diff --git a/.gitattributes b/.gitattributes index 04264fc2..23c0175b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,3 +10,10 @@ # be treated as text and normalized. *.pt binary *.pkl binary + +# ui/dist is a committed build artifact (see AGENTS.md), not hand-written +# source. Mark it generated so GitHub collapses its diffs in PR review by +# default and excludes it from language/diff statistics — CI's "UI build +# artifacts are up to date" check (ci.yml) is what actually vouches for its +# contents, so a reviewer does not need to read every hashed/minified byte. +ui/dist/** linguist-generated=true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e44fab5..2cdc907f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,6 +65,23 @@ jobs: - name: UI unit tests run: node --test --experimental-strip-types ui/tests/*.test.mjs + # ui/dist is committed and embedded in release builds (see AGENTS.md). + # Rebuild it here and fail if the committed copy doesn't match — the + # deterministic-build check backing the generated-file markers below: + # reviewers can trust the diff (or the collapsed "generated" summary) + # reflects a real `ui/src` change, not a stale or hand-edited artifact. + - name: UI build artifacts are up to date + working-directory: ui + run: | + set -euo pipefail + pnpm exec vite build + git add -A -- dist + if ! git diff --cached --quiet -- dist; then + echo "::error::ui/dist is out of date relative to ui/src. Run 'pnpm build' in ui/ and commit the regenerated assets (see AGENTS.md)." + git diff --cached --stat -- dist + exit 1 + fi + - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: diff --git a/AGENTS.md b/AGENTS.md index a41fe616..779dbcfa 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -12,7 +12,7 @@ When changing authentication, organization, sandbox, or managed-compute APIs, in - Rust code lives in `src/`; the dashboard lives in `ui/src/`. Keep local-only behavior local and use the production API client only for capabilities owned by `openresearch.sh`. - Run local app instances through `scripts/dev-slot.mjs` so development data, ports, and processes stay isolated. -- `ui/dist` is committed and embedded in release builds. After UI changes, run `pnpm build` in `ui/` and include the regenerated assets. +- `ui/dist` is committed and embedded in release builds. After UI changes, run `pnpm build` in `ui/` and include the regenerated assets. Prefer a separate commit for the regenerated `ui/dist` from the one changing `ui/src`, so a reviewer can read the source diff on its own and skip the generated one — CI's "UI build artifacts are up to date" check (`ci.yml`) rebuilds `ui/dist` from source and fails the PR if the committed copy doesn't match, so that commit only needs to exist, not be read byte-for-byte. `.gitattributes` marks `ui/dist/**` `linguist-generated=true` so GitHub collapses it in the PR diff by default. - Prefer canonical Tailwind utilities (`flex flex-col h-full min-h-0`) and project theme aliases (`bg-background`, `text-subtext`, `border-border`). Use arbitrary values only when no project utility exists, and preserve semantic marker classes when selectors or runtime behavior depend on them. - Before shipping, follow the checks in `.github/workflows/ci.yml`. diff --git a/README.md b/README.md index a181d618..93d26aae 100644 --- a/README.md +++ b/README.md @@ -77,9 +77,13 @@ Run the workspace next to remote GPUs while using the browser on your laptop: orx up --remote user@host ``` -SSH config aliases and custom ports are supported. The remote service binds to -loopback and has no application-level authentication, so other users on that -host can reach it. +SSH config aliases and custom ports are supported. The remote dashboard binds +to loopback and requires a per-session bearer token minted for this +connection, delivered to it over the SSH channel — other users on that host +cannot reach it. `orx serve` and a bare `orx up` run directly on a box (i.e. +outside this `--remote` flow) are unauthenticated loopback services instead; +see [SECURITY.md](SECURITY.md) for the full trust model, including how to add +a token to `orx serve` on a shared host. ## CLI and agent integration diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..1aa83744 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,211 @@ +# Security model + +`orx` executes code on your own machine and, optionally, on remote hosts you +point it at (SSH targets, Slurm/Kubernetes/Ray clusters, cloud job APIs, and +managed OpenResearch compute). This document is the trust model for that +remote-execution boundary: what's authenticated, what isn't, why, and what to +do differently on a host other people also have accounts on (a shared GPU +server, an HPC login node, a lab workstation). + +It does not cover `openresearch.sh` (accounts, organizations, sandbox +provisioning, managed-compute catalogs) — that's a separate service with its +own security model; see its own docs. + +If you believe you've found a vulnerability, please report it privately +rather than opening a public issue — see "Reporting a vulnerability" below. + +## The short version + +- **Single-user machine (the common case): nothing to configure.** Every + loopback service here assumes it's the only thing bound to `127.0.0.1` on a + box only you have a shell on. That's the actual boundary — not a login + screen. +- **Shared machine, `orx up --remote user@host` from your laptop:** already + safe by default. The dashboard on the remote box requires a per-session + bearer token that never leaves the SSH channel. +- **Shared machine, `orx serve` running on it directly** (the pattern a + managed provider's API tunnels into): **unauthenticated by default.** Pass + `--token` or set `ORX_SERVE_TOKEN` before running it on a box you don't + exclusively control. See [`orx serve`](#orx-serve) below. +- **Shared machine, plain `orx up` run directly on it** (not through + `--remote`): also unauthenticated, for the same reason. Prefer `orx up + --remote` from your laptop instead — it gets you the same dashboard with + the token gate already on. + +## Loopback services and their auth posture + +`orx` runs three independent local HTTP surfaces. All three bind +`127.0.0.1` only — never `0.0.0.0` — but binding loopback keeps *other +machines* out, not *other local accounts* on the same box. Whether that +matters depends on whether you're the only person with a shell there. + +| Service | Default bind | Default auth | When it runs | +|---|---|---|---| +| `orx up` (plain) | `127.0.0.1:4791` | None — loopback is the boundary | Local single-user dashboard | +| `orx up --remote ` | Remote: `127.0.0.1:` (SSH-tunneled). Laptop: `127.0.0.1:` | Per-session bearer token (below) | Working against remote GPUs from a laptop browser | +| `orx serve` | `127.0.0.1:4790` | None by default; opt in with `--token`/`ORX_SERVE_TOKEN` | Exposing the local run store/log stream to another process (typically an API server on the same or a tunneled box) | + +`orx up`'s own module doc states this plainly (`src/commands/up.rs:1-11`): +the normal dashboard is loopback-only with no application-level auth by +design, on the assumption that loopback already means "you." The persistent +remote-host mode adds a session bearer *on top of* loopback specifically +because that assumption stops holding once the box is shared. + +### `orx up --remote ` + +This is the flow to reach for on a shared box, and the one place in the +codebase that already has a full session-auth story: + +1. Your laptop runs `orx up --remote user@host`. It SSHs in, starts `orx + remote-host ensure` on the far end, and mints a random per-connection + bearer token (`uuid4+uuid4`, `src/commands/up_remote.rs`). +2. That token is sent to the remote process over **stdin of the SSH child + process** — never as a CLI argument (so it never shows up in `ps`) and + never echoed by the terminal (`-T`, no PTY; see the doc note at + `src/jobs/ssh.rs` on why the bearer must not hit terminal line + discipline). +3. The remote dashboard's HTTP layer wraps every route in two middleware + layers (`src/commands/up.rs`): `loopback_guard` (Host/Origin/ + `sec-fetch-site` checks — CSRF hardening, not the auth boundary) and + `require_remote_auth`, which SHA-256-digests the request's `Authorization: + Bearer ` and checks it against the set of currently-attached + session tokens, or — for the one-shot callback route a freshly-attaching + client hits before it has a session — against a separate callback secret + compared in constant time (`RemoteAuth::matches_callback`, via + `src/token_auth::constant_time_eq`). +4. Your laptop's local gateway process (`src/commands/up_remote.rs`) is what + the browser actually talks to. It proxies to the remote dashboard over the + SSH tunnel and injects the bearer token **server-side** + (`sanitized_request_headers`) — the token never reaches browser JavaScript + or gets written to disk in the UI. +5. Token lifecycle: minted fresh per `attach`, registered in an in-memory set + for the life of the attach heartbeat loop, and explicitly unregistered on + disconnect or failure (`src/commands/remote_host.rs`, `RemoteAuth:: + register`/`unregister`). There is no persistent token file and no + expiration timer to manage — the token simply stops being valid the + moment the session that minted it ends. Restarting the attach (e.g. after + a laptop sleep/wake) mints a new one; old ones are gone, not merely + expired-but-present. +6. A same-machine control channel (a Unix domain socket, not TCP) gates + attach/status/stop operations on the remote box: connections are checked + against `SO_PEERCRED` for a same-uid match before the token exchange even + starts (`src/commands/remote_host.rs`), and the socket's containing + directory is created `0700` and verified same-owner on every use + (`ensure_private_dir`). This is what stops a different local user on the + shared box from attaching to *your* remote-host process at all, token or + not. +7. **Endpoint minimization is a blocklist today, not an allowlist:** + `remote_route_forbidden` (`src/commands/up.rs`) explicitly denies a + specific set of routes even to a holder of a valid session token (self- + update, data-dir moves, the nested SSH terminal, openresearch login/SSH-key + management) because they're either destructive or would leak credentials + that have nothing to do with running this dashboard. Being a blocklist + means a new dashboard route is remotely reachable by default unless + someone remembers to add it to this list — flag this explicitly in review + whenever a PR adds a new `/api/*` route to `up.rs`. + +Host key handling for the SSH connection itself (`HostKeyPolicy` in +`src/jobs/ssh.rs`) is deliberately scoped by target type, not a single global +policy: + +| Policy | Behavior | Applies to | +|---|---|---| +| `UserConfig` | Defers entirely to your real `~/.ssh/config`/`known_hosts` | `~/.ssh/config` aliases, and `--remote ` when the target is a hostname | +| `AcceptNew` | `StrictHostKeyChecking=accept-new` against your real `known_hosts` — genuine trust-on-first-use; a later key change is still caught and rejected | `--remote :` when the target is a raw IP literal (no `known_hosts` entry would exist for one) | +| `Ephemeral` | `StrictHostKeyChecking=no`, `UserKnownHostsFile=/dev/null` — accepts any key, persists nothing | Only the managed `openresearch_job` backend, whose provider-assigned `host:port` gets recycled between different physical machines, so persisting a host key for it would eventually be a *false* trust signal | + +`Ephemeral` is intentionally the exception, not the default — if you're +adding a new SSH-based backend, it should default to `UserConfig` or +`AcceptNew` unless it shares the same host-recycling property as managed +compute. + +### `orx serve` + +`orx serve` exposes the local SQLite run store and per-run logs read-only +over loopback HTTP/SSE (`src/commands/serve.rs`) — its own doc comment +explains the intended shape: "on an agent box the api SSH-tunnels to it and +re-streams." That description is true of the intended caller, but loopback +binding does not stop an *unintended* one: any other local account on that +box can connect to `127.0.0.1:4790` directly, bypassing the SSH tunnel +entirely, and read every run's metadata and full logs. + +As of this change, `orx serve` supports the same bearer-token pattern as the +`--remote` flow: + +```sh +orx serve --token "$(openssl rand -hex 32)" +# or +ORX_SERVE_TOKEN=... orx serve +``` + +When set, every route — including `/health` — requires a matching +`Authorization: Bearer `, checked as a SHA-256 digest in constant time +(`src/token_auth`, shared with the `--remote` flow rather than a second +implementation of the same check). `/health` is gated too, for the same +reason `orx up --remote`'s own health route is: a liveness probe still +discloses the running version, which is exactly the kind of detail a +same-box attacker uses to target a known CVE. + +**This flag is opt-in, not the default, and that's a real gap.** Whatever +process launches `orx serve` (today, that's `openresearch.sh`'s API tunneling +in over SSH — a separate repository, out of scope for this change per +`AGENTS.md`) has to actually pass a token for this to take effect. If you run +`orx serve` yourself on a box other people also use, pass `--token`. If +you're wiring up an automated launcher, generate a token when you provision +the box and pass it through; don't rely on the loopback bind alone. + +## Credential storage and propagation + +- **openresearch.sh account token** — `~/.config/openresearch/credentials.json` + (`src/config.rs`), created with mode `0600` at open time (not written + world-readable and chmod'd after) and its containing directory tightened to + `0700`, since `~/.config` itself is world-traversable by convention. The + Overleaf token/session cookie (`overleaf.json`, same directory) follows the + identical pattern. +- **SSH keys** — never read or held by `orx` itself. Every SSH operation + shells out to the real `ssh`/`ssh-keygen`/`ssh-add` binaries and only ever + handles the *public* half in-process (`src/local/ssh_identity.rs`, + `src/commands/ssh_key.rs`); pasting a private key into the CLI is rejected. +- **Compute-provider secrets** (Hugging Face, Modal, Weights & Biases, + provider-specific tokens, etc.) reach the remote job as **environment + variables written into the generated `run.sh`, or a platform Secret + object** — never as a `Command` argument, so they're never visible to + other local users on either end via `ps`. Kubernetes uses a real `Secret` + (`src/jobs/kubernetes.rs`) referenced via `secretRef`; Modal uses an + ephemeral Secret (`src/jobs/modal.rs`); SSH/local backends write `export + KEY=...` lines into a `run.sh` that lives inside a `chmod 700` run + directory (`src/jobs/ssh.rs`, `src/jobs/localbox.rs`). +- **`~/.openresearch/env`** (synced provider tokens, e.g. `HF_TOKEN`) is read + by `synced_env_var`/`list_synced_env` and written by `orx` itself via + `write_synced_env_var`(`s`) — all in `src/config.rs`, all now routed + through the same owner-only-at-creation helper as `credentials.json` + above. `openresearch.sh` (out of scope for this change per `AGENTS.md`) may + also write to this file as part of its own sync flow; if you operate a + shared box, confirm that side creates it `0600` too rather than assuming + it inherits `orx`'s guarantee. +- No secret is ever passed as a literal CLI argument anywhere in this + codebase (checked as part of this audit) — the one place that would show + up in `ps` for any other local user on the box. + +## Testing unauthorized local-user access + +- `src/commands/serve.rs` and `src/token_auth.rs` carry tests exercising the + new `orx serve` token gate end-to-end over a real loopback socket (missing + token, wrong token, correct token, and that the gate applies to every + route, not just `/health`), plus unit coverage of the digest/constant-time- + compare primitives themselves. +- `src/config.rs` carries tests confirming the credential-file helpers + actually produce `0600`/`0700` on disk (both for a freshly created path and + for tightening a stale, looser-permissioned one from before this change) — + the property this whole section depends on, now enforced rather than only + asserted in a doc comment. +- `src/commands/remote_host.rs` and `src/commands/up_remote.rs` already had + coverage for the `--remote` bearer/callback distinction and the + `SO_PEERCRED` same-uid gate before this change. + +## Reporting a vulnerability + +Please don't open a public GitHub issue for a suspected vulnerability. Email +the maintainers (see the repository's contact info on GitHub) with a +description and reproduction steps; we'll acknowledge and follow up from +there. diff --git a/src/cli/agent.rs b/src/cli/agent.rs new file mode 100644 index 00000000..02fbc9db --- /dev/null +++ b/src/cli/agent.rs @@ -0,0 +1,32 @@ +use clap::{Args, Subcommand}; + +#[derive(Args, Debug)] +pub struct AgentArgs { + #[command(subcommand)] + pub command: AgentCommand, +} + +#[derive(Subcommand, Debug)] +pub enum AgentCommand { + /// Hand a task to a helper agent running in its own top-level session. + Spawn { + /// What the helper agent should do. Write it as a self-contained brief: + /// the helper starts with an empty transcript and cannot see this chat. + task: Option, + /// Read the task from stdin instead, for long multi-paragraph briefs. + #[arg(long)] + stdin: bool, + /// Name the session in the sidebar. Defaults to an auto-generated title. + #[arg(long)] + title: Option, + /// Harness for the helper (defaults to this session's). + #[arg(long)] + harness: Option, + /// Model for the helper (defaults to this session's). + #[arg(long)] + model: Option, + /// Do not resume this chat when the helper finishes. + #[arg(long)] + no_wake: bool, + }, +} diff --git a/src/cli/auth.rs b/src/cli/auth.rs new file mode 100644 index 00000000..6a8e82f8 --- /dev/null +++ b/src/cli/auth.rs @@ -0,0 +1,8 @@ +use clap::Args; + +#[derive(Args, Debug)] +pub struct LoginArgs { + /// Override the API base URL (or set OPENRESEARCH_API_URL). + #[arg(long = "api-url")] + pub api_url: Option, +} diff --git a/src/cli/compute.rs b/src/cli/compute.rs new file mode 100644 index 00000000..cda15d47 --- /dev/null +++ b/src/cli/compute.rs @@ -0,0 +1,98 @@ +use clap::{Args, Subcommand}; + +#[derive(Args, Debug)] +pub struct ComputeArgs { + /// List CPU-only instance offers instead of the GPU catalog. CPU instances + /// suit GPU-less experiments (data prep, eval harnesses, CPU-bound papers). + #[arg(long)] + pub cpu: bool, + /// Filter to one GPU id (e.g. `H100_SXM`). Case-insensitive. GPU mode only. + #[arg(long)] + pub gpu: Option, + /// Filter to a specific GPU count per instance. GPU mode only. + #[arg(long)] + pub count: Option, + /// Filter to one provider (e.g. `runpod`, `vast`, `lambda`). Case-insensitive. GPU mode only. + #[arg(long)] + pub provider: Option, +} + +#[derive(Args, Debug)] +pub struct SshKeyArgs { + #[command(subcommand)] + pub command: SshKeyCommand, +} + +#[derive(Subcommand, Debug)] +pub enum SshKeyCommand { + /// Register a public key on your account. Every box in your orgs — including + /// ones already running — starts accepting it. + Add(SshKeyAddArgs), + /// List registered keys, marking the ones usable from this computer. + List, +} + +#[derive(Args, Debug)] +pub struct SshKeyAddArgs { + /// Public key path. Without a path, reuse ~/.ssh/id_ed25519.pub or create a key pair. + pub path: Option, +} + +#[derive(Args, Debug)] +pub struct InstanceArgs { + #[command(subcommand)] + pub command: InstanceCommand, +} + +#[derive(Subcommand, Debug)] +pub enum InstanceCommand { + /// Provision a standalone instance in an org (GPU with `--gpu`, or CPU with + /// `--cpu`). Not tied to an experiment — like the dashboard's "Spin up". + Create(InstanceCreateArgs), + /// List an org's instances (status, SSH endpoint, price) — including any + /// `--backend openresearch` box a failed teardown left behind. + List(InstanceListArgs), + /// Terminate an instance (destroys the provider machine). The manual + /// cleanup path when a run's automatic teardown failed. + Delete(InstanceDeleteArgs), +} + +#[derive(Args, Debug)] +pub struct InstanceCreateArgs { + /// Organization id (from `orx orgs`). + pub org_id: String, + /// Provision a GPU instance with this GPU id, e.g. `H100_SXM` — the exact id + /// from `orx compute`, not a family name like `H100`. + #[arg(long)] + pub gpu: Option, + /// GPUs per instance (with `--gpu`; default 1). + #[arg(long)] + pub count: Option, + /// Disk in GB (with `--gpu`; default 100). + #[arg(long)] + pub disk: Option, + /// Provider to provision from (with `--gpu`), e.g. runpod, vast, lambda. + /// Omit to pick the cheapest matching offer across providers (like the + /// dashboard). See `orx compute` for providers; validated server-side. + #[arg(long)] + pub provider: Option, + /// Provision a CPU-only instance with this flavor: cpu5c (compute), cpu5g + /// (general), or cpu5m (memory-optimized). Mutually exclusive with `--gpu`. + #[arg(long)] + pub cpu: Option, + /// vCPUs for a CPU instance (with `--cpu`): 2, 8, or 32 (default 8). + #[arg(long)] + pub vcpus: Option, +} + +#[derive(Args, Debug)] +pub struct InstanceListArgs { + /// Organization id (from `orx orgs`). + pub org_id: String, +} + +#[derive(Args, Debug)] +pub struct InstanceDeleteArgs { + /// The instance (sandbox) id to terminate. + pub sandbox_id: String, +} diff --git a/src/cli/daemon.rs b/src/cli/daemon.rs new file mode 100644 index 00000000..aacb687c --- /dev/null +++ b/src/cli/daemon.rs @@ -0,0 +1,67 @@ +use clap::{Args, Subcommand}; + +#[derive(Args, Debug)] +pub struct ServeArgs { + /// Port to bind on 127.0.0.1 (default 4790 — what the api proxies to). + #[arg(long)] + pub port: Option, + /// Require `Authorization: Bearer ` on every request. Falls back + /// to the `ORX_SERVE_TOKEN` env var when omitted. Unset by default for + /// backward compatibility, but strongly recommended whenever this runs + /// on a host other local users can reach — see SECURITY.md. + #[arg(long)] + pub token: Option, +} + +#[derive(Args, Debug)] +pub struct SuperviseArgs { + /// The run to supervise (must exist in the local store). + pub run_id: String, +} + +#[derive(Args, Debug)] +pub struct UpArgs { + /// Port to bind on 127.0.0.1. With `--remote`, the local presentation port. + #[arg(long, default_value_t = 4791)] + pub port: u16, + /// Run `orx up` on a remote box over SSH and forward it here. The value is + /// an `~/.ssh/config` host alias, or `user@host` (append `:PORT` for a + /// non-standard SSH port, e.g. `root@1.2.3.4:38455`). Only user@host + port + /// are reconstructed; a custom key or jump host must come from `~/.ssh/config`. + /// Starts an authenticated server there, tunnels it through a hidden local + /// port, and opens a dedicated local presentation gateway in your browser. + #[arg(long, value_name = "HOST")] + pub remote: Option, + /// Don't open the dashboard in the browser on startup. + #[arg(long)] + pub no_browser: bool, + /// Don't spawn the opencode agent on startup (for tests). + #[arg(long)] + pub no_agent: bool, + /// opencode model override, e.g. `anthropic/claude-sonnet-4-5`. + #[arg(long)] + pub model: Option, + /// Internal persistent dashboard/agent-host mode. + #[arg(long, hide = true)] + pub remote_host: bool, +} + +#[derive(Args, Clone, Debug)] +pub struct RemoteHostArgs { + #[command(subcommand)] + pub command: RemoteHostCommand, +} + +#[derive(Clone, Subcommand, Debug)] +pub enum RemoteHostCommand { + Ensure { + #[arg(long)] + expected_instance: Option, + }, + Status, + Attach { + #[arg(long)] + expected_instance: String, + }, + Stop, +} diff --git a/src/cli/discover.rs b/src/cli/discover.rs new file mode 100644 index 00000000..1f39743d --- /dev/null +++ b/src/cli/discover.rs @@ -0,0 +1,106 @@ +use clap::{Args, Subcommand, ValueEnum}; + +/// Which corpus a literature command searches or reads from. +#[derive(ValueEnum, Clone, Copy, Debug, PartialEq, Eq)] +#[value(rename_all = "lower")] +pub enum LitSource { + /// alphaXiv (arXiv corpus: CS, math, physics, stats — the default). + Alphaxiv, + /// OpenAlex (general scholarly graph across all disciplines). + Openalex, + /// bioRxiv biology preprints (searched via OpenAlex, fetched via bioRxiv). + Biorxiv, +} + +impl LitSource { + /// Lowercase wire name used to enforce against the Settings disable-set. + /// Matches the `--source` flag values (clap `rename_all = "lower"`) and the + /// `LitHit.source` JSON labels. + pub fn as_str(&self) -> &'static str { + match self { + LitSource::Alphaxiv => "alphaxiv", + LitSource::Openalex => "openalex", + LitSource::Biorxiv => "biorxiv", + } + } + + /// Human-facing name for error/UI text. + pub fn display_name(&self) -> &'static str { + match self { + LitSource::Alphaxiv => "alphaXiv", + LitSource::Openalex => "OpenAlex", + LitSource::Biorxiv => "bioRxiv", + } + } +} + +#[derive(Args, Debug)] +pub struct DiscoverArgs { + #[command(subcommand)] + pub command: DiscoverCommand, +} + +#[derive(Subcommand, Debug)] +pub enum DiscoverCommand { + /// alphaXiv full-text BM25 retrieval with match snippets. + Keyword(DiscoverySearchArgs), + /// alphaXiv semantic title/abstract retrieval with similarity/popularity reranking. + Embedding(DiscoverySearchArgs), + /// OpenAlex scholarly-graph search across disciplines. + Openalex(DiscoverySearchArgs), + /// bioRxiv preprint search through OpenAlex's bioRxiv source index. + Biorxiv(DiscoverySearchArgs), +} + +#[derive(Args, Debug)] +pub struct DiscoverySearchArgs { + /// Exact keyword query or semantic description, depending on the strategy. + pub query: String, + /// Include papers first published on or after this date (YYYY-MM-DD). + #[arg(long = "published-after")] + pub published_after: Option, + /// Include papers first published on or before this date (YYYY-MM-DD). Older + /// or narrow embedding windows can return a thin candidate set. + #[arg(long = "published-before")] + pub published_before: Option, + /// Ranking policy after topical relevance is accounted for. + #[arg(long, value_enum, default_value = "default")] + pub prioritize: DiscoveryPriority, + /// Maximum results to emit (default 15). alphaXiv uses its fixed server-side candidate pool. + #[arg(long, default_value_t = 15, value_parser = clap::value_parser!(u32).range(1..=200))] + pub limit: u32, +} + +#[derive(ValueEnum, Clone, Copy, Debug, PartialEq, Eq)] +#[value(rename_all = "lower")] +pub enum DiscoveryPriority { + Historical, + Default, + Recency, + Popular, +} + +impl DiscoveryPriority { + pub fn as_str(self) -> &'static str { + match self { + Self::Historical => "historical", + Self::Default => "default", + Self::Recency => "recency", + Self::Popular => "popular", + } + } +} + +#[derive(Args, Debug)] +pub struct PaperArgs { + /// Paper id: an arXiv id / URL (alphaXiv), a DOI (bioRxiv `10.1101/…` or any + /// other), or an OpenAlex `W…` id. The source is auto-detected. + pub id: String, + /// Force the source instead of auto-detecting it from the id. + #[arg(long, value_enum)] + pub source: Option, + /// Fetch the full extracted paper text instead of the report (alphaXiv only; + /// OpenAlex/bioRxiv have no extracted full text and point you at the PDF). + #[arg(long)] + pub full: bool, +} diff --git a/src/cli/experiments.rs b/src/cli/experiments.rs new file mode 100644 index 00000000..302e7288 --- /dev/null +++ b/src/cli/experiments.rs @@ -0,0 +1,181 @@ +use clap::{Args, Subcommand}; + +#[derive(Args, Debug)] +pub struct RunsArgs { + pub project_id: String, + /// Filter to one experiment. + #[arg(long)] + pub experiment: Option, +} + +#[derive(Args, Debug)] +pub struct LogsArgs { + pub run_id: String, + /// Read from the start instead of the tail. + #[arg(long)] + pub head: bool, + /// Max bytes to read. + #[arg(long)] + pub bytes: Option, + /// Exact byte window `:`. + #[arg(long)] + pub range: Option, +} + +#[derive(Args, Debug)] +pub struct CreateExperimentArgs { + /// Local project id from `orx projects`. + pub project_id: String, + /// Experiment title (required). + #[arg(long)] + pub title: Option, + /// Experiment description. + #[arg(long)] + pub description: Option, + /// Parent experiment id -> create a child. Omit on an empty project to + /// create the baseline (root); once a root exists, attach under it. + #[arg(long)] + pub parent: Option, + /// Create a new baseline (root) even when the project already has one. + /// Conflicts with --parent. Projects may hold multiple baselines. + #[arg(long, conflicts_with = "parent")] + pub baseline: bool, + /// Run command for the node. Omit to inherit from the parent/project default. + #[arg(long = "run-command")] + pub run_command: Option, +} + +#[derive(Args, Debug)] +pub struct ExpArgs { + #[command(subcommand)] + pub command: ExpCommand, +} + +#[derive(Subcommand, Debug)] +pub enum ExpCommand { + /// Show the experiment's status, run command, and latest run. + Status { exp_id: String }, + + /// View the experiment's description/notes, or overwrite it with `--set` / `--stdin`. + Desc { + exp_id: String, + /// Overwrite the description with this value. + #[arg(long)] + set: Option, + /// Overwrite the description with the whole of stdin (for long markdown docs). + #[arg(long)] + stdin: bool, + }, + + /// Launch a locally initialized experiment through an orx-supervised backend. + Run(Box), + + /// Cancel the in-flight run. + Cancel { exp_id: String }, + + /// Resume this agent after the experiment's latest run succeeds or fails. + Wake { exp_id: String }, + + /// Wait for a run to finish: one experiment (``) or the next completion in a project (`--project`). + Wait { + /// Experiment to watch; its latest run is polled until it reaches a + /// terminal state. Omit and pass `--project` to watch a whole project. + exp_id: Option, + /// Watch every run in this project and return on the FIRST one to + /// complete (reach done/failed/cancelled) — a "slot freed" signal. Call + /// it in a loop, re-listing `orx runs` on each return to catch all + /// finished runs. Returns immediately ("drained: no runs in flight") if + /// none are in flight. Mutually exclusive with ``. + #[arg(long)] + project: Option, + /// Give up and exit non-zero after this many seconds (default 1800). + #[arg(long)] + timeout: Option, + /// Seconds between polls (default 5). + #[arg(long)] + interval: Option, + }, +} + +#[derive(Args, Debug)] +pub struct ExpRunArgs { + pub exp_id: String, + /// Disk in GB for a `--backend openresearch` instance (default 100). + #[arg(long)] + pub disk: Option, + /// Provider for a `--backend openresearch` GPU flavor. When omitted, the + /// cheapest qualified offer is selected. + #[arg(long)] + pub provider: Option, + /// orx-supervised executor: `hf` (Hugging Face Jobs, + /// billed to your HF account), `modal` (a Modal Sandbox on your own Modal + /// account, billed per second), `k8s` (a Job on your own Kubernetes + /// cluster), `ssh` (a detached process on one of your own boxes), `slurm` + /// (a batch job on your Slurm cluster, submitted via its login node), + /// `ray` (a job on your Ray cluster, via the Ray Jobs API), `openresearch` + /// (an ephemeral OpenResearch GPU/CPU box billed to your org; needs + /// `orx login`), `tinker` (a local controller using remote Tinker model + /// compute), or `local` (a detached process on this machine). k8s, + /// ssh, slurm, ray, openresearch, tinker, and local are local + /// experiments only. orx submits the job and a detached supervisor + /// records status and logs locally. Omitted on a local experiment: launches on + /// the configured default compute target, if set. + #[arg(long)] + pub backend: Option, + /// Hardware flavor. With `--backend hf`: t4-small, a10g-small, a100-large, + /// h200, … With `--backend modal`: a Modal GPU (t4, l4, a10g, a100, + /// a100-80gb, l40s, h100, h200, or e.g. h100:2) or cpu/cpu-large. With + /// `--backend slurm`: a GPU request as a GRES spec (h100:2 → --gres=gpu:h100:2; + /// plain `gpu` → one GPU; omit for CPU-only). With `--backend ray`: optional + /// entrypoint resources (`cpu:2`, `gpu:1`, `gpu:1,mem:8GiB`; omit to reserve + /// nothing). With `--backend openresearch`: a GPU id from `orx compute` + /// (h100_sxm, or h100_sxm:2 for two) or a CPU flavor (cpu5c/cpu5g/cpu5m, or + /// cpu5c:32 for the vCPU tier). Not used by k8s (see --manifest) or ssh + /// (see --host). + #[arg(long)] + pub flavor: Option, + /// The org to bill the box to (with `--backend openresearch`). Omit when + /// you belong to exactly one org. + #[arg(long)] + pub org: Option, + /// The ~/.ssh/config host alias to run on (with `--backend ssh`), or the + /// cluster login node (with `--backend slurm`; defaults to the slurm + /// settings' host). + #[arg(long)] + pub host: Option, + /// Repo-relative path to the k8s manifest on the experiment branch (with + /// `--backend k8s`; default .orx/k8s.yaml). The manifest declares the run's + /// resources — image, GPUs, topology — and orx injects the run script, env + /// Secret, labels, and a default timeout. See `orx skill` for the contract. + #[arg(long)] + pub manifest: Option, + /// Docker image for the job (with `--backend hf/modal`). Defaults to + /// python:3.12 on CPU flavors, a CUDA pytorch image otherwise. With + /// `--backend k8s`, set the image in the manifest instead. + #[arg(long)] + pub image: Option, + /// Job timeout (with `--backend hf/modal/k8s/slurm/openresearch`): 90s, + /// 30m, 4h, 1d. Default 4h (HF's own default is only 30 minutes). With + /// `--backend k8s` it becomes activeDeadlineSeconds unless the manifest + /// sets its own. With `--backend slurm` it becomes `#SBATCH --time=` and + /// has no 4h default — unset falls back to the slurm settings, then the + /// cluster's own limit. With `--backend openresearch` it bounds the run's + /// wall clock on the box (the box itself is deleted when the run ends). + /// Not supported with `--backend ray` (Ray Jobs have no time limit). + #[arg(long)] + pub timeout: Option, + /// Launch even when another run is already in flight for this experiment. + #[arg(long)] + pub force: bool, + /// Internal attribution forwarded through the local orx up API. + #[arg(skip)] + pub chat_session_id: Option, +} + +impl ExpRunArgs { + pub fn launching_chat_session(&self) -> Option { + self.chat_session_id + .clone() + .or_else(crate::local::chat::launching_chat_session) + } +} diff --git a/src/cli/library.rs b/src/cli/library.rs new file mode 100644 index 00000000..45114865 --- /dev/null +++ b/src/cli/library.rs @@ -0,0 +1,33 @@ +use clap::{Args, Subcommand}; + +#[derive(Args, Debug)] +pub struct SkillArgs { + pub path: Option, +} + +#[derive(Args, Debug)] +pub struct LibraryArgs { + #[command(subcommand)] + pub command: LibraryCommand, +} + +#[derive(Subcommand, Debug)] +pub enum LibraryCommand { + /// Save a file or ZIP across projects; replaces an existing entry of the same name. + Add { path: std::path::PathBuf }, +} + +#[derive(Args, Debug)] +pub struct InstallSkillsArgs { + /// Which agent(s) to install into: `claude`, `codex`, `opencode`, `cursor`, + /// or `all`. Defaults to every agent already set up on this machine. + #[arg(long)] + pub agent: Option, + + /// Also install the full set of modular `orx` skills (~8 always-listed + /// skills) into the agent's global skills dir, not just the thin shim. + /// Intended for dedicated/orx-only environments. In a general-purpose setup + /// the always-on skills add noise, so the default is the shim alone. + #[arg(long)] + pub full: bool, +} diff --git a/src/cli/mod.rs b/src/cli/mod.rs new file mode 100644 index 00000000..496c670d --- /dev/null +++ b/src/cli/mod.rs @@ -0,0 +1,340 @@ +//! The `orx` CLI schema: the top-level command tree plus every subcommand's +//! argument/subcommand types, split by domain. `main.rs` re-exports every +//! public item here at the crate root (`pub use cli::*;`), so the rest of the +//! codebase keeps addressing them as `crate::LoginArgs`, `crate::Command`, etc. +//! — module boundaries here are purely organizational. + +mod agent; +mod auth; +mod compute; +mod daemon; +mod discover; +mod experiments; +mod library; +mod projects; +mod system; + +pub use agent::*; +pub use auth::*; +pub use compute::*; +pub use daemon::*; +pub use discover::*; +pub use experiments::*; +pub use library::*; +pub use projects::*; +pub use system::*; + +use clap::{Args, Parser, Subcommand}; + +#[derive(Parser, Debug)] +#[command( + name = "orx", + about = "OpenResearch CLI", + version, + disable_help_subcommand = true +)] +pub struct Cli { + // Optional so a bare `orx` prints USAGE to stdout and exits 0 (like the TS + // `if (!command) { console.log(USAGE); return; }`) instead of clap's exit-2. + #[command(subcommand)] + pub command: Option, + + /// Disable anonymous usage analytics for this run. To disable it + /// persistently, run `orx telemetry off`. + #[arg(long, global = true)] + pub no_telemetry: bool, +} + +#[derive(Subcommand, Debug)] +// NOTE: `local::harness::plan_gate` keeps a hand-maintained allowlist of the +// read-only verbs here (what Claude plan mode may run without approval). When +// you add a *read-only* subcommand, add it there too, or it stays gated in plan +// mode. `readonly_verbs_are_real_commands` catches renames but not additions. +pub enum Command { + /// Log in via the browser and store a token. + Login(LoginArgs), + + /// Remove the stored token. + Logout, + + /// List projects registered in the local orx store. + Projects(ProjectsArgs), + + /// List organizations available for OpenResearch compute. + Orgs(OrgsArgs), + + /// Operate on one local project. + Project(ProjectArgs), + + /// Delegate a task to a second agent session. + Agent(AgentArgs), + + /// List a project's runs. + Runs(RunsArgs), + + /// Read a run's terminal log (tail by default). + Logs(LogsArgs), + + /// Add an experiment node to a local `orx up` project. + #[command(name = "create-experiment")] + CreateExperiment(CreateExperimentArgs), + + /// List the GPU compute catalog. + Compute(ComputeArgs), + + /// Spin up standalone compute in an organization (no experiment). + Instance(InstanceArgs), + + /// Register this computer's SSH key so the boxes you provision accept it. + #[command(name = "ssh-key")] + SshKey(SshKeyArgs), + + /// Operate on one local experiment node. + Exp(ExpArgs), + + /// Print CLI usage for agents, or fetch a skill doc. + Skill(SkillArgs), + + /// Add reusable skills to the local OpenResearch library. + Skills(LibraryArgs), + + /// Add reusable LaTeX templates to the local OpenResearch library. + Templates(LibraryArgs), + + /// Install the OpenResearch skill into local coding agents (Claude Code, Codex, OpenCode, Cursor). + #[command(name = "install-skills")] + InstallSkills(InstallSkillsArgs), + + /// Call one paper-retrieval primitive; the caller owns the search loop. + Discover(DiscoverArgs), + + /// Fetch a paper: alphaXiv report/full-text, or OpenAlex/bioRxiv metadata. + /// The source is auto-detected from the id (override with `--source`). + Paper(PaperArgs), + + /// Show the CLI version; `--check` compares it to the latest release. + Version(VersionArgs), + + /// Update orx to the latest release (installer-script installs only). + Update(UpdateArgs), + + /// Link the macOS app's `orx` onto your PATH (macOS app installs only). + InstallCli(InstallCliArgs), + + /// Permanently delete the local database, CLI executable, or both. + Delete(DeleteArgs), + + /// Loopback HTTP/SSE daemon over the local run store (jobs sibling of + /// `opencode serve`); the api tunnels to it on agent boxes. + Serve(ServeArgs), + + /// Supervise one local run: tail backend logs, persist status, and honor + /// local cancel intent. Spawned detached by `exp run`. + Supervise(SuperviseArgs), + + /// Start the local autoresearch dashboard on 127.0.0.1: embedded UI, + /// JSON/SSE API over the local store, and the opencode agent proxy. + Up(UpArgs), + + /// Turn anonymous usage analytics on or off, or show current status. + Telemetry(TelemetryArgs), + + /// Internal: the Claude plan-mode `PreToolUse` hook body. Reads the hook + /// payload on stdin and prints an allow decision for read-only `orx` + /// inspection; not a user command. + #[command(name = "plan-gate", hide = true)] + PlanGate, + + /// Internal: the plan-mode permission bridge. A stdio MCP server Claude + /// Code spawns (`--mcp-config`) and consults (`--permission-prompt-tool`); + /// relays each permission request to the running `orx up`, which surfaces + /// an approval card and blocks until answered. Not a user command. + #[command(name = "mcp-gate", hide = true)] + McpGate, + + /// Internal: detached worker for optional local-project publication. + #[command(name = "publish-branch", hide = true)] + PublishBranch(PublishBranchArgs), + + /// Internal: manage a persistent SSH remote host. + #[command(name = "remote-host", hide = true)] + RemoteHost(RemoteHostArgs), +} + +#[derive(Args, Debug)] +pub struct PublishBranchArgs { + pub repo_path: std::path::PathBuf, + pub branch: String, + pub owner: String, + pub repo: String, +} + +#[cfg(test)] +mod cli_tests { + use super::*; + + /// A double-clicked orx.exe reaches `up` through this parse; an argv clap + /// rejected would panic there instead of opening the dashboard. + #[test] + fn a_double_click_parses_as_a_local_up() { + assert!(matches!( + Cli::parse_from(["orx", "up"]).command, + Some(Command::Up(args)) if args.remote.is_none() + )); + } + + #[test] + fn library_add_commands_are_distinct_from_reading_skill_docs() { + for name in ["skills", "templates"] { + let cli = Cli::try_parse_from(["orx", name, "add", "./package.zip"]).unwrap(); + let args = match cli.command.unwrap() { + Command::Skills(args) | Command::Templates(args) => args, + _ => panic!("expected a library command"), + }; + let LibraryCommand::Add { path } = args.command; + assert_eq!(path, std::path::PathBuf::from("./package.zip")); + assert!(Cli::try_parse_from(["orx", name, "add"]).is_err()); + } + } + + #[test] + fn internal_commands_do_not_emit_command_telemetry() { + assert!(!crate::should_capture_command(&Command::Supervise( + SuperviseArgs { + run_id: "run-1".into(), + } + ))); + assert!(!crate::should_capture_command(&Command::Update( + UpdateArgs { + background: true, + dry_run: false, + force: false, + } + ))); + assert!(crate::should_capture_command(&Command::Update( + UpdateArgs { + background: false, + dry_run: true, + force: false, + } + ))); + } + + #[test] + fn discover_parses_independent_retrieval_options() { + let cli = Cli::try_parse_from([ + "orx", + "discover", + "embedding", + "test-time compute", + "--published-after", + "2024-01-01", + "--published-before", + "2025-12-31", + "--prioritize", + "historical", + "--limit", + "9", + ]) + .expect("discover embedding should parse"); + + let Some(Command::Discover(DiscoverArgs { + command: DiscoverCommand::Embedding(args), + })) = cli.command + else { + panic!("expected discover embedding command"); + }; + assert_eq!(args.query, "test-time compute"); + assert_eq!(args.published_after.as_deref(), Some("2024-01-01")); + assert_eq!(args.published_before.as_deref(), Some("2025-12-31")); + assert_eq!(args.prioritize, DiscoveryPriority::Historical); + assert_eq!(args.limit, 9); + } + + #[test] + fn discover_parses_openalex_and_biorxiv_primitives() { + for (source, expected) in [ + ("openalex", LitSource::Openalex), + ("biorxiv", LitSource::Biorxiv), + ] { + let cli = Cli::try_parse_from(["orx", "discover", source, "protein folding"]) + .expect("source discovery should parse"); + let Some(Command::Discover(DiscoverArgs { command })) = cli.command else { + panic!("expected discover command"); + }; + let actual = match command { + DiscoverCommand::Openalex(_) => LitSource::Openalex, + DiscoverCommand::Biorxiv(_) => LitSource::Biorxiv, + _ => panic!("expected non-alphaXiv discovery source"), + }; + assert_eq!(actual, expected); + } + } + + #[test] + fn run_accepts_only_supervised_backend_flags() { + for flag in ["--gpu", "--cpu", "--sandbox"] { + let error = Cli::try_parse_from(["orx", "exp", "run", "exp-1", flag, "value"]) + .expect_err("unsupported run flag should not parse"); + assert_eq!( + error.kind(), + clap::error::ErrorKind::UnknownArgument, + "{flag}" + ); + } + } + + #[test] + fn research_state_commands_are_local_only() { + for command in [ + "explore", + "experiments", + "env", + "search-logs", + "artifacts", + "artifact", + "wandb", + "query", + "chart", + "report", + ] { + let error = Cli::try_parse_from(["orx", command]) + .expect_err("removed research command should not parse"); + assert_eq!(error.kind(), clap::error::ErrorKind::InvalidSubcommand); + } + + let error = Cli::try_parse_from(["orx", "exp", "cmd", "exp-1"]) + .expect_err("per-experiment run command should not parse"); + assert_eq!(error.kind(), clap::error::ErrorKind::InvalidSubcommand); + + let error = Cli::try_parse_from(["orx", "projects", "--all"]) + .expect_err("local projects have no archived state"); + assert_eq!(error.kind(), clap::error::ErrorKind::UnknownArgument); + + Cli::try_parse_from(["orx", "orgs", "--json"]).expect("orgs should parse"); + } + + #[test] + fn openresearch_backend_and_flavor_still_parse() { + let cli = Cli::try_parse_from([ + "orx", + "exp", + "run", + "exp-1", + "--backend", + "openresearch", + "--flavor", + "h100_sxm", + ]) + .expect("local OpenResearch launch should parse"); + + let Some(Command::Exp(ExpArgs { + command: ExpCommand::Run(args), + })) = cli.command + else { + panic!("expected exp run command"); + }; + assert_eq!(args.backend.as_deref(), Some("openresearch")); + assert_eq!(args.flavor.as_deref(), Some("h100_sxm")); + } +} diff --git a/src/cli/projects.rs b/src/cli/projects.rs new file mode 100644 index 00000000..143f457f --- /dev/null +++ b/src/cli/projects.rs @@ -0,0 +1,39 @@ +use clap::{Args, Subcommand}; + +#[derive(Args, Debug)] +pub struct ProjectsArgs { + /// Emit local project records as JSON. + #[arg(long)] + pub json: bool, +} + +#[derive(Args, Debug)] +pub struct OrgsArgs { + /// Emit organization records as JSON. + #[arg(long)] + pub json: bool, +} + +#[derive(Args, Debug)] +pub struct ProjectArgs { + #[command(subcommand)] + pub command: ProjectCommand, +} + +#[derive(Subcommand, Debug)] +pub enum ProjectCommand { + /// Show a local project's details and experiment tree. + View { project_id: String }, + + /// Edit a local project's name or run command. + Edit { + project_id: String, + /// Rename the project. + #[arg(long)] + name: Option, + /// Set the project's default run command. + /// New experiments inherit it; pass '' to clear. + #[arg(long = "run-command")] + run_command: Option, + }, +} diff --git a/src/cli/system.rs b/src/cli/system.rs new file mode 100644 index 00000000..355df06b --- /dev/null +++ b/src/cli/system.rs @@ -0,0 +1,72 @@ +use clap::{Args, Subcommand}; + +#[derive(Args, Debug)] +pub struct VersionArgs { + /// Print the embedded telemetry build channel. + #[arg(long, hide = true, conflicts_with_all = ["check", "json"])] + pub build_channel: bool, + /// Also check the latest released version on GitHub. + #[arg(long)] + pub check: bool, + /// Emit a JSON object instead of text (implies --check). + #[arg(long)] + pub json: bool, + /// Print the dashboard protocol understood by this binary. + #[arg(long, hide = true, conflicts_with_all = ["check", "json", "build_channel"])] + pub dashboard_protocol: bool, +} + +#[derive(Args, Debug)] +pub struct UpdateArgs { + /// Report whether an update is available without installing anything. + #[arg(long)] + pub dry_run: bool, + /// Update even when the binary doesn't match the install receipt + /// (multiple copies, or a `cargo install` overwrote it). + #[arg(long)] + pub force: bool, + /// Internal: the detached auto-updater. Silent, and records its outcome so + /// repeated failures back off. + #[arg(long, hide = true)] + pub background: bool, +} + +#[derive(Args, Debug)] +pub struct InstallCliArgs { + /// Replace an existing `orx` on your PATH. + #[arg(long)] + pub force: bool, +} + +#[derive(Args, Debug)] +pub struct DeleteArgs { + #[command(subcommand)] + pub command: DeleteCommand, +} + +#[derive(Subcommand, Debug, Clone, Copy)] +pub enum DeleteCommand { + /// Delete only orx.db and its SQLite sidecars. Project folders are untouched. + #[command(alias = "db")] + Database, + /// Delete the running orx executable and its matching installer receipt. + Cli, + /// Delete both the database and CLI executable. + All, +} + +#[derive(Args, Debug)] +pub struct TelemetryArgs { + #[command(subcommand)] + pub command: TelemetryCommand, +} + +#[derive(Subcommand, Debug)] +pub enum TelemetryCommand { + /// Show whether analytics is on, why, and the anonymous install id. + Status, + /// Enable anonymous usage analytics. + On, + /// Disable anonymous usage analytics on this machine. + Off, +} diff --git a/src/commands/exp.rs b/src/commands/exp.rs index 967e59fe..9c0efe7e 100644 --- a/src/commands/exp.rs +++ b/src/commands/exp.rs @@ -8,6 +8,7 @@ //! Unlike the project-scoped data commands, every verb here takes an //! *experiment* id from `orx project view `. +use std::collections::HashMap; use std::time::{Duration, Instant}; use crate::error::{anyhow, Result}; @@ -15,6 +16,13 @@ use crate::plane::{resolve_experiment, resolve_project}; use crate::store::Store; use crate::ExpCommand; +/// How many consecutive reconciliation passes may fail to (re)spawn a +/// supervisor for the same run before giving up on it. Each pass is spaced +/// `RUN_RECONCILE_INTERVAL` apart (`commands::up`), so this is a bound on how +/// long orx keeps retrying a broken installation (binary missing, resource +/// limits) rather than leaving the run stuck `Starting`/`Running` forever. +const MAX_SUPERVISOR_SPAWN_ATTEMPTS: u32 = 5; + pub async fn run(args: crate::ExpArgs) -> Result<()> { let store = Store::open()?; match args.command { @@ -164,6 +172,91 @@ pub(crate) fn spawn_detached_supervise(run_id: &str) -> Result<()> { Ok(()) } +/// Crash recovery: find every locally-owned run that is still `Starting`/ +/// `Running` but has no supervisor left watching it — because `orx up` (or +/// the CLI) restarted after a crash/reboot, or because a supervisor died +/// mid-flight without the process that spawned it noticing — and give it a +/// fresh one. `attempts` tracks consecutive spawn failures per run *across +/// calls* (a caller keeps one map alive for as long as it keeps calling this, +/// e.g. once per tick of `commands::up`'s reconciliation loop); a run whose +/// supervisor cannot be started after [`MAX_SUPERVISOR_SPAWN_ATTEMPTS`] tries +/// is marked unrecoverable instead of being retried forever. +/// +/// This is the one place orphan detection happens: liveness is the same +/// `fd_lock` a running supervisor holds (`supervise::run_has_live_supervisor`), +/// so there is nothing to go stale — a dead process or a rebooted machine +/// releases the lock at the OS level, with no heartbeat/TTL of ours to miss. +/// A backend actually being gone (a killed local process, a deleted k8s Job, +/// an unreachable ssh host) is then detected the normal way, by the fresh +/// supervisor's own `inspect_job` — reconciliation's job is only to make sure +/// *a* supervisor is always eventually running to notice. +pub(crate) fn reconcile_active_runs( + store: &Store, + attempts: &mut HashMap, +) -> Result<()> { + reconcile_active_runs_with( + store, + attempts, + spawn_detached_supervise, + crate::commands::supervise::run_has_live_supervisor, + ) +} + +fn reconcile_active_runs_with( + store: &Store, + attempts: &mut HashMap, + spawn: impl Fn(&str) -> Result<()>, + has_live_supervisor: impl Fn(&str) -> Result, +) -> Result<()> { + let mut seen = std::collections::HashSet::new(); + for run in store.list_active_runs()? { + if store.get_local_experiment(&run.experiment_id)?.is_none() { + continue; + } + seen.insert(run.id.clone()); + if has_live_supervisor(&run.id)? { + // Healthy — being watched normally. Forget any earlier failures: + // a supervisor made it up eventually, and a later crash of *this* + // one restarts the count fresh rather than inheriting stale tries. + attempts.remove(&run.id); + continue; + } + if let Err(err) = spawn(&run.id) { + let count = attempts.entry(run.id.clone()).or_insert(0); + *count += 1; + eprintln!( + "reconcile: could not (re)spawn a supervisor for run {} (attempt {count}/{MAX_SUPERVISOR_SPAWN_ATTEMPTS}): {err}", + run.id + ); + if *count >= MAX_SUPERVISOR_SPAWN_ATTEMPTS { + let reason = format!( + "orx could not start a supervisor process for this run after \ + {count} attempts and is giving up: {err}" + ); + if let Err(mark_err) = store.mark_run_unrecoverable( + &run.id, + crate::error::ErrorKind::Reconciliation, + &reason, + ) { + eprintln!( + "reconcile: could not mark run {} unrecoverable: {mark_err}", + run.id + ); + } else { + attempts.remove(&run.id); + } + } + } else { + attempts.remove(&run.id); + } + } + // Drop counters for runs that left the active set entirely (finished, + // cancelled, or already marked unrecoverable above) so the map can't + // grow without bound across a long-lived `orx up` process. + attempts.retain(|run_id, _| seen.contains(run_id)); + Ok(()) +} + /// Persist cancel intent and ensure an orphaned run gets a fresh supervisor. pub(crate) fn request_local_run_cancel(store: &Store, run_id: &str) -> Result<()> { let lock_path = crate::store::log_path(run_id).with_extension("cancel.lock"); @@ -222,6 +315,9 @@ mod tests { result_markdown: None, cancel_requested: false, chat_session_id: None, + recovery_reason: None, + error_kind: None, + provenance_json: None, } } @@ -311,4 +407,202 @@ mod tests { drop(store); let _ = std::fs::remove_dir_all(dir); } + + // --- reconcile_active_runs_with (TASK 2: crash recovery/reconciliation) --- + + fn experiment_fixture() -> crate::local::model::LocalExperiment { + crate::local::model::LocalExperiment { + id: "experiment-1".into(), + project_id: "project-1".into(), + parent_experiment_id: None, + slug: "exp".into(), + branch_name: "orx/exp".into(), + title: None, + description: None, + run_command: "echo hi".into(), + agent_status: "idle".into(), + created_at: 1, + updated_at: 1, + chat_session_id: None, + } + } + + /// A run already being watched by a live supervisor is left alone: + /// reconciliation never spawns a redundant one, and never touches the + /// attempt counter. + #[test] + fn reconcile_skips_a_run_with_a_live_supervisor() { + let dir = std::env::temp_dir().join(format!("orx-reconcile-live-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + store + .create_local_experiment(&experiment_fixture()) + .unwrap(); + store.upsert_run(&run_fixture()).unwrap(); + let mut attempts = HashMap::new(); + + reconcile_active_runs_with( + &store, + &mut attempts, + |_| panic!("must not spawn"), + |_| Ok(true), + ) + .unwrap(); + + assert!(attempts.is_empty()); + assert_eq!(store.get_run("run-1").unwrap().unwrap().status, "running"); + + let _ = std::fs::remove_dir_all(dir); + } + + /// An orphaned run (no live supervisor) whose spawn succeeds is left with + /// no failure recorded and no attempt counter — the fresh supervisor now + /// owns it. + #[test] + fn reconcile_spawns_a_fresh_supervisor_for_an_orphaned_run() { + let dir = + std::env::temp_dir().join(format!("orx-reconcile-orphan-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + store + .create_local_experiment(&experiment_fixture()) + .unwrap(); + store.upsert_run(&run_fixture()).unwrap(); + let mut attempts = HashMap::new(); + let spawned = std::cell::Cell::new(false); + + reconcile_active_runs_with( + &store, + &mut attempts, + |_| { + spawned.set(true); + Ok(()) + }, + |_| Ok(false), + ) + .unwrap(); + + assert!(spawned.get()); + assert!(attempts.is_empty()); + assert_eq!(store.get_run("run-1").unwrap().unwrap().status, "running"); + + let _ = std::fs::remove_dir_all(dir); + } + + /// A run whose experiment isn't a registered local one is out of scope + /// for local reconciliation entirely — no spawn attempt, no counter. + #[test] + fn reconcile_ignores_runs_without_a_registered_local_experiment() { + let dir = + std::env::temp_dir().join(format!("orx-reconcile-foreign-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + // Deliberately no `create_local_experiment` call. + store.upsert_run(&run_fixture()).unwrap(); + let mut attempts = HashMap::new(); + + reconcile_active_runs_with( + &store, + &mut attempts, + |_| panic!("must not spawn"), + |_| panic!("must not probe a supervisor for an out-of-scope run"), + ) + .unwrap(); + + assert!(attempts.is_empty()); + + let _ = std::fs::remove_dir_all(dir); + } + + /// An orphaned run whose supervisor can never be spawned (a permanently + /// broken installation) is retried up to `MAX_SUPERVISOR_SPAWN_ATTEMPTS` + /// times — left alone in between — and only then marked unrecoverable + /// with a `recovery_reason`, instead of being retried forever or given up + /// on after a single blip. + #[test] + fn reconcile_gives_up_after_repeated_spawn_failures_and_marks_the_run_unrecoverable() { + let dir = + std::env::temp_dir().join(format!("orx-reconcile-giveup-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + store + .create_local_experiment(&experiment_fixture()) + .unwrap(); + store.upsert_run(&run_fixture()).unwrap(); + let mut attempts = HashMap::new(); + + for attempt in 1..MAX_SUPERVISOR_SPAWN_ATTEMPTS { + reconcile_active_runs_with( + &store, + &mut attempts, + |_| Err(anyhow!("synthetic spawn failure")), + |_| Ok(false), + ) + .unwrap(); + assert_eq!(attempts.get("run-1"), Some(&attempt)); + assert_eq!( + store.get_run("run-1").unwrap().unwrap().status, + "running", + "must not give up before the attempt cap" + ); + } + + reconcile_active_runs_with( + &store, + &mut attempts, + |_| Err(anyhow!("synthetic spawn failure")), + |_| Ok(false), + ) + .unwrap(); + + assert!( + !attempts.contains_key("run-1"), + "the counter is cleared once the run is marked unrecoverable" + ); + let run = store.get_run("run-1").unwrap().unwrap(); + assert_eq!(run.status, "failed"); + assert!(run + .recovery_reason + .unwrap() + .contains("synthetic spawn failure")); + assert_eq!(run.error_kind.as_deref(), Some("reconciliation_failure")); + + let _ = std::fs::remove_dir_all(dir); + } + + /// A run that leaves the active set (it reached a terminal state some + /// other way) between reconciliation passes must not leave a stale + /// counter behind — `attempts` must not grow without bound over the + /// lifetime of a long-running `orx up`. + #[test] + fn reconcile_forgets_attempt_counters_for_runs_no_longer_active() { + let dir = + std::env::temp_dir().join(format!("orx-reconcile-forget-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + store + .create_local_experiment(&experiment_fixture()) + .unwrap(); + store.upsert_run(&run_fixture()).unwrap(); + let mut attempts = HashMap::new(); + reconcile_active_runs_with( + &store, + &mut attempts, + |_| Err(anyhow!("synthetic spawn failure")), + |_| Ok(false), + ) + .unwrap(); + assert_eq!(attempts.get("run-1"), Some(&1)); + + // The run finishes through the normal path, independent of reconciliation. + assert!(store + .update_status("run-1", crate::store::RunStatus::Done, Some(1), Some(0)) + .unwrap()); + reconcile_active_runs_with( + &store, + &mut attempts, + |_| panic!("must not spawn"), + |_| panic!("must not probe a terminal run"), + ) + .unwrap(); + + assert!(attempts.is_empty()); + + let _ = std::fs::remove_dir_all(dir); + } } diff --git a/src/commands/remote_host.rs b/src/commands/remote_host.rs index f79baea5..536593f3 100644 --- a/src/commands/remote_host.rs +++ b/src/commands/remote_host.rs @@ -26,6 +26,7 @@ use tokio::sync::watch; use crate::error::{anyhow, Result}; use crate::local::chat::ChatHost; use crate::store::Store; +use crate::token_auth::{constant_time_eq, digest}; use crate::{RemoteHostArgs, RemoteHostCommand}; pub(crate) const CONTROL_PROTOCOL: u32 = 1; @@ -138,21 +139,6 @@ impl RemoteAuth { } } -fn digest(value: &str) -> [u8; 32] { - Sha256::digest(value.as_bytes()).into() -} - -fn constant_time_eq(left: &[u8], right: &[u8]) -> bool { - left.len() == right.len() - && left - .iter() - .zip(right) - .fold(0_u8, |difference, (left, right)| { - difference | (left ^ right) - }) - == 0 -} - pub(crate) enum DashboardLockMode { Shared, Exclusive, @@ -293,6 +279,14 @@ pub(crate) async fn start_control_server( } std::fs::remove_file(&socket_path)?; } + // `set_mode` below lands after `bind`, so the socket briefly exists at + // the process umask. That's not a real window: `ensure_private_dir` + // (called via `runtime_path`, above) already requires the containing + // `/tmp/orx-/` to be 0700 and owner-matched before we get here, so + // no other user can resolve a path into it to connect during the gap — + // and even a same-directory race would still hit the `SO_PEERCRED` + // same-uid check in the accept loop below. The chmod is defense in + // depth, not the actual boundary. let listener = UnixListener::bind(&socket_path)?; set_mode(&socket_path, 0o600)?; let descriptor_path = descriptor_path(&data_dir)?; diff --git a/src/commands/serve.rs b/src/commands/serve.rs index e8c27cf2..edfb9fc9 100644 --- a/src/commands/serve.rs +++ b/src/commands/serve.rs @@ -14,22 +14,45 @@ //! //! Hand-rolled HTTP/1.1 on a tokio TcpListener (the login.rs idiom) — no //! framework dependency for a single-tenant loopback daemon. +//! +//! Auth: loopback bind alone is not a trust boundary against *other local +//! users* on a shared box (this daemon's own doc note above says the api +//! reaches it by SSH-tunneling in — but any other user on that box can also +//! just connect to 127.0.0.1:4790 directly, bypassing the tunnel entirely). +//! `--token`/`ORX_SERVE_TOKEN` closes that gap: when set, every request +//! (`/health` included, for the same reason `orx up --remote` gates its own +//! health route — a liveness probe still discloses the running version) must +//! carry a matching `Authorization: Bearer `, compared as a SHA-256 +//! digest in constant time via `token_auth`. See SECURITY.md. use std::collections::HashMap; +use std::sync::Arc; use std::time::Duration; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; use crate::error::{anyhow, Result}; +use crate::local::is_terminal; use crate::store::{log_path, Store, StoredRun}; +use crate::token_auth::{constant_time_eq, digest}; pub async fn run(args: crate::ServeArgs) -> Result<()> { let port = args.port.unwrap_or(4790); + let token = args.token.or_else(|| { + crate::local::shell_env::var("ORX_SERVE_TOKEN").and_then(|v| v.into_string().ok()) + }); + let auth: Arc> = Arc::new(token.as_deref().map(digest)); let listener = TcpListener::bind(("127.0.0.1", port)) .await .map_err(|e| anyhow!("Could not bind 127.0.0.1:{}: {}", port, e))?; eprintln!("orx serve: listening on http://127.0.0.1:{port}"); + if auth.is_none() { + eprintln!( + "orx serve: no --token/ORX_SERVE_TOKEN set — any local user who can reach \ + 127.0.0.1:{port} can read every run's metadata and logs. Set one on shared hosts." + ); + } loop { let (stream, _) = match listener.accept().await { @@ -39,15 +62,16 @@ pub async fn run(args: crate::ServeArgs) -> Result<()> { continue; } }; + let auth = auth.clone(); tokio::spawn(async move { - if let Err(err) = handle(stream).await { + if let Err(err) = handle(stream, &auth).await { eprintln!("orx serve: request failed: {err}"); } }); } } -async fn handle(mut stream: TcpStream) -> Result<()> { +async fn handle(mut stream: TcpStream, auth: &Option<[u8; 32]>) -> Result<()> { // Read the head (requests are header-only GETs; 8 KB is plenty). let mut buf = vec![0u8; 8192]; let mut len = 0; @@ -75,6 +99,18 @@ async fn handle(mut stream: TcpStream) -> Result<()> { ) .await; } + if let Some(expected) = auth { + let provided = bearer_token(&head).map(digest); + if !provided.is_some_and(|provided| constant_time_eq(&provided, expected)) { + return respond( + &mut stream, + 401, + "application/json", + b"{\"error\":\"unauthorized\"}", + ) + .await; + } + } let (path, query) = match target.split_once('?') { Some((p, q)) => (p, q), None => (target, ""), @@ -149,6 +185,20 @@ async fn handle(mut stream: TcpStream) -> Result<()> { } } +/// Extracts the bearer token from a raw HTTP head's `Authorization` header. +/// Case-insensitive on the header name (per RFC 9110); the scheme itself +/// (`Bearer `) is matched literally, matching every client this daemon talks +/// to today. +fn bearer_token(head: &str) -> Option<&str> { + head.lines().find_map(|line| { + let (name, value) = line.split_once(':')?; + if !name.trim().eq_ignore_ascii_case("authorization") { + return None; + } + value.trim().strip_prefix("Bearer ") + }) +} + fn read_log_from(run_id: &str, offset: u64) -> Vec { use std::io::{Read, Seek, SeekFrom}; let Ok(mut f) = std::fs::File::open(log_path(run_id)) else { @@ -169,6 +219,7 @@ async fn respond( ) -> Result<()> { let reason = match status { 200 => "OK", + 401 => "Unauthorized", 404 => "Not Found", 405 => "Method Not Allowed", _ => "", @@ -275,10 +326,6 @@ async fn emit_log_delta( .await } -fn is_terminal(status: &str) -> bool { - matches!(status, "done" | "failed" | "cancelled") -} - async fn write_event(stream: &mut TcpStream, event: &str, data: &serde_json::Value) -> Result<()> { // SSE data must be newline-free per line; JSON-encode guarantees that. let frame = format!("event: {event}\ndata: {data}\n\n"); @@ -286,3 +333,119 @@ async fn write_event(stream: &mut TcpStream, event: &str, data: &serde_json::Val stream.flush().await?; Ok(()) } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn bearer_token_extracts_value_case_insensitively() { + let head = "GET /health HTTP/1.1\r\nHost: x\r\nAuthorization: Bearer secret-token\r\n\r\n"; + assert_eq!(bearer_token(head), Some("secret-token")); + + let head_lower = "GET /health HTTP/1.1\r\nauthorization: Bearer secret-token\r\n\r\n"; + assert_eq!(bearer_token(head_lower), Some("secret-token")); + } + + #[test] + fn bearer_token_absent_without_header() { + let head = "GET /health HTTP/1.1\r\nHost: x\r\n\r\n"; + assert_eq!(bearer_token(head), None); + } + + #[test] + fn bearer_token_ignores_non_bearer_scheme() { + let head = "GET /health HTTP/1.1\r\nAuthorization: Basic dXNlcjpwYXNz\r\n\r\n"; + assert_eq!(bearer_token(head), None); + } + + /// Starts a real `handle()` loop on a loopback socket and returns its + /// address — exercises the actual accept/parse/auth/respond path used by + /// `run()`, not a reimplementation of it. Only `/health` is used across + /// these tests: it needs no `Store`, so it can't collide with the + /// process-global data dir other tests mutate under the parallel runner. + async fn spawn_server(auth: Option<[u8; 32]>) -> std::net::SocketAddr { + let listener = TcpListener::bind(("127.0.0.1", 0)).await.unwrap(); + let addr = listener.local_addr().unwrap(); + let auth = Arc::new(auth); + tokio::spawn(async move { + loop { + let Ok((stream, _)) = listener.accept().await else { + continue; + }; + let auth = auth.clone(); + tokio::spawn(async move { + let _ = handle(stream, &auth).await; + }); + } + }); + addr + } + + /// Issues one raw HTTP GET and returns (status code, body). + async fn get( + addr: std::net::SocketAddr, + path: &str, + authorization: Option<&str>, + ) -> (u16, String) { + let mut stream = TcpStream::connect(addr).await.unwrap(); + let mut request = format!("GET {path} HTTP/1.1\r\nHost: 127.0.0.1\r\n"); + if let Some(value) = authorization { + request.push_str(&format!("Authorization: {value}\r\n")); + } + request.push_str("\r\n"); + stream.write_all(request.as_bytes()).await.unwrap(); + stream.shutdown().await.unwrap_or(()); + + let mut response = Vec::new(); + stream.read_to_end(&mut response).await.unwrap(); + let response = String::from_utf8_lossy(&response); + let status = response + .lines() + .next() + .and_then(|line| line.split_whitespace().nth(1)) + .and_then(|code| code.parse().ok()) + .unwrap_or(0); + let body = response.split("\r\n\r\n").nth(1).unwrap_or("").to_string(); + (status, body) + } + + #[tokio::test] + async fn no_token_configured_allows_unauthenticated_requests() { + let addr = spawn_server(None).await; + let (status, body) = get(addr, "/health", None).await; + assert_eq!(status, 200); + assert!(body.contains("\"ok\":true")); + } + + #[tokio::test] + async fn token_configured_rejects_missing_authorization() { + let addr = spawn_server(Some(digest("s3cret"))).await; + let (status, _) = get(addr, "/health", None).await; + assert_eq!(status, 401); + } + + #[tokio::test] + async fn token_configured_rejects_wrong_token() { + let addr = spawn_server(Some(digest("s3cret"))).await; + let (status, _) = get(addr, "/health", Some("Bearer wrong")).await; + assert_eq!(status, 401); + } + + #[tokio::test] + async fn token_configured_accepts_matching_token() { + let addr = spawn_server(Some(digest("s3cret"))).await; + let (status, body) = get(addr, "/health", Some("Bearer s3cret")).await; + assert_eq!(status, 200); + assert!(body.contains("\"ok\":true")); + } + + #[tokio::test] + async fn token_gate_applies_to_every_route_not_just_health() { + // /runs would touch the global Store; confirm it's rejected before + // that ever happens rather than exercising the Store-backed path. + let addr = spawn_server(Some(digest("s3cret"))).await; + let (status, _) = get(addr, "/runs", None).await; + assert_eq!(status, 401); + } +} diff --git a/src/commands/supervise.rs b/src/commands/supervise.rs index a834aa3c..90e9bc7c 100644 --- a/src/commands/supervise.rs +++ b/src/commands/supervise.rs @@ -19,12 +19,64 @@ use crate::jobs::ray; use crate::jobs::slurm; use crate::jobs::ssh; use crate::jobs::{is_terminal_stage, stage_to_run_status, BackendDescriptor}; -use crate::store::{log_path, now_ms, Store}; +use crate::store::{log_path, now_ms, RunStatus, Store}; const POLL_INTERVAL: Duration = Duration::from_secs(5); /// How long a silent log stream is held before re-checking job state. const LOG_IDLE: Duration = Duration::from_secs(30); +/// How many consecutive inspect-transport failures (host unreachable, +/// cluster API down, auth expired) a poll loop tolerates before giving up on +/// a run, rather than retrying every `POLL_INTERVAL` forever — roughly 10 +/// minutes at the default interval. Long enough to ride out a flaky network +/// blip or a brief control-plane restart; short enough that a genuinely +/// unreachable backend doesn't strand a run in `Running` indefinitely (TASK +/// 4: every backend's poll loop honors this bound uniformly, where before +/// each retried forever with no cap). +const MAX_CONSECUTIVE_INSPECT_FAILURES: u32 = 120; + +/// Records one inspect-transport failure and reports whether the run should +/// now be given up on. `consecutive_failures` is owned by the poll loop and +/// must be reset to 0 by the caller on the next successful inspect. +fn record_inspect_failure(consecutive_failures: &mut u32) -> bool { + *consecutive_failures += 1; + *consecutive_failures >= MAX_CONSECUTIVE_INSPECT_FAILURES +} + +/// Gives up on a run whose backend has been unreachable for +/// [`MAX_CONSECUTIVE_INSPECT_FAILURES`] consecutive polls: marks it +/// unrecoverable (TASK 2's `mark_run_unrecoverable`, which never overwrites a +/// run that reached a real outcome first) and stops the log tail. Shared by +/// every poll loop so the bound and its bookkeeping can't drift between +/// backends. +async fn give_up_on_unreachable_backend( + store: &Store, + run_id: &str, + backend_label: &str, + last_error: &crate::error::Error, + done_tx: &tokio::sync::watch::Sender, + mut log_task: tokio::task::JoinHandle<()>, +) { + let reason = format!( + "the {backend_label} backend has been unreachable for {MAX_CONSECUTIVE_INSPECT_FAILURES} \ + consecutive polls (roughly {} minutes) — last error: {last_error}", + u64::from(MAX_CONSECUTIVE_INSPECT_FAILURES) * POLL_INTERVAL.as_secs() / 60, + ); + if let Err(err) = + store.mark_run_unrecoverable(run_id, crate::error::ErrorKind::BackendUnavailable, &reason) + { + eprintln!("supervise {run_id}: could not mark run unrecoverable: {err}"); + } + let _ = done_tx.send(true); + if tokio::time::timeout(Duration::from_secs(20), &mut log_task) + .await + .is_err() + { + log_task.abort(); + } + eprintln!("supervise {run_id}: giving up — {reason}"); +} + fn open_supervisor_lock(path: &std::path::Path) -> Result> { let file = std::fs::OpenOptions::new() .create(true) @@ -34,11 +86,42 @@ fn open_supervisor_lock(path: &std::path::Path) -> Result std::path::PathBuf { + log_path(run_id).with_extension("supervisor.lock") +} + +/// Whether a supervisor is currently alive and watching `run_id`, checked by +/// probing the same `fd_lock` file `run()` holds for as long as it supervises +/// — the lock is an OS-level advisory lock, so it is released automatically +/// (by the kernel) the instant the holding process dies or the machine +/// reboots, with no heartbeat/TTL of our own to go stale. Used by +/// reconciliation (`commands::exp::reconcile_active_runs`) to tell an +/// orphaned run (no supervisor left to notice it finished, or died) from one +/// that is already being watched. +pub(crate) fn run_has_live_supervisor(run_id: &str) -> Result { + probe_supervisor_lock(&supervisor_lock_path(run_id)) +} + +/// The path-parameterized core of [`run_has_live_supervisor`], split out so +/// tests can probe an arbitrary temp path instead of the real, `data_dir()`- +/// resolved one. +fn probe_supervisor_lock(path: &std::path::Path) -> Result { + let mut lock = open_supervisor_lock(path)?; + let live = match lock.try_write() { + // Acquired it ourselves: nobody else is holding it. Drop immediately + // — this is a liveness probe, not a claim. + Ok(_guard) => Ok(false), + Err(err) if err.kind() == std::io::ErrorKind::WouldBlock => Ok(true), + Err(err) => Err(err.into()), + }; + live +} + pub async fn run(args: crate::SuperviseArgs) -> Result<()> { let run_id = args.run_id; let store = Store::open()?; - let lock_path = log_path(&run_id).with_extension("supervisor.lock"); + let lock_path = supervisor_lock_path(&run_id); let mut supervisor_lock = open_supervisor_lock(&lock_path)?; let _supervisor_guard = match supervisor_lock.try_write() { Ok(guard) => guard, @@ -64,7 +147,7 @@ pub async fn run(args: crate::SuperviseArgs) -> Result<()> { } } if descriptor.job_id.is_none() { - store.update_status(&run_id, "failed", Some(now_ms()), None)?; + store.update_status(&run_id, RunStatus::Failed, Some(now_ms()), None)?; store.set_result_markdown( &run_id, &format!( @@ -120,28 +203,37 @@ pub async fn run(args: crate::SuperviseArgs) -> Result<()> { done_rx, )); - let mut last_status = stored.status.clone(); + let mut last_status = status_of(&stored); let mut cancel_sent = false; + let mut consecutive_failures = 0u32; loop { // Where is the job now? let job = match hf::inspect_job(&token, &namespace, &job_id).await { - Ok(j) => j, + Ok(j) => { + consecutive_failures = 0; + j.state() + } Err(err) => { eprintln!("supervise {run_id}: inspect failed (will retry): {err}"); + if record_inspect_failure(&mut consecutive_failures) { + give_up_on_unreachable_backend(&store, &run_id, "hf", &err, &done_tx, log_task) + .await; + return Ok(()); + } tokio::time::sleep(POLL_INTERVAL).await; continue; } }; - let stage = job.status.stage.as_str(); + let stage = job.stage.as_str(); let status = run_status_for_stage(&store, &run_id, cancel_sent, stage); // Drain the tail before the status flip so terminal readers see the // complete local log. if is_terminal_stage(stage) { - store.update_status(&run_id, &status, Some(now_ms()), None)?; - if status == "failed" { - if let Some(msg) = &job.status.message { + store.update_status(&run_id, status, Some(now_ms()), None)?; + if status == RunStatus::Failed { + if let Some(msg) = &job.message { if let Err(err) = store.set_result_markdown(&run_id, &format!("Job failed: {msg}")) { @@ -161,10 +253,10 @@ pub async fn run(args: crate::SuperviseArgs) -> Result<()> { } if status != last_status { - store.update_status(&run_id, &status, None, None)?; + store.update_status(&run_id, status, None, None)?; let cancel_requested = local_cancel_requested(&store, &run_id); eprintln!("supervise {run_id}: {last_status} -> {status} (stage {stage})"); - last_status = status.clone(); + last_status = status; if cancel_requested && !cancel_sent { request_backend_cancel(&token, &namespace, &job_id, &run_id, &mut cancel_sent) .await; @@ -192,18 +284,29 @@ fn should_report_cancelled(store: &Store, run_id: &str, cancel_sent: bool) -> bo cancel_sent || local_cancel_requested(store, run_id) } -fn run_status_for_stage(store: &Store, run_id: &str, cancel_sent: bool, stage: &str) -> String { +fn run_status_for_stage(store: &Store, run_id: &str, cancel_sent: bool, stage: &str) -> RunStatus { let status = stage_to_run_status(stage); - if status != "done" + if status != RunStatus::Done && is_terminal_stage(stage) && should_report_cancelled(store, run_id, cancel_sent) { - "cancelled".to_string() + RunStatus::Cancelled } else { - status.to_string() + status } } +/// The run's current status, parsed from the stored row. Falls back to +/// `Running` for a row somehow holding an unrecognized string — conservative, +/// since a fresh supervisor only ever reaches this for a non-terminal run +/// (checked by the caller via `is_terminal`), and `Running` keeps the normal +/// transition rules in force rather than treating the row as fresh (`Starting` +/// would let a backend's next report regress it, which is never legal from +/// `Running`). +fn status_of(stored: &crate::store::StoredRun) -> RunStatus { + RunStatus::parse(&stored.status).unwrap_or(RunStatus::Running) +} + /// Tail the job's log stream into the run's log file until told we're done. /// Reconnects forever (HF replays from the start; `seen` dedups), so a network /// blip or the stream's own idle-close never loses the tail. Truncates on @@ -301,14 +404,25 @@ async fn run_k8s( done_rx, )); - let mut last_status = stored.status.clone(); + let mut last_status = status_of(&stored); let mut cancel_sent = false; + let mut consecutive_failures = 0u32; loop { let job = match k8s::inspect_job(context.as_deref(), &namespace, &job_name).await { - Ok(j) => j, + Ok(j) => { + consecutive_failures = 0; + j + } Err(err) => { eprintln!("supervise {run_id}: inspect failed (will retry): {err}"); + if record_inspect_failure(&mut consecutive_failures) { + give_up_on_unreachable_backend( + &store, &run_id, "k8s", &err, &done_tx, log_task, + ) + .await; + return Ok(()); + } tokio::time::sleep(POLL_INTERVAL).await; continue; } @@ -317,8 +431,8 @@ async fn run_k8s( let status = run_status_for_stage(&store, &run_id, cancel_sent, stage); if is_terminal_stage(stage) { - store.update_status(&run_id, &status, Some(now_ms()), None)?; - if status == "failed" { + store.update_status(&run_id, status, Some(now_ms()), None)?; + if status == RunStatus::Failed { if let Some(msg) = &job.message { if let Err(err) = store.set_result_markdown(&run_id, &format!("Job failed: {msg}")) @@ -339,10 +453,10 @@ async fn run_k8s( } if status != last_status { - store.update_status(&run_id, &status, None, None)?; + store.update_status(&run_id, status, None, None)?; let cancel_requested = local_cancel_requested(&store, &run_id); eprintln!("supervise {run_id}: {last_status} -> {status} (stage {stage})"); - last_status = status.clone(); + last_status = status; if cancel_requested && !cancel_sent { cancel_k8s( context.as_deref(), @@ -461,14 +575,25 @@ async fn run_modal( done_rx, )); - let mut last_status = stored.status.clone(); + let mut last_status = status_of(&stored); let mut cancel_sent = false; + let mut consecutive_failures = 0u32; loop { let job = match modal::inspect_job(&sandbox_id).await { - Ok(j) => j, + Ok(j) => { + consecutive_failures = 0; + j + } Err(err) => { eprintln!("supervise {run_id}: inspect failed (will retry): {err}"); + if record_inspect_failure(&mut consecutive_failures) { + give_up_on_unreachable_backend( + &store, &run_id, "modal", &err, &done_tx, log_task, + ) + .await; + return Ok(()); + } tokio::time::sleep(POLL_INTERVAL).await; continue; } @@ -479,8 +604,8 @@ async fn run_modal( let status = run_status_for_stage(&store, &run_id, cancel_sent, stage); if is_terminal_stage(stage) { - store.update_status(&run_id, &status, Some(now_ms()), None)?; - if status == "failed" { + store.update_status(&run_id, status, Some(now_ms()), None)?; + if status == RunStatus::Failed { if let Some(msg) = &job.message { if let Err(err) = store.set_result_markdown(&run_id, &format!("Job failed: {msg}")) @@ -501,10 +626,10 @@ async fn run_modal( } if status != last_status { - store.update_status(&run_id, &status, None, None)?; + store.update_status(&run_id, status, None, None)?; let cancel_requested = local_cancel_requested(&store, &run_id); eprintln!("supervise {run_id}: {last_status} -> {status} (stage {stage})"); - last_status = status.clone(); + last_status = status; if cancel_requested && !cancel_sent { cancel_modal(&sandbox_id, &run_id, &mut cancel_sent).await; } @@ -581,7 +706,7 @@ async fn run_ssh( eprintln!("supervise {run_id}: watching ssh job {host}:{dir}"); let target = ssh::SshTarget::alias(host); let dir = dir.to_string(); - watch_ssh_job(&store, &stored.status, target, dir, &run_id).await?; + watch_ssh_job(&store, status_of(&stored), target, dir, &run_id).await?; Ok(()) } @@ -590,11 +715,11 @@ async fn run_ssh( /// and returns the final run status after logs are drained. async fn watch_ssh_job( store: &Store, - initial_status: &str, + initial_status: RunStatus, target: ssh::SshTarget, dir: String, run_id: &str, -) -> Result { +) -> Result { let path = log_path(run_id); let (done_tx, done_rx) = tokio::sync::watch::channel(false); let mut log_task = tokio::spawn(tail_logs_ssh( @@ -605,14 +730,25 @@ async fn watch_ssh_job( done_rx, )); - let mut last_status = initial_status.to_string(); + let mut last_status = initial_status; let mut cancel_sent = false; + let mut consecutive_failures = 0u32; loop { let job = match ssh::inspect_job(&target, &dir).await { - Ok(j) => j, + Ok(j) => { + consecutive_failures = 0; + j + } Err(err) => { eprintln!("supervise {run_id}: inspect failed (will retry): {err}"); + if record_inspect_failure(&mut consecutive_failures) { + // Shared by both `ssh_job` and `openresearch_job` — the + // underlying transport is ssh either way. + give_up_on_unreachable_backend(store, run_id, "ssh", &err, &done_tx, log_task) + .await; + return Ok(RunStatus::Failed); + } tokio::time::sleep(POLL_INTERVAL).await; continue; } @@ -621,8 +757,8 @@ async fn watch_ssh_job( let status = run_status_for_stage(store, run_id, cancel_sent, stage); if is_terminal_stage(stage) { - store.update_status(run_id, &status, Some(now_ms()), None)?; - if status == "failed" { + store.update_status(run_id, status, Some(now_ms()), None)?; + if status == RunStatus::Failed { if let Some(msg) = &job.message { if let Err(err) = store.set_result_markdown(run_id, &format!("Job failed: {msg}")) @@ -643,10 +779,10 @@ async fn watch_ssh_job( } if status != last_status { - store.update_status(run_id, &status, None, None)?; + store.update_status(run_id, status, None, None)?; let cancel_requested = local_cancel_requested(store, run_id); eprintln!("supervise {run_id}: {last_status} -> {status} (stage {stage})"); - last_status = status.clone(); + last_status = status; if cancel_requested && !cancel_sent { cancel_ssh(&target, &dir, run_id, &mut cancel_sent).await; } @@ -730,7 +866,7 @@ async fn run_openresearch( let lifecycle = match crate::config::load_credentials().await { Ok(Some(c)) => c, _ => { - store.update_status(&run_id, "failed", Some(now_ms()), None)?; + store.update_status(&run_id, RunStatus::Failed, Some(now_ms()), None)?; store.set_result_markdown( &run_id, &format!( @@ -762,19 +898,19 @@ async fn run_openresearch( Ok(openresearch::WaitOutcome::Online(sandbox)) => sandbox, Ok(openresearch::WaitOutcome::Cancelled) => { eprintln!("supervise {run_id}: cancelled during provisioning"); - store.update_status(&run_id, "cancelled", Some(now_ms()), None)?; + store.update_status(&run_id, RunStatus::Cancelled, Some(now_ms()), None)?; teardown_box(&store, &lifecycle, &sandbox_id, &run_id).await; return Ok(()); } Ok(openresearch::WaitOutcome::Failed(reason)) | Ok(openresearch::WaitOutcome::TimedOut(reason)) => { - store.update_status(&run_id, "failed", Some(now_ms()), None)?; + store.update_status(&run_id, RunStatus::Failed, Some(now_ms()), None)?; store .set_result_markdown(&run_id, &format!("Provisioning failed: {reason}"))?; return Ok(()); } Err(err) => { - store.update_status(&run_id, "failed", Some(now_ms()), None)?; + store.update_status(&run_id, RunStatus::Failed, Some(now_ms()), None)?; store.set_result_markdown(&run_id, &format!("Provisioning failed: {err}"))?; teardown_box(&store, &lifecycle, &sandbox_id, &run_id).await; return Ok(()); @@ -800,7 +936,7 @@ async fn run_openresearch( let source = match crate::compute::SourceSnapshot::from_run(&stored, &descriptor) { Ok(source) => source, Err(error) => { - store.update_status(&run_id, "failed", Some(now_ms()), None)?; + store.update_status(&run_id, RunStatus::Failed, Some(now_ms()), None)?; store.set_result_markdown( &run_id, &format!("The recorded source snapshot could not be loaded: {error}"), @@ -826,7 +962,7 @@ async fn run_openresearch( } if local_cancel_requested(&store, &run_id) { eprintln!("supervise {run_id}: cancelled before launch"); - store.update_status(&run_id, "cancelled", Some(now_ms()), None)?; + store.update_status(&run_id, RunStatus::Cancelled, Some(now_ms()), None)?; teardown_box(&store, &lifecycle, &sandbox_id, &run_id).await; return Ok(()); } @@ -855,7 +991,7 @@ async fn run_openresearch( } } if let Some(err) = launch_err { - store.update_status(&run_id, "failed", Some(now_ms()), None)?; + store.update_status(&run_id, RunStatus::Failed, Some(now_ms()), None)?; store.set_result_markdown( &run_id, &crate::local::ssh_identity::explain_launch_failure(&sandbox_id, &err.to_string()), @@ -872,7 +1008,7 @@ async fn run_openresearch( // The shared ssh loop owns status and logs; the box is deleted after // it returns (logs are drained from the box BEFORE teardown), and even // when it errors. - let watch = watch_ssh_job(&store, &stored.status, target, dir, &run_id).await; + let watch = watch_ssh_job(&store, status_of(&stored), target, dir, &run_id).await; teardown_box(&store, &lifecycle, &sandbox_id, &run_id).await; watch?; Ok(()) @@ -927,7 +1063,7 @@ async fn run_local( done_rx, )); - let mut last_status = stored.status.clone(); + let mut last_status = status_of(&stored); let mut cancel_sent = false; loop { @@ -936,8 +1072,8 @@ async fn run_local( let status = run_status_for_stage(&store, &run_id, cancel_sent, stage); if is_terminal_stage(stage) { - store.update_status(&run_id, &status, Some(now_ms()), None)?; - if status == "failed" { + store.update_status(&run_id, status, Some(now_ms()), None)?; + if status == RunStatus::Failed { if let Some(msg) = &job.message { if let Err(err) = store.set_result_markdown(&run_id, &format!("Job failed: {msg}")) @@ -958,10 +1094,10 @@ async fn run_local( } if status != last_status { - store.update_status(&run_id, &status, None, None)?; + store.update_status(&run_id, status, None, None)?; let cancel_requested = local_cancel_requested(&store, &run_id); eprintln!("supervise {run_id}: {last_status} -> {status} (stage {stage})"); - last_status = status.clone(); + last_status = status; if cancel_requested && !cancel_sent { cancel_local(&dir, &run_id, &mut cancel_sent); } @@ -1053,45 +1189,56 @@ async fn run_slurm( done_rx, )); - let mut last_status = stored.status.clone(); + let mut last_status = status_of(&stored); let mut cancel_sent = false; + let mut consecutive_failures = 0u32; // "GONE" (scheduler doesn't know the job, no exit_code) must persist for // a full minute before it's believed: it also fires during slurmctld // restarts and while the exit_code write is NFS-lagged behind the compute // node. Any other observation resets the count. - const GONE_POLLS_TO_FAIL: u32 = (60 / POLL_INTERVAL.as_secs()) as u32; - let mut gone_polls = 0u32; + let mut gone = crate::jobs::GoneDebounce::new(Duration::from_secs(60), POLL_INTERVAL); loop { let mut job = match slurm::inspect_job(&host, &run_id, &job_id).await { - Ok(j) => j, + Ok(j) => { + consecutive_failures = 0; + j + } Err(err) => { eprintln!("supervise {run_id}: inspect failed (will retry): {err}"); + if record_inspect_failure(&mut consecutive_failures) { + give_up_on_unreachable_backend( + &store, &run_id, "slurm", &err, &done_tx, log_task, + ) + .await; + return Ok(()); + } tokio::time::sleep(POLL_INTERVAL).await; continue; } }; - if job.stage == "GONE" { - gone_polls += 1; - if gone_polls < GONE_POLLS_TO_FAIL { + match gone.observe(&job.stage) { + crate::jobs::GoneOutcome::StillWaiting => { tokio::time::sleep(POLL_INTERVAL).await; continue; } - job = slurm::JobState { - stage: "ERROR".to_string(), - message: Some( - "job left the queue without an exit code (killed or node lost?)".to_string(), - ), - }; - } else { - gone_polls = 0; + crate::jobs::GoneOutcome::ConfirmedGone => { + job = slurm::JobState { + stage: "ERROR".to_string(), + message: Some( + "job left the queue without an exit code (killed or node lost?)" + .to_string(), + ), + }; + } + crate::jobs::GoneOutcome::NotGone => {} } let stage = job.stage.as_str(); let status = run_status_for_stage(&store, &run_id, cancel_sent, stage); if is_terminal_stage(stage) { - store.update_status(&run_id, &status, Some(now_ms()), None)?; - if status == "failed" { + store.update_status(&run_id, status, Some(now_ms()), None)?; + if status == RunStatus::Failed { if let Some(msg) = &job.message { if let Err(err) = store.set_result_markdown(&run_id, &format!("Job failed: {msg}")) @@ -1112,10 +1259,10 @@ async fn run_slurm( } if status != last_status { - store.update_status(&run_id, &status, None, None)?; + store.update_status(&run_id, status, None, None)?; let cancel_requested = local_cancel_requested(&store, &run_id); eprintln!("supervise {run_id}: {last_status} -> {status} (stage {stage})"); - last_status = status.clone(); + last_status = status; if cancel_requested && !cancel_sent { cancel_slurm(&host, &job_id, &run_id, &mut cancel_sent).await; } @@ -1161,45 +1308,55 @@ async fn run_ray( done_rx, )); - let mut last_status = stored.status.clone(); + let mut last_status = status_of(&stored); let mut cancel_sent = false; + let mut consecutive_failures = 0u32; // "GONE" (a 404 — the cluster no longer knows the job) must persist for a // full minute before it's believed: it also fires while a Ray head // restarts. Any other observation resets the count. - const GONE_POLLS_TO_FAIL: u32 = (60 / POLL_INTERVAL.as_secs()) as u32; - let mut gone_polls = 0u32; + let mut gone = crate::jobs::GoneDebounce::new(Duration::from_secs(60), POLL_INTERVAL); loop { let mut job = match ray::inspect_job(&address, &submission_id).await { - Ok(j) => j, + Ok(j) => { + consecutive_failures = 0; + j + } Err(err) => { eprintln!("supervise {run_id}: inspect failed (will retry): {err}"); + if record_inspect_failure(&mut consecutive_failures) { + give_up_on_unreachable_backend( + &store, &run_id, "ray", &err, &done_tx, log_task, + ) + .await; + return Ok(()); + } tokio::time::sleep(POLL_INTERVAL).await; continue; } }; - if job.stage == "GONE" { - gone_polls += 1; - if gone_polls < GONE_POLLS_TO_FAIL { + match gone.observe(&job.stage) { + crate::jobs::GoneOutcome::StillWaiting => { tokio::time::sleep(POLL_INTERVAL).await; continue; } - job = ray::JobInfo { - stage: "ERROR".to_string(), - message: Some( - "job no longer known to the cluster (record purged or head restarted?)" - .to_string(), - ), - }; - } else { - gone_polls = 0; + crate::jobs::GoneOutcome::ConfirmedGone => { + job = ray::JobInfo { + stage: "ERROR".to_string(), + message: Some( + "job no longer known to the cluster (record purged or head restarted?)" + .to_string(), + ), + }; + } + crate::jobs::GoneOutcome::NotGone => {} } let stage = job.stage.as_str(); let status = run_status_for_stage(&store, &run_id, cancel_sent, stage); if is_terminal_stage(stage) { - store.update_status(&run_id, &status, Some(now_ms()), None)?; - if status == "failed" { + store.update_status(&run_id, status, Some(now_ms()), None)?; + if status == RunStatus::Failed { if let Some(msg) = &job.message { if let Err(err) = store.set_result_markdown(&run_id, &format!("Job failed: {msg}")) @@ -1220,10 +1377,10 @@ async fn run_ray( } if status != last_status { - store.update_status(&run_id, &status, None, None)?; + store.update_status(&run_id, status, None, None)?; let cancel_requested = local_cancel_requested(&store, &run_id); eprintln!("supervise {run_id}: {last_status} -> {status} (stage {stage})"); - last_status = status.clone(); + last_status = status; if cancel_requested && !cancel_sent { cancel_ray(&address, &submission_id, &run_id, &mut cancel_sent).await; } @@ -1346,21 +1503,24 @@ mod tests { result_markdown: None, cancel_requested: false, chat_session_id: None, + recovery_reason: None, + error_kind: None, + provenance_json: None, }; store.upsert_run(&run).unwrap(); assert_eq!( run_status_for_stage(&store, &run.id, false, "ERROR"), - "failed" + RunStatus::Failed ); store.set_cancel_requested(&run.id, true).unwrap(); assert_eq!( run_status_for_stage(&store, &run.id, false, "ERROR"), - "cancelled" + RunStatus::Cancelled ); assert_eq!( run_status_for_stage(&store, &run.id, false, "COMPLETED"), - "done" + RunStatus::Done ); drop(store); @@ -1387,4 +1547,114 @@ mod tests { drop(second); let _ = std::fs::remove_dir_all(dir); } + + /// TASK 2 (crash recovery/reconciliation): a run with nobody holding its + /// supervisor lock — never spawned, or the supervisor already exited + /// after finishing — reads as having no live supervisor. + #[test] + fn probe_reports_no_live_supervisor_when_the_lock_is_free() { + let dir = + std::env::temp_dir().join(format!("orx-probe-free-test-{}", uuid::Uuid::new_v4())); + std::fs::create_dir_all(&dir).unwrap(); + let path = dir.join("run.lock"); + + assert!(!probe_supervisor_lock(&path).unwrap()); + + let _ = std::fs::remove_dir_all(dir); + } + + /// A live supervisor (or, in this test, anything holding the lock) makes + /// the probe report `true` without disturbing the holder's guard. + #[test] + fn probe_reports_a_live_supervisor_while_the_lock_is_held() { + let dir = + std::env::temp_dir().join(format!("orx-probe-held-test-{}", uuid::Uuid::new_v4())); + std::fs::create_dir_all(&dir).unwrap(); + let path = dir.join("run.lock"); + let mut holder = open_supervisor_lock(&path).unwrap(); + let guard = holder.try_write().unwrap(); + + assert!(probe_supervisor_lock(&path).unwrap()); + + drop(guard); + drop(holder); + let _ = std::fs::remove_dir_all(dir); + } + + /// Once the holder releases the lock (the supervisor process exits — here + /// simulated by dropping the guard and the lock itself), a fresh probe + /// immediately sees it as free again: this is the OS-level, no-TTL + /// liveness signal reconciliation relies on. + #[test] + fn probe_flips_back_to_no_supervisor_once_the_holder_releases_it() { + let dir = + std::env::temp_dir().join(format!("orx-probe-release-test-{}", uuid::Uuid::new_v4())); + std::fs::create_dir_all(&dir).unwrap(); + let path = dir.join("run.lock"); + let mut holder = open_supervisor_lock(&path).unwrap(); + let guard = holder.try_write().unwrap(); + assert!(probe_supervisor_lock(&path).unwrap()); + + drop(guard); + drop(holder); + + assert!(!probe_supervisor_lock(&path).unwrap()); + + let _ = std::fs::remove_dir_all(dir); + } + + /// TASK 5 (error classification): giving up on an unreachable backend + /// stamps the stable `BackendUnavailable` code alongside the free-text + /// reason, going through the same terminal-state guard as every other + /// path to `Failed` — a real completion racing the give-up must win. + #[tokio::test] + async fn give_up_on_unreachable_backend_stamps_backend_unavailable() { + let dir = std::env::temp_dir().join(format!( + "orx-supervise-giveup-test-{}", + uuid::Uuid::new_v4() + )); + let store = Store::open_at(dir.clone()).unwrap(); + store + .upsert_run(&StoredRun { + id: "run-1".into(), + experiment_id: "experiment-1".into(), + project_id: "project-1".into(), + status: "running".into(), + backend_json: "{}".into(), + command: String::new(), + created_at: 1, + updated_at: 1, + ended_at: None, + exit_code: None, + commit_sha: None, + result_markdown: None, + cancel_requested: false, + chat_session_id: None, + recovery_reason: None, + error_kind: None, + provenance_json: None, + }) + .unwrap(); + + let (done_tx, _done_rx) = tokio::sync::watch::channel(false); + let log_task = tokio::spawn(async {}); + let synthetic_error = anyhow!("connection refused"); + + give_up_on_unreachable_backend( + &store, + "run-1", + "ssh", + &synthetic_error, + &done_tx, + log_task, + ) + .await; + + let run = store.get_run("run-1").unwrap().unwrap(); + assert_eq!(run.status, "failed"); + assert_eq!(run.error_kind.as_deref(), Some("backend_unavailable")); + assert!(run.recovery_reason.unwrap().contains("ssh backend")); + + let _ = std::fs::remove_dir_all(dir); + } } diff --git a/src/commands/up.rs b/src/commands/up.rs index 965879f2..b70a5792 100644 --- a/src/commands/up.rs +++ b/src/commands/up.rs @@ -36,6 +36,7 @@ use crate::commands::remote_host::{DashboardLock, DashboardLockMode, HostDescrip use crate::error::{anyhow, Result}; use crate::local; use crate::local::chat::ChatHost; +use crate::local::is_terminal; use crate::local::opencode::AgentHost; use crate::store::{ log_path, now_ms, SshHostTest, Store, StoredAgentSelection, StoredChatSession, StoredRun, @@ -84,12 +85,16 @@ pub async fn run(args: UpArgs) -> Result<()> { { let store = Store::open()?; local::chat::reconcile_unfinished_turns(&store)?; - for run in store.list_active_runs()? { - if store.get_local_experiment(&run.experiment_id)?.is_some() { - if let Err(err) = crate::commands::exp::spawn_detached_supervise(&run.id) { - eprintln!("could not recover supervisor for run {}: {err}", run.id); - } - } + // Crash recovery: a supervisor that died with `orx up` (or the whole + // machine), or was never successfully spawned before a prior crash, + // leaves its run `Starting`/`Running` with nobody watching it. This + // one-shot pass on startup is backed up by a periodic pass below — + // this one just gets a fresh supervisor running as early as possible + // rather than waiting out the first interval. + let mut startup_attempts = HashMap::new(); + if let Err(err) = crate::commands::exp::reconcile_active_runs(&store, &mut startup_attempts) + { + eprintln!("orx up: could not reconcile active runs at startup: {err}"); } } @@ -142,6 +147,40 @@ pub async fn run(args: UpArgs) -> Result<()> { } }); } + { + let moving = state.data_dir_move_in_progress.clone(); + let gate = state.data_dir_gate.clone(); + tokio::spawn(async move { + // Not a TTL — `reconcile_active_runs`'s liveness check (an + // `fd_lock` probe) is race-free and never goes stale, so this + // interval only bounds how quickly a crash between two ticks + // (a supervisor OOM-killed, `orx up` itself restarting) gets a + // replacement, not correctness. + const RUN_RECONCILE_INTERVAL: Duration = Duration::from_secs(30); + let mut attempts = HashMap::new(); + loop { + tokio::time::sleep(RUN_RECONCILE_INTERVAL).await; + if moving.load(std::sync::atomic::Ordering::SeqCst) { + continue; + } + let _gate = gate.lock().await; + if moving.load(std::sync::atomic::Ordering::SeqCst) { + continue; + } + let store = match Store::open() { + Ok(store) => store, + Err(err) => { + eprintln!("orx up: could not open the store to reconcile runs: {err}"); + continue; + } + }; + if let Err(err) = crate::commands::exp::reconcile_active_runs(&store, &mut attempts) + { + eprintln!("orx up: could not reconcile active runs: {err}"); + } + } + }); + } spawn_agent_preflight(); // Deliver explicitly registered run wake-ups once their chat becomes idle. @@ -821,6 +860,25 @@ struct ApiRun { #[serde(skip_serializing_if = "Option::is_none")] exit_code: Option, cancel_requested: bool, + /// Free-text explanation when `orx` itself force-failed this run (crash + /// recovery giving up, a backend going unreachable) rather than the + /// backend reporting its own outcome. See `error_kind` for the stable, + /// machine-readable counterpart. + #[serde(skip_serializing_if = "Option::is_none")] + recovery_reason: Option, + /// Stable [`crate::error::ErrorKind`] code for the same failure — the + /// half an agent or the dashboard should switch on. `None` unless the + /// stored value round-trips through a known code, so a value from a + /// newer `orx` version never surfaces as a silently-wrong classification. + #[serde(skip_serializing_if = "Option::is_none")] + error_kind: Option, + /// Launch-time provenance (TASK 6: orx version, launcher OS/arch, + /// launching agent, parent experiment) for reproducing, auditing, or + /// exporting this run — see [`crate::store::ProvenanceManifest`]. `None` + /// for runs launched before this existed, or if the stored JSON somehow + /// fails to parse. + #[serde(skip_serializing_if = "Option::is_none")] + provenance: Option, } impl From<&StoredRun> for ApiRun { @@ -839,6 +897,16 @@ impl From<&StoredRun> for ApiRun { ended_at: run.ended_at, exit_code: run.exit_code, cancel_requested: run.cancel_requested, + recovery_reason: run.recovery_reason.clone(), + error_kind: run + .error_kind + .as_deref() + .and_then(crate::error::ErrorKind::parse) + .map(|k| k.as_str().to_string()), + provenance: run + .provenance_json + .as_deref() + .and_then(crate::store::ProvenanceManifest::parse), } } } @@ -7641,10 +7709,6 @@ fn push_log_delta( )); } -fn is_terminal(status: &str) -> bool { - matches!(status, "done" | "failed" | "cancelled") -} - fn log_size(run_id: &str) -> u64 { std::fs::metadata(log_path(run_id)) .map(|m| m.len()) @@ -8061,6 +8125,9 @@ mod tests { result_markdown: None, cancel_requested: true, chat_session_id: None, + recovery_reason: None, + error_kind: None, + provenance_json: None, }; let value = serde_json::to_value(ApiRun::from(&run)).unwrap(); diff --git a/src/compute.rs b/src/compute.rs index 6223cd59..cc4c6da3 100644 --- a/src/compute.rs +++ b/src/compute.rs @@ -19,7 +19,7 @@ use sha2::{Digest as _, Sha256}; use crate::error::{anyhow, Result}; use crate::jobs::BackendDescriptor; use crate::local::model::{LocalExperiment, LocalProject}; -use crate::store::{log_path, Store, StoredRun}; +use crate::store::{log_path, RunStatus, Store, StoredRun}; #[derive(Debug, Clone)] pub struct SourceSnapshot { @@ -693,6 +693,31 @@ pub fn validate_run_args(args: &crate::ExpRunArgs) -> Result<()> { Ok(()) } +/// Launch-time context for [`crate::store::ProvenanceManifest`] (TASK 6, +/// Priority 4) that doesn't vary by backend: which `orx` build and machine +/// launched the run, and what launched it (a human via the CLI, or a named +/// agent harness/model — resolved from the launching chat session, when +/// there is one). Every backend's own `submit` impl already reopens the +/// store and re-fetches its experiment independently of this call, so this +/// only needs to run once, here, before dispatch. +fn build_provenance( + store: &Store, + args: &crate::ExpRunArgs, + experiment: &LocalExperiment, +) -> crate::store::ProvenanceManifest { + let session = args + .launching_chat_session() + .and_then(|id| store.get_chat_session(&id).ok().flatten()); + crate::store::ProvenanceManifest { + orx_version: env!("CARGO_PKG_VERSION").to_string(), + launcher_os: std::env::consts::OS.to_string(), + launcher_arch: std::env::consts::ARCH.to_string(), + agent_harness: session.as_ref().map(|s| s.harness.clone()), + agent_model: session.and_then(|s| s.model), + parent_experiment_id: experiment.parent_experiment_id.clone(), + } +} + pub async fn submit(args: &crate::ExpRunArgs) -> Result { let backend_id = args.backend.as_deref().unwrap_or("local"); let backend = backend(backend_id)?; @@ -758,6 +783,13 @@ pub async fn submit(args: &crate::ExpRunArgs) -> Result { result_markdown: None, cancel_requested: false, chat_session_id: args.launching_chat_session(), + recovery_reason: None, + error_kind: None, + // Captured once, here, on the row's first `upsert_run` (this is the + // `INSERT` branch — every subsequent upsert for this run id, from + // whichever backend actually launches it, excludes this column from + // its `ON CONFLICT` update). See `build_provenance`. + provenance_json: Some(build_provenance(&store, args, &experiment).to_json()), }; reserve_run(&store, &pending, args.force)?; let pending_backend_json = descriptor.to_json(); @@ -783,7 +815,12 @@ pub async fn submit(args: &crate::ExpRunArgs) -> Result { .as_ref() .is_some_and(|run| run.backend_json != pending_backend_json); if !handle_was_persisted { - store.update_status(&run_id, "failed", Some(crate::store::now_ms()), None)?; + store.update_status( + &run_id, + RunStatus::Failed, + Some(crate::store::now_ms()), + None, + )?; store .set_result_markdown(&run_id, &format!("Compute submission failed: {error}"))?; } @@ -918,4 +955,89 @@ mod tests { args.timeout = Some("1h".into()); assert!(validate_run_args(&args).is_err()); } + + fn experiment_fixture(parent_experiment_id: Option<&str>) -> LocalExperiment { + LocalExperiment { + id: "exp_1".into(), + project_id: "proj_1".into(), + parent_experiment_id: parent_experiment_id.map(str::to_string), + slug: "exp".into(), + branch_name: "orx/exp".into(), + title: None, + description: None, + run_command: "echo hi".into(), + agent_status: "idle".into(), + created_at: 1, + updated_at: 1, + chat_session_id: None, + } + } + + /// TASK 6 (experiment provenance): a run launched from an agent chat + /// session resolves that session's harness/model into the manifest, and + /// snapshots the launching experiment's parent id. + #[test] + fn build_provenance_resolves_agent_from_the_launching_chat_session() { + let dir = + std::env::temp_dir().join(format!("orx-compute-provenance-{}", uuid::Uuid::new_v4())); + let store = crate::store::Store::open_at(dir.clone()).unwrap(); + store + .create_chat_session(&crate::store::StoredChatSession { + id: "chat_A".into(), + project_id: "proj_1".into(), + harness: "claude".into(), + native_session_id: None, + title: None, + title_source: None, + model: Some("claude-sonnet-5".into()), + service_tier: None, + permission_mode: None, + plan_mode: false, + plan_reset_pending: false, + reasoning_level: None, + archived: false, + context_usage_json: None, + bootstrap_context: None, + active_leaf_id: None, + parent_session_id: None, + created_at: 1, + updated_at: 1, + }) + .unwrap(); + let mut args = tinker_args(); + args.chat_session_id = Some("chat_A".into()); + let experiment = experiment_fixture(Some("exp_parent")); + + let manifest = build_provenance(&store, &args, &experiment); + + assert_eq!(manifest.orx_version, env!("CARGO_PKG_VERSION")); + assert_eq!(manifest.launcher_os, std::env::consts::OS); + assert_eq!(manifest.launcher_arch, std::env::consts::ARCH); + assert_eq!(manifest.agent_harness.as_deref(), Some("claude")); + assert_eq!(manifest.agent_model.as_deref(), Some("claude-sonnet-5")); + assert_eq!(manifest.parent_experiment_id.as_deref(), Some("exp_parent")); + + let _ = std::fs::remove_dir_all(&dir); + } + + /// A plain CLI launch (no chat session) and a root experiment (no + /// parent) both correctly resolve to `None`, not a fabricated value. + #[test] + fn build_provenance_has_no_agent_fields_for_a_plain_cli_launch() { + let dir = std::env::temp_dir().join(format!( + "orx-compute-provenance-cli-{}", + uuid::Uuid::new_v4() + )); + let store = crate::store::Store::open_at(dir.clone()).unwrap(); + let args = tinker_args(); + let experiment = experiment_fixture(None); + + let manifest = build_provenance(&store, &args, &experiment); + + assert_eq!(manifest.agent_harness, None); + assert_eq!(manifest.agent_model, None); + assert_eq!(manifest.parent_experiment_id, None); + + let _ = std::fs::remove_dir_all(&dir); + } } diff --git a/src/config.rs b/src/config.rs index ace82005..c666a618 100644 --- a/src/config.rs +++ b/src/config.rs @@ -98,25 +98,61 @@ pub async fn load_credentials() -> Result> { } } -/// Persists credentials as pretty JSON with a trailing newline, mode 0600. -pub async fn save_credentials(creds: &Credentials) -> Result<()> { - let path = credentials_path(); - if let Some(parent) = path.parent() { - fs::create_dir_all(parent).await?; +/// Creates `dir` (recursively) and makes sure it isn't group/world-traversable. +/// Idempotent and safe to call on a dir that already exists with looser +/// permissions — it tightens those too, since `~/.config` itself is +/// world-traversable by convention and a stale dir predating this check +/// would otherwise stay that way forever. +/// +/// Directory-level, not just file-level: a 0600 file inside a 0755 directory +/// stops other users from *reading* it, but not from noticing it exists or +/// racing its creation. +async fn ensure_private_dir(dir: &std::path::Path) -> Result<()> { + fs::create_dir_all(dir).await?; + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + fs::set_permissions(dir, std::fs::Permissions::from_mode(0o700)).await?; + } + Ok(()) +} + +/// Writes `body` to `path`, owner-only (mode 0600) from the moment the file +/// is created — never briefly world/group-readable under the process umask, +/// the way write-then-chmod would leave it. The trailing `set_permissions` +/// is a second pass for the case the file already existed (`mode()` only +/// applies when a new file is created), so a stale, looser-permissioned file +/// from before this fix also gets tightened on the next write. +async fn write_owner_only(path: &std::path::Path, body: &[u8]) -> Result<()> { + #[cfg_attr(not(unix), allow(unused_mut))] + let mut options = fs::OpenOptions::new(); + options.write(true).create(true).truncate(true); + #[cfg(unix)] + options.mode(0o600); + { + use tokio::io::AsyncWriteExt; + options.open(path).await?.write_all(body).await?; } - let body = format!("{}\n", serde_json::to_string_pretty(creds)?); - fs::write(&path, body).await?; #[cfg(unix)] { use std::os::unix::fs::PermissionsExt; - let perms = std::fs::Permissions::from_mode(0o600); - fs::set_permissions(&path, perms).await?; + fs::set_permissions(path, std::fs::Permissions::from_mode(0o600)).await?; } Ok(()) } +/// Persists credentials as pretty JSON with a trailing newline, mode 0600. +pub async fn save_credentials(creds: &Credentials) -> Result<()> { + let path = credentials_path(); + if let Some(parent) = path.parent() { + ensure_private_dir(parent).await?; + } + let body = format!("{}\n", serde_json::to_string_pretty(creds)?); + write_owner_only(&path, body.as_bytes()).await +} + /// Removes the credentials file. Succeeds even if it does not exist (`force`). pub async fn clear_credentials() -> Result<()> { match fs::remove_file(credentials_path()).await { @@ -155,6 +191,41 @@ fn overleaf_credentials() -> OverleafCredentials { .unwrap_or_default() } +/// Sync counterpart of `ensure_private_dir`/`write_owner_only` (this module's +/// callers, chiefly the Overleaf credential setters, are sync — the git +/// bridge they back predates this module's async credential path). Same +/// atomic-mode-at-creation reasoning, blocking `std::fs` instead of `tokio::fs`. +fn ensure_private_dir_sync(dir: &std::path::Path) -> Result<()> { + std::fs::create_dir_all(dir)?; + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + std::fs::set_permissions(dir, std::fs::Permissions::from_mode(0o700))?; + } + Ok(()) +} + +fn write_owner_only_sync(path: &std::path::Path, body: &[u8]) -> Result<()> { + #[cfg_attr(not(unix), allow(unused_mut))] + let mut options = std::fs::OpenOptions::new(); + options.write(true).create(true).truncate(true); + #[cfg(unix)] + { + use std::os::unix::fs::OpenOptionsExt; + options.mode(0o600); // applies on create only + } + { + use std::io::Write; + options.open(path)?.write_all(body)?; + } + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o600))?; + } + Ok(()) +} + /// Writes owner-only, like `save_credentials` beside it. An empty file goes /// away rather than lingering with nothing in it. fn save_overleaf_credentials(credentials: &OverleafCredentials) -> Result<()> { @@ -167,16 +238,10 @@ fn save_overleaf_credentials(credentials: &OverleafCredentials) -> Result<()> { }; } if let Some(parent) = path.parent() { - std::fs::create_dir_all(parent)?; + ensure_private_dir_sync(parent)?; } let body = serde_json::to_string_pretty(credentials)?; - std::fs::write(&path, format!("{body}\n"))?; - #[cfg(unix)] - { - use std::os::unix::fs::PermissionsExt; - std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o600))?; - } - Ok(()) + write_owner_only_sync(&path, format!("{body}\n").as_bytes()) } fn non_empty(value: String) -> Option { @@ -413,21 +478,90 @@ pub fn write_synced_env_vars(values: &[(&str, &str)]) -> Result<()> { } } let body = format!("{}\n", lines.join("\n")); - { - use std::io::Write; - let mut opts = std::fs::OpenOptions::new(); - opts.write(true).create(true).truncate(true); - #[cfg(unix)] - { - use std::os::unix::fs::OpenOptionsExt; - opts.mode(0o600); // applies on create only - } - opts.open(&path)?.write_all(body.as_bytes())?; + write_owner_only_sync(&path, body.as_bytes()) +} + +#[cfg(all(test, unix))] +mod tests { + use super::*; + use std::os::unix::fs::PermissionsExt; + + // Each test uses its own throwaway dir under the OS temp dir (the + // codebase-wide idiom for filesystem tests — see the `orx-tel-*` dirs in + // telemetry.rs) rather than touching `$XDG_CONFIG_HOME`/`config_dir()`, + // which real credential paths resolve through: mutating that env var + // races other modules' tests under the parallel runner (see the + // `ENV_LOCK` note in telemetry.rs) and, if a test ever forgot to + // sandbox it, would silently clobber the developer's own + // ~/.config/openresearch/credentials.json. + fn scratch_dir(label: &str) -> PathBuf { + std::env::temp_dir().join(format!("orx-config-{label}-{}", uuid::Uuid::new_v4())) } - #[cfg(unix)] - { - use std::os::unix::fs::PermissionsExt; - std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o600))?; + + fn mode(path: &std::path::Path) -> u32 { + std::fs::metadata(path).unwrap().permissions().mode() & 0o777 + } + + #[tokio::test] + async fn write_owner_only_creates_file_mode_0600() { + let dir = scratch_dir("write-owner-only"); + std::fs::create_dir_all(&dir).unwrap(); + let path = dir.join("secret.json"); + write_owner_only(&path, b"{\"token\":\"x\"}\n") + .await + .unwrap(); + assert_eq!(mode(&path), 0o600); + assert_eq!( + std::fs::read_to_string(&path).unwrap(), + "{\"token\":\"x\"}\n" + ); + } + + #[tokio::test] + async fn write_owner_only_tightens_a_preexisting_looser_file() { + let dir = scratch_dir("write-owner-only-tighten"); + std::fs::create_dir_all(&dir).unwrap(); + let path = dir.join("secret.json"); + std::fs::write(&path, "stale").unwrap(); + std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o644)).unwrap(); + + write_owner_only(&path, b"fresh").await.unwrap(); + + assert_eq!(mode(&path), 0o600); + assert_eq!(std::fs::read_to_string(&path).unwrap(), "fresh"); + } + + #[tokio::test] + async fn ensure_private_dir_creates_mode_0700() { + let dir = scratch_dir("ensure-private-dir").join("nested"); + ensure_private_dir(&dir).await.unwrap(); + assert_eq!(mode(&dir), 0o700); + } + + #[tokio::test] + async fn ensure_private_dir_tightens_a_preexisting_looser_dir() { + let dir = scratch_dir("ensure-private-dir-tighten"); + std::fs::create_dir_all(&dir).unwrap(); + std::fs::set_permissions(&dir, std::fs::Permissions::from_mode(0o755)).unwrap(); + + ensure_private_dir(&dir).await.unwrap(); + + assert_eq!(mode(&dir), 0o700); + } + + #[test] + fn write_owner_only_sync_creates_file_mode_0600() { + let dir = scratch_dir("write-owner-only-sync"); + std::fs::create_dir_all(&dir).unwrap(); + let path = dir.join("overleaf.json"); + write_owner_only_sync(&path, b"{}\n").unwrap(); + assert_eq!(mode(&path), 0o600); + } + + #[test] + fn ensure_private_dir_sync_creates_mode_0700() { + let dir = scratch_dir("ensure-private-dir-sync").join("nested"); + ensure_private_dir_sync(&dir).unwrap(); + assert_eq!(mode(&dir), 0o700); } - Ok(()) } diff --git a/src/error.rs b/src/error.rs index 0aa3cf30..353c1fc9 100644 --- a/src/error.rs +++ b/src/error.rs @@ -13,6 +13,80 @@ pub use anyhow::{anyhow, bail, Context, Error, Result}; use crate::config::{load_credentials, Credentials}; +/// Stable, machine-readable failure category (Priority 9: "Error +/// Classification and Observability"). Distinct from the crate-wide +/// `anyhow::Error` above (used for ordinary `?`-propagated command +/// failures): this is a small, closed vocabulary a consumer — the +/// dashboard, an agent parsing `orx exp status --json` — can switch on +/// reliably, printed alongside (never instead of) the free-text explanation +/// a failure already carries (`StoredRun::result_markdown`/`recovery_reason`). +/// +/// Wired in so far at the two places `orx` itself force-fails a run rather +/// than the backend reporting its own outcome: +/// [`crate::store::Store::mark_run_unrecoverable`], called from +/// `commands::exp::reconcile_active_runs` (TASK 2: [`Self::Reconciliation`]) +/// and `commands::supervise::give_up_on_unreachable_backend` (TASK 4: +/// [`Self::BackendUnavailable`]). Classifying every other failure site +/// across 8 backends and the rest of the CLI is future work. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ErrorKind { + /// Bad or missing configuration, caught before anything ran. + Configuration, + /// Missing, expired, or rejected credentials. + Authentication, + /// Local Git state didn't allow the operation (dirty tree, bad branch, …). + GitState, + /// The compute backend could not be reached at all. + BackendUnavailable, + /// The job could not be launched. + Launch, + /// The job launched but failed during execution. + Runtime, + /// Cancellation itself could not be completed. + Cancellation, + /// Crash-recovery/reconciliation gave up on the run. + Reconciliation, + /// The local SQLite store itself failed. + Storage, +} + +impl ErrorKind { + pub fn as_str(self) -> &'static str { + match self { + Self::Configuration => "configuration_error", + Self::Authentication => "authentication_error", + Self::GitState => "git_state_error", + Self::BackendUnavailable => "backend_unavailable", + Self::Launch => "launch_failure", + Self::Runtime => "runtime_failure", + Self::Cancellation => "cancellation_failure", + Self::Reconciliation => "reconciliation_failure", + Self::Storage => "storage_failure", + } + } + + pub fn parse(code: &str) -> Option { + Some(match code { + "configuration_error" => Self::Configuration, + "authentication_error" => Self::Authentication, + "git_state_error" => Self::GitState, + "backend_unavailable" => Self::BackendUnavailable, + "launch_failure" => Self::Launch, + "runtime_failure" => Self::Runtime, + "cancellation_failure" => Self::Cancellation, + "reconciliation_failure" => Self::Reconciliation, + "storage_failure" => Self::Storage, + _ => return None, + }) + } +} + +impl std::fmt::Display for ErrorKind { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + /// Loads stored credentials or exits the process with code 1 and the message /// `Not logged in. Run `orx login` first.` (stderr), exactly like the TS /// `requireCredentials`. @@ -39,3 +113,47 @@ pub async fn require_credentials() -> Credentials { } } } + +#[cfg(test)] +mod tests { + use super::*; + + const ALL: [ErrorKind; 9] = [ + ErrorKind::Configuration, + ErrorKind::Authentication, + ErrorKind::GitState, + ErrorKind::BackendUnavailable, + ErrorKind::Launch, + ErrorKind::Runtime, + ErrorKind::Cancellation, + ErrorKind::Reconciliation, + ErrorKind::Storage, + ]; + + #[test] + fn error_kind_as_str_round_trips_through_parse() { + for kind in ALL { + assert_eq!(ErrorKind::parse(kind.as_str()), Some(kind)); + } + assert_eq!(ErrorKind::parse("not-a-real-code"), None); + } + + #[test] + fn error_kind_codes_are_unique_and_snake_case() { + let codes: Vec<&str> = ALL.iter().map(|k| k.as_str()).collect(); + let mut sorted = codes.clone(); + sorted.sort_unstable(); + sorted.dedup(); + assert_eq!( + sorted.len(), + codes.len(), + "duplicate error codes: {codes:?}" + ); + for code in codes { + assert!( + code.chars().all(|c| c.is_ascii_lowercase() || c == '_'), + "not snake_case: {code}" + ); + } + } +} diff --git a/src/jobs/huggingface.rs b/src/jobs/huggingface.rs index d716f23a..e15fc14d 100644 --- a/src/jobs/huggingface.rs +++ b/src/jobs/huggingface.rs @@ -203,6 +203,20 @@ pub struct JobInfo { pub status: JobStatus, } +impl JobInfo { + /// Adapts HF's nested `status.{stage,message}` — the one backend whose + /// native API response doesn't already match the shape every other + /// backend returns directly — to [`crate::jobs::JobState`], so callers + /// (`supervise.rs`) don't need an HF-specific field-access special case + /// (TASK 4: one canonical shape across backends). + pub fn state(&self) -> crate::jobs::JobState { + crate::jobs::JobState { + stage: self.status.stage.clone(), + message: self.status.message.clone(), + } + } +} + async fn check(res: reqwest::Response, what: &str) -> Result { let status = res.status(); if status.is_success() { diff --git a/src/jobs/kubernetes.rs b/src/jobs/kubernetes.rs index d8882d6c..0b851052 100644 --- a/src/jobs/kubernetes.rs +++ b/src/jobs/kubernetes.rs @@ -597,12 +597,9 @@ fn prepare_docs( // --- job lifecycle ------------------------------------------------------------ -/// Job state in the shared stage vocabulary. -#[derive(Debug, Clone)] -pub struct JobState { - pub stage: String, - pub message: Option, -} +/// Job state in the shared stage vocabulary — see [`crate::jobs::JobState`], +/// which this re-exports (TASK 4: one canonical shape across backends). +pub use crate::jobs::JobState; pub async fn inspect_job(context: Option<&str>, namespace: &str, name: &str) -> Result { let raw = match kubectl( diff --git a/src/jobs/localbox.rs b/src/jobs/localbox.rs index a2f81581..d3734bc9 100644 --- a/src/jobs/localbox.rs +++ b/src/jobs/localbox.rs @@ -216,10 +216,17 @@ pub fn stream_logs(dir: &Path, skip: u64, sink: &mut (dyn FnMut(&str) + Send)) - } /// TERM the process group (pid == pgid), else the pid alone; on Windows, the process tree. +/// Idempotent (TASK 4's cancellation contract): a process already gone — +/// whether it exited on its own, or a prior `cancel_job` call already +/// terminated it — is not an error to cancel again; there's simply nothing +/// left to do. pub fn cancel_job(dir: &Path) -> Result<()> { let pid = std::fs::read_to_string(dir.join("pid")) .map_err(|e| anyhow!("Could not read the run's pid: {}", e))?; let pid = pid.trim().to_string(); + if !pid_alive(&pid) { + return Ok(()); + } #[cfg(windows)] { terminate_tree(&pid) @@ -402,12 +409,23 @@ mod tests { state } + /// This is `local`'s instance of the TASK 4 (Priority 3, "Standardize + /// Compute Backend Contracts") conformance suite — the codebase has no + /// generic cross-backend test harness (only `local` can run its own + /// launch/inspect/cancel lifecycle end-to-end without external + /// infrastructure: a real cluster, ssh host, or cloud credentials — see + /// the TASK 4 PR description), so the contract is expressed here as one + /// exhaustive scenario rather than a reusable framework with a single + /// implementer. Each block below is labeled with the contract property + /// from `OpenResearch_Improvement_Priorities.md` it verifies; a future + /// backend gaining real test infrastructure should assert the same set. #[test] fn local_job_lifecycle() { // The only test that touches ORX_DATA_DIR, so the global env is safe. let base = std::env::temp_dir().join(format!("orx-localbox-test-{}", std::process::id())); std::env::set_var("ORX_DATA_DIR", &base); + // Contract: launch succeeds with a valid configuration. let dir = run_job(&LocalJobSpec { run_id: "lifecycle".into(), script: "[ -n \"$TINKER_API_KEY\" ] && echo hello-$ORX_TEST_VAR".into(), @@ -422,12 +440,84 @@ mod tests { assert!(run_sh.contains("export PYTHONUNBUFFERED='1'\n")); assert!(!run_sh.contains("s3cr3t-value")); + // Contract: logs remain readable after completion — both a resumed + // read past what's already been consumed (nothing new)... let mut lines = Vec::new(); let seen = stream_logs(&dir, 0, &mut |l| lines.push(l.to_string())).unwrap(); assert_eq!(seen, 1); assert_eq!(lines, ["hello-42"]); - // Re-poll past the consumed lines: nothing new. assert_eq!(stream_logs(&dir, seen, &mut |_| ()).unwrap(), seen); + // ...and a fresh read from the start, well after the job (and its + // supervisor, in the real system) is long gone. + let mut replayed = Vec::new(); + let replayed_seen = stream_logs(&dir, 0, &mut |l| replayed.push(l.to_string())).unwrap(); + assert_eq!(replayed_seen, seen); + assert_eq!(replayed, lines, "the full log must still be replayable"); + + // Contract: status reaches one terminal state only. Wires this run's + // real, backend-produced terminal stage through the same + // `stage_to_run_status` + `Store::update_status` path `supervise.rs` + // uses, and confirms TASK 1's transition guard rejects a conflicting + // second terminal write end-to-end for a real backend's output — + // not just in `store.rs`'s own unit tests. + { + use crate::store::{RunStatus, Store}; + let store_dir = base.join("conformance-store"); + let store = Store::open_at(store_dir.clone()).unwrap(); + let run = crate::store::StoredRun { + id: "lifecycle".into(), + experiment_id: "exp_1".into(), + project_id: "proj_1".into(), + status: "running".into(), + backend_json: "{}".into(), + command: String::new(), + created_at: 1, + updated_at: 1, + ended_at: None, + exit_code: None, + commit_sha: None, + result_markdown: None, + cancel_requested: false, + chat_session_id: None, + recovery_reason: None, + error_kind: None, + provenance_json: None, + }; + store.upsert_run(&run).unwrap(); + let terminal = crate::jobs::stage_to_run_status(&state.stage); + assert_eq!(terminal, RunStatus::Done); + assert!(store + .update_status("lifecycle", terminal, Some(2), Some(0)) + .unwrap()); + // A second, conflicting terminal write — as a duplicate poll or a + // racing supervisor might produce — must be rejected, not applied. + assert!(!store + .update_status("lifecycle", RunStatus::Failed, Some(3), Some(1)) + .unwrap()); + assert_eq!(store.get_run("lifecycle").unwrap().unwrap().status, "done"); + let _ = std::fs::remove_dir_all(&store_dir); + } + + // Contract: invalid configuration fails before execution. A run id + // that collides with an existing *file* at the target run dir path + // can't have its directory created — `run_job` must fail up front + // rather than partially launching into a broken location. + { + let blocked_dir = run_dir("blocked"); + std::fs::create_dir_all(blocked_dir.parent().unwrap()).unwrap(); + std::fs::write(&blocked_dir, b"not a directory").unwrap(); + let result = run_job(&LocalJobSpec { + run_id: "blocked".into(), + script: "echo should-never-run".into(), + env: HashMap::new(), + secret_env: HashMap::new(), + }); + assert!( + result.is_err(), + "launch must fail before spawning anything when the run dir can't be created" + ); + let _ = std::fs::remove_file(&blocked_dir); + } let failed = run_job(&LocalJobSpec { run_id: "failing".into(), @@ -453,6 +543,9 @@ mod tests { // TERM leaves either a dead pid with no exit_code, or a non-zero // exit_code if run.sh got to write one — ERROR either way. assert_eq!(state.stage, "ERROR"); + // Contract: cancellation is idempotent. The process is long dead by + // now; cancelling again must still succeed, not error. + cancel_job(&cancelled).unwrap(); std::env::remove_var("ORX_DATA_DIR"); let _ = std::fs::remove_dir_all(&base); diff --git a/src/jobs/mod.rs b/src/jobs/mod.rs index 79a1952e..091717bc 100644 --- a/src/jobs/mod.rs +++ b/src/jobs/mod.rs @@ -227,14 +227,15 @@ impl BackendDescriptor { /// Map an HF job stage onto the local run-status vocabulary. `UPDATING` appears /// in the wild as a live state (see huggingface_hub). -pub fn stage_to_run_status(stage: &str) -> &'static str { +pub fn stage_to_run_status(stage: &str) -> crate::store::RunStatus { + use crate::store::RunStatus; match stage { - "SCHEDULING" => "starting", - "RUNNING" | "UPDATING" => "running", - "COMPLETED" => "done", - "ERROR" => "failed", - "CANCELED" | "DELETED" => "cancelled", - _ => "running", + "SCHEDULING" => RunStatus::Starting, + "RUNNING" | "UPDATING" => RunStatus::Running, + "COMPLETED" => RunStatus::Done, + "ERROR" => RunStatus::Failed, + "CANCELED" | "DELETED" => RunStatus::Cancelled, + _ => RunStatus::Running, } } @@ -242,6 +243,70 @@ pub fn is_terminal_stage(stage: &str) -> bool { matches!(stage, "COMPLETED" | "CANCELED" | "ERROR" | "DELETED") } +/// Canonical shape for a backend's poll result, in the shared stage +/// vocabulary above. `ssh`, `kubernetes`, `modal`, and `slurm` re-export this +/// type as their own `JobState` (`ray` as `JobInfo`) rather than each +/// defining an identical struct — one shape, so `supervise.rs`'s per-backend +/// poll loops never need backend-specific field access. Huggingface's native +/// API response nests this one level deeper (`JobInfo { status: JobStatus { +/// .. } }`); see `huggingface::JobInfo::state`. +#[derive(Debug, Clone)] +pub struct JobState { + pub stage: String, + pub message: Option, +} + +/// Debounces a scheduler-reported "GONE" stage — the job vanished from the +/// scheduler's own bookkeeping (Slurm's `squeue`/`sacct`, Ray's job list), +/// as opposed to a definite terminal report — before believing it. This also +/// fires during a scheduler restart or while a result is still propagating, +/// so a momentary "GONE" must persist for a full window before being treated +/// as a real, unrecoverable disappearance; any other observation resets it. +/// Shared by every backend whose scheduler can report this, so the window +/// and the reset rule can't drift between them. +pub struct GoneDebounce { + threshold: u32, + consecutive: u32, +} + +/// What [`GoneDebounce::observe`] learned from one poll's raw stage. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum GoneOutcome { + /// Not "GONE" — proceed normally with the raw stage (the counter reset). + NotGone, + /// "GONE", but hasn't persisted through the full debounce window yet — + /// keep polling as usual without treating this as terminal. + StillWaiting, + /// "GONE" has now persisted for the full window — believe it: synthesize + /// a terminal `ERROR` state rather than waiting any longer. + ConfirmedGone, +} + +impl GoneDebounce { + /// `window` / `poll_interval` (rounded down, minimum 1) consecutive + /// "GONE" polls are required before [`GoneOutcome::ConfirmedGone`]. + pub fn new(window: std::time::Duration, poll_interval: std::time::Duration) -> Self { + let threshold = (window.as_secs() / poll_interval.as_secs().max(1)).max(1) as u32; + Self { + threshold, + consecutive: 0, + } + } + + pub fn observe(&mut self, stage: &str) -> GoneOutcome { + if stage != "GONE" { + self.consecutive = 0; + return GoneOutcome::NotGone; + } + self.consecutive += 1; + if self.consecutive >= self.threshold { + GoneOutcome::ConfirmedGone + } else { + GoneOutcome::StillWaiting + } + } +} + #[cfg(test)] mod tests { use super::*; @@ -358,4 +423,45 @@ mod tests { Some("cp1252") ); } + + /// TASK 4 (compute backend contracts): a lone "GONE" poll — the shape a + /// scheduler restart or an NFS-lagged status write produces — must not be + /// believed; the debounce window must fully elapse first. + #[test] + fn gone_debounce_requires_the_full_window_of_consecutive_gone_polls() { + let mut debounce = GoneDebounce::new( + std::time::Duration::from_secs(15), + std::time::Duration::from_secs(5), + ); + assert_eq!(debounce.observe("GONE"), GoneOutcome::StillWaiting); + assert_eq!(debounce.observe("GONE"), GoneOutcome::StillWaiting); + assert_eq!(debounce.observe("GONE"), GoneOutcome::ConfirmedGone); + } + + /// Any real observation in between resets the count — a job that flaps + /// between "GONE" and a real stage never accumulates toward the window. + #[test] + fn gone_debounce_resets_on_any_non_gone_observation() { + let mut debounce = GoneDebounce::new( + std::time::Duration::from_secs(15), + std::time::Duration::from_secs(5), + ); + assert_eq!(debounce.observe("GONE"), GoneOutcome::StillWaiting); + assert_eq!(debounce.observe("GONE"), GoneOutcome::StillWaiting); + assert_eq!(debounce.observe("RUNNING"), GoneOutcome::NotGone); + assert_eq!(debounce.observe("GONE"), GoneOutcome::StillWaiting); + assert_eq!(debounce.observe("GONE"), GoneOutcome::StillWaiting); + assert_eq!(debounce.observe("GONE"), GoneOutcome::ConfirmedGone); + } + + /// A window shorter than one poll interval still requires at least one + /// "GONE" poll — never confirms on the first sight of anything. + #[test] + fn gone_debounce_threshold_is_never_zero() { + let mut debounce = GoneDebounce::new( + std::time::Duration::from_secs(1), + std::time::Duration::from_secs(5), + ); + assert_eq!(debounce.observe("GONE"), GoneOutcome::ConfirmedGone); + } } diff --git a/src/jobs/modal.rs b/src/jobs/modal.rs index b6a97e38..9f516cf9 100644 --- a/src/jobs/modal.rs +++ b/src/jobs/modal.rs @@ -447,12 +447,10 @@ pub async fn run_job(spec: &ModalJobSpec) -> Result { .ok_or_else(|| anyhow!("modal submit returned no sandboxId")) } -/// Sandbox state in the shared stage vocabulary (see `jobs::stage_to_run_status`). -#[derive(Debug, Clone)] -pub struct JobState { - pub stage: String, - pub message: Option, -} +/// Sandbox state in the shared stage vocabulary — see +/// [`crate::jobs::JobState`], which this re-exports (TASK 4: one canonical +/// shape across backends). +pub use crate::jobs::JobState; pub async fn inspect_job(sandbox_id: &str) -> Result { let out = launcher_capture(&["status", sandbox_id], None).await?; diff --git a/src/jobs/ray.rs b/src/jobs/ray.rs index daf46368..186954c2 100644 --- a/src/jobs/ray.rs +++ b/src/jobs/ray.rs @@ -249,12 +249,10 @@ pub struct JobSubmission { pub working_dir: Option, } -#[derive(Debug, Clone)] -pub struct JobInfo { - /// Shared stage vocabulary (`SCHEDULING` / `RUNNING` / `COMPLETED` / …). - pub stage: String, - pub message: Option, -} +/// Job state in the shared stage vocabulary (`SCHEDULING` / `RUNNING` / +/// `COMPLETED` / …) — see [`crate::jobs::JobState`], which this re-exports +/// under Ray's existing name (TASK 4: one canonical shape across backends). +pub use crate::jobs::JobState as JobInfo; #[derive(Debug, Deserialize)] struct RawJobStatus { diff --git a/src/jobs/slurm.rs b/src/jobs/slurm.rs index 3661bfd8..6e84b6a8 100644 --- a/src/jobs/slurm.rs +++ b/src/jobs/slurm.rs @@ -246,12 +246,9 @@ pub async fn run_job(spec: &SlurmJobSpec) -> Result { parse_job_id(&out) } -/// Job state in the shared stage vocabulary (see `jobs::stage_to_run_status`). -#[derive(Debug, Clone)] -pub struct JobState { - pub stage: String, - pub message: Option, -} +/// Job state in the shared stage vocabulary — see [`crate::jobs::JobState`], +/// which this re-exports (TASK 4: one canonical shape across backends). +pub use crate::jobs::JobState; /// One combined remote probe emitting a single token — exit_code first /// (ground truth), then live queue state, then accounting for jobs that left diff --git a/src/jobs/ssh.rs b/src/jobs/ssh.rs index 0cf5167a..1e12dda0 100644 --- a/src/jobs/ssh.rs +++ b/src/jobs/ssh.rs @@ -449,12 +449,9 @@ pub async fn run_job(spec: &SshJobSpec) -> Result { Ok(dir) } -/// Job state in the shared stage vocabulary (see `jobs::stage_to_run_status`). -#[derive(Debug, Clone)] -pub struct JobState { - pub stage: String, - pub message: Option, -} +/// Job state in the shared stage vocabulary — see [`crate::jobs::JobState`], +/// which this re-exports (TASK 4: one canonical shape across backends). +pub use crate::jobs::JobState; pub async fn inspect_job(target: &SshTarget, dir: &str) -> Result { // exit_code present -> finished; pid alive -> running; pid dead & no diff --git a/src/local/chat/mod.rs b/src/local/chat/mod.rs index 601fc8bd..ca9e5a29 100644 --- a/src/local/chat/mod.rs +++ b/src/local/chat/mod.rs @@ -9083,6 +9083,9 @@ mod run_wakeup_tests { result_markdown: None, cancel_requested: false, chat_session_id: Some("owner".into()), + recovery_reason: None, + error_kind: None, + provenance_json: None, } } diff --git a/src/local/demo.rs b/src/local/demo.rs index 55797de7..911ac2f7 100644 --- a/src/local/demo.rs +++ b/src/local/demo.rs @@ -451,6 +451,9 @@ fn seed_at( result_markdown: Some(RESULT_MARKDOWN.into()), cancel_requested: false, chat_session_id: None, + recovery_reason: None, + error_kind: None, + provenance_json: None, }; let session = StoredChatSession { id: SESSION_ID.into(), diff --git a/src/local/hf.rs b/src/local/hf.rs index 45f42f01..f89dcaeb 100644 --- a/src/local/hf.rs +++ b/src/local/hf.rs @@ -145,6 +145,9 @@ pub async fn submit_local_hf_with_source( .get_run(&run_id)? .is_some_and(|run| run.cancel_requested), chat_session_id: args.launching_chat_session(), + recovery_reason: None, + error_kind: None, + provenance_json: None, }; store.upsert_run(&run)?; diff --git a/src/local/k8s.rs b/src/local/k8s.rs index 465c33ce..f3a048f7 100644 --- a/src/local/k8s.rs +++ b/src/local/k8s.rs @@ -189,6 +189,9 @@ pub async fn submit_local_k8s_with_source( .get_run(&run_id)? .is_some_and(|run| run.cancel_requested), chat_session_id: args.launching_chat_session(), + recovery_reason: None, + error_kind: None, + provenance_json: None, }; store.upsert_run(&run)?; diff --git a/src/local/localrun.rs b/src/local/localrun.rs index 96581621..d2ed7e9e 100644 --- a/src/local/localrun.rs +++ b/src/local/localrun.rs @@ -157,6 +157,9 @@ async fn submit_controller_run( .get_run(&run_id)? .is_some_and(|run| run.cancel_requested), chat_session_id: args.launching_chat_session(), + recovery_reason: None, + error_kind: None, + provenance_json: None, }; store.upsert_run(&run)?; diff --git a/src/local/mod.rs b/src/local/mod.rs index d94994de..999c493f 100644 --- a/src/local/mod.rs +++ b/src/local/mod.rs @@ -50,7 +50,7 @@ use crate::store::{now_ms, Store, StoredRun}; /// Terminal run states — the run is finished and won't change further. pub fn is_terminal(status: &str) -> bool { - matches!(status, "done" | "failed" | "cancelled") + crate::store::is_terminal_status(status) } /// The stored run, but only when it belongs to a registered local experiment. diff --git a/src/local/modal.rs b/src/local/modal.rs index 44644029..3f1b9c47 100644 --- a/src/local/modal.rs +++ b/src/local/modal.rs @@ -149,6 +149,9 @@ pub async fn submit_local_modal_with_source( .get_run(&run_id)? .is_some_and(|run| run.cancel_requested), chat_session_id: args.launching_chat_session(), + recovery_reason: None, + error_kind: None, + provenance_json: None, }; store.upsert_run(&run)?; diff --git a/src/local/openresearch.rs b/src/local/openresearch.rs index 022d87cf..cc1c0e23 100644 --- a/src/local/openresearch.rs +++ b/src/local/openresearch.rs @@ -202,6 +202,9 @@ pub async fn submit_local_openresearch_with_source( .get_run(&run_id)? .is_some_and(|run| run.cancel_requested), chat_session_id: args.launching_chat_session(), + recovery_reason: None, + error_kind: None, + provenance_json: None, }; // From here the box is billing: never leak it behind an error the store diff --git a/src/local/ray.rs b/src/local/ray.rs index 50d71e5d..3e7a8311 100644 --- a/src/local/ray.rs +++ b/src/local/ray.rs @@ -162,6 +162,9 @@ pub async fn submit_local_ray_with_source( .get_run(&run_id)? .is_some_and(|run| run.cancel_requested), chat_session_id: args.launching_chat_session(), + recovery_reason: None, + error_kind: None, + provenance_json: None, }; store.upsert_run(&run)?; diff --git a/src/local/resolve.rs b/src/local/resolve.rs index a6cbc73d..113707bb 100644 --- a/src/local/resolve.rs +++ b/src/local/resolve.rs @@ -92,6 +92,9 @@ mod tests { result_markdown: None, cancel_requested: false, chat_session_id: None, + recovery_reason: None, + error_kind: None, + provenance_json: None, } } diff --git a/src/local/slurm.rs b/src/local/slurm.rs index 09ac2039..13c84571 100644 --- a/src/local/slurm.rs +++ b/src/local/slurm.rs @@ -161,6 +161,9 @@ pub async fn submit_local_slurm_with_source( .get_run(&run_id)? .is_some_and(|run| run.cancel_requested), chat_session_id: args.launching_chat_session(), + recovery_reason: None, + error_kind: None, + provenance_json: None, }; store.upsert_run(&run)?; diff --git a/src/local/ssh.rs b/src/local/ssh.rs index 6811788f..843a4f20 100644 --- a/src/local/ssh.rs +++ b/src/local/ssh.rs @@ -134,6 +134,9 @@ pub async fn submit_local_ssh_with_source( .get_run(&run_id)? .is_some_and(|run| run.cancel_requested), chat_session_id: args.launching_chat_session(), + recovery_reason: None, + error_kind: None, + provenance_json: None, }; store.upsert_run(&run)?; diff --git a/src/main.rs b/src/main.rs index bc92a1cf..841470df 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ //! `main().catch(err => { console.error(err.message); process.exit(1) })`. mod browser; +mod cli; mod editors; // DTOs faithfully mirror every API wire field; not all are read by the CLI yet. #[allow(dead_code)] @@ -30,774 +31,16 @@ mod plane; mod remote; mod store; mod telemetry; +mod token_auth; mod updates; mod workspace_state; -use clap::{Args, Parser, Subcommand, ValueEnum}; +// The CLI schema (Cli, Command, and every subcommand's Args/Subcommand types) +// lives in `cli`, split by domain; re-export it here so the rest of the crate +// keeps addressing it as `crate::LoginArgs`, `crate::Command`, etc. +pub use cli::*; -#[derive(Parser, Debug)] -#[command( - name = "orx", - about = "OpenResearch CLI", - version, - disable_help_subcommand = true -)] -struct Cli { - // Optional so a bare `orx` prints USAGE to stdout and exits 0 (like the TS - // `if (!command) { console.log(USAGE); return; }`) instead of clap's exit-2. - #[command(subcommand)] - command: Option, - - /// Disable anonymous usage analytics for this run. To disable it - /// persistently, run `orx telemetry off`. - #[arg(long, global = true)] - no_telemetry: bool, -} - -#[derive(Subcommand, Debug)] -// NOTE: `local::harness::plan_gate` keeps a hand-maintained allowlist of the -// read-only verbs here (what Claude plan mode may run without approval). When -// you add a *read-only* subcommand, add it there too, or it stays gated in plan -// mode. `readonly_verbs_are_real_commands` catches renames but not additions. -enum Command { - /// Log in via the browser and store a token. - Login(LoginArgs), - - /// Remove the stored token. - Logout, - - /// List projects registered in the local orx store. - Projects(ProjectsArgs), - - /// List organizations available for OpenResearch compute. - Orgs(OrgsArgs), - - /// Operate on one local project. - Project(ProjectArgs), - - /// Delegate a task to a second agent session. - Agent(AgentArgs), - - /// List a project's runs. - Runs(RunsArgs), - - /// Read a run's terminal log (tail by default). - Logs(LogsArgs), - - /// Add an experiment node to a local `orx up` project. - #[command(name = "create-experiment")] - CreateExperiment(CreateExperimentArgs), - - /// List the GPU compute catalog. - Compute(ComputeArgs), - - /// Spin up standalone compute in an organization (no experiment). - Instance(InstanceArgs), - - /// Register this computer's SSH key so the boxes you provision accept it. - #[command(name = "ssh-key")] - SshKey(SshKeyArgs), - - /// Operate on one local experiment node. - Exp(ExpArgs), - - /// Print CLI usage for agents, or fetch a skill doc. - Skill(SkillArgs), - - /// Add reusable skills to the local OpenResearch library. - Skills(LibraryArgs), - - /// Add reusable LaTeX templates to the local OpenResearch library. - Templates(LibraryArgs), - - /// Install the OpenResearch skill into local coding agents (Claude Code, Codex, OpenCode, Cursor). - #[command(name = "install-skills")] - InstallSkills(InstallSkillsArgs), - - /// Call one paper-retrieval primitive; the caller owns the search loop. - Discover(DiscoverArgs), - - /// Fetch a paper: alphaXiv report/full-text, or OpenAlex/bioRxiv metadata. - /// The source is auto-detected from the id (override with `--source`). - Paper(PaperArgs), - - /// Show the CLI version; `--check` compares it to the latest release. - Version(VersionArgs), - - /// Update orx to the latest release (installer-script installs only). - Update(UpdateArgs), - - /// Link the macOS app's `orx` onto your PATH (macOS app installs only). - InstallCli(InstallCliArgs), - - /// Permanently delete the local database, CLI executable, or both. - Delete(DeleteArgs), - - /// Loopback HTTP/SSE daemon over the local run store (jobs sibling of - /// `opencode serve`); the api tunnels to it on agent boxes. - Serve(ServeArgs), - - /// Supervise one local run: tail backend logs, persist status, and honor - /// local cancel intent. Spawned detached by `exp run`. - Supervise(SuperviseArgs), - - /// Start the local autoresearch dashboard on 127.0.0.1: embedded UI, - /// JSON/SSE API over the local store, and the opencode agent proxy. - Up(UpArgs), - - /// Turn anonymous usage analytics on or off, or show current status. - Telemetry(TelemetryArgs), - - /// Internal: the Claude plan-mode `PreToolUse` hook body. Reads the hook - /// payload on stdin and prints an allow decision for read-only `orx` - /// inspection; not a user command. - #[command(name = "plan-gate", hide = true)] - PlanGate, - - /// Internal: the plan-mode permission bridge. A stdio MCP server Claude - /// Code spawns (`--mcp-config`) and consults (`--permission-prompt-tool`); - /// relays each permission request to the running `orx up`, which surfaces - /// an approval card and blocks until answered. Not a user command. - #[command(name = "mcp-gate", hide = true)] - McpGate, - - /// Internal: detached worker for optional local-project publication. - #[command(name = "publish-branch", hide = true)] - PublishBranch(PublishBranchArgs), - - /// Internal: manage a persistent SSH remote host. - #[command(name = "remote-host", hide = true)] - RemoteHost(RemoteHostArgs), -} - -#[derive(Args, Debug)] -struct PublishBranchArgs { - repo_path: std::path::PathBuf, - branch: String, - owner: String, - repo: String, -} - -#[derive(Args, Debug)] -pub struct LoginArgs { - /// Override the API base URL (or set OPENRESEARCH_API_URL). - #[arg(long = "api-url")] - pub api_url: Option, -} - -#[derive(Args, Debug)] -pub struct ProjectsArgs { - /// Emit local project records as JSON. - #[arg(long)] - pub json: bool, -} - -#[derive(Args, Debug)] -pub struct OrgsArgs { - /// Emit organization records as JSON. - #[arg(long)] - pub json: bool, -} - -#[derive(Args, Debug)] -pub struct ProjectArgs { - #[command(subcommand)] - pub command: ProjectCommand, -} - -#[derive(Subcommand, Debug)] -pub enum ProjectCommand { - /// Show a local project's details and experiment tree. - View { project_id: String }, - - /// Edit a local project's name or run command. - Edit { - project_id: String, - /// Rename the project. - #[arg(long)] - name: Option, - /// Set the project's default run command. - /// New experiments inherit it; pass '' to clear. - #[arg(long = "run-command")] - run_command: Option, - }, -} - -#[derive(Args, Debug)] -pub struct RunsArgs { - pub project_id: String, - /// Filter to one experiment. - #[arg(long)] - pub experiment: Option, -} - -#[derive(Args, Debug)] -pub struct LogsArgs { - pub run_id: String, - /// Read from the start instead of the tail. - #[arg(long)] - pub head: bool, - /// Max bytes to read. - #[arg(long)] - pub bytes: Option, - /// Exact byte window `:`. - #[arg(long)] - pub range: Option, -} - -#[derive(Args, Debug)] -pub struct CreateExperimentArgs { - /// Local project id from `orx projects`. - pub project_id: String, - /// Experiment title (required). - #[arg(long)] - pub title: Option, - /// Experiment description. - #[arg(long)] - pub description: Option, - /// Parent experiment id -> create a child. Omit on an empty project to - /// create the baseline (root); once a root exists, attach under it. - #[arg(long)] - pub parent: Option, - /// Create a new baseline (root) even when the project already has one. - /// Conflicts with --parent. Projects may hold multiple baselines. - #[arg(long, conflicts_with = "parent")] - pub baseline: bool, - /// Run command for the node. Omit to inherit from the parent/project default. - #[arg(long = "run-command")] - pub run_command: Option, -} - -#[derive(Args, Debug)] -pub struct ComputeArgs { - /// List CPU-only instance offers instead of the GPU catalog. CPU instances - /// suit GPU-less experiments (data prep, eval harnesses, CPU-bound papers). - #[arg(long)] - pub cpu: bool, - /// Filter to one GPU id (e.g. `H100_SXM`). Case-insensitive. GPU mode only. - #[arg(long)] - pub gpu: Option, - /// Filter to a specific GPU count per instance. GPU mode only. - #[arg(long)] - pub count: Option, - /// Filter to one provider (e.g. `runpod`, `vast`, `lambda`). Case-insensitive. GPU mode only. - #[arg(long)] - pub provider: Option, -} - -#[derive(Args, Debug)] -pub struct SshKeyArgs { - #[command(subcommand)] - pub command: SshKeyCommand, -} - -#[derive(Subcommand, Debug)] -pub enum SshKeyCommand { - /// Register a public key on your account. Every box in your orgs — including - /// ones already running — starts accepting it. - Add(SshKeyAddArgs), - /// List registered keys, marking the ones usable from this computer. - List, -} - -#[derive(Args, Debug)] -pub struct SshKeyAddArgs { - /// Public key path. Without a path, reuse ~/.ssh/id_ed25519.pub or create a key pair. - pub path: Option, -} - -#[derive(Args, Debug)] -pub struct InstanceArgs { - #[command(subcommand)] - pub command: InstanceCommand, -} - -#[derive(Subcommand, Debug)] -pub enum InstanceCommand { - /// Provision a standalone instance in an org (GPU with `--gpu`, or CPU with - /// `--cpu`). Not tied to an experiment — like the dashboard's "Spin up". - Create(InstanceCreateArgs), - /// List an org's instances (status, SSH endpoint, price) — including any - /// `--backend openresearch` box a failed teardown left behind. - List(InstanceListArgs), - /// Terminate an instance (destroys the provider machine). The manual - /// cleanup path when a run's automatic teardown failed. - Delete(InstanceDeleteArgs), -} - -#[derive(Args, Debug)] -pub struct InstanceCreateArgs { - /// Organization id (from `orx orgs`). - pub org_id: String, - /// Provision a GPU instance with this GPU id, e.g. `H100_SXM` — the exact id - /// from `orx compute`, not a family name like `H100`. - #[arg(long)] - pub gpu: Option, - /// GPUs per instance (with `--gpu`; default 1). - #[arg(long)] - pub count: Option, - /// Disk in GB (with `--gpu`; default 100). - #[arg(long)] - pub disk: Option, - /// Provider to provision from (with `--gpu`), e.g. runpod, vast, lambda. - /// Omit to pick the cheapest matching offer across providers (like the - /// dashboard). See `orx compute` for providers; validated server-side. - #[arg(long)] - pub provider: Option, - /// Provision a CPU-only instance with this flavor: cpu5c (compute), cpu5g - /// (general), or cpu5m (memory-optimized). Mutually exclusive with `--gpu`. - #[arg(long)] - pub cpu: Option, - /// vCPUs for a CPU instance (with `--cpu`): 2, 8, or 32 (default 8). - #[arg(long)] - pub vcpus: Option, -} - -#[derive(Args, Debug)] -pub struct InstanceListArgs { - /// Organization id (from `orx orgs`). - pub org_id: String, -} - -#[derive(Args, Debug)] -pub struct InstanceDeleteArgs { - /// The instance (sandbox) id to terminate. - pub sandbox_id: String, -} - -#[derive(Args, Debug)] -pub struct AgentArgs { - #[command(subcommand)] - pub command: AgentCommand, -} - -#[derive(Subcommand, Debug)] -pub enum AgentCommand { - /// Hand a task to a helper agent running in its own top-level session. - Spawn { - /// What the helper agent should do. Write it as a self-contained brief: - /// the helper starts with an empty transcript and cannot see this chat. - task: Option, - /// Read the task from stdin instead, for long multi-paragraph briefs. - #[arg(long)] - stdin: bool, - /// Name the session in the sidebar. Defaults to an auto-generated title. - #[arg(long)] - title: Option, - /// Harness for the helper (defaults to this session's). - #[arg(long)] - harness: Option, - /// Model for the helper (defaults to this session's). - #[arg(long)] - model: Option, - /// Do not resume this chat when the helper finishes. - #[arg(long)] - no_wake: bool, - }, -} - -#[derive(Args, Debug)] -pub struct ExpArgs { - #[command(subcommand)] - pub command: ExpCommand, -} - -#[derive(Subcommand, Debug)] -pub enum ExpCommand { - /// Show the experiment's status, run command, and latest run. - Status { exp_id: String }, - - /// View the experiment's description/notes, or overwrite it with `--set` / `--stdin`. - Desc { - exp_id: String, - /// Overwrite the description with this value. - #[arg(long)] - set: Option, - /// Overwrite the description with the whole of stdin (for long markdown docs). - #[arg(long)] - stdin: bool, - }, - - /// Launch a locally initialized experiment through an orx-supervised backend. - Run(Box), - - /// Cancel the in-flight run. - Cancel { exp_id: String }, - - /// Resume this agent after the experiment's latest run succeeds or fails. - Wake { exp_id: String }, - - /// Wait for a run to finish: one experiment (``) or the next completion in a project (`--project`). - Wait { - /// Experiment to watch; its latest run is polled until it reaches a - /// terminal state. Omit and pass `--project` to watch a whole project. - exp_id: Option, - /// Watch every run in this project and return on the FIRST one to - /// complete (reach done/failed/cancelled) — a "slot freed" signal. Call - /// it in a loop, re-listing `orx runs` on each return to catch all - /// finished runs. Returns immediately ("drained: no runs in flight") if - /// none are in flight. Mutually exclusive with ``. - #[arg(long)] - project: Option, - /// Give up and exit non-zero after this many seconds (default 1800). - #[arg(long)] - timeout: Option, - /// Seconds between polls (default 5). - #[arg(long)] - interval: Option, - }, -} - -#[derive(Args, Debug)] -pub struct ExpRunArgs { - pub exp_id: String, - /// Disk in GB for a `--backend openresearch` instance (default 100). - #[arg(long)] - pub disk: Option, - /// Provider for a `--backend openresearch` GPU flavor. When omitted, the - /// cheapest qualified offer is selected. - #[arg(long)] - pub provider: Option, - /// orx-supervised executor: `hf` (Hugging Face Jobs, - /// billed to your HF account), `modal` (a Modal Sandbox on your own Modal - /// account, billed per second), `k8s` (a Job on your own Kubernetes - /// cluster), `ssh` (a detached process on one of your own boxes), `slurm` - /// (a batch job on your Slurm cluster, submitted via its login node), - /// `ray` (a job on your Ray cluster, via the Ray Jobs API), `openresearch` - /// (an ephemeral OpenResearch GPU/CPU box billed to your org; needs - /// `orx login`), `tinker` (a local controller using remote Tinker model - /// compute), or `local` (a detached process on this machine). k8s, - /// ssh, slurm, ray, openresearch, tinker, and local are local - /// experiments only. orx submits the job and a detached supervisor - /// records status and logs locally. Omitted on a local experiment: launches on - /// the configured default compute target, if set. - #[arg(long)] - pub backend: Option, - /// Hardware flavor. With `--backend hf`: t4-small, a10g-small, a100-large, - /// h200, … With `--backend modal`: a Modal GPU (t4, l4, a10g, a100, - /// a100-80gb, l40s, h100, h200, or e.g. h100:2) or cpu/cpu-large. With - /// `--backend slurm`: a GPU request as a GRES spec (h100:2 → --gres=gpu:h100:2; - /// plain `gpu` → one GPU; omit for CPU-only). With `--backend ray`: optional - /// entrypoint resources (`cpu:2`, `gpu:1`, `gpu:1,mem:8GiB`; omit to reserve - /// nothing). With `--backend openresearch`: a GPU id from `orx compute` - /// (h100_sxm, or h100_sxm:2 for two) or a CPU flavor (cpu5c/cpu5g/cpu5m, or - /// cpu5c:32 for the vCPU tier). Not used by k8s (see --manifest) or ssh - /// (see --host). - #[arg(long)] - pub flavor: Option, - /// The org to bill the box to (with `--backend openresearch`). Omit when - /// you belong to exactly one org. - #[arg(long)] - pub org: Option, - /// The ~/.ssh/config host alias to run on (with `--backend ssh`), or the - /// cluster login node (with `--backend slurm`; defaults to the slurm - /// settings' host). - #[arg(long)] - pub host: Option, - /// Repo-relative path to the k8s manifest on the experiment branch (with - /// `--backend k8s`; default .orx/k8s.yaml). The manifest declares the run's - /// resources — image, GPUs, topology — and orx injects the run script, env - /// Secret, labels, and a default timeout. See `orx skill` for the contract. - #[arg(long)] - pub manifest: Option, - /// Docker image for the job (with `--backend hf/modal`). Defaults to - /// python:3.12 on CPU flavors, a CUDA pytorch image otherwise. With - /// `--backend k8s`, set the image in the manifest instead. - #[arg(long)] - pub image: Option, - /// Job timeout (with `--backend hf/modal/k8s/slurm/openresearch`): 90s, - /// 30m, 4h, 1d. Default 4h (HF's own default is only 30 minutes). With - /// `--backend k8s` it becomes activeDeadlineSeconds unless the manifest - /// sets its own. With `--backend slurm` it becomes `#SBATCH --time=` and - /// has no 4h default — unset falls back to the slurm settings, then the - /// cluster's own limit. With `--backend openresearch` it bounds the run's - /// wall clock on the box (the box itself is deleted when the run ends). - /// Not supported with `--backend ray` (Ray Jobs have no time limit). - #[arg(long)] - pub timeout: Option, - /// Launch even when another run is already in flight for this experiment. - #[arg(long)] - pub force: bool, - /// Internal attribution forwarded through the local orx up API. - #[arg(skip)] - pub chat_session_id: Option, -} - -impl ExpRunArgs { - pub fn launching_chat_session(&self) -> Option { - self.chat_session_id - .clone() - .or_else(crate::local::chat::launching_chat_session) - } -} - -#[derive(Args, Debug)] -pub struct ServeArgs { - /// Port to bind on 127.0.0.1 (default 4790 — what the api proxies to). - #[arg(long)] - pub port: Option, -} - -#[derive(Args, Debug)] -pub struct SuperviseArgs { - /// The run to supervise (must exist in the local store). - pub run_id: String, -} - -#[derive(Args, Debug)] -pub struct UpArgs { - /// Port to bind on 127.0.0.1. With `--remote`, the local presentation port. - #[arg(long, default_value_t = 4791)] - pub port: u16, - /// Run `orx up` on a remote box over SSH and forward it here. The value is - /// an `~/.ssh/config` host alias, or `user@host` (append `:PORT` for a - /// non-standard SSH port, e.g. `root@1.2.3.4:38455`). Only user@host + port - /// are reconstructed; a custom key or jump host must come from `~/.ssh/config`. - /// Starts an authenticated server there, tunnels it through a hidden local - /// port, and opens a dedicated local presentation gateway in your browser. - #[arg(long, value_name = "HOST")] - pub remote: Option, - /// Don't open the dashboard in the browser on startup. - #[arg(long)] - pub no_browser: bool, - /// Don't spawn the opencode agent on startup (for tests). - #[arg(long)] - pub no_agent: bool, - /// opencode model override, e.g. `anthropic/claude-sonnet-4-5`. - #[arg(long)] - pub model: Option, - /// Internal persistent dashboard/agent-host mode. - #[arg(long, hide = true)] - pub remote_host: bool, -} - -#[derive(Args, Clone, Debug)] -pub struct RemoteHostArgs { - #[command(subcommand)] - pub command: RemoteHostCommand, -} - -#[derive(Clone, Subcommand, Debug)] -pub enum RemoteHostCommand { - Ensure { - #[arg(long)] - expected_instance: Option, - }, - Status, - Attach { - #[arg(long)] - expected_instance: String, - }, - Stop, -} - -#[derive(Args, Debug)] -pub struct SkillArgs { - pub path: Option, -} - -#[derive(Args, Debug)] -pub struct LibraryArgs { - #[command(subcommand)] - pub command: LibraryCommand, -} - -#[derive(Subcommand, Debug)] -pub enum LibraryCommand { - /// Save a file or ZIP across projects; replaces an existing entry of the same name. - Add { path: std::path::PathBuf }, -} - -#[derive(Args, Debug)] -pub struct InstallSkillsArgs { - /// Which agent(s) to install into: `claude`, `codex`, `opencode`, `cursor`, - /// or `all`. Defaults to every agent already set up on this machine. - #[arg(long)] - pub agent: Option, - - /// Also install the full set of modular `orx` skills (~8 always-listed - /// skills) into the agent's global skills dir, not just the thin shim. - /// Intended for dedicated/orx-only environments. In a general-purpose setup - /// the always-on skills add noise, so the default is the shim alone. - #[arg(long)] - pub full: bool, -} - -#[derive(Args, Debug)] -pub struct TelemetryArgs { - #[command(subcommand)] - pub command: TelemetryCommand, -} - -#[derive(Subcommand, Debug)] -pub enum TelemetryCommand { - /// Show whether analytics is on, why, and the anonymous install id. - Status, - /// Enable anonymous usage analytics. - On, - /// Disable anonymous usage analytics on this machine. - Off, -} - -/// Which corpus a literature command searches or reads from. -#[derive(ValueEnum, Clone, Copy, Debug, PartialEq, Eq)] -#[value(rename_all = "lower")] -pub enum LitSource { - /// alphaXiv (arXiv corpus: CS, math, physics, stats — the default). - Alphaxiv, - /// OpenAlex (general scholarly graph across all disciplines). - Openalex, - /// bioRxiv biology preprints (searched via OpenAlex, fetched via bioRxiv). - Biorxiv, -} - -impl LitSource { - /// Lowercase wire name used to enforce against the Settings disable-set. - /// Matches the `--source` flag values (clap `rename_all = "lower"`) and the - /// `LitHit.source` JSON labels. - pub fn as_str(&self) -> &'static str { - match self { - LitSource::Alphaxiv => "alphaxiv", - LitSource::Openalex => "openalex", - LitSource::Biorxiv => "biorxiv", - } - } - - /// Human-facing name for error/UI text. - pub fn display_name(&self) -> &'static str { - match self { - LitSource::Alphaxiv => "alphaXiv", - LitSource::Openalex => "OpenAlex", - LitSource::Biorxiv => "bioRxiv", - } - } -} - -#[derive(Args, Debug)] -pub struct DiscoverArgs { - #[command(subcommand)] - pub command: DiscoverCommand, -} - -#[derive(Subcommand, Debug)] -pub enum DiscoverCommand { - /// alphaXiv full-text BM25 retrieval with match snippets. - Keyword(DiscoverySearchArgs), - /// alphaXiv semantic title/abstract retrieval with similarity/popularity reranking. - Embedding(DiscoverySearchArgs), - /// OpenAlex scholarly-graph search across disciplines. - Openalex(DiscoverySearchArgs), - /// bioRxiv preprint search through OpenAlex's bioRxiv source index. - Biorxiv(DiscoverySearchArgs), -} - -#[derive(Args, Debug)] -pub struct DiscoverySearchArgs { - /// Exact keyword query or semantic description, depending on the strategy. - pub query: String, - /// Include papers first published on or after this date (YYYY-MM-DD). - #[arg(long = "published-after")] - pub published_after: Option, - /// Include papers first published on or before this date (YYYY-MM-DD). Older - /// or narrow embedding windows can return a thin candidate set. - #[arg(long = "published-before")] - pub published_before: Option, - /// Ranking policy after topical relevance is accounted for. - #[arg(long, value_enum, default_value = "default")] - pub prioritize: DiscoveryPriority, - /// Maximum results to emit (default 15). alphaXiv uses its fixed server-side candidate pool. - #[arg(long, default_value_t = 15, value_parser = clap::value_parser!(u32).range(1..=200))] - pub limit: u32, -} - -#[derive(ValueEnum, Clone, Copy, Debug, PartialEq, Eq)] -#[value(rename_all = "lower")] -pub enum DiscoveryPriority { - Historical, - Default, - Recency, - Popular, -} - -impl DiscoveryPriority { - pub fn as_str(self) -> &'static str { - match self { - Self::Historical => "historical", - Self::Default => "default", - Self::Recency => "recency", - Self::Popular => "popular", - } - } -} - -#[derive(Args, Debug)] -pub struct VersionArgs { - /// Print the embedded telemetry build channel. - #[arg(long, hide = true, conflicts_with_all = ["check", "json"])] - pub build_channel: bool, - /// Also check the latest released version on GitHub. - #[arg(long)] - pub check: bool, - /// Emit a JSON object instead of text (implies --check). - #[arg(long)] - pub json: bool, - /// Print the dashboard protocol understood by this binary. - #[arg(long, hide = true, conflicts_with_all = ["check", "json", "build_channel"])] - pub dashboard_protocol: bool, -} - -#[derive(Args, Debug)] -pub struct UpdateArgs { - /// Report whether an update is available without installing anything. - #[arg(long)] - pub dry_run: bool, - /// Update even when the binary doesn't match the install receipt - /// (multiple copies, or a `cargo install` overwrote it). - #[arg(long)] - pub force: bool, - /// Internal: the detached auto-updater. Silent, and records its outcome so - /// repeated failures back off. - #[arg(long, hide = true)] - pub background: bool, -} - -#[derive(Args, Debug)] -pub struct InstallCliArgs { - /// Replace an existing `orx` on your PATH. - #[arg(long)] - pub force: bool, -} - -#[derive(Args, Debug)] -pub struct DeleteArgs { - #[command(subcommand)] - pub command: DeleteCommand, -} - -#[derive(Subcommand, Debug, Clone, Copy)] -pub enum DeleteCommand { - /// Delete only orx.db and its SQLite sidecars. Project folders are untouched. - #[command(alias = "db")] - Database, - /// Delete the running orx executable and its matching installer receipt. - Cli, - /// Delete both the database and CLI executable. - All, -} - -#[derive(Args, Debug)] -pub struct PaperArgs { - /// Paper id: an arXiv id / URL (alphaXiv), a DOI (bioRxiv `10.1101/…` or any - /// other), or an OpenAlex `W…` id. The source is auto-detected. - pub id: String, - /// Force the source instead of auto-detecting it from the id. - #[arg(long, value_enum)] - pub source: Option, - /// Fetch the full extracted paper text instead of the report (alphaXiv only; - /// OpenAlex/bioRxiv have no extracted full text and point you at the PDF). - #[arg(long)] - pub full: bool, -} +use clap::Parser; // The default multi-thread runtime is load-bearing for macOS app mode: it blocks // the main thread in the AppKit run loop while the dashboard server runs on @@ -1098,169 +341,3 @@ fn command_uses_lifecycle_lock(command: &Command) -> bool { | Command::RemoteHost(_) ) } - -#[cfg(test)] -mod cli_tests { - use super::*; - - /// A double-clicked orx.exe reaches `up` through this parse; an argv clap - /// rejected would panic there instead of opening the dashboard. - #[test] - fn a_double_click_parses_as_a_local_up() { - assert!(matches!( - Cli::parse_from(["orx", "up"]).command, - Some(Command::Up(args)) if args.remote.is_none() - )); - } - - #[test] - fn library_add_commands_are_distinct_from_reading_skill_docs() { - for name in ["skills", "templates"] { - let cli = Cli::try_parse_from(["orx", name, "add", "./package.zip"]).unwrap(); - let args = match cli.command.unwrap() { - Command::Skills(args) | Command::Templates(args) => args, - _ => panic!("expected a library command"), - }; - let LibraryCommand::Add { path } = args.command; - assert_eq!(path, std::path::PathBuf::from("./package.zip")); - assert!(Cli::try_parse_from(["orx", name, "add"]).is_err()); - } - } - - #[test] - fn internal_commands_do_not_emit_command_telemetry() { - assert!(!should_capture_command(&Command::Supervise( - SuperviseArgs { - run_id: "run-1".into(), - } - ))); - assert!(!should_capture_command(&Command::Update(UpdateArgs { - background: true, - dry_run: false, - force: false, - }))); - assert!(should_capture_command(&Command::Update(UpdateArgs { - background: false, - dry_run: true, - force: false, - }))); - } - - #[test] - fn discover_parses_independent_retrieval_options() { - let cli = Cli::try_parse_from([ - "orx", - "discover", - "embedding", - "test-time compute", - "--published-after", - "2024-01-01", - "--published-before", - "2025-12-31", - "--prioritize", - "historical", - "--limit", - "9", - ]) - .expect("discover embedding should parse"); - - let Some(Command::Discover(DiscoverArgs { - command: DiscoverCommand::Embedding(args), - })) = cli.command - else { - panic!("expected discover embedding command"); - }; - assert_eq!(args.query, "test-time compute"); - assert_eq!(args.published_after.as_deref(), Some("2024-01-01")); - assert_eq!(args.published_before.as_deref(), Some("2025-12-31")); - assert_eq!(args.prioritize, DiscoveryPriority::Historical); - assert_eq!(args.limit, 9); - } - - #[test] - fn discover_parses_openalex_and_biorxiv_primitives() { - for (source, expected) in [ - ("openalex", LitSource::Openalex), - ("biorxiv", LitSource::Biorxiv), - ] { - let cli = Cli::try_parse_from(["orx", "discover", source, "protein folding"]) - .expect("source discovery should parse"); - let Some(Command::Discover(DiscoverArgs { command })) = cli.command else { - panic!("expected discover command"); - }; - let actual = match command { - DiscoverCommand::Openalex(_) => LitSource::Openalex, - DiscoverCommand::Biorxiv(_) => LitSource::Biorxiv, - _ => panic!("expected non-alphaXiv discovery source"), - }; - assert_eq!(actual, expected); - } - } - - #[test] - fn run_accepts_only_supervised_backend_flags() { - for flag in ["--gpu", "--cpu", "--sandbox"] { - let error = Cli::try_parse_from(["orx", "exp", "run", "exp-1", flag, "value"]) - .expect_err("unsupported run flag should not parse"); - assert_eq!( - error.kind(), - clap::error::ErrorKind::UnknownArgument, - "{flag}" - ); - } - } - - #[test] - fn research_state_commands_are_local_only() { - for command in [ - "explore", - "experiments", - "env", - "search-logs", - "artifacts", - "artifact", - "wandb", - "query", - "chart", - "report", - ] { - let error = Cli::try_parse_from(["orx", command]) - .expect_err("removed research command should not parse"); - assert_eq!(error.kind(), clap::error::ErrorKind::InvalidSubcommand); - } - - let error = Cli::try_parse_from(["orx", "exp", "cmd", "exp-1"]) - .expect_err("per-experiment run command should not parse"); - assert_eq!(error.kind(), clap::error::ErrorKind::InvalidSubcommand); - - let error = Cli::try_parse_from(["orx", "projects", "--all"]) - .expect_err("local projects have no archived state"); - assert_eq!(error.kind(), clap::error::ErrorKind::UnknownArgument); - - Cli::try_parse_from(["orx", "orgs", "--json"]).expect("orgs should parse"); - } - - #[test] - fn openresearch_backend_and_flavor_still_parse() { - let cli = Cli::try_parse_from([ - "orx", - "exp", - "run", - "exp-1", - "--backend", - "openresearch", - "--flavor", - "h100_sxm", - ]) - .expect("local OpenResearch launch should parse"); - - let Some(Command::Exp(ExpArgs { - command: ExpCommand::Run(args), - })) = cli.command - else { - panic!("expected exp run command"); - }; - assert_eq!(args.backend.as_deref(), Some("openresearch")); - assert_eq!(args.flavor.as_deref(), Some("h100_sxm")); - } -} diff --git a/src/plane.rs b/src/plane.rs index 4578faef..06b76a38 100644 --- a/src/plane.rs +++ b/src/plane.rs @@ -176,6 +176,9 @@ mod tests { result_markdown: result_markdown.map(str::to_string), cancel_requested: false, chat_session_id: None, + recovery_reason: None, + error_kind: None, + provenance_json: None, } } diff --git a/src/store.rs b/src/store.rs index 3826a3ee..63ce01f4 100644 --- a/src/store.rs +++ b/src/store.rs @@ -11,7 +11,7 @@ use std::path::PathBuf; use rusqlite::{params, Connection, OptionalExtension}; -use serde::Serialize; +use serde::{Deserialize, Serialize}; use crate::error::{anyhow, Result}; use crate::local::model::{LocalExperiment, LocalProject}; @@ -220,6 +220,184 @@ pub struct StoredRun { /// CLI-launched runs. This records attribution; wake-ups are /// separately and explicitly registered in `chat_run_wakeups`. pub chat_session_id: Option, + /// Set only by [`Store::mark_run_unrecoverable`] when reconciliation gives + /// up on the run (e.g. no supervisor could be (re)started after repeated + /// attempts) rather than a backend reporting a normal failure. `None` for + /// every other outcome, including a plain `Failed` run. Free-text and + /// human-facing (also appended to `result_markdown`) — see + /// `error_kind` below for the stable, machine-readable counterpart. + pub recovery_reason: Option, + /// The stable [`crate::error::ErrorKind`] code (as + /// [`crate::error::ErrorKind::as_str`]) for a run [`Store::mark_run_unrecoverable`] + /// force-failed — set together with `recovery_reason`, `None` in every + /// other case. This is the machine-readable half a consumer (the + /// dashboard, an agent parsing `orx exp status --json`) should switch + /// on; `recovery_reason` is the free-text half for a human to read. + pub error_kind: Option, + /// [`ProvenanceManifest::to_json`], captured once at launch (TASK 6, + /// Priority 4) and never rewritten — see [`ProvenanceManifest`] for what + /// it records and why. `None` for runs launched before this existed. + pub provenance_json: Option, +} + +/// Launch-time context for reproducing, auditing, or exporting a run — TASK +/// 6 (Priority 4, "Strengthen Experiment Provenance Metadata"). Deliberately +/// scoped to what's cheap and reliable to capture from the launching process +/// itself, without new subprocess probes on the launch path (`orx exp run` +/// is latency-sensitive) or restating data a run already carries on its own +/// columns/`BackendDescriptor`: +/// +/// - Git commit SHA — already `StoredRun::commit_sha`. +/// - Exact execution command — already `StoredRun::command`. +/// - Compute backend + its configuration (flavor, image, …) — already +/// `StoredRun::backend_json` (`BackendDescriptor`). +/// - Start/completion timestamps — already `created_at`/`ended_at`. +/// +/// What's new here: which `orx` build launched the run, what launched it +/// (a human via the CLI, or a named agent harness/model), the launching +/// machine's OS/arch (a lightweight "environment fingerprint" — no secrets, +/// no subprocess calls), and a snapshot of the experiment's parent id (so +/// lineage survives even if the experiment itself is later reparented or +/// deleted). Dependency/runtime versions, hardware details beyond OS/arch, +/// and dataset/artifact references are NOT captured — the first two would +/// need per-backend probing this task doesn't attempt, and the codebase has +/// no dataset/artifact registry to reference. +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct ProvenanceManifest { + /// The `orx` build that launched this run (`CARGO_PKG_VERSION`). + pub orx_version: String, + /// OS of the machine `orx` ran on when it launched this run — NOT + /// necessarily where the payload executes (a remote backend's actual + /// hardware is requested via `BackendDescriptor.flavor`). + pub launcher_os: String, + pub launcher_arch: String, + /// The coding-agent harness that launched this run (e.g. `"claude"`, + /// `"codex"`, `"opencode"`), when launched from an agent chat session + /// rather than a plain CLI invocation. + #[serde(skip_serializing_if = "Option::is_none")] + pub agent_harness: Option, + /// The model that harness was using at launch time, when known. + #[serde(skip_serializing_if = "Option::is_none")] + pub agent_model: Option, + /// The launching experiment's `parent_experiment_id` at launch time — + /// a snapshot, since the live experiment row could later change. + #[serde(skip_serializing_if = "Option::is_none")] + pub parent_experiment_id: Option, +} + +impl ProvenanceManifest { + pub fn to_json(&self) -> String { + serde_json::to_string(self).unwrap_or_else(|_| "{}".to_string()) + } + + pub fn parse(json: &str) -> Option { + serde_json::from_str(json).ok() + } +} + +/// Lifecycle of a [`StoredRun`]. `Starting` and `Running` are the only +/// non-terminal states — every backend (local process, ssh, k8s, Slurm, Ray, +/// Modal, HF Jobs, an OpenResearch box) settles into exactly one of `Done`, +/// `Failed` or `Cancelled` and stays there: +/// +/// ```text +/// Starting +/// ↓ +/// Running +/// ├── Done +/// ├── Failed +/// └── Cancelled +/// ``` +/// +/// A run may also jump straight from `Starting` to a terminal state (a +/// submission that fails, or is cancelled, before the backend ever reports +/// `Running`). What is never legal is moving *out* of a terminal state, or +/// moving backward from `Running` to `Starting` — [`Store::update_status`] is +/// the single place both rules are enforced, atomically, at the SQL layer, so +/// a duplicate completion callback, or a completion racing a cancellation, +/// can only ever be a no-op rather than corrupt the row. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum RunStatus { + /// Submitted to the backend; not yet observed running. + Starting, + /// The backend has confirmed the job is under way. + Running, + /// Terminal: the job ran to completion with a successful exit. + Done, + /// Terminal: the job errored, or was never observed as launched. + Failed, + /// Terminal: cancellation was requested and honored. + Cancelled, +} + +impl RunStatus { + /// Every state, for enumerating legal transitions generically (see + /// [`Store::update_status`]) instead of hand-duplicating + /// [`RunStatus::can_transition_to`]'s table at each call site. + pub const ALL: [RunStatus; 5] = [ + Self::Starting, + Self::Running, + Self::Done, + Self::Failed, + Self::Cancelled, + ]; + + pub fn as_str(self) -> &'static str { + match self { + Self::Starting => "starting", + Self::Running => "running", + Self::Done => "done", + Self::Failed => "failed", + Self::Cancelled => "cancelled", + } + } + + /// Parses the stored/wire vocabulary. `None` for anything else — callers + /// that only need "is this finished" should prefer [`is_terminal_status`], + /// which treats an unrecognized string the same as a non-terminal one. + pub fn parse(status: &str) -> Option { + Some(match status { + "starting" => Self::Starting, + "running" => Self::Running, + "done" => Self::Done, + "failed" => Self::Failed, + "cancelled" => Self::Cancelled, + _ => return None, + }) + } + + /// A run in a terminal state is finished and will never change again. + pub fn is_terminal(self) -> bool { + matches!(self, Self::Done | Self::Failed | Self::Cancelled) + } + + /// Whether `self -> to` is a legal direct transition. Terminal states are + /// absorbing (nothing transitions out of them, including into the same + /// state — so a duplicate terminal write is rejected rather than treated + /// as a legal self-transition), and `Running` never regresses to + /// `Starting`. + pub fn can_transition_to(self, to: RunStatus) -> bool { + use RunStatus::*; + match self { + Starting => matches!(to, Starting | Running | Done | Failed | Cancelled), + Running => matches!(to, Running | Done | Failed | Cancelled), + Done | Failed | Cancelled => false, + } + } +} + +impl std::fmt::Display for RunStatus { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(self.as_str()) + } +} + +/// Whether a stored run status string denotes a finished run. An unrecognized +/// string is treated as non-terminal (the conservative choice: it keeps a run +/// visible as active rather than silently dropping it from "in flight" views). +pub fn is_terminal_status(status: &str) -> bool { + RunStatus::parse(status).is_some_and(RunStatus::is_terminal) } #[derive(Debug, Clone)] @@ -348,6 +526,16 @@ impl Store { ended_at INTEGER, exit_code INTEGER ); + -- `runs` had no index beyond its primary key: every poll of + -- active runs (the TASK 2 reconciliation loop included), + -- listing by project/experiment, and the newest-first history + -- view all table-scanned. These make each a lookup instead — + -- see the store.rs concurrency/stress tests for before/after + -- timing at a realistic row count. + CREATE INDEX IF NOT EXISTS idx_runs_status ON runs(status); + CREATE INDEX IF NOT EXISTS idx_runs_project_id ON runs(project_id, created_at); + CREATE INDEX IF NOT EXISTS idx_runs_experiment_id ON runs(experiment_id, created_at); + CREATE INDEX IF NOT EXISTS idx_runs_created_at ON runs(created_at); CREATE TABLE IF NOT EXISTS local_projects ( id TEXT PRIMARY KEY, name TEXT NOT NULL, @@ -517,6 +705,9 @@ impl Store { "ALTER TABLE runs ADD COLUMN result_markdown TEXT", "ALTER TABLE runs ADD COLUMN cancel_requested INTEGER NOT NULL DEFAULT 0", "ALTER TABLE runs ADD COLUMN chat_session_id TEXT", + "ALTER TABLE runs ADD COLUMN recovery_reason TEXT", + "ALTER TABLE runs ADD COLUMN error_kind TEXT", + "ALTER TABLE runs ADD COLUMN provenance_json TEXT", "ALTER TABLE chat_sessions ADD COLUMN permission_mode TEXT", "ALTER TABLE chat_sessions ADD COLUMN service_tier TEXT", "ALTER TABLE chat_sessions ADD COLUMN plan_mode INTEGER NOT NULL DEFAULT 0", @@ -861,8 +1052,9 @@ impl Store { "INSERT INTO runs (id, experiment_id, project_id, status, backend_json, command, created_at, updated_at, ended_at, exit_code, commit_sha, result_markdown, cancel_requested, - chat_session_id) - VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14) + chat_session_id, recovery_reason, error_kind, + provenance_json) + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17) ON CONFLICT(id) DO UPDATE SET status = excluded.status, backend_json = excluded.backend_json, @@ -871,9 +1063,14 @@ impl Store { exit_code = excluded.exit_code, commit_sha = excluded.commit_sha, result_markdown = excluded.result_markdown", - // chat_session_id is deliberately absent from the DO UPDATE SET: - // run ownership is immutable, so a later status upsert never - // rewrites (or clears) the session that launched the run. + // chat_session_id, recovery_reason, error_kind, and + // provenance_json are deliberately absent from the DO UPDATE + // SET: run ownership and launch-time provenance are immutable, + // so a later status upsert never rewrites (or clears) the + // session that launched the run or the manifest it launched + // with, and a backend re-recording its descriptor never + // clobbers the reason/classification `mark_run_unrecoverable` + // already stamped. params![ run.id, run.experiment_id, @@ -889,25 +1086,62 @@ impl Store { run.result_markdown, run.cancel_requested, run.chat_session_id, + run.recovery_reason, + run.error_kind, + run.provenance_json, ], )?; Ok(()) } + /// Move a run to `status`, honoring [`RunStatus::can_transition_to`]. + /// Returns `Ok(true)` if the row was actually updated, `Ok(false)` if the + /// transition was illegal — most commonly because the run had already + /// reached a terminal state. `Ok(false)` is an expected, benign outcome + /// (a duplicate completion callback, a completion arriving after the run + /// was already marked cancelled, a stale poll racing a fresher one) and + /// callers are not required to treat it as an error; the row simply keeps + /// whatever terminal status it already settled on. + /// + /// The check-and-write happens in one statement, so this is safe to call + /// from multiple processes/threads racing on the same run: whichever + /// write lands first wins, and every later one is a no-op rather than a + /// corruption. pub fn update_status( &self, run_id: &str, - status: &str, + status: RunStatus, ended_at: Option, exit_code: Option, - ) -> Result<()> { - self.conn.execute( + ) -> Result { + // Derive the legal-source set straight from `can_transition_to` + // rather than hand-duplicating its table here, so the two can never + // drift apart. A row not yet in the table (a fresh `Starting` write + // racing `upsert_run`) also matches nothing and is correctly a no-op: + // the run is created via `upsert_run`, not `update_status`. + let sources: Vec<&'static str> = RunStatus::ALL + .into_iter() + .filter(|from| from.can_transition_to(status)) + .map(RunStatus::as_str) + .collect(); + if sources.is_empty() { + return Ok(false); + } + let source_list = sources + .iter() + .map(|s| format!("'{s}'")) + .collect::>() + .join(", "); + let sql = format!( "UPDATE runs SET status = ?2, updated_at = ?3, ended_at = COALESCE(?4, ended_at), exit_code = COALESCE(?5, exit_code) - WHERE id = ?1", - params![run_id, status, now_ms(), ended_at, exit_code], + WHERE id = ?1 AND status IN ({source_list})" + ); + let applied = self.conn.execute( + &sql, + params![run_id, status.as_str(), now_ms(), ended_at, exit_code], )?; - Ok(()) + Ok(applied == 1) } pub fn get_run(&self, run_id: &str) -> Result> { @@ -1014,16 +1248,21 @@ impl Store { Ok(()) } + /// One transaction so a crash/interruption between the reclaim and the + /// delete can never leave the two halves of this sweep half-applied — + /// not a live bug today (each statement is independently safe to re-run), + /// but a future third step would no longer be able to assume that. pub fn prune_run_wakeups(&self) -> Result<()> { self.clear_stale_data_dir_move_lease()?; - self.conn.execute( + let tx = self.begin()?; + tx.execute( "UPDATE chat_run_wakeups SET state = 'pending', claim_token = NULL, claimed_at = NULL WHERE state = 'claimed' AND claimed_at < ?1 AND NOT EXISTS (SELECT 1 FROM data_dir_move_lease WHERE id = 1)", params![now_ms() - RUN_WAKEUP_CLAIM_TTL_MS], )?; - self.conn.execute( + tx.execute( "DELETE FROM chat_run_wakeups WHERE NOT EXISTS (SELECT 1 FROM data_dir_move_lease WHERE id = 1) AND ( @@ -1040,15 +1279,20 @@ impl Store { )", [], )?; + tx.commit()?; Ok(()) } pub fn list_ready_run_wakeups(&self) -> Result> { + // `r.*` (not a hand-rolled column list) so this can never again drift + // out of sync with `row_to_run`'s expected shape the way it silently + // did across TASK 2/5 (recovery_reason/error_kind were reading the + // wakeup's own `chat_session_id`/`state` columns instead — wrong + // data, not even an error, until TASK 6 finally added a column past + // the end and turned it into one). The wakeup's own two columns are + // named to avoid the `chat_session_id` collision with `r.*`. let mut stmt = self.conn.prepare( - "SELECT r.id, r.experiment_id, r.project_id, r.status, r.backend_json, r.command, - r.created_at, r.updated_at, r.ended_at, r.exit_code, - r.commit_sha, r.result_markdown, r.cancel_requested, r.chat_session_id, - w.chat_session_id, w.state + "SELECT r.*, w.chat_session_id AS wakeup_chat_session_id, w.state AS wakeup_state FROM chat_run_wakeups w JOIN runs r ON r.id = w.run_id WHERE w.state IN ('pending', 'claimed') AND r.status IN ('done', 'failed') @@ -1057,8 +1301,8 @@ impl Store { let rows = stmt.query_map([], |row| { Ok(RunWakeup { run: row_to_run(row)?, - chat_session_id: row.get(14)?, - state: row.get(15)?, + chat_session_id: row.get("wakeup_chat_session_id")?, + state: row.get("wakeup_state")?, }) })?; Ok(rows.collect::, _>>()?) @@ -1144,7 +1388,8 @@ impl Store { pub fn prune_chat_spawns(&self) -> Result<()> { self.clear_stale_data_dir_move_lease()?; let stale = now_ms() - CHAT_SPAWN_CLAIM_TTL_MS; - self.conn.execute( + let tx = self.begin()?; + tx.execute( "UPDATE chat_spawns SET state = CASE state WHEN 'starting' THEN 'pending' ELSE 'running' END, attempts = attempts + CASE state WHEN 'starting' THEN 1 ELSE 0 END, @@ -1153,7 +1398,7 @@ impl Store { AND NOT EXISTS (SELECT 1 FROM data_dir_move_lease WHERE id = 1)", params![stale], )?; - self.conn.execute( + tx.execute( "DELETE FROM chat_spawns WHERE NOT EXISTS (SELECT 1 FROM data_dir_move_lease WHERE id = 1) AND NOT EXISTS ( @@ -1161,6 +1406,7 @@ impl Store { )", [], )?; + tx.commit()?; Ok(()) } @@ -1244,13 +1490,16 @@ impl Store { Ok(()) } + /// A single `UPDATE ... RETURNING` rather than an update-then-select: two + /// separate statements would let a concurrent caller's own increment land + /// in between, so the value read back could be *their* count, not this + /// call's — every caller would then believe it holds a unique attempt + /// number when several actually raced to the same one. pub fn record_chat_spawn_attempt(&self, chat_session_id: &str) -> Result { - self.conn.execute( - "UPDATE chat_spawns SET attempts = attempts + 1 WHERE session_id = ?1", - params![chat_session_id], - )?; Ok(self.conn.query_row( - "SELECT attempts FROM chat_spawns WHERE session_id = ?1", + "UPDATE chat_spawns SET attempts = attempts + 1 + WHERE session_id = ?1 + RETURNING attempts", params![chat_session_id], |row| row.get(0), )?) @@ -1268,7 +1517,8 @@ impl Store { pub fn claim_chat_turn(&self, chat_session_id: &str, token: &str) -> Result { self.clear_stale_data_dir_move_lease()?; - self.conn.execute( + let tx = self.begin()?; + tx.execute( "DELETE FROM chat_turn_leases WHERE heartbeat_at < ?1 OR NOT EXISTS ( @@ -1277,13 +1527,14 @@ impl Store { )", params![now_ms() - CHAT_TURN_LEASE_TTL_MS], )?; - let claimed = self.conn.execute( + let claimed = tx.execute( "INSERT OR IGNORE INTO chat_turn_leases (chat_session_id, claim_token, heartbeat_at) SELECT ?1, ?2, ?3 WHERE NOT EXISTS (SELECT 1 FROM data_dir_move_lease WHERE id = 1)", params![chat_session_id, token, now_ms()], )?; + tx.commit()?; Ok(claimed == 1) } @@ -1306,17 +1557,19 @@ impl Store { } pub fn claim_data_dir_move(&self, token: &str) -> Result { - self.conn.execute( + self.clear_stale_data_dir_move_lease()?; + let tx = self.begin()?; + tx.execute( "DELETE FROM chat_turn_leases WHERE heartbeat_at < ?1", params![now_ms() - CHAT_TURN_LEASE_TTL_MS], )?; - self.clear_stale_data_dir_move_lease()?; - let claimed = self.conn.execute( + let claimed = tx.execute( "INSERT OR IGNORE INTO data_dir_move_lease (id, claim_token, heartbeat_at) SELECT 1, ?1, ?2 WHERE NOT EXISTS (SELECT 1 FROM chat_turn_leases)", params![token, now_ms()], )?; + tx.commit()?; Ok(claimed == 1) } @@ -1385,6 +1638,38 @@ impl Store { Ok(()) } + /// Force a run to `Failed` because reconciliation, not the backend, gave + /// up on it (e.g. no supervisor could be started after repeated + /// attempts), recording `reason` (free-text, human-facing) on + /// `recovery_reason` and `kind` (stable, machine-readable — Priority 9) + /// on `error_kind`, and appending `reason` to `result_markdown` for + /// human visibility. Goes through [`Store::update_status`], so it + /// inherits the same terminal-state guard: if the run reached a real + /// terminal state first (it finished, or was cancelled, before + /// reconciliation caught up with it), this is a no-op and neither field + /// is ever recorded — reconciliation must never overwrite a legitimate + /// outcome. + pub fn mark_run_unrecoverable( + &self, + run_id: &str, + kind: crate::error::ErrorKind, + reason: &str, + ) -> Result { + let applied = self.update_status(run_id, RunStatus::Failed, Some(now_ms()), None)?; + if applied { + self.conn.execute( + "UPDATE runs SET recovery_reason = ?2, error_kind = ?3 WHERE id = ?1", + params![run_id, reason, kind.as_str()], + )?; + let existing = self + .get_run(run_id)? + .and_then(|r| r.result_markdown) + .unwrap_or_default(); + self.set_result_markdown(run_id, &format!("{existing}\n\n> **Recovery**: {reason}"))?; + } + Ok(applied) + } + // --- local projects (orx up) --- /// Atomically install a fully-materialized demo project. The project id is @@ -1590,14 +1875,12 @@ impl Store { "DELETE FROM chat_sessions WHERE project_id = ?1", params![id], )?; - self.conn - .execute("DELETE FROM runs WHERE project_id = ?1", params![id])?; - self.conn.execute( + tx.execute("DELETE FROM runs WHERE project_id = ?1", params![id])?; + tx.execute( "DELETE FROM local_experiments WHERE project_id = ?1", params![id], )?; - self.conn - .execute("DELETE FROM local_projects WHERE id = ?1", params![id])?; + tx.execute("DELETE FROM local_projects WHERE id = ?1", params![id])?; tx.commit()?; Ok(()) } @@ -2948,7 +3231,8 @@ fn row_to_chat_session( const SELECT_RUN: &str = "SELECT id, experiment_id, project_id, status, backend_json, command, created_at, updated_at, ended_at, exit_code, commit_sha, result_markdown, cancel_requested, - chat_session_id FROM runs"; + chat_session_id, recovery_reason, error_kind, + provenance_json FROM runs"; const PROJECT_COLS: &str = "id, name, slug, github_owner, github_repo, github_sync_enabled, \ baseline_branch, repo_path, run_command, paper_id, created_at, updated_at"; @@ -2973,6 +3257,9 @@ fn row_to_run(row: &rusqlite::Row<'_>) -> std::result::Result {to} should be {}", + if expected { "legal" } else { "illegal" } + ); + } } } + #[test] + fn run_status_is_terminal_matches_the_three_absorbing_states() { + for status in RunStatus::ALL { + assert_eq!( + status.is_terminal(), + matches!( + status, + RunStatus::Done | RunStatus::Failed | RunStatus::Cancelled + ) + ); + } + } + + #[test] + fn run_status_as_str_round_trips_through_parse() { + for status in RunStatus::ALL { + assert_eq!(RunStatus::parse(status.as_str()), Some(status)); + } + assert_eq!(RunStatus::parse("not-a-real-status"), None); + assert!(!is_terminal_status("not-a-real-status")); + } + + /// TASK 6 (experiment provenance): the manifest round-trips through JSON + /// exactly, including when optional fields are absent. + #[test] + fn provenance_manifest_round_trips_through_json() { + let full = ProvenanceManifest { + orx_version: "0.2.1".into(), + launcher_os: "macos".into(), + launcher_arch: "aarch64".into(), + agent_harness: Some("claude".into()), + agent_model: Some("claude-sonnet-5".into()), + parent_experiment_id: Some("exp_parent".into()), + }; + let parsed = ProvenanceManifest::parse(&full.to_json()).unwrap(); + assert_eq!(parsed, full); + assert!( + !full.to_json().contains("null"), + "Option fields must be omitted, not serialized as null: {}", + full.to_json() + ); + + let minimal = ProvenanceManifest { + orx_version: "0.2.1".into(), + launcher_os: "linux".into(), + launcher_arch: "x86_64".into(), + agent_harness: None, + agent_model: None, + parent_experiment_id: None, + }; + assert_eq!( + ProvenanceManifest::parse(&minimal.to_json()).unwrap(), + minimal + ); + + assert_eq!(ProvenanceManifest::parse("not json"), None); + } + + /// Provenance is captured once at launch and must never be clobbered by + /// a later `upsert_run` — every backend re-upserts the same run id once + /// its real handle is known, and that second write must leave the + /// original manifest alone (the same immutability `chat_session_id` + /// already relies on). + #[test] + fn provenance_json_survives_a_later_upsert_run() { + let dir = + std::env::temp_dir().join(format!("orx-store-provenance-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + let manifest = ProvenanceManifest { + orx_version: "0.2.1".into(), + launcher_os: std::env::consts::OS.into(), + launcher_arch: std::env::consts::ARCH.into(), + agent_harness: Some("claude".into()), + agent_model: Some("claude-sonnet-5".into()), + parent_experiment_id: None, + }; + let mut run = run_fixture("run_1", "starting", None); + run.provenance_json = Some(manifest.to_json()); + store.upsert_run(&run).unwrap(); + + // A backend's own later upsert — e.g. once the real job id is known + // — naturally constructs its `StoredRun` with `provenance_json: None` + // (it never re-derives the manifest); that must not erase what the + // first upsert already stored. + let mut backend_update = run_fixture("run_1", "running", None); + backend_update.backend_json = r#"{"kind":"local_job","jobId":"real-handle"}"#.into(); + backend_update.provenance_json = None; + store.upsert_run(&backend_update).unwrap(); + + let stored = store.get_run("run_1").unwrap().unwrap(); + assert_eq!(stored.status, "running"); + assert_eq!( + stored.backend_json, + r#"{"kind":"local_job","jobId":"real-handle"}"# + ); + assert_eq!( + ProvenanceManifest::parse(&stored.provenance_json.unwrap()).unwrap(), + manifest, + "provenance must survive the backend's follow-up upsert" + ); + + let _ = std::fs::remove_dir_all(&dir); + } + + /// Test scenario from the state-machine design doc: "duplicate completion + /// callbacks". The second write must be silently rejected rather than + /// erroring or re-stamping `ended_at`/`exit_code`. + #[test] + fn duplicate_terminal_writes_are_idempotent_no_ops() { + let dir = std::env::temp_dir().join(format!("orx-store-dup-term-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + store + .upsert_run(&run_fixture("run_1", "running", None)) + .unwrap(); + + assert!(store + .update_status("run_1", RunStatus::Done, Some(100), Some(0)) + .unwrap()); + let first = store.get_run("run_1").unwrap().unwrap(); + assert_eq!(first.status, "done"); + assert_eq!(first.ended_at, Some(100)); + assert_eq!(first.exit_code, Some(0)); + + // A second, later completion callback for the same run (e.g. a + // retried webhook, or a stale poll landing after a fresher one) must + // not be applied, and must not disturb the first write's timestamp + // or exit code. + assert!(!store + .update_status("run_1", RunStatus::Done, Some(200), Some(1)) + .unwrap()); + let second = store.get_run("run_1").unwrap().unwrap(); + assert_eq!(second.status, "done"); + assert_eq!( + second.ended_at, + Some(100), + "ended_at must not be re-stamped" + ); + assert_eq!( + second.exit_code, + Some(0), + "exit_code must not be overwritten" + ); + + let _ = std::fs::remove_dir_all(&dir); + } + + /// Test scenario: "completion arriving after cancellation" — once a run + /// has been recorded as cancelled, a late success/failure report from the + /// backend must not resurrect it. + #[test] + fn completion_after_cancellation_is_rejected() { + let dir = + std::env::temp_dir().join(format!("orx-store-cancel-race-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + store + .upsert_run(&run_fixture("run_1", "running", None)) + .unwrap(); + + assert!(store + .update_status("run_1", RunStatus::Cancelled, Some(100), None) + .unwrap()); + assert!(!store + .update_status("run_1", RunStatus::Done, Some(200), Some(0)) + .unwrap()); + + let run = store.get_run("run_1").unwrap().unwrap(); + assert_eq!(run.status, "cancelled"); + assert_eq!(run.ended_at, Some(100)); + assert_eq!(run.exit_code, None); + + let _ = std::fs::remove_dir_all(&dir); + } + + /// Test scenario: "invalid backward transitions" — a backend cannot + /// regress an already-`running` job back to `starting`. + #[test] + fn running_cannot_regress_to_starting() { + let dir = std::env::temp_dir().join(format!("orx-store-backward-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + store + .upsert_run(&run_fixture("run_1", "running", None)) + .unwrap(); + + assert!(!store + .update_status("run_1", RunStatus::Starting, None, None) + .unwrap()); + assert_eq!(store.get_run("run_1").unwrap().unwrap().status, "running"); + + let _ = std::fs::remove_dir_all(&dir); + } + + /// Test scenarios: "cancel while preparing" and "cancel while running" — + /// both non-terminal states can move directly to `cancelled`. + #[test] + fn cancel_is_legal_from_either_non_terminal_state() { + let dir = + std::env::temp_dir().join(format!("orx-store-cancel-both-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + store + .upsert_run(&run_fixture("run_starting", "starting", None)) + .unwrap(); + store + .upsert_run(&run_fixture("run_running", "running", None)) + .unwrap(); + + assert!(store + .update_status("run_starting", RunStatus::Cancelled, Some(1), None) + .unwrap()); + assert!(store + .update_status("run_running", RunStatus::Cancelled, Some(1), None) + .unwrap()); + + let _ = std::fs::remove_dir_all(&dir); + } + + /// Test scenario: "retry after a partially completed run" — a run that + /// failed can be re-launched under a fresh run id (retries are new rows, + /// never a resurrection of the old one), and the old terminal row is left + /// untouched by anything trying to touch it afterward. + #[test] + fn retry_after_failure_is_a_new_row_not_a_resurrection() { + let dir = std::env::temp_dir().join(format!("orx-store-retry-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + store + .upsert_run(&run_fixture("run_1", "running", None)) + .unwrap(); + assert!(store + .update_status("run_1", RunStatus::Failed, Some(1), Some(1)) + .unwrap()); + + // The retry is a distinct run id; the failed row is untouched. + store + .upsert_run(&run_fixture("run_1_retry", "starting", None)) + .unwrap(); + assert!(store + .update_status("run_1_retry", RunStatus::Running, None, None) + .unwrap()); + + assert_eq!(store.get_run("run_1").unwrap().unwrap().status, "failed"); + assert_eq!( + store.get_run("run_1_retry").unwrap().unwrap().status, + "running" + ); + + let _ = std::fs::remove_dir_all(&dir); + } + + /// Test scenario: "concurrent status updates" / "agent wake while a run + /// is finishing" — many independent connections (as separate supervisor + /// processes would be) race to finalize the same run with different + /// terminal outcomes. Exactly one write must win, and the row must land + /// on a real terminal state rather than a torn/partial one. + #[test] + fn concurrent_terminal_writes_from_separate_connections_settle_on_exactly_one_outcome() { + let dir = + std::env::temp_dir().join(format!("orx-store-concurrent-{}", uuid::Uuid::new_v4())); + // Open once first so schema creation isn't itself racing below. + let setup = Store::open_at(dir.clone()).unwrap(); + setup + .upsert_run(&run_fixture("run_1", "running", None)) + .unwrap(); + drop(setup); + + let outcomes = [RunStatus::Done, RunStatus::Failed, RunStatus::Cancelled]; + let handles: Vec<_> = outcomes + .into_iter() + .map(|outcome| { + let dir = dir.clone(); + std::thread::spawn(move || { + // Each thread is its own connection, like independent + // supervisor processes sharing one SQLite file (WAL + + // busy_timeout, set in `open_at_with_move_lock`). + let store = Store::open_at(dir).unwrap(); + store + .update_status("run_1", outcome, Some(1), None) + .unwrap() + }) + }) + .collect(); + let applied: Vec = handles.into_iter().map(|h| h.join().unwrap()).collect(); + + assert_eq!( + applied.iter().filter(|ok| **ok).count(), + 1, + "exactly one racing writer should win: {applied:?}" + ); + let final_status = store_reopen(&dir).get_run("run_1").unwrap().unwrap().status; + assert!( + RunStatus::parse(&final_status).is_some_and(RunStatus::is_terminal), + "run must settle on a real terminal state, got {final_status:?}" + ); + + let _ = std::fs::remove_dir_all(&dir); + } + + fn store_reopen(dir: &std::path::Path) -> Store { + Store::open_at(dir.to_path_buf()).unwrap() + } + + /// TASK 2 (crash recovery/reconciliation): `mark_run_unrecoverable` forces + /// a non-terminal run to `Failed`, stamping a machine-readable + /// `recovery_reason` distinct from a normal backend-reported failure, and + /// appending a human-readable note to `result_markdown`. + #[test] + fn mark_run_unrecoverable_stamps_reason_and_fails_the_run() { + let dir = + std::env::temp_dir().join(format!("orx-store-unrecoverable-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + store + .upsert_run(&run_fixture("run_1", "running", None)) + .unwrap(); + + assert!(store + .mark_run_unrecoverable( + "run_1", + crate::error::ErrorKind::Reconciliation, + "no supervisor could be started" + ) + .unwrap()); + + let run = store.get_run("run_1").unwrap().unwrap(); + assert_eq!(run.status, "failed"); + assert_eq!( + run.recovery_reason.as_deref(), + Some("no supervisor could be started") + ); + assert_eq!(run.error_kind.as_deref(), Some("reconciliation_failure")); + assert!(run + .result_markdown + .unwrap() + .contains("no supervisor could be started")); + + let _ = std::fs::remove_dir_all(&dir); + } + + /// A run that already reached a real terminal state (it finished, or was + /// cancelled, before reconciliation caught up with it) must never be + /// overwritten — `mark_run_unrecoverable` inherits `update_status`'s + /// terminal-state guard and leaves the row, including any prior + /// `recovery_reason`, untouched. + #[test] + fn mark_run_unrecoverable_never_overwrites_a_real_outcome() { + let dir = std::env::temp_dir().join(format!( + "orx-store-unrecoverable-race-{}", + uuid::Uuid::new_v4() + )); + let store = Store::open_at(dir.clone()).unwrap(); + store + .upsert_run(&run_fixture("run_1", "running", None)) + .unwrap(); + assert!(store + .update_status("run_1", RunStatus::Done, Some(1), Some(0)) + .unwrap()); + + assert!(!store + .mark_run_unrecoverable( + "run_1", + crate::error::ErrorKind::Reconciliation, + "reconciliation gave up" + ) + .unwrap()); + + let run = store.get_run("run_1").unwrap().unwrap(); + assert_eq!( + run.status, "done", + "a real completion must not be clobbered" + ); + assert_eq!(run.recovery_reason, None); + assert_eq!(run.error_kind, None); + + let _ = std::fs::remove_dir_all(&dir); + } + + /// Calling `mark_run_unrecoverable` a second time on an already-recovered + /// run is a no-op (the first call's terminal write wins), matching the + /// idempotency `update_status` already guarantees. + #[test] + fn mark_run_unrecoverable_is_idempotent() { + let dir = std::env::temp_dir().join(format!( + "orx-store-unrecoverable-idem-{}", + uuid::Uuid::new_v4() + )); + let store = Store::open_at(dir.clone()).unwrap(); + store + .upsert_run(&run_fixture("run_1", "starting", None)) + .unwrap(); + + assert!(store + .mark_run_unrecoverable( + "run_1", + crate::error::ErrorKind::Reconciliation, + "first reason" + ) + .unwrap()); + assert!(!store + .mark_run_unrecoverable( + "run_1", + crate::error::ErrorKind::BackendUnavailable, + "second reason" + ) + .unwrap()); + + let run = store.get_run("run_1").unwrap().unwrap(); + assert_eq!(run.recovery_reason.as_deref(), Some("first reason")); + assert_eq!(run.error_kind.as_deref(), Some("reconciliation_failure")); + + let _ = std::fs::remove_dir_all(&dir); + } + + // --- TASK 3: SQLite concurrency and stress tests ----------------------- + + /// Many actors (as separate `orx exp run` invocations would be) creating + /// distinct experiments at once — real threads, each its own connection, + /// matching `concurrent_terminal_writes_from_separate_connections_...` + /// (TASK 1). WAL + busy_timeout must absorb the write contention: every + /// experiment lands, none is silently dropped, and no thread sees a + /// `SQLITE_BUSY` error surface. + #[test] + fn parallel_experiment_creation_all_land_with_no_sqlite_busy_errors() { + let dir = + std::env::temp_dir().join(format!("orx-store-parallel-exp-{}", uuid::Uuid::new_v4())); + let setup = Store::open_at(dir.clone()).unwrap(); + setup + .create_local_project(&LocalProject { + id: "proj_1".into(), + name: "proj_1".into(), + slug: "proj_1".into(), + github_owner: String::new(), + github_repo: String::new(), + github_sync_enabled: false, + baseline_branch: "main".into(), + repo_path: dir.join("proj_1").to_string_lossy().into_owned(), + run_command: None, + paper_id: None, + created_at: 1, + updated_at: 1, + }) + .unwrap(); + drop(setup); + + const N: usize = 32; + let handles: Vec<_> = (0..N) + .map(|i| { + let dir = dir.clone(); + std::thread::spawn(move || { + let store = Store::open_at(dir).unwrap(); + store.create_local_experiment(&experiment_fixture(&format!("exp_{i}"), None)) + }) + }) + .collect(); + for (i, handle) in handles.into_iter().enumerate() { + handle + .join() + .unwrap() + .unwrap_or_else(|err| panic!("experiment {i} failed to create: {err}")); + } + + let store = store_reopen(&dir); + for i in 0..N { + assert!( + store + .get_local_experiment(&format!("exp_{i}")) + .unwrap() + .is_some(), + "experiment {i} is missing after concurrent creation" + ); + } + + let _ = std::fs::remove_dir_all(&dir); + } + + /// Retries `f` a handful of times, with backoff, on a locked/busy error — + /// `busy_timeout` (set on every connection) already retries *inside* + /// SQLite for up to 5s before ever surfacing one, so seeing it here means + /// that connection's own retrying wasn't enough under unusually heavy + /// contention (a slow/virtualized CI disk, several actors polling at + /// once), not that data was lost or corrupted. Any other error is + /// returned immediately — this exists to smooth over platform/CI timing + /// variance in these tests, not to mask a real bug. + fn retry_on_lock(mut f: impl FnMut() -> crate::error::Result) -> crate::error::Result { + for attempt in 1..=5 { + match f() { + Ok(v) => return Ok(v), + Err(err) => { + let retryable = { + let msg = err.to_string(); + msg.contains("locked") || msg.contains("busy") + }; + if !retryable || attempt == 5 { + return Err(err); + } + std::thread::sleep(std::time::Duration::from_millis(20 * attempt)); + } + } + } + unreachable!() + } + + /// Readers must not be permanently blocked or errored by a concurrent + /// writer: WAL mode's whole point is that `list_runs`/`get_run` keep + /// serving the last committed snapshot while a writer holds the + /// database. One thread updates a run at a realistic polling cadence + /// while several others read it at the same cadence; every reader must + /// eventually observe the final terminal status without ever getting + /// stuck. + #[test] + fn concurrent_readers_are_never_blocked_by_a_concurrent_writer() { + let dir = + std::env::temp_dir().join(format!("orx-store-read-write-{}", uuid::Uuid::new_v4())); + let setup = Store::open_at(dir.clone()).unwrap(); + setup + .upsert_run(&run_fixture("run_1", "starting", None)) + .unwrap(); + drop(setup); + + let writer_dir = dir.clone(); + let writer = std::thread::spawn(move || { + let store = Store::open_at(writer_dir).unwrap(); + store + .update_status("run_1", RunStatus::Running, None, None) + .unwrap(); + for _ in 0..20 { + // Touching an unrelated column keeps this a real repeated + // write without racing TASK 1's terminal-write guard. A tiny + // sleep models a poll loop's cadence rather than a hot spin — + // this test is about the read/write contention property, not + // about surviving an artificial denial-of-service pace. + store.set_result_markdown("run_1", "still running").unwrap(); + std::thread::sleep(std::time::Duration::from_millis(2)); + } + store + .update_status("run_1", RunStatus::Done, Some(now_ms()), Some(0)) + .unwrap(); + }); + + let readers: Vec<_> = (0..4) + .map(|_| { + let dir = dir.clone(); + std::thread::spawn(move || -> StoredRun { + let store = Store::open_at(dir).unwrap(); + loop { + // A transient lock error gets a few retries with + // backoff before this test gives up on it — real + // callers get the same protection for free from + // `busy_timeout` retrying inside SQLite; this loop + // only covers the rare case where even that wasn't + // enough. + let last = retry_on_lock(|| store.get_run("run_1")).unwrap().unwrap(); + let _ = retry_on_lock(|| store.list_runs(10)).unwrap(); + if last.status == "done" { + return last; + } + std::thread::sleep(std::time::Duration::from_millis(1)); + } + }) + }) + .collect(); + + writer.join().unwrap(); + for reader in readers { + let final_run = reader.join().unwrap(); + assert_eq!(final_run.status, "done"); + assert_eq!(final_run.exit_code, Some(0)); + } + + let _ = std::fs::remove_dir_all(&dir); + } + + /// A transaction that errors out partway must leave no trace: dropping a + /// `Transaction` without calling `commit()` rolls it back (rusqlite's + /// `Drop` impl), so a write made inside it is invisible once the + /// transaction is gone — proving the rollback guarantee every + /// `self.begin()`-based method in this file depends on. + #[test] + fn an_uncommitted_transaction_rolls_back_on_drop() { + let dir = std::env::temp_dir().join(format!("orx-store-rollback-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + store + .upsert_run(&run_fixture("run_1", "starting", None)) + .unwrap(); + + { + let tx = store.begin().unwrap(); + tx.execute("UPDATE runs SET status = 'running' WHERE id = 'run_1'", []) + .unwrap(); + // Deliberately no `tx.commit()` — the transaction is dropped here + // and must roll back rather than silently persist. + } + + assert_eq!( + store.get_run("run_1").unwrap().unwrap().status, + "starting", + "an uncommitted transaction's write must not survive" + ); + + // The failure-partway-through case a real multi-statement method hits: + // the second statement errors, so neither statement's effect should stick. + { + let tx = store.begin().unwrap(); + tx.execute("UPDATE runs SET status = 'running' WHERE id = 'run_1'", []) + .unwrap(); + let err = tx.execute("THIS IS NOT VALID SQL", []).unwrap_err(); + drop(err); + // `tx` drops here (its own scope), rolling back the first + // statement along with the failed second one. + } + assert_eq!( + store.get_run("run_1").unwrap().unwrap().status, + "starting", + "a failed multi-statement transaction must not partially apply" + ); + + let _ = std::fs::remove_dir_all(&dir); + } + + /// `record_chat_spawn_attempt` used to be a separate `UPDATE` then + /// `SELECT`, so a racing caller's own increment could land in between and + /// the value read back would be *their* count. Now it's one + /// `UPDATE ... RETURNING`: with `N` concurrent callers the returned + /// values must be exactly `{1, 2, ..., N}` — a permutation, not a + /// multiset with duplicates or gaps. + #[test] + fn concurrent_spawn_attempt_increments_never_collide() { + let dir = + std::env::temp_dir().join(format!("orx-store-spawn-attempt-{}", uuid::Uuid::new_v4())); + let setup = Store::open_at(dir.clone()).unwrap(); + setup + .create_chat_session(&chat_session_fixture("chat_A")) + .unwrap(); + setup + .create_chat_spawn(&ChatSpawn { + session_id: "chat_A".into(), + parent_session_id: "chat_parent".into(), + prompt: "go".into(), + wake_parent: true, + attempts: 0, + finished_at: None, + }) + .unwrap(); + drop(setup); + + const N: i64 = 16; + let handles: Vec<_> = (0..N) + .map(|_| { + let dir = dir.clone(); + std::thread::spawn(move || { + let store = Store::open_at(dir).unwrap(); + store.record_chat_spawn_attempt("chat_A").unwrap() + }) + }) + .collect(); + let mut results: Vec = handles.into_iter().map(|h| h.join().unwrap()).collect(); + results.sort_unstable(); + + assert_eq!(results, (1..=N).collect::>()); + + let _ = std::fs::remove_dir_all(&dir); + } + + /// No `criterion`/benchmark harness exists in this repo, so this is a + /// hand-rolled sanity timing test rather than a strict perf assertion — + /// CI hardware varies a lot (a slow/virtualized Windows runner measured + /// at ~2.4ms/write here, vs. sub-millisecond locally), so the bound below + /// is deliberately generous. It exists to catch a severe regression (an + /// accidental per-write fsync, a lock held far too long) rather than to + /// pin an exact number. High-frequency sequential status writes — the + /// shape every supervise poll loop produces — must stay fast. + #[test] + fn sequential_status_writes_complete_quickly() { + let dir = + std::env::temp_dir().join(format!("orx-store-bench-seq-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + store + .upsert_run(&run_fixture("run_1", "running", None)) + .unwrap(); + + const WRITES: usize = 2_000; + let start = std::time::Instant::now(); + for _ in 0..WRITES { + store.set_result_markdown("run_1", "polling...").unwrap(); + } + let elapsed = start.elapsed(); + + assert!( + elapsed < std::time::Duration::from_secs(30), + "{WRITES} sequential writes took {elapsed:?} — investigate for a regression \ + (e.g. an unintended fsync per write, or a lock held too long)" + ); + + let _ = std::fs::remove_dir_all(&dir); + } + + /// Demonstrates the value of this task's new `runs` indexes: with a + /// realistically large table (this repo has no retention/pruning for + /// `runs`, so a long-lived project's table only grows — see the TASK 3 + /// investigation), `list_active_runs`/`count_active_runs` — polled every + /// 30s by the TASK 2 reconciliation loop — must stay fast rather than + /// degrading into a full table scan. + #[test] + fn active_run_queries_stay_fast_against_a_large_runs_table() { + let dir = + std::env::temp_dir().join(format!("orx-store-bench-scale-{}", uuid::Uuid::new_v4())); + let store = Store::open_at(dir.clone()).unwrap(); + + const ROWS: usize = 20_000; + { + let tx = store.begin().unwrap(); + for i in 0..ROWS { + // Every 500th run is left active; the rest are finished + // history — a realistic long-lived-project shape. + let status = if i % 500 == 0 { "running" } else { "done" }; + tx.execute( + "INSERT INTO runs (id, experiment_id, project_id, status, backend_json, + command, created_at, updated_at, ended_at, exit_code, + cancel_requested) + VALUES (?1, 'exp_1', 'proj_1', ?2, '{}', '', ?3, ?3, ?3, 0, 0)", + params![format!("run_{i}"), status, i as i64], + ) + .unwrap(); + } + tx.commit().unwrap(); + } + + let start = std::time::Instant::now(); + for _ in 0..20 { + let active = store.list_active_runs().unwrap(); + assert_eq!(active.len(), ROWS.div_ceil(500)); + let _ = store.count_active_runs().unwrap(); + } + let elapsed = start.elapsed(); + + assert!( + elapsed < std::time::Duration::from_secs(5), + "40 index-backed active-run queries over {ROWS} rows took {elapsed:?} — \ + investigate for a missing/regressed index on runs.status" + ); + + let _ = std::fs::remove_dir_all(&dir); + } + #[test] fn run_chat_session_id_roundtrips() { let dir = std::env::temp_dir().join(format!("orx-store-runsess-{}", uuid::Uuid::new_v4())); @@ -4312,9 +5372,9 @@ mod tests { ["run_done", "run_failed"] ); - store - .update_status("run_active", "done", Some(2), Some(0)) - .unwrap(); + assert!(store + .update_status("run_active", RunStatus::Done, Some(2), Some(0)) + .unwrap()); assert_eq!(store.list_ready_run_wakeups().unwrap().len(), 3); let token = store .claim_run_wakeup("run_done", "chat_A") diff --git a/src/token_auth.rs b/src/token_auth.rs new file mode 100644 index 00000000..e6b471d4 --- /dev/null +++ b/src/token_auth.rs @@ -0,0 +1,63 @@ +//! Shared bearer-token comparison for loopback surfaces that gate on a +//! pre-shared secret (the `orx up --remote` session bearer, `orx serve +//! --token`). Tokens are always compared as SHA-256 digests, never as raw +//! bytes: this keeps the token itself out of process memory diffs/core dumps +//! at the comparison site and makes every call site constant-time by +//! construction rather than by discipline. + +use sha2::{Digest as _, Sha256}; + +/// SHA-256 digest of a token/secret, as a fixed-size array so callers can +/// store and compare digests without re-hashing. +pub(crate) fn digest(value: &str) -> [u8; 32] { + Sha256::digest(value.as_bytes()).into() +} + +/// Constant-time equality for two digests (or any equal-length byte +/// sequences). Returns `false` immediately on a length mismatch — safe here +/// because both operands are always fixed-size digests, so the length itself +/// leaks nothing timing-sensitive. +pub(crate) fn constant_time_eq(left: &[u8], right: &[u8]) -> bool { + left.len() == right.len() + && left + .iter() + .zip(right) + .fold(0_u8, |difference, (left, right)| { + difference | (left ^ right) + }) + == 0 +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn same_value_digests_equal() { + assert_eq!(digest("secret"), digest("secret")); + } + + #[test] + fn different_values_digest_differently() { + assert_ne!(digest("secret"), digest("different")); + } + + #[test] + fn constant_time_eq_matches_equal_digests() { + let a = digest("token-123"); + let b = digest("token-123"); + assert!(constant_time_eq(&a, &b)); + } + + #[test] + fn constant_time_eq_rejects_mismatched_digests() { + let a = digest("token-123"); + let b = digest("token-456"); + assert!(!constant_time_eq(&a, &b)); + } + + #[test] + fn constant_time_eq_rejects_length_mismatch() { + assert!(!constant_time_eq(b"short", b"a-longer-slice")); + } +} diff --git a/ui/dist/assets/index-B5hkWMAS.js b/ui/dist/assets/index-g-Nma8rM.js similarity index 77% rename from ui/dist/assets/index-B5hkWMAS.js rename to ui/dist/assets/index-g-Nma8rM.js index 513e4fa3..e75b6317 100644 --- a/ui/dist/assets/index-B5hkWMAS.js +++ b/ui/dist/assets/index-g-Nma8rM.js @@ -1,4 +1,4 @@ -var eG=Object.defineProperty;var XC=e=>{throw TypeError(e)};var tG=(e,n,t)=>n in e?eG(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var Fs=(e,n,t)=>tG(e,typeof n!="symbol"?n+"":n,t),tx=(e,n,t)=>n.has(e)||XC("Cannot "+t);var de=(e,n,t)=>(tx(e,n,"read from private field"),t?t.call(e):n.get(e)),rt=(e,n,t)=>n.has(e)?XC("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,t),Fe=(e,n,t,r)=>(tx(e,n,"write to private field"),r?r.call(e,t):n.set(e,t),t),Dt=(e,n,t)=>(tx(e,n,"access private method"),t);var r0=(e,n,t,r)=>({set _(s){Fe(e,n,s,t)},get _(){return de(e,n,r)}});(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function t(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 r(s){if(s.ep)return;s.ep=!0;const i=t(s);fetch(s.href,i)}})();function Gp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nx={exports:{}},s0={};/** +var eG=Object.defineProperty;var XC=e=>{throw TypeError(e)};var tG=(e,n,t)=>n in e?eG(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var As=(e,n,t)=>tG(e,typeof n!="symbol"?n+"":n,t),tx=(e,n,t)=>n.has(e)||XC("Cannot "+t);var ue=(e,n,t)=>(tx(e,n,"read from private field"),t?t.call(e):n.get(e)),nt=(e,n,t)=>n.has(e)?XC("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,t),He=(e,n,t,r)=>(tx(e,n,"write to private field"),r?r.call(e,t):n.set(e,t),t),Dt=(e,n,t)=>(tx(e,n,"access private method"),t);var r0=(e,n,t,r)=>({set _(s){He(e,n,s,t)},get _(){return ue(e,n,r)}});(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function t(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 r(s){if(s.ep)return;s.ep=!0;const i=t(s);fetch(s.href,i)}})();function Gp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nx={exports:{}},s0={};/** * @license React * react-jsx-runtime.production.js * @@ -6,7 +6,7 @@ var eG=Object.defineProperty;var XC=e=>{throw TypeError(e)};var tG=(e,n,t)=>n in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ZC;function nG(){if(ZC)return s0;ZC=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function t(r,s,i){var a=null;if(i!==void 0&&(a=""+i),s.key!==void 0&&(a=""+s.key),"key"in s){i={};for(var o in s)o!=="key"&&(i[o]=s[o])}else i=s;return s=i.ref,{$$typeof:e,type:r,key:a,ref:s!==void 0?s:null,props:i}}return s0.Fragment=n,s0.jsx=t,s0.jsxs=t,s0}var JC;function rG(){return JC||(JC=1,nx.exports=nG()),nx.exports}var f=rG(),rx={exports:{}},Xt={};/** + */var ZC;function nG(){if(ZC)return s0;ZC=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function t(r,s,i){var a=null;if(i!==void 0&&(a=""+i),s.key!==void 0&&(a=""+s.key),"key"in s){i={};for(var o in s)o!=="key"&&(i[o]=s[o])}else i=s;return s=i.ref,{$$typeof:e,type:r,key:a,ref:s!==void 0?s:null,props:i}}return s0.Fragment=n,s0.jsx=t,s0.jsxs=t,s0}var JC;function rG(){return JC||(JC=1,nx.exports=nG()),nx.exports}var f=rG(),rx={exports:{}},Jt={};/** * @license React * react.production.js * @@ -14,7 +14,7 @@ var eG=Object.defineProperty;var XC=e=>{throw TypeError(e)};var tG=(e,n,t)=>n in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var e9;function sG(){if(e9)return Xt;e9=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),a=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),p=Symbol.iterator;function m(F){return F===null||typeof F!="object"?null:(F=p&&F[p]||F["@@iterator"],typeof F=="function"?F:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,v={};function b(F,q,G){this.props=F,this.context=q,this.refs=v,this.updater=G||x}b.prototype.isReactComponent={},b.prototype.setState=function(F,q){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,q,"setState")},b.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function w(){}w.prototype=b.prototype;function y(F,q,G){this.props=F,this.context=q,this.refs=v,this.updater=G||x}var C=y.prototype=new w;C.constructor=y,S(C,b.prototype),C.isPureReactComponent=!0;var E=Array.isArray;function N(){}var T={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function M(F,q,G){var ee=G.ref;return{$$typeof:e,type:F,key:q,ref:ee!==void 0?ee:null,props:G}}function O(F,q){return M(F.type,q,F.props)}function B(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function $(F){var q={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(G){return q[G]})}var U=/\/+/g;function H(F,q){return typeof F=="object"&&F!==null&&F.key!=null?$(""+F.key):q.toString(36)}function Y(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(N,N):(F.status="pending",F.then(function(q){F.status==="pending"&&(F.status="fulfilled",F.value=q)},function(q){F.status==="pending"&&(F.status="rejected",F.reason=q)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function V(F,q,G,ee,ce){var oe=typeof F;(oe==="undefined"||oe==="boolean")&&(F=null);var ne=!1;if(F===null)ne=!0;else switch(oe){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(F.$$typeof){case e:case n:ne=!0;break;case _:return ne=F._init,V(ne(F._payload),q,G,ee,ce)}}if(ne)return ce=ce(F),ne=ee===""?"."+H(F,0):ee,E(ce)?(G="",ne!=null&&(G=ne.replace(U,"$&/")+"/"),V(ce,q,G,"",function(ae){return ae})):ce!=null&&(B(ce)&&(ce=O(ce,G+(ce.key==null||F&&F.key===ce.key?"":(""+ce.key).replace(U,"$&/")+"/")+ne)),q.push(ce)),1;ne=0;var Q=ee===""?".":ee+":";if(E(F))for(var le=0;le{const n=R.useContext(oM);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},iG=({client:e,children:n})=>(R.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),f.jsx(oM.Provider,{value:e,children:n})),aG={setTimeout:(e,n)=>setTimeout(e,n),clearTimeout:e=>clearTimeout(e),setInterval:(e,n)=>setInterval(e,n),clearInterval:e=>clearInterval(e)};var Kc,z5,QR,oG=(QR=class{constructor(){rt(this,Kc,aG);rt(this,z5,!1)}setTimeoutProvider(e){Fe(this,Kc,e)}setTimeout(e,n){return de(this,Kc).setTimeout(e,n)}clearTimeout(e){de(this,Kc).clearTimeout(e)}setInterval(e,n){return de(this,Kc).setInterval(e,n)}clearInterval(e){de(this,Kc).clearInterval(e)}},Kc=new WeakMap,z5=new WeakMap,QR);const ad=new oG;function lG(e){setTimeout(e,0)}const cG=typeof window>"u"||"Deno"in globalThis;function Ws(){}function uG(e,n){return typeof e=="function"?e(n):e}function lM(e){return typeof e=="number"&&e>=0&&e!==1/0}function cM(e,n){return Math.max(e+(n||0)-Date.now(),0)}function Br(e,n){return typeof e=="function"?e(n):e}function n9(e,n){const{type:t="all",exact:r,fetchStatus:s,predicate:i,queryKey:a,stale:o}=e;if(a){if(r){if(n.queryHash!==j5(a,n.options))return!1}else if(!Oh(n.queryKey,a))return!1}if(t!=="all"){const l=n.isActive();if(t==="active"&&!l||t==="inactive"&&l)return!1}return!(typeof o=="boolean"&&n.isStale()!==o||s&&s!==n.state.fetchStatus||i&&!i(n))}function r9(e,n){const{exact:t,status:r,predicate:s,mutationKey:i}=e;if(i){if(!n.options.mutationKey)return!1;if(t){if(Td(n.options.mutationKey)!==Td(i))return!1}else if(!Oh(n.options.mutationKey,i))return!1}return!(r&&n.state.status!==r||s&&!s(n))}function j5(e,n){return((n==null?void 0:n.queryKeyHashFn)||Td)(e)}function Td(e){return JSON.stringify(e,(n,t)=>Yw(t)?Object.keys(t).sort().reduce((r,s)=>(r[s]=t[s],r),{}):t)}function Oh(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(Array.isArray(e)&&Array.isArray(n)){for(let r=0;r500)return n;const r=s9(e)&&s9(n);if(!r&&!(Yw(e)&&Yw(n)))return n;const s=(r?e:Object.keys(e)).length,i=r?n:Object.keys(n),a=i.length,o=r?new Array(a):{};let l=0;for(let u=0;u{ad.setTimeout(n,e)})}function Xw(e,n,t){return typeof t.structuralSharing=="function"?t.structuralSharing(e,n):t.structuralSharing!==!1?T5(e,n):n}function hG(e,n,t=0){const r=[...e,n];return t&&r.length>t?r.slice(1):r}function _G(e,n,t=0){const r=[n,...e];return t&&r.length>t?r.slice(0,-1):r}const A5=Symbol();function uM(e,n){return!e.queryFn&&(n!=null&&n.initialPromise)?()=>n.initialPromise:!e.queryFn||e.queryFn===A5?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function R5(e,n){return typeof e=="function"?e(...n):!!e}function pG(e,n,t){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=n()),r||(r=!0,s.aborted?t():s.addEventListener("abort",t,{once:!0})),s)}),e}let mG=()=>cG;const M5=()=>mG();var Gd=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ud,Qc,vh,YR,gG=(YR=class extends Gd{constructor(){super();rt(this,ud);rt(this,Qc);rt(this,vh);Fe(this,vh,n=>{if(typeof window<"u"&&window.addEventListener){const t=()=>n();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){de(this,Qc)||this.setEventListener(de(this,vh))}onUnsubscribe(){var n;this.hasListeners()||((n=de(this,Qc))==null||n.call(this),Fe(this,Qc,void 0))}setEventListener(n){var t;Fe(this,vh,n),(t=de(this,Qc))==null||t.call(this),Fe(this,Qc,n(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(n){de(this,ud)!==n&&(Fe(this,ud,n),this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(t=>{t(n)})}isFocused(){var n;return typeof de(this,ud)=="boolean"?de(this,ud):((n=globalThis.document)==null?void 0:n.visibilityState)!=="hidden"}},ud=new WeakMap,Qc=new WeakMap,vh=new WeakMap,YR);const D5=new gG,vG=lG;function bG(){let e=[],n=0,t=o=>{o()},r=o=>{o()},s=vG;const i=o=>{n?e.push(o):s(()=>{t(o)})},a=()=>{const o=e;e=[],o.length&&s(()=>{r(()=>{o.forEach(l=>{t(l)})})})};return{batch:o=>{let l;n++;try{l=o()}finally{n--,n||a()}return l},batchCalls:o=>(...l)=>{i(()=>{o(...l)})},schedule:i,setNotifyFunction:o=>{t=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{s=o}}}const Tr=bG();var bh,Yc,yh,XR,yG=(XR=class extends Gd{constructor(){super();rt(this,bh,!0);rt(this,Yc);rt(this,yh);Fe(this,yh,n=>{if(typeof window<"u"&&window.addEventListener){const t=()=>n(!0),r=()=>n(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}})}onSubscribe(){de(this,Yc)||this.setEventListener(de(this,yh))}onUnsubscribe(){var n;this.hasListeners()||((n=de(this,Yc))==null||n.call(this),Fe(this,Yc,void 0))}setEventListener(n){var t;Fe(this,yh,n),(t=de(this,Yc))==null||t.call(this),Fe(this,Yc,n(this.setOnline.bind(this)))}setOnline(n){de(this,bh)!==n&&(Fe(this,bh,n),this.listeners.forEach(t=>{t(n)}))}isOnline(){return de(this,bh)}},bh=new WeakMap,Yc=new WeakMap,yh=new WeakMap,XR);const H1=new yG;function xG(e){return Math.min(1e3*2**e,3e4)}function dM(e){return(e??"online")==="online"?H1.isOnline():!0}var q1=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function wG(e){return e instanceof q1}function fM(e){let n=!1,t=0,r,s="pending",i,a;const o=new Promise((w,y)=>{i=w,a=y});o.catch(Ws);const l=()=>s!=="pending",u=w=>{var y;if(!l()){const C=new q1(w);S(C),(y=e.onCancel)==null||y.call(e,C)}},_=()=>{n=!0},d=()=>{n=!1},p=()=>D5.isFocused()&&(e.networkMode==="always"||H1.isOnline())&&e.canRun(),m=()=>dM(e.networkMode)&&e.canRun(),x=w=>{l()||(r==null||r(),s="resolved",i(w))},S=w=>{l()||(r==null||r(),s="rejected",a(w))},v=()=>new Promise(w=>{var y;r=C=>{(l()||p())&&w(C)},(y=e.onPause)==null||y.call(e)}).then(()=>{var w;r=void 0,l()||(w=e.onContinue)==null||w.call(e)}),b=()=>{if(l())return;let w;const y=t===0?e.initialPromise:void 0;try{w=y??e.fn()}catch(C){w=Promise.reject(C)}Promise.resolve(w).then(x).catch(C=>{var M;if(l())return;const E=e.retry??(M5()?0:3),N=e.retryDelay??xG,T=typeof N=="function"?N(t,C):N,z=E===!0||typeof E=="number"&&tp()?void 0:v()).then(()=>{n?S(C):b()})})};return{promise:o,status:()=>s,cancel:u,continue:()=>(r==null||r(),o),cancelRetry:_,continueRetry:d,canStart:m,start:()=>(m()?b():v().then(b),o)}}var dd,ZR,hM=(ZR=class{constructor(){rt(this,dd)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),lM(this.gcTime)&&Fe(this,dd,ad.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(M5()?1/0:3e5))}clearGcTimeout(){de(this,dd)!==void 0&&(ad.clearTimeout(de(this,dd)),Fe(this,dd,void 0))}},dd=new WeakMap,ZR);function SG(e){return{onFetch:(n,t)=>{var _,d,p,m,x;const r=n.options,s=(p=(d=(_=n.fetchOptions)==null?void 0:_.meta)==null?void 0:d.fetchMore)==null?void 0:p.direction,i=((m=n.state.data)==null?void 0:m.pages)||[],a=((x=n.state.data)==null?void 0:x.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const u=async()=>{let S=!1;const v=y=>{pG(y,()=>n.signal,()=>S=!0)},b=uM(n.options,n.fetchOptions),w=async(y,C,E)=>{if(S)return Promise.reject(n.signal.reason);if(C==null&&y.pages.length)return Promise.resolve(y);const T=(()=>{const B={client:n.client,queryKey:n.queryKey,pageParam:C,direction:E?"backward":"forward",meta:n.options.meta};return v(B),B})(),z=await b(T),{maxPages:M}=n.options,O=E?_G:hG;return{pages:O(y.pages,z,M),pageParams:O(y.pageParams,C,M)}};if(s&&i.length){const y=s==="backward",C=y?kG:a9,E={pages:i,pageParams:a};o=await w(E,C(r,E),y)}else{const y=e??i.length;do{const C=l===0?a[0]??r.initialPageParam:a9(r,o);if(l>0&&C==null)break;o=await w(o,C),l++}while(l{var S,v;return(v=(S=n.options).persister)==null?void 0:v.call(S,u,{client:n.client,queryKey:n.queryKey,meta:n.options.meta,signal:n.signal},t)}:n.fetchFn=u}}}function a9(e,{pages:n,pageParams:t}){const r=n.length-1;return n.length>0?e.getNextPageParam(n[r],n,t[r],t):void 0}function kG(e,{pages:n,pageParams:t}){var r;return n.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,n[0],n,t[0],t):void 0}var xh,fd,wh,wa,hd,hs,Ap,_d,Ha,Sl,JR,CG=(JR=class extends hM{constructor(n){super();rt(this,Ha);rt(this,xh);rt(this,fd);rt(this,wh);rt(this,wa);rt(this,hd);rt(this,hs);rt(this,Ap);rt(this,_d);Fe(this,_d,!1),Fe(this,Ap,n.defaultOptions),this.setOptions(n.options),this.observers=[],Fe(this,hd,n.client),Fe(this,wa,de(this,hd).getQueryCache()),this.queryKey=n.queryKey,this.queryHash=n.queryHash,Fe(this,fd,l9(this.options)),this.state=n.state??de(this,fd),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return de(this,xh)}get promise(){var n;return(n=de(this,hs))==null?void 0:n.promise}setOptions(n){if(this.options={...de(this,Ap),...n},n!=null&&n._type&&Fe(this,xh,n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=l9(this.options);t.data!==void 0&&(this.setState(o9(t.data,t.dataUpdatedAt)),Fe(this,fd,t))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&de(this,wa).remove(this)}setData(n,t){const r=Xw(this.state.data,n,this.options);return Dt(this,Ha,Sl).call(this,{data:r,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),r}setState(n){Dt(this,Ha,Sl).call(this,{type:"setState",state:n})}cancel(n){var r,s;const t=(r=de(this,hs))==null?void 0:r.promise;return(s=de(this,hs))==null||s.cancel(n),t?t.then(Ws).catch(Ws):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return de(this,fd)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(n=>Br(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===A5||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(n=>Br(n.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(n=0){return this.state.data===void 0?!0:n==="static"?!1:this.state.isInvalidated?!0:!cM(this.state.dataUpdatedAt,n)}onFocus(){var n,t;(n=this.observers.find(r=>r.shouldFetchOnWindowFocus()))==null||n.refetch({cancelRefetch:!1}),(t=de(this,hs))==null||t.continue()}onOnline(){var n,t;(n=this.observers.find(r=>r.shouldFetchOnReconnect()))==null||n.refetch({cancelRefetch:!1}),(t=de(this,hs))==null||t.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),de(this,wa).notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){const t=this.observers.indexOf(n);t!==-1&&(this.observers.splice(t,1),this.observers.length||(de(this,hs)&&(de(this,_d)||this.state.fetchStatus==="paused"&&this.state.status==="pending"?de(this,hs).cancel({revert:!0}):de(this,hs).cancelRetry()),this.scheduleGc()),de(this,wa).notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Dt(this,Ha,Sl).call(this,{type:"invalidate"})}async fetch(n,t){var u,_,d,p,m,x,S,v,b,w,y,C;if(this.state.fetchStatus!=="idle"&&((u=de(this,hs))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(de(this,hs))return de(this,hs).continueRetry(),de(this,hs).promise}if(n&&this.setOptions(n),!this.options.queryFn){const E=this.observers.find(N=>N.options.queryFn);E&&this.setOptions(E.options)}const r=new AbortController,s=E=>{Object.defineProperty(E,"signal",{enumerable:!0,get:()=>(Fe(this,_d,!0),r.signal)})},i=()=>{const E=uM(this.options,t),T=(()=>{const z={client:de(this,hd),queryKey:this.queryKey,meta:this.meta};return s(z),z})();return Fe(this,_d,!1),this.options.persister?this.options.persister(E,T,this):E(T)},o=(()=>{const E={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:de(this,hd),state:this.state,fetchFn:i};return s(E),E})();(_=de(this,xh)==="infinite"?SG(this.options.pages):this.options.behavior)==null||_.onFetch(o,this),Fe(this,wh,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&Dt(this,Ha,Sl).call(this,{type:"fetch",meta:(p=o.fetchOptions)==null?void 0:p.meta});const l=Fe(this,hs,fM({initialPromise:t==null?void 0:t.initialPromise,fn:o.fetchFn,onCancel:E=>{E instanceof q1&&E.revert&&this.setState({...de(this,wh),fetchStatus:"idle"}),r.abort()},onFail:(E,N)=>{Dt(this,Ha,Sl).call(this,{type:"failed",failureCount:E,error:N})},onPause:()=>{Dt(this,Ha,Sl).call(this,{type:"pause"})},onContinue:()=>{Dt(this,Ha,Sl).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const E=await l.start();if(E===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(E),(x=(m=de(this,wa).config).onSuccess)==null||x.call(m,E,this),(v=(S=de(this,wa).config).onSettled)==null||v.call(S,E,this.state.error,this),E}catch(E){if(E instanceof q1){if(E.silent)return de(this,hs).promise;if(E.revert){if(this.state.data===void 0)throw E;return this.state.data}}throw Dt(this,Ha,Sl).call(this,{type:"error",error:E}),(w=(b=de(this,wa).config).onError)==null||w.call(b,E,this),(C=(y=de(this,wa).config).onSettled)==null||C.call(y,this.state.data,E,this),E}finally{de(this,hs)===l&&Fe(this,hs,void 0),this.scheduleGc()}}},xh=new WeakMap,fd=new WeakMap,wh=new WeakMap,wa=new WeakMap,hd=new WeakMap,hs=new WeakMap,Ap=new WeakMap,_d=new WeakMap,Ha=new WeakSet,Sl=function(n){const t=r=>{switch(n.type){case"failed":return{...r,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,..._M(r.data,this.options),fetchMeta:n.meta??null};case"success":const s={...r,...o9(n.data,n.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Fe(this,wh,n.manual?s:void 0),s;case"error":const i=n.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...n.state}}};this.state=t(this.state),Tr.batch(()=>{this.observers.slice().forEach(r=>{r.onQueryUpdate()}),de(this,wa).notify({query:this,type:"updated",action:n})})},JR);function _M(e,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:dM(n.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function o9(e,n){return{data:e,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function l9(e){const n=typeof e.initialData=="function"?e.initialData():e.initialData,t=n!==void 0,r=t?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:n,dataUpdateCount:0,dataUpdatedAt:t?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var ni,Sn,Rp,ri,pd,Sh,Nl,Mp,kh,Ch,md,gd,Xc,Eh,qn,S0,Zw,Jw,e4,t4,n4,r4,s4,i4,eM,L5=(eM=class extends Gd{constructor(n,t){super();rt(this,qn);rt(this,ni);rt(this,Sn);rt(this,Rp);rt(this,ri);rt(this,pd);rt(this,Sh);rt(this,Nl);rt(this,Mp);rt(this,kh);rt(this,Ch);rt(this,md);rt(this,gd);rt(this,Xc);rt(this,Eh,new Set);this.options=t,Fe(this,ni,n),Fe(this,Nl,null),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(de(this,Sn).addObserver(this),c9(de(this,Sn),this.options)?Dt(this,qn,S0).call(this):this.updateResult(),Dt(this,qn,n4).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return a4(de(this,Sn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return a4(de(this,Sn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Dt(this,qn,r4).call(this),Dt(this,qn,s4).call(this),de(this,Sn).removeObserver(this)}setOptions(n){const t=this.options,r=de(this,Sn);if(this.options=de(this,ni).defaultQueryOptions(n),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Br(this.options.enabled,de(this,Sn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Dt(this,qn,i4).call(this),de(this,Sn).setOptions(this.options),t._defaulted&&!A0(this.options,t)&&de(this,ni).getQueryCache().notify({type:"observerOptionsUpdated",query:de(this,Sn),observer:this});const s=this.hasListeners();s&&u9(de(this,Sn),r,this.options,t)&&Dt(this,qn,S0).call(this),this.updateResult(),s&&(de(this,Sn)!==r||Br(this.options.enabled,de(this,Sn))!==Br(t.enabled,de(this,Sn))||Br(this.options.staleTime,de(this,Sn))!==Br(t.staleTime,de(this,Sn)))&&Dt(this,qn,Jw).call(this);const i=Dt(this,qn,e4).call(this);s&&(de(this,Sn)!==r||Br(this.options.enabled,de(this,Sn))!==Br(t.enabled,de(this,Sn))||i!==de(this,Xc))&&Dt(this,qn,t4).call(this,i)}getOptimisticResult(n){const t=de(this,ni).getQueryCache().build(de(this,ni),n),r=this.createResult(t,n);return A0(this.getCurrentResult(),r)||(Fe(this,ri,r),Fe(this,Sh,this.options),Fe(this,pd,de(this,Sn).state)),r}getCurrentResult(){return de(this,ri)}trackResult(n,t){return new Proxy(n,{get:(r,s)=>(this.trackProp(s),t==null||t(s),Reflect.get(r,s))})}trackProp(n){de(this,Eh).add(n)}getCurrentQuery(){return de(this,Sn)}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const t=de(this,ni).defaultQueryOptions(n),r=de(this,ni).getQueryCache().build(de(this,ni),t);let s=()=>{},i;const a=new Promise(o=>{i=o,s=de(this,ni).getQueryCache().subscribe(l=>{l.type==="updated"&&l.query.queryHash===r.queryHash&&r.state.data!==void 0&&(s(),o(this.createResult(r,t)))})});return Promise.race([r.fetch().then(()=>{const o=this.createResult(r,t);return i==null||i(o),o}).finally(()=>{s()}),a])}fetch(n){return Dt(this,qn,S0).call(this,{...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),de(this,ri)))}createResult(n,t){var N;const r=de(this,Sn),s=this.options,i=de(this,ri),a=de(this,pd),o=de(this,Sh),l=n!==r?n.state:de(this,Rp),{state:u}=n;let _={...u},d=!1,p;if(t._optimisticResults){const T=this.hasListeners(),z=!T&&c9(n,t),M=T&&u9(n,r,t,s);(z||M)&&(_={..._,..._M(u.data,n.options)}),t._optimisticResults==="isRestoring"&&(_.fetchStatus="idle")}let{error:m,errorUpdatedAt:x,status:S}=_;p=_.data;let v=!1;if(t.placeholderData!==void 0&&p===void 0&&S==="pending"){let T;i!=null&&i.isPlaceholderData&&t.placeholderData===(o==null?void 0:o.placeholderData)?(T=i.data,v=!0):T=typeof t.placeholderData=="function"?t.placeholderData((N=de(this,Ch))==null?void 0:N.state.data,de(this,Ch)):t.placeholderData,T!==void 0&&(S="success",p=Xw(i==null?void 0:i.data,T,t),d=!0)}if(t.select&&p!==void 0&&!v)if(i&&p===(a==null?void 0:a.data)&&t.select===de(this,Mp))p=de(this,kh);else try{Fe(this,Mp,t.select),p=t.select(p),p=Xw(i==null?void 0:i.data,p,t),Fe(this,kh,p),Fe(this,Nl,null)}catch(T){Fe(this,Nl,T)}else p===void 0&&Fe(this,Nl,null);de(this,Nl)&&(m=de(this,Nl),p=de(this,kh),x=Date.now(),S="error",d=!1);const b=_.fetchStatus==="fetching",w=S==="pending",y=S==="error",C=w&&b,E=p!==void 0;return{status:S,fetchStatus:_.fetchStatus,isPending:w,isSuccess:S==="success",isError:y,isInitialLoading:C,isLoading:C,data:p,dataUpdatedAt:_.dataUpdatedAt,error:m,errorUpdatedAt:x,failureCount:_.fetchFailureCount,failureReason:_.fetchFailureReason,errorUpdateCount:_.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:_.dataUpdateCount>l.dataUpdateCount||_.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!w,isLoadingError:y&&!E,isPaused:_.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:y&&E,isStale:O5(n,t),refetch:this.refetch,isEnabled:Br(t.enabled,n)!==!1}}updateResult(){const n=de(this,ri),t=this.createResult(de(this,Sn),this.options);if(Fe(this,pd,de(this,Sn).state),Fe(this,Sh,this.options),de(this,pd).data!==void 0&&Fe(this,Ch,de(this,Sn)),A0(t,n))return;Fe(this,ri,t);const s=(()=>{if(!n)return!0;const{notifyOnChangeProps:i}=this.options,a=typeof i=="function"?i():i;if(a==="all"||!a&&!de(this,Eh).size)return!0;const o=new Set(a??de(this,Eh));return this.options.throwOnError&&o.add("error"),Object.keys(de(this,ri)).some(l=>{const u=l;return de(this,ri)[u]!==n[u]&&o.has(u)})})();Tr.batch(()=>{s&&this.listeners.forEach(i=>{i(de(this,ri))}),de(this,ni).getQueryCache().notify({query:de(this,Sn),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Dt(this,qn,n4).call(this)}},ni=new WeakMap,Sn=new WeakMap,Rp=new WeakMap,ri=new WeakMap,pd=new WeakMap,Sh=new WeakMap,Nl=new WeakMap,Mp=new WeakMap,kh=new WeakMap,Ch=new WeakMap,md=new WeakMap,gd=new WeakMap,Xc=new WeakMap,Eh=new WeakMap,qn=new WeakSet,S0=function(n){Dt(this,qn,i4).call(this);let t=de(this,Sn).fetch(this.options,n);return n!=null&&n.throwOnError||(t=t.catch(Ws)),t},Zw=function(n){return!M5()&&Br(this.options.enabled,de(this,Sn))!==!1&&lM(n)},Jw=function(){Dt(this,qn,r4).call(this);const n=Br(this.options.staleTime,de(this,Sn));if(de(this,ri).isStale||!Dt(this,qn,Zw).call(this,n))return;const t=cM(de(this,ri).dataUpdatedAt,n)+1;Fe(this,md,ad.setTimeout(()=>{de(this,ri).isStale||this.updateResult()},t))},e4=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(de(this,Sn)):this.options.refetchInterval)??!1},t4=function(n){Dt(this,qn,s4).call(this),Fe(this,Xc,n),!(de(this,Xc)===0||!Dt(this,qn,Zw).call(this,de(this,Xc)))&&Fe(this,gd,ad.setInterval(()=>{(this.options.refetchIntervalInBackground||D5.isFocused())&&Dt(this,qn,S0).call(this)},de(this,Xc)))},n4=function(){Dt(this,qn,Jw).call(this),Dt(this,qn,t4).call(this,Dt(this,qn,e4).call(this))},r4=function(){de(this,md)!==void 0&&(ad.clearTimeout(de(this,md)),Fe(this,md,void 0))},s4=function(){de(this,gd)!==void 0&&(ad.clearInterval(de(this,gd)),Fe(this,gd,void 0))},i4=function(){const n=de(this,ni).getQueryCache().build(de(this,ni),this.options);if(n===de(this,Sn))return;const t=de(this,Sn);Fe(this,Sn,n),Fe(this,Rp,n.state),this.hasListeners()&&(t==null||t.removeObserver(this),n.addObserver(this))},eM);function EG(e,n){return Br(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Br(n.retryOnMount,e)===!1)}function c9(e,n){return EG(e,n)||e.state.data!==void 0&&a4(e,n,n.refetchOnMount)}function a4(e,n,t){if(Br(n.enabled,e)!==!1&&Br(n.staleTime,e)!=="static"){const r=typeof t=="function"?t(e):t;return r==="always"||r!==!1&&O5(e,n)}return!1}function u9(e,n,t,r){return(e!==n||Br(r.enabled,e)===!1)&&(!t.suspense||e.state.status!=="error")&&O5(e,t)}function O5(e,n){return Br(n.enabled,e)!==!1&&e.isStaleByTime(Br(n.staleTime,e))}var Dp,Co,qs,vd,Eo,Uc,tM,NG=(tM=class extends hM{constructor(n){super();rt(this,Eo);rt(this,Dp);rt(this,Co);rt(this,qs);rt(this,vd);Fe(this,Dp,n.client),this.mutationId=n.mutationId,Fe(this,qs,n.mutationCache),Fe(this,Co,[]),this.state=n.state||pM(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){de(this,Co).includes(n)||(de(this,Co).push(n),this.clearGcTimeout(),de(this,qs).notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){Fe(this,Co,de(this,Co).filter(t=>t!==n)),this.scheduleGc(),de(this,qs).notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){de(this,Co).length||(this.state.status==="pending"?this.scheduleGc():de(this,qs).remove(this))}continue(){var n;return((n=de(this,vd))==null?void 0:n.continue())??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(n){var o,l,u,_,d,p,m,x,S,v,b,w,y,C,E,N,T,z;const t=()=>{Dt(this,Eo,Uc).call(this,{type:"continue"})},r={client:de(this,Dp),meta:this.options.meta,mutationKey:this.options.mutationKey},s=Fe(this,vd,fM({fn:()=>this.options.mutationFn?this.options.mutationFn(n,r):Promise.reject(new Error("No mutationFn found")),onFail:(M,O)=>{Dt(this,Eo,Uc).call(this,{type:"failed",failureCount:M,error:O})},onPause:()=>{Dt(this,Eo,Uc).call(this,{type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>de(this,qs).canRun(this)})),i=this.state.status==="pending",a=!s.canStart();try{if(i)t();else{Dt(this,Eo,Uc).call(this,{type:"pending",variables:n,isPaused:a}),de(this,qs).config.onMutate&&await de(this,qs).config.onMutate(n,this,r);const O=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,n,r));O!==this.state.context&&Dt(this,Eo,Uc).call(this,{type:"pending",context:O,variables:n,isPaused:a})}const M=await s.start();return await((_=(u=de(this,qs).config).onSuccess)==null?void 0:_.call(u,M,n,this.state.context,this,r)),await((p=(d=this.options).onSuccess)==null?void 0:p.call(d,M,n,this.state.context,r)),await((x=(m=de(this,qs).config).onSettled)==null?void 0:x.call(m,M,null,this.state.variables,this.state.context,this,r)),await((v=(S=this.options).onSettled)==null?void 0:v.call(S,M,null,n,this.state.context,r)),Dt(this,Eo,Uc).call(this,{type:"success",data:M}),M}catch(M){try{await((w=(b=de(this,qs).config).onError)==null?void 0:w.call(b,M,n,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((C=(y=this.options).onError)==null?void 0:C.call(y,M,n,this.state.context,r))}catch(O){Promise.reject(O)}try{await((N=(E=de(this,qs).config).onSettled)==null?void 0:N.call(E,void 0,M,this.state.variables,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((z=(T=this.options).onSettled)==null?void 0:z.call(T,void 0,M,n,this.state.context,r))}catch(O){Promise.reject(O)}throw Dt(this,Eo,Uc).call(this,{type:"error",error:M}),M}finally{de(this,vd)===s&&Fe(this,vd,void 0),de(this,qs).runNext(this)}}},Dp=new WeakMap,Co=new WeakMap,qs=new WeakMap,vd=new WeakMap,Eo=new WeakSet,Uc=function(n){const t=r=>{switch(n.type){case"failed":return{...r,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...r,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:n.error,failureCount:r.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Tr.batch(()=>{de(this,Co).forEach(r=>{r.onMutationUpdate(n)}),de(this,qs).notify({mutation:this,type:"updated",action:n})})},tM);function pM(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var zl,qa,Lp,nM,zG=(nM=class extends Gd{constructor(n={}){super();rt(this,zl);rt(this,qa);rt(this,Lp);this.config=n,Fe(this,zl,new Set),Fe(this,qa,new Map),Fe(this,Lp,0)}build(n,t,r){const s=new NG({client:n,mutationCache:this,mutationId:++r0(this,Lp)._,options:n.defaultMutationOptions(t),state:r});return this.add(s),s}add(n){de(this,zl).add(n);const t=yg(n);if(typeof t=="string"){const r=de(this,qa).get(t);r?r.push(n):de(this,qa).set(t,[n])}this.notify({type:"added",mutation:n})}remove(n){if(de(this,zl).delete(n)){const t=yg(n);if(typeof t=="string"){const r=de(this,qa).get(t);if(r)if(r.length>1){const s=r.indexOf(n);s!==-1&&r.splice(s,1)}else r[0]===n&&de(this,qa).delete(t)}}this.notify({type:"removed",mutation:n})}canRun(n){var r;const t=yg(n);if(typeof t=="string"){const s=(r=de(this,qa).get(t))==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===n}else return!0}runNext(n){var r,s;const t=yg(n);return typeof t=="string"?((s=(r=de(this,qa).get(t))==null?void 0:r.find(i=>i!==n&&i.state.isPaused))==null?void 0:s.continue())??Promise.resolve():Promise.resolve()}clear(){Tr.batch(()=>{de(this,zl).forEach(n=>{this.notify({type:"removed",mutation:n})}),de(this,zl).clear(),de(this,qa).clear()})}getAll(){return Array.from(de(this,zl))}find(n){const t={exact:!0,...n};return this.getAll().find(r=>r9(t,r))}findAll(n={}){return this.getAll().filter(t=>r9(n,t))}notify(n){Tr.batch(()=>{this.listeners.forEach(t=>{t(n)})})}resumePausedMutations(){const n=this.getAll().filter(t=>t.state.isPaused);return Tr.batch(()=>Promise.all(n.map(t=>t.continue().catch(Ws))))}},zl=new WeakMap,qa=new WeakMap,Lp=new WeakMap,nM);function yg(e){var n;return(n=e.options.scope)==null?void 0:n.id}var jl,Zc,Us,Tl,Ro,k0,o4,rM,jG=(rM=class extends Gd{constructor(t,r){super();rt(this,Ro);rt(this,jl);rt(this,Zc);rt(this,Us);rt(this,Tl);Fe(this,jl,t),this.setOptions(r),this.bindMethods(),Dt(this,Ro,k0).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var s;const r=this.options;this.options=de(this,jl).defaultMutationOptions(t),A0(this.options,r)||de(this,jl).getMutationCache().notify({type:"observerOptionsUpdated",mutation:de(this,Us),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Td(r.mutationKey)!==Td(this.options.mutationKey)?this.reset():((s=de(this,Us))==null?void 0:s.state.status)==="pending"&&de(this,Us).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&de(this,Us)&&(de(this,Us).addObserver(this),Dt(this,Ro,k0).call(this))}onUnsubscribe(){var t;this.hasListeners()||(t=de(this,Us))==null||t.removeObserver(this)}onMutationUpdate(t){Dt(this,Ro,k0).call(this),Dt(this,Ro,o4).call(this,t)}getCurrentResult(){return de(this,Zc)}reset(){var t;(t=de(this,Us))==null||t.removeObserver(this),Fe(this,Us,void 0),Dt(this,Ro,k0).call(this),Dt(this,Ro,o4).call(this)}mutate(t,r){var s;return Fe(this,Tl,r),(s=de(this,Us))==null||s.removeObserver(this),Fe(this,Us,de(this,jl).getMutationCache().build(de(this,jl),this.options)),de(this,Us).addObserver(this),de(this,Us).execute(t)}},jl=new WeakMap,Zc=new WeakMap,Us=new WeakMap,Tl=new WeakMap,Ro=new WeakSet,k0=function(){var r;const t=((r=de(this,Us))==null?void 0:r.state)??pM();Fe(this,Zc,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},o4=function(t){Tr.batch(()=>{var r,s,i,a,o,l,u,_;if(de(this,Tl)&&this.hasListeners()){const d=de(this,Zc).variables,p=de(this,Zc).context,m={client:de(this,jl),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(s=(r=de(this,Tl)).onSuccess)==null||s.call(r,t.data,d,p,m)}catch(x){Promise.reject(x)}try{(a=(i=de(this,Tl)).onSettled)==null||a.call(i,t.data,null,d,p,m)}catch(x){Promise.reject(x)}}else if((t==null?void 0:t.type)==="error"){try{(l=(o=de(this,Tl)).onError)==null||l.call(o,t.error,d,p,m)}catch(x){Promise.reject(x)}try{(_=(u=de(this,Tl)).onSettled)==null||_.call(u,void 0,t.error,d,p,m)}catch(x){Promise.reject(x)}}}this.listeners.forEach(d=>{d(de(this,Zc))})})},rM);function d9(e,n){const t=new Set(n);return e.filter(r=>!t.has(r))}var Nh,si,zh,bd,Pi,yd,Op,Ip,Bp,$p,ms,l4,c4,mM,u4,d4,f4,sM,TG=(sM=class extends Gd{constructor(n,t,r){super();rt(this,ms);rt(this,Nh);rt(this,si);rt(this,zh);rt(this,bd);rt(this,Pi);rt(this,yd);rt(this,Op);rt(this,Ip);rt(this,Bp);rt(this,$p,[]);Fe(this,Nh,n),Fe(this,bd,r),Fe(this,zh,[]),Fe(this,Pi,[]),Fe(this,si,[]),this.setQueries(t)}onSubscribe(){this.listeners.size===1&&de(this,Pi).forEach(n=>{n.subscribe(t=>{Dt(this,ms,d4).call(this,n,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,de(this,Pi).forEach(n=>{n.destroy()})}setQueries(n,t){Fe(this,zh,n),Fe(this,bd,t),Tr.batch(()=>{const r=de(this,Pi),s=Dt(this,ms,u4).call(this,de(this,zh));s.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const i=s.map(d=>d.observer),a=i.map(d=>d.getCurrentResult()),o=r.length!==i.length,l=i.some((d,p)=>d!==r[p]),u=o||l,_=u?!0:a.some((d,p)=>{const m=de(this,si)[p];return!m||!A0(d,m)});!u&&!_||(u&&(Fe(this,$p,s),Fe(this,Pi,i)),Fe(this,si,a),this.hasListeners()&&(u&&(d9(r,i).forEach(d=>{d.destroy()}),d9(i,r).forEach(d=>{d.subscribe(p=>{Dt(this,ms,d4).call(this,d,p)})})),Dt(this,ms,f4).call(this)))})}getCurrentResult(){return de(this,si)}getQueries(){return de(this,Pi).map(n=>n.getCurrentQuery())}getObservers(){return de(this,Pi)}getOptimisticResult(n,t){const r=Dt(this,ms,u4).call(this,n),s=r.map(a=>a.observer.getOptimisticResult(a.defaultedQueryOptions)),i=r.map(a=>a.defaultedQueryOptions.queryHash);return[s,a=>Dt(this,ms,c4).call(this,a??s,t,i),()=>Dt(this,ms,l4).call(this,s,r)]}},Nh=new WeakMap,si=new WeakMap,zh=new WeakMap,bd=new WeakMap,Pi=new WeakMap,yd=new WeakMap,Op=new WeakMap,Ip=new WeakMap,Bp=new WeakMap,$p=new WeakMap,ms=new WeakSet,l4=function(n,t){const r=new Set;return t.map((s,i)=>{const a=n[i];return s.defaultedQueryOptions.notifyOnChangeProps?a:s.observer.trackResult(a,o=>{r.has(o)||(r.add(o),t.forEach(l=>{l.observer.trackProp(o)}))})})},c4=function(n,t,r){if(t){const s=de(this,Bp),i=r!==void 0&&s!==void 0&&(s.length!==r.length||r.some((a,o)=>a!==s[o]));return(de(this,si)!==de(this,Ip)||i||t!==de(this,Op))&&(Fe(this,Op,t),Fe(this,Ip,de(this,si)),r!==void 0&&Fe(this,Bp,r),Fe(this,yd,T5(de(this,yd),t(n)))),de(this,yd)}return n},mM=function(){var n;return!((n=de(this,bd))!=null&&n.combine)||de(this,Pi).some((t,r)=>{var s;return t.options.suspense&&((s=de(this,si)[r])==null?void 0:s.data)===void 0})},u4=function(n){const t=new Map;de(this,Pi).forEach(s=>{const i=s.options.queryHash;if(!i)return;const a=t.get(i);a?a.push(s):t.set(i,[s])});const r=[];return n.forEach(s=>{var o;const i=de(this,Nh).defaultQueryOptions(s),a=((o=t.get(i.queryHash))==null?void 0:o.shift())??new L5(de(this,Nh),i);r.push({defaultedQueryOptions:i,observer:a})}),r},d4=function(n,t){const r=de(this,Pi).indexOf(n);r!==-1&&(Fe(this,si,de(this,si).slice()),de(this,si)[r]=t,Dt(this,ms,f4).call(this))},f4=function(){var n;if(this.hasListeners()){const t=Dt(this,ms,mM).call(this),r=de(this,yd),s=t?r:Dt(this,ms,c4).call(this,Dt(this,ms,l4).call(this,de(this,si),de(this,$p)),(n=de(this,bd))==null?void 0:n.combine);(t||r!==s)&&Tr.batch(()=>{this.listeners.forEach(i=>{i(de(this,si))})})}},sM),No,iM,AG=(iM=class extends Gd{constructor(n={}){super();rt(this,No);this.config=n,Fe(this,No,new Map)}build(n,t,r){const s=t.queryKey,i=t.queryHash??j5(s,t);let a=this.get(i);return a||(a=new CG({client:n,queryKey:s,queryHash:i,options:n.defaultQueryOptions(t),state:r,defaultOptions:n.getQueryDefaults(s)}),this.add(a)),a}add(n){de(this,No).has(n.queryHash)||(de(this,No).set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){const t=de(this,No).get(n.queryHash);t&&(n.destroy(),t===n&&de(this,No).delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){Tr.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return de(this,No).get(n)}getAll(){return[...de(this,No).values()]}find(n){const t={exact:!0,...n};return this.getAll().find(r=>n9(t,r))}findAll(n={}){const t=this.getAll();return Object.keys(n).length>0?t.filter(r=>n9(n,r)):t}notify(n){Tr.batch(()=>{this.listeners.forEach(t=>{t(n)})})}onFocus(){Tr.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){Tr.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},No=new WeakMap,iM),zr,Jc,eu,jh,Th,tu,Ah,Rh,aM,RG=(aM=class{constructor(e={}){rt(this,zr);rt(this,Jc);rt(this,eu);rt(this,jh);rt(this,Th);rt(this,tu);rt(this,Ah);rt(this,Rh);Fe(this,zr,e.queryCache||new AG),Fe(this,Jc,e.mutationCache||new zG),Fe(this,eu,e.defaultOptions||{}),Fe(this,jh,new Map),Fe(this,Th,new Map),Fe(this,tu,0)}mount(){r0(this,tu)._++,de(this,tu)===1&&(Fe(this,Ah,D5.subscribe(async e=>{e&&(await this.resumePausedMutations(),de(this,zr).onFocus())})),Fe(this,Rh,H1.subscribe(async e=>{e&&(await this.resumePausedMutations(),de(this,zr).onOnline())})))}unmount(){var e,n;r0(this,tu)._--,de(this,tu)===0&&((e=de(this,Ah))==null||e.call(this),Fe(this,Ah,void 0),(n=de(this,Rh))==null||n.call(this),Fe(this,Rh,void 0))}isFetching(e){return de(this,zr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return de(this,Jc).findAll({...e,status:"pending"}).length}getQueryData(e){var t;const n=this.defaultQueryOptions({queryKey:e});return(t=de(this,zr).get(n.queryHash))==null?void 0:t.state.data}ensureQueryData(e){const n=this.defaultQueryOptions(e),t=de(this,zr).build(this,n),r=t.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&t.isStaleByTime(Br(n.staleTime,t))&&this.prefetchQuery(n),Promise.resolve(r))}getQueriesData(e){return de(this,zr).findAll(e).map(({queryKey:n,state:t})=>[n,t.data])}setQueryData(e,n,t){var a;const r=this.defaultQueryOptions({queryKey:e}),s=(a=de(this,zr).get(r.queryHash))==null?void 0:a.state.data,i=uG(n,s);if(i!==void 0)return de(this,zr).build(this,r).setData(i,{...t,manual:!0})}setQueriesData(e,n,t){return Tr.batch(()=>de(this,zr).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,n,t)]))}getQueryState(e){var t;const n=this.defaultQueryOptions({queryKey:e});return(t=de(this,zr).get(n.queryHash))==null?void 0:t.state}removeQueries(e){const n=de(this,zr);Tr.batch(()=>{n.findAll(e).forEach(t=>{n.remove(t)})})}resetQueries(e,n){const t=de(this,zr);return Tr.batch(()=>{const r=t.findAll(e),s=new Set(r);return r.forEach(i=>{i.reset()}),this.refetchQueries({type:"active",predicate:i=>s.has(i)},n)})}cancelQueries(e,n={}){const t={revert:!0,...n},r=Tr.batch(()=>de(this,zr).findAll(e).map(s=>s.cancel(t)));return Promise.all(r).then(Ws).catch(Ws)}invalidateQueries(e,n={}){return Tr.batch(()=>(de(this,zr).findAll(e).forEach(t=>{t.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},n)))}refetchQueries(e,n={}){const t={...n,cancelRefetch:n.cancelRefetch??!0},r=Tr.batch(()=>de(this,zr).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,t);return t.throwOnError||(i=i.catch(Ws)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ws)}async query(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const t=de(this,zr).build(this,n),r=t.isStaleByTime(Br(n.staleTime,t))?await t.fetch(n):t.state.data,s=n.select;return s?s(r):r}fetchQuery(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const t=de(this,zr).build(this,n);return t.isStaleByTime(Br(n.staleTime,t))?t.fetch(n):Promise.resolve(t.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ws).catch(Ws)}infiniteQuery(e){return e._type="infinite",this.query(e)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ws).catch(Ws)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return H1.isOnline()?de(this,Jc).resumePausedMutations():Promise.resolve()}getQueryCache(){return de(this,zr)}getMutationCache(){return de(this,Jc)}getDefaultOptions(){return de(this,eu)}setDefaultOptions(e){Fe(this,eu,e)}setQueryDefaults(e,n){de(this,jh).set(Td(e),{queryKey:e,defaultOptions:n})}getQueryDefaults(e){const n=[...de(this,jh).values()],t={};return n.forEach(r=>{Oh(e,r.queryKey)&&Object.assign(t,r.defaultOptions)}),t}setMutationDefaults(e,n){de(this,Th).set(Td(e),{mutationKey:e,defaultOptions:n})}getMutationDefaults(e){const n=[...de(this,Th).values()],t={};return n.forEach(r=>{Oh(e,r.mutationKey)&&Object.assign(t,r.defaultOptions)}),t}defaultQueryOptions(e){if(e._defaulted)return e;const n={...de(this,eu).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return n.queryHash||(n.queryHash=j5(n.queryKey,n)),n.refetchOnReconnect===void 0&&(n.refetchOnReconnect=n.networkMode!=="always"),n.throwOnError===void 0&&(n.throwOnError=!!n.suspense),!n.networkMode&&n.persister&&(n.networkMode="offlineFirst"),n.queryFn===A5&&(n.enabled=!1),n}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...de(this,eu).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){de(this,zr).clear(),de(this,Jc).clear()}},zr=new WeakMap,Jc=new WeakMap,eu=new WeakMap,jh=new WeakMap,Th=new WeakMap,tu=new WeakMap,Ah=new WeakMap,Rh=new WeakMap,aM);const gM=R.createContext(!1),vM=()=>R.useContext(gM);gM.Provider;function MG(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const DG=R.createContext(MG()),bM=()=>R.useContext(DG),yM=(e,n,t)=>{const r=t!=null&&t.state.error&&typeof e.throwOnError=="function"?R5(e.throwOnError,[t.state.error,t]):e.throwOnError;(e.suspense||r)&&(n.isReset()||(e.retryOnMount=!1))},xM=e=>{R.useEffect(()=>{e.clearReset()},[e])},wM=({result:e,errorResetBoundary:n,throwOnError:t,query:r,suspense:s})=>e.isError&&!n.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||R5(t,[e.error,r])),SM=e=>{if(e.suspense){const t=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>t(r(...s)):t(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},h4=(e,n)=>(e==null?void 0:e.suspense)&&n.isPending,kM=(e,n,t)=>n.fetchOptimistic(e).catch(()=>{t.clearReset()});function LG({queries:e,...n},t){const r=i_(),s=vM(),i=bM(),a=n.subscribed!==!1,o=R.useMemo(()=>e.map(S=>{const v=r.defaultQueryOptions(S);return v._optimisticResults=s?"isRestoring":a?"optimistic":void 0,v}),[e,r,s,a]);o.forEach(S=>{SM(S);const v=r.getQueryCache().get(S.queryHash);yM(S,i,v)}),xM(i);const[l]=R.useState(()=>new TG(r,o,n)),[u,_,d]=l.getOptimisticResult(o,n.combine),p=!s&&a;R.useSyncExternalStore(R.useCallback(S=>p?l.subscribe(Tr.batchCalls(S)):Ws,[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),R.useEffect(()=>{l.setQueries(o,n)},[o,n,l]);const m=u.some((S,v)=>h4(o[v],S))?u.flatMap((S,v)=>{const b=o[v];if(b&&h4(b,S)){const w=new L5(r,b);return kM(b,w,i)}return[]}):[];if(m.length>0)throw Promise.all(m);const x=u.find((S,v)=>{const b=o[v];return b&&wM({result:S,errorResetBoundary:i,throwOnError:b.throwOnError,query:r.getQueryCache().get(b.queryHash),suspense:b.suspense})});if(x)throw x.error;return _(d())}function OG(e,n,t){const r=vM(),s=bM(),i=i_(),a=i.defaultQueryOptions(e),o=i.getQueryCache().get(a.queryHash),l=e.subscribed!==!1;a._optimisticResults=r?"isRestoring":l?"optimistic":void 0,SM(a),yM(a,s,o),xM(s);const[u]=R.useState(()=>new n(i,a)),_=u.getOptimisticResult(a),d=!r&&l;if(R.useSyncExternalStore(R.useCallback(p=>{const m=d?u.subscribe(Tr.batchCalls(p)):Ws;return u.updateResult(),m},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),R.useEffect(()=>{u.setOptions(a)},[a,u]),h4(a,_))throw kM(a,u,s);if(wM({result:_,errorResetBoundary:s,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw _.error;return a.notifyOnChangeProps?_:u.trackResult(_)}function ct(e,n){return OG(e,L5)}function IG(e,n){const t=i_(),r=t.getQueryCache();return R.useSyncExternalStore(R.useCallback(s=>r.subscribe(Tr.batchCalls(s)),[r]),()=>t.isFetching(e),()=>t.isFetching(e))}function gn(e,n){const t=i_(),[r]=R.useState(()=>new jG(t,e));R.useEffect(()=>{r.setOptions(e)},[r,e]);const s=R.useSyncExternalStore(R.useCallback(a=>r.subscribe(Tr.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=R.useCallback((...a)=>{r.mutate(a[0],a[1]).catch(Ws)},[r]);if(s.error&&R5(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}const nt=new RG({defaultOptions:{queries:{staleTime:3e4,gcTime:6e5,retry:!1,networkMode:"always",refetchOnReconnect:!0},mutations:{retry:!1,networkMode:"always"}}}),uu=new Set;let f9=null,Uv=0;const _4=new Set,BG=()=>Uv,h9=e=>(_4.add(e),()=>{_4.delete(e)}),za=()=>["workspace",Uv],Nt=(e,...n)=>[...za(),e,...n];function $G(e,n=!1){if(f9===e&&!n)return!1;const t=za();return f9=e,Uv++,uu.clear(),I5({queryKey:t}),_4.forEach(r=>r()),!0}const Pn=e=>e[1]===Uv;async function I5(e){await nt.cancelQueries(e,{revert:!1}),nt.removeQueries(e)}function Gr(e,n){if(Pn(e))return nt.setQueryData(e,n)}var sx={exports:{}},i0={},ix={exports:{}},ax={};/** + */var e9;function sG(){if(e9)return Jt;e9=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),a=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),p=Symbol.iterator;function m(F){return F===null||typeof F!="object"?null:(F=p&&F[p]||F["@@iterator"],typeof F=="function"?F:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,v={};function b(F,q,G){this.props=F,this.context=q,this.refs=v,this.updater=G||x}b.prototype.isReactComponent={},b.prototype.setState=function(F,q){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,q,"setState")},b.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function w(){}w.prototype=b.prototype;function y(F,q,G){this.props=F,this.context=q,this.refs=v,this.updater=G||x}var C=y.prototype=new w;C.constructor=y,S(C,b.prototype),C.isPureReactComponent=!0;var E=Array.isArray;function N(){}var T={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function M(F,q,G){var re=G.ref;return{$$typeof:e,type:F,key:q,ref:re!==void 0?re:null,props:G}}function I(F,q){return M(F.type,q,F.props)}function B(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function $(F){var q={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(G){return q[G]})}var U=/\/+/g;function H(F,q){return typeof F=="object"&&F!==null&&F.key!=null?$(""+F.key):q.toString(36)}function Y(F){switch(F.status){case"fulfilled":return F.value;case"rejected":throw F.reason;default:switch(typeof F.status=="string"?F.then(N,N):(F.status="pending",F.then(function(q){F.status==="pending"&&(F.status="fulfilled",F.value=q)},function(q){F.status==="pending"&&(F.status="rejected",F.reason=q)})),F.status){case"fulfilled":return F.value;case"rejected":throw F.reason}}throw F}function V(F,q,G,re,ce){var oe=typeof F;(oe==="undefined"||oe==="boolean")&&(F=null);var te=!1;if(F===null)te=!0;else switch(oe){case"bigint":case"string":case"number":te=!0;break;case"object":switch(F.$$typeof){case e:case n:te=!0;break;case _:return te=F._init,V(te(F._payload),q,G,re,ce)}}if(te)return ce=ce(F),te=re===""?"."+H(F,0):re,E(ce)?(G="",te!=null&&(G=te.replace(U,"$&/")+"/"),V(ce,q,G,"",function(ae){return ae})):ce!=null&&(B(ce)&&(ce=I(ce,G+(ce.key==null||F&&F.key===ce.key?"":(""+ce.key).replace(U,"$&/")+"/")+te)),q.push(ce)),1;te=0;var Q=re===""?".":re+":";if(E(F))for(var le=0;le{const n=R.useContext(oM);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},iG=({client:e,children:n})=>(R.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),f.jsx(oM.Provider,{value:e,children:n})),aG={setTimeout:(e,n)=>setTimeout(e,n),clearTimeout:e=>clearTimeout(e),setInterval:(e,n)=>setInterval(e,n),clearInterval:e=>clearInterval(e)};var $c,z5,QR,oG=(QR=class{constructor(){nt(this,$c,aG);nt(this,z5,!1)}setTimeoutProvider(e){He(this,$c,e)}setTimeout(e,n){return ue(this,$c).setTimeout(e,n)}clearTimeout(e){ue(this,$c).clearTimeout(e)}setInterval(e,n){return ue(this,$c).setInterval(e,n)}clearInterval(e){ue(this,$c).clearInterval(e)}},$c=new WeakMap,z5=new WeakMap,QR);const nd=new oG;function lG(e){setTimeout(e,0)}const cG=typeof window>"u"||"Deno"in globalThis;function Os(){}function uG(e,n){return typeof e=="function"?e(n):e}function lM(e){return typeof e=="number"&&e>=0&&e!==1/0}function cM(e,n){return Math.max(e+(n||0)-Date.now(),0)}function Br(e,n){return typeof e=="function"?e(n):e}function n9(e,n){const{type:t="all",exact:r,fetchStatus:s,predicate:i,queryKey:a,stale:o}=e;if(a){if(r){if(n.queryHash!==j5(a,n.options))return!1}else if(!Rh(n.queryKey,a))return!1}if(t!=="all"){const l=n.isActive();if(t==="active"&&!l||t==="inactive"&&l)return!1}return!(typeof o=="boolean"&&n.isStale()!==o||s&&s!==n.state.fetchStatus||i&&!i(n))}function r9(e,n){const{exact:t,status:r,predicate:s,mutationKey:i}=e;if(i){if(!n.options.mutationKey)return!1;if(t){if(Ed(n.options.mutationKey)!==Ed(i))return!1}else if(!Rh(n.options.mutationKey,i))return!1}return!(r&&n.state.status!==r||s&&!s(n))}function j5(e,n){return((n==null?void 0:n.queryKeyHashFn)||Ed)(e)}function Ed(e){return JSON.stringify(e,(n,t)=>Yw(t)?Object.keys(t).sort().reduce((r,s)=>(r[s]=t[s],r),{}):t)}function Rh(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(Array.isArray(e)&&Array.isArray(n)){for(let r=0;r500)return n;const r=s9(e)&&s9(n);if(!r&&!(Yw(e)&&Yw(n)))return n;const s=(r?e:Object.keys(e)).length,i=r?n:Object.keys(n),a=i.length,o=r?new Array(a):{};let l=0;for(let u=0;u{nd.setTimeout(n,e)})}function Xw(e,n,t){return typeof t.structuralSharing=="function"?t.structuralSharing(e,n):t.structuralSharing!==!1?T5(e,n):n}function hG(e,n,t=0){const r=[...e,n];return t&&r.length>t?r.slice(1):r}function _G(e,n,t=0){const r=[n,...e];return t&&r.length>t?r.slice(0,-1):r}const A5=Symbol();function uM(e,n){return!e.queryFn&&(n!=null&&n.initialPromise)?()=>n.initialPromise:!e.queryFn||e.queryFn===A5?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function R5(e,n){return typeof e=="function"?e(...n):!!e}function pG(e,n,t){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=n()),r||(r=!0,s.aborted?t():s.addEventListener("abort",t,{once:!0})),s)}),e}let mG=()=>cG;const M5=()=>mG();var Fd=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ad,Pc,_h,YR,gG=(YR=class extends Fd{constructor(){super();nt(this,ad);nt(this,Pc);nt(this,_h);He(this,_h,n=>{if(typeof window<"u"&&window.addEventListener){const t=()=>n();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){ue(this,Pc)||this.setEventListener(ue(this,_h))}onUnsubscribe(){var n;this.hasListeners()||((n=ue(this,Pc))==null||n.call(this),He(this,Pc,void 0))}setEventListener(n){var t;He(this,_h,n),(t=ue(this,Pc))==null||t.call(this),He(this,Pc,n(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(n){ue(this,ad)!==n&&(He(this,ad,n),this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(t=>{t(n)})}isFocused(){var n;return typeof ue(this,ad)=="boolean"?ue(this,ad):((n=globalThis.document)==null?void 0:n.visibilityState)!=="hidden"}},ad=new WeakMap,Pc=new WeakMap,_h=new WeakMap,YR);const D5=new gG,vG=lG;function bG(){let e=[],n=0,t=o=>{o()},r=o=>{o()},s=vG;const i=o=>{n?e.push(o):s(()=>{t(o)})},a=()=>{const o=e;e=[],o.length&&s(()=>{r(()=>{o.forEach(l=>{t(l)})})})};return{batch:o=>{let l;n++;try{l=o()}finally{n--,n||a()}return l},batchCalls:o=>(...l)=>{i(()=>{o(...l)})},schedule:i,setNotifyFunction:o=>{t=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{s=o}}}const Ar=bG();var ph,Fc,mh,XR,yG=(XR=class extends Fd{constructor(){super();nt(this,ph,!0);nt(this,Fc);nt(this,mh);He(this,mh,n=>{if(typeof window<"u"&&window.addEventListener){const t=()=>n(!0),r=()=>n(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}})}onSubscribe(){ue(this,Fc)||this.setEventListener(ue(this,mh))}onUnsubscribe(){var n;this.hasListeners()||((n=ue(this,Fc))==null||n.call(this),He(this,Fc,void 0))}setEventListener(n){var t;He(this,mh,n),(t=ue(this,Fc))==null||t.call(this),He(this,Fc,n(this.setOnline.bind(this)))}setOnline(n){ue(this,ph)!==n&&(He(this,ph,n),this.listeners.forEach(t=>{t(n)}))}isOnline(){return ue(this,ph)}},ph=new WeakMap,Fc=new WeakMap,mh=new WeakMap,XR);const H1=new yG;function xG(e){return Math.min(1e3*2**e,3e4)}function dM(e){return(e??"online")==="online"?H1.isOnline():!0}var q1=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function wG(e){return e instanceof q1}function fM(e){let n=!1,t=0,r,s="pending",i,a;const o=new Promise((w,y)=>{i=w,a=y});o.catch(Os);const l=()=>s!=="pending",u=w=>{var y;if(!l()){const C=new q1(w);S(C),(y=e.onCancel)==null||y.call(e,C)}},_=()=>{n=!0},d=()=>{n=!1},p=()=>D5.isFocused()&&(e.networkMode==="always"||H1.isOnline())&&e.canRun(),m=()=>dM(e.networkMode)&&e.canRun(),x=w=>{l()||(r==null||r(),s="resolved",i(w))},S=w=>{l()||(r==null||r(),s="rejected",a(w))},v=()=>new Promise(w=>{var y;r=C=>{(l()||p())&&w(C)},(y=e.onPause)==null||y.call(e)}).then(()=>{var w;r=void 0,l()||(w=e.onContinue)==null||w.call(e)}),b=()=>{if(l())return;let w;const y=t===0?e.initialPromise:void 0;try{w=y??e.fn()}catch(C){w=Promise.reject(C)}Promise.resolve(w).then(x).catch(C=>{var M;if(l())return;const E=e.retry??(M5()?0:3),N=e.retryDelay??xG,T=typeof N=="function"?N(t,C):N,z=E===!0||typeof E=="number"&&tp()?void 0:v()).then(()=>{n?S(C):b()})})};return{promise:o,status:()=>s,cancel:u,continue:()=>(r==null||r(),o),cancelRetry:_,continueRetry:d,canStart:m,start:()=>(m()?b():v().then(b),o)}}var od,ZR,hM=(ZR=class{constructor(){nt(this,od)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),lM(this.gcTime)&&He(this,od,nd.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(M5()?1/0:3e5))}clearGcTimeout(){ue(this,od)!==void 0&&(nd.clearTimeout(ue(this,od)),He(this,od,void 0))}},od=new WeakMap,ZR);function SG(e){return{onFetch:(n,t)=>{var _,d,p,m,x;const r=n.options,s=(p=(d=(_=n.fetchOptions)==null?void 0:_.meta)==null?void 0:d.fetchMore)==null?void 0:p.direction,i=((m=n.state.data)==null?void 0:m.pages)||[],a=((x=n.state.data)==null?void 0:x.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const u=async()=>{let S=!1;const v=y=>{pG(y,()=>n.signal,()=>S=!0)},b=uM(n.options,n.fetchOptions),w=async(y,C,E)=>{if(S)return Promise.reject(n.signal.reason);if(C==null&&y.pages.length)return Promise.resolve(y);const T=(()=>{const B={client:n.client,queryKey:n.queryKey,pageParam:C,direction:E?"backward":"forward",meta:n.options.meta};return v(B),B})(),z=await b(T),{maxPages:M}=n.options,I=E?_G:hG;return{pages:I(y.pages,z,M),pageParams:I(y.pageParams,C,M)}};if(s&&i.length){const y=s==="backward",C=y?kG:a9,E={pages:i,pageParams:a};o=await w(E,C(r,E),y)}else{const y=e??i.length;do{const C=l===0?a[0]??r.initialPageParam:a9(r,o);if(l>0&&C==null)break;o=await w(o,C),l++}while(l{var S,v;return(v=(S=n.options).persister)==null?void 0:v.call(S,u,{client:n.client,queryKey:n.queryKey,meta:n.options.meta,signal:n.signal},t)}:n.fetchFn=u}}}function a9(e,{pages:n,pageParams:t}){const r=n.length-1;return n.length>0?e.getNextPageParam(n[r],n,t[r],t):void 0}function kG(e,{pages:n,pageParams:t}){var r;return n.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,n[0],n,t[0],t):void 0}var gh,ld,vh,ga,cd,hs,Ap,ud,Pa,xl,JR,CG=(JR=class extends hM{constructor(n){super();nt(this,Pa);nt(this,gh);nt(this,ld);nt(this,vh);nt(this,ga);nt(this,cd);nt(this,hs);nt(this,Ap);nt(this,ud);He(this,ud,!1),He(this,Ap,n.defaultOptions),this.setOptions(n.options),this.observers=[],He(this,cd,n.client),He(this,ga,ue(this,cd).getQueryCache()),this.queryKey=n.queryKey,this.queryHash=n.queryHash,He(this,ld,l9(this.options)),this.state=n.state??ue(this,ld),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return ue(this,gh)}get promise(){var n;return(n=ue(this,hs))==null?void 0:n.promise}setOptions(n){if(this.options={...ue(this,Ap),...n},n!=null&&n._type&&He(this,gh,n._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=l9(this.options);t.data!==void 0&&(this.setState(o9(t.data,t.dataUpdatedAt)),He(this,ld,t))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ue(this,ga).remove(this)}setData(n,t){const r=Xw(this.state.data,n,this.options);return Dt(this,Pa,xl).call(this,{data:r,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),r}setState(n){Dt(this,Pa,xl).call(this,{type:"setState",state:n})}cancel(n){var r,s;const t=(r=ue(this,hs))==null?void 0:r.promise;return(s=ue(this,hs))==null||s.cancel(n),t?t.then(Os).catch(Os):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return ue(this,ld)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(n=>Br(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===A5||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(n=>Br(n.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(n=0){return this.state.data===void 0?!0:n==="static"?!1:this.state.isInvalidated?!0:!cM(this.state.dataUpdatedAt,n)}onFocus(){var n,t;(n=this.observers.find(r=>r.shouldFetchOnWindowFocus()))==null||n.refetch({cancelRefetch:!1}),(t=ue(this,hs))==null||t.continue()}onOnline(){var n,t;(n=this.observers.find(r=>r.shouldFetchOnReconnect()))==null||n.refetch({cancelRefetch:!1}),(t=ue(this,hs))==null||t.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),ue(this,ga).notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){const t=this.observers.indexOf(n);t!==-1&&(this.observers.splice(t,1),this.observers.length||(ue(this,hs)&&(ue(this,ud)||this.state.fetchStatus==="paused"&&this.state.status==="pending"?ue(this,hs).cancel({revert:!0}):ue(this,hs).cancelRetry()),this.scheduleGc()),ue(this,ga).notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Dt(this,Pa,xl).call(this,{type:"invalidate"})}async fetch(n,t){var u,_,d,p,m,x,S,v,b,w,y,C;if(this.state.fetchStatus!=="idle"&&((u=ue(this,hs))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(ue(this,hs))return ue(this,hs).continueRetry(),ue(this,hs).promise}if(n&&this.setOptions(n),!this.options.queryFn){const E=this.observers.find(N=>N.options.queryFn);E&&this.setOptions(E.options)}const r=new AbortController,s=E=>{Object.defineProperty(E,"signal",{enumerable:!0,get:()=>(He(this,ud,!0),r.signal)})},i=()=>{const E=uM(this.options,t),T=(()=>{const z={client:ue(this,cd),queryKey:this.queryKey,meta:this.meta};return s(z),z})();return He(this,ud,!1),this.options.persister?this.options.persister(E,T,this):E(T)},o=(()=>{const E={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:ue(this,cd),state:this.state,fetchFn:i};return s(E),E})();(_=ue(this,gh)==="infinite"?SG(this.options.pages):this.options.behavior)==null||_.onFetch(o,this),He(this,vh,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&Dt(this,Pa,xl).call(this,{type:"fetch",meta:(p=o.fetchOptions)==null?void 0:p.meta});const l=He(this,hs,fM({initialPromise:t==null?void 0:t.initialPromise,fn:o.fetchFn,onCancel:E=>{E instanceof q1&&E.revert&&this.setState({...ue(this,vh),fetchStatus:"idle"}),r.abort()},onFail:(E,N)=>{Dt(this,Pa,xl).call(this,{type:"failed",failureCount:E,error:N})},onPause:()=>{Dt(this,Pa,xl).call(this,{type:"pause"})},onContinue:()=>{Dt(this,Pa,xl).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const E=await l.start();if(E===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(E),(x=(m=ue(this,ga).config).onSuccess)==null||x.call(m,E,this),(v=(S=ue(this,ga).config).onSettled)==null||v.call(S,E,this.state.error,this),E}catch(E){if(E instanceof q1){if(E.silent)return ue(this,hs).promise;if(E.revert){if(this.state.data===void 0)throw E;return this.state.data}}throw Dt(this,Pa,xl).call(this,{type:"error",error:E}),(w=(b=ue(this,ga).config).onError)==null||w.call(b,E,this),(C=(y=ue(this,ga).config).onSettled)==null||C.call(y,this.state.data,E,this),E}finally{ue(this,hs)===l&&He(this,hs,void 0),this.scheduleGc()}}},gh=new WeakMap,ld=new WeakMap,vh=new WeakMap,ga=new WeakMap,cd=new WeakMap,hs=new WeakMap,Ap=new WeakMap,ud=new WeakMap,Pa=new WeakSet,xl=function(n){const t=r=>{switch(n.type){case"failed":return{...r,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,..._M(r.data,this.options),fetchMeta:n.meta??null};case"success":const s={...r,...o9(n.data,n.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return He(this,vh,n.manual?s:void 0),s;case"error":const i=n.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...n.state}}};this.state=t(this.state),Ar.batch(()=>{this.observers.slice().forEach(r=>{r.onQueryUpdate()}),ue(this,ga).notify({query:this,type:"updated",action:n})})},JR);function _M(e,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:dM(n.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function o9(e,n){return{data:e,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function l9(e){const n=typeof e.initialData=="function"?e.initialData():e.initialData,t=n!==void 0,r=t?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:n,dataUpdateCount:0,dataUpdatedAt:t?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var Ks,Cn,Rp,Qs,dd,bh,Cl,Mp,yh,xh,fd,hd,Hc,wh,In,S0,Zw,Jw,e4,t4,n4,r4,s4,i4,eM,L5=(eM=class extends Fd{constructor(n,t){super();nt(this,In);nt(this,Ks);nt(this,Cn);nt(this,Rp);nt(this,Qs);nt(this,dd);nt(this,bh);nt(this,Cl);nt(this,Mp);nt(this,yh);nt(this,xh);nt(this,fd);nt(this,hd);nt(this,Hc);nt(this,wh,new Set);this.options=t,He(this,Ks,n),He(this,Cl,null),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ue(this,Cn).addObserver(this),c9(ue(this,Cn),this.options)?Dt(this,In,S0).call(this):this.updateResult(),Dt(this,In,n4).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return a4(ue(this,Cn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return a4(ue(this,Cn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Dt(this,In,r4).call(this),Dt(this,In,s4).call(this),ue(this,Cn).removeObserver(this)}setOptions(n){const t=this.options,r=ue(this,Cn);if(this.options=ue(this,Ks).defaultQueryOptions(n),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Br(this.options.enabled,ue(this,Cn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Dt(this,In,i4).call(this),ue(this,Cn).setOptions(this.options),t._defaulted&&!A0(this.options,t)&&ue(this,Ks).getQueryCache().notify({type:"observerOptionsUpdated",query:ue(this,Cn),observer:this});const s=this.hasListeners();s&&u9(ue(this,Cn),r,this.options,t)&&Dt(this,In,S0).call(this),this.updateResult(),s&&(ue(this,Cn)!==r||Br(this.options.enabled,ue(this,Cn))!==Br(t.enabled,ue(this,Cn))||Br(this.options.staleTime,ue(this,Cn))!==Br(t.staleTime,ue(this,Cn)))&&Dt(this,In,Jw).call(this);const i=Dt(this,In,e4).call(this);s&&(ue(this,Cn)!==r||Br(this.options.enabled,ue(this,Cn))!==Br(t.enabled,ue(this,Cn))||i!==ue(this,Hc))&&Dt(this,In,t4).call(this,i)}getOptimisticResult(n){const t=ue(this,Ks).getQueryCache().build(ue(this,Ks),n),r=this.createResult(t,n);return A0(this.getCurrentResult(),r)||(He(this,Qs,r),He(this,bh,this.options),He(this,dd,ue(this,Cn).state)),r}getCurrentResult(){return ue(this,Qs)}trackResult(n,t){return new Proxy(n,{get:(r,s)=>(this.trackProp(s),t==null||t(s),Reflect.get(r,s))})}trackProp(n){ue(this,wh).add(n)}getCurrentQuery(){return ue(this,Cn)}refetch({...n}={}){return this.fetch({...n})}fetchOptimistic(n){const t=ue(this,Ks).defaultQueryOptions(n),r=ue(this,Ks).getQueryCache().build(ue(this,Ks),t);let s=()=>{},i;const a=new Promise(o=>{i=o,s=ue(this,Ks).getQueryCache().subscribe(l=>{l.type==="updated"&&l.query.queryHash===r.queryHash&&r.state.data!==void 0&&(s(),o(this.createResult(r,t)))})});return Promise.race([r.fetch().then(()=>{const o=this.createResult(r,t);return i==null||i(o),o}).finally(()=>{s()}),a])}fetch(n){return Dt(this,In,S0).call(this,{...n,cancelRefetch:n.cancelRefetch??!0}).then(()=>(this.updateResult(),ue(this,Qs)))}createResult(n,t){var N;const r=ue(this,Cn),s=this.options,i=ue(this,Qs),a=ue(this,dd),o=ue(this,bh),l=n!==r?n.state:ue(this,Rp),{state:u}=n;let _={...u},d=!1,p;if(t._optimisticResults){const T=this.hasListeners(),z=!T&&c9(n,t),M=T&&u9(n,r,t,s);(z||M)&&(_={..._,..._M(u.data,n.options)}),t._optimisticResults==="isRestoring"&&(_.fetchStatus="idle")}let{error:m,errorUpdatedAt:x,status:S}=_;p=_.data;let v=!1;if(t.placeholderData!==void 0&&p===void 0&&S==="pending"){let T;i!=null&&i.isPlaceholderData&&t.placeholderData===(o==null?void 0:o.placeholderData)?(T=i.data,v=!0):T=typeof t.placeholderData=="function"?t.placeholderData((N=ue(this,xh))==null?void 0:N.state.data,ue(this,xh)):t.placeholderData,T!==void 0&&(S="success",p=Xw(i==null?void 0:i.data,T,t),d=!0)}if(t.select&&p!==void 0&&!v)if(i&&p===(a==null?void 0:a.data)&&t.select===ue(this,Mp))p=ue(this,yh);else try{He(this,Mp,t.select),p=t.select(p),p=Xw(i==null?void 0:i.data,p,t),He(this,yh,p),He(this,Cl,null)}catch(T){He(this,Cl,T)}else p===void 0&&He(this,Cl,null);ue(this,Cl)&&(m=ue(this,Cl),p=ue(this,yh),x=Date.now(),S="error",d=!1);const b=_.fetchStatus==="fetching",w=S==="pending",y=S==="error",C=w&&b,E=p!==void 0;return{status:S,fetchStatus:_.fetchStatus,isPending:w,isSuccess:S==="success",isError:y,isInitialLoading:C,isLoading:C,data:p,dataUpdatedAt:_.dataUpdatedAt,error:m,errorUpdatedAt:x,failureCount:_.fetchFailureCount,failureReason:_.fetchFailureReason,errorUpdateCount:_.errorUpdateCount,isFetched:n.isFetched(),isFetchedAfterMount:_.dataUpdateCount>l.dataUpdateCount||_.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!w,isLoadingError:y&&!E,isPaused:_.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:y&&E,isStale:O5(n,t),refetch:this.refetch,isEnabled:Br(t.enabled,n)!==!1}}updateResult(){const n=ue(this,Qs),t=this.createResult(ue(this,Cn),this.options);if(He(this,dd,ue(this,Cn).state),He(this,bh,this.options),ue(this,dd).data!==void 0&&He(this,xh,ue(this,Cn)),A0(t,n))return;He(this,Qs,t);const s=(()=>{if(!n)return!0;const{notifyOnChangeProps:i}=this.options,a=typeof i=="function"?i():i;if(a==="all"||!a&&!ue(this,wh).size)return!0;const o=new Set(a??ue(this,wh));return this.options.throwOnError&&o.add("error"),Object.keys(ue(this,Qs)).some(l=>{const u=l;return ue(this,Qs)[u]!==n[u]&&o.has(u)})})();Ar.batch(()=>{s&&this.listeners.forEach(i=>{i(ue(this,Qs))}),ue(this,Ks).getQueryCache().notify({query:ue(this,Cn),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Dt(this,In,n4).call(this)}},Ks=new WeakMap,Cn=new WeakMap,Rp=new WeakMap,Qs=new WeakMap,dd=new WeakMap,bh=new WeakMap,Cl=new WeakMap,Mp=new WeakMap,yh=new WeakMap,xh=new WeakMap,fd=new WeakMap,hd=new WeakMap,Hc=new WeakMap,wh=new WeakMap,In=new WeakSet,S0=function(n){Dt(this,In,i4).call(this);let t=ue(this,Cn).fetch(this.options,n);return n!=null&&n.throwOnError||(t=t.catch(Os)),t},Zw=function(n){return!M5()&&Br(this.options.enabled,ue(this,Cn))!==!1&&lM(n)},Jw=function(){Dt(this,In,r4).call(this);const n=Br(this.options.staleTime,ue(this,Cn));if(ue(this,Qs).isStale||!Dt(this,In,Zw).call(this,n))return;const t=cM(ue(this,Qs).dataUpdatedAt,n)+1;He(this,fd,nd.setTimeout(()=>{ue(this,Qs).isStale||this.updateResult()},t))},e4=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ue(this,Cn)):this.options.refetchInterval)??!1},t4=function(n){Dt(this,In,s4).call(this),He(this,Hc,n),!(ue(this,Hc)===0||!Dt(this,In,Zw).call(this,ue(this,Hc)))&&He(this,hd,nd.setInterval(()=>{(this.options.refetchIntervalInBackground||D5.isFocused())&&Dt(this,In,S0).call(this)},ue(this,Hc)))},n4=function(){Dt(this,In,Jw).call(this),Dt(this,In,t4).call(this,Dt(this,In,e4).call(this))},r4=function(){ue(this,fd)!==void 0&&(nd.clearTimeout(ue(this,fd)),He(this,fd,void 0))},s4=function(){ue(this,hd)!==void 0&&(nd.clearInterval(ue(this,hd)),He(this,hd,void 0))},i4=function(){const n=ue(this,Ks).getQueryCache().build(ue(this,Ks),this.options);if(n===ue(this,Cn))return;const t=ue(this,Cn);He(this,Cn,n),He(this,Rp,n.state),this.hasListeners()&&(t==null||t.removeObserver(this),n.addObserver(this))},eM);function EG(e,n){return Br(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Br(n.retryOnMount,e)===!1)}function c9(e,n){return EG(e,n)||e.state.data!==void 0&&a4(e,n,n.refetchOnMount)}function a4(e,n,t){if(Br(n.enabled,e)!==!1&&Br(n.staleTime,e)!=="static"){const r=typeof t=="function"?t(e):t;return r==="always"||r!==!1&&O5(e,n)}return!1}function u9(e,n,t,r){return(e!==n||Br(r.enabled,e)===!1)&&(!t.suspense||e.state.status!=="error")&&O5(e,t)}function O5(e,n){return Br(n.enabled,e)!==!1&&e.isStaleByTime(Br(n.staleTime,e))}var Dp,Co,Ms,_d,Eo,Lc,tM,NG=(tM=class extends hM{constructor(n){super();nt(this,Eo);nt(this,Dp);nt(this,Co);nt(this,Ms);nt(this,_d);He(this,Dp,n.client),this.mutationId=n.mutationId,He(this,Ms,n.mutationCache),He(this,Co,[]),this.state=n.state||pM(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){ue(this,Co).includes(n)||(ue(this,Co).push(n),this.clearGcTimeout(),ue(this,Ms).notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){He(this,Co,ue(this,Co).filter(t=>t!==n)),this.scheduleGc(),ue(this,Ms).notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){ue(this,Co).length||(this.state.status==="pending"?this.scheduleGc():ue(this,Ms).remove(this))}continue(){var n;return((n=ue(this,_d))==null?void 0:n.continue())??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(n){var o,l,u,_,d,p,m,x,S,v,b,w,y,C,E,N,T,z;const t=()=>{Dt(this,Eo,Lc).call(this,{type:"continue"})},r={client:ue(this,Dp),meta:this.options.meta,mutationKey:this.options.mutationKey},s=He(this,_d,fM({fn:()=>this.options.mutationFn?this.options.mutationFn(n,r):Promise.reject(new Error("No mutationFn found")),onFail:(M,I)=>{Dt(this,Eo,Lc).call(this,{type:"failed",failureCount:M,error:I})},onPause:()=>{Dt(this,Eo,Lc).call(this,{type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ue(this,Ms).canRun(this)})),i=this.state.status==="pending",a=!s.canStart();try{if(i)t();else{Dt(this,Eo,Lc).call(this,{type:"pending",variables:n,isPaused:a}),ue(this,Ms).config.onMutate&&await ue(this,Ms).config.onMutate(n,this,r);const I=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,n,r));I!==this.state.context&&Dt(this,Eo,Lc).call(this,{type:"pending",context:I,variables:n,isPaused:a})}const M=await s.start();return await((_=(u=ue(this,Ms).config).onSuccess)==null?void 0:_.call(u,M,n,this.state.context,this,r)),await((p=(d=this.options).onSuccess)==null?void 0:p.call(d,M,n,this.state.context,r)),await((x=(m=ue(this,Ms).config).onSettled)==null?void 0:x.call(m,M,null,this.state.variables,this.state.context,this,r)),await((v=(S=this.options).onSettled)==null?void 0:v.call(S,M,null,n,this.state.context,r)),Dt(this,Eo,Lc).call(this,{type:"success",data:M}),M}catch(M){try{await((w=(b=ue(this,Ms).config).onError)==null?void 0:w.call(b,M,n,this.state.context,this,r))}catch(I){Promise.reject(I)}try{await((C=(y=this.options).onError)==null?void 0:C.call(y,M,n,this.state.context,r))}catch(I){Promise.reject(I)}try{await((N=(E=ue(this,Ms).config).onSettled)==null?void 0:N.call(E,void 0,M,this.state.variables,this.state.context,this,r))}catch(I){Promise.reject(I)}try{await((z=(T=this.options).onSettled)==null?void 0:z.call(T,void 0,M,n,this.state.context,r))}catch(I){Promise.reject(I)}throw Dt(this,Eo,Lc).call(this,{type:"error",error:M}),M}finally{ue(this,_d)===s&&He(this,_d,void 0),ue(this,Ms).runNext(this)}}},Dp=new WeakMap,Co=new WeakMap,Ms=new WeakMap,_d=new WeakMap,Eo=new WeakSet,Lc=function(n){const t=r=>{switch(n.type){case"failed":return{...r,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...r,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:n.error,failureCount:r.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Ar.batch(()=>{ue(this,Co).forEach(r=>{r.onMutationUpdate(n)}),ue(this,Ms).notify({mutation:this,type:"updated",action:n})})},tM);function pM(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var El,Fa,Lp,nM,zG=(nM=class extends Fd{constructor(n={}){super();nt(this,El);nt(this,Fa);nt(this,Lp);this.config=n,He(this,El,new Set),He(this,Fa,new Map),He(this,Lp,0)}build(n,t,r){const s=new NG({client:n,mutationCache:this,mutationId:++r0(this,Lp)._,options:n.defaultMutationOptions(t),state:r});return this.add(s),s}add(n){ue(this,El).add(n);const t=yg(n);if(typeof t=="string"){const r=ue(this,Fa).get(t);r?r.push(n):ue(this,Fa).set(t,[n])}this.notify({type:"added",mutation:n})}remove(n){if(ue(this,El).delete(n)){const t=yg(n);if(typeof t=="string"){const r=ue(this,Fa).get(t);if(r)if(r.length>1){const s=r.indexOf(n);s!==-1&&r.splice(s,1)}else r[0]===n&&ue(this,Fa).delete(t)}}this.notify({type:"removed",mutation:n})}canRun(n){var r;const t=yg(n);if(typeof t=="string"){const s=(r=ue(this,Fa).get(t))==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===n}else return!0}runNext(n){var r,s;const t=yg(n);return typeof t=="string"?((s=(r=ue(this,Fa).get(t))==null?void 0:r.find(i=>i!==n&&i.state.isPaused))==null?void 0:s.continue())??Promise.resolve():Promise.resolve()}clear(){Ar.batch(()=>{ue(this,El).forEach(n=>{this.notify({type:"removed",mutation:n})}),ue(this,El).clear(),ue(this,Fa).clear()})}getAll(){return Array.from(ue(this,El))}find(n){const t={exact:!0,...n};return this.getAll().find(r=>r9(t,r))}findAll(n={}){return this.getAll().filter(t=>r9(n,t))}notify(n){Ar.batch(()=>{this.listeners.forEach(t=>{t(n)})})}resumePausedMutations(){const n=this.getAll().filter(t=>t.state.isPaused);return Ar.batch(()=>Promise.all(n.map(t=>t.continue().catch(Os))))}},El=new WeakMap,Fa=new WeakMap,Lp=new WeakMap,nM);function yg(e){var n;return(n=e.options.scope)==null?void 0:n.id}var Nl,qc,Ds,zl,Ro,k0,o4,rM,jG=(rM=class extends Fd{constructor(t,r){super();nt(this,Ro);nt(this,Nl);nt(this,qc);nt(this,Ds);nt(this,zl);He(this,Nl,t),this.setOptions(r),this.bindMethods(),Dt(this,Ro,k0).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var s;const r=this.options;this.options=ue(this,Nl).defaultMutationOptions(t),A0(this.options,r)||ue(this,Nl).getMutationCache().notify({type:"observerOptionsUpdated",mutation:ue(this,Ds),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Ed(r.mutationKey)!==Ed(this.options.mutationKey)?this.reset():((s=ue(this,Ds))==null?void 0:s.state.status)==="pending"&&ue(this,Ds).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&ue(this,Ds)&&(ue(this,Ds).addObserver(this),Dt(this,Ro,k0).call(this))}onUnsubscribe(){var t;this.hasListeners()||(t=ue(this,Ds))==null||t.removeObserver(this)}onMutationUpdate(t){Dt(this,Ro,k0).call(this),Dt(this,Ro,o4).call(this,t)}getCurrentResult(){return ue(this,qc)}reset(){var t;(t=ue(this,Ds))==null||t.removeObserver(this),He(this,Ds,void 0),Dt(this,Ro,k0).call(this),Dt(this,Ro,o4).call(this)}mutate(t,r){var s;return He(this,zl,r),(s=ue(this,Ds))==null||s.removeObserver(this),He(this,Ds,ue(this,Nl).getMutationCache().build(ue(this,Nl),this.options)),ue(this,Ds).addObserver(this),ue(this,Ds).execute(t)}},Nl=new WeakMap,qc=new WeakMap,Ds=new WeakMap,zl=new WeakMap,Ro=new WeakSet,k0=function(){var r;const t=((r=ue(this,Ds))==null?void 0:r.state)??pM();He(this,qc,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},o4=function(t){Ar.batch(()=>{var r,s,i,a,o,l,u,_;if(ue(this,zl)&&this.hasListeners()){const d=ue(this,qc).variables,p=ue(this,qc).context,m={client:ue(this,Nl),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(s=(r=ue(this,zl)).onSuccess)==null||s.call(r,t.data,d,p,m)}catch(x){Promise.reject(x)}try{(a=(i=ue(this,zl)).onSettled)==null||a.call(i,t.data,null,d,p,m)}catch(x){Promise.reject(x)}}else if((t==null?void 0:t.type)==="error"){try{(l=(o=ue(this,zl)).onError)==null||l.call(o,t.error,d,p,m)}catch(x){Promise.reject(x)}try{(_=(u=ue(this,zl)).onSettled)==null||_.call(u,void 0,t.error,d,p,m)}catch(x){Promise.reject(x)}}}this.listeners.forEach(d=>{d(ue(this,qc))})})},rM);function d9(e,n){const t=new Set(n);return e.filter(r=>!t.has(r))}var Sh,Ys,kh,pd,Ii,md,Op,Ip,Bp,$p,ms,l4,c4,mM,u4,d4,f4,sM,TG=(sM=class extends Fd{constructor(n,t,r){super();nt(this,ms);nt(this,Sh);nt(this,Ys);nt(this,kh);nt(this,pd);nt(this,Ii);nt(this,md);nt(this,Op);nt(this,Ip);nt(this,Bp);nt(this,$p,[]);He(this,Sh,n),He(this,pd,r),He(this,kh,[]),He(this,Ii,[]),He(this,Ys,[]),this.setQueries(t)}onSubscribe(){this.listeners.size===1&&ue(this,Ii).forEach(n=>{n.subscribe(t=>{Dt(this,ms,d4).call(this,n,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,ue(this,Ii).forEach(n=>{n.destroy()})}setQueries(n,t){He(this,kh,n),He(this,pd,t),Ar.batch(()=>{const r=ue(this,Ii),s=Dt(this,ms,u4).call(this,ue(this,kh));s.forEach(d=>d.observer.setOptions(d.defaultedQueryOptions));const i=s.map(d=>d.observer),a=i.map(d=>d.getCurrentResult()),o=r.length!==i.length,l=i.some((d,p)=>d!==r[p]),u=o||l,_=u?!0:a.some((d,p)=>{const m=ue(this,Ys)[p];return!m||!A0(d,m)});!u&&!_||(u&&(He(this,$p,s),He(this,Ii,i)),He(this,Ys,a),this.hasListeners()&&(u&&(d9(r,i).forEach(d=>{d.destroy()}),d9(i,r).forEach(d=>{d.subscribe(p=>{Dt(this,ms,d4).call(this,d,p)})})),Dt(this,ms,f4).call(this)))})}getCurrentResult(){return ue(this,Ys)}getQueries(){return ue(this,Ii).map(n=>n.getCurrentQuery())}getObservers(){return ue(this,Ii)}getOptimisticResult(n,t){const r=Dt(this,ms,u4).call(this,n),s=r.map(a=>a.observer.getOptimisticResult(a.defaultedQueryOptions)),i=r.map(a=>a.defaultedQueryOptions.queryHash);return[s,a=>Dt(this,ms,c4).call(this,a??s,t,i),()=>Dt(this,ms,l4).call(this,s,r)]}},Sh=new WeakMap,Ys=new WeakMap,kh=new WeakMap,pd=new WeakMap,Ii=new WeakMap,md=new WeakMap,Op=new WeakMap,Ip=new WeakMap,Bp=new WeakMap,$p=new WeakMap,ms=new WeakSet,l4=function(n,t){const r=new Set;return t.map((s,i)=>{const a=n[i];return s.defaultedQueryOptions.notifyOnChangeProps?a:s.observer.trackResult(a,o=>{r.has(o)||(r.add(o),t.forEach(l=>{l.observer.trackProp(o)}))})})},c4=function(n,t,r){if(t){const s=ue(this,Bp),i=r!==void 0&&s!==void 0&&(s.length!==r.length||r.some((a,o)=>a!==s[o]));return(ue(this,Ys)!==ue(this,Ip)||i||t!==ue(this,Op))&&(He(this,Op,t),He(this,Ip,ue(this,Ys)),r!==void 0&&He(this,Bp,r),He(this,md,T5(ue(this,md),t(n)))),ue(this,md)}return n},mM=function(){var n;return!((n=ue(this,pd))!=null&&n.combine)||ue(this,Ii).some((t,r)=>{var s;return t.options.suspense&&((s=ue(this,Ys)[r])==null?void 0:s.data)===void 0})},u4=function(n){const t=new Map;ue(this,Ii).forEach(s=>{const i=s.options.queryHash;if(!i)return;const a=t.get(i);a?a.push(s):t.set(i,[s])});const r=[];return n.forEach(s=>{var o;const i=ue(this,Sh).defaultQueryOptions(s),a=((o=t.get(i.queryHash))==null?void 0:o.shift())??new L5(ue(this,Sh),i);r.push({defaultedQueryOptions:i,observer:a})}),r},d4=function(n,t){const r=ue(this,Ii).indexOf(n);r!==-1&&(He(this,Ys,ue(this,Ys).slice()),ue(this,Ys)[r]=t,Dt(this,ms,f4).call(this))},f4=function(){var n;if(this.hasListeners()){const t=Dt(this,ms,mM).call(this),r=ue(this,md),s=t?r:Dt(this,ms,c4).call(this,Dt(this,ms,l4).call(this,ue(this,Ys),ue(this,$p)),(n=ue(this,pd))==null?void 0:n.combine);(t||r!==s)&&Ar.batch(()=>{this.listeners.forEach(i=>{i(ue(this,Ys))})})}},sM),No,iM,AG=(iM=class extends Fd{constructor(n={}){super();nt(this,No);this.config=n,He(this,No,new Map)}build(n,t,r){const s=t.queryKey,i=t.queryHash??j5(s,t);let a=this.get(i);return a||(a=new CG({client:n,queryKey:s,queryHash:i,options:n.defaultQueryOptions(t),state:r,defaultOptions:n.getQueryDefaults(s)}),this.add(a)),a}add(n){ue(this,No).has(n.queryHash)||(ue(this,No).set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){const t=ue(this,No).get(n.queryHash);t&&(n.destroy(),t===n&&ue(this,No).delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){Ar.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return ue(this,No).get(n)}getAll(){return[...ue(this,No).values()]}find(n){const t={exact:!0,...n};return this.getAll().find(r=>n9(t,r))}findAll(n={}){const t=this.getAll();return Object.keys(n).length>0?t.filter(r=>n9(n,r)):t}notify(n){Ar.batch(()=>{this.listeners.forEach(t=>{t(n)})})}onFocus(){Ar.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){Ar.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},No=new WeakMap,iM),jr,Uc,Gc,Ch,Eh,Wc,Nh,zh,aM,RG=(aM=class{constructor(e={}){nt(this,jr);nt(this,Uc);nt(this,Gc);nt(this,Ch);nt(this,Eh);nt(this,Wc);nt(this,Nh);nt(this,zh);He(this,jr,e.queryCache||new AG),He(this,Uc,e.mutationCache||new zG),He(this,Gc,e.defaultOptions||{}),He(this,Ch,new Map),He(this,Eh,new Map),He(this,Wc,0)}mount(){r0(this,Wc)._++,ue(this,Wc)===1&&(He(this,Nh,D5.subscribe(async e=>{e&&(await this.resumePausedMutations(),ue(this,jr).onFocus())})),He(this,zh,H1.subscribe(async e=>{e&&(await this.resumePausedMutations(),ue(this,jr).onOnline())})))}unmount(){var e,n;r0(this,Wc)._--,ue(this,Wc)===0&&((e=ue(this,Nh))==null||e.call(this),He(this,Nh,void 0),(n=ue(this,zh))==null||n.call(this),He(this,zh,void 0))}isFetching(e){return ue(this,jr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return ue(this,Uc).findAll({...e,status:"pending"}).length}getQueryData(e){var t;const n=this.defaultQueryOptions({queryKey:e});return(t=ue(this,jr).get(n.queryHash))==null?void 0:t.state.data}ensureQueryData(e){const n=this.defaultQueryOptions(e),t=ue(this,jr).build(this,n),r=t.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&t.isStaleByTime(Br(n.staleTime,t))&&this.prefetchQuery(n),Promise.resolve(r))}getQueriesData(e){return ue(this,jr).findAll(e).map(({queryKey:n,state:t})=>[n,t.data])}setQueryData(e,n,t){var a;const r=this.defaultQueryOptions({queryKey:e}),s=(a=ue(this,jr).get(r.queryHash))==null?void 0:a.state.data,i=uG(n,s);if(i!==void 0)return ue(this,jr).build(this,r).setData(i,{...t,manual:!0})}setQueriesData(e,n,t){return Ar.batch(()=>ue(this,jr).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,n,t)]))}getQueryState(e){var t;const n=this.defaultQueryOptions({queryKey:e});return(t=ue(this,jr).get(n.queryHash))==null?void 0:t.state}removeQueries(e){const n=ue(this,jr);Ar.batch(()=>{n.findAll(e).forEach(t=>{n.remove(t)})})}resetQueries(e,n){const t=ue(this,jr);return Ar.batch(()=>{const r=t.findAll(e),s=new Set(r);return r.forEach(i=>{i.reset()}),this.refetchQueries({type:"active",predicate:i=>s.has(i)},n)})}cancelQueries(e,n={}){const t={revert:!0,...n},r=Ar.batch(()=>ue(this,jr).findAll(e).map(s=>s.cancel(t)));return Promise.all(r).then(Os).catch(Os)}invalidateQueries(e,n={}){return Ar.batch(()=>(ue(this,jr).findAll(e).forEach(t=>{t.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},n)))}refetchQueries(e,n={}){const t={...n,cancelRefetch:n.cancelRefetch??!0},r=Ar.batch(()=>ue(this,jr).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,t);return t.throwOnError||(i=i.catch(Os)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Os)}async query(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const t=ue(this,jr).build(this,n),r=t.isStaleByTime(Br(n.staleTime,t))?await t.fetch(n):t.state.data,s=n.select;return s?s(r):r}fetchQuery(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const t=ue(this,jr).build(this,n);return t.isStaleByTime(Br(n.staleTime,t))?t.fetch(n):Promise.resolve(t.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Os).catch(Os)}infiniteQuery(e){return e._type="infinite",this.query(e)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Os).catch(Os)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return H1.isOnline()?ue(this,Uc).resumePausedMutations():Promise.resolve()}getQueryCache(){return ue(this,jr)}getMutationCache(){return ue(this,Uc)}getDefaultOptions(){return ue(this,Gc)}setDefaultOptions(e){He(this,Gc,e)}setQueryDefaults(e,n){ue(this,Ch).set(Ed(e),{queryKey:e,defaultOptions:n})}getQueryDefaults(e){const n=[...ue(this,Ch).values()],t={};return n.forEach(r=>{Rh(e,r.queryKey)&&Object.assign(t,r.defaultOptions)}),t}setMutationDefaults(e,n){ue(this,Eh).set(Ed(e),{mutationKey:e,defaultOptions:n})}getMutationDefaults(e){const n=[...ue(this,Eh).values()],t={};return n.forEach(r=>{Rh(e,r.mutationKey)&&Object.assign(t,r.defaultOptions)}),t}defaultQueryOptions(e){if(e._defaulted)return e;const n={...ue(this,Gc).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return n.queryHash||(n.queryHash=j5(n.queryKey,n)),n.refetchOnReconnect===void 0&&(n.refetchOnReconnect=n.networkMode!=="always"),n.throwOnError===void 0&&(n.throwOnError=!!n.suspense),!n.networkMode&&n.persister&&(n.networkMode="offlineFirst"),n.queryFn===A5&&(n.enabled=!1),n}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...ue(this,Gc).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){ue(this,jr).clear(),ue(this,Uc).clear()}},jr=new WeakMap,Uc=new WeakMap,Gc=new WeakMap,Ch=new WeakMap,Eh=new WeakMap,Wc=new WeakMap,Nh=new WeakMap,zh=new WeakMap,aM);const gM=R.createContext(!1),vM=()=>R.useContext(gM);gM.Provider;function MG(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const DG=R.createContext(MG()),bM=()=>R.useContext(DG),yM=(e,n,t)=>{const r=t!=null&&t.state.error&&typeof e.throwOnError=="function"?R5(e.throwOnError,[t.state.error,t]):e.throwOnError;(e.suspense||r)&&(n.isReset()||(e.retryOnMount=!1))},xM=e=>{R.useEffect(()=>{e.clearReset()},[e])},wM=({result:e,errorResetBoundary:n,throwOnError:t,query:r,suspense:s})=>e.isError&&!n.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||R5(t,[e.error,r])),SM=e=>{if(e.suspense){const t=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>t(r(...s)):t(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},h4=(e,n)=>(e==null?void 0:e.suspense)&&n.isPending,kM=(e,n,t)=>n.fetchOptimistic(e).catch(()=>{t.clearReset()});function LG({queries:e,...n},t){const r=t_(),s=vM(),i=bM(),a=n.subscribed!==!1,o=R.useMemo(()=>e.map(S=>{const v=r.defaultQueryOptions(S);return v._optimisticResults=s?"isRestoring":a?"optimistic":void 0,v}),[e,r,s,a]);o.forEach(S=>{SM(S);const v=r.getQueryCache().get(S.queryHash);yM(S,i,v)}),xM(i);const[l]=R.useState(()=>new TG(r,o,n)),[u,_,d]=l.getOptimisticResult(o,n.combine),p=!s&&a;R.useSyncExternalStore(R.useCallback(S=>p?l.subscribe(Ar.batchCalls(S)):Os,[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),R.useEffect(()=>{l.setQueries(o,n)},[o,n,l]);const m=u.some((S,v)=>h4(o[v],S))?u.flatMap((S,v)=>{const b=o[v];if(b&&h4(b,S)){const w=new L5(r,b);return kM(b,w,i)}return[]}):[];if(m.length>0)throw Promise.all(m);const x=u.find((S,v)=>{const b=o[v];return b&&wM({result:S,errorResetBoundary:i,throwOnError:b.throwOnError,query:r.getQueryCache().get(b.queryHash),suspense:b.suspense})});if(x)throw x.error;return _(d())}function OG(e,n,t){const r=vM(),s=bM(),i=t_(),a=i.defaultQueryOptions(e),o=i.getQueryCache().get(a.queryHash),l=e.subscribed!==!1;a._optimisticResults=r?"isRestoring":l?"optimistic":void 0,SM(a),yM(a,s,o),xM(s);const[u]=R.useState(()=>new n(i,a)),_=u.getOptimisticResult(a),d=!r&&l;if(R.useSyncExternalStore(R.useCallback(p=>{const m=d?u.subscribe(Ar.batchCalls(p)):Os;return u.updateResult(),m},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),R.useEffect(()=>{u.setOptions(a)},[a,u]),h4(a,_))throw kM(a,u,s);if(wM({result:_,errorResetBoundary:s,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw _.error;return a.notifyOnChangeProps?_:u.trackResult(_)}function ot(e,n){return OG(e,L5)}function IG(e,n){const t=t_(),r=t.getQueryCache();return R.useSyncExternalStore(R.useCallback(s=>r.subscribe(Ar.batchCalls(s)),[r]),()=>t.isFetching(e),()=>t.isFetching(e))}function mn(e,n){const t=t_(),[r]=R.useState(()=>new jG(t,e));R.useEffect(()=>{r.setOptions(e)},[r,e]);const s=R.useSyncExternalStore(R.useCallback(a=>r.subscribe(Ar.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=R.useCallback((...a)=>{r.mutate(a[0],a[1]).catch(Os)},[r]);if(s.error&&R5(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}const tt=new RG({defaultOptions:{queries:{staleTime:3e4,gcTime:6e5,retry:!1,networkMode:"always",refetchOnReconnect:!0},mutations:{retry:!1,networkMode:"always"}}}),tu=new Set;let f9=null,qv=0;const _4=new Set,BG=()=>qv,h9=e=>(_4.add(e),()=>{_4.delete(e)}),Sa=()=>["workspace",qv],Nt=(e,...n)=>[...Sa(),e,...n];function $G(e,n=!1){if(f9===e&&!n)return!1;const t=Sa();return f9=e,qv++,tu.clear(),I5({queryKey:t}),_4.forEach(r=>r()),!0}const Dn=e=>e[1]===qv;async function I5(e){await tt.cancelQueries(e,{revert:!1}),tt.removeQueries(e)}function Gr(e,n){if(Dn(e))return tt.setQueryData(e,n)}var sx={exports:{}},i0={},ix={exports:{}},ax={};/** * @license React * scheduler.production.js * @@ -22,7 +22,7 @@ var eG=Object.defineProperty;var XC=e=>{throw TypeError(e)};var tG=(e,n,t)=>n in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var _9;function PG(){return _9||(_9=1,(function(e){function n(V,X){var te=V.length;V.push(X);e:for(;0>>1,L=V[I];if(0>>1;Is(G,te))ees(ce,G)?(V[I]=ce,V[ee]=te,I=ee):(V[I]=G,V[q]=te,I=q);else if(ees(ce,te))V[I]=ce,V[ee]=te,I=ee;else break e}}return X}function s(V,X){var te=V.sortIndex-X.sortIndex;return te!==0?te:V.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var l=[],u=[],_=1,d=null,p=3,m=!1,x=!1,S=!1,v=!1,b=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;function C(V){for(var X=t(u);X!==null;){if(X.callback===null)r(u);else if(X.startTime<=V)r(u),X.sortIndex=X.expirationTime,n(l,X);else break;X=t(u)}}function E(V){if(S=!1,C(V),!x)if(t(l)!==null)x=!0,N||(N=!0,$());else{var X=t(u);X!==null&&Y(E,X.startTime-V)}}var N=!1,T=-1,z=5,M=-1;function O(){return v?!0:!(e.unstable_now()-MV&&O());){var I=d.callback;if(typeof I=="function"){d.callback=null,p=d.priorityLevel;var L=I(d.expirationTime<=V);if(V=e.unstable_now(),typeof L=="function"){d.callback=L,C(V),X=!0;break t}d===t(l)&&r(l),C(V)}else r(l);d=t(l)}if(d!==null)X=!0;else{var F=t(u);F!==null&&Y(E,F.startTime-V),X=!1}}break e}finally{d=null,p=te,m=!1}X=void 0}}finally{X?$():N=!1}}}var $;if(typeof y=="function")$=function(){y(B)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,H=U.port2;U.port1.onmessage=B,$=function(){H.postMessage(null)}}else $=function(){b(B,0)};function Y(V,X){T=b(function(){V(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125I?(V.sortIndex=te,n(u,V),t(l)===null&&V===t(u)&&(S?(w(T),T=-1):S=!0,Y(E,te-I))):(V.sortIndex=L,n(l,V),x||m||(x=!0,N||(N=!0,$()))),V},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(V){var X=p;return function(){var te=p;p=X;try{return V.apply(this,arguments)}finally{p=te}}}})(ax)),ax}var p9;function FG(){return p9||(p9=1,ix.exports=PG()),ix.exports}var ox={exports:{}},Hs={};/** + */var _9;function PG(){return _9||(_9=1,(function(e){function n(V,X){var ee=V.length;V.push(X);e:for(;0>>1,L=V[O];if(0>>1;Os(G,ee))res(ce,G)?(V[O]=ce,V[re]=ee,O=re):(V[O]=G,V[q]=ee,O=q);else if(res(ce,ee))V[O]=ce,V[re]=ee,O=re;else break e}}return X}function s(V,X){var ee=V.sortIndex-X.sortIndex;return ee!==0?ee:V.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var l=[],u=[],_=1,d=null,p=3,m=!1,x=!1,S=!1,v=!1,b=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;function C(V){for(var X=t(u);X!==null;){if(X.callback===null)r(u);else if(X.startTime<=V)r(u),X.sortIndex=X.expirationTime,n(l,X);else break;X=t(u)}}function E(V){if(S=!1,C(V),!x)if(t(l)!==null)x=!0,N||(N=!0,$());else{var X=t(u);X!==null&&Y(E,X.startTime-V)}}var N=!1,T=-1,z=5,M=-1;function I(){return v?!0:!(e.unstable_now()-MV&&I());){var O=d.callback;if(typeof O=="function"){d.callback=null,p=d.priorityLevel;var L=O(d.expirationTime<=V);if(V=e.unstable_now(),typeof L=="function"){d.callback=L,C(V),X=!0;break t}d===t(l)&&r(l),C(V)}else r(l);d=t(l)}if(d!==null)X=!0;else{var F=t(u);F!==null&&Y(E,F.startTime-V),X=!1}}break e}finally{d=null,p=ee,m=!1}X=void 0}}finally{X?$():N=!1}}}var $;if(typeof y=="function")$=function(){y(B)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,H=U.port2;U.port1.onmessage=B,$=function(){H.postMessage(null)}}else $=function(){b(B,0)};function Y(V,X){T=b(function(){V(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125O?(V.sortIndex=ee,n(u,V),t(l)===null&&V===t(u)&&(S?(w(T),T=-1):S=!0,Y(E,ee-O))):(V.sortIndex=L,n(l,V),x||m||(x=!0,N||(N=!0,$()))),V},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(V){var X=p;return function(){var ee=p;p=X;try{return V.apply(this,arguments)}finally{p=ee}}}})(ax)),ax}var p9;function FG(){return p9||(p9=1,ix.exports=PG()),ix.exports}var ox={exports:{}},Rs={};/** * @license React * react-dom.production.js * @@ -30,7 +30,7 @@ var eG=Object.defineProperty;var XC=e=>{throw TypeError(e)};var tG=(e,n,t)=>n in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var m9;function HG(){if(m9)return Hs;m9=1;var e=Wp();function n(l){var u="https://react.dev/errors/"+l;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),ox.exports=HG(),ox.exports}/** + */var m9;function HG(){if(m9)return Rs;m9=1;var e=Wp();function n(l){var u="https://react.dev/errors/"+l;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),ox.exports=HG(),ox.exports}/** * @license React * react-dom-client.production.js * @@ -38,15 +38,15 @@ var eG=Object.defineProperty;var XC=e=>{throw TypeError(e)};var tG=(e,n,t)=>n in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var v9;function qG(){if(v9)return i0;v9=1;var e=FG(),n=Wp(),t=CM();function r(c){var h="https://react.dev/errors/"+c;if(1L||(c.current=I[L],I[L]=null,L--)}function G(c,h){L++,I[L]=c.current,c.current=h}var ee=F(null),ce=F(null),oe=F(null),ne=F(null);function Q(c,h){switch(G(oe,h),G(ce,c),G(ee,null),h.nodeType){case 9:case 11:c=(c=h.documentElement)&&(c=c.namespaceURI)?yC(c):0;break;default:if(c=h.tagName,h=h.namespaceURI)h=yC(h),c=xC(h,c);else switch(c){case"svg":c=1;break;case"math":c=2;break;default:c=0}}q(ee),G(ee,c)}function le(){q(ee),q(ce),q(oe)}function ae(c){c.memoizedState!==null&&G(ne,c);var h=ee.current,g=xC(h,c.type);h!==g&&(G(ce,c),G(ee,g))}function ue(c){ce.current===c&&(q(ee),q(ce)),ne.current===c&&(q(ne),J_._currentValue=te)}var pe,Se;function ye(c){if(pe===void 0)try{throw Error()}catch(g){var h=g.stack.trim().match(/\n( *(at )?)/);pe=h&&h[1]||"",Se=-1L||(c.current=O[L],O[L]=null,L--)}function G(c,h){L++,O[L]=c.current,c.current=h}var re=F(null),ce=F(null),oe=F(null),te=F(null);function Q(c,h){switch(G(oe,h),G(ce,c),G(re,null),h.nodeType){case 9:case 11:c=(c=h.documentElement)&&(c=c.namespaceURI)?yC(c):0;break;default:if(c=h.tagName,h=h.namespaceURI)h=yC(h),c=xC(h,c);else switch(c){case"svg":c=1;break;case"math":c=2;break;default:c=0}}q(re),G(re,c)}function le(){q(re),q(ce),q(oe)}function ae(c){c.memoizedState!==null&&G(te,c);var h=re.current,g=xC(h,c.type);h!==g&&(G(ce,c),G(re,g))}function de(c){ce.current===c&&(q(re),q(ce)),te.current===c&&(q(te),J_._currentValue=ee)}var pe,we;function be(c){if(pe===void 0)try{throw Error()}catch(g){var h=g.stack.trim().match(/\n( *(at )?)/);pe=h&&h[1]||"",we=-1)":-1A||_e[k]!==Ce[A]){var De=` -`+_e[k].replace(" at new "," at ");return c.displayName&&De.includes("")&&(De=De.replace("",c.displayName)),De}while(1<=k&&0<=A);break}}}finally{qe=!1,Error.prepareStackTrace=g}return(g=c?c.displayName||c.name:"")?ye(g):""}function ze(c,h){switch(c.tag){case 26:case 27:case 5:return ye(c.type);case 16:return ye("Lazy");case 13:return c.child!==h&&h!==null?ye("Suspense Fallback"):ye("Suspense");case 19:return ye("SuspenseList");case 0:case 15:return Ie(c.type,!1);case 11:return Ie(c.type.render,!1);case 1:return Ie(c.type,!0);case 31:return ye("Activity");default:return""}}function at(c){try{var h="",g=null;do h+=ze(c,g),g=c,c=c.return;while(c);return h}catch(k){return` +`+pe+c+we}var Pe=!1;function Be(c,h){if(!c||Pe)return"";Pe=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var k={DetermineComponentFrameRoot:function(){try{if(h){var Ie=function(){throw Error()};if(Object.defineProperty(Ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ie,[])}catch(je){var Ee=je}Reflect.construct(c,[],Ie)}else{try{Ie.call()}catch(je){Ee=je}c.call(Ie.prototype)}}else{try{throw Error()}catch(je){Ee=je}(Ie=c())&&typeof Ie.catch=="function"&&Ie.catch(function(){})}}catch(je){if(je&&Ee&&typeof je.stack=="string")return[je.stack,Ee.stack]}return[null,null]}};k.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var A=Object.getOwnPropertyDescriptor(k.DetermineComponentFrameRoot,"name");A&&A.configurable&&Object.defineProperty(k.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var D=k.DetermineComponentFrameRoot(),K=D[0],ne=D[1];if(K&&ne){var _e=K.split(` +`),Ce=ne.split(` +`);for(A=k=0;k<_e.length&&!_e[k].includes("DetermineComponentFrameRoot");)k++;for(;AA||_e[k]!==Ce[A]){var Me=` +`+_e[k].replace(" at new "," at ");return c.displayName&&Me.includes("")&&(Me=Me.replace("",c.displayName)),Me}while(1<=k&&0<=A);break}}}finally{Pe=!1,Error.prepareStackTrace=g}return(g=c?c.displayName||c.name:"")?be(g):""}function ze(c,h){switch(c.tag){case 26:case 27:case 5:return be(c.type);case 16:return be("Lazy");case 13:return c.child!==h&&h!==null?be("Suspense Fallback"):be("Suspense");case 19:return be("SuspenseList");case 0:case 15:return Be(c.type,!1);case 11:return Be(c.type.render,!1);case 1:return Be(c.type,!0);case 31:return be("Activity");default:return""}}function it(c){try{var h="",g=null;do h+=ze(c,g),g=c,c=c.return;while(c);return h}catch(k){return` Error generating stack: `+k.message+` -`+k.stack}}var bt=Object.prototype.hasOwnProperty,$t=e.unstable_scheduleCallback,Pt=e.unstable_cancelCallback,zt=e.unstable_shouldYield,ot=e.unstable_requestPaint,ft=e.unstable_now,It=e.unstable_getCurrentPriorityLevel,we=e.unstable_ImmediatePriority,Re=e.unstable_UserBlockingPriority,Ze=e.unstable_NormalPriority,ht=e.unstable_LowPriority,xt=e.unstable_IdlePriority,Vt=e.log,Ve=e.unstable_setDisableYieldValue,Ht=null,sn=null;function fn(c){if(typeof Vt=="function"&&Ve(c),sn&&typeof sn.setStrictMode=="function")try{sn.setStrictMode(Ht,c)}catch{}}var Zt=Math.clz32?Math.clz32:bn,Qn=Math.log,Jt=Math.LN2;function bn(c){return c>>>=0,c===0?32:31-(Qn(c)/Jt|0)|0}var or=256,lr=262144,br=4194304;function Dn(c){var h=c&42;if(h!==0)return h;switch(c&-c){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return c&261888;case 262144:case 524288:case 1048576:case 2097152:return c&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return c&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return c}}function Wr(c,h,g){var k=c.pendingLanes;if(k===0)return 0;var A=0,D=c.suspendedLanes,K=c.pingedLanes;c=c.warmLanes;var re=k&134217727;return re!==0?(k=re&~D,k!==0?A=Dn(k):(K&=re,K!==0?A=Dn(K):g||(g=re&~c,g!==0&&(A=Dn(g))))):(re=k&~D,re!==0?A=Dn(re):K!==0?A=Dn(K):g||(g=k&~c,g!==0&&(A=Dn(g)))),A===0?0:h!==0&&h!==A&&(h&D)===0&&(D=A&-A,g=h&-h,D>=g||D===32&&(g&4194048)!==0)?h:A}function Nr(c,h){return(c.pendingLanes&~(c.suspendedLanes&~c.pingedLanes)&h)===0}function vt(c,h){switch(c){case 1:case 2:case 4:case 8:case 64:return h+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return h+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function un(){var c=br;return br<<=1,(br&62914560)===0&&(br=4194304),c}function Cn(c){for(var h=[],g=0;31>g;g++)h.push(c);return h}function en(c,h){c.pendingLanes|=h,h!==268435456&&(c.suspendedLanes=0,c.pingedLanes=0,c.warmLanes=0)}function Jn(c,h,g,k,A,D){var K=c.pendingLanes;c.pendingLanes=g,c.suspendedLanes=0,c.pingedLanes=0,c.warmLanes=0,c.expiredLanes&=g,c.entangledLanes&=g,c.errorRecoveryDisabledLanes&=g,c.shellSuspendCounter=0;var re=c.entanglements,_e=c.expirationTimes,Ce=c.hiddenUpdates;for(g=K&~g;0"u")return null;try{return c.activeElement||c.body}catch{return c.body}}var Ls=/[\n"\\]/g;function $r(c){return c.replace(Ls,function(h){return"\\"+h.charCodeAt(0).toString(16)+" "})}function Dr(c,h,g,k,A,D,K,re){c.name="",K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?c.type=K:c.removeAttribute("type"),h!=null?K==="number"?(h===0&&c.value===""||c.value!=h)&&(c.value=""+Mr(h)):c.value!==""+Mr(h)&&(c.value=""+Mr(h)):K!=="submit"&&K!=="reset"||c.removeAttribute("value"),h!=null?bs(c,K,Mr(h)):g!=null?bs(c,K,Mr(g)):k!=null&&c.removeAttribute("value"),A==null&&D!=null&&(c.defaultChecked=!!D),A!=null&&(c.checked=A&&typeof A!="function"&&typeof A!="symbol"),re!=null&&typeof re!="function"&&typeof re!="symbol"&&typeof re!="boolean"?c.name=""+Mr(re):c.removeAttribute("name")}function cs(c,h,g,k,A,D,K,re){if(D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(c.type=D),h!=null||g!=null){if(!(D!=="submit"&&D!=="reset"||h!=null)){Xs(c);return}g=g!=null?""+Mr(g):"",h=h!=null?""+Mr(h):g,re||h===c.value||(c.value=h),c.defaultValue=h}k=k??A,k=typeof k!="function"&&typeof k!="symbol"&&!!k,c.checked=re?c.checked:!!k,c.defaultChecked=!!k,K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"&&(c.name=K),Xs(c)}function bs(c,h,g){h==="number"&&ls(c.ownerDocument)===c||c.defaultValue===""+g||(c.defaultValue=""+g)}function yr(c,h,g,k){if(c=c.options,h){h={};for(var A=0;A"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rc=!1;if(Nn)try{var Rt={};Object.defineProperty(Rt,"passive",{get:function(){rc=!0}}),window.addEventListener("test",Rt,Rt),window.removeEventListener("test",Rt,Rt)}catch{rc=!1}var hr=null,xs=null,la=null;function Ai(){if(la)return la;var c,h=xs,g=h.length,k,A="value"in hr?hr.value:hr.textContent,D=A.length;for(c=0;c=ca),ua=" ",Ia=!1;function hc(c,h){switch(c){case"keyup":return Au.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tl(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var se=!1;function be(c,h){switch(c){case"compositionend":return tl(h);case"keypress":return h.which!==32?null:(Ia=!0,ua);case"textInput":return c=h.data,c===ua&&Ia?null:c;default:return null}}function Ae(c,h){if(se)return c==="compositionend"||!fc&&hc(c,h)?(c=Ai(),la=xs=hr=null,se=!1,c):null;switch(c){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1=h)return{node:g,offset:h-c};c=k}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=Gn(g)}}function zs(c,h){return c&&h?c===h?!0:c&&c.nodeType===3?!1:h&&h.nodeType===3?zs(c,h.parentNode):"contains"in c?c.contains(h):c.compareDocumentPosition?!!(c.compareDocumentPosition(h)&16):!1:!1}function Ps(c){c=c!=null&&c.ownerDocument!=null&&c.ownerDocument.defaultView!=null?c.ownerDocument.defaultView:window;for(var h=ls(c.document);h instanceof c.HTMLIFrameElement;){try{var g=typeof h.contentWindow.location.href=="string"}catch{g=!1}if(g)c=h.contentWindow;else break;h=ls(c.document)}return h}function _i(c){var h=c&&c.nodeName&&c.nodeName.toLowerCase();return h&&(h==="input"&&(c.type==="text"||c.type==="search"||c.type==="tel"||c.type==="url"||c.type==="password")||h==="textarea"||c.contentEditable==="true")}var Tn=Nn&&"documentMode"in document&&11>=document.documentMode,Qr=null,Js=null,tr=null,_c=!1;function pr(c,h,g){var k=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;_c||Qr==null||Qr!==ls(k)||(k=Qr,"selectionStart"in k&&_i(k)?k={start:k.selectionStart,end:k.selectionEnd}:(k=(k.ownerDocument&&k.ownerDocument.defaultView||window).getSelection(),k={anchorNode:k.anchorNode,anchorOffset:k.anchorOffset,focusNode:k.focusNode,focusOffset:k.focusOffset}),tr&&Mt(tr,k)||(tr=k,k=ig(Js,"onSelect"),0>=K,A-=K,_o=1<<32-Zt(h)+A|g<an?(xn=yt,yt=null):xn=yt.sibling;var In=Ee(xe,yt,ke[an],Be);if(In===null){yt===null&&(yt=xn);break}c&&yt&&In.alternate===null&&h(xe,yt),me=D(In,me,an),On===null?At=In:On.sibling=In,On=In,yt=xn}if(an===ke.length)return g(xe,yt),wn&&sl(xe,an),At;if(yt===null){for(;anan?(xn=yt,yt=null):xn=yt.sibling;var Oc=Ee(xe,yt,In.value,Be);if(Oc===null){yt===null&&(yt=xn);break}c&&yt&&Oc.alternate===null&&h(xe,yt),me=D(Oc,me,an),On===null?At=Oc:On.sibling=Oc,On=Oc,yt=xn}if(In.done)return g(xe,yt),wn&&sl(xe,an),At;if(yt===null){for(;!In.done;an++,In=ke.next())In=$e(xe,In.value,Be),In!==null&&(me=D(In,me,an),On===null?At=In:On.sibling=In,On=In);return wn&&sl(xe,an),At}for(yt=k(yt);!In.done;an++,In=ke.next())In=je(yt,xe,an,In.value,Be),In!==null&&(c&&In.alternate!==null&&yt.delete(In.key===null?an:In.key),me=D(In,me,an),On===null?At=In:On.sibling=In,On=In);return c&&yt.forEach(function(JU){return h(xe,JU)}),wn&&sl(xe,an),At}function Zn(xe,me,ke,Be){if(typeof ke=="object"&&ke!==null&&ke.type===S&&ke.key===null&&(ke=ke.props.children),typeof ke=="object"&&ke!==null){switch(ke.$$typeof){case m:e:{for(var At=ke.key;me!==null;){if(me.key===At){if(At=ke.type,At===S){if(me.tag===7){g(xe,me.sibling),Be=A(me,ke.props.children),Be.return=xe,xe=Be;break e}}else if(me.elementType===At||typeof At=="object"&&At!==null&&At.$$typeof===z&&Pu(At)===me.type){g(xe,me.sibling),Be=A(me,ke.props),T_(Be,ke),Be.return=xe,xe=Be;break e}g(xe,me);break}else h(xe,me);me=me.sibling}ke.type===S?(Be=Lu(ke.props.children,xe.mode,Be,ke.key),Be.return=xe,xe=Be):(Be=wm(ke.type,ke.key,ke.props,null,xe.mode,Be),T_(Be,ke),Be.return=xe,xe=Be)}return K(xe);case x:e:{for(At=ke.key;me!==null;){if(me.key===At)if(me.tag===4&&me.stateNode.containerInfo===ke.containerInfo&&me.stateNode.implementation===ke.implementation){g(xe,me.sibling),Be=A(me,ke.children||[]),Be.return=xe,xe=Be;break e}else{g(xe,me);break}else h(xe,me);me=me.sibling}Be=by(ke,xe.mode,Be),Be.return=xe,xe=Be}return K(xe);case z:return ke=Pu(ke),Zn(xe,me,ke,Be)}if(Y(ke))return gt(xe,me,ke,Be);if($(ke)){if(At=$(ke),typeof At!="function")throw Error(r(150));return ke=At.call(ke),Bt(xe,me,ke,Be)}if(typeof ke.then=="function")return Zn(xe,me,jm(ke),Be);if(ke.$$typeof===y)return Zn(xe,me,Cm(xe,ke),Be);Tm(xe,ke)}return typeof ke=="string"&&ke!==""||typeof ke=="number"||typeof ke=="bigint"?(ke=""+ke,me!==null&&me.tag===6?(g(xe,me.sibling),Be=A(me,ke),Be.return=xe,xe=Be):(g(xe,me),Be=vy(ke,xe.mode,Be),Be.return=xe,xe=Be),K(xe)):g(xe,me)}return function(xe,me,ke,Be){try{j_=0;var At=Zn(xe,me,ke,Be);return kf=null,At}catch(yt){if(yt===Sf||yt===Nm)throw yt;var On=Ri(29,yt,null,xe.mode);return On.lanes=Be,On.return=xe,On}finally{}}}var Hu=d7(!0),f7=d7(!1),bc=!1;function Ay(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ry(c,h){c=c.updateQueue,h.updateQueue===c&&(h.updateQueue={baseState:c.baseState,firstBaseUpdate:c.firstBaseUpdate,lastBaseUpdate:c.lastBaseUpdate,shared:c.shared,callbacks:null})}function yc(c){return{lane:c,tag:0,payload:null,callback:null,next:null}}function xc(c,h,g){var k=c.updateQueue;if(k===null)return null;if(k=k.shared,($n&2)!==0){var A=k.pending;return A===null?h.next=h:(h.next=A.next,A.next=h),k.pending=h,h=xm(c),Qk(c,null,g),h}return ym(c,k,h,g),xm(c)}function A_(c,h,g){if(h=h.updateQueue,h!==null&&(h=h.shared,(g&4194048)!==0)){var k=h.lanes;k&=c.pendingLanes,g|=k,h.lanes=g,En(c,g)}}function My(c,h){var g=c.updateQueue,k=c.alternate;if(k!==null&&(k=k.updateQueue,g===k)){var A=null,D=null;if(g=g.firstBaseUpdate,g!==null){do{var K={lane:g.lane,tag:g.tag,payload:g.payload,callback:null,next:null};D===null?A=D=K:D=D.next=K,g=g.next}while(g!==null);D===null?A=D=h:D=D.next=h}else A=D=h;g={baseState:k.baseState,firstBaseUpdate:A,lastBaseUpdate:D,shared:k.shared,callbacks:k.callbacks},c.updateQueue=g;return}c=g.lastBaseUpdate,c===null?g.firstBaseUpdate=h:c.next=h,g.lastBaseUpdate=h}var Dy=!1;function R_(){if(Dy){var c=wf;if(c!==null)throw c}}function M_(c,h,g,k){Dy=!1;var A=c.updateQueue;bc=!1;var D=A.firstBaseUpdate,K=A.lastBaseUpdate,re=A.shared.pending;if(re!==null){A.shared.pending=null;var _e=re,Ce=_e.next;_e.next=null,K===null?D=Ce:K.next=Ce,K=_e;var De=c.alternate;De!==null&&(De=De.updateQueue,re=De.lastBaseUpdate,re!==K&&(re===null?De.firstBaseUpdate=Ce:re.next=Ce,De.lastBaseUpdate=_e))}if(D!==null){var $e=A.baseState;K=0,De=Ce=_e=null,re=D;do{var Ee=re.lane&-536870913,je=Ee!==re.lane;if(je?(yn&Ee)===Ee:(k&Ee)===Ee){Ee!==0&&Ee===xf&&(Dy=!0),De!==null&&(De=De.next={lane:0,tag:re.tag,payload:re.payload,callback:null,next:null});e:{var gt=c,Bt=re;Ee=h;var Zn=g;switch(Bt.tag){case 1:if(gt=Bt.payload,typeof gt=="function"){$e=gt.call(Zn,$e,Ee);break e}$e=gt;break e;case 3:gt.flags=gt.flags&-65537|128;case 0:if(gt=Bt.payload,Ee=typeof gt=="function"?gt.call(Zn,$e,Ee):gt,Ee==null)break e;$e=d({},$e,Ee);break e;case 2:bc=!0}}Ee=re.callback,Ee!==null&&(c.flags|=64,je&&(c.flags|=8192),je=A.callbacks,je===null?A.callbacks=[Ee]:je.push(Ee))}else je={lane:Ee,tag:re.tag,payload:re.payload,callback:re.callback,next:null},De===null?(Ce=De=je,_e=$e):De=De.next=je,K|=Ee;if(re=re.next,re===null){if(re=A.shared.pending,re===null)break;je=re,re=je.next,je.next=null,A.lastBaseUpdate=je,A.shared.pending=null}}while(!0);De===null&&(_e=$e),A.baseState=_e,A.firstBaseUpdate=Ce,A.lastBaseUpdate=De,D===null&&(A.shared.lanes=0),Ec|=K,c.lanes=K,c.memoizedState=$e}}function h7(c,h){if(typeof c!="function")throw Error(r(191,c));c.call(h)}function _7(c,h){var g=c.callbacks;if(g!==null)for(c.callbacks=null,c=0;cD?D:8;var K=V.T,re={};V.T=re,Jy(c,!1,h,g);try{var _e=A(),Ce=V.S;if(Ce!==null&&Ce(re,_e),_e!==null&&typeof _e=="object"&&typeof _e.then=="function"){var De=Hq(_e,k);O_(c,h,De,Ii(c))}else O_(c,h,k,Ii(c))}catch($e){O_(c,h,{then:function(){},status:"rejected",reason:$e},Ii())}finally{X.p=D,K!==null&&re.types!==null&&(K.types=re.types),V.T=K}}function Kq(){}function Xy(c,h,g,k){if(c.tag!==5)throw Error(r(476));var A=W7(c).queue;G7(c,A,h,te,g===null?Kq:function(){return V7(c),g(k)})}function W7(c){var h=c.memoizedState;if(h!==null)return h;h={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:te},next:null};var g={};return h.next={memoizedState:g,baseState:g,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:g},next:null},c.memoizedState=h,c=c.alternate,c!==null&&(c.memoizedState=h),h}function V7(c){var h=W7(c);h.next===null&&(h=c.alternate.memoizedState),O_(c,h.next.queue,{},Ii())}function Zy(){return Ts(J_)}function K7(){return Hr().memoizedState}function Q7(){return Hr().memoizedState}function Qq(c){for(var h=c.return;h!==null;){switch(h.tag){case 24:case 3:var g=Ii();c=yc(g);var k=xc(h,c,g);k!==null&&(bi(k,h,g),A_(k,h,g)),h={cache:Ny()},c.payload=h;return}h=h.return}}function Yq(c,h,g){var k=Ii();g={lane:k,revertLane:0,gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},Pm(c)?X7(h,g):(g=my(c,h,g,k),g!==null&&(bi(g,c,k),Z7(g,h,k)))}function Y7(c,h,g){var k=Ii();O_(c,h,g,k)}function O_(c,h,g,k){var A={lane:k,revertLane:0,gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null};if(Pm(c))X7(h,A);else{var D=c.alternate;if(c.lanes===0&&(D===null||D.lanes===0)&&(D=h.lastRenderedReducer,D!==null))try{var K=h.lastRenderedState,re=D(K,g);if(A.hasEagerState=!0,A.eagerState=re,tt(re,K))return ym(c,h,A,0),nr===null&&bm(),!1}catch{}finally{}if(g=my(c,h,A,k),g!==null)return bi(g,c,k),Z7(g,h,k),!0}return!1}function Jy(c,h,g,k){if(k={lane:2,revertLane:A2(),gesture:null,action:k,hasEagerState:!1,eagerState:null,next:null},Pm(c)){if(h)throw Error(r(479))}else h=my(c,g,k,2),h!==null&&bi(h,c,2)}function Pm(c){var h=c.alternate;return c===rn||h!==null&&h===rn}function X7(c,h){Ef=Mm=!0;var g=c.pending;g===null?h.next=h:(h.next=g.next,g.next=h),c.pending=h}function Z7(c,h,g){if((g&4194048)!==0){var k=h.lanes;k&=c.pendingLanes,g|=k,h.lanes=g,En(c,g)}}var I_={readContext:Ts,use:Om,useCallback:Lr,useContext:Lr,useEffect:Lr,useImperativeHandle:Lr,useLayoutEffect:Lr,useInsertionEffect:Lr,useMemo:Lr,useReducer:Lr,useRef:Lr,useState:Lr,useDebugValue:Lr,useDeferredValue:Lr,useTransition:Lr,useSyncExternalStore:Lr,useId:Lr,useHostTransitionStatus:Lr,useFormState:Lr,useActionState:Lr,useOptimistic:Lr,useMemoCache:Lr,useCacheRefresh:Lr};I_.useEffectEvent=Lr;var J7={readContext:Ts,use:Om,useCallback:function(c,h){return ei().memoizedState=[c,h===void 0?null:h],c},useContext:Ts,useEffect:O7,useImperativeHandle:function(c,h,g){g=g!=null?g.concat([c]):null,Bm(4194308,4,P7.bind(null,h,c),g)},useLayoutEffect:function(c,h){return Bm(4194308,4,c,h)},useInsertionEffect:function(c,h){Bm(4,2,c,h)},useMemo:function(c,h){var g=ei();h=h===void 0?null:h;var k=c();if(qu){fn(!0);try{c()}finally{fn(!1)}}return g.memoizedState=[k,h],k},useReducer:function(c,h,g){var k=ei();if(g!==void 0){var A=g(h);if(qu){fn(!0);try{g(h)}finally{fn(!1)}}}else A=h;return k.memoizedState=k.baseState=A,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:A},k.queue=c,c=c.dispatch=Yq.bind(null,rn,c),[k.memoizedState,c]},useRef:function(c){var h=ei();return c={current:c},h.memoizedState=c},useState:function(c){c=Wy(c);var h=c.queue,g=Y7.bind(null,rn,h);return h.dispatch=g,[c.memoizedState,g]},useDebugValue:Qy,useDeferredValue:function(c,h){var g=ei();return Yy(g,c,h)},useTransition:function(){var c=Wy(!1);return c=G7.bind(null,rn,c.queue,!0,!1),ei().memoizedState=c,[!1,c]},useSyncExternalStore:function(c,h,g){var k=rn,A=ei();if(wn){if(g===void 0)throw Error(r(407));g=g()}else{if(g=h(),nr===null)throw Error(r(349));(yn&127)!==0||y7(k,h,g)}A.memoizedState=g;var D={value:g,getSnapshot:h};return A.queue=D,O7(w7.bind(null,k,D,c),[c]),k.flags|=2048,zf(9,{destroy:void 0},x7.bind(null,k,D,g,h),null),g},useId:function(){var c=ei(),h=nr.identifierPrefix;if(wn){var g=po,k=_o;g=(k&~(1<<32-Zt(k)-1)).toString(32)+g,h="_"+h+"R_"+g,g=Dm++,0<\/script>",D=D.removeChild(D.firstChild);break;case"select":D=typeof k.is=="string"?K.createElement("select",{is:k.is}):K.createElement("select"),k.multiple?D.multiple=!0:k.size&&(D.size=k.size);break;default:D=typeof k.is=="string"?K.createElement(A,{is:k.is}):K.createElement(A)}}D[cn]=h,D[qt]=k;e:for(K=h.child;K!==null;){if(K.tag===5||K.tag===6)D.appendChild(K.stateNode);else if(K.tag!==4&&K.tag!==27&&K.child!==null){K.child.return=K,K=K.child;continue}if(K===h)break e;for(;K.sibling===null;){if(K.return===null||K.return===h)break e;K=K.return}K.sibling.return=K.return,K=K.sibling}h.stateNode=D;e:switch(Rs(D,A,k),A){case"button":case"input":case"select":case"textarea":k=!!k.autoFocus;break e;case"img":k=!0;break e;default:k=!1}k&&ul(h)}}return gr(h),h2(h,h.type,c===null?null:c.memoizedProps,h.pendingProps,g),null;case 6:if(c&&h.stateNode!=null)c.memoizedProps!==k&&ul(h);else{if(typeof k!="string"&&h.stateNode===null)throw Error(r(166));if(c=oe.current,bf(h)){if(c=h.stateNode,g=h.memoizedProps,k=null,A=js,A!==null)switch(A.tag){case 27:case 5:k=A.memoizedProps}c[cn]=h,c=!!(c.nodeValue===g||k!==null&&k.suppressHydrationWarning===!0||vC(c.nodeValue,g)),c||gc(h,!0)}else c=ag(c).createTextNode(k),c[cn]=h,h.stateNode=c}return gr(h),null;case 31:if(g=h.memoizedState,c===null||c.memoizedState!==null){if(k=bf(h),g!==null){if(c===null){if(!k)throw Error(r(318));if(c=h.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(r(557));c[cn]=h}else Ou(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;gr(h),c=!1}else g=Sy(),c!==null&&c.memoizedState!==null&&(c.memoizedState.hydrationErrors=g),c=!0;if(!c)return h.flags&256?(Di(h),h):(Di(h),null);if((h.flags&128)!==0)throw Error(r(558))}return gr(h),null;case 13:if(k=h.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(A=bf(h),k!==null&&k.dehydrated!==null){if(c===null){if(!A)throw Error(r(318));if(A=h.memoizedState,A=A!==null?A.dehydrated:null,!A)throw Error(r(317));A[cn]=h}else Ou(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;gr(h),A=!1}else A=Sy(),c!==null&&c.memoizedState!==null&&(c.memoizedState.hydrationErrors=A),A=!0;if(!A)return h.flags&256?(Di(h),h):(Di(h),null)}return Di(h),(h.flags&128)!==0?(h.lanes=g,h):(g=k!==null,c=c!==null&&c.memoizedState!==null,g&&(k=h.child,A=null,k.alternate!==null&&k.alternate.memoizedState!==null&&k.alternate.memoizedState.cachePool!==null&&(A=k.alternate.memoizedState.cachePool.pool),D=null,k.memoizedState!==null&&k.memoizedState.cachePool!==null&&(D=k.memoizedState.cachePool.pool),D!==A&&(k.flags|=2048)),g!==c&&g&&(h.child.flags|=8192),Gm(h,h.updateQueue),gr(h),null);case 4:return le(),c===null&&L2(h.stateNode.containerInfo),gr(h),null;case 10:return al(h.type),gr(h),null;case 19:if(q(Fr),k=h.memoizedState,k===null)return gr(h),null;if(A=(h.flags&128)!==0,D=k.rendering,D===null)if(A)$_(k,!1);else{if(Or!==0||c!==null&&(c.flags&128)!==0)for(c=h.child;c!==null;){if(D=Rm(c),D!==null){for(h.flags|=128,$_(k,!1),c=D.updateQueue,h.updateQueue=c,Gm(h,c),h.subtreeFlags=0,c=g,g=h.child;g!==null;)Yk(g,c),g=g.sibling;return G(Fr,Fr.current&1|2),wn&&sl(h,k.treeForkCount),h.child}c=c.sibling}k.tail!==null&&ft()>Ym&&(h.flags|=128,A=!0,$_(k,!1),h.lanes=4194304)}else{if(!A)if(c=Rm(D),c!==null){if(h.flags|=128,A=!0,c=c.updateQueue,h.updateQueue=c,Gm(h,c),$_(k,!0),k.tail===null&&k.tailMode==="hidden"&&!D.alternate&&!wn)return gr(h),null}else 2*ft()-k.renderingStartTime>Ym&&g!==536870912&&(h.flags|=128,A=!0,$_(k,!1),h.lanes=4194304);k.isBackwards?(D.sibling=h.child,h.child=D):(c=k.last,c!==null?c.sibling=D:h.child=D,k.last=D)}return k.tail!==null?(c=k.tail,k.rendering=c,k.tail=c.sibling,k.renderingStartTime=ft(),c.sibling=null,g=Fr.current,G(Fr,A?g&1|2:g&1),wn&&sl(h,k.treeForkCount),c):(gr(h),null);case 22:case 23:return Di(h),Oy(),k=h.memoizedState!==null,c!==null?c.memoizedState!==null!==k&&(h.flags|=8192):k&&(h.flags|=8192),k?(g&536870912)!==0&&(h.flags&128)===0&&(gr(h),h.subtreeFlags&6&&(h.flags|=8192)):gr(h),g=h.updateQueue,g!==null&&Gm(h,g.retryQueue),g=null,c!==null&&c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),k=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(k=h.memoizedState.cachePool.pool),k!==g&&(h.flags|=2048),c!==null&&q($u),null;case 24:return g=null,c!==null&&(g=c.memoizedState.cache),h.memoizedState.cache!==g&&(h.flags|=2048),al(Yr),gr(h),null;case 25:return null;case 30:return null}throw Error(r(156,h.tag))}function tU(c,h){switch(xy(h),h.tag){case 1:return c=h.flags,c&65536?(h.flags=c&-65537|128,h):null;case 3:return al(Yr),le(),c=h.flags,(c&65536)!==0&&(c&128)===0?(h.flags=c&-65537|128,h):null;case 26:case 27:case 5:return ue(h),null;case 31:if(h.memoizedState!==null){if(Di(h),h.alternate===null)throw Error(r(340));Ou()}return c=h.flags,c&65536?(h.flags=c&-65537|128,h):null;case 13:if(Di(h),c=h.memoizedState,c!==null&&c.dehydrated!==null){if(h.alternate===null)throw Error(r(340));Ou()}return c=h.flags,c&65536?(h.flags=c&-65537|128,h):null;case 19:return q(Fr),null;case 4:return le(),null;case 10:return al(h.type),null;case 22:case 23:return Di(h),Oy(),c!==null&&q($u),c=h.flags,c&65536?(h.flags=c&-65537|128,h):null;case 24:return al(Yr),null;case 25:return null;default:return null}}function S8(c,h){switch(xy(h),h.tag){case 3:al(Yr),le();break;case 26:case 27:case 5:ue(h);break;case 4:le();break;case 31:h.memoizedState!==null&&Di(h);break;case 13:Di(h);break;case 19:q(Fr);break;case 10:al(h.type);break;case 22:case 23:Di(h),Oy(),c!==null&&q($u);break;case 24:al(Yr)}}function P_(c,h){try{var g=h.updateQueue,k=g!==null?g.lastEffect:null;if(k!==null){var A=k.next;g=A;do{if((g.tag&c)===c){k=void 0;var D=g.create,K=g.inst;k=D(),K.destroy=k}g=g.next}while(g!==A)}}catch(re){Vn(h,h.return,re)}}function kc(c,h,g){try{var k=h.updateQueue,A=k!==null?k.lastEffect:null;if(A!==null){var D=A.next;k=D;do{if((k.tag&c)===c){var K=k.inst,re=K.destroy;if(re!==void 0){K.destroy=void 0,A=h;var _e=g,Ce=re;try{Ce()}catch(De){Vn(A,_e,De)}}}k=k.next}while(k!==D)}}catch(De){Vn(h,h.return,De)}}function k8(c){var h=c.updateQueue;if(h!==null){var g=c.stateNode;try{_7(h,g)}catch(k){Vn(c,c.return,k)}}}function C8(c,h,g){g.props=Uu(c.type,c.memoizedProps),g.state=c.memoizedState;try{g.componentWillUnmount()}catch(k){Vn(c,h,k)}}function F_(c,h){try{var g=c.ref;if(g!==null){switch(c.tag){case 26:case 27:case 5:var k=c.stateNode;break;case 30:k=c.stateNode;break;default:k=c.stateNode}typeof g=="function"?c.refCleanup=g(k):g.current=k}}catch(A){Vn(c,h,A)}}function mo(c,h){var g=c.ref,k=c.refCleanup;if(g!==null)if(typeof k=="function")try{k()}catch(A){Vn(c,h,A)}finally{c.refCleanup=null,c=c.alternate,c!=null&&(c.refCleanup=null)}else if(typeof g=="function")try{g(null)}catch(A){Vn(c,h,A)}else g.current=null}function E8(c){var h=c.type,g=c.memoizedProps,k=c.stateNode;try{e:switch(h){case"button":case"input":case"select":case"textarea":g.autoFocus&&k.focus();break e;case"img":g.src?k.src=g.src:g.srcSet&&(k.srcset=g.srcSet)}}catch(A){Vn(c,c.return,A)}}function _2(c,h,g){try{var k=c.stateNode;SU(k,c.type,g,h),k[qt]=h}catch(A){Vn(c,c.return,A)}}function N8(c){return c.tag===5||c.tag===3||c.tag===26||c.tag===27&&Ac(c.type)||c.tag===4}function p2(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||N8(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.tag===27&&Ac(c.type)||c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function m2(c,h,g){var k=c.tag;if(k===5||k===6)c=c.stateNode,h?(g.nodeType===9?g.body:g.nodeName==="HTML"?g.ownerDocument.body:g).insertBefore(c,h):(h=g.nodeType===9?g.body:g.nodeName==="HTML"?g.ownerDocument.body:g,h.appendChild(c),g=g._reactRootContainer,g!=null||h.onclick!==null||(h.onclick=Pr));else if(k!==4&&(k===27&&Ac(c.type)&&(g=c.stateNode,h=null),c=c.child,c!==null))for(m2(c,h,g),c=c.sibling;c!==null;)m2(c,h,g),c=c.sibling}function Wm(c,h,g){var k=c.tag;if(k===5||k===6)c=c.stateNode,h?g.insertBefore(c,h):g.appendChild(c);else if(k!==4&&(k===27&&Ac(c.type)&&(g=c.stateNode),c=c.child,c!==null))for(Wm(c,h,g),c=c.sibling;c!==null;)Wm(c,h,g),c=c.sibling}function z8(c){var h=c.stateNode,g=c.memoizedProps;try{for(var k=c.type,A=h.attributes;A.length;)h.removeAttributeNode(A[0]);Rs(h,k,g),h[cn]=c,h[qt]=g}catch(D){Vn(c,c.return,D)}}var dl=!1,Jr=!1,g2=!1,j8=typeof WeakSet=="function"?WeakSet:Set,ws=null;function nU(c,h){if(c=c.containerInfo,B2=hg,c=Ps(c),_i(c)){if("selectionStart"in c)var g={start:c.selectionStart,end:c.selectionEnd};else e:{g=(g=c.ownerDocument)&&g.defaultView||window;var k=g.getSelection&&g.getSelection();if(k&&k.rangeCount!==0){g=k.anchorNode;var A=k.anchorOffset,D=k.focusNode;k=k.focusOffset;try{g.nodeType,D.nodeType}catch{g=null;break e}var K=0,re=-1,_e=-1,Ce=0,De=0,$e=c,Ee=null;t:for(;;){for(var je;$e!==g||A!==0&&$e.nodeType!==3||(re=K+A),$e!==D||k!==0&&$e.nodeType!==3||(_e=K+k),$e.nodeType===3&&(K+=$e.nodeValue.length),(je=$e.firstChild)!==null;)Ee=$e,$e=je;for(;;){if($e===c)break t;if(Ee===g&&++Ce===A&&(re=K),Ee===D&&++De===k&&(_e=K),(je=$e.nextSibling)!==null)break;$e=Ee,Ee=$e.parentNode}$e=je}g=re===-1||_e===-1?null:{start:re,end:_e}}else g=null}g=g||{start:0,end:0}}else g=null;for($2={focusedElem:c,selectionRange:g},hg=!1,ws=h;ws!==null;)if(h=ws,c=h.child,(h.subtreeFlags&1028)!==0&&c!==null)c.return=h,ws=c;else for(;ws!==null;){switch(h=ws,D=h.alternate,c=h.flags,h.tag){case 0:if((c&4)!==0&&(c=h.updateQueue,c=c!==null?c.events:null,c!==null))for(g=0;g title"))),Rs(D,k,g),D[cn]=c,Ke(D),k=D;break e;case"link":var K=LC("link","href",A).get(k+(g.href||""));if(K){for(var re=0;reZn&&(K=Zn,Zn=Bt,Bt=K);var xe=Ns(re,Bt),me=Ns(re,Zn);if(xe&&me&&(je.rangeCount!==1||je.anchorNode!==xe.node||je.anchorOffset!==xe.offset||je.focusNode!==me.node||je.focusOffset!==me.offset)){var ke=$e.createRange();ke.setStart(xe.node,xe.offset),je.removeAllRanges(),Bt>Zn?(je.addRange(ke),je.extend(me.node,me.offset)):(ke.setEnd(me.node,me.offset),je.addRange(ke))}}}}for($e=[],je=re;je=je.parentNode;)je.nodeType===1&&$e.push({element:je,left:je.scrollLeft,top:je.scrollTop});for(typeof re.focus=="function"&&re.focus(),re=0;re<$e.length;re++){var Be=$e[re];Be.element.scrollLeft=Be.left,Be.element.scrollTop=Be.top}}hg=!!B2,$2=B2=null}finally{$n=A,X.p=k,V.T=g}}c.current=h,ds=2}}function nC(){if(ds===2){ds=0;var c=zc,h=Mf,g=(h.flags&8772)!==0;if((h.subtreeFlags&8772)!==0||g){g=V.T,V.T=null;var k=X.p;X.p=2;var A=$n;$n|=4;try{T8(c,h.alternate,h)}finally{$n=A,X.p=k,V.T=g}}ds=3}}function rC(){if(ds===4||ds===3){ds=0,ot();var c=zc,h=Mf,g=ml,k=q8;(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?ds=5:(ds=0,Mf=zc=null,sC(c,c.pendingLanes));var A=c.pendingLanes;if(A===0&&(Nc=null),kt(g),h=h.stateNode,sn&&typeof sn.onCommitFiberRoot=="function")try{sn.onCommitFiberRoot(Ht,h,void 0,(h.current.flags&128)===128)}catch{}if(k!==null){h=V.T,A=X.p,X.p=2,V.T=null;try{for(var D=c.onRecoverableError,K=0;Kg?32:g,V.T=null,g=k2,k2=null;var D=zc,K=ml;if(ds=0,Mf=zc=null,ml=0,($n&6)!==0)throw Error(r(331));var re=$n;if($n|=4,P8(D.current),I8(D,D.current,K,g),$n=re,V_(0,!1),sn&&typeof sn.onPostCommitFiberRoot=="function")try{sn.onPostCommitFiberRoot(Ht,D)}catch{}return!0}finally{X.p=A,V.T=k,sC(c,h)}}function aC(c,h,g){h=ha(g,h),h=r2(c.stateNode,h,2),c=xc(c,h,2),c!==null&&(en(c,2),go(c))}function Vn(c,h,g){if(c.tag===3)aC(c,c,g);else for(;h!==null;){if(h.tag===3){aC(h,c,g);break}else if(h.tag===1){var k=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof k.componentDidCatch=="function"&&(Nc===null||!Nc.has(k))){c=ha(g,c),g=o8(2),k=xc(h,g,2),k!==null&&(l8(g,k,h,c),en(k,2),go(k));break}}h=h.return}}function z2(c,h,g){var k=c.pingCache;if(k===null){k=c.pingCache=new iU;var A=new Set;k.set(h,A)}else A=k.get(h),A===void 0&&(A=new Set,k.set(h,A));A.has(g)||(y2=!0,A.add(g),c=uU.bind(null,c,h,g),h.then(c,c))}function uU(c,h,g){var k=c.pingCache;k!==null&&k.delete(h),c.pingedLanes|=c.suspendedLanes&g,c.warmLanes&=~g,nr===c&&(yn&g)===g&&(Or===4||Or===3&&(yn&62914560)===yn&&300>ft()-Qm?($n&2)===0&&Df(c,0):x2|=g,Rf===yn&&(Rf=0)),go(c)}function oC(c,h){h===0&&(h=un()),c=Du(c,h),c!==null&&(en(c,h),go(c))}function dU(c){var h=c.memoizedState,g=0;h!==null&&(g=h.retryLane),oC(c,g)}function fU(c,h){var g=0;switch(c.tag){case 31:case 13:var k=c.stateNode,A=c.memoizedState;A!==null&&(g=A.retryLane);break;case 19:k=c.stateNode;break;case 22:k=c.stateNode._retryCache;break;default:throw Error(r(314))}k!==null&&k.delete(h),oC(c,g)}function hU(c,h){return $t(c,h)}var ng=null,Of=null,j2=!1,rg=!1,T2=!1,Tc=0;function go(c){c!==Of&&c.next===null&&(Of===null?ng=Of=c:Of=Of.next=c),rg=!0,j2||(j2=!0,pU())}function V_(c,h){if(!T2&&rg){T2=!0;do for(var g=!1,k=ng;k!==null;){if(c!==0){var A=k.pendingLanes;if(A===0)var D=0;else{var K=k.suspendedLanes,re=k.pingedLanes;D=(1<<31-Zt(42|c)+1)-1,D&=A&~(K&~re),D=D&201326741?D&201326741|1:D?D|2:0}D!==0&&(g=!0,dC(k,D))}else D=yn,D=Wr(k,k===nr?D:0,k.cancelPendingCommit!==null||k.timeoutHandle!==-1),(D&3)===0||Nr(k,D)||(g=!0,dC(k,D));k=k.next}while(g);T2=!1}}function _U(){lC()}function lC(){rg=j2=!1;var c=0;Tc!==0&&CU()&&(c=Tc);for(var h=ft(),g=null,k=ng;k!==null;){var A=k.next,D=cC(k,h);D===0?(k.next=null,g===null?ng=A:g.next=A,A===null&&(Of=g)):(g=k,(c!==0||(D&3)!==0)&&(rg=!0)),k=A}ds!==0&&ds!==5||V_(c),Tc!==0&&(Tc=0)}function cC(c,h){for(var g=c.suspendedLanes,k=c.pingedLanes,A=c.expirationTimes,D=c.pendingLanes&-62914561;0re)break;var De=_e.transferSize,$e=_e.initiatorType;De&&bC($e)&&(_e=_e.responseEnd,K+=De*(_e"u"?null:document;function AC(c,h,g){var k=If;if(k&&typeof h=="string"&&h){var A=$r(h);A='link[rel="'+c+'"][href="'+A+'"]',typeof g=="string"&&(A+='[crossorigin="'+g+'"]'),TC.has(A)||(TC.add(A),c={rel:c,crossOrigin:g,href:h},k.querySelector(A)===null&&(h=k.createElement("link"),Rs(h,"link",c),Ke(h),k.head.appendChild(h)))}}function DU(c){gl.D(c),AC("dns-prefetch",c,null)}function LU(c,h){gl.C(c,h),AC("preconnect",c,h)}function OU(c,h,g){gl.L(c,h,g);var k=If;if(k&&c&&h){var A='link[rel="preload"][as="'+$r(h)+'"]';h==="image"&&g&&g.imageSrcSet?(A+='[imagesrcset="'+$r(g.imageSrcSet)+'"]',typeof g.imageSizes=="string"&&(A+='[imagesizes="'+$r(g.imageSizes)+'"]')):A+='[href="'+$r(c)+'"]';var D=A;switch(h){case"style":D=Bf(c);break;case"script":D=$f(c)}ba.has(D)||(c=d({rel:"preload",href:h==="image"&&g&&g.imageSrcSet?void 0:c,as:h},g),ba.set(D,c),k.querySelector(A)!==null||h==="style"&&k.querySelector(X_(D))||h==="script"&&k.querySelector(Z_(D))||(h=k.createElement("link"),Rs(h,"link",c),Ke(h),k.head.appendChild(h)))}}function IU(c,h){gl.m(c,h);var g=If;if(g&&c){var k=h&&typeof h.as=="string"?h.as:"script",A='link[rel="modulepreload"][as="'+$r(k)+'"][href="'+$r(c)+'"]',D=A;switch(k){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":D=$f(c)}if(!ba.has(D)&&(c=d({rel:"modulepreload",href:c},h),ba.set(D,c),g.querySelector(A)===null)){switch(k){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(g.querySelector(Z_(D)))return}k=g.createElement("link"),Rs(k,"link",c),Ke(k),g.head.appendChild(k)}}}function BU(c,h,g){gl.S(c,h,g);var k=If;if(k&&c){var A=Rr(k).hoistableStyles,D=Bf(c);h=h||"default";var K=A.get(D);if(!K){var re={loading:0,preload:null};if(K=k.querySelector(X_(D)))re.loading=5;else{c=d({rel:"stylesheet",href:c,"data-precedence":h},g),(g=ba.get(D))&&W2(c,g);var _e=K=k.createElement("link");Ke(_e),Rs(_e,"link",c),_e._p=new Promise(function(Ce,De){_e.onload=Ce,_e.onerror=De}),_e.addEventListener("load",function(){re.loading|=1}),_e.addEventListener("error",function(){re.loading|=2}),re.loading|=4,lg(K,h,k)}K={type:"stylesheet",instance:K,count:1,state:re},A.set(D,K)}}}function $U(c,h){gl.X(c,h);var g=If;if(g&&c){var k=Rr(g).hoistableScripts,A=$f(c),D=k.get(A);D||(D=g.querySelector(Z_(A)),D||(c=d({src:c,async:!0},h),(h=ba.get(A))&&V2(c,h),D=g.createElement("script"),Ke(D),Rs(D,"link",c),g.head.appendChild(D)),D={type:"script",instance:D,count:1,state:null},k.set(A,D))}}function PU(c,h){gl.M(c,h);var g=If;if(g&&c){var k=Rr(g).hoistableScripts,A=$f(c),D=k.get(A);D||(D=g.querySelector(Z_(A)),D||(c=d({src:c,async:!0,type:"module"},h),(h=ba.get(A))&&V2(c,h),D=g.createElement("script"),Ke(D),Rs(D,"link",c),g.head.appendChild(D)),D={type:"script",instance:D,count:1,state:null},k.set(A,D))}}function RC(c,h,g,k){var A=(A=oe.current)?og(A):null;if(!A)throw Error(r(446));switch(c){case"meta":case"title":return null;case"style":return typeof g.precedence=="string"&&typeof g.href=="string"?(h=Bf(g.href),g=Rr(A).hoistableStyles,k=g.get(h),k||(k={type:"style",instance:null,count:0,state:null},g.set(h,k)),k):{type:"void",instance:null,count:0,state:null};case"link":if(g.rel==="stylesheet"&&typeof g.href=="string"&&typeof g.precedence=="string"){c=Bf(g.href);var D=Rr(A).hoistableStyles,K=D.get(c);if(K||(A=A.ownerDocument||A,K={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},D.set(c,K),(D=A.querySelector(X_(c)))&&!D._p&&(K.instance=D,K.state.loading=5),ba.has(c)||(g={rel:"preload",as:"style",href:g.href,crossOrigin:g.crossOrigin,integrity:g.integrity,media:g.media,hrefLang:g.hrefLang,referrerPolicy:g.referrerPolicy},ba.set(c,g),D||FU(A,c,g,K.state))),h&&k===null)throw Error(r(528,""));return K}if(h&&k!==null)throw Error(r(529,""));return null;case"script":return h=g.async,g=g.src,typeof g=="string"&&h&&typeof h!="function"&&typeof h!="symbol"?(h=$f(g),g=Rr(A).hoistableScripts,k=g.get(h),k||(k={type:"script",instance:null,count:0,state:null},g.set(h,k)),k):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,c))}}function Bf(c){return'href="'+$r(c)+'"'}function X_(c){return'link[rel="stylesheet"]['+c+"]"}function MC(c){return d({},c,{"data-precedence":c.precedence,precedence:null})}function FU(c,h,g,k){c.querySelector('link[rel="preload"][as="style"]['+h+"]")?k.loading=1:(h=c.createElement("link"),k.preload=h,h.addEventListener("load",function(){return k.loading|=1}),h.addEventListener("error",function(){return k.loading|=2}),Rs(h,"link",g),Ke(h),c.head.appendChild(h))}function $f(c){return'[src="'+$r(c)+'"]'}function Z_(c){return"script[async]"+c}function DC(c,h,g){if(h.count++,h.instance===null)switch(h.type){case"style":var k=c.querySelector('style[data-href~="'+$r(g.href)+'"]');if(k)return h.instance=k,Ke(k),k;var A=d({},g,{"data-href":g.href,"data-precedence":g.precedence,href:null,precedence:null});return k=(c.ownerDocument||c).createElement("style"),Ke(k),Rs(k,"style",A),lg(k,g.precedence,c),h.instance=k;case"stylesheet":A=Bf(g.href);var D=c.querySelector(X_(A));if(D)return h.state.loading|=4,h.instance=D,Ke(D),D;k=MC(g),(A=ba.get(A))&&W2(k,A),D=(c.ownerDocument||c).createElement("link"),Ke(D);var K=D;return K._p=new Promise(function(re,_e){K.onload=re,K.onerror=_e}),Rs(D,"link",k),h.state.loading|=4,lg(D,g.precedence,c),h.instance=D;case"script":return D=$f(g.src),(A=c.querySelector(Z_(D)))?(h.instance=A,Ke(A),A):(k=g,(A=ba.get(D))&&(k=d({},g),V2(k,A)),c=c.ownerDocument||c,A=c.createElement("script"),Ke(A),Rs(A,"link",k),c.head.appendChild(A),h.instance=A);case"void":return null;default:throw Error(r(443,h.type))}else h.type==="stylesheet"&&(h.state.loading&4)===0&&(k=h.instance,h.state.loading|=4,lg(k,g.precedence,c));return h.instance}function lg(c,h,g){for(var k=g.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),A=k.length?k[k.length-1]:null,D=A,K=0;K title"):null)}function HU(c,h,g){if(g===1||h.itemProp!=null)return!1;switch(c){case"meta":case"title":return!0;case"style":if(typeof h.precedence!="string"||typeof h.href!="string"||h.href==="")break;return!0;case"link":if(typeof h.rel!="string"||typeof h.href!="string"||h.href===""||h.onLoad||h.onError)break;switch(h.rel){case"stylesheet":return c=h.disabled,typeof h.precedence=="string"&&c==null;default:return!0}case"script":if(h.async&&typeof h.async!="function"&&typeof h.async!="symbol"&&!h.onLoad&&!h.onError&&h.src&&typeof h.src=="string")return!0}return!1}function IC(c){return!(c.type==="stylesheet"&&(c.state.loading&3)===0)}function qU(c,h,g,k){if(g.type==="stylesheet"&&(typeof k.media!="string"||matchMedia(k.media).matches!==!1)&&(g.state.loading&4)===0){if(g.instance===null){var A=Bf(k.href),D=h.querySelector(X_(A));if(D){h=D._p,h!==null&&typeof h=="object"&&typeof h.then=="function"&&(c.count++,c=ug.bind(c),h.then(c,c)),g.state.loading|=4,g.instance=D,Ke(D);return}D=h.ownerDocument||h,k=MC(k),(A=ba.get(A))&&W2(k,A),D=D.createElement("link"),Ke(D);var K=D;K._p=new Promise(function(re,_e){K.onload=re,K.onerror=_e}),Rs(D,"link",k),g.instance=D}c.stylesheets===null&&(c.stylesheets=new Map),c.stylesheets.set(g,h),(h=g.state.preload)&&(g.state.loading&3)===0&&(c.count++,g=ug.bind(c),h.addEventListener("load",g),h.addEventListener("error",g))}}var K2=0;function UU(c,h){return c.stylesheets&&c.count===0&&fg(c,c.stylesheets),0K2?50:800)+h);return c.unsuspend=g,function(){c.unsuspend=null,clearTimeout(k),clearTimeout(A)}}:null}function ug(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)fg(this,this.stylesheets);else if(this.unsuspend){var c=this.unsuspend;this.unsuspend=null,c()}}}var dg=null;function fg(c,h){c.stylesheets=null,c.unsuspend!==null&&(c.count++,dg=new Map,h.forEach(GU,c),dg=null,ug.call(c))}function GU(c,h){if(!(h.state.loading&4)){var g=dg.get(c);if(g)var k=g.get(null);else{g=new Map,dg.set(c,g);for(var A=c.querySelectorAll("link[data-precedence],style[data-precedence]"),D=0;D"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),sx.exports=qG(),sx.exports}var GG=UG();const WG=!1;var EM=R.useLayoutEffect;function VG(e,n,t){R.useEffect(()=>{if(!e.current||t||typeof IntersectionObserver!="function")return()=>n();const r=new IntersectionObserver(s=>{n(s.pop())},{rootMargin:"100px"});return r.observe(e.current),()=>{r.disconnect(),n()}},[n,t,e])}function KG(e){const n=R.useRef(null);return R.useImperativeHandle(e,()=>n.current,[]),n}function K0(e){return e[e.length-1]}function Ih(e,n){return typeof e=="function"?e(n):e}const NM=Object.prototype.hasOwnProperty,QG=Object.prototype.propertyIsEnumerable;function zM(e){for(const n in e)if(NM.call(e,n))return!0;return!1}const YG=()=>Object.create(null),Vu=(e,n)=>od(e,n,YG);function od(e,n,t=()=>({}),r=0){if(e===n)return e;if(r>500)return n;const s=n,i=w9(e)&&w9(s);if(!i&&!(U1(e)&&U1(s)))return s;const a=i?e:y9(e);if(!a)return s;const o=i?s:y9(s);if(!o)return s;const l=a.length,u=o.length,_=i?new Array(u):t();let d=0;for(let p=0;p"u")return!0;const t=n.prototype;return!(!x9(t)||!t.hasOwnProperty("isPrototypeOf"))}function x9(e){return Object.prototype.toString.call(e)==="[object Object]"}function w9(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function au(e,n,t){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return!1;for(let r=0,s=e.length;rs||!au(e[a],n[a],t)))return!1;return s===i}return!1}const XG=/[\x00-\x1f\x7f"<>`{}]/g;function ZG(e){return e.replace(XG,n=>"%"+n.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function S9(e){let n;try{n=decodeURI(e)}catch{n=e.replaceAll(/%[0-9A-F]{2}/gi,t=>{try{return decodeURI(t)}catch{return t}})}return ZG(n)}const JG=["http:","https:","mailto:","tel:"];function G1(e,n){if(!e)return!1;try{const t=new URL(e);return!n.has(t.protocol)}catch{return!1}}function a0(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const n=/%25|%5C/gi;let t=0,r="",s;for(;(s=n.exec(e))!==null;)r+=S9(e.slice(t,s.index))+s[0],t=n.lastIndex;r=r+S9(t?e.slice(t):e);let i=!1;return r.startsWith("//")&&(i=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:i}}function eW(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function tW(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let t=0;t{i.next&&(i.prev?(i.prev.next=i.next,i.next.prev=i.prev,i.next=void 0,r&&(r.next=i,i.prev=r)):(i.next.prev=void 0,t=i.next,i.next=void 0,r&&(i.prev=r,r.next=i)),r=i)};return{get(i){const a=n.get(i);if(a)return s(a),a.value},set(i,a){if(n.size>=e&&t){const l=t;n.delete(l.key),l.next&&(t=l.next,l.next.prev=void 0),l===r&&(r=void 0)}const o=n.get(i);if(o)o.value=a,s(o);else{const l={key:i,value:a,prev:r};r&&(r.next=l),r=l,t||(t=l),n.set(i,l)}},clear(){n.clear(),t=void 0,r=void 0}}}const ru=4,jM=5;function TM(e,n,t=new Uint16Array(6)){const r=e.indexOf("/",n),s=r===-1?e.length:r,i=e.substring(n,s);if(!i||!i.includes("$"))return t[0]=0,t[1]=n,t[2]=n,t[3]=s,t[4]=s,t[5]=s,t;if(i==="$"){const l=e.length;return t[0]=2,t[1]=n,t[2]=n,t[3]=l,t[4]=l,t[5]=l,t}if(i.charCodeAt(0)===36)return t[0]=1,t[1]=n,t[2]=n+1,t[3]=s,t[4]=s,t[5]=s,t;const a=i.indexOf("{");let o;if(a!==-1&&a+1!B.parse&&B.caseSensitive===z&&B.prefix===N&&B.suffix===T));if(O)w=O;else{const B=nW(E,d,z,N,T);w=B,B.parent=s,B.depth=i;let $;E===1?$=s.dynamic??(s.dynamic=[]):E===3?$=s.optional??(s.optional=[]):$=s.wildcard??(s.wildcard=[]),$.push(B),$.length===2&&(a==null||a.push($))}break}}s=w}if(S&&t.children&&!t.isRoot&&t.id&&t.id.charCodeAt(t.id.lastIndexOf("/")+1)===95){const b=oh(d);b.kind=jM,b.parent=s,i++,b.depth=i,s.pathless??(s.pathless=[]),s.pathless.push(b),s=b}const v=(t.path||!t.children)&&!t.isRoot;if(v&&d.endsWith("/")){const b=oh(d);b.kind=ru,b.parent=s,i++,b.depth=i,s.index=b,s=b}s.parse=S??null,s.priority=((_=p==null?void 0:p.params)==null?void 0:_.priority)??0,v&&!s.route&&(s.route=t,s.fullPath=d)}if(t.children)for(const d of t.children)Gv(e,n,d,l,s,i,a,o)}function AM(e,n){if(e.parse&&!n.parse)return-1;if(!e.parse&&n.parse)return 1;if(e.parse&&n.parse&&(e.priority||n.priority))return n.priority-e.priority;if(e.prefix&&n.prefix&&e.prefix!==n.prefix){if(e.prefix.startsWith(n.prefix))return-1;if(n.prefix.startsWith(e.prefix))return 1}if(e.suffix&&n.suffix&&e.suffix!==n.suffix){if(e.suffix.endsWith(n.suffix))return-1;if(n.suffix.endsWith(e.suffix))return 1}return e.prefix&&!n.prefix?-1:!e.prefix&&n.prefix?1:e.suffix&&!n.suffix?-1:!e.suffix&&n.suffix?1:e.caseSensitive&&!n.caseSensitive?-1:!e.caseSensitive&&n.caseSensitive?1:0}function oh(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function nW(e,n,t,r,s){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:n,parent:null,parse:null,priority:0,caseSensitive:t,prefix:r,suffix:s}}function rW(e,n){const t=oh("/"),r=new Uint16Array(6),s=[];for(const i of e)Gv(!1,r,i,1,t,0,s);for(const i of s)i.sort(AM);n.masksTree=t,n.flatCache=W1(1e3)}function sW(e,n){e||(e="/");const t=n.flatCache.get(e);if(t!==void 0)return t;const r=$5(e,n.masksTree);return n.flatCache.set(e,r),r}function iW(e,n,t,r,s){e||(e="/"),r||(r="/");const i=n?`case\0${e}`:e;let a=s.singleCache.get(i);return a||(a=oh("/"),Gv(n,new Uint16Array(6),{from:e},1,a,0),s.singleCache.set(i,a)),$5(r,a,t)}function aW(e,n,t=!1){const r=t?e:`nofuzz\0${e}`,s=n.matchCache.get(r);if(s!==void 0)return s;e||(e="/");let i;try{i=$5(e,n.segmentTree,t)}catch(a){if(a instanceof URIError)i=null;else throw a}return i&&(i.branch=MM(i.route)),n.matchCache.set(r,i),i}function oW(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function lW(e,n=!1,t){const r=oh(e.fullPath),s=new Uint16Array(6),i=[],a={},o={};let l=0;Gv(n,s,e,1,r,0,i,u=>{if(t==null||t(u,l),u.id in a&&B5(),a[u.id]=u,l!==0&&u.path){const _=oW(u.fullPath);(!o[_]||u.fullPath.endsWith("/"))&&(o[_]=u)}l++});for(const u of i)u.sort(AM);return{processedTree:{segmentTree:r,singleCache:W1(1e3),matchCache:W1(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function $5(e,n,t=!1){const r=e.split("/"),s=uW(e,r,n,t);if(!s)return null;const[i]=RM(e,r,s);return{route:s.node.route,rawParams:i}}function RM(e,n,t){var _,d,p,m;const r=cW(t.node);let s=null;const i=Object.create(null);let a=((_=t.extract)==null?void 0:_.part)??0,o=((d=t.extract)==null?void 0:d.node)??0,l=((p=t.extract)==null?void 0:p.path)??0,u=((m=t.extract)==null?void 0:m.segment)??0;for(;o=0;N--){const T=d.wildcard[N],{prefix:z,suffix:M}=T;if(!(z&&(y||!(T.caseSensitive?C:E??(E=C.toLowerCase())).startsWith(z)))){if(M){if(y)continue;const O=n.slice(p).join("/"),B=O.slice(-M.length);if((T.caseSensitive?B:B.toLowerCase())!==M||O.length-M.length=0;T--){const z=d.optional[T];o.push({node:z,index:p,skipped:N,statics:x,dynamics:S,optionals:v,extract:b,rawParams:w})}if(!y)for(let T=d.optional.length-1;T>=0;T--){const z=d.optional[T],{prefix:M,suffix:O}=z;if(M||O){const B=z.caseSensitive?C:E??(E=C.toLowerCase());if(M&&!B.startsWith(M)||O&&B.indexOf(O,B.length-O.length)=0;N--){const T=d.dynamic[N],{prefix:z,suffix:M}=T;if(z||M){const O=T.caseSensitive?C:E??(E=C.toLowerCase());if(z&&!O.startsWith(z)||M&&O.indexOf(M,O.length-M.length)=0;N--){const T=d.pathless[N];o.push({node:T,index:p,skipped:m,statics:x,dynamics:S,optionals:v,extract:b,rawParams:w})}}if(u)return u;if(r&&l){let _=l.index;for(let p=0;pe.statics||n.statics===e.statics&&(n.dynamics>e.dynamics||n.dynamics===e.dynamics&&(n.optionals>e.optionals||n.optionals===e.optionals&&((n.node.kind===ru)>(e.node.kind===ru)||n.node.kind===ru==(e.node.kind===ru)&&n.node.depth>e.node.depth))):!0}function m1(e){return g1(e.filter(n=>n!==void 0).join("/"))}function g1(e){return e.replace(/\/{2,}/g,"/")}function DM(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Al(e){const n=e.length;return n>1&&e[n-1]==="/"?e.replace(/\/{1,}$/,""):e}function LM(e){return Al(DM(e))}function V1(e,n){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${n}/`?e.slice(0,-1):e}function fW(e,n,t){return V1(e,t)===V1(n,t)}function hW({base:e,to:n,trailingSlash:t="never",cache:r}){if(n.includes("//")&&(n=g1(n)),n.startsWith("/"))return n.length===1||t==="preserve"?n:t==="always"?n.endsWith("/")?n:`${n}/`:n.endsWith("/")?n.slice(0,-1):n;const s=n===".";let i;if(r){i=s?e:e+"\0"+n;const u=r.get(i);if(u)return u}let a;if(s)a=e.split("/");else{for(e.includes("//")&&(e=g1(e)),a=e.split("/");a.length>1&&K0(a)==="";)a.pop();const u=n.split("/");for(let _=0,d=u.length;_1?a.pop():a=[""]:p==="."||a.push(p)}}a.length>1&&(K0(a)===""?t==="never"&&a.pop():t==="always"&&a.push(""));const o=a.join("/"),l=(s?g1(o):o)||"/";return i&&r&&r.set(i,l),l}function _W(e){const n=new Map(e.map(s=>[encodeURIComponent(s),s])),t=Array.from(n.keys()).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(t,"g");return s=>s.replace(r,i=>n.get(i)??i)}function lx(e,n,t){const r=n[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(s=>E9(s,t)).join("/"):E9(r,t)}function C9({path:e,params:n,decoder:t,...r}){let s=!1;const i=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:i,isMissingParams:s};if(!e.includes("$"))return{interpolatedPath:e,usedParams:i,isMissingParams:s};const a=e.length;let o=0,l,u="";for(;oe.state.__TSR_key||e.href;function xW(e){const n=e.getAttribute(N9);if(n)return`[${N9}="${n}"]`;let t="",r=e,s;for(;s=r.parentNode;){let i=1,a=r;for(;a=a.previousElementSibling;)i++;const o=`${r.localName}:nth-child(${i})`;t=t?`${o} > ${t}`:o,r=s}return t}let Sg=!1;const v1="window";function p4(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function z9(e){const n=new Set;for(const t of e){if(t===v1)continue;const r=p4(t);r&&n.add(r)}return n}function wW(e,n){const t=e.options.scrollRestoration,r=e._scroll;t&&(r.restoring=!0);const s=e.options.getScrollRestorationKey||yW,i=new Set,a=o=>{const l=Gc[o]||(Gc[o]={});for(const u of i)u===document?l[v1]={scrollX,scrollY}:u.isConnected&&(l[xW(u)]={scrollX:u.scrollLeft,scrollY:u.scrollTop})};t&&!r.restoration&&(r.restoration=!0,Sg=!1,history.scrollRestoration="manual",document.addEventListener("scroll",o=>{Sg||i.add(o.target)},!0),e.subscribe("onBeforeLoad",o=>{o.fromLocation&&a(s(o.fromLocation)),i.clear()}),addEventListener("pagehide",()=>{a(s(e.stores.resolvedLocation.get()??e.stores.location.get())),bW()})),!r.reset&&(r.reset=!0,e.subscribe("onRendered",o=>{var S;const l=e.options.scrollRestorationBehavior,u=e.options.scrollToTopSelectors,_=r.next,d=r.hash;let p;if(i.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const m=s(o.toLocation),x=o.fromLocation&&s(o.fromLocation);if(r.restoring&&x&&x!==m){const v=Gc[x];if(v){let b=Gc[m];for(const w in v){if(w===v1){if(_)continue}else{const y=p4(w);if(!y||_&&u&&(p??(p=z9(u)),p.has(y)))continue}b||(b=Gc[m]={}),b[w]??(b[w]=v[w])}}}Sg=!0;try{const v=o.toLocation.hash,b=o.toLocation.state.__hashScrollIntoViewOptions??!0;let w=!1;if(_){!v&&u&&(p??(p=z9(u)));const y=v&&b&&d,C=r.restoring?Gc[m]:void 0;if(C)for(const E in C){const{scrollX:N,scrollY:T}=C[E];if(E===v1){if(y)continue;scrollTo({top:T,left:N,behavior:l}),w=!0}else{const z=p4(E);z&&(z.scrollLeft=N,z.scrollTop=T,p==null||p.delete(z))}}if(!v){const E={top:0,left:0,behavior:l};if(w||scrollTo(E),p)for(const N of p)N.scrollTo(E)}}!w&&v&&b&&((S=document.getElementById(v))==null||S.scrollIntoView(b))}finally{Sg=!1}}))}function SW(e,n=String){const t=new URLSearchParams;for(const r in e){const s=e[r];s!==void 0&&t.set(r,n(s))}return t.toString()}function cx(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function kW(e){const n=new URLSearchParams(e),t=Object.create(null);for(const[r,s]of n.entries()){const i=t[r];i==null?t[r]=cx(s):Array.isArray(i)?i.push(cx(s)):t[r]=[i,cx(s)]}return t}const CW=/^(?:\s|["[{\d-]|fa|nu|tr)/,EW=zW(JSON.parse),NW=jW(JSON.stringify,JSON.parse);function zW(e){return n=>{n[0]==="?"&&(n=n.substring(1));const t=kW(n);for(const r in t){const s=t[r];if(typeof s=="string")try{t[r]=e(s)}catch{}}return t}}function jW(e,n){const t=n===JSON.parse;function r(s){if(s&&typeof s=="object")try{return e(s)}catch{}else if(n&&typeof s=="string"){if(t&&!CW.test(s))return s;try{return n(s),e(s)}catch{}}return s}return s=>{const i=SW(s,r);return i?`?${i}`:""}}const ch="__root__";function TW(e){if(e.statusCode=e.statusCode||e.code||307,!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const n=new Headers(e.headers);e.href&&n.get("Location")===null&&n.set("Location",e.href);const t=new Response(null,{status:e.statusCode,headers:n});if(t.options=e,e.throw)throw t;return t}function OM(e){return e instanceof Response&&!!e.options}function AW(e){return{input:({url:n})=>{for(const t of e)n=m4(t,n);return n},output:({url:n})=>{for(let t=e.length-1;t>=0;t--)n=IM(e[t],n);return n}}}function RW(e){const n=LM(e.basepath),t=`/${n}`,r=e.caseSensitive?t:t.toLowerCase(),s=`${r}/`;return{input:({url:i})=>{const a=e.caseSensitive?i.pathname:i.pathname.toLowerCase();return a===r?i.pathname="/":a.startsWith(s)&&(i.pathname=i.pathname.slice(t.length)),i},output:({url:i})=>(i.pathname=m1(["/",n,i.pathname]),i)}}function m4(e,n){var r;const t=(r=e==null?void 0:e.input)==null?void 0:r.call(e,{url:n});if(t){if(typeof t=="string")return new URL(t);if(t instanceof URL)return t}return n}function IM(e,n){var r;const t=(r=e==null?void 0:e.output)==null?void 0:r.call(e,{url:n});if(t){if(typeof t=="string")return new URL(t);if(t instanceof URL)return t}return n}function MW(e,n){const{createMutableStore:t,createReadonlyStore:r,batch:s}=n,i=new Map,a=t("idle"),o=t(e),l=t(void 0),u=t([]),_=r(()=>u.get().map(S=>i.get(S).get())),d=r(()=>({status:a.get(),isLoading:a.get()==="pending",matches:_.get(),location:o.get(),resolvedLocation:l.get()}));function p(S){let v=i.get(S);return v||(v=t(void 0),i.set(S,v)),v}const m={status:a,location:o,resolvedLocation:l,ids:u,matches:_,byRoute:i,__store:d,getMatchStore:p,setMatches:x};function x(S){const v=u.get(),b=S.map(w=>w.routeId);s(()=>{tW(v,b)||u.set(b);for(const w of v)b.includes(w)||i.get(w).set(()=>{});for(const w of S){const y=p(w.routeId);y.get()!==w&&y.set(w)}})}return m}var ou="__TSR_index",j9="popstate",T9="beforeunload";function DW(e){let n=e.getLocation();const t=new Set,r=a=>{n=e.getLocation(),t.forEach(o=>o({location:n,action:a}))},s=a=>{e.notifyOnIndexChange??!0?r(a):n=e.getLocation()},i=async({task:a,navigateOpts:o,...l})=>{var d,p;if((o==null?void 0:o.ignoreBlocker)??!1){a();return}const u=((d=e.getBlockers)==null?void 0:d.call(e))??[],_=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&u.length&&_)for(const m of u){const x=K1(l.path,l.state);if(await m.blockerFn({currentLocation:n,nextLocation:x,action:l.type})){(p=e.onBlocked)==null||p.call(e);return}}a()};return{get location(){return n},get length(){return e.getLength()},subscribers:t,subscribe:a=>(t.add(a),()=>{t.delete(a)}),push:(a,o,l)=>{const u=n.state[ou];o=A9(u+1,o),i({task:()=>{e.pushState(a,o),r({type:"PUSH"})},navigateOpts:l,type:"PUSH",path:a,state:o})},replace:(a,o,l)=>{const u=n.state[ou];o=A9(u,o),i({task:()=>{e.replaceState(a,o),r({type:"REPLACE"})},navigateOpts:l,type:"REPLACE",path:a,state:o})},go:(a,o)=>{i({task:()=>{e.go(a),s({type:"GO",index:a})},navigateOpts:o,type:"GO"})},back:a=>{i({task:()=>{e.back((a==null?void 0:a.ignoreBlocker)??!1),s({type:"BACK"})},navigateOpts:a,type:"BACK"})},forward:a=>{i({task:()=>{e.forward((a==null?void 0:a.ignoreBlocker)??!1),s({type:"FORWARD"})},navigateOpts:a,type:"FORWARD"})},canGoBack:()=>n.state[ou]!==0,createHref:a=>e.createHref(a),block:a=>{var l;if(!e.setBlockers)return()=>{};const o=((l=e.getBlockers)==null?void 0:l.call(e))??[];return e.setBlockers([...o,a]),()=>{var _,d;const u=((_=e.getBlockers)==null?void 0:_.call(e))??[];(d=e.setBlockers)==null||d.call(e,u.filter(p=>p!==a))}},flush:()=>{var a;return(a=e.flush)==null?void 0:a.call(e)},destroy:()=>{var a;return(a=e.destroy)==null?void 0:a.call(e)},notify:r}}function A9(e,n){n||(n={});const t=P5();return{...n,key:t,__TSR_key:t,[ou]:e}}function LW(e){var T,z;const n=typeof document<"u"?window:void 0,t=n.history.pushState,r=n.history.replaceState;let s=[];const i=()=>s,a=M=>s=M,o=(M=>M),l=(()=>K1(`${n.location.pathname}${n.location.search}${n.location.hash}`,n.history.state));if(!((T=n.history.state)!=null&&T.__TSR_key)&&!((z=n.history.state)!=null&&z.key)){const M=P5();n.history.replaceState({[ou]:0,key:M,__TSR_key:M},"")}let u=l(),_,d=!1,p=!1,m=!1,x=!1;const S=()=>u;let v;const b=()=>{v&&(N._ignoreSubscribers=!0,(v[2]?n.history.pushState:n.history.replaceState)(v[1],"",v[0]),N._ignoreSubscribers=!1,v=void 0,_=void 0)},w=(M,O,B)=>{const $=o(O),U=!!v;U||(_=u),u=K1(O,B),v=[$,B,(v==null?void 0:v[2])||M],U||queueMicrotask(()=>b())},y=M=>{u=l(),N.notify({type:M})},C=async()=>{if(p){p=!1;return}const M=l(),O=M.state[ou]-u.state[ou],B=O===1,$=O===-1,U=!B&&!$||d;d=!1;const H=U?"GO":$?"BACK":"FORWARD",Y=U?{type:"GO",index:O}:{type:$?"BACK":"FORWARD"};if(m)m=!1;else{const V=i();if(typeof document<"u"&&V.length){for(const X of V)if(await X.blockerFn({currentLocation:u,nextLocation:M,action:H})){p=!0,n.history.go(1),N.notify(Y);return}}}u=l(),N.notify(Y)},E=M=>{if(x){x=!1;return}let O=!1;const B=i();if(typeof document<"u"&&B.length)for(const $ of B){const U=$.enableBeforeUnload??!0;if(U===!0){O=!0;break}if(typeof U=="function"&&U()===!0){O=!0;break}}if(O)return M.preventDefault(),M.returnValue=""},N=DW({getLocation:S,getLength:()=>n.history.length,pushState:(M,O)=>w(!0,M,O),replaceState:(M,O)=>w(!1,M,O),back:M=>(M&&(m=!0),x=!0,n.history.back()),forward:M=>{M&&(m=!0),x=!0,n.history.forward()},go:M=>{d=!0,n.history.go(M)},createHref:M=>o(M),flush:b,destroy:()=>{n.history.pushState=t,n.history.replaceState=r,n.removeEventListener(T9,E,{capture:!0}),n.removeEventListener(j9,C)},onBlocked:()=>{_&&u!==_&&(u=_)},getBlockers:i,setBlockers:a,notifyOnIndexChange:!1});return n.addEventListener(T9,E,{capture:!0}),n.addEventListener(j9,C),n.history.pushState=function(...M){const O=t.apply(n.history,M);return N._ignoreSubscribers||y("PUSH"),O},n.history.replaceState=function(...M){const O=r.apply(n.history,M);return N._ignoreSubscribers||y("REPLACE"),O},N}function OW(e){let n=e.replace(/[\x00-\x1f\x7f]/g,"");return n.startsWith("//")&&(n="/"+n.replace(/^\/+/,"")),n}function K1(e,n){const t=OW(e),r=t.indexOf("#"),s=t.indexOf("?"),i=P5();return{href:t,pathname:t.substring(0,r>0?s>0?Math.min(r,s):r:s>0?s:t.length),hash:r>-1?t.substring(r):"",search:s>-1?t.slice(s,r===-1?void 0:r):"",state:n||{[ou]:0,key:i,__TSR_key:i}}}function P5(){return(Math.random()+1).toString(36).substring(7)}function R9(e){var n,t;return e.options.loader||e.options.beforeLoad||e.lazyFn||((n=e.options.component)==null?void 0:n.preload)||((t=e.options.pendingComponent)==null?void 0:t.preload)}function Wv(e,n){return{fromLocation:n,toLocation:e,pathChanged:(n==null?void 0:n.pathname)!==e.pathname,hrefChanged:(n==null?void 0:n.href)!==e.href,hashChanged:(n==null?void 0:n.hash)!==e.hash}}function M9({key:e,__TSR_key:n,__TSR_index:t,__hashScrollIntoViewOptions:r,...s}){return s}function IW(e,n,t,r){var s,i,a,o;for(const l of n){if(r&&e._tx!==r)return;t.some(u=>u.routeId===l.routeId)||(i=(s=e.routesById[l.routeId].options).onLeave)==null||i.call(s,l)}for(const l of t){if(r&&e._tx!==r)return;(o=(a=e.routesById[l.routeId].options)[n.some(u=>u.routeId===l.routeId)?"onStay":"onEnter"])==null||o.call(a,l)}}var BW=class{constructor(e,n){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async t=>(t(),!1),this.update=t=>{const r=this.options,s=this.basepath??(r==null?void 0:r.basepath)??"/",i=this.basepath===void 0,a=r==null?void 0:r.rewrite;if(this.options={...r,...t},this.isServer=this.options.isServer??WG??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=_W(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=LW()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let u;this.resolvePathCache=W1(1e3),u=this.buildRouteTree(),this.setRoutes(u)}if(!this.stores&&this.latestLocation){const u=this.getStoreConfig(this);this.batch=u.batch,this.stores=MW(this.latestLocation,u),wW(this)}const o=this.options.basepath??"/",l=this.options.rewrite;if(i||s!==o||a!==l){this.basepath=o;const u=[],_=LM(o);_&&_!=="/"&&u.push(RW({basepath:o})),l&&u.push(l),this.rewrite=u.length===0?void 0:u.length===1?u[0]:AW(u),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const t=lW(this.routeTree,this.options.caseSensitive,(r,s)=>{r.init({originalIndex:s})});return this.options.routeMasks&&rW(this.options.routeMasks,t.processedTree),t},this.subscribe=(t,r)=>{const s={eventType:t,fn:r};return this.subscribers.add(s),()=>{this.subscribers.delete(s)}},this.emit=t=>{for(const r of this.subscribers)if(r.eventType===t.type)try{r.fn(t)}catch(s){console.error(s)}},this.parseLocation=(t,r)=>{const s=({pathname:l,search:u,hash:_,href:d,state:p})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){const b=this.options.parseSearch(u),w=this.options.stringifySearch(b);return{href:l+w+_,publicHref:l+w+_,pathname:a0(l).path,external:!1,searchStr:w,search:Vu(r==null?void 0:r.search,b),hash:a0(_.slice(1)).path,state:od(r==null?void 0:r.state,p)}}const m=new URL(d,this.origin),x=m4(this.rewrite,m),S=this.options.parseSearch(x.search),v=this.options.stringifySearch(S);return x.search=v,{href:x.href.replace(x.origin,""),publicHref:d,pathname:a0(x.pathname).path,external:!!this.rewrite&&x.origin!==this.origin,searchStr:v,search:Vu(r==null?void 0:r.search,S),hash:a0(x.hash.slice(1)).path,state:od(r==null?void 0:r.state,p)}},i=s(t),{__tempLocation:a,__tempKey:o}=i.state;if(a&&(!o||o===this.tempLocationKey)){const l=s(a);return l.state.key=i.state.key,l.state.__TSR_key=i.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:i}}return i},this.resolvePathWithBase=(t,r)=>hW({base:t,to:r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(t,r,s)=>typeof t=="string"?this.matchRoutesInternal({pathname:t,search:r},s):this.matchRoutesInternal(t,r),this.getMatchedRoutes=t=>{const r=Object.create(null),s=aW(Al(t),this.processedTree,!0);return s&&Object.assign(r,s.rawParams),[(s==null?void 0:s.branch)||[this.routesById.__root__],r,s==null?void 0:s.route]},this.buildLocation=t=>{const r=(i={})=>{var M,O;if(i.href){const B=K1(i.href,{});i={...i,to:m4(this.rewrite,new URL(B.pathname,this.origin)).pathname,search:this.options.parseSearch(B.search),hash:B.hash.slice(1)}}const a=i._fromLocation||this._pendingLocation||this.latestLocation,o=this.matchRoutesLightweight(a);i.from;const l=i.unsafeRelative==="path"?a.pathname:i.from??o[1],u=o[2],_=o[3],d=this.resolvePathWithBase(l,i.to?`${i.to}`:".");let p=D9(i.params,_);const m=this.routesByPath[Al(d)];let x;if(m)x=this.getRouteBranch(m);else if(d.includes("$"))x=[];else{const[B,$,U]=this.getMatchedRoutes(d);x=B,this.options.notFoundRoute&&(!U||U.path!=="/"&&$["**"])&&(x=[...x,this.options.notFoundRoute])}if(x.length&&zM(p))for(const B of x){const $=((M=B.options.params)==null?void 0:M.stringify)??B.options.stringifyParams;if($){p===_&&(p=Object.assign(Object.create(null),p));try{Object.assign(p,$(p))}catch{}}}const S=t.leaveParams?d:a0(C9({path:d,params:p,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let v=u;if(t._includeValidateSearch&&((O=this.options.search)!=null&&O.strict)){const B={};x.forEach($=>{if($.options.validateSearch)try{Object.assign(B,b1($.options.validateSearch,{...B,...v}))}catch{}}),v=B}v=PW(v,i,x,t._includeValidateSearch),v=Vu(u,v);const b=this.options.stringifySearch(v),w=i.hash===!0?a.hash:i.hash?Ih(i.hash,a.hash):void 0,y=w?`#${w}`:"";let C=i.state===!0?a.state:i.state?Ih(i.state,a.state):{};i.state&&(C=od(a.state,C));const E=`${S}${b}${y}`;let N,T,z=!1;if(this.rewrite){const B=new URL(E,this.origin),$=IM(this.rewrite,B);N=B.href.replace(B.origin,""),$.origin!==this.origin?(T=$.href,z=!0):T=$.pathname+$.search+$.hash}else N=eW(E),T=N;return{publicHref:T,href:N,pathname:S,search:v,searchStr:b,state:C,hash:w??"",external:z,unmaskOnReload:i.unmaskOnReload}},s=r(t);if(t.mask)s.maskedLocation=r({from:t.from,...t.mask});else if(this.options.routeMasks){const i=sW(s.pathname,this.processedTree);if(i){const a=Object.assign(Object.create(null),i.rawParams),{from:o,params:l,...u}=i.route,_=D9(l,a);s.maskedLocation=r({from:t.from,...u,params:_})}}return s},this.commitLocation=async({viewTransition:t,ignoreBlocker:r,...s})=>{let i;const a=Al(this.latestLocation.href)===Al(s.href)&&au(M9(s.state),M9(this.latestLocation.state)),o=this._commitPromise;let l;const u=new Promise(_=>{l=_});if(u.resolve=()=>{l(),o==null||o.resolve()},this._commitPromise=u,a)this.load();else{let{maskedLocation:_,hashScrollIntoView:d,...p}=s;_&&(p={..._,state:{..._.state,__tempKey:void 0,__tempLocation:{...p,search:p.searchStr,state:{...p.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(p.unmaskOnReload??this.options.unmaskOnReload??!1)&&(p.state.__tempKey=this.tempLocationKey)),p.state.__hashScrollIntoViewOptions=d??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=t,i=s.replace?"REPLACE":"PUSH",this.history[i==="REPLACE"?"replace":"push"](p.publicHref,p.state,{ignoreBlocker:r}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.next=s.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:t,resetScroll:r,hashScrollIntoView:s,viewTransition:i,ignoreBlocker:a,...o}={})=>{const l=this.buildLocation({...o,_includeValidateSearch:!0});this._pendingLocation=l;const u=this.commitLocation({...l,viewTransition:i,replace:t,resetScroll:r,hashScrollIntoView:s,ignoreBlocker:a});return queueMicrotask(()=>{this._pendingLocation===l&&(this._pendingLocation=void 0)}),u},this.navigate=async({to:t,reloadDocument:r,href:s,publicHref:i,...a})=>{var l,u;let o=!1;if(s)try{new URL(`${s}`),o=!0}catch{}if(o&&!r&&(r=!0),r){if(t!==void 0||!s){const d=this.buildLocation({to:t,...a});s=s??d.publicHref,i=i??d.publicHref}const _=!o&&i?i:s;if(G1(_,this.protocolAllowlist))return;if(!a.ignoreBlocker){const d=((u=(l=this.history).getBlockers)==null?void 0:u.call(l))??[];for(const p of d)if(p!=null&&p.blockerFn&&await p.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return}a.replace?window.location.replace(_):window.location.href=_;return}return this.buildAndCommitLocation({...a,href:s,to:t,_isNavigate:!0})},this.load=async t=>{this.updateLatestLocation(),t!=null&&t.action&&(this._scroll.hash=t.action.type==="PUSH"||t.action.type==="REPLACE"),await QW(this,t)},this.startViewTransition=t=>{var s,i;const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document.startViewTransition=="function"){let a;if(typeof r=="object"&&((i=(s=window.CSS)==null?void 0:s.supports)!=null&&i.call(s,"selector(:active-view-transition-type(a))"))){const o=this.latestLocation,l=this.stores.resolvedLocation.get(),u=typeof r.types=="function"?r.types(Wv(o,l)):r.types;if(u===!1)return t();a={update:t,types:u}}else a=t;return document.startViewTransition(a).updateCallbackDone}return t()},this.invalidate=t=>{var u,_;const r=this._committed,s=t==null?void 0:t.filter,i=this._preloads,a=new Set([...r,...this._cache.values(),...[...(i==null?void 0:i.values())??[]].flat(),...((u=this._tx)==null?void 0:u[3])??[]].filter(d=>!s||s(d)).map(d=>d.id)),o=[];for(const[d,p]of i??[])p.some(m=>a.has(m.id))&&(i.delete(d),o.push(d));const l=d=>{if(a.has(d.id)){const p=this.routesById[d.routeId],m={...d,invalid:!0,...(t!=null&&t.forcePending||d.status==="error"||d.status==="notFound")&&R9(p)?{status:"pending",error:void 0}:void 0};return d._flight=void 0,m}return d};this._committed=r.map(l);for(const[d,p]of this._cache)a.has(d)&&(p.invalid=!0,t!=null&&t.forcePending&&(p.status="pending"));for(const d of a)(_=this._flights)==null||_.delete(d);for(const d of o)d.abort();return this.shouldViewTransition=!1,this.load({sync:t==null?void 0:t.sync})},this.resolveRedirect=t=>{const r=t.headers.get("Location");if(t.options.href){if(r)try{const s=new URL(r);if(this.origin&&s.origin===this.origin){const i=s.pathname+s.search+s.hash;t.options.href=i,t.headers.set("Location",i)}}catch{}}else{const s=this.buildLocation(t.options).publicHref||"/";t.options.href=s,t.headers.set("Location",s)}if(t.options.href&&G1(t.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return t.headers.get("Location")||t.headers.set("Location",t.options.href),t},this.clearCache=t=>{var u;const r=this._cache,s=this._preloads,i=t==null?void 0:t.filter,a=[],o=[];for(const[_,d]of r)(!i||i(d))&&(o.push(_),a.push(d));const l=[];for(const[_,d]of s??[])(!i||d.some(i))&&(l.push(_),a.push(...d));for(const _ of o)r.delete(_);for(const _ of l)s.delete(_);for(const _ of a){const d=_._flight;_._flight=void 0,d&&!--d[2]&&(((u=this._flights)==null?void 0:u.get(_.id))===d&&this._flights.delete(_.id),l.push(d[1]))}for(const _ of l)_.abort()},this.loadRouteChunk=uh,this.preloadRoute=t=>YW(this,t),this.matchRoute=(t,r)=>{const s={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0,params:t.params||{},leaveParams:!0},i=this.buildLocation(s),a=this.stores.status.get()==="pending";if(r!=null&&r.pending&&!a)return!1;const o=(r==null?void 0:r.pending)??!a?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),l=iW(i.pathname,(r==null?void 0:r.caseSensitive)??!1,(r==null?void 0:r.fuzzy)??!1,o.pathname,this.processedTree);return!l||t.params&&!au(l.rawParams,t.params,{partial:!0})?!1:(r==null?void 0:r.includeSearch)??!0?au(o.search,i.search,{partial:!0})?l.rawParams:!1:l.rawParams},this.getStoreConfig=n,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??NW,parseSearch:e.parseSearch??EW,protocolAllowlist:e.protocolAllowlist??JG}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:n,processedTree:t}){this.routesById=e,this.routesByPath=n,this.processedTree=t;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let n=this.routeBranchCache.get(e);return n||(n=MM(e),this.routeBranchCache.set(e,n)),n}matchRoutesInternal(e,n){var p,m;const[t,r,s]=this.getMatchedRoutes(e.pathname);let i=t,a=!1;(s?s.path!=="/"&&r["**"]:Al(e.pathname))&&(this.options.notFoundRoute?i=[...i,this.options.notFoundRoute]:a=!0);const o=a?FW(this.options.notFoundMode,i):void 0,l=new Array(i.length),u=this._committed,_=(x,S)=>{const v=u[S];return(v==null?void 0:v.routeId)===x.id?v:x===this.options.notFoundRoute?u.find(b=>b.routeId===x.id):void 0};let d;for(let x=0;x{const m=p(l.preSearchFilters?l.preSearchFilters.reduce((x,S)=>S(x),d):d);return l.postSearchFilters?l.postSearchFilters.reduce((x,S)=>S(x),m):m};s.push(_)}const u=l.validateSearch;if(r&&u){const _=({search:d,next:p,meta:m})=>{const x=p(d);try{const S=b1(u,x);if(m&&S)for(const v in S)v in x||(m.defaulted||(m.defaulted=new Map)).set(v,S[v]);return{...x,...S}}catch{}return x};s.push(_)}}const i=(o,l,u)=>{if(o>=s.length){if(!n.search)return{};if(n.search===!0)return l;const d=Ih(n.search,l);return u&&(u.explicit=d),d}const _=(d,p)=>{if(p){const m=u||{};return{search:i(o+1,d,m),meta:m}}return i(o+1,d,u)};return s[o]({search:l,next:_,meta:u})};return i(0,e)}function FW(e,n){if(e!=="root"){let t;for(let r=n.length-1;r>=0;r--){const s=n[r];if(s.options.notFoundComponent)return s.id;t||(t=s.children&&s.id)}if(t)return t}return ch}function D9(e,n){if(e===!1||e===null)return Object.create(null);if((e??!0)===!0)return n;const t=Object.assign(Object.create(null),n);return Object.assign(t,Ih(e,t))}function L9(e,n){var r;const t=((r=e.options.params)==null?void 0:r.parse)??e.options.parseParams;t&&Object.assign(n,t(n))}function g4(e,n){var t,r;return(r=(t=e.options[n])==null?void 0:t.preload)==null?void 0:r.call(t)}function HW(e,n){const t=g4(e,"component");let r=g4(e,"pendingComponent");return n&&(r?r=r.then(n):n()),t&&r?Promise.all([t,r]).then(()=>{}):t??r}function uh(e,n,t){const r=()=>n===!1?void 0:n?g4(e,n):HW(e,t),s=e._lazy;if(s)return s===!0?r():s.then(r);if(!e.lazyFn)return r();const i=e.lazyFn().then(a=>{{const{id:o,...l}=a.options;Object.assign(e.options,l),e._lazy=!0}},a=>{throw e._lazy=void 0,a});return e._lazy=i,i.then(r)}function F5(e){const n=e.findIndex(t=>t.status!=="success"||t._notFound)+1;return n&&n{const s=()=>r(n);n.addEventListener("abort",s,{once:!0}),Promise.resolve(e).then(t,r).finally(()=>n.removeEventListener("abort",s))})}function Vd(e,n){return e.routesById[n.routeId]}function Y0(e,n,t){return OM(e)?[Hi,e]:Bh(e)?(e.routeId||(e.routeId=t),[Vv,e]):n?(typeof(e==null?void 0:e.then)=="function"&&(e=new Error("A Promise was thrown",{cause:e})),[Il,e]):[Mo,e]}function H5(e,n){var r,s;let t=Y0(n,!0,e.id);if(t[0]!==Il)return t;try{(s=(r=e.options).onError)==null||s.call(r,t[1])}catch(i){t=Y0(i,!0,e.id)}return t}function R0(e,n,t,r,s){return s[0].signal.aborted?du:G5(e,n,t,H5(t,r),s)}async function qW(e,n,t,r,s,i){var _,d;const[a,o]=n,l=t[0].signal,u=!!t[3];for(let p=t[6]??0;pe.navigate({...C,_fromLocation:a}),buildLocation:e.buildLocation,cause:u?"preload":m.cause,abortController:t[0],preload:u,matches:o,routeId:x.id};try{const C=m._ctx||(m._ctx=x.options.context?x.options.context({...v,deps:m.loaderDeps,context:S})||{}:void 0);m.context={...S,...C}}catch(C){return Rl(e,m),[p,R0(e,n,x,C,t)]}if(l.aborted)return[p,du];const b=m.paramsError??m.searchError;if(b!==void 0)return Rl(e,m),[p,R0(e,n,x,b,t)];const w=x.options.beforeLoad;if(!w)continue;const y=m.status;p>=i&&(m.status="pending",(d=t[7])==null||d.call(t));try{X0(e,m,"beforeLoad",t[0]);const C=await Wd(w({...v,search:m.search,context:m.context,...e.options.additionalContext}),l);if(l.aborted)return[p,du];const E=G5(e,n,x,Y0(C,!1,x.id),t);if(E[0]!==Mo)return Rl(e,m),[p,E];m.context={...m.context,...C}}catch(C){return Rl(e,m),[p,R0(e,n,x,C,t)]}finally{m.status=y,X0(e,m,!1,t[0])}}s()}function q5(e,n,t){var r;if(!(!t||--t[2])){if(((r=e._flights)==null?void 0:r.get(n.id))===t){const s=e._tx;if(s&&!s[0].signal.aborted&&!s[3].includes(n)&&s[3].some(i=>i.id===n.id)&&s[3].some(i=>i.isFetching==="beforeLoad"))return;e._flights.delete(n.id)}return t[1]}}function Rl(e,n){var r;const t=n._flight;n._flight=void 0,(r=q5(e,n,t))==null||r.abort()}function ki(e,n,t,r){var i;const s=[];for(const a of n)if(!(t!=null&&t.includes(a))){const o=a._flight;if(a._flight=void 0,r&&(o==null?void 0:o[2])===1&&((i=e._flights)==null?void 0:i.get(a.id))===o&&(t!=null&&t.some(l=>l.id===a.id)))o[2]=0;else{const l=q5(e,a,o);l&&s.push(l)}}for(const a of s)a.abort()}function U5(e){for(const n of e){const t=n._flight;t&&t[2]++}}function X0(e,n,t,r){var a;if(n.isFetching=t,r&&((a=e._tx)==null?void 0:a[0])!==r)return;const s=e.stores.byRoute.get(n.routeId),i=s==null?void 0:s.get();(i==null?void 0:i.id)===n.id&&s.set({...i,isFetching:t})}function BM(e,n,t,r,s,i,a){const o=n[0];return{params:t.params,location:o,navigate:l=>e.navigate({...l,_fromLocation:o}),cause:a?"preload":t.cause,abortController:s,preload:a,deps:t.loaderDeps,parentMatchPromise:i,context:t.context,route:r,...e.options.additionalContext}}async function O9(e,n,t,r,s,i,a){const o=a[0],l=o.signal;if(l.aborted)return du;if(!s)return[Mo,void 0];let u=t._flight;X0(e,t,"loader",o);try{if(!u){const _=new AbortController;u=[Promise.resolve().then(()=>s(BM(e,n,t,r,_,i,!!a[3]))).then(d=>Y0(d,!1,r.id),d=>Y0(d,!0,r.id)).then(d=>{var p;return d[0]!==Mo&&((p=e._flights)==null?void 0:p.get(t.id))===u&&(e._flights.delete(t.id),u[2]||_.abort()),d[0]===Il&&u[2]?H5(r,d[1]):d}),_,1],(e._flights??(e._flights=new Map)).set(t.id,u)}return t._flight=u,t.abortController=u[1],G5(e,n,r,await Wd(u[0],l),a)}catch(_){if(_!==l||!l.aborted)throw _;return Rl(e,t),du}finally{X0(e,t,!1,o)}}function I9(e,n,t){n[0]!==Hi&&(e.status="success",e.error=void 0,n[0]===Mo?(e.loaderData=n[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=t):e.invalid=!0)}function UW(e,n,t){const r=e._cache.get(n.id);if(r!==t||e._committed.some(i=>i.id===n.id&&i._flight===n._flight))return;const s={...n,_notFound:void 0,context:{}};s._flight&&s._flight[2]++,e._cache.set(n.id,s),r&&Rl(e,r)}function B9(e,n){return n[0]===Il||n[0]===Vv?{...e,status:n[0]===Il?"error":"notFound",error:n[1],_flight:void 0}:e}function GW(e,n,t,r,s,i,a){var $,U;const o=n[1][t],l=Vd(e,o),u=!!i[3],_=e._cache.get(o.id);let d,p=!1,m;try{if(o.status==="success"&&(d=l.options.shouldReload,typeof d=="function"&&(d=d(BM(e,n,o,l,i[0],s,u))),i[0].signal.aborted&&(m=du)),!m)if(o.status!=="success")p=!0;else{const H=u||o.preload?l.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:l.options.staleTime??e.options.defaultStaleTime??0;p=!!(o.invalid||d||d===void 0&&Date.now()-o.updatedAt>=H&&(i[5]||o.cause==="enter"||i[2].some(Y=>Y.routeId===o.routeId&&Y.id!==o.id)))}}catch(H){o.invalid=!0,Rl(e,o),m=R0(e,n,l,H,i)}const x=l.options.loader,S=typeof x=="function",v=S?x:x==null?void 0:x.handler,b=!u||l.options.preload!==!1;let w=b&&x?($=e._flights)==null?void 0:$.get(o.id):void 0;w===o._flight||m?w=void 0:w&&!p&&!u&&d===void 0?p=!0:p||(w=void 0);const y=!!(x&&p&&o.status==="success"&&!u&&!i[4]&&((S?void 0:x.staleReloadMode)??e.options.defaultStaleReloadMode)!=="blocking"),C=p&&b,E=C&&!y&&(o.status!=="success"||!!x),N=t>=a?i[7]:void 0,T=l.lazyFn&&l._lazy!==!0?N:void 0;if(C&&!x&&(o.invalid=!1,o.updatedAt=Date.now()),w&&w[2]++,E){const H=o._flight;o._flight=w,(U=q5(e,o,H))==null||U.abort(),t>=a&&(o.status="pending"),N==null||N()}C||(o.isFetching=!1);const z=(m?Promise.resolve(m):E?O9(e,n,o,l,v,s,i):Promise.resolve([Mo,o.loaderData])).then(H=>(E&&(I9(o,H,u),H[0]===Mo&&(x&&!i[0].signal.aborted&&UW(e,o,_),t>=a&&(o.status="pending"))),H)),M=Wd(Promise.resolve().then(()=>uh(l,void 0,T)),i[0].signal).then(()=>{},H=>n[1].some((Y,V)=>V<=t&&(Y.status==="error"||Y.status==="notFound"||Y._notFound))?void 0:[t,R0(e,n,l,H,i)]).then(H=>z.then(Y=>(E&&!H&&Y[0]===Mo&&o.status==="pending"&&!i[0].signal.aborted&&(o.status="success",N==null||N()),H)));if(r.push([t,z,M]),!y)return z.then(H=>B9(o,H));const O={...o,status:"pending",preload:!1,_flight:w};o.invalid=!1,o.isFetching="loader";const B=O9(e,n,O,l,v,s,i).then(H=>(o.isFetching=!1,I9(O,H,!1),H));return(n[2]??(n[2]=[])).push([t,B,M,O]),B.then(H=>B9(O,H))}async function v4(e,n,t,r,s=0){const i=t==null?void 0:t[1][1];let a=i!=null&&i.routeId?n.findIndex(o=>o.routeId===i.routeId):(t==null?void 0:t[0])??n.length-1;a<0&&(a=0);for(let o=a;o>=0;o--){const l=Vd(e,n[o]);try{const u=uh(l,!1);u&&await Wd(u,r)}catch(u){if(u===r&&r.aborted)throw u}if(l.options.notFoundComponent)return o}return i!=null&&i.routeId?a:s}function kd(e,n){n[2]&&(ki(e,n[2].map(t=>t[3])),n[2]=void 0)}async function $9(e,n,t,r){let s;try{await Promise.all(e.map(i=>i[1].then(async a=>{const o=i[0];if(!(r&&o>=await r)){if(a[0]>=Hi)throw[o,a];!s&&a[0]!==Mo&&(s=[o,a],await Promise.all((t??[]).map(l=>{if(!(l[0]<=o))return l[1].then(u=>{if(u[0]===Hi)throw[l[0],u]})})))}})))}catch(i){return i}return n??s}function G5(e,n,t,r,s,i){for(;r[0]===Hi;){const a=r[1],o=a.options;if(o.reloadDocument?s[3]:s[1]>=20)return r;try{return o.href&&o.reloadDocument?(e.resolveRedirect(a),r):[Hi,a,e.buildLocation({...o,_fromLocation:n[0],_includeValidateSearch:!0})]}catch(l){r=i?[Il,l]:H5(t,l),i=!0}}return r}async function $M(e,n,t,r,s,i){const a=n[1];let o=await s,l=!1;const u=a.findIndex(m=>m._notFound),_=m=>m[1][0]===Vv?v4(e,a,m,r.signal):m[0];let d=u<0?a.length:u;if(((o==null?void 0:o[1][0])??0)>=Hi)d=0;else if(o){d=o[2]??(o[2]=await _(o));for(const m of t){if(m[0]>=d)break;const x=await m[1];if(x[0]!==Mo&&x[0]=d)break;const x=await m[2];if(x){o=x;break}}if(((o==null?void 0:o[1][0])??0)>=Hi){const m=o[1];if(m[0]!==Hi||m[1].options.reloadDocument||m[2])return kd(e,n),m;l=!0,o=[0,[Il,new Error("Too many redirects")]]}const p=o?o[2]??await _(o):u;if(p>=0){const m=o==null?void 0:o[1],x=m==null?void 0:m[0],S=a[p],v=m==null?void 0:m[1],b=()=>{m&&(S._notFound=void 0,x===Il?S.status="error":(v.routeId=S.routeId,S.routeId===e.routeTree.id?(S.status="success",S._notFound=!0):S.status="notFound"),S.error=v,S.isFetching=!1)};b(),m||i==null||i();const w=Vd(e,S);try{await Wd(m?Promise.resolve().then(()=>uh(w,x===Il?"errorComponent":"notFoundComponent")):Promise.all([uh(w),uh(w,"notFoundComponent")]),r.signal)}catch(y){if(y===r.signal&&r.signal.aborted)return kd(e,n),du}m?l&&(r.abort(),await Promise.all([...t.map(y=>y[1]),...t.map(y=>y[2]),...(n[2]??[]).map(y=>y[1])]),kd(e,n),ki(e,a),b()):S.status="success"}return n}async function PM(e,n,t,r=0,s=n[1].length){var a,o;const i=n[1];for(let l=r;lw._notFound);if(e.options.notFoundMode!=="root"&&u>=0){const w=await v4(e,t,void 0,i,u);t[u]._notFound=void 0,t[w]._notFound=!0,u=w}let _=u<0?t.length:u+1,d=0;for(;d<_&&d!==u;){const w=t[d],y=r[2][d],C=l[d];if((y==null?void 0:y.id)!==w.id||y.status!=="success"||y._notFound||w.preload||(C==null?void 0:C.id)!==w.id||C.status!=="success"||C._notFound)break;d++}const p=[],m=r[6]??0;let x=m?Promise.resolve(t[m-1]):void 0;const S=()=>{for(let w=m;w<_&&!i.aborted;w++)x=GW(e,s,w,p,x,r,d)},v=await qW(e,s,r,_,S,d);if(v){if(r[4]=!0,_=v[0],v[1][0]===Vv){const w=await v4(e,t,v,i);v[2]=w,_=Math.min(_,w+1)}else v[1][0]>=Hi&&(_=0);S()}if(!i.aborted&&!r[3]){const w=[];for(const[y,C]of e._flights??[])C[2]||(e._flights.delete(y),w.push(C[1]));for(const y of w)y.abort()}const b=$M(e,s,p,r[0],$9(p,v,s[2]),r[7]);(o=s[2])!=null&&o.length&&(s[3]=$9(s[2],void 0,void 0,b.then(w=>Q0(w)?0:F5(t).length,()=>0))),a=await b}catch(l){if(kd(e,s),l===i&&i.aborted)return du;throw l}return Q0(a)?a:PM(e,a,i,r[6]===t.length?r[6]:0)}function b4(e,n){var i,a;if(e._tx!==n)return;const t=n[3],r=e.stores.matches.get();let s=e._pending;for(let o=0;o0){s[3]=setTimeout(()=>b4(e,n),w);return}s[2]=0}const v=t.map(w=>({...w,_flight:void 0}));v[o].status="pending";const b=s[4]=e.startTransition(()=>e.stores.setMatches(v),v).then(w=>(w&&e._pending===s&&s[4]===b&&!s[2]&&(s[2]=Date.now()+x),w));return}}function o0(e,n){var r;const t=e._pending;(e._tx===n||!((r=e._tx)!=null&&r[3].some(s=>s.id===(t==null?void 0:t[1]))))&&(clearTimeout(t==null?void 0:t[3]),e._pending=void 0)}async function P9(e,n){const t=e._pending;if(!t)return;clearTimeout(t[3]);const r=t[2]-Date.now();if(!t[4]||r<=0||!F5(n[3]).some(i=>i.id===t[1]))return;let s;try{await Wd(new Promise(i=>{s=setTimeout(i,r)}),n[0].signal)}catch{}clearTimeout(s)}function HM(e,n){e._committed=n,e.stores.setMatches(n)}function WW(e,n,t,r){const s=e._committed,i=e._cache;for(const l of t)l.preload=!1,r&&(l._assetEnd=void 0);const a=F5(t).length,o=new Map;{const l=Date.now();for(const u of[...s,...i.values()]){if(u.status!=="success"||t.some((d,p)=>d.id===u.id&&(p=(u.preload?_.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:_.options.gcTime??e.options.defaultGcTime??3e5)||o.set(u.id,i.get(u.id)===u?u:{...u,_flight:void 0,isFetching:!1,context:{}})}}n[3]=[],e._cache=o,HM(e,t),ki(e,[...i.values(),...s],[...t,...o.values()]),IW(e,s,t,n)}async function kg(e,n){let t=e._tx;for(;t&&t!==n;){if(await t[5],e._tx===t)return;t=e._tx}}function qM(e,n,t){const r=t[1].options,s=t[2];if(!s)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:s.publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});s._redirects=n[1]+1,e._pendingLocation=s;const i=e.commitLocation({...s,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===s&&(e._pendingLocation=void 0)}),i}async function VW(e,n,t,r,s){const i=t.map(l=>({...l}));U5(i);for(const l of r)Rl(e,i[l[0]]),i[l[0]]=l[3];const a=[n[2],i];let o;try{o=await $M(e,a,r,n[0],s)}catch(l){throw ki(e,i),l}if(Q0(o)){ki(e,i),o[0]===Hi&&e._tx===n&&e._committed===t&&await qM(e,n,o);return}if(await PM(e,o,n[0].signal),e._tx!==n||e._committed!==t){ki(e,i);return}for(const l of i){const u=e._cache.get(l.id);u!=null&&u._flight&&u._flight===l._flight&&(e._cache.delete(l.id),Rl(e,u))}HM(e,i),ki(e,t,i)}async function KW(e,n,t,r,s,i){const a=await FM(e,n[2],n[3],[n[0],n[1],e._committed,void 0,s,t,i,r]);if(Q0(a)){const d=a[0]===Hi&&e._tx===n;if((!d||a[1].options.reloadDocument)&&o0(e,n),ki(e,n[3]),n[3]=[],!d)return;if(e._tx!==n){o0(e,n);return}await qM(e,n,a);return}const o=a[1];if(e._tx===n&&await P9(e,n),e._tx!==n){o0(e,n),ki(e,o),kd(e,a);return}const l=n[2],u=Wv(l,e.stores.resolvedLocation.get()),_=a[2];await e.startViewTransition(async()=>{var m;if(e._tx===n&&await P9(e,n),e._tx!==n){o0(e,n),ki(e,o),kd(e,a);return}const d=()=>{o0(e,n),WW(e,n,o,i),e._tx===n&&(e.emit({type:"onLoad",...u}),e._tx===n&&e.emit({type:"onBeforeRouteMount",...u}))},p=await e.startTransition(d,o);if(e._tx!==n){kd(e,a);return}_!=null&&_.length&&VW(e,n,o,_,a[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(l),e.stores.status.set("idle"),e._tx===n&&e.emit({type:"onResolved",...u}),p&&e._tx===n&&e.emit({type:"onRendered",...u})}),e._tx===n&&((m=e._commitPromise)==null||m.resolve(),e._commitPromise=void 0)})}async function QW(e,n){var C;const t=e._tx,r=e.stores.resolvedLocation.get(),s=r??e.stores.location.get(),i=e.latestLocation,a=e._pendingLocation,o=(a==null?void 0:a.href)===i.href?a._redirects??0:0,l=e._handoff,u=l==null?void 0:l[0](),_=new AbortController,d=e._preflight;if(e._preflight=_,u||l==null||l[1](),d==null||d.abort(),!_.signal.aborted){const E=Wv(i,r);e.emit({type:"onBeforeNavigate",...E}),_.signal.aborted||e.emit({type:"onBeforeLoad",...E})}if(_.signal.aborted){await kg(e,t);return}const p=s.href===i.href;let m=_;const x=e.matchRoutes(i,{_controller:_});U5(x);const S=u?l[1](x):void 0;if(S?m=u:u==null||u.abort(),_.signal.aborted){ki(e,x),await kg(e,t);return}e._preflight=void 0;let v;const b=()=>KW(e,y,p,()=>b4(e,y),n==null?void 0:n.sync,S),w=n!=null&&n.sync?new Promise(E=>v=E):Promise.resolve().then(b).then(),y=[m,o,i,x,Date.now(),w];if(e._tx=y,t){for(const E of e.stores.matches.get()){if(e._tx!==y)break;E.isFetching&&X0(e,E,!1)}t[0].abort(),ki(e,t[3],y[3],!0)}if(e._tx!==y){ki(e,y[3]),y[3]=[],v==null||v(),await kg(e,y);return}e.batch(()=>{e.stores.status.set("pending"),e.stores.location.set(i)}),(S||!e._committed.length&&((C=x[0])==null?void 0:C.status)!=="success"&&!x.some(E=>E._notFound))&&b4(e,y),v==null||v(b()),await w,await kg(e,y)}async function YW(e,n){let t=e.buildLocation(n);for(let r=0;;r++){const s=e._committed,i=new AbortController;let a,o,l;try{try{a=e.matchRoutes(t,{_controller:i}),U5(a),o=(e._preloads??(e._preloads=new Map)).set(i,a),l=await FM(e,t,a,[i,r,s,!0])}finally{o&&(o=o.delete(i),ki(e,a)),i.abort()}if(!Q0(l))return l[1];if(!o||l.length<3)return;t=l[2]}catch(u){Bh(u)||console.error(u);return}}}const XW="Error preloading route! ☝️";var UM=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=n=>{var l,u;this.originalIndex=n.originalIndex;const t=this.options,r=!(t!=null&&t.path)&&!(t!=null&&t.id);this.parentRoute=(u=(l=this.options).getParentRoute)==null?void 0:u.call(l),r?this._path=ch:this.parentRoute||B5();let s=r?ch:t==null?void 0:t.path;s&&s!=="/"&&(s=DM(s));const i=(t==null?void 0:t.id)||s;let a=r?ch:m1([this.parentRoute.id==="__root__"?"":this.parentRoute.id,i]);s==="__root__"&&(s="/"),a!=="__root__"&&(a=m1(["/",a]));const o=a==="__root__"?"/":m1([this.parentRoute.fullPath,s]);this._path=s,this._id=a,this._fullPath=o,this._to=Al(o)},this.addChildren=n=>this._addFileChildren(n),this._addFileChildren=n=>(Array.isArray(n)&&(this.children=n),typeof n=="object"&&n!==null&&(this.children=Object.values(n)),this),this._addFileTypes=()=>this,this.updateLoader=n=>(Object.assign(this.options,n),this),this.update=n=>(Object.assign(this.options,n),this),this.lazy=n=>(this.lazyFn=n,this),this.redirect=n=>TW({from:this.fullPath,...n}),this.options=e||{},this.isRoot=!(e!=null&&e.getParentRoute),e!=null&&e.id&&(e!=null&&e.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},ZW=class extends UM{constructor(e){super(e)}},W5=class extends R.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,n){const t=e.getResetKey();return n.error&&n.resetKey!==t?{resetKey:t,error:null}:{resetKey:t}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,n){var t,r;(r=(t=this.props).onCatch)==null||r.call(t,e,n)}render(){const e=this.state.error;return e?R.createElement(this.props.errorComponent??JW,{error:e,reset:this.reset}):this.props.children}};function JW({error:e}){const[n,t]=R.useState(!1);return f.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[f.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),f.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>t(r=>!r),children:n?"Hide Error":"Show Error"})]}),f.jsx("div",{style:{height:".25rem"}}),n?f.jsx("div",{children:f.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?f.jsx("code",{children:e.message}):null})}):null]})}function eV({children:e,fallback:n=null}){return f.jsx(Je.Fragment,{children:GM()?e:n})}function GM(){return Je.useSyncExternalStore(tV,()=>!0,()=>!1)}function tV(){return()=>{}}var WM=R.createContext(null);function li(e){return R.useContext(WM)}var Kv=R.createContext(void 0),nV=R.createContext(void 0),wr=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(wr||{});function rV({update:e,notify:n,unwatched:t}){return{link:r,unlink:s,propagate:i,checkDirty:a,shallowPropagate:o};function r(u,_,d){const p=_.depsTail;if(p!==void 0&&p.dep===u)return;const m=p!==void 0?p.nextDep:_.deps;if(m!==void 0&&m.dep===u){m.version=d,_.depsTail=m;return}const x=u.subsTail;if(x!==void 0&&x.version===d&&x.sub===_)return;const S=_.depsTail=u.subsTail={version:d,dep:u,sub:_,prevDep:p,nextDep:m,prevSub:x,nextSub:void 0};m!==void 0&&(m.prevDep=S),p!==void 0?p.nextDep=S:_.deps=S,x!==void 0?x.nextSub=S:u.subs=S}function s(u,_=u.sub){const d=u.dep,p=u.prevDep,m=u.nextDep,x=u.nextSub,S=u.prevSub;return m!==void 0?m.prevDep=p:_.depsTail=p,p!==void 0?p.nextDep=m:_.deps=m,x!==void 0?x.prevSub=S:d.subsTail=S,S!==void 0?S.nextSub=x:(d.subs=x)===void 0&&t(d),m}function i(u){let _=u.nextSub,d;e:do{const p=u.sub;let m=p.flags;if(m&60?m&12?m&4?!(m&48)&&l(u,p)?(p.flags=m|40,m&=1):m=0:p.flags=m&-9|32:m=0:p.flags=m|32,m&2&&n(p),m&1){const x=p.subs;if(x!==void 0){const S=(u=x).nextSub;S!==void 0&&(d={value:_,prev:d},_=S);continue}}if((u=_)!==void 0){_=u.nextSub;continue}for(;d!==void 0;)if(u=d.value,d=d.prev,u!==void 0){_=u.nextSub;continue e}break}while(!0)}function a(u,_){let d,p=0,m=!1;e:do{const x=u.dep,S=x.flags;if(_.flags&16)m=!0;else if((S&17)===17){if(e(x)){const v=x.subs;v.nextSub!==void 0&&o(v),m=!0}}else if((S&33)===33){(u.nextSub!==void 0||u.prevSub!==void 0)&&(d={value:u,prev:d}),u=x.deps,_=x,++p;continue}if(!m){const v=u.nextDep;if(v!==void 0){u=v;continue}}for(;p--;){const v=_.subs,b=v.nextSub!==void 0;if(b?(u=d.value,d=d.prev):u=v,m){if(e(_)){b&&o(v),_=u.sub;continue}m=!1}else _.flags&=-33;_=u.sub;const w=u.nextDep;if(w!==void 0){u=w;continue e}}return m}while(!0)}function o(u){do{const _=u.sub,d=_.flags;(d&48)===32&&(_.flags=d|16,(d&6)===2&&n(_))}while((u=u.nextSub)!==void 0)}function l(u,_){let d=_.depsTail;for(;d!==void 0;){if(d===u)return!0;d=d.prevDep}return!1}}function sV(e,n,t){var i,a,o;const r=typeof e=="object",s=r?e:void 0;return{next:(i=r?e.next:e)==null?void 0:i.bind(s),error:(a=r?e.error:n)==null?void 0:a.bind(s),complete:(o=r?e.complete:t)==null?void 0:o.bind(s)}}const y4=[];let y1=0;const{link:F9,unlink:iV,propagate:aV,checkDirty:VM,shallowPropagate:H9}=rV({update(e){return e._update()},notify(e){y4[x4++]=e,e.flags&=~wr.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=wr.Mutable|wr.Dirty,Y1(e))}});let Cg=0,x4=0,ko,w4=0;function oV(e){try{++w4,e()}finally{--w4||KM()}}function Y1(e){const n=e.depsTail;let t=n!==void 0?n.nextDep:e.deps;for(;t!==void 0;)t=iV(t,e)}function KM(){if(!(w4>0)){for(;Cg{var u;s.get(),o.current?(u=a.next)==null||u.call(a,s._snapshot):o.current=!0});return{unsubscribe:()=>{l.stop()}}},_update(i){const a=ko,o=(n==null?void 0:n.compare)??Object.is;if(t)ko=s,++y1,s.depsTail=void 0;else if(i===void 0)return!1;t&&(s.flags=wr.Mutable|wr.RecursedCheck);try{const l=s._snapshot,u=typeof i=="function"?i(l):i===void 0&&t?r(l):i;return l===void 0||!o(l,u)?(s._snapshot=u,!0):!1}finally{ko=a,t&&(s.flags&=~wr.RecursedCheck),Y1(s)}}};return t?(s.flags=wr.Mutable|wr.Dirty,s.get=function(){const i=s.flags;if(i&wr.Dirty||i&wr.Pending&&VM(s.deps,s)){if(s._update()){const a=s.subs;a!==void 0&&H9(a)}}else i&wr.Pending&&(s.flags=i&~wr.Pending);return ko!==void 0&&F9(s,ko,y1),s._snapshot}):s.set=function(i){if(s._update(i)){const a=s.subs;a!==void 0&&(aV(a),H9(a),KM())}},s}function lV(e){const n=()=>{const r=ko;ko=t,++y1,t.depsTail=void 0,t.flags=wr.Watching|wr.RecursedCheck;try{return e()}finally{ko=r,t.flags&=~wr.RecursedCheck,Y1(t)}},t={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:wr.Watching|wr.RecursedCheck,notify(){const r=this.flags;r&wr.Dirty||r&wr.Pending&&VM(this.deps,this)?n():this.flags=wr.Watching},stop(){this.flags=wr.None,this.depsTail=void 0,Y1(this)}};return n(),t}var ux={exports:{}},dx={},fx={exports:{}},hx={};/** +`+k.stack}}var bt=Object.prototype.hasOwnProperty,It=e.unstable_scheduleCallback,$t=e.unstable_cancelCallback,jt=e.unstable_shouldYield,ct=e.unstable_requestPaint,ut=e.unstable_now,Ht=e.unstable_getCurrentPriorityLevel,Se=e.unstable_ImmediatePriority,Ae=e.unstable_UserBlockingPriority,Ze=e.unstable_NormalPriority,ht=e.unstable_LowPriority,wt=e.unstable_IdlePriority,en=e.log,Ve=e.unstable_setDisableYieldValue,qt=null,ln=null;function cn(c){if(typeof en=="function"&&Ve(c),ln&&typeof ln.setStrictMode=="function")try{ln.setStrictMode(qt,c)}catch{}}var Mt=Math.clz32?Math.clz32:Mr,er=Math.log,tn=Math.LN2;function Mr(c){return c>>>=0,c===0?32:31-(er(c)/tn|0)|0}var tr=256,qn=262144,Sr=4194304;function $n(c){var h=c&42;if(h!==0)return h;switch(c&-c){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return c&261888;case 262144:case 524288:case 1048576:case 2097152:return c&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return c&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return c}}function Wr(c,h,g){var k=c.pendingLanes;if(k===0)return 0;var A=0,D=c.suspendedLanes,K=c.pingedLanes;c=c.warmLanes;var ne=k&134217727;return ne!==0?(k=ne&~D,k!==0?A=$n(k):(K&=ne,K!==0?A=$n(K):g||(g=ne&~c,g!==0&&(A=$n(g))))):(ne=k&~D,ne!==0?A=$n(ne):K!==0?A=$n(K):g||(g=k&~c,g!==0&&(A=$n(g)))),A===0?0:h!==0&&h!==A&&(h&D)===0&&(D=A&-A,g=h&-h,D>=g||D===32&&(g&4194048)!==0)?h:A}function kr(c,h){return(c.pendingLanes&~(c.suspendedLanes&~c.pingedLanes)&h)===0}function gt(c,h){switch(c){case 1:case 2:case 4:case 8:case 64:return h+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return h+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function un(){var c=Sr;return Sr<<=1,(Sr&62914560)===0&&(Sr=4194304),c}function vn(c){for(var h=[],g=0;31>g;g++)h.push(c);return h}function Zt(c,h){c.pendingLanes|=h,h!==268435456&&(c.suspendedLanes=0,c.pingedLanes=0,c.warmLanes=0)}function Kn(c,h,g,k,A,D){var K=c.pendingLanes;c.pendingLanes=g,c.suspendedLanes=0,c.pingedLanes=0,c.warmLanes=0,c.expiredLanes&=g,c.entangledLanes&=g,c.errorRecoveryDisabledLanes&=g,c.shellSuspendCounter=0;var ne=c.entanglements,_e=c.expirationTimes,Ce=c.hiddenUpdates;for(g=K&~g;0"u")return null;try{return c.activeElement||c.body}catch{return c.body}}var ls=/[\n"\\]/g;function Un(c){return c.replace(ls,function(h){return"\\"+h.charCodeAt(0).toString(16)+" "})}function Vr(c,h,g,k,A,D,K,ne){c.name="",K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?c.type=K:c.removeAttribute("type"),h!=null?K==="number"?(h===0&&c.value===""||c.value!=h)&&(c.value=""+Pn(h)):c.value!==""+Pn(h)&&(c.value=""+Pn(h)):K!=="submit"&&K!=="reset"||c.removeAttribute("value"),h!=null?na(c,K,Pn(h)):g!=null?na(c,K,Pn(g)):k!=null&&c.removeAttribute("value"),A==null&&D!=null&&(c.defaultChecked=!!D),A!=null&&(c.checked=A&&typeof A!="function"&&typeof A!="symbol"),ne!=null&&typeof ne!="function"&&typeof ne!="symbol"&&typeof ne!="boolean"?c.name=""+Pn(ne):c.removeAttribute("name")}function $r(c,h,g,k,A,D,K,ne){if(D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(c.type=D),h!=null||g!=null){if(!(D!=="submit"&&D!=="reset"||h!=null)){js(c);return}g=g!=null?""+Pn(g):"",h=h!=null?""+Pn(h):g,ne||h===c.value||(c.value=h),c.defaultValue=h}k=k??A,k=typeof k!="function"&&typeof k!="symbol"&&!!k,c.checked=ne?c.checked:!!k,c.defaultChecked=!!k,K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"&&(c.name=K),js(c)}function na(c,h,g){h==="number"&&Hs(c.ownerDocument)===c||c.defaultValue===""+g||(c.defaultValue=""+g)}function oi(c,h,g,k){if(c=c.options,h){h={};for(var A=0;A"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ni=!1;if(pt)try{var dr={};Object.defineProperty(dr,"passive",{get:function(){Ni=!0}}),window.addEventListener("test",dr,dr),window.removeEventListener("test",dr,dr)}catch{Ni=!1}var Cr=null,Us=null,ja=null;function zi(){if(ja)return ja;var c,h=Us,g=h.length,k,A="value"in Cr?Cr.value:Cr.textContent,D=A.length;for(c=0;c=Kr),rc=" ",Nu=!1;function zu(c,h){switch(c){case"keyup":return Eu.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ma(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var se=!1;function ye(c,h){switch(c){case"compositionend":return Ma(h);case"keypress":return h.which!==32?null:(Nu=!0,rc);case"textInput":return c=h.data,c===rc&&Nu?null:c;default:return null}}function Te(c,h){if(se)return c==="compositionend"||!Ra&&zu(c,h)?(c=zi(),ja=Us=Cr=null,se=!1,c):null;switch(c){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1=h)return{node:g,offset:h-c};c=k}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=x_(g)}}function S_(c,h){return c&&h?c===h?!0:c&&c.nodeType===3?!1:h&&h.nodeType===3?S_(c,h.parentNode):"contains"in c?c.contains(h):c.compareDocumentPosition?!!(c.compareDocumentPosition(h)&16):!1:!1}function k_(c){c=c!=null&&c.ownerDocument!=null&&c.ownerDocument.defaultView!=null?c.ownerDocument.defaultView:window;for(var h=Hs(c.document);h instanceof c.HTMLIFrameElement;){try{var g=typeof h.contentWindow.location.href=="string"}catch{g=!1}if(g)c=h.contentWindow;else break;h=Hs(c.document)}return h}function cf(c){var h=c&&c.nodeName&&c.nodeName.toLowerCase();return h&&(h==="input"&&(c.type==="text"||c.type==="search"||c.type==="tel"||c.type==="url"||c.type==="password")||h==="textarea"||c.contentEditable==="true")}var Hn=pt&&"documentMode"in document&&11>=document.documentMode,di=null,La=null,zr=null,ic=!1;function fr(c,h,g){var k=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;ic||di==null||di!==Hs(k)||(k=di,"selectionStart"in k&&cf(k)?k={start:k.selectionStart,end:k.selectionEnd}:(k=(k.ownerDocument&&k.ownerDocument.defaultView||window).getSelection(),k={anchorNode:k.anchorNode,anchorOffset:k.anchorOffset,focusNode:k.focusNode,focusOffset:k.focusOffset}),zr&&sc(zr,k)||(zr=k,k=ig(La,"onSelect"),0>=K,A-=K,_o=1<<32-Mt(h)+A|g<an?(yn=yt,yt=null):yn=yt.sibling;var An=Ee(xe,yt,ke[an],Oe);if(An===null){yt===null&&(yt=yn);break}c&&yt&&An.alternate===null&&h(xe,yt),me=D(An,me,an),Tn===null?Rt=An:Tn.sibling=An,Tn=An,yt=yn}if(an===ke.length)return g(xe,yt),kn&&nl(xe,an),Rt;if(yt===null){for(;anan?(yn=yt,yt=null):yn=yt.sibling;var Nc=Ee(xe,yt,An.value,Oe);if(Nc===null){yt===null&&(yt=yn);break}c&&yt&&Nc.alternate===null&&h(xe,yt),me=D(Nc,me,an),Tn===null?Rt=Nc:Tn.sibling=Nc,Tn=Nc,yt=yn}if(An.done)return g(xe,yt),kn&&nl(xe,an),Rt;if(yt===null){for(;!An.done;an++,An=ke.next())An=Ie(xe,An.value,Oe),An!==null&&(me=D(An,me,an),Tn===null?Rt=An:Tn.sibling=An,Tn=An);return kn&&nl(xe,an),Rt}for(yt=k(yt);!An.done;an++,An=ke.next())An=je(yt,xe,an,An.value,Oe),An!==null&&(c&&An.alternate!==null&&yt.delete(An.key===null?an:An.key),me=D(An,me,an),Tn===null?Rt=An:Tn.sibling=An,Tn=An);return c&&yt.forEach(function(JU){return h(xe,JU)}),kn&&nl(xe,an),Rt}function Jn(xe,me,ke,Oe){if(typeof ke=="object"&&ke!==null&&ke.type===S&&ke.key===null&&(ke=ke.props.children),typeof ke=="object"&&ke!==null){switch(ke.$$typeof){case m:e:{for(var Rt=ke.key;me!==null;){if(me.key===Rt){if(Rt=ke.type,Rt===S){if(me.tag===7){g(xe,me.sibling),Oe=A(me,ke.props.children),Oe.return=xe,xe=Oe;break e}}else if(me.elementType===Rt||typeof Rt=="object"&&Rt!==null&&Rt.$$typeof===z&&Ou(Rt)===me.type){g(xe,me.sibling),Oe=A(me,ke.props),T_(Oe,ke),Oe.return=xe,xe=Oe;break e}g(xe,me);break}else h(xe,me);me=me.sibling}ke.type===S?(Oe=Au(ke.props.children,xe.mode,Oe,ke.key),Oe.return=xe,xe=Oe):(Oe=wm(ke.type,ke.key,ke.props,null,xe.mode,Oe),T_(Oe,ke),Oe.return=xe,xe=Oe)}return K(xe);case x:e:{for(Rt=ke.key;me!==null;){if(me.key===Rt)if(me.tag===4&&me.stateNode.containerInfo===ke.containerInfo&&me.stateNode.implementation===ke.implementation){g(xe,me.sibling),Oe=A(me,ke.children||[]),Oe.return=xe,xe=Oe;break e}else{g(xe,me);break}else h(xe,me);me=me.sibling}Oe=by(ke,xe.mode,Oe),Oe.return=xe,xe=Oe}return K(xe);case z:return ke=Ou(ke),Jn(xe,me,ke,Oe)}if(Y(ke))return mt(xe,me,ke,Oe);if($(ke)){if(Rt=$(ke),typeof Rt!="function")throw Error(r(150));return ke=Rt.call(ke),Bt(xe,me,ke,Oe)}if(typeof ke.then=="function")return Jn(xe,me,jm(ke),Oe);if(ke.$$typeof===y)return Jn(xe,me,Cm(xe,ke),Oe);Tm(xe,ke)}return typeof ke=="string"&&ke!==""||typeof ke=="number"||typeof ke=="bigint"?(ke=""+ke,me!==null&&me.tag===6?(g(xe,me.sibling),Oe=A(me,ke),Oe.return=xe,xe=Oe):(g(xe,me),Oe=vy(ke,xe.mode,Oe),Oe.return=xe,xe=Oe),K(xe)):g(xe,me)}return function(xe,me,ke,Oe){try{j_=0;var Rt=Jn(xe,me,ke,Oe);return yf=null,Rt}catch(yt){if(yt===bf||yt===Nm)throw yt;var Tn=ji(29,yt,null,xe.mode);return Tn.lanes=Oe,Tn.return=xe,Tn}finally{}}}var Bu=d7(!0),f7=d7(!1),uc=!1;function Ay(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ry(c,h){c=c.updateQueue,h.updateQueue===c&&(h.updateQueue={baseState:c.baseState,firstBaseUpdate:c.firstBaseUpdate,lastBaseUpdate:c.lastBaseUpdate,shared:c.shared,callbacks:null})}function dc(c){return{lane:c,tag:0,payload:null,callback:null,next:null}}function fc(c,h,g){var k=c.updateQueue;if(k===null)return null;if(k=k.shared,(Mn&2)!==0){var A=k.pending;return A===null?h.next=h:(h.next=A.next,A.next=h),k.pending=h,h=xm(c),Qk(c,null,g),h}return ym(c,k,h,g),xm(c)}function A_(c,h,g){if(h=h.updateQueue,h!==null&&(h=h.shared,(g&4194048)!==0)){var k=h.lanes;k&=c.pendingLanes,g|=k,h.lanes=g,Nn(c,g)}}function My(c,h){var g=c.updateQueue,k=c.alternate;if(k!==null&&(k=k.updateQueue,g===k)){var A=null,D=null;if(g=g.firstBaseUpdate,g!==null){do{var K={lane:g.lane,tag:g.tag,payload:g.payload,callback:null,next:null};D===null?A=D=K:D=D.next=K,g=g.next}while(g!==null);D===null?A=D=h:D=D.next=h}else A=D=h;g={baseState:k.baseState,firstBaseUpdate:A,lastBaseUpdate:D,shared:k.shared,callbacks:k.callbacks},c.updateQueue=g;return}c=g.lastBaseUpdate,c===null?g.firstBaseUpdate=h:c.next=h,g.lastBaseUpdate=h}var Dy=!1;function R_(){if(Dy){var c=vf;if(c!==null)throw c}}function M_(c,h,g,k){Dy=!1;var A=c.updateQueue;uc=!1;var D=A.firstBaseUpdate,K=A.lastBaseUpdate,ne=A.shared.pending;if(ne!==null){A.shared.pending=null;var _e=ne,Ce=_e.next;_e.next=null,K===null?D=Ce:K.next=Ce,K=_e;var Me=c.alternate;Me!==null&&(Me=Me.updateQueue,ne=Me.lastBaseUpdate,ne!==K&&(ne===null?Me.firstBaseUpdate=Ce:ne.next=Ce,Me.lastBaseUpdate=_e))}if(D!==null){var Ie=A.baseState;K=0,Me=Ce=_e=null,ne=D;do{var Ee=ne.lane&-536870913,je=Ee!==ne.lane;if(je?(bn&Ee)===Ee:(k&Ee)===Ee){Ee!==0&&Ee===gf&&(Dy=!0),Me!==null&&(Me=Me.next={lane:0,tag:ne.tag,payload:ne.payload,callback:null,next:null});e:{var mt=c,Bt=ne;Ee=h;var Jn=g;switch(Bt.tag){case 1:if(mt=Bt.payload,typeof mt=="function"){Ie=mt.call(Jn,Ie,Ee);break e}Ie=mt;break e;case 3:mt.flags=mt.flags&-65537|128;case 0:if(mt=Bt.payload,Ee=typeof mt=="function"?mt.call(Jn,Ie,Ee):mt,Ee==null)break e;Ie=d({},Ie,Ee);break e;case 2:uc=!0}}Ee=ne.callback,Ee!==null&&(c.flags|=64,je&&(c.flags|=8192),je=A.callbacks,je===null?A.callbacks=[Ee]:je.push(Ee))}else je={lane:Ee,tag:ne.tag,payload:ne.payload,callback:ne.callback,next:null},Me===null?(Ce=Me=je,_e=Ie):Me=Me.next=je,K|=Ee;if(ne=ne.next,ne===null){if(ne=A.shared.pending,ne===null)break;je=ne,ne=je.next,je.next=null,A.lastBaseUpdate=je,A.shared.pending=null}}while(!0);Me===null&&(_e=Ie),A.baseState=_e,A.firstBaseUpdate=Ce,A.lastBaseUpdate=Me,D===null&&(A.shared.lanes=0),gc|=K,c.lanes=K,c.memoizedState=Ie}}function h7(c,h){if(typeof c!="function")throw Error(r(191,c));c.call(h)}function _7(c,h){var g=c.callbacks;if(g!==null)for(c.callbacks=null,c=0;cD?D:8;var K=V.T,ne={};V.T=ne,Jy(c,!1,h,g);try{var _e=A(),Ce=V.S;if(Ce!==null&&Ce(ne,_e),_e!==null&&typeof _e=="object"&&typeof _e.then=="function"){var Me=Hq(_e,k);O_(c,h,Me,Di(c))}else O_(c,h,k,Di(c))}catch(Ie){O_(c,h,{then:function(){},status:"rejected",reason:Ie},Di())}finally{X.p=D,K!==null&&ne.types!==null&&(K.types=ne.types),V.T=K}}function Kq(){}function Xy(c,h,g,k){if(c.tag!==5)throw Error(r(476));var A=W7(c).queue;G7(c,A,h,ee,g===null?Kq:function(){return V7(c),g(k)})}function W7(c){var h=c.memoizedState;if(h!==null)return h;h={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:al,lastRenderedState:ee},next:null};var g={};return h.next={memoizedState:g,baseState:g,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:al,lastRenderedState:g},next:null},c.memoizedState=h,c=c.alternate,c!==null&&(c.memoizedState=h),h}function V7(c){var h=W7(c);h.next===null&&(h=c.alternate.memoizedState),O_(c,h.next.queue,{},Di())}function Zy(){return Ss(J_)}function K7(){return Hr().memoizedState}function Q7(){return Hr().memoizedState}function Qq(c){for(var h=c.return;h!==null;){switch(h.tag){case 24:case 3:var g=Di();c=dc(g);var k=fc(h,c,g);k!==null&&(mi(k,h,g),A_(k,h,g)),h={cache:Ny()},c.payload=h;return}h=h.return}}function Yq(c,h,g){var k=Di();g={lane:k,revertLane:0,gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},Pm(c)?X7(h,g):(g=my(c,h,g,k),g!==null&&(mi(g,c,k),Z7(g,h,k)))}function Y7(c,h,g){var k=Di();O_(c,h,g,k)}function O_(c,h,g,k){var A={lane:k,revertLane:0,gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null};if(Pm(c))X7(h,A);else{var D=c.alternate;if(c.lanes===0&&(D===null||D.lanes===0)&&(D=h.lastRenderedReducer,D!==null))try{var K=h.lastRenderedState,ne=D(K,g);if(A.hasEagerState=!0,A.eagerState=ne,lr(ne,K))return ym(c,h,A,0),rr===null&&bm(),!1}catch{}finally{}if(g=my(c,h,A,k),g!==null)return mi(g,c,k),Z7(g,h,k),!0}return!1}function Jy(c,h,g,k){if(k={lane:2,revertLane:A2(),gesture:null,action:k,hasEagerState:!1,eagerState:null,next:null},Pm(c)){if(h)throw Error(r(479))}else h=my(c,g,k,2),h!==null&&mi(h,c,2)}function Pm(c){var h=c.alternate;return c===nn||h!==null&&h===nn}function X7(c,h){wf=Mm=!0;var g=c.pending;g===null?h.next=h:(h.next=g.next,g.next=h),c.pending=h}function Z7(c,h,g){if((g&4194048)!==0){var k=h.lanes;k&=c.pendingLanes,g|=k,h.lanes=g,Nn(c,g)}}var I_={readContext:Ss,use:Om,useCallback:Lr,useContext:Lr,useEffect:Lr,useImperativeHandle:Lr,useLayoutEffect:Lr,useInsertionEffect:Lr,useMemo:Lr,useReducer:Lr,useRef:Lr,useState:Lr,useDebugValue:Lr,useDeferredValue:Lr,useTransition:Lr,useSyncExternalStore:Lr,useId:Lr,useHostTransitionStatus:Lr,useFormState:Lr,useActionState:Lr,useOptimistic:Lr,useMemoCache:Lr,useCacheRefresh:Lr};I_.useEffectEvent=Lr;var J7={readContext:Ss,use:Om,useCallback:function(c,h){return Ws().memoizedState=[c,h===void 0?null:h],c},useContext:Ss,useEffect:O7,useImperativeHandle:function(c,h,g){g=g!=null?g.concat([c]):null,Bm(4194308,4,P7.bind(null,h,c),g)},useLayoutEffect:function(c,h){return Bm(4194308,4,c,h)},useInsertionEffect:function(c,h){Bm(4,2,c,h)},useMemo:function(c,h){var g=Ws();h=h===void 0?null:h;var k=c();if($u){cn(!0);try{c()}finally{cn(!1)}}return g.memoizedState=[k,h],k},useReducer:function(c,h,g){var k=Ws();if(g!==void 0){var A=g(h);if($u){cn(!0);try{g(h)}finally{cn(!1)}}}else A=h;return k.memoizedState=k.baseState=A,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:A},k.queue=c,c=c.dispatch=Yq.bind(null,nn,c),[k.memoizedState,c]},useRef:function(c){var h=Ws();return c={current:c},h.memoizedState=c},useState:function(c){c=Wy(c);var h=c.queue,g=Y7.bind(null,nn,h);return h.dispatch=g,[c.memoizedState,g]},useDebugValue:Qy,useDeferredValue:function(c,h){var g=Ws();return Yy(g,c,h)},useTransition:function(){var c=Wy(!1);return c=G7.bind(null,nn,c.queue,!0,!1),Ws().memoizedState=c,[!1,c]},useSyncExternalStore:function(c,h,g){var k=nn,A=Ws();if(kn){if(g===void 0)throw Error(r(407));g=g()}else{if(g=h(),rr===null)throw Error(r(349));(bn&127)!==0||y7(k,h,g)}A.memoizedState=g;var D={value:g,getSnapshot:h};return A.queue=D,O7(w7.bind(null,k,D,c),[c]),k.flags|=2048,kf(9,{destroy:void 0},x7.bind(null,k,D,g,h),null),g},useId:function(){var c=Ws(),h=rr.identifierPrefix;if(kn){var g=po,k=_o;g=(k&~(1<<32-Mt(k)-1)).toString(32)+g,h="_"+h+"R_"+g,g=Dm++,0<\/script>",D=D.removeChild(D.firstChild);break;case"select":D=typeof k.is=="string"?K.createElement("select",{is:k.is}):K.createElement("select"),k.multiple?D.multiple=!0:k.size&&(D.size=k.size);break;default:D=typeof k.is=="string"?K.createElement(A,{is:k.is}):K.createElement(A)}}D[xn]=h,D[Ut]=k;e:for(K=h.child;K!==null;){if(K.tag===5||K.tag===6)D.appendChild(K.stateNode);else if(K.tag!==4&&K.tag!==27&&K.child!==null){K.child.return=K,K=K.child;continue}if(K===h)break e;for(;K.sibling===null;){if(K.return===null||K.return===h)break e;K=K.return}K.sibling.return=K.return,K=K.sibling}h.stateNode=D;e:switch(Cs(D,A,k),A){case"button":case"input":case"select":case"textarea":k=!!k.autoFocus;break e;case"img":k=!0;break e;default:k=!1}k&&ll(h)}}return _r(h),h2(h,h.type,c===null?null:c.memoizedProps,h.pendingProps,g),null;case 6:if(c&&h.stateNode!=null)c.memoizedProps!==k&&ll(h);else{if(typeof k!="string"&&h.stateNode===null)throw Error(r(166));if(c=oe.current,pf(h)){if(c=h.stateNode,g=h.memoizedProps,k=null,A=ws,A!==null)switch(A.tag){case 27:case 5:k=A.memoizedProps}c[xn]=h,c=!!(c.nodeValue===g||k!==null&&k.suppressHydrationWarning===!0||vC(c.nodeValue,g)),c||lc(h,!0)}else c=ag(c).createTextNode(k),c[xn]=h,h.stateNode=c}return _r(h),null;case 31:if(g=h.memoizedState,c===null||c.memoizedState!==null){if(k=pf(h),g!==null){if(c===null){if(!k)throw Error(r(318));if(c=h.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(r(557));c[xn]=h}else Ru(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;_r(h),c=!1}else g=Sy(),c!==null&&c.memoizedState!==null&&(c.memoizedState.hydrationErrors=g),c=!0;if(!c)return h.flags&256?(Ai(h),h):(Ai(h),null);if((h.flags&128)!==0)throw Error(r(558))}return _r(h),null;case 13:if(k=h.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(A=pf(h),k!==null&&k.dehydrated!==null){if(c===null){if(!A)throw Error(r(318));if(A=h.memoizedState,A=A!==null?A.dehydrated:null,!A)throw Error(r(317));A[xn]=h}else Ru(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;_r(h),A=!1}else A=Sy(),c!==null&&c.memoizedState!==null&&(c.memoizedState.hydrationErrors=A),A=!0;if(!A)return h.flags&256?(Ai(h),h):(Ai(h),null)}return Ai(h),(h.flags&128)!==0?(h.lanes=g,h):(g=k!==null,c=c!==null&&c.memoizedState!==null,g&&(k=h.child,A=null,k.alternate!==null&&k.alternate.memoizedState!==null&&k.alternate.memoizedState.cachePool!==null&&(A=k.alternate.memoizedState.cachePool.pool),D=null,k.memoizedState!==null&&k.memoizedState.cachePool!==null&&(D=k.memoizedState.cachePool.pool),D!==A&&(k.flags|=2048)),g!==c&&g&&(h.child.flags|=8192),Gm(h,h.updateQueue),_r(h),null);case 4:return le(),c===null&&L2(h.stateNode.containerInfo),_r(h),null;case 10:return sl(h.type),_r(h),null;case 19:if(q(Fr),k=h.memoizedState,k===null)return _r(h),null;if(A=(h.flags&128)!==0,D=k.rendering,D===null)if(A)$_(k,!1);else{if(Or!==0||c!==null&&(c.flags&128)!==0)for(c=h.child;c!==null;){if(D=Rm(c),D!==null){for(h.flags|=128,$_(k,!1),c=D.updateQueue,h.updateQueue=c,Gm(h,c),h.subtreeFlags=0,c=g,g=h.child;g!==null;)Yk(g,c),g=g.sibling;return G(Fr,Fr.current&1|2),kn&&nl(h,k.treeForkCount),h.child}c=c.sibling}k.tail!==null&&ut()>Ym&&(h.flags|=128,A=!0,$_(k,!1),h.lanes=4194304)}else{if(!A)if(c=Rm(D),c!==null){if(h.flags|=128,A=!0,c=c.updateQueue,h.updateQueue=c,Gm(h,c),$_(k,!0),k.tail===null&&k.tailMode==="hidden"&&!D.alternate&&!kn)return _r(h),null}else 2*ut()-k.renderingStartTime>Ym&&g!==536870912&&(h.flags|=128,A=!0,$_(k,!1),h.lanes=4194304);k.isBackwards?(D.sibling=h.child,h.child=D):(c=k.last,c!==null?c.sibling=D:h.child=D,k.last=D)}return k.tail!==null?(c=k.tail,k.rendering=c,k.tail=c.sibling,k.renderingStartTime=ut(),c.sibling=null,g=Fr.current,G(Fr,A?g&1|2:g&1),kn&&nl(h,k.treeForkCount),c):(_r(h),null);case 22:case 23:return Ai(h),Oy(),k=h.memoizedState!==null,c!==null?c.memoizedState!==null!==k&&(h.flags|=8192):k&&(h.flags|=8192),k?(g&536870912)!==0&&(h.flags&128)===0&&(_r(h),h.subtreeFlags&6&&(h.flags|=8192)):_r(h),g=h.updateQueue,g!==null&&Gm(h,g.retryQueue),g=null,c!==null&&c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),k=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(k=h.memoizedState.cachePool.pool),k!==g&&(h.flags|=2048),c!==null&&q(Lu),null;case 24:return g=null,c!==null&&(g=c.memoizedState.cache),h.memoizedState.cache!==g&&(h.flags|=2048),sl(Qr),_r(h),null;case 25:return null;case 30:return null}throw Error(r(156,h.tag))}function tU(c,h){switch(xy(h),h.tag){case 1:return c=h.flags,c&65536?(h.flags=c&-65537|128,h):null;case 3:return sl(Qr),le(),c=h.flags,(c&65536)!==0&&(c&128)===0?(h.flags=c&-65537|128,h):null;case 26:case 27:case 5:return de(h),null;case 31:if(h.memoizedState!==null){if(Ai(h),h.alternate===null)throw Error(r(340));Ru()}return c=h.flags,c&65536?(h.flags=c&-65537|128,h):null;case 13:if(Ai(h),c=h.memoizedState,c!==null&&c.dehydrated!==null){if(h.alternate===null)throw Error(r(340));Ru()}return c=h.flags,c&65536?(h.flags=c&-65537|128,h):null;case 19:return q(Fr),null;case 4:return le(),null;case 10:return sl(h.type),null;case 22:case 23:return Ai(h),Oy(),c!==null&&q(Lu),c=h.flags,c&65536?(h.flags=c&-65537|128,h):null;case 24:return sl(Qr),null;case 25:return null;default:return null}}function S8(c,h){switch(xy(h),h.tag){case 3:sl(Qr),le();break;case 26:case 27:case 5:de(h);break;case 4:le();break;case 31:h.memoizedState!==null&&Ai(h);break;case 13:Ai(h);break;case 19:q(Fr);break;case 10:sl(h.type);break;case 22:case 23:Ai(h),Oy(),c!==null&&q(Lu);break;case 24:sl(Qr)}}function P_(c,h){try{var g=h.updateQueue,k=g!==null?g.lastEffect:null;if(k!==null){var A=k.next;g=A;do{if((g.tag&c)===c){k=void 0;var D=g.create,K=g.inst;k=D(),K.destroy=k}g=g.next}while(g!==A)}}catch(ne){Wn(h,h.return,ne)}}function pc(c,h,g){try{var k=h.updateQueue,A=k!==null?k.lastEffect:null;if(A!==null){var D=A.next;k=D;do{if((k.tag&c)===c){var K=k.inst,ne=K.destroy;if(ne!==void 0){K.destroy=void 0,A=h;var _e=g,Ce=ne;try{Ce()}catch(Me){Wn(A,_e,Me)}}}k=k.next}while(k!==D)}}catch(Me){Wn(h,h.return,Me)}}function k8(c){var h=c.updateQueue;if(h!==null){var g=c.stateNode;try{_7(h,g)}catch(k){Wn(c,c.return,k)}}}function C8(c,h,g){g.props=Pu(c.type,c.memoizedProps),g.state=c.memoizedState;try{g.componentWillUnmount()}catch(k){Wn(c,h,k)}}function F_(c,h){try{var g=c.ref;if(g!==null){switch(c.tag){case 26:case 27:case 5:var k=c.stateNode;break;case 30:k=c.stateNode;break;default:k=c.stateNode}typeof g=="function"?c.refCleanup=g(k):g.current=k}}catch(A){Wn(c,h,A)}}function mo(c,h){var g=c.ref,k=c.refCleanup;if(g!==null)if(typeof k=="function")try{k()}catch(A){Wn(c,h,A)}finally{c.refCleanup=null,c=c.alternate,c!=null&&(c.refCleanup=null)}else if(typeof g=="function")try{g(null)}catch(A){Wn(c,h,A)}else g.current=null}function E8(c){var h=c.type,g=c.memoizedProps,k=c.stateNode;try{e:switch(h){case"button":case"input":case"select":case"textarea":g.autoFocus&&k.focus();break e;case"img":g.src?k.src=g.src:g.srcSet&&(k.srcset=g.srcSet)}}catch(A){Wn(c,c.return,A)}}function _2(c,h,g){try{var k=c.stateNode;SU(k,c.type,g,h),k[Ut]=h}catch(A){Wn(c,c.return,A)}}function N8(c){return c.tag===5||c.tag===3||c.tag===26||c.tag===27&&wc(c.type)||c.tag===4}function p2(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||N8(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.tag===27&&wc(c.type)||c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function m2(c,h,g){var k=c.tag;if(k===5||k===6)c=c.stateNode,h?(g.nodeType===9?g.body:g.nodeName==="HTML"?g.ownerDocument.body:g).insertBefore(c,h):(h=g.nodeType===9?g.body:g.nodeName==="HTML"?g.ownerDocument.body:g,h.appendChild(c),g=g._reactRootContainer,g!=null||h.onclick!==null||(h.onclick=Pr));else if(k!==4&&(k===27&&wc(c.type)&&(g=c.stateNode,h=null),c=c.child,c!==null))for(m2(c,h,g),c=c.sibling;c!==null;)m2(c,h,g),c=c.sibling}function Wm(c,h,g){var k=c.tag;if(k===5||k===6)c=c.stateNode,h?g.insertBefore(c,h):g.appendChild(c);else if(k!==4&&(k===27&&wc(c.type)&&(g=c.stateNode),c=c.child,c!==null))for(Wm(c,h,g),c=c.sibling;c!==null;)Wm(c,h,g),c=c.sibling}function z8(c){var h=c.stateNode,g=c.memoizedProps;try{for(var k=c.type,A=h.attributes;A.length;)h.removeAttributeNode(A[0]);Cs(h,k,g),h[xn]=c,h[Ut]=g}catch(D){Wn(c,c.return,D)}}var cl=!1,Zr=!1,g2=!1,j8=typeof WeakSet=="function"?WeakSet:Set,bs=null;function nU(c,h){if(c=c.containerInfo,B2=hg,c=k_(c),cf(c)){if("selectionStart"in c)var g={start:c.selectionStart,end:c.selectionEnd};else e:{g=(g=c.ownerDocument)&&g.defaultView||window;var k=g.getSelection&&g.getSelection();if(k&&k.rangeCount!==0){g=k.anchorNode;var A=k.anchorOffset,D=k.focusNode;k=k.focusOffset;try{g.nodeType,D.nodeType}catch{g=null;break e}var K=0,ne=-1,_e=-1,Ce=0,Me=0,Ie=c,Ee=null;t:for(;;){for(var je;Ie!==g||A!==0&&Ie.nodeType!==3||(ne=K+A),Ie!==D||k!==0&&Ie.nodeType!==3||(_e=K+k),Ie.nodeType===3&&(K+=Ie.nodeValue.length),(je=Ie.firstChild)!==null;)Ee=Ie,Ie=je;for(;;){if(Ie===c)break t;if(Ee===g&&++Ce===A&&(ne=K),Ee===D&&++Me===k&&(_e=K),(je=Ie.nextSibling)!==null)break;Ie=Ee,Ee=Ie.parentNode}Ie=je}g=ne===-1||_e===-1?null:{start:ne,end:_e}}else g=null}g=g||{start:0,end:0}}else g=null;for($2={focusedElem:c,selectionRange:g},hg=!1,bs=h;bs!==null;)if(h=bs,c=h.child,(h.subtreeFlags&1028)!==0&&c!==null)c.return=h,bs=c;else for(;bs!==null;){switch(h=bs,D=h.alternate,c=h.flags,h.tag){case 0:if((c&4)!==0&&(c=h.updateQueue,c=c!==null?c.events:null,c!==null))for(g=0;g title"))),Cs(D,k,g),D[xn]=c,Xe(D),k=D;break e;case"link":var K=LC("link","href",A).get(k+(g.href||""));if(K){for(var ne=0;neJn&&(K=Jn,Jn=Bt,Bt=K);var xe=w_(ne,Bt),me=w_(ne,Jn);if(xe&&me&&(je.rangeCount!==1||je.anchorNode!==xe.node||je.anchorOffset!==xe.offset||je.focusNode!==me.node||je.focusOffset!==me.offset)){var ke=Ie.createRange();ke.setStart(xe.node,xe.offset),je.removeAllRanges(),Bt>Jn?(je.addRange(ke),je.extend(me.node,me.offset)):(ke.setEnd(me.node,me.offset),je.addRange(ke))}}}}for(Ie=[],je=ne;je=je.parentNode;)je.nodeType===1&&Ie.push({element:je,left:je.scrollLeft,top:je.scrollTop});for(typeof ne.focus=="function"&&ne.focus(),ne=0;neg?32:g,V.T=null,g=k2,k2=null;var D=bc,K=_l;if(ds=0,jf=bc=null,_l=0,(Mn&6)!==0)throw Error(r(331));var ne=Mn;if(Mn|=4,P8(D.current),I8(D,D.current,K,g),Mn=ne,V_(0,!1),ln&&typeof ln.onPostCommitFiberRoot=="function")try{ln.onPostCommitFiberRoot(qt,D)}catch{}return!0}finally{X.p=A,V.T=k,sC(c,h)}}function aC(c,h,g){h=la(g,h),h=r2(c.stateNode,h,2),c=fc(c,h,2),c!==null&&(Zt(c,2),go(c))}function Wn(c,h,g){if(c.tag===3)aC(c,c,g);else for(;h!==null;){if(h.tag===3){aC(h,c,g);break}else if(h.tag===1){var k=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof k.componentDidCatch=="function"&&(vc===null||!vc.has(k))){c=la(g,c),g=o8(2),k=fc(h,g,2),k!==null&&(l8(g,k,h,c),Zt(k,2),go(k));break}}h=h.return}}function z2(c,h,g){var k=c.pingCache;if(k===null){k=c.pingCache=new iU;var A=new Set;k.set(h,A)}else A=k.get(h),A===void 0&&(A=new Set,k.set(h,A));A.has(g)||(y2=!0,A.add(g),c=uU.bind(null,c,h,g),h.then(c,c))}function uU(c,h,g){var k=c.pingCache;k!==null&&k.delete(h),c.pingedLanes|=c.suspendedLanes&g,c.warmLanes&=~g,rr===c&&(bn&g)===g&&(Or===4||Or===3&&(bn&62914560)===bn&&300>ut()-Qm?(Mn&2)===0&&Tf(c,0):x2|=g,zf===bn&&(zf=0)),go(c)}function oC(c,h){h===0&&(h=un()),c=Tu(c,h),c!==null&&(Zt(c,h),go(c))}function dU(c){var h=c.memoizedState,g=0;h!==null&&(g=h.retryLane),oC(c,g)}function fU(c,h){var g=0;switch(c.tag){case 31:case 13:var k=c.stateNode,A=c.memoizedState;A!==null&&(g=A.retryLane);break;case 19:k=c.stateNode;break;case 22:k=c.stateNode._retryCache;break;default:throw Error(r(314))}k!==null&&k.delete(h),oC(c,g)}function hU(c,h){return It(c,h)}var ng=null,Rf=null,j2=!1,rg=!1,T2=!1,xc=0;function go(c){c!==Rf&&c.next===null&&(Rf===null?ng=Rf=c:Rf=Rf.next=c),rg=!0,j2||(j2=!0,pU())}function V_(c,h){if(!T2&&rg){T2=!0;do for(var g=!1,k=ng;k!==null;){if(c!==0){var A=k.pendingLanes;if(A===0)var D=0;else{var K=k.suspendedLanes,ne=k.pingedLanes;D=(1<<31-Mt(42|c)+1)-1,D&=A&~(K&~ne),D=D&201326741?D&201326741|1:D?D|2:0}D!==0&&(g=!0,dC(k,D))}else D=bn,D=Wr(k,k===rr?D:0,k.cancelPendingCommit!==null||k.timeoutHandle!==-1),(D&3)===0||kr(k,D)||(g=!0,dC(k,D));k=k.next}while(g);T2=!1}}function _U(){lC()}function lC(){rg=j2=!1;var c=0;xc!==0&&CU()&&(c=xc);for(var h=ut(),g=null,k=ng;k!==null;){var A=k.next,D=cC(k,h);D===0?(k.next=null,g===null?ng=A:g.next=A,A===null&&(Rf=g)):(g=k,(c!==0||(D&3)!==0)&&(rg=!0)),k=A}ds!==0&&ds!==5||V_(c),xc!==0&&(xc=0)}function cC(c,h){for(var g=c.suspendedLanes,k=c.pingedLanes,A=c.expirationTimes,D=c.pendingLanes&-62914561;0ne)break;var Me=_e.transferSize,Ie=_e.initiatorType;Me&&bC(Ie)&&(_e=_e.responseEnd,K+=Me*(_e"u"?null:document;function AC(c,h,g){var k=Mf;if(k&&typeof h=="string"&&h){var A=Un(h);A='link[rel="'+c+'"][href="'+A+'"]',typeof g=="string"&&(A+='[crossorigin="'+g+'"]'),TC.has(A)||(TC.add(A),c={rel:c,crossOrigin:g,href:h},k.querySelector(A)===null&&(h=k.createElement("link"),Cs(h,"link",c),Xe(h),k.head.appendChild(h)))}}function DU(c){pl.D(c),AC("dns-prefetch",c,null)}function LU(c,h){pl.C(c,h),AC("preconnect",c,h)}function OU(c,h,g){pl.L(c,h,g);var k=Mf;if(k&&c&&h){var A='link[rel="preload"][as="'+Un(h)+'"]';h==="image"&&g&&g.imageSrcSet?(A+='[imagesrcset="'+Un(g.imageSrcSet)+'"]',typeof g.imageSizes=="string"&&(A+='[imagesizes="'+Un(g.imageSizes)+'"]')):A+='[href="'+Un(c)+'"]';var D=A;switch(h){case"style":D=Df(c);break;case"script":D=Lf(c)}_a.has(D)||(c=d({rel:"preload",href:h==="image"&&g&&g.imageSrcSet?void 0:c,as:h},g),_a.set(D,c),k.querySelector(A)!==null||h==="style"&&k.querySelector(X_(D))||h==="script"&&k.querySelector(Z_(D))||(h=k.createElement("link"),Cs(h,"link",c),Xe(h),k.head.appendChild(h)))}}function IU(c,h){pl.m(c,h);var g=Mf;if(g&&c){var k=h&&typeof h.as=="string"?h.as:"script",A='link[rel="modulepreload"][as="'+Un(k)+'"][href="'+Un(c)+'"]',D=A;switch(k){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":D=Lf(c)}if(!_a.has(D)&&(c=d({rel:"modulepreload",href:c},h),_a.set(D,c),g.querySelector(A)===null)){switch(k){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(g.querySelector(Z_(D)))return}k=g.createElement("link"),Cs(k,"link",c),Xe(k),g.head.appendChild(k)}}}function BU(c,h,g){pl.S(c,h,g);var k=Mf;if(k&&c){var A=Ps(k).hoistableStyles,D=Df(c);h=h||"default";var K=A.get(D);if(!K){var ne={loading:0,preload:null};if(K=k.querySelector(X_(D)))ne.loading=5;else{c=d({rel:"stylesheet",href:c,"data-precedence":h},g),(g=_a.get(D))&&W2(c,g);var _e=K=k.createElement("link");Xe(_e),Cs(_e,"link",c),_e._p=new Promise(function(Ce,Me){_e.onload=Ce,_e.onerror=Me}),_e.addEventListener("load",function(){ne.loading|=1}),_e.addEventListener("error",function(){ne.loading|=2}),ne.loading|=4,lg(K,h,k)}K={type:"stylesheet",instance:K,count:1,state:ne},A.set(D,K)}}}function $U(c,h){pl.X(c,h);var g=Mf;if(g&&c){var k=Ps(g).hoistableScripts,A=Lf(c),D=k.get(A);D||(D=g.querySelector(Z_(A)),D||(c=d({src:c,async:!0},h),(h=_a.get(A))&&V2(c,h),D=g.createElement("script"),Xe(D),Cs(D,"link",c),g.head.appendChild(D)),D={type:"script",instance:D,count:1,state:null},k.set(A,D))}}function PU(c,h){pl.M(c,h);var g=Mf;if(g&&c){var k=Ps(g).hoistableScripts,A=Lf(c),D=k.get(A);D||(D=g.querySelector(Z_(A)),D||(c=d({src:c,async:!0,type:"module"},h),(h=_a.get(A))&&V2(c,h),D=g.createElement("script"),Xe(D),Cs(D,"link",c),g.head.appendChild(D)),D={type:"script",instance:D,count:1,state:null},k.set(A,D))}}function RC(c,h,g,k){var A=(A=oe.current)?og(A):null;if(!A)throw Error(r(446));switch(c){case"meta":case"title":return null;case"style":return typeof g.precedence=="string"&&typeof g.href=="string"?(h=Df(g.href),g=Ps(A).hoistableStyles,k=g.get(h),k||(k={type:"style",instance:null,count:0,state:null},g.set(h,k)),k):{type:"void",instance:null,count:0,state:null};case"link":if(g.rel==="stylesheet"&&typeof g.href=="string"&&typeof g.precedence=="string"){c=Df(g.href);var D=Ps(A).hoistableStyles,K=D.get(c);if(K||(A=A.ownerDocument||A,K={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},D.set(c,K),(D=A.querySelector(X_(c)))&&!D._p&&(K.instance=D,K.state.loading=5),_a.has(c)||(g={rel:"preload",as:"style",href:g.href,crossOrigin:g.crossOrigin,integrity:g.integrity,media:g.media,hrefLang:g.hrefLang,referrerPolicy:g.referrerPolicy},_a.set(c,g),D||FU(A,c,g,K.state))),h&&k===null)throw Error(r(528,""));return K}if(h&&k!==null)throw Error(r(529,""));return null;case"script":return h=g.async,g=g.src,typeof g=="string"&&h&&typeof h!="function"&&typeof h!="symbol"?(h=Lf(g),g=Ps(A).hoistableScripts,k=g.get(h),k||(k={type:"script",instance:null,count:0,state:null},g.set(h,k)),k):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,c))}}function Df(c){return'href="'+Un(c)+'"'}function X_(c){return'link[rel="stylesheet"]['+c+"]"}function MC(c){return d({},c,{"data-precedence":c.precedence,precedence:null})}function FU(c,h,g,k){c.querySelector('link[rel="preload"][as="style"]['+h+"]")?k.loading=1:(h=c.createElement("link"),k.preload=h,h.addEventListener("load",function(){return k.loading|=1}),h.addEventListener("error",function(){return k.loading|=2}),Cs(h,"link",g),Xe(h),c.head.appendChild(h))}function Lf(c){return'[src="'+Un(c)+'"]'}function Z_(c){return"script[async]"+c}function DC(c,h,g){if(h.count++,h.instance===null)switch(h.type){case"style":var k=c.querySelector('style[data-href~="'+Un(g.href)+'"]');if(k)return h.instance=k,Xe(k),k;var A=d({},g,{"data-href":g.href,"data-precedence":g.precedence,href:null,precedence:null});return k=(c.ownerDocument||c).createElement("style"),Xe(k),Cs(k,"style",A),lg(k,g.precedence,c),h.instance=k;case"stylesheet":A=Df(g.href);var D=c.querySelector(X_(A));if(D)return h.state.loading|=4,h.instance=D,Xe(D),D;k=MC(g),(A=_a.get(A))&&W2(k,A),D=(c.ownerDocument||c).createElement("link"),Xe(D);var K=D;return K._p=new Promise(function(ne,_e){K.onload=ne,K.onerror=_e}),Cs(D,"link",k),h.state.loading|=4,lg(D,g.precedence,c),h.instance=D;case"script":return D=Lf(g.src),(A=c.querySelector(Z_(D)))?(h.instance=A,Xe(A),A):(k=g,(A=_a.get(D))&&(k=d({},g),V2(k,A)),c=c.ownerDocument||c,A=c.createElement("script"),Xe(A),Cs(A,"link",k),c.head.appendChild(A),h.instance=A);case"void":return null;default:throw Error(r(443,h.type))}else h.type==="stylesheet"&&(h.state.loading&4)===0&&(k=h.instance,h.state.loading|=4,lg(k,g.precedence,c));return h.instance}function lg(c,h,g){for(var k=g.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),A=k.length?k[k.length-1]:null,D=A,K=0;K title"):null)}function HU(c,h,g){if(g===1||h.itemProp!=null)return!1;switch(c){case"meta":case"title":return!0;case"style":if(typeof h.precedence!="string"||typeof h.href!="string"||h.href==="")break;return!0;case"link":if(typeof h.rel!="string"||typeof h.href!="string"||h.href===""||h.onLoad||h.onError)break;switch(h.rel){case"stylesheet":return c=h.disabled,typeof h.precedence=="string"&&c==null;default:return!0}case"script":if(h.async&&typeof h.async!="function"&&typeof h.async!="symbol"&&!h.onLoad&&!h.onError&&h.src&&typeof h.src=="string")return!0}return!1}function IC(c){return!(c.type==="stylesheet"&&(c.state.loading&3)===0)}function qU(c,h,g,k){if(g.type==="stylesheet"&&(typeof k.media!="string"||matchMedia(k.media).matches!==!1)&&(g.state.loading&4)===0){if(g.instance===null){var A=Df(k.href),D=h.querySelector(X_(A));if(D){h=D._p,h!==null&&typeof h=="object"&&typeof h.then=="function"&&(c.count++,c=ug.bind(c),h.then(c,c)),g.state.loading|=4,g.instance=D,Xe(D);return}D=h.ownerDocument||h,k=MC(k),(A=_a.get(A))&&W2(k,A),D=D.createElement("link"),Xe(D);var K=D;K._p=new Promise(function(ne,_e){K.onload=ne,K.onerror=_e}),Cs(D,"link",k),g.instance=D}c.stylesheets===null&&(c.stylesheets=new Map),c.stylesheets.set(g,h),(h=g.state.preload)&&(g.state.loading&3)===0&&(c.count++,g=ug.bind(c),h.addEventListener("load",g),h.addEventListener("error",g))}}var K2=0;function UU(c,h){return c.stylesheets&&c.count===0&&fg(c,c.stylesheets),0K2?50:800)+h);return c.unsuspend=g,function(){c.unsuspend=null,clearTimeout(k),clearTimeout(A)}}:null}function ug(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)fg(this,this.stylesheets);else if(this.unsuspend){var c=this.unsuspend;this.unsuspend=null,c()}}}var dg=null;function fg(c,h){c.stylesheets=null,c.unsuspend!==null&&(c.count++,dg=new Map,h.forEach(GU,c),dg=null,ug.call(c))}function GU(c,h){if(!(h.state.loading&4)){var g=dg.get(c);if(g)var k=g.get(null);else{g=new Map,dg.set(c,g);for(var A=c.querySelectorAll("link[data-precedence],style[data-precedence]"),D=0;D"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),sx.exports=qG(),sx.exports}var GG=UG();const WG=!1;var EM=R.useLayoutEffect;function VG(e,n,t){R.useEffect(()=>{if(!e.current||t||typeof IntersectionObserver!="function")return()=>n();const r=new IntersectionObserver(s=>{n(s.pop())},{rootMargin:"100px"});return r.observe(e.current),()=>{r.disconnect(),n()}},[n,t,e])}function KG(e){const n=R.useRef(null);return R.useImperativeHandle(e,()=>n.current,[]),n}function V0(e){return e[e.length-1]}function Mh(e,n){return typeof e=="function"?e(n):e}const NM=Object.prototype.hasOwnProperty,QG=Object.prototype.propertyIsEnumerable;function zM(e){for(const n in e)if(NM.call(e,n))return!0;return!1}const YG=()=>Object.create(null),qu=(e,n)=>rd(e,n,YG);function rd(e,n,t=()=>({}),r=0){if(e===n)return e;if(r>500)return n;const s=n,i=w9(e)&&w9(s);if(!i&&!(U1(e)&&U1(s)))return s;const a=i?e:y9(e);if(!a)return s;const o=i?s:y9(s);if(!o)return s;const l=a.length,u=o.length,_=i?new Array(u):t();let d=0;for(let p=0;p"u")return!0;const t=n.prototype;return!(!x9(t)||!t.hasOwnProperty("isPrototypeOf"))}function x9(e){return Object.prototype.toString.call(e)==="[object Object]"}function w9(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Xc(e,n,t){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return!1;for(let r=0,s=e.length;rs||!Xc(e[a],n[a],t)))return!1;return s===i}return!1}const XG=/[\x00-\x1f\x7f"<>`{}]/g;function ZG(e){return e.replace(XG,n=>"%"+n.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function S9(e){let n;try{n=decodeURI(e)}catch{n=e.replaceAll(/%[0-9A-F]{2}/gi,t=>{try{return decodeURI(t)}catch{return t}})}return ZG(n)}const JG=["http:","https:","mailto:","tel:"];function G1(e,n){if(!e)return!1;try{const t=new URL(e);return!n.has(t.protocol)}catch{return!1}}function a0(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const n=/%25|%5C/gi;let t=0,r="",s;for(;(s=n.exec(e))!==null;)r+=S9(e.slice(t,s.index))+s[0],t=n.lastIndex;r=r+S9(t?e.slice(t):e);let i=!1;return r.startsWith("//")&&(i=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:i}}function eW(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function tW(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let t=0;t{i.next&&(i.prev?(i.prev.next=i.next,i.next.prev=i.prev,i.next=void 0,r&&(r.next=i,i.prev=r)):(i.next.prev=void 0,t=i.next,i.next=void 0,r&&(i.prev=r,r.next=i)),r=i)};return{get(i){const a=n.get(i);if(a)return s(a),a.value},set(i,a){if(n.size>=e&&t){const l=t;n.delete(l.key),l.next&&(t=l.next,l.next.prev=void 0),l===r&&(r=void 0)}const o=n.get(i);if(o)o.value=a,s(o);else{const l={key:i,value:a,prev:r};r&&(r.next=l),r=l,t||(t=l),n.set(i,l)}},clear(){n.clear(),t=void 0,r=void 0}}}const Kc=4,jM=5;function TM(e,n,t=new Uint16Array(6)){const r=e.indexOf("/",n),s=r===-1?e.length:r,i=e.substring(n,s);if(!i||!i.includes("$"))return t[0]=0,t[1]=n,t[2]=n,t[3]=s,t[4]=s,t[5]=s,t;if(i==="$"){const l=e.length;return t[0]=2,t[1]=n,t[2]=n,t[3]=l,t[4]=l,t[5]=l,t}if(i.charCodeAt(0)===36)return t[0]=1,t[1]=n,t[2]=n+1,t[3]=s,t[4]=s,t[5]=s,t;const a=i.indexOf("{");let o;if(a!==-1&&a+1!B.parse&&B.caseSensitive===z&&B.prefix===N&&B.suffix===T));if(I)w=I;else{const B=nW(E,d,z,N,T);w=B,B.parent=s,B.depth=i;let $;E===1?$=s.dynamic??(s.dynamic=[]):E===3?$=s.optional??(s.optional=[]):$=s.wildcard??(s.wildcard=[]),$.push(B),$.length===2&&(a==null||a.push($))}break}}s=w}if(S&&t.children&&!t.isRoot&&t.id&&t.id.charCodeAt(t.id.lastIndexOf("/")+1)===95){const b=rh(d);b.kind=jM,b.parent=s,i++,b.depth=i,s.pathless??(s.pathless=[]),s.pathless.push(b),s=b}const v=(t.path||!t.children)&&!t.isRoot;if(v&&d.endsWith("/")){const b=rh(d);b.kind=Kc,b.parent=s,i++,b.depth=i,s.index=b,s=b}s.parse=S??null,s.priority=((_=p==null?void 0:p.params)==null?void 0:_.priority)??0,v&&!s.route&&(s.route=t,s.fullPath=d)}if(t.children)for(const d of t.children)Uv(e,n,d,l,s,i,a,o)}function AM(e,n){if(e.parse&&!n.parse)return-1;if(!e.parse&&n.parse)return 1;if(e.parse&&n.parse&&(e.priority||n.priority))return n.priority-e.priority;if(e.prefix&&n.prefix&&e.prefix!==n.prefix){if(e.prefix.startsWith(n.prefix))return-1;if(n.prefix.startsWith(e.prefix))return 1}if(e.suffix&&n.suffix&&e.suffix!==n.suffix){if(e.suffix.endsWith(n.suffix))return-1;if(n.suffix.endsWith(e.suffix))return 1}return e.prefix&&!n.prefix?-1:!e.prefix&&n.prefix?1:e.suffix&&!n.suffix?-1:!e.suffix&&n.suffix?1:e.caseSensitive&&!n.caseSensitive?-1:!e.caseSensitive&&n.caseSensitive?1:0}function rh(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function nW(e,n,t,r,s){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:n,parent:null,parse:null,priority:0,caseSensitive:t,prefix:r,suffix:s}}function rW(e,n){const t=rh("/"),r=new Uint16Array(6),s=[];for(const i of e)Uv(!1,r,i,1,t,0,s);for(const i of s)i.sort(AM);n.masksTree=t,n.flatCache=W1(1e3)}function sW(e,n){e||(e="/");const t=n.flatCache.get(e);if(t!==void 0)return t;const r=$5(e,n.masksTree);return n.flatCache.set(e,r),r}function iW(e,n,t,r,s){e||(e="/"),r||(r="/");const i=n?`case\0${e}`:e;let a=s.singleCache.get(i);return a||(a=rh("/"),Uv(n,new Uint16Array(6),{from:e},1,a,0),s.singleCache.set(i,a)),$5(r,a,t)}function aW(e,n,t=!1){const r=t?e:`nofuzz\0${e}`,s=n.matchCache.get(r);if(s!==void 0)return s;e||(e="/");let i;try{i=$5(e,n.segmentTree,t)}catch(a){if(a instanceof URIError)i=null;else throw a}return i&&(i.branch=MM(i.route)),n.matchCache.set(r,i),i}function oW(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function lW(e,n=!1,t){const r=rh(e.fullPath),s=new Uint16Array(6),i=[],a={},o={};let l=0;Uv(n,s,e,1,r,0,i,u=>{if(t==null||t(u,l),u.id in a&&B5(),a[u.id]=u,l!==0&&u.path){const _=oW(u.fullPath);(!o[_]||u.fullPath.endsWith("/"))&&(o[_]=u)}l++});for(const u of i)u.sort(AM);return{processedTree:{segmentTree:r,singleCache:W1(1e3),matchCache:W1(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function $5(e,n,t=!1){const r=e.split("/"),s=uW(e,r,n,t);if(!s)return null;const[i]=RM(e,r,s);return{route:s.node.route,rawParams:i}}function RM(e,n,t){var _,d,p,m;const r=cW(t.node);let s=null;const i=Object.create(null);let a=((_=t.extract)==null?void 0:_.part)??0,o=((d=t.extract)==null?void 0:d.node)??0,l=((p=t.extract)==null?void 0:p.path)??0,u=((m=t.extract)==null?void 0:m.segment)??0;for(;o=0;N--){const T=d.wildcard[N],{prefix:z,suffix:M}=T;if(!(z&&(y||!(T.caseSensitive?C:E??(E=C.toLowerCase())).startsWith(z)))){if(M){if(y)continue;const I=n.slice(p).join("/"),B=I.slice(-M.length);if((T.caseSensitive?B:B.toLowerCase())!==M||I.length-M.length=0;T--){const z=d.optional[T];o.push({node:z,index:p,skipped:N,statics:x,dynamics:S,optionals:v,extract:b,rawParams:w})}if(!y)for(let T=d.optional.length-1;T>=0;T--){const z=d.optional[T],{prefix:M,suffix:I}=z;if(M||I){const B=z.caseSensitive?C:E??(E=C.toLowerCase());if(M&&!B.startsWith(M)||I&&B.indexOf(I,B.length-I.length)=0;N--){const T=d.dynamic[N],{prefix:z,suffix:M}=T;if(z||M){const I=T.caseSensitive?C:E??(E=C.toLowerCase());if(z&&!I.startsWith(z)||M&&I.indexOf(M,I.length-M.length)=0;N--){const T=d.pathless[N];o.push({node:T,index:p,skipped:m,statics:x,dynamics:S,optionals:v,extract:b,rawParams:w})}}if(u)return u;if(r&&l){let _=l.index;for(let p=0;pe.statics||n.statics===e.statics&&(n.dynamics>e.dynamics||n.dynamics===e.dynamics&&(n.optionals>e.optionals||n.optionals===e.optionals&&((n.node.kind===Kc)>(e.node.kind===Kc)||n.node.kind===Kc==(e.node.kind===Kc)&&n.node.depth>e.node.depth))):!0}function m1(e){return g1(e.filter(n=>n!==void 0).join("/"))}function g1(e){return e.replace(/\/{2,}/g,"/")}function DM(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function jl(e){const n=e.length;return n>1&&e[n-1]==="/"?e.replace(/\/{1,}$/,""):e}function LM(e){return jl(DM(e))}function V1(e,n){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${n}/`?e.slice(0,-1):e}function fW(e,n,t){return V1(e,t)===V1(n,t)}function hW({base:e,to:n,trailingSlash:t="never",cache:r}){if(n.includes("//")&&(n=g1(n)),n.startsWith("/"))return n.length===1||t==="preserve"?n:t==="always"?n.endsWith("/")?n:`${n}/`:n.endsWith("/")?n.slice(0,-1):n;const s=n===".";let i;if(r){i=s?e:e+"\0"+n;const u=r.get(i);if(u)return u}let a;if(s)a=e.split("/");else{for(e.includes("//")&&(e=g1(e)),a=e.split("/");a.length>1&&V0(a)==="";)a.pop();const u=n.split("/");for(let _=0,d=u.length;_1?a.pop():a=[""]:p==="."||a.push(p)}}a.length>1&&(V0(a)===""?t==="never"&&a.pop():t==="always"&&a.push(""));const o=a.join("/"),l=(s?g1(o):o)||"/";return i&&r&&r.set(i,l),l}function _W(e){const n=new Map(e.map(s=>[encodeURIComponent(s),s])),t=Array.from(n.keys()).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(t,"g");return s=>s.replace(r,i=>n.get(i)??i)}function lx(e,n,t){const r=n[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(s=>E9(s,t)).join("/"):E9(r,t)}function C9({path:e,params:n,decoder:t,...r}){let s=!1;const i=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:i,isMissingParams:s};if(!e.includes("$"))return{interpolatedPath:e,usedParams:i,isMissingParams:s};const a=e.length;let o=0,l,u="";for(;oe.state.__TSR_key||e.href;function xW(e){const n=e.getAttribute(N9);if(n)return`[${N9}="${n}"]`;let t="",r=e,s;for(;s=r.parentNode;){let i=1,a=r;for(;a=a.previousElementSibling;)i++;const o=`${r.localName}:nth-child(${i})`;t=t?`${o} > ${t}`:o,r=s}return t}let Sg=!1;const v1="window";function p4(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function z9(e){const n=new Set;for(const t of e){if(t===v1)continue;const r=p4(t);r&&n.add(r)}return n}function wW(e,n){const t=e.options.scrollRestoration,r=e._scroll;t&&(r.restoring=!0);const s=e.options.getScrollRestorationKey||yW,i=new Set,a=o=>{const l=Oc[o]||(Oc[o]={});for(const u of i)u===document?l[v1]={scrollX,scrollY}:u.isConnected&&(l[xW(u)]={scrollX:u.scrollLeft,scrollY:u.scrollTop})};t&&!r.restoration&&(r.restoration=!0,Sg=!1,history.scrollRestoration="manual",document.addEventListener("scroll",o=>{Sg||i.add(o.target)},!0),e.subscribe("onBeforeLoad",o=>{o.fromLocation&&a(s(o.fromLocation)),i.clear()}),addEventListener("pagehide",()=>{a(s(e.stores.resolvedLocation.get()??e.stores.location.get())),bW()})),!r.reset&&(r.reset=!0,e.subscribe("onRendered",o=>{var S;const l=e.options.scrollRestorationBehavior,u=e.options.scrollToTopSelectors,_=r.next,d=r.hash;let p;if(i.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const m=s(o.toLocation),x=o.fromLocation&&s(o.fromLocation);if(r.restoring&&x&&x!==m){const v=Oc[x];if(v){let b=Oc[m];for(const w in v){if(w===v1){if(_)continue}else{const y=p4(w);if(!y||_&&u&&(p??(p=z9(u)),p.has(y)))continue}b||(b=Oc[m]={}),b[w]??(b[w]=v[w])}}}Sg=!0;try{const v=o.toLocation.hash,b=o.toLocation.state.__hashScrollIntoViewOptions??!0;let w=!1;if(_){!v&&u&&(p??(p=z9(u)));const y=v&&b&&d,C=r.restoring?Oc[m]:void 0;if(C)for(const E in C){const{scrollX:N,scrollY:T}=C[E];if(E===v1){if(y)continue;scrollTo({top:T,left:N,behavior:l}),w=!0}else{const z=p4(E);z&&(z.scrollLeft=N,z.scrollTop=T,p==null||p.delete(z))}}if(!v){const E={top:0,left:0,behavior:l};if(w||scrollTo(E),p)for(const N of p)N.scrollTo(E)}}!w&&v&&b&&((S=document.getElementById(v))==null||S.scrollIntoView(b))}finally{Sg=!1}}))}function SW(e,n=String){const t=new URLSearchParams;for(const r in e){const s=e[r];s!==void 0&&t.set(r,n(s))}return t.toString()}function cx(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function kW(e){const n=new URLSearchParams(e),t=Object.create(null);for(const[r,s]of n.entries()){const i=t[r];i==null?t[r]=cx(s):Array.isArray(i)?i.push(cx(s)):t[r]=[i,cx(s)]}return t}const CW=/^(?:\s|["[{\d-]|fa|nu|tr)/,EW=zW(JSON.parse),NW=jW(JSON.stringify,JSON.parse);function zW(e){return n=>{n[0]==="?"&&(n=n.substring(1));const t=kW(n);for(const r in t){const s=t[r];if(typeof s=="string")try{t[r]=e(s)}catch{}}return t}}function jW(e,n){const t=n===JSON.parse;function r(s){if(s&&typeof s=="object")try{return e(s)}catch{}else if(n&&typeof s=="string"){if(t&&!CW.test(s))return s;try{return n(s),e(s)}catch{}}return s}return s=>{const i=SW(s,r);return i?`?${i}`:""}}const ih="__root__";function TW(e){if(e.statusCode=e.statusCode||e.code||307,!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const n=new Headers(e.headers);e.href&&n.get("Location")===null&&n.set("Location",e.href);const t=new Response(null,{status:e.statusCode,headers:n});if(t.options=e,e.throw)throw t;return t}function OM(e){return e instanceof Response&&!!e.options}function AW(e){return{input:({url:n})=>{for(const t of e)n=m4(t,n);return n},output:({url:n})=>{for(let t=e.length-1;t>=0;t--)n=IM(e[t],n);return n}}}function RW(e){const n=LM(e.basepath),t=`/${n}`,r=e.caseSensitive?t:t.toLowerCase(),s=`${r}/`;return{input:({url:i})=>{const a=e.caseSensitive?i.pathname:i.pathname.toLowerCase();return a===r?i.pathname="/":a.startsWith(s)&&(i.pathname=i.pathname.slice(t.length)),i},output:({url:i})=>(i.pathname=m1(["/",n,i.pathname]),i)}}function m4(e,n){var r;const t=(r=e==null?void 0:e.input)==null?void 0:r.call(e,{url:n});if(t){if(typeof t=="string")return new URL(t);if(t instanceof URL)return t}return n}function IM(e,n){var r;const t=(r=e==null?void 0:e.output)==null?void 0:r.call(e,{url:n});if(t){if(typeof t=="string")return new URL(t);if(t instanceof URL)return t}return n}function MW(e,n){const{createMutableStore:t,createReadonlyStore:r,batch:s}=n,i=new Map,a=t("idle"),o=t(e),l=t(void 0),u=t([]),_=r(()=>u.get().map(S=>i.get(S).get())),d=r(()=>({status:a.get(),isLoading:a.get()==="pending",matches:_.get(),location:o.get(),resolvedLocation:l.get()}));function p(S){let v=i.get(S);return v||(v=t(void 0),i.set(S,v)),v}const m={status:a,location:o,resolvedLocation:l,ids:u,matches:_,byRoute:i,__store:d,getMatchStore:p,setMatches:x};function x(S){const v=u.get(),b=S.map(w=>w.routeId);s(()=>{tW(v,b)||u.set(b);for(const w of v)b.includes(w)||i.get(w).set(()=>{});for(const w of S){const y=p(w.routeId);y.get()!==w&&y.set(w)}})}return m}var Zc="__TSR_index",j9="popstate",T9="beforeunload";function DW(e){let n=e.getLocation();const t=new Set,r=a=>{n=e.getLocation(),t.forEach(o=>o({location:n,action:a}))},s=a=>{e.notifyOnIndexChange??!0?r(a):n=e.getLocation()},i=async({task:a,navigateOpts:o,...l})=>{var d,p;if((o==null?void 0:o.ignoreBlocker)??!1){a();return}const u=((d=e.getBlockers)==null?void 0:d.call(e))??[],_=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&u.length&&_)for(const m of u){const x=K1(l.path,l.state);if(await m.blockerFn({currentLocation:n,nextLocation:x,action:l.type})){(p=e.onBlocked)==null||p.call(e);return}}a()};return{get location(){return n},get length(){return e.getLength()},subscribers:t,subscribe:a=>(t.add(a),()=>{t.delete(a)}),push:(a,o,l)=>{const u=n.state[Zc];o=A9(u+1,o),i({task:()=>{e.pushState(a,o),r({type:"PUSH"})},navigateOpts:l,type:"PUSH",path:a,state:o})},replace:(a,o,l)=>{const u=n.state[Zc];o=A9(u,o),i({task:()=>{e.replaceState(a,o),r({type:"REPLACE"})},navigateOpts:l,type:"REPLACE",path:a,state:o})},go:(a,o)=>{i({task:()=>{e.go(a),s({type:"GO",index:a})},navigateOpts:o,type:"GO"})},back:a=>{i({task:()=>{e.back((a==null?void 0:a.ignoreBlocker)??!1),s({type:"BACK"})},navigateOpts:a,type:"BACK"})},forward:a=>{i({task:()=>{e.forward((a==null?void 0:a.ignoreBlocker)??!1),s({type:"FORWARD"})},navigateOpts:a,type:"FORWARD"})},canGoBack:()=>n.state[Zc]!==0,createHref:a=>e.createHref(a),block:a=>{var l;if(!e.setBlockers)return()=>{};const o=((l=e.getBlockers)==null?void 0:l.call(e))??[];return e.setBlockers([...o,a]),()=>{var _,d;const u=((_=e.getBlockers)==null?void 0:_.call(e))??[];(d=e.setBlockers)==null||d.call(e,u.filter(p=>p!==a))}},flush:()=>{var a;return(a=e.flush)==null?void 0:a.call(e)},destroy:()=>{var a;return(a=e.destroy)==null?void 0:a.call(e)},notify:r}}function A9(e,n){n||(n={});const t=P5();return{...n,key:t,__TSR_key:t,[Zc]:e}}function LW(e){var T,z;const n=typeof document<"u"?window:void 0,t=n.history.pushState,r=n.history.replaceState;let s=[];const i=()=>s,a=M=>s=M,o=(M=>M),l=(()=>K1(`${n.location.pathname}${n.location.search}${n.location.hash}`,n.history.state));if(!((T=n.history.state)!=null&&T.__TSR_key)&&!((z=n.history.state)!=null&&z.key)){const M=P5();n.history.replaceState({[Zc]:0,key:M,__TSR_key:M},"")}let u=l(),_,d=!1,p=!1,m=!1,x=!1;const S=()=>u;let v;const b=()=>{v&&(N._ignoreSubscribers=!0,(v[2]?n.history.pushState:n.history.replaceState)(v[1],"",v[0]),N._ignoreSubscribers=!1,v=void 0,_=void 0)},w=(M,I,B)=>{const $=o(I),U=!!v;U||(_=u),u=K1(I,B),v=[$,B,(v==null?void 0:v[2])||M],U||queueMicrotask(()=>b())},y=M=>{u=l(),N.notify({type:M})},C=async()=>{if(p){p=!1;return}const M=l(),I=M.state[Zc]-u.state[Zc],B=I===1,$=I===-1,U=!B&&!$||d;d=!1;const H=U?"GO":$?"BACK":"FORWARD",Y=U?{type:"GO",index:I}:{type:$?"BACK":"FORWARD"};if(m)m=!1;else{const V=i();if(typeof document<"u"&&V.length){for(const X of V)if(await X.blockerFn({currentLocation:u,nextLocation:M,action:H})){p=!0,n.history.go(1),N.notify(Y);return}}}u=l(),N.notify(Y)},E=M=>{if(x){x=!1;return}let I=!1;const B=i();if(typeof document<"u"&&B.length)for(const $ of B){const U=$.enableBeforeUnload??!0;if(U===!0){I=!0;break}if(typeof U=="function"&&U()===!0){I=!0;break}}if(I)return M.preventDefault(),M.returnValue=""},N=DW({getLocation:S,getLength:()=>n.history.length,pushState:(M,I)=>w(!0,M,I),replaceState:(M,I)=>w(!1,M,I),back:M=>(M&&(m=!0),x=!0,n.history.back()),forward:M=>{M&&(m=!0),x=!0,n.history.forward()},go:M=>{d=!0,n.history.go(M)},createHref:M=>o(M),flush:b,destroy:()=>{n.history.pushState=t,n.history.replaceState=r,n.removeEventListener(T9,E,{capture:!0}),n.removeEventListener(j9,C)},onBlocked:()=>{_&&u!==_&&(u=_)},getBlockers:i,setBlockers:a,notifyOnIndexChange:!1});return n.addEventListener(T9,E,{capture:!0}),n.addEventListener(j9,C),n.history.pushState=function(...M){const I=t.apply(n.history,M);return N._ignoreSubscribers||y("PUSH"),I},n.history.replaceState=function(...M){const I=r.apply(n.history,M);return N._ignoreSubscribers||y("REPLACE"),I},N}function OW(e){let n=e.replace(/[\x00-\x1f\x7f]/g,"");return n.startsWith("//")&&(n="/"+n.replace(/^\/+/,"")),n}function K1(e,n){const t=OW(e),r=t.indexOf("#"),s=t.indexOf("?"),i=P5();return{href:t,pathname:t.substring(0,r>0?s>0?Math.min(r,s):r:s>0?s:t.length),hash:r>-1?t.substring(r):"",search:s>-1?t.slice(s,r===-1?void 0:r):"",state:n||{[Zc]:0,key:i,__TSR_key:i}}}function P5(){return(Math.random()+1).toString(36).substring(7)}function R9(e){var n,t;return e.options.loader||e.options.beforeLoad||e.lazyFn||((n=e.options.component)==null?void 0:n.preload)||((t=e.options.pendingComponent)==null?void 0:t.preload)}function Gv(e,n){return{fromLocation:n,toLocation:e,pathChanged:(n==null?void 0:n.pathname)!==e.pathname,hrefChanged:(n==null?void 0:n.href)!==e.href,hashChanged:(n==null?void 0:n.hash)!==e.hash}}function M9({key:e,__TSR_key:n,__TSR_index:t,__hashScrollIntoViewOptions:r,...s}){return s}function IW(e,n,t,r){var s,i,a,o;for(const l of n){if(r&&e._tx!==r)return;t.some(u=>u.routeId===l.routeId)||(i=(s=e.routesById[l.routeId].options).onLeave)==null||i.call(s,l)}for(const l of t){if(r&&e._tx!==r)return;(o=(a=e.routesById[l.routeId].options)[n.some(u=>u.routeId===l.routeId)?"onStay":"onEnter"])==null||o.call(a,l)}}var BW=class{constructor(e,n){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async t=>(t(),!1),this.update=t=>{const r=this.options,s=this.basepath??(r==null?void 0:r.basepath)??"/",i=this.basepath===void 0,a=r==null?void 0:r.rewrite;if(this.options={...r,...t},this.isServer=this.options.isServer??WG??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=_W(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=LW()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let u;this.resolvePathCache=W1(1e3),u=this.buildRouteTree(),this.setRoutes(u)}if(!this.stores&&this.latestLocation){const u=this.getStoreConfig(this);this.batch=u.batch,this.stores=MW(this.latestLocation,u),wW(this)}const o=this.options.basepath??"/",l=this.options.rewrite;if(i||s!==o||a!==l){this.basepath=o;const u=[],_=LM(o);_&&_!=="/"&&u.push(RW({basepath:o})),l&&u.push(l),this.rewrite=u.length===0?void 0:u.length===1?u[0]:AW(u),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const t=lW(this.routeTree,this.options.caseSensitive,(r,s)=>{r.init({originalIndex:s})});return this.options.routeMasks&&rW(this.options.routeMasks,t.processedTree),t},this.subscribe=(t,r)=>{const s={eventType:t,fn:r};return this.subscribers.add(s),()=>{this.subscribers.delete(s)}},this.emit=t=>{for(const r of this.subscribers)if(r.eventType===t.type)try{r.fn(t)}catch(s){console.error(s)}},this.parseLocation=(t,r)=>{const s=({pathname:l,search:u,hash:_,href:d,state:p})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){const b=this.options.parseSearch(u),w=this.options.stringifySearch(b);return{href:l+w+_,publicHref:l+w+_,pathname:a0(l).path,external:!1,searchStr:w,search:qu(r==null?void 0:r.search,b),hash:a0(_.slice(1)).path,state:rd(r==null?void 0:r.state,p)}}const m=new URL(d,this.origin),x=m4(this.rewrite,m),S=this.options.parseSearch(x.search),v=this.options.stringifySearch(S);return x.search=v,{href:x.href.replace(x.origin,""),publicHref:d,pathname:a0(x.pathname).path,external:!!this.rewrite&&x.origin!==this.origin,searchStr:v,search:qu(r==null?void 0:r.search,S),hash:a0(x.hash.slice(1)).path,state:rd(r==null?void 0:r.state,p)}},i=s(t),{__tempLocation:a,__tempKey:o}=i.state;if(a&&(!o||o===this.tempLocationKey)){const l=s(a);return l.state.key=i.state.key,l.state.__TSR_key=i.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:i}}return i},this.resolvePathWithBase=(t,r)=>hW({base:t,to:r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(t,r,s)=>typeof t=="string"?this.matchRoutesInternal({pathname:t,search:r},s):this.matchRoutesInternal(t,r),this.getMatchedRoutes=t=>{const r=Object.create(null),s=aW(jl(t),this.processedTree,!0);return s&&Object.assign(r,s.rawParams),[(s==null?void 0:s.branch)||[this.routesById.__root__],r,s==null?void 0:s.route]},this.buildLocation=t=>{const r=(i={})=>{var M,I;if(i.href){const B=K1(i.href,{});i={...i,to:m4(this.rewrite,new URL(B.pathname,this.origin)).pathname,search:this.options.parseSearch(B.search),hash:B.hash.slice(1)}}const a=i._fromLocation||this._pendingLocation||this.latestLocation,o=this.matchRoutesLightweight(a);i.from;const l=i.unsafeRelative==="path"?a.pathname:i.from??o[1],u=o[2],_=o[3],d=this.resolvePathWithBase(l,i.to?`${i.to}`:".");let p=D9(i.params,_);const m=this.routesByPath[jl(d)];let x;if(m)x=this.getRouteBranch(m);else if(d.includes("$"))x=[];else{const[B,$,U]=this.getMatchedRoutes(d);x=B,this.options.notFoundRoute&&(!U||U.path!=="/"&&$["**"])&&(x=[...x,this.options.notFoundRoute])}if(x.length&&zM(p))for(const B of x){const $=((M=B.options.params)==null?void 0:M.stringify)??B.options.stringifyParams;if($){p===_&&(p=Object.assign(Object.create(null),p));try{Object.assign(p,$(p))}catch{}}}const S=t.leaveParams?d:a0(C9({path:d,params:p,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let v=u;if(t._includeValidateSearch&&((I=this.options.search)!=null&&I.strict)){const B={};x.forEach($=>{if($.options.validateSearch)try{Object.assign(B,b1($.options.validateSearch,{...B,...v}))}catch{}}),v=B}v=PW(v,i,x,t._includeValidateSearch),v=qu(u,v);const b=this.options.stringifySearch(v),w=i.hash===!0?a.hash:i.hash?Mh(i.hash,a.hash):void 0,y=w?`#${w}`:"";let C=i.state===!0?a.state:i.state?Mh(i.state,a.state):{};i.state&&(C=rd(a.state,C));const E=`${S}${b}${y}`;let N,T,z=!1;if(this.rewrite){const B=new URL(E,this.origin),$=IM(this.rewrite,B);N=B.href.replace(B.origin,""),$.origin!==this.origin?(T=$.href,z=!0):T=$.pathname+$.search+$.hash}else N=eW(E),T=N;return{publicHref:T,href:N,pathname:S,search:v,searchStr:b,state:C,hash:w??"",external:z,unmaskOnReload:i.unmaskOnReload}},s=r(t);if(t.mask)s.maskedLocation=r({from:t.from,...t.mask});else if(this.options.routeMasks){const i=sW(s.pathname,this.processedTree);if(i){const a=Object.assign(Object.create(null),i.rawParams),{from:o,params:l,...u}=i.route,_=D9(l,a);s.maskedLocation=r({from:t.from,...u,params:_})}}return s},this.commitLocation=async({viewTransition:t,ignoreBlocker:r,...s})=>{let i;const a=jl(this.latestLocation.href)===jl(s.href)&&Xc(M9(s.state),M9(this.latestLocation.state)),o=this._commitPromise;let l;const u=new Promise(_=>{l=_});if(u.resolve=()=>{l(),o==null||o.resolve()},this._commitPromise=u,a)this.load();else{let{maskedLocation:_,hashScrollIntoView:d,...p}=s;_&&(p={..._,state:{..._.state,__tempKey:void 0,__tempLocation:{...p,search:p.searchStr,state:{...p.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(p.unmaskOnReload??this.options.unmaskOnReload??!1)&&(p.state.__tempKey=this.tempLocationKey)),p.state.__hashScrollIntoViewOptions=d??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=t,i=s.replace?"REPLACE":"PUSH",this.history[i==="REPLACE"?"replace":"push"](p.publicHref,p.state,{ignoreBlocker:r}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.next=s.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:t,resetScroll:r,hashScrollIntoView:s,viewTransition:i,ignoreBlocker:a,...o}={})=>{const l=this.buildLocation({...o,_includeValidateSearch:!0});this._pendingLocation=l;const u=this.commitLocation({...l,viewTransition:i,replace:t,resetScroll:r,hashScrollIntoView:s,ignoreBlocker:a});return queueMicrotask(()=>{this._pendingLocation===l&&(this._pendingLocation=void 0)}),u},this.navigate=async({to:t,reloadDocument:r,href:s,publicHref:i,...a})=>{var l,u;let o=!1;if(s)try{new URL(`${s}`),o=!0}catch{}if(o&&!r&&(r=!0),r){if(t!==void 0||!s){const d=this.buildLocation({to:t,...a});s=s??d.publicHref,i=i??d.publicHref}const _=!o&&i?i:s;if(G1(_,this.protocolAllowlist))return;if(!a.ignoreBlocker){const d=((u=(l=this.history).getBlockers)==null?void 0:u.call(l))??[];for(const p of d)if(p!=null&&p.blockerFn&&await p.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return}a.replace?window.location.replace(_):window.location.href=_;return}return this.buildAndCommitLocation({...a,href:s,to:t,_isNavigate:!0})},this.load=async t=>{this.updateLatestLocation(),t!=null&&t.action&&(this._scroll.hash=t.action.type==="PUSH"||t.action.type==="REPLACE"),await QW(this,t)},this.startViewTransition=t=>{var s,i;const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document.startViewTransition=="function"){let a;if(typeof r=="object"&&((i=(s=window.CSS)==null?void 0:s.supports)!=null&&i.call(s,"selector(:active-view-transition-type(a))"))){const o=this.latestLocation,l=this.stores.resolvedLocation.get(),u=typeof r.types=="function"?r.types(Gv(o,l)):r.types;if(u===!1)return t();a={update:t,types:u}}else a=t;return document.startViewTransition(a).updateCallbackDone}return t()},this.invalidate=t=>{var u,_;const r=this._committed,s=t==null?void 0:t.filter,i=this._preloads,a=new Set([...r,...this._cache.values(),...[...(i==null?void 0:i.values())??[]].flat(),...((u=this._tx)==null?void 0:u[3])??[]].filter(d=>!s||s(d)).map(d=>d.id)),o=[];for(const[d,p]of i??[])p.some(m=>a.has(m.id))&&(i.delete(d),o.push(d));const l=d=>{if(a.has(d.id)){const p=this.routesById[d.routeId],m={...d,invalid:!0,...(t!=null&&t.forcePending||d.status==="error"||d.status==="notFound")&&R9(p)?{status:"pending",error:void 0}:void 0};return d._flight=void 0,m}return d};this._committed=r.map(l);for(const[d,p]of this._cache)a.has(d)&&(p.invalid=!0,t!=null&&t.forcePending&&(p.status="pending"));for(const d of a)(_=this._flights)==null||_.delete(d);for(const d of o)d.abort();return this.shouldViewTransition=!1,this.load({sync:t==null?void 0:t.sync})},this.resolveRedirect=t=>{const r=t.headers.get("Location");if(t.options.href){if(r)try{const s=new URL(r);if(this.origin&&s.origin===this.origin){const i=s.pathname+s.search+s.hash;t.options.href=i,t.headers.set("Location",i)}}catch{}}else{const s=this.buildLocation(t.options).publicHref||"/";t.options.href=s,t.headers.set("Location",s)}if(t.options.href&&G1(t.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return t.headers.get("Location")||t.headers.set("Location",t.options.href),t},this.clearCache=t=>{var u;const r=this._cache,s=this._preloads,i=t==null?void 0:t.filter,a=[],o=[];for(const[_,d]of r)(!i||i(d))&&(o.push(_),a.push(d));const l=[];for(const[_,d]of s??[])(!i||d.some(i))&&(l.push(_),a.push(...d));for(const _ of o)r.delete(_);for(const _ of l)s.delete(_);for(const _ of a){const d=_._flight;_._flight=void 0,d&&!--d[2]&&(((u=this._flights)==null?void 0:u.get(_.id))===d&&this._flights.delete(_.id),l.push(d[1]))}for(const _ of l)_.abort()},this.loadRouteChunk=ah,this.preloadRoute=t=>YW(this,t),this.matchRoute=(t,r)=>{const s={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0,params:t.params||{},leaveParams:!0},i=this.buildLocation(s),a=this.stores.status.get()==="pending";if(r!=null&&r.pending&&!a)return!1;const o=(r==null?void 0:r.pending)??!a?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),l=iW(i.pathname,(r==null?void 0:r.caseSensitive)??!1,(r==null?void 0:r.fuzzy)??!1,o.pathname,this.processedTree);return!l||t.params&&!Xc(l.rawParams,t.params,{partial:!0})?!1:(r==null?void 0:r.includeSearch)??!0?Xc(o.search,i.search,{partial:!0})?l.rawParams:!1:l.rawParams},this.getStoreConfig=n,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??NW,parseSearch:e.parseSearch??EW,protocolAllowlist:e.protocolAllowlist??JG}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:n,processedTree:t}){this.routesById=e,this.routesByPath=n,this.processedTree=t;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let n=this.routeBranchCache.get(e);return n||(n=MM(e),this.routeBranchCache.set(e,n)),n}matchRoutesInternal(e,n){var p,m;const[t,r,s]=this.getMatchedRoutes(e.pathname);let i=t,a=!1;(s?s.path!=="/"&&r["**"]:jl(e.pathname))&&(this.options.notFoundRoute?i=[...i,this.options.notFoundRoute]:a=!0);const o=a?FW(this.options.notFoundMode,i):void 0,l=new Array(i.length),u=this._committed,_=(x,S)=>{const v=u[S];return(v==null?void 0:v.routeId)===x.id?v:x===this.options.notFoundRoute?u.find(b=>b.routeId===x.id):void 0};let d;for(let x=0;x{const m=p(l.preSearchFilters?l.preSearchFilters.reduce((x,S)=>S(x),d):d);return l.postSearchFilters?l.postSearchFilters.reduce((x,S)=>S(x),m):m};s.push(_)}const u=l.validateSearch;if(r&&u){const _=({search:d,next:p,meta:m})=>{const x=p(d);try{const S=b1(u,x);if(m&&S)for(const v in S)v in x||(m.defaulted||(m.defaulted=new Map)).set(v,S[v]);return{...x,...S}}catch{}return x};s.push(_)}}const i=(o,l,u)=>{if(o>=s.length){if(!n.search)return{};if(n.search===!0)return l;const d=Mh(n.search,l);return u&&(u.explicit=d),d}const _=(d,p)=>{if(p){const m=u||{};return{search:i(o+1,d,m),meta:m}}return i(o+1,d,u)};return s[o]({search:l,next:_,meta:u})};return i(0,e)}function FW(e,n){if(e!=="root"){let t;for(let r=n.length-1;r>=0;r--){const s=n[r];if(s.options.notFoundComponent)return s.id;t||(t=s.children&&s.id)}if(t)return t}return ih}function D9(e,n){if(e===!1||e===null)return Object.create(null);if((e??!0)===!0)return n;const t=Object.assign(Object.create(null),n);return Object.assign(t,Mh(e,t))}function L9(e,n){var r;const t=((r=e.options.params)==null?void 0:r.parse)??e.options.parseParams;t&&Object.assign(n,t(n))}function g4(e,n){var t,r;return(r=(t=e.options[n])==null?void 0:t.preload)==null?void 0:r.call(t)}function HW(e,n){const t=g4(e,"component");let r=g4(e,"pendingComponent");return n&&(r?r=r.then(n):n()),t&&r?Promise.all([t,r]).then(()=>{}):t??r}function ah(e,n,t){const r=()=>n===!1?void 0:n?g4(e,n):HW(e,t),s=e._lazy;if(s)return s===!0?r():s.then(r);if(!e.lazyFn)return r();const i=e.lazyFn().then(a=>{{const{id:o,...l}=a.options;Object.assign(e.options,l),e._lazy=!0}},a=>{throw e._lazy=void 0,a});return e._lazy=i,i.then(r)}function F5(e){const n=e.findIndex(t=>t.status!=="success"||t._notFound)+1;return n&&n{const s=()=>r(n);n.addEventListener("abort",s,{once:!0}),Promise.resolve(e).then(t,r).finally(()=>n.removeEventListener("abort",s))})}function qd(e,n){return e.routesById[n.routeId]}function Q0(e,n,t){return OM(e)?[$i,e]:Dh(e)?(e.routeId||(e.routeId=t),[Wv,e]):n?(typeof(e==null?void 0:e.then)=="function"&&(e=new Error("A Promise was thrown",{cause:e})),[Ll,e]):[Mo,e]}function H5(e,n){var r,s;let t=Q0(n,!0,e.id);if(t[0]!==Ll)return t;try{(s=(r=e.options).onError)==null||s.call(r,t[1])}catch(i){t=Q0(i,!0,e.id)}return t}function R0(e,n,t,r,s){return s[0].signal.aborted?nu:G5(e,n,t,H5(t,r),s)}async function qW(e,n,t,r,s,i){var _,d;const[a,o]=n,l=t[0].signal,u=!!t[3];for(let p=t[6]??0;pe.navigate({...C,_fromLocation:a}),buildLocation:e.buildLocation,cause:u?"preload":m.cause,abortController:t[0],preload:u,matches:o,routeId:x.id};try{const C=m._ctx||(m._ctx=x.options.context?x.options.context({...v,deps:m.loaderDeps,context:S})||{}:void 0);m.context={...S,...C}}catch(C){return Tl(e,m),[p,R0(e,n,x,C,t)]}if(l.aborted)return[p,nu];const b=m.paramsError??m.searchError;if(b!==void 0)return Tl(e,m),[p,R0(e,n,x,b,t)];const w=x.options.beforeLoad;if(!w)continue;const y=m.status;p>=i&&(m.status="pending",(d=t[7])==null||d.call(t));try{Y0(e,m,"beforeLoad",t[0]);const C=await Hd(w({...v,search:m.search,context:m.context,...e.options.additionalContext}),l);if(l.aborted)return[p,nu];const E=G5(e,n,x,Q0(C,!1,x.id),t);if(E[0]!==Mo)return Tl(e,m),[p,E];m.context={...m.context,...C}}catch(C){return Tl(e,m),[p,R0(e,n,x,C,t)]}finally{m.status=y,Y0(e,m,!1,t[0])}}s()}function q5(e,n,t){var r;if(!(!t||--t[2])){if(((r=e._flights)==null?void 0:r.get(n.id))===t){const s=e._tx;if(s&&!s[0].signal.aborted&&!s[3].includes(n)&&s[3].some(i=>i.id===n.id)&&s[3].some(i=>i.isFetching==="beforeLoad"))return;e._flights.delete(n.id)}return t[1]}}function Tl(e,n){var r;const t=n._flight;n._flight=void 0,(r=q5(e,n,t))==null||r.abort()}function xi(e,n,t,r){var i;const s=[];for(const a of n)if(!(t!=null&&t.includes(a))){const o=a._flight;if(a._flight=void 0,r&&(o==null?void 0:o[2])===1&&((i=e._flights)==null?void 0:i.get(a.id))===o&&(t!=null&&t.some(l=>l.id===a.id)))o[2]=0;else{const l=q5(e,a,o);l&&s.push(l)}}for(const a of s)a.abort()}function U5(e){for(const n of e){const t=n._flight;t&&t[2]++}}function Y0(e,n,t,r){var a;if(n.isFetching=t,r&&((a=e._tx)==null?void 0:a[0])!==r)return;const s=e.stores.byRoute.get(n.routeId),i=s==null?void 0:s.get();(i==null?void 0:i.id)===n.id&&s.set({...i,isFetching:t})}function BM(e,n,t,r,s,i,a){const o=n[0];return{params:t.params,location:o,navigate:l=>e.navigate({...l,_fromLocation:o}),cause:a?"preload":t.cause,abortController:s,preload:a,deps:t.loaderDeps,parentMatchPromise:i,context:t.context,route:r,...e.options.additionalContext}}async function O9(e,n,t,r,s,i,a){const o=a[0],l=o.signal;if(l.aborted)return nu;if(!s)return[Mo,void 0];let u=t._flight;Y0(e,t,"loader",o);try{if(!u){const _=new AbortController;u=[Promise.resolve().then(()=>s(BM(e,n,t,r,_,i,!!a[3]))).then(d=>Q0(d,!1,r.id),d=>Q0(d,!0,r.id)).then(d=>{var p;return d[0]!==Mo&&((p=e._flights)==null?void 0:p.get(t.id))===u&&(e._flights.delete(t.id),u[2]||_.abort()),d[0]===Ll&&u[2]?H5(r,d[1]):d}),_,1],(e._flights??(e._flights=new Map)).set(t.id,u)}return t._flight=u,t.abortController=u[1],G5(e,n,r,await Hd(u[0],l),a)}catch(_){if(_!==l||!l.aborted)throw _;return Tl(e,t),nu}finally{Y0(e,t,!1,o)}}function I9(e,n,t){n[0]!==$i&&(e.status="success",e.error=void 0,n[0]===Mo?(e.loaderData=n[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=t):e.invalid=!0)}function UW(e,n,t){const r=e._cache.get(n.id);if(r!==t||e._committed.some(i=>i.id===n.id&&i._flight===n._flight))return;const s={...n,_notFound:void 0,context:{}};s._flight&&s._flight[2]++,e._cache.set(n.id,s),r&&Tl(e,r)}function B9(e,n){return n[0]===Ll||n[0]===Wv?{...e,status:n[0]===Ll?"error":"notFound",error:n[1],_flight:void 0}:e}function GW(e,n,t,r,s,i,a){var $,U;const o=n[1][t],l=qd(e,o),u=!!i[3],_=e._cache.get(o.id);let d,p=!1,m;try{if(o.status==="success"&&(d=l.options.shouldReload,typeof d=="function"&&(d=d(BM(e,n,o,l,i[0],s,u))),i[0].signal.aborted&&(m=nu)),!m)if(o.status!=="success")p=!0;else{const H=u||o.preload?l.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:l.options.staleTime??e.options.defaultStaleTime??0;p=!!(o.invalid||d||d===void 0&&Date.now()-o.updatedAt>=H&&(i[5]||o.cause==="enter"||i[2].some(Y=>Y.routeId===o.routeId&&Y.id!==o.id)))}}catch(H){o.invalid=!0,Tl(e,o),m=R0(e,n,l,H,i)}const x=l.options.loader,S=typeof x=="function",v=S?x:x==null?void 0:x.handler,b=!u||l.options.preload!==!1;let w=b&&x?($=e._flights)==null?void 0:$.get(o.id):void 0;w===o._flight||m?w=void 0:w&&!p&&!u&&d===void 0?p=!0:p||(w=void 0);const y=!!(x&&p&&o.status==="success"&&!u&&!i[4]&&((S?void 0:x.staleReloadMode)??e.options.defaultStaleReloadMode)!=="blocking"),C=p&&b,E=C&&!y&&(o.status!=="success"||!!x),N=t>=a?i[7]:void 0,T=l.lazyFn&&l._lazy!==!0?N:void 0;if(C&&!x&&(o.invalid=!1,o.updatedAt=Date.now()),w&&w[2]++,E){const H=o._flight;o._flight=w,(U=q5(e,o,H))==null||U.abort(),t>=a&&(o.status="pending"),N==null||N()}C||(o.isFetching=!1);const z=(m?Promise.resolve(m):E?O9(e,n,o,l,v,s,i):Promise.resolve([Mo,o.loaderData])).then(H=>(E&&(I9(o,H,u),H[0]===Mo&&(x&&!i[0].signal.aborted&&UW(e,o,_),t>=a&&(o.status="pending"))),H)),M=Hd(Promise.resolve().then(()=>ah(l,void 0,T)),i[0].signal).then(()=>{},H=>n[1].some((Y,V)=>V<=t&&(Y.status==="error"||Y.status==="notFound"||Y._notFound))?void 0:[t,R0(e,n,l,H,i)]).then(H=>z.then(Y=>(E&&!H&&Y[0]===Mo&&o.status==="pending"&&!i[0].signal.aborted&&(o.status="success",N==null||N()),H)));if(r.push([t,z,M]),!y)return z.then(H=>B9(o,H));const I={...o,status:"pending",preload:!1,_flight:w};o.invalid=!1,o.isFetching="loader";const B=O9(e,n,I,l,v,s,i).then(H=>(o.isFetching=!1,I9(I,H,!1),H));return(n[2]??(n[2]=[])).push([t,B,M,I]),B.then(H=>B9(I,H))}async function v4(e,n,t,r,s=0){const i=t==null?void 0:t[1][1];let a=i!=null&&i.routeId?n.findIndex(o=>o.routeId===i.routeId):(t==null?void 0:t[0])??n.length-1;a<0&&(a=0);for(let o=a;o>=0;o--){const l=qd(e,n[o]);try{const u=ah(l,!1);u&&await Hd(u,r)}catch(u){if(u===r&&r.aborted)throw u}if(l.options.notFoundComponent)return o}return i!=null&&i.routeId?a:s}function yd(e,n){n[2]&&(xi(e,n[2].map(t=>t[3])),n[2]=void 0)}async function $9(e,n,t,r){let s;try{await Promise.all(e.map(i=>i[1].then(async a=>{const o=i[0];if(!(r&&o>=await r)){if(a[0]>=$i)throw[o,a];!s&&a[0]!==Mo&&(s=[o,a],await Promise.all((t??[]).map(l=>{if(!(l[0]<=o))return l[1].then(u=>{if(u[0]===$i)throw[l[0],u]})})))}})))}catch(i){return i}return n??s}function G5(e,n,t,r,s,i){for(;r[0]===$i;){const a=r[1],o=a.options;if(o.reloadDocument?s[3]:s[1]>=20)return r;try{return o.href&&o.reloadDocument?(e.resolveRedirect(a),r):[$i,a,e.buildLocation({...o,_fromLocation:n[0],_includeValidateSearch:!0})]}catch(l){r=i?[Ll,l]:H5(t,l),i=!0}}return r}async function $M(e,n,t,r,s,i){const a=n[1];let o=await s,l=!1;const u=a.findIndex(m=>m._notFound),_=m=>m[1][0]===Wv?v4(e,a,m,r.signal):m[0];let d=u<0?a.length:u;if(((o==null?void 0:o[1][0])??0)>=$i)d=0;else if(o){d=o[2]??(o[2]=await _(o));for(const m of t){if(m[0]>=d)break;const x=await m[1];if(x[0]!==Mo&&x[0]<$i&&!("loaderData"in a[m[0]])){o=[m[0],x],d=o[2]=await _(o);break}}}for(const m of t){if(m[0]>=d)break;const x=await m[2];if(x){o=x;break}}if(((o==null?void 0:o[1][0])??0)>=$i){const m=o[1];if(m[0]!==$i||m[1].options.reloadDocument||m[2])return yd(e,n),m;l=!0,o=[0,[Ll,new Error("Too many redirects")]]}const p=o?o[2]??await _(o):u;if(p>=0){const m=o==null?void 0:o[1],x=m==null?void 0:m[0],S=a[p],v=m==null?void 0:m[1],b=()=>{m&&(S._notFound=void 0,x===Ll?S.status="error":(v.routeId=S.routeId,S.routeId===e.routeTree.id?(S.status="success",S._notFound=!0):S.status="notFound"),S.error=v,S.isFetching=!1)};b(),m||i==null||i();const w=qd(e,S);try{await Hd(m?Promise.resolve().then(()=>ah(w,x===Ll?"errorComponent":"notFoundComponent")):Promise.all([ah(w),ah(w,"notFoundComponent")]),r.signal)}catch(y){if(y===r.signal&&r.signal.aborted)return yd(e,n),nu}m?l&&(r.abort(),await Promise.all([...t.map(y=>y[1]),...t.map(y=>y[2]),...(n[2]??[]).map(y=>y[1])]),yd(e,n),xi(e,a),b()):S.status="success"}return n}async function PM(e,n,t,r=0,s=n[1].length){var a,o;const i=n[1];for(let l=r;lw._notFound);if(e.options.notFoundMode!=="root"&&u>=0){const w=await v4(e,t,void 0,i,u);t[u]._notFound=void 0,t[w]._notFound=!0,u=w}let _=u<0?t.length:u+1,d=0;for(;d<_&&d!==u;){const w=t[d],y=r[2][d],C=l[d];if((y==null?void 0:y.id)!==w.id||y.status!=="success"||y._notFound||w.preload||(C==null?void 0:C.id)!==w.id||C.status!=="success"||C._notFound)break;d++}const p=[],m=r[6]??0;let x=m?Promise.resolve(t[m-1]):void 0;const S=()=>{for(let w=m;w<_&&!i.aborted;w++)x=GW(e,s,w,p,x,r,d)},v=await qW(e,s,r,_,S,d);if(v){if(r[4]=!0,_=v[0],v[1][0]===Wv){const w=await v4(e,t,v,i);v[2]=w,_=Math.min(_,w+1)}else v[1][0]>=$i&&(_=0);S()}if(!i.aborted&&!r[3]){const w=[];for(const[y,C]of e._flights??[])C[2]||(e._flights.delete(y),w.push(C[1]));for(const y of w)y.abort()}const b=$M(e,s,p,r[0],$9(p,v,s[2]),r[7]);(o=s[2])!=null&&o.length&&(s[3]=$9(s[2],void 0,void 0,b.then(w=>K0(w)?0:F5(t).length,()=>0))),a=await b}catch(l){if(yd(e,s),l===i&&i.aborted)return nu;throw l}return K0(a)?a:PM(e,a,i,r[6]===t.length?r[6]:0)}function b4(e,n){var i,a;if(e._tx!==n)return;const t=n[3],r=e.stores.matches.get();let s=e._pending;for(let o=0;o0){s[3]=setTimeout(()=>b4(e,n),w);return}s[2]=0}const v=t.map(w=>({...w,_flight:void 0}));v[o].status="pending";const b=s[4]=e.startTransition(()=>e.stores.setMatches(v),v).then(w=>(w&&e._pending===s&&s[4]===b&&!s[2]&&(s[2]=Date.now()+x),w));return}}function o0(e,n){var r;const t=e._pending;(e._tx===n||!((r=e._tx)!=null&&r[3].some(s=>s.id===(t==null?void 0:t[1]))))&&(clearTimeout(t==null?void 0:t[3]),e._pending=void 0)}async function P9(e,n){const t=e._pending;if(!t)return;clearTimeout(t[3]);const r=t[2]-Date.now();if(!t[4]||r<=0||!F5(n[3]).some(i=>i.id===t[1]))return;let s;try{await Hd(new Promise(i=>{s=setTimeout(i,r)}),n[0].signal)}catch{}clearTimeout(s)}function HM(e,n){e._committed=n,e.stores.setMatches(n)}function WW(e,n,t,r){const s=e._committed,i=e._cache;for(const l of t)l.preload=!1,r&&(l._assetEnd=void 0);const a=F5(t).length,o=new Map;{const l=Date.now();for(const u of[...s,...i.values()]){if(u.status!=="success"||t.some((d,p)=>d.id===u.id&&(p=(u.preload?_.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:_.options.gcTime??e.options.defaultGcTime??3e5)||o.set(u.id,i.get(u.id)===u?u:{...u,_flight:void 0,isFetching:!1,context:{}})}}n[3]=[],e._cache=o,HM(e,t),xi(e,[...i.values(),...s],[...t,...o.values()]),IW(e,s,t,n)}async function kg(e,n){let t=e._tx;for(;t&&t!==n;){if(await t[5],e._tx===t)return;t=e._tx}}function qM(e,n,t){const r=t[1].options,s=t[2];if(!s)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:s.publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});s._redirects=n[1]+1,e._pendingLocation=s;const i=e.commitLocation({...s,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===s&&(e._pendingLocation=void 0)}),i}async function VW(e,n,t,r,s){const i=t.map(l=>({...l}));U5(i);for(const l of r)Tl(e,i[l[0]]),i[l[0]]=l[3];const a=[n[2],i];let o;try{o=await $M(e,a,r,n[0],s)}catch(l){throw xi(e,i),l}if(K0(o)){xi(e,i),o[0]===$i&&e._tx===n&&e._committed===t&&await qM(e,n,o);return}if(await PM(e,o,n[0].signal),e._tx!==n||e._committed!==t){xi(e,i);return}for(const l of i){const u=e._cache.get(l.id);u!=null&&u._flight&&u._flight===l._flight&&(e._cache.delete(l.id),Tl(e,u))}HM(e,i),xi(e,t,i)}async function KW(e,n,t,r,s,i){const a=await FM(e,n[2],n[3],[n[0],n[1],e._committed,void 0,s,t,i,r]);if(K0(a)){const d=a[0]===$i&&e._tx===n;if((!d||a[1].options.reloadDocument)&&o0(e,n),xi(e,n[3]),n[3]=[],!d)return;if(e._tx!==n){o0(e,n);return}await qM(e,n,a);return}const o=a[1];if(e._tx===n&&await P9(e,n),e._tx!==n){o0(e,n),xi(e,o),yd(e,a);return}const l=n[2],u=Gv(l,e.stores.resolvedLocation.get()),_=a[2];await e.startViewTransition(async()=>{var m;if(e._tx===n&&await P9(e,n),e._tx!==n){o0(e,n),xi(e,o),yd(e,a);return}const d=()=>{o0(e,n),WW(e,n,o,i),e._tx===n&&(e.emit({type:"onLoad",...u}),e._tx===n&&e.emit({type:"onBeforeRouteMount",...u}))},p=await e.startTransition(d,o);if(e._tx!==n){yd(e,a);return}_!=null&&_.length&&VW(e,n,o,_,a[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(l),e.stores.status.set("idle"),e._tx===n&&e.emit({type:"onResolved",...u}),p&&e._tx===n&&e.emit({type:"onRendered",...u})}),e._tx===n&&((m=e._commitPromise)==null||m.resolve(),e._commitPromise=void 0)})}async function QW(e,n){var C;const t=e._tx,r=e.stores.resolvedLocation.get(),s=r??e.stores.location.get(),i=e.latestLocation,a=e._pendingLocation,o=(a==null?void 0:a.href)===i.href?a._redirects??0:0,l=e._handoff,u=l==null?void 0:l[0](),_=new AbortController,d=e._preflight;if(e._preflight=_,u||l==null||l[1](),d==null||d.abort(),!_.signal.aborted){const E=Gv(i,r);e.emit({type:"onBeforeNavigate",...E}),_.signal.aborted||e.emit({type:"onBeforeLoad",...E})}if(_.signal.aborted){await kg(e,t);return}const p=s.href===i.href;let m=_;const x=e.matchRoutes(i,{_controller:_});U5(x);const S=u?l[1](x):void 0;if(S?m=u:u==null||u.abort(),_.signal.aborted){xi(e,x),await kg(e,t);return}e._preflight=void 0;let v;const b=()=>KW(e,y,p,()=>b4(e,y),n==null?void 0:n.sync,S),w=n!=null&&n.sync?new Promise(E=>v=E):Promise.resolve().then(b).then(),y=[m,o,i,x,Date.now(),w];if(e._tx=y,t){for(const E of e.stores.matches.get()){if(e._tx!==y)break;E.isFetching&&Y0(e,E,!1)}t[0].abort(),xi(e,t[3],y[3],!0)}if(e._tx!==y){xi(e,y[3]),y[3]=[],v==null||v(),await kg(e,y);return}e.batch(()=>{e.stores.status.set("pending"),e.stores.location.set(i)}),(S||!e._committed.length&&((C=x[0])==null?void 0:C.status)!=="success"&&!x.some(E=>E._notFound))&&b4(e,y),v==null||v(b()),await w,await kg(e,y)}async function YW(e,n){let t=e.buildLocation(n);for(let r=0;;r++){const s=e._committed,i=new AbortController;let a,o,l;try{try{a=e.matchRoutes(t,{_controller:i}),U5(a),o=(e._preloads??(e._preloads=new Map)).set(i,a),l=await FM(e,t,a,[i,r,s,!0])}finally{o&&(o=o.delete(i),xi(e,a)),i.abort()}if(!K0(l))return l[1];if(!o||l.length<3)return;t=l[2]}catch(u){Dh(u)||console.error(u);return}}}const XW="Error preloading route! ☝️";var UM=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=n=>{var l,u;this.originalIndex=n.originalIndex;const t=this.options,r=!(t!=null&&t.path)&&!(t!=null&&t.id);this.parentRoute=(u=(l=this.options).getParentRoute)==null?void 0:u.call(l),r?this._path=ih:this.parentRoute||B5();let s=r?ih:t==null?void 0:t.path;s&&s!=="/"&&(s=DM(s));const i=(t==null?void 0:t.id)||s;let a=r?ih:m1([this.parentRoute.id==="__root__"?"":this.parentRoute.id,i]);s==="__root__"&&(s="/"),a!=="__root__"&&(a=m1(["/",a]));const o=a==="__root__"?"/":m1([this.parentRoute.fullPath,s]);this._path=s,this._id=a,this._fullPath=o,this._to=jl(o)},this.addChildren=n=>this._addFileChildren(n),this._addFileChildren=n=>(Array.isArray(n)&&(this.children=n),typeof n=="object"&&n!==null&&(this.children=Object.values(n)),this),this._addFileTypes=()=>this,this.updateLoader=n=>(Object.assign(this.options,n),this),this.update=n=>(Object.assign(this.options,n),this),this.lazy=n=>(this.lazyFn=n,this),this.redirect=n=>TW({from:this.fullPath,...n}),this.options=e||{},this.isRoot=!(e!=null&&e.getParentRoute),e!=null&&e.id&&(e!=null&&e.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},ZW=class extends UM{constructor(e){super(e)}},W5=class extends R.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,n){const t=e.getResetKey();return n.error&&n.resetKey!==t?{resetKey:t,error:null}:{resetKey:t}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,n){var t,r;(r=(t=this.props).onCatch)==null||r.call(t,e,n)}render(){const e=this.state.error;return e?R.createElement(this.props.errorComponent??JW,{error:e,reset:this.reset}):this.props.children}};function JW({error:e}){const[n,t]=R.useState(!1);return f.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[f.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),f.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>t(r=>!r),children:n?"Hide Error":"Show Error"})]}),f.jsx("div",{style:{height:".25rem"}}),n?f.jsx("div",{children:f.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?f.jsx("code",{children:e.message}):null})}):null]})}function eV({children:e,fallback:n=null}){return f.jsx(Je.Fragment,{children:GM()?e:n})}function GM(){return Je.useSyncExternalStore(tV,()=>!0,()=>!1)}function tV(){return()=>{}}var WM=R.createContext(null);function ei(e){return R.useContext(WM)}var Vv=R.createContext(void 0),nV=R.createContext(void 0),vr=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(vr||{});function rV({update:e,notify:n,unwatched:t}){return{link:r,unlink:s,propagate:i,checkDirty:a,shallowPropagate:o};function r(u,_,d){const p=_.depsTail;if(p!==void 0&&p.dep===u)return;const m=p!==void 0?p.nextDep:_.deps;if(m!==void 0&&m.dep===u){m.version=d,_.depsTail=m;return}const x=u.subsTail;if(x!==void 0&&x.version===d&&x.sub===_)return;const S=_.depsTail=u.subsTail={version:d,dep:u,sub:_,prevDep:p,nextDep:m,prevSub:x,nextSub:void 0};m!==void 0&&(m.prevDep=S),p!==void 0?p.nextDep=S:_.deps=S,x!==void 0?x.nextSub=S:u.subs=S}function s(u,_=u.sub){const d=u.dep,p=u.prevDep,m=u.nextDep,x=u.nextSub,S=u.prevSub;return m!==void 0?m.prevDep=p:_.depsTail=p,p!==void 0?p.nextDep=m:_.deps=m,x!==void 0?x.prevSub=S:d.subsTail=S,S!==void 0?S.nextSub=x:(d.subs=x)===void 0&&t(d),m}function i(u){let _=u.nextSub,d;e:do{const p=u.sub;let m=p.flags;if(m&60?m&12?m&4?!(m&48)&&l(u,p)?(p.flags=m|40,m&=1):m=0:p.flags=m&-9|32:m=0:p.flags=m|32,m&2&&n(p),m&1){const x=p.subs;if(x!==void 0){const S=(u=x).nextSub;S!==void 0&&(d={value:_,prev:d},_=S);continue}}if((u=_)!==void 0){_=u.nextSub;continue}for(;d!==void 0;)if(u=d.value,d=d.prev,u!==void 0){_=u.nextSub;continue e}break}while(!0)}function a(u,_){let d,p=0,m=!1;e:do{const x=u.dep,S=x.flags;if(_.flags&16)m=!0;else if((S&17)===17){if(e(x)){const v=x.subs;v.nextSub!==void 0&&o(v),m=!0}}else if((S&33)===33){(u.nextSub!==void 0||u.prevSub!==void 0)&&(d={value:u,prev:d}),u=x.deps,_=x,++p;continue}if(!m){const v=u.nextDep;if(v!==void 0){u=v;continue}}for(;p--;){const v=_.subs,b=v.nextSub!==void 0;if(b?(u=d.value,d=d.prev):u=v,m){if(e(_)){b&&o(v),_=u.sub;continue}m=!1}else _.flags&=-33;_=u.sub;const w=u.nextDep;if(w!==void 0){u=w;continue e}}return m}while(!0)}function o(u){do{const _=u.sub,d=_.flags;(d&48)===32&&(_.flags=d|16,(d&6)===2&&n(_))}while((u=u.nextSub)!==void 0)}function l(u,_){let d=_.depsTail;for(;d!==void 0;){if(d===u)return!0;d=d.prevDep}return!1}}function sV(e,n,t){var i,a,o;const r=typeof e=="object",s=r?e:void 0;return{next:(i=r?e.next:e)==null?void 0:i.bind(s),error:(a=r?e.error:n)==null?void 0:a.bind(s),complete:(o=r?e.complete:t)==null?void 0:o.bind(s)}}const y4=[];let y1=0;const{link:F9,unlink:iV,propagate:aV,checkDirty:VM,shallowPropagate:H9}=rV({update(e){return e._update()},notify(e){y4[x4++]=e,e.flags&=~vr.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=vr.Mutable|vr.Dirty,Y1(e))}});let Cg=0,x4=0,ko,w4=0;function oV(e){try{++w4,e()}finally{--w4||KM()}}function Y1(e){const n=e.depsTail;let t=n!==void 0?n.nextDep:e.deps;for(;t!==void 0;)t=iV(t,e)}function KM(){if(!(w4>0)){for(;Cg{var u;s.get(),o.current?(u=a.next)==null||u.call(a,s._snapshot):o.current=!0});return{unsubscribe:()=>{l.stop()}}},_update(i){const a=ko,o=(n==null?void 0:n.compare)??Object.is;if(t)ko=s,++y1,s.depsTail=void 0;else if(i===void 0)return!1;t&&(s.flags=vr.Mutable|vr.RecursedCheck);try{const l=s._snapshot,u=typeof i=="function"?i(l):i===void 0&&t?r(l):i;return l===void 0||!o(l,u)?(s._snapshot=u,!0):!1}finally{ko=a,t&&(s.flags&=~vr.RecursedCheck),Y1(s)}}};return t?(s.flags=vr.Mutable|vr.Dirty,s.get=function(){const i=s.flags;if(i&vr.Dirty||i&vr.Pending&&VM(s.deps,s)){if(s._update()){const a=s.subs;a!==void 0&&H9(a)}}else i&vr.Pending&&(s.flags=i&~vr.Pending);return ko!==void 0&&F9(s,ko,y1),s._snapshot}):s.set=function(i){if(s._update(i)){const a=s.subs;a!==void 0&&(aV(a),H9(a),KM())}},s}function lV(e){const n=()=>{const r=ko;ko=t,++y1,t.depsTail=void 0,t.flags=vr.Watching|vr.RecursedCheck;try{return e()}finally{ko=r,t.flags&=~vr.RecursedCheck,Y1(t)}},t={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:vr.Watching|vr.RecursedCheck,notify(){const r=this.flags;r&vr.Dirty||r&vr.Pending&&VM(this.deps,this)?n():this.flags=vr.Watching},stop(){this.flags=vr.None,this.depsTail=void 0,Y1(this)}};return n(),t}var ux={exports:{}},dx={},fx={exports:{}},hx={};/** * @license React * use-sync-external-store-shim.production.js * @@ -62,13 +62,13 @@ Error generating stack: `+k.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var W9;function dV(){if(W9)return dx;W9=1;var e=Wp(),n=uV();function t(u,_){return u===_&&(u!==0||1/u===1/_)||u!==u&&_!==_}var r=typeof Object.is=="function"?Object.is:t,s=n.useSyncExternalStore,i=e.useRef,a=e.useEffect,o=e.useMemo,l=e.useDebugValue;return dx.useSyncExternalStoreWithSelector=function(u,_,d,p,m){var x=i(null);if(x.current===null){var S={hasValue:!1,value:null};x.current=S}else S=x.current;x=o(function(){function b(N){if(!w){if(w=!0,y=N,N=p(N),m!==void 0&&S.hasValue){var T=S.value;if(m(T,N))return C=T}return C=N}if(T=C,r(y,N))return T;var z=p(N);return m!==void 0&&m(T,z)?(y=N,T):(y=N,C=z)}var w=!1,y,C,E=d===void 0?null:d;return[function(){return b(_())},E===null?void 0:function(){return b(E())}]},[_,d,p,m]);var v=s(u,x[0],x[1]);return a(function(){S.hasValue=!0,S.value=v},[v]),l(v),v},dx}var V9;function fV(){return V9||(V9=1,ux.exports=dV()),ux.exports}var QM=fV();const hV=Gp(QM);function _V(e,n){return e===n}function Oo(e,n,t=_V){const r=R.useCallback(a=>{if(!e)return()=>{};const{unsubscribe:o}=e.subscribe(a);return o},[e]),s=R.useCallback(()=>e==null?void 0:e.get(),[e]);return QM.useSyncExternalStoreWithSelector(r,s,s,n,t)}var K9={};function V5(e,n){const t=R.useRef();return r=>{const s=e!=null&&e.select?e.select(r):r;return(e==null?void 0:e.structuralSharing)??n.options.defaultStructuralSharing?t.current=od(t.current,s):s}}function Kd(e){const n=li(),t=R.useContext(e.from?nV:Kv),r=e.from??t,s=n.stores.getMatchStore(r),i=V5(e,n),a=Oo(s,o=>o?i(o):K9);if(a!==K9)return a;(e.shouldThrow??!0)&&B5()}function YM(e){return Kd({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:n=>e.select?e.select(n.loaderData):n.loaderData})}function XM(e){const{select:n,...t}=e;return Kd({...t,select:r=>n?n(r.loaderDeps):r.loaderDeps})}function ZM(e){return Kd({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:n=>{const t=e.strict===!1?n.params:n._strictParams;return e.select?e.select(t):t}})}function JM(e){return Kd({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:n=>e.select?e.select(n.search):n.search})}function Qv(e){const n=li();return R.useCallback(t=>n.navigate({...t,from:t.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,n])}function K5(e){return Kd({...e,select:n=>e.select?e.select(n.context):n.context})}function _x(e){const n=R.useRef(e);return au(n.current,e,{ignoreUndefined:!1})||(n.current=e),n.current}function pV(e,n){return e[0]===n[0]&&e[1]===n[1]&&e[2]===n[2]}function mV(e,n,t){if(e!=null&&e.external)return G1(e.href,t)?void 0:e.href;if(!SV(n)&&!(typeof n!="string"||n.indexOf(":")===-1))try{return new URL(n),G1(n,t)?void 0:n}catch{}}function gV(e,n,t,r,s,i){if(i)return!1;if(t!=null&&t.exact){if(!fW(e.pathname,n.pathname,r))return!1}else{const a=V1(e.pathname,r),o=V1(n.pathname,r);if(!(a.startsWith(o)&&(a.length===o.length||a[o.length]==="/")))return!1}return((t==null?void 0:t.includeSearch)??!0)&&!au(e.search,n.search,{partial:!(t!=null&&t.exact),ignoreUndefined:!(t!=null&&t.explicitUndefined)})?!1:t!=null&&t.includeHash?s&&e.hash===n.hash:!0}function vV(e,n){const t=li(),r=KG(n),{activeProps:s,inactiveProps:i,activeOptions:a,to:o,preload:l,preloadDelay:u,preloadIntentProximity:_,hashScrollIntoView:d,replace:p,startTransition:m,resetScroll:x,viewTransition:S,children:v,target:b,disabled:w,style:y,className:C,onClick:E,onBlur:N,onFocus:T,onMouseEnter:z,onMouseLeave:M,onTouchStart:O,ignoreBlocker:B,params:$,search:U,hash:H,state:Y,mask:V,reloadDocument:X,unsafeRelative:te,from:I,_fromLocation:L,...F}=e,q=GM(),G=_x(e.search),ee=_x(e.params),ce=_x(a),oe=R.useMemo(()=>e,[t,e.from,e._fromLocation,e.hash,e.to,G,ee,e.state,e.mask,e.unsafeRelative]),ne=R.useCallback(ot=>{const ft=t.buildLocation({_fromLocation:ot,...oe}),It=wV(ft.maskedLocation?ft.maskedLocation.publicHref:ft.publicHref,ft.maskedLocation?ft.maskedLocation.external:ft.external,t.history,w),we=mV(It,o,t.protocolAllowlist);return[It==null?void 0:It.href,we,gV(ot,ft,ce,t.basepath,q,we!==void 0)]},[ce,w,q,oe,t,o]),[Q,le,ae]=Oo(t.stores.location,ne,pV),ue=ae?Ih(s,{})??bV:px,pe=ae?px:Ih(i,{})??px,Se=[C,ue.className,pe.className].filter(Boolean).join(" "),ye=(y||ue.style||pe.style)&&{...y,...ue.style,...pe.style},qe=R.useRef(!1),Ie=e.reloadDocument||le||w?!1:l??t.options.defaultPreload,ze=u??t.options.defaultPreloadDelay??0,at=R.useCallback(()=>{t.preloadRoute(oe).catch(ot=>{console.warn(ot),console.warn(XW)})},[t,oe]),bt=R.useCallback(ot=>{if(!ot){mx(r);return}if(!(ot.isIntersecting??Ie==="intent")){ot.isIntersecting===!1&&mx(r);return}if(!ze){at();return}M0.has(r)||M0.set(r,setTimeout(()=>{M0.delete(r),at()},ze))},[at,r,Ie,ze]);VG(r,bt,Ie!=="viewport"),R.useEffect(()=>{qe.current||Ie==="render"&&(at(),qe.current=!0)},[at,Ie]);const $t=ot=>{const ft=ot.currentTarget.getAttribute("target"),It=b!==void 0?b:ft;!w&&!(ot.metaKey||ot.altKey||ot.ctrlKey||ot.shiftKey)&&!ot.defaultPrevented&&(!It||It==="_self")&&ot.button===0&&(ot.preventDefault(),t.navigate({...oe,replace:p,resetScroll:x,hashScrollIntoView:d,startTransition:m,viewTransition:S,ignoreBlocker:B}))};if(le)return{...F,ref:r,href:le,...v&&{children:v},...b&&{target:b},...w&&{disabled:w},...y&&{style:y},...C&&{className:C},...E&&{onClick:E},...N&&{onBlur:N},...T&&{onFocus:T},...z&&{onMouseEnter:z},...M&&{onMouseLeave:M},...O&&{onTouchStart:O}};const Pt=()=>{Ie==="intent"&&at()},zt=()=>{Ie==="intent"&&mx(r)};return{...F,...ue,...pe,href:Q,ref:r,onClick:Ff([E,$t]),onBlur:Ff([N,zt]),onFocus:Ff([T,bt]),onMouseEnter:Ff([z,bt]),onMouseLeave:Ff([M,zt]),onTouchStart:Ff([O,Pt]),disabled:!!w,target:b,...ye&&{style:ye},...Se&&{className:Se},...w&&yV,...ae&&xV}}var px={},bV={className:"active"},yV={role:"link","aria-disabled":!0},xV={"data-status":"active","aria-current":"page"},M0=new WeakMap,mx=e=>{clearTimeout(M0.get(e)),M0.delete(e)},Ff=e=>n=>{for(const t of e)if(t){if(n.defaultPrevented)return;t(n)}};function wV(e,n,t,r){if(!r)return n?{href:e,external:!0}:{href:t.createHref(e)||"/",external:!1}}function SV(e){if(typeof e!="string")return!1;const n=e.charCodeAt(0);return n===47?e.charCodeAt(1)!==47:n===46}var Yv=R.forwardRef((e,n)=>{const{_asChild:t,...r}=e,{type:s,...i}=vV(r,n),a=typeof r.children=="function"?r.children({isActive:i["data-status"]==="active"}):r.children;if(!t){const{disabled:o,...l}=i;return R.createElement("a",l,a)}return R.createElement(t,i,a)}),kV=class extends UM{constructor(n){super(n),this.useMatch=t=>Kd({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>K5({...t,from:this.id}),this.useSearch=t=>JM({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>ZM({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>XM({...t,from:this.id}),this.useLoaderData=t=>YM({...t,from:this.id}),this.useNavigate=()=>Qv({from:this.fullPath}),this.Link=Je.forwardRef((t,r)=>f.jsx(Yv,{ref:r,from:this.fullPath,...t}))}};function CV(e){return new kV(e)}function EV(){return e=>zV(e)}var NV=class extends ZW{constructor(e){super(e),this.useMatch=n=>Kd({select:n==null?void 0:n.select,from:this.id,structuralSharing:n==null?void 0:n.structuralSharing}),this.useRouteContext=n=>K5({...n,from:this.id}),this.useSearch=n=>JM({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useParams=n=>ZM({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useLoaderDeps=n=>XM({...n,from:this.id}),this.useLoaderData=n=>YM({...n,from:this.id}),this.useNavigate=()=>Qv({from:this.fullPath}),this.Link=Je.forwardRef((n,t)=>f.jsx(Yv,{ref:t,from:this.fullPath,...n}))}};function zV(e){return new NV(e)}function Fo(e){return n=>{const t=CV(n);return t.isRoot=!1,t}}function jV(e){const n=li(),t=`not-found-${Oo(n.stores.location,r=>r.pathname)}-${Oo(n.stores.status,r=>r)}`;return f.jsx(W5,{getResetKey:()=>t,onCatch:(r,s)=>{var i;if(Bh(r))(i=e.onCatch)==null||i.call(e,r,s);else throw r},errorComponent:({error:r})=>{var s;if(Bh(r))return(s=e.fallback)==null?void 0:s.call(e,r);throw r},children:e.children})}function TV(){return f.jsx("p",{children:"Not Found"})}function Qf(e){return f.jsx(f.Fragment,{children:e.children})}function eD(e,n,t){return n.options.notFoundComponent?f.jsx(n.options.notFoundComponent,{...t}):e.options.defaultNotFoundComponent?f.jsx(e.options.defaultNotFoundComponent,{...t}):f.jsx(TV,{})}function Xv(e,n){const t=(n==null?void 0:n.options.pendingComponent)??e.options.defaultPendingComponent;return t?f.jsx(t,{}):null}var AV=(e,n)=>e[0]===n[0]&&e[1]===n[1],tD=(e,n,t)=>!n.isRoot||n.options.shellComponent||n.options.wrapInSuspense||t===!1||t==="data-only"||!e.ssr,nD=R.memo(function({routeId:n}){const t=li();return f.jsx(RV,{router:t,match:Oo(t.stores.getMatchStore(n),r=>r)})});function RV({router:e,match:n}){var d,p;const t=e.routesById[n.routeId],r=Xv(e,t),s=t.options.errorComponent??e.options.defaultErrorComponent,i=t.options.onCatch??e.options.defaultOnCatch,a=t.isRoot?t.options.notFoundComponent??((d=e.options.notFoundRoute)==null?void 0:d.options.component):t.options.notFoundComponent,o=n.ssr===!1||n.ssr==="data-only",l=tD(e,t,n.ssr)&&(t.options.wrapInSuspense??r??(((p=t.options.errorComponent)==null?void 0:p.preload)||o))?R.Suspense:Qf,u=s?W5:Qf,_=a?jV:Qf;return f.jsxs(t.isRoot?t.options.shellComponent??Qf:Qf,{children:[f.jsx(Kv.Provider,{value:n.routeId,children:f.jsx(l,{fallback:r,children:f.jsx(u,{getResetKey:()=>n,errorComponent:s,onCatch:(m,x)=>{if(Bh(m))throw m.routeId??(m.routeId=n.routeId),m;i==null||i(m,x)},children:f.jsx(_,{fallback:m=>{if(m.routeId??(m.routeId=n.routeId),m.routeId!==n.routeId)throw m;return R.createElement(a,m)},children:o?f.jsx(eV,{fallback:r,children:f.jsx(Q9,{match:n})}):f.jsx(Q9,{match:n})})})})}),null]})}var Q9=R.memo(function({match:n}){const t=li(),r=n.routeId,s=t.routesById[r],i=R.useMemo(()=>{var l;const o=(l=s.options.remountDeps??t.options.defaultRemountDeps)==null?void 0:l({routeId:r,loaderDeps:n.loaderDeps,params:n._strictParams,search:n._strictSearch});return o?JSON.stringify(o):void 0},[r,n.loaderDeps,n._strictParams,n._strictSearch,s.options.remountDeps,t.options.defaultRemountDeps]),a=R.useMemo(()=>{const o=s.options.component??t.options.defaultComponent;return o?f.jsx(o,{},i):f.jsx(Z0,{})},[i,s.options.component,t.options.defaultComponent]);if(n.status==="pending"){if(t.ssr&&!tD(t,s,n.ssr))return a;if(t._tx)throw t._tx[5];return Xv(t,s)}if(n.status==="notFound")return eD(t,s,n.error);if(n.status==="error")throw n.error;return a}),Z0=R.memo(function(){const n=li(),t=R.useContext(Kv);let r,s,i;{const o=n.stores.getMatchStore(t);[r,s]=Oo(o,l=>[!!l._notFound,l.error],AV),i=Oo(n.stores.ids,l=>l[l.indexOf(t)+1])}if(r)return eD(n,n.routesById[t],s);if(!i)return null;const a=f.jsx(nD,{routeId:i});return t===ch?f.jsx(R.Suspense,{fallback:Xv(n),children:a}):a});function rD(e,n){const t=e[1];e.length=0,t==null||t(n)}function MV({t:e}){const n=li(),t=n._rendered??(n._rendered=[]);return n.startTransition=(r,s)=>new Promise(i=>{rD(t,!1),t.push(s,i),e(n),R.startTransition(r)}),EM(()=>{const r=n.history.subscribe(n.load);n.updateLatestLocation();const s=n.latestLocation,i=n.buildLocation({to:s.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(Al(s.publicHref)!==Al(i.publicHref))return n.commitLocation({...i,replace:!0,ignoreBlocker:!0}),r;const a=n.stores.resolvedLocation.get();return(a==null?void 0:a.href)===s.href&&a.state.__TSR_key===s.state.__TSR_key?t.push(n.stores.matches.get(),o=>{o&&n.emit({type:"onRendered",...Wv(a,a)})}):n._tx||n.load({sync:!0}).catch(console.error),r},[n,n.history]),null}function DV(){const e=li(),n=e.routesById[ch],t=Xv(e,n),r=e.ssr?Qf:R.Suspense,s=f.jsxs(f.Fragment,{children:[f.jsx(MV,{t:R.useState()[1]}),f.jsx(r,{fallback:t,children:f.jsx(LV,{})})]});return e.options.InnerWrap?f.jsx(e.options.InnerWrap,{children:s}):s}function LV(){const e=li(),n=e._rendered,t=Oo(e.stores.matches,a=>n[0]??a),r=t[0],s=r==null?void 0:r.routeId;EM(()=>{n[0]===t&&rD(n,!0)},[n,t]);const i=s?f.jsx(nD,{routeId:s}):null;return f.jsx(Kv.Provider,{value:s,children:e.options.disableGlobalCatchBoundary?i:f.jsx(W5,{getResetKey:()=>r,onCatch:void 0,children:i})})}var OV=e=>({createMutableStore:q9,createReadonlyStore:q9,batch:oV}),IV=e=>new BV(e),BV=class extends BW{constructor(e){super(e,OV)}};function $V({router:e,children:n,...t}){zM(t)&&e.update({...e.options,...t,context:{...e.options.context,...t.context}});const r=f.jsx(WM.Provider,{value:e,children:n});return e.options.Wrap?f.jsx(e.options.Wrap,{children:r}):r}function PV({router:e,...n}){return f.jsx($V,{router:e,...n,children:f.jsx(DV,{})})}function FV(e,n){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in e)return e;if(typeof e=="function")return{shouldBlockFn:async()=>await e(),enableBeforeUnload:!0,withResolver:!1};const t=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>t&&r!==void 0?await r():t,enableBeforeUnload:t,withResolver:r===void 0}}function HV(e,n){const{shouldBlockFn:t,enableBeforeUnload:r=!0,disabled:s=!1,withResolver:i=!1}=FV(e),a=li(),{history:o}=a,[l,u]=R.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return R.useEffect(()=>{const _=async d=>{function p(b){const w=a.parseLocation(b),[,y,C]=a.getMatchedRoutes(w.pathname);return C===void 0?{routeId:"__notFound__",fullPath:w.pathname,pathname:w.pathname,params:y,search:a.options.parseSearch(b.search)}:{routeId:C.id,fullPath:C.fullPath,pathname:w.pathname,params:y,search:a.options.parseSearch(b.search)}}const m=p(d.currentLocation),x=p(d.nextLocation);if(m.routeId==="__notFound__"&&x.routeId!=="__notFound__")return!1;const S=await t({action:d.action,current:m,next:x});if(!i)return S;if(!S)return!1;const v=await new Promise(b=>{u({status:"blocked",current:m,next:x,action:d.action,proceed:()=>b(!1),reset:()=>b(!0)})});return u({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),v};return s?void 0:o.block({blockerFn:_,enableBeforeUnload:r})},[t,r,s,i,o,a]),l}function sD(e){const n=li({warn:(e==null?void 0:e.router)===void 0}),t=(e==null?void 0:e.router)||n;return Oo(t.stores.__store,V5(e,t))}function qV(e){const n=li();return Oo(n.stores.location,V5(e,n))}const X1=new WeakMap,x1=new WeakMap;function Ga(e,n,t="*"){var r;for(const s of e.getQueryCache().findAll({queryKey:n}))X1.set(s,(X1.get(s)??0)+1),(r=x1.get(s))==null||r.add(t)}function Vp(e,n,t,r=!0){if(!n)return e;const s=new Map(n.map(l=>[l.id,l])),i=new Set(e.map(l=>l.id)),a=n.filter(l=>t.has(l.id)&&!i.has(l.id)),o=e.filter(l=>!t.has(l.id)||s.has(l.id)).map(l=>t.has(l.id)?s.get(l.id)??l:l);return r?[...a,...o]:[...o,...a]}async function a_(e,n,t,r=(s,i)=>i??s){const s=e.getQueryCache().find({queryKey:n,exact:!0}),i=s?X1.get(s):void 0,a=await t();if(!s||X1.get(s)===i||s.state.fetchStatus!=="fetching"||e.getQueryCache().find({queryKey:n,exact:!0})!==s)return a;e.setQueryData(n,l=>l??a);const o=new Set;x1.set(s,o);try{const l=await t();return o.size?r(l,e.getQueryData(n),o):l}finally{x1.get(s)===o&&x1.delete(s)}}const $h=e=>typeof e=="string"&&/^[0-9a-f]{40}$/i.test(e);function iD(e){const n=e.queryKey[2];if(n==="resolvedFile")return $h(e.queryKey[7]);const t=n==="getProjectFile"?e.queryKey[5]:n==="getCodeTree"?e.queryKey[4]:null;return typeof t=="object"&&t!==null&&"ref"in t&&$h(t.ref)}function xa(e,n=za(),t,r=!1){if(!Pn(n))return;const s={queryKey:n,predicate:i=>e.includes(String(i.queryKey[2]))&&!iD(i)&&(!t||t(i))};r?nt.cancelQueries(s).then(()=>{Pn(n)&&nt.invalidateQueries(s)}):nt.invalidateQueries(s)}const aD=["resolvedFile","getProjectFile","getArtifactFileText","getArtifactFileMetadata"],Q5=["getArtifacts","getArtifactFileText","getArtifactFileMetadata"],UV=["listProjects","listProjectActivity","listExperiments","listRuns","listChatSessions","getChatMessages","getHarnesses","getUpdateStatus",...Q5,...aD,"getAbsoluteFile","fileVersion","getCodeTree","getSessionWorktree","getRunDiff","getExperimentDiff"];function GV(e,n=za(),t=!1){const r=nt.getQueryData([...n,"listChatSessions",e])??[],s=nt.getQueryData([...n,"listRuns",e])??[],i=nt.getQueryData([...n,"listExperiments",e])??[];xa([...aD,...Q5,"getRunDiff","getExperimentDiff","getCodeTree","getSessionWorktree","fileVersion","getProjectGitStatus","getOverleafState","getOverleafStatus"],n,a=>{const o=a.queryKey[2];return o==="getRunDiff"?s.some(l=>l.id===a.queryKey[3]):o==="getExperimentDiff"?i.some(l=>l.id===a.queryKey[3]):o==="getSessionWorktree"?r.some(l=>l.id===a.queryKey[3]):o==="fileVersion"?typeof a.queryKey[3]=="string"&&a.queryKey[3].startsWith(`/api/projects/${e}/`):a.queryKey[3]===e},t)}function Zv(e){const n=za();uu.add(e),Ga(nt,[...n,"listChatSessions"],e),nt.setQueriesData({queryKey:[...n,"listChatSessions"]},t=>t==null?void 0:t.filter(r=>r.id!==e));for(const t of["getChatMessages","getSessionWorktree"])I5({queryKey:[...n,t,e]})}function WV(e){const n=za(),t=nt.getQueryData([...n,"listChatSessions",e]);for(const r of t??[])Zv(r.id);I5({queryKey:n,predicate:r=>r.queryKey.slice(3).includes(e)})}const VV={hf:["getHfSettings","getComputeSettings","getEnvVars"],tinker:["getTinkerSettings","getComputeSettings","getEnvVars"],k8s:["getK8sSettings","getComputeSettings"],modal:["getModalSettings","getComputeSettings","getEnvVars"],slurm:["getSlurmSettings","getComputeSettings"],ray:["getRaySettings","getComputeSettings"],env:["getEnvVars","getHfSettings","getTinkerSettings","getModalSettings","getSlurmSettings","getRaySettings","getK8sSettings","getOpenResearchSettings","getComputeSettings","getHarnesses"],"data-dir":["getDataDir"],ssh:["getSshHosts","getSshConfig","getSshMasterStatus","getComputeSettings"],compute:["getComputeSettings"],git:["githubAccount","repoAccess","getProjectGitStatus"],profile:["getProfile"],"lit-sources":["getLitSources"],projects:["getProjectDefaults","getProjectGitStatus"],telemetry:["getTelemetry"]};function KV(e,n){var a;if(!Pn(n))return;const t=(o,l=n,u)=>xa(o,l,u,!0),r=e.split("?")[0];if(/\/(ui-state|open|prewarm|validate|preflight)$/.test(r))return;const s=(a=/^\/api\/settings\/([^/]+)/.exec(r))==null?void 0:a[1];if(s){t(VV[s]??[],n);return}if(r.startsWith("/api/local-models")&&!/\/(discover|check)$/.test(r)){t(["getLocalModels","getHarnesses"],n);return}if(r==="/api/user-skills"){t(["listUserSkills","getSkills","getSkillContent"],n);return}if(r==="/api/latex-templates"){t(["listLatexTemplates"],n);return}if(r==="/api/overleaf/token"){t(["getOverleafSettings","getOverleafState","getOverleafStatus"],n);return}if(r.startsWith("/api/update/")){t(["getUpdateStatus","getLocalMachine"],n);return}if(r.startsWith("/api/remote/")||r.startsWith("/_orx/")){t(["listRemoteSessions"],n),nt.invalidateQueries({queryKey:["gateway","runtime"]});return}if(r.startsWith("/api/chat/")){r==="/api/chat/sessions"&&t(["getProjectStarterPrompts","listProjectActivity"],n);return}const i=/^\/api\/projects\/([^/]+)(.*)$/.exec(r);if(i){const[,o,l]=i;if(l.startsWith("/file")){GV(o,n,!0);return}t(["listProjects","listProjectActivity"],n),t(["getProjectGitStatus","getCodeTree","getProjectStarterPrompts"],n,u=>u.queryKey[3]===o);return}(r==="/api/projects"||r==="/api/onboarding/complete")&&t(["listProjects","listProjectActivity","getUiState","getProfile"],n)}const QV={},YV="en",Y5=["en","zh-CN","fa"],oD="orx:locale",X5=["localStorage","preferredLanguage","baseLocale"],Y9=[],J0=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{};globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let X9=!1,j=()=>{var t;let e=X5;!J0&&typeof window<"u"&&((t=window.location)!=null&&t.href)&&(e=uD(window.location.href));const n=XV(e);if(n)return X9||(X9=!0,lD(n,{reload:!1})),n;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function XV(e,n){let t;for(const r of e){if(r==="baseLocale")t=YV;else if(r==="preferredLanguage"&&!J0)t=nK();else if(r==="localStorage"&&!J0)t=localStorage.getItem(oD)??void 0;else if(dD(r)&&Z1.has(r)){const i=Z1.get(r);if(i){const a=i.getLocale();if(a instanceof Promise)continue;if(a!==void 0)return eK(a)}}const s=ep(t);if(s)return s}}const ZV=e=>{window.location.reload()};let lD=(e,n)=>{var o;const t={reload:!0,...n};let r;try{r=j()}catch{}const s=[];let i=X5;!J0&&typeof window<"u"&&((o=window.location)!=null&&o.href)&&(i=uD(window.location.href));for(const l of i)if(l!=="baseLocale"){if(l==="localStorage"&&typeof window<"u")localStorage.setItem(oD,e);else if(dD(l)&&Z1.has(l)){const u=Z1.get(l);if(u){let _=u.setLocale(e);_ instanceof Promise&&(_=_.catch(d=>{throw new Error(`Custom strategy "${l}" setLocale failed.`,{cause:d})}),s.push(_))}}}const a=()=>{!J0&&t.reload&&window.location&&e!==r&&ZV()};if(s.length)return Promise.all(s).then(()=>{a()});a()},JV=()=>typeof window<"u"?window.location.origin:"http://fallback.com";function ep(e){if(typeof e!="string")return;const n=e.toLowerCase();for(const t of Y5)if(t.toLowerCase()===n)return t}function cD(e){return!!e&&Y5.some(n=>n===e)}function eK(e){const n=ep(e);if(n)return n;throw new Error(`Invalid locale: ${e}. Expected one of: ${Y5.join(", ")}`)}function tK(e,n){return e.exec(n.href)}function nK(){var n;if(!((n=navigator==null?void 0:navigator.languages)!=null&&n.length))return;const e=navigator.languages.map(t=>({fullTag:t,baseTag:t.split("-")[0]}));for(const t of e){const r=ep(t.fullTag);if(r)return r;const s=ep(t.baseTag);if(s)return s}}function rK(e){return sK(e)}function sK(e){const n=typeof e=="string"?new URL(e,JV()):new URL(e),t=n.pathname.split("/").filter(Boolean);return t.length>0&&ep(t[0])&&(n.pathname="/"+t.slice(1).join("/")),n}let Z9,J9;function iK(e){if(Y9.length===0)return;const n=typeof e=="string"?e:e.href;if(Z9===n)return J9;const t=new URL(n,"http://example.com"),r=rK(t),s=r.href===t.href?[t]:[t,r];let i;for(const a of s){for(const o of Y9){const l=new QV(o.match,a.href);if(tK(l,a)){i=o;break}}if(i)break}return Z9=n,J9=i,i}function uD(e){const n=iK(e);return n&&n.exclude!==!0&&Array.isArray(n.strategy)?n.strategy:X5}const Z1=new Map;function dD(e){return typeof e=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(e)}const aK=e=>`Actions for ${e==null?void 0:e.name}`,oK=e=>`${e==null?void 0:e.name} 的操作`,lK=e=>`عملیات ${e==null?void 0:e.name}`,cK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?oK(e):t==="fa"?lK(e):aK(e)}),uK=e=>`${e==null?void 0:e.path} — press Space to preview; double-click or press Enter to keep open in a tab`,dK=e=>`${e==null?void 0:e.path}——按空格键预览;双击或按 Enter 以在标签页中保持打开`,fK=e=>`${e==null?void 0:e.path} — برای پیش‌نمایش Space و برای باز نگه‌داشتن در زبانه دوبار کلیک کنید یا Enter را بزنید`,hK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?dK(e):t==="fa"?fK(e):uK(e)}),_K=e=>`Branch: ${e==null?void 0:e.branch}`,pK=e=>`分支:${e==null?void 0:e.branch}`,mK=e=>`شاخه: ${e==null?void 0:e.branch}`,gK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?pK(e):t==="fa"?mK(e):_K(e)}),vK=e=>`Browse code on ${e==null?void 0:e.branch}`,bK=e=>`浏览分支 ${e==null?void 0:e.branch} 上的代码`,yK=e=>`مرور کد در شاخهٔ ${e==null?void 0:e.branch}`,fD=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?bK(e):t==="fa"?yK(e):vK(e)}),xK=e=>`Harness and model for this chat: ${e==null?void 0:e.label}`,wK=e=>`此聊天的智能体工具和模型:${e==null?void 0:e.label}`,SK=e=>`ابزار عامل و مدل این گفتگو: ${e==null?void 0:e.label}`,kK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?wK(e):t==="fa"?SK(e):xK(e)}),CK=e=>`Collapse ${e==null?void 0:e.name}`,EK=e=>`折叠 ${e==null?void 0:e.name}`,NK=e=>`بستن ${e==null?void 0:e.name}`,zK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?EK(e):t==="fa"?NK(e):CK(e)}),jK=e=>`Committed changes versus ${e==null?void 0:e.parent}`,TK=e=>`与 ${e==null?void 0:e.parent} 相比的已提交更改`,AK=e=>`تغییرات کامیت‌شده نسبت به ${e==null?void 0:e.parent}`,RK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?TK(e):t==="fa"?AK(e):jK(e)}),MK=e=>`Committed changes versus ${e==null?void 0:e.parent} (diff truncated; counts are lower bounds)`,DK=e=>`与 ${e==null?void 0:e.parent} 相比的已提交更改(差异已截断,计数为下限)`,LK=e=>`تغییرات کامیت‌شده نسبت به ${e==null?void 0:e.parent} (تفاوت کوتاه شده و شمارش‌ها حد پایین‌اند)`,OK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?DK(e):t==="fa"?LK(e):MK(e)}),IK=e=>`Copy ${e==null?void 0:e.value}`,BK=e=>`复制 ${e==null?void 0:e.value}`,$K=e=>`کپی ${e==null?void 0:e.value}`,PK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?BK(e):t==="fa"?$K(e):IK(e)}),FK=e=>`Delete ${e==null?void 0:e.name}`,HK=e=>`删除 ${e==null?void 0:e.name}`,qK=e=>`حذف ${e==null?void 0:e.name}`,S4=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?HK(e):t==="fa"?qK(e):FK(e)}),UK=e=>`Download ${e==null?void 0:e.name}`,GK=e=>`下载 ${e==null?void 0:e.name}`,WK=e=>`بارگیری ${e==null?void 0:e.name}`,eE=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?GK(e):t==="fa"?WK(e):UK(e)}),VK=e=>`Expand ${e==null?void 0:e.name}`,KK=e=>`展开 ${e==null?void 0:e.name}`,QK=e=>`باز کردن ${e==null?void 0:e.name}`,YK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?KK(e):t==="fa"?QK(e):VK(e)}),XK=e=>`Hide additional ${e==null?void 0:e.target}`,ZK=e=>`隐藏其余${e==null?void 0:e.target}`,JK=e=>`پنهان کردن موارد بیشترِ ${e==null?void 0:e.target}`,eQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ZK(e):t==="fa"?JK(e):XK(e)}),tQ=e=>`Hide error details for ${e==null?void 0:e.activity}`,nQ=e=>`隐藏 ${e==null?void 0:e.activity} 的错误详情`,rQ=e=>`پنهان کردن جزئیات خطای ${e==null?void 0:e.activity}`,sQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?nQ(e):t==="fa"?rQ(e):tQ(e)}),iQ=e=>`${e==null?void 0:e.count} consecutive identical calls`,aQ=e=>`连续 ${e==null?void 0:e.count} 次相同调用`,oQ=e=>`${e==null?void 0:e.count} فراخوانی یکسان پیاپی`,lQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?aQ(e):t==="fa"?oQ(e):iQ(e)}),cQ=e=>`${e==null?void 0:e.name} — double-click or press Enter to keep open`,uQ=e=>`${e==null?void 0:e.name}——双击或按 Enter 以保持打开`,dQ=e=>`${e==null?void 0:e.name} — برای باز نگه‌داشتن دوبار کلیک کنید یا Enter را بزنید`,fQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?uQ(e):t==="fa"?dQ(e):cQ(e)}),hQ=e=>`Open ${e==null?void 0:e.branch} on GitHub`,_Q=e=>`在 GitHub 上打开 ${e==null?void 0:e.branch}`,pQ=e=>`باز کردن ${e==null?void 0:e.branch} در GitHub`,hD=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?_Q(e):t==="fa"?pQ(e):hQ(e)}),mQ=e=>`Open experiment ${e==null?void 0:e.name}`,gQ=e=>`打开实验 ${e==null?void 0:e.name}`,vQ=e=>`باز کردن آزمایش ${e==null?void 0:e.name}`,bQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?gQ(e):t==="fa"?vQ(e):mQ(e)}),yQ=e=>`Open ${e==null?void 0:e.path} in the right pane`,xQ=e=>`在右侧面板中打开 ${e==null?void 0:e.path}`,wQ=e=>`باز کردن ${e==null?void 0:e.path} در پنل سمت راست`,SQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?xQ(e):t==="fa"?wQ(e):yQ(e)}),kQ=e=>`Open ${e==null?void 0:e.name}`,CQ=e=>`打开 ${e==null?void 0:e.name}`,EQ=e=>`باز کردن ${e==null?void 0:e.name}`,NQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?CQ(e):t==="fa"?EQ(e):kQ(e)}),zQ=e=>`Open logs for run ${e==null?void 0:e.run}`,jQ=e=>`打开运行 ${e==null?void 0:e.run} 的日志`,TQ=e=>`باز کردن گزارش‌های اجرای ${e==null?void 0:e.run}`,AQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?jQ(e):t==="fa"?TQ(e):zQ(e)}),RQ=e=>`Open ${e==null?void 0:e.name} on GitHub`,MQ=e=>`在 GitHub 上打开 ${e==null?void 0:e.name}`,DQ=e=>`باز کردن ${e==null?void 0:e.name} در GitHub`,J1=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?MQ(e):t==="fa"?DQ(e):RQ(e)}),LQ=e=>`Open logs for run ${e==null?void 0:e.id} in the right pane`,OQ=e=>`在右侧面板中打开运行 ${e==null?void 0:e.id} 的日志`,IQ=e=>`باز کردن گزارش اجرای ${e==null?void 0:e.id} در پنل سمت راست`,BQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?OQ(e):t==="fa"?IQ(e):LQ(e)}),$Q=e=>`Overleaf — ${e==null?void 0:e.status}`,PQ=e=>`Overleaf — ${e==null?void 0:e.status}`,FQ=e=>`Overleaf — ${e==null?void 0:e.status}`,HQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?PQ(e):t==="fa"?FQ(e):$Q(e)}),qQ=e=>`Preview /${e==null?void 0:e.name} skill`,UQ=e=>`预览 /${e==null?void 0:e.name} 技能`,GQ=e=>`پیش‌نمایش مهارت ‎/${e==null?void 0:e.name}`,WQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?UQ(e):t==="fa"?GQ(e):qQ(e)}),VQ=e=>`Remove annotation ${e==null?void 0:e.number}`,KQ=e=>`移除批注 ${e==null?void 0:e.number}`,QQ=e=>`حذف یادداشت ${e==null?void 0:e.number}`,YQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?KQ(e):t==="fa"?QQ(e):VQ(e)}),XQ=e=>`Remove ${e==null?void 0:e.name}`,ZQ=e=>`移除 ${e==null?void 0:e.name}`,JQ=e=>`حذف ${e==null?void 0:e.name}`,eY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ZQ(e):t==="fa"?JQ(e):XQ(e)}),tY=e=>`Remove queued message: ${e==null?void 0:e.text}`,nY=e=>`移除排队消息:${e==null?void 0:e.text}`,rY=e=>`حذف پیام صف: ${e==null?void 0:e.text}`,sY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?nY(e):t==="fa"?rY(e):tY(e)}),iY=e=>`Retry queued message: ${e==null?void 0:e.text}`,aY=e=>`重试排队消息:${e==null?void 0:e.text}`,oY=e=>`تلاش دوباره برای پیام صف: ${e==null?void 0:e.text}`,lY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?aY(e):t==="fa"?oY(e):iY(e)}),cY=e=>`Run ${e==null?void 0:e.id}`,uY=e=>`运行 ${e==null?void 0:e.id}`,dY=e=>`اجرای ${e==null?void 0:e.id}`,fY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?uY(e):t==="fa"?dY(e):cY(e)}),hY=e=>`Show error details for ${e==null?void 0:e.activity}`,_Y=e=>`显示 ${e==null?void 0:e.activity} 的错误详情`,pY=e=>`نمایش جزئیات خطای ${e==null?void 0:e.activity}`,mY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?_Y(e):t==="fa"?pY(e):hY(e)}),gY=e=>`Show ${e==null?void 0:e.count} more ${e==null?void 0:e.target}`,vY=e=>`再显示 ${e==null?void 0:e.count} 个${e==null?void 0:e.target}`,bY=e=>`نمایش ${e==null?void 0:e.count} مورد دیگر از ${e==null?void 0:e.target}`,yY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?vY(e):t==="fa"?bY(e):gY(e)}),xY=e=>`${e==null?void 0:e.name} skill`,wY=e=>`${e==null?void 0:e.name} 技能`,SY=e=>`مهارت ${e==null?void 0:e.name}`,kY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?wY(e):t==="fa"?SY(e):xY(e)}),CY=e=>`Value for ${e==null?void 0:e.name}`,EY=e=>`${e==null?void 0:e.name} 的值`,NY=e=>`مقدار ${e==null?void 0:e.name}`,zY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?EY(e):t==="fa"?NY(e):CY(e)}),jY=()=>"Agent reported back",TY=()=>"智能体已返回结果",AY=()=>"عامل نتیجه را گزارش کرد",RY=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?TY():t==="fa"?AY():jY()}),MY=()=>"Browse",DY=()=>"浏览",LY=()=>"مرور",OY=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?DY():t==="fa"?LY():MY()}),IY=()=>"Browsing…",BY=()=>"正在浏览…",$Y=()=>"در حال مرور…",PY=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BY():t==="fa"?$Y():IY()}),FY=()=>"Checked experiment status and updated notes",HY=()=>"已检查实验状态并更新笔记",qY=()=>"وضعیت آزمایش بررسی و یادداشت‌ها به‌روز شد",UY=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HY():t==="fa"?qY():FY()}),GY=()=>"Closed an agent",WY=()=>"已关闭智能体",VY=()=>"عامل بسته شد",KY=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WY():t==="fa"?VY():GY()}),QY=()=>"Compacted context",YY=()=>"上下文已压缩",XY=()=>"زمینه فشرده شد",ZY=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YY():t==="fa"?XY():QY()}),JY=()=>"Compacting context…",eX=()=>"正在压缩上下文…",tX=()=>"در حال فشرده‌سازی زمینه…",nX=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eX():t==="fa"?tX():JY()}),rX=e=>`Created ${e==null?void 0:e.target}`,sX=e=>`已创建 ${e==null?void 0:e.target}`,iX=e=>`${e==null?void 0:e.target} ایجاد شد`,aX=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?sX(e):t==="fa"?iX(e):rX(e)}),oX=()=>"Delegate",lX=()=>"委派",cX=()=>"واگذاری",uX=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lX():t==="fa"?cX():oX()}),dX=()=>"Delegating…",fX=()=>"正在委派…",hX=()=>"در حال واگذاری…",_X=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fX():t==="fa"?hX():dX()}),pX=e=>`Deleted ${e==null?void 0:e.target}`,mX=e=>`已删除 ${e==null?void 0:e.target}`,gX=e=>`${e==null?void 0:e.target} حذف شد`,vX=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?mX(e):t==="fa"?gX(e):pX(e)}),bX=()=>"Edit",yX=()=>"编辑",xX=()=>"ویرایش",wX=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yX():t==="fa"?xX():bX()}),SX=e=>`Edited ${e==null?void 0:e.target}`,kX=e=>`已编辑 ${e==null?void 0:e.target}`,CX=e=>`${e==null?void 0:e.target} ویرایش شد`,EX=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?kX(e):t==="fa"?CX(e):SX(e)}),NX=()=>"Editing…",zX=()=>"正在编辑…",jX=()=>"در حال ویرایش…",TX=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zX():t==="fa"?jX():NX()}),AX=e=>`${e==null?void 0:e.activity} for “${e==null?void 0:e.query}”`,RX=e=>`${e==null?void 0:e.activity}:“${e==null?void 0:e.query}”`,MX=e=>`${e==null?void 0:e.activity}: «${e==null?void 0:e.query}»`,DX=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?RX(e):t==="fa"?MX(e):AX(e)}),LX=e=>`Listed files matching ${e==null?void 0:e.pattern}`,OX=e=>`已列出与 ${e==null?void 0:e.pattern} 匹配的文件`,IX=e=>`فایل‌های مطابق ${e==null?void 0:e.pattern} فهرست شد`,BX=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?OX(e):t==="fa"?IX(e):LX(e)}),$X=()=>"Load",PX=()=>"加载",FX=()=>"بارگیری",HX=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?PX():t==="fa"?FX():$X()}),qX=()=>"Loaded a skill",UX=()=>"已加载技能",GX=()=>"یک مهارت بارگیری شد",WX=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?UX():t==="fa"?GX():qX()}),VX=e=>`Loaded ${e==null?void 0:e.name} skill`,KX=e=>`已加载技能 ${e==null?void 0:e.name}`,QX=e=>`مهارت ${e==null?void 0:e.name} بارگیری شد`,YX=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?KX(e):t==="fa"?QX(e):VX(e)}),XX=()=>"Loading…",ZX=()=>"正在加载…",JX=()=>"در حال بارگیری…",eZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ZX():t==="fa"?JX():XX()}),tZ=e=>`Opened ${e==null?void 0:e.target}`,nZ=e=>`已打开 ${e==null?void 0:e.target}`,rZ=e=>`${e==null?void 0:e.target} باز شد`,sZ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?nZ(e):t==="fa"?rZ(e):tZ(e)}),iZ=e=>`Ran ${e==null?void 0:e.command}`,aZ=e=>`已运行 ${e==null?void 0:e.command}`,oZ=e=>`${e==null?void 0:e.command} اجرا شد`,lZ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?aZ(e):t==="fa"?oZ(e):iZ(e)}),cZ=()=>"Ran a sub-agent",uZ=()=>"已运行子智能体",dZ=()=>"یک عامل فرعی اجرا شد",fZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uZ():t==="fa"?dZ():cZ()}),hZ=()=>"Read",_Z=()=>"读取",pZ=()=>"خواندن",mZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_Z():t==="fa"?pZ():hZ()}),gZ=()=>"Read experiment notes",vZ=()=>"已读取实验笔记",bZ=()=>"یادداشت‌های آزمایش خوانده شد",yZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vZ():t==="fa"?bZ():gZ()}),xZ=()=>"Read a paper",wZ=()=>"已读取论文",SZ=()=>"یک مقاله خوانده شد",kZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wZ():t==="fa"?SZ():xZ()}),CZ=e=>`Read ${e==null?void 0:e.name} skill`,EZ=e=>`已读取技能 ${e==null?void 0:e.name}`,NZ=e=>`مهارت ${e==null?void 0:e.name} خوانده شد`,gx=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?EZ(e):t==="fa"?NZ(e):CZ(e)}),zZ=e=>`Read ${e==null?void 0:e.target}`,jZ=e=>`已读取 ${e==null?void 0:e.target}`,TZ=e=>`${e==null?void 0:e.target} خوانده شد`,l0=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?jZ(e):t==="fa"?TZ(e):zZ(e)}),AZ=()=>"Read a web page",RZ=()=>"已读取网页",MZ=()=>"یک صفحهٔ وب خوانده شد",DZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?RZ():t==="fa"?MZ():AZ()}),LZ=()=>"Reading…",OZ=()=>"正在读取…",IZ=()=>"در حال خواندن…",BZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?OZ():t==="fa"?IZ():LZ()}),$Z=()=>"Resumed an agent",PZ=()=>"已恢复智能体",FZ=()=>"عامل از سر گرفته شد",HZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?PZ():t==="fa"?FZ():$Z()}),qZ=()=>"Review",UZ=()=>"查看",GZ=()=>"بازبینی",WZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?UZ():t==="fa"?GZ():qZ()}),VZ=()=>"Reviewed run log",KZ=()=>"已查看运行日志",QZ=()=>"گزارش اجرا بازبینی شد",YZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KZ():t==="fa"?QZ():VZ()}),XZ=()=>"Reviewed run logs",ZZ=()=>"已查看运行日志",JZ=()=>"گزارش‌های اجرا بازبینی شد",eJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ZZ():t==="fa"?JZ():XZ()}),tJ=()=>"Reviewed experiment status and notes",nJ=()=>"已查看实验状态和笔记",rJ=()=>"وضعیت و یادداشت‌های آزمایش بازبینی شد",sJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nJ():t==="fa"?rJ():tJ()}),iJ=()=>"Reviewing…",aJ=()=>"正在查看…",oJ=()=>"در حال بازبینی…",lJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aJ():t==="fa"?oJ():iJ()}),cJ=()=>"Run",uJ=()=>"运行",dJ=()=>"اجرا",fJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uJ():t==="fa"?dJ():cJ()}),hJ=()=>"Running…",_J=()=>"正在运行…",pJ=()=>"در حال اجرا…",_D=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_J():t==="fa"?pJ():hJ()}),mJ=()=>"Search",gJ=()=>"搜索",vJ=()=>"جست‌وجو",bJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gJ():t==="fa"?vJ():mJ()}),yJ=()=>"Searched alphaXiv full text",xJ=()=>"已搜索 alphaXiv 全文",wJ=()=>"متن کامل alphaXiv جست‌وجو شد",SJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xJ():t==="fa"?wJ():yJ()}),kJ=()=>"Searched alphaXiv semantically",CJ=()=>"已对 alphaXiv 进行语义搜索",EJ=()=>"جست‌وجوی معنایی در alphaXiv انجام شد",NJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?CJ():t==="fa"?EJ():kJ()}),zJ=()=>"Searched bioRxiv",jJ=()=>"已搜索 bioRxiv",TJ=()=>"bioRxiv جست‌وجو شد",AJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jJ():t==="fa"?TJ():zJ()}),RJ=()=>"Searched code",MJ=()=>"已搜索代码",DJ=()=>"کد جست‌وجو شد",vx=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?MJ():t==="fa"?DJ():RJ()}),LJ=e=>`Searched code for “${e==null?void 0:e.pattern}”`,OJ=e=>`已在代码中搜索“${e==null?void 0:e.pattern}”`,IJ=e=>`کد برای «${e==null?void 0:e.pattern}» جست‌وجو شد`,bx=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?OJ(e):t==="fa"?IJ(e):LJ(e)}),BJ=e=>`Searched images for “${e==null?void 0:e.query}”`,$J=e=>`已搜索图片“${e==null?void 0:e.query}”`,PJ=e=>`تصاویر برای «${e==null?void 0:e.query}» جست‌وجو شد`,FJ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?$J(e):t==="fa"?PJ(e):BJ(e)}),HJ=()=>"Searched the literature",qJ=()=>"已搜索文献",UJ=()=>"منابع علمی جست‌وجو شد",tE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qJ():t==="fa"?UJ():HJ()}),GJ=e=>`Searched “${e==null?void 0:e.pattern}” on a page`,WJ=e=>`已在页面中搜索“${e==null?void 0:e.pattern}”`,VJ=e=>`صفحه برای «${e==null?void 0:e.pattern}» جست‌وجو شد`,KJ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?WJ(e):t==="fa"?VJ(e):GJ(e)}),QJ=()=>"Searched OpenAlex",YJ=()=>"已搜索 OpenAlex",XJ=()=>"OpenAlex جست‌وجو شد",ZJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YJ():t==="fa"?XJ():QJ()}),JJ=e=>`Searched the web for “${e==null?void 0:e.query}”`,eee=e=>`已在网页中搜索“${e==null?void 0:e.query}”`,tee=e=>`وب برای «${e==null?void 0:e.query}» جست‌وجو شد`,nE=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?eee(e):t==="fa"?tee(e):JJ(e)}),nee=e=>`Searched a web page for “${e==null?void 0:e.pattern}”`,ree=e=>`已在网页中搜索“${e==null?void 0:e.pattern}”`,see=e=>`صفحهٔ وب برای «${e==null?void 0:e.pattern}» جست‌وجو شد`,iee=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ree(e):t==="fa"?see(e):nee(e)}),aee=()=>"Searching…",oee=()=>"正在搜索…",lee=()=>"در حال جست‌وجو…",cee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oee():t==="fa"?lee():aee()}),uee=()=>"Sent input to an agent",dee=()=>"已向智能体发送输入",fee=()=>"ورودی به عامل فرستاده شد",hee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dee():t==="fa"?fee():uee()}),_ee=()=>"Spawned an agent",pee=()=>"已创建智能体",mee=()=>"یک عامل ساخته شد",gee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pee():t==="fa"?mee():_ee()}),vee=()=>"Sub-agent",bee=()=>"子智能体",yee=()=>"عامل فرعی",xee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bee():t==="fa"?yee():vee()}),wee=()=>"Sub-agent interrupted",See=()=>"子智能体已中断",kee=()=>"عامل فرعی متوقف شد",Cee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?See():t==="fa"?kee():wee()}),Eee=()=>"Sub-agent started",Nee=()=>"子智能体已启动",zee=()=>"عامل فرعی آغاز شد",jee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nee():t==="fa"?zee():Eee()}),Tee=()=>"Updated experiment notes",Aee=()=>"已更新实验笔记",Ree=()=>"یادداشت‌های آزمایش به‌روز شد",Mee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Aee():t==="fa"?Ree():Tee()}),Dee=()=>"Waiting on an agent",Lee=()=>"正在等待智能体",Oee=()=>"در انتظار عامل",Iee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lee():t==="fa"?Oee():Dee()}),Bee=e=>`Approval required: ${e==null?void 0:e.label}`,$ee=e=>`需要批准:${e==null?void 0:e.label}`,Pee=e=>`نیازمند تأیید: ${e==null?void 0:e.label}`,rE=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?$ee(e):t==="fa"?Pee(e):Bee(e)}),Fee=()=>"The CLI is retrying the turn.",Hee=()=>"CLI 正在重试本轮。",qee=()=>"CLI در حال تلاش دوباره برای این نوبت است.",Uee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hee():t==="fa"?qee():Fee()}),Gee=()=>"Continue is available.",Wee=()=>"可以继续。",Vee=()=>"ادامه در دسترس است.",Kee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wee():t==="fa"?Vee():Gee()}),Qee=()=>"Retry is available.",Yee=()=>"可以重试。",Xee=()=>"تلاش دوباره در دسترس است.",Zee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Yee():t==="fa"?Xee():Qee()}),Jee=()=>"Running a tool",ete=()=>"正在运行工具",tte=()=>"در حال اجرای ابزار",nte=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ete():t==="fa"?tte():Jee()}),rte=()=>"Tool activity completed",ste=()=>"工具活动已完成",ite=()=>"فعالیت ابزار کامل شد",ate=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ste():t==="fa"?ite():rte()}),ote=e=>`Tool activity failed: ${e==null?void 0:e.labels}`,lte=e=>`工具活动失败:${e==null?void 0:e.labels}`,cte=e=>`فعالیت ابزار ناموفق بود: ${e==null?void 0:e.labels}`,ute=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?lte(e):t==="fa"?cte(e):ote(e)}),dte=e=>`${e==null?void 0:e.count} tool activities failed: ${e==null?void 0:e.labels}`,fte=e=>`${e==null?void 0:e.count} 个工具活动失败:${e==null?void 0:e.labels}`,hte=e=>`${e==null?void 0:e.count} فعالیت ابزار ناموفق بود: ${e==null?void 0:e.labels}`,_te=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?fte(e):t==="fa"?hte(e):dte(e)}),pte=()=>"Turn did not finish.",mte=()=>"本轮未完成。",gte=()=>"این نوبت کامل نشد.",vte=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mte():t==="fa"?gte():pte()}),bte=()=>"Artifacts",yte=()=>"产物",xte=()=>"خروجی‌ها",pD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yte():t==="fa"?xte():bte()}),wte=()=>"Close panel",Ste=()=>"关闭面板",kte=()=>"بستن پنل",ev=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ste():t==="fa"?kte():wte()}),Cte=()=>"Current task",Ete=()=>"当前任务",Nte=()=>"وظیفهٔ فعلی",sE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ete():t==="fa"?Nte():Cte()}),zte=()=>"Drag to resize panel",jte=()=>"拖动以调整面板大小",Tte=()=>"برای تغییر اندازهٔ پنل بکشید",Ate=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jte():t==="fa"?Tte():zte()}),Rte=()=>"Drag toward the center to restore panel",Mte=()=>"向中央拖动以恢复面板",Dte=()=>"برای بازگرداندن پنل به‌سوی مرکز بکشید",Lte=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Mte():t==="fa"?Dte():Rte()}),Ote=()=>"Entire project",Ite=()=>"整个项目",Bte=()=>"کل پروژه",iE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ite():t==="fa"?Bte():Ote()}),$te=()=>"Expand panel",Pte=()=>"展开面板",Fte=()=>"گسترش پنل",aE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pte():t==="fa"?Fte():$te()}),Hte=e=>`Experiment filter: ${e==null?void 0:e.scope}`,qte=e=>`实验筛选:${e==null?void 0:e.scope}`,Ute=e=>`فیلتر آزمایش: ${e==null?void 0:e.scope}`,Gte=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?qte(e):t==="fa"?Ute(e):Hte(e)}),Wte=()=>"Experiment view",Vte=()=>"实验视图",Kte=()=>"نمای آزمایش",Qte=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vte():t==="fa"?Kte():Wte()}),Yte=()=>"Experiments",Xte=()=>"实验",Zte=()=>"آزمایش‌ها",mD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xte():t==="fa"?Zte():Yte()}),Jte=()=>"Files",ene=()=>"文件",tne=()=>"فایل‌ها",k4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ene():t==="fa"?tne():Jte()}),nne=()=>"Filter experiments",rne=()=>"筛选实验",sne=()=>"فیلتر آزمایش‌ها",ine=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rne():t==="fa"?sne():nne()}),ane=()=>"Current task filtering is unavailable for unattributed experiments",one=()=>"存在无法归属的实验时,不能按当前任务筛选",lne=()=>"برای آزمایش‌های بدون وظیفه، فیلتر وظیفهٔ کنونی در دسترس نیست",cne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?one():t==="fa"?lne():ane()}),une=()=>"No experiments from the current task yet. Switch to Entire project to see all experiments.",dne=()=>"当前任务还没有实验。切换到“整个项目”即可查看所有实验。",fne=()=>"وظیفهٔ کنونی هنوز آزمایشی ندارد. برای دیدن همهٔ آزمایش‌ها به «کل پروژه» بروید.",hne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dne():t==="fa"?fne():une()}),_ne=()=>"Open a task to filter to its experiments",pne=()=>"请打开一个任务以筛选其实验",mne=()=>"برای محدود کردن آزمایش‌ها، یک وظیفه را باز کنید",gne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pne():t==="fa"?mne():_ne()}),vne=()=>"projects",bne=()=>"项目",yne=()=>"پروژه‌ها",D0=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bne():t==="fa"?yne():vne()}),xne=()=>"Restore panel",wne=()=>"还原面板",Sne=()=>"بازگرداندن اندازهٔ پنل",oE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wne():t==="fa"?Sne():xne()}),kne=()=>"Retry",Cne=()=>"重试",Ene=()=>"تلاش دوباره",Ui=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cne():t==="fa"?Ene():kne()}),Nne=()=>"Select a project to browse its files.",zne=()=>"选择一个项目以浏览其文件。",jne=()=>"برای مرور فایل‌ها، یک پروژه را انتخاب کنید.",Tne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zne():t==="fa"?jne():Nne()}),Ane=()=>"settings",Rne=()=>"设置",Mne=()=>"تنظیمات",Dne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rne():t==="fa"?Mne():Ane()}),Lne=e=>`Couldn’t load OpenResearch ${e==null?void 0:e.items}.`,One=e=>`无法加载 OpenResearch 的${e==null?void 0:e.items}。`,Ine=e=>`بارگذاری ${e==null?void 0:e.items} در OpenResearch ناموفق بود.`,Bne=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?One(e):t==="fa"?Ine(e):Lne(e)}),$ne=()=>"Sub-agent",Pne=()=>"子智能体",Fne=()=>"عامل فرعی",Hne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pne():t==="fa"?Fne():$ne()}),qne=()=>"Table",Une=()=>"表格",Gne=()=>"جدول",Wne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Une():t==="fa"?Gne():qne()}),Vne=()=>"Tree",Kne=()=>"树状图",Qne=()=>"درخت",Yne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kne():t==="fa"?Qne():Vne()}),Xne=e=>`Collapse ${e==null?void 0:e.name}`,Zne=e=>`折叠 ${e==null?void 0:e.name}`,Jne=e=>`بستن پوشهٔ ${e==null?void 0:e.name}`,ere=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Zne(e):t==="fa"?Jne(e):Xne(e)}),tre=e=>`Delete “${e==null?void 0:e.path}” from the artifacts directory?`,nre=e=>`从产物目录中删除“${e==null?void 0:e.path}”?`,rre=e=>`«${e==null?void 0:e.path}» از پوشهٔ خروجی‌ها حذف شود؟`,Z5=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?nre(e):t==="fa"?rre(e):tre(e)}),sre=e=>`Delete folder ${e==null?void 0:e.name}`,ire=e=>`删除文件夹 ${e==null?void 0:e.name}`,are=e=>`حذف پوشهٔ ${e==null?void 0:e.name}`,ore=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ire(e):t==="fa"?are(e):sre(e)}),lre=e=>`Expand ${e==null?void 0:e.name}`,cre=e=>`展开 ${e==null?void 0:e.name}`,ure=e=>`باز کردن پوشهٔ ${e==null?void 0:e.name}`,dre=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?cre(e):t==="fa"?ure(e):lre(e)}),fre=()=>"Binary or unsupported file — no inline preview.",hre=()=>"二进制文件或不受支持的文件 — 无法内嵌预览。",_re=()=>"فایل دودویی یا پشتیبانی‌نشده است — پیش‌نمایش درون‌صفحه‌ای ندارد.",pre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hre():t==="fa"?_re():fre()}),mre=()=>"Copy path",gre=()=>"复制路径",vre=()=>"کپی مسیر",bre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gre():t==="fa"?vre():mre()}),yre=()=>"Artifact not found",xre=()=>"找不到产物",wre=()=>"خروجی پیدا نشد",Sre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xre():t==="fa"?wre():yre()}),kre=()=>"Open raw",Cre=()=>"打开原始文件",Ere=()=>"باز کردن فایل خام",Nre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cre():t==="fa"?Ere():kre()}),zre=()=>"Click an artifact to view it",jre=()=>"点击产物即可查看",Tre=()=>"برای مشاهده، یک خروجی را انتخاب کنید",Are=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jre():t==="fa"?Tre():zre()}),Rre=()=>"Delete artifact",Mre=()=>"删除产物",Dre=()=>"حذف خروجی",lE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Mre():t==="fa"?Dre():Rre()}),Lre=()=>"Delete folder",Ore=()=>"删除文件夹",Ire=()=>"حذف پوشه",Bre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ore():t==="fa"?Ire():Lre()}),$re=()=>"Failed to load:",Pre=()=>"加载失败:",Fre=()=>"بارگیری ناموفق بود:",Hre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pre():t==="fa"?Fre():$re()}),qre=()=>"File truncated — showing the first 512 KB.",Ure=()=>"文件已截断——仅显示前 512 KB。",Gre=()=>"فایل کوتاه شده است — فقط ۵۱۲ کیلوبایت نخست نمایش داده می‌شود.",Wre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ure():t==="fa"?Gre():qre()}),Vre=()=>"Listing truncated — the folder has more artifacts.",Kre=()=>"列表已截断——文件夹中还有更多产物。",Qre=()=>"فهرست کوتاه شده است — خروجی‌های بیشتری در پوشه وجود دارد.",Yre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kre():t==="fa"?Qre():Vre()}),Xre=()=>"Loading…",Zre=()=>"正在加载…",Jre=()=>"در حال بارگیری…",gD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zre():t==="fa"?Jre():Xre()}),ese=()=>"Loading artifacts…",tse=()=>"正在加载产物…",nse=()=>"در حال بارگیری خروجی‌ها…",rse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tse():t==="fa"?nse():ese()}),sse=()=>"Modified",ise=()=>"修改时间",ase=()=>"ویرایش‌شده",ose=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ise():t==="fa"?ase():sse()}),lse=()=>"No artifacts yet",cse=()=>"尚无产物",use=()=>"هنوز خروجی‌ای وجود ندارد",dse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cse():t==="fa"?use():lse()}),fse=()=>"Open raw in new tab",hse=()=>"在新标签页中打开原始文件",_se=()=>"باز کردن فایل خام در زبانهٔ جدید",cE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hse():t==="fa"?_se():fse()}),pse=()=>"This is the project's durable output space for reports, figures, images, CSVs, PDFs, and other research artifacts. Ask the agent for a write-up or add your own files.",mse=()=>"这里是项目的持久输出空间,用于保存报告、图表、图片、CSV、PDF 和其他研究产物。你可以让智能体撰写报告,也可以自行添加文件。",gse=()=>"این فضای پایدار خروجی پروژه برای گزارش‌ها، نمودارها، تصاویر، فایل‌های CSV و PDF و دیگر خروجی‌های پژوهشی است. از عامل بخواهید گزارشی بنویسد یا فایل‌های خودتان را اضافه کنید.",vse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mse():t==="fa"?gse():pse()}),bse=()=>"File too large to preview inline.",yse=()=>"文件太大,无法内嵌预览。",xse=()=>"فایل برای پیش‌نمایش درون‌صفحه‌ای بیش از حد بزرگ است.",wse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yse():t==="fa"?xse():bse()}),Sse=()=>"This is the baseline branch, so there is no parent comparison.",kse=()=>"这是基线分支,因此没有父分支可供比较。",Cse=()=>"این شاخهٔ مبناست، بنابراین شاخهٔ والدی برای مقایسه ندارد.",Ese=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kse():t==="fa"?Cse():Sse()}),Nse=()=>"Failed to load changes:",zse=()=>"加载更改失败:",jse=()=>"بارگیری تغییرات ناموفق بود:",Tse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zse():t==="fa"?jse():Nse()}),Ase=()=>"Loading changes…",Rse=()=>"正在加载更改…",Mse=()=>"در حال بارگیری تغییرات…",Dse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rse():t==="fa"?Mse():Ase()}),Lse=()=>"No committed changes from the parent branch.",Ose=()=>"与父分支相比没有已提交的更改。",Ise=()=>"نسبت به شاخهٔ والد تغییر ثبت‌شده‌ای وجود ندارد.",Bse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ose():t==="fa"?Ise():Lse()}),$se=e=>`agent ${e==null?void 0:e.number}`,Pse=e=>`智能体 ${e==null?void 0:e.number}`,Fse=e=>`عامل ${e==null?void 0:e.number}`,uE=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Pse(e):t==="fa"?Fse(e):$se(e)}),Hse=()=>"agent sessions",qse=()=>"智能体会话",Use=()=>"نشست‌های عامل‌ها",Gse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qse():t==="fa"?Use():Hse()}),Wse=()=>"All sessions",Vse=()=>"所有会话",Kse=()=>"همهٔ نشست‌ها",vD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vse():t==="fa"?Kse():Wse()}),Qse=e=>`${e==null?void 0:e.count} annotations`,Yse=e=>`${e==null?void 0:e.count} 条批注`,Xse=e=>`${e==null?void 0:e.count} یادداشت`,Zse=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Yse(e):t==="fa"?Xse(e):Qse(e)}),Jse=()=>"Archive",eie=()=>"归档",tie=()=>"بایگانی",nie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eie():t==="fa"?tie():Jse()}),rie=()=>"Ask the research agent… (/ for commands and skills, ! for shell)",sie=()=>"询问研究智能体…(输入 / 使用命令和技能,输入 ! 运行 shell)",iie=()=>"از عامل پژوهش بپرسید… (/ برای فرمان‌ها و مهارت‌ها، ! برای شل)",aie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sie():t==="fa"?iie():rie()}),oie=()=>"Asked about selected text",lie=()=>"已询问所选文本",cie=()=>"دربارهٔ متن انتخاب‌شده پرسیده شد",uie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lie():t==="fa"?cie():oie()}),die=()=>"Attachment",fie=()=>"附件",hie=()=>"پیوست",_ie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fie():t==="fa"?hie():die()}),pie=e=>`${e==null?void 0:e.name} is too large — each attachment must be under 30 MB.`,mie=e=>`${e==null?void 0:e.name} 太大 — 每个附件必须小于 30 MB。`,gie=e=>`${e==null?void 0:e.name} بیش از حد بزرگ است — هر پیوست باید کمتر از ۳۰ مگابایت باشد.`,vie=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?mie(e):t==="fa"?gie(e):pie(e)}),bie=()=>"Attachments exceed the 40 MB total limit — remove one and try again.",yie=()=>"附件总大小超过 40 MB 限制 — 请移除一个附件后重试。",xie=()=>"حجم پیوست‌ها از سقف ۴۰ مگابایت بیشتر است — یکی را حذف و دوباره تلاش کنید.",wie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yie():t==="fa"?xie():bie()}),Sie=()=>"Wait for the turn to finish before running a command.",kie=()=>"请等待本轮结束后再运行命令。",Cie=()=>"پیش از اجرای فرمان، صبر کنید تا نوبت تمام شود.",Eie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kie():t==="fa"?Cie():Sie()}),Nie=e=>`Exited with code ${e==null?void 0:e.code}`,zie=e=>`退出码 ${e==null?void 0:e.code}`,jie=e=>`با کد ${e==null?void 0:e.code} خارج شد`,Tie=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?zie(e):t==="fa"?jie(e):Nie(e)}),Aie=e=>`Command not run: ${e==null?void 0:e.error}`,Rie=e=>`命令未运行:${e==null?void 0:e.error}`,Mie=e=>`فرمان اجرا نشد: ${e==null?void 0:e.error}`,dE=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Rie(e):t==="fa"?Mie(e):Aie(e)}),Die=()=>"Collapse tool activity",Lie=()=>"折叠工具活动",Oie=()=>"بستن فعالیت ابزارها",Iie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lie():t==="fa"?Oie():Die()}),Bie=()=>"Continue",$ie=()=>"继续",Pie=()=>"ادامه",Fie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$ie():t==="fa"?Pie():Bie()}),Hie=e=>`Delete “${e==null?void 0:e.title}”? + */var W9;function dV(){if(W9)return dx;W9=1;var e=Wp(),n=uV();function t(u,_){return u===_&&(u!==0||1/u===1/_)||u!==u&&_!==_}var r=typeof Object.is=="function"?Object.is:t,s=n.useSyncExternalStore,i=e.useRef,a=e.useEffect,o=e.useMemo,l=e.useDebugValue;return dx.useSyncExternalStoreWithSelector=function(u,_,d,p,m){var x=i(null);if(x.current===null){var S={hasValue:!1,value:null};x.current=S}else S=x.current;x=o(function(){function b(N){if(!w){if(w=!0,y=N,N=p(N),m!==void 0&&S.hasValue){var T=S.value;if(m(T,N))return C=T}return C=N}if(T=C,r(y,N))return T;var z=p(N);return m!==void 0&&m(T,z)?(y=N,T):(y=N,C=z)}var w=!1,y,C,E=d===void 0?null:d;return[function(){return b(_())},E===null?void 0:function(){return b(E())}]},[_,d,p,m]);var v=s(u,x[0],x[1]);return a(function(){S.hasValue=!0,S.value=v},[v]),l(v),v},dx}var V9;function fV(){return V9||(V9=1,ux.exports=dV()),ux.exports}var QM=fV();const hV=Gp(QM);function _V(e,n){return e===n}function Oo(e,n,t=_V){const r=R.useCallback(a=>{if(!e)return()=>{};const{unsubscribe:o}=e.subscribe(a);return o},[e]),s=R.useCallback(()=>e==null?void 0:e.get(),[e]);return QM.useSyncExternalStoreWithSelector(r,s,s,n,t)}var K9={};function V5(e,n){const t=R.useRef();return r=>{const s=e!=null&&e.select?e.select(r):r;return(e==null?void 0:e.structuralSharing)??n.options.defaultStructuralSharing?t.current=rd(t.current,s):s}}function Ud(e){const n=ei(),t=R.useContext(e.from?nV:Vv),r=e.from??t,s=n.stores.getMatchStore(r),i=V5(e,n),a=Oo(s,o=>o?i(o):K9);if(a!==K9)return a;(e.shouldThrow??!0)&&B5()}function YM(e){return Ud({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:n=>e.select?e.select(n.loaderData):n.loaderData})}function XM(e){const{select:n,...t}=e;return Ud({...t,select:r=>n?n(r.loaderDeps):r.loaderDeps})}function ZM(e){return Ud({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:n=>{const t=e.strict===!1?n.params:n._strictParams;return e.select?e.select(t):t}})}function JM(e){return Ud({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:n=>e.select?e.select(n.search):n.search})}function Kv(e){const n=ei();return R.useCallback(t=>n.navigate({...t,from:t.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,n])}function K5(e){return Ud({...e,select:n=>e.select?e.select(n.context):n.context})}function _x(e){const n=R.useRef(e);return Xc(n.current,e,{ignoreUndefined:!1})||(n.current=e),n.current}function pV(e,n){return e[0]===n[0]&&e[1]===n[1]&&e[2]===n[2]}function mV(e,n,t){if(e!=null&&e.external)return G1(e.href,t)?void 0:e.href;if(!SV(n)&&!(typeof n!="string"||n.indexOf(":")===-1))try{return new URL(n),G1(n,t)?void 0:n}catch{}}function gV(e,n,t,r,s,i){if(i)return!1;if(t!=null&&t.exact){if(!fW(e.pathname,n.pathname,r))return!1}else{const a=V1(e.pathname,r),o=V1(n.pathname,r);if(!(a.startsWith(o)&&(a.length===o.length||a[o.length]==="/")))return!1}return((t==null?void 0:t.includeSearch)??!0)&&!Xc(e.search,n.search,{partial:!(t!=null&&t.exact),ignoreUndefined:!(t!=null&&t.explicitUndefined)})?!1:t!=null&&t.includeHash?s&&e.hash===n.hash:!0}function vV(e,n){const t=ei(),r=KG(n),{activeProps:s,inactiveProps:i,activeOptions:a,to:o,preload:l,preloadDelay:u,preloadIntentProximity:_,hashScrollIntoView:d,replace:p,startTransition:m,resetScroll:x,viewTransition:S,children:v,target:b,disabled:w,style:y,className:C,onClick:E,onBlur:N,onFocus:T,onMouseEnter:z,onMouseLeave:M,onTouchStart:I,ignoreBlocker:B,params:$,search:U,hash:H,state:Y,mask:V,reloadDocument:X,unsafeRelative:ee,from:O,_fromLocation:L,...F}=e,q=GM(),G=_x(e.search),re=_x(e.params),ce=_x(a),oe=R.useMemo(()=>e,[t,e.from,e._fromLocation,e.hash,e.to,G,re,e.state,e.mask,e.unsafeRelative]),te=R.useCallback(ct=>{const ut=t.buildLocation({_fromLocation:ct,...oe}),Ht=wV(ut.maskedLocation?ut.maskedLocation.publicHref:ut.publicHref,ut.maskedLocation?ut.maskedLocation.external:ut.external,t.history,w),Se=mV(Ht,o,t.protocolAllowlist);return[Ht==null?void 0:Ht.href,Se,gV(ct,ut,ce,t.basepath,q,Se!==void 0)]},[ce,w,q,oe,t,o]),[Q,le,ae]=Oo(t.stores.location,te,pV),de=ae?Mh(s,{})??bV:px,pe=ae?px:Mh(i,{})??px,we=[C,de.className,pe.className].filter(Boolean).join(" "),be=(y||de.style||pe.style)&&{...y,...de.style,...pe.style},Pe=R.useRef(!1),Be=e.reloadDocument||le||w?!1:l??t.options.defaultPreload,ze=u??t.options.defaultPreloadDelay??0,it=R.useCallback(()=>{t.preloadRoute(oe).catch(ct=>{console.warn(ct),console.warn(XW)})},[t,oe]),bt=R.useCallback(ct=>{if(!ct){mx(r);return}if(!(ct.isIntersecting??Be==="intent")){ct.isIntersecting===!1&&mx(r);return}if(!ze){it();return}M0.has(r)||M0.set(r,setTimeout(()=>{M0.delete(r),it()},ze))},[it,r,Be,ze]);VG(r,bt,Be!=="viewport"),R.useEffect(()=>{Pe.current||Be==="render"&&(it(),Pe.current=!0)},[it,Be]);const It=ct=>{const ut=ct.currentTarget.getAttribute("target"),Ht=b!==void 0?b:ut;!w&&!(ct.metaKey||ct.altKey||ct.ctrlKey||ct.shiftKey)&&!ct.defaultPrevented&&(!Ht||Ht==="_self")&&ct.button===0&&(ct.preventDefault(),t.navigate({...oe,replace:p,resetScroll:x,hashScrollIntoView:d,startTransition:m,viewTransition:S,ignoreBlocker:B}))};if(le)return{...F,ref:r,href:le,...v&&{children:v},...b&&{target:b},...w&&{disabled:w},...y&&{style:y},...C&&{className:C},...E&&{onClick:E},...N&&{onBlur:N},...T&&{onFocus:T},...z&&{onMouseEnter:z},...M&&{onMouseLeave:M},...I&&{onTouchStart:I}};const $t=()=>{Be==="intent"&&it()},jt=()=>{Be==="intent"&&mx(r)};return{...F,...de,...pe,href:Q,ref:r,onClick:If([E,It]),onBlur:If([N,jt]),onFocus:If([T,bt]),onMouseEnter:If([z,bt]),onMouseLeave:If([M,jt]),onTouchStart:If([I,$t]),disabled:!!w,target:b,...be&&{style:be},...we&&{className:we},...w&&yV,...ae&&xV}}var px={},bV={className:"active"},yV={role:"link","aria-disabled":!0},xV={"data-status":"active","aria-current":"page"},M0=new WeakMap,mx=e=>{clearTimeout(M0.get(e)),M0.delete(e)},If=e=>n=>{for(const t of e)if(t){if(n.defaultPrevented)return;t(n)}};function wV(e,n,t,r){if(!r)return n?{href:e,external:!0}:{href:t.createHref(e)||"/",external:!1}}function SV(e){if(typeof e!="string")return!1;const n=e.charCodeAt(0);return n===47?e.charCodeAt(1)!==47:n===46}var Qv=R.forwardRef((e,n)=>{const{_asChild:t,...r}=e,{type:s,...i}=vV(r,n),a=typeof r.children=="function"?r.children({isActive:i["data-status"]==="active"}):r.children;if(!t){const{disabled:o,...l}=i;return R.createElement("a",l,a)}return R.createElement(t,i,a)}),kV=class extends UM{constructor(n){super(n),this.useMatch=t=>Ud({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>K5({...t,from:this.id}),this.useSearch=t=>JM({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>ZM({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>XM({...t,from:this.id}),this.useLoaderData=t=>YM({...t,from:this.id}),this.useNavigate=()=>Kv({from:this.fullPath}),this.Link=Je.forwardRef((t,r)=>f.jsx(Qv,{ref:r,from:this.fullPath,...t}))}};function CV(e){return new kV(e)}function EV(){return e=>zV(e)}var NV=class extends ZW{constructor(e){super(e),this.useMatch=n=>Ud({select:n==null?void 0:n.select,from:this.id,structuralSharing:n==null?void 0:n.structuralSharing}),this.useRouteContext=n=>K5({...n,from:this.id}),this.useSearch=n=>JM({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useParams=n=>ZM({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useLoaderDeps=n=>XM({...n,from:this.id}),this.useLoaderData=n=>YM({...n,from:this.id}),this.useNavigate=()=>Kv({from:this.fullPath}),this.Link=Je.forwardRef((n,t)=>f.jsx(Qv,{ref:t,from:this.fullPath,...n}))}};function zV(e){return new NV(e)}function Fo(e){return n=>{const t=CV(n);return t.isRoot=!1,t}}function jV(e){const n=ei(),t=`not-found-${Oo(n.stores.location,r=>r.pathname)}-${Oo(n.stores.status,r=>r)}`;return f.jsx(W5,{getResetKey:()=>t,onCatch:(r,s)=>{var i;if(Dh(r))(i=e.onCatch)==null||i.call(e,r,s);else throw r},errorComponent:({error:r})=>{var s;if(Dh(r))return(s=e.fallback)==null?void 0:s.call(e,r);throw r},children:e.children})}function TV(){return f.jsx("p",{children:"Not Found"})}function Gf(e){return f.jsx(f.Fragment,{children:e.children})}function eD(e,n,t){return n.options.notFoundComponent?f.jsx(n.options.notFoundComponent,{...t}):e.options.defaultNotFoundComponent?f.jsx(e.options.defaultNotFoundComponent,{...t}):f.jsx(TV,{})}function Yv(e,n){const t=(n==null?void 0:n.options.pendingComponent)??e.options.defaultPendingComponent;return t?f.jsx(t,{}):null}var AV=(e,n)=>e[0]===n[0]&&e[1]===n[1],tD=(e,n,t)=>!n.isRoot||n.options.shellComponent||n.options.wrapInSuspense||t===!1||t==="data-only"||!e.ssr,nD=R.memo(function({routeId:n}){const t=ei();return f.jsx(RV,{router:t,match:Oo(t.stores.getMatchStore(n),r=>r)})});function RV({router:e,match:n}){var d,p;const t=e.routesById[n.routeId],r=Yv(e,t),s=t.options.errorComponent??e.options.defaultErrorComponent,i=t.options.onCatch??e.options.defaultOnCatch,a=t.isRoot?t.options.notFoundComponent??((d=e.options.notFoundRoute)==null?void 0:d.options.component):t.options.notFoundComponent,o=n.ssr===!1||n.ssr==="data-only",l=tD(e,t,n.ssr)&&(t.options.wrapInSuspense??r??(((p=t.options.errorComponent)==null?void 0:p.preload)||o))?R.Suspense:Gf,u=s?W5:Gf,_=a?jV:Gf;return f.jsxs(t.isRoot?t.options.shellComponent??Gf:Gf,{children:[f.jsx(Vv.Provider,{value:n.routeId,children:f.jsx(l,{fallback:r,children:f.jsx(u,{getResetKey:()=>n,errorComponent:s,onCatch:(m,x)=>{if(Dh(m))throw m.routeId??(m.routeId=n.routeId),m;i==null||i(m,x)},children:f.jsx(_,{fallback:m=>{if(m.routeId??(m.routeId=n.routeId),m.routeId!==n.routeId)throw m;return R.createElement(a,m)},children:o?f.jsx(eV,{fallback:r,children:f.jsx(Q9,{match:n})}):f.jsx(Q9,{match:n})})})})}),null]})}var Q9=R.memo(function({match:n}){const t=ei(),r=n.routeId,s=t.routesById[r],i=R.useMemo(()=>{var l;const o=(l=s.options.remountDeps??t.options.defaultRemountDeps)==null?void 0:l({routeId:r,loaderDeps:n.loaderDeps,params:n._strictParams,search:n._strictSearch});return o?JSON.stringify(o):void 0},[r,n.loaderDeps,n._strictParams,n._strictSearch,s.options.remountDeps,t.options.defaultRemountDeps]),a=R.useMemo(()=>{const o=s.options.component??t.options.defaultComponent;return o?f.jsx(o,{},i):f.jsx(X0,{})},[i,s.options.component,t.options.defaultComponent]);if(n.status==="pending"){if(t.ssr&&!tD(t,s,n.ssr))return a;if(t._tx)throw t._tx[5];return Yv(t,s)}if(n.status==="notFound")return eD(t,s,n.error);if(n.status==="error")throw n.error;return a}),X0=R.memo(function(){const n=ei(),t=R.useContext(Vv);let r,s,i;{const o=n.stores.getMatchStore(t);[r,s]=Oo(o,l=>[!!l._notFound,l.error],AV),i=Oo(n.stores.ids,l=>l[l.indexOf(t)+1])}if(r)return eD(n,n.routesById[t],s);if(!i)return null;const a=f.jsx(nD,{routeId:i});return t===ih?f.jsx(R.Suspense,{fallback:Yv(n),children:a}):a});function rD(e,n){const t=e[1];e.length=0,t==null||t(n)}function MV({t:e}){const n=ei(),t=n._rendered??(n._rendered=[]);return n.startTransition=(r,s)=>new Promise(i=>{rD(t,!1),t.push(s,i),e(n),R.startTransition(r)}),EM(()=>{const r=n.history.subscribe(n.load);n.updateLatestLocation();const s=n.latestLocation,i=n.buildLocation({to:s.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(jl(s.publicHref)!==jl(i.publicHref))return n.commitLocation({...i,replace:!0,ignoreBlocker:!0}),r;const a=n.stores.resolvedLocation.get();return(a==null?void 0:a.href)===s.href&&a.state.__TSR_key===s.state.__TSR_key?t.push(n.stores.matches.get(),o=>{o&&n.emit({type:"onRendered",...Gv(a,a)})}):n._tx||n.load({sync:!0}).catch(console.error),r},[n,n.history]),null}function DV(){const e=ei(),n=e.routesById[ih],t=Yv(e,n),r=e.ssr?Gf:R.Suspense,s=f.jsxs(f.Fragment,{children:[f.jsx(MV,{t:R.useState()[1]}),f.jsx(r,{fallback:t,children:f.jsx(LV,{})})]});return e.options.InnerWrap?f.jsx(e.options.InnerWrap,{children:s}):s}function LV(){const e=ei(),n=e._rendered,t=Oo(e.stores.matches,a=>n[0]??a),r=t[0],s=r==null?void 0:r.routeId;EM(()=>{n[0]===t&&rD(n,!0)},[n,t]);const i=s?f.jsx(nD,{routeId:s}):null;return f.jsx(Vv.Provider,{value:s,children:e.options.disableGlobalCatchBoundary?i:f.jsx(W5,{getResetKey:()=>r,onCatch:void 0,children:i})})}var OV=e=>({createMutableStore:q9,createReadonlyStore:q9,batch:oV}),IV=e=>new BV(e),BV=class extends BW{constructor(e){super(e,OV)}};function $V({router:e,children:n,...t}){zM(t)&&e.update({...e.options,...t,context:{...e.options.context,...t.context}});const r=f.jsx(WM.Provider,{value:e,children:n});return e.options.Wrap?f.jsx(e.options.Wrap,{children:r}):r}function PV({router:e,...n}){return f.jsx($V,{router:e,...n,children:f.jsx(DV,{})})}function FV(e,n){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in e)return e;if(typeof e=="function")return{shouldBlockFn:async()=>await e(),enableBeforeUnload:!0,withResolver:!1};const t=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>t&&r!==void 0?await r():t,enableBeforeUnload:t,withResolver:r===void 0}}function HV(e,n){const{shouldBlockFn:t,enableBeforeUnload:r=!0,disabled:s=!1,withResolver:i=!1}=FV(e),a=ei(),{history:o}=a,[l,u]=R.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return R.useEffect(()=>{const _=async d=>{function p(b){const w=a.parseLocation(b),[,y,C]=a.getMatchedRoutes(w.pathname);return C===void 0?{routeId:"__notFound__",fullPath:w.pathname,pathname:w.pathname,params:y,search:a.options.parseSearch(b.search)}:{routeId:C.id,fullPath:C.fullPath,pathname:w.pathname,params:y,search:a.options.parseSearch(b.search)}}const m=p(d.currentLocation),x=p(d.nextLocation);if(m.routeId==="__notFound__"&&x.routeId!=="__notFound__")return!1;const S=await t({action:d.action,current:m,next:x});if(!i)return S;if(!S)return!1;const v=await new Promise(b=>{u({status:"blocked",current:m,next:x,action:d.action,proceed:()=>b(!1),reset:()=>b(!0)})});return u({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),v};return s?void 0:o.block({blockerFn:_,enableBeforeUnload:r})},[t,r,s,i,o,a]),l}function sD(e){const n=ei({warn:(e==null?void 0:e.router)===void 0}),t=(e==null?void 0:e.router)||n;return Oo(t.stores.__store,V5(e,t))}function qV(e){const n=ei();return Oo(n.stores.location,V5(e,n))}const X1=new WeakMap,x1=new WeakMap;function qa(e,n,t="*"){var r;for(const s of e.getQueryCache().findAll({queryKey:n}))X1.set(s,(X1.get(s)??0)+1),(r=x1.get(s))==null||r.add(t)}function Vp(e,n,t,r=!0){if(!n)return e;const s=new Map(n.map(l=>[l.id,l])),i=new Set(e.map(l=>l.id)),a=n.filter(l=>t.has(l.id)&&!i.has(l.id)),o=e.filter(l=>!t.has(l.id)||s.has(l.id)).map(l=>t.has(l.id)?s.get(l.id)??l:l);return r?[...a,...o]:[...o,...a]}async function n_(e,n,t,r=(s,i)=>i??s){const s=e.getQueryCache().find({queryKey:n,exact:!0}),i=s?X1.get(s):void 0,a=await t();if(!s||X1.get(s)===i||s.state.fetchStatus!=="fetching"||e.getQueryCache().find({queryKey:n,exact:!0})!==s)return a;e.setQueryData(n,l=>l??a);const o=new Set;x1.set(s,o);try{const l=await t();return o.size?r(l,e.getQueryData(n),o):l}finally{x1.get(s)===o&&x1.delete(s)}}const Lh=e=>typeof e=="string"&&/^[0-9a-f]{40}$/i.test(e);function iD(e){const n=e.queryKey[2];if(n==="resolvedFile")return Lh(e.queryKey[7]);const t=n==="getProjectFile"?e.queryKey[5]:n==="getCodeTree"?e.queryKey[4]:null;return typeof t=="object"&&t!==null&&"ref"in t&&Lh(t.ref)}function ma(e,n=Sa(),t,r=!1){if(!Dn(n))return;const s={queryKey:n,predicate:i=>e.includes(String(i.queryKey[2]))&&!iD(i)&&(!t||t(i))};r?tt.cancelQueries(s).then(()=>{Dn(n)&&tt.invalidateQueries(s)}):tt.invalidateQueries(s)}const aD=["resolvedFile","getProjectFile","getArtifactFileText","getArtifactFileMetadata"],Q5=["getArtifacts","getArtifactFileText","getArtifactFileMetadata"],UV=["listProjects","listProjectActivity","listExperiments","listRuns","listChatSessions","getChatMessages","getHarnesses","getUpdateStatus",...Q5,...aD,"getAbsoluteFile","fileVersion","getCodeTree","getSessionWorktree","getRunDiff","getExperimentDiff"];function GV(e,n=Sa(),t=!1){const r=tt.getQueryData([...n,"listChatSessions",e])??[],s=tt.getQueryData([...n,"listRuns",e])??[],i=tt.getQueryData([...n,"listExperiments",e])??[];ma([...aD,...Q5,"getRunDiff","getExperimentDiff","getCodeTree","getSessionWorktree","fileVersion","getProjectGitStatus","getOverleafState","getOverleafStatus"],n,a=>{const o=a.queryKey[2];return o==="getRunDiff"?s.some(l=>l.id===a.queryKey[3]):o==="getExperimentDiff"?i.some(l=>l.id===a.queryKey[3]):o==="getSessionWorktree"?r.some(l=>l.id===a.queryKey[3]):o==="fileVersion"?typeof a.queryKey[3]=="string"&&a.queryKey[3].startsWith(`/api/projects/${e}/`):a.queryKey[3]===e},t)}function Xv(e){const n=Sa();tu.add(e),qa(tt,[...n,"listChatSessions"],e),tt.setQueriesData({queryKey:[...n,"listChatSessions"]},t=>t==null?void 0:t.filter(r=>r.id!==e));for(const t of["getChatMessages","getSessionWorktree"])I5({queryKey:[...n,t,e]})}function WV(e){const n=Sa(),t=tt.getQueryData([...n,"listChatSessions",e]);for(const r of t??[])Xv(r.id);I5({queryKey:n,predicate:r=>r.queryKey.slice(3).includes(e)})}const VV={hf:["getHfSettings","getComputeSettings","getEnvVars"],tinker:["getTinkerSettings","getComputeSettings","getEnvVars"],k8s:["getK8sSettings","getComputeSettings"],modal:["getModalSettings","getComputeSettings","getEnvVars"],slurm:["getSlurmSettings","getComputeSettings"],ray:["getRaySettings","getComputeSettings"],env:["getEnvVars","getHfSettings","getTinkerSettings","getModalSettings","getSlurmSettings","getRaySettings","getK8sSettings","getOpenResearchSettings","getComputeSettings","getHarnesses"],"data-dir":["getDataDir"],ssh:["getSshHosts","getSshConfig","getSshMasterStatus","getComputeSettings"],compute:["getComputeSettings"],git:["githubAccount","repoAccess","getProjectGitStatus"],profile:["getProfile"],"lit-sources":["getLitSources"],projects:["getProjectDefaults","getProjectGitStatus"],telemetry:["getTelemetry"]};function KV(e,n){var a;if(!Dn(n))return;const t=(o,l=n,u)=>ma(o,l,u,!0),r=e.split("?")[0];if(/\/(ui-state|open|prewarm|validate|preflight)$/.test(r))return;const s=(a=/^\/api\/settings\/([^/]+)/.exec(r))==null?void 0:a[1];if(s){t(VV[s]??[],n);return}if(r.startsWith("/api/local-models")&&!/\/(discover|check)$/.test(r)){t(["getLocalModels","getHarnesses"],n);return}if(r==="/api/user-skills"){t(["listUserSkills","getSkills","getSkillContent"],n);return}if(r==="/api/latex-templates"){t(["listLatexTemplates"],n);return}if(r==="/api/overleaf/token"){t(["getOverleafSettings","getOverleafState","getOverleafStatus"],n);return}if(r.startsWith("/api/update/")){t(["getUpdateStatus","getLocalMachine"],n);return}if(r.startsWith("/api/remote/")||r.startsWith("/_orx/")){t(["listRemoteSessions"],n),tt.invalidateQueries({queryKey:["gateway","runtime"]});return}if(r.startsWith("/api/chat/")){r==="/api/chat/sessions"&&t(["getProjectStarterPrompts","listProjectActivity"],n);return}const i=/^\/api\/projects\/([^/]+)(.*)$/.exec(r);if(i){const[,o,l]=i;if(l.startsWith("/file")){GV(o,n,!0);return}t(["listProjects","listProjectActivity"],n),t(["getProjectGitStatus","getCodeTree","getProjectStarterPrompts"],n,u=>u.queryKey[3]===o);return}(r==="/api/projects"||r==="/api/onboarding/complete")&&t(["listProjects","listProjectActivity","getUiState","getProfile"],n)}const QV={},YV="en",Y5=["en","zh-CN","fa"],oD="orx:locale",X5=["localStorage","preferredLanguage","baseLocale"],Y9=[],Z0=typeof window>"u";globalThis.__paraglide=globalThis.__paraglide??{};globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};let X9=!1,j=()=>{var t;let e=X5;!Z0&&typeof window<"u"&&((t=window.location)!=null&&t.href)&&(e=uD(window.location.href));const n=XV(e);if(n)return X9||(X9=!0,lD(n,{reload:!1})),n;throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found")};function XV(e,n){let t;for(const r of e){if(r==="baseLocale")t=YV;else if(r==="preferredLanguage"&&!Z0)t=nK();else if(r==="localStorage"&&!Z0)t=localStorage.getItem(oD)??void 0;else if(dD(r)&&Z1.has(r)){const i=Z1.get(r);if(i){const a=i.getLocale();if(a instanceof Promise)continue;if(a!==void 0)return eK(a)}}const s=J0(t);if(s)return s}}const ZV=e=>{window.location.reload()};let lD=(e,n)=>{var o;const t={reload:!0,...n};let r;try{r=j()}catch{}const s=[];let i=X5;!Z0&&typeof window<"u"&&((o=window.location)!=null&&o.href)&&(i=uD(window.location.href));for(const l of i)if(l!=="baseLocale"){if(l==="localStorage"&&typeof window<"u")localStorage.setItem(oD,e);else if(dD(l)&&Z1.has(l)){const u=Z1.get(l);if(u){let _=u.setLocale(e);_ instanceof Promise&&(_=_.catch(d=>{throw new Error(`Custom strategy "${l}" setLocale failed.`,{cause:d})}),s.push(_))}}}const a=()=>{!Z0&&t.reload&&window.location&&e!==r&&ZV()};if(s.length)return Promise.all(s).then(()=>{a()});a()},JV=()=>typeof window<"u"?window.location.origin:"http://fallback.com";function J0(e){if(typeof e!="string")return;const n=e.toLowerCase();for(const t of Y5)if(t.toLowerCase()===n)return t}function cD(e){return!!e&&Y5.some(n=>n===e)}function eK(e){const n=J0(e);if(n)return n;throw new Error(`Invalid locale: ${e}. Expected one of: ${Y5.join(", ")}`)}function tK(e,n){return e.exec(n.href)}function nK(){var n;if(!((n=navigator==null?void 0:navigator.languages)!=null&&n.length))return;const e=navigator.languages.map(t=>({fullTag:t,baseTag:t.split("-")[0]}));for(const t of e){const r=J0(t.fullTag);if(r)return r;const s=J0(t.baseTag);if(s)return s}}function rK(e){return sK(e)}function sK(e){const n=typeof e=="string"?new URL(e,JV()):new URL(e),t=n.pathname.split("/").filter(Boolean);return t.length>0&&J0(t[0])&&(n.pathname="/"+t.slice(1).join("/")),n}let Z9,J9;function iK(e){if(Y9.length===0)return;const n=typeof e=="string"?e:e.href;if(Z9===n)return J9;const t=new URL(n,"http://example.com"),r=rK(t),s=r.href===t.href?[t]:[t,r];let i;for(const a of s){for(const o of Y9){const l=new QV(o.match,a.href);if(tK(l,a)){i=o;break}}if(i)break}return Z9=n,J9=i,i}function uD(e){const n=iK(e);return n&&n.exclude!==!0&&Array.isArray(n.strategy)?n.strategy:X5}const Z1=new Map;function dD(e){return typeof e=="string"&&/^custom-[A-Za-z0-9_-]+$/.test(e)}const aK=e=>`Actions for ${e==null?void 0:e.name}`,oK=e=>`${e==null?void 0:e.name} 的操作`,lK=e=>`عملیات ${e==null?void 0:e.name}`,cK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?oK(e):t==="fa"?lK(e):aK(e)}),uK=e=>`${e==null?void 0:e.path} — press Space to preview; double-click or press Enter to keep open in a tab`,dK=e=>`${e==null?void 0:e.path}——按空格键预览;双击或按 Enter 以在标签页中保持打开`,fK=e=>`${e==null?void 0:e.path} — برای پیش‌نمایش Space و برای باز نگه‌داشتن در زبانه دوبار کلیک کنید یا Enter را بزنید`,hK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?dK(e):t==="fa"?fK(e):uK(e)}),_K=e=>`Branch: ${e==null?void 0:e.branch}`,pK=e=>`分支:${e==null?void 0:e.branch}`,mK=e=>`شاخه: ${e==null?void 0:e.branch}`,gK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?pK(e):t==="fa"?mK(e):_K(e)}),vK=e=>`Browse code on ${e==null?void 0:e.branch}`,bK=e=>`浏览分支 ${e==null?void 0:e.branch} 上的代码`,yK=e=>`مرور کد در شاخهٔ ${e==null?void 0:e.branch}`,fD=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?bK(e):t==="fa"?yK(e):vK(e)}),xK=e=>`Harness and model for this chat: ${e==null?void 0:e.label}`,wK=e=>`此聊天的智能体工具和模型:${e==null?void 0:e.label}`,SK=e=>`ابزار عامل و مدل این گفتگو: ${e==null?void 0:e.label}`,kK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?wK(e):t==="fa"?SK(e):xK(e)}),CK=e=>`Collapse ${e==null?void 0:e.name}`,EK=e=>`折叠 ${e==null?void 0:e.name}`,NK=e=>`بستن ${e==null?void 0:e.name}`,zK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?EK(e):t==="fa"?NK(e):CK(e)}),jK=e=>`Committed changes versus ${e==null?void 0:e.parent}`,TK=e=>`与 ${e==null?void 0:e.parent} 相比的已提交更改`,AK=e=>`تغییرات کامیت‌شده نسبت به ${e==null?void 0:e.parent}`,RK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?TK(e):t==="fa"?AK(e):jK(e)}),MK=e=>`Committed changes versus ${e==null?void 0:e.parent} (diff truncated; counts are lower bounds)`,DK=e=>`与 ${e==null?void 0:e.parent} 相比的已提交更改(差异已截断,计数为下限)`,LK=e=>`تغییرات کامیت‌شده نسبت به ${e==null?void 0:e.parent} (تفاوت کوتاه شده و شمارش‌ها حد پایین‌اند)`,OK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?DK(e):t==="fa"?LK(e):MK(e)}),IK=e=>`Copy ${e==null?void 0:e.value}`,BK=e=>`复制 ${e==null?void 0:e.value}`,$K=e=>`کپی ${e==null?void 0:e.value}`,PK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?BK(e):t==="fa"?$K(e):IK(e)}),FK=e=>`Delete ${e==null?void 0:e.name}`,HK=e=>`删除 ${e==null?void 0:e.name}`,qK=e=>`حذف ${e==null?void 0:e.name}`,S4=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?HK(e):t==="fa"?qK(e):FK(e)}),UK=e=>`Download ${e==null?void 0:e.name}`,GK=e=>`下载 ${e==null?void 0:e.name}`,WK=e=>`بارگیری ${e==null?void 0:e.name}`,eE=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?GK(e):t==="fa"?WK(e):UK(e)}),VK=e=>`Expand ${e==null?void 0:e.name}`,KK=e=>`展开 ${e==null?void 0:e.name}`,QK=e=>`باز کردن ${e==null?void 0:e.name}`,YK=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?KK(e):t==="fa"?QK(e):VK(e)}),XK=e=>`Hide additional ${e==null?void 0:e.target}`,ZK=e=>`隐藏其余${e==null?void 0:e.target}`,JK=e=>`پنهان کردن موارد بیشترِ ${e==null?void 0:e.target}`,eQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ZK(e):t==="fa"?JK(e):XK(e)}),tQ=e=>`Hide error details for ${e==null?void 0:e.activity}`,nQ=e=>`隐藏 ${e==null?void 0:e.activity} 的错误详情`,rQ=e=>`پنهان کردن جزئیات خطای ${e==null?void 0:e.activity}`,sQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?nQ(e):t==="fa"?rQ(e):tQ(e)}),iQ=e=>`${e==null?void 0:e.count} consecutive identical calls`,aQ=e=>`连续 ${e==null?void 0:e.count} 次相同调用`,oQ=e=>`${e==null?void 0:e.count} فراخوانی یکسان پیاپی`,lQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?aQ(e):t==="fa"?oQ(e):iQ(e)}),cQ=e=>`${e==null?void 0:e.name} — double-click or press Enter to keep open`,uQ=e=>`${e==null?void 0:e.name}——双击或按 Enter 以保持打开`,dQ=e=>`${e==null?void 0:e.name} — برای باز نگه‌داشتن دوبار کلیک کنید یا Enter را بزنید`,fQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?uQ(e):t==="fa"?dQ(e):cQ(e)}),hQ=e=>`Open ${e==null?void 0:e.branch} on GitHub`,_Q=e=>`在 GitHub 上打开 ${e==null?void 0:e.branch}`,pQ=e=>`باز کردن ${e==null?void 0:e.branch} در GitHub`,hD=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?_Q(e):t==="fa"?pQ(e):hQ(e)}),mQ=e=>`Open experiment ${e==null?void 0:e.name}`,gQ=e=>`打开实验 ${e==null?void 0:e.name}`,vQ=e=>`باز کردن آزمایش ${e==null?void 0:e.name}`,bQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?gQ(e):t==="fa"?vQ(e):mQ(e)}),yQ=e=>`Open ${e==null?void 0:e.path} in the right pane`,xQ=e=>`在右侧面板中打开 ${e==null?void 0:e.path}`,wQ=e=>`باز کردن ${e==null?void 0:e.path} در پنل سمت راست`,SQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?xQ(e):t==="fa"?wQ(e):yQ(e)}),kQ=e=>`Open ${e==null?void 0:e.name}`,CQ=e=>`打开 ${e==null?void 0:e.name}`,EQ=e=>`باز کردن ${e==null?void 0:e.name}`,NQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?CQ(e):t==="fa"?EQ(e):kQ(e)}),zQ=e=>`Open logs for run ${e==null?void 0:e.run}`,jQ=e=>`打开运行 ${e==null?void 0:e.run} 的日志`,TQ=e=>`باز کردن گزارش‌های اجرای ${e==null?void 0:e.run}`,AQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?jQ(e):t==="fa"?TQ(e):zQ(e)}),RQ=e=>`Open ${e==null?void 0:e.name} on GitHub`,MQ=e=>`在 GitHub 上打开 ${e==null?void 0:e.name}`,DQ=e=>`باز کردن ${e==null?void 0:e.name} در GitHub`,J1=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?MQ(e):t==="fa"?DQ(e):RQ(e)}),LQ=e=>`Open logs for run ${e==null?void 0:e.id} in the right pane`,OQ=e=>`在右侧面板中打开运行 ${e==null?void 0:e.id} 的日志`,IQ=e=>`باز کردن گزارش اجرای ${e==null?void 0:e.id} در پنل سمت راست`,BQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?OQ(e):t==="fa"?IQ(e):LQ(e)}),$Q=e=>`Overleaf — ${e==null?void 0:e.status}`,PQ=e=>`Overleaf — ${e==null?void 0:e.status}`,FQ=e=>`Overleaf — ${e==null?void 0:e.status}`,HQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?PQ(e):t==="fa"?FQ(e):$Q(e)}),qQ=e=>`Preview /${e==null?void 0:e.name} skill`,UQ=e=>`预览 /${e==null?void 0:e.name} 技能`,GQ=e=>`پیش‌نمایش مهارت ‎/${e==null?void 0:e.name}`,WQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?UQ(e):t==="fa"?GQ(e):qQ(e)}),VQ=e=>`Remove annotation ${e==null?void 0:e.number}`,KQ=e=>`移除批注 ${e==null?void 0:e.number}`,QQ=e=>`حذف یادداشت ${e==null?void 0:e.number}`,YQ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?KQ(e):t==="fa"?QQ(e):VQ(e)}),XQ=e=>`Remove ${e==null?void 0:e.name}`,ZQ=e=>`移除 ${e==null?void 0:e.name}`,JQ=e=>`حذف ${e==null?void 0:e.name}`,eY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ZQ(e):t==="fa"?JQ(e):XQ(e)}),tY=e=>`Remove queued message: ${e==null?void 0:e.text}`,nY=e=>`移除排队消息:${e==null?void 0:e.text}`,rY=e=>`حذف پیام صف: ${e==null?void 0:e.text}`,sY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?nY(e):t==="fa"?rY(e):tY(e)}),iY=e=>`Retry queued message: ${e==null?void 0:e.text}`,aY=e=>`重试排队消息:${e==null?void 0:e.text}`,oY=e=>`تلاش دوباره برای پیام صف: ${e==null?void 0:e.text}`,lY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?aY(e):t==="fa"?oY(e):iY(e)}),cY=e=>`Run ${e==null?void 0:e.id}`,uY=e=>`运行 ${e==null?void 0:e.id}`,dY=e=>`اجرای ${e==null?void 0:e.id}`,fY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?uY(e):t==="fa"?dY(e):cY(e)}),hY=e=>`Show error details for ${e==null?void 0:e.activity}`,_Y=e=>`显示 ${e==null?void 0:e.activity} 的错误详情`,pY=e=>`نمایش جزئیات خطای ${e==null?void 0:e.activity}`,mY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?_Y(e):t==="fa"?pY(e):hY(e)}),gY=e=>`Show ${e==null?void 0:e.count} more ${e==null?void 0:e.target}`,vY=e=>`再显示 ${e==null?void 0:e.count} 个${e==null?void 0:e.target}`,bY=e=>`نمایش ${e==null?void 0:e.count} مورد دیگر از ${e==null?void 0:e.target}`,yY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?vY(e):t==="fa"?bY(e):gY(e)}),xY=e=>`${e==null?void 0:e.name} skill`,wY=e=>`${e==null?void 0:e.name} 技能`,SY=e=>`مهارت ${e==null?void 0:e.name}`,kY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?wY(e):t==="fa"?SY(e):xY(e)}),CY=e=>`Value for ${e==null?void 0:e.name}`,EY=e=>`${e==null?void 0:e.name} 的值`,NY=e=>`مقدار ${e==null?void 0:e.name}`,zY=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?EY(e):t==="fa"?NY(e):CY(e)}),jY=()=>"Agent reported back",TY=()=>"智能体已返回结果",AY=()=>"عامل نتیجه را گزارش کرد",RY=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?TY():t==="fa"?AY():jY()}),MY=()=>"Browse",DY=()=>"浏览",LY=()=>"مرور",OY=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?DY():t==="fa"?LY():MY()}),IY=()=>"Browsing…",BY=()=>"正在浏览…",$Y=()=>"در حال مرور…",PY=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BY():t==="fa"?$Y():IY()}),FY=()=>"Checked experiment status and updated notes",HY=()=>"已检查实验状态并更新笔记",qY=()=>"وضعیت آزمایش بررسی و یادداشت‌ها به‌روز شد",UY=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HY():t==="fa"?qY():FY()}),GY=()=>"Closed an agent",WY=()=>"已关闭智能体",VY=()=>"عامل بسته شد",KY=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WY():t==="fa"?VY():GY()}),QY=()=>"Compacted context",YY=()=>"上下文已压缩",XY=()=>"زمینه فشرده شد",ZY=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YY():t==="fa"?XY():QY()}),JY=()=>"Compacting context…",eX=()=>"正在压缩上下文…",tX=()=>"در حال فشرده‌سازی زمینه…",nX=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eX():t==="fa"?tX():JY()}),rX=e=>`Created ${e==null?void 0:e.target}`,sX=e=>`已创建 ${e==null?void 0:e.target}`,iX=e=>`${e==null?void 0:e.target} ایجاد شد`,aX=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?sX(e):t==="fa"?iX(e):rX(e)}),oX=()=>"Delegate",lX=()=>"委派",cX=()=>"واگذاری",uX=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lX():t==="fa"?cX():oX()}),dX=()=>"Delegating…",fX=()=>"正在委派…",hX=()=>"در حال واگذاری…",_X=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fX():t==="fa"?hX():dX()}),pX=e=>`Deleted ${e==null?void 0:e.target}`,mX=e=>`已删除 ${e==null?void 0:e.target}`,gX=e=>`${e==null?void 0:e.target} حذف شد`,vX=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?mX(e):t==="fa"?gX(e):pX(e)}),bX=()=>"Edit",yX=()=>"编辑",xX=()=>"ویرایش",wX=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yX():t==="fa"?xX():bX()}),SX=e=>`Edited ${e==null?void 0:e.target}`,kX=e=>`已编辑 ${e==null?void 0:e.target}`,CX=e=>`${e==null?void 0:e.target} ویرایش شد`,EX=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?kX(e):t==="fa"?CX(e):SX(e)}),NX=()=>"Editing…",zX=()=>"正在编辑…",jX=()=>"در حال ویرایش…",TX=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zX():t==="fa"?jX():NX()}),AX=e=>`${e==null?void 0:e.activity} for “${e==null?void 0:e.query}”`,RX=e=>`${e==null?void 0:e.activity}:“${e==null?void 0:e.query}”`,MX=e=>`${e==null?void 0:e.activity}: «${e==null?void 0:e.query}»`,DX=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?RX(e):t==="fa"?MX(e):AX(e)}),LX=e=>`Listed files matching ${e==null?void 0:e.pattern}`,OX=e=>`已列出与 ${e==null?void 0:e.pattern} 匹配的文件`,IX=e=>`فایل‌های مطابق ${e==null?void 0:e.pattern} فهرست شد`,BX=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?OX(e):t==="fa"?IX(e):LX(e)}),$X=()=>"Load",PX=()=>"加载",FX=()=>"بارگیری",HX=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?PX():t==="fa"?FX():$X()}),qX=()=>"Loaded a skill",UX=()=>"已加载技能",GX=()=>"یک مهارت بارگیری شد",WX=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?UX():t==="fa"?GX():qX()}),VX=e=>`Loaded ${e==null?void 0:e.name} skill`,KX=e=>`已加载技能 ${e==null?void 0:e.name}`,QX=e=>`مهارت ${e==null?void 0:e.name} بارگیری شد`,YX=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?KX(e):t==="fa"?QX(e):VX(e)}),XX=()=>"Loading…",ZX=()=>"正在加载…",JX=()=>"در حال بارگیری…",eZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ZX():t==="fa"?JX():XX()}),tZ=e=>`Opened ${e==null?void 0:e.target}`,nZ=e=>`已打开 ${e==null?void 0:e.target}`,rZ=e=>`${e==null?void 0:e.target} باز شد`,sZ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?nZ(e):t==="fa"?rZ(e):tZ(e)}),iZ=e=>`Ran ${e==null?void 0:e.command}`,aZ=e=>`已运行 ${e==null?void 0:e.command}`,oZ=e=>`${e==null?void 0:e.command} اجرا شد`,lZ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?aZ(e):t==="fa"?oZ(e):iZ(e)}),cZ=()=>"Ran a sub-agent",uZ=()=>"已运行子智能体",dZ=()=>"یک عامل فرعی اجرا شد",fZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uZ():t==="fa"?dZ():cZ()}),hZ=()=>"Read",_Z=()=>"读取",pZ=()=>"خواندن",mZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_Z():t==="fa"?pZ():hZ()}),gZ=()=>"Read experiment notes",vZ=()=>"已读取实验笔记",bZ=()=>"یادداشت‌های آزمایش خوانده شد",yZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vZ():t==="fa"?bZ():gZ()}),xZ=()=>"Read a paper",wZ=()=>"已读取论文",SZ=()=>"یک مقاله خوانده شد",kZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wZ():t==="fa"?SZ():xZ()}),CZ=e=>`Read ${e==null?void 0:e.name} skill`,EZ=e=>`已读取技能 ${e==null?void 0:e.name}`,NZ=e=>`مهارت ${e==null?void 0:e.name} خوانده شد`,gx=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?EZ(e):t==="fa"?NZ(e):CZ(e)}),zZ=e=>`Read ${e==null?void 0:e.target}`,jZ=e=>`已读取 ${e==null?void 0:e.target}`,TZ=e=>`${e==null?void 0:e.target} خوانده شد`,l0=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?jZ(e):t==="fa"?TZ(e):zZ(e)}),AZ=()=>"Read a web page",RZ=()=>"已读取网页",MZ=()=>"یک صفحهٔ وب خوانده شد",DZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?RZ():t==="fa"?MZ():AZ()}),LZ=()=>"Reading…",OZ=()=>"正在读取…",IZ=()=>"در حال خواندن…",BZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?OZ():t==="fa"?IZ():LZ()}),$Z=()=>"Resumed an agent",PZ=()=>"已恢复智能体",FZ=()=>"عامل از سر گرفته شد",HZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?PZ():t==="fa"?FZ():$Z()}),qZ=()=>"Review",UZ=()=>"查看",GZ=()=>"بازبینی",WZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?UZ():t==="fa"?GZ():qZ()}),VZ=()=>"Reviewed run log",KZ=()=>"已查看运行日志",QZ=()=>"گزارش اجرا بازبینی شد",YZ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KZ():t==="fa"?QZ():VZ()}),XZ=()=>"Reviewed run logs",ZZ=()=>"已查看运行日志",JZ=()=>"گزارش‌های اجرا بازبینی شد",eJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ZZ():t==="fa"?JZ():XZ()}),tJ=()=>"Reviewed experiment status and notes",nJ=()=>"已查看实验状态和笔记",rJ=()=>"وضعیت و یادداشت‌های آزمایش بازبینی شد",sJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nJ():t==="fa"?rJ():tJ()}),iJ=()=>"Reviewing…",aJ=()=>"正在查看…",oJ=()=>"در حال بازبینی…",lJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aJ():t==="fa"?oJ():iJ()}),cJ=()=>"Run",uJ=()=>"运行",dJ=()=>"اجرا",fJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uJ():t==="fa"?dJ():cJ()}),hJ=()=>"Running…",_J=()=>"正在运行…",pJ=()=>"در حال اجرا…",_D=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_J():t==="fa"?pJ():hJ()}),mJ=()=>"Search",gJ=()=>"搜索",vJ=()=>"جست‌وجو",bJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gJ():t==="fa"?vJ():mJ()}),yJ=()=>"Searched alphaXiv full text",xJ=()=>"已搜索 alphaXiv 全文",wJ=()=>"متن کامل alphaXiv جست‌وجو شد",SJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xJ():t==="fa"?wJ():yJ()}),kJ=()=>"Searched alphaXiv semantically",CJ=()=>"已对 alphaXiv 进行语义搜索",EJ=()=>"جست‌وجوی معنایی در alphaXiv انجام شد",NJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?CJ():t==="fa"?EJ():kJ()}),zJ=()=>"Searched bioRxiv",jJ=()=>"已搜索 bioRxiv",TJ=()=>"bioRxiv جست‌وجو شد",AJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jJ():t==="fa"?TJ():zJ()}),RJ=()=>"Searched code",MJ=()=>"已搜索代码",DJ=()=>"کد جست‌وجو شد",vx=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?MJ():t==="fa"?DJ():RJ()}),LJ=e=>`Searched code for “${e==null?void 0:e.pattern}”`,OJ=e=>`已在代码中搜索“${e==null?void 0:e.pattern}”`,IJ=e=>`کد برای «${e==null?void 0:e.pattern}» جست‌وجو شد`,bx=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?OJ(e):t==="fa"?IJ(e):LJ(e)}),BJ=e=>`Searched images for “${e==null?void 0:e.query}”`,$J=e=>`已搜索图片“${e==null?void 0:e.query}”`,PJ=e=>`تصاویر برای «${e==null?void 0:e.query}» جست‌وجو شد`,FJ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?$J(e):t==="fa"?PJ(e):BJ(e)}),HJ=()=>"Searched the literature",qJ=()=>"已搜索文献",UJ=()=>"منابع علمی جست‌وجو شد",tE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qJ():t==="fa"?UJ():HJ()}),GJ=e=>`Searched “${e==null?void 0:e.pattern}” on a page`,WJ=e=>`已在页面中搜索“${e==null?void 0:e.pattern}”`,VJ=e=>`صفحه برای «${e==null?void 0:e.pattern}» جست‌وجو شد`,KJ=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?WJ(e):t==="fa"?VJ(e):GJ(e)}),QJ=()=>"Searched OpenAlex",YJ=()=>"已搜索 OpenAlex",XJ=()=>"OpenAlex جست‌وجو شد",ZJ=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YJ():t==="fa"?XJ():QJ()}),JJ=e=>`Searched the web for “${e==null?void 0:e.query}”`,eee=e=>`已在网页中搜索“${e==null?void 0:e.query}”`,tee=e=>`وب برای «${e==null?void 0:e.query}» جست‌وجو شد`,nE=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?eee(e):t==="fa"?tee(e):JJ(e)}),nee=e=>`Searched a web page for “${e==null?void 0:e.pattern}”`,ree=e=>`已在网页中搜索“${e==null?void 0:e.pattern}”`,see=e=>`صفحهٔ وب برای «${e==null?void 0:e.pattern}» جست‌وجو شد`,iee=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ree(e):t==="fa"?see(e):nee(e)}),aee=()=>"Searching…",oee=()=>"正在搜索…",lee=()=>"در حال جست‌وجو…",cee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oee():t==="fa"?lee():aee()}),uee=()=>"Sent input to an agent",dee=()=>"已向智能体发送输入",fee=()=>"ورودی به عامل فرستاده شد",hee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dee():t==="fa"?fee():uee()}),_ee=()=>"Spawned an agent",pee=()=>"已创建智能体",mee=()=>"یک عامل ساخته شد",gee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pee():t==="fa"?mee():_ee()}),vee=()=>"Sub-agent",bee=()=>"子智能体",yee=()=>"عامل فرعی",xee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bee():t==="fa"?yee():vee()}),wee=()=>"Sub-agent interrupted",See=()=>"子智能体已中断",kee=()=>"عامل فرعی متوقف شد",Cee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?See():t==="fa"?kee():wee()}),Eee=()=>"Sub-agent started",Nee=()=>"子智能体已启动",zee=()=>"عامل فرعی آغاز شد",jee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nee():t==="fa"?zee():Eee()}),Tee=()=>"Updated experiment notes",Aee=()=>"已更新实验笔记",Ree=()=>"یادداشت‌های آزمایش به‌روز شد",Mee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Aee():t==="fa"?Ree():Tee()}),Dee=()=>"Waiting on an agent",Lee=()=>"正在等待智能体",Oee=()=>"در انتظار عامل",Iee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lee():t==="fa"?Oee():Dee()}),Bee=e=>`Approval required: ${e==null?void 0:e.label}`,$ee=e=>`需要批准:${e==null?void 0:e.label}`,Pee=e=>`نیازمند تأیید: ${e==null?void 0:e.label}`,rE=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?$ee(e):t==="fa"?Pee(e):Bee(e)}),Fee=()=>"The CLI is retrying the turn.",Hee=()=>"CLI 正在重试本轮。",qee=()=>"CLI در حال تلاش دوباره برای این نوبت است.",Uee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hee():t==="fa"?qee():Fee()}),Gee=()=>"Continue is available.",Wee=()=>"可以继续。",Vee=()=>"ادامه در دسترس است.",Kee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wee():t==="fa"?Vee():Gee()}),Qee=()=>"Retry is available.",Yee=()=>"可以重试。",Xee=()=>"تلاش دوباره در دسترس است.",Zee=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Yee():t==="fa"?Xee():Qee()}),Jee=()=>"Running a tool",ete=()=>"正在运行工具",tte=()=>"در حال اجرای ابزار",nte=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ete():t==="fa"?tte():Jee()}),rte=()=>"Tool activity completed",ste=()=>"工具活动已完成",ite=()=>"فعالیت ابزار کامل شد",ate=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ste():t==="fa"?ite():rte()}),ote=e=>`Tool activity failed: ${e==null?void 0:e.labels}`,lte=e=>`工具活动失败:${e==null?void 0:e.labels}`,cte=e=>`فعالیت ابزار ناموفق بود: ${e==null?void 0:e.labels}`,ute=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?lte(e):t==="fa"?cte(e):ote(e)}),dte=e=>`${e==null?void 0:e.count} tool activities failed: ${e==null?void 0:e.labels}`,fte=e=>`${e==null?void 0:e.count} 个工具活动失败:${e==null?void 0:e.labels}`,hte=e=>`${e==null?void 0:e.count} فعالیت ابزار ناموفق بود: ${e==null?void 0:e.labels}`,_te=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?fte(e):t==="fa"?hte(e):dte(e)}),pte=()=>"Turn did not finish.",mte=()=>"本轮未完成。",gte=()=>"این نوبت کامل نشد.",vte=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mte():t==="fa"?gte():pte()}),bte=()=>"Artifacts",yte=()=>"产物",xte=()=>"خروجی‌ها",pD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yte():t==="fa"?xte():bte()}),wte=()=>"Close panel",Ste=()=>"关闭面板",kte=()=>"بستن پنل",ev=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ste():t==="fa"?kte():wte()}),Cte=()=>"Current task",Ete=()=>"当前任务",Nte=()=>"وظیفهٔ فعلی",sE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ete():t==="fa"?Nte():Cte()}),zte=()=>"Drag to resize panel",jte=()=>"拖动以调整面板大小",Tte=()=>"برای تغییر اندازهٔ پنل بکشید",Ate=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jte():t==="fa"?Tte():zte()}),Rte=()=>"Drag toward the center to restore panel",Mte=()=>"向中央拖动以恢复面板",Dte=()=>"برای بازگرداندن پنل به‌سوی مرکز بکشید",Lte=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Mte():t==="fa"?Dte():Rte()}),Ote=()=>"Entire project",Ite=()=>"整个项目",Bte=()=>"کل پروژه",iE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ite():t==="fa"?Bte():Ote()}),$te=()=>"Expand panel",Pte=()=>"展开面板",Fte=()=>"گسترش پنل",aE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pte():t==="fa"?Fte():$te()}),Hte=e=>`Experiment filter: ${e==null?void 0:e.scope}`,qte=e=>`实验筛选:${e==null?void 0:e.scope}`,Ute=e=>`فیلتر آزمایش: ${e==null?void 0:e.scope}`,Gte=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?qte(e):t==="fa"?Ute(e):Hte(e)}),Wte=()=>"Experiment view",Vte=()=>"实验视图",Kte=()=>"نمای آزمایش",Qte=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vte():t==="fa"?Kte():Wte()}),Yte=()=>"Experiments",Xte=()=>"实验",Zte=()=>"آزمایش‌ها",mD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xte():t==="fa"?Zte():Yte()}),Jte=()=>"Files",ene=()=>"文件",tne=()=>"فایل‌ها",k4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ene():t==="fa"?tne():Jte()}),nne=()=>"Filter experiments",rne=()=>"筛选实验",sne=()=>"فیلتر آزمایش‌ها",ine=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rne():t==="fa"?sne():nne()}),ane=()=>"Current task filtering is unavailable for unattributed experiments",one=()=>"存在无法归属的实验时,不能按当前任务筛选",lne=()=>"برای آزمایش‌های بدون وظیفه، فیلتر وظیفهٔ کنونی در دسترس نیست",cne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?one():t==="fa"?lne():ane()}),une=()=>"No experiments from the current task yet. Switch to Entire project to see all experiments.",dne=()=>"当前任务还没有实验。切换到“整个项目”即可查看所有实验。",fne=()=>"وظیفهٔ کنونی هنوز آزمایشی ندارد. برای دیدن همهٔ آزمایش‌ها به «کل پروژه» بروید.",hne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dne():t==="fa"?fne():une()}),_ne=()=>"Open a task to filter to its experiments",pne=()=>"请打开一个任务以筛选其实验",mne=()=>"برای محدود کردن آزمایش‌ها، یک وظیفه را باز کنید",gne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pne():t==="fa"?mne():_ne()}),vne=()=>"projects",bne=()=>"项目",yne=()=>"پروژه‌ها",ep=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bne():t==="fa"?yne():vne()}),xne=()=>"Restore panel",wne=()=>"还原面板",Sne=()=>"بازگرداندن اندازهٔ پنل",oE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wne():t==="fa"?Sne():xne()}),kne=()=>"Retry",Cne=()=>"重试",Ene=()=>"تلاش دوباره",Fi=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cne():t==="fa"?Ene():kne()}),Nne=()=>"Select a project to browse its files.",zne=()=>"选择一个项目以浏览其文件。",jne=()=>"برای مرور فایل‌ها، یک پروژه را انتخاب کنید.",Tne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zne():t==="fa"?jne():Nne()}),Ane=()=>"settings",Rne=()=>"设置",Mne=()=>"تنظیمات",Dne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rne():t==="fa"?Mne():Ane()}),Lne=e=>`Couldn’t load OpenResearch ${e==null?void 0:e.items}.`,One=e=>`无法加载 OpenResearch 的${e==null?void 0:e.items}。`,Ine=e=>`بارگذاری ${e==null?void 0:e.items} در OpenResearch ناموفق بود.`,Bne=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?One(e):t==="fa"?Ine(e):Lne(e)}),$ne=()=>"Sub-agent",Pne=()=>"子智能体",Fne=()=>"عامل فرعی",Hne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pne():t==="fa"?Fne():$ne()}),qne=()=>"Table",Une=()=>"表格",Gne=()=>"جدول",Wne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Une():t==="fa"?Gne():qne()}),Vne=()=>"Tree",Kne=()=>"树状图",Qne=()=>"درخت",Yne=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kne():t==="fa"?Qne():Vne()}),Xne=e=>`Collapse ${e==null?void 0:e.name}`,Zne=e=>`折叠 ${e==null?void 0:e.name}`,Jne=e=>`بستن پوشهٔ ${e==null?void 0:e.name}`,ere=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Zne(e):t==="fa"?Jne(e):Xne(e)}),tre=e=>`Delete “${e==null?void 0:e.path}” from the artifacts directory?`,nre=e=>`从产物目录中删除“${e==null?void 0:e.path}”?`,rre=e=>`«${e==null?void 0:e.path}» از پوشهٔ خروجی‌ها حذف شود؟`,Z5=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?nre(e):t==="fa"?rre(e):tre(e)}),sre=e=>`Delete folder ${e==null?void 0:e.name}`,ire=e=>`删除文件夹 ${e==null?void 0:e.name}`,are=e=>`حذف پوشهٔ ${e==null?void 0:e.name}`,ore=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ire(e):t==="fa"?are(e):sre(e)}),lre=e=>`Expand ${e==null?void 0:e.name}`,cre=e=>`展开 ${e==null?void 0:e.name}`,ure=e=>`باز کردن پوشهٔ ${e==null?void 0:e.name}`,dre=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?cre(e):t==="fa"?ure(e):lre(e)}),fre=()=>"Binary or unsupported file — no inline preview.",hre=()=>"二进制文件或不受支持的文件 — 无法内嵌预览。",_re=()=>"فایل دودویی یا پشتیبانی‌نشده است — پیش‌نمایش درون‌صفحه‌ای ندارد.",pre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hre():t==="fa"?_re():fre()}),mre=()=>"Copy path",gre=()=>"复制路径",vre=()=>"کپی مسیر",bre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gre():t==="fa"?vre():mre()}),yre=()=>"Artifact not found",xre=()=>"找不到产物",wre=()=>"خروجی پیدا نشد",Sre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xre():t==="fa"?wre():yre()}),kre=()=>"Open raw",Cre=()=>"打开原始文件",Ere=()=>"باز کردن فایل خام",Nre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cre():t==="fa"?Ere():kre()}),zre=()=>"Click an artifact to view it",jre=()=>"点击产物即可查看",Tre=()=>"برای مشاهده، یک خروجی را انتخاب کنید",Are=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jre():t==="fa"?Tre():zre()}),Rre=()=>"Delete artifact",Mre=()=>"删除产物",Dre=()=>"حذف خروجی",lE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Mre():t==="fa"?Dre():Rre()}),Lre=()=>"Delete folder",Ore=()=>"删除文件夹",Ire=()=>"حذف پوشه",Bre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ore():t==="fa"?Ire():Lre()}),$re=()=>"Failed to load:",Pre=()=>"加载失败:",Fre=()=>"بارگیری ناموفق بود:",Hre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pre():t==="fa"?Fre():$re()}),qre=()=>"File truncated — showing the first 512 KB.",Ure=()=>"文件已截断——仅显示前 512 KB。",Gre=()=>"فایل کوتاه شده است — فقط ۵۱۲ کیلوبایت نخست نمایش داده می‌شود.",Wre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ure():t==="fa"?Gre():qre()}),Vre=()=>"Listing truncated — the folder has more artifacts.",Kre=()=>"列表已截断——文件夹中还有更多产物。",Qre=()=>"فهرست کوتاه شده است — خروجی‌های بیشتری در پوشه وجود دارد.",Yre=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kre():t==="fa"?Qre():Vre()}),Xre=()=>"Loading…",Zre=()=>"正在加载…",Jre=()=>"در حال بارگیری…",gD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zre():t==="fa"?Jre():Xre()}),ese=()=>"Loading artifacts…",tse=()=>"正在加载产物…",nse=()=>"در حال بارگیری خروجی‌ها…",rse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tse():t==="fa"?nse():ese()}),sse=()=>"Modified",ise=()=>"修改时间",ase=()=>"ویرایش‌شده",ose=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ise():t==="fa"?ase():sse()}),lse=()=>"No artifacts yet",cse=()=>"尚无产物",use=()=>"هنوز خروجی‌ای وجود ندارد",dse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cse():t==="fa"?use():lse()}),fse=()=>"Open raw in new tab",hse=()=>"在新标签页中打开原始文件",_se=()=>"باز کردن فایل خام در زبانهٔ جدید",cE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hse():t==="fa"?_se():fse()}),pse=()=>"This is the project's durable output space for reports, figures, images, CSVs, PDFs, and other research artifacts. Ask the agent for a write-up or add your own files.",mse=()=>"这里是项目的持久输出空间,用于保存报告、图表、图片、CSV、PDF 和其他研究产物。你可以让智能体撰写报告,也可以自行添加文件。",gse=()=>"این فضای پایدار خروجی پروژه برای گزارش‌ها، نمودارها، تصاویر، فایل‌های CSV و PDF و دیگر خروجی‌های پژوهشی است. از عامل بخواهید گزارشی بنویسد یا فایل‌های خودتان را اضافه کنید.",vse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mse():t==="fa"?gse():pse()}),bse=()=>"File too large to preview inline.",yse=()=>"文件太大,无法内嵌预览。",xse=()=>"فایل برای پیش‌نمایش درون‌صفحه‌ای بیش از حد بزرگ است.",wse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yse():t==="fa"?xse():bse()}),Sse=()=>"This is the baseline branch, so there is no parent comparison.",kse=()=>"这是基线分支,因此没有父分支可供比较。",Cse=()=>"این شاخهٔ مبناست، بنابراین شاخهٔ والدی برای مقایسه ندارد.",Ese=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kse():t==="fa"?Cse():Sse()}),Nse=()=>"Failed to load changes:",zse=()=>"加载更改失败:",jse=()=>"بارگیری تغییرات ناموفق بود:",Tse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zse():t==="fa"?jse():Nse()}),Ase=()=>"Loading changes…",Rse=()=>"正在加载更改…",Mse=()=>"در حال بارگیری تغییرات…",Dse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rse():t==="fa"?Mse():Ase()}),Lse=()=>"No committed changes from the parent branch.",Ose=()=>"与父分支相比没有已提交的更改。",Ise=()=>"نسبت به شاخهٔ والد تغییر ثبت‌شده‌ای وجود ندارد.",Bse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ose():t==="fa"?Ise():Lse()}),$se=e=>`agent ${e==null?void 0:e.number}`,Pse=e=>`智能体 ${e==null?void 0:e.number}`,Fse=e=>`عامل ${e==null?void 0:e.number}`,uE=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Pse(e):t==="fa"?Fse(e):$se(e)}),Hse=()=>"agent sessions",qse=()=>"智能体会话",Use=()=>"نشست‌های عامل‌ها",Gse=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qse():t==="fa"?Use():Hse()}),Wse=()=>"All sessions",Vse=()=>"所有会话",Kse=()=>"همهٔ نشست‌ها",vD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vse():t==="fa"?Kse():Wse()}),Qse=e=>`${e==null?void 0:e.count} annotations`,Yse=e=>`${e==null?void 0:e.count} 条批注`,Xse=e=>`${e==null?void 0:e.count} یادداشت`,Zse=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Yse(e):t==="fa"?Xse(e):Qse(e)}),Jse=()=>"Archive",eie=()=>"归档",tie=()=>"بایگانی",nie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eie():t==="fa"?tie():Jse()}),rie=()=>"Ask the research agent… (/ for commands and skills, ! for shell)",sie=()=>"询问研究智能体…(输入 / 使用命令和技能,输入 ! 运行 shell)",iie=()=>"از عامل پژوهش بپرسید… (/ برای فرمان‌ها و مهارت‌ها، ! برای شل)",aie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sie():t==="fa"?iie():rie()}),oie=()=>"Asked about selected text",lie=()=>"已询问所选文本",cie=()=>"دربارهٔ متن انتخاب‌شده پرسیده شد",uie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lie():t==="fa"?cie():oie()}),die=()=>"Attachment",fie=()=>"附件",hie=()=>"پیوست",_ie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fie():t==="fa"?hie():die()}),pie=e=>`${e==null?void 0:e.name} is too large — each attachment must be under 30 MB.`,mie=e=>`${e==null?void 0:e.name} 太大 — 每个附件必须小于 30 MB。`,gie=e=>`${e==null?void 0:e.name} بیش از حد بزرگ است — هر پیوست باید کمتر از ۳۰ مگابایت باشد.`,vie=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?mie(e):t==="fa"?gie(e):pie(e)}),bie=()=>"Attachments exceed the 40 MB total limit — remove one and try again.",yie=()=>"附件总大小超过 40 MB 限制 — 请移除一个附件后重试。",xie=()=>"حجم پیوست‌ها از سقف ۴۰ مگابایت بیشتر است — یکی را حذف و دوباره تلاش کنید.",wie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yie():t==="fa"?xie():bie()}),Sie=()=>"Wait for the turn to finish before running a command.",kie=()=>"请等待本轮结束后再运行命令。",Cie=()=>"پیش از اجرای فرمان، صبر کنید تا نوبت تمام شود.",Eie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kie():t==="fa"?Cie():Sie()}),Nie=e=>`Exited with code ${e==null?void 0:e.code}`,zie=e=>`退出码 ${e==null?void 0:e.code}`,jie=e=>`با کد ${e==null?void 0:e.code} خارج شد`,Tie=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?zie(e):t==="fa"?jie(e):Nie(e)}),Aie=e=>`Command not run: ${e==null?void 0:e.error}`,Rie=e=>`命令未运行:${e==null?void 0:e.error}`,Mie=e=>`فرمان اجرا نشد: ${e==null?void 0:e.error}`,dE=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Rie(e):t==="fa"?Mie(e):Aie(e)}),Die=()=>"Collapse tool activity",Lie=()=>"折叠工具活动",Oie=()=>"بستن فعالیت ابزارها",Iie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lie():t==="fa"?Oie():Die()}),Bie=()=>"Continue",$ie=()=>"继续",Pie=()=>"ادامه",Fie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$ie():t==="fa"?Pie():Bie()}),Hie=e=>`Delete “${e==null?void 0:e.title}”? Its transcript will be permanently removed.`,qie=e=>`删除“${e==null?void 0:e.title}”? 其对话记录将被永久移除。`,Uie=e=>`«${e==null?void 0:e.title}» حذف شود؟ -رونوشت آن برای همیشه حذف خواهد شد.`,Gie=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?qie(e):t==="fa"?Uie(e):Hie(e)}),Wie=e=>`Failed to delete “${e==null?void 0:e.title}”: ${e==null?void 0:e.error}`,Vie=e=>`删除“${e==null?void 0:e.title}”失败:${e==null?void 0:e.error}`,Kie=e=>`حذف «${e==null?void 0:e.title}» ناموفق بود: ${e==null?void 0:e.error}`,Qie=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Vie(e):t==="fa"?Kie(e):Wie(e)}),Yie=()=>"Could not exit Plan mode. Try again.",Xie=()=>"无法退出计划模式。请重试。",Zie=()=>"خروج از حالت طرح ممکن نشد. دوباره تلاش کنید.",Jie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xie():t==="fa"?Zie():Yie()}),eae=()=>"Expand tool activity",tae=()=>"展开工具活动",nae=()=>"باز کردن فعالیت ابزارها",rae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tae():t==="fa"?nae():eae()}),sae=()=>"experiments",iae=()=>"实验",aae=()=>"آزمایش‌ها",oae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iae():t==="fa"?aae():sae()}),lae=e=>`${e==null?void 0:e.harness} is unavailable — open the model picker`,cae=e=>`${e==null?void 0:e.harness} 不可用 — 请打开模型选择器`,uae=e=>`در حال حاضر ${e==null?void 0:e.harness} در دسترس نیست — انتخاب‌گر مدل را باز کنید`,dae=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?cae(e):t==="fa"?uae(e):lae(e)}),fae=e=>`Message ${e==null?void 0:e.harness}… (/ for commands and skills, ! for shell)`,hae=e=>`给 ${e==null?void 0:e.harness} 发消息…(输入 / 使用命令和技能,输入 ! 运行 shell)`,_ae=e=>`پیام به ${e==null?void 0:e.harness}… (/ برای فرمان‌ها و مهارت‌ها، ! برای شل)`,pae=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?hae(e):t==="fa"?_ae(e):fae(e)}),mae=e=>`Message not sent: ${e==null?void 0:e.error}`,gae=e=>`消息未发送:${e==null?void 0:e.error}`,vae=e=>`پیام ارسال نشد: ${e==null?void 0:e.error}`,bae=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?gae(e):t==="fa"?vae(e):mae(e)}),yae=()=>"Model unavailable",xae=()=>"模型不可用",wae=()=>"مدل در دسترس نیست",Sae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xae():t==="fa"?wae():yae()}),kae=()=>"New session",Cae=()=>"新会话",Eae=()=>"نشست جدید",fE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cae():t==="fa"?Eae():kae()}),Nae=()=>"No active sessions",zae=()=>"没有活跃会话",jae=()=>"نشست فعالی وجود ندارد",Tae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zae():t==="fa"?jae():Nae()}),Aae=()=>"No activity",Rae=()=>"无活动",Mae=()=>"بدون فعالیت",Dae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rae():t==="fa"?Mae():Aae()}),Lae=()=>"No archived sessions",Oae=()=>"没有已归档的会话",Iae=()=>"نشست بایگانی‌شده‌ای وجود ندارد",Bae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Oae():t==="fa"?Iae():Lae()}),$ae=()=>"No sessions yet",Pae=()=>"还没有会话",Fae=()=>"هنوز نشستی وجود ندارد",Hae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pae():t==="fa"?Fae():$ae()}),qae=()=>"1 annotation",Uae=()=>"1 条批注",Gae=()=>"۱ یادداشت",Wae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Uae():t==="fa"?Gae():qae()}),Vae=()=>"Open sub-agent transcript",Kae=()=>"打开子智能体记录",Qae=()=>"باز کردن متن گفت‌وگوی عامل فرعی",Yae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kae():t==="fa"?Qae():Vae()}),Xae=()=>"About this demo",Zae=()=>"关于此演示",Jae=()=>"دربارهٔ این نسخهٔ نمایشی",hE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zae():t==="fa"?Jae():Xae()}),eoe=()=>"Accept and auto mode",toe=()=>"接受并使用自动模式",noe=()=>"پذیرش و حالت خودکار",roe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?toe():t==="fa"?noe():eoe()}),soe=()=>"Accept and bypass all",ioe=()=>"接受并跳过所有审批",aoe=()=>"پذیرش و عبور از همهٔ تأییدها",ooe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ioe():t==="fa"?aoe():soe()}),loe=()=>"Active",coe=()=>"活跃",uoe=()=>"فعال",doe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?coe():t==="fa"?uoe():loe()}),foe=()=>"All",hoe=()=>"全部",_oe=()=>"همه",poe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hoe():t==="fa"?_oe():foe()}),moe=()=>"Allow",goe=()=>"允许",voe=()=>"اجازه دادن",boe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?goe():t==="fa"?voe():moe()}),yoe=()=>"Approval required",xoe=()=>"需要批准",woe=()=>"نیازمند تأیید",Soe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xoe():t==="fa"?woe():yoe()}),koe=()=>"Archived",Coe=()=>"已归档",Eoe=()=>"بایگانی‌شده",_E=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Coe():t==="fa"?Eoe():koe()}),Noe=()=>"Ask about this",zoe=()=>"询问此内容",joe=()=>"دربارهٔ این بپرسید",Toe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zoe():t==="fa"?joe():Noe()}),Aoe=()=>"Attach a PDF or image",Roe=()=>"附加 PDF 或图片",Moe=()=>"پیوست PDF یا تصویر",pE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Roe():t==="fa"?Moe():Aoe()}),Doe=()=>"Bash",Loe=()=>"Bash",Ooe=()=>"Bash",bD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Loe():t==="fa"?Ooe():Doe()}),Ioe=()=>"Browsed the web",Boe=()=>"已浏览网页",$oe=()=>"وب مرور شد",mE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Boe():t==="fa"?$oe():Ioe()}),Poe=()=>"Built the project",Foe=()=>"已构建项目",Hoe=()=>"پروژه ساخته شد",qoe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Foe():t==="fa"?Hoe():Poe()}),Uoe=()=>"Cancel",Goe=()=>"取消",Woe=()=>"لغو",Voe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Goe():t==="fa"?Woe():Uoe()}),Koe=()=>"Cancelled an experiment run",Qoe=()=>"已取消实验运行",Yoe=()=>"اجرای آزمایش لغو شد",Xoe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Qoe():t==="fa"?Yoe():Koe()}),Zoe=()=>"Checked code style",Joe=()=>"已检查代码风格",ele=()=>"سبک کد بررسی شد",tle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Joe():t==="fa"?ele():Zoe()}),nle=()=>"Checked compute options",rle=()=>"已检查算力选项",sle=()=>"گزینه‌های رایانشی بررسی شد",ile=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rle():t==="fa"?sle():nle()}),ale=()=>"Checked experiment status",ole=()=>"已检查实验状态",lle=()=>"وضعیت آزمایش بررسی شد",gE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ole():t==="fa"?lle():ale()}),cle=()=>"Checked Git status",ule=()=>"已检查 Git 状态",dle=()=>"وضعیت Git بررسی شد",fle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ule():t==="fa"?dle():cle()}),hle=()=>"Checked local times",_le=()=>"已查询当地时间",ple=()=>"زمان‌های محلی بررسی شد",mle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_le():t==="fa"?ple():hle()}),gle=()=>"Checked market data",vle=()=>"已查询市场数据",ble=()=>"داده‌های بازار بررسی شد",yle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vle():t==="fa"?ble():gle()}),xle=()=>"Checked sports data",wle=()=>"已查询体育数据",Sle=()=>"داده‌های ورزشی بررسی شد",kle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wle():t==="fa"?Sle():xle()}),Cle=()=>"Checked the weather",Ele=()=>"已查询天气",Nle=()=>"آب‌وهوا بررسی شد",zle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ele():t==="fa"?Nle():Cle()}),jle=()=>"Checked types",Tle=()=>"已检查类型",Ale=()=>"نوع‌ها بررسی شد",Rle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tle():t==="fa"?Ale():jle()}),Mle=()=>"Clear annotations",Dle=()=>"清除批注",Lle=()=>"پاک کردن یادداشت‌ها",vE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Dle():t==="fa"?Lle():Mle()}),Ole=()=>"Customize",Ile=()=>"自定义",Ble=()=>"سفارشی‌سازی",$le=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ile():t==="fa"?Ble():Ole()}),Ple=()=>"Data sources",Fle=()=>"数据源",Hle=()=>"منابع داده",yx=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Fle():t==="fa"?Hle():Ple()}),qle=()=>"Delegated a task to a new agent",Ule=()=>"已将任务委派给新智能体",Gle=()=>"وظیفه به عامل جدید واگذار شد",Wle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ule():t==="fa"?Gle():qle()}),Vle=()=>"Delete",Kle=()=>"删除",Qle=()=>"حذف",yD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kle():t==="fa"?Qle():Vle()}),Yle=()=>"Deny",Xle=()=>"拒绝",Zle=()=>"رد کردن",Jle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xle():t==="fa"?Zle():Yle()}),ece=()=>"Edit and re-send",tce=()=>"编辑并重新发送",nce=()=>"ویرایش و ارسال دوباره",bE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tce():t==="fa"?nce():ece()}),rce=()=>"Edit message",sce=()=>"编辑消息",ice=()=>"ویرایش پیام",ace=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sce():t==="fa"?ice():rce()}),oce=()=>"Edited a file",lce=()=>"已编辑文件",cce=()=>"فایل ویرایش شد",yE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lce():t==="fa"?cce():oce()}),uce=()=>"Exit Bash mode",dce=()=>"退出 Bash 模式",fce=()=>"خروج از حالت Bash",xE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dce():t==="fa"?fce():uce()}),hce=()=>"Exit Plan mode",_ce=()=>"退出计划模式",pce=()=>"خروج از حالت طرح",wE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_ce():t==="fa"?pce():hce()}),mce=()=>"Failed:",gce=()=>"失败:",vce=()=>"ناموفق:",J5=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gce():t==="fa"?vce():mce()}),bce=()=>"Filter sessions",yce=()=>"筛选会话",xce=()=>"فیلتر نشست‌ها",SE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yce():t==="fa"?xce():bce()}),wce=()=>"is unavailable.",Sce=()=>"不可用。",kce=()=>"در دسترس نیست.",Cce=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Sce():t==="fa"?kce():wce()}),Ece=()=>"Later queued messages will wait until this is retried or removed.",Nce=()=>"后续排队的消息会等待此消息重试或移除。",zce=()=>"پیام‌های بعدی صف تا تلاش دوباره یا حذف این پیام منتظر می‌مانند.",jce=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nce():t==="fa"?zce():Ece()}),Tce=()=>"Listed files",Ace=()=>"已列出文件",Rce=()=>"فایل‌ها فهرست شد",kE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ace():t==="fa"?Rce():Tce()}),Mce=()=>"Listed project runs",Dce=()=>"已列出项目运行",Lce=()=>"اجراهای پروژه فهرست شد",Oce=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Dce():t==="fa"?Lce():Mce()}),Ice=()=>"Listed projects",Bce=()=>"已列出项目",$ce=()=>"پروژه‌ها فهرست شد",Pce=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Bce():t==="fa"?$ce():Ice()}),Fce=()=>"Loading conversation…",Hce=()=>"正在加载对话…",qce=()=>"در حال بارگیری گفتگو…",Uce=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hce():t==="fa"?qce():Fce()}),Gce=()=>"New Chat",Wce=()=>"新对话",Vce=()=>"گفتگوی جدید",Kce=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wce():t==="fa"?Vce():Gce()}),Qce=()=>"Next version",Yce=()=>"下一版本",Xce=()=>"نسخهٔ بعدی",CE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Yce():t==="fa"?Xce():Qce()}),Zce=()=>"Open the session this agent spawned",Jce=()=>"打开此智能体创建的会话",eue=()=>"باز کردن نشست ساخته‌شده توسط این عامل",tue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Jce():t==="fa"?eue():Zce()}),nue=()=>"Opened web pages",rue=()=>"已打开网页",sue=()=>"صفحه‌های وب باز شد",iue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rue():t==="fa"?sue():nue()}),aue=()=>"Plan",oue=()=>"计划",lue=()=>"طرح",cue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oue():t==="fa"?lue():aue()}),uue=()=>"Plan approved",due=()=>"计划已批准",fue=()=>"طرح تأیید شد",hue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?due():t==="fa"?fue():uue()}),_ue=()=>"Plan rejected",pue=()=>"计划已拒绝",mue=()=>"طرح رد شد",gue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pue():t==="fa"?mue():_ue()}),vue=()=>"Plan resolved",bue=()=>"计划已处理",yue=()=>"طرح تعیین تکلیف شد",xue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bue():t==="fa"?yue():vue()}),wue=()=>"Plan revision requested",Sue=()=>"已请求修改计划",kue=()=>"درخواست بازنگری طرح ثبت شد",Cue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Sue():t==="fa"?kue():wue()}),Eue=()=>"Previous version",Nue=()=>"上一版本",zue=()=>"نسخهٔ قبلی",EE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nue():t==="fa"?zue():Eue()}),jue=()=>"Ran a command",Tue=()=>"已运行命令",Aue=()=>"فرمان اجرا شد",Rue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tue():t==="fa"?Aue():jue()}),Mue=()=>"Ran tests",Due=()=>"已运行测试",Lue=()=>"آزمون‌ها اجرا شد",Oue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Due():t==="fa"?Lue():Mue()}),Iue=()=>"Read a file",Bue=()=>"已读取文件",$ue=()=>"فایل خوانده شد",Pue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Bue():t==="fa"?$ue():Iue()}),Fue=()=>"Read Git history",Hue=()=>"已读取 Git 历史",que=()=>"تاریخچهٔ Git خوانده شد",Uue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hue():t==="fa"?que():Fue()}),Gue=()=>"Read project details",Wue=()=>"已读取项目详情",Vue=()=>"جزئیات پروژه خوانده شد",Kue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wue():t==="fa"?Vue():Gue()}),Que=()=>"Reject",Yue=()=>"拒绝",Xue=()=>"رد کردن",Zue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Yue():t==="fa"?Xue():Que()}),Jue=()=>"Remove",ede=()=>"移除",tde=()=>"حذف",nde=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ede():t==="fa"?tde():Jue()}),rde=()=>"Remove annotation",sde=()=>"移除批注",ide=()=>"حذف یادداشت",ade=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sde():t==="fa"?ide():rde()}),ode=()=>"Remove file",lde=()=>"移除文件",cde=()=>"حذف فایل",NE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lde():t==="fa"?cde():ode()}),ude=()=>"Remove image",dde=()=>"移除图片",fde=()=>"حذف تصویر",zE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dde():t==="fa"?fde():ude()}),hde=()=>"Remove queued message",_de=()=>"移除排队消息",pde=()=>"حذف پیام صف",jE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_de():t==="fa"?pde():hde()}),mde=()=>"Rename",gde=()=>"重命名",vde=()=>"تغییر نام",xD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gde():t==="fa"?vde():mde()}),bde=()=>"Reviewed code changes",yde=()=>"已审查代码更改",xde=()=>"تغییرات کد بازبینی شد",wde=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yde():t==="fa"?xde():bde()}),Sde=()=>"Run",kde=()=>"运行",Cde=()=>"اجرا",TE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kde():t==="fa"?Cde():Sde()}),Ede=()=>"Selected chat text",Nde=()=>"已选聊天文本",zde=()=>"متن انتخاب‌شدهٔ گفتگو",jde=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nde():t==="fa"?zde():Ede()}),Tde=()=>"Selected text:",Ade=()=>"已选文本:",Rde=()=>"متن انتخاب‌شده:",Mde=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ade():t==="fa"?Rde():Tde()}),Dde=()=>"Send",Lde=()=>"发送",Ode=()=>"ارسال",C4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lde():t==="fa"?Ode():Dde()}),Ide=()=>"Session options",Bde=()=>"会话选项",$de=()=>"گزینه‌های نشست",AE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Bde():t==="fa"?$de():Ide()}),Pde=()=>"Session title",Fde=()=>"会话标题",Hde=()=>"عنوان نشست",qde=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Fde():t==="fa"?Hde():Pde()}),Ude=()=>"Show sidebar",Gde=()=>"显示侧边栏",Wde=()=>"نمایش نوار کناری",RE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Gde():t==="fa"?Wde():Ude()}),Vde=()=>"Started an experiment run",Kde=()=>"已启动实验运行",Qde=()=>"اجرای آزمایش آغاز شد",Yde=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kde():t==="fa"?Qde():Vde()}),Xde=()=>"Reading the project to suggest where to start…",Zde=()=>"正在阅读项目以建议从哪里开始…",Jde=()=>"در حال خواندن پروژه برای پیشنهاد نقطهٔ شروع…",efe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zde():t==="fa"?Jde():Xde()}),tfe=()=>"Starter prompts",nfe=()=>"入门提示",rfe=()=>"پیشنهادهای شروع",sfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nfe():t==="fa"?rfe():tfe()}),ife=()=>"Stop",afe=()=>"停止",ofe=()=>"توقف",ME=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?afe():t==="fa"?ofe():ife()}),lfe=()=>"Submit",cfe=()=>"提交",ufe=()=>"ارسال",dfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cfe():t==="fa"?ufe():lfe()}),ffe=()=>"Tool failed",hfe=()=>"工具失败",_fe=()=>"ابزار ناموفق بود",pfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hfe():t==="fa"?_fe():ffe()}),mfe=()=>"Used tools",gfe=()=>"已使用工具",vfe=()=>"ابزارها استفاده شد",wD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gfe():t==="fa"?vfe():mfe()}),bfe=()=>"View full plan",yfe=()=>"查看完整计划",xfe=()=>"مشاهدهٔ طرح کامل",wfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yfe():t==="fa"?xfe():bfe()}),Sfe=()=>"Waited for an experiment run",kfe=()=>"已等待实验运行",Cfe=()=>"برای اجرای آزمایش صبر شد",Efe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kfe():t==="fa"?Cfe():Sfe()}),Nfe=()=>"Waiting for your input…",zfe=()=>"正在等待你的输入…",jfe=()=>"منتظر ورودی شما…",Tfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zfe():t==="fa"?jfe():Nfe()}),Afe=()=>"What should we research?",Rfe=()=>"我们应该研究什么?",Mfe=()=>"چه چیزی را پژوهش کنیم؟",Dfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rfe():t==="fa"?Mfe():Afe()}),Lfe=()=>"You, mid-task",Ofe=()=>"你(任务进行中)",Ife=()=>"شما، هنگام انجام وظیفه",Bfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ofe():t==="fa"?Ife():Lfe()}),$fe=()=>"Pasted image",Pfe=()=>"粘贴的图片",Ffe=()=>"تصویر جای‌گذاری‌شده",Hfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pfe():t==="fa"?Ffe():$fe()}),qfe=()=>"Plan",Ufe=()=>"计划",Gfe=()=>"طرح",SD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ufe():t==="fa"?Gfe():qfe()}),Wfe=()=>"Plan mode — ready to proceed?",Vfe=()=>"计划模式 — 准备好继续了吗?",Kfe=()=>"حالت طرح — آماده‌اید ادامه دهید؟",Qfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vfe():t==="fa"?Kfe():Wfe()}),Yfe=()=>"Proposed plan",Xfe=()=>"提议的计划",Zfe=()=>"طرح پیشنهادی",DE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xfe():t==="fa"?Zfe():Yfe()}),Jfe=()=>"Question",ehe=()=>"问题",the=()=>"پرسش",nhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ehe():t==="fa"?the():Jfe()}),rhe=()=>"Queued",she=()=>"已排队",ihe=()=>"در صف",ahe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?she():t==="fa"?ihe():rhe()}),ohe=()=>"Recents",lhe=()=>"最近",che=()=>"اخیر",kD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lhe():t==="fa"?che():ohe()}),uhe=()=>"Re-check its setup.",dhe=()=>"请重新检查其设置。",fhe=()=>"راه‌اندازی آن را دوباره بررسی کنید.",hhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dhe():t==="fa"?fhe():uhe()}),_he=()=>"Could not recover this turn. Try again.",phe=()=>"无法恢复本轮。请重试。",mhe=()=>"بازیابی این نوبت ممکن نشد. دوباره تلاش کنید.",ghe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?phe():t==="fa"?mhe():_he()}),vhe=()=>"Could not remove the queued message. Try again.",bhe=()=>"无法移除排队消息。请重试。",yhe=()=>"حذف پیام در صف ممکن نشد. دوباره تلاش کنید.",xhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bhe():t==="fa"?yhe():vhe()}),whe=e=>`Could not re-send: ${e==null?void 0:e.error}`,She=e=>`无法重新发送:${e==null?void 0:e.error}`,khe=e=>`ارسال دوباره ممکن نشد: ${e==null?void 0:e.error}`,Che=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?She(e):t==="fa"?khe(e):whe(e)}),Ehe=()=>"Resolved",Nhe=()=>"已处理",zhe=()=>"رسیدگی شد",jhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nhe():t==="fa"?zhe():Ehe()}),The=()=>"Could not retry the queued message. Try again.",Ahe=()=>"无法重试排队消息。请重试。",Rhe=()=>"تلاش دوباره برای پیام در صف ممکن نشد. دوباره تلاش کنید.",Mhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ahe():t==="fa"?Rhe():The()}),Dhe=()=>"run logs",Lhe=()=>"运行日志",Ohe=()=>"گزارش‌های اجرا",Ihe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lhe():t==="fa"?Ohe():Dhe()}),Bhe=()=>"Scroll to bottom",$he=()=>"滚动到底部",Phe=()=>"رفتن به پایین گفتگو",LE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$he():t==="fa"?Phe():Bhe()}),Fhe=()=>"The selected harness is unavailable",Hhe=()=>"所选智能体工具不可用",qhe=()=>"ابزار عامل انتخاب‌شده در دسترس نیست",xx=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hhe():t==="fa"?qhe():Fhe()}),Uhe=()=>"Session limit reached",Ghe=()=>"已达到会话使用限额",Whe=()=>"به سقف مصرف نشست رسیده‌اید",Vhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ghe():t==="fa"?Whe():Uhe()}),Khe=()=>"The chat session was not created",Qhe=()=>"未能创建聊天会话",Yhe=()=>"نشست گفت‌وگو ایجاد نشد",Xhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Qhe():t==="fa"?Yhe():Khe()}),Zhe=()=>"Show full conversation",Jhe=()=>"显示完整对话",e_e=()=>"نمایش کامل گفتگو",t_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Jhe():t==="fa"?e_e():Zhe()}),n_e=()=>" · Spawned by another agent",r_e=()=>" · 由另一个智能体创建",s_e=()=>" · ساخته‌شده به‌دست عامل دیگر",i_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?r_e():t==="fa"?s_e():n_e()}),a_e=()=>"Starting…",o_e=()=>"正在启动…",l_e=()=>"در حال شروع…",c_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?o_e():t==="fa"?l_e():a_e()}),u_e=e=>`Steer ${e==null?void 0:e.harness}… (${e==null?void 0:e.shortcut} to queue)`,d_e=e=>`向 ${e==null?void 0:e.harness} 补充指示…(按 ${e==null?void 0:e.shortcut} 排队)`,f_e=e=>`راهنمایی ${e==null?void 0:e.harness}… (${e==null?void 0:e.shortcut} برای افزودن به صف)`,h_e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?d_e(e):t==="fa"?f_e(e):u_e(e)}),__e=()=>"Could not stop the turn. Try again.",p_e=()=>"无法停止本轮。请重试。",m_e=()=>"توقف این نوبت ممکن نشد. دوباره تلاش کنید.",g_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?p_e():t==="fa"?m_e():__e()}),v_e=e=>`Could not switch fork: ${e==null?void 0:e.error}`,b_e=e=>`无法切换分支:${e==null?void 0:e.error}`,y_e=e=>`تغییر شاخه ممکن نشد: ${e==null?void 0:e.error}`,x_e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?b_e(e):t==="fa"?y_e(e):v_e(e)}),w_e=()=>"The agent",S_e=()=>"智能体",k_e=()=>"عامل",C_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?S_e():t==="fa"?k_e():w_e()}),E_e=()=>"Thinking",N_e=()=>"正在思考",z_e=()=>"در حال فکر کردن",j_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?N_e():t==="fa"?z_e():E_e()}),T_e=()=>"Could not toggle Plan mode. Try again.",A_e=()=>"无法切换计划模式。请重试。",R_e=()=>"تغییر حالت طرح ممکن نشد. دوباره تلاش کنید.",OE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?A_e():t==="fa"?R_e():T_e()}),M_e=()=>"This turn did not finish.",D_e=()=>"本轮未完成。",L_e=()=>"این نوبت کامل نشد.",IE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?D_e():t==="fa"?L_e():M_e()}),O_e=()=>"Type a custom answer…",I_e=()=>"输入自定义回答…",B_e=()=>"پاسخ دلخواه را بنویسید…",$_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?I_e():t==="fa"?B_e():O_e()}),P_e=()=>"Unarchive",F_e=()=>"取消归档",H_e=()=>"خارج کردن از بایگانی",q_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?F_e():t==="fa"?H_e():P_e()}),U_e=()=>"Untitled",G_e=()=>"未命名",W_e=()=>"بدون عنوان",Eg=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?G_e():t==="fa"?W_e():U_e()}),V_e=()=>"Could not update permissions. Try again.",K_e=()=>"无法更新权限。请重试。",Q_e=()=>"به‌روزرسانی مجوزها انجام نشد. دوباره تلاش کنید.",Y_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?K_e():t==="fa"?Q_e():V_e()}),X_e=()=>"Work details",Z_e=()=>"工作详情",J_e=()=>"جزئیات کار",e0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Z_e():t==="fa"?J_e():X_e()}),t0e=e=>`${e==null?void 0:e.minutes}m ${e==null?void 0:e.seconds}s`,n0e=e=>`${e==null?void 0:e.minutes}分${e==null?void 0:e.seconds}秒`,r0e=e=>`${e==null?void 0:e.minutes} دقیقه ${e==null?void 0:e.seconds} ثانیه`,s0e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?n0e(e):t==="fa"?r0e(e):t0e(e)}),i0e=e=>`Worked for ${e==null?void 0:e.duration}`,a0e=e=>`已工作 ${e==null?void 0:e.duration}`,o0e=e=>`به‌مدت ${e==null?void 0:e.duration} کار کرد`,l0e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?a0e(e):t==="fa"?o0e(e):i0e(e)}),c0e=()=>"Working…",u0e=()=>"正在工作…",d0e=()=>"در حال کار…",e6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?u0e():t==="fa"?d0e():c0e()}),f0e=()=>"Close tab",h0e=()=>"关闭标签页",_0e=()=>"بستن زبانه",p0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?h0e():t==="fa"?_0e():f0e()}),m0e=()=>"Changes",g0e=()=>"更改",v0e=()=>"تغییرات",CD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?g0e():t==="fa"?v0e():m0e()}),b0e=()=>"Code browser view",y0e=()=>"代码浏览器视图",x0e=()=>"نمای مرورگر کد",w0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?y0e():t==="fa"?x0e():b0e()}),S0e=()=>"Files",k0e=()=>"文件",C0e=()=>"فایل‌ها",E0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?k0e():t==="fa"?C0e():S0e()}),N0e=()=>"Refresh",z0e=()=>"刷新",j0e=()=>"تازه‌سازی",BE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?z0e():t==="fa"?j0e():N0e()}),T0e=()=>"listing truncated",A0e=()=>"列表已截断",R0e=()=>"فهرست کوتاه شده است",M0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?A0e():t==="fa"?R0e():T0e()}),D0e=()=>"No files.",L0e=()=>"没有文件。",O0e=()=>"فایلی وجود ندارد.",I0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?L0e():t==="fa"?O0e():D0e()}),B0e=()=>"Refresh failed:",$0e=()=>"刷新失败:",P0e=()=>"تازه‌سازی ناموفق بود:",F0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$0e():t==="fa"?P0e():B0e()}),H0e=()=>"Cancelling…",q0e=()=>"正在取消…",U0e=()=>"در حال لغو…",G0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?q0e():t==="fa"?U0e():H0e()}),W0e=()=>"Checking…",V0e=()=>"正在检查…",K0e=()=>"در حال بررسی…",Yi=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?V0e():t==="fa"?K0e():W0e()}),Q0e=()=>"Copied",Y0e=()=>"已复制",X0e=()=>"کپی شد",tp=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Y0e():t==="fa"?X0e():Q0e()}),Z0e=e=>`Failed to load: ${e==null?void 0:e.error}`,J0e=e=>`加载失败:${e==null?void 0:e.error}`,epe=e=>`بارگذاری ناموفق بود: ${e==null?void 0:e.error}`,ED=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?J0e(e):t==="fa"?epe(e):Z0e(e)}),tpe=()=>"Loading…",npe=()=>"正在加载…",rpe=()=>"در حال بارگیری…",ND=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?npe():t==="fa"?rpe():tpe()}),spe=e=>`+ ${e==null?void 0:e.count} more`,ipe=e=>`另有 ${e==null?void 0:e.count} 项`,ape=e=>`${e==null?void 0:e.count}+ مورد دیگر`,ope=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ipe(e):t==="fa"?ape(e):spe(e)}),lpe=()=>"Rendered view",cpe=()=>"渲染视图",upe=()=>"نمای رندرشده",tv=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cpe():t==="fa"?upe():lpe()}),dpe=()=>"Save",fpe=()=>"保存",hpe=()=>"ذخیره",Ho=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fpe():t==="fa"?hpe():dpe()}),_pe=()=>"Saving…",ppe=()=>"正在保存…",mpe=()=>"در حال ذخیره…",ea=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ppe():t==="fa"?mpe():_pe()}),gpe=()=>"Show less",vpe=()=>"收起",bpe=()=>"نمایش کمتر",zD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vpe():t==="fa"?bpe():gpe()}),ype=()=>"Show more",xpe=()=>"展开",wpe=()=>"نمایش بیشتر",Spe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xpe():t==="fa"?wpe():ype()}),kpe=()=>"Stop",Cpe=()=>"停止",Epe=()=>"توقف",jD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cpe():t==="fa"?Epe():kpe()}),Npe=()=>"Stopping…",zpe=()=>"正在停止…",jpe=()=>"در حال توقف…",Tpe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zpe():t==="fa"?jpe():Npe()}),Ape=()=>"View source",Rpe=()=>"查看源代码",Mpe=()=>"نمایش متن منبع",nh=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rpe():t==="fa"?Mpe():Ape()}),Dpe=()=>"Runs as a remote Hugging Face Job",Lpe=()=>"作为远程 Hugging Face Job 运行",Ope=()=>"به‌صورت Hugging Face Job دوردست اجرا می‌شود",Ipe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lpe():t==="fa"?Ope():Dpe()}),Bpe=()=>"Runs as a Job on your Kubernetes cluster",$pe=()=>"作为 Kubernetes 集群上的 Job 运行",Ppe=()=>"به‌صورت Job روی خوشهٔ Kubernetes اجرا می‌شود",Fpe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$pe():t==="fa"?Ppe():Bpe()}),Hpe=()=>"Runs directly on this computer",qpe=()=>"直接在此计算机上运行",Upe=()=>"مستقیماً روی این رایانه اجرا می‌شود",Gpe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qpe():t==="fa"?Upe():Hpe()}),Wpe=()=>"Runs in a remote Modal sandbox",Vpe=()=>"在远程 Modal 沙箱中运行",Kpe=()=>"در sandbox دوردست Modal اجرا می‌شود",Qpe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vpe():t==="fa"?Kpe():Wpe()}),Ype=()=>"Runs on an ephemeral OpenResearch box",Xpe=()=>"在临时 OpenResearch 主机上运行",Zpe=()=>"روی میزبان موقت OpenResearch اجرا می‌شود",Jpe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xpe():t==="fa"?Zpe():Ype()}),eme=()=>"Runs on the connected Ray cluster",tme=()=>"在已连接的 Ray 集群上运行",nme=()=>"روی خوشهٔ متصل Ray اجرا می‌شود",rme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tme():t==="fa"?nme():eme()}),sme=()=>"Runs as a scheduled job on your Slurm cluster",ime=()=>"作为 Slurm 集群上的调度作业运行",ame=()=>"به‌صورت کار زمان‌بندی‌شده روی خوشهٔ Slurm اجرا می‌شود",ome=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ime():t==="fa"?ame():sme()}),lme=()=>"Runs on a host from your SSH config",cme=()=>"在 SSH 配置中的主机上运行",ume=()=>"روی میزبانی از پیکربندی SSH اجرا می‌شود",dme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cme():t==="fa"?ume():lme()}),fme=()=>"Runs through Tinker’s remote compute",hme=()=>"通过 Tinker 远程算力运行",_me=()=>"از طریق رایانش دوردست Tinker اجرا می‌شود",pme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hme():t==="fa"?_me():fme()}),mme=()=>"HF Jobs",gme=()=>"HF Jobs",vme=()=>"HF Jobs",bme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gme():t==="fa"?vme():mme()}),yme=()=>"Kubernetes",xme=()=>"Kubernetes",wme=()=>"Kubernetes",Sme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xme():t==="fa"?wme():yme()}),kme=()=>"This machine",Cme=()=>"此计算机",Eme=()=>"این رایانه",TD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cme():t==="fa"?Eme():kme()}),Nme=()=>"Modal",zme=()=>"Modal",jme=()=>"Modal",Tme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zme():t==="fa"?jme():Nme()}),Ame=()=>"OpenResearch",Rme=()=>"OpenResearch",Mme=()=>"OpenResearch",Dme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rme():t==="fa"?Mme():Ame()}),Lme=()=>"Ray",Ome=()=>"Ray",Ime=()=>"Ray",Bme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ome():t==="fa"?Ime():Lme()}),$me=()=>"Slurm",Pme=()=>"Slurm",Fme=()=>"Slurm",Hme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pme():t==="fa"?Fme():$me()}),qme=()=>"SSH",Ume=()=>"SSH",Gme=()=>"SSH",Wme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ume():t==="fa"?Gme():qme()}),Vme=()=>"Tinker",Kme=()=>"Tinker",Qme=()=>"Tinker",Yme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kme():t==="fa"?Qme():Vme()}),Xme=()=>"A Hugging Face Job runs remotely in your account using the selected hardware. Usage is billed by Hugging Face.",Zme=()=>"Hugging Face Job 使用所选硬件在你的账户中远程运行。费用由 Hugging Face 收取。",Jme=()=>"یک Hugging Face Job با سخت‌افزار انتخاب‌شده در حساب شما از راه دور اجرا می‌شود. هزینه را Hugging Face دریافت می‌کند.",ege=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zme():t==="fa"?Jme():Xme()}),tge=()=>"A Modal sandbox runs remotely in your account using the selected hardware and scales to zero after the run.",nge=()=>"Modal 沙箱使用所选硬件在你的账户中远程运行,并在运行结束后缩容到零。",rge=()=>"یک sandbox از Modal با سخت‌افزار انتخاب‌شده در حساب شما از راه دور اجرا می‌شود و پس از اجرا به صفر مقیاس می‌یابد.",sge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nge():t==="fa"?rge():tge()}),ige=()=>"An ephemeral OpenResearch box runs the experiment, is billed to your organization, and is deleted when the run ends.",age=()=>"临时 OpenResearch 主机运行实验,费用计入你的组织,并在运行结束后删除。",oge=()=>"یک میزبان موقت OpenResearch آزمایش را اجرا می‌کند، هزینه به سازمان شما منظور می‌شود و میزبان پس از پایان حذف می‌گردد.",lge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?age():t==="fa"?oge():ige()}),cge=()=>"This computer must stay awake and online while Tinker runs.",uge=()=>"Tinker 运行时,此计算机必须保持唤醒和联网。",dge=()=>"هنگام اجرای Tinker، این رایانه باید روشن و آنلاین بماند.",fge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uge():t==="fa"?dge():cge()}),hge=()=>"Context window",_ge=()=>"上下文窗口",pge=()=>"پنجرهٔ زمینه",mge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_ge():t==="fa"?pge():hge()}),gge=()=>"Context window used",vge=()=>"已使用的上下文窗口",bge=()=>"پنجرهٔ زمینهٔ استفاده‌شده",yge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vge():t==="fa"?bge():gge()}),xge=e=>`${e==null?void 0:e.value} tokens`,wge=e=>`${e==null?void 0:e.value} 个 token`,Sge=e=>`${e==null?void 0:e.value} توکن`,kge=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?wge(e):t==="fa"?Sge(e):xge(e)}),Cge=e=>`${e==null?void 0:e.used} / ${e==null?void 0:e.total} (${e==null?void 0:e.percent})`,Ege=e=>`${e==null?void 0:e.used} / ${e==null?void 0:e.total}(${e==null?void 0:e.percent})`,Nge=e=>`${e==null?void 0:e.used} از ${e==null?void 0:e.total} (${e==null?void 0:e.percent})`,zge=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Ege(e):t==="fa"?Nge(e):Cge(e)}),jge=()=>"No runs yet — ask the agent to launch one.",Tge=()=>"尚无运行——让智能体启动一个。",Age=()=>"هنوز اجرایی وجود ندارد — از عامل بخواهید یکی را آغاز کند.",Rge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tge():t==="fa"?Age():jge()}),Mge=()=>"Run",Dge=()=>"运行",Lge=()=>"اجرا",$E=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Dge():t==="fa"?Lge():Mge()}),Oge=()=>"Switch run",Ige=()=>"切换运行",Bge=()=>"تغییر اجرا",$ge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ige():t==="fa"?Bge():Oge()}),Pge=e=>`${e==null?void 0:e.days}d ${e==null?void 0:e.hours}h`,Fge=e=>`${e==null?void 0:e.days} 天 ${e==null?void 0:e.hours} 小时`,Hge=e=>`${e==null?void 0:e.days} روز و ${e==null?void 0:e.hours} ساعت`,qge=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Fge(e):t==="fa"?Hge(e):Pge(e)}),Uge=e=>`${e==null?void 0:e.hours}h ${e==null?void 0:e.minutes}m`,Gge=e=>`${e==null?void 0:e.hours} 小时 ${e==null?void 0:e.minutes} 分钟`,Wge=e=>`${e==null?void 0:e.hours} ساعت و ${e==null?void 0:e.minutes} دقیقه`,Vge=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Gge(e):t==="fa"?Wge(e):Uge(e)}),Kge=e=>`${e==null?void 0:e.value}m`,Qge=e=>`${e==null?void 0:e.value} 分钟`,Yge=e=>`${e==null?void 0:e.value} دقیقه`,Xge=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Qge(e):t==="fa"?Yge(e):Kge(e)}),Zge=e=>`${e==null?void 0:e.value}s`,Jge=e=>`${e==null?void 0:e.value} 秒`,e1e=e=>`${e==null?void 0:e.value} ثانیه`,t1e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Jge(e):t==="fa"?e1e(e):Zge(e)}),n1e=()=>"Code",r1e=()=>"代码",s1e=()=>"کد",i1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?r1e():t==="fa"?s1e():n1e()}),a1e=()=>"created",o1e=()=>"创建于",l1e=()=>"ایجادشده",c1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?o1e():t==="fa"?l1e():a1e()}),u1e=()=>"from",d1e=()=>"来自",f1e=()=>"از",h1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?d1e():t==="fa"?f1e():u1e()}),_1e=()=>"Logs",p1e=()=>"日志",m1e=()=>"گزارش‌ها",g1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?p1e():t==="fa"?m1e():_1e()}),v1e=()=>"Latest run",b1e=()=>"最新运行",y1e=()=>"آخرین اجرا",x1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?b1e():t==="fa"?y1e():v1e()}),w1e=()=>"Code",S1e=()=>"代码",k1e=()=>"کد",C1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?S1e():t==="fa"?k1e():w1e()}),E1e=()=>"Commit",N1e=()=>"提交",z1e=()=>"کامیت",j1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?N1e():t==="fa"?z1e():E1e()}),T1e=()=>"created",A1e=()=>"创建于",R1e=()=>"ایجادشده",M1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?A1e():t==="fa"?R1e():T1e()}),D1e=()=>"Description",L1e=()=>"说明",O1e=()=>"توضیحات",I1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?L1e():t==="fa"?O1e():D1e()}),B1e=()=>"Duration",$1e=()=>"时长",P1e=()=>"مدت",F1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$1e():t==="fa"?P1e():B1e()}),H1e=()=>"exit",q1e=()=>"退出码",U1e=()=>"خروج",G1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?q1e():t==="fa"?U1e():H1e()}),W1e=()=>"from",V1e=()=>"来自",K1e=()=>"از",Q1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?V1e():t==="fa"?K1e():W1e()}),Y1e=()=>"Logs",X1e=()=>"日志",Z1e=()=>"گزارش‌ها",J1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?X1e():t==="fa"?Z1e():Y1e()}),eve=()=>"Run",tve=()=>"运行",nve=()=>"اجرا",rve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tve():t==="fa"?nve():eve()}),sve=()=>"Run history",ive=()=>"运行历史",ave=()=>"تاریخچهٔ اجرا",ove=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ive():t==="fa"?ave():sve()}),lve=()=>"Started",cve=()=>"开始时间",uve=()=>"آغاز",dve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cve():t==="fa"?uve():lve()}),fve=()=>"Runs",hve=()=>"运行",_ve=()=>"اجراها",pve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hve():t==="fa"?_ve():fve()}),mve=()=>"Experiments and their runs will appear here. Ask the agent to set up an experiment to get started.",gve=()=>"实验及其运行会显示在这里。让智能体设置一个实验即可开始。",vve=()=>"آزمایش‌ها و اجراهای آن‌ها اینجا نمایش داده می‌شوند. برای شروع، از عامل بخواهید آزمایشی راه‌اندازی کند.",bve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gve():t==="fa"?vve():mve()}),yve=()=>"No runs yet",xve=()=>"还没有运行",wve=()=>"هنوز اجرایی وجود ندارد",Sve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xve():t==="fa"?wve():yve()}),kve=()=>"No experiments yet.",Cve=()=>"还没有实验。",Eve=()=>"هنوز آزمایشی وجود ندارد.",Nve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cve():t==="fa"?Eve():kve()}),zve=()=>"Not run yet",jve=()=>"尚未运行",Tve=()=>"هنوز اجرا نشده",Ave=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jve():t==="fa"?Tve():zve()}),Rve=()=>"1 run",Mve=()=>"1 次运行",Dve=()=>"۱ اجرا",Lve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Mve():t==="fa"?Dve():Rve()}),Ove=()=>"Open logs",Ive=()=>"打开日志",Bve=()=>"باز کردن گزارش‌ها",$ve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ive():t==="fa"?Bve():Ove()}),Pve=e=>`${e==null?void 0:e.count} runs`,Fve=e=>`${e==null?void 0:e.count} 次运行`,Hve=e=>`${e==null?void 0:e.count} اجرا`,qve=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Fve(e):t==="fa"?Hve(e):Pve(e)}),Uve=()=>"Stop requested",Gve=()=>"已请求停止",Wve=()=>"درخواست توقف ثبت شد",Vve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Gve():t==="fa"?Wve():Uve()}),Kve=()=>"Stop run",Qve=()=>"停止运行",Yve=()=>"توقف اجرا",Xve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Qve():t==="fa"?Yve():Kve()}),Zve=()=>"Code",Jve=()=>"代码",ebe=()=>"کد",tbe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Jve():t==="fa"?ebe():Zve()}),nbe=()=>"Experiments",rbe=()=>"实验",sbe=()=>"آزمایش‌ها",ibe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rbe():t==="fa"?sbe():nbe()}),abe=()=>"Logs",obe=()=>"日志",lbe=()=>"گزارش‌ها",cbe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?obe():t==="fa"?lbe():abe()}),ube=()=>"Stop failed:",dbe=()=>"停止失败:",fbe=()=>"توقف ناموفق بود:",hbe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dbe():t==="fa"?fbe():ube()}),_be=()=>"Clipboard access is unavailable.",pbe=()=>"无法访问剪贴板。",mbe=()=>"دسترسی به کلیپ‌بورد در دسترس نیست.",AD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pbe():t==="fa"?mbe():_be()}),gbe=e=>`Delete “${e==null?void 0:e.path}”? This cannot be undone.`,vbe=e=>`删除“${e==null?void 0:e.path}”?此操作无法撤销。`,bbe=e=>`«${e==null?void 0:e.path}» حذف شود؟ این کار قابل بازگشت نیست.`,ybe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?vbe(e):t==="fa"?bbe(e):gbe(e)}),xbe=()=>"Duplicate",wbe=()=>"创建副本",Sbe=()=>"ایجاد نسخهٔ تکراری",kbe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wbe():t==="fa"?Sbe():xbe()}),Cbe=e=>`File actions for ${e==null?void 0:e.path}`,Ebe=e=>`${e==null?void 0:e.path} 的文件操作`,Nbe=e=>`عملیات فایل برای ${e==null?void 0:e.path}`,zbe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Ebe(e):t==="fa"?Nbe(e):Cbe(e)}),jbe=()=>"Open",Tbe=()=>"打开",Abe=()=>"باز کردن",Rbe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tbe():t==="fa"?Abe():jbe()}),Mbe=e=>`Rename ${e==null?void 0:e.path}`,Dbe=e=>`重命名 ${e==null?void 0:e.path}`,Lbe=e=>`تغییر نام ${e==null?void 0:e.path}`,Obe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Dbe(e):t==="fa"?Lbe(e):Mbe(e)}),Ibe=e=>`Not in the ${e==null?void 0:e.root} — showing the copy from the project’s artifacts.`,Bbe=e=>`${e==null?void 0:e.root} 中没有该文件——当前显示项目产物中的副本。`,$be=e=>`فایل در ${e==null?void 0:e.root} نیست — نسخهٔ موجود در خروجی‌های پروژه نمایش داده می‌شود.`,Pbe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Bbe(e):t==="fa"?$be(e):Ibe(e)}),Fbe=()=>"Binary file — no inline preview.",Hbe=()=>"二进制文件——无法内嵌预览。",qbe=()=>"فایل دودویی است — پیش‌نمایش درون‌خطی ندارد.",Ube=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hbe():t==="fa"?qbe():Fbe()}),Gbe=()=>"This file changed on disk. Your edits have not been overwritten.",Wbe=()=>"此文件已在磁盘上更改。您的编辑未被覆盖。",Vbe=()=>"این فایل روی دیسک تغییر کرده است. ویرایش‌های شما جایگزین نشده‌اند.",PE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wbe():t==="fa"?Vbe():Gbe()}),Kbe=()=>"Compile failed",Qbe=()=>"编译失败",Ybe=()=>"کامپایل ناموفق بود",Xbe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Qbe():t==="fa"?Ybe():Kbe()}),Zbe=()=>"Compile PDF",Jbe=()=>"编译 PDF",eye=()=>"کامپایل PDF",FE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Jbe():t==="fa"?eye():Zbe()}),tye=()=>"Compiled, but the engine reported errors — check the output below.",nye=()=>"编译已完成,但引擎报告了错误 — 请查看下方输出。",rye=()=>"کامپایل انجام شد، اما موتور خطا گزارش کرد — خروجی پایین را بررسی کنید.",sye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nye():t==="fa"?rye():tye()}),iye=()=>"Copy command",aye=()=>"复制命令",oye=()=>"کپی فرمان",lye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aye():t==="fa"?oye():iye()}),cye=()=>"Copy install command",uye=()=>"复制安装命令",dye=()=>"کپی فرمان نصب",fye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uye():t==="fa"?dye():cye()}),hye=()=>"This file was deleted on disk. Your edits have not been discarded.",_ye=()=>"此文件已从磁盘删除。您的编辑未被丢弃。",pye=()=>"این فایل از روی دیسک حذف شده است. ویرایش‌های شما حذف نشده‌اند.",HE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_ye():t==="fa"?pye():hye()}),mye=()=>"Discard my edits and reload",gye=()=>"放弃我的编辑并重新加载",vye=()=>"نادیده گرفتن ویرایش‌های من و بارگیری دوباره",bye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gye():t==="fa"?vye():mye()}),yye=()=>"Discard unsaved changes and close this file?",xye=()=>"要丢弃未保存的更改并关闭此文件吗?",wye=()=>"تغییرات ذخیره‌نشده حذف و فایل بسته شود؟",qE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xye():t==="fa"?wye():yye()}),Sye=()=>"Dismiss",kye=()=>"关闭",Cye=()=>"بستن",Eye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kye():t==="fa"?Cye():Sye()}),Nye=()=>"Dismiss compile message",zye=()=>"关闭编译消息",jye=()=>"بستن پیام کامپایل",Tye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zye():t==="fa"?jye():Nye()}),Aye=()=>"Dismiss Overleaf message",Rye=()=>"关闭 Overleaf 消息",Mye=()=>"بستن پیام Overleaf",Dye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rye():t==="fa"?Mye():Aye()}),Lye=()=>"Download",Oye=()=>"下载",Iye=()=>"بارگیری",RD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Oye():t==="fa"?Iye():Lye()}),Bye=e=>`Download ${e==null?void 0:e.name} (out of date — recompile first)`,$ye=e=>`下载 ${e==null?void 0:e.name}(版本过旧 — 请先重新编译)`,Pye=e=>`دانلود ${e==null?void 0:e.name} (قدیمی است — ابتدا دوباره کامپایل کنید)`,Fye=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?$ye(e):t==="fa"?Pye(e):Bye(e)}),Hye=()=>"Failed to load file:",qye=()=>"加载文件失败:",Uye=()=>"بارگیری فایل ناموفق بود:",UE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qye():t==="fa"?Uye():Hye()}),Gye=()=>"File truncated — showing the first 512 KB.",Wye=()=>"文件已截断——仅显示前 512 KB。",Vye=()=>"فایل کوتاه شده است — فقط ۵۱۲ کیلوبایت نخست نمایش داده می‌شود.",Kye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wye():t==="fa"?Vye():Gye()}),Qye=()=>"The page below stops partway — the full file could not be loaded.",Yye=()=>"下方页面在中途结束——无法加载完整文件。",Xye=()=>"صفحهٔ زیر در میانه متوقف می‌شود — فایل کامل بارگیری نشد.",Zye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Yye():t==="fa"?Xye():Qye()}),Jye=e=>`Rendered HTML: ${e==null?void 0:e.name}`,e2e=e=>`已渲染的 HTML:${e==null?void 0:e.name}`,t2e=e=>`HTML رندرشده: ${e==null?void 0:e.name}`,n2e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?e2e(e):t==="fa"?t2e(e):Jye(e)}),r2e=()=>"Loading…",s2e=()=>"正在加载…",i2e=()=>"در حال بارگیری…",MD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?s2e():t==="fa"?i2e():r2e()}),a2e=()=>"File not found.",o2e=()=>"找不到文件。",l2e=()=>"فایل پیدا نشد.",c2e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?o2e():t==="fa"?l2e():a2e()}),u2e=e=>`File not found in the project’s artifacts or the ${e==null?void 0:e.root}.`,d2e=e=>`在项目产物或${e==null?void 0:e.root}中找不到此文件。`,f2e=e=>`فایل در خروجی‌های پروژه یا ${e==null?void 0:e.root} پیدا نشد.`,h2e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?d2e(e):t==="fa"?f2e(e):u2e(e)}),_2e=e=>`File not found on branch ${e==null?void 0:e.branch}.`,p2e=e=>`在分支 ${e==null?void 0:e.branch} 上找不到此文件。`,m2e=e=>`فایل در شاخهٔ ${e==null?void 0:e.branch} پیدا نشد.`,g2e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?p2e(e):t==="fa"?m2e(e):_2e(e)}),v2e=()=>"File not found on disk.",b2e=()=>"磁盘上找不到此文件。",y2e=()=>"فایل روی دیسک پیدا نشد.",x2e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?b2e():t==="fa"?y2e():v2e()}),w2e=e=>`File not found in the ${e==null?void 0:e.root} or the project’s artifacts.`,S2e=e=>`在${e==null?void 0:e.root}或项目产物中找不到此文件。`,k2e=e=>`فایل در ${e==null?void 0:e.root} یا خروجی‌های پروژه پیدا نشد.`,C2e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?S2e(e):t==="fa"?k2e(e):w2e(e)}),E2e=e=>`Not in the project’s artifacts — showing the copy from the ${e==null?void 0:e.root}.`,N2e=e=>`项目产物中没有此文件 — 正在显示${e==null?void 0:e.root}中的副本。`,z2e=e=>`در خروجی‌های پروژه نیست — نسخهٔ موجود در ${e==null?void 0:e.root} نمایش داده می‌شود.`,j2e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?N2e(e):t==="fa"?z2e(e):E2e(e)}),T2e=()=>"Open in default editor",A2e=()=>"在默认编辑器中打开",R2e=()=>"باز کردن در ویرایشگر پیش‌فرض",GE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?A2e():t==="fa"?R2e():T2e()}),M2e=()=>"Overleaf's copy of this file was pulled while you had unsaved edits, so what you see is no longer what is on disk. Saving now sends this draft to Overleaf instead.",D2e=()=>"你有未保存的编辑时,Overleaf 上的文件副本被拉取,因此当前内容已与磁盘不同。现在保存会将此草稿发送到 Overleaf。",L2e=()=>"هنگامی که ویرایش‌های ذخیره‌نشده داشتید، نسخهٔ Overleaf این فایل دریافت شد؛ بنابراین آنچه می‌بینید دیگر با فایل روی دیسک یکی نیست. ذخیره‌سازی اکنون این پیش‌نویس را به Overleaf می‌فرستد.",O2e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?D2e():t==="fa"?L2e():M2e()}),I2e=()=>"Overwrite disk file",B2e=()=>"覆盖磁盘文件",$2e=()=>"بازنویسی فایل روی دیسک",P2e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?B2e():t==="fa"?$2e():I2e()}),F2e=()=>"Compiled PDF is out of date",H2e=()=>"已编译的 PDF 不是最新版本",q2e=()=>"PDF کامپایل‌شده به‌روز نیست",U2e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?H2e():t==="fa"?q2e():F2e()}),G2e=()=>"project clone",W2e=()=>"项目克隆",V2e=()=>"کلون پروژه",Ng=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?W2e():t==="fa"?V2e():G2e()}),K2e=()=>"Recompile PDF",Q2e=()=>"重新编译 PDF",Y2e=()=>"کامپایل دوبارهٔ PDF",WE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Q2e():t==="fa"?Y2e():K2e()}),X2e=()=>"Reload from disk",Z2e=()=>"从磁盘重新加载",J2e=()=>"بارگذاری مجدد از دیسک",exe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Z2e():t==="fa"?J2e():X2e()}),txe=()=>"Save failed",nxe=()=>"保存失败",rxe=()=>"ذخیره ناموفق بود",sxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nxe():t==="fa"?rxe():txe()}),ixe=()=>"Saving…",axe=()=>"正在保存…",oxe=()=>"در حال ذخیره…",lxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?axe():t==="fa"?oxe():ixe()}),cxe=()=>"Selected — press ⌘C",uxe=()=>"已选中 — 按 ⌘C 复制",dxe=()=>"انتخاب شد — برای کپی ⌘C را بزنید",fxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uxe():t==="fa"?dxe():cxe()}),hxe=()=>"session’s worktree",_xe=()=>"会话工作树",pxe=()=>"درخت کاری نشست",zg=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_xe():t==="fa"?pxe():hxe()}),mxe=()=>"Show compiled PDF",gxe=()=>"显示已编译的 PDF",vxe=()=>"نمایش PDF کامپایل‌شده",VE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gxe():t==="fa"?vxe():mxe()}),bxe=()=>"This PDF was compiled from an earlier version of the source — recompile to update it.",yxe=()=>"此 PDF 由较早版本的源文件编译而成——请重新编译以更新。",xxe=()=>"این PDF از نسخه‌ای قدیمی‌تر از منبع ساخته شده است — برای به‌روزرسانی دوباره کامپایل کنید.",wxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yxe():t==="fa"?xxe():bxe()}),Sxe=()=>"This session's worktree isn't available — showing the project clone's copy.",kxe=()=>"此会话的工作树不可用——当前显示项目克隆中的副本。",Cxe=()=>"درخت کاری این نشست در دسترس نیست — نسخهٔ کلون پروژه نمایش داده می‌شود.",Exe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kxe():t==="fa"?Cxe():Sxe()}),Nxe=()=>"Unsaved",zxe=()=>"未保存",jxe=()=>"ذخیره نشده",DD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zxe():t==="fa"?jxe():Nxe()}),Txe=()=>"Unsaved — ⌘S to save",Axe=()=>"未保存 — 按 ⌘S 保存",Rxe=()=>"ذخیره نشده — برای ذخیره ⌘S را بزنید",Mxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Axe():t==="fa"?Rxe():Txe()}),Dxe=()=>"Update orx on the remote machine to edit this file safely.",Lxe=()=>"请更新远程计算机上的 orx,以安全编辑此文件。",Oxe=()=>"برای ویرایش ایمن این فایل، orx را روی دستگاه ریموت به‌روز کنید.",Ixe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lxe():t==="fa"?Oxe():Dxe()}),Bxe=()=>"This session’s worktree isn’t available, and the file isn’t in the project clone or its artifacts.",$xe=()=>"此会话的工作树不可用,项目克隆和产物中也没有此文件。",Pxe=()=>"درخت کاری این نشست در دسترس نیست و فایل در نسخهٔ محلی پروژه یا خروجی‌های آن هم پیدا نشد.",Fxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$xe():t==="fa"?Pxe():Bxe()}),Hxe=()=>"Files in this workspace will appear here. Ask the agent to create a file to get started.",qxe=()=>"此工作区中的文件会显示在这里。让智能体创建一个文件即可开始。",Uxe=()=>"فایل‌های این فضای کاری اینجا نمایش داده می‌شوند. برای شروع، از عامل بخواهید فایلی ایجاد کند.",Gxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qxe():t==="fa"?Uxe():Hxe()}),Wxe=()=>"Back to preview",Vxe=()=>"返回预览",Kxe=()=>"بازگشت به پیش‌نمایش",Qxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vxe():t==="fa"?Kxe():Wxe()}),Yxe=e=>`${e==null?void 0:e.count} changed files`,Xxe=e=>`${e==null?void 0:e.count} 个已更改文件`,Zxe=e=>`${e==null?void 0:e.count} فایل تغییرکرده`,LD=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Xxe(e):t==="fa"?Zxe(e):Yxe(e)}),Jxe=()=>"Changed files",ewe=()=>"已更改文件",twe=()=>"فایل‌های تغییرکرده",nwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ewe():t==="fa"?twe():Jxe()}),rwe=()=>"Diff preview truncated",swe=()=>"差异预览已截断",iwe=()=>"پیش‌نمایش تفاوت کوتاه شده است",awe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?swe():t==="fa"?iwe():rwe()}),owe=e=>`${e==null?void 0:e.count} files shown (partial)`,lwe=e=>`显示 ${e==null?void 0:e.count} 个文件(部分)`,cwe=e=>`${e==null?void 0:e.count} فایل نمایش داده شده (ناقص)`,uwe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?lwe(e):t==="fa"?cwe(e):owe(e)}),dwe=()=>"No changes.",fwe=()=>"没有更改。",hwe=()=>"تغییری وجود ندارد.",_we=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fwe():t==="fa"?hwe():dwe()}),pwe=()=>"No complete file preview was available before the cutoff.",mwe=()=>"在截断位置之前没有完整的文件预览。",gwe=()=>"پیش از نقطهٔ برش، پیش‌نمایش کاملی از هیچ فایلی موجود نبود.",vwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mwe():t==="fa"?gwe():pwe()}),bwe=()=>"No textual diff for this file.",ywe=()=>"此文件没有文本差异。",xwe=()=>"برای این فایل تفاوت متنی وجود ندارد.",wwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ywe():t==="fa"?xwe():bwe()}),Swe=()=>"1 changed file",kwe=()=>"1 个已更改文件",Cwe=()=>"۱ فایل تغییرکرده",OD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kwe():t==="fa"?Cwe():Swe()}),Ewe=()=>"1 file shown (partial)",Nwe=()=>"显示 1 个文件(部分)",zwe=()=>"۱ فایل نمایش داده شده (ناقص)",jwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nwe():t==="fa"?zwe():Ewe()}),Twe=()=>"Unable to parse this diff.",Awe=()=>"无法解析此差异。",Rwe=()=>"خواندن این تفاوت ممکن نبود.",Mwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Awe():t==="fa"?Rwe():Twe()}),Dwe=e=>`Showing the first ${e==null?void 0:e.limit} (${e==null?void 0:e.read} read). View the complete diff locally with git.`,Lwe=e=>`正在显示前 ${e==null?void 0:e.limit}(已读取 ${e==null?void 0:e.read})。请在本地使用 git 查看完整差异。`,Owe=e=>`نخستین ${e==null?void 0:e.limit} نمایش داده می‌شود (${e==null?void 0:e.read} خوانده شد). تفاوت کامل را با git به‌صورت محلی ببینید.`,Iwe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Lwe(e):t==="fa"?Owe(e):Dwe(e)}),Bwe=()=>"View full diff",$we=()=>"查看完整差异",Pwe=()=>"نمایش تفاوت کامل",Fwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$we():t==="fa"?Pwe():Bwe()}),Hwe=()=>"Create a token ↗",qwe=()=>"创建令牌 ↗",Uwe=()=>"ساخت توکن ↗",Gwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qwe():t==="fa"?Uwe():Hwe()}),Wwe=()=>"All projects",Vwe=()=>"所有项目",Kwe=()=>"همهٔ پروژه‌ها",KE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vwe():t==="fa"?Kwe():Wwe()}),Qwe=()=>"Configure Repository",Ywe=()=>"配置仓库",Xwe=()=>"پیکربندی مخزن",Zwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ywe():t==="fa"?Xwe():Qwe()}),Jwe=()=>"Create a new project",e4e=()=>"新建项目",t4e=()=>"ایجاد پروژهٔ جدید",n4e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?e4e():t==="fa"?t4e():Jwe()}),r4e=()=>"Hide sidebar",s4e=()=>"隐藏侧边栏",i4e=()=>"پنهان کردن نوار کناری",QE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?s4e():t==="fa"?i4e():r4e()}),a4e=()=>"Project",o4e=()=>"项目",l4e=()=>"پروژه",c4e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?o4e():t==="fa"?l4e():a4e()}),u4e=e=>`${e==null?void 0:e.count} cancelled`,d4e=e=>`${e==null?void 0:e.count} 次取消`,f4e=e=>`${e==null?void 0:e.count} لغوشده`,h4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?d4e(e):t==="fa"?f4e(e):u4e(e)}),_4e=e=>`${e==null?void 0:e.count} done`,p4e=e=>`${e==null?void 0:e.count} 次完成`,m4e=e=>`${e==null?void 0:e.count} تمام‌شده`,g4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?p4e(e):t==="fa"?m4e(e):_4e(e)}),v4e=e=>`${e==null?void 0:e.count} failed`,b4e=e=>`${e==null?void 0:e.count} 次失败`,y4e=e=>`${e==null?void 0:e.count} ناموفق`,x4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?b4e(e):t==="fa"?y4e(e):v4e(e)}),w4e=e=>`${e==null?void 0:e.count} files`,S4e=e=>`${e==null?void 0:e.count} 个文件`,k4e=e=>`${e==null?void 0:e.count} فایل`,C4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?S4e(e):t==="fa"?k4e(e):w4e(e)}),E4e=e=>`${e==null?void 0:e.count}+ files`,N4e=e=>`至少 ${e==null?void 0:e.count} 个文件`,z4e=e=>`بیش از ${e==null?void 0:e.count} فایل`,j4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?N4e(e):t==="fa"?z4e(e):E4e(e)}),T4e=e=>`${e==null?void 0:e.count} live`,A4e=e=>`${e==null?void 0:e.count} 次进行中`,R4e=e=>`${e==null?void 0:e.count} فعال`,M4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?A4e(e):t==="fa"?R4e(e):T4e(e)}),D4e=()=>"1 file",L4e=()=>"1 个文件",O4e=()=>"۱ فایل",I4e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?L4e():t==="fa"?O4e():D4e()}),B4e=()=>"1 run",$4e=()=>"1 次运行",P4e=()=>"۱ اجرا",F4e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$4e():t==="fa"?P4e():B4e()}),H4e=e=>`${e==null?void 0:e.count} runs`,q4e=e=>`${e==null?void 0:e.count} 次运行`,U4e=e=>`${e==null?void 0:e.count} اجرا`,G4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?q4e(e):t==="fa"?U4e(e):H4e(e)}),W4e=()=>"No instances yet.",V4e=()=>"还没有实例。",K4e=()=>"هنوز نمونه‌ای وجود ندارد.",Q4e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?V4e():t==="fa"?K4e():W4e()}),Y4e=()=>"Nothing running right now.",X4e=()=>"当前没有运行中的实例。",Z4e=()=>"اکنون چیزی در حال اجرا نیست.",J4e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?X4e():t==="fa"?Z4e():Y4e()}),e3e=()=>"Select a project to see its history.",t3e=()=>"请选择一个项目以查看其历史记录。",n3e=()=>"برای دیدن تاریخچه یک پروژه انتخاب کنید.",r3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?t3e():t==="fa"?n3e():e3e()}),s3e=()=>"Select a project to see its runs.",i3e=()=>"请选择一个项目以查看其运行。",a3e=()=>"برای دیدن اجراها یک پروژه انتخاب کنید.",o3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?i3e():t==="fa"?a3e():s3e()}),l3e=()=>"View history",c3e=()=>"查看历史记录",u3e=()=>"مشاهدهٔ تاریخچه",d3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?c3e():t==="fa"?u3e():l3e()}),f3e=e=>`View history (${e==null?void 0:e.count})`,h3e=e=>`查看历史记录(${e==null?void 0:e.count})`,_3e=e=>`مشاهدهٔ تاریخچه (${e==null?void 0:e.count})`,p3e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?h3e(e):t==="fa"?_3e(e):f3e(e)}),m3e=()=>"The engine exited without producing a PDF or a log.",g3e=()=>"引擎已退出,但没有生成 PDF 或日志。",v3e=()=>"موتور بدون تولید PDF یا گزارش خارج شد.",b3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?g3e():t==="fa"?v3e():m3e()}),y3e=()=>"Loading…",x3e=()=>"正在加载…",w3e=()=>"در حال بارگیری…",S3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?x3e():t==="fa"?w3e():y3e()}),k3e=()=>"Add local model",C3e=()=>"添加本地模型",E3e=()=>"افزودن مدل محلی",ID=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?C3e():t==="fa"?E3e():k3e()}),N3e=()=>"Local server address",z3e=()=>"本地服务器地址",j3e=()=>"نشانی سرور محلی",T3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?z3e():t==="fa"?j3e():N3e()}),A3e=()=>"Find models",R3e=()=>"查找模型",M3e=()=>"یافتن مدل‌ها",D3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?R3e():t==="fa"?M3e():A3e()}),L3e=()=>"(OpenAI compatible)",O3e=()=>"(兼容 OpenAI)",I3e=()=>"(سازگار با OpenAI)",BD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?O3e():t==="fa"?I3e():L3e()}),B3e=()=>"Saved, but OpenCode did not list this model. Check installed agents again. If your OpenCode config restricts enabled providers, allow this connection before using it.",$3e=()=>"已保存,但 OpenCode 未列出该模型。请重新检查已安装的智能体。如果 OpenCode 配置限制了启用的提供商,请先允许此连接。",P3e=()=>"ذخیره شد، اما OpenCode این مدل را فهرست نکرد. عامل‌های نصب‌شده را دوباره بررسی کنید. اگر پیکربندی OpenCode ارائه‌دهندگان فعال را محدود کرده، ابتدا این اتصال را مجاز کنید.",F3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$3e():t==="fa"?P3e():B3e()}),H3e=()=>"Connected",q3e=()=>"已连接",U3e=()=>"متصل شد",G3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?q3e():t==="fa"?U3e():H3e()}),W3e=()=>"Context window",V3e=()=>"上下文窗口",K3e=()=>"پنجرهٔ زمینه",Q3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?V3e():t==="fa"?K3e():W3e()}),Y3e=()=>"Match the context window loaded in your model app. 32K is a useful starting point for tools; larger contexts use more memory.",X3e=()=>"请与模型应用中加载的上下文窗口保持一致。使用工具时可从 32K 开始;更大的上下文需要更多内存。",Z3e=()=>"اندازهٔ زمینه را با تنظیم بارگذاری‌شده در برنامهٔ مدل هماهنگ کنید. ۳۲هزار توکن نقطهٔ شروع مناسبی برای ابزارهاست؛ زمینهٔ بزرگ‌تر حافظهٔ بیشتری مصرف می‌کند.",J3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?X3e():t==="fa"?Z3e():Y3e()}),e5e=()=>"Custom Endpoint",t5e=()=>"自定义端点",n5e=()=>"نقطهٔ اتصال سفارشی",t6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?t5e():t==="fa"?n5e():e5e()}),r5e=e=>`Disconnect ${e==null?void 0:e.name}`,s5e=e=>`断开 ${e==null?void 0:e.name}`,i5e=e=>`قطع اتصال ${e==null?void 0:e.name}`,a5e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?s5e(e):t==="fa"?i5e(e):r5e(e)}),o5e=()=>"Get OpenCode",l5e=()=>"获取 OpenCode",c5e=()=>"دریافت OpenCode",u5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?l5e():t==="fa"?c5e():o5e()}),d5e=()=>"Install OpenCode to run tools with your local model, then re-check installed agents. No cloud account is required.",f5e=()=>"安装 OpenCode 以使用本地模型执行工具,然后重新检查已安装的智能体。无需云端账户。",h5e=()=>"برای اجرای ابزارها با مدل محلی، OpenCode را نصب کنید و عامل‌های نصب‌شده را دوباره بررسی کنید. حساب ابری لازم نیست.",_5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?f5e():t==="fa"?h5e():d5e()}),p5e=()=>"API key (optional)",m5e=()=>"API 密钥(可选)",g5e=()=>"کلید API (اختیاری)",v5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?m5e():t==="fa"?g5e():p5e()}),b5e=()=>"Save model",y5e=()=>"保存模型",x5e=()=>"ذخیرهٔ مدل",w5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?y5e():t==="fa"?x5e():b5e()}),S5e=()=>"Model server",k5e=()=>"模型服务器",C5e=()=>"سرور مدل",YE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?k5e():t==="fa"?C5e():S5e()}),E5e=()=>"Local models",N5e=()=>"本地模型",z5e=()=>"مدل‌های محلی",XE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?N5e():t==="fa"?z5e():E5e()}),j5e=()=>"API token (optional)",T5e=()=>"API 令牌(可选)",A5e=()=>"توکن API (اختیاری)",R5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?T5e():t==="fa"?A5e():j5e()}),M5e=()=>"Copy",D5e=()=>"复制",L5e=()=>"کپی",n6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?D5e():t==="fa"?L5e():M5e()}),O5e=()=>"Copy code",I5e=()=>"复制代码",B5e=()=>"کپی کد",$5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?I5e():t==="fa"?B5e():O5e()}),P5e=()=>"Download",F5e=()=>"下载",H5e=()=>"بارگیری",$D=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?F5e():t==="fa"?H5e():P5e()}),q5e=()=>"This browser can’t preview this media format.",U5e=()=>"此浏览器无法预览该媒体格式。",G5e=()=>"این مرورگر نمی‌تواند این قالب رسانه را پیش‌نمایش کند.",W5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?U5e():t==="fa"?G5e():q5e()}),V5e=()=>"Add Local Model",K5e=()=>"添加本地模型",Q5e=()=>"افزودن مدل محلی",Y5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?K5e():t==="fa"?Q5e():V5e()}),X5e=()=>" · CLI configuration",Z5e=()=>" · CLI 配置",J5e=()=>" · پیکربندی CLI",PD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Z5e():t==="fa"?J5e():X5e()}),e6e=()=>"· Default",t6e=()=>"· 默认",n6e=()=>"· پیش‌فرض",FD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?t6e():t==="fa"?n6e():e6e()}),r6e=()=>"Default model",s6e=()=>"默认模型",i6e=()=>"مدل پیش‌فرض",ZE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?s6e():t==="fa"?i6e():r6e()}),a6e=()=>"Detecting harnesses…",o6e=()=>"正在检测智能体工具…",l6e=()=>"در حال شناسایی ابزارهای عامل…",c6e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?o6e():t==="fa"?l6e():a6e()}),u6e=()=>"Effort",d6e=()=>"推理强度",f6e=()=>"میزان استدلال",h6e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?d6e():t==="fa"?f6e():u6e()}),_6e=()=>"Fast speed ·",p6e=()=>"快速 ·",m6e=()=>"سرعت بالا ·",g6e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?p6e():t==="fa"?m6e():_6e()}),v6e=()=>"Mode",b6e=()=>"模式",y6e=()=>"حالت",JE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?b6e():t==="fa"?y6e():v6e()}),x6e=()=>"Model",w6e=()=>"模型",S6e=()=>"مدل",L0=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?w6e():t==="fa"?S6e():x6e()}),k6e=e=>`${e==null?void 0:e.count} more — search to find`,C6e=e=>`还有 ${e==null?void 0:e.count} 个——搜索即可查找`,E6e=e=>`${e==null?void 0:e.count} مورد دیگر — برای یافتن جست‌وجو کنید`,N6e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?C6e(e):t==="fa"?E6e(e):k6e(e)}),z6e=()=>"Not available",j6e=()=>"不可用",T6e=()=>"در دسترس نیست",A6e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?j6e():t==="fa"?T6e():z6e()}),R6e=()=>"Search models…",M6e=()=>"搜索模型…",D6e=()=>"جست‌وجوی مدل‌ها…",HD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?M6e():t==="fa"?D6e():R6e()}),L6e=()=>"Sessions keep their harness. Start a new chat to switch.",O6e=()=>"会话将沿用当前的智能体工具。新建聊天即可切换。",I6e=()=>"نشست‌ها ابزار عامل خود را نگه می‌دارند. برای تغییر، گفتگوی جدیدی بسازید",B6e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?O6e():t==="fa"?I6e():L6e()}),$6e=()=>"Speed",P6e=()=>"速度",F6e=()=>"سرعت",eN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?P6e():t==="fa"?F6e():$6e()}),H6e=()=>"Unavailable",q6e=()=>"不可用",U6e=()=>"در دسترس نیست",Ya=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?q6e():t==="fa"?U6e():H6e()}),G6e=e=>`Use “${e==null?void 0:e.id}” as the model ID`,W6e=e=>`使用“${e==null?void 0:e.id}”作为模型 ID`,V6e=e=>`از «${e==null?void 0:e.id}» به‌عنوان شناسهٔ مدل استفاده کنید`,K6e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?W6e(e):t==="fa"?V6e(e):G6e(e)}),Q6e=()=>"Variant",Y6e=()=>"变体",X6e=()=>"گونه",Z6e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Y6e():t==="fa"?X6e():Q6e()}),J6e=()=>"Advanced",eSe=()=>"高级",tSe=()=>"پیشرفته",nSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eSe():t==="fa"?tSe():J6e()}),rSe=()=>"Advanced · Connect GitHub",sSe=()=>"高级 · 连接 GitHub",iSe=()=>"پیشرفته · اتصال GitHub",aSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sSe():t==="fa"?iSe():rSe()}),oSe=()=>"Advanced · GitHub sync on",lSe=()=>"高级 · GitHub 同步已开启",cSe=()=>"پیشرفته · همگام‌سازی GitHub روشن است",uSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lSe():t==="fa"?cSe():oSe()}),dSe=()=>"Choose a different destination. A paper project needs a new or empty folder of its own.",fSe=()=>"请选择其他位置。论文项目需要拥有独立的新文件夹或空文件夹。",hSe=()=>"مقصد دیگری انتخاب کنید. پروژهٔ مقاله باید پوشهٔ جدید یا خالیِ جداگانه‌ای داشته باشد.",_Se=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fSe():t==="fa"?hSe():dSe()}),pSe=e=>`Change project folder; current folder: ${e==null?void 0:e.path}`,mSe=e=>`更改项目文件夹;当前文件夹:${e==null?void 0:e.path}`,gSe=e=>`تغییر پوشهٔ پروژه؛ پوشهٔ کنونی: ${e==null?void 0:e.path}`,vSe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?mSe(e):t==="fa"?gSe(e):pSe(e)}),bSe=()=>"Choose an existing project folder",ySe=()=>"选择现有项目文件夹",xSe=()=>"انتخاب پوشهٔ موجود پروژه",tN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ySe():t==="fa"?xSe():bSe()}),wSe=()=>"Choosing…",SSe=()=>"正在选择…",kSe=()=>"در حال انتخاب…",CSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?SSe():t==="fa"?kSe():wSe()}),ESe=()=>"Clone destination",NSe=()=>"克隆位置",zSe=()=>"مقصد کلون",jSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?NSe():t==="fa"?zSe():ESe()}),TSe=()=>"Clone paper project",ASe=()=>"克隆论文项目",RSe=()=>"کلون پروژهٔ مقاله",MSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ASe():t==="fa"?RSe():TSe()}),DSe=()=>"Create project",LSe=()=>"创建项目",OSe=()=>"ایجاد پروژه",nN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LSe():t==="fa"?OSe():DSe()}),ISe=()=>"Creating…",BSe=()=>"正在创建…",$Se=()=>"در حال ایجاد…",PSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BSe():t==="fa"?$Se():ISe()}),FSe=()=>"Choose a different destination. This path is a file, not a folder.",HSe=()=>"请选择其他位置。此路径是文件,不是文件夹。",qSe=()=>"مقصد دیگری انتخاب کنید. این مسیر فایل است، نه پوشه.",wx=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HSe():t==="fa"?qSe():FSe()}),USe=()=>"A folder already exists here. Choose a different name or location, or use Existing folder.",GSe=()=>"此处已有文件夹。请选择其他名称或位置,或使用“现有文件夹”。",WSe=()=>"پوشه‌ای در این محل وجود دارد. نام یا محل دیگری انتخاب کنید، یا از «پوشهٔ موجود» استفاده کنید.",rN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?GSe():t==="fa"?WSe():USe()}),VSe=()=>"Blank project",KSe=()=>"空白项目",QSe=()=>"پروژهٔ خالی",YSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KSe():t==="fa"?QSe():VSe()}),XSe=()=>"Cancel",ZSe=()=>"取消",JSe=()=>"لغو",eke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ZSe():t==="fa"?JSe():XSe()}),tke=()=>"Change",nke=()=>"更改",rke=()=>"تغییر",ske=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nke():t==="fa"?rke():tke()}),ike=()=>"Change selected paper",ake=()=>"更改所选论文",oke=()=>"تغییر مقالهٔ انتخاب‌شده",lke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ake():t==="fa"?oke():ike()}),cke=()=>"Check out a Git branch before using this folder.",uke=()=>"使用此文件夹前,请先检出一个 Git 分支。",dke=()=>"پیش از استفاده از این پوشه، یک شاخهٔ Git را checkout کنید.",fke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uke():t==="fa"?dke():cke()}),hke=()=>"Checking project location.",_ke=()=>"正在检查项目位置。",pke=()=>"در حال بررسی محل پروژه.",sN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_ke():t==="fa"?pke():hke()}),mke=()=>"Existing folder",gke=()=>"现有文件夹",vke=()=>"پوشهٔ موجود",bke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gke():t==="fa"?vke():mke()}),yke=()=>"Experiment branches will be pushed to the remote GitHub repository.",xke=()=>"实验分支将推送到远程 GitHub 仓库。",wke=()=>"شاخه‌های آزمایش به مخزن دوردست GitHub فرستاده می‌شوند.",Ske=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xke():t==="fa"?wke():yke()}),kke=()=>"From a paper",Cke=()=>"从论文创建",Eke=()=>"از یک مقاله",Nke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cke():t==="fa"?Eke():kke()}),zke=()=>"Git is required for experiments but is not installed. Install Git, then restart OpenResearch.",jke=()=>"实验需要 Git,但尚未安装。请安装 Git,然后重新启动 OpenResearch。",Tke=()=>"Git برای آزمایش‌ها لازم است اما نصب نیست. Git را نصب و سپس OpenResearch را دوباره راه‌اندازی کنید.",Ake=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jke():t==="fa"?Tke():zke()}),Rke=()=>"my-research",Mke=()=>"my-research",Dke=()=>"my-research",iN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Mke():t==="fa"?Dke():Rke()}),Lke=()=>"No papers found. Try an arXiv ID, URL, or a different title.",Oke=()=>"未找到论文。请尝试 arXiv ID、网址或其他标题。",Ike=()=>"مقاله‌ای پیدا نشد. یک شناسهٔ arXiv، نشانی یا عنوان دیگری را امتحان کنید.",Bke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Oke():t==="fa"?Ike():Lke()}),$ke=()=>"No public repository found on alphaXiv",Pke=()=>"在 alphaXiv 上未找到公开仓库",Fke=()=>"مخزن عمومی‌ای در alphaXiv پیدا نشد",Hke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pke():t==="fa"?Fke():$ke()}),qke=()=>"OpenResearch will start a blank project with this paper's PDF.",Uke=()=>"OpenResearch 将使用此论文的 PDF 创建空白项目。",Gke=()=>"OpenResearch یک پروژهٔ خالی با PDF این مقاله آغاز می‌کند.",Wke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Uke():t==="fa"?Gke():qke()}),Vke=()=>"Paper",Kke=()=>"论文",Qke=()=>"مقاله",Yke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kke():t==="fa"?Qke():Vke()}),Xke=()=>"Project location",Zke=()=>"项目位置",Jke=()=>"محل پروژه",Sx=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zke():t==="fa"?Jke():Xke()}),e7e=()=>"Project name",t7e=()=>"项目名称",n7e=()=>"نام پروژه",aN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?t7e():t==="fa"?n7e():e7e()}),r7e=()=>"Search for a paper by arXiv ID, URL, or title",s7e=()=>"按 arXiv ID、网址或标题搜索论文",i7e=()=>"جست‌وجوی مقاله با شناسهٔ arXiv، نشانی یا عنوان",a7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?s7e():t==="fa"?i7e():r7e()}),o7e=()=>"Sync experiments to GitHub",l7e=()=>"将实验同步到 GitHub",c7e=()=>"همگام‌سازی آزمایش‌ها با GitHub",u7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?l7e():t==="fa"?c7e():o7e()}),d7e=()=>"That folder no longer exists. Choose it again.",f7e=()=>"该文件夹已不存在。请重新选择。",h7e=()=>"آن پوشه دیگر وجود ندارد. دوباره انتخابش کنید.",_7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?f7e():t==="fa"?h7e():d7e()}),p7e=()=>"The selected folder contains an invalid Git repository.",m7e=()=>"所选文件夹包含无效的 Git 仓库。",g7e=()=>"پوشهٔ انتخاب‌شده یک مخزن Git نامعتبر دارد.",v7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?m7e():t==="fa"?g7e():p7e()}),b7e=()=>"The selected path is not a folder.",y7e=()=>"所选路径不是文件夹。",x7e=()=>"مسیر انتخاب‌شده پوشه نیست.",w7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?y7e():t==="fa"?x7e():b7e()}),S7e=e=>`Checking ${e==null?void 0:e.repository}.`,k7e=e=>`正在检查 ${e==null?void 0:e.repository}。`,C7e=e=>`در حال بررسی ${e==null?void 0:e.repository}.`,E7e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?k7e(e):t==="fa"?C7e(e):S7e(e)}),N7e=e=>`Creates ${e==null?void 0:e.repository}.`,z7e=e=>`将创建 ${e==null?void 0:e.repository}。`,j7e=e=>`${e==null?void 0:e.repository} را ایجاد می‌کند.`,T7e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?z7e(e):t==="fa"?j7e(e):N7e(e)}),A7e=e=>`Pushes to ${e==null?void 0:e.repository}.`,R7e=e=>`将推送到 ${e==null?void 0:e.repository}。`,M7e=e=>`به ${e==null?void 0:e.repository} پوش می‌کند.`,D7e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?R7e(e):t==="fa"?M7e(e):A7e(e)}),L7e=()=>"Project location is required.",O7e=()=>"必须填写项目位置。",I7e=()=>"محل پروژه الزامی است.",oN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?O7e():t==="fa"?I7e():L7e()}),B7e=()=>"Choose a different destination. The paper repository needs a new or empty folder.",$7e=()=>"请选择其他位置。论文仓库需要一个新的或空的文件夹。",P7e=()=>"مقصد دیگری انتخاب کنید. مخزن مقاله به پوشه‌ای جدید یا خالی نیاز دارد.",lN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$7e():t==="fa"?P7e():B7e()}),F7e=()=>"A linked public code repository is cloned without credentials.",H7e=()=>"关联的公开代码仓库无需凭据即可克隆。",q7e=()=>"مخزن عمومی کدِ پیوندشده بدون نیاز به اعتبارنامه کلون می‌شود.",U7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?H7e():t==="fa"?q7e():F7e()}),G7e=e=>`Run ${e==null?void 0:e.command} before creating the project.`,W7e=e=>`创建项目前请运行 ${e==null?void 0:e.command}。`,V7e=e=>`پیش از ساخت پروژه، ${e==null?void 0:e.command} را اجرا کنید.`,K7e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?W7e(e):t==="fa"?V7e(e):G7e(e)}),Q7e=()=>"Searching alphaXiv…",Y7e=()=>"正在搜索 alphaXiv…",X7e=()=>"در حال جست‌وجوی alphaXiv…",Z7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Y7e():t==="fa"?X7e():Q7e()}),J7e=()=>"Use folder",e8e=()=>"使用文件夹",t8e=()=>"استفاده از پوشه",n8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?e8e():t==="fa"?t8e():J7e()}),r8e=()=>"Can’t reach OpenResearch. This page is no longer live.",s8e=()=>"无法连接 OpenResearch。此页面已不再实时同步。",i8e=()=>"دسترسی به OpenResearch ممکن نیست. این صفحه دیگر همگام نیست.",E4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?s8e():t==="fa"?i8e():r8e()}),a8e=()=>"A workspace for your research agents",o8e=()=>"面向研究智能体的工作空间",l8e=()=>"فضای کاری برای عامل‌های پژوهشی شما",c8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?o8e():t==="fa"?l8e():a8e()}),u8e=()=>"Add papers that represent your research interests, including papers by other authors.",d8e=()=>"添加能够代表你研究兴趣的论文,也可以包括其他作者的论文。",f8e=()=>"مقاله‌هایی را که نمایندهٔ علایق پژوهشی شما هستند، از جمله آثار نویسندگان دیگر، اضافه کنید.",h8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?d8e():t==="fa"?f8e():u8e()}),_8e=()=>"API key",p8e=()=>"API 密钥",m8e=()=>"کلید API",r6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?p8e():t==="fa"?m8e():_8e()}),g8e=()=>"AI/ML",v8e=()=>"人工智能与机器学习",b8e=()=>"هوش مصنوعی و یادگیری ماشین",y8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?v8e():t==="fa"?b8e():g8e()}),x8e=()=>"Biology",w8e=()=>"生物学",S8e=()=>"زیست‌شناسی",k8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?w8e():t==="fa"?S8e():x8e()}),C8e=()=>"Other",E8e=()=>"其他",N8e=()=>"سایر",z8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?E8e():t==="fa"?N8e():C8e()}),j8e=()=>"Physics",T8e=()=>"物理学",A8e=()=>"فیزیک",R8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?T8e():t==="fa"?A8e():j8e()}),M8e=()=>"Back",D8e=()=>"返回",L8e=()=>"بازگشت",cN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?D8e():t==="fa"?L8e():M8e()}),O8e=()=>"Check failed",I8e=()=>"检查失败",B8e=()=>"بررسی ناموفق بود",$8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?I8e():t==="fa"?B8e():O8e()}),P8e=()=>"Checking",F8e=()=>"正在检查",H8e=()=>"در حال بررسی",q8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?F8e():t==="fa"?H8e():P8e()}),U8e=()=>"Checking Git…",G8e=()=>"正在检查 Git…",W8e=()=>"در حال بررسی Git…",V8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?G8e():t==="fa"?W8e():U8e()}),K8e=()=>"Choose a coding agent",Q8e=()=>"选择编程智能体",Y8e=()=>"یک عامل کدنویسی انتخاب کنید",X8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Q8e():t==="fa"?Y8e():K8e()}),Z8e=()=>"Choose a coding agent to continue.",J8e=()=>"选择一个编程智能体以继续。",eCe=()=>"برای ادامه یک عامل کدنویسی انتخاب کنید.",tCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?J8e():t==="fa"?eCe():Z8e()}),nCe=()=>"Choose at least one research area to continue.",rCe=()=>"请至少选择一个研究领域后再继续。",sCe=()=>"برای ادامه دست‌کم یک حوزهٔ پژوهشی انتخاب کنید.",iCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rCe():t==="fa"?sCe():nCe()}),aCe=()=>"Choose one or more.",oCe=()=>"请选择一项或多项。",lCe=()=>"یک یا چند مورد را انتخاب کنید.",cCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oCe():t==="fa"?lCe():aCe()}),uCe=()=>"Choose your preferred coding agent",dCe=()=>"请选择首选编程智能体",fCe=()=>"عامل برنامه‌نویسی ترجیحی خود را انتخاب کنید",hCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dCe():t==="fa"?fCe():uCe()}),_Ce=()=>"Consolidate your research",pCe=()=>"集中管理研究",mCe=()=>"پژوهش خود را یکپارچه کنید",gCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pCe():t==="fa"?mCe():_Ce()}),vCe=()=>"Continue",bCe=()=>"继续",yCe=()=>"ادامه",uN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bCe():t==="fa"?yCe():vCe()}),xCe=()=>"Describe your research area to continue.",wCe=()=>"请描述你的研究领域后再继续。",SCe=()=>"برای ادامه حوزهٔ پژوهشی خود را شرح دهید.",kCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wCe():t==="fa"?SCe():xCe()}),CCe=()=>"Detecting Claude Code, Codex, OpenCode, Cursor…",ECe=()=>"正在检测 Claude Code、Codex、OpenCode、Cursor…",NCe=()=>"در حال شناسایی Claude Code، Codex، OpenCode و Cursor…",zCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ECe():t==="fa"?NCe():CCe()}),jCe=()=>"e.g. I work on sample-efficient RL for LLM post-training, focused on reward-model-free methods.",TCe=()=>"例如:我研究用于 LLM 后训练的样本高效强化学习,重点关注无需奖励模型的方法。",ACe=()=>"مثلاً روی یادگیری تقویتی کم‌نمونه برای پس‌آموزش LLM با تمرکز بر روش‌های بدون مدل پاداش کار می‌کنم.",RCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?TCe():t==="fa"?ACe():jCe()}),MCe=()=>"Everything stays local",DCe=()=>"一切都保留在本地",LCe=()=>"همه‌چیز محلی می‌ماند",OCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?DCe():t==="fa"?LCe():MCe()}),ICe=()=>"Get started",BCe=()=>"开始使用",$Ce=()=>"شروع",PCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BCe():t==="fa"?$Ce():ICe()}),FCe=()=>"Git is required for local experiments. Install Git, then re-check.",HCe=()=>"本地实验需要 Git。请安装 Git,然后重新检查。",qCe=()=>"Git برای آزمایش‌های محلی لازم است. آن را نصب و دوباره بررسی کنید.",UCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HCe():t==="fa"?qCe():FCe()}),GCe=()=>"Ground your agents",WCe=()=>"为智能体提供可靠依据",VCe=()=>"عامل‌هایتان را به منابع متصل کنید",KCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WCe():t==="fa"?VCe():GCe()}),QCe=()=>"Install broken",YCe=()=>"安装损坏",XCe=()=>"نصب خراب است",ZCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YCe():t==="fa"?XCe():QCe()}),JCe=()=>"Install Git to continue",e9e=()=>"请安装 Git 后再继续",t9e=()=>"برای ادامه Git را نصب کنید",n9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?e9e():t==="fa"?t9e():JCe()}),r9e=()=>"Local Git",s9e=()=>"本地 Git",i9e=()=>"Git محلی",a9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?s9e():t==="fa"?i9e():r9e()}),o9e=()=>", and ",l9e=()=>" 和 ",c9e=()=>" و ",u9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?l9e():t==="fa"?c9e():o9e()}),d9e=()=>"Compatible with",f9e=()=>"兼容",h9e=()=>"سازگار با",_9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?f9e():t==="fa"?h9e():d9e()}),p9e=()=>"Use your own local models",m9e=()=>"使用你自己的本地模型",g9e=()=>"از مدل‌های محلی خود استفاده کنید",v9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?m9e():t==="fa"?g9e():p9e()}),b9e=()=>"Not detected",y9e=()=>"未检测到",x9e=()=>"شناسایی نشد",dN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?y9e():t==="fa"?x9e():b9e()}),w9e=()=>"Not found",S9e=()=>"未找到",k9e=()=>"پیدا نشد",qD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?S9e():t==="fa"?k9e():w9e()}),C9e=()=>"Not signed in",E9e=()=>"未登录",N9e=()=>"وارد نشده",z9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?E9e():t==="fa"?N9e():C9e()}),j9e=()=>"OpenResearch uses a coding agent already installed on this machine.",T9e=()=>"OpenResearch 使用这台计算机上已安装的编程智能体。",A9e=()=>"OpenResearch از عامل کدنویسی نصب‌شده روی این دستگاه استفاده می‌کند.",R9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?T9e():t==="fa"?A9e():j9e()}),M9e=()=>"Other research area",D9e=()=>"其他研究领域",L9e=()=>"حوزهٔ پژوهشی دیگر",O9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?D9e():t==="fa"?L9e():M9e()}),I9e=()=>"Re-check",B9e=()=>"重新检查",$9e=()=>"بررسی دوباره",UD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?B9e():t==="fa"?$9e():I9e()}),P9e=()=>"Ready",F9e=()=>"已就绪",H9e=()=>"آماده",s6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?F9e():t==="fa"?H9e():P9e()}),q9e=()=>"Re-check Git before continuing",U9e=()=>"请重新检查 Git 后再继续",G9e=()=>"پیش از ادامه Git را دوباره بررسی کنید",W9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?U9e():t==="fa"?G9e():q9e()}),V9e=()=>"Representative papers",K9e=()=>"代表性论文",Q9e=()=>"مقاله‌های شاخص",Y9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?K9e():t==="fa"?Q9e():V9e()}),X9e=()=>"Research background",Z9e=()=>"研究背景",J9e=()=>"پیشینهٔ پژوهشی",eEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Z9e():t==="fa"?J9e():X9e()}),tEe=()=>"Couldn’t reach orx. Check that it’s still running, then re-check.",nEe=()=>"无法连接到 orx。请确认它仍在运行,然后重新检查。",rEe=()=>"ارتباط با orx برقرار نشد. مطمئن شوید هنوز در حال اجراست و دوباره بررسی کنید.",fN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nEe():t==="fa"?rEe():tEe()}),sEe=()=>"Search alphaXiv by title to link a paper…",iEe=()=>"按标题搜索 alphaXiv 以关联论文…",aEe=()=>"برای پیوند مقاله، عنوان را در alphaXiv جست‌وجو کنید…",oEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iEe():t==="fa"?aEe():sEe()}),lEe=()=>"Searching alphaXiv…",cEe=()=>"正在搜索 alphaXiv…",uEe=()=>"در حال جست‌وجوی alphaXiv…",dEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cEe():t==="fa"?uEe():lEe()}),fEe=()=>"Selected",hEe=()=>"已选择",_Ee=()=>"انتخاب‌شده",pEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hEe():t==="fa"?_Ee():fEe()}),mEe=()=>"Local model unavailable",gEe=()=>"本地模型不可用",vEe=()=>"مدل محلی در دسترس نیست",GD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gEe():t==="fa"?vEe():mEe()}),bEe=()=>"Setting things up…",yEe=()=>"正在设置…",xEe=()=>"در حال راه‌اندازی…",wEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yEe():t==="fa"?xEe():bEe()}),SEe=()=>"Connect a local model or sign in to a coding agent to continue",kEe=()=>"连接本地模型或登录编码智能体以继续",CEe=()=>"برای ادامه، یک مدل محلی متصل کنید یا به یک عامل کدنویسی وارد شوید",EEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kEe():t==="fa"?CEe():SEe()}),NEe=()=>"Connect a local model or sign in to an agent to continue.",zEe=()=>"连接本地模型或登录一个智能体以继续。",jEe=()=>"برای ادامه، یک مدل محلی متصل کنید یا به یک عامل وارد شوید.",TEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zEe():t==="fa"?jEe():NEe()}),AEe=()=>"Signed in",REe=()=>"已登录",MEe=()=>"وارد شده",DEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?REe():t==="fa"?MEe():AEe()}),LEe=()=>"Connected to alphaXiv, bioRxiv, and OpenAlex to ground your agents in the latest research.",OEe=()=>"已连接 alphaXiv、bioRxiv 和 OpenAlex,让智能体以最新研究为依据。",IEe=()=>"به alphaXiv، bioRxiv و OpenAlex متصل است تا عامل‌هایتان بر تازه‌ترین پژوهش‌ها تکیه کنند.",BEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?OEe():t==="fa"?IEe():LEe()}),$Ee=()=>"· Step 1 of 2",PEe=()=>"· 第 1 步,共 2 步",FEe=()=>"· مرحلهٔ ۱ از ۲",HEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?PEe():t==="fa"?FEe():$Ee()}),qEe=()=>"· Step 2 of 2",UEe=()=>"· 第 2 步,共 2 步",GEe=()=>"· مرحلهٔ ۲ از ۲",WEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?UEe():t==="fa"?GEe():qEe()}),VEe=()=>"Tell us about your research",KEe=()=>"介绍一下你的研究",QEe=()=>"از پژوهش خود بگویید",YEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KEe():t==="fa"?QEe():VEe()}),XEe=()=>"Tell us your other research area",ZEe=()=>"告诉我们你的其他研究领域",JEe=()=>"حوزهٔ پژوهشی دیگر خود را بنویسید",eNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ZEe():t==="fa"?JEe():XEe()}),tNe=()=>"Track experiments, artifacts, compute, skills, and code all in one place.",nNe=()=>"在一处跟踪实验、产物、算力、技能和代码。",rNe=()=>"آزمایش‌ها، خروجی‌ها، رایانش، مهارت‌ها و کد را یک‌جا دنبال کنید.",sNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nNe():t==="fa"?rNe():tNe()}),iNe=()=>"Unable to verify",aNe=()=>"无法验证",oNe=()=>"تأیید ممکن نیست",lNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aNe():t==="fa"?oNe():iNe()}),cNe=()=>"Update required",uNe=()=>"需要更新",dNe=()=>"نیازمند به‌روزرسانی",fNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uNe():t==="fa"?dNe():cNe()}),hNe=()=>"Waiting for the Git check",_Ne=()=>"正在等待 Git 检查",pNe=()=>"در انتظار بررسی Git",mNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_Ne():t==="fa"?pNe():hNe()}),gNe=()=>"Waiting for the local tool checks",vNe=()=>"正在等待本地工具检查",bNe=()=>"در انتظار بررسی ابزارهای محلی",yNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vNe():t==="fa"?bNe():gNe()}),xNe=()=>"What areas are you interested in?",wNe=()=>"你对哪些领域感兴趣?",SNe=()=>"به چه حوزه‌هایی علاقه دارید؟",kNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wNe():t==="fa"?SNe():xNe()}),CNe=()=>"Your code, data, and experiment history stay on your machine.",ENe=()=>"你的代码、数据和实验历史都保留在自己的计算机上。",NNe=()=>"کد، داده‌ها و تاریخچهٔ آزمایش شما روی رایانهٔ خودتان می‌ماند.",zNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ENe():t==="fa"?NNe():CNe()}),jNe=()=>"Your selected agent is no longer ready. Go back to Step 1 and choose another.",TNe=()=>"所选智能体已无法使用。请返回第 1 步并选择其他智能体。",ANe=()=>"عامل انتخاب‌شده دیگر آماده نیست. به مرحلهٔ ۱ برگردید و عامل دیگری را انتخاب کنید.",RNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?TNe():t==="fa"?ANe():jNe()}),MNe=()=>"Add cookie",DNe=()=>"添加 cookie",LNe=()=>"افزودن کوکی",ONe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?DNe():t==="fa"?LNe():MNe()}),INe=()=>"Changed here and on Overleaf — choose which copy to keep",BNe=()=>"此处和 Overleaf 都有更改 — 请选择要保留的版本",$Ne=()=>"هم اینجا و هم در Overleaf تغییر کرده است — نسخه‌ای را که می‌خواهید نگه دارید انتخاب کنید",PNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BNe():t==="fa"?$Ne():INe()}),FNe=()=>"Create a token ↗",HNe=()=>"创建令牌 ↗",qNe=()=>"ساخت توکن ↗",UNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HNe():t==="fa"?qNe():FNe()}),GNe=()=>"Overleaf Git token",WNe=()=>"Overleaf Git 令牌",VNe=()=>"توکن Git در Overleaf",hN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WNe():t==="fa"?VNe():GNe()}),KNe=()=>"Follow Overleaf as people type by adding your Overleaf session cookie.",QNe=()=>"添加 Overleaf 会话 cookie,即可在他人输入时实时跟随 Overleaf。",YNe=()=>"با افزودن کوکی نشست Overleaf، هنگام تایپ دیگران Overleaf را زنده دنبال کنید.",XNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?QNe():t==="fa"?YNe():KNe()}),ZNe=()=>"Import from browser",JNe=()=>"从浏览器导入",eze=()=>"وارد کردن از مرورگر",tze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JNe():t==="fa"?eze():ZNe()}),nze=()=>"In step with Overleaf",rze=()=>"已与 Overleaf 同步",sze=()=>"با Overleaf همگام است",WD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rze():t==="fa"?sze():nze()}),ize=()=>"The last sync did not finish.",aze=()=>"上次同步未完成。",oze=()=>"آخرین همگام‌سازی کامل نشد.",lze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aze():t==="fa"?oze():ize()}),cze=()=>"Link and sync",uze=()=>"关联并同步",dze=()=>"پیوند و همگام‌سازی",fze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uze():t==="fa"?dze():cze()}),hze=()=>"Connecting to Overleaf…",_ze=()=>"正在连接 Overleaf…",pze=()=>"در حال اتصال به Overleaf…",mze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_ze():t==="fa"?pze():hze()}),gze=()=>"Edits are live on Overleaf",vze=()=>"编辑已在 Overleaf 实时同步",bze=()=>"ویرایش‌ها روی Overleaf زنده‌اند",yze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vze():t==="fa"?bze():gze()}),xze=()=>"Retry",wze=()=>"重试",Sze=()=>"تلاش دوباره",kze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wze():t==="fa"?Sze():xze()}),Cze=()=>"Live sync stopped.",Eze=()=>"实时同步已停止。",Nze=()=>"همگام‌سازی زنده متوقف شد.",zze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Eze():t==="fa"?Nze():Cze()}),jze=()=>"Live sync starts once the paper is in step with Overleaf.",Tze=()=>"论文与 Overleaf 同步后,实时同步即会开始。",Aze=()=>"همگام‌سازی زنده پس از هم‌گام شدن مقاله با Overleaf آغاز می‌شود.",Rze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tze():t==="fa"?Aze():jze()}),Mze=()=>"My projects ↗",Dze=()=>"我的项目 ↗",Lze=()=>"پروژه‌های من ↗",_N=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Dze():t==="fa"?Lze():Mze()}),Oze=()=>"Nothing could be synced.",Ize=()=>"没有内容可以同步。",Bze=()=>"هیچ موردی قابل همگام‌سازی نبود.",$ze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ize():t==="fa"?Bze():Oze()}),Pze=()=>"Open Overleaf ↗",Fze=()=>"打开 Overleaf ↗",Hze=()=>"باز کردن Overleaf ↗",qze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Fze():t==="fa"?Hze():Pze()}),Uze=()=>"Cancel",Gze=()=>"取消",Wze=()=>"لغو",VD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Gze():t==="fa"?Wze():Uze()}),Vze=()=>"changed here and on Overleaf. Both copies are untouched — choose which one to keep.",Kze=()=>"在此处和 Overleaf 上均有更改。两个副本均未被修改——请选择要保留的版本。",Qze=()=>"هم اینجا و هم در Overleaf تغییر کرده است. هر دو نسخه دست‌نخورده‌اند — انتخاب کنید کدام نگه داشته شود.",Yze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kze():t==="fa"?Qze():Vze()}),Xze=()=>"Keep this copy",Zze=()=>"保留此副本",Jze=()=>"نگه داشتن این نسخه",eje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zze():t==="fa"?Jze():Xze()}),tje=()=>"Open in Overleaf",nje=()=>"在 Overleaf 中打开",rje=()=>"باز کردن در Overleaf",sje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nje():t==="fa"?rje():tje()}),ije=()=>"Replace the Overleaf token",aje=()=>"替换 Overleaf 令牌",oje=()=>"جایگزینی توکن Overleaf",pN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aje():t==="fa"?oje():ije()}),lje=()=>"Sync files",cje=()=>"同步文件",uje=()=>"همگام‌سازی فایل‌ها",dje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cje():t==="fa"?uje():lje()}),fje=()=>"Unlink",hje=()=>"取消关联",_je=()=>"قطع پیوند",pje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hje():t==="fa"?_je():fje()}),mje=()=>"Upload a copy as a new project ↗",gje=()=>"上传副本作为新项目 ↗",vje=()=>"بارگذاری یک کپی به‌عنوان پروژهٔ جدید ↗",KD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gje():t==="fa"?vje():mje()}),bje=()=>"Use Overleaf's",yje=()=>"使用 Overleaf 的副本",xje=()=>"استفاده از نسخهٔ Overleaf",wje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yje():t==="fa"?xje():bje()}),Sje=()=>"This paper stays in step with Overleaf.",kje=()=>"此论文将与 Overleaf 保持同步。",Cje=()=>"این مقاله با Overleaf همگام می‌ماند.",Eje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kje():t==="fa"?Cje():Sje()}),Nje=()=>"Paste it instead",zje=()=>"改为粘贴",jje=()=>"به‌جایش بچسبانید",Tje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zje():t==="fa"?jje():Nje()}),Aje=e=>`Pulled ${e==null?void 0:e.paths}.`,Rje=e=>`已拉取 ${e==null?void 0:e.paths}。`,Mje=e=>`${e==null?void 0:e.paths} دریافت شد.`,Dje=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Rje(e):t==="fa"?Mje(e):Aje(e)}),Lje=e=>`Pulled ${e==null?void 0:e.pulled}; pushed ${e==null?void 0:e.pushed}.`,Oje=e=>`已拉取 ${e==null?void 0:e.pulled};已推送 ${e==null?void 0:e.pushed}。`,Ije=e=>`${e==null?void 0:e.pulled} دریافت و ${e==null?void 0:e.pushed} ارسال شد.`,Bje=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Oje(e):t==="fa"?Ije(e):Lje(e)}),$je=e=>`Pushed ${e==null?void 0:e.paths}.`,Pje=e=>`已推送 ${e==null?void 0:e.paths}。`,Fje=e=>`${e==null?void 0:e.paths} ارسال شد.`,Hje=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Pje(e):t==="fa"?Fje(e):$je(e)}),qje=()=>"Add a fresh Overleaf session cookie to start following again.",Uje=()=>"添加新的 Overleaf 会话 cookie 即可继续实时跟随。",Gje=()=>"برای ادامهٔ دنبال کردن، کوکی نشست تازه‌ای از Overleaf اضافه کنید.",Wje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Uje():t==="fa"?Gje():qje()}),Vje=()=>"Save the file first",Kje=()=>"请先保存文件",Qje=()=>"ابتدا فایل را ذخیره کنید",Yje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kje():t==="fa"?Qje():Vje()}),Xje=()=>"Save this file to sync it with Overleaf",Zje=()=>"保存此文件以与 Overleaf 同步",Jje=()=>"برای همگام‌سازی با Overleaf این فایل را ذخیره کنید",QD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zje():t==="fa"?Jje():Xje()}),eTe=()=>"Save token",tTe=()=>"保存令牌",nTe=()=>"ذخیرهٔ توکن",rTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tTe():t==="fa"?nTe():eTe()}),sTe=()=>"Send this paper to Overleaf",iTe=()=>"将此论文发送到 Overleaf",aTe=()=>"ارسال مقاله به Overleaf",oTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iTe():t==="fa"?aTe():sTe()}),lTe=()=>"Overleaf session cookie",cTe=()=>"Overleaf 会话 cookie",uTe=()=>"کوکی نشست Overleaf",N4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cTe():t==="fa"?uTe():lTe()}),dTe=()=>"To follow Overleaf as people type, paste your Overleaf session cookie: in a browser signed in to Overleaf, open the developer tools, find the overleaf_session2 cookie, and copy its value. It stays on this machine.",fTe=()=>"要在他人输入时实时跟随 Overleaf,请粘贴你的 Overleaf 会话 cookie:在已登录 Overleaf 的浏览器中打开开发者工具,找到 overleaf_session2 cookie 并复制其值。它只保存在这台机器上。",hTe=()=>"برای دنبال کردن Overleaf هنگام تایپ دیگران، کوکی نشست Overleaf خود را بچسبانید: در مرورگری که به Overleaf وارد شده‌اید، ابزارهای توسعه‌دهنده را باز کنید، کوکی overleaf_session2 را پیدا کنید و مقدار آن را کپی کنید. این مقدار روی همین دستگاه می‌ماند.",_Te=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fTe():t==="fa"?hTe():dTe()}),pTe=()=>"Overleaf sync failed",mTe=()=>"Overleaf 同步失败",gTe=()=>"همگام‌سازی با Overleaf ناموفق بود",z4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mTe():t==="fa"?gTe():pTe()}),vTe=()=>"Text syncs live. This moves figures and other files, and settles conflicts.",bTe=()=>"文本会实时同步。此操作用于同步图片等其他文件,并解决冲突。",yTe=()=>"متن زنده همگام می‌شود. این کار تصویرها و دیگر فایل‌ها را جابه‌جا می‌کند و تعارض‌ها را حل می‌کند.",xTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bTe():t==="fa"?yTe():vTe()}),wTe=()=>"Syncing with Overleaf…",STe=()=>"正在与 Overleaf 同步…",kTe=()=>"در حال همگام‌سازی با Overleaf…",YD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?STe():t==="fa"?kTe():wTe()}),CTe=()=>"Paste an Overleaf Git authentication token to keep this paper in step with an Overleaf project. Create one in Overleaf under Account Settings — Git integration comes with a paid Overleaf plan.",ETe=()=>"粘贴 Overleaf Git 身份验证令牌,使此论文与 Overleaf 项目保持同步。请在 Overleaf 的“账户设置”中创建令牌 — Git 集成功能需要付费 Overleaf 套餐。",NTe=()=>"برای همگام نگه داشتن این مقاله با یک پروژهٔ Overleaf، توکن احراز هویت Git در Overleaf را جای‌گذاری کنید. آن را در بخش تنظیمات حساب Overleaf بسازید — یکپارچه‌سازی Git به طرح پولی Overleaf نیاز دارد.",zTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ETe():t==="fa"?NTe():CTe()}),jTe=()=>"Paste the URL of the Overleaf project this paper belongs to. Overleaf cannot create one over Git, so open or create the project there first.",TTe=()=>"粘贴此论文所属 Overleaf 项目的 URL。Overleaf 无法通过 Git 创建项目,因此请先在 Overleaf 中打开或创建项目。",ATe=()=>"نشانی پروژهٔ Overleaf مربوط به این مقاله را جای‌گذاری کنید. Overleaf نمی‌تواند پروژه را از طریق Git بسازد؛ پس ابتدا پروژه را در آنجا باز یا ایجاد کنید.",RTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?TTe():t==="fa"?ATe():jTe()}),MTe=()=>"Toggle Plan mode for this chat",DTe=()=>"切换此聊天的计划模式",LTe=()=>"تغییر حالت طرح این گفت‌وگو",OTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?DTe():t==="fa"?LTe():MTe()}),ITe=()=>"Accept and auto mode",BTe=()=>"接受并使用自动模式",$Te=()=>"پذیرش و حالت خودکار",PTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BTe():t==="fa"?$Te():ITe()}),FTe=()=>"Accept and bypass all",HTe=()=>"接受并跳过所有审批",qTe=()=>"پذیرش و عبور از همهٔ تأییدها",UTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HTe():t==="fa"?qTe():FTe()}),GTe=()=>"Accept plan",WTe=()=>"接受计划",VTe=()=>"پذیرش طرح",KTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WTe():t==="fa"?VTe():GTe()}),QTe=e=>`${e==null?void 0:e.agent} proposed a plan`,YTe=e=>`${e==null?void 0:e.agent} 提出了一个计划`,XTe=e=>`طرح پیشنهادیِ ${e==null?void 0:e.agent}`,ZTe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?YTe(e):t==="fa"?XTe(e):QTe(e)}),JTe=e=>`${e==null?void 0:e.agent} is ready to proceed`,eAe=e=>`${e==null?void 0:e.agent} 已准备好继续`,tAe=e=>`طرحِ ${e==null?void 0:e.agent} آمادهٔ ادامه است`,nAe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?eAe(e):t==="fa"?tAe(e):JTe(e)}),rAe=()=>"Back",sAe=()=>"返回",iAe=()=>"بازگشت",aAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sAe():t==="fa"?iAe():rAe()}),oAe=()=>"More approval options",lAe=()=>"更多批准选项",cAe=()=>"گزینه‌های تأیید بیشتر",uAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lAe():t==="fa"?cAe():oAe()}),dAe=()=>"Open plan",fAe=()=>"打开计划",hAe=()=>"باز کردن طرح",_Ae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fAe():t==="fa"?hAe():dAe()}),pAe=()=>"Reject",mAe=()=>"拒绝",gAe=()=>"رد کردن",vAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mAe():t==="fa"?gAe():pAe()}),bAe=()=>"Revise",yAe=()=>"修改",xAe=()=>"بازنگری",wAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yAe():t==="fa"?xAe():bAe()}),SAe=()=>"Revise…",kAe=()=>"修改…",CAe=()=>"بازنگری…",EAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kAe():t==="fa"?CAe():SAe()}),NAe=()=>"What should change? (optional)",zAe=()=>"需要更改什么?(可选)",jAe=()=>"چه چیزی باید تغییر کند؟ (اختیاری)",TAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zAe():t==="fa"?jAe():NAe()}),AAe=e=>`${e==null?void 0:e.count} active`,RAe=e=>`${e==null?void 0:e.count} 个活跃`,MAe=e=>`${e==null?void 0:e.count} فعال`,DAe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?RAe(e):t==="fa"?MAe(e):AAe(e)}),LAe=e=>`${e==null?void 0:e.count} total agents`,OAe=e=>`共 ${e==null?void 0:e.count} 个智能体`,IAe=e=>`در مجموع ${e==null?void 0:e.count} عامل`,BAe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?OAe(e):t==="fa"?IAe(e):LAe(e)}),$Ae=e=>`Delete ${e==null?void 0:e.name} from OpenResearch? Its experiments, runs, and chats will be permanently removed.`,PAe=e=>`从 OpenResearch 中删除 ${e==null?void 0:e.name}?其实验、运行和聊天将被永久移除。`,FAe=e=>`${e==null?void 0:e.name} از OpenResearch حذف شود؟ آزمایش‌ها، اجراها و گفتگوهای آن برای همیشه حذف می‌شوند.`,HAe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?PAe(e):t==="fa"?FAe(e):$Ae(e)}),qAe=()=>"Agents",UAe=()=>"智能体",GAe=()=>"عامل‌ها",mN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?UAe():t==="fa"?GAe():qAe()}),WAe=()=>"arXiv paper ID:",VAe=()=>"arXiv 论文 ID:",KAe=()=>"شناسهٔ مقالهٔ arXiv:",QAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VAe():t==="fa"?KAe():WAe()}),YAe=()=>"Cancel",XAe=()=>"取消",ZAe=()=>"لغو",JAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?XAe():t==="fa"?ZAe():YAe()}),eRe=()=>"Created",tRe=()=>"创建时间",nRe=()=>"ایجادشده",rRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tRe():t==="fa"?nRe():eRe()}),sRe=()=>"Delete project?",iRe=()=>"删除项目?",aRe=()=>"پروژه حذف شود؟",oRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iRe():t==="fa"?aRe():sRe()}),lRe=()=>"Delete project",cRe=()=>"删除项目",uRe=()=>"حذف پروژه",dRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cRe():t==="fa"?uRe():lRe()}),fRe=()=>"Deleting…",hRe=()=>"正在删除…",_Re=()=>"در حال حذف…",pRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hRe():t==="fa"?_Re():fRe()}),mRe=()=>"Experiments",gRe=()=>"实验",vRe=()=>"آزمایش‌ها",gN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gRe():t==="fa"?vRe():mRe()}),bRe=()=>"The local folder and linked GitHub repository are kept.",yRe=()=>"本地文件夹和已关联的 GitHub 仓库都会保留。",xRe=()=>"پوشهٔ محلی و مخزن پیوندشدهٔ GitHub نگه داشته می‌شوند.",wRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yRe():t==="fa"?xRe():bRe()}),SRe=()=>"The local folder is kept.",kRe=()=>"本地文件夹会保留。",CRe=()=>"پوشهٔ محلی نگه داشته می‌شود.",ERe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kRe():t==="fa"?CRe():SRe()}),NRe=()=>"New project",zRe=()=>"新建项目",jRe=()=>"پروژهٔ جدید",XD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zRe():t==="fa"?jRe():NRe()}),TRe=()=>"No projects yet — create one to get started.",ARe=()=>"尚无项目——新建一个即可开始。",RRe=()=>"هنوز پروژه‌ای نیست — برای شروع یکی بسازید.",MRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ARe():t==="fa"?RRe():TRe()}),DRe=()=>"Project",LRe=()=>"项目",ORe=()=>"پروژه",IRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LRe():t==="fa"?ORe():DRe()}),BRe=()=>"Projects",$Re=()=>"项目",PRe=()=>"پروژه‌ها",FRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$Re():t==="fa"?PRe():BRe()}),HRe=()=>"Repository",qRe=()=>"仓库",URe=()=>"مخزن",vN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qRe():t==="fa"?URe():HRe()}),GRe=()=>"Idle",WRe=()=>"空闲",VRe=()=>"بیکار",KRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WRe():t==="fa"?VRe():GRe()}),QRe=()=>"Local",YRe=()=>"本地",XRe=()=>"محلی",i6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YRe():t==="fa"?XRe():QRe()}),ZRe=()=>"1 total agent",JRe=()=>"共 1 个智能体",eMe=()=>"در مجموع ۱ عامل",tMe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JRe():t==="fa"?eMe():ZRe()}),nMe=e=>`${e==null?void 0:e.count} running`,rMe=e=>`${e==null?void 0:e.count} 个运行中`,sMe=e=>`${e==null?void 0:e.count} در حال اجرا`,iMe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?rMe(e):t==="fa"?sMe(e):nMe(e)}),aMe=e=>`${e==null?void 0:e.count} total`,oMe=e=>`共 ${e==null?void 0:e.count} 个`,lMe=e=>`در مجموع ${e==null?void 0:e.count}`,bN=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?oMe(e):t==="fa"?lMe(e):aMe(e)}),cMe=()=>"Installing the compatible binary. This may take a few minutes.",uMe=()=>"正在安装兼容的二进制文件。这可能需要几分钟。",dMe=()=>"در حال نصب فایل اجرایی سازگار. این کار ممکن است چند دقیقه طول بکشد.",fMe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uMe():t==="fa"?dMe():cMe()}),hMe=e=>`Setting up OpenResearch on ${e==null?void 0:e.host}`,_Me=e=>`正在设置 ${e==null?void 0:e.host} 上的 OpenResearch`,pMe=e=>`در حال راه‌اندازی OpenResearch روی ${e==null?void 0:e.host}`,mMe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?_Me(e):t==="fa"?pMe(e):hMe(e)}),gMe=()=>"Check again",vMe=()=>"再次检查",bMe=()=>"بررسی دوباره",yN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vMe():t==="fa"?bMe():gMe()}),yMe=()=>"Closing…",xMe=()=>"正在关闭…",wMe=()=>"در حال بستن…",SMe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xMe():t==="fa"?wMe():yMe()}),kMe=e=>`Connected to ${e==null?void 0:e.host} as ${e==null?void 0:e.user}`,CMe=e=>`已以 ${e==null?void 0:e.user} 身份连接到 ${e==null?void 0:e.host}`,EMe=e=>`اتصال به ${e==null?void 0:e.host} با کاربر ${e==null?void 0:e.user}`,NMe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?CMe(e):t==="fa"?EMe(e):kMe(e)}),zMe=()=>"Preparing your remote workspace…",jMe=()=>"正在准备远程工作区…",TMe=()=>"در حال آماده‌سازی فضای کاری راه‌دور…",AMe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jMe():t==="fa"?TMe():zMe()}),RMe=e=>`Connecting to ${e==null?void 0:e.host}`,MMe=e=>`正在连接到 ${e==null?void 0:e.host}`,DMe=e=>`در حال اتصال به ${e==null?void 0:e.host}`,LMe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?MMe(e):t==="fa"?DMe(e):RMe(e)}),OMe=()=>"Close remote host picker",IMe=()=>"关闭远程主机选择器",BMe=()=>"بستن انتخاب‌گر میزبان راه‌دور",$Me=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?IMe():t==="fa"?BMe():OMe()}),PMe=()=>"Choose a configured SSH host.",FMe=()=>"选择已配置的 SSH 主机。",HMe=()=>"یک میزبان SSH پیکربندی‌شده انتخاب کنید.",qMe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?FMe():t==="fa"?HMe():PMe()}),UMe=()=>"Connect to remote",GMe=()=>"连接到远程主机",WMe=()=>"اتصال به میزبان راه‌دور",ZD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?GMe():t==="fa"?WMe():UMe()}),VMe=()=>"Disconnect",KMe=()=>"断开连接",QMe=()=>"قطع اتصال",j4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KMe():t==="fa"?QMe():VMe()}),YMe=()=>"Your remote work is still running. Reconnect when you’re ready.",XMe=()=>"你的远程工作仍在运行。准备好后可以重新连接。",ZMe=()=>"کار راه‌دور شما همچنان در حال اجرا است. هر زمان آماده بودید دوباره متصل شوید.",JMe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?XMe():t==="fa"?ZMe():YMe()}),eDe=e=>`Disconnected from ${e==null?void 0:e.host}`,tDe=e=>`已断开与 ${e==null?void 0:e.host} 的连接`,nDe=e=>`اتصال به ${e==null?void 0:e.host} قطع شد`,JD=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?tDe(e):t==="fa"?nDe(e):eDe(e)}),rDe=e=>`Could not connect to ${e==null?void 0:e.host}`,sDe=e=>`无法连接到 ${e==null?void 0:e.host}`,iDe=e=>`اتصال به ${e==null?void 0:e.host} ممکن نشد`,aDe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?sDe(e):t==="fa"?iDe(e):rDe(e)}),oDe=()=>"Restart local OpenResearch and select this SSH host again. Work on the remote host continues.",lDe=()=>"请重新启动本地 OpenResearch 并再次选择此 SSH 主机。远程主机上的工作仍在继续。",cDe=()=>"OpenResearch محلی را دوباره راه‌اندازی کنید و این میزبان SSH را دوباره انتخاب کنید. کار روی میزبان راه‌دور ادامه دارد.",uDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lDe():t==="fa"?cDe():oDe()}),dDe=()=>"OpenResearch agents have stopped. Submitted experiments may still be running.",fDe=()=>"OpenResearch 智能体已停止。已提交的实验可能仍在运行。",hDe=()=>"عامل‌های OpenResearch متوقف شده‌اند. آزمایش‌های ارسال‌شده ممکن است همچنان در حال اجرا باشند.",_De=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fDe():t==="fa"?hDe():dDe()}),pDe=e=>`OpenResearch is not running on ${e==null?void 0:e.host}`,mDe=e=>`OpenResearch 未在 ${e==null?void 0:e.host} 上运行`,gDe=e=>`OpenResearch روی ${e==null?void 0:e.host} در حال اجرا نیست`,vDe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?mDe(e):t==="fa"?gDe(e):pDe(e)}),bDe=()=>"OpenResearch binary",yDe=()=>"OpenResearch 二进制文件",xDe=()=>"فایل اجرایی OpenResearch",wDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yDe():t==="fa"?xDe():bDe()}),SDe=()=>"OpenResearch Database",kDe=()=>"OpenResearch 数据库",CDe=()=>"پایگاه دادهٔ OpenResearch",EDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kDe():t==="fa"?CDe():SDe()}),NDe=()=>"OpenResearch will use these locations for your remote SSH user and does not require sudo.",zDe=()=>"OpenResearch 将为你的远程 SSH 用户使用以下位置,无需 sudo。",jDe=()=>"OpenResearch از این مسیرها برای کاربر SSH راه‌دور شما استفاده می‌کند و به sudo نیاز ندارد.",TDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zDe():t==="fa"?jDe():NDe()}),ADe=()=>"Install OpenResearch?",RDe=()=>"安装 OpenResearch?",MDe=()=>"OpenResearch نصب شود؟",DDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?RDe():t==="fa"?MDe():ADe()}),LDe=()=>"Installing…",ODe=()=>"正在安装…",IDe=()=>"در حال نصب…",BDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ODe():t==="fa"?IDe():LDe()}),$De=()=>"No matching SSH hosts",PDe=()=>"没有匹配的 SSH 主机",FDe=()=>"میزبان SSH منطبقی پیدا نشد",HDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?PDe():t==="fa"?FDe():$De()}),qDe=e=>`OpenResearch is not installed for ${e==null?void 0:e.user} on ${e==null?void 0:e.host}. Install it now?`,UDe=e=>`${e==null?void 0:e.user} 尚未在 ${e==null?void 0:e.host} 上安装 OpenResearch。现在安装吗?`,GDe=e=>`OpenResearch برای ${e==null?void 0:e.user} روی ${e==null?void 0:e.host} نصب نیست. اکنون نصب شود؟`,WDe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?UDe(e):t==="fa"?GDe(e):qDe(e)}),VDe=()=>"Open remote",KDe=()=>"打开远程工作区",QDe=()=>"باز کردن راه‌دور",YDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KDe():t==="fa"?QDe():VDe()}),XDe=()=>"Closing this tab or disconnecting leaves agents and experiments running. Approval requests remain pending for up to 55 minutes. A host restart or administrator policy may stop OpenResearch.",ZDe=()=>"关闭此标签页或断开连接后,代理和实验仍会继续运行。审批请求最多保持待处理 55 分钟。主机重启或管理员策略可能会停止 OpenResearch。",JDe=()=>"بستن این زبانه یا قطع اتصال، عامل‌ها و آزمایش‌ها را در حال اجرا نگه می‌دارد. درخواست‌های تأیید تا ۵۵ دقیقه در انتظار می‌مانند. راه‌اندازی مجدد میزبان یا سیاست مدیر ممکن است OpenResearch را متوقف کند.",eLe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ZDe():t==="fa"?JDe():XDe()}),tLe=()=>"Your browser blocked the remote workspace tab. Allow pop-ups and try again.",nLe=()=>"浏览器阻止了远程工作区标签页。请允许弹出窗口后重试。",rLe=()=>"مرورگر زبانهٔ فضای کاری راه‌دور را مسدود کرد. پنجره‌های بازشو را مجاز کنید و دوباره تلاش کنید.",sLe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nLe():t==="fa"?rLe():tLe()}),iLe=()=>"Preparing remote workspace…",aLe=()=>"正在准备远程工作区…",oLe=()=>"در حال آماده‌سازی فضای کاری راه‌دور…",lLe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aLe():t==="fa"?oLe():iLe()}),cLe=()=>"Reconnect",uLe=()=>"重新连接",dLe=()=>"اتصال دوباره",xN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uLe():t==="fa"?dLe():cLe()}),fLe=()=>"The connection dropped. Your remote work remains running while OpenResearch reconnects.",hLe=()=>"连接已中断。OpenResearch 重新连接期间,你的远程工作仍会继续运行。",_Le=()=>"اتصال قطع شد. هنگام اتصال دوبارهٔ OpenResearch، کار راه‌دور شما همچنان اجرا می‌شود.",pLe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hLe():t==="fa"?_Le():fLe()}),mLe=e=>`Reconnecting to ${e==null?void 0:e.host}`,gLe=e=>`正在重新连接到 ${e==null?void 0:e.host}`,vLe=e=>`در حال اتصال دوباره به ${e==null?void 0:e.host}`,bLe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?gLe(e):t==="fa"?vLe(e):mLe(e)}),yLe=()=>"Search SSH hosts",xLe=()=>"搜索 SSH 主机",wLe=()=>"جستجوی میزبان‌های SSH",wN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xLe():t==="fa"?wLe():yLe()}),SLe=e=>`SSH: ${e==null?void 0:e.host}`,kLe=e=>`SSH:${e==null?void 0:e.host}`,CLe=e=>`SSH: ${e==null?void 0:e.host}`,kx=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?kLe(e):t==="fa"?CLe(e):SLe(e)}),ELe=()=>"Start a new OpenResearch host",NLe=()=>"启动新的 OpenResearch 主机",zLe=()=>"راه‌اندازی میزبان جدید OpenResearch",jLe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?NLe():t==="fa"?zLe():ELe()}),TLe=e=>`End ${e==null?void 0:e.count} pending approvals.`,ALe=e=>`结束 ${e==null?void 0:e.count} 个待审批请求。`,RLe=e=>`${e==null?void 0:e.count} تأیید در انتظار را پایان می‌دهد.`,MLe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ALe(e):t==="fa"?RLe(e):TLe(e)}),DLe=()=>"Stop OpenResearch",LLe=()=>"停止 OpenResearch",OLe=()=>"توقف OpenResearch",ILe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LLe():t==="fa"?OLe():DLe()}),BLe=e=>`Stop OpenResearch on ${e==null?void 0:e.host}?`,$Le=e=>`停止 ${e==null?void 0:e.host} 上的 OpenResearch?`,PLe=e=>`OpenResearch روی ${e==null?void 0:e.host} متوقف شود؟`,FLe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?$Le(e):t==="fa"?PLe(e):BLe(e)}),HLe=e=>`Leave ${e==null?void 0:e.count} submitted experiments running.`,qLe=e=>`让 ${e==null?void 0:e.count} 个已提交实验继续运行。`,ULe=e=>`${e==null?void 0:e.count} آزمایش ارسال‌شده را در حال اجرا نگه می‌دارد.`,GLe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?qLe(e):t==="fa"?ULe(e):HLe(e)}),WLe=()=>"Stop OpenResearch on host",VLe=()=>"停止主机上的 OpenResearch",KLe=()=>"توقف OpenResearch روی میزبان",eL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VLe():t==="fa"?KLe():WLe()}),QLe=()=>"This will also:",YLe=()=>"这还将:",XLe=()=>"این کار همچنین:",ZLe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YLe():t==="fa"?XLe():QLe()}),JLe=()=>"End 1 pending approval.",eOe=()=>"结束 1 个待审批请求。",tOe=()=>"۱ تأیید در انتظار را پایان می‌دهد.",nOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eOe():t==="fa"?tOe():JLe()}),rOe=()=>"Leave 1 submitted experiment running.",sOe=()=>"让 1 个已提交实验继续运行。",iOe=()=>"۱ آزمایش ارسال‌شده را در حال اجرا نگه می‌دارد.",aOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sOe():t==="fa"?iOe():rOe()}),oOe=()=>"Disconnect 1 other client.",lOe=()=>"断开 1 个其他客户端。",cOe=()=>"اتصال ۱ کارخواه دیگر را قطع می‌کند.",uOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lOe():t==="fa"?cOe():oOe()}),dOe=()=>"Keep 1 queued message saved.",fOe=()=>"保留 1 条排队消息。",hOe=()=>"۱ پیام در صف را ذخیره نگه می‌دارد.",_Oe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fOe():t==="fa"?hOe():dOe()}),pOe=()=>"Interrupt 1 active agent turn.",mOe=()=>"中断 1 个活动代理任务。",gOe=()=>"۱ نوبت فعال عامل را قطع می‌کند.",vOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mOe():t==="fa"?gOe():pOe()}),bOe=e=>`Disconnect ${e==null?void 0:e.count} other clients.`,yOe=e=>`断开 ${e==null?void 0:e.count} 个其他客户端。`,xOe=e=>`اتصال ${e==null?void 0:e.count} کارخواه دیگر را قطع می‌کند.`,wOe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?yOe(e):t==="fa"?xOe(e):bOe(e)}),SOe=e=>`Keep ${e==null?void 0:e.count} queued messages saved.`,kOe=e=>`保留 ${e==null?void 0:e.count} 条排队消息。`,COe=e=>`${e==null?void 0:e.count} پیام در صف را ذخیره نگه می‌دارد.`,EOe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?kOe(e):t==="fa"?COe(e):SOe(e)}),NOe=e=>`Interrupt ${e==null?void 0:e.count} active agent turns.`,zOe=e=>`中断 ${e==null?void 0:e.count} 个活动代理任务。`,jOe=e=>`${e==null?void 0:e.count} نوبت فعال عامل را قطع می‌کند.`,TOe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?zOe(e):t==="fa"?jOe(e):NOe(e)}),AOe=()=>"Stopping host…",ROe=()=>"正在停止主机…",MOe=()=>"در حال توقف میزبان…",DOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ROe():t==="fa"?MOe():AOe()}),LOe=()=>"Update",OOe=()=>"更新",IOe=()=>"به‌روزرسانی",SN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?OOe():t==="fa"?IOe():LOe()}),BOe=e=>`The OpenResearch installation on ${e==null?void 0:e.host} is not compatible with this dashboard. Update it now?`,$Oe=e=>`${e==null?void 0:e.host} 上的 OpenResearch 与此仪表板不兼容。现在更新吗?`,POe=e=>`نسخهٔ OpenResearch روی ${e==null?void 0:e.host} با این داشبورد سازگار نیست. اکنون به‌روزرسانی شود؟`,FOe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?$Oe(e):t==="fa"?POe(e):BOe(e)}),HOe=()=>"Update OpenResearch?",qOe=()=>"更新 OpenResearch?",UOe=()=>"OpenResearch به‌روزرسانی شود؟",GOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qOe():t==="fa"?UOe():HOe()}),WOe=()=>"Updating…",VOe=()=>"正在更新…",KOe=()=>"در حال به‌روزرسانی…",QOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VOe():t==="fa"?KOe():WOe()}),YOe=()=>"Disable syncing",XOe=()=>"关闭同步",ZOe=()=>"غیرفعال کردن همگام‌سازی",JOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?XOe():t==="fa"?ZOe():YOe()}),eIe=()=>"Enable GitHub syncing",tIe=()=>"启用 GitHub 同步",nIe=()=>"فعال‌سازی همگام‌سازی GitHub",rIe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tIe():t==="fa"?nIe():eIe()}),sIe=()=>"Enabling…",iIe=()=>"正在启用…",aIe=()=>"در حال فعال‌سازی…",oIe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iIe():t==="fa"?aIe():sIe()}),lIe=()=>"Updating…",cIe=()=>"正在更新…",uIe=()=>"در حال به‌روزرسانی…",dIe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cIe():t==="fa"?uIe():lIe()}),fIe=e=>`Retrying · attempt ${e==null?void 0:e.attempt}`,hIe=e=>`正在重试 · 第 ${e==null?void 0:e.attempt} 次`,_Ie=e=>`در حال تلاش دوباره · تلاش ${e==null?void 0:e.attempt}`,pIe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?hIe(e):t==="fa"?_Ie(e):fIe(e)}),mIe=e=>`Retrying · attempt ${e==null?void 0:e.attempt}/${e==null?void 0:e.maximum}`,gIe=e=>`正在重试 · 第 ${e==null?void 0:e.attempt}/${e==null?void 0:e.maximum} 次`,vIe=e=>`در حال تلاش دوباره · تلاش ${e==null?void 0:e.attempt} از ${e==null?void 0:e.maximum}`,bIe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?gIe(e):t==="fa"?vIe(e):mIe(e)}),yIe=e=>`Retrying · attempt ${e==null?void 0:e.attempt}/${e==null?void 0:e.maximum} · next attempt in ${e==null?void 0:e.seconds}s`,xIe=e=>`正在重试 · 第 ${e==null?void 0:e.attempt}/${e==null?void 0:e.maximum} 次 · ${e==null?void 0:e.seconds} 秒后再次尝试`,wIe=e=>`در حال تلاش دوباره · تلاش ${e==null?void 0:e.attempt} از ${e==null?void 0:e.maximum} · تلاش بعدی تا ${e==null?void 0:e.seconds} ثانیه`,SIe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?xIe(e):t==="fa"?wIe(e):yIe(e)}),kIe=e=>`Retrying · attempt ${e==null?void 0:e.attempt} · next attempt in ${e==null?void 0:e.seconds}s`,CIe=e=>`正在重试 · 第 ${e==null?void 0:e.attempt} 次 · ${e==null?void 0:e.seconds} 秒后再次尝试`,EIe=e=>`در حال تلاش دوباره · تلاش ${e==null?void 0:e.attempt} · تلاش بعدی تا ${e==null?void 0:e.seconds} ثانیه`,NIe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?CIe(e):t==="fa"?EIe(e):kIe(e)}),zIe=()=>"CLI is retrying…",jIe=()=>"CLI 正在重试…",TIe=()=>"CLI در حال تلاش دوباره است…",AIe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jIe():t==="fa"?TIe():zIe()}),RIe=e=>`Retrying · next attempt in ${e==null?void 0:e.seconds}s`,MIe=e=>`正在重试 · ${e==null?void 0:e.seconds} 秒后再次尝试`,DIe=e=>`در حال تلاش دوباره · تلاش بعدی تا ${e==null?void 0:e.seconds} ثانیه`,LIe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?MIe(e):t==="fa"?DIe(e):RIe(e)}),OIe=()=>"Sending again…",IIe=()=>"正在重新发送…",BIe=()=>"در حال ارسال دوباره…",$Ie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?IIe():t==="fa"?BIe():OIe()}),PIe=e=>`Sending again in ${e==null?void 0:e.seconds}s…`,FIe=e=>`将在 ${e==null?void 0:e.seconds} 秒后重新发送…`,HIe=e=>`ارسال دوباره تا ${e==null?void 0:e.seconds} ثانیه…`,qIe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?FIe(e):t==="fa"?HIe(e):PIe(e)}),UIe=()=>"Retrying…",GIe=()=>"正在重试…",WIe=()=>"در حال تلاش دوباره…",tL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?GIe():t==="fa"?WIe():UIe()}),VIe=()=>"Default speed",KIe=()=>"默认速度",QIe=()=>"سرعت پیش‌فرض",YIe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KIe():t==="fa"?QIe():VIe()}),XIe=()=>"Standard",ZIe=()=>"标准",JIe=()=>"استاندارد",eBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ZIe():t==="fa"?JIe():XIe()}),tBe=e=>` Add ${e==null?void 0:e.directory} to your PATH to use it.`,nBe=e=>` 请将 ${e==null?void 0:e.directory} 添加到 PATH 后使用。`,rBe=e=>` برای استفاده، ${e==null?void 0:e.directory} را به PATH اضافه کنید.`,sBe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?nBe(e):t==="fa"?rBe(e):tBe(e)}),iBe=()=>"Appearance",aBe=()=>"外观",oBe=()=>"ظاهر",lBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aBe():t==="fa"?oBe():iBe()}),cBe=()=>"Check",uBe=()=>"检查",dBe=()=>"بررسی",fBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uBe():t==="fa"?dBe():cBe()}),hBe=()=>"Check again",_Be=()=>"再次检查",pBe=()=>"بررسی دوباره",Kp=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_Be():t==="fa"?pBe():hBe()}),mBe=()=>"Check for updates",gBe=()=>"检查更新",vBe=()=>"بررسی به‌روزرسانی",bBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gBe():t==="fa"?vBe():mBe()}),yBe=()=>"Check now",xBe=()=>"立即检查",wBe=()=>"اکنون بررسی کن",SBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xBe():t==="fa"?wBe():yBe()}),kBe=()=>"Check setup",CBe=()=>"检查设置",EBe=()=>"بررسی راه‌اندازی",NBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?CBe():t==="fa"?EBe():kBe()}),zBe=()=>"orx checks a few times a day on its own.",jBe=()=>"orx 每天会自动检查几次。",TBe=()=>"orx روزی چند بار خودکار بررسی می‌کند.",ABe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jBe():t==="fa"?TBe():zBe()}),RBe=()=>"Choose a flavor",MBe=()=>"选择配置",DBe=()=>"انتخاب پیکربندی",LBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?MBe():t==="fa"?DBe():RBe()}),OBe=e=>`Choose a flavor to use ${e==null?void 0:e.destination} for new runs.`,IBe=e=>`请选择一个配置,以便新运行使用${e==null?void 0:e.destination}。`,BBe=e=>`برای اجرای کارهای جدید روی ${e==null?void 0:e.destination} یک پیکربندی انتخاب کنید.`,$Be=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?IBe(e):t==="fa"?BBe(e):OBe(e)}),PBe=()=>"clean",FBe=()=>"无更改",HBe=()=>"بدون تغییر",qBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?FBe():t==="fa"?HBe():PBe()}),UBe=e=>`Already linked at ${e==null?void 0:e.link}.`,GBe=e=>`已链接到 ${e==null?void 0:e.link}。`,WBe=e=>`از قبل در ${e==null?void 0:e.link} پیوند شده است.`,VBe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?GBe(e):t==="fa"?WBe(e):UBe(e)}),KBe=e=>`Linked ${e==null?void 0:e.link}.`,QBe=e=>`已链接 ${e==null?void 0:e.link}。`,YBe=e=>`${e==null?void 0:e.link} پیوند شد.`,XBe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?QBe(e):t==="fa"?YBe(e):KBe(e)}),ZBe=()=>"Connect",JBe=()=>"连接",e$e=()=>"اتصال",a6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JBe():t==="fa"?e$e():ZBe()}),t$e=()=>"Connected via GitHub CLI",n$e=()=>"已通过 GitHub CLI 连接",r$e=()=>"از طریق GitHub CLI متصل است",nL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?n$e():t==="fa"?r$e():t$e()}),s$e=()=>"Connecting…",i$e=()=>"正在连接…",a$e=()=>"در حال اتصال…",rL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?i$e():t==="fa"?a$e():s$e()}),o$e=e=>`CPU cores: ${e==null?void 0:e.count}`,l$e=e=>`${e==null?void 0:e.count} 个 CPU 核心`,c$e=e=>`${e==null?void 0:e.count} هستهٔ CPU`,u$e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?l$e(e):t==="fa"?c$e(e):o$e(e)}),d$e=()=>"Create a private repository and automatically push experiment branches for collaborator visibility.",f$e=()=>"创建私有仓库,并自动推送实验分支以便协作者查看。",h$e=()=>"یک مخزن خصوصی بسازید و شاخه‌های آزمایش را برای مشاهدهٔ همکاران به‌طور خودکار پوش کنید.",_$e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?f$e():t==="fa"?h$e():d$e()}),p$e=()=>"the current project",m$e=()=>"当前项目",g$e=()=>"پروژهٔ فعلی",v$e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?m$e():t==="fa"?g$e():p$e()}),b$e=e=>`${e==null?void 0:e.value} (custom)`,y$e=e=>`${e==null?void 0:e.value}(自定义)`,x$e=e=>`${e==null?void 0:e.value} (سفارشی)`,w$e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?y$e(e):t==="fa"?x$e(e):b$e(e)}),S$e=()=>"detached",k$e=()=>"分离头指针",C$e=()=>"جدا از شاخه",o6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?k$e():t==="fa"?C$e():S$e()}),E$e=()=>"Disconnected",N$e=()=>"已断开连接",z$e=()=>"قطع اتصال",sL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?N$e():t==="fa"?z$e():E$e()}),j$e=()=>"Environment tab",T$e=()=>"环境标签页",A$e=()=>"زبانهٔ محیط",R$e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?T$e():t==="fa"?A$e():j$e()}),M$e=e=>`${e==null?void 0:e.branch} · ${e==null?void 0:e.state}`,D$e=e=>`${e==null?void 0:e.branch} · ${e==null?void 0:e.state}`,L$e=e=>`${e==null?void 0:e.branch} · ${e==null?void 0:e.state}`,O$e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?D$e(e):t==="fa"?L$e(e):M$e(e)}),I$e=()=>"GitHub rejected the push because this repository is archived and read-only. The local project is still available. Unarchive the repository on GitHub, then enable syncing here.",B$e=()=>"GitHub 拒绝了推送,因为此仓库已归档且为只读。你的本地项目仍然可用。请在 GitHub 上取消归档该仓库,然后在此处启用同步。",$$e=()=>"GitHub پوش را نپذیرفت، چون این مخزن بایگانی‌شده و فقط‌خواندنی است. پروژهٔ محلی همچنان در دسترس است. مخزن را در GitHub از بایگانی خارج کنید و سپس همگام‌سازی را اینجا فعال کنید.",P$e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?B$e():t==="fa"?$$e():I$e()}),F$e=()=>"GitHub contains changes that are not in this local project. Pull the latest GitHub changes and resolve any conflicts in Git, then try enabling syncing again.",H$e=()=>"GitHub 上有本地项目中不存在的更改。请拉取 GitHub 上的最新更改,在 Git 中解决冲突,然后再次尝试启用同步。",q$e=()=>"GitHub تغییراتی دارد که در پروژهٔ محلی نیست. تازه‌ترین تغییرات GitHub را دریافت و تعارض‌ها را در Git حل کنید، سپس دوباره همگام‌سازی را فعال کنید.",U$e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?H$e():t==="fa"?q$e():F$e()}),G$e=()=>"GitHub rejected the push. Make sure your connected account has write access to this repository, then try again.",W$e=()=>"GitHub 拒绝了推送。请确认已连接的账户对此仓库有写入权限,然后重试。",V$e=()=>"GitHub پوش را نپذیرفت. مطمئن شوید حساب متصل اجازهٔ نوشتن در این مخزن را دارد و دوباره تلاش کنید.",K$e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?W$e():t==="fa"?V$e():G$e()}),Q$e=e=>`GPU × ${e==null?void 0:e.count}`,Y$e=e=>`${e==null?void 0:e.count} 个 GPU`,X$e=e=>`${e==null?void 0:e.count} پردازندهٔ گرافیکی`,Z$e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Y$e(e):t==="fa"?X$e(e):Q$e(e)}),J$e=()=>"has changes",ePe=()=>"有更改",tPe=()=>"دارای تغییر",nPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ePe():t==="fa"?tPe():J$e()}),rPe=e=>`This token is valid but does not report whether it can launch Jobs; OAuth tokens from ${e==null?void 0:e.login} never do. Launches may still work. For a definitive check, save a write-scoped token from ${e==null?void 0:e.url}.`,sPe=e=>`此令牌有效,但不会报告能否启动 Jobs;来自 ${e==null?void 0:e.login} 的 OAuth 令牌从不提供该信息。启动仍可能成功。如需最终确认,请从 ${e==null?void 0:e.url} 保存具有写入权限的令牌。`,iPe=e=>`این توکن معتبر است، اما مشخص نمی‌کند که می‌تواند Jobs را اجرا کند؛ توکن‌های OAuth از ${e==null?void 0:e.login} هرگز چنین اطلاعاتی نمی‌دهند. اجراها ممکن است کار کنند. برای بررسی قطعی، یک توکن دارای مجوز نوشتن از ${e==null?void 0:e.url} ذخیره کنید.`,aPe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?sPe(e):t==="fa"?iPe(e):rPe(e)}),oPe=()=>"This token is valid, but cannot submit Hugging Face Jobs. Create a token with Jobs write permission in Hugging Face token settings, then replace it here.",lPe=()=>"此令牌有效,但无法提交 Hugging Face 任务。请在 Hugging Face 令牌设置中创建具有 Jobs 写入权限的令牌,然后在此处替换。",cPe=()=>"این توکن معتبر است، اما اجازهٔ ارسال کار به Hugging Face را ندارد. در تنظیمات توکن Hugging Face، توکنی با مجوز نوشتن Jobs بسازید و آن را اینجا جایگزین کنید.",uPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lPe():t==="fa"?cPe():oPe()}),dPe=()=>"Install",fPe=()=>"安装",hPe=()=>"نصب",_Pe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fPe():t==="fa"?hPe():dPe()}),pPe=e=>`Adds ${e==null?void 0:e.command} to your terminal, pointing at this app, so the CLI and app are always the same version.`,mPe=e=>`将 ${e==null?void 0:e.command} 添加到终端并指向此应用,使 CLI 和应用始终使用同一版本。`,gPe=e=>`فرمان ${e==null?void 0:e.command} را به ترمینال شما و با اشاره به این برنامه اضافه می‌کند تا CLI و برنامه همیشه یک نسخه باشند.`,vPe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?mPe(e):t==="fa"?gPe(e):pPe(e)}),bPe=e=>`Install the ${e==null?void 0:e.command} command`,yPe=e=>`安装 ${e==null?void 0:e.command} 命令`,xPe=e=>`نصب فرمان ${e==null?void 0:e.command}`,wPe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?yPe(e):t==="fa"?xPe(e):bPe(e)}),SPe=()=>"Install GitHub CLI, then run `gh auth login` in your terminal.",kPe=()=>"请安装 GitHub CLI,然后在终端中运行 `gh auth login`。",CPe=()=>"GitHub CLI را نصب کنید و سپس در پایانه `gh auth login` را اجرا کنید.",EPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kPe():t==="fa"?CPe():SPe()}),NPe=()=>"Install the new release now instead of waiting for the background update.",zPe=()=>"立即安装新版本,无需等待后台更新。",jPe=()=>"نسخهٔ جدید را اکنون نصب کنید و منتظر به‌روزرسانی پس‌زمینه نمانید.",TPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zPe():t==="fa"?jPe():NPe()}),APe=()=>"Discard your unsaved Kubernetes changes?",RPe=()=>"要放弃未保存的 Kubernetes 更改吗?",MPe=()=>"تغییرات ذخیره‌نشدهٔ Kubernetes کنار گذاشته شود؟",DPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?RPe():t==="fa"?MPe():APe()}),LPe=()=>"Key from",OPe=()=>"密钥来自",IPe=()=>"کلید از",BPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?OPe():t==="fa"?IPe():LPe()}),$Pe=()=>"Use current kubectl context",PPe=()=>"使用当前 kubectl 上下文",FPe=()=>"استفاده از کانتکست فعلی kubectl",HPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?PPe():t==="fa"?FPe():$Pe()}),qPe=e=>`Use current context (${e==null?void 0:e.context})`,UPe=e=>`使用当前上下文(${e==null?void 0:e.context})`,GPe=e=>`استفاده از کانتکست فعلی (${e==null?void 0:e.context})`,WPe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?UPe(e):t==="fa"?GPe(e):qPe(e)}),VPe=()=>"Language",KPe=()=>"语言",QPe=()=>"زبان",YPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KPe():t==="fa"?QPe():VPe()}),XPe=e=>`Run ${e==null?void 0:e.command} in a terminal to sign in.`,ZPe=e=>`在终端中运行 ${e==null?void 0:e.command} 以登录。`,JPe=e=>`برای ورود، ${e==null?void 0:e.command} را در ترمینال اجرا کنید.`,eFe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ZPe(e):t==="fa"?JPe(e):XPe(e)}),tFe=()=>"Make default",nFe=()=>"设为默认值",rFe=()=>"پیش‌فرض شود",sFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nFe():t==="fa"?rFe():tFe()}),iFe=()=>"Modal credentials are set in the process environment. Remove those overrides before replacing the token here.",aFe=()=>"Modal 凭据已在进程环境中设置。请先移除这些覆盖设置,再在此处替换令牌。",oFe=()=>"اعتبارنامه‌های Modal در محیط فرایند تنظیم شده‌اند. پیش از جایگزینی توکن در اینجا، این تنظیمات را حذف کنید.",lFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aFe():t==="fa"?oFe():iFe()}),cFe=()=>"Replace token ID",uFe=()=>"替换令牌 ID",dFe=()=>"جایگزینی شناسهٔ توکن",fFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uFe():t==="fa"?dFe():cFe()}),hFe=()=>"Replace token secret",_Fe=()=>"替换令牌密钥",pFe=()=>"جایگزینی رمز توکن",mFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_Fe():t==="fa"?pFe():hFe()}),gFe=()=>"How to get a Modal token",vFe=()=>"如何获取 Modal 令牌",bFe=()=>"روش دریافت توکن Modal",yFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vFe():t==="fa"?bFe():gFe()}),xFe=()=>"Token ID",wFe=()=>"令牌 ID",SFe=()=>"شناسهٔ توکن",kFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wFe():t==="fa"?SFe():xFe()}),CFe=()=>"Token secret",EFe=()=>"令牌密钥",NFe=()=>"رمز توکن",zFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?EFe():t==="fa"?NFe():CFe()}),jFe=e=>`${e==null?void 0:e.count} models available — ${e==null?void 0:e.models}`,TFe=e=>`${e==null?void 0:e.count} 个模型可用 — ${e==null?void 0:e.models}`,AFe=e=>`${e==null?void 0:e.count} مدل در دسترس — ${e==null?void 0:e.models}`,iL=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?TFe(e):t==="fa"?AFe(e):jFe(e)}),RFe=e=>`Needs ${e==null?void 0:e.tool}`,MFe=e=>`需要 ${e==null?void 0:e.tool}`,DFe=e=>`به ${e==null?void 0:e.tool} نیاز دارد`,LFe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?MFe(e):t==="fa"?DFe(e):RFe(e)}),OFe=()=>"Needs tools",IFe=()=>"缺少工具",BFe=()=>"به ابزارها نیاز دارد",$Fe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?IFe():t==="fa"?BFe():OFe()}),PFe=e=>`New runs use ${e==null?void 0:e.destination} unless another backend is specified.`,FFe=e=>`除非另行指定后端,否则新运行将使用${e==null?void 0:e.destination}。`,HFe=e=>`اجراهای جدید از ${e==null?void 0:e.destination} استفاده می‌کنند، مگر اینکه سامانهٔ دیگری مشخص شود.`,qFe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?FFe(e):t==="fa"?HFe(e):PFe(e)}),UFe=()=>"New runs use SSH; choose a host when launching.",GFe=()=>"新运行将使用 SSH;启动时请选择主机。",WFe=()=>"اجراهای جدید از SSH استفاده می‌کنند؛ هنگام اجرا یک میزبان انتخاب کنید.",VFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?GFe():t==="fa"?WFe():UFe()}),KFe=()=>"New token",QFe=()=>"新令牌",YFe=()=>"توکن جدید",XFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?QFe():t==="fa"?YFe():KFe()}),ZFe=()=>"No default flavor",JFe=()=>"不设默认配置",eHe=()=>"بدون پیکربندی پیش‌فرض",tHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JFe():t==="fa"?eHe():ZFe()}),nHe=()=>"none",rHe=()=>"无",sHe=()=>"هیچ‌کدام",l6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rHe():t==="fa"?sHe():nHe()}),iHe=()=>"Not connected",aHe=()=>"未连接",oHe=()=>"متصل نیست",aL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aHe():t==="fa"?oHe():iHe()}),lHe=()=>"not found on PATH",cHe=()=>"在 PATH 中未找到",uHe=()=>"در PATH پیدا نشد",dHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cHe():t==="fa"?uHe():lHe()}),fHe=e=>`${e==null?void 0:e.context} (not in kubeconfig)`,hHe=e=>`${e==null?void 0:e.context}(不在 kubeconfig 中)`,_He=e=>`${e==null?void 0:e.context} (در kubeconfig نیست)`,pHe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?hHe(e):t==="fa"?_He(e):fHe(e)}),mHe=()=>"not initialized",gHe=()=>"尚未初始化",vHe=()=>"راه‌اندازی نشده",bHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gHe():t==="fa"?vHe():mHe()}),yHe=()=>"Not set",xHe=()=>"未设置",wHe=()=>"تنظیم نشده",T4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xHe():t==="fa"?wHe():yHe()}),SHe=()=>"OAuth (subscription login)",kHe=()=>"OAuth(订阅登录)",CHe=()=>"OAuth (ورود با اشتراک)",EHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kHe():t==="fa"?CHe():SHe()}),NHe=e=>`The old copy was left at ${e==null?void 0:e.path} on a different disk. You can delete it after confirming everything works.`,zHe=e=>`旧副本保留在另一磁盘的 ${e==null?void 0:e.path}。确认一切正常后即可删除。`,jHe=e=>`نسخهٔ قدیمی در ${e==null?void 0:e.path} روی دیسکی دیگر باقی ماند. پس از اطمینان از درست کار کردن همه‌چیز می‌توانید آن را حذف کنید.`,THe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?zHe(e):t==="fa"?jHe(e):NHe(e)}),AHe=()=>"Setting up…",RHe=()=>"正在设置…",MHe=()=>"در حال راه‌اندازی…",DHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?RHe():t==="fa"?MHe():AHe()}),LHe=()=>"Account",OHe=()=>"账户",IHe=()=>"حساب",c6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?OHe():t==="fa"?IHe():LHe()}),BHe=()=>"Add one with",$He=()=>"使用以下命令添加:",PHe=()=>"یکی با این فرمان اضافه کنید:",FHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$He():t==="fa"?PHe():BHe()}),HHe=()=>"Add variable",qHe=()=>"添加变量",UHe=()=>"افزودن متغیر",GHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qHe():t==="fa"?UHe():HHe()}),WHe=()=>"Agent models",VHe=()=>"智能体模型",KHe=()=>"مدل‌های عامل",QHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VHe():t==="fa"?KHe():WHe()}),YHe=()=>"Anonymous usage analytics",XHe=()=>"匿名使用情况分析",ZHe=()=>"تحلیل ناشناس استفاده",kN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?XHe():t==="fa"?ZHe():YHe()}),JHe=()=>"Auth",eqe=()=>"身份验证",tqe=()=>"احراز هویت",nqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eqe():t==="fa"?tqe():JHe()}),rqe=()=>"Authentication",sqe=()=>"身份验证",iqe=()=>"احراز هویت",oL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sqe():t==="fa"?iqe():rqe()}),aqe=()=>"Back to Compute",oqe=()=>"返回算力设置",lqe=()=>"بازگشت به رایانش",lL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oqe():t==="fa"?lqe():aqe()}),cqe=()=>"Backend",uqe=()=>"后端",dqe=()=>"بک‌اند",fqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uqe():t==="fa"?dqe():cqe()}),hqe=()=>"Baseline",_qe=()=>"基线",pqe=()=>"خط مبنا",mqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_qe():t==="fa"?pqe():hqe()}),gqe=()=>"Binary",vqe=()=>"可执行文件",bqe=()=>"فایل اجرایی",yqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vqe():t==="fa"?bqe():gqe()}),xqe=()=>"Cancel",wqe=()=>"取消",Sqe=()=>"لغو",Ad=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wqe():t==="fa"?Sqe():xqe()}),kqe=()=>"Cancel new variable",Cqe=()=>"取消新变量",Eqe=()=>"لغو متغیر جدید",Nqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cqe():t==="fa"?Eqe():kqe()}),zqe=()=>"Checking compute targets…",jqe=()=>"正在检查算力目标…",Tqe=()=>"در حال بررسی مقصدهای رایانشی…",Aqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jqe():t==="fa"?Tqe():zqe()}),Rqe=()=>"Checking kubectl…",Mqe=()=>"正在检查 kubectl…",Dqe=()=>"در حال بررسی kubectl…",Lqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Mqe():t==="fa"?Dqe():Rqe()}),Oqe=()=>"Checking Modal…",Iqe=()=>"正在检查 Modal…",Bqe=()=>"در حال بررسی Modal…",$qe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Iqe():t==="fa"?Bqe():Oqe()}),Pqe=()=>"Choose a preset flavor",Fqe=()=>"选择预设规格",Hqe=()=>"یک پیکربندی آماده انتخاب کنید",CN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Fqe():t==="fa"?Hqe():Pqe()}),qqe=()=>"cluster default",Uqe=()=>"集群默认值",Gqe=()=>"پیش‌فرض خوشه",EN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Uqe():t==="fa"?Gqe():qqe()}),Wqe=()=>"cluster default (e.g. 4h, 30m)",Vqe=()=>"集群默认值(例如 4h、30m)",Kqe=()=>"پیش‌فرض خوشه (مثلاً 4h یا 30m)",Qqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vqe():t==="fa"?Kqe():Wqe()}),Yqe=()=>"Cluster unreachable",Xqe=()=>"无法连接集群",Zqe=()=>"خوشه در دسترس نیست",Jqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xqe():t==="fa"?Zqe():Yqe()}),eUe=()=>"Compute",tUe=()=>"算力",nUe=()=>"رایانش",cL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tUe():t==="fa"?nUe():eUe()}),rUe=()=>"Connect compute backends and choose where new runs execute.",sUe=()=>"连接算力后端,并选择新运行的执行位置。",iUe=()=>"backendهای رایانشی را متصل و محل اجرای کارهای جدید را انتخاب کنید.",aUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sUe():t==="fa"?iUe():rUe()}),oUe=()=>"Connected",lUe=()=>"已连接",cUe=()=>"متصل",uUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lUe():t==="fa"?cUe():oUe()}),dUe=()=>"Context",fUe=()=>"上下文",hUe=()=>"زمینه",_Ue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fUe():t==="fa"?hUe():dUe()}),pUe=()=>"Current",mUe=()=>"当前",gUe=()=>"فعلی",vUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mUe():t==="fa"?gUe():pUe()}),bUe=()=>"Currently off:",yUe=()=>"当前已关闭:",xUe=()=>"اکنون خاموش است:",wUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yUe():t==="fa"?xUe():bUe()}),SUe=()=>"Custom flavor",kUe=()=>"自定义规格",CUe=()=>"پیکربندی سفارشی",EUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kUe():t==="fa"?CUe():SUe()}),NUe=()=>"Custom flavor…",zUe=()=>"自定义规格…",jUe=()=>"پیکربندی سفارشی…",TUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zUe():t==="fa"?jUe():NUe()}),AUe=()=>"Data directory",RUe=()=>"数据目录",MUe=()=>"پوشهٔ داده",DUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?RUe():t==="fa"?MUe():AUe()}),LUe=()=>"default",OUe=()=>"默认",IUe=()=>"پیش‌فرض",BUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?OUe():t==="fa"?IUe():LUe()}),$Ue=()=>"Default",PUe=()=>"默认",FUe=()=>"پیش‌فرض",uL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?PUe():t==="fa"?FUe():$Ue()}),HUe=()=>"Default destination",qUe=()=>"默认目标",UUe=()=>"مقصد پیش‌فرض",GUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qUe():t==="fa"?UUe():HUe()}),WUe=()=>"Detecting hardware…",VUe=()=>"正在检测硬件…",KUe=()=>"در حال شناسایی سخت‌افزار…",QUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VUe():t==="fa"?KUe():WUe()}),YUe=()=>"Detecting harnesses…",XUe=()=>"正在检测智能体工具…",ZUe=()=>"در حال شناسایی ابزارهای عامل…",JUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?XUe():t==="fa"?ZUe():YUe()}),eGe=()=>"Disabling syncing stops automatic pushes. Compute continues to use direct source snapshots. This does not delete the GitHub repository or code already pushed.",tGe=()=>"关闭同步会停止自动推送。算力执行仍使用直接的源代码快照。此操作不会删除 GitHub 仓库或已推送的代码。",nGe=()=>"خاموش کردن همگام‌سازی، push خودکار را متوقف می‌کند. رایانش همچنان از snapshot مستقیم منبع استفاده می‌کند. این کار مخزن GitHub یا کدهای ازپیش pushشده را حذف نمی‌کند.",rGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tGe():t==="fa"?nGe():eGe()}),sGe=()=>"Effective URL",iGe=()=>"实际使用的网址",aGe=()=>"نشانی مؤثر",oGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iGe():t==="fa"?aGe():sGe()}),lGe=()=>"Enable GitHub syncing for new projects",cGe=()=>"为新项目启用 GitHub 同步",uGe=()=>"فعال‌سازی همگام‌سازی GitHub برای پروژه‌های جدید",NN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cGe():t==="fa"?uGe():lGe()}),dGe=()=>"Environment",fGe=()=>"环境",hGe=()=>"محیط",dL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fGe():t==="fa"?hGe():dGe()}),_Ge=()=>"Failed",pGe=()=>"失败",mGe=()=>"ناموفق",u6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pGe():t==="fa"?mGe():_Ge()}),gGe=()=>"General",vGe=()=>"常规",bGe=()=>"عمومی",yGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vGe():t==="fa"?bGe():gGe()}),xGe=()=>"GitHub publishing",wGe=()=>"GitHub 发布",SGe=()=>"انتشار در GitHub",kGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wGe():t==="fa"?SGe():xGe()}),CGe=()=>"Git token",EGe=()=>"Git 令牌",NGe=()=>"توکن Git",zGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?EGe():t==="fa"?NGe():CGe()}),jGe=()=>"Harnesses",TGe=()=>"智能体工具",AGe=()=>"ابزارهای عامل",RGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?TGe():t==="fa"?AGe():jGe()}),MGe=()=>"hf_…",DGe=()=>"hf_…",LGe=()=>"hf_…",OGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?DGe():t==="fa"?LGe():MGe()}),IGe=()=>"HF_TOKEN is set in the environment and overrides any token saved here.",BGe=()=>"环境中已设置 HF_TOKEN,它会覆盖此处保存的令牌。",$Ge=()=>"مقدار HF_TOKEN در محیط تنظیم شده و هر توکن ذخیره‌شده در اینجا را بازنویسی می‌کند.",PGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BGe():t==="fa"?$Ge():IGe()}),FGe=()=>"Initialize Git",HGe=()=>"初始化 Git",qGe=()=>"راه‌اندازی Git",UGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HGe():t==="fa"?qGe():FGe()}),GGe=()=>"Install",WGe=()=>"安装",VGe=()=>"نصب",fL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WGe():t==="fa"?VGe():GGe()}),KGe=()=>"Install broken",QGe=()=>"安装损坏",YGe=()=>"نصب خراب است",XGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?QGe():t==="fa"?YGe():KGe()}),ZGe=()=>"Install GitHub CLI",JGe=()=>"安装 GitHub CLI",eWe=()=>"نصب GitHub CLI",tWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JGe():t==="fa"?eWe():ZGe()}),nWe=()=>"Install updates automatically",rWe=()=>"自动安装更新",sWe=()=>"نصب خودکار به‌روزرسانی‌ها",zN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rWe():t==="fa"?sWe():nWe()}),iWe=()=>"Instance history",aWe=()=>"实例历史",oWe=()=>"تاریخچهٔ نمونه‌ها",lWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aWe():t==="fa"?oWe():iWe()}),cWe=()=>"Invalid Token",uWe=()=>"令牌无效",dWe=()=>"توکن نامعتبر",fWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uWe():t==="fa"?dWe():cWe()}),hWe=()=>"Jobs / Dashboard URL",_We=()=>"Jobs / 控制台网址",pWe=()=>"نشانی Jobs / داشبورد",mWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_We():t==="fa"?pWe():hWe()}),gWe=()=>"kubectl not found",vWe=()=>"未找到 kubectl",bWe=()=>"kubectl پیدا نشد",yWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vWe():t==="fa"?bWe():gWe()}),xWe=()=>"Latest",wWe=()=>"最新版本",SWe=()=>"جدیدترین",kWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wWe():t==="fa"?SWe():xWe()}),CWe=()=>"Loading…",EWe=()=>"正在加载…",NWe=()=>"در حال بارگیری…",yu=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?EWe():t==="fa"?NWe():CWe()}),zWe=()=>"Loading Ray settings…",jWe=()=>"正在加载 Ray 设置…",TWe=()=>"در حال بارگیری تنظیمات Ray…",AWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jWe():t==="fa"?TWe():zWe()}),RWe=()=>"Loading slurm settings…",MWe=()=>"正在加载 Slurm 设置…",DWe=()=>"در حال بارگیری تنظیمات Slurm…",LWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?MWe():t==="fa"?DWe():RWe()}),OWe=()=>"Loading status…",IWe=()=>"正在加载状态…",BWe=()=>"در حال بارگیری وضعیت…",$We=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?IWe():t==="fa"?BWe():OWe()}),PWe=()=>"Local only",FWe=()=>"仅本地",HWe=()=>"فقط محلی",qWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?FWe():t==="fa"?HWe():PWe()}),UWe=()=>"Local repository",GWe=()=>"本地仓库",WWe=()=>"مخزن محلی",VWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?GWe():t==="fa"?WWe():UWe()}),KWe=()=>"Login node",QWe=()=>"登录节点",YWe=()=>"گرهٔ ورود",XWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?QWe():t==="fa"?YWe():KWe()}),ZWe=()=>"Make GitHub syncing the default?",JWe=()=>"将 GitHub 同步设为默认值?",eVe=()=>"همگام‌سازی GitHub پیش‌فرض شود؟",tVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JWe():t==="fa"?eVe():ZWe()}),nVe=()=>"Missing bash/tar",rVe=()=>"缺少 bash/tar",sVe=()=>"bash/tar موجود نیست",iVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rVe():t==="fa"?sVe():nVe()}),aVe=()=>"More compute options",oVe=()=>"更多算力选项",lVe=()=>"گزینه‌های رایانشی بیشتر",cVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oVe():t==="fa"?lVe():aVe()}),uVe=()=>"Move failed:",dVe=()=>"移动失败:",fVe=()=>"انتقال ناموفق بود:",hVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dVe():t==="fa"?fVe():uVe()}),_Ve=()=>"Moved. orx is now using the new location.",pVe=()=>"已移动。orx 现在使用新位置。",mVe=()=>"منتقل شد. orx اکنون از محل جدید استفاده می‌کند.",gVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pVe():t==="fa"?mVe():_Ve()}),vVe=()=>"Namespace",bVe=()=>"命名空间",yVe=()=>"فضای نام",xVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bVe():t==="fa"?yVe():vVe()}),wVe=()=>"New location",SVe=()=>"新位置",kVe=()=>"محل جدید",CVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?SVe():t==="fa"?kVe():wVe()}),EVe=()=>"New releases are downloaded and installed in the background. Turning this off keeps the notice but leaves the install to you.",NVe=()=>"新版本会在后台下载并安装。关闭后仍会显示通知,但需要手动安装。",zVe=()=>"نسخه‌های جدید در پس‌زمینه دریافت و نصب می‌شوند. خاموش کردن این گزینه اعلان را نگه می‌دارد، اما نصب را به شما می‌سپارد.",jVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?NVe():t==="fa"?zVe():EVe()}),TVe=()=>"New variable key",AVe=()=>"新变量键名",RVe=()=>"کلید متغیر جدید",MVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?AVe():t==="fa"?RVe():TVe()}),DVe=()=>"New variable value",LVe=()=>"新变量值",OVe=()=>"مقدار متغیر جدید",IVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LVe():t==="fa"?OVe():DVe()}),BVe=()=>"No code, prompts, file contents, or account identifiers are sent.",$Ve=()=>"不会发送代码、提示词、文件内容或账户标识符。",PVe=()=>"هیچ کد، پرامپت، محتوای فایل یا شناسهٔ حسابی ارسال نمی‌شود.",FVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$Ve():t==="fa"?PVe():BVe()}),HVe=()=>"No hosts found in ~/.ssh/config.",qVe=()=>"在 ~/.ssh/config 中未找到主机。",UVe=()=>"میزبانی در ‎~/.ssh/config پیدا نشد.",GVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qVe():t==="fa"?UVe():HVe()}),WVe=()=>"No job-create permission",VVe=()=>"没有创建 Job 的权限",KVe=()=>"مجوز ساخت Job وجود ندارد",QVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VVe():t==="fa"?KVe():WVe()}),YVe=()=>"No Write Permissions",XVe=()=>"无写入权限",ZVe=()=>"بدون مجوز نوشتن",JVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?XVe():t==="fa"?ZVe():YVe()}),eKe=()=>"No key on this computer to register — load a registered key with",tKe=()=>"此计算机上没有可注册的密钥——使用以下命令加载已注册的密钥:",nKe=()=>"کلیدی برای ثبت روی این رایانه نیست — کلید ثبت‌شده را با این فرمان بار کنید:",rKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tKe():t==="fa"?nKe():eKe()}),sKe=()=>"No key on this computer yet — create one with",iKe=()=>"此计算机上还没有密钥——使用以下命令创建:",aKe=()=>"هنوز کلیدی روی این رایانه نیست — با این فرمان یکی بسازید:",oKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iKe():t==="fa"?aKe():sKe()}),lKe=()=>"No Slurm CLI",cKe=()=>"无 Slurm CLI",uKe=()=>"بدون CLI اسلورم",dKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cKe():t==="fa"?uKe():lKe()}),fKe=()=>"None registered",hKe=()=>"未注册任何密钥",_Ke=()=>"هیچ‌کدام ثبت نشده",pKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hKe():t==="fa"?_Ke():fKe()}),mKe=()=>"Not checked",gKe=()=>"未检查",vKe=()=>"بررسی نشده",hL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gKe():t==="fa"?vKe():mKe()}),bKe=()=>"Not configured",yKe=()=>"未配置",xKe=()=>"پیکربندی نشده",Jv=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yKe():t==="fa"?xKe():bKe()}),wKe=()=>"Not installed",SKe=()=>"未安装",kKe=()=>"نصب نیست",CKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?SKe():t==="fa"?kKe():wKe()}),EKe=()=>"Not now",NKe=()=>"暂不",zKe=()=>"اکنون نه",jKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?NKe():t==="fa"?zKe():EKe()}),TKe=()=>"Not on this computer",AKe=()=>"不在此计算机上",RKe=()=>"روی این رایانه نیست",MKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?AKe():t==="fa"?RKe():TKe()}),DKe=()=>"Not set (pass --host per launch)",LKe=()=>"未设置(每次启动时传入 --host)",OKe=()=>"تنظیم نشده (در هر اجرا ‎--host بدهید)",IKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LKe():t==="fa"?OKe():DKe()}),BKe=()=>"Not signed in",$Ke=()=>"未登录",PKe=()=>"وارد نشده",_L=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$Ke():t==="fa"?PKe():BKe()}),FKe=()=>"On this computer",HKe=()=>"在此计算机上",qKe=()=>"روی این رایانه",UKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HKe():t==="fa"?qKe():FKe()}),GKe=()=>"Open a project to inspect its repository and GitHub publication state.",WKe=()=>"打开项目以查看其仓库和 GitHub 发布状态。",VKe=()=>"پروژه‌ای را باز کنید تا مخزن و وضعیت انتشار GitHub آن را ببینید.",KKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WKe():t==="fa"?VKe():GKe()}),QKe=()=>"Open job page",YKe=()=>"打开作业页面",XKe=()=>"باز کردن صفحهٔ کار",jN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YKe():t==="fa"?XKe():QKe()}),ZKe=()=>"Open on GitHub",JKe=()=>"在 GitHub 上打开",eQe=()=>"باز کردن در GitHub",TN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JKe():t==="fa"?eQe():ZKe()}),tQe=()=>", or create one with",nQe=()=>",或使用以下命令创建:",rQe=()=>"، یا با این فرمان یکی بسازید:",sQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nQe():t==="fa"?rQe():tQe()}),iQe=()=>"Org",aQe=()=>"组织",oQe=()=>"سازمان",lQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aQe():t==="fa"?oQe():iQe()}),cQe=()=>"Orgs",uQe=()=>"组织",dQe=()=>"سازمان‌ها",fQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uQe():t==="fa"?dQe():cQe()}),hQe=()=>"orx can't update this install",_Qe=()=>"orx 无法更新此安装",pQe=()=>"orx نمی‌تواند این نصب را به‌روزرسانی کند",mQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_Qe():t==="fa"?pQe():hQe()}),gQe=()=>"Overleaf",vQe=()=>"Overleaf",bQe=()=>"Overleaf",pL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vQe():t==="fa"?bQe():gQe()}),yQe=()=>"Overleaf Git authentication token",xQe=()=>"Overleaf Git 身份验证令牌",wQe=()=>"توکن احراز هویت Git در Overleaf",SQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xQe():t==="fa"?wQe():yQe()}),kQe=()=>"Overridden by env",CQe=()=>"已被环境变量覆盖",EQe=()=>"بازنویسی‌شده توسط محیط",NQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?CQe():t==="fa"?EQe():kQe()}),zQe=()=>"Partition",jQe=()=>"分区",TQe=()=>"پارتیشن",AQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jQe():t==="fa"?TQe():zQe()}),RQe=()=>"Path",MQe=()=>"路径",DQe=()=>"مسیر",LQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?MQe():t==="fa"?DQe():RQe()}),OQe=()=>"Plan",IQe=()=>"方案",BQe=()=>"سطح اشتراک",$Qe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?IQe():t==="fa"?BQe():OQe()}),PQe=()=>"Project",FQe=()=>"项目",HQe=()=>"پروژه",qQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?FQe():t==="fa"?HQe():PQe()}),UQe=()=>"Ray version",GQe=()=>"Ray 版本",WQe=()=>"نسخهٔ Ray",VQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?GQe():t==="fa"?WQe():UQe()}),KQe=()=>"Reachable",QQe=()=>"可访问",YQe=()=>"در دسترس",XQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?QQe():t==="fa"?YQe():KQe()}),ZQe=()=>"Reading ~/.ssh/config…",JQe=()=>"正在读取 ~/.ssh/config…",eYe=()=>"در حال خواندن ‎~/.ssh/config…",mL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JQe():t==="fa"?eYe():ZQe()}),tYe=()=>"Ready",nYe=()=>"就绪",rYe=()=>"آماده",Qp=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nYe():t==="fa"?rYe():tYe()}),sYe=()=>"Ready to move",iYe=()=>"可以移动",aYe=()=>"آمادهٔ انتقال",oYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iYe():t==="fa"?aYe():sYe()}),lYe=()=>"Configured",cYe=()=>"已配置",uYe=()=>"پیکربندی‌شده",d6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cYe():t==="fa"?uYe():lYe()}),dYe=()=>"Refresh",fYe=()=>"刷新",hYe=()=>"تازه‌سازی",Yp=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fYe():t==="fa"?hYe():dYe()}),_Ye=()=>"Remotes",pYe=()=>"远程仓库",mYe=()=>"مخزن‌های دوردست",gYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pYe():t==="fa"?mYe():_Ye()}),vYe=()=>"Repository",bYe=()=>"仓库",yYe=()=>"مخزن",xYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bYe():t==="fa"?yYe():vYe()}),wYe=()=>"Restart to finish updating",SYe=()=>"重新启动以完成更新",kYe=()=>"برای تکمیل به‌روزرسانی، دوباره راه‌اندازی کنید",CYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?SYe():t==="fa"?kYe():wYe()}),EYe=()=>"Running instances",NYe=()=>"正在运行的实例",zYe=()=>"نمونه‌های در حال اجرا",jYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?NYe():t==="fa"?zYe():EYe()}),TYe=()=>"Runtime",AYe=()=>"运行时间",RYe=()=>"زمان اجرا",MYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?AYe():t==="fa"?RYe():TYe()}),DYe=()=>". Save it under that key if it's meant for HF Jobs.",LYe=()=>"读取它。如果它用于 HF Jobs,请以该键名保存。",OYe=()=>"می‌خوانند. اگر برای HF Jobs است، آن را با همان کلید ذخیره کنید.",IYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LYe():t==="fa"?OYe():DYe()}),BYe=()=>"Session cookie",$Ye=()=>"会话 cookie",PYe=()=>"کوکی نشست",FYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$Ye():t==="fa"?PYe():BYe()}),HYe=()=>"With a session cookie saved, a linked paper follows Overleaf as people type and sends saves straight back. Figures still move on the slower Git sync. Copy the overleaf_session2 cookie from a browser signed in to Overleaf; it stops working when that sign-in does.",qYe=()=>"保存会话 cookie 后,已关联的论文会在他人输入时实时跟随 Overleaf,并立即回传保存;图片仍通过较慢的 Git 同步传输。请从已登录 Overleaf 的浏览器复制 overleaf_session2 cookie;该登录失效后它也会失效。",UYe=()=>"با ذخیرهٔ کوکی نشست، مقالهٔ پیوندشده هنگام تایپ دیگران Overleaf را زنده دنبال می‌کند و ذخیره‌ها را مستقیماً برمی‌گرداند؛ تصویرها همچنان با همگام‌سازی کندتر Git جابه‌جا می‌شوند. کوکی overleaf_session2 را از مرورگری که به Overleaf وارد شده کپی کنید؛ با پایان آن ورود، کوکی هم از کار می‌افتد.",GYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qYe():t==="fa"?UYe():HYe()}),WYe=()=>"Settings",VYe=()=>"设置",KYe=()=>"تنظیمات",f6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VYe():t==="fa"?KYe():WYe()}),QYe=()=>"Signed in",YYe=()=>"已登录",XYe=()=>"وارد شده",ZYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YYe():t==="fa"?XYe():QYe()}),JYe=()=>"Source",eXe=()=>"来源",tXe=()=>"منبع",gL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eXe():t==="fa"?tXe():JYe()}),nXe=()=>"SSH Key",rXe=()=>"SSH 密钥",sXe=()=>"کلید SSH",iXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rXe():t==="fa"?sXe():nXe()}),aXe=()=>"Started",oXe=()=>"开始时间",lXe=()=>"آغاز",cXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oXe():t==="fa"?lXe():aXe()}),uXe=()=>"State",dXe=()=>"状态",fXe=()=>"وضعیت",hXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dXe():t==="fa"?fXe():uXe()}),_Xe=()=>"Status",pXe=()=>"状态",mXe=()=>"وضعیت",o_=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pXe():t==="fa"?mXe():_Xe()}),gXe=()=>"Storage",vXe=()=>"存储",bXe=()=>"ذخیره‌سازی",yXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vXe():t==="fa"?bXe():gXe()}),xXe=()=>"Sync",wXe=()=>"同步",SXe=()=>"همگام‌سازی",kXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wXe():t==="fa"?SXe():xXe()}),CXe=()=>"Syncing off",EXe=()=>"同步已关闭",NXe=()=>"همگام‌سازی خاموش",zXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?EXe():t==="fa"?NXe():CXe()}),jXe=()=>"Test connection",TXe=()=>"测试连接",AXe=()=>"آزمایش اتصال",RXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?TXe():t==="fa"?AXe():jXe()}),MXe=()=>"Testing…",DXe=()=>"正在测试…",LXe=()=>"در حال آزمایش…",OXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?DXe():t==="fa"?LXe():MXe()}),IXe=()=>", then add it with",BXe=()=>",然后使用以下命令添加:",$Xe=()=>"، سپس با این فرمان اضافه‌اش کنید:",PXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BXe():t==="fa"?$Xe():IXe()}),FXe=()=>"This is useful when collaborators follow project changes on GitHub. New projects will enable syncing automatically, creating a private repository when needed and pushing experiment branches for visibility.",HXe=()=>"当协作者在 GitHub 上关注项目更改时,此功能很有用。新项目将自动启用同步,在需要时创建私有仓库,并推送实验分支以便查看。",qXe=()=>"وقتی همکاران تغییرات پروژه را در GitHub دنبال می‌کنند، این گزینه مفید است. پروژه‌های جدید همگام‌سازی را خودکار فعال می‌کنند، در صورت نیاز مخزن خصوصی می‌سازند و شاخه‌های آزمایش را برای دیده‌شدن push می‌کنند.",UXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HXe():t==="fa"?qXe():FXe()}),GXe=()=>"This saved destination is not configured. Set it up below or choose another backend.",WXe=()=>"已保存的目标尚未配置。请在下方完成设置或选择其他后端。",VXe=()=>"این مقصد ذخیره‌شده پیکربندی نشده است. آن را در پایین راه‌اندازی یا backend دیگری انتخاب کنید.",KXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WXe():t==="fa"?VXe():GXe()}),QXe=()=>"This value looks like a Hugging Face token — compute runs only read it from",YXe=()=>"此值看起来像 Hugging Face 令牌——算力运行只会从",XXe=()=>"این مقدار شبیه توکن Hugging Face است — اجراهای رایانشی آن را فقط از",ZXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YXe():t==="fa"?XXe():QXe()}),JXe=()=>"Time limit",eZe=()=>"时间限制",tZe=()=>"محدودیت زمانی",nZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eZe():t==="fa"?tZe():JXe()}),rZe=()=>"Unable to verify",sZe=()=>"无法验证",iZe=()=>"تأیید ممکن نیست",A4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sZe():t==="fa"?iZe():rZe()}),aZe=()=>"Unknown",oZe=()=>"未知",lZe=()=>"نامشخص",vL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oZe():t==="fa"?lZe():aZe()}),cZe=()=>"Update required",uZe=()=>"需要更新",dZe=()=>"نیازمند به‌روزرسانی",fZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uZe():t==="fa"?dZe():cZe()}),hZe=()=>"Updates",_Ze=()=>"更新",pZe=()=>"به‌روزرسانی‌ها",AN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_Ze():t==="fa"?pZe():hZe()}),mZe=()=>"Usage analytics",gZe=()=>"使用情况分析",vZe=()=>"تحلیل استفاده",bZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gZe():t==="fa"?vZe():mZe()}),yZe=()=>"value",xZe=()=>"值",wZe=()=>"مقدار",bL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xZe():t==="fa"?wZe():yZe()}),SZe=()=>"Variables available to runs and the research agent (API keys, tokens).",kZe=()=>"可供运行和研究智能体使用的变量(API 密钥、令牌)。",CZe=()=>"متغیرهای در دسترس اجراها و عامل پژوهشی (کلیدهای API، توکن‌ها).",EZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kZe():t==="fa"?CZe():SZe()}),NZe=()=>"Version",zZe=()=>"版本",jZe=()=>"نسخه",yL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zZe():t==="fa"?jZe():NZe()}),TZe=()=>"When enabled, each new project gets a private GitHub repository. Experiment branches are pushed automatically for collaborator visibility. Compute always uses direct source snapshots.",AZe=()=>"启用后,每个新项目都会获得一个私有 GitHub 仓库。实验分支会自动推送,便于协作者查看。算力执行始终使用直接的源代码快照。",RZe=()=>"با فعال شدن، هر پروژهٔ جدید یک مخزن خصوصی GitHub می‌گیرد. شاخه‌های آزمایش برای دیده‌شدن توسط همکاران خودکار push می‌شوند. رایانش همیشه از snapshot مستقیم منبع استفاده می‌کند.",MZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?AZe():t==="fa"?RZe():TZe()}),DZe=()=>"With a token saved, a paper opened in the dashboard can be kept in step with an Overleaf project, in both directions. Overleaf's Git integration comes with a paid Overleaf plan; without one, a paper can still be uploaded to Overleaf as a new project. The token stays on this machine and is not sent to compute backends.",LZe=()=>"保存令牌后,可让控制台中打开的论文与 Overleaf 项目双向保持同步。Overleaf 的 Git 集成需要付费方案;没有付费方案时,仍可将论文作为新项目上传到 Overleaf。令牌仅保存在此计算机上,不会发送到算力后端。",OZe=()=>"با ذخیرهٔ توکن، مقاله‌ای که در داشبورد باز شده می‌تواند در هر دو جهت با یک پروژهٔ Overleaf همگام بماند. یکپارچه‌سازی Git در Overleaf به طرح پولی نیاز دارد؛ بدون آن هم می‌توان مقاله را به‌عنوان پروژه‌ای جدید در Overleaf بارگذاری کرد. توکن روی همین دستگاه می‌ماند و به backendهای رایانشی فرستاده نمی‌شود.",IZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LZe():t==="fa"?OZe():DZe()}),BZe=()=>"Pick a login node first",$Ze=()=>"请先选择登录节点",PZe=()=>"ابتدا یک گرهٔ ورود انتخاب کنید",FZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$Ze():t==="fa"?PZe():BZe()}),HZe=()=>"Providers",qZe=()=>"提供商",UZe=()=>"ارائه‌دهندگان",GZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qZe():t==="fa"?UZe():HZe()}),WZe=()=>"Reconnect",VZe=()=>"重新连接",KZe=()=>"اتصال دوباره",xL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VZe():t==="fa"?KZe():WZe()}),QZe=e=>`Register this computer with ${e==null?void 0:e.register}, or load a registered key with ${e==null?void 0:e.load}.`,YZe=e=>`使用 ${e==null?void 0:e.register} 注册此计算机,或使用 ${e==null?void 0:e.load} 加载已注册的密钥。`,XZe=e=>`این رایانه را با ${e==null?void 0:e.register} ثبت کنید، یا کلید ثبت‌شده را با ${e==null?void 0:e.load} بار کنید.`,ZZe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?YZe(e):t==="fa"?XZe(e):QZe(e)}),JZe=()=>"Reinstall with the orx installer to get automatic updates.",eJe=()=>"请使用 orx 安装程序重新安装,以获得自动更新。",tJe=()=>"برای دریافت به‌روزرسانی خودکار، با نصب‌کنندهٔ orx دوباره نصب کنید.",nJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eJe():t==="fa"?tJe():JZe()}),rJe=()=>"Re-link",sJe=()=>"重新链接",iJe=()=>"پیوند دوباره",aJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sJe():t==="fa"?iJe():rJe()}),oJe=()=>"Remove cookie",lJe=()=>"移除 cookie",cJe=()=>"حذف کوکی",uJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lJe():t==="fa"?cJe():oJe()}),dJe=()=>"Remove token",fJe=()=>"移除令牌",hJe=()=>"حذف توکن",_Je=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fJe():t==="fa"?hJe():dJe()}),pJe=()=>"Removing…",mJe=()=>"正在移除…",gJe=()=>"در حال حذف…",RN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mJe():t==="fa"?gJe():pJe()}),vJe=()=>"Replace anyway",bJe=()=>"仍要替换",yJe=()=>"به‌هرحال جایگزین کن",xJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bJe():t==="fa"?yJe():vJe()}),wJe=()=>"Replace key",SJe=()=>"替换密钥",kJe=()=>"جایگزینی کلید",CJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?SJe():t==="fa"?kJe():wJe()}),EJe=()=>"Replace token",NJe=()=>"替换令牌",zJe=()=>"جایگزینی توکن",jJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?NJe():t==="fa"?zJe():EJe()}),TJe=e=>`Git and GitHub settings for ${e==null?void 0:e.project}. Local Git powers experiments; publishing is optional.`,AJe=e=>`${e==null?void 0:e.project} 的 Git 和 GitHub 设置。本地 Git 为实验提供支持;发布是可选的。`,RJe=e=>`تنظیمات Git و GitHub برای ${e==null?void 0:e.project}. Git محلی آزمایش‌ها را ممکن می‌کند؛ انتشار اختیاری است.`,MJe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?AJe(e):t==="fa"?RJe(e):TJe(e)}),DJe=e=>`Version ${e==null?void 0:e.installed} is installed. This window is still running ${e==null?void 0:e.current}.`,LJe=e=>`已安装版本 ${e==null?void 0:e.installed}。此窗口仍在运行 ${e==null?void 0:e.current}。`,OJe=e=>`نسخهٔ ${e==null?void 0:e.installed} نصب شده است. این پنجره هنوز نسخهٔ ${e==null?void 0:e.current} را اجرا می‌کند.`,IJe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?LJe(e):t==="fa"?OJe(e):DJe(e)}),BJe=()=>"Run `gh auth login` in your terminal.",$Je=()=>"请在终端中运行 `gh auth login`。",PJe=()=>"در پایانه `gh auth login` را اجرا کنید.",FJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$Je():t==="fa"?PJe():BJe()}),HJe=()=>"Saved",qJe=()=>"已保存",UJe=()=>"ذخیره شده",MN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qJe():t==="fa"?UJe():HJe()}),GJe=()=>"Set up",WJe=()=>"设置",VJe=()=>"راه‌اندازی",KJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WJe():t==="fa"?VJe():GJe()}),QJe=()=>"Set up SSH key",YJe=()=>"设置 SSH 密钥",XJe=()=>"راه‌اندازی کلید SSH",ZJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YJe():t==="fa"?XJe():QJe()}),JJe=()=>"Sign in",eet=()=>"登录",tet=()=>"ورود",wL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eet():t==="fa"?tet():JJe()}),net=e=>`SSH connection terminal for ${e==null?void 0:e.host}`,ret=e=>`${e==null?void 0:e.host} 的 SSH 连接终端`,set=e=>`پایانهٔ اتصال SSH برای ${e==null?void 0:e.host}`,SL=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ret(e):t==="fa"?set(e):net(e)}),iet=()=>"The local database, run logs, artifacts, and chat attachments. Moving this directory copies the entire store.",aet=()=>"本地数据库、运行日志、产物和聊天附件。移动此目录会复制整个存储。",oet=()=>"پایگاه دادهٔ محلی، گزارش اجراها، خروجی‌ها و پیوست‌های گفتگو. انتقال این پوشه، کل مخزن داده را کپی می‌کند.",cet=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aet():t==="fa"?oet():iet()}),uet=()=>"The terminal disconnected before setup completed. Try again.",det=()=>"设置完成前终端连接已断开。请重试。",fet=()=>"ارتباط ترمینال پیش از تکمیل راه‌اندازی قطع شد. دوباره تلاش کنید.",DN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?det():t==="fa"?fet():uet()}),het=()=>"Dark",_et=()=>"深色",pet=()=>"تیره",met=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_et():t==="fa"?pet():het()}),get=()=>"Theme",vet=()=>"主题",bet=()=>"پوسته",LN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vet():t==="fa"?bet():get()}),yet=()=>"Light",xet=()=>"浅色",wet=()=>"روشن",ket=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xet():t==="fa"?wet():yet()}),Cet=()=>"System",Eet=()=>"系统",Net=()=>"سیستم",zet=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Eet():t==="fa"?Net():Cet()}),jet=()=>"Set up billing in the Tinker console",Tet=()=>"在 Tinker 控制台设置账单",Aet=()=>"تنظیم پرداخت در کنسول Tinker",Ret=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tet():t==="fa"?Aet():jet()}),Met=()=>"Billing setup required",Det=()=>"需要设置账单",Let=()=>"تنظیم پرداخت لازم است",Oet=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Det():t==="fa"?Let():Met()}),Iet=()=>"TINKER_API_KEY is set in the process environment and overrides keys saved here. The status reflects that key.",Bet=()=>"进程环境中已设置 TINKER_API_KEY,它会覆盖此处保存的密钥。状态显示的是该密钥的检查结果。",$et=()=>"متغیر TINKER_API_KEY در محیط فرایند تنظیم شده و بر کلیدهای ذخیره‌شده در اینجا اولویت دارد. وضعیت مربوط به همان کلید است.",Pet=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Bet():t==="fa"?$et():Iet()}),Fet=()=>"Invalid Key",Het=()=>"密钥无效",qet=()=>"کلید نامعتبر",Uet=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Het():t==="fa"?qet():Fet()}),Get=()=>"Token from",Wet=()=>"令牌来自",Vet=()=>"توکن از",Ket=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wet():t==="fa"?Vet():Get()}),Qet=()=>"Update now",Yet=()=>"立即更新",Xet=()=>"اکنون به‌روزرسانی کن",Zet=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Yet():t==="fa"?Xet():Qet()}),Jet=e=>`Update to ${e==null?void 0:e.version}`,ett=e=>`更新到 ${e==null?void 0:e.version}`,ttt=e=>`به‌روزرسانی به ${e==null?void 0:e.version}`,ntt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ett(e):t==="fa"?ttt(e):Jet(e)}),rtt=()=>" Updates are switched off for this environment by ORX_NO_UPDATE_CHECK, so this setting has no effect.",stt=()=>" 此环境已通过 ORX_NO_UPDATE_CHECK 关闭更新,因此此设置不会生效。",itt=()=>" به‌روزرسانی در این محیط با ORX_NO_UPDATE_CHECK خاموش شده است؛ بنابراین این تنظیم اثری ندارد.",att=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?stt():t==="fa"?itt():rtt()}),ott=()=>"Updating default destination…",ltt=()=>"正在更新默认运行位置…",ctt=()=>"در حال به‌روزرسانی مقصد پیش‌فرض…",utt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ltt():t==="fa"?ctt():ott()}),dtt=()=>"Use this repository for automatic experiment-branch pushes when your connected account can write to it. Otherwise, OpenResearch creates a separate private repository for collaboration.",ftt=()=>"当已连接的账户有写入权限时,使用此仓库自动推送实验分支。否则,OpenResearch 会另建一个私有仓库用于协作。",htt=()=>"اگر حساب متصل اجازهٔ نوشتن داشته باشد، شاخه‌های آزمایش خودکار به این مخزن پوش می‌شوند. در غیر این صورت OpenResearch یک مخزن خصوصی جداگانه برای همکاری می‌سازد.",_tt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ftt():t==="fa"?htt():dtt()}),ptt=()=>"Validating…",mtt=()=>"正在验证…",gtt=()=>"در حال اعتبارسنجی…",kL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mtt():t==="fa"?gtt():ptt()}),vtt=()=>"View settings",btt=()=>"查看设置",ytt=()=>"مشاهدهٔ تنظیمات",xtt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?btt():t==="fa"?ytt():vtt()}),wtt=()=>"Skill",Stt=()=>"技能",ktt=()=>"مهارت",Ctt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Stt():t==="fa"?ktt():wtt()}),Ett=()=>"Loading skill…",Ntt=()=>"正在加载技能…",ztt=()=>"در حال بارگیری مهارت…",jtt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ntt():t==="fa"?ztt():Ett()}),Ttt=()=>"Personal",Att=()=>"个人",Rtt=()=>"شخصی",Mtt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Att():t==="fa"?Rtt():Ttt()}),Dtt=()=>"Alternatively, tell your agent to save a reusable skill for you.",Ltt=()=>"或者,请你的智能体为你保存可重复使用的技能。",Ott=()=>"یا از عامل خود بخواهید یک مهارت قابل استفادهٔ مجدد برایتان ذخیره کند.",Itt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ltt():t==="fa"?Ott():Dtt()}),Btt=e=>`Delete the “${e==null?void 0:e.name}” skill?`,$tt=e=>`删除技能“${e==null?void 0:e.name}”?`,Ptt=e=>`مهارت «${e==null?void 0:e.name}» حذف شود؟`,Ftt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?$tt(e):t==="fa"?Ptt(e):Btt(e)}),Htt=e=>`Delete skill ${e==null?void 0:e.name}`,qtt=e=>`删除技能 ${e==null?void 0:e.name}`,Utt=e=>`حذف مهارت ${e==null?void 0:e.name}`,Gtt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?qtt(e):t==="fa"?Utt(e):Htt(e)}),Wtt=e=>`Delete the “${e==null?void 0:e.name}” template?`,Vtt=e=>`删除模板“${e==null?void 0:e.name}”?`,Ktt=e=>`قالب «${e==null?void 0:e.name}» حذف شود؟`,Qtt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Vtt(e):t==="fa"?Ktt(e):Wtt(e)}),Ytt=e=>`Delete template ${e==null?void 0:e.name}`,Xtt=e=>`删除模板 ${e==null?void 0:e.name}`,Ztt=e=>`حذف قالب ${e==null?void 0:e.name}`,Jtt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Xtt(e):t==="fa"?Ztt(e):Ytt(e)}),ent=()=>"Invoke skills with /name in chat. Skills from your coding agents are screened for research relevance before importing. Upload a skill to include it yourself. Alternatively, tell your OpenResearch agent to create and add a reusable skill for you.",tnt=()=>"在聊天中使用 /name 调用技能。来自编程代理的技能会先经过研究相关性筛选,再导入。您也可以自行上传技能,或让 OpenResearch 代理为您创建并添加可复用技能。",nnt=()=>"مهارت‌ها را با /name در گفتگو فراخوانی کنید. مهارت‌های عامل‌های برنامه‌نویسی پیش از وارد شدن از نظر ارتباط با پژوهش بررسی می‌شوند. می‌توانید مهارت را خودتان بارگذاری کنید یا از عامل OpenResearch بخواهید یک مهارت قابل استفادهٔ مجدد بسازد و اضافه کند.",rnt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tnt():t==="fa"?nnt():ent()}),snt=()=>"Drop a SKILL.md or .zip here, or click to choose",int=()=>"将 SKILL.md 或 .zip 拖放到此处,或点击选择",ant=()=>"یک فایل SKILL.md یا .zip را اینجا رها کنید، یا برای انتخاب کلیک کنید",ont=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?int():t==="fa"?ant():snt()}),lnt=()=>"Drop a .tex or .zip here, or click to choose",cnt=()=>"将 .tex 或 .zip 拖放到此处,或点击选择",unt=()=>"یک فایل .tex یا .zip را اینجا رها کنید، یا برای انتخاب کلیک کنید",dnt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cnt():t==="fa"?unt():lnt()}),fnt=()=>"File too large (max 20 MB).",hnt=()=>"文件过大(最大 20 MB)。",_nt=()=>"فایل بیش از حد بزرگ است (حداکثر ۲۰ مگابایت).",CL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hnt():t==="fa"?_nt():fnt()}),pnt=()=>" + 1 file",mnt=()=>" + 1 个文件",gnt=()=>" + ۱ فایل",vnt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mnt():t==="fa"?gnt():pnt()}),bnt=()=>"Customize the skills and LaTeX templates available across your projects. Upload them here, or ask an OpenResearch agent to create and add them for you.",ynt=()=>"自定义所有项目中可用的技能和 LaTeX 模板。在此上传,或让 OpenResearch 代理为您创建并添加。",xnt=()=>"مهارت‌ها و قالب‌های LaTeX قابل استفاده در همهٔ پروژه‌ها را سفارشی کنید. آن‌ها را اینجا بارگذاری کنید یا از عامل OpenResearch بخواهید برایتان بسازد و اضافه کند.",wnt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ynt():t==="fa"?xnt():bnt()}),Snt=()=>"Remove from OpenResearch",knt=()=>"从 OpenResearch 移除",Cnt=()=>"حذف از OpenResearch",Ent=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?knt():t==="fa"?Cnt():Snt()}),Nnt=e=>`Remove “${e==null?void 0:e.name}” from OpenResearch? Its source files will remain in your coding agent.`,znt=e=>`从 OpenResearch 移除“${e==null?void 0:e.name}”?源文件将保留在你的编程智能体中。`,jnt=e=>`«${e==null?void 0:e.name}» از OpenResearch حذف شود؟ فایل‌های اصلی در عامل برنامه‌نویسی شما باقی می‌مانند.`,Tnt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?znt(e):t==="fa"?jnt(e):Nnt(e)}),Ant=e=>`Remove ${e==null?void 0:e.name} from OpenResearch`,Rnt=e=>`从 OpenResearch 移除 ${e==null?void 0:e.name}`,Mnt=e=>`حذف ${e==null?void 0:e.name} از OpenResearch`,Dnt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Rnt(e):t==="fa"?Mnt(e):Ant(e)}),Lnt=e=>` + ${e==null?void 0:e.count} files`,Ont=e=>` + ${e==null?void 0:e.count} 个文件`,Int=e=>` + ${e==null?void 0:e.count} فایل`,Bnt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Ont(e):t==="fa"?Int(e):Lnt(e)}),$nt=()=>"Could not load skills:",Pnt=()=>"无法加载技能:",Fnt=()=>"بارگیری مهارت‌ها ممکن نشد:",Hnt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pnt():t==="fa"?Fnt():$nt()}),qnt=()=>"Could not load templates:",Unt=()=>"无法加载模板:",Gnt=()=>"بارگیری قالب‌ها ممکن نشد:",Wnt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Unt():t==="fa"?Gnt():qnt()}),Vnt=()=>"Customize",Knt=()=>"自定义",Qnt=()=>"سفارشی‌سازی",Ynt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Knt():t==="fa"?Qnt():Vnt()}),Xnt=()=>"Delete skill",Znt=()=>"删除技能",Jnt=()=>"حذف مهارت",ert=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Znt():t==="fa"?Jnt():Xnt()}),trt=()=>"Delete template",nrt=()=>"删除模板",rrt=()=>"حذف قالب",srt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nrt():t==="fa"?rrt():trt()}),irt=()=>"LaTeX templates",art=()=>"LaTeX 模板",ort=()=>"قالب‌های LaTeX",lrt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?art():t==="fa"?ort():irt()}),crt=()=>"Loading skills…",urt=()=>"正在加载技能…",drt=()=>"در حال بارگیری مهارت‌ها…",frt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?urt():t==="fa"?drt():crt()}),hrt=()=>"Loading templates…",_rt=()=>"正在加载模板…",prt=()=>"در حال بارگیری قالب‌ها…",mrt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_rt():t==="fa"?prt():hrt()}),grt=()=>"No skills yet.",vrt=()=>"尚无技能。",brt=()=>"هنوز مهارتی وجود ندارد.",yrt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vrt():t==="fa"?brt():grt()}),xrt=()=>"No templates yet.",wrt=()=>"尚无模板。",Srt=()=>"هنوز قالبی وجود ندارد.",krt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wrt():t==="fa"?Srt():xrt()}),Crt=()=>"Skills",Ert=()=>"技能",Nrt=()=>"مهارت‌ها",zrt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ert():t==="fa"?Nrt():Crt()}),jrt=()=>"Uploading…",Trt=()=>"正在上传…",Art=()=>"در حال بارگذاری…",Rrt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Trt():t==="fa"?Art():jrt()}),Mrt=()=>"A conference class or house style the agent writes papers into instead of its default preamble. Upload a .tex file or a .zip containing its .cls and .sty files. Alternatively, tell your OpenResearch agent to create and add a LaTeX template for you. With exactly one template available, the agent uses it without asking.",Drt=()=>"代理撰写论文时使用的会议格式或自定义样式,用于替代默认导言区。上传 .tex 文件或包含 .cls 和 .sty 文件的 .zip 压缩包,也可以让 OpenResearch 代理为您创建并添加 LaTeX 模板。只有一个模板可用时,代理会直接使用,无需询问。",Lrt=()=>"قالب کنفرانس یا سبک اختصاصی که عامل به‌جای پیش‌گفتار پیش‌فرض برای نوشتن مقاله استفاده می‌کند. یک فایل .tex یا فایل .zip شامل فایل‌های .cls و .sty بارگذاری کنید، یا از عامل OpenResearch بخواهید قالب LaTeX بسازد و اضافه کند. اگر تنها یک قالب موجود باشد، عامل بدون پرسش از آن استفاده می‌کند.",Ort=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Drt():t==="fa"?Lrt():Mrt()}),Irt=()=>"Upload a SKILL.md file or a .zip of a skill folder.",Brt=()=>"请上传 SKILL.md 文件或技能文件夹的 .zip 压缩包。",$rt=()=>"یک فایل SKILL.md یا فایل .zip از پوشهٔ مهارت بارگذاری کنید.",Prt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Brt():t==="fa"?$rt():Irt()}),Frt=()=>"Upload a .tex file or a .zip of a template folder.",Hrt=()=>"请上传 .tex 文件或模板文件夹的 .zip 压缩包。",qrt=()=>"یک فایل .tex یا فایل .zip از پوشهٔ قالب بارگذاری کنید.",Urt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hrt():t==="fa"?qrt():Frt()}),Grt=()=>"Close SSH config",Wrt=()=>"关闭 SSH 配置",Vrt=()=>"بستن پیکربندی SSH",Krt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wrt():t==="fa"?Vrt():Grt()}),Qrt=()=>"Discard your unsaved SSH config changes?",Yrt=()=>"要放弃未保存的 SSH 配置更改吗?",Xrt=()=>"تغییرات ذخیره‌نشدهٔ پیکربندی SSH کنار گذاشته شود؟",Zrt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Yrt():t==="fa"?Xrt():Qrt()}),Jrt=()=>"Loading SSH config…",est=()=>"正在加载 SSH 配置…",tst=()=>"در حال بارگیری پیکربندی SSH…",nst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?est():t==="fa"?tst():Jrt()}),rst=()=>"SSH config saved",sst=()=>"SSH 配置已保存",ist=()=>"پیکربندی SSH ذخیره شد",ast=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sst():t==="fa"?ist():rst()}),ost=()=>"SSH config",lst=()=>"SSH 配置",cst=()=>"پیکربندی SSH",ust=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lst():t==="fa"?cst():ost()}),dst=()=>"Configure SSH hosts…",fst=()=>"配置 SSH 主机…",hst=()=>"پیکربندی میزبان‌های SSH…",EL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fst():t==="fa"?hst():dst()}),_st=()=>"Cancelled",pst=()=>"已取消",mst=()=>"لغوشده",gst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pst():t==="fa"?mst():_st()}),vst=()=>"Cancelling",bst=()=>"正在取消",yst=()=>"در حال لغو",xst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bst():t==="fa"?yst():vst()}),wst=()=>"Done",Sst=()=>"已完成",kst=()=>"انجام‌شده",Cst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Sst():t==="fa"?kst():wst()}),Est=()=>"Editing",Nst=()=>"正在编辑",zst=()=>"در حال ویرایش",jst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nst():t==="fa"?zst():Est()}),Tst=()=>"Failed",Ast=()=>"失败",Rst=()=>"ناموفق",Mst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ast():t==="fa"?Rst():Tst()}),Dst=()=>"Idle",Lst=()=>"空闲",Ost=()=>"بی‌کار",Ist=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lst():t==="fa"?Ost():Dst()}),Bst=()=>"Running",$st=()=>"运行中",Pst=()=>"در حال اجرا",Fst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$st():t==="fa"?Pst():Bst()}),Hst=()=>"Starting",qst=()=>"正在启动",Ust=()=>"در حال آغاز",Gst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qst():t==="fa"?Ust():Hst()}),Wst=()=>"Copying…",Vst=()=>"正在复制…",Kst=()=>"در حال کپی…",Qst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vst():t==="fa"?Kst():Wst()}),Yst=()=>"Finalizing…",Xst=()=>"正在完成…",Zst=()=>"در حال نهایی‌سازی…",Jst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xst():t==="fa"?Zst():Yst()}),eit=e=>`${e==null?void 0:e.size} free at target`,tit=e=>`目标位置可用空间 ${e==null?void 0:e.size}`,nit=e=>`${e==null?void 0:e.size} فضای آزاد در مقصد`,rit=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?tit(e):t==="fa"?nit(e):eit(e)}),sit=e=>`Move all orx data to: +رونوشت آن برای همیشه حذف خواهد شد.`,Gie=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?qie(e):t==="fa"?Uie(e):Hie(e)}),Wie=e=>`Failed to delete “${e==null?void 0:e.title}”: ${e==null?void 0:e.error}`,Vie=e=>`删除“${e==null?void 0:e.title}”失败:${e==null?void 0:e.error}`,Kie=e=>`حذف «${e==null?void 0:e.title}» ناموفق بود: ${e==null?void 0:e.error}`,Qie=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Vie(e):t==="fa"?Kie(e):Wie(e)}),Yie=()=>"Could not exit Plan mode. Try again.",Xie=()=>"无法退出计划模式。请重试。",Zie=()=>"خروج از حالت طرح ممکن نشد. دوباره تلاش کنید.",Jie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xie():t==="fa"?Zie():Yie()}),eae=()=>"Expand tool activity",tae=()=>"展开工具活动",nae=()=>"باز کردن فعالیت ابزارها",rae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tae():t==="fa"?nae():eae()}),sae=()=>"experiments",iae=()=>"实验",aae=()=>"آزمایش‌ها",oae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iae():t==="fa"?aae():sae()}),lae=e=>`${e==null?void 0:e.harness} is unavailable — open the model picker`,cae=e=>`${e==null?void 0:e.harness} 不可用 — 请打开模型选择器`,uae=e=>`در حال حاضر ${e==null?void 0:e.harness} در دسترس نیست — انتخاب‌گر مدل را باز کنید`,dae=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?cae(e):t==="fa"?uae(e):lae(e)}),fae=e=>`Message ${e==null?void 0:e.harness}… (/ for commands and skills, ! for shell)`,hae=e=>`给 ${e==null?void 0:e.harness} 发消息…(输入 / 使用命令和技能,输入 ! 运行 shell)`,_ae=e=>`پیام به ${e==null?void 0:e.harness}… (/ برای فرمان‌ها و مهارت‌ها، ! برای شل)`,pae=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?hae(e):t==="fa"?_ae(e):fae(e)}),mae=e=>`Message not sent: ${e==null?void 0:e.error}`,gae=e=>`消息未发送:${e==null?void 0:e.error}`,vae=e=>`پیام ارسال نشد: ${e==null?void 0:e.error}`,bae=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?gae(e):t==="fa"?vae(e):mae(e)}),yae=()=>"Model unavailable",xae=()=>"模型不可用",wae=()=>"مدل در دسترس نیست",Sae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xae():t==="fa"?wae():yae()}),kae=()=>"New session",Cae=()=>"新会话",Eae=()=>"نشست جدید",fE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cae():t==="fa"?Eae():kae()}),Nae=()=>"No active sessions",zae=()=>"没有活跃会话",jae=()=>"نشست فعالی وجود ندارد",Tae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zae():t==="fa"?jae():Nae()}),Aae=()=>"No activity",Rae=()=>"无活动",Mae=()=>"بدون فعالیت",Dae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rae():t==="fa"?Mae():Aae()}),Lae=()=>"No archived sessions",Oae=()=>"没有已归档的会话",Iae=()=>"نشست بایگانی‌شده‌ای وجود ندارد",Bae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Oae():t==="fa"?Iae():Lae()}),$ae=()=>"No sessions yet",Pae=()=>"还没有会话",Fae=()=>"هنوز نشستی وجود ندارد",Hae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pae():t==="fa"?Fae():$ae()}),qae=()=>"1 annotation",Uae=()=>"1 条批注",Gae=()=>"۱ یادداشت",Wae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Uae():t==="fa"?Gae():qae()}),Vae=()=>"Open sub-agent transcript",Kae=()=>"打开子智能体记录",Qae=()=>"باز کردن متن گفت‌وگوی عامل فرعی",Yae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kae():t==="fa"?Qae():Vae()}),Xae=()=>"About this demo",Zae=()=>"关于此演示",Jae=()=>"دربارهٔ این نسخهٔ نمایشی",hE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zae():t==="fa"?Jae():Xae()}),eoe=()=>"Accept and auto mode",toe=()=>"接受并使用自动模式",noe=()=>"پذیرش و حالت خودکار",roe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?toe():t==="fa"?noe():eoe()}),soe=()=>"Accept and bypass all",ioe=()=>"接受并跳过所有审批",aoe=()=>"پذیرش و عبور از همهٔ تأییدها",ooe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ioe():t==="fa"?aoe():soe()}),loe=()=>"Active",coe=()=>"活跃",uoe=()=>"فعال",doe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?coe():t==="fa"?uoe():loe()}),foe=()=>"All",hoe=()=>"全部",_oe=()=>"همه",poe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hoe():t==="fa"?_oe():foe()}),moe=()=>"Allow",goe=()=>"允许",voe=()=>"اجازه دادن",boe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?goe():t==="fa"?voe():moe()}),yoe=()=>"Approval required",xoe=()=>"需要批准",woe=()=>"نیازمند تأیید",Soe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xoe():t==="fa"?woe():yoe()}),koe=()=>"Archived",Coe=()=>"已归档",Eoe=()=>"بایگانی‌شده",_E=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Coe():t==="fa"?Eoe():koe()}),Noe=()=>"Ask about this",zoe=()=>"询问此内容",joe=()=>"دربارهٔ این بپرسید",Toe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zoe():t==="fa"?joe():Noe()}),Aoe=()=>"Attach a PDF or image",Roe=()=>"附加 PDF 或图片",Moe=()=>"پیوست PDF یا تصویر",pE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Roe():t==="fa"?Moe():Aoe()}),Doe=()=>"Bash",Loe=()=>"Bash",Ooe=()=>"Bash",bD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Loe():t==="fa"?Ooe():Doe()}),Ioe=()=>"Browsed the web",Boe=()=>"已浏览网页",$oe=()=>"وب مرور شد",mE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Boe():t==="fa"?$oe():Ioe()}),Poe=()=>"Built the project",Foe=()=>"已构建项目",Hoe=()=>"پروژه ساخته شد",qoe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Foe():t==="fa"?Hoe():Poe()}),Uoe=()=>"Cancel",Goe=()=>"取消",Woe=()=>"لغو",Voe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Goe():t==="fa"?Woe():Uoe()}),Koe=()=>"Cancelled an experiment run",Qoe=()=>"已取消实验运行",Yoe=()=>"اجرای آزمایش لغو شد",Xoe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Qoe():t==="fa"?Yoe():Koe()}),Zoe=()=>"Checked code style",Joe=()=>"已检查代码风格",ele=()=>"سبک کد بررسی شد",tle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Joe():t==="fa"?ele():Zoe()}),nle=()=>"Checked compute options",rle=()=>"已检查算力选项",sle=()=>"گزینه‌های رایانشی بررسی شد",ile=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rle():t==="fa"?sle():nle()}),ale=()=>"Checked experiment status",ole=()=>"已检查实验状态",lle=()=>"وضعیت آزمایش بررسی شد",gE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ole():t==="fa"?lle():ale()}),cle=()=>"Checked Git status",ule=()=>"已检查 Git 状态",dle=()=>"وضعیت Git بررسی شد",fle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ule():t==="fa"?dle():cle()}),hle=()=>"Checked local times",_le=()=>"已查询当地时间",ple=()=>"زمان‌های محلی بررسی شد",mle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_le():t==="fa"?ple():hle()}),gle=()=>"Checked market data",vle=()=>"已查询市场数据",ble=()=>"داده‌های بازار بررسی شد",yle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vle():t==="fa"?ble():gle()}),xle=()=>"Checked sports data",wle=()=>"已查询体育数据",Sle=()=>"داده‌های ورزشی بررسی شد",kle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wle():t==="fa"?Sle():xle()}),Cle=()=>"Checked the weather",Ele=()=>"已查询天气",Nle=()=>"آب‌وهوا بررسی شد",zle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ele():t==="fa"?Nle():Cle()}),jle=()=>"Checked types",Tle=()=>"已检查类型",Ale=()=>"نوع‌ها بررسی شد",Rle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tle():t==="fa"?Ale():jle()}),Mle=()=>"Clear annotations",Dle=()=>"清除批注",Lle=()=>"پاک کردن یادداشت‌ها",vE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Dle():t==="fa"?Lle():Mle()}),Ole=()=>"Customize",Ile=()=>"自定义",Ble=()=>"سفارشی‌سازی",$le=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ile():t==="fa"?Ble():Ole()}),Ple=()=>"Data sources",Fle=()=>"数据源",Hle=()=>"منابع داده",yx=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Fle():t==="fa"?Hle():Ple()}),qle=()=>"Delegated a task to a new agent",Ule=()=>"已将任务委派给新智能体",Gle=()=>"وظیفه به عامل جدید واگذار شد",Wle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ule():t==="fa"?Gle():qle()}),Vle=()=>"Delete",Kle=()=>"删除",Qle=()=>"حذف",yD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kle():t==="fa"?Qle():Vle()}),Yle=()=>"Deny",Xle=()=>"拒绝",Zle=()=>"رد کردن",Jle=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xle():t==="fa"?Zle():Yle()}),ece=()=>"Edit and re-send",tce=()=>"编辑并重新发送",nce=()=>"ویرایش و ارسال دوباره",bE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tce():t==="fa"?nce():ece()}),rce=()=>"Edit message",sce=()=>"编辑消息",ice=()=>"ویرایش پیام",ace=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sce():t==="fa"?ice():rce()}),oce=()=>"Edited a file",lce=()=>"已编辑文件",cce=()=>"فایل ویرایش شد",yE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lce():t==="fa"?cce():oce()}),uce=()=>"Exit Bash mode",dce=()=>"退出 Bash 模式",fce=()=>"خروج از حالت Bash",xE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dce():t==="fa"?fce():uce()}),hce=()=>"Exit Plan mode",_ce=()=>"退出计划模式",pce=()=>"خروج از حالت طرح",wE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_ce():t==="fa"?pce():hce()}),mce=()=>"Failed:",gce=()=>"失败:",vce=()=>"ناموفق:",J5=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gce():t==="fa"?vce():mce()}),bce=()=>"Filter sessions",yce=()=>"筛选会话",xce=()=>"فیلتر نشست‌ها",SE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yce():t==="fa"?xce():bce()}),wce=()=>"is unavailable.",Sce=()=>"不可用。",kce=()=>"در دسترس نیست.",Cce=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Sce():t==="fa"?kce():wce()}),Ece=()=>"Later queued messages will wait until this is retried or removed.",Nce=()=>"后续排队的消息会等待此消息重试或移除。",zce=()=>"پیام‌های بعدی صف تا تلاش دوباره یا حذف این پیام منتظر می‌مانند.",jce=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nce():t==="fa"?zce():Ece()}),Tce=()=>"Listed files",Ace=()=>"已列出文件",Rce=()=>"فایل‌ها فهرست شد",kE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ace():t==="fa"?Rce():Tce()}),Mce=()=>"Listed project runs",Dce=()=>"已列出项目运行",Lce=()=>"اجراهای پروژه فهرست شد",Oce=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Dce():t==="fa"?Lce():Mce()}),Ice=()=>"Listed projects",Bce=()=>"已列出项目",$ce=()=>"پروژه‌ها فهرست شد",Pce=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Bce():t==="fa"?$ce():Ice()}),Fce=()=>"Loading conversation…",Hce=()=>"正在加载对话…",qce=()=>"در حال بارگیری گفتگو…",Uce=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hce():t==="fa"?qce():Fce()}),Gce=()=>"New Chat",Wce=()=>"新对话",Vce=()=>"گفتگوی جدید",Kce=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wce():t==="fa"?Vce():Gce()}),Qce=()=>"Next version",Yce=()=>"下一版本",Xce=()=>"نسخهٔ بعدی",CE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Yce():t==="fa"?Xce():Qce()}),Zce=()=>"Open the session this agent spawned",Jce=()=>"打开此智能体创建的会话",eue=()=>"باز کردن نشست ساخته‌شده توسط این عامل",tue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Jce():t==="fa"?eue():Zce()}),nue=()=>"Opened web pages",rue=()=>"已打开网页",sue=()=>"صفحه‌های وب باز شد",iue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rue():t==="fa"?sue():nue()}),aue=()=>"Plan",oue=()=>"计划",lue=()=>"طرح",cue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oue():t==="fa"?lue():aue()}),uue=()=>"Plan approved",due=()=>"计划已批准",fue=()=>"طرح تأیید شد",hue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?due():t==="fa"?fue():uue()}),_ue=()=>"Plan rejected",pue=()=>"计划已拒绝",mue=()=>"طرح رد شد",gue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pue():t==="fa"?mue():_ue()}),vue=()=>"Plan resolved",bue=()=>"计划已处理",yue=()=>"طرح تعیین تکلیف شد",xue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bue():t==="fa"?yue():vue()}),wue=()=>"Plan revision requested",Sue=()=>"已请求修改计划",kue=()=>"درخواست بازنگری طرح ثبت شد",Cue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Sue():t==="fa"?kue():wue()}),Eue=()=>"Previous version",Nue=()=>"上一版本",zue=()=>"نسخهٔ قبلی",EE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nue():t==="fa"?zue():Eue()}),jue=()=>"Ran a command",Tue=()=>"已运行命令",Aue=()=>"فرمان اجرا شد",Rue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tue():t==="fa"?Aue():jue()}),Mue=()=>"Ran tests",Due=()=>"已运行测试",Lue=()=>"آزمون‌ها اجرا شد",Oue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Due():t==="fa"?Lue():Mue()}),Iue=()=>"Read a file",Bue=()=>"已读取文件",$ue=()=>"فایل خوانده شد",Pue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Bue():t==="fa"?$ue():Iue()}),Fue=()=>"Read Git history",Hue=()=>"已读取 Git 历史",que=()=>"تاریخچهٔ Git خوانده شد",Uue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hue():t==="fa"?que():Fue()}),Gue=()=>"Read project details",Wue=()=>"已读取项目详情",Vue=()=>"جزئیات پروژه خوانده شد",Kue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wue():t==="fa"?Vue():Gue()}),Que=()=>"Reject",Yue=()=>"拒绝",Xue=()=>"رد کردن",Zue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Yue():t==="fa"?Xue():Que()}),Jue=()=>"Remove",ede=()=>"移除",tde=()=>"حذف",nde=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ede():t==="fa"?tde():Jue()}),rde=()=>"Remove annotation",sde=()=>"移除批注",ide=()=>"حذف یادداشت",ade=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sde():t==="fa"?ide():rde()}),ode=()=>"Remove file",lde=()=>"移除文件",cde=()=>"حذف فایل",NE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lde():t==="fa"?cde():ode()}),ude=()=>"Remove image",dde=()=>"移除图片",fde=()=>"حذف تصویر",zE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dde():t==="fa"?fde():ude()}),hde=()=>"Remove queued message",_de=()=>"移除排队消息",pde=()=>"حذف پیام صف",jE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_de():t==="fa"?pde():hde()}),mde=()=>"Rename",gde=()=>"重命名",vde=()=>"تغییر نام",xD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gde():t==="fa"?vde():mde()}),bde=()=>"Reviewed code changes",yde=()=>"已审查代码更改",xde=()=>"تغییرات کد بازبینی شد",wde=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yde():t==="fa"?xde():bde()}),Sde=()=>"Run",kde=()=>"运行",Cde=()=>"اجرا",TE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kde():t==="fa"?Cde():Sde()}),Ede=()=>"Selected chat text",Nde=()=>"已选聊天文本",zde=()=>"متن انتخاب‌شدهٔ گفتگو",jde=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nde():t==="fa"?zde():Ede()}),Tde=()=>"Selected text:",Ade=()=>"已选文本:",Rde=()=>"متن انتخاب‌شده:",Mde=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ade():t==="fa"?Rde():Tde()}),Dde=()=>"Send",Lde=()=>"发送",Ode=()=>"ارسال",C4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lde():t==="fa"?Ode():Dde()}),Ide=()=>"Session options",Bde=()=>"会话选项",$de=()=>"گزینه‌های نشست",AE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Bde():t==="fa"?$de():Ide()}),Pde=()=>"Session title",Fde=()=>"会话标题",Hde=()=>"عنوان نشست",qde=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Fde():t==="fa"?Hde():Pde()}),Ude=()=>"Show sidebar",Gde=()=>"显示侧边栏",Wde=()=>"نمایش نوار کناری",RE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Gde():t==="fa"?Wde():Ude()}),Vde=()=>"Started an experiment run",Kde=()=>"已启动实验运行",Qde=()=>"اجرای آزمایش آغاز شد",Yde=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kde():t==="fa"?Qde():Vde()}),Xde=()=>"Reading the project to suggest where to start…",Zde=()=>"正在阅读项目以建议从哪里开始…",Jde=()=>"در حال خواندن پروژه برای پیشنهاد نقطهٔ شروع…",efe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zde():t==="fa"?Jde():Xde()}),tfe=()=>"Starter prompts",nfe=()=>"入门提示",rfe=()=>"پیشنهادهای شروع",sfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nfe():t==="fa"?rfe():tfe()}),ife=()=>"Stop",afe=()=>"停止",ofe=()=>"توقف",ME=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?afe():t==="fa"?ofe():ife()}),lfe=()=>"Submit",cfe=()=>"提交",ufe=()=>"ارسال",dfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cfe():t==="fa"?ufe():lfe()}),ffe=()=>"Tool failed",hfe=()=>"工具失败",_fe=()=>"ابزار ناموفق بود",pfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hfe():t==="fa"?_fe():ffe()}),mfe=()=>"Used tools",gfe=()=>"已使用工具",vfe=()=>"ابزارها استفاده شد",wD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gfe():t==="fa"?vfe():mfe()}),bfe=()=>"View full plan",yfe=()=>"查看完整计划",xfe=()=>"مشاهدهٔ طرح کامل",wfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yfe():t==="fa"?xfe():bfe()}),Sfe=()=>"Waited for an experiment run",kfe=()=>"已等待实验运行",Cfe=()=>"برای اجرای آزمایش صبر شد",Efe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kfe():t==="fa"?Cfe():Sfe()}),Nfe=()=>"Waiting for your input…",zfe=()=>"正在等待你的输入…",jfe=()=>"منتظر ورودی شما…",Tfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zfe():t==="fa"?jfe():Nfe()}),Afe=()=>"What should we research?",Rfe=()=>"我们应该研究什么?",Mfe=()=>"چه چیزی را پژوهش کنیم؟",Dfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rfe():t==="fa"?Mfe():Afe()}),Lfe=()=>"You, mid-task",Ofe=()=>"你(任务进行中)",Ife=()=>"شما، هنگام انجام وظیفه",Bfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ofe():t==="fa"?Ife():Lfe()}),$fe=()=>"Pasted image",Pfe=()=>"粘贴的图片",Ffe=()=>"تصویر جای‌گذاری‌شده",Hfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pfe():t==="fa"?Ffe():$fe()}),qfe=()=>"Plan",Ufe=()=>"计划",Gfe=()=>"طرح",SD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ufe():t==="fa"?Gfe():qfe()}),Wfe=()=>"Plan mode — ready to proceed?",Vfe=()=>"计划模式 — 准备好继续了吗?",Kfe=()=>"حالت طرح — آماده‌اید ادامه دهید؟",Qfe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vfe():t==="fa"?Kfe():Wfe()}),Yfe=()=>"Proposed plan",Xfe=()=>"提议的计划",Zfe=()=>"طرح پیشنهادی",DE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xfe():t==="fa"?Zfe():Yfe()}),Jfe=()=>"Question",ehe=()=>"问题",the=()=>"پرسش",nhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ehe():t==="fa"?the():Jfe()}),rhe=()=>"Queued",she=()=>"已排队",ihe=()=>"در صف",ahe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?she():t==="fa"?ihe():rhe()}),ohe=()=>"Recents",lhe=()=>"最近",che=()=>"اخیر",kD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lhe():t==="fa"?che():ohe()}),uhe=()=>"Re-check its setup.",dhe=()=>"请重新检查其设置。",fhe=()=>"راه‌اندازی آن را دوباره بررسی کنید.",hhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dhe():t==="fa"?fhe():uhe()}),_he=()=>"Could not recover this turn. Try again.",phe=()=>"无法恢复本轮。请重试。",mhe=()=>"بازیابی این نوبت ممکن نشد. دوباره تلاش کنید.",ghe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?phe():t==="fa"?mhe():_he()}),vhe=()=>"Could not remove the queued message. Try again.",bhe=()=>"无法移除排队消息。请重试。",yhe=()=>"حذف پیام در صف ممکن نشد. دوباره تلاش کنید.",xhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bhe():t==="fa"?yhe():vhe()}),whe=e=>`Could not re-send: ${e==null?void 0:e.error}`,She=e=>`无法重新发送:${e==null?void 0:e.error}`,khe=e=>`ارسال دوباره ممکن نشد: ${e==null?void 0:e.error}`,Che=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?She(e):t==="fa"?khe(e):whe(e)}),Ehe=()=>"Resolved",Nhe=()=>"已处理",zhe=()=>"رسیدگی شد",jhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nhe():t==="fa"?zhe():Ehe()}),The=()=>"Could not retry the queued message. Try again.",Ahe=()=>"无法重试排队消息。请重试。",Rhe=()=>"تلاش دوباره برای پیام در صف ممکن نشد. دوباره تلاش کنید.",Mhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ahe():t==="fa"?Rhe():The()}),Dhe=()=>"run logs",Lhe=()=>"运行日志",Ohe=()=>"گزارش‌های اجرا",Ihe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lhe():t==="fa"?Ohe():Dhe()}),Bhe=()=>"Scroll to bottom",$he=()=>"滚动到底部",Phe=()=>"رفتن به پایین گفتگو",LE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$he():t==="fa"?Phe():Bhe()}),Fhe=()=>"The selected harness is unavailable",Hhe=()=>"所选智能体工具不可用",qhe=()=>"ابزار عامل انتخاب‌شده در دسترس نیست",xx=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hhe():t==="fa"?qhe():Fhe()}),Uhe=()=>"Session limit reached",Ghe=()=>"已达到会话使用限额",Whe=()=>"به سقف مصرف نشست رسیده‌اید",Vhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ghe():t==="fa"?Whe():Uhe()}),Khe=()=>"The chat session was not created",Qhe=()=>"未能创建聊天会话",Yhe=()=>"نشست گفت‌وگو ایجاد نشد",Xhe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Qhe():t==="fa"?Yhe():Khe()}),Zhe=()=>"Show full conversation",Jhe=()=>"显示完整对话",e_e=()=>"نمایش کامل گفتگو",t_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Jhe():t==="fa"?e_e():Zhe()}),n_e=()=>" · Spawned by another agent",r_e=()=>" · 由另一个智能体创建",s_e=()=>" · ساخته‌شده به‌دست عامل دیگر",i_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?r_e():t==="fa"?s_e():n_e()}),a_e=()=>"Starting…",o_e=()=>"正在启动…",l_e=()=>"در حال شروع…",c_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?o_e():t==="fa"?l_e():a_e()}),u_e=e=>`Steer ${e==null?void 0:e.harness}… (${e==null?void 0:e.shortcut} to queue)`,d_e=e=>`向 ${e==null?void 0:e.harness} 补充指示…(按 ${e==null?void 0:e.shortcut} 排队)`,f_e=e=>`راهنمایی ${e==null?void 0:e.harness}… (${e==null?void 0:e.shortcut} برای افزودن به صف)`,h_e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?d_e(e):t==="fa"?f_e(e):u_e(e)}),__e=()=>"Could not stop the turn. Try again.",p_e=()=>"无法停止本轮。请重试。",m_e=()=>"توقف این نوبت ممکن نشد. دوباره تلاش کنید.",g_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?p_e():t==="fa"?m_e():__e()}),v_e=e=>`Could not switch fork: ${e==null?void 0:e.error}`,b_e=e=>`无法切换分支:${e==null?void 0:e.error}`,y_e=e=>`تغییر شاخه ممکن نشد: ${e==null?void 0:e.error}`,x_e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?b_e(e):t==="fa"?y_e(e):v_e(e)}),w_e=()=>"The agent",S_e=()=>"智能体",k_e=()=>"عامل",C_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?S_e():t==="fa"?k_e():w_e()}),E_e=()=>"Thinking",N_e=()=>"正在思考",z_e=()=>"در حال فکر کردن",j_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?N_e():t==="fa"?z_e():E_e()}),T_e=()=>"Could not toggle Plan mode. Try again.",A_e=()=>"无法切换计划模式。请重试。",R_e=()=>"تغییر حالت طرح ممکن نشد. دوباره تلاش کنید.",OE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?A_e():t==="fa"?R_e():T_e()}),M_e=()=>"This turn did not finish.",D_e=()=>"本轮未完成。",L_e=()=>"این نوبت کامل نشد.",IE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?D_e():t==="fa"?L_e():M_e()}),O_e=()=>"Type a custom answer…",I_e=()=>"输入自定义回答…",B_e=()=>"پاسخ دلخواه را بنویسید…",$_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?I_e():t==="fa"?B_e():O_e()}),P_e=()=>"Unarchive",F_e=()=>"取消归档",H_e=()=>"خارج کردن از بایگانی",q_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?F_e():t==="fa"?H_e():P_e()}),U_e=()=>"Untitled",G_e=()=>"未命名",W_e=()=>"بدون عنوان",Eg=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?G_e():t==="fa"?W_e():U_e()}),V_e=()=>"Could not update permissions. Try again.",K_e=()=>"无法更新权限。请重试。",Q_e=()=>"به‌روزرسانی مجوزها انجام نشد. دوباره تلاش کنید.",Y_e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?K_e():t==="fa"?Q_e():V_e()}),X_e=()=>"Work details",Z_e=()=>"工作详情",J_e=()=>"جزئیات کار",e0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Z_e():t==="fa"?J_e():X_e()}),t0e=e=>`${e==null?void 0:e.minutes}m ${e==null?void 0:e.seconds}s`,n0e=e=>`${e==null?void 0:e.minutes}分${e==null?void 0:e.seconds}秒`,r0e=e=>`${e==null?void 0:e.minutes} دقیقه ${e==null?void 0:e.seconds} ثانیه`,s0e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?n0e(e):t==="fa"?r0e(e):t0e(e)}),i0e=e=>`Worked for ${e==null?void 0:e.duration}`,a0e=e=>`已工作 ${e==null?void 0:e.duration}`,o0e=e=>`به‌مدت ${e==null?void 0:e.duration} کار کرد`,l0e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?a0e(e):t==="fa"?o0e(e):i0e(e)}),c0e=()=>"Working…",u0e=()=>"正在工作…",d0e=()=>"در حال کار…",e6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?u0e():t==="fa"?d0e():c0e()}),f0e=()=>"Close tab",h0e=()=>"关闭标签页",_0e=()=>"بستن زبانه",p0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?h0e():t==="fa"?_0e():f0e()}),m0e=()=>"Changes",g0e=()=>"更改",v0e=()=>"تغییرات",CD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?g0e():t==="fa"?v0e():m0e()}),b0e=()=>"Code browser view",y0e=()=>"代码浏览器视图",x0e=()=>"نمای مرورگر کد",w0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?y0e():t==="fa"?x0e():b0e()}),S0e=()=>"Files",k0e=()=>"文件",C0e=()=>"فایل‌ها",E0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?k0e():t==="fa"?C0e():S0e()}),N0e=()=>"Refresh",z0e=()=>"刷新",j0e=()=>"تازه‌سازی",BE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?z0e():t==="fa"?j0e():N0e()}),T0e=()=>"listing truncated",A0e=()=>"列表已截断",R0e=()=>"فهرست کوتاه شده است",M0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?A0e():t==="fa"?R0e():T0e()}),D0e=()=>"No files.",L0e=()=>"没有文件。",O0e=()=>"فایلی وجود ندارد.",I0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?L0e():t==="fa"?O0e():D0e()}),B0e=()=>"Refresh failed:",$0e=()=>"刷新失败:",P0e=()=>"تازه‌سازی ناموفق بود:",F0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$0e():t==="fa"?P0e():B0e()}),H0e=()=>"Cancelling…",q0e=()=>"正在取消…",U0e=()=>"در حال لغو…",G0e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?q0e():t==="fa"?U0e():H0e()}),W0e=()=>"Checking…",V0e=()=>"正在检查…",K0e=()=>"در حال بررسی…",Vi=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?V0e():t==="fa"?K0e():W0e()}),Q0e=()=>"Copied",Y0e=()=>"已复制",X0e=()=>"کپی شد",tp=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Y0e():t==="fa"?X0e():Q0e()}),Z0e=e=>`Failed to load: ${e==null?void 0:e.error}`,J0e=e=>`加载失败:${e==null?void 0:e.error}`,epe=e=>`بارگذاری ناموفق بود: ${e==null?void 0:e.error}`,ED=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?J0e(e):t==="fa"?epe(e):Z0e(e)}),tpe=()=>"Loading…",npe=()=>"正在加载…",rpe=()=>"در حال بارگیری…",ND=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?npe():t==="fa"?rpe():tpe()}),spe=e=>`+ ${e==null?void 0:e.count} more`,ipe=e=>`另有 ${e==null?void 0:e.count} 项`,ape=e=>`${e==null?void 0:e.count}+ مورد دیگر`,ope=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ipe(e):t==="fa"?ape(e):spe(e)}),lpe=()=>"Rendered view",cpe=()=>"渲染视图",upe=()=>"نمای رندرشده",tv=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cpe():t==="fa"?upe():lpe()}),dpe=()=>"Save",fpe=()=>"保存",hpe=()=>"ذخیره",Ho=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fpe():t==="fa"?hpe():dpe()}),_pe=()=>"Saving…",ppe=()=>"正在保存…",mpe=()=>"در حال ذخیره…",Xi=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ppe():t==="fa"?mpe():_pe()}),gpe=()=>"Show less",vpe=()=>"收起",bpe=()=>"نمایش کمتر",zD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vpe():t==="fa"?bpe():gpe()}),ype=()=>"Show more",xpe=()=>"展开",wpe=()=>"نمایش بیشتر",Spe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xpe():t==="fa"?wpe():ype()}),kpe=()=>"Stop",Cpe=()=>"停止",Epe=()=>"توقف",jD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cpe():t==="fa"?Epe():kpe()}),Npe=()=>"Stopping…",zpe=()=>"正在停止…",jpe=()=>"در حال توقف…",Tpe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zpe():t==="fa"?jpe():Npe()}),Ape=()=>"View source",Rpe=()=>"查看源代码",Mpe=()=>"نمایش متن منبع",Zf=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rpe():t==="fa"?Mpe():Ape()}),Dpe=()=>"Runs as a remote Hugging Face Job",Lpe=()=>"作为远程 Hugging Face Job 运行",Ope=()=>"به‌صورت Hugging Face Job دوردست اجرا می‌شود",Ipe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lpe():t==="fa"?Ope():Dpe()}),Bpe=()=>"Runs as a Job on your Kubernetes cluster",$pe=()=>"作为 Kubernetes 集群上的 Job 运行",Ppe=()=>"به‌صورت Job روی خوشهٔ Kubernetes اجرا می‌شود",Fpe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$pe():t==="fa"?Ppe():Bpe()}),Hpe=()=>"Runs directly on this computer",qpe=()=>"直接在此计算机上运行",Upe=()=>"مستقیماً روی این رایانه اجرا می‌شود",Gpe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qpe():t==="fa"?Upe():Hpe()}),Wpe=()=>"Runs in a remote Modal sandbox",Vpe=()=>"在远程 Modal 沙箱中运行",Kpe=()=>"در sandbox دوردست Modal اجرا می‌شود",Qpe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vpe():t==="fa"?Kpe():Wpe()}),Ype=()=>"Runs on an ephemeral OpenResearch box",Xpe=()=>"在临时 OpenResearch 主机上运行",Zpe=()=>"روی میزبان موقت OpenResearch اجرا می‌شود",Jpe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xpe():t==="fa"?Zpe():Ype()}),eme=()=>"Runs on the connected Ray cluster",tme=()=>"在已连接的 Ray 集群上运行",nme=()=>"روی خوشهٔ متصل Ray اجرا می‌شود",rme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tme():t==="fa"?nme():eme()}),sme=()=>"Runs as a scheduled job on your Slurm cluster",ime=()=>"作为 Slurm 集群上的调度作业运行",ame=()=>"به‌صورت کار زمان‌بندی‌شده روی خوشهٔ Slurm اجرا می‌شود",ome=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ime():t==="fa"?ame():sme()}),lme=()=>"Runs on a host from your SSH config",cme=()=>"在 SSH 配置中的主机上运行",ume=()=>"روی میزبانی از پیکربندی SSH اجرا می‌شود",dme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cme():t==="fa"?ume():lme()}),fme=()=>"Runs through Tinker’s remote compute",hme=()=>"通过 Tinker 远程算力运行",_me=()=>"از طریق رایانش دوردست Tinker اجرا می‌شود",pme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hme():t==="fa"?_me():fme()}),mme=()=>"HF Jobs",gme=()=>"HF Jobs",vme=()=>"HF Jobs",bme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gme():t==="fa"?vme():mme()}),yme=()=>"Kubernetes",xme=()=>"Kubernetes",wme=()=>"Kubernetes",Sme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xme():t==="fa"?wme():yme()}),kme=()=>"This machine",Cme=()=>"此计算机",Eme=()=>"این رایانه",TD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cme():t==="fa"?Eme():kme()}),Nme=()=>"Modal",zme=()=>"Modal",jme=()=>"Modal",Tme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zme():t==="fa"?jme():Nme()}),Ame=()=>"OpenResearch",Rme=()=>"OpenResearch",Mme=()=>"OpenResearch",Dme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rme():t==="fa"?Mme():Ame()}),Lme=()=>"Ray",Ome=()=>"Ray",Ime=()=>"Ray",Bme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ome():t==="fa"?Ime():Lme()}),$me=()=>"Slurm",Pme=()=>"Slurm",Fme=()=>"Slurm",Hme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pme():t==="fa"?Fme():$me()}),qme=()=>"SSH",Ume=()=>"SSH",Gme=()=>"SSH",Wme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ume():t==="fa"?Gme():qme()}),Vme=()=>"Tinker",Kme=()=>"Tinker",Qme=()=>"Tinker",Yme=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kme():t==="fa"?Qme():Vme()}),Xme=()=>"A Hugging Face Job runs remotely in your account using the selected hardware. Usage is billed by Hugging Face.",Zme=()=>"Hugging Face Job 使用所选硬件在你的账户中远程运行。费用由 Hugging Face 收取。",Jme=()=>"یک Hugging Face Job با سخت‌افزار انتخاب‌شده در حساب شما از راه دور اجرا می‌شود. هزینه را Hugging Face دریافت می‌کند.",ege=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zme():t==="fa"?Jme():Xme()}),tge=()=>"A Modal sandbox runs remotely in your account using the selected hardware and scales to zero after the run.",nge=()=>"Modal 沙箱使用所选硬件在你的账户中远程运行,并在运行结束后缩容到零。",rge=()=>"یک sandbox از Modal با سخت‌افزار انتخاب‌شده در حساب شما از راه دور اجرا می‌شود و پس از اجرا به صفر مقیاس می‌یابد.",sge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nge():t==="fa"?rge():tge()}),ige=()=>"An ephemeral OpenResearch box runs the experiment, is billed to your organization, and is deleted when the run ends.",age=()=>"临时 OpenResearch 主机运行实验,费用计入你的组织,并在运行结束后删除。",oge=()=>"یک میزبان موقت OpenResearch آزمایش را اجرا می‌کند، هزینه به سازمان شما منظور می‌شود و میزبان پس از پایان حذف می‌گردد.",lge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?age():t==="fa"?oge():ige()}),cge=()=>"This computer must stay awake and online while Tinker runs.",uge=()=>"Tinker 运行时,此计算机必须保持唤醒和联网。",dge=()=>"هنگام اجرای Tinker، این رایانه باید روشن و آنلاین بماند.",fge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uge():t==="fa"?dge():cge()}),hge=()=>"Context window",_ge=()=>"上下文窗口",pge=()=>"پنجرهٔ زمینه",mge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_ge():t==="fa"?pge():hge()}),gge=()=>"Context window used",vge=()=>"已使用的上下文窗口",bge=()=>"پنجرهٔ زمینهٔ استفاده‌شده",yge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vge():t==="fa"?bge():gge()}),xge=e=>`${e==null?void 0:e.value} tokens`,wge=e=>`${e==null?void 0:e.value} 个 token`,Sge=e=>`${e==null?void 0:e.value} توکن`,kge=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?wge(e):t==="fa"?Sge(e):xge(e)}),Cge=e=>`${e==null?void 0:e.used} / ${e==null?void 0:e.total} (${e==null?void 0:e.percent})`,Ege=e=>`${e==null?void 0:e.used} / ${e==null?void 0:e.total}(${e==null?void 0:e.percent})`,Nge=e=>`${e==null?void 0:e.used} از ${e==null?void 0:e.total} (${e==null?void 0:e.percent})`,zge=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Ege(e):t==="fa"?Nge(e):Cge(e)}),jge=()=>"No runs yet — ask the agent to launch one.",Tge=()=>"尚无运行——让智能体启动一个。",Age=()=>"هنوز اجرایی وجود ندارد — از عامل بخواهید یکی را آغاز کند.",Rge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tge():t==="fa"?Age():jge()}),Mge=()=>"Run",Dge=()=>"运行",Lge=()=>"اجرا",$E=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Dge():t==="fa"?Lge():Mge()}),Oge=()=>"Switch run",Ige=()=>"切换运行",Bge=()=>"تغییر اجرا",$ge=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ige():t==="fa"?Bge():Oge()}),Pge=e=>`${e==null?void 0:e.days}d ${e==null?void 0:e.hours}h`,Fge=e=>`${e==null?void 0:e.days} 天 ${e==null?void 0:e.hours} 小时`,Hge=e=>`${e==null?void 0:e.days} روز و ${e==null?void 0:e.hours} ساعت`,qge=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Fge(e):t==="fa"?Hge(e):Pge(e)}),Uge=e=>`${e==null?void 0:e.hours}h ${e==null?void 0:e.minutes}m`,Gge=e=>`${e==null?void 0:e.hours} 小时 ${e==null?void 0:e.minutes} 分钟`,Wge=e=>`${e==null?void 0:e.hours} ساعت و ${e==null?void 0:e.minutes} دقیقه`,Vge=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Gge(e):t==="fa"?Wge(e):Uge(e)}),Kge=e=>`${e==null?void 0:e.value}m`,Qge=e=>`${e==null?void 0:e.value} 分钟`,Yge=e=>`${e==null?void 0:e.value} دقیقه`,Xge=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Qge(e):t==="fa"?Yge(e):Kge(e)}),Zge=e=>`${e==null?void 0:e.value}s`,Jge=e=>`${e==null?void 0:e.value} 秒`,e1e=e=>`${e==null?void 0:e.value} ثانیه`,t1e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Jge(e):t==="fa"?e1e(e):Zge(e)}),n1e=()=>"Code",r1e=()=>"代码",s1e=()=>"کد",i1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?r1e():t==="fa"?s1e():n1e()}),a1e=()=>"created",o1e=()=>"创建于",l1e=()=>"ایجادشده",c1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?o1e():t==="fa"?l1e():a1e()}),u1e=()=>"from",d1e=()=>"来自",f1e=()=>"از",h1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?d1e():t==="fa"?f1e():u1e()}),_1e=()=>"Logs",p1e=()=>"日志",m1e=()=>"گزارش‌ها",g1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?p1e():t==="fa"?m1e():_1e()}),v1e=()=>"Latest run",b1e=()=>"最新运行",y1e=()=>"آخرین اجرا",x1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?b1e():t==="fa"?y1e():v1e()}),w1e=()=>"Code",S1e=()=>"代码",k1e=()=>"کد",C1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?S1e():t==="fa"?k1e():w1e()}),E1e=()=>"Commit",N1e=()=>"提交",z1e=()=>"کامیت",j1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?N1e():t==="fa"?z1e():E1e()}),T1e=()=>"created",A1e=()=>"创建于",R1e=()=>"ایجادشده",M1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?A1e():t==="fa"?R1e():T1e()}),D1e=()=>"Description",L1e=()=>"说明",O1e=()=>"توضیحات",I1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?L1e():t==="fa"?O1e():D1e()}),B1e=()=>"Duration",$1e=()=>"时长",P1e=()=>"مدت",F1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$1e():t==="fa"?P1e():B1e()}),H1e=()=>"exit",q1e=()=>"退出码",U1e=()=>"خروج",G1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?q1e():t==="fa"?U1e():H1e()}),W1e=()=>"from",V1e=()=>"来自",K1e=()=>"از",Q1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?V1e():t==="fa"?K1e():W1e()}),Y1e=()=>"Logs",X1e=()=>"日志",Z1e=()=>"گزارش‌ها",J1e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?X1e():t==="fa"?Z1e():Y1e()}),eve=()=>"Run",tve=()=>"运行",nve=()=>"اجرا",rve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tve():t==="fa"?nve():eve()}),sve=()=>"Run history",ive=()=>"运行历史",ave=()=>"تاریخچهٔ اجرا",ove=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ive():t==="fa"?ave():sve()}),lve=()=>"Started",cve=()=>"开始时间",uve=()=>"آغاز",dve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cve():t==="fa"?uve():lve()}),fve=()=>"Runs",hve=()=>"运行",_ve=()=>"اجراها",pve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hve():t==="fa"?_ve():fve()}),mve=()=>"Experiments and their runs will appear here. Ask the agent to set up an experiment to get started.",gve=()=>"实验及其运行会显示在这里。让智能体设置一个实验即可开始。",vve=()=>"آزمایش‌ها و اجراهای آن‌ها اینجا نمایش داده می‌شوند. برای شروع، از عامل بخواهید آزمایشی راه‌اندازی کند.",bve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gve():t==="fa"?vve():mve()}),yve=()=>"No runs yet",xve=()=>"还没有运行",wve=()=>"هنوز اجرایی وجود ندارد",Sve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xve():t==="fa"?wve():yve()}),kve=()=>"No experiments yet.",Cve=()=>"还没有实验。",Eve=()=>"هنوز آزمایشی وجود ندارد.",Nve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cve():t==="fa"?Eve():kve()}),zve=()=>"Not run yet",jve=()=>"尚未运行",Tve=()=>"هنوز اجرا نشده",Ave=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jve():t==="fa"?Tve():zve()}),Rve=()=>"1 run",Mve=()=>"1 次运行",Dve=()=>"۱ اجرا",Lve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Mve():t==="fa"?Dve():Rve()}),Ove=()=>"Open logs",Ive=()=>"打开日志",Bve=()=>"باز کردن گزارش‌ها",$ve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ive():t==="fa"?Bve():Ove()}),Pve=e=>`${e==null?void 0:e.count} runs`,Fve=e=>`${e==null?void 0:e.count} 次运行`,Hve=e=>`${e==null?void 0:e.count} اجرا`,qve=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Fve(e):t==="fa"?Hve(e):Pve(e)}),Uve=()=>"Stop requested",Gve=()=>"已请求停止",Wve=()=>"درخواست توقف ثبت شد",Vve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Gve():t==="fa"?Wve():Uve()}),Kve=()=>"Stop run",Qve=()=>"停止运行",Yve=()=>"توقف اجرا",Xve=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Qve():t==="fa"?Yve():Kve()}),Zve=()=>"Code",Jve=()=>"代码",ebe=()=>"کد",tbe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Jve():t==="fa"?ebe():Zve()}),nbe=()=>"Experiments",rbe=()=>"实验",sbe=()=>"آزمایش‌ها",ibe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rbe():t==="fa"?sbe():nbe()}),abe=()=>"Logs",obe=()=>"日志",lbe=()=>"گزارش‌ها",cbe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?obe():t==="fa"?lbe():abe()}),ube=()=>"Stop failed:",dbe=()=>"停止失败:",fbe=()=>"توقف ناموفق بود:",hbe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dbe():t==="fa"?fbe():ube()}),_be=()=>"Clipboard access is unavailable.",pbe=()=>"无法访问剪贴板。",mbe=()=>"دسترسی به کلیپ‌بورد در دسترس نیست.",AD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pbe():t==="fa"?mbe():_be()}),gbe=e=>`Delete “${e==null?void 0:e.path}”? This cannot be undone.`,vbe=e=>`删除“${e==null?void 0:e.path}”?此操作无法撤销。`,bbe=e=>`«${e==null?void 0:e.path}» حذف شود؟ این کار قابل بازگشت نیست.`,ybe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?vbe(e):t==="fa"?bbe(e):gbe(e)}),xbe=()=>"Duplicate",wbe=()=>"创建副本",Sbe=()=>"ایجاد نسخهٔ تکراری",kbe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wbe():t==="fa"?Sbe():xbe()}),Cbe=e=>`File actions for ${e==null?void 0:e.path}`,Ebe=e=>`${e==null?void 0:e.path} 的文件操作`,Nbe=e=>`عملیات فایل برای ${e==null?void 0:e.path}`,zbe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Ebe(e):t==="fa"?Nbe(e):Cbe(e)}),jbe=()=>"Open",Tbe=()=>"打开",Abe=()=>"باز کردن",Rbe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tbe():t==="fa"?Abe():jbe()}),Mbe=e=>`Rename ${e==null?void 0:e.path}`,Dbe=e=>`重命名 ${e==null?void 0:e.path}`,Lbe=e=>`تغییر نام ${e==null?void 0:e.path}`,Obe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Dbe(e):t==="fa"?Lbe(e):Mbe(e)}),Ibe=e=>`Not in the ${e==null?void 0:e.root} — showing the copy from the project’s artifacts.`,Bbe=e=>`${e==null?void 0:e.root} 中没有该文件——当前显示项目产物中的副本。`,$be=e=>`فایل در ${e==null?void 0:e.root} نیست — نسخهٔ موجود در خروجی‌های پروژه نمایش داده می‌شود.`,Pbe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Bbe(e):t==="fa"?$be(e):Ibe(e)}),Fbe=()=>"Binary file — no inline preview.",Hbe=()=>"二进制文件——无法内嵌预览。",qbe=()=>"فایل دودویی است — پیش‌نمایش درون‌خطی ندارد.",Ube=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hbe():t==="fa"?qbe():Fbe()}),Gbe=()=>"This file changed on disk. Your edits have not been overwritten.",Wbe=()=>"此文件已在磁盘上更改。您的编辑未被覆盖。",Vbe=()=>"این فایل روی دیسک تغییر کرده است. ویرایش‌های شما جایگزین نشده‌اند.",PE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wbe():t==="fa"?Vbe():Gbe()}),Kbe=()=>"Compile failed",Qbe=()=>"编译失败",Ybe=()=>"کامپایل ناموفق بود",Xbe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Qbe():t==="fa"?Ybe():Kbe()}),Zbe=()=>"Compile PDF",Jbe=()=>"编译 PDF",eye=()=>"کامپایل PDF",FE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Jbe():t==="fa"?eye():Zbe()}),tye=()=>"Compiled, but the engine reported errors — check the output below.",nye=()=>"编译已完成,但引擎报告了错误 — 请查看下方输出。",rye=()=>"کامپایل انجام شد، اما موتور خطا گزارش کرد — خروجی پایین را بررسی کنید.",sye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nye():t==="fa"?rye():tye()}),iye=()=>"Copy command",aye=()=>"复制命令",oye=()=>"کپی فرمان",lye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aye():t==="fa"?oye():iye()}),cye=()=>"Copy install command",uye=()=>"复制安装命令",dye=()=>"کپی فرمان نصب",fye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uye():t==="fa"?dye():cye()}),hye=()=>"This file was deleted on disk. Your edits have not been discarded.",_ye=()=>"此文件已从磁盘删除。您的编辑未被丢弃。",pye=()=>"این فایل از روی دیسک حذف شده است. ویرایش‌های شما حذف نشده‌اند.",HE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_ye():t==="fa"?pye():hye()}),mye=()=>"Discard my edits and reload",gye=()=>"放弃我的编辑并重新加载",vye=()=>"نادیده گرفتن ویرایش‌های من و بارگیری دوباره",bye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gye():t==="fa"?vye():mye()}),yye=()=>"Discard unsaved changes and close this file?",xye=()=>"要丢弃未保存的更改并关闭此文件吗?",wye=()=>"تغییرات ذخیره‌نشده حذف و فایل بسته شود؟",qE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xye():t==="fa"?wye():yye()}),Sye=()=>"Dismiss",kye=()=>"关闭",Cye=()=>"بستن",Eye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kye():t==="fa"?Cye():Sye()}),Nye=()=>"Dismiss compile message",zye=()=>"关闭编译消息",jye=()=>"بستن پیام کامپایل",Tye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zye():t==="fa"?jye():Nye()}),Aye=()=>"Dismiss Overleaf message",Rye=()=>"关闭 Overleaf 消息",Mye=()=>"بستن پیام Overleaf",Dye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Rye():t==="fa"?Mye():Aye()}),Lye=()=>"Download",Oye=()=>"下载",Iye=()=>"بارگیری",RD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Oye():t==="fa"?Iye():Lye()}),Bye=e=>`Download ${e==null?void 0:e.name} (out of date — recompile first)`,$ye=e=>`下载 ${e==null?void 0:e.name}(版本过旧 — 请先重新编译)`,Pye=e=>`دانلود ${e==null?void 0:e.name} (قدیمی است — ابتدا دوباره کامپایل کنید)`,Fye=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?$ye(e):t==="fa"?Pye(e):Bye(e)}),Hye=()=>"Failed to load file:",qye=()=>"加载文件失败:",Uye=()=>"بارگیری فایل ناموفق بود:",UE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qye():t==="fa"?Uye():Hye()}),Gye=()=>"File truncated — showing the first 512 KB.",Wye=()=>"文件已截断——仅显示前 512 KB。",Vye=()=>"فایل کوتاه شده است — فقط ۵۱۲ کیلوبایت نخست نمایش داده می‌شود.",Kye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wye():t==="fa"?Vye():Gye()}),Qye=()=>"The page below stops partway — the full file could not be loaded.",Yye=()=>"下方页面在中途结束——无法加载完整文件。",Xye=()=>"صفحهٔ زیر در میانه متوقف می‌شود — فایل کامل بارگیری نشد.",Zye=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Yye():t==="fa"?Xye():Qye()}),Jye=e=>`Rendered HTML: ${e==null?void 0:e.name}`,e2e=e=>`已渲染的 HTML:${e==null?void 0:e.name}`,t2e=e=>`HTML رندرشده: ${e==null?void 0:e.name}`,n2e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?e2e(e):t==="fa"?t2e(e):Jye(e)}),r2e=()=>"Loading…",s2e=()=>"正在加载…",i2e=()=>"در حال بارگیری…",MD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?s2e():t==="fa"?i2e():r2e()}),a2e=()=>"File not found.",o2e=()=>"找不到文件。",l2e=()=>"فایل پیدا نشد.",c2e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?o2e():t==="fa"?l2e():a2e()}),u2e=e=>`File not found in the project’s artifacts or the ${e==null?void 0:e.root}.`,d2e=e=>`在项目产物或${e==null?void 0:e.root}中找不到此文件。`,f2e=e=>`فایل در خروجی‌های پروژه یا ${e==null?void 0:e.root} پیدا نشد.`,h2e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?d2e(e):t==="fa"?f2e(e):u2e(e)}),_2e=e=>`File not found on branch ${e==null?void 0:e.branch}.`,p2e=e=>`在分支 ${e==null?void 0:e.branch} 上找不到此文件。`,m2e=e=>`فایل در شاخهٔ ${e==null?void 0:e.branch} پیدا نشد.`,g2e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?p2e(e):t==="fa"?m2e(e):_2e(e)}),v2e=()=>"File not found on disk.",b2e=()=>"磁盘上找不到此文件。",y2e=()=>"فایل روی دیسک پیدا نشد.",x2e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?b2e():t==="fa"?y2e():v2e()}),w2e=e=>`File not found in the ${e==null?void 0:e.root} or the project’s artifacts.`,S2e=e=>`在${e==null?void 0:e.root}或项目产物中找不到此文件。`,k2e=e=>`فایل در ${e==null?void 0:e.root} یا خروجی‌های پروژه پیدا نشد.`,C2e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?S2e(e):t==="fa"?k2e(e):w2e(e)}),E2e=e=>`Not in the project’s artifacts — showing the copy from the ${e==null?void 0:e.root}.`,N2e=e=>`项目产物中没有此文件 — 正在显示${e==null?void 0:e.root}中的副本。`,z2e=e=>`در خروجی‌های پروژه نیست — نسخهٔ موجود در ${e==null?void 0:e.root} نمایش داده می‌شود.`,j2e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?N2e(e):t==="fa"?z2e(e):E2e(e)}),T2e=()=>"Open in default editor",A2e=()=>"在默认编辑器中打开",R2e=()=>"باز کردن در ویرایشگر پیش‌فرض",GE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?A2e():t==="fa"?R2e():T2e()}),M2e=()=>"Overleaf's copy of this file was pulled while you had unsaved edits, so what you see is no longer what is on disk. Saving now sends this draft to Overleaf instead.",D2e=()=>"你有未保存的编辑时,Overleaf 上的文件副本被拉取,因此当前内容已与磁盘不同。现在保存会将此草稿发送到 Overleaf。",L2e=()=>"هنگامی که ویرایش‌های ذخیره‌نشده داشتید، نسخهٔ Overleaf این فایل دریافت شد؛ بنابراین آنچه می‌بینید دیگر با فایل روی دیسک یکی نیست. ذخیره‌سازی اکنون این پیش‌نویس را به Overleaf می‌فرستد.",O2e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?D2e():t==="fa"?L2e():M2e()}),I2e=()=>"Overwrite disk file",B2e=()=>"覆盖磁盘文件",$2e=()=>"بازنویسی فایل روی دیسک",P2e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?B2e():t==="fa"?$2e():I2e()}),F2e=()=>"Compiled PDF is out of date",H2e=()=>"已编译的 PDF 不是最新版本",q2e=()=>"PDF کامپایل‌شده به‌روز نیست",U2e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?H2e():t==="fa"?q2e():F2e()}),G2e=()=>"project clone",W2e=()=>"项目克隆",V2e=()=>"کلون پروژه",Ng=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?W2e():t==="fa"?V2e():G2e()}),K2e=()=>"Recompile PDF",Q2e=()=>"重新编译 PDF",Y2e=()=>"کامپایل دوبارهٔ PDF",WE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Q2e():t==="fa"?Y2e():K2e()}),X2e=()=>"Reload from disk",Z2e=()=>"从磁盘重新加载",J2e=()=>"بارگذاری مجدد از دیسک",exe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Z2e():t==="fa"?J2e():X2e()}),txe=()=>"Save failed",nxe=()=>"保存失败",rxe=()=>"ذخیره ناموفق بود",sxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nxe():t==="fa"?rxe():txe()}),ixe=()=>"Saving…",axe=()=>"正在保存…",oxe=()=>"در حال ذخیره…",lxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?axe():t==="fa"?oxe():ixe()}),cxe=()=>"Selected — press ⌘C",uxe=()=>"已选中 — 按 ⌘C 复制",dxe=()=>"انتخاب شد — برای کپی ⌘C را بزنید",fxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uxe():t==="fa"?dxe():cxe()}),hxe=()=>"session’s worktree",_xe=()=>"会话工作树",pxe=()=>"درخت کاری نشست",zg=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_xe():t==="fa"?pxe():hxe()}),mxe=()=>"Show compiled PDF",gxe=()=>"显示已编译的 PDF",vxe=()=>"نمایش PDF کامپایل‌شده",VE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gxe():t==="fa"?vxe():mxe()}),bxe=()=>"This PDF was compiled from an earlier version of the source — recompile to update it.",yxe=()=>"此 PDF 由较早版本的源文件编译而成——请重新编译以更新。",xxe=()=>"این PDF از نسخه‌ای قدیمی‌تر از منبع ساخته شده است — برای به‌روزرسانی دوباره کامپایل کنید.",wxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yxe():t==="fa"?xxe():bxe()}),Sxe=()=>"This session's worktree isn't available — showing the project clone's copy.",kxe=()=>"此会话的工作树不可用——当前显示项目克隆中的副本。",Cxe=()=>"درخت کاری این نشست در دسترس نیست — نسخهٔ کلون پروژه نمایش داده می‌شود.",Exe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kxe():t==="fa"?Cxe():Sxe()}),Nxe=()=>"Unsaved",zxe=()=>"未保存",jxe=()=>"ذخیره نشده",DD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zxe():t==="fa"?jxe():Nxe()}),Txe=()=>"Unsaved — ⌘S to save",Axe=()=>"未保存 — 按 ⌘S 保存",Rxe=()=>"ذخیره نشده — برای ذخیره ⌘S را بزنید",Mxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Axe():t==="fa"?Rxe():Txe()}),Dxe=()=>"Update orx on the remote machine to edit this file safely.",Lxe=()=>"请更新远程计算机上的 orx,以安全编辑此文件。",Oxe=()=>"برای ویرایش ایمن این فایل، orx را روی دستگاه ریموت به‌روز کنید.",Ixe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lxe():t==="fa"?Oxe():Dxe()}),Bxe=()=>"This session’s worktree isn’t available, and the file isn’t in the project clone or its artifacts.",$xe=()=>"此会话的工作树不可用,项目克隆和产物中也没有此文件。",Pxe=()=>"درخت کاری این نشست در دسترس نیست و فایل در نسخهٔ محلی پروژه یا خروجی‌های آن هم پیدا نشد.",Fxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$xe():t==="fa"?Pxe():Bxe()}),Hxe=()=>"Files in this workspace will appear here. Ask the agent to create a file to get started.",qxe=()=>"此工作区中的文件会显示在这里。让智能体创建一个文件即可开始。",Uxe=()=>"فایل‌های این فضای کاری اینجا نمایش داده می‌شوند. برای شروع، از عامل بخواهید فایلی ایجاد کند.",Gxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qxe():t==="fa"?Uxe():Hxe()}),Wxe=()=>"Back to preview",Vxe=()=>"返回预览",Kxe=()=>"بازگشت به پیش‌نمایش",Qxe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vxe():t==="fa"?Kxe():Wxe()}),Yxe=e=>`${e==null?void 0:e.count} changed files`,Xxe=e=>`${e==null?void 0:e.count} 个已更改文件`,Zxe=e=>`${e==null?void 0:e.count} فایل تغییرکرده`,LD=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Xxe(e):t==="fa"?Zxe(e):Yxe(e)}),Jxe=()=>"Changed files",ewe=()=>"已更改文件",twe=()=>"فایل‌های تغییرکرده",nwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ewe():t==="fa"?twe():Jxe()}),rwe=()=>"Diff preview truncated",swe=()=>"差异预览已截断",iwe=()=>"پیش‌نمایش تفاوت کوتاه شده است",awe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?swe():t==="fa"?iwe():rwe()}),owe=e=>`${e==null?void 0:e.count} files shown (partial)`,lwe=e=>`显示 ${e==null?void 0:e.count} 个文件(部分)`,cwe=e=>`${e==null?void 0:e.count} فایل نمایش داده شده (ناقص)`,uwe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?lwe(e):t==="fa"?cwe(e):owe(e)}),dwe=()=>"No changes.",fwe=()=>"没有更改。",hwe=()=>"تغییری وجود ندارد.",_we=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fwe():t==="fa"?hwe():dwe()}),pwe=()=>"No complete file preview was available before the cutoff.",mwe=()=>"在截断位置之前没有完整的文件预览。",gwe=()=>"پیش از نقطهٔ برش، پیش‌نمایش کاملی از هیچ فایلی موجود نبود.",vwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mwe():t==="fa"?gwe():pwe()}),bwe=()=>"No textual diff for this file.",ywe=()=>"此文件没有文本差异。",xwe=()=>"برای این فایل تفاوت متنی وجود ندارد.",wwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ywe():t==="fa"?xwe():bwe()}),Swe=()=>"1 changed file",kwe=()=>"1 个已更改文件",Cwe=()=>"۱ فایل تغییرکرده",OD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kwe():t==="fa"?Cwe():Swe()}),Ewe=()=>"1 file shown (partial)",Nwe=()=>"显示 1 个文件(部分)",zwe=()=>"۱ فایل نمایش داده شده (ناقص)",jwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nwe():t==="fa"?zwe():Ewe()}),Twe=()=>"Unable to parse this diff.",Awe=()=>"无法解析此差异。",Rwe=()=>"خواندن این تفاوت ممکن نبود.",Mwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Awe():t==="fa"?Rwe():Twe()}),Dwe=e=>`Showing the first ${e==null?void 0:e.limit} (${e==null?void 0:e.read} read). View the complete diff locally with git.`,Lwe=e=>`正在显示前 ${e==null?void 0:e.limit}(已读取 ${e==null?void 0:e.read})。请在本地使用 git 查看完整差异。`,Owe=e=>`نخستین ${e==null?void 0:e.limit} نمایش داده می‌شود (${e==null?void 0:e.read} خوانده شد). تفاوت کامل را با git به‌صورت محلی ببینید.`,Iwe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Lwe(e):t==="fa"?Owe(e):Dwe(e)}),Bwe=()=>"View full diff",$we=()=>"查看完整差异",Pwe=()=>"نمایش تفاوت کامل",Fwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$we():t==="fa"?Pwe():Bwe()}),Hwe=()=>"Create a token ↗",qwe=()=>"创建令牌 ↗",Uwe=()=>"ساخت توکن ↗",Gwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qwe():t==="fa"?Uwe():Hwe()}),Wwe=()=>"All projects",Vwe=()=>"所有项目",Kwe=()=>"همهٔ پروژه‌ها",KE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vwe():t==="fa"?Kwe():Wwe()}),Qwe=()=>"Configure Repository",Ywe=()=>"配置仓库",Xwe=()=>"پیکربندی مخزن",Zwe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ywe():t==="fa"?Xwe():Qwe()}),Jwe=()=>"Create a new project",e4e=()=>"新建项目",t4e=()=>"ایجاد پروژهٔ جدید",n4e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?e4e():t==="fa"?t4e():Jwe()}),r4e=()=>"Hide sidebar",s4e=()=>"隐藏侧边栏",i4e=()=>"پنهان کردن نوار کناری",QE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?s4e():t==="fa"?i4e():r4e()}),a4e=()=>"Project",o4e=()=>"项目",l4e=()=>"پروژه",c4e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?o4e():t==="fa"?l4e():a4e()}),u4e=e=>`${e==null?void 0:e.count} cancelled`,d4e=e=>`${e==null?void 0:e.count} 次取消`,f4e=e=>`${e==null?void 0:e.count} لغوشده`,h4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?d4e(e):t==="fa"?f4e(e):u4e(e)}),_4e=e=>`${e==null?void 0:e.count} done`,p4e=e=>`${e==null?void 0:e.count} 次完成`,m4e=e=>`${e==null?void 0:e.count} تمام‌شده`,g4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?p4e(e):t==="fa"?m4e(e):_4e(e)}),v4e=e=>`${e==null?void 0:e.count} failed`,b4e=e=>`${e==null?void 0:e.count} 次失败`,y4e=e=>`${e==null?void 0:e.count} ناموفق`,x4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?b4e(e):t==="fa"?y4e(e):v4e(e)}),w4e=e=>`${e==null?void 0:e.count} files`,S4e=e=>`${e==null?void 0:e.count} 个文件`,k4e=e=>`${e==null?void 0:e.count} فایل`,C4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?S4e(e):t==="fa"?k4e(e):w4e(e)}),E4e=e=>`${e==null?void 0:e.count}+ files`,N4e=e=>`至少 ${e==null?void 0:e.count} 个文件`,z4e=e=>`بیش از ${e==null?void 0:e.count} فایل`,j4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?N4e(e):t==="fa"?z4e(e):E4e(e)}),T4e=e=>`${e==null?void 0:e.count} live`,A4e=e=>`${e==null?void 0:e.count} 次进行中`,R4e=e=>`${e==null?void 0:e.count} فعال`,M4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?A4e(e):t==="fa"?R4e(e):T4e(e)}),D4e=()=>"1 file",L4e=()=>"1 个文件",O4e=()=>"۱ فایل",I4e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?L4e():t==="fa"?O4e():D4e()}),B4e=()=>"1 run",$4e=()=>"1 次运行",P4e=()=>"۱ اجرا",F4e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$4e():t==="fa"?P4e():B4e()}),H4e=e=>`${e==null?void 0:e.count} runs`,q4e=e=>`${e==null?void 0:e.count} 次运行`,U4e=e=>`${e==null?void 0:e.count} اجرا`,G4e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?q4e(e):t==="fa"?U4e(e):H4e(e)}),W4e=()=>"No instances yet.",V4e=()=>"还没有实例。",K4e=()=>"هنوز نمونه‌ای وجود ندارد.",Q4e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?V4e():t==="fa"?K4e():W4e()}),Y4e=()=>"Nothing running right now.",X4e=()=>"当前没有运行中的实例。",Z4e=()=>"اکنون چیزی در حال اجرا نیست.",J4e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?X4e():t==="fa"?Z4e():Y4e()}),e3e=()=>"Select a project to see its history.",t3e=()=>"请选择一个项目以查看其历史记录。",n3e=()=>"برای دیدن تاریخچه یک پروژه انتخاب کنید.",r3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?t3e():t==="fa"?n3e():e3e()}),s3e=()=>"Select a project to see its runs.",i3e=()=>"请选择一个项目以查看其运行。",a3e=()=>"برای دیدن اجراها یک پروژه انتخاب کنید.",o3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?i3e():t==="fa"?a3e():s3e()}),l3e=()=>"View history",c3e=()=>"查看历史记录",u3e=()=>"مشاهدهٔ تاریخچه",d3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?c3e():t==="fa"?u3e():l3e()}),f3e=e=>`View history (${e==null?void 0:e.count})`,h3e=e=>`查看历史记录(${e==null?void 0:e.count})`,_3e=e=>`مشاهدهٔ تاریخچه (${e==null?void 0:e.count})`,p3e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?h3e(e):t==="fa"?_3e(e):f3e(e)}),m3e=()=>"The engine exited without producing a PDF or a log.",g3e=()=>"引擎已退出,但没有生成 PDF 或日志。",v3e=()=>"موتور بدون تولید PDF یا گزارش خارج شد.",b3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?g3e():t==="fa"?v3e():m3e()}),y3e=()=>"Loading…",x3e=()=>"正在加载…",w3e=()=>"در حال بارگیری…",S3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?x3e():t==="fa"?w3e():y3e()}),k3e=()=>"Add local model",C3e=()=>"添加本地模型",E3e=()=>"افزودن مدل محلی",ID=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?C3e():t==="fa"?E3e():k3e()}),N3e=()=>"Local server address",z3e=()=>"本地服务器地址",j3e=()=>"نشانی سرور محلی",T3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?z3e():t==="fa"?j3e():N3e()}),A3e=()=>"Find models",R3e=()=>"查找模型",M3e=()=>"یافتن مدل‌ها",D3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?R3e():t==="fa"?M3e():A3e()}),L3e=()=>"(OpenAI compatible)",O3e=()=>"(兼容 OpenAI)",I3e=()=>"(سازگار با OpenAI)",BD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?O3e():t==="fa"?I3e():L3e()}),B3e=()=>"Saved, but OpenCode did not list this model. Check installed agents again. If your OpenCode config restricts enabled providers, allow this connection before using it.",$3e=()=>"已保存,但 OpenCode 未列出该模型。请重新检查已安装的智能体。如果 OpenCode 配置限制了启用的提供商,请先允许此连接。",P3e=()=>"ذخیره شد، اما OpenCode این مدل را فهرست نکرد. عامل‌های نصب‌شده را دوباره بررسی کنید. اگر پیکربندی OpenCode ارائه‌دهندگان فعال را محدود کرده، ابتدا این اتصال را مجاز کنید.",F3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$3e():t==="fa"?P3e():B3e()}),H3e=()=>"Connected",q3e=()=>"已连接",U3e=()=>"متصل شد",G3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?q3e():t==="fa"?U3e():H3e()}),W3e=()=>"Context window",V3e=()=>"上下文窗口",K3e=()=>"پنجرهٔ زمینه",Q3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?V3e():t==="fa"?K3e():W3e()}),Y3e=()=>"Match the context window loaded in your model app. 32K is a useful starting point for tools; larger contexts use more memory.",X3e=()=>"请与模型应用中加载的上下文窗口保持一致。使用工具时可从 32K 开始;更大的上下文需要更多内存。",Z3e=()=>"اندازهٔ زمینه را با تنظیم بارگذاری‌شده در برنامهٔ مدل هماهنگ کنید. ۳۲هزار توکن نقطهٔ شروع مناسبی برای ابزارهاست؛ زمینهٔ بزرگ‌تر حافظهٔ بیشتری مصرف می‌کند.",J3e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?X3e():t==="fa"?Z3e():Y3e()}),e5e=()=>"Custom Endpoint",t5e=()=>"自定义端点",n5e=()=>"نقطهٔ اتصال سفارشی",t6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?t5e():t==="fa"?n5e():e5e()}),r5e=e=>`Disconnect ${e==null?void 0:e.name}`,s5e=e=>`断开 ${e==null?void 0:e.name}`,i5e=e=>`قطع اتصال ${e==null?void 0:e.name}`,a5e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?s5e(e):t==="fa"?i5e(e):r5e(e)}),o5e=()=>"Get OpenCode",l5e=()=>"获取 OpenCode",c5e=()=>"دریافت OpenCode",u5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?l5e():t==="fa"?c5e():o5e()}),d5e=()=>"Install OpenCode to run tools with your local model, then re-check installed agents. No cloud account is required.",f5e=()=>"安装 OpenCode 以使用本地模型执行工具,然后重新检查已安装的智能体。无需云端账户。",h5e=()=>"برای اجرای ابزارها با مدل محلی، OpenCode را نصب کنید و عامل‌های نصب‌شده را دوباره بررسی کنید. حساب ابری لازم نیست.",_5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?f5e():t==="fa"?h5e():d5e()}),p5e=()=>"API key (optional)",m5e=()=>"API 密钥(可选)",g5e=()=>"کلید API (اختیاری)",v5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?m5e():t==="fa"?g5e():p5e()}),b5e=()=>"Save model",y5e=()=>"保存模型",x5e=()=>"ذخیرهٔ مدل",w5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?y5e():t==="fa"?x5e():b5e()}),S5e=()=>"Model server",k5e=()=>"模型服务器",C5e=()=>"سرور مدل",YE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?k5e():t==="fa"?C5e():S5e()}),E5e=()=>"Local models",N5e=()=>"本地模型",z5e=()=>"مدل‌های محلی",XE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?N5e():t==="fa"?z5e():E5e()}),j5e=()=>"API token (optional)",T5e=()=>"API 令牌(可选)",A5e=()=>"توکن API (اختیاری)",R5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?T5e():t==="fa"?A5e():j5e()}),M5e=()=>"Copy",D5e=()=>"复制",L5e=()=>"کپی",n6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?D5e():t==="fa"?L5e():M5e()}),O5e=()=>"Copy code",I5e=()=>"复制代码",B5e=()=>"کپی کد",$5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?I5e():t==="fa"?B5e():O5e()}),P5e=()=>"Download",F5e=()=>"下载",H5e=()=>"بارگیری",$D=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?F5e():t==="fa"?H5e():P5e()}),q5e=()=>"This browser can’t preview this media format.",U5e=()=>"此浏览器无法预览该媒体格式。",G5e=()=>"این مرورگر نمی‌تواند این قالب رسانه را پیش‌نمایش کند.",W5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?U5e():t==="fa"?G5e():q5e()}),V5e=()=>"Add Local Model",K5e=()=>"添加本地模型",Q5e=()=>"افزودن مدل محلی",Y5e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?K5e():t==="fa"?Q5e():V5e()}),X5e=()=>" · CLI configuration",Z5e=()=>" · CLI 配置",J5e=()=>" · پیکربندی CLI",PD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Z5e():t==="fa"?J5e():X5e()}),e6e=()=>"· Default",t6e=()=>"· 默认",n6e=()=>"· پیش‌فرض",FD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?t6e():t==="fa"?n6e():e6e()}),r6e=()=>"Default model",s6e=()=>"默认模型",i6e=()=>"مدل پیش‌فرض",ZE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?s6e():t==="fa"?i6e():r6e()}),a6e=()=>"Detecting harnesses…",o6e=()=>"正在检测智能体工具…",l6e=()=>"در حال شناسایی ابزارهای عامل…",c6e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?o6e():t==="fa"?l6e():a6e()}),u6e=()=>"Effort",d6e=()=>"推理强度",f6e=()=>"میزان استدلال",h6e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?d6e():t==="fa"?f6e():u6e()}),_6e=()=>"Fast speed ·",p6e=()=>"快速 ·",m6e=()=>"سرعت بالا ·",g6e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?p6e():t==="fa"?m6e():_6e()}),v6e=()=>"Mode",b6e=()=>"模式",y6e=()=>"حالت",JE=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?b6e():t==="fa"?y6e():v6e()}),x6e=()=>"Model",w6e=()=>"模型",S6e=()=>"مدل",D0=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?w6e():t==="fa"?S6e():x6e()}),k6e=e=>`${e==null?void 0:e.count} more — search to find`,C6e=e=>`还有 ${e==null?void 0:e.count} 个——搜索即可查找`,E6e=e=>`${e==null?void 0:e.count} مورد دیگر — برای یافتن جست‌وجو کنید`,N6e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?C6e(e):t==="fa"?E6e(e):k6e(e)}),z6e=()=>"Not available",j6e=()=>"不可用",T6e=()=>"در دسترس نیست",A6e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?j6e():t==="fa"?T6e():z6e()}),R6e=()=>"Search models…",M6e=()=>"搜索模型…",D6e=()=>"جست‌وجوی مدل‌ها…",HD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?M6e():t==="fa"?D6e():R6e()}),L6e=()=>"Sessions keep their harness. Start a new chat to switch.",O6e=()=>"会话将沿用当前的智能体工具。新建聊天即可切换。",I6e=()=>"نشست‌ها ابزار عامل خود را نگه می‌دارند. برای تغییر، گفتگوی جدیدی بسازید",B6e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?O6e():t==="fa"?I6e():L6e()}),$6e=()=>"Speed",P6e=()=>"速度",F6e=()=>"سرعت",eN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?P6e():t==="fa"?F6e():$6e()}),H6e=()=>"Unavailable",q6e=()=>"不可用",U6e=()=>"در دسترس نیست",Ka=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?q6e():t==="fa"?U6e():H6e()}),G6e=e=>`Use “${e==null?void 0:e.id}” as the model ID`,W6e=e=>`使用“${e==null?void 0:e.id}”作为模型 ID`,V6e=e=>`از «${e==null?void 0:e.id}» به‌عنوان شناسهٔ مدل استفاده کنید`,K6e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?W6e(e):t==="fa"?V6e(e):G6e(e)}),Q6e=()=>"Variant",Y6e=()=>"变体",X6e=()=>"گونه",Z6e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Y6e():t==="fa"?X6e():Q6e()}),J6e=()=>"Advanced",eSe=()=>"高级",tSe=()=>"پیشرفته",nSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eSe():t==="fa"?tSe():J6e()}),rSe=()=>"Advanced · Connect GitHub",sSe=()=>"高级 · 连接 GitHub",iSe=()=>"پیشرفته · اتصال GitHub",aSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sSe():t==="fa"?iSe():rSe()}),oSe=()=>"Advanced · GitHub sync on",lSe=()=>"高级 · GitHub 同步已开启",cSe=()=>"پیشرفته · همگام‌سازی GitHub روشن است",uSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lSe():t==="fa"?cSe():oSe()}),dSe=()=>"Choose a different destination. A paper project needs a new or empty folder of its own.",fSe=()=>"请选择其他位置。论文项目需要拥有独立的新文件夹或空文件夹。",hSe=()=>"مقصد دیگری انتخاب کنید. پروژهٔ مقاله باید پوشهٔ جدید یا خالیِ جداگانه‌ای داشته باشد.",_Se=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fSe():t==="fa"?hSe():dSe()}),pSe=e=>`Change project folder; current folder: ${e==null?void 0:e.path}`,mSe=e=>`更改项目文件夹;当前文件夹:${e==null?void 0:e.path}`,gSe=e=>`تغییر پوشهٔ پروژه؛ پوشهٔ کنونی: ${e==null?void 0:e.path}`,vSe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?mSe(e):t==="fa"?gSe(e):pSe(e)}),bSe=()=>"Choose an existing project folder",ySe=()=>"选择现有项目文件夹",xSe=()=>"انتخاب پوشهٔ موجود پروژه",tN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ySe():t==="fa"?xSe():bSe()}),wSe=()=>"Choosing…",SSe=()=>"正在选择…",kSe=()=>"در حال انتخاب…",CSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?SSe():t==="fa"?kSe():wSe()}),ESe=()=>"Clone destination",NSe=()=>"克隆位置",zSe=()=>"مقصد کلون",jSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?NSe():t==="fa"?zSe():ESe()}),TSe=()=>"Clone paper project",ASe=()=>"克隆论文项目",RSe=()=>"کلون پروژهٔ مقاله",MSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ASe():t==="fa"?RSe():TSe()}),DSe=()=>"Create project",LSe=()=>"创建项目",OSe=()=>"ایجاد پروژه",nN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LSe():t==="fa"?OSe():DSe()}),ISe=()=>"Creating…",BSe=()=>"正在创建…",$Se=()=>"در حال ایجاد…",PSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BSe():t==="fa"?$Se():ISe()}),FSe=()=>"Choose a different destination. This path is a file, not a folder.",HSe=()=>"请选择其他位置。此路径是文件,不是文件夹。",qSe=()=>"مقصد دیگری انتخاب کنید. این مسیر فایل است، نه پوشه.",wx=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HSe():t==="fa"?qSe():FSe()}),USe=()=>"A folder already exists here. Choose a different name or location, or use Existing folder.",GSe=()=>"此处已有文件夹。请选择其他名称或位置,或使用“现有文件夹”。",WSe=()=>"پوشه‌ای در این محل وجود دارد. نام یا محل دیگری انتخاب کنید، یا از «پوشهٔ موجود» استفاده کنید.",rN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?GSe():t==="fa"?WSe():USe()}),VSe=()=>"Blank project",KSe=()=>"空白项目",QSe=()=>"پروژهٔ خالی",YSe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KSe():t==="fa"?QSe():VSe()}),XSe=()=>"Cancel",ZSe=()=>"取消",JSe=()=>"لغو",eke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ZSe():t==="fa"?JSe():XSe()}),tke=()=>"Change",nke=()=>"更改",rke=()=>"تغییر",ske=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nke():t==="fa"?rke():tke()}),ike=()=>"Change selected paper",ake=()=>"更改所选论文",oke=()=>"تغییر مقالهٔ انتخاب‌شده",lke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ake():t==="fa"?oke():ike()}),cke=()=>"Check out a Git branch before using this folder.",uke=()=>"使用此文件夹前,请先检出一个 Git 分支。",dke=()=>"پیش از استفاده از این پوشه، یک شاخهٔ Git را checkout کنید.",fke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uke():t==="fa"?dke():cke()}),hke=()=>"Checking project location.",_ke=()=>"正在检查项目位置。",pke=()=>"در حال بررسی محل پروژه.",sN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_ke():t==="fa"?pke():hke()}),mke=()=>"Existing folder",gke=()=>"现有文件夹",vke=()=>"پوشهٔ موجود",bke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gke():t==="fa"?vke():mke()}),yke=()=>"Experiment branches will be pushed to the remote GitHub repository.",xke=()=>"实验分支将推送到远程 GitHub 仓库。",wke=()=>"شاخه‌های آزمایش به مخزن دوردست GitHub فرستاده می‌شوند.",Ske=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xke():t==="fa"?wke():yke()}),kke=()=>"From a paper",Cke=()=>"从论文创建",Eke=()=>"از یک مقاله",Nke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cke():t==="fa"?Eke():kke()}),zke=()=>"Git is required for experiments but is not installed. Install Git, then restart OpenResearch.",jke=()=>"实验需要 Git,但尚未安装。请安装 Git,然后重新启动 OpenResearch。",Tke=()=>"Git برای آزمایش‌ها لازم است اما نصب نیست. Git را نصب و سپس OpenResearch را دوباره راه‌اندازی کنید.",Ake=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jke():t==="fa"?Tke():zke()}),Rke=()=>"my-research",Mke=()=>"my-research",Dke=()=>"my-research",iN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Mke():t==="fa"?Dke():Rke()}),Lke=()=>"No papers found. Try an arXiv ID, URL, or a different title.",Oke=()=>"未找到论文。请尝试 arXiv ID、网址或其他标题。",Ike=()=>"مقاله‌ای پیدا نشد. یک شناسهٔ arXiv، نشانی یا عنوان دیگری را امتحان کنید.",Bke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Oke():t==="fa"?Ike():Lke()}),$ke=()=>"No public repository found on alphaXiv",Pke=()=>"在 alphaXiv 上未找到公开仓库",Fke=()=>"مخزن عمومی‌ای در alphaXiv پیدا نشد",Hke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pke():t==="fa"?Fke():$ke()}),qke=()=>"OpenResearch will start a blank project with this paper's PDF.",Uke=()=>"OpenResearch 将使用此论文的 PDF 创建空白项目。",Gke=()=>"OpenResearch یک پروژهٔ خالی با PDF این مقاله آغاز می‌کند.",Wke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Uke():t==="fa"?Gke():qke()}),Vke=()=>"Paper",Kke=()=>"论文",Qke=()=>"مقاله",Yke=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kke():t==="fa"?Qke():Vke()}),Xke=()=>"Project location",Zke=()=>"项目位置",Jke=()=>"محل پروژه",Sx=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zke():t==="fa"?Jke():Xke()}),e7e=()=>"Project name",t7e=()=>"项目名称",n7e=()=>"نام پروژه",aN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?t7e():t==="fa"?n7e():e7e()}),r7e=()=>"Search for a paper by arXiv ID, URL, or title",s7e=()=>"按 arXiv ID、网址或标题搜索论文",i7e=()=>"جست‌وجوی مقاله با شناسهٔ arXiv، نشانی یا عنوان",a7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?s7e():t==="fa"?i7e():r7e()}),o7e=()=>"Sync experiments to GitHub",l7e=()=>"将实验同步到 GitHub",c7e=()=>"همگام‌سازی آزمایش‌ها با GitHub",u7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?l7e():t==="fa"?c7e():o7e()}),d7e=()=>"That folder no longer exists. Choose it again.",f7e=()=>"该文件夹已不存在。请重新选择。",h7e=()=>"آن پوشه دیگر وجود ندارد. دوباره انتخابش کنید.",_7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?f7e():t==="fa"?h7e():d7e()}),p7e=()=>"The selected folder contains an invalid Git repository.",m7e=()=>"所选文件夹包含无效的 Git 仓库。",g7e=()=>"پوشهٔ انتخاب‌شده یک مخزن Git نامعتبر دارد.",v7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?m7e():t==="fa"?g7e():p7e()}),b7e=()=>"The selected path is not a folder.",y7e=()=>"所选路径不是文件夹。",x7e=()=>"مسیر انتخاب‌شده پوشه نیست.",w7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?y7e():t==="fa"?x7e():b7e()}),S7e=e=>`Checking ${e==null?void 0:e.repository}.`,k7e=e=>`正在检查 ${e==null?void 0:e.repository}。`,C7e=e=>`در حال بررسی ${e==null?void 0:e.repository}.`,E7e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?k7e(e):t==="fa"?C7e(e):S7e(e)}),N7e=e=>`Creates ${e==null?void 0:e.repository}.`,z7e=e=>`将创建 ${e==null?void 0:e.repository}。`,j7e=e=>`${e==null?void 0:e.repository} را ایجاد می‌کند.`,T7e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?z7e(e):t==="fa"?j7e(e):N7e(e)}),A7e=e=>`Pushes to ${e==null?void 0:e.repository}.`,R7e=e=>`将推送到 ${e==null?void 0:e.repository}。`,M7e=e=>`به ${e==null?void 0:e.repository} پوش می‌کند.`,D7e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?R7e(e):t==="fa"?M7e(e):A7e(e)}),L7e=()=>"Project location is required.",O7e=()=>"必须填写项目位置。",I7e=()=>"محل پروژه الزامی است.",oN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?O7e():t==="fa"?I7e():L7e()}),B7e=()=>"Choose a different destination. The paper repository needs a new or empty folder.",$7e=()=>"请选择其他位置。论文仓库需要一个新的或空的文件夹。",P7e=()=>"مقصد دیگری انتخاب کنید. مخزن مقاله به پوشه‌ای جدید یا خالی نیاز دارد.",lN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$7e():t==="fa"?P7e():B7e()}),F7e=()=>"A linked public code repository is cloned without credentials.",H7e=()=>"关联的公开代码仓库无需凭据即可克隆。",q7e=()=>"مخزن عمومی کدِ پیوندشده بدون نیاز به اعتبارنامه کلون می‌شود.",U7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?H7e():t==="fa"?q7e():F7e()}),G7e=e=>`Run ${e==null?void 0:e.command} before creating the project.`,W7e=e=>`创建项目前请运行 ${e==null?void 0:e.command}。`,V7e=e=>`پیش از ساخت پروژه، ${e==null?void 0:e.command} را اجرا کنید.`,K7e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?W7e(e):t==="fa"?V7e(e):G7e(e)}),Q7e=()=>"Searching alphaXiv…",Y7e=()=>"正在搜索 alphaXiv…",X7e=()=>"در حال جست‌وجوی alphaXiv…",Z7e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Y7e():t==="fa"?X7e():Q7e()}),J7e=()=>"Use folder",e8e=()=>"使用文件夹",t8e=()=>"استفاده از پوشه",n8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?e8e():t==="fa"?t8e():J7e()}),r8e=()=>"Can’t reach OpenResearch. This page is no longer live.",s8e=()=>"无法连接 OpenResearch。此页面已不再实时同步。",i8e=()=>"دسترسی به OpenResearch ممکن نیست. این صفحه دیگر همگام نیست.",E4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?s8e():t==="fa"?i8e():r8e()}),a8e=()=>"A workspace for your research agents",o8e=()=>"面向研究智能体的工作空间",l8e=()=>"فضای کاری برای عامل‌های پژوهشی شما",c8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?o8e():t==="fa"?l8e():a8e()}),u8e=()=>"Add papers that represent your research interests, including papers by other authors.",d8e=()=>"添加能够代表你研究兴趣的论文,也可以包括其他作者的论文。",f8e=()=>"مقاله‌هایی را که نمایندهٔ علایق پژوهشی شما هستند، از جمله آثار نویسندگان دیگر، اضافه کنید.",h8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?d8e():t==="fa"?f8e():u8e()}),_8e=()=>"API key",p8e=()=>"API 密钥",m8e=()=>"کلید API",r6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?p8e():t==="fa"?m8e():_8e()}),g8e=()=>"AI/ML",v8e=()=>"人工智能与机器学习",b8e=()=>"هوش مصنوعی و یادگیری ماشین",y8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?v8e():t==="fa"?b8e():g8e()}),x8e=()=>"Biology",w8e=()=>"生物学",S8e=()=>"زیست‌شناسی",k8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?w8e():t==="fa"?S8e():x8e()}),C8e=()=>"Other",E8e=()=>"其他",N8e=()=>"سایر",z8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?E8e():t==="fa"?N8e():C8e()}),j8e=()=>"Physics",T8e=()=>"物理学",A8e=()=>"فیزیک",R8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?T8e():t==="fa"?A8e():j8e()}),M8e=()=>"Back",D8e=()=>"返回",L8e=()=>"بازگشت",cN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?D8e():t==="fa"?L8e():M8e()}),O8e=()=>"Check failed",I8e=()=>"检查失败",B8e=()=>"بررسی ناموفق بود",$8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?I8e():t==="fa"?B8e():O8e()}),P8e=()=>"Checking",F8e=()=>"正在检查",H8e=()=>"در حال بررسی",q8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?F8e():t==="fa"?H8e():P8e()}),U8e=()=>"Checking Git…",G8e=()=>"正在检查 Git…",W8e=()=>"در حال بررسی Git…",V8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?G8e():t==="fa"?W8e():U8e()}),K8e=()=>"Choose a coding agent",Q8e=()=>"选择编程智能体",Y8e=()=>"یک عامل کدنویسی انتخاب کنید",X8e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Q8e():t==="fa"?Y8e():K8e()}),Z8e=()=>"Choose a coding agent to continue.",J8e=()=>"选择一个编程智能体以继续。",eCe=()=>"برای ادامه یک عامل کدنویسی انتخاب کنید.",tCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?J8e():t==="fa"?eCe():Z8e()}),nCe=()=>"Choose at least one research area to continue.",rCe=()=>"请至少选择一个研究领域后再继续。",sCe=()=>"برای ادامه دست‌کم یک حوزهٔ پژوهشی انتخاب کنید.",iCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rCe():t==="fa"?sCe():nCe()}),aCe=()=>"Choose one or more.",oCe=()=>"请选择一项或多项。",lCe=()=>"یک یا چند مورد را انتخاب کنید.",cCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oCe():t==="fa"?lCe():aCe()}),uCe=()=>"Choose your preferred coding agent",dCe=()=>"请选择首选编程智能体",fCe=()=>"عامل برنامه‌نویسی ترجیحی خود را انتخاب کنید",hCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dCe():t==="fa"?fCe():uCe()}),_Ce=()=>"Consolidate your research",pCe=()=>"集中管理研究",mCe=()=>"پژوهش خود را یکپارچه کنید",gCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pCe():t==="fa"?mCe():_Ce()}),vCe=()=>"Continue",bCe=()=>"继续",yCe=()=>"ادامه",uN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bCe():t==="fa"?yCe():vCe()}),xCe=()=>"Describe your research area to continue.",wCe=()=>"请描述你的研究领域后再继续。",SCe=()=>"برای ادامه حوزهٔ پژوهشی خود را شرح دهید.",kCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wCe():t==="fa"?SCe():xCe()}),CCe=()=>"Detecting Claude Code, Codex, OpenCode, Cursor…",ECe=()=>"正在检测 Claude Code、Codex、OpenCode、Cursor…",NCe=()=>"در حال شناسایی Claude Code، Codex، OpenCode و Cursor…",zCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ECe():t==="fa"?NCe():CCe()}),jCe=()=>"e.g. I work on sample-efficient RL for LLM post-training, focused on reward-model-free methods.",TCe=()=>"例如:我研究用于 LLM 后训练的样本高效强化学习,重点关注无需奖励模型的方法。",ACe=()=>"مثلاً روی یادگیری تقویتی کم‌نمونه برای پس‌آموزش LLM با تمرکز بر روش‌های بدون مدل پاداش کار می‌کنم.",RCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?TCe():t==="fa"?ACe():jCe()}),MCe=()=>"Everything stays local",DCe=()=>"一切都保留在本地",LCe=()=>"همه‌چیز محلی می‌ماند",OCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?DCe():t==="fa"?LCe():MCe()}),ICe=()=>"Get started",BCe=()=>"开始使用",$Ce=()=>"شروع",PCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BCe():t==="fa"?$Ce():ICe()}),FCe=()=>"Git is required for local experiments. Install Git, then re-check.",HCe=()=>"本地实验需要 Git。请安装 Git,然后重新检查。",qCe=()=>"Git برای آزمایش‌های محلی لازم است. آن را نصب و دوباره بررسی کنید.",UCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HCe():t==="fa"?qCe():FCe()}),GCe=()=>"Ground your agents",WCe=()=>"为智能体提供可靠依据",VCe=()=>"عامل‌هایتان را به منابع متصل کنید",KCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WCe():t==="fa"?VCe():GCe()}),QCe=()=>"Install broken",YCe=()=>"安装损坏",XCe=()=>"نصب خراب است",ZCe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YCe():t==="fa"?XCe():QCe()}),JCe=()=>"Install Git to continue",e9e=()=>"请安装 Git 后再继续",t9e=()=>"برای ادامه Git را نصب کنید",n9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?e9e():t==="fa"?t9e():JCe()}),r9e=()=>"Local Git",s9e=()=>"本地 Git",i9e=()=>"Git محلی",a9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?s9e():t==="fa"?i9e():r9e()}),o9e=()=>", and ",l9e=()=>" 和 ",c9e=()=>" و ",u9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?l9e():t==="fa"?c9e():o9e()}),d9e=()=>"Compatible with",f9e=()=>"兼容",h9e=()=>"سازگار با",_9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?f9e():t==="fa"?h9e():d9e()}),p9e=()=>"Use your own local models",m9e=()=>"使用你自己的本地模型",g9e=()=>"از مدل‌های محلی خود استفاده کنید",v9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?m9e():t==="fa"?g9e():p9e()}),b9e=()=>"Not detected",y9e=()=>"未检测到",x9e=()=>"شناسایی نشد",dN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?y9e():t==="fa"?x9e():b9e()}),w9e=()=>"Not found",S9e=()=>"未找到",k9e=()=>"پیدا نشد",qD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?S9e():t==="fa"?k9e():w9e()}),C9e=()=>"Not signed in",E9e=()=>"未登录",N9e=()=>"وارد نشده",z9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?E9e():t==="fa"?N9e():C9e()}),j9e=()=>"OpenResearch uses a coding agent already installed on this machine.",T9e=()=>"OpenResearch 使用这台计算机上已安装的编程智能体。",A9e=()=>"OpenResearch از عامل کدنویسی نصب‌شده روی این دستگاه استفاده می‌کند.",R9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?T9e():t==="fa"?A9e():j9e()}),M9e=()=>"Other research area",D9e=()=>"其他研究领域",L9e=()=>"حوزهٔ پژوهشی دیگر",O9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?D9e():t==="fa"?L9e():M9e()}),I9e=()=>"Re-check",B9e=()=>"重新检查",$9e=()=>"بررسی دوباره",UD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?B9e():t==="fa"?$9e():I9e()}),P9e=()=>"Ready",F9e=()=>"已就绪",H9e=()=>"آماده",s6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?F9e():t==="fa"?H9e():P9e()}),q9e=()=>"Re-check Git before continuing",U9e=()=>"请重新检查 Git 后再继续",G9e=()=>"پیش از ادامه Git را دوباره بررسی کنید",W9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?U9e():t==="fa"?G9e():q9e()}),V9e=()=>"Representative papers",K9e=()=>"代表性论文",Q9e=()=>"مقاله‌های شاخص",Y9e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?K9e():t==="fa"?Q9e():V9e()}),X9e=()=>"Research background",Z9e=()=>"研究背景",J9e=()=>"پیشینهٔ پژوهشی",eEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Z9e():t==="fa"?J9e():X9e()}),tEe=()=>"Couldn’t reach orx. Check that it’s still running, then re-check.",nEe=()=>"无法连接到 orx。请确认它仍在运行,然后重新检查。",rEe=()=>"ارتباط با orx برقرار نشد. مطمئن شوید هنوز در حال اجراست و دوباره بررسی کنید.",fN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nEe():t==="fa"?rEe():tEe()}),sEe=()=>"Search alphaXiv by title to link a paper…",iEe=()=>"按标题搜索 alphaXiv 以关联论文…",aEe=()=>"برای پیوند مقاله، عنوان را در alphaXiv جست‌وجو کنید…",oEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iEe():t==="fa"?aEe():sEe()}),lEe=()=>"Searching alphaXiv…",cEe=()=>"正在搜索 alphaXiv…",uEe=()=>"در حال جست‌وجوی alphaXiv…",dEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cEe():t==="fa"?uEe():lEe()}),fEe=()=>"Selected",hEe=()=>"已选择",_Ee=()=>"انتخاب‌شده",pEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hEe():t==="fa"?_Ee():fEe()}),mEe=()=>"Local model unavailable",gEe=()=>"本地模型不可用",vEe=()=>"مدل محلی در دسترس نیست",GD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gEe():t==="fa"?vEe():mEe()}),bEe=()=>"Setting things up…",yEe=()=>"正在设置…",xEe=()=>"در حال راه‌اندازی…",wEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yEe():t==="fa"?xEe():bEe()}),SEe=()=>"Connect a local model or sign in to a coding agent to continue",kEe=()=>"连接本地模型或登录编码智能体以继续",CEe=()=>"برای ادامه، یک مدل محلی متصل کنید یا به یک عامل کدنویسی وارد شوید",EEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kEe():t==="fa"?CEe():SEe()}),NEe=()=>"Connect a local model or sign in to an agent to continue.",zEe=()=>"连接本地模型或登录一个智能体以继续。",jEe=()=>"برای ادامه، یک مدل محلی متصل کنید یا به یک عامل وارد شوید.",TEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zEe():t==="fa"?jEe():NEe()}),AEe=()=>"Signed in",REe=()=>"已登录",MEe=()=>"وارد شده",DEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?REe():t==="fa"?MEe():AEe()}),LEe=()=>"Connected to alphaXiv, bioRxiv, and OpenAlex to ground your agents in the latest research.",OEe=()=>"已连接 alphaXiv、bioRxiv 和 OpenAlex,让智能体以最新研究为依据。",IEe=()=>"به alphaXiv، bioRxiv و OpenAlex متصل است تا عامل‌هایتان بر تازه‌ترین پژوهش‌ها تکیه کنند.",BEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?OEe():t==="fa"?IEe():LEe()}),$Ee=()=>"· Step 1 of 2",PEe=()=>"· 第 1 步,共 2 步",FEe=()=>"· مرحلهٔ ۱ از ۲",HEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?PEe():t==="fa"?FEe():$Ee()}),qEe=()=>"· Step 2 of 2",UEe=()=>"· 第 2 步,共 2 步",GEe=()=>"· مرحلهٔ ۲ از ۲",WEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?UEe():t==="fa"?GEe():qEe()}),VEe=()=>"Tell us about your research",KEe=()=>"介绍一下你的研究",QEe=()=>"از پژوهش خود بگویید",YEe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KEe():t==="fa"?QEe():VEe()}),XEe=()=>"Tell us your other research area",ZEe=()=>"告诉我们你的其他研究领域",JEe=()=>"حوزهٔ پژوهشی دیگر خود را بنویسید",eNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ZEe():t==="fa"?JEe():XEe()}),tNe=()=>"Track experiments, artifacts, compute, skills, and code all in one place.",nNe=()=>"在一处跟踪实验、产物、算力、技能和代码。",rNe=()=>"آزمایش‌ها، خروجی‌ها، رایانش، مهارت‌ها و کد را یک‌جا دنبال کنید.",sNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nNe():t==="fa"?rNe():tNe()}),iNe=()=>"Unable to verify",aNe=()=>"无法验证",oNe=()=>"تأیید ممکن نیست",lNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aNe():t==="fa"?oNe():iNe()}),cNe=()=>"Update required",uNe=()=>"需要更新",dNe=()=>"نیازمند به‌روزرسانی",fNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uNe():t==="fa"?dNe():cNe()}),hNe=()=>"Waiting for the Git check",_Ne=()=>"正在等待 Git 检查",pNe=()=>"در انتظار بررسی Git",mNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_Ne():t==="fa"?pNe():hNe()}),gNe=()=>"Waiting for the local tool checks",vNe=()=>"正在等待本地工具检查",bNe=()=>"در انتظار بررسی ابزارهای محلی",yNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vNe():t==="fa"?bNe():gNe()}),xNe=()=>"What areas are you interested in?",wNe=()=>"你对哪些领域感兴趣?",SNe=()=>"به چه حوزه‌هایی علاقه دارید؟",kNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wNe():t==="fa"?SNe():xNe()}),CNe=()=>"Your code, data, and experiment history stay on your machine.",ENe=()=>"你的代码、数据和实验历史都保留在自己的计算机上。",NNe=()=>"کد، داده‌ها و تاریخچهٔ آزمایش شما روی رایانهٔ خودتان می‌ماند.",zNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ENe():t==="fa"?NNe():CNe()}),jNe=()=>"Your selected agent is no longer ready. Go back to Step 1 and choose another.",TNe=()=>"所选智能体已无法使用。请返回第 1 步并选择其他智能体。",ANe=()=>"عامل انتخاب‌شده دیگر آماده نیست. به مرحلهٔ ۱ برگردید و عامل دیگری را انتخاب کنید.",RNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?TNe():t==="fa"?ANe():jNe()}),MNe=()=>"Add cookie",DNe=()=>"添加 cookie",LNe=()=>"افزودن کوکی",ONe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?DNe():t==="fa"?LNe():MNe()}),INe=()=>"Changed here and on Overleaf — choose which copy to keep",BNe=()=>"此处和 Overleaf 都有更改 — 请选择要保留的版本",$Ne=()=>"هم اینجا و هم در Overleaf تغییر کرده است — نسخه‌ای را که می‌خواهید نگه دارید انتخاب کنید",PNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BNe():t==="fa"?$Ne():INe()}),FNe=()=>"Create a token ↗",HNe=()=>"创建令牌 ↗",qNe=()=>"ساخت توکن ↗",UNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HNe():t==="fa"?qNe():FNe()}),GNe=()=>"Overleaf Git token",WNe=()=>"Overleaf Git 令牌",VNe=()=>"توکن Git در Overleaf",hN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WNe():t==="fa"?VNe():GNe()}),KNe=()=>"Follow Overleaf as people type by adding your Overleaf session cookie.",QNe=()=>"添加 Overleaf 会话 cookie,即可在他人输入时实时跟随 Overleaf。",YNe=()=>"با افزودن کوکی نشست Overleaf، هنگام تایپ دیگران Overleaf را زنده دنبال کنید.",XNe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?QNe():t==="fa"?YNe():KNe()}),ZNe=()=>"Import from browser",JNe=()=>"从浏览器导入",eze=()=>"وارد کردن از مرورگر",tze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JNe():t==="fa"?eze():ZNe()}),nze=()=>"In step with Overleaf",rze=()=>"已与 Overleaf 同步",sze=()=>"با Overleaf همگام است",WD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rze():t==="fa"?sze():nze()}),ize=()=>"The last sync did not finish.",aze=()=>"上次同步未完成。",oze=()=>"آخرین همگام‌سازی کامل نشد.",lze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aze():t==="fa"?oze():ize()}),cze=()=>"Link and sync",uze=()=>"关联并同步",dze=()=>"پیوند و همگام‌سازی",fze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uze():t==="fa"?dze():cze()}),hze=()=>"Connecting to Overleaf…",_ze=()=>"正在连接 Overleaf…",pze=()=>"در حال اتصال به Overleaf…",mze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_ze():t==="fa"?pze():hze()}),gze=()=>"Edits are live on Overleaf",vze=()=>"编辑已在 Overleaf 实时同步",bze=()=>"ویرایش‌ها روی Overleaf زنده‌اند",yze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vze():t==="fa"?bze():gze()}),xze=()=>"Retry",wze=()=>"重试",Sze=()=>"تلاش دوباره",kze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wze():t==="fa"?Sze():xze()}),Cze=()=>"Live sync stopped.",Eze=()=>"实时同步已停止。",Nze=()=>"همگام‌سازی زنده متوقف شد.",zze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Eze():t==="fa"?Nze():Cze()}),jze=()=>"Live sync starts once the paper is in step with Overleaf.",Tze=()=>"论文与 Overleaf 同步后,实时同步即会开始。",Aze=()=>"همگام‌سازی زنده پس از هم‌گام شدن مقاله با Overleaf آغاز می‌شود.",Rze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tze():t==="fa"?Aze():jze()}),Mze=()=>"My projects ↗",Dze=()=>"我的项目 ↗",Lze=()=>"پروژه‌های من ↗",_N=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Dze():t==="fa"?Lze():Mze()}),Oze=()=>"Nothing could be synced.",Ize=()=>"没有内容可以同步。",Bze=()=>"هیچ موردی قابل همگام‌سازی نبود.",$ze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ize():t==="fa"?Bze():Oze()}),Pze=()=>"Open Overleaf ↗",Fze=()=>"打开 Overleaf ↗",Hze=()=>"باز کردن Overleaf ↗",qze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Fze():t==="fa"?Hze():Pze()}),Uze=()=>"Cancel",Gze=()=>"取消",Wze=()=>"لغو",VD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Gze():t==="fa"?Wze():Uze()}),Vze=()=>"changed here and on Overleaf. Both copies are untouched — choose which one to keep.",Kze=()=>"在此处和 Overleaf 上均有更改。两个副本均未被修改——请选择要保留的版本。",Qze=()=>"هم اینجا و هم در Overleaf تغییر کرده است. هر دو نسخه دست‌نخورده‌اند — انتخاب کنید کدام نگه داشته شود.",Yze=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kze():t==="fa"?Qze():Vze()}),Xze=()=>"Keep this copy",Zze=()=>"保留此副本",Jze=()=>"نگه داشتن این نسخه",eje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zze():t==="fa"?Jze():Xze()}),tje=()=>"Open in Overleaf",nje=()=>"在 Overleaf 中打开",rje=()=>"باز کردن در Overleaf",sje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nje():t==="fa"?rje():tje()}),ije=()=>"Replace the Overleaf token",aje=()=>"替换 Overleaf 令牌",oje=()=>"جایگزینی توکن Overleaf",pN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aje():t==="fa"?oje():ije()}),lje=()=>"Sync files",cje=()=>"同步文件",uje=()=>"همگام‌سازی فایل‌ها",dje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cje():t==="fa"?uje():lje()}),fje=()=>"Unlink",hje=()=>"取消关联",_je=()=>"قطع پیوند",pje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hje():t==="fa"?_je():fje()}),mje=()=>"Upload a copy as a new project ↗",gje=()=>"上传副本作为新项目 ↗",vje=()=>"بارگذاری یک کپی به‌عنوان پروژهٔ جدید ↗",KD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gje():t==="fa"?vje():mje()}),bje=()=>"Use Overleaf's",yje=()=>"使用 Overleaf 的副本",xje=()=>"استفاده از نسخهٔ Overleaf",wje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yje():t==="fa"?xje():bje()}),Sje=()=>"This paper stays in step with Overleaf.",kje=()=>"此论文将与 Overleaf 保持同步。",Cje=()=>"این مقاله با Overleaf همگام می‌ماند.",Eje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kje():t==="fa"?Cje():Sje()}),Nje=()=>"Paste it instead",zje=()=>"改为粘贴",jje=()=>"به‌جایش بچسبانید",Tje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zje():t==="fa"?jje():Nje()}),Aje=e=>`Pulled ${e==null?void 0:e.paths}.`,Rje=e=>`已拉取 ${e==null?void 0:e.paths}。`,Mje=e=>`${e==null?void 0:e.paths} دریافت شد.`,Dje=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Rje(e):t==="fa"?Mje(e):Aje(e)}),Lje=e=>`Pulled ${e==null?void 0:e.pulled}; pushed ${e==null?void 0:e.pushed}.`,Oje=e=>`已拉取 ${e==null?void 0:e.pulled};已推送 ${e==null?void 0:e.pushed}。`,Ije=e=>`${e==null?void 0:e.pulled} دریافت و ${e==null?void 0:e.pushed} ارسال شد.`,Bje=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Oje(e):t==="fa"?Ije(e):Lje(e)}),$je=e=>`Pushed ${e==null?void 0:e.paths}.`,Pje=e=>`已推送 ${e==null?void 0:e.paths}。`,Fje=e=>`${e==null?void 0:e.paths} ارسال شد.`,Hje=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Pje(e):t==="fa"?Fje(e):$je(e)}),qje=()=>"Add a fresh Overleaf session cookie to start following again.",Uje=()=>"添加新的 Overleaf 会话 cookie 即可继续实时跟随。",Gje=()=>"برای ادامهٔ دنبال کردن، کوکی نشست تازه‌ای از Overleaf اضافه کنید.",Wje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Uje():t==="fa"?Gje():qje()}),Vje=()=>"Save the file first",Kje=()=>"请先保存文件",Qje=()=>"ابتدا فایل را ذخیره کنید",Yje=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Kje():t==="fa"?Qje():Vje()}),Xje=()=>"Save this file to sync it with Overleaf",Zje=()=>"保存此文件以与 Overleaf 同步",Jje=()=>"برای همگام‌سازی با Overleaf این فایل را ذخیره کنید",QD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Zje():t==="fa"?Jje():Xje()}),eTe=()=>"Save token",tTe=()=>"保存令牌",nTe=()=>"ذخیرهٔ توکن",rTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tTe():t==="fa"?nTe():eTe()}),sTe=()=>"Send this paper to Overleaf",iTe=()=>"将此论文发送到 Overleaf",aTe=()=>"ارسال مقاله به Overleaf",oTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iTe():t==="fa"?aTe():sTe()}),lTe=()=>"Overleaf session cookie",cTe=()=>"Overleaf 会话 cookie",uTe=()=>"کوکی نشست Overleaf",N4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cTe():t==="fa"?uTe():lTe()}),dTe=()=>"To follow Overleaf as people type, paste your Overleaf session cookie: in a browser signed in to Overleaf, open the developer tools, find the overleaf_session2 cookie, and copy its value. It stays on this machine.",fTe=()=>"要在他人输入时实时跟随 Overleaf,请粘贴你的 Overleaf 会话 cookie:在已登录 Overleaf 的浏览器中打开开发者工具,找到 overleaf_session2 cookie 并复制其值。它只保存在这台机器上。",hTe=()=>"برای دنبال کردن Overleaf هنگام تایپ دیگران، کوکی نشست Overleaf خود را بچسبانید: در مرورگری که به Overleaf وارد شده‌اید، ابزارهای توسعه‌دهنده را باز کنید، کوکی overleaf_session2 را پیدا کنید و مقدار آن را کپی کنید. این مقدار روی همین دستگاه می‌ماند.",_Te=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fTe():t==="fa"?hTe():dTe()}),pTe=()=>"Overleaf sync failed",mTe=()=>"Overleaf 同步失败",gTe=()=>"همگام‌سازی با Overleaf ناموفق بود",z4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mTe():t==="fa"?gTe():pTe()}),vTe=()=>"Text syncs live. This moves figures and other files, and settles conflicts.",bTe=()=>"文本会实时同步。此操作用于同步图片等其他文件,并解决冲突。",yTe=()=>"متن زنده همگام می‌شود. این کار تصویرها و دیگر فایل‌ها را جابه‌جا می‌کند و تعارض‌ها را حل می‌کند.",xTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bTe():t==="fa"?yTe():vTe()}),wTe=()=>"Syncing with Overleaf…",STe=()=>"正在与 Overleaf 同步…",kTe=()=>"در حال همگام‌سازی با Overleaf…",YD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?STe():t==="fa"?kTe():wTe()}),CTe=()=>"Paste an Overleaf Git authentication token to keep this paper in step with an Overleaf project. Create one in Overleaf under Account Settings — Git integration comes with a paid Overleaf plan.",ETe=()=>"粘贴 Overleaf Git 身份验证令牌,使此论文与 Overleaf 项目保持同步。请在 Overleaf 的“账户设置”中创建令牌 — Git 集成功能需要付费 Overleaf 套餐。",NTe=()=>"برای همگام نگه داشتن این مقاله با یک پروژهٔ Overleaf، توکن احراز هویت Git در Overleaf را جای‌گذاری کنید. آن را در بخش تنظیمات حساب Overleaf بسازید — یکپارچه‌سازی Git به طرح پولی Overleaf نیاز دارد.",zTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ETe():t==="fa"?NTe():CTe()}),jTe=()=>"Paste the URL of the Overleaf project this paper belongs to. Overleaf cannot create one over Git, so open or create the project there first.",TTe=()=>"粘贴此论文所属 Overleaf 项目的 URL。Overleaf 无法通过 Git 创建项目,因此请先在 Overleaf 中打开或创建项目。",ATe=()=>"نشانی پروژهٔ Overleaf مربوط به این مقاله را جای‌گذاری کنید. Overleaf نمی‌تواند پروژه را از طریق Git بسازد؛ پس ابتدا پروژه را در آنجا باز یا ایجاد کنید.",RTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?TTe():t==="fa"?ATe():jTe()}),MTe=()=>"Toggle Plan mode for this chat",DTe=()=>"切换此聊天的计划模式",LTe=()=>"تغییر حالت طرح این گفت‌وگو",OTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?DTe():t==="fa"?LTe():MTe()}),ITe=()=>"Accept and auto mode",BTe=()=>"接受并使用自动模式",$Te=()=>"پذیرش و حالت خودکار",PTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BTe():t==="fa"?$Te():ITe()}),FTe=()=>"Accept and bypass all",HTe=()=>"接受并跳过所有审批",qTe=()=>"پذیرش و عبور از همهٔ تأییدها",UTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HTe():t==="fa"?qTe():FTe()}),GTe=()=>"Accept plan",WTe=()=>"接受计划",VTe=()=>"پذیرش طرح",KTe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WTe():t==="fa"?VTe():GTe()}),QTe=e=>`${e==null?void 0:e.agent} proposed a plan`,YTe=e=>`${e==null?void 0:e.agent} 提出了一个计划`,XTe=e=>`طرح پیشنهادیِ ${e==null?void 0:e.agent}`,ZTe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?YTe(e):t==="fa"?XTe(e):QTe(e)}),JTe=e=>`${e==null?void 0:e.agent} is ready to proceed`,eAe=e=>`${e==null?void 0:e.agent} 已准备好继续`,tAe=e=>`طرحِ ${e==null?void 0:e.agent} آمادهٔ ادامه است`,nAe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?eAe(e):t==="fa"?tAe(e):JTe(e)}),rAe=()=>"Back",sAe=()=>"返回",iAe=()=>"بازگشت",aAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sAe():t==="fa"?iAe():rAe()}),oAe=()=>"More approval options",lAe=()=>"更多批准选项",cAe=()=>"گزینه‌های تأیید بیشتر",uAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lAe():t==="fa"?cAe():oAe()}),dAe=()=>"Open plan",fAe=()=>"打开计划",hAe=()=>"باز کردن طرح",_Ae=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fAe():t==="fa"?hAe():dAe()}),pAe=()=>"Reject",mAe=()=>"拒绝",gAe=()=>"رد کردن",vAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mAe():t==="fa"?gAe():pAe()}),bAe=()=>"Revise",yAe=()=>"修改",xAe=()=>"بازنگری",wAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yAe():t==="fa"?xAe():bAe()}),SAe=()=>"Revise…",kAe=()=>"修改…",CAe=()=>"بازنگری…",EAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kAe():t==="fa"?CAe():SAe()}),NAe=()=>"What should change? (optional)",zAe=()=>"需要更改什么?(可选)",jAe=()=>"چه چیزی باید تغییر کند؟ (اختیاری)",TAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zAe():t==="fa"?jAe():NAe()}),AAe=e=>`${e==null?void 0:e.count} active`,RAe=e=>`${e==null?void 0:e.count} 个活跃`,MAe=e=>`${e==null?void 0:e.count} فعال`,DAe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?RAe(e):t==="fa"?MAe(e):AAe(e)}),LAe=e=>`${e==null?void 0:e.count} total agents`,OAe=e=>`共 ${e==null?void 0:e.count} 个智能体`,IAe=e=>`در مجموع ${e==null?void 0:e.count} عامل`,BAe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?OAe(e):t==="fa"?IAe(e):LAe(e)}),$Ae=e=>`Delete ${e==null?void 0:e.name} from OpenResearch? Its experiments, runs, and chats will be permanently removed.`,PAe=e=>`从 OpenResearch 中删除 ${e==null?void 0:e.name}?其实验、运行和聊天将被永久移除。`,FAe=e=>`${e==null?void 0:e.name} از OpenResearch حذف شود؟ آزمایش‌ها، اجراها و گفتگوهای آن برای همیشه حذف می‌شوند.`,HAe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?PAe(e):t==="fa"?FAe(e):$Ae(e)}),qAe=()=>"Agents",UAe=()=>"智能体",GAe=()=>"عامل‌ها",mN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?UAe():t==="fa"?GAe():qAe()}),WAe=()=>"arXiv paper ID:",VAe=()=>"arXiv 论文 ID:",KAe=()=>"شناسهٔ مقالهٔ arXiv:",QAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VAe():t==="fa"?KAe():WAe()}),YAe=()=>"Cancel",XAe=()=>"取消",ZAe=()=>"لغو",JAe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?XAe():t==="fa"?ZAe():YAe()}),eRe=()=>"Created",tRe=()=>"创建时间",nRe=()=>"ایجادشده",rRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tRe():t==="fa"?nRe():eRe()}),sRe=()=>"Delete project?",iRe=()=>"删除项目?",aRe=()=>"پروژه حذف شود؟",oRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iRe():t==="fa"?aRe():sRe()}),lRe=()=>"Delete project",cRe=()=>"删除项目",uRe=()=>"حذف پروژه",dRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cRe():t==="fa"?uRe():lRe()}),fRe=()=>"Deleting…",hRe=()=>"正在删除…",_Re=()=>"در حال حذف…",pRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hRe():t==="fa"?_Re():fRe()}),mRe=()=>"Experiments",gRe=()=>"实验",vRe=()=>"آزمایش‌ها",gN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gRe():t==="fa"?vRe():mRe()}),bRe=()=>"The local folder and linked GitHub repository are kept.",yRe=()=>"本地文件夹和已关联的 GitHub 仓库都会保留。",xRe=()=>"پوشهٔ محلی و مخزن پیوندشدهٔ GitHub نگه داشته می‌شوند.",wRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yRe():t==="fa"?xRe():bRe()}),SRe=()=>"The local folder is kept.",kRe=()=>"本地文件夹会保留。",CRe=()=>"پوشهٔ محلی نگه داشته می‌شود.",ERe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kRe():t==="fa"?CRe():SRe()}),NRe=()=>"New project",zRe=()=>"新建项目",jRe=()=>"پروژهٔ جدید",XD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zRe():t==="fa"?jRe():NRe()}),TRe=()=>"No projects yet — create one to get started.",ARe=()=>"尚无项目——新建一个即可开始。",RRe=()=>"هنوز پروژه‌ای نیست — برای شروع یکی بسازید.",MRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ARe():t==="fa"?RRe():TRe()}),DRe=()=>"Project",LRe=()=>"项目",ORe=()=>"پروژه",IRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LRe():t==="fa"?ORe():DRe()}),BRe=()=>"Projects",$Re=()=>"项目",PRe=()=>"پروژه‌ها",FRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$Re():t==="fa"?PRe():BRe()}),HRe=()=>"Repository",qRe=()=>"仓库",URe=()=>"مخزن",vN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qRe():t==="fa"?URe():HRe()}),GRe=()=>"Idle",WRe=()=>"空闲",VRe=()=>"بیکار",KRe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WRe():t==="fa"?VRe():GRe()}),QRe=()=>"Local",YRe=()=>"本地",XRe=()=>"محلی",i6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YRe():t==="fa"?XRe():QRe()}),ZRe=()=>"1 total agent",JRe=()=>"共 1 个智能体",eMe=()=>"در مجموع ۱ عامل",tMe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JRe():t==="fa"?eMe():ZRe()}),nMe=e=>`${e==null?void 0:e.count} running`,rMe=e=>`${e==null?void 0:e.count} 个运行中`,sMe=e=>`${e==null?void 0:e.count} در حال اجرا`,iMe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?rMe(e):t==="fa"?sMe(e):nMe(e)}),aMe=e=>`${e==null?void 0:e.count} total`,oMe=e=>`共 ${e==null?void 0:e.count} 个`,lMe=e=>`در مجموع ${e==null?void 0:e.count}`,bN=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?oMe(e):t==="fa"?lMe(e):aMe(e)}),cMe=()=>"Installing the compatible binary. This may take a few minutes.",uMe=()=>"正在安装兼容的二进制文件。这可能需要几分钟。",dMe=()=>"در حال نصب فایل اجرایی سازگار. این کار ممکن است چند دقیقه طول بکشد.",fMe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uMe():t==="fa"?dMe():cMe()}),hMe=e=>`Setting up OpenResearch on ${e==null?void 0:e.host}`,_Me=e=>`正在设置 ${e==null?void 0:e.host} 上的 OpenResearch`,pMe=e=>`در حال راه‌اندازی OpenResearch روی ${e==null?void 0:e.host}`,mMe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?_Me(e):t==="fa"?pMe(e):hMe(e)}),gMe=()=>"Check again",vMe=()=>"再次检查",bMe=()=>"بررسی دوباره",yN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vMe():t==="fa"?bMe():gMe()}),yMe=()=>"Closing…",xMe=()=>"正在关闭…",wMe=()=>"در حال بستن…",SMe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xMe():t==="fa"?wMe():yMe()}),kMe=e=>`Connected to ${e==null?void 0:e.host} as ${e==null?void 0:e.user}`,CMe=e=>`已以 ${e==null?void 0:e.user} 身份连接到 ${e==null?void 0:e.host}`,EMe=e=>`اتصال به ${e==null?void 0:e.host} با کاربر ${e==null?void 0:e.user}`,NMe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?CMe(e):t==="fa"?EMe(e):kMe(e)}),zMe=()=>"Preparing your remote workspace…",jMe=()=>"正在准备远程工作区…",TMe=()=>"در حال آماده‌سازی فضای کاری راه‌دور…",AMe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jMe():t==="fa"?TMe():zMe()}),RMe=e=>`Connecting to ${e==null?void 0:e.host}`,MMe=e=>`正在连接到 ${e==null?void 0:e.host}`,DMe=e=>`در حال اتصال به ${e==null?void 0:e.host}`,LMe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?MMe(e):t==="fa"?DMe(e):RMe(e)}),OMe=()=>"Close remote host picker",IMe=()=>"关闭远程主机选择器",BMe=()=>"بستن انتخاب‌گر میزبان راه‌دور",$Me=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?IMe():t==="fa"?BMe():OMe()}),PMe=()=>"Choose a configured SSH host.",FMe=()=>"选择已配置的 SSH 主机。",HMe=()=>"یک میزبان SSH پیکربندی‌شده انتخاب کنید.",qMe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?FMe():t==="fa"?HMe():PMe()}),UMe=()=>"Connect to remote",GMe=()=>"连接到远程主机",WMe=()=>"اتصال به میزبان راه‌دور",ZD=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?GMe():t==="fa"?WMe():UMe()}),VMe=()=>"Disconnect",KMe=()=>"断开连接",QMe=()=>"قطع اتصال",j4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KMe():t==="fa"?QMe():VMe()}),YMe=()=>"Your remote work is still running. Reconnect when you’re ready.",XMe=()=>"你的远程工作仍在运行。准备好后可以重新连接。",ZMe=()=>"کار راه‌دور شما همچنان در حال اجرا است. هر زمان آماده بودید دوباره متصل شوید.",JMe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?XMe():t==="fa"?ZMe():YMe()}),eDe=e=>`Disconnected from ${e==null?void 0:e.host}`,tDe=e=>`已断开与 ${e==null?void 0:e.host} 的连接`,nDe=e=>`اتصال به ${e==null?void 0:e.host} قطع شد`,JD=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?tDe(e):t==="fa"?nDe(e):eDe(e)}),rDe=e=>`Could not connect to ${e==null?void 0:e.host}`,sDe=e=>`无法连接到 ${e==null?void 0:e.host}`,iDe=e=>`اتصال به ${e==null?void 0:e.host} ممکن نشد`,aDe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?sDe(e):t==="fa"?iDe(e):rDe(e)}),oDe=()=>"Restart local OpenResearch and select this SSH host again. Work on the remote host continues.",lDe=()=>"请重新启动本地 OpenResearch 并再次选择此 SSH 主机。远程主机上的工作仍在继续。",cDe=()=>"OpenResearch محلی را دوباره راه‌اندازی کنید و این میزبان SSH را دوباره انتخاب کنید. کار روی میزبان راه‌دور ادامه دارد.",uDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lDe():t==="fa"?cDe():oDe()}),dDe=()=>"OpenResearch agents have stopped. Submitted experiments may still be running.",fDe=()=>"OpenResearch 智能体已停止。已提交的实验可能仍在运行。",hDe=()=>"عامل‌های OpenResearch متوقف شده‌اند. آزمایش‌های ارسال‌شده ممکن است همچنان در حال اجرا باشند.",_De=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fDe():t==="fa"?hDe():dDe()}),pDe=e=>`OpenResearch is not running on ${e==null?void 0:e.host}`,mDe=e=>`OpenResearch 未在 ${e==null?void 0:e.host} 上运行`,gDe=e=>`OpenResearch روی ${e==null?void 0:e.host} در حال اجرا نیست`,vDe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?mDe(e):t==="fa"?gDe(e):pDe(e)}),bDe=()=>"OpenResearch binary",yDe=()=>"OpenResearch 二进制文件",xDe=()=>"فایل اجرایی OpenResearch",wDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yDe():t==="fa"?xDe():bDe()}),SDe=()=>"OpenResearch Database",kDe=()=>"OpenResearch 数据库",CDe=()=>"پایگاه دادهٔ OpenResearch",EDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kDe():t==="fa"?CDe():SDe()}),NDe=()=>"OpenResearch will use these locations for your remote SSH user and does not require sudo.",zDe=()=>"OpenResearch 将为你的远程 SSH 用户使用以下位置,无需 sudo。",jDe=()=>"OpenResearch از این مسیرها برای کاربر SSH راه‌دور شما استفاده می‌کند و به sudo نیاز ندارد.",TDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zDe():t==="fa"?jDe():NDe()}),ADe=()=>"Install OpenResearch?",RDe=()=>"安装 OpenResearch?",MDe=()=>"OpenResearch نصب شود؟",DDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?RDe():t==="fa"?MDe():ADe()}),LDe=()=>"Installing…",ODe=()=>"正在安装…",IDe=()=>"در حال نصب…",BDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ODe():t==="fa"?IDe():LDe()}),$De=()=>"No matching SSH hosts",PDe=()=>"没有匹配的 SSH 主机",FDe=()=>"میزبان SSH منطبقی پیدا نشد",HDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?PDe():t==="fa"?FDe():$De()}),qDe=e=>`OpenResearch is not installed for ${e==null?void 0:e.user} on ${e==null?void 0:e.host}. Install it now?`,UDe=e=>`${e==null?void 0:e.user} 尚未在 ${e==null?void 0:e.host} 上安装 OpenResearch。现在安装吗?`,GDe=e=>`OpenResearch برای ${e==null?void 0:e.user} روی ${e==null?void 0:e.host} نصب نیست. اکنون نصب شود؟`,WDe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?UDe(e):t==="fa"?GDe(e):qDe(e)}),VDe=()=>"Open remote",KDe=()=>"打开远程工作区",QDe=()=>"باز کردن راه‌دور",YDe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KDe():t==="fa"?QDe():VDe()}),XDe=()=>"Closing this tab or disconnecting leaves agents and experiments running. Approval requests remain pending for up to 55 minutes. A host restart or administrator policy may stop OpenResearch.",ZDe=()=>"关闭此标签页或断开连接后,代理和实验仍会继续运行。审批请求最多保持待处理 55 分钟。主机重启或管理员策略可能会停止 OpenResearch。",JDe=()=>"بستن این زبانه یا قطع اتصال، عامل‌ها و آزمایش‌ها را در حال اجرا نگه می‌دارد. درخواست‌های تأیید تا ۵۵ دقیقه در انتظار می‌مانند. راه‌اندازی مجدد میزبان یا سیاست مدیر ممکن است OpenResearch را متوقف کند.",eLe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ZDe():t==="fa"?JDe():XDe()}),tLe=()=>"Your browser blocked the remote workspace tab. Allow pop-ups and try again.",nLe=()=>"浏览器阻止了远程工作区标签页。请允许弹出窗口后重试。",rLe=()=>"مرورگر زبانهٔ فضای کاری راه‌دور را مسدود کرد. پنجره‌های بازشو را مجاز کنید و دوباره تلاش کنید.",sLe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nLe():t==="fa"?rLe():tLe()}),iLe=()=>"Preparing remote workspace…",aLe=()=>"正在准备远程工作区…",oLe=()=>"در حال آماده‌سازی فضای کاری راه‌دور…",lLe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aLe():t==="fa"?oLe():iLe()}),cLe=()=>"Reconnect",uLe=()=>"重新连接",dLe=()=>"اتصال دوباره",xN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uLe():t==="fa"?dLe():cLe()}),fLe=()=>"The connection dropped. Your remote work remains running while OpenResearch reconnects.",hLe=()=>"连接已中断。OpenResearch 重新连接期间,你的远程工作仍会继续运行。",_Le=()=>"اتصال قطع شد. هنگام اتصال دوبارهٔ OpenResearch، کار راه‌دور شما همچنان اجرا می‌شود.",pLe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hLe():t==="fa"?_Le():fLe()}),mLe=e=>`Reconnecting to ${e==null?void 0:e.host}`,gLe=e=>`正在重新连接到 ${e==null?void 0:e.host}`,vLe=e=>`در حال اتصال دوباره به ${e==null?void 0:e.host}`,bLe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?gLe(e):t==="fa"?vLe(e):mLe(e)}),yLe=()=>"Search SSH hosts",xLe=()=>"搜索 SSH 主机",wLe=()=>"جستجوی میزبان‌های SSH",wN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xLe():t==="fa"?wLe():yLe()}),SLe=e=>`SSH: ${e==null?void 0:e.host}`,kLe=e=>`SSH:${e==null?void 0:e.host}`,CLe=e=>`SSH: ${e==null?void 0:e.host}`,kx=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?kLe(e):t==="fa"?CLe(e):SLe(e)}),ELe=()=>"Start a new OpenResearch host",NLe=()=>"启动新的 OpenResearch 主机",zLe=()=>"راه‌اندازی میزبان جدید OpenResearch",jLe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?NLe():t==="fa"?zLe():ELe()}),TLe=e=>`End ${e==null?void 0:e.count} pending approvals.`,ALe=e=>`结束 ${e==null?void 0:e.count} 个待审批请求。`,RLe=e=>`${e==null?void 0:e.count} تأیید در انتظار را پایان می‌دهد.`,MLe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ALe(e):t==="fa"?RLe(e):TLe(e)}),DLe=()=>"Stop OpenResearch",LLe=()=>"停止 OpenResearch",OLe=()=>"توقف OpenResearch",ILe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LLe():t==="fa"?OLe():DLe()}),BLe=e=>`Stop OpenResearch on ${e==null?void 0:e.host}?`,$Le=e=>`停止 ${e==null?void 0:e.host} 上的 OpenResearch?`,PLe=e=>`OpenResearch روی ${e==null?void 0:e.host} متوقف شود؟`,FLe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?$Le(e):t==="fa"?PLe(e):BLe(e)}),HLe=e=>`Leave ${e==null?void 0:e.count} submitted experiments running.`,qLe=e=>`让 ${e==null?void 0:e.count} 个已提交实验继续运行。`,ULe=e=>`${e==null?void 0:e.count} آزمایش ارسال‌شده را در حال اجرا نگه می‌دارد.`,GLe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?qLe(e):t==="fa"?ULe(e):HLe(e)}),WLe=()=>"Stop OpenResearch on host",VLe=()=>"停止主机上的 OpenResearch",KLe=()=>"توقف OpenResearch روی میزبان",eL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VLe():t==="fa"?KLe():WLe()}),QLe=()=>"This will also:",YLe=()=>"这还将:",XLe=()=>"این کار همچنین:",ZLe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YLe():t==="fa"?XLe():QLe()}),JLe=()=>"End 1 pending approval.",eOe=()=>"结束 1 个待审批请求。",tOe=()=>"۱ تأیید در انتظار را پایان می‌دهد.",nOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eOe():t==="fa"?tOe():JLe()}),rOe=()=>"Leave 1 submitted experiment running.",sOe=()=>"让 1 个已提交实验继续运行。",iOe=()=>"۱ آزمایش ارسال‌شده را در حال اجرا نگه می‌دارد.",aOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sOe():t==="fa"?iOe():rOe()}),oOe=()=>"Disconnect 1 other client.",lOe=()=>"断开 1 个其他客户端。",cOe=()=>"اتصال ۱ کارخواه دیگر را قطع می‌کند.",uOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lOe():t==="fa"?cOe():oOe()}),dOe=()=>"Keep 1 queued message saved.",fOe=()=>"保留 1 条排队消息。",hOe=()=>"۱ پیام در صف را ذخیره نگه می‌دارد.",_Oe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fOe():t==="fa"?hOe():dOe()}),pOe=()=>"Interrupt 1 active agent turn.",mOe=()=>"中断 1 个活动代理任务。",gOe=()=>"۱ نوبت فعال عامل را قطع می‌کند.",vOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mOe():t==="fa"?gOe():pOe()}),bOe=e=>`Disconnect ${e==null?void 0:e.count} other clients.`,yOe=e=>`断开 ${e==null?void 0:e.count} 个其他客户端。`,xOe=e=>`اتصال ${e==null?void 0:e.count} کارخواه دیگر را قطع می‌کند.`,wOe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?yOe(e):t==="fa"?xOe(e):bOe(e)}),SOe=e=>`Keep ${e==null?void 0:e.count} queued messages saved.`,kOe=e=>`保留 ${e==null?void 0:e.count} 条排队消息。`,COe=e=>`${e==null?void 0:e.count} پیام در صف را ذخیره نگه می‌دارد.`,EOe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?kOe(e):t==="fa"?COe(e):SOe(e)}),NOe=e=>`Interrupt ${e==null?void 0:e.count} active agent turns.`,zOe=e=>`中断 ${e==null?void 0:e.count} 个活动代理任务。`,jOe=e=>`${e==null?void 0:e.count} نوبت فعال عامل را قطع می‌کند.`,TOe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?zOe(e):t==="fa"?jOe(e):NOe(e)}),AOe=()=>"Stopping host…",ROe=()=>"正在停止主机…",MOe=()=>"در حال توقف میزبان…",DOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ROe():t==="fa"?MOe():AOe()}),LOe=()=>"Update",OOe=()=>"更新",IOe=()=>"به‌روزرسانی",SN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?OOe():t==="fa"?IOe():LOe()}),BOe=e=>`The OpenResearch installation on ${e==null?void 0:e.host} is not compatible with this dashboard. Update it now?`,$Oe=e=>`${e==null?void 0:e.host} 上的 OpenResearch 与此仪表板不兼容。现在更新吗?`,POe=e=>`نسخهٔ OpenResearch روی ${e==null?void 0:e.host} با این داشبورد سازگار نیست. اکنون به‌روزرسانی شود؟`,FOe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?$Oe(e):t==="fa"?POe(e):BOe(e)}),HOe=()=>"Update OpenResearch?",qOe=()=>"更新 OpenResearch?",UOe=()=>"OpenResearch به‌روزرسانی شود؟",GOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qOe():t==="fa"?UOe():HOe()}),WOe=()=>"Updating…",VOe=()=>"正在更新…",KOe=()=>"در حال به‌روزرسانی…",QOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VOe():t==="fa"?KOe():WOe()}),YOe=()=>"Disable syncing",XOe=()=>"关闭同步",ZOe=()=>"غیرفعال کردن همگام‌سازی",JOe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?XOe():t==="fa"?ZOe():YOe()}),eIe=()=>"Enable GitHub syncing",tIe=()=>"启用 GitHub 同步",nIe=()=>"فعال‌سازی همگام‌سازی GitHub",rIe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tIe():t==="fa"?nIe():eIe()}),sIe=()=>"Enabling…",iIe=()=>"正在启用…",aIe=()=>"در حال فعال‌سازی…",oIe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iIe():t==="fa"?aIe():sIe()}),lIe=()=>"Updating…",cIe=()=>"正在更新…",uIe=()=>"در حال به‌روزرسانی…",dIe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cIe():t==="fa"?uIe():lIe()}),fIe=e=>`Retrying · attempt ${e==null?void 0:e.attempt}`,hIe=e=>`正在重试 · 第 ${e==null?void 0:e.attempt} 次`,_Ie=e=>`در حال تلاش دوباره · تلاش ${e==null?void 0:e.attempt}`,pIe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?hIe(e):t==="fa"?_Ie(e):fIe(e)}),mIe=e=>`Retrying · attempt ${e==null?void 0:e.attempt}/${e==null?void 0:e.maximum}`,gIe=e=>`正在重试 · 第 ${e==null?void 0:e.attempt}/${e==null?void 0:e.maximum} 次`,vIe=e=>`در حال تلاش دوباره · تلاش ${e==null?void 0:e.attempt} از ${e==null?void 0:e.maximum}`,bIe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?gIe(e):t==="fa"?vIe(e):mIe(e)}),yIe=e=>`Retrying · attempt ${e==null?void 0:e.attempt}/${e==null?void 0:e.maximum} · next attempt in ${e==null?void 0:e.seconds}s`,xIe=e=>`正在重试 · 第 ${e==null?void 0:e.attempt}/${e==null?void 0:e.maximum} 次 · ${e==null?void 0:e.seconds} 秒后再次尝试`,wIe=e=>`در حال تلاش دوباره · تلاش ${e==null?void 0:e.attempt} از ${e==null?void 0:e.maximum} · تلاش بعدی تا ${e==null?void 0:e.seconds} ثانیه`,SIe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?xIe(e):t==="fa"?wIe(e):yIe(e)}),kIe=e=>`Retrying · attempt ${e==null?void 0:e.attempt} · next attempt in ${e==null?void 0:e.seconds}s`,CIe=e=>`正在重试 · 第 ${e==null?void 0:e.attempt} 次 · ${e==null?void 0:e.seconds} 秒后再次尝试`,EIe=e=>`در حال تلاش دوباره · تلاش ${e==null?void 0:e.attempt} · تلاش بعدی تا ${e==null?void 0:e.seconds} ثانیه`,NIe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?CIe(e):t==="fa"?EIe(e):kIe(e)}),zIe=()=>"CLI is retrying…",jIe=()=>"CLI 正在重试…",TIe=()=>"CLI در حال تلاش دوباره است…",AIe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jIe():t==="fa"?TIe():zIe()}),RIe=e=>`Retrying · next attempt in ${e==null?void 0:e.seconds}s`,MIe=e=>`正在重试 · ${e==null?void 0:e.seconds} 秒后再次尝试`,DIe=e=>`در حال تلاش دوباره · تلاش بعدی تا ${e==null?void 0:e.seconds} ثانیه`,LIe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?MIe(e):t==="fa"?DIe(e):RIe(e)}),OIe=()=>"Sending again…",IIe=()=>"正在重新发送…",BIe=()=>"در حال ارسال دوباره…",$Ie=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?IIe():t==="fa"?BIe():OIe()}),PIe=e=>`Sending again in ${e==null?void 0:e.seconds}s…`,FIe=e=>`将在 ${e==null?void 0:e.seconds} 秒后重新发送…`,HIe=e=>`ارسال دوباره تا ${e==null?void 0:e.seconds} ثانیه…`,qIe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?FIe(e):t==="fa"?HIe(e):PIe(e)}),UIe=()=>"Retrying…",GIe=()=>"正在重试…",WIe=()=>"در حال تلاش دوباره…",tL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?GIe():t==="fa"?WIe():UIe()}),VIe=()=>"Default speed",KIe=()=>"默认速度",QIe=()=>"سرعت پیش‌فرض",YIe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KIe():t==="fa"?QIe():VIe()}),XIe=()=>"Standard",ZIe=()=>"标准",JIe=()=>"استاندارد",eBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ZIe():t==="fa"?JIe():XIe()}),tBe=e=>` Add ${e==null?void 0:e.directory} to your PATH to use it.`,nBe=e=>` 请将 ${e==null?void 0:e.directory} 添加到 PATH 后使用。`,rBe=e=>` برای استفاده، ${e==null?void 0:e.directory} را به PATH اضافه کنید.`,sBe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?nBe(e):t==="fa"?rBe(e):tBe(e)}),iBe=()=>"Appearance",aBe=()=>"外观",oBe=()=>"ظاهر",lBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aBe():t==="fa"?oBe():iBe()}),cBe=()=>"Check",uBe=()=>"检查",dBe=()=>"بررسی",fBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uBe():t==="fa"?dBe():cBe()}),hBe=()=>"Check again",_Be=()=>"再次检查",pBe=()=>"بررسی دوباره",Kp=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_Be():t==="fa"?pBe():hBe()}),mBe=()=>"Check for updates",gBe=()=>"检查更新",vBe=()=>"بررسی به‌روزرسانی",bBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gBe():t==="fa"?vBe():mBe()}),yBe=()=>"Check now",xBe=()=>"立即检查",wBe=()=>"اکنون بررسی کن",SBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xBe():t==="fa"?wBe():yBe()}),kBe=()=>"Check setup",CBe=()=>"检查设置",EBe=()=>"بررسی راه‌اندازی",NBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?CBe():t==="fa"?EBe():kBe()}),zBe=()=>"orx checks a few times a day on its own.",jBe=()=>"orx 每天会自动检查几次。",TBe=()=>"orx روزی چند بار خودکار بررسی می‌کند.",ABe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jBe():t==="fa"?TBe():zBe()}),RBe=()=>"Choose a flavor",MBe=()=>"选择配置",DBe=()=>"انتخاب پیکربندی",LBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?MBe():t==="fa"?DBe():RBe()}),OBe=e=>`Choose a flavor to use ${e==null?void 0:e.destination} for new runs.`,IBe=e=>`请选择一个配置,以便新运行使用${e==null?void 0:e.destination}。`,BBe=e=>`برای اجرای کارهای جدید روی ${e==null?void 0:e.destination} یک پیکربندی انتخاب کنید.`,$Be=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?IBe(e):t==="fa"?BBe(e):OBe(e)}),PBe=()=>"clean",FBe=()=>"无更改",HBe=()=>"بدون تغییر",qBe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?FBe():t==="fa"?HBe():PBe()}),UBe=e=>`Already linked at ${e==null?void 0:e.link}.`,GBe=e=>`已链接到 ${e==null?void 0:e.link}。`,WBe=e=>`از قبل در ${e==null?void 0:e.link} پیوند شده است.`,VBe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?GBe(e):t==="fa"?WBe(e):UBe(e)}),KBe=e=>`Linked ${e==null?void 0:e.link}.`,QBe=e=>`已链接 ${e==null?void 0:e.link}。`,YBe=e=>`${e==null?void 0:e.link} پیوند شد.`,XBe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?QBe(e):t==="fa"?YBe(e):KBe(e)}),ZBe=()=>"Connect",JBe=()=>"连接",e$e=()=>"اتصال",a6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JBe():t==="fa"?e$e():ZBe()}),t$e=()=>"Connected via GitHub CLI",n$e=()=>"已通过 GitHub CLI 连接",r$e=()=>"از طریق GitHub CLI متصل است",nL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?n$e():t==="fa"?r$e():t$e()}),s$e=()=>"Connecting…",i$e=()=>"正在连接…",a$e=()=>"در حال اتصال…",rL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?i$e():t==="fa"?a$e():s$e()}),o$e=e=>`CPU cores: ${e==null?void 0:e.count}`,l$e=e=>`${e==null?void 0:e.count} 个 CPU 核心`,c$e=e=>`${e==null?void 0:e.count} هستهٔ CPU`,u$e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?l$e(e):t==="fa"?c$e(e):o$e(e)}),d$e=()=>"Create a private repository and automatically push experiment branches for collaborator visibility.",f$e=()=>"创建私有仓库,并自动推送实验分支以便协作者查看。",h$e=()=>"یک مخزن خصوصی بسازید و شاخه‌های آزمایش را برای مشاهدهٔ همکاران به‌طور خودکار پوش کنید.",_$e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?f$e():t==="fa"?h$e():d$e()}),p$e=()=>"the current project",m$e=()=>"当前项目",g$e=()=>"پروژهٔ فعلی",v$e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?m$e():t==="fa"?g$e():p$e()}),b$e=e=>`${e==null?void 0:e.value} (custom)`,y$e=e=>`${e==null?void 0:e.value}(自定义)`,x$e=e=>`${e==null?void 0:e.value} (سفارشی)`,w$e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?y$e(e):t==="fa"?x$e(e):b$e(e)}),S$e=()=>"detached",k$e=()=>"分离头指针",C$e=()=>"جدا از شاخه",o6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?k$e():t==="fa"?C$e():S$e()}),E$e=()=>"Disconnected",N$e=()=>"已断开连接",z$e=()=>"قطع اتصال",sL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?N$e():t==="fa"?z$e():E$e()}),j$e=()=>"Environment tab",T$e=()=>"环境标签页",A$e=()=>"زبانهٔ محیط",R$e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?T$e():t==="fa"?A$e():j$e()}),M$e=e=>`${e==null?void 0:e.branch} · ${e==null?void 0:e.state}`,D$e=e=>`${e==null?void 0:e.branch} · ${e==null?void 0:e.state}`,L$e=e=>`${e==null?void 0:e.branch} · ${e==null?void 0:e.state}`,O$e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?D$e(e):t==="fa"?L$e(e):M$e(e)}),I$e=()=>"GitHub rejected the push because this repository is archived and read-only. The local project is still available. Unarchive the repository on GitHub, then enable syncing here.",B$e=()=>"GitHub 拒绝了推送,因为此仓库已归档且为只读。你的本地项目仍然可用。请在 GitHub 上取消归档该仓库,然后在此处启用同步。",$$e=()=>"GitHub پوش را نپذیرفت، چون این مخزن بایگانی‌شده و فقط‌خواندنی است. پروژهٔ محلی همچنان در دسترس است. مخزن را در GitHub از بایگانی خارج کنید و سپس همگام‌سازی را اینجا فعال کنید.",P$e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?B$e():t==="fa"?$$e():I$e()}),F$e=()=>"GitHub contains changes that are not in this local project. Pull the latest GitHub changes and resolve any conflicts in Git, then try enabling syncing again.",H$e=()=>"GitHub 上有本地项目中不存在的更改。请拉取 GitHub 上的最新更改,在 Git 中解决冲突,然后再次尝试启用同步。",q$e=()=>"GitHub تغییراتی دارد که در پروژهٔ محلی نیست. تازه‌ترین تغییرات GitHub را دریافت و تعارض‌ها را در Git حل کنید، سپس دوباره همگام‌سازی را فعال کنید.",U$e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?H$e():t==="fa"?q$e():F$e()}),G$e=()=>"GitHub rejected the push. Make sure your connected account has write access to this repository, then try again.",W$e=()=>"GitHub 拒绝了推送。请确认已连接的账户对此仓库有写入权限,然后重试。",V$e=()=>"GitHub پوش را نپذیرفت. مطمئن شوید حساب متصل اجازهٔ نوشتن در این مخزن را دارد و دوباره تلاش کنید.",K$e=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?W$e():t==="fa"?V$e():G$e()}),Q$e=e=>`GPU × ${e==null?void 0:e.count}`,Y$e=e=>`${e==null?void 0:e.count} 个 GPU`,X$e=e=>`${e==null?void 0:e.count} پردازندهٔ گرافیکی`,Z$e=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Y$e(e):t==="fa"?X$e(e):Q$e(e)}),J$e=()=>"has changes",ePe=()=>"有更改",tPe=()=>"دارای تغییر",nPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ePe():t==="fa"?tPe():J$e()}),rPe=e=>`This token is valid but does not report whether it can launch Jobs; OAuth tokens from ${e==null?void 0:e.login} never do. Launches may still work. For a definitive check, save a write-scoped token from ${e==null?void 0:e.url}.`,sPe=e=>`此令牌有效,但不会报告能否启动 Jobs;来自 ${e==null?void 0:e.login} 的 OAuth 令牌从不提供该信息。启动仍可能成功。如需最终确认,请从 ${e==null?void 0:e.url} 保存具有写入权限的令牌。`,iPe=e=>`این توکن معتبر است، اما مشخص نمی‌کند که می‌تواند Jobs را اجرا کند؛ توکن‌های OAuth از ${e==null?void 0:e.login} هرگز چنین اطلاعاتی نمی‌دهند. اجراها ممکن است کار کنند. برای بررسی قطعی، یک توکن دارای مجوز نوشتن از ${e==null?void 0:e.url} ذخیره کنید.`,aPe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?sPe(e):t==="fa"?iPe(e):rPe(e)}),oPe=()=>"This token is valid, but cannot submit Hugging Face Jobs. Create a token with Jobs write permission in Hugging Face token settings, then replace it here.",lPe=()=>"此令牌有效,但无法提交 Hugging Face 任务。请在 Hugging Face 令牌设置中创建具有 Jobs 写入权限的令牌,然后在此处替换。",cPe=()=>"این توکن معتبر است، اما اجازهٔ ارسال کار به Hugging Face را ندارد. در تنظیمات توکن Hugging Face، توکنی با مجوز نوشتن Jobs بسازید و آن را اینجا جایگزین کنید.",uPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lPe():t==="fa"?cPe():oPe()}),dPe=()=>"Install",fPe=()=>"安装",hPe=()=>"نصب",_Pe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fPe():t==="fa"?hPe():dPe()}),pPe=e=>`Adds ${e==null?void 0:e.command} to your terminal, pointing at this app, so the CLI and app are always the same version.`,mPe=e=>`将 ${e==null?void 0:e.command} 添加到终端并指向此应用,使 CLI 和应用始终使用同一版本。`,gPe=e=>`فرمان ${e==null?void 0:e.command} را به ترمینال شما و با اشاره به این برنامه اضافه می‌کند تا CLI و برنامه همیشه یک نسخه باشند.`,vPe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?mPe(e):t==="fa"?gPe(e):pPe(e)}),bPe=e=>`Install the ${e==null?void 0:e.command} command`,yPe=e=>`安装 ${e==null?void 0:e.command} 命令`,xPe=e=>`نصب فرمان ${e==null?void 0:e.command}`,wPe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?yPe(e):t==="fa"?xPe(e):bPe(e)}),SPe=()=>"Install GitHub CLI, then run `gh auth login` in your terminal.",kPe=()=>"请安装 GitHub CLI,然后在终端中运行 `gh auth login`。",CPe=()=>"GitHub CLI را نصب کنید و سپس در پایانه `gh auth login` را اجرا کنید.",EPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kPe():t==="fa"?CPe():SPe()}),NPe=()=>"Install the new release now instead of waiting for the background update.",zPe=()=>"立即安装新版本,无需等待后台更新。",jPe=()=>"نسخهٔ جدید را اکنون نصب کنید و منتظر به‌روزرسانی پس‌زمینه نمانید.",TPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zPe():t==="fa"?jPe():NPe()}),APe=()=>"Discard your unsaved Kubernetes changes?",RPe=()=>"要放弃未保存的 Kubernetes 更改吗?",MPe=()=>"تغییرات ذخیره‌نشدهٔ Kubernetes کنار گذاشته شود؟",DPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?RPe():t==="fa"?MPe():APe()}),LPe=()=>"Key from",OPe=()=>"密钥来自",IPe=()=>"کلید از",BPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?OPe():t==="fa"?IPe():LPe()}),$Pe=()=>"Use current kubectl context",PPe=()=>"使用当前 kubectl 上下文",FPe=()=>"استفاده از کانتکست فعلی kubectl",HPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?PPe():t==="fa"?FPe():$Pe()}),qPe=e=>`Use current context (${e==null?void 0:e.context})`,UPe=e=>`使用当前上下文(${e==null?void 0:e.context})`,GPe=e=>`استفاده از کانتکست فعلی (${e==null?void 0:e.context})`,WPe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?UPe(e):t==="fa"?GPe(e):qPe(e)}),VPe=()=>"Language",KPe=()=>"语言",QPe=()=>"زبان",YPe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?KPe():t==="fa"?QPe():VPe()}),XPe=e=>`Run ${e==null?void 0:e.command} in a terminal to sign in.`,ZPe=e=>`在终端中运行 ${e==null?void 0:e.command} 以登录。`,JPe=e=>`برای ورود، ${e==null?void 0:e.command} را در ترمینال اجرا کنید.`,eFe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ZPe(e):t==="fa"?JPe(e):XPe(e)}),tFe=()=>"Make default",nFe=()=>"设为默认值",rFe=()=>"پیش‌فرض شود",sFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nFe():t==="fa"?rFe():tFe()}),iFe=()=>"Modal credentials are set in the process environment. Remove those overrides before replacing the token here.",aFe=()=>"Modal 凭据已在进程环境中设置。请先移除这些覆盖设置,再在此处替换令牌。",oFe=()=>"اعتبارنامه‌های Modal در محیط فرایند تنظیم شده‌اند. پیش از جایگزینی توکن در اینجا، این تنظیمات را حذف کنید.",lFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aFe():t==="fa"?oFe():iFe()}),cFe=()=>"Replace token ID",uFe=()=>"替换令牌 ID",dFe=()=>"جایگزینی شناسهٔ توکن",fFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uFe():t==="fa"?dFe():cFe()}),hFe=()=>"Replace token secret",_Fe=()=>"替换令牌密钥",pFe=()=>"جایگزینی رمز توکن",mFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_Fe():t==="fa"?pFe():hFe()}),gFe=()=>"How to get a Modal token",vFe=()=>"如何获取 Modal 令牌",bFe=()=>"روش دریافت توکن Modal",yFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vFe():t==="fa"?bFe():gFe()}),xFe=()=>"Token ID",wFe=()=>"令牌 ID",SFe=()=>"شناسهٔ توکن",kFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wFe():t==="fa"?SFe():xFe()}),CFe=()=>"Token secret",EFe=()=>"令牌密钥",NFe=()=>"رمز توکن",zFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?EFe():t==="fa"?NFe():CFe()}),jFe=e=>`${e==null?void 0:e.count} models available — ${e==null?void 0:e.models}`,TFe=e=>`${e==null?void 0:e.count} 个模型可用 — ${e==null?void 0:e.models}`,AFe=e=>`${e==null?void 0:e.count} مدل در دسترس — ${e==null?void 0:e.models}`,iL=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?TFe(e):t==="fa"?AFe(e):jFe(e)}),RFe=e=>`Needs ${e==null?void 0:e.tool}`,MFe=e=>`需要 ${e==null?void 0:e.tool}`,DFe=e=>`به ${e==null?void 0:e.tool} نیاز دارد`,LFe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?MFe(e):t==="fa"?DFe(e):RFe(e)}),OFe=()=>"Needs tools",IFe=()=>"缺少工具",BFe=()=>"به ابزارها نیاز دارد",$Fe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?IFe():t==="fa"?BFe():OFe()}),PFe=e=>`New runs use ${e==null?void 0:e.destination} unless another backend is specified.`,FFe=e=>`除非另行指定后端,否则新运行将使用${e==null?void 0:e.destination}。`,HFe=e=>`اجراهای جدید از ${e==null?void 0:e.destination} استفاده می‌کنند، مگر اینکه سامانهٔ دیگری مشخص شود.`,qFe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?FFe(e):t==="fa"?HFe(e):PFe(e)}),UFe=()=>"New runs use SSH; choose a host when launching.",GFe=()=>"新运行将使用 SSH;启动时请选择主机。",WFe=()=>"اجراهای جدید از SSH استفاده می‌کنند؛ هنگام اجرا یک میزبان انتخاب کنید.",VFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?GFe():t==="fa"?WFe():UFe()}),KFe=()=>"New token",QFe=()=>"新令牌",YFe=()=>"توکن جدید",XFe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?QFe():t==="fa"?YFe():KFe()}),ZFe=()=>"No default flavor",JFe=()=>"不设默认配置",eHe=()=>"بدون پیکربندی پیش‌فرض",tHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JFe():t==="fa"?eHe():ZFe()}),nHe=()=>"none",rHe=()=>"无",sHe=()=>"هیچ‌کدام",l6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rHe():t==="fa"?sHe():nHe()}),iHe=()=>"Not connected",aHe=()=>"未连接",oHe=()=>"متصل نیست",aL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aHe():t==="fa"?oHe():iHe()}),lHe=()=>"not found on PATH",cHe=()=>"在 PATH 中未找到",uHe=()=>"در PATH پیدا نشد",dHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cHe():t==="fa"?uHe():lHe()}),fHe=e=>`${e==null?void 0:e.context} (not in kubeconfig)`,hHe=e=>`${e==null?void 0:e.context}(不在 kubeconfig 中)`,_He=e=>`${e==null?void 0:e.context} (در kubeconfig نیست)`,pHe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?hHe(e):t==="fa"?_He(e):fHe(e)}),mHe=()=>"not initialized",gHe=()=>"尚未初始化",vHe=()=>"راه‌اندازی نشده",bHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gHe():t==="fa"?vHe():mHe()}),yHe=()=>"Not set",xHe=()=>"未设置",wHe=()=>"تنظیم نشده",T4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xHe():t==="fa"?wHe():yHe()}),SHe=()=>"OAuth (subscription login)",kHe=()=>"OAuth(订阅登录)",CHe=()=>"OAuth (ورود با اشتراک)",EHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kHe():t==="fa"?CHe():SHe()}),NHe=e=>`The old copy was left at ${e==null?void 0:e.path} on a different disk. You can delete it after confirming everything works.`,zHe=e=>`旧副本保留在另一磁盘的 ${e==null?void 0:e.path}。确认一切正常后即可删除。`,jHe=e=>`نسخهٔ قدیمی در ${e==null?void 0:e.path} روی دیسکی دیگر باقی ماند. پس از اطمینان از درست کار کردن همه‌چیز می‌توانید آن را حذف کنید.`,THe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?zHe(e):t==="fa"?jHe(e):NHe(e)}),AHe=()=>"Setting up…",RHe=()=>"正在设置…",MHe=()=>"در حال راه‌اندازی…",DHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?RHe():t==="fa"?MHe():AHe()}),LHe=()=>"Account",OHe=()=>"账户",IHe=()=>"حساب",c6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?OHe():t==="fa"?IHe():LHe()}),BHe=()=>"Add one with",$He=()=>"使用以下命令添加:",PHe=()=>"یکی با این فرمان اضافه کنید:",FHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$He():t==="fa"?PHe():BHe()}),HHe=()=>"Add variable",qHe=()=>"添加变量",UHe=()=>"افزودن متغیر",GHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qHe():t==="fa"?UHe():HHe()}),WHe=()=>"Agent models",VHe=()=>"智能体模型",KHe=()=>"مدل‌های عامل",QHe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VHe():t==="fa"?KHe():WHe()}),YHe=()=>"Anonymous usage analytics",XHe=()=>"匿名使用情况分析",ZHe=()=>"تحلیل ناشناس استفاده",kN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?XHe():t==="fa"?ZHe():YHe()}),JHe=()=>"Auth",eqe=()=>"身份验证",tqe=()=>"احراز هویت",nqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eqe():t==="fa"?tqe():JHe()}),rqe=()=>"Authentication",sqe=()=>"身份验证",iqe=()=>"احراز هویت",oL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sqe():t==="fa"?iqe():rqe()}),aqe=()=>"Back to Compute",oqe=()=>"返回算力设置",lqe=()=>"بازگشت به رایانش",lL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oqe():t==="fa"?lqe():aqe()}),cqe=()=>"Backend",uqe=()=>"后端",dqe=()=>"بک‌اند",fqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uqe():t==="fa"?dqe():cqe()}),hqe=()=>"Baseline",_qe=()=>"基线",pqe=()=>"خط مبنا",mqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_qe():t==="fa"?pqe():hqe()}),gqe=()=>"Binary",vqe=()=>"可执行文件",bqe=()=>"فایل اجرایی",yqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vqe():t==="fa"?bqe():gqe()}),xqe=()=>"Cancel",wqe=()=>"取消",Sqe=()=>"لغو",Nd=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wqe():t==="fa"?Sqe():xqe()}),kqe=()=>"Cancel new variable",Cqe=()=>"取消新变量",Eqe=()=>"لغو متغیر جدید",Nqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cqe():t==="fa"?Eqe():kqe()}),zqe=()=>"Checking compute targets…",jqe=()=>"正在检查算力目标…",Tqe=()=>"در حال بررسی مقصدهای رایانشی…",Aqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jqe():t==="fa"?Tqe():zqe()}),Rqe=()=>"Checking kubectl…",Mqe=()=>"正在检查 kubectl…",Dqe=()=>"در حال بررسی kubectl…",Lqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Mqe():t==="fa"?Dqe():Rqe()}),Oqe=()=>"Checking Modal…",Iqe=()=>"正在检查 Modal…",Bqe=()=>"در حال بررسی Modal…",$qe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Iqe():t==="fa"?Bqe():Oqe()}),Pqe=()=>"Choose a preset flavor",Fqe=()=>"选择预设规格",Hqe=()=>"یک پیکربندی آماده انتخاب کنید",CN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Fqe():t==="fa"?Hqe():Pqe()}),qqe=()=>"cluster default",Uqe=()=>"集群默认值",Gqe=()=>"پیش‌فرض خوشه",EN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Uqe():t==="fa"?Gqe():qqe()}),Wqe=()=>"cluster default (e.g. 4h, 30m)",Vqe=()=>"集群默认值(例如 4h、30m)",Kqe=()=>"پیش‌فرض خوشه (مثلاً 4h یا 30m)",Qqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vqe():t==="fa"?Kqe():Wqe()}),Yqe=()=>"Cluster unreachable",Xqe=()=>"无法连接集群",Zqe=()=>"خوشه در دسترس نیست",Jqe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xqe():t==="fa"?Zqe():Yqe()}),eUe=()=>"Compute",tUe=()=>"算力",nUe=()=>"رایانش",cL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tUe():t==="fa"?nUe():eUe()}),rUe=()=>"Connect compute backends and choose where new runs execute.",sUe=()=>"连接算力后端,并选择新运行的执行位置。",iUe=()=>"backendهای رایانشی را متصل و محل اجرای کارهای جدید را انتخاب کنید.",aUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sUe():t==="fa"?iUe():rUe()}),oUe=()=>"Connected",lUe=()=>"已连接",cUe=()=>"متصل",uUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lUe():t==="fa"?cUe():oUe()}),dUe=()=>"Context",fUe=()=>"上下文",hUe=()=>"زمینه",_Ue=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fUe():t==="fa"?hUe():dUe()}),pUe=()=>"Current",mUe=()=>"当前",gUe=()=>"فعلی",vUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mUe():t==="fa"?gUe():pUe()}),bUe=()=>"Currently off:",yUe=()=>"当前已关闭:",xUe=()=>"اکنون خاموش است:",wUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yUe():t==="fa"?xUe():bUe()}),SUe=()=>"Custom flavor",kUe=()=>"自定义规格",CUe=()=>"پیکربندی سفارشی",EUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kUe():t==="fa"?CUe():SUe()}),NUe=()=>"Custom flavor…",zUe=()=>"自定义规格…",jUe=()=>"پیکربندی سفارشی…",TUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zUe():t==="fa"?jUe():NUe()}),AUe=()=>"Data directory",RUe=()=>"数据目录",MUe=()=>"پوشهٔ داده",DUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?RUe():t==="fa"?MUe():AUe()}),LUe=()=>"default",OUe=()=>"默认",IUe=()=>"پیش‌فرض",BUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?OUe():t==="fa"?IUe():LUe()}),$Ue=()=>"Default",PUe=()=>"默认",FUe=()=>"پیش‌فرض",uL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?PUe():t==="fa"?FUe():$Ue()}),HUe=()=>"Default destination",qUe=()=>"默认目标",UUe=()=>"مقصد پیش‌فرض",GUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qUe():t==="fa"?UUe():HUe()}),WUe=()=>"Detecting hardware…",VUe=()=>"正在检测硬件…",KUe=()=>"در حال شناسایی سخت‌افزار…",QUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VUe():t==="fa"?KUe():WUe()}),YUe=()=>"Detecting harnesses…",XUe=()=>"正在检测智能体工具…",ZUe=()=>"در حال شناسایی ابزارهای عامل…",JUe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?XUe():t==="fa"?ZUe():YUe()}),eGe=()=>"Disabling syncing stops automatic pushes. Compute continues to use direct source snapshots. This does not delete the GitHub repository or code already pushed.",tGe=()=>"关闭同步会停止自动推送。算力执行仍使用直接的源代码快照。此操作不会删除 GitHub 仓库或已推送的代码。",nGe=()=>"خاموش کردن همگام‌سازی، push خودکار را متوقف می‌کند. رایانش همچنان از snapshot مستقیم منبع استفاده می‌کند. این کار مخزن GitHub یا کدهای ازپیش pushشده را حذف نمی‌کند.",rGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tGe():t==="fa"?nGe():eGe()}),sGe=()=>"Effective URL",iGe=()=>"实际使用的网址",aGe=()=>"نشانی مؤثر",oGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iGe():t==="fa"?aGe():sGe()}),lGe=()=>"Enable GitHub syncing for new projects",cGe=()=>"为新项目启用 GitHub 同步",uGe=()=>"فعال‌سازی همگام‌سازی GitHub برای پروژه‌های جدید",NN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cGe():t==="fa"?uGe():lGe()}),dGe=()=>"Environment",fGe=()=>"环境",hGe=()=>"محیط",dL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fGe():t==="fa"?hGe():dGe()}),_Ge=()=>"Failed",pGe=()=>"失败",mGe=()=>"ناموفق",u6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pGe():t==="fa"?mGe():_Ge()}),gGe=()=>"General",vGe=()=>"常规",bGe=()=>"عمومی",yGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vGe():t==="fa"?bGe():gGe()}),xGe=()=>"GitHub publishing",wGe=()=>"GitHub 发布",SGe=()=>"انتشار در GitHub",kGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wGe():t==="fa"?SGe():xGe()}),CGe=()=>"Git token",EGe=()=>"Git 令牌",NGe=()=>"توکن Git",zGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?EGe():t==="fa"?NGe():CGe()}),jGe=()=>"Harnesses",TGe=()=>"智能体工具",AGe=()=>"ابزارهای عامل",RGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?TGe():t==="fa"?AGe():jGe()}),MGe=()=>"hf_…",DGe=()=>"hf_…",LGe=()=>"hf_…",OGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?DGe():t==="fa"?LGe():MGe()}),IGe=()=>"HF_TOKEN is set in the environment and overrides any token saved here.",BGe=()=>"环境中已设置 HF_TOKEN,它会覆盖此处保存的令牌。",$Ge=()=>"مقدار HF_TOKEN در محیط تنظیم شده و هر توکن ذخیره‌شده در اینجا را بازنویسی می‌کند.",PGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BGe():t==="fa"?$Ge():IGe()}),FGe=()=>"Initialize Git",HGe=()=>"初始化 Git",qGe=()=>"راه‌اندازی Git",UGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HGe():t==="fa"?qGe():FGe()}),GGe=()=>"Install",WGe=()=>"安装",VGe=()=>"نصب",fL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WGe():t==="fa"?VGe():GGe()}),KGe=()=>"Install broken",QGe=()=>"安装损坏",YGe=()=>"نصب خراب است",XGe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?QGe():t==="fa"?YGe():KGe()}),ZGe=()=>"Install GitHub CLI",JGe=()=>"安装 GitHub CLI",eWe=()=>"نصب GitHub CLI",tWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JGe():t==="fa"?eWe():ZGe()}),nWe=()=>"Install updates automatically",rWe=()=>"自动安装更新",sWe=()=>"نصب خودکار به‌روزرسانی‌ها",zN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rWe():t==="fa"?sWe():nWe()}),iWe=()=>"Instance history",aWe=()=>"实例历史",oWe=()=>"تاریخچهٔ نمونه‌ها",lWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aWe():t==="fa"?oWe():iWe()}),cWe=()=>"Invalid Token",uWe=()=>"令牌无效",dWe=()=>"توکن نامعتبر",fWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uWe():t==="fa"?dWe():cWe()}),hWe=()=>"Jobs / Dashboard URL",_We=()=>"Jobs / 控制台网址",pWe=()=>"نشانی Jobs / داشبورد",mWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_We():t==="fa"?pWe():hWe()}),gWe=()=>"kubectl not found",vWe=()=>"未找到 kubectl",bWe=()=>"kubectl پیدا نشد",yWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vWe():t==="fa"?bWe():gWe()}),xWe=()=>"Latest",wWe=()=>"最新版本",SWe=()=>"جدیدترین",kWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wWe():t==="fa"?SWe():xWe()}),CWe=()=>"Loading…",EWe=()=>"正在加载…",NWe=()=>"در حال بارگیری…",du=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?EWe():t==="fa"?NWe():CWe()}),zWe=()=>"Loading Ray settings…",jWe=()=>"正在加载 Ray 设置…",TWe=()=>"در حال بارگیری تنظیمات Ray…",AWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jWe():t==="fa"?TWe():zWe()}),RWe=()=>"Loading slurm settings…",MWe=()=>"正在加载 Slurm 设置…",DWe=()=>"در حال بارگیری تنظیمات Slurm…",LWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?MWe():t==="fa"?DWe():RWe()}),OWe=()=>"Loading status…",IWe=()=>"正在加载状态…",BWe=()=>"در حال بارگیری وضعیت…",$We=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?IWe():t==="fa"?BWe():OWe()}),PWe=()=>"Local only",FWe=()=>"仅本地",HWe=()=>"فقط محلی",qWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?FWe():t==="fa"?HWe():PWe()}),UWe=()=>"Local repository",GWe=()=>"本地仓库",WWe=()=>"مخزن محلی",VWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?GWe():t==="fa"?WWe():UWe()}),KWe=()=>"Login node",QWe=()=>"登录节点",YWe=()=>"گرهٔ ورود",XWe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?QWe():t==="fa"?YWe():KWe()}),ZWe=()=>"Make GitHub syncing the default?",JWe=()=>"将 GitHub 同步设为默认值?",eVe=()=>"همگام‌سازی GitHub پیش‌فرض شود؟",tVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JWe():t==="fa"?eVe():ZWe()}),nVe=()=>"Missing bash/tar",rVe=()=>"缺少 bash/tar",sVe=()=>"bash/tar موجود نیست",iVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rVe():t==="fa"?sVe():nVe()}),aVe=()=>"More compute options",oVe=()=>"更多算力选项",lVe=()=>"گزینه‌های رایانشی بیشتر",cVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oVe():t==="fa"?lVe():aVe()}),uVe=()=>"Move failed:",dVe=()=>"移动失败:",fVe=()=>"انتقال ناموفق بود:",hVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dVe():t==="fa"?fVe():uVe()}),_Ve=()=>"Moved. orx is now using the new location.",pVe=()=>"已移动。orx 现在使用新位置。",mVe=()=>"منتقل شد. orx اکنون از محل جدید استفاده می‌کند.",gVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pVe():t==="fa"?mVe():_Ve()}),vVe=()=>"Namespace",bVe=()=>"命名空间",yVe=()=>"فضای نام",xVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bVe():t==="fa"?yVe():vVe()}),wVe=()=>"New location",SVe=()=>"新位置",kVe=()=>"محل جدید",CVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?SVe():t==="fa"?kVe():wVe()}),EVe=()=>"New releases are downloaded and installed in the background. Turning this off keeps the notice but leaves the install to you.",NVe=()=>"新版本会在后台下载并安装。关闭后仍会显示通知,但需要手动安装。",zVe=()=>"نسخه‌های جدید در پس‌زمینه دریافت و نصب می‌شوند. خاموش کردن این گزینه اعلان را نگه می‌دارد، اما نصب را به شما می‌سپارد.",jVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?NVe():t==="fa"?zVe():EVe()}),TVe=()=>"New variable key",AVe=()=>"新变量键名",RVe=()=>"کلید متغیر جدید",MVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?AVe():t==="fa"?RVe():TVe()}),DVe=()=>"New variable value",LVe=()=>"新变量值",OVe=()=>"مقدار متغیر جدید",IVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LVe():t==="fa"?OVe():DVe()}),BVe=()=>"No code, prompts, file contents, or account identifiers are sent.",$Ve=()=>"不会发送代码、提示词、文件内容或账户标识符。",PVe=()=>"هیچ کد، پرامپت، محتوای فایل یا شناسهٔ حسابی ارسال نمی‌شود.",FVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$Ve():t==="fa"?PVe():BVe()}),HVe=()=>"No hosts found in ~/.ssh/config.",qVe=()=>"在 ~/.ssh/config 中未找到主机。",UVe=()=>"میزبانی در ‎~/.ssh/config پیدا نشد.",GVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qVe():t==="fa"?UVe():HVe()}),WVe=()=>"No job-create permission",VVe=()=>"没有创建 Job 的权限",KVe=()=>"مجوز ساخت Job وجود ندارد",QVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VVe():t==="fa"?KVe():WVe()}),YVe=()=>"No Write Permissions",XVe=()=>"无写入权限",ZVe=()=>"بدون مجوز نوشتن",JVe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?XVe():t==="fa"?ZVe():YVe()}),eKe=()=>"No key on this computer to register — load a registered key with",tKe=()=>"此计算机上没有可注册的密钥——使用以下命令加载已注册的密钥:",nKe=()=>"کلیدی برای ثبت روی این رایانه نیست — کلید ثبت‌شده را با این فرمان بار کنید:",rKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tKe():t==="fa"?nKe():eKe()}),sKe=()=>"No key on this computer yet — create one with",iKe=()=>"此计算机上还没有密钥——使用以下命令创建:",aKe=()=>"هنوز کلیدی روی این رایانه نیست — با این فرمان یکی بسازید:",oKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iKe():t==="fa"?aKe():sKe()}),lKe=()=>"No Slurm CLI",cKe=()=>"无 Slurm CLI",uKe=()=>"بدون CLI اسلورم",dKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cKe():t==="fa"?uKe():lKe()}),fKe=()=>"None registered",hKe=()=>"未注册任何密钥",_Ke=()=>"هیچ‌کدام ثبت نشده",pKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hKe():t==="fa"?_Ke():fKe()}),mKe=()=>"Not checked",gKe=()=>"未检查",vKe=()=>"بررسی نشده",hL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gKe():t==="fa"?vKe():mKe()}),bKe=()=>"Not configured",yKe=()=>"未配置",xKe=()=>"پیکربندی نشده",Zv=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yKe():t==="fa"?xKe():bKe()}),wKe=()=>"Not installed",SKe=()=>"未安装",kKe=()=>"نصب نیست",CKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?SKe():t==="fa"?kKe():wKe()}),EKe=()=>"Not now",NKe=()=>"暂不",zKe=()=>"اکنون نه",jKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?NKe():t==="fa"?zKe():EKe()}),TKe=()=>"Not on this computer",AKe=()=>"不在此计算机上",RKe=()=>"روی این رایانه نیست",MKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?AKe():t==="fa"?RKe():TKe()}),DKe=()=>"Not set (pass --host per launch)",LKe=()=>"未设置(每次启动时传入 --host)",OKe=()=>"تنظیم نشده (در هر اجرا ‎--host بدهید)",IKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LKe():t==="fa"?OKe():DKe()}),BKe=()=>"Not signed in",$Ke=()=>"未登录",PKe=()=>"وارد نشده",_L=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$Ke():t==="fa"?PKe():BKe()}),FKe=()=>"On this computer",HKe=()=>"在此计算机上",qKe=()=>"روی این رایانه",UKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HKe():t==="fa"?qKe():FKe()}),GKe=()=>"Open a project to inspect its repository and GitHub publication state.",WKe=()=>"打开项目以查看其仓库和 GitHub 发布状态。",VKe=()=>"پروژه‌ای را باز کنید تا مخزن و وضعیت انتشار GitHub آن را ببینید.",KKe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WKe():t==="fa"?VKe():GKe()}),QKe=()=>"Open job page",YKe=()=>"打开作业页面",XKe=()=>"باز کردن صفحهٔ کار",jN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YKe():t==="fa"?XKe():QKe()}),ZKe=()=>"Open on GitHub",JKe=()=>"在 GitHub 上打开",eQe=()=>"باز کردن در GitHub",TN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JKe():t==="fa"?eQe():ZKe()}),tQe=()=>", or create one with",nQe=()=>",或使用以下命令创建:",rQe=()=>"، یا با این فرمان یکی بسازید:",sQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nQe():t==="fa"?rQe():tQe()}),iQe=()=>"Org",aQe=()=>"组织",oQe=()=>"سازمان",lQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aQe():t==="fa"?oQe():iQe()}),cQe=()=>"Orgs",uQe=()=>"组织",dQe=()=>"سازمان‌ها",fQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uQe():t==="fa"?dQe():cQe()}),hQe=()=>"orx can't update this install",_Qe=()=>"orx 无法更新此安装",pQe=()=>"orx نمی‌تواند این نصب را به‌روزرسانی کند",mQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_Qe():t==="fa"?pQe():hQe()}),gQe=()=>"Overleaf",vQe=()=>"Overleaf",bQe=()=>"Overleaf",pL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vQe():t==="fa"?bQe():gQe()}),yQe=()=>"Overleaf Git authentication token",xQe=()=>"Overleaf Git 身份验证令牌",wQe=()=>"توکن احراز هویت Git در Overleaf",SQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xQe():t==="fa"?wQe():yQe()}),kQe=()=>"Overridden by env",CQe=()=>"已被环境变量覆盖",EQe=()=>"بازنویسی‌شده توسط محیط",NQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?CQe():t==="fa"?EQe():kQe()}),zQe=()=>"Partition",jQe=()=>"分区",TQe=()=>"پارتیشن",AQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jQe():t==="fa"?TQe():zQe()}),RQe=()=>"Path",MQe=()=>"路径",DQe=()=>"مسیر",LQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?MQe():t==="fa"?DQe():RQe()}),OQe=()=>"Plan",IQe=()=>"方案",BQe=()=>"سطح اشتراک",$Qe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?IQe():t==="fa"?BQe():OQe()}),PQe=()=>"Project",FQe=()=>"项目",HQe=()=>"پروژه",qQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?FQe():t==="fa"?HQe():PQe()}),UQe=()=>"Ray version",GQe=()=>"Ray 版本",WQe=()=>"نسخهٔ Ray",VQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?GQe():t==="fa"?WQe():UQe()}),KQe=()=>"Reachable",QQe=()=>"可访问",YQe=()=>"در دسترس",XQe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?QQe():t==="fa"?YQe():KQe()}),ZQe=()=>"Reading ~/.ssh/config…",JQe=()=>"正在读取 ~/.ssh/config…",eYe=()=>"در حال خواندن ‎~/.ssh/config…",mL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?JQe():t==="fa"?eYe():ZQe()}),tYe=()=>"Ready",nYe=()=>"就绪",rYe=()=>"آماده",Qp=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nYe():t==="fa"?rYe():tYe()}),sYe=()=>"Ready to move",iYe=()=>"可以移动",aYe=()=>"آمادهٔ انتقال",oYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?iYe():t==="fa"?aYe():sYe()}),lYe=()=>"Configured",cYe=()=>"已配置",uYe=()=>"پیکربندی‌شده",d6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cYe():t==="fa"?uYe():lYe()}),dYe=()=>"Refresh",fYe=()=>"刷新",hYe=()=>"تازه‌سازی",Yp=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fYe():t==="fa"?hYe():dYe()}),_Ye=()=>"Remotes",pYe=()=>"远程仓库",mYe=()=>"مخزن‌های دوردست",gYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pYe():t==="fa"?mYe():_Ye()}),vYe=()=>"Repository",bYe=()=>"仓库",yYe=()=>"مخزن",xYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bYe():t==="fa"?yYe():vYe()}),wYe=()=>"Restart to finish updating",SYe=()=>"重新启动以完成更新",kYe=()=>"برای تکمیل به‌روزرسانی، دوباره راه‌اندازی کنید",CYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?SYe():t==="fa"?kYe():wYe()}),EYe=()=>"Running instances",NYe=()=>"正在运行的实例",zYe=()=>"نمونه‌های در حال اجرا",jYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?NYe():t==="fa"?zYe():EYe()}),TYe=()=>"Runtime",AYe=()=>"运行时间",RYe=()=>"زمان اجرا",MYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?AYe():t==="fa"?RYe():TYe()}),DYe=()=>". Save it under that key if it's meant for HF Jobs.",LYe=()=>"读取它。如果它用于 HF Jobs,请以该键名保存。",OYe=()=>"می‌خوانند. اگر برای HF Jobs است، آن را با همان کلید ذخیره کنید.",IYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LYe():t==="fa"?OYe():DYe()}),BYe=()=>"Session cookie",$Ye=()=>"会话 cookie",PYe=()=>"کوکی نشست",FYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$Ye():t==="fa"?PYe():BYe()}),HYe=()=>"With a session cookie saved, a linked paper follows Overleaf as people type and sends saves straight back. Figures still move on the slower Git sync. Copy the overleaf_session2 cookie from a browser signed in to Overleaf; it stops working when that sign-in does.",qYe=()=>"保存会话 cookie 后,已关联的论文会在他人输入时实时跟随 Overleaf,并立即回传保存;图片仍通过较慢的 Git 同步传输。请从已登录 Overleaf 的浏览器复制 overleaf_session2 cookie;该登录失效后它也会失效。",UYe=()=>"با ذخیرهٔ کوکی نشست، مقالهٔ پیوندشده هنگام تایپ دیگران Overleaf را زنده دنبال می‌کند و ذخیره‌ها را مستقیماً برمی‌گرداند؛ تصویرها همچنان با همگام‌سازی کندتر Git جابه‌جا می‌شوند. کوکی overleaf_session2 را از مرورگری که به Overleaf وارد شده کپی کنید؛ با پایان آن ورود، کوکی هم از کار می‌افتد.",GYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qYe():t==="fa"?UYe():HYe()}),WYe=()=>"Settings",VYe=()=>"设置",KYe=()=>"تنظیمات",f6=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VYe():t==="fa"?KYe():WYe()}),QYe=()=>"Signed in",YYe=()=>"已登录",XYe=()=>"وارد شده",ZYe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YYe():t==="fa"?XYe():QYe()}),JYe=()=>"Source",eXe=()=>"来源",tXe=()=>"منبع",gL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eXe():t==="fa"?tXe():JYe()}),nXe=()=>"SSH Key",rXe=()=>"SSH 密钥",sXe=()=>"کلید SSH",iXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?rXe():t==="fa"?sXe():nXe()}),aXe=()=>"Started",oXe=()=>"开始时间",lXe=()=>"آغاز",cXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oXe():t==="fa"?lXe():aXe()}),uXe=()=>"State",dXe=()=>"状态",fXe=()=>"وضعیت",hXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dXe():t==="fa"?fXe():uXe()}),_Xe=()=>"Status",pXe=()=>"状态",mXe=()=>"وضعیت",r_=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pXe():t==="fa"?mXe():_Xe()}),gXe=()=>"Storage",vXe=()=>"存储",bXe=()=>"ذخیره‌سازی",yXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vXe():t==="fa"?bXe():gXe()}),xXe=()=>"Sync",wXe=()=>"同步",SXe=()=>"همگام‌سازی",kXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wXe():t==="fa"?SXe():xXe()}),CXe=()=>"Syncing off",EXe=()=>"同步已关闭",NXe=()=>"همگام‌سازی خاموش",zXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?EXe():t==="fa"?NXe():CXe()}),jXe=()=>"Test connection",TXe=()=>"测试连接",AXe=()=>"آزمایش اتصال",RXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?TXe():t==="fa"?AXe():jXe()}),MXe=()=>"Testing…",DXe=()=>"正在测试…",LXe=()=>"در حال آزمایش…",OXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?DXe():t==="fa"?LXe():MXe()}),IXe=()=>", then add it with",BXe=()=>",然后使用以下命令添加:",$Xe=()=>"، سپس با این فرمان اضافه‌اش کنید:",PXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?BXe():t==="fa"?$Xe():IXe()}),FXe=()=>"This is useful when collaborators follow project changes on GitHub. New projects will enable syncing automatically, creating a private repository when needed and pushing experiment branches for visibility.",HXe=()=>"当协作者在 GitHub 上关注项目更改时,此功能很有用。新项目将自动启用同步,在需要时创建私有仓库,并推送实验分支以便查看。",qXe=()=>"وقتی همکاران تغییرات پروژه را در GitHub دنبال می‌کنند، این گزینه مفید است. پروژه‌های جدید همگام‌سازی را خودکار فعال می‌کنند، در صورت نیاز مخزن خصوصی می‌سازند و شاخه‌های آزمایش را برای دیده‌شدن push می‌کنند.",UXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?HXe():t==="fa"?qXe():FXe()}),GXe=()=>"This saved destination is not configured. Set it up below or choose another backend.",WXe=()=>"已保存的目标尚未配置。请在下方完成设置或选择其他后端。",VXe=()=>"این مقصد ذخیره‌شده پیکربندی نشده است. آن را در پایین راه‌اندازی یا backend دیگری انتخاب کنید.",KXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WXe():t==="fa"?VXe():GXe()}),QXe=()=>"This value looks like a Hugging Face token — compute runs only read it from",YXe=()=>"此值看起来像 Hugging Face 令牌——算力运行只会从",XXe=()=>"این مقدار شبیه توکن Hugging Face است — اجراهای رایانشی آن را فقط از",ZXe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YXe():t==="fa"?XXe():QXe()}),JXe=()=>"Time limit",eZe=()=>"时间限制",tZe=()=>"محدودیت زمانی",nZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eZe():t==="fa"?tZe():JXe()}),rZe=()=>"Unable to verify",sZe=()=>"无法验证",iZe=()=>"تأیید ممکن نیست",A4=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sZe():t==="fa"?iZe():rZe()}),aZe=()=>"Unknown",oZe=()=>"未知",lZe=()=>"نامشخص",vL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oZe():t==="fa"?lZe():aZe()}),cZe=()=>"Update required",uZe=()=>"需要更新",dZe=()=>"نیازمند به‌روزرسانی",fZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?uZe():t==="fa"?dZe():cZe()}),hZe=()=>"Updates",_Ze=()=>"更新",pZe=()=>"به‌روزرسانی‌ها",AN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_Ze():t==="fa"?pZe():hZe()}),mZe=()=>"Usage analytics",gZe=()=>"使用情况分析",vZe=()=>"تحلیل استفاده",bZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?gZe():t==="fa"?vZe():mZe()}),yZe=()=>"value",xZe=()=>"值",wZe=()=>"مقدار",bL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xZe():t==="fa"?wZe():yZe()}),SZe=()=>"Variables available to runs and the research agent (API keys, tokens).",kZe=()=>"可供运行和研究智能体使用的变量(API 密钥、令牌)。",CZe=()=>"متغیرهای در دسترس اجراها و عامل پژوهشی (کلیدهای API، توکن‌ها).",EZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kZe():t==="fa"?CZe():SZe()}),NZe=()=>"Version",zZe=()=>"版本",jZe=()=>"نسخه",yL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zZe():t==="fa"?jZe():NZe()}),TZe=()=>"When enabled, each new project gets a private GitHub repository. Experiment branches are pushed automatically for collaborator visibility. Compute always uses direct source snapshots.",AZe=()=>"启用后,每个新项目都会获得一个私有 GitHub 仓库。实验分支会自动推送,便于协作者查看。算力执行始终使用直接的源代码快照。",RZe=()=>"با فعال شدن، هر پروژهٔ جدید یک مخزن خصوصی GitHub می‌گیرد. شاخه‌های آزمایش برای دیده‌شدن توسط همکاران خودکار push می‌شوند. رایانش همیشه از snapshot مستقیم منبع استفاده می‌کند.",MZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?AZe():t==="fa"?RZe():TZe()}),DZe=()=>"With a token saved, a paper opened in the dashboard can be kept in step with an Overleaf project, in both directions. Overleaf's Git integration comes with a paid Overleaf plan; without one, a paper can still be uploaded to Overleaf as a new project. The token stays on this machine and is not sent to compute backends.",LZe=()=>"保存令牌后,可让控制台中打开的论文与 Overleaf 项目双向保持同步。Overleaf 的 Git 集成需要付费方案;没有付费方案时,仍可将论文作为新项目上传到 Overleaf。令牌仅保存在此计算机上,不会发送到算力后端。",OZe=()=>"با ذخیرهٔ توکن، مقاله‌ای که در داشبورد باز شده می‌تواند در هر دو جهت با یک پروژهٔ Overleaf همگام بماند. یکپارچه‌سازی Git در Overleaf به طرح پولی نیاز دارد؛ بدون آن هم می‌توان مقاله را به‌عنوان پروژه‌ای جدید در Overleaf بارگذاری کرد. توکن روی همین دستگاه می‌ماند و به backendهای رایانشی فرستاده نمی‌شود.",IZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?LZe():t==="fa"?OZe():DZe()}),BZe=()=>"Pick a login node first",$Ze=()=>"请先选择登录节点",PZe=()=>"ابتدا یک گرهٔ ورود انتخاب کنید",FZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$Ze():t==="fa"?PZe():BZe()}),HZe=()=>"Providers",qZe=()=>"提供商",UZe=()=>"ارائه‌دهندگان",GZe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qZe():t==="fa"?UZe():HZe()}),WZe=()=>"Reconnect",VZe=()=>"重新连接",KZe=()=>"اتصال دوباره",xL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?VZe():t==="fa"?KZe():WZe()}),QZe=e=>`Register this computer with ${e==null?void 0:e.register}, or load a registered key with ${e==null?void 0:e.load}.`,YZe=e=>`使用 ${e==null?void 0:e.register} 注册此计算机,或使用 ${e==null?void 0:e.load} 加载已注册的密钥。`,XZe=e=>`این رایانه را با ${e==null?void 0:e.register} ثبت کنید، یا کلید ثبت‌شده را با ${e==null?void 0:e.load} بار کنید.`,ZZe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?YZe(e):t==="fa"?XZe(e):QZe(e)}),JZe=()=>"Reinstall with the orx installer to get automatic updates.",eJe=()=>"请使用 orx 安装程序重新安装,以获得自动更新。",tJe=()=>"برای دریافت به‌روزرسانی خودکار، با نصب‌کنندهٔ orx دوباره نصب کنید.",nJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eJe():t==="fa"?tJe():JZe()}),rJe=()=>"Re-link",sJe=()=>"重新链接",iJe=()=>"پیوند دوباره",aJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sJe():t==="fa"?iJe():rJe()}),oJe=()=>"Remove cookie",lJe=()=>"移除 cookie",cJe=()=>"حذف کوکی",uJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lJe():t==="fa"?cJe():oJe()}),dJe=()=>"Remove token",fJe=()=>"移除令牌",hJe=()=>"حذف توکن",_Je=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fJe():t==="fa"?hJe():dJe()}),pJe=()=>"Removing…",mJe=()=>"正在移除…",gJe=()=>"در حال حذف…",RN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mJe():t==="fa"?gJe():pJe()}),vJe=()=>"Replace anyway",bJe=()=>"仍要替换",yJe=()=>"به‌هرحال جایگزین کن",xJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bJe():t==="fa"?yJe():vJe()}),wJe=()=>"Replace key",SJe=()=>"替换密钥",kJe=()=>"جایگزینی کلید",CJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?SJe():t==="fa"?kJe():wJe()}),EJe=()=>"Replace token",NJe=()=>"替换令牌",zJe=()=>"جایگزینی توکن",jJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?NJe():t==="fa"?zJe():EJe()}),TJe=e=>`Git and GitHub settings for ${e==null?void 0:e.project}. Local Git powers experiments; publishing is optional.`,AJe=e=>`${e==null?void 0:e.project} 的 Git 和 GitHub 设置。本地 Git 为实验提供支持;发布是可选的。`,RJe=e=>`تنظیمات Git و GitHub برای ${e==null?void 0:e.project}. Git محلی آزمایش‌ها را ممکن می‌کند؛ انتشار اختیاری است.`,MJe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?AJe(e):t==="fa"?RJe(e):TJe(e)}),DJe=e=>`Version ${e==null?void 0:e.installed} is installed. This window is still running ${e==null?void 0:e.current}.`,LJe=e=>`已安装版本 ${e==null?void 0:e.installed}。此窗口仍在运行 ${e==null?void 0:e.current}。`,OJe=e=>`نسخهٔ ${e==null?void 0:e.installed} نصب شده است. این پنجره هنوز نسخهٔ ${e==null?void 0:e.current} را اجرا می‌کند.`,IJe=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?LJe(e):t==="fa"?OJe(e):DJe(e)}),BJe=()=>"Run `gh auth login` in your terminal.",$Je=()=>"请在终端中运行 `gh auth login`。",PJe=()=>"در پایانه `gh auth login` را اجرا کنید.",FJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$Je():t==="fa"?PJe():BJe()}),HJe=()=>"Saved",qJe=()=>"已保存",UJe=()=>"ذخیره شده",MN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qJe():t==="fa"?UJe():HJe()}),GJe=()=>"Set up",WJe=()=>"设置",VJe=()=>"راه‌اندازی",KJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?WJe():t==="fa"?VJe():GJe()}),QJe=()=>"Set up SSH key",YJe=()=>"设置 SSH 密钥",XJe=()=>"راه‌اندازی کلید SSH",ZJe=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?YJe():t==="fa"?XJe():QJe()}),JJe=()=>"Sign in",eet=()=>"登录",tet=()=>"ورود",wL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?eet():t==="fa"?tet():JJe()}),net=e=>`SSH connection terminal for ${e==null?void 0:e.host}`,ret=e=>`${e==null?void 0:e.host} 的 SSH 连接终端`,set=e=>`پایانهٔ اتصال SSH برای ${e==null?void 0:e.host}`,SL=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ret(e):t==="fa"?set(e):net(e)}),iet=()=>"The local database, run logs, artifacts, and chat attachments. Moving this directory copies the entire store.",aet=()=>"本地数据库、运行日志、产物和聊天附件。移动此目录会复制整个存储。",oet=()=>"پایگاه دادهٔ محلی، گزارش اجراها، خروجی‌ها و پیوست‌های گفتگو. انتقال این پوشه، کل مخزن داده را کپی می‌کند.",cet=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?aet():t==="fa"?oet():iet()}),uet=()=>"The terminal disconnected before setup completed. Try again.",det=()=>"设置完成前终端连接已断开。请重试。",fet=()=>"ارتباط ترمینال پیش از تکمیل راه‌اندازی قطع شد. دوباره تلاش کنید.",DN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?det():t==="fa"?fet():uet()}),het=()=>"Dark",_et=()=>"深色",pet=()=>"تیره",met=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_et():t==="fa"?pet():het()}),get=()=>"Theme",vet=()=>"主题",bet=()=>"پوسته",LN=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vet():t==="fa"?bet():get()}),yet=()=>"Light",xet=()=>"浅色",wet=()=>"روشن",ket=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xet():t==="fa"?wet():yet()}),Cet=()=>"System",Eet=()=>"系统",Net=()=>"سیستم",zet=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Eet():t==="fa"?Net():Cet()}),jet=()=>"Set up billing in the Tinker console",Tet=()=>"在 Tinker 控制台设置账单",Aet=()=>"تنظیم پرداخت در کنسول Tinker",Ret=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tet():t==="fa"?Aet():jet()}),Met=()=>"Billing setup required",Det=()=>"需要设置账单",Let=()=>"تنظیم پرداخت لازم است",Oet=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Det():t==="fa"?Let():Met()}),Iet=()=>"TINKER_API_KEY is set in the process environment and overrides keys saved here. The status reflects that key.",Bet=()=>"进程环境中已设置 TINKER_API_KEY,它会覆盖此处保存的密钥。状态显示的是该密钥的检查结果。",$et=()=>"متغیر TINKER_API_KEY در محیط فرایند تنظیم شده و بر کلیدهای ذخیره‌شده در اینجا اولویت دارد. وضعیت مربوط به همان کلید است.",Pet=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Bet():t==="fa"?$et():Iet()}),Fet=()=>"Invalid Key",Het=()=>"密钥无效",qet=()=>"کلید نامعتبر",Uet=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Het():t==="fa"?qet():Fet()}),Get=()=>"Token from",Wet=()=>"令牌来自",Vet=()=>"توکن از",Ket=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wet():t==="fa"?Vet():Get()}),Qet=()=>"Update now",Yet=()=>"立即更新",Xet=()=>"اکنون به‌روزرسانی کن",Zet=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Yet():t==="fa"?Xet():Qet()}),Jet=e=>`Update to ${e==null?void 0:e.version}`,ett=e=>`更新到 ${e==null?void 0:e.version}`,ttt=e=>`به‌روزرسانی به ${e==null?void 0:e.version}`,ntt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ett(e):t==="fa"?ttt(e):Jet(e)}),rtt=()=>" Updates are switched off for this environment by ORX_NO_UPDATE_CHECK, so this setting has no effect.",stt=()=>" 此环境已通过 ORX_NO_UPDATE_CHECK 关闭更新,因此此设置不会生效。",itt=()=>" به‌روزرسانی در این محیط با ORX_NO_UPDATE_CHECK خاموش شده است؛ بنابراین این تنظیم اثری ندارد.",att=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?stt():t==="fa"?itt():rtt()}),ott=()=>"Updating default destination…",ltt=()=>"正在更新默认运行位置…",ctt=()=>"در حال به‌روزرسانی مقصد پیش‌فرض…",utt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ltt():t==="fa"?ctt():ott()}),dtt=()=>"Use this repository for automatic experiment-branch pushes when your connected account can write to it. Otherwise, OpenResearch creates a separate private repository for collaboration.",ftt=()=>"当已连接的账户有写入权限时,使用此仓库自动推送实验分支。否则,OpenResearch 会另建一个私有仓库用于协作。",htt=()=>"اگر حساب متصل اجازهٔ نوشتن داشته باشد، شاخه‌های آزمایش خودکار به این مخزن پوش می‌شوند. در غیر این صورت OpenResearch یک مخزن خصوصی جداگانه برای همکاری می‌سازد.",_tt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ftt():t==="fa"?htt():dtt()}),ptt=()=>"Validating…",mtt=()=>"正在验证…",gtt=()=>"در حال اعتبارسنجی…",kL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mtt():t==="fa"?gtt():ptt()}),vtt=()=>"View settings",btt=()=>"查看设置",ytt=()=>"مشاهدهٔ تنظیمات",xtt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?btt():t==="fa"?ytt():vtt()}),wtt=()=>"Skill",Stt=()=>"技能",ktt=()=>"مهارت",Ctt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Stt():t==="fa"?ktt():wtt()}),Ett=()=>"Loading skill…",Ntt=()=>"正在加载技能…",ztt=()=>"در حال بارگیری مهارت…",jtt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ntt():t==="fa"?ztt():Ett()}),Ttt=()=>"Personal",Att=()=>"个人",Rtt=()=>"شخصی",Mtt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Att():t==="fa"?Rtt():Ttt()}),Dtt=()=>"Alternatively, tell your agent to save a reusable skill for you.",Ltt=()=>"或者,请你的智能体为你保存可重复使用的技能。",Ott=()=>"یا از عامل خود بخواهید یک مهارت قابل استفادهٔ مجدد برایتان ذخیره کند.",Itt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ltt():t==="fa"?Ott():Dtt()}),Btt=e=>`Delete the “${e==null?void 0:e.name}” skill?`,$tt=e=>`删除技能“${e==null?void 0:e.name}”?`,Ptt=e=>`مهارت «${e==null?void 0:e.name}» حذف شود؟`,Ftt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?$tt(e):t==="fa"?Ptt(e):Btt(e)}),Htt=e=>`Delete skill ${e==null?void 0:e.name}`,qtt=e=>`删除技能 ${e==null?void 0:e.name}`,Utt=e=>`حذف مهارت ${e==null?void 0:e.name}`,Gtt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?qtt(e):t==="fa"?Utt(e):Htt(e)}),Wtt=e=>`Delete the “${e==null?void 0:e.name}” template?`,Vtt=e=>`删除模板“${e==null?void 0:e.name}”?`,Ktt=e=>`قالب «${e==null?void 0:e.name}» حذف شود؟`,Qtt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Vtt(e):t==="fa"?Ktt(e):Wtt(e)}),Ytt=e=>`Delete template ${e==null?void 0:e.name}`,Xtt=e=>`删除模板 ${e==null?void 0:e.name}`,Ztt=e=>`حذف قالب ${e==null?void 0:e.name}`,Jtt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Xtt(e):t==="fa"?Ztt(e):Ytt(e)}),ent=()=>"Invoke skills with /name in chat. Skills from your coding agents are screened for research relevance before importing. Upload a skill to include it yourself. Alternatively, tell your OpenResearch agent to create and add a reusable skill for you.",tnt=()=>"在聊天中使用 /name 调用技能。来自编程代理的技能会先经过研究相关性筛选,再导入。您也可以自行上传技能,或让 OpenResearch 代理为您创建并添加可复用技能。",nnt=()=>"مهارت‌ها را با /name در گفتگو فراخوانی کنید. مهارت‌های عامل‌های برنامه‌نویسی پیش از وارد شدن از نظر ارتباط با پژوهش بررسی می‌شوند. می‌توانید مهارت را خودتان بارگذاری کنید یا از عامل OpenResearch بخواهید یک مهارت قابل استفادهٔ مجدد بسازد و اضافه کند.",rnt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tnt():t==="fa"?nnt():ent()}),snt=()=>"Drop a SKILL.md or .zip here, or click to choose",int=()=>"将 SKILL.md 或 .zip 拖放到此处,或点击选择",ant=()=>"یک فایل SKILL.md یا .zip را اینجا رها کنید، یا برای انتخاب کلیک کنید",ont=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?int():t==="fa"?ant():snt()}),lnt=()=>"Drop a .tex or .zip here, or click to choose",cnt=()=>"将 .tex 或 .zip 拖放到此处,或点击选择",unt=()=>"یک فایل .tex یا .zip را اینجا رها کنید، یا برای انتخاب کلیک کنید",dnt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cnt():t==="fa"?unt():lnt()}),fnt=()=>"File too large (max 20 MB).",hnt=()=>"文件过大(最大 20 MB)。",_nt=()=>"فایل بیش از حد بزرگ است (حداکثر ۲۰ مگابایت).",CL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hnt():t==="fa"?_nt():fnt()}),pnt=()=>" + 1 file",mnt=()=>" + 1 个文件",gnt=()=>" + ۱ فایل",vnt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mnt():t==="fa"?gnt():pnt()}),bnt=()=>"Customize the skills and LaTeX templates available across your projects. Upload them here, or ask an OpenResearch agent to create and add them for you.",ynt=()=>"自定义所有项目中可用的技能和 LaTeX 模板。在此上传,或让 OpenResearch 代理为您创建并添加。",xnt=()=>"مهارت‌ها و قالب‌های LaTeX قابل استفاده در همهٔ پروژه‌ها را سفارشی کنید. آن‌ها را اینجا بارگذاری کنید یا از عامل OpenResearch بخواهید برایتان بسازد و اضافه کند.",wnt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ynt():t==="fa"?xnt():bnt()}),Snt=()=>"Remove from OpenResearch",knt=()=>"从 OpenResearch 移除",Cnt=()=>"حذف از OpenResearch",Ent=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?knt():t==="fa"?Cnt():Snt()}),Nnt=e=>`Remove “${e==null?void 0:e.name}” from OpenResearch? Its source files will remain in your coding agent.`,znt=e=>`从 OpenResearch 移除“${e==null?void 0:e.name}”?源文件将保留在你的编程智能体中。`,jnt=e=>`«${e==null?void 0:e.name}» از OpenResearch حذف شود؟ فایل‌های اصلی در عامل برنامه‌نویسی شما باقی می‌مانند.`,Tnt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?znt(e):t==="fa"?jnt(e):Nnt(e)}),Ant=e=>`Remove ${e==null?void 0:e.name} from OpenResearch`,Rnt=e=>`从 OpenResearch 移除 ${e==null?void 0:e.name}`,Mnt=e=>`حذف ${e==null?void 0:e.name} از OpenResearch`,Dnt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Rnt(e):t==="fa"?Mnt(e):Ant(e)}),Lnt=e=>` + ${e==null?void 0:e.count} files`,Ont=e=>` + ${e==null?void 0:e.count} 个文件`,Int=e=>` + ${e==null?void 0:e.count} فایل`,Bnt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Ont(e):t==="fa"?Int(e):Lnt(e)}),$nt=()=>"Could not load skills:",Pnt=()=>"无法加载技能:",Fnt=()=>"بارگیری مهارت‌ها ممکن نشد:",Hnt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Pnt():t==="fa"?Fnt():$nt()}),qnt=()=>"Could not load templates:",Unt=()=>"无法加载模板:",Gnt=()=>"بارگیری قالب‌ها ممکن نشد:",Wnt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Unt():t==="fa"?Gnt():qnt()}),Vnt=()=>"Customize",Knt=()=>"自定义",Qnt=()=>"سفارشی‌سازی",Ynt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Knt():t==="fa"?Qnt():Vnt()}),Xnt=()=>"Delete skill",Znt=()=>"删除技能",Jnt=()=>"حذف مهارت",ert=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Znt():t==="fa"?Jnt():Xnt()}),trt=()=>"Delete template",nrt=()=>"删除模板",rrt=()=>"حذف قالب",srt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?nrt():t==="fa"?rrt():trt()}),irt=()=>"LaTeX templates",art=()=>"LaTeX 模板",ort=()=>"قالب‌های LaTeX",lrt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?art():t==="fa"?ort():irt()}),crt=()=>"Loading skills…",urt=()=>"正在加载技能…",drt=()=>"در حال بارگیری مهارت‌ها…",frt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?urt():t==="fa"?drt():crt()}),hrt=()=>"Loading templates…",_rt=()=>"正在加载模板…",prt=()=>"در حال بارگیری قالب‌ها…",mrt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?_rt():t==="fa"?prt():hrt()}),grt=()=>"No skills yet.",vrt=()=>"尚无技能。",brt=()=>"هنوز مهارتی وجود ندارد.",yrt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?vrt():t==="fa"?brt():grt()}),xrt=()=>"No templates yet.",wrt=()=>"尚无模板。",Srt=()=>"هنوز قالبی وجود ندارد.",krt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?wrt():t==="fa"?Srt():xrt()}),Crt=()=>"Skills",Ert=()=>"技能",Nrt=()=>"مهارت‌ها",zrt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ert():t==="fa"?Nrt():Crt()}),jrt=()=>"Uploading…",Trt=()=>"正在上传…",Art=()=>"در حال بارگذاری…",Rrt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Trt():t==="fa"?Art():jrt()}),Mrt=()=>"A conference class or house style the agent writes papers into instead of its default preamble. Upload a .tex file or a .zip containing its .cls and .sty files. Alternatively, tell your OpenResearch agent to create and add a LaTeX template for you. With exactly one template available, the agent uses it without asking.",Drt=()=>"代理撰写论文时使用的会议格式或自定义样式,用于替代默认导言区。上传 .tex 文件或包含 .cls 和 .sty 文件的 .zip 压缩包,也可以让 OpenResearch 代理为您创建并添加 LaTeX 模板。只有一个模板可用时,代理会直接使用,无需询问。",Lrt=()=>"قالب کنفرانس یا سبک اختصاصی که عامل به‌جای پیش‌گفتار پیش‌فرض برای نوشتن مقاله استفاده می‌کند. یک فایل .tex یا فایل .zip شامل فایل‌های .cls و .sty بارگذاری کنید، یا از عامل OpenResearch بخواهید قالب LaTeX بسازد و اضافه کند. اگر تنها یک قالب موجود باشد، عامل بدون پرسش از آن استفاده می‌کند.",Ort=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Drt():t==="fa"?Lrt():Mrt()}),Irt=()=>"Upload a SKILL.md file or a .zip of a skill folder.",Brt=()=>"请上传 SKILL.md 文件或技能文件夹的 .zip 压缩包。",$rt=()=>"یک فایل SKILL.md یا فایل .zip از پوشهٔ مهارت بارگذاری کنید.",Prt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Brt():t==="fa"?$rt():Irt()}),Frt=()=>"Upload a .tex file or a .zip of a template folder.",Hrt=()=>"请上传 .tex 文件或模板文件夹的 .zip 压缩包。",qrt=()=>"یک فایل .tex یا فایل .zip از پوشهٔ قالب بارگذاری کنید.",Urt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hrt():t==="fa"?qrt():Frt()}),Grt=()=>"Close SSH config",Wrt=()=>"关闭 SSH 配置",Vrt=()=>"بستن پیکربندی SSH",Krt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wrt():t==="fa"?Vrt():Grt()}),Qrt=()=>"Discard your unsaved SSH config changes?",Yrt=()=>"要放弃未保存的 SSH 配置更改吗?",Xrt=()=>"تغییرات ذخیره‌نشدهٔ پیکربندی SSH کنار گذاشته شود؟",Zrt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Yrt():t==="fa"?Xrt():Qrt()}),Jrt=()=>"Loading SSH config…",est=()=>"正在加载 SSH 配置…",tst=()=>"در حال بارگیری پیکربندی SSH…",nst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?est():t==="fa"?tst():Jrt()}),rst=()=>"SSH config saved",sst=()=>"SSH 配置已保存",ist=()=>"پیکربندی SSH ذخیره شد",ast=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sst():t==="fa"?ist():rst()}),ost=()=>"SSH config",lst=()=>"SSH 配置",cst=()=>"پیکربندی SSH",ust=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lst():t==="fa"?cst():ost()}),dst=()=>"Configure SSH hosts…",fst=()=>"配置 SSH 主机…",hst=()=>"پیکربندی میزبان‌های SSH…",EL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fst():t==="fa"?hst():dst()}),_st=()=>"Cancelled",pst=()=>"已取消",mst=()=>"لغوشده",gst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pst():t==="fa"?mst():_st()}),vst=()=>"Cancelling",bst=()=>"正在取消",yst=()=>"در حال لغو",xst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bst():t==="fa"?yst():vst()}),wst=()=>"Done",Sst=()=>"已完成",kst=()=>"انجام‌شده",Cst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Sst():t==="fa"?kst():wst()}),Est=()=>"Editing",Nst=()=>"正在编辑",zst=()=>"در حال ویرایش",jst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nst():t==="fa"?zst():Est()}),Tst=()=>"Failed",Ast=()=>"失败",Rst=()=>"ناموفق",Mst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ast():t==="fa"?Rst():Tst()}),Dst=()=>"Idle",Lst=()=>"空闲",Ost=()=>"بی‌کار",Ist=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lst():t==="fa"?Ost():Dst()}),Bst=()=>"Running",$st=()=>"运行中",Pst=()=>"در حال اجرا",Fst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$st():t==="fa"?Pst():Bst()}),Hst=()=>"Starting",qst=()=>"正在启动",Ust=()=>"در حال آغاز",Gst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qst():t==="fa"?Ust():Hst()}),Wst=()=>"Copying…",Vst=()=>"正在复制…",Kst=()=>"در حال کپی…",Qst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vst():t==="fa"?Kst():Wst()}),Yst=()=>"Finalizing…",Xst=()=>"正在完成…",Zst=()=>"در حال نهایی‌سازی…",Jst=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xst():t==="fa"?Zst():Yst()}),eit=e=>`${e==null?void 0:e.size} free at target`,tit=e=>`目标位置可用空间 ${e==null?void 0:e.size}`,nit=e=>`${e==null?void 0:e.size} فضای آزاد در مقصد`,rit=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?tit(e):t==="fa"?nit(e):eit(e)}),sit=e=>`Move all orx data to: ${e==null?void 0:e.path} The store is copied to the new location and activated there. Active runs or chats will block the move.`,iit=e=>`将所有 orx 数据移动到: @@ -77,15 +77,15 @@ ${e==null?void 0:e.path} 存储内容会复制到新位置并在那里启用。活跃的运行或聊天会阻止移动。`,ait=e=>`همهٔ داده‌های orx به این محل منتقل شوند؟ ${e==null?void 0:e.path} -مخزن داده به محل جدید کپی و همان‌جا فعال می‌شود. اجراها یا گفتگوهای فعال مانع انتقال خواهند شد.`,oit=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?iit(e):t==="fa"?ait(e):sit(e)}),lit=()=>"Move data here",cit=()=>"将数据移动到此处",uit=()=>"انتقال داده به اینجا",dit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cit():t==="fa"?uit():lit()}),fit=()=>"Moving…",hit=()=>"正在移动…",_it=()=>"در حال جابه‌جایی…",pit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hit():t==="fa"?_it():fit()}),mit=()=>"Preparing…",git=()=>"正在准备…",vit=()=>"در حال آماده‌سازی…",bit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?git():t==="fa"?vit():mit()}),yit=()=>" (same disk, instant)",xit=()=>"(同一磁盘,可立即完成)",wit=()=>" (روی همان دیسک، فوری)",Sit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xit():t==="fa"?wit():yit()}),kit=()=>"default location",Cit=()=>"默认位置",Eit=()=>"محل پیش‌فرض",Nit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cit():t==="fa"?Eit():kit()}),zit=()=>"ORX_DATA_DIR environment variable",jit=()=>"ORX_DATA_DIR 环境变量",Tit=()=>"متغیر محیطی ORX_DATA_DIR",Ait=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jit():t==="fa"?Tit():zit()}),Rit=()=>"your saved setting",Mit=()=>"已保存的设置",Dit=()=>"تنظیم ذخیره‌شدهٔ شما",Lit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Mit():t==="fa"?Dit():Rit()}),Oit=()=>"XDG_DATA_HOME",Iit=()=>"XDG_DATA_HOME",Bit=()=>"XDG_DATA_HOME",$it=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Iit():t==="fa"?Bit():Oit()}),Pit=()=>"Verifying…",Fit=()=>"正在验证…",Hit=()=>"در حال بررسی…",qit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Fit():t==="fa"?Hit():Pit()}),Uit=()=>"Loading…",Git=()=>"正在加载…",Wit=()=>"در حال بارگیری…",Vit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Git():t==="fa"?Wit():Uit()}),Kit=()=>"This sub-agent is no longer available.",Qit=()=>"此子智能体已不可用。",Yit=()=>"این عامل فرعی دیگر در دسترس نیست.",Xit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Qit():t==="fa"?Yit():Kit()}),Zit=e=>`${e==null?void 0:e.label} (preview; double-click or Command/Control K, then Enter to keep open)`,Jit=e=>`${e==null?void 0:e.label}(预览;双击或按 Command/Control K 后按 Enter 以保持打开)`,eat=e=>`${e==null?void 0:e.label} (پیش‌نمایش؛ برای باز نگه‌داشتن دوبار کلیک کنید یا Command/Control K و سپس Enter را بزنید)`,tat=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Jit(e):t==="fa"?eat(e):Zit(e)}),nat=e=>`${e==null?void 0:e.label} (double-click or ⌘/Ctrl+K Enter to keep open)`,rat=e=>`${e==null?void 0:e.label}(双击或按 ⌘/Ctrl+K 后按 Enter 以保持打开)`,sat=e=>`${e==null?void 0:e.label} (برای باز نگه‌داشتن دوبار کلیک کنید یا ⌘/Ctrl+K و سپس Enter را بزنید)`,iat=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?rat(e):t==="fa"?sat(e):nat(e)}),aat=()=>"Alternatively, tell your agent to add a LaTeX template for you.",oat=()=>"或者,请你的智能体为你添加 LaTeX 模板。",lat=()=>"یا از عامل خود بخواهید یک قالب LaTeX برایتان اضافه کند.",cat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oat():t==="fa"?lat():aat()}),uat=()=>", a repo for training a mini-GPT from scratch.",dat=()=>",一个从零训练迷你 GPT 的仓库。",fat=()=>"، اثر Andrej Karpathy، مخزنی برای آموزش یک GPT کوچک از صفر، استفاده می‌کند.",hat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dat():t==="fa"?fat():uat()}),_at=()=>"Close",pat=()=>"关闭",mat=()=>"بستن",gat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pat():t==="fa"?mat():_at()}),vat=()=>"Create a new project",bat=()=>"新建项目",yat=()=>"ایجاد پروژهٔ جدید",xat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bat():t==="fa"?yat():vat()}),wat=()=>"Demo project",Sat=()=>"演示项目",kat=()=>"پروژهٔ نمایشی",Cat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Sat():t==="fa"?kat():wat()}),Eat=()=>"Explore the demo",Nat=()=>"探索演示项目",zat=()=>"دیدن پروژهٔ نمایشی",jat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nat():t==="fa"?zat():Eat()}),Tat=()=>"Look through the agent conversations, experiments, runs, and artifacts to see how a project on OpenResearch comes together.",Aat=()=>"浏览智能体对话、实验、运行和产物,了解 OpenResearch 项目是如何形成的。",Rat=()=>"گفتگوهای عامل، آزمایش‌ها، اجراها و خروجی‌ها را ببینید تا با شکل‌گیری یک پروژه در OpenResearch آشنا شوید.",Mat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Aat():t==="fa"?Rat():Tat()}),Dat=()=>"nanochat",Lat=()=>"nanochat",Oat=()=>"nanochat",Iat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lat():t==="fa"?Oat():Dat()}),Bat=()=>"Couldn’t save your progress. Try again.",$at=()=>"无法保存进度。请重试。",Pat=()=>"ذخیرهٔ پیشرفت ممکن نشد. دوباره تلاش کنید.",Fat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$at():t==="fa"?Pat():Bat()}),Hat=()=>"This is a demo project showing how OpenResearch works. This demo uses Andrej Karpathy's",qat=()=>"这是一个展示 OpenResearch 工作方式的演示项目。本演示使用 Andrej Karpathy 的",Uat=()=>"این پروژهٔ نمایشی نحوهٔ کار OpenResearch را نشان می‌دهد. این نسخهٔ نمایشی از",Gat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qat():t==="fa"?Uat():Hat()}),Wat=()=>"Welcome to OpenResearch",Vat=()=>"欢迎使用 OpenResearch",Kat=()=>"به OpenResearch خوش آمدید",Qat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vat():t==="fa"?Kat():Wat()}),Yat=()=>"Baseline",Xat=()=>"基线",Zat=()=>"مبنا",Jat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xat():t==="fa"?Zat():Yat()}),eot=()=>"Experiment",tot=()=>"实验",not=()=>"آزمایش",Cl=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tot():t==="fa"?not():eot()}),rot=e=>`${e==null?void 0:e.count} experiments`,sot=e=>`${e==null?void 0:e.count} 个实验`,iot=e=>`${e==null?void 0:e.count} آزمایش`,aot=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?sot(e):t==="fa"?iot(e):rot(e)}),oot=()=>"1 experiment",lot=()=>"1 个实验",cot=()=>"۱ آزمایش",uot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lot():t==="fa"?cot():oot()}),dot=()=>"Running",fot=()=>"运行中",hot=()=>"در حال اجرا",_ot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fot():t==="fa"?hot():dot()}),pot=()=>"Ask in this task to create one, or switch to Entire project to see all experiments.",mot=()=>"在此任务中请求创建实验,或切换到“整个项目”查看所有实验。",got=()=>"در این وظیفه بخواهید یکی ساخته شود، یا برای دیدن همهٔ آزمایش‌ها به «کل پروژه» بروید.",vot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mot():t==="fa"?got():pot()}),bot=()=>"Ask the agent in chat to create and run your first experiment.",yot=()=>"在聊天中让智能体创建并运行你的第一个实验。",xot=()=>"در گفتگو از عامل بخواهید نخستین آزمایش شما را بسازد و اجرا کند.",wot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yot():t==="fa"?xot():bot()}),Sot=()=>"Code",kot=()=>"代码",Cot=()=>"کد",Eot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kot():t==="fa"?Cot():Sot()}),Not=()=>"Logs",zot=()=>"日志",jot=()=>"گزارش‌ها",NL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zot():t==="fa"?jot():Not()}),Tot=()=>"No experiments from the current task yet",Aot=()=>"当前任务尚无实验",Rot=()=>"وظیفهٔ فعلی هنوز آزمایشی ندارد",Mot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Aot():t==="fa"?Rot():Tot()}),Dot=()=>"No experiments yet",Lot=()=>"尚无实验",Oot=()=>"هنوز آزمایشی وجود ندارد",Iot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lot():t==="fa"?Oot():Dot()}),Bot=()=>"no runs",$ot=()=>"无运行",Pot=()=>"بدون اجرا",Fot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$ot():t==="fa"?Pot():Bot()}),Hot=()=>"Open logs",qot=()=>"打开日志",Uot=()=>"باز کردن گزارش‌ها",Got=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qot():t==="fa"?Uot():Hot()}),Wot=()=>"other tasks",Vot=()=>"其他任务",Kot=()=>"وظایف دیگر",Qot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vot():t==="fa"?Kot():Wot()}),Yot=()=>"Runs",Xot=()=>"运行",Zot=()=>"اجراها",Jot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xot():t==="fa"?Zot():Yot()}),elt=()=>"Switch to Entire project to see all experiments",tlt=()=>"切换到“整个项目”以查看所有实验",nlt=()=>"برای دیدن همهٔ آزمایش‌ها به «کل پروژه» بروید",rlt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tlt():t==="fa"?nlt():elt()}),slt=e=>`Updated to ${e==null?void 0:e.version}. Restart to use it.`,ilt=e=>`已更新到 ${e==null?void 0:e.version}。重新启动即可使用。`,alt=e=>`به ${e==null?void 0:e.version} به‌روزرسانی شد. برای استفاده دوباره راه‌اندازی کنید.`,olt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ilt(e):t==="fa"?alt(e):slt(e)}),llt=()=>"Dismiss",clt=()=>"关闭",ult=()=>"بستن",dlt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?clt():t==="fa"?ult():llt()}),flt=()=>"Restart now",hlt=()=>"立即重新启动",_lt=()=>"هم‌اکنون دوباره راه‌اندازی کن",zL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hlt():t==="fa"?_lt():flt()}),plt=e=>`Could not restart: ${e==null?void 0:e.error}`,mlt=e=>`无法重新启动:${e==null?void 0:e.error}`,glt=e=>`راه‌اندازی مجدد ممکن نشد: ${e==null?void 0:e.error}`,jL=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?mlt(e):t==="fa"?glt(e):plt(e)}),vlt=()=>"The updated OpenResearch did not come back in time. Restart it by hand.",blt=()=>"更新后的 OpenResearch 未能及时恢复。请手动重新启动。",ylt=()=>"OpenResearch به‌روزشده به‌موقع برنگشت. آن را به‌صورت دستی دوباره راه‌اندازی کنید.",xlt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?blt():t==="fa"?ylt():vlt()}),wlt=()=>"Restarting…",Slt=()=>"正在重新启动…",klt=()=>"در حال راه‌اندازی مجدد…",TL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Slt():t==="fa"?klt():wlt()}),Clt=()=>"macOS app",Elt=()=>"macOS 应用",Nlt=()=>"برنامهٔ macOS",zlt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Elt():t==="fa"?Nlt():Clt()}),jlt=()=>"Installed with cargo",Tlt=()=>"通过 cargo 安装",Alt=()=>"نصب‌شده با cargo",Rlt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tlt():t==="fa"?Alt():jlt()}),Mlt=()=>"Installed with Homebrew",Dlt=()=>"通过 Homebrew 安装",Llt=()=>"نصب‌شده با Homebrew",Olt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Dlt():t==="fa"?Llt():Mlt()}),Ilt=()=>"Installed with the orx installer",Blt=()=>"通过 orx 安装程序安装",$lt=()=>"نصب‌شده با نصب‌کنندهٔ orx",Plt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Blt():t==="fa"?$lt():Ilt()}),Flt=()=>"Managed by Nix",Hlt=()=>"由 Nix 管理",qlt=()=>"مدیریت‌شده با Nix",Ult=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hlt():t==="fa"?qlt():Flt()}),Glt=()=>"Unknown install",Wlt=()=>"未知安装方式",Vlt=()=>"روش نصب نامشخص",Klt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wlt():t==="fa"?Vlt():Glt()}),Qlt=()=>"Re-run your cargo install to update.",Ylt=()=>"重新运行 cargo 安装命令以更新。",Xlt=()=>"برای به‌روزرسانی، نصب cargo را دوباره اجرا کنید.",Zlt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ylt():t==="fa"?Xlt():Qlt()}),Jlt=()=>"Run brew upgrade to update.",ect=()=>"运行 brew upgrade 以更新。",tct=()=>"برای به‌روزرسانی brew upgrade را اجرا کنید.",nct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ect():t==="fa"?tct():Jlt()}),rct=()=>"Update it through your Nix configuration.",sct=()=>"通过 Nix 配置进行更新。",ict=()=>"از طریق پیکربندی Nix به‌روزرسانی کنید.",act=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sct():t==="fa"?ict():rct()}),oct=()=>"Active Experiments",lct=()=>"活跃实验",cct=()=>"آزمایش‌های فعال",uct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lct():t==="fa"?cct():oct()}),dct=()=>"Default compute",fct=()=>"默认计算目标",hct=()=>"محاسبات پیش‌فرض",_ct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fct():t==="fa"?hct():dct()}),pct=()=>"This worktree",mct=()=>"当前工作树",gct=()=>"این درخت کاری",vct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mct():t==="fa"?gct():pct()}),bct=()=>"Workspace",yct=()=>"工作区",xct=()=>"فضای کاری",Cx=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yct():t==="fa"?xct():bct()}),wct=e=>`Current worktree · ${e==null?void 0:e.branch}`,Sct=e=>`当前工作树 · ${e==null?void 0:e.branch}`,kct=e=>`درخت کاری کنونی · ${e==null?void 0:e.branch}`,Cct=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Sct(e):t==="fa"?kct(e):wct(e)}),Ect=e=>`Default branch · ${e==null?void 0:e.branch}`,Nct=e=>`默认分支 · ${e==null?void 0:e.branch}`,zct=e=>`شاخهٔ پیش‌فرض · ${e==null?void 0:e.branch}`,jct=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Nct(e):t==="fa"?zct(e):Ect(e)}),Tct=e=>`detached at ${e==null?void 0:e.branch}`,Act=e=>`分离于 ${e==null?void 0:e.branch}`,Rct=e=>`جدا در ${e==null?void 0:e.branch}`,Mct=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Act(e):t==="fa"?Rct(e):Tct(e)}),Dct=()=>"Listing truncated.",Lct=()=>"列表已截断。",Oct=()=>"فهرست کوتاه شده است.",Ict=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lct():t==="fa"?Oct():Dct()}),Bct=()=>"Loading…",$ct=()=>"正在加载…",Pct=()=>"در حال بارگیری…",Fct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$ct():t==="fa"?Pct():Bct()}),Hct=()=>"No changes yet.",qct=()=>"尚无更改。",Uct=()=>"هنوز تغییری وجود ندارد.",Gct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qct():t==="fa"?Uct():Hct()}),Wct=()=>"No files.",Vct=()=>"没有文件。",Kct=()=>"فایلی وجود ندارد.",Qct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vct():t==="fa"?Kct():Wct()}),Yct=()=>"Refresh failed:",Xct=()=>"刷新失败:",Zct=()=>"تازه‌سازی ناموفق بود:",Jct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xct():t==="fa"?Zct():Yct()}),Ne=e=>`⁦${e}⁩`,Do=e=>`⁨${e}⁩`,Wt=e=>new Intl.NumberFormat(j()).format(e),Ex="demo_nanochat_v1",Wc=e=>e.startsWith("demo_"),O0="chat_demo_nanochat_v1",h6="chat_demo_nanochat_figures_v1",_6="chat_demo_nanochat_literature_v1",eut={[O0]:"cpu_end_to_end",[h6]:"figures",[_6]:"literature"},w1="cpu-apple-silicon-pipeline-results.md",tut="Run the Muon matrix LR 2× probe experiment. When it finishes, compare its step-100 and step-200 val_bpb against the baseline and tell me whether doubling the matrix learning rate helps early training.";class R4 extends Error{constructor(t,r,s){super(t);Fs(this,"currentVersion");Fs(this,"exists");this.name="FileChangedError",this.currentVersion=r,this.exists=s}}function Gi(e){return(e.status==="running"||e.status==="starting")&&e.cancelRequested?"cancelling":e.status}const AL=new WeakMap;async function ci(e){if(!e.ok){const r=await e.text().catch(()=>"");let s=r;try{const i=JSON.parse(r);if(typeof i=="object"&&i!==null&&("error"in i&&typeof i.error=="string"&&(s=i.error),e.status===409&&"code"in i&&i.code==="fileChanged"&&"exists"in i&&typeof i.exists=="boolean")){const a="currentVersion"in i&&typeof i.currentVersion=="string"?i.currentVersion:null;throw new R4(s,a,i.exists)}}catch(i){if(i instanceof R4)throw i}throw new Error(s||`HTTP ${e.status}`)}const n=await e.json(),t=AL.get(e);if(t&&!Pn(t))throw new DOMException("Workspace changed","AbortError");return n}const Tt=(e,n)=>fetch(e,{signal:n}).then(t=>ci(t));async function ta(e,n){const t=za(),r=await fetch(e,n);if(!Pn(t))throw new DOMException("Workspace changed","AbortError");return AL.set(r,t),r.ok&&KV(e,t),r}const St=(e,n,t=!1)=>ta(e,{method:"POST",keepalive:t,headers:n===void 0?{}:{"content-type":"application/json"},body:n===void 0?void 0:JSON.stringify(n)}).then(r=>ci(r)),l_=(e,n)=>ta(e,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(n)}).then(t=>ci(t)),RL=(e,n)=>ta(e,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(n)}).then(t=>ci(t)),nut=e=>Tt("/api/projects",e).then(n=>n.projects),rut=e=>Tt("/api/projects/activity",e).then(n=>n.activity),sut=e=>Tt("/api/settings/ui-state",e),iut=(e,n)=>Tt(`/api/projects/${encodeURIComponent(e)}/ui-state`,n),aut=(e,n,t=!1)=>St(`/api/projects/${encodeURIComponent(e)}/ui-state`,n,t),out=(e,n=!1)=>St("/api/settings/ui-state",{workspace:e},n),lut=e=>St("/api/settings/ui-state",e),cut=(e,n)=>St("/api/onboarding/complete",{...e,...n}),uut=(e="",n)=>{const t=e?`?path=${encodeURIComponent(e)}`:"";return Tt(`/api/project-path/status${t}`,n)},dut=()=>St("/api/project-path/pick").then(e=>e.path),fut=e=>St("/api/projects",e),hut=(e,n)=>Tt(`/api/papers/search?q=${encodeURIComponent(e)}`,n).then(t=>t.papers),_ut=e=>Tt("/api/github/account",e),put=(e,n)=>Tt(`/api/github/project-repo-preview?name=${encodeURIComponent(e)}`,n),mut=(e,n,t)=>Tt(`/api/github/repo-access?owner=${encodeURIComponent(e)}&repo=${encodeURIComponent(n)}`,t),gut=(e,n)=>Tt(`/api/papers/resolve?id=${encodeURIComponent(e)}`,n).then(t=>t.paper),vut=e=>St("/api/projects/starter-prompts/prewarm",e),but=(e,n,t,r,s)=>Tt(`/api/projects/${e}/starter-prompts?${new URLSearchParams({harness:n,...t?{model:t}:{},locale:r})}`,s),yut=e=>St(`/api/projects/${e}/open`).then(n=>n.project),xut=e=>ta(`/api/projects/${e}`,{method:"DELETE"}).then(async n=>{if(!n.ok){const t=await n.json().catch(()=>null);throw new Error((t==null?void 0:t.error)??`delete failed (${n.status})`)}WV(e)}),wut=(e,n)=>Tt(`/api/projects/${e}/experiments`,n).then(t=>t.experiments),Sut=(e,n)=>Tt(`/api/projects/${e}/runs`,n).then(t=>t.runs),ML=e=>St(`/api/runs/${e}/cancel`).then(()=>{}),kut=(e,n)=>Tt(`/api/runs/${e}/log?offset=${n}`),Cut=(e,n)=>Tt(`/api/runs/${e}/diff`,n),Eut=(e,n)=>Tt(`/api/experiments/${e}/diff`,n),xu=(e,n=new URLSearchParams)=>(e.sessionId&&n.set("sessionId",e.sessionId),e.ref&&n.set("ref",e.ref),n),Nut=(e,n,t={},r)=>Tt(`/api/projects/${e}/file?${xu(t,new URLSearchParams({path:n}))}`,r),ON=(e,n,t={})=>`/api/projects/${e}/file/raw?${xu(t,new URLSearchParams({path:n}))}`,zut=(e,n)=>Tt(`/api/files/abs?path=${encodeURIComponent(e)}`,n),jut=e=>`/api/files/abs/raw?path=${encodeURIComponent(e)}`,Tut=(e,n,t,r)=>RL(`/api/projects/${e}/file`,{path:n,content:t,sessionId:r.sessionId,expectedVersion:r.expectedVersion}),Aut=(e,n,t,r={})=>l_(`/api/projects/${e}/file`,{path:n,...t,sessionId:r.sessionId}),Rut=(e,n,t={})=>St(`/api/projects/${e}/file/open`,{path:n,sessionId:t.sessionId}),Mut=e=>Tt("/api/latex/engine",e),Dut=(e,n,t={})=>St(`/api/projects/${e}/file/latex`,{path:n,sessionId:t.sessionId}),Lut=e=>Tt("/api/overleaf/settings",e),DL=e=>St("/api/overleaf/token",{token:e}),Out=()=>ta("/api/overleaf/token",{method:"DELETE"}).then(e=>ci(e)),LL=(e,n={})=>St("/api/overleaf/session",{session:e,host:n.host}),Iut=()=>fetch("/api/overleaf/session",{method:"DELETE"}).then(e=>ci(e)),But=(e={})=>St("/api/overleaf/session/import",{host:e.host}),$ut=(e,n,t={})=>St(`/api/projects/${e}/file/overleaf/live`,{path:n,sessionId:t.sessionId,retry:t.retry}),Put=(e,n,t={})=>fetch(`/api/projects/${e}/file/overleaf/live?${xu(t,new URLSearchParams({path:n}))}`,{method:"DELETE"}).then(r=>ci(r)),Fut=(e,n,t={},r)=>Tt(`/api/projects/${e}/file/overleaf?${xu(t,new URLSearchParams({path:n}))}`,r),Hut=(e,n,t)=>St(`/api/projects/${e}/file/overleaf`,{path:n,project:t.project,sessionId:t.sessionId}),qut=(e,n,t={})=>ta(`/api/projects/${e}/file/overleaf?${xu(t,new URLSearchParams({path:n}))}`,{method:"DELETE"}).then(r=>ci(r)),Uut=(e,n,t={})=>St(`/api/projects/${e}/file/overleaf/sync`,{path:n,sessionId:t.sessionId,resolve:t.resolve}),Gut=(e,n,t={},r)=>Tt(`/api/projects/${e}/file/overleaf/status?${xu(t,new URLSearchParams({path:n}))}`,r),Wut=(e,n,t={})=>`/api/projects/${e}/file/overleaf/upload?${xu(t,new URLSearchParams({path:n}))}`,Vut=(e,n={},t)=>{const r=xu(n).toString();return Tt(`/api/projects/${e}/code-tree${r?`?${r}`:""}`,t)},Kut=(e,n)=>Tt(`/api/chat/sessions/${e}/worktree`,n),eb=(e,n,t)=>`https://github.com/${e}/${n}/tree/${t.split("/").map(encodeURIComponent).join("/")}`,Qut=e=>Tt("/api/settings/hf",e),Yut=e=>St("/api/settings/hf",{token:e}),Xut=e=>Tt("/api/settings/tinker",e),Zut=e=>St("/api/settings/tinker",{key:e}),Jut=e=>Tt("/api/update",e),edt=()=>St("/api/update/apply"),tdt=()=>St("/api/update/restart"),ndt=e=>St("/api/update/auto",{enabled:e}),rdt=(e=!1)=>St("/api/update/install-cli",{force:e}),sdt=e=>Tt("/api/settings/k8s",e),idt=e=>St("/api/settings/k8s",e),adt=e=>Tt("/api/settings/modal",e),odt=(e,n)=>St("/api/settings/modal",{tokenId:e,tokenSecret:n}),ldt=e=>Tt("/api/settings/env",e).then(n=>n.vars),OL=(e,n)=>St("/api/settings/env",{key:e,value:n}).then(t=>t.vars),cdt=e=>ta(`/api/settings/env/${encodeURIComponent(e)}`,{method:"DELETE"}).then(n=>ci(n)).then(n=>n.vars),udt=e=>Tt("/api/settings/data-dir",e),ddt=e=>St("/api/settings/data-dir/validate",{path:e}),fdt=e=>St("/api/settings/data-dir/move",{path:e}),hdt=e=>Tt("/api/settings/ssh",e).then(n=>n.hosts),_dt=e=>Tt("/api/settings/ssh/config",e),pdt=(e,n)=>RL("/api/settings/ssh/config",{content:e,previousContent:n}),mdt=(e,n)=>Tt(`/api/settings/ssh/master?host=${encodeURIComponent(e)}`,n),gdt=e=>Tt("/_orx/runtime",e),vdt=e=>Tt("/api/remote/sessions",e).then(n=>n.sessions),bdt=(e,n)=>St("/api/remote/sessions",{host:e,uiPreferences:n}),ydt=e=>St("/_orx/install",e),xdt=()=>St("/_orx/reconnect"),IL=()=>St("/_orx/disconnect"),wdt=()=>St("/_orx/start-host"),BL=()=>Tt("/_orx/stop-host"),$L=e=>St("/_orx/stop-host",{expectedInstanceId:e.instanceId,expectedPreview:{activeTurnCount:e.activeTurnCount,queuedMessageCount:e.queuedMessageCount,pendingPermissionCount:e.pendingPermissionCount,activeRunCount:e.activeRunCount,attachmentCount:e.attachmentCount}}),Sdt=e=>Tt("/api/settings/slurm",e),kdt=e=>St("/api/settings/slurm",e),Cdt=e=>Tt("/api/settings/ray",e),Edt=e=>St("/api/settings/ray",e),Ndt=e=>St("/api/settings/ray/preflight",{address:e??null}),zdt=(e,n)=>Tt(`/api/settings/compute${e?`?projectId=${encodeURIComponent(e)}`:""}`,n),jdt=e=>St("/api/settings/compute/default",e),Tdt=e=>Tt("/api/settings/local",e),Adt=e=>Tt("/api/settings/openresearch",e),Rdt=(e,n)=>Tt(`/api/projects/${e}/files`,n),Mdt=(e,n)=>ta(`/api/projects/${e}/files?path=${encodeURIComponent(n)}`,{method:"DELETE"}).then(t=>ci(t)),Ddt=(e,n,t)=>l_(`/api/projects/${e}/files`,{path:n,...t}),Ph=(e,n)=>`/api/projects/${e}/files/file?path=${encodeURIComponent(n)}`,PL=512e3,Ldt=(e,n)=>{const t=new Uint8Array(e);if(t.includes(0))return{content:"",binary:!0,truncated:n};try{return{content:new TextDecoder("utf-8",{fatal:!0}).decode(t,{stream:n}),binary:!1,truncated:n}}catch{return{content:"",binary:!0,truncated:n}}},Odt=(e,n,t)=>fetch(Ph(e,n),{signal:t,headers:{Range:`bytes=0-${PL-1}`}}).then(r=>{var i;if(r.status===404)return null;if(r.status===416&&r.headers.get("content-range")==="bytes */0")return{content:"",binary:!1,truncated:!1};if(!r.ok)throw new Error(`HTTP ${r.status}`);const s=Number((i=r.headers.get("content-range"))==null?void 0:i.split("/").pop());return r.arrayBuffer().then(a=>Ldt(a,Number.isFinite(s)&&s>a.byteLength))}),Idt=e=>e==="image"||e==="audio"||e==="video"||e==="pdf"||e==="text"||e==="unknown"||e==="download",Bdt=(e,n,t)=>fetch(Ph(e,n),{signal:t,method:"HEAD"}).then(r=>{if(r.status===404)return null;if(!r.ok)throw new Error(`HTTP ${r.status}`);const s=r.headers.get("x-openresearch-presentation");return{size:Number(r.headers.get("content-length"))||0,presentation:Idt(s)?s:"download"}}),$dt=e=>Tt("/api/settings/profile",e),Pdt=e=>Tt("/api/settings/lit-sources",e),Fdt=e=>St("/api/settings/lit-sources",e),Hdt=e=>Tt("/api/settings/projects",e),FL=(e,n)=>St("/api/settings/projects",{githubForNewProjects:e,...n===void 0?{}:{githubDefaultPromptSeen:n}}),qdt=(e,n)=>Tt(`/api/projects/${e}/git`,n),Udt=e=>St(`/api/projects/${e}/git/init`),Gdt=e=>St(`/api/projects/${e}/github`),Wdt=e=>St(`/api/projects/${e}/github/disable`),Vdt=e=>Tt("/api/settings/telemetry",e),Kdt=e=>St("/api/settings/telemetry",{enabled:e}),sd=e=>{St("/api/telemetry/event",e).catch(()=>{})};function I0(e){var s;if(!e.id.startsWith("orx-local-"))return e.displayName??D4(e.id);const n=(s=e.displayName)==null?void 0:s.split(" · ").slice(1).join(" · ").replace(/ \(local\)$/,""),t=n==="OpenAI-compatible server"||n==="Custom endpoint"||n==="Custom Endpoint"?t6():n,r=D4(e.id.replace(/-(?:FP|BF)\d+$/i,""));return t?`${r} · ${t}`:r}const nv="default";function tb(e,n){var a,o,l;const t=e==null?void 0:e.models.find(u=>u.id===n),r=(t==null?void 0:t.reasoningLevels)??((a=e==null?void 0:e.options)==null?void 0:a.reasoningLevels)??[],s=t==null?void 0:t.defaultReasoningLevel,i=s&&r.some(u=>u.id===s)?s:r.some(u=>u.id===nv)?nv:((o=e==null?void 0:e.options)==null?void 0:o.defaultReasoningLevel)??((l=r[0])==null?void 0:l.id)??null;return{choices:r,defaultId:i}}const M4="default";function HL(e,n){var r;if((e==null?void 0:e.id)!=="codex")return[];const t=(r=e.models.find(s=>s.id===n))==null?void 0:r.serviceTiers;return t!=null&&t.length?[{id:M4,label:eBe(),description:YIe()},...t]:[]}function rv(e,n,t){var i;if(!e)return t??null;if(e.id!=="codex"||((i=e.models.find(a=>a.id===n))==null?void 0:i.serviceTiers)===void 0)return null;const s=HL(e,n);return s.length===0?M4:t!=null&&s.some(a=>a.id===t)?t:M4}function qL(e,n,t){if(!e)return t;const{choices:r,defaultId:s}=tb(e,n);return r.length===0?nv:t&&r.some(i=>i.id===t)?t:s}const UL=(e=!1,n=!1,t)=>{const r=new URLSearchParams;e&&r.set("refresh","1"),n&&r.set("retry","1");const s=r.size>0?`?${r.toString()}`:"";return Tt(`/api/harnesses${s}`,t).then(i=>i.harnesses)},Qdt=(e,n)=>Tt(`/api/skills${n?`?harness=${encodeURIComponent(n)}`:""}`,e),Ydt=(e,n,t,r)=>Tt(`/api/skills/${encodeURIComponent(e)}${`?${new URLSearchParams({...n?{project:n}:{},...r?{harness:r}:{}})}`}`,t).then(s=>s.content),Xdt=e=>Tt("/api/latex-templates",e).then(n=>n.templates),Zdt=e=>St("/api/latex-templates",e).then(n=>n.template),Jdt=e=>ta(`/api/latex-templates?name=${encodeURIComponent(e)}`,{method:"DELETE"}).then(n=>ci(n)),eft=e=>Tt("/api/user-skills",e),tft=e=>St("/api/user-skills",e).then(n=>n.skill),nft=e=>ta(`/api/user-skills?name=${encodeURIComponent(e)}`,{method:"DELETE"}).then(n=>ci(n));function D4(e){const n=(e.split("/").pop()??e).replace(/^~/,"").replace(/^claude-/,""),t=[],r=[];for(const s of n.split("-"))/^\d+(\.\d+)?$/.test(s)?r.push(s):(r.length&&t.push(r.splice(0).join(".")),t.push(s==="gpt"?"GPT":s.charAt(0).toUpperCase()+s.slice(1)));return r.length&&t.push(r.join(".")),t.join(" ")}const rft=(e,n)=>Tt(`/api/chat/sessions?projectId=${encodeURIComponent(e)}`,n).then(t=>t.sessions),sft=(e,n,t={})=>St("/api/chat/sessions",{projectId:e,harness:n,...t}).then(r=>r.session),ift=e=>ta(`/api/chat/sessions/${e}`,{method:"DELETE"}).then(n=>ci(n).then(t=>(Zv(e),t))),aft=(e,n)=>l_(`/api/chat/sessions/${e}`,{archived:n}).then(t=>t.session),oft=(e,n)=>l_(`/api/chat/sessions/${e}`,{title:n}).then(t=>t.session),lft=(e,n)=>l_(`/api/chat/sessions/${e}`,{planMode:n}).then(t=>t.session),cft=(e,n)=>l_(`/api/chat/sessions/${e}`,{permissionMode:n}).then(t=>t.session),uft=(e,n)=>Tt(`/api/chat/sessions/${e}/messages`,n).then(t=>({messages:t.messages,queued:t.queued??[],activeLeafId:t.activeLeafId??null})),dft=(e,n)=>ta(`/api/chat/sessions/${e}/queue/${encodeURIComponent(n)}`,{method:"DELETE"}).then(t=>ci(t)),fft=(e,n)=>St(`/api/chat/sessions/${e}/queue/${encodeURIComponent(n)}`),hft=e=>`/api/chat/attachments/${encodeURIComponent(e)}`,IN=(e,n,t={},r,s,i,a)=>St(`/api/chat/sessions/${e}/message`,{text:n,clientTurnId:i,model:t.model,serviceTier:t.serviceTier,permissionMode:t.permissionMode,planMode:t.planMode,reasoningLevel:t.reasoningLevel,images:r,annotations:s,mode:a}),_ft=(e,n)=>St(`/api/chat/sessions/${e}/shell`,{command:n}),pft=(e,n,t,r={})=>St(`/api/chat/sessions/${e}/turns/${n}/recover`,{action:t,...r}),mft=(e,n,t)=>St(`/api/chat/sessions/${e}/fork`,{messageId:n,text:t}),gft=(e,n)=>St(`/api/chat/sessions/${e}/branch`,{leafId:n}),vft=e=>St(`/api/chat/sessions/${e}/interrupt`),bft=(e,n)=>St(`/api/chat/sessions/${e}/respond`,n);function Io(e){const n=Math.max(0,Math.floor((Date.now()-e)/1e3)),t=new Intl.RelativeTimeFormat(j(),{numeric:"always",style:"narrow"});if(n<60)return t.format(-n,"second");const r=Math.floor(n/60);if(r<60)return t.format(-r,"minute");const s=Math.floor(r/60);return s<24?t.format(-s,"hour"):t.format(-Math.floor(s/24),"day")}function np(e){const n=Math.max(0,Math.floor(e/1e3));if(n<60)return t1e({value:Wt(n)});const t=Math.floor(n/60);if(t<60)return Xge({value:Wt(t)});const r=Math.floor(t/60);return r<24?Vge({hours:Wt(r),minutes:Wt(t%60)}):qge({days:Wt(Math.floor(r/24)),hours:Wt(r%24)})}function Ml(e){const n=["B","KB","MB","GB","TB"];let t=e,r=0;for(;t>=1024&&rTt("/api/local-models",e),wft=e=>St("/api/local-models/discover",e),Sft=e=>St("/api/local-models",e),kft=e=>St(`/api/local-models/${encodeURIComponent(e)}/check`,{}),Cft=e=>ta(`/api/local-models/${encodeURIComponent(e)}`,{method:"DELETE"}).then(n=>ci(n)),BN=()=>({queryKey:Nt("getHfSettings"),queryFn:({signal:e})=>Qut(e),staleTime:3e5}),$N=()=>({queryKey:Nt("getTinkerSettings"),queryFn:({signal:e})=>Xut(e),staleTime:3e5}),PN=()=>({queryKey:Nt("getK8sSettings"),queryFn:({signal:e})=>sdt(e),staleTime:3e4}),FN=()=>({queryKey:Nt("getModalSettings"),queryFn:({signal:e})=>adt(e),staleTime:3e5}),Eft=()=>({queryKey:Nt("getSlurmSettings"),queryFn:({signal:e})=>Sdt(e),staleTime:3e5}),Nft=()=>({queryKey:Nt("getRaySettings"),queryFn:({signal:e})=>Cdt(e),staleTime:3e5}),GL=e=>({queryKey:Nt("getComputeSettings",e??null),queryFn:({signal:n})=>zdt(e,n),staleTime:3e4}),zft=()=>({queryKey:Nt("getLocalMachine"),queryFn:({signal:e})=>Tdt(e),staleTime:3e5}),jft=()=>({queryKey:Nt("getOpenResearchSettings"),queryFn:({signal:e})=>Adt(e),staleTime:3e4}),Tft=()=>({queryKey:Nt("getEnvVars"),queryFn:({signal:e})=>ldt(e),staleTime:3e5}),Aft=()=>({queryKey:Nt("getDataDir"),queryFn:({signal:e})=>udt(e),staleTime:3e5}),WL=()=>({queryKey:Nt("getSshHosts"),queryFn:({signal:e})=>hdt(e),staleTime:3e5}),Rft=()=>({queryKey:Nt("getSshConfig"),queryFn:({signal:e})=>_dt(e),staleTime:3e5}),HN=e=>({queryKey:Nt("getSshMasterStatus",e),queryFn:({signal:n})=>mdt(e,n),staleTime:5e3}),Mft=()=>({queryKey:["gateway","runtime"],queryFn:({signal:e})=>gdt(e),staleTime:2e3}),Dft=()=>({queryKey:Nt("listRemoteSessions"),queryFn:({signal:e})=>vdt(e),staleTime:3e4}),sv=()=>({queryKey:Nt("getUpdateStatus"),queryFn:({signal:e,client:n,queryKey:t})=>a_(n,t,()=>Jut(e)),staleTime:3e4}),Lft=()=>({queryKey:Nt("getProfile"),queryFn:({signal:e})=>$dt(e),staleTime:3e5}),Oft=()=>({queryKey:Nt("getLitSources"),queryFn:({signal:e})=>Pdt(e),staleTime:3e5}),m6=()=>({queryKey:Nt("getProjectDefaults"),queryFn:({signal:e})=>Hdt(e),staleTime:3e5}),Ift=e=>({queryKey:Nt("getProjectGitStatus",e),queryFn:({signal:n})=>qdt(e,n),staleTime:3e4}),Bft=()=>({queryKey:Nt("getTelemetry"),queryFn:({signal:e})=>Vdt(e),staleTime:3e5}),fu=()=>({queryKey:Nt("getHarnesses"),queryFn:({signal:e})=>UL(!1,!1,e),staleTime:3e5}),$ft=e=>({queryKey:Nt("getSkills",e??null),queryFn:({signal:n})=>Qdt(n,e),select:n=>n.skills,refetchInterval:n=>{var t;return(t=n.state.data)!=null&&t.importing?2e3:3e4},staleTime:3e5}),Pft=(e,n,t)=>({queryKey:Nt("getSkillContent",e,n??null,t??null),queryFn:({signal:r})=>Ydt(e,n,r,t),staleTime:3e5}),Fft=()=>({queryKey:Nt("listLatexTemplates"),queryFn:({signal:e})=>Xdt(e),refetchInterval:3e4,staleTime:3e5}),Hft=()=>({queryKey:Nt("listUserSkills"),queryFn:({signal:e})=>eft(e),select:e=>e.skills,refetchInterval:e=>{var n;return(n=e.state.data)!=null&&n.importing?2e3:3e4},staleTime:3e5});async function nb(e=!1,n=!1){const t=fu();if(!e&&!n)return nt.fetchQuery(t);await nt.cancelQueries(t);const r=await UL(e,n);return Pn(t.queryKey)&&nt.setQueryData(t.queryKey,r),r}const qft=()=>({queryKey:Nt("getLocalModels"),queryFn:({signal:e})=>xft(e),staleTime:3e4}),Ea=e=>({queryKey:Nt("listChatSessions",e),queryFn:({signal:n,client:t,queryKey:r})=>a_(t,r,async()=>{const s=await rft(e,n),i=t.getQueryData(r);return s.filter(a=>!uu.has(a.id)).map(a=>{var o;return{...a,contextUsage:a.contextUsage??((o=i==null?void 0:i.find(l=>l.id===a.id))==null?void 0:o.contextUsage)}})},Vp),staleTime:3e4}),Bl=e=>({queryKey:Nt("getChatMessages",e),queryFn:async({signal:n,client:t,queryKey:r})=>{var _;const s=t.getQueryData(r),i=await a_(t,r,()=>uft(e,n),(d,p,m)=>{if(!p)return d;const x=new Set([...m].filter(S=>S.startsWith("message:")).map(S=>S.slice(8)));return{messages:Vp(d.messages,p.messages,x,!1),queued:m.has("queued")?p.queued:d.queued,activeLeafId:m.has("branch")||x.size?p.activeLeafId:d.activeLeafId}});n.throwIfAborted();const a=t.getQueryData(r),l=s!==void 0&&i.messages.some(d=>d.role==="user"&&!(s!=null&&s.messages.some(p=>p.id===d.id)))?[]:(a==null?void 0:a.messages.filter(d=>d.id.startsWith("local-")))??[],u=l.some(d=>d.id===(a==null?void 0:a.activeLeafId));return{...i,messages:[...i.messages,...l.filter(d=>!i.messages.some(p=>p.id===d.id))],activeLeafId:a&&(u||!((_=a.activeLeafId)!=null&&_.startsWith("local-"))&&a.activeLeafId!==(s==null?void 0:s.activeLeafId))?a.activeLeafId:i.activeLeafId}},staleTime:1/0,refetchOnMount:"always",refetchOnWindowFocus:"always"}),Cd="local-",VL="bash";function qN(e,n){const t=e.findIndex(r=>r.id===n.id);if(t>=0){const r=e.slice();return r[t]=n,r}return n.role!=="user"?[...e,n]:[...e.filter(r=>!r.id.startsWith(Cd)),n]}function Uft(e,n){switch(n.type){case"upsertMessage":{const t=e.messagesBySession[n.sessionId]??[],r=t.some(o=>o.id===n.message.id),s=e.activeLeafBySession[n.sessionId]??null,i=n.message.role==="user"&&s!==null&&s.startsWith(Cd),a=n.message.parentId!=null&&n.message.parentId===s;return{...e,messagesBySession:{...e.messagesBySession,[n.sessionId]:qN(t,n.message)},activeLeafBySession:r&&!i&&!a?e.activeLeafBySession:{...e.activeLeafBySession,[n.sessionId]:n.message.id}}}case"localError":{const t=e.messagesBySession[n.sessionId]??[],r={id:`${Cd}senderr-${Date.now()}`,role:"assistant",parts:[{id:"p0",type:"tool",tool:"error",state:{status:"error",error:n.text}}],createdAt:Date.now(),parentId:e.activeLeafBySession[n.sessionId]??null};return{...e,messagesBySession:{...e.messagesBySession,[n.sessionId]:[...t,r]},activeLeafBySession:{...e.activeLeafBySession,[n.sessionId]:r.id}}}case"localShell":{const t=e.messagesBySession[n.sessionId]??[],r=t.find(i=>i.id===n.id),s={id:n.id,role:"user",parts:[{id:"p0",type:"tool",tool:VL,state:{status:n.error===void 0?"running":"error",input:{command:n.command},error:n.error}}],createdAt:(r==null?void 0:r.createdAt)??Date.now(),parentId:r?r.parentId:e.activeLeafBySession[n.sessionId]??null};return{...e,messagesBySession:{...e.messagesBySession,[n.sessionId]:r?qN(t,s):[...t,s]},activeLeafBySession:r?e.activeLeafBySession:{...e.activeLeafBySession,[n.sessionId]:s.id}}}case"activeLeaf":return{...e,activeLeafBySession:{...e.activeLeafBySession,[n.sessionId]:n.leafId}};case"optimisticUser":{const t=e.messagesBySession[n.sessionId]??[],r=n.text?[{id:"p0",type:"text",text:n.text}]:[];n.attachments.forEach((i,a)=>r.push({id:`img${a}`,type:"image",text:i.url,name:i.name})),n.annotations.forEach((i,a)=>r.push({id:`annotation${a}`,type:"annotation",text:i.text}));const s={id:`${Cd}${Date.now()}`,role:"user",parts:r,createdAt:Date.now(),parentId:e.activeLeafBySession[n.sessionId]??null};return{...e,messagesBySession:{...e.messagesBySession,[n.sessionId]:[...t,s]},activeLeafBySession:{...e.activeLeafBySession,[n.sessionId]:s.id}}}case"setQueued":return{...e,queuedBySession:{...e.queuedBySession,[n.sessionId]:n.items}}}}let KL=0;function QL(e){return(e.query.queryKey[2]==="listChatSessions"||e.query.queryKey[2]==="getChatMessages")&&(e.type==="removed"||e.type==="updated"&&e.action.type==="success")}nt.getQueryCache().subscribe(e=>{QL(e)&&KL++});const Gft=e=>nt.getQueryCache().subscribe(n=>{QL(n)&&e()}),Wft=()=>KL;function Vft(e,n){const t=nt.getQueryData(Ea(e).queryKey)??[],r=new Set(t.filter(a=>a.busy).map(a=>a.id)),s={messagesBySession:{},queuedBySession:{},activeLeafBySession:{},busySessions:r},i=new Set(r);n&&i.add(n);for(const a of i){const o=nt.getQueryData(Bl(a).queryKey);o&&(s.messagesBySession[a]=o.messages,s.queuedBySession[a]=o.queued,s.activeLeafBySession[a]=o.activeLeafId)}return s}function YL(e,n,t=!1){if(n.type==="busy"){Ga(nt,Ea(e).queryKey,n.sessionId),nt.setQueryData(Ea(e).queryKey,l=>l==null?void 0:l.map(u=>u.id===n.sessionId?{...u,busy:n.busy}:u));return}const r=Bl(n.sessionId);if(uu.has(n.sessionId))return;Ga(nt,r.queryKey,n.type==="upsertMessage"?`message:${n.message.id}`:n.type==="setQueued"?"queued":n.type==="activeLeaf"?"branch":"local");const s=nt.getQueryData(r.queryKey);if(t&&!s)return;const i={messagesBySession:s?{[n.sessionId]:s.messages}:{},queuedBySession:s?{[n.sessionId]:s.queued}:{},activeLeafBySession:s?{[n.sessionId]:s.activeLeafId}:{},busySessions:new Set},a=Uft(i,n),o={messages:a.messagesBySession[n.sessionId]??[],queued:a.queuedBySession[n.sessionId]??[],activeLeafId:a.activeLeafBySession[n.sessionId]??null};nt.setQueryData(r.queryKey,o)}function Kft(e,n){const t=!!n&&!uu.has(n??""),r=ct({...Bl(n??""),enabled:t,subscribed:t}),s=R.useSyncExternalStore(Gft,Wft),i=R.useMemo(()=>Vft(e,n),[e,n,s]),a=za()[1],o=R.useCallback(l=>{Pn(["workspace",a])&&YL(e,l)},[e,a]);return[i,o,r]}const S1=new Map;function Qft(e,n){let t=S1.get(e);return t||(t=new Set,S1.set(e,t)),t.add(n),()=>{t.delete(n),t.size===0&&S1.delete(e)}}function Yft(e){var n;(n=S1.get(e.runId))==null||n.forEach(t=>t(e))}const L4=new Set;function iv(e){return L4.add(e),()=>{L4.delete(e)}}function vl(e){L4.forEach(n=>n(e))}const O4=new Set;function Xft(e){return O4.add(e),()=>{O4.delete(e)}}function bl(){O4.forEach(e=>e())}const I4=new Set;function Zft(e){return I4.add(e),()=>{I4.delete(e)}}function UN(e){I4.forEach(n=>n(e))}const B4=new Set;function XL(e){return B4.add(e),()=>{B4.delete(e)}}function Nx(e){B4.forEach(n=>n(e))}const $4=new Set;function Jft(e){return $4.add(e),()=>{$4.delete(e)}}function GN(e){$4.forEach(n=>n(e))}const P4=new Set;function eht(e){return P4.add(e),()=>{P4.delete(e)}}function tht(e){P4.forEach(n=>n(e))}let F4=!0;const H4=new Set;function nht(e){return H4.add(e),()=>{H4.delete(e)}}function WN(){return F4}function VN(e){e!==F4&&(F4=e,H4.forEach(n=>n()))}const rht=8e3,sht=3e3;function iht(e){const n=R.useRef(e);n.current=e,R.useEffect(()=>{let t=null,r=!1,s,i,a=!1;const o=()=>{t==null||t.close();const l=new EventSource("/api/events");t=l,l.onerror=()=>{r||(a=!0,s??(s=window.setTimeout(()=>VN(!1),rht)),l.readyState===EventSource.CLOSED&&i===void 0&&(i=window.setTimeout(()=>{i=void 0,o()},sht)))},l.onopen=()=>{var _,d;r||(window.clearTimeout(s),s=void 0,VN(!0),a&&(vl({type:"reconnected"}),bl(),UN({harness:"*",authState:"unknown"}),(d=(_=n.current).onReconnect)==null||d.call(_)),a=!0)};const u=_=>{try{return JSON.parse(_.data)}catch{return null}};l.addEventListener("resync.required",()=>{var _,d;vl({type:"reconnected"}),bl(),(d=(_=n.current).onReconnect)==null||d.call(_)}),l.addEventListener("run.updated",_=>{const d=u(_);d!=null&&d.run&&(bl(),n.current.onRun(d.run))}),l.addEventListener("experiment.updated",_=>{var p,m;const d=u(_);d!=null&&d.experiment&&(bl(),(m=(p=n.current).onExperiment)==null||m.call(p,d.experiment))}),l.addEventListener("project.updated",_=>{var p,m;const d=u(_);d!=null&&d.project&&(bl(),(m=(p=n.current).onProject)==null||m.call(p,d.project))}),l.addEventListener("files.updated",_=>{var p,m;const d=u(_);d!=null&&d.projectId&&((m=(p=n.current).onArtifacts)==null||m.call(p,d.projectId))}),l.addEventListener("run.log",_=>{const d=u(_);d!=null&&d.runId&&Yft(d)}),l.addEventListener("chat.session",_=>{const d=u(_);d!=null&&d.session&&(bl(),vl({type:"session",session:d.session}))}),l.addEventListener("chat.session.deleted",_=>{const d=u(_);d!=null&&d.sessionId&&(bl(),vl({type:"sessionDeleted",sessionId:d.sessionId}))}),l.addEventListener("chat.message",_=>{const d=u(_);d!=null&&d.message&&(bl(),vl({type:"message",sessionId:d.sessionId,message:d.message}))}),l.addEventListener("chat.busy",_=>{const d=u(_);d!=null&&d.sessionId&&(bl(),vl({type:"busy",sessionId:d.sessionId,busy:d.busy}))}),l.addEventListener("chat.usage",_=>{const d=u(_);d!=null&&d.sessionId&&d.usage&&vl({type:"usage",sessionId:d.sessionId,usage:d.usage})}),l.addEventListener("chat.queued",_=>{const d=u(_);d!=null&&d.sessionId&&vl({type:"queued",sessionId:d.sessionId,items:d.items??[]})}),l.addEventListener("chat.branch",_=>{const d=u(_);d!=null&&d.sessionId&&vl({type:"branch",sessionId:d.sessionId,activeLeafId:d.activeLeafId??null})}),l.addEventListener("harness.auth",_=>{const d=u(_);d!=null&&d.harness&&d.authState&&UN(d)}),l.addEventListener("datadir.move.progress",_=>{const d=u(_);d&&Nx({type:"progress",...d})}),l.addEventListener("datadir.move.done",_=>{const d=u(_);d&&Nx({type:"done",path:d.path,oldPathLeft:d.oldPathLeft})}),l.addEventListener("datadir.move.error",_=>{const d=u(_);d&&Nx({type:"error",error:d.error})}),l.addEventListener("update.status",_=>{const d=u(_);d&&tht(d)}),l.addEventListener("overleaf.live",_=>{const d=u(_);d!=null&&d.key&&d.status&&GN({type:"live",key:d.key,status:d.status})}),l.addEventListener("overleaf.pulled",_=>{const d=u(_);d!=null&&d.key&&Array.isArray(d.paths)&&GN({type:"pulled",key:d.key,paths:d.paths})})};return o(),()=>{r=!0,window.clearTimeout(s),window.clearTimeout(i),t==null||t.close()}},[])}const av=new Set;function aht(e){const n=R.useRef(e);n.current=e,R.useEffect(()=>{const t={onRun:r=>n.current.onRun(r),onReconnect:()=>{var r,s;return(s=(r=n.current).onReconnect)==null?void 0:s.call(r)}};return av.add(t),()=>{av.delete(t)}},[])}const KN={onRun:e=>av.forEach(n=>n.onRun(e)),onReconnect:()=>av.forEach(e=>{var n;return(n=e.onReconnect)==null?void 0:n.call(e)})},rp=()=>({queryKey:Nt("listProjects"),queryFn:({signal:e,client:n,queryKey:t})=>a_(n,t,()=>nut(e),Vp),staleTime:3e4}),oht=()=>({queryKey:Nt("listProjectActivity"),queryFn:({signal:e})=>rut(e),staleTime:3e4}),Xp=()=>({queryKey:Nt("getUiState"),queryFn:({signal:e})=>sut(e),staleTime:3e5}),g6=e=>({queryKey:Nt("getProjectUiState",e),queryFn:({signal:n})=>iut(e,n),staleTime:3e5}),B0=(e="")=>({queryKey:Nt("getProjectPathStatus",e),queryFn:({signal:n})=>uut(e,n),staleTime:3e4}),ZL=e=>({queryKey:Nt("searchPapers",e),queryFn:({signal:n})=>hut(e,n),staleTime:3e5}),lht=()=>({queryKey:Nt("githubAccount"),queryFn:({signal:e})=>_ut(e),staleTime:3e5}),cht=e=>({queryKey:Nt("githubProjectRepoPreview",e),queryFn:({signal:n})=>put(e,n),staleTime:3e4}),QN=(e,n)=>({queryKey:Nt("repoAccess",e,n),queryFn:({signal:t})=>mut(e,n,t),staleTime:3e4}),q4=e=>({queryKey:Nt("resolvePaper",e),queryFn:({signal:n})=>gut(e,n),staleTime:36e5}),uht=(e,n,t,r)=>({queryKey:Nt("getProjectStarterPrompts",e,n,t,r),queryFn:({signal:s})=>but(e,n,t,r,s),staleTime:3e5,refetchOnWindowFocus:!1,retryOnMount:!1}),U4=e=>({queryKey:Nt("listExperiments",e),queryFn:({signal:n,client:t,queryKey:r})=>a_(t,r,()=>wut(e,n),Vp),staleTime:3e4}),su=e=>({queryKey:Nt("listRuns",e),queryFn:({signal:n,client:t,queryKey:r})=>a_(t,r,()=>Sut(e,n),Vp),staleTime:3e4});function Tg(e,n){if(!e)return;const t=e.find(r=>r.id===n.id);return t&&t.updatedAt>n.updatedAt?e:t?e.map(r=>r.id===n.id?n:r):[...e,n]}function YN(){const e=za();return iht({onRun(n){var r;if(!Pn(e))return;const t=(r=nt.getQueryData(su(n.projectId).queryKey))==null?void 0:r.find(s=>s.id===n.id);Ga(nt,su(n.projectId).queryKey,n.id),nt.setQueryData(su(n.projectId).queryKey,s=>Tg(s,n)),(t==null?void 0:t.commitSha)!==n.commitSha&&(xa(["getRunDiff"],e,s=>s.queryKey[3]===n.id),xa(["getExperimentDiff"],e,s=>s.queryKey[3]===n.experimentId)),KN.onRun(n)},onExperiment(n){Pn(e)&&(Ga(nt,U4(n.projectId).queryKey,n.id),nt.setQueryData(U4(n.projectId).queryKey,t=>Tg(t,n)),xa(["getProjectStarterPrompts"],e,t=>t.queryKey[3]===n.projectId),xa(["getExperimentDiff"],e,t=>t.queryKey[3]===n.id),xa(["getRunDiff"],e,t=>{var r;return((r=nt.getQueryData(su(n.projectId).queryKey))==null?void 0:r.some(s=>s.experimentId===n.id&&s.id===t.queryKey[3]))??!1}))},onProject(n){Pn(e)&&(Ga(nt,rp().queryKey,n.id),nt.setQueryData(rp().queryKey,t=>Tg(t,n)))},onArtifacts(n){Pn(e)&&(xa(Q5,e,t=>t.queryKey[3]===n),xa(["resolvedFile"],e,t=>t.queryKey[3]===n&&t.queryKey[5]==="artifacts"))},onReconnect(){Pn(e)&&(xa(UV,e),KN.onReconnect())}}),R.useEffect(()=>{let n;const t=Xft(()=>{n??(n=setTimeout(()=>{n=void 0,xa(["listProjectActivity"],e)},100))}),r=XL(o=>{o.type==="done"&&xa(["getDataDir"],e)}),s=iv(o=>{Pn(e)&&(o.type==="session"?Ga(nt,Ea(o.session.projectId).queryKey,o.session.id):(o.type==="busy"||o.type==="usage")&&Ga(nt,[...e,"listChatSessions"],o.sessionId),(o.type==="message"||o.type==="queued"||o.type==="branch")&&YL("",o.type==="message"?{type:"upsertMessage",sessionId:o.sessionId,message:o.message}:o.type==="queued"?{type:"setQueued",sessionId:o.sessionId,items:o.items}:{type:"activeLeaf",sessionId:o.sessionId,leafId:o.activeLeafId},!0),o.type==="session"&&!uu.has(o.session.id)?nt.setQueryData(Ea(o.session.projectId).queryKey,l=>{if(!l)return;const u=l.find(_=>_.id===o.session.id);return u?Tg(l,{...o.session,contextUsage:o.session.contextUsage??u.contextUsage}):[o.session,...l]}):o.type==="sessionDeleted"?Zv(o.sessionId):(o.type==="busy"||o.type==="usage")&&nt.setQueriesData({queryKey:[...e,"listChatSessions"]},l=>l==null?void 0:l.map(u=>u.id!==o.sessionId?u:o.type==="busy"?{...u,busy:o.busy}:{...u,contextUsage:o.usage})))}),i=Zft(()=>{Pn(e)&&nb(!0).catch(()=>{})}),a=eht(o=>{Pn(e)&&(Ga(nt,sv().queryKey),nt.setQueryData(sv().queryKey,o))});return()=>{clearTimeout(n),t(),r(),s(),i(),a()}},[e[1]]),null}const G4=new Set;function JL(e){if(e!==j()){lD(e,{reload:!1}),document.documentElement.lang=e;for(const n of G4)n()}}function dht(e){return G4.add(e),()=>G4.delete(e)}function Qd(){return R.useSyncExternalStore(dht,j,j)}const eO="orx:theme";function fht(){try{const e=localStorage.getItem(eO);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}let Fh=fht();const W4=new Set;function hht(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v6(){document.documentElement.dataset.theme=hht(Fh)}function tO(e){Fh=e;try{localStorage.setItem(eO,e)}catch{}v6();for(const n of W4)n()}function _ht(){return Fh}window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{Fh==="system"&&v6()});v6();function pht(e){return W4.add(e),()=>W4.delete(e)}function nO(){return[R.useSyncExternalStore(pht,()=>Fh,()=>Fh),tO]}const mht=(e,n)=>{const t=new Array(e.length+n.length);for(let r=0;r({classGroupId:e,validator:n}),rO=(e=new Map,n=null,t)=>({nextPart:e,validators:n,classGroupId:t}),ov="-",XN=[],vht="arbitrary..",bht=e=>{const n=xht(e),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return yht(a);const o=a.split(ov),l=o[0]===""&&o.length>1?1:0;return sO(o,l,n)},getConflictingClassGroupIds:(a,o)=>{if(o){const l=r[a],u=t[a];return l?u?mht(u,l):l:u||XN}return t[a]||XN}}},sO=(e,n,t)=>{if(e.length-n===0)return t.classGroupId;const s=e[n],i=t.nextPart.get(s);if(i){const u=sO(e,n+1,i);if(u)return u}const a=t.validators;if(a===null)return;const o=n===0?e.join(ov):e.slice(n).join(ov),l=a.length;for(let u=0;ue.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const n=e.slice(1,-1),t=n.indexOf(":"),r=n.slice(0,t);return r?vht+r:void 0})(),xht=e=>{const{theme:n,classGroups:t}=e;return wht(t,n)},wht=(e,n)=>{const t=rO();for(const r in e){const s=e[r];b6(s,t,r,n)}return t},b6=(e,n,t,r)=>{const s=e.length;for(let i=0;i{if(typeof e=="string"){kht(e,n,t);return}if(typeof e=="function"){Cht(e,n,t,r);return}Eht(e,n,t,r)},kht=(e,n,t)=>{const r=e===""?n:iO(n,e);r.classGroupId=t},Cht=(e,n,t,r)=>{if(Nht(e)){b6(e(r),n,t,r);return}n.validators===null&&(n.validators=[]),n.validators.push(ght(t,e))},Eht=(e,n,t,r)=>{const s=Object.entries(e),i=s.length;for(let a=0;a{let t=e;const r=n.split(ov),s=r.length;for(let i=0;i"isThemeGetter"in e&&e.isThemeGetter===!0,zht=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,t=Object.create(null),r=Object.create(null);const s=(i,a)=>{t[i]=a,n++,n>e&&(n=0,r=t,t=Object.create(null))};return{get(i){let a=t[i];if(a!==void 0)return a;if((a=r[i])!==void 0)return s(i,a),a},set(i,a){i in t?t[i]=a:s(i,a)}}},V4="!",ZN=":",jht=[],JN=(e,n,t,r,s)=>({modifiers:e,hasImportantModifier:n,baseClassName:t,maybePostfixModifierPosition:r,isExternal:s}),Tht=e=>{const{prefix:n,experimentalParseClassName:t}=e;let r=s=>{const i=[];let a=0,o=0,l=0,u;const _=s.length;for(let S=0;S<_;S++){const v=s[S];if(a===0&&o===0){if(v===ZN){i.push(s.slice(l,S)),l=S+1;continue}if(v==="/"){u=S;continue}}v==="["?a++:v==="]"?a--:v==="("?o++:v===")"&&o--}const d=i.length===0?s:s.slice(l);let p=d,m=!1;d.endsWith(V4)?(p=d.slice(0,-1),m=!0):d.startsWith(V4)&&(p=d.slice(1),m=!0);const x=u&&u>l?u-l:void 0;return JN(i,m,p,x)};if(n){const s=n+ZN,i=r;r=a=>a.startsWith(s)?i(a.slice(s.length)):JN(jht,!1,a,void 0,!0)}if(t){const s=r;r=i=>t({className:i,parseClassName:s})}return r},Aht=e=>{const n=new Map;return e.orderSensitiveModifiers.forEach((t,r)=>{n.set(t,1e6+r)}),t=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},Rht=e=>({cache:zht(e.cacheSize),parseClassName:Tht(e),sortModifiers:Aht(e),postfixLookupClassGroupIds:Mht(e),...bht(e)}),Mht=e=>{const n=Object.create(null),t=e.postfixLookupClassGroups;if(t)for(let r=0;r{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i,postfixLookupClassGroupIds:a}=n,o=[],l=e.trim().split(Dht);let u="";for(let _=l.length-1;_>=0;_-=1){const d=l[_],{isExternal:p,modifiers:m,hasImportantModifier:x,baseClassName:S,maybePostfixModifierPosition:v}=t(d);if(p){u=d+(u.length>0?" "+u:u);continue}let b=!!v,w;if(b){const T=S.substring(0,v);w=r(T);const z=w&&a[w]?r(S):void 0;z&&z!==w&&(w=z,b=!1)}else w=r(S);if(!w){if(!b){u=d+(u.length>0?" "+u:u);continue}if(w=r(S),!w){u=d+(u.length>0?" "+u:u);continue}b=!1}const y=m.length===0?"":m.length===1?m[0]:i(m).join(":"),C=x?y+V4:y,E=C+w;if(o.indexOf(E)>-1)continue;o.push(E);const N=s(w,b);for(let T=0;T0?" "+u:u)}return u},Oht=(...e)=>{let n=0,t,r,s="";for(;n{if(typeof e=="string")return e;let n,t="";for(let r=0;r{let t,r,s,i;const a=l=>{const u=n.reduce((_,d)=>d(_),e());return t=Rht(u),r=t.cache.get,s=t.cache.set,i=o,o(l)},o=l=>{const u=r(l);if(u)return u;const _=Lht(l,t);return s(l,_),_};return i=a,(...l)=>i(Oht(...l))},Iht=[],fs=e=>{const n=t=>t[e]||Iht;return n.isThemeGetter=!0,n},oO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,lO=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Bht=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,$ht=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Pht=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Fht=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Hht=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qht=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ic=e=>Bht.test(e),dn=e=>!!e&&!Number.isNaN(Number(e)),vo=e=>!!e&&Number.isInteger(Number(e)),zx=e=>e.endsWith("%")&&dn(e.slice(0,-1)),yl=e=>$ht.test(e),cO=()=>!0,Uht=e=>Pht.test(e)&&!Fht.test(e),y6=()=>!1,Ght=e=>Hht.test(e),Wht=e=>qht.test(e),Vht=e=>!dt(e)&&!_t(e),Kht=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Qht=e=>wu(e,fO,y6),dt=e=>oO.test(e),Ku=e=>wu(e,hO,Uht),tz=e=>wu(e,r_t,dn),Yht=e=>wu(e,pO,cO),Xht=e=>wu(e,_O,y6),nz=e=>wu(e,uO,y6),Zht=e=>wu(e,dO,Wht),Ag=e=>wu(e,mO,Ght),_t=e=>lO.test(e),c0=e=>Yd(e,hO),Jht=e=>Yd(e,_O),rz=e=>Yd(e,uO),e_t=e=>Yd(e,fO),t_t=e=>Yd(e,dO),Rg=e=>Yd(e,mO,!0),n_t=e=>Yd(e,pO,!0),wu=(e,n,t)=>{const r=oO.exec(e);return r?r[1]?n(r[1]):t(r[2]):!1},Yd=(e,n,t=!1)=>{const r=lO.exec(e);return r?r[1]?n(r[1]):t:!1},uO=e=>e==="position"||e==="percentage",dO=e=>e==="image"||e==="url",fO=e=>e==="length"||e==="size"||e==="bg-size",hO=e=>e==="length",r_t=e=>e==="number",_O=e=>e==="family-name",pO=e=>e==="number"||e==="weight",mO=e=>e==="shadow",sz=()=>{const e=fs("color"),n=fs("font"),t=fs("text"),r=fs("font-weight"),s=fs("tracking"),i=fs("leading"),a=fs("breakpoint"),o=fs("container"),l=fs("spacing"),u=fs("radius"),_=fs("shadow"),d=fs("inset-shadow"),p=fs("text-shadow"),m=fs("drop-shadow"),x=fs("blur"),S=fs("perspective"),v=fs("aspect"),b=fs("ease"),w=fs("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...C(),_t,dt],N=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],z=()=>[_t,dt,l],M=()=>[Ic,"full","auto",...z()],O=()=>[vo,"none","subgrid",_t,dt],B=()=>["auto",{span:["full",vo,_t,dt]},vo,_t,dt],$=()=>[vo,"auto",_t,dt],U=()=>["auto","min","max","fr",_t,dt],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Y=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...z()],X=()=>[Ic,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],te=()=>[Ic,"screen","full","dvw","lvw","svw","min","max","fit",...z()],I=()=>[Ic,"screen","full","lh","dvh","lvh","svh","min","max","fit",...z()],L=()=>[e,_t,dt],F=()=>[...C(),rz,nz,{position:[_t,dt]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",e_t,Qht,{size:[_t,dt]}],ee=()=>[zx,c0,Ku],ce=()=>["","none","full",u,_t,dt],oe=()=>["",dn,c0,Ku],ne=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[dn,zx,rz,nz],ae=()=>["","none",x,_t,dt],ue=()=>["none",dn,_t,dt],pe=()=>["none",dn,_t,dt],Se=()=>[dn,_t,dt],ye=()=>[Ic,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[yl],breakpoint:[yl],color:[cO],container:[yl],"drop-shadow":[yl],ease:["in","out","in-out"],font:[Vht],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[yl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[yl],shadow:[yl],spacing:["px",dn],text:[yl],"text-shadow":[yl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ic,dt,_t,v]}],container:["container"],"container-type":[{"@container":["","normal","size",_t,dt]}],"container-named":[Kht],columns:[{columns:[dn,dt,_t,o]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{"inset-s":M(),start:M()}],end:[{"inset-e":M(),end:M()}],"inset-bs":[{"inset-bs":M()}],"inset-be":[{"inset-be":M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[vo,"auto",_t,dt]}],basis:[{basis:[Ic,"full","auto",o,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[dn,Ic,"auto","initial","none",dt]}],grow:[{grow:["",dn,_t,dt]}],shrink:[{shrink:["",dn,_t,dt]}],order:[{order:[vo,"first","last","none",_t,dt]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...Y(),"normal"]}],"justify-self":[{"justify-self":["auto",...Y()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...Y(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Y(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...Y(),"baseline"]}],"place-self":[{"place-self":["auto",...Y()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pbs:[{pbs:z()}],pbe:[{pbe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mbs:[{mbs:V()}],mbe:[{mbe:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],"inline-size":[{inline:["auto",...te()]}],"min-inline-size":[{"min-inline":["auto",...te()]}],"max-inline-size":[{"max-inline":["none",...te()]}],"block-size":[{block:["auto",...I()]}],"min-block-size":[{"min-block":["auto",...I()]}],"max-block-size":[{"max-block":["none",...I()]}],w:[{w:[o,"screen",...X()]}],"min-w":[{"min-w":[o,"screen","none",...X()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",t,c0,Ku]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,n_t,Yht]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",zx,dt]}],"font-family":[{font:[Jht,Xht,n]}],"font-features":[{"font-features":[dt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,_t,dt]}],"line-clamp":[{"line-clamp":[dn,"none",_t,tz]}],leading:[{leading:[i,...z()]}],"list-image":[{"list-image":["none",_t,dt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",_t,dt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ne(),"wavy"]}],"text-decoration-thickness":[{decoration:[dn,"from-font","auto",_t,Ku]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[dn,"auto",_t,dt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"tab-size":[{tab:[vo,_t,dt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_t,dt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",_t,dt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},vo,_t,dt],radial:["",_t,dt],conic:[vo,_t,dt]},t_t,Zht]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ne(),"hidden","none"]}],"divide-style":[{divide:[...ne(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...ne(),"none","hidden"]}],"outline-offset":[{"outline-offset":[dn,_t,dt]}],"outline-w":[{outline:["",dn,c0,Ku]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",_,Rg,Ag]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",d,Rg,Ag]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[dn,Ku]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",p,Rg,Ag]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[dn,_t,dt]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[dn]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[_t,dt]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[dn]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",_t,dt]}],filter:[{filter:["","none",_t,dt]}],blur:[{blur:ae()}],brightness:[{brightness:[dn,_t,dt]}],contrast:[{contrast:[dn,_t,dt]}],"drop-shadow":[{"drop-shadow":["","none",m,Rg,Ag]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",dn,_t,dt]}],"hue-rotate":[{"hue-rotate":[dn,_t,dt]}],invert:[{invert:["",dn,_t,dt]}],saturate:[{saturate:[dn,_t,dt]}],sepia:[{sepia:["",dn,_t,dt]}],"backdrop-filter":[{"backdrop-filter":["","none",_t,dt]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[dn,_t,dt]}],"backdrop-contrast":[{"backdrop-contrast":[dn,_t,dt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",dn,_t,dt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[dn,_t,dt]}],"backdrop-invert":[{"backdrop-invert":["",dn,_t,dt]}],"backdrop-opacity":[{"backdrop-opacity":[dn,_t,dt]}],"backdrop-saturate":[{"backdrop-saturate":[dn,_t,dt]}],"backdrop-sepia":[{"backdrop-sepia":["",dn,_t,dt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",_t,dt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[dn,"initial",_t,dt]}],ease:[{ease:["linear","initial",b,_t,dt]}],delay:[{delay:[dn,_t,dt]}],animate:[{animate:["none",w,_t,dt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,_t,dt]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":["scale-3d"],skew:[{skew:Se()}],"skew-x":[{"skew-x":Se()}],"skew-y":[{"skew-y":Se()}],transform:[{transform:[_t,dt,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":["translate-none"],zoom:[{zoom:[vo,_t,dt]}],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",_t,dt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":L()}],"scrollbar-track-color":[{"scrollbar-track":L()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mbs":[{"scroll-mbs":z()}],"scroll-mbe":[{"scroll-mbe":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pbs":[{"scroll-pbs":z()}],"scroll-pbe":[{"scroll-pbe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",_t,dt]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[dn,c0,Ku,tz]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},s_t=(e,{cacheSize:n,prefix:t,experimentalParseClassName:r,extend:s={},override:i={}})=>(Yf(e,"cacheSize",n),Yf(e,"prefix",t),Yf(e,"experimentalParseClassName",r),Mg(e.theme,i.theme),Mg(e.classGroups,i.classGroups),Mg(e.conflictingClassGroups,i.conflictingClassGroups),Mg(e.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),Yf(e,"postfixLookupClassGroups",i.postfixLookupClassGroups),Yf(e,"orderSensitiveModifiers",i.orderSensitiveModifiers),Dg(e.theme,s.theme),Dg(e.classGroups,s.classGroups),Dg(e.conflictingClassGroups,s.conflictingClassGroups),Dg(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),K4(e,s,"postfixLookupClassGroups"),K4(e,s,"orderSensitiveModifiers"),e),Yf=(e,n,t)=>{t!==void 0&&(e[n]=t)},Mg=(e,n)=>{if(n)for(const t in n)Yf(e,t,n[t])},Dg=(e,n)=>{if(n)for(const t in n)K4(e,n,t)},K4=(e,n,t)=>{const r=n[t];r!==void 0&&(e[t]=e[t]?e[t].concat(r):r)},i_t=(e,...n)=>typeof e=="function"?ez(sz,e,...n):ez(()=>s_t(sz(),e),...n),a_t=i_t({extend:{theme:{text:["menu"]}}});function Ds(...e){return a_t(...e)}const o_t={default:"border-transparent bg-surface text-subtext",success:"border-accent-green bg-accent-green-subtle text-accent-green",error:"border-accent-red bg-accent-red-subtle text-accent-red",warning:"border-accent-amber bg-accent-amber-subtle text-accent-amber"};function Ft({variant:e="default",size:n="default",className:t,...r}){return f.jsx("span",{className:Ds("badge inline-flex items-center rounded-full border py-px font-sans",n==="small"?"px-1.5 text-xs font-normal":"px-2 text-sm font-medium",o_t[e],t),...r})}const l_t=["btn inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap border font-medium","transition-[background,border-color,color] duration-120 ease-standard","focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-text focus-visible:outline-offset-2","disabled:cursor-default disabled:opacity-45"].join(" "),c_t={default:"border-border bg-background text-text [&:hover:not(:disabled)]:bg-surface [&:active:not(:disabled)]:bg-highlight",primary:"border-primary bg-primary text-background [&:hover:not(:disabled)]:border-primary-hover [&:hover:not(:disabled)]:bg-primary-hover [&:active:not(:disabled)]:border-primary-active [&:active:not(:disabled)]:bg-primary-active",ghost:"border-transparent bg-transparent text-text [&:hover:not(:disabled)]:bg-surface [&:active:not(:disabled)]:bg-highlight [&.active]:bg-surface [&.active]:text-muted",danger:"border-border bg-background text-accent-red [&:hover:not(:disabled)]:bg-danger-hover [&:active:not(:disabled)]:bg-danger-active",warning:"border-accent-amber bg-background text-accent-amber [&:hover:not(:disabled)]:bg-accent-amber-subtle [&:active:not(:disabled)]:bg-highlight"},u_t={default:"h-8 rounded-md px-3.5 text-sm",small:"h-7 rounded-sm px-2.5 text-sm",large:"h-14 rounded-lg px-7 text-xl"};function gO(e,n,t,r){return Ds(l_t,c_t[e],u_t[n],t&&"active",r)}function Oe({active:e=!1,variant:n="default",size:t="default",className:r,...s}){return f.jsx("button",{className:gO(n,t,e,r),...s})}function Hh({active:e=!1,variant:n="default",size:t="default",className:r,...s}){return f.jsx("a",{className:gO(n,t,e,r),...s})}const d_t=["icon-btn relative inline-flex shrink-0 items-center justify-center","transition-[background,color] duration-120 ease-standard","focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-text focus-visible:outline-offset-2","disabled:cursor-default disabled:opacity-45"].join(" "),f_t={default:"text-subtext [&:hover:not(:disabled)]:bg-surface [&:hover:not(:disabled)]:text-text [&:active:not(:disabled)]:bg-highlight [&.active]:bg-surface [&.active]:text-primary",primary:"bg-primary text-background [&:hover:not(:disabled)]:bg-primary-hover [&:active:not(:disabled)]:bg-primary-active",stop:"bg-surface text-text [&:hover:not(:disabled)]:bg-stop-hover [&:active:not(:disabled)]:bg-highlight"},h_t={default:"h-8 w-8 rounded-md",small:"h-7 w-7 rounded-sm"};function vO(e,n,t,r){return Ds(d_t,f_t[e],h_t[n],t&&"active",r)}const Qt=R.forwardRef(function({active:n=!1,size:t="default",variant:r="default",className:s,...i},a){return f.jsx("button",{ref:a,className:vO(r,t,n,s),...i})});function rb({active:e=!1,size:n="default",variant:t="default",className:r,...s}){return f.jsx("a",{className:vO(t,n,e,r),...s})}const __t={default:"h-8 rounded-md border border-border bg-background px-2.5 py-1.5 focus:border-text",inline:"h-8 rounded-none border-x-0 border-t-0 border-b border-transparent bg-transparent px-0 py-0 focus:border-text"};function rs({variant:e="default",className:n,...t}){return f.jsx("input",{className:Ds("w-full font-sans text-sm font-normal text-text outline-none placeholder:text-muted disabled:cursor-default disabled:opacity-45",__t[e],n),...t})}function sr({active:e=!1,danger:n=!1,size:t="default",className:r,...s}){return f.jsx("button",{className:Ds("model-item flex w-full items-center justify-between gap-2 rounded-sm px-2 text-start transition-[background,color] duration-120 ease-standard hover:bg-surface focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-text focus-visible:outline-offset-2 disabled:cursor-default disabled:opacity-45 [&_.model-id]:block [&_.model-id]:text-xs [&_.model-id]:text-muted",t==="compact"?"min-h-6 py-0.5 text-menu":"min-h-8 py-1.5 text-sm",e&&"bg-surface",n&&"text-accent-red hover:text-accent-red",r),...s})}function Lt({className:e,...n}){return f.jsx("span",{className:Ds("spinner h-[13px] w-[13px] shrink-0 animate-[spin_0.8s_linear_infinite] rounded-full border-2 border-border border-t-primary",e),...n})}function ss({className:e,...n}){return f.jsx("div",{className:Ds("flex items-center gap-2 px-0 py-1 text-sm text-subtext",e),...n})}const p_t={success:"text-accent-green",danger:"text-accent-red",info:"text-accent-teal",warning:"text-accent-amber",caution:"text-accent-orange",accent:"text-accent-purple",neutral:"text-muted"};function sb({tone:e="neutral",live:n=!1,className:t,children:r,...s}){return f.jsxs("span",{className:Ds("status-badge inline-flex items-center gap-1.5 whitespace-nowrap text-sm font-medium text-text",t),...s,children:[f.jsx("span",{className:Ds("h-[7px] w-[7px] shrink-0 rounded-full bg-current",p_t[e],n&&"animate-[or-pulse_1.2s_ease-in-out_infinite]")}),r]})}const m_t=["relative h-5.5 w-9.5 flex-none rounded-full border border-border bg-surface","transition-[background,border-color] duration-120 ease-standard","[&_span]:absolute [&_span]:start-[3px] [&_span]:top-[3px] [&_span]:h-3.5 [&_span]:w-3.5","[&_span]:rounded-full [&_span]:bg-muted [&_span]:transition-[translate,background] [&_span]:duration-120 [&_span]:ease-standard","hover:border-border-strong","disabled:cursor-default disabled:opacity-45 focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-text focus-visible:outline-offset-2"].join(" ");function bO(e,n){return Ds(m_t,e&&"border-primary bg-primary [&_span]:translate-x-4 [&_span]:bg-background",n)}function x6({checked:e=!1,className:n,children:t,...r}){return f.jsx("button",{role:"switch","aria-checked":e,className:bO(e,n),...r,children:t??f.jsx("span",{})})}function g_t({checked:e=!1,className:n,...t}){return f.jsx("span",{className:bO(e,n),...t,children:f.jsx("span",{})})}var no=CM();const v_t=Gp(no);function b_t(e){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css",n.appendChild(t),t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}const y_t=e=>{switch(e){case"success":return S_t;case"info":return C_t;case"warning":return k_t;case"error":return E_t;default:return null}},x_t=Array(12).fill(0),w_t=({visible:e,className:n})=>Je.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":e},Je.createElement("div",{className:"sonner-spinner"},x_t.map((t,r)=>Je.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),S_t=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Je.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),k_t=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Je.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),C_t=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Je.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),E_t=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Je.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),N_t=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},Je.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Je.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),z_t=()=>{const[e,n]=Je.useState(document.hidden);return Je.useEffect(()=>{const t=()=>{n(document.hidden)};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[]),e};let j_t=1;const T_t=100,iz=e=>{var n;return typeof(e==null?void 0:e.id)=="number"||(e==null||(n=e.id)==null?void 0:n.length)>0?e.id:j_t++};class A_t{constructor(){this.subscribe=n=>(this.subscribers.push(n),this.getActiveToasts().forEach(t=>n(t)),()=>{const t=this.subscribers.indexOf(n);this.subscribers.splice(t,1)}),this.publish=n=>{this.subscribers.forEach(t=>t(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n],this.trimHistory()},this.trimHistory=()=>{let n=this.toasts.length-T_t;n<=0||(this.toasts=this.toasts.filter(t=>n>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),n--,!1):!0))},this.create=n=>{const{message:t,...r}=n,s=iz(n),i=this.pendingDismissals.get(s);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(s),this.dismissedToasts.delete(s));const a=this.dismissedToasts.has(s),o=n.dismissible===void 0?!0:n.dismissible;return a&&(this.dismissedToasts.delete(s),this.toasts=this.toasts.filter(u=>u.id!==s)),(a?void 0:this.toasts.find(u=>u.id===s))?this.toasts=this.toasts.map(u=>u.id===s?(this.publish({...u,...n,id:s,title:t}),{...u,...n,id:s,dismissible:o,title:t}):u):this.addToast({title:t,...r,dismissible:o,id:s}),s},this.dismiss=n=>{if(n==null)return this.getActiveToasts().forEach(r=>{this.dismissedToasts.add(r.id),this.subscribers.forEach(s=>s({id:r.id,dismiss:!0}))}),n;this.dismissedToasts.add(n);const t=this.pendingDismissals.get(n);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(n,requestAnimationFrame(()=>{this.pendingDismissals.delete(n),this.subscribers.forEach(r=>r({id:n,dismiss:!0}))})),n},this.message=(n,t)=>this.create({...t,message:n,type:void 0}),this.error=(n,t)=>this.create({...t,message:n,type:"error"}),this.success=(n,t)=>this.create({...t,type:"success",message:n}),this.info=(n,t)=>this.create({...t,type:"info",message:n}),this.warning=(n,t)=>this.create({...t,type:"warning",message:n}),this.loading=(n,t)=>this.create({...t,type:"loading",message:n}),this.promise=(n,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:n,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));const s=Promise.resolve(n instanceof Function?n():n);let i=r!==void 0,a;const o=s.then(async u=>{if(a=["resolve",u],Je.isValidElement(u))i=!1,this.create({id:r,type:"default",message:u});else if(M_t(u)&&!u.ok){i=!1;const d=typeof t.error=="function"?await t.error(`HTTP error! status: ${u.status}`):t.error,p=typeof t.description=="function"?await t.description(`HTTP error! status: ${u.status}`):t.description,x=typeof d=="object"&&!Je.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:p,...x})}else if(u instanceof Error){i=!1;const d=typeof t.error=="function"?await t.error(u):t.error,p=typeof t.description=="function"?await t.description(u):t.description,x=typeof d=="object"&&!Je.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:p,...x})}else if(t.success!==void 0){i=!1;const d=typeof t.success=="function"?await t.success(u):t.success,p=typeof t.description=="function"?await t.description(u):t.description,x=typeof d=="object"&&!Je.isValidElement(d)?d:{message:d};this.create({id:r,type:"success",description:p,...x})}}).catch(async u=>{if(a=["reject",u],t.error!==void 0){i=!1;const _=typeof t.error=="function"?await t.error(u):t.error,d=typeof t.description=="function"?await t.description(u):t.description,m=typeof _=="object"&&!Je.isValidElement(_)?_:{message:_};this.create({id:r,type:"error",description:d,...m})}}).finally(()=>{i&&(this.dismiss(r),r=void 0),t.finally==null||t.finally.call(t)}),l=()=>new Promise((u,_)=>o.then(()=>a[0]==="reject"?_(a[1]):u(a[1])).catch(_));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(n,t)=>{const r=iz(t);return this.create({...t,jsx:n(r),id:r,type:void 0}),r},this.getActiveToasts=()=>this.toasts.filter(n=>!this.dismissedToasts.has(n.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}}const wi=new A_t,R_t=(e,n)=>wi.message(e,n),M_t=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",D_t=R_t,L_t=()=>wi.toasts,O_t=()=>wi.getActiveToasts(),I_t=Object.assign(D_t,{success:wi.success,info:wi.info,warning:wi.warning,error:wi.error,custom:wi.custom,message:wi.message,promise:wi.promise,dismiss:wi.dismiss,loading:wi.loading},{getHistory:L_t,getToasts:O_t});b_t("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Lg(e){return e.label!==void 0}const B_t=3,$_t="24px",P_t="16px",az=4e3,F_t=356,H_t=14,q_t=45,U_t=200;function bo(...e){return e.filter(Boolean).join(" ")}function G_t(e){const[n,t]=e.split("-"),r=[];return n&&r.push(n),t&&r.push(t),r}const W_t=e=>{var n,t,r,s,i,a,o,l,u;const{invert:_,toast:d,unstyled:p,interacting:m,setHeights:x,visibleToasts:S,heights:v,index:b,toasts:w,expanded:y,removeToast:C,defaultRichColors:E,closeButton:N,style:T,cancelButtonStyle:z,actionButtonStyle:M,className:O="",descriptionClassName:B="",duration:$,position:U,gap:H,expandByDefault:Y,classNames:V,icons:X,closeButtonAriaLabel:te="Close toast"}=e,[I,L]=Je.useState(null),[F,q]=Je.useState(null),[G,ee]=Je.useState(!1),[ce,oe]=Je.useState(!1),[ne,Q]=Je.useState(!1),[le,ae]=Je.useState(!1),[ue,pe]=Je.useState(!1),[Se,ye]=Je.useState(0),[qe,Ie]=Je.useState(0),ze=Je.useRef(d.duration||$||az),at=Je.useRef(null),bt=Je.useRef(null),$t=b===0,Pt=b+1<=S,zt=d.type,ot=zt??"default",ft=d.dismissible!==!1,It=d.className||"",we=d.descriptionClassName||"",Re=Je.useMemo(()=>v.findIndex(vt=>vt.toastId===d.id)||0,[v,d.id]),Ze=Je.useMemo(()=>{var vt;return(vt=d.closeButton)!=null?vt:N},[d.closeButton,N]),ht=Je.useMemo(()=>d.duration||$||az,[d.duration,$]),xt=Je.useRef(0),Vt=Je.useRef(0),Ve=Je.useRef(0),Ht=Je.useRef(null),[sn,fn]=U.split("-"),Zt=Je.useMemo(()=>v.reduce((vt,un,Cn)=>Cn>=Re?vt:vt+un.height,0),[v,Re]),Qn=z_t(),Jt=Je.useMemo(()=>{var vt;return(vt=e.swipeDirections)!=null?vt:G_t(U)},[e.swipeDirections,U]),bn=d.invert||_,or=zt==="loading";Vt.current=Je.useMemo(()=>Re*H+Zt,[Re,Zt]),Je.useEffect(()=>{ze.current=ht},[ht]),Je.useEffect(()=>{ee(!0)},[]),Je.useEffect(()=>{const vt=bt.current;if(vt){const un=vt.getBoundingClientRect().height;return Ie(un),x(Cn=>[{toastId:d.id,height:un,position:d.position},...Cn]),()=>x(Cn=>Cn.filter(en=>en.toastId!==d.id))}},[x,d.id]),Je.useLayoutEffect(()=>{if(!G)return;const vt=bt.current,un=vt.style.height;vt.style.height="auto";const Cn=vt.getBoundingClientRect().height;vt.style.height=un,Ie(Cn),x(en=>en.find(hn=>hn.toastId===d.id)?en.map(hn=>hn.toastId===d.id?{...hn,height:Cn}:hn):[{toastId:d.id,height:Cn,position:d.position},...en])},[G,d.title,d.description,x,d.id,d.jsx,d.action,d.cancel]);const lr=Je.useCallback(()=>{oe(!0),ye(Vt.current),x(vt=>vt.filter(un=>un.toastId!==d.id)),setTimeout(()=>{C(d)},U_t)},[d,C,x,Vt]);Je.useEffect(()=>{if(d.promise&&zt==="loading"||d.duration===1/0||d.type==="loading")return;let vt;return y||m||Qn?(()=>{if(Ve.current{ze.current!==1/0&&(xt.current=new Date().getTime(),vt=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),lr()},ze.current))})(),()=>clearTimeout(vt)},[y,m,d,zt,Qn,lr]),Je.useEffect(()=>{d.delete&&(lr(),d.onDismiss==null||d.onDismiss.call(d,d))},[lr,d.delete]);function br(){var vt;if(X!=null&&X.loading){var un;return Je.createElement("div",{className:bo(V==null?void 0:V.loader,d==null||(un=d.classNames)==null?void 0:un.loader,"sonner-loader"),"data-visible":zt==="loading"},X.loading)}return Je.createElement(w_t,{className:bo(V==null?void 0:V.loader,d==null||(vt=d.classNames)==null?void 0:vt.loader),visible:zt==="loading"})}const Dn=d.icon||(X==null?void 0:X[zt])||y_t(zt);var Wr,Nr;return Je.createElement("li",{tabIndex:0,ref:bt,className:bo(O,It,V==null?void 0:V.toast,d==null||(n=d.classNames)==null?void 0:n.toast,V==null?void 0:V[ot],d==null||(t=d.classNames)==null?void 0:t[ot]),"data-sonner-toast":"","data-rich-colors":(Wr=d.richColors)!=null?Wr:E,"data-styled":!(d.jsx||d.unstyled||p),"data-mounted":G,"data-promise":!!d.promise,"data-swiped":ue,"data-removed":ce,"data-visible":Pt,"data-y-position":sn,"data-x-position":fn,"data-index":b,"data-front":$t,"data-swiping":ne,"data-dismissible":ft,"data-type":zt,"data-invert":bn,"data-swipe-out":le,"data-swipe-direction":F,"data-expanded":!!(y||Y&&G),"data-testid":d.testId,style:{"--index":b,"--toasts-before":b,"--z-index":w.length-b,"--offset":`${ce?Se:Vt.current}px`,"--initial-height":Y?"auto":`${qe}px`,...T,...d.style},onDragEnd:()=>{Q(!1),L(null),Ht.current=null},onPointerDown:vt=>{vt.button!==2&&(or||!ft||(at.current=new Date,ye(Vt.current),vt.target.setPointerCapture(vt.pointerId),vt.target.tagName!=="BUTTON"&&(Q(!0),Ht.current={x:vt.clientX,y:vt.clientY})))},onPointerUp:()=>{var vt,un,Cn;if(le||!ft)return;Ht.current=null;const en=Number(((vt=bt.current)==null?void 0:vt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Jn=Number(((un=bt.current)==null?void 0:un.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),hn=new Date().getTime()-((Cn=at.current)==null?void 0:Cn.getTime()),En=I==="x"?en:Jn,ln=Math.abs(En)/hn;if((I==="x"?Jt.includes(en>0?"right":"left"):Jt.includes(Jn>0?"bottom":"top"))&&(Math.abs(En)>=q_t||ln>.11)){ye(Vt.current),d.onDismiss==null||d.onDismiss.call(d,d),q(I==="x"?en>0?"right":"left":Jn>0?"down":"up"),lr(),ae(!0);return}else{var kt,Ge;(kt=bt.current)==null||kt.style.setProperty("--swipe-amount-x","0px"),(Ge=bt.current)==null||Ge.style.setProperty("--swipe-amount-y","0px")}pe(!1),Q(!1),L(null)},onPointerMove:vt=>{var un,Cn,en;if(!Ht.current||!ft||((un=window.getSelection())==null?void 0:un.toString().length)>0)return;const hn=vt.clientY-Ht.current.y,En=vt.clientX-Ht.current.x;!I&&(Math.abs(En)>1||Math.abs(hn)>1)&&L(Math.abs(En)>Math.abs(hn)?"x":"y");let ln={x:0,y:0};const pt=kt=>1/(1.5+Math.abs(kt)/20);if(I==="y"){if(Jt.includes("top")||Jt.includes("bottom"))if(Jt.includes("top")&&hn<0||Jt.includes("bottom")&&hn>0)ln.y=hn;else{const kt=hn*pt(hn);ln.y=Math.abs(kt)0)ln.x=En;else{const kt=En*pt(En);ln.x=Math.abs(kt)0||Math.abs(ln.y)>0)&&pe(!0),(Cn=bt.current)==null||Cn.style.setProperty("--swipe-amount-x",`${ln.x}px`),(en=bt.current)==null||en.style.setProperty("--swipe-amount-y",`${ln.y}px`)}},Ze&&!d.jsx&&zt!=="loading"?Je.createElement("button",{"aria-label":te,"data-disabled":or,"data-close-button":!0,onClick:or||!ft?()=>{}:()=>{lr(),d.onDismiss==null||d.onDismiss.call(d,d)},className:bo(V==null?void 0:V.closeButton,d==null||(r=d.classNames)==null?void 0:r.closeButton)},(Nr=X==null?void 0:X.close)!=null?Nr:N_t):null,(zt||d.icon||d.promise)&&d.icon!==null&&((X==null?void 0:X[zt])!==null||d.icon)?Je.createElement("div",{"data-icon":"",className:bo(V==null?void 0:V.icon,d==null||(s=d.classNames)==null?void 0:s.icon)},zt==="loading"?d.icon||br():d.promise?br():null,zt!=="loading"?Dn:null):null,Je.createElement("div",{"data-content":"",className:bo(V==null?void 0:V.content,d==null||(i=d.classNames)==null?void 0:i.content)},Je.createElement("div",{"data-title":"",className:bo(V==null?void 0:V.title,d==null||(a=d.classNames)==null?void 0:a.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?Je.createElement("div",{"data-description":"",className:bo(B,we,V==null?void 0:V.description,d==null||(o=d.classNames)==null?void 0:o.description)},typeof d.description=="function"?d.description():d.description):null),Je.isValidElement(d.cancel)?d.cancel:d.cancel&&Lg(d.cancel)?Je.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||z,onClick:vt=>{Lg(d.cancel)&&ft&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,vt),lr())},className:bo(V==null?void 0:V.cancelButton,d==null||(l=d.classNames)==null?void 0:l.cancelButton)},d.cancel.label):null,Je.isValidElement(d.action)?d.action:d.action&&Lg(d.action)?Je.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||M,onClick:vt=>{Lg(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,vt),!vt.defaultPrevented&&lr())},className:bo(V==null?void 0:V.actionButton,d==null||(u=d.classNames)==null?void 0:u.actionButton)},d.action.label):null)};function oz(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function V_t(e,n){const t={};return[e,n].forEach((r,s)=>{const i=s===1,a=i?"--mobile-offset":"--offset",o=i?P_t:$_t;function l(u){["top","right","bottom","left"].forEach(_=>{t[`${a}-${_}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?t[`${a}-${u}`]=o:t[`${a}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):l(o)}),t}const K_t=Je.forwardRef(function(n,t){const{id:r,invert:s,position:i="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:u,offset:_,mobileOffset:d,theme:p="light",richColors:m,duration:x,style:S,visibleToasts:v=B_t,toastOptions:b,dir:w=oz(),gap:y=H_t,icons:C,customAriaLabel:E,containerAriaLabel:N="Notifications"}=n,[T,z]=Je.useState([]),M=Je.useMemo(()=>r?T.filter(ee=>ee.toasterId===r):T.filter(ee=>!ee.toasterId),[T,r]),O=Je.useMemo(()=>Array.from(new Set([i].concat(M.filter(ee=>ee.position).map(ee=>ee.position)))),[M,i]),[B,$]=Je.useState([]),[U,H]=Je.useState(!1),[Y,V]=Je.useState(!1),[X,te]=Je.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),I=Je.useRef(null),L=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),F=Je.useRef(null),q=Je.useRef(!1),G=Je.useCallback(ee=>{z(ce=>{var oe;return(oe=ce.find(ne=>ne.id===ee.id))!=null&&oe.delete||wi.dismiss(ee.id),ce.filter(({id:ne})=>ne!==ee.id)})},[]);return Je.useEffect(()=>wi.subscribe(ee=>{if(ee.dismiss){requestAnimationFrame(()=>{z(ce=>ce.map(oe=>oe.id===ee.id?{...oe,delete:!0}:oe))});return}setTimeout(()=>{v_t.flushSync(()=>{z(ce=>{const oe=ce.findIndex(ne=>ne.id===ee.id);return oe!==-1?[...ce.slice(0,oe),{...ce[oe],...ee},...ce.slice(oe+1)]:[ee,...ce]})})})}),[]),Je.useEffect(()=>{if(p!=="system"){te(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?te("dark"):te("light")),typeof window>"u")return;const ee=window.matchMedia("(prefers-color-scheme: dark)");try{ee.addEventListener("change",({matches:ce})=>{te(ce?"dark":"light")})}catch{ee.addListener(({matches:oe})=>{try{te(oe?"dark":"light")}catch(ne){console.error(ne)}})}},[p]),Je.useEffect(()=>{T.length<=1&&H(!1)},[T]),Je.useEffect(()=>{const ee=ce=>{var oe;if(a.length>0&&a.every(le=>ce[le]||ce.code===le)){var Q;H(!0),(Q=I.current)==null||Q.focus()}ce.code==="Escape"&&(document.activeElement===I.current||(oe=I.current)!=null&&oe.contains(document.activeElement))&&H(!1)};return document.addEventListener("keydown",ee),()=>document.removeEventListener("keydown",ee)},[a]),Je.useEffect(()=>{if(I.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,q.current=!1)}},[I.current]),Je.createElement("section",{ref:t,"aria-label":E??`${N} ${L}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},O.map((ee,ce)=>{var oe;const[ne,Q]=ee.split("-");return M.length?Je.createElement("ol",{key:ee,dir:w==="auto"?oz():w,tabIndex:-1,ref:I,className:u,"data-sonner-toaster":!0,"data-sonner-theme":X,"data-y-position":ne,"data-x-position":Q,style:{"--front-toast-height":`${((oe=B[0])==null?void 0:oe.height)||0}px`,"--width":`${F_t}px`,"--gap":`${y}px`,...S,...V_t(_,d)},onBlur:le=>{q.current&&!le.currentTarget.contains(le.relatedTarget)&&(q.current=!1,F.current&&(F.current.focus({preventScroll:!0}),F.current=null))},onFocus:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||q.current||(q.current=!0,F.current=le.relatedTarget)},onMouseEnter:()=>H(!0),onMouseMove:()=>H(!0),onMouseLeave:()=>{Y||H(!1)},onDragEnd:()=>H(!1),onPointerDown:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||V(!0)},onPointerUp:()=>V(!1)},M.filter(le=>!le.position&&ce===0||le.position===ee).map((le,ae)=>{var ue,pe;return Je.createElement(W_t,{key:le.id,icons:C,index:ae,toast:le,defaultRichColors:m,duration:(ue=b==null?void 0:b.duration)!=null?ue:x,className:b==null?void 0:b.className,descriptionClassName:b==null?void 0:b.descriptionClassName,invert:s,visibleToasts:v,closeButton:(pe=b==null?void 0:b.closeButton)!=null?pe:l,interacting:Y,position:ee,style:b==null?void 0:b.style,unstyled:b==null?void 0:b.unstyled,classNames:b==null?void 0:b.classNames,cancelButtonStyle:b==null?void 0:b.cancelButtonStyle,actionButtonStyle:b==null?void 0:b.actionButtonStyle,closeButtonAriaLabel:b==null?void 0:b.closeButtonAriaLabel,removeToast:G,toasts:M.filter(Se=>Se.position==le.position),heights:B.filter(Se=>Se.position==le.position),setHeights:$,expandByDefault:o,gap:y,expanded:U,swipeDirections:n.swipeDirections})})):null}))});function Q_t(e){const[n]=nO();return f.jsx(K_t,{theme:n,...e})}function Kn(e,n,t){I_t[n](e,{duration:n==="warning"||n==="error"?1/0:5e3,position:"top-center",closeButton:!0,...t})}function w6({content:e,children:n,className:t}){const r=R.useRef(null),s=R.useRef(null);function i(){const o=r.current,l=s.current;if(!o||!l)return;l.matches(":popover-open")||l.showPopover();const u=o.getBoundingClientRect(),_=l.getBoundingClientRect(),d=Math.max(8,Math.min(u.left+u.width/2-_.width/2,window.innerWidth-_.width-8));l.style.left=`${d}px`,l.style.top=`${Math.max(8,u.top-_.height-6)}px`}function a(){var o,l;(o=r.current)!=null&&o.matches(":hover, :focus")||(l=s.current)==null||l.hidePopover()}return R.useEffect(()=>{const o=()=>{var l;return(l=s.current)==null?void 0:l.hidePopover()};return window.addEventListener("scroll",o,!0),window.addEventListener("resize",o),()=>{window.removeEventListener("scroll",o,!0),window.removeEventListener("resize",o)}},[]),f.jsxs("span",{ref:r,className:Ds("group relative inline-flex cursor-help rounded-full outline-none focus-visible:outline-2 focus-visible:outline-text focus-visible:outline-offset-2",t),tabIndex:0,role:"img","aria-label":e,onMouseEnter:i,onMouseLeave:a,onFocus:i,onBlur:a,onKeyDown:o=>{var l;o.key==="Escape"&&((l=s.current)!=null&&l.matches(":popover-open"))&&(o.preventDefault(),o.stopPropagation(),s.current.hidePopover())},children:[n,f.jsx("span",{ref:s,popover:"manual",role:"tooltip",className:"pointer-events-none fixed inset-auto m-0 w-max max-w-64 whitespace-normal rounded-sm border-0 bg-text px-2 py-1.5 font-sans text-sm font-normal leading-snug text-background shadow-control-subtle",children:e})]})}const Y_t='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function ib(e,n,t="[data-initial-focus]"){const r=R.useRef(n);r.current=n,R.useEffect(()=>{const s=e.current;if(!s)return;const i=document.activeElement instanceof HTMLElement?document.activeElement:null,a=()=>[...s.querySelectorAll(Y_t)];(s.querySelector(t)??a()[0]??s).focus();const o=l=>{if(l.key==="Escape"){if(s.querySelector(":popover-open"))return;l.preventDefault(),l.stopPropagation(),r.current();return}if(l.key!=="Tab")return;const u=a(),_=u[0],d=u.at(-1);!_||!d?(l.preventDefault(),s.focus()):l.shiftKey&&document.activeElement===_?(l.preventDefault(),d.focus()):!l.shiftKey&&document.activeElement===d&&(l.preventDefault(),_.focus())};return document.addEventListener("keydown",o,!0),()=>{document.removeEventListener("keydown",o,!0),i==null||i.focus()}},[e,t])}function yO({host:e,preview:n,currentClientAttached:t,stopping:r,onClose:s,onConfirm:i}){const a=R.useRef(null),o=Math.max(0,n.attachmentCount-(t?1:0)),l=[];return n.activeTurnCount>0&&l.push(n.activeTurnCount===1?vOe():TOe({count:Wt(n.activeTurnCount)})),n.pendingPermissionCount>0&&l.push(n.pendingPermissionCount===1?nOe():MLe({count:Wt(n.pendingPermissionCount)})),o>0&&l.push(o===1?uOe():wOe({count:Wt(o)})),n.queuedMessageCount>0&&l.push(n.queuedMessageCount===1?_Oe():EOe({count:Wt(n.queuedMessageCount)})),n.activeRunCount>0&&l.push(n.activeRunCount===1?aOe():GLe({count:Wt(n.activeRunCount)})),ib(a,s),no.createPortal(f.jsx("div",{className:"fixed inset-0 z-200 flex items-center justify-center bg-modal-backdrop p-5",onClick:u=>{!r&&u.target===u.currentTarget&&s()},children:f.jsxs("div",{ref:a,className:"w-120 max-w-full rounded-xl border border-border bg-background p-6 shadow-modal",role:"dialog","aria-modal":"true","aria-labelledby":"remote-stop-dialog-title","aria-describedby":l.length>0?"remote-stop-dialog-impact":void 0,tabIndex:-1,children:[f.jsx("h2",{id:"remote-stop-dialog-title",className:"m-0 text-xl font-medium text-text",children:FLe({host:Ne(e)})}),l.length>0&&f.jsxs("div",{id:"remote-stop-dialog-impact",className:"mt-4 text-sm text-text",children:[f.jsx("p",{className:"m-0 font-medium",children:ZLe()}),f.jsx("ul",{className:"mt-2 mb-0 space-y-1 ps-5",children:l.map(u=>f.jsx("li",{children:u},u))})]}),f.jsxs("div",{className:"mt-6 flex justify-end gap-2.5",children:[f.jsx(Oe,{disabled:r,onClick:s,children:Ad()}),f.jsx(Oe,{variant:"danger",disabled:r,onClick:i,children:r?DOe():ILe()})]})]})}),document.body)}var jx={exports:{}},lz;function X_t(){return lz||(lz=1,(function(e,n){(function(t,r){e.exports=r()})(self,(()=>(()=>{var t={};return(()=>{var r=t;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(s){this._terminal=s}dispose(){}fit(){const s=this.proposeDimensions();if(!s||!this._terminal||isNaN(s.cols)||isNaN(s.rows))return;const i=this._terminal._core;this._terminal.rows===s.rows&&this._terminal.cols===s.cols||(i._renderService.clear(),this._terminal.resize(s.cols,s.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const s=this._terminal._core,i=s._renderService.dimensions;if(i.css.cell.width===0||i.css.cell.height===0)return;const a=this._terminal.options.scrollback===0?0:s.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(o.getPropertyValue("height")),u=Math.max(0,parseInt(o.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),d=l-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),p=u-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-a;return{cols:Math.max(2,Math.floor(p/i.css.cell.width)),rows:Math.max(1,Math.floor(d/i.css.cell.height))}}}})(),t})()))})(jx)),jx.exports}var Z_t=X_t(),Tx={exports:{}},cz;function J_t(){return cz||(cz=1,(function(e,n){(function(t,r){e.exports=r()})(self,(()=>(()=>{var t={6:(a,o)=>{function l(_){try{const d=new URL(_),p=d.password&&d.username?`${d.protocol}//${d.username}:${d.password}@${d.host}`:d.username?`${d.protocol}//${d.username}@${d.host}`:`${d.protocol}//${d.host}`;return _.toLocaleLowerCase().startsWith(p.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(o,"__esModule",{value:!0}),o.LinkComputer=o.WebLinkProvider=void 0,o.WebLinkProvider=class{constructor(_,d,p,m={}){this._terminal=_,this._regex=d,this._handler=p,this._options=m}provideLinks(_,d){const p=u.computeLink(_,this._regex,this._terminal,this._handler);d(this._addCallbacks(p))}_addCallbacks(_){return _.map((d=>(d.leave=this._options.leave,d.hover=(p,m)=>{if(this._options.hover){const{range:x}=d;this._options.hover(p,m,x)}},d)))}};class u{static computeLink(d,p,m,x){const S=new RegExp(p.source,(p.flags||"")+"g"),[v,b]=u._getWindowedLineStrings(d-1,m),w=v.join("");let y;const C=[];for(;y=S.exec(w);){const E=y[0];if(!l(E))continue;const[N,T]=u._mapStrIdx(m,b,0,y.index),[z,M]=u._mapStrIdx(m,N,T,E.length);if(N===-1||T===-1||z===-1||M===-1)continue;const O={start:{x:T+1,y:N+1},end:{x:M,y:z+1}};C.push({range:O,text:E,activate:x})}return C}static _getWindowedLineStrings(d,p){let m,x=d,S=d,v=0,b="";const w=[];if(m=p.buffer.active.getLine(d)){const y=m.translateToString(!0);if(m.isWrapped&&y[0]!==" "){for(v=0;(m=p.buffer.active.getLine(--x))&&v<2048&&(b=m.translateToString(!0),v+=b.length,w.push(b),m.isWrapped&&b.indexOf(" ")===-1););w.reverse()}for(w.push(y),v=0;(m=p.buffer.active.getLine(++S))&&m.isWrapped&&v<2048&&(b=m.translateToString(!0),v+=b.length,w.push(b),b.indexOf(" ")===-1););}return[w,x]}static _mapStrIdx(d,p,m,x){const S=d.buffer.active,v=S.getNullCell();let b=m;for(;x;){const w=S.getLine(p);if(!w)return[-1,-1];for(let y=b;y{var a=i;Object.defineProperty(a,"__esModule",{value:!0}),a.WebLinksAddon=void 0;const o=s(6),l=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function u(_,d){const p=window.open();if(p){try{p.opener=null}catch{}p.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}a.WebLinksAddon=class{constructor(_=u,d={}){this._handler=_,this._options=d}activate(_){this._terminal=_;const d=this._options,p=d.urlRegex||l;this._linkProvider=this._terminal.registerLinkProvider(new o.WebLinkProvider(this._terminal,p,this._handler,d))}dispose(){var _;(_=this._linkProvider)==null||_.dispose()}}})(),i})()))})(Tx)),Tx.exports}var e0t=J_t(),Ax={exports:{}},uz;function t0t(){return uz||(uz=1,(function(e,n){(function(t,r){e.exports=r()})(globalThis,(()=>(()=>{var t={4567:function(a,o,l){var u=this&&this.__decorate||function(w,y,C,E){var N,T=arguments.length,z=T<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,C):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(w,y,C,E);else for(var M=w.length-1;M>=0;M--)(N=w[M])&&(z=(T<3?N(z):T>3?N(y,C,z):N(y,C))||z);return T>3&&z&&Object.defineProperty(y,C,z),z},_=this&&this.__param||function(w,y){return function(C,E){y(C,E,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=l(9042),p=l(9924),m=l(844),x=l(4725),S=l(2585),v=l(3656);let b=o.AccessibilityManager=class extends m.Disposable{constructor(w,y,C,E){super(),this._terminal=w,this._coreBrowserService=C,this._renderService=E,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let N=0;Nthis._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new p.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` +مخزن داده به محل جدید کپی و همان‌جا فعال می‌شود. اجراها یا گفتگوهای فعال مانع انتقال خواهند شد.`,oit=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?iit(e):t==="fa"?ait(e):sit(e)}),lit=()=>"Move data here",cit=()=>"将数据移动到此处",uit=()=>"انتقال داده به اینجا",dit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?cit():t==="fa"?uit():lit()}),fit=()=>"Moving…",hit=()=>"正在移动…",_it=()=>"در حال جابه‌جایی…",pit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hit():t==="fa"?_it():fit()}),mit=()=>"Preparing…",git=()=>"正在准备…",vit=()=>"در حال آماده‌سازی…",bit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?git():t==="fa"?vit():mit()}),yit=()=>" (same disk, instant)",xit=()=>"(同一磁盘,可立即完成)",wit=()=>" (روی همان دیسک، فوری)",Sit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?xit():t==="fa"?wit():yit()}),kit=()=>"default location",Cit=()=>"默认位置",Eit=()=>"محل پیش‌فرض",Nit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Cit():t==="fa"?Eit():kit()}),zit=()=>"ORX_DATA_DIR environment variable",jit=()=>"ORX_DATA_DIR 环境变量",Tit=()=>"متغیر محیطی ORX_DATA_DIR",Ait=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?jit():t==="fa"?Tit():zit()}),Rit=()=>"your saved setting",Mit=()=>"已保存的设置",Dit=()=>"تنظیم ذخیره‌شدهٔ شما",Lit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Mit():t==="fa"?Dit():Rit()}),Oit=()=>"XDG_DATA_HOME",Iit=()=>"XDG_DATA_HOME",Bit=()=>"XDG_DATA_HOME",$it=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Iit():t==="fa"?Bit():Oit()}),Pit=()=>"Verifying…",Fit=()=>"正在验证…",Hit=()=>"در حال بررسی…",qit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Fit():t==="fa"?Hit():Pit()}),Uit=()=>"Loading…",Git=()=>"正在加载…",Wit=()=>"در حال بارگیری…",Vit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Git():t==="fa"?Wit():Uit()}),Kit=()=>"This sub-agent is no longer available.",Qit=()=>"此子智能体已不可用。",Yit=()=>"این عامل فرعی دیگر در دسترس نیست.",Xit=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Qit():t==="fa"?Yit():Kit()}),Zit=e=>`${e==null?void 0:e.label} (preview; double-click or Command/Control K, then Enter to keep open)`,Jit=e=>`${e==null?void 0:e.label}(预览;双击或按 Command/Control K 后按 Enter 以保持打开)`,eat=e=>`${e==null?void 0:e.label} (پیش‌نمایش؛ برای باز نگه‌داشتن دوبار کلیک کنید یا Command/Control K و سپس Enter را بزنید)`,tat=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Jit(e):t==="fa"?eat(e):Zit(e)}),nat=e=>`${e==null?void 0:e.label} (double-click or ⌘/Ctrl+K Enter to keep open)`,rat=e=>`${e==null?void 0:e.label}(双击或按 ⌘/Ctrl+K 后按 Enter 以保持打开)`,sat=e=>`${e==null?void 0:e.label} (برای باز نگه‌داشتن دوبار کلیک کنید یا ⌘/Ctrl+K و سپس Enter را بزنید)`,iat=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?rat(e):t==="fa"?sat(e):nat(e)}),aat=()=>"Alternatively, tell your agent to add a LaTeX template for you.",oat=()=>"或者,请你的智能体为你添加 LaTeX 模板。",lat=()=>"یا از عامل خود بخواهید یک قالب LaTeX برایتان اضافه کند.",cat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?oat():t==="fa"?lat():aat()}),uat=()=>", a repo for training a mini-GPT from scratch.",dat=()=>",一个从零训练迷你 GPT 的仓库。",fat=()=>"، اثر Andrej Karpathy، مخزنی برای آموزش یک GPT کوچک از صفر، استفاده می‌کند.",hat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?dat():t==="fa"?fat():uat()}),_at=()=>"Close",pat=()=>"关闭",mat=()=>"بستن",gat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?pat():t==="fa"?mat():_at()}),vat=()=>"Create a new project",bat=()=>"新建项目",yat=()=>"ایجاد پروژهٔ جدید",xat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?bat():t==="fa"?yat():vat()}),wat=()=>"Demo project",Sat=()=>"演示项目",kat=()=>"پروژهٔ نمایشی",Cat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Sat():t==="fa"?kat():wat()}),Eat=()=>"Explore the demo",Nat=()=>"探索演示项目",zat=()=>"دیدن پروژهٔ نمایشی",jat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Nat():t==="fa"?zat():Eat()}),Tat=()=>"Look through the agent conversations, experiments, runs, and artifacts to see how a project on OpenResearch comes together.",Aat=()=>"浏览智能体对话、实验、运行和产物,了解 OpenResearch 项目是如何形成的。",Rat=()=>"گفتگوهای عامل، آزمایش‌ها، اجراها و خروجی‌ها را ببینید تا با شکل‌گیری یک پروژه در OpenResearch آشنا شوید.",Mat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Aat():t==="fa"?Rat():Tat()}),Dat=()=>"nanochat",Lat=()=>"nanochat",Oat=()=>"nanochat",Iat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lat():t==="fa"?Oat():Dat()}),Bat=()=>"Couldn’t save your progress. Try again.",$at=()=>"无法保存进度。请重试。",Pat=()=>"ذخیرهٔ پیشرفت ممکن نشد. دوباره تلاش کنید.",Fat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$at():t==="fa"?Pat():Bat()}),Hat=()=>"This is a demo project showing how OpenResearch works. This demo uses Andrej Karpathy's",qat=()=>"这是一个展示 OpenResearch 工作方式的演示项目。本演示使用 Andrej Karpathy 的",Uat=()=>"این پروژهٔ نمایشی نحوهٔ کار OpenResearch را نشان می‌دهد. این نسخهٔ نمایشی از",Gat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qat():t==="fa"?Uat():Hat()}),Wat=()=>"Welcome to OpenResearch",Vat=()=>"欢迎使用 OpenResearch",Kat=()=>"به OpenResearch خوش آمدید",Qat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vat():t==="fa"?Kat():Wat()}),Yat=()=>"Baseline",Xat=()=>"基线",Zat=()=>"مبنا",Jat=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xat():t==="fa"?Zat():Yat()}),eot=()=>"Experiment",tot=()=>"实验",not=()=>"آزمایش",Sl=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tot():t==="fa"?not():eot()}),rot=e=>`${e==null?void 0:e.count} experiments`,sot=e=>`${e==null?void 0:e.count} 个实验`,iot=e=>`${e==null?void 0:e.count} آزمایش`,aot=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?sot(e):t==="fa"?iot(e):rot(e)}),oot=()=>"1 experiment",lot=()=>"1 个实验",cot=()=>"۱ آزمایش",uot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lot():t==="fa"?cot():oot()}),dot=()=>"Running",fot=()=>"运行中",hot=()=>"در حال اجرا",_ot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fot():t==="fa"?hot():dot()}),pot=()=>"Ask in this task to create one, or switch to Entire project to see all experiments.",mot=()=>"在此任务中请求创建实验,或切换到“整个项目”查看所有实验。",got=()=>"در این وظیفه بخواهید یکی ساخته شود، یا برای دیدن همهٔ آزمایش‌ها به «کل پروژه» بروید.",vot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mot():t==="fa"?got():pot()}),bot=()=>"Ask the agent in chat to create and run your first experiment.",yot=()=>"在聊天中让智能体创建并运行你的第一个实验。",xot=()=>"در گفتگو از عامل بخواهید نخستین آزمایش شما را بسازد و اجرا کند.",wot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yot():t==="fa"?xot():bot()}),Sot=()=>"Code",kot=()=>"代码",Cot=()=>"کد",Eot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?kot():t==="fa"?Cot():Sot()}),Not=()=>"Logs",zot=()=>"日志",jot=()=>"گزارش‌ها",NL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?zot():t==="fa"?jot():Not()}),Tot=()=>"No experiments from the current task yet",Aot=()=>"当前任务尚无实验",Rot=()=>"وظیفهٔ فعلی هنوز آزمایشی ندارد",Mot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Aot():t==="fa"?Rot():Tot()}),Dot=()=>"No experiments yet",Lot=()=>"尚无实验",Oot=()=>"هنوز آزمایشی وجود ندارد",Iot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lot():t==="fa"?Oot():Dot()}),Bot=()=>"no runs",$ot=()=>"无运行",Pot=()=>"بدون اجرا",Fot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$ot():t==="fa"?Pot():Bot()}),Hot=()=>"Open logs",qot=()=>"打开日志",Uot=()=>"باز کردن گزارش‌ها",Got=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qot():t==="fa"?Uot():Hot()}),Wot=()=>"other tasks",Vot=()=>"其他任务",Kot=()=>"وظایف دیگر",Qot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vot():t==="fa"?Kot():Wot()}),Yot=()=>"Runs",Xot=()=>"运行",Zot=()=>"اجراها",Jot=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xot():t==="fa"?Zot():Yot()}),elt=()=>"Switch to Entire project to see all experiments",tlt=()=>"切换到“整个项目”以查看所有实验",nlt=()=>"برای دیدن همهٔ آزمایش‌ها به «کل پروژه» بروید",rlt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?tlt():t==="fa"?nlt():elt()}),slt=e=>`Updated to ${e==null?void 0:e.version}. Restart to use it.`,ilt=e=>`已更新到 ${e==null?void 0:e.version}。重新启动即可使用。`,alt=e=>`به ${e==null?void 0:e.version} به‌روزرسانی شد. برای استفاده دوباره راه‌اندازی کنید.`,olt=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?ilt(e):t==="fa"?alt(e):slt(e)}),llt=()=>"Dismiss",clt=()=>"关闭",ult=()=>"بستن",dlt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?clt():t==="fa"?ult():llt()}),flt=()=>"Restart now",hlt=()=>"立即重新启动",_lt=()=>"هم‌اکنون دوباره راه‌اندازی کن",zL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?hlt():t==="fa"?_lt():flt()}),plt=e=>`Could not restart: ${e==null?void 0:e.error}`,mlt=e=>`无法重新启动:${e==null?void 0:e.error}`,glt=e=>`راه‌اندازی مجدد ممکن نشد: ${e==null?void 0:e.error}`,jL=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?mlt(e):t==="fa"?glt(e):plt(e)}),vlt=()=>"The updated OpenResearch did not come back in time. Restart it by hand.",blt=()=>"更新后的 OpenResearch 未能及时恢复。请手动重新启动。",ylt=()=>"OpenResearch به‌روزشده به‌موقع برنگشت. آن را به‌صورت دستی دوباره راه‌اندازی کنید.",xlt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?blt():t==="fa"?ylt():vlt()}),wlt=()=>"Restarting…",Slt=()=>"正在重新启动…",klt=()=>"در حال راه‌اندازی مجدد…",TL=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Slt():t==="fa"?klt():wlt()}),Clt=()=>"macOS app",Elt=()=>"macOS 应用",Nlt=()=>"برنامهٔ macOS",zlt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Elt():t==="fa"?Nlt():Clt()}),jlt=()=>"Installed with cargo",Tlt=()=>"通过 cargo 安装",Alt=()=>"نصب‌شده با cargo",Rlt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Tlt():t==="fa"?Alt():jlt()}),Mlt=()=>"Installed with Homebrew",Dlt=()=>"通过 Homebrew 安装",Llt=()=>"نصب‌شده با Homebrew",Olt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Dlt():t==="fa"?Llt():Mlt()}),Ilt=()=>"Installed with the orx installer",Blt=()=>"通过 orx 安装程序安装",$lt=()=>"نصب‌شده با نصب‌کنندهٔ orx",Plt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Blt():t==="fa"?$lt():Ilt()}),Flt=()=>"Managed by Nix",Hlt=()=>"由 Nix 管理",qlt=()=>"مدیریت‌شده با Nix",Ult=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Hlt():t==="fa"?qlt():Flt()}),Glt=()=>"Unknown install",Wlt=()=>"未知安装方式",Vlt=()=>"روش نصب نامشخص",Klt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Wlt():t==="fa"?Vlt():Glt()}),Qlt=()=>"Re-run your cargo install to update.",Ylt=()=>"重新运行 cargo 安装命令以更新。",Xlt=()=>"برای به‌روزرسانی، نصب cargo را دوباره اجرا کنید.",Zlt=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Ylt():t==="fa"?Xlt():Qlt()}),Jlt=()=>"Run brew upgrade to update.",ect=()=>"运行 brew upgrade 以更新。",tct=()=>"برای به‌روزرسانی brew upgrade را اجرا کنید.",nct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?ect():t==="fa"?tct():Jlt()}),rct=()=>"Update it through your Nix configuration.",sct=()=>"通过 Nix 配置进行更新。",ict=()=>"از طریق پیکربندی Nix به‌روزرسانی کنید.",act=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?sct():t==="fa"?ict():rct()}),oct=()=>"Active Experiments",lct=()=>"活跃实验",cct=()=>"آزمایش‌های فعال",uct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?lct():t==="fa"?cct():oct()}),dct=()=>"Default compute",fct=()=>"默认计算目标",hct=()=>"محاسبات پیش‌فرض",_ct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?fct():t==="fa"?hct():dct()}),pct=()=>"This worktree",mct=()=>"当前工作树",gct=()=>"این درخت کاری",vct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?mct():t==="fa"?gct():pct()}),bct=()=>"Workspace",yct=()=>"工作区",xct=()=>"فضای کاری",Cx=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?yct():t==="fa"?xct():bct()}),wct=e=>`Current worktree · ${e==null?void 0:e.branch}`,Sct=e=>`当前工作树 · ${e==null?void 0:e.branch}`,kct=e=>`درخت کاری کنونی · ${e==null?void 0:e.branch}`,Cct=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Sct(e):t==="fa"?kct(e):wct(e)}),Ect=e=>`Default branch · ${e==null?void 0:e.branch}`,Nct=e=>`默认分支 · ${e==null?void 0:e.branch}`,zct=e=>`شاخهٔ پیش‌فرض · ${e==null?void 0:e.branch}`,jct=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Nct(e):t==="fa"?zct(e):Ect(e)}),Tct=e=>`detached at ${e==null?void 0:e.branch}`,Act=e=>`分离于 ${e==null?void 0:e.branch}`,Rct=e=>`جدا در ${e==null?void 0:e.branch}`,Mct=((e,n={})=>{const t=n.locale??j();return t==="zh-CN"?Act(e):t==="fa"?Rct(e):Tct(e)}),Dct=()=>"Listing truncated.",Lct=()=>"列表已截断。",Oct=()=>"فهرست کوتاه شده است.",Ict=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Lct():t==="fa"?Oct():Dct()}),Bct=()=>"Loading…",$ct=()=>"正在加载…",Pct=()=>"در حال بارگیری…",Fct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?$ct():t==="fa"?Pct():Bct()}),Hct=()=>"No changes yet.",qct=()=>"尚无更改。",Uct=()=>"هنوز تغییری وجود ندارد.",Gct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?qct():t==="fa"?Uct():Hct()}),Wct=()=>"No files.",Vct=()=>"没有文件。",Kct=()=>"فایلی وجود ندارد.",Qct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Vct():t==="fa"?Kct():Wct()}),Yct=()=>"Refresh failed:",Xct=()=>"刷新失败:",Zct=()=>"تازه‌سازی ناموفق بود:",Jct=((e={},n={})=>{const t=n.locale??j();return t==="zh-CN"?Xct():t==="fa"?Zct():Yct()}),Ne=e=>`⁦${e}⁩`,Do=e=>`⁨${e}⁩`,Wt=e=>new Intl.NumberFormat(j()).format(e),Ex="demo_nanochat_v1",Ic=e=>e.startsWith("demo_"),L0="chat_demo_nanochat_v1",h6="chat_demo_nanochat_figures_v1",_6="chat_demo_nanochat_literature_v1",eut={[L0]:"cpu_end_to_end",[h6]:"figures",[_6]:"literature"},w1="cpu-apple-silicon-pipeline-results.md",tut="Run the Muon matrix LR 2× probe experiment. When it finishes, compare its step-100 and step-200 val_bpb against the baseline and tell me whether doubling the matrix learning rate helps early training.";class R4 extends Error{constructor(t,r,s){super(t);As(this,"currentVersion");As(this,"exists");this.name="FileChangedError",this.currentVersion=r,this.exists=s}}function Hi(e){return(e.status==="running"||e.status==="starting")&&e.cancelRequested?"cancelling":e.status}const AL=new WeakMap;async function ti(e){if(!e.ok){const r=await e.text().catch(()=>"");let s=r;try{const i=JSON.parse(r);if(typeof i=="object"&&i!==null&&("error"in i&&typeof i.error=="string"&&(s=i.error),e.status===409&&"code"in i&&i.code==="fileChanged"&&"exists"in i&&typeof i.exists=="boolean")){const a="currentVersion"in i&&typeof i.currentVersion=="string"?i.currentVersion:null;throw new R4(s,a,i.exists)}}catch(i){if(i instanceof R4)throw i}throw new Error(s||`HTTP ${e.status}`)}const n=await e.json(),t=AL.get(e);if(t&&!Dn(t))throw new DOMException("Workspace changed","AbortError");return n}const Tt=(e,n)=>fetch(e,{signal:n}).then(t=>ti(t));async function Zi(e,n){const t=Sa(),r=await fetch(e,n);if(!Dn(t))throw new DOMException("Workspace changed","AbortError");return AL.set(r,t),r.ok&&KV(e,t),r}const kt=(e,n,t=!1)=>Zi(e,{method:"POST",keepalive:t,headers:n===void 0?{}:{"content-type":"application/json"},body:n===void 0?void 0:JSON.stringify(n)}).then(r=>ti(r)),s_=(e,n)=>Zi(e,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(n)}).then(t=>ti(t)),RL=(e,n)=>Zi(e,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(n)}).then(t=>ti(t)),nut=e=>Tt("/api/projects",e).then(n=>n.projects),rut=e=>Tt("/api/projects/activity",e).then(n=>n.activity),sut=e=>Tt("/api/settings/ui-state",e),iut=(e,n)=>Tt(`/api/projects/${encodeURIComponent(e)}/ui-state`,n),aut=(e,n,t=!1)=>kt(`/api/projects/${encodeURIComponent(e)}/ui-state`,n,t),out=(e,n=!1)=>kt("/api/settings/ui-state",{workspace:e},n),lut=e=>kt("/api/settings/ui-state",e),cut=(e,n)=>kt("/api/onboarding/complete",{...e,...n}),uut=(e="",n)=>{const t=e?`?path=${encodeURIComponent(e)}`:"";return Tt(`/api/project-path/status${t}`,n)},dut=()=>kt("/api/project-path/pick").then(e=>e.path),fut=e=>kt("/api/projects",e),hut=(e,n)=>Tt(`/api/papers/search?q=${encodeURIComponent(e)}`,n).then(t=>t.papers),_ut=e=>Tt("/api/github/account",e),put=(e,n)=>Tt(`/api/github/project-repo-preview?name=${encodeURIComponent(e)}`,n),mut=(e,n,t)=>Tt(`/api/github/repo-access?owner=${encodeURIComponent(e)}&repo=${encodeURIComponent(n)}`,t),gut=(e,n)=>Tt(`/api/papers/resolve?id=${encodeURIComponent(e)}`,n).then(t=>t.paper),vut=e=>kt("/api/projects/starter-prompts/prewarm",e),but=(e,n,t,r,s)=>Tt(`/api/projects/${e}/starter-prompts?${new URLSearchParams({harness:n,...t?{model:t}:{},locale:r})}`,s),yut=e=>kt(`/api/projects/${e}/open`).then(n=>n.project),xut=e=>Zi(`/api/projects/${e}`,{method:"DELETE"}).then(async n=>{if(!n.ok){const t=await n.json().catch(()=>null);throw new Error((t==null?void 0:t.error)??`delete failed (${n.status})`)}WV(e)}),wut=(e,n)=>Tt(`/api/projects/${e}/experiments`,n).then(t=>t.experiments),Sut=(e,n)=>Tt(`/api/projects/${e}/runs`,n).then(t=>t.runs),ML=e=>kt(`/api/runs/${e}/cancel`).then(()=>{}),kut=(e,n)=>Tt(`/api/runs/${e}/log?offset=${n}`),Cut=(e,n)=>Tt(`/api/runs/${e}/diff`,n),Eut=(e,n)=>Tt(`/api/experiments/${e}/diff`,n),fu=(e,n=new URLSearchParams)=>(e.sessionId&&n.set("sessionId",e.sessionId),e.ref&&n.set("ref",e.ref),n),Nut=(e,n,t={},r)=>Tt(`/api/projects/${e}/file?${fu(t,new URLSearchParams({path:n}))}`,r),ON=(e,n,t={})=>`/api/projects/${e}/file/raw?${fu(t,new URLSearchParams({path:n}))}`,zut=(e,n)=>Tt(`/api/files/abs?path=${encodeURIComponent(e)}`,n),jut=e=>`/api/files/abs/raw?path=${encodeURIComponent(e)}`,Tut=(e,n,t,r)=>RL(`/api/projects/${e}/file`,{path:n,content:t,sessionId:r.sessionId,expectedVersion:r.expectedVersion}),Aut=(e,n,t,r={})=>s_(`/api/projects/${e}/file`,{path:n,...t,sessionId:r.sessionId}),Rut=(e,n,t={})=>kt(`/api/projects/${e}/file/open`,{path:n,sessionId:t.sessionId}),Mut=e=>Tt("/api/latex/engine",e),Dut=(e,n,t={})=>kt(`/api/projects/${e}/file/latex`,{path:n,sessionId:t.sessionId}),Lut=e=>Tt("/api/overleaf/settings",e),DL=e=>kt("/api/overleaf/token",{token:e}),Out=()=>Zi("/api/overleaf/token",{method:"DELETE"}).then(e=>ti(e)),LL=(e,n={})=>kt("/api/overleaf/session",{session:e,host:n.host}),Iut=()=>fetch("/api/overleaf/session",{method:"DELETE"}).then(e=>ti(e)),But=(e={})=>kt("/api/overleaf/session/import",{host:e.host}),$ut=(e,n,t={})=>kt(`/api/projects/${e}/file/overleaf/live`,{path:n,sessionId:t.sessionId,retry:t.retry}),Put=(e,n,t={})=>fetch(`/api/projects/${e}/file/overleaf/live?${fu(t,new URLSearchParams({path:n}))}`,{method:"DELETE"}).then(r=>ti(r)),Fut=(e,n,t={},r)=>Tt(`/api/projects/${e}/file/overleaf?${fu(t,new URLSearchParams({path:n}))}`,r),Hut=(e,n,t)=>kt(`/api/projects/${e}/file/overleaf`,{path:n,project:t.project,sessionId:t.sessionId}),qut=(e,n,t={})=>Zi(`/api/projects/${e}/file/overleaf?${fu(t,new URLSearchParams({path:n}))}`,{method:"DELETE"}).then(r=>ti(r)),Uut=(e,n,t={})=>kt(`/api/projects/${e}/file/overleaf/sync`,{path:n,sessionId:t.sessionId,resolve:t.resolve}),Gut=(e,n,t={},r)=>Tt(`/api/projects/${e}/file/overleaf/status?${fu(t,new URLSearchParams({path:n}))}`,r),Wut=(e,n,t={})=>`/api/projects/${e}/file/overleaf/upload?${fu(t,new URLSearchParams({path:n}))}`,Vut=(e,n={},t)=>{const r=fu(n).toString();return Tt(`/api/projects/${e}/code-tree${r?`?${r}`:""}`,t)},Kut=(e,n)=>Tt(`/api/chat/sessions/${e}/worktree`,n),Jv=(e,n,t)=>`https://github.com/${e}/${n}/tree/${t.split("/").map(encodeURIComponent).join("/")}`,Qut=e=>Tt("/api/settings/hf",e),Yut=e=>kt("/api/settings/hf",{token:e}),Xut=e=>Tt("/api/settings/tinker",e),Zut=e=>kt("/api/settings/tinker",{key:e}),Jut=e=>Tt("/api/update",e),edt=()=>kt("/api/update/apply"),tdt=()=>kt("/api/update/restart"),ndt=e=>kt("/api/update/auto",{enabled:e}),rdt=(e=!1)=>kt("/api/update/install-cli",{force:e}),sdt=e=>Tt("/api/settings/k8s",e),idt=e=>kt("/api/settings/k8s",e),adt=e=>Tt("/api/settings/modal",e),odt=(e,n)=>kt("/api/settings/modal",{tokenId:e,tokenSecret:n}),ldt=e=>Tt("/api/settings/env",e).then(n=>n.vars),OL=(e,n)=>kt("/api/settings/env",{key:e,value:n}).then(t=>t.vars),cdt=e=>Zi(`/api/settings/env/${encodeURIComponent(e)}`,{method:"DELETE"}).then(n=>ti(n)).then(n=>n.vars),udt=e=>Tt("/api/settings/data-dir",e),ddt=e=>kt("/api/settings/data-dir/validate",{path:e}),fdt=e=>kt("/api/settings/data-dir/move",{path:e}),hdt=e=>Tt("/api/settings/ssh",e).then(n=>n.hosts),_dt=e=>Tt("/api/settings/ssh/config",e),pdt=(e,n)=>RL("/api/settings/ssh/config",{content:e,previousContent:n}),mdt=(e,n)=>Tt(`/api/settings/ssh/master?host=${encodeURIComponent(e)}`,n),gdt=e=>Tt("/_orx/runtime",e),vdt=e=>Tt("/api/remote/sessions",e).then(n=>n.sessions),bdt=(e,n)=>kt("/api/remote/sessions",{host:e,uiPreferences:n}),ydt=e=>kt("/_orx/install",e),xdt=()=>kt("/_orx/reconnect"),IL=()=>kt("/_orx/disconnect"),wdt=()=>kt("/_orx/start-host"),BL=()=>Tt("/_orx/stop-host"),$L=e=>kt("/_orx/stop-host",{expectedInstanceId:e.instanceId,expectedPreview:{activeTurnCount:e.activeTurnCount,queuedMessageCount:e.queuedMessageCount,pendingPermissionCount:e.pendingPermissionCount,activeRunCount:e.activeRunCount,attachmentCount:e.attachmentCount}}),Sdt=e=>Tt("/api/settings/slurm",e),kdt=e=>kt("/api/settings/slurm",e),Cdt=e=>Tt("/api/settings/ray",e),Edt=e=>kt("/api/settings/ray",e),Ndt=e=>kt("/api/settings/ray/preflight",{address:e??null}),zdt=(e,n)=>Tt(`/api/settings/compute${e?`?projectId=${encodeURIComponent(e)}`:""}`,n),jdt=e=>kt("/api/settings/compute/default",e),Tdt=e=>Tt("/api/settings/local",e),Adt=e=>Tt("/api/settings/openresearch",e),Rdt=(e,n)=>Tt(`/api/projects/${e}/files`,n),Mdt=(e,n)=>Zi(`/api/projects/${e}/files?path=${encodeURIComponent(n)}`,{method:"DELETE"}).then(t=>ti(t)),Ddt=(e,n,t)=>s_(`/api/projects/${e}/files`,{path:n,...t}),Oh=(e,n)=>`/api/projects/${e}/files/file?path=${encodeURIComponent(n)}`,PL=512e3,Ldt=(e,n)=>{const t=new Uint8Array(e);if(t.includes(0))return{content:"",binary:!0,truncated:n};try{return{content:new TextDecoder("utf-8",{fatal:!0}).decode(t,{stream:n}),binary:!1,truncated:n}}catch{return{content:"",binary:!0,truncated:n}}},Odt=(e,n,t)=>fetch(Oh(e,n),{signal:t,headers:{Range:`bytes=0-${PL-1}`}}).then(r=>{var i;if(r.status===404)return null;if(r.status===416&&r.headers.get("content-range")==="bytes */0")return{content:"",binary:!1,truncated:!1};if(!r.ok)throw new Error(`HTTP ${r.status}`);const s=Number((i=r.headers.get("content-range"))==null?void 0:i.split("/").pop());return r.arrayBuffer().then(a=>Ldt(a,Number.isFinite(s)&&s>a.byteLength))}),Idt=e=>e==="image"||e==="audio"||e==="video"||e==="pdf"||e==="text"||e==="unknown"||e==="download",Bdt=(e,n,t)=>fetch(Oh(e,n),{signal:t,method:"HEAD"}).then(r=>{if(r.status===404)return null;if(!r.ok)throw new Error(`HTTP ${r.status}`);const s=r.headers.get("x-openresearch-presentation");return{size:Number(r.headers.get("content-length"))||0,presentation:Idt(s)?s:"download"}}),$dt=e=>Tt("/api/settings/profile",e),Pdt=e=>Tt("/api/settings/lit-sources",e),Fdt=e=>kt("/api/settings/lit-sources",e),Hdt=e=>Tt("/api/settings/projects",e),FL=(e,n)=>kt("/api/settings/projects",{githubForNewProjects:e,...n===void 0?{}:{githubDefaultPromptSeen:n}}),qdt=(e,n)=>Tt(`/api/projects/${e}/git`,n),Udt=e=>kt(`/api/projects/${e}/git/init`),Gdt=e=>kt(`/api/projects/${e}/github`),Wdt=e=>kt(`/api/projects/${e}/github/disable`),Vdt=e=>Tt("/api/settings/telemetry",e),Kdt=e=>kt("/api/settings/telemetry",{enabled:e}),ed=e=>{kt("/api/telemetry/event",e).catch(()=>{})};function O0(e){var s;if(!e.id.startsWith("orx-local-"))return e.displayName??D4(e.id);const n=(s=e.displayName)==null?void 0:s.split(" · ").slice(1).join(" · ").replace(/ \(local\)$/,""),t=n==="OpenAI-compatible server"||n==="Custom endpoint"||n==="Custom Endpoint"?t6():n,r=D4(e.id.replace(/-(?:FP|BF)\d+$/i,""));return t?`${r} · ${t}`:r}const nv="default";function eb(e,n){var a,o,l;const t=e==null?void 0:e.models.find(u=>u.id===n),r=(t==null?void 0:t.reasoningLevels)??((a=e==null?void 0:e.options)==null?void 0:a.reasoningLevels)??[],s=t==null?void 0:t.defaultReasoningLevel,i=s&&r.some(u=>u.id===s)?s:r.some(u=>u.id===nv)?nv:((o=e==null?void 0:e.options)==null?void 0:o.defaultReasoningLevel)??((l=r[0])==null?void 0:l.id)??null;return{choices:r,defaultId:i}}const M4="default";function HL(e,n){var r;if((e==null?void 0:e.id)!=="codex")return[];const t=(r=e.models.find(s=>s.id===n))==null?void 0:r.serviceTiers;return t!=null&&t.length?[{id:M4,label:eBe(),description:YIe()},...t]:[]}function rv(e,n,t){var i;if(!e)return t??null;if(e.id!=="codex"||((i=e.models.find(a=>a.id===n))==null?void 0:i.serviceTiers)===void 0)return null;const s=HL(e,n);return s.length===0?M4:t!=null&&s.some(a=>a.id===t)?t:M4}function qL(e,n,t){if(!e)return t;const{choices:r,defaultId:s}=eb(e,n);return r.length===0?nv:t&&r.some(i=>i.id===t)?t:s}const UL=(e=!1,n=!1,t)=>{const r=new URLSearchParams;e&&r.set("refresh","1"),n&&r.set("retry","1");const s=r.size>0?`?${r.toString()}`:"";return Tt(`/api/harnesses${s}`,t).then(i=>i.harnesses)},Qdt=(e,n)=>Tt(`/api/skills${n?`?harness=${encodeURIComponent(n)}`:""}`,e),Ydt=(e,n,t,r)=>Tt(`/api/skills/${encodeURIComponent(e)}${`?${new URLSearchParams({...n?{project:n}:{},...r?{harness:r}:{}})}`}`,t).then(s=>s.content),Xdt=e=>Tt("/api/latex-templates",e).then(n=>n.templates),Zdt=e=>kt("/api/latex-templates",e).then(n=>n.template),Jdt=e=>Zi(`/api/latex-templates?name=${encodeURIComponent(e)}`,{method:"DELETE"}).then(n=>ti(n)),eft=e=>Tt("/api/user-skills",e),tft=e=>kt("/api/user-skills",e).then(n=>n.skill),nft=e=>Zi(`/api/user-skills?name=${encodeURIComponent(e)}`,{method:"DELETE"}).then(n=>ti(n));function D4(e){const n=(e.split("/").pop()??e).replace(/^~/,"").replace(/^claude-/,""),t=[],r=[];for(const s of n.split("-"))/^\d+(\.\d+)?$/.test(s)?r.push(s):(r.length&&t.push(r.splice(0).join(".")),t.push(s==="gpt"?"GPT":s.charAt(0).toUpperCase()+s.slice(1)));return r.length&&t.push(r.join(".")),t.join(" ")}const rft=(e,n)=>Tt(`/api/chat/sessions?projectId=${encodeURIComponent(e)}`,n).then(t=>t.sessions),sft=(e,n,t={})=>kt("/api/chat/sessions",{projectId:e,harness:n,...t}).then(r=>r.session),ift=e=>Zi(`/api/chat/sessions/${e}`,{method:"DELETE"}).then(n=>ti(n).then(t=>(Xv(e),t))),aft=(e,n)=>s_(`/api/chat/sessions/${e}`,{archived:n}).then(t=>t.session),oft=(e,n)=>s_(`/api/chat/sessions/${e}`,{title:n}).then(t=>t.session),lft=(e,n)=>s_(`/api/chat/sessions/${e}`,{planMode:n}).then(t=>t.session),cft=(e,n)=>s_(`/api/chat/sessions/${e}`,{permissionMode:n}).then(t=>t.session),uft=(e,n)=>Tt(`/api/chat/sessions/${e}/messages`,n).then(t=>({messages:t.messages,queued:t.queued??[],activeLeafId:t.activeLeafId??null})),dft=(e,n)=>Zi(`/api/chat/sessions/${e}/queue/${encodeURIComponent(n)}`,{method:"DELETE"}).then(t=>ti(t)),fft=(e,n)=>kt(`/api/chat/sessions/${e}/queue/${encodeURIComponent(n)}`),hft=e=>`/api/chat/attachments/${encodeURIComponent(e)}`,IN=(e,n,t={},r,s,i,a)=>kt(`/api/chat/sessions/${e}/message`,{text:n,clientTurnId:i,model:t.model,serviceTier:t.serviceTier,permissionMode:t.permissionMode,planMode:t.planMode,reasoningLevel:t.reasoningLevel,images:r,annotations:s,mode:a}),_ft=(e,n)=>kt(`/api/chat/sessions/${e}/shell`,{command:n}),pft=(e,n,t,r={})=>kt(`/api/chat/sessions/${e}/turns/${n}/recover`,{action:t,...r}),mft=(e,n,t)=>kt(`/api/chat/sessions/${e}/fork`,{messageId:n,text:t}),gft=(e,n)=>kt(`/api/chat/sessions/${e}/branch`,{leafId:n}),vft=e=>kt(`/api/chat/sessions/${e}/interrupt`),bft=(e,n)=>kt(`/api/chat/sessions/${e}/respond`,n);function Io(e){const n=Math.max(0,Math.floor((Date.now()-e)/1e3)),t=new Intl.RelativeTimeFormat(j(),{numeric:"always",style:"narrow"});if(n<60)return t.format(-n,"second");const r=Math.floor(n/60);if(r<60)return t.format(-r,"minute");const s=Math.floor(r/60);return s<24?t.format(-s,"hour"):t.format(-Math.floor(s/24),"day")}function np(e){const n=Math.max(0,Math.floor(e/1e3));if(n<60)return t1e({value:Wt(n)});const t=Math.floor(n/60);if(t<60)return Xge({value:Wt(t)});const r=Math.floor(t/60);return r<24?Vge({hours:Wt(r),minutes:Wt(t%60)}):qge({days:Wt(Math.floor(r/24)),hours:Wt(r%24)})}function Al(e){const n=["B","KB","MB","GB","TB"];let t=e,r=0;for(;t>=1024&&rTt("/api/local-models",e),wft=e=>kt("/api/local-models/discover",e),Sft=e=>kt("/api/local-models",e),kft=e=>kt(`/api/local-models/${encodeURIComponent(e)}/check`,{}),Cft=e=>Zi(`/api/local-models/${encodeURIComponent(e)}`,{method:"DELETE"}).then(n=>ti(n)),BN=()=>({queryKey:Nt("getHfSettings"),queryFn:({signal:e})=>Qut(e),staleTime:3e5}),$N=()=>({queryKey:Nt("getTinkerSettings"),queryFn:({signal:e})=>Xut(e),staleTime:3e5}),PN=()=>({queryKey:Nt("getK8sSettings"),queryFn:({signal:e})=>sdt(e),staleTime:3e4}),FN=()=>({queryKey:Nt("getModalSettings"),queryFn:({signal:e})=>adt(e),staleTime:3e5}),Eft=()=>({queryKey:Nt("getSlurmSettings"),queryFn:({signal:e})=>Sdt(e),staleTime:3e5}),Nft=()=>({queryKey:Nt("getRaySettings"),queryFn:({signal:e})=>Cdt(e),staleTime:3e5}),GL=e=>({queryKey:Nt("getComputeSettings",e??null),queryFn:({signal:n})=>zdt(e,n),staleTime:3e4}),zft=()=>({queryKey:Nt("getLocalMachine"),queryFn:({signal:e})=>Tdt(e),staleTime:3e5}),jft=()=>({queryKey:Nt("getOpenResearchSettings"),queryFn:({signal:e})=>Adt(e),staleTime:3e4}),Tft=()=>({queryKey:Nt("getEnvVars"),queryFn:({signal:e})=>ldt(e),staleTime:3e5}),Aft=()=>({queryKey:Nt("getDataDir"),queryFn:({signal:e})=>udt(e),staleTime:3e5}),WL=()=>({queryKey:Nt("getSshHosts"),queryFn:({signal:e})=>hdt(e),staleTime:3e5}),Rft=()=>({queryKey:Nt("getSshConfig"),queryFn:({signal:e})=>_dt(e),staleTime:3e5}),HN=e=>({queryKey:Nt("getSshMasterStatus",e),queryFn:({signal:n})=>mdt(e,n),staleTime:5e3}),Mft=()=>({queryKey:["gateway","runtime"],queryFn:({signal:e})=>gdt(e),staleTime:2e3}),Dft=()=>({queryKey:Nt("listRemoteSessions"),queryFn:({signal:e})=>vdt(e),staleTime:3e4}),sv=()=>({queryKey:Nt("getUpdateStatus"),queryFn:({signal:e,client:n,queryKey:t})=>n_(n,t,()=>Jut(e)),staleTime:3e4}),Lft=()=>({queryKey:Nt("getProfile"),queryFn:({signal:e})=>$dt(e),staleTime:3e5}),Oft=()=>({queryKey:Nt("getLitSources"),queryFn:({signal:e})=>Pdt(e),staleTime:3e5}),m6=()=>({queryKey:Nt("getProjectDefaults"),queryFn:({signal:e})=>Hdt(e),staleTime:3e5}),Ift=e=>({queryKey:Nt("getProjectGitStatus",e),queryFn:({signal:n})=>qdt(e,n),staleTime:3e4}),Bft=()=>({queryKey:Nt("getTelemetry"),queryFn:({signal:e})=>Vdt(e),staleTime:3e5}),ru=()=>({queryKey:Nt("getHarnesses"),queryFn:({signal:e})=>UL(!1,!1,e),staleTime:3e5}),$ft=e=>({queryKey:Nt("getSkills",e??null),queryFn:({signal:n})=>Qdt(n,e),select:n=>n.skills,refetchInterval:n=>{var t;return(t=n.state.data)!=null&&t.importing?2e3:3e4},staleTime:3e5}),Pft=(e,n,t)=>({queryKey:Nt("getSkillContent",e,n??null,t??null),queryFn:({signal:r})=>Ydt(e,n,r,t),staleTime:3e5}),Fft=()=>({queryKey:Nt("listLatexTemplates"),queryFn:({signal:e})=>Xdt(e),refetchInterval:3e4,staleTime:3e5}),Hft=()=>({queryKey:Nt("listUserSkills"),queryFn:({signal:e})=>eft(e),select:e=>e.skills,refetchInterval:e=>{var n;return(n=e.state.data)!=null&&n.importing?2e3:3e4},staleTime:3e5});async function tb(e=!1,n=!1){const t=ru();if(!e&&!n)return tt.fetchQuery(t);await tt.cancelQueries(t);const r=await UL(e,n);return Dn(t.queryKey)&&tt.setQueryData(t.queryKey,r),r}const qft=()=>({queryKey:Nt("getLocalModels"),queryFn:({signal:e})=>xft(e),staleTime:3e4}),xa=e=>({queryKey:Nt("listChatSessions",e),queryFn:({signal:n,client:t,queryKey:r})=>n_(t,r,async()=>{const s=await rft(e,n),i=t.getQueryData(r);return s.filter(a=>!tu.has(a.id)).map(a=>{var o;return{...a,contextUsage:a.contextUsage??((o=i==null?void 0:i.find(l=>l.id===a.id))==null?void 0:o.contextUsage)}})},Vp),staleTime:3e4}),Ol=e=>({queryKey:Nt("getChatMessages",e),queryFn:async({signal:n,client:t,queryKey:r})=>{var _;const s=t.getQueryData(r),i=await n_(t,r,()=>uft(e,n),(d,p,m)=>{if(!p)return d;const x=new Set([...m].filter(S=>S.startsWith("message:")).map(S=>S.slice(8)));return{messages:Vp(d.messages,p.messages,x,!1),queued:m.has("queued")?p.queued:d.queued,activeLeafId:m.has("branch")||x.size?p.activeLeafId:d.activeLeafId}});n.throwIfAborted();const a=t.getQueryData(r),l=s!==void 0&&i.messages.some(d=>d.role==="user"&&!(s!=null&&s.messages.some(p=>p.id===d.id)))?[]:(a==null?void 0:a.messages.filter(d=>d.id.startsWith("local-")))??[],u=l.some(d=>d.id===(a==null?void 0:a.activeLeafId));return{...i,messages:[...i.messages,...l.filter(d=>!i.messages.some(p=>p.id===d.id))],activeLeafId:a&&(u||!((_=a.activeLeafId)!=null&&_.startsWith("local-"))&&a.activeLeafId!==(s==null?void 0:s.activeLeafId))?a.activeLeafId:i.activeLeafId}},staleTime:1/0,refetchOnMount:"always",refetchOnWindowFocus:"always"}),xd="local-",VL="bash";function qN(e,n){const t=e.findIndex(r=>r.id===n.id);if(t>=0){const r=e.slice();return r[t]=n,r}return n.role!=="user"?[...e,n]:[...e.filter(r=>!r.id.startsWith(xd)),n]}function Uft(e,n){switch(n.type){case"upsertMessage":{const t=e.messagesBySession[n.sessionId]??[],r=t.some(o=>o.id===n.message.id),s=e.activeLeafBySession[n.sessionId]??null,i=n.message.role==="user"&&s!==null&&s.startsWith(xd),a=n.message.parentId!=null&&n.message.parentId===s;return{...e,messagesBySession:{...e.messagesBySession,[n.sessionId]:qN(t,n.message)},activeLeafBySession:r&&!i&&!a?e.activeLeafBySession:{...e.activeLeafBySession,[n.sessionId]:n.message.id}}}case"localError":{const t=e.messagesBySession[n.sessionId]??[],r={id:`${xd}senderr-${Date.now()}`,role:"assistant",parts:[{id:"p0",type:"tool",tool:"error",state:{status:"error",error:n.text}}],createdAt:Date.now(),parentId:e.activeLeafBySession[n.sessionId]??null};return{...e,messagesBySession:{...e.messagesBySession,[n.sessionId]:[...t,r]},activeLeafBySession:{...e.activeLeafBySession,[n.sessionId]:r.id}}}case"localShell":{const t=e.messagesBySession[n.sessionId]??[],r=t.find(i=>i.id===n.id),s={id:n.id,role:"user",parts:[{id:"p0",type:"tool",tool:VL,state:{status:n.error===void 0?"running":"error",input:{command:n.command},error:n.error}}],createdAt:(r==null?void 0:r.createdAt)??Date.now(),parentId:r?r.parentId:e.activeLeafBySession[n.sessionId]??null};return{...e,messagesBySession:{...e.messagesBySession,[n.sessionId]:r?qN(t,s):[...t,s]},activeLeafBySession:r?e.activeLeafBySession:{...e.activeLeafBySession,[n.sessionId]:s.id}}}case"activeLeaf":return{...e,activeLeafBySession:{...e.activeLeafBySession,[n.sessionId]:n.leafId}};case"optimisticUser":{const t=e.messagesBySession[n.sessionId]??[],r=n.text?[{id:"p0",type:"text",text:n.text}]:[];n.attachments.forEach((i,a)=>r.push({id:`img${a}`,type:"image",text:i.url,name:i.name})),n.annotations.forEach((i,a)=>r.push({id:`annotation${a}`,type:"annotation",text:i.text}));const s={id:`${xd}${Date.now()}`,role:"user",parts:r,createdAt:Date.now(),parentId:e.activeLeafBySession[n.sessionId]??null};return{...e,messagesBySession:{...e.messagesBySession,[n.sessionId]:[...t,s]},activeLeafBySession:{...e.activeLeafBySession,[n.sessionId]:s.id}}}case"setQueued":return{...e,queuedBySession:{...e.queuedBySession,[n.sessionId]:n.items}}}}let KL=0;function QL(e){return(e.query.queryKey[2]==="listChatSessions"||e.query.queryKey[2]==="getChatMessages")&&(e.type==="removed"||e.type==="updated"&&e.action.type==="success")}tt.getQueryCache().subscribe(e=>{QL(e)&&KL++});const Gft=e=>tt.getQueryCache().subscribe(n=>{QL(n)&&e()}),Wft=()=>KL;function Vft(e,n){const t=tt.getQueryData(xa(e).queryKey)??[],r=new Set(t.filter(a=>a.busy).map(a=>a.id)),s={messagesBySession:{},queuedBySession:{},activeLeafBySession:{},busySessions:r},i=new Set(r);n&&i.add(n);for(const a of i){const o=tt.getQueryData(Ol(a).queryKey);o&&(s.messagesBySession[a]=o.messages,s.queuedBySession[a]=o.queued,s.activeLeafBySession[a]=o.activeLeafId)}return s}function YL(e,n,t=!1){if(n.type==="busy"){qa(tt,xa(e).queryKey,n.sessionId),tt.setQueryData(xa(e).queryKey,l=>l==null?void 0:l.map(u=>u.id===n.sessionId?{...u,busy:n.busy}:u));return}const r=Ol(n.sessionId);if(tu.has(n.sessionId))return;qa(tt,r.queryKey,n.type==="upsertMessage"?`message:${n.message.id}`:n.type==="setQueued"?"queued":n.type==="activeLeaf"?"branch":"local");const s=tt.getQueryData(r.queryKey);if(t&&!s)return;const i={messagesBySession:s?{[n.sessionId]:s.messages}:{},queuedBySession:s?{[n.sessionId]:s.queued}:{},activeLeafBySession:s?{[n.sessionId]:s.activeLeafId}:{},busySessions:new Set},a=Uft(i,n),o={messages:a.messagesBySession[n.sessionId]??[],queued:a.queuedBySession[n.sessionId]??[],activeLeafId:a.activeLeafBySession[n.sessionId]??null};tt.setQueryData(r.queryKey,o)}function Kft(e,n){const t=!!n&&!tu.has(n??""),r=ot({...Ol(n??""),enabled:t,subscribed:t}),s=R.useSyncExternalStore(Gft,Wft),i=R.useMemo(()=>Vft(e,n),[e,n,s]),a=Sa()[1],o=R.useCallback(l=>{Dn(["workspace",a])&&YL(e,l)},[e,a]);return[i,o,r]}const S1=new Map;function Qft(e,n){let t=S1.get(e);return t||(t=new Set,S1.set(e,t)),t.add(n),()=>{t.delete(n),t.size===0&&S1.delete(e)}}function Yft(e){var n;(n=S1.get(e.runId))==null||n.forEach(t=>t(e))}const L4=new Set;function iv(e){return L4.add(e),()=>{L4.delete(e)}}function ml(e){L4.forEach(n=>n(e))}const O4=new Set;function Xft(e){return O4.add(e),()=>{O4.delete(e)}}function gl(){O4.forEach(e=>e())}const I4=new Set;function Zft(e){return I4.add(e),()=>{I4.delete(e)}}function UN(e){I4.forEach(n=>n(e))}const B4=new Set;function XL(e){return B4.add(e),()=>{B4.delete(e)}}function Nx(e){B4.forEach(n=>n(e))}const $4=new Set;function Jft(e){return $4.add(e),()=>{$4.delete(e)}}function GN(e){$4.forEach(n=>n(e))}const P4=new Set;function eht(e){return P4.add(e),()=>{P4.delete(e)}}function tht(e){P4.forEach(n=>n(e))}let F4=!0;const H4=new Set;function nht(e){return H4.add(e),()=>{H4.delete(e)}}function WN(){return F4}function VN(e){e!==F4&&(F4=e,H4.forEach(n=>n()))}const rht=8e3,sht=3e3;function iht(e){const n=R.useRef(e);n.current=e,R.useEffect(()=>{let t=null,r=!1,s,i,a=!1;const o=()=>{t==null||t.close();const l=new EventSource("/api/events");t=l,l.onerror=()=>{r||(a=!0,s??(s=window.setTimeout(()=>VN(!1),rht)),l.readyState===EventSource.CLOSED&&i===void 0&&(i=window.setTimeout(()=>{i=void 0,o()},sht)))},l.onopen=()=>{var _,d;r||(window.clearTimeout(s),s=void 0,VN(!0),a&&(ml({type:"reconnected"}),gl(),UN({harness:"*",authState:"unknown"}),(d=(_=n.current).onReconnect)==null||d.call(_)),a=!0)};const u=_=>{try{return JSON.parse(_.data)}catch{return null}};l.addEventListener("resync.required",()=>{var _,d;ml({type:"reconnected"}),gl(),(d=(_=n.current).onReconnect)==null||d.call(_)}),l.addEventListener("run.updated",_=>{const d=u(_);d!=null&&d.run&&(gl(),n.current.onRun(d.run))}),l.addEventListener("experiment.updated",_=>{var p,m;const d=u(_);d!=null&&d.experiment&&(gl(),(m=(p=n.current).onExperiment)==null||m.call(p,d.experiment))}),l.addEventListener("project.updated",_=>{var p,m;const d=u(_);d!=null&&d.project&&(gl(),(m=(p=n.current).onProject)==null||m.call(p,d.project))}),l.addEventListener("files.updated",_=>{var p,m;const d=u(_);d!=null&&d.projectId&&((m=(p=n.current).onArtifacts)==null||m.call(p,d.projectId))}),l.addEventListener("run.log",_=>{const d=u(_);d!=null&&d.runId&&Yft(d)}),l.addEventListener("chat.session",_=>{const d=u(_);d!=null&&d.session&&(gl(),ml({type:"session",session:d.session}))}),l.addEventListener("chat.session.deleted",_=>{const d=u(_);d!=null&&d.sessionId&&(gl(),ml({type:"sessionDeleted",sessionId:d.sessionId}))}),l.addEventListener("chat.message",_=>{const d=u(_);d!=null&&d.message&&(gl(),ml({type:"message",sessionId:d.sessionId,message:d.message}))}),l.addEventListener("chat.busy",_=>{const d=u(_);d!=null&&d.sessionId&&(gl(),ml({type:"busy",sessionId:d.sessionId,busy:d.busy}))}),l.addEventListener("chat.usage",_=>{const d=u(_);d!=null&&d.sessionId&&d.usage&&ml({type:"usage",sessionId:d.sessionId,usage:d.usage})}),l.addEventListener("chat.queued",_=>{const d=u(_);d!=null&&d.sessionId&&ml({type:"queued",sessionId:d.sessionId,items:d.items??[]})}),l.addEventListener("chat.branch",_=>{const d=u(_);d!=null&&d.sessionId&&ml({type:"branch",sessionId:d.sessionId,activeLeafId:d.activeLeafId??null})}),l.addEventListener("harness.auth",_=>{const d=u(_);d!=null&&d.harness&&d.authState&&UN(d)}),l.addEventListener("datadir.move.progress",_=>{const d=u(_);d&&Nx({type:"progress",...d})}),l.addEventListener("datadir.move.done",_=>{const d=u(_);d&&Nx({type:"done",path:d.path,oldPathLeft:d.oldPathLeft})}),l.addEventListener("datadir.move.error",_=>{const d=u(_);d&&Nx({type:"error",error:d.error})}),l.addEventListener("update.status",_=>{const d=u(_);d&&tht(d)}),l.addEventListener("overleaf.live",_=>{const d=u(_);d!=null&&d.key&&d.status&&GN({type:"live",key:d.key,status:d.status})}),l.addEventListener("overleaf.pulled",_=>{const d=u(_);d!=null&&d.key&&Array.isArray(d.paths)&&GN({type:"pulled",key:d.key,paths:d.paths})})};return o(),()=>{r=!0,window.clearTimeout(s),window.clearTimeout(i),t==null||t.close()}},[])}const av=new Set;function aht(e){const n=R.useRef(e);n.current=e,R.useEffect(()=>{const t={onRun:r=>n.current.onRun(r),onReconnect:()=>{var r,s;return(s=(r=n.current).onReconnect)==null?void 0:s.call(r)}};return av.add(t),()=>{av.delete(t)}},[])}const KN={onRun:e=>av.forEach(n=>n.onRun(e)),onReconnect:()=>av.forEach(e=>{var n;return(n=e.onReconnect)==null?void 0:n.call(e)})},rp=()=>({queryKey:Nt("listProjects"),queryFn:({signal:e,client:n,queryKey:t})=>n_(n,t,()=>nut(e),Vp),staleTime:3e4}),oht=()=>({queryKey:Nt("listProjectActivity"),queryFn:({signal:e})=>rut(e),staleTime:3e4}),Xp=()=>({queryKey:Nt("getUiState"),queryFn:({signal:e})=>sut(e),staleTime:3e5}),g6=e=>({queryKey:Nt("getProjectUiState",e),queryFn:({signal:n})=>iut(e,n),staleTime:3e5}),I0=(e="")=>({queryKey:Nt("getProjectPathStatus",e),queryFn:({signal:n})=>uut(e,n),staleTime:3e4}),ZL=e=>({queryKey:Nt("searchPapers",e),queryFn:({signal:n})=>hut(e,n),staleTime:3e5}),lht=()=>({queryKey:Nt("githubAccount"),queryFn:({signal:e})=>_ut(e),staleTime:3e5}),cht=e=>({queryKey:Nt("githubProjectRepoPreview",e),queryFn:({signal:n})=>put(e,n),staleTime:3e4}),QN=(e,n)=>({queryKey:Nt("repoAccess",e,n),queryFn:({signal:t})=>mut(e,n,t),staleTime:3e4}),q4=e=>({queryKey:Nt("resolvePaper",e),queryFn:({signal:n})=>gut(e,n),staleTime:36e5}),uht=(e,n,t,r)=>({queryKey:Nt("getProjectStarterPrompts",e,n,t,r),queryFn:({signal:s})=>but(e,n,t,r,s),staleTime:3e5,refetchOnWindowFocus:!1,retryOnMount:!1}),U4=e=>({queryKey:Nt("listExperiments",e),queryFn:({signal:n,client:t,queryKey:r})=>n_(t,r,()=>wut(e,n),Vp),staleTime:3e4}),Qc=e=>({queryKey:Nt("listRuns",e),queryFn:({signal:n,client:t,queryKey:r})=>n_(t,r,()=>Sut(e,n),Vp),staleTime:3e4});function Tg(e,n){if(!e)return;const t=e.find(r=>r.id===n.id);return t&&t.updatedAt>n.updatedAt?e:t?e.map(r=>r.id===n.id?n:r):[...e,n]}function YN(){const e=Sa();return iht({onRun(n){var r;if(!Dn(e))return;const t=(r=tt.getQueryData(Qc(n.projectId).queryKey))==null?void 0:r.find(s=>s.id===n.id);qa(tt,Qc(n.projectId).queryKey,n.id),tt.setQueryData(Qc(n.projectId).queryKey,s=>Tg(s,n)),(t==null?void 0:t.commitSha)!==n.commitSha&&(ma(["getRunDiff"],e,s=>s.queryKey[3]===n.id),ma(["getExperimentDiff"],e,s=>s.queryKey[3]===n.experimentId)),KN.onRun(n)},onExperiment(n){Dn(e)&&(qa(tt,U4(n.projectId).queryKey,n.id),tt.setQueryData(U4(n.projectId).queryKey,t=>Tg(t,n)),ma(["getProjectStarterPrompts"],e,t=>t.queryKey[3]===n.projectId),ma(["getExperimentDiff"],e,t=>t.queryKey[3]===n.id),ma(["getRunDiff"],e,t=>{var r;return((r=tt.getQueryData(Qc(n.projectId).queryKey))==null?void 0:r.some(s=>s.experimentId===n.id&&s.id===t.queryKey[3]))??!1}))},onProject(n){Dn(e)&&(qa(tt,rp().queryKey,n.id),tt.setQueryData(rp().queryKey,t=>Tg(t,n)))},onArtifacts(n){Dn(e)&&(ma(Q5,e,t=>t.queryKey[3]===n),ma(["resolvedFile"],e,t=>t.queryKey[3]===n&&t.queryKey[5]==="artifacts"))},onReconnect(){Dn(e)&&(ma(UV,e),KN.onReconnect())}}),R.useEffect(()=>{let n;const t=Xft(()=>{n??(n=setTimeout(()=>{n=void 0,ma(["listProjectActivity"],e)},100))}),r=XL(o=>{o.type==="done"&&ma(["getDataDir"],e)}),s=iv(o=>{Dn(e)&&(o.type==="session"?qa(tt,xa(o.session.projectId).queryKey,o.session.id):(o.type==="busy"||o.type==="usage")&&qa(tt,[...e,"listChatSessions"],o.sessionId),(o.type==="message"||o.type==="queued"||o.type==="branch")&&YL("",o.type==="message"?{type:"upsertMessage",sessionId:o.sessionId,message:o.message}:o.type==="queued"?{type:"setQueued",sessionId:o.sessionId,items:o.items}:{type:"activeLeaf",sessionId:o.sessionId,leafId:o.activeLeafId},!0),o.type==="session"&&!tu.has(o.session.id)?tt.setQueryData(xa(o.session.projectId).queryKey,l=>{if(!l)return;const u=l.find(_=>_.id===o.session.id);return u?Tg(l,{...o.session,contextUsage:o.session.contextUsage??u.contextUsage}):[o.session,...l]}):o.type==="sessionDeleted"?Xv(o.sessionId):(o.type==="busy"||o.type==="usage")&&tt.setQueriesData({queryKey:[...e,"listChatSessions"]},l=>l==null?void 0:l.map(u=>u.id!==o.sessionId?u:o.type==="busy"?{...u,busy:o.busy}:{...u,contextUsage:o.usage})))}),i=Zft(()=>{Dn(e)&&tb(!0).catch(()=>{})}),a=eht(o=>{Dn(e)&&(qa(tt,sv().queryKey),tt.setQueryData(sv().queryKey,o))});return()=>{clearTimeout(n),t(),r(),s(),i(),a()}},[e[1]]),null}const G4=new Set;function JL(e){if(e!==j()){lD(e,{reload:!1}),document.documentElement.lang=e;for(const n of G4)n()}}function dht(e){return G4.add(e),()=>G4.delete(e)}function Gd(){return R.useSyncExternalStore(dht,j,j)}const eO="orx:theme";function fht(){try{const e=localStorage.getItem(eO);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}let Ih=fht();const W4=new Set;function hht(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v6(){document.documentElement.dataset.theme=hht(Ih)}function tO(e){Ih=e;try{localStorage.setItem(eO,e)}catch{}v6();for(const n of W4)n()}function _ht(){return Ih}window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{Ih==="system"&&v6()});v6();function pht(e){return W4.add(e),()=>W4.delete(e)}function nO(){return[R.useSyncExternalStore(pht,()=>Ih,()=>Ih),tO]}const mht=(e,n)=>{const t=new Array(e.length+n.length);for(let r=0;r({classGroupId:e,validator:n}),rO=(e=new Map,n=null,t)=>({nextPart:e,validators:n,classGroupId:t}),ov="-",XN=[],vht="arbitrary..",bht=e=>{const n=xht(e),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return yht(a);const o=a.split(ov),l=o[0]===""&&o.length>1?1:0;return sO(o,l,n)},getConflictingClassGroupIds:(a,o)=>{if(o){const l=r[a],u=t[a];return l?u?mht(u,l):l:u||XN}return t[a]||XN}}},sO=(e,n,t)=>{if(e.length-n===0)return t.classGroupId;const s=e[n],i=t.nextPart.get(s);if(i){const u=sO(e,n+1,i);if(u)return u}const a=t.validators;if(a===null)return;const o=n===0?e.join(ov):e.slice(n).join(ov),l=a.length;for(let u=0;ue.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const n=e.slice(1,-1),t=n.indexOf(":"),r=n.slice(0,t);return r?vht+r:void 0})(),xht=e=>{const{theme:n,classGroups:t}=e;return wht(t,n)},wht=(e,n)=>{const t=rO();for(const r in e){const s=e[r];b6(s,t,r,n)}return t},b6=(e,n,t,r)=>{const s=e.length;for(let i=0;i{if(typeof e=="string"){kht(e,n,t);return}if(typeof e=="function"){Cht(e,n,t,r);return}Eht(e,n,t,r)},kht=(e,n,t)=>{const r=e===""?n:iO(n,e);r.classGroupId=t},Cht=(e,n,t,r)=>{if(Nht(e)){b6(e(r),n,t,r);return}n.validators===null&&(n.validators=[]),n.validators.push(ght(t,e))},Eht=(e,n,t,r)=>{const s=Object.entries(e),i=s.length;for(let a=0;a{let t=e;const r=n.split(ov),s=r.length;for(let i=0;i"isThemeGetter"in e&&e.isThemeGetter===!0,zht=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,t=Object.create(null),r=Object.create(null);const s=(i,a)=>{t[i]=a,n++,n>e&&(n=0,r=t,t=Object.create(null))};return{get(i){let a=t[i];if(a!==void 0)return a;if((a=r[i])!==void 0)return s(i,a),a},set(i,a){i in t?t[i]=a:s(i,a)}}},V4="!",ZN=":",jht=[],JN=(e,n,t,r,s)=>({modifiers:e,hasImportantModifier:n,baseClassName:t,maybePostfixModifierPosition:r,isExternal:s}),Tht=e=>{const{prefix:n,experimentalParseClassName:t}=e;let r=s=>{const i=[];let a=0,o=0,l=0,u;const _=s.length;for(let S=0;S<_;S++){const v=s[S];if(a===0&&o===0){if(v===ZN){i.push(s.slice(l,S)),l=S+1;continue}if(v==="/"){u=S;continue}}v==="["?a++:v==="]"?a--:v==="("?o++:v===")"&&o--}const d=i.length===0?s:s.slice(l);let p=d,m=!1;d.endsWith(V4)?(p=d.slice(0,-1),m=!0):d.startsWith(V4)&&(p=d.slice(1),m=!0);const x=u&&u>l?u-l:void 0;return JN(i,m,p,x)};if(n){const s=n+ZN,i=r;r=a=>a.startsWith(s)?i(a.slice(s.length)):JN(jht,!1,a,void 0,!0)}if(t){const s=r;r=i=>t({className:i,parseClassName:s})}return r},Aht=e=>{const n=new Map;return e.orderSensitiveModifiers.forEach((t,r)=>{n.set(t,1e6+r)}),t=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},Rht=e=>({cache:zht(e.cacheSize),parseClassName:Tht(e),sortModifiers:Aht(e),postfixLookupClassGroupIds:Mht(e),...bht(e)}),Mht=e=>{const n=Object.create(null),t=e.postfixLookupClassGroups;if(t)for(let r=0;r{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i,postfixLookupClassGroupIds:a}=n,o=[],l=e.trim().split(Dht);let u="";for(let _=l.length-1;_>=0;_-=1){const d=l[_],{isExternal:p,modifiers:m,hasImportantModifier:x,baseClassName:S,maybePostfixModifierPosition:v}=t(d);if(p){u=d+(u.length>0?" "+u:u);continue}let b=!!v,w;if(b){const T=S.substring(0,v);w=r(T);const z=w&&a[w]?r(S):void 0;z&&z!==w&&(w=z,b=!1)}else w=r(S);if(!w){if(!b){u=d+(u.length>0?" "+u:u);continue}if(w=r(S),!w){u=d+(u.length>0?" "+u:u);continue}b=!1}const y=m.length===0?"":m.length===1?m[0]:i(m).join(":"),C=x?y+V4:y,E=C+w;if(o.indexOf(E)>-1)continue;o.push(E);const N=s(w,b);for(let T=0;T0?" "+u:u)}return u},Oht=(...e)=>{let n=0,t,r,s="";for(;n{if(typeof e=="string")return e;let n,t="";for(let r=0;r{let t,r,s,i;const a=l=>{const u=n.reduce((_,d)=>d(_),e());return t=Rht(u),r=t.cache.get,s=t.cache.set,i=o,o(l)},o=l=>{const u=r(l);if(u)return u;const _=Lht(l,t);return s(l,_),_};return i=a,(...l)=>i(Oht(...l))},Iht=[],fs=e=>{const n=t=>t[e]||Iht;return n.isThemeGetter=!0,n},oO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,lO=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Bht=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,$ht=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Pht=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Fht=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Hht=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qht=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zc=e=>Bht.test(e),dn=e=>!!e&&!Number.isNaN(Number(e)),vo=e=>!!e&&Number.isInteger(Number(e)),zx=e=>e.endsWith("%")&&dn(e.slice(0,-1)),vl=e=>$ht.test(e),cO=()=>!0,Uht=e=>Pht.test(e)&&!Fht.test(e),y6=()=>!1,Ght=e=>Hht.test(e),Wht=e=>qht.test(e),Vht=e=>!dt(e)&&!ft(e),Kht=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Qht=e=>hu(e,fO,y6),dt=e=>oO.test(e),Uu=e=>hu(e,hO,Uht),tz=e=>hu(e,r_t,dn),Yht=e=>hu(e,pO,cO),Xht=e=>hu(e,_O,y6),nz=e=>hu(e,uO,y6),Zht=e=>hu(e,dO,Wht),Ag=e=>hu(e,mO,Ght),ft=e=>lO.test(e),c0=e=>Wd(e,hO),Jht=e=>Wd(e,_O),rz=e=>Wd(e,uO),e_t=e=>Wd(e,fO),t_t=e=>Wd(e,dO),Rg=e=>Wd(e,mO,!0),n_t=e=>Wd(e,pO,!0),hu=(e,n,t)=>{const r=oO.exec(e);return r?r[1]?n(r[1]):t(r[2]):!1},Wd=(e,n,t=!1)=>{const r=lO.exec(e);return r?r[1]?n(r[1]):t:!1},uO=e=>e==="position"||e==="percentage",dO=e=>e==="image"||e==="url",fO=e=>e==="length"||e==="size"||e==="bg-size",hO=e=>e==="length",r_t=e=>e==="number",_O=e=>e==="family-name",pO=e=>e==="number"||e==="weight",mO=e=>e==="shadow",sz=()=>{const e=fs("color"),n=fs("font"),t=fs("text"),r=fs("font-weight"),s=fs("tracking"),i=fs("leading"),a=fs("breakpoint"),o=fs("container"),l=fs("spacing"),u=fs("radius"),_=fs("shadow"),d=fs("inset-shadow"),p=fs("text-shadow"),m=fs("drop-shadow"),x=fs("blur"),S=fs("perspective"),v=fs("aspect"),b=fs("ease"),w=fs("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...C(),ft,dt],N=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],z=()=>[ft,dt,l],M=()=>[zc,"full","auto",...z()],I=()=>[vo,"none","subgrid",ft,dt],B=()=>["auto",{span:["full",vo,ft,dt]},vo,ft,dt],$=()=>[vo,"auto",ft,dt],U=()=>["auto","min","max","fr",ft,dt],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Y=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...z()],X=()=>[zc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],ee=()=>[zc,"screen","full","dvw","lvw","svw","min","max","fit",...z()],O=()=>[zc,"screen","full","lh","dvh","lvh","svh","min","max","fit",...z()],L=()=>[e,ft,dt],F=()=>[...C(),rz,nz,{position:[ft,dt]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",e_t,Qht,{size:[ft,dt]}],re=()=>[zx,c0,Uu],ce=()=>["","none","full",u,ft,dt],oe=()=>["",dn,c0,Uu],te=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[dn,zx,rz,nz],ae=()=>["","none",x,ft,dt],de=()=>["none",dn,ft,dt],pe=()=>["none",dn,ft,dt],we=()=>[dn,ft,dt],be=()=>[zc,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[vl],breakpoint:[vl],color:[cO],container:[vl],"drop-shadow":[vl],ease:["in","out","in-out"],font:[Vht],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[vl],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[vl],shadow:[vl],spacing:["px",dn],text:[vl],"text-shadow":[vl],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",zc,dt,ft,v]}],container:["container"],"container-type":[{"@container":["","normal","size",ft,dt]}],"container-named":[Kht],columns:[{columns:[dn,dt,ft,o]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{"inset-s":M(),start:M()}],end:[{"inset-e":M(),end:M()}],"inset-bs":[{"inset-bs":M()}],"inset-be":[{"inset-be":M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[vo,"auto",ft,dt]}],basis:[{basis:[zc,"full","auto",o,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[dn,zc,"auto","initial","none",dt]}],grow:[{grow:["",dn,ft,dt]}],shrink:[{shrink:["",dn,ft,dt]}],order:[{order:[vo,"first","last","none",ft,dt]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...Y(),"normal"]}],"justify-self":[{"justify-self":["auto",...Y()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...Y(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Y(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...Y(),"baseline"]}],"place-self":[{"place-self":["auto",...Y()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pbs:[{pbs:z()}],pbe:[{pbe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mbs:[{mbs:V()}],mbe:[{mbe:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],"inline-size":[{inline:["auto",...ee()]}],"min-inline-size":[{"min-inline":["auto",...ee()]}],"max-inline-size":[{"max-inline":["none",...ee()]}],"block-size":[{block:["auto",...O()]}],"min-block-size":[{"min-block":["auto",...O()]}],"max-block-size":[{"max-block":["none",...O()]}],w:[{w:[o,"screen",...X()]}],"min-w":[{"min-w":[o,"screen","none",...X()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",t,c0,Uu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,n_t,Yht]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",zx,dt]}],"font-family":[{font:[Jht,Xht,n]}],"font-features":[{"font-features":[dt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,ft,dt]}],"line-clamp":[{"line-clamp":[dn,"none",ft,tz]}],leading:[{leading:[i,...z()]}],"list-image":[{"list-image":["none",ft,dt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ft,dt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[dn,"from-font","auto",ft,Uu]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[dn,"auto",ft,dt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"tab-size":[{tab:[vo,ft,dt]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ft,dt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ft,dt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},vo,ft,dt],radial:["",ft,dt],conic:[vo,ft,dt]},t_t,Zht]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[dn,ft,dt]}],"outline-w":[{outline:["",dn,c0,Uu]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",_,Rg,Ag]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",d,Rg,Ag]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[dn,Uu]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",p,Rg,Ag]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[dn,ft,dt]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[dn]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[ft,dt]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[dn]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ft,dt]}],filter:[{filter:["","none",ft,dt]}],blur:[{blur:ae()}],brightness:[{brightness:[dn,ft,dt]}],contrast:[{contrast:[dn,ft,dt]}],"drop-shadow":[{"drop-shadow":["","none",m,Rg,Ag]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",dn,ft,dt]}],"hue-rotate":[{"hue-rotate":[dn,ft,dt]}],invert:[{invert:["",dn,ft,dt]}],saturate:[{saturate:[dn,ft,dt]}],sepia:[{sepia:["",dn,ft,dt]}],"backdrop-filter":[{"backdrop-filter":["","none",ft,dt]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[dn,ft,dt]}],"backdrop-contrast":[{"backdrop-contrast":[dn,ft,dt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",dn,ft,dt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[dn,ft,dt]}],"backdrop-invert":[{"backdrop-invert":["",dn,ft,dt]}],"backdrop-opacity":[{"backdrop-opacity":[dn,ft,dt]}],"backdrop-saturate":[{"backdrop-saturate":[dn,ft,dt]}],"backdrop-sepia":[{"backdrop-sepia":["",dn,ft,dt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ft,dt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[dn,"initial",ft,dt]}],ease:[{ease:["linear","initial",b,ft,dt]}],delay:[{delay:[dn,ft,dt]}],animate:[{animate:["none",w,ft,dt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,ft,dt]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[ft,dt,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],zoom:[{zoom:[vo,ft,dt]}],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ft,dt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":L()}],"scrollbar-track-color":[{"scrollbar-track":L()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mbs":[{"scroll-mbs":z()}],"scroll-mbe":[{"scroll-mbe":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pbs":[{"scroll-pbs":z()}],"scroll-pbe":[{"scroll-pbe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ft,dt]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[dn,c0,Uu,tz]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},s_t=(e,{cacheSize:n,prefix:t,experimentalParseClassName:r,extend:s={},override:i={}})=>(Wf(e,"cacheSize",n),Wf(e,"prefix",t),Wf(e,"experimentalParseClassName",r),Mg(e.theme,i.theme),Mg(e.classGroups,i.classGroups),Mg(e.conflictingClassGroups,i.conflictingClassGroups),Mg(e.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),Wf(e,"postfixLookupClassGroups",i.postfixLookupClassGroups),Wf(e,"orderSensitiveModifiers",i.orderSensitiveModifiers),Dg(e.theme,s.theme),Dg(e.classGroups,s.classGroups),Dg(e.conflictingClassGroups,s.conflictingClassGroups),Dg(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),K4(e,s,"postfixLookupClassGroups"),K4(e,s,"orderSensitiveModifiers"),e),Wf=(e,n,t)=>{t!==void 0&&(e[n]=t)},Mg=(e,n)=>{if(n)for(const t in n)Wf(e,t,n[t])},Dg=(e,n)=>{if(n)for(const t in n)K4(e,n,t)},K4=(e,n,t)=>{const r=n[t];r!==void 0&&(e[t]=e[t]?e[t].concat(r):r)},i_t=(e,...n)=>typeof e=="function"?ez(sz,e,...n):ez(()=>s_t(sz(),e),...n),a_t=i_t({extend:{theme:{text:["menu"]}}});function Ns(...e){return a_t(...e)}const o_t={default:"border-transparent bg-surface text-subtext",success:"border-accent-green bg-accent-green-subtle text-accent-green",error:"border-accent-red bg-accent-red-subtle text-accent-red",warning:"border-accent-amber bg-accent-amber-subtle text-accent-amber"};function Ft({variant:e="default",size:n="default",className:t,...r}){return f.jsx("span",{className:Ns("badge inline-flex items-center rounded-full border py-px font-sans",n==="small"?"px-1.5 text-xs font-normal":"px-2 text-sm font-medium",o_t[e],t),...r})}const l_t=["btn inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap border font-medium","transition-[background,border-color,color] duration-120 ease-standard","focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-text focus-visible:outline-offset-2","disabled:cursor-default disabled:opacity-45"].join(" "),c_t={default:"border-border bg-background text-text [&:hover:not(:disabled)]:bg-surface [&:active:not(:disabled)]:bg-highlight",primary:"border-primary bg-primary text-background [&:hover:not(:disabled)]:border-primary-hover [&:hover:not(:disabled)]:bg-primary-hover [&:active:not(:disabled)]:border-primary-active [&:active:not(:disabled)]:bg-primary-active",ghost:"border-transparent bg-transparent text-text [&:hover:not(:disabled)]:bg-surface [&:active:not(:disabled)]:bg-highlight [&.active]:bg-surface [&.active]:text-muted",danger:"border-border bg-background text-accent-red [&:hover:not(:disabled)]:bg-danger-hover [&:active:not(:disabled)]:bg-danger-active",warning:"border-accent-amber bg-background text-accent-amber [&:hover:not(:disabled)]:bg-accent-amber-subtle [&:active:not(:disabled)]:bg-highlight"},u_t={default:"h-8 rounded-md px-3.5 text-sm",small:"h-7 rounded-sm px-2.5 text-sm",large:"h-14 rounded-lg px-7 text-xl"};function gO(e,n,t,r){return Ns(l_t,c_t[e],u_t[n],t&&"active",r)}function Le({active:e=!1,variant:n="default",size:t="default",className:r,...s}){return f.jsx("button",{className:gO(n,t,e,r),...s})}function Bh({active:e=!1,variant:n="default",size:t="default",className:r,...s}){return f.jsx("a",{className:gO(n,t,e,r),...s})}const d_t=["icon-btn relative inline-flex shrink-0 items-center justify-center","transition-[background,color] duration-120 ease-standard","focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-text focus-visible:outline-offset-2","disabled:cursor-default disabled:opacity-45"].join(" "),f_t={default:"text-subtext [&:hover:not(:disabled)]:bg-surface [&:hover:not(:disabled)]:text-text [&:active:not(:disabled)]:bg-highlight [&.active]:bg-surface [&.active]:text-primary",primary:"bg-primary text-background [&:hover:not(:disabled)]:bg-primary-hover [&:active:not(:disabled)]:bg-primary-active",stop:"bg-surface text-text [&:hover:not(:disabled)]:bg-stop-hover [&:active:not(:disabled)]:bg-highlight"},h_t={default:"h-8 w-8 rounded-md",small:"h-7 w-7 rounded-sm"};function vO(e,n,t,r){return Ns(d_t,f_t[e],h_t[n],t&&"active",r)}const Yt=R.forwardRef(function({active:n=!1,size:t="default",variant:r="default",className:s,...i},a){return f.jsx("button",{ref:a,className:vO(r,t,n,s),...i})});function nb({active:e=!1,size:n="default",variant:t="default",className:r,...s}){return f.jsx("a",{className:vO(t,n,e,r),...s})}const __t={default:"h-8 rounded-md border border-border bg-background px-2.5 py-1.5 focus:border-text",inline:"h-8 rounded-none border-x-0 border-t-0 border-b border-transparent bg-transparent px-0 py-0 focus:border-text"};function ns({variant:e="default",className:n,...t}){return f.jsx("input",{className:Ns("w-full font-sans text-sm font-normal text-text outline-none placeholder:text-muted disabled:cursor-default disabled:opacity-45",__t[e],n),...t})}function ir({active:e=!1,danger:n=!1,size:t="default",className:r,...s}){return f.jsx("button",{className:Ns("model-item flex w-full items-center justify-between gap-2 rounded-sm px-2 text-start transition-[background,color] duration-120 ease-standard hover:bg-surface focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-text focus-visible:outline-offset-2 disabled:cursor-default disabled:opacity-45 [&_.model-id]:block [&_.model-id]:text-xs [&_.model-id]:text-muted",t==="compact"?"min-h-6 py-0.5 text-menu":"min-h-8 py-1.5 text-sm",e&&"bg-surface",n&&"text-accent-red hover:text-accent-red",r),...s})}function Lt({className:e,...n}){return f.jsx("span",{className:Ns("spinner h-[13px] w-[13px] shrink-0 animate-[spin_0.8s_linear_infinite] rounded-full border-2 border-border border-t-primary",e),...n})}function rs({className:e,...n}){return f.jsx("div",{className:Ns("flex items-center gap-2 px-0 py-1 text-sm text-subtext",e),...n})}const p_t={success:"text-accent-green",danger:"text-accent-red",info:"text-accent-teal",warning:"text-accent-amber",caution:"text-accent-orange",accent:"text-accent-purple",neutral:"text-muted"};function rb({tone:e="neutral",live:n=!1,className:t,children:r,...s}){return f.jsxs("span",{className:Ns("status-badge inline-flex items-center gap-1.5 whitespace-nowrap text-sm font-medium text-text",t),...s,children:[f.jsx("span",{className:Ns("h-[7px] w-[7px] shrink-0 rounded-full bg-current",p_t[e],n&&"animate-[or-pulse_1.2s_ease-in-out_infinite]")}),r]})}const m_t=["relative h-5.5 w-9.5 flex-none rounded-full border border-border bg-surface","transition-[background,border-color] duration-120 ease-standard","[&_span]:absolute [&_span]:start-[3px] [&_span]:top-[3px] [&_span]:h-3.5 [&_span]:w-3.5","[&_span]:rounded-full [&_span]:bg-muted [&_span]:transition-[translate,background] [&_span]:duration-120 [&_span]:ease-standard","hover:border-border-strong","disabled:cursor-default disabled:opacity-45 focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-text focus-visible:outline-offset-2"].join(" ");function bO(e,n){return Ns(m_t,e&&"border-primary bg-primary [&_span]:translate-x-4 [&_span]:bg-background",n)}function x6({checked:e=!1,className:n,children:t,...r}){return f.jsx("button",{role:"switch","aria-checked":e,className:bO(e,n),...r,children:t??f.jsx("span",{})})}function g_t({checked:e=!1,className:n,...t}){return f.jsx("span",{className:bO(e,n),...t,children:f.jsx("span",{})})}var eo=CM();const v_t=Gp(eo);function b_t(e){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css",n.appendChild(t),t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}const y_t=e=>{switch(e){case"success":return S_t;case"info":return C_t;case"warning":return k_t;case"error":return E_t;default:return null}},x_t=Array(12).fill(0),w_t=({visible:e,className:n})=>Je.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":e},Je.createElement("div",{className:"sonner-spinner"},x_t.map((t,r)=>Je.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),S_t=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Je.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),k_t=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Je.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),C_t=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Je.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),E_t=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Je.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),N_t=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},Je.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Je.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),z_t=()=>{const[e,n]=Je.useState(document.hidden);return Je.useEffect(()=>{const t=()=>{n(document.hidden)};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[]),e};let j_t=1;const T_t=100,iz=e=>{var n;return typeof(e==null?void 0:e.id)=="number"||(e==null||(n=e.id)==null?void 0:n.length)>0?e.id:j_t++};class A_t{constructor(){this.subscribe=n=>(this.subscribers.push(n),this.getActiveToasts().forEach(t=>n(t)),()=>{const t=this.subscribers.indexOf(n);this.subscribers.splice(t,1)}),this.publish=n=>{this.subscribers.forEach(t=>t(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n],this.trimHistory()},this.trimHistory=()=>{let n=this.toasts.length-T_t;n<=0||(this.toasts=this.toasts.filter(t=>n>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),n--,!1):!0))},this.create=n=>{const{message:t,...r}=n,s=iz(n),i=this.pendingDismissals.get(s);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(s),this.dismissedToasts.delete(s));const a=this.dismissedToasts.has(s),o=n.dismissible===void 0?!0:n.dismissible;return a&&(this.dismissedToasts.delete(s),this.toasts=this.toasts.filter(u=>u.id!==s)),(a?void 0:this.toasts.find(u=>u.id===s))?this.toasts=this.toasts.map(u=>u.id===s?(this.publish({...u,...n,id:s,title:t}),{...u,...n,id:s,dismissible:o,title:t}):u):this.addToast({title:t,...r,dismissible:o,id:s}),s},this.dismiss=n=>{if(n==null)return this.getActiveToasts().forEach(r=>{this.dismissedToasts.add(r.id),this.subscribers.forEach(s=>s({id:r.id,dismiss:!0}))}),n;this.dismissedToasts.add(n);const t=this.pendingDismissals.get(n);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(n,requestAnimationFrame(()=>{this.pendingDismissals.delete(n),this.subscribers.forEach(r=>r({id:n,dismiss:!0}))})),n},this.message=(n,t)=>this.create({...t,message:n,type:void 0}),this.error=(n,t)=>this.create({...t,message:n,type:"error"}),this.success=(n,t)=>this.create({...t,type:"success",message:n}),this.info=(n,t)=>this.create({...t,type:"info",message:n}),this.warning=(n,t)=>this.create({...t,type:"warning",message:n}),this.loading=(n,t)=>this.create({...t,type:"loading",message:n}),this.promise=(n,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:n,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));const s=Promise.resolve(n instanceof Function?n():n);let i=r!==void 0,a;const o=s.then(async u=>{if(a=["resolve",u],Je.isValidElement(u))i=!1,this.create({id:r,type:"default",message:u});else if(M_t(u)&&!u.ok){i=!1;const d=typeof t.error=="function"?await t.error(`HTTP error! status: ${u.status}`):t.error,p=typeof t.description=="function"?await t.description(`HTTP error! status: ${u.status}`):t.description,x=typeof d=="object"&&!Je.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:p,...x})}else if(u instanceof Error){i=!1;const d=typeof t.error=="function"?await t.error(u):t.error,p=typeof t.description=="function"?await t.description(u):t.description,x=typeof d=="object"&&!Je.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:p,...x})}else if(t.success!==void 0){i=!1;const d=typeof t.success=="function"?await t.success(u):t.success,p=typeof t.description=="function"?await t.description(u):t.description,x=typeof d=="object"&&!Je.isValidElement(d)?d:{message:d};this.create({id:r,type:"success",description:p,...x})}}).catch(async u=>{if(a=["reject",u],t.error!==void 0){i=!1;const _=typeof t.error=="function"?await t.error(u):t.error,d=typeof t.description=="function"?await t.description(u):t.description,m=typeof _=="object"&&!Je.isValidElement(_)?_:{message:_};this.create({id:r,type:"error",description:d,...m})}}).finally(()=>{i&&(this.dismiss(r),r=void 0),t.finally==null||t.finally.call(t)}),l=()=>new Promise((u,_)=>o.then(()=>a[0]==="reject"?_(a[1]):u(a[1])).catch(_));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(n,t)=>{const r=iz(t);return this.create({...t,jsx:n(r),id:r,type:void 0}),r},this.getActiveToasts=()=>this.toasts.filter(n=>!this.dismissedToasts.has(n.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}}const bi=new A_t,R_t=(e,n)=>bi.message(e,n),M_t=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",D_t=R_t,L_t=()=>bi.toasts,O_t=()=>bi.getActiveToasts(),I_t=Object.assign(D_t,{success:bi.success,info:bi.info,warning:bi.warning,error:bi.error,custom:bi.custom,message:bi.message,promise:bi.promise,dismiss:bi.dismiss,loading:bi.loading},{getHistory:L_t,getToasts:O_t});b_t("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Lg(e){return e.label!==void 0}const B_t=3,$_t="24px",P_t="16px",az=4e3,F_t=356,H_t=14,q_t=45,U_t=200;function bo(...e){return e.filter(Boolean).join(" ")}function G_t(e){const[n,t]=e.split("-"),r=[];return n&&r.push(n),t&&r.push(t),r}const W_t=e=>{var n,t,r,s,i,a,o,l,u;const{invert:_,toast:d,unstyled:p,interacting:m,setHeights:x,visibleToasts:S,heights:v,index:b,toasts:w,expanded:y,removeToast:C,defaultRichColors:E,closeButton:N,style:T,cancelButtonStyle:z,actionButtonStyle:M,className:I="",descriptionClassName:B="",duration:$,position:U,gap:H,expandByDefault:Y,classNames:V,icons:X,closeButtonAriaLabel:ee="Close toast"}=e,[O,L]=Je.useState(null),[F,q]=Je.useState(null),[G,re]=Je.useState(!1),[ce,oe]=Je.useState(!1),[te,Q]=Je.useState(!1),[le,ae]=Je.useState(!1),[de,pe]=Je.useState(!1),[we,be]=Je.useState(0),[Pe,Be]=Je.useState(0),ze=Je.useRef(d.duration||$||az),it=Je.useRef(null),bt=Je.useRef(null),It=b===0,$t=b+1<=S,jt=d.type,ct=jt??"default",ut=d.dismissible!==!1,Ht=d.className||"",Se=d.descriptionClassName||"",Ae=Je.useMemo(()=>v.findIndex(gt=>gt.toastId===d.id)||0,[v,d.id]),Ze=Je.useMemo(()=>{var gt;return(gt=d.closeButton)!=null?gt:N},[d.closeButton,N]),ht=Je.useMemo(()=>d.duration||$||az,[d.duration,$]),wt=Je.useRef(0),en=Je.useRef(0),Ve=Je.useRef(0),qt=Je.useRef(null),[ln,cn]=U.split("-"),Mt=Je.useMemo(()=>v.reduce((gt,un,vn)=>vn>=Ae?gt:gt+un.height,0),[v,Ae]),er=z_t(),tn=Je.useMemo(()=>{var gt;return(gt=e.swipeDirections)!=null?gt:G_t(U)},[e.swipeDirections,U]),Mr=d.invert||_,tr=jt==="loading";en.current=Je.useMemo(()=>Ae*H+Mt,[Ae,Mt]),Je.useEffect(()=>{ze.current=ht},[ht]),Je.useEffect(()=>{re(!0)},[]),Je.useEffect(()=>{const gt=bt.current;if(gt){const un=gt.getBoundingClientRect().height;return Be(un),x(vn=>[{toastId:d.id,height:un,position:d.position},...vn]),()=>x(vn=>vn.filter(Zt=>Zt.toastId!==d.id))}},[x,d.id]),Je.useLayoutEffect(()=>{if(!G)return;const gt=bt.current,un=gt.style.height;gt.style.height="auto";const vn=gt.getBoundingClientRect().height;gt.style.height=un,Be(vn),x(Zt=>Zt.find(fn=>fn.toastId===d.id)?Zt.map(fn=>fn.toastId===d.id?{...fn,height:vn}:fn):[{toastId:d.id,height:vn,position:d.position},...Zt])},[G,d.title,d.description,x,d.id,d.jsx,d.action,d.cancel]);const qn=Je.useCallback(()=>{oe(!0),be(en.current),x(gt=>gt.filter(un=>un.toastId!==d.id)),setTimeout(()=>{C(d)},U_t)},[d,C,x,en]);Je.useEffect(()=>{if(d.promise&&jt==="loading"||d.duration===1/0||d.type==="loading")return;let gt;return y||m||er?(()=>{if(Ve.current{ze.current!==1/0&&(wt.current=new Date().getTime(),gt=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),qn()},ze.current))})(),()=>clearTimeout(gt)},[y,m,d,jt,er,qn]),Je.useEffect(()=>{d.delete&&(qn(),d.onDismiss==null||d.onDismiss.call(d,d))},[qn,d.delete]);function Sr(){var gt;if(X!=null&&X.loading){var un;return Je.createElement("div",{className:bo(V==null?void 0:V.loader,d==null||(un=d.classNames)==null?void 0:un.loader,"sonner-loader"),"data-visible":jt==="loading"},X.loading)}return Je.createElement(w_t,{className:bo(V==null?void 0:V.loader,d==null||(gt=d.classNames)==null?void 0:gt.loader),visible:jt==="loading"})}const $n=d.icon||(X==null?void 0:X[jt])||y_t(jt);var Wr,kr;return Je.createElement("li",{tabIndex:0,ref:bt,className:bo(I,Ht,V==null?void 0:V.toast,d==null||(n=d.classNames)==null?void 0:n.toast,V==null?void 0:V[ct],d==null||(t=d.classNames)==null?void 0:t[ct]),"data-sonner-toast":"","data-rich-colors":(Wr=d.richColors)!=null?Wr:E,"data-styled":!(d.jsx||d.unstyled||p),"data-mounted":G,"data-promise":!!d.promise,"data-swiped":de,"data-removed":ce,"data-visible":$t,"data-y-position":ln,"data-x-position":cn,"data-index":b,"data-front":It,"data-swiping":te,"data-dismissible":ut,"data-type":jt,"data-invert":Mr,"data-swipe-out":le,"data-swipe-direction":F,"data-expanded":!!(y||Y&&G),"data-testid":d.testId,style:{"--index":b,"--toasts-before":b,"--z-index":w.length-b,"--offset":`${ce?we:en.current}px`,"--initial-height":Y?"auto":`${Pe}px`,...T,...d.style},onDragEnd:()=>{Q(!1),L(null),qt.current=null},onPointerDown:gt=>{gt.button!==2&&(tr||!ut||(it.current=new Date,be(en.current),gt.target.setPointerCapture(gt.pointerId),gt.target.tagName!=="BUTTON"&&(Q(!0),qt.current={x:gt.clientX,y:gt.clientY})))},onPointerUp:()=>{var gt,un,vn;if(le||!ut)return;qt.current=null;const Zt=Number(((gt=bt.current)==null?void 0:gt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Kn=Number(((un=bt.current)==null?void 0:un.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),fn=new Date().getTime()-((vn=it.current)==null?void 0:vn.getTime()),Nn=O==="x"?Zt:Kn,Vt=Math.abs(Nn)/fn;if((O==="x"?tn.includes(Zt>0?"right":"left"):tn.includes(Kn>0?"bottom":"top"))&&(Math.abs(Nn)>=q_t||Vt>.11)){be(en.current),d.onDismiss==null||d.onDismiss.call(d,d),q(O==="x"?Zt>0?"right":"left":Kn>0?"down":"up"),qn(),ae(!0);return}else{var At,Fe;(At=bt.current)==null||At.style.setProperty("--swipe-amount-x","0px"),(Fe=bt.current)==null||Fe.style.setProperty("--swipe-amount-y","0px")}pe(!1),Q(!1),L(null)},onPointerMove:gt=>{var un,vn,Zt;if(!qt.current||!ut||((un=window.getSelection())==null?void 0:un.toString().length)>0)return;const fn=gt.clientY-qt.current.y,Nn=gt.clientX-qt.current.x;!O&&(Math.abs(Nn)>1||Math.abs(fn)>1)&&L(Math.abs(Nn)>Math.abs(fn)?"x":"y");let Vt={x:0,y:0};const xt=At=>1/(1.5+Math.abs(At)/20);if(O==="y"){if(tn.includes("top")||tn.includes("bottom"))if(tn.includes("top")&&fn<0||tn.includes("bottom")&&fn>0)Vt.y=fn;else{const At=fn*xt(fn);Vt.y=Math.abs(At)0)Vt.x=Nn;else{const At=Nn*xt(Nn);Vt.x=Math.abs(At)0||Math.abs(Vt.y)>0)&&pe(!0),(vn=bt.current)==null||vn.style.setProperty("--swipe-amount-x",`${Vt.x}px`),(Zt=bt.current)==null||Zt.style.setProperty("--swipe-amount-y",`${Vt.y}px`)}},Ze&&!d.jsx&&jt!=="loading"?Je.createElement("button",{"aria-label":ee,"data-disabled":tr,"data-close-button":!0,onClick:tr||!ut?()=>{}:()=>{qn(),d.onDismiss==null||d.onDismiss.call(d,d)},className:bo(V==null?void 0:V.closeButton,d==null||(r=d.classNames)==null?void 0:r.closeButton)},(kr=X==null?void 0:X.close)!=null?kr:N_t):null,(jt||d.icon||d.promise)&&d.icon!==null&&((X==null?void 0:X[jt])!==null||d.icon)?Je.createElement("div",{"data-icon":"",className:bo(V==null?void 0:V.icon,d==null||(s=d.classNames)==null?void 0:s.icon)},jt==="loading"?d.icon||Sr():d.promise?Sr():null,jt!=="loading"?$n:null):null,Je.createElement("div",{"data-content":"",className:bo(V==null?void 0:V.content,d==null||(i=d.classNames)==null?void 0:i.content)},Je.createElement("div",{"data-title":"",className:bo(V==null?void 0:V.title,d==null||(a=d.classNames)==null?void 0:a.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?Je.createElement("div",{"data-description":"",className:bo(B,Se,V==null?void 0:V.description,d==null||(o=d.classNames)==null?void 0:o.description)},typeof d.description=="function"?d.description():d.description):null),Je.isValidElement(d.cancel)?d.cancel:d.cancel&&Lg(d.cancel)?Je.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||z,onClick:gt=>{Lg(d.cancel)&&ut&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,gt),qn())},className:bo(V==null?void 0:V.cancelButton,d==null||(l=d.classNames)==null?void 0:l.cancelButton)},d.cancel.label):null,Je.isValidElement(d.action)?d.action:d.action&&Lg(d.action)?Je.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||M,onClick:gt=>{Lg(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,gt),!gt.defaultPrevented&&qn())},className:bo(V==null?void 0:V.actionButton,d==null||(u=d.classNames)==null?void 0:u.actionButton)},d.action.label):null)};function oz(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function V_t(e,n){const t={};return[e,n].forEach((r,s)=>{const i=s===1,a=i?"--mobile-offset":"--offset",o=i?P_t:$_t;function l(u){["top","right","bottom","left"].forEach(_=>{t[`${a}-${_}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?t[`${a}-${u}`]=o:t[`${a}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):l(o)}),t}const K_t=Je.forwardRef(function(n,t){const{id:r,invert:s,position:i="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:u,offset:_,mobileOffset:d,theme:p="light",richColors:m,duration:x,style:S,visibleToasts:v=B_t,toastOptions:b,dir:w=oz(),gap:y=H_t,icons:C,customAriaLabel:E,containerAriaLabel:N="Notifications"}=n,[T,z]=Je.useState([]),M=Je.useMemo(()=>r?T.filter(re=>re.toasterId===r):T.filter(re=>!re.toasterId),[T,r]),I=Je.useMemo(()=>Array.from(new Set([i].concat(M.filter(re=>re.position).map(re=>re.position)))),[M,i]),[B,$]=Je.useState([]),[U,H]=Je.useState(!1),[Y,V]=Je.useState(!1),[X,ee]=Je.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),O=Je.useRef(null),L=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),F=Je.useRef(null),q=Je.useRef(!1),G=Je.useCallback(re=>{z(ce=>{var oe;return(oe=ce.find(te=>te.id===re.id))!=null&&oe.delete||bi.dismiss(re.id),ce.filter(({id:te})=>te!==re.id)})},[]);return Je.useEffect(()=>bi.subscribe(re=>{if(re.dismiss){requestAnimationFrame(()=>{z(ce=>ce.map(oe=>oe.id===re.id?{...oe,delete:!0}:oe))});return}setTimeout(()=>{v_t.flushSync(()=>{z(ce=>{const oe=ce.findIndex(te=>te.id===re.id);return oe!==-1?[...ce.slice(0,oe),{...ce[oe],...re},...ce.slice(oe+1)]:[re,...ce]})})})}),[]),Je.useEffect(()=>{if(p!=="system"){ee(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ee("dark"):ee("light")),typeof window>"u")return;const re=window.matchMedia("(prefers-color-scheme: dark)");try{re.addEventListener("change",({matches:ce})=>{ee(ce?"dark":"light")})}catch{re.addListener(({matches:oe})=>{try{ee(oe?"dark":"light")}catch(te){console.error(te)}})}},[p]),Je.useEffect(()=>{T.length<=1&&H(!1)},[T]),Je.useEffect(()=>{const re=ce=>{var oe;if(a.length>0&&a.every(le=>ce[le]||ce.code===le)){var Q;H(!0),(Q=O.current)==null||Q.focus()}ce.code==="Escape"&&(document.activeElement===O.current||(oe=O.current)!=null&&oe.contains(document.activeElement))&&H(!1)};return document.addEventListener("keydown",re),()=>document.removeEventListener("keydown",re)},[a]),Je.useEffect(()=>{if(O.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,q.current=!1)}},[O.current]),Je.createElement("section",{ref:t,"aria-label":E??`${N} ${L}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},I.map((re,ce)=>{var oe;const[te,Q]=re.split("-");return M.length?Je.createElement("ol",{key:re,dir:w==="auto"?oz():w,tabIndex:-1,ref:O,className:u,"data-sonner-toaster":!0,"data-sonner-theme":X,"data-y-position":te,"data-x-position":Q,style:{"--front-toast-height":`${((oe=B[0])==null?void 0:oe.height)||0}px`,"--width":`${F_t}px`,"--gap":`${y}px`,...S,...V_t(_,d)},onBlur:le=>{q.current&&!le.currentTarget.contains(le.relatedTarget)&&(q.current=!1,F.current&&(F.current.focus({preventScroll:!0}),F.current=null))},onFocus:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||q.current||(q.current=!0,F.current=le.relatedTarget)},onMouseEnter:()=>H(!0),onMouseMove:()=>H(!0),onMouseLeave:()=>{Y||H(!1)},onDragEnd:()=>H(!1),onPointerDown:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||V(!0)},onPointerUp:()=>V(!1)},M.filter(le=>!le.position&&ce===0||le.position===re).map((le,ae)=>{var de,pe;return Je.createElement(W_t,{key:le.id,icons:C,index:ae,toast:le,defaultRichColors:m,duration:(de=b==null?void 0:b.duration)!=null?de:x,className:b==null?void 0:b.className,descriptionClassName:b==null?void 0:b.descriptionClassName,invert:s,visibleToasts:v,closeButton:(pe=b==null?void 0:b.closeButton)!=null?pe:l,interacting:Y,position:re,style:b==null?void 0:b.style,unstyled:b==null?void 0:b.unstyled,classNames:b==null?void 0:b.classNames,cancelButtonStyle:b==null?void 0:b.cancelButtonStyle,actionButtonStyle:b==null?void 0:b.actionButtonStyle,closeButtonAriaLabel:b==null?void 0:b.closeButtonAriaLabel,removeToast:G,toasts:M.filter(we=>we.position==le.position),heights:B.filter(we=>we.position==le.position),setHeights:$,expandByDefault:o,gap:y,expanded:U,swipeDirections:n.swipeDirections})})):null}))});function Q_t(e){const[n]=nO();return f.jsx(K_t,{theme:n,...e})}function Vn(e,n,t){I_t[n](e,{duration:n==="warning"||n==="error"?1/0:5e3,position:"top-center",closeButton:!0,...t})}function w6({content:e,children:n,className:t}){const r=R.useRef(null),s=R.useRef(null);function i(){const o=r.current,l=s.current;if(!o||!l)return;l.matches(":popover-open")||l.showPopover();const u=o.getBoundingClientRect(),_=l.getBoundingClientRect(),d=Math.max(8,Math.min(u.left+u.width/2-_.width/2,window.innerWidth-_.width-8));l.style.left=`${d}px`,l.style.top=`${Math.max(8,u.top-_.height-6)}px`}function a(){var o,l;(o=r.current)!=null&&o.matches(":hover, :focus")||(l=s.current)==null||l.hidePopover()}return R.useEffect(()=>{const o=()=>{var l;return(l=s.current)==null?void 0:l.hidePopover()};return window.addEventListener("scroll",o,!0),window.addEventListener("resize",o),()=>{window.removeEventListener("scroll",o,!0),window.removeEventListener("resize",o)}},[]),f.jsxs("span",{ref:r,className:Ns("group relative inline-flex cursor-help rounded-full outline-none focus-visible:outline-2 focus-visible:outline-text focus-visible:outline-offset-2",t),tabIndex:0,role:"img","aria-label":e,onMouseEnter:i,onMouseLeave:a,onFocus:i,onBlur:a,onKeyDown:o=>{var l;o.key==="Escape"&&((l=s.current)!=null&&l.matches(":popover-open"))&&(o.preventDefault(),o.stopPropagation(),s.current.hidePopover())},children:[n,f.jsx("span",{ref:s,popover:"manual",role:"tooltip",className:"pointer-events-none fixed inset-auto m-0 w-max max-w-64 whitespace-normal rounded-sm border-0 bg-text px-2 py-1.5 font-sans text-sm font-normal leading-snug text-background shadow-control-subtle",children:e})]})}const Y_t='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function sb(e,n,t="[data-initial-focus]"){const r=R.useRef(n);r.current=n,R.useEffect(()=>{const s=e.current;if(!s)return;const i=document.activeElement instanceof HTMLElement?document.activeElement:null,a=()=>[...s.querySelectorAll(Y_t)];(s.querySelector(t)??a()[0]??s).focus();const o=l=>{if(l.key==="Escape"){if(s.querySelector(":popover-open"))return;l.preventDefault(),l.stopPropagation(),r.current();return}if(l.key!=="Tab")return;const u=a(),_=u[0],d=u.at(-1);!_||!d?(l.preventDefault(),s.focus()):l.shiftKey&&document.activeElement===_?(l.preventDefault(),d.focus()):!l.shiftKey&&document.activeElement===d&&(l.preventDefault(),_.focus())};return document.addEventListener("keydown",o,!0),()=>{document.removeEventListener("keydown",o,!0),i==null||i.focus()}},[e,t])}function yO({host:e,preview:n,currentClientAttached:t,stopping:r,onClose:s,onConfirm:i}){const a=R.useRef(null),o=Math.max(0,n.attachmentCount-(t?1:0)),l=[];return n.activeTurnCount>0&&l.push(n.activeTurnCount===1?vOe():TOe({count:Wt(n.activeTurnCount)})),n.pendingPermissionCount>0&&l.push(n.pendingPermissionCount===1?nOe():MLe({count:Wt(n.pendingPermissionCount)})),o>0&&l.push(o===1?uOe():wOe({count:Wt(o)})),n.queuedMessageCount>0&&l.push(n.queuedMessageCount===1?_Oe():EOe({count:Wt(n.queuedMessageCount)})),n.activeRunCount>0&&l.push(n.activeRunCount===1?aOe():GLe({count:Wt(n.activeRunCount)})),sb(a,s),eo.createPortal(f.jsx("div",{className:"fixed inset-0 z-200 flex items-center justify-center bg-modal-backdrop p-5",onClick:u=>{!r&&u.target===u.currentTarget&&s()},children:f.jsxs("div",{ref:a,className:"w-120 max-w-full rounded-xl border border-border bg-background p-6 shadow-modal",role:"dialog","aria-modal":"true","aria-labelledby":"remote-stop-dialog-title","aria-describedby":l.length>0?"remote-stop-dialog-impact":void 0,tabIndex:-1,children:[f.jsx("h2",{id:"remote-stop-dialog-title",className:"m-0 text-xl font-medium text-text",children:FLe({host:Ne(e)})}),l.length>0&&f.jsxs("div",{id:"remote-stop-dialog-impact",className:"mt-4 text-sm text-text",children:[f.jsx("p",{className:"m-0 font-medium",children:ZLe()}),f.jsx("ul",{className:"mt-2 mb-0 space-y-1 ps-5",children:l.map(u=>f.jsx("li",{children:u},u))})]}),f.jsxs("div",{className:"mt-6 flex justify-end gap-2.5",children:[f.jsx(Le,{disabled:r,onClick:s,children:Nd()}),f.jsx(Le,{variant:"danger",disabled:r,onClick:i,children:r?DOe():ILe()})]})]})}),document.body)}var jx={exports:{}},lz;function X_t(){return lz||(lz=1,(function(e,n){(function(t,r){e.exports=r()})(self,(()=>(()=>{var t={};return(()=>{var r=t;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(s){this._terminal=s}dispose(){}fit(){const s=this.proposeDimensions();if(!s||!this._terminal||isNaN(s.cols)||isNaN(s.rows))return;const i=this._terminal._core;this._terminal.rows===s.rows&&this._terminal.cols===s.cols||(i._renderService.clear(),this._terminal.resize(s.cols,s.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const s=this._terminal._core,i=s._renderService.dimensions;if(i.css.cell.width===0||i.css.cell.height===0)return;const a=this._terminal.options.scrollback===0?0:s.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(o.getPropertyValue("height")),u=Math.max(0,parseInt(o.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),d=l-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),p=u-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-a;return{cols:Math.max(2,Math.floor(p/i.css.cell.width)),rows:Math.max(1,Math.floor(d/i.css.cell.height))}}}})(),t})()))})(jx)),jx.exports}var Z_t=X_t(),Tx={exports:{}},cz;function J_t(){return cz||(cz=1,(function(e,n){(function(t,r){e.exports=r()})(self,(()=>(()=>{var t={6:(a,o)=>{function l(_){try{const d=new URL(_),p=d.password&&d.username?`${d.protocol}//${d.username}:${d.password}@${d.host}`:d.username?`${d.protocol}//${d.username}@${d.host}`:`${d.protocol}//${d.host}`;return _.toLocaleLowerCase().startsWith(p.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(o,"__esModule",{value:!0}),o.LinkComputer=o.WebLinkProvider=void 0,o.WebLinkProvider=class{constructor(_,d,p,m={}){this._terminal=_,this._regex=d,this._handler=p,this._options=m}provideLinks(_,d){const p=u.computeLink(_,this._regex,this._terminal,this._handler);d(this._addCallbacks(p))}_addCallbacks(_){return _.map((d=>(d.leave=this._options.leave,d.hover=(p,m)=>{if(this._options.hover){const{range:x}=d;this._options.hover(p,m,x)}},d)))}};class u{static computeLink(d,p,m,x){const S=new RegExp(p.source,(p.flags||"")+"g"),[v,b]=u._getWindowedLineStrings(d-1,m),w=v.join("");let y;const C=[];for(;y=S.exec(w);){const E=y[0];if(!l(E))continue;const[N,T]=u._mapStrIdx(m,b,0,y.index),[z,M]=u._mapStrIdx(m,N,T,E.length);if(N===-1||T===-1||z===-1||M===-1)continue;const I={start:{x:T+1,y:N+1},end:{x:M,y:z+1}};C.push({range:I,text:E,activate:x})}return C}static _getWindowedLineStrings(d,p){let m,x=d,S=d,v=0,b="";const w=[];if(m=p.buffer.active.getLine(d)){const y=m.translateToString(!0);if(m.isWrapped&&y[0]!==" "){for(v=0;(m=p.buffer.active.getLine(--x))&&v<2048&&(b=m.translateToString(!0),v+=b.length,w.push(b),m.isWrapped&&b.indexOf(" ")===-1););w.reverse()}for(w.push(y),v=0;(m=p.buffer.active.getLine(++S))&&m.isWrapped&&v<2048&&(b=m.translateToString(!0),v+=b.length,w.push(b),b.indexOf(" ")===-1););}return[w,x]}static _mapStrIdx(d,p,m,x){const S=d.buffer.active,v=S.getNullCell();let b=m;for(;x;){const w=S.getLine(p);if(!w)return[-1,-1];for(let y=b;y{var a=i;Object.defineProperty(a,"__esModule",{value:!0}),a.WebLinksAddon=void 0;const o=s(6),l=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function u(_,d){const p=window.open();if(p){try{p.opener=null}catch{}p.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}a.WebLinksAddon=class{constructor(_=u,d={}){this._handler=_,this._options=d}activate(_){this._terminal=_;const d=this._options,p=d.urlRegex||l;this._linkProvider=this._terminal.registerLinkProvider(new o.WebLinkProvider(this._terminal,p,this._handler,d))}dispose(){var _;(_=this._linkProvider)==null||_.dispose()}}})(),i})()))})(Tx)),Tx.exports}var e0t=J_t(),Ax={exports:{}},uz;function t0t(){return uz||(uz=1,(function(e,n){(function(t,r){e.exports=r()})(globalThis,(()=>(()=>{var t={4567:function(a,o,l){var u=this&&this.__decorate||function(w,y,C,E){var N,T=arguments.length,z=T<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,C):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(w,y,C,E);else for(var M=w.length-1;M>=0;M--)(N=w[M])&&(z=(T<3?N(z):T>3?N(y,C,z):N(y,C))||z);return T>3&&z&&Object.defineProperty(y,C,z),z},_=this&&this.__param||function(w,y){return function(C,E){y(C,E,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=l(9042),p=l(9924),m=l(844),x=l(4725),S=l(2585),v=l(3656);let b=o.AccessibilityManager=class extends m.Disposable{constructor(w,y,C,E){super(),this._terminal=w,this._coreBrowserService=C,this._renderService=E,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let N=0;Nthis._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new p.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` `)))),this.register(this._terminal.onA11yTab((N=>this._handleTab(N)))),this.register(this._terminal.onKey((N=>this._handleKey(N.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,v.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,m.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(w){for(let y=0;y0?this._charsToConsume.shift()!==w&&(this._charsToAnnounce+=w):this._charsToAnnounce+=w,w===` -`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(w){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(w)||this._charsToConsume.push(w)}_refreshRows(w,y){this._liveRegionDebouncer.refresh(w,y,this._terminal.rows)}_renderRows(w,y){const C=this._terminal.buffer,E=C.lines.length.toString();for(let N=w;N<=y;N++){const T=C.lines.get(C.ydisp+N),z=[],M=(T==null?void 0:T.translateToString(!0,void 0,void 0,z))||"",O=(C.ydisp+N+1).toString(),B=this._rowElements[N];B&&(M.length===0?(B.innerText=" ",this._rowColumns.set(B,[0,1])):(B.textContent=M,this._rowColumns.set(B,z)),B.setAttribute("aria-posinset",O),B.setAttribute("aria-setsize",E))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(w,y){const C=w.target,E=this._rowElements[y===0?1:this._rowElements.length-2];if(C.getAttribute("aria-posinset")===(y===0?"1":`${this._terminal.buffer.lines.length}`)||w.relatedTarget!==E)return;let N,T;if(y===0?(N=C,T=this._rowElements.pop(),this._rowContainer.removeChild(T)):(N=this._rowElements.shift(),T=C,this._rowContainer.removeChild(N)),N.removeEventListener("focus",this._topBoundaryFocusListener),T.removeEventListener("focus",this._bottomBoundaryFocusListener),y===0){const z=this._createAccessibilityTreeNode();this._rowElements.unshift(z),this._rowContainer.insertAdjacentElement("afterbegin",z)}else{const z=this._createAccessibilityTreeNode();this._rowElements.push(z),this._rowContainer.appendChild(z)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(y===0?-1:1),this._rowElements[y===0?1:this._rowElements.length-2].focus(),w.preventDefault(),w.stopImmediatePropagation()}_handleSelectionChange(){var M;if(this._rowElements.length===0)return;const w=document.getSelection();if(!w)return;if(w.isCollapsed)return void(this._rowContainer.contains(w.anchorNode)&&this._terminal.clearSelection());if(!w.anchorNode||!w.focusNode)return void console.error("anchorNode and/or focusNode are null");let y={node:w.anchorNode,offset:w.anchorOffset},C={node:w.focusNode,offset:w.focusOffset};if((y.node.compareDocumentPosition(C.node)&Node.DOCUMENT_POSITION_PRECEDING||y.node===C.node&&y.offset>C.offset)&&([y,C]=[C,y]),y.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(y={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(y.node))return;const E=this._rowElements.slice(-1)[0];if(C.node.compareDocumentPosition(E)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(C={node:E,offset:((M=E.textContent)==null?void 0:M.length)??0}),!this._rowContainer.contains(C.node))return;const N=({node:O,offset:B})=>{const $=O instanceof Text?O.parentNode:O;let U=parseInt($==null?void 0:$.getAttribute("aria-posinset"),10)-1;if(isNaN(U))return console.warn("row is invalid. Race condition?"),null;const H=this._rowColumns.get($);if(!H)return console.warn("columns is null. Race condition?"),null;let Y=B=this._terminal.cols&&(++U,Y=0),{row:U,column:Y}},T=N(y),z=N(C);if(T&&z){if(T.row>z.row||T.row===z.row&&T.column>=z.column)throw new Error("invalid range");this._terminal.select(T.column,T.row,(z.row-T.row)*this._terminal.cols-T.column+z.column)}}_handleResize(w){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let y=this._rowContainer.children.length;yw;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const w=this._coreBrowserService.mainDocument.createElement("div");return w.setAttribute("role","listitem"),w.tabIndex=-1,this._refreshRowDimensions(w),w}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let w=0;w{function l(p){return p.replace(/\r?\n/g,"\r")}function u(p,m){return m?"\x1B[200~"+p+"\x1B[201~":p}function _(p,m,x,S){p=u(p=l(p),x.decPrivateModes.bracketedPasteMode&&S.rawOptions.ignoreBracketedPasteMode!==!0),x.triggerDataEvent(p,!0),m.value=""}function d(p,m,x){const S=x.getBoundingClientRect(),v=p.clientX-S.left-10,b=p.clientY-S.top-10;m.style.width="20px",m.style.height="20px",m.style.left=`${v}px`,m.style.top=`${b}px`,m.style.zIndex="1000",m.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=l,o.bracketTextForPaste=u,o.copyHandler=function(p,m){p.clipboardData&&p.clipboardData.setData("text/plain",m.selectionText),p.preventDefault()},o.handlePasteEvent=function(p,m,x,S){p.stopPropagation(),p.clipboardData&&_(p.clipboardData.getData("text/plain"),m,x,S)},o.paste=_,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(p,m,x,S,v){d(p,m,x),v&&S.rightClickSelect(p),m.value=S.selectionText,m.select()}},7239:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const u=l(1505);o.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(_,d,p){this._css.set(_,d,p)}getCss(_,d){return this._css.get(_,d)}setColor(_,d,p){this._color.set(_,d,p)}getColor(_,d){return this._color.get(_,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(l,u,_,d){l.addEventListener(u,_,d);let p=!1;return{dispose:()=>{p||(p=!0,l.removeEventListener(u,_,d))}}}},3551:function(a,o,l){var u=this&&this.__decorate||function(b,w,y,C){var E,N=arguments.length,T=N<3?w:C===null?C=Object.getOwnPropertyDescriptor(w,y):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,w,y,C);else for(var z=b.length-1;z>=0;z--)(E=b[z])&&(T=(N<3?E(T):N>3?E(w,y,T):E(w,y))||T);return N>3&&T&&Object.defineProperty(w,y,T),T},_=this&&this.__param||function(b,w){return function(y,C){w(y,C,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=l(3656),p=l(8460),m=l(844),x=l(2585),S=l(4725);let v=o.Linkifier=class extends m.Disposable{get currentLink(){return this._currentLink}constructor(b,w,y,C,E){super(),this._element=b,this._mouseService=w,this._renderService=y,this._bufferService=C,this._linkProviderService=E,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,m.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,m.toDisposable)((()=>{var N;this._lastMouseEvent=void 0,(N=this._activeProviderReplies)==null||N.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const w=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!w)return;this._isMouseOut=!1;const y=b.composedPath();for(let C=0;C{N==null||N.forEach((T=>{T.link.dispose&&T.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let y=!1;for(const[N,T]of this._linkProviderService.linkProviders.entries())w?(E=this._activeProviderReplies)!=null&&E.get(N)&&(y=this._checkLinkProviderResult(N,b,y)):T.provideLinks(b.y,(z=>{var O,B;if(this._isMouseOut)return;const M=z==null?void 0:z.map(($=>({link:$})));(O=this._activeProviderReplies)==null||O.set(N,M),y=this._checkLinkProviderResult(N,b,y),((B=this._activeProviderReplies)==null?void 0:B.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,w){const y=new Set;for(let C=0;Cb?this._bufferService.cols:T.link.range.end.x;for(let O=z;O<=M;O++){if(y.has(O)){E.splice(N--,1);break}y.add(O)}}}}_checkLinkProviderResult(b,w,y){var N;if(!this._activeProviderReplies)return y;const C=this._activeProviderReplies.get(b);let E=!1;for(let T=0;Tthis._linkAtPosition(z.link,w)));T&&(y=!0,this._handleNewLink(T))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!y)for(let T=0;Tthis._linkAtPosition(M.link,w)));if(z){y=!0,this._handleNewLink(z);break}}return y}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const w=this._positionFromMouseEvent(b,this._element,this._mouseService);w&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,w)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,w){this._currentLink&&this._lastMouseEvent&&(!b||!w||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=w)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,m.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const w=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);w&&this._linkAtPosition(b.link,w)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>{var y,C;return(C=(y=this._currentLink)==null?void 0:y.state)==null?void 0:C.decorations.pointerCursor},set:y=>{var C;(C=this._currentLink)!=null&&C.state&&this._currentLink.state.decorations.pointerCursor!==y&&(this._currentLink.state.decorations.pointerCursor=y,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",y))}},underline:{get:()=>{var y,C;return(C=(y=this._currentLink)==null?void 0:y.state)==null?void 0:C.decorations.underline},set:y=>{var C,E,N;(C=this._currentLink)!=null&&C.state&&((N=(E=this._currentLink)==null?void 0:E.state)==null?void 0:N.decorations.underline)!==y&&(this._currentLink.state.decorations.underline=y,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,y))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((y=>{if(!this._currentLink)return;const C=y.start===0?0:y.start+1+this._bufferService.buffer.ydisp,E=this._bufferService.buffer.ydisp+1+y.end;if(this._currentLink.link.range.start.y>=C&&this._currentLink.link.range.end.y<=E&&(this._clearCurrentLink(C,E),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(b,w,y){var C;(C=this._currentLink)!=null&&C.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(w,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),w.hover&&w.hover(y,w.text)}_fireUnderlineEvent(b,w){const y=b.range,C=this._bufferService.buffer.ydisp,E=this._createLinkUnderlineEvent(y.start.x-1,y.start.y-C-1,y.end.x,y.end.y-C-1,void 0);(w?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(E)}_linkLeave(b,w,y){var C;(C=this._currentLink)!=null&&C.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(w,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),w.leave&&w.leave(y,w.text)}_linkAtPosition(b,w){const y=b.range.start.y*this._bufferService.cols+b.range.start.x,C=b.range.end.y*this._bufferService.cols+b.range.end.x,E=w.y*this._bufferService.cols+w.x;return y<=E&&E<=C}_positionFromMouseEvent(b,w,y){const C=y.getCoords(b,w,this._bufferService.cols,this._bufferService.rows);if(C)return{x:C[0],y:C[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,w,y,C,E){return{x1:b,y1:w,x2:y,y2:C,cols:this._bufferService.cols,fg:E}}};o.Linkifier=v=u([_(1,S.IMouseService),_(2,S.IRenderService),_(3,x.IBufferService),_(4,S.ILinkProviderService)],v)},9042:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(a,o,l){var u=this&&this.__decorate||function(S,v,b,w){var y,C=arguments.length,E=C<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,b):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(S,v,b,w);else for(var N=S.length-1;N>=0;N--)(y=S[N])&&(E=(C<3?y(E):C>3?y(v,b,E):y(v,b))||E);return C>3&&E&&Object.defineProperty(v,b,E),E},_=this&&this.__param||function(S,v){return function(b,w){v(b,w,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=l(511),p=l(2585);let m=o.OscLinkProvider=class{constructor(S,v,b){this._bufferService=S,this._optionsService=v,this._oscLinkService=b}provideLinks(S,v){var M;const b=this._bufferService.buffer.lines.get(S-1);if(!b)return void v(void 0);const w=[],y=this._optionsService.rawOptions.linkHandler,C=new d.CellData,E=b.getTrimmedLength();let N=-1,T=-1,z=!1;for(let O=0;Oy?y.activate(H,Y,$):x(0,Y),hover:(H,Y)=>{var V;return(V=y==null?void 0:y.hover)==null?void 0:V.call(y,H,Y,$)},leave:(H,Y)=>{var V;return(V=y==null?void 0:y.leave)==null?void 0:V.call(y,H,Y,$)}})}z=!1,C.hasExtendedAttrs()&&C.extended.urlId?(T=O,N=C.extended.urlId):(T=-1,N=-1)}}v(w)}};function x(S,v){if(confirm(`Do you want to navigate to ${v}? +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(w){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(w)||this._charsToConsume.push(w)}_refreshRows(w,y){this._liveRegionDebouncer.refresh(w,y,this._terminal.rows)}_renderRows(w,y){const C=this._terminal.buffer,E=C.lines.length.toString();for(let N=w;N<=y;N++){const T=C.lines.get(C.ydisp+N),z=[],M=(T==null?void 0:T.translateToString(!0,void 0,void 0,z))||"",I=(C.ydisp+N+1).toString(),B=this._rowElements[N];B&&(M.length===0?(B.innerText=" ",this._rowColumns.set(B,[0,1])):(B.textContent=M,this._rowColumns.set(B,z)),B.setAttribute("aria-posinset",I),B.setAttribute("aria-setsize",E))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(w,y){const C=w.target,E=this._rowElements[y===0?1:this._rowElements.length-2];if(C.getAttribute("aria-posinset")===(y===0?"1":`${this._terminal.buffer.lines.length}`)||w.relatedTarget!==E)return;let N,T;if(y===0?(N=C,T=this._rowElements.pop(),this._rowContainer.removeChild(T)):(N=this._rowElements.shift(),T=C,this._rowContainer.removeChild(N)),N.removeEventListener("focus",this._topBoundaryFocusListener),T.removeEventListener("focus",this._bottomBoundaryFocusListener),y===0){const z=this._createAccessibilityTreeNode();this._rowElements.unshift(z),this._rowContainer.insertAdjacentElement("afterbegin",z)}else{const z=this._createAccessibilityTreeNode();this._rowElements.push(z),this._rowContainer.appendChild(z)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(y===0?-1:1),this._rowElements[y===0?1:this._rowElements.length-2].focus(),w.preventDefault(),w.stopImmediatePropagation()}_handleSelectionChange(){var M;if(this._rowElements.length===0)return;const w=document.getSelection();if(!w)return;if(w.isCollapsed)return void(this._rowContainer.contains(w.anchorNode)&&this._terminal.clearSelection());if(!w.anchorNode||!w.focusNode)return void console.error("anchorNode and/or focusNode are null");let y={node:w.anchorNode,offset:w.anchorOffset},C={node:w.focusNode,offset:w.focusOffset};if((y.node.compareDocumentPosition(C.node)&Node.DOCUMENT_POSITION_PRECEDING||y.node===C.node&&y.offset>C.offset)&&([y,C]=[C,y]),y.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(y={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(y.node))return;const E=this._rowElements.slice(-1)[0];if(C.node.compareDocumentPosition(E)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(C={node:E,offset:((M=E.textContent)==null?void 0:M.length)??0}),!this._rowContainer.contains(C.node))return;const N=({node:I,offset:B})=>{const $=I instanceof Text?I.parentNode:I;let U=parseInt($==null?void 0:$.getAttribute("aria-posinset"),10)-1;if(isNaN(U))return console.warn("row is invalid. Race condition?"),null;const H=this._rowColumns.get($);if(!H)return console.warn("columns is null. Race condition?"),null;let Y=B=this._terminal.cols&&(++U,Y=0),{row:U,column:Y}},T=N(y),z=N(C);if(T&&z){if(T.row>z.row||T.row===z.row&&T.column>=z.column)throw new Error("invalid range");this._terminal.select(T.column,T.row,(z.row-T.row)*this._terminal.cols-T.column+z.column)}}_handleResize(w){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let y=this._rowContainer.children.length;yw;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const w=this._coreBrowserService.mainDocument.createElement("div");return w.setAttribute("role","listitem"),w.tabIndex=-1,this._refreshRowDimensions(w),w}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let w=0;w{function l(p){return p.replace(/\r?\n/g,"\r")}function u(p,m){return m?"\x1B[200~"+p+"\x1B[201~":p}function _(p,m,x,S){p=u(p=l(p),x.decPrivateModes.bracketedPasteMode&&S.rawOptions.ignoreBracketedPasteMode!==!0),x.triggerDataEvent(p,!0),m.value=""}function d(p,m,x){const S=x.getBoundingClientRect(),v=p.clientX-S.left-10,b=p.clientY-S.top-10;m.style.width="20px",m.style.height="20px",m.style.left=`${v}px`,m.style.top=`${b}px`,m.style.zIndex="1000",m.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=l,o.bracketTextForPaste=u,o.copyHandler=function(p,m){p.clipboardData&&p.clipboardData.setData("text/plain",m.selectionText),p.preventDefault()},o.handlePasteEvent=function(p,m,x,S){p.stopPropagation(),p.clipboardData&&_(p.clipboardData.getData("text/plain"),m,x,S)},o.paste=_,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(p,m,x,S,v){d(p,m,x),v&&S.rightClickSelect(p),m.value=S.selectionText,m.select()}},7239:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const u=l(1505);o.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(_,d,p){this._css.set(_,d,p)}getCss(_,d){return this._css.get(_,d)}setColor(_,d,p){this._color.set(_,d,p)}getColor(_,d){return this._color.get(_,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(l,u,_,d){l.addEventListener(u,_,d);let p=!1;return{dispose:()=>{p||(p=!0,l.removeEventListener(u,_,d))}}}},3551:function(a,o,l){var u=this&&this.__decorate||function(b,w,y,C){var E,N=arguments.length,T=N<3?w:C===null?C=Object.getOwnPropertyDescriptor(w,y):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,w,y,C);else for(var z=b.length-1;z>=0;z--)(E=b[z])&&(T=(N<3?E(T):N>3?E(w,y,T):E(w,y))||T);return N>3&&T&&Object.defineProperty(w,y,T),T},_=this&&this.__param||function(b,w){return function(y,C){w(y,C,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=l(3656),p=l(8460),m=l(844),x=l(2585),S=l(4725);let v=o.Linkifier=class extends m.Disposable{get currentLink(){return this._currentLink}constructor(b,w,y,C,E){super(),this._element=b,this._mouseService=w,this._renderService=y,this._bufferService=C,this._linkProviderService=E,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,m.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,m.toDisposable)((()=>{var N;this._lastMouseEvent=void 0,(N=this._activeProviderReplies)==null||N.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const w=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!w)return;this._isMouseOut=!1;const y=b.composedPath();for(let C=0;C{N==null||N.forEach((T=>{T.link.dispose&&T.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let y=!1;for(const[N,T]of this._linkProviderService.linkProviders.entries())w?(E=this._activeProviderReplies)!=null&&E.get(N)&&(y=this._checkLinkProviderResult(N,b,y)):T.provideLinks(b.y,(z=>{var I,B;if(this._isMouseOut)return;const M=z==null?void 0:z.map(($=>({link:$})));(I=this._activeProviderReplies)==null||I.set(N,M),y=this._checkLinkProviderResult(N,b,y),((B=this._activeProviderReplies)==null?void 0:B.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,w){const y=new Set;for(let C=0;Cb?this._bufferService.cols:T.link.range.end.x;for(let I=z;I<=M;I++){if(y.has(I)){E.splice(N--,1);break}y.add(I)}}}}_checkLinkProviderResult(b,w,y){var N;if(!this._activeProviderReplies)return y;const C=this._activeProviderReplies.get(b);let E=!1;for(let T=0;Tthis._linkAtPosition(z.link,w)));T&&(y=!0,this._handleNewLink(T))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!y)for(let T=0;Tthis._linkAtPosition(M.link,w)));if(z){y=!0,this._handleNewLink(z);break}}return y}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const w=this._positionFromMouseEvent(b,this._element,this._mouseService);w&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,w)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,w){this._currentLink&&this._lastMouseEvent&&(!b||!w||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=w)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,m.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const w=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);w&&this._linkAtPosition(b.link,w)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>{var y,C;return(C=(y=this._currentLink)==null?void 0:y.state)==null?void 0:C.decorations.pointerCursor},set:y=>{var C;(C=this._currentLink)!=null&&C.state&&this._currentLink.state.decorations.pointerCursor!==y&&(this._currentLink.state.decorations.pointerCursor=y,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",y))}},underline:{get:()=>{var y,C;return(C=(y=this._currentLink)==null?void 0:y.state)==null?void 0:C.decorations.underline},set:y=>{var C,E,N;(C=this._currentLink)!=null&&C.state&&((N=(E=this._currentLink)==null?void 0:E.state)==null?void 0:N.decorations.underline)!==y&&(this._currentLink.state.decorations.underline=y,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,y))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((y=>{if(!this._currentLink)return;const C=y.start===0?0:y.start+1+this._bufferService.buffer.ydisp,E=this._bufferService.buffer.ydisp+1+y.end;if(this._currentLink.link.range.start.y>=C&&this._currentLink.link.range.end.y<=E&&(this._clearCurrentLink(C,E),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(b,w,y){var C;(C=this._currentLink)!=null&&C.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(w,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),w.hover&&w.hover(y,w.text)}_fireUnderlineEvent(b,w){const y=b.range,C=this._bufferService.buffer.ydisp,E=this._createLinkUnderlineEvent(y.start.x-1,y.start.y-C-1,y.end.x,y.end.y-C-1,void 0);(w?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(E)}_linkLeave(b,w,y){var C;(C=this._currentLink)!=null&&C.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(w,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),w.leave&&w.leave(y,w.text)}_linkAtPosition(b,w){const y=b.range.start.y*this._bufferService.cols+b.range.start.x,C=b.range.end.y*this._bufferService.cols+b.range.end.x,E=w.y*this._bufferService.cols+w.x;return y<=E&&E<=C}_positionFromMouseEvent(b,w,y){const C=y.getCoords(b,w,this._bufferService.cols,this._bufferService.rows);if(C)return{x:C[0],y:C[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,w,y,C,E){return{x1:b,y1:w,x2:y,y2:C,cols:this._bufferService.cols,fg:E}}};o.Linkifier=v=u([_(1,S.IMouseService),_(2,S.IRenderService),_(3,x.IBufferService),_(4,S.ILinkProviderService)],v)},9042:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(a,o,l){var u=this&&this.__decorate||function(S,v,b,w){var y,C=arguments.length,E=C<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,b):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(S,v,b,w);else for(var N=S.length-1;N>=0;N--)(y=S[N])&&(E=(C<3?y(E):C>3?y(v,b,E):y(v,b))||E);return C>3&&E&&Object.defineProperty(v,b,E),E},_=this&&this.__param||function(S,v){return function(b,w){v(b,w,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=l(511),p=l(2585);let m=o.OscLinkProvider=class{constructor(S,v,b){this._bufferService=S,this._optionsService=v,this._oscLinkService=b}provideLinks(S,v){var M;const b=this._bufferService.buffer.lines.get(S-1);if(!b)return void v(void 0);const w=[],y=this._optionsService.rawOptions.linkHandler,C=new d.CellData,E=b.getTrimmedLength();let N=-1,T=-1,z=!1;for(let I=0;Iy?y.activate(H,Y,$):x(0,Y),hover:(H,Y)=>{var V;return(V=y==null?void 0:y.hover)==null?void 0:V.call(y,H,Y,$)},leave:(H,Y)=>{var V;return(V=y==null?void 0:y.leave)==null?void 0:V.call(y,H,Y,$)}})}z=!1,C.hasExtendedAttrs()&&C.extended.urlId?(T=I,N=C.extended.urlId):(T=-1,N=-1)}}v(w)}};function x(S,v){if(confirm(`Do you want to navigate to ${v}? -WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=m=u([_(0,p.IBufferService),_(1,p.IOptionsService),_(2,p.IOscLinkService)],m)},6193:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(l,u){this._renderCallback=l,this._coreBrowserService=u,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(l){return this._refreshCallbacks.push(l),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(l,u,_){this._rowCount=_,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const l=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,u),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const l of this._refreshCallbacks)l(0);this._refreshCallbacks=[]}}},3236:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const u=l(3614),_=l(3656),d=l(3551),p=l(9042),m=l(3730),x=l(1680),S=l(3107),v=l(5744),b=l(2950),w=l(1296),y=l(428),C=l(4269),E=l(5114),N=l(8934),T=l(3230),z=l(9312),M=l(4725),O=l(6731),B=l(8055),$=l(8969),U=l(8460),H=l(844),Y=l(6114),V=l(8437),X=l(2584),te=l(7399),I=l(5941),L=l(9074),F=l(2585),q=l(5435),G=l(4567),ee=l(779);class ce extends $.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(ne={}){super(ne),this.browser=Y,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new H.MutableDisposable),this._onCursorMove=this.register(new U.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new U.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new U.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new U.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new U.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new U.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new U.EventEmitter),this._onBlur=this.register(new U.EventEmitter),this._onA11yCharEmitter=this.register(new U.EventEmitter),this._onA11yTabEmitter=this.register(new U.EventEmitter),this._onWillOpen=this.register(new U.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(F.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ee.LinkProviderService),this._instantiationService.setService(M.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(m.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((Q,le)=>this.refresh(Q,le)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((Q=>this._reportWindowsOptions(Q)))),this.register(this._inputHandler.onColor((Q=>this._handleColorEvent(Q)))),this.register((0,U.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,U.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,U.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,U.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((Q=>this._afterResize(Q.cols,Q.rows)))),this.register((0,H.toDisposable)((()=>{var Q,le;this._customKeyEventHandler=void 0,(le=(Q=this.element)==null?void 0:Q.parentNode)==null||le.removeChild(this.element)})))}_handleColorEvent(ne){if(this._themeService)for(const Q of ne){let le,ae="";switch(Q.index){case 256:le="foreground",ae="10";break;case 257:le="background",ae="11";break;case 258:le="cursor",ae="12";break;default:le="ansi",ae="4;"+Q.index}switch(Q.type){case 0:const ue=B.color.toColorRGB(le==="ansi"?this._themeService.colors.ansi[Q.index]:this._themeService.colors[le]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${ae};${(0,I.toRgbString)(ue)}${X.C1_ESCAPED.ST}`);break;case 1:if(le==="ansi")this._themeService.modifyColors((pe=>pe.ansi[Q.index]=B.channels.toColor(...Q.color)));else{const pe=le;this._themeService.modifyColors((Se=>Se[pe]=B.channels.toColor(...Q.color)))}break;case 2:this._themeService.restoreColor(Q.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(ne){ne?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(G.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(ne){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var ne;return(ne=this.textarea)==null?void 0:ne.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const ne=this.buffer.ybase+this.buffer.y,Q=this.buffer.lines.get(ne);if(!Q)return;const le=Math.min(this.buffer.x,this.cols-1),ae=this._renderService.dimensions.css.cell.height,ue=Q.getWidth(le),pe=this._renderService.dimensions.css.cell.width*ue,Se=this.buffer.y*this._renderService.dimensions.css.cell.height,ye=le*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ye+"px",this.textarea.style.top=Se+"px",this.textarea.style.width=pe+"px",this.textarea.style.height=ae+"px",this.textarea.style.lineHeight=ae+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",(Q=>{this.hasSelection()&&(0,u.copyHandler)(Q,this._selectionService)})));const ne=Q=>(0,u.handlePasteEvent)(Q,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",ne)),this.register((0,_.addDisposableDomListener)(this.element,"paste",ne)),Y.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(Q=>{Q.button===2&&(0,u.rightClickHandler)(Q,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",(Q=>{(0,u.rightClickHandler)(Q,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),Y.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",(Q=>{Q.button===1&&(0,u.moveTextAreaUnderMouseCursor)(Q,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",(ne=>this._keyUp(ne)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",(ne=>this._keyDown(ne)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",(ne=>this._keyPress(ne)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",(ne=>this._compositionHelper.compositionupdate(ne)))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,_.addDisposableDomListener)(this.textarea,"input",(ne=>this._inputEvent(ne)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(ne){var le;if(!ne)throw new Error("Terminal requires a parent element.");if(ne.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((le=this.element)==null?void 0:le.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=ne.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),ne.appendChild(this.element);const Q=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),Q.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,_.addDisposableDomListener)(this.screenElement,"mousemove",(ae=>this.updateCursorStyle(ae)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),Q.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),Y.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(E.CoreBrowserService,this.textarea,ne.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(M.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",(ae=>this._handleTextAreaFocus(ae)))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(y.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(M.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(O.ThemeService),this._instantiationService.setService(M.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(C.CharacterJoinerService),this._instantiationService.setService(M.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(T.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(M.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ae=>this._onRender.fire(ae)))),this.onResize((ae=>this._renderService.resize(ae.cols,ae.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(b.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(N.MouseService),this._instantiationService.setService(M.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.Linkifier,this.screenElement)),this.element.appendChild(Q);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(x.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ae=>this.scrollLines(ae.amount,ae.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(z.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(M.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ae=>this.scrollLines(ae.amount,ae.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ae=>this._renderService.handleSelectionChanged(ae.start,ae.end,ae.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ae=>{this.textarea.value=ae,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ae=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,_.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(S.BufferDecorationRenderer,this.screenElement)),this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(ae=>this._selectionService.handleMouseDown(ae)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(G.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ae=>this._handleScreenReaderModeOptionChange(ae)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ae=>{!this._overviewRulerRenderer&&ae&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(w.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const ne=this,Q=this.element;function le(pe){const Se=ne._mouseService.getMouseReportCoords(pe,ne.screenElement);if(!Se)return!1;let ye,qe;switch(pe.overrideType||pe.type){case"mousemove":qe=32,pe.buttons===void 0?(ye=3,pe.button!==void 0&&(ye=pe.button<3?pe.button:3)):ye=1&pe.buttons?0:4&pe.buttons?1:2&pe.buttons?2:3;break;case"mouseup":qe=0,ye=pe.button<3?pe.button:3;break;case"mousedown":qe=1,ye=pe.button<3?pe.button:3;break;case"wheel":if(ne._customWheelEventHandler&&ne._customWheelEventHandler(pe)===!1||ne.viewport.getLinesScrolled(pe)===0)return!1;qe=pe.deltaY<0?0:1,ye=4;break;default:return!1}return!(qe===void 0||ye===void 0||ye>4)&&ne.coreMouseService.triggerMouseEvent({col:Se.col,row:Se.row,x:Se.x,y:Se.y,button:ye,action:qe,ctrl:pe.ctrlKey,alt:pe.altKey,shift:pe.shiftKey})}const ae={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ue={mouseup:pe=>(le(pe),pe.buttons||(this._document.removeEventListener("mouseup",ae.mouseup),ae.mousedrag&&this._document.removeEventListener("mousemove",ae.mousedrag)),this.cancel(pe)),wheel:pe=>(le(pe),this.cancel(pe,!0)),mousedrag:pe=>{pe.buttons&&le(pe)},mousemove:pe=>{pe.buttons||le(pe)}};this.register(this.coreMouseService.onProtocolChange((pe=>{pe?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(pe)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&pe?ae.mousemove||(Q.addEventListener("mousemove",ue.mousemove),ae.mousemove=ue.mousemove):(Q.removeEventListener("mousemove",ae.mousemove),ae.mousemove=null),16&pe?ae.wheel||(Q.addEventListener("wheel",ue.wheel,{passive:!1}),ae.wheel=ue.wheel):(Q.removeEventListener("wheel",ae.wheel),ae.wheel=null),2&pe?ae.mouseup||(ae.mouseup=ue.mouseup):(this._document.removeEventListener("mouseup",ae.mouseup),ae.mouseup=null),4&pe?ae.mousedrag||(ae.mousedrag=ue.mousedrag):(this._document.removeEventListener("mousemove",ae.mousedrag),ae.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(Q,"mousedown",(pe=>{if(pe.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(pe))return le(pe),ae.mouseup&&this._document.addEventListener("mouseup",ae.mouseup),ae.mousedrag&&this._document.addEventListener("mousemove",ae.mousedrag),this.cancel(pe)}))),this.register((0,_.addDisposableDomListener)(Q,"wheel",(pe=>{if(!ae.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(pe)===!1)return!1;if(!this.buffer.hasScrollback){const Se=this.viewport.getLinesScrolled(pe);if(Se===0)return;const ye=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(pe.deltaY<0?"A":"B");let qe="";for(let Ie=0;Ie{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(pe),this.cancel(pe)}),{passive:!0})),this.register((0,_.addDisposableDomListener)(Q,"touchmove",(pe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(pe)?void 0:this.cancel(pe)}),{passive:!1}))}refresh(ne,Q){var le;(le=this._renderService)==null||le.refreshRows(ne,Q)}updateCursorStyle(ne){var Q;(Q=this._selectionService)!=null&&Q.shouldColumnSelect(ne)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(ne,Q,le=0){var ae;le===1?(super.scrollLines(ne,Q,le),this.refresh(0,this.rows-1)):(ae=this.viewport)==null||ae.scrollLines(ne)}paste(ne){(0,u.paste)(ne,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(ne){this._customKeyEventHandler=ne}attachCustomWheelEventHandler(ne){this._customWheelEventHandler=ne}registerLinkProvider(ne){return this._linkProviderService.registerLinkProvider(ne)}registerCharacterJoiner(ne){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const Q=this._characterJoinerService.register(ne);return this.refresh(0,this.rows-1),Q}deregisterCharacterJoiner(ne){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(ne)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(ne){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+ne)}registerDecoration(ne){return this._decorationService.registerDecoration(ne)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(ne,Q,le){this._selectionService.setSelection(ne,Q,le)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var ne;(ne=this._selectionService)==null||ne.clearSelection()}selectAll(){var ne;(ne=this._selectionService)==null||ne.selectAll()}selectLines(ne,Q){var le;(le=this._selectionService)==null||le.selectLines(ne,Q)}_keyDown(ne){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(ne)===!1)return!1;const Q=this.browser.isMac&&this.options.macOptionIsMeta&&ne.altKey;if(!Q&&!this._compositionHelper.keydown(ne))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;Q||ne.key!=="Dead"&&ne.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const le=(0,te.evaluateKeyboardEvent)(ne,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(ne),le.type===3||le.type===2){const ae=this.rows-1;return this.scrollLines(le.type===2?-ae:ae),this.cancel(ne,!0)}return le.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,ne)||(le.cancel&&this.cancel(ne,!0),!le.key||!!(ne.key&&!ne.ctrlKey&&!ne.altKey&&!ne.metaKey&&ne.key.length===1&&ne.key.charCodeAt(0)>=65&&ne.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(le.key!==X.C0.ETX&&le.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:le.key,domEvent:ne}),this._showCursor(),this.coreService.triggerDataEvent(le.key,!0),!this.optionsService.rawOptions.screenReaderMode||ne.altKey||ne.ctrlKey?this.cancel(ne,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(ne,Q){const le=ne.isMac&&!this.options.macOptionIsMeta&&Q.altKey&&!Q.ctrlKey&&!Q.metaKey||ne.isWindows&&Q.altKey&&Q.ctrlKey&&!Q.metaKey||ne.isWindows&&Q.getModifierState("AltGraph");return Q.type==="keypress"?le:le&&(!Q.keyCode||Q.keyCode>47)}_keyUp(ne){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(ne)===!1||((function(Q){return Q.keyCode===16||Q.keyCode===17||Q.keyCode===18})(ne)||this.focus(),this.updateCursorStyle(ne),this._keyPressHandled=!1)}_keyPress(ne){let Q;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(ne)===!1)return!1;if(this.cancel(ne),ne.charCode)Q=ne.charCode;else if(ne.which===null||ne.which===void 0)Q=ne.keyCode;else{if(ne.which===0||ne.charCode===0)return!1;Q=ne.which}return!(!Q||(ne.altKey||ne.ctrlKey||ne.metaKey)&&!this._isThirdLevelShift(this.browser,ne)||(Q=String.fromCharCode(Q),this._onKey.fire({key:Q,domEvent:ne}),this._showCursor(),this.coreService.triggerDataEvent(Q,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(ne){if(ne.data&&ne.inputType==="insertText"&&(!ne.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const Q=ne.data;return this.coreService.triggerDataEvent(Q,!0),this.cancel(ne),!0}return!1}resize(ne,Q){ne!==this.cols||Q!==this.rows?super.resize(ne,Q):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(ne,Q){var le,ae;(le=this._charSizeService)==null||le.measure(),(ae=this.viewport)==null||ae.syncScrollArea(!0)}clear(){var ne;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let Q=1;Q{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(l,u=1e3){this._renderCallback=l,this._debounceThresholdMS=u,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(l,u,_){this._rowCount=_,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const p=d-this._lastRefreshMs,m=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),m)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const l=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,u)}}},1680:function(a,o,l){var u=this&&this.__decorate||function(b,w,y,C){var E,N=arguments.length,T=N<3?w:C===null?C=Object.getOwnPropertyDescriptor(w,y):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,w,y,C);else for(var z=b.length-1;z>=0;z--)(E=b[z])&&(T=(N<3?E(T):N>3?E(w,y,T):E(w,y))||T);return N>3&&T&&Object.defineProperty(w,y,T),T},_=this&&this.__param||function(b,w){return function(y,C){w(y,C,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const d=l(3656),p=l(4725),m=l(8460),x=l(844),S=l(2585);let v=o.Viewport=class extends x.Disposable{constructor(b,w,y,C,E,N,T,z){super(),this._viewportElement=b,this._scrollArea=w,this._bufferService=y,this._optionsService=C,this._charSizeService=E,this._renderService=N,this._coreBrowserService=T,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new m.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((M=>this._activeBuffer=M.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((M=>this._renderDimensions=M))),this._handleThemeChange(z.colors),this.register(z.onChangeColors((M=>this._handleThemeChange(M)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(b){this._viewportElement.style.backgroundColor=b.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(b){if(b)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const w=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==w&&(this._lastRecordedBufferHeight=w,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const b=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==b&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=b),this._refreshAnimationFrame=null}syncScrollArea(b=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(b);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(b)}_handleScroll(b){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const w=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:w,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const b=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(b*(this._smoothScrollState.target-this._smoothScrollState.origin)),b<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(b,w){const y=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(w<0&&this._viewportElement.scrollTop!==0||w>0&&y0&&(y=$),C=""}}return{bufferElements:E,cursorElement:y}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let w=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(w/=this._currentRowHeight+0,this._wheelPartialScroll+=w,w=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(w*=this._bufferService.rows),w}_applyScrollModifier(b,w){const y=this._optionsService.rawOptions.fastScrollModifier;return y==="alt"&&w.altKey||y==="ctrl"&&w.ctrlKey||y==="shift"&&w.shiftKey?b*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:b*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(b){this._lastTouchY=b.touches[0].pageY}handleTouchMove(b){const w=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,w!==0&&(this._viewportElement.scrollTop+=w,this._bubbleScroll(b,w))}};o.Viewport=v=u([_(2,S.IBufferService),_(3,S.IOptionsService),_(4,p.ICharSizeService),_(5,p.IRenderService),_(6,p.ICoreBrowserService),_(7,p.IThemeService)],v)},3107:function(a,o,l){var u=this&&this.__decorate||function(S,v,b,w){var y,C=arguments.length,E=C<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,b):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(S,v,b,w);else for(var N=S.length-1;N>=0;N--)(y=S[N])&&(E=(C<3?y(E):C>3?y(v,b,E):y(v,b))||E);return C>3&&E&&Object.defineProperty(v,b,E),E},_=this&&this.__param||function(S,v){return function(b,w){v(b,w,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const d=l(4725),p=l(844),m=l(2585);let x=o.BufferDecorationRenderer=class extends p.Disposable{constructor(S,v,b,w,y){super(),this._screenElement=S,this._bufferService=v,this._coreBrowserService=b,this._decorationService=w,this._renderService=y,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((C=>this._removeDecoration(C)))),this.register((0,p.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const S of this._decorationService.decorations)this._renderDecoration(S);this._dimensionsChanged=!1}_renderDecoration(S){this._refreshStyle(S),this._dimensionsChanged&&this._refreshXPosition(S)}_createElement(S){var w;const v=this._coreBrowserService.mainDocument.createElement("div");v.classList.add("xterm-decoration"),v.classList.toggle("xterm-decoration-top-layer",((w=S==null?void 0:S.options)==null?void 0:w.layer)==="top"),v.style.width=`${Math.round((S.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,v.style.height=(S.options.height||1)*this._renderService.dimensions.css.cell.height+"px",v.style.top=(S.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",v.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=S.options.x??0;return b&&b>this._bufferService.cols&&(v.style.display="none"),this._refreshXPosition(S,v),v}_refreshStyle(S){const v=S.marker.line-this._bufferService.buffers.active.ydisp;if(v<0||v>=this._bufferService.rows)S.element&&(S.element.style.display="none",S.onRenderEmitter.fire(S.element));else{let b=this._decorationElements.get(S);b||(b=this._createElement(S),S.element=b,this._decorationElements.set(S,b),this._container.appendChild(b),S.onDispose((()=>{this._decorationElements.delete(S),b.remove()}))),b.style.top=v*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",S.onRenderEmitter.fire(b)}}_refreshXPosition(S,v=S.element){if(!v)return;const b=S.options.x??0;(S.options.anchor||"left")==="right"?v.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":v.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(S){var v;(v=this._decorationElements.get(S))==null||v.remove(),this._decorationElements.delete(S),S.dispose()}};o.BufferDecorationRenderer=x=u([_(1,m.IBufferService),_(2,d.ICoreBrowserService),_(3,m.IDecorationService),_(4,d.IRenderService)],x)},5871:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorZoneStore=void 0,o.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(l){if(l.options.overviewRulerOptions){for(const u of this._zones)if(u.color===l.options.overviewRulerOptions.color&&u.position===l.options.overviewRulerOptions.position){if(this._lineIntersectsZone(u,l.marker.line))return;if(this._lineAdjacentToZone(u,l.marker.line,l.options.overviewRulerOptions.position))return void this._addLineToZone(u,l.marker.line)}if(this._zonePoolIndex=l.startBufferLine&&u<=l.endBufferLine}_lineAdjacentToZone(l,u,_){return u>=l.startBufferLine-this._linePadding[_||"full"]&&u<=l.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(l,u){l.startBufferLine=Math.min(l.startBufferLine,u),l.endBufferLine=Math.max(l.endBufferLine,u)}}},5744:function(a,o,l){var u=this&&this.__decorate||function(y,C,E,N){var T,z=arguments.length,M=z<3?C:N===null?N=Object.getOwnPropertyDescriptor(C,E):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,C,E,N);else for(var O=y.length-1;O>=0;O--)(T=y[O])&&(M=(z<3?T(M):z>3?T(C,E,M):T(C,E))||M);return z>3&&M&&Object.defineProperty(C,E,M),M},_=this&&this.__param||function(y,C){return function(E,N){C(E,N,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const d=l(5871),p=l(4725),m=l(844),x=l(2585),S={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let w=o.OverviewRulerRenderer=class extends m.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(y,C,E,N,T,z,M){var B;super(),this._viewportElement=y,this._screenElement=C,this._bufferService=E,this._decorationService=N,this._renderService=T,this._optionsService=z,this._coreBrowserService=M,this._colorZoneStore=new d.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(B=this._viewportElement.parentElement)==null||B.insertBefore(this._canvas,this._viewportElement);const O=this._canvas.getContext("2d");if(!O)throw new Error("Ctx cannot be null");this._ctx=O,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,m.toDisposable)((()=>{var $;($=this._canvas)==null||$.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const y=Math.floor(this._canvas.width/3),C=Math.ceil(this._canvas.width/3);v.full=this._canvas.width,v.left=y,v.center=C,v.right=y,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=v.left,b.right=v.left+v.center}_refreshDrawHeightConstants(){S.full=Math.round(2*this._coreBrowserService.dpr);const y=this._canvas.height/this._bufferService.buffer.lines.length,C=Math.round(Math.max(Math.min(y,12),6)*this._coreBrowserService.dpr);S.left=C,S.center=C,S.right=C}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const C of this._decorationService.decorations)this._colorZoneStore.addDecoration(C);this._ctx.lineWidth=1;const y=this._colorZoneStore.zones;for(const C of y)C.position!=="full"&&this._renderColorZone(C);for(const C of y)C.position==="full"&&this._renderColorZone(C);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(y){this._ctx.fillStyle=y.color,this._ctx.fillRect(b[y.position||"full"],Math.round((this._canvas.height-1)*(y.startBufferLine/this._bufferService.buffers.active.lines.length)-S[y.position||"full"]/2),v[y.position||"full"],Math.round((this._canvas.height-1)*((y.endBufferLine-y.startBufferLine)/this._bufferService.buffers.active.lines.length)+S[y.position||"full"]))}_queueRefresh(y,C){this._shouldUpdateDimensions=y||this._shouldUpdateDimensions,this._shouldUpdateAnchor=C||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=w=u([_(2,x.IBufferService),_(3,x.IDecorationService),_(4,p.IRenderService),_(5,x.IOptionsService),_(6,p.ICoreBrowserService)],w)},2950:function(a,o,l){var u=this&&this.__decorate||function(S,v,b,w){var y,C=arguments.length,E=C<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,b):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(S,v,b,w);else for(var N=S.length-1;N>=0;N--)(y=S[N])&&(E=(C<3?y(E):C>3?y(v,b,E):y(v,b))||E);return C>3&&E&&Object.defineProperty(v,b,E),E},_=this&&this.__param||function(S,v){return function(b,w){v(b,w,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const d=l(4725),p=l(2585),m=l(2584);let x=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(S,v,b,w,y,C){this._textarea=S,this._compositionView=v,this._bufferService=b,this._optionsService=w,this._coreService=y,this._renderService=C,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(S){this._compositionView.textContent=S.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(S){if(this._isComposing||this._isSendingComposition){if(S.keyCode===229||S.keyCode===16||S.keyCode===17||S.keyCode===18)return!1;this._finalizeComposition(!1)}return S.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(S){if(this._compositionView.classList.remove("active"),this._isComposing=!1,S){const v={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,v.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(v.start,v.end):this._textarea.value.substring(v.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const v=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(v,!0)}}_handleAnyTextareaChanges(){const S=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const v=this._textarea.value,b=v.replace(S,"");this._dataAlreadySent=b,v.length>S.length?this._coreService.triggerDataEvent(b,!0):v.lengththis.updateCompositionElements(!0)),0)}}};o.CompositionHelper=x=u([_(2,p.IBufferService),_(3,p.IOptionsService),_(4,p.ICoreService),_(5,d.IRenderService)],x)},9806:(a,o)=>{function l(u,_,d){const p=d.getBoundingClientRect(),m=u.getComputedStyle(d),x=parseInt(m.getPropertyValue("padding-left")),S=parseInt(m.getPropertyValue("padding-top"));return[_.clientX-p.left-x,_.clientY-p.top-S]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=l,o.getCoords=function(u,_,d,p,m,x,S,v,b){if(!x)return;const w=l(u,_,d);return w?(w[0]=Math.ceil((w[0]+(b?S/2:0))/S),w[1]=Math.ceil(w[1]/v),w[0]=Math.min(Math.max(w[0],1),p+(b?1:0)),w[1]=Math.min(Math.max(w[1],1),m),w):void 0}},9504:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const u=l(2584);function _(v,b,w,y){const C=v-d(v,w),E=b-d(b,w),N=Math.abs(C-E)-(function(T,z,M){let O=0;const B=T-d(T,M),$=z-d(z,M);for(let U=0;U=0&&vb?"A":"B"}function m(v,b,w,y,C,E){let N=v,T=b,z="";for(;N!==w||T!==y;)N+=C?1:-1,C&&N>E.cols-1?(z+=E.buffer.translateBufferLineToString(T,!1,v,N),N=0,v=0,T++):!C&&N<0&&(z+=E.buffer.translateBufferLineToString(T,!1,0,v+1),N=E.cols-1,v=N,T--);return z+E.buffer.translateBufferLineToString(T,!1,v,N)}function x(v,b){const w=b?"O":"[";return u.C0.ESC+w+v}function S(v,b){v=Math.floor(v);let w="";for(let y=0;y0?B-d(B,$):M;const Y=B,V=(function(X,te,I,L,F,q){let G;return G=_(I,L,F,q).length>0?L-d(L,F):te,X=I&&Gv?"D":"C",S(Math.abs(C-v),x(N,y));N=E>b?"D":"C";const T=Math.abs(E-b);return S((function(z,M){return M.cols-z})(E>b?v:C,w)+(T-1)*w.cols+1+((E>b?C:v)-1),x(N,y))}},1296:function(a,o,l){var u=this&&this.__decorate||function(U,H,Y,V){var X,te=arguments.length,I=te<3?H:V===null?V=Object.getOwnPropertyDescriptor(H,Y):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(U,H,Y,V);else for(var L=U.length-1;L>=0;L--)(X=U[L])&&(I=(te<3?X(I):te>3?X(H,Y,I):X(H,Y))||I);return te>3&&I&&Object.defineProperty(H,Y,I),I},_=this&&this.__param||function(U,H){return function(Y,V){H(Y,V,U)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const d=l(3787),p=l(2550),m=l(2223),x=l(6171),S=l(6052),v=l(4725),b=l(8055),w=l(8460),y=l(844),C=l(2585),E="xterm-dom-renderer-owner-",N="xterm-rows",T="xterm-fg-",z="xterm-bg-",M="xterm-focus",O="xterm-selection";let B=1,$=o.DomRenderer=class extends y.Disposable{constructor(U,H,Y,V,X,te,I,L,F,q,G,ee,ce){super(),this._terminal=U,this._document=H,this._element=Y,this._screenElement=V,this._viewportElement=X,this._helperContainer=te,this._linkifier2=I,this._charSizeService=F,this._optionsService=q,this._bufferService=G,this._coreBrowserService=ee,this._themeService=ce,this._terminalClass=B++,this._rowElements=[],this._selectionRenderModel=(0,S.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new w.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(N),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(O),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,x.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((oe=>this._injectCss(oe)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(E+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((oe=>this._handleLinkHover(oe)))),this.register(this._linkifier2.onHideLinkUnderline((oe=>this._handleLinkLeave(oe)))),this.register((0,y.toDisposable)((()=>{this._element.classList.remove(E+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new p.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const U=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*U,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*U),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/U),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/U),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const Y of this._rowElements)Y.style.width=`${this.dimensions.css.canvas.width}px`,Y.style.height=`${this.dimensions.css.cell.height}px`,Y.style.lineHeight=`${this.dimensions.css.cell.height}px`,Y.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const H=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=H,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(U){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let H=`${this._terminalSelector} .${N} { color: ${U.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;H+=`${this._terminalSelector} .${N} .xterm-dim { color: ${b.color.multiplyOpacity(U.foreground,.5).css};}`,H+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const Y=`blink_underline_${this._terminalClass}`,V=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;H+=`@keyframes ${Y} { 50% { border-bottom-style: hidden; }}`,H+=`@keyframes ${V} { 50% { box-shadow: none; }}`,H+=`@keyframes ${X} { 0% { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css}; } 50% { background-color: inherit; color: ${U.cursor.css}; }}`,H+=`${this._terminalSelector} .${N}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${N}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${V} 1s step-end infinite;}${this._terminalSelector} .${N}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${U.cursor.css} !important; color: ${U.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${U.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${U.cursor.css} inset;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${U.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,H+=`${this._terminalSelector} .${O} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${O} div { position: absolute; background-color: ${U.selectionBackgroundOpaque.css};}${this._terminalSelector} .${O} div { position: absolute; background-color: ${U.selectionInactiveBackgroundOpaque.css};}`;for(const[te,I]of U.ansi.entries())H+=`${this._terminalSelector} .${T}${te} { color: ${I.css}; }${this._terminalSelector} .${T}${te}.xterm-dim { color: ${b.color.multiplyOpacity(I,.5).css}; }${this._terminalSelector} .${z}${te} { background-color: ${I.css}; }`;H+=`${this._terminalSelector} .${T}${m.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(U.background).css}; }${this._terminalSelector} .${T}${m.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(U.background),.5).css}; }${this._terminalSelector} .${z}${m.INVERTED_DEFAULT_COLOR} { background-color: ${U.foreground.css}; }`,this._themeStyleElement.textContent=H}_setDefaultSpacing(){const U=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${U}px`,this._rowFactory.defaultSpacing=U}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(U,H){for(let Y=this._rowElements.length;Y<=H;Y++){const V=this._document.createElement("div");this._rowContainer.appendChild(V),this._rowElements.push(V)}for(;this._rowElements.length>H;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(U,H){this._refreshRowElements(U,H),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(M),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(M),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(U,H,Y){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(U,H,Y),this.renderRows(0,this._bufferService.rows-1),!U||!H)return;this._selectionRenderModel.update(this._terminal,U,H,Y);const V=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,te=this._selectionRenderModel.viewportCappedStartRow,I=this._selectionRenderModel.viewportCappedEndRow;if(te>=this._bufferService.rows||I<0)return;const L=this._document.createDocumentFragment();if(Y){const F=U[0]>H[0];L.appendChild(this._createSelectionElement(te,F?H[0]:U[0],F?U[0]:H[0],I-te+1))}else{const F=V===te?U[0]:0,q=te===X?H[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(te,F,q));const G=I-te-1;if(L.appendChild(this._createSelectionElement(te+1,0,this._bufferService.cols,G)),te!==I){const ee=X===I?H[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(I,0,ee))}}this._selectionContainer.appendChild(L)}_createSelectionElement(U,H,Y,V=1){const X=this._document.createElement("div"),te=H*this.dimensions.css.cell.width;let I=this.dimensions.css.cell.width*(Y-H);return te+I>this.dimensions.css.canvas.width&&(I=this.dimensions.css.canvas.width-te),X.style.height=V*this.dimensions.css.cell.height+"px",X.style.top=U*this.dimensions.css.cell.height+"px",X.style.left=`${te}px`,X.style.width=`${I}px`,X}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const U of this._rowElements)U.replaceChildren()}renderRows(U,H){const Y=this._bufferService.buffer,V=Y.ybase+Y.y,X=Math.min(Y.x,this._bufferService.cols-1),te=this._optionsService.rawOptions.cursorBlink,I=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let F=U;F<=H;F++){const q=F+Y.ydisp,G=this._rowElements[F],ee=Y.lines.get(q);if(!G||!ee)break;G.replaceChildren(...this._rowFactory.createRow(ee,q,q===V,I,L,X,te,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${E}${this._terminalClass}`}_handleLinkHover(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!0)}_handleLinkLeave(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!1)}_setCellUnderline(U,H,Y,V,X,te){Y<0&&(U=0),V<0&&(H=0);const I=this._bufferService.rows-1;Y=Math.max(Math.min(Y,I),0),V=Math.max(Math.min(V,I),0),X=Math.min(X,this._bufferService.cols);const L=this._bufferService.buffer,F=L.ybase+L.y,q=Math.min(L.x,X-1),G=this._optionsService.rawOptions.cursorBlink,ee=this._optionsService.rawOptions.cursorStyle,ce=this._optionsService.rawOptions.cursorInactiveStyle;for(let oe=Y;oe<=V;++oe){const ne=oe+L.ydisp,Q=this._rowElements[oe],le=L.lines.get(ne);if(!Q||!le)break;Q.replaceChildren(...this._rowFactory.createRow(le,ne,ne===F,ee,ce,q,G,this.dimensions.css.cell.width,this._widthCache,te?oe===Y?U:0:-1,te?(oe===V?H:X)-1:-1))}}};o.DomRenderer=$=u([_(7,C.IInstantiationService),_(8,v.ICharSizeService),_(9,C.IOptionsService),_(10,C.IBufferService),_(11,v.ICoreBrowserService),_(12,v.IThemeService)],$)},3787:function(a,o,l){var u=this&&this.__decorate||function(N,T,z,M){var O,B=arguments.length,$=B<3?T:M===null?M=Object.getOwnPropertyDescriptor(T,z):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(N,T,z,M);else for(var U=N.length-1;U>=0;U--)(O=N[U])&&($=(B<3?O($):B>3?O(T,z,$):O(T,z))||$);return B>3&&$&&Object.defineProperty(T,z,$),$},_=this&&this.__param||function(N,T){return function(z,M){T(z,M,N)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const d=l(2223),p=l(643),m=l(511),x=l(2585),S=l(8055),v=l(4725),b=l(4269),w=l(6171),y=l(3734);let C=o.DomRendererRowFactory=class{constructor(N,T,z,M,O,B,$){this._document=N,this._characterJoinerService=T,this._optionsService=z,this._coreBrowserService=M,this._coreService=O,this._decorationService=B,this._themeService=$,this._workCell=new m.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,T,z){this._selectionStart=N,this._selectionEnd=T,this._columnSelectMode=z}createRow(N,T,z,M,O,B,$,U,H,Y,V){const X=[],te=this._characterJoinerService.getJoinedCharacters(T),I=this._themeService.colors;let L,F=N.getNoBgTrimmedLength();z&&F0&&Se===te[0][0]){qe=!0;const Ve=te.shift();ze=new b.JoinedCellData(this._workCell,N.translateToString(!0,Ve[0],Ve[1]),Ve[1]-Ve[0]),Ie=Ve[1]-1,ye=ze.getWidth()}const at=this._isCellInSelection(Se,T),bt=z&&Se===B,$t=pe&&Se>=Y&&Se<=V;let Pt=!1;this._decorationService.forEachDecorationAtCell(Se,T,void 0,(Ve=>{Pt=!0}));let zt=ze.getChars()||p.WHITESPACE_CELL_CHAR;if(zt===" "&&(ze.isUnderline()||ze.isOverline())&&(zt=" "),ae=ye*U-H.get(zt,ze.isBold(),ze.isItalic()),L){if(q&&(at&&le||!at&&!le&&ze.bg===ee)&&(at&&le&&I.selectionForeground||ze.fg===ce)&&ze.extended.ext===oe&&$t===ne&&ae===Q&&!bt&&!qe&&!Pt){ze.isInvisible()?G+=p.WHITESPACE_CELL_CHAR:G+=zt,q++;continue}q&&(L.textContent=G),L=this._document.createElement("span"),q=0,G=""}else L=this._document.createElement("span");if(ee=ze.bg,ce=ze.fg,oe=ze.extended.ext,ne=$t,Q=ae,le=at,qe&&B>=Se&&B<=Ie&&(B=Se),!this._coreService.isCursorHidden&&bt&&this._coreService.isCursorInitialized){if(ue.push("xterm-cursor"),this._coreBrowserService.isFocused)$&&ue.push("xterm-cursor-blink"),ue.push(M==="bar"?"xterm-cursor-bar":M==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(O)switch(O){case"outline":ue.push("xterm-cursor-outline");break;case"block":ue.push("xterm-cursor-block");break;case"bar":ue.push("xterm-cursor-bar");break;case"underline":ue.push("xterm-cursor-underline")}}if(ze.isBold()&&ue.push("xterm-bold"),ze.isItalic()&&ue.push("xterm-italic"),ze.isDim()&&ue.push("xterm-dim"),G=ze.isInvisible()?p.WHITESPACE_CELL_CHAR:ze.getChars()||p.WHITESPACE_CELL_CHAR,ze.isUnderline()&&(ue.push(`xterm-underline-${ze.extended.underlineStyle}`),G===" "&&(G=" "),!ze.isUnderlineColorDefault()))if(ze.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${y.AttributeData.toColorRGB(ze.getUnderlineColor()).join(",")})`;else{let Ve=ze.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ze.isBold()&&Ve<8&&(Ve+=8),L.style.textDecorationColor=I.ansi[Ve].css}ze.isOverline()&&(ue.push("xterm-overline"),G===" "&&(G=" ")),ze.isStrikethrough()&&ue.push("xterm-strikethrough"),$t&&(L.style.textDecoration="underline");let ot=ze.getFgColor(),ft=ze.getFgColorMode(),It=ze.getBgColor(),we=ze.getBgColorMode();const Re=!!ze.isInverse();if(Re){const Ve=ot;ot=It,It=Ve;const Ht=ft;ft=we,we=Ht}let Ze,ht,xt,Vt=!1;switch(this._decorationService.forEachDecorationAtCell(Se,T,void 0,(Ve=>{Ve.options.layer!=="top"&&Vt||(Ve.backgroundColorRGB&&(we=50331648,It=Ve.backgroundColorRGB.rgba>>8&16777215,Ze=Ve.backgroundColorRGB),Ve.foregroundColorRGB&&(ft=50331648,ot=Ve.foregroundColorRGB.rgba>>8&16777215,ht=Ve.foregroundColorRGB),Vt=Ve.options.layer==="top")})),!Vt&&at&&(Ze=this._coreBrowserService.isFocused?I.selectionBackgroundOpaque:I.selectionInactiveBackgroundOpaque,It=Ze.rgba>>8&16777215,we=50331648,Vt=!0,I.selectionForeground&&(ft=50331648,ot=I.selectionForeground.rgba>>8&16777215,ht=I.selectionForeground)),Vt&&ue.push("xterm-decoration-top"),we){case 16777216:case 33554432:xt=I.ansi[It],ue.push(`xterm-bg-${It}`);break;case 50331648:xt=S.channels.toColor(It>>16,It>>8&255,255&It),this._addStyle(L,`background-color:#${E((It>>>0).toString(16),"0",6)}`);break;default:Re?(xt=I.foreground,ue.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):xt=I.background}switch(Ze||ze.isDim()&&(Ze=S.color.multiplyOpacity(xt,.5)),ft){case 16777216:case 33554432:ze.isBold()&&ot<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ot+=8),this._applyMinimumContrast(L,xt,I.ansi[ot],ze,Ze,void 0)||ue.push(`xterm-fg-${ot}`);break;case 50331648:const Ve=S.channels.toColor(ot>>16&255,ot>>8&255,255&ot);this._applyMinimumContrast(L,xt,Ve,ze,Ze,ht)||this._addStyle(L,`color:#${E(ot.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,xt,I.foreground,ze,Ze,ht)||Re&&ue.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}ue.length&&(L.className=ue.join(" "),ue.length=0),bt||qe||Pt?L.textContent=G:q++,ae!==this.defaultSpacing&&(L.style.letterSpacing=`${ae}px`),X.push(L),Se=Ie}return L&&q&&(L.textContent=G),X}_applyMinimumContrast(N,T,z,M,O,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,w.treatGlyphAsBackgroundColor)(M.getCode()))return!1;const $=this._getContrastCache(M);let U;if(O||B||(U=$.getColor(T.rgba,z.rgba)),U===void 0){const H=this._optionsService.rawOptions.minimumContrastRatio/(M.isDim()?2:1);U=S.color.ensureContrastRatio(O||T,B||z,H),$.setColor((O||T).rgba,(B||z).rgba,U??null)}return!!U&&(this._addStyle(N,`color:${U.css}`),!0)}_getContrastCache(N){return N.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(N,T){N.setAttribute("style",`${N.getAttribute("style")||""}${T};`)}_isCellInSelection(N,T){const z=this._selectionStart,M=this._selectionEnd;return!(!z||!M)&&(this._columnSelectMode?z[0]<=M[0]?N>=z[0]&&T>=z[1]&&N=z[1]&&N>=M[0]&&T<=M[1]:T>z[1]&&T=z[0]&&N=z[0])}};function E(N,T,z){for(;N.length{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(l,u){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=l.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const _=l.createElement("span");_.classList.add("xterm-char-measure-element");const d=l.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const p=l.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontStyle="italic";const m=l.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold",m.style.fontStyle="italic",this._measureElements=[_,d,p,m],this._container.appendChild(_),this._container.appendChild(d),this._container.appendChild(p),this._container.appendChild(m),u.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(l,u,_,d){l===this._font&&u===this._fontSize&&_===this._weight&&d===this._weightBold||(this._font=l,this._fontSize=u,this._weight=_,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${_}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${_}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(l,u,_){let d=0;if(!u&&!_&&l.length===1&&(d=l.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const x=this._measure(l,0);return x>0&&(this._flat[d]=x),x}let p=l;u&&(p+="B"),_&&(p+="I");let m=this._holey.get(p);if(m===void 0){let x=0;u&&(x|=1),_&&(x|=2),m=this._measure(l,x),m>0&&this._holey.set(p,m)}return m}_measure(l,u){const _=this._measureElements[u];return _.textContent=l.repeat(32),_.offsetWidth/32}}},2223:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const u=l(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=u.isFirefox||u.isLegacyEdge?"bottom":"ideographic"},6171:(a,o)=>{function l(_){return 57508<=_&&_<=57558}function u(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},o.isPowerlineGlyph=l,o.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},o.isEmoji=u,o.allowRescaling=function(_,d,p,m){return d===1&&p>Math.ceil(1.5*m)&&_!==void 0&&_>255&&!u(_)&&!l(_)&&!(function(x){return 57344<=x&&x<=63743})(_)},o.treatGlyphAsBackgroundColor=function(_){return l(_)||(function(d){return 9472<=d&&d<=9631})(_)},o.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},o.computeNextVariantOffset=function(_,d,p=0){return(_-(2*Math.round(d)-p))%(2*Math.round(d))}},6052:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class l{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(_,d,p,m=!1){if(this.selectionStart=d,this.selectionEnd=p,!d||!p||d[0]===p[0]&&d[1]===p[1])return void this.clear();const x=_.buffers.active.ydisp,S=d[1]-x,v=p[1]-x,b=Math.max(S,0),w=Math.min(v,_.rows-1);b>=_.rows||w<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=m,this.viewportStartRow=S,this.viewportEndRow=v,this.viewportCappedStartRow=b,this.viewportCappedEndRow=w,this.startCol=d[0],this.endCol=p[0])}isCellSelected(_,d,p){return!!this.hasSelection&&(p-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&p>=this.viewportCappedStartRow&&d=this.viewportCappedStartRow&&d>=this.endCol&&p<=this.viewportCappedEndRow:p>this.viewportStartRow&&p=this.startCol&&d=this.startCol)}}o.createSelectionRenderModel=function(){return new l}},456:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.SelectionModel=class{constructor(l){this._bufferService=l,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?l%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)-1]:[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[l,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[Math.max(l,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const l=this.selectionStart,u=this.selectionEnd;return!(!l||!u)&&(l[1]>u[1]||l[1]===u[1]&&l[0]>u[0])}handleTrim(l){return this.selectionStart&&(this.selectionStart[1]-=l),this.selectionEnd&&(this.selectionEnd[1]-=l),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(a,o,l){var u=this&&this.__decorate||function(w,y,C,E){var N,T=arguments.length,z=T<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,C):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(w,y,C,E);else for(var M=w.length-1;M>=0;M--)(N=w[M])&&(z=(T<3?N(z):T>3?N(y,C,z):N(y,C))||z);return T>3&&z&&Object.defineProperty(y,C,z),z},_=this&&this.__param||function(w,y){return function(C,E){y(C,E,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const d=l(2585),p=l(8460),m=l(844);let x=o.CharSizeService=class extends m.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(w,y,C){super(),this._optionsService=C,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new v(w,y,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const w=this._measureStrategy.measure();w.width===this.width&&w.height===this.height||(this.width=w.width,this.height=w.height,this._onCharSizeChange.fire())}};o.CharSizeService=x=u([_(2,d.IOptionsService)],x);class S extends m.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(y,C){y!==void 0&&y>0&&C!==void 0&&C>0&&(this._result.width=y,this._result.height=C)}}class v extends S{constructor(y,C,E){super(),this._document=y,this._parentElement=C,this._optionsService=E,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class b extends S{constructor(y){super(),this._optionsService=y,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const C=this._ctx.measureText("W");if(!("width"in C&&"fontBoundingBoxAscent"in C&&"fontBoundingBoxDescent"in C))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const y=this._ctx.measureText("W");return this._validateAndSet(y.width,y.fontBoundingBoxAscent+y.fontBoundingBoxDescent),this._result}}},4269:function(a,o,l){var u=this&&this.__decorate||function(b,w,y,C){var E,N=arguments.length,T=N<3?w:C===null?C=Object.getOwnPropertyDescriptor(w,y):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,w,y,C);else for(var z=b.length-1;z>=0;z--)(E=b[z])&&(T=(N<3?E(T):N>3?E(w,y,T):E(w,y))||T);return N>3&&T&&Object.defineProperty(w,y,T),T},_=this&&this.__param||function(b,w){return function(y,C){w(y,C,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const d=l(3734),p=l(643),m=l(511),x=l(2585);class S extends d.AttributeData{constructor(w,y,C){super(),this.content=0,this.combinedData="",this.fg=w.fg,this.bg=w.bg,this.combinedData=y,this._width=C}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(w){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=S;let v=o.CharacterJoinerService=class xO{constructor(w){this._bufferService=w,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new m.CellData}register(w){const y={id:this._nextCharacterJoinerId++,handler:w};return this._characterJoiners.push(y),y.id}deregister(w){for(let y=0;y1){const $=this._getJoinedRanges(E,z,T,y,N);for(let U=0;U<$.length;U++)C.push($[U])}N=B,z=T,M=this._workCell.fg,O=this._workCell.bg}T+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const B=this._getJoinedRanges(E,z,T,y,N);for(let $=0;${Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const u=l(844),_=l(8460),d=l(3656);class p extends u.Disposable{constructor(S,v,b){super(),this._textarea=S,this._window=v,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new m(this._window),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new _.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((w=>this._screenDprMonitor.setWindow(w)))),this.register((0,_.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(S){this._window!==S&&(this._window=S,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}o.CoreBrowserService=p;class m extends u.Disposable{constructor(S){super(),this._parentWindow=S,this._windowResizeListener=this.register(new u.MutableDisposable),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,u.toDisposable)((()=>this.clearListener())))}setWindow(S){this._parentWindow=S,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,d.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var S;this._outerListener&&((S=this._resolutionMediaMatchList)==null||S.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const u=l(844);class _ extends u.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,u.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(p){return this.linkProviders.push(p),{dispose:()=>{const m=this.linkProviders.indexOf(p);m!==-1&&this.linkProviders.splice(m,1)}}}}o.LinkProviderService=_},8934:function(a,o,l){var u=this&&this.__decorate||function(x,S,v,b){var w,y=arguments.length,C=y<3?S:b===null?b=Object.getOwnPropertyDescriptor(S,v):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(x,S,v,b);else for(var E=x.length-1;E>=0;E--)(w=x[E])&&(C=(y<3?w(C):y>3?w(S,v,C):w(S,v))||C);return y>3&&C&&Object.defineProperty(S,v,C),C},_=this&&this.__param||function(x,S){return function(v,b){S(v,b,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const d=l(4725),p=l(9806);let m=o.MouseService=class{constructor(x,S){this._renderService=x,this._charSizeService=S}getCoords(x,S,v,b,w){return(0,p.getCoords)(window,x,S,v,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,w)}getMouseReportCoords(x,S){const v=(0,p.getCoordsRelativeToElement)(window,x,S);if(this._charSizeService.hasValidSize)return v[0]=Math.min(Math.max(v[0],0),this._renderService.dimensions.css.canvas.width-1),v[1]=Math.min(Math.max(v[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(v[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(v[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(v[0]),y:Math.floor(v[1])}}};o.MouseService=m=u([_(0,d.IRenderService),_(1,d.ICharSizeService)],m)},3230:function(a,o,l){var u=this&&this.__decorate||function(w,y,C,E){var N,T=arguments.length,z=T<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,C):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(w,y,C,E);else for(var M=w.length-1;M>=0;M--)(N=w[M])&&(z=(T<3?N(z):T>3?N(y,C,z):N(y,C))||z);return T>3&&z&&Object.defineProperty(y,C,z),z},_=this&&this.__param||function(w,y){return function(C,E){y(C,E,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const d=l(6193),p=l(4725),m=l(8460),x=l(844),S=l(7226),v=l(2585);let b=o.RenderService=class extends x.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(w,y,C,E,N,T,z,M){super(),this._rowCount=w,this._charSizeService=E,this._renderer=this.register(new x.MutableDisposable),this._pausedResizeTask=new S.DebouncedIdleTask,this._observerDisposable=this.register(new x.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new m.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new m.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new m.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new m.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((O,B)=>this._renderRows(O,B)),z),this.register(this._renderDebouncer),this.register(z.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(T.onResize((()=>this._fullRefresh()))),this.register(T.buffers.onBufferActivate((()=>{var O;return(O=this._renderer.value)==null?void 0:O.clear()}))),this.register(C.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(N.onDecorationRegistered((()=>this._fullRefresh()))),this.register(N.onDecorationRemoved((()=>this._fullRefresh()))),this.register(C.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(T.cols,T.rows),this._fullRefresh()}))),this.register(C.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(T.buffer.y,T.buffer.y,!0)))),this.register(M.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(z.window,y),this.register(z.onWindowChange((O=>this._registerIntersectionObserver(O,y))))}_registerIntersectionObserver(w,y){if("IntersectionObserver"in w){const C=new w.IntersectionObserver((E=>this._handleIntersectionChange(E[E.length-1])),{threshold:0});C.observe(y),this._observerDisposable.value=(0,x.toDisposable)((()=>C.disconnect()))}}_handleIntersectionChange(w){this._isPaused=w.isIntersecting===void 0?w.intersectionRatio===0:!w.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(w,y,C=!1){this._isPaused?this._needsFullRefresh=!0:(C||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(w,y,this._rowCount))}_renderRows(w,y){this._renderer.value&&(w=Math.min(w,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(w,y),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:w,end:y}),this._onRender.fire({start:w,end:y}),this._isNextRenderRedrawOnly=!0)}resize(w,y){this._rowCount=y,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(w){this._renderer.value=w,this._renderer.value&&(this._renderer.value.onRequestRedraw((y=>this.refreshRows(y.start,y.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(w){return this._renderDebouncer.addRefreshCallback(w)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var w,y;this._renderer.value&&((y=(w=this._renderer.value).clearTextureAtlas)==null||y.call(w),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(w,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var C;return(C=this._renderer.value)==null?void 0:C.handleResize(w,y)})):this._renderer.value.handleResize(w,y),this._fullRefresh())}handleCharSizeChanged(){var w;(w=this._renderer.value)==null||w.handleCharSizeChanged()}handleBlur(){var w;(w=this._renderer.value)==null||w.handleBlur()}handleFocus(){var w;(w=this._renderer.value)==null||w.handleFocus()}handleSelectionChanged(w,y,C){var E;this._selectionState.start=w,this._selectionState.end=y,this._selectionState.columnSelectMode=C,(E=this._renderer.value)==null||E.handleSelectionChanged(w,y,C)}handleCursorMove(){var w;(w=this._renderer.value)==null||w.handleCursorMove()}clear(){var w;(w=this._renderer.value)==null||w.clear()}};o.RenderService=b=u([_(2,v.IOptionsService),_(3,p.ICharSizeService),_(4,v.IDecorationService),_(5,v.IBufferService),_(6,p.ICoreBrowserService),_(7,p.IThemeService)],b)},9312:function(a,o,l){var u=this&&this.__decorate||function(z,M,O,B){var $,U=arguments.length,H=U<3?M:B===null?B=Object.getOwnPropertyDescriptor(M,O):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(z,M,O,B);else for(var Y=z.length-1;Y>=0;Y--)($=z[Y])&&(H=(U<3?$(H):U>3?$(M,O,H):$(M,O))||H);return U>3&&H&&Object.defineProperty(M,O,H),H},_=this&&this.__param||function(z,M){return function(O,B){M(O,B,z)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const d=l(9806),p=l(9504),m=l(456),x=l(4725),S=l(8460),v=l(844),b=l(6114),w=l(4841),y=l(511),C=l(2585),E=" ",N=new RegExp(E,"g");let T=o.SelectionService=class extends v.Disposable{constructor(z,M,O,B,$,U,H,Y,V){super(),this._element=z,this._screenElement=M,this._linkifier=O,this._bufferService=B,this._coreService=$,this._mouseService=U,this._optionsService=H,this._renderService=Y,this._coreBrowserService=V,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new y.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new S.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new S.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new S.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new S.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new m.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,v.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const z=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!z||!M||z[0]===M[0]&&z[1]===M[1])}get selectionText(){const z=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;if(!z||!M)return"";const O=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(z[0]===M[0])return"";const $=z[0]$.replace(N," "))).join(b.isWindows?`\r +WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=v}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=m=u([_(0,p.IBufferService),_(1,p.IOptionsService),_(2,p.IOscLinkService)],m)},6193:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(l,u){this._renderCallback=l,this._coreBrowserService=u,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(l){return this._refreshCallbacks.push(l),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(l,u,_){this._rowCount=_,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const l=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,u),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const l of this._refreshCallbacks)l(0);this._refreshCallbacks=[]}}},3236:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const u=l(3614),_=l(3656),d=l(3551),p=l(9042),m=l(3730),x=l(1680),S=l(3107),v=l(5744),b=l(2950),w=l(1296),y=l(428),C=l(4269),E=l(5114),N=l(8934),T=l(3230),z=l(9312),M=l(4725),I=l(6731),B=l(8055),$=l(8969),U=l(8460),H=l(844),Y=l(6114),V=l(8437),X=l(2584),ee=l(7399),O=l(5941),L=l(9074),F=l(2585),q=l(5435),G=l(4567),re=l(779);class ce extends $.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(te={}){super(te),this.browser=Y,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new H.MutableDisposable),this._onCursorMove=this.register(new U.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new U.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new U.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new U.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new U.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new U.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new U.EventEmitter),this._onBlur=this.register(new U.EventEmitter),this._onA11yCharEmitter=this.register(new U.EventEmitter),this._onA11yTabEmitter=this.register(new U.EventEmitter),this._onWillOpen=this.register(new U.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(F.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(re.LinkProviderService),this._instantiationService.setService(M.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(m.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((Q,le)=>this.refresh(Q,le)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((Q=>this._reportWindowsOptions(Q)))),this.register(this._inputHandler.onColor((Q=>this._handleColorEvent(Q)))),this.register((0,U.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,U.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,U.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,U.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((Q=>this._afterResize(Q.cols,Q.rows)))),this.register((0,H.toDisposable)((()=>{var Q,le;this._customKeyEventHandler=void 0,(le=(Q=this.element)==null?void 0:Q.parentNode)==null||le.removeChild(this.element)})))}_handleColorEvent(te){if(this._themeService)for(const Q of te){let le,ae="";switch(Q.index){case 256:le="foreground",ae="10";break;case 257:le="background",ae="11";break;case 258:le="cursor",ae="12";break;default:le="ansi",ae="4;"+Q.index}switch(Q.type){case 0:const de=B.color.toColorRGB(le==="ansi"?this._themeService.colors.ansi[Q.index]:this._themeService.colors[le]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${ae};${(0,O.toRgbString)(de)}${X.C1_ESCAPED.ST}`);break;case 1:if(le==="ansi")this._themeService.modifyColors((pe=>pe.ansi[Q.index]=B.channels.toColor(...Q.color)));else{const pe=le;this._themeService.modifyColors((we=>we[pe]=B.channels.toColor(...Q.color)))}break;case 2:this._themeService.restoreColor(Q.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(te){te?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(G.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(te){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var te;return(te=this.textarea)==null?void 0:te.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const te=this.buffer.ybase+this.buffer.y,Q=this.buffer.lines.get(te);if(!Q)return;const le=Math.min(this.buffer.x,this.cols-1),ae=this._renderService.dimensions.css.cell.height,de=Q.getWidth(le),pe=this._renderService.dimensions.css.cell.width*de,we=this.buffer.y*this._renderService.dimensions.css.cell.height,be=le*this._renderService.dimensions.css.cell.width;this.textarea.style.left=be+"px",this.textarea.style.top=we+"px",this.textarea.style.width=pe+"px",this.textarea.style.height=ae+"px",this.textarea.style.lineHeight=ae+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",(Q=>{this.hasSelection()&&(0,u.copyHandler)(Q,this._selectionService)})));const te=Q=>(0,u.handlePasteEvent)(Q,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",te)),this.register((0,_.addDisposableDomListener)(this.element,"paste",te)),Y.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(Q=>{Q.button===2&&(0,u.rightClickHandler)(Q,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",(Q=>{(0,u.rightClickHandler)(Q,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),Y.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",(Q=>{Q.button===1&&(0,u.moveTextAreaUnderMouseCursor)(Q,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",(te=>this._keyUp(te)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",(te=>this._keyDown(te)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",(te=>this._keyPress(te)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",(te=>this._compositionHelper.compositionupdate(te)))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,_.addDisposableDomListener)(this.textarea,"input",(te=>this._inputEvent(te)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(te){var le;if(!te)throw new Error("Terminal requires a parent element.");if(te.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((le=this.element)==null?void 0:le.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=te.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),te.appendChild(this.element);const Q=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),Q.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,_.addDisposableDomListener)(this.screenElement,"mousemove",(ae=>this.updateCursorStyle(ae)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),Q.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.promptLabel),Y.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(E.CoreBrowserService,this.textarea,te.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(M.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",(ae=>this._handleTextAreaFocus(ae)))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(y.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(M.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(I.ThemeService),this._instantiationService.setService(M.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(C.CharacterJoinerService),this._instantiationService.setService(M.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(T.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(M.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ae=>this._onRender.fire(ae)))),this.onResize((ae=>this._renderService.resize(ae.cols,ae.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(b.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(N.MouseService),this._instantiationService.setService(M.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.Linkifier,this.screenElement)),this.element.appendChild(Q);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(x.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ae=>this.scrollLines(ae.amount,ae.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(z.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(M.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ae=>this.scrollLines(ae.amount,ae.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ae=>this._renderService.handleSelectionChanged(ae.start,ae.end,ae.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ae=>{this.textarea.value=ae,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ae=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,_.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(S.BufferDecorationRenderer,this.screenElement)),this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(ae=>this._selectionService.handleMouseDown(ae)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(G.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ae=>this._handleScreenReaderModeOptionChange(ae)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ae=>{!this._overviewRulerRenderer&&ae&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(v.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(w.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const te=this,Q=this.element;function le(pe){const we=te._mouseService.getMouseReportCoords(pe,te.screenElement);if(!we)return!1;let be,Pe;switch(pe.overrideType||pe.type){case"mousemove":Pe=32,pe.buttons===void 0?(be=3,pe.button!==void 0&&(be=pe.button<3?pe.button:3)):be=1&pe.buttons?0:4&pe.buttons?1:2&pe.buttons?2:3;break;case"mouseup":Pe=0,be=pe.button<3?pe.button:3;break;case"mousedown":Pe=1,be=pe.button<3?pe.button:3;break;case"wheel":if(te._customWheelEventHandler&&te._customWheelEventHandler(pe)===!1||te.viewport.getLinesScrolled(pe)===0)return!1;Pe=pe.deltaY<0?0:1,be=4;break;default:return!1}return!(Pe===void 0||be===void 0||be>4)&&te.coreMouseService.triggerMouseEvent({col:we.col,row:we.row,x:we.x,y:we.y,button:be,action:Pe,ctrl:pe.ctrlKey,alt:pe.altKey,shift:pe.shiftKey})}const ae={mouseup:null,wheel:null,mousedrag:null,mousemove:null},de={mouseup:pe=>(le(pe),pe.buttons||(this._document.removeEventListener("mouseup",ae.mouseup),ae.mousedrag&&this._document.removeEventListener("mousemove",ae.mousedrag)),this.cancel(pe)),wheel:pe=>(le(pe),this.cancel(pe,!0)),mousedrag:pe=>{pe.buttons&&le(pe)},mousemove:pe=>{pe.buttons||le(pe)}};this.register(this.coreMouseService.onProtocolChange((pe=>{pe?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(pe)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&pe?ae.mousemove||(Q.addEventListener("mousemove",de.mousemove),ae.mousemove=de.mousemove):(Q.removeEventListener("mousemove",ae.mousemove),ae.mousemove=null),16&pe?ae.wheel||(Q.addEventListener("wheel",de.wheel,{passive:!1}),ae.wheel=de.wheel):(Q.removeEventListener("wheel",ae.wheel),ae.wheel=null),2&pe?ae.mouseup||(ae.mouseup=de.mouseup):(this._document.removeEventListener("mouseup",ae.mouseup),ae.mouseup=null),4&pe?ae.mousedrag||(ae.mousedrag=de.mousedrag):(this._document.removeEventListener("mousemove",ae.mousedrag),ae.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(Q,"mousedown",(pe=>{if(pe.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(pe))return le(pe),ae.mouseup&&this._document.addEventListener("mouseup",ae.mouseup),ae.mousedrag&&this._document.addEventListener("mousemove",ae.mousedrag),this.cancel(pe)}))),this.register((0,_.addDisposableDomListener)(Q,"wheel",(pe=>{if(!ae.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(pe)===!1)return!1;if(!this.buffer.hasScrollback){const we=this.viewport.getLinesScrolled(pe);if(we===0)return;const be=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(pe.deltaY<0?"A":"B");let Pe="";for(let Be=0;Be{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(pe),this.cancel(pe)}),{passive:!0})),this.register((0,_.addDisposableDomListener)(Q,"touchmove",(pe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(pe)?void 0:this.cancel(pe)}),{passive:!1}))}refresh(te,Q){var le;(le=this._renderService)==null||le.refreshRows(te,Q)}updateCursorStyle(te){var Q;(Q=this._selectionService)!=null&&Q.shouldColumnSelect(te)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(te,Q,le=0){var ae;le===1?(super.scrollLines(te,Q,le),this.refresh(0,this.rows-1)):(ae=this.viewport)==null||ae.scrollLines(te)}paste(te){(0,u.paste)(te,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(te){this._customKeyEventHandler=te}attachCustomWheelEventHandler(te){this._customWheelEventHandler=te}registerLinkProvider(te){return this._linkProviderService.registerLinkProvider(te)}registerCharacterJoiner(te){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const Q=this._characterJoinerService.register(te);return this.refresh(0,this.rows-1),Q}deregisterCharacterJoiner(te){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(te)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(te){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+te)}registerDecoration(te){return this._decorationService.registerDecoration(te)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(te,Q,le){this._selectionService.setSelection(te,Q,le)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var te;(te=this._selectionService)==null||te.clearSelection()}selectAll(){var te;(te=this._selectionService)==null||te.selectAll()}selectLines(te,Q){var le;(le=this._selectionService)==null||le.selectLines(te,Q)}_keyDown(te){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(te)===!1)return!1;const Q=this.browser.isMac&&this.options.macOptionIsMeta&&te.altKey;if(!Q&&!this._compositionHelper.keydown(te))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;Q||te.key!=="Dead"&&te.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const le=(0,ee.evaluateKeyboardEvent)(te,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(te),le.type===3||le.type===2){const ae=this.rows-1;return this.scrollLines(le.type===2?-ae:ae),this.cancel(te,!0)}return le.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,te)||(le.cancel&&this.cancel(te,!0),!le.key||!!(te.key&&!te.ctrlKey&&!te.altKey&&!te.metaKey&&te.key.length===1&&te.key.charCodeAt(0)>=65&&te.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(le.key!==X.C0.ETX&&le.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:le.key,domEvent:te}),this._showCursor(),this.coreService.triggerDataEvent(le.key,!0),!this.optionsService.rawOptions.screenReaderMode||te.altKey||te.ctrlKey?this.cancel(te,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(te,Q){const le=te.isMac&&!this.options.macOptionIsMeta&&Q.altKey&&!Q.ctrlKey&&!Q.metaKey||te.isWindows&&Q.altKey&&Q.ctrlKey&&!Q.metaKey||te.isWindows&&Q.getModifierState("AltGraph");return Q.type==="keypress"?le:le&&(!Q.keyCode||Q.keyCode>47)}_keyUp(te){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(te)===!1||((function(Q){return Q.keyCode===16||Q.keyCode===17||Q.keyCode===18})(te)||this.focus(),this.updateCursorStyle(te),this._keyPressHandled=!1)}_keyPress(te){let Q;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(te)===!1)return!1;if(this.cancel(te),te.charCode)Q=te.charCode;else if(te.which===null||te.which===void 0)Q=te.keyCode;else{if(te.which===0||te.charCode===0)return!1;Q=te.which}return!(!Q||(te.altKey||te.ctrlKey||te.metaKey)&&!this._isThirdLevelShift(this.browser,te)||(Q=String.fromCharCode(Q),this._onKey.fire({key:Q,domEvent:te}),this._showCursor(),this.coreService.triggerDataEvent(Q,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(te){if(te.data&&te.inputType==="insertText"&&(!te.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const Q=te.data;return this.coreService.triggerDataEvent(Q,!0),this.cancel(te),!0}return!1}resize(te,Q){te!==this.cols||Q!==this.rows?super.resize(te,Q):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(te,Q){var le,ae;(le=this._charSizeService)==null||le.measure(),(ae=this.viewport)==null||ae.syncScrollArea(!0)}clear(){var te;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let Q=1;Q{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(l,u=1e3){this._renderCallback=l,this._debounceThresholdMS=u,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(l,u,_){this._rowCount=_,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const p=d-this._lastRefreshMs,m=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),m)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const l=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,u)}}},1680:function(a,o,l){var u=this&&this.__decorate||function(b,w,y,C){var E,N=arguments.length,T=N<3?w:C===null?C=Object.getOwnPropertyDescriptor(w,y):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,w,y,C);else for(var z=b.length-1;z>=0;z--)(E=b[z])&&(T=(N<3?E(T):N>3?E(w,y,T):E(w,y))||T);return N>3&&T&&Object.defineProperty(w,y,T),T},_=this&&this.__param||function(b,w){return function(y,C){w(y,C,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const d=l(3656),p=l(4725),m=l(8460),x=l(844),S=l(2585);let v=o.Viewport=class extends x.Disposable{constructor(b,w,y,C,E,N,T,z){super(),this._viewportElement=b,this._scrollArea=w,this._bufferService=y,this._optionsService=C,this._charSizeService=E,this._renderService=N,this._coreBrowserService=T,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new m.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((M=>this._activeBuffer=M.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((M=>this._renderDimensions=M))),this._handleThemeChange(z.colors),this.register(z.onChangeColors((M=>this._handleThemeChange(M)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(b){this._viewportElement.style.backgroundColor=b.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(b){if(b)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const w=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==w&&(this._lastRecordedBufferHeight=w,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const b=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==b&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=b),this._refreshAnimationFrame=null}syncScrollArea(b=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(b);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(b)}_handleScroll(b){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const w=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:w,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const b=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(b*(this._smoothScrollState.target-this._smoothScrollState.origin)),b<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(b,w){const y=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(w<0&&this._viewportElement.scrollTop!==0||w>0&&y0&&(y=$),C=""}}return{bufferElements:E,cursorElement:y}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let w=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(w/=this._currentRowHeight+0,this._wheelPartialScroll+=w,w=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(w*=this._bufferService.rows),w}_applyScrollModifier(b,w){const y=this._optionsService.rawOptions.fastScrollModifier;return y==="alt"&&w.altKey||y==="ctrl"&&w.ctrlKey||y==="shift"&&w.shiftKey?b*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:b*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(b){this._lastTouchY=b.touches[0].pageY}handleTouchMove(b){const w=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,w!==0&&(this._viewportElement.scrollTop+=w,this._bubbleScroll(b,w))}};o.Viewport=v=u([_(2,S.IBufferService),_(3,S.IOptionsService),_(4,p.ICharSizeService),_(5,p.IRenderService),_(6,p.ICoreBrowserService),_(7,p.IThemeService)],v)},3107:function(a,o,l){var u=this&&this.__decorate||function(S,v,b,w){var y,C=arguments.length,E=C<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,b):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(S,v,b,w);else for(var N=S.length-1;N>=0;N--)(y=S[N])&&(E=(C<3?y(E):C>3?y(v,b,E):y(v,b))||E);return C>3&&E&&Object.defineProperty(v,b,E),E},_=this&&this.__param||function(S,v){return function(b,w){v(b,w,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const d=l(4725),p=l(844),m=l(2585);let x=o.BufferDecorationRenderer=class extends p.Disposable{constructor(S,v,b,w,y){super(),this._screenElement=S,this._bufferService=v,this._coreBrowserService=b,this._decorationService=w,this._renderService=y,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((C=>this._removeDecoration(C)))),this.register((0,p.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const S of this._decorationService.decorations)this._renderDecoration(S);this._dimensionsChanged=!1}_renderDecoration(S){this._refreshStyle(S),this._dimensionsChanged&&this._refreshXPosition(S)}_createElement(S){var w;const v=this._coreBrowserService.mainDocument.createElement("div");v.classList.add("xterm-decoration"),v.classList.toggle("xterm-decoration-top-layer",((w=S==null?void 0:S.options)==null?void 0:w.layer)==="top"),v.style.width=`${Math.round((S.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,v.style.height=(S.options.height||1)*this._renderService.dimensions.css.cell.height+"px",v.style.top=(S.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",v.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=S.options.x??0;return b&&b>this._bufferService.cols&&(v.style.display="none"),this._refreshXPosition(S,v),v}_refreshStyle(S){const v=S.marker.line-this._bufferService.buffers.active.ydisp;if(v<0||v>=this._bufferService.rows)S.element&&(S.element.style.display="none",S.onRenderEmitter.fire(S.element));else{let b=this._decorationElements.get(S);b||(b=this._createElement(S),S.element=b,this._decorationElements.set(S,b),this._container.appendChild(b),S.onDispose((()=>{this._decorationElements.delete(S),b.remove()}))),b.style.top=v*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",S.onRenderEmitter.fire(b)}}_refreshXPosition(S,v=S.element){if(!v)return;const b=S.options.x??0;(S.options.anchor||"left")==="right"?v.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":v.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(S){var v;(v=this._decorationElements.get(S))==null||v.remove(),this._decorationElements.delete(S),S.dispose()}};o.BufferDecorationRenderer=x=u([_(1,m.IBufferService),_(2,d.ICoreBrowserService),_(3,m.IDecorationService),_(4,d.IRenderService)],x)},5871:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorZoneStore=void 0,o.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(l){if(l.options.overviewRulerOptions){for(const u of this._zones)if(u.color===l.options.overviewRulerOptions.color&&u.position===l.options.overviewRulerOptions.position){if(this._lineIntersectsZone(u,l.marker.line))return;if(this._lineAdjacentToZone(u,l.marker.line,l.options.overviewRulerOptions.position))return void this._addLineToZone(u,l.marker.line)}if(this._zonePoolIndex=l.startBufferLine&&u<=l.endBufferLine}_lineAdjacentToZone(l,u,_){return u>=l.startBufferLine-this._linePadding[_||"full"]&&u<=l.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(l,u){l.startBufferLine=Math.min(l.startBufferLine,u),l.endBufferLine=Math.max(l.endBufferLine,u)}}},5744:function(a,o,l){var u=this&&this.__decorate||function(y,C,E,N){var T,z=arguments.length,M=z<3?C:N===null?N=Object.getOwnPropertyDescriptor(C,E):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,C,E,N);else for(var I=y.length-1;I>=0;I--)(T=y[I])&&(M=(z<3?T(M):z>3?T(C,E,M):T(C,E))||M);return z>3&&M&&Object.defineProperty(C,E,M),M},_=this&&this.__param||function(y,C){return function(E,N){C(E,N,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const d=l(5871),p=l(4725),m=l(844),x=l(2585),S={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let w=o.OverviewRulerRenderer=class extends m.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(y,C,E,N,T,z,M){var B;super(),this._viewportElement=y,this._screenElement=C,this._bufferService=E,this._decorationService=N,this._renderService=T,this._optionsService=z,this._coreBrowserService=M,this._colorZoneStore=new d.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(B=this._viewportElement.parentElement)==null||B.insertBefore(this._canvas,this._viewportElement);const I=this._canvas.getContext("2d");if(!I)throw new Error("Ctx cannot be null");this._ctx=I,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,m.toDisposable)((()=>{var $;($=this._canvas)==null||$.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const y=Math.floor(this._canvas.width/3),C=Math.ceil(this._canvas.width/3);v.full=this._canvas.width,v.left=y,v.center=C,v.right=y,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=v.left,b.right=v.left+v.center}_refreshDrawHeightConstants(){S.full=Math.round(2*this._coreBrowserService.dpr);const y=this._canvas.height/this._bufferService.buffer.lines.length,C=Math.round(Math.max(Math.min(y,12),6)*this._coreBrowserService.dpr);S.left=C,S.center=C,S.right=C}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*S.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const C of this._decorationService.decorations)this._colorZoneStore.addDecoration(C);this._ctx.lineWidth=1;const y=this._colorZoneStore.zones;for(const C of y)C.position!=="full"&&this._renderColorZone(C);for(const C of y)C.position==="full"&&this._renderColorZone(C);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(y){this._ctx.fillStyle=y.color,this._ctx.fillRect(b[y.position||"full"],Math.round((this._canvas.height-1)*(y.startBufferLine/this._bufferService.buffers.active.lines.length)-S[y.position||"full"]/2),v[y.position||"full"],Math.round((this._canvas.height-1)*((y.endBufferLine-y.startBufferLine)/this._bufferService.buffers.active.lines.length)+S[y.position||"full"]))}_queueRefresh(y,C){this._shouldUpdateDimensions=y||this._shouldUpdateDimensions,this._shouldUpdateAnchor=C||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=w=u([_(2,x.IBufferService),_(3,x.IDecorationService),_(4,p.IRenderService),_(5,x.IOptionsService),_(6,p.ICoreBrowserService)],w)},2950:function(a,o,l){var u=this&&this.__decorate||function(S,v,b,w){var y,C=arguments.length,E=C<3?v:w===null?w=Object.getOwnPropertyDescriptor(v,b):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(S,v,b,w);else for(var N=S.length-1;N>=0;N--)(y=S[N])&&(E=(C<3?y(E):C>3?y(v,b,E):y(v,b))||E);return C>3&&E&&Object.defineProperty(v,b,E),E},_=this&&this.__param||function(S,v){return function(b,w){v(b,w,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const d=l(4725),p=l(2585),m=l(2584);let x=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(S,v,b,w,y,C){this._textarea=S,this._compositionView=v,this._bufferService=b,this._optionsService=w,this._coreService=y,this._renderService=C,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(S){this._compositionView.textContent=S.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(S){if(this._isComposing||this._isSendingComposition){if(S.keyCode===229||S.keyCode===16||S.keyCode===17||S.keyCode===18)return!1;this._finalizeComposition(!1)}return S.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(S){if(this._compositionView.classList.remove("active"),this._isComposing=!1,S){const v={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,v.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(v.start,v.end):this._textarea.value.substring(v.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const v=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(v,!0)}}_handleAnyTextareaChanges(){const S=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const v=this._textarea.value,b=v.replace(S,"");this._dataAlreadySent=b,v.length>S.length?this._coreService.triggerDataEvent(b,!0):v.lengththis.updateCompositionElements(!0)),0)}}};o.CompositionHelper=x=u([_(2,p.IBufferService),_(3,p.IOptionsService),_(4,p.ICoreService),_(5,d.IRenderService)],x)},9806:(a,o)=>{function l(u,_,d){const p=d.getBoundingClientRect(),m=u.getComputedStyle(d),x=parseInt(m.getPropertyValue("padding-left")),S=parseInt(m.getPropertyValue("padding-top"));return[_.clientX-p.left-x,_.clientY-p.top-S]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=l,o.getCoords=function(u,_,d,p,m,x,S,v,b){if(!x)return;const w=l(u,_,d);return w?(w[0]=Math.ceil((w[0]+(b?S/2:0))/S),w[1]=Math.ceil(w[1]/v),w[0]=Math.min(Math.max(w[0],1),p+(b?1:0)),w[1]=Math.min(Math.max(w[1],1),m),w):void 0}},9504:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const u=l(2584);function _(v,b,w,y){const C=v-d(v,w),E=b-d(b,w),N=Math.abs(C-E)-(function(T,z,M){let I=0;const B=T-d(T,M),$=z-d(z,M);for(let U=0;U=0&&vb?"A":"B"}function m(v,b,w,y,C,E){let N=v,T=b,z="";for(;N!==w||T!==y;)N+=C?1:-1,C&&N>E.cols-1?(z+=E.buffer.translateBufferLineToString(T,!1,v,N),N=0,v=0,T++):!C&&N<0&&(z+=E.buffer.translateBufferLineToString(T,!1,0,v+1),N=E.cols-1,v=N,T--);return z+E.buffer.translateBufferLineToString(T,!1,v,N)}function x(v,b){const w=b?"O":"[";return u.C0.ESC+w+v}function S(v,b){v=Math.floor(v);let w="";for(let y=0;y0?B-d(B,$):M;const Y=B,V=(function(X,ee,O,L,F,q){let G;return G=_(O,L,F,q).length>0?L-d(L,F):ee,X=O&&Gv?"D":"C",S(Math.abs(C-v),x(N,y));N=E>b?"D":"C";const T=Math.abs(E-b);return S((function(z,M){return M.cols-z})(E>b?v:C,w)+(T-1)*w.cols+1+((E>b?C:v)-1),x(N,y))}},1296:function(a,o,l){var u=this&&this.__decorate||function(U,H,Y,V){var X,ee=arguments.length,O=ee<3?H:V===null?V=Object.getOwnPropertyDescriptor(H,Y):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(U,H,Y,V);else for(var L=U.length-1;L>=0;L--)(X=U[L])&&(O=(ee<3?X(O):ee>3?X(H,Y,O):X(H,Y))||O);return ee>3&&O&&Object.defineProperty(H,Y,O),O},_=this&&this.__param||function(U,H){return function(Y,V){H(Y,V,U)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const d=l(3787),p=l(2550),m=l(2223),x=l(6171),S=l(6052),v=l(4725),b=l(8055),w=l(8460),y=l(844),C=l(2585),E="xterm-dom-renderer-owner-",N="xterm-rows",T="xterm-fg-",z="xterm-bg-",M="xterm-focus",I="xterm-selection";let B=1,$=o.DomRenderer=class extends y.Disposable{constructor(U,H,Y,V,X,ee,O,L,F,q,G,re,ce){super(),this._terminal=U,this._document=H,this._element=Y,this._screenElement=V,this._viewportElement=X,this._helperContainer=ee,this._linkifier2=O,this._charSizeService=F,this._optionsService=q,this._bufferService=G,this._coreBrowserService=re,this._themeService=ce,this._terminalClass=B++,this._rowElements=[],this._selectionRenderModel=(0,S.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new w.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(N),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(I),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,x.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((oe=>this._injectCss(oe)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(E+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((oe=>this._handleLinkHover(oe)))),this.register(this._linkifier2.onHideLinkUnderline((oe=>this._handleLinkLeave(oe)))),this.register((0,y.toDisposable)((()=>{this._element.classList.remove(E+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new p.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const U=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*U,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*U),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/U),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/U),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const Y of this._rowElements)Y.style.width=`${this.dimensions.css.canvas.width}px`,Y.style.height=`${this.dimensions.css.cell.height}px`,Y.style.lineHeight=`${this.dimensions.css.cell.height}px`,Y.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const H=`${this._terminalSelector} .${N} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=H,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(U){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let H=`${this._terminalSelector} .${N} { color: ${U.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;H+=`${this._terminalSelector} .${N} .xterm-dim { color: ${b.color.multiplyOpacity(U.foreground,.5).css};}`,H+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const Y=`blink_underline_${this._terminalClass}`,V=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;H+=`@keyframes ${Y} { 50% { border-bottom-style: hidden; }}`,H+=`@keyframes ${V} { 50% { box-shadow: none; }}`,H+=`@keyframes ${X} { 0% { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css}; } 50% { background-color: inherit; color: ${U.cursor.css}; }}`,H+=`${this._terminalSelector} .${N}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${N}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${V} 1s step-end infinite;}${this._terminalSelector} .${N}.${M} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css};}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${U.cursor.css} !important; color: ${U.cursorAccent.css} !important;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${U.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${U.cursor.css} inset;}${this._terminalSelector} .${N} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${U.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,H+=`${this._terminalSelector} .${I} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${I} div { position: absolute; background-color: ${U.selectionBackgroundOpaque.css};}${this._terminalSelector} .${I} div { position: absolute; background-color: ${U.selectionInactiveBackgroundOpaque.css};}`;for(const[ee,O]of U.ansi.entries())H+=`${this._terminalSelector} .${T}${ee} { color: ${O.css}; }${this._terminalSelector} .${T}${ee}.xterm-dim { color: ${b.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${z}${ee} { background-color: ${O.css}; }`;H+=`${this._terminalSelector} .${T}${m.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(U.background).css}; }${this._terminalSelector} .${T}${m.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(U.background),.5).css}; }${this._terminalSelector} .${z}${m.INVERTED_DEFAULT_COLOR} { background-color: ${U.foreground.css}; }`,this._themeStyleElement.textContent=H}_setDefaultSpacing(){const U=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${U}px`,this._rowFactory.defaultSpacing=U}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(U,H){for(let Y=this._rowElements.length;Y<=H;Y++){const V=this._document.createElement("div");this._rowContainer.appendChild(V),this._rowElements.push(V)}for(;this._rowElements.length>H;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(U,H){this._refreshRowElements(U,H),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(M),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(M),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(U,H,Y){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(U,H,Y),this.renderRows(0,this._bufferService.rows-1),!U||!H)return;this._selectionRenderModel.update(this._terminal,U,H,Y);const V=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,ee=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(ee>=this._bufferService.rows||O<0)return;const L=this._document.createDocumentFragment();if(Y){const F=U[0]>H[0];L.appendChild(this._createSelectionElement(ee,F?H[0]:U[0],F?U[0]:H[0],O-ee+1))}else{const F=V===ee?U[0]:0,q=ee===X?H[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(ee,F,q));const G=O-ee-1;if(L.appendChild(this._createSelectionElement(ee+1,0,this._bufferService.cols,G)),ee!==O){const re=X===O?H[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(O,0,re))}}this._selectionContainer.appendChild(L)}_createSelectionElement(U,H,Y,V=1){const X=this._document.createElement("div"),ee=H*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(Y-H);return ee+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-ee),X.style.height=V*this.dimensions.css.cell.height+"px",X.style.top=U*this.dimensions.css.cell.height+"px",X.style.left=`${ee}px`,X.style.width=`${O}px`,X}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const U of this._rowElements)U.replaceChildren()}renderRows(U,H){const Y=this._bufferService.buffer,V=Y.ybase+Y.y,X=Math.min(Y.x,this._bufferService.cols-1),ee=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let F=U;F<=H;F++){const q=F+Y.ydisp,G=this._rowElements[F],re=Y.lines.get(q);if(!G||!re)break;G.replaceChildren(...this._rowFactory.createRow(re,q,q===V,O,L,X,ee,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${E}${this._terminalClass}`}_handleLinkHover(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!0)}_handleLinkLeave(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!1)}_setCellUnderline(U,H,Y,V,X,ee){Y<0&&(U=0),V<0&&(H=0);const O=this._bufferService.rows-1;Y=Math.max(Math.min(Y,O),0),V=Math.max(Math.min(V,O),0),X=Math.min(X,this._bufferService.cols);const L=this._bufferService.buffer,F=L.ybase+L.y,q=Math.min(L.x,X-1),G=this._optionsService.rawOptions.cursorBlink,re=this._optionsService.rawOptions.cursorStyle,ce=this._optionsService.rawOptions.cursorInactiveStyle;for(let oe=Y;oe<=V;++oe){const te=oe+L.ydisp,Q=this._rowElements[oe],le=L.lines.get(te);if(!Q||!le)break;Q.replaceChildren(...this._rowFactory.createRow(le,te,te===F,re,ce,q,G,this.dimensions.css.cell.width,this._widthCache,ee?oe===Y?U:0:-1,ee?(oe===V?H:X)-1:-1))}}};o.DomRenderer=$=u([_(7,C.IInstantiationService),_(8,v.ICharSizeService),_(9,C.IOptionsService),_(10,C.IBufferService),_(11,v.ICoreBrowserService),_(12,v.IThemeService)],$)},3787:function(a,o,l){var u=this&&this.__decorate||function(N,T,z,M){var I,B=arguments.length,$=B<3?T:M===null?M=Object.getOwnPropertyDescriptor(T,z):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(N,T,z,M);else for(var U=N.length-1;U>=0;U--)(I=N[U])&&($=(B<3?I($):B>3?I(T,z,$):I(T,z))||$);return B>3&&$&&Object.defineProperty(T,z,$),$},_=this&&this.__param||function(N,T){return function(z,M){T(z,M,N)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const d=l(2223),p=l(643),m=l(511),x=l(2585),S=l(8055),v=l(4725),b=l(4269),w=l(6171),y=l(3734);let C=o.DomRendererRowFactory=class{constructor(N,T,z,M,I,B,$){this._document=N,this._characterJoinerService=T,this._optionsService=z,this._coreBrowserService=M,this._coreService=I,this._decorationService=B,this._themeService=$,this._workCell=new m.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(N,T,z){this._selectionStart=N,this._selectionEnd=T,this._columnSelectMode=z}createRow(N,T,z,M,I,B,$,U,H,Y,V){const X=[],ee=this._characterJoinerService.getJoinedCharacters(T),O=this._themeService.colors;let L,F=N.getNoBgTrimmedLength();z&&F0&&we===ee[0][0]){Pe=!0;const Ve=ee.shift();ze=new b.JoinedCellData(this._workCell,N.translateToString(!0,Ve[0],Ve[1]),Ve[1]-Ve[0]),Be=Ve[1]-1,be=ze.getWidth()}const it=this._isCellInSelection(we,T),bt=z&&we===B,It=pe&&we>=Y&&we<=V;let $t=!1;this._decorationService.forEachDecorationAtCell(we,T,void 0,(Ve=>{$t=!0}));let jt=ze.getChars()||p.WHITESPACE_CELL_CHAR;if(jt===" "&&(ze.isUnderline()||ze.isOverline())&&(jt=" "),ae=be*U-H.get(jt,ze.isBold(),ze.isItalic()),L){if(q&&(it&&le||!it&&!le&&ze.bg===re)&&(it&&le&&O.selectionForeground||ze.fg===ce)&&ze.extended.ext===oe&&It===te&&ae===Q&&!bt&&!Pe&&!$t){ze.isInvisible()?G+=p.WHITESPACE_CELL_CHAR:G+=jt,q++;continue}q&&(L.textContent=G),L=this._document.createElement("span"),q=0,G=""}else L=this._document.createElement("span");if(re=ze.bg,ce=ze.fg,oe=ze.extended.ext,te=It,Q=ae,le=it,Pe&&B>=we&&B<=Be&&(B=we),!this._coreService.isCursorHidden&&bt&&this._coreService.isCursorInitialized){if(de.push("xterm-cursor"),this._coreBrowserService.isFocused)$&&de.push("xterm-cursor-blink"),de.push(M==="bar"?"xterm-cursor-bar":M==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(I)switch(I){case"outline":de.push("xterm-cursor-outline");break;case"block":de.push("xterm-cursor-block");break;case"bar":de.push("xterm-cursor-bar");break;case"underline":de.push("xterm-cursor-underline")}}if(ze.isBold()&&de.push("xterm-bold"),ze.isItalic()&&de.push("xterm-italic"),ze.isDim()&&de.push("xterm-dim"),G=ze.isInvisible()?p.WHITESPACE_CELL_CHAR:ze.getChars()||p.WHITESPACE_CELL_CHAR,ze.isUnderline()&&(de.push(`xterm-underline-${ze.extended.underlineStyle}`),G===" "&&(G=" "),!ze.isUnderlineColorDefault()))if(ze.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${y.AttributeData.toColorRGB(ze.getUnderlineColor()).join(",")})`;else{let Ve=ze.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ze.isBold()&&Ve<8&&(Ve+=8),L.style.textDecorationColor=O.ansi[Ve].css}ze.isOverline()&&(de.push("xterm-overline"),G===" "&&(G=" ")),ze.isStrikethrough()&&de.push("xterm-strikethrough"),It&&(L.style.textDecoration="underline");let ct=ze.getFgColor(),ut=ze.getFgColorMode(),Ht=ze.getBgColor(),Se=ze.getBgColorMode();const Ae=!!ze.isInverse();if(Ae){const Ve=ct;ct=Ht,Ht=Ve;const qt=ut;ut=Se,Se=qt}let Ze,ht,wt,en=!1;switch(this._decorationService.forEachDecorationAtCell(we,T,void 0,(Ve=>{Ve.options.layer!=="top"&&en||(Ve.backgroundColorRGB&&(Se=50331648,Ht=Ve.backgroundColorRGB.rgba>>8&16777215,Ze=Ve.backgroundColorRGB),Ve.foregroundColorRGB&&(ut=50331648,ct=Ve.foregroundColorRGB.rgba>>8&16777215,ht=Ve.foregroundColorRGB),en=Ve.options.layer==="top")})),!en&&it&&(Ze=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,Ht=Ze.rgba>>8&16777215,Se=50331648,en=!0,O.selectionForeground&&(ut=50331648,ct=O.selectionForeground.rgba>>8&16777215,ht=O.selectionForeground)),en&&de.push("xterm-decoration-top"),Se){case 16777216:case 33554432:wt=O.ansi[Ht],de.push(`xterm-bg-${Ht}`);break;case 50331648:wt=S.channels.toColor(Ht>>16,Ht>>8&255,255&Ht),this._addStyle(L,`background-color:#${E((Ht>>>0).toString(16),"0",6)}`);break;default:Ae?(wt=O.foreground,de.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):wt=O.background}switch(Ze||ze.isDim()&&(Ze=S.color.multiplyOpacity(wt,.5)),ut){case 16777216:case 33554432:ze.isBold()&&ct<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ct+=8),this._applyMinimumContrast(L,wt,O.ansi[ct],ze,Ze,void 0)||de.push(`xterm-fg-${ct}`);break;case 50331648:const Ve=S.channels.toColor(ct>>16&255,ct>>8&255,255&ct);this._applyMinimumContrast(L,wt,Ve,ze,Ze,ht)||this._addStyle(L,`color:#${E(ct.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,wt,O.foreground,ze,Ze,ht)||Ae&&de.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}de.length&&(L.className=de.join(" "),de.length=0),bt||Pe||$t?L.textContent=G:q++,ae!==this.defaultSpacing&&(L.style.letterSpacing=`${ae}px`),X.push(L),we=Be}return L&&q&&(L.textContent=G),X}_applyMinimumContrast(N,T,z,M,I,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,w.treatGlyphAsBackgroundColor)(M.getCode()))return!1;const $=this._getContrastCache(M);let U;if(I||B||(U=$.getColor(T.rgba,z.rgba)),U===void 0){const H=this._optionsService.rawOptions.minimumContrastRatio/(M.isDim()?2:1);U=S.color.ensureContrastRatio(I||T,B||z,H),$.setColor((I||T).rgba,(B||z).rgba,U??null)}return!!U&&(this._addStyle(N,`color:${U.css}`),!0)}_getContrastCache(N){return N.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(N,T){N.setAttribute("style",`${N.getAttribute("style")||""}${T};`)}_isCellInSelection(N,T){const z=this._selectionStart,M=this._selectionEnd;return!(!z||!M)&&(this._columnSelectMode?z[0]<=M[0]?N>=z[0]&&T>=z[1]&&N=z[1]&&N>=M[0]&&T<=M[1]:T>z[1]&&T=z[0]&&N=z[0])}};function E(N,T,z){for(;N.length{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(l,u){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=l.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const _=l.createElement("span");_.classList.add("xterm-char-measure-element");const d=l.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const p=l.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontStyle="italic";const m=l.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold",m.style.fontStyle="italic",this._measureElements=[_,d,p,m],this._container.appendChild(_),this._container.appendChild(d),this._container.appendChild(p),this._container.appendChild(m),u.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(l,u,_,d){l===this._font&&u===this._fontSize&&_===this._weight&&d===this._weightBold||(this._font=l,this._fontSize=u,this._weight=_,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${_}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${_}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(l,u,_){let d=0;if(!u&&!_&&l.length===1&&(d=l.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const x=this._measure(l,0);return x>0&&(this._flat[d]=x),x}let p=l;u&&(p+="B"),_&&(p+="I");let m=this._holey.get(p);if(m===void 0){let x=0;u&&(x|=1),_&&(x|=2),m=this._measure(l,x),m>0&&this._holey.set(p,m)}return m}_measure(l,u){const _=this._measureElements[u];return _.textContent=l.repeat(32),_.offsetWidth/32}}},2223:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const u=l(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=u.isFirefox||u.isLegacyEdge?"bottom":"ideographic"},6171:(a,o)=>{function l(_){return 57508<=_&&_<=57558}function u(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(o,"__esModule",{value:!0}),o.computeNextVariantOffset=o.createRenderDimensions=o.treatGlyphAsBackgroundColor=o.allowRescaling=o.isEmoji=o.isRestrictedPowerlineGlyph=o.isPowerlineGlyph=o.throwIfFalsy=void 0,o.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},o.isPowerlineGlyph=l,o.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},o.isEmoji=u,o.allowRescaling=function(_,d,p,m){return d===1&&p>Math.ceil(1.5*m)&&_!==void 0&&_>255&&!u(_)&&!l(_)&&!(function(x){return 57344<=x&&x<=63743})(_)},o.treatGlyphAsBackgroundColor=function(_){return l(_)||(function(d){return 9472<=d&&d<=9631})(_)},o.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},o.computeNextVariantOffset=function(_,d,p=0){return(_-(2*Math.round(d)-p))%(2*Math.round(d))}},6052:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class l{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(_,d,p,m=!1){if(this.selectionStart=d,this.selectionEnd=p,!d||!p||d[0]===p[0]&&d[1]===p[1])return void this.clear();const x=_.buffers.active.ydisp,S=d[1]-x,v=p[1]-x,b=Math.max(S,0),w=Math.min(v,_.rows-1);b>=_.rows||w<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=m,this.viewportStartRow=S,this.viewportEndRow=v,this.viewportCappedStartRow=b,this.viewportCappedEndRow=w,this.startCol=d[0],this.endCol=p[0])}isCellSelected(_,d,p){return!!this.hasSelection&&(p-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&p>=this.viewportCappedStartRow&&d=this.viewportCappedStartRow&&d>=this.endCol&&p<=this.viewportCappedEndRow:p>this.viewportStartRow&&p=this.startCol&&d=this.startCol)}}o.createSelectionRenderModel=function(){return new l}},456:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.SelectionModel=class{constructor(l){this._bufferService=l,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?l%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)-1]:[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[l,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[Math.max(l,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const l=this.selectionStart,u=this.selectionEnd;return!(!l||!u)&&(l[1]>u[1]||l[1]===u[1]&&l[0]>u[0])}handleTrim(l){return this.selectionStart&&(this.selectionStart[1]-=l),this.selectionEnd&&(this.selectionEnd[1]-=l),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(a,o,l){var u=this&&this.__decorate||function(w,y,C,E){var N,T=arguments.length,z=T<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,C):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(w,y,C,E);else for(var M=w.length-1;M>=0;M--)(N=w[M])&&(z=(T<3?N(z):T>3?N(y,C,z):N(y,C))||z);return T>3&&z&&Object.defineProperty(y,C,z),z},_=this&&this.__param||function(w,y){return function(C,E){y(C,E,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const d=l(2585),p=l(8460),m=l(844);let x=o.CharSizeService=class extends m.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(w,y,C){super(),this._optionsService=C,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new v(w,y,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const w=this._measureStrategy.measure();w.width===this.width&&w.height===this.height||(this.width=w.width,this.height=w.height,this._onCharSizeChange.fire())}};o.CharSizeService=x=u([_(2,d.IOptionsService)],x);class S extends m.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(y,C){y!==void 0&&y>0&&C!==void 0&&C>0&&(this._result.width=y,this._result.height=C)}}class v extends S{constructor(y,C,E){super(),this._document=y,this._parentElement=C,this._optionsService=E,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class b extends S{constructor(y){super(),this._optionsService=y,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const C=this._ctx.measureText("W");if(!("width"in C&&"fontBoundingBoxAscent"in C&&"fontBoundingBoxDescent"in C))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const y=this._ctx.measureText("W");return this._validateAndSet(y.width,y.fontBoundingBoxAscent+y.fontBoundingBoxDescent),this._result}}},4269:function(a,o,l){var u=this&&this.__decorate||function(b,w,y,C){var E,N=arguments.length,T=N<3?w:C===null?C=Object.getOwnPropertyDescriptor(w,y):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,w,y,C);else for(var z=b.length-1;z>=0;z--)(E=b[z])&&(T=(N<3?E(T):N>3?E(w,y,T):E(w,y))||T);return N>3&&T&&Object.defineProperty(w,y,T),T},_=this&&this.__param||function(b,w){return function(y,C){w(y,C,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const d=l(3734),p=l(643),m=l(511),x=l(2585);class S extends d.AttributeData{constructor(w,y,C){super(),this.content=0,this.combinedData="",this.fg=w.fg,this.bg=w.bg,this.combinedData=y,this._width=C}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(w){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=S;let v=o.CharacterJoinerService=class xO{constructor(w){this._bufferService=w,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new m.CellData}register(w){const y={id:this._nextCharacterJoinerId++,handler:w};return this._characterJoiners.push(y),y.id}deregister(w){for(let y=0;y1){const $=this._getJoinedRanges(E,z,T,y,N);for(let U=0;U<$.length;U++)C.push($[U])}N=B,z=T,M=this._workCell.fg,I=this._workCell.bg}T+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-N>1){const B=this._getJoinedRanges(E,z,T,y,N);for(let $=0;${Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const u=l(844),_=l(8460),d=l(3656);class p extends u.Disposable{constructor(S,v,b){super(),this._textarea=S,this._window=v,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new m(this._window),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new _.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((w=>this._screenDprMonitor.setWindow(w)))),this.register((0,_.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(S){this._window!==S&&(this._window=S,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}o.CoreBrowserService=p;class m extends u.Disposable{constructor(S){super(),this._parentWindow=S,this._windowResizeListener=this.register(new u.MutableDisposable),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,u.toDisposable)((()=>this.clearListener())))}setWindow(S){this._parentWindow=S,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,d.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var S;this._outerListener&&((S=this._resolutionMediaMatchList)==null||S.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const u=l(844);class _ extends u.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,u.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(p){return this.linkProviders.push(p),{dispose:()=>{const m=this.linkProviders.indexOf(p);m!==-1&&this.linkProviders.splice(m,1)}}}}o.LinkProviderService=_},8934:function(a,o,l){var u=this&&this.__decorate||function(x,S,v,b){var w,y=arguments.length,C=y<3?S:b===null?b=Object.getOwnPropertyDescriptor(S,v):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(x,S,v,b);else for(var E=x.length-1;E>=0;E--)(w=x[E])&&(C=(y<3?w(C):y>3?w(S,v,C):w(S,v))||C);return y>3&&C&&Object.defineProperty(S,v,C),C},_=this&&this.__param||function(x,S){return function(v,b){S(v,b,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const d=l(4725),p=l(9806);let m=o.MouseService=class{constructor(x,S){this._renderService=x,this._charSizeService=S}getCoords(x,S,v,b,w){return(0,p.getCoords)(window,x,S,v,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,w)}getMouseReportCoords(x,S){const v=(0,p.getCoordsRelativeToElement)(window,x,S);if(this._charSizeService.hasValidSize)return v[0]=Math.min(Math.max(v[0],0),this._renderService.dimensions.css.canvas.width-1),v[1]=Math.min(Math.max(v[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(v[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(v[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(v[0]),y:Math.floor(v[1])}}};o.MouseService=m=u([_(0,d.IRenderService),_(1,d.ICharSizeService)],m)},3230:function(a,o,l){var u=this&&this.__decorate||function(w,y,C,E){var N,T=arguments.length,z=T<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,C):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(w,y,C,E);else for(var M=w.length-1;M>=0;M--)(N=w[M])&&(z=(T<3?N(z):T>3?N(y,C,z):N(y,C))||z);return T>3&&z&&Object.defineProperty(y,C,z),z},_=this&&this.__param||function(w,y){return function(C,E){y(C,E,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const d=l(6193),p=l(4725),m=l(8460),x=l(844),S=l(7226),v=l(2585);let b=o.RenderService=class extends x.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(w,y,C,E,N,T,z,M){super(),this._rowCount=w,this._charSizeService=E,this._renderer=this.register(new x.MutableDisposable),this._pausedResizeTask=new S.DebouncedIdleTask,this._observerDisposable=this.register(new x.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new m.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new m.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new m.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new m.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((I,B)=>this._renderRows(I,B)),z),this.register(this._renderDebouncer),this.register(z.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(T.onResize((()=>this._fullRefresh()))),this.register(T.buffers.onBufferActivate((()=>{var I;return(I=this._renderer.value)==null?void 0:I.clear()}))),this.register(C.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(N.onDecorationRegistered((()=>this._fullRefresh()))),this.register(N.onDecorationRemoved((()=>this._fullRefresh()))),this.register(C.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(T.cols,T.rows),this._fullRefresh()}))),this.register(C.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(T.buffer.y,T.buffer.y,!0)))),this.register(M.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(z.window,y),this.register(z.onWindowChange((I=>this._registerIntersectionObserver(I,y))))}_registerIntersectionObserver(w,y){if("IntersectionObserver"in w){const C=new w.IntersectionObserver((E=>this._handleIntersectionChange(E[E.length-1])),{threshold:0});C.observe(y),this._observerDisposable.value=(0,x.toDisposable)((()=>C.disconnect()))}}_handleIntersectionChange(w){this._isPaused=w.isIntersecting===void 0?w.intersectionRatio===0:!w.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(w,y,C=!1){this._isPaused?this._needsFullRefresh=!0:(C||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(w,y,this._rowCount))}_renderRows(w,y){this._renderer.value&&(w=Math.min(w,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(w,y),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:w,end:y}),this._onRender.fire({start:w,end:y}),this._isNextRenderRedrawOnly=!0)}resize(w,y){this._rowCount=y,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(w){this._renderer.value=w,this._renderer.value&&(this._renderer.value.onRequestRedraw((y=>this.refreshRows(y.start,y.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(w){return this._renderDebouncer.addRefreshCallback(w)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var w,y;this._renderer.value&&((y=(w=this._renderer.value).clearTextureAtlas)==null||y.call(w),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(w,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var C;return(C=this._renderer.value)==null?void 0:C.handleResize(w,y)})):this._renderer.value.handleResize(w,y),this._fullRefresh())}handleCharSizeChanged(){var w;(w=this._renderer.value)==null||w.handleCharSizeChanged()}handleBlur(){var w;(w=this._renderer.value)==null||w.handleBlur()}handleFocus(){var w;(w=this._renderer.value)==null||w.handleFocus()}handleSelectionChanged(w,y,C){var E;this._selectionState.start=w,this._selectionState.end=y,this._selectionState.columnSelectMode=C,(E=this._renderer.value)==null||E.handleSelectionChanged(w,y,C)}handleCursorMove(){var w;(w=this._renderer.value)==null||w.handleCursorMove()}clear(){var w;(w=this._renderer.value)==null||w.clear()}};o.RenderService=b=u([_(2,v.IOptionsService),_(3,p.ICharSizeService),_(4,v.IDecorationService),_(5,v.IBufferService),_(6,p.ICoreBrowserService),_(7,p.IThemeService)],b)},9312:function(a,o,l){var u=this&&this.__decorate||function(z,M,I,B){var $,U=arguments.length,H=U<3?M:B===null?B=Object.getOwnPropertyDescriptor(M,I):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(z,M,I,B);else for(var Y=z.length-1;Y>=0;Y--)($=z[Y])&&(H=(U<3?$(H):U>3?$(M,I,H):$(M,I))||H);return U>3&&H&&Object.defineProperty(M,I,H),H},_=this&&this.__param||function(z,M){return function(I,B){M(I,B,z)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const d=l(9806),p=l(9504),m=l(456),x=l(4725),S=l(8460),v=l(844),b=l(6114),w=l(4841),y=l(511),C=l(2585),E=" ",N=new RegExp(E,"g");let T=o.SelectionService=class extends v.Disposable{constructor(z,M,I,B,$,U,H,Y,V){super(),this._element=z,this._screenElement=M,this._linkifier=I,this._bufferService=B,this._coreService=$,this._mouseService=U,this._optionsService=H,this._renderService=Y,this._coreBrowserService=V,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new y.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new S.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new S.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new S.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new S.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),this.enable(),this._model=new m.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,v.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const z=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!z||!M||z[0]===M[0]&&z[1]===M[1])}get selectionText(){const z=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;if(!z||!M)return"";const I=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(z[0]===M[0])return"";const $=z[0]$.replace(N," "))).join(b.isWindows?`\r `:` -`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(z){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&z&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(z){const M=this._getMouseBufferCoords(z),O=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(O&&B&&M)&&this._areCoordsInSelection(M,O,B)}isCellInSelection(z,M){const O=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!O||!B)&&this._areCoordsInSelection([z,M],O,B)}_areCoordsInSelection(z,M,O){return z[1]>M[1]&&z[1]=M[0]&&z[0]=M[0]}_selectWordAtCursor(z,M){var $,U;const O=(U=($=this._linkifier.currentLink)==null?void 0:$.link)==null?void 0:U.range;if(O)return this._model.selectionStart=[O.start.x-1,O.start.y-1],this._model.selectionStartLength=(0,w.getRangeLength)(O,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(z);return!!B&&(this._selectWordAt(B,M),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(z,M){this._model.clearSelection(),z=Math.max(z,0),M=Math.min(M,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,z],this._model.selectionEnd=[this._bufferService.cols,M],this.refresh(),this._onSelectionChange.fire()}_handleTrim(z){this._model.handleTrim(z)&&this.refresh()}_getMouseBufferCoords(z){const M=this._mouseService.getCoords(z,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(M)return M[0]--,M[1]--,M[1]+=this._bufferService.buffer.ydisp,M}_getMouseEventScrollAmount(z){let M=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,z,this._screenElement)[1];const O=this._renderService.dimensions.css.canvas.height;return M>=0&&M<=O?0:(M>O&&(M-=O),M=Math.min(Math.max(M,-50),50),M/=50,M/Math.abs(M)+Math.round(14*M))}shouldForceSelection(z){return b.isMac?z.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:z.shiftKey}handleMouseDown(z){if(this._mouseDownTimeStamp=z.timeStamp,(z.button!==2||!this.hasSelection)&&z.button===0){if(!this._enabled){if(!this.shouldForceSelection(z))return;z.stopPropagation()}z.preventDefault(),this._dragScrollAmount=0,this._enabled&&z.shiftKey?this._handleIncrementalClick(z):z.detail===1?this._handleSingleClick(z):z.detail===2?this._handleDoubleClick(z):z.detail===3&&this._handleTripleClick(z),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(z){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(z))}_handleSingleClick(z){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(z)?3:0,this._model.selectionStart=this._getMouseBufferCoords(z),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const M=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);M&&M.length!==this._model.selectionStart[0]&&M.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(z){this._selectWordAtCursor(z,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(z){const M=this._getMouseBufferCoords(z);M&&(this._activeSelectionMode=2,this._selectLineAt(M[1]))}shouldColumnSelect(z){return z.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(z){if(z.stopImmediatePropagation(),!this._model.selectionStart)return;const M=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(z),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const O=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(z.ydisp+this._bufferService.rows,z.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=z.ydisp),this.refresh()}}_handleMouseUp(z){const M=z.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&M<500&&z.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const O=this._mouseService.getCoords(z,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(O&&O[0]!==void 0&&O[1]!==void 0){const B=(0,p.moveToCellSequence)(O[0]-1,O[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const z=this._model.finalSelectionStart,M=this._model.finalSelectionEnd,O=!(!z||!M||z[0]===M[0]&&z[1]===M[1]);O?z&&M&&(this._oldSelectionStart&&this._oldSelectionEnd&&z[0]===this._oldSelectionStart[0]&&z[1]===this._oldSelectionStart[1]&&M[0]===this._oldSelectionEnd[0]&&M[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(z,M,O)):this._oldHasSelection&&this._fireOnSelectionChange(z,M,O)}_fireOnSelectionChange(z,M,O){this._oldSelectionStart=z,this._oldSelectionEnd=M,this._oldHasSelection=O,this._onSelectionChange.fire()}_handleBufferActivate(z){this.clearSelection(),this._trimListener.dispose(),this._trimListener=z.activeBuffer.lines.onTrim((M=>this._handleTrim(M)))}_convertViewportColToCharacterIndex(z,M){let O=M;for(let B=0;M>=B;B++){const $=z.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?O--:$>1&&M!==B&&(O+=$-1)}return O}setSelection(z,M,O){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[z,M],this._model.selectionStartLength=O,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(z){this._isClickInSelection(z)||(this._selectWordAtCursor(z,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(z,M,O=!0,B=!0){if(z[0]>=this._bufferService.cols)return;const $=this._bufferService.buffer,U=$.lines.get(z[1]);if(!U)return;const H=$.translateBufferLineToString(z[1],!1);let Y=this._convertViewportColToCharacterIndex(U,z[0]),V=Y;const X=z[0]-Y;let te=0,I=0,L=0,F=0;if(H.charAt(Y)===" "){for(;Y>0&&H.charAt(Y-1)===" ";)Y--;for(;V1&&(F+=oe-1,V+=oe-1);ee>0&&Y>0&&!this._isCharWordSeparator(U.loadCell(ee-1,this._workCell));){U.loadCell(ee-1,this._workCell);const ne=this._workCell.getChars().length;this._workCell.getWidth()===0?(te++,ee--):ne>1&&(L+=ne-1,Y-=ne-1),Y--,ee--}for(;ce1&&(F+=ne-1,V+=ne-1),V++,ce++}}V++;let q=Y+X-te+L,G=Math.min(this._bufferService.cols,V-Y+te+I-L-F);if(M||H.slice(Y,V).trim()!==""){if(O&&q===0&&U.getCodePoint(0)!==32){const ee=$.lines.get(z[1]-1);if(ee&&U.isWrapped&&ee.getCodePoint(this._bufferService.cols-1)!==32){const ce=this._getWordAt([this._bufferService.cols-1,z[1]-1],!1,!0,!1);if(ce){const oe=this._bufferService.cols-ce.start;q-=oe,G+=oe}}}if(B&&q+G===this._bufferService.cols&&U.getCodePoint(this._bufferService.cols-1)!==32){const ee=$.lines.get(z[1]+1);if(ee!=null&&ee.isWrapped&&ee.getCodePoint(0)!==32){const ce=this._getWordAt([0,z[1]+1],!1,!1,!0);ce&&(G+=ce.length)}}return{start:q,length:G}}}_selectWordAt(z,M){const O=this._getWordAt(z,M);if(O){for(;O.start<0;)O.start+=this._bufferService.cols,z[1]--;this._model.selectionStart=[O.start,z[1]],this._model.selectionStartLength=O.length}}_selectToWordAt(z){const M=this._getWordAt(z,!0);if(M){let O=z[1];for(;M.start<0;)M.start+=this._bufferService.cols,O--;if(!this._model.areSelectionValuesReversed())for(;M.start+M.length>this._bufferService.cols;)M.length-=this._bufferService.cols,O++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?M.start:M.start+M.length,O]}}_isCharWordSeparator(z){return z.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(z.getChars())>=0}_selectLineAt(z){const M=this._bufferService.buffer.getWrappedRangeForLine(z),O={start:{x:0,y:M.first},end:{x:this._bufferService.cols-1,y:M.last}};this._model.selectionStart=[0,M.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,w.getRangeLength)(O,this._bufferService.cols)}};o.SelectionService=T=u([_(3,C.IBufferService),_(4,C.ICoreService),_(5,x.IMouseService),_(6,C.IOptionsService),_(7,x.IRenderService),_(8,x.ICoreBrowserService)],T)},4725:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const u=l(8343);o.ICharSizeService=(0,u.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),o.IMouseService=(0,u.createDecorator)("MouseService"),o.IRenderService=(0,u.createDecorator)("RenderService"),o.ISelectionService=(0,u.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,u.createDecorator)("ThemeService"),o.ILinkProviderService=(0,u.createDecorator)("LinkProviderService")},6731:function(a,o,l){var u=this&&this.__decorate||function(T,z,M,O){var B,$=arguments.length,U=$<3?z:O===null?O=Object.getOwnPropertyDescriptor(z,M):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(T,z,M,O);else for(var H=T.length-1;H>=0;H--)(B=T[H])&&(U=($<3?B(U):$>3?B(z,M,U):B(z,M))||U);return $>3&&U&&Object.defineProperty(z,M,U),U},_=this&&this.__param||function(T,z){return function(M,O){z(M,O,T)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=l(7239),p=l(8055),m=l(8460),x=l(844),S=l(2585),v=p.css.toColor("#ffffff"),b=p.css.toColor("#000000"),w=p.css.toColor("#ffffff"),y=p.css.toColor("#000000"),C={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const T=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],z=[0,95,135,175,215,255];for(let M=0;M<216;M++){const O=z[M/36%6|0],B=z[M/6%6|0],$=z[M%6];T.push({css:p.channels.toCss(O,B,$),rgba:p.channels.toRgba(O,B,$)})}for(let M=0;M<24;M++){const O=8+10*M;T.push({css:p.channels.toCss(O,O,O),rgba:p.channels.toRgba(O,O,O)})}return T})());let E=o.ThemeService=class extends x.Disposable{get colors(){return this._colors}constructor(T){super(),this._optionsService=T,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new m.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:b,cursor:w,cursorAccent:y,selectionForeground:void 0,selectionBackgroundTransparent:C,selectionBackgroundOpaque:p.color.blend(b,C),selectionInactiveBackgroundTransparent:C,selectionInactiveBackgroundOpaque:p.color.blend(b,C),ansi:o.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(T={}){const z=this._colors;if(z.foreground=N(T.foreground,v),z.background=N(T.background,b),z.cursor=N(T.cursor,w),z.cursorAccent=N(T.cursorAccent,y),z.selectionBackgroundTransparent=N(T.selectionBackground,C),z.selectionBackgroundOpaque=p.color.blend(z.background,z.selectionBackgroundTransparent),z.selectionInactiveBackgroundTransparent=N(T.selectionInactiveBackground,z.selectionBackgroundTransparent),z.selectionInactiveBackgroundOpaque=p.color.blend(z.background,z.selectionInactiveBackgroundTransparent),z.selectionForeground=T.selectionForeground?N(T.selectionForeground,p.NULL_COLOR):void 0,z.selectionForeground===p.NULL_COLOR&&(z.selectionForeground=void 0),p.color.isOpaque(z.selectionBackgroundTransparent)&&(z.selectionBackgroundTransparent=p.color.opacity(z.selectionBackgroundTransparent,.3)),p.color.isOpaque(z.selectionInactiveBackgroundTransparent)&&(z.selectionInactiveBackgroundTransparent=p.color.opacity(z.selectionInactiveBackgroundTransparent,.3)),z.ansi=o.DEFAULT_ANSI_COLORS.slice(),z.ansi[0]=N(T.black,o.DEFAULT_ANSI_COLORS[0]),z.ansi[1]=N(T.red,o.DEFAULT_ANSI_COLORS[1]),z.ansi[2]=N(T.green,o.DEFAULT_ANSI_COLORS[2]),z.ansi[3]=N(T.yellow,o.DEFAULT_ANSI_COLORS[3]),z.ansi[4]=N(T.blue,o.DEFAULT_ANSI_COLORS[4]),z.ansi[5]=N(T.magenta,o.DEFAULT_ANSI_COLORS[5]),z.ansi[6]=N(T.cyan,o.DEFAULT_ANSI_COLORS[6]),z.ansi[7]=N(T.white,o.DEFAULT_ANSI_COLORS[7]),z.ansi[8]=N(T.brightBlack,o.DEFAULT_ANSI_COLORS[8]),z.ansi[9]=N(T.brightRed,o.DEFAULT_ANSI_COLORS[9]),z.ansi[10]=N(T.brightGreen,o.DEFAULT_ANSI_COLORS[10]),z.ansi[11]=N(T.brightYellow,o.DEFAULT_ANSI_COLORS[11]),z.ansi[12]=N(T.brightBlue,o.DEFAULT_ANSI_COLORS[12]),z.ansi[13]=N(T.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),z.ansi[14]=N(T.brightCyan,o.DEFAULT_ANSI_COLORS[14]),z.ansi[15]=N(T.brightWhite,o.DEFAULT_ANSI_COLORS[15]),T.extendedAnsi){const M=Math.min(z.ansi.length-16,T.extendedAnsi.length);for(let O=0;O{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const u=l(8460),_=l(844);class d extends _.Disposable{constructor(m){super(),this._maxLength=m,this.onDeleteEmitter=this.register(new u.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new u.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new u.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(m){if(this._maxLength===m)return;const x=new Array(m);for(let S=0;Sthis._length)for(let x=this._length;x=m;v--)this._array[this._getCyclicIndex(v+S.length)]=this._array[this._getCyclicIndex(v)];for(let v=0;vthis._maxLength){const v=this._length+S.length-this._maxLength;this._startIndex+=v,this._length=this._maxLength,this.onTrimEmitter.fire(v)}else this._length+=S.length}trimStart(m){m>this._length&&(m=this._length),this._startIndex+=m,this._length-=m,this.onTrimEmitter.fire(m)}shiftElements(m,x,S){if(!(x<=0)){if(m<0||m>=this._length)throw new Error("start argument out of range");if(m+S<0)throw new Error("Cannot shift elements in list beyond index 0");if(S>0){for(let b=x-1;b>=0;b--)this.set(m+b+S,this.get(m+b));const v=m+x+S-this._length;if(v>0)for(this._length+=v;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let v=0;v{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function l(u,_=5){if(typeof u!="object")return u;const d=Array.isArray(u)?[]:{};for(const p in u)d[p]=_<=1?u[p]:u[p]&&l(u[p],_-1);return d}},8055:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let l=0,u=0,_=0,d=0;var p,m,x,S,v;function b(y){const C=y.toString(16);return C.length<2?"0"+C:C}function w(y,C){return y>>0},y.toColor=function(C,E,N,T){return{css:y.toCss(C,E,N,T),rgba:y.toRgba(C,E,N,T)}}})(p||(o.channels=p={})),(function(y){function C(E,N){return d=Math.round(255*N),[l,u,_]=v.toChannels(E.rgba),{css:p.toCss(l,u,_,d),rgba:p.toRgba(l,u,_,d)}}y.blend=function(E,N){if(d=(255&N.rgba)/255,d===1)return{css:N.css,rgba:N.rgba};const T=N.rgba>>24&255,z=N.rgba>>16&255,M=N.rgba>>8&255,O=E.rgba>>24&255,B=E.rgba>>16&255,$=E.rgba>>8&255;return l=O+Math.round((T-O)*d),u=B+Math.round((z-B)*d),_=$+Math.round((M-$)*d),{css:p.toCss(l,u,_),rgba:p.toRgba(l,u,_)}},y.isOpaque=function(E){return(255&E.rgba)==255},y.ensureContrastRatio=function(E,N,T){const z=v.ensureContrastRatio(E.rgba,N.rgba,T);if(z)return p.toColor(z>>24&255,z>>16&255,z>>8&255)},y.opaque=function(E){const N=(255|E.rgba)>>>0;return[l,u,_]=v.toChannels(N),{css:p.toCss(l,u,_),rgba:N}},y.opacity=C,y.multiplyOpacity=function(E,N){return d=255&E.rgba,C(E,d*N/255)},y.toColorRGB=function(E){return[E.rgba>>24&255,E.rgba>>16&255,E.rgba>>8&255]}})(m||(o.color=m={})),(function(y){let C,E;try{const N=document.createElement("canvas");N.width=1,N.height=1;const T=N.getContext("2d",{willReadFrequently:!0});T&&(C=T,C.globalCompositeOperation="copy",E=C.createLinearGradient(0,0,1,1))}catch{}y.toColor=function(N){if(N.match(/#[\da-f]{3,8}/i))switch(N.length){case 4:return l=parseInt(N.slice(1,2).repeat(2),16),u=parseInt(N.slice(2,3).repeat(2),16),_=parseInt(N.slice(3,4).repeat(2),16),p.toColor(l,u,_);case 5:return l=parseInt(N.slice(1,2).repeat(2),16),u=parseInt(N.slice(2,3).repeat(2),16),_=parseInt(N.slice(3,4).repeat(2),16),d=parseInt(N.slice(4,5).repeat(2),16),p.toColor(l,u,_,d);case 7:return{css:N,rgba:(parseInt(N.slice(1),16)<<8|255)>>>0};case 9:return{css:N,rgba:parseInt(N.slice(1),16)>>>0}}const T=N.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(T)return l=parseInt(T[1]),u=parseInt(T[2]),_=parseInt(T[3]),d=Math.round(255*(T[5]===void 0?1:parseFloat(T[5]))),p.toColor(l,u,_,d);if(!C||!E)throw new Error("css.toColor: Unsupported css format");if(C.fillStyle=E,C.fillStyle=N,typeof C.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(C.fillRect(0,0,1,1),[l,u,_,d]=C.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:p.toRgba(l,u,_,d),css:N}}})(x||(o.css=x={})),(function(y){function C(E,N,T){const z=E/255,M=N/255,O=T/255;return .2126*(z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4))+.7152*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.0722*(O<=.03928?O/12.92:Math.pow((O+.055)/1.055,2.4))}y.relativeLuminance=function(E){return C(E>>16&255,E>>8&255,255&E)},y.relativeLuminance2=C})(S||(o.rgb=S={})),(function(y){function C(N,T,z){const M=N>>24&255,O=N>>16&255,B=N>>8&255;let $=T>>24&255,U=T>>16&255,H=T>>8&255,Y=w(S.relativeLuminance2($,U,H),S.relativeLuminance2(M,O,B));for(;Y0||U>0||H>0);)$-=Math.max(0,Math.ceil(.1*$)),U-=Math.max(0,Math.ceil(.1*U)),H-=Math.max(0,Math.ceil(.1*H)),Y=w(S.relativeLuminance2($,U,H),S.relativeLuminance2(M,O,B));return($<<24|U<<16|H<<8|255)>>>0}function E(N,T,z){const M=N>>24&255,O=N>>16&255,B=N>>8&255;let $=T>>24&255,U=T>>16&255,H=T>>8&255,Y=w(S.relativeLuminance2($,U,H),S.relativeLuminance2(M,O,B));for(;Y>>0}y.blend=function(N,T){if(d=(255&T)/255,d===1)return T;const z=T>>24&255,M=T>>16&255,O=T>>8&255,B=N>>24&255,$=N>>16&255,U=N>>8&255;return l=B+Math.round((z-B)*d),u=$+Math.round((M-$)*d),_=U+Math.round((O-U)*d),p.toRgba(l,u,_)},y.ensureContrastRatio=function(N,T,z){const M=S.relativeLuminance(N>>8),O=S.relativeLuminance(T>>8);if(w(M,O)>8));if(Hw(M,S.relativeLuminance(Y>>8))?U:Y}return U}const B=E(N,T,z),$=w(M,S.relativeLuminance(B>>8));if($w(M,S.relativeLuminance(U>>8))?B:U}return B}},y.reduceLuminance=C,y.increaseLuminance=E,y.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(v||(o.rgba=v={})),o.toPaddedHex=b,o.contrastRatio=w},8969:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const u=l(844),_=l(2585),d=l(4348),p=l(7866),m=l(744),x=l(7302),S=l(6975),v=l(8460),b=l(1753),w=l(1480),y=l(7994),C=l(9282),E=l(5435),N=l(5981),T=l(2660);let z=!1;class M extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new v.EventEmitter),this._onScroll.event((B=>{var $;($=this._onScrollApi)==null||$.fire(B.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(B){for(const $ in B)this.optionsService.options[$]=B[$]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new v.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new v.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new v.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new x.OptionsService(B)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(m.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(S.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(w.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(y.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(T.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new E.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,v.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,v.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,v.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,v.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll(($=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll(($=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new N.WriteBuffer((($,U)=>this._inputHandler.parse($,U)))),this.register((0,v.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,$){this._writeBuffer.write(B,$)}writeSync(B,$){this._logService.logLevel<=_.LogLevelEnum.WARN&&!z&&(this._logService.warn("writeSync is unreliable and will be removed soon."),z=!0),this._writeBuffer.writeSync(B,$)}input(B,$=!0){this.coreService.triggerDataEvent(B,$)}resize(B,$){isNaN(B)||isNaN($)||(B=Math.max(B,m.MINIMUM_COLS),$=Math.max($,m.MINIMUM_ROWS),this._bufferService.resize(B,$))}scroll(B,$=!1){this._bufferService.scroll(B,$)}scrollLines(B,$,U){this._bufferService.scrollLines(B,$,U)}scrollPages(B){this.scrollLines(B*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(B){const $=B-this._bufferService.buffer.ydisp;$!==0&&this.scrollLines($)}registerEscHandler(B,$){return this._inputHandler.registerEscHandler(B,$)}registerDcsHandler(B,$){return this._inputHandler.registerDcsHandler(B,$)}registerCsiHandler(B,$){return this._inputHandler.registerCsiHandler(B,$)}registerOscHandler(B,$){return this._inputHandler.registerOscHandler(B,$)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const $=this.optionsService.rawOptions.windowsPty;$&&$.buildNumber!==void 0&&$.buildNumber!==void 0?B=$.backend==="conpty"&&$.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(B=!0),B?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const B=[];B.push(this.onLineFeed(C.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},(()=>((0,C.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const $ of B)$.dispose()}))}}}o.CoreTerminal=M},8460:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let u=0;uu.fire(_)))},o.runAndSubscribe=function(l,u){return u(void 0),l((_=>u(_)))}},5435:function(a,o,l){var u=this&&this.__decorate||function(te,I,L,F){var q,G=arguments.length,ee=G<3?I:F===null?F=Object.getOwnPropertyDescriptor(I,L):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ee=Reflect.decorate(te,I,L,F);else for(var ce=te.length-1;ce>=0;ce--)(q=te[ce])&&(ee=(G<3?q(ee):G>3?q(I,L,ee):q(I,L))||ee);return G>3&&ee&&Object.defineProperty(I,L,ee),ee},_=this&&this.__param||function(te,I){return function(L,F){I(L,F,te)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=l(2584),p=l(7116),m=l(2015),x=l(844),S=l(482),v=l(8437),b=l(8460),w=l(643),y=l(511),C=l(3734),E=l(2585),N=l(1480),T=l(6242),z=l(6351),M=l(5941),O={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function $(te,I){if(te>24)return I.setWinLines||!1;switch(te){case 1:return!!I.restoreWin;case 2:return!!I.minimizeWin;case 3:return!!I.setWinPosition;case 4:return!!I.setWinSizePixels;case 5:return!!I.raiseWin;case 6:return!!I.lowerWin;case 7:return!!I.refreshWin;case 8:return!!I.setWinSizeChars;case 9:return!!I.maximizeWin;case 10:return!!I.fullscreenWin;case 11:return!!I.getWinState;case 13:return!!I.getWinPosition;case 14:return!!I.getWinSizePixels;case 15:return!!I.getScreenSizePixels;case 16:return!!I.getCellSizePixels;case 18:return!!I.getWinSizeChars;case 19:return!!I.getScreenSizeChars;case 20:return!!I.getIconTitle;case 21:return!!I.getWinTitle;case 22:return!!I.pushTitle;case 23:return!!I.popTitle;case 24:return!!I.setWinLines}return!1}var U;(function(te){te[te.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",te[te.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(U||(o.WindowsOptionsReportType=U={}));let H=0;class Y extends x.Disposable{getAttrData(){return this._curAttrData}constructor(I,L,F,q,G,ee,ce,oe,ne=new m.EscapeSequenceParser){super(),this._bufferService=I,this._charsetService=L,this._coreService=F,this._logService=q,this._optionsService=G,this._oscLinkService=ee,this._coreMouseService=ce,this._unicodeService=oe,this._parser=ne,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new S.StringToUtf32,this._utf8Decoder=new S.Utf8ToUtf32,this._workCell=new y.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new b.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new b.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new b.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new b.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new b.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new b.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new b.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new b.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new b.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new b.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new V(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((Q=>this._activeBuffer=Q.activeBuffer))),this._parser.setCsiHandlerFallback(((Q,le)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(Q),params:le.toArray()})})),this._parser.setEscHandlerFallback((Q=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(Q)})})),this._parser.setExecuteHandlerFallback((Q=>{this._logService.debug("Unknown EXECUTE code: ",{code:Q})})),this._parser.setOscHandlerFallback(((Q,le,ae)=>{this._logService.debug("Unknown OSC code: ",{identifier:Q,action:le,data:ae})})),this._parser.setDcsHandlerFallback(((Q,le,ae)=>{le==="HOOK"&&(ae=ae.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(Q),action:le,payload:ae})})),this._parser.setPrintHandler(((Q,le,ae)=>this.print(Q,le,ae))),this._parser.registerCsiHandler({final:"@"},(Q=>this.insertChars(Q))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(Q=>this.scrollLeft(Q))),this._parser.registerCsiHandler({final:"A"},(Q=>this.cursorUp(Q))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(Q=>this.scrollRight(Q))),this._parser.registerCsiHandler({final:"B"},(Q=>this.cursorDown(Q))),this._parser.registerCsiHandler({final:"C"},(Q=>this.cursorForward(Q))),this._parser.registerCsiHandler({final:"D"},(Q=>this.cursorBackward(Q))),this._parser.registerCsiHandler({final:"E"},(Q=>this.cursorNextLine(Q))),this._parser.registerCsiHandler({final:"F"},(Q=>this.cursorPrecedingLine(Q))),this._parser.registerCsiHandler({final:"G"},(Q=>this.cursorCharAbsolute(Q))),this._parser.registerCsiHandler({final:"H"},(Q=>this.cursorPosition(Q))),this._parser.registerCsiHandler({final:"I"},(Q=>this.cursorForwardTab(Q))),this._parser.registerCsiHandler({final:"J"},(Q=>this.eraseInDisplay(Q,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(Q=>this.eraseInDisplay(Q,!0))),this._parser.registerCsiHandler({final:"K"},(Q=>this.eraseInLine(Q,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(Q=>this.eraseInLine(Q,!0))),this._parser.registerCsiHandler({final:"L"},(Q=>this.insertLines(Q))),this._parser.registerCsiHandler({final:"M"},(Q=>this.deleteLines(Q))),this._parser.registerCsiHandler({final:"P"},(Q=>this.deleteChars(Q))),this._parser.registerCsiHandler({final:"S"},(Q=>this.scrollUp(Q))),this._parser.registerCsiHandler({final:"T"},(Q=>this.scrollDown(Q))),this._parser.registerCsiHandler({final:"X"},(Q=>this.eraseChars(Q))),this._parser.registerCsiHandler({final:"Z"},(Q=>this.cursorBackwardTab(Q))),this._parser.registerCsiHandler({final:"`"},(Q=>this.charPosAbsolute(Q))),this._parser.registerCsiHandler({final:"a"},(Q=>this.hPositionRelative(Q))),this._parser.registerCsiHandler({final:"b"},(Q=>this.repeatPrecedingCharacter(Q))),this._parser.registerCsiHandler({final:"c"},(Q=>this.sendDeviceAttributesPrimary(Q))),this._parser.registerCsiHandler({prefix:">",final:"c"},(Q=>this.sendDeviceAttributesSecondary(Q))),this._parser.registerCsiHandler({final:"d"},(Q=>this.linePosAbsolute(Q))),this._parser.registerCsiHandler({final:"e"},(Q=>this.vPositionRelative(Q))),this._parser.registerCsiHandler({final:"f"},(Q=>this.hVPosition(Q))),this._parser.registerCsiHandler({final:"g"},(Q=>this.tabClear(Q))),this._parser.registerCsiHandler({final:"h"},(Q=>this.setMode(Q))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(Q=>this.setModePrivate(Q))),this._parser.registerCsiHandler({final:"l"},(Q=>this.resetMode(Q))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(Q=>this.resetModePrivate(Q))),this._parser.registerCsiHandler({final:"m"},(Q=>this.charAttributes(Q))),this._parser.registerCsiHandler({final:"n"},(Q=>this.deviceStatus(Q))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(Q=>this.deviceStatusPrivate(Q))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(Q=>this.softReset(Q))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(Q=>this.setCursorStyle(Q))),this._parser.registerCsiHandler({final:"r"},(Q=>this.setScrollRegion(Q))),this._parser.registerCsiHandler({final:"s"},(Q=>this.saveCursor(Q))),this._parser.registerCsiHandler({final:"t"},(Q=>this.windowOptions(Q))),this._parser.registerCsiHandler({final:"u"},(Q=>this.restoreCursor(Q))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(Q=>this.insertColumns(Q))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(Q=>this.deleteColumns(Q))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(Q=>this.selectProtected(Q))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(Q=>this.requestMode(Q,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(Q=>this.requestMode(Q,!1))),this._parser.setExecuteHandler(d.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(d.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(d.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(d.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(d.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(d.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(d.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(d.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(d.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new T.OscHandler((Q=>(this.setTitle(Q),this.setIconName(Q),!0)))),this._parser.registerOscHandler(1,new T.OscHandler((Q=>this.setIconName(Q)))),this._parser.registerOscHandler(2,new T.OscHandler((Q=>this.setTitle(Q)))),this._parser.registerOscHandler(4,new T.OscHandler((Q=>this.setOrReportIndexedColor(Q)))),this._parser.registerOscHandler(8,new T.OscHandler((Q=>this.setHyperlink(Q)))),this._parser.registerOscHandler(10,new T.OscHandler((Q=>this.setOrReportFgColor(Q)))),this._parser.registerOscHandler(11,new T.OscHandler((Q=>this.setOrReportBgColor(Q)))),this._parser.registerOscHandler(12,new T.OscHandler((Q=>this.setOrReportCursorColor(Q)))),this._parser.registerOscHandler(104,new T.OscHandler((Q=>this.restoreIndexedColor(Q)))),this._parser.registerOscHandler(110,new T.OscHandler((Q=>this.restoreFgColor(Q)))),this._parser.registerOscHandler(111,new T.OscHandler((Q=>this.restoreBgColor(Q)))),this._parser.registerOscHandler(112,new T.OscHandler((Q=>this.restoreCursorColor(Q)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const Q in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:Q},(()=>this.selectCharset("("+Q))),this._parser.registerEscHandler({intermediates:")",final:Q},(()=>this.selectCharset(")"+Q))),this._parser.registerEscHandler({intermediates:"*",final:Q},(()=>this.selectCharset("*"+Q))),this._parser.registerEscHandler({intermediates:"+",final:Q},(()=>this.selectCharset("+"+Q))),this._parser.registerEscHandler({intermediates:"-",final:Q},(()=>this.selectCharset("-"+Q))),this._parser.registerEscHandler({intermediates:".",final:Q},(()=>this.selectCharset("."+Q))),this._parser.registerEscHandler({intermediates:"/",final:Q},(()=>this.selectCharset("/"+Q)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((Q=>(this._logService.error("Parsing error: ",Q),Q))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new z.DcsHandler(((Q,le)=>this.requestStatusString(Q,le))))}_preserveStack(I,L,F,q){this._parseStack.paused=!0,this._parseStack.cursorStartX=I,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=F,this._parseStack.position=q}_logSlowResolvingAsync(I){this._logService.logLevel<=E.LogLevelEnum.WARN&&Promise.race([I,new Promise(((L,F)=>setTimeout((()=>F("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(I,L){let F,q=this._activeBuffer.x,G=this._activeBuffer.y,ee=0;const ce=this._parseStack.paused;if(ce){if(F=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(F),F;q=this._parseStack.cursorStartX,G=this._parseStack.cursorStartY,this._parseStack.paused=!1,I.length>B&&(ee=this._parseStack.position+B)}if(this._logService.logLevel<=E.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof I=="string"?` "${I}"`:` "${Array.prototype.map.call(I,(Q=>String.fromCharCode(Q))).join("")}"`),typeof I=="string"?I.split("").map((Q=>Q.charCodeAt(0))):I),this._parseBuffer.lengthB)for(let Q=ee;Q0&&ae.getWidth(this._activeBuffer.x-1)===2&&ae.setCellFromCodepoint(this._activeBuffer.x-1,0,1,le);let ue=this._parser.precedingJoinState;for(let pe=L;peoe){if(ne){const Ie=ae;let ze=this._activeBuffer.x-qe;for(this._activeBuffer.x=qe,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),ae=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),qe>0&&ae instanceof v.BufferLine&&ae.copyCellsFrom(Ie,ze,0,qe,!1);ze=0;)ae.setCellFromCodepoint(this._activeBuffer.x++,0,0,le)}else if(Q&&(ae.insertCells(this._activeBuffer.x,G-qe,this._activeBuffer.getNullCell(le)),ae.getWidth(oe-1)===2&&ae.setCellFromCodepoint(oe-1,w.NULL_CELL_CODE,w.NULL_CELL_WIDTH,le)),ae.setCellFromCodepoint(this._activeBuffer.x++,q,G,le),G>0)for(;--G;)ae.setCellFromCodepoint(this._activeBuffer.x++,0,0,le)}this._parser.precedingJoinState=ue,this._activeBuffer.x0&&ae.getWidth(this._activeBuffer.x)===0&&!ae.hasContent(this._activeBuffer.x)&&ae.setCellFromCodepoint(this._activeBuffer.x,0,1,le),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(I,L){return I.final!=="t"||I.prefix||I.intermediates?this._parser.registerCsiHandler(I,L):this._parser.registerCsiHandler(I,(F=>!$(F.params[0],this._optionsService.rawOptions.windowOptions)||L(F)))}registerDcsHandler(I,L){return this._parser.registerDcsHandler(I,new z.DcsHandler(L))}registerEscHandler(I,L){return this._parser.registerEscHandler(I,L)}registerOscHandler(I,L){return this._parser.registerOscHandler(I,new T.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var I;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((I=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&I.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const I=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-I),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(I=this._bufferService.cols-1){this._activeBuffer.x=Math.min(I,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(I,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=I,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=I,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(I,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+I,this._activeBuffer.y+L)}cursorUp(I){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,I.params[0]||1)):this._moveCursor(0,-(I.params[0]||1)),!0}cursorDown(I){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,I.params[0]||1)):this._moveCursor(0,I.params[0]||1),!0}cursorForward(I){return this._moveCursor(I.params[0]||1,0),!0}cursorBackward(I){return this._moveCursor(-(I.params[0]||1),0),!0}cursorNextLine(I){return this.cursorDown(I),this._activeBuffer.x=0,!0}cursorPrecedingLine(I){return this.cursorUp(I),this._activeBuffer.x=0,!0}cursorCharAbsolute(I){return this._setCursor((I.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(I){return this._setCursor(I.length>=2?(I.params[1]||1)-1:0,(I.params[0]||1)-1),!0}charPosAbsolute(I){return this._setCursor((I.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(I){return this._moveCursor(I.params[0]||1,0),!0}linePosAbsolute(I){return this._setCursor(this._activeBuffer.x,(I.params[0]||1)-1),!0}vPositionRelative(I){return this._moveCursor(0,I.params[0]||1),!0}hVPosition(I){return this.cursorPosition(I),!0}tabClear(I){const L=I.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(I){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=I.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(I){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=I.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(I){const L=I.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(I,L,F,q=!1,G=!1){const ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);ee.replaceCells(L,F,this._activeBuffer.getNullCell(this._eraseAttrData()),G),q&&(ee.isWrapped=!1)}_resetBufferLine(I,L=!1){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+I);F&&(F.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+I),F.isWrapped=!1)}eraseInDisplay(I,L=!1){let F;switch(this._restrictCursor(this._bufferService.cols),I.params[0]){case 0:for(F=this._activeBuffer.y,this._dirtyRowTracker.markDirty(F),this._eraseInBufferLine(F++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);F=this._bufferService.cols&&(this._activeBuffer.lines.get(F+1).isWrapped=!1);F--;)this._resetBufferLine(F,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(F=this._bufferService.rows,this._dirtyRowTracker.markDirty(F-1);F--;)this._resetBufferLine(F,L);this._dirtyRowTracker.markDirty(0);break;case 3:const q=this._activeBuffer.lines.length-this._bufferService.rows;q>0&&(this._activeBuffer.lines.trimStart(q),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-q,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-q,0),this._onScroll.fire(0))}return!0}eraseInLine(I,L=!1){switch(this._restrictCursor(this._bufferService.cols),I.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(I){this._restrictCursor();let L=I.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let ne=oe;for(let Q=1;Q0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(I){return I.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(I.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(I){return(this._optionsService.rawOptions.termName+"").indexOf(I)===0}setMode(I){for(let L=0;Lye?1:2,ue=I.params[0];return pe=ue,Se=L?ue===2?4:ue===4?ae(ee.modes.insertMode):ue===12?3:ue===20?ae(le.convertEol):0:ue===1?ae(F.applicationCursorKeys):ue===3?le.windowOptions.setWinLines?oe===80?2:oe===132?1:0:0:ue===6?ae(F.origin):ue===7?ae(F.wraparound):ue===8?3:ue===9?ae(q==="X10"):ue===12?ae(le.cursorBlink):ue===25?ae(!ee.isCursorHidden):ue===45?ae(F.reverseWraparound):ue===66?ae(F.applicationKeypad):ue===67?4:ue===1e3?ae(q==="VT200"):ue===1002?ae(q==="DRAG"):ue===1003?ae(q==="ANY"):ue===1004?ae(F.sendFocus):ue===1005?4:ue===1006?ae(G==="SGR"):ue===1015?4:ue===1016?ae(G==="SGR_PIXELS"):ue===1048?1:ue===47||ue===1047||ue===1049?ae(ne===Q):ue===2004?ae(F.bracketedPasteMode):0,ee.triggerDataEvent(`${d.C0.ESC}[${L?"":"?"}${pe};${Se}$y`),!0;var pe,Se}_updateAttrColor(I,L,F,q,G){return L===2?(I|=50331648,I&=-16777216,I|=C.AttributeData.fromColorRGB([F,q,G])):L===5&&(I&=-50331904,I|=33554432|255&F),I}_extractColor(I,L,F){const q=[0,0,-1,0,0,0];let G=0,ee=0;do{if(q[ee+G]=I.params[L+ee],I.hasSubParams(L+ee)){const ce=I.getSubParams(L+ee);let oe=0;do q[1]===5&&(G=1),q[ee+oe+1+G]=ce[oe];while(++oe=2||q[1]===2&&ee+G>=5)break;q[1]&&(G=1)}while(++ee+L5)&&(I=1),L.extended.underlineStyle=I,L.fg|=268435456,I===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(I){I.fg=v.DEFAULT_ATTR_DATA.fg,I.bg=v.DEFAULT_ATTR_DATA.bg,I.extended=I.extended.clone(),I.extended.underlineStyle=0,I.extended.underlineColor&=-67108864,I.updateExtended()}charAttributes(I){if(I.length===1&&I.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=I.length;let F;const q=this._curAttrData;for(let G=0;G=30&&F<=37?(q.fg&=-50331904,q.fg|=16777216|F-30):F>=40&&F<=47?(q.bg&=-50331904,q.bg|=16777216|F-40):F>=90&&F<=97?(q.fg&=-50331904,q.fg|=16777224|F-90):F>=100&&F<=107?(q.bg&=-50331904,q.bg|=16777224|F-100):F===0?this._processSGR0(q):F===1?q.fg|=134217728:F===3?q.bg|=67108864:F===4?(q.fg|=268435456,this._processUnderline(I.hasSubParams(G)?I.getSubParams(G)[0]:1,q)):F===5?q.fg|=536870912:F===7?q.fg|=67108864:F===8?q.fg|=1073741824:F===9?q.fg|=2147483648:F===2?q.bg|=134217728:F===21?this._processUnderline(2,q):F===22?(q.fg&=-134217729,q.bg&=-134217729):F===23?q.bg&=-67108865:F===24?(q.fg&=-268435457,this._processUnderline(0,q)):F===25?q.fg&=-536870913:F===27?q.fg&=-67108865:F===28?q.fg&=-1073741825:F===29?q.fg&=2147483647:F===39?(q.fg&=-67108864,q.fg|=16777215&v.DEFAULT_ATTR_DATA.fg):F===49?(q.bg&=-67108864,q.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):F===38||F===48||F===58?G+=this._extractColor(I,G,q):F===53?q.bg|=1073741824:F===55?q.bg&=-1073741825:F===59?(q.extended=q.extended.clone(),q.extended.underlineColor=-1,q.updateExtended()):F===100?(q.fg&=-67108864,q.fg|=16777215&v.DEFAULT_ATTR_DATA.fg,q.bg&=-67108864,q.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",F);return!0}deviceStatus(I){switch(I.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,F=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${L};${F}R`)}return!0}deviceStatusPrivate(I){if(I.params[0]===6){const L=this._activeBuffer.y+1,F=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${L};${F}R`)}return!0}softReset(I){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(I){const L=I.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const F=L%2==1;return this._optionsService.options.cursorBlink=F,!0}setScrollRegion(I){const L=I.params[0]||1;let F;return(I.length<2||(F=I.params[1])>this._bufferService.rows||F===0)&&(F=this._bufferService.rows),F>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=F-1,this._setCursor(0,0)),!0}windowOptions(I){if(!$(I.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=I.length>1?I.params[1]:0;switch(I.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(U.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(U.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(I){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(I){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(I){return this._windowTitle=I,this._onTitleChange.fire(I),!0}setIconName(I){return this._iconName=I,!0}setOrReportIndexedColor(I){const L=[],F=I.split(";");for(;F.length>1;){const q=F.shift(),G=F.shift();if(/^\d+$/.exec(q)){const ee=parseInt(q);if(X(ee))if(G==="?")L.push({type:0,index:ee});else{const ce=(0,M.parseColor)(G);ce&&L.push({type:1,index:ee,color:ce})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(I){const L=I.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(I,L){this._getCurrentLinkId()&&this._finishHyperlink();const F=I.split(":");let q;const G=F.findIndex((ee=>ee.startsWith("id=")));return G!==-1&&(q=F[G].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:q,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(I,L){const F=I.split(";");for(let q=0;q=this._specialColors.length);++q,++L)if(F[q]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const G=(0,M.parseColor)(F[q]);G&&this._onColor.fire([{type:1,index:this._specialColors[L],color:G}])}return!0}setOrReportFgColor(I){return this._setOrReportSpecialColor(I,0)}setOrReportBgColor(I){return this._setOrReportSpecialColor(I,1)}setOrReportCursorColor(I){return this._setOrReportSpecialColor(I,2)}restoreIndexedColor(I){if(!I)return this._onColor.fire([{type:2}]),!0;const L=[],F=I.split(";");for(let q=0;q=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const I=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,I,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(I){return this._charsetService.setgLevel(I),!0}screenAlignmentPattern(){const I=new y.CellData;I.content=4194373,I.fg=this._curAttrData.fg,I.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L(this._coreService.triggerDataEvent(`${d.C0.ESC}${G}${d.C0.ESC}\\`),!0))(I==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:I==='"p'?'P1$r61;1"p':I==="r"?`P1$r${F.scrollTop+1};${F.scrollBottom+1}r`:I==="m"?"P1$r0m":I===" q"?`P1$r${{block:2,underline:4,bar:6}[q.cursorStyle]-(q.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(I,L){this._dirtyRowTracker.markRangeDirty(I,L)}}o.InputHandler=Y;let V=class{constructor(te){this._bufferService=te,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(te){tethis.end&&(this.end=te)}markRangeDirty(te,I){te>I&&(H=te,te=I,I=H),tethis.end&&(this.end=I)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(te){return 0<=te&&te<256}V=u([_(0,E.IBufferService)],V)},844:(a,o)=>{function l(u){for(const _ of u)_.dispose();u.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const _=this._disposables.indexOf(u);_!==-1&&this._disposables.splice(_,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var _;this._isDisposed||u===this._value||((_=this._value)==null||_.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){var u;this._isDisposed=!0,(u=this._value)==null||u.dispose(),this._value=void 0}},o.toDisposable=function(u){return{dispose:u}},o.disposeArray=l,o.getDisposeArrayDisposable=function(u){return{dispose:()=>l(u)}}},1505:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(_,d,p){this._data[_]||(this._data[_]={}),this._data[_][d]=p}get(_,d){return this._data[_]?this._data[_][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=l,o.FourKeyMap=class{constructor(){this._data=new l}set(u,_,d,p,m){this._data.get(u,_)||this._data.set(u,_,new l),this._data.get(u,_).set(d,p,m)}get(u,_,d,p){var m;return(m=this._data.get(u,_))==null?void 0:m.get(d,p)}clear(){this._data.clear()}}},6114:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const l=o.isNode?"node":navigator.userAgent,u=o.isNode?"node":navigator.platform;o.isFirefox=l.includes("Firefox"),o.isLegacyEdge=l.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(l),o.getSafariVersion=function(){if(!o.isSafari)return 0;const _=l.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),o.isIpad=u==="iPad",o.isIphone=u==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),o.isLinux=u.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(l)},6106:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let l=0;o.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(l=this._search(this._getKey(u)),this._array.splice(l,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const _=this._getKey(u);if(_===void 0||(l=this._search(_),l===-1)||this._getKey(this._array[l])!==_)return!1;do if(this._array[l]===u)return this._array.splice(l,1),!0;while(++l=this._array.length)&&this._getKey(this._array[l])===u))do yield this._array[l];while(++l=this._array.length)&&this._getKey(this._array[l])===u))do _(this._array[l]);while(++l=_;){let p=_+d>>1;const m=this._getKey(this._array[p]);if(m>u)d=p-1;else{if(!(m0&&this._getKey(this._array[p-1])===u;)p--;return p}_=p+1}}return _}}},7226:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const u=l(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(m){this._tasks.push(m),this._start()}flush(){for(;this._ib)return v-x<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(v-x))}ms`),void this._start();v=b}this.clear()}}class d extends _{_requestCallback(m){return setTimeout((()=>m(this._createDeadline(16))))}_cancelCallback(m){clearTimeout(m)}_createDeadline(m){const x=Date.now()+m;return{timeRemaining:()=>Math.max(0,x-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const u=l(643);o.updateWindowsModeWrappedState=function(_){const d=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),p=d==null?void 0:d.get(_.cols-1),m=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);m&&p&&(m.isWrapped=p[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&p[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new l;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}o.AttributeData=l;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,p=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=p}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=u},9092:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const u=l(6349),_=l(7226),d=l(3734),p=l(8437),m=l(4634),x=l(511),S=l(643),v=l(4863),b=l(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(w,y,C){this._hasScrollback=w,this._optionsService=y,this._bufferService=C,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=x.CellData.fromCharData([0,S.NULL_CELL_CHAR,S.NULL_CELL_WIDTH,S.NULL_CELL_CODE]),this._whitespaceCell=x.CellData.fromCharData([0,S.WHITESPACE_CELL_CHAR,S.WHITESPACE_CELL_WIDTH,S.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(w){return w?(this._nullCell.fg=w.fg,this._nullCell.bg=w.bg,this._nullCell.extended=w.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(w){return w?(this._whitespaceCell.fg=w.fg,this._whitespaceCell.bg=w.bg,this._whitespaceCell.extended=w.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(w,y){return new p.BufferLine(this._bufferService.cols,this.getNullCell(w),y)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const w=this.ybase+this.y-this.ydisp;return w>=0&&wo.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:y}fillViewportRows(w){if(this.lines.length===0){w===void 0&&(w=p.DEFAULT_ATTR_DATA);let y=this._rows;for(;y--;)this.lines.push(this.getBlankLine(w))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(w,y){const C=this.getNullCell(p.DEFAULT_ATTR_DATA);let E=0;const N=this._getCorrectBufferLength(y);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+T+1?(this.ybase--,T++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(w,C)));else for(let z=this._rows;z>y;z--)this.lines.length>y+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(N0&&(this.lines.trimStart(z),this.ybase=Math.max(this.ybase-z,0),this.ydisp=Math.max(this.ydisp-z,0),this.savedY=Math.max(this.savedY-z,0)),this.lines.maxLength=N}this.x=Math.min(this.x,w-1),this.y=Math.min(this.y,y-1),T&&(this.y+=T),this.savedX=Math.min(this.savedX,w-1),this.scrollTop=0}if(this.scrollBottom=y-1,this._isReflowEnabled&&(this._reflow(w,y),this._cols>w))for(let T=0;T.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let w=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,w=!1);let y=0;for(;this._memoryCleanupPosition100)return!0;return w}get _isReflowEnabled(){const w=this._optionsService.rawOptions.windowsPty;return w&&w.buildNumber?this._hasScrollback&&w.backend==="conpty"&&w.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(w,y){this._cols!==w&&(w>this._cols?this._reflowLarger(w,y):this._reflowSmaller(w,y))}_reflowLarger(w,y){const C=(0,m.reflowLargerGetLinesToRemove)(this.lines,this._cols,w,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(C.length>0){const E=(0,m.reflowLargerCreateNewLayout)(this.lines,C);(0,m.reflowLargerApplyNewLayout)(this.lines,E.layout),this._reflowLargerAdjustViewport(w,y,E.countRemoved)}}_reflowLargerAdjustViewport(w,y,C){const E=this.getNullCell(p.DEFAULT_ATTR_DATA);let N=C;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;T--){let z=this.lines.get(T);if(!z||!z.isWrapped&&z.getTrimmedLength()<=w)continue;const M=[z];for(;z.isWrapped&&T>0;)z=this.lines.get(--T),M.unshift(z);const O=this.ybase+this.y;if(O>=T&&O0&&(E.push({start:T+M.length+N,newLines:Y}),N+=Y.length),M.push(...Y);let V=$.length-1,X=$[V];X===0&&(V--,X=$[V]);let te=M.length-U-1,I=B;for(;te>=0;){const F=Math.min(I,X);if(M[V]===void 0)break;if(M[V].copyCellsFrom(M[te],I-F,X-F,F,!0),X-=F,X===0&&(V--,X=$[V]),I-=F,I===0){te--;const q=Math.max(te,0);I=(0,m.getWrappedLineTrimmedLength)(M,q,this._cols)}}for(let F=0;F0;)this.ybase===0?this.y0){const T=[],z=[];for(let V=0;V=0;V--)if($&&$.start>O+U){for(let X=$.newLines.length-1;X>=0;X--)this.lines.set(V--,$.newLines[X]);V++,T.push({index:O+1,amount:$.newLines.length}),U+=$.newLines.length,$=E[++B]}else this.lines.set(V,z[O--]);let H=0;for(let V=T.length-1;V>=0;V--)T[V].index+=H,this.lines.onInsertEmitter.fire(T[V]),H+=T[V].amount;const Y=Math.max(0,M+N-this.lines.maxLength);Y>0&&this.lines.onTrimEmitter.fire(Y)}}translateBufferLineToString(w,y,C=0,E){const N=this.lines.get(w);return N?N.translateToString(y,C,E):""}getWrappedRangeForLine(w){let y=w,C=w;for(;y>0&&this.lines.get(y).isWrapped;)y--;for(;C+10;);return w>=this._cols?this._cols-1:w<0?0:w}nextStop(w){for(w==null&&(w=this.x);!this.tabs[++w]&&w=this._cols?this._cols-1:w<0?0:w}clearMarkers(w){this._isClearing=!0;for(let y=0;y{y.line-=C,y.line<0&&y.dispose()}))),y.register(this.lines.onInsert((C=>{y.line>=C.index&&(y.line+=C.amount)}))),y.register(this.lines.onDelete((C=>{y.line>=C.index&&y.lineC.index&&(y.line-=C.amount)}))),y.register(y.onDispose((()=>this._removeMarker(y)))),y}_removeMarker(w){this._isClearing||this.markers.splice(this.markers.indexOf(w),1)}}},8437:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const u=l(3734),_=l(511),d=l(643),p=l(482);o.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let m=0;class x{constructor(v,b,w=!1){this.isWrapped=w,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);const y=b||_.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let C=0;C>22,2097152&b?this._combined[v].charCodeAt(this._combined[v].length-1):w]}set(v,b){this._data[3*v+1]=b[d.CHAR_DATA_ATTR_INDEX],b[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=b[1],this._data[3*v+0]=2097152|v|b[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=b[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(v){return this._data[3*v+0]>>22}hasWidth(v){return 12582912&this._data[3*v+0]}getFg(v){return this._data[3*v+1]}getBg(v){return this._data[3*v+2]}hasContent(v){return 4194303&this._data[3*v+0]}getCodePoint(v){const b=this._data[3*v+0];return 2097152&b?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&b}isCombined(v){return 2097152&this._data[3*v+0]}getString(v){const b=this._data[3*v+0];return 2097152&b?this._combined[v]:2097151&b?(0,p.stringFromCodePoint)(2097151&b):""}isProtected(v){return 536870912&this._data[3*v+2]}loadCell(v,b){return m=3*v,b.content=this._data[m+0],b.fg=this._data[m+1],b.bg=this._data[m+2],2097152&b.content&&(b.combinedData=this._combined[v]),268435456&b.bg&&(b.extended=this._extendedAttrs[v]),b}setCell(v,b){2097152&b.content&&(this._combined[v]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[v]=b.extended),this._data[3*v+0]=b.content,this._data[3*v+1]=b.fg,this._data[3*v+2]=b.bg}setCellFromCodepoint(v,b,w,y){268435456&y.bg&&(this._extendedAttrs[v]=y.extended),this._data[3*v+0]=b|w<<22,this._data[3*v+1]=y.fg,this._data[3*v+2]=y.bg}addCodepointToCell(v,b,w){let y=this._data[3*v+0];2097152&y?this._combined[v]+=(0,p.stringFromCodePoint)(b):2097151&y?(this._combined[v]=(0,p.stringFromCodePoint)(2097151&y)+(0,p.stringFromCodePoint)(b),y&=-2097152,y|=2097152):y=b|4194304,w&&(y&=-12582913,y|=w<<22),this._data[3*v+0]=y}insertCells(v,b,w){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,w),b=0;--C)this.setCell(v+b+C,this.loadCell(v+C,y));for(let C=0;Cthis.length){if(this._data.buffer.byteLength>=4*w)this._data=new Uint32Array(this._data.buffer,0,w);else{const y=new Uint32Array(w);y.set(this._data),this._data=y}for(let y=this.length;y=v&&delete this._combined[N]}const C=Object.keys(this._extendedAttrs);for(let E=0;E=v&&delete this._extendedAttrs[N]}}return this.length=v,4*w*2=0;--v)if(4194303&this._data[3*v+0])return v+(this._data[3*v+0]>>22);return 0}getNoBgTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0]||50331648&this._data[3*v+2])return v+(this._data[3*v+0]>>22);return 0}copyCellsFrom(v,b,w,y,C){const E=v._data;if(C)for(let T=y-1;T>=0;T--){for(let z=0;z<3;z++)this._data[3*(w+T)+z]=E[3*(b+T)+z];268435456&E[3*(b+T)+2]&&(this._extendedAttrs[w+T]=v._extendedAttrs[b+T])}else for(let T=0;T=b&&(this._combined[z-b+w]=v._combined[z])}}translateToString(v,b,w,y){b=b??0,w=w??this.length,v&&(w=Math.min(w,this.getTrimmedLength())),y&&(y.length=0);let C="";for(;b>22||1}return y&&y.push(b),C}}o.BufferLine=x},4841:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(l,u){if(l.start.y>l.end.y)throw new Error(`Buffer range end (${l.end.x}, ${l.end.y}) cannot be before start (${l.start.x}, ${l.start.y})`);return u*(l.end.y-l.start.y)+(l.end.x-l.start.x+1)}},4634:(a,o)=>{function l(u,_,d){if(_===u.length-1)return u[_].getTrimmedLength();const p=!u[_].hasContent(d-1)&&u[_].getWidth(d-1)===1,m=u[_+1].getWidth(0)===2;return p&&m?d-1:d}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(u,_,d,p,m){const x=[];for(let S=0;S=S&&p0&&(z>y||w[z].getTrimmedLength()===0);z--)T++;T>0&&(x.push(S+w.length-T),x.push(T)),S+=w.length-1}return x},o.reflowLargerCreateNewLayout=function(u,_){const d=[];let p=0,m=_[p],x=0;for(let S=0;Sl(u,w,_))).reduce(((b,w)=>b+w));let x=0,S=0,v=0;for(;vb&&(x-=b,S++);const w=u[S].getWidth(x-1)===2;w&&x--;const y=w?d-1:d;p.push(y),v+=y}return p},o.getWrappedLineTrimmedLength=l},5295:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const u=l(8460),_=l(844),d=l(9092);class p extends _.Disposable{constructor(x,S){super(),this._optionsService=x,this._bufferService=S,this._onBufferActivate=this.register(new u.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(x){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(x),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(x,S){this._normal.resize(x,S),this._alt.resize(x,S),this.setupTabStops(x)}setupTabStops(x){this._normal.setupTabStops(x),this._alt.setupTabStops(x)}}o.BufferSet=p},511:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const u=l(482),_=l(643),d=l(3734);class p extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(x){const S=new p;return S.setFromCharData(x),S}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(x){this.fg=x[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let S=!1;if(x[_.CHAR_DATA_CHAR_INDEX].length>2)S=!0;else if(x[_.CHAR_DATA_CHAR_INDEX].length===2){const v=x[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=v&&v<=56319){const b=x[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(v-55296)+b-56320+65536|x[_.CHAR_DATA_WIDTH_INDEX]<<22:S=!0}else S=!0}else this.content=x[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[_.CHAR_DATA_WIDTH_INDEX]<<22;S&&(this.combinedData=x[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|x[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=p},643:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const u=l(8460),_=l(844);class d{get id(){return this._id}constructor(m){this.line=m,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,_.disposeArray)(this._disposables),this._disposables.length=0)}register(m){return this._disposables.push(m),m}}o.Marker=d,d._nextId=1},7116:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(a,o)=>{var l,u,_;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.C0=void 0,(function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=` -`,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""})(l||(o.C0=l={})),(function(d){d.PAD="€",d.HOP="",d.BPH="‚",d.NBH="ƒ",d.IND="„",d.NEL="…",d.SSA="†",d.ESA="‡",d.HTS="ˆ",d.HTJ="‰",d.VTS="Š",d.PLD="‹",d.PLU="Œ",d.RI="",d.SS2="Ž",d.SS3="",d.DCS="",d.PU1="‘",d.PU2="’",d.STS="“",d.CCH="”",d.MW="•",d.SPA="–",d.EPA="—",d.SOS="˜",d.SGCI="™",d.SCI="š",d.CSI="›",d.ST="œ",d.OSC="",d.PM="ž",d.APC="Ÿ"})(u||(o.C1=u={})),(function(d){d.ST=`${l.ESC}\\`})(_||(o.C1_ESCAPED=_={}))},7399:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const u=l(2584),_={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};o.evaluateKeyboardEvent=function(d,p,m,x){const S={type:0,cancel:!1,key:void 0},v=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?S.key=p?u.C0.ESC+"OA":u.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?S.key=p?u.C0.ESC+"OD":u.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?S.key=p?u.C0.ESC+"OC":u.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(S.key=p?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:S.key=d.ctrlKey?"\b":u.C0.DEL,d.altKey&&(S.key=u.C0.ESC+S.key);break;case 9:if(d.shiftKey){S.key=u.C0.ESC+"[Z";break}S.key=u.C0.HT,S.cancel=!0;break;case 13:S.key=d.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,S.cancel=!0;break;case 27:S.key=u.C0.ESC,d.altKey&&(S.key=u.C0.ESC+u.C0.ESC),S.cancel=!0;break;case 37:if(d.metaKey)break;v?(S.key=u.C0.ESC+"[1;"+(v+1)+"D",S.key===u.C0.ESC+"[1;3D"&&(S.key=u.C0.ESC+(m?"b":"[1;5D"))):S.key=p?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(d.metaKey)break;v?(S.key=u.C0.ESC+"[1;"+(v+1)+"C",S.key===u.C0.ESC+"[1;3C"&&(S.key=u.C0.ESC+(m?"f":"[1;5C"))):S.key=p?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(d.metaKey)break;v?(S.key=u.C0.ESC+"[1;"+(v+1)+"A",m||S.key!==u.C0.ESC+"[1;3A"||(S.key=u.C0.ESC+"[1;5A")):S.key=p?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(d.metaKey)break;v?(S.key=u.C0.ESC+"[1;"+(v+1)+"B",m||S.key!==u.C0.ESC+"[1;3B"||(S.key=u.C0.ESC+"[1;5B")):S.key=p?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(S.key=u.C0.ESC+"[2~");break;case 46:S.key=v?u.C0.ESC+"[3;"+(v+1)+"~":u.C0.ESC+"[3~";break;case 36:S.key=v?u.C0.ESC+"[1;"+(v+1)+"H":p?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:S.key=v?u.C0.ESC+"[1;"+(v+1)+"F":p?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:d.shiftKey?S.type=2:d.ctrlKey?S.key=u.C0.ESC+"[5;"+(v+1)+"~":S.key=u.C0.ESC+"[5~";break;case 34:d.shiftKey?S.type=3:d.ctrlKey?S.key=u.C0.ESC+"[6;"+(v+1)+"~":S.key=u.C0.ESC+"[6~";break;case 112:S.key=v?u.C0.ESC+"[1;"+(v+1)+"P":u.C0.ESC+"OP";break;case 113:S.key=v?u.C0.ESC+"[1;"+(v+1)+"Q":u.C0.ESC+"OQ";break;case 114:S.key=v?u.C0.ESC+"[1;"+(v+1)+"R":u.C0.ESC+"OR";break;case 115:S.key=v?u.C0.ESC+"[1;"+(v+1)+"S":u.C0.ESC+"OS";break;case 116:S.key=v?u.C0.ESC+"[15;"+(v+1)+"~":u.C0.ESC+"[15~";break;case 117:S.key=v?u.C0.ESC+"[17;"+(v+1)+"~":u.C0.ESC+"[17~";break;case 118:S.key=v?u.C0.ESC+"[18;"+(v+1)+"~":u.C0.ESC+"[18~";break;case 119:S.key=v?u.C0.ESC+"[19;"+(v+1)+"~":u.C0.ESC+"[19~";break;case 120:S.key=v?u.C0.ESC+"[20;"+(v+1)+"~":u.C0.ESC+"[20~";break;case 121:S.key=v?u.C0.ESC+"[21;"+(v+1)+"~":u.C0.ESC+"[21~";break;case 122:S.key=v?u.C0.ESC+"[23;"+(v+1)+"~":u.C0.ESC+"[23~";break;case 123:S.key=v?u.C0.ESC+"[24;"+(v+1)+"~":u.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(m&&!x||!d.altKey||d.metaKey)!m||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?S.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(S.key=u.C0.US),d.key==="@"&&(S.key=u.C0.NUL)):d.keyCode===65&&(S.type=1);else{const b=_[d.keyCode],w=b==null?void 0:b[d.shiftKey?1:0];if(w)S.key=u.C0.ESC+w;else if(d.keyCode>=65&&d.keyCode<=90){const y=d.ctrlKey?d.keyCode-64:d.keyCode+32;let C=String.fromCharCode(y);d.shiftKey&&(C=C.toUpperCase()),S.key=u.C0.ESC+C}else if(d.keyCode===32)S.key=u.C0.ESC+(d.ctrlKey?u.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let y=d.code.slice(3,4);d.shiftKey||(y=y.toLowerCase()),S.key=u.C0.ESC+y,S.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?S.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?S.key=u.C0.NUL:d.keyCode>=51&&d.keyCode<=55?S.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?S.key=u.C0.DEL:d.keyCode===219?S.key=u.C0.ESC:d.keyCode===220?S.key=u.C0.FS:d.keyCode===221&&(S.key=u.C0.GS)}return S}},482:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},o.utf32ToString=function(l,u=0,_=l.length){let d="";for(let p=u;p<_;++p){let m=l[p];m>65535?(m-=65536,d+=String.fromCharCode(55296+(m>>10))+String.fromCharCode(m%1024+56320)):d+=String.fromCharCode(m)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,u){const _=l.length;if(!_)return 0;let d=0,p=0;if(this._interim){const m=l.charCodeAt(p++);56320<=m&&m<=57343?u[d++]=1024*(this._interim-55296)+m-56320+65536:(u[d++]=this._interim,u[d++]=m),this._interim=0}for(let m=p;m<_;++m){const x=l.charCodeAt(m);if(55296<=x&&x<=56319){if(++m>=_)return this._interim=x,d;const S=l.charCodeAt(m);56320<=S&&S<=57343?u[d++]=1024*(x-55296)+S-56320+65536:(u[d++]=x,u[d++]=S)}else x!==65279&&(u[d++]=x)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,u){const _=l.length;if(!_)return 0;let d,p,m,x,S=0,v=0,b=0;if(this.interim[0]){let C=!1,E=this.interim[0];E&=(224&E)==192?31:(240&E)==224?15:7;let N,T=0;for(;(N=63&this.interim[++T])&&T<4;)E<<=6,E|=N;const z=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,M=z-T;for(;b=_)return 0;if(N=l[b++],(192&N)!=128){b--,C=!0;break}this.interim[T++]=N,E<<=6,E|=63&N}C||(z===2?E<128?b--:u[S++]=E:z===3?E<2048||E>=55296&&E<=57343||E===65279||(u[S++]=E):E<65536||E>1114111||(u[S++]=E)),this.interim.fill(0)}const w=_-4;let y=b;for(;y<_;){for(;!(!(y=_)return this.interim[0]=d,S;if(p=l[y++],(192&p)!=128){y--;continue}if(v=(31&d)<<6|63&p,v<128){y--;continue}u[S++]=v}else if((240&d)==224){if(y>=_)return this.interim[0]=d,S;if(p=l[y++],(192&p)!=128){y--;continue}if(y>=_)return this.interim[0]=d,this.interim[1]=p,S;if(m=l[y++],(192&m)!=128){y--;continue}if(v=(15&d)<<12|(63&p)<<6|63&m,v<2048||v>=55296&&v<=57343||v===65279)continue;u[S++]=v}else if((248&d)==240){if(y>=_)return this.interim[0]=d,S;if(p=l[y++],(192&p)!=128){y--;continue}if(y>=_)return this.interim[0]=d,this.interim[1]=p,S;if(m=l[y++],(192&m)!=128){y--;continue}if(y>=_)return this.interim[0]=d,this.interim[1]=p,this.interim[2]=m,S;if(x=l[y++],(192&x)!=128){y--;continue}if(v=(7&d)<<18|(63&p)<<12|(63&m)<<6|63&x,v<65536||v>1114111)continue;u[S++]=v}}return S}}},225:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const u=l(1480),_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],d=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let p;o.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let m=0;m<_.length;++m)p.fill(0,_[m][0],_[m][1]+1)}}wcwidth(m){return m<32?0:m<127?1:m<65536?p[m]:(function(x,S){let v,b=0,w=S.length-1;if(xS[w][1])return!1;for(;w>=b;)if(v=b+w>>1,x>S[v][1])b=v+1;else{if(!(x=131072&&m<=196605||m>=196608&&m<=262141?2:1}charProperties(m,x){let S=this.wcwidth(m),v=S===0&&x!==0;if(v){const b=u.UnicodeService.extractWidth(x);b===0?v=!1:b>S&&(S=b)}return u.UnicodeService.createPropertyValue(0,S,v)}}},5981:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const u=l(8460),_=l(844);class d extends _.Disposable{constructor(m){super(),this._action=m,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(m,x){if(x!==void 0&&this._syncCalls>x)return void(this._syncCalls=0);if(this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let S;for(this._isSyncWriting=!0;S=this._writeBuffer.shift();){this._action(S);const v=this._callbacks.shift();v&&v()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(m,x){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(x),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(x)}_innerWrite(m=0,x=!0){const S=m||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const v=this._writeBuffer[this._bufferOffset],b=this._action(v,x);if(b){const y=C=>Date.now()-S>=12?setTimeout((()=>this._innerWrite(0,C))):this._innerWrite(S,C);return void b.catch((C=>(queueMicrotask((()=>{throw C})),Promise.resolve(!1)))).then(y)}const w=this._callbacks[this._bufferOffset];if(w&&w(),this._bufferOffset++,this._pendingData-=v.length,Date.now()-S>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}o.WriteBuffer=d},5941:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const l=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,u=/^[\da-f]+$/;function _(d,p){const m=d.toString(16),x=m.length<2?"0"+m:m;switch(p){case 4:return m[0];case 8:return x;case 12:return(x+x).slice(0,3);default:return x+x}}o.parseColor=function(d){if(!d)return;let p=d.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const m=l.exec(p);if(m){const x=m[1]?15:m[4]?255:m[7]?4095:65535;return[Math.round(parseInt(m[1]||m[4]||m[7]||m[10],16)/x*255),Math.round(parseInt(m[2]||m[5]||m[8]||m[11],16)/x*255),Math.round(parseInt(m[3]||m[6]||m[9]||m[12],16)/x*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),u.exec(p)&&[3,6,9,12].includes(p.length))){const m=p.length/3,x=[0,0,0];for(let S=0;S<3;++S){const v=parseInt(p.slice(m*S,m*S+m),16);x[S]=m===1?v<<4:m===2?v:m===3?v>>4:v>>8}return x}},o.toRgbString=function(d,p=16){const[m,x,S]=d;return`rgb:${_(m,p)}/${_(x,p)}/${_(S,p)}`}},5770:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const u=l(482),_=l(8742),d=l(5770),p=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(x,S){this._handlers[x]===void 0&&(this._handlers[x]=[]);const v=this._handlers[x];return v.push(S),{dispose:()=>{const b=v.indexOf(S);b!==-1&&v.splice(b,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}reset(){if(this._active.length)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(x,S){if(this.reset(),this._ident=x,this._active=this._handlers[x]||p,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].hook(S);else this._handlerFb(this._ident,"HOOK",S)}put(x,S,v){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(x,S,v);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(x,S,v))}unhook(x,S=!0){if(this._active.length){let v=!1,b=this._active.length-1,w=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,v=S,w=this._stack.fallThrough,this._stack.paused=!1),!w&&v===!1){for(;b>=0&&(v=this._active[b].unhook(x),v!==!0);b--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,v;b--}for(;b>=0;b--)if(v=this._active[b].unhook(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,v}else this._handlerFb(this._ident,"UNHOOK",x);this._active=p,this._ident=0}};const m=new _.Params;m.addParam(0),o.DcsHandler=class{constructor(x){this._handler=x,this._data="",this._params=m,this._hitLimit=!1}hook(x){this._params=x.length>1||x.params[0]?x.clone():m,this._data="",this._hitLimit=!1}put(x,S,v){this._hitLimit||(this._data+=(0,u.utf32ToString)(x,S,v),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(x){let S=!1;if(this._hitLimit)S=!1;else if(x&&(S=this._handler(this._data,this._params),S instanceof Promise))return S.then((v=>(this._params=m,this._data="",this._hitLimit=!1,v)));return this._params=m,this._data="",this._hitLimit=!1,S}}},2015:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const u=l(844),_=l(8742),d=l(6242),p=l(6351);class m{constructor(b){this.table=new Uint8Array(b)}setDefault(b,w){this.table.fill(b<<4|w)}add(b,w,y,C){this.table[w<<8|b]=y<<4|C}addMany(b,w,y,C){for(let E=0;Ez)),w=(T,z)=>b.slice(T,z),y=w(32,127),C=w(0,24);C.push(25),C.push.apply(C,w(28,32));const E=w(0,14);let N;for(N in v.setDefault(1,0),v.addMany(y,0,2,0),E)v.addMany([24,26,153,154],N,3,0),v.addMany(w(128,144),N,3,0),v.addMany(w(144,152),N,3,0),v.add(156,N,0,0),v.add(27,N,11,1),v.add(157,N,4,8),v.addMany([152,158,159],N,0,7),v.add(155,N,11,3),v.add(144,N,11,9);return v.addMany(C,0,3,0),v.addMany(C,1,3,1),v.add(127,1,0,1),v.addMany(C,8,0,8),v.addMany(C,3,3,3),v.add(127,3,0,3),v.addMany(C,4,3,4),v.add(127,4,0,4),v.addMany(C,6,3,6),v.addMany(C,5,3,5),v.add(127,5,0,5),v.addMany(C,2,3,2),v.add(127,2,0,2),v.add(93,1,4,8),v.addMany(y,8,5,8),v.add(127,8,5,8),v.addMany([156,27,24,26,7],8,6,0),v.addMany(w(28,32),8,0,8),v.addMany([88,94,95],1,0,7),v.addMany(y,7,0,7),v.addMany(C,7,0,7),v.add(156,7,0,0),v.add(127,7,0,7),v.add(91,1,11,3),v.addMany(w(64,127),3,7,0),v.addMany(w(48,60),3,8,4),v.addMany([60,61,62,63],3,9,4),v.addMany(w(48,60),4,8,4),v.addMany(w(64,127),4,7,0),v.addMany([60,61,62,63],4,0,6),v.addMany(w(32,64),6,0,6),v.add(127,6,0,6),v.addMany(w(64,127),6,0,0),v.addMany(w(32,48),3,9,5),v.addMany(w(32,48),5,9,5),v.addMany(w(48,64),5,0,6),v.addMany(w(64,127),5,7,0),v.addMany(w(32,48),4,9,5),v.addMany(w(32,48),1,9,2),v.addMany(w(32,48),2,9,2),v.addMany(w(48,127),2,10,0),v.addMany(w(48,80),1,10,0),v.addMany(w(81,88),1,10,0),v.addMany([89,90,92],1,10,0),v.addMany(w(96,127),1,10,0),v.add(80,1,11,9),v.addMany(C,9,0,9),v.add(127,9,0,9),v.addMany(w(28,32),9,0,9),v.addMany(w(32,48),9,9,12),v.addMany(w(48,60),9,8,10),v.addMany([60,61,62,63],9,9,10),v.addMany(C,11,0,11),v.addMany(w(32,128),11,0,11),v.addMany(w(28,32),11,0,11),v.addMany(C,10,0,10),v.add(127,10,0,10),v.addMany(w(28,32),10,0,10),v.addMany(w(48,60),10,8,10),v.addMany([60,61,62,63],10,0,11),v.addMany(w(32,48),10,9,12),v.addMany(C,12,0,12),v.add(127,12,0,12),v.addMany(w(28,32),12,0,12),v.addMany(w(32,48),12,9,12),v.addMany(w(48,64),12,0,11),v.addMany(w(64,127),12,12,13),v.addMany(w(64,127),10,12,13),v.addMany(w(64,127),9,12,13),v.addMany(C,13,13,13),v.addMany(y,13,13,13),v.add(127,13,0,13),v.addMany([27,156,24,26],13,14,0),v.add(x,0,2,0),v.add(x,8,5,8),v.add(x,6,0,6),v.add(x,11,0,11),v.add(x,13,13,13),v})();class S extends u.Disposable{constructor(b=o.VT500_TRANSITION_TABLE){super(),this._transitions=b,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(w,y,C)=>{},this._executeHandlerFb=w=>{},this._csiHandlerFb=(w,y)=>{},this._escHandlerFb=w=>{},this._errorHandlerFb=w=>w,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,u.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new d.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,w=[64,126]){let y=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(y=b.prefix.charCodeAt(0),y&&60>y||y>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(b.intermediates){if(b.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let E=0;EN||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");y<<=8,y|=N}}if(b.final.length!==1)throw new Error("final must be a single byte");const C=b.final.charCodeAt(0);if(w[0]>C||C>w[1])throw new Error(`final must be in range ${w[0]} .. ${w[1]}`);return y<<=8,y|=C,y}identToString(b){const w=[];for(;b;)w.push(String.fromCharCode(255&b)),b>>=8;return w.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,w){const y=this._identifier(b,[48,126]);this._escHandlers[y]===void 0&&(this._escHandlers[y]=[]);const C=this._escHandlers[y];return C.push(w),{dispose:()=>{const E=C.indexOf(w);E!==-1&&C.splice(E,1)}}}clearEscHandler(b){this._escHandlers[this._identifier(b,[48,126])]&&delete this._escHandlers[this._identifier(b,[48,126])]}setEscHandlerFallback(b){this._escHandlerFb=b}setExecuteHandler(b,w){this._executeHandlers[b.charCodeAt(0)]=w}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,w){const y=this._identifier(b);this._csiHandlers[y]===void 0&&(this._csiHandlers[y]=[]);const C=this._csiHandlers[y];return C.push(w),{dispose:()=>{const E=C.indexOf(w);E!==-1&&C.splice(E,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,w){return this._dcsParser.registerHandler(this._identifier(b),w)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,w){return this._oscParser.registerHandler(b,w)}clearOscHandler(b){this._oscParser.clearHandler(b)}setOscHandlerFallback(b){this._oscParser.setHandlerFallback(b)}setErrorHandler(b){this._errorHandler=b}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(b,w,y,C,E){this._parseStack.state=b,this._parseStack.handlers=w,this._parseStack.handlerPos=y,this._parseStack.transition=C,this._parseStack.chunkPos=E}parse(b,w,y){let C,E=0,N=0,T=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,T=this._parseStack.chunkPos+1;else{if(y===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const z=this._parseStack.handlers;let M=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(y===!1&&M>-1){for(;M>=0&&(C=z[M](this._params),C!==!0);M--)if(C instanceof Promise)return this._parseStack.handlerPos=M,C}this._parseStack.handlers=[];break;case 4:if(y===!1&&M>-1){for(;M>=0&&(C=z[M](),C!==!0);M--)if(C instanceof Promise)return this._parseStack.handlerPos=M,C}this._parseStack.handlers=[];break;case 6:if(E=b[this._parseStack.chunkPos],C=this._dcsParser.unhook(E!==24&&E!==26,y),C)return C;E===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(E=b[this._parseStack.chunkPos],C=this._oscParser.end(E!==24&&E!==26,y),C)return C;E===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,T=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let z=T;z>4){case 2:for(let U=z+1;;++U){if(U>=w||(E=b[U])<32||E>126&&E=w||(E=b[U])<32||E>126&&E=w||(E=b[U])<32||E>126&&E=w||(E=b[U])<32||E>126&&E=0&&(C=M[O](this._params),C!==!0);O--)if(C instanceof Promise)return this._preserveStack(3,M,O,N,z),C;O<0&&this._csiHandlerFb(this._collect<<8|E,this._params),this.precedingJoinState=0;break;case 8:do switch(E){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(E-48)}while(++z47&&E<60);z--;break;case 9:this._collect<<=8,this._collect|=E;break;case 10:const B=this._escHandlers[this._collect<<8|E];let $=B?B.length-1:-1;for(;$>=0&&(C=B[$](),C!==!0);$--)if(C instanceof Promise)return this._preserveStack(4,B,$,N,z),C;$<0&&this._escHandlerFb(this._collect<<8|E),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|E,this._params);break;case 13:for(let U=z+1;;++U)if(U>=w||(E=b[U])===24||E===26||E===27||E>127&&E=w||(E=b[U])<32||E>127&&E{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const u=l(5770),_=l(482),d=[];o.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,m){this._handlers[p]===void 0&&(this._handlers[p]=[]);const x=this._handlers[p];return x.push(m),{dispose:()=>{const S=x.indexOf(m);S!==-1&&x.splice(S,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,m,x){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(p,m,x);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(p,m,x))}start(){this.reset(),this._state=1}put(p,m,x){if(this._state!==3){if(this._state===1)for(;m0&&this._put(p,m,x)}}end(p,m=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let x=!1,S=this._active.length-1,v=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,x=m,v=this._stack.fallThrough,this._stack.paused=!1),!v&&x===!1){for(;S>=0&&(x=this._active[S].end(p),x!==!0);S--)if(x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,x;S--}for(;S>=0;S--)if(x=this._active[S].end(!1),x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,x}else this._handlerFb(this._id,"END",p);this._active=d,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,m,x){this._hitLimit||(this._data+=(0,_.utf32ToString)(p,m,x),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let m=!1;if(this._hitLimit)m=!1;else if(p&&(m=this._handler(this._data),m instanceof Promise))return m.then((x=>(this._data="",this._hitLimit=!1,x)));return this._data="",this._hitLimit=!1,m}}},8742:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const l=2147483647;class u{static fromArray(d){const p=new u;if(!d.length)return p;for(let m=Array.isArray(d[0])?1:0;m256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new u(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let p=0;p>8,x=255&this._subParamsIdx[p];x-m>0&&d.push(Array.prototype.slice.call(this._subParams,m,x))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>l?l:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>l?l:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const p=this._subParamsIdx[d]>>8,m=255&this._subParamsIdx[d];return m-p>0?this._subParams.subarray(p,m):null}getSubParamsAll(){const d={};for(let p=0;p>8,x=255&this._subParamsIdx[p];x-m>0&&(d[p]=this._subParams.slice(m,x))}return d}addDigit(d){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const m=this._digitIsSub?this._subParams:this.params,x=m[p-1];m[p-1]=~x?Math.min(10*x+d,l):d}}o.Params=u},5741:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,u){const _={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(_),u.dispose=()=>this._wrappedAddonDispose(_),u.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let u=-1;for(let _=0;_{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const u=l(3785),_=l(511);o.BufferApiView=class{constructor(d,p){this._buffer=d,this.type=p}init(d){return this._buffer=d,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(d){const p=this._buffer.lines.get(d);if(p)return new u.BufferLineApiView(p)}getNullCell(){return new _.CellData}}},3785:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const u=l(511);o.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,d){if(!(_<0||_>=this._line.length))return d?(this._line.loadCell(_,d),d):this._line.loadCell(_,new u.CellData)}translateToString(_,d,p){return this._line.translateToString(_,d,p)}}},8285:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const u=l(8771),_=l(8460),d=l(844);class p extends d.Disposable{constructor(x){super(),this._core=x,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}o.BufferNamespaceApi=p},7975:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,u){return this._core.registerCsiHandler(l,(_=>u(_.toArray())))}addCsiHandler(l,u){return this.registerCsiHandler(l,u)}registerDcsHandler(l,u){return this._core.registerDcsHandler(l,((_,d)=>u(_,d.toArray())))}addDcsHandler(l,u){return this.registerDcsHandler(l,u)}registerEscHandler(l,u){return this._core.registerEscHandler(l,u)}addEscHandler(l,u){return this.registerEscHandler(l,u)}registerOscHandler(l,u){return this._core.registerOscHandler(l,u)}addOscHandler(l,u){return this.registerOscHandler(l,u)}}},7090:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(a,o,l){var u=this&&this.__decorate||function(v,b,w,y){var C,E=arguments.length,N=E<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,w):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(v,b,w,y);else for(var T=v.length-1;T>=0;T--)(C=v[T])&&(N=(E<3?C(N):E>3?C(b,w,N):C(b,w))||N);return E>3&&N&&Object.defineProperty(b,w,N),N},_=this&&this.__param||function(v,b){return function(w,y){b(w,y,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=l(8460),p=l(844),m=l(5295),x=l(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let S=o.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(v){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(v.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(v.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new m.BufferSet(v,this))}resize(v,b){this.cols=v,this.rows=b,this.buffers.resize(v,b),this._onResize.fire({cols:v,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(v,b=!1){const w=this.buffer;let y;y=this._cachedBlankLine,y&&y.length===this.cols&&y.getFg(0)===v.fg&&y.getBg(0)===v.bg||(y=w.getBlankLine(v,b),this._cachedBlankLine=y),y.isWrapped=b;const C=w.ybase+w.scrollTop,E=w.ybase+w.scrollBottom;if(w.scrollTop===0){const N=w.lines.isFull;E===w.lines.length-1?N?w.lines.recycle().copyFrom(y):w.lines.push(y.clone()):w.lines.splice(E+1,0,y.clone()),N?this.isUserScrolling&&(w.ydisp=Math.max(w.ydisp-1,0)):(w.ybase++,this.isUserScrolling||w.ydisp++)}else{const N=E-C+1;w.lines.shiftElements(C+1,N-1,-1),w.lines.set(E,y.clone())}this.isUserScrolling||(w.ydisp=w.ybase),this._onScroll.fire(w.ydisp)}scrollLines(v,b,w){const y=this.buffer;if(v<0){if(y.ydisp===0)return;this.isUserScrolling=!0}else v+y.ydisp>=y.ybase&&(this.isUserScrolling=!1);const C=y.ydisp;y.ydisp=Math.max(Math.min(y.ydisp+v,y.ybase),0),C!==y.ydisp&&(b||this._onScroll.fire(y.ydisp))}};o.BufferService=S=u([_(0,x.IOptionsService)],S)},7994:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,u){this._charsets[l]=u,this.glevel===l&&(this.charset=u)}}},1753:function(a,o,l){var u=this&&this.__decorate||function(y,C,E,N){var T,z=arguments.length,M=z<3?C:N===null?N=Object.getOwnPropertyDescriptor(C,E):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,C,E,N);else for(var O=y.length-1;O>=0;O--)(T=y[O])&&(M=(z<3?T(M):z>3?T(C,E,M):T(C,E))||M);return z>3&&M&&Object.defineProperty(C,E,M),M},_=this&&this.__param||function(y,C){return function(E,N){C(E,N,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=l(2585),p=l(8460),m=l(844),x={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:y=>y.button!==4&&y.action===1&&(y.ctrl=!1,y.alt=!1,y.shift=!1,!0)},VT200:{events:19,restrict:y=>y.action!==32},DRAG:{events:23,restrict:y=>y.action!==32||y.button!==3},ANY:{events:31,restrict:y=>!0}};function S(y,C){let E=(y.ctrl?16:0)|(y.shift?4:0)|(y.alt?8:0);return y.button===4?(E|=64,E|=y.action):(E|=3&y.button,4&y.button&&(E|=64),8&y.button&&(E|=128),y.action===32?E|=32:y.action!==0||C||(E|=3)),E}const v=String.fromCharCode,b={DEFAULT:y=>{const C=[S(y,!1)+32,y.col+32,y.row+32];return C[0]>255||C[1]>255||C[2]>255?"":`\x1B[M${v(C[0])}${v(C[1])}${v(C[2])}`},SGR:y=>{const C=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${S(y,!0)};${y.col};${y.row}${C}`},SGR_PIXELS:y=>{const C=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${S(y,!0)};${y.x};${y.y}${C}`}};let w=o.CoreMouseService=class extends m.Disposable{constructor(y,C){super(),this._bufferService=y,this._coreService=C,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const E of Object.keys(x))this.addProtocol(E,x[E]);for(const E of Object.keys(b))this.addEncoding(E,b[E]);this.reset()}addProtocol(y,C){this._protocols[y]=C}addEncoding(y,C){this._encodings[y]=C}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(y){if(!this._protocols[y])throw new Error(`unknown protocol "${y}"`);this._activeProtocol=y,this._onProtocolChange.fire(this._protocols[y].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(y){if(!this._encodings[y])throw new Error(`unknown encoding "${y}"`);this._activeEncoding=y}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(y){if(y.col<0||y.col>=this._bufferService.cols||y.row<0||y.row>=this._bufferService.rows||y.button===4&&y.action===32||y.button===3&&y.action!==32||y.button!==4&&(y.action===2||y.action===3)||(y.col++,y.row++,y.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,y,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(y))return!1;const C=this._encodings[this._activeEncoding](y);return C&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(C):this._coreService.triggerDataEvent(C,!0)),this._lastEvent=y,!0}explainEvents(y){return{down:!!(1&y),up:!!(2&y),drag:!!(4&y),move:!!(8&y),wheel:!!(16&y)}}_equalEvents(y,C,E){if(E){if(y.x!==C.x||y.y!==C.y)return!1}else if(y.col!==C.col||y.row!==C.row)return!1;return y.button===C.button&&y.action===C.action&&y.ctrl===C.ctrl&&y.alt===C.alt&&y.shift===C.shift}};o.CoreMouseService=w=u([_(0,d.IBufferService),_(1,d.ICoreService)],w)},6975:function(a,o,l){var u=this&&this.__decorate||function(w,y,C,E){var N,T=arguments.length,z=T<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,C):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(w,y,C,E);else for(var M=w.length-1;M>=0;M--)(N=w[M])&&(z=(T<3?N(z):T>3?N(y,C,z):N(y,C))||z);return T>3&&z&&Object.defineProperty(y,C,z),z},_=this&&this.__param||function(w,y){return function(C,E){y(C,E,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=l(1439),p=l(8460),m=l(844),x=l(2585),S=Object.freeze({insertMode:!1}),v=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=o.CoreService=class extends m.Disposable{constructor(w,y,C){super(),this._bufferService=w,this._logService=y,this._optionsService=C,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(S),this.decPrivateModes=(0,d.clone)(v)}reset(){this.modes=(0,d.clone)(S),this.decPrivateModes=(0,d.clone)(v)}triggerDataEvent(w,y=!1){if(this._optionsService.rawOptions.disableStdin)return;const C=this._bufferService.buffer;y&&this._optionsService.rawOptions.scrollOnUserInput&&C.ybase!==C.ydisp&&this._onRequestScrollToBottom.fire(),y&&this._onUserInput.fire(),this._logService.debug(`sending data "${w}"`,(()=>w.split("").map((E=>E.charCodeAt(0))))),this._onData.fire(w)}triggerBinaryEvent(w){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${w}"`,(()=>w.split("").map((y=>y.charCodeAt(0))))),this._onBinary.fire(w))}};o.CoreService=b=u([_(0,x.IBufferService),_(1,x.ILogService),_(2,x.IOptionsService)],b)},9074:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const u=l(8055),_=l(8460),d=l(844),p=l(6106);let m=0,x=0;class S extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList((w=>w==null?void 0:w.marker.line)),this._onDecorationRegistered=this.register(new _.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new _.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(w){if(w.marker.isDisposed)return;const y=new v(w);if(y){const C=y.marker.onDispose((()=>y.dispose()));y.onDispose((()=>{y&&(this._decorations.delete(y)&&this._onDecorationRemoved.fire(y),C.dispose())})),this._decorations.insert(y),this._onDecorationRegistered.fire(y)}return y}reset(){for(const w of this._decorations.values())w.dispose();this._decorations.clear()}*getDecorationsAtCell(w,y,C){let E=0,N=0;for(const T of this._decorations.getKeyIterator(y))E=T.options.x??0,N=E+(T.options.width??1),w>=E&&w{m=N.options.x??0,x=m+(N.options.width??1),w>=m&&w{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const u=l(2585),_=l(8343);class d{constructor(...m){this._entries=new Map;for(const[x,S]of m)this.set(x,S)}set(m,x){const S=this._entries.get(m);return this._entries.set(m,x),S}forEach(m){for(const[x,S]of this._entries.entries())m(x,S)}has(m){return this._entries.has(m)}get(m){return this._entries.get(m)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(u.IInstantiationService,this)}setService(p,m){this._services.set(p,m)}getService(p){return this._services.get(p)}createInstance(p,...m){const x=(0,_.getServiceDependencies)(p).sort(((b,w)=>b.index-w.index)),S=[];for(const b of x){const w=this._services.get(b.id);if(!w)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${b.id}.`);S.push(w)}const v=x.length>0?x[0].index:m.length;if(m.length!==v)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${v+1} conflicts with ${m.length} static arguments`);return new p(...m,...S)}}},7866:function(a,o,l){var u=this&&this.__decorate||function(v,b,w,y){var C,E=arguments.length,N=E<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,w):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(v,b,w,y);else for(var T=v.length-1;T>=0;T--)(C=v[T])&&(N=(E<3?C(N):E>3?C(b,w,N):C(b,w))||N);return E>3&&N&&Object.defineProperty(b,w,N),N},_=this&&this.__param||function(v,b){return function(w,y){b(w,y,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=l(844),p=l(2585),m={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let x,S=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(v){super(),this._optionsService=v,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),x=this}_updateLogLevel(){this._logLevel=m[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(v){for(let b=0;bJSON.stringify(N))).join(", ")})`);const E=y.apply(this,C);return x.trace(`GlyphRenderer#${y.name} return`,E),E}}},7302:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const u=l(8460),_=l(844),d=l(6114);o.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const p=["normal","bold","100","200","300","400","500","600","700","800","900"];class m extends _.Disposable{constructor(S){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const v={...o.DEFAULT_OPTIONS};for(const b in S)if(b in v)try{const w=S[b];v[b]=this._sanitizeAndValidateOption(b,w)}catch(w){console.error(w)}this.rawOptions=v,this.options={...v},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(S,v){return this.onOptionChange((b=>{b===S&&v(this.rawOptions[S])}))}onMultipleOptionChange(S,v){return this.onOptionChange((b=>{S.indexOf(b)!==-1&&v()}))}_setupOptions(){const S=b=>{if(!(b in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},v=(b,w)=>{if(!(b in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);w=this._sanitizeAndValidateOption(b,w),this.rawOptions[b]!==w&&(this.rawOptions[b]=w,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const w={get:S.bind(this,b),set:v.bind(this,b)};Object.defineProperty(this.options,b,w)}}_sanitizeAndValidateOption(S,v){switch(S){case"cursorStyle":if(v||(v=o.DEFAULT_OPTIONS[S]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(v))throw new Error(`"${v}" is not a valid value for ${S}`);break;case"wordSeparator":v||(v=o.DEFAULT_OPTIONS[S]);break;case"fontWeight":case"fontWeightBold":if(typeof v=="number"&&1<=v&&v<=1e3)break;v=p.includes(v)?v:o.DEFAULT_OPTIONS[S];break;case"cursorWidth":v=Math.floor(v);case"lineHeight":case"tabStopWidth":if(v<1)throw new Error(`${S} cannot be less than 1, value: ${v}`);break;case"minimumContrastRatio":v=Math.max(1,Math.min(21,Math.round(10*v)/10));break;case"scrollback":if((v=Math.min(v,4294967295))<0)throw new Error(`${S} cannot be less than 0, value: ${v}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(v<=0)throw new Error(`${S} cannot be less than or equal to 0, value: ${v}`);break;case"rows":case"cols":if(!v&&v!==0)throw new Error(`${S} must be numeric, value: ${v}`);break;case"windowsPty":v=v??{}}return v}}o.OptionsService=m},2660:function(a,o,l){var u=this&&this.__decorate||function(m,x,S,v){var b,w=arguments.length,y=w<3?x:v===null?v=Object.getOwnPropertyDescriptor(x,S):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(m,x,S,v);else for(var C=m.length-1;C>=0;C--)(b=m[C])&&(y=(w<3?b(y):w>3?b(x,S,y):b(x,S))||y);return w>3&&y&&Object.defineProperty(x,S,y),y},_=this&&this.__param||function(m,x){return function(S,v){x(S,v,m)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=l(2585);let p=o.OscLinkService=class{constructor(m){this._bufferService=m,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(m){const x=this._bufferService.buffer;if(m.id===void 0){const C=x.addMarker(x.ybase+x.y),E={data:m,id:this._nextId++,lines:[C]};return C.onDispose((()=>this._removeMarkerFromLink(E,C))),this._dataByLinkId.set(E.id,E),E.id}const S=m,v=this._getEntryIdKey(S),b=this._entriesWithId.get(v);if(b)return this.addLineToLink(b.id,x.ybase+x.y),b.id;const w=x.addMarker(x.ybase+x.y),y={id:this._nextId++,key:this._getEntryIdKey(S),data:S,lines:[w]};return w.onDispose((()=>this._removeMarkerFromLink(y,w))),this._entriesWithId.set(y.key,y),this._dataByLinkId.set(y.id,y),y.id}addLineToLink(m,x){const S=this._dataByLinkId.get(m);if(S&&S.lines.every((v=>v.line!==x))){const v=this._bufferService.buffer.addMarker(x);S.lines.push(v),v.onDispose((()=>this._removeMarkerFromLink(S,v)))}}getLinkData(m){var x;return(x=this._dataByLinkId.get(m))==null?void 0:x.data}_getEntryIdKey(m){return`${m.id};;${m.uri}`}_removeMarkerFromLink(m,x){const S=m.lines.indexOf(x);S!==-1&&(m.lines.splice(S,1),m.lines.length===0&&(m.data.id!==void 0&&this._entriesWithId.delete(m.key),this._dataByLinkId.delete(m.id)))}};o.OscLinkService=p=u([_(0,d.IBufferService)],p)},8343:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const l="di$target",u="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(_){return _[u]||[]},o.createDecorator=function(_){if(o.serviceRegistry.has(_))return o.serviceRegistry.get(_);const d=function(p,m,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(S,v,b){v[l]===v?v[u].push({id:S,index:b}):(v[u]=[{id:S,index:b}],v[l]=v)})(d,p,x)};return d.toString=()=>_,o.serviceRegistry.set(_,d),d}},2585:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const u=l(8343);var _;o.IBufferService=(0,u.createDecorator)("BufferService"),o.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),o.ICoreService=(0,u.createDecorator)("CoreService"),o.ICharsetService=(0,u.createDecorator)("CharsetService"),o.IInstantiationService=(0,u.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(_||(o.LogLevelEnum=_={})),o.ILogService=(0,u.createDecorator)("LogService"),o.IOptionsService=(0,u.createDecorator)("OptionsService"),o.IOscLinkService=(0,u.createDecorator)("OscLinkService"),o.IUnicodeService=(0,u.createDecorator)("UnicodeService"),o.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const u=l(8460),_=l(225);class d{static extractShouldJoin(m){return(1&m)!=0}static extractWidth(m){return m>>1&3}static extractCharKind(m){return m>>3}static createPropertyValue(m,x,S=!1){return(16777215&m)<<3|(3&x)<<1|(S?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const m=new _.UnicodeV6;this.register(m),this._active=m.version,this._activeProvider=m}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(m){if(!this._providers[m])throw new Error(`unknown Unicode version "${m}"`);this._active=m,this._activeProvider=this._providers[m],this._onChange.fire(m)}register(m){this._providers[m.version]=m}wcwidth(m){return this._activeProvider.wcwidth(m)}getStringCellWidth(m){let x=0,S=0;const v=m.length;for(let b=0;b=v)return x+this.wcwidth(w);const E=m.charCodeAt(b);56320<=E&&E<=57343?w=1024*(w-55296)+E-56320+65536:x+=this.wcwidth(E)}const y=this.charProperties(w,S);let C=d.extractWidth(y);d.extractShouldJoin(y)&&(C-=d.extractWidth(S)),x+=C,S=y}return x}charProperties(m,x){return this._activeProvider.charProperties(m,x)}}o.UnicodeService=d}},r={};function s(a){var o=r[a];if(o!==void 0)return o.exports;var l=r[a]={exports:{}};return t[a].call(l.exports,l,l.exports,s),l.exports}var i={};return(()=>{var a=i;Object.defineProperty(a,"__esModule",{value:!0}),a.Terminal=void 0;const o=s(9042),l=s(3236),u=s(844),_=s(5741),d=s(8285),p=s(7975),m=s(7090),x=["cols","rows"];class S extends u.Disposable{constructor(b){super(),this._core=this.register(new l.Terminal(b)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const w=C=>this._core.options[C],y=(C,E)=>{this._checkReadonlyOptions(C),this._core.options[C]=E};for(const C in this._core.options){const E={get:w.bind(this,C),set:y.bind(this,C)};Object.defineProperty(this._publicOptions,C,E)}}_checkReadonlyOptions(b){if(x.includes(b))throw new Error(`Option "${b}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new p.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new m.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let w="none";switch(this._core.coreMouseService.activeProtocol){case"X10":w="x10";break;case"VT200":w="vt200";break;case"DRAG":w="drag";break;case"ANY":w="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:w,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const w in b)this._publicOptions[w]=b[w]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,w=!0){this._core.input(b,w)}resize(b,w){this._verifyIntegers(b,w),this._core.resize(b,w)}open(b){this._core.open(b)}attachCustomKeyEventHandler(b){this._core.attachCustomKeyEventHandler(b)}attachCustomWheelEventHandler(b){this._core.attachCustomWheelEventHandler(b)}registerLinkProvider(b){return this._core.registerLinkProvider(b)}registerCharacterJoiner(b){return this._checkProposedApi(),this._core.registerCharacterJoiner(b)}deregisterCharacterJoiner(b){this._checkProposedApi(),this._core.deregisterCharacterJoiner(b)}registerMarker(b=0){return this._verifyIntegers(b),this._core.registerMarker(b)}registerDecoration(b){return this._checkProposedApi(),this._verifyPositiveIntegers(b.x??0,b.width??0,b.height??0),this._core.registerDecoration(b)}hasSelection(){return this._core.hasSelection()}select(b,w,y){this._verifyIntegers(b,w,y),this._core.select(b,w,y)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,w){this._verifyIntegers(b,w),this._core.selectLines(b,w)}dispose(){super.dispose()}scrollLines(b){this._verifyIntegers(b),this._core.scrollLines(b)}scrollPages(b){this._verifyIntegers(b),this._core.scrollPages(b)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(b){this._verifyIntegers(b),this._core.scrollToLine(b)}clear(){this._core.clear()}write(b,w){this._core.write(b,w)}writeln(b,w){this._core.write(b),this._core.write(`\r -`,w)}paste(b){this._core.paste(b)}refresh(b,w){this._verifyIntegers(b,w),this._core.refresh(b,w)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return o}_verifyIntegers(...b){for(const w of b)if(w===1/0||isNaN(w)||w%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const w of b)if(w&&(w===1/0||isNaN(w)||w%1!=0||w<0))throw new Error("This API only accepts positive integers")}}a.Terminal=S})(),i})()))})(Ax)),Ax.exports}var n0t=t0t();function S6(e,n,t=!1){const r=getComputedStyle(document.documentElement),s=new n0t.Terminal({convertEol:!0,disableStdin:n,fontSize:12,fontFamily:r.getPropertyValue("--mono").trim()||"ui-monospace, Menlo, Consolas, monospace",scrollback:2e4,theme:{background:r.getPropertyValue("--term-bg").trim(),foreground:r.getPropertyValue("--term-foreground").trim(),cursor:n?r.getPropertyValue("--term-bg").trim():r.getPropertyValue("--term-foreground").trim(),selectionBackground:r.getPropertyValue("--term-selection").trim()}}),i=new Z_t.FitAddon;s.loadAddon(i),t&&s.loadAddon(new e0t.WebLinksAddon((l,u)=>{let _;try{_=new URL(u)}catch{return}(_.protocol==="http:"||_.protocol==="https:")&&window.open(_,"_blank","noopener,noreferrer")})),s.open(e);const a=()=>{try{i.fit()}catch{}};a();const o=new ResizeObserver(a);return o.observe(e),{terminal:s,dispose(){o.disconnect(),s.dispose()}}}const wO="overflow-hidden rounded-md bg-terminal p-2";function Zp(e){return typeof e=="object"&&e!==null}function SO(e){return Array.isArray(e)&&e.every(n=>typeof n=="string")}function r0t(e){return Zp(e)&&typeof e.reachable=="boolean"&&typeof e.toolsFound=="boolean"&&(e.missingTools===void 0||SO(e.missingTools))&&(e.error===null||typeof e.error=="string")&&typeof e.testedAt=="number"}function s0t(e){return Zp(e)&&typeof e.reachable=="boolean"&&typeof e.slurmFound=="boolean"&&typeof e.toolsFound=="boolean"&&SO(e.partitions)&&(e.error===null||typeof e.error=="string")}function i0t(e){return!Zp(e)||e.type!=="complete"?null:e.backend==="ssh"&&r0t(e.result)?{backend:"ssh",result:e.result}:e.backend==="slurm"&&s0t(e.result)?{backend:"slurm",result:e.result}:null}function a0t(e){return Zp(e)&&e.type==="error"&&typeof e.error=="string"?e.error:null}function k6({host:e,backend:n,path:t="/api/settings/ssh/connect",active:r=!0,onComplete:s,onError:i}){const a=new URLSearchParams({host:e,backend:n});return f.jsx(kO,{path:`${t}?${a}`,label:SL({host:Ne(e)}),active:r,onError:i,onComplete:o=>{const l=i0t(o);return l?(s(l),!0):!1}})}function o0t({login:e,onComplete:n,onError:t}){return f.jsx(kO,{path:e?"/api/settings/openresearch/login":"/api/settings/openresearch/ssh-key",label:e?"orx login":"orx ssh-key add",heightClass:"h-80",onError:t,onComplete:r=>!Zp(r)||r.type!=="complete"?!1:(n(),!0)})}function kO({path:e,label:n,heightClass:t="h-40",active:r=!0,onComplete:s,onError:i}){const a=R.useRef(null),o=R.useRef(null),l=R.useRef(s),u=R.useRef(i),[_,d]=R.useState(null);return l.current=s,u.current=i,R.useEffect(()=>{const p=a.current;if(!p)return;const{terminal:m,dispose:x}=S6(p,!1,!0);o.current=m,m.focus();const S=location.protocol==="https:"?"wss:":"ws:",v=new URL(e,`${S}//${location.host}`),b=new WebSocket(v);b.binaryType="arraybuffer";let w=!1,y=!1,C=!1;const E=z=>{var M;y||(y=!0,C||m.writeln(z),m.options.disableStdin=!0,m.blur(),d(z),(M=u.current)==null||M.call(u,z))},N=m.onData(z=>{b.readyState===WebSocket.OPEN&&b.send(new TextEncoder().encode(z))}),T=m.onResize(({cols:z,rows:M})=>{b.readyState===WebSocket.OPEN&&b.send(JSON.stringify({type:"resize",cols:z,rows:M}))});return b.onopen=()=>{b.send(JSON.stringify({type:"resize",cols:m.cols,rows:m.rows}))},b.onmessage=z=>{if(z.data instanceof ArrayBuffer){C=!0,m.write(new Uint8Array(z.data));return}if(typeof z.data!="string")return;let M;try{M=JSON.parse(z.data)}catch{return}if(l.current(M)){w=!0,b.close();return}const O=a0t(M);O&&E(O)},b.onerror=()=>E(DN()),b.onclose=()=>{!w&&!y&&E(DN())},()=>{b.onopen=null,b.onmessage=null,b.onerror=null,b.onclose=null,N.dispose(),T.dispose(),b.close(),o.current=null,x()}},[e]),R.useEffect(()=>{const p=o.current;p&&(p.options.disableStdin=!r||_!==null,r&&_===null?p.focus():p.blur())},[r,_]),f.jsxs("div",{className:"mt-3",children:[f.jsx("div",{className:`${t} ${wO}`,role:"group","aria-label":n,children:f.jsx("div",{ref:a,className:"h-full overflow-hidden"})}),_?f.jsx("p",{role:"alert",className:"sr-only",children:_}):null]})}function l0t({host:e,transcript:n}){const t=R.useRef(null);return R.useEffect(()=>{const r=t.current;if(!r)return;const{terminal:s,dispose:i}=S6(r,!0,!0);return s.write(n),i},[n]),f.jsx("div",{className:`mt-3 h-40 ${wO}`,role:"group","aria-label":SL({host:Ne(e)}),children:f.jsx("div",{ref:t,className:"h-full overflow-hidden"})})}function lu(e,n){return e&&Object.hasOwn(e.tasks,n)?e.tasks[n]:void 0}const c0t=["settings","harnesses","projects","compute","instances","environment","git","storage"],u0t=e=>c0t.some(n=>n===e),d0t=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Bi=e=>typeof e=="string"&&e.length>0,Og=e=>e==null||Bi(e);function C6(e){if(!d0t(e))return;const n=(...t)=>Object.keys(e).every(r=>t.includes(r));switch(e.kind){case"home":if(n("kind","view")&&(e.view==="experiments"||e.view==="files"||e.view==="artifacts"))return{kind:"home",view:e.view};break;case"experiment":if(n("kind","experimentId","view","runId")&&Bi(e.experimentId)&&(e.view==="overview"||e.view==="terminal")&&Og(e.runId))return{kind:"experiment",experimentId:e.experimentId,view:e.view,...Bi(e.runId)?{runId:e.runId}:{}};break;case"file":if(n("kind","path","source","sessionId","ref","line","branchLabel")&&Bi(e.path)&&Og(e.sessionId)&&Og(e.ref)&&Og(e.branchLabel)&&(e.source==null||e.source==="repo"||e.source==="artifacts"||e.source==="abs")&&(e.line==null||typeof e.line=="number"&&Number.isSafeInteger(e.line)&&e.line>0))return{kind:"file",path:e.path,...e.source?{source:e.source}:{},...Bi(e.sessionId)?{sessionId:e.sessionId}:{},...Bi(e.ref)?{ref:e.ref}:{},...typeof e.line=="number"?{line:e.line}:{},...Bi(e.branchLabel)?{branchLabel:e.branchLabel}:{}};break;case"code":if(n("kind","experimentId","branch","view")&&Bi(e.experimentId)&&Bi(e.branch)&&(e.view==="files"||e.view==="changes"))return{kind:"code",experimentId:e.experimentId,branch:e.branch,view:e.view};break;case"plan":if(n("kind","sessionId","promptId")&&Bi(e.sessionId)&&Bi(e.promptId))return{kind:"plan",sessionId:e.sessionId,promptId:e.promptId};break;case"subagent":if(n("kind","sessionId","spawnPartId")&&Bi(e.sessionId)&&Bi(e.spawnPartId))return{kind:"subagent",sessionId:e.sessionId,spawnPartId:e.spawnPartId}}}function Rd(e){if(e==="/projects")return{kind:"home"};const n=e.split("/");if(n[0]!==""||n[1]!=="projects"||!n[2])return null;let t,r;try{t=decodeURIComponent(n[2]),r=decodeURIComponent(n[4]??"")}catch{return null}const s=i=>i.length>0&&i!=="."&&i!==".."&&!/[\\/?#\u0000-\u001f\u007f-\u009f]/.test(i);return s(t)?n.length===3||n.length===4&&n[3]===""?{kind:"resume",projectId:t}:n.length===4&&n[3]==="skills"?{kind:"skills",projectId:t}:n.length===5&&n[3]==="tasks"&&s(r)?{kind:"task",projectId:t,...r==="new"?{}:{sessionId:r}}:n.length===5&&n[3]==="settings"&&u0t(r)?{kind:"settings",projectId:t,section:r}:null:null}function ab(e){if(typeof e!="string"||!e.startsWith("/")||e.startsWith("//")||/[\\#\u0000-\u001f\u007f-\u009f]/.test(e))return null;const n=e.indexOf("?"),t=n===-1?e:e.slice(0,n),r=n===-1?"":e.slice(n+1),s=Rd(t);if(!s||s.kind==="resume")return null;const i=new URLSearchParams(r);if([...i.keys()].some(a=>a!=="pane")||i.getAll("pane").length>1)return null;if(i.has("pane"))try{if(!C6(JSON.parse(i.get("pane")??"")))return null}catch{return null}return e}function k1(e,n,t){const r=`/projects/${encodeURIComponent(e)}/tasks/${n?encodeURIComponent(n):"new"}`;return t?`${r}?${new URLSearchParams({pane:JSON.stringify(t)})}`:r}const dz=()=>({version:1,lastTaskId:null,lastLocation:null,tasks:{}});function CO(e,n){let t,r,s=!1,i=!1,a;async function o(l=!1){if(clearTimeout(a),i||(i=l),s||t===void 0)return;s=!0;const u=t;t=void 0;const _=i;i=!1;try{await e(u,_),r=void 0}catch(d){r=u,n(d)}finally{s=!1,t!==void 0&&o()}}return{queue(l,u=0){t=l,clearTimeout(a),a=setTimeout(()=>void o(),u)},flush:o,retry(){return!s&&t===void 0&&(t=r),o()}}}let lv=null,C0=0;const E6=()=>lv;function EO(){const e=C0;return CO(async(n,t)=>{if(e!==C0)return;const r=await out(n,t);e===C0&&nt.setQueryData(Xp().queryKey,s=>s?{...s,workspace:r.workspace}:r)},n=>{e===C0&&Kn(n instanceof Error?n.message:String(n),"error",{id:"workspace-save",action:{label:Ui(),onClick:()=>void ob.retry()}})})}let C1=EO();function f0t(){C0++,lv=null,C1=EO()}const ob={flush:(e=!1)=>C1.flush(e),retry:()=>C1.retry(),queue(e,n=0){const t=lv;t&&t.lastLocation===e.lastLocation&&t.railOpen===e.railOpen&&t.panelWidth===e.panelWidth&&t.experimentsView===e.experimentsView||(lv=e,C1.queue(e,n))}};window.addEventListener("pagehide",()=>void ob.flush(!0));function Dl(e,n){if(typeof e=="string")return{kind:"home",view:e};if("code"in e)return{kind:"code",experimentId:e.experimentId,branch:e.branch,view:e.view};if("kind"in e)return e.kind==="plan"?{kind:"plan",sessionId:e.sessionId,promptId:e.promptId}:{kind:"subagent",sessionId:e.sessionId,spawnPartId:e.spawnPartId};if("path"in e)return{kind:"file",path:e.path,source:e.source,sessionId:e.sessionId,ref:e.ref,line:e.line,branchLabel:e.branchLabel};const t=n===void 0?e.runId:n;return{kind:"experiment",experimentId:e.id,view:e.view,...t?{runId:t}:{}}}function Wa(e){switch(e.kind){case"home":return e.view;case"experiment":return{id:e.experimentId,view:e.view,...e.runId?{runId:e.runId}:{}};case"file":return{path:e.path,source:e.source,sessionId:e.sessionId,ref:e.ref,line:e.line,branchLabel:e.branchLabel};case"code":return{code:!0,experimentId:e.experimentId,branch:e.branch,view:e.view,toggled:new Set};case"plan":return{kind:"plan",sessionId:e.sessionId,promptId:e.promptId,plan:""};case"subagent":return{kind:"subagent",sessionId:e.sessionId,spawnPartId:e.spawnPartId}}}function NO(e,n,t){const r=[];e.filesTabOpen&&r.push("files"),e.artifactsTabOpen&&r.push("artifacts"),e.experimentsTabOpen&&r.push("experiments");const s=[...e.expTabs,...e.fileTabs,...e.planTabs,...e.subagentTabs,...e.codeTabs],i=new Map(s.map(u=>[Ct(u),u])),a=e.contentTabOrder.flatMap(u=>{const _=i.get(u);return _?[_]:[]}),o=Ct(e.rightTab);return{tabs:[...r,...a].map(u=>Dl(u,Ct(u)===o?e.selectedRunId:void 0)),active:e.panelOpen?Dl(e.rightTab,e.selectedRunId):null,previewKey:e.previewTab?Ct(e.previewTab):null,history:e.tabHistory.map(Ct),expanded:Object.fromEntries([["files",[...e.filesToggled]],...e.codeTabs.map(u=>[Ct(u),[...u.toggled]])]),scroll:n,sourceModes:t,filesView:e.filesView,scope:e.scope,panelMax:e.panelMax,treeViewport:e.treeViewport}}function h0t(e,n){const t=z6();e&&(t.filesView=e.filesView,t.filesToggled=new Set(e.expanded.files??[]),t.scope=e.scope,t.panelMax=e.panelMax,t.treeViewport=e.treeViewport??null);const r=[...(e==null?void 0:e.tabs)??[]];if(n){const i=r.findIndex(a=>Ct(Wa(a))===Ct(Wa(n)));i===-1?r.push(n):r[i]=n}for(const i of r){const a=Wa(i);if(typeof a=="string"){a==="experiments"&&(t.experimentsTabOpen=!0),a==="files"&&(t.filesTabOpen=!0),a==="artifacts"&&(t.artifactsTabOpen=!0);continue}"code"in a?(a.toggled=new Set((e==null?void 0:e.expanded[Ct(a)])??[]),t.codeTabs.push(a)):"path"in a?t.fileTabs.push(a):"kind"in a?a.kind==="plan"?t.planTabs.push(a):t.subagentTabs.push(a):t.expTabs.push(a),t.contentTabOrder.push(Ct(a))}const s=new Map(r.map(i=>{const a=Wa(i);return[Ct(a),a]}));return t.tabHistory=((e==null?void 0:e.history)??[]).flatMap(i=>{const a=s.get(i);return a?[a]:[]}),t.previewTab=e!=null&&e.previewKey?s.get(e.previewKey)??null:null,t.rightTab=n?Wa(n):e!=null&&e.active?Wa(e.active):"experiments",t.panelOpen=n!==void 0,t.selectedRunId=(n==null?void 0:n.kind)==="experiment"?n.runId??null:null,jO(t,n)}const Rx=(e,n)=>e.id===n.id&&e.view===n.view,Qu=(e,n)=>e.path===n.path&&(e.source??"repo")===(n.source??"repo")&&e.sessionId===n.sessionId&&e.ref===n.ref,N6=e=>`${e.source??"repo"}:${e.sessionId??""}:${e.ref??""}:${e.path}`,Ms=(e,n,t)=>`${e}:${n??""}:${N6(t)}`,zO=e=>({...e,lineScrollRequest:void 0});function Ig(e){return typeof e=="object"&&"path"in e?zO(e):e}const Hf=(e,n)=>e.branch===n.branch;function Ct(e){return typeof e=="string"?`home:${e}`:"code"in e?`code:${e.branch}`:"kind"in e?e.kind==="plan"?`plan:${e.promptId}`:`subagent:${e.spawnPartId}`:"path"in e?`file:${N6(e)}`:`experiment:${e.id}:${e.view}`}function u0(e,n){const t=e.filter(r=>Ct(r)!==n);return t.length===e.length?e:t}function _0t(e){return e!==void 0}function z6(e,n=!1){const t={rightTab:"experiments",tabHistory:[],experimentsTabOpen:!1,filesTabOpen:!1,artifactsTabOpen:!1,expTabs:[],fileTabs:[],planTabs:[],subagentTabs:[],codeTabs:[],contentTabOrder:[],previewTab:null,filesView:"files",filesToggled:new Set,selectedRunId:null,scope:"project",panelOpen:!1,panelMax:!1,treeViewport:null};if(e===O0&&n){const r={path:w1,source:"artifacts"},s="experiments";return{...t,rightTab:s,tabHistory:[r,s],experimentsTabOpen:!0,fileTabs:[r],contentTabOrder:[Ct(r)],panelOpen:!0}}if(e===h6){const r=[{path:"nanochat-base-training-curves.svg",source:"artifacts"},{path:"nanochat-sft-training-curves.svg",source:"artifacts"},{path:"nanochat-training-throughput.svg",source:"artifacts"},{path:"nanochat-core-evaluation.svg",source:"artifacts"}];return{...t,rightTab:r[0],tabHistory:[...r.slice(1),r[0]],fileTabs:r,contentTabOrder:r.map(Ct),panelOpen:!0}}if(e===_6){const r=[{path:"nanochat-bottleneck-diagnosis.md",source:"artifacts"}];return{...t,rightTab:r[0],tabHistory:[r[0]],fileTabs:r,contentTabOrder:r.map(Ct),panelOpen:!0}}return t}function j6(e,n){const t=z6(e,n);return t.panelOpen?NO(t,{},{}):void 0}function jO(e,n){if(!n)return e;const t=Wa(n),r=Ct(t),s=[...e.expTabs,...e.fileTabs,...e.codeTabs,...e.planTabs,...e.subagentTabs].find(l=>Ct(l)===r),i=(l,u)=>{const _=l.findIndex(d=>Ct(d)===r);return _<0?[...l,u]:JSON.stringify(Dl(l[_]))===JSON.stringify(Dl(u))?l:l.map((d,p)=>p===_?{...d,...u}:d)},a={...e};typeof t=="string"?t==="files"?a.filesTabOpen=!0:t==="artifacts"?a.artifactsTabOpen=!0:a.experimentsTabOpen=!0:("path"in t?a.fileTabs=i(e.fileTabs,t):"id"in t?a.expTabs=i(e.expTabs,{...t,runId:n.kind==="experiment"?n.runId:void 0}):"code"in t?a.codeTabs=i(e.codeTabs,{...t,toggled:s&&"code"in s?s.toggled:t.toggled}):t.kind==="plan"?a.planTabs=i(e.planTabs,t):a.subagentTabs=i(e.subagentTabs,t),e.contentTabOrder.includes(r)||(a.contentTabOrder=[...e.contentTabOrder,r]));const o=e.tabHistory.at(-1);return o&&Ct(o)===r&&JSON.stringify(Dl(o))===JSON.stringify(Dl(t))||(a.tabHistory=[...e.tabHistory.filter(l=>Ct(l)!==r),t]),a}let Va=0;const sp=new Map,cv=new Map,Q4=new Set,Y4=()=>{for(const e of Q4)e()},p0t=e=>(Q4.add(e),()=>{Q4.delete(e)}),ip=new Map,Ka=new Map,TO=e=>Ka.get(e);function m0t(){Va++,Ka.clear(),ip.clear(),sp.clear(),cv.clear(),Y4()}function g0t(e,n){const t=Ka.get(e);if(!(t!=null&&t.tasks.new)||lu(t,n))return;const r=t.tasks.new,s=a=>Object.fromEntries(r.tabs.flatMap(o=>{if(o.kind!=="file")return[];const l=Wa(o);if(typeof l=="string"||!("path"in l))return[];const u=Ms(e,null,l);return u in a?[[Ms(e,n,l),a[u]]]:[]})),i={...t.tasks,[n]:{...r,scroll:s(r.scroll),sourceModes:s(r.sourceModes)}};delete i.new,ip.set(e,n),Ka.set(e,{...t,tasks:i})}function v0t(e){let n=sp.get(e);if(!n){const t=Va;n=CO(async(r,s)=>{if(t!==Va)return;const i=await aut(e,r,s);t===Va&&nt.setQueryData(g6(e).queryKey,i),t===Va&&cv.delete(e)&&Y4()},r=>{t===Va&&(cv.set(e,r instanceof Error?r.message:String(r)),Y4())}),sp.set(e,n)}return n}function Mx(e,n,t,r){const s=Ka.get(e);if(!s||t==="new"&&ip.has(e))return;const i=ab(n)??s.lastLocation,a=t?t==="new"?null:t:s.lastTaskId,o=t?lu(s,t):void 0;if(i===s.lastLocation&&a===s.lastTaskId&&(!r||JSON.stringify(r)===JSON.stringify(o)))return;const l={...s,lastLocation:i,lastTaskId:a,tasks:t&&r?{...s.tasks,[t]:r}:s.tasks},u=o&&r&&i===s.lastLocation&&JSON.stringify({...o,scroll:{},sourceModes:{}})===JSON.stringify({...r,scroll:{},sourceModes:{}});Ka.set(e,l),v0t(e).queue(l,u?250:0)}function fz(e,n,t,r){const s=new Set(e.state.fileTabs.map(_=>Ms(t,r==="new"?null:r,_))),i=Object.fromEntries(Object.entries(e.getScroll()).filter(([_])=>s.has(_))),a=Object.fromEntries(Object.entries(e.sourceModes).filter(([_])=>s.has(_))),o=NO(e.state,i,a),l=e.pane??(n==null?void 0:n.active),u=l?Ct(Wa(l)):null;return o.active=o.tabs.find(_=>Ct(Wa(_))===u)??null,o}function b0t(e){const{projectId:n,taskKey:t,location:r,pane:s,isTask:i,demoOverview:a,state:o,apply:l,getScroll:u,sourceModes:_,revision:d}=e,p=R.useRef(dz()),m=R.useSyncExternalStore(p0t,()=>n?cv.get(n)??null:null),[x,S]=R.useState(null),[v,b]=R.useState(0),[w,y]=R.useState(null),[C,E]=R.useState(null),N=R.useRef(null),T=R.useRef(null),z=R.useRef(null),M=R.useRef(e);M.current=e;const O=JSON.stringify([n,t,i]),B=JSON.stringify(s??null),$=R.useCallback(()=>{const H=z.current;if(!H)return;const Y=fz({...M.current,state:H.state,pane:H.pane},lu(Ka.get(H.projectId),H.taskKey),H.projectId,H.taskKey);Mx(H.projectId,H.location,H.taskKey,Y)},[]);R.useEffect(()=>{let H=!0;const Y=Va;if(S(null),y(null),!!n)return Ka.has(n)?y(n):nt.fetchQuery(g6(n)).then(V=>{!H||Y!==Va||(Ka.set(n,V??dz()),y(n))}).catch(V=>{H&&Y===Va&&S(V instanceof Error?V.message:String(V))}),()=>{H=!1}},[n,v]),R.useLayoutEffect(()=>{if(z.current&&z.current.scope!==O){const V=z.current.projectId;$(),ip.get(V)===t&&ip.delete(V),z.current=null}if(!n||w!==n)return;const H=Ka.get(n);if(!H)return;if(p.current=H,N.current!==O){if(N.current=O,T.current=B,i){const V=lu(H,t)??(Wc(n)?j6(t,a):void 0);l(h0t(V,s),V,!0)}E(O);return}if(C!==O)return;let Y=o;T.current!==B&&(T.current=B,i&&s&&(Y=jO(o,s),l(Y,void 0,!1))),i?(Mx(n,r,t,fz({state:Y,pane:s,getScroll:u,sourceModes:_},lu(H,t),n,t)),z.current={projectId:n,taskKey:t,scope:O,location:r,pane:s,state:Y}):Mx(n,r),p.current=Ka.get(n)??H},[n,t,r,s,B,i,a,o,l,u,_,d,w,O,C,$]),R.useEffect(()=>{const H=Va,Y=X=>{if(H===Va){$();for(const te of sp.values())te.flush(X)}},V=()=>Y(!0);return window.addEventListener("pagehide",V),()=>{window.removeEventListener("pagehide",V),Y(!1)}},[$]);const U=R.useCallback(()=>{var H;n&&(x?b(Y=>Y+1):(H=sp.get(n))==null||H.retry())},[n,x]);return{ready:n===null||w===n&&C===O,loaded:n===null||w===n,error:x??m,retry:U,capture:$,workspace:p}}const y0t="data:image/svg+xml,"+encodeURIComponent(''),X4=R.createContext(null);function x0t(e){var n;return e.kind==="local"?"local":`${e.session.id}:${((n=e.session.installPaths)==null?void 0:n.database)??""}`}function AO(){const e=R.useContext(X4);if(!e)throw new Error("Runtime is not connected");return e}function w0t(e){const n=document.querySelector('link[rel="icon"]');n&&(n.href=e?y0t:"/favicon.svg")}function hz(e){try{return localStorage.getItem(e)!==null}catch{return!1}}function S0t(e){if(e.kind!=="ssh")return;const{theme:n,locale:t}=e.session.uiPreferences;!hz("orx:theme")&&(n==="light"||n==="dark"||n==="system")&&tO(n),!hz("orx:locale")&&t&&cD(t)&&JL(t)}function k0t(e){return e.includes("ssh ")&&e.includes("failed")}function _z({host:e,overlay:n=!1}){return f.jsx("div",{className:n?"w-full max-w-2xl":"app flex h-full items-center justify-center bg-background p-6",children:f.jsxs("section",{className:"w-full max-w-2xl rounded-xl border border-border bg-background p-7 shadow-modal",children:[f.jsx("h1",{id:"remote-setup-title",className:"m-0 text-2xl font-semibold text-text",children:JD({host:Ne(e)})}),f.jsx("p",{className:"mt-2 mb-0 text-base text-text",children:E4()}),f.jsx("p",{className:"mt-2 mb-0 text-sm text-subtext",children:uDe()})]})})}function pz({runtime:e,overlay:n=!1,retriedInteractiveError:t,setRetriedInteractiveError:r}){var M,O,B;const{session:s}=e,[i,a]=R.useState(s.installPaths),[o,l]=R.useState(!1),[u,_]=R.useState(null);R.useEffect(()=>a(s.installPaths),[(M=s.installPaths)==null?void 0:M.binary,(O=s.installPaths)==null?void 0:O.database,(B=s.installPaths)==null?void 0:B.cache]);async function d(){if(i){l(!0);try{await ydt(i)}catch($){Kn($ instanceof Error?$.message:String($),"error")}finally{l(!1)}}}async function p($=!1){r($?s.error:null),l(!0);try{await xdt()}catch(U){Kn(U instanceof Error?U.message:String(U),"error")}finally{l(!1)}}async function m(){l(!0);try{await IL()}catch($){Kn($ instanceof Error?$.message:String($),"error")}finally{l(!1)}}async function x(){l(!0);try{_(await BL())}catch($){Kn($ instanceof Error?$.message:String($),"error")}finally{l(!1)}}async function S(){if(u){l(!0);try{await $L(u),_(null)}catch($){_(null),Kn($ instanceof Error?$.message:String($),"error")}finally{l(!1)}}}async function v(){l(!0);try{await wdt()}catch($){Kn($ instanceof Error?$.message:String($),"error")}finally{l(!1)}}const b=s.status==="applying"||o,w=s.status==="needsInstall",y=s.status==="needsUpdate",C=i&&w,E=["connecting","applying","reconnecting"].includes(s.status),N=s.status==="disconnected"&&s.error!==null&&k0t(s.error)&&t!==s.error&&!s.canStartNewHost,T=w?DDe():y?GOe():s.status==="applying"?mMe({host:Ne(s.host)}):s.status==="reconnecting"?bLe({host:Ne(s.host)}):s.status==="disconnected"?s.error?aDe({host:Ne(s.host)}):s.canStartNewHost?vDe({host:Ne(s.host)}):JD({host:Ne(s.host)}):LMe({host:Ne(s.host)}),z=s.error??(s.canStartNewHost?_De():w?WDe({user:Ne(s.user??""),host:Ne(s.host)}):y?FOe({host:Ne(s.host)}):s.status==="applying"?fMe():s.status==="reconnecting"?pLe():s.status==="disconnected"?JMe():AMe());return f.jsxs(f.Fragment,{children:[f.jsx("main",{className:n?"w-full max-w-2xl":"app flex h-full items-center justify-center bg-background p-6",children:f.jsxs("section",{className:"w-full max-w-2xl rounded-xl border border-border bg-background p-7 shadow-modal",children:[f.jsxs("div",{className:"flex items-start gap-3",children:[E&&f.jsx(Lt,{className:"mt-2"}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("h1",{id:"remote-setup-title",className:"m-0 text-2xl font-semibold text-text",children:T}),!N&&f.jsx("p",{className:"mt-2 mb-0 text-base text-text",children:z})]})]}),N&&f.jsx(k6,{host:s.host,backend:"ssh",path:"/_orx/ssh/connect",onComplete:()=>void p(!0)}),C&&f.jsxs("div",{className:"mt-6 grid gap-4 border-t border-border-variant pt-5",children:[f.jsx("p",{className:"m-0 text-sm text-subtext",children:TDe()}),[["binary",wDe()],["database",EDe()]].map(([$,U])=>f.jsxs("label",{className:"grid gap-1 text-sm font-medium text-subtext",children:[U,f.jsx(rs,{value:i[$],onChange:H=>a({...i,[$]:H.target.value}),disabled:b,dir:"ltr"})]},$)),!s.error&&f.jsx("div",{className:"flex justify-end pt-1",children:f.jsx(Oe,{variant:"primary",disabled:b,onClick:()=>void d(),children:b?f.jsxs(f.Fragment,{children:[f.jsx(Lt,{})," ",BDe()]}):y?SN():fL()})})]}),y&&i&&f.jsx("div",{className:"mt-6 flex justify-end",children:!s.error&&f.jsx(Oe,{variant:"primary",disabled:b,onClick:()=>void d(),children:b?f.jsxs(f.Fragment,{children:[f.jsx(Lt,{})," ",QOe()]}):SN()})}),s.status==="disconnected"&&f.jsx("div",{className:"mt-6 flex justify-end border-t border-border-variant pt-5",children:s.canStartNewHost?f.jsxs(Oe,{variant:"primary",disabled:o,onClick:()=>void v(),children:[o?f.jsx(Lt,{}):null,s.error?xN():jLe()]}):f.jsxs(Oe,{variant:"primary",disabled:o,onClick:()=>void p(),children:[o?f.jsx(Lt,{}):null,xN()]})}),(s.status==="connecting"||s.status==="reconnecting")&&f.jsx("div",{className:"mt-6 flex justify-end border-t border-border-variant pt-5",children:f.jsx(Oe,{disabled:o,onClick:()=>void m(),children:j4()})}),y&&s.error&&f.jsxs("div",{className:"mt-6 flex justify-end gap-2 border-t border-border-variant pt-5",children:[f.jsx(Oe,{disabled:o,onClick:()=>void m(),children:j4()}),s.installPaths!==null&&(s.dashboardProtocol===null||s.dashboardProtocolvoid p(),children:[o?f.jsx(Lt,{}):null,yN()]}),s.installPaths===null&&s.dashboardProtocol!==null&&s.dashboardProtocolvoid x(),children:[o?f.jsx(Lt,{}):null,eL()]})]}),w&&s.error&&f.jsx("div",{className:"mt-6 flex justify-end",children:f.jsxs(Oe,{variant:"primary",disabled:o,onClick:()=>void p(),children:[o?f.jsx(Lt,{}):null,yN()]})})]})}),u&&f.jsx(yO,{host:s.host,preview:u,currentClientAttached:!1,stopping:o,onClose:()=>{o||_(null)},onConfirm:()=>void S()})]})}function C0t({children:e}){const n=R.useRef(null);return R.useEffect(()=>{var t;return(t=n.current)==null?void 0:t.focus()},[]),f.jsx("div",{ref:n,role:"alertdialog","aria-modal":"true","aria-labelledby":"remote-setup-title",tabIndex:-1,className:"absolute inset-0 z-100 flex items-center justify-center bg-modal-backdrop p-6",children:e})}function E0t(){R.useSyncExternalStore(h9,BG),R.useEffect(()=>h9(()=>{f0t(),m0t()}),[]);const e=qV({select:x=>x.pathname==="/remote-launch"}),[n,t]=R.useState(null),[r,s]=R.useState(null),i=R.useRef(!1),a=R.useRef(!1),o=R.useRef(!1),l=R.useRef(null),[u,_]=R.useState(null),d=ct({...Mft(),enabled:!e,refetchInterval:x=>{var S;return x.state.status==="error"||((S=x.state.data)==null?void 0:S.kind)==="ssh"?2e3:!1},refetchIntervalInBackground:!0});if(R.useEffect(()=>{var v,b;if(e)return;const x=d.data;if(!x){s(((v=d.error)==null?void 0:v.message)??null);return}const S=x0t(x);$G(S),l.current!==null&&l.current!==S&&(i.current=!1,a.current=!1,o.current=!1),l.current=S,x.kind==="ssh"&&(o.current||(o.current=!0,S0t(x)),x.session.status==="connected"?(i.current=!0,a.current=!0,_(null)):x.session.status==="disconnected"&&x.session.error===null&&(a.current=!1)),t(x),s(((b=d.error)==null?void 0:b.message)??null)},[e,d.data,d.error]),R.useEffect(()=>{const x=(n==null?void 0:n.kind)==="ssh";w0t(x),x&&(!i.current||n.session.status==="disconnected"&&!n.session.error)&&(document.title="OpenResearch")},[n]),e)return f.jsxs("main",{className:"app flex h-full items-center justify-center gap-3 bg-background text-base text-text",children:[f.jsx(Lt,{})," ",lLe()]});if(!n)return f.jsx("main",{className:"app flex h-full items-center justify-center gap-3 bg-background text-base text-text",children:r?f.jsxs(f.Fragment,{children:[f.jsx("span",{children:r}),f.jsx(Oe,{onClick:()=>location.reload(),children:Ui()})]}):f.jsx(Lt,{})});if(n.kind==="local")return f.jsxs(X4,{value:n,children:[f.jsx(YN,{}),f.jsx(Z0,{})]},za()[1]);if(!(a.current&&(n.session.status!=="disconnected"||n.session.error!==null))&&n.session.status!=="connected")return r?f.jsx(_z,{host:n.session.host}):f.jsx(pz,{runtime:n,retriedInteractiveError:u,setRetriedInteractiveError:_});const m=n.session.status!=="connected"||r!==null;return f.jsxs("div",{className:"relative h-full",children:[f.jsx("div",{className:"h-full",inert:m,children:f.jsxs(X4,{value:n,children:[f.jsx(YN,{}),f.jsx(Z0,{})]},za()[1])}),m&&f.jsx(C0t,{children:r?f.jsx(_z,{host:n.session.host,overlay:!0}):f.jsx(pz,{runtime:n,overlay:!0,retriedInteractiveError:u,setRetriedInteractiveError:_})})]})}const lb=EV()({component:E0t}),T6="orx:demo-read-sessions";function RO(){try{const e=JSON.parse(sessionStorage.getItem(T6)??"[]");return new Set(Array.isArray(e)?e.filter(n=>typeof n=="string"):[])}catch{return new Set}}function N0t(e){try{const n=RO();n.add(e),sessionStorage.setItem(T6,JSON.stringify([...n]))}catch{}}function z0t(){try{sessionStorage.removeItem(T6)}catch{}}function MO(e,n){const t=Rd(e.split("?")[0]);return!!(t&&(!t.sessionId||n.some(r=>r.id===t.sessionId&&r.projectId===t.projectId)))}async function j0t(e=nt){var i;const[n,t]=await Promise.all([e.fetchQuery(Xp()),e.fetchQuery(rp())]),r=ab((i=E6()??n.workspace)==null?void 0:i.lastLocation);if(!r)return"/projects";const s=Rd(r.split("?")[0]);return!(s!=null&&s.projectId)||!t.some(a=>a.id===s.projectId)||s.sessionId&&!MO(r,await e.fetchQuery(Ea(s.projectId)))?"/projects":r}async function T0t(e,n=nt){var _;const[t,r]=await Promise.all([n.fetchQuery(g6(e)),n.fetchQuery(Ea(e))]),s=TO(e)??t,i=ab(s==null?void 0:s.lastLocation);if(i&&((_=Rd(i.split("?")[0]))==null?void 0:_.projectId)===e&&MO(i,r))return i;const a=r.find(d=>!d.archived),o=Wc(e)?j6(a==null?void 0:a.id,!(await n.fetchQuery(Xp())).tourCompleted):void 0,l=lu(s,(a==null?void 0:a.id)??"new"),u=l?l.active:o==null?void 0:o.active;return k1(e,(a==null?void 0:a.id)??null,u)}/** +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(z){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&z&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(z){const M=this._getMouseBufferCoords(z),I=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(I&&B&&M)&&this._areCoordsInSelection(M,I,B)}isCellInSelection(z,M){const I=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!I||!B)&&this._areCoordsInSelection([z,M],I,B)}_areCoordsInSelection(z,M,I){return z[1]>M[1]&&z[1]=M[0]&&z[0]=M[0]}_selectWordAtCursor(z,M){var $,U;const I=(U=($=this._linkifier.currentLink)==null?void 0:$.link)==null?void 0:U.range;if(I)return this._model.selectionStart=[I.start.x-1,I.start.y-1],this._model.selectionStartLength=(0,w.getRangeLength)(I,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(z);return!!B&&(this._selectWordAt(B,M),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(z,M){this._model.clearSelection(),z=Math.max(z,0),M=Math.min(M,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,z],this._model.selectionEnd=[this._bufferService.cols,M],this.refresh(),this._onSelectionChange.fire()}_handleTrim(z){this._model.handleTrim(z)&&this.refresh()}_getMouseBufferCoords(z){const M=this._mouseService.getCoords(z,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(M)return M[0]--,M[1]--,M[1]+=this._bufferService.buffer.ydisp,M}_getMouseEventScrollAmount(z){let M=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,z,this._screenElement)[1];const I=this._renderService.dimensions.css.canvas.height;return M>=0&&M<=I?0:(M>I&&(M-=I),M=Math.min(Math.max(M,-50),50),M/=50,M/Math.abs(M)+Math.round(14*M))}shouldForceSelection(z){return b.isMac?z.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:z.shiftKey}handleMouseDown(z){if(this._mouseDownTimeStamp=z.timeStamp,(z.button!==2||!this.hasSelection)&&z.button===0){if(!this._enabled){if(!this.shouldForceSelection(z))return;z.stopPropagation()}z.preventDefault(),this._dragScrollAmount=0,this._enabled&&z.shiftKey?this._handleIncrementalClick(z):z.detail===1?this._handleSingleClick(z):z.detail===2?this._handleDoubleClick(z):z.detail===3&&this._handleTripleClick(z),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(z){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(z))}_handleSingleClick(z){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(z)?3:0,this._model.selectionStart=this._getMouseBufferCoords(z),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const M=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);M&&M.length!==this._model.selectionStart[0]&&M.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(z){this._selectWordAtCursor(z,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(z){const M=this._getMouseBufferCoords(z);M&&(this._activeSelectionMode=2,this._selectLineAt(M[1]))}shouldColumnSelect(z){return z.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(z){if(z.stopImmediatePropagation(),!this._model.selectionStart)return;const M=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(z),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const I=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(z.ydisp+this._bufferService.rows,z.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=z.ydisp),this.refresh()}}_handleMouseUp(z){const M=z.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&M<500&&z.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const I=this._mouseService.getCoords(z,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(I&&I[0]!==void 0&&I[1]!==void 0){const B=(0,p.moveToCellSequence)(I[0]-1,I[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const z=this._model.finalSelectionStart,M=this._model.finalSelectionEnd,I=!(!z||!M||z[0]===M[0]&&z[1]===M[1]);I?z&&M&&(this._oldSelectionStart&&this._oldSelectionEnd&&z[0]===this._oldSelectionStart[0]&&z[1]===this._oldSelectionStart[1]&&M[0]===this._oldSelectionEnd[0]&&M[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(z,M,I)):this._oldHasSelection&&this._fireOnSelectionChange(z,M,I)}_fireOnSelectionChange(z,M,I){this._oldSelectionStart=z,this._oldSelectionEnd=M,this._oldHasSelection=I,this._onSelectionChange.fire()}_handleBufferActivate(z){this.clearSelection(),this._trimListener.dispose(),this._trimListener=z.activeBuffer.lines.onTrim((M=>this._handleTrim(M)))}_convertViewportColToCharacterIndex(z,M){let I=M;for(let B=0;M>=B;B++){const $=z.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?I--:$>1&&M!==B&&(I+=$-1)}return I}setSelection(z,M,I){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[z,M],this._model.selectionStartLength=I,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(z){this._isClickInSelection(z)||(this._selectWordAtCursor(z,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(z,M,I=!0,B=!0){if(z[0]>=this._bufferService.cols)return;const $=this._bufferService.buffer,U=$.lines.get(z[1]);if(!U)return;const H=$.translateBufferLineToString(z[1],!1);let Y=this._convertViewportColToCharacterIndex(U,z[0]),V=Y;const X=z[0]-Y;let ee=0,O=0,L=0,F=0;if(H.charAt(Y)===" "){for(;Y>0&&H.charAt(Y-1)===" ";)Y--;for(;V1&&(F+=oe-1,V+=oe-1);re>0&&Y>0&&!this._isCharWordSeparator(U.loadCell(re-1,this._workCell));){U.loadCell(re-1,this._workCell);const te=this._workCell.getChars().length;this._workCell.getWidth()===0?(ee++,re--):te>1&&(L+=te-1,Y-=te-1),Y--,re--}for(;ce1&&(F+=te-1,V+=te-1),V++,ce++}}V++;let q=Y+X-ee+L,G=Math.min(this._bufferService.cols,V-Y+ee+O-L-F);if(M||H.slice(Y,V).trim()!==""){if(I&&q===0&&U.getCodePoint(0)!==32){const re=$.lines.get(z[1]-1);if(re&&U.isWrapped&&re.getCodePoint(this._bufferService.cols-1)!==32){const ce=this._getWordAt([this._bufferService.cols-1,z[1]-1],!1,!0,!1);if(ce){const oe=this._bufferService.cols-ce.start;q-=oe,G+=oe}}}if(B&&q+G===this._bufferService.cols&&U.getCodePoint(this._bufferService.cols-1)!==32){const re=$.lines.get(z[1]+1);if(re!=null&&re.isWrapped&&re.getCodePoint(0)!==32){const ce=this._getWordAt([0,z[1]+1],!1,!1,!0);ce&&(G+=ce.length)}}return{start:q,length:G}}}_selectWordAt(z,M){const I=this._getWordAt(z,M);if(I){for(;I.start<0;)I.start+=this._bufferService.cols,z[1]--;this._model.selectionStart=[I.start,z[1]],this._model.selectionStartLength=I.length}}_selectToWordAt(z){const M=this._getWordAt(z,!0);if(M){let I=z[1];for(;M.start<0;)M.start+=this._bufferService.cols,I--;if(!this._model.areSelectionValuesReversed())for(;M.start+M.length>this._bufferService.cols;)M.length-=this._bufferService.cols,I++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?M.start:M.start+M.length,I]}}_isCharWordSeparator(z){return z.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(z.getChars())>=0}_selectLineAt(z){const M=this._bufferService.buffer.getWrappedRangeForLine(z),I={start:{x:0,y:M.first},end:{x:this._bufferService.cols-1,y:M.last}};this._model.selectionStart=[0,M.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,w.getRangeLength)(I,this._bufferService.cols)}};o.SelectionService=T=u([_(3,C.IBufferService),_(4,C.ICoreService),_(5,x.IMouseService),_(6,C.IOptionsService),_(7,x.IRenderService),_(8,x.ICoreBrowserService)],T)},4725:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const u=l(8343);o.ICharSizeService=(0,u.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),o.IMouseService=(0,u.createDecorator)("MouseService"),o.IRenderService=(0,u.createDecorator)("RenderService"),o.ISelectionService=(0,u.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,u.createDecorator)("ThemeService"),o.ILinkProviderService=(0,u.createDecorator)("LinkProviderService")},6731:function(a,o,l){var u=this&&this.__decorate||function(T,z,M,I){var B,$=arguments.length,U=$<3?z:I===null?I=Object.getOwnPropertyDescriptor(z,M):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(T,z,M,I);else for(var H=T.length-1;H>=0;H--)(B=T[H])&&(U=($<3?B(U):$>3?B(z,M,U):B(z,M))||U);return $>3&&U&&Object.defineProperty(z,M,U),U},_=this&&this.__param||function(T,z){return function(M,I){z(M,I,T)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=l(7239),p=l(8055),m=l(8460),x=l(844),S=l(2585),v=p.css.toColor("#ffffff"),b=p.css.toColor("#000000"),w=p.css.toColor("#ffffff"),y=p.css.toColor("#000000"),C={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const T=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],z=[0,95,135,175,215,255];for(let M=0;M<216;M++){const I=z[M/36%6|0],B=z[M/6%6|0],$=z[M%6];T.push({css:p.channels.toCss(I,B,$),rgba:p.channels.toRgba(I,B,$)})}for(let M=0;M<24;M++){const I=8+10*M;T.push({css:p.channels.toCss(I,I,I),rgba:p.channels.toRgba(I,I,I)})}return T})());let E=o.ThemeService=class extends x.Disposable{get colors(){return this._colors}constructor(T){super(),this._optionsService=T,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new m.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:v,background:b,cursor:w,cursorAccent:y,selectionForeground:void 0,selectionBackgroundTransparent:C,selectionBackgroundOpaque:p.color.blend(b,C),selectionInactiveBackgroundTransparent:C,selectionInactiveBackgroundOpaque:p.color.blend(b,C),ansi:o.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(T={}){const z=this._colors;if(z.foreground=N(T.foreground,v),z.background=N(T.background,b),z.cursor=N(T.cursor,w),z.cursorAccent=N(T.cursorAccent,y),z.selectionBackgroundTransparent=N(T.selectionBackground,C),z.selectionBackgroundOpaque=p.color.blend(z.background,z.selectionBackgroundTransparent),z.selectionInactiveBackgroundTransparent=N(T.selectionInactiveBackground,z.selectionBackgroundTransparent),z.selectionInactiveBackgroundOpaque=p.color.blend(z.background,z.selectionInactiveBackgroundTransparent),z.selectionForeground=T.selectionForeground?N(T.selectionForeground,p.NULL_COLOR):void 0,z.selectionForeground===p.NULL_COLOR&&(z.selectionForeground=void 0),p.color.isOpaque(z.selectionBackgroundTransparent)&&(z.selectionBackgroundTransparent=p.color.opacity(z.selectionBackgroundTransparent,.3)),p.color.isOpaque(z.selectionInactiveBackgroundTransparent)&&(z.selectionInactiveBackgroundTransparent=p.color.opacity(z.selectionInactiveBackgroundTransparent,.3)),z.ansi=o.DEFAULT_ANSI_COLORS.slice(),z.ansi[0]=N(T.black,o.DEFAULT_ANSI_COLORS[0]),z.ansi[1]=N(T.red,o.DEFAULT_ANSI_COLORS[1]),z.ansi[2]=N(T.green,o.DEFAULT_ANSI_COLORS[2]),z.ansi[3]=N(T.yellow,o.DEFAULT_ANSI_COLORS[3]),z.ansi[4]=N(T.blue,o.DEFAULT_ANSI_COLORS[4]),z.ansi[5]=N(T.magenta,o.DEFAULT_ANSI_COLORS[5]),z.ansi[6]=N(T.cyan,o.DEFAULT_ANSI_COLORS[6]),z.ansi[7]=N(T.white,o.DEFAULT_ANSI_COLORS[7]),z.ansi[8]=N(T.brightBlack,o.DEFAULT_ANSI_COLORS[8]),z.ansi[9]=N(T.brightRed,o.DEFAULT_ANSI_COLORS[9]),z.ansi[10]=N(T.brightGreen,o.DEFAULT_ANSI_COLORS[10]),z.ansi[11]=N(T.brightYellow,o.DEFAULT_ANSI_COLORS[11]),z.ansi[12]=N(T.brightBlue,o.DEFAULT_ANSI_COLORS[12]),z.ansi[13]=N(T.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),z.ansi[14]=N(T.brightCyan,o.DEFAULT_ANSI_COLORS[14]),z.ansi[15]=N(T.brightWhite,o.DEFAULT_ANSI_COLORS[15]),T.extendedAnsi){const M=Math.min(z.ansi.length-16,T.extendedAnsi.length);for(let I=0;I{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const u=l(8460),_=l(844);class d extends _.Disposable{constructor(m){super(),this._maxLength=m,this.onDeleteEmitter=this.register(new u.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new u.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new u.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(m){if(this._maxLength===m)return;const x=new Array(m);for(let S=0;Sthis._length)for(let x=this._length;x=m;v--)this._array[this._getCyclicIndex(v+S.length)]=this._array[this._getCyclicIndex(v)];for(let v=0;vthis._maxLength){const v=this._length+S.length-this._maxLength;this._startIndex+=v,this._length=this._maxLength,this.onTrimEmitter.fire(v)}else this._length+=S.length}trimStart(m){m>this._length&&(m=this._length),this._startIndex+=m,this._length-=m,this.onTrimEmitter.fire(m)}shiftElements(m,x,S){if(!(x<=0)){if(m<0||m>=this._length)throw new Error("start argument out of range");if(m+S<0)throw new Error("Cannot shift elements in list beyond index 0");if(S>0){for(let b=x-1;b>=0;b--)this.set(m+b+S,this.get(m+b));const v=m+x+S-this._length;if(v>0)for(this._length+=v;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let v=0;v{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function l(u,_=5){if(typeof u!="object")return u;const d=Array.isArray(u)?[]:{};for(const p in u)d[p]=_<=1?u[p]:u[p]&&l(u[p],_-1);return d}},8055:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let l=0,u=0,_=0,d=0;var p,m,x,S,v;function b(y){const C=y.toString(16);return C.length<2?"0"+C:C}function w(y,C){return y>>0},y.toColor=function(C,E,N,T){return{css:y.toCss(C,E,N,T),rgba:y.toRgba(C,E,N,T)}}})(p||(o.channels=p={})),(function(y){function C(E,N){return d=Math.round(255*N),[l,u,_]=v.toChannels(E.rgba),{css:p.toCss(l,u,_,d),rgba:p.toRgba(l,u,_,d)}}y.blend=function(E,N){if(d=(255&N.rgba)/255,d===1)return{css:N.css,rgba:N.rgba};const T=N.rgba>>24&255,z=N.rgba>>16&255,M=N.rgba>>8&255,I=E.rgba>>24&255,B=E.rgba>>16&255,$=E.rgba>>8&255;return l=I+Math.round((T-I)*d),u=B+Math.round((z-B)*d),_=$+Math.round((M-$)*d),{css:p.toCss(l,u,_),rgba:p.toRgba(l,u,_)}},y.isOpaque=function(E){return(255&E.rgba)==255},y.ensureContrastRatio=function(E,N,T){const z=v.ensureContrastRatio(E.rgba,N.rgba,T);if(z)return p.toColor(z>>24&255,z>>16&255,z>>8&255)},y.opaque=function(E){const N=(255|E.rgba)>>>0;return[l,u,_]=v.toChannels(N),{css:p.toCss(l,u,_),rgba:N}},y.opacity=C,y.multiplyOpacity=function(E,N){return d=255&E.rgba,C(E,d*N/255)},y.toColorRGB=function(E){return[E.rgba>>24&255,E.rgba>>16&255,E.rgba>>8&255]}})(m||(o.color=m={})),(function(y){let C,E;try{const N=document.createElement("canvas");N.width=1,N.height=1;const T=N.getContext("2d",{willReadFrequently:!0});T&&(C=T,C.globalCompositeOperation="copy",E=C.createLinearGradient(0,0,1,1))}catch{}y.toColor=function(N){if(N.match(/#[\da-f]{3,8}/i))switch(N.length){case 4:return l=parseInt(N.slice(1,2).repeat(2),16),u=parseInt(N.slice(2,3).repeat(2),16),_=parseInt(N.slice(3,4).repeat(2),16),p.toColor(l,u,_);case 5:return l=parseInt(N.slice(1,2).repeat(2),16),u=parseInt(N.slice(2,3).repeat(2),16),_=parseInt(N.slice(3,4).repeat(2),16),d=parseInt(N.slice(4,5).repeat(2),16),p.toColor(l,u,_,d);case 7:return{css:N,rgba:(parseInt(N.slice(1),16)<<8|255)>>>0};case 9:return{css:N,rgba:parseInt(N.slice(1),16)>>>0}}const T=N.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(T)return l=parseInt(T[1]),u=parseInt(T[2]),_=parseInt(T[3]),d=Math.round(255*(T[5]===void 0?1:parseFloat(T[5]))),p.toColor(l,u,_,d);if(!C||!E)throw new Error("css.toColor: Unsupported css format");if(C.fillStyle=E,C.fillStyle=N,typeof C.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(C.fillRect(0,0,1,1),[l,u,_,d]=C.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:p.toRgba(l,u,_,d),css:N}}})(x||(o.css=x={})),(function(y){function C(E,N,T){const z=E/255,M=N/255,I=T/255;return .2126*(z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4))+.7152*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}y.relativeLuminance=function(E){return C(E>>16&255,E>>8&255,255&E)},y.relativeLuminance2=C})(S||(o.rgb=S={})),(function(y){function C(N,T,z){const M=N>>24&255,I=N>>16&255,B=N>>8&255;let $=T>>24&255,U=T>>16&255,H=T>>8&255,Y=w(S.relativeLuminance2($,U,H),S.relativeLuminance2(M,I,B));for(;Y0||U>0||H>0);)$-=Math.max(0,Math.ceil(.1*$)),U-=Math.max(0,Math.ceil(.1*U)),H-=Math.max(0,Math.ceil(.1*H)),Y=w(S.relativeLuminance2($,U,H),S.relativeLuminance2(M,I,B));return($<<24|U<<16|H<<8|255)>>>0}function E(N,T,z){const M=N>>24&255,I=N>>16&255,B=N>>8&255;let $=T>>24&255,U=T>>16&255,H=T>>8&255,Y=w(S.relativeLuminance2($,U,H),S.relativeLuminance2(M,I,B));for(;Y>>0}y.blend=function(N,T){if(d=(255&T)/255,d===1)return T;const z=T>>24&255,M=T>>16&255,I=T>>8&255,B=N>>24&255,$=N>>16&255,U=N>>8&255;return l=B+Math.round((z-B)*d),u=$+Math.round((M-$)*d),_=U+Math.round((I-U)*d),p.toRgba(l,u,_)},y.ensureContrastRatio=function(N,T,z){const M=S.relativeLuminance(N>>8),I=S.relativeLuminance(T>>8);if(w(M,I)>8));if(Hw(M,S.relativeLuminance(Y>>8))?U:Y}return U}const B=E(N,T,z),$=w(M,S.relativeLuminance(B>>8));if($w(M,S.relativeLuminance(U>>8))?B:U}return B}},y.reduceLuminance=C,y.increaseLuminance=E,y.toChannels=function(N){return[N>>24&255,N>>16&255,N>>8&255,255&N]}})(v||(o.rgba=v={})),o.toPaddedHex=b,o.contrastRatio=w},8969:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const u=l(844),_=l(2585),d=l(4348),p=l(7866),m=l(744),x=l(7302),S=l(6975),v=l(8460),b=l(1753),w=l(1480),y=l(7994),C=l(9282),E=l(5435),N=l(5981),T=l(2660);let z=!1;class M extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new v.EventEmitter),this._onScroll.event((B=>{var $;($=this._onScrollApi)==null||$.fire(B.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(B){for(const $ in B)this.optionsService.options[$]=B[$]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new v.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new v.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new v.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new x.OptionsService(B)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(m.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(S.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(w.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(y.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(T.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new E.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,v.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,v.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,v.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,v.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll(($=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll(($=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new N.WriteBuffer((($,U)=>this._inputHandler.parse($,U)))),this.register((0,v.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,$){this._writeBuffer.write(B,$)}writeSync(B,$){this._logService.logLevel<=_.LogLevelEnum.WARN&&!z&&(this._logService.warn("writeSync is unreliable and will be removed soon."),z=!0),this._writeBuffer.writeSync(B,$)}input(B,$=!0){this.coreService.triggerDataEvent(B,$)}resize(B,$){isNaN(B)||isNaN($)||(B=Math.max(B,m.MINIMUM_COLS),$=Math.max($,m.MINIMUM_ROWS),this._bufferService.resize(B,$))}scroll(B,$=!1){this._bufferService.scroll(B,$)}scrollLines(B,$,U){this._bufferService.scrollLines(B,$,U)}scrollPages(B){this.scrollLines(B*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(B){const $=B-this._bufferService.buffer.ydisp;$!==0&&this.scrollLines($)}registerEscHandler(B,$){return this._inputHandler.registerEscHandler(B,$)}registerDcsHandler(B,$){return this._inputHandler.registerDcsHandler(B,$)}registerCsiHandler(B,$){return this._inputHandler.registerCsiHandler(B,$)}registerOscHandler(B,$){return this._inputHandler.registerOscHandler(B,$)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const $=this.optionsService.rawOptions.windowsPty;$&&$.buildNumber!==void 0&&$.buildNumber!==void 0?B=$.backend==="conpty"&&$.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(B=!0),B?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const B=[];B.push(this.onLineFeed(C.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},(()=>((0,C.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const $ of B)$.dispose()}))}}}o.CoreTerminal=M},8460:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let u=0;uu.fire(_)))},o.runAndSubscribe=function(l,u){return u(void 0),l((_=>u(_)))}},5435:function(a,o,l){var u=this&&this.__decorate||function(ee,O,L,F){var q,G=arguments.length,re=G<3?O:F===null?F=Object.getOwnPropertyDescriptor(O,L):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")re=Reflect.decorate(ee,O,L,F);else for(var ce=ee.length-1;ce>=0;ce--)(q=ee[ce])&&(re=(G<3?q(re):G>3?q(O,L,re):q(O,L))||re);return G>3&&re&&Object.defineProperty(O,L,re),re},_=this&&this.__param||function(ee,O){return function(L,F){O(L,F,ee)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=l(2584),p=l(7116),m=l(2015),x=l(844),S=l(482),v=l(8437),b=l(8460),w=l(643),y=l(511),C=l(3734),E=l(2585),N=l(1480),T=l(6242),z=l(6351),M=l(5941),I={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function $(ee,O){if(ee>24)return O.setWinLines||!1;switch(ee){case 1:return!!O.restoreWin;case 2:return!!O.minimizeWin;case 3:return!!O.setWinPosition;case 4:return!!O.setWinSizePixels;case 5:return!!O.raiseWin;case 6:return!!O.lowerWin;case 7:return!!O.refreshWin;case 8:return!!O.setWinSizeChars;case 9:return!!O.maximizeWin;case 10:return!!O.fullscreenWin;case 11:return!!O.getWinState;case 13:return!!O.getWinPosition;case 14:return!!O.getWinSizePixels;case 15:return!!O.getScreenSizePixels;case 16:return!!O.getCellSizePixels;case 18:return!!O.getWinSizeChars;case 19:return!!O.getScreenSizeChars;case 20:return!!O.getIconTitle;case 21:return!!O.getWinTitle;case 22:return!!O.pushTitle;case 23:return!!O.popTitle;case 24:return!!O.setWinLines}return!1}var U;(function(ee){ee[ee.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ee[ee.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(U||(o.WindowsOptionsReportType=U={}));let H=0;class Y extends x.Disposable{getAttrData(){return this._curAttrData}constructor(O,L,F,q,G,re,ce,oe,te=new m.EscapeSequenceParser){super(),this._bufferService=O,this._charsetService=L,this._coreService=F,this._logService=q,this._optionsService=G,this._oscLinkService=re,this._coreMouseService=ce,this._unicodeService=oe,this._parser=te,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new S.StringToUtf32,this._utf8Decoder=new S.Utf8ToUtf32,this._workCell=new y.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new b.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new b.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new b.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new b.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new b.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new b.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new b.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new b.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new b.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new b.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new V(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((Q=>this._activeBuffer=Q.activeBuffer))),this._parser.setCsiHandlerFallback(((Q,le)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(Q),params:le.toArray()})})),this._parser.setEscHandlerFallback((Q=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(Q)})})),this._parser.setExecuteHandlerFallback((Q=>{this._logService.debug("Unknown EXECUTE code: ",{code:Q})})),this._parser.setOscHandlerFallback(((Q,le,ae)=>{this._logService.debug("Unknown OSC code: ",{identifier:Q,action:le,data:ae})})),this._parser.setDcsHandlerFallback(((Q,le,ae)=>{le==="HOOK"&&(ae=ae.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(Q),action:le,payload:ae})})),this._parser.setPrintHandler(((Q,le,ae)=>this.print(Q,le,ae))),this._parser.registerCsiHandler({final:"@"},(Q=>this.insertChars(Q))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(Q=>this.scrollLeft(Q))),this._parser.registerCsiHandler({final:"A"},(Q=>this.cursorUp(Q))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(Q=>this.scrollRight(Q))),this._parser.registerCsiHandler({final:"B"},(Q=>this.cursorDown(Q))),this._parser.registerCsiHandler({final:"C"},(Q=>this.cursorForward(Q))),this._parser.registerCsiHandler({final:"D"},(Q=>this.cursorBackward(Q))),this._parser.registerCsiHandler({final:"E"},(Q=>this.cursorNextLine(Q))),this._parser.registerCsiHandler({final:"F"},(Q=>this.cursorPrecedingLine(Q))),this._parser.registerCsiHandler({final:"G"},(Q=>this.cursorCharAbsolute(Q))),this._parser.registerCsiHandler({final:"H"},(Q=>this.cursorPosition(Q))),this._parser.registerCsiHandler({final:"I"},(Q=>this.cursorForwardTab(Q))),this._parser.registerCsiHandler({final:"J"},(Q=>this.eraseInDisplay(Q,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(Q=>this.eraseInDisplay(Q,!0))),this._parser.registerCsiHandler({final:"K"},(Q=>this.eraseInLine(Q,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(Q=>this.eraseInLine(Q,!0))),this._parser.registerCsiHandler({final:"L"},(Q=>this.insertLines(Q))),this._parser.registerCsiHandler({final:"M"},(Q=>this.deleteLines(Q))),this._parser.registerCsiHandler({final:"P"},(Q=>this.deleteChars(Q))),this._parser.registerCsiHandler({final:"S"},(Q=>this.scrollUp(Q))),this._parser.registerCsiHandler({final:"T"},(Q=>this.scrollDown(Q))),this._parser.registerCsiHandler({final:"X"},(Q=>this.eraseChars(Q))),this._parser.registerCsiHandler({final:"Z"},(Q=>this.cursorBackwardTab(Q))),this._parser.registerCsiHandler({final:"`"},(Q=>this.charPosAbsolute(Q))),this._parser.registerCsiHandler({final:"a"},(Q=>this.hPositionRelative(Q))),this._parser.registerCsiHandler({final:"b"},(Q=>this.repeatPrecedingCharacter(Q))),this._parser.registerCsiHandler({final:"c"},(Q=>this.sendDeviceAttributesPrimary(Q))),this._parser.registerCsiHandler({prefix:">",final:"c"},(Q=>this.sendDeviceAttributesSecondary(Q))),this._parser.registerCsiHandler({final:"d"},(Q=>this.linePosAbsolute(Q))),this._parser.registerCsiHandler({final:"e"},(Q=>this.vPositionRelative(Q))),this._parser.registerCsiHandler({final:"f"},(Q=>this.hVPosition(Q))),this._parser.registerCsiHandler({final:"g"},(Q=>this.tabClear(Q))),this._parser.registerCsiHandler({final:"h"},(Q=>this.setMode(Q))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(Q=>this.setModePrivate(Q))),this._parser.registerCsiHandler({final:"l"},(Q=>this.resetMode(Q))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(Q=>this.resetModePrivate(Q))),this._parser.registerCsiHandler({final:"m"},(Q=>this.charAttributes(Q))),this._parser.registerCsiHandler({final:"n"},(Q=>this.deviceStatus(Q))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(Q=>this.deviceStatusPrivate(Q))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(Q=>this.softReset(Q))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(Q=>this.setCursorStyle(Q))),this._parser.registerCsiHandler({final:"r"},(Q=>this.setScrollRegion(Q))),this._parser.registerCsiHandler({final:"s"},(Q=>this.saveCursor(Q))),this._parser.registerCsiHandler({final:"t"},(Q=>this.windowOptions(Q))),this._parser.registerCsiHandler({final:"u"},(Q=>this.restoreCursor(Q))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(Q=>this.insertColumns(Q))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(Q=>this.deleteColumns(Q))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(Q=>this.selectProtected(Q))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(Q=>this.requestMode(Q,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(Q=>this.requestMode(Q,!1))),this._parser.setExecuteHandler(d.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(d.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(d.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(d.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(d.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(d.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(d.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(d.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(d.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new T.OscHandler((Q=>(this.setTitle(Q),this.setIconName(Q),!0)))),this._parser.registerOscHandler(1,new T.OscHandler((Q=>this.setIconName(Q)))),this._parser.registerOscHandler(2,new T.OscHandler((Q=>this.setTitle(Q)))),this._parser.registerOscHandler(4,new T.OscHandler((Q=>this.setOrReportIndexedColor(Q)))),this._parser.registerOscHandler(8,new T.OscHandler((Q=>this.setHyperlink(Q)))),this._parser.registerOscHandler(10,new T.OscHandler((Q=>this.setOrReportFgColor(Q)))),this._parser.registerOscHandler(11,new T.OscHandler((Q=>this.setOrReportBgColor(Q)))),this._parser.registerOscHandler(12,new T.OscHandler((Q=>this.setOrReportCursorColor(Q)))),this._parser.registerOscHandler(104,new T.OscHandler((Q=>this.restoreIndexedColor(Q)))),this._parser.registerOscHandler(110,new T.OscHandler((Q=>this.restoreFgColor(Q)))),this._parser.registerOscHandler(111,new T.OscHandler((Q=>this.restoreBgColor(Q)))),this._parser.registerOscHandler(112,new T.OscHandler((Q=>this.restoreCursorColor(Q)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const Q in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:Q},(()=>this.selectCharset("("+Q))),this._parser.registerEscHandler({intermediates:")",final:Q},(()=>this.selectCharset(")"+Q))),this._parser.registerEscHandler({intermediates:"*",final:Q},(()=>this.selectCharset("*"+Q))),this._parser.registerEscHandler({intermediates:"+",final:Q},(()=>this.selectCharset("+"+Q))),this._parser.registerEscHandler({intermediates:"-",final:Q},(()=>this.selectCharset("-"+Q))),this._parser.registerEscHandler({intermediates:".",final:Q},(()=>this.selectCharset("."+Q))),this._parser.registerEscHandler({intermediates:"/",final:Q},(()=>this.selectCharset("/"+Q)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((Q=>(this._logService.error("Parsing error: ",Q),Q))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new z.DcsHandler(((Q,le)=>this.requestStatusString(Q,le))))}_preserveStack(O,L,F,q){this._parseStack.paused=!0,this._parseStack.cursorStartX=O,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=F,this._parseStack.position=q}_logSlowResolvingAsync(O){this._logService.logLevel<=E.LogLevelEnum.WARN&&Promise.race([O,new Promise(((L,F)=>setTimeout((()=>F("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(O,L){let F,q=this._activeBuffer.x,G=this._activeBuffer.y,re=0;const ce=this._parseStack.paused;if(ce){if(F=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(F),F;q=this._parseStack.cursorStartX,G=this._parseStack.cursorStartY,this._parseStack.paused=!1,O.length>B&&(re=this._parseStack.position+B)}if(this._logService.logLevel<=E.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof O=="string"?` "${O}"`:` "${Array.prototype.map.call(O,(Q=>String.fromCharCode(Q))).join("")}"`),typeof O=="string"?O.split("").map((Q=>Q.charCodeAt(0))):O),this._parseBuffer.lengthB)for(let Q=re;Q0&&ae.getWidth(this._activeBuffer.x-1)===2&&ae.setCellFromCodepoint(this._activeBuffer.x-1,0,1,le);let de=this._parser.precedingJoinState;for(let pe=L;peoe){if(te){const Be=ae;let ze=this._activeBuffer.x-Pe;for(this._activeBuffer.x=Pe,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),ae=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Pe>0&&ae instanceof v.BufferLine&&ae.copyCellsFrom(Be,ze,0,Pe,!1);ze=0;)ae.setCellFromCodepoint(this._activeBuffer.x++,0,0,le)}else if(Q&&(ae.insertCells(this._activeBuffer.x,G-Pe,this._activeBuffer.getNullCell(le)),ae.getWidth(oe-1)===2&&ae.setCellFromCodepoint(oe-1,w.NULL_CELL_CODE,w.NULL_CELL_WIDTH,le)),ae.setCellFromCodepoint(this._activeBuffer.x++,q,G,le),G>0)for(;--G;)ae.setCellFromCodepoint(this._activeBuffer.x++,0,0,le)}this._parser.precedingJoinState=de,this._activeBuffer.x0&&ae.getWidth(this._activeBuffer.x)===0&&!ae.hasContent(this._activeBuffer.x)&&ae.setCellFromCodepoint(this._activeBuffer.x,0,1,le),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(O,L){return O.final!=="t"||O.prefix||O.intermediates?this._parser.registerCsiHandler(O,L):this._parser.registerCsiHandler(O,(F=>!$(F.params[0],this._optionsService.rawOptions.windowOptions)||L(F)))}registerDcsHandler(O,L){return this._parser.registerDcsHandler(O,new z.DcsHandler(L))}registerEscHandler(O,L){return this._parser.registerEscHandler(O,L)}registerOscHandler(O,L){return this._parser.registerOscHandler(O,new T.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var O;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&O.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const O=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-O),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(O=this._bufferService.cols-1){this._activeBuffer.x=Math.min(O,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(O,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=O,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=O,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(O,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+O,this._activeBuffer.y+L)}cursorUp(O){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,O.params[0]||1)):this._moveCursor(0,-(O.params[0]||1)),!0}cursorDown(O){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,O.params[0]||1)):this._moveCursor(0,O.params[0]||1),!0}cursorForward(O){return this._moveCursor(O.params[0]||1,0),!0}cursorBackward(O){return this._moveCursor(-(O.params[0]||1),0),!0}cursorNextLine(O){return this.cursorDown(O),this._activeBuffer.x=0,!0}cursorPrecedingLine(O){return this.cursorUp(O),this._activeBuffer.x=0,!0}cursorCharAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(O){return this._setCursor(O.length>=2?(O.params[1]||1)-1:0,(O.params[0]||1)-1),!0}charPosAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(O){return this._moveCursor(O.params[0]||1,0),!0}linePosAbsolute(O){return this._setCursor(this._activeBuffer.x,(O.params[0]||1)-1),!0}vPositionRelative(O){return this._moveCursor(0,O.params[0]||1),!0}hVPosition(O){return this.cursorPosition(O),!0}tabClear(O){const L=O.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=O.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=O.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(O){const L=O.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(O,L,F,q=!1,G=!1){const re=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);re.replaceCells(L,F,this._activeBuffer.getNullCell(this._eraseAttrData()),G),q&&(re.isWrapped=!1)}_resetBufferLine(O,L=!1){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);F&&(F.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+O),F.isWrapped=!1)}eraseInDisplay(O,L=!1){let F;switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:for(F=this._activeBuffer.y,this._dirtyRowTracker.markDirty(F),this._eraseInBufferLine(F++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);F=this._bufferService.cols&&(this._activeBuffer.lines.get(F+1).isWrapped=!1);F--;)this._resetBufferLine(F,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(F=this._bufferService.rows,this._dirtyRowTracker.markDirty(F-1);F--;)this._resetBufferLine(F,L);this._dirtyRowTracker.markDirty(0);break;case 3:const q=this._activeBuffer.lines.length-this._bufferService.rows;q>0&&(this._activeBuffer.lines.trimStart(q),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-q,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-q,0),this._onScroll.fire(0))}return!0}eraseInLine(O,L=!1){switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(O){this._restrictCursor();let L=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let te=oe;for(let Q=1;Q0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(O){return O.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(O.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(O){return(this._optionsService.rawOptions.termName+"").indexOf(O)===0}setMode(O){for(let L=0;Lbe?1:2,de=O.params[0];return pe=de,we=L?de===2?4:de===4?ae(re.modes.insertMode):de===12?3:de===20?ae(le.convertEol):0:de===1?ae(F.applicationCursorKeys):de===3?le.windowOptions.setWinLines?oe===80?2:oe===132?1:0:0:de===6?ae(F.origin):de===7?ae(F.wraparound):de===8?3:de===9?ae(q==="X10"):de===12?ae(le.cursorBlink):de===25?ae(!re.isCursorHidden):de===45?ae(F.reverseWraparound):de===66?ae(F.applicationKeypad):de===67?4:de===1e3?ae(q==="VT200"):de===1002?ae(q==="DRAG"):de===1003?ae(q==="ANY"):de===1004?ae(F.sendFocus):de===1005?4:de===1006?ae(G==="SGR"):de===1015?4:de===1016?ae(G==="SGR_PIXELS"):de===1048?1:de===47||de===1047||de===1049?ae(te===Q):de===2004?ae(F.bracketedPasteMode):0,re.triggerDataEvent(`${d.C0.ESC}[${L?"":"?"}${pe};${we}$y`),!0;var pe,we}_updateAttrColor(O,L,F,q,G){return L===2?(O|=50331648,O&=-16777216,O|=C.AttributeData.fromColorRGB([F,q,G])):L===5&&(O&=-50331904,O|=33554432|255&F),O}_extractColor(O,L,F){const q=[0,0,-1,0,0,0];let G=0,re=0;do{if(q[re+G]=O.params[L+re],O.hasSubParams(L+re)){const ce=O.getSubParams(L+re);let oe=0;do q[1]===5&&(G=1),q[re+oe+1+G]=ce[oe];while(++oe=2||q[1]===2&&re+G>=5)break;q[1]&&(G=1)}while(++re+L5)&&(O=1),L.extended.underlineStyle=O,L.fg|=268435456,O===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(O){O.fg=v.DEFAULT_ATTR_DATA.fg,O.bg=v.DEFAULT_ATTR_DATA.bg,O.extended=O.extended.clone(),O.extended.underlineStyle=0,O.extended.underlineColor&=-67108864,O.updateExtended()}charAttributes(O){if(O.length===1&&O.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=O.length;let F;const q=this._curAttrData;for(let G=0;G=30&&F<=37?(q.fg&=-50331904,q.fg|=16777216|F-30):F>=40&&F<=47?(q.bg&=-50331904,q.bg|=16777216|F-40):F>=90&&F<=97?(q.fg&=-50331904,q.fg|=16777224|F-90):F>=100&&F<=107?(q.bg&=-50331904,q.bg|=16777224|F-100):F===0?this._processSGR0(q):F===1?q.fg|=134217728:F===3?q.bg|=67108864:F===4?(q.fg|=268435456,this._processUnderline(O.hasSubParams(G)?O.getSubParams(G)[0]:1,q)):F===5?q.fg|=536870912:F===7?q.fg|=67108864:F===8?q.fg|=1073741824:F===9?q.fg|=2147483648:F===2?q.bg|=134217728:F===21?this._processUnderline(2,q):F===22?(q.fg&=-134217729,q.bg&=-134217729):F===23?q.bg&=-67108865:F===24?(q.fg&=-268435457,this._processUnderline(0,q)):F===25?q.fg&=-536870913:F===27?q.fg&=-67108865:F===28?q.fg&=-1073741825:F===29?q.fg&=2147483647:F===39?(q.fg&=-67108864,q.fg|=16777215&v.DEFAULT_ATTR_DATA.fg):F===49?(q.bg&=-67108864,q.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):F===38||F===48||F===58?G+=this._extractColor(O,G,q):F===53?q.bg|=1073741824:F===55?q.bg&=-1073741825:F===59?(q.extended=q.extended.clone(),q.extended.underlineColor=-1,q.updateExtended()):F===100?(q.fg&=-67108864,q.fg|=16777215&v.DEFAULT_ATTR_DATA.fg,q.bg&=-67108864,q.bg|=16777215&v.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",F);return!0}deviceStatus(O){switch(O.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,F=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${L};${F}R`)}return!0}deviceStatusPrivate(O){if(O.params[0]===6){const L=this._activeBuffer.y+1,F=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${L};${F}R`)}return!0}softReset(O){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(O){const L=O.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const F=L%2==1;return this._optionsService.options.cursorBlink=F,!0}setScrollRegion(O){const L=O.params[0]||1;let F;return(O.length<2||(F=O.params[1])>this._bufferService.rows||F===0)&&(F=this._bufferService.rows),F>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=F-1,this._setCursor(0,0)),!0}windowOptions(O){if(!$(O.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=O.length>1?O.params[1]:0;switch(O.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(U.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(U.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(O){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(O){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(O){return this._windowTitle=O,this._onTitleChange.fire(O),!0}setIconName(O){return this._iconName=O,!0}setOrReportIndexedColor(O){const L=[],F=O.split(";");for(;F.length>1;){const q=F.shift(),G=F.shift();if(/^\d+$/.exec(q)){const re=parseInt(q);if(X(re))if(G==="?")L.push({type:0,index:re});else{const ce=(0,M.parseColor)(G);ce&&L.push({type:1,index:re,color:ce})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(O){const L=O.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(O,L){this._getCurrentLinkId()&&this._finishHyperlink();const F=O.split(":");let q;const G=F.findIndex((re=>re.startsWith("id=")));return G!==-1&&(q=F[G].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:q,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(O,L){const F=O.split(";");for(let q=0;q=this._specialColors.length);++q,++L)if(F[q]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const G=(0,M.parseColor)(F[q]);G&&this._onColor.fire([{type:1,index:this._specialColors[L],color:G}])}return!0}setOrReportFgColor(O){return this._setOrReportSpecialColor(O,0)}setOrReportBgColor(O){return this._setOrReportSpecialColor(O,1)}setOrReportCursorColor(O){return this._setOrReportSpecialColor(O,2)}restoreIndexedColor(O){if(!O)return this._onColor.fire([{type:2}]),!0;const L=[],F=O.split(";");for(let q=0;q=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const O=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,O,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=v.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=v.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(O){return this._charsetService.setgLevel(O),!0}screenAlignmentPattern(){const O=new y.CellData;O.content=4194373,O.fg=this._curAttrData.fg,O.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L(this._coreService.triggerDataEvent(`${d.C0.ESC}${G}${d.C0.ESC}\\`),!0))(O==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:O==='"p'?'P1$r61;1"p':O==="r"?`P1$r${F.scrollTop+1};${F.scrollBottom+1}r`:O==="m"?"P1$r0m":O===" q"?`P1$r${{block:2,underline:4,bar:6}[q.cursorStyle]-(q.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(O,L){this._dirtyRowTracker.markRangeDirty(O,L)}}o.InputHandler=Y;let V=class{constructor(ee){this._bufferService=ee,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(ee){eethis.end&&(this.end=ee)}markRangeDirty(ee,O){ee>O&&(H=ee,ee=O,O=H),eethis.end&&(this.end=O)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(ee){return 0<=ee&&ee<256}V=u([_(0,E.IBufferService)],V)},844:(a,o)=>{function l(u){for(const _ of u)_.dispose();u.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const _=this._disposables.indexOf(u);_!==-1&&this._disposables.splice(_,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var _;this._isDisposed||u===this._value||((_=this._value)==null||_.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){var u;this._isDisposed=!0,(u=this._value)==null||u.dispose(),this._value=void 0}},o.toDisposable=function(u){return{dispose:u}},o.disposeArray=l,o.getDisposeArrayDisposable=function(u){return{dispose:()=>l(u)}}},1505:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(_,d,p){this._data[_]||(this._data[_]={}),this._data[_][d]=p}get(_,d){return this._data[_]?this._data[_][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=l,o.FourKeyMap=class{constructor(){this._data=new l}set(u,_,d,p,m){this._data.get(u,_)||this._data.set(u,_,new l),this._data.get(u,_).set(d,p,m)}get(u,_,d,p){var m;return(m=this._data.get(u,_))==null?void 0:m.get(d,p)}clear(){this._data.clear()}}},6114:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const l=o.isNode?"node":navigator.userAgent,u=o.isNode?"node":navigator.platform;o.isFirefox=l.includes("Firefox"),o.isLegacyEdge=l.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(l),o.getSafariVersion=function(){if(!o.isSafari)return 0;const _=l.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),o.isIpad=u==="iPad",o.isIphone=u==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),o.isLinux=u.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(l)},6106:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let l=0;o.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(l=this._search(this._getKey(u)),this._array.splice(l,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const _=this._getKey(u);if(_===void 0||(l=this._search(_),l===-1)||this._getKey(this._array[l])!==_)return!1;do if(this._array[l]===u)return this._array.splice(l,1),!0;while(++l=this._array.length)&&this._getKey(this._array[l])===u))do yield this._array[l];while(++l=this._array.length)&&this._getKey(this._array[l])===u))do _(this._array[l]);while(++l=_;){let p=_+d>>1;const m=this._getKey(this._array[p]);if(m>u)d=p-1;else{if(!(m0&&this._getKey(this._array[p-1])===u;)p--;return p}_=p+1}}return _}}},7226:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const u=l(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(m){this._tasks.push(m),this._start()}flush(){for(;this._ib)return v-x<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(v-x))}ms`),void this._start();v=b}this.clear()}}class d extends _{_requestCallback(m){return setTimeout((()=>m(this._createDeadline(16))))}_cancelCallback(m){clearTimeout(m)}_createDeadline(m){const x=Date.now()+m;return{timeRemaining:()=>Math.max(0,x-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const u=l(643);o.updateWindowsModeWrappedState=function(_){const d=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),p=d==null?void 0:d.get(_.cols-1),m=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);m&&p&&(m.isWrapped=p[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&p[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new l;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}o.AttributeData=l;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,p=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=p}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=u},9092:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const u=l(6349),_=l(7226),d=l(3734),p=l(8437),m=l(4634),x=l(511),S=l(643),v=l(4863),b=l(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(w,y,C){this._hasScrollback=w,this._optionsService=y,this._bufferService=C,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=x.CellData.fromCharData([0,S.NULL_CELL_CHAR,S.NULL_CELL_WIDTH,S.NULL_CELL_CODE]),this._whitespaceCell=x.CellData.fromCharData([0,S.WHITESPACE_CELL_CHAR,S.WHITESPACE_CELL_WIDTH,S.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(w){return w?(this._nullCell.fg=w.fg,this._nullCell.bg=w.bg,this._nullCell.extended=w.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(w){return w?(this._whitespaceCell.fg=w.fg,this._whitespaceCell.bg=w.bg,this._whitespaceCell.extended=w.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(w,y){return new p.BufferLine(this._bufferService.cols,this.getNullCell(w),y)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const w=this.ybase+this.y-this.ydisp;return w>=0&&wo.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:y}fillViewportRows(w){if(this.lines.length===0){w===void 0&&(w=p.DEFAULT_ATTR_DATA);let y=this._rows;for(;y--;)this.lines.push(this.getBlankLine(w))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(w,y){const C=this.getNullCell(p.DEFAULT_ATTR_DATA);let E=0;const N=this._getCorrectBufferLength(y);if(N>this.lines.maxLength&&(this.lines.maxLength=N),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+T+1?(this.ybase--,T++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(w,C)));else for(let z=this._rows;z>y;z--)this.lines.length>y+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(N0&&(this.lines.trimStart(z),this.ybase=Math.max(this.ybase-z,0),this.ydisp=Math.max(this.ydisp-z,0),this.savedY=Math.max(this.savedY-z,0)),this.lines.maxLength=N}this.x=Math.min(this.x,w-1),this.y=Math.min(this.y,y-1),T&&(this.y+=T),this.savedX=Math.min(this.savedX,w-1),this.scrollTop=0}if(this.scrollBottom=y-1,this._isReflowEnabled&&(this._reflow(w,y),this._cols>w))for(let T=0;T.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let w=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,w=!1);let y=0;for(;this._memoryCleanupPosition100)return!0;return w}get _isReflowEnabled(){const w=this._optionsService.rawOptions.windowsPty;return w&&w.buildNumber?this._hasScrollback&&w.backend==="conpty"&&w.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(w,y){this._cols!==w&&(w>this._cols?this._reflowLarger(w,y):this._reflowSmaller(w,y))}_reflowLarger(w,y){const C=(0,m.reflowLargerGetLinesToRemove)(this.lines,this._cols,w,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(C.length>0){const E=(0,m.reflowLargerCreateNewLayout)(this.lines,C);(0,m.reflowLargerApplyNewLayout)(this.lines,E.layout),this._reflowLargerAdjustViewport(w,y,E.countRemoved)}}_reflowLargerAdjustViewport(w,y,C){const E=this.getNullCell(p.DEFAULT_ATTR_DATA);let N=C;for(;N-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;T--){let z=this.lines.get(T);if(!z||!z.isWrapped&&z.getTrimmedLength()<=w)continue;const M=[z];for(;z.isWrapped&&T>0;)z=this.lines.get(--T),M.unshift(z);const I=this.ybase+this.y;if(I>=T&&I0&&(E.push({start:T+M.length+N,newLines:Y}),N+=Y.length),M.push(...Y);let V=$.length-1,X=$[V];X===0&&(V--,X=$[V]);let ee=M.length-U-1,O=B;for(;ee>=0;){const F=Math.min(O,X);if(M[V]===void 0)break;if(M[V].copyCellsFrom(M[ee],O-F,X-F,F,!0),X-=F,X===0&&(V--,X=$[V]),O-=F,O===0){ee--;const q=Math.max(ee,0);O=(0,m.getWrappedLineTrimmedLength)(M,q,this._cols)}}for(let F=0;F0;)this.ybase===0?this.y0){const T=[],z=[];for(let V=0;V=0;V--)if($&&$.start>I+U){for(let X=$.newLines.length-1;X>=0;X--)this.lines.set(V--,$.newLines[X]);V++,T.push({index:I+1,amount:$.newLines.length}),U+=$.newLines.length,$=E[++B]}else this.lines.set(V,z[I--]);let H=0;for(let V=T.length-1;V>=0;V--)T[V].index+=H,this.lines.onInsertEmitter.fire(T[V]),H+=T[V].amount;const Y=Math.max(0,M+N-this.lines.maxLength);Y>0&&this.lines.onTrimEmitter.fire(Y)}}translateBufferLineToString(w,y,C=0,E){const N=this.lines.get(w);return N?N.translateToString(y,C,E):""}getWrappedRangeForLine(w){let y=w,C=w;for(;y>0&&this.lines.get(y).isWrapped;)y--;for(;C+10;);return w>=this._cols?this._cols-1:w<0?0:w}nextStop(w){for(w==null&&(w=this.x);!this.tabs[++w]&&w=this._cols?this._cols-1:w<0?0:w}clearMarkers(w){this._isClearing=!0;for(let y=0;y{y.line-=C,y.line<0&&y.dispose()}))),y.register(this.lines.onInsert((C=>{y.line>=C.index&&(y.line+=C.amount)}))),y.register(this.lines.onDelete((C=>{y.line>=C.index&&y.lineC.index&&(y.line-=C.amount)}))),y.register(y.onDispose((()=>this._removeMarker(y)))),y}_removeMarker(w){this._isClearing||this.markers.splice(this.markers.indexOf(w),1)}}},8437:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const u=l(3734),_=l(511),d=l(643),p=l(482);o.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let m=0;class x{constructor(v,b,w=!1){this.isWrapped=w,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*v);const y=b||_.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let C=0;C>22,2097152&b?this._combined[v].charCodeAt(this._combined[v].length-1):w]}set(v,b){this._data[3*v+1]=b[d.CHAR_DATA_ATTR_INDEX],b[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[v]=b[1],this._data[3*v+0]=2097152|v|b[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*v+0]=b[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(v){return this._data[3*v+0]>>22}hasWidth(v){return 12582912&this._data[3*v+0]}getFg(v){return this._data[3*v+1]}getBg(v){return this._data[3*v+2]}hasContent(v){return 4194303&this._data[3*v+0]}getCodePoint(v){const b=this._data[3*v+0];return 2097152&b?this._combined[v].charCodeAt(this._combined[v].length-1):2097151&b}isCombined(v){return 2097152&this._data[3*v+0]}getString(v){const b=this._data[3*v+0];return 2097152&b?this._combined[v]:2097151&b?(0,p.stringFromCodePoint)(2097151&b):""}isProtected(v){return 536870912&this._data[3*v+2]}loadCell(v,b){return m=3*v,b.content=this._data[m+0],b.fg=this._data[m+1],b.bg=this._data[m+2],2097152&b.content&&(b.combinedData=this._combined[v]),268435456&b.bg&&(b.extended=this._extendedAttrs[v]),b}setCell(v,b){2097152&b.content&&(this._combined[v]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[v]=b.extended),this._data[3*v+0]=b.content,this._data[3*v+1]=b.fg,this._data[3*v+2]=b.bg}setCellFromCodepoint(v,b,w,y){268435456&y.bg&&(this._extendedAttrs[v]=y.extended),this._data[3*v+0]=b|w<<22,this._data[3*v+1]=y.fg,this._data[3*v+2]=y.bg}addCodepointToCell(v,b,w){let y=this._data[3*v+0];2097152&y?this._combined[v]+=(0,p.stringFromCodePoint)(b):2097151&y?(this._combined[v]=(0,p.stringFromCodePoint)(2097151&y)+(0,p.stringFromCodePoint)(b),y&=-2097152,y|=2097152):y=b|4194304,w&&(y&=-12582913,y|=w<<22),this._data[3*v+0]=y}insertCells(v,b,w){if((v%=this.length)&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v-1,0,1,w),b=0;--C)this.setCell(v+b+C,this.loadCell(v+C,y));for(let C=0;Cthis.length){if(this._data.buffer.byteLength>=4*w)this._data=new Uint32Array(this._data.buffer,0,w);else{const y=new Uint32Array(w);y.set(this._data),this._data=y}for(let y=this.length;y=v&&delete this._combined[N]}const C=Object.keys(this._extendedAttrs);for(let E=0;E=v&&delete this._extendedAttrs[N]}}return this.length=v,4*w*2=0;--v)if(4194303&this._data[3*v+0])return v+(this._data[3*v+0]>>22);return 0}getNoBgTrimmedLength(){for(let v=this.length-1;v>=0;--v)if(4194303&this._data[3*v+0]||50331648&this._data[3*v+2])return v+(this._data[3*v+0]>>22);return 0}copyCellsFrom(v,b,w,y,C){const E=v._data;if(C)for(let T=y-1;T>=0;T--){for(let z=0;z<3;z++)this._data[3*(w+T)+z]=E[3*(b+T)+z];268435456&E[3*(b+T)+2]&&(this._extendedAttrs[w+T]=v._extendedAttrs[b+T])}else for(let T=0;T=b&&(this._combined[z-b+w]=v._combined[z])}}translateToString(v,b,w,y){b=b??0,w=w??this.length,v&&(w=Math.min(w,this.getTrimmedLength())),y&&(y.length=0);let C="";for(;b>22||1}return y&&y.push(b),C}}o.BufferLine=x},4841:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(l,u){if(l.start.y>l.end.y)throw new Error(`Buffer range end (${l.end.x}, ${l.end.y}) cannot be before start (${l.start.x}, ${l.start.y})`);return u*(l.end.y-l.start.y)+(l.end.x-l.start.x+1)}},4634:(a,o)=>{function l(u,_,d){if(_===u.length-1)return u[_].getTrimmedLength();const p=!u[_].hasContent(d-1)&&u[_].getWidth(d-1)===1,m=u[_+1].getWidth(0)===2;return p&&m?d-1:d}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(u,_,d,p,m){const x=[];for(let S=0;S=S&&p0&&(z>y||w[z].getTrimmedLength()===0);z--)T++;T>0&&(x.push(S+w.length-T),x.push(T)),S+=w.length-1}return x},o.reflowLargerCreateNewLayout=function(u,_){const d=[];let p=0,m=_[p],x=0;for(let S=0;Sl(u,w,_))).reduce(((b,w)=>b+w));let x=0,S=0,v=0;for(;vb&&(x-=b,S++);const w=u[S].getWidth(x-1)===2;w&&x--;const y=w?d-1:d;p.push(y),v+=y}return p},o.getWrappedLineTrimmedLength=l},5295:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const u=l(8460),_=l(844),d=l(9092);class p extends _.Disposable{constructor(x,S){super(),this._optionsService=x,this._bufferService=S,this._onBufferActivate=this.register(new u.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(x){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(x),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(x,S){this._normal.resize(x,S),this._alt.resize(x,S),this.setupTabStops(x)}setupTabStops(x){this._normal.setupTabStops(x),this._alt.setupTabStops(x)}}o.BufferSet=p},511:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const u=l(482),_=l(643),d=l(3734);class p extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(x){const S=new p;return S.setFromCharData(x),S}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(x){this.fg=x[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let S=!1;if(x[_.CHAR_DATA_CHAR_INDEX].length>2)S=!0;else if(x[_.CHAR_DATA_CHAR_INDEX].length===2){const v=x[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=v&&v<=56319){const b=x[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(v-55296)+b-56320+65536|x[_.CHAR_DATA_WIDTH_INDEX]<<22:S=!0}else S=!0}else this.content=x[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[_.CHAR_DATA_WIDTH_INDEX]<<22;S&&(this.combinedData=x[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|x[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=p},643:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const u=l(8460),_=l(844);class d{get id(){return this._id}constructor(m){this.line=m,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,_.disposeArray)(this._disposables),this._disposables.length=0)}register(m){return this._disposables.push(m),m}}o.Marker=d,d._nextId=1},7116:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(a,o)=>{var l,u,_;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.C0=void 0,(function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=` +`,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""})(l||(o.C0=l={})),(function(d){d.PAD="€",d.HOP="",d.BPH="‚",d.NBH="ƒ",d.IND="„",d.NEL="…",d.SSA="†",d.ESA="‡",d.HTS="ˆ",d.HTJ="‰",d.VTS="Š",d.PLD="‹",d.PLU="Œ",d.RI="",d.SS2="Ž",d.SS3="",d.DCS="",d.PU1="‘",d.PU2="’",d.STS="“",d.CCH="”",d.MW="•",d.SPA="–",d.EPA="—",d.SOS="˜",d.SGCI="™",d.SCI="š",d.CSI="›",d.ST="œ",d.OSC="",d.PM="ž",d.APC="Ÿ"})(u||(o.C1=u={})),(function(d){d.ST=`${l.ESC}\\`})(_||(o.C1_ESCAPED=_={}))},7399:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const u=l(2584),_={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};o.evaluateKeyboardEvent=function(d,p,m,x){const S={type:0,cancel:!1,key:void 0},v=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?S.key=p?u.C0.ESC+"OA":u.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?S.key=p?u.C0.ESC+"OD":u.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?S.key=p?u.C0.ESC+"OC":u.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(S.key=p?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:S.key=d.ctrlKey?"\b":u.C0.DEL,d.altKey&&(S.key=u.C0.ESC+S.key);break;case 9:if(d.shiftKey){S.key=u.C0.ESC+"[Z";break}S.key=u.C0.HT,S.cancel=!0;break;case 13:S.key=d.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,S.cancel=!0;break;case 27:S.key=u.C0.ESC,d.altKey&&(S.key=u.C0.ESC+u.C0.ESC),S.cancel=!0;break;case 37:if(d.metaKey)break;v?(S.key=u.C0.ESC+"[1;"+(v+1)+"D",S.key===u.C0.ESC+"[1;3D"&&(S.key=u.C0.ESC+(m?"b":"[1;5D"))):S.key=p?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(d.metaKey)break;v?(S.key=u.C0.ESC+"[1;"+(v+1)+"C",S.key===u.C0.ESC+"[1;3C"&&(S.key=u.C0.ESC+(m?"f":"[1;5C"))):S.key=p?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(d.metaKey)break;v?(S.key=u.C0.ESC+"[1;"+(v+1)+"A",m||S.key!==u.C0.ESC+"[1;3A"||(S.key=u.C0.ESC+"[1;5A")):S.key=p?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(d.metaKey)break;v?(S.key=u.C0.ESC+"[1;"+(v+1)+"B",m||S.key!==u.C0.ESC+"[1;3B"||(S.key=u.C0.ESC+"[1;5B")):S.key=p?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(S.key=u.C0.ESC+"[2~");break;case 46:S.key=v?u.C0.ESC+"[3;"+(v+1)+"~":u.C0.ESC+"[3~";break;case 36:S.key=v?u.C0.ESC+"[1;"+(v+1)+"H":p?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:S.key=v?u.C0.ESC+"[1;"+(v+1)+"F":p?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:d.shiftKey?S.type=2:d.ctrlKey?S.key=u.C0.ESC+"[5;"+(v+1)+"~":S.key=u.C0.ESC+"[5~";break;case 34:d.shiftKey?S.type=3:d.ctrlKey?S.key=u.C0.ESC+"[6;"+(v+1)+"~":S.key=u.C0.ESC+"[6~";break;case 112:S.key=v?u.C0.ESC+"[1;"+(v+1)+"P":u.C0.ESC+"OP";break;case 113:S.key=v?u.C0.ESC+"[1;"+(v+1)+"Q":u.C0.ESC+"OQ";break;case 114:S.key=v?u.C0.ESC+"[1;"+(v+1)+"R":u.C0.ESC+"OR";break;case 115:S.key=v?u.C0.ESC+"[1;"+(v+1)+"S":u.C0.ESC+"OS";break;case 116:S.key=v?u.C0.ESC+"[15;"+(v+1)+"~":u.C0.ESC+"[15~";break;case 117:S.key=v?u.C0.ESC+"[17;"+(v+1)+"~":u.C0.ESC+"[17~";break;case 118:S.key=v?u.C0.ESC+"[18;"+(v+1)+"~":u.C0.ESC+"[18~";break;case 119:S.key=v?u.C0.ESC+"[19;"+(v+1)+"~":u.C0.ESC+"[19~";break;case 120:S.key=v?u.C0.ESC+"[20;"+(v+1)+"~":u.C0.ESC+"[20~";break;case 121:S.key=v?u.C0.ESC+"[21;"+(v+1)+"~":u.C0.ESC+"[21~";break;case 122:S.key=v?u.C0.ESC+"[23;"+(v+1)+"~":u.C0.ESC+"[23~";break;case 123:S.key=v?u.C0.ESC+"[24;"+(v+1)+"~":u.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(m&&!x||!d.altKey||d.metaKey)!m||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?S.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(S.key=u.C0.US),d.key==="@"&&(S.key=u.C0.NUL)):d.keyCode===65&&(S.type=1);else{const b=_[d.keyCode],w=b==null?void 0:b[d.shiftKey?1:0];if(w)S.key=u.C0.ESC+w;else if(d.keyCode>=65&&d.keyCode<=90){const y=d.ctrlKey?d.keyCode-64:d.keyCode+32;let C=String.fromCharCode(y);d.shiftKey&&(C=C.toUpperCase()),S.key=u.C0.ESC+C}else if(d.keyCode===32)S.key=u.C0.ESC+(d.ctrlKey?u.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let y=d.code.slice(3,4);d.shiftKey||(y=y.toLowerCase()),S.key=u.C0.ESC+y,S.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?S.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?S.key=u.C0.NUL:d.keyCode>=51&&d.keyCode<=55?S.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?S.key=u.C0.DEL:d.keyCode===219?S.key=u.C0.ESC:d.keyCode===220?S.key=u.C0.FS:d.keyCode===221&&(S.key=u.C0.GS)}return S}},482:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},o.utf32ToString=function(l,u=0,_=l.length){let d="";for(let p=u;p<_;++p){let m=l[p];m>65535?(m-=65536,d+=String.fromCharCode(55296+(m>>10))+String.fromCharCode(m%1024+56320)):d+=String.fromCharCode(m)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,u){const _=l.length;if(!_)return 0;let d=0,p=0;if(this._interim){const m=l.charCodeAt(p++);56320<=m&&m<=57343?u[d++]=1024*(this._interim-55296)+m-56320+65536:(u[d++]=this._interim,u[d++]=m),this._interim=0}for(let m=p;m<_;++m){const x=l.charCodeAt(m);if(55296<=x&&x<=56319){if(++m>=_)return this._interim=x,d;const S=l.charCodeAt(m);56320<=S&&S<=57343?u[d++]=1024*(x-55296)+S-56320+65536:(u[d++]=x,u[d++]=S)}else x!==65279&&(u[d++]=x)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,u){const _=l.length;if(!_)return 0;let d,p,m,x,S=0,v=0,b=0;if(this.interim[0]){let C=!1,E=this.interim[0];E&=(224&E)==192?31:(240&E)==224?15:7;let N,T=0;for(;(N=63&this.interim[++T])&&T<4;)E<<=6,E|=N;const z=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,M=z-T;for(;b=_)return 0;if(N=l[b++],(192&N)!=128){b--,C=!0;break}this.interim[T++]=N,E<<=6,E|=63&N}C||(z===2?E<128?b--:u[S++]=E:z===3?E<2048||E>=55296&&E<=57343||E===65279||(u[S++]=E):E<65536||E>1114111||(u[S++]=E)),this.interim.fill(0)}const w=_-4;let y=b;for(;y<_;){for(;!(!(y=_)return this.interim[0]=d,S;if(p=l[y++],(192&p)!=128){y--;continue}if(v=(31&d)<<6|63&p,v<128){y--;continue}u[S++]=v}else if((240&d)==224){if(y>=_)return this.interim[0]=d,S;if(p=l[y++],(192&p)!=128){y--;continue}if(y>=_)return this.interim[0]=d,this.interim[1]=p,S;if(m=l[y++],(192&m)!=128){y--;continue}if(v=(15&d)<<12|(63&p)<<6|63&m,v<2048||v>=55296&&v<=57343||v===65279)continue;u[S++]=v}else if((248&d)==240){if(y>=_)return this.interim[0]=d,S;if(p=l[y++],(192&p)!=128){y--;continue}if(y>=_)return this.interim[0]=d,this.interim[1]=p,S;if(m=l[y++],(192&m)!=128){y--;continue}if(y>=_)return this.interim[0]=d,this.interim[1]=p,this.interim[2]=m,S;if(x=l[y++],(192&x)!=128){y--;continue}if(v=(7&d)<<18|(63&p)<<12|(63&m)<<6|63&x,v<65536||v>1114111)continue;u[S++]=v}}return S}}},225:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const u=l(1480),_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],d=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let p;o.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let m=0;m<_.length;++m)p.fill(0,_[m][0],_[m][1]+1)}}wcwidth(m){return m<32?0:m<127?1:m<65536?p[m]:(function(x,S){let v,b=0,w=S.length-1;if(xS[w][1])return!1;for(;w>=b;)if(v=b+w>>1,x>S[v][1])b=v+1;else{if(!(x=131072&&m<=196605||m>=196608&&m<=262141?2:1}charProperties(m,x){let S=this.wcwidth(m),v=S===0&&x!==0;if(v){const b=u.UnicodeService.extractWidth(x);b===0?v=!1:b>S&&(S=b)}return u.UnicodeService.createPropertyValue(0,S,v)}}},5981:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const u=l(8460),_=l(844);class d extends _.Disposable{constructor(m){super(),this._action=m,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(m,x){if(x!==void 0&&this._syncCalls>x)return void(this._syncCalls=0);if(this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let S;for(this._isSyncWriting=!0;S=this._writeBuffer.shift();){this._action(S);const v=this._callbacks.shift();v&&v()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(m,x){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(x),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(x)}_innerWrite(m=0,x=!0){const S=m||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const v=this._writeBuffer[this._bufferOffset],b=this._action(v,x);if(b){const y=C=>Date.now()-S>=12?setTimeout((()=>this._innerWrite(0,C))):this._innerWrite(S,C);return void b.catch((C=>(queueMicrotask((()=>{throw C})),Promise.resolve(!1)))).then(y)}const w=this._callbacks[this._bufferOffset];if(w&&w(),this._bufferOffset++,this._pendingData-=v.length,Date.now()-S>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}o.WriteBuffer=d},5941:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const l=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,u=/^[\da-f]+$/;function _(d,p){const m=d.toString(16),x=m.length<2?"0"+m:m;switch(p){case 4:return m[0];case 8:return x;case 12:return(x+x).slice(0,3);default:return x+x}}o.parseColor=function(d){if(!d)return;let p=d.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const m=l.exec(p);if(m){const x=m[1]?15:m[4]?255:m[7]?4095:65535;return[Math.round(parseInt(m[1]||m[4]||m[7]||m[10],16)/x*255),Math.round(parseInt(m[2]||m[5]||m[8]||m[11],16)/x*255),Math.round(parseInt(m[3]||m[6]||m[9]||m[12],16)/x*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),u.exec(p)&&[3,6,9,12].includes(p.length))){const m=p.length/3,x=[0,0,0];for(let S=0;S<3;++S){const v=parseInt(p.slice(m*S,m*S+m),16);x[S]=m===1?v<<4:m===2?v:m===3?v>>4:v>>8}return x}},o.toRgbString=function(d,p=16){const[m,x,S]=d;return`rgb:${_(m,p)}/${_(x,p)}/${_(S,p)}`}},5770:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const u=l(482),_=l(8742),d=l(5770),p=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(x,S){this._handlers[x]===void 0&&(this._handlers[x]=[]);const v=this._handlers[x];return v.push(S),{dispose:()=>{const b=v.indexOf(S);b!==-1&&v.splice(b,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}reset(){if(this._active.length)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(x,S){if(this.reset(),this._ident=x,this._active=this._handlers[x]||p,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].hook(S);else this._handlerFb(this._ident,"HOOK",S)}put(x,S,v){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(x,S,v);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(x,S,v))}unhook(x,S=!0){if(this._active.length){let v=!1,b=this._active.length-1,w=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,v=S,w=this._stack.fallThrough,this._stack.paused=!1),!w&&v===!1){for(;b>=0&&(v=this._active[b].unhook(x),v!==!0);b--)if(v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,v;b--}for(;b>=0;b--)if(v=this._active[b].unhook(!1),v instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,v}else this._handlerFb(this._ident,"UNHOOK",x);this._active=p,this._ident=0}};const m=new _.Params;m.addParam(0),o.DcsHandler=class{constructor(x){this._handler=x,this._data="",this._params=m,this._hitLimit=!1}hook(x){this._params=x.length>1||x.params[0]?x.clone():m,this._data="",this._hitLimit=!1}put(x,S,v){this._hitLimit||(this._data+=(0,u.utf32ToString)(x,S,v),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(x){let S=!1;if(this._hitLimit)S=!1;else if(x&&(S=this._handler(this._data,this._params),S instanceof Promise))return S.then((v=>(this._params=m,this._data="",this._hitLimit=!1,v)));return this._params=m,this._data="",this._hitLimit=!1,S}}},2015:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const u=l(844),_=l(8742),d=l(6242),p=l(6351);class m{constructor(b){this.table=new Uint8Array(b)}setDefault(b,w){this.table.fill(b<<4|w)}add(b,w,y,C){this.table[w<<8|b]=y<<4|C}addMany(b,w,y,C){for(let E=0;Ez)),w=(T,z)=>b.slice(T,z),y=w(32,127),C=w(0,24);C.push(25),C.push.apply(C,w(28,32));const E=w(0,14);let N;for(N in v.setDefault(1,0),v.addMany(y,0,2,0),E)v.addMany([24,26,153,154],N,3,0),v.addMany(w(128,144),N,3,0),v.addMany(w(144,152),N,3,0),v.add(156,N,0,0),v.add(27,N,11,1),v.add(157,N,4,8),v.addMany([152,158,159],N,0,7),v.add(155,N,11,3),v.add(144,N,11,9);return v.addMany(C,0,3,0),v.addMany(C,1,3,1),v.add(127,1,0,1),v.addMany(C,8,0,8),v.addMany(C,3,3,3),v.add(127,3,0,3),v.addMany(C,4,3,4),v.add(127,4,0,4),v.addMany(C,6,3,6),v.addMany(C,5,3,5),v.add(127,5,0,5),v.addMany(C,2,3,2),v.add(127,2,0,2),v.add(93,1,4,8),v.addMany(y,8,5,8),v.add(127,8,5,8),v.addMany([156,27,24,26,7],8,6,0),v.addMany(w(28,32),8,0,8),v.addMany([88,94,95],1,0,7),v.addMany(y,7,0,7),v.addMany(C,7,0,7),v.add(156,7,0,0),v.add(127,7,0,7),v.add(91,1,11,3),v.addMany(w(64,127),3,7,0),v.addMany(w(48,60),3,8,4),v.addMany([60,61,62,63],3,9,4),v.addMany(w(48,60),4,8,4),v.addMany(w(64,127),4,7,0),v.addMany([60,61,62,63],4,0,6),v.addMany(w(32,64),6,0,6),v.add(127,6,0,6),v.addMany(w(64,127),6,0,0),v.addMany(w(32,48),3,9,5),v.addMany(w(32,48),5,9,5),v.addMany(w(48,64),5,0,6),v.addMany(w(64,127),5,7,0),v.addMany(w(32,48),4,9,5),v.addMany(w(32,48),1,9,2),v.addMany(w(32,48),2,9,2),v.addMany(w(48,127),2,10,0),v.addMany(w(48,80),1,10,0),v.addMany(w(81,88),1,10,0),v.addMany([89,90,92],1,10,0),v.addMany(w(96,127),1,10,0),v.add(80,1,11,9),v.addMany(C,9,0,9),v.add(127,9,0,9),v.addMany(w(28,32),9,0,9),v.addMany(w(32,48),9,9,12),v.addMany(w(48,60),9,8,10),v.addMany([60,61,62,63],9,9,10),v.addMany(C,11,0,11),v.addMany(w(32,128),11,0,11),v.addMany(w(28,32),11,0,11),v.addMany(C,10,0,10),v.add(127,10,0,10),v.addMany(w(28,32),10,0,10),v.addMany(w(48,60),10,8,10),v.addMany([60,61,62,63],10,0,11),v.addMany(w(32,48),10,9,12),v.addMany(C,12,0,12),v.add(127,12,0,12),v.addMany(w(28,32),12,0,12),v.addMany(w(32,48),12,9,12),v.addMany(w(48,64),12,0,11),v.addMany(w(64,127),12,12,13),v.addMany(w(64,127),10,12,13),v.addMany(w(64,127),9,12,13),v.addMany(C,13,13,13),v.addMany(y,13,13,13),v.add(127,13,0,13),v.addMany([27,156,24,26],13,14,0),v.add(x,0,2,0),v.add(x,8,5,8),v.add(x,6,0,6),v.add(x,11,0,11),v.add(x,13,13,13),v})();class S extends u.Disposable{constructor(b=o.VT500_TRANSITION_TABLE){super(),this._transitions=b,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(w,y,C)=>{},this._executeHandlerFb=w=>{},this._csiHandlerFb=(w,y)=>{},this._escHandlerFb=w=>{},this._errorHandlerFb=w=>w,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,u.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new d.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,w=[64,126]){let y=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(y=b.prefix.charCodeAt(0),y&&60>y||y>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(b.intermediates){if(b.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let E=0;EN||N>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");y<<=8,y|=N}}if(b.final.length!==1)throw new Error("final must be a single byte");const C=b.final.charCodeAt(0);if(w[0]>C||C>w[1])throw new Error(`final must be in range ${w[0]} .. ${w[1]}`);return y<<=8,y|=C,y}identToString(b){const w=[];for(;b;)w.push(String.fromCharCode(255&b)),b>>=8;return w.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,w){const y=this._identifier(b,[48,126]);this._escHandlers[y]===void 0&&(this._escHandlers[y]=[]);const C=this._escHandlers[y];return C.push(w),{dispose:()=>{const E=C.indexOf(w);E!==-1&&C.splice(E,1)}}}clearEscHandler(b){this._escHandlers[this._identifier(b,[48,126])]&&delete this._escHandlers[this._identifier(b,[48,126])]}setEscHandlerFallback(b){this._escHandlerFb=b}setExecuteHandler(b,w){this._executeHandlers[b.charCodeAt(0)]=w}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,w){const y=this._identifier(b);this._csiHandlers[y]===void 0&&(this._csiHandlers[y]=[]);const C=this._csiHandlers[y];return C.push(w),{dispose:()=>{const E=C.indexOf(w);E!==-1&&C.splice(E,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,w){return this._dcsParser.registerHandler(this._identifier(b),w)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,w){return this._oscParser.registerHandler(b,w)}clearOscHandler(b){this._oscParser.clearHandler(b)}setOscHandlerFallback(b){this._oscParser.setHandlerFallback(b)}setErrorHandler(b){this._errorHandler=b}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(b,w,y,C,E){this._parseStack.state=b,this._parseStack.handlers=w,this._parseStack.handlerPos=y,this._parseStack.transition=C,this._parseStack.chunkPos=E}parse(b,w,y){let C,E=0,N=0,T=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,T=this._parseStack.chunkPos+1;else{if(y===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const z=this._parseStack.handlers;let M=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(y===!1&&M>-1){for(;M>=0&&(C=z[M](this._params),C!==!0);M--)if(C instanceof Promise)return this._parseStack.handlerPos=M,C}this._parseStack.handlers=[];break;case 4:if(y===!1&&M>-1){for(;M>=0&&(C=z[M](),C!==!0);M--)if(C instanceof Promise)return this._parseStack.handlerPos=M,C}this._parseStack.handlers=[];break;case 6:if(E=b[this._parseStack.chunkPos],C=this._dcsParser.unhook(E!==24&&E!==26,y),C)return C;E===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(E=b[this._parseStack.chunkPos],C=this._oscParser.end(E!==24&&E!==26,y),C)return C;E===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,T=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let z=T;z>4){case 2:for(let U=z+1;;++U){if(U>=w||(E=b[U])<32||E>126&&E=w||(E=b[U])<32||E>126&&E=w||(E=b[U])<32||E>126&&E=w||(E=b[U])<32||E>126&&E=0&&(C=M[I](this._params),C!==!0);I--)if(C instanceof Promise)return this._preserveStack(3,M,I,N,z),C;I<0&&this._csiHandlerFb(this._collect<<8|E,this._params),this.precedingJoinState=0;break;case 8:do switch(E){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(E-48)}while(++z47&&E<60);z--;break;case 9:this._collect<<=8,this._collect|=E;break;case 10:const B=this._escHandlers[this._collect<<8|E];let $=B?B.length-1:-1;for(;$>=0&&(C=B[$](),C!==!0);$--)if(C instanceof Promise)return this._preserveStack(4,B,$,N,z),C;$<0&&this._escHandlerFb(this._collect<<8|E),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|E,this._params);break;case 13:for(let U=z+1;;++U)if(U>=w||(E=b[U])===24||E===26||E===27||E>127&&E=w||(E=b[U])<32||E>127&&E{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const u=l(5770),_=l(482),d=[];o.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,m){this._handlers[p]===void 0&&(this._handlers[p]=[]);const x=this._handlers[p];return x.push(m),{dispose:()=>{const S=x.indexOf(m);S!==-1&&x.splice(S,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,m,x){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(p,m,x);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(p,m,x))}start(){this.reset(),this._state=1}put(p,m,x){if(this._state!==3){if(this._state===1)for(;m0&&this._put(p,m,x)}}end(p,m=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let x=!1,S=this._active.length-1,v=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,x=m,v=this._stack.fallThrough,this._stack.paused=!1),!v&&x===!1){for(;S>=0&&(x=this._active[S].end(p),x!==!0);S--)if(x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,x;S--}for(;S>=0;S--)if(x=this._active[S].end(!1),x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,x}else this._handlerFb(this._id,"END",p);this._active=d,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,m,x){this._hitLimit||(this._data+=(0,_.utf32ToString)(p,m,x),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let m=!1;if(this._hitLimit)m=!1;else if(p&&(m=this._handler(this._data),m instanceof Promise))return m.then((x=>(this._data="",this._hitLimit=!1,x)));return this._data="",this._hitLimit=!1,m}}},8742:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const l=2147483647;class u{static fromArray(d){const p=new u;if(!d.length)return p;for(let m=Array.isArray(d[0])?1:0;m256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new u(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let p=0;p>8,x=255&this._subParamsIdx[p];x-m>0&&d.push(Array.prototype.slice.call(this._subParams,m,x))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>l?l:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>l?l:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const p=this._subParamsIdx[d]>>8,m=255&this._subParamsIdx[d];return m-p>0?this._subParams.subarray(p,m):null}getSubParamsAll(){const d={};for(let p=0;p>8,x=255&this._subParamsIdx[p];x-m>0&&(d[p]=this._subParams.slice(m,x))}return d}addDigit(d){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const m=this._digitIsSub?this._subParams:this.params,x=m[p-1];m[p-1]=~x?Math.min(10*x+d,l):d}}o.Params=u},5741:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,u){const _={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(_),u.dispose=()=>this._wrappedAddonDispose(_),u.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let u=-1;for(let _=0;_{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const u=l(3785),_=l(511);o.BufferApiView=class{constructor(d,p){this._buffer=d,this.type=p}init(d){return this._buffer=d,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(d){const p=this._buffer.lines.get(d);if(p)return new u.BufferLineApiView(p)}getNullCell(){return new _.CellData}}},3785:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const u=l(511);o.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,d){if(!(_<0||_>=this._line.length))return d?(this._line.loadCell(_,d),d):this._line.loadCell(_,new u.CellData)}translateToString(_,d,p){return this._line.translateToString(_,d,p)}}},8285:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const u=l(8771),_=l(8460),d=l(844);class p extends d.Disposable{constructor(x){super(),this._core=x,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}o.BufferNamespaceApi=p},7975:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,u){return this._core.registerCsiHandler(l,(_=>u(_.toArray())))}addCsiHandler(l,u){return this.registerCsiHandler(l,u)}registerDcsHandler(l,u){return this._core.registerDcsHandler(l,((_,d)=>u(_,d.toArray())))}addDcsHandler(l,u){return this.registerDcsHandler(l,u)}registerEscHandler(l,u){return this._core.registerEscHandler(l,u)}addEscHandler(l,u){return this.registerEscHandler(l,u)}registerOscHandler(l,u){return this._core.registerOscHandler(l,u)}addOscHandler(l,u){return this.registerOscHandler(l,u)}}},7090:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(a,o,l){var u=this&&this.__decorate||function(v,b,w,y){var C,E=arguments.length,N=E<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,w):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(v,b,w,y);else for(var T=v.length-1;T>=0;T--)(C=v[T])&&(N=(E<3?C(N):E>3?C(b,w,N):C(b,w))||N);return E>3&&N&&Object.defineProperty(b,w,N),N},_=this&&this.__param||function(v,b){return function(w,y){b(w,y,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=l(8460),p=l(844),m=l(5295),x=l(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let S=o.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(v){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(v.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(v.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new m.BufferSet(v,this))}resize(v,b){this.cols=v,this.rows=b,this.buffers.resize(v,b),this._onResize.fire({cols:v,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(v,b=!1){const w=this.buffer;let y;y=this._cachedBlankLine,y&&y.length===this.cols&&y.getFg(0)===v.fg&&y.getBg(0)===v.bg||(y=w.getBlankLine(v,b),this._cachedBlankLine=y),y.isWrapped=b;const C=w.ybase+w.scrollTop,E=w.ybase+w.scrollBottom;if(w.scrollTop===0){const N=w.lines.isFull;E===w.lines.length-1?N?w.lines.recycle().copyFrom(y):w.lines.push(y.clone()):w.lines.splice(E+1,0,y.clone()),N?this.isUserScrolling&&(w.ydisp=Math.max(w.ydisp-1,0)):(w.ybase++,this.isUserScrolling||w.ydisp++)}else{const N=E-C+1;w.lines.shiftElements(C+1,N-1,-1),w.lines.set(E,y.clone())}this.isUserScrolling||(w.ydisp=w.ybase),this._onScroll.fire(w.ydisp)}scrollLines(v,b,w){const y=this.buffer;if(v<0){if(y.ydisp===0)return;this.isUserScrolling=!0}else v+y.ydisp>=y.ybase&&(this.isUserScrolling=!1);const C=y.ydisp;y.ydisp=Math.max(Math.min(y.ydisp+v,y.ybase),0),C!==y.ydisp&&(b||this._onScroll.fire(y.ydisp))}};o.BufferService=S=u([_(0,x.IOptionsService)],S)},7994:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,u){this._charsets[l]=u,this.glevel===l&&(this.charset=u)}}},1753:function(a,o,l){var u=this&&this.__decorate||function(y,C,E,N){var T,z=arguments.length,M=z<3?C:N===null?N=Object.getOwnPropertyDescriptor(C,E):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(y,C,E,N);else for(var I=y.length-1;I>=0;I--)(T=y[I])&&(M=(z<3?T(M):z>3?T(C,E,M):T(C,E))||M);return z>3&&M&&Object.defineProperty(C,E,M),M},_=this&&this.__param||function(y,C){return function(E,N){C(E,N,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=l(2585),p=l(8460),m=l(844),x={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:y=>y.button!==4&&y.action===1&&(y.ctrl=!1,y.alt=!1,y.shift=!1,!0)},VT200:{events:19,restrict:y=>y.action!==32},DRAG:{events:23,restrict:y=>y.action!==32||y.button!==3},ANY:{events:31,restrict:y=>!0}};function S(y,C){let E=(y.ctrl?16:0)|(y.shift?4:0)|(y.alt?8:0);return y.button===4?(E|=64,E|=y.action):(E|=3&y.button,4&y.button&&(E|=64),8&y.button&&(E|=128),y.action===32?E|=32:y.action!==0||C||(E|=3)),E}const v=String.fromCharCode,b={DEFAULT:y=>{const C=[S(y,!1)+32,y.col+32,y.row+32];return C[0]>255||C[1]>255||C[2]>255?"":`\x1B[M${v(C[0])}${v(C[1])}${v(C[2])}`},SGR:y=>{const C=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${S(y,!0)};${y.col};${y.row}${C}`},SGR_PIXELS:y=>{const C=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${S(y,!0)};${y.x};${y.y}${C}`}};let w=o.CoreMouseService=class extends m.Disposable{constructor(y,C){super(),this._bufferService=y,this._coreService=C,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const E of Object.keys(x))this.addProtocol(E,x[E]);for(const E of Object.keys(b))this.addEncoding(E,b[E]);this.reset()}addProtocol(y,C){this._protocols[y]=C}addEncoding(y,C){this._encodings[y]=C}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(y){if(!this._protocols[y])throw new Error(`unknown protocol "${y}"`);this._activeProtocol=y,this._onProtocolChange.fire(this._protocols[y].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(y){if(!this._encodings[y])throw new Error(`unknown encoding "${y}"`);this._activeEncoding=y}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(y){if(y.col<0||y.col>=this._bufferService.cols||y.row<0||y.row>=this._bufferService.rows||y.button===4&&y.action===32||y.button===3&&y.action!==32||y.button!==4&&(y.action===2||y.action===3)||(y.col++,y.row++,y.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,y,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(y))return!1;const C=this._encodings[this._activeEncoding](y);return C&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(C):this._coreService.triggerDataEvent(C,!0)),this._lastEvent=y,!0}explainEvents(y){return{down:!!(1&y),up:!!(2&y),drag:!!(4&y),move:!!(8&y),wheel:!!(16&y)}}_equalEvents(y,C,E){if(E){if(y.x!==C.x||y.y!==C.y)return!1}else if(y.col!==C.col||y.row!==C.row)return!1;return y.button===C.button&&y.action===C.action&&y.ctrl===C.ctrl&&y.alt===C.alt&&y.shift===C.shift}};o.CoreMouseService=w=u([_(0,d.IBufferService),_(1,d.ICoreService)],w)},6975:function(a,o,l){var u=this&&this.__decorate||function(w,y,C,E){var N,T=arguments.length,z=T<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,C):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(w,y,C,E);else for(var M=w.length-1;M>=0;M--)(N=w[M])&&(z=(T<3?N(z):T>3?N(y,C,z):N(y,C))||z);return T>3&&z&&Object.defineProperty(y,C,z),z},_=this&&this.__param||function(w,y){return function(C,E){y(C,E,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=l(1439),p=l(8460),m=l(844),x=l(2585),S=Object.freeze({insertMode:!1}),v=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=o.CoreService=class extends m.Disposable{constructor(w,y,C){super(),this._bufferService=w,this._logService=y,this._optionsService=C,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(S),this.decPrivateModes=(0,d.clone)(v)}reset(){this.modes=(0,d.clone)(S),this.decPrivateModes=(0,d.clone)(v)}triggerDataEvent(w,y=!1){if(this._optionsService.rawOptions.disableStdin)return;const C=this._bufferService.buffer;y&&this._optionsService.rawOptions.scrollOnUserInput&&C.ybase!==C.ydisp&&this._onRequestScrollToBottom.fire(),y&&this._onUserInput.fire(),this._logService.debug(`sending data "${w}"`,(()=>w.split("").map((E=>E.charCodeAt(0))))),this._onData.fire(w)}triggerBinaryEvent(w){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${w}"`,(()=>w.split("").map((y=>y.charCodeAt(0))))),this._onBinary.fire(w))}};o.CoreService=b=u([_(0,x.IBufferService),_(1,x.ILogService),_(2,x.IOptionsService)],b)},9074:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const u=l(8055),_=l(8460),d=l(844),p=l(6106);let m=0,x=0;class S extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList((w=>w==null?void 0:w.marker.line)),this._onDecorationRegistered=this.register(new _.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new _.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(w){if(w.marker.isDisposed)return;const y=new v(w);if(y){const C=y.marker.onDispose((()=>y.dispose()));y.onDispose((()=>{y&&(this._decorations.delete(y)&&this._onDecorationRemoved.fire(y),C.dispose())})),this._decorations.insert(y),this._onDecorationRegistered.fire(y)}return y}reset(){for(const w of this._decorations.values())w.dispose();this._decorations.clear()}*getDecorationsAtCell(w,y,C){let E=0,N=0;for(const T of this._decorations.getKeyIterator(y))E=T.options.x??0,N=E+(T.options.width??1),w>=E&&w{m=N.options.x??0,x=m+(N.options.width??1),w>=m&&w{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const u=l(2585),_=l(8343);class d{constructor(...m){this._entries=new Map;for(const[x,S]of m)this.set(x,S)}set(m,x){const S=this._entries.get(m);return this._entries.set(m,x),S}forEach(m){for(const[x,S]of this._entries.entries())m(x,S)}has(m){return this._entries.has(m)}get(m){return this._entries.get(m)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(u.IInstantiationService,this)}setService(p,m){this._services.set(p,m)}getService(p){return this._services.get(p)}createInstance(p,...m){const x=(0,_.getServiceDependencies)(p).sort(((b,w)=>b.index-w.index)),S=[];for(const b of x){const w=this._services.get(b.id);if(!w)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${b.id}.`);S.push(w)}const v=x.length>0?x[0].index:m.length;if(m.length!==v)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${v+1} conflicts with ${m.length} static arguments`);return new p(...m,...S)}}},7866:function(a,o,l){var u=this&&this.__decorate||function(v,b,w,y){var C,E=arguments.length,N=E<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,w):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(v,b,w,y);else for(var T=v.length-1;T>=0;T--)(C=v[T])&&(N=(E<3?C(N):E>3?C(b,w,N):C(b,w))||N);return E>3&&N&&Object.defineProperty(b,w,N),N},_=this&&this.__param||function(v,b){return function(w,y){b(w,y,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=l(844),p=l(2585),m={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let x,S=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(v){super(),this._optionsService=v,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),x=this}_updateLogLevel(){this._logLevel=m[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(v){for(let b=0;bJSON.stringify(N))).join(", ")})`);const E=y.apply(this,C);return x.trace(`GlyphRenderer#${y.name} return`,E),E}}},7302:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const u=l(8460),_=l(844),d=l(6114);o.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const p=["normal","bold","100","200","300","400","500","600","700","800","900"];class m extends _.Disposable{constructor(S){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const v={...o.DEFAULT_OPTIONS};for(const b in S)if(b in v)try{const w=S[b];v[b]=this._sanitizeAndValidateOption(b,w)}catch(w){console.error(w)}this.rawOptions=v,this.options={...v},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(S,v){return this.onOptionChange((b=>{b===S&&v(this.rawOptions[S])}))}onMultipleOptionChange(S,v){return this.onOptionChange((b=>{S.indexOf(b)!==-1&&v()}))}_setupOptions(){const S=b=>{if(!(b in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},v=(b,w)=>{if(!(b in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);w=this._sanitizeAndValidateOption(b,w),this.rawOptions[b]!==w&&(this.rawOptions[b]=w,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const w={get:S.bind(this,b),set:v.bind(this,b)};Object.defineProperty(this.options,b,w)}}_sanitizeAndValidateOption(S,v){switch(S){case"cursorStyle":if(v||(v=o.DEFAULT_OPTIONS[S]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(v))throw new Error(`"${v}" is not a valid value for ${S}`);break;case"wordSeparator":v||(v=o.DEFAULT_OPTIONS[S]);break;case"fontWeight":case"fontWeightBold":if(typeof v=="number"&&1<=v&&v<=1e3)break;v=p.includes(v)?v:o.DEFAULT_OPTIONS[S];break;case"cursorWidth":v=Math.floor(v);case"lineHeight":case"tabStopWidth":if(v<1)throw new Error(`${S} cannot be less than 1, value: ${v}`);break;case"minimumContrastRatio":v=Math.max(1,Math.min(21,Math.round(10*v)/10));break;case"scrollback":if((v=Math.min(v,4294967295))<0)throw new Error(`${S} cannot be less than 0, value: ${v}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(v<=0)throw new Error(`${S} cannot be less than or equal to 0, value: ${v}`);break;case"rows":case"cols":if(!v&&v!==0)throw new Error(`${S} must be numeric, value: ${v}`);break;case"windowsPty":v=v??{}}return v}}o.OptionsService=m},2660:function(a,o,l){var u=this&&this.__decorate||function(m,x,S,v){var b,w=arguments.length,y=w<3?x:v===null?v=Object.getOwnPropertyDescriptor(x,S):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(m,x,S,v);else for(var C=m.length-1;C>=0;C--)(b=m[C])&&(y=(w<3?b(y):w>3?b(x,S,y):b(x,S))||y);return w>3&&y&&Object.defineProperty(x,S,y),y},_=this&&this.__param||function(m,x){return function(S,v){x(S,v,m)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=l(2585);let p=o.OscLinkService=class{constructor(m){this._bufferService=m,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(m){const x=this._bufferService.buffer;if(m.id===void 0){const C=x.addMarker(x.ybase+x.y),E={data:m,id:this._nextId++,lines:[C]};return C.onDispose((()=>this._removeMarkerFromLink(E,C))),this._dataByLinkId.set(E.id,E),E.id}const S=m,v=this._getEntryIdKey(S),b=this._entriesWithId.get(v);if(b)return this.addLineToLink(b.id,x.ybase+x.y),b.id;const w=x.addMarker(x.ybase+x.y),y={id:this._nextId++,key:this._getEntryIdKey(S),data:S,lines:[w]};return w.onDispose((()=>this._removeMarkerFromLink(y,w))),this._entriesWithId.set(y.key,y),this._dataByLinkId.set(y.id,y),y.id}addLineToLink(m,x){const S=this._dataByLinkId.get(m);if(S&&S.lines.every((v=>v.line!==x))){const v=this._bufferService.buffer.addMarker(x);S.lines.push(v),v.onDispose((()=>this._removeMarkerFromLink(S,v)))}}getLinkData(m){var x;return(x=this._dataByLinkId.get(m))==null?void 0:x.data}_getEntryIdKey(m){return`${m.id};;${m.uri}`}_removeMarkerFromLink(m,x){const S=m.lines.indexOf(x);S!==-1&&(m.lines.splice(S,1),m.lines.length===0&&(m.data.id!==void 0&&this._entriesWithId.delete(m.key),this._dataByLinkId.delete(m.id)))}};o.OscLinkService=p=u([_(0,d.IBufferService)],p)},8343:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const l="di$target",u="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(_){return _[u]||[]},o.createDecorator=function(_){if(o.serviceRegistry.has(_))return o.serviceRegistry.get(_);const d=function(p,m,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(S,v,b){v[l]===v?v[u].push({id:S,index:b}):(v[u]=[{id:S,index:b}],v[l]=v)})(d,p,x)};return d.toString=()=>_,o.serviceRegistry.set(_,d),d}},2585:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const u=l(8343);var _;o.IBufferService=(0,u.createDecorator)("BufferService"),o.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),o.ICoreService=(0,u.createDecorator)("CoreService"),o.ICharsetService=(0,u.createDecorator)("CharsetService"),o.IInstantiationService=(0,u.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(_||(o.LogLevelEnum=_={})),o.ILogService=(0,u.createDecorator)("LogService"),o.IOptionsService=(0,u.createDecorator)("OptionsService"),o.IOscLinkService=(0,u.createDecorator)("OscLinkService"),o.IUnicodeService=(0,u.createDecorator)("UnicodeService"),o.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const u=l(8460),_=l(225);class d{static extractShouldJoin(m){return(1&m)!=0}static extractWidth(m){return m>>1&3}static extractCharKind(m){return m>>3}static createPropertyValue(m,x,S=!1){return(16777215&m)<<3|(3&x)<<1|(S?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const m=new _.UnicodeV6;this.register(m),this._active=m.version,this._activeProvider=m}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(m){if(!this._providers[m])throw new Error(`unknown Unicode version "${m}"`);this._active=m,this._activeProvider=this._providers[m],this._onChange.fire(m)}register(m){this._providers[m.version]=m}wcwidth(m){return this._activeProvider.wcwidth(m)}getStringCellWidth(m){let x=0,S=0;const v=m.length;for(let b=0;b=v)return x+this.wcwidth(w);const E=m.charCodeAt(b);56320<=E&&E<=57343?w=1024*(w-55296)+E-56320+65536:x+=this.wcwidth(E)}const y=this.charProperties(w,S);let C=d.extractWidth(y);d.extractShouldJoin(y)&&(C-=d.extractWidth(S)),x+=C,S=y}return x}charProperties(m,x){return this._activeProvider.charProperties(m,x)}}o.UnicodeService=d}},r={};function s(a){var o=r[a];if(o!==void 0)return o.exports;var l=r[a]={exports:{}};return t[a].call(l.exports,l,l.exports,s),l.exports}var i={};return(()=>{var a=i;Object.defineProperty(a,"__esModule",{value:!0}),a.Terminal=void 0;const o=s(9042),l=s(3236),u=s(844),_=s(5741),d=s(8285),p=s(7975),m=s(7090),x=["cols","rows"];class S extends u.Disposable{constructor(b){super(),this._core=this.register(new l.Terminal(b)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const w=C=>this._core.options[C],y=(C,E)=>{this._checkReadonlyOptions(C),this._core.options[C]=E};for(const C in this._core.options){const E={get:w.bind(this,C),set:y.bind(this,C)};Object.defineProperty(this._publicOptions,C,E)}}_checkReadonlyOptions(b){if(x.includes(b))throw new Error(`Option "${b}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new p.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new m.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let w="none";switch(this._core.coreMouseService.activeProtocol){case"X10":w="x10";break;case"VT200":w="vt200";break;case"DRAG":w="drag";break;case"ANY":w="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:w,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const w in b)this._publicOptions[w]=b[w]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,w=!0){this._core.input(b,w)}resize(b,w){this._verifyIntegers(b,w),this._core.resize(b,w)}open(b){this._core.open(b)}attachCustomKeyEventHandler(b){this._core.attachCustomKeyEventHandler(b)}attachCustomWheelEventHandler(b){this._core.attachCustomWheelEventHandler(b)}registerLinkProvider(b){return this._core.registerLinkProvider(b)}registerCharacterJoiner(b){return this._checkProposedApi(),this._core.registerCharacterJoiner(b)}deregisterCharacterJoiner(b){this._checkProposedApi(),this._core.deregisterCharacterJoiner(b)}registerMarker(b=0){return this._verifyIntegers(b),this._core.registerMarker(b)}registerDecoration(b){return this._checkProposedApi(),this._verifyPositiveIntegers(b.x??0,b.width??0,b.height??0),this._core.registerDecoration(b)}hasSelection(){return this._core.hasSelection()}select(b,w,y){this._verifyIntegers(b,w,y),this._core.select(b,w,y)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,w){this._verifyIntegers(b,w),this._core.selectLines(b,w)}dispose(){super.dispose()}scrollLines(b){this._verifyIntegers(b),this._core.scrollLines(b)}scrollPages(b){this._verifyIntegers(b),this._core.scrollPages(b)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(b){this._verifyIntegers(b),this._core.scrollToLine(b)}clear(){this._core.clear()}write(b,w){this._core.write(b,w)}writeln(b,w){this._core.write(b),this._core.write(`\r +`,w)}paste(b){this._core.paste(b)}refresh(b,w){this._verifyIntegers(b,w),this._core.refresh(b,w)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return o}_verifyIntegers(...b){for(const w of b)if(w===1/0||isNaN(w)||w%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const w of b)if(w&&(w===1/0||isNaN(w)||w%1!=0||w<0))throw new Error("This API only accepts positive integers")}}a.Terminal=S})(),i})()))})(Ax)),Ax.exports}var n0t=t0t();function S6(e,n,t=!1){const r=getComputedStyle(document.documentElement),s=new n0t.Terminal({convertEol:!0,disableStdin:n,fontSize:12,fontFamily:r.getPropertyValue("--mono").trim()||"ui-monospace, Menlo, Consolas, monospace",scrollback:2e4,theme:{background:r.getPropertyValue("--term-bg").trim(),foreground:r.getPropertyValue("--term-foreground").trim(),cursor:n?r.getPropertyValue("--term-bg").trim():r.getPropertyValue("--term-foreground").trim(),selectionBackground:r.getPropertyValue("--term-selection").trim()}}),i=new Z_t.FitAddon;s.loadAddon(i),t&&s.loadAddon(new e0t.WebLinksAddon((l,u)=>{let _;try{_=new URL(u)}catch{return}(_.protocol==="http:"||_.protocol==="https:")&&window.open(_,"_blank","noopener,noreferrer")})),s.open(e);const a=()=>{try{i.fit()}catch{}};a();const o=new ResizeObserver(a);return o.observe(e),{terminal:s,dispose(){o.disconnect(),s.dispose()}}}const wO="overflow-hidden rounded-md bg-terminal p-2";function Zp(e){return typeof e=="object"&&e!==null}function SO(e){return Array.isArray(e)&&e.every(n=>typeof n=="string")}function r0t(e){return Zp(e)&&typeof e.reachable=="boolean"&&typeof e.toolsFound=="boolean"&&(e.missingTools===void 0||SO(e.missingTools))&&(e.error===null||typeof e.error=="string")&&typeof e.testedAt=="number"}function s0t(e){return Zp(e)&&typeof e.reachable=="boolean"&&typeof e.slurmFound=="boolean"&&typeof e.toolsFound=="boolean"&&SO(e.partitions)&&(e.error===null||typeof e.error=="string")}function i0t(e){return!Zp(e)||e.type!=="complete"?null:e.backend==="ssh"&&r0t(e.result)?{backend:"ssh",result:e.result}:e.backend==="slurm"&&s0t(e.result)?{backend:"slurm",result:e.result}:null}function a0t(e){return Zp(e)&&e.type==="error"&&typeof e.error=="string"?e.error:null}function k6({host:e,backend:n,path:t="/api/settings/ssh/connect",active:r=!0,onComplete:s,onError:i}){const a=new URLSearchParams({host:e,backend:n});return f.jsx(kO,{path:`${t}?${a}`,label:SL({host:Ne(e)}),active:r,onError:i,onComplete:o=>{const l=i0t(o);return l?(s(l),!0):!1}})}function o0t({login:e,onComplete:n,onError:t}){return f.jsx(kO,{path:e?"/api/settings/openresearch/login":"/api/settings/openresearch/ssh-key",label:e?"orx login":"orx ssh-key add",heightClass:"h-80",onError:t,onComplete:r=>!Zp(r)||r.type!=="complete"?!1:(n(),!0)})}function kO({path:e,label:n,heightClass:t="h-40",active:r=!0,onComplete:s,onError:i}){const a=R.useRef(null),o=R.useRef(null),l=R.useRef(s),u=R.useRef(i),[_,d]=R.useState(null);return l.current=s,u.current=i,R.useEffect(()=>{const p=a.current;if(!p)return;const{terminal:m,dispose:x}=S6(p,!1,!0);o.current=m,m.focus();const S=location.protocol==="https:"?"wss:":"ws:",v=new URL(e,`${S}//${location.host}`),b=new WebSocket(v);b.binaryType="arraybuffer";let w=!1,y=!1,C=!1;const E=z=>{var M;y||(y=!0,C||m.writeln(z),m.options.disableStdin=!0,m.blur(),d(z),(M=u.current)==null||M.call(u,z))},N=m.onData(z=>{b.readyState===WebSocket.OPEN&&b.send(new TextEncoder().encode(z))}),T=m.onResize(({cols:z,rows:M})=>{b.readyState===WebSocket.OPEN&&b.send(JSON.stringify({type:"resize",cols:z,rows:M}))});return b.onopen=()=>{b.send(JSON.stringify({type:"resize",cols:m.cols,rows:m.rows}))},b.onmessage=z=>{if(z.data instanceof ArrayBuffer){C=!0,m.write(new Uint8Array(z.data));return}if(typeof z.data!="string")return;let M;try{M=JSON.parse(z.data)}catch{return}if(l.current(M)){w=!0,b.close();return}const I=a0t(M);I&&E(I)},b.onerror=()=>E(DN()),b.onclose=()=>{!w&&!y&&E(DN())},()=>{b.onopen=null,b.onmessage=null,b.onerror=null,b.onclose=null,N.dispose(),T.dispose(),b.close(),o.current=null,x()}},[e]),R.useEffect(()=>{const p=o.current;p&&(p.options.disableStdin=!r||_!==null,r&&_===null?p.focus():p.blur())},[r,_]),f.jsxs("div",{className:"mt-3",children:[f.jsx("div",{className:`${t} ${wO}`,role:"group","aria-label":n,children:f.jsx("div",{ref:a,className:"h-full overflow-hidden"})}),_?f.jsx("p",{role:"alert",className:"sr-only",children:_}):null]})}function l0t({host:e,transcript:n}){const t=R.useRef(null);return R.useEffect(()=>{const r=t.current;if(!r)return;const{terminal:s,dispose:i}=S6(r,!0,!0);return s.write(n),i},[n]),f.jsx("div",{className:`mt-3 h-40 ${wO}`,role:"group","aria-label":SL({host:Ne(e)}),children:f.jsx("div",{ref:t,className:"h-full overflow-hidden"})})}function Jc(e,n){return e&&Object.hasOwn(e.tasks,n)?e.tasks[n]:void 0}const c0t=["settings","harnesses","projects","compute","instances","environment","git","storage"],u0t=e=>c0t.some(n=>n===e),d0t=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Li=e=>typeof e=="string"&&e.length>0,Og=e=>e==null||Li(e);function C6(e){if(!d0t(e))return;const n=(...t)=>Object.keys(e).every(r=>t.includes(r));switch(e.kind){case"home":if(n("kind","view")&&(e.view==="experiments"||e.view==="files"||e.view==="artifacts"))return{kind:"home",view:e.view};break;case"experiment":if(n("kind","experimentId","view","runId")&&Li(e.experimentId)&&(e.view==="overview"||e.view==="terminal")&&Og(e.runId))return{kind:"experiment",experimentId:e.experimentId,view:e.view,...Li(e.runId)?{runId:e.runId}:{}};break;case"file":if(n("kind","path","source","sessionId","ref","line","branchLabel")&&Li(e.path)&&Og(e.sessionId)&&Og(e.ref)&&Og(e.branchLabel)&&(e.source==null||e.source==="repo"||e.source==="artifacts"||e.source==="abs")&&(e.line==null||typeof e.line=="number"&&Number.isSafeInteger(e.line)&&e.line>0))return{kind:"file",path:e.path,...e.source?{source:e.source}:{},...Li(e.sessionId)?{sessionId:e.sessionId}:{},...Li(e.ref)?{ref:e.ref}:{},...typeof e.line=="number"?{line:e.line}:{},...Li(e.branchLabel)?{branchLabel:e.branchLabel}:{}};break;case"code":if(n("kind","experimentId","branch","view")&&Li(e.experimentId)&&Li(e.branch)&&(e.view==="files"||e.view==="changes"))return{kind:"code",experimentId:e.experimentId,branch:e.branch,view:e.view};break;case"plan":if(n("kind","sessionId","promptId")&&Li(e.sessionId)&&Li(e.promptId))return{kind:"plan",sessionId:e.sessionId,promptId:e.promptId};break;case"subagent":if(n("kind","sessionId","spawnPartId")&&Li(e.sessionId)&&Li(e.spawnPartId))return{kind:"subagent",sessionId:e.sessionId,spawnPartId:e.spawnPartId}}}function zd(e){if(e==="/projects")return{kind:"home"};const n=e.split("/");if(n[0]!==""||n[1]!=="projects"||!n[2])return null;let t,r;try{t=decodeURIComponent(n[2]),r=decodeURIComponent(n[4]??"")}catch{return null}const s=i=>i.length>0&&i!=="."&&i!==".."&&!/[\\/?#\u0000-\u001f\u007f-\u009f]/.test(i);return s(t)?n.length===3||n.length===4&&n[3]===""?{kind:"resume",projectId:t}:n.length===4&&n[3]==="skills"?{kind:"skills",projectId:t}:n.length===5&&n[3]==="tasks"&&s(r)?{kind:"task",projectId:t,...r==="new"?{}:{sessionId:r}}:n.length===5&&n[3]==="settings"&&u0t(r)?{kind:"settings",projectId:t,section:r}:null:null}function ib(e){if(typeof e!="string"||!e.startsWith("/")||e.startsWith("//")||/[\\#\u0000-\u001f\u007f-\u009f]/.test(e))return null;const n=e.indexOf("?"),t=n===-1?e:e.slice(0,n),r=n===-1?"":e.slice(n+1),s=zd(t);if(!s||s.kind==="resume")return null;const i=new URLSearchParams(r);if([...i.keys()].some(a=>a!=="pane")||i.getAll("pane").length>1)return null;if(i.has("pane"))try{if(!C6(JSON.parse(i.get("pane")??"")))return null}catch{return null}return e}function k1(e,n,t){const r=`/projects/${encodeURIComponent(e)}/tasks/${n?encodeURIComponent(n):"new"}`;return t?`${r}?${new URLSearchParams({pane:JSON.stringify(t)})}`:r}const dz=()=>({version:1,lastTaskId:null,lastLocation:null,tasks:{}});function CO(e,n){let t,r,s=!1,i=!1,a;async function o(l=!1){if(clearTimeout(a),i||(i=l),s||t===void 0)return;s=!0;const u=t;t=void 0;const _=i;i=!1;try{await e(u,_),r=void 0}catch(d){r=u,n(d)}finally{s=!1,t!==void 0&&o()}}return{queue(l,u=0){t=l,clearTimeout(a),a=setTimeout(()=>void o(),u)},flush:o,retry(){return!s&&t===void 0&&(t=r),o()}}}let lv=null,C0=0;const E6=()=>lv;function EO(){const e=C0;return CO(async(n,t)=>{if(e!==C0)return;const r=await out(n,t);e===C0&&tt.setQueryData(Xp().queryKey,s=>s?{...s,workspace:r.workspace}:r)},n=>{e===C0&&Vn(n instanceof Error?n.message:String(n),"error",{id:"workspace-save",action:{label:Fi(),onClick:()=>void ab.retry()}})})}let C1=EO();function f0t(){C0++,lv=null,C1=EO()}const ab={flush:(e=!1)=>C1.flush(e),retry:()=>C1.retry(),queue(e,n=0){const t=lv;t&&t.lastLocation===e.lastLocation&&t.railOpen===e.railOpen&&t.panelWidth===e.panelWidth&&t.experimentsView===e.experimentsView||(lv=e,C1.queue(e,n))}};window.addEventListener("pagehide",()=>void ab.flush(!0));function Rl(e,n){if(typeof e=="string")return{kind:"home",view:e};if("code"in e)return{kind:"code",experimentId:e.experimentId,branch:e.branch,view:e.view};if("kind"in e)return e.kind==="plan"?{kind:"plan",sessionId:e.sessionId,promptId:e.promptId}:{kind:"subagent",sessionId:e.sessionId,spawnPartId:e.spawnPartId};if("path"in e)return{kind:"file",path:e.path,source:e.source,sessionId:e.sessionId,ref:e.ref,line:e.line,branchLabel:e.branchLabel};const t=n===void 0?e.runId:n;return{kind:"experiment",experimentId:e.id,view:e.view,...t?{runId:t}:{}}}function Ua(e){switch(e.kind){case"home":return e.view;case"experiment":return{id:e.experimentId,view:e.view,...e.runId?{runId:e.runId}:{}};case"file":return{path:e.path,source:e.source,sessionId:e.sessionId,ref:e.ref,line:e.line,branchLabel:e.branchLabel};case"code":return{code:!0,experimentId:e.experimentId,branch:e.branch,view:e.view,toggled:new Set};case"plan":return{kind:"plan",sessionId:e.sessionId,promptId:e.promptId,plan:""};case"subagent":return{kind:"subagent",sessionId:e.sessionId,spawnPartId:e.spawnPartId}}}function NO(e,n,t){const r=[];e.filesTabOpen&&r.push("files"),e.artifactsTabOpen&&r.push("artifacts"),e.experimentsTabOpen&&r.push("experiments");const s=[...e.expTabs,...e.fileTabs,...e.planTabs,...e.subagentTabs,...e.codeTabs],i=new Map(s.map(u=>[Ct(u),u])),a=e.contentTabOrder.flatMap(u=>{const _=i.get(u);return _?[_]:[]}),o=Ct(e.rightTab);return{tabs:[...r,...a].map(u=>Rl(u,Ct(u)===o?e.selectedRunId:void 0)),active:e.panelOpen?Rl(e.rightTab,e.selectedRunId):null,previewKey:e.previewTab?Ct(e.previewTab):null,history:e.tabHistory.map(Ct),expanded:Object.fromEntries([["files",[...e.filesToggled]],...e.codeTabs.map(u=>[Ct(u),[...u.toggled]])]),scroll:n,sourceModes:t,filesView:e.filesView,scope:e.scope,panelMax:e.panelMax,treeViewport:e.treeViewport}}function h0t(e,n){const t=z6();e&&(t.filesView=e.filesView,t.filesToggled=new Set(e.expanded.files??[]),t.scope=e.scope,t.panelMax=e.panelMax,t.treeViewport=e.treeViewport??null);const r=[...(e==null?void 0:e.tabs)??[]];if(n){const i=r.findIndex(a=>Ct(Ua(a))===Ct(Ua(n)));i===-1?r.push(n):r[i]=n}for(const i of r){const a=Ua(i);if(typeof a=="string"){a==="experiments"&&(t.experimentsTabOpen=!0),a==="files"&&(t.filesTabOpen=!0),a==="artifacts"&&(t.artifactsTabOpen=!0);continue}"code"in a?(a.toggled=new Set((e==null?void 0:e.expanded[Ct(a)])??[]),t.codeTabs.push(a)):"path"in a?t.fileTabs.push(a):"kind"in a?a.kind==="plan"?t.planTabs.push(a):t.subagentTabs.push(a):t.expTabs.push(a),t.contentTabOrder.push(Ct(a))}const s=new Map(r.map(i=>{const a=Ua(i);return[Ct(a),a]}));return t.tabHistory=((e==null?void 0:e.history)??[]).flatMap(i=>{const a=s.get(i);return a?[a]:[]}),t.previewTab=e!=null&&e.previewKey?s.get(e.previewKey)??null:null,t.rightTab=n?Ua(n):e!=null&&e.active?Ua(e.active):"experiments",t.panelOpen=n!==void 0,t.selectedRunId=(n==null?void 0:n.kind)==="experiment"?n.runId??null:null,jO(t,n)}const Rx=(e,n)=>e.id===n.id&&e.view===n.view,Gu=(e,n)=>e.path===n.path&&(e.source??"repo")===(n.source??"repo")&&e.sessionId===n.sessionId&&e.ref===n.ref,N6=e=>`${e.source??"repo"}:${e.sessionId??""}:${e.ref??""}:${e.path}`,Es=(e,n,t)=>`${e}:${n??""}:${N6(t)}`,zO=e=>({...e,lineScrollRequest:void 0});function Ig(e){return typeof e=="object"&&"path"in e?zO(e):e}const Bf=(e,n)=>e.branch===n.branch;function Ct(e){return typeof e=="string"?`home:${e}`:"code"in e?`code:${e.branch}`:"kind"in e?e.kind==="plan"?`plan:${e.promptId}`:`subagent:${e.spawnPartId}`:"path"in e?`file:${N6(e)}`:`experiment:${e.id}:${e.view}`}function u0(e,n){const t=e.filter(r=>Ct(r)!==n);return t.length===e.length?e:t}function _0t(e){return e!==void 0}function z6(e,n=!1){const t={rightTab:"experiments",tabHistory:[],experimentsTabOpen:!1,filesTabOpen:!1,artifactsTabOpen:!1,expTabs:[],fileTabs:[],planTabs:[],subagentTabs:[],codeTabs:[],contentTabOrder:[],previewTab:null,filesView:"files",filesToggled:new Set,selectedRunId:null,scope:"project",panelOpen:!1,panelMax:!1,treeViewport:null};if(e===L0&&n){const r={path:w1,source:"artifacts"},s="experiments";return{...t,rightTab:s,tabHistory:[r,s],experimentsTabOpen:!0,fileTabs:[r],contentTabOrder:[Ct(r)],panelOpen:!0}}if(e===h6){const r=[{path:"nanochat-base-training-curves.svg",source:"artifacts"},{path:"nanochat-sft-training-curves.svg",source:"artifacts"},{path:"nanochat-training-throughput.svg",source:"artifacts"},{path:"nanochat-core-evaluation.svg",source:"artifacts"}];return{...t,rightTab:r[0],tabHistory:[...r.slice(1),r[0]],fileTabs:r,contentTabOrder:r.map(Ct),panelOpen:!0}}if(e===_6){const r=[{path:"nanochat-bottleneck-diagnosis.md",source:"artifacts"}];return{...t,rightTab:r[0],tabHistory:[r[0]],fileTabs:r,contentTabOrder:r.map(Ct),panelOpen:!0}}return t}function j6(e,n){const t=z6(e,n);return t.panelOpen?NO(t,{},{}):void 0}function jO(e,n){if(!n)return e;const t=Ua(n),r=Ct(t),s=[...e.expTabs,...e.fileTabs,...e.codeTabs,...e.planTabs,...e.subagentTabs].find(l=>Ct(l)===r),i=(l,u)=>{const _=l.findIndex(d=>Ct(d)===r);return _<0?[...l,u]:JSON.stringify(Rl(l[_]))===JSON.stringify(Rl(u))?l:l.map((d,p)=>p===_?{...d,...u}:d)},a={...e};typeof t=="string"?t==="files"?a.filesTabOpen=!0:t==="artifacts"?a.artifactsTabOpen=!0:a.experimentsTabOpen=!0:("path"in t?a.fileTabs=i(e.fileTabs,t):"id"in t?a.expTabs=i(e.expTabs,{...t,runId:n.kind==="experiment"?n.runId:void 0}):"code"in t?a.codeTabs=i(e.codeTabs,{...t,toggled:s&&"code"in s?s.toggled:t.toggled}):t.kind==="plan"?a.planTabs=i(e.planTabs,t):a.subagentTabs=i(e.subagentTabs,t),e.contentTabOrder.includes(r)||(a.contentTabOrder=[...e.contentTabOrder,r]));const o=e.tabHistory.at(-1);return o&&Ct(o)===r&&JSON.stringify(Rl(o))===JSON.stringify(Rl(t))||(a.tabHistory=[...e.tabHistory.filter(l=>Ct(l)!==r),t]),a}let Ga=0;const sp=new Map,cv=new Map,Q4=new Set,Y4=()=>{for(const e of Q4)e()},p0t=e=>(Q4.add(e),()=>{Q4.delete(e)}),ip=new Map,Wa=new Map,TO=e=>Wa.get(e);function m0t(){Ga++,Wa.clear(),ip.clear(),sp.clear(),cv.clear(),Y4()}function g0t(e,n){const t=Wa.get(e);if(!(t!=null&&t.tasks.new)||Jc(t,n))return;const r=t.tasks.new,s=a=>Object.fromEntries(r.tabs.flatMap(o=>{if(o.kind!=="file")return[];const l=Ua(o);if(typeof l=="string"||!("path"in l))return[];const u=Es(e,null,l);return u in a?[[Es(e,n,l),a[u]]]:[]})),i={...t.tasks,[n]:{...r,scroll:s(r.scroll),sourceModes:s(r.sourceModes)}};delete i.new,ip.set(e,n),Wa.set(e,{...t,tasks:i})}function v0t(e){let n=sp.get(e);if(!n){const t=Ga;n=CO(async(r,s)=>{if(t!==Ga)return;const i=await aut(e,r,s);t===Ga&&tt.setQueryData(g6(e).queryKey,i),t===Ga&&cv.delete(e)&&Y4()},r=>{t===Ga&&(cv.set(e,r instanceof Error?r.message:String(r)),Y4())}),sp.set(e,n)}return n}function Mx(e,n,t,r){const s=Wa.get(e);if(!s||t==="new"&&ip.has(e))return;const i=ib(n)??s.lastLocation,a=t?t==="new"?null:t:s.lastTaskId,o=t?Jc(s,t):void 0;if(i===s.lastLocation&&a===s.lastTaskId&&(!r||JSON.stringify(r)===JSON.stringify(o)))return;const l={...s,lastLocation:i,lastTaskId:a,tasks:t&&r?{...s.tasks,[t]:r}:s.tasks},u=o&&r&&i===s.lastLocation&&JSON.stringify({...o,scroll:{},sourceModes:{}})===JSON.stringify({...r,scroll:{},sourceModes:{}});Wa.set(e,l),v0t(e).queue(l,u?250:0)}function fz(e,n,t,r){const s=new Set(e.state.fileTabs.map(_=>Es(t,r==="new"?null:r,_))),i=Object.fromEntries(Object.entries(e.getScroll()).filter(([_])=>s.has(_))),a=Object.fromEntries(Object.entries(e.sourceModes).filter(([_])=>s.has(_))),o=NO(e.state,i,a),l=e.pane??(n==null?void 0:n.active),u=l?Ct(Ua(l)):null;return o.active=o.tabs.find(_=>Ct(Ua(_))===u)??null,o}function b0t(e){const{projectId:n,taskKey:t,location:r,pane:s,isTask:i,demoOverview:a,state:o,apply:l,getScroll:u,sourceModes:_,revision:d}=e,p=R.useRef(dz()),m=R.useSyncExternalStore(p0t,()=>n?cv.get(n)??null:null),[x,S]=R.useState(null),[v,b]=R.useState(0),[w,y]=R.useState(null),[C,E]=R.useState(null),N=R.useRef(null),T=R.useRef(null),z=R.useRef(null),M=R.useRef(e);M.current=e;const I=JSON.stringify([n,t,i]),B=JSON.stringify(s??null),$=R.useCallback(()=>{const H=z.current;if(!H)return;const Y=fz({...M.current,state:H.state,pane:H.pane},Jc(Wa.get(H.projectId),H.taskKey),H.projectId,H.taskKey);Mx(H.projectId,H.location,H.taskKey,Y)},[]);R.useEffect(()=>{let H=!0;const Y=Ga;if(S(null),y(null),!!n)return Wa.has(n)?y(n):tt.fetchQuery(g6(n)).then(V=>{!H||Y!==Ga||(Wa.set(n,V??dz()),y(n))}).catch(V=>{H&&Y===Ga&&S(V instanceof Error?V.message:String(V))}),()=>{H=!1}},[n,v]),R.useLayoutEffect(()=>{if(z.current&&z.current.scope!==I){const V=z.current.projectId;$(),ip.get(V)===t&&ip.delete(V),z.current=null}if(!n||w!==n)return;const H=Wa.get(n);if(!H)return;if(p.current=H,N.current!==I){if(N.current=I,T.current=B,i){const V=Jc(H,t)??(Ic(n)?j6(t,a):void 0);l(h0t(V,s),V,!0)}E(I);return}if(C!==I)return;let Y=o;T.current!==B&&(T.current=B,i&&s&&(Y=jO(o,s),l(Y,void 0,!1))),i?(Mx(n,r,t,fz({state:Y,pane:s,getScroll:u,sourceModes:_},Jc(H,t),n,t)),z.current={projectId:n,taskKey:t,scope:I,location:r,pane:s,state:Y}):Mx(n,r),p.current=Wa.get(n)??H},[n,t,r,s,B,i,a,o,l,u,_,d,w,I,C,$]),R.useEffect(()=>{const H=Ga,Y=X=>{if(H===Ga){$();for(const ee of sp.values())ee.flush(X)}},V=()=>Y(!0);return window.addEventListener("pagehide",V),()=>{window.removeEventListener("pagehide",V),Y(!1)}},[$]);const U=R.useCallback(()=>{var H;n&&(x?b(Y=>Y+1):(H=sp.get(n))==null||H.retry())},[n,x]);return{ready:n===null||w===n&&C===I,loaded:n===null||w===n,error:x??m,retry:U,capture:$,workspace:p}}const y0t="data:image/svg+xml,"+encodeURIComponent(''),X4=R.createContext(null);function x0t(e){var n;return e.kind==="local"?"local":`${e.session.id}:${((n=e.session.installPaths)==null?void 0:n.database)??""}`}function AO(){const e=R.useContext(X4);if(!e)throw new Error("Runtime is not connected");return e}function w0t(e){const n=document.querySelector('link[rel="icon"]');n&&(n.href=e?y0t:"/favicon.svg")}function hz(e){try{return localStorage.getItem(e)!==null}catch{return!1}}function S0t(e){if(e.kind!=="ssh")return;const{theme:n,locale:t}=e.session.uiPreferences;!hz("orx:theme")&&(n==="light"||n==="dark"||n==="system")&&tO(n),!hz("orx:locale")&&t&&cD(t)&&JL(t)}function k0t(e){return e.includes("ssh ")&&e.includes("failed")}function _z({host:e,overlay:n=!1}){return f.jsx("div",{className:n?"w-full max-w-2xl":"app flex h-full items-center justify-center bg-background p-6",children:f.jsxs("section",{className:"w-full max-w-2xl rounded-xl border border-border bg-background p-7 shadow-modal",children:[f.jsx("h1",{id:"remote-setup-title",className:"m-0 text-2xl font-semibold text-text",children:JD({host:Ne(e)})}),f.jsx("p",{className:"mt-2 mb-0 text-base text-text",children:E4()}),f.jsx("p",{className:"mt-2 mb-0 text-sm text-subtext",children:uDe()})]})})}function pz({runtime:e,overlay:n=!1,retriedInteractiveError:t,setRetriedInteractiveError:r}){var M,I,B;const{session:s}=e,[i,a]=R.useState(s.installPaths),[o,l]=R.useState(!1),[u,_]=R.useState(null);R.useEffect(()=>a(s.installPaths),[(M=s.installPaths)==null?void 0:M.binary,(I=s.installPaths)==null?void 0:I.database,(B=s.installPaths)==null?void 0:B.cache]);async function d(){if(i){l(!0);try{await ydt(i)}catch($){Vn($ instanceof Error?$.message:String($),"error")}finally{l(!1)}}}async function p($=!1){r($?s.error:null),l(!0);try{await xdt()}catch(U){Vn(U instanceof Error?U.message:String(U),"error")}finally{l(!1)}}async function m(){l(!0);try{await IL()}catch($){Vn($ instanceof Error?$.message:String($),"error")}finally{l(!1)}}async function x(){l(!0);try{_(await BL())}catch($){Vn($ instanceof Error?$.message:String($),"error")}finally{l(!1)}}async function S(){if(u){l(!0);try{await $L(u),_(null)}catch($){_(null),Vn($ instanceof Error?$.message:String($),"error")}finally{l(!1)}}}async function v(){l(!0);try{await wdt()}catch($){Vn($ instanceof Error?$.message:String($),"error")}finally{l(!1)}}const b=s.status==="applying"||o,w=s.status==="needsInstall",y=s.status==="needsUpdate",C=i&&w,E=["connecting","applying","reconnecting"].includes(s.status),N=s.status==="disconnected"&&s.error!==null&&k0t(s.error)&&t!==s.error&&!s.canStartNewHost,T=w?DDe():y?GOe():s.status==="applying"?mMe({host:Ne(s.host)}):s.status==="reconnecting"?bLe({host:Ne(s.host)}):s.status==="disconnected"?s.error?aDe({host:Ne(s.host)}):s.canStartNewHost?vDe({host:Ne(s.host)}):JD({host:Ne(s.host)}):LMe({host:Ne(s.host)}),z=s.error??(s.canStartNewHost?_De():w?WDe({user:Ne(s.user??""),host:Ne(s.host)}):y?FOe({host:Ne(s.host)}):s.status==="applying"?fMe():s.status==="reconnecting"?pLe():s.status==="disconnected"?JMe():AMe());return f.jsxs(f.Fragment,{children:[f.jsx("main",{className:n?"w-full max-w-2xl":"app flex h-full items-center justify-center bg-background p-6",children:f.jsxs("section",{className:"w-full max-w-2xl rounded-xl border border-border bg-background p-7 shadow-modal",children:[f.jsxs("div",{className:"flex items-start gap-3",children:[E&&f.jsx(Lt,{className:"mt-2"}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("h1",{id:"remote-setup-title",className:"m-0 text-2xl font-semibold text-text",children:T}),!N&&f.jsx("p",{className:"mt-2 mb-0 text-base text-text",children:z})]})]}),N&&f.jsx(k6,{host:s.host,backend:"ssh",path:"/_orx/ssh/connect",onComplete:()=>void p(!0)}),C&&f.jsxs("div",{className:"mt-6 grid gap-4 border-t border-border-variant pt-5",children:[f.jsx("p",{className:"m-0 text-sm text-subtext",children:TDe()}),[["binary",wDe()],["database",EDe()]].map(([$,U])=>f.jsxs("label",{className:"grid gap-1 text-sm font-medium text-subtext",children:[U,f.jsx(ns,{value:i[$],onChange:H=>a({...i,[$]:H.target.value}),disabled:b,dir:"ltr"})]},$)),!s.error&&f.jsx("div",{className:"flex justify-end pt-1",children:f.jsx(Le,{variant:"primary",disabled:b,onClick:()=>void d(),children:b?f.jsxs(f.Fragment,{children:[f.jsx(Lt,{})," ",BDe()]}):y?SN():fL()})})]}),y&&i&&f.jsx("div",{className:"mt-6 flex justify-end",children:!s.error&&f.jsx(Le,{variant:"primary",disabled:b,onClick:()=>void d(),children:b?f.jsxs(f.Fragment,{children:[f.jsx(Lt,{})," ",QOe()]}):SN()})}),s.status==="disconnected"&&f.jsx("div",{className:"mt-6 flex justify-end border-t border-border-variant pt-5",children:s.canStartNewHost?f.jsxs(Le,{variant:"primary",disabled:o,onClick:()=>void v(),children:[o?f.jsx(Lt,{}):null,s.error?xN():jLe()]}):f.jsxs(Le,{variant:"primary",disabled:o,onClick:()=>void p(),children:[o?f.jsx(Lt,{}):null,xN()]})}),(s.status==="connecting"||s.status==="reconnecting")&&f.jsx("div",{className:"mt-6 flex justify-end border-t border-border-variant pt-5",children:f.jsx(Le,{disabled:o,onClick:()=>void m(),children:j4()})}),y&&s.error&&f.jsxs("div",{className:"mt-6 flex justify-end gap-2 border-t border-border-variant pt-5",children:[f.jsx(Le,{disabled:o,onClick:()=>void m(),children:j4()}),s.installPaths!==null&&(s.dashboardProtocol===null||s.dashboardProtocolvoid p(),children:[o?f.jsx(Lt,{}):null,yN()]}),s.installPaths===null&&s.dashboardProtocol!==null&&s.dashboardProtocolvoid x(),children:[o?f.jsx(Lt,{}):null,eL()]})]}),w&&s.error&&f.jsx("div",{className:"mt-6 flex justify-end",children:f.jsxs(Le,{variant:"primary",disabled:o,onClick:()=>void p(),children:[o?f.jsx(Lt,{}):null,yN()]})})]})}),u&&f.jsx(yO,{host:s.host,preview:u,currentClientAttached:!1,stopping:o,onClose:()=>{o||_(null)},onConfirm:()=>void S()})]})}function C0t({children:e}){const n=R.useRef(null);return R.useEffect(()=>{var t;return(t=n.current)==null?void 0:t.focus()},[]),f.jsx("div",{ref:n,role:"alertdialog","aria-modal":"true","aria-labelledby":"remote-setup-title",tabIndex:-1,className:"absolute inset-0 z-100 flex items-center justify-center bg-modal-backdrop p-6",children:e})}function E0t(){R.useSyncExternalStore(h9,BG),R.useEffect(()=>h9(()=>{f0t(),m0t()}),[]);const e=qV({select:x=>x.pathname==="/remote-launch"}),[n,t]=R.useState(null),[r,s]=R.useState(null),i=R.useRef(!1),a=R.useRef(!1),o=R.useRef(!1),l=R.useRef(null),[u,_]=R.useState(null),d=ot({...Mft(),enabled:!e,refetchInterval:x=>{var S;return x.state.status==="error"||((S=x.state.data)==null?void 0:S.kind)==="ssh"?2e3:!1},refetchIntervalInBackground:!0});if(R.useEffect(()=>{var v,b;if(e)return;const x=d.data;if(!x){s(((v=d.error)==null?void 0:v.message)??null);return}const S=x0t(x);$G(S),l.current!==null&&l.current!==S&&(i.current=!1,a.current=!1,o.current=!1),l.current=S,x.kind==="ssh"&&(o.current||(o.current=!0,S0t(x)),x.session.status==="connected"?(i.current=!0,a.current=!0,_(null)):x.session.status==="disconnected"&&x.session.error===null&&(a.current=!1)),t(x),s(((b=d.error)==null?void 0:b.message)??null)},[e,d.data,d.error]),R.useEffect(()=>{const x=(n==null?void 0:n.kind)==="ssh";w0t(x),x&&(!i.current||n.session.status==="disconnected"&&!n.session.error)&&(document.title="OpenResearch")},[n]),e)return f.jsxs("main",{className:"app flex h-full items-center justify-center gap-3 bg-background text-base text-text",children:[f.jsx(Lt,{})," ",lLe()]});if(!n)return f.jsx("main",{className:"app flex h-full items-center justify-center gap-3 bg-background text-base text-text",children:r?f.jsxs(f.Fragment,{children:[f.jsx("span",{children:r}),f.jsx(Le,{onClick:()=>location.reload(),children:Fi()})]}):f.jsx(Lt,{})});if(n.kind==="local")return f.jsxs(X4,{value:n,children:[f.jsx(YN,{}),f.jsx(X0,{})]},Sa()[1]);if(!(a.current&&(n.session.status!=="disconnected"||n.session.error!==null))&&n.session.status!=="connected")return r?f.jsx(_z,{host:n.session.host}):f.jsx(pz,{runtime:n,retriedInteractiveError:u,setRetriedInteractiveError:_});const m=n.session.status!=="connected"||r!==null;return f.jsxs("div",{className:"relative h-full",children:[f.jsx("div",{className:"h-full",inert:m,children:f.jsxs(X4,{value:n,children:[f.jsx(YN,{}),f.jsx(X0,{})]},Sa()[1])}),m&&f.jsx(C0t,{children:r?f.jsx(_z,{host:n.session.host,overlay:!0}):f.jsx(pz,{runtime:n,overlay:!0,retriedInteractiveError:u,setRetriedInteractiveError:_})})]})}const ob=EV()({component:E0t}),T6="orx:demo-read-sessions";function RO(){try{const e=JSON.parse(sessionStorage.getItem(T6)??"[]");return new Set(Array.isArray(e)?e.filter(n=>typeof n=="string"):[])}catch{return new Set}}function N0t(e){try{const n=RO();n.add(e),sessionStorage.setItem(T6,JSON.stringify([...n]))}catch{}}function z0t(){try{sessionStorage.removeItem(T6)}catch{}}function MO(e,n){const t=zd(e.split("?")[0]);return!!(t&&(!t.sessionId||n.some(r=>r.id===t.sessionId&&r.projectId===t.projectId)))}async function j0t(e=tt){var i;const[n,t]=await Promise.all([e.fetchQuery(Xp()),e.fetchQuery(rp())]),r=ib((i=E6()??n.workspace)==null?void 0:i.lastLocation);if(!r)return"/projects";const s=zd(r.split("?")[0]);return!(s!=null&&s.projectId)||!t.some(a=>a.id===s.projectId)||s.sessionId&&!MO(r,await e.fetchQuery(xa(s.projectId)))?"/projects":r}async function T0t(e,n=tt){var _;const[t,r]=await Promise.all([n.fetchQuery(g6(e)),n.fetchQuery(xa(e))]),s=TO(e)??t,i=ib(s==null?void 0:s.lastLocation);if(i&&((_=zd(i.split("?")[0]))==null?void 0:_.projectId)===e&&MO(i,r))return i;const a=r.find(d=>!d.archived),o=Ic(e)?j6(a==null?void 0:a.id,!(await n.fetchQuery(Xp())).tourCompleted):void 0,l=Jc(s,(a==null?void 0:a.id)??"new"),u=l?l.active:o==null?void 0:o.active;return k1(e,(a==null?void 0:a.id)??null,u)}/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. @@ -120,415 +120,415 @@ WARNING: This link could potentially be dangerous`)){const b=window.open();if(b) * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const st=(e,n)=>{const t=R.forwardRef(({className:r,...s},i)=>R.createElement(O0t,{ref:i,iconNode:n,className:DO(`lucide-${A0t(mz(e))}`,`lucide-${e}`,r),...s}));return t.displayName=mz(e),t};/** + */const rt=(e,n)=>{const t=R.forwardRef(({className:r,...s},i)=>R.createElement(O0t,{ref:i,iconNode:n,className:DO(`lucide-${A0t(mz(e))}`,`lucide-${e}`,r),...s}));return t.displayName=mz(e),t};/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const I0t=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],B0t=st("arrow-down",I0t);/** + */const I0t=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],B0t=rt("arrow-down",I0t);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $0t=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ap=st("arrow-left",$0t);/** + */const $0t=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ap=rt("arrow-left",$0t);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const P0t=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],E1=st("arrow-right",P0t);/** + */const P0t=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],E1=rt("arrow-right",P0t);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const F0t=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],H0t=st("arrow-up-right",F0t);/** + */const F0t=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],H0t=rt("arrow-up-right",F0t);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const q0t=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],LO=st("blocks",q0t);/** + */const q0t=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],LO=rt("blocks",q0t);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const U0t=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],OO=st("book-open",U0t);/** + */const U0t=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],OO=rt("book-open",U0t);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const G0t=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],W0t=st("calendar-days",G0t);/** + */const G0t=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],W0t=rt("calendar-days",G0t);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const V0t=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16c.5-2 1.5-7 4-7 2 0 2 3 4 3 2.5 0 4.5-5 5-7",key:"lw07rv"}]],K0t=st("chart-spline",V0t);/** + */const V0t=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16c.5-2 1.5-7 4-7 2 0 2 3 4 3 2.5 0 4.5-5 5-7",key:"lw07rv"}]],K0t=rt("chart-spline",V0t);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Q0t=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Na=st("check",Q0t);/** + */const Q0t=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],wa=rt("check",Q0t);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Y0t=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qo=st("chevron-down",Y0t);/** + */const Y0t=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qo=rt("chevron-down",Y0t);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const X0t=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],IO=st("chevron-left",X0t);/** + */const X0t=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],IO=rt("chevron-left",X0t);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Z0t=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ta=st("chevron-right",Z0t);/** + */const Z0t=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ca=rt("chevron-right",Z0t);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const J0t=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],BO=st("circle-alert",J0t);/** + */const J0t=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],BO=rt("circle-alert",J0t);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ept=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],tpt=st("circle-question-mark",ept);/** + */const ept=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],tpt=rt("circle-question-mark",ept);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const npt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],$O=st("circle-stop",npt);/** + */const npt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],$O=rt("circle-stop",npt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rpt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],PO=st("circle-x",rpt);/** + */const rpt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],PO=rt("circle-x",rpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const spt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],ipt=st("clock-3",spt);/** + */const spt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]],ipt=rt("clock-3",spt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const apt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],opt=st("clock",apt);/** + */const apt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],opt=rt("clock",apt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lpt=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],cpt=st("cloud-upload",lpt);/** + */const lpt=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],cpt=rt("cloud-upload",lpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const upt=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Z4=st("code",upt);/** + */const upt=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Z4=rt("code",upt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dpt=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],cb=st("copy",dpt);/** + */const dpt=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],lb=rt("copy",dpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fpt=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],FO=st("corner-down-left",fpt);/** + */const fpt=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],FO=rt("corner-down-left",fpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hpt=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],HO=st("cpu",hpt);/** + */const hpt=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],HO=rt("cpu",hpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _pt=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],ppt=st("download",_pt);/** + */const _pt=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],ppt=rt("download",_pt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mpt=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],A6=st("ellipsis",mpt);/** + */const mpt=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],A6=rt("ellipsis",mpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gpt=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Md=st("external-link",gpt);/** + */const gpt=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],jd=rt("external-link",gpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vpt=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],qO=st("file-code",vpt);/** + */const vpt=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],qO=rt("file-code",vpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bpt=[["path",{d:"M4.226 20.925A2 2 0 0 0 6 22h12a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v3.127",key:"wfxp4w"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]],ypt=st("file-output",bpt);/** + */const bpt=[["path",{d:"M4.226 20.925A2 2 0 0 0 6 22h12a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v3.127",key:"wfxp4w"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]],ypt=rt("file-output",bpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xpt=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ub=st("file-text",xpt);/** + */const xpt=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],cb=rt("file-text",xpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wpt=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],db=st("flask-conical",wpt);/** + */const wpt=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],ub=rt("flask-conical",wpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Spt=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],UO=st("folder-git-2",Spt);/** + */const Spt=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],UO=rt("folder-git-2",Spt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kpt=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Dd=st("folder-open",kpt);/** + */const kpt=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Td=rt("folder-open",kpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Cpt=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Ept=st("folder-plus",Cpt);/** + */const Cpt=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Ept=rt("folder-plus",Cpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Npt=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],fb=st("folder-tree",Npt);/** + */const Npt=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],db=rt("folder-tree",Npt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zpt=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],jpt=st("funnel",zpt);/** + */const zpt=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],jpt=rt("funnel",zpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Tpt=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Apt=st("gauge",Tpt);/** + */const Tpt=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Apt=rt("gauge",Tpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Rpt=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Jp=st("git-branch",Rpt);/** + */const Rpt=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Jp=rt("git-branch",Rpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Mpt=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],Dpt=st("git-commit-horizontal",Mpt);/** + */const Mpt=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],Dpt=rt("git-commit-horizontal",Mpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Lpt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Opt=st("globe",Lpt);/** + */const Lpt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Opt=rt("globe",Lpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ipt=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Bpt=st("history",Ipt);/** + */const Ipt=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Bpt=rt("history",Ipt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $pt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],R6=st("info",$pt);/** + */const $pt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],R6=rt("info",$pt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ppt=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],Fpt=st("laptop",Ppt);/** + */const Ppt=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],Fpt=rt("laptop",Ppt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Hpt=[["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",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],qpt=st("lightbulb",Hpt);/** + */const Hpt=[["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",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],qpt=rt("lightbulb",Hpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Upt=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],GO=st("link-2",Upt);/** + */const Upt=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],GO=rt("link-2",Upt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Gpt=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],WO=st("list-checks",Gpt);/** + */const Gpt=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],WO=rt("list-checks",Gpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Wpt=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],gz=st("lock",Wpt);/** + */const Wpt=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],gz=rt("lock",Wpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Vpt=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Kpt=st("maximize-2",Vpt);/** + */const Vpt=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Kpt=rt("maximize-2",Vpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Qpt=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],VO=st("message-square-quote",Qpt);/** + */const Qpt=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],VO=rt("message-square-quote",Qpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ypt=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Xpt=st("minimize-2",Ypt);/** + */const Ypt=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Xpt=rt("minimize-2",Ypt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Zpt=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Jpt=st("monitor",Zpt);/** + */const Zpt=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Jpt=rt("monitor",Zpt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const emt=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],tmt=st("moon",emt);/** + */const emt=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],tmt=rt("moon",emt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nmt=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],rmt=st("mouse-pointer-click",nmt);/** + */const nmt=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],rmt=rt("mouse-pointer-click",nmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const smt=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],M6=st("package",smt);/** + */const smt=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],M6=rt("package",smt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const imt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],KO=st("panel-left",imt);/** + */const imt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],KO=rt("panel-left",imt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const amt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],QO=st("panel-right",amt);/** + */const amt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],QO=rt("panel-right",amt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const omt=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],lmt=st("paperclip",omt);/** + */const omt=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],lmt=rt("paperclip",omt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cmt=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],D6=st("pencil",cmt);/** + */const cmt=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],D6=rt("pencil",cmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const umt=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],em=st("plus",umt);/** + */const umt=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],em=rt("plus",umt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dmt=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Aa=st("refresh-cw",dmt);/** + */const dmt=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Ea=rt("refresh-cw",dmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fmt=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],hmt=st("rotate-cw",fmt);/** + */const fmt=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],hmt=rt("rotate-cw",fmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _mt=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],L6=st("scroll-text",_mt);/** + */const _mt=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],L6=rt("scroll-text",_mt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pmt=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],YO=st("search",pmt);/** + */const pmt=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],YO=rt("search",pmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mmt=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],vz=st("server",mmt);/** + */const mmt=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],vz=rt("server",mmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gmt=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],XO=st("settings",gmt);/** + */const gmt=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],XO=rt("settings",gmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vmt=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],ZO=st("sliders-horizontal",vmt);/** + */const vmt=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],ZO=rt("sliders-horizontal",vmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bmt=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],c_=st("square-terminal",bmt);/** + */const bmt=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],i_=rt("square-terminal",bmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ymt=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],xmt=st("sun",ymt);/** + */const ymt=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],xmt=rt("sun",ymt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wmt=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],qh=st("terminal",wmt);/** + */const wmt=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],$h=rt("terminal",wmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Smt=[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],kmt=st("toggle-right",Smt);/** + */const Smt=[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],kmt=rt("toggle-right",Smt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Cmt=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Xd=st("trash-2",Cmt);/** + */const Cmt=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Vd=rt("trash-2",Cmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Emt=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],O6=st("triangle-alert",Emt);/** + */const Emt=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],O6=rt("triangle-alert",Emt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Nmt=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],zmt=st("upload",Nmt);/** + */const Nmt=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],zmt=rt("upload",Nmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jmt=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],I6=st("users",jmt);/** + */const jmt=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],I6=rt("users",jmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Tmt=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],JO=st("wand-sparkles",Tmt);/** + */const Tmt=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],JO=rt("wand-sparkles",Tmt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Amt=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],qr=st("x",Amt);/** + */const Amt=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],qr=rt("x",Amt);/** * @license lucide-react v1.23.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Rmt=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Mmt=st("zap",Rmt);function B6(){return f.jsxs("svg",{viewBox:"0 0 100 100","aria-hidden":"true",children:[f.jsx("rect",{width:"100",height:"100",rx:"8",fill:"#9a2036"}),f.jsx("path",{d:"M15.375 16.782v63.843a4 4 0 0 0 4 4h63.843c3.564 0 5.348-4.309 2.829-6.828L22.203 13.953c-2.52-2.52-6.828-.735-6.828 2.829",fill:"#fff"})]})}function Lx(){return f.jsxs("span",{className:"wordmark inline-flex items-center gap-[0.4em] text-text [&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:shrink-0",children:[f.jsx(B6,{}),"OpenResearch"]})}function Dmt({cmd:e}){const[n,t]=R.useState(!1);return f.jsxs("span",{className:"cmd-inline inline-flex items-center gap-1 align-baseline",children:[f.jsx("code",{className:"font-mono text-sm",children:e}),f.jsx("button",{type:"button",className:"cmd-inline-copy inline-flex items-center p-0.5 border-0 rounded-xs bg-none bg-transparent text-muted cursor-pointer [&:hover]:bg-surface [&:hover]:text-text",onClick:()=>{navigator.clipboard.writeText(e).then(()=>{t(!0),setTimeout(()=>t(!1),1500)}).catch(()=>{})},"aria-label":n?tp():PK({value:Ne(e)}),title:n?tp():n6(),children:n?f.jsx(Na,{size:11,strokeWidth:3}):f.jsx(cb,{size:11})})]})}function tm(e){return e?e.split(/`([^`]+)`/).map((n,t)=>t%2===1?f.jsx(Dmt,{cmd:n},t):n):null}function J4({harness:e,size:n=16}){const t="block shrink-0";return e==="claude-code"?f.jsx("svg",{className:t,width:n,height:n,viewBox:"0 0 24 24",fill:"#d97757","aria-hidden":"true",children:f.jsx("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"})}):e==="opencode"?f.jsx("svg",{className:t,width:n,height:n,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:f.jsx("path",{d:"M22 24H2V0h20zM17 4.8H7v14.4h10z"})}):e==="cursor"?f.jsxs("svg",{className:t,width:n,height:n,viewBox:"388 395 191 191",fill:"none","aria-hidden":"true",children:[f.jsx("path",{fill:"#72716D",d:"M483.395 490.5L566 538.297C565.493 539.178 564.757 539.93 563.845 540.456L486.636 585.13C484.632 586.29 482.159 586.29 480.154 585.13L402.945 540.456C402.034 539.93 401.297 539.178 400.79 538.297L483.395 490.5Z"}),f.jsx("path",{fill:"#55544F",d:"M483.395 395V490.5L400.79 538.297C400.282 537.416 400 536.398 400 535.346V445.654C400 443.545 401.122 441.6 402.945 440.544L480.15 395.87C481.154 395.29 482.273 395 483.391 395H483.395Z"}),f.jsx("path",{fill:"#43413C",d:"M565.996 442.703C565.489 441.822 564.752 441.07 563.841 440.544L486.632 395.87C485.632 395.29 484.513 395 483.395 395V490.5L566 538.297C566.507 537.416 566.789 536.398 566.789 535.346V445.654C566.789 444.598 566.511 443.588 566 442.703H565.996Z"}),f.jsx("path",{fill:"#D6D5D2",d:"M560.218 446.049C560.686 446.858 560.751 447.896 560.218 448.82L485.235 578.974C484.732 579.855 483.392 579.493 483.392 578.479V492.713C483.392 492.029 483.209 491.37 482.877 490.794L560.215 446.045H560.218V446.049Z"}),f.jsx("path",{fill:"#FFFFFF",d:"M560.218 446.049L482.88 490.797C482.552 490.224 482.073 489.737 481.48 489.394L407.369 446.511C406.49 446.006 406.851 444.663 407.862 444.663H557.824C558.889 444.663 559.754 445.239 560.218 446.049Z"})]}):f.jsx("svg",{className:t,width:n,height:n,viewBox:"146 227 268 265",fill:"currentColor","aria-hidden":"true",children:f.jsx("path",{d:"M249.176 323.434V298.276C249.176 296.158 249.971 294.569 251.825 293.509L302.406 264.381C309.29 260.409 317.5 258.555 325.973 258.555C357.75 258.555 377.877 283.185 377.877 309.399C377.877 311.253 377.877 313.371 377.611 315.49L325.178 284.771C322.001 282.919 318.822 282.919 315.645 284.771L249.176 323.434ZM367.283 421.415V361.301C367.283 357.592 365.694 354.945 362.516 353.092L296.048 314.43L317.763 301.982C319.617 300.925 321.206 300.925 323.058 301.982L373.639 331.112C388.205 339.586 398.003 357.592 398.003 375.069C398.003 395.195 386.087 413.733 367.283 421.412V421.415ZM233.553 368.452L211.838 355.742C209.986 354.684 209.19 353.095 209.19 350.975V292.718C209.19 264.383 230.905 242.932 260.301 242.932C271.423 242.932 281.748 246.641 290.49 253.26L238.321 283.449C235.146 285.303 233.555 287.951 233.555 291.659V368.455L233.553 368.452ZM280.292 395.462L249.176 377.985V340.913L280.292 323.436L311.407 340.913V377.985L280.292 395.462ZM300.286 475.968C289.163 475.968 278.837 472.259 270.097 465.64L322.264 435.449C325.441 433.597 327.03 430.949 327.03 427.239V350.445L349.011 363.155C350.865 364.213 351.66 365.802 351.66 367.922V426.179C351.66 454.514 329.679 475.965 300.286 475.965V475.968ZM237.525 416.915L186.944 387.785C172.378 379.31 162.582 361.305 162.582 343.827C162.582 323.436 174.763 305.164 193.563 297.485V357.861C193.563 361.571 195.154 364.217 198.33 366.071L264.535 404.467L242.82 416.915C240.967 417.972 239.377 417.972 237.525 416.915ZM234.614 460.343C204.689 460.343 182.71 437.833 182.71 410.028C182.71 407.91 182.976 405.792 183.238 403.672L235.405 433.863C238.582 435.715 241.763 435.715 244.938 433.863L311.407 395.466V420.622C311.407 422.742 310.612 424.331 308.758 425.389L258.179 454.519C251.293 458.491 243.083 460.343 234.611 460.343H234.614ZM300.286 491.854C332.329 491.854 359.073 469.082 365.167 438.892C394.825 431.211 413.892 403.406 413.892 375.073C413.892 356.535 405.948 338.529 391.648 325.552C392.972 319.991 393.766 314.43 393.766 308.87C393.766 271.003 363.048 242.666 327.562 242.666C320.413 242.666 313.528 243.723 306.644 246.109C294.725 234.457 278.307 227.042 260.301 227.042C228.258 227.042 201.513 249.815 195.42 280.004C165.761 287.685 146.694 315.49 146.694 343.824C146.694 362.362 154.638 380.368 168.938 393.344C167.613 398.906 166.819 404.467 166.819 410.027C166.819 447.894 197.538 476.231 233.024 476.231C240.172 476.231 247.058 475.173 253.943 472.788C265.859 484.441 282.278 491.854 300.286 491.854Z"})})}const eI="data:image/svg+xml,%3csvg%20width='512'%20height='512'%20viewBox='0%200%20512%20512'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%20179.2C0%20116.474%200%2085.1112%2012.2073%2061.1531C22.9451%2040.0789%2040.0789%2022.9451%2061.1531%2012.2073C85.1112%200%20116.474%200%20179.2%200H332.8C395.526%200%20426.889%200%20450.847%2012.2073C471.921%2022.9451%20489.055%2040.0789%20499.793%2061.1531C512%2085.1112%20512%20116.474%20512%20179.2V332.8C512%20395.526%20512%20426.889%20499.793%20450.847C489.055%20471.921%20471.921%20489.055%20450.847%20499.793C426.889%20512%20395.526%20512%20332.8%20512H179.2C116.474%20512%2085.1112%20512%2061.1531%20499.793C40.0789%20489.055%2022.9451%20471.921%2012.2073%20450.847C0%20426.889%200%20395.526%200%20332.8V179.2Z'%20fill='url(%23paint0_linear_496_292)'/%3e%3crect%20opacity='0.25'%20x='128'%20y='84'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20x='64'%20y='84'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20opacity='0.25'%20x='224'%20y='144'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20x='160'%20y='144'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20opacity='0.25'%20x='168'%20y='204'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20x='104'%20y='204'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20opacity='0.25'%20x='112'%20y='264'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20x='48'%20y='264'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20opacity='0.25'%20x='176'%20y='324'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20x='112'%20y='324'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20opacity='0.25'%20x='304'%20y='384'%20width='152'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20x='240'%20y='384'%20width='152'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_496_292'%20x1='-219.792'%20y1='229.426'%20x2='239.06'%20y2='702.601'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%236E7EF3'%20style='stop-color:%236E7EF3;stop-color:color(display-p3%200.4303%200.4946%200.9515);stop-opacity:1;'/%3e%3cstop%20offset='1'%20stop-color='%234F13BE'%20style='stop-color:%234F13BE;stop-color:color(display-p3%200.3079%200.0763%200.7470);stop-opacity:1;'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",tI="/assets/ollama-logo-Bt9O-2K_.png",nI="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='160'%20height='160'%20viewBox='0%200%20160%20160'%3e%3cdefs%3e%3cfilter%20id='shadow'%20x='-10%25'%20y='-10%25'%20width='130%25'%20height='130%25'%3e%3cfeDropShadow%20dx='0'%20dy='2'%20stdDeviation='6'%20flood-color='%23000'%20flood-opacity='0.15'/%3e%3c/filter%3e%3clinearGradient%20id='bg'%20x1='0'%20y1='0'%20x2='0'%20y2='1'%3e%3cstop%20offset='0%25'%20stop-color='%23ffffff'/%3e%3cstop%20offset='100%25'%20stop-color='%23f0f0f0'/%3e%3c/linearGradient%3e%3c/defs%3e%3crect%20x='10'%20y='10'%20width='140'%20height='140'%20rx='32'%20fill='url(%23bg)'%20filter='url(%23shadow)'/%3e%3cg%20transform='translate(25,%2025)%20scale(0.0221)'%3e%3cg%20transform='translate(0,4970)%20scale(1,-1)'%20fill='%23000000'%20stroke='none'%3e%3cpath%20d='M2275%204349%20c-408%20-39%20-769%20-207%20-1056%20-492%20-196%20-194%20-333%20-428%20-418%20-715%20-47%20-158%20-67%20-281%20-101%20-617%20-66%20-662%20-116%20-944%20-245%20-1387%20-102%20-352%20-271%20-774%20-420%20-1051%20-19%20-35%20-35%20-70%20-35%20-76%200%20-8%2050%20-11%20163%20-11%20l164%200%2080%20168%20c168%20348%20303%20739%20408%201175%2073%20307%20109%20532%20155%20982%2052%20500%2072%20627%20122%20785%20162%20507%20570%20860%201096%20951%20155%2026%20389%2026%20544%200%20221%20-38%20440%20-129%20620%20-258%2045%20-32%20152%20-126%20237%20-209%2086%20-82%20178%20-165%20204%20-183%20106%20-72%20312%20-150%20495%20-186%20l32%20-7%20-86%20-54%20c-110%20-69%20-170%20-117%20-267%20-212%20-93%20-91%20-143%20-154%20-191%20-243%20-105%20-191%20-130%20-406%20-75%20-623%2029%20-115%2081%20-239%20217%20-516%20234%20-480%20343%20-769%20411%20-1091%2036%20-172%2048%20-252%2057%20-381%20l7%20-98%20158%200%20158%200%20-4%2028%20c-2%2015%20-6%2066%20-9%20113%20-14%20218%20-95%20560%20-201%20849%20-81%20220%20-165%20407%20-363%20810%20-120%20245%20-147%20320%20-161%20443%20-38%20338%20202%20621%20766%20906%20131%2065%20166%20126%20106%20183%20-33%2031%20-86%2047%20-288%2088%20-177%2036%20-274%2061%20-370%2097%20-140%2052%20-190%2088%20-377%20270%20-140%20137%20-202%20189%20-300%20254%20-378%20250%20-782%20351%20-1233%20308z%20M3050%203391%20c-57%20-11%20-122%20-53%20-154%20-99%20-41%20-57%20-49%20-158%20-18%20-218%2029%20-56%2066%20-92%20120%20-117%20153%20-69%20323%2037%20325%20203%201%20147%20-131%20259%20-273%20231z%20M1985%201391%20c-68%20-31%20-70%20-40%20-66%20-271%201%20-114%20-2%20-243%20-9%20-290%20-40%20-307%20-124%20-555%20-255%20-754%20-25%20-38%20-45%20-71%20-45%20-72%200%20-2%2079%20-4%20176%20-4%20l175%200%2054%20113%20c117%20247%20182%20512%20201%20812%207%20126%20-9%20319%20-32%20374%20-26%2063%20-86%20111%20-136%20111%20-13%200%20-41%20-9%20-63%20-19z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Lmt={header:"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-base font-semibold text-text",list:"text-sm font-medium text-text"};function op({variant:e="list",className:n,...t}){return f.jsx("span",{className:Ds("title",Lmt[e],n),...t})}const bz=["onb-gate-hint text-base font-medium leading-normal text-text","onb-agent-hint mt-0 mx-0 mb-2.5"].join(" "),lp=["onb-card-meta text-sm text-subtext [&_code]:font-mono","[&_code]:text-xs [&_code]:bg-panel","[&_code]:border [&_code]:border-border-variant [&_code]:rounded-xs","[&_code]:py-px [&_code]:px-[5px] [&_code]:whitespace-nowrap"].join(" "),yz=["onb-gate-hint mt-4.5 mx-0 mb-0 text-base font-medium leading-normal","text-text onb-git-hint mt-2"].join(" "),rI=["onb-card flex flex-col gap-[5px] bg-background","border border-border rounded-lg py-4.5 px-5"].join(" "),xz=["onb-gate-hint mt-4.5 mx-0 mb-0 text-base font-medium leading-normal","text-text"].join(" "),Omt=[{id:"AI/ML",label:y8e},{id:"Biology",label:k8e},{id:"Physics",label:R8e},{id:"Other",label:z8e}],Imt=["welcome","environment","profile"];function Bmt({onDone:e,preferredAgent:n}){var le;const t=gn({mutationFn:ae=>cut(...ae)}),[r,s]=R.useState(0);R.useEffect(()=>{const ae=Imt[r];ae&&sd({name:"onboarding_step_viewed",step:ae})},[r]);const i=ct(fu()),a=ct(B0()),o=i.data??null,l=(le=a.data)==null?void 0:le.gitVersion,[u,_]=R.useState(!1),[d,p]=R.useState(null),[m,x]=R.useState(null),[S,v]=R.useState(!1),[b,w]=R.useState([]),[y,C]=R.useState(""),[E,N]=R.useState(""),[T,z]=R.useState([]),[M,O]=R.useState(""),[B,$]=R.useState([]),[U,H]=R.useState(!1),Y=R.useRef(0),[V,X]=R.useState(!1),[te,I]=R.useState(!1),L=(o==null?void 0:o.some(ae=>ae.agentReady))??!1,F=l!=null,q=R.useRef(0),G=(ae,ue=!1)=>{const pe=++q.current;v(!0),X(!1),I(!1);const Se=()=>pe===q.current;Promise.allSettled([nb(ae,ue),nt.fetchQuery({...B0(),staleTime:ae?0:3e4})]).then(([ye,qe])=>{Se()&&(ye.status==="rejected"&&X(!0),qe.status==="rejected"&&I(!0))}).finally(()=>Se()&&v(!1))};R.useEffect(()=>G(!1),[]),R.useEffect(()=>{if(o===null)return;const ae=o.filter(ue=>ue.agentReady);x(ue=>{var Se;if(ue&&ae.some(ye=>ye.id===ue))return ue;const pe=n&&ae.find(ye=>ye.id===n.harness);return(pe==null?void 0:pe.id)??((Se=ae[0])==null?void 0:Se.id)??null})},[o,n]),R.useEffect(()=>X(i.isError),[i.isError,i.dataUpdatedAt]),R.useEffect(()=>I(a.isError),[a.isError,a.dataUpdatedAt]),R.useEffect(()=>{nt.fetchQuery(Lft()).then(ae=>{w(ae.researchAreas),C(ae.otherArea??""),N(ae.background??""),z(ae.papers)}).catch(()=>{})},[]),R.useEffect(()=>{const ae=M.trim();if(ae.length<3){$([]),H(!1);return}const ue=++Y.current;H(!0);const pe=setTimeout(()=>{nt.fetchQuery(ZL(ae)).then(Se=>ue===Y.current&&$(Se)).catch(()=>ue===Y.current&&$([])).finally(()=>ue===Y.current&&H(!1))},350);return()=>clearTimeout(pe)},[M]);const ee=ae=>{const ue=T.some(pe=>pe.paperId===ae.paperId);z(pe=>pe.some(Se=>Se.paperId===ae.paperId)?pe:[...pe,{paperId:ae.paperId,title:wz(ae.title)}]),O(""),$([]),ue||nt.fetchQuery(q4(ae.paperId)).then(pe=>{var ye;const Se=(ye=pe.title)==null?void 0:ye.trim();Se&&z(qe=>qe.map(Ie=>Ie.paperId===ae.paperId?{...Ie,title:Se}:Ie))}).catch(()=>{})},ce=ae=>z(ue=>ue.filter(pe=>pe.paperId!==ae)),oe=ae=>{w(ue=>ue.includes(ae)?ue.filter(pe=>pe!==ae):[...ue,ae])},ne=b.length>0&&(!b.includes("Other")||y.trim().length>0),Q=async()=>{var pe;const ae=o==null?void 0:o.find(Se=>Se.id===m&&Se.agentReady);if(!ae||u)return;const ue=Pmt(ae,((pe=ae.models[0])==null?void 0:pe.id)??null);_(!0),p(null);try{const Se=await t.mutateAsync([ue,{researchAreas:b,otherArea:b.includes("Other")?y:null,background:E||null,papers:T}]);e(Se.project,Se.selection)}catch(Se){p(Se instanceof Error?Se.message:String(Se))}finally{_(!1)}};return f.jsx("div",{className:`home flex-1 min-h-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] bg-canvas onboarding ${r===0?"[&_.home-inner]:max-w-300 [&_.home-inner]:pt-0 [&_.home-inner]:pb-0":"[&_.home-inner]:max-w-140 [&_.home-inner]:pt-24"}`,children:f.jsx("div",{className:`home-inner max-w-155 my-0 mx-auto ${r===0?"px-8 sm:px-12":"pt-12 px-6 pb-16"}`,children:r===0?f.jsxs("div",{className:"onb-intro relative flex min-h-dvh flex-col justify-center gap-4 py-12 min-[1120px]:grid min-[1120px]:grid-cols-[minmax(0,_1.1fr)_minmax(28rem,_1fr)] min-[1120px]:grid-rows-[auto_auto] min-[1120px]:content-center min-[1120px]:gap-x-20 min-[1120px]:gap-y-10",children:[f.jsxs("div",{className:"onb-intro-copy relative z-10 min-[1120px]:col-start-1 min-[1120px]:row-start-1 min-[1120px]:self-start",children:[f.jsx("div",{className:"onb-intro-brand mb-10 text-6xl font-semibold leading-none tracking-[-0.035em]",children:f.jsx(Lx,{})}),f.jsx("h2",{className:"onb-title mt-0 mx-0 text-4xl font-medium leading-[1.08] tracking-[-0.035em]",children:c8e()})]}),f.jsxs("div",{className:"onb-intro-features relative min-[1120px]:col-start-2 min-[1120px]:row-start-1 min-[1120px]:self-end",children:[f.jsx("div",{"aria-hidden":"true",className:"absolute -inset-14 rounded-full bg-primary-subtle opacity-70 blur-3xl"}),f.jsxs("ul",{className:"onb-intro-list relative flex flex-col gap-4 m-0 p-0 list-none",children:[f.jsx("li",{className:"rounded-2xl border border-border bg-background p-6 shadow-card",children:f.jsxs("span",{children:[f.jsx("strong",{className:"mb-1.5 block text-xl font-semibold tracking-[-0.015em]",children:gCe()}),f.jsx("span",{className:"block text-lg leading-[1.55] text-text",children:sNe()})]})}),f.jsx("li",{className:"rounded-2xl border border-border bg-background p-6 shadow-card",children:f.jsxs("span",{children:[f.jsx("strong",{className:"mb-1.5 block text-xl font-semibold tracking-[-0.015em]",children:KCe()}),f.jsx("span",{className:"block text-lg leading-[1.55] text-text",children:BEe()})]})}),f.jsx("li",{className:"rounded-2xl border border-border bg-background p-6 shadow-card",children:f.jsxs("span",{children:[f.jsx("strong",{className:"mb-1.5 block text-xl font-semibold tracking-[-0.015em]",children:OCe()}),f.jsx("span",{className:"block text-lg leading-[1.55] text-text",children:zNe()})]})})]})]}),f.jsx("div",{className:"onb-intro-actions relative z-10 mt-8 flex justify-end min-[1120px]:col-start-2 min-[1120px]:row-start-2 min-[1120px]:mt-0 min-[1120px]:self-start",children:f.jsxs(Oe,{variant:"primary",size:"large",onClick:()=>s(1),children:[uN()," ",f.jsx(E1,{size:20})]})})]}):r===1?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"onb-eyebrow mb-4.5 flex items-center gap-2 text-xl font-medium text-muted",children:[f.jsx(Lx,{}),f.jsx("span",{children:HEe()})]}),f.jsx("h2",{className:"onb-title mt-0 mx-0 mb-1.5 text-3xl tracking-[-0.01em]",children:X8e()}),f.jsx("p",{className:"onb-sub text-text text-base leading-[1.55] mt-0 mx-0 mb-5.5 max-w-120",children:R9e()}),o!==null&&!L&&f.jsx("p",{className:bz,children:TEe()}),o!==null&&L&&m===null&&f.jsx("p",{className:bz,children:tCe()}),(l===null||te)&&f.jsxs("div",{className:"onb-git-check mt-7",role:"status","aria-live":"polite",children:[f.jsx(qmt,{gitVersion:l,error:te}),te?f.jsx("p",{className:yz,children:fN()}):f.jsx("p",{className:yz,children:UCe()})]}),f.jsx("div",{className:"onb-cards flex flex-col gap-3.5",children:o!==null?o.map(ae=>f.jsx(Hmt,{h:ae,selected:m===ae.id,onSelect:()=>x(ae.id)},ae.id)):V?f.jsx("div",{className:lp,children:fN()}):f.jsxs(ss,{className:"py-2",children:[f.jsx(Lt,{})," ",zCe()]})}),f.jsxs("div",{className:"onb-actions flex items-center gap-2.5 mt-5.5",children:[f.jsxs(Oe,{variant:"ghost",onClick:()=>s(0),children:[f.jsx(ap,{size:12})," ",cN()]}),f.jsxs(Oe,{variant:"ghost",onClick:()=>G(!0,!0),disabled:S,children:[f.jsx(Aa,{size:12,className:S?"animate-[spin_0.9s_linear_infinite]":""})," ",UD()]}),f.jsx("div",{className:"flex-1"}),f.jsxs(Oe,{variant:"primary",onClick:()=>s(2),disabled:S||!L||m===null||!F,title:S?yNe():L?m===null?hCe():te?W9e():l===void 0?mNe():l===null?n9e():void 0:EEe(),children:[uN()," ",f.jsx(E1,{size:13})]})]})]}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"onb-eyebrow mb-4.5 flex items-center gap-2 text-xl font-medium text-muted",children:[f.jsx(Lx,{}),f.jsx("span",{children:WEe()})]}),f.jsx("h2",{className:"onb-title mt-0 mx-0 mb-1.5 text-3xl tracking-[-0.01em] onb-profile-title mb-5.5",children:YEe()}),f.jsx("div",{className:"onb-cards flex flex-col gap-2.5",children:f.jsxs("div",{className:rI,children:[f.jsxs("fieldset",{className:"onb-fieldset border-0 mt-0 mx-0 mb-4.5 p-0 [&_legend]:text-base [&_legend]:font-medium [&_legend]:mb-1.5",children:[f.jsx("legend",{children:kNe()}),f.jsx("p",{className:"onb-field-hint text-muted text-sm leading-[1.4] mt-0 mx-0 mb-2",children:cCe()}),f.jsx("div",{className:"onb-area-options grid grid-cols-[repeat(2,_minmax(0,_1fr))] gap-2",children:Omt.map(ae=>f.jsxs("label",{className:"onb-area-option flex items-center gap-2 border border-border rounded-md cursor-pointer py-[9px] px-2.5 [&:has(input:checked)]:border-accent [&:has(input:checked)]:bg-primary-subtle [&_input]:m-0",children:[f.jsx("input",{type:"checkbox",checked:b.includes(ae.id),onChange:()=>oe(ae.id),disabled:u}),f.jsx("span",{children:ae.label()})]},ae.id))}),b.includes("Other")&&f.jsx("input",{className:"onb-other-area w-full mt-2",value:y,onChange:ae=>C(ae.target.value),disabled:u,placeholder:eNe(),"aria-label":O9e()})]}),f.jsx("label",{className:"onb-field-label text-base font-medium mb-1.5",htmlFor:"onb-background",children:eEe()}),f.jsx("textarea",{id:"onb-background",className:"onb-textarea w-full resize-y min-h-19.5 leading-normal text-base mb-3.5",value:E,onChange:ae=>N(ae.target.value),disabled:u,rows:4,placeholder:RCe()}),f.jsx("label",{className:"onb-field-label text-base font-medium mb-1.5",htmlFor:"onb-paper-search",children:Y9e()}),f.jsx("p",{className:"onb-field-hint text-muted text-sm leading-[1.4] mt-0 mx-0 mb-2",children:h8e()}),f.jsxs("div",{className:"onb-paper-search flex flex-col gap-1.5 mt-3 [&_input]:w-full",children:[f.jsx("input",{id:"onb-paper-search",value:M,onChange:ae=>O(ae.target.value),disabled:u,placeholder:oEe()}),U?f.jsx("div",{className:lp,children:dEe()}):B.length>0?f.jsx("div",{className:"onb-paper-results flex flex-col border border-border rounded-md max-h-50 overflow-y-auto [&_button]:flex [&_button]:flex-col [&_button]:items-start [&_button]:gap-0.5 [&_button]:py-2 [&_button]:px-2.5 [&_button]:bg-none [&_button]:bg-transparent [&_button]:border-0 [&_button]:border-b [&_button]:border-b-border-variant [&_button]:text-start [&_button]:[font:inherit] [&_button]:text-text [&_button]:cursor-pointer [&_button:last-child]:border-b-0 [&_button:hover]:bg-surface [&_.title]:text-sm [&_.title]:font-medium [&_.id]:text-xs [&_.id]:text-muted",children:B.map(ae=>f.jsxs("button",{type:"button",onClick:()=>ee(ae),disabled:u,children:[f.jsx(op,{children:wz(ae.title)}),f.jsx("span",{className:"id",children:ae.paperId})]},ae.paperId))}):null]}),T.length>0&&f.jsx("div",{className:"onb-paper-chips flex flex-wrap gap-1.5 mt-2.5",children:T.map(ae=>f.jsxs("span",{className:"onb-paper-chip inline-flex items-center gap-1.5 pt-1 pe-1 pb-1 ps-2.5 border border-border rounded-sm bg-surface text-sm max-w-full [&_.title]:font-medium [&_.title]:overflow-hidden [&_.title]:text-ellipsis [&_.title]:whitespace-nowrap [&_.title]:max-w-60 [&_.id]:text-xs [&_.id]:text-muted [&_button]:inline-flex [&_button]:items-center [&_button]:justify-center [&_button]:p-0.5 [&_button]:border-0 [&_button]:bg-none [&_button]:bg-transparent [&_button]:text-muted [&_button]:cursor-pointer [&_button]:rounded-xs [&_button:hover]:text-text [&_button:hover]:bg-panel",children:[f.jsx(op,{children:ae.title||ae.paperId}),f.jsx("span",{className:"id",children:ae.paperId}),f.jsx("button",{type:"button","aria-label":eY({name:Ne(ae.paperId)}),onClick:()=>ce(ae.paperId),disabled:u,children:f.jsx(qr,{size:12})})]},ae.paperId))})]})}),!ne&&f.jsx("p",{className:"onb-profile-hint text-accent-red text-sm mt-2 mx-0 mb-0",children:b.length===0?iCe():kCe()}),f.jsxs("div",{className:"onb-actions flex items-center gap-2.5 mt-5.5",children:[f.jsxs(Oe,{variant:"ghost",onClick:()=>s(1),disabled:u,children:[f.jsx(ap,{size:12})," ",cN()]}),f.jsx("div",{className:"flex-1"}),f.jsx(Oe,{variant:"primary",onClick:()=>void Q(),disabled:u||m===null||!ne,children:u?f.jsxs(f.Fragment,{children:[f.jsx(Lt,{})," ",wEe()]}):f.jsxs(f.Fragment,{children:[PCe()," ",f.jsx(E1,{size:13})]})})]}),m===null&&f.jsx("p",{className:xz,children:RNe()}),d&&f.jsx("p",{className:xz,children:d})]})})})}function wz(e){return e.replace(/^\[[^\]]*\]\s*/,"").replace(/\s*[-–|]\s*arXiv\s*$/i,"")}function $mt(e){return e.agentReady?{tone:"success",label:e.authMethod==="local"?s6():DEe()}:e.installed?e.installBroken?{tone:"warning",label:ZCe()}:e.authMethod==="local"?{tone:"warning",label:GD()}:e.authState==="unknown"?{tone:"warning",label:lNe()}:e.authState==="unsupported"?{tone:"warning",label:fNe()}:e.installed?{tone:"warning",label:z9e()}:{tone:"neutral",label:dN()}:{tone:"neutral",label:dN()}}function Pmt(e,n){var t;return{harness:e.id,model:n,permissionMode:((t=e.options)==null?void 0:t.defaultPermissionMode)??null,reasoningLevel:tb(e,n).defaultId}}function Fmt({harness:e}){return f.jsx(J4,{harness:e,size:26})}function Hmt({h:e,selected:n,onSelect:t}){var u;const r=$mt(e),s=n?{tone:"success",label:pEe()}:r,i=(u=e.version)==null?void 0:u.replace(/\s*\(.*\)$/,""),a=[e.id==="opencode"&&e.account!=="opencode"&&e.account,e.id==="opencode"&&e.plan,i,e.models.length>0&&iL({count:Wt(e.models.length),models:new Intl.ListFormat(j()).format(e.models.map(_=>Ne(I0(_))))})].filter(Boolean).join(" · "),o=f.jsxs("div",{className:"onb-card-head flex items-center justify-between gap-3",children:[f.jsxs("span",{className:"onb-card-identity flex items-center gap-3 min-w-0",children:[f.jsx(Fmt,{harness:e.id}),f.jsx("span",{className:"onb-card-name text-lg font-semibold tracking-[-0.01em]",children:e.name})]}),f.jsx(sb,{tone:s.tone,children:s.label})]}),l=e.id==="opencode"&&f.jsxs("div",{className:"space-y-1 text-sm text-text",children:[f.jsx("div",{className:"font-medium",children:v9e()}),f.jsxs("div",{children:[_9e()," ",f.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap align-baseline",children:[f.jsx("img",{src:eI,alt:"",width:14,height:14,className:"size-3.5 shrink-0 object-contain"}),"LM Studio"]}),", ",f.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap align-baseline",children:[f.jsx("img",{src:tI,alt:"",width:14,height:14,className:"size-3.5 shrink-0 object-contain dark:invert"}),"Ollama"]}),u9e(),f.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap align-baseline",children:[f.jsx("img",{src:nI,alt:"",width:14,height:14,className:"size-3.5 shrink-0 object-contain"}),"oMLX"]}),"."]})]});return e.agentReady?f.jsxs("button",{type:"button",className:`onb-card flex flex-col gap-2.5 bg-background border border-border rounded-lg py-5.5 px-6 onb-agent-choice w-full text-inherit [font:inherit] text-start transition-[border-color,box-shadow] duration-120 ease-standard [button&]:cursor-pointer [button&:hover]:border-muted [&.selected]:border-accent [&.selected]:shadow-selected${n?" selected":""}`,"aria-pressed":n,onClick:t,children:[o,e.id!=="opencode"&&f.jsxs("div",{className:"onb-card-detail text-sm",children:[e.account??r6(),e.plan?` · ${e.plan}`:""]}),f.jsx("div",{className:`${lp} w-full overflow-hidden text-ellipsis whitespace-nowrap`,title:a,children:a}),l]}):f.jsxs("div",{className:"onb-card flex flex-col gap-2.5 bg-background border border-border rounded-lg py-5.5 px-6 onb-agent-choice w-full text-inherit [font:inherit] text-start transition-[border-color,box-shadow] duration-120 ease-standard [button&]:cursor-pointer [button&:hover]:border-muted [&.selected]:border-accent [&.selected]:shadow-selected",children:[o,f.jsx("div",{className:lp,children:tm(e.agentNote)}),l]})}function qmt({gitVersion:e,error:n}){return f.jsxs("div",{className:rI,children:[f.jsxs("div",{className:"onb-card-head flex items-center justify-between gap-3",children:[f.jsx("span",{className:"onb-card-name font-semibold text-base",children:a9e()}),f.jsx(sb,{tone:e?"success":n||e===null?"danger":"warning",children:e?s6():n?$8e():e===null?qD():q8e()})]}),(e||!n&&e===void 0)&&f.jsx("div",{className:lp,children:e??V8e()})]})}const Umt="/assets/slurm-logo-aGSXVZcE.svg",Gmt="/assets/thinking-machines-BOdslTfm.png";function Wmt(e){switch(e){case"modal_job":return"Modal";case"hf_job":return"Hugging Face";case"k8s_job":return"Kubernetes";case"ssh_job":return"SSH";case"slurm_job":return"Slurm";case"ray_job":return"Ray";case"openresearch_job":return"OpenResearch";case"local_job":return TD();case"tinker_job":return"Tinker";default:return e||"—"}}function Vmt({size:e=16}){return f.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",children:[f.jsx("path",{d:"M2.25 11.535c0-3.407 1.847-6.554 4.844-8.258a9.822 9.822 0 019.687 0c2.997 1.704 4.844 4.851 4.844 8.258 0 5.266-4.337 9.535-9.687 9.535S2.25 16.8 2.25 11.535z",fill:"#FF9D0B"}),f.jsx("path",{d:"M11.938 20.086c4.797 0 8.687-3.829 8.687-8.551 0-4.722-3.89-8.55-8.687-8.55-4.798 0-8.688 3.828-8.688 8.55 0 4.722 3.89 8.55 8.688 8.55z",fill:"#FFD21E"}),f.jsx("path",{d:"M11.875 15.113c2.457 0 3.25-2.156 3.25-3.263 0-0.576-.393-.394-1.023-.089-0.582.283-1.365.675-2.224.675-1.798 0-3.25-1.693-3.25-0.586 0 1.107.79 3.263 3.25 3.263h-.003z",fill:"#FF323D"}),f.jsx("path",{d:"M14.76 9.21c.32.108.445.753.767.585.447-.233.707-.708.659-1.204a1.235 1.235 0 00-.879-1.059 1.262 1.262 0 00-1.33.394c-.322.384-.377.92-.14 1.36.153.283.638-.177.925-.079l-.002.003zm-5.887 0c-.32.108-.448.753-.768.585a1.226 1.226 0 01-.658-1.204c.048-.495.395-.913.878-1.059a1.262 1.262 0 011.33.394c.322.384.377.92.14 1.36-.152.283-.64-.177-.925-.079l.003.003z",fill:"#3A3B45"}),f.jsx("path",{d:"M17.812 10.366a.806.806 0 00.813-.8c0-.441-.364-.8-.813-.8a.806.806 0 00-.812.8c0 .442.364.8.812.8zm-11.624 0a.806.806 0 00.812-.8c0-.441-.364-.8-.812-.8a.806.806 0 00-.813.8c0 .442.364.8.813.8z",fill:"#3A3B45"}),f.jsx("path",{d:"M4.515 13.073c-.405 0-.765.162-1.017.46a1.455 1.455 0 00-.333.925 1.801 1.801 0 00-.485-.074c-.387 0-.737.146-.985.409a1.41 1.41 0 00-.2 1.722 1.302 1.302 0 00-.447.694c-.06.222-.12.69.2 1.166a1.267 1.267 0 00-.093 1.236c.238.533.81.958 1.89 1.405l.24.096c.768.3 1.473.492 1.478.494.89.243 1.808.375 2.732.394 1.465 0 2.513-.443 3.115-1.314.93-1.342.842-2.575-.274-3.763l-.151-.154c-.692-.684-1.155-1.69-1.25-1.912-.195-.655-.71-1.383-1.562-1.383-.46.007-.889.233-1.15.605-.25-.31-.495-0.553-.715-.694a1.87 1.87 0 00-.993-.312zm14.97 0c.405 0 .767.162 1.017.46.216.262.333.588.333.925.158-.047.322-.071.487-.074.388 0 .738.146.985.409a1.41 1.41 0 01.2 1.722c.22.178.377.422.445.694.06.222.12.69-.2 1.166.244.37.279.836.093 1.236-.238.533-.81.958-1.889 1.405l-.239.096c-.77.3-1.475.492-1.48.494-.89.243-1.808.375-2.732.394-1.465 0-2.513-.443-3.115-1.314-.93-1.342-.842-2.575.274-3.763l.151-.154c.695-.684 1.157-1.69 1.252-1.912.195-.655.708-1.383 1.56-1.383.46.007.889.233 1.15.605.25-.31.495-0.553.718-.694.244-.162.523-.265.814-.3l.176-.012z",fill:"#FF9D0B"}),f.jsx("path",{d:"M9.785 20.132c.688-.994.638-1.74-.305-2.667-.945-.928-1.495-2.288-1.495-2.288s-.205-.788-.672-.714c-.468.074-.81 1.25.17 1.971.977.721-.195 1.21-0.573.534-.375-.677-1.405-2.416-1.94-2.751-0.532-.332-.907-.148-.782.541.125.687 2.357 2.35 2.14 2.707-.218.362-.983-.42-.983-.42S2.953 14.9 2.43 15.46c-0.52.558.398 1.026 1.7 1.803 1.308.778 1.41.985 1.225 1.28-.187.295-3.07-2.1-3.34-1.083-.27 1.011 2.943 1.304 2.745 2.006-.2.7-2.265-1.324-2.685-0.537-.425.79 2.913 1.718 2.94 1.725 1.075.276 3.813.859 4.77-0.522zm4.432 0c-.687-.994-.64-1.74.305-2.667.943-.928 1.493-2.288 1.493-2.288s.205-.788.675-.714c.465.074.807 1.25-.17 1.971-.98.721.195 1.21.57.534.377-.677 1.407-2.416 1.94-2.751.532-.332.91-.148.782.541-.125.687-2.355 2.35-2.137 2.707.215.362.98-.42.98-.42S21.05 14.9 21.57 15.46c.52.558-.395 1.026-1.7 1.803-1.308.778-1.408.985-1.225 1.28.187.295 3.07-2.1 3.34-1.083.27 1.011-2.94 1.304-2.743 2.006.2.7 2.263-1.324 2.685-0.537.423.79-2.912 1.718-2.94 1.725-1.077.276-3.815.859-4.77-0.522z",fill:"#FFD21E"})]})}function Kmt({size:e=16}){return f.jsxs("svg",{width:e,height:e,viewBox:"0 0 300 300",fill:"none","aria-hidden":"true",children:[f.jsx("path",{d:"M121.683 75.25L149.997 124L91.4816 224.75C90.3128 226.757 88.155 228 85.8174 228H32.9664C31.7976 228 30.6778 227.691 29.697 227.131C28.7161 226.57 27.8906 225.758 27.3021 224.75L0.876625 179.25C-0.292208 177.243 -0.292208 174.765 0.876625 172.75L57.512 75.25C58.0923 74.2425 58.9259 73.43 59.9068 72.8694C60.8876 72.3088 62.0074 72 63.1762 72H116.027C118.365 72 120.523 73.2431 121.692 75.25H121.683ZM299.125 172.75L242.49 75.25C241.91 74.2425 241.076 73.43 240.095 72.8694C239.114 72.3088 237.995 72 236.826 72H183.975C181.637 72 179.479 73.2431 178.311 75.25L149.997 124L208.512 224.75C209.681 226.757 211.839 228 214.177 228H267.027C268.196 228 269.316 227.691 270.297 227.131C271.278 226.57 272.103 225.758 272.692 224.75L299.117 179.25C300.286 177.243 300.286 174.765 299.117 172.75H299.125Z",fill:"#62DE61"}),f.jsx("path",{d:"M89.6018 124H150.005L121.692 75.25C120.523 73.2431 118.365 72 116.027 72H63.1763C62.0074 72 60.8876 72.3088 59.9068 72.8694L89.6018 124Z",fill:"url(#orxModalA)"}),f.jsx("path",{d:"M89.6018 124L59.9068 72.8694C58.9259 73.43 58.1005 74.2425 57.512 75.25L0.876625 172.75C-0.292208 174.765 -0.292208 177.235 0.876625 179.25L27.3021 224.75C27.8825 225.758 28.7161 226.57 29.697 227.131L89.5936 124H89.6018Z",fill:"url(#orxModalB)"}),f.jsx("path",{d:"M149.997 124H89.5936L29.697 227.131C30.6778 227.691 31.7976 228 32.9664 228H85.8174C88.155 228 90.3128 226.757 91.4816 224.75L149.997 124Z",fill:"#09AF58"}),f.jsx("path",{d:"M299.125 179.25C299.706 178.243 300 177.121 300 176H240.61L210.915 227.131C211.896 227.691 213.016 228 214.185 228H267.036C269.373 228 271.531 226.757 272.7 224.75L299.125 179.25Z",fill:"#09AF58"}),f.jsx("path",{d:"M183.975 72C182.806 72 181.686 72.3088 180.705 72.8694L240.602 176H299.992C299.992 174.879 299.698 173.758 299.117 172.75L242.49 75.25C241.321 73.2431 239.163 72 236.826 72H183.967H183.975Z",fill:"url(#orxModalC)"}),f.jsx("path",{d:"M210.907 227.131L240.602 176L180.705 72.8694C179.725 73.43 178.899 74.2425 178.311 75.25L149.997 124L208.512 224.75C209.093 225.758 209.926 226.57 210.907 227.131Z",fill:"url(#orxModalD)"}),f.jsxs("defs",{children:[f.jsxs("linearGradient",{id:"orxModalA",x1:"127.348",y1:"137",x2:"82.9561",y2:"59.6398",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{stopColor:"#BFF9B4"}),f.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),f.jsxs("linearGradient",{id:"orxModalB",x1:"7.04774",y1:"214.131",x2:"81.1284",y2:"85.0556",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{stopColor:"#80EE64"}),f.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),f.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),f.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),f.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),f.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),f.jsx("stop",{offset:"1",stopColor:"#09AF58"})]}),f.jsxs("linearGradient",{id:"orxModalC",x1:"278.103",y1:"188.561",x2:"204.022",y2:"59.4863",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{stopColor:"#BFF9B4"}),f.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),f.jsxs("linearGradient",{id:"orxModalD",x1:"232.804",y1:"214.569",x2:"158.724",y2:"85.4864",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{stopColor:"#80EE64"}),f.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),f.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),f.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),f.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),f.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),f.jsx("stop",{offset:"1",stopColor:"#09AF58"})]})]})]})}function Qmt({size:e=16}){return f.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#326CE5","aria-hidden":"true",children:f.jsx("path",{d:"M10.204 14.35l.007.01-.999 2.413a5.171 5.171 0 0 1-2.075-2.597l2.578-.437.004.005a.44.44 0 0 1 .484.606zm-.833-2.129a.44.44 0 0 0 .173-.756l.002-.011L7.585 9.7a5.143 5.143 0 0 0-.73 3.255l2.514-.725.002-.009zm1.145-1.98a.44.44 0 0 0 .699-.337l.01-.005.15-2.62a5.144 5.144 0 0 0-3.01 1.442l2.147 1.523.004-.002zm.76 2.75l.723.349.722-.347.18-.78-0.5-.623h-.804l-0.5.623.179.779zm1.5-3.095a.44.44 0 0 0 .7.336l.008.003 2.134-1.513a5.188 5.188 0 0 0-2.992-1.442l.148 2.615.002.001zm10.876 5.97l-5.773 7.181a1.6 1.6 0 0 1-1.248.594l-9.261.003a1.6 1.6 0 0 1-1.247-0.596l-5.776-7.18a1.583 1.583 0 0 1-.307-1.34L2.1 5.573c.108-.47.425-.864.863-1.073L11.305.513a1.606 1.606 0 0 1 1.385 0l8.345 3.985c.438.209.755.604.863 1.073l2.062 8.955c.108.47-.005.963-.308 1.34zm-3.289-2.057c-.042-.01-.103-.026-.145-.034-.174-.033-.315-.025-.479-.038-.35-.037-.638-.067-.895-.148-.105-.04-.18-.165-.216-.216l-.201-.059a6.45 6.45 0 0 0-.105-2.332 6.465 6.465 0 0 0-.936-2.163c.052-.047.15-.133.177-.159.008-.09.001-.183.094-.282.197-.185.444-.338.743-0.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-0.52.123-.736-.172-.216-0.506-.236-.745-.045-.034.027-.08.062-.111.088-.134.116-.217.23-.33.35-.246.25-.45.458-.673.609-.097.056-.239.037-.303.033l-.19.135a6.545 6.545 0 0 0-4.146-2.003l-.012-.223c-.065-.062-.143-.115-.163-.25-.022-.268.015-0.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-0.555-0.5-0.555-.275 0-.499.249-.499.555l.001.014c0 .041-.002.092 0 .128.006.177.044.312.067.475.042.348.078.637.056.906a.545.545 0 0 1-.162.258l-.012.211a6.424 6.424 0 0 0-4.166 2.003 8.373 8.373 0 0 1-.18-.128c-.09.012-.18.04-.297-.029-.223-.15-.427-.358-.673-.608-.113-.12-.195-.234-.329-.349-.03-.026-.077-.062-.111-.088a.594.594 0 0 0-.348-.132.481.481 0 0 0-.398.176c-.172.216-.117.546.123.737l.007.005.104.083c.142.105.272.159.414.242.299.185.546.338.743.522.076.082.09.226.1.288l.16.143a6.462 6.462 0 0 0-1.02 4.506l-.208.06c-.055.072-.133.184-.215.217-.257.081-0.546.11-.895.147-.164.014-.305.006-.48.039-.037.007-.09.02-.133.03l-.004.002-.007.002c-.295.071-.484.342-.423.608.061.267.349.429.645.365l.007-.001.01-.003.129-.029c.17-.046.294-.113.448-.172.33-.118.604-.217.87-.256.112-.009.23.069.288.101l.217-.037a6.5 6.5 0 0 0 2.88 3.596l-.09.218c.033.084.069.199.044.282-.097.252-.263.517-.452.813-.091.136-.185.242-.268.399-.02.037-.045.095-.064.134-.128.275-.034.591.213.71.248.12.556-.007.69-.282v-.002c.02-.039.046-.09.062-.127.07-.162.094-.301.144-.458.132-.332.205-.68.387-.897.05-.06.13-.082.215-.105l.113-.205a6.453 6.453 0 0 0 4.609.012l.106.192c.086.028.18.042.256.155.136.232.229.507.342.84.05.156.074.295.145.457.016.037.043.09.062.129.133.276.442.402.69.282.247-.118.341-.435.213-.71-.02-.039-.045-.096-.065-.134-.083-.156-.177-.261-.268-.398-.19-.296-.346-0.541-.443-.793-.04-.13.007-.21.038-.294-.018-.022-.059-.144-.083-.202a6.499 6.499 0 0 0 2.88-3.622c.064.01.176.03.213.038.075-.05.144-.114.28-.104.266.039.54.138.87.256.154.06.277.128.448.173.036.01.088.019.13.028l.009.003.007.001c.297.064.584-.098.645-.365.06-.266-.128-0.537-.423-.608zM16.4 9.701l-1.95 1.746v.005a.44.44 0 0 0 .173.757l.003.01 2.526.728a5.199 5.199 0 0 0-.108-1.674A5.208 5.208 0 0 0 16.4 9.7zm-4.013 5.325a.437.437 0 0 0-.404-.232.44.44 0 0 0-.372.233h-.002l-1.268 2.292a5.164 5.164 0 0 0 3.326.003l-1.27-2.296h-.01zm1.888-1.293a.44.44 0 0 0-.27.036.44.44 0 0 0-.214.572l-.003.004 1.01 2.438a5.15 5.15 0 0 0 2.081-2.615l-2.6-.44-.004.005z"})})}function Ymt({size:e=16}){return f.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#028CF0","aria-hidden":"true",children:f.jsx("path",{d:"M16.153 12.826c-.63-.183-1.03.15-1.378.846-0.58 1.13-1.643 1.644-2.888 1.594-1.245-.05-2.257-.63-2.788-1.776-.233-.498-.498-.664-1.046-.68-.93-.017-1.643.016-2.174 1.062-.631 1.261-2.258 1.693-3.619 1.261a3.234 3.234 0 0 1-2.257-3.22 3.198 3.198 0 0 1 2.29-3.02 3.276 3.276 0 0 1 3.702 1.327c.216.315.216.863.597.93.648.1 1.328.033 1.992.033.299 0 .316-.266.399-.465.58-1.295 1.61-1.959 2.987-1.975 1.361-.017 2.39.647 2.955 1.892.215.465.48.598.946.548.166-.017.332.016.498 0 .464-.083 1.062.282 1.344-.448.282-.73-.382-.913-.68-1.245-.847-.946-1.81-1.793-2.673-2.706-.415-.465-.763-.614-1.41-.415-1.876.614-3.619-.431-4.15-2.357-.448-1.676.714-3.535 2.44-3.917a3.293 3.293 0 0 1 3.95 2.457c.017.05.017.083.033.133.117.564.117 1.145-.132 1.626-.283.531-.133.83.249 1.195a152.61 152.61 0 0 1 3.286 3.27c.299.299.498.349.913.2 1.51-0.565 2.97-.1 3.884 1.161a3.266 3.266 0 0 1-.067 3.801c-.896 1.195-2.357 1.643-3.834 1.079-.381-.15-0.58-.1-.846.182a163.619 163.619 0 0 1-3.403 3.386c-.299.3-.415.532-.232.98a3.198 3.198 0 0 1-1.278 3.917A3.298 3.298 0 0 1 9.646 23c-1.062-1.062-1.228-2.688-.415-4.033a3.196 3.196 0 0 1 3.835-1.294c.498.182.78.083 1.145-.283 1.012-1.045 2.058-2.058 3.087-3.103.266-.266.68-.449.432-1.03-.233-0.547-.631-.414-1.03-.431zM11.97 4.942c.913.016 1.643-.714 1.66-1.627v-.05a1.646 1.646 0 0 0-1.76-1.56 1.63 1.63 0 0 0-1.543 1.527 1.638 1.638 0 0 0 1.577 1.71zm.033 5.41a1.658 1.658 0 0 0-1.676 1.61v.084a1.73 1.73 0 0 0 1.643 1.66c.847.016 1.643-.78 1.677-1.627a1.648 1.648 0 0 0-1.577-1.71c-.017-.016-.05-.016-.067-.016zm7.088 1.694c.016.896.747 1.61 1.626 1.643a1.723 1.723 0 0 0 1.66-1.726 1.666 1.666 0 0 0-1.66-1.61 1.623 1.623 0 0 0-1.643 1.577c.017.05.017.083.017.116zM3.24 10.353a1.692 1.692 0 0 0-1.66 1.626c-.017.847.863 1.727 1.693 1.71a1.687 1.687 0 0 0 1.626-1.743 1.615 1.615 0 0 0-1.643-1.593Zm8.68 12c.98.033 1.71-.647 1.727-1.593a1.646 1.646 0 0 0-1.51-1.793 1.646 1.646 0 0 0-1.793 1.51v.233a1.609 1.609 0 0 0 1.543 1.66c0-.017.017-.017.033-.017z"})})}function Xmt({size:e=16}){return f.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100","aria-hidden":"true",children:[f.jsx("rect",{width:"100",height:"100",rx:"8",fill:"#9a2036"}),f.jsx("path",{d:"M15.375 16.782v63.843a4 4 0 0 0 4 4h63.843c3.564 0 5.348-4.309 2.829-6.828L22.203 13.953c-2.52-2.52-6.828-.735-6.828 2.829",fill:"#fff"})]})}function Zmt({size:e=16}){return f.jsx("img",{className:"tinker-logo block flex-none object-contain",src:Gmt,width:e,height:e,style:{transform:e>=48?`translateX(${Math.round(e*.18)}px) scale(1.65)`:"scale(1.22)"},alt:"","aria-hidden":"true"})}function Jmt({size:e=16}){return f.jsx("img",{className:"block flex-none object-contain",src:Umt,width:e,height:e,alt:"","aria-hidden":"true"})}function hb({size:e=16}){return f.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:f.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-0.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-0.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"})})}function u_({kind:e,size:n=16}){switch(e){case"modal_job":return f.jsx(Kmt,{size:n});case"hf_job":return f.jsx(Vmt,{size:n});case"k8s_job":return f.jsx(Qmt,{size:n});case"ssh_job":return f.jsx(vz,{size:n,strokeWidth:1.5});case"slurm_job":return f.jsx(Jmt,{size:n});case"ray_job":return f.jsx(Ymt,{size:n});case"openresearch_job":return f.jsx(Xmt,{size:n});case"tinker_job":return f.jsx(Zmt,{size:n});case"local_job":return f.jsx(Fpt,{size:n,strokeWidth:1.5});default:return f.jsx(vz,{size:n})}}function $6({backend:e}){const n=p6(e),t=yft(e);return n?f.jsxs("span",{className:"backend-badge inline-flex items-center gap-[7px] [&_svg]:flex-none [&_svg]:block [&_.backend-name]:font-medium [&_.backend-detail]:text-muted [&.muted]:text-muted",children:[f.jsx(u_,{kind:n}),f.jsx("span",{className:"backend-name",children:Wmt(n)}),t&&f.jsx("span",{className:"backend-detail text-sm",children:t})]}):f.jsx("span",{className:"backend-badge inline-flex items-center gap-[7px] [&_svg]:flex-none [&_svg]:block [&_.backend-name]:font-medium [&_.backend-detail]:text-muted [&.muted]:text-muted muted text-muted",children:"—"})}function Ox(e,n){const[t,r]=R.useState(e);return R.useEffect(()=>{const s=setTimeout(()=>r(e),n);return()=>clearTimeout(s)},[e,n]),t}function Bg(e,n){const t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return(n?t.slice(0,n):t)||"research-project"}function egt(e){const t=(e.trim().split(/[?#]/)[0].split("/").filter(Boolean).pop()??"").replace(/\.(pdf|md)$/i,"");return/^\d{4}\.\d{4,5}(v\d+)?$/.test(t)?t:null}function tgt(e){const n=e==null?void 0:e.trim().match(/github\.com[/:]([^/]+)\/([^/?#]+)/i);return n?{owner:n[1],repo:n[2].replace(/\.git$/,"")}:null}function ngt(e){return e.trim().replace(/^https?:\/\//i,"").replace(/^git@([^:]+):/i,"$1/").replace(/\.git$/i,"").replace(/\/$/,"")}function rgt({onCreated:e,onCancel:n,remote:t=!1}){var Jn,hn,En,ln;const[r,s]=R.useState("blank"),[i,a]=R.useState(""),[o,l]=R.useState(!1),[u,_]=R.useState(""),[d,p]=R.useState(!1),[m,x]=R.useState(!1),[S,v]=R.useState(!1),[b,w]=R.useState(null),[y,C]=R.useState(!1),[E,N]=R.useState(!1),[T,z]=R.useState(""),[M,O]=R.useState(null),[B,$]=R.useState(!1),U=R.useRef(0),H=R.useRef(0),Y=R.useRef({blank:{name:"",nameTouched:!1,path:"",pathTouched:!1},folder:{name:"",nameTouched:!1,path:"",pathTouched:!1},paper:{name:"",nameTouched:!1,path:"",pathTouched:!1}}),V=r==="paper"?tgt(M==null?void 0:M.repoUrl):null,X=i.trim()?`~/OpenResearch/${Bg(i,48)}`:"",te=`~/OpenResearch/${Bg(i||(M==null?void 0:M.title)||(M==null?void 0:M.paperId)||"")}`,I=r==="blank"&&!d?X:r==="paper"&&M&&!d?te:u,L=Ox(I.trim(),200),F=ct({...B0(L),enabled:!!L&&L===I.trim()}),q=L===I.trim()?F.data??null:null,G=L===I.trim()?((Jn=F.error)==null?void 0:Jn.message)??null:null,ee=!!I.trim()&&(L!==I.trim()||F.isFetching),ce=V??(r==="folder"&&(q!=null&&q.githubOwner)&&q.githubRepo?{owner:q.githubOwner,repo:q.githubRepo}:null),oe=ct(lht()),ne=((hn=oe.data)==null?void 0:hn.login)??(oe.isPending?void 0:null),Q=ct(m6()),le=R.useRef(!1);R.useEffect(()=>{le.current||!Q.data||(le.current=!0,N(Q.data.githubForNewProjects))},[Q.data]);const ae=Ox(i.trim(),150),ue=ct({...cht(ae),enabled:ae===i.trim()}),pe=ae===i.trim()?((En=ue.data)==null?void 0:En.repo)??Bg(i,48):Bg(i,48),Se=ae!==i.trim()||ue.isFetching,ye=ct({...QN((ce==null?void 0:ce.owner)??"",(ce==null?void 0:ce.repo)??""),enabled:!!ce,subscribed:!!ce}),qe=!!ce&&ye.isFetching,Ie=ce&&((ln=ye.data)!=null&&ln.canPush)?`github.com/${ce.owner}/${ce.repo}`:null,ze=Ox(T.trim(),350),at=egt(ze),bt=r==="paper"&&!M&&ze===T.trim(),$t=ct({...ZL(ze),enabled:bt&&!at&&ze.length>=3,subscribed:bt&&!at&&ze.length>=3}),Pt=ct({...q4(at??""),enabled:bt&&!!at,subscribed:bt&&!!at}),zt=bt&&!at?$t.data??[]:[],ot=bt&&$t.isSuccess?ze:"",ft=B||r==="paper"&&!M&&(ze!==T.trim()||(at?Pt.isFetching:$t.isFetching));R.useEffect(()=>{var pt;!bt||!at||!Pt.data||(O(Pt.data),o||a(((pt=Pt.data.title)==null?void 0:pt.trim())||Pt.data.paperId))},[bt,at,Pt.data,o]),R.useEffect(()=>{const pt=at?Pt.error:$t.error;bt&&pt&&w(pt.message)},[bt,at,Pt.error,$t.error]);const It=gn({mutationFn:fut});async function we(pt){var Ge;const kt=++U.current;$(!0),w(null);try{const mt=await nt.fetchQuery(q4(pt));if(kt!==U.current)return;O(mt),o||a(((Ge=mt.title)==null?void 0:Ge.trim())||mt.paperId)}catch(mt){kt===U.current&&w(mt instanceof Error?mt.message:String(mt))}finally{kt===U.current&&$(!1)}}function Re(){U.current+=1,H.current+=1,O(null),z(""),$(!1),x(!1),_(""),p(!1),Y.current.paper={name:o?i:"",nameTouched:o,path:"",pathTouched:!1},o||a("")}function Ze(pt){if(pt===r)return;U.current+=1,H.current+=1,Y.current[r]={name:i,nameTouched:o,path:u,pathTouched:d};const kt=Y.current[pt];s(pt),w(null),$(!1),x(!1),a(kt.name),l(kt.nameTouched),_(kt.path),p(kt.pathTouched)}async function ht(){if(m)return;const pt=++H.current;x(!0),w(null);try{const kt=await dut();if(pt!==H.current||!kt)return;if(p(!0),_(kt),nt.invalidateQueries(B0(kt)),r==="folder"&&!o){const Ge=kt.replace(/[\\/]+$/,"").split(/[\\/]/).pop();Ge&&a(Ge)}}catch(kt){pt===H.current&&w(kt instanceof Error?kt.message:String(kt))}finally{pt===H.current&&x(!1)}}async function xt(pt){if(pt.preventDefault(),!!vt){v(!0),w(null);try{const kt=await nt.fetchQuery({...B0(I.trim()),staleTime:0});if(kt.exists&&kt.directory===!1)throw new Error(wx());if(r==="blank"&&kt.exists)throw new Error(rN());if(r==="paper"&&kt.empty===!1)throw new Error(lN());E&&ce&&await nt.fetchQuery({...QN(ce.owner,ce.repo),staleTime:0}).catch(()=>null);const Ge=await It.mutateAsync({name:i.trim(),path:I.trim(),createFolder:r!=="folder",requireNewFolder:r==="blank",initializeGit:!0,githubSyncEnabled:E,locale:j(),...r==="paper"&&M?{paperId:M.paperId,cloneUrl:M.repoUrl??void 0}:{}});e(Ge.project,Ge.githubPublicationError)}catch(kt){w(kt instanceof Error?kt.message:String(kt))}finally{v(!1)}}}const Vt=i.trim(),Ve=r==="paper"&&M&&!M.repoUrl?M.paperId:null,Ht=r==="folder"&&(q==null?void 0:q.gitState)==="ready"?q.resolvedPath??null:null,sn=Vt!==""&&(r==="blank"||Ve!==null||Ht!==null);R.useEffect(()=>{if(!sn)return;const pt=window.setTimeout(()=>{vut({name:Vt,paperId:Ve??void 0,path:Ht??void 0,locale:j()}).catch(()=>{})},1200);return()=>window.clearTimeout(pt)},[sn,Vt,Ve,Ht]);const fn=(q==null?void 0:q.gitVersion)===null,Zt=r==="folder"&&!!I.trim()&&q!==null&&q.exists===!1,Qn=r==="blank"&&(q==null?void 0:q.exists)===!0,Jt=!!I.trim()&&(q==null?void 0:q.exists)===!0&&q.directory===!1,bn=r==="paper"&&!!(M!=null&&M.repoUrl)&&(q==null?void 0:q.empty)===!1,or=r==="paper"&&!!M&&!(M!=null&&M.repoUrl)&&(q==null?void 0:q.empty)===!1,lr=r==="folder"&&((q==null?void 0:q.gitState)==="detached"||(q==null?void 0:q.gitState)==="invalid"),br=d&&!I.trim()||Jt||bn||or,Dn=d&&!I.trim()||Jt||Qn,Wr=d&&!I.trim()?oN():Jt?wx():Qn?rN():null,Nr=d&&!I.trim()?oN():Jt?wx():bn?lN():or?_Se():null,vt=!!(i.trim()&&I.trim())&&!S&&!m&&!ee&&q!==null&&!G&&!fn&&!Zt&&!Qn&&!Jt&&!bn&&!or&&!lr&&(r!=="paper"||!!M)&&(!E||typeof ne=="string"&&!Se&&!qe),un=Ie??`github.com/${ne??"you"}/${pe}`,Cn=ne===void 0||Se||qe,en=r==="paper"&&!M&&T.trim().length>=3&&ot===T.trim()&&!ft&&zt.length===0&&!b;return f.jsxs("form",{className:"form [&_.form-seg]:self-start [&_.form-seg]:mb-0.5 [&_.form-seg_button]:py-[5px] [&_.form-seg_button]:px-3 [&_.repo-hint]:font-normal [&_.repo-hint]:text-sm [&_.repo-hint]:text-muted [&_.repo-hint.ok]:text-accent-teal [&_.folder-picker-control]:flex [&_.folder-picker-control]:items-center [&_.folder-picker-control]:gap-[9px] [&_.folder-picker-control]:w-full [&_.folder-picker-control]:min-w-0 [&_.folder-picker-control]:py-2 [&_.folder-picker-control]:px-2.5 [&_.folder-picker-control]:overflow-hidden [&_.folder-picker-control]:bg-background [&_.folder-picker-control]:border [&_.folder-picker-control]:border-border [&_.folder-picker-control]:rounded-md [&_.folder-picker-control]:cursor-pointer [&_.folder-picker-control]:text-start [&_.folder-picker-control]:transition-[border-color,box-shadow] [&_.folder-picker-control]:duration-120 [&_.folder-picker-control]:ease-standard [&_.folder-picker-control:hover:not(:disabled)]:border-muted [&_.folder-picker-control:hover:not(:disabled)]:shadow-control-subtle [&_.folder-picker-control:focus-visible]:outline-2 [&_.folder-picker-control:focus-visible]:outline-solid [&_.folder-picker-control:focus-visible]:outline-text [&_.folder-picker-control:focus-visible]:outline-offset-2 [&_.folder-picker-control_span]:flex-1 [&_.folder-picker-control_span]:min-w-0 [&_.folder-picker-control_span]:overflow-hidden [&_.folder-picker-control_span]:text-ellipsis [&_.folder-picker-control_span]:whitespace-nowrap [&_.folder-picker-control_.placeholder]:text-muted [&_.folder-picker-icon]:flex-none [&_.folder-picker-icon]:text-current [&_.folder-picker-chevron]:flex-none [&_.folder-picker-chevron]:text-muted [&_.folder-picker-control:hover:not(:disabled)_.folder-picker-chevron]:text-subtext [&_.folder-picker-hint]:text-subtext [&_.folder-picker-hint]:text-sm [&_.folder-picker-hint]:font-normal [&_.folder-picker-hint]:leading-[1.4] [&_.project-location-field]:flex [&_.project-location-field]:flex-col [&_.project-location-field]:gap-2 [&_.project-location-label]:text-text [&_.project-location-label]:text-base [&_.project-location-label]:font-medium [&_.project-field-label]:text-text [&_.project-field-label]:text-base [&_.project-field-label]:font-medium [&_.folder-picker-control:disabled]:cursor-default [&_.folder-picker-control:disabled]:opacity-65 [&_.paper-destination]:flex [&_.paper-destination]:items-center [&_.paper-destination]:gap-2.5 [&_.paper-destination]:pt-2 [&_.paper-destination]:pe-2 [&_.paper-destination]:pb-2 [&_.paper-destination]:ps-3 [&_.paper-destination]:border [&_.paper-destination]:border-border [&_.paper-destination]:rounded-md [&_.paper-destination]:bg-background [&_.paper-destination_code]:flex-1 [&_.paper-destination_code]:min-w-0 [&_.paper-destination_code]:overflow-hidden [&_.paper-destination_code]:text-text [&_.paper-destination_code]:text-sm [&_.paper-destination_code]:font-normal [&_.paper-destination_code]:text-ellipsis [&_.paper-destination_code]:whitespace-nowrap [&_.paper-destination_.btn]:flex-none [&_.project-path-notice]:py-[9px] [&_.project-path-notice]:px-[11px] [&_.project-path-notice]:border [&_.project-path-notice]:border-border-variant [&_.project-path-notice]:rounded-sm [&_.project-path-notice]:bg-surface [&_.project-path-notice]:text-subtext [&_.project-path-notice]:text-sm [&_.project-path-notice]:leading-[1.4] [&_.project-path-notice.error]:border-danger-notice-border [&_.paper-results]:flex [&_.paper-results]:flex-col [&_.paper-results]:border [&_.paper-results]:border-border [&_.paper-results]:rounded-md [&_.paper-results]:max-h-60 [&_.paper-results]:overflow-y-auto [&_.paper-results_button]:flex [&_.paper-results_button]:flex-col [&_.paper-results_button]:items-start [&_.paper-results_button]:gap-0.5 [&_.paper-results_button]:py-2 [&_.paper-results_button]:px-2.5 [&_.paper-results_button]:bg-none [&_.paper-results_button]:bg-transparent [&_.paper-results_button]:border-0 [&_.paper-results_button]:border-b [&_.paper-results_button]:border-b-border-variant [&_.paper-results_button]:text-start [&_.paper-results_button]:[font:inherit] [&_.paper-results_button]:text-text [&_.paper-results_button]:cursor-pointer [&_.paper-results_button:last-child]:border-b-0 [&_.paper-results_button:hover]:bg-surface [&_.paper-results_.title]:text-sm [&_.paper-results_.title]:font-medium [&_.paper-results_.id]:text-xs [&_.paper-results_.id]:text-muted [&_.paper-pick_.id]:text-xs [&_.paper-pick_.id]:text-muted [&_.paper-pick]:flex [&_.paper-pick]:items-center [&_.paper-pick]:justify-between [&_.paper-pick]:gap-2.5 [&_.paper-pick]:py-2.5 [&_.paper-pick]:px-3 [&_.paper-pick]:border [&_.paper-pick]:border-border [&_.paper-pick]:rounded-md [&_.paper-pick]:bg-surface [&_.paper-pick_.meta]:min-w-0 [&_.paper-pick_.title]:text-sm [&_.paper-pick_.title]:font-medium flex flex-col [&_label]:flex [&_label]:flex-col [&_label]:gap-1 [&_label]:text-sm [&_label]:text-text [&_label]:font-medium [&_.row2]:grid [&_.row2]:grid-cols-2 [&_.row2]:gap-2.5 [&_.actions]:flex [&_.actions]:justify-end [&_.actions]:gap-2.5 [&_.actions]:mt-1.5 [&_.new-project-actions]:justify-start [&_.new-project-actions]:mt-2.5 [&_.error]:text-accent-red [&_.error]:text-sm [&_.error]:whitespace-pre-wrap new-project-form gap-4.5 [&_>_label]:gap-2",onSubmit:xt,children:[f.jsxs("div",{className:"seg inline-flex items-center gap-0.5 p-[3px] rounded-md bg-hover-subtle [&_button]:py-[3px] [&_button]:px-3 [&_button]:text-sm [&_button]:font-medium [&_button]:text-text [&_button]:rounded-sm [&_button:not(:disabled):hover]:text-text [&_button.active]:bg-background [&_button.active]:shadow-segment [&_button:disabled]:text-muted [&_button:disabled]:cursor-default form-seg",children:[f.jsx("button",{type:"button",className:r==="blank"?"active":"","aria-pressed":r==="blank",onClick:()=>Ze("blank"),children:YSe()}),f.jsx("span",{"aria-hidden":!0,className:`h-6 w-px bg-border${r==="paper"?"":" invisible"}`}),f.jsx("button",{type:"button",className:r==="folder"?"active":"","aria-pressed":r==="folder",onClick:()=>Ze("folder"),children:bke()}),f.jsx("span",{"aria-hidden":!0,className:`h-6 w-px bg-border${r==="blank"?"":" invisible"}`}),f.jsx("button",{type:"button",className:r==="paper"?"active":"","aria-pressed":r==="paper",onClick:()=>Ze("paper"),children:Nke()})]}),r==="paper"&&!M&&f.jsxs("label",{className:"!font-normal",children:[Yke(),f.jsx("input",{className:"text-sm font-normal","data-initial-focus":!0,value:T,onChange:pt=>{w(null),z(pt.target.value)},placeholder:a7e()}),!en&&f.jsx("span",{className:"repo-hint",children:ft?Z7e():U7e()}),en&&f.jsx("span",{className:"project-path-notice block",children:Bke()}),zt.length>0&&f.jsx("div",{className:"paper-results",children:zt.map(pt=>f.jsxs("button",{type:"button",onClick:()=>void we(pt.paperId),children:[f.jsx(op,{children:pt.title}),f.jsx("span",{className:"id",children:pt.paperId})]},pt.paperId))})]}),M&&r==="paper"&&f.jsxs("div",{className:"paper-pick !flex-col !items-stretch",children:[f.jsxs("div",{className:"flex items-start justify-between gap-2.5",children:[f.jsxs("div",{className:"meta",children:[f.jsx(op,{className:"block",children:M.title||M.paperId}),M.repoUrl&&f.jsx("div",{className:"id",children:ngt(M.repoUrl)})]}),f.jsx(Oe,{size:"small",type:"button","aria-label":lke(),onClick:Re,children:ske()})]}),!M.repoUrl&&f.jsxs("div",{className:"flex w-full flex-col items-start gap-1 rounded-md border border-border-variant bg-background px-[9px] py-1 text-sm font-normal text-subtext",children:[f.jsxs("span",{className:"flex items-center gap-[5px] text-sm",children:[f.jsx(BO,{size:16})," ",Hke()]}),f.jsx("span",{className:"text-sm font-normal text-accent-amber",children:Wke()})]})]}),(r!=="paper"||M)&&f.jsxs(f.Fragment,{children:[r==="blank"&&f.jsxs("label",{className:"!font-normal",children:[f.jsx("span",{className:"project-field-label !font-medium",children:aN()}),f.jsx("input",{className:"text-sm font-normal","data-initial-focus":!0,value:i,onChange:pt=>{l(!0),a(pt.target.value)},placeholder:iN()})]}),r==="paper"?f.jsxs("label",{className:"project-location-field",children:[f.jsx("span",{className:"project-location-label !font-medium",children:M!=null&&M.repoUrl?jSe():Sx()}),f.jsx("input",{className:"text-sm font-normal",value:I,onChange:pt=>{p(!0),_(pt.target.value)},"aria-describedby":br?"paper-destination-description":void 0,placeholder:"~/OpenResearch/paper-title",spellCheck:!1}),ee&&f.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:sN()}),br&&f.jsx("span",{id:"paper-destination-description",className:"folder-picker-hint error !text-accent-red",role:"alert",children:Nr})]}):r==="folder"&&!t?f.jsxs("button",{"data-initial-focus":!0,type:"button",className:"folder-picker-control","aria-label":u?vSe({path:Ne(u)}):tN(),disabled:m,title:u||void 0,onClick:()=>void ht(),children:[f.jsx(Dd,{className:u?"folder-picker-icon":"folder-picker-icon placeholder",size:16}),f.jsx("span",{className:u?"text-sm":"placeholder",children:m?CSe():u||tN()}),f.jsx(Ta,{className:"folder-picker-chevron",size:15})]}):r==="folder"?f.jsxs("label",{className:"project-location-field",children:[f.jsx("span",{className:"project-location-label !font-medium",children:Sx()}),f.jsx("input",{"data-initial-focus":!0,className:"text-sm font-normal",value:u,onChange:pt=>{p(!0),_(pt.target.value)},placeholder:"/home/user/project",spellCheck:!1,dir:"ltr"})]}):i.trim()?f.jsxs("label",{className:"project-location-field",children:[f.jsx("span",{className:"project-location-label !font-medium",children:Sx()}),f.jsx("input",{className:"text-sm font-normal",value:I,onChange:pt=>{p(!0),_(pt.target.value)},placeholder:"~/OpenResearch/my-research","aria-describedby":Dn?"blank-destination-description":void 0,spellCheck:!1}),ee&&f.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:sN()}),Dn&&f.jsx("span",{id:"blank-destination-description",className:"folder-picker-hint error !text-accent-red",role:"alert",children:Wr})]}):null,r!=="blank"&&I&&f.jsxs("label",{className:"!font-normal",children:[f.jsx("span",{className:"project-field-label !font-medium",children:aN()}),f.jsx("input",{className:"text-sm font-normal",value:i,onChange:pt=>{l(!0),a(pt.target.value)},placeholder:iN()})]}),fn&&f.jsx("div",{className:"project-path-notice error",children:Ake()}),!fn&&r==="folder"&&u.trim()&&!ee&&(q==null?void 0:q.exists)===!1&&f.jsx("div",{className:"project-path-notice error",children:_7e()}),!fn&&r==="folder"&&u.trim()&&!ee&&Jt&&f.jsx("div",{className:"project-path-notice error",children:w7e()}),!fn&&r==="folder"&&!ee&&(q==null?void 0:q.gitState)==="detached"&&f.jsx("div",{className:"project-path-notice error",children:fke()}),!fn&&r==="folder"&&!ee&&(q==null?void 0:q.gitState)==="invalid"&&f.jsx("div",{className:"project-path-notice error",children:v7e()}),G&&f.jsx("div",{className:"project-path-notice error",role:"alert",children:G})]}),b&&f.jsx("div",{className:"error",role:"alert",children:b}),(r!=="paper"||M)&&I&&(r!=="blank"||i.trim())&&f.jsxs("div",{className:"flex w-full flex-col items-start gap-2",children:[f.jsxs("button",{type:"button",className:`inline-flex items-center gap-1 text-sm font-medium${E&&ne===null?" text-accent-red":" text-text"}`,"aria-expanded":y,"aria-controls":"new-project-advanced-settings",onClick:()=>C(pt=>!pt),children:[E?ne===null?aSe():uSe():nSe(),f.jsx(qo,{className:y?"rotate-180":"",size:16})]}),y&&f.jsxs("label",{id:"new-project-advanced-settings",className:"flex w-full flex-col items-stretch gap-[7px] font-normal",children:[f.jsxs("span",{className:"flex flex-row items-center gap-[9px]",children:[f.jsx("input",{className:"m-0",type:"checkbox",checked:E,onChange:pt=>N(pt.target.checked),disabled:S}),f.jsx("strong",{className:"text-base font-medium leading-[1.3] text-text",children:u7e()})]}),f.jsxs("span",{className:"flex flex-col gap-[3px] font-sans text-sm font-normal leading-[1.4] text-subtext",children:[f.jsx("span",{children:Cn?E7e({repository:Ne(un)}):Ie?D7e({repository:Ne(un)}):T7e({repository:Ne(un)})}),f.jsx("span",{children:Ske()}),ne===null&&f.jsx("span",{children:K7e({command:Ne("gh auth login")})})]})]})]}),f.jsxs("div",{className:"actions new-project-actions",children:[n&&f.jsx(Oe,{type:"button",onClick:n,children:eke()}),f.jsx(Oe,{variant:"primary",className:"ms-auto",disabled:!vt,children:S?PSe():r==="paper"?M!=null&&M.repoUrl?MSe():nN():r==="folder"?n8e():nN()})]})]})}function sI({onClose:e,onCreated:n,remote:t=!1}){const r=R.useRef(null),s=R.useRef(e);return s.current=e,R.useEffect(()=>{const i=r.current;if(!i)return;const a=document.activeElement instanceof HTMLElement?document.activeElement:null,o=()=>[...i.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])')];(i.querySelector("[data-initial-focus]")??o()[0]??i).focus();const l=u=>{if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),s.current();return}if(u.key==="Enter"&&(u.metaKey||u.ctrlKey)&&!u.altKey&&u.shiftKey){u.preventDefault(),u.stopPropagation();return}if(u.key!=="Tab")return;const _=o();if(_.length===0){u.preventDefault(),i.focus();return}const d=_[0],p=_[_.length-1];u.shiftKey&&document.activeElement===d?(u.preventDefault(),p.focus()):!u.shiftKey&&document.activeElement===p&&(u.preventDefault(),d.focus())};return document.addEventListener("keydown",l,!0),()=>{document.removeEventListener("keydown",l,!0),a==null||a.focus()}},[]),f.jsx("div",{className:"modal-backdrop fixed inset-0 bg-modal-backdrop flex items-start justify-center p-5 [--new-project-modal-top:clamp(4rem,20vh,24rem)] pt-[var(--new-project-modal-top)] overflow-y-auto z-100",onClick:i=>{i.target===i.currentTarget&&e()},children:f.jsxs("div",{ref:r,className:"modal w-120 max-w-full max-h-[calc(100vh_-_var(--new-project-modal-top)_-_1.25rem)] overflow-y-auto bg-background border border-border rounded-xl shadow-modal p-6 [&_h2]:mt-0 [&_h2]:mx-0 [&_h2]:mb-3.5 [&_h2]:text-xl [&_h2]:font-medium",role:"dialog","aria-modal":"true","aria-labelledby":"new-project-dialog-title",tabIndex:-1,children:[f.jsx("h2",{id:"new-project-dialog-title",children:XD()}),f.jsx(rgt,{onCancel:e,onCreated:n,remote:t})]})})}function sgt({project:e,deleting:n,error:t,onClose:r,onConfirm:s}){const i=R.useRef(null),a=R.useRef(r),o=R.useRef(n);a.current=r,o.current=n,R.useEffect(()=>{const u=i.current;if(!u)return;const _=document.activeElement instanceof HTMLElement?document.activeElement:null,d=()=>[...u.querySelectorAll('button:not([disabled]), [tabindex]:not([tabindex="-1"])')];(d()[0]??u).focus();const p=m=>{if(m.key==="Escape"){m.preventDefault(),o.current||a.current();return}if(m.key!=="Tab")return;const x=d();if(x.length===0){m.preventDefault(),u.focus();return}const S=x[0],v=x[x.length-1];m.shiftKey&&document.activeElement===S?(m.preventDefault(),v.focus()):!m.shiftKey&&document.activeElement===v&&(m.preventDefault(),S.focus())};return document.addEventListener("keydown",p,!0),()=>{document.removeEventListener("keydown",p,!0),_==null||_.focus()}},[]);const l=!!(e.githubEnabled&&(e.githubUrl||e.githubOwner&&e.githubRepo));return f.jsx("div",{className:"modal-backdrop fixed inset-0 bg-modal-backdrop flex items-center justify-center p-5 overflow-y-auto z-100",onClick:u=>{!n&&u.target===u.currentTarget&&r()},children:f.jsxs("div",{ref:i,className:"modal w-110 max-w-full bg-background border border-border rounded-xl shadow-modal p-6",role:"dialog","aria-modal":"true","aria-labelledby":"delete-project-dialog-title","aria-describedby":"delete-project-dialog-description",tabIndex:-1,children:[f.jsx("h2",{id:"delete-project-dialog-title",className:"mt-0 mb-3 text-xl",children:oRe()}),f.jsxs("div",{id:"delete-project-dialog-description",className:"flex flex-col gap-2 text-sm leading-normal text-subtext",children:[f.jsx("p",{className:"m-0",children:HAe({name:Do(e.name)})}),f.jsx("p",{className:"m-0",children:l?wRe():ERe()}),t&&f.jsx("p",{className:"m-0 text-accent-red",role:"alert",children:t})]}),f.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[f.jsx(Oe,{disabled:n,onClick:r,children:JAe()}),f.jsx(Oe,{variant:"danger",disabled:n,onClick:s,children:n?pRe():dRe()})]})]})})}function Sz(){return f.jsx("span",{className:"activity-pulse h-2 w-2 shrink-0 rounded-full bg-accent-teal animate-[or-pulse_1.2s_ease-in-out_infinite]"})}function igt({projects:e,onOpen:n,onCreated:t,onDeleted:r,remote:s=!1}){const[i,a]=R.useState(!1),[o,l]=R.useState(null),[u,_]=R.useState(null),[d,p]=R.useState(null),m=ct(oht()),x=Object.fromEntries((m.data??[]).map(v=>[v.projectId,v]));async function S(v){l(v.id),_(null);try{await xut(v.id),_(null),p(null),r(v.id)}catch(b){_(b instanceof Error?b.message:String(b))}finally{l(null)}}return f.jsxs("div",{className:"home flex-1 min-h-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] bg-canvas",children:[f.jsxs("div",{className:"home-inner max-w-290 my-0 mx-auto pt-12 px-6 pb-16 [@media((max-width:_960px))]:pt-6 [@media((max-width:_960px))]:px-4",children:[f.jsxs("div",{className:"home-head flex items-center justify-between gap-3 mb-4.5 [&_h2]:m-0 [&_h2]:text-4xl [&_h2]:tracking-[-0.02em] [@media((max-width:_520px))]:items-start [@media((max-width:_520px))]:flex-col",children:[f.jsx("h2",{children:FRe()}),f.jsxs(Oe,{onClick:()=>a(!0),children:[f.jsx(em,{size:15})," ",XD()]})]}),f.jsx("div",{className:"home-list overflow-hidden rounded-lg border border-border bg-background",children:f.jsxs("div",{children:[f.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_9rem_9rem_minmax(18rem,max-content)] items-center gap-3 border-b border-border bg-background py-2.5 ps-4 pe-2 text-xs font-medium tracking-[0.06em] text-text uppercase [@media((max-width:_960px))]:hidden",children:[f.jsx("span",{children:IRe()}),f.jsx("span",{children:mN()}),f.jsx("span",{children:gN()}),f.jsx("span",{children:vN()})]}),e.length===0?f.jsx("div",{className:"py-8 px-4 text-sm text-muted",children:MRe()}):[...e].sort((v,b)=>{var C,E;const w=((C=x[v.id])==null?void 0:C.lastMessageAt)??v.createdAt;return(((E=x[b.id])==null?void 0:E.lastMessageAt)??b.createdAt)-w||v.name.localeCompare(b.name)}).map(v=>{const b=x[v.id],w=v.githubEnabled?v.githubUrl??(v.githubOwner&&v.githubRepo?`https://github.com/${v.githubOwner}/${v.githubRepo}`:null):null,y=w?v.githubOwner&&v.githubRepo?`${v.githubOwner}/${v.githubRepo}`:w.replace(/^https?:\/\/github\.com\//,"").replace(/\.git$/,"").replace(/\/$/,""):i6(),C=b?b.activeAgents>0?DAe({count:Wt(b.activeAgents)}):KRe():"—",E=b?b.totalAgents===1?tMe():BAe({count:Wt(b.totalAgents)}):"—",N=b?b.runningExperiments>0?iMe({count:Wt(b.runningExperiments)}):b.totalExperiments===0?l6():bN({count:Wt(b.totalExperiments)}):"—",T=b&&b.runningExperiments>0?bN({count:Wt(b.totalExperiments)}):null;return f.jsxs("div",{className:"group project-row relative grid cursor-pointer grid-cols-[minmax(0,1fr)_9rem_9rem_minmax(18rem,max-content)] items-center gap-3 border-b border-border-variant py-4 ps-4 pe-2 text-start transition-colors duration-120 ease-standard last:border-b-0 hover:bg-surface-bright focus-within:bg-surface-bright [@media((max-width:_960px))]:grid-cols-[minmax(0,0.8fr)_minmax(0,0.8fr)_minmax(0,1.4fr)] [@media((max-width:_960px))]:items-start [@media((max-width:_960px))]:gap-x-4 [@media((max-width:_960px))]:gap-y-3 [@media((max-width:_960px))]:py-4 [@media((max-width:_960px))]:px-4 [@media((max-width:_600px))]:grid-cols-2",children:[f.jsx("button",{className:"project-row-open absolute inset-0 z-0 cursor-pointer rounded-[inherit] focus-visible:outline focus-visible:outline-2 focus-visible:outline-text focus-visible:outline-offset-[-2px]","aria-label":NQ({name:Do(v.name)}),onClick:()=>n(v.id)}),f.jsxs("div",{className:"relative z-1 flex min-w-0 flex-col gap-1 pointer-events-none [@media((max-width:_960px))]:col-span-3 [@media((max-width:_600px))]:col-span-2",children:[f.jsx("span",{dir:"auto",className:"project-row-title whitespace-normal break-words text-base font-semibold text-text pointer-events-none",children:v.name}),f.jsxs("span",{className:"relative z-2 flex items-center gap-1.5 text-xs text-muted [@media((max-width:_960px))]:flex-wrap",children:[f.jsxs("span",{children:[rRe()," ",Io(v.createdAt)]}),v.paperId&&f.jsx("span",{"aria-hidden":"true",children:"·"}),v.paperId&&f.jsxs("span",{children:[QAe()," ",Ne(v.paperId)]}),f.jsx("button",{className:"project-row-secondary project-row-delete inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-sm leading-0 text-muted opacity-0 pointer-events-none transition-opacity hover:bg-surface hover:text-accent-red group-hover:opacity-100 group-hover:pointer-events-auto group-focus-within:opacity-100 group-focus-within:pointer-events-auto focus:opacity-100 focus:pointer-events-auto focus-visible:outline focus-visible:outline-2 focus-visible:outline-text","aria-label":S4({name:Do(v.name)}),disabled:o===v.id,onClick:z=>{z.stopPropagation(),_(null),p(v)},children:f.jsx(Xd,{size:14})})]})]}),f.jsxs("div",{className:"relative z-1 flex min-w-0 flex-col gap-1 pointer-events-none",children:[f.jsx("span",{className:"hidden text-xs font-medium tracking-[0.06em] text-text uppercase [@media((max-width:_960px))]:block",children:mN()}),f.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-text",children:[b&&b.activeAgents>0&&f.jsx(Sz,{}),C]}),f.jsx("span",{className:"text-xs text-muted",children:E})]}),f.jsxs("div",{className:"relative z-1 flex min-w-0 flex-col gap-1 pointer-events-none",children:[f.jsx("span",{className:"hidden text-xs font-medium tracking-[0.06em] text-text uppercase [@media((max-width:_960px))]:block",children:gN()}),f.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-text",children:[b&&b.runningExperiments>0&&f.jsx(Sz,{}),N]}),T&&f.jsx("span",{className:"text-xs text-muted",children:T})]}),f.jsxs("div",{className:"relative z-1 min-w-0 pointer-events-none [@media((max-width:_600px))]:col-span-2",children:[f.jsx("span",{className:"hidden text-xs font-medium tracking-[0.06em] text-text uppercase [@media((max-width:_960px))]:mb-1 [@media((max-width:_960px))]:block",children:vN()}),w?f.jsxs("a",{className:"project-row-secondary inline-flex max-w-full items-center gap-2 text-sm text-text no-underline pointer-events-auto hover:underline underline-offset-2",href:w,target:"_blank",rel:"noreferrer","aria-label":J1({name:Do(v.name)}),children:[f.jsx("span",{className:"inline-flex shrink-0",children:f.jsx(hb,{size:14})}),f.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap [@media((max-width:_960px))]:whitespace-normal [@media((max-width:_960px))]:break-all",children:Ne(y)})]}):f.jsx("span",{className:"text-sm text-text pointer-events-none",children:y})]})]},v.id)})]})})]}),i&&f.jsx(sI,{remote:s,onClose:()=>a(!1),onCreated:(v,b)=>{a(!1),t(v,b)}}),d&&f.jsx(sgt,{project:d,deleting:o===d.id,error:u,onClose:()=>{_(null),p(null)},onConfirm:()=>void S(d)})]})}function iI(){const e=R.useSyncExternalStore(nht,WN,WN);return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:e?"":E4()}),!e&&f.jsxs("div",{className:"offline-banner flex items-center gap-2 shrink-0 py-1.5 px-3.5 text-sm text-text bg-accent-amber-subtle border-b border-b-accent-amber","aria-hidden":!0,children:[f.jsx(BO,{size:13,className:"shrink-0 text-accent-amber"}),f.jsx("span",{dir:"auto",className:"min-w-0",children:E4()})]})]})}const aI={id:"lmstudio",label:"LM Studio",icon:eI,url:"http://127.0.0.1:1234/v1"},N1=[aI,{id:"omlx",label:"oMLX",icon:nI,url:"http://127.0.0.1:8000/v1"},{id:"ollama",label:"Ollama",icon:tI,url:"http://127.0.0.1:11434/v1"},{id:"openai-compatible",label:"Custom Endpoint",icon:null,url:"http://127.0.0.1:8000/v1"}];function oI({installed:e,onConnected:n,dialogOnly:t=!1,onClose:r}){var X,te;const s=i_(),i=ct({...qft(),enabled:!t}),a=ct(fu()),o=(X=a.data)==null?void 0:X.find(I=>I.id==="opencode"),[l,u]=R.useState(t),_=()=>{u(!1),r==null||r()},[d,p]=R.useState("lmstudio"),m=N1.find(I=>I.id===d)??aI,[x,S]=R.useState({}),v=x[m.id]??{baseUrl:m.url,apiKey:"",models:[],model:null,contextWindow:"32768",error:null},{baseUrl:b,models:w,model:y,contextWindow:C,error:E}=v,N=m.id==="ollama"?"":v.apiKey,T=I=>{S(L=>({...L,[m.id]:{...L[m.id]??v,...I}}))},z=gn({mutationFn:wft}),M=gn({mutationFn:async I=>{var q;const L=await Sft(I);if(!((q=(await s.fetchQuery({...fu(),staleTime:0})).find(G=>G.id==="opencode"))!=null&&q.models.some(G=>G.id===L.model)))throw new Error(F3e());return L}}),O=gn({mutationFn:Cft}),B=Number(C),$=z.isPending||M.isPending,U=(I={})=>T({models:[],model:null,error:null,...I}),H=async()=>{U();try{const I=await z.mutateAsync({baseUrl:b.trim(),apiKey:N});T({models:I.models,model:I.models[0]??null})}catch(I){T({error:I instanceof Error?I.message:String(I)})}},Y=async()=>{if(y){T({error:null});try{const I=await M.mutateAsync({name:m.label,baseUrl:b.trim(),apiKey:N,model:y,contextWindow:B});_(),n==null||n(I.model)}catch(I){T({error:I instanceof Error?I.message:String(I)})}}},V=async I=>{try{await O.mutateAsync(I)}catch(L){Kn(L instanceof Error?L.message:String(L),"error")}};return f.jsxs(f.Fragment,{children:[!t&&f.jsxs("section",{className:"mt-4 space-y-3 border-t border-border pt-4","aria-label":XE(),children:[f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[f.jsx("h3",{className:"text-base font-medium",children:XE()}),f.jsxs(Oe,{disabled:$,onClick:()=>u(!0),"aria-haspopup":"dialog",children:[f.jsx(em,{size:14}),ID()]})]}),i.error&&f.jsx("p",{className:"text-sm text-accent-red",role:"alert",children:i.error.message}),f.jsx("div",{className:"space-y-3",children:(te=i.data)==null?void 0:te.map(I=>f.jsx(agt,{connection:I,harnessReady:(o==null?void 0:o.agentReady)??!1,availableModels:(o==null?void 0:o.models.map(L=>L.id))??[],checking:a.isFetching,unknown:a.isError||!a.data,disabled:$||O.isPending,onRemove:()=>void V(I.id)},I.id))})]}),l&&f.jsx(ogt,{busy:$,onClose:_,footer:f.jsxs(Oe,{variant:"primary",disabled:$||!e||w.length>0&&(!y||!Number.isSafeInteger(B)||B<4096),onClick:()=>void(w.length>0?Y():H()),children:[$&&f.jsx(Lt,{}),w.length>0?w5e():D3e()]}),children:f.jsxs("div",{className:"space-y-4",children:[!e&&f.jsxs("div",{className:"text-sm text-text",children:[f.jsx("p",{children:_5e()}),f.jsx(Hh,{href:"https://opencode.ai/docs/#install",target:"_blank",rel:"noreferrer",children:u5e()})]}),f.jsx(Ld,{choices:N1,value:d,title:YE(),header:YE(),variant:"field",floating:!0,dropDown:!0,disabled:$,renderLabel:I=>f.jsxs(f.Fragment,{children:[I.id==="openai-compatible"?t6():I.label,I.id==="openai-compatible"&&f.jsx("span",{className:"ml-1 text-xs font-normal text-subtext",children:BD()})]}),renderIcon:I=>{var F;const L=(F=N1.find(q=>q.id===I.id))==null?void 0:F.icon;return L?f.jsx("img",{src:L,alt:"",width:14,height:14,className:`size-3.5 shrink-0 object-contain${I.id==="ollama"?" dark:invert":""}`}):f.jsx(GO,{size:14,className:"shrink-0"})},onSelect:p}),f.jsxs("label",{className:"block space-y-1 text-sm text-subtext",children:[f.jsx("span",{children:T3e()}),f.jsx(rs,{value:b,disabled:$,onChange:I=>{U({baseUrl:I.target.value})}})]}),m.id!=="ollama"&&f.jsxs("details",{className:"text-sm text-text",children:[f.jsx("summary",{className:"cursor-pointer",children:oL()}),f.jsxs("label",{className:"block space-y-1 mt-3 text-sm text-subtext",children:[f.jsx("span",{children:m.id==="lmstudio"?R5e():v5e()}),f.jsx(rs,{type:"password",autoComplete:"off",value:N,disabled:$,onChange:I=>U({apiKey:I.target.value})})]})]},m.id),w.length>0&&f.jsxs(f.Fragment,{children:[f.jsx(Ld,{choices:w.map(I=>({id:I,label:I})),value:y,searchPlaceholder:HD(),title:L0(),header:L0(),variant:"field",floating:!0,dropDown:!0,disabled:$,onSelect:I=>{T({model:I})}}),f.jsxs("label",{className:"block space-y-1 text-sm text-subtext",children:[f.jsx("span",{children:Q3e()}),f.jsx(rs,{type:"number",min:4096,step:1024,value:C,disabled:$,onChange:I=>{T({contextWindow:I.target.value})}})]}),f.jsx("p",{className:"text-sm text-subtext",children:J3e()})]}),E&&f.jsx("p",{className:"text-sm text-accent-red",role:"alert",children:E})]})})]})}function agt({connection:e,harnessReady:n,availableModels:t,checking:r,unknown:s,disabled:i,onRemove:a}){const o=gn({mutationFn:async()=>{try{await kft(e.id)}finally{await nb(!0)}}}),l=N1.find(x=>x.label===e.name||x.id==="openai-compatible"&&["OpenAI-compatible server","Custom endpoint"].includes(e.name)),u=Object.keys(e.models),_=u.length>0&&n&&u.every(x=>t.includes(`${e.id}/${x}`)),d=o.isPending||r,p=s,m=_;return f.jsxs("div",{className:"@container min-w-0 px-4 py-4",children:[f.jsxs("div",{className:"flex flex-col items-stretch gap-3 @sm:flex-row @sm:items-center @sm:justify-between",children:[f.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[l!=null&&l.icon?f.jsx("img",{src:l.icon,alt:"",width:20,height:20,className:`mt-0.5 size-5 shrink-0 object-contain${l.id==="ollama"?" dark:invert":""}`}):f.jsx(GO,{size:20,className:"mt-0.5 shrink-0"}),f.jsxs("div",{className:"min-w-0 space-y-1",children:[f.jsx("div",{className:"text-base font-medium break-words",children:u.join(", ")}),f.jsxs("div",{className:"text-sm text-subtext break-all",children:[(l==null?void 0:l.id)==="openai-compatible"?t6():(l==null?void 0:l.label)??e.name,(l==null?void 0:l.id)==="openai-compatible"&&f.jsx("span",{className:"ml-1 text-xs font-normal text-subtext",children:BD()})," · ",e.baseUrl]})]})]}),f.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1 self-end @sm:self-auto @lg:flex-row @lg:items-center @lg:gap-2",children:[f.jsx("span",{role:"status",children:f.jsx(Ft,{variant:d||p?"default":m?"success":"warning",children:d?Yi():p?vL():m?G3e():Ya()})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(Oe,{variant:"ghost",disabled:i||o.isPending,onClick:()=>o.mutate(),children:[f.jsx(Aa,{size:14}),UD()]}),f.jsx(Qt,{"aria-label":a5e({name:e.name}),disabled:i||o.isPending,onClick:a,children:f.jsx(Xd,{size:14})})]})]})]}),o.error&&!m&&f.jsx("p",{className:"mt-2 text-sm text-accent-red",role:"alert",children:o.error.message})]})}function ogt({busy:e,onClose:n,footer:t,children:r}){const s=R.useRef(null),i=()=>{e||n()};return ib(s,i,"input"),no.createPortal(f.jsx("div",{className:"fixed inset-0 z-200 flex items-center justify-center bg-modal-backdrop p-5",onClick:a=>{a.target===a.currentTarget&&i()},children:f.jsxs("div",{ref:s,role:"dialog","aria-modal":"true","aria-labelledby":"local-model-dialog-title",tabIndex:-1,className:"relative flex max-h-full w-140 max-w-full flex-col rounded-xl border border-border bg-background shadow-modal",children:[f.jsx("div",{className:"shrink-0 px-6 pt-5 pb-4 pe-14",children:f.jsx("h2",{id:"local-model-dialog-title",className:"m-0 text-xl font-medium",children:ID()})}),f.jsx(Qt,{className:"absolute end-3.5 top-3.5","aria-label":Ad(),onClick:i,disabled:e,children:f.jsx(qr,{size:16})}),f.jsx("div",{className:"min-h-0 overflow-y-auto px-6 pb-2",children:r}),f.jsxs("div",{className:"flex shrink-0 justify-end gap-2 px-6 py-4",children:[f.jsx(Oe,{onClick:i,disabled:e,children:Ad()}),t]})]})}),document.body)}const lI=["model-group flex items-center justify-between gap-2","text-sm font-medium text-text pt-2.5 px-2 pb-1.5"].join(" "),kz=["model-more [&_code]:font-mono [&_code]:text-xs","[&_code]:bg-panel [&_code]:border [&_code]:border-border-variant","[&_code]:rounded-xs [&_code]:py-px [&_code]:px-[5px] [&_code]:whitespace-nowrap","pt-1 px-2 pb-2 text-sm text-muted"].join(" "),E0={"claude-code":"Claude Code",codex:"Codex",opencode:"OpenCode",cursor:"Cursor"};function lgt(e){var r,s;const n=e.find(i=>i.agentReady);if(!n)return null;const t=((r=n.models[0])==null?void 0:r.id)??null;return{harness:n.id,model:t,serviceTier:rv(n,t,null),permissionMode:((s=n.options)==null?void 0:s.defaultPermissionMode)??null,reasoningLevel:tb(n,t).defaultId}}function ro(e){const[n,t]=R.useState(!1),r=R.useRef(null);return R.useEffect(()=>{if(!n)return;const s=a=>{var o,l;a.target instanceof Node&&!((o=r.current)!=null&&o.contains(a.target))&&!((l=e==null?void 0:e.current)!=null&&l.contains(a.target))&&t(!1)},i=a=>{var o;a.key==="Escape"&&(a.preventDefault(),a.stopPropagation(),t(!1),(o=e==null?void 0:e.current)==null||o.focus())};return document.addEventListener("mousedown",s,!0),document.addEventListener("keydown",i,!0),()=>{document.removeEventListener("mousedown",s,!0),document.removeEventListener("keydown",i,!0)}},[n,e]),{open:n,setOpen:t,ref:r}}function cgt({value:e,onSelect:n,permissionChoices:t=[],defaultPermissionId:r,onSelectPermission:s,reasoningChoices:i=[],defaultReasoningId:a,onSelectReasoning:o,lockHarness:l=!1,className:u}){var ne,Q,le,ae,ue,pe,Se;const{data:_=ugt}=ct(fu()),d=i_(),[p,m]=R.useState(!1),x=R.useRef(null),S=R.useRef(null),{open:v,setOpen:b,ref:w}=ro(x),[y,C]=R.useState(""),[E,N]=R.useState("root"),T=()=>{b(!1),N("root"),C("")};R.useEffect(()=>{var ye;v&&(E==="reasoning"||E==="speed"||E==="permissions")&&((ye=S.current)==null||ye.focus())},[v,E]);const z=R.useMemo(()=>{const ye=y.trim().toLowerCase();return(l&&e?_.filter(Ie=>Ie.id===e.harness):_).map(Ie=>{let ze=Ie.models;return ye?ze=ze.filter(at=>`${at.id} ${I0(at)}`.toLowerCase().includes(ye)):(Ie.id==="opencode"||Ie.id==="cursor")&&(ze=ze.slice(0,5)),{harness:Ie,models:ze,hidden:ye?0:Ie.models.length-ze.length}})},[_,y,l,e]),M=(ye,qe)=>{var ze;const Ie=(e==null?void 0:e.harness)===ye.id;n({harness:ye.id,model:qe,serviceTier:rv(ye,qe,Ie?e==null?void 0:e.serviceTier:null),permissionMode:Ie?e.permissionMode:((ze=ye.options)==null?void 0:ze.defaultPermissionMode)??null,reasoningLevel:qL(ye,qe,Ie?e.reasoningLevel:null)}),T()},O=(e==null?void 0:e.model)!=null?(ne=_.find(ye=>ye.id===e.harness))==null?void 0:ne.models.find(ye=>ye.id===e.model):void 0,B=e?e.model?O?I0(O):D4(e.model):ZE():L0(),$=(e==null?void 0:e.reasoningLevel)??a??((Q=i[0])==null?void 0:Q.id),U=(le=i.find(ye=>ye.id===$))==null?void 0:le.label,H=(e==null?void 0:e.permissionMode)??r??((ae=t[0])==null?void 0:ae.id),Y=(ue=t.find(ye=>ye.id===H))==null?void 0:ue.label,V=(e==null?void 0:e.harness)==="opencode"?Z6e():h6e(),X=_.find(ye=>ye.id===(e==null?void 0:e.harness)),te=HL(X,e==null?void 0:e.model),I=rv(X,e==null?void 0:e.model,e==null?void 0:e.serviceTier),L=(pe=te.find(ye=>ye.id===I))==null?void 0:pe.label,F=ye=>{o==null||o(ye),T()},q=ye=>{s==null||s(ye),T()},G=ye=>{e&&n({...e,serviceTier:ye}),T()},ee=(ye,qe,Ie)=>f.jsxs("button",{type:"button",className:"model-root-row flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-start text-sm text-text hover:bg-surface","aria-haspopup":"menu",onClick:()=>N(Ie),children:[f.jsx("span",{className:"flex-1",children:ye}),qe&&f.jsx("span",{className:"max-w-36 truncate text-sm text-muted",children:qe}),f.jsx(Ta,{size:14,className:"shrink-0 text-muted"})]}),ce=ye=>f.jsxs("button",{ref:S,type:"button",className:"model-submenu-header flex w-full items-center gap-2 border-0 border-b border-solid border-b-border-variant bg-transparent px-2 py-2 text-start text-sm font-medium text-text hover:bg-surface",onClick:()=>{N("root"),C("")},children:[f.jsx(IO,{size:15}),ye]}),oe=(ye,qe,Ie,ze)=>f.jsx("div",{className:"model-menu-list overflow-y-auto p-1.5",children:ye.map(at=>f.jsxs(sr,{onClick:()=>ze(at.id),children:[f.jsxs("span",{className:"flex min-w-0 flex-col items-start gap-0.5",children:[f.jsxs("span",{children:[at.label,at.id===Ie&&f.jsxs("span",{className:"font-normal text-muted",children:[" ",FD()]})]}),at.description&&f.jsx("span",{className:"max-w-72 text-sm font-normal leading-snug text-muted",children:at.description})]}),at.id===qe&&f.jsx(Na,{size:13})]},at.id))});return f.jsxs("div",{className:"model-picker relative inline-flex min-w-0","data-onboarding":"model-picker",ref:w,children:[f.jsxs("button",{ref:x,type:"button",className:Ds("composer-pill inline-flex h-8 min-w-0 max-w-full items-center gap-[5px] rounded-md px-2 text-sm text-text whitespace-nowrap transition-[background,color] duration-150 ease-standard hover:bg-surface",u),title:kK({label:`${B}${U?` · ${U}`:""}${L?` · ${L}`:""}`}),"aria-haspopup":"menu","aria-expanded":v,onClick:()=>{v?T():(N("root"),b(!0))},children:[I==="priority"?f.jsx(Mmt,{size:14,fill:"currentColor","aria-hidden":"true"}):e!=null&&e.harness?f.jsx(J4,{harness:e.harness,size:14}):null,I==="priority"&&f.jsxs("span",{className:"sr-only",children:[g6e()," "]}),f.jsxs("span",{className:"model-picker-label min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:[B,U&&f.jsx("span",{className:"model-picker-reasoning ms-1 text-muted",children:U})]}),f.jsx(qo,{size:14,className:"shrink-0 text-muted"})]}),v&&f.jsxs("div",{className:"model-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-100 flex flex-col bg-background border border-border rounded-md shadow-dropdown z-50 overflow-hidden w-72 [&.align-right]:start-auto [&.align-right]:end-0 [&_input]:rounded-none [&_input]:border-0 [&_input]:border-b [&_input]:border-b-border-variant [&_input]:bg-none [&_input]:bg-transparent [&_input]:py-2 [&_input]:px-2.5 [&_input]:text-sm [&_input]:outline-none align-right",children:[E==="root"&&f.jsxs("div",{className:"model-root-menu p-1",children:[ee(L0(),B,"models"),i.length>0&&ee(V,U,"reasoning"),te.length>0&&ee(eN(),L,"speed"),t.length>0&&ee(JE(),Y,"permissions")]}),E==="models"&&f.jsxs(f.Fragment,{children:[ce(L0()),f.jsx("input",{autoFocus:!0,type:"text",placeholder:HD(),value:y,onChange:ye=>C(ye.target.value)}),f.jsxs("div",{className:"model-menu-list overflow-y-auto p-1.5",children:[z.map(({harness:ye,models:qe,hidden:Ie})=>f.jsxs("div",{className:"[&_.model-item]:ps-6",children:[f.jsxs("div",{className:lI,children:[f.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[f.jsx(J4,{harness:ye.id,size:14}),ye.name]}),!ye.agentReady&&f.jsxs("span",{className:"model-group-status inline-flex items-center gap-1 text-accent-amber font-normal",children:[f.jsx(gz,{size:10})," ",Ya()]})]}),ye.agentReady?f.jsxs(f.Fragment,{children:[ye.models.length===0&&f.jsxs(sr,{onClick:()=>M(ye,null),children:[f.jsxs("span",{children:[ZE(),f.jsx("span",{className:"model-id",children:PD()})]}),(e==null?void 0:e.harness)===ye.id&&(e==null?void 0:e.model)===null&&f.jsx(Na,{size:13})]}),qe.map(ze=>f.jsxs(sr,{title:ze.id,onClick:()=>M(ye,ze.id),children:[f.jsx("span",{children:I0(ze)}),(e==null?void 0:e.harness)===ye.id&&(e==null?void 0:e.model)===ze.id&&f.jsx(Na,{size:13})]},ze.id)),y.trim().length>0&&!ye.models.some(ze=>ze.id===y.trim())&&f.jsx(sr,{onClick:()=>M(ye,y.trim()),children:f.jsx("span",{children:K6e({id:Ne(y.trim())})})})]}):f.jsx("div",{className:"model-more [&_code]:font-mono [&_code]:text-xs [&_code]:bg-panel [&_code]:border [&_code]:border-border-variant [&_code]:rounded-xs [&_code]:py-px [&_code]:px-[5px] [&_code]:whitespace-nowrap pt-1 px-2 pb-2 text-sm text-muted model-unavailable leading-normal border-b border-b-border-variant",children:ye.agentNote?tm(ye.agentNote):A6e()}),ye.id==="opencode"&&f.jsx(sr,{type:"button",className:"font-medium","aria-haspopup":"dialog",onClick:()=>{var ze;T(),(ze=x.current)==null||ze.focus(),m(!0)},children:f.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[Y5e(),f.jsx(em,{size:14,"aria-hidden":"true"})]})}),ye.agentReady&&Ie>0&&f.jsx("div",{className:kz,children:N6e({count:Wt(Ie)})})]},ye.id)),_.length===0&&f.jsx("div",{className:kz,children:c6e()})]}),l&&e&&_.length>1&&f.jsxs("div",{className:"model-locked-note py-[7px] px-3 text-sm text-muted border-t border-t-border-variant",children:[f.jsx(gz,{size:11,className:"inline-block align-baseline me-1","aria-hidden":"true"}),B6e()]})]}),E==="reasoning"&&f.jsxs(f.Fragment,{children:[ce(V),oe(i,$,a,F)]}),E==="permissions"&&f.jsxs(f.Fragment,{children:[ce(JE()),oe(t,H,r,q)]}),E==="speed"&&f.jsxs(f.Fragment,{children:[ce(eN()),oe(te,I??void 0,"default",G)]})]}),p&&f.jsx(oI,{dialogOnly:!0,installed:((Se=_.find(ye=>ye.id==="opencode"))==null?void 0:Se.installed)??!1,onClose:()=>m(!1),onConnected:ye=>{var Ie;const qe=(Ie=d.getQueryData(fu().queryKey))==null?void 0:Ie.find(ze=>ze.id==="opencode");qe&&(!l||(e==null?void 0:e.harness)==="opencode")&&M(qe,ye)}})]})}function Ld({choices:e,value:n,defaultId:t,header:r,align:s="left",dropDown:i=!1,disabled:a=!1,variant:o="pill",title:l,numbered:u=!1,searchPlaceholder:_,renderIcon:d,renderLabel:p,floating:m=!1,onSelect:x,className:S}){var Y,V;const v=R.useRef(null),{open:b,setOpen:w,ref:y}=ro(v),C=R.useRef(null),[E,N]=R.useState("");if(R.useLayoutEffect(()=>{var L;const X=C.current,te=y.current;if(!b||!m||!X||!te)return;X.matches(":popover-open")||(X.showPopover(),(L=X.querySelector("input"))==null||L.focus());const I=()=>{const F=te.getBoundingClientRect(),q=window.innerHeight-F.bottom-12,G=F.top-12,ee=Math.min(380,X.scrollHeight),ce=i?q>=ee||q>=G:GG;X.style.width=`${F.width}px`,X.style.minWidth="0",X.style.maxHeight=`${Math.max(0,Math.min(380,ce?q:G))}px`,X.style.left=`${F.left}px`,X.style.top=`${ce?F.bottom+4:F.top-X.getBoundingClientRect().height-4}px`};return I(),window.addEventListener("resize",I),window.addEventListener("scroll",I,!0),()=>{window.removeEventListener("resize",I),window.removeEventListener("scroll",I,!0)}},[b,m,i,E,e.length,y]),e.length===0)return null;const T=n??t??((Y=e[0])==null?void 0:Y.id)??null,z=e.find(X=>X.id===T),M=e.find(X=>X.id===t),O=o==="bare"&&(M==null?void 0:M.id)===nv?M:void 0,$=(O?e.filter(X=>X.id!==O.id):e).filter(X=>`${X.label} ${X.id}`.toLowerCase().includes(E.toLowerCase())),U=(z==null?void 0:z.label)??((V=e[0])==null?void 0:V.label)??"",H=X=>{var te;x(X),w(!1),(te=v.current)==null||te.focus()};return f.jsxs("div",{className:`option-picker relative inline-flex${o==="field"?" w-full":""}`,ref:y,children:[f.jsxs("button",{ref:v,type:"button",className:Ds(o==="field"?"inline-flex h-9 w-full items-center justify-between gap-2 rounded-md border border-border bg-background px-3 text-sm font-normal text-text transition-colors duration-120 ease-standard hover:bg-surface disabled:opacity-45":`inline-flex h-8 items-center rounded-md transition-[background,color] duration-150 ease-standard hover:bg-surface ${o==="pill"?"composer-pill gap-[5px] px-2 text-sm text-text whitespace-nowrap":"composer-bare gap-[3px] px-1 text-sm text-text"}`,S),title:l,"aria-haspopup":"menu","aria-expanded":b,disabled:a,onClick:()=>{N(""),w(X=>!X)},children:[f.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2",children:[z&&(d==null?void 0:d(z)),f.jsx("span",{className:"truncate",children:z?(p==null?void 0:p(z))??U:U})]}),f.jsx(qo,{size:12})]}),b&&f.jsxs("div",{ref:C,popover:m?"manual":void 0,style:m?{position:"fixed",inset:"auto",margin:0}:void 0,className:`option-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-95 flex flex-col bg-background border border-border rounded-lg shadow-menu z-50 overflow-hidden min-w-47.5 p-1.5 [&.align-right]:start-auto [&.align-right]:end-0 [&.drop-down]:bottom-auto [&.drop-down]:top-[calc(100%_+_4px)] [&.session-menu]:start-auto [&.session-menu]:end-1.5 [&.session-menu]:top-[calc(100%_-_2px)] [&.session-menu]:min-w-35 ${e.some(X=>X.description)?"min-w-80":""} ${o==="field"?"min-w-full text-text":""} ${s==="right"?"align-right":""} ${i?"drop-down":""}`,children:[r&&f.jsx("div",{className:lI,children:r}),_&&f.jsx("input",{autoFocus:!0,"aria-label":_,placeholder:_,value:E,onChange:X=>N(X.target.value),className:"shrink-0 border-b border-border bg-background px-2 py-2 text-sm outline-none"}),f.jsxs("div",{className:"min-h-0 overflow-y-auto",children:[O&&f.jsxs(f.Fragment,{children:[f.jsxs(sr,{type:"button",onClick:()=>H(O.id),children:[f.jsxs("span",{className:"inline-flex items-center gap-2",children:[d==null?void 0:d(O),f.jsxs("span",{children:[(p==null?void 0:p(O))??O.label,f.jsx("span",{className:"option-default text-muted font-normal",children:PD()})]})]}),T===O.id&&f.jsx(Na,{size:13})]}),f.jsx("div",{className:"option-sep h-px my-[5px] mx-1 bg-border-variant"})]}),$.map((X,te)=>f.jsxs(sr,{type:"button",onClick:()=>H(X.id),children:[f.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[d==null?void 0:d(X),f.jsxs("span",{className:"flex min-w-0 flex-col items-start gap-0.5",children:[f.jsxs("span",{children:[(p==null?void 0:p(X))??X.label,!O&&X.id===t&&f.jsxs("span",{className:"option-default text-muted font-normal",children:[" ",FD()]})]}),X.description&&f.jsx("span",{className:"max-w-68 text-sm font-normal leading-snug text-muted",children:X.description})]})]}),T===X.id?f.jsx(Na,{size:13}):u&&f.jsx("span",{className:"option-num text-muted text-xs tabular-nums",children:te+1})]},X.id))]})]})]})}const ugt=[];function e3({size:e=16,className:n}){return f.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor",className:n,"aria-hidden":"true",children:[f.jsx("path",{d:"M3.14573 5.14704C3.34064 4.95221 3.65776 4.95237 3.85277 5.14704L7.85277 9.14704L7.85374 9.14606C8.04873 9.34105 8.0487 9.65809 7.85374 9.8531L3.85374 13.8531C3.7558 13.951 3.62815 13.9995 3.50023 13.9996C3.37223 13.9996 3.24373 13.9501 3.14573 13.8531C2.95103 13.6581 2.95083 13.341 3.14573 13.1461L6.79222 9.50056L3.14573 5.85407C2.95104 5.65905 2.95084 5.34194 3.14573 5.14704Z"}),f.jsx("path",{d:"M12.1457 1.14704C12.3406 0.952206 12.6578 0.952371 12.8528 1.14704C13.0477 1.34202 13.0477 1.65907 12.8528 1.85407L9.20726 5.50056L12.8537 9.14704C13.0487 9.34202 13.0487 9.65907 12.8537 9.85407C12.7558 9.95101 12.6282 10.0005 12.5002 10.0006C12.3722 10.0006 12.2437 9.95207 12.1457 9.85407L8.14573 5.85407C7.95104 5.65905 7.95084 5.34194 8.14573 5.14704L12.1457 1.14704Z"})]})}function uv({runtime:e,corner:n=!1}){const[t,r]=R.useState(!1),[s,i]=R.useState(!1),[a,o]=R.useState(!1),[l,u]=R.useState(null),_=ro();async function d(){if(l){o(!0);try{await $L(l),u(null)}catch(p){u(null),Kn(p instanceof Error?p.message:String(p),"error")}finally{o(!1)}}}return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:n?"fixed bottom-0 start-0 z-50":"relative shrink-0 rounded-b-lg border-t border-border bg-background",ref:_.ref,children:[_.open&&f.jsxs("div",{className:"option-menu absolute bottom-[calc(100%_+_6px)] start-2 z-50 min-w-60 rounded-lg border border-border bg-background p-1.5 shadow-menu",children:[f.jsxs("div",{className:"border-b border-border-variant px-2 pt-1 pb-2",children:[f.jsx("div",{className:"text-sm font-medium text-text",children:NMe({host:Ne(e.session.host),user:Ne(e.session.user??"")})}),f.jsxs("div",{className:"mt-0.5 text-xs text-subtext",children:["OpenResearch ",Ne(e.session.version??"…")]})]}),f.jsxs("div",{className:"flex items-center rounded-sm hover:bg-surface",children:[f.jsx(sr,{className:"hover:bg-transparent",disabled:t,onClick:async()=>{r(!0);try{await IL(),_.setOpen(!1)}catch(p){Kn(p instanceof Error?p.message:String(p),"error")}finally{r(!1)}},children:t?SMe():j4()}),f.jsx(w6,{content:eLe(),className:"me-2 shrink-0 text-subtext",children:f.jsx(R6,{size:15})})]}),f.jsx(sr,{danger:!0,disabled:s,onClick:async()=>{i(!0);try{u(await BL()),_.setOpen(!1)}catch(p){Kn(p instanceof Error?p.message:String(p),"error")}finally{i(!1)}},children:eL()})]}),n?f.jsxs(Oe,{variant:"default",className:"h-auto w-auto max-w-48 justify-start rounded-none border-accent-blue bg-accent-blue px-2.5 py-1.5 font-normal text-white [&:hover:not(:disabled)]:border-accent-blue [&:hover:not(:disabled)]:bg-accent-blue/90","aria-haspopup":"menu","aria-expanded":_.open,onClick:()=>_.setOpen(p=>!p),children:[f.jsx(e3,{size:14,className:"shrink-0"}),f.jsx("span",{className:"min-w-0 truncate text-sm leading-tight",children:kx({host:Ne(e.session.host)})})]}):f.jsxs("div",{className:"flex items-center gap-1.5 py-2 ps-1 pe-2.5",children:[f.jsx(Qt,{size:"small","aria-label":kx({host:Ne(e.session.host)}),"aria-haspopup":"menu","aria-expanded":_.open,onClick:()=>_.setOpen(p=>!p),children:f.jsx(e3,{size:14,className:"shrink-0"})}),f.jsxs("span",{className:"flex min-w-0 flex-col gap-1 text-start text-text",children:[f.jsx("span",{className:"-my-0.5 max-w-full self-start truncate rounded-sm bg-accent-blue px-1.5 py-0.5 text-sm leading-tight text-white",children:kx({host:Ne(e.session.host)})}),f.jsxs("span",{className:"truncate text-xs leading-tight text-subtext",children:["OpenResearch ",Ne(e.session.version??"…")]})]})]})]}),l&&f.jsx(yO,{host:e.session.host,preview:l,currentClientAttached:e.session.status==="connected",stopping:a,onClose:()=>{a||u(null)},onConfirm:()=>void d()})]})}function P6(e=!0){var r;const n=sv(),t=ct({...n,enabled:e});return{status:t.data??null,error:((r=t.error)==null?void 0:r.message)??null,apply:s=>Gr(n.queryKey,s)}}const dgt=6e4,fgt=500;function cI(e){const[n,t]=R.useState(!1),[r,s]=R.useState(null),i=R.useRef(!1);R.useEffect(()=>(i.current=!1,()=>{i.current=!0}),[]);const a=e!=null&&e.restartRequired?e.instance:null;return{restarting:n,error:r,restart:()=>{if(!a||n)return;const l=sv(),u=()=>i.current||!Pn(l.queryKey);t(!0),s(null),(async()=>{try{if(await tdt(),u())return;const _=Date.now()+dgt;for(;Date.now()<_;){if(await new Promise(p=>setTimeout(p,fgt)),u())return;const d=await nt.fetchQuery({...l,staleTime:0}).catch(()=>null);if(u())return;if(d&&d.instance!==a){window.location.reload();return}}throw new Error(xlt())}catch(_){if(u())return;s(_ instanceof Error?_.message:String(_)),t(!1)}})()}}}function uI({status:e}){const[n,t]=R.useState(null),r=e!=null&&e.restartRequired?e.installedVersion:null,{restarting:s,error:i,restart:a}=cI(e);return!r||n===r?null:f.jsxs("div",{className:"update-banner flex items-center gap-2 shrink-0 py-1.5 px-3.5 text-sm text-text bg-surface border-b border-b-border",role:"status",children:[f.jsx(Aa,{size:13,className:`shrink-0 text-subtext${s?" animate-spin":""}`}),f.jsx("span",{className:"min-w-0",children:i?jL({error:i}):olt({version:Ne(r)})}),(e==null?void 0:e.canRestart)&&f.jsx(Oe,{type:"button",size:"small",disabled:s,onClick:a,children:s?TL():zL()}),f.jsx(Qt,{type:"button",size:"small",className:"ms-auto","aria-label":dlt(),disabled:s,onClick:()=>t(r),children:f.jsx(qr,{size:13})})]})}function F6(){return f.jsx("div",{className:"flex flex-1 h-full items-center justify-center",children:f.jsx(Lt,{})})}function hgt(){return f.jsxs("div",{className:"flex flex-1 h-full flex-col items-center justify-center gap-3 text-subtext",children:[f.jsx("p",{children:Ya()}),f.jsx(Yv,{to:"/projects",children:D0()})]})}function H6({error:e,reset:n}){return f.jsxs("div",{className:"flex flex-1 h-full flex-col items-center justify-center gap-3 text-subtext",children:[f.jsx("p",{role:"alert",children:e.message}),f.jsx(Oe,{onClick:n,children:Ui()}),f.jsx(Yv,{to:"/projects",children:D0()})]})}function dI({projectId:e}){const{queryClient:n}=K5({from:"__root__"}),t=Qv(),[r,s]=R.useState(null),[i,a]=R.useState(0);return R.useEffect(()=>{let o=!0;return s(null),(e?T0t(e,n):j0t(n)).then(l=>{o&&t({href:l,replace:!0})}).catch(l=>{o&&(wG(l)?a(u=>u+1):s(l instanceof Error?l:new Error(String(l))))}),()=>{o=!1}},[e,i,t,n]),r?f.jsx(H6,{error:r,reset:()=>a(o=>o+1)}):f.jsx(F6,{})}function _gt(){return f.jsx(dI,{})}function pgt({projectId:e}){return f.jsx(dI,{projectId:e})}function mgt(){const e=AO(),n=Qv(),t=rp(),r=ct(t),s=ct(Xp()),i=r.data,a=s.data,o=r.error??s.error,l=()=>{r.refetch(),s.refetch()},{status:u}=P6(e.kind==="local");R.useEffect(()=>{document.title="OpenResearch",a&&ob.queue({...E6()??a.workspace??{railOpen:!0,panelWidth:760,experimentsView:"table"},lastLocation:"/projects"})},[a]);const _=d=>void n({to:"/projects/$projectId",params:{projectId:d}});return f.jsxs("div",{className:"app flex flex-col h-full",children:[e.kind==="local"&&f.jsxs(f.Fragment,{children:[f.jsx(iI,{}),f.jsx(uI,{status:u})]}),o&&(!i||!a)?f.jsx(H6,{error:o,reset:l}):!i||!a?f.jsx(F6,{}):i.length===0&&!a.onboardingCompleted?f.jsx(Bmt,{preferredAgent:a.preferredAgent,onDone:d=>{z0t(),_(d.id)}}):f.jsx(igt,{remote:e.kind==="ssh",projects:i,onOpen:_,onCreated:(d,p)=>{p?(Kn(p,"error"),n({to:"/projects/$projectId/settings/$tab",params:{projectId:d.id,tab:"git"}})):_(d.id)},onDeleted:d=>Gr(t.queryKey,p=>p==null?void 0:p.filter(m=>m.id!==d))}),e.kind==="ssh"&&f.jsx(uv,{runtime:e,corner:!0})]})}const ggt=Fo()({component:_gt}),vgt=Fo()({component:Z0}),bgt=Fo()({}),ygt=Fo()({component:mgt}),xgt=e=>({queryKey:Nt("getRunDiff",e),queryFn:({signal:n})=>Cut(e,n),staleTime:3e4}),fI=e=>({queryKey:Nt("getExperimentDiff",e),queryFn:({signal:n})=>Eut(e,n),staleTime:3e4}),dv=(e,n,t={})=>({queryKey:Nt("getProjectFile",e,n,{...t}),queryFn:({signal:r})=>Nut(e,n,t,r),staleTime:t.ref?$h(t.ref)?1/0:3e4:1/0,refetchOnMount:t.ref?!0:"always",refetchOnWindowFocus:t.ref?!0:"always"}),hI=e=>({queryKey:Nt("getAbsoluteFile",e),queryFn:({signal:n})=>zut(e,n),staleTime:1/0,refetchOnMount:"always",refetchOnWindowFocus:"always"}),_I=(e,n={})=>({queryKey:Nt("getCodeTree",e,{...n}),queryFn:({signal:t})=>Vut(e,n,t),staleTime:n.ref&&$h(n.ref)?1/0:3e4}),fv=e=>({queryKey:Nt("getSessionWorktree",e),queryFn:({signal:n})=>Kut(e,n),staleTime:3e4}),wgt=e=>({queryKey:Nt("getArtifacts",e),queryFn:({signal:n})=>Rdt(e,n),staleTime:3e4}),q6=(e,n)=>({queryKey:Nt("getArtifactFileText",e,n),queryFn:({signal:t})=>Odt(e,n,t),staleTime:1/0,refetchOnMount:"always",refetchOnWindowFocus:"always"}),pI=(e,n)=>({queryKey:Nt("getArtifactFileMetadata",e,n),queryFn:({signal:t})=>Bdt(e,n,t),staleTime:2e3}),Sgt=()=>({queryKey:Nt("getLatexEngine"),queryFn:({signal:e})=>Mut(e),staleTime:3e5}),kgt=()=>({queryKey:Nt("getOverleafSettings"),queryFn:({signal:e})=>Lut(e),staleTime:3e5}),Cgt=(e,n,t={})=>({queryKey:Nt("getOverleafState",e,n,{...t}),queryFn:({signal:r})=>Fut(e,n,t,r),staleTime:3e5}),Egt=(e,n,t={})=>({queryKey:Nt("getOverleafStatus",e,n,{...t}),queryFn:({signal:r})=>Gut(e,n,t,r),staleTime:3e4}),mI=(e,n,t,r,s)=>({queryKey:Nt("resolvedFile",e,n,t,r??null,s??null),staleTime:s&&!$h(s)?3e4:1/0,refetchOnMount:s?!0:"always",refetchOnWindowFocus:s?!0:"always",queryFn:async({signal:i,client:a})=>{const o=async m=>{i.throwIfAborted();const x=await a.fetchQuery({...m,staleTime:s?m.staleTime:0});return i.throwIfAborted(),x},l=t==="abs",u=t==="artifacts",_=async()=>{const m=await o(pI(e,n)),x=(m==null?void 0:m.presentation)==="text"||(m==null?void 0:m.presentation)==="unknown",S=m&&x?await o(q6(e,n)):null,v=m===null||x&&S===null;return{path:n,content:(S==null?void 0:S.content)??"",truncated:(S==null?void 0:S.truncated)??!1,binary:(S==null?void 0:S.binary)??(m==null?void 0:m.presentation)==="download",notFound:v,presentation:S?S.binary?"download":"text":(m==null?void 0:m.presentation)??"download"}},d=async()=>{for(const m of[`artifacts/${n}`,n]){const x=await o(dv(e,m,{sessionId:r})).catch(()=>(i.throwIfAborted(),null));if(x&&!x.notFound)return x}return null},p=await(l?o(hI(n)).then(m=>({source:"absolute",file:m})):u?_().then(async m=>{if(!m.notFound)return{source:"artifact",file:m};const x=await d();return x?{source:"checkout",file:x}:{source:"artifact",file:m}}):o(dv(e,n,{sessionId:r,ref:s})).then(m=>m.notFound&&!s?_().then(x=>x.notFound?{source:"checkout",file:m}:{source:"artifact",file:x,checkoutRoot:m.root}):{source:"checkout",file:m}));return i.throwIfAborted(),p}});async function Ngt(e,n,t,r,s){if($h(s))return;const i=mI(e,n,t,r,s),a=[i.queryKey,...t==="abs"?[hI(n).queryKey]:[dv(e,n,{sessionId:r,ref:s}).queryKey,dv(e,`artifacts/${n}`,{sessionId:r}).queryKey,q6(e,n).queryKey,pI(e,n).queryKey]];await Promise.all(a.map(o=>nt.cancelQueries({queryKey:o,exact:!0}))),await Promise.all(a.map(o=>nt.invalidateQueries({queryKey:o,exact:!0,refetchType:"none"}))),await nt.invalidateQueries({queryKey:i.queryKey,exact:!0})}function zgt(e,n,t){return t?n.flatMap(r=>{if(r.status!=="starting"&&r.status!=="running")return[];const s=e.find(i=>i.id===r.experimentId&&i.chatSessionId===t);return s?[{experiment:s,run:r}]:[]}):[]}const Cz={done:{tone:"success",live:!1},failed:{tone:"danger",live:!1},running:{tone:"info",live:!0},starting:{tone:"warning",live:!0},cancelling:{tone:"caution",live:!0},cancelled:{tone:"caution",live:!1},editing:{tone:"accent",live:!0},idle:{tone:"neutral",live:!1}};function jgt(e){return Cz[e]??Cz.idle}const Tgt={done:Cst,failed:Mst,running:Fst,starting:Gst,cancelling:xst,cancelled:gst,editing:jst,idle:Ist};function U6(e){const n=Tgt[e];return n?n():e.charAt(0).toUpperCase()+e.slice(1)}function $l({status:e,label:n,className:t}){const r=jgt(e);return f.jsx(sb,{tone:r.tone,live:r.live,className:t,children:n??U6(e)})}const Od={local:TD,tinker:Yme,hf:bme,modal:Tme,k8s:Sme,ssh:Wme,slurm:Hme,ray:Bme,openresearch:Dme};function Ez(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),t.push.apply(t,r)}return t}function Fn(e){for(var n=1;n=0||(_[l]=a[l]);return _})(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(s[t]=e[t])}return s}function kn(e,n){return vI(e)||(function(t,r){var s=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(s!=null){var i,a,o,l,u=[],_=!0,d=!1;try{if(o=(s=s.call(t)).next,r===0){if(Object(s)!==s)return;_=!1}else for(;!(_=(i=o.call(s)).done)&&(u.push(i.value),u.length!==r);_=!0);}catch(p){d=!0,a=p}finally{try{if(!_&&s.return!=null&&(l=s.return(),Object(l)!==l))return}finally{if(d)throw a}}return u}})(e,n)||_b(e,n)||yI()}function gI(e){return vI(e)||bI(e)||_b(e)||yI()}function Wi(e){return(function(n){if(Array.isArray(n))return n3(n)})(e)||bI(e)||_b(e)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function vI(e){if(Array.isArray(e))return e}function bI(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _b(e,n){if(e){if(typeof e=="string")return n3(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n3(e,n):void 0}}function n3(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,a=!0,o=!1;return{s:function(){t=t.call(e)},n:function(){var l=t.next();return a=l.done,l},e:function(l){o=!0,i=l},f:function(){try{a||t.return==null||t.return()}finally{if(o)throw i}}}}var $g=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nm(e,n){return e(n={exports:{}},n.exports),n.exports}var qi=nm((function(e){/*! + */const Rmt=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Mmt=rt("zap",Rmt);function B6(){return f.jsxs("svg",{viewBox:"0 0 100 100","aria-hidden":"true",children:[f.jsx("rect",{width:"100",height:"100",rx:"8",fill:"#9a2036"}),f.jsx("path",{d:"M15.375 16.782v63.843a4 4 0 0 0 4 4h63.843c3.564 0 5.348-4.309 2.829-6.828L22.203 13.953c-2.52-2.52-6.828-.735-6.828 2.829",fill:"#fff"})]})}function Lx(){return f.jsxs("span",{className:"wordmark inline-flex items-center gap-[0.4em] text-text [&_svg]:w-[1em] [&_svg]:h-[1em] [&_svg]:shrink-0",children:[f.jsx(B6,{}),"OpenResearch"]})}function Dmt({cmd:e}){const[n,t]=R.useState(!1);return f.jsxs("span",{className:"cmd-inline inline-flex items-center gap-1 align-baseline",children:[f.jsx("code",{className:"font-mono text-sm",children:e}),f.jsx("button",{type:"button",className:"cmd-inline-copy inline-flex items-center p-0.5 border-0 rounded-xs bg-none bg-transparent text-muted cursor-pointer [&:hover]:bg-surface [&:hover]:text-text",onClick:()=>{navigator.clipboard.writeText(e).then(()=>{t(!0),setTimeout(()=>t(!1),1500)}).catch(()=>{})},"aria-label":n?tp():PK({value:Ne(e)}),title:n?tp():n6(),children:n?f.jsx(wa,{size:11,strokeWidth:3}):f.jsx(lb,{size:11})})]})}function tm(e){return e?e.split(/`([^`]+)`/).map((n,t)=>t%2===1?f.jsx(Dmt,{cmd:n},t):n):null}function J4({harness:e,size:n=16}){const t="block shrink-0";return e==="claude-code"?f.jsx("svg",{className:t,width:n,height:n,viewBox:"0 0 24 24",fill:"#d97757","aria-hidden":"true",children:f.jsx("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"})}):e==="opencode"?f.jsx("svg",{className:t,width:n,height:n,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:f.jsx("path",{d:"M22 24H2V0h20zM17 4.8H7v14.4h10z"})}):e==="cursor"?f.jsxs("svg",{className:t,width:n,height:n,viewBox:"388 395 191 191",fill:"none","aria-hidden":"true",children:[f.jsx("path",{fill:"#72716D",d:"M483.395 490.5L566 538.297C565.493 539.178 564.757 539.93 563.845 540.456L486.636 585.13C484.632 586.29 482.159 586.29 480.154 585.13L402.945 540.456C402.034 539.93 401.297 539.178 400.79 538.297L483.395 490.5Z"}),f.jsx("path",{fill:"#55544F",d:"M483.395 395V490.5L400.79 538.297C400.282 537.416 400 536.398 400 535.346V445.654C400 443.545 401.122 441.6 402.945 440.544L480.15 395.87C481.154 395.29 482.273 395 483.391 395H483.395Z"}),f.jsx("path",{fill:"#43413C",d:"M565.996 442.703C565.489 441.822 564.752 441.07 563.841 440.544L486.632 395.87C485.632 395.29 484.513 395 483.395 395V490.5L566 538.297C566.507 537.416 566.789 536.398 566.789 535.346V445.654C566.789 444.598 566.511 443.588 566 442.703H565.996Z"}),f.jsx("path",{fill:"#D6D5D2",d:"M560.218 446.049C560.686 446.858 560.751 447.896 560.218 448.82L485.235 578.974C484.732 579.855 483.392 579.493 483.392 578.479V492.713C483.392 492.029 483.209 491.37 482.877 490.794L560.215 446.045H560.218V446.049Z"}),f.jsx("path",{fill:"#FFFFFF",d:"M560.218 446.049L482.88 490.797C482.552 490.224 482.073 489.737 481.48 489.394L407.369 446.511C406.49 446.006 406.851 444.663 407.862 444.663H557.824C558.889 444.663 559.754 445.239 560.218 446.049Z"})]}):f.jsx("svg",{className:t,width:n,height:n,viewBox:"146 227 268 265",fill:"currentColor","aria-hidden":"true",children:f.jsx("path",{d:"M249.176 323.434V298.276C249.176 296.158 249.971 294.569 251.825 293.509L302.406 264.381C309.29 260.409 317.5 258.555 325.973 258.555C357.75 258.555 377.877 283.185 377.877 309.399C377.877 311.253 377.877 313.371 377.611 315.49L325.178 284.771C322.001 282.919 318.822 282.919 315.645 284.771L249.176 323.434ZM367.283 421.415V361.301C367.283 357.592 365.694 354.945 362.516 353.092L296.048 314.43L317.763 301.982C319.617 300.925 321.206 300.925 323.058 301.982L373.639 331.112C388.205 339.586 398.003 357.592 398.003 375.069C398.003 395.195 386.087 413.733 367.283 421.412V421.415ZM233.553 368.452L211.838 355.742C209.986 354.684 209.19 353.095 209.19 350.975V292.718C209.19 264.383 230.905 242.932 260.301 242.932C271.423 242.932 281.748 246.641 290.49 253.26L238.321 283.449C235.146 285.303 233.555 287.951 233.555 291.659V368.455L233.553 368.452ZM280.292 395.462L249.176 377.985V340.913L280.292 323.436L311.407 340.913V377.985L280.292 395.462ZM300.286 475.968C289.163 475.968 278.837 472.259 270.097 465.64L322.264 435.449C325.441 433.597 327.03 430.949 327.03 427.239V350.445L349.011 363.155C350.865 364.213 351.66 365.802 351.66 367.922V426.179C351.66 454.514 329.679 475.965 300.286 475.965V475.968ZM237.525 416.915L186.944 387.785C172.378 379.31 162.582 361.305 162.582 343.827C162.582 323.436 174.763 305.164 193.563 297.485V357.861C193.563 361.571 195.154 364.217 198.33 366.071L264.535 404.467L242.82 416.915C240.967 417.972 239.377 417.972 237.525 416.915ZM234.614 460.343C204.689 460.343 182.71 437.833 182.71 410.028C182.71 407.91 182.976 405.792 183.238 403.672L235.405 433.863C238.582 435.715 241.763 435.715 244.938 433.863L311.407 395.466V420.622C311.407 422.742 310.612 424.331 308.758 425.389L258.179 454.519C251.293 458.491 243.083 460.343 234.611 460.343H234.614ZM300.286 491.854C332.329 491.854 359.073 469.082 365.167 438.892C394.825 431.211 413.892 403.406 413.892 375.073C413.892 356.535 405.948 338.529 391.648 325.552C392.972 319.991 393.766 314.43 393.766 308.87C393.766 271.003 363.048 242.666 327.562 242.666C320.413 242.666 313.528 243.723 306.644 246.109C294.725 234.457 278.307 227.042 260.301 227.042C228.258 227.042 201.513 249.815 195.42 280.004C165.761 287.685 146.694 315.49 146.694 343.824C146.694 362.362 154.638 380.368 168.938 393.344C167.613 398.906 166.819 404.467 166.819 410.027C166.819 447.894 197.538 476.231 233.024 476.231C240.172 476.231 247.058 475.173 253.943 472.788C265.859 484.441 282.278 491.854 300.286 491.854Z"})})}const eI="data:image/svg+xml,%3csvg%20width='512'%20height='512'%20viewBox='0%200%20512%20512'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%20179.2C0%20116.474%200%2085.1112%2012.2073%2061.1531C22.9451%2040.0789%2040.0789%2022.9451%2061.1531%2012.2073C85.1112%200%20116.474%200%20179.2%200H332.8C395.526%200%20426.889%200%20450.847%2012.2073C471.921%2022.9451%20489.055%2040.0789%20499.793%2061.1531C512%2085.1112%20512%20116.474%20512%20179.2V332.8C512%20395.526%20512%20426.889%20499.793%20450.847C489.055%20471.921%20471.921%20489.055%20450.847%20499.793C426.889%20512%20395.526%20512%20332.8%20512H179.2C116.474%20512%2085.1112%20512%2061.1531%20499.793C40.0789%20489.055%2022.9451%20471.921%2012.2073%20450.847C0%20426.889%200%20395.526%200%20332.8V179.2Z'%20fill='url(%23paint0_linear_496_292)'/%3e%3crect%20opacity='0.25'%20x='128'%20y='84'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20x='64'%20y='84'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20opacity='0.25'%20x='224'%20y='144'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20x='160'%20y='144'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20opacity='0.25'%20x='168'%20y='204'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20x='104'%20y='204'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20opacity='0.25'%20x='112'%20y='264'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20x='48'%20y='264'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20opacity='0.25'%20x='176'%20y='324'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20x='112'%20y='324'%20width='224'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20opacity='0.25'%20x='304'%20y='384'%20width='152'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3crect%20x='240'%20y='384'%20width='152'%20height='44'%20rx='22'%20fill='white'%20style='fill:white;fill-opacity:1;'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_496_292'%20x1='-219.792'%20y1='229.426'%20x2='239.06'%20y2='702.601'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%236E7EF3'%20style='stop-color:%236E7EF3;stop-color:color(display-p3%200.4303%200.4946%200.9515);stop-opacity:1;'/%3e%3cstop%20offset='1'%20stop-color='%234F13BE'%20style='stop-color:%234F13BE;stop-color:color(display-p3%200.3079%200.0763%200.7470);stop-opacity:1;'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",tI="/assets/ollama-logo-Bt9O-2K_.png",nI="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='160'%20height='160'%20viewBox='0%200%20160%20160'%3e%3cdefs%3e%3cfilter%20id='shadow'%20x='-10%25'%20y='-10%25'%20width='130%25'%20height='130%25'%3e%3cfeDropShadow%20dx='0'%20dy='2'%20stdDeviation='6'%20flood-color='%23000'%20flood-opacity='0.15'/%3e%3c/filter%3e%3clinearGradient%20id='bg'%20x1='0'%20y1='0'%20x2='0'%20y2='1'%3e%3cstop%20offset='0%25'%20stop-color='%23ffffff'/%3e%3cstop%20offset='100%25'%20stop-color='%23f0f0f0'/%3e%3c/linearGradient%3e%3c/defs%3e%3crect%20x='10'%20y='10'%20width='140'%20height='140'%20rx='32'%20fill='url(%23bg)'%20filter='url(%23shadow)'/%3e%3cg%20transform='translate(25,%2025)%20scale(0.0221)'%3e%3cg%20transform='translate(0,4970)%20scale(1,-1)'%20fill='%23000000'%20stroke='none'%3e%3cpath%20d='M2275%204349%20c-408%20-39%20-769%20-207%20-1056%20-492%20-196%20-194%20-333%20-428%20-418%20-715%20-47%20-158%20-67%20-281%20-101%20-617%20-66%20-662%20-116%20-944%20-245%20-1387%20-102%20-352%20-271%20-774%20-420%20-1051%20-19%20-35%20-35%20-70%20-35%20-76%200%20-8%2050%20-11%20163%20-11%20l164%200%2080%20168%20c168%20348%20303%20739%20408%201175%2073%20307%20109%20532%20155%20982%2052%20500%2072%20627%20122%20785%20162%20507%20570%20860%201096%20951%20155%2026%20389%2026%20544%200%20221%20-38%20440%20-129%20620%20-258%2045%20-32%20152%20-126%20237%20-209%2086%20-82%20178%20-165%20204%20-183%20106%20-72%20312%20-150%20495%20-186%20l32%20-7%20-86%20-54%20c-110%20-69%20-170%20-117%20-267%20-212%20-93%20-91%20-143%20-154%20-191%20-243%20-105%20-191%20-130%20-406%20-75%20-623%2029%20-115%2081%20-239%20217%20-516%20234%20-480%20343%20-769%20411%20-1091%2036%20-172%2048%20-252%2057%20-381%20l7%20-98%20158%200%20158%200%20-4%2028%20c-2%2015%20-6%2066%20-9%20113%20-14%20218%20-95%20560%20-201%20849%20-81%20220%20-165%20407%20-363%20810%20-120%20245%20-147%20320%20-161%20443%20-38%20338%20202%20621%20766%20906%20131%2065%20166%20126%20106%20183%20-33%2031%20-86%2047%20-288%2088%20-177%2036%20-274%2061%20-370%2097%20-140%2052%20-190%2088%20-377%20270%20-140%20137%20-202%20189%20-300%20254%20-378%20250%20-782%20351%20-1233%20308z%20M3050%203391%20c-57%20-11%20-122%20-53%20-154%20-99%20-41%20-57%20-49%20-158%20-18%20-218%2029%20-56%2066%20-92%20120%20-117%20153%20-69%20323%2037%20325%20203%201%20147%20-131%20259%20-273%20231z%20M1985%201391%20c-68%20-31%20-70%20-40%20-66%20-271%201%20-114%20-2%20-243%20-9%20-290%20-40%20-307%20-124%20-555%20-255%20-754%20-25%20-38%20-45%20-71%20-45%20-72%200%20-2%2079%20-4%20176%20-4%20l175%200%2054%20113%20c117%20247%20182%20512%20201%20812%207%20126%20-9%20319%20-32%20374%20-26%2063%20-86%20111%20-136%20111%20-13%200%20-41%20-9%20-63%20-19z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Lmt={header:"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-base font-semibold text-text",list:"text-sm font-medium text-text"};function op({variant:e="list",className:n,...t}){return f.jsx("span",{className:Ns("title",Lmt[e],n),...t})}const bz=["onb-gate-hint text-base font-medium leading-normal text-text","onb-agent-hint mt-0 mx-0 mb-2.5"].join(" "),lp=["onb-card-meta text-sm text-subtext [&_code]:font-mono","[&_code]:text-xs [&_code]:bg-panel","[&_code]:border [&_code]:border-border-variant [&_code]:rounded-xs","[&_code]:py-px [&_code]:px-[5px] [&_code]:whitespace-nowrap"].join(" "),yz=["onb-gate-hint mt-4.5 mx-0 mb-0 text-base font-medium leading-normal","text-text onb-git-hint mt-2"].join(" "),rI=["onb-card flex flex-col gap-[5px] bg-background","border border-border rounded-lg py-4.5 px-5"].join(" "),xz=["onb-gate-hint mt-4.5 mx-0 mb-0 text-base font-medium leading-normal","text-text"].join(" "),Omt=[{id:"AI/ML",label:y8e},{id:"Biology",label:k8e},{id:"Physics",label:R8e},{id:"Other",label:z8e}],Imt=["welcome","environment","profile"];function Bmt({onDone:e,preferredAgent:n}){var le;const t=mn({mutationFn:ae=>cut(...ae)}),[r,s]=R.useState(0);R.useEffect(()=>{const ae=Imt[r];ae&&ed({name:"onboarding_step_viewed",step:ae})},[r]);const i=ot(ru()),a=ot(I0()),o=i.data??null,l=(le=a.data)==null?void 0:le.gitVersion,[u,_]=R.useState(!1),[d,p]=R.useState(null),[m,x]=R.useState(null),[S,v]=R.useState(!1),[b,w]=R.useState([]),[y,C]=R.useState(""),[E,N]=R.useState(""),[T,z]=R.useState([]),[M,I]=R.useState(""),[B,$]=R.useState([]),[U,H]=R.useState(!1),Y=R.useRef(0),[V,X]=R.useState(!1),[ee,O]=R.useState(!1),L=(o==null?void 0:o.some(ae=>ae.agentReady))??!1,F=l!=null,q=R.useRef(0),G=(ae,de=!1)=>{const pe=++q.current;v(!0),X(!1),O(!1);const we=()=>pe===q.current;Promise.allSettled([tb(ae,de),tt.fetchQuery({...I0(),staleTime:ae?0:3e4})]).then(([be,Pe])=>{we()&&(be.status==="rejected"&&X(!0),Pe.status==="rejected"&&O(!0))}).finally(()=>we()&&v(!1))};R.useEffect(()=>G(!1),[]),R.useEffect(()=>{if(o===null)return;const ae=o.filter(de=>de.agentReady);x(de=>{var we;if(de&&ae.some(be=>be.id===de))return de;const pe=n&&ae.find(be=>be.id===n.harness);return(pe==null?void 0:pe.id)??((we=ae[0])==null?void 0:we.id)??null})},[o,n]),R.useEffect(()=>X(i.isError),[i.isError,i.dataUpdatedAt]),R.useEffect(()=>O(a.isError),[a.isError,a.dataUpdatedAt]),R.useEffect(()=>{tt.fetchQuery(Lft()).then(ae=>{w(ae.researchAreas),C(ae.otherArea??""),N(ae.background??""),z(ae.papers)}).catch(()=>{})},[]),R.useEffect(()=>{const ae=M.trim();if(ae.length<3){$([]),H(!1);return}const de=++Y.current;H(!0);const pe=setTimeout(()=>{tt.fetchQuery(ZL(ae)).then(we=>de===Y.current&&$(we)).catch(()=>de===Y.current&&$([])).finally(()=>de===Y.current&&H(!1))},350);return()=>clearTimeout(pe)},[M]);const re=ae=>{const de=T.some(pe=>pe.paperId===ae.paperId);z(pe=>pe.some(we=>we.paperId===ae.paperId)?pe:[...pe,{paperId:ae.paperId,title:wz(ae.title)}]),I(""),$([]),de||tt.fetchQuery(q4(ae.paperId)).then(pe=>{var be;const we=(be=pe.title)==null?void 0:be.trim();we&&z(Pe=>Pe.map(Be=>Be.paperId===ae.paperId?{...Be,title:we}:Be))}).catch(()=>{})},ce=ae=>z(de=>de.filter(pe=>pe.paperId!==ae)),oe=ae=>{w(de=>de.includes(ae)?de.filter(pe=>pe!==ae):[...de,ae])},te=b.length>0&&(!b.includes("Other")||y.trim().length>0),Q=async()=>{var pe;const ae=o==null?void 0:o.find(we=>we.id===m&&we.agentReady);if(!ae||u)return;const de=Pmt(ae,((pe=ae.models[0])==null?void 0:pe.id)??null);_(!0),p(null);try{const we=await t.mutateAsync([de,{researchAreas:b,otherArea:b.includes("Other")?y:null,background:E||null,papers:T}]);e(we.project,we.selection)}catch(we){p(we instanceof Error?we.message:String(we))}finally{_(!1)}};return f.jsx("div",{className:`home flex-1 min-h-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] bg-canvas onboarding ${r===0?"[&_.home-inner]:max-w-300 [&_.home-inner]:pt-0 [&_.home-inner]:pb-0":"[&_.home-inner]:max-w-140 [&_.home-inner]:pt-24"}`,children:f.jsx("div",{className:`home-inner max-w-155 my-0 mx-auto ${r===0?"px-8 sm:px-12":"pt-12 px-6 pb-16"}`,children:r===0?f.jsxs("div",{className:"onb-intro relative flex min-h-dvh flex-col justify-center gap-4 py-12 min-[1120px]:grid min-[1120px]:grid-cols-[minmax(0,_1.1fr)_minmax(28rem,_1fr)] min-[1120px]:grid-rows-[auto_auto] min-[1120px]:content-center min-[1120px]:gap-x-20 min-[1120px]:gap-y-10",children:[f.jsxs("div",{className:"onb-intro-copy relative z-10 min-[1120px]:col-start-1 min-[1120px]:row-start-1 min-[1120px]:self-start",children:[f.jsx("div",{className:"onb-intro-brand mb-10 text-6xl font-semibold leading-none tracking-[-0.035em]",children:f.jsx(Lx,{})}),f.jsx("h2",{className:"onb-title mt-0 mx-0 text-4xl font-medium leading-[1.08] tracking-[-0.035em]",children:c8e()})]}),f.jsxs("div",{className:"onb-intro-features relative min-[1120px]:col-start-2 min-[1120px]:row-start-1 min-[1120px]:self-end",children:[f.jsx("div",{"aria-hidden":"true",className:"absolute -inset-14 rounded-full bg-primary-subtle opacity-70 blur-3xl"}),f.jsxs("ul",{className:"onb-intro-list relative flex flex-col gap-4 m-0 p-0 list-none",children:[f.jsx("li",{className:"rounded-2xl border border-border bg-background p-6 shadow-card",children:f.jsxs("span",{children:[f.jsx("strong",{className:"mb-1.5 block text-xl font-semibold tracking-[-0.015em]",children:gCe()}),f.jsx("span",{className:"block text-lg leading-[1.55] text-text",children:sNe()})]})}),f.jsx("li",{className:"rounded-2xl border border-border bg-background p-6 shadow-card",children:f.jsxs("span",{children:[f.jsx("strong",{className:"mb-1.5 block text-xl font-semibold tracking-[-0.015em]",children:KCe()}),f.jsx("span",{className:"block text-lg leading-[1.55] text-text",children:BEe()})]})}),f.jsx("li",{className:"rounded-2xl border border-border bg-background p-6 shadow-card",children:f.jsxs("span",{children:[f.jsx("strong",{className:"mb-1.5 block text-xl font-semibold tracking-[-0.015em]",children:OCe()}),f.jsx("span",{className:"block text-lg leading-[1.55] text-text",children:zNe()})]})})]})]}),f.jsx("div",{className:"onb-intro-actions relative z-10 mt-8 flex justify-end min-[1120px]:col-start-2 min-[1120px]:row-start-2 min-[1120px]:mt-0 min-[1120px]:self-start",children:f.jsxs(Le,{variant:"primary",size:"large",onClick:()=>s(1),children:[uN()," ",f.jsx(E1,{size:20})]})})]}):r===1?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"onb-eyebrow mb-4.5 flex items-center gap-2 text-xl font-medium text-muted",children:[f.jsx(Lx,{}),f.jsx("span",{children:HEe()})]}),f.jsx("h2",{className:"onb-title mt-0 mx-0 mb-1.5 text-3xl tracking-[-0.01em]",children:X8e()}),f.jsx("p",{className:"onb-sub text-text text-base leading-[1.55] mt-0 mx-0 mb-5.5 max-w-120",children:R9e()}),o!==null&&!L&&f.jsx("p",{className:bz,children:TEe()}),o!==null&&L&&m===null&&f.jsx("p",{className:bz,children:tCe()}),(l===null||ee)&&f.jsxs("div",{className:"onb-git-check mt-7",role:"status","aria-live":"polite",children:[f.jsx(qmt,{gitVersion:l,error:ee}),ee?f.jsx("p",{className:yz,children:fN()}):f.jsx("p",{className:yz,children:UCe()})]}),f.jsx("div",{className:"onb-cards flex flex-col gap-3.5",children:o!==null?o.map(ae=>f.jsx(Hmt,{h:ae,selected:m===ae.id,onSelect:()=>x(ae.id)},ae.id)):V?f.jsx("div",{className:lp,children:fN()}):f.jsxs(rs,{className:"py-2",children:[f.jsx(Lt,{})," ",zCe()]})}),f.jsxs("div",{className:"onb-actions flex items-center gap-2.5 mt-5.5",children:[f.jsxs(Le,{variant:"ghost",onClick:()=>s(0),children:[f.jsx(ap,{size:12})," ",cN()]}),f.jsxs(Le,{variant:"ghost",onClick:()=>G(!0,!0),disabled:S,children:[f.jsx(Ea,{size:12,className:S?"animate-[spin_0.9s_linear_infinite]":""})," ",UD()]}),f.jsx("div",{className:"flex-1"}),f.jsxs(Le,{variant:"primary",onClick:()=>s(2),disabled:S||!L||m===null||!F,title:S?yNe():L?m===null?hCe():ee?W9e():l===void 0?mNe():l===null?n9e():void 0:EEe(),children:[uN()," ",f.jsx(E1,{size:13})]})]})]}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"onb-eyebrow mb-4.5 flex items-center gap-2 text-xl font-medium text-muted",children:[f.jsx(Lx,{}),f.jsx("span",{children:WEe()})]}),f.jsx("h2",{className:"onb-title mt-0 mx-0 mb-1.5 text-3xl tracking-[-0.01em] onb-profile-title mb-5.5",children:YEe()}),f.jsx("div",{className:"onb-cards flex flex-col gap-2.5",children:f.jsxs("div",{className:rI,children:[f.jsxs("fieldset",{className:"onb-fieldset border-0 mt-0 mx-0 mb-4.5 p-0 [&_legend]:text-base [&_legend]:font-medium [&_legend]:mb-1.5",children:[f.jsx("legend",{children:kNe()}),f.jsx("p",{className:"onb-field-hint text-muted text-sm leading-[1.4] mt-0 mx-0 mb-2",children:cCe()}),f.jsx("div",{className:"onb-area-options grid grid-cols-[repeat(2,_minmax(0,_1fr))] gap-2",children:Omt.map(ae=>f.jsxs("label",{className:"onb-area-option flex items-center gap-2 border border-border rounded-md cursor-pointer py-[9px] px-2.5 [&:has(input:checked)]:border-accent [&:has(input:checked)]:bg-primary-subtle [&_input]:m-0",children:[f.jsx("input",{type:"checkbox",checked:b.includes(ae.id),onChange:()=>oe(ae.id),disabled:u}),f.jsx("span",{children:ae.label()})]},ae.id))}),b.includes("Other")&&f.jsx("input",{className:"onb-other-area w-full mt-2",value:y,onChange:ae=>C(ae.target.value),disabled:u,placeholder:eNe(),"aria-label":O9e()})]}),f.jsx("label",{className:"onb-field-label text-base font-medium mb-1.5",htmlFor:"onb-background",children:eEe()}),f.jsx("textarea",{id:"onb-background",className:"onb-textarea w-full resize-y min-h-19.5 leading-normal text-base mb-3.5",value:E,onChange:ae=>N(ae.target.value),disabled:u,rows:4,placeholder:RCe()}),f.jsx("label",{className:"onb-field-label text-base font-medium mb-1.5",htmlFor:"onb-paper-search",children:Y9e()}),f.jsx("p",{className:"onb-field-hint text-muted text-sm leading-[1.4] mt-0 mx-0 mb-2",children:h8e()}),f.jsxs("div",{className:"onb-paper-search flex flex-col gap-1.5 mt-3 [&_input]:w-full",children:[f.jsx("input",{id:"onb-paper-search",value:M,onChange:ae=>I(ae.target.value),disabled:u,placeholder:oEe()}),U?f.jsx("div",{className:lp,children:dEe()}):B.length>0?f.jsx("div",{className:"onb-paper-results flex flex-col border border-border rounded-md max-h-50 overflow-y-auto [&_button]:flex [&_button]:flex-col [&_button]:items-start [&_button]:gap-0.5 [&_button]:py-2 [&_button]:px-2.5 [&_button]:bg-none [&_button]:bg-transparent [&_button]:border-0 [&_button]:border-b [&_button]:border-b-border-variant [&_button]:text-start [&_button]:[font:inherit] [&_button]:text-text [&_button]:cursor-pointer [&_button:last-child]:border-b-0 [&_button:hover]:bg-surface [&_.title]:text-sm [&_.title]:font-medium [&_.id]:text-xs [&_.id]:text-muted",children:B.map(ae=>f.jsxs("button",{type:"button",onClick:()=>re(ae),disabled:u,children:[f.jsx(op,{children:wz(ae.title)}),f.jsx("span",{className:"id",children:ae.paperId})]},ae.paperId))}):null]}),T.length>0&&f.jsx("div",{className:"onb-paper-chips flex flex-wrap gap-1.5 mt-2.5",children:T.map(ae=>f.jsxs("span",{className:"onb-paper-chip inline-flex items-center gap-1.5 pt-1 pe-1 pb-1 ps-2.5 border border-border rounded-sm bg-surface text-sm max-w-full [&_.title]:font-medium [&_.title]:overflow-hidden [&_.title]:text-ellipsis [&_.title]:whitespace-nowrap [&_.title]:max-w-60 [&_.id]:text-xs [&_.id]:text-muted [&_button]:inline-flex [&_button]:items-center [&_button]:justify-center [&_button]:p-0.5 [&_button]:border-0 [&_button]:bg-none [&_button]:bg-transparent [&_button]:text-muted [&_button]:cursor-pointer [&_button]:rounded-xs [&_button:hover]:text-text [&_button:hover]:bg-panel",children:[f.jsx(op,{children:ae.title||ae.paperId}),f.jsx("span",{className:"id",children:ae.paperId}),f.jsx("button",{type:"button","aria-label":eY({name:Ne(ae.paperId)}),onClick:()=>ce(ae.paperId),disabled:u,children:f.jsx(qr,{size:12})})]},ae.paperId))})]})}),!te&&f.jsx("p",{className:"onb-profile-hint text-accent-red text-sm mt-2 mx-0 mb-0",children:b.length===0?iCe():kCe()}),f.jsxs("div",{className:"onb-actions flex items-center gap-2.5 mt-5.5",children:[f.jsxs(Le,{variant:"ghost",onClick:()=>s(1),disabled:u,children:[f.jsx(ap,{size:12})," ",cN()]}),f.jsx("div",{className:"flex-1"}),f.jsx(Le,{variant:"primary",onClick:()=>void Q(),disabled:u||m===null||!te,children:u?f.jsxs(f.Fragment,{children:[f.jsx(Lt,{})," ",wEe()]}):f.jsxs(f.Fragment,{children:[PCe()," ",f.jsx(E1,{size:13})]})})]}),m===null&&f.jsx("p",{className:xz,children:RNe()}),d&&f.jsx("p",{className:xz,children:d})]})})})}function wz(e){return e.replace(/^\[[^\]]*\]\s*/,"").replace(/\s*[-–|]\s*arXiv\s*$/i,"")}function $mt(e){return e.agentReady?{tone:"success",label:e.authMethod==="local"?s6():DEe()}:e.installed?e.installBroken?{tone:"warning",label:ZCe()}:e.authMethod==="local"?{tone:"warning",label:GD()}:e.authState==="unknown"?{tone:"warning",label:lNe()}:e.authState==="unsupported"?{tone:"warning",label:fNe()}:e.installed?{tone:"warning",label:z9e()}:{tone:"neutral",label:dN()}:{tone:"neutral",label:dN()}}function Pmt(e,n){var t;return{harness:e.id,model:n,permissionMode:((t=e.options)==null?void 0:t.defaultPermissionMode)??null,reasoningLevel:eb(e,n).defaultId}}function Fmt({harness:e}){return f.jsx(J4,{harness:e,size:26})}function Hmt({h:e,selected:n,onSelect:t}){var u;const r=$mt(e),s=n?{tone:"success",label:pEe()}:r,i=(u=e.version)==null?void 0:u.replace(/\s*\(.*\)$/,""),a=[e.id==="opencode"&&e.account!=="opencode"&&e.account,e.id==="opencode"&&e.plan,i,e.models.length>0&&iL({count:Wt(e.models.length),models:new Intl.ListFormat(j()).format(e.models.map(_=>Ne(O0(_))))})].filter(Boolean).join(" · "),o=f.jsxs("div",{className:"onb-card-head flex items-center justify-between gap-3",children:[f.jsxs("span",{className:"onb-card-identity flex items-center gap-3 min-w-0",children:[f.jsx(Fmt,{harness:e.id}),f.jsx("span",{className:"onb-card-name text-lg font-semibold tracking-[-0.01em]",children:e.name})]}),f.jsx(rb,{tone:s.tone,children:s.label})]}),l=e.id==="opencode"&&f.jsxs("div",{className:"space-y-1 text-sm text-text",children:[f.jsx("div",{className:"font-medium",children:v9e()}),f.jsxs("div",{children:[_9e()," ",f.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap align-baseline",children:[f.jsx("img",{src:eI,alt:"",width:14,height:14,className:"size-3.5 shrink-0 object-contain"}),"LM Studio"]}),", ",f.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap align-baseline",children:[f.jsx("img",{src:tI,alt:"",width:14,height:14,className:"size-3.5 shrink-0 object-contain dark:invert"}),"Ollama"]}),u9e(),f.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap align-baseline",children:[f.jsx("img",{src:nI,alt:"",width:14,height:14,className:"size-3.5 shrink-0 object-contain"}),"oMLX"]}),"."]})]});return e.agentReady?f.jsxs("button",{type:"button",className:`onb-card flex flex-col gap-2.5 bg-background border border-border rounded-lg py-5.5 px-6 onb-agent-choice w-full text-inherit [font:inherit] text-start transition-[border-color,box-shadow] duration-120 ease-standard [button&]:cursor-pointer [button&:hover]:border-muted [&.selected]:border-accent [&.selected]:shadow-selected${n?" selected":""}`,"aria-pressed":n,onClick:t,children:[o,e.id!=="opencode"&&f.jsxs("div",{className:"onb-card-detail text-sm",children:[e.account??r6(),e.plan?` · ${e.plan}`:""]}),f.jsx("div",{className:`${lp} w-full overflow-hidden text-ellipsis whitespace-nowrap`,title:a,children:a}),l]}):f.jsxs("div",{className:"onb-card flex flex-col gap-2.5 bg-background border border-border rounded-lg py-5.5 px-6 onb-agent-choice w-full text-inherit [font:inherit] text-start transition-[border-color,box-shadow] duration-120 ease-standard [button&]:cursor-pointer [button&:hover]:border-muted [&.selected]:border-accent [&.selected]:shadow-selected",children:[o,f.jsx("div",{className:lp,children:tm(e.agentNote)}),l]})}function qmt({gitVersion:e,error:n}){return f.jsxs("div",{className:rI,children:[f.jsxs("div",{className:"onb-card-head flex items-center justify-between gap-3",children:[f.jsx("span",{className:"onb-card-name font-semibold text-base",children:a9e()}),f.jsx(rb,{tone:e?"success":n||e===null?"danger":"warning",children:e?s6():n?$8e():e===null?qD():q8e()})]}),(e||!n&&e===void 0)&&f.jsx("div",{className:lp,children:e??V8e()})]})}const Umt="/assets/slurm-logo-aGSXVZcE.svg",Gmt="/assets/thinking-machines-BOdslTfm.png";function Wmt(e){switch(e){case"modal_job":return"Modal";case"hf_job":return"Hugging Face";case"k8s_job":return"Kubernetes";case"ssh_job":return"SSH";case"slurm_job":return"Slurm";case"ray_job":return"Ray";case"openresearch_job":return"OpenResearch";case"local_job":return TD();case"tinker_job":return"Tinker";default:return e||"—"}}function Vmt({size:e=16}){return f.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",children:[f.jsx("path",{d:"M2.25 11.535c0-3.407 1.847-6.554 4.844-8.258a9.822 9.822 0 019.687 0c2.997 1.704 4.844 4.851 4.844 8.258 0 5.266-4.337 9.535-9.687 9.535S2.25 16.8 2.25 11.535z",fill:"#FF9D0B"}),f.jsx("path",{d:"M11.938 20.086c4.797 0 8.687-3.829 8.687-8.551 0-4.722-3.89-8.55-8.687-8.55-4.798 0-8.688 3.828-8.688 8.55 0 4.722 3.89 8.55 8.688 8.55z",fill:"#FFD21E"}),f.jsx("path",{d:"M11.875 15.113c2.457 0 3.25-2.156 3.25-3.263 0-0.576-.393-.394-1.023-.089-0.582.283-1.365.675-2.224.675-1.798 0-3.25-1.693-3.25-0.586 0 1.107.79 3.263 3.25 3.263h-.003z",fill:"#FF323D"}),f.jsx("path",{d:"M14.76 9.21c.32.108.445.753.767.585.447-.233.707-.708.659-1.204a1.235 1.235 0 00-.879-1.059 1.262 1.262 0 00-1.33.394c-.322.384-.377.92-.14 1.36.153.283.638-.177.925-.079l-.002.003zm-5.887 0c-.32.108-.448.753-.768.585a1.226 1.226 0 01-.658-1.204c.048-.495.395-.913.878-1.059a1.262 1.262 0 011.33.394c.322.384.377.92.14 1.36-.152.283-.64-.177-.925-.079l.003.003z",fill:"#3A3B45"}),f.jsx("path",{d:"M17.812 10.366a.806.806 0 00.813-.8c0-.441-.364-.8-.813-.8a.806.806 0 00-.812.8c0 .442.364.8.812.8zm-11.624 0a.806.806 0 00.812-.8c0-.441-.364-.8-.812-.8a.806.806 0 00-.813.8c0 .442.364.8.813.8z",fill:"#3A3B45"}),f.jsx("path",{d:"M4.515 13.073c-.405 0-.765.162-1.017.46a1.455 1.455 0 00-.333.925 1.801 1.801 0 00-.485-.074c-.387 0-.737.146-.985.409a1.41 1.41 0 00-.2 1.722 1.302 1.302 0 00-.447.694c-.06.222-.12.69.2 1.166a1.267 1.267 0 00-.093 1.236c.238.533.81.958 1.89 1.405l.24.096c.768.3 1.473.492 1.478.494.89.243 1.808.375 2.732.394 1.465 0 2.513-.443 3.115-1.314.93-1.342.842-2.575-.274-3.763l-.151-.154c-.692-.684-1.155-1.69-1.25-1.912-.195-.655-.71-1.383-1.562-1.383-.46.007-.889.233-1.15.605-.25-.31-.495-0.553-.715-.694a1.87 1.87 0 00-.993-.312zm14.97 0c.405 0 .767.162 1.017.46.216.262.333.588.333.925.158-.047.322-.071.487-.074.388 0 .738.146.985.409a1.41 1.41 0 01.2 1.722c.22.178.377.422.445.694.06.222.12.69-.2 1.166.244.37.279.836.093 1.236-.238.533-.81.958-1.889 1.405l-.239.096c-.77.3-1.475.492-1.48.494-.89.243-1.808.375-2.732.394-1.465 0-2.513-.443-3.115-1.314-.93-1.342-.842-2.575.274-3.763l.151-.154c.695-.684 1.157-1.69 1.252-1.912.195-.655.708-1.383 1.56-1.383.46.007.889.233 1.15.605.25-.31.495-0.553.718-.694.244-.162.523-.265.814-.3l.176-.012z",fill:"#FF9D0B"}),f.jsx("path",{d:"M9.785 20.132c.688-.994.638-1.74-.305-2.667-.945-.928-1.495-2.288-1.495-2.288s-.205-.788-.672-.714c-.468.074-.81 1.25.17 1.971.977.721-.195 1.21-0.573.534-.375-.677-1.405-2.416-1.94-2.751-0.532-.332-.907-.148-.782.541.125.687 2.357 2.35 2.14 2.707-.218.362-.983-.42-.983-.42S2.953 14.9 2.43 15.46c-0.52.558.398 1.026 1.7 1.803 1.308.778 1.41.985 1.225 1.28-.187.295-3.07-2.1-3.34-1.083-.27 1.011 2.943 1.304 2.745 2.006-.2.7-2.265-1.324-2.685-0.537-.425.79 2.913 1.718 2.94 1.725 1.075.276 3.813.859 4.77-0.522zm4.432 0c-.687-.994-.64-1.74.305-2.667.943-.928 1.493-2.288 1.493-2.288s.205-.788.675-.714c.465.074.807 1.25-.17 1.971-.98.721.195 1.21.57.534.377-.677 1.407-2.416 1.94-2.751.532-.332.91-.148.782.541-.125.687-2.355 2.35-2.137 2.707.215.362.98-.42.98-.42S21.05 14.9 21.57 15.46c.52.558-.395 1.026-1.7 1.803-1.308.778-1.408.985-1.225 1.28.187.295 3.07-2.1 3.34-1.083.27 1.011-2.94 1.304-2.743 2.006.2.7 2.263-1.324 2.685-0.537.423.79-2.912 1.718-2.94 1.725-1.077.276-3.815.859-4.77-0.522z",fill:"#FFD21E"})]})}function Kmt({size:e=16}){return f.jsxs("svg",{width:e,height:e,viewBox:"0 0 300 300",fill:"none","aria-hidden":"true",children:[f.jsx("path",{d:"M121.683 75.25L149.997 124L91.4816 224.75C90.3128 226.757 88.155 228 85.8174 228H32.9664C31.7976 228 30.6778 227.691 29.697 227.131C28.7161 226.57 27.8906 225.758 27.3021 224.75L0.876625 179.25C-0.292208 177.243 -0.292208 174.765 0.876625 172.75L57.512 75.25C58.0923 74.2425 58.9259 73.43 59.9068 72.8694C60.8876 72.3088 62.0074 72 63.1762 72H116.027C118.365 72 120.523 73.2431 121.692 75.25H121.683ZM299.125 172.75L242.49 75.25C241.91 74.2425 241.076 73.43 240.095 72.8694C239.114 72.3088 237.995 72 236.826 72H183.975C181.637 72 179.479 73.2431 178.311 75.25L149.997 124L208.512 224.75C209.681 226.757 211.839 228 214.177 228H267.027C268.196 228 269.316 227.691 270.297 227.131C271.278 226.57 272.103 225.758 272.692 224.75L299.117 179.25C300.286 177.243 300.286 174.765 299.117 172.75H299.125Z",fill:"#62DE61"}),f.jsx("path",{d:"M89.6018 124H150.005L121.692 75.25C120.523 73.2431 118.365 72 116.027 72H63.1763C62.0074 72 60.8876 72.3088 59.9068 72.8694L89.6018 124Z",fill:"url(#orxModalA)"}),f.jsx("path",{d:"M89.6018 124L59.9068 72.8694C58.9259 73.43 58.1005 74.2425 57.512 75.25L0.876625 172.75C-0.292208 174.765 -0.292208 177.235 0.876625 179.25L27.3021 224.75C27.8825 225.758 28.7161 226.57 29.697 227.131L89.5936 124H89.6018Z",fill:"url(#orxModalB)"}),f.jsx("path",{d:"M149.997 124H89.5936L29.697 227.131C30.6778 227.691 31.7976 228 32.9664 228H85.8174C88.155 228 90.3128 226.757 91.4816 224.75L149.997 124Z",fill:"#09AF58"}),f.jsx("path",{d:"M299.125 179.25C299.706 178.243 300 177.121 300 176H240.61L210.915 227.131C211.896 227.691 213.016 228 214.185 228H267.036C269.373 228 271.531 226.757 272.7 224.75L299.125 179.25Z",fill:"#09AF58"}),f.jsx("path",{d:"M183.975 72C182.806 72 181.686 72.3088 180.705 72.8694L240.602 176H299.992C299.992 174.879 299.698 173.758 299.117 172.75L242.49 75.25C241.321 73.2431 239.163 72 236.826 72H183.967H183.975Z",fill:"url(#orxModalC)"}),f.jsx("path",{d:"M210.907 227.131L240.602 176L180.705 72.8694C179.725 73.43 178.899 74.2425 178.311 75.25L149.997 124L208.512 224.75C209.093 225.758 209.926 226.57 210.907 227.131Z",fill:"url(#orxModalD)"}),f.jsxs("defs",{children:[f.jsxs("linearGradient",{id:"orxModalA",x1:"127.348",y1:"137",x2:"82.9561",y2:"59.6398",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{stopColor:"#BFF9B4"}),f.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),f.jsxs("linearGradient",{id:"orxModalB",x1:"7.04774",y1:"214.131",x2:"81.1284",y2:"85.0556",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{stopColor:"#80EE64"}),f.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),f.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),f.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),f.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),f.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),f.jsx("stop",{offset:"1",stopColor:"#09AF58"})]}),f.jsxs("linearGradient",{id:"orxModalC",x1:"278.103",y1:"188.561",x2:"204.022",y2:"59.4863",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{stopColor:"#BFF9B4"}),f.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),f.jsxs("linearGradient",{id:"orxModalD",x1:"232.804",y1:"214.569",x2:"158.724",y2:"85.4864",gradientUnits:"userSpaceOnUse",children:[f.jsx("stop",{stopColor:"#80EE64"}),f.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),f.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),f.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),f.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),f.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),f.jsx("stop",{offset:"1",stopColor:"#09AF58"})]})]})]})}function Qmt({size:e=16}){return f.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#326CE5","aria-hidden":"true",children:f.jsx("path",{d:"M10.204 14.35l.007.01-.999 2.413a5.171 5.171 0 0 1-2.075-2.597l2.578-.437.004.005a.44.44 0 0 1 .484.606zm-.833-2.129a.44.44 0 0 0 .173-.756l.002-.011L7.585 9.7a5.143 5.143 0 0 0-.73 3.255l2.514-.725.002-.009zm1.145-1.98a.44.44 0 0 0 .699-.337l.01-.005.15-2.62a5.144 5.144 0 0 0-3.01 1.442l2.147 1.523.004-.002zm.76 2.75l.723.349.722-.347.18-.78-0.5-.623h-.804l-0.5.623.179.779zm1.5-3.095a.44.44 0 0 0 .7.336l.008.003 2.134-1.513a5.188 5.188 0 0 0-2.992-1.442l.148 2.615.002.001zm10.876 5.97l-5.773 7.181a1.6 1.6 0 0 1-1.248.594l-9.261.003a1.6 1.6 0 0 1-1.247-0.596l-5.776-7.18a1.583 1.583 0 0 1-.307-1.34L2.1 5.573c.108-.47.425-.864.863-1.073L11.305.513a1.606 1.606 0 0 1 1.385 0l8.345 3.985c.438.209.755.604.863 1.073l2.062 8.955c.108.47-.005.963-.308 1.34zm-3.289-2.057c-.042-.01-.103-.026-.145-.034-.174-.033-.315-.025-.479-.038-.35-.037-.638-.067-.895-.148-.105-.04-.18-.165-.216-.216l-.201-.059a6.45 6.45 0 0 0-.105-2.332 6.465 6.465 0 0 0-.936-2.163c.052-.047.15-.133.177-.159.008-.09.001-.183.094-.282.197-.185.444-.338.743-0.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-0.52.123-.736-.172-.216-0.506-.236-.745-.045-.034.027-.08.062-.111.088-.134.116-.217.23-.33.35-.246.25-.45.458-.673.609-.097.056-.239.037-.303.033l-.19.135a6.545 6.545 0 0 0-4.146-2.003l-.012-.223c-.065-.062-.143-.115-.163-.25-.022-.268.015-0.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-0.555-0.5-0.555-.275 0-.499.249-.499.555l.001.014c0 .041-.002.092 0 .128.006.177.044.312.067.475.042.348.078.637.056.906a.545.545 0 0 1-.162.258l-.012.211a6.424 6.424 0 0 0-4.166 2.003 8.373 8.373 0 0 1-.18-.128c-.09.012-.18.04-.297-.029-.223-.15-.427-.358-.673-.608-.113-.12-.195-.234-.329-.349-.03-.026-.077-.062-.111-.088a.594.594 0 0 0-.348-.132.481.481 0 0 0-.398.176c-.172.216-.117.546.123.737l.007.005.104.083c.142.105.272.159.414.242.299.185.546.338.743.522.076.082.09.226.1.288l.16.143a6.462 6.462 0 0 0-1.02 4.506l-.208.06c-.055.072-.133.184-.215.217-.257.081-0.546.11-.895.147-.164.014-.305.006-.48.039-.037.007-.09.02-.133.03l-.004.002-.007.002c-.295.071-.484.342-.423.608.061.267.349.429.645.365l.007-.001.01-.003.129-.029c.17-.046.294-.113.448-.172.33-.118.604-.217.87-.256.112-.009.23.069.288.101l.217-.037a6.5 6.5 0 0 0 2.88 3.596l-.09.218c.033.084.069.199.044.282-.097.252-.263.517-.452.813-.091.136-.185.242-.268.399-.02.037-.045.095-.064.134-.128.275-.034.591.213.71.248.12.556-.007.69-.282v-.002c.02-.039.046-.09.062-.127.07-.162.094-.301.144-.458.132-.332.205-.68.387-.897.05-.06.13-.082.215-.105l.113-.205a6.453 6.453 0 0 0 4.609.012l.106.192c.086.028.18.042.256.155.136.232.229.507.342.84.05.156.074.295.145.457.016.037.043.09.062.129.133.276.442.402.69.282.247-.118.341-.435.213-.71-.02-.039-.045-.096-.065-.134-.083-.156-.177-.261-.268-.398-.19-.296-.346-0.541-.443-.793-.04-.13.007-.21.038-.294-.018-.022-.059-.144-.083-.202a6.499 6.499 0 0 0 2.88-3.622c.064.01.176.03.213.038.075-.05.144-.114.28-.104.266.039.54.138.87.256.154.06.277.128.448.173.036.01.088.019.13.028l.009.003.007.001c.297.064.584-.098.645-.365.06-.266-.128-0.537-.423-.608zM16.4 9.701l-1.95 1.746v.005a.44.44 0 0 0 .173.757l.003.01 2.526.728a5.199 5.199 0 0 0-.108-1.674A5.208 5.208 0 0 0 16.4 9.7zm-4.013 5.325a.437.437 0 0 0-.404-.232.44.44 0 0 0-.372.233h-.002l-1.268 2.292a5.164 5.164 0 0 0 3.326.003l-1.27-2.296h-.01zm1.888-1.293a.44.44 0 0 0-.27.036.44.44 0 0 0-.214.572l-.003.004 1.01 2.438a5.15 5.15 0 0 0 2.081-2.615l-2.6-.44-.004.005z"})})}function Ymt({size:e=16}){return f.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#028CF0","aria-hidden":"true",children:f.jsx("path",{d:"M16.153 12.826c-.63-.183-1.03.15-1.378.846-0.58 1.13-1.643 1.644-2.888 1.594-1.245-.05-2.257-.63-2.788-1.776-.233-.498-.498-.664-1.046-.68-.93-.017-1.643.016-2.174 1.062-.631 1.261-2.258 1.693-3.619 1.261a3.234 3.234 0 0 1-2.257-3.22 3.198 3.198 0 0 1 2.29-3.02 3.276 3.276 0 0 1 3.702 1.327c.216.315.216.863.597.93.648.1 1.328.033 1.992.033.299 0 .316-.266.399-.465.58-1.295 1.61-1.959 2.987-1.975 1.361-.017 2.39.647 2.955 1.892.215.465.48.598.946.548.166-.017.332.016.498 0 .464-.083 1.062.282 1.344-.448.282-.73-.382-.913-.68-1.245-.847-.946-1.81-1.793-2.673-2.706-.415-.465-.763-.614-1.41-.415-1.876.614-3.619-.431-4.15-2.357-.448-1.676.714-3.535 2.44-3.917a3.293 3.293 0 0 1 3.95 2.457c.017.05.017.083.033.133.117.564.117 1.145-.132 1.626-.283.531-.133.83.249 1.195a152.61 152.61 0 0 1 3.286 3.27c.299.299.498.349.913.2 1.51-0.565 2.97-.1 3.884 1.161a3.266 3.266 0 0 1-.067 3.801c-.896 1.195-2.357 1.643-3.834 1.079-.381-.15-0.58-.1-.846.182a163.619 163.619 0 0 1-3.403 3.386c-.299.3-.415.532-.232.98a3.198 3.198 0 0 1-1.278 3.917A3.298 3.298 0 0 1 9.646 23c-1.062-1.062-1.228-2.688-.415-4.033a3.196 3.196 0 0 1 3.835-1.294c.498.182.78.083 1.145-.283 1.012-1.045 2.058-2.058 3.087-3.103.266-.266.68-.449.432-1.03-.233-0.547-.631-.414-1.03-.431zM11.97 4.942c.913.016 1.643-.714 1.66-1.627v-.05a1.646 1.646 0 0 0-1.76-1.56 1.63 1.63 0 0 0-1.543 1.527 1.638 1.638 0 0 0 1.577 1.71zm.033 5.41a1.658 1.658 0 0 0-1.676 1.61v.084a1.73 1.73 0 0 0 1.643 1.66c.847.016 1.643-.78 1.677-1.627a1.648 1.648 0 0 0-1.577-1.71c-.017-.016-.05-.016-.067-.016zm7.088 1.694c.016.896.747 1.61 1.626 1.643a1.723 1.723 0 0 0 1.66-1.726 1.666 1.666 0 0 0-1.66-1.61 1.623 1.623 0 0 0-1.643 1.577c.017.05.017.083.017.116zM3.24 10.353a1.692 1.692 0 0 0-1.66 1.626c-.017.847.863 1.727 1.693 1.71a1.687 1.687 0 0 0 1.626-1.743 1.615 1.615 0 0 0-1.643-1.593Zm8.68 12c.98.033 1.71-.647 1.727-1.593a1.646 1.646 0 0 0-1.51-1.793 1.646 1.646 0 0 0-1.793 1.51v.233a1.609 1.609 0 0 0 1.543 1.66c0-.017.017-.017.033-.017z"})})}function Xmt({size:e=16}){return f.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100","aria-hidden":"true",children:[f.jsx("rect",{width:"100",height:"100",rx:"8",fill:"#9a2036"}),f.jsx("path",{d:"M15.375 16.782v63.843a4 4 0 0 0 4 4h63.843c3.564 0 5.348-4.309 2.829-6.828L22.203 13.953c-2.52-2.52-6.828-.735-6.828 2.829",fill:"#fff"})]})}function Zmt({size:e=16}){return f.jsx("img",{className:"tinker-logo block flex-none object-contain",src:Gmt,width:e,height:e,style:{transform:e>=48?`translateX(${Math.round(e*.18)}px) scale(1.65)`:"scale(1.22)"},alt:"","aria-hidden":"true"})}function Jmt({size:e=16}){return f.jsx("img",{className:"block flex-none object-contain",src:Umt,width:e,height:e,alt:"","aria-hidden":"true"})}function fb({size:e=16}){return f.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:f.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-0.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-0.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"})})}function a_({kind:e,size:n=16}){switch(e){case"modal_job":return f.jsx(Kmt,{size:n});case"hf_job":return f.jsx(Vmt,{size:n});case"k8s_job":return f.jsx(Qmt,{size:n});case"ssh_job":return f.jsx(vz,{size:n,strokeWidth:1.5});case"slurm_job":return f.jsx(Jmt,{size:n});case"ray_job":return f.jsx(Ymt,{size:n});case"openresearch_job":return f.jsx(Xmt,{size:n});case"tinker_job":return f.jsx(Zmt,{size:n});case"local_job":return f.jsx(Fpt,{size:n,strokeWidth:1.5});default:return f.jsx(vz,{size:n})}}function $6({backend:e}){const n=p6(e),t=yft(e);return n?f.jsxs("span",{className:"backend-badge inline-flex items-center gap-[7px] [&_svg]:flex-none [&_svg]:block [&_.backend-name]:font-medium [&_.backend-detail]:text-muted [&.muted]:text-muted",children:[f.jsx(a_,{kind:n}),f.jsx("span",{className:"backend-name",children:Wmt(n)}),t&&f.jsx("span",{className:"backend-detail text-sm",children:t})]}):f.jsx("span",{className:"backend-badge inline-flex items-center gap-[7px] [&_svg]:flex-none [&_svg]:block [&_.backend-name]:font-medium [&_.backend-detail]:text-muted [&.muted]:text-muted muted text-muted",children:"—"})}function Ox(e,n){const[t,r]=R.useState(e);return R.useEffect(()=>{const s=setTimeout(()=>r(e),n);return()=>clearTimeout(s)},[e,n]),t}function Bg(e,n){const t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return(n?t.slice(0,n):t)||"research-project"}function egt(e){const t=(e.trim().split(/[?#]/)[0].split("/").filter(Boolean).pop()??"").replace(/\.(pdf|md)$/i,"");return/^\d{4}\.\d{4,5}(v\d+)?$/.test(t)?t:null}function tgt(e){const n=e==null?void 0:e.trim().match(/github\.com[/:]([^/]+)\/([^/?#]+)/i);return n?{owner:n[1],repo:n[2].replace(/\.git$/,"")}:null}function ngt(e){return e.trim().replace(/^https?:\/\//i,"").replace(/^git@([^:]+):/i,"$1/").replace(/\.git$/i,"").replace(/\/$/,"")}function rgt({onCreated:e,onCancel:n,remote:t=!1}){var Kn,fn,Nn,Vt;const[r,s]=R.useState("blank"),[i,a]=R.useState(""),[o,l]=R.useState(!1),[u,_]=R.useState(""),[d,p]=R.useState(!1),[m,x]=R.useState(!1),[S,v]=R.useState(!1),[b,w]=R.useState(null),[y,C]=R.useState(!1),[E,N]=R.useState(!1),[T,z]=R.useState(""),[M,I]=R.useState(null),[B,$]=R.useState(!1),U=R.useRef(0),H=R.useRef(0),Y=R.useRef({blank:{name:"",nameTouched:!1,path:"",pathTouched:!1},folder:{name:"",nameTouched:!1,path:"",pathTouched:!1},paper:{name:"",nameTouched:!1,path:"",pathTouched:!1}}),V=r==="paper"?tgt(M==null?void 0:M.repoUrl):null,X=i.trim()?`~/OpenResearch/${Bg(i,48)}`:"",ee=`~/OpenResearch/${Bg(i||(M==null?void 0:M.title)||(M==null?void 0:M.paperId)||"")}`,O=r==="blank"&&!d?X:r==="paper"&&M&&!d?ee:u,L=Ox(O.trim(),200),F=ot({...I0(L),enabled:!!L&&L===O.trim()}),q=L===O.trim()?F.data??null:null,G=L===O.trim()?((Kn=F.error)==null?void 0:Kn.message)??null:null,re=!!O.trim()&&(L!==O.trim()||F.isFetching),ce=V??(r==="folder"&&(q!=null&&q.githubOwner)&&q.githubRepo?{owner:q.githubOwner,repo:q.githubRepo}:null),oe=ot(lht()),te=((fn=oe.data)==null?void 0:fn.login)??(oe.isPending?void 0:null),Q=ot(m6()),le=R.useRef(!1);R.useEffect(()=>{le.current||!Q.data||(le.current=!0,N(Q.data.githubForNewProjects))},[Q.data]);const ae=Ox(i.trim(),150),de=ot({...cht(ae),enabled:ae===i.trim()}),pe=ae===i.trim()?((Nn=de.data)==null?void 0:Nn.repo)??Bg(i,48):Bg(i,48),we=ae!==i.trim()||de.isFetching,be=ot({...QN((ce==null?void 0:ce.owner)??"",(ce==null?void 0:ce.repo)??""),enabled:!!ce,subscribed:!!ce}),Pe=!!ce&&be.isFetching,Be=ce&&((Vt=be.data)!=null&&Vt.canPush)?`github.com/${ce.owner}/${ce.repo}`:null,ze=Ox(T.trim(),350),it=egt(ze),bt=r==="paper"&&!M&&ze===T.trim(),It=ot({...ZL(ze),enabled:bt&&!it&&ze.length>=3,subscribed:bt&&!it&&ze.length>=3}),$t=ot({...q4(it??""),enabled:bt&&!!it,subscribed:bt&&!!it}),jt=bt&&!it?It.data??[]:[],ct=bt&&It.isSuccess?ze:"",ut=B||r==="paper"&&!M&&(ze!==T.trim()||(it?$t.isFetching:It.isFetching));R.useEffect(()=>{var xt;!bt||!it||!$t.data||(I($t.data),o||a(((xt=$t.data.title)==null?void 0:xt.trim())||$t.data.paperId))},[bt,it,$t.data,o]),R.useEffect(()=>{const xt=it?$t.error:It.error;bt&&xt&&w(xt.message)},[bt,it,$t.error,It.error]);const Ht=mn({mutationFn:fut});async function Se(xt){var Fe;const At=++U.current;$(!0),w(null);try{const _t=await tt.fetchQuery(q4(xt));if(At!==U.current)return;I(_t),o||a(((Fe=_t.title)==null?void 0:Fe.trim())||_t.paperId)}catch(_t){At===U.current&&w(_t instanceof Error?_t.message:String(_t))}finally{At===U.current&&$(!1)}}function Ae(){U.current+=1,H.current+=1,I(null),z(""),$(!1),x(!1),_(""),p(!1),Y.current.paper={name:o?i:"",nameTouched:o,path:"",pathTouched:!1},o||a("")}function Ze(xt){if(xt===r)return;U.current+=1,H.current+=1,Y.current[r]={name:i,nameTouched:o,path:u,pathTouched:d};const At=Y.current[xt];s(xt),w(null),$(!1),x(!1),a(At.name),l(At.nameTouched),_(At.path),p(At.pathTouched)}async function ht(){if(m)return;const xt=++H.current;x(!0),w(null);try{const At=await dut();if(xt!==H.current||!At)return;if(p(!0),_(At),tt.invalidateQueries(I0(At)),r==="folder"&&!o){const Fe=At.replace(/[\\/]+$/,"").split(/[\\/]/).pop();Fe&&a(Fe)}}catch(At){xt===H.current&&w(At instanceof Error?At.message:String(At))}finally{xt===H.current&&x(!1)}}async function wt(xt){if(xt.preventDefault(),!!gt){v(!0),w(null);try{const At=await tt.fetchQuery({...I0(O.trim()),staleTime:0});if(At.exists&&At.directory===!1)throw new Error(wx());if(r==="blank"&&At.exists)throw new Error(rN());if(r==="paper"&&At.empty===!1)throw new Error(lN());E&&ce&&await tt.fetchQuery({...QN(ce.owner,ce.repo),staleTime:0}).catch(()=>null);const Fe=await Ht.mutateAsync({name:i.trim(),path:O.trim(),createFolder:r!=="folder",requireNewFolder:r==="blank",initializeGit:!0,githubSyncEnabled:E,locale:j(),...r==="paper"&&M?{paperId:M.paperId,cloneUrl:M.repoUrl??void 0}:{}});e(Fe.project,Fe.githubPublicationError)}catch(At){w(At instanceof Error?At.message:String(At))}finally{v(!1)}}}const en=i.trim(),Ve=r==="paper"&&M&&!M.repoUrl?M.paperId:null,qt=r==="folder"&&(q==null?void 0:q.gitState)==="ready"?q.resolvedPath??null:null,ln=en!==""&&(r==="blank"||Ve!==null||qt!==null);R.useEffect(()=>{if(!ln)return;const xt=window.setTimeout(()=>{vut({name:en,paperId:Ve??void 0,path:qt??void 0,locale:j()}).catch(()=>{})},1200);return()=>window.clearTimeout(xt)},[ln,en,Ve,qt]);const cn=(q==null?void 0:q.gitVersion)===null,Mt=r==="folder"&&!!O.trim()&&q!==null&&q.exists===!1,er=r==="blank"&&(q==null?void 0:q.exists)===!0,tn=!!O.trim()&&(q==null?void 0:q.exists)===!0&&q.directory===!1,Mr=r==="paper"&&!!(M!=null&&M.repoUrl)&&(q==null?void 0:q.empty)===!1,tr=r==="paper"&&!!M&&!(M!=null&&M.repoUrl)&&(q==null?void 0:q.empty)===!1,qn=r==="folder"&&((q==null?void 0:q.gitState)==="detached"||(q==null?void 0:q.gitState)==="invalid"),Sr=d&&!O.trim()||tn||Mr||tr,$n=d&&!O.trim()||tn||er,Wr=d&&!O.trim()?oN():tn?wx():er?rN():null,kr=d&&!O.trim()?oN():tn?wx():Mr?lN():tr?_Se():null,gt=!!(i.trim()&&O.trim())&&!S&&!m&&!re&&q!==null&&!G&&!cn&&!Mt&&!er&&!tn&&!Mr&&!tr&&!qn&&(r!=="paper"||!!M)&&(!E||typeof te=="string"&&!we&&!Pe),un=Be??`github.com/${te??"you"}/${pe}`,vn=te===void 0||we||Pe,Zt=r==="paper"&&!M&&T.trim().length>=3&&ct===T.trim()&&!ut&&jt.length===0&&!b;return f.jsxs("form",{className:"form [&_.form-seg]:self-start [&_.form-seg]:mb-0.5 [&_.form-seg_button]:py-[5px] [&_.form-seg_button]:px-3 [&_.repo-hint]:font-normal [&_.repo-hint]:text-sm [&_.repo-hint]:text-muted [&_.repo-hint.ok]:text-accent-teal [&_.folder-picker-control]:flex [&_.folder-picker-control]:items-center [&_.folder-picker-control]:gap-[9px] [&_.folder-picker-control]:w-full [&_.folder-picker-control]:min-w-0 [&_.folder-picker-control]:py-2 [&_.folder-picker-control]:px-2.5 [&_.folder-picker-control]:overflow-hidden [&_.folder-picker-control]:bg-background [&_.folder-picker-control]:border [&_.folder-picker-control]:border-border [&_.folder-picker-control]:rounded-md [&_.folder-picker-control]:cursor-pointer [&_.folder-picker-control]:text-start [&_.folder-picker-control]:transition-[border-color,box-shadow] [&_.folder-picker-control]:duration-120 [&_.folder-picker-control]:ease-standard [&_.folder-picker-control:hover:not(:disabled)]:border-muted [&_.folder-picker-control:hover:not(:disabled)]:shadow-control-subtle [&_.folder-picker-control:focus-visible]:outline-2 [&_.folder-picker-control:focus-visible]:outline-solid [&_.folder-picker-control:focus-visible]:outline-text [&_.folder-picker-control:focus-visible]:outline-offset-2 [&_.folder-picker-control_span]:flex-1 [&_.folder-picker-control_span]:min-w-0 [&_.folder-picker-control_span]:overflow-hidden [&_.folder-picker-control_span]:text-ellipsis [&_.folder-picker-control_span]:whitespace-nowrap [&_.folder-picker-control_.placeholder]:text-muted [&_.folder-picker-icon]:flex-none [&_.folder-picker-icon]:text-current [&_.folder-picker-chevron]:flex-none [&_.folder-picker-chevron]:text-muted [&_.folder-picker-control:hover:not(:disabled)_.folder-picker-chevron]:text-subtext [&_.folder-picker-hint]:text-subtext [&_.folder-picker-hint]:text-sm [&_.folder-picker-hint]:font-normal [&_.folder-picker-hint]:leading-[1.4] [&_.project-location-field]:flex [&_.project-location-field]:flex-col [&_.project-location-field]:gap-2 [&_.project-location-label]:text-text [&_.project-location-label]:text-base [&_.project-location-label]:font-medium [&_.project-field-label]:text-text [&_.project-field-label]:text-base [&_.project-field-label]:font-medium [&_.folder-picker-control:disabled]:cursor-default [&_.folder-picker-control:disabled]:opacity-65 [&_.paper-destination]:flex [&_.paper-destination]:items-center [&_.paper-destination]:gap-2.5 [&_.paper-destination]:pt-2 [&_.paper-destination]:pe-2 [&_.paper-destination]:pb-2 [&_.paper-destination]:ps-3 [&_.paper-destination]:border [&_.paper-destination]:border-border [&_.paper-destination]:rounded-md [&_.paper-destination]:bg-background [&_.paper-destination_code]:flex-1 [&_.paper-destination_code]:min-w-0 [&_.paper-destination_code]:overflow-hidden [&_.paper-destination_code]:text-text [&_.paper-destination_code]:text-sm [&_.paper-destination_code]:font-normal [&_.paper-destination_code]:text-ellipsis [&_.paper-destination_code]:whitespace-nowrap [&_.paper-destination_.btn]:flex-none [&_.project-path-notice]:py-[9px] [&_.project-path-notice]:px-[11px] [&_.project-path-notice]:border [&_.project-path-notice]:border-border-variant [&_.project-path-notice]:rounded-sm [&_.project-path-notice]:bg-surface [&_.project-path-notice]:text-subtext [&_.project-path-notice]:text-sm [&_.project-path-notice]:leading-[1.4] [&_.project-path-notice.error]:border-danger-notice-border [&_.paper-results]:flex [&_.paper-results]:flex-col [&_.paper-results]:border [&_.paper-results]:border-border [&_.paper-results]:rounded-md [&_.paper-results]:max-h-60 [&_.paper-results]:overflow-y-auto [&_.paper-results_button]:flex [&_.paper-results_button]:flex-col [&_.paper-results_button]:items-start [&_.paper-results_button]:gap-0.5 [&_.paper-results_button]:py-2 [&_.paper-results_button]:px-2.5 [&_.paper-results_button]:bg-none [&_.paper-results_button]:bg-transparent [&_.paper-results_button]:border-0 [&_.paper-results_button]:border-b [&_.paper-results_button]:border-b-border-variant [&_.paper-results_button]:text-start [&_.paper-results_button]:[font:inherit] [&_.paper-results_button]:text-text [&_.paper-results_button]:cursor-pointer [&_.paper-results_button:last-child]:border-b-0 [&_.paper-results_button:hover]:bg-surface [&_.paper-results_.title]:text-sm [&_.paper-results_.title]:font-medium [&_.paper-results_.id]:text-xs [&_.paper-results_.id]:text-muted [&_.paper-pick_.id]:text-xs [&_.paper-pick_.id]:text-muted [&_.paper-pick]:flex [&_.paper-pick]:items-center [&_.paper-pick]:justify-between [&_.paper-pick]:gap-2.5 [&_.paper-pick]:py-2.5 [&_.paper-pick]:px-3 [&_.paper-pick]:border [&_.paper-pick]:border-border [&_.paper-pick]:rounded-md [&_.paper-pick]:bg-surface [&_.paper-pick_.meta]:min-w-0 [&_.paper-pick_.title]:text-sm [&_.paper-pick_.title]:font-medium flex flex-col [&_label]:flex [&_label]:flex-col [&_label]:gap-1 [&_label]:text-sm [&_label]:text-text [&_label]:font-medium [&_.row2]:grid [&_.row2]:grid-cols-2 [&_.row2]:gap-2.5 [&_.actions]:flex [&_.actions]:justify-end [&_.actions]:gap-2.5 [&_.actions]:mt-1.5 [&_.new-project-actions]:justify-start [&_.new-project-actions]:mt-2.5 [&_.error]:text-accent-red [&_.error]:text-sm [&_.error]:whitespace-pre-wrap new-project-form gap-4.5 [&_>_label]:gap-2",onSubmit:wt,children:[f.jsxs("div",{className:"seg inline-flex items-center gap-0.5 p-[3px] rounded-md bg-hover-subtle [&_button]:py-[3px] [&_button]:px-3 [&_button]:text-sm [&_button]:font-medium [&_button]:text-text [&_button]:rounded-sm [&_button:not(:disabled):hover]:text-text [&_button.active]:bg-background [&_button.active]:shadow-segment [&_button:disabled]:text-muted [&_button:disabled]:cursor-default form-seg",children:[f.jsx("button",{type:"button",className:r==="blank"?"active":"","aria-pressed":r==="blank",onClick:()=>Ze("blank"),children:YSe()}),f.jsx("span",{"aria-hidden":!0,className:`h-6 w-px bg-border${r==="paper"?"":" invisible"}`}),f.jsx("button",{type:"button",className:r==="folder"?"active":"","aria-pressed":r==="folder",onClick:()=>Ze("folder"),children:bke()}),f.jsx("span",{"aria-hidden":!0,className:`h-6 w-px bg-border${r==="blank"?"":" invisible"}`}),f.jsx("button",{type:"button",className:r==="paper"?"active":"","aria-pressed":r==="paper",onClick:()=>Ze("paper"),children:Nke()})]}),r==="paper"&&!M&&f.jsxs("label",{className:"!font-normal",children:[Yke(),f.jsx("input",{className:"text-sm font-normal","data-initial-focus":!0,value:T,onChange:xt=>{w(null),z(xt.target.value)},placeholder:a7e()}),!Zt&&f.jsx("span",{className:"repo-hint",children:ut?Z7e():U7e()}),Zt&&f.jsx("span",{className:"project-path-notice block",children:Bke()}),jt.length>0&&f.jsx("div",{className:"paper-results",children:jt.map(xt=>f.jsxs("button",{type:"button",onClick:()=>void Se(xt.paperId),children:[f.jsx(op,{children:xt.title}),f.jsx("span",{className:"id",children:xt.paperId})]},xt.paperId))})]}),M&&r==="paper"&&f.jsxs("div",{className:"paper-pick !flex-col !items-stretch",children:[f.jsxs("div",{className:"flex items-start justify-between gap-2.5",children:[f.jsxs("div",{className:"meta",children:[f.jsx(op,{className:"block",children:M.title||M.paperId}),M.repoUrl&&f.jsx("div",{className:"id",children:ngt(M.repoUrl)})]}),f.jsx(Le,{size:"small",type:"button","aria-label":lke(),onClick:Ae,children:ske()})]}),!M.repoUrl&&f.jsxs("div",{className:"flex w-full flex-col items-start gap-1 rounded-md border border-border-variant bg-background px-[9px] py-1 text-sm font-normal text-subtext",children:[f.jsxs("span",{className:"flex items-center gap-[5px] text-sm",children:[f.jsx(BO,{size:16})," ",Hke()]}),f.jsx("span",{className:"text-sm font-normal text-accent-amber",children:Wke()})]})]}),(r!=="paper"||M)&&f.jsxs(f.Fragment,{children:[r==="blank"&&f.jsxs("label",{className:"!font-normal",children:[f.jsx("span",{className:"project-field-label !font-medium",children:aN()}),f.jsx("input",{className:"text-sm font-normal","data-initial-focus":!0,value:i,onChange:xt=>{l(!0),a(xt.target.value)},placeholder:iN()})]}),r==="paper"?f.jsxs("label",{className:"project-location-field",children:[f.jsx("span",{className:"project-location-label !font-medium",children:M!=null&&M.repoUrl?jSe():Sx()}),f.jsx("input",{className:"text-sm font-normal",value:O,onChange:xt=>{p(!0),_(xt.target.value)},"aria-describedby":Sr?"paper-destination-description":void 0,placeholder:"~/OpenResearch/paper-title",spellCheck:!1}),re&&f.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:sN()}),Sr&&f.jsx("span",{id:"paper-destination-description",className:"folder-picker-hint error !text-accent-red",role:"alert",children:kr})]}):r==="folder"&&!t?f.jsxs("button",{"data-initial-focus":!0,type:"button",className:"folder-picker-control","aria-label":u?vSe({path:Ne(u)}):tN(),disabled:m,title:u||void 0,onClick:()=>void ht(),children:[f.jsx(Td,{className:u?"folder-picker-icon":"folder-picker-icon placeholder",size:16}),f.jsx("span",{className:u?"text-sm":"placeholder",children:m?CSe():u||tN()}),f.jsx(Ca,{className:"folder-picker-chevron",size:15})]}):r==="folder"?f.jsxs("label",{className:"project-location-field",children:[f.jsx("span",{className:"project-location-label !font-medium",children:Sx()}),f.jsx("input",{"data-initial-focus":!0,className:"text-sm font-normal",value:u,onChange:xt=>{p(!0),_(xt.target.value)},placeholder:"/home/user/project",spellCheck:!1,dir:"ltr"})]}):i.trim()?f.jsxs("label",{className:"project-location-field",children:[f.jsx("span",{className:"project-location-label !font-medium",children:Sx()}),f.jsx("input",{className:"text-sm font-normal",value:O,onChange:xt=>{p(!0),_(xt.target.value)},placeholder:"~/OpenResearch/my-research","aria-describedby":$n?"blank-destination-description":void 0,spellCheck:!1}),re&&f.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:sN()}),$n&&f.jsx("span",{id:"blank-destination-description",className:"folder-picker-hint error !text-accent-red",role:"alert",children:Wr})]}):null,r!=="blank"&&O&&f.jsxs("label",{className:"!font-normal",children:[f.jsx("span",{className:"project-field-label !font-medium",children:aN()}),f.jsx("input",{className:"text-sm font-normal",value:i,onChange:xt=>{l(!0),a(xt.target.value)},placeholder:iN()})]}),cn&&f.jsx("div",{className:"project-path-notice error",children:Ake()}),!cn&&r==="folder"&&u.trim()&&!re&&(q==null?void 0:q.exists)===!1&&f.jsx("div",{className:"project-path-notice error",children:_7e()}),!cn&&r==="folder"&&u.trim()&&!re&&tn&&f.jsx("div",{className:"project-path-notice error",children:w7e()}),!cn&&r==="folder"&&!re&&(q==null?void 0:q.gitState)==="detached"&&f.jsx("div",{className:"project-path-notice error",children:fke()}),!cn&&r==="folder"&&!re&&(q==null?void 0:q.gitState)==="invalid"&&f.jsx("div",{className:"project-path-notice error",children:v7e()}),G&&f.jsx("div",{className:"project-path-notice error",role:"alert",children:G})]}),b&&f.jsx("div",{className:"error",role:"alert",children:b}),(r!=="paper"||M)&&O&&(r!=="blank"||i.trim())&&f.jsxs("div",{className:"flex w-full flex-col items-start gap-2",children:[f.jsxs("button",{type:"button",className:`inline-flex items-center gap-1 text-sm font-medium${E&&te===null?" text-accent-red":" text-text"}`,"aria-expanded":y,"aria-controls":"new-project-advanced-settings",onClick:()=>C(xt=>!xt),children:[E?te===null?aSe():uSe():nSe(),f.jsx(qo,{className:y?"rotate-180":"",size:16})]}),y&&f.jsxs("label",{id:"new-project-advanced-settings",className:"flex w-full flex-col items-stretch gap-[7px] font-normal",children:[f.jsxs("span",{className:"flex flex-row items-center gap-[9px]",children:[f.jsx("input",{className:"m-0",type:"checkbox",checked:E,onChange:xt=>N(xt.target.checked),disabled:S}),f.jsx("strong",{className:"text-base font-medium leading-[1.3] text-text",children:u7e()})]}),f.jsxs("span",{className:"flex flex-col gap-[3px] font-sans text-sm font-normal leading-[1.4] text-subtext",children:[f.jsx("span",{children:vn?E7e({repository:Ne(un)}):Be?D7e({repository:Ne(un)}):T7e({repository:Ne(un)})}),f.jsx("span",{children:Ske()}),te===null&&f.jsx("span",{children:K7e({command:Ne("gh auth login")})})]})]})]}),f.jsxs("div",{className:"actions new-project-actions",children:[n&&f.jsx(Le,{type:"button",onClick:n,children:eke()}),f.jsx(Le,{variant:"primary",className:"ms-auto",disabled:!gt,children:S?PSe():r==="paper"?M!=null&&M.repoUrl?MSe():nN():r==="folder"?n8e():nN()})]})]})}function sI({onClose:e,onCreated:n,remote:t=!1}){const r=R.useRef(null),s=R.useRef(e);return s.current=e,R.useEffect(()=>{const i=r.current;if(!i)return;const a=document.activeElement instanceof HTMLElement?document.activeElement:null,o=()=>[...i.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])')];(i.querySelector("[data-initial-focus]")??o()[0]??i).focus();const l=u=>{if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),s.current();return}if(u.key==="Enter"&&(u.metaKey||u.ctrlKey)&&!u.altKey&&u.shiftKey){u.preventDefault(),u.stopPropagation();return}if(u.key!=="Tab")return;const _=o();if(_.length===0){u.preventDefault(),i.focus();return}const d=_[0],p=_[_.length-1];u.shiftKey&&document.activeElement===d?(u.preventDefault(),p.focus()):!u.shiftKey&&document.activeElement===p&&(u.preventDefault(),d.focus())};return document.addEventListener("keydown",l,!0),()=>{document.removeEventListener("keydown",l,!0),a==null||a.focus()}},[]),f.jsx("div",{className:"modal-backdrop fixed inset-0 bg-modal-backdrop flex items-start justify-center p-5 [--new-project-modal-top:clamp(4rem,20vh,24rem)] pt-[var(--new-project-modal-top)] overflow-y-auto z-100",onClick:i=>{i.target===i.currentTarget&&e()},children:f.jsxs("div",{ref:r,className:"modal w-120 max-w-full max-h-[calc(100vh_-_var(--new-project-modal-top)_-_1.25rem)] overflow-y-auto bg-background border border-border rounded-xl shadow-modal p-6 [&_h2]:mt-0 [&_h2]:mx-0 [&_h2]:mb-3.5 [&_h2]:text-xl [&_h2]:font-medium",role:"dialog","aria-modal":"true","aria-labelledby":"new-project-dialog-title",tabIndex:-1,children:[f.jsx("h2",{id:"new-project-dialog-title",children:XD()}),f.jsx(rgt,{onCancel:e,onCreated:n,remote:t})]})})}function sgt({project:e,deleting:n,error:t,onClose:r,onConfirm:s}){const i=R.useRef(null),a=R.useRef(r),o=R.useRef(n);a.current=r,o.current=n,R.useEffect(()=>{const u=i.current;if(!u)return;const _=document.activeElement instanceof HTMLElement?document.activeElement:null,d=()=>[...u.querySelectorAll('button:not([disabled]), [tabindex]:not([tabindex="-1"])')];(d()[0]??u).focus();const p=m=>{if(m.key==="Escape"){m.preventDefault(),o.current||a.current();return}if(m.key!=="Tab")return;const x=d();if(x.length===0){m.preventDefault(),u.focus();return}const S=x[0],v=x[x.length-1];m.shiftKey&&document.activeElement===S?(m.preventDefault(),v.focus()):!m.shiftKey&&document.activeElement===v&&(m.preventDefault(),S.focus())};return document.addEventListener("keydown",p,!0),()=>{document.removeEventListener("keydown",p,!0),_==null||_.focus()}},[]);const l=!!(e.githubEnabled&&(e.githubUrl||e.githubOwner&&e.githubRepo));return f.jsx("div",{className:"modal-backdrop fixed inset-0 bg-modal-backdrop flex items-center justify-center p-5 overflow-y-auto z-100",onClick:u=>{!n&&u.target===u.currentTarget&&r()},children:f.jsxs("div",{ref:i,className:"modal w-110 max-w-full bg-background border border-border rounded-xl shadow-modal p-6",role:"dialog","aria-modal":"true","aria-labelledby":"delete-project-dialog-title","aria-describedby":"delete-project-dialog-description",tabIndex:-1,children:[f.jsx("h2",{id:"delete-project-dialog-title",className:"mt-0 mb-3 text-xl",children:oRe()}),f.jsxs("div",{id:"delete-project-dialog-description",className:"flex flex-col gap-2 text-sm leading-normal text-subtext",children:[f.jsx("p",{className:"m-0",children:HAe({name:Do(e.name)})}),f.jsx("p",{className:"m-0",children:l?wRe():ERe()}),t&&f.jsx("p",{className:"m-0 text-accent-red",role:"alert",children:t})]}),f.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[f.jsx(Le,{disabled:n,onClick:r,children:JAe()}),f.jsx(Le,{variant:"danger",disabled:n,onClick:s,children:n?pRe():dRe()})]})]})})}function Sz(){return f.jsx("span",{className:"activity-pulse h-2 w-2 shrink-0 rounded-full bg-accent-teal animate-[or-pulse_1.2s_ease-in-out_infinite]"})}function igt({projects:e,onOpen:n,onCreated:t,onDeleted:r,remote:s=!1}){const[i,a]=R.useState(!1),[o,l]=R.useState(null),[u,_]=R.useState(null),[d,p]=R.useState(null),m=ot(oht()),x=Object.fromEntries((m.data??[]).map(v=>[v.projectId,v]));async function S(v){l(v.id),_(null);try{await xut(v.id),_(null),p(null),r(v.id)}catch(b){_(b instanceof Error?b.message:String(b))}finally{l(null)}}return f.jsxs("div",{className:"home flex-1 min-h-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] bg-canvas",children:[f.jsxs("div",{className:"home-inner max-w-290 my-0 mx-auto pt-12 px-6 pb-16 [@media((max-width:_960px))]:pt-6 [@media((max-width:_960px))]:px-4",children:[f.jsxs("div",{className:"home-head flex items-center justify-between gap-3 mb-4.5 [&_h2]:m-0 [&_h2]:text-4xl [&_h2]:tracking-[-0.02em] [@media((max-width:_520px))]:items-start [@media((max-width:_520px))]:flex-col",children:[f.jsx("h2",{children:FRe()}),f.jsxs(Le,{onClick:()=>a(!0),children:[f.jsx(em,{size:15})," ",XD()]})]}),f.jsx("div",{className:"home-list overflow-hidden rounded-lg border border-border bg-background",children:f.jsxs("div",{children:[f.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_9rem_9rem_minmax(18rem,max-content)] items-center gap-3 border-b border-border bg-background py-2.5 ps-4 pe-2 text-xs font-medium tracking-[0.06em] text-text uppercase [@media((max-width:_960px))]:hidden",children:[f.jsx("span",{children:IRe()}),f.jsx("span",{children:mN()}),f.jsx("span",{children:gN()}),f.jsx("span",{children:vN()})]}),e.length===0?f.jsx("div",{className:"py-8 px-4 text-sm text-muted",children:MRe()}):[...e].sort((v,b)=>{var C,E;const w=((C=x[v.id])==null?void 0:C.lastMessageAt)??v.createdAt;return(((E=x[b.id])==null?void 0:E.lastMessageAt)??b.createdAt)-w||v.name.localeCompare(b.name)}).map(v=>{const b=x[v.id],w=v.githubEnabled?v.githubUrl??(v.githubOwner&&v.githubRepo?`https://github.com/${v.githubOwner}/${v.githubRepo}`:null):null,y=w?v.githubOwner&&v.githubRepo?`${v.githubOwner}/${v.githubRepo}`:w.replace(/^https?:\/\/github\.com\//,"").replace(/\.git$/,"").replace(/\/$/,""):i6(),C=b?b.activeAgents>0?DAe({count:Wt(b.activeAgents)}):KRe():"—",E=b?b.totalAgents===1?tMe():BAe({count:Wt(b.totalAgents)}):"—",N=b?b.runningExperiments>0?iMe({count:Wt(b.runningExperiments)}):b.totalExperiments===0?l6():bN({count:Wt(b.totalExperiments)}):"—",T=b&&b.runningExperiments>0?bN({count:Wt(b.totalExperiments)}):null;return f.jsxs("div",{className:"group project-row relative grid cursor-pointer grid-cols-[minmax(0,1fr)_9rem_9rem_minmax(18rem,max-content)] items-center gap-3 border-b border-border-variant py-4 ps-4 pe-2 text-start transition-colors duration-120 ease-standard last:border-b-0 hover:bg-surface-bright focus-within:bg-surface-bright [@media((max-width:_960px))]:grid-cols-[minmax(0,0.8fr)_minmax(0,0.8fr)_minmax(0,1.4fr)] [@media((max-width:_960px))]:items-start [@media((max-width:_960px))]:gap-x-4 [@media((max-width:_960px))]:gap-y-3 [@media((max-width:_960px))]:py-4 [@media((max-width:_960px))]:px-4 [@media((max-width:_600px))]:grid-cols-2",children:[f.jsx("button",{className:"project-row-open absolute inset-0 z-0 cursor-pointer rounded-[inherit] focus-visible:outline focus-visible:outline-2 focus-visible:outline-text focus-visible:outline-offset-[-2px]","aria-label":NQ({name:Do(v.name)}),onClick:()=>n(v.id)}),f.jsxs("div",{className:"relative z-1 flex min-w-0 flex-col gap-1 pointer-events-none [@media((max-width:_960px))]:col-span-3 [@media((max-width:_600px))]:col-span-2",children:[f.jsx("span",{dir:"auto",className:"project-row-title whitespace-normal break-words text-base font-semibold text-text pointer-events-none",children:v.name}),f.jsxs("span",{className:"relative z-2 flex items-center gap-1.5 text-xs text-muted [@media((max-width:_960px))]:flex-wrap",children:[f.jsxs("span",{children:[rRe()," ",Io(v.createdAt)]}),v.paperId&&f.jsx("span",{"aria-hidden":"true",children:"·"}),v.paperId&&f.jsxs("span",{children:[QAe()," ",Ne(v.paperId)]}),f.jsx("button",{className:"project-row-secondary project-row-delete inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-sm leading-0 text-muted opacity-0 pointer-events-none transition-opacity hover:bg-surface hover:text-accent-red group-hover:opacity-100 group-hover:pointer-events-auto group-focus-within:opacity-100 group-focus-within:pointer-events-auto focus:opacity-100 focus:pointer-events-auto focus-visible:outline focus-visible:outline-2 focus-visible:outline-text","aria-label":S4({name:Do(v.name)}),disabled:o===v.id,onClick:z=>{z.stopPropagation(),_(null),p(v)},children:f.jsx(Vd,{size:14})})]})]}),f.jsxs("div",{className:"relative z-1 flex min-w-0 flex-col gap-1 pointer-events-none",children:[f.jsx("span",{className:"hidden text-xs font-medium tracking-[0.06em] text-text uppercase [@media((max-width:_960px))]:block",children:mN()}),f.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-text",children:[b&&b.activeAgents>0&&f.jsx(Sz,{}),C]}),f.jsx("span",{className:"text-xs text-muted",children:E})]}),f.jsxs("div",{className:"relative z-1 flex min-w-0 flex-col gap-1 pointer-events-none",children:[f.jsx("span",{className:"hidden text-xs font-medium tracking-[0.06em] text-text uppercase [@media((max-width:_960px))]:block",children:gN()}),f.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-text",children:[b&&b.runningExperiments>0&&f.jsx(Sz,{}),N]}),T&&f.jsx("span",{className:"text-xs text-muted",children:T})]}),f.jsxs("div",{className:"relative z-1 min-w-0 pointer-events-none [@media((max-width:_600px))]:col-span-2",children:[f.jsx("span",{className:"hidden text-xs font-medium tracking-[0.06em] text-text uppercase [@media((max-width:_960px))]:mb-1 [@media((max-width:_960px))]:block",children:vN()}),w?f.jsxs("a",{className:"project-row-secondary inline-flex max-w-full items-center gap-2 text-sm text-text no-underline pointer-events-auto hover:underline underline-offset-2",href:w,target:"_blank",rel:"noreferrer","aria-label":J1({name:Do(v.name)}),children:[f.jsx("span",{className:"inline-flex shrink-0",children:f.jsx(fb,{size:14})}),f.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap [@media((max-width:_960px))]:whitespace-normal [@media((max-width:_960px))]:break-all",children:Ne(y)})]}):f.jsx("span",{className:"text-sm text-text pointer-events-none",children:y})]})]},v.id)})]})})]}),i&&f.jsx(sI,{remote:s,onClose:()=>a(!1),onCreated:(v,b)=>{a(!1),t(v,b)}}),d&&f.jsx(sgt,{project:d,deleting:o===d.id,error:u,onClose:()=>{_(null),p(null)},onConfirm:()=>void S(d)})]})}function iI(){const e=R.useSyncExternalStore(nht,WN,WN);return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:e?"":E4()}),!e&&f.jsxs("div",{className:"offline-banner flex items-center gap-2 shrink-0 py-1.5 px-3.5 text-sm text-text bg-accent-amber-subtle border-b border-b-accent-amber","aria-hidden":!0,children:[f.jsx(BO,{size:13,className:"shrink-0 text-accent-amber"}),f.jsx("span",{dir:"auto",className:"min-w-0",children:E4()})]})]})}const aI={id:"lmstudio",label:"LM Studio",icon:eI,url:"http://127.0.0.1:1234/v1"},N1=[aI,{id:"omlx",label:"oMLX",icon:nI,url:"http://127.0.0.1:8000/v1"},{id:"ollama",label:"Ollama",icon:tI,url:"http://127.0.0.1:11434/v1"},{id:"openai-compatible",label:"Custom Endpoint",icon:null,url:"http://127.0.0.1:8000/v1"}];function oI({installed:e,onConnected:n,dialogOnly:t=!1,onClose:r}){var X,ee;const s=t_(),i=ot({...qft(),enabled:!t}),a=ot(ru()),o=(X=a.data)==null?void 0:X.find(O=>O.id==="opencode"),[l,u]=R.useState(t),_=()=>{u(!1),r==null||r()},[d,p]=R.useState("lmstudio"),m=N1.find(O=>O.id===d)??aI,[x,S]=R.useState({}),v=x[m.id]??{baseUrl:m.url,apiKey:"",models:[],model:null,contextWindow:"32768",error:null},{baseUrl:b,models:w,model:y,contextWindow:C,error:E}=v,N=m.id==="ollama"?"":v.apiKey,T=O=>{S(L=>({...L,[m.id]:{...L[m.id]??v,...O}}))},z=mn({mutationFn:wft}),M=mn({mutationFn:async O=>{var q;const L=await Sft(O);if(!((q=(await s.fetchQuery({...ru(),staleTime:0})).find(G=>G.id==="opencode"))!=null&&q.models.some(G=>G.id===L.model)))throw new Error(F3e());return L}}),I=mn({mutationFn:Cft}),B=Number(C),$=z.isPending||M.isPending,U=(O={})=>T({models:[],model:null,error:null,...O}),H=async()=>{U();try{const O=await z.mutateAsync({baseUrl:b.trim(),apiKey:N});T({models:O.models,model:O.models[0]??null})}catch(O){T({error:O instanceof Error?O.message:String(O)})}},Y=async()=>{if(y){T({error:null});try{const O=await M.mutateAsync({name:m.label,baseUrl:b.trim(),apiKey:N,model:y,contextWindow:B});_(),n==null||n(O.model)}catch(O){T({error:O instanceof Error?O.message:String(O)})}}},V=async O=>{try{await I.mutateAsync(O)}catch(L){Vn(L instanceof Error?L.message:String(L),"error")}};return f.jsxs(f.Fragment,{children:[!t&&f.jsxs("section",{className:"mt-4 space-y-3 border-t border-border pt-4","aria-label":XE(),children:[f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[f.jsx("h3",{className:"text-base font-medium",children:XE()}),f.jsxs(Le,{disabled:$,onClick:()=>u(!0),"aria-haspopup":"dialog",children:[f.jsx(em,{size:14}),ID()]})]}),i.error&&f.jsx("p",{className:"text-sm text-accent-red",role:"alert",children:i.error.message}),f.jsx("div",{className:"space-y-3",children:(ee=i.data)==null?void 0:ee.map(O=>f.jsx(agt,{connection:O,harnessReady:(o==null?void 0:o.agentReady)??!1,availableModels:(o==null?void 0:o.models.map(L=>L.id))??[],checking:a.isFetching,unknown:a.isError||!a.data,disabled:$||I.isPending,onRemove:()=>void V(O.id)},O.id))})]}),l&&f.jsx(ogt,{busy:$,onClose:_,footer:f.jsxs(Le,{variant:"primary",disabled:$||!e||w.length>0&&(!y||!Number.isSafeInteger(B)||B<4096),onClick:()=>void(w.length>0?Y():H()),children:[$&&f.jsx(Lt,{}),w.length>0?w5e():D3e()]}),children:f.jsxs("div",{className:"space-y-4",children:[!e&&f.jsxs("div",{className:"text-sm text-text",children:[f.jsx("p",{children:_5e()}),f.jsx(Bh,{href:"https://opencode.ai/docs/#install",target:"_blank",rel:"noreferrer",children:u5e()})]}),f.jsx(Ad,{choices:N1,value:d,title:YE(),header:YE(),variant:"field",floating:!0,dropDown:!0,disabled:$,renderLabel:O=>f.jsxs(f.Fragment,{children:[O.id==="openai-compatible"?t6():O.label,O.id==="openai-compatible"&&f.jsx("span",{className:"ml-1 text-xs font-normal text-subtext",children:BD()})]}),renderIcon:O=>{var F;const L=(F=N1.find(q=>q.id===O.id))==null?void 0:F.icon;return L?f.jsx("img",{src:L,alt:"",width:14,height:14,className:`size-3.5 shrink-0 object-contain${O.id==="ollama"?" dark:invert":""}`}):f.jsx(GO,{size:14,className:"shrink-0"})},onSelect:p}),f.jsxs("label",{className:"block space-y-1 text-sm text-subtext",children:[f.jsx("span",{children:T3e()}),f.jsx(ns,{value:b,disabled:$,onChange:O=>{U({baseUrl:O.target.value})}})]}),m.id!=="ollama"&&f.jsxs("details",{className:"text-sm text-text",children:[f.jsx("summary",{className:"cursor-pointer",children:oL()}),f.jsxs("label",{className:"block space-y-1 mt-3 text-sm text-subtext",children:[f.jsx("span",{children:m.id==="lmstudio"?R5e():v5e()}),f.jsx(ns,{type:"password",autoComplete:"off",value:N,disabled:$,onChange:O=>U({apiKey:O.target.value})})]})]},m.id),w.length>0&&f.jsxs(f.Fragment,{children:[f.jsx(Ad,{choices:w.map(O=>({id:O,label:O})),value:y,searchPlaceholder:HD(),title:D0(),header:D0(),variant:"field",floating:!0,dropDown:!0,disabled:$,onSelect:O=>{T({model:O})}}),f.jsxs("label",{className:"block space-y-1 text-sm text-subtext",children:[f.jsx("span",{children:Q3e()}),f.jsx(ns,{type:"number",min:4096,step:1024,value:C,disabled:$,onChange:O=>{T({contextWindow:O.target.value})}})]}),f.jsx("p",{className:"text-sm text-subtext",children:J3e()})]}),E&&f.jsx("p",{className:"text-sm text-accent-red",role:"alert",children:E})]})})]})}function agt({connection:e,harnessReady:n,availableModels:t,checking:r,unknown:s,disabled:i,onRemove:a}){const o=mn({mutationFn:async()=>{try{await kft(e.id)}finally{await tb(!0)}}}),l=N1.find(x=>x.label===e.name||x.id==="openai-compatible"&&["OpenAI-compatible server","Custom endpoint"].includes(e.name)),u=Object.keys(e.models),_=u.length>0&&n&&u.every(x=>t.includes(`${e.id}/${x}`)),d=o.isPending||r,p=s,m=_;return f.jsxs("div",{className:"@container min-w-0 px-4 py-4",children:[f.jsxs("div",{className:"flex flex-col items-stretch gap-3 @sm:flex-row @sm:items-center @sm:justify-between",children:[f.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[l!=null&&l.icon?f.jsx("img",{src:l.icon,alt:"",width:20,height:20,className:`mt-0.5 size-5 shrink-0 object-contain${l.id==="ollama"?" dark:invert":""}`}):f.jsx(GO,{size:20,className:"mt-0.5 shrink-0"}),f.jsxs("div",{className:"min-w-0 space-y-1",children:[f.jsx("div",{className:"text-base font-medium break-words",children:u.join(", ")}),f.jsxs("div",{className:"text-sm text-subtext break-all",children:[(l==null?void 0:l.id)==="openai-compatible"?t6():(l==null?void 0:l.label)??e.name,(l==null?void 0:l.id)==="openai-compatible"&&f.jsx("span",{className:"ml-1 text-xs font-normal text-subtext",children:BD()})," · ",e.baseUrl]})]})]}),f.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1 self-end @sm:self-auto @lg:flex-row @lg:items-center @lg:gap-2",children:[f.jsx("span",{role:"status",children:f.jsx(Ft,{variant:d||p?"default":m?"success":"warning",children:d?Vi():p?vL():m?G3e():Ka()})}),f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsxs(Le,{variant:"ghost",disabled:i||o.isPending,onClick:()=>o.mutate(),children:[f.jsx(Ea,{size:14}),UD()]}),f.jsx(Yt,{"aria-label":a5e({name:e.name}),disabled:i||o.isPending,onClick:a,children:f.jsx(Vd,{size:14})})]})]})]}),o.error&&!m&&f.jsx("p",{className:"mt-2 text-sm text-accent-red",role:"alert",children:o.error.message})]})}function ogt({busy:e,onClose:n,footer:t,children:r}){const s=R.useRef(null),i=()=>{e||n()};return sb(s,i,"input"),eo.createPortal(f.jsx("div",{className:"fixed inset-0 z-200 flex items-center justify-center bg-modal-backdrop p-5",onClick:a=>{a.target===a.currentTarget&&i()},children:f.jsxs("div",{ref:s,role:"dialog","aria-modal":"true","aria-labelledby":"local-model-dialog-title",tabIndex:-1,className:"relative flex max-h-full w-140 max-w-full flex-col rounded-xl border border-border bg-background shadow-modal",children:[f.jsx("div",{className:"shrink-0 px-6 pt-5 pb-4 pe-14",children:f.jsx("h2",{id:"local-model-dialog-title",className:"m-0 text-xl font-medium",children:ID()})}),f.jsx(Yt,{className:"absolute end-3.5 top-3.5","aria-label":Nd(),onClick:i,disabled:e,children:f.jsx(qr,{size:16})}),f.jsx("div",{className:"min-h-0 overflow-y-auto px-6 pb-2",children:r}),f.jsxs("div",{className:"flex shrink-0 justify-end gap-2 px-6 py-4",children:[f.jsx(Le,{onClick:i,disabled:e,children:Nd()}),t]})]})}),document.body)}const lI=["model-group flex items-center justify-between gap-2","text-sm font-medium text-text pt-2.5 px-2 pb-1.5"].join(" "),kz=["model-more [&_code]:font-mono [&_code]:text-xs","[&_code]:bg-panel [&_code]:border [&_code]:border-border-variant","[&_code]:rounded-xs [&_code]:py-px [&_code]:px-[5px] [&_code]:whitespace-nowrap","pt-1 px-2 pb-2 text-sm text-muted"].join(" "),E0={"claude-code":"Claude Code",codex:"Codex",opencode:"OpenCode",cursor:"Cursor"};function lgt(e){var r,s;const n=e.find(i=>i.agentReady);if(!n)return null;const t=((r=n.models[0])==null?void 0:r.id)??null;return{harness:n.id,model:t,serviceTier:rv(n,t,null),permissionMode:((s=n.options)==null?void 0:s.defaultPermissionMode)??null,reasoningLevel:eb(n,t).defaultId}}function to(e){const[n,t]=R.useState(!1),r=R.useRef(null);return R.useEffect(()=>{if(!n)return;const s=a=>{var o,l;a.target instanceof Node&&!((o=r.current)!=null&&o.contains(a.target))&&!((l=e==null?void 0:e.current)!=null&&l.contains(a.target))&&t(!1)},i=a=>{var o;a.key==="Escape"&&(a.preventDefault(),a.stopPropagation(),t(!1),(o=e==null?void 0:e.current)==null||o.focus())};return document.addEventListener("mousedown",s,!0),document.addEventListener("keydown",i,!0),()=>{document.removeEventListener("mousedown",s,!0),document.removeEventListener("keydown",i,!0)}},[n,e]),{open:n,setOpen:t,ref:r}}function cgt({value:e,onSelect:n,permissionChoices:t=[],defaultPermissionId:r,onSelectPermission:s,reasoningChoices:i=[],defaultReasoningId:a,onSelectReasoning:o,lockHarness:l=!1,className:u}){var te,Q,le,ae,de,pe,we;const{data:_=ugt}=ot(ru()),d=t_(),[p,m]=R.useState(!1),x=R.useRef(null),S=R.useRef(null),{open:v,setOpen:b,ref:w}=to(x),[y,C]=R.useState(""),[E,N]=R.useState("root"),T=()=>{b(!1),N("root"),C("")};R.useEffect(()=>{var be;v&&(E==="reasoning"||E==="speed"||E==="permissions")&&((be=S.current)==null||be.focus())},[v,E]);const z=R.useMemo(()=>{const be=y.trim().toLowerCase();return(l&&e?_.filter(Be=>Be.id===e.harness):_).map(Be=>{let ze=Be.models;return be?ze=ze.filter(it=>`${it.id} ${O0(it)}`.toLowerCase().includes(be)):(Be.id==="opencode"||Be.id==="cursor")&&(ze=ze.slice(0,5)),{harness:Be,models:ze,hidden:be?0:Be.models.length-ze.length}})},[_,y,l,e]),M=(be,Pe)=>{var ze;const Be=(e==null?void 0:e.harness)===be.id;n({harness:be.id,model:Pe,serviceTier:rv(be,Pe,Be?e==null?void 0:e.serviceTier:null),permissionMode:Be?e.permissionMode:((ze=be.options)==null?void 0:ze.defaultPermissionMode)??null,reasoningLevel:qL(be,Pe,Be?e.reasoningLevel:null)}),T()},I=(e==null?void 0:e.model)!=null?(te=_.find(be=>be.id===e.harness))==null?void 0:te.models.find(be=>be.id===e.model):void 0,B=e?e.model?I?O0(I):D4(e.model):ZE():D0(),$=(e==null?void 0:e.reasoningLevel)??a??((Q=i[0])==null?void 0:Q.id),U=(le=i.find(be=>be.id===$))==null?void 0:le.label,H=(e==null?void 0:e.permissionMode)??r??((ae=t[0])==null?void 0:ae.id),Y=(de=t.find(be=>be.id===H))==null?void 0:de.label,V=(e==null?void 0:e.harness)==="opencode"?Z6e():h6e(),X=_.find(be=>be.id===(e==null?void 0:e.harness)),ee=HL(X,e==null?void 0:e.model),O=rv(X,e==null?void 0:e.model,e==null?void 0:e.serviceTier),L=(pe=ee.find(be=>be.id===O))==null?void 0:pe.label,F=be=>{o==null||o(be),T()},q=be=>{s==null||s(be),T()},G=be=>{e&&n({...e,serviceTier:be}),T()},re=(be,Pe,Be)=>f.jsxs("button",{type:"button",className:"model-root-row flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-start text-sm text-text hover:bg-surface","aria-haspopup":"menu",onClick:()=>N(Be),children:[f.jsx("span",{className:"flex-1",children:be}),Pe&&f.jsx("span",{className:"max-w-36 truncate text-sm text-muted",children:Pe}),f.jsx(Ca,{size:14,className:"shrink-0 text-muted"})]}),ce=be=>f.jsxs("button",{ref:S,type:"button",className:"model-submenu-header flex w-full items-center gap-2 border-0 border-b border-solid border-b-border-variant bg-transparent px-2 py-2 text-start text-sm font-medium text-text hover:bg-surface",onClick:()=>{N("root"),C("")},children:[f.jsx(IO,{size:15}),be]}),oe=(be,Pe,Be,ze)=>f.jsx("div",{className:"model-menu-list overflow-y-auto p-1.5",children:be.map(it=>f.jsxs(ir,{onClick:()=>ze(it.id),children:[f.jsxs("span",{className:"flex min-w-0 flex-col items-start gap-0.5",children:[f.jsxs("span",{children:[it.label,it.id===Be&&f.jsxs("span",{className:"font-normal text-muted",children:[" ",FD()]})]}),it.description&&f.jsx("span",{className:"max-w-72 text-sm font-normal leading-snug text-muted",children:it.description})]}),it.id===Pe&&f.jsx(wa,{size:13})]},it.id))});return f.jsxs("div",{className:"model-picker relative inline-flex min-w-0","data-onboarding":"model-picker",ref:w,children:[f.jsxs("button",{ref:x,type:"button",className:Ns("composer-pill inline-flex h-8 min-w-0 max-w-full items-center gap-[5px] rounded-md px-2 text-sm text-text whitespace-nowrap transition-[background,color] duration-150 ease-standard hover:bg-surface",u),title:kK({label:`${B}${U?` · ${U}`:""}${L?` · ${L}`:""}`}),"aria-haspopup":"menu","aria-expanded":v,onClick:()=>{v?T():(N("root"),b(!0))},children:[O==="priority"?f.jsx(Mmt,{size:14,fill:"currentColor","aria-hidden":"true"}):e!=null&&e.harness?f.jsx(J4,{harness:e.harness,size:14}):null,O==="priority"&&f.jsxs("span",{className:"sr-only",children:[g6e()," "]}),f.jsxs("span",{className:"model-picker-label min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:[B,U&&f.jsx("span",{className:"model-picker-reasoning ms-1 text-muted",children:U})]}),f.jsx(qo,{size:14,className:"shrink-0 text-muted"})]}),v&&f.jsxs("div",{className:"model-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-100 flex flex-col bg-background border border-border rounded-md shadow-dropdown z-50 overflow-hidden w-72 [&.align-right]:start-auto [&.align-right]:end-0 [&_input]:rounded-none [&_input]:border-0 [&_input]:border-b [&_input]:border-b-border-variant [&_input]:bg-none [&_input]:bg-transparent [&_input]:py-2 [&_input]:px-2.5 [&_input]:text-sm [&_input]:outline-none align-right",children:[E==="root"&&f.jsxs("div",{className:"model-root-menu p-1",children:[re(D0(),B,"models"),i.length>0&&re(V,U,"reasoning"),ee.length>0&&re(eN(),L,"speed"),t.length>0&&re(JE(),Y,"permissions")]}),E==="models"&&f.jsxs(f.Fragment,{children:[ce(D0()),f.jsx("input",{autoFocus:!0,type:"text",placeholder:HD(),value:y,onChange:be=>C(be.target.value)}),f.jsxs("div",{className:"model-menu-list overflow-y-auto p-1.5",children:[z.map(({harness:be,models:Pe,hidden:Be})=>f.jsxs("div",{className:"[&_.model-item]:ps-6",children:[f.jsxs("div",{className:lI,children:[f.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[f.jsx(J4,{harness:be.id,size:14}),be.name]}),!be.agentReady&&f.jsxs("span",{className:"model-group-status inline-flex items-center gap-1 text-accent-amber font-normal",children:[f.jsx(gz,{size:10})," ",Ka()]})]}),be.agentReady?f.jsxs(f.Fragment,{children:[be.models.length===0&&f.jsxs(ir,{onClick:()=>M(be,null),children:[f.jsxs("span",{children:[ZE(),f.jsx("span",{className:"model-id",children:PD()})]}),(e==null?void 0:e.harness)===be.id&&(e==null?void 0:e.model)===null&&f.jsx(wa,{size:13})]}),Pe.map(ze=>f.jsxs(ir,{title:ze.id,onClick:()=>M(be,ze.id),children:[f.jsx("span",{children:O0(ze)}),(e==null?void 0:e.harness)===be.id&&(e==null?void 0:e.model)===ze.id&&f.jsx(wa,{size:13})]},ze.id)),y.trim().length>0&&!be.models.some(ze=>ze.id===y.trim())&&f.jsx(ir,{onClick:()=>M(be,y.trim()),children:f.jsx("span",{children:K6e({id:Ne(y.trim())})})})]}):f.jsx("div",{className:"model-more [&_code]:font-mono [&_code]:text-xs [&_code]:bg-panel [&_code]:border [&_code]:border-border-variant [&_code]:rounded-xs [&_code]:py-px [&_code]:px-[5px] [&_code]:whitespace-nowrap pt-1 px-2 pb-2 text-sm text-muted model-unavailable leading-normal border-b border-b-border-variant",children:be.agentNote?tm(be.agentNote):A6e()}),be.id==="opencode"&&f.jsx(ir,{type:"button",className:"font-medium","aria-haspopup":"dialog",onClick:()=>{var ze;T(),(ze=x.current)==null||ze.focus(),m(!0)},children:f.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[Y5e(),f.jsx(em,{size:14,"aria-hidden":"true"})]})}),be.agentReady&&Be>0&&f.jsx("div",{className:kz,children:N6e({count:Wt(Be)})})]},be.id)),_.length===0&&f.jsx("div",{className:kz,children:c6e()})]}),l&&e&&_.length>1&&f.jsxs("div",{className:"model-locked-note py-[7px] px-3 text-sm text-muted border-t border-t-border-variant",children:[f.jsx(gz,{size:11,className:"inline-block align-baseline me-1","aria-hidden":"true"}),B6e()]})]}),E==="reasoning"&&f.jsxs(f.Fragment,{children:[ce(V),oe(i,$,a,F)]}),E==="permissions"&&f.jsxs(f.Fragment,{children:[ce(JE()),oe(t,H,r,q)]}),E==="speed"&&f.jsxs(f.Fragment,{children:[ce(eN()),oe(ee,O??void 0,"default",G)]})]}),p&&f.jsx(oI,{dialogOnly:!0,installed:((we=_.find(be=>be.id==="opencode"))==null?void 0:we.installed)??!1,onClose:()=>m(!1),onConnected:be=>{var Be;const Pe=(Be=d.getQueryData(ru().queryKey))==null?void 0:Be.find(ze=>ze.id==="opencode");Pe&&(!l||(e==null?void 0:e.harness)==="opencode")&&M(Pe,be)}})]})}function Ad({choices:e,value:n,defaultId:t,header:r,align:s="left",dropDown:i=!1,disabled:a=!1,variant:o="pill",title:l,numbered:u=!1,searchPlaceholder:_,renderIcon:d,renderLabel:p,floating:m=!1,onSelect:x,className:S}){var Y,V;const v=R.useRef(null),{open:b,setOpen:w,ref:y}=to(v),C=R.useRef(null),[E,N]=R.useState("");if(R.useLayoutEffect(()=>{var L;const X=C.current,ee=y.current;if(!b||!m||!X||!ee)return;X.matches(":popover-open")||(X.showPopover(),(L=X.querySelector("input"))==null||L.focus());const O=()=>{const F=ee.getBoundingClientRect(),q=window.innerHeight-F.bottom-12,G=F.top-12,re=Math.min(380,X.scrollHeight),ce=i?q>=re||q>=G:GG;X.style.width=`${F.width}px`,X.style.minWidth="0",X.style.maxHeight=`${Math.max(0,Math.min(380,ce?q:G))}px`,X.style.left=`${F.left}px`,X.style.top=`${ce?F.bottom+4:F.top-X.getBoundingClientRect().height-4}px`};return O(),window.addEventListener("resize",O),window.addEventListener("scroll",O,!0),()=>{window.removeEventListener("resize",O),window.removeEventListener("scroll",O,!0)}},[b,m,i,E,e.length,y]),e.length===0)return null;const T=n??t??((Y=e[0])==null?void 0:Y.id)??null,z=e.find(X=>X.id===T),M=e.find(X=>X.id===t),I=o==="bare"&&(M==null?void 0:M.id)===nv?M:void 0,$=(I?e.filter(X=>X.id!==I.id):e).filter(X=>`${X.label} ${X.id}`.toLowerCase().includes(E.toLowerCase())),U=(z==null?void 0:z.label)??((V=e[0])==null?void 0:V.label)??"",H=X=>{var ee;x(X),w(!1),(ee=v.current)==null||ee.focus()};return f.jsxs("div",{className:`option-picker relative inline-flex${o==="field"?" w-full":""}`,ref:y,children:[f.jsxs("button",{ref:v,type:"button",className:Ns(o==="field"?"inline-flex h-9 w-full items-center justify-between gap-2 rounded-md border border-border bg-background px-3 text-sm font-normal text-text transition-colors duration-120 ease-standard hover:bg-surface disabled:opacity-45":`inline-flex h-8 items-center rounded-md transition-[background,color] duration-150 ease-standard hover:bg-surface ${o==="pill"?"composer-pill gap-[5px] px-2 text-sm text-text whitespace-nowrap":"composer-bare gap-[3px] px-1 text-sm text-text"}`,S),title:l,"aria-haspopup":"menu","aria-expanded":b,disabled:a,onClick:()=>{N(""),w(X=>!X)},children:[f.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2",children:[z&&(d==null?void 0:d(z)),f.jsx("span",{className:"truncate",children:z?(p==null?void 0:p(z))??U:U})]}),f.jsx(qo,{size:12})]}),b&&f.jsxs("div",{ref:C,popover:m?"manual":void 0,style:m?{position:"fixed",inset:"auto",margin:0}:void 0,className:`option-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-95 flex flex-col bg-background border border-border rounded-lg shadow-menu z-50 overflow-hidden min-w-47.5 p-1.5 [&.align-right]:start-auto [&.align-right]:end-0 [&.drop-down]:bottom-auto [&.drop-down]:top-[calc(100%_+_4px)] [&.session-menu]:start-auto [&.session-menu]:end-1.5 [&.session-menu]:top-[calc(100%_-_2px)] [&.session-menu]:min-w-35 ${e.some(X=>X.description)?"min-w-80":""} ${o==="field"?"min-w-full text-text":""} ${s==="right"?"align-right":""} ${i?"drop-down":""}`,children:[r&&f.jsx("div",{className:lI,children:r}),_&&f.jsx("input",{autoFocus:!0,"aria-label":_,placeholder:_,value:E,onChange:X=>N(X.target.value),className:"shrink-0 border-b border-border bg-background px-2 py-2 text-sm outline-none"}),f.jsxs("div",{className:"min-h-0 overflow-y-auto",children:[I&&f.jsxs(f.Fragment,{children:[f.jsxs(ir,{type:"button",onClick:()=>H(I.id),children:[f.jsxs("span",{className:"inline-flex items-center gap-2",children:[d==null?void 0:d(I),f.jsxs("span",{children:[(p==null?void 0:p(I))??I.label,f.jsx("span",{className:"option-default text-muted font-normal",children:PD()})]})]}),T===I.id&&f.jsx(wa,{size:13})]}),f.jsx("div",{className:"option-sep h-px my-[5px] mx-1 bg-border-variant"})]}),$.map((X,ee)=>f.jsxs(ir,{type:"button",onClick:()=>H(X.id),children:[f.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[d==null?void 0:d(X),f.jsxs("span",{className:"flex min-w-0 flex-col items-start gap-0.5",children:[f.jsxs("span",{children:[(p==null?void 0:p(X))??X.label,!I&&X.id===t&&f.jsxs("span",{className:"option-default text-muted font-normal",children:[" ",FD()]})]}),X.description&&f.jsx("span",{className:"max-w-68 text-sm font-normal leading-snug text-muted",children:X.description})]})]}),T===X.id?f.jsx(wa,{size:13}):u&&f.jsx("span",{className:"option-num text-muted text-xs tabular-nums",children:ee+1})]},X.id))]})]})]})}const ugt=[];function e3({size:e=16,className:n}){return f.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor",className:n,"aria-hidden":"true",children:[f.jsx("path",{d:"M3.14573 5.14704C3.34064 4.95221 3.65776 4.95237 3.85277 5.14704L7.85277 9.14704L7.85374 9.14606C8.04873 9.34105 8.0487 9.65809 7.85374 9.8531L3.85374 13.8531C3.7558 13.951 3.62815 13.9995 3.50023 13.9996C3.37223 13.9996 3.24373 13.9501 3.14573 13.8531C2.95103 13.6581 2.95083 13.341 3.14573 13.1461L6.79222 9.50056L3.14573 5.85407C2.95104 5.65905 2.95084 5.34194 3.14573 5.14704Z"}),f.jsx("path",{d:"M12.1457 1.14704C12.3406 0.952206 12.6578 0.952371 12.8528 1.14704C13.0477 1.34202 13.0477 1.65907 12.8528 1.85407L9.20726 5.50056L12.8537 9.14704C13.0487 9.34202 13.0487 9.65907 12.8537 9.85407C12.7558 9.95101 12.6282 10.0005 12.5002 10.0006C12.3722 10.0006 12.2437 9.95207 12.1457 9.85407L8.14573 5.85407C7.95104 5.65905 7.95084 5.34194 8.14573 5.14704L12.1457 1.14704Z"})]})}function uv({runtime:e,corner:n=!1}){const[t,r]=R.useState(!1),[s,i]=R.useState(!1),[a,o]=R.useState(!1),[l,u]=R.useState(null),_=to();async function d(){if(l){o(!0);try{await $L(l),u(null)}catch(p){u(null),Vn(p instanceof Error?p.message:String(p),"error")}finally{o(!1)}}}return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:n?"fixed bottom-0 start-0 z-50":"relative shrink-0 rounded-b-lg border-t border-border bg-background",ref:_.ref,children:[_.open&&f.jsxs("div",{className:"option-menu absolute bottom-[calc(100%_+_6px)] start-2 z-50 min-w-60 rounded-lg border border-border bg-background p-1.5 shadow-menu",children:[f.jsxs("div",{className:"border-b border-border-variant px-2 pt-1 pb-2",children:[f.jsx("div",{className:"text-sm font-medium text-text",children:NMe({host:Ne(e.session.host),user:Ne(e.session.user??"")})}),f.jsxs("div",{className:"mt-0.5 text-xs text-subtext",children:["OpenResearch ",Ne(e.session.version??"…")]})]}),f.jsxs("div",{className:"flex items-center rounded-sm hover:bg-surface",children:[f.jsx(ir,{className:"hover:bg-transparent",disabled:t,onClick:async()=>{r(!0);try{await IL(),_.setOpen(!1)}catch(p){Vn(p instanceof Error?p.message:String(p),"error")}finally{r(!1)}},children:t?SMe():j4()}),f.jsx(w6,{content:eLe(),className:"me-2 shrink-0 text-subtext",children:f.jsx(R6,{size:15})})]}),f.jsx(ir,{danger:!0,disabled:s,onClick:async()=>{i(!0);try{u(await BL()),_.setOpen(!1)}catch(p){Vn(p instanceof Error?p.message:String(p),"error")}finally{i(!1)}},children:eL()})]}),n?f.jsxs(Le,{variant:"default",className:"h-auto w-auto max-w-48 justify-start rounded-none border-accent-blue bg-accent-blue px-2.5 py-1.5 font-normal text-white [&:hover:not(:disabled)]:border-accent-blue [&:hover:not(:disabled)]:bg-accent-blue/90","aria-haspopup":"menu","aria-expanded":_.open,onClick:()=>_.setOpen(p=>!p),children:[f.jsx(e3,{size:14,className:"shrink-0"}),f.jsx("span",{className:"min-w-0 truncate text-sm leading-tight",children:kx({host:Ne(e.session.host)})})]}):f.jsxs("div",{className:"flex items-center gap-1.5 py-2 ps-1 pe-2.5",children:[f.jsx(Yt,{size:"small","aria-label":kx({host:Ne(e.session.host)}),"aria-haspopup":"menu","aria-expanded":_.open,onClick:()=>_.setOpen(p=>!p),children:f.jsx(e3,{size:14,className:"shrink-0"})}),f.jsxs("span",{className:"flex min-w-0 flex-col gap-1 text-start text-text",children:[f.jsx("span",{className:"-my-0.5 max-w-full self-start truncate rounded-sm bg-accent-blue px-1.5 py-0.5 text-sm leading-tight text-white",children:kx({host:Ne(e.session.host)})}),f.jsxs("span",{className:"truncate text-xs leading-tight text-subtext",children:["OpenResearch ",Ne(e.session.version??"…")]})]})]})]}),l&&f.jsx(yO,{host:e.session.host,preview:l,currentClientAttached:e.session.status==="connected",stopping:a,onClose:()=>{a||u(null)},onConfirm:()=>void d()})]})}function P6(e=!0){var r;const n=sv(),t=ot({...n,enabled:e});return{status:t.data??null,error:((r=t.error)==null?void 0:r.message)??null,apply:s=>Gr(n.queryKey,s)}}const dgt=6e4,fgt=500;function cI(e){const[n,t]=R.useState(!1),[r,s]=R.useState(null),i=R.useRef(!1);R.useEffect(()=>(i.current=!1,()=>{i.current=!0}),[]);const a=e!=null&&e.restartRequired?e.instance:null;return{restarting:n,error:r,restart:()=>{if(!a||n)return;const l=sv(),u=()=>i.current||!Dn(l.queryKey);t(!0),s(null),(async()=>{try{if(await tdt(),u())return;const _=Date.now()+dgt;for(;Date.now()<_;){if(await new Promise(p=>setTimeout(p,fgt)),u())return;const d=await tt.fetchQuery({...l,staleTime:0}).catch(()=>null);if(u())return;if(d&&d.instance!==a){window.location.reload();return}}throw new Error(xlt())}catch(_){if(u())return;s(_ instanceof Error?_.message:String(_)),t(!1)}})()}}}function uI({status:e}){const[n,t]=R.useState(null),r=e!=null&&e.restartRequired?e.installedVersion:null,{restarting:s,error:i,restart:a}=cI(e);return!r||n===r?null:f.jsxs("div",{className:"update-banner flex items-center gap-2 shrink-0 py-1.5 px-3.5 text-sm text-text bg-surface border-b border-b-border",role:"status",children:[f.jsx(Ea,{size:13,className:`shrink-0 text-subtext${s?" animate-spin":""}`}),f.jsx("span",{className:"min-w-0",children:i?jL({error:i}):olt({version:Ne(r)})}),(e==null?void 0:e.canRestart)&&f.jsx(Le,{type:"button",size:"small",disabled:s,onClick:a,children:s?TL():zL()}),f.jsx(Yt,{type:"button",size:"small",className:"ms-auto","aria-label":dlt(),disabled:s,onClick:()=>t(r),children:f.jsx(qr,{size:13})})]})}function F6(){return f.jsx("div",{className:"flex flex-1 h-full items-center justify-center",children:f.jsx(Lt,{})})}function hgt(){return f.jsxs("div",{className:"flex flex-1 h-full flex-col items-center justify-center gap-3 text-subtext",children:[f.jsx("p",{children:Ka()}),f.jsx(Qv,{to:"/projects",children:ep()})]})}function H6({error:e,reset:n}){return f.jsxs("div",{className:"flex flex-1 h-full flex-col items-center justify-center gap-3 text-subtext",children:[f.jsx("p",{role:"alert",children:e.message}),f.jsx(Le,{onClick:n,children:Fi()}),f.jsx(Qv,{to:"/projects",children:ep()})]})}function dI({projectId:e}){const{queryClient:n}=K5({from:"__root__"}),t=Kv(),[r,s]=R.useState(null),[i,a]=R.useState(0);return R.useEffect(()=>{let o=!0;return s(null),(e?T0t(e,n):j0t(n)).then(l=>{o&&t({href:l,replace:!0})}).catch(l=>{o&&(wG(l)?a(u=>u+1):s(l instanceof Error?l:new Error(String(l))))}),()=>{o=!1}},[e,i,t,n]),r?f.jsx(H6,{error:r,reset:()=>a(o=>o+1)}):f.jsx(F6,{})}function _gt(){return f.jsx(dI,{})}function pgt({projectId:e}){return f.jsx(dI,{projectId:e})}function mgt(){const e=AO(),n=Kv(),t=rp(),r=ot(t),s=ot(Xp()),i=r.data,a=s.data,o=r.error??s.error,l=()=>{r.refetch(),s.refetch()},{status:u}=P6(e.kind==="local");R.useEffect(()=>{document.title="OpenResearch",a&&ab.queue({...E6()??a.workspace??{railOpen:!0,panelWidth:760,experimentsView:"table"},lastLocation:"/projects"})},[a]);const _=d=>void n({to:"/projects/$projectId",params:{projectId:d}});return f.jsxs("div",{className:"app flex flex-col h-full",children:[e.kind==="local"&&f.jsxs(f.Fragment,{children:[f.jsx(iI,{}),f.jsx(uI,{status:u})]}),o&&(!i||!a)?f.jsx(H6,{error:o,reset:l}):!i||!a?f.jsx(F6,{}):i.length===0&&!a.onboardingCompleted?f.jsx(Bmt,{preferredAgent:a.preferredAgent,onDone:d=>{z0t(),_(d.id)}}):f.jsx(igt,{remote:e.kind==="ssh",projects:i,onOpen:_,onCreated:(d,p)=>{p?(Vn(p,"error"),n({to:"/projects/$projectId/settings/$tab",params:{projectId:d.id,tab:"git"}})):_(d.id)},onDeleted:d=>Gr(t.queryKey,p=>p==null?void 0:p.filter(m=>m.id!==d))}),e.kind==="ssh"&&f.jsx(uv,{runtime:e,corner:!0})]})}const ggt=Fo()({component:_gt}),vgt=Fo()({component:X0}),bgt=Fo()({}),ygt=Fo()({component:mgt}),xgt=e=>({queryKey:Nt("getRunDiff",e),queryFn:({signal:n})=>Cut(e,n),staleTime:3e4}),fI=e=>({queryKey:Nt("getExperimentDiff",e),queryFn:({signal:n})=>Eut(e,n),staleTime:3e4}),dv=(e,n,t={})=>({queryKey:Nt("getProjectFile",e,n,{...t}),queryFn:({signal:r})=>Nut(e,n,t,r),staleTime:t.ref?Lh(t.ref)?1/0:3e4:1/0,refetchOnMount:t.ref?!0:"always",refetchOnWindowFocus:t.ref?!0:"always"}),hI=e=>({queryKey:Nt("getAbsoluteFile",e),queryFn:({signal:n})=>zut(e,n),staleTime:1/0,refetchOnMount:"always",refetchOnWindowFocus:"always"}),_I=(e,n={})=>({queryKey:Nt("getCodeTree",e,{...n}),queryFn:({signal:t})=>Vut(e,n,t),staleTime:n.ref&&Lh(n.ref)?1/0:3e4}),fv=e=>({queryKey:Nt("getSessionWorktree",e),queryFn:({signal:n})=>Kut(e,n),staleTime:3e4}),wgt=e=>({queryKey:Nt("getArtifacts",e),queryFn:({signal:n})=>Rdt(e,n),staleTime:3e4}),q6=(e,n)=>({queryKey:Nt("getArtifactFileText",e,n),queryFn:({signal:t})=>Odt(e,n,t),staleTime:1/0,refetchOnMount:"always",refetchOnWindowFocus:"always"}),pI=(e,n)=>({queryKey:Nt("getArtifactFileMetadata",e,n),queryFn:({signal:t})=>Bdt(e,n,t),staleTime:2e3}),Sgt=()=>({queryKey:Nt("getLatexEngine"),queryFn:({signal:e})=>Mut(e),staleTime:3e5}),kgt=()=>({queryKey:Nt("getOverleafSettings"),queryFn:({signal:e})=>Lut(e),staleTime:3e5}),Cgt=(e,n,t={})=>({queryKey:Nt("getOverleafState",e,n,{...t}),queryFn:({signal:r})=>Fut(e,n,t,r),staleTime:3e5}),Egt=(e,n,t={})=>({queryKey:Nt("getOverleafStatus",e,n,{...t}),queryFn:({signal:r})=>Gut(e,n,t,r),staleTime:3e4}),mI=(e,n,t,r,s)=>({queryKey:Nt("resolvedFile",e,n,t,r??null,s??null),staleTime:s&&!Lh(s)?3e4:1/0,refetchOnMount:s?!0:"always",refetchOnWindowFocus:s?!0:"always",queryFn:async({signal:i,client:a})=>{const o=async m=>{i.throwIfAborted();const x=await a.fetchQuery({...m,staleTime:s?m.staleTime:0});return i.throwIfAborted(),x},l=t==="abs",u=t==="artifacts",_=async()=>{const m=await o(pI(e,n)),x=(m==null?void 0:m.presentation)==="text"||(m==null?void 0:m.presentation)==="unknown",S=m&&x?await o(q6(e,n)):null,v=m===null||x&&S===null;return{path:n,content:(S==null?void 0:S.content)??"",truncated:(S==null?void 0:S.truncated)??!1,binary:(S==null?void 0:S.binary)??(m==null?void 0:m.presentation)==="download",notFound:v,presentation:S?S.binary?"download":"text":(m==null?void 0:m.presentation)??"download"}},d=async()=>{for(const m of[`artifacts/${n}`,n]){const x=await o(dv(e,m,{sessionId:r})).catch(()=>(i.throwIfAborted(),null));if(x&&!x.notFound)return x}return null},p=await(l?o(hI(n)).then(m=>({source:"absolute",file:m})):u?_().then(async m=>{if(!m.notFound)return{source:"artifact",file:m};const x=await d();return x?{source:"checkout",file:x}:{source:"artifact",file:m}}):o(dv(e,n,{sessionId:r,ref:s})).then(m=>m.notFound&&!s?_().then(x=>x.notFound?{source:"checkout",file:m}:{source:"artifact",file:x,checkoutRoot:m.root}):{source:"checkout",file:m}));return i.throwIfAborted(),p}});async function Ngt(e,n,t,r,s){if(Lh(s))return;const i=mI(e,n,t,r,s),a=[i.queryKey,...t==="abs"?[hI(n).queryKey]:[dv(e,n,{sessionId:r,ref:s}).queryKey,dv(e,`artifacts/${n}`,{sessionId:r}).queryKey,q6(e,n).queryKey,pI(e,n).queryKey]];await Promise.all(a.map(o=>tt.cancelQueries({queryKey:o,exact:!0}))),await Promise.all(a.map(o=>tt.invalidateQueries({queryKey:o,exact:!0,refetchType:"none"}))),await tt.invalidateQueries({queryKey:i.queryKey,exact:!0})}function zgt(e,n,t){return t?n.flatMap(r=>{if(r.status!=="starting"&&r.status!=="running")return[];const s=e.find(i=>i.id===r.experimentId&&i.chatSessionId===t);return s?[{experiment:s,run:r}]:[]}):[]}const Cz={done:{tone:"success",live:!1},failed:{tone:"danger",live:!1},running:{tone:"info",live:!0},starting:{tone:"warning",live:!0},cancelling:{tone:"caution",live:!0},cancelled:{tone:"caution",live:!1},editing:{tone:"accent",live:!0},idle:{tone:"neutral",live:!1}};function jgt(e){return Cz[e]??Cz.idle}const Tgt={done:Cst,failed:Mst,running:Fst,starting:Gst,cancelling:xst,cancelled:gst,editing:jst,idle:Ist};function U6(e){const n=Tgt[e];return n?n():e.charAt(0).toUpperCase()+e.slice(1)}function Il({status:e,label:n,className:t}){const r=jgt(e);return f.jsx(rb,{tone:r.tone,live:r.live,className:t,children:n??U6(e)})}const Rd={local:TD,tinker:Yme,hf:bme,modal:Tme,k8s:Sme,ssh:Wme,slurm:Hme,ray:Bme,openresearch:Dme};function Ez(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),t.push.apply(t,r)}return t}function Ln(e){for(var n=1;n=0||(_[l]=a[l]);return _})(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(s[t]=e[t])}return s}function En(e,n){return vI(e)||(function(t,r){var s=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(s!=null){var i,a,o,l,u=[],_=!0,d=!1;try{if(o=(s=s.call(t)).next,r===0){if(Object(s)!==s)return;_=!1}else for(;!(_=(i=o.call(s)).done)&&(u.push(i.value),u.length!==r);_=!0);}catch(p){d=!0,a=p}finally{try{if(!_&&s.return!=null&&(l=s.return(),Object(l)!==l))return}finally{if(d)throw a}}return u}})(e,n)||hb(e,n)||yI()}function gI(e){return vI(e)||bI(e)||hb(e)||yI()}function qi(e){return(function(n){if(Array.isArray(n))return n3(n)})(e)||bI(e)||hb(e)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function vI(e){if(Array.isArray(e))return e}function bI(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function hb(e,n){if(e){if(typeof e=="string")return n3(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n3(e,n):void 0}}function n3(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,a=!0,o=!1;return{s:function(){t=t.call(e)},n:function(){var l=t.next();return a=l.done,l},e:function(l){o=!0,i=l},f:function(){try{a||t.return==null||t.return()}finally{if(o)throw i}}}}var $g=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nm(e,n){return e(n={exports:{}},n.exports),n.exports}var Pi=nm((function(e){/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(){var n={}.hasOwnProperty;function t(){for(var r=[],s=0;s-1?b.slice(0,y):C;switch(C){case"diff":S--;break e;case"deleted":case"new":var E=b.slice(y+1);E.indexOf("file mode")===0&&(a[C==="new"?"newMode":"oldMode"]=E.slice(10));break;case"similarity":a.similarity=parseInt(b.split(" ")[2],10);break;case"index":var N=b.slice(y+1).split(" "),T=N[0].split("..");a.oldRevision=T[0],a.newRevision=T[1],N[1]&&(a.oldMode=a.newMode=N[1]);break;case"copy":case"rename":var z=b.slice(y+1);z.indexOf("from")===0?a.oldPath=z.slice(5):a.newPath=z.slice(3),w=C;break;case"---":var M=b.slice(y+1),O=m[++S].slice(4);M==="/dev/null"?(O=O.slice(2),w="add"):O==="/dev/null"?(M=M.slice(2),w="delete"):(w="modify",M=M.slice(2),O=O.slice(2)),M&&(a.oldPath=M),O&&(a.newPath=O),p=5;break e}}a.type=w||"modify"}else if(v.indexOf("Binary")===0)a.isBinary=!0,a.type=v.indexOf("/dev/null and")>=0?"add":v.indexOf("and /dev/null")>=0?"delete":"modify",p=2,a=null;else if(p===5)if(v.indexOf("@@")===0){var B=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(v);o={content:v,oldStart:B[1]-0,newStart:B[4]-0,oldLines:B[3]-0||1,newLines:B[6]-0||1,changes:[]},a.hunks.push(o),l=o.oldStart,u=o.newStart}else{var $=v.slice(0,1),U={content:v.slice(1)};switch($){case"+":U.type="insert",U.isInsert=!0,U.lineNumber=u,u++;break;case"-":U.type="delete",U.isDelete=!0,U.lineNumber=l,l++;break;case" ":U.type="normal",U.isNormal=!0,U.oldLineNumber=l,U.newLineNumber=u,l++,u++;break;case"\\":var H=o.changes[o.changes.length-1];H.isDelete||(a.newEndingNewLine=!1),H.isInsert||(a.oldEndingNewLine=!1)}U.type&&o.changes.push(U)}S++}return d}};e.exports=s})()}));function Su(e){return e.type==="insert"}function Vi(e){return e.type==="delete"}function Hl(e){return e.type==="normal"}function Dgt(e,n){var t=n.nearbySequences==="zip"?(function(r){var s=r.reduce((function(i,a,o){var l=kn(i,3),u=l[0],_=l[1],d=l[2];return _?Su(a)&&d>=0?(u.splice(d+1,0,a),[u,a,d+2]):(u.push(a),[u,a,Vi(a)&&Vi(_)?d:o]):(u.push(a),[u,a,Vi(a)?o:-1])}),[[],null,-1]);return kn(s,1)[0]})(e.changes):e.changes;return Fn(Fn({},e),{},{isPlain:!1,changes:t})}function r3(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=(function(r){if(r.startsWith("diff --git"))return r;var s=r.indexOf(` +*/(function(){var n={}.hasOwnProperty;function t(){for(var r=[],s=0;s-1?b.slice(0,y):C;switch(C){case"diff":S--;break e;case"deleted":case"new":var E=b.slice(y+1);E.indexOf("file mode")===0&&(a[C==="new"?"newMode":"oldMode"]=E.slice(10));break;case"similarity":a.similarity=parseInt(b.split(" ")[2],10);break;case"index":var N=b.slice(y+1).split(" "),T=N[0].split("..");a.oldRevision=T[0],a.newRevision=T[1],N[1]&&(a.oldMode=a.newMode=N[1]);break;case"copy":case"rename":var z=b.slice(y+1);z.indexOf("from")===0?a.oldPath=z.slice(5):a.newPath=z.slice(3),w=C;break;case"---":var M=b.slice(y+1),I=m[++S].slice(4);M==="/dev/null"?(I=I.slice(2),w="add"):I==="/dev/null"?(M=M.slice(2),w="delete"):(w="modify",M=M.slice(2),I=I.slice(2)),M&&(a.oldPath=M),I&&(a.newPath=I),p=5;break e}}a.type=w||"modify"}else if(v.indexOf("Binary")===0)a.isBinary=!0,a.type=v.indexOf("/dev/null and")>=0?"add":v.indexOf("and /dev/null")>=0?"delete":"modify",p=2,a=null;else if(p===5)if(v.indexOf("@@")===0){var B=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(v);o={content:v,oldStart:B[1]-0,newStart:B[4]-0,oldLines:B[3]-0||1,newLines:B[6]-0||1,changes:[]},a.hunks.push(o),l=o.oldStart,u=o.newStart}else{var $=v.slice(0,1),U={content:v.slice(1)};switch($){case"+":U.type="insert",U.isInsert=!0,U.lineNumber=u,u++;break;case"-":U.type="delete",U.isDelete=!0,U.lineNumber=l,l++;break;case" ":U.type="normal",U.isNormal=!0,U.oldLineNumber=l,U.newLineNumber=u,l++,u++;break;case"\\":var H=o.changes[o.changes.length-1];H.isDelete||(a.newEndingNewLine=!1),H.isInsert||(a.oldEndingNewLine=!1)}U.type&&o.changes.push(U)}S++}return d}};e.exports=s})()}));function _u(e){return e.type==="insert"}function Ui(e){return e.type==="delete"}function Pl(e){return e.type==="normal"}function Dgt(e,n){var t=n.nearbySequences==="zip"?(function(r){var s=r.reduce((function(i,a,o){var l=En(i,3),u=l[0],_=l[1],d=l[2];return _?_u(a)&&d>=0?(u.splice(d+1,0,a),[u,a,d+2]):(u.push(a),[u,a,Ui(a)&&Ui(_)?d:o]):(u.push(a),[u,a,Ui(a)?o:-1])}),[[],null,-1]);return En(s,1)[0]})(e.changes):e.changes;return Ln(Ln({},e),{},{isPlain:!1,changes:t})}function r3(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=(function(r){if(r.startsWith("diff --git"))return r;var s=r.indexOf(` `),i=r.indexOf(` `,s+1),a=r.slice(0,s),o=r.slice(s+1,i),l=a.split(" ").slice(1,-3).join(" "),u=o.split(" ").slice(1,-3).join(" ");return["diff --git a/".concat(l," b/").concat(u),"index 1111111..2222222 100644","--- a/".concat(l),"+++ b/".concat(u),r.slice(i+1)].join(` -`)})(e.trimStart());return Mgt.parse(t).map((function(r){return(function(s,i){var a=s.hunks.map((function(o){return Dgt(o,i)}));return Fn(Fn({},s),{},{hunks:a})})(r,n)}))}function Lgt(e){return e[0]}function Ogt(e){return e[e.length-1]}function s3(e){return["".concat(e,"Start"),"".concat(e,"Lines")]}function cp(e){return e==="old"?function(n){return Su(n)?-1:Hl(n)?n.oldLineNumber:n.lineNumber}:function(n){return Vi(n)?-1:Hl(n)?n.newLineNumber:n.lineNumber}}function wI(e,n){return function(t,r){var s=t[e],i=s+t[n];return r>=s&&r=i&&s-1},Ugt=function(e,n){var t=this.__data__,r=pb(t,e);return r<0?(++this.size,t.push([e,n])):t[r][1]=n,this};function Xf(e){var n=-1,t=e==null?0:e.length;for(this.clear();++no))return!1;var u=i.get(e),_=i.get(n);if(u&&_)return u==n&&_==e;var d=-1,p=!0,m=2&t?new N1t:void 0;for(i.set(e,n),i.set(n,e);++d-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},vr={};vr["[object Float32Array]"]=vr["[object Float64Array]"]=vr["[object Int8Array]"]=vr["[object Int16Array]"]=vr["[object Int32Array]"]=vr["[object Uint8Array]"]=vr["[object Uint8ClampedArray]"]=vr["[object Uint16Array]"]=vr["[object Uint32Array]"]=!0,vr["[object Arguments]"]=vr["[object Array]"]=vr["[object ArrayBuffer]"]=vr["[object Boolean]"]=vr["[object DataView]"]=vr["[object Date]"]=vr["[object Error]"]=vr["[object Function]"]=vr["[object Map]"]=vr["[object Number]"]=vr["[object Object]"]=vr["[object RegExp]"]=vr["[object Set]"]=vr["[object String]"]=vr["[object WeakMap]"]=!1;var q1t=function(e){return Uh(e)&&V6(e.length)&&!!vr[d_(e)]},U1t=function(e){return function(n){return e(n)}},Dz=nm((function(e,n){var t=n&&!n.nodeType&&n,r=t&&e&&!e.nodeType&&e,s=r&&r.exports===t&&CI.process,i=(function(){try{var a=r&&r.require&&r.require("util").types;return a||s&&s.binding&&s.binding("util")}catch{}})();e.exports=i})),Lz=Dz&&Dz.isTypedArray,K6=Lz?U1t(Lz):q1t,G1t=Object.prototype.hasOwnProperty,W1t=function(e,n){var t=Xi(e),r=!t&&bb(e),s=!t&&!r&&hv(e),i=!t&&!r&&!s&&K6(e),a=t||r||s||i,o=a?B1t(e.length,String):[],l=o.length;for(var u in e)!G1t.call(e,u)||a&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||AI(u,l))||o.push(u);return o},V1t=Object.prototype,RI=function(e){var n=e&&e.constructor;return e===(typeof n=="function"&&n.prototype||V1t)},K1t=(function(e,n){return function(t){return e(n(t))}})(Object.keys,Object),Q1t=Object.prototype.hasOwnProperty,MI=function(e){if(!RI(e))return K1t(e);var n=[];for(var t in Object(e))Q1t.call(e,t)&&t!="constructor"&&n.push(t);return n},yb=function(e){return e!=null&&V6(e.length)&&!NI(e)},Q6=function(e){return yb(e)?W1t(e):MI(e)},Oz=function(e){return M1t(e,Q6,I1t)},Y1t=Object.prototype.hasOwnProperty,X1t=function(e,n,t,r,s,i){var a=1&t,o=Oz(e),l=o.length;if(l!=Oz(n).length&&!a)return!1;for(var u=l;u--;){var _=o[u];if(!(a?_ in n:Y1t.call(n,_)))return!1}var d=i.get(e),p=i.get(n);if(d&&p)return d==n&&p==e;var m=!0;i.set(e,n),i.set(n,e);for(var x=a;++u1)return!1;if(e.length===1){var n=kn(e,1)[0];return n.type==="text"&&!n.value}return!0}function $vt(e){var n=e.changeKey,t=e.text,r=e.tokens,s=e.renderToken,i=hu(e,Ivt),a=s?function(o,l){return s(o,Fz,l)}:Fz;return f.jsx("td",Fn(Fn({},i),{},{"data-change-key":n,children:r?Bvt(r)?" ":r.map(a):t||" "}))}var FI=R.memo($vt);function HI(e,n){return function(){var t=n==="old"?Cb(e):Eb(e);return t===-1?void 0:t}}function qI(e,n){return function(t){return e&&t?f.jsx("a",{href:n?"#"+n:void 0,children:t}):t}}function _v(e,n){return n?function(t){e(),n(t)}:e}function Hz(e,n,t,r){return R.useMemo((function(){var s=PI(e,(function(i){return function(a){return i&&i(n,a)}}));return s.onMouseEnter=_v(t,s.onMouseEnter),s.onMouseLeave=_v(r,s.onMouseLeave),s}),[e,t,r,n])}function qz(e,n,t,r,s,i,a,o,l){var u={change:n,side:r,inHoverState:o,renderDefault:HI(n,r),wrapInAnchor:qI(s,i)};return f.jsx("td",Fn(Fn({className:e},a),{},{"data-change-key":t,children:l(u)}))}function Pvt(e){var n,t,r,s=e.change,i=e.selected,a=e.tokens,o=e.className,l=e.generateLineClassName,u=e.gutterClassName,_=e.codeClassName,d=e.gutterEvents,p=e.codeEvents,m=e.hideGutter,x=e.gutterAnchor,S=e.generateAnchorID,v=e.renderToken,b=e.renderGutter,w=s.type,y=s.content,C=cu(s),E=(n=kn(R.useState(!1),2),t=n[0],r=n[1],[t,R.useCallback((function(){return r(!0)}),[]),R.useCallback((function(){return r(!1)}),[])]),N=kn(E,3),T=N[0],z=N[1],M=N[2],O=R.useMemo((function(){return{change:s}}),[s]),B=Hz(d,O,z,M),$=Hz(p,O,z,M),U=S(s),H=l({changes:[s],defaultGenerate:function(){return o}}),Y=qi("diff-gutter","diff-gutter-".concat(w),u,{"diff-gutter-selected":i}),V=qi("diff-code","diff-code-".concat(w),_,{"diff-code-selected":i});return f.jsxs("tr",{id:U,className:qi("diff-line",H),children:[!m&&qz(Y,s,C,"old",x,U,B,T,b),!m&&qz(Y,s,C,"new",x,U,B,T,b),f.jsx(FI,Fn({className:V,changeKey:C,text:y,tokens:a,renderToken:v},$))]})}var Fvt=R.memo(Pvt);function Hvt(e){var n=e.hideGutter,t=e.element;return f.jsx("tr",{className:"diff-widget",children:f.jsx("td",{colSpan:n?1:3,className:"diff-widget-content",children:t})})}var qvt=["hideGutter","selectedChanges","tokens","lineClassName"],Uvt=["hunk","widgets","className"];function Gvt(e){var n=e.hunk,t=e.widgets,r=e.className,s=hu(e,Uvt),i=(function(a,o){return a.reduce((function(l,u){var _=cu(u);l.push(["change",_,u]);var d=o[_];return d&&l.push(["widget",_,d]),l}),[])})(n.changes,t);return f.jsx("tbody",{className:qi("diff-hunk",r),children:i.map((function(a){return(function(o,l){var u=kn(o,3),_=u[0],d=u[1],p=u[2],m=l.hideGutter,x=l.selectedChanges,S=l.tokens,v=l.lineClassName,b=hu(l,qvt);if(_==="change"){var w=Vi(p)?"old":"new",y=Vi(p)?Cb(p):Eb(p),C=S?S[w][y-1]:null;return f.jsx(Fvt,Fn({className:v,change:p,hideGutter:m,selected:x.includes(d),tokens:C},b),"change".concat(d))}return _==="widget"?f.jsx(Hvt,{hideGutter:m,element:p},"widget".concat(d)):null})(a,s)}))})}var UI=0;function Fg(e,n,t,r){var s=R.useCallback((function(){return n(e)}),[e,n]),i=R.useCallback((function(){return n("")}),[n]);return R.useMemo((function(){var a=PI(r,(function(o){return function(l){return o&&o({side:e,change:t},l)}}));return a.onMouseEnter=_v(s,a.onMouseEnter),a.onMouseLeave=_v(i,a.onMouseLeave),a}),[t,r,s,e,i])}function $x(e){var n=e.change,t=e.side,r=e.selected,s=e.tokens,i=e.gutterClassName,a=e.codeClassName,o=e.gutterEvents,l=e.codeEvents,u=e.anchorID,_=e.gutterAnchor,d=e.gutterAnchorTarget,p=e.hideGutter,m=e.hover,x=e.renderToken,S=e.renderGutter;if(!n){var v=qi("diff-gutter","diff-gutter-omit",i),b=qi("diff-code","diff-code-omit",a);return[!p&&f.jsx("td",{className:v},"gutter"),f.jsx("td",{className:b},"code")]}var w=n.type,y=n.content,C=cu(n),E=t===UI?"old":"new",N=Fn({id:u||void 0,className:qi("diff-gutter","diff-gutter-".concat(w),t3({"diff-gutter-selected":r},"diff-line-hover-"+E,m),i),children:S({change:n,side:E,inHoverState:m,renderDefault:HI(n,E),wrapInAnchor:qI(_,d)})},o),T=qi("diff-code","diff-code-".concat(w),t3({"diff-code-selected":r},"diff-line-hover-"+E,m),a);return[!p&&f.jsx("td",Fn(Fn({},N),{},{"data-change-key":C}),"gutter"),f.jsx(FI,Fn({className:T,changeKey:C,text:y,tokens:s,renderToken:x},l),"code")]}function Wvt(e){var n=e.className,t=e.oldChange,r=e.newChange,s=e.oldSelected,i=e.newSelected,a=e.oldTokens,o=e.newTokens,l=e.monotonous,u=e.gutterClassName,_=e.codeClassName,d=e.gutterEvents,p=e.codeEvents,m=e.hideGutter,x=e.generateAnchorID,S=e.generateLineClassName,v=e.gutterAnchor,b=e.renderToken,w=e.renderGutter,y=kn(R.useState(""),2),C=y[0],E=y[1],N=Fg("old",E,t,d),T=Fg("new",E,r,d),z=Fg("old",E,t,p),M=Fg("new",E,r,p),O=t&&x(t),B=r&&x(r),$=S({changes:[t,r],defaultGenerate:function(){return n}}),U={monotonous:l,hideGutter:m,gutterClassName:u,codeClassName:_,gutterEvents:d,codeEvents:p,renderToken:b,renderGutter:w},H=Fn(Fn({},U),{},{change:t,side:UI,selected:s,tokens:a,gutterEvents:N,codeEvents:z,anchorID:O,gutterAnchor:v,gutterAnchorTarget:O,hover:C==="old"}),Y=Fn(Fn({},U),{},{change:r,side:1,selected:i,tokens:o,gutterEvents:T,codeEvents:M,anchorID:t===r?null:B,gutterAnchor:v,gutterAnchorTarget:t===r?O:B,hover:C==="new"});if(l)return f.jsx("tr",{className:qi("diff-line",$),children:$x(t?H:Y)});var V=(function(X,te){return X&&!te?"diff-line-old-only":!X&&te?"diff-line-new-only":X===te?"diff-line-normal":"diff-line-compare"})(t,r);return f.jsxs("tr",{className:qi("diff-line",V,$),children:[$x(H),$x(Y)]})}var Vvt=R.memo(Wvt);function Kvt(e){var n=e.hideGutter,t=e.oldElement,r=e.newElement;return e.monotonous?f.jsx("tr",{className:"diff-widget",children:f.jsx("td",{colSpan:n?1:2,className:"diff-widget-content",children:t||r})}):t===r?f.jsx("tr",{className:"diff-widget",children:f.jsx("td",{colSpan:n?2:4,className:"diff-widget-content",children:t})}):f.jsxs("tr",{className:"diff-widget",children:[f.jsx("td",{colSpan:n?1:2,className:"diff-widget-content",children:t}),f.jsx("td",{colSpan:n?1:2,className:"diff-widget-content",children:r})]})}var Qvt=["selectedChanges","monotonous","hideGutter","tokens","lineClassName"],Yvt=["hunk","widgets","className"];function Hg(e,n){return(e?cu(e):"00")+(n?cu(n):"00")}function Xvt(e){var n=e.hunk,t=e.widgets,r=e.className,s=hu(e,Yvt),i=(function(a,o){for(var l=function(b){if(!b)return null;var w=cu(b);return o[w]||null},u=[],_=0;_=s&&r=i&&s-1},Ugt=function(e,n){var t=this.__data__,r=_b(t,e);return r<0?(++this.size,t.push([e,n])):t[r][1]=n,this};function Vf(e){var n=-1,t=e==null?0:e.length;for(this.clear();++no))return!1;var u=i.get(e),_=i.get(n);if(u&&_)return u==n&&_==e;var d=-1,p=!0,m=2&t?new N1t:void 0;for(i.set(e,n),i.set(n,e);++d-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},pr={};pr["[object Float32Array]"]=pr["[object Float64Array]"]=pr["[object Int8Array]"]=pr["[object Int16Array]"]=pr["[object Int32Array]"]=pr["[object Uint8Array]"]=pr["[object Uint8ClampedArray]"]=pr["[object Uint16Array]"]=pr["[object Uint32Array]"]=!0,pr["[object Arguments]"]=pr["[object Array]"]=pr["[object ArrayBuffer]"]=pr["[object Boolean]"]=pr["[object DataView]"]=pr["[object Date]"]=pr["[object Error]"]=pr["[object Function]"]=pr["[object Map]"]=pr["[object Number]"]=pr["[object Object]"]=pr["[object RegExp]"]=pr["[object Set]"]=pr["[object String]"]=pr["[object WeakMap]"]=!1;var q1t=function(e){return Ph(e)&&V6(e.length)&&!!pr[o_(e)]},U1t=function(e){return function(n){return e(n)}},Dz=nm((function(e,n){var t=n&&!n.nodeType&&n,r=t&&e&&!e.nodeType&&e,s=r&&r.exports===t&&CI.process,i=(function(){try{var a=r&&r.require&&r.require("util").types;return a||s&&s.binding&&s.binding("util")}catch{}})();e.exports=i})),Lz=Dz&&Dz.isTypedArray,K6=Lz?U1t(Lz):q1t,G1t=Object.prototype.hasOwnProperty,W1t=function(e,n){var t=Ki(e),r=!t&&vb(e),s=!t&&!r&&hv(e),i=!t&&!r&&!s&&K6(e),a=t||r||s||i,o=a?B1t(e.length,String):[],l=o.length;for(var u in e)!G1t.call(e,u)||a&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||AI(u,l))||o.push(u);return o},V1t=Object.prototype,RI=function(e){var n=e&&e.constructor;return e===(typeof n=="function"&&n.prototype||V1t)},K1t=(function(e,n){return function(t){return e(n(t))}})(Object.keys,Object),Q1t=Object.prototype.hasOwnProperty,MI=function(e){if(!RI(e))return K1t(e);var n=[];for(var t in Object(e))Q1t.call(e,t)&&t!="constructor"&&n.push(t);return n},bb=function(e){return e!=null&&V6(e.length)&&!NI(e)},Q6=function(e){return bb(e)?W1t(e):MI(e)},Oz=function(e){return M1t(e,Q6,I1t)},Y1t=Object.prototype.hasOwnProperty,X1t=function(e,n,t,r,s,i){var a=1&t,o=Oz(e),l=o.length;if(l!=Oz(n).length&&!a)return!1;for(var u=l;u--;){var _=o[u];if(!(a?_ in n:Y1t.call(n,_)))return!1}var d=i.get(e),p=i.get(n);if(d&&p)return d==n&&p==e;var m=!0;i.set(e,n),i.set(n,e);for(var x=a;++u1)return!1;if(e.length===1){var n=En(e,1)[0];return n.type==="text"&&!n.value}return!0}function $vt(e){var n=e.changeKey,t=e.text,r=e.tokens,s=e.renderToken,i=su(e,Ivt),a=s?function(o,l){return s(o,Fz,l)}:Fz;return f.jsx("td",Ln(Ln({},i),{},{"data-change-key":n,children:r?Bvt(r)?" ":r.map(a):t||" "}))}var FI=R.memo($vt);function HI(e,n){return function(){var t=n==="old"?kb(e):Cb(e);return t===-1?void 0:t}}function qI(e,n){return function(t){return e&&t?f.jsx("a",{href:n?"#"+n:void 0,children:t}):t}}function _v(e,n){return n?function(t){e(),n(t)}:e}function Hz(e,n,t,r){return R.useMemo((function(){var s=PI(e,(function(i){return function(a){return i&&i(n,a)}}));return s.onMouseEnter=_v(t,s.onMouseEnter),s.onMouseLeave=_v(r,s.onMouseLeave),s}),[e,t,r,n])}function qz(e,n,t,r,s,i,a,o,l){var u={change:n,side:r,inHoverState:o,renderDefault:HI(n,r),wrapInAnchor:qI(s,i)};return f.jsx("td",Ln(Ln({className:e},a),{},{"data-change-key":t,children:l(u)}))}function Pvt(e){var n,t,r,s=e.change,i=e.selected,a=e.tokens,o=e.className,l=e.generateLineClassName,u=e.gutterClassName,_=e.codeClassName,d=e.gutterEvents,p=e.codeEvents,m=e.hideGutter,x=e.gutterAnchor,S=e.generateAnchorID,v=e.renderToken,b=e.renderGutter,w=s.type,y=s.content,C=eu(s),E=(n=En(R.useState(!1),2),t=n[0],r=n[1],[t,R.useCallback((function(){return r(!0)}),[]),R.useCallback((function(){return r(!1)}),[])]),N=En(E,3),T=N[0],z=N[1],M=N[2],I=R.useMemo((function(){return{change:s}}),[s]),B=Hz(d,I,z,M),$=Hz(p,I,z,M),U=S(s),H=l({changes:[s],defaultGenerate:function(){return o}}),Y=Pi("diff-gutter","diff-gutter-".concat(w),u,{"diff-gutter-selected":i}),V=Pi("diff-code","diff-code-".concat(w),_,{"diff-code-selected":i});return f.jsxs("tr",{id:U,className:Pi("diff-line",H),children:[!m&&qz(Y,s,C,"old",x,U,B,T,b),!m&&qz(Y,s,C,"new",x,U,B,T,b),f.jsx(FI,Ln({className:V,changeKey:C,text:y,tokens:a,renderToken:v},$))]})}var Fvt=R.memo(Pvt);function Hvt(e){var n=e.hideGutter,t=e.element;return f.jsx("tr",{className:"diff-widget",children:f.jsx("td",{colSpan:n?1:3,className:"diff-widget-content",children:t})})}var qvt=["hideGutter","selectedChanges","tokens","lineClassName"],Uvt=["hunk","widgets","className"];function Gvt(e){var n=e.hunk,t=e.widgets,r=e.className,s=su(e,Uvt),i=(function(a,o){return a.reduce((function(l,u){var _=eu(u);l.push(["change",_,u]);var d=o[_];return d&&l.push(["widget",_,d]),l}),[])})(n.changes,t);return f.jsx("tbody",{className:Pi("diff-hunk",r),children:i.map((function(a){return(function(o,l){var u=En(o,3),_=u[0],d=u[1],p=u[2],m=l.hideGutter,x=l.selectedChanges,S=l.tokens,v=l.lineClassName,b=su(l,qvt);if(_==="change"){var w=Ui(p)?"old":"new",y=Ui(p)?kb(p):Cb(p),C=S?S[w][y-1]:null;return f.jsx(Fvt,Ln({className:v,change:p,hideGutter:m,selected:x.includes(d),tokens:C},b),"change".concat(d))}return _==="widget"?f.jsx(Hvt,{hideGutter:m,element:p},"widget".concat(d)):null})(a,s)}))})}var UI=0;function Fg(e,n,t,r){var s=R.useCallback((function(){return n(e)}),[e,n]),i=R.useCallback((function(){return n("")}),[n]);return R.useMemo((function(){var a=PI(r,(function(o){return function(l){return o&&o({side:e,change:t},l)}}));return a.onMouseEnter=_v(s,a.onMouseEnter),a.onMouseLeave=_v(i,a.onMouseLeave),a}),[t,r,s,e,i])}function $x(e){var n=e.change,t=e.side,r=e.selected,s=e.tokens,i=e.gutterClassName,a=e.codeClassName,o=e.gutterEvents,l=e.codeEvents,u=e.anchorID,_=e.gutterAnchor,d=e.gutterAnchorTarget,p=e.hideGutter,m=e.hover,x=e.renderToken,S=e.renderGutter;if(!n){var v=Pi("diff-gutter","diff-gutter-omit",i),b=Pi("diff-code","diff-code-omit",a);return[!p&&f.jsx("td",{className:v},"gutter"),f.jsx("td",{className:b},"code")]}var w=n.type,y=n.content,C=eu(n),E=t===UI?"old":"new",N=Ln({id:u||void 0,className:Pi("diff-gutter","diff-gutter-".concat(w),t3({"diff-gutter-selected":r},"diff-line-hover-"+E,m),i),children:S({change:n,side:E,inHoverState:m,renderDefault:HI(n,E),wrapInAnchor:qI(_,d)})},o),T=Pi("diff-code","diff-code-".concat(w),t3({"diff-code-selected":r},"diff-line-hover-"+E,m),a);return[!p&&f.jsx("td",Ln(Ln({},N),{},{"data-change-key":C}),"gutter"),f.jsx(FI,Ln({className:T,changeKey:C,text:y,tokens:s,renderToken:x},l),"code")]}function Wvt(e){var n=e.className,t=e.oldChange,r=e.newChange,s=e.oldSelected,i=e.newSelected,a=e.oldTokens,o=e.newTokens,l=e.monotonous,u=e.gutterClassName,_=e.codeClassName,d=e.gutterEvents,p=e.codeEvents,m=e.hideGutter,x=e.generateAnchorID,S=e.generateLineClassName,v=e.gutterAnchor,b=e.renderToken,w=e.renderGutter,y=En(R.useState(""),2),C=y[0],E=y[1],N=Fg("old",E,t,d),T=Fg("new",E,r,d),z=Fg("old",E,t,p),M=Fg("new",E,r,p),I=t&&x(t),B=r&&x(r),$=S({changes:[t,r],defaultGenerate:function(){return n}}),U={monotonous:l,hideGutter:m,gutterClassName:u,codeClassName:_,gutterEvents:d,codeEvents:p,renderToken:b,renderGutter:w},H=Ln(Ln({},U),{},{change:t,side:UI,selected:s,tokens:a,gutterEvents:N,codeEvents:z,anchorID:I,gutterAnchor:v,gutterAnchorTarget:I,hover:C==="old"}),Y=Ln(Ln({},U),{},{change:r,side:1,selected:i,tokens:o,gutterEvents:T,codeEvents:M,anchorID:t===r?null:B,gutterAnchor:v,gutterAnchorTarget:t===r?I:B,hover:C==="new"});if(l)return f.jsx("tr",{className:Pi("diff-line",$),children:$x(t?H:Y)});var V=(function(X,ee){return X&&!ee?"diff-line-old-only":!X&&ee?"diff-line-new-only":X===ee?"diff-line-normal":"diff-line-compare"})(t,r);return f.jsxs("tr",{className:Pi("diff-line",V,$),children:[$x(H),$x(Y)]})}var Vvt=R.memo(Wvt);function Kvt(e){var n=e.hideGutter,t=e.oldElement,r=e.newElement;return e.monotonous?f.jsx("tr",{className:"diff-widget",children:f.jsx("td",{colSpan:n?1:2,className:"diff-widget-content",children:t||r})}):t===r?f.jsx("tr",{className:"diff-widget",children:f.jsx("td",{colSpan:n?2:4,className:"diff-widget-content",children:t})}):f.jsxs("tr",{className:"diff-widget",children:[f.jsx("td",{colSpan:n?1:2,className:"diff-widget-content",children:t}),f.jsx("td",{colSpan:n?1:2,className:"diff-widget-content",children:r})]})}var Qvt=["selectedChanges","monotonous","hideGutter","tokens","lineClassName"],Yvt=["hunk","widgets","className"];function Hg(e,n){return(e?eu(e):"00")+(n?eu(n):"00")}function Xvt(e){var n=e.hunk,t=e.widgets,r=e.className,s=su(e,Yvt),i=(function(a,o){for(var l=function(b){if(!b)return null;var w=eu(b);return o[w]||null},u=[],_=0;_=(i==null?void 0:i.value.length))return[e];var o=function(d,p){var m=i.value.slice(d,p);return[].concat(Wi(s),[Fn(Fn({},i),{},{value:m})])};if(n>0){var l=o(0,n);a.push(rh(l))}var u=o(Math.max(n,0),t);if(a.push(r?(function(d,p){return[p].concat(Wi(rh(d)))})(u,r):rh(u)),t1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(e.children){var r=e.children,s=hu(e,gbt);t.push(s);var i,a=G6(r);try{for(a.s();!(i=a.n()).done;)KI(i.value,n,t)}catch(o){a.e(o)}finally{a.f()}t.pop()}else n.push(rh([].concat(Wi(t.slice(1)),[e])));return n}function vbt(e){return e.reduce((function(n,t){var r=n[n.length-1],s=(function(l){var u=eS(l);return u.value.includes(` +`)})(n.oldSource,e),r=n.highlight?function(l){return n.refractor.highlight(l,n.language)}:function(l){return[{type:"text",value:l}]};return[qg(r(n.oldSource)),qg(r(t))]}var s=En(fbt(e),2),i=s[0],a=s[1],o=n.highlight?function(l){return qg(n.refractor.highlight(l,n.language))}:function(l){return qg([{type:"text",value:l}])};return[o(i),o(a)]}function Jf(e){return e.map((function(n){return Ln({},n)}))}function _bt(e,n){return[].concat(qi(Jf(e.slice(0,-1))),[n])}function pbt(e){return e.type==="text"}function eS(e){var n=e[e.length-1];if(pbt(n))return n;throw new Error("Invalid token path with leaf of type ".concat(n.type))}function mbt(e,n,t,r){var s=e.slice(0,-1),i=eS(e),a=[];if(t<=0||n>=(i==null?void 0:i.value.length))return[e];var o=function(d,p){var m=i.value.slice(d,p);return[].concat(qi(s),[Ln(Ln({},i),{},{value:m})])};if(n>0){var l=o(0,n);a.push(Jf(l))}var u=o(Math.max(n,0),t);if(a.push(r?(function(d,p){return[p].concat(qi(Jf(d)))})(u,r):Jf(u)),t1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(e.children){var r=e.children,s=su(e,gbt);t.push(s);var i,a=G6(r);try{for(a.s();!(i=a.n()).done;)KI(i.value,n,t)}catch(o){a.e(o)}finally{a.f()}t.pop()}else n.push(Jf([].concat(qi(t.slice(1)),[e])));return n}function vbt(e){return e.reduce((function(n,t){var r=n[n.length-1],s=(function(l){var u=eS(l);return u.value.includes(` `)?u.value.split(` -`).map((function(_){return _bt(l,Fn(Fn({},u),{},{value:_}))})):[l]})(t),i=gI(s),a=i[0],o=i.slice(1);return[].concat(Wi(n.slice(0,-1)),[[].concat(Wi(r),[a])],Wi(o.map((function(l){return[l]}))))}),[[]])}function Vz(e){return vbt(KI(e))}var bbt=function(e,n,t){var r=(t=typeof t=="function"?t:void 0)?t(e,n):void 0;return r===void 0?xb(e,n,void 0,t):!!r},ybt=function(e,n){return xb(e,n)},xbt=function(e){var n=e==null?0:e.length;return n?e[n-1]:void 0};function wbt(e,n){if(!e.children)throw new Error("parent node missing children property");var t,r,s=xbt(e.children);return s&&(r=n,(t=s).type===r.type&&(t.type==="text"||t.children&&r.children&&bbt(t,r,(function(i,a,o){return o==="chlidren"||ybt(i,a)}))))?e.children[e.children.length-1]=(function(i,a){return"value"in i&&"value"in a?Fn(Fn({},i),{},{value:"".concat(i.value).concat(a.value)}):i})(s,n):e.children.push(n),e.children[e.children.length-1]}function Kz(e){var n,t={type:"root",children:[]},r=G6(e);try{var s=function(){var i=n.value;i.reduce((function(a,o,l){return wbt(a,l===i.length-1?Fn({},o):Fn(Fn({},o),{},{children:[]}))}),t)};for(r.s();!(n=r.n()).done;)s()}catch(i){r.e(i)}finally{r.f()}return t}var Sbt=Object.prototype.hasOwnProperty,kbt=WI((function(e,n,t){Sbt.call(e,t)?e[t].push(n):Z6(e,t,[n])})),Cbt=Object.prototype.hasOwnProperty,Ebt=function(e){if(e==null)return!0;if(yb(e)&&(Xi(e)||typeof e=="string"||typeof e.splice=="function"||hv(e)||K6(e)||bb(e)))return!e.length;var n=c3(e);if(n=="[object Map]"||n=="[object Set]")return!e.size;if(RI(e))return!MI(e).length;for(var t in e)if(Cbt.call(e,t))return!1;return!0},Nbt=function(e,n){var t=n.start,r=n.length,s=t+r,i=e.reduce((function(a,o){var l=kn(a,2),u=l[0],_=l[1],d=_+eS(o).value.length;if(_>s||dr.length?t:r,l=t.length>r.length?r:t,u=o.indexOf(l);if(u!=-1)return a=[new n.Diff(1,o.substring(0,u)),new n.Diff(0,l),new n.Diff(1,o.substring(u+l.length))],t.length>r.length&&(a[0][0]=a[2][0]=-1),a;if(l.length==1)return[new n.Diff(-1,t),new n.Diff(1,r)];var _=this.diff_halfMatch_(t,r);if(_){var d=_[0],p=_[1],m=_[2],x=_[3],S=_[4],v=this.diff_main(d,m,s,i),b=this.diff_main(p,x,s,i);return v.concat([new n.Diff(0,S)],b)}return s&&t.length>100&&r.length>100?this.diff_lineMode_(t,r,i):this.diff_bisect_(t,r,i)},n.prototype.diff_lineMode_=function(t,r,s){var i=this.diff_linesToChars_(t,r);t=i.chars1,r=i.chars2;var a=i.lineArray,o=this.diff_main(t,r,!1,s);this.diff_charsToLines_(o,a),this.diff_cleanupSemantic(o),o.push(new n.Diff(0,""));for(var l=0,u=0,_=0,d="",p="";l=1&&_>=1){o.splice(l-u-_,u+_),l=l-u-_;for(var m=this.diff_main(d,p,!1,s),x=m.length-1;x>=0;x--)o.splice(l,0,m[x]);l+=m.length}_=0,u=0,d="",p=""}l++}return o.pop(),o},n.prototype.diff_bisect_=function(t,r,s){for(var i=t.length,a=r.length,o=Math.ceil((i+a)/2),l=o,u=2*o,_=new Array(u),d=new Array(u),p=0;ps);y++){for(var C=-y+S;C<=y-v;C+=2){for(var E=l+C,N=(B=C==-y||C!=y&&_[E-1]<_[E+1]?_[E+1]:_[E-1]+1)-C;Bi)v+=2;else if(N>a)S+=2;else if(x&&(M=l+m-C)>=0&&M=(z=i-d[M]))return this.diff_bisectSplit_(t,r,B,N,s)}for(var T=-y+b;T<=y-w;T+=2){for(var z,M=l+T,O=(z=T==-y||T!=y&&d[M-1]i)w+=2;else if(O>a)b+=2;else if(!x&&(E=l+m-T)>=0&&E=(z=i-z))return this.diff_bisectSplit_(t,r,B,N,s)}}}return[new n.Diff(-1,t),new n.Diff(1,r)]},n.prototype.diff_bisectSplit_=function(t,r,s,i,a){var o=t.substring(0,s),l=r.substring(0,i),u=t.substring(s),_=r.substring(i),d=this.diff_main(o,l,!1,a),p=this.diff_main(u,_,!1,a);return d.concat(p)},n.prototype.diff_linesToChars_=function(t,r){var s=[],i={};function a(u){for(var _="",d=0,p=-1,m=s.length;pi?t=t.substring(s-i):sr.length?t:r,i=t.length>r.length?r:t;if(s.length<4||2*i.length=S.length?[w,y,C,E,z]:null}var l,u,_,d,p,m=o(s,i,Math.ceil(s.length/4)),x=o(s,i,Math.ceil(s.length/2));return m||x?(l=x?m&&m[4].length>x[4].length?m:x:m,t.length>r.length?(u=l[0],_=l[1],d=l[2],p=l[3]):(d=l[0],p=l[1],u=l[2],_=l[3]),[u,_,d,p,l[4]]):null},n.prototype.diff_cleanupSemantic=function(t){for(var r=!1,s=[],i=0,a=null,o=0,l=0,u=0,_=0,d=0;o0?s[i-1]:-1,l=0,u=0,_=0,d=0,a=null,r=!0)),o++;for(r&&this.diff_cleanupMerge(t),this.diff_cleanupSemanticLossless(t),o=1;o=S?(x>=p.length/2||x>=m.length/2)&&(t.splice(o,0,new n.Diff(0,m.substring(0,x))),t[o-1][1]=p.substring(0,p.length-x),t[o+1][1]=m.substring(x),o++):(S>=p.length/2||S>=m.length/2)&&(t.splice(o,0,new n.Diff(0,p.substring(0,S))),t[o-1][0]=1,t[o-1][1]=m.substring(0,m.length-S),t[o+1][0]=-1,t[o+1][1]=p.substring(S),o++),o++}o++}},n.prototype.diff_cleanupSemanticLossless=function(t){function r(S,v){if(!S||!v)return 6;var b=S.charAt(S.length-1),w=v.charAt(0),y=b.match(n.nonAlphaNumericRegex_),C=w.match(n.nonAlphaNumericRegex_),E=y&&b.match(n.whitespaceRegex_),N=C&&w.match(n.whitespaceRegex_),T=E&&b.match(n.linebreakRegex_),z=N&&w.match(n.linebreakRegex_),M=T&&S.match(n.blanklineEndRegex_),O=z&&v.match(n.blanklineStartRegex_);return M||O?5:T||z?4:y&&!E&&N?3:E||N?2:y||C?1:0}for(var s=1;s=m&&(m=x,_=i,d=a,p=o)}t[s-1][1]!=_&&(_?t[s-1][1]=_:(t.splice(s-1,1),s--),t[s][1]=d,p?t[s+1][1]=p:(t.splice(s+1,1),s--))}s++}},n.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,n.whitespaceRegex_=/\s/,n.linebreakRegex_=/[\r\n]/,n.blanklineEndRegex_=/\n\r?\n$/,n.blanklineStartRegex_=/^\r?\n\r?\n/,n.prototype.diff_cleanupEfficiency=function(t){for(var r=!1,s=[],i=0,a=null,o=0,l=!1,u=!1,_=!1,d=!1;o0?s[i-1]:-1,_=d=!1),r=!0)),o++;r&&this.diff_cleanupMerge(t)},n.prototype.diff_cleanupMerge=function(t){t.push(new n.Diff(0,""));for(var r,s=0,i=0,a=0,o="",l="";s1?(i!==0&&a!==0&&((r=this.diff_commonPrefix(l,o))!==0&&(s-i-a>0&&t[s-i-a-1][0]==0?t[s-i-a-1][1]+=l.substring(0,r):(t.splice(0,0,new n.Diff(0,l.substring(0,r))),s++),l=l.substring(r),o=o.substring(r)),(r=this.diff_commonSuffix(l,o))!==0&&(t[s][1]=l.substring(l.length-r)+t[s][1],l=l.substring(0,l.length-r),o=o.substring(0,o.length-r))),s-=i+a,t.splice(s,i+a),o.length&&(t.splice(s,0,new n.Diff(-1,o)),s++),l.length&&(t.splice(s,0,new n.Diff(1,l)),s++),s++):s!==0&&t[s-1][0]==0?(t[s-1][1]+=t[s][1],t.splice(s,1)):s++,a=0,i=0,o="",l=""}t[t.length-1][1]===""&&t.pop();var u=!1;for(s=1;sr));s++)o=i,l=a;return t.length!=s&&t[s][0]===-1?l:l+(r-o)},n.prototype.diff_prettyHtml=function(t){for(var r=[],s=/&/g,i=//g,o=/\n/g,l=0;l");switch(u){case 1:r[l]=''+_+"";break;case-1:r[l]=''+_+"";break;case 0:r[l]=""+_+""}}return r.join("")},n.prototype.diff_text1=function(t){for(var r=[],s=0;sthis.Match_MaxBits)throw new Error("Pattern too long for this browser.");var i=this.match_alphabet_(r),a=this;function o(N,T){var z=N/r.length,M=Math.abs(s-T);return a.Match_Distance?z+M/a.Match_Distance:M?1:z}var l=this.Match_Threshold,u=t.indexOf(r,s);u!=-1&&(l=Math.min(o(0,u),l),(u=t.lastIndexOf(r,s+r.length))!=-1&&(l=Math.min(o(0,u),l)));var _,d,p=1<=v;y--){var C=i[t.charAt(y-1)];if(w[y]=S===0?(w[y+1]<<1|1)&C:(w[y+1]<<1|1)&C|(m[y+1]|m[y])<<1|1|m[y+1],w[y]&p){var E=o(S,y-1);if(E<=l){if(l=E,!((u=y-1)>s))break;v=Math.max(1,2*s-u)}}}if(o(S+1,s)>l)break;m=w}return u},n.prototype.match_alphabet_=function(t){for(var r={},s=0;s2&&(this.diff_cleanupSemantic(a),this.diff_cleanupEfficiency(a));else if(t&&typeof t=="object"&&r===void 0&&s===void 0)a=t,i=this.diff_text1(a);else if(typeof t=="string"&&r&&typeof r=="object"&&s===void 0)i=t,a=r;else{if(typeof t!="string"||typeof r!="string"||!s||typeof s!="object")throw new Error("Unknown call format to patch_make.");i=t,a=s}if(a.length===0)return[];for(var o=[],l=new n.patch_obj,u=0,_=0,d=0,p=i,m=i,x=0;x=2*this.Patch_Margin&&u&&(this.patch_addContext_(l,p),o.push(l),l=new n.patch_obj,u=0,p=m,_=d)}S!==1&&(_+=v.length),S!==-1&&(d+=v.length)}return u&&(this.patch_addContext_(l,p),o.push(l)),o},n.prototype.patch_deepCopy=function(t){for(var r=[],s=0;sthis.Match_MaxBits?(l=this.match_main(r,d.substring(0,this.Match_MaxBits),_))!=-1&&((p=this.match_main(r,d.substring(d.length-this.Match_MaxBits),_+d.length-this.Match_MaxBits))==-1||l>=p)&&(l=-1):l=this.match_main(r,d,_),l==-1)a[o]=!1,i-=t[o].length2-t[o].length1;else if(a[o]=!0,i=l-_,d==(u=p==-1?r.substring(l,l+d.length):r.substring(l,p+this.Match_MaxBits)))r=r.substring(0,l)+this.diff_text2(t[o].diffs)+r.substring(l+d.length);else{var m=this.diff_main(d,u,!1);if(d.length>this.Match_MaxBits&&this.diff_levenshtein(m)/d.length>this.Patch_DeleteThreshold)a[o]=!1;else{this.diff_cleanupSemanticLossless(m);for(var x,S=0,v=0;vo[0][1].length){var l=r-o[0][1].length;o[0][1]=s.substring(o[0][1].length)+o[0][1],a.start1-=l,a.start2-=l,a.length1+=l,a.length2+=l}return(o=(a=t[t.length-1]).diffs).length==0||o[o.length-1][0]!=0?(o.push(new n.Diff(0,s)),a.length1+=r,a.length2+=r):r>o[o.length-1][1].length&&(l=r-o[o.length-1][1].length,o[o.length-1][1]+=s.substring(0,l),a.length1+=l,a.length2+=l),s},n.prototype.patch_splitMax=function(t){for(var r=this.Match_MaxBits,s=0;s2*r?(u.length1+=p.length,a+=p.length,_=!1,u.diffs.push(new n.Diff(d,p)),i.diffs.shift()):(p=p.substring(0,r-u.length1-this.Patch_Margin),u.length1+=p.length,a+=p.length,d===0?(u.length2+=p.length,o+=p.length):_=!1,u.diffs.push(new n.Diff(d,p)),p==i.diffs[0][1]?i.diffs.shift():i.diffs[0][1]=i.diffs[0][1].substring(p.length))}l=(l=this.diff_text2(u.diffs)).substring(l.length-this.Patch_Margin);var m=this.diff_text1(i.diffs).substring(0,this.Patch_Margin);m!==""&&(u.length1+=m.length,u.length2+=m.length,u.diffs.length!==0&&u.diffs[u.diffs.length-1][0]===0?u.diffs[u.diffs.length-1][1]+=m:u.diffs.push(new n.Diff(0,m))),_||t.splice(++s,0,u)}}},n.prototype.patch_toText=function(t){for(var r=[],s=0;ss||dr.length?t:r,l=t.length>r.length?r:t,u=o.indexOf(l);if(u!=-1)return a=[new n.Diff(1,o.substring(0,u)),new n.Diff(0,l),new n.Diff(1,o.substring(u+l.length))],t.length>r.length&&(a[0][0]=a[2][0]=-1),a;if(l.length==1)return[new n.Diff(-1,t),new n.Diff(1,r)];var _=this.diff_halfMatch_(t,r);if(_){var d=_[0],p=_[1],m=_[2],x=_[3],S=_[4],v=this.diff_main(d,m,s,i),b=this.diff_main(p,x,s,i);return v.concat([new n.Diff(0,S)],b)}return s&&t.length>100&&r.length>100?this.diff_lineMode_(t,r,i):this.diff_bisect_(t,r,i)},n.prototype.diff_lineMode_=function(t,r,s){var i=this.diff_linesToChars_(t,r);t=i.chars1,r=i.chars2;var a=i.lineArray,o=this.diff_main(t,r,!1,s);this.diff_charsToLines_(o,a),this.diff_cleanupSemantic(o),o.push(new n.Diff(0,""));for(var l=0,u=0,_=0,d="",p="";l=1&&_>=1){o.splice(l-u-_,u+_),l=l-u-_;for(var m=this.diff_main(d,p,!1,s),x=m.length-1;x>=0;x--)o.splice(l,0,m[x]);l+=m.length}_=0,u=0,d="",p=""}l++}return o.pop(),o},n.prototype.diff_bisect_=function(t,r,s){for(var i=t.length,a=r.length,o=Math.ceil((i+a)/2),l=o,u=2*o,_=new Array(u),d=new Array(u),p=0;ps);y++){for(var C=-y+S;C<=y-v;C+=2){for(var E=l+C,N=(B=C==-y||C!=y&&_[E-1]<_[E+1]?_[E+1]:_[E-1]+1)-C;Bi)v+=2;else if(N>a)S+=2;else if(x&&(M=l+m-C)>=0&&M=(z=i-d[M]))return this.diff_bisectSplit_(t,r,B,N,s)}for(var T=-y+b;T<=y-w;T+=2){for(var z,M=l+T,I=(z=T==-y||T!=y&&d[M-1]i)w+=2;else if(I>a)b+=2;else if(!x&&(E=l+m-T)>=0&&E=(z=i-z))return this.diff_bisectSplit_(t,r,B,N,s)}}}return[new n.Diff(-1,t),new n.Diff(1,r)]},n.prototype.diff_bisectSplit_=function(t,r,s,i,a){var o=t.substring(0,s),l=r.substring(0,i),u=t.substring(s),_=r.substring(i),d=this.diff_main(o,l,!1,a),p=this.diff_main(u,_,!1,a);return d.concat(p)},n.prototype.diff_linesToChars_=function(t,r){var s=[],i={};function a(u){for(var _="",d=0,p=-1,m=s.length;pi?t=t.substring(s-i):sr.length?t:r,i=t.length>r.length?r:t;if(s.length<4||2*i.length=S.length?[w,y,C,E,z]:null}var l,u,_,d,p,m=o(s,i,Math.ceil(s.length/4)),x=o(s,i,Math.ceil(s.length/2));return m||x?(l=x?m&&m[4].length>x[4].length?m:x:m,t.length>r.length?(u=l[0],_=l[1],d=l[2],p=l[3]):(d=l[0],p=l[1],u=l[2],_=l[3]),[u,_,d,p,l[4]]):null},n.prototype.diff_cleanupSemantic=function(t){for(var r=!1,s=[],i=0,a=null,o=0,l=0,u=0,_=0,d=0;o0?s[i-1]:-1,l=0,u=0,_=0,d=0,a=null,r=!0)),o++;for(r&&this.diff_cleanupMerge(t),this.diff_cleanupSemanticLossless(t),o=1;o=S?(x>=p.length/2||x>=m.length/2)&&(t.splice(o,0,new n.Diff(0,m.substring(0,x))),t[o-1][1]=p.substring(0,p.length-x),t[o+1][1]=m.substring(x),o++):(S>=p.length/2||S>=m.length/2)&&(t.splice(o,0,new n.Diff(0,p.substring(0,S))),t[o-1][0]=1,t[o-1][1]=m.substring(0,m.length-S),t[o+1][0]=-1,t[o+1][1]=p.substring(S),o++),o++}o++}},n.prototype.diff_cleanupSemanticLossless=function(t){function r(S,v){if(!S||!v)return 6;var b=S.charAt(S.length-1),w=v.charAt(0),y=b.match(n.nonAlphaNumericRegex_),C=w.match(n.nonAlphaNumericRegex_),E=y&&b.match(n.whitespaceRegex_),N=C&&w.match(n.whitespaceRegex_),T=E&&b.match(n.linebreakRegex_),z=N&&w.match(n.linebreakRegex_),M=T&&S.match(n.blanklineEndRegex_),I=z&&v.match(n.blanklineStartRegex_);return M||I?5:T||z?4:y&&!E&&N?3:E||N?2:y||C?1:0}for(var s=1;s=m&&(m=x,_=i,d=a,p=o)}t[s-1][1]!=_&&(_?t[s-1][1]=_:(t.splice(s-1,1),s--),t[s][1]=d,p?t[s+1][1]=p:(t.splice(s+1,1),s--))}s++}},n.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,n.whitespaceRegex_=/\s/,n.linebreakRegex_=/[\r\n]/,n.blanklineEndRegex_=/\n\r?\n$/,n.blanklineStartRegex_=/^\r?\n\r?\n/,n.prototype.diff_cleanupEfficiency=function(t){for(var r=!1,s=[],i=0,a=null,o=0,l=!1,u=!1,_=!1,d=!1;o0?s[i-1]:-1,_=d=!1),r=!0)),o++;r&&this.diff_cleanupMerge(t)},n.prototype.diff_cleanupMerge=function(t){t.push(new n.Diff(0,""));for(var r,s=0,i=0,a=0,o="",l="";s1?(i!==0&&a!==0&&((r=this.diff_commonPrefix(l,o))!==0&&(s-i-a>0&&t[s-i-a-1][0]==0?t[s-i-a-1][1]+=l.substring(0,r):(t.splice(0,0,new n.Diff(0,l.substring(0,r))),s++),l=l.substring(r),o=o.substring(r)),(r=this.diff_commonSuffix(l,o))!==0&&(t[s][1]=l.substring(l.length-r)+t[s][1],l=l.substring(0,l.length-r),o=o.substring(0,o.length-r))),s-=i+a,t.splice(s,i+a),o.length&&(t.splice(s,0,new n.Diff(-1,o)),s++),l.length&&(t.splice(s,0,new n.Diff(1,l)),s++),s++):s!==0&&t[s-1][0]==0?(t[s-1][1]+=t[s][1],t.splice(s,1)):s++,a=0,i=0,o="",l=""}t[t.length-1][1]===""&&t.pop();var u=!1;for(s=1;sr));s++)o=i,l=a;return t.length!=s&&t[s][0]===-1?l:l+(r-o)},n.prototype.diff_prettyHtml=function(t){for(var r=[],s=/&/g,i=//g,o=/\n/g,l=0;l");switch(u){case 1:r[l]=''+_+"";break;case-1:r[l]=''+_+"";break;case 0:r[l]=""+_+""}}return r.join("")},n.prototype.diff_text1=function(t){for(var r=[],s=0;sthis.Match_MaxBits)throw new Error("Pattern too long for this browser.");var i=this.match_alphabet_(r),a=this;function o(N,T){var z=N/r.length,M=Math.abs(s-T);return a.Match_Distance?z+M/a.Match_Distance:M?1:z}var l=this.Match_Threshold,u=t.indexOf(r,s);u!=-1&&(l=Math.min(o(0,u),l),(u=t.lastIndexOf(r,s+r.length))!=-1&&(l=Math.min(o(0,u),l)));var _,d,p=1<=v;y--){var C=i[t.charAt(y-1)];if(w[y]=S===0?(w[y+1]<<1|1)&C:(w[y+1]<<1|1)&C|(m[y+1]|m[y])<<1|1|m[y+1],w[y]&p){var E=o(S,y-1);if(E<=l){if(l=E,!((u=y-1)>s))break;v=Math.max(1,2*s-u)}}}if(o(S+1,s)>l)break;m=w}return u},n.prototype.match_alphabet_=function(t){for(var r={},s=0;s2&&(this.diff_cleanupSemantic(a),this.diff_cleanupEfficiency(a));else if(t&&typeof t=="object"&&r===void 0&&s===void 0)a=t,i=this.diff_text1(a);else if(typeof t=="string"&&r&&typeof r=="object"&&s===void 0)i=t,a=r;else{if(typeof t!="string"||typeof r!="string"||!s||typeof s!="object")throw new Error("Unknown call format to patch_make.");i=t,a=s}if(a.length===0)return[];for(var o=[],l=new n.patch_obj,u=0,_=0,d=0,p=i,m=i,x=0;x=2*this.Patch_Margin&&u&&(this.patch_addContext_(l,p),o.push(l),l=new n.patch_obj,u=0,p=m,_=d)}S!==1&&(_+=v.length),S!==-1&&(d+=v.length)}return u&&(this.patch_addContext_(l,p),o.push(l)),o},n.prototype.patch_deepCopy=function(t){for(var r=[],s=0;sthis.Match_MaxBits?(l=this.match_main(r,d.substring(0,this.Match_MaxBits),_))!=-1&&((p=this.match_main(r,d.substring(d.length-this.Match_MaxBits),_+d.length-this.Match_MaxBits))==-1||l>=p)&&(l=-1):l=this.match_main(r,d,_),l==-1)a[o]=!1,i-=t[o].length2-t[o].length1;else if(a[o]=!0,i=l-_,d==(u=p==-1?r.substring(l,l+d.length):r.substring(l,p+this.Match_MaxBits)))r=r.substring(0,l)+this.diff_text2(t[o].diffs)+r.substring(l+d.length);else{var m=this.diff_main(d,u,!1);if(d.length>this.Match_MaxBits&&this.diff_levenshtein(m)/d.length>this.Patch_DeleteThreshold)a[o]=!1;else{this.diff_cleanupSemanticLossless(m);for(var x,S=0,v=0;vo[0][1].length){var l=r-o[0][1].length;o[0][1]=s.substring(o[0][1].length)+o[0][1],a.start1-=l,a.start2-=l,a.length1+=l,a.length2+=l}return(o=(a=t[t.length-1]).diffs).length==0||o[o.length-1][0]!=0?(o.push(new n.Diff(0,s)),a.length1+=r,a.length2+=r):r>o[o.length-1][1].length&&(l=r-o[o.length-1][1].length,o[o.length-1][1]+=s.substring(0,l),a.length1+=l,a.length2+=l),s},n.prototype.patch_splitMax=function(t){for(var r=this.Match_MaxBits,s=0;s2*r?(u.length1+=p.length,a+=p.length,_=!1,u.diffs.push(new n.Diff(d,p)),i.diffs.shift()):(p=p.substring(0,r-u.length1-this.Patch_Margin),u.length1+=p.length,a+=p.length,d===0?(u.length2+=p.length,o+=p.length):_=!1,u.diffs.push(new n.Diff(d,p)),p==i.diffs[0][1]?i.diffs.shift():i.diffs[0][1]=i.diffs[0][1].substring(p.length))}l=(l=this.diff_text2(u.diffs)).substring(l.length-this.Patch_Margin);var m=this.diff_text1(i.diffs).substring(0,this.Patch_Margin);m!==""&&(u.length1+=m.length,u.length2+=m.length,u.diffs.length!==0&&u.diffs[u.diffs.length-1][0]===0?u.diffs[u.diffs.length-1][1]+=m:u.diffs.push(new n.Diff(0,m))),_||t.splice(++s,0,u)}}},n.prototype.patch_toText=function(t){for(var r=[],s=0;s1&&arguments[1]!==void 0?arguments[1]:{}).type,t=(n===void 0?"block":n)==="block"?Mbt:Dbt,r=J6(e.map((function(o){return o.changes})),QI).map(t).reduce((function(o,l){var u=kn(o,2),_=u[0],d=u[1],p=kn(l,2),m=p[0],x=p[1];return[_.concat(m),d.concat(x)]}),[[],[]]),s=kn(r,2),i=s[0],a=s[1];return zbt(Yz(i),Yz(a))}var Obt=["enhancers"],ej=function(e){var n,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.enhancers,s=r===void 0?[]:r,i=kn(hbt(e,hu(t,Obt)),2),a=i[0],o=i[1],l=[Vz(a),Vz(o)],u=(n=[l[0],l[1]],s.reduce((function(S,v){return v(S)}),n)),_=kn(u,2),d=_[0],p=_[1],m=[d.map(Kz),p.map(Kz)],x=m[1];return{old:m[0].map((function(S){var v;return(v=S.children)!==null&&v!==void 0?v:[]})),new:x.map((function(S){var v;return(v=S.children)!==null&&v!==void 0?v:[]}))}};Uo.displayName="clike";Uo.aliases=[];function Uo(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}rm.displayName="c";rm.aliases=[];function rm(e){e.register(Uo),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}zb.displayName="cpp";zb.aliases=[];function zb(e){e.register(rm),(function(n){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,r=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,function(){return t.source});n.languages.cpp=n.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),n.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,function(){return r})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),n.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n.languages.cpp}}}}),n.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),n.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:n.languages.extend("cpp",{})}}),n.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},n.languages.cpp["base-clause"])})(e)}tS.displayName="arduino";tS.aliases=["ino"];function tS(e){e.register(zb),e.languages.arduino=e.languages.extend("cpp",{keyword:/\b(?:String|array|bool|boolean|break|byte|case|catch|continue|default|do|double|else|finally|for|function|goto|if|in|instanceof|int|integer|long|loop|new|null|return|setup|string|switch|throw|try|void|while|word)\b/,constant:/\b(?:ANALOG_MESSAGE|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FIRMATA_STRING|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL2V56|LED_BUILTIN|LOW|OUTPUT|REPORT_ANALOG|REPORT_DIGITAL|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET)\b/,builtin:/\b(?:Audio|BSSID|Bridge|Client|Console|EEPROM|Esplora|EsploraTFT|Ethernet|EthernetClient|EthernetServer|EthernetUDP|File|FileIO|FileSystem|Firmata|GPRS|GSM|GSMBand|GSMClient|GSMModem|GSMPIN|GSMScanner|GSMServer|GSMVoiceCall|GSM_SMS|HttpClient|IPAddress|IRread|Keyboard|KeyboardController|LiquidCrystal|LiquidCrystal_I2C|Mailbox|Mouse|MouseController|PImage|Process|RSSI|RobotControl|RobotMotor|SD|SPI|SSID|Scheduler|Serial|Server|Servo|SoftwareSerial|Stepper|Stream|TFT|Task|USBHost|WiFi|WiFiClient|WiFiServer|WiFiUDP|Wire|YunClient|YunServer|abs|addParameter|analogRead|analogReadResolution|analogReference|analogWrite|analogWriteResolution|answerCall|attach|attachGPRS|attachInterrupt|attached|autoscroll|available|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|bitClear|bitRead|bitSet|bitWrite|blink|blinkVersion|buffer|changePIN|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compassRead|config|connect|connected|constrain|cos|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|delay|delayMicroseconds|detach|detachInterrupt|digitalRead|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endTransmission|endWrite|exists|exitValue|fill|find|findUntil|flush|gatewayIP|get|getAsynchronously|getBand|getButton|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|home|image|interrupts|isActionDone|isDirectory|isListening|isPIN|isPressed|isValid|keyPressed|keyReleased|keyboardRead|knobRead|leftToRight|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|lowByte|macAddress|maintain|map|max|messageAvailable|micros|millis|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|noListenOnLocalhost|noStroke|noTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|pinMode|playFile|playMelody|point|pointTo|position|pow|prepare|press|print|printFirmwareVersion|printVersion|println|process|processInput|pulseIn|put|random|randomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|run|runAsynchronously|runShellCommand|runShellCommandAsynchronously|running|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|serialEvent|setBand|setBitOrder|setClockDivider|setCursor|setDNS|setDataMode|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|shiftIn|shiftOut|shutdown|sin|size|sqrt|startLoop|step|stop|stroke|subnetMask|switchPIN|tan|tempoWrite|text|tone|transfer|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRGB|writeRed|yield)\b/}),e.languages.ino=e.languages.arduino}nS.displayName="bash";nS.aliases=["sh","shell"];function nS(e){(function(n){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},s={bash:r,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};n.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:s},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:s},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:s.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:s.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=n.languages.bash;for(var i=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=s.variable[1].inside,o=0;o>/g,function(q,G){return"(?:"+F[+G]+")"})}function r(L,F,q){return RegExp(t(L,F),"")}function s(L,F){for(var q=0;q>/g,function(){return"(?:"+L+")"});return L.replace(/<>/g,"[^\\s\\S]")}var i={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function a(L){return"\\b(?:"+L.trim().replace(/ /g,"|")+")\\b"}var o=a(i.typeDeclaration),l=RegExp(a(i.type+" "+i.typeDeclaration+" "+i.contextual+" "+i.other)),u=a(i.typeDeclaration+" "+i.contextual+" "+i.other),_=a(i.type+" "+i.typeDeclaration+" "+i.other),d=s(/<(?:[^<>;=+\-*/%&|^]|<>)*>/.source,2),p=s(/\((?:[^()]|<>)*\)/.source,2),m=/@?\b[A-Za-z_]\w*\b/.source,x=t(/<<0>>(?:\s*<<1>>)?/.source,[m,d]),S=t(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[u,x]),v=/\[\s*(?:,\s*)*\]/.source,b=t(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[S,v]),w=t(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[d,p,v]),y=t(/\(<<0>>+(?:,<<0>>+)+\)/.source,[w]),C=t(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[y,S,v]),E={keyword:l,punctuation:/[<>()?,.:[\]]/},N=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,T=/"(?:\\.|[^\\"\r\n])*"/.source,z=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;n.languages.csharp=n.languages.extend("clike",{string:[{pattern:r(/(^|[^$\\])<<0>>/.source,[z]),lookbehind:!0,greedy:!0},{pattern:r(/(^|[^@$\\])<<0>>/.source,[T]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:r(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[S]),lookbehind:!0,inside:E},{pattern:r(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[m,C]),lookbehind:!0,inside:E},{pattern:r(/(\busing\s+)<<0>>(?=\s*=)/.source,[m]),lookbehind:!0},{pattern:r(/(\b<<0>>\s+)<<1>>/.source,[o,x]),lookbehind:!0,inside:E},{pattern:r(/(\bcatch\s*\(\s*)<<0>>/.source,[S]),lookbehind:!0,inside:E},{pattern:r(/(\bwhere\s+)<<0>>/.source,[m]),lookbehind:!0},{pattern:r(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[b]),lookbehind:!0,inside:E},{pattern:r(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[C,_,m]),inside:E}],keyword:l,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),n.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),n.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:r(/([(,]\s*)<<0>>(?=\s*:)/.source,[m]),lookbehind:!0,alias:"punctuation"}}),n.languages.insertBefore("csharp","class-name",{namespace:{pattern:r(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[m]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:r(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[p]),lookbehind:!0,alias:"class-name",inside:E},"return-type":{pattern:r(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[C,S]),inside:E,alias:"class-name"},"constructor-invocation":{pattern:r(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[C]),lookbehind:!0,inside:E,alias:"class-name"},"generic-method":{pattern:r(/<<0>>\s*<<1>>(?=\s*\()/.source,[m,d]),inside:{function:r(/^<<0>>/.source,[m]),generic:{pattern:RegExp(d),alias:"class-name",inside:E}}},"type-list":{pattern:r(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[o,x,m,C,l.source,p,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:r(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[x,p]),lookbehind:!0,greedy:!0,inside:n.languages.csharp},keyword:l,"class-name":{pattern:RegExp(C),greedy:!0,inside:E},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var M=T+"|"+N,O=t(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[M]),B=s(t(/[^"'/()]|<<0>>|\(<>*\)/.source,[O]),2),$=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,U=t(/<<0>>(?:\s*\(<<1>>*\))?/.source,[S,B]);n.languages.insertBefore("csharp","class-name",{attribute:{pattern:r(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[$,U]),lookbehind:!0,greedy:!0,inside:{target:{pattern:r(/^<<0>>(?=\s*:)/.source,[$]),alias:"keyword"},"attribute-arguments":{pattern:r(/\(<<0>>*\)/.source,[B]),inside:n.languages.csharp},"class-name":{pattern:RegExp(S),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var H=/:[^}\r\n]+/.source,Y=s(t(/[^"'/()]|<<0>>|\(<>*\)/.source,[O]),2),V=t(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[Y,H]),X=s(t(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<>*\)/.source,[M]),2),te=t(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[X,H]);function I(L,F){return{interpolation:{pattern:r(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[L]),lookbehind:!0,inside:{"format-string":{pattern:r(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[F,H]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:n.languages.csharp}}},string:/[\s\S]+/}}n.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:r(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[V]),lookbehind:!0,greedy:!0,inside:I(V,Y)},{pattern:r(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[te]),lookbehind:!0,greedy:!0,inside:I(te,X)}],char:{pattern:RegExp(N),greedy:!0}}),n.languages.dotnet=n.languages.cs=n.languages.csharp})(e)}sm.displayName="markup";sm.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function sm(e){e.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(t,r){var s={};s["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[r]},s.cdata=/^$/i;var i={"included-cdata":{pattern://i,inside:s}};i["language-"+r]={pattern:/[\s\S]+/,inside:e.languages[r]};var a={};a[t]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:i},e.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(n,t){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:e.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}f_.displayName="css";f_.aliases=[];function f_(e){(function(n){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var r=n.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(e)}sS.displayName="diff";sS.aliases=[];function sS(e){(function(n){n.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach(function(r){var s=t[r],i=[];/^\w+$/.test(r)||i.push(/\w+/.exec(r)[0]),r==="diff"&&i.push("bold"),n.languages.diff[r]={pattern:RegExp("^(?:["+s+`].*(?:\r +`:"")+_.content]}),["",""]),t=En(n,2),r=En(YI(t[0],t[1]),2),s=r[0],i=r[1];if(s.length===0&&i.length===0)return[[],[]];var a=function(u){if(u&&!Pl(u))return u.lineNumber},o=a(e.find(Ui)),l=a(e.find(_u));if(o===void 0||l===void 0)throw new Error("Could not find start line number for edit");return[Jz(Zz(s),o),Jz(Zz(i),l)]}function Dbt(e){var n=e.reduce((function(r,s){var i=En(r,3),a=i[0],o=i[1],l=i[2];if(!l||!Ui(l)||!_u(s))return[a,o,s];var u=En(YI(l.content,s.content),2),_=u[0],d=u[1];return[a.concat(u3(_,l.lineNumber)),o.concat(u3(d,s.lineNumber)),s]}),[[],[],null]),t=En(n,2);return[t[0],t[1]]}function Lbt(e){var n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).type,t=(n===void 0?"block":n)==="block"?Mbt:Dbt,r=J6(e.map((function(o){return o.changes})),QI).map(t).reduce((function(o,l){var u=En(o,2),_=u[0],d=u[1],p=En(l,2),m=p[0],x=p[1];return[_.concat(m),d.concat(x)]}),[[],[]]),s=En(r,2),i=s[0],a=s[1];return zbt(Yz(i),Yz(a))}var Obt=["enhancers"],ej=function(e){var n,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.enhancers,s=r===void 0?[]:r,i=En(hbt(e,su(t,Obt)),2),a=i[0],o=i[1],l=[Vz(a),Vz(o)],u=(n=[l[0],l[1]],s.reduce((function(S,v){return v(S)}),n)),_=En(u,2),d=_[0],p=_[1],m=[d.map(Kz),p.map(Kz)],x=m[1];return{old:m[0].map((function(S){var v;return(v=S.children)!==null&&v!==void 0?v:[]})),new:x.map((function(S){var v;return(v=S.children)!==null&&v!==void 0?v:[]}))}};Uo.displayName="clike";Uo.aliases=[];function Uo(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}rm.displayName="c";rm.aliases=[];function rm(e){e.register(Uo),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}Nb.displayName="cpp";Nb.aliases=[];function Nb(e){e.register(rm),(function(n){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,r=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,function(){return t.source});n.languages.cpp=n.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),n.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,function(){return r})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),n.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n.languages.cpp}}}}),n.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),n.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:n.languages.extend("cpp",{})}}),n.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},n.languages.cpp["base-clause"])})(e)}tS.displayName="arduino";tS.aliases=["ino"];function tS(e){e.register(Nb),e.languages.arduino=e.languages.extend("cpp",{keyword:/\b(?:String|array|bool|boolean|break|byte|case|catch|continue|default|do|double|else|finally|for|function|goto|if|in|instanceof|int|integer|long|loop|new|null|return|setup|string|switch|throw|try|void|while|word)\b/,constant:/\b(?:ANALOG_MESSAGE|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FIRMATA_STRING|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL2V56|LED_BUILTIN|LOW|OUTPUT|REPORT_ANALOG|REPORT_DIGITAL|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET)\b/,builtin:/\b(?:Audio|BSSID|Bridge|Client|Console|EEPROM|Esplora|EsploraTFT|Ethernet|EthernetClient|EthernetServer|EthernetUDP|File|FileIO|FileSystem|Firmata|GPRS|GSM|GSMBand|GSMClient|GSMModem|GSMPIN|GSMScanner|GSMServer|GSMVoiceCall|GSM_SMS|HttpClient|IPAddress|IRread|Keyboard|KeyboardController|LiquidCrystal|LiquidCrystal_I2C|Mailbox|Mouse|MouseController|PImage|Process|RSSI|RobotControl|RobotMotor|SD|SPI|SSID|Scheduler|Serial|Server|Servo|SoftwareSerial|Stepper|Stream|TFT|Task|USBHost|WiFi|WiFiClient|WiFiServer|WiFiUDP|Wire|YunClient|YunServer|abs|addParameter|analogRead|analogReadResolution|analogReference|analogWrite|analogWriteResolution|answerCall|attach|attachGPRS|attachInterrupt|attached|autoscroll|available|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|bitClear|bitRead|bitSet|bitWrite|blink|blinkVersion|buffer|changePIN|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compassRead|config|connect|connected|constrain|cos|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|delay|delayMicroseconds|detach|detachInterrupt|digitalRead|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endTransmission|endWrite|exists|exitValue|fill|find|findUntil|flush|gatewayIP|get|getAsynchronously|getBand|getButton|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|home|image|interrupts|isActionDone|isDirectory|isListening|isPIN|isPressed|isValid|keyPressed|keyReleased|keyboardRead|knobRead|leftToRight|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|lowByte|macAddress|maintain|map|max|messageAvailable|micros|millis|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|noListenOnLocalhost|noStroke|noTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|pinMode|playFile|playMelody|point|pointTo|position|pow|prepare|press|print|printFirmwareVersion|printVersion|println|process|processInput|pulseIn|put|random|randomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|run|runAsynchronously|runShellCommand|runShellCommandAsynchronously|running|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|serialEvent|setBand|setBitOrder|setClockDivider|setCursor|setDNS|setDataMode|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|shiftIn|shiftOut|shutdown|sin|size|sqrt|startLoop|step|stop|stroke|subnetMask|switchPIN|tan|tempoWrite|text|tone|transfer|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRGB|writeRed|yield)\b/}),e.languages.ino=e.languages.arduino}nS.displayName="bash";nS.aliases=["sh","shell"];function nS(e){(function(n){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},s={bash:r,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};n.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:s},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:s},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:s.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:s.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=n.languages.bash;for(var i=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=s.variable[1].inside,o=0;o>/g,function(q,G){return"(?:"+F[+G]+")"})}function r(L,F,q){return RegExp(t(L,F),"")}function s(L,F){for(var q=0;q>/g,function(){return"(?:"+L+")"});return L.replace(/<>/g,"[^\\s\\S]")}var i={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function a(L){return"\\b(?:"+L.trim().replace(/ /g,"|")+")\\b"}var o=a(i.typeDeclaration),l=RegExp(a(i.type+" "+i.typeDeclaration+" "+i.contextual+" "+i.other)),u=a(i.typeDeclaration+" "+i.contextual+" "+i.other),_=a(i.type+" "+i.typeDeclaration+" "+i.other),d=s(/<(?:[^<>;=+\-*/%&|^]|<>)*>/.source,2),p=s(/\((?:[^()]|<>)*\)/.source,2),m=/@?\b[A-Za-z_]\w*\b/.source,x=t(/<<0>>(?:\s*<<1>>)?/.source,[m,d]),S=t(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[u,x]),v=/\[\s*(?:,\s*)*\]/.source,b=t(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[S,v]),w=t(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[d,p,v]),y=t(/\(<<0>>+(?:,<<0>>+)+\)/.source,[w]),C=t(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[y,S,v]),E={keyword:l,punctuation:/[<>()?,.:[\]]/},N=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,T=/"(?:\\.|[^\\"\r\n])*"/.source,z=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;n.languages.csharp=n.languages.extend("clike",{string:[{pattern:r(/(^|[^$\\])<<0>>/.source,[z]),lookbehind:!0,greedy:!0},{pattern:r(/(^|[^@$\\])<<0>>/.source,[T]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:r(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[S]),lookbehind:!0,inside:E},{pattern:r(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[m,C]),lookbehind:!0,inside:E},{pattern:r(/(\busing\s+)<<0>>(?=\s*=)/.source,[m]),lookbehind:!0},{pattern:r(/(\b<<0>>\s+)<<1>>/.source,[o,x]),lookbehind:!0,inside:E},{pattern:r(/(\bcatch\s*\(\s*)<<0>>/.source,[S]),lookbehind:!0,inside:E},{pattern:r(/(\bwhere\s+)<<0>>/.source,[m]),lookbehind:!0},{pattern:r(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[b]),lookbehind:!0,inside:E},{pattern:r(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[C,_,m]),inside:E}],keyword:l,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),n.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),n.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:r(/([(,]\s*)<<0>>(?=\s*:)/.source,[m]),lookbehind:!0,alias:"punctuation"}}),n.languages.insertBefore("csharp","class-name",{namespace:{pattern:r(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[m]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:r(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[p]),lookbehind:!0,alias:"class-name",inside:E},"return-type":{pattern:r(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[C,S]),inside:E,alias:"class-name"},"constructor-invocation":{pattern:r(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[C]),lookbehind:!0,inside:E,alias:"class-name"},"generic-method":{pattern:r(/<<0>>\s*<<1>>(?=\s*\()/.source,[m,d]),inside:{function:r(/^<<0>>/.source,[m]),generic:{pattern:RegExp(d),alias:"class-name",inside:E}}},"type-list":{pattern:r(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[o,x,m,C,l.source,p,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:r(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[x,p]),lookbehind:!0,greedy:!0,inside:n.languages.csharp},keyword:l,"class-name":{pattern:RegExp(C),greedy:!0,inside:E},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var M=T+"|"+N,I=t(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[M]),B=s(t(/[^"'/()]|<<0>>|\(<>*\)/.source,[I]),2),$=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,U=t(/<<0>>(?:\s*\(<<1>>*\))?/.source,[S,B]);n.languages.insertBefore("csharp","class-name",{attribute:{pattern:r(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[$,U]),lookbehind:!0,greedy:!0,inside:{target:{pattern:r(/^<<0>>(?=\s*:)/.source,[$]),alias:"keyword"},"attribute-arguments":{pattern:r(/\(<<0>>*\)/.source,[B]),inside:n.languages.csharp},"class-name":{pattern:RegExp(S),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var H=/:[^}\r\n]+/.source,Y=s(t(/[^"'/()]|<<0>>|\(<>*\)/.source,[I]),2),V=t(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[Y,H]),X=s(t(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<>*\)/.source,[M]),2),ee=t(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[X,H]);function O(L,F){return{interpolation:{pattern:r(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[L]),lookbehind:!0,inside:{"format-string":{pattern:r(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[F,H]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:n.languages.csharp}}},string:/[\s\S]+/}}n.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:r(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[V]),lookbehind:!0,greedy:!0,inside:O(V,Y)},{pattern:r(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[ee]),lookbehind:!0,greedy:!0,inside:O(ee,X)}],char:{pattern:RegExp(N),greedy:!0}}),n.languages.dotnet=n.languages.cs=n.languages.csharp})(e)}sm.displayName="markup";sm.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function sm(e){e.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(t,r){var s={};s["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[r]},s.cdata=/^$/i;var i={"included-cdata":{pattern://i,inside:s}};i["language-"+r]={pattern:/[\s\S]+/,inside:e.languages[r]};var a={};a[t]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:i},e.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(n,t){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:e.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}l_.displayName="css";l_.aliases=[];function l_(e){(function(n){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var r=n.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(e)}sS.displayName="diff";sS.aliases=[];function sS(e){(function(n){n.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach(function(r){var s=t[r],i=[];/^\w+$/.test(r)||i.push(/\w+/.exec(r)[0]),r==="diff"&&i.push("bold"),n.languages.diff[r]={pattern:RegExp("^(?:["+s+`].*(?:\r ?| -|(?![\\s\\S])))+`,"m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(r)[0]}}}}),Object.defineProperty(n.languages.diff,"PREFIXES",{value:t})})(e)}iS.displayName="go";iS.aliases=[];function iS(e){e.register(Uo),e.languages.go=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go["class-name"]}aS.displayName="ini";aS.aliases=[];function aS(e){e.languages.ini={comment:{pattern:/(^[ \f\t\v]*)[#;][^\n\r]*/m,lookbehind:!0},section:{pattern:/(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/\[|\]/}},key:{pattern:/(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^("|').+(?=\1$)/,lookbehind:!0}}},punctuation:/=/}}oS.displayName="java";oS.aliases=[];function oS(e){e.register(Uo),(function(n){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,r=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,s={pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};n.languages.java=n.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[s,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:s.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:s.inside}],keyword:t,function:[n.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),n.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),n.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":s,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:s.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:s.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,function(){return t.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}lS.displayName="regex";lS.aliases=[];function lS(e){(function(n){var t={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},r=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,s={pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},i={pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},a="(?:[^\\\\-]|"+r.source+")",o=RegExp(a+"-"+a),l={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"};n.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:o,inside:{escape:r,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":t,"char-set":i,escape:r}},"special-escape":t,"char-set":s,backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":l}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:r,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]||&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}cS.displayName="json";cS.aliases=["webmanifest"];function cS(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}uS.displayName="kotlin";uS.aliases=["kt","kts"];function uS(e){e.register(Uo),(function(n){n.languages.kotlin=n.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete n.languages.kotlin["class-name"];var t={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:n.languages.kotlin}};n.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:t},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:t},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete n.languages.kotlin.string,n.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),n.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),n.languages.kt=n.languages.kotlin,n.languages.kts=n.languages.kotlin})(e)}dS.displayName="less";dS.aliases=[];function dS(e){e.register(f_),e.languages.less=e.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),e.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}})}fS.displayName="lua";fS.aliases=[];function fS(e){e.languages.lua={comment:/^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,string:{pattern:/(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,greedy:!0},number:/\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,keyword:/\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,function:/(?!\d)\w+(?=\s*(?:[({]))/,operator:[/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,{pattern:/(^|[^.])\.\.(?!\.)/,lookbehind:!0}],punctuation:/[\[\](){},;]|\.+|:+/}}hS.displayName="makefile";hS.aliases=[];function hS(e){e.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/}}_S.displayName="yaml";_S.aliases=["yml"];function _S(e){(function(n){var t=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,s="(?:"+r.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+r.source+")?)",i=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),a=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(l,u){u=(u||"").replace(/m/g,"")+"m";var _=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return s}).replace(/<>/g,function(){return l});return RegExp(_,u)}n.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return s})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return s}).replace(/<>/g,function(){return"(?:"+i+"|"+a+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:o(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:o(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:o(a),lookbehind:!0,greedy:!0},number:{pattern:o(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},n.languages.yml=n.languages.yaml})(e)}pS.displayName="markdown";pS.aliases=["md"];function pS(e){e.register(sm),(function(n){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(o){return o=o.replace(//g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+o+")")}var s=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return s}),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;n.languages.markdown=n.languages.extend("markup",{}),n.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:n.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+a+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+a+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(s),inside:n.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(s),alias:"important",inside:n.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(o){["url","bold","italic","strike","code-snippet"].forEach(function(l){o!==l&&(n.languages.markdown[o].inside.content.inside[l]=n.languages.markdown[l])})}),n.hooks.add("after-tokenize",function(o){if(o.language!=="markdown"&&o.language!=="md")return;function l(u){if(!(!u||typeof u=="string"))for(var _=0,d=u.length;_]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete e.languages.objectivec["class-name"],e.languages.objc=e.languages.objectivec}gS.displayName="perl";gS.aliases=[];function gS(e){(function(n){var t=/(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;n.languages.perl={comment:[{pattern:/(^\s*)=\w[\s\S]*?=cut.*/m,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],string:[{pattern:RegExp(/\b(?:q|qq|qw|qx)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,t].join("|")+")"),greedy:!0},{pattern:/("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,greedy:!0},{pattern:/'(?:[^'\\\r\n]|\\.)*'/,greedy:!0}],regex:[{pattern:RegExp(/\b(?:m|qr)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,t].join("|")+")"+/[msixpodualngc]*/.source),greedy:!0},{pattern:RegExp(/(^|[^-])\b(?:s|tr|y)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,/([a-zA-Z0-9])(?:(?!\3)[^\\]|\\[\s\S])*\3(?:(?!\3)[^\\]|\\[\s\S])*\3/.source,t+/\s*/.source+t].join("|")+")"+/[msixpodualngcer]*/.source),lookbehind:!0,greedy:!0},{pattern:/\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|x|xor)\b))/,greedy:!0}],variable:[/[&*$@%]\{\^[A-Z]+\}/,/[&*$@%]\^[A-Z_]/,/[&*$@%]#?(?=\{)/,/[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+(?![\w$]))+(?:::)*/,/[&*$@%]\d+/,/(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/],filehandle:{pattern:/<(?![<=])\S*?>|\b_\b/,alias:"symbol"},"v-string":{pattern:/v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,alias:"string"},function:{pattern:/(\bsub[ \t]+)\w+/,lookbehind:!0},keyword:/\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,operator:/-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\b/,punctuation:/[{}[\];(),:]/}})(e)}Tb.displayName="markup-templating";Tb.aliases=[];function Tb(e){e.register(sm),(function(n){function t(r,s){return"___"+r.toUpperCase()+s+"___"}Object.defineProperties(n.languages["markup-templating"]={},{buildPlaceholders:{value:function(r,s,i,a){if(r.language===s){var o=r.tokenStack=[];r.code=r.code.replace(i,function(l){if(typeof a=="function"&&!a(l))return l;for(var u=o.length,_;r.code.indexOf(_=t(s,u))!==-1;)++u;return o[u]=l,_}),r.grammar=n.languages.markup}}},tokenizePlaceholders:{value:function(r,s){if(r.language!==s||!r.tokenStack)return;r.grammar=n.languages[s];var i=0,a=Object.keys(r.tokenStack);function o(l){for(var u=0;u=a.length);u++){var _=l[u];if(typeof _=="string"||_.content&&typeof _.content=="string"){var d=a[i],p=r.tokenStack[d],m=typeof _=="string"?_:_.content,x=t(s,d),S=m.indexOf(x);if(S>-1){++i;var v=m.substring(0,S),b=new n.Token(s,n.tokenize(p,r.grammar),"language-"+s,p),w=m.substring(S+x.length),y=[];v&&y.push.apply(y,o([v])),y.push(b),w&&y.push.apply(y,o([w])),typeof _=="string"?l.splice.apply(l,[u,1].concat(y)):_.content=y}}else _.content&&o(_.content)}return l}o(r.tokens)}}})})(e)}vS.displayName="php";vS.aliases=[];function vS(e){e.register(Tb),(function(n){var t=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,r=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],s=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,i=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,a=/[{}\[\](),:;]/;n.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:t,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:s,operator:i,punctuation:a};var o={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:n.languages.php},l=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:o}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:o}}];n.languages.insertBefore("php","variable",{string:l,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:t,string:l,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,number:s,operator:i,punctuation:a}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),n.hooks.add("before-tokenize",function(u){if(/<\?/.test(u.code)){var _=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;n.languages["markup-templating"].buildPlaceholders(u,"php",_)}}),n.hooks.add("after-tokenize",function(u){n.languages["markup-templating"].tokenizePlaceholders(u,"php")})})(e)}bS.displayName="python";bS.aliases=["py"];function bS(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}yS.displayName="r";yS.aliases=[];function yS(e){e.languages.r={comment:/#.*/,string:{pattern:/(['"])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},"percent-operator":{pattern:/%[^%\s]*%/,alias:"operator"},boolean:/\b(?:FALSE|TRUE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:Inf|NaN)\b/,/(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/],keyword:/\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,operator:/->?>?|<(?:=|=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,punctuation:/[(){}\[\],;]/}}xS.displayName="ruby";xS.aliases=["rb"];function xS(e){e.register(Uo),(function(n){n.languages.ruby=n.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===||[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),n.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var t={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:n.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete n.languages.ruby.function;var r="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",s=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;n.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+r+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+s),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+s+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),n.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+r),greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+r),greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete n.languages.ruby.string,n.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),n.languages.rb=n.languages.ruby})(e)}wS.displayName="rust";wS.aliases=[];function wS(e){(function(n){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,r=0;r<2;r++)t=t.replace(//g,function(){return t});t=t.replace(//g,function(){return/[^\s\S]/.source}),n.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},n.languages.rust["closure-params"].inside.rest=n.languages.rust,n.languages.rust.attribute.inside.string=n.languages.rust.string})(e)}SS.displayName="sass";SS.aliases=[];function SS(e){e.register(f_),(function(n){n.languages.sass=n.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),n.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete n.languages.sass.atrule;var t=/\$[-\w]+|#\{\$[-\w]+\}/,r=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];n.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:t,operator:r}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:t,operator:r,important:n.languages.sass.important}}}),delete n.languages.sass.property,delete n.languages.sass.important,n.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})})(e)}kS.displayName="scss";kS.aliases=[];function kS(e){e.register(f_),e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}CS.displayName="sql";CS.aliases=[];function CS(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}ES.displayName="swift";ES.aliases=[];function ES(e){e.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},e.languages.swift["string-literal"].forEach(function(n){n.inside.interpolation.inside=e.languages.swift})}NS.displayName="typescript";NS.aliases=["ts"];function NS(e){e.register(jb),(function(n){n.languages.typescript=n.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),n.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete n.languages.typescript.parameter,delete n.languages.typescript["literal-property"];var t=n.languages.extend("typescript",{});delete t["class-name"],n.languages.typescript["class-name"].inside=t,n.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),n.languages.ts=n.languages.typescript})(e)}Ab.displayName="basic";Ab.aliases=[];function Ab(e){e.languages.basic={comment:{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},string:{pattern:/"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,greedy:!0},number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,keyword:/\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SELECT CASE|SHARED|SHELL|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,function:/\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i,punctuation:/[,;:()]/}}zS.displayName="vbnet";zS.aliases=[];function zS(e){e.register(Ab),e.languages.vbnet=e.languages.extend("basic",{comment:[{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},{pattern:/(^|[^\\:])'.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(^|[^"])"(?:""|[^"])*"(?!")/,lookbehind:!0,greedy:!0},keyword:/(?:\b(?:ADDHANDLER|ADDRESSOF|ALIAS|AND|ANDALSO|AS|BEEP|BLOAD|BOOLEAN|BSAVE|BYREF|BYTE|BYVAL|CALL(?: ABSOLUTE)?|CASE|CATCH|CBOOL|CBYTE|CCHAR|CDATE|CDBL|CDEC|CHAIN|CHAR|CHDIR|CINT|CLASS|CLEAR|CLNG|CLOSE|CLS|COBJ|COM|COMMON|CONST|CONTINUE|CSBYTE|CSHORT|CSNG|CSTR|CTYPE|CUINT|CULNG|CUSHORT|DATA|DATE|DECIMAL|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DEFAULT|DELEGATE|DIM|DIRECTCAST|DO|DOUBLE|ELSE|ELSEIF|END|ENUM|ENVIRON|ERASE|ERROR|EVENT|EXIT|FALSE|FIELD|FILES|FINALLY|FOR(?: EACH)?|FRIEND|FUNCTION|GET|GETTYPE|GETXMLNAMESPACE|GLOBAL|GOSUB|GOTO|HANDLES|IF|IMPLEMENTS|IMPORTS|IN|INHERITS|INPUT|INTEGER|INTERFACE|IOCTL|IS|ISNOT|KEY|KILL|LET|LIB|LIKE|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|ME|MKDIR|MOD|MODULE|MUSTINHERIT|MUSTOVERRIDE|MYBASE|MYCLASS|NAME|NAMESPACE|NARROWING|NEW|NEXT|NOT|NOTHING|NOTINHERITABLE|NOTOVERRIDABLE|OBJECT|OF|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPERATOR|OPTION(?: BASE)?|OPTIONAL|OR|ORELSE|OUT|OVERLOADS|OVERRIDABLE|OVERRIDES|PARAMARRAY|PARTIAL|POKE|PRIVATE|PROPERTY|PROTECTED|PUBLIC|PUT|RAISEEVENT|READ|READONLY|REDIM|REM|REMOVEHANDLER|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SBYTE|SELECT(?: CASE)?|SET|SHADOWS|SHARED|SHELL|SHORT|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|STRUCTURE|SUB|SWAP|SYNCLOCK|SYSTEM|THEN|THROW|TIMER|TO|TROFF|TRON|TRUE|TRY|TRYCAST|TYPE|TYPEOF|UINTEGER|ULONG|UNLOCK|UNTIL|USHORT|USING|VIEW PRINT|WAIT|WEND|WHEN|WHILE|WIDENING|WITH|WITHEVENTS|WRITE|WRITEONLY|XOR)|\B(?:#CONST|#ELSE|#ELSEIF|#END|#IF))(?:\$|\b)/i,punctuation:/[,;:(){}]/})}class im{constructor(n,t,r){this.normal=t,this.property=n,r&&(this.space=r)}}im.prototype.normal={};im.prototype.property={};im.prototype.space=void 0;function XI(e,n){const t={},r={};for(const s of e)Object.assign(t,s.property),Object.assign(r,s.normal);return new im(t,r,n)}function hp(e){return e.toLowerCase()}class Ei{constructor(n,t){this.attribute=t,this.property=n}}Ei.prototype.attribute="";Ei.prototype.booleanish=!1;Ei.prototype.boolean=!1;Ei.prototype.commaOrSpaceSeparated=!1;Ei.prototype.commaSeparated=!1;Ei.prototype.defined=!1;Ei.prototype.mustUseProperty=!1;Ei.prototype.number=!1;Ei.prototype.overloadedBoolean=!1;Ei.prototype.property="";Ei.prototype.spaceSeparated=!1;Ei.prototype.space=void 0;let Ibt=0;const Kt=ef(),es=ef(),d3=ef(),Qe=ef(),rr=ef(),Ed=ef(),$i=ef();function ef(){return 2**++Ibt}const f3=Object.freeze(Object.defineProperty({__proto__:null,boolean:Kt,booleanish:es,commaOrSpaceSeparated:$i,commaSeparated:Ed,number:Qe,overloadedBoolean:d3,spaceSeparated:rr},Symbol.toStringTag,{value:"Module"})),Px=Object.keys(f3);class jS extends Ei{constructor(n,t,r,s){let i=-1;if(super(n,t),tj(this,"space",s),typeof r=="number")for(;++i4&&t.slice(0,4)==="data"&&Hbt.test(n)){if(n.charAt(4)==="-"){const i=n.slice(5).replace(nj,Ubt);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=n.slice(4);if(!nj.test(i)){let a=i.replace(Fbt,qbt);a.charAt(0)!=="-"&&(a="-"+a),n="data"+a}}s=jS}return new s(r,n)}function qbt(e){return"-"+e.toLowerCase()}function Ubt(e){return e.charAt(1).toUpperCase()}const iB=XI([ZI,Bbt,tB,nB,rB],"html"),Rb=XI([ZI,$bt,tB,nB,rB],"svg");function rj(e){const n=[],t=String(e||"");let r=t.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=t.length,i=!0);const a=t.slice(s,r).trim();(a||!i)&&n.push(a),s=r+1,r=t.indexOf(",",s)}return n}function Gbt(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const sj=/[#.]/g;function Wbt(e,n){const t=e||"",r={};let s=0,i,a;for(;s=48&&n<=57}function tyt(e){const n=typeof e=="string"?e.charCodeAt(0):e;return n>=97&&n<=102||n>=65&&n<=70||n>=48&&n<=57}function nyt(e){const n=typeof e=="string"?e.charCodeAt(0):e;return n>=97&&n<=122||n>=65&&n<=90}function lj(e){return nyt(e)||lB(e)}const cj=document.createElement("i");function _p(e){const n="&"+e+";";cj.innerHTML=n;const t=cj.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}const ryt=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function syt(e,n){const t={},r=typeof t.additional=="string"?t.additional.charCodeAt(0):t.additional,s=[];let i=0,a=-1,o="",l,u;t.position&&("start"in t.position||"indent"in t.position?(u=t.position.indent,l=t.position.start):l=t.position);let _=(l?l.line:0)||1,d=(l?l.column:0)||1,p=x(),m;for(i--;++i<=e.length;)if(m===10&&(d=(u?u[a]:0)||1),m=e.charCodeAt(i),m===38){const b=e.charCodeAt(i+1);if(b===9||b===10||b===12||b===32||b===38||b===60||Number.isNaN(b)||r&&b===r){o+=String.fromCharCode(m),d++;continue}const w=i+1;let y=w,C=w,E;if(b===35){C=++y;const U=e.charCodeAt(C);U===88||U===120?(E="hexadecimal",C=++y):E="decimal"}else E="named";let N="",T="",z="";const M=E==="named"?lj:E==="decimal"?lB:tyt;for(C--;++C<=e.length;){const U=e.charCodeAt(C);if(!M(U))break;z+=String.fromCharCode(U),E==="named"&&eyt.includes(z)&&(N=z,T=_p(z))}let O=e.charCodeAt(C)===59;if(O){C++;const U=E==="named"?_p(z):!1;U&&(N=z,T=U)}let B=1+C-w,$="";if(!(!O&&t.nonTerminated===!1))if(!z)E!=="named"&&S(4,B);else if(E==="named"){if(O&&!T)S(5,1);else if(N!==z&&(C=y+N.length,B=1+C-y,O=!1),!O){const U=N?1:3;if(t.attribute){const H=e.charCodeAt(C);H===61?(S(U,B),T=""):lj(H)?T="":S(U,B)}else S(U,B)}$=T}else{O||S(2,B);let U=Number.parseInt(z,E==="hexadecimal"?16:10);if(iyt(U))S(7,B),$="�";else if(U in oj)S(6,B),$=oj[U];else{let H="";ayt(U)&&S(6,B),U>65535&&(U-=65536,H+=String.fromCharCode(U>>>10|55296),U=56320|U&1023),$=H+String.fromCharCode(U)}}if($){v(),p=x(),i=C-1,d+=C-w+1,s.push($);const U=x();U.offset++,t.reference&&t.reference.call(t.referenceContext||void 0,$,{start:p,end:U},e.slice(w-1,C)),p=U}else z=e.slice(w-1,C),o+=z,d+=z.length,i=C-1}else m===10&&(_++,a++,d=0),Number.isNaN(m)?v():(o+=String.fromCharCode(m),d++);return s.join("");function x(){return{line:_,column:d,offset:i+((l?l.offset:0)||0)}}function S(b,w){let y;t.warning&&(y=x(),y.column+=w,y.offset+=w,t.warning.call(t.warningContext||void 0,ryt[b],y,b))}function v(){o&&(s.push(o),t.text&&t.text.call(t.textContext||void 0,o,{start:p,end:x()}),o="")}}function iyt(e){return e>=55296&&e<=57343||e>1114111}function ayt(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var oyt=0,Ug={},Ss={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++oyt}),e.__id},clone:function e(n,t){t=t||{};var r,s;switch(Ss.util.type(n)){case"Object":if(s=Ss.util.objId(n),t[s])return t[s];r={},t[s]=r;for(var i in n)n.hasOwnProperty(i)&&(r[i]=e(n[i],t));return r;case"Array":return s=Ss.util.objId(n),t[s]?t[s]:(r=[],t[s]=r,n.forEach(function(a,o){r[o]=e(a,t)}),r);default:return n}}},languages:{plain:Ug,plaintext:Ug,text:Ug,txt:Ug,extend:function(e,n){var t=Ss.util.clone(Ss.languages[e]);for(var r in n)t[r]=n[r];return t},insertBefore:function(e,n,t,r){r=r||Ss.languages;var s=r[e],i={};for(var a in s)if(s.hasOwnProperty(a)){if(a==n)for(var o in t)t.hasOwnProperty(o)&&(i[o]=t[o]);t.hasOwnProperty(a)||(i[a]=s[a])}var l=r[e];return r[e]=i,Ss.languages.DFS(Ss.languages,function(u,_){_===l&&u!=e&&(this[u]=i)}),i},DFS:function e(n,t,r,s){s=s||{};var i=Ss.util.objId;for(var a in n)if(n.hasOwnProperty(a)){t.call(n,a,n[a],r||a);var o=n[a],l=Ss.util.type(o);l==="Object"&&!s[i(o)]?(s[i(o)]=!0,e(o,t,null,s)):l==="Array"&&!s[i(o)]&&(s[i(o)]=!0,e(o,t,a,s))}}},plugins:{},highlight:function(e,n,t){var r={code:e,grammar:n,language:t};if(Ss.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=Ss.tokenize(r.code,r.grammar),Ss.hooks.run("after-tokenize",r),$0.stringify(Ss.util.encode(r.tokens),r.language)},tokenize:function(e,n){var t=n.rest;if(t){for(var r in t)n[r]=t[r];delete n.rest}var s=new lyt;return T1(s,s.head,e),cB(e,s,n,s.head,0),uyt(s)},hooks:{all:{},add:function(e,n){var t=Ss.hooks.all;t[e]=t[e]||[],t[e].push(n)},run:function(e,n){var t=Ss.hooks.all[e];if(!(!t||!t.length))for(var r=0,s;s=t[r++];)s(n)}},Token:$0};function $0(e,n,t,r){this.type=e,this.content=n,this.alias=t,this.length=(r||"").length|0}function uj(e,n,t,r){e.lastIndex=n;var s=e.exec(t);if(s&&r&&s[1]){var i=s[1].length;s.index+=i,s[0]=s[0].slice(i)}return s}function cB(e,n,t,r,s,i){for(var a in t)if(!(!t.hasOwnProperty(a)||!t[a])){var o=t[a];o=Array.isArray(o)?o:[o];for(var l=0;l=i.reach);b+=v.value.length,v=v.next){var w=v.value;if(n.length>e.length)return;if(!(w instanceof $0)){var y=1,C;if(p){if(C=uj(S,b,e,d),!C||C.index>=e.length)break;var z=C.index,E=C.index+C[0].length,N=b;for(N+=v.value.length;z>=N;)v=v.next,N+=v.value.length;if(N-=v.value.length,b=N,v.value instanceof $0)continue;for(var T=v;T!==n.tail&&(Ni.reach&&(i.reach=$);var U=v.prev;O&&(U=T1(n,U,O),b+=O.length),cyt(n,U,y);var H=new $0(a,_?Ss.tokenize(M,_):M,m,M);if(v=T1(n,U,H),B&&T1(n,v,B),y>1){var Y={cause:a+","+l,reach:$};cB(e,n,t,v.prev,b,Y),i&&Y.reach>i.reach&&(i.reach=Y.reach)}}}}}}function lyt(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function T1(e,n,t){var r=n.next,s={value:t,prev:n,next:r};return n.next=s,r.prev=s,e.length++,s}function cyt(e,n,t){for(var r=n.next,s=0;s_td:first-child]:p-0","[&_.openresearch-diff-file.diff-unified_col.diff-gutter-col:nth-child(2)]:w-[7ch]","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:w-[7ch]","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:pt-0 [&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:pe-2.5 [&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:pb-0 [&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:ps-3.5","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:whitespace-nowrap","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:text-end","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:text-diff-gutter-text","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:border-e [&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:border-e-border","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:select-none","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:cursor-default","[&_.openresearch-diff-file_.diff-line:has(.diff-code-insert)]:bg-diff-insert-code","[&_.openresearch-diff-file_.diff-line:has(.diff-code-delete)]:bg-diff-delete-code","[&_.openresearch-diff-file_.diff-code]:py-0 [&_.openresearch-diff-file_.diff-code]:ps-[2ch] [&_.openresearch-diff-file_.diff-code]:pe-4","[&_.openresearch-diff-file_.diff-hunk_+_.diff-hunk_.diff-line:first-child_>_td]:border-t [&_.openresearch-diff-file_.diff-hunk_+_.diff-hunk_.diff-line:first-child_>_td]:border-t-border"].join(" "),yyt=2e3,xyt={highlight(e,n){return jt.highlight(e,n).children}};function wyt(e){return e.type==="normal"?e.newLineNumber:e.lineNumber}function Mb(e){let n=0,t=0;for(const r of e.hunks)for(const s of r.changes)s.type==="insert"?n++:s.type==="delete"&&t++;return{additions:n,deletions:t}}function Syt(e){return e.newPath==="/dev/null"?e.oldPath:(e.oldPath==="/dev/null",e.newPath)}function g3(e){switch(e.type){case"delete":return e.oldPath;case"add":case"modify":return e.newPath;case"rename":case"copy":return`${e.oldPath} → ${e.newPath}`}}function kyt(e){const n=[Lbt(e.hunks,{type:"line"})],t=TS(Syt(e));return t&&jt.registered(t)?ej(e.hunks,{enhancers:n,highlight:!0,language:t,refractor:xyt}):ej(e.hunks,{enhancers:n,highlight:!1})}function fB(e,n){if(!e.trim())return{files:[],failed:!1};try{return{files:r3(e,{nearbySequences:"zip"}),failed:!1}}catch{if(n){const t=Array.from(e.matchAll(/^diff --git /gm),s=>s.index),r=t[t.length-1];if(t.length>1&&r!==void 0)try{return{files:r3(e.slice(0,r),{nearbySequences:"zip"}),failed:!1}}catch{return{files:[],failed:!0}}}return{files:[],failed:!0}}}const Cyt=({change:e,side:n})=>n==="old"?null:wyt(e);function hB({bytesRead:e,byteLimit:n}){return f.jsxs("div",{className:"truncated-notice border border-accent-amber rounded-md bg-accent-amber-subtle py-3 px-3.5 text-sm [&_h4]:mt-0 [&_h4]:mx-0 [&_h4]:mb-1 [&_h4]:text-sm [&_h4]:text-accent-amber [&_p]:m-0 [&_p]:text-subtext",children:[f.jsx("h4",{children:awe()}),f.jsx("p",{children:Iwe({limit:Ne(Ml(n)),read:Ne(Ml(e))})})]})}function _B({file:e,defaultExpanded:n}){const[t,r]=R.useState(n),{additions:s,deletions:i}=R.useMemo(()=>Mb(e),[e]),a=t&&s+i<=yyt,o=R.useMemo(()=>{if(a)try{return kyt(e)}catch{return}},[e,a]);return f.jsxs("section",{className:`diff-file-card overflow-hidden border border-border rounded-md bg-background [&.expanded_.diff-file-header]:border-b [&.expanded_.diff-file-header]:border-b-border ${t?"expanded":""}`,children:[f.jsxs("button",{className:"diff-file-header sticky top-0 z-10 flex items-center justify-between gap-3 w-full text-start py-2 px-3 bg-canvas cursor-pointer [&_.chev]:text-muted [&_.chev]:text-xs [&_.chev]:shrink-0 [&_.chev]:w-3 [&_.path]:flex [&_.path]:items-center [&_.path]:gap-2 [&_.path]:min-w-0 [&_.path]:flex-1 [&_.path_code]:min-w-0 [&_.path_code]:flex-1 [&_.path_code]:overflow-hidden [&_.path_code]:text-ellipsis [&_.path_code]:whitespace-nowrap [&_.path_code]:font-mono [&_.path_code]:text-xs [&_.path_code]:font-medium [&_.path_code]:text-text [&_.stats]:flex [&_.stats]:items-center [&_.stats]:gap-2 [&_.stats]:shrink-0 [&_.stats]:font-mono [&_.stats]:text-xs [&_.stats]:font-medium [&_.stats]:tabular-nums","aria-expanded":t,onClick:()=>r(l=>!l),children:[f.jsx("span",{className:"chev",children:t?f.jsx(qo,{size:14}):f.jsx(Ta,{size:14})}),f.jsx("span",{className:"path",children:f.jsx("code",{children:g3(e)})}),f.jsxs("span",{className:"stats",children:[f.jsxs("span",{className:"diff-stat-add text-accent-green",children:["+",s]}),f.jsxs("span",{className:"diff-stat-del text-accent-red",children:["−",i]})]})]}),t&&(e.hunks.length===0?f.jsx("div",{className:"diff-empty py-2 px-3 text-muted text-sm",children:wwe()}):f.jsx("div",{className:"diff-file-body min-w-0 py-3.5 bg-background",children:f.jsx(rbt,{className:"openresearch-diff-file",diffType:e.type,gutterType:"default",hunks:e.hunks,renderGutter:Cyt,tokens:o,viewType:"unified"})}))]})}function Eyt({files:e,className:n}){return f.jsx("div",{className:n?`${m3} ${n}`:m3,children:e.map((t,r)=>f.jsx(_B,{file:t,defaultExpanded:r===0},`${t.oldPath}→${t.newPath}#${r}`))})}function Nyt(e){switch(e.type){case"add":return"A";case"delete":return"D";case"rename":return"R";case"copy":return"C";case"modify":return"M"}}function pB({diff:e,partial:n=!1}){var p;const t=R.useMemo(()=>fB(e,n),[e,n]),r=t.files,s=R.useMemo(()=>r.map((m,x)=>({file:m,key:`${m.oldPath}→${m.newPath}#${x}`,changes:Mb(m)})),[r]),[i,a]=R.useState(null),[o,l]=R.useState(!1),u=o&&!n,_=s.some(m=>m.key===i)?i:((p=s[0])==null?void 0:p.key)??null,d=s.find(m=>m.key===_)??null;return t.failed?f.jsx("div",{className:"diff-empty py-2 px-3 text-muted text-sm",children:n?vwe():Mwe()}):s.length===0?f.jsx("div",{className:"diff-empty py-2 px-3 text-muted text-sm",children:_we()}):f.jsxs("div",{className:"diff-explorer @container",children:[f.jsxs("div",{className:"diff-explorer-toolbar flex items-center justify-between gap-3 mb-2.5 text-sm [&_button]:py-0.5 [&_button]:px-0 [&_button]:text-muted [&_button]:text-sm [&_button]:font-medium [&_button:hover]:text-text [&_button:hover]:underline [&_button:hover]:underline-offset-2",children:[f.jsx("strong",{className:"font-medium",children:n?s.length===1?jwe():uwe({count:Wt(s.length)}):s.length===1?OD():LD({count:Wt(s.length)})}),!n&&f.jsx("button",{type:"button",onClick:()=>l(m=>!m),children:u?Qxe():Fwe()})]}),u?f.jsx(Eyt,{files:r}):f.jsxs("div",{className:"diff-explorer-layout grid grid-cols-[minmax(180px,_260px)_minmax(0,_1fr)] items-start gap-3.5 [@container((max-width:_960px))]:grid-cols-1",children:[f.jsx("div",{className:"diff-explorer-files sticky top-0 max-h-[min(70vh,_720px)] overflow-auto border border-border rounded-md bg-background [&_button]:grid [&_button]:grid-cols-[18px_minmax(0,_1fr)_auto_auto] [&_button]:items-center [&_button]:gap-[7px] [&_button]:w-full [&_button]:py-2 [&_button]:px-[9px] [&_button]:border-b [&_button]:border-b-border-variant [&_button]:text-text [&_button]:text-start [&_button:last-child]:border-b-0 [&_button:hover]:bg-surface [&_button.active]:bg-surface [&_button.active]:shadow-diff-active [&_code]:overflow-hidden [&_code]:text-ellipsis [&_code]:whitespace-nowrap [&_code]:text-xs [@container((max-width:_960px))]:static [@container((max-width:_960px))]:max-h-55","aria-label":nwe(),children:s.map(m=>f.jsxs("button",{type:"button",className:m.key===_?"active":"","aria-pressed":m.key===_,onClick:()=>a(m.key),children:[f.jsx("span",{className:`diff-file-status font-mono text-xs font-medium text-muted [&.status-add]:text-accent-green [&.status-delete]:text-accent-red [&.status-rename]:text-accent-blue [&.status-copy]:text-accent-blue status-${m.file.type}`,children:Nyt(m.file)}),f.jsx("code",{title:g3(m.file),children:g3(m.file)}),f.jsxs("span",{className:"diff-explorer-stat font-mono text-xs diff-stat-add text-accent-green",children:["+",m.changes.additions]}),f.jsxs("span",{className:"diff-explorer-stat font-mono text-xs diff-stat-del text-accent-red",children:["−",m.changes.deletions]})]},m.key))}),f.jsx("div",{className:`${m3} diff-explorer-preview min-w-0`,children:d&&f.jsx(_B,{file:d.file,defaultExpanded:!0},d.key)})]})]})}function zyt({expanded:e,experiments:n,runs:t,onOpenExperiment:r,rightOffset:s,activeView:i,projectId:a,onCompute:o,sessionId:l,busy:u,onChanges:_,onFiles:d,onArtifacts:p,onExperiments:m}){var y,C;const x=zgt(n,t,l),S=ct({...GL(a),enabled:e}),v=((y=S.data)==null?void 0:y.configuredDefaultBackend)??((C=S.data)==null?void 0:C.defaultBackend),b=v?Od[v]():S.isPending?"…":S.isError?Ya():T4(),w=[{id:"files",label:k4(),Icon:Dd,onClick:d},{id:"artifacts",label:pD(),Icon:M6,onClick:p},{id:"experiments",label:mD(),Icon:db,onClick:m}];return f.jsx("div",{className:"workspace-tools absolute end-3.5 top-7 z-30",style:{insetInlineEnd:s},children:e?f.jsxs("nav",{"aria-label":Cx(),className:"workspace-tools-card flex w-60 flex-col gap-0.5 rounded-xl border border-border bg-background px-1.5 py-2 shadow-elevated",children:[f.jsx("h2",{className:"m-0 px-2 pt-1 pb-2 text-sm font-normal text-subtext",children:Cx()}),w.filter(E=>E.id!=="files").map(({id:E,label:N,Icon:T,onClick:z})=>f.jsx(sr,{className:"min-h-7 py-1","data-onboarding":E==="artifacts"?"nav-artifacts":void 0,onClick:z,children:f.jsxs("span",{className:"flex items-center gap-4",children:[f.jsx(T,{size:15}),N]})},E)),f.jsx(sr,{className:"py-1",onClick:o,children:f.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5",children:[f.jsxs("span",{className:"flex items-center gap-4 text-sm text-text",children:[f.jsx(HO,{size:15,className:"shrink-0"}),_ct()]}),f.jsxs("span",{className:"flex items-center gap-1.5 ps-[31px] text-menu text-subtext",children:[v&&f.jsx(u_,{kind:`${v}_job`,size:12}),f.jsx("span",{className:"wrap-anywhere",children:b})]})]})}),f.jsxs("div",{className:"mt-2 border-t border-border/50 pt-3",children:[f.jsx("h2",{className:"m-0 px-2 pt-1 pb-2 text-sm font-normal text-subtext",children:vct()}),f.jsx(sr,{className:"min-h-7 py-1",onClick:d,children:f.jsxs("span",{className:"flex items-center gap-4",children:[f.jsx(Dd,{size:15}),k4()]})}),l&&f.jsx(jyt,{sessionId:l,busy:u,onChanges:_},l),x.length>0&&f.jsxs("div",{children:[f.jsxs("h2",{className:"m-0 flex items-center gap-4 px-2 py-1 text-sm font-normal text-text",children:[f.jsx("span",{className:"flex w-[15px] shrink-0 justify-center",children:f.jsx(sb,{tone:"success",live:!0})}),f.jsx("span",{children:uct()})]}),x.map(E=>f.jsx(sr,{className:"min-h-7 py-1",onClick:()=>r(E.experiment.id,E.run.id),children:f.jsx("span",{className:"min-w-0 truncate ps-[31px] text-menu text-subtext",title:`${E.experiment.title||E.experiment.slug} · ${U6(Gi(E.run))}`,children:E.experiment.title||E.experiment.slug})},E.run.id))]})]})]}):f.jsx("nav",{"aria-label":Cx(),className:"flex items-center justify-end gap-3",children:w.map(({id:E,label:N,Icon:T,onClick:z})=>f.jsx(Qt,{active:i===E,className:"text-text [&.active]:text-text","data-tip":N,"data-tip-align":E==="experiments"?"end":void 0,"aria-label":N,"aria-pressed":i===E,onClick:z,children:f.jsx(T,{size:15})},E))})})}function jyt({sessionId:e,busy:n,onChanges:t}){var l,u;const r=ct({...fv(e),refetchInterval:n?5e3:!1}),s=R.useRef(n),{refetch:i}=r;R.useEffect(()=>{s.current&&!n&&i(),s.current=n},[n,i]);const a=r.data,o=R.useMemo(()=>{if(!(a!=null&&a.diff)||a.diff.truncated)return null;const _=fB(a.diff.diff,!1);return _.failed?null:_.files.map(Mb).reduce((d,p)=>({additions:d.additions+p.additions,deletions:d.deletions+p.deletions}),{additions:0,deletions:0})},[a==null?void 0:a.diff]);return a!=null&&a.exists?f.jsxs(sr,{className:"min-h-7 py-1",onClick:t,title:a.branch??o6(),children:[f.jsxs("span",{className:"flex min-w-0 items-center gap-4",children:[f.jsx(Jp,{size:15,className:"shrink-0"}),f.jsx("span",{children:CD()})]}),o?f.jsxs("span",{className:"flex shrink-0 gap-1 text-xs tabular-nums",children:[f.jsxs("span",{className:"text-accent-green",children:["+",Wt(o.additions)]}),f.jsxs("span",{className:"text-accent-red",children:["−",Wt(o.deletions)]})]}):f.jsx("span",{className:"shrink-0 text-xs text-subtext",children:((l=a.files)==null?void 0:l.length)===1?OD():LD({count:Wt(((u=a.files)==null?void 0:u.length)??0)})})]}):null}function Tyt(e,n,t){const r=new Array(e);return new Proxy(r,{get(s,i,a){if(typeof i=="string"){const o=i.charCodeAt(0);if(o>=48&&o<=57){const l=+i;if(Number.isInteger(l)&&l>=0&&lr[_]!==u))&&(r=o,s=n(...o),t!=null&&t.onChange&&!(i&&t.skipInitialOnChange)&&t.onChange(s),i=!1),s}return a.updateDeps=o=>{r=o},a}function dj(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const Ayt=(e,n)=>Math.abs(e-n)<1.01,Ryt=(e,n,t)=>{let r;return Object.assign(function(...s){e.clearTimeout(r),r=e.setTimeout(()=>n.apply(this,s),t)},{cancel:()=>{e.clearTimeout(r)}})};let f0;const Fx=()=>{if(f0!==void 0)return f0;if(typeof navigator>"u")return f0=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return f0=!0;const e=navigator.maxTouchPoints;return f0=navigator.platform==="MacIntel"&&e!==void 0&&e>0},fj=e=>{const{offsetWidth:n,offsetHeight:t}=e;return{width:n,height:t}},Myt=e=>e,mB=e=>{const n=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-n+1,s=new Array(r);for(let i=0;i{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;const s=a=>{const{width:o,height:l}=a;n({width:Math.round(o),height:Math.round(l)})};if(s(fj(t)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const o=()=>{const l=a[0];if(l!=null&&l.borderBoxSize){const u=l.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(fj(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},pv={passive:!0},Lyt=typeof window>"u"?!0:"onscrollend"in window,Oyt=(e,n,t)=>{const r=e.scrollElement;if(!r)return;const s=e.targetWindow;if(!s)return;const i=e.options.useScrollendEvent&&Lyt;let a=0;const o=i?null:Ryt(s,()=>n(a,!1),e.options.isScrollingResetDelay),l=d=>()=>{a=t(r),o==null||o(),n(a,d)},u=l(!0),_=l(!1);return r.addEventListener("scroll",u,pv),i&&r.addEventListener("scrollend",_,pv),()=>{r.removeEventListener("scroll",u),i&&r.removeEventListener("scrollend",_),o==null||o.cancel()}},Iyt=(e,n)=>Oyt(e,n,t=>{const{horizontal:r,isRtl:s}=e.options;return r?t.scrollLeft*(s&&-1||1):t.scrollTop}),Byt=(e,n,t)=>{if(t.options.useCachedMeasurements){const r=t.indexFromElement(e),s=t.options.getItemKey(r);return t.itemSizeCache.get(s)??t.options.estimateSize(r)}if(n!=null&&n.borderBoxSize){const r=n.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}if(!n){const r=t.indexFromElement(e),s=t.options.getItemKey(r),i=t.itemSizeCache.get(s);if(i!==void 0)return i}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},$yt=(e,{adjustments:n=0,behavior:t},r)=>{var s,i;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:e+n,behavior:t})},Pyt=$yt;class Fyt{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this._clampedAdjustment=null,this.elementsCache=new Map,this.now=()=>{var t,r,s;return((s=(r=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:r.now)==null?void 0:s.call(r))??Date.now()},this.observer=(()=>{let t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const a=()=>{const o=i.target,l=this.indexFromElement(o);if(!o.isConnected){this.observer.unobserve(o);for(const[u,_]of this.elementsCache)if(_===o){this.elementsCache.delete(u);break}return}this.isIndexInRange(l)&&this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(o,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),t=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=t=>{var r,s;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Myt,rangeExtractor:mB,onChange:()=>{},measureElement:Byt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const p in t){const m=t[p];m!==void 0&&(i[p]=m)}const a=this.options;let o=null,l=null,u=!1;if(a!==void 0&&a.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const p=a.count,m=i.count,x=this.getMeasurements(),S=p>0?((r=x[0])==null?void 0:r.key)??a.getItemKey(0):null,v=p>0?((s=x[p-1])==null?void 0:s.key)??a.getItemKey(p-1):null;if(m!==p||p>0&&m>0&&(i.getItemKey(0)!==S||i.getItemKey(m-1)!==v)){u=!0;const y=p>0?this.getVirtualItemForOffset(this.getScrollOffset())??x[0]:null;y&&(o=[y.key,this.getScrollOffset()-y.start]);const C=i.followOnAppend===!0?"auto":i.followOnAppend||null;C&&m>p&&this.isAtEnd(a.scrollEndThreshold)&&(p===0||i.getItemKey(m-1)!==v)&&(l=C)}}this.options=i,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let _=!1,d=0;if(o&&this.scrollOffset!==null){const[p,m]=o,x=this.getMeasurements(),{count:S,getItemKey:v}=this.options;let b=0;for(;b{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,t)},this.maybeNotify=qf(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._clampedAdjustment=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,a)=>{if(a&&this._intendedScrollOffset===null&&i===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this._clampedAdjustment!==null&&Math.abs(i-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null),this.scrollAdjustments=0;const o=this.getScrollOffset();this.scrollDirection=a?o===i?this.scrollDirection:o{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},o=()=>{this._iosTouching=!1,!(!Fx()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",a,pv),i.addEventListener("touchend",o,pv),this.unsubs.push(()=>{i.removeEventListener("touchstart",a),i.removeEventListener("touchend",o),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const s=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled){const[i,a,o,l]=s;i!==null&&!o&&(Fx()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),o&&this.scrollToEnd({behavior:o})}this._retryClampedAdjustment()},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;const{target:t,maxAtWrite:r}=this._clampedAdjustment,s=this.getMaxScrollOffset();s>r+.5&&(this._clampedAdjustment=t>s+.5?{target:t,maxAtWrite:s}:null,this._scrollToOffset(t,{adjustments:void 0,behavior:void 0}))},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const t=this.getScrollOffset(),r=this.getMaxScrollOffset();if(t<0||t>r)return;if(this._iosDeferredAdjustment<0&&t>=r-1){this._iosDeferredAdjustment=0;return}const s=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=s,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=qf(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,r,s,i,a,o,l,u)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:t,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a,lanes:o,laneAssignmentMode:l,gap:u}),{key:!1}),this.isIndexInRange=t=>t>=0&&t[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a,lanes:o,laneAssignmentMode:l,gap:u},_)=>{const d=this.itemSizeCache;if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const b of this.laneAssignments.keys())b>=t&&this.laneAssignments.delete(b);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(b=>{this.itemSizeCache.set(b.key,b.size)}));const p=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),o===1){const b=t*2;let w=this._flatMeasurements;if(!w||w.length0&&E.set(w.subarray(0,p*2)),w=E,this._flatMeasurements=w}let y;if(p===0)y=r+s;else{const E=p-1;y=w[E*2]+w[E*2+1]+u}for(let E=p;E1){C=y;const O=x[C],B=O!==void 0?m[O]:void 0;E=B?B.end+u:r+s}else if(v===o){let O=0,B=S[0],$=x[0];for(let U=1;Uthis.options.debug}),this.calculateRange=qf(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,s,i)=>t.length===0||r===0?(this.range=null,null):(this.range=qyt(t,r,s,i,i===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=qf(()=>{let t=null,r=null;const s=this.calculateRange();return s&&(t=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r]},(t,r,s,i,a)=>i===null||a===null?[]:t({startIndex:i,endIndex:a,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const r=this.options.indexAttribute,s=t.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(s!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,s-i),o=Math.min(this.options.count-1,s+i);return t>=a&&t<=o}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((a,o)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(o))});return}const r=this.indexFromElement(t);if(!this.isIndexInRange(r))return;const s=this.options.getItemKey(r),i=this.elementsCache.get(s);i!==t&&(i&&this.observer.unobserve(i),this.observer.observe(t),this.elementsCache.set(s,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,r)=>{var s,i;if(!this.isIndexInRange(t))return;let a,o,l;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)l=this.options.getItemKey(t),o=u[t*2],a=u[t*2+1];else{const p=this.measurementsCache[t];if(!p)return;l=p.key,o=p.start,a=p.size}const _=this.itemSizeCache.get(l)??a,d=r-_;if(d!==0){const p=this.options.anchorTo==="end"&&((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,m=p?this.getTotalSize():0,x=this.getScrollOffset()+this.scrollAdjustments,v=!this.itemSizeCache.has(l)?o[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const s=[];for(let i=0,a=t.length;ithis.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length===0)return;const s=this._flatMeasurements,i=this.options.lanes===1&&s!=null,a=gB(0,r.length-1,i?o=>s[o*2]:o=>dj(r[o]).start,t);return dj(r[a])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,r,s=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=t>=a+i?"end":"start"),r==="center"?t+=(s-i)/2:r==="end"&&(t-=i);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.getSize(),i=this.getScrollOffset(),a=this.measurementsCache[t];if(!a)return;if(r==="auto")if(a.end>=i+s-this.options.scrollPaddingEnd)r="end";else if(a.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),r];const o=r==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,a.size),r]},this.scrollToOffset=(t,{align:r="start",behavior:s="auto"}={})=>{this._iosDeferredAdjustment=0;const i=this.getOffsetForAlignment(t,r),a=this.now();this.scrollState={index:null,align:r,behavior:s,startedAt:a,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:r="auto",behavior:s="auto"}={})=>{this._iosDeferredAdjustment=0,t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getOffsetForIndex(t,r);if(!i)return;const[a,o]=i,l=this.now();this.scrollState={index:t,align:o,behavior:s,startedAt:l,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:r="auto"}={})=>{const s=this.getScrollOffset()+t,i=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){const i=r.length-1,a=this._flatMeasurements;a!=null?s=a[i*2]+a[i*2+1]:s=((t=r[i])==null?void 0:t.end)??0}else{const i=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&i.some(o=>o===null);){const o=r[a];i[o.lane]===null&&(i[o.lane]=o.end),a--}s=Math.max(...i.filter(o=>o!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(this.itemSizeCache.size===0)return t;const r=this.getMeasurements();for(const s of r)s&&this.itemSizeCache.has(s.key)&&t.push({index:s.index,key:s.key,start:s.start,size:s.size,end:s.end,lane:s.lane});return t},this._scrollToOffset=(t,{adjustments:r,behavior:s})=>{this._intendedScrollOffset=t+(r??0),this.options.scrollToFn(t,{behavior:s,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(n)}applyScrollAdjustment(n,t){if(n===0)return!1;if(Fx()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this._iosDeferredAdjustment+=n,!1;{const r=this.getScrollOffset()+this.scrollAdjustments+n,s=this.scrollElement,i=s!==null&&("scrollHeight"in s||"document"in s)?this.getMaxScrollOffset():null;return this._clampedAdjustment=i!==null&&r>i+.5?{target:r,maxAtWrite:i}:null,this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=n,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0}}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=r?r[0]:this.scrollState.lastTargetOffset,i=1,a=s!==this.scrollState.lastTargetOffset;if(!a&&Ayt(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==s&&this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,a){const o=this.getSize()||600,l=Math.abs(s-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&l>o;this.scrollState.lastTargetOffset=s,u||(this.scrollState.behavior="auto"),this._scrollToOffset(s,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const gB=(e,n,t,r)=>{for(;e<=n;){const s=(e+n)/2|0,i=t(s);if(ir)n=s-1;else return s}return e>0?e-1:0};function Hyt(e,n,t){let r=0;for(;r<=n;){const s=(r+n)/2|0,i=e[s*2];if(it)n=s-1;else return s}return r>0?r-1:0}function qyt(e,n,t,r,s){const i=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:i};if(r===1&&s!==null){const u=Hyt(s,i,t);let _=u;const d=t+n;for(;_e[u].start,t),l=o;if(r===1)for(;l1){const u=Array(r).fill(0);for(;ld=0&&_.some(d=>d>=t);){const d=e[o];_[d.lane]=d.start,o--}o=Math.max(0,o-o%r),l=Math.min(i,l+(r-1-l%r))}return{startIndex:o,endIndex:l}}const Hx=typeof document<"u"?R.useLayoutEffect:R.useEffect;function Uyt({useFlushSync:e=!0,directDomUpdates:n=!1,directDomUpdatesMode:t="transform",...r}){const s=R.useReducer(_=>_+1,0)[1],i=R.useRef({enabled:n,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=n,i.current.mode=t;const a=_=>{const d=i.current;if(!d.enabled||!d.container)return;const p=_.getTotalSize();if(p!==d.lastSize){d.lastSize=p;const m=_.options.horizontal?"width":"height";d.container.style[m]=`${p}px`}},o=_=>{const d=i.current;if(!d.enabled||!d.container)return;a(_);const p=!!_.options.horizontal,m=d.mode==="transform",x=p?"left":"top",S=_.options.scrollMargin,v=_.getVirtualItems();for(const b of v){const w=b.start-S,y=_.elementsCache.get(b.key);y&&d.lastPositions.get(y)!==w&&(d.lastPositions.set(y,w),m?y.style.transform=p?`translate3d(${w}px, 0, 0)`:`translate3d(0, ${w}px, 0)`:y.style[x]=`${w}px`)}},l={...r,onChange:(_,d)=>{var p;const m=i.current;let x=!0;if(m.enabled){o(_);const S=_.range,v=m.prevRange;x=!v||v.isScrolling!==_.isScrolling||v.startIndex!==(S==null?void 0:S.startIndex)||v.endIndex!==(S==null?void 0:S.endIndex),x&&(m.prevRange=S?{startIndex:S.startIndex,endIndex:S.endIndex,isScrolling:_.isScrolling}:null)}x&&(e&&d?no.flushSync(s):s()),(p=r.onChange)==null||p.call(r,_,d)}},[u]=R.useState(()=>{const _=new Fyt(l);return Object.assign(_,{containerRef:d=>{const p=i.current;if(p.container=d,p.lastSize=null,d&&p.enabled){const m=_.getTotalSize();p.lastSize=m;const x=_.options.horizontal?"width":"height";d.style[x]=`${m}px`}}})});return u.setOptions(l),Hx(()=>u._didMount(),[]),Hx(()=>(a(u),u._willUpdate())),Hx(()=>{o(u)}),u}function Gyt(e){return Uyt({observeElementRect:Dyt,observeElementOffset:Iyt,scrollToFn:Pyt,...e})}function Wyt(e,n){if(!n)return e;const t=new Map(e.map(i=>[i.id,i]));let r=t.get(n);if(!r)return e;const s=[];for(;r;)s.push(r),r=r.parentId?t.get(r.parentId):void 0;return s.reverse()}function Vyt(e,n,t){var a;let r=e;for(;r&&r.role!=="user";)r=r.parentId?n.get(r.parentId):void 0;const s=e.role==="user"?e.parentId??null:(r==null?void 0:r.id)??null,i=(a=t.get(s))==null?void 0:a.filter(o=>o.role===e.role);return i!=null&&i.length?i:[e]}function Kyt(e,n,t,r){const s=e.filter(u=>!r(u.id)),i=new Map(s.map(u=>[u.id,u])),a=new Map;for(const u of s){const _=u.parentId??null,d=a.get(_);d?d.push(u):a.set(_,[u])}const o=new Set(n.map(u=>u.id)),l=new Map;for(const u of t){const _=Vyt(u,i,a),d=_.findIndex(p=>o.has(p.id));l.set(u.id,{count:_.length,index:d,prevId:d>0?_[d-1].id:void 0,nextId:d<_.length-1?_[d+1].id:void 0})}return l}function Gh(e,n){var t;if(e.type==="tool"&&((t=e.tool)==null?void 0:t.toLowerCase())==="interrupted")return!1;if(e.type==="prompt"){if(!e.prompt)return!1;if(e.prompt.kind==="permission"){if(e.prompt.resolved)return!1;if(n!==void 0)return e.id===n}return!0}return e.type==="reasoning"?!1:e.type==="text"?!!e.text:!0}function am(e){return e.id==="turn-retry"||e.id==="turn-recovery"}function vB(e){var n;for(let t=e.length-1;t>=0;t--){const r=e[t];if(!(r.type==="steer"||am(r)||!Gh(r)))return r.type!=="tool"||((n=r.state)==null?void 0:n.status)==="error"?null:r.id}return null}function bB(e){const n=e.at(-1);if((n==null?void 0:n.role)!=="assistant")return null;const t=vB(n.parts);return t?{messageId:n.id,toolId:t}:null}function Qyt(e){const n=e.at(-1);if((n==null?void 0:n.role)!=="assistant")return!1;for(let t=n.parts.length-1;t>=0;t--){const r=n.parts[t];if(!(r.type==="steer"||am(r)))return r.type==="text"&&!!r.text}return!1}function Yyt(e,n,t,r,s){const i=[...n].filter(o=>!t.has(o)&&r.some(l=>l.id===o)&&o!==s);if(i.length===0&&!(s&&e.has(s)))return e;const a=new Set(e);for(const o of i)a.add(o);return s&&a.delete(s),a}function Xyt(e,n){if(e.some(r=>{var s;return r.type==="prompt"&&!((s=r.prompt)!=null&&s.resolved)}))return{work:[],answer:e};let t=e.findIndex(r=>r.type==="text"&&r.phase==="final_answer");if(t<0&&!n&&!e.some(r=>r.phase))for(let r=e.length-1;r>=0;r--){const s=e[r];if(s.type!=="reasoning"){if(s.type!=="text")break;s.text&&(t=r)}}return t<0||!n&&!e.slice(t).some(r=>Gh(r))||!e.slice(0,t).some(r=>Gh(r))?{work:[],answer:e}:{work:e.slice(0,t),answer:e.slice(t)}}function yB(e){var n,t;return e.type==="tool"&&e.tool==="error"&&/^(?:ActionRequiredError:\s*)?Named models unavailable\b/i.test(((t=(n=e.state)==null?void 0:n.error)==null?void 0:t.trim())??"")}function v3(e){var t,r,s;if(yB(e)||((r=(t=e.state)==null?void 0:t.input)==null?void 0:r.errorKind)==="claude_usage_limit")return!0;const n=e.type==="text"?e.text:e.tool==="error"?(s=e.state)==null?void 0:s.error:null;return e.type==="tool"&&e.tool==="error"&&n&&/usageLimitExceeded|rateLimitExceeded|insufficient_quota|(?:usage|rate|session) limit|(?:exceeded|exhausted) (?:your |the |current )*quota|insufficient (?:credits|balance)|(?:credit|quota)[ _-](?:exhausted|exceeded)/i.test(n)?!0:!!(n&&(/^(?:claude: )?you(?:'ve| have) reached your .+ limit\./i.test(n.trim())&&n.includes("claude.ai/settings/usage")||/^(?:claude: )?you(?:'ve| have) hit your session limit · resets /i.test(n.trim())))}const xo=e=>new Intl.NumberFormat(j()).format(e);function Zyt(e,n){const t=typeof e.nextRetryAt=="number"?Math.max(0,Math.ceil((e.nextRetryAt-n)/1e3)):null;return e.retryOwner==="native"&&e.maximum==null&&t==null?AIe():typeof e.attempt=="number"&&typeof e.maximum=="number"&&t!=null?SIe({attempt:xo(e.attempt),maximum:xo(e.maximum),seconds:xo(t)}):typeof e.attempt=="number"&&typeof e.maximum=="number"?bIe({attempt:xo(e.attempt),maximum:xo(e.maximum)}):typeof e.attempt=="number"&&t!=null?NIe({attempt:xo(e.attempt),seconds:xo(t)}):typeof e.attempt=="number"?pIe({attempt:xo(e.attempt)}):t!=null?LIe({seconds:xo(t)}):tL()}function Jyt(e,n){if(typeof e!="number")return $Ie();const t=Math.max(0,Math.ceil((e-n)/1e3));return qIe({seconds:xo(t)})}function xB(e){return e==="retry"||e==="continue"?e:null}function e2t(e){const n={};return e.model!==void 0&&(n.model=e.model),e.serviceTier!==void 0&&(n.serviceTier=e.serviceTier),e.permissionMode!==void 0&&(n.permissionMode=e.permissionMode),e.planMode!==void 0&&(n.planMode=e.planMode),e.reasoningLevel!==void 0&&(n.reasoningLevel=e.reasoningLevel),n}function t2t(e){return["*","?","[","]","{","}"].some(n=>e.includes(n))}function hj(e){return e==="alphaxiv"||e==="openalex"||e==="biorxiv"?e:void 0}function n2t(e){const n=e.trim(),t=n.toLowerCase();if(t.includes("biorxiv.org"))return"biorxiv";if(t.includes("openalex.org"))return"openalex";const r=n.match(/10\.\d+\/\S+/);if(r)return r[0].startsWith("10.1101/")?"biorxiv":"openalex";const s=n.split("/").pop()??"";return/^W\d+$/i.test(s)?"openalex":"alphaxiv"}function AS(e){const n=[];let t="",r=!1,s=null;const i=()=>{r&&n.push(t),t="",r=!1};for(let a=0;a(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go["class-name"]}aS.displayName="ini";aS.aliases=[];function aS(e){e.languages.ini={comment:{pattern:/(^[ \f\t\v]*)[#;][^\n\r]*/m,lookbehind:!0},section:{pattern:/(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/\[|\]/}},key:{pattern:/(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^("|').+(?=\1$)/,lookbehind:!0}}},punctuation:/=/}}oS.displayName="java";oS.aliases=[];function oS(e){e.register(Uo),(function(n){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,r=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,s={pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};n.languages.java=n.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[s,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:s.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:s.inside}],keyword:t,function:[n.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),n.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),n.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":s,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:s.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:s.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,function(){return t.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}lS.displayName="regex";lS.aliases=[];function lS(e){(function(n){var t={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},r=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,s={pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},i={pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},a="(?:[^\\\\-]|"+r.source+")",o=RegExp(a+"-"+a),l={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"};n.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:o,inside:{escape:r,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":t,"char-set":i,escape:r}},"special-escape":t,"char-set":s,backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":l}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:r,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]||&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}cS.displayName="json";cS.aliases=["webmanifest"];function cS(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}uS.displayName="kotlin";uS.aliases=["kt","kts"];function uS(e){e.register(Uo),(function(n){n.languages.kotlin=n.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete n.languages.kotlin["class-name"];var t={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:n.languages.kotlin}};n.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:t},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:t},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete n.languages.kotlin.string,n.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),n.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),n.languages.kt=n.languages.kotlin,n.languages.kts=n.languages.kotlin})(e)}dS.displayName="less";dS.aliases=[];function dS(e){e.register(l_),e.languages.less=e.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),e.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}})}fS.displayName="lua";fS.aliases=[];function fS(e){e.languages.lua={comment:/^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,string:{pattern:/(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,greedy:!0},number:/\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,keyword:/\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,function:/(?!\d)\w+(?=\s*(?:[({]))/,operator:[/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,{pattern:/(^|[^.])\.\.(?!\.)/,lookbehind:!0}],punctuation:/[\[\](){},;]|\.+|:+/}}hS.displayName="makefile";hS.aliases=[];function hS(e){e.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/}}_S.displayName="yaml";_S.aliases=["yml"];function _S(e){(function(n){var t=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,s="(?:"+r.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+r.source+")?)",i=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),a=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(l,u){u=(u||"").replace(/m/g,"")+"m";var _=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return s}).replace(/<>/g,function(){return l});return RegExp(_,u)}n.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return s})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return s}).replace(/<>/g,function(){return"(?:"+i+"|"+a+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:o(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:o(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:o(a),lookbehind:!0,greedy:!0},number:{pattern:o(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},n.languages.yml=n.languages.yaml})(e)}pS.displayName="markdown";pS.aliases=["md"];function pS(e){e.register(sm),(function(n){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(o){return o=o.replace(//g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+o+")")}var s=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return s}),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;n.languages.markdown=n.languages.extend("markup",{}),n.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:n.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+a+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+a+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(s),inside:n.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(s),alias:"important",inside:n.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(o){["url","bold","italic","strike","code-snippet"].forEach(function(l){o!==l&&(n.languages.markdown[o].inside.content.inside[l]=n.languages.markdown[l])})}),n.hooks.add("after-tokenize",function(o){if(o.language!=="markdown"&&o.language!=="md")return;function l(u){if(!(!u||typeof u=="string"))for(var _=0,d=u.length;_]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete e.languages.objectivec["class-name"],e.languages.objc=e.languages.objectivec}gS.displayName="perl";gS.aliases=[];function gS(e){(function(n){var t=/(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;n.languages.perl={comment:[{pattern:/(^\s*)=\w[\s\S]*?=cut.*/m,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],string:[{pattern:RegExp(/\b(?:q|qq|qw|qx)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,t].join("|")+")"),greedy:!0},{pattern:/("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,greedy:!0},{pattern:/'(?:[^'\\\r\n]|\\.)*'/,greedy:!0}],regex:[{pattern:RegExp(/\b(?:m|qr)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,t].join("|")+")"+/[msixpodualngc]*/.source),greedy:!0},{pattern:RegExp(/(^|[^-])\b(?:s|tr|y)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,/([a-zA-Z0-9])(?:(?!\3)[^\\]|\\[\s\S])*\3(?:(?!\3)[^\\]|\\[\s\S])*\3/.source,t+/\s*/.source+t].join("|")+")"+/[msixpodualngcer]*/.source),lookbehind:!0,greedy:!0},{pattern:/\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|x|xor)\b))/,greedy:!0}],variable:[/[&*$@%]\{\^[A-Z]+\}/,/[&*$@%]\^[A-Z_]/,/[&*$@%]#?(?=\{)/,/[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+(?![\w$]))+(?:::)*/,/[&*$@%]\d+/,/(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/],filehandle:{pattern:/<(?![<=])\S*?>|\b_\b/,alias:"symbol"},"v-string":{pattern:/v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,alias:"string"},function:{pattern:/(\bsub[ \t]+)\w+/,lookbehind:!0},keyword:/\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,operator:/-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\b/,punctuation:/[{}[\];(),:]/}})(e)}jb.displayName="markup-templating";jb.aliases=[];function jb(e){e.register(sm),(function(n){function t(r,s){return"___"+r.toUpperCase()+s+"___"}Object.defineProperties(n.languages["markup-templating"]={},{buildPlaceholders:{value:function(r,s,i,a){if(r.language===s){var o=r.tokenStack=[];r.code=r.code.replace(i,function(l){if(typeof a=="function"&&!a(l))return l;for(var u=o.length,_;r.code.indexOf(_=t(s,u))!==-1;)++u;return o[u]=l,_}),r.grammar=n.languages.markup}}},tokenizePlaceholders:{value:function(r,s){if(r.language!==s||!r.tokenStack)return;r.grammar=n.languages[s];var i=0,a=Object.keys(r.tokenStack);function o(l){for(var u=0;u=a.length);u++){var _=l[u];if(typeof _=="string"||_.content&&typeof _.content=="string"){var d=a[i],p=r.tokenStack[d],m=typeof _=="string"?_:_.content,x=t(s,d),S=m.indexOf(x);if(S>-1){++i;var v=m.substring(0,S),b=new n.Token(s,n.tokenize(p,r.grammar),"language-"+s,p),w=m.substring(S+x.length),y=[];v&&y.push.apply(y,o([v])),y.push(b),w&&y.push.apply(y,o([w])),typeof _=="string"?l.splice.apply(l,[u,1].concat(y)):_.content=y}}else _.content&&o(_.content)}return l}o(r.tokens)}}})})(e)}vS.displayName="php";vS.aliases=[];function vS(e){e.register(jb),(function(n){var t=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,r=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],s=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,i=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,a=/[{}\[\](),:;]/;n.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:t,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:s,operator:i,punctuation:a};var o={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:n.languages.php},l=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:o}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:o}}];n.languages.insertBefore("php","variable",{string:l,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:t,string:l,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,number:s,operator:i,punctuation:a}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),n.hooks.add("before-tokenize",function(u){if(/<\?/.test(u.code)){var _=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;n.languages["markup-templating"].buildPlaceholders(u,"php",_)}}),n.hooks.add("after-tokenize",function(u){n.languages["markup-templating"].tokenizePlaceholders(u,"php")})})(e)}bS.displayName="python";bS.aliases=["py"];function bS(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}yS.displayName="r";yS.aliases=[];function yS(e){e.languages.r={comment:/#.*/,string:{pattern:/(['"])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},"percent-operator":{pattern:/%[^%\s]*%/,alias:"operator"},boolean:/\b(?:FALSE|TRUE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:Inf|NaN)\b/,/(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/],keyword:/\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,operator:/->?>?|<(?:=|=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,punctuation:/[(){}\[\],;]/}}xS.displayName="ruby";xS.aliases=["rb"];function xS(e){e.register(Uo),(function(n){n.languages.ruby=n.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===||[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),n.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var t={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:n.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete n.languages.ruby.function;var r="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",s=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;n.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+r+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+s),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+s+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),n.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+r),greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+r),greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete n.languages.ruby.string,n.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),n.languages.rb=n.languages.ruby})(e)}wS.displayName="rust";wS.aliases=[];function wS(e){(function(n){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,r=0;r<2;r++)t=t.replace(//g,function(){return t});t=t.replace(//g,function(){return/[^\s\S]/.source}),n.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},n.languages.rust["closure-params"].inside.rest=n.languages.rust,n.languages.rust.attribute.inside.string=n.languages.rust.string})(e)}SS.displayName="sass";SS.aliases=[];function SS(e){e.register(l_),(function(n){n.languages.sass=n.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),n.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete n.languages.sass.atrule;var t=/\$[-\w]+|#\{\$[-\w]+\}/,r=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];n.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:t,operator:r}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:t,operator:r,important:n.languages.sass.important}}}),delete n.languages.sass.property,delete n.languages.sass.important,n.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})})(e)}kS.displayName="scss";kS.aliases=[];function kS(e){e.register(l_),e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}CS.displayName="sql";CS.aliases=[];function CS(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}ES.displayName="swift";ES.aliases=[];function ES(e){e.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},e.languages.swift["string-literal"].forEach(function(n){n.inside.interpolation.inside=e.languages.swift})}NS.displayName="typescript";NS.aliases=["ts"];function NS(e){e.register(zb),(function(n){n.languages.typescript=n.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),n.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete n.languages.typescript.parameter,delete n.languages.typescript["literal-property"];var t=n.languages.extend("typescript",{});delete t["class-name"],n.languages.typescript["class-name"].inside=t,n.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),n.languages.ts=n.languages.typescript})(e)}Tb.displayName="basic";Tb.aliases=[];function Tb(e){e.languages.basic={comment:{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},string:{pattern:/"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,greedy:!0},number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,keyword:/\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SELECT CASE|SHARED|SHELL|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,function:/\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i,punctuation:/[,;:()]/}}zS.displayName="vbnet";zS.aliases=[];function zS(e){e.register(Tb),e.languages.vbnet=e.languages.extend("basic",{comment:[{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},{pattern:/(^|[^\\:])'.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(^|[^"])"(?:""|[^"])*"(?!")/,lookbehind:!0,greedy:!0},keyword:/(?:\b(?:ADDHANDLER|ADDRESSOF|ALIAS|AND|ANDALSO|AS|BEEP|BLOAD|BOOLEAN|BSAVE|BYREF|BYTE|BYVAL|CALL(?: ABSOLUTE)?|CASE|CATCH|CBOOL|CBYTE|CCHAR|CDATE|CDBL|CDEC|CHAIN|CHAR|CHDIR|CINT|CLASS|CLEAR|CLNG|CLOSE|CLS|COBJ|COM|COMMON|CONST|CONTINUE|CSBYTE|CSHORT|CSNG|CSTR|CTYPE|CUINT|CULNG|CUSHORT|DATA|DATE|DECIMAL|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DEFAULT|DELEGATE|DIM|DIRECTCAST|DO|DOUBLE|ELSE|ELSEIF|END|ENUM|ENVIRON|ERASE|ERROR|EVENT|EXIT|FALSE|FIELD|FILES|FINALLY|FOR(?: EACH)?|FRIEND|FUNCTION|GET|GETTYPE|GETXMLNAMESPACE|GLOBAL|GOSUB|GOTO|HANDLES|IF|IMPLEMENTS|IMPORTS|IN|INHERITS|INPUT|INTEGER|INTERFACE|IOCTL|IS|ISNOT|KEY|KILL|LET|LIB|LIKE|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|ME|MKDIR|MOD|MODULE|MUSTINHERIT|MUSTOVERRIDE|MYBASE|MYCLASS|NAME|NAMESPACE|NARROWING|NEW|NEXT|NOT|NOTHING|NOTINHERITABLE|NOTOVERRIDABLE|OBJECT|OF|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPERATOR|OPTION(?: BASE)?|OPTIONAL|OR|ORELSE|OUT|OVERLOADS|OVERRIDABLE|OVERRIDES|PARAMARRAY|PARTIAL|POKE|PRIVATE|PROPERTY|PROTECTED|PUBLIC|PUT|RAISEEVENT|READ|READONLY|REDIM|REM|REMOVEHANDLER|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SBYTE|SELECT(?: CASE)?|SET|SHADOWS|SHARED|SHELL|SHORT|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|STRUCTURE|SUB|SWAP|SYNCLOCK|SYSTEM|THEN|THROW|TIMER|TO|TROFF|TRON|TRUE|TRY|TRYCAST|TYPE|TYPEOF|UINTEGER|ULONG|UNLOCK|UNTIL|USHORT|USING|VIEW PRINT|WAIT|WEND|WHEN|WHILE|WIDENING|WITH|WITHEVENTS|WRITE|WRITEONLY|XOR)|\B(?:#CONST|#ELSE|#ELSEIF|#END|#IF))(?:\$|\b)/i,punctuation:/[,;:(){}]/})}class im{constructor(n,t,r){this.normal=t,this.property=n,r&&(this.space=r)}}im.prototype.normal={};im.prototype.property={};im.prototype.space=void 0;function XI(e,n){const t={},r={};for(const s of e)Object.assign(t,s.property),Object.assign(r,s.normal);return new im(t,r,n)}function hp(e){return e.toLowerCase()}class Si{constructor(n,t){this.attribute=t,this.property=n}}Si.prototype.attribute="";Si.prototype.booleanish=!1;Si.prototype.boolean=!1;Si.prototype.commaOrSpaceSeparated=!1;Si.prototype.commaSeparated=!1;Si.prototype.defined=!1;Si.prototype.mustUseProperty=!1;Si.prototype.number=!1;Si.prototype.overloadedBoolean=!1;Si.prototype.property="";Si.prototype.spaceSeparated=!1;Si.prototype.space=void 0;let Ibt=0;const Qt=Yd(),Jr=Yd(),d3=Yd(),Ke=Yd(),sr=Yd(),wd=Yd(),Oi=Yd();function Yd(){return 2**++Ibt}const f3=Object.freeze(Object.defineProperty({__proto__:null,boolean:Qt,booleanish:Jr,commaOrSpaceSeparated:Oi,commaSeparated:wd,number:Ke,overloadedBoolean:d3,spaceSeparated:sr},Symbol.toStringTag,{value:"Module"})),Px=Object.keys(f3);class jS extends Si{constructor(n,t,r,s){let i=-1;if(super(n,t),tj(this,"space",s),typeof r=="number")for(;++i4&&t.slice(0,4)==="data"&&Hbt.test(n)){if(n.charAt(4)==="-"){const i=n.slice(5).replace(nj,Ubt);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=n.slice(4);if(!nj.test(i)){let a=i.replace(Fbt,qbt);a.charAt(0)!=="-"&&(a="-"+a),n="data"+a}}s=jS}return new s(r,n)}function qbt(e){return"-"+e.toLowerCase()}function Ubt(e){return e.charAt(1).toUpperCase()}const iB=XI([ZI,Bbt,tB,nB,rB],"html"),Ab=XI([ZI,$bt,tB,nB,rB],"svg");function rj(e){const n=[],t=String(e||"");let r=t.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=t.length,i=!0);const a=t.slice(s,r).trim();(a||!i)&&n.push(a),s=r+1,r=t.indexOf(",",s)}return n}function Gbt(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const sj=/[#.]/g;function Wbt(e,n){const t=e||"",r={};let s=0,i,a;for(;s=48&&n<=57}function tyt(e){const n=typeof e=="string"?e.charCodeAt(0):e;return n>=97&&n<=102||n>=65&&n<=70||n>=48&&n<=57}function nyt(e){const n=typeof e=="string"?e.charCodeAt(0):e;return n>=97&&n<=122||n>=65&&n<=90}function lj(e){return nyt(e)||lB(e)}const cj=document.createElement("i");function _p(e){const n="&"+e+";";cj.innerHTML=n;const t=cj.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}const ryt=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function syt(e,n){const t={},r=typeof t.additional=="string"?t.additional.charCodeAt(0):t.additional,s=[];let i=0,a=-1,o="",l,u;t.position&&("start"in t.position||"indent"in t.position?(u=t.position.indent,l=t.position.start):l=t.position);let _=(l?l.line:0)||1,d=(l?l.column:0)||1,p=x(),m;for(i--;++i<=e.length;)if(m===10&&(d=(u?u[a]:0)||1),m=e.charCodeAt(i),m===38){const b=e.charCodeAt(i+1);if(b===9||b===10||b===12||b===32||b===38||b===60||Number.isNaN(b)||r&&b===r){o+=String.fromCharCode(m),d++;continue}const w=i+1;let y=w,C=w,E;if(b===35){C=++y;const U=e.charCodeAt(C);U===88||U===120?(E="hexadecimal",C=++y):E="decimal"}else E="named";let N="",T="",z="";const M=E==="named"?lj:E==="decimal"?lB:tyt;for(C--;++C<=e.length;){const U=e.charCodeAt(C);if(!M(U))break;z+=String.fromCharCode(U),E==="named"&&eyt.includes(z)&&(N=z,T=_p(z))}let I=e.charCodeAt(C)===59;if(I){C++;const U=E==="named"?_p(z):!1;U&&(N=z,T=U)}let B=1+C-w,$="";if(!(!I&&t.nonTerminated===!1))if(!z)E!=="named"&&S(4,B);else if(E==="named"){if(I&&!T)S(5,1);else if(N!==z&&(C=y+N.length,B=1+C-y,I=!1),!I){const U=N?1:3;if(t.attribute){const H=e.charCodeAt(C);H===61?(S(U,B),T=""):lj(H)?T="":S(U,B)}else S(U,B)}$=T}else{I||S(2,B);let U=Number.parseInt(z,E==="hexadecimal"?16:10);if(iyt(U))S(7,B),$="�";else if(U in oj)S(6,B),$=oj[U];else{let H="";ayt(U)&&S(6,B),U>65535&&(U-=65536,H+=String.fromCharCode(U>>>10|55296),U=56320|U&1023),$=H+String.fromCharCode(U)}}if($){v(),p=x(),i=C-1,d+=C-w+1,s.push($);const U=x();U.offset++,t.reference&&t.reference.call(t.referenceContext||void 0,$,{start:p,end:U},e.slice(w-1,C)),p=U}else z=e.slice(w-1,C),o+=z,d+=z.length,i=C-1}else m===10&&(_++,a++,d=0),Number.isNaN(m)?v():(o+=String.fromCharCode(m),d++);return s.join("");function x(){return{line:_,column:d,offset:i+((l?l.offset:0)||0)}}function S(b,w){let y;t.warning&&(y=x(),y.column+=w,y.offset+=w,t.warning.call(t.warningContext||void 0,ryt[b],y,b))}function v(){o&&(s.push(o),t.text&&t.text.call(t.textContext||void 0,o,{start:p,end:x()}),o="")}}function iyt(e){return e>=55296&&e<=57343||e>1114111}function ayt(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var oyt=0,Ug={},ys={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++oyt}),e.__id},clone:function e(n,t){t=t||{};var r,s;switch(ys.util.type(n)){case"Object":if(s=ys.util.objId(n),t[s])return t[s];r={},t[s]=r;for(var i in n)n.hasOwnProperty(i)&&(r[i]=e(n[i],t));return r;case"Array":return s=ys.util.objId(n),t[s]?t[s]:(r=[],t[s]=r,n.forEach(function(a,o){r[o]=e(a,t)}),r);default:return n}}},languages:{plain:Ug,plaintext:Ug,text:Ug,txt:Ug,extend:function(e,n){var t=ys.util.clone(ys.languages[e]);for(var r in n)t[r]=n[r];return t},insertBefore:function(e,n,t,r){r=r||ys.languages;var s=r[e],i={};for(var a in s)if(s.hasOwnProperty(a)){if(a==n)for(var o in t)t.hasOwnProperty(o)&&(i[o]=t[o]);t.hasOwnProperty(a)||(i[a]=s[a])}var l=r[e];return r[e]=i,ys.languages.DFS(ys.languages,function(u,_){_===l&&u!=e&&(this[u]=i)}),i},DFS:function e(n,t,r,s){s=s||{};var i=ys.util.objId;for(var a in n)if(n.hasOwnProperty(a)){t.call(n,a,n[a],r||a);var o=n[a],l=ys.util.type(o);l==="Object"&&!s[i(o)]?(s[i(o)]=!0,e(o,t,null,s)):l==="Array"&&!s[i(o)]&&(s[i(o)]=!0,e(o,t,a,s))}}},plugins:{},highlight:function(e,n,t){var r={code:e,grammar:n,language:t};if(ys.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=ys.tokenize(r.code,r.grammar),ys.hooks.run("after-tokenize",r),B0.stringify(ys.util.encode(r.tokens),r.language)},tokenize:function(e,n){var t=n.rest;if(t){for(var r in t)n[r]=t[r];delete n.rest}var s=new lyt;return T1(s,s.head,e),cB(e,s,n,s.head,0),uyt(s)},hooks:{all:{},add:function(e,n){var t=ys.hooks.all;t[e]=t[e]||[],t[e].push(n)},run:function(e,n){var t=ys.hooks.all[e];if(!(!t||!t.length))for(var r=0,s;s=t[r++];)s(n)}},Token:B0};function B0(e,n,t,r){this.type=e,this.content=n,this.alias=t,this.length=(r||"").length|0}function uj(e,n,t,r){e.lastIndex=n;var s=e.exec(t);if(s&&r&&s[1]){var i=s[1].length;s.index+=i,s[0]=s[0].slice(i)}return s}function cB(e,n,t,r,s,i){for(var a in t)if(!(!t.hasOwnProperty(a)||!t[a])){var o=t[a];o=Array.isArray(o)?o:[o];for(var l=0;l=i.reach);b+=v.value.length,v=v.next){var w=v.value;if(n.length>e.length)return;if(!(w instanceof B0)){var y=1,C;if(p){if(C=uj(S,b,e,d),!C||C.index>=e.length)break;var z=C.index,E=C.index+C[0].length,N=b;for(N+=v.value.length;z>=N;)v=v.next,N+=v.value.length;if(N-=v.value.length,b=N,v.value instanceof B0)continue;for(var T=v;T!==n.tail&&(Ni.reach&&(i.reach=$);var U=v.prev;I&&(U=T1(n,U,I),b+=I.length),cyt(n,U,y);var H=new B0(a,_?ys.tokenize(M,_):M,m,M);if(v=T1(n,U,H),B&&T1(n,v,B),y>1){var Y={cause:a+","+l,reach:$};cB(e,n,t,v.prev,b,Y),i&&Y.reach>i.reach&&(i.reach=Y.reach)}}}}}}function lyt(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function T1(e,n,t){var r=n.next,s={value:t,prev:n,next:r};return n.next=s,r.prev=s,e.length++,s}function cyt(e,n,t){for(var r=n.next,s=0;s_td:first-child]:p-0","[&_.openresearch-diff-file.diff-unified_col.diff-gutter-col:nth-child(2)]:w-[7ch]","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:w-[7ch]","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:pt-0 [&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:pe-2.5 [&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:pb-0 [&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:ps-3.5","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:whitespace-nowrap","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:text-end","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:text-diff-gutter-text","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:border-e [&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:border-e-border","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:select-none","[&_.openresearch-diff-file.diff-unified_.diff-line_>_td:nth-child(2)]:cursor-default","[&_.openresearch-diff-file_.diff-line:has(.diff-code-insert)]:bg-diff-insert-code","[&_.openresearch-diff-file_.diff-line:has(.diff-code-delete)]:bg-diff-delete-code","[&_.openresearch-diff-file_.diff-code]:py-0 [&_.openresearch-diff-file_.diff-code]:ps-[2ch] [&_.openresearch-diff-file_.diff-code]:pe-4","[&_.openresearch-diff-file_.diff-hunk_+_.diff-hunk_.diff-line:first-child_>_td]:border-t [&_.openresearch-diff-file_.diff-hunk_+_.diff-hunk_.diff-line:first-child_>_td]:border-t-border"].join(" "),yyt=2e3,xyt={highlight(e,n){return zt.highlight(e,n).children}};function wyt(e){return e.type==="normal"?e.newLineNumber:e.lineNumber}function Rb(e){let n=0,t=0;for(const r of e.hunks)for(const s of r.changes)s.type==="insert"?n++:s.type==="delete"&&t++;return{additions:n,deletions:t}}function Syt(e){return e.newPath==="/dev/null"?e.oldPath:(e.oldPath==="/dev/null",e.newPath)}function g3(e){switch(e.type){case"delete":return e.oldPath;case"add":case"modify":return e.newPath;case"rename":case"copy":return`${e.oldPath} → ${e.newPath}`}}function kyt(e){const n=[Lbt(e.hunks,{type:"line"})],t=TS(Syt(e));return t&&zt.registered(t)?ej(e.hunks,{enhancers:n,highlight:!0,language:t,refractor:xyt}):ej(e.hunks,{enhancers:n,highlight:!1})}function fB(e,n){if(!e.trim())return{files:[],failed:!1};try{return{files:r3(e,{nearbySequences:"zip"}),failed:!1}}catch{if(n){const t=Array.from(e.matchAll(/^diff --git /gm),s=>s.index),r=t[t.length-1];if(t.length>1&&r!==void 0)try{return{files:r3(e.slice(0,r),{nearbySequences:"zip"}),failed:!1}}catch{return{files:[],failed:!0}}}return{files:[],failed:!0}}}const Cyt=({change:e,side:n})=>n==="old"?null:wyt(e);function hB({bytesRead:e,byteLimit:n}){return f.jsxs("div",{className:"truncated-notice border border-accent-amber rounded-md bg-accent-amber-subtle py-3 px-3.5 text-sm [&_h4]:mt-0 [&_h4]:mx-0 [&_h4]:mb-1 [&_h4]:text-sm [&_h4]:text-accent-amber [&_p]:m-0 [&_p]:text-subtext",children:[f.jsx("h4",{children:awe()}),f.jsx("p",{children:Iwe({limit:Ne(Al(n)),read:Ne(Al(e))})})]})}function _B({file:e,defaultExpanded:n}){const[t,r]=R.useState(n),{additions:s,deletions:i}=R.useMemo(()=>Rb(e),[e]),a=t&&s+i<=yyt,o=R.useMemo(()=>{if(a)try{return kyt(e)}catch{return}},[e,a]);return f.jsxs("section",{className:`diff-file-card overflow-hidden border border-border rounded-md bg-background [&.expanded_.diff-file-header]:border-b [&.expanded_.diff-file-header]:border-b-border ${t?"expanded":""}`,children:[f.jsxs("button",{className:"diff-file-header sticky top-0 z-10 flex items-center justify-between gap-3 w-full text-start py-2 px-3 bg-canvas cursor-pointer [&_.chev]:text-muted [&_.chev]:text-xs [&_.chev]:shrink-0 [&_.chev]:w-3 [&_.path]:flex [&_.path]:items-center [&_.path]:gap-2 [&_.path]:min-w-0 [&_.path]:flex-1 [&_.path_code]:min-w-0 [&_.path_code]:flex-1 [&_.path_code]:overflow-hidden [&_.path_code]:text-ellipsis [&_.path_code]:whitespace-nowrap [&_.path_code]:font-mono [&_.path_code]:text-xs [&_.path_code]:font-medium [&_.path_code]:text-text [&_.stats]:flex [&_.stats]:items-center [&_.stats]:gap-2 [&_.stats]:shrink-0 [&_.stats]:font-mono [&_.stats]:text-xs [&_.stats]:font-medium [&_.stats]:tabular-nums","aria-expanded":t,onClick:()=>r(l=>!l),children:[f.jsx("span",{className:"chev",children:t?f.jsx(qo,{size:14}):f.jsx(Ca,{size:14})}),f.jsx("span",{className:"path",children:f.jsx("code",{children:g3(e)})}),f.jsxs("span",{className:"stats",children:[f.jsxs("span",{className:"diff-stat-add text-accent-green",children:["+",s]}),f.jsxs("span",{className:"diff-stat-del text-accent-red",children:["−",i]})]})]}),t&&(e.hunks.length===0?f.jsx("div",{className:"diff-empty py-2 px-3 text-muted text-sm",children:wwe()}):f.jsx("div",{className:"diff-file-body min-w-0 py-3.5 bg-background",children:f.jsx(rbt,{className:"openresearch-diff-file",diffType:e.type,gutterType:"default",hunks:e.hunks,renderGutter:Cyt,tokens:o,viewType:"unified"})}))]})}function Eyt({files:e,className:n}){return f.jsx("div",{className:n?`${m3} ${n}`:m3,children:e.map((t,r)=>f.jsx(_B,{file:t,defaultExpanded:r===0},`${t.oldPath}→${t.newPath}#${r}`))})}function Nyt(e){switch(e.type){case"add":return"A";case"delete":return"D";case"rename":return"R";case"copy":return"C";case"modify":return"M"}}function pB({diff:e,partial:n=!1}){var p;const t=R.useMemo(()=>fB(e,n),[e,n]),r=t.files,s=R.useMemo(()=>r.map((m,x)=>({file:m,key:`${m.oldPath}→${m.newPath}#${x}`,changes:Rb(m)})),[r]),[i,a]=R.useState(null),[o,l]=R.useState(!1),u=o&&!n,_=s.some(m=>m.key===i)?i:((p=s[0])==null?void 0:p.key)??null,d=s.find(m=>m.key===_)??null;return t.failed?f.jsx("div",{className:"diff-empty py-2 px-3 text-muted text-sm",children:n?vwe():Mwe()}):s.length===0?f.jsx("div",{className:"diff-empty py-2 px-3 text-muted text-sm",children:_we()}):f.jsxs("div",{className:"diff-explorer @container",children:[f.jsxs("div",{className:"diff-explorer-toolbar flex items-center justify-between gap-3 mb-2.5 text-sm [&_button]:py-0.5 [&_button]:px-0 [&_button]:text-muted [&_button]:text-sm [&_button]:font-medium [&_button:hover]:text-text [&_button:hover]:underline [&_button:hover]:underline-offset-2",children:[f.jsx("strong",{className:"font-medium",children:n?s.length===1?jwe():uwe({count:Wt(s.length)}):s.length===1?OD():LD({count:Wt(s.length)})}),!n&&f.jsx("button",{type:"button",onClick:()=>l(m=>!m),children:u?Qxe():Fwe()})]}),u?f.jsx(Eyt,{files:r}):f.jsxs("div",{className:"diff-explorer-layout grid grid-cols-[minmax(180px,_260px)_minmax(0,_1fr)] items-start gap-3.5 [@container((max-width:_960px))]:grid-cols-1",children:[f.jsx("div",{className:"diff-explorer-files sticky top-0 max-h-[min(70vh,_720px)] overflow-auto border border-border rounded-md bg-background [&_button]:grid [&_button]:grid-cols-[18px_minmax(0,_1fr)_auto_auto] [&_button]:items-center [&_button]:gap-[7px] [&_button]:w-full [&_button]:py-2 [&_button]:px-[9px] [&_button]:border-b [&_button]:border-b-border-variant [&_button]:text-text [&_button]:text-start [&_button:last-child]:border-b-0 [&_button:hover]:bg-surface [&_button.active]:bg-surface [&_button.active]:shadow-diff-active [&_code]:overflow-hidden [&_code]:text-ellipsis [&_code]:whitespace-nowrap [&_code]:text-xs [@container((max-width:_960px))]:static [@container((max-width:_960px))]:max-h-55","aria-label":nwe(),children:s.map(m=>f.jsxs("button",{type:"button",className:m.key===_?"active":"","aria-pressed":m.key===_,onClick:()=>a(m.key),children:[f.jsx("span",{className:`diff-file-status font-mono text-xs font-medium text-muted [&.status-add]:text-accent-green [&.status-delete]:text-accent-red [&.status-rename]:text-accent-blue [&.status-copy]:text-accent-blue status-${m.file.type}`,children:Nyt(m.file)}),f.jsx("code",{title:g3(m.file),children:g3(m.file)}),f.jsxs("span",{className:"diff-explorer-stat font-mono text-xs diff-stat-add text-accent-green",children:["+",m.changes.additions]}),f.jsxs("span",{className:"diff-explorer-stat font-mono text-xs diff-stat-del text-accent-red",children:["−",m.changes.deletions]})]},m.key))}),f.jsx("div",{className:`${m3} diff-explorer-preview min-w-0`,children:d&&f.jsx(_B,{file:d.file,defaultExpanded:!0},d.key)})]})]})}function zyt({expanded:e,experiments:n,runs:t,onOpenExperiment:r,rightOffset:s,activeView:i,projectId:a,onCompute:o,sessionId:l,busy:u,onChanges:_,onFiles:d,onArtifacts:p,onExperiments:m}){var y,C;const x=zgt(n,t,l),S=ot({...GL(a),enabled:e}),v=((y=S.data)==null?void 0:y.configuredDefaultBackend)??((C=S.data)==null?void 0:C.defaultBackend),b=v?Rd[v]():S.isPending?"…":S.isError?Ka():T4(),w=[{id:"files",label:k4(),Icon:Td,onClick:d},{id:"artifacts",label:pD(),Icon:M6,onClick:p},{id:"experiments",label:mD(),Icon:ub,onClick:m}];return f.jsx("div",{className:"workspace-tools absolute end-3.5 top-7 z-30",style:{insetInlineEnd:s},children:e?f.jsxs("nav",{"aria-label":Cx(),className:"workspace-tools-card flex w-60 flex-col gap-0.5 rounded-xl border border-border bg-background px-1.5 py-2 shadow-elevated",children:[f.jsx("h2",{className:"m-0 px-2 pt-1 pb-2 text-sm font-normal text-subtext",children:Cx()}),w.filter(E=>E.id!=="files").map(({id:E,label:N,Icon:T,onClick:z})=>f.jsx(ir,{className:"min-h-7 py-1","data-onboarding":E==="artifacts"?"nav-artifacts":void 0,onClick:z,children:f.jsxs("span",{className:"flex items-center gap-4",children:[f.jsx(T,{size:15}),N]})},E)),f.jsx(ir,{className:"py-1",onClick:o,children:f.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5",children:[f.jsxs("span",{className:"flex items-center gap-4 text-sm text-text",children:[f.jsx(HO,{size:15,className:"shrink-0"}),_ct()]}),f.jsxs("span",{className:"flex items-center gap-1.5 ps-[31px] text-menu text-subtext",children:[v&&f.jsx(a_,{kind:`${v}_job`,size:12}),f.jsx("span",{className:"wrap-anywhere",children:b})]})]})}),f.jsxs("div",{className:"mt-2 border-t border-border/50 pt-3",children:[f.jsx("h2",{className:"m-0 px-2 pt-1 pb-2 text-sm font-normal text-subtext",children:vct()}),f.jsx(ir,{className:"min-h-7 py-1",onClick:d,children:f.jsxs("span",{className:"flex items-center gap-4",children:[f.jsx(Td,{size:15}),k4()]})}),l&&f.jsx(jyt,{sessionId:l,busy:u,onChanges:_},l),x.length>0&&f.jsxs("div",{children:[f.jsxs("h2",{className:"m-0 flex items-center gap-4 px-2 py-1 text-sm font-normal text-text",children:[f.jsx("span",{className:"flex w-[15px] shrink-0 justify-center",children:f.jsx(rb,{tone:"success",live:!0})}),f.jsx("span",{children:uct()})]}),x.map(E=>f.jsx(ir,{className:"min-h-7 py-1",onClick:()=>r(E.experiment.id,E.run.id),children:f.jsx("span",{className:"min-w-0 truncate ps-[31px] text-menu text-subtext",title:`${E.experiment.title||E.experiment.slug} · ${U6(Hi(E.run))}`,children:E.experiment.title||E.experiment.slug})},E.run.id))]})]})]}):f.jsx("nav",{"aria-label":Cx(),className:"flex items-center justify-end gap-3",children:w.map(({id:E,label:N,Icon:T,onClick:z})=>f.jsx(Yt,{active:i===E,className:"text-text [&.active]:text-text","data-tip":N,"data-tip-align":E==="experiments"?"end":void 0,"aria-label":N,"aria-pressed":i===E,onClick:z,children:f.jsx(T,{size:15})},E))})})}function jyt({sessionId:e,busy:n,onChanges:t}){var l,u;const r=ot({...fv(e),refetchInterval:n?5e3:!1}),s=R.useRef(n),{refetch:i}=r;R.useEffect(()=>{s.current&&!n&&i(),s.current=n},[n,i]);const a=r.data,o=R.useMemo(()=>{if(!(a!=null&&a.diff)||a.diff.truncated)return null;const _=fB(a.diff.diff,!1);return _.failed?null:_.files.map(Rb).reduce((d,p)=>({additions:d.additions+p.additions,deletions:d.deletions+p.deletions}),{additions:0,deletions:0})},[a==null?void 0:a.diff]);return a!=null&&a.exists?f.jsxs(ir,{className:"min-h-7 py-1",onClick:t,title:a.branch??o6(),children:[f.jsxs("span",{className:"flex min-w-0 items-center gap-4",children:[f.jsx(Jp,{size:15,className:"shrink-0"}),f.jsx("span",{children:CD()})]}),o?f.jsxs("span",{className:"flex shrink-0 gap-1 text-xs tabular-nums",children:[f.jsxs("span",{className:"text-accent-green",children:["+",Wt(o.additions)]}),f.jsxs("span",{className:"text-accent-red",children:["−",Wt(o.deletions)]})]}):f.jsx("span",{className:"shrink-0 text-xs text-subtext",children:((l=a.files)==null?void 0:l.length)===1?OD():LD({count:Wt(((u=a.files)==null?void 0:u.length)??0)})})]}):null}function Tyt(e,n,t){const r=new Array(e);return new Proxy(r,{get(s,i,a){if(typeof i=="string"){const o=i.charCodeAt(0);if(o>=48&&o<=57){const l=+i;if(Number.isInteger(l)&&l>=0&&lr[_]!==u))&&(r=o,s=n(...o),t!=null&&t.onChange&&!(i&&t.skipInitialOnChange)&&t.onChange(s),i=!1),s}return a.updateDeps=o=>{r=o},a}function dj(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const Ayt=(e,n)=>Math.abs(e-n)<1.01,Ryt=(e,n,t)=>{let r;return Object.assign(function(...s){e.clearTimeout(r),r=e.setTimeout(()=>n.apply(this,s),t)},{cancel:()=>{e.clearTimeout(r)}})};let f0;const Fx=()=>{if(f0!==void 0)return f0;if(typeof navigator>"u")return f0=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return f0=!0;const e=navigator.maxTouchPoints;return f0=navigator.platform==="MacIntel"&&e!==void 0&&e>0},fj=e=>{const{offsetWidth:n,offsetHeight:t}=e;return{width:n,height:t}},Myt=e=>e,mB=e=>{const n=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-n+1,s=new Array(r);for(let i=0;i{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;const s=a=>{const{width:o,height:l}=a;n({width:Math.round(o),height:Math.round(l)})};if(s(fj(t)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const o=()=>{const l=a[0];if(l!=null&&l.borderBoxSize){const u=l.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(fj(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},pv={passive:!0},Lyt=typeof window>"u"?!0:"onscrollend"in window,Oyt=(e,n,t)=>{const r=e.scrollElement;if(!r)return;const s=e.targetWindow;if(!s)return;const i=e.options.useScrollendEvent&&Lyt;let a=0;const o=i?null:Ryt(s,()=>n(a,!1),e.options.isScrollingResetDelay),l=d=>()=>{a=t(r),o==null||o(),n(a,d)},u=l(!0),_=l(!1);return r.addEventListener("scroll",u,pv),i&&r.addEventListener("scrollend",_,pv),()=>{r.removeEventListener("scroll",u),i&&r.removeEventListener("scrollend",_),o==null||o.cancel()}},Iyt=(e,n)=>Oyt(e,n,t=>{const{horizontal:r,isRtl:s}=e.options;return r?t.scrollLeft*(s&&-1||1):t.scrollTop}),Byt=(e,n,t)=>{if(t.options.useCachedMeasurements){const r=t.indexFromElement(e),s=t.options.getItemKey(r);return t.itemSizeCache.get(s)??t.options.estimateSize(r)}if(n!=null&&n.borderBoxSize){const r=n.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}if(!n){const r=t.indexFromElement(e),s=t.options.getItemKey(r),i=t.itemSizeCache.get(s);if(i!==void 0)return i}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},$yt=(e,{adjustments:n=0,behavior:t},r)=>{var s,i;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:e+n,behavior:t})},Pyt=$yt;class Fyt{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this._clampedAdjustment=null,this.elementsCache=new Map,this.now=()=>{var t,r,s;return((s=(r=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:r.now)==null?void 0:s.call(r))??Date.now()},this.observer=(()=>{let t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const a=()=>{const o=i.target,l=this.indexFromElement(o);if(!o.isConnected){this.observer.unobserve(o);for(const[u,_]of this.elementsCache)if(_===o){this.elementsCache.delete(u);break}return}this.isIndexInRange(l)&&this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(o,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),t=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=t=>{var r,s;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Myt,rangeExtractor:mB,onChange:()=>{},measureElement:Byt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const p in t){const m=t[p];m!==void 0&&(i[p]=m)}const a=this.options;let o=null,l=null,u=!1;if(a!==void 0&&a.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const p=a.count,m=i.count,x=this.getMeasurements(),S=p>0?((r=x[0])==null?void 0:r.key)??a.getItemKey(0):null,v=p>0?((s=x[p-1])==null?void 0:s.key)??a.getItemKey(p-1):null;if(m!==p||p>0&&m>0&&(i.getItemKey(0)!==S||i.getItemKey(m-1)!==v)){u=!0;const y=p>0?this.getVirtualItemForOffset(this.getScrollOffset())??x[0]:null;y&&(o=[y.key,this.getScrollOffset()-y.start]);const C=i.followOnAppend===!0?"auto":i.followOnAppend||null;C&&m>p&&this.isAtEnd(a.scrollEndThreshold)&&(p===0||i.getItemKey(m-1)!==v)&&(l=C)}}this.options=i,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let _=!1,d=0;if(o&&this.scrollOffset!==null){const[p,m]=o,x=this.getMeasurements(),{count:S,getItemKey:v}=this.options;let b=0;for(;b{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,t)},this.maybeNotify=$f(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._clampedAdjustment=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,a)=>{if(a&&this._intendedScrollOffset===null&&i===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this._clampedAdjustment!==null&&Math.abs(i-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null),this.scrollAdjustments=0;const o=this.getScrollOffset();this.scrollDirection=a?o===i?this.scrollDirection:o{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},o=()=>{this._iosTouching=!1,!(!Fx()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",a,pv),i.addEventListener("touchend",o,pv),this.unsubs.push(()=>{i.removeEventListener("touchstart",a),i.removeEventListener("touchend",o),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const s=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled){const[i,a,o,l]=s;i!==null&&!o&&(Fx()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),o&&this.scrollToEnd({behavior:o})}this._retryClampedAdjustment()},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;const{target:t,maxAtWrite:r}=this._clampedAdjustment,s=this.getMaxScrollOffset();s>r+.5&&(this._clampedAdjustment=t>s+.5?{target:t,maxAtWrite:s}:null,this._scrollToOffset(t,{adjustments:void 0,behavior:void 0}))},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const t=this.getScrollOffset(),r=this.getMaxScrollOffset();if(t<0||t>r)return;if(this._iosDeferredAdjustment<0&&t>=r-1){this._iosDeferredAdjustment=0;return}const s=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=s,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=$f(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,r,s,i,a,o,l,u)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:t,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a,lanes:o,laneAssignmentMode:l,gap:u}),{key:!1}),this.isIndexInRange=t=>t>=0&&t[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a,lanes:o,laneAssignmentMode:l,gap:u},_)=>{const d=this.itemSizeCache;if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const b of this.laneAssignments.keys())b>=t&&this.laneAssignments.delete(b);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(b=>{this.itemSizeCache.set(b.key,b.size)}));const p=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),o===1){const b=t*2;let w=this._flatMeasurements;if(!w||w.length0&&E.set(w.subarray(0,p*2)),w=E,this._flatMeasurements=w}let y;if(p===0)y=r+s;else{const E=p-1;y=w[E*2]+w[E*2+1]+u}for(let E=p;E1){C=y;const I=x[C],B=I!==void 0?m[I]:void 0;E=B?B.end+u:r+s}else if(v===o){let I=0,B=S[0],$=x[0];for(let U=1;Uthis.options.debug}),this.calculateRange=$f(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,s,i)=>t.length===0||r===0?(this.range=null,null):(this.range=qyt(t,r,s,i,i===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=$f(()=>{let t=null,r=null;const s=this.calculateRange();return s&&(t=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r]},(t,r,s,i,a)=>i===null||a===null?[]:t({startIndex:i,endIndex:a,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const r=this.options.indexAttribute,s=t.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(s!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,s-i),o=Math.min(this.options.count-1,s+i);return t>=a&&t<=o}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((a,o)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(o))});return}const r=this.indexFromElement(t);if(!this.isIndexInRange(r))return;const s=this.options.getItemKey(r),i=this.elementsCache.get(s);i!==t&&(i&&this.observer.unobserve(i),this.observer.observe(t),this.elementsCache.set(s,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,r)=>{var s,i;if(!this.isIndexInRange(t))return;let a,o,l;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)l=this.options.getItemKey(t),o=u[t*2],a=u[t*2+1];else{const p=this.measurementsCache[t];if(!p)return;l=p.key,o=p.start,a=p.size}const _=this.itemSizeCache.get(l)??a,d=r-_;if(d!==0){const p=this.options.anchorTo==="end"&&((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,m=p?this.getTotalSize():0,x=this.getScrollOffset()+this.scrollAdjustments,v=!this.itemSizeCache.has(l)?o[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const s=[];for(let i=0,a=t.length;ithis.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length===0)return;const s=this._flatMeasurements,i=this.options.lanes===1&&s!=null,a=gB(0,r.length-1,i?o=>s[o*2]:o=>dj(r[o]).start,t);return dj(r[a])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,r,s=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=t>=a+i?"end":"start"),r==="center"?t+=(s-i)/2:r==="end"&&(t-=i);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.getSize(),i=this.getScrollOffset(),a=this.measurementsCache[t];if(!a)return;if(r==="auto")if(a.end>=i+s-this.options.scrollPaddingEnd)r="end";else if(a.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),r];const o=r==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,a.size),r]},this.scrollToOffset=(t,{align:r="start",behavior:s="auto"}={})=>{this._iosDeferredAdjustment=0;const i=this.getOffsetForAlignment(t,r),a=this.now();this.scrollState={index:null,align:r,behavior:s,startedAt:a,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:r="auto",behavior:s="auto"}={})=>{this._iosDeferredAdjustment=0,t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getOffsetForIndex(t,r);if(!i)return;const[a,o]=i,l=this.now();this.scrollState={index:t,align:o,behavior:s,startedAt:l,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:r="auto"}={})=>{const s=this.getScrollOffset()+t,i=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){const i=r.length-1,a=this._flatMeasurements;a!=null?s=a[i*2]+a[i*2+1]:s=((t=r[i])==null?void 0:t.end)??0}else{const i=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&i.some(o=>o===null);){const o=r[a];i[o.lane]===null&&(i[o.lane]=o.end),a--}s=Math.max(...i.filter(o=>o!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(this.itemSizeCache.size===0)return t;const r=this.getMeasurements();for(const s of r)s&&this.itemSizeCache.has(s.key)&&t.push({index:s.index,key:s.key,start:s.start,size:s.size,end:s.end,lane:s.lane});return t},this._scrollToOffset=(t,{adjustments:r,behavior:s})=>{this._intendedScrollOffset=t+(r??0),this.options.scrollToFn(t,{behavior:s,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(n)}applyScrollAdjustment(n,t){if(n===0)return!1;if(Fx()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this._iosDeferredAdjustment+=n,!1;{const r=this.getScrollOffset()+this.scrollAdjustments+n,s=this.scrollElement,i=s!==null&&("scrollHeight"in s||"document"in s)?this.getMaxScrollOffset():null;return this._clampedAdjustment=i!==null&&r>i+.5?{target:r,maxAtWrite:i}:null,this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=n,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0}}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=r?r[0]:this.scrollState.lastTargetOffset,i=1,a=s!==this.scrollState.lastTargetOffset;if(!a&&Ayt(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==s&&this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,a){const o=this.getSize()||600,l=Math.abs(s-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&l>o;this.scrollState.lastTargetOffset=s,u||(this.scrollState.behavior="auto"),this._scrollToOffset(s,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const gB=(e,n,t,r)=>{for(;e<=n;){const s=(e+n)/2|0,i=t(s);if(ir)n=s-1;else return s}return e>0?e-1:0};function Hyt(e,n,t){let r=0;for(;r<=n;){const s=(r+n)/2|0,i=e[s*2];if(it)n=s-1;else return s}return r>0?r-1:0}function qyt(e,n,t,r,s){const i=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:i};if(r===1&&s!==null){const u=Hyt(s,i,t);let _=u;const d=t+n;for(;_e[u].start,t),l=o;if(r===1)for(;l1){const u=Array(r).fill(0);for(;ld=0&&_.some(d=>d>=t);){const d=e[o];_[d.lane]=d.start,o--}o=Math.max(0,o-o%r),l=Math.min(i,l+(r-1-l%r))}return{startIndex:o,endIndex:l}}const Hx=typeof document<"u"?R.useLayoutEffect:R.useEffect;function Uyt({useFlushSync:e=!0,directDomUpdates:n=!1,directDomUpdatesMode:t="transform",...r}){const s=R.useReducer(_=>_+1,0)[1],i=R.useRef({enabled:n,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=n,i.current.mode=t;const a=_=>{const d=i.current;if(!d.enabled||!d.container)return;const p=_.getTotalSize();if(p!==d.lastSize){d.lastSize=p;const m=_.options.horizontal?"width":"height";d.container.style[m]=`${p}px`}},o=_=>{const d=i.current;if(!d.enabled||!d.container)return;a(_);const p=!!_.options.horizontal,m=d.mode==="transform",x=p?"left":"top",S=_.options.scrollMargin,v=_.getVirtualItems();for(const b of v){const w=b.start-S,y=_.elementsCache.get(b.key);y&&d.lastPositions.get(y)!==w&&(d.lastPositions.set(y,w),m?y.style.transform=p?`translate3d(${w}px, 0, 0)`:`translate3d(0, ${w}px, 0)`:y.style[x]=`${w}px`)}},l={...r,onChange:(_,d)=>{var p;const m=i.current;let x=!0;if(m.enabled){o(_);const S=_.range,v=m.prevRange;x=!v||v.isScrolling!==_.isScrolling||v.startIndex!==(S==null?void 0:S.startIndex)||v.endIndex!==(S==null?void 0:S.endIndex),x&&(m.prevRange=S?{startIndex:S.startIndex,endIndex:S.endIndex,isScrolling:_.isScrolling}:null)}x&&(e&&d?eo.flushSync(s):s()),(p=r.onChange)==null||p.call(r,_,d)}},[u]=R.useState(()=>{const _=new Fyt(l);return Object.assign(_,{containerRef:d=>{const p=i.current;if(p.container=d,p.lastSize=null,d&&p.enabled){const m=_.getTotalSize();p.lastSize=m;const x=_.options.horizontal?"width":"height";d.style[x]=`${m}px`}}})});return u.setOptions(l),Hx(()=>u._didMount(),[]),Hx(()=>(a(u),u._willUpdate())),Hx(()=>{o(u)}),u}function Gyt(e){return Uyt({observeElementRect:Dyt,observeElementOffset:Iyt,scrollToFn:Pyt,...e})}function Wyt(e,n){if(!n)return e;const t=new Map(e.map(i=>[i.id,i]));let r=t.get(n);if(!r)return e;const s=[];for(;r;)s.push(r),r=r.parentId?t.get(r.parentId):void 0;return s.reverse()}function Vyt(e,n,t){var a;let r=e;for(;r&&r.role!=="user";)r=r.parentId?n.get(r.parentId):void 0;const s=e.role==="user"?e.parentId??null:(r==null?void 0:r.id)??null,i=(a=t.get(s))==null?void 0:a.filter(o=>o.role===e.role);return i!=null&&i.length?i:[e]}function Kyt(e,n,t,r){const s=e.filter(u=>!r(u.id)),i=new Map(s.map(u=>[u.id,u])),a=new Map;for(const u of s){const _=u.parentId??null,d=a.get(_);d?d.push(u):a.set(_,[u])}const o=new Set(n.map(u=>u.id)),l=new Map;for(const u of t){const _=Vyt(u,i,a),d=_.findIndex(p=>o.has(p.id));l.set(u.id,{count:_.length,index:d,prevId:d>0?_[d-1].id:void 0,nextId:d<_.length-1?_[d+1].id:void 0})}return l}function Fh(e,n){var t;if(e.type==="tool"&&((t=e.tool)==null?void 0:t.toLowerCase())==="interrupted")return!1;if(e.type==="prompt"){if(!e.prompt)return!1;if(e.prompt.kind==="permission"){if(e.prompt.resolved)return!1;if(n!==void 0)return e.id===n}return!0}return e.type==="reasoning"?!1:e.type==="text"?!!e.text:!0}function am(e){return e.id==="turn-retry"||e.id==="turn-recovery"}function vB(e){var n;for(let t=e.length-1;t>=0;t--){const r=e[t];if(!(r.type==="steer"||am(r)||!Fh(r)))return r.type!=="tool"||((n=r.state)==null?void 0:n.status)==="error"?null:r.id}return null}function bB(e){const n=e.at(-1);if((n==null?void 0:n.role)!=="assistant")return null;const t=vB(n.parts);return t?{messageId:n.id,toolId:t}:null}function Qyt(e){const n=e.at(-1);if((n==null?void 0:n.role)!=="assistant")return!1;for(let t=n.parts.length-1;t>=0;t--){const r=n.parts[t];if(!(r.type==="steer"||am(r)))return r.type==="text"&&!!r.text}return!1}function Yyt(e,n,t,r,s){const i=[...n].filter(o=>!t.has(o)&&r.some(l=>l.id===o)&&o!==s);if(i.length===0&&!(s&&e.has(s)))return e;const a=new Set(e);for(const o of i)a.add(o);return s&&a.delete(s),a}function Xyt(e,n){if(e.some(r=>{var s;return r.type==="prompt"&&!((s=r.prompt)!=null&&s.resolved)}))return{work:[],answer:e};let t=e.findIndex(r=>r.type==="text"&&r.phase==="final_answer");if(t<0&&!n&&!e.some(r=>r.phase))for(let r=e.length-1;r>=0;r--){const s=e[r];if(s.type!=="reasoning"){if(s.type!=="text")break;s.text&&(t=r)}}return t<0||!n&&!e.slice(t).some(r=>Fh(r))||!e.slice(0,t).some(r=>Fh(r))?{work:[],answer:e}:{work:e.slice(0,t),answer:e.slice(t)}}function yB(e){var n,t;return e.type==="tool"&&e.tool==="error"&&/^(?:ActionRequiredError:\s*)?Named models unavailable\b/i.test(((t=(n=e.state)==null?void 0:n.error)==null?void 0:t.trim())??"")}function v3(e){var t,r,s;if(yB(e)||((r=(t=e.state)==null?void 0:t.input)==null?void 0:r.errorKind)==="claude_usage_limit")return!0;const n=e.type==="text"?e.text:e.tool==="error"?(s=e.state)==null?void 0:s.error:null;return e.type==="tool"&&e.tool==="error"&&n&&/usageLimitExceeded|rateLimitExceeded|insufficient_quota|(?:usage|rate|session) limit|(?:exceeded|exhausted) (?:your |the |current )*quota|insufficient (?:credits|balance)|(?:credit|quota)[ _-](?:exhausted|exceeded)/i.test(n)?!0:!!(n&&(/^(?:claude: )?you(?:'ve| have) reached your .+ limit\./i.test(n.trim())&&n.includes("claude.ai/settings/usage")||/^(?:claude: )?you(?:'ve| have) hit your session limit · resets /i.test(n.trim())))}const xo=e=>new Intl.NumberFormat(j()).format(e);function Zyt(e,n){const t=typeof e.nextRetryAt=="number"?Math.max(0,Math.ceil((e.nextRetryAt-n)/1e3)):null;return e.retryOwner==="native"&&e.maximum==null&&t==null?AIe():typeof e.attempt=="number"&&typeof e.maximum=="number"&&t!=null?SIe({attempt:xo(e.attempt),maximum:xo(e.maximum),seconds:xo(t)}):typeof e.attempt=="number"&&typeof e.maximum=="number"?bIe({attempt:xo(e.attempt),maximum:xo(e.maximum)}):typeof e.attempt=="number"&&t!=null?NIe({attempt:xo(e.attempt),seconds:xo(t)}):typeof e.attempt=="number"?pIe({attempt:xo(e.attempt)}):t!=null?LIe({seconds:xo(t)}):tL()}function Jyt(e,n){if(typeof e!="number")return $Ie();const t=Math.max(0,Math.ceil((e-n)/1e3));return qIe({seconds:xo(t)})}function xB(e){return e==="retry"||e==="continue"?e:null}function e2t(e){const n={};return e.model!==void 0&&(n.model=e.model),e.serviceTier!==void 0&&(n.serviceTier=e.serviceTier),e.permissionMode!==void 0&&(n.permissionMode=e.permissionMode),e.planMode!==void 0&&(n.planMode=e.planMode),e.reasoningLevel!==void 0&&(n.reasoningLevel=e.reasoningLevel),n}function t2t(e){return["*","?","[","]","{","}"].some(n=>e.includes(n))}function hj(e){return e==="alphaxiv"||e==="openalex"||e==="biorxiv"?e:void 0}function n2t(e){const n=e.trim(),t=n.toLowerCase();if(t.includes("biorxiv.org"))return"biorxiv";if(t.includes("openalex.org"))return"openalex";const r=n.match(/10\.\d+\/\S+/);if(r)return r[0].startsWith("10.1101/")?"biorxiv":"openalex";const s=n.split("/").pop()??"";return/^W\d+$/i.test(s)?"openalex":"alphaxiv"}function AS(e){const n=[];let t="",r=!1,s=null;const i=()=>{r&&n.push(t),t="",r=!1};for(let a=0;a"||o==="&")break;/\s/.test(o)?i():(t+=o,r=!0)}return i(),n}function r2t(e){const n=e[0];if((n==='"'||n==="'")&&e.at(-1)===n){const t=AS(e);if(t.length===1)return t[0]}return e}function s2t(e){var t,r,s;let n=0;for(;["do","then","else","if","while","until"].includes(e[n]);)n++;for(;/^[A-Za-z_][A-Za-z0-9_]*=/.test(e[n]??"");)n++;if(e[n]==="env")for(n++;(t=e[n])!=null&&t.startsWith("-")||/^[A-Za-z_][A-Za-z0-9_]*=/.test(e[n]??"");)n++;if(e[n]==="command"){if(n++,["-v","-V"].includes(e[n]))return null;for(;(r=e[n])!=null&&r.startsWith("-");)n++}return((s=e[n])==null?void 0:s.split("/").pop())!=="orx"?null:e.slice(n+1)}function Wh(e){return s2t(typeof e=="string"?AS(e):e)}function i2t(e){var t;const n=(t=e[0])==null?void 0:t.split("/").pop();return!n||!["sh","bash","zsh"].includes(n)||e[1]!=="-lc"?null:e[2]??null}function a2t(e,n){const t=Wh(e);return t===null?!1:n.split("\\s+").every((s,i)=>t[i]!==void 0&&new RegExp(`^(?:${s})$`,"i").test(t[i]))}function o2t(e){var l;const n=Wh(e);if(!n)return null;const t=n[0];if(t!=="paper"&&t!=="discover")return null;let r;const s=[],i=new Set(["--limit","--published-after","--published-before","--prioritize"]);for(let u=1;u +`&&(t+=l,r=!0);continue}if(s){o===s?s=null:t+=o,r=!0;continue}if(o==='"'||o==="'"){s=o,r=!0;continue}if(o==="|"||o===";"||o===">"||o==="&")break;/\s/.test(o)?i():(t+=o,r=!0)}return i(),n}function r2t(e){const n=e[0];if((n==='"'||n==="'")&&e.at(-1)===n){const t=AS(e);if(t.length===1)return t[0]}return e}function s2t(e){var t,r,s;let n=0;for(;["do","then","else","if","while","until"].includes(e[n]);)n++;for(;/^[A-Za-z_][A-Za-z0-9_]*=/.test(e[n]??"");)n++;if(e[n]==="env")for(n++;(t=e[n])!=null&&t.startsWith("-")||/^[A-Za-z_][A-Za-z0-9_]*=/.test(e[n]??"");)n++;if(e[n]==="command"){if(n++,["-v","-V"].includes(e[n]))return null;for(;(r=e[n])!=null&&r.startsWith("-");)n++}return((s=e[n])==null?void 0:s.split("/").pop())!=="orx"?null:e.slice(n+1)}function Hh(e){return s2t(typeof e=="string"?AS(e):e)}function i2t(e){var t;const n=(t=e[0])==null?void 0:t.split("/").pop();return!n||!["sh","bash","zsh"].includes(n)||e[1]!=="-lc"?null:e[2]??null}function a2t(e,n){const t=Hh(e);return t===null?!1:n.split("\\s+").every((s,i)=>t[i]!==void 0&&new RegExp(`^(?:${s})$`,"i").test(t[i]))}function o2t(e){var l;const n=Hh(e);if(!n)return null;const t=n[0];if(t!=="paper"&&t!=="discover")return null;let r;const s=[],i=new Set(["--limit","--published-after","--published-before","--prioritize"]);for(let u=1;u @@ -675,25 +675,25 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho Z" /> -`,wB={alphaxiv:"alphaXiv",openalex:"OpenAlex",biorxiv:"bioRxiv"},d2t={alphaxiv:l2t,openalex:u2t,biorxiv:c2t};function SB({source:e,size:n=16,decorative:t=!1,className:r=""}){return f.jsx("span",{className:`lit-logo flex-none inline-flex items-center justify-center p-[1.5px] box-border bg-white rounded-[3px] shadow-logo [&_svg]:w-full [&_svg]:h-full [&_svg]:block ${r}`,style:{width:n,height:n},...t?{"aria-hidden":!0}:{role:"img","aria-label":wB[e]},dangerouslySetInnerHTML:{__html:d2t[e]}})}function f2t(e){const t=e.trim().replace(/^https?:\/\/doi\.org\//i,"").replace(/^doi:/i,"").match(/10\.\d+\/[^\s?#]+/);return t?t[0].replace(/[.,)]+$/,"").replace(/v\d+(\.[a-z][a-z-]*)*$/i,""):null}function h2t(e,n){const t=n.trim();if(e==="alphaxiv"){const i=(t.split(/[?#]/)[0].split("/").pop()||t).replace(/\.(pdf|md)$/i,"");return`https://www.alphaxiv.org/abs/${encodeURIComponent(i)}`}const r=f2t(t);if(r)return`https://doi.org/${r}`;if(e==="openalex"){const s=t.split("/").pop()||t;return`https://openalex.org/${encodeURIComponent(s)}`}return`https://doi.org/${t}`}const _2t=["alphaxiv","openalex","biorxiv"];function p2t(){const e=Oft(),{data:n}=ct(e),t=gn({mutationFn:Fdt,onSuccess:i=>Gr(e.queryKey,i)}),r=t.isPending,s=i=>{n&&!r&&t.mutate({...n,[i]:!n[i]})};return n?f.jsx("div",{className:"flex flex-col",children:_2t.map(i=>{const a=n[i];return f.jsxs(sr,{type:"button",role:"switch","aria-checked":a,disabled:r,onClick:()=>s(i),children:[f.jsxs("span",{className:"inline-flex items-center gap-[9px]",children:[f.jsx(SB,{source:i,size:16,decorative:!0}),wB[i]]}),f.jsx(g_t,{checked:a,"aria-hidden":"true"})]},i)})}):f.jsx("div",{className:"py-1.5 px-2 text-muted text-sm",children:S3e()})}function qx(e,n){if(!e)throw new Error("Assertion Error")}function Yu(e,n){if(e==null)throw new Error(`Unexpected ${e}`);return e}function m2t(e,n){const t={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,t),e.applyData(n,t)}function g2t(e,n){const t={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,t),[e.applyData(n,t),{type:"text",value:` +`,wB={alphaxiv:"alphaXiv",openalex:"OpenAlex",biorxiv:"bioRxiv"},d2t={alphaxiv:l2t,openalex:u2t,biorxiv:c2t};function SB({source:e,size:n=16,decorative:t=!1,className:r=""}){return f.jsx("span",{className:`lit-logo flex-none inline-flex items-center justify-center p-[1.5px] box-border bg-white rounded-[3px] shadow-logo [&_svg]:w-full [&_svg]:h-full [&_svg]:block ${r}`,style:{width:n,height:n},...t?{"aria-hidden":!0}:{role:"img","aria-label":wB[e]},dangerouslySetInnerHTML:{__html:d2t[e]}})}function f2t(e){const t=e.trim().replace(/^https?:\/\/doi\.org\//i,"").replace(/^doi:/i,"").match(/10\.\d+\/[^\s?#]+/);return t?t[0].replace(/[.,)]+$/,"").replace(/v\d+(\.[a-z][a-z-]*)*$/i,""):null}function h2t(e,n){const t=n.trim();if(e==="alphaxiv"){const i=(t.split(/[?#]/)[0].split("/").pop()||t).replace(/\.(pdf|md)$/i,"");return`https://www.alphaxiv.org/abs/${encodeURIComponent(i)}`}const r=f2t(t);if(r)return`https://doi.org/${r}`;if(e==="openalex"){const s=t.split("/").pop()||t;return`https://openalex.org/${encodeURIComponent(s)}`}return`https://doi.org/${t}`}const _2t=["alphaxiv","openalex","biorxiv"];function p2t(){const e=Oft(),{data:n}=ot(e),t=mn({mutationFn:Fdt,onSuccess:i=>Gr(e.queryKey,i)}),r=t.isPending,s=i=>{n&&!r&&t.mutate({...n,[i]:!n[i]})};return n?f.jsx("div",{className:"flex flex-col",children:_2t.map(i=>{const a=n[i];return f.jsxs(ir,{type:"button",role:"switch","aria-checked":a,disabled:r,onClick:()=>s(i),children:[f.jsxs("span",{className:"inline-flex items-center gap-[9px]",children:[f.jsx(SB,{source:i,size:16,decorative:!0}),wB[i]]}),f.jsx(g_t,{checked:a,"aria-hidden":"true"})]},i)})}):f.jsx("div",{className:"py-1.5 px-2 text-muted text-sm",children:S3e()})}function qx(e,n){if(!e)throw new Error("Assertion Error")}function Wu(e,n){if(e==null)throw new Error(`Unexpected ${e}`);return e}function m2t(e,n){const t={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,t),e.applyData(n,t)}function g2t(e,n){const t={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,t),[e.applyData(n,t),{type:"text",value:` `}]}function v2t(e,n){const t=n.value?n.value+` -`:"",r={},s=n.lang?n.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:t}]};return n.meta&&(i.data={meta:n.meta}),e.patch(n,i),i=e.applyData(n,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(n,i),i}function b2t(e,n){const t={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function y2t(e,n){const t={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}const ai=ku(/[A-Za-z]/),Vs=ku(/[\dA-Za-z]/),x2t=ku(/[#-'*+\--9=?A-Z^-~]/);function mv(e){return e!==null&&(e<32||e===127)}const b3=ku(/\d/),w2t=ku(/[\dA-Fa-f]/),S2t=ku(/[!-/:-@[-`{-~]/);function wt(e){return e!==null&&e<-2}function ir(e){return e!==null&&(e<0||e===32)}function vn(e){return e===-2||e===-1||e===32}const Db=ku(new RegExp("\\p{P}|\\p{S}","u")),Id=ku(/\s/);function ku(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function __(e){const n=[];let t=-1,r=0,s=0;for(;++t55295&&i<57344){const o=e.charCodeAt(t+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(n.push(e.slice(r,t),encodeURIComponent(a)),r=t+s+1,a=""),s&&(t+=s,s=0)}return n.join("")+e.slice(r)}function k2t(e,n){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(n.identifier).toUpperCase(),s=__(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,o+=1,e.footnoteCounts.set(r,o);const l={type:"element",tagName:"a",properties:{href:"#"+t+"fn-"+s,id:t+"fnref-"+s+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(n,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(n,u),e.applyData(n,u)}function C2t(e,n){const t={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function E2t(e,n){if(e.options.allowDangerousHtml){const t={type:"raw",value:n.value};return e.patch(n,t),e.applyData(n,t)}}function kB(e,n){const t=n.referenceType;let r="]";if(t==="collapsed"?r+="[]":t==="full"&&(r+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+r}];const s=e.all(n),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function N2t(e,n){const t=String(n.identifier).toUpperCase(),r=e.definitionById.get(t);if(!r)return kB(e,n);const s={src:__(r.url||""),alt:n.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(n,i),e.applyData(n,i)}function z2t(e,n){const t={src:__(n.url)};n.alt!==null&&n.alt!==void 0&&(t.alt=n.alt),n.title!==null&&n.title!==void 0&&(t.title=n.title);const r={type:"element",tagName:"img",properties:t,children:[]};return e.patch(n,r),e.applyData(n,r)}function j2t(e,n){const t={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,t);const r={type:"element",tagName:"code",properties:{},children:[t]};return e.patch(n,r),e.applyData(n,r)}function T2t(e,n){const t=String(n.identifier).toUpperCase(),r=e.definitionById.get(t);if(!r)return kB(e,n);const s={href:__(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function A2t(e,n){const t={href:__(n.url)};n.title!==null&&n.title!==void 0&&(t.title=n.title);const r={type:"element",tagName:"a",properties:t,children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function R2t(e,n,t){const r=e.all(n),s=t?M2t(t):CB(n),i={},a=[];if(typeof n.checked=="boolean"){const _=r[0];let d;_&&_.type==="element"&&_.tagName==="p"?d=_:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:t}]};return n.meta&&(i.data={meta:n.meta}),e.patch(n,i),i=e.applyData(n,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(n,i),i}function b2t(e,n){const t={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function y2t(e,n){const t={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}const Zs=pu(/[A-Za-z]/),Is=pu(/[\dA-Za-z]/),x2t=pu(/[#-'*+\--9=?A-Z^-~]/);function mv(e){return e!==null&&(e<32||e===127)}const b3=pu(/\d/),w2t=pu(/[\dA-Fa-f]/),S2t=pu(/[!-/:-@[-`{-~]/);function St(e){return e!==null&&e<-2}function ar(e){return e!==null&&(e<0||e===32)}function gn(e){return e===-2||e===-1||e===32}const Mb=pu(new RegExp("\\p{P}|\\p{S}","u")),Md=pu(/\s/);function pu(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function u_(e){const n=[];let t=-1,r=0,s=0;for(;++t55295&&i<57344){const o=e.charCodeAt(t+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(n.push(e.slice(r,t),encodeURIComponent(a)),r=t+s+1,a=""),s&&(t+=s,s=0)}return n.join("")+e.slice(r)}function k2t(e,n){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(n.identifier).toUpperCase(),s=u_(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,o+=1,e.footnoteCounts.set(r,o);const l={type:"element",tagName:"a",properties:{href:"#"+t+"fn-"+s,id:t+"fnref-"+s+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(n,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(n,u),e.applyData(n,u)}function C2t(e,n){const t={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function E2t(e,n){if(e.options.allowDangerousHtml){const t={type:"raw",value:n.value};return e.patch(n,t),e.applyData(n,t)}}function kB(e,n){const t=n.referenceType;let r="]";if(t==="collapsed"?r+="[]":t==="full"&&(r+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+r}];const s=e.all(n),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function N2t(e,n){const t=String(n.identifier).toUpperCase(),r=e.definitionById.get(t);if(!r)return kB(e,n);const s={src:u_(r.url||""),alt:n.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(n,i),e.applyData(n,i)}function z2t(e,n){const t={src:u_(n.url)};n.alt!==null&&n.alt!==void 0&&(t.alt=n.alt),n.title!==null&&n.title!==void 0&&(t.title=n.title);const r={type:"element",tagName:"img",properties:t,children:[]};return e.patch(n,r),e.applyData(n,r)}function j2t(e,n){const t={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,t);const r={type:"element",tagName:"code",properties:{},children:[t]};return e.patch(n,r),e.applyData(n,r)}function T2t(e,n){const t=String(n.identifier).toUpperCase(),r=e.definitionById.get(t);if(!r)return kB(e,n);const s={href:u_(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function A2t(e,n){const t={href:u_(n.url)};n.title!==null&&n.title!==void 0&&(t.title=n.title);const r={type:"element",tagName:"a",properties:t,children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function R2t(e,n,t){const r=e.all(n),s=t?M2t(t):CB(n),i={},a=[];if(typeof n.checked=="boolean"){const _=r[0];let d;_&&_.type==="element"&&_.tagName==="p"?d=_:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o1}function D2t(e,n){const t={},r=e.all(n);let s=-1;for(typeof n.start=="number"&&n.start!==1&&(t.start=n.start);++s0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function B2t(e){const n=RS(e),t=EB(e);if(n&&t)return{start:n,end:t}}function $2t(e,n){const t=e.all(n),r=t.shift(),s=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(n.children[0],a),s.push(a)}if(t.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(t,!0)},o=RS(n.children[1]),l=EB(n.children[n.children.length-1]);o&&l&&(a.position={start:o,end:l}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(n,i),e.applyData(n,i)}function P2t(e,n,t){const r=t?t.children:void 0,i=(r?r.indexOf(n):1)===0?"th":"td",a=t&&t.type==="table"?t.align:void 0,o=a?a.length:n.children.length;let l=-1;const u=[];for(;++l0,!0),r[0]),s=r.index+r[0].length,r=t.exec(n);return i.push(mj(n.slice(s),s>0,!1)),i.join("")}function mj(e,n,t){let r=0,s=e.length;if(n){let i=e.codePointAt(r);for(;i===_j||i===pj;)r++,i=e.codePointAt(r)}if(t){let i=e.codePointAt(s-1);for(;i===_j||i===pj;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function q2t(e,n){const t={type:"text",value:H2t(String(n.value))};return e.patch(n,t),e.applyData(n,t)}function U2t(e,n){const t={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,t),e.applyData(n,t)}const G2t={blockquote:m2t,break:g2t,code:v2t,delete:b2t,emphasis:y2t,footnoteReference:k2t,heading:C2t,html:E2t,imageReference:N2t,image:z2t,inlineCode:j2t,linkReference:T2t,link:A2t,listItem:R2t,list:D2t,paragraph:L2t,root:O2t,strong:I2t,table:$2t,tableCell:F2t,tableRow:P2t,text:q2t,thematicBreak:U2t,toml:Gg,yaml:Gg,definition:Gg,footnoteDefinition:Gg};function Gg(){}const zB=-1,Lb=0,P0=1,gv=2,MS=3,DS=4,LS=5,OS=6,jB=7,TB=8,W2t=typeof self=="object"?self:globalThis,gj=(e,n)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new W2t[e](n)},V2t=(e,n)=>{const t=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=n[s];switch(i){case Lb:case zB:return t(a,s);case P0:{const o=t([],s);for(const l of a)o.push(r(l));return o}case gv:{const o=t({},s);for(const[l,u]of a)o[r(l)]=r(u);return o}case MS:return t(new Date(a),s);case DS:{const{source:o,flags:l}=a;return t(new RegExp(o,l),s)}case LS:{const o=t(new Map,s);for(const[l,u]of a)o.set(r(l),r(u));return o}case OS:{const o=t(new Set,s);for(const l of a)o.add(r(l));return o}case jB:{const{name:o,message:l}=a;return t(gj(o,l),s)}case TB:return t(BigInt(a),s);case"BigInt":return t(Object(BigInt(a)),s);case"ArrayBuffer":return t(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return t(new DataView(o),a)}}return t(gj(i,a),s)};return r},vj=e=>V2t(new Map,e)(0),td="",{toString:K2t}={},{keys:Q2t}=Object,h0=e=>{const n=typeof e;if(n!=="object"||!e)return[Lb,n];const t=K2t.call(e).slice(8,-1);switch(t){case"Array":return[P0,td];case"Object":return[gv,td];case"Date":return[MS,td];case"RegExp":return[DS,td];case"Map":return[LS,td];case"Set":return[OS,td];case"DataView":return[P0,t]}return t.includes("Array")?[P0,t]:t.includes("Error")?[jB,t]:[gv,t]},Wg=([e,n])=>e===Lb&&(n==="function"||n==="symbol"),Y2t=(e,n,t,r)=>{const s=(a,o)=>{const l=r.push(a)-1;return t.set(o,l),l},i=a=>{if(t.has(a))return t.get(a);let[o,l]=h0(a);switch(o){case Lb:{let _=a;switch(l){case"bigint":o=TB,_=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);_=null;break;case"undefined":return s([zB],a)}return s([o,_],a)}case P0:{if(l){let p=a;return l==="DataView"?p=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(p=new Uint8Array(a)),s([l,[...p]],a)}const _=[],d=s([o,_],a);for(const p of a)_.push(i(p));return d}case gv:{if(l)switch(l){case"BigInt":return s([l,a.toString()],a);case"Boolean":case"Number":case"String":return s([l,a.valueOf()],a)}if(n&&"toJSON"in a)return i(a.toJSON());const _=[],d=s([o,_],a);for(const p of Q2t(a))(e||!Wg(h0(a[p])))&&_.push([i(p),i(a[p])]);return d}case MS:return s([o,isNaN(a.getTime())?td:a.toISOString()],a);case DS:{const{source:_,flags:d}=a;return s([o,{source:_,flags:d}],a)}case LS:{const _=[],d=s([o,_],a);for(const[p,m]of a)(e||!(Wg(h0(p))||Wg(h0(m))))&&_.push([i(p),i(m)]);return d}case OS:{const _=[],d=s([o,_],a);for(const p of a)(e||!Wg(h0(p)))&&_.push(i(p));return d}}const{message:u}=a;return s([o,{name:l,message:u}],a)};return i},bj=(e,{json:n,lossy:t}={})=>{const r=[];return Y2t(!(n||t),!!n,new Map,r)(e),r},vv=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?vj(bj(e,n)):structuredClone(e):(e,n)=>vj(bj(e,n));function X2t(e,n){const t=[{type:"text",value:"↩"}];return n>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),t}function Z2t(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function J2t(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",t=e.options.footnoteBackContent||X2t,r=e.options.footnoteBackLabel||Z2t,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l0&&x.push({type:"text",value:" "});let w=typeof t=="string"?t:t(l,m);typeof w=="string"&&(w={type:"text",value:w}),x.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+p+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,m),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const v=_[_.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const w=v.children[v.children.length-1];w&&w.type==="text"?w.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...x)}else _.push(...x);const b={type:"element",tagName:"li",properties:{id:n+"fn-"+p},children:e.wrap(_,!0)};e.patch(u,b),o.push(b)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...vv(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`});const u={type:"element",tagName:"li",properties:i,children:a};return e.patch(n,u),e.applyData(n,u)}function M2t(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const t=e.children;let r=-1;for(;!n&&++r1}function D2t(e,n){const t={},r=e.all(n);let s=-1;for(typeof n.start=="number"&&n.start!==1&&(t.start=n.start);++s0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function B2t(e){const n=RS(e),t=EB(e);if(n&&t)return{start:n,end:t}}function $2t(e,n){const t=e.all(n),r=t.shift(),s=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(n.children[0],a),s.push(a)}if(t.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(t,!0)},o=RS(n.children[1]),l=EB(n.children[n.children.length-1]);o&&l&&(a.position={start:o,end:l}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(n,i),e.applyData(n,i)}function P2t(e,n,t){const r=t?t.children:void 0,i=(r?r.indexOf(n):1)===0?"th":"td",a=t&&t.type==="table"?t.align:void 0,o=a?a.length:n.children.length;let l=-1;const u=[];for(;++l0,!0),r[0]),s=r.index+r[0].length,r=t.exec(n);return i.push(mj(n.slice(s),s>0,!1)),i.join("")}function mj(e,n,t){let r=0,s=e.length;if(n){let i=e.codePointAt(r);for(;i===_j||i===pj;)r++,i=e.codePointAt(r)}if(t){let i=e.codePointAt(s-1);for(;i===_j||i===pj;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function q2t(e,n){const t={type:"text",value:H2t(String(n.value))};return e.patch(n,t),e.applyData(n,t)}function U2t(e,n){const t={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,t),e.applyData(n,t)}const G2t={blockquote:m2t,break:g2t,code:v2t,delete:b2t,emphasis:y2t,footnoteReference:k2t,heading:C2t,html:E2t,imageReference:N2t,image:z2t,inlineCode:j2t,linkReference:T2t,link:A2t,listItem:R2t,list:D2t,paragraph:L2t,root:O2t,strong:I2t,table:$2t,tableCell:F2t,tableRow:P2t,text:q2t,thematicBreak:U2t,toml:Gg,yaml:Gg,definition:Gg,footnoteDefinition:Gg};function Gg(){}const zB=-1,Db=0,$0=1,gv=2,MS=3,DS=4,LS=5,OS=6,jB=7,TB=8,W2t=typeof self=="object"?self:globalThis,gj=(e,n)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new W2t[e](n)},V2t=(e,n)=>{const t=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=n[s];switch(i){case Db:case zB:return t(a,s);case $0:{const o=t([],s);for(const l of a)o.push(r(l));return o}case gv:{const o=t({},s);for(const[l,u]of a)o[r(l)]=r(u);return o}case MS:return t(new Date(a),s);case DS:{const{source:o,flags:l}=a;return t(new RegExp(o,l),s)}case LS:{const o=t(new Map,s);for(const[l,u]of a)o.set(r(l),r(u));return o}case OS:{const o=t(new Set,s);for(const l of a)o.add(r(l));return o}case jB:{const{name:o,message:l}=a;return t(gj(o,l),s)}case TB:return t(BigInt(a),s);case"BigInt":return t(Object(BigInt(a)),s);case"ArrayBuffer":return t(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return t(new DataView(o),a)}}return t(gj(i,a),s)};return r},vj=e=>V2t(new Map,e)(0),Xu="",{toString:K2t}={},{keys:Q2t}=Object,h0=e=>{const n=typeof e;if(n!=="object"||!e)return[Db,n];const t=K2t.call(e).slice(8,-1);switch(t){case"Array":return[$0,Xu];case"Object":return[gv,Xu];case"Date":return[MS,Xu];case"RegExp":return[DS,Xu];case"Map":return[LS,Xu];case"Set":return[OS,Xu];case"DataView":return[$0,t]}return t.includes("Array")?[$0,t]:t.includes("Error")?[jB,t]:[gv,t]},Wg=([e,n])=>e===Db&&(n==="function"||n==="symbol"),Y2t=(e,n,t,r)=>{const s=(a,o)=>{const l=r.push(a)-1;return t.set(o,l),l},i=a=>{if(t.has(a))return t.get(a);let[o,l]=h0(a);switch(o){case Db:{let _=a;switch(l){case"bigint":o=TB,_=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);_=null;break;case"undefined":return s([zB],a)}return s([o,_],a)}case $0:{if(l){let p=a;return l==="DataView"?p=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(p=new Uint8Array(a)),s([l,[...p]],a)}const _=[],d=s([o,_],a);for(const p of a)_.push(i(p));return d}case gv:{if(l)switch(l){case"BigInt":return s([l,a.toString()],a);case"Boolean":case"Number":case"String":return s([l,a.valueOf()],a)}if(n&&"toJSON"in a)return i(a.toJSON());const _=[],d=s([o,_],a);for(const p of Q2t(a))(e||!Wg(h0(a[p])))&&_.push([i(p),i(a[p])]);return d}case MS:return s([o,isNaN(a.getTime())?Xu:a.toISOString()],a);case DS:{const{source:_,flags:d}=a;return s([o,{source:_,flags:d}],a)}case LS:{const _=[],d=s([o,_],a);for(const[p,m]of a)(e||!(Wg(h0(p))||Wg(h0(m))))&&_.push([i(p),i(m)]);return d}case OS:{const _=[],d=s([o,_],a);for(const p of a)(e||!Wg(h0(p)))&&_.push(i(p));return d}}const{message:u}=a;return s([o,{name:l,message:u}],a)};return i},bj=(e,{json:n,lossy:t}={})=>{const r=[];return Y2t(!(n||t),!!n,new Map,r)(e),r},vv=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?vj(bj(e,n)):structuredClone(e):(e,n)=>vj(bj(e,n));function X2t(e,n){const t=[{type:"text",value:"↩"}];return n>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),t}function Z2t(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function J2t(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",t=e.options.footnoteBackContent||X2t,r=e.options.footnoteBackLabel||Z2t,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l0&&x.push({type:"text",value:" "});let w=typeof t=="string"?t:t(l,m);typeof w=="string"&&(w={type:"text",value:w}),x.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+p+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,m),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const v=_[_.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const w=v.children[v.children.length-1];w&&w.type==="text"?w.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...x)}else _.push(...x);const b={type:"element",tagName:"li",properties:{id:n+"fn-"+p},children:e.wrap(_,!0)};e.patch(u,b),o.push(b)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...vv(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:` -`}]}}const om=(function(e){if(e==null)return rxt;if(typeof e=="function")return Ob(e);if(typeof e=="object")return Array.isArray(e)?ext(e):txt(e);if(typeof e=="string")return nxt(e);throw new Error("Expected function, string, or object as test")});function ext(e){const n=[];let t=-1;for(;++t":""))+")"})}return p;function p(){let m=AB,x,S,v;if((!n||i(l,u,_[_.length-1]||void 0))&&(m=axt(t(l,_)),m[0]===y3))return m;if("children"in l&&l.children){const b=l;if(b.children&&m[0]!==RB)for(S=(r?b.children.length:-1)+a,v=_.concat(b);S>-1&&S":""))+")"})}return p;function p(){let m=AB,x,S,v;if((!n||i(l,u,_[_.length-1]||void 0))&&(m=axt(t(l,_)),m[0]===y3))return m;if("children"in l&&l.children){const b=l;if(b.children&&m[0]!==RB)for(S=(r?b.children.length:-1)+a,v=_.concat(b);S>-1&&S0&&t.push({type:"text",value:` `}),t}function yj(e){let n=0,t=e.charCodeAt(n);for(;t===9||t===32;)n++,t=e.charCodeAt(n);return e.slice(n)}function xj(e,n){const t=lxt(e,n),r=t.one(e,void 0),s=J2t(t),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` -`},s),i}function bv(e,n){return e&&"run"in e?async function(t,r){const s=xj(t,{file:r,...n});await e.run(s,r)}:function(t,r){return xj(t,{file:r,...e||n})}}function wj(e){if(e)throw e}var Ux,Sj;function hxt(){if(Sj)return Ux;Sj=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(u){return typeof Array.isArray=="function"?Array.isArray(u):n.call(u)==="[object Array]"},i=function(u){if(!u||n.call(u)!=="[object Object]")return!1;var _=e.call(u,"constructor"),d=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!_&&!d)return!1;var p;for(p in u);return typeof p>"u"||e.call(u,p)},a=function(u,_){t&&_.name==="__proto__"?t(u,_.name,{enumerable:!0,configurable:!0,value:_.newValue,writable:!0}):u[_.name]=_.newValue},o=function(u,_){if(_==="__proto__")if(e.call(u,_)){if(r)return r(u,_).value}else return;return u[_]};return Ux=function l(){var u,_,d,p,m,x,S=arguments[0],v=1,b=arguments.length,w=!1;for(typeof S=="boolean"&&(w=S,S=arguments[1]||{},v=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});va.length;let l;o&&a.push(s);try{l=e.apply(this,a)}catch(u){const _=u;if(o&&t)throw _;return s(_)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(a,...o){t||(t=!0,n(a,...o))}function i(a){s(null,a)}}function F0(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?kj(e.position):"start"in e||"end"in e?kj(e):"line"in e||"column"in e?S3(e):""}function S3(e){return Cj(e&&e.line)+":"+Cj(e&&e.column)}function kj(e){return S3(e&&e.start)+"-"+S3(e&&e.end)}function Cj(e){return e&&typeof e=="number"?e:1}class Qs extends Error{constructor(n,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let s="",i={},a=!1;if(t&&("line"in t&&"column"in t?i={place:t}:"start"in t&&"end"in t?i={place:t}:"type"in t?i={ancestors:[t],place:t.position}:i={...t}),typeof n=="string"?s=n:!i.cause&&n&&(a=!0,s=n.message,i.cause=n),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=F0(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Qs.prototype.file="";Qs.prototype.name="";Qs.prototype.reason="";Qs.prototype.message="";Qs.prototype.stack="";Qs.prototype.column=void 0;Qs.prototype.line=void 0;Qs.prototype.ancestors=void 0;Qs.prototype.cause=void 0;Qs.prototype.fatal=void 0;Qs.prototype.place=void 0;Qs.prototype.ruleId=void 0;Qs.prototype.source=void 0;const wo={basename:gxt,dirname:vxt,extname:bxt,join:yxt,sep:"/"};function gxt(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');lm(e);let t=0,r=-1,s=e.length,i;if(n===void 0||n.length===0||n.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){t=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(t,r)}if(n===e)return"";let a=-1,o=n.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){t=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(e.codePointAt(s)===n.codePointAt(o--)?o<0&&(r=s):(o=-1,r=a));return t===r?r=a:r<0&&(r=e.length),e.slice(t,r)}function vxt(e){if(lm(e),e.length===0)return".";let n=-1,t=e.length,r;for(;--t;)if(e.codePointAt(t)===47){if(r){n=t;break}}else r||(r=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function bxt(e){lm(e);let n=e.length,t=-1,r=0,s=-1,i=0,a;for(;n--;){const o=e.codePointAt(n);if(o===47){if(a){r=n+1;break}continue}t<0&&(a=!0,t=n+1),o===46?s<0?s=n:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||t<0||i===0||i===1&&s===t-1&&s===r+1?"":e.slice(s,t)}function yxt(...e){let n=-1,t;for(;++n0&&e.codePointAt(e.length-1)===47&&(t+="/"),n?"/"+t:t}function wxt(e,n){let t="",r=0,s=-1,i=0,a=-1,o,l;for(;++a<=e.length;){if(a2){if(l=t.lastIndexOf("/"),l!==t.length-1){l<0?(t="",r=0):(t=t.slice(0,l),r=t.length-1-t.lastIndexOf("/")),s=a,i=0;continue}}else if(t.length>0){t="",r=0,s=a,i=0;continue}}n&&(t=t.length>0?t+"/..":"..",r=2)}else t.length>0?t+="/"+e.slice(s+1,a):t=e.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return t}function lm(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Sxt={cwd:kxt};function kxt(){return"/"}function k3(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Cxt(e){if(typeof e=="string")e=new URL(e);else if(!k3(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return Ext(e)}function Ext(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let t=-1;for(;++t0){let[m,...x]=_;const S=r[p][1];w3(S)&&w3(m)&&(m=Gx(!0,S,m)),r[p]=[u,m,...x]}}}}const PS=new $S().freeze();function Qx(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yx(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Xx(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Nj(e){if(!w3(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function zj(e,n,t){if(!t)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function Vg(e){return Txt(e)?e:new MB(e)}function Txt(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Axt(e){return typeof e=="string"||Rxt(e)}function Rxt(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var jj=Object.prototype.hasOwnProperty;function Tj(e,n,t){for(t of e.keys())if(H0(t,n))return t}function H0(e,n){var t,r,s;if(e===n)return!0;if(e&&n&&(t=e.constructor)===n.constructor){if(t===Date)return e.getTime()===n.getTime();if(t===RegExp)return e.toString()===n.toString();if(t===Array){if((r=e.length)===n.length)for(;r--&&H0(e[r],n[r]););return r===-1}if(t===Set){if(e.size!==n.size)return!1;for(r of e)if(s=r,s&&typeof s=="object"&&(s=Tj(n,s),!s)||!n.has(s))return!1;return!0}if(t===Map){if(e.size!==n.size)return!1;for(r of e)if(s=r[0],s&&typeof s=="object"&&(s=Tj(n,s),!s)||!H0(r[1],n.get(s)))return!1;return!0}if(t===ArrayBuffer)e=new Uint8Array(e),n=new Uint8Array(n);else if(t===DataView){if((r=e.byteLength)===n.byteLength)for(;r--&&e.getInt8(r)===n.getInt8(r););return r===-1}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===n.byteLength)for(;r--&&e[r]===n[r];);return r===-1}if(!t||typeof e=="object"){r=0;for(t in e)if(jj.call(e,t)&&++r&&!jj.call(n,t)||!(t in n)||!H0(e[t],n[t]))return!1;return Object.keys(n).length===r}}return e!==e&&n!==n}const Mxt=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dxt=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Lxt={};function Aj(e,n){return(Lxt.jsx?Dxt:Mxt).test(e)}const Oxt=/[ \t\n\f\r]/g;function Ixt(e){return typeof e=="object"?e.type==="text"?Rj(e.value):!1:Rj(e)}function Rj(e){return e.replace(Oxt,"")===""}var Uf={},Zx,Mj;function Bxt(){if(Mj)return Zx;Mj=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,t=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,l=` -`,u="/",_="*",d="",p="comment",m="declaration";function x(v,b){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];b=b||{};var w=1,y=1;function C(H){var Y=H.match(n);Y&&(w+=Y.length);var V=H.lastIndexOf(l);y=~V?H.length-V:y+H.length}function E(){var H={line:w,column:y};return function(Y){return Y.position=new N(H),M(),Y}}function N(H){this.start=H,this.end={line:w,column:y},this.source=b.source}N.prototype.content=v;function T(H){var Y=new Error(b.source+":"+w+":"+y+": "+H);if(Y.reason=H,Y.filename=b.source,Y.line=w,Y.column=y,Y.source=v,!b.silent)throw Y}function z(H){var Y=H.exec(v);if(Y){var V=Y[0];return C(V),v=v.slice(V.length),Y}}function M(){z(t)}function O(H){var Y;for(H=H||[];Y=B();)Y!==!1&&H.push(Y);return H}function B(){var H=E();if(!(u!=v.charAt(0)||_!=v.charAt(1))){for(var Y=2;d!=v.charAt(Y)&&(_!=v.charAt(Y)||u!=v.charAt(Y+1));)++Y;if(Y+=2,d===v.charAt(Y-1))return T("End of comment missing");var V=v.slice(2,Y-2);return y+=2,C(V),v=v.slice(Y),y+=2,H({type:p,comment:V})}}function $(){var H=E(),Y=z(r);if(Y){if(B(),!z(s))return T("property missing ':'");var V=z(i),X=H({type:m,property:S(Y[0].replace(e,d)),value:V?S(V[0].replace(e,d)):d});return z(a),X}}function U(){var H=[];O(H);for(var Y;Y=$();)Y!==!1&&(H.push(Y),O(H));return H}return M(),U()}function S(v){return v?v.replace(o,d):d}return Zx=x,Zx}var Dj;function $xt(){if(Dj)return Uf;Dj=1;var e=Uf&&Uf.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.default=t;const n=e(Bxt());function t(r,s){let i=null;if(!r||typeof r!="string")return i;const a=(0,n.default)(r),o=typeof s=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:_}=l;o?s(u,_,l):_&&(i=i||{},i[u]=_)}),i}return Uf}var _0={},Lj;function Pxt(){if(Lj)return _0;Lj=1,Object.defineProperty(_0,"__esModule",{value:!0}),_0.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,t=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(u){return!u||t.test(u)||e.test(u)},a=function(u,_){return _.toUpperCase()},o=function(u,_){return"".concat(_,"-")},l=function(u,_){return _===void 0&&(_={}),i(u)?u:(u=u.toLowerCase(),_.reactCompat?u=u.replace(s,o):u=u.replace(r,o),u.replace(n,a))};return _0.camelCase=l,_0}var p0,Oj;function Fxt(){if(Oj)return p0;Oj=1;var e=p0&&p0.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},n=e($xt()),t=Pxt();function r(s,i){var a={};return!s||typeof s!="string"||(0,n.default)(s,function(o,l){o&&l&&(a[(0,t.camelCase)(o,i)]=l)}),a}return r.default=r,p0=r,p0}var Hxt=Fxt();const qxt=Gp(Hxt),FS={}.hasOwnProperty,Uxt=new Map,Gxt=/[A-Z]/g,Wxt=new Set(["table","tbody","thead","tfoot","tr"]),Vxt=new Set(["td","th"]),DB="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function LB(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=n.filePath||void 0;let r;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=twt(t,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=ewt(t,n.jsx,n.jsxs)}const s={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:r,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Rb:iB,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},i=OB(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function OB(e,n,t){if(n.type==="element")return Kxt(e,n,t);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return Qxt(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return Xxt(e,n,t);if(n.type==="mdxjsEsm")return Yxt(e,n);if(n.type==="root")return Zxt(e,n,t);if(n.type==="text")return Jxt(e,n)}function Kxt(e,n,t){const r=e.schema;let s=r;n.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Rb,e.schema=s),e.ancestors.push(n);const i=BB(e,n.tagName,!1),a=nwt(e,n);let o=qS(e,n);return Wxt.has(n.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!Ixt(l):!0})),IB(e,a,i,n),HS(a,o),e.ancestors.pop(),e.schema=r,e.create(n,i,a,t)}function Qxt(e,n){if(n.data&&n.data.estree&&e.evaluater){const r=n.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}pp(e,n.position)}function Yxt(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);pp(e,n.position)}function Xxt(e,n,t){const r=e.schema;let s=r;n.name==="svg"&&r.space==="html"&&(s=Rb,e.schema=s),e.ancestors.push(n);const i=n.name===null?e.Fragment:BB(e,n.name,!0),a=rwt(e,n),o=qS(e,n);return IB(e,a,i,n),HS(a,o),e.ancestors.pop(),e.schema=r,e.create(n,i,a,t)}function Zxt(e,n,t){const r={};return HS(r,qS(e,n)),e.create(n,e.Fragment,r,t)}function Jxt(e,n){return n.value}function IB(e,n,t,r){typeof t!="string"&&t!==e.Fragment&&e.passNode&&(n.node=r)}function HS(e,n){if(n.length>0){const t=n.length>1?n:n[0];t&&(e.children=t)}}function ewt(e,n,t){return r;function r(s,i,a,o){const u=Array.isArray(a.children)?t:n;return o?u(i,a,o):u(i,a)}}function twt(e,n){return t;function t(r,s,i,a){const o=Array.isArray(i.children),l=RS(r);return n(s,i,a,o,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function nwt(e,n){const t={};let r,s;for(s in n.properties)if(s!=="children"&&FS.call(n.properties,s)){const i=swt(e,s,n.properties[s]);if(i){const[a,o]=i;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&Vxt.has(n.tagName)?r=o:t[a]=o}}if(r){const i=t.style||(t.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return t}function rwt(e,n){const t={};for(const r of n.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(t,e.evaluater.evaluateExpression(o.argument))}else pp(e,n.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else pp(e,n.position);else i=r.value===null?!0:r.value;t[s]=i}return t}function qS(e,n){const t=[];let r=-1;const s=e.passKeys?new Map:Uxt;for(;++ry.key).filter(y=>y!==void 0));let u=0;for(;u=e.children.length-_&&(N=s.length-(e.children.length-y)),N>=0&&(E=((b=s[N])==null?void 0:b.key)??E);E&&l.has(E)&&((w=s[N])==null?void 0:w.key)!==E;)E=`${E}+`;E&&l.add(E);const T=$B(C,s[N]??null,t,E);i.push(T),T.react!==void 0&&a.push(T.react)}const d=n!==null&&fwt(e,n.node);if(n&&n.key===r&&d&&s.length===i.length&&i.every((y,C)=>y===s[C]))return n;const p=e.type==="element"&&cwt.has(e.tagName)?a.filter(y=>typeof y!="string"||!uwt.test(y)):a,m=p.length>0?p.length===1?p[0]:p:null;let x=d?n==null?void 0:n.shell:null;if(!x){const y=LB({...e,children:[]},t);x={props:y.props,type:y.type}}return{children:i,key:r,node:e,react:f.jsx(x.type,{...x.props,children:m},r),shell:x}}function fwt(e,n){if(e===n)return!0;const{children:t,position:r,...s}=e,{children:i,position:a,...o}=n;return H0(s,o)}function dh(e,n){if(e===n)return!0;if(Array.isArray(e)||Array.isArray(n)){if(!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length)return!1;for(let a=0;as?0:s+n:n=n>s?s:n,t=t>0?t:0,r.length<1e4)a=Array.from(r),a.unshift(n,t),e.splice(...a);else for(t&&e.splice(n,t);i0?(Ki(e,e.length,0,n),e):n}const Bj={}.hasOwnProperty;function FB(e){const n={};let t=-1;for(;++t13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function Ja(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}function _n(e,n,t,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(l){return vn(l)?(e.enter(t),o(l)):n(l)}function o(l){return vn(l)&&i++a))return;const T=n.events.length;let z=T,M,O;for(;z--;)if(n.events[z][0]==="exit"&&n.events[z][1].type==="chunkFlow"){if(M){O=n.events[z][1].end;break}M=!0}for(b(r),N=T;Ny;){const E=t[C];n.containerState=E[1],E[0].exit.call(n,e)}t.length=y}function w(){s.write([null]),i=void 0,s=void 0,n.containerState._closeFlow=void 0}}function xwt(e,n,t){return _n(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Vh(e){if(e===null||ir(e)||Id(e))return 1;if(Db(e))return 2}function Ib(e,n,t){const r=[];let s=-1;for(;++s1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;const d={...e[r][1].end},p={...e[t][1].start};Pj(d,-l),Pj(p,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[t][1].start},end:p},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[t][1].start}},s={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[t][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Sa(u,[["enter",e[r][1],n],["exit",e[r][1],n]])),u=Sa(u,[["enter",s,n],["enter",a,n],["exit",a,n],["enter",i,n]]),u=Sa(u,Ib(n.parser.constructs.insideSpan.null,e.slice(r+1,t),n)),u=Sa(u,[["exit",i,n],["enter",o,n],["exit",o,n],["exit",s,n]]),e[t][1].end.offset-e[t][1].start.offset?(_=2,u=Sa(u,[["enter",e[t][1],n],["exit",e[t][1],n]])):_=0,Ki(e,r-1,t-r+3,u),t=r+u.length-_-2;break}}for(t=-1;++t0&&vn(N)?_n(e,w,"linePrefix",i+1)(N):w(N)}function w(N){return N===null||wt(N)?e.check(Fj,S,C)(N):(e.enter("codeFlowValue"),y(N))}function y(N){return N===null||wt(N)?(e.exit("codeFlowValue"),w(N)):(e.consume(N),y)}function C(N){return e.exit("codeFenced"),n(N)}function E(N,T,z){let M=0;return O;function O(Y){return N.enter("lineEnding"),N.consume(Y),N.exit("lineEnding"),B}function B(Y){return N.enter("codeFencedFence"),vn(Y)?_n(N,$,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):$(Y)}function $(Y){return Y===o?(N.enter("codeFencedFenceSequence"),U(Y)):z(Y)}function U(Y){return Y===o?(M++,N.consume(Y),U):M>=a?(N.exit("codeFencedFenceSequence"),vn(Y)?_n(N,H,"whitespace")(Y):H(Y)):z(Y)}function H(Y){return Y===null||wt(Y)?(N.exit("codeFencedFence"),T(Y)):z(Y)}}}function Mwt(e,n,t){const r=this;return s;function s(a){return a===null?t(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?t(a):n(a)}}const Jx={name:"codeIndented",tokenize:Lwt},Dwt={partial:!0,tokenize:Owt};function Lwt(e,n,t){const r=this;return s;function s(u){return e.enter("codeIndented"),_n(e,i,"linePrefix",5)(u)}function i(u){const _=r.events[r.events.length-1];return _&&_[1].type==="linePrefix"&&_[2].sliceSerialize(_[1],!0).length>=4?a(u):t(u)}function a(u){return u===null?l(u):wt(u)?e.attempt(Dwt,a,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||wt(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),n(u)}}function Owt(e,n,t){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?t(a):wt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):_n(e,i,"linePrefix",5)(a)}function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?n(a):wt(a)?s(a):t(a)}}const Iwt={name:"codeText",previous:$wt,resolve:Bwt,tokenize:Pwt};function Bwt(e){let n=e.length-4,t=3,r,s;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=t;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return nthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(n,t,r){const s=t||0;this.setCursor(Math.trunc(n));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&m0(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),m0(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),m0(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n=4?n(a):e.interrupt(r.parser.constructs.flow,t,n)(a)}}function VB(e,n,t,r,s,i,a,o,l){const u=l||Number.POSITIVE_INFINITY;let _=0;return d;function d(b){return b===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(b),e.exit(i),p):b===null||b===32||b===41||mv(b)?t(b):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),S(b))}function p(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(s),e.exit(r),n):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===62?(e.exit("chunkString"),e.exit(o),p(b)):b===null||b===60||wt(b)?t(b):(e.consume(b),b===92?x:m)}function x(b){return b===60||b===62||b===92?(e.consume(b),m):m(b)}function S(b){return!_&&(b===null||b===41||ir(b))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),n(b)):_999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?t(m):m===93?(e.exit(i),e.enter(s),e.consume(m),e.exit(s),e.exit(r),n):wt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),_):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===null||m===91||m===93||wt(m)||o++>999?(e.exit("chunkString"),_(m)):(e.consume(m),l||(l=!vn(m)),m===92?p:d)}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}}function QB(e,n,t,r,s,i){let a;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(s),e.consume(p),e.exit(s),a=p===40?41:p,l):t(p)}function l(p){return p===a?(e.enter(s),e.consume(p),e.exit(s),e.exit(r),n):(e.enter(i),u(p))}function u(p){return p===a?(e.exit(i),l(a)):p===null?t(p):wt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),_n(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),_(p))}function _(p){return p===a||p===null||wt(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?d:_)}function d(p){return p===a||p===92?(e.consume(p),_):_(p)}}function q0(e,n){let t;return r;function r(s){return wt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t=!0,r):vn(s)?_n(e,r,t?"linePrefix":"lineSuffix")(s):n(s)}}const Kwt={name:"definition",tokenize:Ywt},Qwt={partial:!0,tokenize:Xwt};function Ywt(e,n,t){const r=this;let s;return i;function i(m){return e.enter("definition"),a(m)}function a(m){return KB.call(r,e,o,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return s=Ja(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):t(m)}function l(m){return ir(m)?q0(e,u)(m):u(m)}function u(m){return VB(e,_,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function _(m){return e.attempt(Qwt,d,d)(m)}function d(m){return vn(m)?_n(e,p,"whitespace")(m):p(m)}function p(m){return m===null||wt(m)?(e.exit("definition"),r.parser.defined.push(s),n(m)):t(m)}}function Xwt(e,n,t){return r;function r(o){return ir(o)?q0(e,s)(o):t(o)}function s(o){return QB(e,i,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return vn(o)?_n(e,a,"whitespace")(o):a(o)}function a(o){return o===null||wt(o)?n(o):t(o)}}const Zwt={name:"hardBreakEscape",tokenize:Jwt};function Jwt(e,n,t){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return wt(i)?(e.exit("hardBreakEscape"),n(i)):t(i)}}const e4t={name:"headingAtx",resolve:t4t,tokenize:n4t};function t4t(e,n){let t=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),t-2>r&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&e[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[t][1].end},i={type:"chunkText",start:e[r][1].start,end:e[t][1].end,contentType:"text"},Ki(e,r,t-r+1,[["enter",s,n],["enter",i,n],["exit",i,n],["exit",s,n]])),e}function n4t(e,n,t){let r=0;return s;function s(_){return e.enter("atxHeading"),i(_)}function i(_){return e.enter("atxHeadingSequence"),a(_)}function a(_){return _===35&&r++<6?(e.consume(_),a):_===null||ir(_)?(e.exit("atxHeadingSequence"),o(_)):t(_)}function o(_){return _===35?(e.enter("atxHeadingSequence"),l(_)):_===null||wt(_)?(e.exit("atxHeading"),n(_)):vn(_)?_n(e,o,"whitespace")(_):(e.enter("atxHeadingText"),u(_))}function l(_){return _===35?(e.consume(_),l):(e.exit("atxHeadingSequence"),o(_))}function u(_){return _===null||_===35||ir(_)?(e.exit("atxHeadingText"),o(_)):(e.consume(_),u)}}const r4t=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],qj=["pre","script","style","textarea"],s4t={concrete:!0,name:"htmlFlow",resolveTo:o4t,tokenize:l4t},i4t={partial:!0,tokenize:u4t},a4t={partial:!0,tokenize:c4t};function o4t(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function l4t(e,n,t){const r=this;let s,i,a,o,l;return u;function u(G){return _(G)}function _(G){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(G),d}function d(G){return G===33?(e.consume(G),p):G===47?(e.consume(G),i=!0,S):G===63?(e.consume(G),s=3,r.interrupt?n:L):ai(G)?(e.consume(G),a=String.fromCharCode(G),v):t(G)}function p(G){return G===45?(e.consume(G),s=2,m):G===91?(e.consume(G),s=5,o=0,x):ai(G)?(e.consume(G),s=4,r.interrupt?n:L):t(G)}function m(G){return G===45?(e.consume(G),r.interrupt?n:L):t(G)}function x(G){const ee="CDATA[";return G===ee.charCodeAt(o++)?(e.consume(G),o===ee.length?r.interrupt?n:$:x):t(G)}function S(G){return ai(G)?(e.consume(G),a=String.fromCharCode(G),v):t(G)}function v(G){if(G===null||G===47||G===62||ir(G)){const ee=G===47,ce=a.toLowerCase();return!ee&&!i&&qj.includes(ce)?(s=1,r.interrupt?n(G):$(G)):r4t.includes(a.toLowerCase())?(s=6,ee?(e.consume(G),b):r.interrupt?n(G):$(G)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(G):i?w(G):y(G))}return G===45||Vs(G)?(e.consume(G),a+=String.fromCharCode(G),v):t(G)}function b(G){return G===62?(e.consume(G),r.interrupt?n:$):t(G)}function w(G){return vn(G)?(e.consume(G),w):O(G)}function y(G){return G===47?(e.consume(G),O):G===58||G===95||ai(G)?(e.consume(G),C):vn(G)?(e.consume(G),y):O(G)}function C(G){return G===45||G===46||G===58||G===95||Vs(G)?(e.consume(G),C):E(G)}function E(G){return G===61?(e.consume(G),N):vn(G)?(e.consume(G),E):y(G)}function N(G){return G===null||G===60||G===61||G===62||G===96?t(G):G===34||G===39?(e.consume(G),l=G,T):vn(G)?(e.consume(G),N):z(G)}function T(G){return G===l?(e.consume(G),l=null,M):G===null||wt(G)?t(G):(e.consume(G),T)}function z(G){return G===null||G===34||G===39||G===47||G===60||G===61||G===62||G===96||ir(G)?E(G):(e.consume(G),z)}function M(G){return G===47||G===62||vn(G)?y(G):t(G)}function O(G){return G===62?(e.consume(G),B):t(G)}function B(G){return G===null||wt(G)?$(G):vn(G)?(e.consume(G),B):t(G)}function $(G){return G===45&&s===2?(e.consume(G),V):G===60&&s===1?(e.consume(G),X):G===62&&s===4?(e.consume(G),F):G===63&&s===3?(e.consume(G),L):G===93&&s===5?(e.consume(G),I):wt(G)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(i4t,q,U)(G)):G===null||wt(G)?(e.exit("htmlFlowData"),U(G)):(e.consume(G),$)}function U(G){return e.check(a4t,H,q)(G)}function H(G){return e.enter("lineEnding"),e.consume(G),e.exit("lineEnding"),Y}function Y(G){return G===null||wt(G)?U(G):(e.enter("htmlFlowData"),$(G))}function V(G){return G===45?(e.consume(G),L):$(G)}function X(G){return G===47?(e.consume(G),a="",te):$(G)}function te(G){if(G===62){const ee=a.toLowerCase();return qj.includes(ee)?(e.consume(G),F):$(G)}return ai(G)&&a.length<8?(e.consume(G),a+=String.fromCharCode(G),te):$(G)}function I(G){return G===93?(e.consume(G),L):$(G)}function L(G){return G===62?(e.consume(G),F):G===45&&s===2?(e.consume(G),L):$(G)}function F(G){return G===null||wt(G)?(e.exit("htmlFlowData"),q(G)):(e.consume(G),F)}function q(G){return e.exit("htmlFlow"),n(G)}}function c4t(e,n,t){const r=this;return s;function s(a){return wt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):t(a)}function i(a){return r.parser.lazy[r.now().line]?t(a):n(a)}}function u4t(e,n,t){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(cm,n,t)}}const d4t={name:"htmlText",tokenize:f4t};function f4t(e,n,t){const r=this;let s,i,a;return o;function o(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),l}function l(L){return L===33?(e.consume(L),u):L===47?(e.consume(L),E):L===63?(e.consume(L),y):ai(L)?(e.consume(L),z):t(L)}function u(L){return L===45?(e.consume(L),_):L===91?(e.consume(L),i=0,x):ai(L)?(e.consume(L),w):t(L)}function _(L){return L===45?(e.consume(L),m):t(L)}function d(L){return L===null?t(L):L===45?(e.consume(L),p):wt(L)?(a=d,X(L)):(e.consume(L),d)}function p(L){return L===45?(e.consume(L),m):d(L)}function m(L){return L===62?V(L):L===45?p(L):d(L)}function x(L){const F="CDATA[";return L===F.charCodeAt(i++)?(e.consume(L),i===F.length?S:x):t(L)}function S(L){return L===null?t(L):L===93?(e.consume(L),v):wt(L)?(a=S,X(L)):(e.consume(L),S)}function v(L){return L===93?(e.consume(L),b):S(L)}function b(L){return L===62?V(L):L===93?(e.consume(L),b):S(L)}function w(L){return L===null||L===62?V(L):wt(L)?(a=w,X(L)):(e.consume(L),w)}function y(L){return L===null?t(L):L===63?(e.consume(L),C):wt(L)?(a=y,X(L)):(e.consume(L),y)}function C(L){return L===62?V(L):y(L)}function E(L){return ai(L)?(e.consume(L),N):t(L)}function N(L){return L===45||Vs(L)?(e.consume(L),N):T(L)}function T(L){return wt(L)?(a=T,X(L)):vn(L)?(e.consume(L),T):V(L)}function z(L){return L===45||Vs(L)?(e.consume(L),z):L===47||L===62||ir(L)?M(L):t(L)}function M(L){return L===47?(e.consume(L),V):L===58||L===95||ai(L)?(e.consume(L),O):wt(L)?(a=M,X(L)):vn(L)?(e.consume(L),M):V(L)}function O(L){return L===45||L===46||L===58||L===95||Vs(L)?(e.consume(L),O):B(L)}function B(L){return L===61?(e.consume(L),$):wt(L)?(a=B,X(L)):vn(L)?(e.consume(L),B):M(L)}function $(L){return L===null||L===60||L===61||L===62||L===96?t(L):L===34||L===39?(e.consume(L),s=L,U):wt(L)?(a=$,X(L)):vn(L)?(e.consume(L),$):(e.consume(L),H)}function U(L){return L===s?(e.consume(L),s=void 0,Y):L===null?t(L):wt(L)?(a=U,X(L)):(e.consume(L),U)}function H(L){return L===null||L===34||L===39||L===60||L===61||L===96?t(L):L===47||L===62||ir(L)?M(L):(e.consume(L),H)}function Y(L){return L===47||L===62||ir(L)?M(L):t(L)}function V(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),n):t(L)}function X(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),te}function te(L){return vn(L)?_n(e,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):I(L)}function I(L){return e.enter("htmlTextData"),a(L)}}const GS={name:"labelEnd",resolveAll:m4t,resolveTo:g4t,tokenize:v4t},h4t={tokenize:b4t},_4t={tokenize:y4t},p4t={tokenize:x4t};function m4t(e){let n=-1;const t=[];for(;++n=3&&(u===null||wt(u))?(e.exit("thematicBreak"),n(u)):t(u)}function l(u){return u===s?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),vn(u)?_n(e,o,"whitespace")(u):o(u))}}const xi={continuation:{tokenize:A4t},exit:M4t,name:"list",tokenize:T4t},z4t={partial:!0,tokenize:D4t},j4t={partial:!0,tokenize:R4t};function T4t(e,n,t){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return o;function o(m){const x=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:b3(m)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(A1,t,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return t(m)}function l(m){return b3(m)&&++a<10?(e.consume(m),l):(!r.interrupt||a<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):t(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(cm,r.interrupt?t:_,e.attempt(z4t,p,d))}function _(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function d(m){return vn(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):t(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(m)}}function A4t(e,n,t){const r=this;return r.containerState._closeFlow=void 0,e.check(cm,s,i);function s(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,_n(e,n,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!vn(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(j4t,n,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,_n(e,e.attempt(xi,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function R4t(e,n,t){const r=this;return _n(e,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?n(i):t(i)}}function M4t(e){e.exit(this.containerState.type)}function D4t(e,n,t){const r=this;return _n(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!vn(i)&&a&&a[1].type==="listItemPrefixWhitespace"?n(i):t(i)}}const Uj={name:"setextUnderline",resolveTo:L4t,tokenize:O4t};function L4t(e,n){let t=e.length,r,s,i;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){r=t;break}e[t][1].type==="paragraph"&&(s=t)}else e[t][1].type==="content"&&e.splice(t,1),!i&&e[t][1].type==="definition"&&(i=t);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,n]),e.splice(i+1,0,["exit",e[r][1],n]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,n]),e}function O4t(e,n,t){const r=this;let s;return i;function i(u){let _=r.events.length,d;for(;_--;)if(r.events[_][1].type!=="lineEnding"&&r.events[_][1].type!=="linePrefix"&&r.events[_][1].type!=="content"){d=r.events[_][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),s=u,a(u)):t(u)}function a(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===s?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),vn(u)?_n(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||wt(u)?(e.exit("setextHeadingLine"),n(u)):t(u)}}const I4t={tokenize:B4t};function B4t(e){const n=this,t=e.attempt(cm,r,e.attempt(this.parser.constructs.flowInitial,s,_n(e,e.attempt(this.parser.constructs.flow,s,e.attempt(qwt,s)),"linePrefix")));return t;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n.currentConstruct=void 0,t}}const $4t={resolveAll:XB()},P4t=YB("string"),F4t=YB("text");function YB(e){return{resolveAll:XB(e==="text"?H4t:void 0),tokenize:n};function n(t){const r=this,s=this.parser.constructs[e],i=t.attempt(s,a,o);return a;function a(_){return u(_)?i(_):o(_)}function o(_){if(_===null){t.consume(_);return}return t.enter("data"),t.consume(_),l}function l(_){return u(_)?(t.exit("data"),i(_)):(t.consume(_),l)}function u(_){if(_===null)return!0;const d=s[_];let p=-1;if(d)for(;++p-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function t3t(e,n){let t=-1;const r=[];let s;for(;++t"u"||e.call(u,p)},a=function(u,_){t&&_.name==="__proto__"?t(u,_.name,{enumerable:!0,configurable:!0,value:_.newValue,writable:!0}):u[_.name]=_.newValue},o=function(u,_){if(_==="__proto__")if(e.call(u,_)){if(r)return r(u,_).value}else return;return u[_]};return Ux=function l(){var u,_,d,p,m,x,S=arguments[0],v=1,b=arguments.length,w=!1;for(typeof S=="boolean"&&(w=S,S=arguments[1]||{},v=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});va.length;let l;o&&a.push(s);try{l=e.apply(this,a)}catch(u){const _=u;if(o&&t)throw _;return s(_)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(a,...o){t||(t=!0,n(a,...o))}function i(a){s(null,a)}}function P0(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?kj(e.position):"start"in e||"end"in e?kj(e):"line"in e||"column"in e?S3(e):""}function S3(e){return Cj(e&&e.line)+":"+Cj(e&&e.column)}function kj(e){return S3(e&&e.start)+"-"+S3(e&&e.end)}function Cj(e){return e&&typeof e=="number"?e:1}class $s extends Error{constructor(n,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let s="",i={},a=!1;if(t&&("line"in t&&"column"in t?i={place:t}:"start"in t&&"end"in t?i={place:t}:"type"in t?i={ancestors:[t],place:t.position}:i={...t}),typeof n=="string"?s=n:!i.cause&&n&&(a=!0,s=n.message,i.cause=n),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=P0(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}$s.prototype.file="";$s.prototype.name="";$s.prototype.reason="";$s.prototype.message="";$s.prototype.stack="";$s.prototype.column=void 0;$s.prototype.line=void 0;$s.prototype.ancestors=void 0;$s.prototype.cause=void 0;$s.prototype.fatal=void 0;$s.prototype.place=void 0;$s.prototype.ruleId=void 0;$s.prototype.source=void 0;const wo={basename:gxt,dirname:vxt,extname:bxt,join:yxt,sep:"/"};function gxt(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');lm(e);let t=0,r=-1,s=e.length,i;if(n===void 0||n.length===0||n.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){t=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(t,r)}if(n===e)return"";let a=-1,o=n.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){t=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(e.codePointAt(s)===n.codePointAt(o--)?o<0&&(r=s):(o=-1,r=a));return t===r?r=a:r<0&&(r=e.length),e.slice(t,r)}function vxt(e){if(lm(e),e.length===0)return".";let n=-1,t=e.length,r;for(;--t;)if(e.codePointAt(t)===47){if(r){n=t;break}}else r||(r=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function bxt(e){lm(e);let n=e.length,t=-1,r=0,s=-1,i=0,a;for(;n--;){const o=e.codePointAt(n);if(o===47){if(a){r=n+1;break}continue}t<0&&(a=!0,t=n+1),o===46?s<0?s=n:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||t<0||i===0||i===1&&s===t-1&&s===r+1?"":e.slice(s,t)}function yxt(...e){let n=-1,t;for(;++n0&&e.codePointAt(e.length-1)===47&&(t+="/"),n?"/"+t:t}function wxt(e,n){let t="",r=0,s=-1,i=0,a=-1,o,l;for(;++a<=e.length;){if(a2){if(l=t.lastIndexOf("/"),l!==t.length-1){l<0?(t="",r=0):(t=t.slice(0,l),r=t.length-1-t.lastIndexOf("/")),s=a,i=0;continue}}else if(t.length>0){t="",r=0,s=a,i=0;continue}}n&&(t=t.length>0?t+"/..":"..",r=2)}else t.length>0?t+="/"+e.slice(s+1,a):t=e.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return t}function lm(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Sxt={cwd:kxt};function kxt(){return"/"}function k3(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Cxt(e){if(typeof e=="string")e=new URL(e);else if(!k3(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return Ext(e)}function Ext(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let t=-1;for(;++t0){let[m,...x]=_;const S=r[p][1];w3(S)&&w3(m)&&(m=Gx(!0,S,m)),r[p]=[u,m,...x]}}}}const PS=new $S().freeze();function Qx(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yx(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Xx(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Nj(e){if(!w3(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function zj(e,n,t){if(!t)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function Vg(e){return Txt(e)?e:new MB(e)}function Txt(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Axt(e){return typeof e=="string"||Rxt(e)}function Rxt(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var jj=Object.prototype.hasOwnProperty;function Tj(e,n,t){for(t of e.keys())if(F0(t,n))return t}function F0(e,n){var t,r,s;if(e===n)return!0;if(e&&n&&(t=e.constructor)===n.constructor){if(t===Date)return e.getTime()===n.getTime();if(t===RegExp)return e.toString()===n.toString();if(t===Array){if((r=e.length)===n.length)for(;r--&&F0(e[r],n[r]););return r===-1}if(t===Set){if(e.size!==n.size)return!1;for(r of e)if(s=r,s&&typeof s=="object"&&(s=Tj(n,s),!s)||!n.has(s))return!1;return!0}if(t===Map){if(e.size!==n.size)return!1;for(r of e)if(s=r[0],s&&typeof s=="object"&&(s=Tj(n,s),!s)||!F0(r[1],n.get(s)))return!1;return!0}if(t===ArrayBuffer)e=new Uint8Array(e),n=new Uint8Array(n);else if(t===DataView){if((r=e.byteLength)===n.byteLength)for(;r--&&e.getInt8(r)===n.getInt8(r););return r===-1}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===n.byteLength)for(;r--&&e[r]===n[r];);return r===-1}if(!t||typeof e=="object"){r=0;for(t in e)if(jj.call(e,t)&&++r&&!jj.call(n,t)||!(t in n)||!F0(e[t],n[t]))return!1;return Object.keys(n).length===r}}return e!==e&&n!==n}const Mxt=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dxt=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Lxt={};function Aj(e,n){return(Lxt.jsx?Dxt:Mxt).test(e)}const Oxt=/[ \t\n\f\r]/g;function Ixt(e){return typeof e=="object"?e.type==="text"?Rj(e.value):!1:Rj(e)}function Rj(e){return e.replace(Oxt,"")===""}var Pf={},Zx,Mj;function Bxt(){if(Mj)return Zx;Mj=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,t=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,l=` +`,u="/",_="*",d="",p="comment",m="declaration";function x(v,b){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];b=b||{};var w=1,y=1;function C(H){var Y=H.match(n);Y&&(w+=Y.length);var V=H.lastIndexOf(l);y=~V?H.length-V:y+H.length}function E(){var H={line:w,column:y};return function(Y){return Y.position=new N(H),M(),Y}}function N(H){this.start=H,this.end={line:w,column:y},this.source=b.source}N.prototype.content=v;function T(H){var Y=new Error(b.source+":"+w+":"+y+": "+H);if(Y.reason=H,Y.filename=b.source,Y.line=w,Y.column=y,Y.source=v,!b.silent)throw Y}function z(H){var Y=H.exec(v);if(Y){var V=Y[0];return C(V),v=v.slice(V.length),Y}}function M(){z(t)}function I(H){var Y;for(H=H||[];Y=B();)Y!==!1&&H.push(Y);return H}function B(){var H=E();if(!(u!=v.charAt(0)||_!=v.charAt(1))){for(var Y=2;d!=v.charAt(Y)&&(_!=v.charAt(Y)||u!=v.charAt(Y+1));)++Y;if(Y+=2,d===v.charAt(Y-1))return T("End of comment missing");var V=v.slice(2,Y-2);return y+=2,C(V),v=v.slice(Y),y+=2,H({type:p,comment:V})}}function $(){var H=E(),Y=z(r);if(Y){if(B(),!z(s))return T("property missing ':'");var V=z(i),X=H({type:m,property:S(Y[0].replace(e,d)),value:V?S(V[0].replace(e,d)):d});return z(a),X}}function U(){var H=[];I(H);for(var Y;Y=$();)Y!==!1&&(H.push(Y),I(H));return H}return M(),U()}function S(v){return v?v.replace(o,d):d}return Zx=x,Zx}var Dj;function $xt(){if(Dj)return Pf;Dj=1;var e=Pf&&Pf.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Pf,"__esModule",{value:!0}),Pf.default=t;const n=e(Bxt());function t(r,s){let i=null;if(!r||typeof r!="string")return i;const a=(0,n.default)(r),o=typeof s=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:_}=l;o?s(u,_,l):_&&(i=i||{},i[u]=_)}),i}return Pf}var _0={},Lj;function Pxt(){if(Lj)return _0;Lj=1,Object.defineProperty(_0,"__esModule",{value:!0}),_0.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,t=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(u){return!u||t.test(u)||e.test(u)},a=function(u,_){return _.toUpperCase()},o=function(u,_){return"".concat(_,"-")},l=function(u,_){return _===void 0&&(_={}),i(u)?u:(u=u.toLowerCase(),_.reactCompat?u=u.replace(s,o):u=u.replace(r,o),u.replace(n,a))};return _0.camelCase=l,_0}var p0,Oj;function Fxt(){if(Oj)return p0;Oj=1;var e=p0&&p0.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},n=e($xt()),t=Pxt();function r(s,i){var a={};return!s||typeof s!="string"||(0,n.default)(s,function(o,l){o&&l&&(a[(0,t.camelCase)(o,i)]=l)}),a}return r.default=r,p0=r,p0}var Hxt=Fxt();const qxt=Gp(Hxt),FS={}.hasOwnProperty,Uxt=new Map,Gxt=/[A-Z]/g,Wxt=new Set(["table","tbody","thead","tfoot","tr"]),Vxt=new Set(["td","th"]),DB="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function LB(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=n.filePath||void 0;let r;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=twt(t,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=ewt(t,n.jsx,n.jsxs)}const s={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:r,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Ab:iB,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},i=OB(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function OB(e,n,t){if(n.type==="element")return Kxt(e,n,t);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return Qxt(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return Xxt(e,n,t);if(n.type==="mdxjsEsm")return Yxt(e,n);if(n.type==="root")return Zxt(e,n,t);if(n.type==="text")return Jxt(e,n)}function Kxt(e,n,t){const r=e.schema;let s=r;n.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Ab,e.schema=s),e.ancestors.push(n);const i=BB(e,n.tagName,!1),a=nwt(e,n);let o=qS(e,n);return Wxt.has(n.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!Ixt(l):!0})),IB(e,a,i,n),HS(a,o),e.ancestors.pop(),e.schema=r,e.create(n,i,a,t)}function Qxt(e,n){if(n.data&&n.data.estree&&e.evaluater){const r=n.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}pp(e,n.position)}function Yxt(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);pp(e,n.position)}function Xxt(e,n,t){const r=e.schema;let s=r;n.name==="svg"&&r.space==="html"&&(s=Ab,e.schema=s),e.ancestors.push(n);const i=n.name===null?e.Fragment:BB(e,n.name,!0),a=rwt(e,n),o=qS(e,n);return IB(e,a,i,n),HS(a,o),e.ancestors.pop(),e.schema=r,e.create(n,i,a,t)}function Zxt(e,n,t){const r={};return HS(r,qS(e,n)),e.create(n,e.Fragment,r,t)}function Jxt(e,n){return n.value}function IB(e,n,t,r){typeof t!="string"&&t!==e.Fragment&&e.passNode&&(n.node=r)}function HS(e,n){if(n.length>0){const t=n.length>1?n:n[0];t&&(e.children=t)}}function ewt(e,n,t){return r;function r(s,i,a,o){const u=Array.isArray(a.children)?t:n;return o?u(i,a,o):u(i,a)}}function twt(e,n){return t;function t(r,s,i,a){const o=Array.isArray(i.children),l=RS(r);return n(s,i,a,o,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function nwt(e,n){const t={};let r,s;for(s in n.properties)if(s!=="children"&&FS.call(n.properties,s)){const i=swt(e,s,n.properties[s]);if(i){const[a,o]=i;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&Vxt.has(n.tagName)?r=o:t[a]=o}}if(r){const i=t.style||(t.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return t}function rwt(e,n){const t={};for(const r of n.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(t,e.evaluater.evaluateExpression(o.argument))}else pp(e,n.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else pp(e,n.position);else i=r.value===null?!0:r.value;t[s]=i}return t}function qS(e,n){const t=[];let r=-1;const s=e.passKeys?new Map:Uxt;for(;++ry.key).filter(y=>y!==void 0));let u=0;for(;u=e.children.length-_&&(N=s.length-(e.children.length-y)),N>=0&&(E=((b=s[N])==null?void 0:b.key)??E);E&&l.has(E)&&((w=s[N])==null?void 0:w.key)!==E;)E=`${E}+`;E&&l.add(E);const T=$B(C,s[N]??null,t,E);i.push(T),T.react!==void 0&&a.push(T.react)}const d=n!==null&&fwt(e,n.node);if(n&&n.key===r&&d&&s.length===i.length&&i.every((y,C)=>y===s[C]))return n;const p=e.type==="element"&&cwt.has(e.tagName)?a.filter(y=>typeof y!="string"||!uwt.test(y)):a,m=p.length>0?p.length===1?p[0]:p:null;let x=d?n==null?void 0:n.shell:null;if(!x){const y=LB({...e,children:[]},t);x={props:y.props,type:y.type}}return{children:i,key:r,node:e,react:f.jsx(x.type,{...x.props,children:m},r),shell:x}}function fwt(e,n){if(e===n)return!0;const{children:t,position:r,...s}=e,{children:i,position:a,...o}=n;return F0(s,o)}function oh(e,n){if(e===n)return!0;if(Array.isArray(e)||Array.isArray(n)){if(!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length)return!1;for(let a=0;as?0:s+n:n=n>s?s:n,t=t>0?t:0,r.length<1e4)a=Array.from(r),a.unshift(n,t),e.splice(...a);else for(t&&e.splice(n,t);i0?(Gi(e,e.length,0,n),e):n}const Bj={}.hasOwnProperty;function FB(e){const n={};let t=-1;for(;++t13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function Xa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}function hn(e,n,t,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(l){return gn(l)?(e.enter(t),o(l)):n(l)}function o(l){return gn(l)&&i++a))return;const T=n.events.length;let z=T,M,I;for(;z--;)if(n.events[z][0]==="exit"&&n.events[z][1].type==="chunkFlow"){if(M){I=n.events[z][1].end;break}M=!0}for(b(r),N=T;Ny;){const E=t[C];n.containerState=E[1],E[0].exit.call(n,e)}t.length=y}function w(){s.write([null]),i=void 0,s=void 0,n.containerState._closeFlow=void 0}}function xwt(e,n,t){return hn(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function qh(e){if(e===null||ar(e)||Md(e))return 1;if(Mb(e))return 2}function Ob(e,n,t){const r=[];let s=-1;for(;++s1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;const d={...e[r][1].end},p={...e[t][1].start};Pj(d,-l),Pj(p,l),a={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...e[t][1].start},end:p},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[t][1].start}},s={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[t][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=va(u,[["enter",e[r][1],n],["exit",e[r][1],n]])),u=va(u,[["enter",s,n],["enter",a,n],["exit",a,n],["enter",i,n]]),u=va(u,Ob(n.parser.constructs.insideSpan.null,e.slice(r+1,t),n)),u=va(u,[["exit",i,n],["enter",o,n],["exit",o,n],["exit",s,n]]),e[t][1].end.offset-e[t][1].start.offset?(_=2,u=va(u,[["enter",e[t][1],n],["exit",e[t][1],n]])):_=0,Gi(e,r-1,t-r+3,u),t=r+u.length-_-2;break}}for(t=-1;++t0&&gn(N)?hn(e,w,"linePrefix",i+1)(N):w(N)}function w(N){return N===null||St(N)?e.check(Fj,S,C)(N):(e.enter("codeFlowValue"),y(N))}function y(N){return N===null||St(N)?(e.exit("codeFlowValue"),w(N)):(e.consume(N),y)}function C(N){return e.exit("codeFenced"),n(N)}function E(N,T,z){let M=0;return I;function I(Y){return N.enter("lineEnding"),N.consume(Y),N.exit("lineEnding"),B}function B(Y){return N.enter("codeFencedFence"),gn(Y)?hn(N,$,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):$(Y)}function $(Y){return Y===o?(N.enter("codeFencedFenceSequence"),U(Y)):z(Y)}function U(Y){return Y===o?(M++,N.consume(Y),U):M>=a?(N.exit("codeFencedFenceSequence"),gn(Y)?hn(N,H,"whitespace")(Y):H(Y)):z(Y)}function H(Y){return Y===null||St(Y)?(N.exit("codeFencedFence"),T(Y)):z(Y)}}}function Mwt(e,n,t){const r=this;return s;function s(a){return a===null?t(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?t(a):n(a)}}const Jx={name:"codeIndented",tokenize:Lwt},Dwt={partial:!0,tokenize:Owt};function Lwt(e,n,t){const r=this;return s;function s(u){return e.enter("codeIndented"),hn(e,i,"linePrefix",5)(u)}function i(u){const _=r.events[r.events.length-1];return _&&_[1].type==="linePrefix"&&_[2].sliceSerialize(_[1],!0).length>=4?a(u):t(u)}function a(u){return u===null?l(u):St(u)?e.attempt(Dwt,a,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||St(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),n(u)}}function Owt(e,n,t){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?t(a):St(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):hn(e,i,"linePrefix",5)(a)}function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?n(a):St(a)?s(a):t(a)}}const Iwt={name:"codeText",previous:$wt,resolve:Bwt,tokenize:Pwt};function Bwt(e){let n=e.length-4,t=3,r,s;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=t;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return nthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(n,t,r){const s=t||0;this.setCursor(Math.trunc(n));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&m0(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),m0(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),m0(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n=4?n(a):e.interrupt(r.parser.constructs.flow,t,n)(a)}}function VB(e,n,t,r,s,i,a,o,l){const u=l||Number.POSITIVE_INFINITY;let _=0;return d;function d(b){return b===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(b),e.exit(i),p):b===null||b===32||b===41||mv(b)?t(b):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),S(b))}function p(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(s),e.exit(r),n):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===62?(e.exit("chunkString"),e.exit(o),p(b)):b===null||b===60||St(b)?t(b):(e.consume(b),b===92?x:m)}function x(b){return b===60||b===62||b===92?(e.consume(b),m):m(b)}function S(b){return!_&&(b===null||b===41||ar(b))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),n(b)):_999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?t(m):m===93?(e.exit(i),e.enter(s),e.consume(m),e.exit(s),e.exit(r),n):St(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),_):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===null||m===91||m===93||St(m)||o++>999?(e.exit("chunkString"),_(m)):(e.consume(m),l||(l=!gn(m)),m===92?p:d)}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,d):d(m)}}function QB(e,n,t,r,s,i){let a;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(s),e.consume(p),e.exit(s),a=p===40?41:p,l):t(p)}function l(p){return p===a?(e.enter(s),e.consume(p),e.exit(s),e.exit(r),n):(e.enter(i),u(p))}function u(p){return p===a?(e.exit(i),l(a)):p===null?t(p):St(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),hn(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),_(p))}function _(p){return p===a||p===null||St(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?d:_)}function d(p){return p===a||p===92?(e.consume(p),_):_(p)}}function H0(e,n){let t;return r;function r(s){return St(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t=!0,r):gn(s)?hn(e,r,t?"linePrefix":"lineSuffix")(s):n(s)}}const Kwt={name:"definition",tokenize:Ywt},Qwt={partial:!0,tokenize:Xwt};function Ywt(e,n,t){const r=this;let s;return i;function i(m){return e.enter("definition"),a(m)}function a(m){return KB.call(r,e,o,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return s=Xa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):t(m)}function l(m){return ar(m)?H0(e,u)(m):u(m)}function u(m){return VB(e,_,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function _(m){return e.attempt(Qwt,d,d)(m)}function d(m){return gn(m)?hn(e,p,"whitespace")(m):p(m)}function p(m){return m===null||St(m)?(e.exit("definition"),r.parser.defined.push(s),n(m)):t(m)}}function Xwt(e,n,t){return r;function r(o){return ar(o)?H0(e,s)(o):t(o)}function s(o){return QB(e,i,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return gn(o)?hn(e,a,"whitespace")(o):a(o)}function a(o){return o===null||St(o)?n(o):t(o)}}const Zwt={name:"hardBreakEscape",tokenize:Jwt};function Jwt(e,n,t){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return St(i)?(e.exit("hardBreakEscape"),n(i)):t(i)}}const e4t={name:"headingAtx",resolve:t4t,tokenize:n4t};function t4t(e,n){let t=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),t-2>r&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&e[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[t][1].end},i={type:"chunkText",start:e[r][1].start,end:e[t][1].end,contentType:"text"},Gi(e,r,t-r+1,[["enter",s,n],["enter",i,n],["exit",i,n],["exit",s,n]])),e}function n4t(e,n,t){let r=0;return s;function s(_){return e.enter("atxHeading"),i(_)}function i(_){return e.enter("atxHeadingSequence"),a(_)}function a(_){return _===35&&r++<6?(e.consume(_),a):_===null||ar(_)?(e.exit("atxHeadingSequence"),o(_)):t(_)}function o(_){return _===35?(e.enter("atxHeadingSequence"),l(_)):_===null||St(_)?(e.exit("atxHeading"),n(_)):gn(_)?hn(e,o,"whitespace")(_):(e.enter("atxHeadingText"),u(_))}function l(_){return _===35?(e.consume(_),l):(e.exit("atxHeadingSequence"),o(_))}function u(_){return _===null||_===35||ar(_)?(e.exit("atxHeadingText"),o(_)):(e.consume(_),u)}}const r4t=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],qj=["pre","script","style","textarea"],s4t={concrete:!0,name:"htmlFlow",resolveTo:o4t,tokenize:l4t},i4t={partial:!0,tokenize:u4t},a4t={partial:!0,tokenize:c4t};function o4t(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function l4t(e,n,t){const r=this;let s,i,a,o,l;return u;function u(G){return _(G)}function _(G){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(G),d}function d(G){return G===33?(e.consume(G),p):G===47?(e.consume(G),i=!0,S):G===63?(e.consume(G),s=3,r.interrupt?n:L):Zs(G)?(e.consume(G),a=String.fromCharCode(G),v):t(G)}function p(G){return G===45?(e.consume(G),s=2,m):G===91?(e.consume(G),s=5,o=0,x):Zs(G)?(e.consume(G),s=4,r.interrupt?n:L):t(G)}function m(G){return G===45?(e.consume(G),r.interrupt?n:L):t(G)}function x(G){const re="CDATA[";return G===re.charCodeAt(o++)?(e.consume(G),o===re.length?r.interrupt?n:$:x):t(G)}function S(G){return Zs(G)?(e.consume(G),a=String.fromCharCode(G),v):t(G)}function v(G){if(G===null||G===47||G===62||ar(G)){const re=G===47,ce=a.toLowerCase();return!re&&!i&&qj.includes(ce)?(s=1,r.interrupt?n(G):$(G)):r4t.includes(a.toLowerCase())?(s=6,re?(e.consume(G),b):r.interrupt?n(G):$(G)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(G):i?w(G):y(G))}return G===45||Is(G)?(e.consume(G),a+=String.fromCharCode(G),v):t(G)}function b(G){return G===62?(e.consume(G),r.interrupt?n:$):t(G)}function w(G){return gn(G)?(e.consume(G),w):I(G)}function y(G){return G===47?(e.consume(G),I):G===58||G===95||Zs(G)?(e.consume(G),C):gn(G)?(e.consume(G),y):I(G)}function C(G){return G===45||G===46||G===58||G===95||Is(G)?(e.consume(G),C):E(G)}function E(G){return G===61?(e.consume(G),N):gn(G)?(e.consume(G),E):y(G)}function N(G){return G===null||G===60||G===61||G===62||G===96?t(G):G===34||G===39?(e.consume(G),l=G,T):gn(G)?(e.consume(G),N):z(G)}function T(G){return G===l?(e.consume(G),l=null,M):G===null||St(G)?t(G):(e.consume(G),T)}function z(G){return G===null||G===34||G===39||G===47||G===60||G===61||G===62||G===96||ar(G)?E(G):(e.consume(G),z)}function M(G){return G===47||G===62||gn(G)?y(G):t(G)}function I(G){return G===62?(e.consume(G),B):t(G)}function B(G){return G===null||St(G)?$(G):gn(G)?(e.consume(G),B):t(G)}function $(G){return G===45&&s===2?(e.consume(G),V):G===60&&s===1?(e.consume(G),X):G===62&&s===4?(e.consume(G),F):G===63&&s===3?(e.consume(G),L):G===93&&s===5?(e.consume(G),O):St(G)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(i4t,q,U)(G)):G===null||St(G)?(e.exit("htmlFlowData"),U(G)):(e.consume(G),$)}function U(G){return e.check(a4t,H,q)(G)}function H(G){return e.enter("lineEnding"),e.consume(G),e.exit("lineEnding"),Y}function Y(G){return G===null||St(G)?U(G):(e.enter("htmlFlowData"),$(G))}function V(G){return G===45?(e.consume(G),L):$(G)}function X(G){return G===47?(e.consume(G),a="",ee):$(G)}function ee(G){if(G===62){const re=a.toLowerCase();return qj.includes(re)?(e.consume(G),F):$(G)}return Zs(G)&&a.length<8?(e.consume(G),a+=String.fromCharCode(G),ee):$(G)}function O(G){return G===93?(e.consume(G),L):$(G)}function L(G){return G===62?(e.consume(G),F):G===45&&s===2?(e.consume(G),L):$(G)}function F(G){return G===null||St(G)?(e.exit("htmlFlowData"),q(G)):(e.consume(G),F)}function q(G){return e.exit("htmlFlow"),n(G)}}function c4t(e,n,t){const r=this;return s;function s(a){return St(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):t(a)}function i(a){return r.parser.lazy[r.now().line]?t(a):n(a)}}function u4t(e,n,t){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(cm,n,t)}}const d4t={name:"htmlText",tokenize:f4t};function f4t(e,n,t){const r=this;let s,i,a;return o;function o(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),l}function l(L){return L===33?(e.consume(L),u):L===47?(e.consume(L),E):L===63?(e.consume(L),y):Zs(L)?(e.consume(L),z):t(L)}function u(L){return L===45?(e.consume(L),_):L===91?(e.consume(L),i=0,x):Zs(L)?(e.consume(L),w):t(L)}function _(L){return L===45?(e.consume(L),m):t(L)}function d(L){return L===null?t(L):L===45?(e.consume(L),p):St(L)?(a=d,X(L)):(e.consume(L),d)}function p(L){return L===45?(e.consume(L),m):d(L)}function m(L){return L===62?V(L):L===45?p(L):d(L)}function x(L){const F="CDATA[";return L===F.charCodeAt(i++)?(e.consume(L),i===F.length?S:x):t(L)}function S(L){return L===null?t(L):L===93?(e.consume(L),v):St(L)?(a=S,X(L)):(e.consume(L),S)}function v(L){return L===93?(e.consume(L),b):S(L)}function b(L){return L===62?V(L):L===93?(e.consume(L),b):S(L)}function w(L){return L===null||L===62?V(L):St(L)?(a=w,X(L)):(e.consume(L),w)}function y(L){return L===null?t(L):L===63?(e.consume(L),C):St(L)?(a=y,X(L)):(e.consume(L),y)}function C(L){return L===62?V(L):y(L)}function E(L){return Zs(L)?(e.consume(L),N):t(L)}function N(L){return L===45||Is(L)?(e.consume(L),N):T(L)}function T(L){return St(L)?(a=T,X(L)):gn(L)?(e.consume(L),T):V(L)}function z(L){return L===45||Is(L)?(e.consume(L),z):L===47||L===62||ar(L)?M(L):t(L)}function M(L){return L===47?(e.consume(L),V):L===58||L===95||Zs(L)?(e.consume(L),I):St(L)?(a=M,X(L)):gn(L)?(e.consume(L),M):V(L)}function I(L){return L===45||L===46||L===58||L===95||Is(L)?(e.consume(L),I):B(L)}function B(L){return L===61?(e.consume(L),$):St(L)?(a=B,X(L)):gn(L)?(e.consume(L),B):M(L)}function $(L){return L===null||L===60||L===61||L===62||L===96?t(L):L===34||L===39?(e.consume(L),s=L,U):St(L)?(a=$,X(L)):gn(L)?(e.consume(L),$):(e.consume(L),H)}function U(L){return L===s?(e.consume(L),s=void 0,Y):L===null?t(L):St(L)?(a=U,X(L)):(e.consume(L),U)}function H(L){return L===null||L===34||L===39||L===60||L===61||L===96?t(L):L===47||L===62||ar(L)?M(L):(e.consume(L),H)}function Y(L){return L===47||L===62||ar(L)?M(L):t(L)}function V(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),n):t(L)}function X(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),ee}function ee(L){return gn(L)?hn(e,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):O(L)}function O(L){return e.enter("htmlTextData"),a(L)}}const GS={name:"labelEnd",resolveAll:m4t,resolveTo:g4t,tokenize:v4t},h4t={tokenize:b4t},_4t={tokenize:y4t},p4t={tokenize:x4t};function m4t(e){let n=-1;const t=[];for(;++n=3&&(u===null||St(u))?(e.exit("thematicBreak"),n(u)):t(u)}function l(u){return u===s?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),gn(u)?hn(e,o,"whitespace")(u):o(u))}}const vi={continuation:{tokenize:A4t},exit:M4t,name:"list",tokenize:T4t},z4t={partial:!0,tokenize:D4t},j4t={partial:!0,tokenize:R4t};function T4t(e,n,t){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return o;function o(m){const x=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:b3(m)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(A1,t,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return t(m)}function l(m){return b3(m)&&++a<10?(e.consume(m),l):(!r.interrupt||a<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):t(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(cm,r.interrupt?t:_,e.attempt(z4t,p,d))}function _(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function d(m){return gn(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):t(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(m)}}function A4t(e,n,t){const r=this;return r.containerState._closeFlow=void 0,e.check(cm,s,i);function s(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,hn(e,n,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!gn(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(j4t,n,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,hn(e,e.attempt(vi,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function R4t(e,n,t){const r=this;return hn(e,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?n(i):t(i)}}function M4t(e){e.exit(this.containerState.type)}function D4t(e,n,t){const r=this;return hn(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!gn(i)&&a&&a[1].type==="listItemPrefixWhitespace"?n(i):t(i)}}const Uj={name:"setextUnderline",resolveTo:L4t,tokenize:O4t};function L4t(e,n){let t=e.length,r,s,i;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){r=t;break}e[t][1].type==="paragraph"&&(s=t)}else e[t][1].type==="content"&&e.splice(t,1),!i&&e[t][1].type==="definition"&&(i=t);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,n]),e.splice(i+1,0,["exit",e[r][1],n]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,n]),e}function O4t(e,n,t){const r=this;let s;return i;function i(u){let _=r.events.length,d;for(;_--;)if(r.events[_][1].type!=="lineEnding"&&r.events[_][1].type!=="linePrefix"&&r.events[_][1].type!=="content"){d=r.events[_][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),s=u,a(u)):t(u)}function a(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===s?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),gn(u)?hn(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||St(u)?(e.exit("setextHeadingLine"),n(u)):t(u)}}const I4t={tokenize:B4t};function B4t(e){const n=this,t=e.attempt(cm,r,e.attempt(this.parser.constructs.flowInitial,s,hn(e,e.attempt(this.parser.constructs.flow,s,e.attempt(qwt,s)),"linePrefix")));return t;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n.currentConstruct=void 0,t}}const $4t={resolveAll:XB()},P4t=YB("string"),F4t=YB("text");function YB(e){return{resolveAll:XB(e==="text"?H4t:void 0),tokenize:n};function n(t){const r=this,s=this.parser.constructs[e],i=t.attempt(s,a,o);return a;function a(_){return u(_)?i(_):o(_)}function o(_){if(_===null){t.consume(_);return}return t.enter("data"),t.consume(_),l}function l(_){return u(_)?(t.exit("data"),i(_)):(t.consume(_),l)}function u(_){if(_===null)return!0;const d=s[_];let p=-1;if(d)for(;++p-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function t3t(e,n){let t=-1;const r=[];let s;for(;++t0){const Vt=Ze.tokenStack[Ze.tokenStack.length-1];(Vt[1]||Wj).call(Ze,void 0,Vt[0])}for(Re.position={start:Bc(we.length>0?we[0][1].start:{line:1,column:1,offset:0}),end:Bc(we.length>0?we[we.length-2][1].end:{line:1,column:1,offset:0})},xt=-1;++xt0&&(Fe(this,nu,de(this,nu)+t.slice(0,r.commitIndex)),t=t.slice(r.commitIndex),r=Vj(t)),de(this,nu)+S3t(t,r)}}nu=new WeakMap;const f3t=new Set(["*","**","_","__"]);function Vj(e){const n={commitIndex:0,delims:[],exclusive:null,links:[],pendingDelim:null,pendingHtml:null};for(let t=0;t0){const en=Ze.tokenStack[Ze.tokenStack.length-1];(en[1]||Wj).call(Ze,void 0,en[0])}for(Ae.position={start:jc(Se.length>0?Se[0][1].start:{line:1,column:1,offset:0}),end:jc(Se.length>0?Se[Se.length-2][1].end:{line:1,column:1,offset:0})},wt=-1;++wt0&&(He(this,Vc,ue(this,Vc)+t.slice(0,r.commitIndex)),t=t.slice(r.commitIndex),r=Vj(t)),ue(this,Vc)+S3t(t,r)}}Vc=new WeakMap;const f3t=new Set(["*","**","_","__"]);function Vj(e){const n={commitIndex:0,delims:[],exclusive:null,links:[],pendingDelim:null,pendingHtml:null};for(let t=0;tt){t=s-1;continue}if(n.exclusive)continue;if(w3t(n)){Kj(n,t,r);continue}const i=g3t(n,e,t);if(i>t){t=i-1;continue}const a=v3t(n,e,t);if(a>t){t=a-1;continue}eo(e,t)||Kj(n,t,r)}return n}function h3t(e,n,t){const r=n[t];return r==="`"?_3t(e,n,t):r==="$"?p3t(e,n,t):r==="~"?m3t(e,n,t):t}function _3t(e,n,t){const r=VS(n,t),s="`".repeat(r),i=e.exclusive;return(i==null?void 0:i.kind)==="fence"?(i.token[0]==="`"&&yv(n,t)&&!eo(n,t)&&r>=i.token.length&&(e.exclusive=null),t+r):(i==null?void 0:i.kind)==="code"?(!eo(n,t)&&r>=i.token.length&&(e.exclusive=null),t+r):i||eo(n,t)?t+r:r>=3&&yv(n,t)?(e.exclusive={kind:"fence",start:t,token:s},t+r):(e.exclusive={kind:"code",start:t,token:s},t+r)}function p3t(e,n,t){const r=VS(n,t),s=e.exclusive;return(s==null?void 0:s.kind)==="math"?(!eo(n,t)&&r>=s.token.length&&(e.exclusive=null),t+r):(s||eo(n,t)||(e.exclusive={kind:"math",start:t,token:r>=2?"$$":"$"}),t+r)}function m3t(e,n,t){const r=VS(n,t),s=e.exclusive;return(s==null?void 0:s.kind)==="fence"&&s.token[0]==="~"?(yv(n,t)&&!eo(n,t)&&r>=s.token.length&&(e.exclusive=null),t+r):s||r<3||!yv(n,t)||eo(n,t)?t:(e.exclusive={kind:"fence",start:t,token:"~".repeat(r)},t+r)}function g3t(e,n,t){if(n[t]!=="<"||eo(n,t))return t;const r=n[t+1];if(r!==void 0&&!n$(r))return t;e.pendingHtml=t;for(let s=t+1;s"||n[s]===` -`)return e.pendingHtml=null,s+1;return n.length}function v3t(e,n,t){const r=b3t(n,t);if(!r)return t;if(eo(n,t))return t+r.length;const s=e.delims.findLastIndex(i=>i.token===r);return s!==-1?(e.delims.splice(s,1),t+r.length):t+r.length===n.length?(e.pendingDelim={start:t,token:r},t+r.length):(y3t(n,t,r)&&e.delims.push({start:t,token:r}),t+r.length)}function b3t(e,n){const t=e[n];if(t==="*")return e.startsWith("***",n)?"***":e.startsWith("**",n)?"**":"*";if(t==="_")return e.startsWith("__",n)?"__":"_";if(t==="~"&&e.startsWith("~~",n))return"~~"}function y3t(e,n,t){const r=e[n+t.length];if(!r||/\s/.test(r))return!1;const s=e[n-1];return!Xj(s)||!Xj(r)}function Kj(e,n,t){const r=e.links.at(-1);if(t==="["){e.links.push({phase:"text",start:n});return}if(t==="]"&&(r==null?void 0:r.phase)==="text"){e.links[e.links.length-1]={phase:"url_wait",start:r.start,textEnd:n};return}if(t==="("&&(r==null?void 0:r.phase)==="url_wait"){e.links[e.links.length-1]={phase:"url",start:r.start,textEnd:r.textEnd,parenDepth:0};return}if(t==="("&&(r==null?void 0:r.phase)==="url"){r.parenDepth+=1;return}if(t===")"&&(r==null?void 0:r.phase)==="url"){if(r.parenDepth>0){r.parenDepth-=1;return}e.links.pop()}}function x3t(e){var n,t;e.delims.length=0,e.links.length=0,((n=e.exclusive)==null?void 0:n.kind)!=="fence"&&(((t=e.exclusive)==null?void 0:t.kind)==="math"&&e.exclusive.token==="$$"||(e.exclusive=null))}function w3t(e){var t;const n=(t=e.links.at(-1))==null?void 0:t.phase;return n==="url_wait"||n==="url"}function S3t(e,n){n.pendingHtml!==null&&(e=e.slice(0,E3t(e,n.pendingHtml)));const t=n.links.at(-1);if(t)return yo(k3t(e,t));const r=C3t(n);if(r)return yo(sh(e,r));const s=j3t(n);return s?s.kind==="delim"?yo(E3(e,s.start,s.token.length)?e$(e,s.token):e.slice(0,s.start)):E3(e,s.start,s.token.length)?s.kind==="fence"?yo(e):s.kind==="code"?yo(sh(e,s.token)):s.token==="$$"?yo(sh(e,(e.endsWith(` +`){x3t(n),n.exclusive||(n.commitIndex=t+1);continue}const s=h3t(n,e,t);if(s>t){t=s-1;continue}if(n.exclusive)continue;if(w3t(n)){Kj(n,t,r);continue}const i=g3t(n,e,t);if(i>t){t=i-1;continue}const a=v3t(n,e,t);if(a>t){t=a-1;continue}Za(e,t)||Kj(n,t,r)}return n}function h3t(e,n,t){const r=n[t];return r==="`"?_3t(e,n,t):r==="$"?p3t(e,n,t):r==="~"?m3t(e,n,t):t}function _3t(e,n,t){const r=VS(n,t),s="`".repeat(r),i=e.exclusive;return(i==null?void 0:i.kind)==="fence"?(i.token[0]==="`"&&yv(n,t)&&!Za(n,t)&&r>=i.token.length&&(e.exclusive=null),t+r):(i==null?void 0:i.kind)==="code"?(!Za(n,t)&&r>=i.token.length&&(e.exclusive=null),t+r):i||Za(n,t)?t+r:r>=3&&yv(n,t)?(e.exclusive={kind:"fence",start:t,token:s},t+r):(e.exclusive={kind:"code",start:t,token:s},t+r)}function p3t(e,n,t){const r=VS(n,t),s=e.exclusive;return(s==null?void 0:s.kind)==="math"?(!Za(n,t)&&r>=s.token.length&&(e.exclusive=null),t+r):(s||Za(n,t)||(e.exclusive={kind:"math",start:t,token:r>=2?"$$":"$"}),t+r)}function m3t(e,n,t){const r=VS(n,t),s=e.exclusive;return(s==null?void 0:s.kind)==="fence"&&s.token[0]==="~"?(yv(n,t)&&!Za(n,t)&&r>=s.token.length&&(e.exclusive=null),t+r):s||r<3||!yv(n,t)||Za(n,t)?t:(e.exclusive={kind:"fence",start:t,token:"~".repeat(r)},t+r)}function g3t(e,n,t){if(n[t]!=="<"||Za(n,t))return t;const r=n[t+1];if(r!==void 0&&!n$(r))return t;e.pendingHtml=t;for(let s=t+1;s"||n[s]===` +`)return e.pendingHtml=null,s+1;return n.length}function v3t(e,n,t){const r=b3t(n,t);if(!r)return t;if(Za(n,t))return t+r.length;const s=e.delims.findLastIndex(i=>i.token===r);return s!==-1?(e.delims.splice(s,1),t+r.length):t+r.length===n.length?(e.pendingDelim={start:t,token:r},t+r.length):(y3t(n,t,r)&&e.delims.push({start:t,token:r}),t+r.length)}function b3t(e,n){const t=e[n];if(t==="*")return e.startsWith("***",n)?"***":e.startsWith("**",n)?"**":"*";if(t==="_")return e.startsWith("__",n)?"__":"_";if(t==="~"&&e.startsWith("~~",n))return"~~"}function y3t(e,n,t){const r=e[n+t.length];if(!r||/\s/.test(r))return!1;const s=e[n-1];return!Xj(s)||!Xj(r)}function Kj(e,n,t){const r=e.links.at(-1);if(t==="["){e.links.push({phase:"text",start:n});return}if(t==="]"&&(r==null?void 0:r.phase)==="text"){e.links[e.links.length-1]={phase:"url_wait",start:r.start,textEnd:n};return}if(t==="("&&(r==null?void 0:r.phase)==="url_wait"){e.links[e.links.length-1]={phase:"url",start:r.start,textEnd:r.textEnd,parenDepth:0};return}if(t==="("&&(r==null?void 0:r.phase)==="url"){r.parenDepth+=1;return}if(t===")"&&(r==null?void 0:r.phase)==="url"){if(r.parenDepth>0){r.parenDepth-=1;return}e.links.pop()}}function x3t(e){var n,t;e.delims.length=0,e.links.length=0,((n=e.exclusive)==null?void 0:n.kind)!=="fence"&&(((t=e.exclusive)==null?void 0:t.kind)==="math"&&e.exclusive.token==="$$"||(e.exclusive=null))}function w3t(e){var t;const n=(t=e.links.at(-1))==null?void 0:t.phase;return n==="url_wait"||n==="url"}function S3t(e,n){n.pendingHtml!==null&&(e=e.slice(0,E3t(e,n.pendingHtml)));const t=n.links.at(-1);if(t)return yo(k3t(e,t));const r=C3t(n);if(r)return yo(eh(e,r));const s=j3t(n);return s?s.kind==="delim"?yo(E3(e,s.start,s.token.length)?e$(e,s.token):e.slice(0,s.start)):E3(e,s.start,s.token.length)?s.kind==="fence"?yo(e):s.kind==="code"?yo(eh(e,s.token)):s.token==="$$"?yo(eh(e,(e.endsWith(` `)?"":` -`)+"$$")):/\s/.test(e[e.length-1]??"")?yo(e):yo(sh(e,"$")):yo(s.kind==="fence"?e:e.slice(0,s.start)):yo(n.pendingDelim?e.slice(0,n.pendingDelim.start):e)}function k3t(e,n){const t=e.slice(0,n.start);if(n.phase==="text")return E3(e,n.start,1)?t+e.slice(n.start+1):t;const r=e.slice(n.start+1,n.textEnd);return n.phase==="url_wait"?t+r+e.slice(n.textEnd+1):t+r}function C3t(e){const n=[];if(e.exclusive){if(e.exclusive.kind!=="code")return;n.push(e.exclusive.token)}for(let t=e.delims.length-1;t>=0;t--){const r=e.delims[t].token;if(!f3t.has(r))return;n.push(r)}if(!(n.length<2))return n.join("")}function E3t(e,n){let t=n,r=n;for(;r>0;){const s=e.lastIndexOf("<",r-1);if(s===-1||!N3t(e,s,r))break;t=s,r=s}return t}function N3t(e,n,t){if(e[t-1]!==">"||eo(e,n))return!1;const r=e[n+1];if(r!==void 0&&!n$(r))return!1;for(let s=n+1;s"||i===` +`)+"$$")):/\s/.test(e[e.length-1]??"")?yo(e):yo(eh(e,"$")):yo(s.kind==="fence"?e:e.slice(0,s.start)):yo(n.pendingDelim?e.slice(0,n.pendingDelim.start):e)}function k3t(e,n){const t=e.slice(0,n.start);if(n.phase==="text")return E3(e,n.start,1)?t+e.slice(n.start+1):t;const r=e.slice(n.start+1,n.textEnd);return n.phase==="url_wait"?t+r+e.slice(n.textEnd+1):t+r}function C3t(e){const n=[];if(e.exclusive){if(e.exclusive.kind!=="code")return;n.push(e.exclusive.token)}for(let t=e.delims.length-1;t>=0;t--){const r=e.delims[t].token;if(!f3t.has(r))return;n.push(r)}if(!(n.length<2))return n.join("")}function E3t(e,n){let t=n,r=n;for(;r>0;){const s=e.lastIndexOf("<",r-1);if(s===-1||!N3t(e,s,r))break;t=s,r=s}return t}function N3t(e,n,t){if(e[t-1]!==">"||Za(e,n))return!1;const r=e[n+1];if(r!==void 0&&!n$(r))return!1;for(let s=n+1;s"||i===` `)return!1}return!0}function yo(e){var v;const n=e.lastIndexOf(` `),t=n===-1?0:n+2,r=e.slice(0,t),s=e.slice(t),i=s.indexOf(` @@ -702,10 +702,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `),x=m===-1?d:d.slice(0,m),S=m===-1?"":d.slice(m);if(A3t(x,o,_))return e;if(x.startsWith(o+"|")&&/^[ |:\-\t]*$/.test(x.slice(o.length))){const b=t$(x,o).map(w=>{const y=w.trim();if(y.length===0)return"-";let C=0;for(let E=0;E1&&y.endsWith(":")?":":"")});for(;b.length<_;)b.push("-");return r+l+` `+Yj(o,b)+S}return r+l+` `+p+` -`+d}function sh(e,n){return e+n.slice(z3t(e,n))}function e$(e,n){var s;const t=(s=e.match(/[^\S\n]+$/))==null?void 0:s[0];if(!t)return sh(e,n);const r=e.slice(0,-t.length);return sh(r,n)+t}function z3t(e,n){for(let t=Math.min(e.length,n.length);t>0;t-=1)if(e.endsWith(n.slice(0,t)))return t;return 0}function j3t(e){const n=e.delims.at(-1);return e.exclusive&&(!n||e.exclusive.start>n.start)?e.exclusive:n?{kind:"delim",start:n.start,token:n.token}:e.exclusive}function Qj(e){let n=0;for(let t=0;t0}function Yj(e,n){return e+"|"+n.map(t=>` ${t} |`).join("")}function t$(e,n){const t=e.slice(n.length+1).split("|");return e.trimEnd().endsWith("|")&&t.pop(),t}function A3t(e,n,t){if(!e.startsWith(n))return!1;const r=e.slice(n.length).trim();if(!r.startsWith("|")||!r.endsWith("|"))return!1;const s=t$(r,"").map(i=>i.trim());return s.length===t&&s.every(i=>/^:?-+:?$/.test(i))}function VS(e,n){let t=n+1;for(;tn+t}function yv(e,n){return n===0||e[n-1]===` -`}function eo(e,n){let t=0;for(let r=n-1;r>=0&&e[r]==="\\";r--)t+=1;return t%2===1}function Xj(e){return!!e&&/[A-Za-z0-9]/.test(e)}function n$(e){return!!e&&/[A-Za-z]/.test(e)}const r$=PS().use(WS);var Pp,Mh,Dh,xd,Lh,Fp,Hp,qp,wd,Up,Sd;class R3t{constructor(){rt(this,Pp,r$);rt(this,Mh,null);rt(this,Dh,{});rt(this,xd,null);rt(this,Lh,"");rt(this,Fp,[]);rt(this,Hp,[]);rt(this,qp,[]);rt(this,wd,0);rt(this,Up,[]);rt(this,Sd,[])}reconfigure(n,t,r){de(this,Mh)!==null&&de(this,Pp)===n&&s$(de(this,Dh),r)&&!!de(this,xd)===t||(Fe(this,Pp,n),n.attachers.some(s=>s[0]===bv)||(n=n(),n.use(bv),n.freeze()),Fe(this,Mh,n),Fe(this,Dh,r),Fe(this,Lh,""),Fe(this,Fp,[]),Fe(this,Hp,[]),Fe(this,qp,[]),Fe(this,wd,0),Fe(this,Up,[]),Fe(this,xd,t?new d3t:null))}update(n){de(this,xd)&&(n=de(this,xd).update(n));let t=de(this,Lh);if(n===t)return de(this,Sd);const r=de(this,Fp),s=M3t(n,t);let i=r.length-1;for(;i>=0&&!(s>=r[i]);i-=1);let a=r[i]??0;i===-1&&(i=0);const o=Yu(de(this,Mh)),l=de(this,Hp),u=l.slice(i).some(N=>N.some(N3));let _=o.parse(n.slice(a)),d=_.children.map(N=>Yu(Yu(N.position).start.offset)+a);Fe(this,Lh,n),qx(r.length===l.length),r.splice(i,r.length-i,...d);{const N=tw(_,d,a);qx(N.length===d.length),l.splice(i,l.length-i,...N)}if(u||N3(_)){i=0,a=0,_=o.parse(n),d=_.children.map(T=>Yu(Yu(T.position).start.offset)+a),r.splice(0,r.length,...d);const N=tw(_,d,a);qx(N.length===d.length),l.splice(0,l.length,...N)}const p=tw(o.runSync(_),d,a),m=de(this,qp),x=de(this,Up),S=de(this,Sd),v=x.length;let b=null,w=0;for(;wv&&(m.length=x.length=r.length);for(let N=r.length=C?M=v-(r.length-T):T=v){m[T]=String(de(this,wd)),Fe(this,wd,de(this,wd)+1),x[T]=null,b&&(b[T]=void 0);continue}m[T]=m[M]??String(r0(this,wd)._++),x[T]=x[M]??null,b&&(b[T]=S[M])}r.length[]);let s=0;for(const a of e.children){const o=(i=a.position)==null?void 0:i.start.offset;if(o!==void 0){for(;s+1s||t!==-1&&n>t||r!==-1&&n>r||P3t.test(e.slice(0,n))?e:""}const rw={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function W3t(e,n){return a$(e,{})||{type:"root",children:[]}}function a$(e,n){const t=V3t(e,n);return t&&n.afterTransform&&n.afterTransform(e,t),t}function V3t(e,n){switch(e.nodeType){case 1:return X3t(e,n);case 3:return Q3t(e);case 8:return Y3t(e);case 9:return tT(e,n);case 10:return K3t();case 11:return tT(e,n);default:return}}function tT(e,n){return{type:"root",children:o$(e,n)}}function K3t(){return{type:"doctype"}}function Q3t(e){return{type:"text",value:e.nodeValue||""}}function Y3t(e){return{type:"comment",value:e.nodeValue||""}}function X3t(e,n){const t=e.namespaceURI,r=t===rw.svg?Jbt:oB,s=t===rw.html?e.tagName.toLowerCase():e.tagName,i=t===rw.html&&s==="template"?e.content:e,a=e.getAttributeNames(),o={};let l=-1;for(;++lu&&(u=_):_&&(u!==void 0&&u>-1&&l.push(` +`+d}function eh(e,n){return e+n.slice(z3t(e,n))}function e$(e,n){var s;const t=(s=e.match(/[^\S\n]+$/))==null?void 0:s[0];if(!t)return eh(e,n);const r=e.slice(0,-t.length);return eh(r,n)+t}function z3t(e,n){for(let t=Math.min(e.length,n.length);t>0;t-=1)if(e.endsWith(n.slice(0,t)))return t;return 0}function j3t(e){const n=e.delims.at(-1);return e.exclusive&&(!n||e.exclusive.start>n.start)?e.exclusive:n?{kind:"delim",start:n.start,token:n.token}:e.exclusive}function Qj(e){let n=0;for(let t=0;t0}function Yj(e,n){return e+"|"+n.map(t=>` ${t} |`).join("")}function t$(e,n){const t=e.slice(n.length+1).split("|");return e.trimEnd().endsWith("|")&&t.pop(),t}function A3t(e,n,t){if(!e.startsWith(n))return!1;const r=e.slice(n.length).trim();if(!r.startsWith("|")||!r.endsWith("|"))return!1;const s=t$(r,"").map(i=>i.trim());return s.length===t&&s.every(i=>/^:?-+:?$/.test(i))}function VS(e,n){let t=n+1;for(;tn+t}function yv(e,n){return n===0||e[n-1]===` +`}function Za(e,n){let t=0;for(let r=n-1;r>=0&&e[r]==="\\";r--)t+=1;return t%2===1}function Xj(e){return!!e&&/[A-Za-z0-9]/.test(e)}function n$(e){return!!e&&/[A-Za-z]/.test(e)}const r$=PS().use(WS);var Pp,jh,Th,gd,Ah,Fp,Hp,qp,vd,Up,bd;class R3t{constructor(){nt(this,Pp,r$);nt(this,jh,null);nt(this,Th,{});nt(this,gd,null);nt(this,Ah,"");nt(this,Fp,[]);nt(this,Hp,[]);nt(this,qp,[]);nt(this,vd,0);nt(this,Up,[]);nt(this,bd,[])}reconfigure(n,t,r){ue(this,jh)!==null&&ue(this,Pp)===n&&s$(ue(this,Th),r)&&!!ue(this,gd)===t||(He(this,Pp,n),n.attachers.some(s=>s[0]===bv)||(n=n(),n.use(bv),n.freeze()),He(this,jh,n),He(this,Th,r),He(this,Ah,""),He(this,Fp,[]),He(this,Hp,[]),He(this,qp,[]),He(this,vd,0),He(this,Up,[]),He(this,gd,t?new d3t:null))}update(n){ue(this,gd)&&(n=ue(this,gd).update(n));let t=ue(this,Ah);if(n===t)return ue(this,bd);const r=ue(this,Fp),s=M3t(n,t);let i=r.length-1;for(;i>=0&&!(s>=r[i]);i-=1);let a=r[i]??0;i===-1&&(i=0);const o=Wu(ue(this,jh)),l=ue(this,Hp),u=l.slice(i).some(N=>N.some(N3));let _=o.parse(n.slice(a)),d=_.children.map(N=>Wu(Wu(N.position).start.offset)+a);He(this,Ah,n),qx(r.length===l.length),r.splice(i,r.length-i,...d);{const N=tw(_,d,a);qx(N.length===d.length),l.splice(i,l.length-i,...N)}if(u||N3(_)){i=0,a=0,_=o.parse(n),d=_.children.map(T=>Wu(Wu(T.position).start.offset)+a),r.splice(0,r.length,...d);const N=tw(_,d,a);qx(N.length===d.length),l.splice(0,l.length,...N)}const p=tw(o.runSync(_),d,a),m=ue(this,qp),x=ue(this,Up),S=ue(this,bd),v=x.length;let b=null,w=0;for(;wv&&(m.length=x.length=r.length);for(let N=r.length=C?M=v-(r.length-T):T=v){m[T]=String(ue(this,vd)),He(this,vd,ue(this,vd)+1),x[T]=null,b&&(b[T]=void 0);continue}m[T]=m[M]??String(r0(this,vd)._++),x[T]=x[M]??null,b&&(b[T]=S[M])}r.length[]);let s=0;for(const a of e.children){const o=(i=a.position)==null?void 0:i.start.offset;if(o!==void 0){for(;s+1s||t!==-1&&n>t||r!==-1&&n>r||P3t.test(e.slice(0,n))?e:""}const rw={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function W3t(e,n){return a$(e,{})||{type:"root",children:[]}}function a$(e,n){const t=V3t(e,n);return t&&n.afterTransform&&n.afterTransform(e,t),t}function V3t(e,n){switch(e.nodeType){case 1:return X3t(e,n);case 3:return Q3t(e);case 8:return Y3t(e);case 9:return tT(e,n);case 10:return K3t();case 11:return tT(e,n);default:return}}function tT(e,n){return{type:"root",children:o$(e,n)}}function K3t(){return{type:"doctype"}}function Q3t(e){return{type:"text",value:e.nodeValue||""}}function Y3t(e){return{type:"comment",value:e.nodeValue||""}}function X3t(e,n){const t=e.namespaceURI,r=t===rw.svg?Jbt:oB,s=t===rw.html?e.tagName.toLowerCase():e.tagName,i=t===rw.html&&s==="template"?e.content:e,a=e.getAttributeNames(),o={};let l=-1;for(;++lu&&(u=_):_&&(u!==void 0&&u>-1&&l.push(` `.repeat(u)||" "),u=-1,l.push(_))}return l.join("")}function c$(e,n,t){return e.type==="element"?o5t(e,n,t):e.type==="text"?t.whitespace==="normal"?u$(e,t):l5t(e):[]}function o5t(e,n,t){const r=d$(e,t),s=e.children||[];let i=-1,a=[];if(i5t(e))return a;let o,l;for(z3(e)||aT(e)&&nT(n,e,aT)?l=` -`:s5t(e)?(o=2,l=2):l$(e)&&(o=1,l=1);++i15?u="…"+o.slice(s-15,s):u=o.slice(0,s);var _;i+15e.replace(h5t,"-$1").toLowerCase(),p5t={"&":"&",">":">","<":"<",'"':""","'":"'"},m5t=/[&><"']/g,Ks=e=>String(e).replace(m5t,n=>p5t[n]),R1=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?R1(e.body[0]):e:e.type==="font"?R1(e.body):e,g5t=new Set(["mathord","textord","atom"]),Wl=e=>g5t.has(R1(e).type),v5t=e=>{var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},j3={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,n)=>(n.push(e),n)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand ",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function b5t(e){if(typeof e!="string")return e.enum[0];switch(e){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function y5t(e){if(e.default!==void 0)return e.default;var n=Array.isArray(e.type)?e.type[0]:e.type;return b5t(n)}function x5t(e,n,t,r){var s=t[n];e[n]=s!==void 0?r.processor?r.processor(s):s:y5t(r)}class QS{constructor(n){n===void 0&&(n={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,n=n||{};for(var t of Object.keys(j3)){var r=j3[t];r&&x5t(this,t,n,r)}}reportNonstrict(n,t,r){var s=this.strict;if(typeof s=="function"&&(s=s(n,t,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new Ye("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+n+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+n+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+t+" ["+n+"]"))}}useStrictBehavior(n,t,r){var s=this.strict;if(typeof s=="function")try{s=s(n,t,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+n+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+t+" ["+n+"]")),!1)}isTrusted(n){if("url"in n&&n.url&&!n.protocol){var t=v5t(n.url);if(t==null)return!1;n.protocol=t}var r=typeof this.trust=="function"?this.trust(n):this.trust;return!!r}}class $c{constructor(n,t,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=n,this.size=t,this.cramped=r}sup(){return zo[w5t[this.id]]}sub(){return zo[S5t[this.id]]}fracNum(){return zo[k5t[this.id]]}fracDen(){return zo[C5t[this.id]]}cramp(){return zo[E5t[this.id]]}text(){return zo[N5t[this.id]]}isTight(){return this.size>=2}}var YS=0,xv=1,fh=2,Pl=3,mp=4,ka=5,Kh=6,oi=7,zo=[new $c(YS,0,!1),new $c(xv,0,!0),new $c(fh,1,!1),new $c(Pl,1,!0),new $c(mp,2,!1),new $c(ka,2,!0),new $c(Kh,3,!1),new $c(oi,3,!0)],w5t=[mp,ka,mp,ka,Kh,oi,Kh,oi],S5t=[ka,ka,ka,ka,oi,oi,oi,oi],k5t=[fh,Pl,mp,ka,Kh,oi,Kh,oi],C5t=[Pl,Pl,ka,ka,oi,oi,oi,oi],E5t=[xv,xv,Pl,Pl,ka,ka,oi,oi],N5t=[YS,xv,fh,Pl,fh,Pl,fh,Pl],Yt={DISPLAY:zo[YS],TEXT:zo[fh],SCRIPT:zo[mp],SCRIPTSCRIPT:zo[Kh]},T3=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function z5t(e){for(var n=0;n=s[0]&&e<=s[1])return t.name}return null}var M1=[];T3.forEach(e=>e.blocks.forEach(n=>M1.push(...n)));function f$(e){for(var n=0;n=M1[n]&&e<=M1[n+1])return!0;return!1}var _s=e=>e+" "+e,Gf=80,j5t=function(n,t){return"M95,"+(622+n+t)+` +`:s5t(e)?(o=2,l=2):l$(e)&&(o=1,l=1);++i15?u="…"+o.slice(s-15,s):u=o.slice(0,s);var _;i+15e.replace(h5t,"-$1").toLowerCase(),p5t={"&":"&",">":">","<":"<",'"':""","'":"'"},m5t=/[&><"']/g,Bs=e=>String(e).replace(m5t,n=>p5t[n]),R1=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?R1(e.body[0]):e:e.type==="font"?R1(e.body):e,g5t=new Set(["mathord","textord","atom"]),Ul=e=>g5t.has(R1(e).type),v5t=e=>{var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},j3={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,n)=>(n.push(e),n)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand ",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function b5t(e){if(typeof e!="string")return e.enum[0];switch(e){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function y5t(e){if(e.default!==void 0)return e.default;var n=Array.isArray(e.type)?e.type[0]:e.type;return b5t(n)}function x5t(e,n,t,r){var s=t[n];e[n]=s!==void 0?r.processor?r.processor(s):s:y5t(r)}class QS{constructor(n){n===void 0&&(n={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,n=n||{};for(var t of Object.keys(j3)){var r=j3[t];r&&x5t(this,t,n,r)}}reportNonstrict(n,t,r){var s=this.strict;if(typeof s=="function"&&(s=s(n,t,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new Qe("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+n+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+n+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+t+" ["+n+"]"))}}useStrictBehavior(n,t,r){var s=this.strict;if(typeof s=="function")try{s=s(n,t,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+n+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+t+" ["+n+"]")),!1)}isTrusted(n){if("url"in n&&n.url&&!n.protocol){var t=v5t(n.url);if(t==null)return!1;n.protocol=t}var r=typeof this.trust=="function"?this.trust(n):this.trust;return!!r}}class Tc{constructor(n,t,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=n,this.size=t,this.cramped=r}sup(){return zo[w5t[this.id]]}sub(){return zo[S5t[this.id]]}fracNum(){return zo[k5t[this.id]]}fracDen(){return zo[C5t[this.id]]}cramp(){return zo[E5t[this.id]]}text(){return zo[N5t[this.id]]}isTight(){return this.size>=2}}var YS=0,xv=1,lh=2,Bl=3,mp=4,ba=5,Uh=6,Js=7,zo=[new Tc(YS,0,!1),new Tc(xv,0,!0),new Tc(lh,1,!1),new Tc(Bl,1,!0),new Tc(mp,2,!1),new Tc(ba,2,!0),new Tc(Uh,3,!1),new Tc(Js,3,!0)],w5t=[mp,ba,mp,ba,Uh,Js,Uh,Js],S5t=[ba,ba,ba,ba,Js,Js,Js,Js],k5t=[lh,Bl,mp,ba,Uh,Js,Uh,Js],C5t=[Bl,Bl,ba,ba,Js,Js,Js,Js],E5t=[xv,xv,Bl,Bl,ba,ba,Js,Js],N5t=[YS,xv,lh,Bl,lh,Bl,lh,Bl],Xt={DISPLAY:zo[YS],TEXT:zo[lh],SCRIPT:zo[mp],SCRIPTSCRIPT:zo[Uh]},T3=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function z5t(e){for(var n=0;n=s[0]&&e<=s[1])return t.name}return null}var M1=[];T3.forEach(e=>e.blocks.forEach(n=>M1.push(...n)));function f$(e){for(var n=0;n=M1[n]&&e<=M1[n+1])return!0;return!1}var _s=e=>e+" "+e,Ff=80,j5t=function(n,t){return"M95,"+(622+n+t)+` c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 @@ -756,7 +756,7 @@ s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,1 H742v`+s+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 -219 661 l218 661zM702 `+t+"H400000v"+(40+n)+"H742z"},O5t=function(n,t,r){t=1e3*t;var s="";switch(n){case"sqrtMain":s=j5t(t,Gf);break;case"sqrtSize1":s=T5t(t,Gf);break;case"sqrtSize2":s=A5t(t,Gf);break;case"sqrtSize3":s=R5t(t,Gf);break;case"sqrtSize4":s=M5t(t,Gf);break;case"sqrtTall":s=L5t(t,Gf,r)}return s},I5t=function(n,t){switch(n){case"⎜":return _s("M291 0 H417 V"+t+" H291z");case"∣":return _s("M145 0 H188 V"+t+" H145z");case"∥":return _s("M145 0 H188 V"+t+" H145z")+_s("M367 0 H410 V"+t+" H367z");case"⎟":return _s("M457 0 H583 V"+t+" H457z");case"⎢":return _s("M319 0 H403 V"+t+" H319z");case"⎥":return _s("M263 0 H347 V"+t+" H263z");case"⎪":return _s("M384 0 H504 V"+t+" H384z");case"⏐":return _s("M312 0 H355 V"+t+" H312z");case"‖":return _s("M257 0 H300 V"+t+" H257z")+_s("M478 0 H521 V"+t+" H478z");default:return""}},oT={doubleleftarrow:`M262 157 +219 661 l218 661zM702 `+t+"H400000v"+(40+n)+"H742z"},O5t=function(n,t,r){t=1e3*t;var s="";switch(n){case"sqrtMain":s=j5t(t,Ff);break;case"sqrtSize1":s=T5t(t,Ff);break;case"sqrtSize2":s=A5t(t,Ff);break;case"sqrtSize3":s=R5t(t,Ff);break;case"sqrtSize4":s=M5t(t,Ff);break;case"sqrtTall":s=L5t(t,Ff,r)}return s},I5t=function(n,t){switch(n){case"⎜":return _s("M291 0 H417 V"+t+" H291z");case"∣":return _s("M145 0 H188 V"+t+" H145z");case"∥":return _s("M145 0 H188 V"+t+" H145z")+_s("M367 0 H410 V"+t+" H367z");case"⎟":return _s("M457 0 H583 V"+t+" H457z");case"⎢":return _s("M319 0 H403 V"+t+" H319z");case"⎥":return _s("M263 0 H347 V"+t+" H263z");case"⎪":return _s("M384 0 H504 V"+t+" H384z");case"⏐":return _s("M312 0 H355 V"+t+" H312z");case"‖":return _s("M257 0 H300 V"+t+" H257z")+_s("M478 0 H521 V"+t+" H478z");default:return""}},oT={doubleleftarrow:`M262 157 l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 @@ -955,13 +955,13 @@ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6 c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, --470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};function $5t(e){return"toText"in e}class p_{constructor(n){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=n,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(n){return this.classes.includes(n)}toNode(){for(var n=document.createDocumentFragment(),t=0;t{if($5t(n))return n.toText();throw new Error("Expected MathDomNode with toText, got "+n.constructor.name)}).join("")}}var A3={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},P5t={ex:!0,em:!0,mu:!0},h$=function(n){return typeof n!="string"&&(n=n.unit),n in A3||n in P5t||n==="ex"},Ar=function(n,t){var r;if(n.unit in A3)r=A3[n.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(n.unit==="mu")r=t.fontMetrics().cssEmPerMu;else{var s;if(t.style.isTight()?s=t.havingStyle(t.style.text()):s=t,n.unit==="ex")r=s.fontMetrics().xHeight;else if(n.unit==="em")r=s.fontMetrics().quad;else throw new Ye("Invalid unit: '"+n.unit+"'");s!==t&&(r*=s.sizeMultiplier/t.sizeMultiplier)}return Math.min(n.number*r,t.maxSize)},et=function(n){return+n.toFixed(4)+"em"},_u=function(n){return n.filter(t=>t).join(" ")},XS=function(n){var t="";for(var r of Object.keys(n)){var s=n[r];s!==void 0&&(t+=_5t(r)+":"+s+";")}return t},_$=function(n,t,r){if(this.classes=n||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},t){t.style.isTight()&&this.classes.push("mtight");var s=t.getColor();s&&(this.style.color=s)}},p$=function(n){var t=document.createElement(n);t.className=_u(this.classes),Object.assign(t.style,this.style);for(var r of Object.keys(this.attributes))t.setAttribute(r,this.attributes[r]);for(var s=0;s/=\x00-\x1f]/,m$=function(n){var t="<"+n;this.classes.length&&(t+=' class="'+Ks(_u(this.classes))+'"');var r=XS(this.style);r&&(t+=' style="'+Ks(r)+'"');for(var s of Object.keys(this.attributes)){if(F5t.test(s))throw new Ye("Invalid attribute name '"+s+"'");t+=" "+s+'="'+Ks(this.attributes[s])+'"'}t+=">";for(var i=0;i",t};class m_{constructor(n,t,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,_$.call(this,n,r,s),this.children=t||[]}setAttribute(n,t){this.attributes[n]=t}hasClass(n){return this.classes.includes(n)}toNode(){return p$.call(this,"span")}toMarkup(){return m$.call(this,"span")}}class Bb{constructor(n,t,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,_$.call(this,t,s),this.children=r||[],this.setAttribute("href",n)}setAttribute(n,t){this.attributes[n]=t}hasClass(n){return this.classes.includes(n)}toNode(){return p$.call(this,"a")}toMarkup(){return m$.call(this,"a")}}class H5t{constructor(n,t,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=n,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=r}hasClass(n){return this.classes.includes(n)}toNode(){var n=document.createElement("img");return n.src=this.src,n.alt=this.alt,n.className="mord",Object.assign(n.style,this.style),n}toMarkup(){var n=''+Ks(this.alt)+'0&&(t=document.createElement("span"),t.style.marginRight=et(this.italic)),this.classes.length>0&&(t=t||document.createElement("span"),t.className=_u(this.classes)),Object.keys(this.style).length>0&&(t=t||document.createElement("span"),Object.assign(t.style,this.style)),t?(t.appendChild(n),t):n}toMarkup(){var n=!1,t="0&&(r+="margin-right:"+et(this.italic)+";"),r+=XS(this.style),r&&(n=!0,t+=' style="'+Ks(r)+'"');var s=Ks(this.text);return n?(t+=">",t+=s,t+="",t):s}}class ql{constructor(n,t){this.children=void 0,this.attributes=void 0,this.children=n||[],this.attributes=t||{}}toNode(){var n="http://www.w3.org/2000/svg",t=document.createElementNS(n,"svg");for(var r of Object.keys(this.attributes))t.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class R3{constructor(n){this.attributes=void 0,this.attributes=n||{}}toNode(){var n="http://www.w3.org/2000/svg",t=document.createElementNS(n,"line");for(var r of Object.keys(this.attributes))t.setAttribute(r,this.attributes[r]);return t}toMarkup(){var n=" but got "+String(e)+".")}var W5t=e=>e instanceof m_||e instanceof Bb||e instanceof p_,To={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Kg={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},lT={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function V5t(e,n){To[e]=n}function ZS(e,n,t){if(!To[n])throw new Error("Font metrics not found for font: "+n+".");var r=e.charCodeAt(0),s=To[n][r];if(!s&&e[0]in lT&&(r=lT[e[0]].charCodeAt(0),s=To[n][r]),!s&&t==="text"&&f$(r)&&(s=To[n][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var sw={};function K5t(e){var n;if(e>=5?n=0:e>=3?n=1:n=2,!sw[n]){var t=sw[n]={cssEmPerMu:Kg.quad[n]/18};for(var r in Kg)Kg.hasOwnProperty(r)&&(t[r]=Kg[r][n])}return sw[n]}var Sr={math:{},text:{}};function P(e,n,t,r,s,i){Sr[e][s]={font:n,group:t,replace:r},i&&r&&(Sr[e][r]=Sr[e][s])}var W="math",He="text",J="main",fe="ams",Cr="accent-token",ut="bin",ui="close",g_="inner",Ot="mathord",is="op-token",na="open",um="punct",he="rel",Vl="spacing",ve="textord";P(W,J,he,"≡","\\equiv",!0);P(W,J,he,"≺","\\prec",!0);P(W,J,he,"≻","\\succ",!0);P(W,J,he,"∼","\\sim",!0);P(W,J,he,"⊥","\\perp");P(W,J,he,"⪯","\\preceq",!0);P(W,J,he,"⪰","\\succeq",!0);P(W,J,he,"≃","\\simeq",!0);P(W,J,he,"∣","\\mid",!0);P(W,J,he,"≪","\\ll",!0);P(W,J,he,"≫","\\gg",!0);P(W,J,he,"≍","\\asymp",!0);P(W,J,he,"∥","\\parallel");P(W,J,he,"⋈","\\bowtie",!0);P(W,J,he,"⌣","\\smile",!0);P(W,J,he,"⊑","\\sqsubseteq",!0);P(W,J,he,"⊒","\\sqsupseteq",!0);P(W,J,he,"≐","\\doteq",!0);P(W,J,he,"⌢","\\frown",!0);P(W,J,he,"∋","\\ni",!0);P(W,J,he,"∝","\\propto",!0);P(W,J,he,"⊢","\\vdash",!0);P(W,J,he,"⊣","\\dashv",!0);P(W,J,he,"∋","\\owns");P(W,J,um,".","\\ldotp");P(W,J,um,"⋅","\\cdotp");P(W,J,um,"⋅","·");P(He,J,ve,"⋅","·");P(W,J,ve,"#","\\#");P(He,J,ve,"#","\\#");P(W,J,ve,"&","\\&");P(He,J,ve,"&","\\&");P(W,J,ve,"ℵ","\\aleph",!0);P(W,J,ve,"∀","\\forall",!0);P(W,J,ve,"ℏ","\\hbar",!0);P(W,J,ve,"∃","\\exists",!0);P(W,J,ve,"∇","\\nabla",!0);P(W,J,ve,"♭","\\flat",!0);P(W,J,ve,"ℓ","\\ell",!0);P(W,J,ve,"♮","\\natural",!0);P(W,J,ve,"♣","\\clubsuit",!0);P(W,J,ve,"℘","\\wp",!0);P(W,J,ve,"♯","\\sharp",!0);P(W,J,ve,"♢","\\diamondsuit",!0);P(W,J,ve,"ℜ","\\Re",!0);P(W,J,ve,"♡","\\heartsuit",!0);P(W,J,ve,"ℑ","\\Im",!0);P(W,J,ve,"♠","\\spadesuit",!0);P(W,J,ve,"§","\\S",!0);P(He,J,ve,"§","\\S");P(W,J,ve,"¶","\\P",!0);P(He,J,ve,"¶","\\P");P(W,J,ve,"†","\\dag");P(He,J,ve,"†","\\dag");P(He,J,ve,"†","\\textdagger");P(W,J,ve,"‡","\\ddag");P(He,J,ve,"‡","\\ddag");P(He,J,ve,"‡","\\textdaggerdbl");P(W,J,ui,"⎱","\\rmoustache",!0);P(W,J,na,"⎰","\\lmoustache",!0);P(W,J,ui,"⟯","\\rgroup",!0);P(W,J,na,"⟮","\\lgroup",!0);P(W,J,ut,"∓","\\mp",!0);P(W,J,ut,"⊖","\\ominus",!0);P(W,J,ut,"⊎","\\uplus",!0);P(W,J,ut,"⊓","\\sqcap",!0);P(W,J,ut,"∗","\\ast");P(W,J,ut,"⊔","\\sqcup",!0);P(W,J,ut,"◯","\\bigcirc",!0);P(W,J,ut,"∙","\\bullet",!0);P(W,J,ut,"‡","\\ddagger");P(W,J,ut,"≀","\\wr",!0);P(W,J,ut,"⨿","\\amalg");P(W,J,ut,"&","\\And");P(W,J,he,"⟵","\\longleftarrow",!0);P(W,J,he,"⇐","\\Leftarrow",!0);P(W,J,he,"⟸","\\Longleftarrow",!0);P(W,J,he,"⟶","\\longrightarrow",!0);P(W,J,he,"⇒","\\Rightarrow",!0);P(W,J,he,"⟹","\\Longrightarrow",!0);P(W,J,he,"↔","\\leftrightarrow",!0);P(W,J,he,"⟷","\\longleftrightarrow",!0);P(W,J,he,"⇔","\\Leftrightarrow",!0);P(W,J,he,"⟺","\\Longleftrightarrow",!0);P(W,J,he,"↦","\\mapsto",!0);P(W,J,he,"⟼","\\longmapsto",!0);P(W,J,he,"↗","\\nearrow",!0);P(W,J,he,"↩","\\hookleftarrow",!0);P(W,J,he,"↪","\\hookrightarrow",!0);P(W,J,he,"↘","\\searrow",!0);P(W,J,he,"↼","\\leftharpoonup",!0);P(W,J,he,"⇀","\\rightharpoonup",!0);P(W,J,he,"↙","\\swarrow",!0);P(W,J,he,"↽","\\leftharpoondown",!0);P(W,J,he,"⇁","\\rightharpoondown",!0);P(W,J,he,"↖","\\nwarrow",!0);P(W,J,he,"⇌","\\rightleftharpoons",!0);P(W,fe,he,"≮","\\nless",!0);P(W,fe,he,"","\\@nleqslant");P(W,fe,he,"","\\@nleqq");P(W,fe,he,"⪇","\\lneq",!0);P(W,fe,he,"≨","\\lneqq",!0);P(W,fe,he,"","\\@lvertneqq");P(W,fe,he,"⋦","\\lnsim",!0);P(W,fe,he,"⪉","\\lnapprox",!0);P(W,fe,he,"⊀","\\nprec",!0);P(W,fe,he,"⋠","\\npreceq",!0);P(W,fe,he,"⋨","\\precnsim",!0);P(W,fe,he,"⪹","\\precnapprox",!0);P(W,fe,he,"≁","\\nsim",!0);P(W,fe,he,"","\\@nshortmid");P(W,fe,he,"∤","\\nmid",!0);P(W,fe,he,"⊬","\\nvdash",!0);P(W,fe,he,"⊭","\\nvDash",!0);P(W,fe,he,"⋪","\\ntriangleleft");P(W,fe,he,"⋬","\\ntrianglelefteq",!0);P(W,fe,he,"⊊","\\subsetneq",!0);P(W,fe,he,"","\\@varsubsetneq");P(W,fe,he,"⫋","\\subsetneqq",!0);P(W,fe,he,"","\\@varsubsetneqq");P(W,fe,he,"≯","\\ngtr",!0);P(W,fe,he,"","\\@ngeqslant");P(W,fe,he,"","\\@ngeqq");P(W,fe,he,"⪈","\\gneq",!0);P(W,fe,he,"≩","\\gneqq",!0);P(W,fe,he,"","\\@gvertneqq");P(W,fe,he,"⋧","\\gnsim",!0);P(W,fe,he,"⪊","\\gnapprox",!0);P(W,fe,he,"⊁","\\nsucc",!0);P(W,fe,he,"⋡","\\nsucceq",!0);P(W,fe,he,"⋩","\\succnsim",!0);P(W,fe,he,"⪺","\\succnapprox",!0);P(W,fe,he,"≆","\\ncong",!0);P(W,fe,he,"","\\@nshortparallel");P(W,fe,he,"∦","\\nparallel",!0);P(W,fe,he,"⊯","\\nVDash",!0);P(W,fe,he,"⋫","\\ntriangleright");P(W,fe,he,"⋭","\\ntrianglerighteq",!0);P(W,fe,he,"","\\@nsupseteqq");P(W,fe,he,"⊋","\\supsetneq",!0);P(W,fe,he,"","\\@varsupsetneq");P(W,fe,he,"⫌","\\supsetneqq",!0);P(W,fe,he,"","\\@varsupsetneqq");P(W,fe,he,"⊮","\\nVdash",!0);P(W,fe,he,"⪵","\\precneqq",!0);P(W,fe,he,"⪶","\\succneqq",!0);P(W,fe,he,"","\\@nsubseteqq");P(W,fe,ut,"⊴","\\unlhd");P(W,fe,ut,"⊵","\\unrhd");P(W,fe,he,"↚","\\nleftarrow",!0);P(W,fe,he,"↛","\\nrightarrow",!0);P(W,fe,he,"⇍","\\nLeftarrow",!0);P(W,fe,he,"⇏","\\nRightarrow",!0);P(W,fe,he,"↮","\\nleftrightarrow",!0);P(W,fe,he,"⇎","\\nLeftrightarrow",!0);P(W,fe,he,"△","\\vartriangle");P(W,fe,ve,"ℏ","\\hslash");P(W,fe,ve,"▽","\\triangledown");P(W,fe,ve,"◊","\\lozenge");P(W,fe,ve,"Ⓢ","\\circledS");P(W,fe,ve,"®","\\circledR");P(He,fe,ve,"®","\\circledR");P(W,fe,ve,"∡","\\measuredangle",!0);P(W,fe,ve,"∄","\\nexists");P(W,fe,ve,"℧","\\mho");P(W,fe,ve,"Ⅎ","\\Finv",!0);P(W,fe,ve,"⅁","\\Game",!0);P(W,fe,ve,"‵","\\backprime");P(W,fe,ve,"▲","\\blacktriangle");P(W,fe,ve,"▼","\\blacktriangledown");P(W,fe,ve,"■","\\blacksquare");P(W,fe,ve,"⧫","\\blacklozenge");P(W,fe,ve,"★","\\bigstar");P(W,fe,ve,"∢","\\sphericalangle",!0);P(W,fe,ve,"∁","\\complement",!0);P(W,fe,ve,"ð","\\eth",!0);P(He,J,ve,"ð","ð");P(W,fe,ve,"╱","\\diagup");P(W,fe,ve,"╲","\\diagdown");P(W,fe,ve,"□","\\square");P(W,fe,ve,"□","\\Box");P(W,fe,ve,"◊","\\Diamond");P(W,fe,ve,"¥","\\yen",!0);P(He,fe,ve,"¥","\\yen",!0);P(W,fe,ve,"✓","\\checkmark",!0);P(He,fe,ve,"✓","\\checkmark");P(W,fe,ve,"ℶ","\\beth",!0);P(W,fe,ve,"ℸ","\\daleth",!0);P(W,fe,ve,"ℷ","\\gimel",!0);P(W,fe,ve,"ϝ","\\digamma",!0);P(W,fe,ve,"ϰ","\\varkappa");P(W,fe,na,"┌","\\@ulcorner",!0);P(W,fe,ui,"┐","\\@urcorner",!0);P(W,fe,na,"└","\\@llcorner",!0);P(W,fe,ui,"┘","\\@lrcorner",!0);P(W,fe,he,"≦","\\leqq",!0);P(W,fe,he,"⩽","\\leqslant",!0);P(W,fe,he,"⪕","\\eqslantless",!0);P(W,fe,he,"≲","\\lesssim",!0);P(W,fe,he,"⪅","\\lessapprox",!0);P(W,fe,he,"≊","\\approxeq",!0);P(W,fe,ut,"⋖","\\lessdot");P(W,fe,he,"⋘","\\lll",!0);P(W,fe,he,"≶","\\lessgtr",!0);P(W,fe,he,"⋚","\\lesseqgtr",!0);P(W,fe,he,"⪋","\\lesseqqgtr",!0);P(W,fe,he,"≑","\\doteqdot");P(W,fe,he,"≓","\\risingdotseq",!0);P(W,fe,he,"≒","\\fallingdotseq",!0);P(W,fe,he,"∽","\\backsim",!0);P(W,fe,he,"⋍","\\backsimeq",!0);P(W,fe,he,"⫅","\\subseteqq",!0);P(W,fe,he,"⋐","\\Subset",!0);P(W,fe,he,"⊏","\\sqsubset",!0);P(W,fe,he,"≼","\\preccurlyeq",!0);P(W,fe,he,"⋞","\\curlyeqprec",!0);P(W,fe,he,"≾","\\precsim",!0);P(W,fe,he,"⪷","\\precapprox",!0);P(W,fe,he,"⊲","\\vartriangleleft");P(W,fe,he,"⊴","\\trianglelefteq");P(W,fe,he,"⊨","\\vDash",!0);P(W,fe,he,"⊪","\\Vvdash",!0);P(W,fe,he,"⌣","\\smallsmile");P(W,fe,he,"⌢","\\smallfrown");P(W,fe,he,"≏","\\bumpeq",!0);P(W,fe,he,"≎","\\Bumpeq",!0);P(W,fe,he,"≧","\\geqq",!0);P(W,fe,he,"⩾","\\geqslant",!0);P(W,fe,he,"⪖","\\eqslantgtr",!0);P(W,fe,he,"≳","\\gtrsim",!0);P(W,fe,he,"⪆","\\gtrapprox",!0);P(W,fe,ut,"⋗","\\gtrdot");P(W,fe,he,"⋙","\\ggg",!0);P(W,fe,he,"≷","\\gtrless",!0);P(W,fe,he,"⋛","\\gtreqless",!0);P(W,fe,he,"⪌","\\gtreqqless",!0);P(W,fe,he,"≖","\\eqcirc",!0);P(W,fe,he,"≗","\\circeq",!0);P(W,fe,he,"≜","\\triangleq",!0);P(W,fe,he,"∼","\\thicksim");P(W,fe,he,"≈","\\thickapprox");P(W,fe,he,"⫆","\\supseteqq",!0);P(W,fe,he,"⋑","\\Supset",!0);P(W,fe,he,"⊐","\\sqsupset",!0);P(W,fe,he,"≽","\\succcurlyeq",!0);P(W,fe,he,"⋟","\\curlyeqsucc",!0);P(W,fe,he,"≿","\\succsim",!0);P(W,fe,he,"⪸","\\succapprox",!0);P(W,fe,he,"⊳","\\vartriangleright");P(W,fe,he,"⊵","\\trianglerighteq");P(W,fe,he,"⊩","\\Vdash",!0);P(W,fe,he,"∣","\\shortmid");P(W,fe,he,"∥","\\shortparallel");P(W,fe,he,"≬","\\between",!0);P(W,fe,he,"⋔","\\pitchfork",!0);P(W,fe,he,"∝","\\varpropto");P(W,fe,he,"◀","\\blacktriangleleft");P(W,fe,he,"∴","\\therefore",!0);P(W,fe,he,"∍","\\backepsilon");P(W,fe,he,"▶","\\blacktriangleright");P(W,fe,he,"∵","\\because",!0);P(W,fe,he,"⋘","\\llless");P(W,fe,he,"⋙","\\gggtr");P(W,fe,ut,"⊲","\\lhd");P(W,fe,ut,"⊳","\\rhd");P(W,fe,he,"≂","\\eqsim",!0);P(W,J,he,"⋈","\\Join");P(W,fe,he,"≑","\\Doteq",!0);P(W,fe,ut,"∔","\\dotplus",!0);P(W,fe,ut,"∖","\\smallsetminus");P(W,fe,ut,"⋒","\\Cap",!0);P(W,fe,ut,"⋓","\\Cup",!0);P(W,fe,ut,"⩞","\\doublebarwedge",!0);P(W,fe,ut,"⊟","\\boxminus",!0);P(W,fe,ut,"⊞","\\boxplus",!0);P(W,fe,ut,"⋇","\\divideontimes",!0);P(W,fe,ut,"⋉","\\ltimes",!0);P(W,fe,ut,"⋊","\\rtimes",!0);P(W,fe,ut,"⋋","\\leftthreetimes",!0);P(W,fe,ut,"⋌","\\rightthreetimes",!0);P(W,fe,ut,"⋏","\\curlywedge",!0);P(W,fe,ut,"⋎","\\curlyvee",!0);P(W,fe,ut,"⊝","\\circleddash",!0);P(W,fe,ut,"⊛","\\circledast",!0);P(W,fe,ut,"⋅","\\centerdot");P(W,fe,ut,"⊺","\\intercal",!0);P(W,fe,ut,"⋒","\\doublecap");P(W,fe,ut,"⋓","\\doublecup");P(W,fe,ut,"⊠","\\boxtimes",!0);P(W,fe,he,"⇢","\\dashrightarrow",!0);P(W,fe,he,"⇠","\\dashleftarrow",!0);P(W,fe,he,"⇇","\\leftleftarrows",!0);P(W,fe,he,"⇆","\\leftrightarrows",!0);P(W,fe,he,"⇚","\\Lleftarrow",!0);P(W,fe,he,"↞","\\twoheadleftarrow",!0);P(W,fe,he,"↢","\\leftarrowtail",!0);P(W,fe,he,"↫","\\looparrowleft",!0);P(W,fe,he,"⇋","\\leftrightharpoons",!0);P(W,fe,he,"↶","\\curvearrowleft",!0);P(W,fe,he,"↺","\\circlearrowleft",!0);P(W,fe,he,"↰","\\Lsh",!0);P(W,fe,he,"⇈","\\upuparrows",!0);P(W,fe,he,"↿","\\upharpoonleft",!0);P(W,fe,he,"⇃","\\downharpoonleft",!0);P(W,J,he,"⊶","\\origof",!0);P(W,J,he,"⊷","\\imageof",!0);P(W,fe,he,"⊸","\\multimap",!0);P(W,fe,he,"↭","\\leftrightsquigarrow",!0);P(W,fe,he,"⇉","\\rightrightarrows",!0);P(W,fe,he,"⇄","\\rightleftarrows",!0);P(W,fe,he,"↠","\\twoheadrightarrow",!0);P(W,fe,he,"↣","\\rightarrowtail",!0);P(W,fe,he,"↬","\\looparrowright",!0);P(W,fe,he,"↷","\\curvearrowright",!0);P(W,fe,he,"↻","\\circlearrowright",!0);P(W,fe,he,"↱","\\Rsh",!0);P(W,fe,he,"⇊","\\downdownarrows",!0);P(W,fe,he,"↾","\\upharpoonright",!0);P(W,fe,he,"⇂","\\downharpoonright",!0);P(W,fe,he,"⇝","\\rightsquigarrow",!0);P(W,fe,he,"⇝","\\leadsto");P(W,fe,he,"⇛","\\Rrightarrow",!0);P(W,fe,he,"↾","\\restriction");P(W,J,ve,"‘","`");P(W,J,ve,"$","\\$");P(He,J,ve,"$","\\$");P(He,J,ve,"$","\\textdollar");P(W,J,ve,"%","\\%");P(He,J,ve,"%","\\%");P(W,J,ve,"_","\\_");P(He,J,ve,"_","\\_");P(He,J,ve,"_","\\textunderscore");P(W,J,ve,"∠","\\angle",!0);P(W,J,ve,"∞","\\infty",!0);P(W,J,ve,"′","\\prime");P(W,J,ve,"△","\\triangle");P(W,J,ve,"Γ","\\Gamma",!0);P(W,J,ve,"Δ","\\Delta",!0);P(W,J,ve,"Θ","\\Theta",!0);P(W,J,ve,"Λ","\\Lambda",!0);P(W,J,ve,"Ξ","\\Xi",!0);P(W,J,ve,"Π","\\Pi",!0);P(W,J,ve,"Σ","\\Sigma",!0);P(W,J,ve,"Υ","\\Upsilon",!0);P(W,J,ve,"Φ","\\Phi",!0);P(W,J,ve,"Ψ","\\Psi",!0);P(W,J,ve,"Ω","\\Omega",!0);P(W,J,ve,"A","Α");P(W,J,ve,"B","Β");P(W,J,ve,"E","Ε");P(W,J,ve,"Z","Ζ");P(W,J,ve,"H","Η");P(W,J,ve,"I","Ι");P(W,J,ve,"K","Κ");P(W,J,ve,"M","Μ");P(W,J,ve,"N","Ν");P(W,J,ve,"O","Ο");P(W,J,ve,"P","Ρ");P(W,J,ve,"T","Τ");P(W,J,ve,"X","Χ");P(W,J,ve,"¬","\\neg",!0);P(W,J,ve,"¬","\\lnot");P(W,J,ve,"⊤","\\top");P(W,J,ve,"⊥","\\bot");P(W,J,ve,"∅","\\emptyset");P(W,fe,ve,"∅","\\varnothing");P(W,J,Ot,"α","\\alpha",!0);P(W,J,Ot,"β","\\beta",!0);P(W,J,Ot,"γ","\\gamma",!0);P(W,J,Ot,"δ","\\delta",!0);P(W,J,Ot,"ϵ","\\epsilon",!0);P(W,J,Ot,"ζ","\\zeta",!0);P(W,J,Ot,"η","\\eta",!0);P(W,J,Ot,"θ","\\theta",!0);P(W,J,Ot,"ι","\\iota",!0);P(W,J,Ot,"κ","\\kappa",!0);P(W,J,Ot,"λ","\\lambda",!0);P(W,J,Ot,"μ","\\mu",!0);P(W,J,Ot,"ν","\\nu",!0);P(W,J,Ot,"ξ","\\xi",!0);P(W,J,Ot,"ο","\\omicron",!0);P(W,J,Ot,"π","\\pi",!0);P(W,J,Ot,"ρ","\\rho",!0);P(W,J,Ot,"σ","\\sigma",!0);P(W,J,Ot,"τ","\\tau",!0);P(W,J,Ot,"υ","\\upsilon",!0);P(W,J,Ot,"ϕ","\\phi",!0);P(W,J,Ot,"χ","\\chi",!0);P(W,J,Ot,"ψ","\\psi",!0);P(W,J,Ot,"ω","\\omega",!0);P(W,J,Ot,"ε","\\varepsilon",!0);P(W,J,Ot,"ϑ","\\vartheta",!0);P(W,J,Ot,"ϖ","\\varpi",!0);P(W,J,Ot,"ϱ","\\varrho",!0);P(W,J,Ot,"ς","\\varsigma",!0);P(W,J,Ot,"φ","\\varphi",!0);P(W,J,ut,"∗","*",!0);P(W,J,ut,"+","+");P(W,J,ut,"−","-",!0);P(W,J,ut,"⋅","\\cdot",!0);P(W,J,ut,"∘","\\circ",!0);P(W,J,ut,"÷","\\div",!0);P(W,J,ut,"±","\\pm",!0);P(W,J,ut,"×","\\times",!0);P(W,J,ut,"∩","\\cap",!0);P(W,J,ut,"∪","\\cup",!0);P(W,J,ut,"∖","\\setminus",!0);P(W,J,ut,"∧","\\land");P(W,J,ut,"∨","\\lor");P(W,J,ut,"∧","\\wedge",!0);P(W,J,ut,"∨","\\vee",!0);P(W,J,ve,"√","\\surd");P(W,J,na,"⟨","\\langle",!0);P(W,J,na,"∣","\\lvert");P(W,J,na,"∥","\\lVert");P(W,J,ui,"?","?");P(W,J,ui,"!","!");P(W,J,ui,"⟩","\\rangle",!0);P(W,J,ui,"∣","\\rvert");P(W,J,ui,"∥","\\rVert");P(W,J,he,"=","=");P(W,J,he,":",":");P(W,J,he,"≈","\\approx",!0);P(W,J,he,"≅","\\cong",!0);P(W,J,he,"≥","\\ge");P(W,J,he,"≥","\\geq",!0);P(W,J,he,"←","\\gets");P(W,J,he,">","\\gt",!0);P(W,J,he,"∈","\\in",!0);P(W,J,he,"","\\@not");P(W,J,he,"⊂","\\subset",!0);P(W,J,he,"⊃","\\supset",!0);P(W,J,he,"⊆","\\subseteq",!0);P(W,J,he,"⊇","\\supseteq",!0);P(W,fe,he,"⊈","\\nsubseteq",!0);P(W,fe,he,"⊉","\\nsupseteq",!0);P(W,J,he,"⊨","\\models");P(W,J,he,"←","\\leftarrow",!0);P(W,J,he,"≤","\\le");P(W,J,he,"≤","\\leq",!0);P(W,J,he,"<","\\lt",!0);P(W,J,he,"→","\\rightarrow",!0);P(W,J,he,"→","\\to");P(W,fe,he,"≱","\\ngeq",!0);P(W,fe,he,"≰","\\nleq",!0);P(W,J,Vl," ","\\ ");P(W,J,Vl," ","\\space");P(W,J,Vl," ","\\nobreakspace");P(He,J,Vl," ","\\ ");P(He,J,Vl," "," ");P(He,J,Vl," ","\\space");P(He,J,Vl," ","\\nobreakspace");P(W,J,Vl,"","\\nobreak");P(W,J,Vl,"","\\allowbreak");P(W,J,um,",",",");P(W,J,um,";",";");P(W,fe,ut,"⊼","\\barwedge",!0);P(W,fe,ut,"⊻","\\veebar",!0);P(W,J,ut,"⊙","\\odot",!0);P(W,J,ut,"⊕","\\oplus",!0);P(W,J,ut,"⊗","\\otimes",!0);P(W,J,ve,"∂","\\partial",!0);P(W,J,ut,"⊘","\\oslash",!0);P(W,fe,ut,"⊚","\\circledcirc",!0);P(W,fe,ut,"⊡","\\boxdot",!0);P(W,J,ut,"△","\\bigtriangleup");P(W,J,ut,"▽","\\bigtriangledown");P(W,J,ut,"†","\\dagger");P(W,J,ut,"⋄","\\diamond");P(W,J,ut,"⋆","\\star");P(W,J,ut,"◃","\\triangleleft");P(W,J,ut,"▹","\\triangleright");P(W,J,na,"{","\\{");P(He,J,ve,"{","\\{");P(He,J,ve,"{","\\textbraceleft");P(W,J,ui,"}","\\}");P(He,J,ve,"}","\\}");P(He,J,ve,"}","\\textbraceright");P(W,J,na,"{","\\lbrace");P(W,J,ui,"}","\\rbrace");P(W,J,na,"[","\\lbrack",!0);P(He,J,ve,"[","\\lbrack",!0);P(W,J,ui,"]","\\rbrack",!0);P(He,J,ve,"]","\\rbrack",!0);P(W,J,na,"(","\\lparen",!0);P(W,J,ui,")","\\rparen",!0);P(He,J,ve,"<","\\textless",!0);P(He,J,ve,">","\\textgreater",!0);P(W,J,na,"⌊","\\lfloor",!0);P(W,J,ui,"⌋","\\rfloor",!0);P(W,J,na,"⌈","\\lceil",!0);P(W,J,ui,"⌉","\\rceil",!0);P(W,J,ve,"\\","\\backslash");P(W,J,ve,"∣","|");P(W,J,ve,"∣","\\vert");P(He,J,ve,"|","\\textbar",!0);P(W,J,ve,"∥","\\|");P(W,J,ve,"∥","\\Vert");P(He,J,ve,"∥","\\textbardbl");P(He,J,ve,"~","\\textasciitilde");P(He,J,ve,"\\","\\textbackslash");P(He,J,ve,"^","\\textasciicircum");P(W,J,he,"↑","\\uparrow",!0);P(W,J,he,"⇑","\\Uparrow",!0);P(W,J,he,"↓","\\downarrow",!0);P(W,J,he,"⇓","\\Downarrow",!0);P(W,J,he,"↕","\\updownarrow",!0);P(W,J,he,"⇕","\\Updownarrow",!0);P(W,J,is,"∐","\\coprod");P(W,J,is,"⋁","\\bigvee");P(W,J,is,"⋀","\\bigwedge");P(W,J,is,"⨄","\\biguplus");P(W,J,is,"⋂","\\bigcap");P(W,J,is,"⋃","\\bigcup");P(W,J,is,"∫","\\int");P(W,J,is,"∫","\\intop");P(W,J,is,"∬","\\iint");P(W,J,is,"∭","\\iiint");P(W,J,is,"∏","\\prod");P(W,J,is,"∑","\\sum");P(W,J,is,"⨂","\\bigotimes");P(W,J,is,"⨁","\\bigoplus");P(W,J,is,"⨀","\\bigodot");P(W,J,is,"∮","\\oint");P(W,J,is,"∯","\\oiint");P(W,J,is,"∰","\\oiiint");P(W,J,is,"⨆","\\bigsqcup");P(W,J,is,"∫","\\smallint");P(He,J,g_,"…","\\textellipsis");P(W,J,g_,"…","\\mathellipsis");P(He,J,g_,"…","\\ldots",!0);P(W,J,g_,"…","\\ldots",!0);P(W,J,g_,"⋯","\\@cdots",!0);P(W,J,g_,"⋱","\\ddots",!0);P(W,J,ve,"⋮","\\varvdots");P(He,J,ve,"⋮","\\varvdots");P(W,J,Cr,"ˊ","\\acute");P(W,J,Cr,"ˋ","\\grave");P(W,J,Cr,"¨","\\ddot");P(W,J,Cr,"~","\\tilde");P(W,J,Cr,"ˉ","\\bar");P(W,J,Cr,"˘","\\breve");P(W,J,Cr,"ˇ","\\check");P(W,J,Cr,"^","\\hat");P(W,J,Cr,"⃗","\\vec");P(W,J,Cr,"˙","\\dot");P(W,J,Cr,"˚","\\mathring");P(W,J,Ot,"","\\@imath");P(W,J,Ot,"","\\@jmath");P(W,J,ve,"ı","ı");P(W,J,ve,"ȷ","ȷ");P(He,J,ve,"ı","\\i",!0);P(He,J,ve,"ȷ","\\j",!0);P(He,J,ve,"ß","\\ss",!0);P(He,J,ve,"æ","\\ae",!0);P(He,J,ve,"œ","\\oe",!0);P(He,J,ve,"ø","\\o",!0);P(He,J,ve,"Æ","\\AE",!0);P(He,J,ve,"Œ","\\OE",!0);P(He,J,ve,"Ø","\\O",!0);P(He,J,Cr,"ˊ","\\'");P(He,J,Cr,"ˋ","\\`");P(He,J,Cr,"ˆ","\\^");P(He,J,Cr,"˜","\\~");P(He,J,Cr,"ˉ","\\=");P(He,J,Cr,"˘","\\u");P(He,J,Cr,"˙","\\.");P(He,J,Cr,"¸","\\c");P(He,J,Cr,"˚","\\r");P(He,J,Cr,"ˇ","\\v");P(He,J,Cr,"¨",'\\"');P(He,J,Cr,"˝","\\H");P(He,J,Cr,"◯","\\textcircled");var g$={"--":!0,"---":!0,"``":!0,"''":!0};P(He,J,ve,"–","--",!0);P(He,J,ve,"–","\\textendash");P(He,J,ve,"—","---",!0);P(He,J,ve,"—","\\textemdash");P(He,J,ve,"‘","`",!0);P(He,J,ve,"‘","\\textquoteleft");P(He,J,ve,"’","'",!0);P(He,J,ve,"’","\\textquoteright");P(He,J,ve,"“","``",!0);P(He,J,ve,"“","\\textquotedblleft");P(He,J,ve,"”","''",!0);P(He,J,ve,"”","\\textquotedblright");P(W,J,ve,"°","\\degree",!0);P(He,J,ve,"°","\\degree");P(He,J,ve,"°","\\textdegree",!0);P(W,J,ve,"£","\\pounds");P(W,J,ve,"£","\\mathsterling",!0);P(He,J,ve,"£","\\pounds");P(He,J,ve,"£","\\textsterling",!0);P(W,fe,ve,"✠","\\maltese");P(He,fe,ve,"✠","\\maltese");var cT='0123456789/@."';for(var iw=0;iw{var n=e.charCodeAt(0),t=e.charCodeAt(1),r=(n-55296)*1024+(t-56320)+65536;if(119808<=r&&r<120484){var s=Math.floor((r-119808)/26);return bT[s]}else if(120782<=r&&r<=120831){var i=Math.floor((r-120782)/10);return Y5t[i]}else{if(r===120485||r===120486)return bT[0];if(120486{if(_u(e.classes)!==_u(n.classes)||e.skew!==n.skew||e.maxFontSize!==n.maxFontSize||e.italic!==0&&e.hasClass("mathnormal"))return!1;if(e.classes.length===1){var t=e.classes[0];if(t==="mbin"||t==="mord")return!1}for(var r of Object.keys(e.style))if(e.style[r]!==n.style[r])return!1;for(var s of Object.keys(n.style))if(e.style[s]!==n.style[s])return!1;return!0},v$=e=>{for(var n=0;nt&&(t=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>s&&(s=a.maxFontSize)}n.height=t,n.depth=r,n.maxFontSize=s},We=function(n,t,r,s){var i=new m_(n,t,r,s);return ek(i),i},mu=(e,n,t,r)=>new m_(e,n,t,r),Qh=function(n,t,r){var s=We([n],[],t);return s.height=Math.max(r||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),s.style.borderBottomWidth=et(s.height),s.maxFontSize=1,s},e6t=function(n,t,r,s){var i=new Bb(n,t,r,s);return ek(i),i},Kl=function(n){var t=new p_(n);return ek(t),t},Yh=function(n,t){return n instanceof p_?We([],[n],t):n},t6t=function(n){if(n.positionType==="individualShift"){for(var t=n.children,r=[t[0]],s=-t[0].shift-t[0].elem.depth,i=s,a=1;a{var t=We(["mspace"],[],n),r=Ar(e,n);return t.style.marginRight=et(r),t},Xg=(e,n,t)=>{var r,s;switch(e){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=e}return n==="textbf"&&t==="textit"?s="BoldItalic":n==="textbf"?s="Bold":t==="textit"?s="Italic":s="Regular",r+"-"+s},B3={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},y$={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},x$=function(n,t){var[r,s,i]=y$[n],a=new pu(r),o=new ql([a],{width:et(s),height:et(i),style:"width:"+et(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=mu(["overlay"],[o],t);return l.height=i,l.style.height=et(i),l.style.width=et(s),l},jr={number:3,unit:"mu"},Zu={number:4,unit:"mu"},xl={number:5,unit:"mu"},n6t={mord:{mop:jr,mbin:Zu,mrel:xl,minner:jr},mop:{mord:jr,mop:jr,mrel:xl,minner:jr},mbin:{mord:Zu,mop:Zu,mopen:Zu,minner:Zu},mrel:{mord:xl,mop:xl,mopen:xl,minner:xl},mopen:{},mclose:{mop:jr,mbin:Zu,mrel:xl,minner:jr},mpunct:{mord:jr,mop:jr,mrel:xl,mopen:jr,mclose:jr,mpunct:jr,minner:jr},minner:{mord:jr,mop:jr,mbin:Zu,mrel:xl,mopen:jr,mpunct:jr,minner:jr}},r6t={mord:{mop:jr},mop:{mord:jr,mop:jr},mbin:{},mrel:{},mopen:{},mclose:{mop:jr},mpunct:{},minner:{mop:jr}},w$={},Sv={},kv={};function lt(e){for(var{type:n,names:t,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=e,o={type:n,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},l=0;l{var v=S.classes[0],b=x.classes[0];v==="mbin"&&i6t.has(b)?S.classes[0]="mord":b==="mbin"&&s6t.has(v)&&(x.classes[0]="mord")},{node:d},p,m),$3(i,(x,S)=>{var v,b,w=F3(S),y=F3(x),C=w&&y?x.hasClass("mtight")?(v=r6t[w])==null?void 0:v[y]:(b=n6t[w])==null?void 0:b[y]:null;if(C)return b$(C,u)},{node:d},p,m),i},$3=function(n,t,r,s,i){s&&n.push(s);for(var a=0;ap=>{n.splice(d+1,0,p),a++})(a)}s&&n.pop()},S$=function(n){return n instanceof p_||n instanceof Bb||n instanceof m_&&n.hasClass("enclosing")?n:null},P3=function(n,t){var r=S$(n);if(r){var s=r.children;if(s.length){if(t==="right")return P3(s[s.length-1],"right");if(t==="left")return P3(s[0],"left")}}return n},F3=function(n,t){if(!n)return null;t&&(n=P3(n,t));var r=n.classes[0];return o6t[r]||null},gp=function(n,t){var r=["nulldelimiter"].concat(n.baseSizingClasses());return We(t.concat(r))},Un=function(n,t,r){if(!n)return We();if(Sv[n.type]){var s=Sv[n.type](n,t);if(r&&t.size!==r.size){s=We(t.sizingClasses(r),[s],t);var i=t.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new Ye("Got group of unknown type: '"+n.type+"'")};function Zg(e,n){var t=We(["base"],e,n),r=We(["strut"]);return r.style.height=et(t.height+t.depth),t.depth&&(r.style.verticalAlign=et(-t.depth)),t.children.unshift(r),t}function H3(e,n){var t=null;e.length===1&&e[0].type==="tag"&&(t=e[0].tag,e=e[0].body);var r=ps(e,n,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],a=[],o=0;o0&&(i.push(Zg(a,n)),a=[]),i.push(r[o]));a.length>0&&i.push(Zg(a,n));var u;t?(u=Zg(ps(t,n,!0),n),u.classes=["tag"],i.push(u)):s&&i.push(s);var _=We(["katex-html"],i);if(_.setAttribute("aria-hidden","true"),u){var d=u.children[0];d.style.height=et(_.height+_.depth),_.depth&&(d.style.verticalAlign=et(-_.depth))}return _}function k$(e){return new p_(e)}class Xe{constructor(n,t,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=n,this.attributes={},this.children=t||[],this.classes=r||[]}setAttribute(n,t){this.attributes[n]=t}getAttribute(n){return this.attributes[n]}toNode(){var n=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&n.setAttribute(t,this.attributes[t]);this.classes.length>0&&(n.className=_u(this.classes));for(var r=0;r0&&(n+=' class ="'+Ks(_u(this.classes))+'"'),n+=">";for(var r=0;r",n}toText(){return this.children.map(n=>n.toText()).join("")}}class ns{constructor(n){this.text=void 0,this.text=n}toNode(){return document.createTextNode(this.text)}toMarkup(){return Ks(this.toText())}toText(){return this.text}}class C${constructor(n){this.width=void 0,this.character=void 0,this.width=n,n>=.05555&&n<=.05556?this.character=" ":n>=.1666&&n<=.1667?this.character=" ":n>=.2222&&n<=.2223?this.character=" ":n>=.2777&&n<=.2778?this.character="  ":n>=-.05556&&n<=-.05555?this.character=" ⁣":n>=-.1667&&n<=-.1666?this.character=" ⁣":n>=-.2223&&n<=-.2222?this.character=" ⁣":n>=-.2778&&n<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var n=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return n.setAttribute("width",et(this.width)),n}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var l6t=new Set(["\\imath","\\jmath"]),c6t=new Set(["mrow","mtable"]),ja=function(n,t,r){return Sr[t][n]&&Sr[t][n].replace&&n.charCodeAt(0)!==55349&&!(g$.hasOwnProperty(n)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(n=Sr[t][n].replace),new ns(n)},tk=function(n){return n.length===1?n[0]:new Xe("mrow",n)},u6t={mathit:"italic",boldsymbol:e=>e.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},nk=(e,n)=>{if(e.mode==="text"){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold"}var t=n.font;if(!t||t==="mathnormal")return null;var r=e.mode,s=u6t[t];if(s)return typeof s=="function"?s(e):s;var i=e.text;if(l6t.has(i))return null;if(Sr[r][i]){var a=Sr[r][i].replace;a&&(i=a)}var o=B3[t].fontName;return ZS(i,o,r)?B3[t].variant:null};function cw(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var n=e.children[0];return n instanceof ns&&n.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var t=e.children[0];return t instanceof ns&&t.text===","}else return!1}var ra=function(n,t,r){if(n.length===1){var s=ar(n[0],t);return r&&s instanceof Xe&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],a,o=0;o=1&&(a.type==="mn"||cw(a))){var u=l.children[0];u instanceof Xe&&u.type==="mn"&&(u.children=[...a.children,...u.children],i.pop())}else if(a.type==="mi"&&a.children.length===1){var _=a.children[0];if(_ instanceof ns&&_.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof ns&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),i.pop())}}}i.push(l),a=l}return i},gu=function(n,t,r){return tk(ra(n,t,r))},ar=function(n,t){if(!n)return new Xe("mrow");if(kv[n.type])return kv[n.type](n,t);throw new Ye("Got group of unknown type: '"+n.type+"'")};function yT(e,n,t,r,s){var i=ra(e,t),a;i.length===1&&i[0]instanceof Xe&&c6t.has(i[0].type)?a=i[0]:a=new Xe("mrow",i);var o=new Xe("annotation",[new ns(n)]);o.setAttribute("encoding","application/x-tex");var l=new Xe("semantics",[a,o]),u=new Xe("math",[l]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&u.setAttribute("display","block");var _=s?"katex":"katex-mathml";return We([_],[u])}var d6t=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],xT=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],wT=function(n,t){return t.size<2?n:d6t[n-1][t.size-1]};class El{constructor(n){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=n.style,this.color=n.color,this.size=n.size||El.BASESIZE,this.textSize=n.textSize||this.size,this.phantom=!!n.phantom,this.font=n.font||"",this.fontFamily=n.fontFamily||"",this.fontWeight=n.fontWeight||"",this.fontShape=n.fontShape||"",this.sizeMultiplier=xT[this.size-1],this.maxSize=n.maxSize,this.minRuleThickness=n.minRuleThickness,this._fontMetrics=void 0}extend(n){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(t,n),new El(t)}havingStyle(n){return this.style===n?this:this.extend({style:n,size:wT(this.textSize,n)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(n){return this.size===n&&this.textSize===n?this:this.extend({style:this.style.text(),size:n,textSize:n,sizeMultiplier:xT[n-1]})}havingBaseStyle(n){n=n||this.style.text();var t=wT(El.BASESIZE,n);return this.size===t&&this.textSize===El.BASESIZE&&this.style===n?this:this.extend({style:n,size:t})}havingBaseSizing(){var n;switch(this.style.id){case 4:case 5:n=3;break;case 6:case 7:n=1;break;default:n=6}return this.extend({style:this.style.text(),size:n})}withColor(n){return this.extend({color:n})}withPhantom(){return this.extend({phantom:!0})}withFont(n){return this.extend({font:n})}withTextFontFamily(n){return this.extend({fontFamily:n,font:""})}withTextFontWeight(n){return this.extend({fontWeight:n,font:""})}withTextFontShape(n){return this.extend({fontShape:n,font:""})}sizingClasses(n){return n.size!==this.size?["sizing","reset-size"+n.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==El.BASESIZE?["sizing","reset-size"+this.size,"size"+El.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=K5t(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}El.BASESIZE=6;var E$=function(n){return new El({style:n.displayMode?Yt.DISPLAY:Yt.TEXT,maxSize:n.maxSize,minRuleThickness:n.minRuleThickness})},N$=function(n,t){if(t.displayMode){var r=["katex-display"];t.leqno&&r.push("leqno"),t.fleqn&&r.push("fleqn"),n=We(r,[n])}return n},f6t=function(n,t,r){var s=E$(r),i;if(r.output==="mathml")return yT(n,t,s,r.displayMode,!0);if(r.output==="html"){var a=H3(n,s);i=We(["katex"],[a])}else{var o=yT(n,t,s,r.displayMode,!1),l=H3(n,s);i=We(["katex"],[o,l])}return N$(i,r)},h6t=function(n,t,r){var s=E$(r),i=H3(n,s),a=We(["katex"],[i]);return N$(a,r)},_6t={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Fb=function(n){var t=new Xe("mo",[new ns(_6t[n.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},p6t={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},m6t=new Set(["widehat","widecheck","widetilde","utilde"]),Hb=function(n,t){function r(){var o=4e5,l=n.label.slice(1);if(m6t.has(l)&&"base"in n){var u=n.base.type==="ordgroup"?n.base.body.length:1,_,d,p;if(u>5)l==="widehat"||l==="widecheck"?(_=420,o=2364,p=.42,d=l+"4"):(_=312,o=2340,p=.34,d="tilde4");else{var m=[1,1,2,2,3,3][u];l==="widehat"||l==="widecheck"?(o=[0,1062,2364,2364,2364][m],_=[0,239,300,360,420][m],p=[0,.24,.3,.3,.36,.42][m],d=l+m):(o=[0,600,1033,2339,2340][m],_=[0,260,286,306,312][m],p=[0,.26,.286,.3,.306,.34][m],d="tilde"+m)}var x=new pu(d),S=new ql([x],{width:"100%",height:et(p),viewBox:"0 0 "+o+" "+_,preserveAspectRatio:"none"});return{span:mu([],[S],t),minWidth:0,height:p}}else{var v=[],b=p6t[l];if(!b)throw new Error('No SVG data for "'+l+'".');var[w,y,C]=b,E=C/1e3,N=w.length,T,z;if(N===1){if(b.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');T=["hide-tail"],z=[b[3]]}else if(N===2)T=["halfarrow-left","halfarrow-right"],z=["xMinYMin","xMaxYMin"];else if(N===3)T=["brace-left","brace-center","brace-right"],z=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support - `+N+" children.");for(var M=0;M0&&(s.style.minWidth=et(i)),s},g6t=function(n,t,r,s,i){var a,o=n.height+n.depth+r+s;if(/fbox|color|angl/.test(t)){if(a=We(["stretchy",t],[],i),t==="fbox"){var l=i.color&&i.getColor();l&&(a.style.borderColor=l)}}else{var u=[];/^[bx]cancel$/.test(t)&&u.push(new R3({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&u.push(new R3({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var _=new ql(u,{width:"100%",height:et(o)});a=mu([],[_],i)}return a.height=o,a.style.height=et(o),a},v6t={bin:1,close:1,inner:1,open:1,punct:1,rel:1},b6t={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function y6t(e){return e in v6t}function on(e,n){if(!e||e.type!==n)throw new Error("Expected node of type "+n+", but got "+(e?"node of type "+e.type:String(e)));return e}function qb(e){var n=Ub(e);if(!n)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return n}function Ub(e){return e&&(e.type==="atom"||b6t.hasOwnProperty(e.type))?e:null}var z$=e=>{if(e instanceof Zi)return e;if(W5t(e)&&e.children.length===1)return z$(e.children[0])},rk=(e,n)=>{var t,r,s;e&&e.type==="supsub"?(r=on(e.base,"accent"),t=r.base,e.base=t,s=G5t(Un(e,n)),e.base=r):(r=on(e,"accent"),t=r.base);var i=Un(t,n.havingCrampedStyle()),a=r.isShifty&&Wl(t),o=0;if(a){var l,u;o=(l=(u=z$(i))==null?void 0:u.skew)!=null?l:0}var _=r.label==="\\c",d=_?i.height+i.depth:Math.min(i.height,n.fontMetrics().xHeight),p;if(r.isStretchy)p=Hb(r,n),p=Hn({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:p,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+et(2*o)+")",marginLeft:et(2*o)}:void 0}]});else{var m,x;r.label==="\\vec"?(m=x$("vec",n),x=y$.vec[1]):(m=Pb({mode:r.mode,text:r.label},n,"textord"),m=U5t(m),m.italic=0,x=m.width,_&&(d+=m.depth)),p=We(["accent-body"],[m]);var S=r.label==="\\textcircled";S&&(p.classes.push("accent-full"),d=i.height);var v=o;S||(v-=x/2),p.style.left=et(v),r.label==="\\textcircled"&&(p.style.top=".2em"),p=Hn({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-d},{type:"elem",elem:p}]})}var b=We(["mord","accent"],[p],n);return s?(s.children[0]=b,s.height=Math.max(b.height,s.height),s.classes[0]="mord",s):b},j$=(e,n)=>{var t=e.isStretchy?Fb(e.label):new Xe("mo",[ja(e.label,e.mode)]),r=new Xe("mover",[ar(e.base,n),t]);return r.setAttribute("accent","true"),r},x6t=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));lt({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,n)=>{var t=Cv(n[0]),r=!x6t.test(e.funcName),s=!r||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:s,base:t}},htmlBuilder:rk,mathmlBuilder:j$});lt({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,n)=>{var t=n[0],r=e.parser.mode;return r==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:t}},htmlBuilder:rk,mathmlBuilder:j$});lt({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=n[0];return{type:"accentUnder",mode:t.mode,label:r,base:s}},htmlBuilder:(e,n)=>{var t=Un(e.base,n),r=Hb(e,n),s=e.label==="\\utilde"?.12:0,i=Hn({positionType:"top",positionData:t.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:t}]});return We(["mord","accentunder"],[i],n)},mathmlBuilder:(e,n)=>{var t=Fb(e.label),r=new Xe("munder",[ar(e.base,n),t]);return r.setAttribute("accentunder","true"),r}});var Jg=e=>{var n=new Xe("mpadded",e?[e]:[]);return n.setAttribute("width","+0.6em"),n.setAttribute("lspace","0.3em"),n};lt({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,n,t){var{parser:r,funcName:s}=e;return{type:"xArrow",mode:r.mode,label:s,body:n[0],below:t[0]}},htmlBuilder(e,n){var t=n.style,r=n.havingStyle(t.sup()),s=Yh(Un(e.body,r,n),n),i=e.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var a;e.below&&(r=n.havingStyle(t.sub()),a=Yh(Un(e.below,r,n),n),a.classes.push(i+"-arrow-pad"));var o=Hb(e,n),l=-n.fontMetrics().axisHeight+.5*o.height,u=-n.fontMetrics().axisHeight-.5*o.height-.111;(s.depth>.25||e.label==="\\xleftequilibrium")&&(u-=s.depth);var _;if(a){var d=-n.fontMetrics().axisHeight+a.height+.5*o.height+.111;_=Hn({positionType:"individualShift",children:[{type:"elem",elem:s,shift:u},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:a,shift:d}]})}else _=Hn({positionType:"individualShift",children:[{type:"elem",elem:s,shift:u},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]}]});return We(["mrel","x-arrow"],[_],n)},mathmlBuilder(e,n){var t=Fb(e.label);t.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(e.body){var s=Jg(ar(e.body,n));if(e.below){var i=Jg(ar(e.below,n));r=new Xe("munderover",[t,i,s])}else r=new Xe("mover",[t,s])}else if(e.below){var a=Jg(ar(e.below,n));r=new Xe("munder",[t,a])}else r=Jg(),r=new Xe("mover",[t,r]);return r}});function T$(e,n){var t=ps(e.body,n,!0);return We([e.mclass],t,n)}function A$(e,n){var t,r=ra(e.body,n);return e.mclass==="minner"?t=new Xe("mpadded",r):e.mclass==="mord"?e.isCharacterBox?(t=r[0],t.type="mi"):t=new Xe("mi",r):(e.isCharacterBox?(t=r[0],t.type="mo"):t=new Xe("mo",r),e.mclass==="mbin"?(t.attributes.lspace="0.22em",t.attributes.rspace="0.22em"):e.mclass==="mpunct"?(t.attributes.lspace="0em",t.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(t.attributes.lspace="0em",t.attributes.rspace="0em"):e.mclass==="minner"&&(t.attributes.lspace="0.0556em",t.attributes.width="+0.1111em")),t}lt({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,n){var{parser:t,funcName:r}=e,s=n[0];return{type:"mclass",mode:t.mode,mclass:"m"+r.slice(5),body:ts(s),isCharacterBox:Wl(s)}},htmlBuilder:T$,mathmlBuilder:A$});var Gb=e=>{var n=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return n.type==="atom"&&(n.family==="bin"||n.family==="rel")?"m"+n.family:"mord"};lt({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,n){var{parser:t}=e;return{type:"mclass",mode:t.mode,mclass:Gb(n[0]),body:ts(n[1]),isCharacterBox:Wl(n[1])}}});lt({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,n){var{parser:t,funcName:r}=e,s=n[1],i=n[0],a;r!=="\\stackrel"?a=Gb(s):a="mrel";var o={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:ts(s)},l={type:"supsub",mode:i.mode,base:o,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:t.mode,mclass:a,body:[l],isCharacterBox:Wl(l)}},htmlBuilder:T$,mathmlBuilder:A$});lt({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,n){var{parser:t}=e;return{type:"pmb",mode:t.mode,mclass:Gb(n[0]),body:ts(n[0])}},htmlBuilder(e,n){var t=ps(e.body,n,!0),r=We([e.mclass],t,n);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,n){var t=ra(e.body,n),r=new Xe("mstyle",t);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var w6t={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},ST=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),kT=e=>e.type==="textord"&&e.text==="@",S6t=(e,n)=>(e.type==="mathord"||e.type==="atom")&&e.text===n;function k6t(e,n,t){var r=w6t[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return t.callFunction(r,[n[0]],[n[1]]);case"\\uparrow":case"\\downarrow":{var s=t.callFunction("\\\\cdleft",[n[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},a=t.callFunction("\\Big",[i],[]),o=t.callFunction("\\\\cdright",[n[1]],[]),l={type:"ordgroup",mode:"math",body:[s,a,o]};return t.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return t.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return t.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function C6t(e){var n=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){n.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var t=e.fetch().text;if(t==="&"||t==="\\\\")e.consume();else if(t==="\\end"){n[n.length-1].length===0&&n.pop();break}else throw new Ye("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var r=[],s=[r],i=0;iAV".includes(u))for(var d=0;d<2;d++){for(var p=!0,m=l+1;mAV=|." after @',a[l]);var x=k6t(u,_,e),S={type:"styling",body:[x],mode:"math",style:"display",resetFont:!0};r.push(S),o=ST()}i%2===0?r.push(o):r.shift(),r=[],s.push(r)}e.gullet.endGroup(),e.gullet.endGroup();var v=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:v,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}lt({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,n){var{parser:t,funcName:r}=e;return{type:"cdlabel",mode:t.mode,side:r.slice(4),label:n[0]}},htmlBuilder(e,n){var t=n.havingStyle(n.style.sup()),r=Yh(Un(e.label,t,n),n);return r.classes.push("cd-label-"+e.side),r.style.bottom=et(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,n){var t=new Xe("mrow",[ar(e.label,n)]);return t=new Xe("mpadded",[t]),t.setAttribute("width","0"),e.side==="left"&&t.setAttribute("lspace","-1width"),t.setAttribute("voffset","0.7em"),t=new Xe("mstyle",[t]),t.setAttribute("displaystyle","false"),t.setAttribute("scriptlevel","1"),t}});lt({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,n){var{parser:t}=e;return{type:"cdlabelparent",mode:t.mode,fragment:n[0]}},htmlBuilder(e,n){var t=Yh(Un(e.fragment,n),n);return t.classes.push("cd-vert-arrow"),t},mathmlBuilder(e,n){return new Xe("mrow",[ar(e.fragment,n)])}});lt({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,n){for(var{parser:t}=e,r=on(n[0],"ordgroup"),s=r.body,i="",a=0;a=1114111)throw new Ye("\\@char with invalid code point "+i);return l<=65535?u=String.fromCharCode(l):(l-=65536,u=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:t.mode,text:u}}});var R$=(e,n)=>{var t=ps(e.body,n.withColor(e.color),!1);return Kl(t)},M$=(e,n)=>{var t=ra(e.body,n.withColor(e.color)),r=new Xe("mstyle",t);return r.setAttribute("mathcolor",e.color),r};lt({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,n){var{parser:t}=e,r=on(n[0],"color-token").color,s=n[1];return{type:"color",mode:t.mode,color:r,body:ts(s)}},htmlBuilder:R$,mathmlBuilder:M$});lt({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,n){var{parser:t,breakOnTokenText:r}=e,s=on(n[0],"color-token").color;t.gullet.macros.set("\\current@color",s);var i=t.parseExpression(!0,r);return{type:"color",mode:t.mode,color:s,body:i}},htmlBuilder:R$,mathmlBuilder:M$});lt({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,n,t){var{parser:r}=e,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&on(s,"size").value}},htmlBuilder(e,n){var t=We(["mspace"],[],n);return e.newLine&&(t.classes.push("newline"),e.size&&(t.style.marginTop=et(Ar(e.size,n)))),t},mathmlBuilder(e,n){var t=new Xe("mspace");return e.newLine&&(t.setAttribute("linebreak","newline"),e.size&&t.setAttribute("height",et(Ar(e.size,n)))),t}});var q3={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},D$=e=>{var n=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(n))throw new Ye("Expected a control sequence",e);return n},E6t=e=>{var n=e.gullet.popToken();return n.text==="="&&(n=e.gullet.popToken(),n.text===" "&&(n=e.gullet.popToken())),n},L$=(e,n,t,r)=>{var s=e.gullet.macros.get(t.text);s==null&&(t.noexpand=!0,s={tokens:[t],numArgs:0,unexpandable:!e.gullet.isExpandable(t.text)}),e.gullet.macros.set(n,s,r)};lt({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:n,funcName:t}=e;n.consumeSpaces();var r=n.fetch();if(q3[r.text])return(t==="\\global"||t==="\\\\globallong")&&(r.text=q3[r.text]),on(n.parseFunction(),"internal");throw new Ye("Invalid token after macro prefix",r)}});lt({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:n,funcName:t}=e,r=n.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new Ye("Expected a control sequence",r);for(var i=0,a,o=[[]];n.gullet.future().text!=="{";)if(r=n.gullet.popToken(),r.text==="#"){if(n.gullet.future().text==="{"){a=n.gullet.future(),o[i].push("{");break}if(r=n.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Ye('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new Ye('Argument number "'+r.text+'" out of order');i++,o.push([])}else{if(r.text==="EOF")throw new Ye("Expected a macro definition");o[i].push(r.text)}var{tokens:l}=n.gullet.consumeArg();return a&&l.unshift(a),(t==="\\edef"||t==="\\xdef")&&(l=n.gullet.expandTokens(l),l.reverse()),n.gullet.macros.set(s,{tokens:l,numArgs:i,delimiters:o},t===q3[t]),{type:"internal",mode:n.mode}}});lt({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:n,funcName:t}=e,r=D$(n.gullet.popToken());n.gullet.consumeSpaces();var s=E6t(n);return L$(n,r,s,t==="\\\\globallet"),{type:"internal",mode:n.mode}}});lt({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:n,funcName:t}=e,r=D$(n.gullet.popToken()),s=n.gullet.popToken(),i=n.gullet.popToken();return L$(n,r,i,t==="\\\\globalfuture"),n.gullet.pushToken(i),n.gullet.pushToken(s),{type:"internal",mode:n.mode}}});var N0=function(n,t,r){var s=Sr.math[n]&&Sr.math[n].replace,i=ZS(s||n,t,r);if(!i)throw new Error("Unsupported symbol "+n+" and font size "+t+".");return i},sk=function(n,t,r,s){var i=r.havingBaseStyle(t),a=We(s.concat(i.sizingClasses(r)),[n],r),o=i.sizeMultiplier/r.sizeMultiplier;return a.height*=o,a.depth*=o,a.maxFontSize=i.sizeMultiplier,a},O$=function(n,t,r){var s=t.havingBaseStyle(r),i=(1-t.sizeMultiplier/s.sizeMultiplier)*t.fontMetrics().axisHeight;n.classes.push("delimcenter"),n.style.top=et(i),n.height-=i,n.depth+=i},N6t=function(n,t,r,s,i,a){var o=ii(n,"Main-Regular",i,s),l=sk(o,t,s,a);return O$(l,s,t),l},z6t=function(n,t,r,s){return ii(n,"Size"+t+"-Regular",r,s)},I$=function(n,t,r,s,i,a){var o=z6t(n,t,i,s),l=sk(We(["delimsizing","size"+t],[o],s),Yt.TEXT,s,a);return r&&O$(l,s,Yt.TEXT),l},uw=function(n,t,r){var s;t==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=We(["delimsizinginner",s],[We([],[ii(n,t,r)])]);return{type:"elem",elem:i}},dw=function(n,t,r){var s=To["Size4-Regular"][n.charCodeAt(0)]?To["Size4-Regular"][n.charCodeAt(0)][4]:To["Size1-Regular"][n.charCodeAt(0)][4],i=new pu("inner",I5t(n,Math.round(1e3*t))),a=new ql([i],{width:et(s),height:et(t),style:"width:"+et(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),o=mu([],[a],r);return o.height=t,o.style.height=et(t),o.style.width=et(s),{type:"elem",elem:o}},U3=.008,e1={type:"kern",size:-1*U3},j6t=new Set(["|","\\lvert","\\rvert","\\vert"]),T6t=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),B$=function(n,t,r,s,i,a){var o,l,u,_,d="",p=0;o=u=_=n,l=null;var m="Size1-Regular";n==="\\uparrow"?u=_="⏐":n==="\\Uparrow"?u=_="‖":n==="\\downarrow"?o=u="⏐":n==="\\Downarrow"?o=u="‖":n==="\\updownarrow"?(o="\\uparrow",u="⏐",_="\\downarrow"):n==="\\Updownarrow"?(o="\\Uparrow",u="‖",_="\\Downarrow"):j6t.has(n)?(u="∣",d="vert",p=333):T6t.has(n)?(u="∥",d="doublevert",p=556):n==="["||n==="\\lbrack"?(o="⎡",u="⎢",_="⎣",m="Size4-Regular",d="lbrack",p=667):n==="]"||n==="\\rbrack"?(o="⎤",u="⎥",_="⎦",m="Size4-Regular",d="rbrack",p=667):n==="\\lfloor"||n==="⌊"?(u=o="⎢",_="⎣",m="Size4-Regular",d="lfloor",p=667):n==="\\lceil"||n==="⌈"?(o="⎡",u=_="⎢",m="Size4-Regular",d="lceil",p=667):n==="\\rfloor"||n==="⌋"?(u=o="⎥",_="⎦",m="Size4-Regular",d="rfloor",p=667):n==="\\rceil"||n==="⌉"?(o="⎤",u=_="⎥",m="Size4-Regular",d="rceil",p=667):n==="("||n==="\\lparen"?(o="⎛",u="⎜",_="⎝",m="Size4-Regular",d="lparen",p=875):n===")"||n==="\\rparen"?(o="⎞",u="⎟",_="⎠",m="Size4-Regular",d="rparen",p=875):n==="\\{"||n==="\\lbrace"?(o="⎧",l="⎨",_="⎩",u="⎪",m="Size4-Regular"):n==="\\}"||n==="\\rbrace"?(o="⎫",l="⎬",_="⎭",u="⎪",m="Size4-Regular"):n==="\\lgroup"||n==="⟮"?(o="⎧",_="⎩",u="⎪",m="Size4-Regular"):n==="\\rgroup"||n==="⟯"?(o="⎫",_="⎭",u="⎪",m="Size4-Regular"):n==="\\lmoustache"||n==="⎰"?(o="⎧",_="⎭",u="⎪",m="Size4-Regular"):(n==="\\rmoustache"||n==="⎱")&&(o="⎫",_="⎩",u="⎪",m="Size4-Regular");var x=N0(o,m,i),S=x.height+x.depth,v=N0(u,m,i),b=v.height+v.depth,w=N0(_,m,i),y=w.height+w.depth,C=0,E=1;if(l!==null){var N=N0(l,m,i);C=N.height+N.depth,E=2}var T=S+y+C,z=Math.max(0,Math.ceil((t-T)/(E*b))),M=T+z*E*b,O=s.fontMetrics().axisHeight;r&&(O*=s.sizeMultiplier);var B=M/2-O,$=[];if(d.length>0){var U=M-S-y,H=Math.round(M*1e3),Y=B5t(d,Math.round(U*1e3)),V=new pu(d,Y),X=et(p/1e3),te=et(H/1e3),I=new ql([V],{width:X,height:te,viewBox:"0 0 "+p+" "+H}),L=mu([],[I],s);L.height=H/1e3,L.style.width=X,L.style.height=te,$.push({type:"elem",elem:L})}else{if($.push(uw(_,m,i)),$.push(e1),l===null){var F=M-S-y+2*U3;$.push(dw(u,F,s))}else{var q=(M-S-y-C)/2+2*U3;$.push(dw(u,q,s)),$.push(e1),$.push(uw(l,m,i)),$.push(e1),$.push(dw(u,q,s))}$.push(e1),$.push(uw(o,m,i))}var G=s.havingBaseStyle(Yt.TEXT),ee=Hn({positionType:"bottom",positionData:B,children:$});return sk(We(["delimsizing","mult"],[ee],G),Yt.TEXT,s,a)},fw=80,hw=.08,_w=function(n,t,r,s,i){var a=O5t(n,s,r),o=new pu(n,a),l=new ql([o],{width:"400em",height:et(t),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return mu(["hide-tail"],[l],i)},A6t=function(n,t){var r=t.havingBaseSizing(),s=q$("\\surd",n*r.sizeMultiplier,H$,r),i=r.sizeMultiplier,a=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),o,l,u,_,d;return s.type==="small"?(_=1e3+1e3*a+fw,n<1?i=1:n<1.4&&(i=.7),l=(1+a+hw)/i,u=(1+a)/i,o=_w("sqrtMain",l,_,a,t),o.style.minWidth="0.853em",d=.833/i):s.type==="large"?(_=(1e3+fw)*U0[s.size],u=(U0[s.size]+a)/i,l=(U0[s.size]+a+hw)/i,o=_w("sqrtSize"+s.size,l,_,a,t),o.style.minWidth="1.02em",d=1/i):(l=n+a+hw,u=n+a,_=Math.floor(1e3*n+a)+fw,o=_w("sqrtTall",l,_,a,t),o.style.minWidth="0.742em",d=1.056),o.height=u,o.style.height=et(l),{span:o,advanceWidth:d,ruleWidth:(t.fontMetrics().sqrtRuleThickness+a)*i}},$$=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),R6t=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),P$=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),U0=[0,1.2,1.8,2.4,3],F$=function(n,t,r,s,i){if(n==="<"||n==="\\lt"||n==="⟨"?n="\\langle":(n===">"||n==="\\gt"||n==="⟩")&&(n="\\rangle"),$$.has(n)||P$.has(n))return I$(n,t,!1,r,s,i);if(R6t.has(n))return B$(n,U0[t],!1,r,s,i);throw new Ye("Illegal delimiter: '"+n+"'")},M6t=[{type:"small",style:Yt.SCRIPTSCRIPT},{type:"small",style:Yt.SCRIPT},{type:"small",style:Yt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],D6t=[{type:"small",style:Yt.SCRIPTSCRIPT},{type:"small",style:Yt.SCRIPT},{type:"small",style:Yt.TEXT},{type:"stack"}],H$=[{type:"small",style:Yt.SCRIPTSCRIPT},{type:"small",style:Yt.SCRIPT},{type:"small",style:Yt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],L6t=function(n){if(n.type==="small")return"Main-Regular";if(n.type==="large")return"Size"+n.size+"-Regular";if(n.type==="stack")return"Size4-Regular";var t=n.type;throw new Error("Add support for delim type '"+t+"' here.")},q$=function(n,t,r,s){for(var i=Math.min(2,3-s.style.size),a=i;at)return o}return r[r.length-1]},G3=function(n,t,r,s,i,a){n==="<"||n==="\\lt"||n==="⟨"?n="\\langle":(n===">"||n==="\\gt"||n==="⟩")&&(n="\\rangle");var o;P$.has(n)?o=M6t:$$.has(n)?o=H$:o=D6t;var l=q$(n,t,o,s);return l.type==="small"?N6t(n,l.style,r,s,i,a):l.type==="large"?I$(n,l.size,r,s,i,a):B$(n,t,r,s,i,a)},pw=function(n,t,r,s,i,a){var o=s.fontMetrics().axisHeight*s.sizeMultiplier,l=901,u=5/s.fontMetrics().ptPerEm,_=Math.max(t-o,r+o),d=Math.max(_/500*l,2*_-u);return G3(n,d,!0,s,i,a)},CT={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},O6t=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function ET(e){return"isMiddle"in e}function Wb(e,n){var t=Ub(e);if(t&&O6t.has(t.text))return t;throw t?new Ye("Invalid delimiter '"+t.text+"' after '"+n.funcName+"'",e):new Ye("Invalid delimiter type '"+e.type+"'",e)}lt({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,n)=>{var t=Wb(n[0],e);return{type:"delimsizing",mode:e.parser.mode,size:CT[e.funcName].size,mclass:CT[e.funcName].mclass,delim:t.text}},htmlBuilder:(e,n)=>e.delim==="."?We([e.mclass]):F$(e.delim,e.size,n,e.mode,[e.mclass]),mathmlBuilder:e=>{var n=[];e.delim!=="."&&n.push(ja(e.delim,e.mode));var t=new Xe("mo",n);e.mclass==="mopen"||e.mclass==="mclose"?t.setAttribute("fence","true"):t.setAttribute("fence","false"),t.setAttribute("stretchy","true");var r=et(U0[e.size]);return t.setAttribute("minsize",r),t.setAttribute("maxsize",r),t}});function NT(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}lt({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,n)=>{var t=e.parser.gullet.macros.get("\\current@color");if(t&&typeof t!="string")throw new Ye("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Wb(n[0],e).text,color:t}}});lt({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,n)=>{var t=Wb(n[0],e),r=e.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=on(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:t.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,n)=>{NT(e);for(var t=ps(e.body,n,!0,["mopen","mclose"]),r=0,s=0,i=!1,a=0;a{NT(e);var t=ra(e.body,n);if(e.left!=="."){var r=new Xe("mo",[ja(e.left,e.mode)]);r.setAttribute("fence","true"),t.unshift(r)}if(e.right!=="."){var s=new Xe("mo",[ja(e.right,e.mode)]);s.setAttribute("fence","true"),e.rightColor&&s.setAttribute("mathcolor",e.rightColor),t.push(s)}return tk(t)}});lt({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,n)=>{var t=Wb(n[0],e);if(!e.parser.leftrightDepth)throw new Ye("\\middle without preceding \\left",t);return{type:"middle",mode:e.parser.mode,delim:t.text}},htmlBuilder:(e,n)=>{var t;return e.delim==="."?t=gp(n,[]):(t=F$(e.delim,1,n,e.mode,[]),t.isMiddle={delim:e.delim,options:n}),t},mathmlBuilder:(e,n)=>{var t=e.delim==="\\vert"||e.delim==="|"?ja("|","text"):ja(e.delim,e.mode),r=new Xe("mo",[t]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var Vb=(e,n)=>{var t=Yh(Un(e.body,n),n),r=e.label.slice(1),s=n.sizeMultiplier,i,a,o=Wl(e.body);if(r==="sout")i=We(["stretchy","sout"]),i.height=n.fontMetrics().defaultRuleThickness/s,a=-.5*n.fontMetrics().xHeight;else if(r==="phase"){var l=Ar({number:.6,unit:"pt"},n),u=Ar({number:.35,unit:"ex"},n),_=n.havingBaseSizing();s=s/_.sizeMultiplier;var d=t.height+t.depth+l+u;t.style.paddingLeft=et(d/2+l);var p=Math.floor(1e3*d*s),m=D5t(p),x=new ql([new pu("phase",m)],{width:"400em",height:et(p/1e3),viewBox:"0 0 400000 "+p,preserveAspectRatio:"xMinYMin slice"});i=mu(["hide-tail"],[x],n),i.style.height=et(d),a=t.depth+l+u}else{/cancel/.test(r)?o||t.classes.push("cancel-pad"):r==="angl"?t.classes.push("anglpad"):t.classes.push("boxpad");var S,v,b=0;/box/.test(r)?(b=Math.max(n.fontMetrics().fboxrule,n.minRuleThickness),S=n.fontMetrics().fboxsep+(r==="colorbox"?0:b),v=S):r==="angl"?(b=Math.max(n.fontMetrics().defaultRuleThickness,n.minRuleThickness),S=4*b,v=Math.max(0,.25-t.depth)):(S=o?.2:0,v=S),i=g6t(t,r,S,v,n),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=et(b)):r==="angl"&&b!==.049&&(i.style.borderTopWidth=et(b),i.style.borderRightWidth=et(b)),a=t.depth+v,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var w;if(e.backgroundColor)w=Hn({positionType:"individualShift",children:[{type:"elem",elem:i,shift:a},{type:"elem",elem:t,shift:0}]});else{var y=/cancel|phase/.test(r)?["svg-align"]:[];w=Hn({positionType:"individualShift",children:[{type:"elem",elem:t,shift:0},{type:"elem",elem:i,shift:a,wrapperClasses:y}]})}return/cancel/.test(r)&&(w.height=t.height,w.depth=t.depth),/cancel/.test(r)&&!o?We(["mord","cancel-lap"],[w],n):We(["mord"],[w],n)},Kb=(e,n)=>{var t,r=new Xe(e.label.includes("colorbox")?"mpadded":"menclose",[ar(e.body,n)]);switch(e.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(t=n.fontMetrics().fboxsep*n.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*t+"pt"),r.setAttribute("height","+"+2*t+"pt"),r.setAttribute("lspace",t+"pt"),r.setAttribute("voffset",t+"pt"),e.label==="\\fcolorbox"){var s=Math.max(n.fontMetrics().fboxrule,n.minRuleThickness);r.setAttribute("style","border: "+et(s)+" solid "+e.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};lt({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,n,t){var{parser:r,funcName:s}=e,i=on(n[0],"color-token").color,a=n[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:a}},htmlBuilder:Vb,mathmlBuilder:Kb});lt({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,n,t){var{parser:r,funcName:s}=e,i=on(n[0],"color-token").color,a=on(n[1],"color-token").color,o=n[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:a,borderColor:i,body:o}},htmlBuilder:Vb,mathmlBuilder:Kb});lt({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,n){var{parser:t}=e;return{type:"enclose",mode:t.mode,label:"\\fbox",body:n[0]}}});lt({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,n){var{parser:t,funcName:r}=e,s=n[0];return{type:"enclose",mode:t.mode,label:r,body:s}},htmlBuilder:Vb,mathmlBuilder:Kb});lt({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(e,n){var{parser:t,funcName:r}=e;t.mode==="math"&&t.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var s=n[0];return{type:"enclose",mode:t.mode,label:r,body:s}},htmlBuilder:Vb,mathmlBuilder:Kb});lt({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,n){var{parser:t}=e;return{type:"enclose",mode:t.mode,label:"\\angl",body:n[0]}}});var U$={};function Go(e){for(var{type:n,names:t,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=e,o={type:n,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},l=0;l{var n=e.parser.settings;if(!n.displayMode)throw new Ye("{"+e.envName+"} can be used only in display mode.")},I6t=new Set(["gather","gather*"]);function ik(e){if(!e.includes("ed"))return!e.includes("*")}function Cu(e,n,t){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:a,colSeparationType:o,autoTag:l,singleRow:u,emptySingleRow:_,maxNumCols:d,leqno:p}=n;if(e.gullet.beginGroup(),u||e.gullet.macros.set("\\cr","\\\\\\relax"),!a){var m=e.gullet.expandMacroAsText("\\arraystretch");if(m==null)a=1;else if(a=parseFloat(m),!a||a<0)throw new Ye("Invalid \\arraystretch: "+m)}e.gullet.beginGroup();var x=[],S=[x],v=[],b=[],w=l!=null?[]:void 0;function y(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function C(){w&&(e.gullet.macros.get("\\df@tag")?(w.push(e.subparse([new Qi("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):w.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(y(),b.push(zT(e));;){var E=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var N={type:"ordgroup",mode:e.mode,body:E};t&&(N={type:"styling",mode:e.mode,style:t,resetFont:!0,body:[N]}),x.push(N);var T=e.fetch().text;if(T==="&"){if(d&&x.length===d){if(u||o)throw new Ye("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(T==="\\end"){C(),x.length===1&&N.type==="styling"&&N.body.length===1&&N.body[0].type==="ordgroup"&&N.body[0].body.length===0&&(S.length>1||!_)&&S.pop(),b.length0&&(y+=.25),u.push({pos:y,isDashed:Ze[ht]})}for(C(a[0]),r=0;r0&&(B+=w,TZe))for(r=0;r=o)){var le=void 0;if(s>0||n.hskipBeforeAndAfter){var ae,ue;le=(ae=(ue=G)==null?void 0:ue.pregap)!=null?ae:p,le!==0&&(Y=We(["arraycolsep"],[]),Y.style.width=et(le),H.push(Y))}var pe=[];for(r=0;r0){for(var Pt=Qh("hline",t,_),zt=Qh("hdashline",t,_),ot=[{type:"elem",elem:$t,shift:0}];u.length>0;){var ft=u.pop(),It=ft.pos-$;ft.isDashed?ot.push({type:"elem",elem:zt,shift:It}):ot.push({type:"elem",elem:Pt,shift:It})}$t=Hn({positionType:"individualShift",children:ot})}if(X.length===0)return We(["mord"],[$t],t);var we=Hn({positionType:"individualShift",children:X}),Re=We(["tag"],[we],t);return Kl([$t,Re])},B6t={c:"center ",l:"left ",r:"right "},Vo=function(n,t){for(var r=[],s=new Xe("mtd",[],["mtr-glue"]),i=new Xe("mtd",[],["mml-eqn-num"]),a=0;a0){var x=n.cols,S="",v=!1,b=0,w=x.length;x[0].type==="separator"&&(p+="top ",b=1),x[x.length-1].type==="separator"&&(p+="bottom ",w-=1);for(var y=b;y0?"left ":"",p+=M[M.length-1].length>0?"right ":"";for(var O=1;O0&&m&&(v=1),r[x]={type:"align",align:S,pregap:v,postgap:0}}return a.colSeparationType=m?"align":"alignat",a};Go({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,n){var t=Ub(n[0]),r=t?[n[0]]:on(n[0],"ordgroup").body,s=r.map(function(a){var o=qb(a),l=o.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new Ye("Unknown column alignment: "+l,a)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Cu(e.parser,i,ak(e.envName))},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var n={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],t="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:t}]};if(e.envName.charAt(e.envName.length-1)==="*"){var s=e.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),t=s.fetch().text,!"lcr".includes(t))throw new Ye("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:t}]}}var i=Cu(e.parser,r,ak(e.envName)),a=Math.max(0,...i.body.map(o=>o.length));return i.cols=new Array(a).fill({type:"align",align:t}),n?{type:"leftright",mode:e.mode,body:[i],left:n[0],right:n[1],rightColor:void 0}:i},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var n={arraystretch:.5},t=Cu(e.parser,n,"script");return t.colSeparationType="small",t},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["subarray"],props:{numArgs:1},handler(e,n){var t=Ub(n[0]),r=t?[n[0]]:on(n[0],"ordgroup").body,s=r.map(function(o){var l=qb(o),u=l.text;if("lc".includes(u))return{type:"align",align:u};throw new Ye("Unknown column alignment: "+u,o)});if(s.length>1)throw new Ye("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5},a=Cu(e.parser,i,"script");if(a.body.length>0&&a.body[0].length>1)throw new Ye("{subarray} can contain only one column");return a},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var n={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},t=Cu(e.parser,n,ak(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:W$,htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){I6t.has(e.envName)&&Qb(e);var n={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:ik(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Cu(e.parser,n,"display")},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:W$,htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Qb(e);var n={autoTag:ik(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Cu(e.parser,n,"display")},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["CD"],props:{numArgs:0},handler(e){return Qb(e),C6t(e.parser)},htmlBuilder:Wo,mathmlBuilder:Vo});ie("\\nonumber","\\gdef\\@eqnsw{0}");ie("\\notag","\\nonumber");lt({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,n){throw new Ye(e.funcName+" valid only within array environment")}});var jT=U$;lt({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,n){var{parser:t,funcName:r}=e,s=n[0];if(s.type!=="ordgroup")throw new Ye("Invalid environment name",s);for(var i="",a=0;a{var t=e.font,r=n.withFont(t);return Un(e.body,r)},K$=(e,n)=>{var t=e.font,r=n.withFont(t);return ar(e.body,r)},TT={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};lt({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=Cv(n[0]),i=r;return i in TT&&(i=TT[i]),{type:"font",mode:t.mode,font:i.slice(1),body:s}},htmlBuilder:V$,mathmlBuilder:K$});lt({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,n)=>{var{parser:t}=e,r=n[0];return{type:"mclass",mode:t.mode,mclass:Gb(r),body:[{type:"font",mode:t.mode,font:"boldsymbol",body:r}],isCharacterBox:Wl(r)}}});lt({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,n)=>{var{parser:t,funcName:r,breakOnTokenText:s}=e,{mode:i}=t,a=t.parseExpression(!0,s);return{type:"font",mode:i,font:"math"+r.slice(1),body:{type:"ordgroup",mode:t.mode,body:a}}},htmlBuilder:V$,mathmlBuilder:K$});var $6t=(e,n)=>{var t=n.style,r=t.fracNum(),s=t.fracDen(),i;i=n.havingStyle(r);var a=Un(e.numer,i,n);if(e.continued){var o=8.5/n.fontMetrics().ptPerEm,l=3.5/n.fontMetrics().ptPerEm;a.height=a.height0?x=3*p:x=7*p,S=n.fontMetrics().denom1):(d>0?(m=n.fontMetrics().num2,x=p):(m=n.fontMetrics().num3,x=3*p),S=n.fontMetrics().denom2);var v;if(_){var w=n.fontMetrics().axisHeight;m-a.depth-(w+.5*d){var t=new Xe("mfrac",[ar(e.numer,n),ar(e.denom,n)]);if(!e.hasBarLine)t.setAttribute("linethickness","0px");else if(e.barSize){var r=Ar(e.barSize,n);t.setAttribute("linethickness",et(r))}if(e.leftDelim!=null||e.rightDelim!=null){var s=[];if(e.leftDelim!=null){var i=new Xe("mo",[new ns(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),s.push(i)}if(s.push(t),e.rightDelim!=null){var a=new Xe("mo",[new ns(e.rightDelim.replace("\\",""))]);a.setAttribute("fence","true"),s.push(a)}return tk(s)}return t},Q$=(e,n)=>{if(!n)return e;var t={type:"styling",mode:e.mode,style:n,body:[e]};return t};lt({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=n[0],i=n[1],a,o=null,l=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a=!1,o="(",l=")";break;case"\\\\bracefrac":a=!1,o="\\{",l="\\}";break;case"\\\\brackfrac":a=!1,o="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var u=r==="\\cfrac",_=null;return u||r.startsWith("\\d")?_="display":r.startsWith("\\t")&&(_="text"),Q$({type:"genfrac",mode:t.mode,numer:s,denom:i,continued:u,hasBarLine:a,leftDelim:o,rightDelim:l,barSize:null},_)},htmlBuilder:$6t,mathmlBuilder:P6t});lt({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:n,funcName:t,token:r}=e,s;switch(t){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:n.mode,replaceWith:s,token:r}}});var AT=["display","text","script","scriptscript"],RT=function(n){var t=null;return n.length>0&&(t=n,t=t==="."?null:t),t};lt({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,n){var{parser:t}=e,r=n[4],s=n[5],i=Cv(n[0]),a=i.type==="atom"&&i.family==="open"?RT(i.text):null,o=Cv(n[1]),l=o.type==="atom"&&o.family==="close"?RT(o.text):null,u=on(n[2],"size"),_,d=null;u.isBlank?_=!0:(d=u.value,_=d.number>0);var p=null,m=n[3];if(m.type==="ordgroup"){if(m.body.length>0){var x=on(m.body[0],"textord");p=AT[Number(x.text)]}}else m=on(m,"textord"),p=AT[Number(m.text)];return Q$({type:"genfrac",mode:t.mode,numer:r,denom:s,continued:!1,hasBarLine:_,barSize:d,leftDelim:a,rightDelim:l},p)}});lt({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,n){var{parser:t,funcName:r,token:s}=e;return{type:"infix",mode:t.mode,replaceWith:"\\\\abovefrac",size:on(n[0],"size").value,token:s}}});lt({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=n[0],i=on(n[1],"infix").size;if(!i)throw new Error("\\\\abovefrac expected size, but got "+String(i));var a=n[2],o=i.number>0;return{type:"genfrac",mode:t.mode,numer:s,denom:a,continued:!1,hasBarLine:o,barSize:i,leftDelim:null,rightDelim:null}}});var Y$=(e,n)=>{var t=n.style,r,s;e.type==="supsub"?(r=e.sup?Un(e.sup,n.havingStyle(t.sup()),n):Un(e.sub,n.havingStyle(t.sub()),n),s=on(e.base,"horizBrace")):s=on(e,"horizBrace");var i=Un(s.base,n.havingBaseStyle(Yt.DISPLAY)),a=Hb(s,n),o;if(s.isOver?o=Hn({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:a,wrapperClasses:["svg-align"]}]}):o=Hn({positionType:"bottom",positionData:i.depth+.1+a.height,children:[{type:"elem",elem:a,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),r){var l=We(["minner",s.isOver?"mover":"munder"],[o],n);s.isOver?o=Hn({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):o=Hn({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return We(["minner",s.isOver?"mover":"munder"],[o],n)},F6t=(e,n)=>{var t=Fb(e.label);return new Xe(e.isOver?"mover":"munder",[ar(e.base,n),t])};lt({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(e,n){var{parser:t,funcName:r}=e;return{type:"horizBrace",mode:t.mode,label:r,isOver:r.includes("\\over"),base:n[0]}},htmlBuilder:Y$,mathmlBuilder:F6t});lt({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,n)=>{var{parser:t}=e,r=n[1],s=on(n[0],"url").url;return t.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:t.mode,href:s,body:ts(r)}:t.formatUnsupportedCmd("\\href")},htmlBuilder:(e,n)=>{var t=ps(e.body,n,!1);return e6t(e.href,[],t,n)},mathmlBuilder:(e,n)=>{var t=gu(e.body,n);return t instanceof Xe||(t=new Xe("mrow",[t])),t.setAttribute("href",e.href),t}});lt({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,n)=>{var{parser:t}=e,r=on(n[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:r}))return t.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:t,funcName:r,token:s}=e,i=on(n[0],"raw").string,a=n[1];t.settings.strict&&t.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,l={};switch(r){case"\\htmlClass":l.class=i,o={command:"\\htmlClass",class:i};break;case"\\htmlId":l.id=i,o={command:"\\htmlId",id:i};break;case"\\htmlStyle":l.style=i,o={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var u=i.split(","),_=0;_{var t=ps(e.body,n,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var s=We(r,t,n);for(var i in e.attributes)i!=="class"&&e.attributes.hasOwnProperty(i)&&s.setAttribute(i,e.attributes[i]);return s},mathmlBuilder:(e,n)=>gu(e.body,n)});lt({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(e,n)=>{var{parser:t}=e;return{type:"htmlmathml",mode:t.mode,html:ts(n[0]),mathml:ts(n[1])}},htmlBuilder:(e,n)=>{var t=ps(e.html,n,!1);return Kl(t)},mathmlBuilder:(e,n)=>gu(e.mathml,n)});var mw=function(n){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(n))return{number:+n,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n);if(!t)throw new Ye("Invalid size: '"+n+"' in \\includegraphics");var r={number:+(t[1]+t[2]),unit:t[3]};if(!h$(r))throw new Ye("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};lt({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,n,t)=>{var{parser:r}=e,s={number:0,unit:"em"},i={number:.9,unit:"em"},a={number:0,unit:"em"},o="";if(t[0])for(var l=on(t[0],"raw").string,u=l.split(","),_=0;_{var t=Ar(e.height,n),r=0;e.totalheight.number>0&&(r=Ar(e.totalheight,n)-t);var s=0;e.width.number>0&&(s=Ar(e.width,n));var i={height:et(t+r)};s>0&&(i.width=et(s)),r>0&&(i.verticalAlign=et(-r));var a=new H5t(e.src,e.alt,i);return a.height=t,a.depth=r,a},mathmlBuilder:(e,n)=>{var t=new Xe("mglyph",[]);t.setAttribute("alt",e.alt);var r=Ar(e.height,n),s=0;if(e.totalheight.number>0&&(s=Ar(e.totalheight,n)-r,t.setAttribute("valign",et(-s))),t.setAttribute("height",et(r+s)),e.width.number>0){var i=Ar(e.width,n);t.setAttribute("width",et(i))}return t.setAttribute("src",e.src),t}});lt({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,n){var{parser:t,funcName:r}=e,s=on(n[0],"size");if(t.settings.strict){var i=r[1]==="m",a=s.value.unit==="mu";i?(a||t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),t.mode!=="math"&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:t.mode,dimension:s.value}},htmlBuilder(e,n){return b$(e.dimension,n)},mathmlBuilder(e,n){var t=Ar(e.dimension,n);return new C$(t)}});lt({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=n[0];return{type:"lap",mode:t.mode,alignment:r.slice(5),body:s}},htmlBuilder:(e,n)=>{var t;e.alignment==="clap"?(t=We([],[Un(e.body,n)]),t=We(["inner"],[t],n)):t=We(["inner"],[Un(e.body,n)]);var r=We(["fix"],[]),s=We([e.alignment],[t,r],n),i=We(["strut"]);return i.style.height=et(s.height+s.depth),s.depth&&(i.style.verticalAlign=et(-s.depth)),s.children.unshift(i),s=We(["thinbox"],[s],n),We(["mord","vbox"],[s],n)},mathmlBuilder:(e,n)=>{var t=new Xe("mpadded",[ar(e.body,n)]);if(e.alignment!=="rlap"){var r=e.alignment==="llap"?"-1":"-0.5";t.setAttribute("lspace",r+"width")}return t.setAttribute("width","0px"),t}});lt({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,n){var{funcName:t,parser:r}=e,s=r.mode;r.switchMode("math");var i=t==="\\("?"\\)":"$",a=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",resetFont:!0,body:a}}});lt({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,n){throw new Ye("Mismatched "+e.funcName)}});var MT=(e,n)=>{switch(n.style.size){case Yt.DISPLAY.size:return e.display;case Yt.TEXT.size:return e.text;case Yt.SCRIPT.size:return e.script;case Yt.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};lt({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,n)=>{var{parser:t}=e;return{type:"mathchoice",mode:t.mode,display:ts(n[0]),text:ts(n[1]),script:ts(n[2]),scriptscript:ts(n[3])}},htmlBuilder:(e,n)=>{var t=MT(e,n),r=ps(t,n,!1);return Kl(r)},mathmlBuilder:(e,n)=>{var t=MT(e,n);return gu(t,n)}});var X$=(e,n,t,r,s,i,a)=>{e=We([],[e]);var o=t&&Wl(t),l,u;if(n){var _=Un(n,r.havingStyle(s.sup()),r);u={elem:_,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-_.depth)}}if(t){var d=Un(t,r.havingStyle(s.sub()),r);l={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-d.height)}}var p;if(u&&l){var m=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+a;p=Hn({positionType:"bottom",positionData:m,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:et(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:et(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var x=e.height-a;p=Hn({positionType:"top",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:et(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(u){var S=e.depth+a;p=Hn({positionType:"bottom",positionData:S,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:et(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return e;var v=[p];if(l&&i!==0&&!o){var b=We(["mspace"],[],r);b.style.marginRight=et(i),v.unshift(b)}return We(["mop","op-limits"],v,r)},Z$=new Set(["\\smallint"]),v_=(e,n)=>{var t,r,s=!1,i;e.type==="supsub"?(t=e.sup,r=e.sub,i=on(e.base,"op"),s=!0):i=on(e,"op");var a=n.style,o=!1;a.size===Yt.DISPLAY.size&&i.symbol&&!Z$.has(i.name)&&(o=!0);var l,u;if(i.symbol){var _=o?"Size2-Regular":"Size1-Regular",d="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(d=i.name.slice(1),i.name=d==="oiint"?"\\iint":"\\iiint"),l=ii(i.name,_,"math",n,["mop","op-symbol",o?"large-op":"small-op"]),u=l.italic,d.length>0){var p=x$(d+"Size"+(o?"2":"1"),n);l=Hn({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:p,shift:o?.08:0}]}),i.name="\\"+d,l.classes.unshift("mop"),l.italic=u}}else if(i.body){var m=ps(i.body,n,!0);m.length===1&&m[0]instanceof Zi?(l=m[0],l.classes[0]="mop"):l=We(["mop"],m,n)}else{for(var x=[],S=1;S{var t;if(e.symbol)t=new Xe("mo",[ja(e.name,e.mode)]),Z$.has(e.name)&&t.setAttribute("largeop","false");else if(e.body)t=new Xe("mo",ra(e.body,n));else{t=new Xe("mi",[new ns(e.name.slice(1))]);var r=new Xe("mo",[ja("⁡","text")]);e.parentIsSupSub?t=new Xe("mrow",[t,r]):t=k$([t,r])}return t},H6t={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};lt({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=r;return s.length===1&&(s=H6t[s]),{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:v_,mathmlBuilder:dm});lt({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,n)=>{var{parser:t}=e,r=n[0];return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:ts(r)}},htmlBuilder:v_,mathmlBuilder:dm});var q6t={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};lt({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:n,funcName:t}=e;return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:v_,mathmlBuilder:dm});lt({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:n,funcName:t}=e;return{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:v_,mathmlBuilder:dm});lt({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:n,funcName:t}=e,r=t;return r.length===1&&(r=q6t[r]),{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:v_,mathmlBuilder:dm});var J$=(e,n)=>{var t,r,s=!1,i;e.type==="supsub"?(t=e.sup,r=e.sub,i=on(e.base,"operatorname"),s=!0):i=on(e,"operatorname");var a;if(i.body.length>0){for(var o=i.body.map(d=>{var p="text"in d?d.text:void 0;return typeof p=="string"?{type:"textord",mode:d.mode,text:p}:d}),l=ps(o,n.withFont("mathrm"),!0),u=0;u{for(var t=ra(e.body,n.withFont("mathrm")),r=!0,s=0;s_.toText()).join("");t=[new ns(o)]}var l=new Xe("mi",t);l.setAttribute("mathvariant","normal");var u=new Xe("mo",[ja("⁡","text")]);return e.parentIsSupSub?new Xe("mrow",[l,u]):k$([l,u])};lt({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=n[0];return{type:"operatorname",mode:t.mode,body:ts(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:J$,mathmlBuilder:U6t});ie("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");nf({type:"ordgroup",htmlBuilder(e,n){return e.semisimple?Kl(ps(e.body,n,!1)):We(["mord"],ps(e.body,n,!0),n)},mathmlBuilder(e,n){return gu(e.body,n,!0)}});lt({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,n){var{parser:t}=e,r=n[0];return{type:"overline",mode:t.mode,body:r}},htmlBuilder(e,n){var t=Un(e.body,n.havingCrampedStyle()),r=Qh("overline-line",n),s=n.fontMetrics().defaultRuleThickness,i=Hn({positionType:"firstBaseline",children:[{type:"elem",elem:t},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]});return We(["mord","overline"],[i],n)},mathmlBuilder(e,n){var t=new Xe("mo",[new ns("‾")]);t.setAttribute("stretchy","true");var r=new Xe("mover",[ar(e.body,n),t]);return r.setAttribute("accent","true"),r}});lt({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,n)=>{var{parser:t}=e,r=n[0];return{type:"phantom",mode:t.mode,body:ts(r)}},htmlBuilder:(e,n)=>{var t=ps(e.body,n.withPhantom(),!1);return Kl(t)},mathmlBuilder:(e,n)=>{var t=ra(e.body,n);return new Xe("mphantom",t)}});ie("\\hphantom","\\smash{\\phantom{#1}}");lt({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,n)=>{var{parser:t}=e,r=n[0];return{type:"vphantom",mode:t.mode,body:r}},htmlBuilder:(e,n)=>{var t=We(["inner"],[Un(e.body,n.withPhantom())]),r=We(["fix"],[]);return We(["mord","rlap"],[t,r],n)},mathmlBuilder:(e,n)=>{var t=ra(ts(e.body),n),r=new Xe("mphantom",t),s=new Xe("mpadded",[r]);return s.setAttribute("width","0px"),s}});lt({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,n){var{parser:t}=e,r=on(n[0],"size").value,s=n[1];return{type:"raisebox",mode:t.mode,dy:r,body:s}},htmlBuilder(e,n){var t=Un(e.body,n),r=Ar(e.dy,n);return Hn({positionType:"shift",positionData:-r,children:[{type:"elem",elem:t}]})},mathmlBuilder(e,n){var t=new Xe("mpadded",[ar(e.body,n)]),r=e.dy.number+e.dy.unit;return t.setAttribute("voffset",r),t}});lt({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:n}=e;return{type:"internal",mode:n.mode}}});lt({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,n,t){var{parser:r}=e,s=t[0],i=on(n[0],"size"),a=on(n[1],"size");return{type:"rule",mode:r.mode,shift:s&&on(s,"size").value,width:i.value,height:a.value}},htmlBuilder(e,n){var t=We(["mord","rule"],[],n),r=Ar(e.width,n),s=Ar(e.height,n),i=e.shift?Ar(e.shift,n):0;return t.style.borderRightWidth=et(r),t.style.borderTopWidth=et(s),t.style.bottom=et(i),t.width=r,t.height=s+i,t.depth=-i,t.maxFontSize=s*1.125*n.sizeMultiplier,t},mathmlBuilder(e,n){var t=Ar(e.width,n),r=Ar(e.height,n),s=e.shift?Ar(e.shift,n):0,i=n.color&&n.getColor()||"black",a=new Xe("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",et(t)),a.setAttribute("height",et(r));var o=new Xe("mpadded",[a]);return s>=0?o.setAttribute("height",et(s)):(o.setAttribute("height",et(s)),o.setAttribute("depth",et(-s))),o.setAttribute("voffset",et(s)),o}});function eP(e,n,t){for(var r=ps(e,n,!1),s=n.sizeMultiplier/t.sizeMultiplier,i=0;i{var t=n.havingSize(e.size);return eP(e.body,t,n)};lt({type:"sizing",names:DT,props:{numArgs:0,allowedInText:!0},handler:(e,n)=>{var{breakOnTokenText:t,funcName:r,parser:s}=e,i=s.parseExpression(!1,t);return{type:"sizing",mode:s.mode,size:DT.indexOf(r)+1,body:i}},htmlBuilder:G6t,mathmlBuilder:(e,n)=>{var t=n.havingSize(e.size),r=ra(e.body,t),s=new Xe("mstyle",r);return s.setAttribute("mathsize",et(t.sizeMultiplier)),s}});lt({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,n,t)=>{var{parser:r}=e,s=!1,i=!1,a=t[0]&&on(t[0],"ordgroup");if(a)for(var o,l=0;l{var t=We([],[Un(e.body,n)]);if(!e.smashHeight&&!e.smashDepth)return t;if(e.smashHeight&&(t.height=0),e.smashDepth&&(t.depth=0),e.smashHeight&&e.smashDepth)return We(["mord","smash"],[t],n);if(t.children)for(var r=0;r{var t=new Xe("mpadded",[ar(e.body,n)]);return e.smashHeight&&t.setAttribute("height","0px"),e.smashDepth&&t.setAttribute("depth","0px"),t}});lt({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,n,t){var{parser:r}=e,s=t[0],i=n[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(e,n){var t=Un(e.body,n.havingCrampedStyle());t.height===0&&(t.height=n.fontMetrics().xHeight),t=Yh(t,n);var r=n.fontMetrics(),s=r.defaultRuleThickness,i=s;n.style.idt.height+t.depth+a&&(a=(a+d-t.height-t.depth)/2);var p=l.height-t.height-a-u;t.style.paddingLeft=et(_);var m=Hn({positionType:"firstBaseline",children:[{type:"elem",elem:t,wrapperClasses:["svg-align"]},{type:"kern",size:-(t.height+p)},{type:"elem",elem:l},{type:"kern",size:u}]});if(e.index){var x=n.havingStyle(Yt.SCRIPTSCRIPT),S=Un(e.index,x,n),v=.6*(m.height-m.depth),b=Hn({positionType:"shift",positionData:-v,children:[{type:"elem",elem:S}]}),w=We(["root"],[b]);return We(["mord","sqrt"],[w,m],n)}else return We(["mord","sqrt"],[m],n)},mathmlBuilder(e,n){var{body:t,index:r}=e;return r?new Xe("mroot",[ar(t,n),ar(r,n)]):new Xe("msqrt",[ar(t,n)])}});var W3={display:Yt.DISPLAY,text:Yt.TEXT,script:Yt.SCRIPT,scriptscript:Yt.SCRIPTSCRIPT};function W6t(e){return e in W3}lt({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,n){var{breakOnTokenText:t,funcName:r,parser:s}=e,i=s.parseExpression(!0,t),a=r.slice(1,r.length-5);if(!W6t(a))throw new Error("Unknown style: "+a);return{type:"styling",mode:s.mode,style:a,body:i}},htmlBuilder(e,n){var t=W3[e.style],r=n.havingStyle(t);return e.resetFont&&(r=r.withFont("")),eP(e.body,r,n)},mathmlBuilder(e,n){var t=W3[e.style],r=n.havingStyle(t);e.resetFont&&(r=r.withFont(""));var s=ra(e.body,r),i=new Xe("mstyle",s),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=a[e.style];return i.setAttribute("scriptlevel",o[0]),i.setAttribute("displaystyle",o[1]),i}});var V6t=function(n,t){var r=n.base;if(r)if(r.type==="op"){var s=r.limits&&(t.style.size===Yt.DISPLAY.size||r.alwaysHandleSupSub);return s?v_:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(t.style.size===Yt.DISPLAY.size||r.limits);return i?J$:null}else{if(r.type==="accent")return Wl(r.base)?rk:null;if(r.type==="horizBrace"){var a=!n.sub;return a===r.isOver?Y$:null}else return null}else return null};nf({type:"supsub",htmlBuilder(e,n){var t=V6t(e,n);if(t)return t(e,n);var{base:r,sup:s,sub:i}=e,a=Un(r,n),o,l,u=n.fontMetrics(),_=0,d=0,p=r&&Wl(r);if(s){var m=n.havingStyle(n.style.sup());o=Un(s,m,n),p||(_=a.height-m.fontMetrics().supDrop*m.sizeMultiplier/n.sizeMultiplier)}if(i){var x=n.havingStyle(n.style.sub());l=Un(i,x,n),p||(d=a.depth+x.fontMetrics().subDrop*x.sizeMultiplier/n.sizeMultiplier)}var S;n.style===Yt.DISPLAY?S=u.sup1:n.style.cramped?S=u.sup3:S=u.sup2;var v=n.sizeMultiplier,b=et(.5/u.ptPerEm/v),w=null;if(l){var y=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(a instanceof Zi||y){var C;w=et(-((C=a.italic)!=null?C:0))}}var E;if(o&&l){_=Math.max(_,S,o.depth+.25*u.xHeight),d=Math.max(d,u.sub2);var N=u.defaultRuleThickness,T=4*N;if(_-o.depth-(l.height-d)0&&(_+=z,d-=z)}var M=[{type:"elem",elem:l,shift:d,marginRight:b,marginLeft:w},{type:"elem",elem:o,shift:-_,marginRight:b}];E=Hn({positionType:"individualShift",children:M})}else if(l){d=Math.max(d,u.sub1,l.height-.8*u.xHeight);var O=[{type:"elem",elem:l,marginLeft:w,marginRight:b}];E=Hn({positionType:"shift",positionData:d,children:O})}else if(o)_=Math.max(_,S,o.depth+.25*u.xHeight),E=Hn({positionType:"shift",positionData:-_,children:[{type:"elem",elem:o,marginRight:b}]});else throw new Error("supsub must have either sup or sub.");var B=F3(a,"right")||"mord";return We([B],[a,We(["msupsub"],[E])],n)},mathmlBuilder(e,n){var t=!1,r,s;e.base&&e.base.type==="horizBrace"&&(s=!!e.sup,s===e.base.isOver&&(t=!0,r=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var i=[ar(e.base,n)];e.sub&&i.push(ar(e.sub,n)),e.sup&&i.push(ar(e.sup,n));var a;if(t)a=r?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&n.style===Yt.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(n.style===Yt.DISPLAY||u.limits)?a="munderover":a="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(n.style===Yt.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||n.style===Yt.DISPLAY)?a="munder":a="msub"}else{var o=e.base;o&&o.type==="op"&&o.limits&&(n.style===Yt.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||n.style===Yt.DISPLAY)?a="mover":a="msup"}return new Xe(a,i)}});nf({type:"atom",htmlBuilder(e,n){return JS(e.text,e.mode,n,["m"+e.family])},mathmlBuilder(e,n){var t=new Xe("mo",[ja(e.text,e.mode)]);if(e.family==="bin"){var r=nk(e,n);r==="bold-italic"&&t.setAttribute("mathvariant",r)}else e.family==="punct"?t.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&t.setAttribute("stretchy","false");return t}});var tP={mi:"italic",mn:"normal",mtext:"normal"};nf({type:"mathord",htmlBuilder(e,n){return Pb(e,n,"mathord")},mathmlBuilder(e,n){var t=new Xe("mi",[ja(e.text,e.mode,n)]),r=nk(e,n)||"italic";return r!==tP[t.type]&&t.setAttribute("mathvariant",r),t}});nf({type:"textord",htmlBuilder(e,n){return Pb(e,n,"textord")},mathmlBuilder(e,n){var t=ja(e.text,e.mode,n),r=nk(e,n)||"normal",s;return e.mode==="text"?s=new Xe("mtext",[t]):/[0-9]/.test(e.text)?s=new Xe("mn",[t]):e.text==="\\prime"?s=new Xe("mo",[t]):s=new Xe("mi",[t]),r!==tP[s.type]&&s.setAttribute("mathvariant",r),s}});var gw={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},vw={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};nf({type:"spacing",htmlBuilder(e,n){if(vw.hasOwnProperty(e.text)){var t=vw[e.text].className||"";if(e.mode==="text"){var r=Pb(e,n,"textord");return r.classes.push(t),r}else return We(["mspace",t],[JS(e.text,e.mode,n)],n)}else{if(gw.hasOwnProperty(e.text))return We(["mspace",gw[e.text]],[],n);throw new Ye('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,n){var t;if(vw.hasOwnProperty(e.text))t=new Xe("mtext",[new ns(" ")]);else{if(gw.hasOwnProperty(e.text))return new Xe("mspace");throw new Ye('Unknown type of space "'+e.text+'"')}return t}});var LT=()=>{var e=new Xe("mtd",[]);return e.setAttribute("width","50%"),e};nf({type:"tag",mathmlBuilder(e,n){var t=new Xe("mtable",[new Xe("mtr",[LT(),new Xe("mtd",[gu(e.body,n)]),LT(),new Xe("mtd",[gu(e.tag,n)])])]);return t.setAttribute("width","100%"),t}});var OT={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},IT={"\\textbf":"textbf","\\textmd":"textmd"},K6t={"\\textit":"textit","\\textup":"textup"},BT=(e,n)=>{var t=e.font;if(t){if(OT[t])return n.withTextFontFamily(OT[t]);if(IT[t])return n.withTextFontWeight(IT[t]);if(t==="\\emph")return n.fontShape==="textit"?n.withTextFontShape("textup"):n.withTextFontShape("textit")}else return n;return n.withTextFontShape(K6t[t])};lt({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,n){var{parser:t,funcName:r}=e,s=n[0];return{type:"text",mode:t.mode,body:ts(s),font:r}},htmlBuilder(e,n){var t=BT(e,n),r=ps(e.body,t,!0);return We(["mord","text"],r,t)},mathmlBuilder(e,n){var t=BT(e,n);return gu(e.body,t)}});lt({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,n){var{parser:t}=e;return{type:"underline",mode:t.mode,body:n[0]}},htmlBuilder(e,n){var t=Un(e.body,n),r=Qh("underline-line",n),s=n.fontMetrics().defaultRuleThickness,i=Hn({positionType:"top",positionData:t.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:t}]});return We(["mord","underline"],[i],n)},mathmlBuilder(e,n){var t=new Xe("mo",[new ns("‾")]);t.setAttribute("stretchy","true");var r=new Xe("munder",[ar(e.body,n),t]);return r.setAttribute("accentunder","true"),r}});lt({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,n){var{parser:t}=e;return{type:"vcenter",mode:t.mode,body:n[0]}},htmlBuilder(e,n){var t=Un(e.body,n),r=n.fontMetrics().axisHeight,s=.5*(t.height-r-(t.depth+r));return Hn({positionType:"shift",positionData:s,children:[{type:"elem",elem:t}]})},mathmlBuilder(e,n){var t=new Xe("mpadded",[ar(e.body,n)],["vcenter"]);return new Xe("mrow",[t])}});lt({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,n,t){throw new Ye("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,n){for(var t=$T(e),r=[],s=n.havingStyle(n.style.text()),i=0;ie.body.replace(/ /g,e.star?"␣":" "),iu=w$,nP=`[ \r +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};function $5t(e){return"toText"in e}class d_{constructor(n){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=n,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(n){return this.classes.includes(n)}toNode(){for(var n=document.createDocumentFragment(),t=0;t{if($5t(n))return n.toText();throw new Error("Expected MathDomNode with toText, got "+n.constructor.name)}).join("")}}var A3={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},P5t={ex:!0,em:!0,mu:!0},h$=function(n){return typeof n!="string"&&(n=n.unit),n in A3||n in P5t||n==="ex"},Rr=function(n,t){var r;if(n.unit in A3)r=A3[n.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(n.unit==="mu")r=t.fontMetrics().cssEmPerMu;else{var s;if(t.style.isTight()?s=t.havingStyle(t.style.text()):s=t,n.unit==="ex")r=s.fontMetrics().xHeight;else if(n.unit==="em")r=s.fontMetrics().quad;else throw new Qe("Invalid unit: '"+n.unit+"'");s!==t&&(r*=s.sizeMultiplier/t.sizeMultiplier)}return Math.min(n.number*r,t.maxSize)},et=function(n){return+n.toFixed(4)+"em"},iu=function(n){return n.filter(t=>t).join(" ")},XS=function(n){var t="";for(var r of Object.keys(n)){var s=n[r];s!==void 0&&(t+=_5t(r)+":"+s+";")}return t},_$=function(n,t,r){if(this.classes=n||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},t){t.style.isTight()&&this.classes.push("mtight");var s=t.getColor();s&&(this.style.color=s)}},p$=function(n){var t=document.createElement(n);t.className=iu(this.classes),Object.assign(t.style,this.style);for(var r of Object.keys(this.attributes))t.setAttribute(r,this.attributes[r]);for(var s=0;s/=\x00-\x1f]/,m$=function(n){var t="<"+n;this.classes.length&&(t+=' class="'+Bs(iu(this.classes))+'"');var r=XS(this.style);r&&(t+=' style="'+Bs(r)+'"');for(var s of Object.keys(this.attributes)){if(F5t.test(s))throw new Qe("Invalid attribute name '"+s+"'");t+=" "+s+'="'+Bs(this.attributes[s])+'"'}t+=">";for(var i=0;i",t};class f_{constructor(n,t,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,_$.call(this,n,r,s),this.children=t||[]}setAttribute(n,t){this.attributes[n]=t}hasClass(n){return this.classes.includes(n)}toNode(){return p$.call(this,"span")}toMarkup(){return m$.call(this,"span")}}class Ib{constructor(n,t,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,_$.call(this,t,s),this.children=r||[],this.setAttribute("href",n)}setAttribute(n,t){this.attributes[n]=t}hasClass(n){return this.classes.includes(n)}toNode(){return p$.call(this,"a")}toMarkup(){return m$.call(this,"a")}}class H5t{constructor(n,t,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=n,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=r}hasClass(n){return this.classes.includes(n)}toNode(){var n=document.createElement("img");return n.src=this.src,n.alt=this.alt,n.className="mord",Object.assign(n.style,this.style),n}toMarkup(){var n=''+Bs(this.alt)+'0&&(t=document.createElement("span"),t.style.marginRight=et(this.italic)),this.classes.length>0&&(t=t||document.createElement("span"),t.className=iu(this.classes)),Object.keys(this.style).length>0&&(t=t||document.createElement("span"),Object.assign(t.style,this.style)),t?(t.appendChild(n),t):n}toMarkup(){var n=!1,t="0&&(r+="margin-right:"+et(this.italic)+";"),r+=XS(this.style),r&&(n=!0,t+=' style="'+Bs(r)+'"');var s=Bs(this.text);return n?(t+=">",t+=s,t+="",t):s}}class Fl{constructor(n,t){this.children=void 0,this.attributes=void 0,this.children=n||[],this.attributes=t||{}}toNode(){var n="http://www.w3.org/2000/svg",t=document.createElementNS(n,"svg");for(var r of Object.keys(this.attributes))t.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class R3{constructor(n){this.attributes=void 0,this.attributes=n||{}}toNode(){var n="http://www.w3.org/2000/svg",t=document.createElementNS(n,"line");for(var r of Object.keys(this.attributes))t.setAttribute(r,this.attributes[r]);return t}toMarkup(){var n=" but got "+String(e)+".")}var W5t=e=>e instanceof f_||e instanceof Ib||e instanceof d_,To={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},Kg={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},lT={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function V5t(e,n){To[e]=n}function ZS(e,n,t){if(!To[n])throw new Error("Font metrics not found for font: "+n+".");var r=e.charCodeAt(0),s=To[n][r];if(!s&&e[0]in lT&&(r=lT[e[0]].charCodeAt(0),s=To[n][r]),!s&&t==="text"&&f$(r)&&(s=To[n][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var sw={};function K5t(e){var n;if(e>=5?n=0:e>=3?n=1:n=2,!sw[n]){var t=sw[n]={cssEmPerMu:Kg.quad[n]/18};for(var r in Kg)Kg.hasOwnProperty(r)&&(t[r]=Kg[r][n])}return sw[n]}var br={math:{},text:{}};function P(e,n,t,r,s,i){br[e][s]={font:n,group:t,replace:r},i&&r&&(br[e][r]=br[e][s])}var W="math",qe="text",Z="main",fe="ams",xr="accent-token",lt="bin",ni="close",h_="inner",Ot="mathord",ss="op-token",Ji="open",um="punct",he="rel",Gl="spacing",ge="textord";P(W,Z,he,"≡","\\equiv",!0);P(W,Z,he,"≺","\\prec",!0);P(W,Z,he,"≻","\\succ",!0);P(W,Z,he,"∼","\\sim",!0);P(W,Z,he,"⊥","\\perp");P(W,Z,he,"⪯","\\preceq",!0);P(W,Z,he,"⪰","\\succeq",!0);P(W,Z,he,"≃","\\simeq",!0);P(W,Z,he,"∣","\\mid",!0);P(W,Z,he,"≪","\\ll",!0);P(W,Z,he,"≫","\\gg",!0);P(W,Z,he,"≍","\\asymp",!0);P(W,Z,he,"∥","\\parallel");P(W,Z,he,"⋈","\\bowtie",!0);P(W,Z,he,"⌣","\\smile",!0);P(W,Z,he,"⊑","\\sqsubseteq",!0);P(W,Z,he,"⊒","\\sqsupseteq",!0);P(W,Z,he,"≐","\\doteq",!0);P(W,Z,he,"⌢","\\frown",!0);P(W,Z,he,"∋","\\ni",!0);P(W,Z,he,"∝","\\propto",!0);P(W,Z,he,"⊢","\\vdash",!0);P(W,Z,he,"⊣","\\dashv",!0);P(W,Z,he,"∋","\\owns");P(W,Z,um,".","\\ldotp");P(W,Z,um,"⋅","\\cdotp");P(W,Z,um,"⋅","·");P(qe,Z,ge,"⋅","·");P(W,Z,ge,"#","\\#");P(qe,Z,ge,"#","\\#");P(W,Z,ge,"&","\\&");P(qe,Z,ge,"&","\\&");P(W,Z,ge,"ℵ","\\aleph",!0);P(W,Z,ge,"∀","\\forall",!0);P(W,Z,ge,"ℏ","\\hbar",!0);P(W,Z,ge,"∃","\\exists",!0);P(W,Z,ge,"∇","\\nabla",!0);P(W,Z,ge,"♭","\\flat",!0);P(W,Z,ge,"ℓ","\\ell",!0);P(W,Z,ge,"♮","\\natural",!0);P(W,Z,ge,"♣","\\clubsuit",!0);P(W,Z,ge,"℘","\\wp",!0);P(W,Z,ge,"♯","\\sharp",!0);P(W,Z,ge,"♢","\\diamondsuit",!0);P(W,Z,ge,"ℜ","\\Re",!0);P(W,Z,ge,"♡","\\heartsuit",!0);P(W,Z,ge,"ℑ","\\Im",!0);P(W,Z,ge,"♠","\\spadesuit",!0);P(W,Z,ge,"§","\\S",!0);P(qe,Z,ge,"§","\\S");P(W,Z,ge,"¶","\\P",!0);P(qe,Z,ge,"¶","\\P");P(W,Z,ge,"†","\\dag");P(qe,Z,ge,"†","\\dag");P(qe,Z,ge,"†","\\textdagger");P(W,Z,ge,"‡","\\ddag");P(qe,Z,ge,"‡","\\ddag");P(qe,Z,ge,"‡","\\textdaggerdbl");P(W,Z,ni,"⎱","\\rmoustache",!0);P(W,Z,Ji,"⎰","\\lmoustache",!0);P(W,Z,ni,"⟯","\\rgroup",!0);P(W,Z,Ji,"⟮","\\lgroup",!0);P(W,Z,lt,"∓","\\mp",!0);P(W,Z,lt,"⊖","\\ominus",!0);P(W,Z,lt,"⊎","\\uplus",!0);P(W,Z,lt,"⊓","\\sqcap",!0);P(W,Z,lt,"∗","\\ast");P(W,Z,lt,"⊔","\\sqcup",!0);P(W,Z,lt,"◯","\\bigcirc",!0);P(W,Z,lt,"∙","\\bullet",!0);P(W,Z,lt,"‡","\\ddagger");P(W,Z,lt,"≀","\\wr",!0);P(W,Z,lt,"⨿","\\amalg");P(W,Z,lt,"&","\\And");P(W,Z,he,"⟵","\\longleftarrow",!0);P(W,Z,he,"⇐","\\Leftarrow",!0);P(W,Z,he,"⟸","\\Longleftarrow",!0);P(W,Z,he,"⟶","\\longrightarrow",!0);P(W,Z,he,"⇒","\\Rightarrow",!0);P(W,Z,he,"⟹","\\Longrightarrow",!0);P(W,Z,he,"↔","\\leftrightarrow",!0);P(W,Z,he,"⟷","\\longleftrightarrow",!0);P(W,Z,he,"⇔","\\Leftrightarrow",!0);P(W,Z,he,"⟺","\\Longleftrightarrow",!0);P(W,Z,he,"↦","\\mapsto",!0);P(W,Z,he,"⟼","\\longmapsto",!0);P(W,Z,he,"↗","\\nearrow",!0);P(W,Z,he,"↩","\\hookleftarrow",!0);P(W,Z,he,"↪","\\hookrightarrow",!0);P(W,Z,he,"↘","\\searrow",!0);P(W,Z,he,"↼","\\leftharpoonup",!0);P(W,Z,he,"⇀","\\rightharpoonup",!0);P(W,Z,he,"↙","\\swarrow",!0);P(W,Z,he,"↽","\\leftharpoondown",!0);P(W,Z,he,"⇁","\\rightharpoondown",!0);P(W,Z,he,"↖","\\nwarrow",!0);P(W,Z,he,"⇌","\\rightleftharpoons",!0);P(W,fe,he,"≮","\\nless",!0);P(W,fe,he,"","\\@nleqslant");P(W,fe,he,"","\\@nleqq");P(W,fe,he,"⪇","\\lneq",!0);P(W,fe,he,"≨","\\lneqq",!0);P(W,fe,he,"","\\@lvertneqq");P(W,fe,he,"⋦","\\lnsim",!0);P(W,fe,he,"⪉","\\lnapprox",!0);P(W,fe,he,"⊀","\\nprec",!0);P(W,fe,he,"⋠","\\npreceq",!0);P(W,fe,he,"⋨","\\precnsim",!0);P(W,fe,he,"⪹","\\precnapprox",!0);P(W,fe,he,"≁","\\nsim",!0);P(W,fe,he,"","\\@nshortmid");P(W,fe,he,"∤","\\nmid",!0);P(W,fe,he,"⊬","\\nvdash",!0);P(W,fe,he,"⊭","\\nvDash",!0);P(W,fe,he,"⋪","\\ntriangleleft");P(W,fe,he,"⋬","\\ntrianglelefteq",!0);P(W,fe,he,"⊊","\\subsetneq",!0);P(W,fe,he,"","\\@varsubsetneq");P(W,fe,he,"⫋","\\subsetneqq",!0);P(W,fe,he,"","\\@varsubsetneqq");P(W,fe,he,"≯","\\ngtr",!0);P(W,fe,he,"","\\@ngeqslant");P(W,fe,he,"","\\@ngeqq");P(W,fe,he,"⪈","\\gneq",!0);P(W,fe,he,"≩","\\gneqq",!0);P(W,fe,he,"","\\@gvertneqq");P(W,fe,he,"⋧","\\gnsim",!0);P(W,fe,he,"⪊","\\gnapprox",!0);P(W,fe,he,"⊁","\\nsucc",!0);P(W,fe,he,"⋡","\\nsucceq",!0);P(W,fe,he,"⋩","\\succnsim",!0);P(W,fe,he,"⪺","\\succnapprox",!0);P(W,fe,he,"≆","\\ncong",!0);P(W,fe,he,"","\\@nshortparallel");P(W,fe,he,"∦","\\nparallel",!0);P(W,fe,he,"⊯","\\nVDash",!0);P(W,fe,he,"⋫","\\ntriangleright");P(W,fe,he,"⋭","\\ntrianglerighteq",!0);P(W,fe,he,"","\\@nsupseteqq");P(W,fe,he,"⊋","\\supsetneq",!0);P(W,fe,he,"","\\@varsupsetneq");P(W,fe,he,"⫌","\\supsetneqq",!0);P(W,fe,he,"","\\@varsupsetneqq");P(W,fe,he,"⊮","\\nVdash",!0);P(W,fe,he,"⪵","\\precneqq",!0);P(W,fe,he,"⪶","\\succneqq",!0);P(W,fe,he,"","\\@nsubseteqq");P(W,fe,lt,"⊴","\\unlhd");P(W,fe,lt,"⊵","\\unrhd");P(W,fe,he,"↚","\\nleftarrow",!0);P(W,fe,he,"↛","\\nrightarrow",!0);P(W,fe,he,"⇍","\\nLeftarrow",!0);P(W,fe,he,"⇏","\\nRightarrow",!0);P(W,fe,he,"↮","\\nleftrightarrow",!0);P(W,fe,he,"⇎","\\nLeftrightarrow",!0);P(W,fe,he,"△","\\vartriangle");P(W,fe,ge,"ℏ","\\hslash");P(W,fe,ge,"▽","\\triangledown");P(W,fe,ge,"◊","\\lozenge");P(W,fe,ge,"Ⓢ","\\circledS");P(W,fe,ge,"®","\\circledR");P(qe,fe,ge,"®","\\circledR");P(W,fe,ge,"∡","\\measuredangle",!0);P(W,fe,ge,"∄","\\nexists");P(W,fe,ge,"℧","\\mho");P(W,fe,ge,"Ⅎ","\\Finv",!0);P(W,fe,ge,"⅁","\\Game",!0);P(W,fe,ge,"‵","\\backprime");P(W,fe,ge,"▲","\\blacktriangle");P(W,fe,ge,"▼","\\blacktriangledown");P(W,fe,ge,"■","\\blacksquare");P(W,fe,ge,"⧫","\\blacklozenge");P(W,fe,ge,"★","\\bigstar");P(W,fe,ge,"∢","\\sphericalangle",!0);P(W,fe,ge,"∁","\\complement",!0);P(W,fe,ge,"ð","\\eth",!0);P(qe,Z,ge,"ð","ð");P(W,fe,ge,"╱","\\diagup");P(W,fe,ge,"╲","\\diagdown");P(W,fe,ge,"□","\\square");P(W,fe,ge,"□","\\Box");P(W,fe,ge,"◊","\\Diamond");P(W,fe,ge,"¥","\\yen",!0);P(qe,fe,ge,"¥","\\yen",!0);P(W,fe,ge,"✓","\\checkmark",!0);P(qe,fe,ge,"✓","\\checkmark");P(W,fe,ge,"ℶ","\\beth",!0);P(W,fe,ge,"ℸ","\\daleth",!0);P(W,fe,ge,"ℷ","\\gimel",!0);P(W,fe,ge,"ϝ","\\digamma",!0);P(W,fe,ge,"ϰ","\\varkappa");P(W,fe,Ji,"┌","\\@ulcorner",!0);P(W,fe,ni,"┐","\\@urcorner",!0);P(W,fe,Ji,"└","\\@llcorner",!0);P(W,fe,ni,"┘","\\@lrcorner",!0);P(W,fe,he,"≦","\\leqq",!0);P(W,fe,he,"⩽","\\leqslant",!0);P(W,fe,he,"⪕","\\eqslantless",!0);P(W,fe,he,"≲","\\lesssim",!0);P(W,fe,he,"⪅","\\lessapprox",!0);P(W,fe,he,"≊","\\approxeq",!0);P(W,fe,lt,"⋖","\\lessdot");P(W,fe,he,"⋘","\\lll",!0);P(W,fe,he,"≶","\\lessgtr",!0);P(W,fe,he,"⋚","\\lesseqgtr",!0);P(W,fe,he,"⪋","\\lesseqqgtr",!0);P(W,fe,he,"≑","\\doteqdot");P(W,fe,he,"≓","\\risingdotseq",!0);P(W,fe,he,"≒","\\fallingdotseq",!0);P(W,fe,he,"∽","\\backsim",!0);P(W,fe,he,"⋍","\\backsimeq",!0);P(W,fe,he,"⫅","\\subseteqq",!0);P(W,fe,he,"⋐","\\Subset",!0);P(W,fe,he,"⊏","\\sqsubset",!0);P(W,fe,he,"≼","\\preccurlyeq",!0);P(W,fe,he,"⋞","\\curlyeqprec",!0);P(W,fe,he,"≾","\\precsim",!0);P(W,fe,he,"⪷","\\precapprox",!0);P(W,fe,he,"⊲","\\vartriangleleft");P(W,fe,he,"⊴","\\trianglelefteq");P(W,fe,he,"⊨","\\vDash",!0);P(W,fe,he,"⊪","\\Vvdash",!0);P(W,fe,he,"⌣","\\smallsmile");P(W,fe,he,"⌢","\\smallfrown");P(W,fe,he,"≏","\\bumpeq",!0);P(W,fe,he,"≎","\\Bumpeq",!0);P(W,fe,he,"≧","\\geqq",!0);P(W,fe,he,"⩾","\\geqslant",!0);P(W,fe,he,"⪖","\\eqslantgtr",!0);P(W,fe,he,"≳","\\gtrsim",!0);P(W,fe,he,"⪆","\\gtrapprox",!0);P(W,fe,lt,"⋗","\\gtrdot");P(W,fe,he,"⋙","\\ggg",!0);P(W,fe,he,"≷","\\gtrless",!0);P(W,fe,he,"⋛","\\gtreqless",!0);P(W,fe,he,"⪌","\\gtreqqless",!0);P(W,fe,he,"≖","\\eqcirc",!0);P(W,fe,he,"≗","\\circeq",!0);P(W,fe,he,"≜","\\triangleq",!0);P(W,fe,he,"∼","\\thicksim");P(W,fe,he,"≈","\\thickapprox");P(W,fe,he,"⫆","\\supseteqq",!0);P(W,fe,he,"⋑","\\Supset",!0);P(W,fe,he,"⊐","\\sqsupset",!0);P(W,fe,he,"≽","\\succcurlyeq",!0);P(W,fe,he,"⋟","\\curlyeqsucc",!0);P(W,fe,he,"≿","\\succsim",!0);P(W,fe,he,"⪸","\\succapprox",!0);P(W,fe,he,"⊳","\\vartriangleright");P(W,fe,he,"⊵","\\trianglerighteq");P(W,fe,he,"⊩","\\Vdash",!0);P(W,fe,he,"∣","\\shortmid");P(W,fe,he,"∥","\\shortparallel");P(W,fe,he,"≬","\\between",!0);P(W,fe,he,"⋔","\\pitchfork",!0);P(W,fe,he,"∝","\\varpropto");P(W,fe,he,"◀","\\blacktriangleleft");P(W,fe,he,"∴","\\therefore",!0);P(W,fe,he,"∍","\\backepsilon");P(W,fe,he,"▶","\\blacktriangleright");P(W,fe,he,"∵","\\because",!0);P(W,fe,he,"⋘","\\llless");P(W,fe,he,"⋙","\\gggtr");P(W,fe,lt,"⊲","\\lhd");P(W,fe,lt,"⊳","\\rhd");P(W,fe,he,"≂","\\eqsim",!0);P(W,Z,he,"⋈","\\Join");P(W,fe,he,"≑","\\Doteq",!0);P(W,fe,lt,"∔","\\dotplus",!0);P(W,fe,lt,"∖","\\smallsetminus");P(W,fe,lt,"⋒","\\Cap",!0);P(W,fe,lt,"⋓","\\Cup",!0);P(W,fe,lt,"⩞","\\doublebarwedge",!0);P(W,fe,lt,"⊟","\\boxminus",!0);P(W,fe,lt,"⊞","\\boxplus",!0);P(W,fe,lt,"⋇","\\divideontimes",!0);P(W,fe,lt,"⋉","\\ltimes",!0);P(W,fe,lt,"⋊","\\rtimes",!0);P(W,fe,lt,"⋋","\\leftthreetimes",!0);P(W,fe,lt,"⋌","\\rightthreetimes",!0);P(W,fe,lt,"⋏","\\curlywedge",!0);P(W,fe,lt,"⋎","\\curlyvee",!0);P(W,fe,lt,"⊝","\\circleddash",!0);P(W,fe,lt,"⊛","\\circledast",!0);P(W,fe,lt,"⋅","\\centerdot");P(W,fe,lt,"⊺","\\intercal",!0);P(W,fe,lt,"⋒","\\doublecap");P(W,fe,lt,"⋓","\\doublecup");P(W,fe,lt,"⊠","\\boxtimes",!0);P(W,fe,he,"⇢","\\dashrightarrow",!0);P(W,fe,he,"⇠","\\dashleftarrow",!0);P(W,fe,he,"⇇","\\leftleftarrows",!0);P(W,fe,he,"⇆","\\leftrightarrows",!0);P(W,fe,he,"⇚","\\Lleftarrow",!0);P(W,fe,he,"↞","\\twoheadleftarrow",!0);P(W,fe,he,"↢","\\leftarrowtail",!0);P(W,fe,he,"↫","\\looparrowleft",!0);P(W,fe,he,"⇋","\\leftrightharpoons",!0);P(W,fe,he,"↶","\\curvearrowleft",!0);P(W,fe,he,"↺","\\circlearrowleft",!0);P(W,fe,he,"↰","\\Lsh",!0);P(W,fe,he,"⇈","\\upuparrows",!0);P(W,fe,he,"↿","\\upharpoonleft",!0);P(W,fe,he,"⇃","\\downharpoonleft",!0);P(W,Z,he,"⊶","\\origof",!0);P(W,Z,he,"⊷","\\imageof",!0);P(W,fe,he,"⊸","\\multimap",!0);P(W,fe,he,"↭","\\leftrightsquigarrow",!0);P(W,fe,he,"⇉","\\rightrightarrows",!0);P(W,fe,he,"⇄","\\rightleftarrows",!0);P(W,fe,he,"↠","\\twoheadrightarrow",!0);P(W,fe,he,"↣","\\rightarrowtail",!0);P(W,fe,he,"↬","\\looparrowright",!0);P(W,fe,he,"↷","\\curvearrowright",!0);P(W,fe,he,"↻","\\circlearrowright",!0);P(W,fe,he,"↱","\\Rsh",!0);P(W,fe,he,"⇊","\\downdownarrows",!0);P(W,fe,he,"↾","\\upharpoonright",!0);P(W,fe,he,"⇂","\\downharpoonright",!0);P(W,fe,he,"⇝","\\rightsquigarrow",!0);P(W,fe,he,"⇝","\\leadsto");P(W,fe,he,"⇛","\\Rrightarrow",!0);P(W,fe,he,"↾","\\restriction");P(W,Z,ge,"‘","`");P(W,Z,ge,"$","\\$");P(qe,Z,ge,"$","\\$");P(qe,Z,ge,"$","\\textdollar");P(W,Z,ge,"%","\\%");P(qe,Z,ge,"%","\\%");P(W,Z,ge,"_","\\_");P(qe,Z,ge,"_","\\_");P(qe,Z,ge,"_","\\textunderscore");P(W,Z,ge,"∠","\\angle",!0);P(W,Z,ge,"∞","\\infty",!0);P(W,Z,ge,"′","\\prime");P(W,Z,ge,"△","\\triangle");P(W,Z,ge,"Γ","\\Gamma",!0);P(W,Z,ge,"Δ","\\Delta",!0);P(W,Z,ge,"Θ","\\Theta",!0);P(W,Z,ge,"Λ","\\Lambda",!0);P(W,Z,ge,"Ξ","\\Xi",!0);P(W,Z,ge,"Π","\\Pi",!0);P(W,Z,ge,"Σ","\\Sigma",!0);P(W,Z,ge,"Υ","\\Upsilon",!0);P(W,Z,ge,"Φ","\\Phi",!0);P(W,Z,ge,"Ψ","\\Psi",!0);P(W,Z,ge,"Ω","\\Omega",!0);P(W,Z,ge,"A","Α");P(W,Z,ge,"B","Β");P(W,Z,ge,"E","Ε");P(W,Z,ge,"Z","Ζ");P(W,Z,ge,"H","Η");P(W,Z,ge,"I","Ι");P(W,Z,ge,"K","Κ");P(W,Z,ge,"M","Μ");P(W,Z,ge,"N","Ν");P(W,Z,ge,"O","Ο");P(W,Z,ge,"P","Ρ");P(W,Z,ge,"T","Τ");P(W,Z,ge,"X","Χ");P(W,Z,ge,"¬","\\neg",!0);P(W,Z,ge,"¬","\\lnot");P(W,Z,ge,"⊤","\\top");P(W,Z,ge,"⊥","\\bot");P(W,Z,ge,"∅","\\emptyset");P(W,fe,ge,"∅","\\varnothing");P(W,Z,Ot,"α","\\alpha",!0);P(W,Z,Ot,"β","\\beta",!0);P(W,Z,Ot,"γ","\\gamma",!0);P(W,Z,Ot,"δ","\\delta",!0);P(W,Z,Ot,"ϵ","\\epsilon",!0);P(W,Z,Ot,"ζ","\\zeta",!0);P(W,Z,Ot,"η","\\eta",!0);P(W,Z,Ot,"θ","\\theta",!0);P(W,Z,Ot,"ι","\\iota",!0);P(W,Z,Ot,"κ","\\kappa",!0);P(W,Z,Ot,"λ","\\lambda",!0);P(W,Z,Ot,"μ","\\mu",!0);P(W,Z,Ot,"ν","\\nu",!0);P(W,Z,Ot,"ξ","\\xi",!0);P(W,Z,Ot,"ο","\\omicron",!0);P(W,Z,Ot,"π","\\pi",!0);P(W,Z,Ot,"ρ","\\rho",!0);P(W,Z,Ot,"σ","\\sigma",!0);P(W,Z,Ot,"τ","\\tau",!0);P(W,Z,Ot,"υ","\\upsilon",!0);P(W,Z,Ot,"ϕ","\\phi",!0);P(W,Z,Ot,"χ","\\chi",!0);P(W,Z,Ot,"ψ","\\psi",!0);P(W,Z,Ot,"ω","\\omega",!0);P(W,Z,Ot,"ε","\\varepsilon",!0);P(W,Z,Ot,"ϑ","\\vartheta",!0);P(W,Z,Ot,"ϖ","\\varpi",!0);P(W,Z,Ot,"ϱ","\\varrho",!0);P(W,Z,Ot,"ς","\\varsigma",!0);P(W,Z,Ot,"φ","\\varphi",!0);P(W,Z,lt,"∗","*",!0);P(W,Z,lt,"+","+");P(W,Z,lt,"−","-",!0);P(W,Z,lt,"⋅","\\cdot",!0);P(W,Z,lt,"∘","\\circ",!0);P(W,Z,lt,"÷","\\div",!0);P(W,Z,lt,"±","\\pm",!0);P(W,Z,lt,"×","\\times",!0);P(W,Z,lt,"∩","\\cap",!0);P(W,Z,lt,"∪","\\cup",!0);P(W,Z,lt,"∖","\\setminus",!0);P(W,Z,lt,"∧","\\land");P(W,Z,lt,"∨","\\lor");P(W,Z,lt,"∧","\\wedge",!0);P(W,Z,lt,"∨","\\vee",!0);P(W,Z,ge,"√","\\surd");P(W,Z,Ji,"⟨","\\langle",!0);P(W,Z,Ji,"∣","\\lvert");P(W,Z,Ji,"∥","\\lVert");P(W,Z,ni,"?","?");P(W,Z,ni,"!","!");P(W,Z,ni,"⟩","\\rangle",!0);P(W,Z,ni,"∣","\\rvert");P(W,Z,ni,"∥","\\rVert");P(W,Z,he,"=","=");P(W,Z,he,":",":");P(W,Z,he,"≈","\\approx",!0);P(W,Z,he,"≅","\\cong",!0);P(W,Z,he,"≥","\\ge");P(W,Z,he,"≥","\\geq",!0);P(W,Z,he,"←","\\gets");P(W,Z,he,">","\\gt",!0);P(W,Z,he,"∈","\\in",!0);P(W,Z,he,"","\\@not");P(W,Z,he,"⊂","\\subset",!0);P(W,Z,he,"⊃","\\supset",!0);P(W,Z,he,"⊆","\\subseteq",!0);P(W,Z,he,"⊇","\\supseteq",!0);P(W,fe,he,"⊈","\\nsubseteq",!0);P(W,fe,he,"⊉","\\nsupseteq",!0);P(W,Z,he,"⊨","\\models");P(W,Z,he,"←","\\leftarrow",!0);P(W,Z,he,"≤","\\le");P(W,Z,he,"≤","\\leq",!0);P(W,Z,he,"<","\\lt",!0);P(W,Z,he,"→","\\rightarrow",!0);P(W,Z,he,"→","\\to");P(W,fe,he,"≱","\\ngeq",!0);P(W,fe,he,"≰","\\nleq",!0);P(W,Z,Gl," ","\\ ");P(W,Z,Gl," ","\\space");P(W,Z,Gl," ","\\nobreakspace");P(qe,Z,Gl," ","\\ ");P(qe,Z,Gl," "," ");P(qe,Z,Gl," ","\\space");P(qe,Z,Gl," ","\\nobreakspace");P(W,Z,Gl,"","\\nobreak");P(W,Z,Gl,"","\\allowbreak");P(W,Z,um,",",",");P(W,Z,um,";",";");P(W,fe,lt,"⊼","\\barwedge",!0);P(W,fe,lt,"⊻","\\veebar",!0);P(W,Z,lt,"⊙","\\odot",!0);P(W,Z,lt,"⊕","\\oplus",!0);P(W,Z,lt,"⊗","\\otimes",!0);P(W,Z,ge,"∂","\\partial",!0);P(W,Z,lt,"⊘","\\oslash",!0);P(W,fe,lt,"⊚","\\circledcirc",!0);P(W,fe,lt,"⊡","\\boxdot",!0);P(W,Z,lt,"△","\\bigtriangleup");P(W,Z,lt,"▽","\\bigtriangledown");P(W,Z,lt,"†","\\dagger");P(W,Z,lt,"⋄","\\diamond");P(W,Z,lt,"⋆","\\star");P(W,Z,lt,"◃","\\triangleleft");P(W,Z,lt,"▹","\\triangleright");P(W,Z,Ji,"{","\\{");P(qe,Z,ge,"{","\\{");P(qe,Z,ge,"{","\\textbraceleft");P(W,Z,ni,"}","\\}");P(qe,Z,ge,"}","\\}");P(qe,Z,ge,"}","\\textbraceright");P(W,Z,Ji,"{","\\lbrace");P(W,Z,ni,"}","\\rbrace");P(W,Z,Ji,"[","\\lbrack",!0);P(qe,Z,ge,"[","\\lbrack",!0);P(W,Z,ni,"]","\\rbrack",!0);P(qe,Z,ge,"]","\\rbrack",!0);P(W,Z,Ji,"(","\\lparen",!0);P(W,Z,ni,")","\\rparen",!0);P(qe,Z,ge,"<","\\textless",!0);P(qe,Z,ge,">","\\textgreater",!0);P(W,Z,Ji,"⌊","\\lfloor",!0);P(W,Z,ni,"⌋","\\rfloor",!0);P(W,Z,Ji,"⌈","\\lceil",!0);P(W,Z,ni,"⌉","\\rceil",!0);P(W,Z,ge,"\\","\\backslash");P(W,Z,ge,"∣","|");P(W,Z,ge,"∣","\\vert");P(qe,Z,ge,"|","\\textbar",!0);P(W,Z,ge,"∥","\\|");P(W,Z,ge,"∥","\\Vert");P(qe,Z,ge,"∥","\\textbardbl");P(qe,Z,ge,"~","\\textasciitilde");P(qe,Z,ge,"\\","\\textbackslash");P(qe,Z,ge,"^","\\textasciicircum");P(W,Z,he,"↑","\\uparrow",!0);P(W,Z,he,"⇑","\\Uparrow",!0);P(W,Z,he,"↓","\\downarrow",!0);P(W,Z,he,"⇓","\\Downarrow",!0);P(W,Z,he,"↕","\\updownarrow",!0);P(W,Z,he,"⇕","\\Updownarrow",!0);P(W,Z,ss,"∐","\\coprod");P(W,Z,ss,"⋁","\\bigvee");P(W,Z,ss,"⋀","\\bigwedge");P(W,Z,ss,"⨄","\\biguplus");P(W,Z,ss,"⋂","\\bigcap");P(W,Z,ss,"⋃","\\bigcup");P(W,Z,ss,"∫","\\int");P(W,Z,ss,"∫","\\intop");P(W,Z,ss,"∬","\\iint");P(W,Z,ss,"∭","\\iiint");P(W,Z,ss,"∏","\\prod");P(W,Z,ss,"∑","\\sum");P(W,Z,ss,"⨂","\\bigotimes");P(W,Z,ss,"⨁","\\bigoplus");P(W,Z,ss,"⨀","\\bigodot");P(W,Z,ss,"∮","\\oint");P(W,Z,ss,"∯","\\oiint");P(W,Z,ss,"∰","\\oiiint");P(W,Z,ss,"⨆","\\bigsqcup");P(W,Z,ss,"∫","\\smallint");P(qe,Z,h_,"…","\\textellipsis");P(W,Z,h_,"…","\\mathellipsis");P(qe,Z,h_,"…","\\ldots",!0);P(W,Z,h_,"…","\\ldots",!0);P(W,Z,h_,"⋯","\\@cdots",!0);P(W,Z,h_,"⋱","\\ddots",!0);P(W,Z,ge,"⋮","\\varvdots");P(qe,Z,ge,"⋮","\\varvdots");P(W,Z,xr,"ˊ","\\acute");P(W,Z,xr,"ˋ","\\grave");P(W,Z,xr,"¨","\\ddot");P(W,Z,xr,"~","\\tilde");P(W,Z,xr,"ˉ","\\bar");P(W,Z,xr,"˘","\\breve");P(W,Z,xr,"ˇ","\\check");P(W,Z,xr,"^","\\hat");P(W,Z,xr,"⃗","\\vec");P(W,Z,xr,"˙","\\dot");P(W,Z,xr,"˚","\\mathring");P(W,Z,Ot,"","\\@imath");P(W,Z,Ot,"","\\@jmath");P(W,Z,ge,"ı","ı");P(W,Z,ge,"ȷ","ȷ");P(qe,Z,ge,"ı","\\i",!0);P(qe,Z,ge,"ȷ","\\j",!0);P(qe,Z,ge,"ß","\\ss",!0);P(qe,Z,ge,"æ","\\ae",!0);P(qe,Z,ge,"œ","\\oe",!0);P(qe,Z,ge,"ø","\\o",!0);P(qe,Z,ge,"Æ","\\AE",!0);P(qe,Z,ge,"Œ","\\OE",!0);P(qe,Z,ge,"Ø","\\O",!0);P(qe,Z,xr,"ˊ","\\'");P(qe,Z,xr,"ˋ","\\`");P(qe,Z,xr,"ˆ","\\^");P(qe,Z,xr,"˜","\\~");P(qe,Z,xr,"ˉ","\\=");P(qe,Z,xr,"˘","\\u");P(qe,Z,xr,"˙","\\.");P(qe,Z,xr,"¸","\\c");P(qe,Z,xr,"˚","\\r");P(qe,Z,xr,"ˇ","\\v");P(qe,Z,xr,"¨",'\\"');P(qe,Z,xr,"˝","\\H");P(qe,Z,xr,"◯","\\textcircled");var g$={"--":!0,"---":!0,"``":!0,"''":!0};P(qe,Z,ge,"–","--",!0);P(qe,Z,ge,"–","\\textendash");P(qe,Z,ge,"—","---",!0);P(qe,Z,ge,"—","\\textemdash");P(qe,Z,ge,"‘","`",!0);P(qe,Z,ge,"‘","\\textquoteleft");P(qe,Z,ge,"’","'",!0);P(qe,Z,ge,"’","\\textquoteright");P(qe,Z,ge,"“","``",!0);P(qe,Z,ge,"“","\\textquotedblleft");P(qe,Z,ge,"”","''",!0);P(qe,Z,ge,"”","\\textquotedblright");P(W,Z,ge,"°","\\degree",!0);P(qe,Z,ge,"°","\\degree");P(qe,Z,ge,"°","\\textdegree",!0);P(W,Z,ge,"£","\\pounds");P(W,Z,ge,"£","\\mathsterling",!0);P(qe,Z,ge,"£","\\pounds");P(qe,Z,ge,"£","\\textsterling",!0);P(W,fe,ge,"✠","\\maltese");P(qe,fe,ge,"✠","\\maltese");var cT='0123456789/@."';for(var iw=0;iw{var n=e.charCodeAt(0),t=e.charCodeAt(1),r=(n-55296)*1024+(t-56320)+65536;if(119808<=r&&r<120484){var s=Math.floor((r-119808)/26);return bT[s]}else if(120782<=r&&r<=120831){var i=Math.floor((r-120782)/10);return Y5t[i]}else{if(r===120485||r===120486)return bT[0];if(120486{if(iu(e.classes)!==iu(n.classes)||e.skew!==n.skew||e.maxFontSize!==n.maxFontSize||e.italic!==0&&e.hasClass("mathnormal"))return!1;if(e.classes.length===1){var t=e.classes[0];if(t==="mbin"||t==="mord")return!1}for(var r of Object.keys(e.style))if(e.style[r]!==n.style[r])return!1;for(var s of Object.keys(n.style))if(e.style[s]!==n.style[s])return!1;return!0},v$=e=>{for(var n=0;nt&&(t=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>s&&(s=a.maxFontSize)}n.height=t,n.depth=r,n.maxFontSize=s},We=function(n,t,r,s){var i=new f_(n,t,r,s);return ek(i),i},ou=(e,n,t,r)=>new f_(e,n,t,r),Gh=function(n,t,r){var s=We([n],[],t);return s.height=Math.max(r||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),s.style.borderBottomWidth=et(s.height),s.maxFontSize=1,s},e6t=function(n,t,r,s){var i=new Ib(n,t,r,s);return ek(i),i},Wl=function(n){var t=new d_(n);return ek(t),t},Wh=function(n,t){return n instanceof d_?We([],[n],t):n},t6t=function(n){if(n.positionType==="individualShift"){for(var t=n.children,r=[t[0]],s=-t[0].shift-t[0].elem.depth,i=s,a=1;a{var t=We(["mspace"],[],n),r=Rr(e,n);return t.style.marginRight=et(r),t},Xg=(e,n,t)=>{var r,s;switch(e){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=e}return n==="textbf"&&t==="textit"?s="BoldItalic":n==="textbf"?s="Bold":t==="textit"?s="Italic":s="Regular",r+"-"+s},B3={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},y$={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},x$=function(n,t){var[r,s,i]=y$[n],a=new au(r),o=new Fl([a],{width:et(s),height:et(i),style:"width:"+et(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=ou(["overlay"],[o],t);return l.height=i,l.style.height=et(i),l.style.width=et(s),l},Tr={number:3,unit:"mu"},Ku={number:4,unit:"mu"},bl={number:5,unit:"mu"},n6t={mord:{mop:Tr,mbin:Ku,mrel:bl,minner:Tr},mop:{mord:Tr,mop:Tr,mrel:bl,minner:Tr},mbin:{mord:Ku,mop:Ku,mopen:Ku,minner:Ku},mrel:{mord:bl,mop:bl,mopen:bl,minner:bl},mopen:{},mclose:{mop:Tr,mbin:Ku,mrel:bl,minner:Tr},mpunct:{mord:Tr,mop:Tr,mrel:bl,mopen:Tr,mclose:Tr,mpunct:Tr,minner:Tr},minner:{mord:Tr,mop:Tr,mbin:Ku,mrel:bl,mopen:Tr,mpunct:Tr,minner:Tr}},r6t={mord:{mop:Tr},mop:{mord:Tr,mop:Tr},mbin:{},mrel:{},mopen:{},mclose:{mop:Tr},mpunct:{},minner:{mop:Tr}},w$={},Sv={},kv={};function st(e){for(var{type:n,names:t,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=e,o={type:n,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},l=0;l{var v=S.classes[0],b=x.classes[0];v==="mbin"&&i6t.has(b)?S.classes[0]="mord":b==="mbin"&&s6t.has(v)&&(x.classes[0]="mord")},{node:d},p,m),$3(i,(x,S)=>{var v,b,w=F3(S),y=F3(x),C=w&&y?x.hasClass("mtight")?(v=r6t[w])==null?void 0:v[y]:(b=n6t[w])==null?void 0:b[y]:null;if(C)return b$(C,u)},{node:d},p,m),i},$3=function(n,t,r,s,i){s&&n.push(s);for(var a=0;ap=>{n.splice(d+1,0,p),a++})(a)}s&&n.pop()},S$=function(n){return n instanceof d_||n instanceof Ib||n instanceof f_&&n.hasClass("enclosing")?n:null},P3=function(n,t){var r=S$(n);if(r){var s=r.children;if(s.length){if(t==="right")return P3(s[s.length-1],"right");if(t==="left")return P3(s[0],"left")}}return n},F3=function(n,t){if(!n)return null;t&&(n=P3(n,t));var r=n.classes[0];return o6t[r]||null},gp=function(n,t){var r=["nulldelimiter"].concat(n.baseSizingClasses());return We(t.concat(r))},Bn=function(n,t,r){if(!n)return We();if(Sv[n.type]){var s=Sv[n.type](n,t);if(r&&t.size!==r.size){s=We(t.sizingClasses(r),[s],t);var i=t.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new Qe("Got group of unknown type: '"+n.type+"'")};function Zg(e,n){var t=We(["base"],e,n),r=We(["strut"]);return r.style.height=et(t.height+t.depth),t.depth&&(r.style.verticalAlign=et(-t.depth)),t.children.unshift(r),t}function H3(e,n){var t=null;e.length===1&&e[0].type==="tag"&&(t=e[0].tag,e=e[0].body);var r=ps(e,n,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],a=[],o=0;o0&&(i.push(Zg(a,n)),a=[]),i.push(r[o]));a.length>0&&i.push(Zg(a,n));var u;t?(u=Zg(ps(t,n,!0),n),u.classes=["tag"],i.push(u)):s&&i.push(s);var _=We(["katex-html"],i);if(_.setAttribute("aria-hidden","true"),u){var d=u.children[0];d.style.height=et(_.height+_.depth),_.depth&&(d.style.verticalAlign=et(-_.depth))}return _}function k$(e){return new d_(e)}class Ye{constructor(n,t,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=n,this.attributes={},this.children=t||[],this.classes=r||[]}setAttribute(n,t){this.attributes[n]=t}getAttribute(n){return this.attributes[n]}toNode(){var n=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&n.setAttribute(t,this.attributes[t]);this.classes.length>0&&(n.className=iu(this.classes));for(var r=0;r0&&(n+=' class ="'+Bs(iu(this.classes))+'"'),n+=">";for(var r=0;r",n}toText(){return this.children.map(n=>n.toText()).join("")}}class ts{constructor(n){this.text=void 0,this.text=n}toNode(){return document.createTextNode(this.text)}toMarkup(){return Bs(this.toText())}toText(){return this.text}}class C${constructor(n){this.width=void 0,this.character=void 0,this.width=n,n>=.05555&&n<=.05556?this.character=" ":n>=.1666&&n<=.1667?this.character=" ":n>=.2222&&n<=.2223?this.character=" ":n>=.2777&&n<=.2778?this.character="  ":n>=-.05556&&n<=-.05555?this.character=" ⁣":n>=-.1667&&n<=-.1666?this.character=" ⁣":n>=-.2223&&n<=-.2222?this.character=" ⁣":n>=-.2778&&n<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var n=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return n.setAttribute("width",et(this.width)),n}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var l6t=new Set(["\\imath","\\jmath"]),c6t=new Set(["mrow","mtable"]),ka=function(n,t,r){return br[t][n]&&br[t][n].replace&&n.charCodeAt(0)!==55349&&!(g$.hasOwnProperty(n)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(n=br[t][n].replace),new ts(n)},tk=function(n){return n.length===1?n[0]:new Ye("mrow",n)},u6t={mathit:"italic",boldsymbol:e=>e.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},nk=(e,n)=>{if(e.mode==="text"){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold"}var t=n.font;if(!t||t==="mathnormal")return null;var r=e.mode,s=u6t[t];if(s)return typeof s=="function"?s(e):s;var i=e.text;if(l6t.has(i))return null;if(br[r][i]){var a=br[r][i].replace;a&&(i=a)}var o=B3[t].fontName;return ZS(i,o,r)?B3[t].variant:null};function cw(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var n=e.children[0];return n instanceof ts&&n.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var t=e.children[0];return t instanceof ts&&t.text===","}else return!1}var ea=function(n,t,r){if(n.length===1){var s=or(n[0],t);return r&&s instanceof Ye&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],a,o=0;o=1&&(a.type==="mn"||cw(a))){var u=l.children[0];u instanceof Ye&&u.type==="mn"&&(u.children=[...a.children,...u.children],i.pop())}else if(a.type==="mi"&&a.children.length===1){var _=a.children[0];if(_ instanceof ts&&_.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof ts&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),i.pop())}}}i.push(l),a=l}return i},lu=function(n,t,r){return tk(ea(n,t,r))},or=function(n,t){if(!n)return new Ye("mrow");if(kv[n.type])return kv[n.type](n,t);throw new Qe("Got group of unknown type: '"+n.type+"'")};function yT(e,n,t,r,s){var i=ea(e,t),a;i.length===1&&i[0]instanceof Ye&&c6t.has(i[0].type)?a=i[0]:a=new Ye("mrow",i);var o=new Ye("annotation",[new ts(n)]);o.setAttribute("encoding","application/x-tex");var l=new Ye("semantics",[a,o]),u=new Ye("math",[l]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&u.setAttribute("display","block");var _=s?"katex":"katex-mathml";return We([_],[u])}var d6t=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],xT=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],wT=function(n,t){return t.size<2?n:d6t[n-1][t.size-1]};class kl{constructor(n){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=n.style,this.color=n.color,this.size=n.size||kl.BASESIZE,this.textSize=n.textSize||this.size,this.phantom=!!n.phantom,this.font=n.font||"",this.fontFamily=n.fontFamily||"",this.fontWeight=n.fontWeight||"",this.fontShape=n.fontShape||"",this.sizeMultiplier=xT[this.size-1],this.maxSize=n.maxSize,this.minRuleThickness=n.minRuleThickness,this._fontMetrics=void 0}extend(n){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(t,n),new kl(t)}havingStyle(n){return this.style===n?this:this.extend({style:n,size:wT(this.textSize,n)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(n){return this.size===n&&this.textSize===n?this:this.extend({style:this.style.text(),size:n,textSize:n,sizeMultiplier:xT[n-1]})}havingBaseStyle(n){n=n||this.style.text();var t=wT(kl.BASESIZE,n);return this.size===t&&this.textSize===kl.BASESIZE&&this.style===n?this:this.extend({style:n,size:t})}havingBaseSizing(){var n;switch(this.style.id){case 4:case 5:n=3;break;case 6:case 7:n=1;break;default:n=6}return this.extend({style:this.style.text(),size:n})}withColor(n){return this.extend({color:n})}withPhantom(){return this.extend({phantom:!0})}withFont(n){return this.extend({font:n})}withTextFontFamily(n){return this.extend({fontFamily:n,font:""})}withTextFontWeight(n){return this.extend({fontWeight:n,font:""})}withTextFontShape(n){return this.extend({fontShape:n,font:""})}sizingClasses(n){return n.size!==this.size?["sizing","reset-size"+n.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==kl.BASESIZE?["sizing","reset-size"+this.size,"size"+kl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=K5t(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}kl.BASESIZE=6;var E$=function(n){return new kl({style:n.displayMode?Xt.DISPLAY:Xt.TEXT,maxSize:n.maxSize,minRuleThickness:n.minRuleThickness})},N$=function(n,t){if(t.displayMode){var r=["katex-display"];t.leqno&&r.push("leqno"),t.fleqn&&r.push("fleqn"),n=We(r,[n])}return n},f6t=function(n,t,r){var s=E$(r),i;if(r.output==="mathml")return yT(n,t,s,r.displayMode,!0);if(r.output==="html"){var a=H3(n,s);i=We(["katex"],[a])}else{var o=yT(n,t,s,r.displayMode,!1),l=H3(n,s);i=We(["katex"],[o,l])}return N$(i,r)},h6t=function(n,t,r){var s=E$(r),i=H3(n,s),a=We(["katex"],[i]);return N$(a,r)},_6t={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Pb=function(n){var t=new Ye("mo",[new ts(_6t[n.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},p6t={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},m6t=new Set(["widehat","widecheck","widetilde","utilde"]),Fb=function(n,t){function r(){var o=4e5,l=n.label.slice(1);if(m6t.has(l)&&"base"in n){var u=n.base.type==="ordgroup"?n.base.body.length:1,_,d,p;if(u>5)l==="widehat"||l==="widecheck"?(_=420,o=2364,p=.42,d=l+"4"):(_=312,o=2340,p=.34,d="tilde4");else{var m=[1,1,2,2,3,3][u];l==="widehat"||l==="widecheck"?(o=[0,1062,2364,2364,2364][m],_=[0,239,300,360,420][m],p=[0,.24,.3,.3,.36,.42][m],d=l+m):(o=[0,600,1033,2339,2340][m],_=[0,260,286,306,312][m],p=[0,.26,.286,.3,.306,.34][m],d="tilde"+m)}var x=new au(d),S=new Fl([x],{width:"100%",height:et(p),viewBox:"0 0 "+o+" "+_,preserveAspectRatio:"none"});return{span:ou([],[S],t),minWidth:0,height:p}}else{var v=[],b=p6t[l];if(!b)throw new Error('No SVG data for "'+l+'".');var[w,y,C]=b,E=C/1e3,N=w.length,T,z;if(N===1){if(b.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');T=["hide-tail"],z=[b[3]]}else if(N===2)T=["halfarrow-left","halfarrow-right"],z=["xMinYMin","xMaxYMin"];else if(N===3)T=["brace-left","brace-center","brace-right"],z=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+N+" children.");for(var M=0;M0&&(s.style.minWidth=et(i)),s},g6t=function(n,t,r,s,i){var a,o=n.height+n.depth+r+s;if(/fbox|color|angl/.test(t)){if(a=We(["stretchy",t],[],i),t==="fbox"){var l=i.color&&i.getColor();l&&(a.style.borderColor=l)}}else{var u=[];/^[bx]cancel$/.test(t)&&u.push(new R3({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&u.push(new R3({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var _=new Fl(u,{width:"100%",height:et(o)});a=ou([],[_],i)}return a.height=o,a.style.height=et(o),a},v6t={bin:1,close:1,inner:1,open:1,punct:1,rel:1},b6t={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function y6t(e){return e in v6t}function on(e,n){if(!e||e.type!==n)throw new Error("Expected node of type "+n+", but got "+(e?"node of type "+e.type:String(e)));return e}function Hb(e){var n=qb(e);if(!n)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return n}function qb(e){return e&&(e.type==="atom"||b6t.hasOwnProperty(e.type))?e:null}var z$=e=>{if(e instanceof Qi)return e;if(W5t(e)&&e.children.length===1)return z$(e.children[0])},rk=(e,n)=>{var t,r,s;e&&e.type==="supsub"?(r=on(e.base,"accent"),t=r.base,e.base=t,s=G5t(Bn(e,n)),e.base=r):(r=on(e,"accent"),t=r.base);var i=Bn(t,n.havingCrampedStyle()),a=r.isShifty&&Ul(t),o=0;if(a){var l,u;o=(l=(u=z$(i))==null?void 0:u.skew)!=null?l:0}var _=r.label==="\\c",d=_?i.height+i.depth:Math.min(i.height,n.fontMetrics().xHeight),p;if(r.isStretchy)p=Fb(r,n),p=On({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:p,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+et(2*o)+")",marginLeft:et(2*o)}:void 0}]});else{var m,x;r.label==="\\vec"?(m=x$("vec",n),x=y$.vec[1]):(m=$b({mode:r.mode,text:r.label},n,"textord"),m=U5t(m),m.italic=0,x=m.width,_&&(d+=m.depth)),p=We(["accent-body"],[m]);var S=r.label==="\\textcircled";S&&(p.classes.push("accent-full"),d=i.height);var v=o;S||(v-=x/2),p.style.left=et(v),r.label==="\\textcircled"&&(p.style.top=".2em"),p=On({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-d},{type:"elem",elem:p}]})}var b=We(["mord","accent"],[p],n);return s?(s.children[0]=b,s.height=Math.max(b.height,s.height),s.classes[0]="mord",s):b},j$=(e,n)=>{var t=e.isStretchy?Pb(e.label):new Ye("mo",[ka(e.label,e.mode)]),r=new Ye("mover",[or(e.base,n),t]);return r.setAttribute("accent","true"),r},x6t=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));st({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,n)=>{var t=Cv(n[0]),r=!x6t.test(e.funcName),s=!r||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:s,base:t}},htmlBuilder:rk,mathmlBuilder:j$});st({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,n)=>{var t=n[0],r=e.parser.mode;return r==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:t}},htmlBuilder:rk,mathmlBuilder:j$});st({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=n[0];return{type:"accentUnder",mode:t.mode,label:r,base:s}},htmlBuilder:(e,n)=>{var t=Bn(e.base,n),r=Fb(e,n),s=e.label==="\\utilde"?.12:0,i=On({positionType:"top",positionData:t.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:t}]});return We(["mord","accentunder"],[i],n)},mathmlBuilder:(e,n)=>{var t=Pb(e.label),r=new Ye("munder",[or(e.base,n),t]);return r.setAttribute("accentunder","true"),r}});var Jg=e=>{var n=new Ye("mpadded",e?[e]:[]);return n.setAttribute("width","+0.6em"),n.setAttribute("lspace","0.3em"),n};st({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,n,t){var{parser:r,funcName:s}=e;return{type:"xArrow",mode:r.mode,label:s,body:n[0],below:t[0]}},htmlBuilder(e,n){var t=n.style,r=n.havingStyle(t.sup()),s=Wh(Bn(e.body,r,n),n),i=e.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var a;e.below&&(r=n.havingStyle(t.sub()),a=Wh(Bn(e.below,r,n),n),a.classes.push(i+"-arrow-pad"));var o=Fb(e,n),l=-n.fontMetrics().axisHeight+.5*o.height,u=-n.fontMetrics().axisHeight-.5*o.height-.111;(s.depth>.25||e.label==="\\xleftequilibrium")&&(u-=s.depth);var _;if(a){var d=-n.fontMetrics().axisHeight+a.height+.5*o.height+.111;_=On({positionType:"individualShift",children:[{type:"elem",elem:s,shift:u},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:a,shift:d}]})}else _=On({positionType:"individualShift",children:[{type:"elem",elem:s,shift:u},{type:"elem",elem:o,shift:l,wrapperClasses:["svg-align"]}]});return We(["mrel","x-arrow"],[_],n)},mathmlBuilder(e,n){var t=Pb(e.label);t.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(e.body){var s=Jg(or(e.body,n));if(e.below){var i=Jg(or(e.below,n));r=new Ye("munderover",[t,i,s])}else r=new Ye("mover",[t,s])}else if(e.below){var a=Jg(or(e.below,n));r=new Ye("munder",[t,a])}else r=Jg(),r=new Ye("mover",[t,r]);return r}});function T$(e,n){var t=ps(e.body,n,!0);return We([e.mclass],t,n)}function A$(e,n){var t,r=ea(e.body,n);return e.mclass==="minner"?t=new Ye("mpadded",r):e.mclass==="mord"?e.isCharacterBox?(t=r[0],t.type="mi"):t=new Ye("mi",r):(e.isCharacterBox?(t=r[0],t.type="mo"):t=new Ye("mo",r),e.mclass==="mbin"?(t.attributes.lspace="0.22em",t.attributes.rspace="0.22em"):e.mclass==="mpunct"?(t.attributes.lspace="0em",t.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(t.attributes.lspace="0em",t.attributes.rspace="0em"):e.mclass==="minner"&&(t.attributes.lspace="0.0556em",t.attributes.width="+0.1111em")),t}st({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,n){var{parser:t,funcName:r}=e,s=n[0];return{type:"mclass",mode:t.mode,mclass:"m"+r.slice(5),body:es(s),isCharacterBox:Ul(s)}},htmlBuilder:T$,mathmlBuilder:A$});var Ub=e=>{var n=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return n.type==="atom"&&(n.family==="bin"||n.family==="rel")?"m"+n.family:"mord"};st({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,n){var{parser:t}=e;return{type:"mclass",mode:t.mode,mclass:Ub(n[0]),body:es(n[1]),isCharacterBox:Ul(n[1])}}});st({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,n){var{parser:t,funcName:r}=e,s=n[1],i=n[0],a;r!=="\\stackrel"?a=Ub(s):a="mrel";var o={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:es(s)},l={type:"supsub",mode:i.mode,base:o,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:t.mode,mclass:a,body:[l],isCharacterBox:Ul(l)}},htmlBuilder:T$,mathmlBuilder:A$});st({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,n){var{parser:t}=e;return{type:"pmb",mode:t.mode,mclass:Ub(n[0]),body:es(n[0])}},htmlBuilder(e,n){var t=ps(e.body,n,!0),r=We([e.mclass],t,n);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,n){var t=ea(e.body,n),r=new Ye("mstyle",t);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var w6t={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},ST=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),kT=e=>e.type==="textord"&&e.text==="@",S6t=(e,n)=>(e.type==="mathord"||e.type==="atom")&&e.text===n;function k6t(e,n,t){var r=w6t[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return t.callFunction(r,[n[0]],[n[1]]);case"\\uparrow":case"\\downarrow":{var s=t.callFunction("\\\\cdleft",[n[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},a=t.callFunction("\\Big",[i],[]),o=t.callFunction("\\\\cdright",[n[1]],[]),l={type:"ordgroup",mode:"math",body:[s,a,o]};return t.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return t.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return t.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function C6t(e){var n=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){n.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var t=e.fetch().text;if(t==="&"||t==="\\\\")e.consume();else if(t==="\\end"){n[n.length-1].length===0&&n.pop();break}else throw new Qe("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var r=[],s=[r],i=0;iAV".includes(u))for(var d=0;d<2;d++){for(var p=!0,m=l+1;mAV=|." after @',a[l]);var x=k6t(u,_,e),S={type:"styling",body:[x],mode:"math",style:"display",resetFont:!0};r.push(S),o=ST()}i%2===0?r.push(o):r.shift(),r=[],s.push(r)}e.gullet.endGroup(),e.gullet.endGroup();var v=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:v,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}st({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,n){var{parser:t,funcName:r}=e;return{type:"cdlabel",mode:t.mode,side:r.slice(4),label:n[0]}},htmlBuilder(e,n){var t=n.havingStyle(n.style.sup()),r=Wh(Bn(e.label,t,n),n);return r.classes.push("cd-label-"+e.side),r.style.bottom=et(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,n){var t=new Ye("mrow",[or(e.label,n)]);return t=new Ye("mpadded",[t]),t.setAttribute("width","0"),e.side==="left"&&t.setAttribute("lspace","-1width"),t.setAttribute("voffset","0.7em"),t=new Ye("mstyle",[t]),t.setAttribute("displaystyle","false"),t.setAttribute("scriptlevel","1"),t}});st({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,n){var{parser:t}=e;return{type:"cdlabelparent",mode:t.mode,fragment:n[0]}},htmlBuilder(e,n){var t=Wh(Bn(e.fragment,n),n);return t.classes.push("cd-vert-arrow"),t},mathmlBuilder(e,n){return new Ye("mrow",[or(e.fragment,n)])}});st({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,n){for(var{parser:t}=e,r=on(n[0],"ordgroup"),s=r.body,i="",a=0;a=1114111)throw new Qe("\\@char with invalid code point "+i);return l<=65535?u=String.fromCharCode(l):(l-=65536,u=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:t.mode,text:u}}});var R$=(e,n)=>{var t=ps(e.body,n.withColor(e.color),!1);return Wl(t)},M$=(e,n)=>{var t=ea(e.body,n.withColor(e.color)),r=new Ye("mstyle",t);return r.setAttribute("mathcolor",e.color),r};st({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,n){var{parser:t}=e,r=on(n[0],"color-token").color,s=n[1];return{type:"color",mode:t.mode,color:r,body:es(s)}},htmlBuilder:R$,mathmlBuilder:M$});st({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,n){var{parser:t,breakOnTokenText:r}=e,s=on(n[0],"color-token").color;t.gullet.macros.set("\\current@color",s);var i=t.parseExpression(!0,r);return{type:"color",mode:t.mode,color:s,body:i}},htmlBuilder:R$,mathmlBuilder:M$});st({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,n,t){var{parser:r}=e,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&on(s,"size").value}},htmlBuilder(e,n){var t=We(["mspace"],[],n);return e.newLine&&(t.classes.push("newline"),e.size&&(t.style.marginTop=et(Rr(e.size,n)))),t},mathmlBuilder(e,n){var t=new Ye("mspace");return e.newLine&&(t.setAttribute("linebreak","newline"),e.size&&t.setAttribute("height",et(Rr(e.size,n)))),t}});var q3={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},D$=e=>{var n=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(n))throw new Qe("Expected a control sequence",e);return n},E6t=e=>{var n=e.gullet.popToken();return n.text==="="&&(n=e.gullet.popToken(),n.text===" "&&(n=e.gullet.popToken())),n},L$=(e,n,t,r)=>{var s=e.gullet.macros.get(t.text);s==null&&(t.noexpand=!0,s={tokens:[t],numArgs:0,unexpandable:!e.gullet.isExpandable(t.text)}),e.gullet.macros.set(n,s,r)};st({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:n,funcName:t}=e;n.consumeSpaces();var r=n.fetch();if(q3[r.text])return(t==="\\global"||t==="\\\\globallong")&&(r.text=q3[r.text]),on(n.parseFunction(),"internal");throw new Qe("Invalid token after macro prefix",r)}});st({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:n,funcName:t}=e,r=n.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new Qe("Expected a control sequence",r);for(var i=0,a,o=[[]];n.gullet.future().text!=="{";)if(r=n.gullet.popToken(),r.text==="#"){if(n.gullet.future().text==="{"){a=n.gullet.future(),o[i].push("{");break}if(r=n.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Qe('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new Qe('Argument number "'+r.text+'" out of order');i++,o.push([])}else{if(r.text==="EOF")throw new Qe("Expected a macro definition");o[i].push(r.text)}var{tokens:l}=n.gullet.consumeArg();return a&&l.unshift(a),(t==="\\edef"||t==="\\xdef")&&(l=n.gullet.expandTokens(l),l.reverse()),n.gullet.macros.set(s,{tokens:l,numArgs:i,delimiters:o},t===q3[t]),{type:"internal",mode:n.mode}}});st({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:n,funcName:t}=e,r=D$(n.gullet.popToken());n.gullet.consumeSpaces();var s=E6t(n);return L$(n,r,s,t==="\\\\globallet"),{type:"internal",mode:n.mode}}});st({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:n,funcName:t}=e,r=D$(n.gullet.popToken()),s=n.gullet.popToken(),i=n.gullet.popToken();return L$(n,r,i,t==="\\\\globalfuture"),n.gullet.pushToken(i),n.gullet.pushToken(s),{type:"internal",mode:n.mode}}});var N0=function(n,t,r){var s=br.math[n]&&br.math[n].replace,i=ZS(s||n,t,r);if(!i)throw new Error("Unsupported symbol "+n+" and font size "+t+".");return i},sk=function(n,t,r,s){var i=r.havingBaseStyle(t),a=We(s.concat(i.sizingClasses(r)),[n],r),o=i.sizeMultiplier/r.sizeMultiplier;return a.height*=o,a.depth*=o,a.maxFontSize=i.sizeMultiplier,a},O$=function(n,t,r){var s=t.havingBaseStyle(r),i=(1-t.sizeMultiplier/s.sizeMultiplier)*t.fontMetrics().axisHeight;n.classes.push("delimcenter"),n.style.top=et(i),n.height-=i,n.depth+=i},N6t=function(n,t,r,s,i,a){var o=Xs(n,"Main-Regular",i,s),l=sk(o,t,s,a);return O$(l,s,t),l},z6t=function(n,t,r,s){return Xs(n,"Size"+t+"-Regular",r,s)},I$=function(n,t,r,s,i,a){var o=z6t(n,t,i,s),l=sk(We(["delimsizing","size"+t],[o],s),Xt.TEXT,s,a);return r&&O$(l,s,Xt.TEXT),l},uw=function(n,t,r){var s;t==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=We(["delimsizinginner",s],[We([],[Xs(n,t,r)])]);return{type:"elem",elem:i}},dw=function(n,t,r){var s=To["Size4-Regular"][n.charCodeAt(0)]?To["Size4-Regular"][n.charCodeAt(0)][4]:To["Size1-Regular"][n.charCodeAt(0)][4],i=new au("inner",I5t(n,Math.round(1e3*t))),a=new Fl([i],{width:et(s),height:et(t),style:"width:"+et(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),o=ou([],[a],r);return o.height=t,o.style.height=et(t),o.style.width=et(s),{type:"elem",elem:o}},U3=.008,e1={type:"kern",size:-1*U3},j6t=new Set(["|","\\lvert","\\rvert","\\vert"]),T6t=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),B$=function(n,t,r,s,i,a){var o,l,u,_,d="",p=0;o=u=_=n,l=null;var m="Size1-Regular";n==="\\uparrow"?u=_="⏐":n==="\\Uparrow"?u=_="‖":n==="\\downarrow"?o=u="⏐":n==="\\Downarrow"?o=u="‖":n==="\\updownarrow"?(o="\\uparrow",u="⏐",_="\\downarrow"):n==="\\Updownarrow"?(o="\\Uparrow",u="‖",_="\\Downarrow"):j6t.has(n)?(u="∣",d="vert",p=333):T6t.has(n)?(u="∥",d="doublevert",p=556):n==="["||n==="\\lbrack"?(o="⎡",u="⎢",_="⎣",m="Size4-Regular",d="lbrack",p=667):n==="]"||n==="\\rbrack"?(o="⎤",u="⎥",_="⎦",m="Size4-Regular",d="rbrack",p=667):n==="\\lfloor"||n==="⌊"?(u=o="⎢",_="⎣",m="Size4-Regular",d="lfloor",p=667):n==="\\lceil"||n==="⌈"?(o="⎡",u=_="⎢",m="Size4-Regular",d="lceil",p=667):n==="\\rfloor"||n==="⌋"?(u=o="⎥",_="⎦",m="Size4-Regular",d="rfloor",p=667):n==="\\rceil"||n==="⌉"?(o="⎤",u=_="⎥",m="Size4-Regular",d="rceil",p=667):n==="("||n==="\\lparen"?(o="⎛",u="⎜",_="⎝",m="Size4-Regular",d="lparen",p=875):n===")"||n==="\\rparen"?(o="⎞",u="⎟",_="⎠",m="Size4-Regular",d="rparen",p=875):n==="\\{"||n==="\\lbrace"?(o="⎧",l="⎨",_="⎩",u="⎪",m="Size4-Regular"):n==="\\}"||n==="\\rbrace"?(o="⎫",l="⎬",_="⎭",u="⎪",m="Size4-Regular"):n==="\\lgroup"||n==="⟮"?(o="⎧",_="⎩",u="⎪",m="Size4-Regular"):n==="\\rgroup"||n==="⟯"?(o="⎫",_="⎭",u="⎪",m="Size4-Regular"):n==="\\lmoustache"||n==="⎰"?(o="⎧",_="⎭",u="⎪",m="Size4-Regular"):(n==="\\rmoustache"||n==="⎱")&&(o="⎫",_="⎩",u="⎪",m="Size4-Regular");var x=N0(o,m,i),S=x.height+x.depth,v=N0(u,m,i),b=v.height+v.depth,w=N0(_,m,i),y=w.height+w.depth,C=0,E=1;if(l!==null){var N=N0(l,m,i);C=N.height+N.depth,E=2}var T=S+y+C,z=Math.max(0,Math.ceil((t-T)/(E*b))),M=T+z*E*b,I=s.fontMetrics().axisHeight;r&&(I*=s.sizeMultiplier);var B=M/2-I,$=[];if(d.length>0){var U=M-S-y,H=Math.round(M*1e3),Y=B5t(d,Math.round(U*1e3)),V=new au(d,Y),X=et(p/1e3),ee=et(H/1e3),O=new Fl([V],{width:X,height:ee,viewBox:"0 0 "+p+" "+H}),L=ou([],[O],s);L.height=H/1e3,L.style.width=X,L.style.height=ee,$.push({type:"elem",elem:L})}else{if($.push(uw(_,m,i)),$.push(e1),l===null){var F=M-S-y+2*U3;$.push(dw(u,F,s))}else{var q=(M-S-y-C)/2+2*U3;$.push(dw(u,q,s)),$.push(e1),$.push(uw(l,m,i)),$.push(e1),$.push(dw(u,q,s))}$.push(e1),$.push(uw(o,m,i))}var G=s.havingBaseStyle(Xt.TEXT),re=On({positionType:"bottom",positionData:B,children:$});return sk(We(["delimsizing","mult"],[re],G),Xt.TEXT,s,a)},fw=80,hw=.08,_w=function(n,t,r,s,i){var a=O5t(n,s,r),o=new au(n,a),l=new Fl([o],{width:"400em",height:et(t),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return ou(["hide-tail"],[l],i)},A6t=function(n,t){var r=t.havingBaseSizing(),s=q$("\\surd",n*r.sizeMultiplier,H$,r),i=r.sizeMultiplier,a=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),o,l,u,_,d;return s.type==="small"?(_=1e3+1e3*a+fw,n<1?i=1:n<1.4&&(i=.7),l=(1+a+hw)/i,u=(1+a)/i,o=_w("sqrtMain",l,_,a,t),o.style.minWidth="0.853em",d=.833/i):s.type==="large"?(_=(1e3+fw)*q0[s.size],u=(q0[s.size]+a)/i,l=(q0[s.size]+a+hw)/i,o=_w("sqrtSize"+s.size,l,_,a,t),o.style.minWidth="1.02em",d=1/i):(l=n+a+hw,u=n+a,_=Math.floor(1e3*n+a)+fw,o=_w("sqrtTall",l,_,a,t),o.style.minWidth="0.742em",d=1.056),o.height=u,o.style.height=et(l),{span:o,advanceWidth:d,ruleWidth:(t.fontMetrics().sqrtRuleThickness+a)*i}},$$=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),R6t=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),P$=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),q0=[0,1.2,1.8,2.4,3],F$=function(n,t,r,s,i){if(n==="<"||n==="\\lt"||n==="⟨"?n="\\langle":(n===">"||n==="\\gt"||n==="⟩")&&(n="\\rangle"),$$.has(n)||P$.has(n))return I$(n,t,!1,r,s,i);if(R6t.has(n))return B$(n,q0[t],!1,r,s,i);throw new Qe("Illegal delimiter: '"+n+"'")},M6t=[{type:"small",style:Xt.SCRIPTSCRIPT},{type:"small",style:Xt.SCRIPT},{type:"small",style:Xt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],D6t=[{type:"small",style:Xt.SCRIPTSCRIPT},{type:"small",style:Xt.SCRIPT},{type:"small",style:Xt.TEXT},{type:"stack"}],H$=[{type:"small",style:Xt.SCRIPTSCRIPT},{type:"small",style:Xt.SCRIPT},{type:"small",style:Xt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],L6t=function(n){if(n.type==="small")return"Main-Regular";if(n.type==="large")return"Size"+n.size+"-Regular";if(n.type==="stack")return"Size4-Regular";var t=n.type;throw new Error("Add support for delim type '"+t+"' here.")},q$=function(n,t,r,s){for(var i=Math.min(2,3-s.style.size),a=i;at)return o}return r[r.length-1]},G3=function(n,t,r,s,i,a){n==="<"||n==="\\lt"||n==="⟨"?n="\\langle":(n===">"||n==="\\gt"||n==="⟩")&&(n="\\rangle");var o;P$.has(n)?o=M6t:$$.has(n)?o=H$:o=D6t;var l=q$(n,t,o,s);return l.type==="small"?N6t(n,l.style,r,s,i,a):l.type==="large"?I$(n,l.size,r,s,i,a):B$(n,t,r,s,i,a)},pw=function(n,t,r,s,i,a){var o=s.fontMetrics().axisHeight*s.sizeMultiplier,l=901,u=5/s.fontMetrics().ptPerEm,_=Math.max(t-o,r+o),d=Math.max(_/500*l,2*_-u);return G3(n,d,!0,s,i,a)},CT={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},O6t=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function ET(e){return"isMiddle"in e}function Gb(e,n){var t=qb(e);if(t&&O6t.has(t.text))return t;throw t?new Qe("Invalid delimiter '"+t.text+"' after '"+n.funcName+"'",e):new Qe("Invalid delimiter type '"+e.type+"'",e)}st({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,n)=>{var t=Gb(n[0],e);return{type:"delimsizing",mode:e.parser.mode,size:CT[e.funcName].size,mclass:CT[e.funcName].mclass,delim:t.text}},htmlBuilder:(e,n)=>e.delim==="."?We([e.mclass]):F$(e.delim,e.size,n,e.mode,[e.mclass]),mathmlBuilder:e=>{var n=[];e.delim!=="."&&n.push(ka(e.delim,e.mode));var t=new Ye("mo",n);e.mclass==="mopen"||e.mclass==="mclose"?t.setAttribute("fence","true"):t.setAttribute("fence","false"),t.setAttribute("stretchy","true");var r=et(q0[e.size]);return t.setAttribute("minsize",r),t.setAttribute("maxsize",r),t}});function NT(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}st({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,n)=>{var t=e.parser.gullet.macros.get("\\current@color");if(t&&typeof t!="string")throw new Qe("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Gb(n[0],e).text,color:t}}});st({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,n)=>{var t=Gb(n[0],e),r=e.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=on(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:t.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,n)=>{NT(e);for(var t=ps(e.body,n,!0,["mopen","mclose"]),r=0,s=0,i=!1,a=0;a{NT(e);var t=ea(e.body,n);if(e.left!=="."){var r=new Ye("mo",[ka(e.left,e.mode)]);r.setAttribute("fence","true"),t.unshift(r)}if(e.right!=="."){var s=new Ye("mo",[ka(e.right,e.mode)]);s.setAttribute("fence","true"),e.rightColor&&s.setAttribute("mathcolor",e.rightColor),t.push(s)}return tk(t)}});st({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,n)=>{var t=Gb(n[0],e);if(!e.parser.leftrightDepth)throw new Qe("\\middle without preceding \\left",t);return{type:"middle",mode:e.parser.mode,delim:t.text}},htmlBuilder:(e,n)=>{var t;return e.delim==="."?t=gp(n,[]):(t=F$(e.delim,1,n,e.mode,[]),t.isMiddle={delim:e.delim,options:n}),t},mathmlBuilder:(e,n)=>{var t=e.delim==="\\vert"||e.delim==="|"?ka("|","text"):ka(e.delim,e.mode),r=new Ye("mo",[t]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var Wb=(e,n)=>{var t=Wh(Bn(e.body,n),n),r=e.label.slice(1),s=n.sizeMultiplier,i,a,o=Ul(e.body);if(r==="sout")i=We(["stretchy","sout"]),i.height=n.fontMetrics().defaultRuleThickness/s,a=-.5*n.fontMetrics().xHeight;else if(r==="phase"){var l=Rr({number:.6,unit:"pt"},n),u=Rr({number:.35,unit:"ex"},n),_=n.havingBaseSizing();s=s/_.sizeMultiplier;var d=t.height+t.depth+l+u;t.style.paddingLeft=et(d/2+l);var p=Math.floor(1e3*d*s),m=D5t(p),x=new Fl([new au("phase",m)],{width:"400em",height:et(p/1e3),viewBox:"0 0 400000 "+p,preserveAspectRatio:"xMinYMin slice"});i=ou(["hide-tail"],[x],n),i.style.height=et(d),a=t.depth+l+u}else{/cancel/.test(r)?o||t.classes.push("cancel-pad"):r==="angl"?t.classes.push("anglpad"):t.classes.push("boxpad");var S,v,b=0;/box/.test(r)?(b=Math.max(n.fontMetrics().fboxrule,n.minRuleThickness),S=n.fontMetrics().fboxsep+(r==="colorbox"?0:b),v=S):r==="angl"?(b=Math.max(n.fontMetrics().defaultRuleThickness,n.minRuleThickness),S=4*b,v=Math.max(0,.25-t.depth)):(S=o?.2:0,v=S),i=g6t(t,r,S,v,n),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=et(b)):r==="angl"&&b!==.049&&(i.style.borderTopWidth=et(b),i.style.borderRightWidth=et(b)),a=t.depth+v,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var w;if(e.backgroundColor)w=On({positionType:"individualShift",children:[{type:"elem",elem:i,shift:a},{type:"elem",elem:t,shift:0}]});else{var y=/cancel|phase/.test(r)?["svg-align"]:[];w=On({positionType:"individualShift",children:[{type:"elem",elem:t,shift:0},{type:"elem",elem:i,shift:a,wrapperClasses:y}]})}return/cancel/.test(r)&&(w.height=t.height,w.depth=t.depth),/cancel/.test(r)&&!o?We(["mord","cancel-lap"],[w],n):We(["mord"],[w],n)},Vb=(e,n)=>{var t,r=new Ye(e.label.includes("colorbox")?"mpadded":"menclose",[or(e.body,n)]);switch(e.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(t=n.fontMetrics().fboxsep*n.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*t+"pt"),r.setAttribute("height","+"+2*t+"pt"),r.setAttribute("lspace",t+"pt"),r.setAttribute("voffset",t+"pt"),e.label==="\\fcolorbox"){var s=Math.max(n.fontMetrics().fboxrule,n.minRuleThickness);r.setAttribute("style","border: "+et(s)+" solid "+e.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};st({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,n,t){var{parser:r,funcName:s}=e,i=on(n[0],"color-token").color,a=n[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:a}},htmlBuilder:Wb,mathmlBuilder:Vb});st({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,n,t){var{parser:r,funcName:s}=e,i=on(n[0],"color-token").color,a=on(n[1],"color-token").color,o=n[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:a,borderColor:i,body:o}},htmlBuilder:Wb,mathmlBuilder:Vb});st({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,n){var{parser:t}=e;return{type:"enclose",mode:t.mode,label:"\\fbox",body:n[0]}}});st({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,n){var{parser:t,funcName:r}=e,s=n[0];return{type:"enclose",mode:t.mode,label:r,body:s}},htmlBuilder:Wb,mathmlBuilder:Vb});st({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(e,n){var{parser:t,funcName:r}=e;t.mode==="math"&&t.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var s=n[0];return{type:"enclose",mode:t.mode,label:r,body:s}},htmlBuilder:Wb,mathmlBuilder:Vb});st({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,n){var{parser:t}=e;return{type:"enclose",mode:t.mode,label:"\\angl",body:n[0]}}});var U$={};function Go(e){for(var{type:n,names:t,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=e,o={type:n,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},l=0;l{var n=e.parser.settings;if(!n.displayMode)throw new Qe("{"+e.envName+"} can be used only in display mode.")},I6t=new Set(["gather","gather*"]);function ik(e){if(!e.includes("ed"))return!e.includes("*")}function mu(e,n,t){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:a,colSeparationType:o,autoTag:l,singleRow:u,emptySingleRow:_,maxNumCols:d,leqno:p}=n;if(e.gullet.beginGroup(),u||e.gullet.macros.set("\\cr","\\\\\\relax"),!a){var m=e.gullet.expandMacroAsText("\\arraystretch");if(m==null)a=1;else if(a=parseFloat(m),!a||a<0)throw new Qe("Invalid \\arraystretch: "+m)}e.gullet.beginGroup();var x=[],S=[x],v=[],b=[],w=l!=null?[]:void 0;function y(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function C(){w&&(e.gullet.macros.get("\\df@tag")?(w.push(e.subparse([new Wi("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):w.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(y(),b.push(zT(e));;){var E=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var N={type:"ordgroup",mode:e.mode,body:E};t&&(N={type:"styling",mode:e.mode,style:t,resetFont:!0,body:[N]}),x.push(N);var T=e.fetch().text;if(T==="&"){if(d&&x.length===d){if(u||o)throw new Qe("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(T==="\\end"){C(),x.length===1&&N.type==="styling"&&N.body.length===1&&N.body[0].type==="ordgroup"&&N.body[0].body.length===0&&(S.length>1||!_)&&S.pop(),b.length0&&(y+=.25),u.push({pos:y,isDashed:Ze[ht]})}for(C(a[0]),r=0;r0&&(B+=w,TZe))for(r=0;r=o)){var le=void 0;if(s>0||n.hskipBeforeAndAfter){var ae,de;le=(ae=(de=G)==null?void 0:de.pregap)!=null?ae:p,le!==0&&(Y=We(["arraycolsep"],[]),Y.style.width=et(le),H.push(Y))}var pe=[];for(r=0;r0){for(var $t=Gh("hline",t,_),jt=Gh("hdashline",t,_),ct=[{type:"elem",elem:It,shift:0}];u.length>0;){var ut=u.pop(),Ht=ut.pos-$;ut.isDashed?ct.push({type:"elem",elem:jt,shift:Ht}):ct.push({type:"elem",elem:$t,shift:Ht})}It=On({positionType:"individualShift",children:ct})}if(X.length===0)return We(["mord"],[It],t);var Se=On({positionType:"individualShift",children:X}),Ae=We(["tag"],[Se],t);return Wl([It,Ae])},B6t={c:"center ",l:"left ",r:"right "},Vo=function(n,t){for(var r=[],s=new Ye("mtd",[],["mtr-glue"]),i=new Ye("mtd",[],["mml-eqn-num"]),a=0;a0){var x=n.cols,S="",v=!1,b=0,w=x.length;x[0].type==="separator"&&(p+="top ",b=1),x[x.length-1].type==="separator"&&(p+="bottom ",w-=1);for(var y=b;y0?"left ":"",p+=M[M.length-1].length>0?"right ":"";for(var I=1;I0&&m&&(v=1),r[x]={type:"align",align:S,pregap:v,postgap:0}}return a.colSeparationType=m?"align":"alignat",a};Go({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,n){var t=qb(n[0]),r=t?[n[0]]:on(n[0],"ordgroup").body,s=r.map(function(a){var o=Hb(a),l=o.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new Qe("Unknown column alignment: "+l,a)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return mu(e.parser,i,ak(e.envName))},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var n={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],t="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:t}]};if(e.envName.charAt(e.envName.length-1)==="*"){var s=e.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),t=s.fetch().text,!"lcr".includes(t))throw new Qe("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:t}]}}var i=mu(e.parser,r,ak(e.envName)),a=Math.max(0,...i.body.map(o=>o.length));return i.cols=new Array(a).fill({type:"align",align:t}),n?{type:"leftright",mode:e.mode,body:[i],left:n[0],right:n[1],rightColor:void 0}:i},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var n={arraystretch:.5},t=mu(e.parser,n,"script");return t.colSeparationType="small",t},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["subarray"],props:{numArgs:1},handler(e,n){var t=qb(n[0]),r=t?[n[0]]:on(n[0],"ordgroup").body,s=r.map(function(o){var l=Hb(o),u=l.text;if("lc".includes(u))return{type:"align",align:u};throw new Qe("Unknown column alignment: "+u,o)});if(s.length>1)throw new Qe("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5},a=mu(e.parser,i,"script");if(a.body.length>0&&a.body[0].length>1)throw new Qe("{subarray} can contain only one column");return a},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var n={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},t=mu(e.parser,n,ak(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:W$,htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){I6t.has(e.envName)&&Kb(e);var n={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:ik(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return mu(e.parser,n,"display")},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:W$,htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Kb(e);var n={autoTag:ik(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return mu(e.parser,n,"display")},htmlBuilder:Wo,mathmlBuilder:Vo});Go({type:"array",names:["CD"],props:{numArgs:0},handler(e){return Kb(e),C6t(e.parser)},htmlBuilder:Wo,mathmlBuilder:Vo});ie("\\nonumber","\\gdef\\@eqnsw{0}");ie("\\notag","\\nonumber");st({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,n){throw new Qe(e.funcName+" valid only within array environment")}});var jT=U$;st({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,n){var{parser:t,funcName:r}=e,s=n[0];if(s.type!=="ordgroup")throw new Qe("Invalid environment name",s);for(var i="",a=0;a{var t=e.font,r=n.withFont(t);return Bn(e.body,r)},K$=(e,n)=>{var t=e.font,r=n.withFont(t);return or(e.body,r)},TT={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};st({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=Cv(n[0]),i=r;return i in TT&&(i=TT[i]),{type:"font",mode:t.mode,font:i.slice(1),body:s}},htmlBuilder:V$,mathmlBuilder:K$});st({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,n)=>{var{parser:t}=e,r=n[0];return{type:"mclass",mode:t.mode,mclass:Ub(r),body:[{type:"font",mode:t.mode,font:"boldsymbol",body:r}],isCharacterBox:Ul(r)}}});st({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,n)=>{var{parser:t,funcName:r,breakOnTokenText:s}=e,{mode:i}=t,a=t.parseExpression(!0,s);return{type:"font",mode:i,font:"math"+r.slice(1),body:{type:"ordgroup",mode:t.mode,body:a}}},htmlBuilder:V$,mathmlBuilder:K$});var $6t=(e,n)=>{var t=n.style,r=t.fracNum(),s=t.fracDen(),i;i=n.havingStyle(r);var a=Bn(e.numer,i,n);if(e.continued){var o=8.5/n.fontMetrics().ptPerEm,l=3.5/n.fontMetrics().ptPerEm;a.height=a.height0?x=3*p:x=7*p,S=n.fontMetrics().denom1):(d>0?(m=n.fontMetrics().num2,x=p):(m=n.fontMetrics().num3,x=3*p),S=n.fontMetrics().denom2);var v;if(_){var w=n.fontMetrics().axisHeight;m-a.depth-(w+.5*d){var t=new Ye("mfrac",[or(e.numer,n),or(e.denom,n)]);if(!e.hasBarLine)t.setAttribute("linethickness","0px");else if(e.barSize){var r=Rr(e.barSize,n);t.setAttribute("linethickness",et(r))}if(e.leftDelim!=null||e.rightDelim!=null){var s=[];if(e.leftDelim!=null){var i=new Ye("mo",[new ts(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),s.push(i)}if(s.push(t),e.rightDelim!=null){var a=new Ye("mo",[new ts(e.rightDelim.replace("\\",""))]);a.setAttribute("fence","true"),s.push(a)}return tk(s)}return t},Q$=(e,n)=>{if(!n)return e;var t={type:"styling",mode:e.mode,style:n,body:[e]};return t};st({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=n[0],i=n[1],a,o=null,l=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a=!1,o="(",l=")";break;case"\\\\bracefrac":a=!1,o="\\{",l="\\}";break;case"\\\\brackfrac":a=!1,o="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var u=r==="\\cfrac",_=null;return u||r.startsWith("\\d")?_="display":r.startsWith("\\t")&&(_="text"),Q$({type:"genfrac",mode:t.mode,numer:s,denom:i,continued:u,hasBarLine:a,leftDelim:o,rightDelim:l,barSize:null},_)},htmlBuilder:$6t,mathmlBuilder:P6t});st({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:n,funcName:t,token:r}=e,s;switch(t){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:n.mode,replaceWith:s,token:r}}});var AT=["display","text","script","scriptscript"],RT=function(n){var t=null;return n.length>0&&(t=n,t=t==="."?null:t),t};st({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,n){var{parser:t}=e,r=n[4],s=n[5],i=Cv(n[0]),a=i.type==="atom"&&i.family==="open"?RT(i.text):null,o=Cv(n[1]),l=o.type==="atom"&&o.family==="close"?RT(o.text):null,u=on(n[2],"size"),_,d=null;u.isBlank?_=!0:(d=u.value,_=d.number>0);var p=null,m=n[3];if(m.type==="ordgroup"){if(m.body.length>0){var x=on(m.body[0],"textord");p=AT[Number(x.text)]}}else m=on(m,"textord"),p=AT[Number(m.text)];return Q$({type:"genfrac",mode:t.mode,numer:r,denom:s,continued:!1,hasBarLine:_,barSize:d,leftDelim:a,rightDelim:l},p)}});st({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,n){var{parser:t,funcName:r,token:s}=e;return{type:"infix",mode:t.mode,replaceWith:"\\\\abovefrac",size:on(n[0],"size").value,token:s}}});st({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=n[0],i=on(n[1],"infix").size;if(!i)throw new Error("\\\\abovefrac expected size, but got "+String(i));var a=n[2],o=i.number>0;return{type:"genfrac",mode:t.mode,numer:s,denom:a,continued:!1,hasBarLine:o,barSize:i,leftDelim:null,rightDelim:null}}});var Y$=(e,n)=>{var t=n.style,r,s;e.type==="supsub"?(r=e.sup?Bn(e.sup,n.havingStyle(t.sup()),n):Bn(e.sub,n.havingStyle(t.sub()),n),s=on(e.base,"horizBrace")):s=on(e,"horizBrace");var i=Bn(s.base,n.havingBaseStyle(Xt.DISPLAY)),a=Fb(s,n),o;if(s.isOver?o=On({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:a,wrapperClasses:["svg-align"]}]}):o=On({positionType:"bottom",positionData:i.depth+.1+a.height,children:[{type:"elem",elem:a,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),r){var l=We(["minner",s.isOver?"mover":"munder"],[o],n);s.isOver?o=On({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):o=On({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return We(["minner",s.isOver?"mover":"munder"],[o],n)},F6t=(e,n)=>{var t=Pb(e.label);return new Ye(e.isOver?"mover":"munder",[or(e.base,n),t])};st({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(e,n){var{parser:t,funcName:r}=e;return{type:"horizBrace",mode:t.mode,label:r,isOver:r.includes("\\over"),base:n[0]}},htmlBuilder:Y$,mathmlBuilder:F6t});st({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,n)=>{var{parser:t}=e,r=n[1],s=on(n[0],"url").url;return t.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:t.mode,href:s,body:es(r)}:t.formatUnsupportedCmd("\\href")},htmlBuilder:(e,n)=>{var t=ps(e.body,n,!1);return e6t(e.href,[],t,n)},mathmlBuilder:(e,n)=>{var t=lu(e.body,n);return t instanceof Ye||(t=new Ye("mrow",[t])),t.setAttribute("href",e.href),t}});st({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,n)=>{var{parser:t}=e,r=on(n[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:r}))return t.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:t,funcName:r,token:s}=e,i=on(n[0],"raw").string,a=n[1];t.settings.strict&&t.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,l={};switch(r){case"\\htmlClass":l.class=i,o={command:"\\htmlClass",class:i};break;case"\\htmlId":l.id=i,o={command:"\\htmlId",id:i};break;case"\\htmlStyle":l.style=i,o={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var u=i.split(","),_=0;_{var t=ps(e.body,n,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var s=We(r,t,n);for(var i in e.attributes)i!=="class"&&e.attributes.hasOwnProperty(i)&&s.setAttribute(i,e.attributes[i]);return s},mathmlBuilder:(e,n)=>lu(e.body,n)});st({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(e,n)=>{var{parser:t}=e;return{type:"htmlmathml",mode:t.mode,html:es(n[0]),mathml:es(n[1])}},htmlBuilder:(e,n)=>{var t=ps(e.html,n,!1);return Wl(t)},mathmlBuilder:(e,n)=>lu(e.mathml,n)});var mw=function(n){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(n))return{number:+n,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n);if(!t)throw new Qe("Invalid size: '"+n+"' in \\includegraphics");var r={number:+(t[1]+t[2]),unit:t[3]};if(!h$(r))throw new Qe("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};st({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,n,t)=>{var{parser:r}=e,s={number:0,unit:"em"},i={number:.9,unit:"em"},a={number:0,unit:"em"},o="";if(t[0])for(var l=on(t[0],"raw").string,u=l.split(","),_=0;_{var t=Rr(e.height,n),r=0;e.totalheight.number>0&&(r=Rr(e.totalheight,n)-t);var s=0;e.width.number>0&&(s=Rr(e.width,n));var i={height:et(t+r)};s>0&&(i.width=et(s)),r>0&&(i.verticalAlign=et(-r));var a=new H5t(e.src,e.alt,i);return a.height=t,a.depth=r,a},mathmlBuilder:(e,n)=>{var t=new Ye("mglyph",[]);t.setAttribute("alt",e.alt);var r=Rr(e.height,n),s=0;if(e.totalheight.number>0&&(s=Rr(e.totalheight,n)-r,t.setAttribute("valign",et(-s))),t.setAttribute("height",et(r+s)),e.width.number>0){var i=Rr(e.width,n);t.setAttribute("width",et(i))}return t.setAttribute("src",e.src),t}});st({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,n){var{parser:t,funcName:r}=e,s=on(n[0],"size");if(t.settings.strict){var i=r[1]==="m",a=s.value.unit==="mu";i?(a||t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),t.mode!=="math"&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:t.mode,dimension:s.value}},htmlBuilder(e,n){return b$(e.dimension,n)},mathmlBuilder(e,n){var t=Rr(e.dimension,n);return new C$(t)}});st({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=n[0];return{type:"lap",mode:t.mode,alignment:r.slice(5),body:s}},htmlBuilder:(e,n)=>{var t;e.alignment==="clap"?(t=We([],[Bn(e.body,n)]),t=We(["inner"],[t],n)):t=We(["inner"],[Bn(e.body,n)]);var r=We(["fix"],[]),s=We([e.alignment],[t,r],n),i=We(["strut"]);return i.style.height=et(s.height+s.depth),s.depth&&(i.style.verticalAlign=et(-s.depth)),s.children.unshift(i),s=We(["thinbox"],[s],n),We(["mord","vbox"],[s],n)},mathmlBuilder:(e,n)=>{var t=new Ye("mpadded",[or(e.body,n)]);if(e.alignment!=="rlap"){var r=e.alignment==="llap"?"-1":"-0.5";t.setAttribute("lspace",r+"width")}return t.setAttribute("width","0px"),t}});st({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,n){var{funcName:t,parser:r}=e,s=r.mode;r.switchMode("math");var i=t==="\\("?"\\)":"$",a=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",resetFont:!0,body:a}}});st({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,n){throw new Qe("Mismatched "+e.funcName)}});var MT=(e,n)=>{switch(n.style.size){case Xt.DISPLAY.size:return e.display;case Xt.TEXT.size:return e.text;case Xt.SCRIPT.size:return e.script;case Xt.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};st({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,n)=>{var{parser:t}=e;return{type:"mathchoice",mode:t.mode,display:es(n[0]),text:es(n[1]),script:es(n[2]),scriptscript:es(n[3])}},htmlBuilder:(e,n)=>{var t=MT(e,n),r=ps(t,n,!1);return Wl(r)},mathmlBuilder:(e,n)=>{var t=MT(e,n);return lu(t,n)}});var X$=(e,n,t,r,s,i,a)=>{e=We([],[e]);var o=t&&Ul(t),l,u;if(n){var _=Bn(n,r.havingStyle(s.sup()),r);u={elem:_,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-_.depth)}}if(t){var d=Bn(t,r.havingStyle(s.sub()),r);l={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-d.height)}}var p;if(u&&l){var m=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+a;p=On({positionType:"bottom",positionData:m,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:et(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:et(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var x=e.height-a;p=On({positionType:"top",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:et(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(u){var S=e.depth+a;p=On({positionType:"bottom",positionData:S,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:et(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return e;var v=[p];if(l&&i!==0&&!o){var b=We(["mspace"],[],r);b.style.marginRight=et(i),v.unshift(b)}return We(["mop","op-limits"],v,r)},Z$=new Set(["\\smallint"]),__=(e,n)=>{var t,r,s=!1,i;e.type==="supsub"?(t=e.sup,r=e.sub,i=on(e.base,"op"),s=!0):i=on(e,"op");var a=n.style,o=!1;a.size===Xt.DISPLAY.size&&i.symbol&&!Z$.has(i.name)&&(o=!0);var l,u;if(i.symbol){var _=o?"Size2-Regular":"Size1-Regular",d="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(d=i.name.slice(1),i.name=d==="oiint"?"\\iint":"\\iiint"),l=Xs(i.name,_,"math",n,["mop","op-symbol",o?"large-op":"small-op"]),u=l.italic,d.length>0){var p=x$(d+"Size"+(o?"2":"1"),n);l=On({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:p,shift:o?.08:0}]}),i.name="\\"+d,l.classes.unshift("mop"),l.italic=u}}else if(i.body){var m=ps(i.body,n,!0);m.length===1&&m[0]instanceof Qi?(l=m[0],l.classes[0]="mop"):l=We(["mop"],m,n)}else{for(var x=[],S=1;S{var t;if(e.symbol)t=new Ye("mo",[ka(e.name,e.mode)]),Z$.has(e.name)&&t.setAttribute("largeop","false");else if(e.body)t=new Ye("mo",ea(e.body,n));else{t=new Ye("mi",[new ts(e.name.slice(1))]);var r=new Ye("mo",[ka("⁡","text")]);e.parentIsSupSub?t=new Ye("mrow",[t,r]):t=k$([t,r])}return t},H6t={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};st({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=r;return s.length===1&&(s=H6t[s]),{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:__,mathmlBuilder:dm});st({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,n)=>{var{parser:t}=e,r=n[0];return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:es(r)}},htmlBuilder:__,mathmlBuilder:dm});var q6t={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};st({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:n,funcName:t}=e;return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:__,mathmlBuilder:dm});st({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:n,funcName:t}=e;return{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:__,mathmlBuilder:dm});st({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:n,funcName:t}=e,r=t;return r.length===1&&(r=q6t[r]),{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:__,mathmlBuilder:dm});var J$=(e,n)=>{var t,r,s=!1,i;e.type==="supsub"?(t=e.sup,r=e.sub,i=on(e.base,"operatorname"),s=!0):i=on(e,"operatorname");var a;if(i.body.length>0){for(var o=i.body.map(d=>{var p="text"in d?d.text:void 0;return typeof p=="string"?{type:"textord",mode:d.mode,text:p}:d}),l=ps(o,n.withFont("mathrm"),!0),u=0;u{for(var t=ea(e.body,n.withFont("mathrm")),r=!0,s=0;s_.toText()).join("");t=[new ts(o)]}var l=new Ye("mi",t);l.setAttribute("mathvariant","normal");var u=new Ye("mo",[ka("⁡","text")]);return e.parentIsSupSub?new Ye("mrow",[l,u]):k$([l,u])};st({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,n)=>{var{parser:t,funcName:r}=e,s=n[0];return{type:"operatorname",mode:t.mode,body:es(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:J$,mathmlBuilder:U6t});ie("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Zd({type:"ordgroup",htmlBuilder(e,n){return e.semisimple?Wl(ps(e.body,n,!1)):We(["mord"],ps(e.body,n,!0),n)},mathmlBuilder(e,n){return lu(e.body,n,!0)}});st({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,n){var{parser:t}=e,r=n[0];return{type:"overline",mode:t.mode,body:r}},htmlBuilder(e,n){var t=Bn(e.body,n.havingCrampedStyle()),r=Gh("overline-line",n),s=n.fontMetrics().defaultRuleThickness,i=On({positionType:"firstBaseline",children:[{type:"elem",elem:t},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]});return We(["mord","overline"],[i],n)},mathmlBuilder(e,n){var t=new Ye("mo",[new ts("‾")]);t.setAttribute("stretchy","true");var r=new Ye("mover",[or(e.body,n),t]);return r.setAttribute("accent","true"),r}});st({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,n)=>{var{parser:t}=e,r=n[0];return{type:"phantom",mode:t.mode,body:es(r)}},htmlBuilder:(e,n)=>{var t=ps(e.body,n.withPhantom(),!1);return Wl(t)},mathmlBuilder:(e,n)=>{var t=ea(e.body,n);return new Ye("mphantom",t)}});ie("\\hphantom","\\smash{\\phantom{#1}}");st({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,n)=>{var{parser:t}=e,r=n[0];return{type:"vphantom",mode:t.mode,body:r}},htmlBuilder:(e,n)=>{var t=We(["inner"],[Bn(e.body,n.withPhantom())]),r=We(["fix"],[]);return We(["mord","rlap"],[t,r],n)},mathmlBuilder:(e,n)=>{var t=ea(es(e.body),n),r=new Ye("mphantom",t),s=new Ye("mpadded",[r]);return s.setAttribute("width","0px"),s}});st({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,n){var{parser:t}=e,r=on(n[0],"size").value,s=n[1];return{type:"raisebox",mode:t.mode,dy:r,body:s}},htmlBuilder(e,n){var t=Bn(e.body,n),r=Rr(e.dy,n);return On({positionType:"shift",positionData:-r,children:[{type:"elem",elem:t}]})},mathmlBuilder(e,n){var t=new Ye("mpadded",[or(e.body,n)]),r=e.dy.number+e.dy.unit;return t.setAttribute("voffset",r),t}});st({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:n}=e;return{type:"internal",mode:n.mode}}});st({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,n,t){var{parser:r}=e,s=t[0],i=on(n[0],"size"),a=on(n[1],"size");return{type:"rule",mode:r.mode,shift:s&&on(s,"size").value,width:i.value,height:a.value}},htmlBuilder(e,n){var t=We(["mord","rule"],[],n),r=Rr(e.width,n),s=Rr(e.height,n),i=e.shift?Rr(e.shift,n):0;return t.style.borderRightWidth=et(r),t.style.borderTopWidth=et(s),t.style.bottom=et(i),t.width=r,t.height=s+i,t.depth=-i,t.maxFontSize=s*1.125*n.sizeMultiplier,t},mathmlBuilder(e,n){var t=Rr(e.width,n),r=Rr(e.height,n),s=e.shift?Rr(e.shift,n):0,i=n.color&&n.getColor()||"black",a=new Ye("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",et(t)),a.setAttribute("height",et(r));var o=new Ye("mpadded",[a]);return s>=0?o.setAttribute("height",et(s)):(o.setAttribute("height",et(s)),o.setAttribute("depth",et(-s))),o.setAttribute("voffset",et(s)),o}});function eP(e,n,t){for(var r=ps(e,n,!1),s=n.sizeMultiplier/t.sizeMultiplier,i=0;i{var t=n.havingSize(e.size);return eP(e.body,t,n)};st({type:"sizing",names:DT,props:{numArgs:0,allowedInText:!0},handler:(e,n)=>{var{breakOnTokenText:t,funcName:r,parser:s}=e,i=s.parseExpression(!1,t);return{type:"sizing",mode:s.mode,size:DT.indexOf(r)+1,body:i}},htmlBuilder:G6t,mathmlBuilder:(e,n)=>{var t=n.havingSize(e.size),r=ea(e.body,t),s=new Ye("mstyle",r);return s.setAttribute("mathsize",et(t.sizeMultiplier)),s}});st({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,n,t)=>{var{parser:r}=e,s=!1,i=!1,a=t[0]&&on(t[0],"ordgroup");if(a)for(var o,l=0;l{var t=We([],[Bn(e.body,n)]);if(!e.smashHeight&&!e.smashDepth)return t;if(e.smashHeight&&(t.height=0),e.smashDepth&&(t.depth=0),e.smashHeight&&e.smashDepth)return We(["mord","smash"],[t],n);if(t.children)for(var r=0;r{var t=new Ye("mpadded",[or(e.body,n)]);return e.smashHeight&&t.setAttribute("height","0px"),e.smashDepth&&t.setAttribute("depth","0px"),t}});st({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,n,t){var{parser:r}=e,s=t[0],i=n[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(e,n){var t=Bn(e.body,n.havingCrampedStyle());t.height===0&&(t.height=n.fontMetrics().xHeight),t=Wh(t,n);var r=n.fontMetrics(),s=r.defaultRuleThickness,i=s;n.style.idt.height+t.depth+a&&(a=(a+d-t.height-t.depth)/2);var p=l.height-t.height-a-u;t.style.paddingLeft=et(_);var m=On({positionType:"firstBaseline",children:[{type:"elem",elem:t,wrapperClasses:["svg-align"]},{type:"kern",size:-(t.height+p)},{type:"elem",elem:l},{type:"kern",size:u}]});if(e.index){var x=n.havingStyle(Xt.SCRIPTSCRIPT),S=Bn(e.index,x,n),v=.6*(m.height-m.depth),b=On({positionType:"shift",positionData:-v,children:[{type:"elem",elem:S}]}),w=We(["root"],[b]);return We(["mord","sqrt"],[w,m],n)}else return We(["mord","sqrt"],[m],n)},mathmlBuilder(e,n){var{body:t,index:r}=e;return r?new Ye("mroot",[or(t,n),or(r,n)]):new Ye("msqrt",[or(t,n)])}});var W3={display:Xt.DISPLAY,text:Xt.TEXT,script:Xt.SCRIPT,scriptscript:Xt.SCRIPTSCRIPT};function W6t(e){return e in W3}st({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,n){var{breakOnTokenText:t,funcName:r,parser:s}=e,i=s.parseExpression(!0,t),a=r.slice(1,r.length-5);if(!W6t(a))throw new Error("Unknown style: "+a);return{type:"styling",mode:s.mode,style:a,body:i}},htmlBuilder(e,n){var t=W3[e.style],r=n.havingStyle(t);return e.resetFont&&(r=r.withFont("")),eP(e.body,r,n)},mathmlBuilder(e,n){var t=W3[e.style],r=n.havingStyle(t);e.resetFont&&(r=r.withFont(""));var s=ea(e.body,r),i=new Ye("mstyle",s),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=a[e.style];return i.setAttribute("scriptlevel",o[0]),i.setAttribute("displaystyle",o[1]),i}});var V6t=function(n,t){var r=n.base;if(r)if(r.type==="op"){var s=r.limits&&(t.style.size===Xt.DISPLAY.size||r.alwaysHandleSupSub);return s?__:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(t.style.size===Xt.DISPLAY.size||r.limits);return i?J$:null}else{if(r.type==="accent")return Ul(r.base)?rk:null;if(r.type==="horizBrace"){var a=!n.sub;return a===r.isOver?Y$:null}else return null}else return null};Zd({type:"supsub",htmlBuilder(e,n){var t=V6t(e,n);if(t)return t(e,n);var{base:r,sup:s,sub:i}=e,a=Bn(r,n),o,l,u=n.fontMetrics(),_=0,d=0,p=r&&Ul(r);if(s){var m=n.havingStyle(n.style.sup());o=Bn(s,m,n),p||(_=a.height-m.fontMetrics().supDrop*m.sizeMultiplier/n.sizeMultiplier)}if(i){var x=n.havingStyle(n.style.sub());l=Bn(i,x,n),p||(d=a.depth+x.fontMetrics().subDrop*x.sizeMultiplier/n.sizeMultiplier)}var S;n.style===Xt.DISPLAY?S=u.sup1:n.style.cramped?S=u.sup3:S=u.sup2;var v=n.sizeMultiplier,b=et(.5/u.ptPerEm/v),w=null;if(l){var y=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(a instanceof Qi||y){var C;w=et(-((C=a.italic)!=null?C:0))}}var E;if(o&&l){_=Math.max(_,S,o.depth+.25*u.xHeight),d=Math.max(d,u.sub2);var N=u.defaultRuleThickness,T=4*N;if(_-o.depth-(l.height-d)0&&(_+=z,d-=z)}var M=[{type:"elem",elem:l,shift:d,marginRight:b,marginLeft:w},{type:"elem",elem:o,shift:-_,marginRight:b}];E=On({positionType:"individualShift",children:M})}else if(l){d=Math.max(d,u.sub1,l.height-.8*u.xHeight);var I=[{type:"elem",elem:l,marginLeft:w,marginRight:b}];E=On({positionType:"shift",positionData:d,children:I})}else if(o)_=Math.max(_,S,o.depth+.25*u.xHeight),E=On({positionType:"shift",positionData:-_,children:[{type:"elem",elem:o,marginRight:b}]});else throw new Error("supsub must have either sup or sub.");var B=F3(a,"right")||"mord";return We([B],[a,We(["msupsub"],[E])],n)},mathmlBuilder(e,n){var t=!1,r,s;e.base&&e.base.type==="horizBrace"&&(s=!!e.sup,s===e.base.isOver&&(t=!0,r=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var i=[or(e.base,n)];e.sub&&i.push(or(e.sub,n)),e.sup&&i.push(or(e.sup,n));var a;if(t)a=r?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&n.style===Xt.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(n.style===Xt.DISPLAY||u.limits)?a="munderover":a="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(n.style===Xt.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||n.style===Xt.DISPLAY)?a="munder":a="msub"}else{var o=e.base;o&&o.type==="op"&&o.limits&&(n.style===Xt.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||n.style===Xt.DISPLAY)?a="mover":a="msup"}return new Ye(a,i)}});Zd({type:"atom",htmlBuilder(e,n){return JS(e.text,e.mode,n,["m"+e.family])},mathmlBuilder(e,n){var t=new Ye("mo",[ka(e.text,e.mode)]);if(e.family==="bin"){var r=nk(e,n);r==="bold-italic"&&t.setAttribute("mathvariant",r)}else e.family==="punct"?t.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&t.setAttribute("stretchy","false");return t}});var tP={mi:"italic",mn:"normal",mtext:"normal"};Zd({type:"mathord",htmlBuilder(e,n){return $b(e,n,"mathord")},mathmlBuilder(e,n){var t=new Ye("mi",[ka(e.text,e.mode,n)]),r=nk(e,n)||"italic";return r!==tP[t.type]&&t.setAttribute("mathvariant",r),t}});Zd({type:"textord",htmlBuilder(e,n){return $b(e,n,"textord")},mathmlBuilder(e,n){var t=ka(e.text,e.mode,n),r=nk(e,n)||"normal",s;return e.mode==="text"?s=new Ye("mtext",[t]):/[0-9]/.test(e.text)?s=new Ye("mn",[t]):e.text==="\\prime"?s=new Ye("mo",[t]):s=new Ye("mi",[t]),r!==tP[s.type]&&s.setAttribute("mathvariant",r),s}});var gw={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},vw={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Zd({type:"spacing",htmlBuilder(e,n){if(vw.hasOwnProperty(e.text)){var t=vw[e.text].className||"";if(e.mode==="text"){var r=$b(e,n,"textord");return r.classes.push(t),r}else return We(["mspace",t],[JS(e.text,e.mode,n)],n)}else{if(gw.hasOwnProperty(e.text))return We(["mspace",gw[e.text]],[],n);throw new Qe('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,n){var t;if(vw.hasOwnProperty(e.text))t=new Ye("mtext",[new ts(" ")]);else{if(gw.hasOwnProperty(e.text))return new Ye("mspace");throw new Qe('Unknown type of space "'+e.text+'"')}return t}});var LT=()=>{var e=new Ye("mtd",[]);return e.setAttribute("width","50%"),e};Zd({type:"tag",mathmlBuilder(e,n){var t=new Ye("mtable",[new Ye("mtr",[LT(),new Ye("mtd",[lu(e.body,n)]),LT(),new Ye("mtd",[lu(e.tag,n)])])]);return t.setAttribute("width","100%"),t}});var OT={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},IT={"\\textbf":"textbf","\\textmd":"textmd"},K6t={"\\textit":"textit","\\textup":"textup"},BT=(e,n)=>{var t=e.font;if(t){if(OT[t])return n.withTextFontFamily(OT[t]);if(IT[t])return n.withTextFontWeight(IT[t]);if(t==="\\emph")return n.fontShape==="textit"?n.withTextFontShape("textup"):n.withTextFontShape("textit")}else return n;return n.withTextFontShape(K6t[t])};st({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,n){var{parser:t,funcName:r}=e,s=n[0];return{type:"text",mode:t.mode,body:es(s),font:r}},htmlBuilder(e,n){var t=BT(e,n),r=ps(e.body,t,!0);return We(["mord","text"],r,t)},mathmlBuilder(e,n){var t=BT(e,n);return lu(e.body,t)}});st({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,n){var{parser:t}=e;return{type:"underline",mode:t.mode,body:n[0]}},htmlBuilder(e,n){var t=Bn(e.body,n),r=Gh("underline-line",n),s=n.fontMetrics().defaultRuleThickness,i=On({positionType:"top",positionData:t.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:t}]});return We(["mord","underline"],[i],n)},mathmlBuilder(e,n){var t=new Ye("mo",[new ts("‾")]);t.setAttribute("stretchy","true");var r=new Ye("munder",[or(e.body,n),t]);return r.setAttribute("accentunder","true"),r}});st({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,n){var{parser:t}=e;return{type:"vcenter",mode:t.mode,body:n[0]}},htmlBuilder(e,n){var t=Bn(e.body,n),r=n.fontMetrics().axisHeight,s=.5*(t.height-r-(t.depth+r));return On({positionType:"shift",positionData:s,children:[{type:"elem",elem:t}]})},mathmlBuilder(e,n){var t=new Ye("mpadded",[or(e.body,n)],["vcenter"]);return new Ye("mrow",[t])}});st({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,n,t){throw new Qe("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,n){for(var t=$T(e),r=[],s=n.havingStyle(n.style.text()),i=0;ie.body.replace(/ /g,e.star?"␣":" "),Yc=w$,nP=`[ \r ]`,Q6t="\\\\[a-zA-Z@]+",Y6t="\\\\[^\uD800-\uDFFF]",X6t="("+Q6t+")"+nP+"*",Z6t=`\\\\( |[ \r ]+ -?)[ \r ]*`,V3="[̀-ͯ]",J6t=new RegExp(V3+"+$"),eSt="("+nP+"+)|"+(Z6t+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(V3+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(V3+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+X6t)+("|"+Y6t+")");class PT{constructor(n,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=n,this.settings=t,this.tokenRegex=new RegExp(eSt,"g"),this.catcodes={"%":14,"~":13}}setCatcode(n,t){this.catcodes[n]=t}lex(){var n=this.input,t=this.tokenRegex.lastIndex;if(t===n.length)return new Qi("EOF",new Si(this,t,t));var r=this.tokenRegex.exec(n);if(r===null||r.index!==t)throw new Ye("Unexpected character: '"+n[t]+"'",new Qi(n[t],new Si(this,t,t+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=n.indexOf(` -`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=n.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new Qi(s,new Si(this,t,this.tokenRegex.lastIndex))}}class tSt{constructor(n,t){n===void 0&&(n={}),t===void 0&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=n,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Ye("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var n=this.undefStack.pop();for(var t in n)n.hasOwnProperty(t)&&(n[t]==null?delete this.current[t]:this.current[t]=n[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(n){return this.current.hasOwnProperty(n)||this.builtins.hasOwnProperty(n)}get(n){return this.current.hasOwnProperty(n)?this.current[n]:this.builtins[n]}set(n,t,r){if(r===void 0&&(r=!1),r){for(var s=0;s0&&(this.undefStack[this.undefStack.length-1][n]=t)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(n)&&(i[n]=this.current[n])}t==null?delete this.current[n]:this.current[n]=t}}var nSt=G$;ie("\\noexpand",function(e){var n=e.popToken();return e.isExpandable(n.text)&&(n.noexpand=!0,n.treatAsRelax=!0),{tokens:[n],numArgs:0}});ie("\\expandafter",function(e){var n=e.popToken();return e.expandOnce(!0),{tokens:[n],numArgs:0}});ie("\\@firstoftwo",function(e){var n=e.consumeArgs(2);return{tokens:n[0],numArgs:0}});ie("\\@secondoftwo",function(e){var n=e.consumeArgs(2);return{tokens:n[1],numArgs:0}});ie("\\@ifnextchar",function(e){var n=e.consumeArgs(3);e.consumeSpaces();var t=e.future();return n[0].length===1&&n[0][0].text===t.text?{tokens:n[1],numArgs:0}:{tokens:n[2],numArgs:0}});ie("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");ie("\\TextOrMath",function(e){var n=e.consumeArgs(2);return e.mode==="text"?{tokens:n[0],numArgs:0}:{tokens:n[1],numArgs:0}});var FT={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};ie("\\char",function(e){var n=e.popToken(),t,r=0;if(n.text==="'")t=8,n=e.popToken();else if(n.text==='"')t=16,n=e.popToken();else if(n.text==="`")if(n=e.popToken(),n.text[0]==="\\")r=n.text.charCodeAt(1);else{if(n.text==="EOF")throw new Ye("\\char` missing argument");r=n.text.charCodeAt(0)}else t=10;if(t){if(r=FT[n.text],r==null||r>=t)throw new Ye("Invalid base-"+t+" digit "+n.text);for(var s;(s=FT[e.future().text])!=null&&s{var s=e.consumeArg().tokens;if(s.length!==1)throw new Ye("\\newcommand's first argument must be a macro name");var i=s[0].text,a=e.isDefined(i);if(a&&!n)throw new Ye("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!a&&!t)throw new Ye("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var o=0;if(s=e.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var l="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)l+=u.text,u=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new Ye("Invalid number of arguments: "+l);o=parseInt(l),s=e.consumeArg().tokens}return a&&r||e.macros.set(i,{tokens:s,numArgs:o}),""};ie("\\newcommand",e=>ok(e,!1,!0,!1));ie("\\renewcommand",e=>ok(e,!0,!1,!1));ie("\\providecommand",e=>ok(e,!0,!0,!0));ie("\\message",e=>{var n=e.consumeArgs(1)[0];return console.log(n.reverse().map(t=>t.text).join("")),""});ie("\\errmessage",e=>{var n=e.consumeArgs(1)[0];return console.error(n.reverse().map(t=>t.text).join("")),""});ie("\\show",e=>{var n=e.popToken(),t=n.text;return console.log(n,e.macros.get(t),iu[t],Sr.math[t],Sr.text[t]),""});ie("\\bgroup","{");ie("\\egroup","}");ie("~","\\nobreakspace");ie("\\lq","`");ie("\\rq","'");ie("\\aa","\\r a");ie("\\AA","\\r A");ie("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");ie("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");ie("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");ie("ℬ","\\mathscr{B}");ie("ℰ","\\mathscr{E}");ie("ℱ","\\mathscr{F}");ie("ℋ","\\mathscr{H}");ie("ℐ","\\mathscr{I}");ie("ℒ","\\mathscr{L}");ie("ℳ","\\mathscr{M}");ie("ℛ","\\mathscr{R}");ie("ℭ","\\mathfrak{C}");ie("ℌ","\\mathfrak{H}");ie("ℨ","\\mathfrak{Z}");ie("\\Bbbk","\\Bbb{k}");ie("\\llap","\\mathllap{\\textrm{#1}}");ie("\\rlap","\\mathrlap{\\textrm{#1}}");ie("\\clap","\\mathclap{\\textrm{#1}}");ie("\\mathstrut","\\vphantom{(}");ie("\\underbar","\\underline{\\text{#1}}");ie("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');ie("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");ie("\\ne","\\neq");ie("≠","\\neq");ie("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");ie("∉","\\notin");ie("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");ie("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");ie("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");ie("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");ie("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");ie("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");ie("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");ie("⟂","\\perp");ie("‼","\\mathclose{!\\mkern-0.8mu!}");ie("∌","\\notni");ie("⌜","\\ulcorner");ie("⌝","\\urcorner");ie("⌞","\\llcorner");ie("⌟","\\lrcorner");ie("©","\\copyright");ie("®","\\textregistered");ie("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');ie("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');ie("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');ie("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');ie("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");ie("⋮","\\vdots");ie("\\varGamma","\\mathit{\\Gamma}");ie("\\varDelta","\\mathit{\\Delta}");ie("\\varTheta","\\mathit{\\Theta}");ie("\\varLambda","\\mathit{\\Lambda}");ie("\\varXi","\\mathit{\\Xi}");ie("\\varPi","\\mathit{\\Pi}");ie("\\varSigma","\\mathit{\\Sigma}");ie("\\varUpsilon","\\mathit{\\Upsilon}");ie("\\varPhi","\\mathit{\\Phi}");ie("\\varPsi","\\mathit{\\Psi}");ie("\\varOmega","\\mathit{\\Omega}");ie("\\substack","\\begin{subarray}{c}#1\\end{subarray}");ie("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");ie("\\boxed","\\fbox{$\\displaystyle{#1}$}");ie("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");ie("\\implies","\\DOTSB\\;\\Longrightarrow\\;");ie("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");ie("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");ie("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var HT={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},rSt=new Set(["bin","rel"]);ie("\\dots",function(e){var n="\\dotso",t=e.expandAfterFuture().text;return t in HT?n=HT[t]:(t.slice(0,4)==="\\not"||t in Sr.math&&rSt.has(Sr.math[t].group))&&(n="\\dotsb"),n});var lk={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};ie("\\dotso",function(e){var n=e.future().text;return n in lk?"\\ldots\\,":"\\ldots"});ie("\\dotsc",function(e){var n=e.future().text;return n in lk&&n!==","?"\\ldots\\,":"\\ldots"});ie("\\cdots",function(e){var n=e.future().text;return n in lk?"\\@cdots\\,":"\\@cdots"});ie("\\dotsb","\\cdots");ie("\\dotsm","\\cdots");ie("\\dotsi","\\!\\cdots");ie("\\dotsx","\\ldots\\,");ie("\\DOTSI","\\relax");ie("\\DOTSB","\\relax");ie("\\DOTSX","\\relax");ie("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");ie("\\,","\\tmspace+{3mu}{.1667em}");ie("\\thinspace","\\,");ie("\\>","\\mskip{4mu}");ie("\\:","\\tmspace+{4mu}{.2222em}");ie("\\medspace","\\:");ie("\\;","\\tmspace+{5mu}{.2777em}");ie("\\thickspace","\\;");ie("\\!","\\tmspace-{3mu}{.1667em}");ie("\\negthinspace","\\!");ie("\\negmedspace","\\tmspace-{4mu}{.2222em}");ie("\\negthickspace","\\tmspace-{5mu}{.277em}");ie("\\enspace","\\kern.5em ");ie("\\enskip","\\hskip.5em\\relax");ie("\\quad","\\hskip1em\\relax");ie("\\qquad","\\hskip2em\\relax");ie("\\tag","\\@ifstar\\tag@literal\\tag@paren");ie("\\tag@paren","\\tag@literal{({#1})}");ie("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Ye("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});ie("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");ie("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");ie("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");ie("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");ie("\\newline","\\\\\\relax");ie("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var rP=et(To["Main-Regular"][84][1]-.7*To["Main-Regular"][65][1]);ie("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+rP+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");ie("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+rP+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");ie("\\hspace","\\@ifstar\\@hspacer\\@hspace");ie("\\@hspace","\\hskip #1\\relax");ie("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");ie("\\ordinarycolon",":");ie("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");ie("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');ie("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');ie("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');ie("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');ie("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');ie("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');ie("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');ie("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');ie("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');ie("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');ie("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');ie("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');ie("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');ie("∷","\\dblcolon");ie("∹","\\eqcolon");ie("≔","\\coloneqq");ie("≕","\\eqqcolon");ie("⩴","\\Coloneqq");ie("\\ratio","\\vcentcolon");ie("\\coloncolon","\\dblcolon");ie("\\colonequals","\\coloneqq");ie("\\coloncolonequals","\\Coloneqq");ie("\\equalscolon","\\eqqcolon");ie("\\equalscoloncolon","\\Eqqcolon");ie("\\colonminus","\\coloneq");ie("\\coloncolonminus","\\Coloneq");ie("\\minuscolon","\\eqcolon");ie("\\minuscoloncolon","\\Eqcolon");ie("\\coloncolonapprox","\\Colonapprox");ie("\\coloncolonsim","\\Colonsim");ie("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");ie("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");ie("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");ie("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");ie("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");ie("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");ie("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");ie("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");ie("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");ie("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");ie("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");ie("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");ie("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");ie("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");ie("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");ie("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");ie("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");ie("\\nleqq","\\html@mathml{\\@nleqq}{≰}");ie("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");ie("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");ie("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");ie("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");ie("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");ie("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");ie("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");ie("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");ie("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");ie("\\imath","\\html@mathml{\\@imath}{ı}");ie("\\jmath","\\html@mathml{\\@jmath}{ȷ}");ie("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");ie("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");ie("⟦","\\llbracket");ie("⟧","\\rrbracket");ie("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");ie("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");ie("⦃","\\lBrace");ie("⦄","\\rBrace");ie("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");ie("⦵","\\minuso");ie("\\darr","\\downarrow");ie("\\dArr","\\Downarrow");ie("\\Darr","\\Downarrow");ie("\\lang","\\langle");ie("\\rang","\\rangle");ie("\\uarr","\\uparrow");ie("\\uArr","\\Uparrow");ie("\\Uarr","\\Uparrow");ie("\\N","\\mathbb{N}");ie("\\R","\\mathbb{R}");ie("\\Z","\\mathbb{Z}");ie("\\alef","\\aleph");ie("\\alefsym","\\aleph");ie("\\Alpha","\\mathrm{A}");ie("\\Beta","\\mathrm{B}");ie("\\bull","\\bullet");ie("\\Chi","\\mathrm{X}");ie("\\clubs","\\clubsuit");ie("\\cnums","\\mathbb{C}");ie("\\Complex","\\mathbb{C}");ie("\\Dagger","\\ddagger");ie("\\diamonds","\\diamondsuit");ie("\\empty","\\emptyset");ie("\\Epsilon","\\mathrm{E}");ie("\\Eta","\\mathrm{H}");ie("\\exist","\\exists");ie("\\harr","\\leftrightarrow");ie("\\hArr","\\Leftrightarrow");ie("\\Harr","\\Leftrightarrow");ie("\\hearts","\\heartsuit");ie("\\image","\\Im");ie("\\infin","\\infty");ie("\\Iota","\\mathrm{I}");ie("\\isin","\\in");ie("\\Kappa","\\mathrm{K}");ie("\\larr","\\leftarrow");ie("\\lArr","\\Leftarrow");ie("\\Larr","\\Leftarrow");ie("\\lrarr","\\leftrightarrow");ie("\\lrArr","\\Leftrightarrow");ie("\\Lrarr","\\Leftrightarrow");ie("\\Mu","\\mathrm{M}");ie("\\natnums","\\mathbb{N}");ie("\\Nu","\\mathrm{N}");ie("\\Omicron","\\mathrm{O}");ie("\\plusmn","\\pm");ie("\\rarr","\\rightarrow");ie("\\rArr","\\Rightarrow");ie("\\Rarr","\\Rightarrow");ie("\\real","\\Re");ie("\\reals","\\mathbb{R}");ie("\\Reals","\\mathbb{R}");ie("\\Rho","\\mathrm{P}");ie("\\sdot","\\cdot");ie("\\sect","\\S");ie("\\spades","\\spadesuit");ie("\\sub","\\subset");ie("\\sube","\\subseteq");ie("\\supe","\\supseteq");ie("\\Tau","\\mathrm{T}");ie("\\thetasym","\\vartheta");ie("\\weierp","\\wp");ie("\\Zeta","\\mathrm{Z}");ie("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");ie("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");ie("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");ie("\\bra","\\mathinner{\\langle{#1}|}");ie("\\ket","\\mathinner{|{#1}\\rangle}");ie("\\braket","\\mathinner{\\langle{#1}\\rangle}");ie("\\Bra","\\left\\langle#1\\right|");ie("\\Ket","\\left|#1\\right\\rangle");var sP=e=>n=>{var t=n.consumeArg().tokens,r=n.consumeArg().tokens,s=n.consumeArg().tokens,i=n.consumeArg().tokens,a=n.macros.get("|"),o=n.macros.get("\\|");n.macros.beginGroup();var l=d=>p=>{e&&(p.macros.set("|",a),s.length&&p.macros.set("\\|",o));var m=d;if(!d&&s.length){var x=p.future();x.text==="|"&&(p.popToken(),m=!0)}return{tokens:m?s:r,numArgs:0}};n.macros.set("|",l(!1)),s.length&&n.macros.set("\\|",l(!0));var u=n.consumeArg().tokens,_=n.expandTokens([...i,...u,...t]);return n.macros.endGroup(),{tokens:_.reverse(),numArgs:0}};ie("\\bra@ket",sP(!1));ie("\\bra@set",sP(!0));ie("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");ie("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");ie("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");ie("\\angln","{\\angl n}");ie("\\blue","\\textcolor{##6495ed}{#1}");ie("\\orange","\\textcolor{##ffa500}{#1}");ie("\\pink","\\textcolor{##ff00af}{#1}");ie("\\red","\\textcolor{##df0030}{#1}");ie("\\green","\\textcolor{##28ae7b}{#1}");ie("\\gray","\\textcolor{gray}{#1}");ie("\\purple","\\textcolor{##9d38bd}{#1}");ie("\\blueA","\\textcolor{##ccfaff}{#1}");ie("\\blueB","\\textcolor{##80f6ff}{#1}");ie("\\blueC","\\textcolor{##63d9ea}{#1}");ie("\\blueD","\\textcolor{##11accd}{#1}");ie("\\blueE","\\textcolor{##0c7f99}{#1}");ie("\\tealA","\\textcolor{##94fff5}{#1}");ie("\\tealB","\\textcolor{##26edd5}{#1}");ie("\\tealC","\\textcolor{##01d1c1}{#1}");ie("\\tealD","\\textcolor{##01a995}{#1}");ie("\\tealE","\\textcolor{##208170}{#1}");ie("\\greenA","\\textcolor{##b6ffb0}{#1}");ie("\\greenB","\\textcolor{##8af281}{#1}");ie("\\greenC","\\textcolor{##74cf70}{#1}");ie("\\greenD","\\textcolor{##1fab54}{#1}");ie("\\greenE","\\textcolor{##0d923f}{#1}");ie("\\goldA","\\textcolor{##ffd0a9}{#1}");ie("\\goldB","\\textcolor{##ffbb71}{#1}");ie("\\goldC","\\textcolor{##ff9c39}{#1}");ie("\\goldD","\\textcolor{##e07d10}{#1}");ie("\\goldE","\\textcolor{##a75a05}{#1}");ie("\\redA","\\textcolor{##fca9a9}{#1}");ie("\\redB","\\textcolor{##ff8482}{#1}");ie("\\redC","\\textcolor{##f9685d}{#1}");ie("\\redD","\\textcolor{##e84d39}{#1}");ie("\\redE","\\textcolor{##bc2612}{#1}");ie("\\maroonA","\\textcolor{##ffbde0}{#1}");ie("\\maroonB","\\textcolor{##ff92c6}{#1}");ie("\\maroonC","\\textcolor{##ed5fa6}{#1}");ie("\\maroonD","\\textcolor{##ca337c}{#1}");ie("\\maroonE","\\textcolor{##9e034e}{#1}");ie("\\purpleA","\\textcolor{##ddd7ff}{#1}");ie("\\purpleB","\\textcolor{##c6b9fc}{#1}");ie("\\purpleC","\\textcolor{##aa87ff}{#1}");ie("\\purpleD","\\textcolor{##7854ab}{#1}");ie("\\purpleE","\\textcolor{##543b78}{#1}");ie("\\mintA","\\textcolor{##f5f9e8}{#1}");ie("\\mintB","\\textcolor{##edf2df}{#1}");ie("\\mintC","\\textcolor{##e0e5cc}{#1}");ie("\\grayA","\\textcolor{##f6f7f7}{#1}");ie("\\grayB","\\textcolor{##f0f1f2}{#1}");ie("\\grayC","\\textcolor{##e3e5e6}{#1}");ie("\\grayD","\\textcolor{##d6d8da}{#1}");ie("\\grayE","\\textcolor{##babec2}{#1}");ie("\\grayF","\\textcolor{##888d93}{#1}");ie("\\grayG","\\textcolor{##626569}{#1}");ie("\\grayH","\\textcolor{##3b3e40}{#1}");ie("\\grayI","\\textcolor{##21242c}{#1}");ie("\\kaBlue","\\textcolor{##314453}{#1}");ie("\\kaGreen","\\textcolor{##71B307}{#1}");var iP={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class sSt{constructor(n,t,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(n),this.macros=new tSt(nSt,t.macros),this.mode=r,this.stack=[]}feed(n){this.lexer=new PT(n,this.settings)}switchMode(n){this.mode=n}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(n){this.stack.push(n)}pushTokens(n){this.stack.push(...n)}scanArgument(n){var t,r,s;if(n){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:t,end:r}=this.consumeArg());return this.pushToken(new Qi("EOF",r.loc)),this.pushTokens(s),new Qi("",Si.range(t,r))}consumeSpaces(){for(;;){var n=this.future();if(n.text===" ")this.stack.pop();else break}}consumeArg(n){var t=[],r=n&&n.length>0;r||this.consumeSpaces();var s=this.future(),i,a=0,o=0;do{if(i=this.popToken(),t.push(i),i.text==="{")++a;else if(i.text==="}"){if(--a,a===-1)throw new Ye("Extra }",i)}else if(i.text==="EOF")throw new Ye("Unexpected end of input in a macro argument, expected '"+(n&&r?n[o]:"}")+"'",i);if(n&&r)if((a===0||a===1&&n[o]==="{")&&i.text===n[o]){if(++o,o===n.length){t.splice(-o,o);break}}else o=0}while(a!==0||r);return s.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:s,end:i}}consumeArgs(n,t){if(t){if(t.length!==n+1)throw new Ye("The length of delimiters doesn't match the number of args!");for(var r=t[0],s=0;sthis.settings.maxExpand)throw new Ye("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(n){var t=this.popToken(),r=t.text,s=t.noexpand?null:this._getExpansion(r);if(s==null||n&&s.unexpandable){if(n&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new Ye("Undefined control sequence: "+r);return this.pushToken(t),!1}this.countExpansion(1);var i=s.tokens,a=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var o=i.length-1;o>=0;--o){var l=i[o];if(l.text==="#"){if(o===0)throw new Ye("Incomplete placeholder at end of macro body",l);if(l=i[--o],l.text==="#")i.splice(o+1,1);else if(/^[1-9]$/.test(l.text))i.splice(o,2,...a[+l.text-1]);else throw new Ye("Not a valid argument number",l)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var n=this.stack.pop();return n.treatAsRelax&&(n.text="\\relax"),n}}expandMacro(n){return this.macros.has(n)?this.expandTokens([new Qi(n)]):void 0}expandTokens(n){var t=[],r=this.stack.length;for(this.pushTokens(n);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),t.push(s)}return this.countExpansion(t.length),t}expandMacroAsText(n){var t=this.expandMacro(n);return t&&t.map(r=>r.text).join("")}_getExpansion(n){var t=this.macros.get(n);if(t==null)return t;if(n.length===1){var r=this.lexer.catcodes[n];if(r!=null&&r!==13)return}var s=typeof t=="function"?t(this):t;if(typeof s=="string"){var i=0;if(s.includes("#"))for(var a=s.replace(/##/g,"");a.includes("#"+(i+1));)++i;for(var o=new PT(s,this.settings),l=[],u=o.lex();u.text!=="EOF";)l.push(u),u=o.lex();l.reverse();var _={tokens:l,numArgs:i};return _}return s}isDefined(n){return this.macros.has(n)||iu.hasOwnProperty(n)||Sr.math.hasOwnProperty(n)||Sr.text.hasOwnProperty(n)||iP.hasOwnProperty(n)}isExpandable(n){var t=this.macros.get(n);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:iu.hasOwnProperty(n)&&!iu[n].primitive}}var qT=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,t1=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),bw={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},UT={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Yb{constructor(n,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new sSt(n,t,this.mode),this.settings=t,this.leftrightDepth=0,this.nextToken=null}expect(n,t){if(t===void 0&&(t=!0),this.fetch().text!==n)throw new Ye("Expected '"+n+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(n){this.mode=n,this.gullet.switchMode(n)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var n=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),n}finally{this.gullet.endGroups()}}subparse(n){var t=this.nextToken;this.consume(),this.gullet.pushToken(new Qi("}")),this.gullet.pushTokens(n);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,r}parseExpression(n,t){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(Yb.endOfExpression.has(s.text)||t&&s.text===t||n&&iu[s.text]&&iu[s.text].infix)break;var i=this.parseAtom(t);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(n){for(var t=-1,r,s=0;s=128)this.settings.strict&&(f$(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',n):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),n)),a={type:"textord",mode:"text",loc:Si.range(n),text:t};else return null;if(this.consume(),i)for(var _=0;_0?{type:"text",value:N}:void 0),N===!1?p.lastIndex=C+1:(x!==C&&w.push({type:"text",value:u.value.slice(x,C)}),Array.isArray(N)?w.push(...N):N&&w.push(N),x=C+y[0].length,b=!0),!p.global)break;y=p.exec(u.value)}return b?(x?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let t=n[0],r=t.indexOf(")");const s=WT(e,"(");let i=WT(e,")");for(;r!==-1&&s>i;)e+=t.slice(0,r+1),t=t.slice(r+1),r=t.indexOf(")"),i++;return[e,t]}function cP(e,n){const t=e.input.charCodeAt(e.index-1);return(e.index===0||Id(t)||Db(t))&&(!n||t!==47)}uP.peek=ISt;function jSt(){this.buffer()}function TSt(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ASt(){this.buffer()}function RSt(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function MSt(e){const n=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=Ja(this.sliceSerialize(e)).toLowerCase(),t.label=n}function DSt(e){this.exit(e)}function LSt(e){const n=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=Ja(this.sliceSerialize(e)).toLowerCase(),t.label=n}function OSt(e){this.exit(e)}function ISt(){return"["}function uP(e,n,t,r){const s=t.createTracker(r);let i=s.move("[^");const a=t.enter("footnoteReference"),o=t.enter("reference");return i+=s.move(t.safe(t.associationId(e),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function BSt(){return{enter:{gfmFootnoteCallString:jSt,gfmFootnoteCall:TSt,gfmFootnoteDefinitionLabelString:ASt,gfmFootnoteDefinition:RSt},exit:{gfmFootnoteCallString:MSt,gfmFootnoteCall:DSt,gfmFootnoteDefinitionLabelString:LSt,gfmFootnoteDefinition:OSt}}}function $St(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:t,footnoteReference:uP},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function t(r,s,i,a){const o=i.createTracker(a);let l=o.move("[^");const u=i.enter("footnoteDefinition"),_=i.enter("label");return l+=o.move(i.safe(i.associationId(r),{before:l,after:"]"})),_(),l+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),l+=o.move((n?` +?)[ \r ]*`,V3="[̀-ͯ]",J6t=new RegExp(V3+"+$"),eSt="("+nP+"+)|"+(Z6t+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(V3+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(V3+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+X6t)+("|"+Y6t+")");class PT{constructor(n,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=n,this.settings=t,this.tokenRegex=new RegExp(eSt,"g"),this.catcodes={"%":14,"~":13}}setCatcode(n,t){this.catcodes[n]=t}lex(){var n=this.input,t=this.tokenRegex.lastIndex;if(t===n.length)return new Wi("EOF",new yi(this,t,t));var r=this.tokenRegex.exec(n);if(r===null||r.index!==t)throw new Qe("Unexpected character: '"+n[t]+"'",new Wi(n[t],new yi(this,t,t+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=n.indexOf(` +`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=n.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new Wi(s,new yi(this,t,this.tokenRegex.lastIndex))}}class tSt{constructor(n,t){n===void 0&&(n={}),t===void 0&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=n,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Qe("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var n=this.undefStack.pop();for(var t in n)n.hasOwnProperty(t)&&(n[t]==null?delete this.current[t]:this.current[t]=n[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(n){return this.current.hasOwnProperty(n)||this.builtins.hasOwnProperty(n)}get(n){return this.current.hasOwnProperty(n)?this.current[n]:this.builtins[n]}set(n,t,r){if(r===void 0&&(r=!1),r){for(var s=0;s0&&(this.undefStack[this.undefStack.length-1][n]=t)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(n)&&(i[n]=this.current[n])}t==null?delete this.current[n]:this.current[n]=t}}var nSt=G$;ie("\\noexpand",function(e){var n=e.popToken();return e.isExpandable(n.text)&&(n.noexpand=!0,n.treatAsRelax=!0),{tokens:[n],numArgs:0}});ie("\\expandafter",function(e){var n=e.popToken();return e.expandOnce(!0),{tokens:[n],numArgs:0}});ie("\\@firstoftwo",function(e){var n=e.consumeArgs(2);return{tokens:n[0],numArgs:0}});ie("\\@secondoftwo",function(e){var n=e.consumeArgs(2);return{tokens:n[1],numArgs:0}});ie("\\@ifnextchar",function(e){var n=e.consumeArgs(3);e.consumeSpaces();var t=e.future();return n[0].length===1&&n[0][0].text===t.text?{tokens:n[1],numArgs:0}:{tokens:n[2],numArgs:0}});ie("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");ie("\\TextOrMath",function(e){var n=e.consumeArgs(2);return e.mode==="text"?{tokens:n[0],numArgs:0}:{tokens:n[1],numArgs:0}});var FT={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};ie("\\char",function(e){var n=e.popToken(),t,r=0;if(n.text==="'")t=8,n=e.popToken();else if(n.text==='"')t=16,n=e.popToken();else if(n.text==="`")if(n=e.popToken(),n.text[0]==="\\")r=n.text.charCodeAt(1);else{if(n.text==="EOF")throw new Qe("\\char` missing argument");r=n.text.charCodeAt(0)}else t=10;if(t){if(r=FT[n.text],r==null||r>=t)throw new Qe("Invalid base-"+t+" digit "+n.text);for(var s;(s=FT[e.future().text])!=null&&s{var s=e.consumeArg().tokens;if(s.length!==1)throw new Qe("\\newcommand's first argument must be a macro name");var i=s[0].text,a=e.isDefined(i);if(a&&!n)throw new Qe("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!a&&!t)throw new Qe("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var o=0;if(s=e.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var l="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)l+=u.text,u=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new Qe("Invalid number of arguments: "+l);o=parseInt(l),s=e.consumeArg().tokens}return a&&r||e.macros.set(i,{tokens:s,numArgs:o}),""};ie("\\newcommand",e=>ok(e,!1,!0,!1));ie("\\renewcommand",e=>ok(e,!0,!1,!1));ie("\\providecommand",e=>ok(e,!0,!0,!0));ie("\\message",e=>{var n=e.consumeArgs(1)[0];return console.log(n.reverse().map(t=>t.text).join("")),""});ie("\\errmessage",e=>{var n=e.consumeArgs(1)[0];return console.error(n.reverse().map(t=>t.text).join("")),""});ie("\\show",e=>{var n=e.popToken(),t=n.text;return console.log(n,e.macros.get(t),Yc[t],br.math[t],br.text[t]),""});ie("\\bgroup","{");ie("\\egroup","}");ie("~","\\nobreakspace");ie("\\lq","`");ie("\\rq","'");ie("\\aa","\\r a");ie("\\AA","\\r A");ie("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");ie("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");ie("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");ie("ℬ","\\mathscr{B}");ie("ℰ","\\mathscr{E}");ie("ℱ","\\mathscr{F}");ie("ℋ","\\mathscr{H}");ie("ℐ","\\mathscr{I}");ie("ℒ","\\mathscr{L}");ie("ℳ","\\mathscr{M}");ie("ℛ","\\mathscr{R}");ie("ℭ","\\mathfrak{C}");ie("ℌ","\\mathfrak{H}");ie("ℨ","\\mathfrak{Z}");ie("\\Bbbk","\\Bbb{k}");ie("\\llap","\\mathllap{\\textrm{#1}}");ie("\\rlap","\\mathrlap{\\textrm{#1}}");ie("\\clap","\\mathclap{\\textrm{#1}}");ie("\\mathstrut","\\vphantom{(}");ie("\\underbar","\\underline{\\text{#1}}");ie("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');ie("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");ie("\\ne","\\neq");ie("≠","\\neq");ie("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");ie("∉","\\notin");ie("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");ie("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");ie("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");ie("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");ie("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");ie("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");ie("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");ie("⟂","\\perp");ie("‼","\\mathclose{!\\mkern-0.8mu!}");ie("∌","\\notni");ie("⌜","\\ulcorner");ie("⌝","\\urcorner");ie("⌞","\\llcorner");ie("⌟","\\lrcorner");ie("©","\\copyright");ie("®","\\textregistered");ie("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');ie("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');ie("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');ie("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');ie("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");ie("⋮","\\vdots");ie("\\varGamma","\\mathit{\\Gamma}");ie("\\varDelta","\\mathit{\\Delta}");ie("\\varTheta","\\mathit{\\Theta}");ie("\\varLambda","\\mathit{\\Lambda}");ie("\\varXi","\\mathit{\\Xi}");ie("\\varPi","\\mathit{\\Pi}");ie("\\varSigma","\\mathit{\\Sigma}");ie("\\varUpsilon","\\mathit{\\Upsilon}");ie("\\varPhi","\\mathit{\\Phi}");ie("\\varPsi","\\mathit{\\Psi}");ie("\\varOmega","\\mathit{\\Omega}");ie("\\substack","\\begin{subarray}{c}#1\\end{subarray}");ie("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");ie("\\boxed","\\fbox{$\\displaystyle{#1}$}");ie("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");ie("\\implies","\\DOTSB\\;\\Longrightarrow\\;");ie("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");ie("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");ie("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var HT={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},rSt=new Set(["bin","rel"]);ie("\\dots",function(e){var n="\\dotso",t=e.expandAfterFuture().text;return t in HT?n=HT[t]:(t.slice(0,4)==="\\not"||t in br.math&&rSt.has(br.math[t].group))&&(n="\\dotsb"),n});var lk={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};ie("\\dotso",function(e){var n=e.future().text;return n in lk?"\\ldots\\,":"\\ldots"});ie("\\dotsc",function(e){var n=e.future().text;return n in lk&&n!==","?"\\ldots\\,":"\\ldots"});ie("\\cdots",function(e){var n=e.future().text;return n in lk?"\\@cdots\\,":"\\@cdots"});ie("\\dotsb","\\cdots");ie("\\dotsm","\\cdots");ie("\\dotsi","\\!\\cdots");ie("\\dotsx","\\ldots\\,");ie("\\DOTSI","\\relax");ie("\\DOTSB","\\relax");ie("\\DOTSX","\\relax");ie("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");ie("\\,","\\tmspace+{3mu}{.1667em}");ie("\\thinspace","\\,");ie("\\>","\\mskip{4mu}");ie("\\:","\\tmspace+{4mu}{.2222em}");ie("\\medspace","\\:");ie("\\;","\\tmspace+{5mu}{.2777em}");ie("\\thickspace","\\;");ie("\\!","\\tmspace-{3mu}{.1667em}");ie("\\negthinspace","\\!");ie("\\negmedspace","\\tmspace-{4mu}{.2222em}");ie("\\negthickspace","\\tmspace-{5mu}{.277em}");ie("\\enspace","\\kern.5em ");ie("\\enskip","\\hskip.5em\\relax");ie("\\quad","\\hskip1em\\relax");ie("\\qquad","\\hskip2em\\relax");ie("\\tag","\\@ifstar\\tag@literal\\tag@paren");ie("\\tag@paren","\\tag@literal{({#1})}");ie("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Qe("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});ie("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");ie("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");ie("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");ie("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");ie("\\newline","\\\\\\relax");ie("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var rP=et(To["Main-Regular"][84][1]-.7*To["Main-Regular"][65][1]);ie("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+rP+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");ie("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+rP+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");ie("\\hspace","\\@ifstar\\@hspacer\\@hspace");ie("\\@hspace","\\hskip #1\\relax");ie("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");ie("\\ordinarycolon",":");ie("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");ie("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');ie("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');ie("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');ie("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');ie("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');ie("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');ie("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');ie("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');ie("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');ie("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');ie("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');ie("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');ie("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');ie("∷","\\dblcolon");ie("∹","\\eqcolon");ie("≔","\\coloneqq");ie("≕","\\eqqcolon");ie("⩴","\\Coloneqq");ie("\\ratio","\\vcentcolon");ie("\\coloncolon","\\dblcolon");ie("\\colonequals","\\coloneqq");ie("\\coloncolonequals","\\Coloneqq");ie("\\equalscolon","\\eqqcolon");ie("\\equalscoloncolon","\\Eqqcolon");ie("\\colonminus","\\coloneq");ie("\\coloncolonminus","\\Coloneq");ie("\\minuscolon","\\eqcolon");ie("\\minuscoloncolon","\\Eqcolon");ie("\\coloncolonapprox","\\Colonapprox");ie("\\coloncolonsim","\\Colonsim");ie("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");ie("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");ie("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");ie("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");ie("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");ie("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");ie("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");ie("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");ie("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");ie("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");ie("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");ie("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");ie("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");ie("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");ie("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");ie("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");ie("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");ie("\\nleqq","\\html@mathml{\\@nleqq}{≰}");ie("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");ie("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");ie("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");ie("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");ie("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");ie("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");ie("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");ie("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");ie("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");ie("\\imath","\\html@mathml{\\@imath}{ı}");ie("\\jmath","\\html@mathml{\\@jmath}{ȷ}");ie("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");ie("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");ie("⟦","\\llbracket");ie("⟧","\\rrbracket");ie("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");ie("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");ie("⦃","\\lBrace");ie("⦄","\\rBrace");ie("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");ie("⦵","\\minuso");ie("\\darr","\\downarrow");ie("\\dArr","\\Downarrow");ie("\\Darr","\\Downarrow");ie("\\lang","\\langle");ie("\\rang","\\rangle");ie("\\uarr","\\uparrow");ie("\\uArr","\\Uparrow");ie("\\Uarr","\\Uparrow");ie("\\N","\\mathbb{N}");ie("\\R","\\mathbb{R}");ie("\\Z","\\mathbb{Z}");ie("\\alef","\\aleph");ie("\\alefsym","\\aleph");ie("\\Alpha","\\mathrm{A}");ie("\\Beta","\\mathrm{B}");ie("\\bull","\\bullet");ie("\\Chi","\\mathrm{X}");ie("\\clubs","\\clubsuit");ie("\\cnums","\\mathbb{C}");ie("\\Complex","\\mathbb{C}");ie("\\Dagger","\\ddagger");ie("\\diamonds","\\diamondsuit");ie("\\empty","\\emptyset");ie("\\Epsilon","\\mathrm{E}");ie("\\Eta","\\mathrm{H}");ie("\\exist","\\exists");ie("\\harr","\\leftrightarrow");ie("\\hArr","\\Leftrightarrow");ie("\\Harr","\\Leftrightarrow");ie("\\hearts","\\heartsuit");ie("\\image","\\Im");ie("\\infin","\\infty");ie("\\Iota","\\mathrm{I}");ie("\\isin","\\in");ie("\\Kappa","\\mathrm{K}");ie("\\larr","\\leftarrow");ie("\\lArr","\\Leftarrow");ie("\\Larr","\\Leftarrow");ie("\\lrarr","\\leftrightarrow");ie("\\lrArr","\\Leftrightarrow");ie("\\Lrarr","\\Leftrightarrow");ie("\\Mu","\\mathrm{M}");ie("\\natnums","\\mathbb{N}");ie("\\Nu","\\mathrm{N}");ie("\\Omicron","\\mathrm{O}");ie("\\plusmn","\\pm");ie("\\rarr","\\rightarrow");ie("\\rArr","\\Rightarrow");ie("\\Rarr","\\Rightarrow");ie("\\real","\\Re");ie("\\reals","\\mathbb{R}");ie("\\Reals","\\mathbb{R}");ie("\\Rho","\\mathrm{P}");ie("\\sdot","\\cdot");ie("\\sect","\\S");ie("\\spades","\\spadesuit");ie("\\sub","\\subset");ie("\\sube","\\subseteq");ie("\\supe","\\supseteq");ie("\\Tau","\\mathrm{T}");ie("\\thetasym","\\vartheta");ie("\\weierp","\\wp");ie("\\Zeta","\\mathrm{Z}");ie("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");ie("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");ie("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");ie("\\bra","\\mathinner{\\langle{#1}|}");ie("\\ket","\\mathinner{|{#1}\\rangle}");ie("\\braket","\\mathinner{\\langle{#1}\\rangle}");ie("\\Bra","\\left\\langle#1\\right|");ie("\\Ket","\\left|#1\\right\\rangle");var sP=e=>n=>{var t=n.consumeArg().tokens,r=n.consumeArg().tokens,s=n.consumeArg().tokens,i=n.consumeArg().tokens,a=n.macros.get("|"),o=n.macros.get("\\|");n.macros.beginGroup();var l=d=>p=>{e&&(p.macros.set("|",a),s.length&&p.macros.set("\\|",o));var m=d;if(!d&&s.length){var x=p.future();x.text==="|"&&(p.popToken(),m=!0)}return{tokens:m?s:r,numArgs:0}};n.macros.set("|",l(!1)),s.length&&n.macros.set("\\|",l(!0));var u=n.consumeArg().tokens,_=n.expandTokens([...i,...u,...t]);return n.macros.endGroup(),{tokens:_.reverse(),numArgs:0}};ie("\\bra@ket",sP(!1));ie("\\bra@set",sP(!0));ie("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");ie("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");ie("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");ie("\\angln","{\\angl n}");ie("\\blue","\\textcolor{##6495ed}{#1}");ie("\\orange","\\textcolor{##ffa500}{#1}");ie("\\pink","\\textcolor{##ff00af}{#1}");ie("\\red","\\textcolor{##df0030}{#1}");ie("\\green","\\textcolor{##28ae7b}{#1}");ie("\\gray","\\textcolor{gray}{#1}");ie("\\purple","\\textcolor{##9d38bd}{#1}");ie("\\blueA","\\textcolor{##ccfaff}{#1}");ie("\\blueB","\\textcolor{##80f6ff}{#1}");ie("\\blueC","\\textcolor{##63d9ea}{#1}");ie("\\blueD","\\textcolor{##11accd}{#1}");ie("\\blueE","\\textcolor{##0c7f99}{#1}");ie("\\tealA","\\textcolor{##94fff5}{#1}");ie("\\tealB","\\textcolor{##26edd5}{#1}");ie("\\tealC","\\textcolor{##01d1c1}{#1}");ie("\\tealD","\\textcolor{##01a995}{#1}");ie("\\tealE","\\textcolor{##208170}{#1}");ie("\\greenA","\\textcolor{##b6ffb0}{#1}");ie("\\greenB","\\textcolor{##8af281}{#1}");ie("\\greenC","\\textcolor{##74cf70}{#1}");ie("\\greenD","\\textcolor{##1fab54}{#1}");ie("\\greenE","\\textcolor{##0d923f}{#1}");ie("\\goldA","\\textcolor{##ffd0a9}{#1}");ie("\\goldB","\\textcolor{##ffbb71}{#1}");ie("\\goldC","\\textcolor{##ff9c39}{#1}");ie("\\goldD","\\textcolor{##e07d10}{#1}");ie("\\goldE","\\textcolor{##a75a05}{#1}");ie("\\redA","\\textcolor{##fca9a9}{#1}");ie("\\redB","\\textcolor{##ff8482}{#1}");ie("\\redC","\\textcolor{##f9685d}{#1}");ie("\\redD","\\textcolor{##e84d39}{#1}");ie("\\redE","\\textcolor{##bc2612}{#1}");ie("\\maroonA","\\textcolor{##ffbde0}{#1}");ie("\\maroonB","\\textcolor{##ff92c6}{#1}");ie("\\maroonC","\\textcolor{##ed5fa6}{#1}");ie("\\maroonD","\\textcolor{##ca337c}{#1}");ie("\\maroonE","\\textcolor{##9e034e}{#1}");ie("\\purpleA","\\textcolor{##ddd7ff}{#1}");ie("\\purpleB","\\textcolor{##c6b9fc}{#1}");ie("\\purpleC","\\textcolor{##aa87ff}{#1}");ie("\\purpleD","\\textcolor{##7854ab}{#1}");ie("\\purpleE","\\textcolor{##543b78}{#1}");ie("\\mintA","\\textcolor{##f5f9e8}{#1}");ie("\\mintB","\\textcolor{##edf2df}{#1}");ie("\\mintC","\\textcolor{##e0e5cc}{#1}");ie("\\grayA","\\textcolor{##f6f7f7}{#1}");ie("\\grayB","\\textcolor{##f0f1f2}{#1}");ie("\\grayC","\\textcolor{##e3e5e6}{#1}");ie("\\grayD","\\textcolor{##d6d8da}{#1}");ie("\\grayE","\\textcolor{##babec2}{#1}");ie("\\grayF","\\textcolor{##888d93}{#1}");ie("\\grayG","\\textcolor{##626569}{#1}");ie("\\grayH","\\textcolor{##3b3e40}{#1}");ie("\\grayI","\\textcolor{##21242c}{#1}");ie("\\kaBlue","\\textcolor{##314453}{#1}");ie("\\kaGreen","\\textcolor{##71B307}{#1}");var iP={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class sSt{constructor(n,t,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(n),this.macros=new tSt(nSt,t.macros),this.mode=r,this.stack=[]}feed(n){this.lexer=new PT(n,this.settings)}switchMode(n){this.mode=n}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(n){this.stack.push(n)}pushTokens(n){this.stack.push(...n)}scanArgument(n){var t,r,s;if(n){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:t,end:r}=this.consumeArg());return this.pushToken(new Wi("EOF",r.loc)),this.pushTokens(s),new Wi("",yi.range(t,r))}consumeSpaces(){for(;;){var n=this.future();if(n.text===" ")this.stack.pop();else break}}consumeArg(n){var t=[],r=n&&n.length>0;r||this.consumeSpaces();var s=this.future(),i,a=0,o=0;do{if(i=this.popToken(),t.push(i),i.text==="{")++a;else if(i.text==="}"){if(--a,a===-1)throw new Qe("Extra }",i)}else if(i.text==="EOF")throw new Qe("Unexpected end of input in a macro argument, expected '"+(n&&r?n[o]:"}")+"'",i);if(n&&r)if((a===0||a===1&&n[o]==="{")&&i.text===n[o]){if(++o,o===n.length){t.splice(-o,o);break}}else o=0}while(a!==0||r);return s.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:s,end:i}}consumeArgs(n,t){if(t){if(t.length!==n+1)throw new Qe("The length of delimiters doesn't match the number of args!");for(var r=t[0],s=0;sthis.settings.maxExpand)throw new Qe("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(n){var t=this.popToken(),r=t.text,s=t.noexpand?null:this._getExpansion(r);if(s==null||n&&s.unexpandable){if(n&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new Qe("Undefined control sequence: "+r);return this.pushToken(t),!1}this.countExpansion(1);var i=s.tokens,a=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var o=i.length-1;o>=0;--o){var l=i[o];if(l.text==="#"){if(o===0)throw new Qe("Incomplete placeholder at end of macro body",l);if(l=i[--o],l.text==="#")i.splice(o+1,1);else if(/^[1-9]$/.test(l.text))i.splice(o,2,...a[+l.text-1]);else throw new Qe("Not a valid argument number",l)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var n=this.stack.pop();return n.treatAsRelax&&(n.text="\\relax"),n}}expandMacro(n){return this.macros.has(n)?this.expandTokens([new Wi(n)]):void 0}expandTokens(n){var t=[],r=this.stack.length;for(this.pushTokens(n);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),t.push(s)}return this.countExpansion(t.length),t}expandMacroAsText(n){var t=this.expandMacro(n);return t&&t.map(r=>r.text).join("")}_getExpansion(n){var t=this.macros.get(n);if(t==null)return t;if(n.length===1){var r=this.lexer.catcodes[n];if(r!=null&&r!==13)return}var s=typeof t=="function"?t(this):t;if(typeof s=="string"){var i=0;if(s.includes("#"))for(var a=s.replace(/##/g,"");a.includes("#"+(i+1));)++i;for(var o=new PT(s,this.settings),l=[],u=o.lex();u.text!=="EOF";)l.push(u),u=o.lex();l.reverse();var _={tokens:l,numArgs:i};return _}return s}isDefined(n){return this.macros.has(n)||Yc.hasOwnProperty(n)||br.math.hasOwnProperty(n)||br.text.hasOwnProperty(n)||iP.hasOwnProperty(n)}isExpandable(n){var t=this.macros.get(n);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:Yc.hasOwnProperty(n)&&!Yc[n].primitive}}var qT=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,t1=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),bw={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},UT={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Qb{constructor(n,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new sSt(n,t,this.mode),this.settings=t,this.leftrightDepth=0,this.nextToken=null}expect(n,t){if(t===void 0&&(t=!0),this.fetch().text!==n)throw new Qe("Expected '"+n+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(n){this.mode=n,this.gullet.switchMode(n)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var n=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),n}finally{this.gullet.endGroups()}}subparse(n){var t=this.nextToken;this.consume(),this.gullet.pushToken(new Wi("}")),this.gullet.pushTokens(n);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,r}parseExpression(n,t){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(Qb.endOfExpression.has(s.text)||t&&s.text===t||n&&Yc[s.text]&&Yc[s.text].infix)break;var i=this.parseAtom(t);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(n){for(var t=-1,r,s=0;s=128)this.settings.strict&&(f$(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',n):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),n)),a={type:"textord",mode:"text",loc:yi.range(n),text:t};else return null;if(this.consume(),i)for(var _=0;_0?{type:"text",value:N}:void 0),N===!1?p.lastIndex=C+1:(x!==C&&w.push({type:"text",value:u.value.slice(x,C)}),Array.isArray(N)?w.push(...N):N&&w.push(N),x=C+y[0].length,b=!0),!p.global)break;y=p.exec(u.value)}return b?(x?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let t=n[0],r=t.indexOf(")");const s=WT(e,"(");let i=WT(e,")");for(;r!==-1&&s>i;)e+=t.slice(0,r+1),t=t.slice(r+1),r=t.indexOf(")"),i++;return[e,t]}function cP(e,n){const t=e.input.charCodeAt(e.index-1);return(e.index===0||Md(t)||Mb(t))&&(!n||t!==47)}uP.peek=ISt;function jSt(){this.buffer()}function TSt(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ASt(){this.buffer()}function RSt(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function MSt(e){const n=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=Xa(this.sliceSerialize(e)).toLowerCase(),t.label=n}function DSt(e){this.exit(e)}function LSt(e){const n=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=Xa(this.sliceSerialize(e)).toLowerCase(),t.label=n}function OSt(e){this.exit(e)}function ISt(){return"["}function uP(e,n,t,r){const s=t.createTracker(r);let i=s.move("[^");const a=t.enter("footnoteReference"),o=t.enter("reference");return i+=s.move(t.safe(t.associationId(e),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function BSt(){return{enter:{gfmFootnoteCallString:jSt,gfmFootnoteCall:TSt,gfmFootnoteDefinitionLabelString:ASt,gfmFootnoteDefinition:RSt},exit:{gfmFootnoteCallString:MSt,gfmFootnoteCall:DSt,gfmFootnoteDefinitionLabelString:LSt,gfmFootnoteDefinition:OSt}}}function $St(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:t,footnoteReference:uP},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function t(r,s,i,a){const o=i.createTracker(a);let l=o.move("[^");const u=i.enter("footnoteDefinition"),_=i.enter("label");return l+=o.move(i.safe(i.associationId(r),{before:l,after:"]"})),_(),l+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),l+=o.move((n?` `:" ")+i.indentLines(i.containerFlow(r,o.current()),n?dP:PSt))),u(),l}}function PSt(e,n,t){return n===0?e:dP(e,n,t)}function dP(e,n,t){return(t?"":" ")+e}const FSt=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];fP.peek=WSt;function HSt(){return{canContainEols:["delete"],enter:{strikethrough:USt},exit:{strikethrough:GSt}}}function qSt(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:FSt}],handlers:{delete:fP}}}function USt(e){this.enter({type:"delete",children:[]},e)}function GSt(e){this.exit(e)}function fP(e,n,t,r){const s=t.createTracker(r),i=t.enter("strikethrough");let a=s.move("~~");return a+=t.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function WSt(){return"~"}function VSt(e){return e.length}function KSt(e,n){const t=n||{},r=(t.align||[]).concat(),s=t.stringLength||VSt,i=[],a=[],o=[],l=[];let u=0,_=-1;for(;++_u&&(u=e[_].length);++bl[b])&&(l[b]=y)}S.push(w)}a[_]=S,o[_]=v}let d=-1;if(typeof r=="object"&&"length"in r)for(;++dl[d]&&(l[d]=w),m[d]=w),p[d]=y}a.splice(1,0,p),o.splice(1,0,m),_=-1;const x=[];for(;++_ "),i.shift(2);const a=t.indentLines(t.containerFlow(e,i.current()),XSt);return s(),a}function XSt(e,n,t){return">"+(t?"":" ")+e}function ZSt(e,n){return KT(e,n.inConstruct,!0)&&!KT(e,n.notInConstruct,!1)}function KT(e,n,t){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return t;let r=-1;for(;++r",...l.current()})),u+=l.move(">")):(o=t.enter("destinationRaw"),u+=l.move(t.safe(e.url,{before:u,after:e.title?" ":` -`,...l.current()}))),o(),e.title&&(o=t.enter(`title${i}`),u+=l.move(" "+s),u+=l.move(t.safe(e.title,{before:u,after:s,...l.current()})),u+=l.move(s),o()),a(),u}function skt(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function vp(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ev(e,n,t){const r=Vh(e),s=Vh(n);return r===void 0?s===void 0?t==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}_P.peek=ikt;function _P(e,n,t,r){const s=skt(t),i=t.enter("emphasis"),a=t.createTracker(r),o=a.move(s);let l=a.move(t.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=l.charCodeAt(0),_=Ev(r.before.charCodeAt(r.before.length-1),u,s);_.inside&&(l=vp(u)+l.slice(1));const d=l.charCodeAt(l.length-1),p=Ev(r.after.charCodeAt(0),d,s);p.inside&&(l=l.slice(0,-1)+vp(d));const m=a.move(s);return i(),t.attentionEncodeSurroundingInfo={after:p.outside,before:_.outside},o+l+m}function ikt(e,n,t){return t.options.emphasis||"*"}function akt(e,n){let t=!1;return BS(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return t=!0,y3}),!!((!e.depth||e.depth<3)&&US(e)&&(n.options.setext||t))}function okt(e,n,t,r){const s=Math.max(Math.min(6,e.depth||1),1),i=t.createTracker(r);if(akt(e,t)){const _=t.enter("headingSetext"),d=t.enter("phrasing"),p=t.containerPhrasing(e,{...i.current(),before:` +`,...l.current()}))),o(),e.title&&(o=t.enter(`title${i}`),u+=l.move(" "+s),u+=l.move(t.safe(e.title,{before:u,after:s,...l.current()})),u+=l.move(s),o()),a(),u}function skt(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function vp(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ev(e,n,t){const r=qh(e),s=qh(n);return r===void 0?s===void 0?t==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}_P.peek=ikt;function _P(e,n,t,r){const s=skt(t),i=t.enter("emphasis"),a=t.createTracker(r),o=a.move(s);let l=a.move(t.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=l.charCodeAt(0),_=Ev(r.before.charCodeAt(r.before.length-1),u,s);_.inside&&(l=vp(u)+l.slice(1));const d=l.charCodeAt(l.length-1),p=Ev(r.after.charCodeAt(0),d,s);p.inside&&(l=l.slice(0,-1)+vp(d));const m=a.move(s);return i(),t.attentionEncodeSurroundingInfo={after:p.outside,before:_.outside},o+l+m}function ikt(e,n,t){return t.options.emphasis||"*"}function akt(e,n){let t=!1;return BS(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return t=!0,y3}),!!((!e.depth||e.depth<3)&&US(e)&&(n.options.setext||t))}function okt(e,n,t,r){const s=Math.max(Math.min(6,e.depth||1),1),i=t.createTracker(r);if(akt(e,t)){const _=t.enter("headingSetext"),d=t.enter("phrasing"),p=t.containerPhrasing(e,{...i.current(),before:` `,after:` `});return d(),_(),p+` `+(s===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(` `))+1))}const a="#".repeat(s),o=t.enter("headingAtx"),l=t.enter("phrasing");i.move(a+" ");let u=t.containerPhrasing(e,{before:"# ",after:` `,...i.current()});return/^[\t ]/.test(u)&&(u=vp(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,t.options.closeAtx&&(u+=" "+a),l(),o(),u}pP.peek=lkt;function pP(e){return e.value||""}function lkt(){return"<"}mP.peek=ckt;function mP(e,n,t,r){const s=dk(t),i=s==='"'?"Quote":"Apostrophe",a=t.enter("image");let o=t.enter("label");const l=t.createTracker(r);let u=l.move("![");return u+=l.move(t.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=t.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(t.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(o=t.enter("destinationRaw"),u+=l.move(t.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),o(),e.title&&(o=t.enter(`title${i}`),u+=l.move(" "+s),u+=l.move(t.safe(e.title,{before:u,after:s,...l.current()})),u+=l.move(s),o()),u+=l.move(")"),a(),u}function ckt(){return"!"}gP.peek=ukt;function gP(e,n,t,r){const s=e.referenceType,i=t.enter("imageReference");let a=t.enter("label");const o=t.createTracker(r);let l=o.move("![");const u=t.safe(e.alt,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),a();const _=t.stack;t.stack=[],a=t.enter("reference");const d=t.safe(t.associationId(e),{before:l,after:"]",...o.current()});return a(),t.stack=_,i(),s==="full"||!u||u!==d?l+=o.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function ukt(){return"!"}vP.peek=dkt;function vP(e,n,t){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(e.url))}yP.peek=fkt;function yP(e,n,t,r){const s=dk(t),i=s==='"'?"Quote":"Apostrophe",a=t.createTracker(r);let o,l;if(bP(e,t)){const _=t.stack;t.stack=[],o=t.enter("autolink");let d=a.move("<");return d+=a.move(t.containerPhrasing(e,{before:d,after:">",...a.current()})),d+=a.move(">"),o(),t.stack=_,d}o=t.enter("link"),l=t.enter("label");let u=a.move("[");return u+=a.move(t.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=t.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(t.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(l=t.enter("destinationRaw"),u+=a.move(t.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=t.enter(`title${i}`),u+=a.move(" "+s),u+=a.move(t.safe(e.title,{before:u,after:s,...a.current()})),u+=a.move(s),l()),u+=a.move(")"),o(),u}function fkt(e,n,t){return bP(e,t)?"<":"["}xP.peek=hkt;function xP(e,n,t,r){const s=e.referenceType,i=t.enter("linkReference");let a=t.enter("label");const o=t.createTracker(r);let l=o.move("[");const u=t.containerPhrasing(e,{before:l,after:"]",...o.current()});l+=o.move(u+"]["),a();const _=t.stack;t.stack=[],a=t.enter("reference");const d=t.safe(t.associationId(e),{before:l,after:"]",...o.current()});return a(),t.stack=_,i(),s==="full"||!u||u!==d?l+=o.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=o.move("]"),l}function hkt(){return"["}function fk(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function _kt(e){const n=fk(e),t=e.options.bulletOther;if(!t)return n==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+t+"`) to be different");return t}function pkt(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function wP(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function mkt(e,n,t,r){const s=t.enter("list"),i=t.bulletCurrent;let a=e.ordered?pkt(t):fk(t);const o=e.ordered?a==="."?")":".":_kt(t);let l=n&&t.bulletLastUsed?a===t.bulletLastUsed:!1;if(!e.ordered){const _=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&_&&(!_.children||!_.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(l=!0),wP(t)===a&&_){let d=-1;for(;++d-1?n.start:1)+(t.options.incrementListMarker===!1?0:n.children.indexOf(e))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=t.createTracker(r);o.move(i+" ".repeat(a-i.length)),o.shift(a);const l=t.enter("listItem"),u=t.indentLines(t.containerFlow(e,o.current()),_);return l(),u;function _(d,p,m){return p?(m?"":" ".repeat(a))+d:(m?i:i+" ".repeat(a-i.length))+d}}function bkt(e,n,t,r){const s=t.enter("paragraph"),i=t.enter("phrasing"),a=t.containerPhrasing(e,r);return i(),s(),a}const ykt=om(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function xkt(e,n,t,r){return(e.children.some(function(a){return ykt(a)})?t.containerPhrasing:t.containerFlow).call(t,e,r)}function wkt(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}SP.peek=Skt;function SP(e,n,t,r){const s=wkt(t),i=t.enter("strong"),a=t.createTracker(r),o=a.move(s+s);let l=a.move(t.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=l.charCodeAt(0),_=Ev(r.before.charCodeAt(r.before.length-1),u,s);_.inside&&(l=vp(u)+l.slice(1));const d=l.charCodeAt(l.length-1),p=Ev(r.after.charCodeAt(0),d,s);p.inside&&(l=l.slice(0,-1)+vp(d));const m=a.move(s+s);return i(),t.attentionEncodeSurroundingInfo={after:p.outside,before:_.outside},o+l+m}function Skt(e,n,t){return t.options.strong||"*"}function kkt(e,n,t,r){return t.safe(e.value,r)}function Ckt(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function Ekt(e,n,t){const r=(wP(t)+(t.options.ruleSpaces?" ":"")).repeat(Ckt(t));return t.options.ruleSpaces?r.slice(0,-1):r}const kP={blockquote:YSt,break:QT,code:tkt,definition:rkt,emphasis:_P,hardBreak:QT,heading:okt,html:pP,image:mP,imageReference:gP,inlineCode:vP,link:yP,linkReference:xP,list:mkt,listItem:vkt,paragraph:bkt,root:xkt,strong:SP,text:kkt,thematicBreak:Ekt};function Nkt(){return{enter:{table:zkt,tableData:YT,tableHeader:YT,tableRow:Tkt},exit:{codeText:Akt,table:jkt,tableData:Sw,tableHeader:Sw,tableRow:Sw}}}function zkt(e){const n=e._align;this.enter({type:"table",align:n.map(function(t){return t==="none"?null:t}),children:[]},e),this.data.inTable=!0}function jkt(e){this.exit(e),this.data.inTable=void 0}function Tkt(e){this.enter({type:"tableRow",children:[]},e)}function Sw(e){this.exit(e)}function YT(e){this.enter({type:"tableCell",children:[]},e)}function Akt(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,Rkt));const t=this.stack[this.stack.length-1];t.type,t.value=n,this.exit(e)}function Rkt(e,n){return n==="|"?n:e}function Mkt(e){const n=e||{},t=n.tableCellPadding,r=n.tablePipeAlign,s=n.stringLength,i=t?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:a,tableCell:l,tableRow:o}};function a(m,x,S,v){return u(_(m,S,v),m.align)}function o(m,x,S,v){const b=d(m,S,v),w=u([b]);return w.slice(0,w.indexOf(` -`))}function l(m,x,S,v){const b=S.enter("tableCell"),w=S.enter("phrasing"),y=S.containerPhrasing(m,{...v,before:i,after:i});return w(),b(),y}function u(m,x){return KSt(m,{align:x,alignDelimiters:r,padding:t,stringLength:s})}function _(m,x,S){const v=m.children;let b=-1;const w=[],y=x.enter("table");for(;++b0&&!t&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}const Xkt={tokenize:i7t,partial:!0};function Zkt(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:n7t,continuation:{tokenize:r7t},exit:s7t}},text:{91:{name:"gfmFootnoteCall",tokenize:t7t},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Jkt,resolveTo:e7t}}}}function Jkt(e,n,t){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!a||!a._balanced)return t(l);const u=Ja(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?t(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),n(l))}}function e7t(e,n){let t=e.length;for(;t--;)if(e[t][1].type==="labelImage"&&e[t][0]==="enter"){e[t][1];break}e[t+1][1].type="data",e[t+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[t+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[t+3][1].end),end:Object.assign({},e[t+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[e[t+1],e[t+2],["enter",r,n],e[t+3],e[t+4],["enter",s,n],["exit",s,n],["enter",i,n],["enter",a,n],["exit",a,n],["exit",i,n],e[e.length-2],e[e.length-1],["exit",r,n]];return e.splice(t,e.length-t+1,...o),e}function t7t(e,n,t){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return o;function o(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?t(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(d){if(i>999||d===93&&!a||d===null||d===91||ir(d))return t(d);if(d===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return s.includes(Ja(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):t(d)}return ir(d)||(a=!0),i++,e.consume(d),d===92?_:u}function _(d){return d===91||d===92||d===93?(e.consume(d),i++,u):u(d)}}function n7t(e,n,t){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,o;return l;function l(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",_):t(x)}function _(x){if(a>999||x===93&&!o||x===null||x===91||ir(x))return t(x);if(x===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return i=Ja(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return ir(x)||(o=!0),a++,e.consume(x),x===92?d:_}function d(x){return x===91||x===92||x===93?(e.consume(x),a++,_):_(x)}function p(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),s.includes(i)||s.push(i),_n(e,m,"gfmFootnoteDefinitionWhitespace")):t(x)}function m(x){return n(x)}}function r7t(e,n,t){return e.check(cm,n,e.attempt(Xkt,n,t))}function s7t(e){e.exit("gfmFootnoteDefinition")}function i7t(e,n,t){const r=this;return _n(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?n(i):t(i)}}function a7t(e){let t=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return t==null&&(t=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,o){let l=-1;for(;++l1?l(x):(a.consume(x),d++,m);if(d<2&&!t)return l(x);const v=a.exit("strikethroughSequenceTemporary"),b=Vh(x);return v._open=!b||b===2&&!!S,v._close=!S||S===2&&!!b,o(x)}}}class o7t{constructor(){this.map=[]}add(n,t,r){l7t(this,n,t,r)}consume(n){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const r=[];for(;t>0;)t-=1,r.push(n.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),n.length=this.map[t][0];r.push(n.slice()),n.length=0;let s=r.pop();for(;s;){for(const i of s)n.push(i);s=r.pop()}this.map.length=0}}function l7t(e,n,t,r){let s=0;if(!(t===0&&r.length===0)){for(;s-1;){const H=r.events[B][1].type;if(H==="lineEnding"||H==="linePrefix")B--;else break}const $=B>-1?r.events[B][1].type:null,U=$==="tableHead"||$==="tableRow"?N:l;return U===N&&r.parser.lazy[r.now().line]?t(O):U(O)}function l(O){return e.enter("tableHead"),e.enter("tableRow"),u(O)}function u(O){return O===124||(a=!0,i+=1),_(O)}function _(O){return O===null?t(O):wt(O)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),m):t(O):vn(O)?_n(e,_,"whitespace")(O):(i+=1,a&&(a=!1,s+=1),O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),a=!0,_):(e.enter("data"),d(O)))}function d(O){return O===null||O===124||ir(O)?(e.exit("data"),_(O)):(e.consume(O),O===92?p:d)}function p(O){return O===92||O===124?(e.consume(O),d):d(O)}function m(O){return r.interrupt=!1,r.parser.lazy[r.now().line]?t(O):(e.enter("tableDelimiterRow"),a=!1,vn(O)?_n(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):x(O))}function x(O){return O===45||O===58?v(O):O===124?(a=!0,e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),S):E(O)}function S(O){return vn(O)?_n(e,v,"whitespace")(O):v(O)}function v(O){return O===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),b):O===45?(i+=1,b(O)):O===null||wt(O)?C(O):E(O)}function b(O){return O===45?(e.enter("tableDelimiterFiller"),w(O)):E(O)}function w(O){return O===45?(e.consume(O),w):O===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(O))}function y(O){return vn(O)?_n(e,C,"whitespace")(O):C(O)}function C(O){return O===124?x(O):O===null||wt(O)?!a||s!==i?E(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(O)):E(O)}function E(O){return t(O)}function N(O){return e.enter("tableRow"),T(O)}function T(O){return O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),T):O===null||wt(O)?(e.exit("tableRow"),n(O)):vn(O)?_n(e,T,"whitespace")(O):(e.enter("data"),z(O))}function z(O){return O===null||O===124||ir(O)?(e.exit("data"),T(O)):(e.consume(O),O===92?M:z)}function M(O){return O===92||O===124?(e.consume(O),z):z(O)}}function f7t(e,n){let t=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,l=0,u,_,d;const p=new o7t;for(;++tt[2]+1){const x=t[2]+1,S=t[3]-t[2]-1;e.add(x,S,[])}}e.add(t[3]+1,0,[["exit",d,n]])}return s!==void 0&&(i.end=Object.assign({},th(n.events,s)),e.add(s,0,[["exit",i,n]]),i=void 0),i}function ZT(e,n,t,r,s){const i=[],a=th(n.events,t);s&&(s.end=Object.assign({},a),i.push(["exit",s,n])),r.end=Object.assign({},a),i.push(["exit",r,n]),e.add(t+1,0,i)}function th(e,n){const t=e[n],r=t[0]==="enter"?"start":"end";return t[1][r]}const h7t={name:"tasklistCheck",tokenize:p7t};function _7t(){return{text:{91:h7t}}}function p7t(e,n,t){const r=this;return s;function s(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?t(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return ir(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):t(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):t(l)}function o(l){return wt(l)?n(l):vn(l)?e.check({tokenize:m7t},n,t)(l):t(l)}}function m7t(e,n,t){return _n(e,r,"whitespace");function r(s){return s===null?t(s):n(s)}}function g7t(e){return FB([Hkt(),Zkt(),a7t(e),u7t(),_7t()])}const v7t={};function MP(e){const n=this,t=e||v7t,r=n.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(g7t(t)),i.push(Bkt()),a.push($kt(t))}function b7t(){return{enter:{mathFlow:e,mathFlowFenceMeta:n,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:t,mathFlowValue:o,mathText:a,mathTextData:o}};function e(l){const u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},l)}function n(){this.buffer()}function t(){const l=this.resume(),u=this.stack[this.stack.length-1];u.type,u.meta=l}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(l){const u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),_=this.stack[this.stack.length-1];_.type,this.exit(l),_.value=u;const d=_.data.hChildren[0];d.type,d.tagName,d.children.push({type:"text",value:u}),this.data.mathFlowInside=void 0}function i(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function a(l){const u=this.resume(),_=this.stack[this.stack.length-1];_.type,this.exit(l),_.value=u,_.data.hChildren.push({type:"text",value:u})}function o(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function y7t(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +`))}function l(m,x,S,v){const b=S.enter("tableCell"),w=S.enter("phrasing"),y=S.containerPhrasing(m,{...v,before:i,after:i});return w(),b(),y}function u(m,x){return KSt(m,{align:x,alignDelimiters:r,padding:t,stringLength:s})}function _(m,x,S){const v=m.children;let b=-1;const w=[],y=x.enter("table");for(;++b0&&!t&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}const Xkt={tokenize:i7t,partial:!0};function Zkt(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:n7t,continuation:{tokenize:r7t},exit:s7t}},text:{91:{name:"gfmFootnoteCall",tokenize:t7t},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Jkt,resolveTo:e7t}}}}function Jkt(e,n,t){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!a||!a._balanced)return t(l);const u=Xa(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?t(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),n(l))}}function e7t(e,n){let t=e.length;for(;t--;)if(e[t][1].type==="labelImage"&&e[t][0]==="enter"){e[t][1];break}e[t+1][1].type="data",e[t+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[t+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[t+3][1].end),end:Object.assign({},e[t+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[e[t+1],e[t+2],["enter",r,n],e[t+3],e[t+4],["enter",s,n],["exit",s,n],["enter",i,n],["enter",a,n],["exit",a,n],["exit",i,n],e[e.length-2],e[e.length-1],["exit",r,n]];return e.splice(t,e.length-t+1,...o),e}function t7t(e,n,t){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return o;function o(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?t(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(d){if(i>999||d===93&&!a||d===null||d===91||ar(d))return t(d);if(d===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return s.includes(Xa(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):t(d)}return ar(d)||(a=!0),i++,e.consume(d),d===92?_:u}function _(d){return d===91||d===92||d===93?(e.consume(d),i++,u):u(d)}}function n7t(e,n,t){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,o;return l;function l(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",_):t(x)}function _(x){if(a>999||x===93&&!o||x===null||x===91||ar(x))return t(x);if(x===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return i=Xa(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return ar(x)||(o=!0),a++,e.consume(x),x===92?d:_}function d(x){return x===91||x===92||x===93?(e.consume(x),a++,_):_(x)}function p(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),s.includes(i)||s.push(i),hn(e,m,"gfmFootnoteDefinitionWhitespace")):t(x)}function m(x){return n(x)}}function r7t(e,n,t){return e.check(cm,n,e.attempt(Xkt,n,t))}function s7t(e){e.exit("gfmFootnoteDefinition")}function i7t(e,n,t){const r=this;return hn(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?n(i):t(i)}}function a7t(e){let t=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return t==null&&(t=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,o){let l=-1;for(;++l1?l(x):(a.consume(x),d++,m);if(d<2&&!t)return l(x);const v=a.exit("strikethroughSequenceTemporary"),b=qh(x);return v._open=!b||b===2&&!!S,v._close=!S||S===2&&!!b,o(x)}}}class o7t{constructor(){this.map=[]}add(n,t,r){l7t(this,n,t,r)}consume(n){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const r=[];for(;t>0;)t-=1,r.push(n.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),n.length=this.map[t][0];r.push(n.slice()),n.length=0;let s=r.pop();for(;s;){for(const i of s)n.push(i);s=r.pop()}this.map.length=0}}function l7t(e,n,t,r){let s=0;if(!(t===0&&r.length===0)){for(;s-1;){const H=r.events[B][1].type;if(H==="lineEnding"||H==="linePrefix")B--;else break}const $=B>-1?r.events[B][1].type:null,U=$==="tableHead"||$==="tableRow"?N:l;return U===N&&r.parser.lazy[r.now().line]?t(I):U(I)}function l(I){return e.enter("tableHead"),e.enter("tableRow"),u(I)}function u(I){return I===124||(a=!0,i+=1),_(I)}function _(I){return I===null?t(I):St(I)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),m):t(I):gn(I)?hn(e,_,"whitespace")(I):(i+=1,a&&(a=!1,s+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),a=!0,_):(e.enter("data"),d(I)))}function d(I){return I===null||I===124||ar(I)?(e.exit("data"),_(I)):(e.consume(I),I===92?p:d)}function p(I){return I===92||I===124?(e.consume(I),d):d(I)}function m(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?t(I):(e.enter("tableDelimiterRow"),a=!1,gn(I)?hn(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):x(I))}function x(I){return I===45||I===58?v(I):I===124?(a=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),S):E(I)}function S(I){return gn(I)?hn(e,v,"whitespace")(I):v(I)}function v(I){return I===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),b):I===45?(i+=1,b(I)):I===null||St(I)?C(I):E(I)}function b(I){return I===45?(e.enter("tableDelimiterFiller"),w(I)):E(I)}function w(I){return I===45?(e.consume(I),w):I===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(I))}function y(I){return gn(I)?hn(e,C,"whitespace")(I):C(I)}function C(I){return I===124?x(I):I===null||St(I)?!a||s!==i?E(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(I)):E(I)}function E(I){return t(I)}function N(I){return e.enter("tableRow"),T(I)}function T(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),T):I===null||St(I)?(e.exit("tableRow"),n(I)):gn(I)?hn(e,T,"whitespace")(I):(e.enter("data"),z(I))}function z(I){return I===null||I===124||ar(I)?(e.exit("data"),T(I)):(e.consume(I),I===92?M:z)}function M(I){return I===92||I===124?(e.consume(I),z):z(I)}}function f7t(e,n){let t=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,l=0,u,_,d;const p=new o7t;for(;++tt[2]+1){const x=t[2]+1,S=t[3]-t[2]-1;e.add(x,S,[])}}e.add(t[3]+1,0,[["exit",d,n]])}return s!==void 0&&(i.end=Object.assign({},Xf(n.events,s)),e.add(s,0,[["exit",i,n]]),i=void 0),i}function ZT(e,n,t,r,s){const i=[],a=Xf(n.events,t);s&&(s.end=Object.assign({},a),i.push(["exit",s,n])),r.end=Object.assign({},a),i.push(["exit",r,n]),e.add(t+1,0,i)}function Xf(e,n){const t=e[n],r=t[0]==="enter"?"start":"end";return t[1][r]}const h7t={name:"tasklistCheck",tokenize:p7t};function _7t(){return{text:{91:h7t}}}function p7t(e,n,t){const r=this;return s;function s(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?t(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return ar(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):t(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):t(l)}function o(l){return St(l)?n(l):gn(l)?e.check({tokenize:m7t},n,t)(l):t(l)}}function m7t(e,n,t){return hn(e,r,"whitespace");function r(s){return s===null?t(s):n(s)}}function g7t(e){return FB([Hkt(),Zkt(),a7t(e),u7t(),_7t()])}const v7t={};function MP(e){const n=this,t=e||v7t,r=n.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(g7t(t)),i.push(Bkt()),a.push($kt(t))}function b7t(){return{enter:{mathFlow:e,mathFlowFenceMeta:n,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:t,mathFlowValue:o,mathText:a,mathTextData:o}};function e(l){const u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},l)}function n(){this.buffer()}function t(){const l=this.resume(),u=this.stack[this.stack.length-1];u.type,u.meta=l}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(l){const u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),_=this.stack[this.stack.length-1];_.type,this.exit(l),_.value=u;const d=_.data.hChildren[0];d.type,d.tagName,d.children.push({type:"text",value:u}),this.data.mathFlowInside=void 0}function i(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function a(l){const u=this.resume(),_=this.stack[this.stack.length-1];_.type,this.exit(l),_.value=u,_.data.hChildren.push({type:"text",value:u})}function o(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function y7t(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` `,inConstruct:"mathFlowMeta"},{character:"$",after:n?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:t,inlineMath:r}};function t(i,a,o,l){const u=i.value||"",_=o.createTracker(l),d="$".repeat(Math.max(hP(u,"$")+1,2)),p=o.enter("mathFlow");let m=_.move(d);if(i.meta){const x=o.enter("mathFlowMeta");m+=_.move(o.safe(i.meta,{after:` `,before:m,encode:["$"],..._.current()})),x()}return m+=_.move(` `),u&&(m+=_.move(u+` -`)),m+=_.move(d),p(),m}function r(i,a,o){let l=i.value||"",u=1;for(n||u++;new RegExp("(^|[^$])"+"\\$".repeat(u)+"([^$]|$)").test(l);)u++;const _="$".repeat(u);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let d=-1;for(;++dt)return null;try{return jt.highlight(e,n).children}catch{return null}}function OP(e,n){var t;return e.type==="text"?e.value??"":e.type!=="element"?null:f.jsx("span",{className:(((t=e.properties)==null?void 0:t.className)??[]).join(" "),children:(e.children??[]).map(OP)},n)}function j7t(e,n,t=3e5){var r;return((r=LP(e,n,t))==null?void 0:r.map(OP))??e}function IP(e,n,t=3e5){const r=LP(e,n,t);if(!r)return e.split(` +`)),m+=_.move(d),p(),m}function r(i,a,o){let l=i.value||"",u=1;for(n||u++;new RegExp("(^|[^$])"+"\\$".repeat(u)+"([^$]|$)").test(l);)u++;const _="$".repeat(u);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let d=-1;for(;++dt)return null;try{return zt.highlight(e,n).children}catch{return null}}function OP(e,n){var t;return e.type==="text"?e.value??"":e.type!=="element"?null:f.jsx("span",{className:(((t=e.properties)==null?void 0:t.className)??[]).join(" "),children:(e.children??[]).map(OP)},n)}function j7t(e,n,t=3e5){var r;return((r=LP(e,n,t))==null?void 0:r.map(OP))??e}function IP(e,n,t=3e5){const r=LP(e,n,t);if(!r)return e.split(` `);const s=[];let i=[];const a=[];let o=0;const l=_=>{let d=_;for(let p=a.length-1;p>=0;p--)d=f.jsx("span",{className:a[p],children:d},o++);i.push(d)},u=_=>{var d;if(_.type==="text"){(_.value??"").split(` -`).forEach((p,m)=>{m>0&&(s.push(i),i=[]),p&&l(p)});return}_.type==="element"&&(a.push((((d=_.properties)==null?void 0:d.className)??[]).join(" ")),(_.children??[]).forEach(u),a.pop())};return r.forEach(u),s.push(i),s}function BP(e){return Array.isArray(e)?e.length===0:e===""}const eA=/^\d+(?:,\d{3})*(?:\.\d+)?(?:\s*[–—-]\s*\$?\d+(?:,\d{3})*(?:\.\d+)?)?(?:\/[A-Za-z][A-Za-z0-9-]*)?/;function Xh(e,n,t){let r=n;for(;e[r]===t;)r+=1;return r-n}function bp(e,n){let t=0;for(let r=n-1;r>=0&&e[r]==="\\";r-=1)t+=1;return t%2===1}function Q3(e){var a;let n=!1,t=0,r=0,s=0;for(;r[ \t]?/.exec(e.slice(r));if(o){r+=o[0].length,s+=1;continue}const l=/^ {0,3}(?:[-+*]|\d+[.)])[ \t]+/.exec(e.slice(r));if(!l)break;r+=l[0].length,t+=l[0].length,n=!0}const i=((a=/^[ \t]*/.exec(e.slice(r)))==null?void 0:a[0].length)??0;return{hasListMarker:n,indentation:i,listIndent:t,offset:r+i,quoteDepth:s}}function T7t(e,n){const t=e[n];if(t!=="`"&&t!=="~"||bp(e,n)||Xh(e,n,t)<3)return!1;const r=e.lastIndexOf(` +`).forEach((p,m)=>{m>0&&(s.push(i),i=[]),p&&l(p)});return}_.type==="element"&&(a.push((((d=_.properties)==null?void 0:d.className)??[]).join(" ")),(_.children??[]).forEach(u),a.pop())};return r.forEach(u),s.push(i),s}function BP(e){return Array.isArray(e)?e.length===0:e===""}const eA=/^\d+(?:,\d{3})*(?:\.\d+)?(?:\s*[–—-]\s*\$?\d+(?:,\d{3})*(?:\.\d+)?)?(?:\/[A-Za-z][A-Za-z0-9-]*)?/;function Vh(e,n,t){let r=n;for(;e[r]===t;)r+=1;return r-n}function bp(e,n){let t=0;for(let r=n-1;r>=0&&e[r]==="\\";r-=1)t+=1;return t%2===1}function Q3(e){var a;let n=!1,t=0,r=0,s=0;for(;r[ \t]?/.exec(e.slice(r));if(o){r+=o[0].length,s+=1;continue}const l=/^ {0,3}(?:[-+*]|\d+[.)])[ \t]+/.exec(e.slice(r));if(!l)break;r+=l[0].length,t+=l[0].length,n=!0}const i=((a=/^[ \t]*/.exec(e.slice(r)))==null?void 0:a[0].length)??0;return{hasListMarker:n,indentation:i,listIndent:t,offset:r+i,quoteDepth:s}}function T7t(e,n){const t=e[n];if(t!=="`"&&t!=="~"||bp(e,n)||Vh(e,n,t)<3)return!1;const r=e.lastIndexOf(` `,n-1)+1,s=e.indexOf(` -`,n),i=e.slice(r,s===-1?e.length:s),a=Q3(i);return a.indentation<=3&&r+a.offset===n}function A7t(e,n){const t=e[n],r=Xh(e,n,t),s=e.lastIndexOf(` +`,n),i=e.slice(r,s===-1?e.length:s),a=Q3(i);return a.indentation<=3&&r+a.offset===n}function A7t(e,n){const t=e[n],r=Vh(e,n,t),s=e.lastIndexOf(` `,n-1)+1,i=e.indexOf(` `,n),a=Q3(e.slice(s,i===-1?e.length:i));let o=e.indexOf(` `,n+r);if(o===-1)return e.length;for(o+=1;o=a.listIndent&&d.indentation<=a.listIndent+3&&m>=r&&/^[ \t\r]*$/.test(e.slice(p+m,u)))return l===-1?e.length:l+1;if(l===-1)return e.length;o=l+1}return e.length}function R7t(e,n,t){const r=Xh(e,n,"`");let s=n+r;for(;s")return s+1}return t?e.length:null}function D7t(e){const n=[];for(let t=0;t|()[\]-]+$/.test(t)?/^[eE][+-]?\d+$/.test(t)||/[+*/=^_{}\\<>|()]/.test(t)?!0:/^[A-Za-z][A-Za-z0-9]*$/.test(t):!1:!0}function O7t(e,{predictMath:n=!1}={}){const t=D7t(e),r=new Set,s=new Set;for(let u=0;u=a.listIndent&&d.indentation<=a.listIndent+3&&m>=r&&/^[ \t\r]*$/.test(e.slice(p+m,u)))return l===-1?e.length:l+1;if(l===-1)return e.length;o=l+1}return e.length}function R7t(e,n,t){const r=Vh(e,n,"`");let s=n+r;for(;s")return s+1}return t?e.length:null}function D7t(e){const n=[];for(let t=0;t|()[\]-]+$/.test(t)?/^[eE][+-]?\d+$/.test(t)||/[+*/=^_{}\\<>|()]/.test(t)?!0:/^[A-Za-z][A-Za-z0-9]*$/.test(t):!1:!0}function O7t(e,{predictMath:n=!1}={}){const t=D7t(e),r=new Set,s=new Set;for(let u=0;u`$$${s}$$`).replace(/\\\(([\s\S]+?)\\\)/g,(r,s)=>`$$${s}$$`);return n.predictMath&&(t=t.replace(/\\\[([\s\S]*)$/,(r,s)=>`$$${s}`).replace(/\\\(([\s\S]*)$/,(r,s)=>`$$${s}`)),O7t(t,n)}function $P(e,n={}){let t="",r=0,s=0;for(;ss!==n);return{order:e.order.filter(s=>s!==n),previewKey:e.previewKey===n?null:e.previewKey,fallbackKey:r[r.length-1]??null}}function $7t(e){return e==="Enter"?"keepOpen":e===" "?"preview":null}function Ur(e,n={}){const t=r=>{n.stopPropagation&&r.stopPropagation()};return{onClick:r=>{t(r),e("preview")},onDoubleClick:r=>{t(r),e("keepOpen")},onAuxClick:r=>{r.button===1&&(r.preventDefault(),t(r),e("keepOpen"))},onKeyDown:r=>{const s=$7t(r.key);s&&(r.preventDefault(),t(r),e(s))}}}const P7t=1e5;function F7t({code:e,lang:n}){const[t,r]=R.useState(!1),s=()=>{var i;(i=navigator.clipboard)==null||i.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};return f.jsxs("div",{className:"md-code relative my-2.5 mx-0 [&_pre]:m-0 [&:hover_.md-code-copy]:opacity-100",children:[f.jsx(Qt,{size:"small",className:"md-code-copy absolute top-1.5 end-1.5 bg-background opacity-0",title:n6(),"aria-label":$5e(),onClick:s,children:t?f.jsx(Na,{size:13}):f.jsx(cb,{size:13})}),f.jsx("pre",{children:f.jsx("code",{children:j7t(e,n,P7t)})})]})}function H7t(e){const n={};for(const t of e.matchAll(/([\w-]+)=(["'])(.*?)\2/g)){const r=t[1];r&&(n[r.toLowerCase()]=t[3]??"")}return n}function nA(e,n,t){let r=n.line,s=n.column;for(let i=0;i`$$${s}$$`).replace(/\\\(([\s\S]+?)\\\)/g,(r,s)=>`$$${s}$$`);return n.predictMath&&(t=t.replace(/\\\[([\s\S]*)$/,(r,s)=>`$$${s}`).replace(/\\\(([\s\S]*)$/,(r,s)=>`$$${s}`)),O7t(t,n)}function $P(e,n={}){let t="",r=0,s=0;for(;ss!==n);return{order:e.order.filter(s=>s!==n),previewKey:e.previewKey===n?null:e.previewKey,fallbackKey:r[r.length-1]??null}}function $7t(e){return e==="Enter"?"keepOpen":e===" "?"preview":null}function Ur(e,n={}){const t=r=>{n.stopPropagation&&r.stopPropagation()};return{onClick:r=>{t(r),e("preview")},onDoubleClick:r=>{t(r),e("keepOpen")},onAuxClick:r=>{r.button===1&&(r.preventDefault(),t(r),e("keepOpen"))},onKeyDown:r=>{const s=$7t(r.key);s&&(r.preventDefault(),t(r),e(s))}}}const P7t=1e5;function F7t({code:e,lang:n}){const[t,r]=R.useState(!1),s=()=>{var i;(i=navigator.clipboard)==null||i.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};return f.jsxs("div",{className:"md-code relative my-2.5 mx-0 [&_pre]:m-0 [&:hover_.md-code-copy]:opacity-100",children:[f.jsx(Yt,{size:"small",className:"md-code-copy absolute top-1.5 end-1.5 bg-background opacity-0",title:n6(),"aria-label":$5e(),onClick:s,children:t?f.jsx(wa,{size:13}):f.jsx(lb,{size:13})}),f.jsx("pre",{children:f.jsx("code",{children:j7t(e,n,P7t)})})]})}function H7t(e){const n={};for(const t of e.matchAll(/([\w-]+)=(["'])(.*?)\2/g)){const r=t[1];r&&(n[r.toLowerCase()]=t[3]??"")}return n}function nA(e,n,t){let r=n.line,s=n.column;for(let i=0;i]*?)\/?>/gi,r=[];let s=0,i=!1;for(const a of n.matchAll(t)){const o=(a[1]??"").toLowerCase(),l=H7t(a[2]??"");if(!l[o==="run"?"id":"path"])continue;i=!0,a.index>s&&r.push({type:"text",value:n.slice(s,a.index),position:kw(e,s,a.index)});const _=a.index+a[0].length;r.push({children:[],data:{hName:o==="run"?"run-mention":"file-mention",hProperties:l},position:kw(e,a.index,_),type:o==="run"?"runMention":"fileMention"}),s=_}return i?(sPP(e)}function U7t(){return e=>{const n=t=>{var r;for(const s of["href","src"])t.properties&&Object.hasOwn(t.properties,s)&&(t.properties[s]=i$(String(t.properties[s]||"")));(r=t.children)==null||r.forEach(n)};n(e)}}function sA({path:e,lines:n,exp:t,onOpenFile:r}){const s=e.split("/").pop()||e,i=n&&Number.parseInt(n,10)||void 0,a=i!=null?`${s}:${i}`:s;return f.jsxs("button",{className:"file-chip",title:r?SQ({path:Ne(e)}):e,...Ur(o=>r==null?void 0:r(e,i,t,void 0,o)),disabled:!r,children:[f.jsx(qO,{size:12}),f.jsx("span",{className:"file-chip-label",children:a}),f.jsx(QO,{className:"file-chip-open",size:12,"aria-hidden":"true"})]})}function G7t({id:e,label:n,onOpenRun:t}){return f.jsxs("button",{className:"file-chip run-chip",title:t?BQ({id:Ne(e)}):fY({id:Ne(e)}),...Ur(r=>t==null?void 0:t(e,r)),disabled:!t,children:[f.jsx(L6,{size:12}),f.jsx("span",{className:"file-chip-label",children:n||NL()}),f.jsx(QO,{className:"file-chip-open",size:12,"aria-hidden":"true"})]})}const FP={singleDollarTextMath:!0},W7t=PS().use(WS).use(MP).use(DP,FP).use(q7t).use(bv).use(U7t).use(lP);function V7t(e){return!(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("#")||e.startsWith("//"))}const HP={code:({node:e,className:n,children:t,...r})=>{const s=n??"",i=/language-(\w+)/.exec(s),a=String(t??"").replace(/\n$/,"");if(!(i!=null||a.includes(` -`)))return f.jsx("code",{className:s,...r,children:t});const l=i?p3(i[1]):null;return f.jsx(F7t,{code:a,lang:l})},pre:({children:e})=>f.jsx(f.Fragment,{children:e})},$o=R.memo(function({text:n,onOpenFile:t,onOpenRun:r,resolveFilePath:s,resolveImageSrc:i,predict:a=!1}){Qd();const o=R.useMemo(()=>({"file-mention":l=>f.jsx(sA,{path:l.path,lines:l.lines,exp:l.exp,onOpenFile:t}),"run-mention":l=>f.jsx(G7t,{id:l.id,label:l.label,onOpenRun:r}),a:({node:l,href:u,children:_,...d})=>{if(u&&V7t(u)&&t){let p;try{p=decodeURI(u)}catch{return f.jsx("span",{children:_})}const m=s?s(p):p;return m?f.jsx(sA,{path:m,onOpenFile:t}):f.jsx("span",{children:_})}return f.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",...d,children:_})},th:({node:l,...u})=>f.jsx("th",{dir:"auto",...u}),td:({node:l,...u})=>f.jsx("td",{dir:"auto",...u}),img:({node:l,src:u,alt:_,className:d,...p})=>{if(!u||typeof u!="string")return null;const m=i?i(u):u;return m?f.jsx("img",{...p,src:m,alt:_??"",loading:"lazy",className:`block max-w-full h-auto my-3 rounded-sm border border-border ${d??""}`}):null},...HP}),[t,r,s,i]);return f.jsx("div",{dir:"auto","data-streaming":a||void 0,className:"md min-w-0 wrap-anywhere text-text leading-[1.62] [&_>_*:first-child]:mt-0 [&_>_*:last-child]:mb-0 [&_p]:my-2.5 [&_p]:mx-0 [&_strong]:text-text [&_strong]:font-semibold [&_pre]:bg-surface [&_pre]:border [&_pre]:border-border-muted [&_pre]:rounded-md [&_pre]:py-2 [&_pre]:px-3 [&_pre]:overflow-x-auto [&_pre]:text-sm [&_pre]:text-text [&_code]:font-mono [&_code]:text-sm [&_code]:font-medium [&_code]:text-primary [&_code]:bg-panel [&_code]:border [&_code]:border-border-variant [&_code]:rounded-xs [&_code]:py-px [&_code]:px-[5px] [&_.katex]:text-prose-emphasis [&_.katex-display]:my-3 [&_.katex-display]:mx-0 [&_.katex-display]:overflow-x-auto [&_.katex-display]:overflow-y-hidden [&_.katex-display]:py-0.5 [&_.katex-display]:px-0 [&_.file-chip]:inline-flex [&_.file-chip]:items-center [&_.file-chip]:gap-1 [&_.file-chip]:max-w-full [&_.file-chip]:my-0 [&_.file-chip]:mx-px [&_.file-chip]:py-0 [&_.file-chip]:px-1.5 [&_.file-chip]:align-baseline [&_.file-chip]:font-mono [&_.file-chip]:text-sm [&_.file-chip]:font-medium [&_.file-chip]:text-text [&_.file-chip]:bg-panel [&_.file-chip]:border [&_.file-chip]:border-border-variant [&_.file-chip]:rounded-xs [&_.file-chip]:cursor-pointer [&_.file-chip:hover:not(:disabled)]:bg-surface [&_.file-chip:hover:not(:disabled)]:text-primary [&_.file-chip_svg]:flex-none [&_.file-chip_svg]:opacity-60 [&_.file-chip-label]:max-w-65 [&_.file-chip-label]:overflow-hidden [&_.file-chip-label]:text-ellipsis [&_.file-chip-label]:whitespace-nowrap [&_.run-chip_svg]:opacity-100 [&_.run-chip_svg]:text-primary [&_pre_code]:bg-none [&_pre_code]:bg-transparent [&_pre_code]:border-0 [&_pre_code]:text-inherit [&_pre_code]:p-0 [&_pre_code]:font-normal [&_h1]:text-text [&_h1]:text-prose-emphasis [&_h1]:font-semibold [&_h1]:mt-3 [&_h1]:mx-0 [&_h1]:mb-1.5 [&_h2]:text-text [&_h2]:text-prose-emphasis [&_h2]:font-semibold [&_h2]:mt-3 [&_h2]:mx-0 [&_h2]:mb-1.5 [&_h3]:text-text [&_h3]:text-prose-emphasis [&_h3]:font-semibold [&_h3]:mt-3 [&_h3]:mx-0 [&_h3]:mb-1.5 [&_h4]:text-text [&_h4]:text-prose-emphasis [&_h4]:font-semibold [&_h4]:mt-3 [&_h4]:mx-0 [&_h4]:mb-1.5 [&_ul]:my-1.5 [&_ul]:mx-0 [&_ul]:ps-5.5 [&_ol]:my-1.5 [&_ol]:mx-0 [&_ol]:ps-5.5 [&_li::marker]:text-primary [&_a]:text-primary [&_table]:border-collapse [&_table]:block [&_table]:w-max [&_table]:max-w-full [&_table]:text-sm [&_table]:my-2.5 [&_table]:mx-0 [&_table]:border [&_table]:border-border [&_table]:rounded-md [&_table]:overflow-x-auto [&_th]:border-b [&_th]:border-b-border-variant [&_th]:py-2 [&_th]:px-3.5 [&_th]:text-start [&_th]:text-text [&_th]:break-normal [&_th]:break-words [&_td]:border-b [&_td]:border-b-border-variant [&_td]:py-2 [&_td]:px-3.5 [&_td]:text-start [&_td]:text-text [&_td]:break-normal [&_td]:break-words [&_tr:last-child_td]:border-b-0 [&_thead_th]:bg-surface [&_thead_th]:font-medium [&_thead_th]:text-text [&_thead_th]:border-b [&_thead_th]:border-b-border [&_tbody_tr:hover_td]:bg-surface-bright [&_blockquote]:my-1.5 [&_blockquote]:mx-0 [&_blockquote]:pt-0.5 [&_blockquote]:pe-0 [&_blockquote]:pb-0.5 [&_blockquote]:ps-2.5 [&_blockquote]:border-s-[3px] [&_blockquote]:border-s-border [&_blockquote]:text-subtext [:is(&,_.openresearch-diff,_.file-view)_.token.comment]:italic [:is(&,_.openresearch-diff,_.file-view)_.token.prolog]:italic [:is(&,_.openresearch-diff,_.file-view)_.token.cdata]:italic [:is(&,_.openresearch-diff,_.file-view)_.token.operator]:text-syntax-cyan [:is(&,_.openresearch-diff,_.file-view)_.token.entity]:text-syntax-cyan [:is(&,_.openresearch-diff,_.file-view)_.token.url]:text-syntax-cyan [:is(&,_.openresearch-diff,_.file-view)_.token.comment]:text-syntax-comment [:is(&,_.openresearch-diff,_.file-view)_.token.prolog]:text-syntax-comment [:is(&,_.openresearch-diff,_.file-view)_.token.cdata]:text-syntax-comment [:is(&,_.openresearch-diff,_.file-view)_.token.punctuation]:text-syntax-text [:is(&,_.openresearch-diff,_.file-view)_.token.property]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.tag]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.deleted]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.constant]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.symbol]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.boolean]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.number]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.selector]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.attr-name]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.char]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.inserted]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.string]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.builtin]:text-syntax-yellow [:is(&,_.openresearch-diff,_.file-view)_.token.atrule]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.attr-value]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.keyword]:text-syntax-purple [:is(&,_.openresearch-diff,_.file-view)_.token.function]:text-syntax-blue [:is(&,_.openresearch-diff,_.file-view)_.token.decorator]:text-syntax-blue [:is(&,_.openresearch-diff,_.file-view)_.token.def]:text-syntax-blue [:is(&,_.openresearch-diff,_.file-view)_.token.class-name]:text-syntax-yellow [:is(&,_.openresearch-diff,_.file-view)_.token.namespace]:text-syntax-yellow [:is(&,_.openresearch-diff,_.file-view)_.token.regex]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.important]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.variable]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.parameter]:text-syntax-text",children:f.jsx(L3t,{content:$P(n,{predictMath:a}),processor:W7t,components:o,predict:a})})}),iA="prompt-actions plan-strip-actions flex flex-wrap justify-end gap-x-2 gap-y-1.5";function K7t({synthesized:e,agentLabel:n,onView:t,onApprove:r,showResumeModes:s,onReject:i,onRevise:a}){const[o,l]=R.useState(!1),u=R.useRef(null),[_,d]=R.useState(!1),[p,m]=R.useState(""),x=R.useRef(null);R.useEffect(()=>{if(!o)return;const v=b=>{u.current&&!u.current.contains(b.target)&&l(!1)};return window.addEventListener("pointerdown",v),()=>window.removeEventListener("pointerdown",v)},[o]),R.useEffect(()=>{var v;_&&((v=x.current)==null||v.focus())},[_]);const S=()=>{a(p.trim()||"no specific feedback — use your judgment"),m(""),d(!1)};return f.jsxs("div",{className:"plan-strip relative w-full mt-0 mx-0 mb-2.5 py-[11px] px-[13px] flex flex-col items-stretch gap-2.5 border border-border border-s-[3px] border-s-accent-blue rounded-md bg-surface shadow-plan",children:[f.jsxs("div",{className:"plan-strip-info flex items-baseline gap-2 min-w-0",children:[f.jsx(L6,{size:14,className:"plan-strip-icon text-accent-blue shrink-0 self-center"}),f.jsx("span",{dir:"auto",className:"plan-strip-title text-sm font-semibold whitespace-nowrap",children:e?nAe({agent:Ne(n)}):ZTe({agent:Ne(n)})}),f.jsx("button",{className:"plan-strip-open ms-auto p-0 border-0 bg-none bg-transparent text-accent-blue text-sm cursor-pointer whitespace-nowrap shrink-0 [&:hover]:underline",...Ur(t),children:_Ae()})]}),_?f.jsxs(f.Fragment,{children:[f.jsx("textarea",{dir:"auto",ref:x,className:"plan-strip-revise-input w-full resize-none border border-border rounded-md py-[9px] px-[11px] text-sm font-[inherit] bg-background text-text [&:focus]:border-accent-blue",placeholder:TAe(),rows:2,value:p,onChange:v=>m(v.target.value),onKeyDown:v=>{v.key==="Escape"?(v.preventDefault(),m(""),d(!1)):v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),S())}}),f.jsxs("div",{className:iA,children:[f.jsx(Oe,{size:"small",onClick:()=>{m(""),d(!1)},children:aAe()}),f.jsx("span",{className:"plan-strip-spacer flex-1"}),f.jsxs(Oe,{size:"small",variant:"primary",onClick:S,children:[wAe(),f.jsx(FO,{size:13})]})]})]}):f.jsxs("div",{className:iA,children:[f.jsx(Oe,{size:"small",onClick:i,children:vAe()}),f.jsx(Oe,{size:"small",onClick:()=>d(!0),children:EAe()}),f.jsx("span",{className:"plan-strip-spacer flex-1"}),s?f.jsxs("div",{className:"plan-strip-approve relative flex",ref:u,children:[f.jsx(Oe,{size:"small",variant:"primary",className:"rounded-e-none",onClick:()=>r("auto"),children:PTe()}),f.jsx(Oe,{size:"small",variant:"primary",className:"rounded-s-none border-s-plan-caret px-1.5","aria-label":uAe(),onClick:()=>l(v=>!v),children:f.jsx(qo,{size:13})}),o&&f.jsx("div",{className:"plan-strip-menu absolute end-0 bottom-[calc(100%_+_4px)] flex min-w-47.5 flex-col rounded-md border border-border bg-surface p-1 shadow-plan-menu z-6",children:f.jsx(sr,{onClick:()=>{l(!1),r("bypassPermissions")},children:UTe()})})]}):f.jsx(Oe,{size:"small",variant:"primary",onClick:()=>r(),children:KTe()})]})]})}function aA({save:e,onSaved:n,placeholder:t,createHref:r,createLabel:s}){const[i,a]=R.useState(""),[o,l]=R.useState(!1),[u,_]=R.useState(null);async function d(p){if(p.preventDefault(),!(o||!i.trim())){l(!0),_(null);try{n(await e(i.trim())),a("")}catch(m){_(m instanceof Error?m.message:String(m))}finally{l(!1)}}}return f.jsxs("form",{className:"onb-token-form flex items-center flex-wrap gap-2 mt-2 [&_input]:flex-1 [&_input]:min-w-55 [&_input]:text-sm [&_a]:text-sm [&_a]:text-subtext [&_a]:whitespace-nowrap [&_.error]:basis-full [&_.error]:text-accent-red [&_.error]:text-sm [&_.error]:whitespace-pre-wrap",onSubmit:d,children:[f.jsx("input",{type:"password",value:i,onChange:p=>a(p.target.value),placeholder:t,autoComplete:"off"}),f.jsx(Oe,{type:"submit",disabled:o||!i.trim(),children:o?ea():Ho()}),f.jsx("a",{href:r,target:"_blank",rel:"noreferrer",children:s??Gwe()}),u&&f.jsx("div",{className:"error",children:u})]})}function qP({value:e,max:n,label:t,caption:r,fillColor:s}){const i=n>0?Math.min(100,Math.round(e/n*100)):0;return f.jsxs("div",{className:"progress mt-3 mx-0 mb-1",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:[f.jsx("div",{className:"progress-track h-2 rounded-full bg-surface border border-border overflow-hidden",children:f.jsx("div",{className:"progress-fill h-full bg-accent rounded-full transition-[width] duration-200 ease-standard",style:{width:`${i}%`,background:s}})}),(t!==void 0||r!==void 0)&&f.jsxs("div",{className:"progress-caption flex justify-between mt-1.5 text-sm text-muted",children:[f.jsx("span",{children:t??`${i}%`}),r]})]})}const Nv="code-source-text",UP="code-source-wrap",GP="file-view-gutter text-right text-muted select-none";function WP(e){const n=String(e).length+2;return{ruleCh:n,codeCh:n+2}}function VP({value:e,onChange:n,onSave:t,onBlur:r,readOnly:s=!1,path:i,highlightLine:a,scrollRequest:o,onScrollRequestHandled:l,scrollPosition:u,onScrollPositionChange:_}){const d=R.useMemo(()=>IP(e,TS(i)),[e,i]),{ruleCh:p,codeCh:m}=WP(d.length),x=R.useRef(null),S=R.useRef(null),v=()=>{const C=x.current;C&&S.current&&(S.current.scrollTop=C.scrollTop)},b=R.useRef(u);R.useLayoutEffect(()=>{const C=x.current;!C||!b.current||(C.scrollTop=b.current.top,C.scrollLeft=b.current.left,v())},[i]),R.useLayoutEffect(v,[e]),R.useLayoutEffect(()=>{var M;const C=x.current;if(!C||!a||o===void 0)return;const E=e.split(` -`),N=Math.min(Math.max(Math.trunc(a),1),E.length);let T=0;for(let O=0;O{if(!s){if((C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="s"){C.preventDefault(),t();return}if(C.key==="Tab"){C.preventDefault();const E=C.currentTarget,{selectionStart:N,selectionEnd:T}=E,z=e.slice(0,N)+" "+e.slice(T);n(z),requestAnimationFrame(()=>{E.selectionStart=E.selectionEnd=N+1})}}},y=`absolute inset-0 m-0 py-3.5 pe-4 ${Nv} ${UP} [scrollbar-gutter:stable]`;return f.jsxs("div",{className:`file-view-editwrap relative h-full min-h-0 ${Nv}`,children:[f.jsx("div",{className:"absolute start-0 top-0 bottom-0 border-e border-e-border-variant pointer-events-none",style:{width:`${p}ch`},"aria-hidden":"true"}),f.jsx("div",{ref:S,className:`file-view-code ${y} overflow-hidden pointer-events-none`,"aria-hidden":"true",children:d.map((C,E)=>f.jsxs("div",{"data-line":E+1,className:"relative",style:{paddingInlineStart:`${m}ch`},children:[f.jsx("span",{className:`${GP} absolute start-0 pe-[1ch]`,style:{width:`${p}ch`},children:E+1}),BP(C)?f.jsx("br",{}):C]},E))}),f.jsx("textarea",{ref:x,className:`file-view-editarea ${y} overflow-y-auto overflow-x-hidden resize-none border-0 bg-transparent text-transparent caret-text outline-none`,style:{paddingInlineStart:`${m}ch`},value:e,onChange:C=>{s||n(C.target.value)},onScroll:C=>{v(),_==null||_({top:Math.max(0,C.currentTarget.scrollTop),left:Math.max(0,C.currentTarget.scrollLeft)})},onKeyDown:w,onBlur:s?void 0:r,readOnly:s,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"})]})}function KP({onClose:e,onSaved:n}){const t=Rft(),r=ct(t),[s,i]=R.useState(()=>r.data??null),[a,o]=R.useState(()=>{var y;return((y=r.data)==null?void 0:y.content)??""}),l=!s&&r.error?r.error.message:null,u=gn({mutationFn:({content:y,previous:C})=>pdt(y,C)}),[_,d]=R.useState(!1),p=R.useRef(null),m=R.useRef(e),x=s!==null&&a!==s.content,S=R.useRef(x),v=R.useRef(_);S.current=x,v.current=_,m.current=e,R.useEffect(()=>{!r.data||S.current||v.current||(i(r.data),o(r.data.content))},[r.data]);const b=()=>{v.current||S.current&&!window.confirm(Zrt())||m.current()};ib(p,b,"textarea");async function w(){if(!(!s||!x||_)){d(!0);try{if(await u.mutateAsync({content:a,previous:s.content}),!Pn(t.queryKey))return;Gr(t.queryKey,{...s,content:a}),i({...s,content:a}),n==null||n(),Kn(ast(),"success")}catch(y){Kn(y instanceof Error?y.message:String(y),"error")}finally{d(!1)}}}return no.createPortal(f.jsx("div",{className:"fixed inset-0 z-200 flex items-center justify-center bg-modal-backdrop p-5",onClick:y=>{y.target===y.currentTarget&&b()},children:f.jsxs("div",{ref:p,className:"relative flex h-[min(48rem,calc(100vh-2.5rem))] w-200 max-w-full flex-col overflow-hidden rounded-xl border border-border bg-background shadow-modal",role:"dialog","aria-modal":"true","aria-labelledby":"ssh-config-dialog-title",tabIndex:-1,children:[f.jsxs("div",{className:"shrink-0 px-6 pt-5 pb-4 pe-14",children:[f.jsx("h2",{id:"ssh-config-dialog-title",className:"m-0 text-xl font-medium",children:ust()}),f.jsx("code",{className:"mt-1 block font-mono text-sm text-subtext",children:"~/.ssh/config"})]}),f.jsx(Qt,{className:"absolute end-3.5 top-3.5","aria-label":Krt(),onClick:b,disabled:_,children:f.jsx(qr,{size:16})}),f.jsx("div",{className:"file-view min-h-0 flex-1 border-y border-border-variant bg-background",children:l?f.jsx("p",{className:"m-5 text-sm text-accent-red",children:l}):s===null?f.jsxs("div",{className:"flex items-center gap-2 p-5 text-sm text-subtext",children:[f.jsx(Lt,{})," ",nst()]}):f.jsx(VP,{value:a,onChange:o,onSave:()=>void w(),path:s.path})}),f.jsxs("div",{className:"flex shrink-0 justify-end gap-2.5 p-4",children:[f.jsx(Oe,{onClick:b,disabled:_,children:Ad()}),f.jsx(Oe,{variant:"primary",onClick:()=>void w(),disabled:!x||_,children:_?ea():Ho()})]})]})}),document.body)}const Po=["settings-card [&_>_.error]:text-accent-red [&_>_.error]:text-base","[&_>_.error]:whitespace-pre-wrap bg-background border border-border","rounded-lg py-4 px-4.5 mb-4 [&_h3]:mt-0 [&_h3]:mx-0 [&_h3]:mb-2.5","[&_h3]:text-base [&_h3]:font-semibold [&_h3]:text-text","[&_.settings-sub]:mb-3 [&_.kv]:gap-y-1.5 [&_.kv]:gap-x-4.5","[&_>_.project-default-row:first-child]:pt-0 [&_>_.project-default-row:first-child]:border-t-0"].join(" "),Bd=["kv grid grid-cols-[auto_1fr] items-baseline gap-y-[3px] gap-x-3.5 text-base","[&_.k]:text-sm [&_.k]:text-subtext [&_.v]:text-base [&_.v]:text-text","[&_.v]:break-all"].join(" "),Q7t=["grid grid-cols-[9rem_minmax(0,1fr)] items-center gap-x-5 gap-y-2.5 font-sans text-base text-text","[&_.k]:font-medium [&_.k]:text-sm [&_.k]:text-text","[&_.v]:min-w-0 [&_.v]:flex [&_.v]:items-center [&_.v]:flex-wrap [&_.v]:gap-2","[&_.v]:font-sans [&_.v]:text-base [&_.v]:text-text [&_.v]:break-words"].join(" "),Xb="mt-3 mx-0 mb-0 ps-3 border-s-2 border-s-accent-red font-sans text-base leading-relaxed text-text whitespace-pre-wrap",Ca=["settings-note mt-2.5 mx-0 mb-0 text-base py-2 px-2.5","border border-accent-amber rounded-md bg-accent-amber-subtle","text-accent-amber font-medium"].join(" "),pk=["form font-sans text-sm text-text [&_.form-seg]:self-start [&_.form-seg]:mb-0.5","[&_.form-seg_button]:py-[5px] [&_.form-seg_button]:px-3","[&_.repo-hint]:font-normal [&_.repo-hint]:text-sm","[&_.repo-hint]:text-muted [&_.repo-hint.ok]:text-accent-teal","[&_.folder-picker-control]:flex [&_.folder-picker-control]:items-center","[&_.folder-picker-control]:gap-[9px] [&_.folder-picker-control]:w-full","[&_.folder-picker-control]:min-w-0 [&_.folder-picker-control]:py-2 [&_.folder-picker-control]:px-2.5","[&_.folder-picker-control]:overflow-hidden [&_.folder-picker-control]:bg-background","[&_.folder-picker-control]:border [&_.folder-picker-control]:border-border","[&_.folder-picker-control]:rounded-md [&_.folder-picker-control]:cursor-pointer","[&_.folder-picker-control]:text-start","[&_.folder-picker-control]:transition-[border-color,box-shadow] [&_.folder-picker-control]:duration-120 [&_.folder-picker-control]:ease-standard","[&_.folder-picker-control:hover:not(:disabled)]:border-muted","[&_.folder-picker-control:hover:not(:disabled)]:shadow-control-subtle","[&_.folder-picker-control:focus-visible]:outline-2 [&_.folder-picker-control:focus-visible]:outline-solid [&_.folder-picker-control:focus-visible]:outline-text","[&_.folder-picker-control:focus-visible]:outline-offset-2 [&_.folder-picker-control_span]:flex-1","[&_.folder-picker-control_span]:min-w-0 [&_.folder-picker-control_span]:overflow-hidden","[&_.folder-picker-control_span]:text-ellipsis [&_.folder-picker-control_span]:whitespace-nowrap","[&_.folder-picker-control_.placeholder]:text-muted [&_.folder-picker-icon]:flex-none","[&_.folder-picker-icon]:text-current [&_.folder-picker-chevron]:flex-none","[&_.folder-picker-chevron]:text-muted","[&_.folder-picker-control:hover:not(:disabled)_.folder-picker-chevron]:text-subtext","[&_.folder-picker-hint]:text-subtext [&_.folder-picker-hint]:text-sm","[&_.folder-picker-hint]:font-normal [&_.folder-picker-hint]:leading-[1.4]","[&_.project-location-field]:flex [&_.project-location-field]:flex-col","[&_.project-location-field]:gap-2 [&_.project-location-label]:text-text","[&_.project-location-label]:text-base","[&_.project-location-label]:font-medium [&_.project-field-label]:text-text","[&_.project-field-label]:text-base [&_.project-field-label]:font-medium","[&_.folder-picker-control:disabled]:cursor-default [&_.folder-picker-control:disabled]:opacity-65","[&_.paper-destination]:flex [&_.paper-destination]:items-center","[&_.paper-destination]:gap-2.5 [&_.paper-destination]:pt-2 [&_.paper-destination]:pe-2 [&_.paper-destination]:pb-2 [&_.paper-destination]:ps-3","[&_.paper-destination]:border [&_.paper-destination]:border-border [&_.paper-destination]:rounded-md","[&_.paper-destination]:bg-background [&_.paper-destination_code]:flex-1","[&_.paper-destination_code]:min-w-0 [&_.paper-destination_code]:overflow-hidden","[&_.paper-destination_code]:text-text [&_.paper-destination_code]:text-sm","[&_.paper-destination_code]:font-normal","[&_.paper-destination_code]:text-ellipsis [&_.paper-destination_code]:whitespace-nowrap","[&_.paper-destination_.btn]:flex-none [&_.project-path-notice]:py-[9px] [&_.project-path-notice]:px-[11px]","[&_.project-path-notice]:border [&_.project-path-notice]:border-border-variant","[&_.project-path-notice]:rounded-sm [&_.project-path-notice]:bg-surface","[&_.project-path-notice]:text-base [&_.project-path-notice]:leading-relaxed [&_.project-path-notice]:text-text","[&_.project-path-notice]:leading-[1.4]","[&_.project-path-notice.error]:border-danger-notice-border","[&_.paper-results]:flex [&_.paper-results]:flex-col","[&_.paper-results]:border [&_.paper-results]:border-border [&_.paper-results]:rounded-md","[&_.paper-results]:max-h-60 [&_.paper-results]:overflow-y-auto","[&_.paper-results_button]:flex [&_.paper-results_button]:flex-col","[&_.paper-results_button]:items-start [&_.paper-results_button]:gap-0.5","[&_.paper-results_button]:py-2 [&_.paper-results_button]:px-2.5 [&_.paper-results_button]:bg-none [&_.paper-results_button]:bg-transparent","[&_.paper-results_button]:border-0","[&_.paper-results_button]:border-b [&_.paper-results_button]:border-b-border-variant","[&_.paper-results_button]:text-start [&_.paper-results_button]:[font:inherit]","[&_.paper-results_button]:text-text [&_.paper-results_button]:cursor-pointer","[&_.paper-results_button:last-child]:border-b-0","[&_.paper-results_button:hover]:bg-surface [&_.paper-results_.title]:text-sm","[&_.paper-results_.title]:font-medium","[&_.paper-results_.id]:text-xs [&_.paper-results_.id]:text-muted","[&_.paper-pick_.id]:text-xs","[&_.paper-pick_.id]:text-muted [&_.paper-pick]:flex [&_.paper-pick]:items-center","[&_.paper-pick]:justify-between [&_.paper-pick]:gap-2.5 [&_.paper-pick]:py-2.5 [&_.paper-pick]:px-3","[&_.paper-pick]:border [&_.paper-pick]:border-border [&_.paper-pick]:rounded-md","[&_.paper-pick]:bg-surface [&_.paper-pick_.meta]:min-w-0","[&_.paper-pick_.title]:text-sm [&_.paper-pick_.title]:font-medium","flex flex-col gap-2.5 [&_label]:flex [&_label]:flex-col","[&_label]:gap-1 [&_label]:text-sm [&_label]:text-text","[&_label]:font-medium [&_.row2]:grid [&_.row2]:grid-cols-2","[&_input]:font-sans [&_input]:text-sm [&_input]:font-normal [&_input]:text-text [&_input::placeholder]:text-subtext","[&_select]:font-sans [&_select]:text-sm [&_select]:font-normal [&_select]:text-text","[&_.row2]:gap-2.5 [&_.actions]:flex [&_.actions]:justify-end","[&_.actions]:gap-2.5 [&_.actions]:mt-1.5 [&_.new-project-actions]:justify-start","[&_.new-project-actions]:mt-2.5","[&_.error]:text-accent-red [&_.error]:text-base [&_.error]:whitespace-pre-wrap","settings-form mt-3.5 pt-3.5 border-t border-t-border"].join(" "),Ll=["project-default-row flex items-center justify-between gap-6","pt-3.5 border-t border-t-border-variant [&_p]:mt-[3px] [&_p]:mx-0 [&_p]:mb-0","[&_.project-default-title]:text-base [&_p]:text-sm [&_p]:leading-relaxed [&_p]:text-text"].join(" "),Y3=["settings-card [&_>_.error]:text-accent-red [&_>_.error]:text-base","[&_>_.error]:whitespace-pre-wrap bg-background border border-border","rounded-lg mb-4 [&_h3]:mt-0 [&_h3]:mx-0 [&_h3]:mb-2.5 [&_h3]:text-base","[&_h3]:font-semibold [&_h3]:text-text [&_.settings-sub]:mb-3","[&_>_.project-default-row:first-child]:pt-0 [&_>_.project-default-row:first-child]:border-t-0","git-settings-card py-3.5 px-4 [&_h3]:mb-3","[&_.kv]:grid-cols-[132px_minmax(0,_1fr)] [&_.kv]:items-center [&_.kv]:gap-y-[9px] [&_.kv]:gap-x-4.5","[&_.kv_.k]:text-sm [&_.kv_.v]:flex [&_.kv_.v]:items-center","[&_.kv_.v]:flex-wrap [&_.kv_.v]:gap-[7px] [&_.kv_.v]:min-w-0 [&_.kv_.v]:font-sans","[&_.kv_.v]:text-base [&_.kv_.v]:break-normal","[@media((max-width:_640px))]:[&_.kv]:grid-cols-1","[@media((max-width:_640px))]:[&_.kv]:gap-[3px] [@media((max-width:_640px))]:[&_.kv_.v_+_.k]:mt-[7px]"].join(" "),G0=["git-card-actions flex flex-wrap gap-2 mt-3.5 pt-3.5","border-t border-t-border-variant"].join(" "),Wf=["settings-stack-section [&_+_.settings-stack-section]:mt-6 [&_>_:last-child]:mb-0","[&_>_h2]:mt-0 [&_>_h2]:mx-0 [&_>_h2]:mb-1.5 [&_>_h2]:text-xl"].join(" ");function Cw(e){return e.agentReady?{cls:"ok",variant:"success",label:e.authMethod==="local"?s6():ZYe()}:e.installed?e.installBroken?{cls:"warn",variant:"warning",label:XGe()}:e.authMethod==="local"?{cls:"warn",variant:"warning",label:GD()}:e.authState==="unknown"?{cls:"warn",variant:"warning",label:A4()}:e.authState==="unsupported"?{cls:"warn",variant:"warning",label:fZe()}:{cls:"warn",variant:"warning",label:_L()}:{cls:"warn",variant:"warning",label:CKe()}}function Y7t({h:e}){return e.authMethod?e.authMethod==="local"?f.jsx(f.Fragment,{children:i6()}):f.jsx(f.Fragment,{children:e.authMethod==="oauth"?EHe():r6()}):f.jsx(f.Fragment,{children:"—"})}function X7t(){const e=fu(),{data:n=null}=ct(e),[t,r]=R.useState("claude-code"),[s,i]=R.useState(!1),a=(l,u=!1)=>{i(!0),nb(l,u).catch(()=>{}).finally(()=>i(!1))},o=n==null?void 0:n.find(l=>l.id===t);return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:RGe()}),f.jsx("div",{className:"harness-tabs mt-3 flex gap-1 mb-3.5 border-b border-b-border-variant [&_button]:inline-flex [&_button]:items-center [&_button]:gap-[7px] [&_button]:py-[7px] [&_button]:px-3 [&_button]:text-sm [&_button]:font-medium [&_button]:text-text [&_button]:border-b-2 [&_button]:border-b-transparent [&_button]:-mb-px [&_button:hover]:text-text [&_button.active]:border-b-primary",children:(n??[]).map(l=>f.jsxs("button",{className:l.id===t?"active":"",onClick:()=>r(l.id),children:[l.name,f.jsx("span",{className:`w-[7px] h-[7px] rounded-full bg-muted [&.ok]:bg-accent-green [&.err]:bg-accent-red [&.warn]:bg-accent-amber ${Cw(l).cls}`})]},l.id))}),n?o?f.jsxs("div",{className:Po,children:[f.jsxs("div",{className:"settings-card-head flex items-center gap-2.5 mb-3",children:[f.jsx(Ft,{variant:Cw(o).variant,children:Cw(o).label}),f.jsx("div",{className:"spacer flex-1"}),f.jsxs(Oe,{size:"small",onClick:()=>a(!0,!0),disabled:s,children:[f.jsx(Aa,{size:12,className:s?"animate-[spin_0.9s_linear_infinite]":""})," ",Yp()]})]}),f.jsxs("div",{className:Bd,children:[f.jsx("span",{className:"k",children:yqe()}),f.jsx("span",{className:"v",children:o.binPath??dHe()}),f.jsx("span",{className:"k",children:yL()}),f.jsx("span",{className:"v",children:o.version??"—"}),f.jsx("span",{className:"k",children:nqe()}),f.jsx("span",{className:"v",children:f.jsx(Y7t,{h:o})}),o.account&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"k",children:o.id==="opencode"?GZe():c6()}),f.jsx("span",{className:"v",children:o.account})]}),o.org&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"k",children:lQe()}),f.jsx("span",{className:"v",children:o.org})]}),o.plan&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"k",children:$Qe()}),f.jsx("span",{className:"v",children:o.plan})]}),f.jsx("span",{className:"k",children:QHe()}),f.jsx("span",{className:"v",children:o.models.length>0?iL({count:Wt(o.models.length),models:new Intl.ListFormat(j()).format(o.models.slice(0,4).map(l=>Ne(I0(l))))}):l6()})]}),o.agentNote&&f.jsx("p",{className:Ca,children:tm(o.agentNote)}),o.id==="opencode"&&f.jsx(oI,{installed:o.installed})]}):null:f.jsxs(ss,{children:[f.jsx(Lt,{})," ",JUe()]})]})}function Z7t({s:e}){const n=e.preflight;return n.kubectlFound?n.reachable?n.canCreateJobs?f.jsx(Ft,{variant:"success",children:uUe()}):f.jsx(Ft,{variant:"error",children:QVe()}):f.jsx(Ft,{variant:"error",children:Jqe()}):f.jsx(Ft,{variant:"error",children:yWe()})}function J7t({onEditState:e}){var T;const n=gn({mutationFn:idt}),t=PN(),r=ct(t),s=r.data??null,i=z=>{Gr(t.queryKey,M=>(typeof z=="function"?z(M??null):z)??void 0)},a=s?null:((T=r.error)==null?void 0:T.message)??null,[o,l]=R.useState(""),[u,_]=R.useState(""),[d,p]=R.useState(!1),[m,x]=R.useState(!1),[S,v]=R.useState(null),b=z=>{i(z),l(z.context??""),_(z.namespace)},w=R.useRef(null);R.useEffect(()=>{const z=w.current;w.current=s,s&&(!z||o===(z.context??"")&&u.trim()===z.namespace)&&(l(s.context??""),_(s.namespace??""))},[s,o,u]);const y=s!==null&&o===(s.context??"")&&u.trim()===s.namespace,C=s!==null&&!y;R.useEffect(()=>{e==null||e({dirty:C,saving:d})},[C,d,e]);async function E(){if(!(m||d||!y)){x(!0);try{await nt.fetchQuery({...PN(),staleTime:0})}catch(z){Kn(z instanceof Error?z.message:String(z),"error")}finally{x(!1)}}}async function N(z){if(z.preventDefault(),!(d||m)){p(!0),v(null);try{b(await n.mutateAsync({context:o,namespace:u.trim()}))}catch(M){v(M instanceof Error?M.message:String(M))}finally{p(!1)}}}return f.jsx(f.Fragment,{children:a?f.jsx("p",{className:"m-0 text-sm text-accent-red whitespace-pre-wrap break-words",children:a}):s?f.jsxs(f.Fragment,{children:[f.jsxs("dl",{className:"m-0 flex items-center justify-between gap-4 text-sm",children:[f.jsx("dt",{className:"text-subtext",children:o_()}),f.jsx("dd",{className:"m-0",children:m||d?f.jsx(Ft,{children:Yi()}):C?f.jsx(Ft,{children:DD()}):f.jsx(Z7t,{s})})]}),y&&!m&&!d&&s.preflight.error&&f.jsx("p",{className:`${Xb} break-words`,children:s.preflight.error}),f.jsxs("form",{className:"mt-5 flex flex-col gap-4",onSubmit:N,children:[f.jsxs("label",{className:"flex flex-col gap-2 text-sm font-medium text-subtext",children:[_Ue(),f.jsx(Ld,{choices:[{id:"",label:s.currentContext?WPe({context:Ne(s.currentContext)}):HPe()},...o&&!s.contexts.includes(o)?[{id:o,label:pHe({context:Ne(o)})}]:[],...s.contexts.map(z=>({id:z,label:z}))],value:o,variant:"field",dropDown:!0,disabled:d||m,onSelect:l})]}),f.jsxs("label",{className:"flex flex-col gap-2 text-sm font-medium text-subtext",children:[xVe(),f.jsx(rs,{type:"text",value:u,disabled:d||m,onChange:z=>_(z.target.value),placeholder:BUe(),autoComplete:"off",spellCheck:!1})]}),S&&f.jsx("p",{className:"m-0 text-sm text-accent-red whitespace-pre-wrap break-words",children:S}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsxs(Oe,{type:"button",onClick:()=>void E(),disabled:d||m||!y,children:[f.jsx(Aa,{size:13})," ",m?Yi():Kp()]}),f.jsx(Oe,{variant:"primary",type:"submit",disabled:d||m||y,children:d?ea():Ho()})]})]})]}):f.jsxs(ss,{children:[f.jsx(Lt,{})," ",Lqe()]})})}function e8t(){var y;const e=gn({mutationFn:C=>odt(...C)}),n=FN(),t=ct(n),r=t.data??null,s=C=>{Gr(n.queryKey,E=>(typeof C=="function"?C(E??null):C)??void 0)},[i,a]=R.useState(null),o=i??((y=t.error)==null?void 0:y.message)??null,[l,u]=R.useState(""),[_,d]=R.useState(""),[p,m]=R.useState(!1),x=t.isPending||p,[S,v]=R.useState(!1);async function b(){if(!(x||S)){m(!0),a(null);try{await nt.fetchQuery({...FN(),staleTime:0})}catch(C){a(C instanceof Error?C.message:String(C))}finally{m(!1)}}}async function w(C){if(C.preventDefault(),!(!l.trim()||!_.trim()||x||S||r!=null&&r.processEnv)){v(!0),a(null);try{s(await e.mutateAsync([l.trim(),_.trim()])),u(""),d("")}catch(E){a(E instanceof Error?E.message:String(E))}finally{v(!1)}}}return f.jsxs(f.Fragment,{children:[!r&&x?f.jsxs(ss,{children:[f.jsx(Lt,{})," ",$qe()]}):r&&f.jsxs("dl",{className:"m-0 flex items-center justify-between gap-4 text-sm",children:[f.jsx("dt",{className:"font-medium text-subtext",children:o_()}),f.jsx("dd",{className:"m-0",children:f.jsx(Ft,{variant:r.tokenConfigured?"success":"warning",children:r.tokenConfigured?d6():Jv()})})]}),(r==null?void 0:r.processEnv)&&f.jsx("p",{className:"mt-2 mb-0 text-sm text-subtext",children:lFe()}),f.jsxs("form",{className:"mt-5 flex flex-col gap-4",onSubmit:w,children:[f.jsxs("label",{className:"flex flex-col gap-2 text-sm font-medium text-subtext",children:[r!=null&&r.tokenConfigured?fFe():kFe(),f.jsx(rs,{type:"password",value:l,onChange:C=>u(C.target.value),placeholder:(r==null?void 0:r.maskedTokenId)??"ak-…",autoComplete:"new-password",disabled:r==null?void 0:r.processEnv})]}),f.jsxs("label",{className:"flex flex-col gap-2 text-sm font-medium text-subtext",children:[r!=null&&r.tokenConfigured?mFe():zFe(),f.jsx(rs,{type:"password",value:_,onChange:C=>d(C.target.value),placeholder:(r==null?void 0:r.maskedTokenSecret)??"as-…",autoComplete:"new-password",disabled:r==null?void 0:r.processEnv})]}),f.jsx("a",{className:"self-start text-sm text-subtext underline",href:"https://modal.com/docs/sdk/py/latest/config",target:"_blank",rel:"noreferrer",children:yFe()}),o&&f.jsx("p",{className:"m-0 text-sm text-accent-red",children:o}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsxs(Oe,{type:"button",disabled:x||S,onClick:()=>void b(),children:[f.jsx(Aa,{size:13})," ",Yp()]}),f.jsx(Oe,{variant:"primary",type:"submit",disabled:!l.trim()||!_.trim()||x||S||(r==null?void 0:r.processEnv),children:S?ea():Ho()})]})]})]})}const QP="rounded-sm border-border-strong bg-surface text-subtext",YP="rounded-sm border-accent-blue bg-accent-blue-subtle text-accent-blue",t8t=5e3;function XP(e){const n=za(),t=e.map(a=>HN(a)),r=LG({queries:t.map(a=>({...a,refetchInterval:t8t}))});return[Object.fromEntries(e.flatMap((a,o)=>r[o].data?[[a,r[o].data.running]]:[])),a=>{Pn(n)&&Gr(HN(a).queryKey,{running:!0})}]}function n8t({test:e,connecting:n,masterRunning:t}){if(n)return f.jsx("span",{role:"status",children:f.jsx(Ft,{className:YP,children:rL()})});if(e===void 0)return f.jsx(Ft,{className:QP,children:hL()});const r=e.missingTools??[],s=e.reachable&&e.toolsFound&&t===!1,i=e.reachable?e.toolsFound?s?f.jsx(Ft,{className:"rounded-sm",variant:"warning",children:sL()}):f.jsx(Ft,{className:"rounded-sm",variant:"success",children:Qp()}):f.jsx(Ft,{className:"rounded-sm",variant:"error",children:r.length===1?LFe({tool:Ne(r[0])}):$Fe()}):f.jsx(Ft,{className:"rounded-sm",variant:"error",children:u6()});return f.jsxs("div",{className:"flex items-center gap-4",role:"status",children:[i,!s&&f.jsx("span",{className:"ssh-tested-at whitespace-nowrap text-xs text-subtext",children:Io(e.testedAt)})]})}function r8t({remote:e=!1}){const n=WL(),t=ct(n),r=t.data??(t.isError?[]:null),[s,i]=R.useState(!1),[a,o]=R.useState({}),[l,u]=R.useState({}),[_,d]=R.useState(null),[p,m]=R.useState(!1),[x,S]=R.useState(0),v=e?[]:(r==null?void 0:r.filter(N=>{const T=a[N.host]??N.lastTest;return(T==null?void 0:T.reachable)&&T.toolsFound}).map(N=>N.host))??[],[b,w]=XP(v);function y(N){m(!1),S(T=>T+1),d(N),u(T=>({...T,[N]:!0}))}function C(){m(!1),d(null)}function E(N,T){u(z=>({...z,[N]:!T}))}return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mb-3 flex justify-end",children:f.jsxs(Oe,{variant:"ghost",onClick:()=>i(!0),children:[f.jsx(XO,{size:14})," ",EL()]})}),r===null?f.jsxs(ss,{children:[f.jsx(Lt,{})," ",mL()]}):r.length===0?f.jsx("p",{className:"settings-empty mt-1 mx-0 mb-0 text-base text-subtext",children:GVe()}):f.jsx("div",{className:"border-y border-border-variant divide-y divide-border-variant",children:r.map(N=>{const T=a[N.host]??N.lastTest,z=_===N.host,M=l[N.host]??!1,O=!e&&(z||(T==null?void 0:T.reachable)===!1),B=`${N.user?`${N.user}@`:""}${N.hostname??N.host}${N.port?`:${N.port}`:""}`;return f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center gap-3 py-3 px-2",children:[f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5",children:[O?f.jsx("button",{type:"button",className:"flex-none inline-flex items-center p-0.5 rounded-sm [&:hover]:bg-panel","aria-expanded":M,"aria-label":M?zK({name:Ne(N.host)}):YK({name:Ne(N.host)}),onClick:$=>{$.stopPropagation(),E(N.host,M)},children:f.jsx(qo,{size:15,className:`text-muted transition-transform duration-120 ease-standard${M?" rotate-180":""}`})}):f.jsx("span",{className:"w-5 flex-none","aria-hidden":"true"}),f.jsxs("div",{className:"min-w-0",children:[f.jsx("div",{className:"truncate text-base font-medium text-text",title:N.host,children:N.host}),f.jsx("div",{className:"mt-1 truncate text-sm text-subtext",title:B,children:B})]})]}),!e&&f.jsxs("div",{className:"grid flex-none grid-cols-[8.5rem_5rem] items-center gap-x-12",children:[f.jsx("div",{className:"text-start",children:f.jsx(n8t,{test:T,connecting:z&&!p,masterRunning:b[N.host]})}),f.jsx(Oe,{size:"small",type:"button",className:"justify-self-end",onClick:$=>{$.stopPropagation(),z&&!p?C():y(N.host)},disabled:!z&&_!==null&&!p,children:z?p?Ui():Ad():(T==null?void 0:T.reachable)===!1?Ui():T?xL():a6()})]})]}),O&&(M||z)&&f.jsxs("div",{className:`border-t border-t-border-variant py-3 pe-2 ps-10${M?"":" hidden"}`,children:[!z&&(T==null?void 0:T.error)&&f.jsx(l0t,{host:N.host,transcript:T.error}),z&&f.jsx(k6,{host:N.host,backend:"ssh",active:M,onComplete:$=>{$.backend==="ssh"&&(o(U=>({...U,[N.host]:$.result})),w(N.host),m(!1),d(null))},onError:$=>{m(!0),o(U=>({...U,[N.host]:{reachable:!1,toolsFound:!1,missingTools:[],error:$,testedAt:Date.now()}}))}},x)]})]},N.host)})}),s&&f.jsx(KP,{onClose:()=>i(!1)})]})}function s8t({test:e,connecting:n,masterRunning:t}){return n?f.jsx(Ft,{className:YP,children:rL()}):e===null?f.jsx(Ft,{className:QP,children:hL()}):e.reachable?e.slurmFound?e.toolsFound?t===!1?f.jsx(Ft,{className:"rounded-sm",variant:"warning",children:sL()}):f.jsx(Ft,{className:"rounded-sm",variant:"success",children:Qp()}):f.jsx(Ft,{className:"rounded-sm",variant:"error",children:iVe()}):f.jsx(Ft,{className:"rounded-sm",variant:"error",children:dKe()}):f.jsx(Ft,{className:"rounded-sm",variant:"error",children:u6()})}function i8t({remote:e=!1}){var I;const n=gn({mutationFn:kdt}),t=Eft(),r=ct(t),s=r.data??null,i=L=>{Gr(t.queryKey,F=>(typeof L=="function"?L(F??null):L)??void 0)},a=s?null:((I=r.error)==null?void 0:I.message)??null,[o,l]=R.useState(""),[u,_]=R.useState(""),[d,p]=R.useState(""),[m,x]=R.useState(""),[S,v]=R.useState(!1),[b,w]=R.useState(null),[y,C]=R.useState(null),[E,N]=R.useState(!1),[T,z]=R.useState(!1),[M,O]=R.useState(0),B=!e&&o&&(y!=null&&y.reachable)&&y.slurmFound&&y.toolsFound?[o]:[],[$,U]=XP(B);function H(){z(!1),O(L=>L+1),N(!0)}const Y=L=>{i(L),l(L.host??""),_(L.partition??""),p(L.account??""),x(L.timeLimit??"")},V=R.useRef(null);R.useEffect(()=>{const L=V.current;V.current=s,s&&(!L||o===(L.host??"")&&u.trim()===(L.partition??"")&&d.trim()===(L.account??"")&&m.trim()===(L.timeLimit??""))&&(l(s.host??""),_(s.partition??""),p(s.account??""),x(s.timeLimit??""))},[s,o,u,d,m]);const X=s!==null&&o===(s.host??"")&&u.trim()===(s.partition??"")&&d.trim()===(s.account??"")&&m.trim()===(s.timeLimit??"");async function te(L){if(L.preventDefault(),!S){v(!0),w(null);try{Y(await n.mutateAsync({host:o,partition:u.trim(),account:d.trim(),timeLimit:m.trim()}))}catch(F){w(F instanceof Error?F.message:String(F))}finally{v(!1)}}}return f.jsx(f.Fragment,{children:a?f.jsx("div",{className:"error",children:a}):s?f.jsxs(f.Fragment,{children:[!E&&(y==null?void 0:y.error)&&f.jsx("p",{className:Xb,children:y.error}),f.jsxs("form",{className:pk,onSubmit:te,children:[f.jsx("div",{className:"max-w-xl",children:f.jsxs("label",{children:[XWe(),f.jsx(Ld,{choices:[{id:"",label:IKe()},...o&&!s.hosts.some(L=>L.host===o)?[{id:o,label:`${o} (not in ~/.ssh/config)`}]:[],...s.hosts.map(L=>({id:L.host,label:L.host}))],value:o,variant:"field",dropDown:!0,disabled:S||E,onSelect:L=>{l(L),C(null),N(!1),z(!1)}})]})}),f.jsxs("div",{className:"actions",children:[!e&&f.jsx(Oe,{type:"button",onClick:()=>{E&&!T?(z(!1),N(!1)):H()},disabled:!o,title:o?void 0:FZe(),children:E?T?Ui():Ad():y?xL():a6()}),f.jsx("span",{role:"status",children:f.jsx(s8t,{test:y,connecting:E&&!T,masterRunning:$[o]})})]}),f.jsxs("div",{className:"mt-5 border-t border-border pt-5",children:[f.jsxs("div",{className:"row2",children:[f.jsxs("label",{children:[AQe(),f.jsx(rs,{type:"text",list:"slurm-partitions",value:u,onChange:L=>_(L.target.value),placeholder:EN(),autoComplete:"off",spellCheck:!1}),f.jsx("datalist",{id:"slurm-partitions",children:y==null?void 0:y.partitions.map(L=>f.jsx("option",{value:L},L))})]}),f.jsxs("label",{children:[c6(),f.jsx(rs,{type:"text",value:d,onChange:L=>p(L.target.value),placeholder:EN(),autoComplete:"off",spellCheck:!1})]})]}),f.jsxs("label",{className:"mt-3 block max-w-xl",children:[nZe(),f.jsx(rs,{type:"text",value:m,onChange:L=>x(L.target.value),placeholder:Qqe(),autoComplete:"off",spellCheck:!1})]})]}),b&&f.jsx("div",{className:"error",children:b}),f.jsx("div",{className:"actions",children:f.jsx(Oe,{variant:"primary",type:"submit",disabled:S||X||E,children:S?ea():Ho()})})]}),!e&&E&&f.jsx(k6,{host:o,backend:"slurm",onComplete:L=>{L.backend==="slurm"&&(C(L.result),U(o),z(!1),N(!1))},onError:L=>{z(!0),C({reachable:!1,slurmFound:!1,toolsFound:!1,partitions:[],error:L})}},M)]}):f.jsxs(ss,{children:[f.jsx(Lt,{})," ",LWe()]})})}function a8t(){var C;const e=gn({mutationFn:Edt}),n=Nft(),t=ct(n),r=t.data??null,s=E=>{Gr(n.queryKey,N=>(typeof E=="function"?E(N??null):E)??void 0)},i=r?null:((C=t.error)==null?void 0:C.message)??null,[a,o]=R.useState(""),[l,u]=R.useState(!1),[_,d]=R.useState(null),[p,m]=R.useState(null),x=p!==null&&p!=="testing"?p:null,S=E=>{s(E),o(E.address??"")},v=R.useRef(null);R.useEffect(()=>{const E=v.current;v.current=r,r&&(!E||a===(E.address??""))&&o(r.address??"")},[r,a]);const b=r!==null&&a===(r.address??"");async function w(E){if(E.preventDefault(),!l){u(!0),d(null);try{S(await e.mutateAsync({address:a}))}catch(N){d(N instanceof Error?N.message:String(N))}finally{u(!1)}}}async function y(){m("testing");try{m(await Ndt(a.trim()||void 0))}catch(E){m({reachable:!1,address:a.trim()||"(unknown)",rayVersion:null,error:E instanceof Error?E.message:String(E)})}}return f.jsx(f.Fragment,{children:i?f.jsx("div",{className:"error",children:i}):r?f.jsxs(f.Fragment,{children:[(x==null?void 0:x.error)&&f.jsx("p",{className:Xb,children:x.error}),f.jsxs("form",{className:pk,onSubmit:w,children:[f.jsxs("label",{children:[mWe(),f.jsx(rs,{type:"text",value:a,onChange:E=>{o(E.target.value),m(null)},placeholder:"http://127.0.0.1:8265",autoComplete:"off",spellCheck:!1})]}),f.jsxs("p",{className:"m-0 text-sm text-subtext",children:[oGe(),": ",Ne(r.resolvedAddress)," · ",gL(),": ",r.source]}),_&&f.jsx("div",{className:"error",children:_}),f.jsxs("div",{className:"actions",children:[f.jsx(Oe,{variant:"primary",type:"submit",disabled:l||b,children:l?ea():Ho()}),f.jsx(Oe,{type:"button",onClick:()=>void y(),disabled:p==="testing",children:RXe()}),f.jsx(o8t,{test:p})]}),(x==null?void 0:x.reachable)&&x.rayVersion&&f.jsxs("p",{className:"m-0 text-sm text-subtext",children:[VQe(),": ",x.rayVersion]})]})]}):f.jsxs(ss,{children:[f.jsx(Lt,{})," ",AWe()]})})}function o8t({test:e}){return e===null?null:e==="testing"?f.jsx(Ft,{children:OXe()}):e.reachable?f.jsx(Ft,{variant:"success",children:XQe()}):f.jsx(Ft,{variant:"error",children:u6()})}function l8t(e){const n=e.chip??`${e.os}/${e.arch}`,t=e.memBytes===null?null:Ml(e.memBytes),r=e.gpus.length===0?null:Z$e({count:e.gpus.length});return[n,e.cpuCount>0?u$e({count:e.cpuCount}):null,t,r].filter(Boolean).join(" · ")}function c8t({remote:e}){var p;const n=ct(jft()),t=n.data,r=(p=n.error)==null?void 0:p.message,s=n.isFetching,[i,a]=R.useState(0),[o,l]=R.useState(!0),[u,_]=R.useState(!1),d=()=>n.refetch();return f.jsxs(f.Fragment,{children:[r&&!t?f.jsx("div",{className:"error",children:r}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:Q7t,children:[f.jsx("span",{className:"k",children:o_()}),f.jsx("span",{className:"v",children:!t&&s||u?f.jsxs(Ft,{className:"gap-1.5",role:"status",children:[f.jsx(Lt,{}),u?DHe():Yi()]}):r?f.jsx(Ft,{variant:"warning",children:A4()}):t?t.loggedIn?t.sshKeyStatus==="matched"?f.jsx(Ft,{variant:"success",children:Qp()}):t.sshKeyStatus==="unknown"?f.jsx(Ft,{variant:"warning",children:A4()}):f.jsx(Ft,{variant:"warning",children:Jv()}):f.jsx(Ft,{variant:"warning",children:_L()}):null}),f.jsx("span",{className:"k",children:fQe()}),f.jsx("span",{className:"v",children:t!=null&&t.loggedIn&&t.orgs.length>0?t.orgs.join(", "):"—"}),f.jsx("span",{className:"k",children:iXe()}),f.jsx("span",{className:"v",children:t!=null&&t.loggedIn?t.sshKeyStatus==="matched"?f.jsx(Ft,{variant:"success",children:UKe()}):t.sshKeyStatus==="no_local_match"?f.jsx(Ft,{variant:"warning",children:MKe()}):t.sshKeyStatus==="none_registered"?f.jsx(Ft,{variant:"error",children:pKe()}):f.jsx(Ft,{children:vL()}):"—"})]}),e&&t&&!t.loggedIn&&f.jsx("p",{className:"mt-4 mb-0 text-sm text-subtext",children:eFe({command:Ne("orx login")})}),!e&&i>0&&f.jsx(o0t,{login:o,onComplete:()=>{_(!1),a(0),d()},onError:m=>{_(!1),Kn(m,"error")}},i),e&&(t==null?void 0:t.loggedIn)&&t.sshKeyStatus==="none_registered"&&(t.sshKeyPath?f.jsxs("p",{dir:"auto",className:Ca,children:[FHe()," ",f.jsxs("code",{children:["orx ssh-key add ",t.sshKeyPath]}),"."]}):f.jsxs("p",{dir:"auto",className:Ca,children:[oKe()," ",f.jsx("code",{children:"ssh-keygen -t ed25519"}),PXe()," ",f.jsx("code",{children:"orx ssh-key add"}),"."]})),e&&(t==null?void 0:t.loggedIn)&&t.sshKeyStatus==="no_local_match"&&(t.sshKeyPath?f.jsx("p",{dir:"auto",className:Ca,children:ZZe({register:Ne(`orx ssh-key add ${t.sshKeyPath}`),load:Ne("ssh-add")})}):f.jsxs("p",{dir:"auto",className:Ca,children:[rKe()," ",f.jsx("code",{children:"ssh-add"}),sQe()," ",f.jsx("code",{children:"ssh-keygen -t ed25519"}),"."]})),!s&&(r||(t==null?void 0:t.error))&&f.jsx("p",{dir:"auto",className:"mt-4 mb-0 text-sm text-accent-red whitespace-pre-wrap break-words",children:r||(t==null?void 0:t.error)})]}),f.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[f.jsxs(Oe,{onClick:()=>void d(),disabled:s||u,children:[f.jsx(Aa,{size:13})," ",s?Yi():Kp()]}),!e&&t&&(!t.loggedIn||t.sshKeyStatus!=="matched")&&f.jsxs(Oe,{variant:"primary",disabled:s||u,onClick:()=>{l(!t.loggedIn),_(!0),a(m=>m+1)},children:[u?f.jsx(Lt,{}):f.jsx(c_,{size:13})," ",t.loggedIn?ZJe():wL()]})]})]})}const u8t={local:Gpe,ssh:dme,tinker:pme,hf:Ipe,modal:Qpe,k8s:Fpe,slurm:ome,ray:rme,openresearch:Jpe},Zb={local:"local_job",tinker:"tinker_job",hf:"hf_job",modal:"modal_job",k8s:"k8s_job",ssh:"ssh_job",slurm:"slurm_job",ray:"ray_job",openresearch:"openresearch_job"},oA=["hf","modal","slurm","ray","openresearch"],Ew=["hf","modal","openresearch"],ZP={hf:["cpu-basic","t4-small","a10g-small","a10g-large","a100-large","h100","h200"],modal:["cpu","t4","l4","a10g","a100","a100-80gb","l40s","h100","h100:2"],slurm:["gpu","h100:1","h100:2","a100:4"],ray:["cpu","cpu:2","gpu","gpu:1","gpu:1,cpu:4","gpu:1,mem:8GiB"],openresearch:["h100_sxm","h100_sxm:2","cpu5c","cpu5g","cpu5m"]},X3=["tinker","hf","modal","ray","k8s"],d8t={tinker:fge,hf:ege,modal:sge,openresearch:lge},lA="__custom__";function g0(e,n){return!!(n&&!(ZP[e]??[]).includes(n))}function f8t({settings:e,projectId:n,onSaved:t}){const r=gn({mutationFn:jdt}),s=e.configuredDefaultBackend??e.defaultBackend??"local",i=e.defaultFlavor??"",[a,o]=R.useState(s),[l,u]=R.useState(i),[_,d]=R.useState(g0(s,i)),[p,m]=R.useState(!1),[x,S]=R.useState(null),v=e.targets.find($=>$.id===a),b=e.targets.filter($=>$.configured||$.id===s),w=oA.includes(a),y=Ew.includes(a),C=ZP[a]??[],E=a===s&&(!w||l.trim()===i),N=Od[a](),T=d8t[a],z=p?utt():y&&!l.trim()?$Be({destination:N}):a==="ssh"?VFe():qFe({destination:N});R.useEffect(()=>{o(s),u(i),d(g0(s,i))},[s,i]);async function M($,U){const H=oA.includes($);if(!(p||Ew.includes($)&&!U.trim())){m(!0),S(null);try{t(await r.mutateAsync({backend:$,flavor:H&&U.trim()||null,projectId:n}))}catch(Y){S(Y instanceof Error?Y.message:String(Y)),o(s),u(i),d(g0(s,i))}finally{m(!1)}}}function O($){const U=e.targets.find(Y=>Y.id===$);if(!U)return;o(U.id);const H=U.id===s?i:"";u(H),d(g0(U.id,H)),Ew.includes(U.id)||M(U.id,H)}function B($){if($===lA){d(!0);return}d(!1),u($),(!y||$)&&M(a,$)}return f.jsxs("section",{className:"mb-8",children:[f.jsx("h2",{className:"mt-0 mx-0 mb-2 text-lg",children:GUe()}),f.jsxs("div",{children:[f.jsxs("form",{className:"grid grid-cols-[minmax(12rem,18rem)_minmax(12rem,18rem)] items-start gap-3",onSubmit:$=>{$.preventDefault(),E||M(a,l)},children:[f.jsx(Ld,{choices:b.map($=>({id:$.id,label:Od[$.id]()})),value:a,variant:"field",dropDown:!0,disabled:p,renderIcon:$=>{const U=e.targets.find(H=>H.id===$.id);return U?f.jsx(u_,{kind:Zb[U.id],size:16}):null},onSelect:O}),w&&f.jsx("div",{children:_?f.jsxs("div",{className:"relative",children:[f.jsx("input",{className:"h-9 w-full rounded-md border border-border bg-background py-0 pe-10 ps-3 font-sans text-sm text-text outline-none focus:border-text",type:"text",value:l,onChange:$=>u($.target.value),onBlur:()=>{if(y&&!l.trim()){a===s&&(u(i),d(g0(s,i)));return}E||M(a,l)},placeholder:EUe(),autoFocus:!0,autoComplete:"off",spellCheck:!1,disabled:p}),f.jsx("button",{type:"button",className:"absolute inset-y-0 end-0 inline-flex w-9 items-center justify-center text-muted hover:text-text","aria-label":CN(),title:CN(),onMouseDown:$=>$.preventDefault(),onClick:()=>d(!1),children:f.jsx(qo,{size:12})})]}):f.jsx(Ld,{choices:[{id:"",label:y?LBe():tHe()},...l&&!C.includes(l)?[{id:l,label:w$e({value:Ne(l)})}]:[],...C.map($=>({id:$,label:$})),{id:lA,label:TUe()}],value:l,variant:"field",dropDown:!0,disabled:p,onSelect:B})})]}),x&&f.jsx("div",{className:"error mt-2.5",children:x}),v&&!v.configured&&f.jsx("p",{className:Ca,children:KXe()})]}),f.jsx("p",{className:"mt-2 mb-0 text-sm leading-relaxed text-subtext",children:z}),T&&f.jsx("p",{className:"mt-1 mb-0 text-sm leading-relaxed text-subtext",children:T()})]})}function h8t({target:e,isDefault:n,summary:t,onOpen:r,onOpenEnvironment:s}){const i=`compute-${e.id}-summary`,a=e.unverified?NBe():e.id==="openresearch"?wL():e.id==="ray"?a6():KJe();return f.jsxs("div",{className:`group relative flex min-h-41 w-full flex-col items-start rounded-lg border border-border bg-background p-5 text-start font-sans ${r&&e.enabled?"transition-colors duration-120 ease-standard hover:border-text hover:bg-surface":""} ${e.enabled?"":"opacity-52"}`,children:[r&&f.jsx("button",{type:"button",className:"absolute inset-0 z-10 rounded-lg focus-visible:outline-2 focus-visible:outline-text focus-visible:outline-offset-2 disabled:cursor-default",onClick:r,disabled:!e.enabled,"aria-label":Od[e.id](),"aria-describedby":i,"aria-haspopup":X3.includes(e.id)?"dialog":void 0}),f.jsx("span",{className:"flex h-16 w-40 flex-none items-center justify-start",children:f.jsx(u_,{kind:Zb[e.id],size:48})}),f.jsx("span",{className:"mt-5 text-lg font-semibold text-text",children:Od[e.id]()}),f.jsx("span",{className:"mt-1 line-clamp-2 min-h-9 text-sm leading-normal text-text",children:u8t[e.id]()}),f.jsx("span",{id:i,className:"mt-2 line-clamp-2 min-h-8 text-xs leading-normal text-subtext",children:e.fromEnvironmentTab?f.jsxs(f.Fragment,{children:[e.id==="tinker"?BPe():Ket()," ",f.jsx("button",{type:"button",className:"relative z-20 text-primary underline-offset-2 hover:text-primary-hover hover:underline",onClick:s,children:R$e()})]}):t??e.summary}),f.jsxs("span",{className:"mt-auto flex w-full items-center justify-between gap-3 pt-3 text-sm",children:[f.jsx("span",{className:n?"font-medium text-primary":"text-subtext",children:n?uL():e.configured?!r||X3.includes(e.id)?d6():xtt():a}),r&&f.jsx("span",{className:"text-subtext transition-transform duration-120 ease-standard group-hover:translate-x-0.5","aria-hidden":"true",children:f.jsx(E1,{size:16})})]})]})}function _8t({target:e,isDefault:n,onBack:t,remote:r}){return f.jsxs(f.Fragment,{children:[f.jsxs("button",{type:"button",className:"settings-back mb-6 inline-flex items-center gap-2 text-sm font-medium text-subtext hover:text-text",onClick:t,children:[f.jsx(ap,{size:16})," ",lL()]}),f.jsxs("div",{className:"flex items-center justify-between gap-6",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[f.jsx("span",{className:"flex h-10 w-10 flex-none items-center justify-center",children:f.jsx(u_,{kind:Zb[e.id],size:36})}),f.jsx("h1",{className:"m-0 min-w-0 text-2xl",children:Od[e.id]()})]}),n&&f.jsx(Ft,{className:"flex-none border-primary bg-primary-subtle text-primary",children:uL()})]}),f.jsxs("div",{className:"mt-6 font-sans text-base text-text [&_.settings-card]:mb-0 [&_.settings-form]:mt-6 [&_.settings-form]:border-t-0 [&_.settings-form]:pt-0 [&>.settings-form:first-child]:mt-0 [&>div:first-child]:border-t-0",children:[e.id==="ssh"&&f.jsx(r8t,{remote:r}),e.id==="slurm"&&f.jsx(i8t,{remote:r}),e.id==="openresearch"&&f.jsx(c8t,{remote:r})]})]})}function p8t({target:e,onClose:n}){const t=R.useRef(null),[r,s]=R.useState({dirty:!1,saving:!1});R.useEffect(()=>{const a=t.current;return a==null||a.showModal(),()=>a==null?void 0:a.close()},[]);const i=()=>{r.saving||r.dirty&&!window.confirm(DPe())||n()};return f.jsxs("dialog",{ref:t,className:"m-auto w-140 max-w-[calc(100vw_-_40px)] max-h-[calc(100vh_-_40px)] overflow-y-auto rounded-xl border border-border bg-background p-5 text-text shadow-modal backdrop:bg-modal-backdrop-light","aria-labelledby":"compute-quick-setup-title",onKeyDown:a=>{a.key==="Escape"&&(a.preventDefault(),i())},onCancel:a=>{a.preventDefault(),i()},children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between gap-4",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[f.jsx(u_,{kind:Zb[e.id],size:32}),f.jsx("h2",{id:"compute-quick-setup-title",className:"m-0 text-xl font-medium text-text",children:Od[e.id]()})]}),f.jsx(Qt,{title:ev(),"aria-label":ev(),onClick:i,disabled:r.saving,children:f.jsx(qr,{size:14})})]}),e.id==="tinker"&&f.jsx(g8t,{target:e}),e.id==="hf"&&f.jsx(b8t,{}),e.id==="modal"&&f.jsx(e8t,{}),e.id==="ray"&&f.jsx(a8t,{}),e.id==="k8s"&&f.jsx(J7t,{onEditState:s})]})}function m8t({project:e,onViewHistory:n,onOpenEnvironment:t,remote:r}){var M,O;const s=GL(e==null?void 0:e.id),i=ct(s),a=i.data??null,o=B=>{Gr(s.queryKey,$=>(typeof B=="function"?B($??null):B)??void 0)},l=a?null:((M=i.error)==null?void 0:M.message)??null,[u,_]=R.useState(null),[d,p]=R.useState(null),m=zft(),x=ct(m),S=x.data??null,v=((O=x.error)==null?void 0:O.message)??null;R.useEffect(()=>{_(null),p(null)},[e==null?void 0:e.id]);const b=B=>{o(B),p(null)},w=a?a.targets:null,y=(a==null?void 0:a.configuredDefaultBackend)??(a==null?void 0:a.defaultBackend),C=w?[...w].sort((B,$)=>+($.id===y)-+(B.id===y)):null,E=(C==null?void 0:C.filter(B=>B.configured))??[],N=(C==null?void 0:C.filter(B=>!B.configured))??[],T=B=>f.jsx(h8t,{target:B,isDefault:y===B.id,summary:B.id==="local"?S?l8t(S):v??QUe():void 0,onOpen:B.id==="local"?void 0:()=>_(B.id),onOpenEnvironment:t},`${(e==null?void 0:e.id)??"none"}:${B.id}`),z=u?a==null?void 0:a.targets.find(B=>B.id===u):null;return z&&!X3.includes(z.id)?f.jsx(_8t,{target:z,isDefault:y===z.id,onBack:()=>_(null),remote:r}):f.jsxs(f.Fragment,{children:[f.jsx("h1",{children:cL()}),f.jsx("p",{className:"settings-sub mt-0 mx-0 mb-4.5 text-base leading-relaxed text-text",children:aUe()}),f.jsx(O8t,{projectId:e==null?void 0:e.id,onViewHistory:n}),l?f.jsx("div",{className:"error",children:l}):a?f.jsxs(f.Fragment,{children:[d&&f.jsx("div",{className:"error",children:d}),f.jsx(f8t,{settings:a,projectId:e==null?void 0:e.id,onSaved:b}),f.jsxs("section",{className:"mb-8",children:[f.jsx("h2",{className:"mt-0 mx-0 mb-2 text-lg",children:d6()}),f.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:E.map(T)})]}),N.length>0&&f.jsxs("section",{className:"mb-3.5",children:[f.jsx("h2",{className:"mt-0 mx-0 mb-2 text-lg",children:cVe()}),f.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:N.map(T)})]}),z&&f.jsx(p8t,{target:z,onClose:()=>_(null)})]}):f.jsxs(ss,{children:[f.jsx(Lt,{})," ",Aqe()]})]})}function g8t({target:e}){var w;const n=gn({mutationFn:Zut}),[t,r]=R.useState(""),[s,i]=R.useState(!1),[a,o]=R.useState(null),l=$N(),u=ct(l),_=u.data??null,d=a??((w=u.error)==null?void 0:w.message)??null,p=y=>{Gr(l.queryKey,C=>(typeof y=="function"?y(C??null):y)??void 0)},[m,x]=R.useState(!1),S=u.isPending||m;async function v(){if(!(S||s)){x(!0),o(null);try{await nt.fetchQuery({...$N(),staleTime:0})}catch(y){o(y instanceof Error?y.message:String(y))}finally{x(!1)}}}async function b(y){if(y.preventDefault(),!(!t.trim()||s||S)){i(!0),o(null);try{p(await n.mutateAsync(t.trim())),r("")}catch(C){o(C instanceof Error?C.message:String(C))}finally{i(!1)}}}return f.jsxs(f.Fragment,{children:[!_&&S?f.jsxs(ss,{children:[f.jsx(Lt,{})," ",Yi()]}):_&&f.jsxs("dl",{className:"m-0 flex items-center justify-between gap-4 text-sm",children:[f.jsx("dt",{className:"font-medium text-subtext",children:o_()}),f.jsx("dd",{className:"m-0",children:f.jsx(Ft,{variant:_.validationStatus==="valid"?"success":_.validationStatus==="invalid"?"error":"warning",children:_.validationStatus==="valid"?Qp():_.validationStatus==="invalid"?Uet():_.validationStatus==="billingRequired"?Oet():Jv()})})]}),(_==null?void 0:_.validationStatus)==="billingRequired"&&f.jsx("p",{className:"mt-2 mb-0 text-sm text-subtext",children:f.jsx("a",{className:"underline",href:"https://tinker.thinkingmachines.ai/",target:"_blank",rel:"noreferrer",children:Ret()})}),(_==null?void 0:_.processEnv)&&f.jsx("p",{className:"mt-2 mb-0 text-sm text-subtext",children:Pet()}),f.jsxs("form",{className:"mt-5 flex flex-col gap-4",onSubmit:b,children:[f.jsxs("label",{className:"flex flex-col gap-2 text-sm font-medium text-subtext",children:[e.configured||_!==null&&_.validationStatus!=="missing"?CJe():r6(),f.jsx(rs,{type:"password",value:t,placeholder:(_==null?void 0:_.maskedKey)??"",onChange:y=>r(y.target.value),autoComplete:"new-password"})]}),d&&f.jsx("p",{className:"m-0 text-sm text-accent-red",children:d}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsxs(Oe,{type:"button",disabled:s||S,onClick:()=>void v(),children:[f.jsx(Aa,{size:13})," ",S?Yi():Kp()]}),f.jsx(Oe,{variant:"primary",type:"submit",disabled:!t.trim()||s||S,children:s?kL():Ho()})]})]})]})}function v8t({settings:e}){return e.validationStatus==="missing"?f.jsx(Ft,{variant:"warning",children:Jv()}):e.validationStatus==="invalid"?f.jsx(Ft,{variant:"error",children:fWe()}):e.validationStatus!=="valid"?null:e.jobsWrite===!0?f.jsx(Ft,{variant:"success",children:Qp()}):e.jobsWrite===!1?f.jsxs("span",{className:"inline-flex items-center gap-2",children:[f.jsx(Ft,{variant:"warning",children:JVe()}),f.jsx(w6,{content:uPe(),className:"text-subtext",children:f.jsx(R6,{size:15})})]}):null}function b8t(){var v;const e=gn({mutationFn:Yut}),n=BN(),t=ct(n),r=t.data??null,s=b=>{Gr(n.queryKey,w=>(typeof b=="function"?b(w??null):b)??void 0)},i=r?null:((v=t.error)==null?void 0:v.message)??null,[a,o]=R.useState(""),[l,u]=R.useState(!1),[_,d]=R.useState(!1),[p,m]=R.useState(null);async function x(){if(!(l||_||!r&&!i)){d(!0),m(null);try{await nt.fetchQuery({...BN(),staleTime:0})}catch(b){m(b instanceof Error?b.message:String(b))}finally{d(!1)}}}async function S(b){if(b.preventDefault(),!(!a.trim()||l||_||!r&&!i)){u(!0),m(null);try{const w=await e.mutateAsync(a.trim());s(w),m(null),o("")}catch(w){m(w instanceof Error?w.message:String(w))}finally{u(!1)}}}return f.jsxs(f.Fragment,{children:[i?f.jsx("div",{className:"error",children:i}):r?f.jsxs(f.Fragment,{children:[f.jsxs("dl",{className:"m-0 flex flex-col gap-3 text-sm",children:[r.username&&f.jsxs("div",{className:"flex items-center justify-between gap-4",children:[f.jsx("dt",{className:"font-medium text-subtext",children:c6()}),f.jsx("dd",{className:"m-0 text-text",children:r.username})]}),(r.validationStatus==="missing"||r.validationStatus==="invalid"||r.validationStatus==="valid"&&r.jobsWrite!==null)&&f.jsxs("div",{className:"flex items-center justify-between gap-4",children:[f.jsx("dt",{className:"font-medium text-subtext",children:o_()}),f.jsx("dd",{className:"m-0 text-text",children:f.jsx(v8t,{settings:r})})]})]}),r.validationStatus==="unreachable"&&r.validationError&&f.jsx("p",{className:Xb,children:r.validationError}),r.source==="env"&&f.jsx("p",{className:Ca,children:PGe()}),r.validationStatus==="valid"&&r.jobsWrite===null&&f.jsx("p",{className:Ca,children:aPe({login:Ne("hf auth login"),url:Ne("huggingface.co/settings/tokens")})})]}):f.jsxs(ss,{children:[f.jsx(Lt,{})," ",$We()]}),f.jsxs("form",{className:"mt-5 flex flex-col gap-4",onSubmit:S,children:[f.jsxs("label",{className:"flex flex-col gap-2 text-sm font-medium text-subtext",children:[r!=null&&r.configured?jJe():XFe(),f.jsx(rs,{type:"password",value:a,onChange:b=>o(b.target.value),placeholder:(r==null?void 0:r.maskedToken)??OGe(),autoComplete:"off"})]}),p&&f.jsx("div",{className:"error",children:p}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsxs(Oe,{type:"button",disabled:l||_||!r&&!i,onClick:()=>void x(),children:[f.jsx(Aa,{size:13})," ",_?Yi():Kp()]}),f.jsx(Oe,{variant:"primary",type:"submit",disabled:!a.trim()||l||_||!r&&!i,children:l?kL():Ho()})]})]})]})}const JP=/^hf_[A-Za-z0-9]{10,}$/;function eF(){return f.jsx("tr",{children:f.jsx("td",{colSpan:3,children:f.jsxs("p",{dir:"auto",className:Ca,children:[ZXe()," ",f.jsx("code",{children:"HF_TOKEN"}),IYe()]})})})}const cA=["TINKER_API_KEY","HF_TOKEN","WANDB_API_KEY"];function Z3(e,n){const t=n instanceof Error?n.message:String(n);Kn(t.includes(e)?t:`${e}: ${t}`,"error")}function y8t({name:e,entry:n,onVars:t}){const r=gn({mutationFn:d=>OL(...d)}),s=gn({mutationFn:cdt}),[i,a]=R.useState(""),[o,l]=R.useState(!1);async function u(){if(!(!i.trim()||o)){l(!0);try{t(await r.mutateAsync([e,i.trim()])),a("")}catch(d){Z3(e,d)}finally{l(!1)}}}async function _(){if(!o){l(!0);try{t(await s.mutateAsync(e))}catch(d){Z3(e,d)}finally{l(!1)}}}return f.jsxs(f.Fragment,{children:[f.jsxs("tr",{children:[f.jsx("td",{className:"font-mono text-sm",children:e}),f.jsx("td",{className:"text-base text-subtext",children:n?f.jsxs(f.Fragment,{children:[n.maskedValue,n.inProcessEnv&&f.jsx(Ft,{children:NQe()})]}):f.jsx(rs,{variant:"inline",className:"text-base",type:"password",value:i,onChange:d=>a(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),u()),d.key==="Escape"&&!o&&a("")},placeholder:bL(),"aria-label":zY({name:Ne(e)}),autoComplete:"new-password",disabled:o})}),f.jsx("td",{children:n?f.jsx(Qt,{className:"[&:hover:not(:disabled)]:text-accent-red",title:S4({name:Ne(e)}),"aria-label":S4({name:Ne(e)}),onClick:()=>void _(),disabled:o,children:f.jsx(Xd,{size:13})}):i.trim()&&f.jsx(Oe,{size:"small",onClick:()=>void u(),disabled:o,children:o?ea():Ho()})})]}),!n&&e!=="HF_TOKEN"&&JP.test(i.trim())&&f.jsx(eF,{})]})}function x8t({onVars:e,onDone:n}){const t=gn({mutationFn:d=>OL(...d)}),[r,s]=R.useState(""),[i,a]=R.useState(""),[o,l]=R.useState(!1);async function u(){if(!(!r.trim()||!i.trim()||o)){l(!0);try{e(await t.mutateAsync([r.trim(),i.trim()])),n()}catch(d){Z3(r.trim(),d)}finally{l(!1)}}}const _=d=>{d.key==="Enter"&&(d.preventDefault(),u()),d.key==="Escape"&&!o&&n()};return f.jsxs(f.Fragment,{children:[f.jsxs("tr",{children:[f.jsx("td",{children:f.jsx(rs,{autoFocus:!0,variant:"inline",className:"font-mono text-sm",type:"text",value:r,onChange:d=>s(d.target.value),onKeyDown:_,placeholder:"MY_API_KEY","aria-label":MVe(),autoComplete:"off",spellCheck:!1,disabled:o})}),f.jsx("td",{children:f.jsx(rs,{variant:"inline",className:"text-base",type:"password",value:i,onChange:d=>a(d.target.value),onKeyDown:_,placeholder:bL(),"aria-label":IVe(),autoComplete:"new-password",disabled:o})}),f.jsxs("td",{children:[f.jsx(Oe,{size:"small",onClick:()=>void u(),disabled:o||!r.trim()||!i.trim(),children:o?ea():Ho()}),f.jsx(Qt,{title:Ad(),"aria-label":Nqe(),onClick:n,disabled:o,children:f.jsx(qr,{size:13})})]})]}),r.trim()!=="HF_TOKEN"&&JP.test(i.trim())&&f.jsx(eF,{})]})}function w8t(){var u;const e=Tft(),n=ct(e),t=n.data??null,r=_=>{Gr(e.queryKey,d=>(typeof _=="function"?_(d??null):_)??void 0)},s=t?null:((u=n.error)==null?void 0:u.message)??null,[i,a]=R.useState(!1),o=t===null?[]:t.map(_=>_.key).filter(_=>!cA.includes(_)),l=[...cA,...o];return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"mb-4.5 flex items-center justify-between gap-4",children:[f.jsx("p",{className:"m-0 text-base leading-relaxed text-text",children:EZe()}),f.jsxs(Oe,{size:"small",className:"shrink-0",onClick:()=>a(!0),disabled:i||t===null,children:[f.jsx(em,{size:12})," ",GHe()]})]}),f.jsx("div",{className:Po,children:s?f.jsx("div",{className:"error",children:s}):t===null?f.jsxs(ss,{children:[f.jsx(Lt,{})," ",yu()]}):f.jsx("table",{className:"env-table w-full table-fixed border-collapse text-base [&_td:first-child]:w-[32%] [&_td:first-child]:wrap-anywhere [&_.badge]:ms-2 [&_td]:h-12 [&_td]:pt-0 [&_td]:pe-2.5 [&_td]:pb-0 [&_td]:ps-0 [&_td]:align-middle [&_td]:border-b [&_td]:border-b-border-variant [&_td:last-child]:w-29 [&_td:last-child]:whitespace-nowrap [&_td:last-child]:text-end [&_td[colspan]]:whitespace-normal [&_td[colspan]]:text-start [&_.icon-btn]:ms-2 [&_.icon-btn]:align-middle",children:f.jsxs("tbody",{children:[l.map(_=>f.jsx(y8t,{name:_,entry:t.find(d=>d.key===_),onVars:r},_)),i&&f.jsx(x8t,{onVars:r,onDone:()=>a(!1)})]})})})]})}const v0=[{value:"system",label:zet,icon:Jpt},{value:"light",label:ket,icon:xmt},{value:"dark",label:met,icon:tmt}],S8t=[{id:"en",label:"English"},{id:"zh-CN",label:"简体中文"},{id:"fa",label:"فارسی"}];function k8t(){const e=Qd(),[n,t]=nO(),r=s=>{var _;const i=s.key==="ArrowRight"||s.key==="ArrowDown"?1:s.key==="ArrowLeft"||s.key==="ArrowUp"?-1:0;if(!i)return;s.preventDefault();const a=[...s.currentTarget.querySelectorAll('[role="radio"]')],o=a.findIndex(d=>d===document.activeElement),u=((o===-1?v0.findIndex(d=>d.value===n):o)+i+v0.length)%v0.length;t(v0[u].value),(_=a[u])==null||_.focus()};return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:lBe()}),f.jsxs("div",{className:`${Po} mt-3`,children:[f.jsxs("div",{className:`${Ll} pb-3.5`,children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:LN()}),f.jsx("div",{className:"theme-segmented inline-flex flex-none gap-0.5 p-0.5 border border-border rounded-md bg-surface",role:"radiogroup","aria-label":LN(),onKeyDown:r,children:v0.map(({value:s,label:i,icon:a})=>f.jsxs("button",{type:"button",role:"radio","aria-checked":n===s,tabIndex:n===s?0:-1,className:`theme-segment inline-flex items-center gap-1.5 py-[5px] px-2.5 rounded-sm text-subtext text-sm cursor-pointer transition-[background,color] duration-120 ease-standard [&:hover:not(.on)]:text-text [&:hover:not(.on)]:bg-highlight [&.on]:text-background [&.on]:bg-primary [&:focus-visible]:outline-2 [&:focus-visible]:outline-solid [&:focus-visible]:outline-text [&:focus-visible]:outline-offset-2 ${n===s?"on":""}`,onClick:()=>t(s),children:[f.jsx(a,{size:14}),i()]},s))})]}),f.jsxs("div",{className:Ll,children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:YPe()}),f.jsx("div",{className:"w-52 flex-none",children:f.jsx(Ld,{choices:S8t,value:e,variant:"field",dropDown:!0,onSelect:s=>{cD(s)&&JL(s)}})})]})]})]})}const C8t={installer:Plt,"app-bundle":zlt,cargo:Rlt,homebrew:Olt,nix:Ult,unknown:Klt},Nw={cargo:Zlt,homebrew:nct,nix:act};function E8t(){var d;const e=gn({mutationFn:p=>ndt(...p)}),{status:n,error:t,apply:r}=P6(),[s,i]=R.useState(null),[a,o]=R.useState(null),l=cI(n),u=s!==null||l.restarting;if(!n)return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:AN()}),t?f.jsx("div",{className:Po,children:f.jsx("div",{className:"error",children:t})}):f.jsxs(ss,{children:[f.jsx(Lt,{})," ",yu()]})]});const _=async(p,m)=>{i(p),o(null);try{await m()}catch(x){o(x instanceof Error?x.message:String(x))}finally{i(null)}};return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:AN()}),f.jsxs("div",{className:`${Po} mt-3`,children:[f.jsxs("div",{className:`${Bd} pb-3.5`,children:[f.jsx("div",{className:"k",children:yL()}),f.jsx("div",{className:"v",children:n.current}),f.jsx("div",{className:"k",children:kWe()}),f.jsx("div",{className:"v",children:n.latest??"—"}),f.jsx("div",{className:"k",children:fL()}),f.jsx("div",{className:"v",children:C8t[n.channel]()})]}),n.restartRequired&&f.jsxs("div",{className:Ll,children:[f.jsxs("div",{children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:CYe()}),f.jsx("p",{children:l.error?jL({error:l.error}):IJe({installed:Ne(n.installedVersion??"—"),current:Ne(n.current??n.installedVersion??"—")})})]}),n.canRestart&&f.jsx(Oe,{size:"small",type:"button",disabled:u,onClick:l.restart,children:l.restarting?TL():zL()})]}),n.selfUpdates?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:Ll,children:[f.jsxs("div",{children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:zN()}),f.jsxs("p",{children:[jVe(),n.envDisabled&&att()]})]}),f.jsx(x6,{type:"button",checked:n.autoUpdate,"aria-label":zN(),disabled:u,onClick:()=>void _("auto",()=>e.mutateAsync([!n.autoUpdate]).then(r))})]}),f.jsxs("div",{className:Ll,children:[f.jsxs("div",{children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:n.updateAvailable?ntt({version:Ne(n.latest??"—")}):bBe()}),f.jsx("p",{children:n.updateAvailable?TPe():ABe()})]}),f.jsx(Oe,{size:"small",type:"button",disabled:u,onClick:()=>void _("apply",()=>edt().then(r)),children:s==="apply"?e6():n.updateAvailable?Zet():SBe()})]})]}):f.jsx("div",{className:Ll,children:f.jsxs("div",{children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:mQe()}),f.jsx("p",{children:((d=Nw[n.channel])==null?void 0:d.call(Nw))??nJe()})]})}),n.channel==="app-bundle"&&f.jsx(z8t,{busy:s,disabled:u,run:_}),a&&f.jsx("div",{className:"error",children:a})]})]})}function N8t(){var d;const e=gn({mutationFn:Kdt}),n=Bft(),t=ct(n),r=t.data??null,s=p=>{Gr(n.queryKey,m=>(typeof p=="function"?p(m??null):p)??void 0)},[i,a]=R.useState(!1),[o,l]=R.useState(null),u=o??((d=t.error)==null?void 0:d.message)??null,_=()=>{!r||i||(a(!0),l(null),e.mutateAsync(!r.preferenceEnabled).then(s).catch(p=>l(p instanceof Error?p.message:String(p))).finally(()=>a(!1)))};return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:bZe()}),r?f.jsxs("div",{className:`${Po} mt-3`,children:[f.jsxs("div",{className:Ll,children:[f.jsxs("div",{children:[f.jsxs("div",{className:"project-default-title inline-flex items-center gap-1.5 text-base font-medium",children:[kN(),r.locked&&r.reason&&f.jsx(w6,{content:`${wUe()} ${r.reason}.`,className:"text-subtext",children:f.jsx(R6,{size:15})})]}),f.jsx("p",{children:FVe()})]}),f.jsx(x6,{type:"button",checked:r.enabled,"aria-label":kN(),disabled:i||r.locked,onClick:_})]}),u&&f.jsx("div",{className:"error",children:u})]}):u?f.jsx("div",{className:"error",children:u}):f.jsxs(ss,{children:[f.jsx(Lt,{})," ",yu()]})]})}function z8t({busy:e,disabled:n,run:t}){const r=gn({mutationFn:rdt}),[s,i]=R.useState(null),[a,o]=R.useState(!1),l=u=>void t("cli",()=>r.mutateAsync(u).then(_=>{i(_),o(!1)}).catch(_=>{throw o(!u&&String((_==null?void 0:_.message)??_).includes("--force")),_}));return f.jsxs("div",{className:Ll,children:[f.jsxs("div",{children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:wPe({command:Ne("orx")})}),s?f.jsxs("p",{children:[s.alreadyCurrent?VBe({link:Ne(s.link)}):XBe({link:Ne(s.link)}),!s.onPath&&sBe({directory:Ne(s.dir)})]}):f.jsx("p",{children:vPe({command:Ne("orx")})})]}),f.jsx(Oe,{size:"small",type:"button",disabled:n,onClick:()=>l(a),children:e==="cli"?e6():a?xJe():s?aJe():_Pe()})]})}function j8t(){var p;const e=gn({mutationFn:m=>FL(...m)}),n=m6(),t=ct(n),r=t.data??null,s=m=>{Gr(n.queryKey,x=>(typeof m=="function"?m(x??null):m)??void 0)},[i,a]=R.useState(!1),[o,l]=R.useState(null),u=o??((p=t.error)==null?void 0:p.message)??null,_=async()=>{await t.refetch({cancelRefetch:!1})},d=()=>{if(!r||i)return;const m=!r.githubForNewProjects;a(!0),l(null),e.mutateAsync([m,!0]).then(s).catch(x=>l(x instanceof Error?x.message:String(x))).finally(()=>a(!1))};return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:yGe()}),r?f.jsxs("div",{className:`${Po} mt-3 project-defaults-card [&_.settings-card-head]:justify-between [&_.settings-card-head]:mb-0 [&_.settings-card-head]:pb-3 [&_.settings-card-head_h3]:m-0`,children:[f.jsxs("div",{className:"settings-card-head flex items-center gap-2.5 mb-3",children:[f.jsx("h3",{children:kGe()}),f.jsx(Ft,{variant:r.githubAuthenticated?"success":r.ghInstalled?"warning":"error",children:r.githubAuthenticated?nL():aL()})]}),f.jsxs("div",{className:Ll,children:[f.jsxs("div",{children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:NN()}),f.jsx("p",{children:MZe()})]}),f.jsx(x6,{type:"button",checked:r.githubForNewProjects,"aria-label":NN(),disabled:i||!r.githubAuthenticated&&!r.githubForNewProjects,onClick:d})]}),!r.githubAuthenticated&&f.jsx("div",{className:"mt-3.5 pt-3.5 border-t border-t-border-variant",children:f.jsx(tF,{ghInstalled:r.ghInstalled,onCheck:_})}),u&&f.jsx("div",{className:"error",children:u})]}):u?f.jsx("div",{className:"error",children:u}):f.jsxs(ss,{children:[f.jsx(Lt,{})," ",yu()]})]})}function tF({ghInstalled:e,onCheck:n}){const[t,r]=R.useState(!1),s=()=>{r(!0),n().finally(()=>r(!1))};return f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"git-card-helper m-0 text-sm leading-relaxed text-text",children:tm(e?FJe():EPe())}),f.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[!e&&f.jsxs(Hh,{variant:"primary",href:"https://cli.github.com/",target:"_blank",rel:"noreferrer",children:[tWe()," ",f.jsx(Md,{size:12})]}),f.jsx(Oe,{type:"button",variant:e?"warning":"default",disabled:t,onClick:s,children:t?Yi():Kp()})]})]})}function T8t(){var m,x,S;const e=gn({mutationFn:Out}),n=gn({mutationFn:Iut}),t=kgt(),r=ct(t),s=((m=r.data)==null?void 0:m.hasToken)??null,i=((x=r.data)==null?void 0:x.hasSession)??null,a=v=>Gr(t.queryKey,{hasToken:s??!1,hasSession:i??!1,...v}),o=v=>a({hasToken:v}),[l,u]=R.useState(!1),[_,d]=R.useState(null),p=_??((S=r.error)==null?void 0:S.message);return f.jsxs("div",{className:Y3,children:[f.jsx("h3",{children:pL()}),f.jsxs("div",{className:Bd,children:[f.jsx("span",{className:"k",children:zGe()}),f.jsx("span",{className:"v",children:f.jsx(Ft,{variant:s?"success":"default",children:s===null?p?Ya():Yi():s?MN():T4()})})]}),f.jsx("p",{className:"git-card-helper mt-3.5 mx-0 mb-0 text-sm leading-relaxed text-text",children:IZe()}),s?f.jsx("div",{className:G0,children:f.jsx(Oe,{disabled:l,onClick:()=>{u(!0),d(null),e.mutateAsync().then(v=>o(v.hasToken)).catch(v=>d(v instanceof Error?v.message:String(v))).finally(()=>u(!1))},children:l?RN():_Je()})}):f.jsx(aA,{save:DL,onSaved:v=>o(v.hasToken),placeholder:SQe(),createHref:"https://www.overleaf.com/user/settings"}),f.jsxs("div",{className:Bd,children:[f.jsx("span",{className:"k",children:FYe()}),f.jsx("span",{className:"v",children:f.jsx(Ft,{variant:i?"success":"default",children:i===null?p?Ya():Yi():i?MN():T4()})})]}),f.jsx("p",{className:"git-card-helper mt-3.5 mx-0 mb-0 text-sm leading-relaxed text-text",children:GYe()}),i?f.jsx("div",{className:G0,children:f.jsx(Oe,{disabled:l,onClick:()=>{u(!0),d(null),n.mutateAsync().then(v=>a({hasSession:v.hasSession})).catch(v=>d(v instanceof Error?v.message:String(v))).finally(()=>u(!1))},children:l?RN():uJe()})}):f.jsx(aA,{save:v=>LL(v),onSaved:v=>a({hasSession:v.hasSession}),placeholder:N4(),createHref:"https://www.overleaf.com/project",createLabel:qze()}),p&&f.jsx("div",{className:"error",children:p})]})}function A8t({project:e,onProjectUpdate:n}){var T;const t=gn({mutationFn:z=>FL(...z)}),r={...Ift((e==null?void 0:e.id)??""),enabled:!!e},s=ct(r),i=s.data??null,a=z=>{Gr(r.queryKey,M=>(typeof z=="function"?z(M??null):z)??void 0)},[o,l]=R.useState(!1),[u,_]=R.useState(null),d=u??((T=s.error)==null?void 0:T.message)??null,[p,m]=R.useState(!1),[x,S]=R.useState(!1),[v,b]=R.useState(null),w=!!(i!=null&&i.github.owner&&i.github.repo),y=async()=>{await s.refetch({cancelRefetch:!1})},C=z=>{const M=z instanceof Error?z.message:String(z);return M.toLowerCase().includes("archived")?P$e():M.includes("(fetch first)")||M.includes("non-fast-forward")?U$e():M.includes("403")||M.toLowerCase().includes("permission denied")?K$e():M},E=()=>{e&&(l(!0),_(null),Gdt(e.id).then(z=>{a(z.git),n(z.project),nt.fetchQuery(m6()).then(M=>{!M.githubForNewProjects&&!M.githubDefaultPromptSeen&&m(!0)}).catch(()=>{})}).catch(z=>_(C(z))).finally(()=>l(!1)))},N=z=>{S(!0),b(null),t.mutateAsync([z,!0]).then(()=>m(!1)).catch(M=>b(M instanceof Error?M.message:String(M))).finally(()=>S(!1))};return f.jsxs(f.Fragment,{children:[f.jsx("h1",{children:xYe()}),f.jsx("p",{className:"settings-sub mt-0 mx-0 mb-4.5 text-base leading-relaxed text-text",children:MJe({project:(e==null?void 0:e.name)??v$e()})}),e?d&&!i?f.jsx("div",{className:"error",children:d}):i?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:Y3,children:[f.jsx("h3",{children:VWe()}),f.jsxs("div",{className:Bd,children:[f.jsx("span",{className:"k",children:LQe()}),f.jsx("span",{className:"v",children:i.path}),f.jsx("span",{className:"k",children:"Git"}),f.jsx("span",{className:"v",children:i.gitVersion??qD()}),f.jsx("span",{className:"k",children:hXe()}),f.jsx("span",{className:"v",children:i.initialized?O$e({branch:Ne(i.currentBranch??o6()),state:i.clean?qBe():nPe()}):bHe()}),f.jsx("span",{className:"k",children:mqe()}),f.jsx("span",{className:"v",children:i.baselineBranch}),f.jsx("span",{className:"k",children:gYe()}),f.jsx("span",{className:"v",children:i.remotes.length?i.remotes.map(z=>`${z.name}: ${z.url}`).join(" · "):l6()})]}),!i.initialized&&f.jsx("div",{className:G0,children:f.jsx(Oe,{variant:"primary",onClick:()=>void Udt(e.id).then(a).catch(z=>_(String(z))),children:UGe()})})]}),f.jsxs("div",{className:Y3,children:[f.jsx("h3",{children:"GitHub"}),f.jsxs("div",{className:Bd,children:[f.jsx("span",{className:"k",children:oL()}),f.jsx("span",{className:"v",children:f.jsx(Ft,{variant:i.github.authenticated?"success":i.github.ghInstalled?"warning":"error",children:i.github.authenticated?nL():aL()})}),f.jsx("span",{className:"k",children:qQe()}),f.jsx("span",{className:"v",children:w?f.jsxs(f.Fragment,{children:[f.jsxs("span",{children:[i.github.owner,"/",i.github.repo]}),!i.github.enabled&&f.jsx(Ft,{children:zXe()})]}):f.jsx(Ft,{children:qWe()})}),i.github.enabled&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"k",children:kXe()}),f.jsx("span",{className:"v",children:i.github.syncStatus})]})]}),!i.github.authenticated&&f.jsx("div",{className:"mt-3.5 pt-3.5 border-t border-t-border-variant",children:f.jsx(tF,{ghInstalled:i.github.ghInstalled,onCheck:()=>y()})}),i.github.authenticated&&!i.github.enabled&&f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"git-card-helper mt-3.5 mx-0 mb-0 text-sm leading-relaxed text-text",children:w?_tt():_$e()}),f.jsxs("div",{className:G0,children:[w&&i.github.url&&f.jsxs(Hh,{href:i.github.url,target:"_blank",rel:"noreferrer",children:[TN()," ",f.jsx(Md,{size:12})]}),f.jsx(Oe,{variant:"primary",disabled:o,onClick:E,children:o?oIe():rIe()})]})]}),i.github.enabled&&f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"git-card-helper mt-3.5 mx-0 mb-0 text-sm leading-relaxed text-text",children:rGe()}),f.jsxs("div",{className:G0,children:[i.github.url&&f.jsxs(Hh,{href:i.github.url,target:"_blank",rel:"noreferrer",children:[TN()," ",f.jsx(Md,{size:12})]}),f.jsx(Oe,{disabled:o,onClick:()=>{l(!0),Wdt(e.id).then(z=>{a(z.git),n(z.project)}).catch(z=>_(z instanceof Error?z.message:String(z))).finally(()=>l(!1))},children:o?dIe():JOe()})]})]})]}),f.jsx(T8t,{}),d&&f.jsx("div",{className:"error",children:C(d)})]}):f.jsxs(ss,{children:[f.jsx(Lt,{})," ",yu()]}):f.jsx("div",{className:Po,children:f.jsx("p",{className:Ca,children:KKe()})}),p&&f.jsx("div",{className:"modal-backdrop fixed inset-0 bg-modal-backdrop-light flex items-start justify-center pt-[var(--modal-top)] px-4 pb-6 overflow-y-auto z-100",onClick:()=>N(!1),children:f.jsxs("div",{className:"modal max-w-[94vw] max-h-[calc(100vh_-_var(--modal-top)_-_48px)] overflow-y-auto bg-background border border-border rounded-xl shadow-modal p-6 [&_h2]:mt-0 [&_h2]:mx-0 [&_h2]:mb-3.5 [&_h2]:text-xl github-default-modal w-110 [&_>_p]:m-0 [&_>_p]:text-sm [&_>_p]:leading-relaxed [&_>_p]:text-text [&_>_.error]:mt-3.5",role:"dialog","aria-modal":"true","aria-labelledby":"github-default-title",onClick:z=>z.stopPropagation(),children:[f.jsx("h2",{id:"github-default-title",children:tVe()}),f.jsx("p",{children:UXe()}),v&&f.jsx("div",{className:"error",children:v}),f.jsxs("div",{className:"github-default-actions flex justify-end gap-2.5 mt-5.5",children:[f.jsx(Oe,{disabled:x,onClick:()=>N(!1),children:jKe()}),f.jsx(Oe,{variant:"primary",disabled:x,onClick:()=>N(!0),children:x?ea():sFe()})]})]})})]})}const R8t={env:Ait,config:Lit,xdg:$it,default:Nit},zw={preparing:bit,copying:Qst,verifying:qit,finalizing:Jst},M8t=e=>{var n;return((n=zw[e])==null?void 0:n.call(zw))??e};function D8t(){var y;const e=Aft(),n=ct(e),t=n.data??null,r=t?null:((y=n.error)==null?void 0:y.message)??null,[s,i]=R.useState(""),[a,o]=R.useState(!1),[l,u]=R.useState(null),[_,d]=R.useState({kind:"idle"}),[p,m]=R.useState(null);R.useEffect(()=>{t&&i(C=>C||t.current)},[t]),R.useEffect(()=>XL(C=>{C.type==="progress"?d(E=>{const N=E.kind==="moving"?E.total:0;return{kind:"moving",phase:C.phase,copied:C.copiedBytes,total:C.totalBytes||N}}):C.type==="done"?(d({kind:"done",oldPathLeft:C.oldPathLeft}),u(null),i("")):C.type==="error"&&d({kind:"error",message:C.error})}),[]);const x=(t==null?void 0:t.source)==="env",S=s.trim(),v=t!==null&&S===t.current;async function b(){if(!(a||!S)){o(!0),m(null),u(null);try{u(await ddt(S))}catch(C){m(C instanceof Error?C.message:String(C))}finally{o(!1)}}}async function w(C){if(C.preventDefault(),!(_.kind==="moving"||!S||v)&&(m(null),!!window.confirm(oit({path:Ne(S)})))){d({kind:"moving",phase:"preparing",copied:0,total:(l==null?void 0:l.treeBytes)??0});try{await fdt(S)}catch(E){d({kind:"idle"}),m(E instanceof Error?E.message:String(E))}}}return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:yXe()}),f.jsx("p",{className:"settings-sub mt-0 mx-0 mb-4.5 text-sm leading-relaxed text-subtext",children:cet()}),r?f.jsx("div",{className:Po,children:f.jsx("div",{className:"error",children:r})}):t?f.jsxs("div",{className:Po,children:[f.jsx("div",{className:"settings-card-head mb-3",children:f.jsx("h3",{children:DUe()})}),f.jsxs("div",{className:Bd,children:[f.jsx("span",{className:"k",children:vUe()}),f.jsx("span",{className:"v",children:t.current}),f.jsx("span",{className:"k",children:gL()}),f.jsx("span",{className:"v",children:R8t[t.source]()})]}),!x&&f.jsxs("form",{className:pk,onSubmit:w,children:[f.jsxs("label",{children:[CVe(),f.jsx("input",{className:"text-sm",type:"text",value:s,onChange:C=>{i(C.target.value),u(null)},placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,disabled:_.kind==="moving"})]}),l&&!l.error&&l.ok&&f.jsxs("p",{className:Ca,children:[oYe()," ",Ml(l.treeBytes??0),l.freeBytes!=null&&` — ${rit({size:Ne(Ml(l.freeBytes))})}`,l.sameFilesystem?Sit():"","."]}),l&&l.ok===!1&&l.error&&f.jsx("div",{className:"error",children:l.error}),p&&f.jsx("div",{className:"error",children:p}),_.kind==="moving"&&f.jsx(qP,{value:_.copied,max:_.total,label:M8t(_.phase),caption:_.total>0?f.jsxs("span",{className:"text-sm",children:[Ml(_.copied)," / ",Ml(_.total)]}):void 0}),_.kind==="done"&&f.jsxs("p",{className:Ca,children:[gVe(),_.oldPathLeft&&f.jsxs(f.Fragment,{children:[" ",THe({path:Ne(_.oldPathLeft)})]})]}),_.kind==="error"&&f.jsxs("div",{className:"error",children:[hVe()," ",_.message]}),f.jsxs("div",{className:"actions",children:[f.jsx(Oe,{type:"button",onClick:b,disabled:a||!S||v||_.kind==="moving",children:a?Yi():fBe()}),f.jsx(Oe,{variant:"primary",type:"submit",disabled:!S||v||_.kind==="moving",children:_.kind==="moving"?pit():dit()})]})]})]}):f.jsxs(ss,{children:[f.jsx(Lt,{})," ",yu()]})]})}const J3=e=>e==="running"||e==="starting";function L8t(e){return J3(e.status)?np(Date.now()-e.createdAt):e.endedAt?np(e.endedAt-e.createdAt):"—"}function nF({instances:e,emptyLabel:n}){return e.length===0?f.jsx("p",{className:"instances-empty m-0 rounded-lg border border-border bg-background py-3.5 px-4 text-base text-subtext",children:n}):f.jsx("div",{className:"instances-table-wrap overflow-x-auto",children:f.jsxs("table",{className:"runs-table w-full border-collapse bg-background text-base [&_th]:text-start [&_th]:text-text [&_th]:text-sm [&_th]:font-medium [&_th]:py-2 [&_th]:px-3 [&_th]:border-b [&_th]:border-b-border [&_th]:sticky [&_th]:top-0 [&_th]:bg-background [&_th]:z-1 [&_td]:py-2 [&_td]:px-3 [&_td]:border-b [&_td]:border-b-divider-faint [&_td]:whitespace-nowrap [&_tr:last-child_td]:border-b-0 [&_tr.clickable]:cursor-pointer [&_tr.clickable:hover_td]:bg-canvas",children:[f.jsx("thead",{children:f.jsxs("tr",{children:[f.jsx("th",{children:fqe()}),f.jsx("th",{children:o_()}),f.jsx("th",{children:cXe()}),f.jsx("th",{children:MYe()})]})}),f.jsx("tbody",{children:e.map(t=>{var s;const r=typeof((s=t.backend)==null?void 0:s.url)=="string"?t.backend.url:void 0;return f.jsxs("tr",{children:[f.jsx("td",{children:f.jsxs("span",{className:"backend-cell inline-flex items-center gap-0.5",children:[f.jsx($6,{backend:t.backend}),r&&f.jsx(rb,{size:"small",href:r,target:"_blank",rel:"noreferrer",title:jN(),"aria-label":jN(),onClick:i=>i.stopPropagation(),children:f.jsx(Md,{size:12})})]})}),f.jsx("td",{children:f.jsx($l,{status:Gi(t)})}),f.jsx("td",{children:Io(t.createdAt)}),f.jsx("td",{children:L8t(t)})]},t.id)})})]})})}function O8t({projectId:e,onViewHistory:n}){var d;const t=ct({...su(e??""),enabled:!!e,subscribed:!!e}),r=e?t.data??(t.error?[]:null):[],s=(d=t.error)==null?void 0:d.message,i=t.isFetching,[,a]=R.useState(0);R.useEffect(()=>{const p=setInterval(()=>a(m=>m+1),3e4);return()=>clearInterval(p)},[]);const o=()=>{e&&t.refetch()},l=(p,m)=>m.createdAt-p.createdAt,u=r==null?void 0:r.filter(p=>J3(p.status)).sort(l),_=r==null?void 0:r.filter(p=>!J3(p.status)).sort(l);return f.jsxs("section",{className:"compute-activity [&_.count-badge]:inline-flex [&_.count-badge]:items-center [&_.count-badge]:justify-center [&_.count-badge]:min-w-4.5 [&_.count-badge]:h-4.5 [&_.count-badge]:py-0 [&_.count-badge]:px-[5px] [&_.count-badge]:rounded-md [&_.count-badge]:bg-canvas [&_.count-badge]:border [&_.count-badge]:border-border [&_.count-badge]:text-xs [&_.count-badge]:font-medium [&_.count-badge]:text-text mt-5.5 mx-0 mb-8",children:[f.jsxs("div",{className:"compute-activity-head flex items-start justify-between gap-5 mb-3.5 [&_h2]:flex [&_h2]:items-center [&_h2]:gap-2 [&_h2]:m-0 [&_h2]:text-lg [@media((max-width:_640px))]:items-stretch [@media((max-width:_640px))]:flex-col",children:[f.jsx("div",{children:f.jsxs("h2",{children:[jYe(),u&&u.length>0&&f.jsx("span",{className:"count-badge",children:u.length})]})}),f.jsxs("div",{className:"compute-activity-actions flex gap-2 flex-none [@media((max-width:_640px))]:justify-start",children:[f.jsxs(Oe,{size:"small",onClick:o,disabled:i,children:[f.jsx(Aa,{size:12,className:i?"animate-[spin_0.9s_linear_infinite]":""})," ",Yp()]}),f.jsx(Oe,{size:"small",onClick:n,children:_!=null&&_.length?p3e({count:Wt(_.length)}):d3e()})]})]}),s&&f.jsx("div",{className:"error",children:s}),!u||!_?f.jsxs(ss,{children:[f.jsx(Lt,{})," ",yu()]}):f.jsx(nF,{instances:u,emptyLabel:e?J4e():o3e()})]})}function I8t({projectId:e,onBack:n}){var l;const t=ct({...su(e??""),enabled:!!e,subscribed:!!e}),r=e?t.data??(t.error?[]:null):[],s=(l=t.error)==null?void 0:l.message,i=t.isFetching,[,a]=R.useState(0);R.useEffect(()=>{const u=setInterval(()=>a(_=>_+1),3e4);return()=>clearInterval(u)},[]);const o=()=>{e&&t.refetch()};return f.jsxs(f.Fragment,{children:[f.jsxs("button",{type:"button",className:"settings-back inline-flex items-center gap-1.5 mt-0 mx-0 mb-4.5 text-subtext text-sm font-medium [&:hover]:text-text",onClick:n,children:[f.jsx(ap,{size:14})," ",lL()]}),f.jsxs("div",{className:"settings-head-row flex items-center justify-between gap-2.5 [&_h1]:m-0",children:[f.jsx("h1",{children:lWe()}),f.jsxs(Oe,{size:"small",onClick:o,disabled:i,children:[f.jsx(Aa,{size:12,className:i?"animate-[spin_0.9s_linear_infinite]":""})," ",Yp()]})]}),s&&f.jsx("div",{className:"error",children:s}),r?f.jsx(nF,{instances:[...r].sort((u,_)=>_.createdAt-u.createdAt),emptyLabel:e?Q4e():r3e()}):f.jsxs(ss,{children:[f.jsx(Lt,{})," ",yu()]})]})}const rF=["projects","harnesses","storage"],B8t=[{id:"compute",label:cL,icon:f.jsx(HO,{size:15}),activeTabs:["compute","instances"]},{id:"environment",label:dL,icon:f.jsx(c_,{size:15}),activeTabs:["environment"]},{id:"settings",label:f6,icon:f.jsx(XO,{size:15}),activeTabs:["settings",...rF]}];function $8t(e){return rF.includes(e)}function P8t({tab:e,project:n,onProjectUpdate:t,onSelectTab:r,remote:s=!1}){const i=e==="settings"||$8t(e),a=R.useRef(null);return R.useLayoutEffect(()=>{const o=a.current,l=o==null?void 0:o.parentElement;if(!o||!l)return;const u=()=>o.scrollIntoView({block:"start"}),_=new ResizeObserver(u);_.observe(l),u();const d=()=>_.disconnect(),p=["wheel","touchstart","pointerdown","keydown"];for(const m of p)window.addEventListener(m,d,{passive:!0});return()=>{d();for(const m of p)window.removeEventListener(m,d)}},[e,n==null?void 0:n.id]),f.jsxs("div",{className:"settings-view max-w-readable my-0 mx-auto pt-6 px-8 pb-15 [&_h1]:mt-0 [&_h1]:mx-0 [&_h1]:mb-1.5 [&_h1]:text-3xl [&_>_.error]:text-accent-red [&_>_.error]:text-base [&_>_.error]:whitespace-pre-wrap [&_>_.error]:mt-0 [&_>_.error]:mx-0 [&_>_.error]:mb-3",children:[i&&f.jsxs(f.Fragment,{children:[f.jsx("h1",{children:f6()}),f.jsxs("div",{className:"settings-stack mt-4.5",children:[f.jsx("section",{className:Wf,children:f.jsx(k8t,{})}),f.jsx("section",{ref:e==="projects"?a:void 0,className:Wf,children:f.jsx(j8t,{})}),f.jsx("section",{ref:e==="harnesses"?a:void 0,className:Wf,children:f.jsx(X7t,{})}),!s&&f.jsx("section",{ref:e==="storage"?a:void 0,className:Wf,children:f.jsx(D8t,{})}),f.jsx("section",{className:Wf,children:f.jsx(N8t,{})}),!s&&f.jsx("section",{className:Wf,children:f.jsx(E8t,{})})]})]}),e==="compute"&&f.jsx(m8t,{project:n,onViewHistory:()=>r("instances"),onOpenEnvironment:()=>r("environment"),remote:s}),e==="instances"&&f.jsx(I8t,{projectId:n==null?void 0:n.id,onBack:()=>r("compute")}),e==="environment"&&f.jsxs(f.Fragment,{children:[f.jsx("h1",{children:dL()}),f.jsx(w8t,{})]}),e==="git"&&f.jsx(A8t,{project:n,onProjectUpdate:t})]})}function zv(e){return e.charAt(0).toUpperCase()+e.slice(1).replaceAll("-"," ")}function e5(e){return`${e.plugin?`${zv(e.plugin)}: `:""}${zv(e.name)}`}const uA={name:"plan",get description(){return OTe()},source:"command"};function jw(e,n){if(n<0||n>e.length)return null;let t=n;for(;t>0&&!/\s/.test(e[t-1]);)t-=1;if(e[t]!=="/")return null;let r=n;for(;r=r?_:s}${a.slice(_.length)}`:s+a}const o=((u=/^[ \t]+/.exec(a))==null?void 0:u[0].length)??0;return{text:`${i}/${t}${a}`,cursor:i.length+t.length+1+o}}function dA(e,n){let t=e.slice(0,n.start),r=e.slice(n.end);return t?r?/\s$/.test(t)&&/^\s/.test(r)&&(r=r.slice(1)):t=t.replace(/\s$/,""):r=r.replace(/^\s/,""),{text:t+r,cursor:t.length}}function q8t(e,n){const t=e.filter(r=>r.name.toLowerCase()!==uA.name);return n&&t.push(uA),t.sort((r,s)=>+(s.source==="command")-+(r.source==="command")||e5(r).localeCompare(e5(s),void 0,{sensitivity:"base"}))}function U8t(e,n){if(!n)return null;const t=/(^|\s)\/plan(?=\s|$)/gi;return t.test(e)?{prompt:e.replace(t,"").trim()}:null}function fA(e,n,t){if(e==="command")return n!==void 0?n:t??void 0}function G8t({skills:e,activeIndex:n,onPick:t,onHover:r}){const s=R.useRef(null);return R.useLayoutEffect(()=>{var i;(i=s.current)==null||i.scrollIntoView({block:"nearest"})},[n,e]),f.jsx("div",{className:"skill-menu absolute bottom-[calc(100%_+_8px)] start-0 w-full max-h-[min(18rem,40vh)] overflow-y-auto overscroll-contain p-1.5 bg-background border border-border-variant rounded-2xl shadow-control-subtle z-50",children:e.map((i,a)=>f.jsxs("button",{ref:a===n?s:void 0,type:"button",className:`skill-item flex items-center gap-2 w-full text-start py-1 px-2 rounded-full text-sm font-normal text-text/80 [&.active]:bg-hover-muted [&.active]:text-text ${a===n?"active":""}`,onMouseDown:o=>{o.preventDefault(),t(i)},onMouseEnter:()=>r(a),children:[i.source==="command"&&i.name==="plan"?f.jsx(WO,{size:16,strokeWidth:1.5,className:"shrink-0","aria-hidden":"true"}):f.jsx(JO,{size:16,strokeWidth:1.5,className:"shrink-0","aria-hidden":"true"}),f.jsx("span",{className:"skill-name shrink-0",children:e5(i)}),f.jsx("span",{className:"skill-desc min-w-0 truncate text-muted",children:i.description}),i.source==="user"&&f.jsx("span",{className:"ms-auto shrink-0 ps-2 text-muted",children:Mtt()})]},i.name))})}const W8t=["font-family","font-size","font-weight","font-style","font-variant","line-height","letter-spacing","word-spacing","text-transform","direction","unicode-bidi","tab-size","padding-top","padding-right","padding-bottom","padding-left","border-top-width","border-right-width","border-bottom-width","border-left-width"];let V8t=null;function t5(e,n){const t=V8t??(V8t=document.createElement("canvas").getContext("2d"));if(!t||!n)return 6;const r=getComputedStyle(n);t.font=`${r.fontStyle} ${r.fontWeight} ${r.fontSize} ${r.fontFamily}`;const s=20+t.measureText(zv(e)).width-t.measureText(`/${e}`).width;return Math.max(2,Math.ceil((s+6)/t.measureText(" ").width))}function sF({name:e}){const n=e==="plan"?WO:JO;return f.jsxs(f.Fragment,{children:[f.jsx(n,{size:16,strokeWidth:1.5,className:"me-1 inline-block align-middle","aria-hidden":"true"}),zv(e)]})}function iF(e,n,t,r,s,i=!1){let a=0;return F8t(e,n).map((o,l,u)=>{var m,x;const _=a+o.text.length;a=_;const d=o.text.slice(1).toLowerCase();if(o.command&&s)return s(o.text,d,_,l);let p=o.text;return i||((m=u[l-1])!=null&&m.command&&(p=p.replace(/^[ \t]+/," ")),(x=u[l+1])!=null&&x.command&&(p=p.replace(/[ \t]+$/," "))),o.command?f.jsx("span",{className:t,onMouseDown:void 0,children:f.jsx(sF,{name:d})},l):i?f.jsx("span",{"aria-hidden":"true",children:o.text},l):f.jsx(R.Fragment,{children:p},l)})}function K8t({label:e,name:n,end:t,skill:r,projectId:s,textareaRef:i}){const a=R.useRef(null),o=R.useRef(null),l=R.useRef(null),u=R.useId(),[_,d]=R.useState(!1),p=ct({...Pft(n,s,r.harness),enabled:_,subscribed:_}),m=p.data??null,x=p.isFetching,[S,v]=R.useState({}),b=()=>{l.current!==null&&window.clearTimeout(l.current),l.current=null},w=()=>{const E=a.current;if(!E)return;const N=E.getBoundingClientRect(),T=Math.min(420,window.innerWidth-32),z=Math.max(16,Math.min(N.left-4,window.innerWidth-T-16));v(N.top>300?{bottom:window.innerHeight-N.top+12,left:z,width:T}:{left:z,top:N.bottom+12,width:T})},y=()=>{b(),w(),d(!0)},C=()=>{b(),l.current=window.setTimeout(()=>d(!1),120)};return R.useEffect(()=>()=>b(),[]),R.useEffect(()=>{if(!_)return;const E=()=>w();return window.addEventListener("resize",E),window.addEventListener("scroll",E,!0),()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0)}},[_]),f.jsxs(R.Fragment,{children:[f.jsxs("span",{ref:a,role:"button",tabIndex:0,"aria-controls":u,"aria-expanded":_,"aria-label":WQ({name:n}),className:"composer-chip group/skill pointer-events-auto relative z-1 inline-grid align-baseline cursor-text rounded-md bg-background text-skill-blue",onMouseEnter:y,onMouseLeave:C,onFocus:y,onBlur:C,onKeyDown:E=>{var N,T;if(E.key==="Escape"){d(!1);return}if(E.key==="Enter"||E.key===" "){E.preventDefault(),y();return}_&&(E.key==="ArrowDown"||E.key==="PageDown")&&(E.preventDefault(),(N=o.current)==null||N.scrollBy({top:E.key==="PageDown"?240:48,behavior:"smooth"})),_&&(E.key==="ArrowUp"||E.key==="PageUp")&&(E.preventDefault(),(T=o.current)==null||T.scrollBy({top:E.key==="PageUp"?-240:-48,behavior:"smooth"}))},onMouseDown:E=>{var N,T;E.preventDefault(),(N=i.current)==null||N.focus(),(T=i.current)==null||T.setSelectionRange(t,t),b()},children:[f.jsx("span",{className:"pointer-events-none absolute -inset-[7px] z-0 rounded-md bg-skill-blue-subtle opacity-0 transition-opacity group-hover/skill:opacity-100"}),f.jsx("span",{className:"invisible col-start-1 row-start-1","aria-hidden":"true",children:e}),f.jsx("span",{className:"relative z-1 col-start-1 row-start-1 w-0 whitespace-nowrap",children:f.jsx("span",{className:"bg-background text-skill-blue",children:f.jsx(sF,{name:n})})})]}),_&&no.createPortal(f.jsxs("div",{id:u,ref:o,role:"dialog","aria-label":kY({name:n}),style:{...S,maxHeight:"min(28rem, calc(100vh - 2rem))"},className:"fixed z-100 overflow-y-auto rounded-lg border border-border bg-background shadow-floating",onMouseEnter:b,onMouseLeave:C,onFocus:b,onBlur:C,onMouseDown:E=>E.stopPropagation(),children:[f.jsxs("div",{className:"sticky top-0 z-1 flex items-center gap-2 border-b border-border-variant bg-background px-4 py-3",children:[f.jsxs("span",{className:"text-sm font-medium text-muted",children:["/",n]}),f.jsx(Ft,{className:"h-5 border-border-variant bg-canvas px-1.5 tracking-[0.05em]",children:Ctt()})]}),f.jsx("div",{className:"p-4 text-sm text-text",children:x&&m===null?f.jsx("span",{className:"text-muted",children:jtt()}):f.jsx($o,{text:m??r.description})})]}),document.body)]})}function Q8t({text:e,isCommand:n}){return f.jsx(f.Fragment,{children:iF(e,n,"skill-chip me-0.5 whitespace-nowrap font-normal text-skill-blue")})}function Y8t({text:e,editingTokenEnd:n,isCommand:t,skills:r,projectId:s,textareaRef:i}){const a=R.useRef(null);return R.useLayoutEffect(()=>{const o=i.current,l=a.current;if(!o||!l)return;const u=()=>{const d=getComputedStyle(o);for(const p of W8t)l.style.setProperty(p,d.getPropertyValue(p));l.style.width=`${o.clientWidth+parseFloat(d.borderLeftWidth)+parseFloat(d.borderRightWidth)}px`};u();const _=new ResizeObserver(u);return _.observe(o),()=>_.disconnect()},[e,i]),R.useLayoutEffect(()=>{const o=i.current;if(!o)return;const l=()=>{a.current&&(a.current.scrollTop=o.scrollTop)};return l(),o.addEventListener("scroll",l),()=>o.removeEventListener("scroll",l)},[i,e]),f.jsxs("div",{ref:a,className:"composer-chips pointer-events-none absolute inset-y-0 start-0 z-2 box-border overflow-hidden whitespace-pre-wrap break-words border-solid border-transparent text-transparent select-none",children:[iF(e,t,"",void 0,(o,l,u,_)=>{var x;const d=e.slice(u),p=((x=/^[ \t]+/.exec(d))==null?void 0:x[0].length)??0;if(u===n||d&&!d.startsWith(` -`)&&pS.name===l);return m&&m.source!=="command"?f.jsx(K8t,{label:o,name:l,end:u,skill:m,projectId:s,textareaRef:i},`${_}:${u}`):f.jsxs("span",{"aria-hidden":"true",className:"bg-background text-skill-blue",children:[f.jsx("span",{className:"text-skill-blue-slash",children:"/"}),o.slice(1)]},`${_}:${u}`)},!0),"​"]})}function X8t(e){return e>=95?"var(--accent-red)":e>=80?"var(--accent-amber)":"var(--accent)"}const n5=6.5,hA=2*Math.PI*n5;function Z8t({usage:e}){return!e||e.usedTokens<=0?null:f.jsx(J8t,{usage:e})}function J8t({usage:e}){const{open:n,setOpen:t,ref:r}=ro(),{usedTokens:s,contextWindow:i}=e,a=i&&i>0?Math.min(100,Math.round(s/i*100)):null,o=a===null?"var(--accent)":X8t(a),l=a===null?"":new Intl.NumberFormat(j(),{style:"percent"}).format(a/100);return f.jsxs("div",{className:"option-picker relative inline-flex shrink-0",ref:r,children:[f.jsx("button",{type:"button",className:`${a===null?"inline-flex h-8 items-center rounded-md px-1 transition-[background,color] duration-150 ease-standard hover:bg-surface":"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-text transition-[background,color] duration-150 ease-standard hover:bg-surface"} composer-bare context-ring text-sm text-text`,title:yge(),onClick:()=>t(u=>!u),children:a===null?jg(s):f.jsxs("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true",children:[f.jsx("circle",{cx:"8",cy:"8",r:n5,fill:"none",stroke:"var(--border)",strokeWidth:"2.5"}),f.jsx("circle",{cx:"8",cy:"8",r:n5,fill:"none",stroke:o,strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:`${hA*Math.max(a,2)/100} ${hA}`,transform:"rotate(-90 8 8)"})]})}),n&&f.jsxs("div",{className:"option-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-95 flex flex-col bg-background border border-border rounded-lg shadow-menu z-50 overflow-hidden min-w-47.5 [&.align-right]:start-auto [&.align-right]:end-0 [&.drop-down]:bottom-auto [&.drop-down]:top-[calc(100%_+_4px)] [&.session-menu]:start-auto [&.session-menu]:end-1.5 [&.session-menu]:top-[calc(100%_-_2px)] [&.session-menu]:min-w-35 align-right context-meter-menu w-70 pt-2.5 px-3 pb-3 [&_.progress]:mt-2 [&_.progress]:mx-0 [&_.progress]:mb-0 [&_.progress-track]:h-[5px] [&_.progress-track]:border-0 [&_.progress-track]:bg-border",children:[f.jsxs("div",{className:"context-meter-head flex justify-between items-baseline gap-3 text-sm text-muted",children:[f.jsx("span",{children:mge()}),f.jsx("span",{className:"context-meter-value text-text tabular-nums",children:a===null?kge({value:Ne(jg(s))}):zge({used:Ne(jg(s)),total:Ne(jg(i)),percent:Ne(l)})})]}),a!==null&&f.jsx(qP,{value:s,max:i,fillColor:o})]})]})}const jv="!";function _A(e){return e.startsWith(jv)?e.slice(jv.length).trim():null}function eCt(e){return e.startsWith(jv)?e.slice(jv.length):e}function tCt(e){return e.replace(/([\\`*_[\]<>$~])/g,"\\$1").replace(/(^|\n)(\s*)(#{1,6}|>|[-+]|\d+\.)\s/g,"$1$2\\$3 ").replace(/(^|\n)(\s*)(=+|-{1,2})(?=\s*(?:\n|$))/g,"$1$2\\$3").replace(/(^|\n)(\s*)(-{3,})(?=\s*(?:\n|$))/g,"$1$2\\$3")}function nCt(e){const n=Math.max(0,...Array.from(e.matchAll(/`+/g),s=>s[0].length)),t="`".repeat(n+1),r=/^[\s`]|[\s`]$/.test(e)?` ${e} `:e;return`${t}${r}${t}`}function rCt(e){const n=Math.max(0,...Array.from(e.matchAll(/`+/g),r=>r[0].length)),t="`".repeat(Math.max(3,n+1));return` +`)))return f.jsx("code",{className:s,...r,children:t});const l=i?p3(i[1]):null;return f.jsx(F7t,{code:a,lang:l})},pre:({children:e})=>f.jsx(f.Fragment,{children:e})},$o=R.memo(function({text:n,onOpenFile:t,onOpenRun:r,resolveFilePath:s,resolveImageSrc:i,predict:a=!1}){Gd();const o=R.useMemo(()=>({"file-mention":l=>f.jsx(sA,{path:l.path,lines:l.lines,exp:l.exp,onOpenFile:t}),"run-mention":l=>f.jsx(G7t,{id:l.id,label:l.label,onOpenRun:r}),a:({node:l,href:u,children:_,...d})=>{if(u&&V7t(u)&&t){let p;try{p=decodeURI(u)}catch{return f.jsx("span",{children:_})}const m=s?s(p):p;return m?f.jsx(sA,{path:m,onOpenFile:t}):f.jsx("span",{children:_})}return f.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",...d,children:_})},th:({node:l,...u})=>f.jsx("th",{dir:"auto",...u}),td:({node:l,...u})=>f.jsx("td",{dir:"auto",...u}),img:({node:l,src:u,alt:_,className:d,...p})=>{if(!u||typeof u!="string")return null;const m=i?i(u):u;return m?f.jsx("img",{...p,src:m,alt:_??"",loading:"lazy",className:`block max-w-full h-auto my-3 rounded-sm border border-border ${d??""}`}):null},...HP}),[t,r,s,i]);return f.jsx("div",{dir:"auto","data-streaming":a||void 0,className:"md min-w-0 wrap-anywhere text-text leading-[1.62] [&_>_*:first-child]:mt-0 [&_>_*:last-child]:mb-0 [&_p]:my-2.5 [&_p]:mx-0 [&_strong]:text-text [&_strong]:font-semibold [&_pre]:bg-surface [&_pre]:border [&_pre]:border-border-muted [&_pre]:rounded-md [&_pre]:py-2 [&_pre]:px-3 [&_pre]:overflow-x-auto [&_pre]:text-sm [&_pre]:text-text [&_code]:font-mono [&_code]:text-sm [&_code]:font-medium [&_code]:text-primary [&_code]:bg-panel [&_code]:border [&_code]:border-border-variant [&_code]:rounded-xs [&_code]:py-px [&_code]:px-[5px] [&_.katex]:text-prose-emphasis [&_.katex-display]:my-3 [&_.katex-display]:mx-0 [&_.katex-display]:overflow-x-auto [&_.katex-display]:overflow-y-hidden [&_.katex-display]:py-0.5 [&_.katex-display]:px-0 [&_.file-chip]:inline-flex [&_.file-chip]:items-center [&_.file-chip]:gap-1 [&_.file-chip]:max-w-full [&_.file-chip]:my-0 [&_.file-chip]:mx-px [&_.file-chip]:py-0 [&_.file-chip]:px-1.5 [&_.file-chip]:align-baseline [&_.file-chip]:font-mono [&_.file-chip]:text-sm [&_.file-chip]:font-medium [&_.file-chip]:text-text [&_.file-chip]:bg-panel [&_.file-chip]:border [&_.file-chip]:border-border-variant [&_.file-chip]:rounded-xs [&_.file-chip]:cursor-pointer [&_.file-chip:hover:not(:disabled)]:bg-surface [&_.file-chip:hover:not(:disabled)]:text-primary [&_.file-chip_svg]:flex-none [&_.file-chip_svg]:opacity-60 [&_.file-chip-label]:max-w-65 [&_.file-chip-label]:overflow-hidden [&_.file-chip-label]:text-ellipsis [&_.file-chip-label]:whitespace-nowrap [&_.run-chip_svg]:opacity-100 [&_.run-chip_svg]:text-primary [&_pre_code]:bg-none [&_pre_code]:bg-transparent [&_pre_code]:border-0 [&_pre_code]:text-inherit [&_pre_code]:p-0 [&_pre_code]:font-normal [&_h1]:text-text [&_h1]:text-prose-emphasis [&_h1]:font-semibold [&_h1]:mt-3 [&_h1]:mx-0 [&_h1]:mb-1.5 [&_h2]:text-text [&_h2]:text-prose-emphasis [&_h2]:font-semibold [&_h2]:mt-3 [&_h2]:mx-0 [&_h2]:mb-1.5 [&_h3]:text-text [&_h3]:text-prose-emphasis [&_h3]:font-semibold [&_h3]:mt-3 [&_h3]:mx-0 [&_h3]:mb-1.5 [&_h4]:text-text [&_h4]:text-prose-emphasis [&_h4]:font-semibold [&_h4]:mt-3 [&_h4]:mx-0 [&_h4]:mb-1.5 [&_ul]:my-1.5 [&_ul]:mx-0 [&_ul]:ps-5.5 [&_ol]:my-1.5 [&_ol]:mx-0 [&_ol]:ps-5.5 [&_li::marker]:text-primary [&_a]:text-primary [&_table]:border-collapse [&_table]:block [&_table]:w-max [&_table]:max-w-full [&_table]:text-sm [&_table]:my-2.5 [&_table]:mx-0 [&_table]:border [&_table]:border-border [&_table]:rounded-md [&_table]:overflow-x-auto [&_th]:border-b [&_th]:border-b-border-variant [&_th]:py-2 [&_th]:px-3.5 [&_th]:text-start [&_th]:text-text [&_th]:break-normal [&_th]:break-words [&_td]:border-b [&_td]:border-b-border-variant [&_td]:py-2 [&_td]:px-3.5 [&_td]:text-start [&_td]:text-text [&_td]:break-normal [&_td]:break-words [&_tr:last-child_td]:border-b-0 [&_thead_th]:bg-surface [&_thead_th]:font-medium [&_thead_th]:text-text [&_thead_th]:border-b [&_thead_th]:border-b-border [&_tbody_tr:hover_td]:bg-surface-bright [&_blockquote]:my-1.5 [&_blockquote]:mx-0 [&_blockquote]:pt-0.5 [&_blockquote]:pe-0 [&_blockquote]:pb-0.5 [&_blockquote]:ps-2.5 [&_blockquote]:border-s-[3px] [&_blockquote]:border-s-border [&_blockquote]:text-subtext [:is(&,_.openresearch-diff,_.file-view)_.token.comment]:italic [:is(&,_.openresearch-diff,_.file-view)_.token.prolog]:italic [:is(&,_.openresearch-diff,_.file-view)_.token.cdata]:italic [:is(&,_.openresearch-diff,_.file-view)_.token.operator]:text-syntax-cyan [:is(&,_.openresearch-diff,_.file-view)_.token.entity]:text-syntax-cyan [:is(&,_.openresearch-diff,_.file-view)_.token.url]:text-syntax-cyan [:is(&,_.openresearch-diff,_.file-view)_.token.comment]:text-syntax-comment [:is(&,_.openresearch-diff,_.file-view)_.token.prolog]:text-syntax-comment [:is(&,_.openresearch-diff,_.file-view)_.token.cdata]:text-syntax-comment [:is(&,_.openresearch-diff,_.file-view)_.token.punctuation]:text-syntax-text [:is(&,_.openresearch-diff,_.file-view)_.token.property]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.tag]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.deleted]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.constant]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.symbol]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.boolean]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.number]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.selector]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.attr-name]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.char]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.inserted]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.string]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.builtin]:text-syntax-yellow [:is(&,_.openresearch-diff,_.file-view)_.token.atrule]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.attr-value]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.keyword]:text-syntax-purple [:is(&,_.openresearch-diff,_.file-view)_.token.function]:text-syntax-blue [:is(&,_.openresearch-diff,_.file-view)_.token.decorator]:text-syntax-blue [:is(&,_.openresearch-diff,_.file-view)_.token.def]:text-syntax-blue [:is(&,_.openresearch-diff,_.file-view)_.token.class-name]:text-syntax-yellow [:is(&,_.openresearch-diff,_.file-view)_.token.namespace]:text-syntax-yellow [:is(&,_.openresearch-diff,_.file-view)_.token.regex]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.important]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.variable]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.parameter]:text-syntax-text",children:f.jsx(L3t,{content:$P(n,{predictMath:a}),processor:W7t,components:o,predict:a})})}),iA="prompt-actions plan-strip-actions flex flex-wrap justify-end gap-x-2 gap-y-1.5";function K7t({synthesized:e,agentLabel:n,onView:t,onApprove:r,showResumeModes:s,onReject:i,onRevise:a}){const[o,l]=R.useState(!1),u=R.useRef(null),[_,d]=R.useState(!1),[p,m]=R.useState(""),x=R.useRef(null);R.useEffect(()=>{if(!o)return;const v=b=>{u.current&&!u.current.contains(b.target)&&l(!1)};return window.addEventListener("pointerdown",v),()=>window.removeEventListener("pointerdown",v)},[o]),R.useEffect(()=>{var v;_&&((v=x.current)==null||v.focus())},[_]);const S=()=>{a(p.trim()||"no specific feedback — use your judgment"),m(""),d(!1)};return f.jsxs("div",{className:"plan-strip relative w-full mt-0 mx-0 mb-2.5 py-[11px] px-[13px] flex flex-col items-stretch gap-2.5 border border-border border-s-[3px] border-s-accent-blue rounded-md bg-surface shadow-plan",children:[f.jsxs("div",{className:"plan-strip-info flex items-baseline gap-2 min-w-0",children:[f.jsx(L6,{size:14,className:"plan-strip-icon text-accent-blue shrink-0 self-center"}),f.jsx("span",{dir:"auto",className:"plan-strip-title text-sm font-semibold whitespace-nowrap",children:e?nAe({agent:Ne(n)}):ZTe({agent:Ne(n)})}),f.jsx("button",{className:"plan-strip-open ms-auto p-0 border-0 bg-none bg-transparent text-accent-blue text-sm cursor-pointer whitespace-nowrap shrink-0 [&:hover]:underline",...Ur(t),children:_Ae()})]}),_?f.jsxs(f.Fragment,{children:[f.jsx("textarea",{dir:"auto",ref:x,className:"plan-strip-revise-input w-full resize-none border border-border rounded-md py-[9px] px-[11px] text-sm font-[inherit] bg-background text-text [&:focus]:border-accent-blue",placeholder:TAe(),rows:2,value:p,onChange:v=>m(v.target.value),onKeyDown:v=>{v.key==="Escape"?(v.preventDefault(),m(""),d(!1)):v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),S())}}),f.jsxs("div",{className:iA,children:[f.jsx(Le,{size:"small",onClick:()=>{m(""),d(!1)},children:aAe()}),f.jsx("span",{className:"plan-strip-spacer flex-1"}),f.jsxs(Le,{size:"small",variant:"primary",onClick:S,children:[wAe(),f.jsx(FO,{size:13})]})]})]}):f.jsxs("div",{className:iA,children:[f.jsx(Le,{size:"small",onClick:i,children:vAe()}),f.jsx(Le,{size:"small",onClick:()=>d(!0),children:EAe()}),f.jsx("span",{className:"plan-strip-spacer flex-1"}),s?f.jsxs("div",{className:"plan-strip-approve relative flex",ref:u,children:[f.jsx(Le,{size:"small",variant:"primary",className:"rounded-e-none",onClick:()=>r("auto"),children:PTe()}),f.jsx(Le,{size:"small",variant:"primary",className:"rounded-s-none border-s-plan-caret px-1.5","aria-label":uAe(),onClick:()=>l(v=>!v),children:f.jsx(qo,{size:13})}),o&&f.jsx("div",{className:"plan-strip-menu absolute end-0 bottom-[calc(100%_+_4px)] flex min-w-47.5 flex-col rounded-md border border-border bg-surface p-1 shadow-plan-menu z-6",children:f.jsx(ir,{onClick:()=>{l(!1),r("bypassPermissions")},children:UTe()})})]}):f.jsx(Le,{size:"small",variant:"primary",onClick:()=>r(),children:KTe()})]})]})}function aA({save:e,onSaved:n,placeholder:t,createHref:r,createLabel:s}){const[i,a]=R.useState(""),[o,l]=R.useState(!1),[u,_]=R.useState(null);async function d(p){if(p.preventDefault(),!(o||!i.trim())){l(!0),_(null);try{n(await e(i.trim())),a("")}catch(m){_(m instanceof Error?m.message:String(m))}finally{l(!1)}}}return f.jsxs("form",{className:"onb-token-form flex items-center flex-wrap gap-2 mt-2 [&_input]:flex-1 [&_input]:min-w-55 [&_input]:text-sm [&_a]:text-sm [&_a]:text-subtext [&_a]:whitespace-nowrap [&_.error]:basis-full [&_.error]:text-accent-red [&_.error]:text-sm [&_.error]:whitespace-pre-wrap",onSubmit:d,children:[f.jsx("input",{type:"password",value:i,onChange:p=>a(p.target.value),placeholder:t,autoComplete:"off"}),f.jsx(Le,{type:"submit",disabled:o||!i.trim(),children:o?Xi():Ho()}),f.jsx("a",{href:r,target:"_blank",rel:"noreferrer",children:s??Gwe()}),u&&f.jsx("div",{className:"error",children:u})]})}function qP({value:e,max:n,label:t,caption:r,fillColor:s}){const i=n>0?Math.min(100,Math.round(e/n*100)):0;return f.jsxs("div",{className:"progress mt-3 mx-0 mb-1",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:[f.jsx("div",{className:"progress-track h-2 rounded-full bg-surface border border-border overflow-hidden",children:f.jsx("div",{className:"progress-fill h-full bg-accent rounded-full transition-[width] duration-200 ease-standard",style:{width:`${i}%`,background:s}})}),(t!==void 0||r!==void 0)&&f.jsxs("div",{className:"progress-caption flex justify-between mt-1.5 text-sm text-muted",children:[f.jsx("span",{children:t??`${i}%`}),r]})]})}const Nv="code-source-text",UP="code-source-wrap",GP="file-view-gutter text-right text-muted select-none";function WP(e){const n=String(e).length+2;return{ruleCh:n,codeCh:n+2}}function VP({value:e,onChange:n,onSave:t,onBlur:r,readOnly:s=!1,path:i,highlightLine:a,scrollRequest:o,onScrollRequestHandled:l,scrollPosition:u,onScrollPositionChange:_}){const d=R.useMemo(()=>IP(e,TS(i)),[e,i]),{ruleCh:p,codeCh:m}=WP(d.length),x=R.useRef(null),S=R.useRef(null),v=()=>{const C=x.current;C&&S.current&&(S.current.scrollTop=C.scrollTop)},b=R.useRef(u);R.useLayoutEffect(()=>{const C=x.current;!C||!b.current||(C.scrollTop=b.current.top,C.scrollLeft=b.current.left,v())},[i]),R.useLayoutEffect(v,[e]),R.useLayoutEffect(()=>{var M;const C=x.current;if(!C||!a||o===void 0)return;const E=e.split(` +`),N=Math.min(Math.max(Math.trunc(a),1),E.length);let T=0;for(let I=0;I{if(!s){if((C.metaKey||C.ctrlKey)&&C.key.toLowerCase()==="s"){C.preventDefault(),t();return}if(C.key==="Tab"){C.preventDefault();const E=C.currentTarget,{selectionStart:N,selectionEnd:T}=E,z=e.slice(0,N)+" "+e.slice(T);n(z),requestAnimationFrame(()=>{E.selectionStart=E.selectionEnd=N+1})}}},y=`absolute inset-0 m-0 py-3.5 pe-4 ${Nv} ${UP} [scrollbar-gutter:stable]`;return f.jsxs("div",{className:`file-view-editwrap relative h-full min-h-0 ${Nv}`,children:[f.jsx("div",{className:"absolute start-0 top-0 bottom-0 border-e border-e-border-variant pointer-events-none",style:{width:`${p}ch`},"aria-hidden":"true"}),f.jsx("div",{ref:S,className:`file-view-code ${y} overflow-hidden pointer-events-none`,"aria-hidden":"true",children:d.map((C,E)=>f.jsxs("div",{"data-line":E+1,className:"relative",style:{paddingInlineStart:`${m}ch`},children:[f.jsx("span",{className:`${GP} absolute start-0 pe-[1ch]`,style:{width:`${p}ch`},children:E+1}),BP(C)?f.jsx("br",{}):C]},E))}),f.jsx("textarea",{ref:x,className:`file-view-editarea ${y} overflow-y-auto overflow-x-hidden resize-none border-0 bg-transparent text-transparent caret-text outline-none`,style:{paddingInlineStart:`${m}ch`},value:e,onChange:C=>{s||n(C.target.value)},onScroll:C=>{v(),_==null||_({top:Math.max(0,C.currentTarget.scrollTop),left:Math.max(0,C.currentTarget.scrollLeft)})},onKeyDown:w,onBlur:s?void 0:r,readOnly:s,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off"})]})}function KP({onClose:e,onSaved:n}){const t=Rft(),r=ot(t),[s,i]=R.useState(()=>r.data??null),[a,o]=R.useState(()=>{var y;return((y=r.data)==null?void 0:y.content)??""}),l=!s&&r.error?r.error.message:null,u=mn({mutationFn:({content:y,previous:C})=>pdt(y,C)}),[_,d]=R.useState(!1),p=R.useRef(null),m=R.useRef(e),x=s!==null&&a!==s.content,S=R.useRef(x),v=R.useRef(_);S.current=x,v.current=_,m.current=e,R.useEffect(()=>{!r.data||S.current||v.current||(i(r.data),o(r.data.content))},[r.data]);const b=()=>{v.current||S.current&&!window.confirm(Zrt())||m.current()};sb(p,b,"textarea");async function w(){if(!(!s||!x||_)){d(!0);try{if(await u.mutateAsync({content:a,previous:s.content}),!Dn(t.queryKey))return;Gr(t.queryKey,{...s,content:a}),i({...s,content:a}),n==null||n(),Vn(ast(),"success")}catch(y){Vn(y instanceof Error?y.message:String(y),"error")}finally{d(!1)}}}return eo.createPortal(f.jsx("div",{className:"fixed inset-0 z-200 flex items-center justify-center bg-modal-backdrop p-5",onClick:y=>{y.target===y.currentTarget&&b()},children:f.jsxs("div",{ref:p,className:"relative flex h-[min(48rem,calc(100vh-2.5rem))] w-200 max-w-full flex-col overflow-hidden rounded-xl border border-border bg-background shadow-modal",role:"dialog","aria-modal":"true","aria-labelledby":"ssh-config-dialog-title",tabIndex:-1,children:[f.jsxs("div",{className:"shrink-0 px-6 pt-5 pb-4 pe-14",children:[f.jsx("h2",{id:"ssh-config-dialog-title",className:"m-0 text-xl font-medium",children:ust()}),f.jsx("code",{className:"mt-1 block font-mono text-sm text-subtext",children:"~/.ssh/config"})]}),f.jsx(Yt,{className:"absolute end-3.5 top-3.5","aria-label":Krt(),onClick:b,disabled:_,children:f.jsx(qr,{size:16})}),f.jsx("div",{className:"file-view min-h-0 flex-1 border-y border-border-variant bg-background",children:l?f.jsx("p",{className:"m-5 text-sm text-accent-red",children:l}):s===null?f.jsxs("div",{className:"flex items-center gap-2 p-5 text-sm text-subtext",children:[f.jsx(Lt,{})," ",nst()]}):f.jsx(VP,{value:a,onChange:o,onSave:()=>void w(),path:s.path})}),f.jsxs("div",{className:"flex shrink-0 justify-end gap-2.5 p-4",children:[f.jsx(Le,{onClick:b,disabled:_,children:Nd()}),f.jsx(Le,{variant:"primary",onClick:()=>void w(),disabled:!x||_,children:_?Xi():Ho()})]})]})}),document.body)}const Po=["settings-card [&_>_.error]:text-accent-red [&_>_.error]:text-base","[&_>_.error]:whitespace-pre-wrap bg-background border border-border","rounded-lg py-4 px-4.5 mb-4 [&_h3]:mt-0 [&_h3]:mx-0 [&_h3]:mb-2.5","[&_h3]:text-base [&_h3]:font-semibold [&_h3]:text-text","[&_.settings-sub]:mb-3 [&_.kv]:gap-y-1.5 [&_.kv]:gap-x-4.5","[&_>_.project-default-row:first-child]:pt-0 [&_>_.project-default-row:first-child]:border-t-0"].join(" "),Dd=["kv grid grid-cols-[auto_1fr] items-baseline gap-y-[3px] gap-x-3.5 text-base","[&_.k]:text-sm [&_.k]:text-subtext [&_.v]:text-base [&_.v]:text-text","[&_.v]:break-all"].join(" "),Q7t=["grid grid-cols-[9rem_minmax(0,1fr)] items-center gap-x-5 gap-y-2.5 font-sans text-base text-text","[&_.k]:font-medium [&_.k]:text-sm [&_.k]:text-text","[&_.v]:min-w-0 [&_.v]:flex [&_.v]:items-center [&_.v]:flex-wrap [&_.v]:gap-2","[&_.v]:font-sans [&_.v]:text-base [&_.v]:text-text [&_.v]:break-words"].join(" "),Yb="mt-3 mx-0 mb-0 ps-3 border-s-2 border-s-accent-red font-sans text-base leading-relaxed text-text whitespace-pre-wrap",ya=["settings-note mt-2.5 mx-0 mb-0 text-base py-2 px-2.5","border border-accent-amber rounded-md bg-accent-amber-subtle","text-accent-amber font-medium"].join(" "),pk=["form font-sans text-sm text-text [&_.form-seg]:self-start [&_.form-seg]:mb-0.5","[&_.form-seg_button]:py-[5px] [&_.form-seg_button]:px-3","[&_.repo-hint]:font-normal [&_.repo-hint]:text-sm","[&_.repo-hint]:text-muted [&_.repo-hint.ok]:text-accent-teal","[&_.folder-picker-control]:flex [&_.folder-picker-control]:items-center","[&_.folder-picker-control]:gap-[9px] [&_.folder-picker-control]:w-full","[&_.folder-picker-control]:min-w-0 [&_.folder-picker-control]:py-2 [&_.folder-picker-control]:px-2.5","[&_.folder-picker-control]:overflow-hidden [&_.folder-picker-control]:bg-background","[&_.folder-picker-control]:border [&_.folder-picker-control]:border-border","[&_.folder-picker-control]:rounded-md [&_.folder-picker-control]:cursor-pointer","[&_.folder-picker-control]:text-start","[&_.folder-picker-control]:transition-[border-color,box-shadow] [&_.folder-picker-control]:duration-120 [&_.folder-picker-control]:ease-standard","[&_.folder-picker-control:hover:not(:disabled)]:border-muted","[&_.folder-picker-control:hover:not(:disabled)]:shadow-control-subtle","[&_.folder-picker-control:focus-visible]:outline-2 [&_.folder-picker-control:focus-visible]:outline-solid [&_.folder-picker-control:focus-visible]:outline-text","[&_.folder-picker-control:focus-visible]:outline-offset-2 [&_.folder-picker-control_span]:flex-1","[&_.folder-picker-control_span]:min-w-0 [&_.folder-picker-control_span]:overflow-hidden","[&_.folder-picker-control_span]:text-ellipsis [&_.folder-picker-control_span]:whitespace-nowrap","[&_.folder-picker-control_.placeholder]:text-muted [&_.folder-picker-icon]:flex-none","[&_.folder-picker-icon]:text-current [&_.folder-picker-chevron]:flex-none","[&_.folder-picker-chevron]:text-muted","[&_.folder-picker-control:hover:not(:disabled)_.folder-picker-chevron]:text-subtext","[&_.folder-picker-hint]:text-subtext [&_.folder-picker-hint]:text-sm","[&_.folder-picker-hint]:font-normal [&_.folder-picker-hint]:leading-[1.4]","[&_.project-location-field]:flex [&_.project-location-field]:flex-col","[&_.project-location-field]:gap-2 [&_.project-location-label]:text-text","[&_.project-location-label]:text-base","[&_.project-location-label]:font-medium [&_.project-field-label]:text-text","[&_.project-field-label]:text-base [&_.project-field-label]:font-medium","[&_.folder-picker-control:disabled]:cursor-default [&_.folder-picker-control:disabled]:opacity-65","[&_.paper-destination]:flex [&_.paper-destination]:items-center","[&_.paper-destination]:gap-2.5 [&_.paper-destination]:pt-2 [&_.paper-destination]:pe-2 [&_.paper-destination]:pb-2 [&_.paper-destination]:ps-3","[&_.paper-destination]:border [&_.paper-destination]:border-border [&_.paper-destination]:rounded-md","[&_.paper-destination]:bg-background [&_.paper-destination_code]:flex-1","[&_.paper-destination_code]:min-w-0 [&_.paper-destination_code]:overflow-hidden","[&_.paper-destination_code]:text-text [&_.paper-destination_code]:text-sm","[&_.paper-destination_code]:font-normal","[&_.paper-destination_code]:text-ellipsis [&_.paper-destination_code]:whitespace-nowrap","[&_.paper-destination_.btn]:flex-none [&_.project-path-notice]:py-[9px] [&_.project-path-notice]:px-[11px]","[&_.project-path-notice]:border [&_.project-path-notice]:border-border-variant","[&_.project-path-notice]:rounded-sm [&_.project-path-notice]:bg-surface","[&_.project-path-notice]:text-base [&_.project-path-notice]:leading-relaxed [&_.project-path-notice]:text-text","[&_.project-path-notice]:leading-[1.4]","[&_.project-path-notice.error]:border-danger-notice-border","[&_.paper-results]:flex [&_.paper-results]:flex-col","[&_.paper-results]:border [&_.paper-results]:border-border [&_.paper-results]:rounded-md","[&_.paper-results]:max-h-60 [&_.paper-results]:overflow-y-auto","[&_.paper-results_button]:flex [&_.paper-results_button]:flex-col","[&_.paper-results_button]:items-start [&_.paper-results_button]:gap-0.5","[&_.paper-results_button]:py-2 [&_.paper-results_button]:px-2.5 [&_.paper-results_button]:bg-none [&_.paper-results_button]:bg-transparent","[&_.paper-results_button]:border-0","[&_.paper-results_button]:border-b [&_.paper-results_button]:border-b-border-variant","[&_.paper-results_button]:text-start [&_.paper-results_button]:[font:inherit]","[&_.paper-results_button]:text-text [&_.paper-results_button]:cursor-pointer","[&_.paper-results_button:last-child]:border-b-0","[&_.paper-results_button:hover]:bg-surface [&_.paper-results_.title]:text-sm","[&_.paper-results_.title]:font-medium","[&_.paper-results_.id]:text-xs [&_.paper-results_.id]:text-muted","[&_.paper-pick_.id]:text-xs","[&_.paper-pick_.id]:text-muted [&_.paper-pick]:flex [&_.paper-pick]:items-center","[&_.paper-pick]:justify-between [&_.paper-pick]:gap-2.5 [&_.paper-pick]:py-2.5 [&_.paper-pick]:px-3","[&_.paper-pick]:border [&_.paper-pick]:border-border [&_.paper-pick]:rounded-md","[&_.paper-pick]:bg-surface [&_.paper-pick_.meta]:min-w-0","[&_.paper-pick_.title]:text-sm [&_.paper-pick_.title]:font-medium","flex flex-col gap-2.5 [&_label]:flex [&_label]:flex-col","[&_label]:gap-1 [&_label]:text-sm [&_label]:text-text","[&_label]:font-medium [&_.row2]:grid [&_.row2]:grid-cols-2","[&_input]:font-sans [&_input]:text-sm [&_input]:font-normal [&_input]:text-text [&_input::placeholder]:text-subtext","[&_select]:font-sans [&_select]:text-sm [&_select]:font-normal [&_select]:text-text","[&_.row2]:gap-2.5 [&_.actions]:flex [&_.actions]:justify-end","[&_.actions]:gap-2.5 [&_.actions]:mt-1.5 [&_.new-project-actions]:justify-start","[&_.new-project-actions]:mt-2.5","[&_.error]:text-accent-red [&_.error]:text-base [&_.error]:whitespace-pre-wrap","settings-form mt-3.5 pt-3.5 border-t border-t-border"].join(" "),Ml=["project-default-row flex items-center justify-between gap-6","pt-3.5 border-t border-t-border-variant [&_p]:mt-[3px] [&_p]:mx-0 [&_p]:mb-0","[&_.project-default-title]:text-base [&_p]:text-sm [&_p]:leading-relaxed [&_p]:text-text"].join(" "),Y3=["settings-card [&_>_.error]:text-accent-red [&_>_.error]:text-base","[&_>_.error]:whitespace-pre-wrap bg-background border border-border","rounded-lg mb-4 [&_h3]:mt-0 [&_h3]:mx-0 [&_h3]:mb-2.5 [&_h3]:text-base","[&_h3]:font-semibold [&_h3]:text-text [&_.settings-sub]:mb-3","[&_>_.project-default-row:first-child]:pt-0 [&_>_.project-default-row:first-child]:border-t-0","git-settings-card py-3.5 px-4 [&_h3]:mb-3","[&_.kv]:grid-cols-[132px_minmax(0,_1fr)] [&_.kv]:items-center [&_.kv]:gap-y-[9px] [&_.kv]:gap-x-4.5","[&_.kv_.k]:text-sm [&_.kv_.v]:flex [&_.kv_.v]:items-center","[&_.kv_.v]:flex-wrap [&_.kv_.v]:gap-[7px] [&_.kv_.v]:min-w-0 [&_.kv_.v]:font-sans","[&_.kv_.v]:text-base [&_.kv_.v]:break-normal","[@media((max-width:_640px))]:[&_.kv]:grid-cols-1","[@media((max-width:_640px))]:[&_.kv]:gap-[3px] [@media((max-width:_640px))]:[&_.kv_.v_+_.k]:mt-[7px]"].join(" "),U0=["git-card-actions flex flex-wrap gap-2 mt-3.5 pt-3.5","border-t border-t-border-variant"].join(" "),Hf=["settings-stack-section [&_+_.settings-stack-section]:mt-6 [&_>_:last-child]:mb-0","[&_>_h2]:mt-0 [&_>_h2]:mx-0 [&_>_h2]:mb-1.5 [&_>_h2]:text-xl"].join(" ");function Cw(e){return e.agentReady?{cls:"ok",variant:"success",label:e.authMethod==="local"?s6():ZYe()}:e.installed?e.installBroken?{cls:"warn",variant:"warning",label:XGe()}:e.authMethod==="local"?{cls:"warn",variant:"warning",label:GD()}:e.authState==="unknown"?{cls:"warn",variant:"warning",label:A4()}:e.authState==="unsupported"?{cls:"warn",variant:"warning",label:fZe()}:{cls:"warn",variant:"warning",label:_L()}:{cls:"warn",variant:"warning",label:CKe()}}function Y7t({h:e}){return e.authMethod?e.authMethod==="local"?f.jsx(f.Fragment,{children:i6()}):f.jsx(f.Fragment,{children:e.authMethod==="oauth"?EHe():r6()}):f.jsx(f.Fragment,{children:"—"})}function X7t(){const e=ru(),{data:n=null}=ot(e),[t,r]=R.useState("claude-code"),[s,i]=R.useState(!1),a=(l,u=!1)=>{i(!0),tb(l,u).catch(()=>{}).finally(()=>i(!1))},o=n==null?void 0:n.find(l=>l.id===t);return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:RGe()}),f.jsx("div",{className:"harness-tabs mt-3 flex gap-1 mb-3.5 border-b border-b-border-variant [&_button]:inline-flex [&_button]:items-center [&_button]:gap-[7px] [&_button]:py-[7px] [&_button]:px-3 [&_button]:text-sm [&_button]:font-medium [&_button]:text-text [&_button]:border-b-2 [&_button]:border-b-transparent [&_button]:-mb-px [&_button:hover]:text-text [&_button.active]:border-b-primary",children:(n??[]).map(l=>f.jsxs("button",{className:l.id===t?"active":"",onClick:()=>r(l.id),children:[l.name,f.jsx("span",{className:`w-[7px] h-[7px] rounded-full bg-muted [&.ok]:bg-accent-green [&.err]:bg-accent-red [&.warn]:bg-accent-amber ${Cw(l).cls}`})]},l.id))}),n?o?f.jsxs("div",{className:Po,children:[f.jsxs("div",{className:"settings-card-head flex items-center gap-2.5 mb-3",children:[f.jsx(Ft,{variant:Cw(o).variant,children:Cw(o).label}),f.jsx("div",{className:"spacer flex-1"}),f.jsxs(Le,{size:"small",onClick:()=>a(!0,!0),disabled:s,children:[f.jsx(Ea,{size:12,className:s?"animate-[spin_0.9s_linear_infinite]":""})," ",Yp()]})]}),f.jsxs("div",{className:Dd,children:[f.jsx("span",{className:"k",children:yqe()}),f.jsx("span",{className:"v",children:o.binPath??dHe()}),f.jsx("span",{className:"k",children:yL()}),f.jsx("span",{className:"v",children:o.version??"—"}),f.jsx("span",{className:"k",children:nqe()}),f.jsx("span",{className:"v",children:f.jsx(Y7t,{h:o})}),o.account&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"k",children:o.id==="opencode"?GZe():c6()}),f.jsx("span",{className:"v",children:o.account})]}),o.org&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"k",children:lQe()}),f.jsx("span",{className:"v",children:o.org})]}),o.plan&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"k",children:$Qe()}),f.jsx("span",{className:"v",children:o.plan})]}),f.jsx("span",{className:"k",children:QHe()}),f.jsx("span",{className:"v",children:o.models.length>0?iL({count:Wt(o.models.length),models:new Intl.ListFormat(j()).format(o.models.slice(0,4).map(l=>Ne(O0(l))))}):l6()})]}),o.agentNote&&f.jsx("p",{className:ya,children:tm(o.agentNote)}),o.id==="opencode"&&f.jsx(oI,{installed:o.installed})]}):null:f.jsxs(rs,{children:[f.jsx(Lt,{})," ",JUe()]})]})}function Z7t({s:e}){const n=e.preflight;return n.kubectlFound?n.reachable?n.canCreateJobs?f.jsx(Ft,{variant:"success",children:uUe()}):f.jsx(Ft,{variant:"error",children:QVe()}):f.jsx(Ft,{variant:"error",children:Jqe()}):f.jsx(Ft,{variant:"error",children:yWe()})}function J7t({onEditState:e}){var T;const n=mn({mutationFn:idt}),t=PN(),r=ot(t),s=r.data??null,i=z=>{Gr(t.queryKey,M=>(typeof z=="function"?z(M??null):z)??void 0)},a=s?null:((T=r.error)==null?void 0:T.message)??null,[o,l]=R.useState(""),[u,_]=R.useState(""),[d,p]=R.useState(!1),[m,x]=R.useState(!1),[S,v]=R.useState(null),b=z=>{i(z),l(z.context??""),_(z.namespace)},w=R.useRef(null);R.useEffect(()=>{const z=w.current;w.current=s,s&&(!z||o===(z.context??"")&&u.trim()===z.namespace)&&(l(s.context??""),_(s.namespace??""))},[s,o,u]);const y=s!==null&&o===(s.context??"")&&u.trim()===s.namespace,C=s!==null&&!y;R.useEffect(()=>{e==null||e({dirty:C,saving:d})},[C,d,e]);async function E(){if(!(m||d||!y)){x(!0);try{await tt.fetchQuery({...PN(),staleTime:0})}catch(z){Vn(z instanceof Error?z.message:String(z),"error")}finally{x(!1)}}}async function N(z){if(z.preventDefault(),!(d||m)){p(!0),v(null);try{b(await n.mutateAsync({context:o,namespace:u.trim()}))}catch(M){v(M instanceof Error?M.message:String(M))}finally{p(!1)}}}return f.jsx(f.Fragment,{children:a?f.jsx("p",{className:"m-0 text-sm text-accent-red whitespace-pre-wrap break-words",children:a}):s?f.jsxs(f.Fragment,{children:[f.jsxs("dl",{className:"m-0 flex items-center justify-between gap-4 text-sm",children:[f.jsx("dt",{className:"text-subtext",children:r_()}),f.jsx("dd",{className:"m-0",children:m||d?f.jsx(Ft,{children:Vi()}):C?f.jsx(Ft,{children:DD()}):f.jsx(Z7t,{s})})]}),y&&!m&&!d&&s.preflight.error&&f.jsx("p",{className:`${Yb} break-words`,children:s.preflight.error}),f.jsxs("form",{className:"mt-5 flex flex-col gap-4",onSubmit:N,children:[f.jsxs("label",{className:"flex flex-col gap-2 text-sm font-medium text-subtext",children:[_Ue(),f.jsx(Ad,{choices:[{id:"",label:s.currentContext?WPe({context:Ne(s.currentContext)}):HPe()},...o&&!s.contexts.includes(o)?[{id:o,label:pHe({context:Ne(o)})}]:[],...s.contexts.map(z=>({id:z,label:z}))],value:o,variant:"field",dropDown:!0,disabled:d||m,onSelect:l})]}),f.jsxs("label",{className:"flex flex-col gap-2 text-sm font-medium text-subtext",children:[xVe(),f.jsx(ns,{type:"text",value:u,disabled:d||m,onChange:z=>_(z.target.value),placeholder:BUe(),autoComplete:"off",spellCheck:!1})]}),S&&f.jsx("p",{className:"m-0 text-sm text-accent-red whitespace-pre-wrap break-words",children:S}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsxs(Le,{type:"button",onClick:()=>void E(),disabled:d||m||!y,children:[f.jsx(Ea,{size:13})," ",m?Vi():Kp()]}),f.jsx(Le,{variant:"primary",type:"submit",disabled:d||m||y,children:d?Xi():Ho()})]})]})]}):f.jsxs(rs,{children:[f.jsx(Lt,{})," ",Lqe()]})})}function e8t(){var y;const e=mn({mutationFn:C=>odt(...C)}),n=FN(),t=ot(n),r=t.data??null,s=C=>{Gr(n.queryKey,E=>(typeof C=="function"?C(E??null):C)??void 0)},[i,a]=R.useState(null),o=i??((y=t.error)==null?void 0:y.message)??null,[l,u]=R.useState(""),[_,d]=R.useState(""),[p,m]=R.useState(!1),x=t.isPending||p,[S,v]=R.useState(!1);async function b(){if(!(x||S)){m(!0),a(null);try{await tt.fetchQuery({...FN(),staleTime:0})}catch(C){a(C instanceof Error?C.message:String(C))}finally{m(!1)}}}async function w(C){if(C.preventDefault(),!(!l.trim()||!_.trim()||x||S||r!=null&&r.processEnv)){v(!0),a(null);try{s(await e.mutateAsync([l.trim(),_.trim()])),u(""),d("")}catch(E){a(E instanceof Error?E.message:String(E))}finally{v(!1)}}}return f.jsxs(f.Fragment,{children:[!r&&x?f.jsxs(rs,{children:[f.jsx(Lt,{})," ",$qe()]}):r&&f.jsxs("dl",{className:"m-0 flex items-center justify-between gap-4 text-sm",children:[f.jsx("dt",{className:"font-medium text-subtext",children:r_()}),f.jsx("dd",{className:"m-0",children:f.jsx(Ft,{variant:r.tokenConfigured?"success":"warning",children:r.tokenConfigured?d6():Zv()})})]}),(r==null?void 0:r.processEnv)&&f.jsx("p",{className:"mt-2 mb-0 text-sm text-subtext",children:lFe()}),f.jsxs("form",{className:"mt-5 flex flex-col gap-4",onSubmit:w,children:[f.jsxs("label",{className:"flex flex-col gap-2 text-sm font-medium text-subtext",children:[r!=null&&r.tokenConfigured?fFe():kFe(),f.jsx(ns,{type:"password",value:l,onChange:C=>u(C.target.value),placeholder:(r==null?void 0:r.maskedTokenId)??"ak-…",autoComplete:"new-password",disabled:r==null?void 0:r.processEnv})]}),f.jsxs("label",{className:"flex flex-col gap-2 text-sm font-medium text-subtext",children:[r!=null&&r.tokenConfigured?mFe():zFe(),f.jsx(ns,{type:"password",value:_,onChange:C=>d(C.target.value),placeholder:(r==null?void 0:r.maskedTokenSecret)??"as-…",autoComplete:"new-password",disabled:r==null?void 0:r.processEnv})]}),f.jsx("a",{className:"self-start text-sm text-subtext underline",href:"https://modal.com/docs/sdk/py/latest/config",target:"_blank",rel:"noreferrer",children:yFe()}),o&&f.jsx("p",{className:"m-0 text-sm text-accent-red",children:o}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsxs(Le,{type:"button",disabled:x||S,onClick:()=>void b(),children:[f.jsx(Ea,{size:13})," ",Yp()]}),f.jsx(Le,{variant:"primary",type:"submit",disabled:!l.trim()||!_.trim()||x||S||(r==null?void 0:r.processEnv),children:S?Xi():Ho()})]})]})]})}const QP="rounded-sm border-border-strong bg-surface text-subtext",YP="rounded-sm border-accent-blue bg-accent-blue-subtle text-accent-blue",t8t=5e3;function XP(e){const n=Sa(),t=e.map(a=>HN(a)),r=LG({queries:t.map(a=>({...a,refetchInterval:t8t}))});return[Object.fromEntries(e.flatMap((a,o)=>r[o].data?[[a,r[o].data.running]]:[])),a=>{Dn(n)&&Gr(HN(a).queryKey,{running:!0})}]}function n8t({test:e,connecting:n,masterRunning:t}){if(n)return f.jsx("span",{role:"status",children:f.jsx(Ft,{className:YP,children:rL()})});if(e===void 0)return f.jsx(Ft,{className:QP,children:hL()});const r=e.missingTools??[],s=e.reachable&&e.toolsFound&&t===!1,i=e.reachable?e.toolsFound?s?f.jsx(Ft,{className:"rounded-sm",variant:"warning",children:sL()}):f.jsx(Ft,{className:"rounded-sm",variant:"success",children:Qp()}):f.jsx(Ft,{className:"rounded-sm",variant:"error",children:r.length===1?LFe({tool:Ne(r[0])}):$Fe()}):f.jsx(Ft,{className:"rounded-sm",variant:"error",children:u6()});return f.jsxs("div",{className:"flex items-center gap-4",role:"status",children:[i,!s&&f.jsx("span",{className:"ssh-tested-at whitespace-nowrap text-xs text-subtext",children:Io(e.testedAt)})]})}function r8t({remote:e=!1}){const n=WL(),t=ot(n),r=t.data??(t.isError?[]:null),[s,i]=R.useState(!1),[a,o]=R.useState({}),[l,u]=R.useState({}),[_,d]=R.useState(null),[p,m]=R.useState(!1),[x,S]=R.useState(0),v=e?[]:(r==null?void 0:r.filter(N=>{const T=a[N.host]??N.lastTest;return(T==null?void 0:T.reachable)&&T.toolsFound}).map(N=>N.host))??[],[b,w]=XP(v);function y(N){m(!1),S(T=>T+1),d(N),u(T=>({...T,[N]:!0}))}function C(){m(!1),d(null)}function E(N,T){u(z=>({...z,[N]:!T}))}return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mb-3 flex justify-end",children:f.jsxs(Le,{variant:"ghost",onClick:()=>i(!0),children:[f.jsx(XO,{size:14})," ",EL()]})}),r===null?f.jsxs(rs,{children:[f.jsx(Lt,{})," ",mL()]}):r.length===0?f.jsx("p",{className:"settings-empty mt-1 mx-0 mb-0 text-base text-subtext",children:GVe()}):f.jsx("div",{className:"border-y border-border-variant divide-y divide-border-variant",children:r.map(N=>{const T=a[N.host]??N.lastTest,z=_===N.host,M=l[N.host]??!1,I=!e&&(z||(T==null?void 0:T.reachable)===!1),B=`${N.user?`${N.user}@`:""}${N.hostname??N.host}${N.port?`:${N.port}`:""}`;return f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center gap-3 py-3 px-2",children:[f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5",children:[I?f.jsx("button",{type:"button",className:"flex-none inline-flex items-center p-0.5 rounded-sm [&:hover]:bg-panel","aria-expanded":M,"aria-label":M?zK({name:Ne(N.host)}):YK({name:Ne(N.host)}),onClick:$=>{$.stopPropagation(),E(N.host,M)},children:f.jsx(qo,{size:15,className:`text-muted transition-transform duration-120 ease-standard${M?" rotate-180":""}`})}):f.jsx("span",{className:"w-5 flex-none","aria-hidden":"true"}),f.jsxs("div",{className:"min-w-0",children:[f.jsx("div",{className:"truncate text-base font-medium text-text",title:N.host,children:N.host}),f.jsx("div",{className:"mt-1 truncate text-sm text-subtext",title:B,children:B})]})]}),!e&&f.jsxs("div",{className:"grid flex-none grid-cols-[8.5rem_5rem] items-center gap-x-12",children:[f.jsx("div",{className:"text-start",children:f.jsx(n8t,{test:T,connecting:z&&!p,masterRunning:b[N.host]})}),f.jsx(Le,{size:"small",type:"button",className:"justify-self-end",onClick:$=>{$.stopPropagation(),z&&!p?C():y(N.host)},disabled:!z&&_!==null&&!p,children:z?p?Fi():Nd():(T==null?void 0:T.reachable)===!1?Fi():T?xL():a6()})]})]}),I&&(M||z)&&f.jsxs("div",{className:`border-t border-t-border-variant py-3 pe-2 ps-10${M?"":" hidden"}`,children:[!z&&(T==null?void 0:T.error)&&f.jsx(l0t,{host:N.host,transcript:T.error}),z&&f.jsx(k6,{host:N.host,backend:"ssh",active:M,onComplete:$=>{$.backend==="ssh"&&(o(U=>({...U,[N.host]:$.result})),w(N.host),m(!1),d(null))},onError:$=>{m(!0),o(U=>({...U,[N.host]:{reachable:!1,toolsFound:!1,missingTools:[],error:$,testedAt:Date.now()}}))}},x)]})]},N.host)})}),s&&f.jsx(KP,{onClose:()=>i(!1)})]})}function s8t({test:e,connecting:n,masterRunning:t}){return n?f.jsx(Ft,{className:YP,children:rL()}):e===null?f.jsx(Ft,{className:QP,children:hL()}):e.reachable?e.slurmFound?e.toolsFound?t===!1?f.jsx(Ft,{className:"rounded-sm",variant:"warning",children:sL()}):f.jsx(Ft,{className:"rounded-sm",variant:"success",children:Qp()}):f.jsx(Ft,{className:"rounded-sm",variant:"error",children:iVe()}):f.jsx(Ft,{className:"rounded-sm",variant:"error",children:dKe()}):f.jsx(Ft,{className:"rounded-sm",variant:"error",children:u6()})}function i8t({remote:e=!1}){var O;const n=mn({mutationFn:kdt}),t=Eft(),r=ot(t),s=r.data??null,i=L=>{Gr(t.queryKey,F=>(typeof L=="function"?L(F??null):L)??void 0)},a=s?null:((O=r.error)==null?void 0:O.message)??null,[o,l]=R.useState(""),[u,_]=R.useState(""),[d,p]=R.useState(""),[m,x]=R.useState(""),[S,v]=R.useState(!1),[b,w]=R.useState(null),[y,C]=R.useState(null),[E,N]=R.useState(!1),[T,z]=R.useState(!1),[M,I]=R.useState(0),B=!e&&o&&(y!=null&&y.reachable)&&y.slurmFound&&y.toolsFound?[o]:[],[$,U]=XP(B);function H(){z(!1),I(L=>L+1),N(!0)}const Y=L=>{i(L),l(L.host??""),_(L.partition??""),p(L.account??""),x(L.timeLimit??"")},V=R.useRef(null);R.useEffect(()=>{const L=V.current;V.current=s,s&&(!L||o===(L.host??"")&&u.trim()===(L.partition??"")&&d.trim()===(L.account??"")&&m.trim()===(L.timeLimit??""))&&(l(s.host??""),_(s.partition??""),p(s.account??""),x(s.timeLimit??""))},[s,o,u,d,m]);const X=s!==null&&o===(s.host??"")&&u.trim()===(s.partition??"")&&d.trim()===(s.account??"")&&m.trim()===(s.timeLimit??"");async function ee(L){if(L.preventDefault(),!S){v(!0),w(null);try{Y(await n.mutateAsync({host:o,partition:u.trim(),account:d.trim(),timeLimit:m.trim()}))}catch(F){w(F instanceof Error?F.message:String(F))}finally{v(!1)}}}return f.jsx(f.Fragment,{children:a?f.jsx("div",{className:"error",children:a}):s?f.jsxs(f.Fragment,{children:[!E&&(y==null?void 0:y.error)&&f.jsx("p",{className:Yb,children:y.error}),f.jsxs("form",{className:pk,onSubmit:ee,children:[f.jsx("div",{className:"max-w-xl",children:f.jsxs("label",{children:[XWe(),f.jsx(Ad,{choices:[{id:"",label:IKe()},...o&&!s.hosts.some(L=>L.host===o)?[{id:o,label:`${o} (not in ~/.ssh/config)`}]:[],...s.hosts.map(L=>({id:L.host,label:L.host}))],value:o,variant:"field",dropDown:!0,disabled:S||E,onSelect:L=>{l(L),C(null),N(!1),z(!1)}})]})}),f.jsxs("div",{className:"actions",children:[!e&&f.jsx(Le,{type:"button",onClick:()=>{E&&!T?(z(!1),N(!1)):H()},disabled:!o,title:o?void 0:FZe(),children:E?T?Fi():Nd():y?xL():a6()}),f.jsx("span",{role:"status",children:f.jsx(s8t,{test:y,connecting:E&&!T,masterRunning:$[o]})})]}),f.jsxs("div",{className:"mt-5 border-t border-border pt-5",children:[f.jsxs("div",{className:"row2",children:[f.jsxs("label",{children:[AQe(),f.jsx(ns,{type:"text",list:"slurm-partitions",value:u,onChange:L=>_(L.target.value),placeholder:EN(),autoComplete:"off",spellCheck:!1}),f.jsx("datalist",{id:"slurm-partitions",children:y==null?void 0:y.partitions.map(L=>f.jsx("option",{value:L},L))})]}),f.jsxs("label",{children:[c6(),f.jsx(ns,{type:"text",value:d,onChange:L=>p(L.target.value),placeholder:EN(),autoComplete:"off",spellCheck:!1})]})]}),f.jsxs("label",{className:"mt-3 block max-w-xl",children:[nZe(),f.jsx(ns,{type:"text",value:m,onChange:L=>x(L.target.value),placeholder:Qqe(),autoComplete:"off",spellCheck:!1})]})]}),b&&f.jsx("div",{className:"error",children:b}),f.jsx("div",{className:"actions",children:f.jsx(Le,{variant:"primary",type:"submit",disabled:S||X||E,children:S?Xi():Ho()})})]}),!e&&E&&f.jsx(k6,{host:o,backend:"slurm",onComplete:L=>{L.backend==="slurm"&&(C(L.result),U(o),z(!1),N(!1))},onError:L=>{z(!0),C({reachable:!1,slurmFound:!1,toolsFound:!1,partitions:[],error:L})}},M)]}):f.jsxs(rs,{children:[f.jsx(Lt,{})," ",LWe()]})})}function a8t(){var C;const e=mn({mutationFn:Edt}),n=Nft(),t=ot(n),r=t.data??null,s=E=>{Gr(n.queryKey,N=>(typeof E=="function"?E(N??null):E)??void 0)},i=r?null:((C=t.error)==null?void 0:C.message)??null,[a,o]=R.useState(""),[l,u]=R.useState(!1),[_,d]=R.useState(null),[p,m]=R.useState(null),x=p!==null&&p!=="testing"?p:null,S=E=>{s(E),o(E.address??"")},v=R.useRef(null);R.useEffect(()=>{const E=v.current;v.current=r,r&&(!E||a===(E.address??""))&&o(r.address??"")},[r,a]);const b=r!==null&&a===(r.address??"");async function w(E){if(E.preventDefault(),!l){u(!0),d(null);try{S(await e.mutateAsync({address:a}))}catch(N){d(N instanceof Error?N.message:String(N))}finally{u(!1)}}}async function y(){m("testing");try{m(await Ndt(a.trim()||void 0))}catch(E){m({reachable:!1,address:a.trim()||"(unknown)",rayVersion:null,error:E instanceof Error?E.message:String(E)})}}return f.jsx(f.Fragment,{children:i?f.jsx("div",{className:"error",children:i}):r?f.jsxs(f.Fragment,{children:[(x==null?void 0:x.error)&&f.jsx("p",{className:Yb,children:x.error}),f.jsxs("form",{className:pk,onSubmit:w,children:[f.jsxs("label",{children:[mWe(),f.jsx(ns,{type:"text",value:a,onChange:E=>{o(E.target.value),m(null)},placeholder:"http://127.0.0.1:8265",autoComplete:"off",spellCheck:!1})]}),f.jsxs("p",{className:"m-0 text-sm text-subtext",children:[oGe(),": ",Ne(r.resolvedAddress)," · ",gL(),": ",r.source]}),_&&f.jsx("div",{className:"error",children:_}),f.jsxs("div",{className:"actions",children:[f.jsx(Le,{variant:"primary",type:"submit",disabled:l||b,children:l?Xi():Ho()}),f.jsx(Le,{type:"button",onClick:()=>void y(),disabled:p==="testing",children:RXe()}),f.jsx(o8t,{test:p})]}),(x==null?void 0:x.reachable)&&x.rayVersion&&f.jsxs("p",{className:"m-0 text-sm text-subtext",children:[VQe(),": ",x.rayVersion]})]})]}):f.jsxs(rs,{children:[f.jsx(Lt,{})," ",AWe()]})})}function o8t({test:e}){return e===null?null:e==="testing"?f.jsx(Ft,{children:OXe()}):e.reachable?f.jsx(Ft,{variant:"success",children:XQe()}):f.jsx(Ft,{variant:"error",children:u6()})}function l8t(e){const n=e.chip??`${e.os}/${e.arch}`,t=e.memBytes===null?null:Al(e.memBytes),r=e.gpus.length===0?null:Z$e({count:e.gpus.length});return[n,e.cpuCount>0?u$e({count:e.cpuCount}):null,t,r].filter(Boolean).join(" · ")}function c8t({remote:e}){var p;const n=ot(jft()),t=n.data,r=(p=n.error)==null?void 0:p.message,s=n.isFetching,[i,a]=R.useState(0),[o,l]=R.useState(!0),[u,_]=R.useState(!1),d=()=>n.refetch();return f.jsxs(f.Fragment,{children:[r&&!t?f.jsx("div",{className:"error",children:r}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:Q7t,children:[f.jsx("span",{className:"k",children:r_()}),f.jsx("span",{className:"v",children:!t&&s||u?f.jsxs(Ft,{className:"gap-1.5",role:"status",children:[f.jsx(Lt,{}),u?DHe():Vi()]}):r?f.jsx(Ft,{variant:"warning",children:A4()}):t?t.loggedIn?t.sshKeyStatus==="matched"?f.jsx(Ft,{variant:"success",children:Qp()}):t.sshKeyStatus==="unknown"?f.jsx(Ft,{variant:"warning",children:A4()}):f.jsx(Ft,{variant:"warning",children:Zv()}):f.jsx(Ft,{variant:"warning",children:_L()}):null}),f.jsx("span",{className:"k",children:fQe()}),f.jsx("span",{className:"v",children:t!=null&&t.loggedIn&&t.orgs.length>0?t.orgs.join(", "):"—"}),f.jsx("span",{className:"k",children:iXe()}),f.jsx("span",{className:"v",children:t!=null&&t.loggedIn?t.sshKeyStatus==="matched"?f.jsx(Ft,{variant:"success",children:UKe()}):t.sshKeyStatus==="no_local_match"?f.jsx(Ft,{variant:"warning",children:MKe()}):t.sshKeyStatus==="none_registered"?f.jsx(Ft,{variant:"error",children:pKe()}):f.jsx(Ft,{children:vL()}):"—"})]}),e&&t&&!t.loggedIn&&f.jsx("p",{className:"mt-4 mb-0 text-sm text-subtext",children:eFe({command:Ne("orx login")})}),!e&&i>0&&f.jsx(o0t,{login:o,onComplete:()=>{_(!1),a(0),d()},onError:m=>{_(!1),Vn(m,"error")}},i),e&&(t==null?void 0:t.loggedIn)&&t.sshKeyStatus==="none_registered"&&(t.sshKeyPath?f.jsxs("p",{dir:"auto",className:ya,children:[FHe()," ",f.jsxs("code",{children:["orx ssh-key add ",t.sshKeyPath]}),"."]}):f.jsxs("p",{dir:"auto",className:ya,children:[oKe()," ",f.jsx("code",{children:"ssh-keygen -t ed25519"}),PXe()," ",f.jsx("code",{children:"orx ssh-key add"}),"."]})),e&&(t==null?void 0:t.loggedIn)&&t.sshKeyStatus==="no_local_match"&&(t.sshKeyPath?f.jsx("p",{dir:"auto",className:ya,children:ZZe({register:Ne(`orx ssh-key add ${t.sshKeyPath}`),load:Ne("ssh-add")})}):f.jsxs("p",{dir:"auto",className:ya,children:[rKe()," ",f.jsx("code",{children:"ssh-add"}),sQe()," ",f.jsx("code",{children:"ssh-keygen -t ed25519"}),"."]})),!s&&(r||(t==null?void 0:t.error))&&f.jsx("p",{dir:"auto",className:"mt-4 mb-0 text-sm text-accent-red whitespace-pre-wrap break-words",children:r||(t==null?void 0:t.error)})]}),f.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[f.jsxs(Le,{onClick:()=>void d(),disabled:s||u,children:[f.jsx(Ea,{size:13})," ",s?Vi():Kp()]}),!e&&t&&(!t.loggedIn||t.sshKeyStatus!=="matched")&&f.jsxs(Le,{variant:"primary",disabled:s||u,onClick:()=>{l(!t.loggedIn),_(!0),a(m=>m+1)},children:[u?f.jsx(Lt,{}):f.jsx(i_,{size:13})," ",t.loggedIn?ZJe():wL()]})]})]})}const u8t={local:Gpe,ssh:dme,tinker:pme,hf:Ipe,modal:Qpe,k8s:Fpe,slurm:ome,ray:rme,openresearch:Jpe},Xb={local:"local_job",tinker:"tinker_job",hf:"hf_job",modal:"modal_job",k8s:"k8s_job",ssh:"ssh_job",slurm:"slurm_job",ray:"ray_job",openresearch:"openresearch_job"},oA=["hf","modal","slurm","ray","openresearch"],Ew=["hf","modal","openresearch"],ZP={hf:["cpu-basic","t4-small","a10g-small","a10g-large","a100-large","h100","h200"],modal:["cpu","t4","l4","a10g","a100","a100-80gb","l40s","h100","h100:2"],slurm:["gpu","h100:1","h100:2","a100:4"],ray:["cpu","cpu:2","gpu","gpu:1","gpu:1,cpu:4","gpu:1,mem:8GiB"],openresearch:["h100_sxm","h100_sxm:2","cpu5c","cpu5g","cpu5m"]},X3=["tinker","hf","modal","ray","k8s"],d8t={tinker:fge,hf:ege,modal:sge,openresearch:lge},lA="__custom__";function g0(e,n){return!!(n&&!(ZP[e]??[]).includes(n))}function f8t({settings:e,projectId:n,onSaved:t}){const r=mn({mutationFn:jdt}),s=e.configuredDefaultBackend??e.defaultBackend??"local",i=e.defaultFlavor??"",[a,o]=R.useState(s),[l,u]=R.useState(i),[_,d]=R.useState(g0(s,i)),[p,m]=R.useState(!1),[x,S]=R.useState(null),v=e.targets.find($=>$.id===a),b=e.targets.filter($=>$.configured||$.id===s),w=oA.includes(a),y=Ew.includes(a),C=ZP[a]??[],E=a===s&&(!w||l.trim()===i),N=Rd[a](),T=d8t[a],z=p?utt():y&&!l.trim()?$Be({destination:N}):a==="ssh"?VFe():qFe({destination:N});R.useEffect(()=>{o(s),u(i),d(g0(s,i))},[s,i]);async function M($,U){const H=oA.includes($);if(!(p||Ew.includes($)&&!U.trim())){m(!0),S(null);try{t(await r.mutateAsync({backend:$,flavor:H&&U.trim()||null,projectId:n}))}catch(Y){S(Y instanceof Error?Y.message:String(Y)),o(s),u(i),d(g0(s,i))}finally{m(!1)}}}function I($){const U=e.targets.find(Y=>Y.id===$);if(!U)return;o(U.id);const H=U.id===s?i:"";u(H),d(g0(U.id,H)),Ew.includes(U.id)||M(U.id,H)}function B($){if($===lA){d(!0);return}d(!1),u($),(!y||$)&&M(a,$)}return f.jsxs("section",{className:"mb-8",children:[f.jsx("h2",{className:"mt-0 mx-0 mb-2 text-lg",children:GUe()}),f.jsxs("div",{children:[f.jsxs("form",{className:"grid grid-cols-[minmax(12rem,18rem)_minmax(12rem,18rem)] items-start gap-3",onSubmit:$=>{$.preventDefault(),E||M(a,l)},children:[f.jsx(Ad,{choices:b.map($=>({id:$.id,label:Rd[$.id]()})),value:a,variant:"field",dropDown:!0,disabled:p,renderIcon:$=>{const U=e.targets.find(H=>H.id===$.id);return U?f.jsx(a_,{kind:Xb[U.id],size:16}):null},onSelect:I}),w&&f.jsx("div",{children:_?f.jsxs("div",{className:"relative",children:[f.jsx("input",{className:"h-9 w-full rounded-md border border-border bg-background py-0 pe-10 ps-3 font-sans text-sm text-text outline-none focus:border-text",type:"text",value:l,onChange:$=>u($.target.value),onBlur:()=>{if(y&&!l.trim()){a===s&&(u(i),d(g0(s,i)));return}E||M(a,l)},placeholder:EUe(),autoFocus:!0,autoComplete:"off",spellCheck:!1,disabled:p}),f.jsx("button",{type:"button",className:"absolute inset-y-0 end-0 inline-flex w-9 items-center justify-center text-muted hover:text-text","aria-label":CN(),title:CN(),onMouseDown:$=>$.preventDefault(),onClick:()=>d(!1),children:f.jsx(qo,{size:12})})]}):f.jsx(Ad,{choices:[{id:"",label:y?LBe():tHe()},...l&&!C.includes(l)?[{id:l,label:w$e({value:Ne(l)})}]:[],...C.map($=>({id:$,label:$})),{id:lA,label:TUe()}],value:l,variant:"field",dropDown:!0,disabled:p,onSelect:B})})]}),x&&f.jsx("div",{className:"error mt-2.5",children:x}),v&&!v.configured&&f.jsx("p",{className:ya,children:KXe()})]}),f.jsx("p",{className:"mt-2 mb-0 text-sm leading-relaxed text-subtext",children:z}),T&&f.jsx("p",{className:"mt-1 mb-0 text-sm leading-relaxed text-subtext",children:T()})]})}function h8t({target:e,isDefault:n,summary:t,onOpen:r,onOpenEnvironment:s}){const i=`compute-${e.id}-summary`,a=e.unverified?NBe():e.id==="openresearch"?wL():e.id==="ray"?a6():KJe();return f.jsxs("div",{className:`group relative flex min-h-41 w-full flex-col items-start rounded-lg border border-border bg-background p-5 text-start font-sans ${r&&e.enabled?"transition-colors duration-120 ease-standard hover:border-text hover:bg-surface":""} ${e.enabled?"":"opacity-52"}`,children:[r&&f.jsx("button",{type:"button",className:"absolute inset-0 z-10 rounded-lg focus-visible:outline-2 focus-visible:outline-text focus-visible:outline-offset-2 disabled:cursor-default",onClick:r,disabled:!e.enabled,"aria-label":Rd[e.id](),"aria-describedby":i,"aria-haspopup":X3.includes(e.id)?"dialog":void 0}),f.jsx("span",{className:"flex h-16 w-40 flex-none items-center justify-start",children:f.jsx(a_,{kind:Xb[e.id],size:48})}),f.jsx("span",{className:"mt-5 text-lg font-semibold text-text",children:Rd[e.id]()}),f.jsx("span",{className:"mt-1 line-clamp-2 min-h-9 text-sm leading-normal text-text",children:u8t[e.id]()}),f.jsx("span",{id:i,className:"mt-2 line-clamp-2 min-h-8 text-xs leading-normal text-subtext",children:e.fromEnvironmentTab?f.jsxs(f.Fragment,{children:[e.id==="tinker"?BPe():Ket()," ",f.jsx("button",{type:"button",className:"relative z-20 text-primary underline-offset-2 hover:text-primary-hover hover:underline",onClick:s,children:R$e()})]}):t??e.summary}),f.jsxs("span",{className:"mt-auto flex w-full items-center justify-between gap-3 pt-3 text-sm",children:[f.jsx("span",{className:n?"font-medium text-primary":"text-subtext",children:n?uL():e.configured?!r||X3.includes(e.id)?d6():xtt():a}),r&&f.jsx("span",{className:"text-subtext transition-transform duration-120 ease-standard group-hover:translate-x-0.5","aria-hidden":"true",children:f.jsx(E1,{size:16})})]})]})}function _8t({target:e,isDefault:n,onBack:t,remote:r}){return f.jsxs(f.Fragment,{children:[f.jsxs("button",{type:"button",className:"settings-back mb-6 inline-flex items-center gap-2 text-sm font-medium text-subtext hover:text-text",onClick:t,children:[f.jsx(ap,{size:16})," ",lL()]}),f.jsxs("div",{className:"flex items-center justify-between gap-6",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[f.jsx("span",{className:"flex h-10 w-10 flex-none items-center justify-center",children:f.jsx(a_,{kind:Xb[e.id],size:36})}),f.jsx("h1",{className:"m-0 min-w-0 text-2xl",children:Rd[e.id]()})]}),n&&f.jsx(Ft,{className:"flex-none border-primary bg-primary-subtle text-primary",children:uL()})]}),f.jsxs("div",{className:"mt-6 font-sans text-base text-text [&_.settings-card]:mb-0 [&_.settings-form]:mt-6 [&_.settings-form]:border-t-0 [&_.settings-form]:pt-0 [&>.settings-form:first-child]:mt-0 [&>div:first-child]:border-t-0",children:[e.id==="ssh"&&f.jsx(r8t,{remote:r}),e.id==="slurm"&&f.jsx(i8t,{remote:r}),e.id==="openresearch"&&f.jsx(c8t,{remote:r})]})]})}function p8t({target:e,onClose:n}){const t=R.useRef(null),[r,s]=R.useState({dirty:!1,saving:!1});R.useEffect(()=>{const a=t.current;return a==null||a.showModal(),()=>a==null?void 0:a.close()},[]);const i=()=>{r.saving||r.dirty&&!window.confirm(DPe())||n()};return f.jsxs("dialog",{ref:t,className:"m-auto w-140 max-w-[calc(100vw_-_40px)] max-h-[calc(100vh_-_40px)] overflow-y-auto rounded-xl border border-border bg-background p-5 text-text shadow-modal backdrop:bg-modal-backdrop-light","aria-labelledby":"compute-quick-setup-title",onKeyDown:a=>{a.key==="Escape"&&(a.preventDefault(),i())},onCancel:a=>{a.preventDefault(),i()},children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between gap-4",children:[f.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[f.jsx(a_,{kind:Xb[e.id],size:32}),f.jsx("h2",{id:"compute-quick-setup-title",className:"m-0 text-xl font-medium text-text",children:Rd[e.id]()})]}),f.jsx(Yt,{title:ev(),"aria-label":ev(),onClick:i,disabled:r.saving,children:f.jsx(qr,{size:14})})]}),e.id==="tinker"&&f.jsx(g8t,{target:e}),e.id==="hf"&&f.jsx(b8t,{}),e.id==="modal"&&f.jsx(e8t,{}),e.id==="ray"&&f.jsx(a8t,{}),e.id==="k8s"&&f.jsx(J7t,{onEditState:s})]})}function m8t({project:e,onViewHistory:n,onOpenEnvironment:t,remote:r}){var M,I;const s=GL(e==null?void 0:e.id),i=ot(s),a=i.data??null,o=B=>{Gr(s.queryKey,$=>(typeof B=="function"?B($??null):B)??void 0)},l=a?null:((M=i.error)==null?void 0:M.message)??null,[u,_]=R.useState(null),[d,p]=R.useState(null),m=zft(),x=ot(m),S=x.data??null,v=((I=x.error)==null?void 0:I.message)??null;R.useEffect(()=>{_(null),p(null)},[e==null?void 0:e.id]);const b=B=>{o(B),p(null)},w=a?a.targets:null,y=(a==null?void 0:a.configuredDefaultBackend)??(a==null?void 0:a.defaultBackend),C=w?[...w].sort((B,$)=>+($.id===y)-+(B.id===y)):null,E=(C==null?void 0:C.filter(B=>B.configured))??[],N=(C==null?void 0:C.filter(B=>!B.configured))??[],T=B=>f.jsx(h8t,{target:B,isDefault:y===B.id,summary:B.id==="local"?S?l8t(S):v??QUe():void 0,onOpen:B.id==="local"?void 0:()=>_(B.id),onOpenEnvironment:t},`${(e==null?void 0:e.id)??"none"}:${B.id}`),z=u?a==null?void 0:a.targets.find(B=>B.id===u):null;return z&&!X3.includes(z.id)?f.jsx(_8t,{target:z,isDefault:y===z.id,onBack:()=>_(null),remote:r}):f.jsxs(f.Fragment,{children:[f.jsx("h1",{children:cL()}),f.jsx("p",{className:"settings-sub mt-0 mx-0 mb-4.5 text-base leading-relaxed text-text",children:aUe()}),f.jsx(O8t,{projectId:e==null?void 0:e.id,onViewHistory:n}),l?f.jsx("div",{className:"error",children:l}):a?f.jsxs(f.Fragment,{children:[d&&f.jsx("div",{className:"error",children:d}),f.jsx(f8t,{settings:a,projectId:e==null?void 0:e.id,onSaved:b}),f.jsxs("section",{className:"mb-8",children:[f.jsx("h2",{className:"mt-0 mx-0 mb-2 text-lg",children:d6()}),f.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:E.map(T)})]}),N.length>0&&f.jsxs("section",{className:"mb-3.5",children:[f.jsx("h2",{className:"mt-0 mx-0 mb-2 text-lg",children:cVe()}),f.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:N.map(T)})]}),z&&f.jsx(p8t,{target:z,onClose:()=>_(null)})]}):f.jsxs(rs,{children:[f.jsx(Lt,{})," ",Aqe()]})]})}function g8t({target:e}){var w;const n=mn({mutationFn:Zut}),[t,r]=R.useState(""),[s,i]=R.useState(!1),[a,o]=R.useState(null),l=$N(),u=ot(l),_=u.data??null,d=a??((w=u.error)==null?void 0:w.message)??null,p=y=>{Gr(l.queryKey,C=>(typeof y=="function"?y(C??null):y)??void 0)},[m,x]=R.useState(!1),S=u.isPending||m;async function v(){if(!(S||s)){x(!0),o(null);try{await tt.fetchQuery({...$N(),staleTime:0})}catch(y){o(y instanceof Error?y.message:String(y))}finally{x(!1)}}}async function b(y){if(y.preventDefault(),!(!t.trim()||s||S)){i(!0),o(null);try{p(await n.mutateAsync(t.trim())),r("")}catch(C){o(C instanceof Error?C.message:String(C))}finally{i(!1)}}}return f.jsxs(f.Fragment,{children:[!_&&S?f.jsxs(rs,{children:[f.jsx(Lt,{})," ",Vi()]}):_&&f.jsxs("dl",{className:"m-0 flex items-center justify-between gap-4 text-sm",children:[f.jsx("dt",{className:"font-medium text-subtext",children:r_()}),f.jsx("dd",{className:"m-0",children:f.jsx(Ft,{variant:_.validationStatus==="valid"?"success":_.validationStatus==="invalid"?"error":"warning",children:_.validationStatus==="valid"?Qp():_.validationStatus==="invalid"?Uet():_.validationStatus==="billingRequired"?Oet():Zv()})})]}),(_==null?void 0:_.validationStatus)==="billingRequired"&&f.jsx("p",{className:"mt-2 mb-0 text-sm text-subtext",children:f.jsx("a",{className:"underline",href:"https://tinker.thinkingmachines.ai/",target:"_blank",rel:"noreferrer",children:Ret()})}),(_==null?void 0:_.processEnv)&&f.jsx("p",{className:"mt-2 mb-0 text-sm text-subtext",children:Pet()}),f.jsxs("form",{className:"mt-5 flex flex-col gap-4",onSubmit:b,children:[f.jsxs("label",{className:"flex flex-col gap-2 text-sm font-medium text-subtext",children:[e.configured||_!==null&&_.validationStatus!=="missing"?CJe():r6(),f.jsx(ns,{type:"password",value:t,placeholder:(_==null?void 0:_.maskedKey)??"",onChange:y=>r(y.target.value),autoComplete:"new-password"})]}),d&&f.jsx("p",{className:"m-0 text-sm text-accent-red",children:d}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsxs(Le,{type:"button",disabled:s||S,onClick:()=>void v(),children:[f.jsx(Ea,{size:13})," ",S?Vi():Kp()]}),f.jsx(Le,{variant:"primary",type:"submit",disabled:!t.trim()||s||S,children:s?kL():Ho()})]})]})]})}function v8t({settings:e}){return e.validationStatus==="missing"?f.jsx(Ft,{variant:"warning",children:Zv()}):e.validationStatus==="invalid"?f.jsx(Ft,{variant:"error",children:fWe()}):e.validationStatus!=="valid"?null:e.jobsWrite===!0?f.jsx(Ft,{variant:"success",children:Qp()}):e.jobsWrite===!1?f.jsxs("span",{className:"inline-flex items-center gap-2",children:[f.jsx(Ft,{variant:"warning",children:JVe()}),f.jsx(w6,{content:uPe(),className:"text-subtext",children:f.jsx(R6,{size:15})})]}):null}function b8t(){var v;const e=mn({mutationFn:Yut}),n=BN(),t=ot(n),r=t.data??null,s=b=>{Gr(n.queryKey,w=>(typeof b=="function"?b(w??null):b)??void 0)},i=r?null:((v=t.error)==null?void 0:v.message)??null,[a,o]=R.useState(""),[l,u]=R.useState(!1),[_,d]=R.useState(!1),[p,m]=R.useState(null);async function x(){if(!(l||_||!r&&!i)){d(!0),m(null);try{await tt.fetchQuery({...BN(),staleTime:0})}catch(b){m(b instanceof Error?b.message:String(b))}finally{d(!1)}}}async function S(b){if(b.preventDefault(),!(!a.trim()||l||_||!r&&!i)){u(!0),m(null);try{const w=await e.mutateAsync(a.trim());s(w),m(null),o("")}catch(w){m(w instanceof Error?w.message:String(w))}finally{u(!1)}}}return f.jsxs(f.Fragment,{children:[i?f.jsx("div",{className:"error",children:i}):r?f.jsxs(f.Fragment,{children:[f.jsxs("dl",{className:"m-0 flex flex-col gap-3 text-sm",children:[r.username&&f.jsxs("div",{className:"flex items-center justify-between gap-4",children:[f.jsx("dt",{className:"font-medium text-subtext",children:c6()}),f.jsx("dd",{className:"m-0 text-text",children:r.username})]}),(r.validationStatus==="missing"||r.validationStatus==="invalid"||r.validationStatus==="valid"&&r.jobsWrite!==null)&&f.jsxs("div",{className:"flex items-center justify-between gap-4",children:[f.jsx("dt",{className:"font-medium text-subtext",children:r_()}),f.jsx("dd",{className:"m-0 text-text",children:f.jsx(v8t,{settings:r})})]})]}),r.validationStatus==="unreachable"&&r.validationError&&f.jsx("p",{className:Yb,children:r.validationError}),r.source==="env"&&f.jsx("p",{className:ya,children:PGe()}),r.validationStatus==="valid"&&r.jobsWrite===null&&f.jsx("p",{className:ya,children:aPe({login:Ne("hf auth login"),url:Ne("huggingface.co/settings/tokens")})})]}):f.jsxs(rs,{children:[f.jsx(Lt,{})," ",$We()]}),f.jsxs("form",{className:"mt-5 flex flex-col gap-4",onSubmit:S,children:[f.jsxs("label",{className:"flex flex-col gap-2 text-sm font-medium text-subtext",children:[r!=null&&r.configured?jJe():XFe(),f.jsx(ns,{type:"password",value:a,onChange:b=>o(b.target.value),placeholder:(r==null?void 0:r.maskedToken)??OGe(),autoComplete:"off"})]}),p&&f.jsx("div",{className:"error",children:p}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsxs(Le,{type:"button",disabled:l||_||!r&&!i,onClick:()=>void x(),children:[f.jsx(Ea,{size:13})," ",_?Vi():Kp()]}),f.jsx(Le,{variant:"primary",type:"submit",disabled:!a.trim()||l||_||!r&&!i,children:l?kL():Ho()})]})]})]})}const JP=/^hf_[A-Za-z0-9]{10,}$/;function eF(){return f.jsx("tr",{children:f.jsx("td",{colSpan:3,children:f.jsxs("p",{dir:"auto",className:ya,children:[ZXe()," ",f.jsx("code",{children:"HF_TOKEN"}),IYe()]})})})}const cA=["TINKER_API_KEY","HF_TOKEN","WANDB_API_KEY"];function Z3(e,n){const t=n instanceof Error?n.message:String(n);Vn(t.includes(e)?t:`${e}: ${t}`,"error")}function y8t({name:e,entry:n,onVars:t}){const r=mn({mutationFn:d=>OL(...d)}),s=mn({mutationFn:cdt}),[i,a]=R.useState(""),[o,l]=R.useState(!1);async function u(){if(!(!i.trim()||o)){l(!0);try{t(await r.mutateAsync([e,i.trim()])),a("")}catch(d){Z3(e,d)}finally{l(!1)}}}async function _(){if(!o){l(!0);try{t(await s.mutateAsync(e))}catch(d){Z3(e,d)}finally{l(!1)}}}return f.jsxs(f.Fragment,{children:[f.jsxs("tr",{children:[f.jsx("td",{className:"font-mono text-sm",children:e}),f.jsx("td",{className:"text-base text-subtext",children:n?f.jsxs(f.Fragment,{children:[n.maskedValue,n.inProcessEnv&&f.jsx(Ft,{children:NQe()})]}):f.jsx(ns,{variant:"inline",className:"text-base",type:"password",value:i,onChange:d=>a(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),u()),d.key==="Escape"&&!o&&a("")},placeholder:bL(),"aria-label":zY({name:Ne(e)}),autoComplete:"new-password",disabled:o})}),f.jsx("td",{children:n?f.jsx(Yt,{className:"[&:hover:not(:disabled)]:text-accent-red",title:S4({name:Ne(e)}),"aria-label":S4({name:Ne(e)}),onClick:()=>void _(),disabled:o,children:f.jsx(Vd,{size:13})}):i.trim()&&f.jsx(Le,{size:"small",onClick:()=>void u(),disabled:o,children:o?Xi():Ho()})})]}),!n&&e!=="HF_TOKEN"&&JP.test(i.trim())&&f.jsx(eF,{})]})}function x8t({onVars:e,onDone:n}){const t=mn({mutationFn:d=>OL(...d)}),[r,s]=R.useState(""),[i,a]=R.useState(""),[o,l]=R.useState(!1);async function u(){if(!(!r.trim()||!i.trim()||o)){l(!0);try{e(await t.mutateAsync([r.trim(),i.trim()])),n()}catch(d){Z3(r.trim(),d)}finally{l(!1)}}}const _=d=>{d.key==="Enter"&&(d.preventDefault(),u()),d.key==="Escape"&&!o&&n()};return f.jsxs(f.Fragment,{children:[f.jsxs("tr",{children:[f.jsx("td",{children:f.jsx(ns,{autoFocus:!0,variant:"inline",className:"font-mono text-sm",type:"text",value:r,onChange:d=>s(d.target.value),onKeyDown:_,placeholder:"MY_API_KEY","aria-label":MVe(),autoComplete:"off",spellCheck:!1,disabled:o})}),f.jsx("td",{children:f.jsx(ns,{variant:"inline",className:"text-base",type:"password",value:i,onChange:d=>a(d.target.value),onKeyDown:_,placeholder:bL(),"aria-label":IVe(),autoComplete:"new-password",disabled:o})}),f.jsxs("td",{children:[f.jsx(Le,{size:"small",onClick:()=>void u(),disabled:o||!r.trim()||!i.trim(),children:o?Xi():Ho()}),f.jsx(Yt,{title:Nd(),"aria-label":Nqe(),onClick:n,disabled:o,children:f.jsx(qr,{size:13})})]})]}),r.trim()!=="HF_TOKEN"&&JP.test(i.trim())&&f.jsx(eF,{})]})}function w8t(){var u;const e=Tft(),n=ot(e),t=n.data??null,r=_=>{Gr(e.queryKey,d=>(typeof _=="function"?_(d??null):_)??void 0)},s=t?null:((u=n.error)==null?void 0:u.message)??null,[i,a]=R.useState(!1),o=t===null?[]:t.map(_=>_.key).filter(_=>!cA.includes(_)),l=[...cA,...o];return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"mb-4.5 flex items-center justify-between gap-4",children:[f.jsx("p",{className:"m-0 text-base leading-relaxed text-text",children:EZe()}),f.jsxs(Le,{size:"small",className:"shrink-0",onClick:()=>a(!0),disabled:i||t===null,children:[f.jsx(em,{size:12})," ",GHe()]})]}),f.jsx("div",{className:Po,children:s?f.jsx("div",{className:"error",children:s}):t===null?f.jsxs(rs,{children:[f.jsx(Lt,{})," ",du()]}):f.jsx("table",{className:"env-table w-full table-fixed border-collapse text-base [&_td:first-child]:w-[32%] [&_td:first-child]:wrap-anywhere [&_.badge]:ms-2 [&_td]:h-12 [&_td]:pt-0 [&_td]:pe-2.5 [&_td]:pb-0 [&_td]:ps-0 [&_td]:align-middle [&_td]:border-b [&_td]:border-b-border-variant [&_td:last-child]:w-29 [&_td:last-child]:whitespace-nowrap [&_td:last-child]:text-end [&_td[colspan]]:whitespace-normal [&_td[colspan]]:text-start [&_.icon-btn]:ms-2 [&_.icon-btn]:align-middle",children:f.jsxs("tbody",{children:[l.map(_=>f.jsx(y8t,{name:_,entry:t.find(d=>d.key===_),onVars:r},_)),i&&f.jsx(x8t,{onVars:r,onDone:()=>a(!1)})]})})})]})}const v0=[{value:"system",label:zet,icon:Jpt},{value:"light",label:ket,icon:xmt},{value:"dark",label:met,icon:tmt}],S8t=[{id:"en",label:"English"},{id:"zh-CN",label:"简体中文"},{id:"fa",label:"فارسی"}];function k8t(){const e=Gd(),[n,t]=nO(),r=s=>{var _;const i=s.key==="ArrowRight"||s.key==="ArrowDown"?1:s.key==="ArrowLeft"||s.key==="ArrowUp"?-1:0;if(!i)return;s.preventDefault();const a=[...s.currentTarget.querySelectorAll('[role="radio"]')],o=a.findIndex(d=>d===document.activeElement),u=((o===-1?v0.findIndex(d=>d.value===n):o)+i+v0.length)%v0.length;t(v0[u].value),(_=a[u])==null||_.focus()};return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:lBe()}),f.jsxs("div",{className:`${Po} mt-3`,children:[f.jsxs("div",{className:`${Ml} pb-3.5`,children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:LN()}),f.jsx("div",{className:"theme-segmented inline-flex flex-none gap-0.5 p-0.5 border border-border rounded-md bg-surface",role:"radiogroup","aria-label":LN(),onKeyDown:r,children:v0.map(({value:s,label:i,icon:a})=>f.jsxs("button",{type:"button",role:"radio","aria-checked":n===s,tabIndex:n===s?0:-1,className:`theme-segment inline-flex items-center gap-1.5 py-[5px] px-2.5 rounded-sm text-subtext text-sm cursor-pointer transition-[background,color] duration-120 ease-standard [&:hover:not(.on)]:text-text [&:hover:not(.on)]:bg-highlight [&.on]:text-background [&.on]:bg-primary [&:focus-visible]:outline-2 [&:focus-visible]:outline-solid [&:focus-visible]:outline-text [&:focus-visible]:outline-offset-2 ${n===s?"on":""}`,onClick:()=>t(s),children:[f.jsx(a,{size:14}),i()]},s))})]}),f.jsxs("div",{className:Ml,children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:YPe()}),f.jsx("div",{className:"w-52 flex-none",children:f.jsx(Ad,{choices:S8t,value:e,variant:"field",dropDown:!0,onSelect:s=>{cD(s)&&JL(s)}})})]})]})]})}const C8t={installer:Plt,"app-bundle":zlt,cargo:Rlt,homebrew:Olt,nix:Ult,unknown:Klt},Nw={cargo:Zlt,homebrew:nct,nix:act};function E8t(){var d;const e=mn({mutationFn:p=>ndt(...p)}),{status:n,error:t,apply:r}=P6(),[s,i]=R.useState(null),[a,o]=R.useState(null),l=cI(n),u=s!==null||l.restarting;if(!n)return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:AN()}),t?f.jsx("div",{className:Po,children:f.jsx("div",{className:"error",children:t})}):f.jsxs(rs,{children:[f.jsx(Lt,{})," ",du()]})]});const _=async(p,m)=>{i(p),o(null);try{await m()}catch(x){o(x instanceof Error?x.message:String(x))}finally{i(null)}};return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:AN()}),f.jsxs("div",{className:`${Po} mt-3`,children:[f.jsxs("div",{className:`${Dd} pb-3.5`,children:[f.jsx("div",{className:"k",children:yL()}),f.jsx("div",{className:"v",children:n.current}),f.jsx("div",{className:"k",children:kWe()}),f.jsx("div",{className:"v",children:n.latest??"—"}),f.jsx("div",{className:"k",children:fL()}),f.jsx("div",{className:"v",children:C8t[n.channel]()})]}),n.restartRequired&&f.jsxs("div",{className:Ml,children:[f.jsxs("div",{children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:CYe()}),f.jsx("p",{children:l.error?jL({error:l.error}):IJe({installed:Ne(n.installedVersion??"—"),current:Ne(n.current??n.installedVersion??"—")})})]}),n.canRestart&&f.jsx(Le,{size:"small",type:"button",disabled:u,onClick:l.restart,children:l.restarting?TL():zL()})]}),n.selfUpdates?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:Ml,children:[f.jsxs("div",{children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:zN()}),f.jsxs("p",{children:[jVe(),n.envDisabled&&att()]})]}),f.jsx(x6,{type:"button",checked:n.autoUpdate,"aria-label":zN(),disabled:u,onClick:()=>void _("auto",()=>e.mutateAsync([!n.autoUpdate]).then(r))})]}),f.jsxs("div",{className:Ml,children:[f.jsxs("div",{children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:n.updateAvailable?ntt({version:Ne(n.latest??"—")}):bBe()}),f.jsx("p",{children:n.updateAvailable?TPe():ABe()})]}),f.jsx(Le,{size:"small",type:"button",disabled:u,onClick:()=>void _("apply",()=>edt().then(r)),children:s==="apply"?e6():n.updateAvailable?Zet():SBe()})]})]}):f.jsx("div",{className:Ml,children:f.jsxs("div",{children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:mQe()}),f.jsx("p",{children:((d=Nw[n.channel])==null?void 0:d.call(Nw))??nJe()})]})}),n.channel==="app-bundle"&&f.jsx(z8t,{busy:s,disabled:u,run:_}),a&&f.jsx("div",{className:"error",children:a})]})]})}function N8t(){var d;const e=mn({mutationFn:Kdt}),n=Bft(),t=ot(n),r=t.data??null,s=p=>{Gr(n.queryKey,m=>(typeof p=="function"?p(m??null):p)??void 0)},[i,a]=R.useState(!1),[o,l]=R.useState(null),u=o??((d=t.error)==null?void 0:d.message)??null,_=()=>{!r||i||(a(!0),l(null),e.mutateAsync(!r.preferenceEnabled).then(s).catch(p=>l(p instanceof Error?p.message:String(p))).finally(()=>a(!1)))};return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:bZe()}),r?f.jsxs("div",{className:`${Po} mt-3`,children:[f.jsxs("div",{className:Ml,children:[f.jsxs("div",{children:[f.jsxs("div",{className:"project-default-title inline-flex items-center gap-1.5 text-base font-medium",children:[kN(),r.locked&&r.reason&&f.jsx(w6,{content:`${wUe()} ${r.reason}.`,className:"text-subtext",children:f.jsx(R6,{size:15})})]}),f.jsx("p",{children:FVe()})]}),f.jsx(x6,{type:"button",checked:r.enabled,"aria-label":kN(),disabled:i||r.locked,onClick:_})]}),u&&f.jsx("div",{className:"error",children:u})]}):u?f.jsx("div",{className:"error",children:u}):f.jsxs(rs,{children:[f.jsx(Lt,{})," ",du()]})]})}function z8t({busy:e,disabled:n,run:t}){const r=mn({mutationFn:rdt}),[s,i]=R.useState(null),[a,o]=R.useState(!1),l=u=>void t("cli",()=>r.mutateAsync(u).then(_=>{i(_),o(!1)}).catch(_=>{throw o(!u&&String((_==null?void 0:_.message)??_).includes("--force")),_}));return f.jsxs("div",{className:Ml,children:[f.jsxs("div",{children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:wPe({command:Ne("orx")})}),s?f.jsxs("p",{children:[s.alreadyCurrent?VBe({link:Ne(s.link)}):XBe({link:Ne(s.link)}),!s.onPath&&sBe({directory:Ne(s.dir)})]}):f.jsx("p",{children:vPe({command:Ne("orx")})})]}),f.jsx(Le,{size:"small",type:"button",disabled:n,onClick:()=>l(a),children:e==="cli"?e6():a?xJe():s?aJe():_Pe()})]})}function j8t(){var p;const e=mn({mutationFn:m=>FL(...m)}),n=m6(),t=ot(n),r=t.data??null,s=m=>{Gr(n.queryKey,x=>(typeof m=="function"?m(x??null):m)??void 0)},[i,a]=R.useState(!1),[o,l]=R.useState(null),u=o??((p=t.error)==null?void 0:p.message)??null,_=async()=>{await t.refetch({cancelRefetch:!1})},d=()=>{if(!r||i)return;const m=!r.githubForNewProjects;a(!0),l(null),e.mutateAsync([m,!0]).then(s).catch(x=>l(x instanceof Error?x.message:String(x))).finally(()=>a(!1))};return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:yGe()}),r?f.jsxs("div",{className:`${Po} mt-3 project-defaults-card [&_.settings-card-head]:justify-between [&_.settings-card-head]:mb-0 [&_.settings-card-head]:pb-3 [&_.settings-card-head_h3]:m-0`,children:[f.jsxs("div",{className:"settings-card-head flex items-center gap-2.5 mb-3",children:[f.jsx("h3",{children:kGe()}),f.jsx(Ft,{variant:r.githubAuthenticated?"success":r.ghInstalled?"warning":"error",children:r.githubAuthenticated?nL():aL()})]}),f.jsxs("div",{className:Ml,children:[f.jsxs("div",{children:[f.jsx("div",{className:"project-default-title text-base font-medium",children:NN()}),f.jsx("p",{children:MZe()})]}),f.jsx(x6,{type:"button",checked:r.githubForNewProjects,"aria-label":NN(),disabled:i||!r.githubAuthenticated&&!r.githubForNewProjects,onClick:d})]}),!r.githubAuthenticated&&f.jsx("div",{className:"mt-3.5 pt-3.5 border-t border-t-border-variant",children:f.jsx(tF,{ghInstalled:r.ghInstalled,onCheck:_})}),u&&f.jsx("div",{className:"error",children:u})]}):u?f.jsx("div",{className:"error",children:u}):f.jsxs(rs,{children:[f.jsx(Lt,{})," ",du()]})]})}function tF({ghInstalled:e,onCheck:n}){const[t,r]=R.useState(!1),s=()=>{r(!0),n().finally(()=>r(!1))};return f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"git-card-helper m-0 text-sm leading-relaxed text-text",children:tm(e?FJe():EPe())}),f.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[!e&&f.jsxs(Bh,{variant:"primary",href:"https://cli.github.com/",target:"_blank",rel:"noreferrer",children:[tWe()," ",f.jsx(jd,{size:12})]}),f.jsx(Le,{type:"button",variant:e?"warning":"default",disabled:t,onClick:s,children:t?Vi():Kp()})]})]})}function T8t(){var m,x,S;const e=mn({mutationFn:Out}),n=mn({mutationFn:Iut}),t=kgt(),r=ot(t),s=((m=r.data)==null?void 0:m.hasToken)??null,i=((x=r.data)==null?void 0:x.hasSession)??null,a=v=>Gr(t.queryKey,{hasToken:s??!1,hasSession:i??!1,...v}),o=v=>a({hasToken:v}),[l,u]=R.useState(!1),[_,d]=R.useState(null),p=_??((S=r.error)==null?void 0:S.message);return f.jsxs("div",{className:Y3,children:[f.jsx("h3",{children:pL()}),f.jsxs("div",{className:Dd,children:[f.jsx("span",{className:"k",children:zGe()}),f.jsx("span",{className:"v",children:f.jsx(Ft,{variant:s?"success":"default",children:s===null?p?Ka():Vi():s?MN():T4()})})]}),f.jsx("p",{className:"git-card-helper mt-3.5 mx-0 mb-0 text-sm leading-relaxed text-text",children:IZe()}),s?f.jsx("div",{className:U0,children:f.jsx(Le,{disabled:l,onClick:()=>{u(!0),d(null),e.mutateAsync().then(v=>o(v.hasToken)).catch(v=>d(v instanceof Error?v.message:String(v))).finally(()=>u(!1))},children:l?RN():_Je()})}):f.jsx(aA,{save:DL,onSaved:v=>o(v.hasToken),placeholder:SQe(),createHref:"https://www.overleaf.com/user/settings"}),f.jsxs("div",{className:Dd,children:[f.jsx("span",{className:"k",children:FYe()}),f.jsx("span",{className:"v",children:f.jsx(Ft,{variant:i?"success":"default",children:i===null?p?Ka():Vi():i?MN():T4()})})]}),f.jsx("p",{className:"git-card-helper mt-3.5 mx-0 mb-0 text-sm leading-relaxed text-text",children:GYe()}),i?f.jsx("div",{className:U0,children:f.jsx(Le,{disabled:l,onClick:()=>{u(!0),d(null),n.mutateAsync().then(v=>a({hasSession:v.hasSession})).catch(v=>d(v instanceof Error?v.message:String(v))).finally(()=>u(!1))},children:l?RN():uJe()})}):f.jsx(aA,{save:v=>LL(v),onSaved:v=>a({hasSession:v.hasSession}),placeholder:N4(),createHref:"https://www.overleaf.com/project",createLabel:qze()}),p&&f.jsx("div",{className:"error",children:p})]})}function A8t({project:e,onProjectUpdate:n}){var T;const t=mn({mutationFn:z=>FL(...z)}),r={...Ift((e==null?void 0:e.id)??""),enabled:!!e},s=ot(r),i=s.data??null,a=z=>{Gr(r.queryKey,M=>(typeof z=="function"?z(M??null):z)??void 0)},[o,l]=R.useState(!1),[u,_]=R.useState(null),d=u??((T=s.error)==null?void 0:T.message)??null,[p,m]=R.useState(!1),[x,S]=R.useState(!1),[v,b]=R.useState(null),w=!!(i!=null&&i.github.owner&&i.github.repo),y=async()=>{await s.refetch({cancelRefetch:!1})},C=z=>{const M=z instanceof Error?z.message:String(z);return M.toLowerCase().includes("archived")?P$e():M.includes("(fetch first)")||M.includes("non-fast-forward")?U$e():M.includes("403")||M.toLowerCase().includes("permission denied")?K$e():M},E=()=>{e&&(l(!0),_(null),Gdt(e.id).then(z=>{a(z.git),n(z.project),tt.fetchQuery(m6()).then(M=>{!M.githubForNewProjects&&!M.githubDefaultPromptSeen&&m(!0)}).catch(()=>{})}).catch(z=>_(C(z))).finally(()=>l(!1)))},N=z=>{S(!0),b(null),t.mutateAsync([z,!0]).then(()=>m(!1)).catch(M=>b(M instanceof Error?M.message:String(M))).finally(()=>S(!1))};return f.jsxs(f.Fragment,{children:[f.jsx("h1",{children:xYe()}),f.jsx("p",{className:"settings-sub mt-0 mx-0 mb-4.5 text-base leading-relaxed text-text",children:MJe({project:(e==null?void 0:e.name)??v$e()})}),e?d&&!i?f.jsx("div",{className:"error",children:d}):i?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:Y3,children:[f.jsx("h3",{children:VWe()}),f.jsxs("div",{className:Dd,children:[f.jsx("span",{className:"k",children:LQe()}),f.jsx("span",{className:"v",children:i.path}),f.jsx("span",{className:"k",children:"Git"}),f.jsx("span",{className:"v",children:i.gitVersion??qD()}),f.jsx("span",{className:"k",children:hXe()}),f.jsx("span",{className:"v",children:i.initialized?O$e({branch:Ne(i.currentBranch??o6()),state:i.clean?qBe():nPe()}):bHe()}),f.jsx("span",{className:"k",children:mqe()}),f.jsx("span",{className:"v",children:i.baselineBranch}),f.jsx("span",{className:"k",children:gYe()}),f.jsx("span",{className:"v",children:i.remotes.length?i.remotes.map(z=>`${z.name}: ${z.url}`).join(" · "):l6()})]}),!i.initialized&&f.jsx("div",{className:U0,children:f.jsx(Le,{variant:"primary",onClick:()=>void Udt(e.id).then(a).catch(z=>_(String(z))),children:UGe()})})]}),f.jsxs("div",{className:Y3,children:[f.jsx("h3",{children:"GitHub"}),f.jsxs("div",{className:Dd,children:[f.jsx("span",{className:"k",children:oL()}),f.jsx("span",{className:"v",children:f.jsx(Ft,{variant:i.github.authenticated?"success":i.github.ghInstalled?"warning":"error",children:i.github.authenticated?nL():aL()})}),f.jsx("span",{className:"k",children:qQe()}),f.jsx("span",{className:"v",children:w?f.jsxs(f.Fragment,{children:[f.jsxs("span",{children:[i.github.owner,"/",i.github.repo]}),!i.github.enabled&&f.jsx(Ft,{children:zXe()})]}):f.jsx(Ft,{children:qWe()})}),i.github.enabled&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"k",children:kXe()}),f.jsx("span",{className:"v",children:i.github.syncStatus})]})]}),!i.github.authenticated&&f.jsx("div",{className:"mt-3.5 pt-3.5 border-t border-t-border-variant",children:f.jsx(tF,{ghInstalled:i.github.ghInstalled,onCheck:()=>y()})}),i.github.authenticated&&!i.github.enabled&&f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"git-card-helper mt-3.5 mx-0 mb-0 text-sm leading-relaxed text-text",children:w?_tt():_$e()}),f.jsxs("div",{className:U0,children:[w&&i.github.url&&f.jsxs(Bh,{href:i.github.url,target:"_blank",rel:"noreferrer",children:[TN()," ",f.jsx(jd,{size:12})]}),f.jsx(Le,{variant:"primary",disabled:o,onClick:E,children:o?oIe():rIe()})]})]}),i.github.enabled&&f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"git-card-helper mt-3.5 mx-0 mb-0 text-sm leading-relaxed text-text",children:rGe()}),f.jsxs("div",{className:U0,children:[i.github.url&&f.jsxs(Bh,{href:i.github.url,target:"_blank",rel:"noreferrer",children:[TN()," ",f.jsx(jd,{size:12})]}),f.jsx(Le,{disabled:o,onClick:()=>{l(!0),Wdt(e.id).then(z=>{a(z.git),n(z.project)}).catch(z=>_(z instanceof Error?z.message:String(z))).finally(()=>l(!1))},children:o?dIe():JOe()})]})]})]}),f.jsx(T8t,{}),d&&f.jsx("div",{className:"error",children:C(d)})]}):f.jsxs(rs,{children:[f.jsx(Lt,{})," ",du()]}):f.jsx("div",{className:Po,children:f.jsx("p",{className:ya,children:KKe()})}),p&&f.jsx("div",{className:"modal-backdrop fixed inset-0 bg-modal-backdrop-light flex items-start justify-center pt-[var(--modal-top)] px-4 pb-6 overflow-y-auto z-100",onClick:()=>N(!1),children:f.jsxs("div",{className:"modal max-w-[94vw] max-h-[calc(100vh_-_var(--modal-top)_-_48px)] overflow-y-auto bg-background border border-border rounded-xl shadow-modal p-6 [&_h2]:mt-0 [&_h2]:mx-0 [&_h2]:mb-3.5 [&_h2]:text-xl github-default-modal w-110 [&_>_p]:m-0 [&_>_p]:text-sm [&_>_p]:leading-relaxed [&_>_p]:text-text [&_>_.error]:mt-3.5",role:"dialog","aria-modal":"true","aria-labelledby":"github-default-title",onClick:z=>z.stopPropagation(),children:[f.jsx("h2",{id:"github-default-title",children:tVe()}),f.jsx("p",{children:UXe()}),v&&f.jsx("div",{className:"error",children:v}),f.jsxs("div",{className:"github-default-actions flex justify-end gap-2.5 mt-5.5",children:[f.jsx(Le,{disabled:x,onClick:()=>N(!1),children:jKe()}),f.jsx(Le,{variant:"primary",disabled:x,onClick:()=>N(!0),children:x?Xi():sFe()})]})]})})]})}const R8t={env:Ait,config:Lit,xdg:$it,default:Nit},zw={preparing:bit,copying:Qst,verifying:qit,finalizing:Jst},M8t=e=>{var n;return((n=zw[e])==null?void 0:n.call(zw))??e};function D8t(){var y;const e=Aft(),n=ot(e),t=n.data??null,r=t?null:((y=n.error)==null?void 0:y.message)??null,[s,i]=R.useState(""),[a,o]=R.useState(!1),[l,u]=R.useState(null),[_,d]=R.useState({kind:"idle"}),[p,m]=R.useState(null);R.useEffect(()=>{t&&i(C=>C||t.current)},[t]),R.useEffect(()=>XL(C=>{C.type==="progress"?d(E=>{const N=E.kind==="moving"?E.total:0;return{kind:"moving",phase:C.phase,copied:C.copiedBytes,total:C.totalBytes||N}}):C.type==="done"?(d({kind:"done",oldPathLeft:C.oldPathLeft}),u(null),i("")):C.type==="error"&&d({kind:"error",message:C.error})}),[]);const x=(t==null?void 0:t.source)==="env",S=s.trim(),v=t!==null&&S===t.current;async function b(){if(!(a||!S)){o(!0),m(null),u(null);try{u(await ddt(S))}catch(C){m(C instanceof Error?C.message:String(C))}finally{o(!1)}}}async function w(C){if(C.preventDefault(),!(_.kind==="moving"||!S||v)&&(m(null),!!window.confirm(oit({path:Ne(S)})))){d({kind:"moving",phase:"preparing",copied:0,total:(l==null?void 0:l.treeBytes)??0});try{await fdt(S)}catch(E){d({kind:"idle"}),m(E instanceof Error?E.message:String(E))}}}return f.jsxs(f.Fragment,{children:[f.jsx("h2",{children:yXe()}),f.jsx("p",{className:"settings-sub mt-0 mx-0 mb-4.5 text-sm leading-relaxed text-subtext",children:cet()}),r?f.jsx("div",{className:Po,children:f.jsx("div",{className:"error",children:r})}):t?f.jsxs("div",{className:Po,children:[f.jsx("div",{className:"settings-card-head mb-3",children:f.jsx("h3",{children:DUe()})}),f.jsxs("div",{className:Dd,children:[f.jsx("span",{className:"k",children:vUe()}),f.jsx("span",{className:"v",children:t.current}),f.jsx("span",{className:"k",children:gL()}),f.jsx("span",{className:"v",children:R8t[t.source]()})]}),!x&&f.jsxs("form",{className:pk,onSubmit:w,children:[f.jsxs("label",{children:[CVe(),f.jsx("input",{className:"text-sm",type:"text",value:s,onChange:C=>{i(C.target.value),u(null)},placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,disabled:_.kind==="moving"})]}),l&&!l.error&&l.ok&&f.jsxs("p",{className:ya,children:[oYe()," ",Al(l.treeBytes??0),l.freeBytes!=null&&` — ${rit({size:Ne(Al(l.freeBytes))})}`,l.sameFilesystem?Sit():"","."]}),l&&l.ok===!1&&l.error&&f.jsx("div",{className:"error",children:l.error}),p&&f.jsx("div",{className:"error",children:p}),_.kind==="moving"&&f.jsx(qP,{value:_.copied,max:_.total,label:M8t(_.phase),caption:_.total>0?f.jsxs("span",{className:"text-sm",children:[Al(_.copied)," / ",Al(_.total)]}):void 0}),_.kind==="done"&&f.jsxs("p",{className:ya,children:[gVe(),_.oldPathLeft&&f.jsxs(f.Fragment,{children:[" ",THe({path:Ne(_.oldPathLeft)})]})]}),_.kind==="error"&&f.jsxs("div",{className:"error",children:[hVe()," ",_.message]}),f.jsxs("div",{className:"actions",children:[f.jsx(Le,{type:"button",onClick:b,disabled:a||!S||v||_.kind==="moving",children:a?Vi():fBe()}),f.jsx(Le,{variant:"primary",type:"submit",disabled:!S||v||_.kind==="moving",children:_.kind==="moving"?pit():dit()})]})]})]}):f.jsxs(rs,{children:[f.jsx(Lt,{})," ",du()]})]})}const J3=e=>e==="running"||e==="starting";function L8t(e){return J3(e.status)?np(Date.now()-e.createdAt):e.endedAt?np(e.endedAt-e.createdAt):"—"}function nF({instances:e,emptyLabel:n}){return e.length===0?f.jsx("p",{className:"instances-empty m-0 rounded-lg border border-border bg-background py-3.5 px-4 text-base text-subtext",children:n}):f.jsx("div",{className:"instances-table-wrap overflow-x-auto",children:f.jsxs("table",{className:"runs-table w-full border-collapse bg-background text-base [&_th]:text-start [&_th]:text-text [&_th]:text-sm [&_th]:font-medium [&_th]:py-2 [&_th]:px-3 [&_th]:border-b [&_th]:border-b-border [&_th]:sticky [&_th]:top-0 [&_th]:bg-background [&_th]:z-1 [&_td]:py-2 [&_td]:px-3 [&_td]:border-b [&_td]:border-b-divider-faint [&_td]:whitespace-nowrap [&_tr:last-child_td]:border-b-0 [&_tr.clickable]:cursor-pointer [&_tr.clickable:hover_td]:bg-canvas",children:[f.jsx("thead",{children:f.jsxs("tr",{children:[f.jsx("th",{children:fqe()}),f.jsx("th",{children:r_()}),f.jsx("th",{children:cXe()}),f.jsx("th",{children:MYe()})]})}),f.jsx("tbody",{children:e.map(t=>{var s;const r=typeof((s=t.backend)==null?void 0:s.url)=="string"?t.backend.url:void 0;return f.jsxs("tr",{children:[f.jsx("td",{children:f.jsxs("span",{className:"backend-cell inline-flex items-center gap-0.5",children:[f.jsx($6,{backend:t.backend}),r&&f.jsx(nb,{size:"small",href:r,target:"_blank",rel:"noreferrer",title:jN(),"aria-label":jN(),onClick:i=>i.stopPropagation(),children:f.jsx(jd,{size:12})})]})}),f.jsx("td",{children:f.jsx(Il,{status:Hi(t)})}),f.jsx("td",{children:Io(t.createdAt)}),f.jsx("td",{children:L8t(t)})]},t.id)})})]})})}function O8t({projectId:e,onViewHistory:n}){var d;const t=ot({...Qc(e??""),enabled:!!e,subscribed:!!e}),r=e?t.data??(t.error?[]:null):[],s=(d=t.error)==null?void 0:d.message,i=t.isFetching,[,a]=R.useState(0);R.useEffect(()=>{const p=setInterval(()=>a(m=>m+1),3e4);return()=>clearInterval(p)},[]);const o=()=>{e&&t.refetch()},l=(p,m)=>m.createdAt-p.createdAt,u=r==null?void 0:r.filter(p=>J3(p.status)).sort(l),_=r==null?void 0:r.filter(p=>!J3(p.status)).sort(l);return f.jsxs("section",{className:"compute-activity [&_.count-badge]:inline-flex [&_.count-badge]:items-center [&_.count-badge]:justify-center [&_.count-badge]:min-w-4.5 [&_.count-badge]:h-4.5 [&_.count-badge]:py-0 [&_.count-badge]:px-[5px] [&_.count-badge]:rounded-md [&_.count-badge]:bg-canvas [&_.count-badge]:border [&_.count-badge]:border-border [&_.count-badge]:text-xs [&_.count-badge]:font-medium [&_.count-badge]:text-text mt-5.5 mx-0 mb-8",children:[f.jsxs("div",{className:"compute-activity-head flex items-start justify-between gap-5 mb-3.5 [&_h2]:flex [&_h2]:items-center [&_h2]:gap-2 [&_h2]:m-0 [&_h2]:text-lg [@media((max-width:_640px))]:items-stretch [@media((max-width:_640px))]:flex-col",children:[f.jsx("div",{children:f.jsxs("h2",{children:[jYe(),u&&u.length>0&&f.jsx("span",{className:"count-badge",children:u.length})]})}),f.jsxs("div",{className:"compute-activity-actions flex gap-2 flex-none [@media((max-width:_640px))]:justify-start",children:[f.jsxs(Le,{size:"small",onClick:o,disabled:i,children:[f.jsx(Ea,{size:12,className:i?"animate-[spin_0.9s_linear_infinite]":""})," ",Yp()]}),f.jsx(Le,{size:"small",onClick:n,children:_!=null&&_.length?p3e({count:Wt(_.length)}):d3e()})]})]}),s&&f.jsx("div",{className:"error",children:s}),!u||!_?f.jsxs(rs,{children:[f.jsx(Lt,{})," ",du()]}):f.jsx(nF,{instances:u,emptyLabel:e?J4e():o3e()})]})}function I8t({projectId:e,onBack:n}){var l;const t=ot({...Qc(e??""),enabled:!!e,subscribed:!!e}),r=e?t.data??(t.error?[]:null):[],s=(l=t.error)==null?void 0:l.message,i=t.isFetching,[,a]=R.useState(0);R.useEffect(()=>{const u=setInterval(()=>a(_=>_+1),3e4);return()=>clearInterval(u)},[]);const o=()=>{e&&t.refetch()};return f.jsxs(f.Fragment,{children:[f.jsxs("button",{type:"button",className:"settings-back inline-flex items-center gap-1.5 mt-0 mx-0 mb-4.5 text-subtext text-sm font-medium [&:hover]:text-text",onClick:n,children:[f.jsx(ap,{size:14})," ",lL()]}),f.jsxs("div",{className:"settings-head-row flex items-center justify-between gap-2.5 [&_h1]:m-0",children:[f.jsx("h1",{children:lWe()}),f.jsxs(Le,{size:"small",onClick:o,disabled:i,children:[f.jsx(Ea,{size:12,className:i?"animate-[spin_0.9s_linear_infinite]":""})," ",Yp()]})]}),s&&f.jsx("div",{className:"error",children:s}),r?f.jsx(nF,{instances:[...r].sort((u,_)=>_.createdAt-u.createdAt),emptyLabel:e?Q4e():r3e()}):f.jsxs(rs,{children:[f.jsx(Lt,{})," ",du()]})]})}const rF=["projects","harnesses","storage"],B8t=[{id:"compute",label:cL,icon:f.jsx(HO,{size:15}),activeTabs:["compute","instances"]},{id:"environment",label:dL,icon:f.jsx(i_,{size:15}),activeTabs:["environment"]},{id:"settings",label:f6,icon:f.jsx(XO,{size:15}),activeTabs:["settings",...rF]}];function $8t(e){return rF.includes(e)}function P8t({tab:e,project:n,onProjectUpdate:t,onSelectTab:r,remote:s=!1}){const i=e==="settings"||$8t(e),a=R.useRef(null);return R.useLayoutEffect(()=>{const o=a.current,l=o==null?void 0:o.parentElement;if(!o||!l)return;const u=()=>o.scrollIntoView({block:"start"}),_=new ResizeObserver(u);_.observe(l),u();const d=()=>_.disconnect(),p=["wheel","touchstart","pointerdown","keydown"];for(const m of p)window.addEventListener(m,d,{passive:!0});return()=>{d();for(const m of p)window.removeEventListener(m,d)}},[e,n==null?void 0:n.id]),f.jsxs("div",{className:"settings-view max-w-readable my-0 mx-auto pt-6 px-8 pb-15 [&_h1]:mt-0 [&_h1]:mx-0 [&_h1]:mb-1.5 [&_h1]:text-3xl [&_>_.error]:text-accent-red [&_>_.error]:text-base [&_>_.error]:whitespace-pre-wrap [&_>_.error]:mt-0 [&_>_.error]:mx-0 [&_>_.error]:mb-3",children:[i&&f.jsxs(f.Fragment,{children:[f.jsx("h1",{children:f6()}),f.jsxs("div",{className:"settings-stack mt-4.5",children:[f.jsx("section",{className:Hf,children:f.jsx(k8t,{})}),f.jsx("section",{ref:e==="projects"?a:void 0,className:Hf,children:f.jsx(j8t,{})}),f.jsx("section",{ref:e==="harnesses"?a:void 0,className:Hf,children:f.jsx(X7t,{})}),!s&&f.jsx("section",{ref:e==="storage"?a:void 0,className:Hf,children:f.jsx(D8t,{})}),f.jsx("section",{className:Hf,children:f.jsx(N8t,{})}),!s&&f.jsx("section",{className:Hf,children:f.jsx(E8t,{})})]})]}),e==="compute"&&f.jsx(m8t,{project:n,onViewHistory:()=>r("instances"),onOpenEnvironment:()=>r("environment"),remote:s}),e==="instances"&&f.jsx(I8t,{projectId:n==null?void 0:n.id,onBack:()=>r("compute")}),e==="environment"&&f.jsxs(f.Fragment,{children:[f.jsx("h1",{children:dL()}),f.jsx(w8t,{})]}),e==="git"&&f.jsx(A8t,{project:n,onProjectUpdate:t})]})}function zv(e){return e.charAt(0).toUpperCase()+e.slice(1).replaceAll("-"," ")}function e5(e){return`${e.plugin?`${zv(e.plugin)}: `:""}${zv(e.name)}`}const uA={name:"plan",get description(){return OTe()},source:"command"};function jw(e,n){if(n<0||n>e.length)return null;let t=n;for(;t>0&&!/\s/.test(e[t-1]);)t-=1;if(e[t]!=="/")return null;let r=n;for(;r=r?_:s}${a.slice(_.length)}`:s+a}const o=((u=/^[ \t]+/.exec(a))==null?void 0:u[0].length)??0;return{text:`${i}/${t}${a}`,cursor:i.length+t.length+1+o}}function dA(e,n){let t=e.slice(0,n.start),r=e.slice(n.end);return t?r?/\s$/.test(t)&&/^\s/.test(r)&&(r=r.slice(1)):t=t.replace(/\s$/,""):r=r.replace(/^\s/,""),{text:t+r,cursor:t.length}}function q8t(e,n){const t=e.filter(r=>r.name.toLowerCase()!==uA.name);return n&&t.push(uA),t.sort((r,s)=>+(s.source==="command")-+(r.source==="command")||e5(r).localeCompare(e5(s),void 0,{sensitivity:"base"}))}function U8t(e,n){if(!n)return null;const t=/(^|\s)\/plan(?=\s|$)/gi;return t.test(e)?{prompt:e.replace(t,"").trim()}:null}function fA(e,n,t){if(e==="command")return n!==void 0?n:t??void 0}function G8t({skills:e,activeIndex:n,onPick:t,onHover:r}){const s=R.useRef(null);return R.useLayoutEffect(()=>{var i;(i=s.current)==null||i.scrollIntoView({block:"nearest"})},[n,e]),f.jsx("div",{className:"skill-menu absolute bottom-[calc(100%_+_8px)] start-0 w-full max-h-[min(18rem,40vh)] overflow-y-auto overscroll-contain p-1.5 bg-background border border-border-variant rounded-2xl shadow-control-subtle z-50",children:e.map((i,a)=>f.jsxs("button",{ref:a===n?s:void 0,type:"button",className:`skill-item flex items-center gap-2 w-full text-start py-1 px-2 rounded-full text-sm font-normal text-text/80 [&.active]:bg-hover-muted [&.active]:text-text ${a===n?"active":""}`,onMouseDown:o=>{o.preventDefault(),t(i)},onMouseEnter:()=>r(a),children:[i.source==="command"&&i.name==="plan"?f.jsx(WO,{size:16,strokeWidth:1.5,className:"shrink-0","aria-hidden":"true"}):f.jsx(JO,{size:16,strokeWidth:1.5,className:"shrink-0","aria-hidden":"true"}),f.jsx("span",{className:"skill-name shrink-0",children:e5(i)}),f.jsx("span",{className:"skill-desc min-w-0 truncate text-muted",children:i.description}),i.source==="user"&&f.jsx("span",{className:"ms-auto shrink-0 ps-2 text-muted",children:Mtt()})]},i.name))})}const W8t=["font-family","font-size","font-weight","font-style","font-variant","line-height","letter-spacing","word-spacing","text-transform","direction","unicode-bidi","tab-size","padding-top","padding-right","padding-bottom","padding-left","border-top-width","border-right-width","border-bottom-width","border-left-width"];let V8t=null;function t5(e,n){const t=V8t??(V8t=document.createElement("canvas").getContext("2d"));if(!t||!n)return 6;const r=getComputedStyle(n);t.font=`${r.fontStyle} ${r.fontWeight} ${r.fontSize} ${r.fontFamily}`;const s=20+t.measureText(zv(e)).width-t.measureText(`/${e}`).width;return Math.max(2,Math.ceil((s+6)/t.measureText(" ").width))}function sF({name:e}){const n=e==="plan"?WO:JO;return f.jsxs(f.Fragment,{children:[f.jsx(n,{size:16,strokeWidth:1.5,className:"me-1 inline-block align-middle","aria-hidden":"true"}),zv(e)]})}function iF(e,n,t,r,s,i=!1){let a=0;return F8t(e,n).map((o,l,u)=>{var m,x;const _=a+o.text.length;a=_;const d=o.text.slice(1).toLowerCase();if(o.command&&s)return s(o.text,d,_,l);let p=o.text;return i||((m=u[l-1])!=null&&m.command&&(p=p.replace(/^[ \t]+/," ")),(x=u[l+1])!=null&&x.command&&(p=p.replace(/[ \t]+$/," "))),o.command?f.jsx("span",{className:t,onMouseDown:void 0,children:f.jsx(sF,{name:d})},l):i?f.jsx("span",{"aria-hidden":"true",children:o.text},l):f.jsx(R.Fragment,{children:p},l)})}function K8t({label:e,name:n,end:t,skill:r,projectId:s,textareaRef:i}){const a=R.useRef(null),o=R.useRef(null),l=R.useRef(null),u=R.useId(),[_,d]=R.useState(!1),p=ot({...Pft(n,s,r.harness),enabled:_,subscribed:_}),m=p.data??null,x=p.isFetching,[S,v]=R.useState({}),b=()=>{l.current!==null&&window.clearTimeout(l.current),l.current=null},w=()=>{const E=a.current;if(!E)return;const N=E.getBoundingClientRect(),T=Math.min(420,window.innerWidth-32),z=Math.max(16,Math.min(N.left-4,window.innerWidth-T-16));v(N.top>300?{bottom:window.innerHeight-N.top+12,left:z,width:T}:{left:z,top:N.bottom+12,width:T})},y=()=>{b(),w(),d(!0)},C=()=>{b(),l.current=window.setTimeout(()=>d(!1),120)};return R.useEffect(()=>()=>b(),[]),R.useEffect(()=>{if(!_)return;const E=()=>w();return window.addEventListener("resize",E),window.addEventListener("scroll",E,!0),()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0)}},[_]),f.jsxs(R.Fragment,{children:[f.jsxs("span",{ref:a,role:"button",tabIndex:0,"aria-controls":u,"aria-expanded":_,"aria-label":WQ({name:n}),className:"composer-chip group/skill pointer-events-auto relative z-1 inline-grid align-baseline cursor-text rounded-md bg-background text-skill-blue",onMouseEnter:y,onMouseLeave:C,onFocus:y,onBlur:C,onKeyDown:E=>{var N,T;if(E.key==="Escape"){d(!1);return}if(E.key==="Enter"||E.key===" "){E.preventDefault(),y();return}_&&(E.key==="ArrowDown"||E.key==="PageDown")&&(E.preventDefault(),(N=o.current)==null||N.scrollBy({top:E.key==="PageDown"?240:48,behavior:"smooth"})),_&&(E.key==="ArrowUp"||E.key==="PageUp")&&(E.preventDefault(),(T=o.current)==null||T.scrollBy({top:E.key==="PageUp"?-240:-48,behavior:"smooth"}))},onMouseDown:E=>{var N,T;E.preventDefault(),(N=i.current)==null||N.focus(),(T=i.current)==null||T.setSelectionRange(t,t),b()},children:[f.jsx("span",{className:"pointer-events-none absolute -inset-[7px] z-0 rounded-md bg-skill-blue-subtle opacity-0 transition-opacity group-hover/skill:opacity-100"}),f.jsx("span",{className:"invisible col-start-1 row-start-1","aria-hidden":"true",children:e}),f.jsx("span",{className:"relative z-1 col-start-1 row-start-1 w-0 whitespace-nowrap",children:f.jsx("span",{className:"bg-background text-skill-blue",children:f.jsx(sF,{name:n})})})]}),_&&eo.createPortal(f.jsxs("div",{id:u,ref:o,role:"dialog","aria-label":kY({name:n}),style:{...S,maxHeight:"min(28rem, calc(100vh - 2rem))"},className:"fixed z-100 overflow-y-auto rounded-lg border border-border bg-background shadow-floating",onMouseEnter:b,onMouseLeave:C,onFocus:b,onBlur:C,onMouseDown:E=>E.stopPropagation(),children:[f.jsxs("div",{className:"sticky top-0 z-1 flex items-center gap-2 border-b border-border-variant bg-background px-4 py-3",children:[f.jsxs("span",{className:"text-sm font-medium text-muted",children:["/",n]}),f.jsx(Ft,{className:"h-5 border-border-variant bg-canvas px-1.5 tracking-[0.05em]",children:Ctt()})]}),f.jsx("div",{className:"p-4 text-sm text-text",children:x&&m===null?f.jsx("span",{className:"text-muted",children:jtt()}):f.jsx($o,{text:m??r.description})})]}),document.body)]})}function Q8t({text:e,isCommand:n}){return f.jsx(f.Fragment,{children:iF(e,n,"skill-chip me-0.5 whitespace-nowrap font-normal text-skill-blue")})}function Y8t({text:e,editingTokenEnd:n,isCommand:t,skills:r,projectId:s,textareaRef:i}){const a=R.useRef(null);return R.useLayoutEffect(()=>{const o=i.current,l=a.current;if(!o||!l)return;const u=()=>{const d=getComputedStyle(o);for(const p of W8t)l.style.setProperty(p,d.getPropertyValue(p));l.style.width=`${o.clientWidth+parseFloat(d.borderLeftWidth)+parseFloat(d.borderRightWidth)}px`};u();const _=new ResizeObserver(u);return _.observe(o),()=>_.disconnect()},[e,i]),R.useLayoutEffect(()=>{const o=i.current;if(!o)return;const l=()=>{a.current&&(a.current.scrollTop=o.scrollTop)};return l(),o.addEventListener("scroll",l),()=>o.removeEventListener("scroll",l)},[i,e]),f.jsxs("div",{ref:a,className:"composer-chips pointer-events-none absolute inset-y-0 start-0 z-2 box-border overflow-hidden whitespace-pre-wrap break-words border-solid border-transparent text-transparent select-none",children:[iF(e,t,"",void 0,(o,l,u,_)=>{var x;const d=e.slice(u),p=((x=/^[ \t]+/.exec(d))==null?void 0:x[0].length)??0;if(u===n||d&&!d.startsWith(` +`)&&pS.name===l);return m&&m.source!=="command"?f.jsx(K8t,{label:o,name:l,end:u,skill:m,projectId:s,textareaRef:i},`${_}:${u}`):f.jsxs("span",{"aria-hidden":"true",className:"bg-background text-skill-blue",children:[f.jsx("span",{className:"text-skill-blue-slash",children:"/"}),o.slice(1)]},`${_}:${u}`)},!0),"​"]})}function X8t(e){return e>=95?"var(--accent-red)":e>=80?"var(--accent-amber)":"var(--accent)"}const n5=6.5,hA=2*Math.PI*n5;function Z8t({usage:e}){return!e||e.usedTokens<=0?null:f.jsx(J8t,{usage:e})}function J8t({usage:e}){const{open:n,setOpen:t,ref:r}=to(),{usedTokens:s,contextWindow:i}=e,a=i&&i>0?Math.min(100,Math.round(s/i*100)):null,o=a===null?"var(--accent)":X8t(a),l=a===null?"":new Intl.NumberFormat(j(),{style:"percent"}).format(a/100);return f.jsxs("div",{className:"option-picker relative inline-flex shrink-0",ref:r,children:[f.jsx("button",{type:"button",className:`${a===null?"inline-flex h-8 items-center rounded-md px-1 transition-[background,color] duration-150 ease-standard hover:bg-surface":"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-text transition-[background,color] duration-150 ease-standard hover:bg-surface"} composer-bare context-ring text-sm text-text`,title:yge(),onClick:()=>t(u=>!u),children:a===null?jg(s):f.jsxs("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true",children:[f.jsx("circle",{cx:"8",cy:"8",r:n5,fill:"none",stroke:"var(--border)",strokeWidth:"2.5"}),f.jsx("circle",{cx:"8",cy:"8",r:n5,fill:"none",stroke:o,strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:`${hA*Math.max(a,2)/100} ${hA}`,transform:"rotate(-90 8 8)"})]})}),n&&f.jsxs("div",{className:"option-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-95 flex flex-col bg-background border border-border rounded-lg shadow-menu z-50 overflow-hidden min-w-47.5 [&.align-right]:start-auto [&.align-right]:end-0 [&.drop-down]:bottom-auto [&.drop-down]:top-[calc(100%_+_4px)] [&.session-menu]:start-auto [&.session-menu]:end-1.5 [&.session-menu]:top-[calc(100%_-_2px)] [&.session-menu]:min-w-35 align-right context-meter-menu w-70 pt-2.5 px-3 pb-3 [&_.progress]:mt-2 [&_.progress]:mx-0 [&_.progress]:mb-0 [&_.progress-track]:h-[5px] [&_.progress-track]:border-0 [&_.progress-track]:bg-border",children:[f.jsxs("div",{className:"context-meter-head flex justify-between items-baseline gap-3 text-sm text-muted",children:[f.jsx("span",{children:mge()}),f.jsx("span",{className:"context-meter-value text-text tabular-nums",children:a===null?kge({value:Ne(jg(s))}):zge({used:Ne(jg(s)),total:Ne(jg(i)),percent:Ne(l)})})]}),a!==null&&f.jsx(qP,{value:s,max:i,fillColor:o})]})]})}const jv="!";function _A(e){return e.startsWith(jv)?e.slice(jv.length).trim():null}function eCt(e){return e.startsWith(jv)?e.slice(jv.length):e}function tCt(e){return e.replace(/([\\`*_[\]<>$~])/g,"\\$1").replace(/(^|\n)(\s*)(#{1,6}|>|[-+]|\d+\.)\s/g,"$1$2\\$3 ").replace(/(^|\n)(\s*)(=+|-{1,2})(?=\s*(?:\n|$))/g,"$1$2\\$3").replace(/(^|\n)(\s*)(-{3,})(?=\s*(?:\n|$))/g,"$1$2\\$3")}function nCt(e){const n=Math.max(0,...Array.from(e.matchAll(/`+/g),s=>s[0].length)),t="`".repeat(n+1),r=/^[\s`]|[\s`]$/.test(e)?` ${e} `:e;return`${t}${r}${t}`}function rCt(e){const n=Math.max(0,...Array.from(e.matchAll(/`+/g),r=>r[0].length)),t="`".repeat(Math.max(3,n+1));return` ${t} ${e.replace(/^\n|\n$/g,"")} @@ -1010,7 +1010,7 @@ ${e} `:`\\(${e}\\)`}function sCt(e,n){const t=n.trim().split(` `),r=" ".repeat(e.length+1);return[`${e} ${t[0]??""}`,...t.slice(1).map(s=>s?`${r}${s}`:"")].join(` `)}function iCt(e,n){if(e.length===0)return"";const t=Math.max(...e.map(a=>a.length)),r=a=>`| ${Array.from({length:t},(o,l)=>a[l]??"").join(" | ")} |`,s=n?e[0]:Array.from({length:t},()=>""),i=n?e.slice(1):e;return[r(s),r(Array.from({length:t},()=>"---")),...i.map(r)].join(` -`)}function aCt(e,n){const t=Number(e.slice(1));return Number.isInteger(t)&&t>=1&&t<=6?`${"#".repeat(t)} ${n.trim()}`:void 0}function oCt(e){return!e.includes("\\(")&&!e.includes("\\[")&&!e.includes("$$")}function lCt(e,n){return Math.min(e.length,n.length)/Math.max(e.length,n.length)>=.8&&(e.includes(n)||n.includes(e))}const aF="tool-line flex-1 min-w-0 line-clamp-2 break-words text-base leading-6",mk="tool-output py-1.5 px-2.5 font-mono text-xs text-subtext whitespace-pre-wrap wrap-anywhere max-h-65 overflow-y-auto bg-background border border-border-variant rounded-sm",vu=256,oF=1024,lF=2e4,Tw=8,r1="chat-annotations";function ld(e){return e instanceof Element?e:e.parentElement}function pA(e){const n=document.createRange();return n.setStart(e.container,e.offset),n.collapse(!0),n}function Aw(e,n){return pA(e).compareBoundaryPoints(Range.START_TO_START,pA(n))<0}function mA(e,n){const t=document.createRange();return t.setStart(e.container,e.offset),t.setEnd(n.container,n.offset),t.cloneContents()}const cCt=new Set(["A","B","CODE","EM","I","STRONG"]);function uCt(e,n){var s,i;const t=ld(e.endContainer);if(Array.from(n.childNodes).every(a=>a.nodeType===Node.TEXT_NODE)){let a=ld(e.startContainer);for(;a&&a.matches(".md *")&&a.contains(t);){if(cCt.has(a.tagName)){const o=a.cloneNode(!1);o instanceof HTMLElement&&(o.replaceChildren(...Array.from(n.childNodes)),n.replaceChildren(o))}a=a.parentElement}}const r=(s=ld(e.startContainer))==null?void 0:s.closest("pre");if(r!=null&&r.contains(t)){const a=(i=r.querySelector("code"))==null?void 0:i.cloneNode(!1),o=r.cloneNode(!1);o instanceof HTMLElement&&a instanceof HTMLElement&&(a.replaceChildren(...Array.from(n.childNodes)),o.replaceChildren(a),n.replaceChildren(o))}}function dCt(e){e.querySelectorAll("button").forEach(n=>{n.replaceWith(document.createTextNode(n.textContent??""))}),e.querySelectorAll("script, style, iframe, object, embed, input, textarea, select").forEach(n=>n.remove()),e.querySelectorAll("*").forEach(n=>{for(const t of Array.from(n.attributes))(t.name.toLowerCase().startsWith("on")||t.name==="contenteditable"||t.name==="tabindex")&&n.removeAttribute(t.name)})}function fCt(e,n){const t=document.createElement("div"),r={container:e.endContainer,offset:e.endOffset};let s={container:e.startContainer,offset:e.startOffset};const i=Array.from(n.querySelectorAll(".katex")).filter(a=>e.intersectsNode(a));for(const a of i){const o=a.closest(".katex-display")??a,l=document.createRange();l.selectNode(o);const u={container:l.startContainer,offset:l.startOffset},_={container:l.endContainer,offset:l.endOffset};if(Aw(s,u)&&t.append(mA(s,u)),t.append(o.cloneNode(!0)),s=_,!Aw(s,r))break}return i.length===0?t.append(e.cloneContents()):Aw(s,r)&&t.append(mA(s,r)),uCt(e,t),dCt(t),t}function hCt(e){const n=Array.from(e.querySelectorAll("tr")).map(t=>Array.from(t.querySelectorAll(":scope > th, :scope > td")).map(r=>yp(r).trim().replaceAll("|","\\|"))).filter(t=>t.length>0);return n.length>0?` +`)}function aCt(e,n){const t=Number(e.slice(1));return Number.isInteger(t)&&t>=1&&t<=6?`${"#".repeat(t)} ${n.trim()}`:void 0}function oCt(e){return!e.includes("\\(")&&!e.includes("\\[")&&!e.includes("$$")}function lCt(e,n){return Math.min(e.length,n.length)/Math.max(e.length,n.length)>=.8&&(e.includes(n)||n.includes(e))}const aF="tool-line flex-1 min-w-0 line-clamp-2 break-words text-base leading-6",mk="tool-output py-1.5 px-2.5 font-mono text-xs text-subtext whitespace-pre-wrap wrap-anywhere max-h-65 overflow-y-auto bg-background border border-border-variant rounded-sm",cu=256,oF=1024,lF=2e4,Tw=8,r1="chat-annotations";function sd(e){return e instanceof Element?e:e.parentElement}function pA(e){const n=document.createRange();return n.setStart(e.container,e.offset),n.collapse(!0),n}function Aw(e,n){return pA(e).compareBoundaryPoints(Range.START_TO_START,pA(n))<0}function mA(e,n){const t=document.createRange();return t.setStart(e.container,e.offset),t.setEnd(n.container,n.offset),t.cloneContents()}const cCt=new Set(["A","B","CODE","EM","I","STRONG"]);function uCt(e,n){var s,i;const t=sd(e.endContainer);if(Array.from(n.childNodes).every(a=>a.nodeType===Node.TEXT_NODE)){let a=sd(e.startContainer);for(;a&&a.matches(".md *")&&a.contains(t);){if(cCt.has(a.tagName)){const o=a.cloneNode(!1);o instanceof HTMLElement&&(o.replaceChildren(...Array.from(n.childNodes)),n.replaceChildren(o))}a=a.parentElement}}const r=(s=sd(e.startContainer))==null?void 0:s.closest("pre");if(r!=null&&r.contains(t)){const a=(i=r.querySelector("code"))==null?void 0:i.cloneNode(!1),o=r.cloneNode(!1);o instanceof HTMLElement&&a instanceof HTMLElement&&(a.replaceChildren(...Array.from(n.childNodes)),o.replaceChildren(a),n.replaceChildren(o))}}function dCt(e){e.querySelectorAll("button").forEach(n=>{n.replaceWith(document.createTextNode(n.textContent??""))}),e.querySelectorAll("script, style, iframe, object, embed, input, textarea, select").forEach(n=>n.remove()),e.querySelectorAll("*").forEach(n=>{for(const t of Array.from(n.attributes))(t.name.toLowerCase().startsWith("on")||t.name==="contenteditable"||t.name==="tabindex")&&n.removeAttribute(t.name)})}function fCt(e,n){const t=document.createElement("div"),r={container:e.endContainer,offset:e.endOffset};let s={container:e.startContainer,offset:e.startOffset};const i=Array.from(n.querySelectorAll(".katex")).filter(a=>e.intersectsNode(a));for(const a of i){const o=a.closest(".katex-display")??a,l=document.createRange();l.selectNode(o);const u={container:l.startContainer,offset:l.startOffset},_={container:l.endContainer,offset:l.endOffset};if(Aw(s,u)&&t.append(mA(s,u)),t.append(o.cloneNode(!0)),s=_,!Aw(s,r))break}return i.length===0?t.append(e.cloneContents()):Aw(s,r)&&t.append(mA(s,r)),uCt(e,t),dCt(t),t}function hCt(e){const n=Array.from(e.querySelectorAll("tr")).map(t=>Array.from(t.querySelectorAll(":scope > th, :scope > td")).map(r=>yp(r).trim().replaceAll("|","\\|"))).filter(t=>t.length>0);return n.length>0?` ${iCt(n,!!e.querySelector("tr:first-child th"))} @@ -1042,31 +1042,31 @@ ${n.trim()} `).replace(/[ \t]+\n/g,` `).replace(/\n{3,}/g,` -`).trim()||n}function gA(e){return e.normalize("NFKC").replace(/[\s\u200B-\u200D\u2060\uFEFF]/g,"").toLowerCase()}function pCt(e,n){var s,i,a,o;if(!oCt(e))return;const t=gA(e);if(t.length<8)return;let r;for(const l of n.querySelectorAll(".msg-assistant > .md .katex")){const _=[(s=l.querySelector(".katex-mathml"))==null?void 0:s.textContent,(i=l.querySelector(".katex-html"))==null?void 0:i.textContent,l.textContent].filter(x=>!!x).map(gA).find(x=>lCt(x,t));if(!_)continue;const d=(o=(a=l.querySelector("annotation[encoding='application/x-tex']"))==null?void 0:a.textContent)==null?void 0:o.trim();if(!d)continue;const p=!!l.closest(".katex-display"),m={markdown:r5(d,p).trim(),delta:Math.abs(_.length-t.length)};(!r||m.delta .md .katex")){const _=[(s=l.querySelector(".katex-mathml"))==null?void 0:s.textContent,(i=l.querySelector(".katex-html"))==null?void 0:i.textContent,l.textContent].filter(x=>!!x).map(gA).find(x=>lCt(x,t));if(!_)continue;const d=(o=(a=l.querySelector("annotation[encoding='application/x-tex']"))==null?void 0:a.textContent)==null?void 0:o.trim();if(!d)continue;const p=!!l.closest(".katex-display"),m={markdown:r5(d,p).trim(),delta:Math.abs(_.length-t.length)};(!r||m.deltaz.width>0&&z.height>0),x=m[0]??t.getBoundingClientRect(),S=m.filter(z=>z.topx.top),v=S.length>0?S:[x],b=Math.min(...v.map(z=>z.left)),w=Math.max(...v.map(z=>z.right)),y=Math.min(...v.map(z=>z.top)),C=Math.max(...v.map(z=>z.bottom)),E=34,N=74,T=y>=E+Tw?y-E-Tw:C+Tw;return{text:_Ct(p,d),range:t.cloneRange(),x:Math.min(window.innerWidth-N,Math.max(N,b+(w-b)/2)),top:T}}function gCt(e,n){const[t,r]=R.useState(null),s=R.useRef(!1),i=R.useCallback(()=>{const l=e.current;r(l?mCt(l):null)},[e]);R.useEffect(()=>{let l=null;const u=()=>{s.current||i()},_=p=>{const m=e.current,x=p.target;!p.isPrimary||p.button!==0||!m||!(x instanceof Node)||!m.contains(x)||(s.current=!0,r(null))},d=p=>{!p.isPrimary||!s.current||(s.current=!1,l=window.requestAnimationFrame(i))};return document.addEventListener("selectionchange",u),document.addEventListener("pointerdown",_,!0),window.addEventListener("pointerup",d,!0),window.addEventListener("pointercancel",d,!0),()=>{document.removeEventListener("selectionchange",u),document.removeEventListener("pointerdown",_,!0),window.removeEventListener("pointerup",d,!0),window.removeEventListener("pointercancel",d,!0),l!==null&&window.cancelAnimationFrame(l),s.current=!1}},[i]),R.useEffect(()=>{if(!t)return;const l=u=>{const _=u.target;_ instanceof Element&&_.closest(".chat-selection-action")||r(null)};return document.addEventListener("mousedown",l,!0),window.addEventListener("resize",i),()=>{document.removeEventListener("mousedown",l,!0),window.removeEventListener("resize",i)}},[t,i]);const a=R.useCallback(()=>{var l;t&&(n({text:t.text,range:t.range}),r(null),(l=window.getSelection())==null||l.removeAllRanges())},[t,n]),o=R.useCallback(()=>r(null),[]);return{action:t,add:a,dismiss:o}}function vCt(e){R.useLayoutEffect(()=>{if(!("highlights"in CSS)||typeof Highlight>"u")return;const n=e.flatMap(r=>r.range?[r.range]:[]);if(n.length===0){CSS.highlights.delete(r1);return}const t=new Highlight(...n);return CSS.highlights.set(r1,t),()=>{CSS.highlights.get(r1)===t&&CSS.highlights.delete(r1)}},[e])}function bCt({annotation:e}){const n=R.useRef(null),[t,r]=R.useState();return R.useLayoutEffect(()=>{var i;const s=(i=n.current)==null?void 0:i.closest(".chat-thread-inner");r(s?pCt(e.text,s):void 0)},[e.id,e.text]),f.jsx("div",{ref:n,children:f.jsx($o,{text:t??e.text})})}function yCt({annotations:e,onRemove:n}){return e.map((t,r)=>f.jsxs("div",{className:`annotation-item grid gap-2 py-2 px-1 [&+&]:border-t [&+&]:border-border-variant ${n?"grid-cols-[24px_minmax(0,_1fr)_28px]":"grid-cols-[24px_minmax(0,_1fr)]"}`,children:[f.jsxs("span",{className:"text-sm text-muted text-end",children:[r+1,"."]}),f.jsxs("div",{className:"min-w-0",children:[f.jsx("div",{className:"text-sm text-muted mb-1",children:Mde()}),f.jsx(bCt,{annotation:t})]}),n&&f.jsx(Qt,{type:"button",size:"small","data-annotation-remove":!0,title:ade(),"aria-label":YQ({number:Wt(r+1)}),onClick:()=>n(t.id),children:f.jsx(qr,{size:13})})]},t.id))}function gk({annotations:e,variant:n,onClear:t,onRemove:r}){const s=R.useRef(null),i=R.useRef(null),a=R.useId(),o=ro(s),l=n==="sent",u=R.useRef(null),_=()=>{u.current!==null&&window.clearTimeout(u.current),u.current=null,o.setOpen(!0)},d=()=>{u.current=window.setTimeout(()=>{var x;(x=i.current)!=null&&x.contains(document.activeElement)||o.setOpen(!1)},160)},p=()=>{const x=l||!o.open;o.setOpen(x),x&&window.requestAnimationFrame(()=>{var S;return(S=i.current)==null?void 0:S.focus()})},m=x=>{r==null||r(x),window.requestAnimationFrame(()=>{var v,b;(b=((v=i.current)==null?void 0:v.querySelector("button[data-annotation-remove]"))??i.current??s.current)==null||b.focus()})};return R.useEffect(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]),f.jsxs("div",{className:l?"sent-annotations relative flex w-fit":"composer-annotations relative flex w-fit pt-2 px-3 pb-0",ref:o.ref,onMouseEnter:l?_:void 0,onMouseLeave:l?d:void 0,children:[f.jsxs("div",{className:`inline-flex items-center border border-border bg-background overflow-hidden ${l?"rounded-full":"rounded-sm"}`,children:[f.jsxs("button",{ref:s,type:"button",className:`inline-flex items-center gap-1.5 py-1 text-sm font-medium text-text [&:hover]:bg-surface ${l?"px-2.5":"ps-2 pe-1.5"}`,"aria-expanded":o.open,"aria-haspopup":"dialog","aria-controls":a,onClick:p,children:[f.jsx(VO,{size:l?13:14,className:"text-muted"}),e.length===1?Wae():Zse({count:Wt(e.length)})]}),t&&f.jsx("button",{type:"button",className:"inline-flex items-center justify-center self-stretch w-6.5 text-muted border-s border-border [&:hover]:bg-surface [&:hover]:text-text",title:vE(),"aria-label":vE(),onClick:t,children:f.jsx(qr,{size:13})})]}),o.open&&f.jsx("div",{id:a,ref:i,tabIndex:-1,className:`annotation-menu absolute bottom-[calc(100%_+_8px)] z-50 w-[min(440px,_calc(100vw_-_48px))] max-h-80 overflow-y-auto overscroll-contain bg-background border border-border rounded-lg shadow-popover p-2 text-start ${l?"end-0 after:absolute after:top-full after:start-0 after:end-0 after:h-2 after:content-['']":"start-3"}`,role:"dialog","aria-label":jde(),children:f.jsx(yCt,{annotations:e,onRemove:r?m:void 0})})]})}function xCt(e){return f.jsx(gk,{...e,variant:"composer"})}const wCt=["prompt-collapsed text-muted text-base font-[375] my-3.5 mx-0 [&_summary]:flex","[&_summary]:items-center [&_summary]:gap-2 [&_summary]:cursor-pointer","[&_summary]:list-none [&_summary]:select-none [&_summary::-webkit-details-marker]:hidden","[&_summary::after]:content-['›'] [&_summary::after]:text-muted","[&_summary::after]:transition-transform [&_summary::after]:duration-80 [&_summary::after]:ease-standard [&[open]_summary::after]:rotate-90"].join(" "),vA=["prompt-collapsed-body mt-1.5 ps-3 border-s-2 border-s-border","text-sm text-subtext"].join(" "),SCt=["prompt-collapsed plan-resolved text-subtext my-3.5 mx-0","[&_summary]:flex [&_summary]:items-center [&_summary]:gap-2 [&_summary]:w-fit [&_summary]:max-w-full","[&_summary]:py-[3px] [&_summary]:px-1 [&_summary]:cursor-pointer [&_summary]:rounded-sm","[&_summary]:list-none [&_summary]:select-none [&_summary:hover]:bg-surface","[&_summary::-webkit-details-marker]:hidden","[&_summary_.plan-chevron]:transition-transform [&_summary_.plan-chevron]:duration-120","[&_summary_.plan-chevron]:ease-standard [&[open]_summary_.plan-chevron]:rotate-90"].join(" "),kCt=["prompt-head text-sm font-medium text-text","[&_code]:font-mono [&_code]:text-sm [&_code]:text-text"].join(" "),s5="prompt-actions flex flex-wrap gap-2",bA=[],CCt=[],b0={};function nd(e){const n=e.replace(/\/+$/,"");return n.slice(n.lastIndexOf("/")+1)||n}function Rw(e){var t;const n=e.replace(/\\/g,"/").replace(/\/+$/,"").split("/").filter(Boolean);return((t=n.at(-1))==null?void 0:t.toLowerCase())!=="skill.md"?null:n.at(-2)??null}function ECt(e,n){return/^orx-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(n)?e==="Skill"?`.claude/skills/${n}/SKILL.md`:e==="skill"?`.opencode/skills/${n}/SKILL.md`:null:null}function Gs(e,...n){for(const t of n){const r=e[t];if(typeof r=="string"&&r)return r}return null}function Mw(e,n,t){const r=e[n];if(!Array.isArray(r))return null;for(const s of r){if(!s||typeof s!="object"||!(t in s))continue;const i=s[t];if(typeof i=="string"&&i)return i}return null}function Dw(e,n){const t=e[n];if(!Array.isArray(t))return[];const r=[];for(let s=0;s=vu));s++);return r}function NCt(e,n){const t=e[n];if(!Array.isArray(t))return null;const r=[];for(const s of t){if(typeof s!="string")return null;r.push(s)}return r}function hh(...e){const n=new Set,t=new RegExp(`^${Nd}$`,"i");let r=0;for(const s of e)for(const i of s){if(n.size>=vu||r++>=oF)return[...n];t.test(i)&&n.add(i.toLowerCase())}return[...n]}function Jb(e){return e.replace(/^Exit code \d+\s*/i,"").split(` +`).trim();if(!d)return null;const p=fCt(t,e),m=Array.from(t.getClientRects()).filter(z=>z.width>0&&z.height>0),x=m[0]??t.getBoundingClientRect(),S=m.filter(z=>z.topx.top),v=S.length>0?S:[x],b=Math.min(...v.map(z=>z.left)),w=Math.max(...v.map(z=>z.right)),y=Math.min(...v.map(z=>z.top)),C=Math.max(...v.map(z=>z.bottom)),E=34,N=74,T=y>=E+Tw?y-E-Tw:C+Tw;return{text:_Ct(p,d),range:t.cloneRange(),x:Math.min(window.innerWidth-N,Math.max(N,b+(w-b)/2)),top:T}}function gCt(e,n){const[t,r]=R.useState(null),s=R.useRef(!1),i=R.useCallback(()=>{const l=e.current;r(l?mCt(l):null)},[e]);R.useEffect(()=>{let l=null;const u=()=>{s.current||i()},_=p=>{const m=e.current,x=p.target;!p.isPrimary||p.button!==0||!m||!(x instanceof Node)||!m.contains(x)||(s.current=!0,r(null))},d=p=>{!p.isPrimary||!s.current||(s.current=!1,l=window.requestAnimationFrame(i))};return document.addEventListener("selectionchange",u),document.addEventListener("pointerdown",_,!0),window.addEventListener("pointerup",d,!0),window.addEventListener("pointercancel",d,!0),()=>{document.removeEventListener("selectionchange",u),document.removeEventListener("pointerdown",_,!0),window.removeEventListener("pointerup",d,!0),window.removeEventListener("pointercancel",d,!0),l!==null&&window.cancelAnimationFrame(l),s.current=!1}},[i]),R.useEffect(()=>{if(!t)return;const l=u=>{const _=u.target;_ instanceof Element&&_.closest(".chat-selection-action")||r(null)};return document.addEventListener("mousedown",l,!0),window.addEventListener("resize",i),()=>{document.removeEventListener("mousedown",l,!0),window.removeEventListener("resize",i)}},[t,i]);const a=R.useCallback(()=>{var l;t&&(n({text:t.text,range:t.range}),r(null),(l=window.getSelection())==null||l.removeAllRanges())},[t,n]),o=R.useCallback(()=>r(null),[]);return{action:t,add:a,dismiss:o}}function vCt(e){R.useLayoutEffect(()=>{if(!("highlights"in CSS)||typeof Highlight>"u")return;const n=e.flatMap(r=>r.range?[r.range]:[]);if(n.length===0){CSS.highlights.delete(r1);return}const t=new Highlight(...n);return CSS.highlights.set(r1,t),()=>{CSS.highlights.get(r1)===t&&CSS.highlights.delete(r1)}},[e])}function bCt({annotation:e}){const n=R.useRef(null),[t,r]=R.useState();return R.useLayoutEffect(()=>{var i;const s=(i=n.current)==null?void 0:i.closest(".chat-thread-inner");r(s?pCt(e.text,s):void 0)},[e.id,e.text]),f.jsx("div",{ref:n,children:f.jsx($o,{text:t??e.text})})}function yCt({annotations:e,onRemove:n}){return e.map((t,r)=>f.jsxs("div",{className:`annotation-item grid gap-2 py-2 px-1 [&+&]:border-t [&+&]:border-border-variant ${n?"grid-cols-[24px_minmax(0,_1fr)_28px]":"grid-cols-[24px_minmax(0,_1fr)]"}`,children:[f.jsxs("span",{className:"text-sm text-muted text-end",children:[r+1,"."]}),f.jsxs("div",{className:"min-w-0",children:[f.jsx("div",{className:"text-sm text-muted mb-1",children:Mde()}),f.jsx(bCt,{annotation:t})]}),n&&f.jsx(Yt,{type:"button",size:"small","data-annotation-remove":!0,title:ade(),"aria-label":YQ({number:Wt(r+1)}),onClick:()=>n(t.id),children:f.jsx(qr,{size:13})})]},t.id))}function gk({annotations:e,variant:n,onClear:t,onRemove:r}){const s=R.useRef(null),i=R.useRef(null),a=R.useId(),o=to(s),l=n==="sent",u=R.useRef(null),_=()=>{u.current!==null&&window.clearTimeout(u.current),u.current=null,o.setOpen(!0)},d=()=>{u.current=window.setTimeout(()=>{var x;(x=i.current)!=null&&x.contains(document.activeElement)||o.setOpen(!1)},160)},p=()=>{const x=l||!o.open;o.setOpen(x),x&&window.requestAnimationFrame(()=>{var S;return(S=i.current)==null?void 0:S.focus()})},m=x=>{r==null||r(x),window.requestAnimationFrame(()=>{var v,b;(b=((v=i.current)==null?void 0:v.querySelector("button[data-annotation-remove]"))??i.current??s.current)==null||b.focus()})};return R.useEffect(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]),f.jsxs("div",{className:l?"sent-annotations relative flex w-fit":"composer-annotations relative flex w-fit pt-2 px-3 pb-0",ref:o.ref,onMouseEnter:l?_:void 0,onMouseLeave:l?d:void 0,children:[f.jsxs("div",{className:`inline-flex items-center border border-border bg-background overflow-hidden ${l?"rounded-full":"rounded-sm"}`,children:[f.jsxs("button",{ref:s,type:"button",className:`inline-flex items-center gap-1.5 py-1 text-sm font-medium text-text [&:hover]:bg-surface ${l?"px-2.5":"ps-2 pe-1.5"}`,"aria-expanded":o.open,"aria-haspopup":"dialog","aria-controls":a,onClick:p,children:[f.jsx(VO,{size:l?13:14,className:"text-muted"}),e.length===1?Wae():Zse({count:Wt(e.length)})]}),t&&f.jsx("button",{type:"button",className:"inline-flex items-center justify-center self-stretch w-6.5 text-muted border-s border-border [&:hover]:bg-surface [&:hover]:text-text",title:vE(),"aria-label":vE(),onClick:t,children:f.jsx(qr,{size:13})})]}),o.open&&f.jsx("div",{id:a,ref:i,tabIndex:-1,className:`annotation-menu absolute bottom-[calc(100%_+_8px)] z-50 w-[min(440px,_calc(100vw_-_48px))] max-h-80 overflow-y-auto overscroll-contain bg-background border border-border rounded-lg shadow-popover p-2 text-start ${l?"end-0 after:absolute after:top-full after:start-0 after:end-0 after:h-2 after:content-['']":"start-3"}`,role:"dialog","aria-label":jde(),children:f.jsx(yCt,{annotations:e,onRemove:r?m:void 0})})]})}function xCt(e){return f.jsx(gk,{...e,variant:"composer"})}const wCt=["prompt-collapsed text-muted text-base font-[375] my-3.5 mx-0 [&_summary]:flex","[&_summary]:items-center [&_summary]:gap-2 [&_summary]:cursor-pointer","[&_summary]:list-none [&_summary]:select-none [&_summary::-webkit-details-marker]:hidden","[&_summary::after]:content-['›'] [&_summary::after]:text-muted","[&_summary::after]:transition-transform [&_summary::after]:duration-80 [&_summary::after]:ease-standard [&[open]_summary::after]:rotate-90"].join(" "),vA=["prompt-collapsed-body mt-1.5 ps-3 border-s-2 border-s-border","text-sm text-subtext"].join(" "),SCt=["prompt-collapsed plan-resolved text-subtext my-3.5 mx-0","[&_summary]:flex [&_summary]:items-center [&_summary]:gap-2 [&_summary]:w-fit [&_summary]:max-w-full","[&_summary]:py-[3px] [&_summary]:px-1 [&_summary]:cursor-pointer [&_summary]:rounded-sm","[&_summary]:list-none [&_summary]:select-none [&_summary:hover]:bg-surface","[&_summary::-webkit-details-marker]:hidden","[&_summary_.plan-chevron]:transition-transform [&_summary_.plan-chevron]:duration-120","[&_summary_.plan-chevron]:ease-standard [&[open]_summary_.plan-chevron]:rotate-90"].join(" "),kCt=["prompt-head text-sm font-medium text-text","[&_code]:font-mono [&_code]:text-sm [&_code]:text-text"].join(" "),s5="prompt-actions flex flex-wrap gap-2",bA=[],CCt=[],b0={};function Zu(e){const n=e.replace(/\/+$/,"");return n.slice(n.lastIndexOf("/")+1)||n}function Rw(e){var t;const n=e.replace(/\\/g,"/").replace(/\/+$/,"").split("/").filter(Boolean);return((t=n.at(-1))==null?void 0:t.toLowerCase())!=="skill.md"?null:n.at(-2)??null}function ECt(e,n){return/^orx-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(n)?e==="Skill"?`.claude/skills/${n}/SKILL.md`:e==="skill"?`.opencode/skills/${n}/SKILL.md`:null:null}function Ls(e,...n){for(const t of n){const r=e[t];if(typeof r=="string"&&r)return r}return null}function Mw(e,n,t){const r=e[n];if(!Array.isArray(r))return null;for(const s of r){if(!s||typeof s!="object"||!(t in s))continue;const i=s[t];if(typeof i=="string"&&i)return i}return null}function Dw(e,n){const t=e[n];if(!Array.isArray(t))return[];const r=[];for(let s=0;s=cu));s++);return r}function NCt(e,n){const t=e[n];if(!Array.isArray(t))return null;const r=[];for(const s of t){if(typeof s!="string")return null;r.push(s)}return r}function ch(...e){const n=new Set,t=new RegExp(`^${Sd}$`,"i");let r=0;for(const s of e)for(const i of s){if(n.size>=cu||r++>=oF)return[...n];t.test(i)&&n.add(i.toLowerCase())}return[...n]}function Zb(e){return e.replace(/^Exit code \d+\s*/i,"").split(` `).filter(n=>!/^\s*\[orx-(?:run|experiment):[^\]]+\]\s*$/.test(n)).join(` `).trim()}function zCt(e){const n=e.changes;if(!Array.isArray(n))return null;for(const t of n){if(!t||typeof t!="object"||!("path"in t)||typeof t.path!="string")continue;const r="kind"in t?t.kind:null,s=r&&typeof r=="object"&&"type"in r&&typeof r.type=="string"?r.type:null;return{path:t.path,type:s}}return null}function jCt(e){const n=e.trim(),t=n.match(/^\/bin\/(?:ba|z)?sh\s+-lc\s+([\s\S]+)$/);let r=((t==null?void 0:t[1])??n).trim();return r=r2t(r),uF(r)}function uF(e){return ACt(e).replace(/[\t\r ]+/g," ").trim()}function TCt(e){let n=null,t=!1;for(let r=0;r!i.startsWith("-")&&i.includes(":"));if(!n)return null;const t=n.indexOf(":"),r=n.slice(0,t),s=n.slice(t+1);return r&&fF(s)?{ref:r,path:s}:null}function DCt(e){const n=e.match(/\b(?:rg|grep)\b(?:\s+-[^\s]+)*\s+(?:"([^"]+)"|'([^']+)'|([^\s]+))/);return(n==null?void 0:n[1])??(n==null?void 0:n[2])??(n==null?void 0:n[3])??null}function yA(e,n){if(/[$`~]/.test(e)||/[$`~]/.test(n))return null;const t=n.startsWith("/")||!n.startsWith("/")&&e.startsWith("/"),r=n.startsWith("/")?[]:e.split("/").filter(Boolean);for(const i of n.split("/"))if(!(!i||i===".")){if(i===".."){r.length>0&&r[r.length-1]!==".."?r.pop():t||r.push(i);continue}r.push(i)}return`${t?"/":""}${r.join("/")}`||(t?"/":null)}function LCt(e,n,t,r){if(e.startsWith("/"))return e;let s=r??"";for(let i=0;i!u.startsWith("-"));if(!o)return null;const l=yA(s,o);if(!l)return null;s=l}return s?yA(s,e):e}const So="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",OCt=new RegExp(`\\bchat_(${So})\\b`,"gi"),Nd=`(?:${So}|[0-9a-f]{8})`;function _h(e){const n=[];let t="",r="",s=null,i=!1;const a=()=>{(t.trim()||r.trim())&&n.push({raw:t.trim(),code:r.trim()}),t="",r=""},o=u=>{let _=1,d=null,p=!1;for(let m=u;m{let _=!1;for(let d=u;da2t(t.raw,n))}function ya(e,n){return ey(e,n).length>0}function ICt(e){if(!e)return[];const n=new Set;for(const t of e.slice(0,lF).matchAll(OCt))if(n.add(t[0].toLowerCase()),n.size>=vu)break;return[...n]}function i5(e,n){if(!e)return[];const t=new Set,r=e.slice(0,lF),s=n==="runs"?[new RegExp(`/runs/(${So})`,"gi"),new RegExp(`\\brun(?:_|\\s+)id:\\s*(${So})`,"gi"),new RegExp(`^\\s*RUN\\s+(${So})\\b`,"gim"),new RegExp(`={3,}\\s*(${So})\\s*={3,}`,"gi")]:[new RegExp(`/experiments/(${So})`,"gi"),new RegExp(`^\\s*id:\\s*(${So})`,"gim"),new RegExp(`={3,}\\s*(${So})\\s*={3,}`,"gi")];for(const a of s)for(const o of r.matchAll(a))if(t.add(o[1]),t.size>=vu)return[...t];const i=new RegExp(`^\\s*(${So})(?:\\s|$)`,"gim");for(const a of r.matchAll(i))if(t.add(a[1]),t.size>=vu)break;return[...t]}function _F(e,n){let t=0;return n.map(r=>{const s=e.indexOf(r.raw,t),i=s===-1?e.indexOf(r.raw):s;return t=Math.max(t,i+r.raw.length),{invocation:r,offset:Math.max(0,i)}})}function pF(e,n,t,r){const s=new RegExp(`(?:^|[\\s;])(?:export\\s+)?${n}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s;]+))`,"gi");let i="";for(const a of e.matchAll(s)){if((a.index??0)>=t)break;i=a[1]??a[2]??a[3]??""}return[...i.matchAll(new RegExp(r,"gi"))].map(a=>a[0])}function mF(e,n,t,r){const s=new RegExp(`\\bfor\\s+${n}\\s+in\\s+([\\s\\S]*?)(?:;|\\n)\\s*do\\b`,"gi");let i="";for(const a of e.matchAll(s)){const o=a.index??0;if(o>=t)break;const l=o+a[0].length;l<=t&&/\bdone\b/.test(e.slice(l,t))||(i=a[1])}return/\$\(|`/.test(i)?[]:[...i.matchAll(new RegExp(r,"gi"))].map(a=>a[0])}function BCt(e,n,t=[],r=[]){const s=ey(e,"logs"),i=new Set;if(s.length===0){if(!ya(e,"logs"))return[];const o=t.length>0?[]:i5(n,"runs");for(const l of t.length>0?t:o.length>0?o:r)if(i.add(l),i.size>=vu)break;return hh([...i])}let a=!1;for(const{invocation:o,offset:l}of _F(e,s)){const u=Wh(o.raw);if((u==null?void 0:u[0])!=="logs")continue;const _=u.slice(1);let d=null;for(let v=0;v<_.length;v++){const b=_[v];if(b!=="--head"){if(b==="--bytes"||b==="--range"){v++;continue}if(!(b.startsWith("--bytes=")||b.startsWith("--range="))){d=b;break}}}if(!d){a=!0;continue}if(new RegExp(`^${Nd}$`,"i").test(d)){i.add(d);continue}const p=/^\$\{?([A-Za-z_][A-Za-z0-9_]*)\}?$/.exec(d);if(!p){a=!0;continue}const m=p[1],x=pF(e,m,l,Nd);for(const v of x)i.add(v);const S=mF(e,m,l,Nd);for(const v of S)i.add(v);x.length===0&&S.length===0&&(a=!0)}if(i.size===0||a){const o=t.length>0?[]:i5(n,"runs"),l=t.length>0?t:o.length>0?o:r;for(const u of l)if(i.add(u),i.size>=vu)break}return hh([...i])}function Vf(e,n,t=[],r=[]){const s=ey(e,"exp\\s+(?:status|desc)");if(s.length===0)return[];const i=new Set;let a=!1;for(const{invocation:o,offset:l}of _F(e,s)){const u=Wh(o.raw),_=(u==null?void 0:u[0])==="exp"&&(u[1]==="status"||u[1]==="desc")?u[2]:null;let d=!1;_&&new RegExp(`^${Nd}$`,"i").test(_)&&(i.add(_),d=!0);const p=_?/^\$\{?([A-Za-z_][A-Za-z0-9_]*)\}?$/.exec(_):null;if(p){const m=p[1],x=pF(e,m,l,Nd);if(x.length>0){for(const v of x)i.add(v);d=!0}const S=mF(e,m,l,Nd);for(const v of S)i.add(v);S.length>0&&(d=!0)}d||(a=!0)}if(i.size===0||a){const o=t.length>0?[]:i5(n,"experiments"),l=t.length>0?t:o.length>0?o:r;for(const u of l)if(i.add(u),i.size>=vu)break}return hh([...i])}const xA=new WeakMap;function $d(e){const n=j(),t=xA.get(e);if((t==null?void 0:t.locale)===n)return t.activity;const r=$Ct(e);return xA.set(e,{locale:n,activity:r}),r}function $Ct(e){var b,w,y,C;const n=e.tool??"tool",t=((b=e.state)==null?void 0:b.input)??{},r=t.arguments,s=r&&typeof r=="object"&&!Array.isArray(r)?Object.fromEntries(Object.entries(r)):{},i={...t,...s},a=Gs(i,"command","cmd"),o=NCt(i,"commandArgv"),l=((w=e.state)==null?void 0:w.output)||((y=e.state)==null?void 0:y.error),u=hh(Dw(i,"targetIds")),_=hh(Dw(i,"runTargetIds")),d=hh(Dw(i,"experimentTargetIds")),p=Gs(i,"filePath","file_path","notebookPath","notebook_path","path"),m=Gs(i,"description"),x=n.toLowerCase().split(/(?::|\.|__)+/),S=x.at(-1)??n.toLowerCase();if(S==="run"&&x.includes("web")){const E=Mw(i,"search_query","q"),N=Mw(i,"image_query","q"),T=Mw(i,"find","pattern");return E?{kind:"web",label:nE({query:E})}:N?{kind:"web",label:FJ({query:N})}:T?{kind:"web",label:iee({pattern:T})}:Array.isArray(i.open)?{kind:"web",label:iue()}:Array.isArray(i.weather)?{kind:"web",label:zle()}:Array.isArray(i.finance)?{kind:"web",label:yle()}:Array.isArray(i.sports)?{kind:"web",label:kle()}:Array.isArray(i.time)?{kind:"web",label:mle()}:{kind:"web",label:mE()}}switch(new Map([["read_file","read"],["write_file","write"],["edit_file","edit"],["exec","bash"],["exec_command","bash"],["run_command","bash"],["agent","task"],["collabagenttoolcall","subagent"],["subagentactivity","subagent"]]).get(S)??S){case"bash":{if(!a&&!(o!=null&&o.length))return{kind:"command",label:Rue()};const E=jCt(a??(o==null?void 0:o.join(" "))??""),N=_h(E);let T=N.map(oe=>oe.raw);if(o!=null&&o.length){const oe=i2t(o);T=oe===null?[o]:_h(uF(oe)).map(ne=>ne.raw)}let z=null;for(const oe of T)if(z=o2t(oe),z)break;const M=T.some(oe=>{const ne=Wh(oe);return ne!==null&&ne[0]!=="discover"&&ne[0]!=="paper"});if(z&&!M){const oe=z.kind==="discover"?{keyword:SJ(),embedding:NJ(),openalex:ZJ(),biorxiv:AJ()}[z.strategy]:null,ne=z.kind==="discover"?z.query?DX({activity:oe??tE(),query:z.query}):oe??tE():z.id?l0({target:Ne(z.id)}):kZ();return{kind:z.kind==="paper"?"read":"search",label:ne,litCall:z}}if(ya(E,"agent\\s+spawn"))return{kind:"agent",label:Wle(),spawnedSessionIds:ICt(l),litCall:z??void 0};const O=N.map(oe=>hF(oe.raw)),B=ya(E,"exp\\s+status"),$=ya(E,"exp\\s+desc"),U=ey(E,"exp\\s+desc").some(oe=>(Wh(oe.raw)??[]).some(Q=>Q==="--set"||Q.startsWith("--set=")||Q==="--stdin")),H=U?Mee():yZ(),Y=U?UY():sJ();if(ya(E,"logs")){const oe=BCt(E,l,_,u);return{kind:"project",label:oe.length===1?YZ():eJ(),runIds:oe,litCall:z??void 0}}if(ya(E,"exp\\s+run"))return{kind:"project",label:Yde(),litCall:z??void 0};if(ya(E,"exp\\s+wait"))return{kind:"project",label:Efe(),litCall:z??void 0};if(ya(E,"exp\\s+cancel"))return{kind:"project",label:Xoe(),litCall:z??void 0};const V=ya(E,"project\\s+view");if(V&&B&&$)return{kind:"project",label:Y,experimentIds:Vf(E,l,d,u),litCall:z??void 0};if(V&&$)return{kind:"project",label:H,experimentIds:Vf(E,l,d,u),litCall:z??void 0};if(V&&B)return{kind:"project",label:gE(),experimentIds:Vf(E,l,d,u),litCall:z??void 0};if(V)return{kind:"project",label:Kue(),litCall:z??void 0};if(B&&$)return{kind:"project",label:Y,experimentIds:Vf(E,l,d,u),litCall:z??void 0};if(B)return{kind:"project",label:gE(),experimentIds:Vf(E,l,d,u),litCall:z??void 0};if($)return{kind:"project",label:H,experimentIds:Vf(E,l,d,u),litCall:z??void 0};if(ya(E,"runs?"))return{kind:"project",label:Oce(),litCall:z??void 0};if(ya(E,"projects"))return{kind:"project",label:Pce(),litCall:z??void 0};if(ya(E,"compute"))return{kind:"project",label:ile(),litCall:z??void 0};const X=O.map(MCt).find(oe=>oe!=null);if(X){const oe=Rw(X.path);return{kind:oe?"skill":"read",label:oe?gx({name:Ne(oe)}):l0({target:Ne(nd(X.path))}),filePath:X.path,fileRef:X.ref,labelTarget:oe?`${oe} skill`:nd(X.path)}}const te=O.findIndex(oe=>oe!=null&&["sed","cat","head","tail"].includes(oe.name)),I=te>=0?O[te]:null,L=I?RCt(I):null,F=L?LCt(L,N,te,Gs(i,"cwd","workdir")):null;if(L&&F){const oe=Rw(F);return{kind:oe?"skill":"read",label:oe?gx({name:Ne(oe)}):l0({target:Ne(nd(L))}),filePath:F,labelTarget:oe?`${oe} skill`:nd(L)}}if(O.some(oe=>(oe==null?void 0:oe.name)==="find"||(oe==null?void 0:oe.name)==="ls"||(oe==null?void 0:oe.name)==="rg"&&oe.args.includes("--files")))return{kind:"search",label:kE()};const q=O.findIndex(oe=>(oe==null?void 0:oe.name)==="rg"||(oe==null?void 0:oe.name)==="grep");if(q>=0){const oe=DCt(N[q].raw);return{kind:"search",label:oe?bx({pattern:Ne(oe)}):vx(),searchPattern:oe??void 0}}const G=O.find(oe=>(oe==null?void 0:oe.name)==="git"),ee=G==null?void 0:G.args[0];if(ee==="grep"){const oe=G==null?void 0:G.args.slice(1).find(ne=>!ne.startsWith("-"));return{kind:"search",label:oe?bx({pattern:Ne(oe)}):vx(),searchPattern:oe}}if(ee==="status")return{kind:"command",label:fle()};if(ee==="diff")return{kind:"command",label:wde()};if(ee==="log")return{kind:"command",label:Uue()};const ce=oe=>O.some(ne=>!ne||!["cargo","pnpm","npm","yarn"].includes(ne.name)?!1:ne.args[0]===oe||ne.args[0]==="run"&&ne.args[1]===oe);return ce("test")?{kind:"command",label:Oue()}:O.some(oe=>(oe==null?void 0:oe.name)==="tsc")||ce("typecheck")?{kind:"command",label:Rle()}:ce("lint")?{kind:"command",label:tle()}:ce("build")?{kind:"command",label:qoe()}:{kind:"command",label:lZ({command:Ne(E)})}}case"skill":{const E=Gs(i,"skill","name"),N=E?ECt(n,E):null;return{kind:"skill",label:E?YX({name:Ne(E)}):WX(),filePath:N??void 0,labelTarget:N&&E?`${E} skill`:void 0}}case"read":{const E=p?nd(p):null,N=p?Rw(p):null;return N?{kind:"skill",label:gx({name:Ne(N)}),filePath:p??void 0,labelTarget:`${N} skill`}:E?{kind:"read",label:l0({target:Ne(E)}),filePath:p??void 0,labelTarget:E}:{kind:"read",label:Pue()}}case"edit":case"write":case"notebookedit":{const E=zCt(i),N=p??(E==null?void 0:E.path)??null,T=N?nd(N):null,z=T?(E==null?void 0:E.type)==="add"?aX({target:Ne(T)}):(E==null?void 0:E.type)==="delete"?vX({target:Ne(T)}):EX({target:Ne(T)}):null;return T?{kind:"edit",label:z??yE(),filePath:N??void 0,labelTarget:T}:{kind:"edit",label:yE()}}case"grep":{const E=Gs(i,"pattern");return{kind:"search",label:E?bx({pattern:Ne(E)}):vx(),searchPattern:E??void 0}}case"glob":{const E=Gs(i,"pattern");return{kind:"search",label:E?BX({pattern:Ne(E)}):kE()}}case"websearch":{const E=Gs(i,"query"),N=Gs(i,"url"),T=Gs(i,"pattern");return E?{kind:"web",label:nE({query:E})}:T&&N?{kind:"web",label:KJ({pattern:T})}:N?{kind:"web",label:sZ({target:Ne(N)})}:{kind:"web",label:m??mE()}}case"webfetch":{const E=Gs(i,"url");return{kind:"web",label:E?l0({target:Ne(E)}):m??DZ()}}case"task":return{kind:"agent",label:m??fZ()};case"subagent":return{kind:"agent",label:PCt(i)};case"error":return{kind:"command",label:pfe()};case"contextcompaction":return{kind:"command",label:ZY(),progressLabel:nX()};default:{const E=m??p??a??((C=e.state)==null?void 0:C.title)??"";return{kind:"command",label:E?`${n}: ${E}`:n}}}}function PCt(e){const n=typeof e.nickname=="string"&&e.nickname?e.nickname.replace(/[_-]+/g," "):"",t=n&&n.charAt(0).toUpperCase()+n.slice(1);if(t)return t;switch(typeof e.tool=="string"?e.tool:""){case"spawnAgent":return gee();case"sendInput":return hee();case"resumeAgent":return HZ();case"wait":return Iee();case"closeAgent":return KY()}switch(typeof e.kind=="string"?e.kind:""){case"started":return jee();case"interacted":return RY();case"interrupted":return Cee()}return xee()}function Tv({activity:e,className:n=""}){const t={size:16,strokeWidth:1.75,className:"tool-kind-icon"};let r=f.jsx(c_,{...t});if(e.litCall)r=f.jsx(SB,{source:e.litCall.source,size:16,className:"tool-kind-icon"});else switch(e.kind){case"skill":r=f.jsx(LO,{...t});break;case"read":case"project":r=f.jsx(OO,{...t});break;case"search":r=f.jsx(YO,{...t});break;case"edit":r=f.jsx(D6,{...t});break;case"web":r=f.jsx(Opt,{...t});break;case"agent":r=f.jsx(I6,{...t});break}return f.jsx("span",{className:`flex h-6 shrink-0 items-center ${n}`,children:r})}function Lw({items:e,onOpen:n,onSelect:t,targetType:r}){const[s,i]=R.useState(!1),a=R.useRef(null),o=R.useRef(!1);return R.useEffect(()=>{var l,u;!s||!o.current||(o.current=!1,(u=(l=a.current)==null?void 0:l.querySelector("button"))==null||u.focus())},[s]),f.jsxs("span",{className:"tool-target-overflow inline",children:[s&&f.jsx("span",{className:"tool-target-reveal",ref:a,children:e.map((l,u)=>f.jsxs("span",{children:[u>0&&", ",n||t?f.jsx("button",{className:"tool-target",...n?Ur(_=>n(l.id,_),{stopPropagation:!0}):{onClick:_=>{_.stopPropagation(),t==null||t(l.id)}},children:l.label}):f.jsx("span",{children:l.label})]},l.id))}),s&&", ",f.jsx("button",{className:"tool-target-more","aria-expanded":s,"aria-label":s?eQ({target:r}):yY({count:Wt(e.length),target:r}),onClick:l=>{l.preventDefault(),l.stopPropagation(),o.current=!s&&l.detail===0,i(u=>!u)},children:s?zD():ope({count:Wt(e.length)})})]})}function a5({activity:e,onOpenFile:n,onOpenRun:t,onOpenSpawnedSession:r,runExperimentName:s,onOpenExperiment:i,experimentName:a}){var o,l,u,_;if(e.searchPattern)return e.label;if(((o=e.litCall)==null?void 0:o.kind)==="paper"&&e.litCall.id)return f.jsxs("a",{className:"tool-target",href:h2t(e.litCall.source,e.litCall.id),target:"_blank",rel:"noopener noreferrer",children:[e.label,f.jsx(H0t,{className:"inline ms-1 opacity-50",size:13,"aria-hidden":"true"})]});if(e.filePath&&e.labelTarget&&n){const d=e.filePath;return f.jsx("span",{className:"tool-target",role:"button",tabIndex:0,...Ur(p=>n(d,void 0,void 0,e.fileRef,p),{stopPropagation:!0}),children:e.label})}if((l=e.spawnedSessionIds)!=null&&l.length&&r){const d=e.spawnedSessionIds,p=d.slice(0,3),m=d.slice(p.length).map((x,S)=>({id:x,label:uE({number:Wt(p.length+S+1)})}));return f.jsxs(f.Fragment,{children:[e.label," — ",p.map((x,S)=>f.jsxs("span",{children:[S>0&&", ",f.jsx("button",{className:"tool-target",title:tue(),onClick:v=>{v.preventDefault(),v.stopPropagation(),r(x)},children:uE({number:Wt(S+1)})})]},x)),m.length>0&&f.jsxs(f.Fragment,{children:[", ",f.jsx(Lw,{items:m,onSelect:r,targetType:Gse()})]})]})}if((u=e.runIds)!=null&&u.length){const d=s?e.runIds.filter(x=>!!s(x)):e.runIds;if(d.length===0)return e.label;const p=d.slice(0,3),m=d.slice(p.length).map(x=>({id:x,label:(s==null?void 0:s(x))||Cl()}));return f.jsxs(f.Fragment,{children:[e.label," — ",p.map((x,S)=>f.jsxs("span",{children:[S>0&&", ",t?f.jsx("button",{className:"tool-target",title:AQ({run:Ne(x)}),...Ur(v=>t(x,v),{stopPropagation:!0}),children:(s==null?void 0:s(x))||Cl()}):f.jsx("span",{children:(s==null?void 0:s(x))||Cl()})]},x)),m.length>0&&f.jsxs(f.Fragment,{children:[", ",f.jsx(Lw,{items:m,onOpen:t,targetType:Ihe()})]})]})}if((_=e.experimentIds)!=null&&_.length){const d=a?e.experimentIds.filter(x=>!!a(x)):e.experimentIds;if(d.length===0)return e.label;const p=d.slice(0,3),m=d.slice(p.length).map(x=>({id:x,label:(a==null?void 0:a(x))||Cl()}));return f.jsxs(f.Fragment,{children:[e.label," — ",p.map((x,S)=>f.jsxs("span",{children:[S>0&&", ",i?f.jsx("button",{className:"tool-target",title:bQ({name:(a==null?void 0:a(x))||Ne(x)}),...Ur(v=>i(x,v),{stopPropagation:!0}),children:(a==null?void 0:a(x))||Cl()}):f.jsx("span",{children:(a==null?void 0:a(x))||Cl()})]},x)),m.length>0&&f.jsxs(f.Fragment,{children:[", ",f.jsx(Lw,{items:m,onOpen:i,targetType:oae()})]})]})}return e.label}function vk(e){const n=e.progressLabel??{skill:eZ(),read:BZ(),search:cee(),edit:TX(),project:lJ(),web:PY(),agent:_X(),command:_D()}[e.kind];return{...e,label:n}}function gF(e,n){const t=$d({id:"permission-preview",type:"tool",tool:e,state:{status:"running",input:n}});return{skill:HX(),read:mZ(),search:bJ(),edit:wX(),project:WZ(),web:OY(),agent:uX(),command:fJ()}[t.kind]}function FCt(e){return e==null?!0:typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0}const HCt=250;function qCt(e,n){const[t,r]=R.useState(e),s=R.useRef(Date.now()),i=R.useRef(e);return R.useEffect(()=>{if(i.current=e,(e==null?void 0:e.label)===(t==null?void 0:t.label)||n&&e!=null&&t!=null)return;if(e==null||t==null){s.current=Date.now(),r(e);return}const a=HCt-(Date.now()-s.current);if(a<=0){s.current=Date.now(),r(e);return}const o=window.setTimeout(()=>{s.current=Date.now(),r(i.current)},a);return()=>window.clearTimeout(o)},[e,t,n]),e!=null&&e.label===(t==null?void 0:t.label)?e:t}const UCt=160;function vF(e){const[n,t]=R.useState(!1);return R.useEffect(()=>{if(!e){t(!1);return}const r=window.setTimeout(()=>t(!0),UCt);return()=>window.clearTimeout(r)},[e]),e&&n}function GCt(e){const n=["skill","read","search","edit","project","web","command","agent"];for(const t of n){const r=e.find(s=>s.kind===t);if(r)return r}return e[0]??{kind:"command",label:wD()}}function WCt(e,n){var t,r;return((t=e.state)==null?void 0:t.status)!=="completed"?null:JSON.stringify([n.kind,n.label,n.filePath??null,n.fileRef??null,((r=n.litCall)==null?void 0:r.kind)==="paper"?n.litCall.id??null:null,n.runIds??null,n.experimentIds??null,n.spawnedSessionIds??null])}function VCt(e){const n=[];let t=null;for(const r of e){const s=$d(r),i=WCt(r,s),a=n[n.length-1];i&&a&&t===i?a.count++:n.push({part:r,activity:s,count:1}),t=i}return n}function bF({part:e,busy:n,recovering:t,onRecover:r,usageLimited:s=!1}){var x,S;const i=(x=e.state)==null?void 0:x.input,a=(i==null?void 0:i.nextRetryAt)??null,[o,l]=R.useState(Date.now());if(R.useEffect(()=>{if(typeof a!="number"||(l(Date.now()),a<=Date.now()))return;const v=window.setInterval(()=>{const b=Date.now();l(b),b>=a&&window.clearInterval(v)},1e3);return()=>window.clearInterval(v)},[a]),e.id==="turn-retry"){const v=Zyt(i??{},o);return f.jsxs("div",{className:"turn-retry-row flex items-center gap-2 py-1 px-1 text-sm text-subtext",children:[f.jsx(Lt,{}),f.jsx("span",{children:v})]})}const u=xB(i==null?void 0:i.recoveryAction),_=i==null?void 0:i.turnId,d=yB(e)?Sae():s?Vhe():IE(),p=s?Apt:O6,m=Jb(((S=e.state)==null?void 0:S.error)||IE());return f.jsxs("details",{className:"turn-usage-limit group/limit text-base text-subtext",children:[f.jsxs("summary",{className:"flex w-fit max-w-full items-center gap-2 cursor-pointer list-none rounded-sm focus-visible:outline-2 focus-visible:outline-text [&::-webkit-details-marker]:hidden",children:[f.jsx(p,{size:18,className:"shrink-0 text-accent-red","aria-hidden":"true"}),f.jsx("span",{children:d}),f.jsx(Ta,{size:16,className:"shrink-0 text-text transition-transform duration-120 ease-standard group-open/limit:rotate-90 motion-reduce:transition-none","aria-hidden":"true"})]}),f.jsx("pre",{className:"mt-2 rounded-md bg-surface p-2 text-sm font-mono whitespace-pre-wrap wrap-anywhere",children:m}),!s&&r&&_&&(u==="retry"||u==="continue")&&f.jsx(Oe,{type:"button",size:"small",className:"mt-2",disabled:n||t,onClick:()=>r(_,u),children:t?c_e():u==="retry"?Ui():Fie()})]})}function wA({part:e,activity:n,repeatCount:t=1,onOpenFile:r,onOpenRun:s,onOpenSpawnedSession:i,runExperimentName:a,onOpenExperiment:o,experimentName:l}){const u=e.state,_=(u==null?void 0:u.status)==="error",d=Jb((u==null?void 0:u.error)||(u==null?void 0:u.output)||""),p=_&&!!d,[m,x]=R.useState(!1),S=`tool-error-${e.id.replace(/[^A-Za-z0-9_-]/g,"-")}`;if(e.tool==="error")return f.jsx(bF,{part:e,busy:!1,recovering:!1,usageLimited:v3(e)});const v=f.jsxs(f.Fragment,{children:[_&&f.jsxs("span",{className:"sr-only",children:[J5()," "]}),_?f.jsx("span",{className:"flex h-6 shrink-0 items-center text-accent-red",children:f.jsx(PO,{size:16,strokeWidth:1.75,className:"tool-kind-icon","aria-hidden":"true"})}):f.jsx(Tv,{activity:n,className:"text-muted"}),f.jsxs("span",{className:`${aF} ${_?"text-accent-red":"text-subtext"}`,children:[f.jsx(a5,{activity:n,onOpenFile:r,onOpenRun:s,onOpenSpawnedSession:i,runExperimentName:a,onOpenExperiment:o,experimentName:l}),t>1&&f.jsxs("span",{className:"tool-repeat-count ms-1 text-muted font-normal",title:lQ({count:Wt(t)}),children:["×",t]})]})]});return p?f.jsxs("div",{className:"tool-row tool-row-error flex flex-col min-w-0",children:[f.jsxs("div",{className:"flex items-start gap-2 w-fit max-w-full py-[3px] px-1 min-w-0 rounded-sm",children:[v,f.jsx("button",{type:"button",className:"tool-row-detail-toggle inline-flex h-6 shrink-0 items-center justify-center p-0.5 rounded-sm cursor-pointer hover:bg-surface","aria-expanded":m,"aria-controls":S,"aria-label":m?sQ({activity:n.label}):mY({activity:n.label}),onClick:()=>x(b=>!b),children:f.jsx(Ta,{size:16,className:`text-accent-red transition-transform duration-120 ease-standard ${m?"rotate-90":""}`})})]}),m&&f.jsx("div",{className:"tool-detail mt-1 me-0 mb-1 ms-6",id:S,children:f.jsx("div",{className:mk,children:d.slice(0,2e4)})})]}):f.jsx("div",{className:"tool-row flex items-start gap-2 min-w-0 py-[3px] px-1",children:v})}function KCt({parts:e,pendingTail:n,onOpenFile:t,onOpenRun:r,onOpenSpawnedSession:s,runExperimentName:i,onOpenExperiment:a,experimentName:o}){var z,M,O,B;const[l,u]=R.useState(!1),[_,d]=R.useState(!1),p=()=>{d(!0),u($=>!$)},m=VCt(e),x=m.map(({activity:$})=>$),S=n?m.at(-1):void 0,v=S==null?void 0:S.part,b=S==null?void 0:S.activity,w=((z=v==null?void 0:v.state)==null?void 0:z.status)!=="error"?(b&&vk(b))??null:null,y=!!v&&((M=v.state)==null?void 0:M.status)==="running"&&!(w!=null&&w.progressLabel)&&(FCt((O=v.state)==null?void 0:O.input)||(w==null?void 0:w.kind)==="command"&&!Gs(((B=v.state)==null?void 0:B.input)??{},"command","cmd")),C=qCt(w,y),E=vF(C!=null),N=C??GCt(x),T=C?C.label:wD();return e.length===1?C?f.jsx("div",{className:"tool-group my-3.5 mx-0",children:f.jsxs("div",{className:"tool-row flex items-start gap-2 min-w-0 py-[3px] px-1 text-base leading-6 text-subtext",children:[f.jsx(Tv,{activity:C,className:E?"tool-running-shimmer-icon":"text-muted"}),f.jsx("span",{className:`${E?"tool-running-shimmer":""} min-w-0 line-clamp-2 break-words`,title:T,children:f.jsx(a5,{activity:C,onOpenFile:t,onOpenRun:r,onOpenSpawnedSession:s,runExperimentName:i,onOpenExperiment:a,experimentName:o})})]})}):f.jsx("div",{className:"tool-group my-3.5 mx-0",children:f.jsx(wA,{part:e[0],activity:m[0].activity,onOpenFile:t,onOpenRun:r,onOpenSpawnedSession:s,runExperimentName:i,onOpenExperiment:a,experimentName:o})}):f.jsxs("div",{className:"tool-group my-3.5 mx-0",children:[f.jsxs("div",{className:"tool-group-summary flex items-start gap-2 w-fit max-w-full py-[3px] px-1 text-base leading-6 text-subtext text-start",children:[f.jsx(Tv,{activity:N,className:E?"tool-running-shimmer-icon":"text-muted"}),C?f.jsx("span",{className:`tool-group-label min-w-0 line-clamp-2 break-words ${E?"tool-running-shimmer":""}`,title:T,children:f.jsx(a5,{activity:C,onOpenFile:t,onOpenRun:r,onOpenSpawnedSession:s,runExperimentName:i,onOpenExperiment:a,experimentName:o})}):f.jsx("button",{type:"button",className:"tool-group-label min-w-0 whitespace-normal break-words cursor-pointer text-start",onClick:p,"aria-expanded":l,children:T}),f.jsx("button",{type:"button",className:"tool-group-chevron-button inline-flex h-6 shrink-0 items-center justify-center p-px cursor-pointer rounded-sm",onClick:p,"aria-expanded":l,"aria-label":l?Iie():rae(),children:f.jsx(Ta,{size:16,className:`tool-chevron text-muted transition-[transform,color] duration-120 ease-standard [&.open]:rotate-90 ${l?"open":""}`})})]}),f.jsx("div",{className:`tool-group-disclosure ${l?"open":""}`,"aria-hidden":!l,inert:!l,children:f.jsx("div",{className:"tool-group-disclosure-inner",children:f.jsx("div",{className:"tool-group-rows flex flex-col gap-px mt-0.5 me-0 mb-1 ms-6",children:_&&m.map(({part:$,count:U,activity:H})=>f.jsx(wA,{part:$,repeatCount:U,activity:H,onOpenFile:t,onOpenRun:r,onOpenSpawnedSession:s,runExperimentName:i,onOpenExperiment:a,experimentName:o},$.id))})})})]})}function QCt({part:e,onRespond:n,onOpenFile:t,onOpenPlan:r}){var _;const s=e.prompt,[i,a]=R.useState([]),o=!n,l=d=>n==null?void 0:n({promptId:e.id,...d});if(s.resolved){if(s.kind==="permission")return null;if(s.kind==="plan"){const m=s.approved===!0?{label:hue(),icon:Na,iconClass:"text-accent-green"}:s.approved===!1&&s.note?{label:Cue(),icon:D6,iconClass:"text-accent-amber"}:s.approved===!1?{label:gue(),icon:qr,iconClass:"text-accent-red"}:{label:xue(),icon:ub,iconClass:"text-muted"},x=m.icon;return f.jsxs("details",{className:SCt,children:[f.jsxs("summary",{children:[f.jsx("span",{className:"plan-resolved-label text-base font-[375] wrap-anywhere",children:s.synthesized?SD():DE()}),f.jsx(x,{size:17,strokeWidth:1.8,className:`shrink-0 ${m.iconClass}`}),f.jsx("span",{className:"plan-resolved-label prompt-outcome text-base font-[375] wrap-anywhere",children:m.label}),f.jsx(Ta,{size:12,className:"plan-chevron shrink-0 text-muted"})]}),f.jsxs("div",{className:`${vA} ms-6`,children:[f.jsx($o,{text:s.plan??"",onOpenFile:t}),s.note&&f.jsx("div",{className:"prompt-collapsed-note mt-1.5 italic",children:s.note})]})]})}const d=(s.answers??[]).join(", ")||s.note||"",p=(s.annotations??[]).map((m,x)=>({id:`${e.id}-annotation-${x}`,text:m.text}));return f.jsxs("div",{className:"flex flex-col items-end gap-1.5",children:[p.length>0&&f.jsx(gk,{annotations:p,variant:"sent"}),f.jsxs("details",{className:wCt,children:[f.jsxs("summary",{children:[f.jsx("span",{className:"prompt-collapsed-title font-[375] wrap-anywhere",children:s.header||s.question||nhe()}),f.jsx("span",{className:`prompt-outcome font-[375] text-subtext wrap-anywhere [&.approved]:text-accent-green [&.chosen]:text-accent-green [&.approved::before]:content-['✓_'] [&.chosen::before]:content-['✓_'] [&.revised]:text-accent-amber [&.rejected]:text-accent-amber ${d?"chosen":""}`,children:d||jhe()})]}),f.jsxs("div",{className:vA,children:[s.header&&s.question&&f.jsx("div",{className:"prompt-q text-base font-semibold leading-normal text-text",children:s.question}),(s.options??[]).length>0&&f.jsx("ul",{className:"prompt-collapsed-options mt-1.5 mx-0 mb-0 ps-4.5 [&_.sel]:text-text [&_.sel]:font-medium",children:(s.options??[]).map(m=>{var x;return f.jsx("li",{className:(x=s.answers)!=null&&x.includes(m.label)?"sel":"",children:m.label},m.label)})}),s.note&&s.note!==d&&f.jsx("div",{className:"prompt-collapsed-note mt-1.5 italic",children:s.note})]})]})]})}if(s.kind==="plan"){const d=!!r;return f.jsxs("div",{className:`prompt-card my-2 mx-0 py-3 px-3.5 border border-border border-s-[3px] border-s-border rounded-sm bg-surface flex flex-col gap-[9px] [&.plan]:border-s-accent-blue [&.permission]:border-s-accent-amber [&.question]:border-s-accent-purple [&.readonly]:opacity-60 plan ${o?"readonly":""}`,children:[f.jsx("div",{className:"prompt-head text-base font-semibold text-text",children:s.synthesized?Qfe():DE()}),f.jsx("div",{className:`prompt-plan text-base leading-[1.6] text-text max-h-85 overflow-y-auto [&.clamped]:max-h-[9.5em] [&.clamped]:overflow-hidden [&.clamped]:relative [&.clamped::after]:content-[''] [&.clamped::after]:absolute [&.clamped::after]:inset-x-0 [&.clamped::after]:bottom-0 [&.clamped::after]:top-auto [&.clamped::after]:h-8.5 [&.clamped::after]:bg-[linear-gradient(to_bottom,_transparent,_var(--surface))] [&.clamped::after]:pointer-events-none ${d?"clamped":""}`,children:f.jsx($o,{text:s.plan??"",onOpenFile:t})}),d&&f.jsx("button",{className:"prompt-plan-open self-start border-0 bg-transparent text-accent-blue text-sm p-0 cursor-pointer [&:hover]:underline",...Ur(p=>r(s.plan??"",e.id,p)),children:wfe()}),!o&&!d&&f.jsxs("div",{className:s5,children:[f.jsx(Oe,{size:"small",variant:"primary",onClick:()=>l({approve:!0,resumeMode:"auto"}),children:roe()}),f.jsx(Oe,{size:"small",onClick:()=>l({approve:!0,resumeMode:"bypassPermissions"}),children:ooe()}),f.jsx(Oe,{size:"small",onClick:()=>l({approve:!1}),children:Zue()})]})]})}if(s.kind==="permission"){const d=s.toolInput??{},p=Gs(d,"command","cmd","filePath","file_path","path")||"",m=typeof((_=s.toolInput)==null?void 0:_.reason)=="string"&&s.toolInput.reason||"",x=Gs(d,"description")||"",S=m||x||gF(s.tool,d),v=`permission-heading-${e.id}`;return f.jsxs("div",{className:`prompt-card permission my-3 w-full max-w-2xl overflow-hidden rounded-md border border-border bg-background shadow-hairline [&.readonly]:opacity-60 ${o?"readonly":""}`,role:"group","aria-labelledby":v,children:[f.jsxs("div",{className:"flex items-center gap-2.5 px-3.5 pt-3 pb-0",children:[f.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-accent-amber-subtle text-accent-amber",children:f.jsx(O6,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),f.jsx("span",{id:v,className:"text-base font-semibold text-text",children:Soe()})]}),f.jsxs("div",{className:"flex flex-col gap-3 px-3.5 py-3",children:[f.jsx("div",{className:"prompt-sub text-base font-normal leading-normal text-text wrap-anywhere",children:S}),p&&f.jsx("code",{className:"prompt-command block max-h-36 overflow-auto whitespace-pre-wrap wrap-anywhere rounded-md border border-border-variant bg-surface px-3 py-2 font-mono text-sm leading-relaxed text-text",children:p}),!o&&f.jsxs("div",{className:"prompt-actions flex items-center justify-end gap-2 pt-0.5",children:[f.jsx(Oe,{size:"small",variant:"ghost",onClick:()=>l({approve:!1}),children:Jle()}),f.jsx(Oe,{size:"small",variant:"primary",onClick:()=>l({approve:!0}),children:boe()})]})]})]})}const u=d=>a(p=>s.multiSelect?p.includes(d)?p.filter(m=>m!==d):[...p,d]:[d]);return f.jsxs("div",{className:`prompt-card my-2 mx-0 py-3 px-3.5 border border-border border-s-[3px] border-s-border rounded-sm bg-surface flex flex-col gap-[9px] [&.plan]:border-s-accent-blue [&.permission]:border-s-accent-amber [&.question]:border-s-accent-purple [&.readonly]:opacity-60 question ${o?"readonly":""}`,children:[s.header&&f.jsx("div",{className:kCt,children:s.header}),s.question&&f.jsx("div",{className:"prompt-q text-base font-semibold leading-normal text-text",children:s.question}),f.jsx("div",{className:"prompt-options flex flex-col gap-1.5",children:(s.options??[]).map(d=>{const p=i.includes(d.label);return f.jsxs("button",{className:`prompt-option flex flex-col items-start gap-0.5 w-full py-2 px-[11px] text-start border border-border rounded-sm bg-background text-text cursor-pointer transition-[border-color,background] duration-80 ease-standard [&:hover:not(:disabled)]:border-border-strong [&:hover:not(:disabled)]:bg-surface [&.sel]:border-primary [&.sel]:bg-primary-subtle [&:disabled]:cursor-default ${p?"sel":""}`,disabled:o,onClick:()=>o?void 0:s.multiSelect?u(d.label):l({answers:[d.label]}),children:[f.jsx("span",{className:"prompt-option-label block text-sm font-medium",children:d.label}),d.description&&f.jsx("span",{className:"prompt-option-desc block text-sm font-normal leading-[1.45] text-subtext",children:d.description})]},d.label)})}),s.multiSelect&&!o&&f.jsx("div",{className:s5,children:f.jsx(Oe,{size:"small",variant:"primary",disabled:i.length===0,onClick:()=>l({answers:i}),children:dfe()})})]})}function YCt(e,n){return e.role==="user"?!0:e.parts.some(t=>Gh(t,n))}function XCt(e){const n=e.text??"",t=n.startsWith("data:")?n:hft(n),r=n.startsWith("data:")?"":n.includes("__")?n.slice(n.indexOf("__")+2):n,s=e.name||r||"attachment",i=n.startsWith("data:application/pdf")||/\.pdf$/i.test(s)||/\.pdf$/i.test(n);return{src:t,isPdf:i,name:s}}function ZCt({text:e,createdAt:n,count:t,index:r,prevId:s,nextId:i,onSelect:a,pagerDisabled:o,onEdit:l,editDisabled:u}){const _=t>1,d=new Date(n),p=async()=>{try{if(!navigator.clipboard)throw new Error(AD());await navigator.clipboard.writeText(e),Kn(tp(),"success")}catch(m){Kn(m instanceof Error?m.message:String(m),"error")}};return f.jsxs("div",{className:`fork-controls flex items-center gap-0.5 transition-opacity duration-80 ease-standard ${_?"opacity-100":"opacity-0 group-hover/turn:opacity-100 group-focus-within/turn:opacity-100"}`,children:[_&&f.jsxs(f.Fragment,{children:[f.jsx(Qt,{size:"small",title:EE(),"aria-label":EE(),disabled:o||!s,onClick:()=>s&&a(s),children:f.jsx(IO,{size:14})}),f.jsxs("span",{className:"fork-count text-xs text-subtext tabular-nums select-none",children:[r+1,"/",t]}),f.jsx(Qt,{size:"small",title:CE(),"aria-label":CE(),disabled:o||!i,onClick:()=>i&&a(i),children:f.jsx(Ta,{size:14})})]}),f.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 group-hover/turn:opacity-100 group-focus-within/turn:opacity-100 transition-opacity duration-80 ease-standard",children:[f.jsx("time",{dateTime:d.toISOString(),className:"text-xs text-subtext tabular-nums me-2",children:d.toLocaleTimeString(j(),{hour:"numeric",minute:"2-digit"})}),f.jsx(Qt,{size:"small","aria-label":n6(),disabled:!e,onClick:p,children:f.jsx(cb,{size:13})})]}),f.jsx(Qt,{size:"small",title:bE(),"aria-label":bE(),disabled:u,onClick:l,children:f.jsx(D6,{size:13})})]})}const JCt=R.memo(function({message:n,activePermissionId:t,pendingTailToolId:r,onOpenFile:s,onOpenRun:i,onOpenSpawnedSession:a,runExperimentName:o,onOpenExperiment:l,experimentName:u,onRespond:_,onOpenPlan:d,onOpenSubagent:p,busy:m=!1,recoveringTurnId:x,onRecover:S,skills:v,predictTextTail:b=!1,forkCount:w,forkIndex:y=0,forkPrevId:C,forkNextId:E,forkDisabled:N,branchDisabled:T,onFork:z,onSelectFork:M}){var V,X;Qd();const[O,B]=R.useState(null),$=t9t(n);if($)return f.jsx(n9t,{part:$});if(n.role==="user"){const te=n.parts.filter(ee=>ee.type==="text").map(ee=>ee.text??"").join(` -`),I=ee=>!!(v!=null&&v.some(ce=>ce.name===ee)),L=n.parts.filter(ee=>ee.type==="image"&&ee.text).map(XCt),F=L.filter(ee=>!ee.isPdf),q=L.filter(ee=>ee.isPdf),G=n.parts.filter(ee=>ee.type==="annotation"&&ee.text).map(ee=>({id:ee.id,text:ee.text??""}));if(O!==null){const ee=()=>{const ce=O.trim();!ce||N||(B(null),z(n.id,ce))};return f.jsx("div",{className:"msg-user-group ms-auto self-end flex w-full max-w-[88%] flex-col items-end gap-1.5",children:f.jsxs("div",{className:"msg-user-edit w-full bg-surface rounded-[16px] py-2.5 px-[15px] flex flex-col gap-2",children:[f.jsx("textarea",{dir:"auto",className:"w-full bg-transparent text-base text-text resize-none outline-none field-sizing-content min-h-16","aria-label":ace(),value:O,autoFocus:!0,onChange:ce=>B(ce.target.value),onKeyDown:ce=>{ce.key==="Escape"?(ce.preventDefault(),B(null)):ce.key==="Enter"&&!ce.shiftKey&&!ce.nativeEvent.isComposing&&(ce.preventDefault(),ee())}}),f.jsxs("div",{className:`${s5} justify-end`,children:[f.jsx(Oe,{size:"small",onClick:()=>B(null),children:Voe()}),f.jsx(Oe,{size:"small",variant:"primary",onClick:ee,disabled:N||!O.trim(),children:C4()})]})]})})}return f.jsxs("div",{className:"msg-user-group group/turn ms-auto self-end flex max-w-[88%] flex-col items-end gap-1.5",children:[G.length>0&&f.jsx(gk,{annotations:G,variant:"sent"}),f.jsxs("div",{dir:"auto",className:"msg-user max-w-full bg-surface rounded-[16px] py-2.5 px-[15px] text-base whitespace-pre-wrap wrap-anywhere [&_.skill-chip]:align-baseline",children:[f.jsx(Q8t,{text:te,isCommand:I}),F.length>0&&f.jsx("div",{className:"msg-images flex flex-wrap gap-1.5 mt-2 [&_img]:max-w-55 [&_img]:max-h-40 [&_img]:border [&_img]:border-border-variant [&_img]:rounded-xs [&_img]:block",children:F.map((ee,ce)=>f.jsx("a",{href:ee.src,target:"_blank",rel:"noreferrer",children:f.jsx("img",{src:ee.src,alt:_ie()})},ce))}),q.length>0&&f.jsx("div",{className:"msg-files flex flex-wrap gap-1.5 mt-2",children:q.map((ee,ce)=>f.jsxs("a",{className:"msg-file inline-flex items-center gap-1.5 max-w-60 py-1.5 px-2.5 border border-border-variant rounded-sm text-text no-underline [&:hover]:border-text [&_span]:overflow-hidden [&_span]:text-ellipsis [&_span]:whitespace-nowrap",href:ee.src,target:"_blank",rel:"noreferrer",children:[f.jsx(ub,{size:15}),f.jsx("span",{children:ee.name})]},ce))})]}),w!==void 0&&f.jsx(ZCt,{text:te,createdAt:n.createdAt,count:w,index:y,prevId:C,nextId:E,onSelect:M,pagerDisabled:T,onEdit:()=>B(te),editDisabled:N})]})}const U=n.parts.find(te=>te.type==="tool"&&v3(te)),H=n.parts.find(am)??U,Y=n.parts.filter(te=>te!==H&&!(U&&v3(te)));return f.jsxs("div",{className:"msg-assistant group/turn text-base leading-[1.62] text-text min-w-0",children:[f.jsx(e9t,{message:n,parts:Y,options:{activePermissionId:t,pendingTailToolId:r,onOpenFile:s,onOpenRun:i,onOpenSpawnedSession:a,runExperimentName:o,onOpenExperiment:l,experimentName:u,onRespond:_,onOpenPlan:d,onOpenSubagent:p,predictTextTail:b}}),H&&f.jsx(bF,{part:H,usageLimited:!!U,busy:m,recovering:x===((X=(V=H.state)==null?void 0:V.input)==null?void 0:X.turnId),onRecover:S})]})});function e9t({message:e,parts:n,options:t}){const r=t.predictTextTail??!1,{work:s,answer:i}=Xyt(n,r),[a,o]=R.useState(!1),[,l]=R.useState(0);if(R.useEffect(()=>{if(!r||e.completedAt!=null||s.length===0)return;const p=window.setInterval(()=>l(m=>m+1),1e3);return()=>window.clearInterval(p)},[r,e.completedAt,s.length]),s.length===0)return f.jsx(f.Fragment,{children:D1(i,t)});const u=e.completedAt??(r?Date.now():null),_=u===null?null:u-e.createdAt,d=_===null?null:_<6e4||_>=36e5?np(_):s0e({minutes:Wt(Math.floor(_/6e4)),seconds:Wt(Math.floor(_/1e3)%60)});return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"turn-work mb-4",children:[f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 border-b border-border/50 pb-2 text-start text-base text-subtext cursor-pointer hover:text-text focus-visible:outline-2 focus-visible:outline-primary","aria-expanded":a,"data-work-toggle":!0,onClick:()=>o(p=>!p),children:[f.jsx("span",{children:d===null?e0e():l0e({duration:d})}),f.jsx(Ta,{size:16,className:`shrink-0 text-muted transition-transform duration-200 ease-standard motion-reduce:transition-none ${a?"rotate-90":""}`})]}),f.jsx("div",{className:`tool-group-disclosure ${a?"open":""}`,"aria-hidden":!a,inert:!a,children:f.jsx("div",{className:"tool-group-disclosure-inner",children:f.jsx("div",{className:"turn-work-content pt-4",children:D1(s,{...t,predictTextTail:!1,pendingTailToolId:null})})})})]}),f.jsx("div",{className:"turn-answer",children:D1(i,t)})]})}function t9t(e){const n=e.parts.length===1?e.parts[0]:void 0;return e.role==="user"&&(n==null?void 0:n.type)==="tool"&&n.tool===VL?n:null}function n9t({part:e}){var l;const n=e.state,t=Gs((n==null?void 0:n.input)??{},"command")??"",r=(n==null?void 0:n.status)==="running",s=(n==null?void 0:n.status)==="error",i=typeof((l=n==null?void 0:n.input)==null?void 0:l.exitCode)=="number"?n.input.exitCode:null,a=[n==null?void 0:n.output,n==null?void 0:n.error].filter(Boolean).join(` -`),o=r?_D():s&&i!==null?Tie({code:Wt(i)}):null;return f.jsx("div",{className:"msg-shell ms-auto self-end flex w-full max-w-[88%] flex-col items-stretch gap-1.5",children:f.jsxs("div",{dir:"ltr",className:"max-w-full bg-surface rounded-[16px] py-2.5 px-[15px] text-base",children:[f.jsxs("div",{className:"flex items-start gap-2 font-mono text-sm text-text whitespace-pre-wrap wrap-anywhere",children:[f.jsxs("span",{className:"sr-only",children:[bD()," "]}),f.jsx(c_,{size:16,strokeWidth:1.6,className:`mt-0.5 shrink-0 ${s?"text-accent-red":"text-muted"}`,"aria-hidden":"true"}),f.jsx("span",{children:t})]}),a&&f.jsx("div",{className:`${mk} mt-2`,children:a.slice(0,2e4)}),o&&f.jsx("div",{className:`mt-1.5 text-xs ${s?"text-accent-red":"text-muted"}`,children:o})]})})}function D1(e,n){var w,y;const{activePermissionId:t,pendingTailToolId:r,onOpenFile:s,onOpenRun:i,onOpenSpawnedSession:a,runExperimentName:o,onOpenExperiment:l,experimentName:u,onRespond:_,onOpenPlan:d,onOpenSubagent:p,predictTextTail:m=!1}=n,x=e.filter(C=>C.type!=="steer"&&Gh(C,t)).at(-1),S=[];let v=[];const b=()=>{v.length!==0&&(S.push(f.jsx(KCt,{parts:v,pendingTail:v.some(C=>C.id===r),onOpenFile:s,onOpenRun:i,onOpenSpawnedSession:a,runExperimentName:o,onOpenExperiment:l,experimentName:u},`tg-${v[0].id}`)),v=[])};for(const C of e)if(Gh(C,t)){if(C.type==="tool"&&(s9t(C.tool)||(((w=C.children)==null?void 0:w.length)??0)>0)){b(),S.push(f.jsx(a9t,{part:C,pendingTail:m&&((y=C.state)==null?void 0:y.status)==="running"||C.id===r,onOpenSubagent:p},C.id));continue}if(C.type==="tool"){v.push(C);continue}b(),C.type==="text"?S.push(f.jsx($o,{text:C.text,onOpenFile:s,onOpenRun:i,predict:m&&C.id===(x==null?void 0:x.id)},C.id)):C.type==="steer"?S.push(f.jsx("div",{dir:"auto",role:"note","aria-label":Bfe(),className:"msg-steer my-2 ms-auto w-fit max-w-[88%] bg-surface rounded-[16px] py-2.5 px-[15px] text-base whitespace-pre-wrap wrap-anywhere",children:C.text},C.id)):C.type==="prompt"&&C.prompt&&S.push(f.jsx(QCt,{part:C,onRespond:_,onOpenFile:s,onOpenPlan:d},C.id))}return b(),S}function r9t(e){return $d(e).label}function s9t(e){const n=(e??"").toLowerCase();return n==="subagent"||n==="task"||n==="agent"}function yF(e){var t,r;const n=((t=e.state)==null?void 0:t.status)==="completed"?((r=e.state)==null?void 0:r.output)??"":"";return n.startsWith("Async agent launched")?"":n}function Av(e,n){for(const t of e){if(t.id===n)return t;const r=t.children&&Av(t.children,n);if(r)return r}return null}function i9t({spawn:e,onOpenFile:n,onOpenRun:t,runExperimentName:r,onOpenExperiment:s,experimentName:i,onOpenSubagent:a}){var x,S,v,b;const o=e.children??[],l=((x=e.state)==null?void 0:x.status)==="running",u=((S=e.state)==null?void 0:S.status)==="error",_=u?Jb(((v=e.state)==null?void 0:v.error)||((b=e.state)==null?void 0:b.output)||""):"",d=D1(o,{onOpenFile:n,onOpenRun:t,runExperimentName:r,onOpenExperiment:s,experimentName:i,onOpenSubagent:a,predictTextTail:l,pendingTailToolId:l?vB(o):null}),m=o.some(w=>w.type==="text"&&!!w.text)?"":yF(e);return f.jsxs("div",{className:"msg-assistant text-base leading-[1.62] text-text min-w-0",children:[u&&f.jsxs("span",{className:"sr-only",children:[J5()," "]}),_&&f.jsx("div",{className:mk,children:_.slice(0,2e4)}),d.length===0&&!m&&!_?f.jsx("div",{className:"subagent-empty py-[3px] px-1 text-sm text-muted",children:l?e6():Dae()}):f.jsxs(f.Fragment,{children:[d,m&&f.jsx($o,{text:m,onOpenFile:n,onOpenRun:t})]})]})}function a9t({part:e,pendingTail:n,onOpenSubagent:t}){var u,_,d,p;const r=((u=e.state)==null?void 0:u.status)==="error",s=Jb(((_=e.state)==null?void 0:_.error)||((d=e.state)==null?void 0:d.output)||""),i=n&&!r?vk($d(e)):$d(e),a=vF(!!(n&&!r)),o=(((p=e.children)==null?void 0:p.length)??0)===0&&!r&&!yF(e),l=f.jsxs(f.Fragment,{children:[r&&f.jsxs("span",{className:"sr-only",children:[J5()," "]}),r?f.jsx("span",{className:"flex h-6 shrink-0 items-center text-accent-red",children:f.jsx(PO,{size:16,strokeWidth:1.75,className:"subagent-icon","aria-hidden":"true"})}):f.jsx(Tv,{activity:i,className:`subagent-icon ${a?"tool-running-shimmer-icon":"text-muted"}`}),f.jsx("span",{className:`${aF} ${a?"tool-running-shimmer":r?"text-accent-red":"text-subtext"}`,children:i.label})]});return o?f.jsx("div",{className:"subagent-row flex items-start gap-2 w-full my-3.5 mx-0 py-[3px] px-1 text-text text-base text-start rounded-sm",children:l}):f.jsxs("button",{className:"subagent-row flex items-start gap-2 w-full my-3.5 mx-0 py-[3px] px-1 cursor-pointer text-text text-base text-start rounded-sm [&:hover:not(:disabled)]:bg-surface [&:disabled]:cursor-default",title:r&&s?s:Yae(),...Ur(m=>t==null?void 0:t(e.id,i.label,m)),disabled:!t,children:[l,f.jsx("span",{className:"subagent-row-chevron flex h-6 shrink-0 items-center text-muted",children:f.jsx(Ta,{size:12})})]})}function o9t(e){const n=new Map;let t;for(let s=e.length-1;s>=0;s--)if(e[s].role==="assistant"){t=e[s];break}if(!t)return{messageId:"",states:n};const r=(s,i)=>{var a,o;for(const l of s){const u=`${i}/${l.id}`;l.type==="tool"&&((a=l.state)!=null&&a.status)&&n.set(u,{status:l.state.status,part:l}),(o=l.children)!=null&&o.length&&r(l.children,u)}};return r(t.parts,t.id),{messageId:t.id,states:n}}function bk(e){const n=(t,r)=>{var s;for(const i of t){const a=i.prompt;if(i.type==="prompt"&&(a==null?void 0:a.kind)==="permission"&&!a.resolved){const o=a.toolInput??{},u=Gs(o,"reason","description")||gF(a.tool,o);return{id:i.id,path:`${r}/${i.id}`,label:u}}if((s=i.children)!=null&&s.length){const o=n(i.children,`${r}/${i.id}`);if(o)return o}}return null};for(const t of e){if(t.role!=="assistant")continue;const r=n(t.parts,t.id);if(r)return r}return null}function l9t(e){const[n,t]=R.useState({text:"",sequence:0}),r=R.useRef(null);return R.useEffect(()=>{var x,S,v,b,w;const s=((x=e[0])==null?void 0:x.id)??"",{messageId:i,states:a}=o9t(e),o=bk(e);if(!r.current||r.current.transcript!==s){r.current={transcript:s,messageId:i,states:a,permissionPath:(o==null?void 0:o.path)??null},t(y=>({text:o?rE({label:Do(o.label)}):"",sequence:y.sequence+1}));return}const l=r.current.messageId===i?r.current.states:new Map,u=r.current.permissionPath,_=[...a].filter(([y,C])=>{var E;return((E=l.get(y))==null?void 0:E.status)!==C.status});if(r.current={transcript:s,messageId:i,states:a,permissionPath:(o==null?void 0:o.path)??null},o&&o.path!==u){t(y=>({text:rE({label:Do(o.label)}),sequence:y.sequence+1}));return}const d=(S=_.find(([,y])=>am(y.part)))==null?void 0:S[1].part;if((d==null?void 0:d.id)==="turn-recovery"){const y=xB((b=(v=d.state)==null?void 0:v.input)==null?void 0:b.recoveryAction);t(C=>({text:`${vte()}${y?` ${y==="retry"?Zee():Kee()}`:""}`,sequence:C.sequence+1}));return}if((d==null?void 0:d.id)==="turn-retry"){t(y=>({text:Uee(),sequence:y.sequence+1}));return}const p=_.filter(([,y])=>y.status==="error");if(p.length>0){const y=p.slice(0,2).map(([,C])=>$d(C.part).label).join(", ");t(C=>({text:p.length===1?ute({labels:y}):_te({count:Wt(p.length),labels:y}),sequence:C.sequence+1}));return}const m=_.filter(([,y])=>y.status==="running");if(m.length>0){const y=(w=m.at(-1))==null?void 0:w[1].part;t(C=>({text:y?vk($d(y)).label:nte(),sequence:C.sequence+1}));return}_.some(([,y])=>y.status==="completed")&&t(y=>({text:ate(),sequence:y.sequence+1}))},[e]),n}const c9t=R.memo(function({messages:n,scrollRef:t,scrollToEndRef:r,stickToBottom:s,onPinToBottom:i,allMessages:a,canFork:o,onFork:l,onSelectFork:u,busy:_,onOpenFile:d,onOpenRun:p,onOpenSpawnedSession:m,runExperimentName:x,onOpenExperiment:S,experimentName:v,onRespond:b,onOpenPlan:w,onOpenSubagent:y,recoveringTurnId:C,onRecover:E,skills:N}){var I,L,F;Qd();const T=((I=bk(n))==null?void 0:I.id)??null,z=R.useMemo(()=>n.filter(q=>YCt(q,T)),[n,T]),M=R.useMemo(()=>{const q=z.filter(G=>G.role==="user"&&!G.id.startsWith(Cd));return Kyt(a,n,q,G=>G.startsWith(Cd))},[n,z,a]),O=R.useRef(new Set),[B,$]=R.useState(!1),U=R.useCallback(q=>z[q].id,[z]),H=R.useCallback(q=>{if(B)return z.map((ee,ce)=>ce);const G=new Set(mB(q));return z.forEach((ee,ce)=>{O.current.has(ee.id)&&G.add(ce)}),[...G].sort((ee,ce)=>ee-ce)},[z,B]),Y=Gyt({count:z.length,useFlushSync:!1,getScrollElement:()=>t.current,getItemKey:U,estimateSize:()=>400,overscan:1,initialRect:{width:((L=t.current)==null?void 0:L.clientWidth)??0,height:((F=t.current)==null?void 0:F.clientHeight)??0},initialOffset:()=>{var q;return Math.max(0,z.length*400-(((q=t.current)==null?void 0:q.clientHeight)??0))},anchorTo:s.current?"end":"start",followOnAppend:!0,scrollEndThreshold:60,rangeExtractor:H});R.useLayoutEffect(()=>{const q=()=>Y.scrollToEnd();return r.current=q,i(),()=>{r.current=null}},[Y,r,i]),R.useEffect(()=>{const q=()=>{var ce;const G=window.getSelection();if(!G||G.isCollapsed||!G.rangeCount)return;const ee=G.getRangeAt(0);for(const oe of((ce=t.current)==null?void 0:ce.querySelectorAll("[data-message-id]"))??[])ee.intersectsNode(oe)&&oe.dataset.messageId&&O.current.add(oe.dataset.messageId)};return document.addEventListener("selectionchange",q),()=>document.removeEventListener("selectionchange",q)},[t]);const V=z.at(-1),X=l9t(n),te=_?bB(n):null;return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:f.jsx("span",{children:X.text},X.sequence)}),f.jsx("button",{type:"button",className:"sr-only focus:not-sr-only","aria-pressed":B,onClick:()=>$(q=>!q),children:t_e()}),f.jsx("div",{className:"relative",style:{height:Y.getTotalSize()},children:Y.getVirtualItems().map(q=>{var ne,Q,le,ae,ue,pe;const G=z[q.index],ee=G.parts.find(am),ce=(Q=(ne=ee==null?void 0:ee.state)==null?void 0:ne.input)==null?void 0:Q.turnId,oe=ee?_||C!==null:!1;return f.jsx("div",{"data-index":q.index,"data-message-id":G.id,ref:Y.measureElement,className:"absolute left-0 w-full pb-4",style:{top:q.start},onClickCapture:Se=>{!(Se.target instanceof Element)||!Se.target.closest("[data-work-toggle]")||(s.current=!1,Y.setOptions({...Y.options,anchorTo:"start"}))},onPointerDownCapture:()=>O.current.add(G.id),onFocusCapture:()=>O.current.add(G.id),children:f.jsx(JCt,{message:G,forkCount:(le=M.get(G.id))==null?void 0:le.count,forkIndex:(ae=M.get(G.id))==null?void 0:ae.index,forkPrevId:(ue=M.get(G.id))==null?void 0:ue.prevId,forkNextId:(pe=M.get(G.id))==null?void 0:pe.nextId,forkDisabled:!o,branchDisabled:_,onFork:l,onSelectFork:u,activePermissionId:T,pendingTailToolId:(te==null?void 0:te.messageId)===G.id?te.toolId:null,onOpenFile:d,onOpenRun:p,onOpenSpawnedSession:m,runExperimentName:x,onOpenExperiment:S,experimentName:v,onRespond:b,onOpenPlan:w,onOpenSubagent:y,busy:oe,recoveringTurnId:ce===C?C:null,onRecover:E,skills:N,predictTextTail:_&&G===V&&G.role==="assistant"})},G.id)})})]})}),u9t=(e,n)=>e==="all"?!0:e==="archived"?n:!n,xF=[{id:"active",label:doe,railLabel:kD},{id:"archived",label:_E,railLabel:_E},{id:"all",label:poe,railLabel:vD}];function d9t({value:e,onChange:n}){const{open:t,setOpen:r,ref:s}=ro();return f.jsxs("div",{className:"rail-filter relative inline-flex",ref:s,children:[f.jsx(Qt,{size:"small",className:"rail-filter-btn",active:e!=="active",title:SE(),"aria-label":SE(),onClick:()=>r(i=>!i),children:f.jsx(ZO,{size:13})}),t&&f.jsx("div",{className:"option-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-95 flex flex-col bg-background border border-border rounded-lg shadow-menu z-50 overflow-hidden min-w-47.5 p-1.5 [&.align-right]:start-auto [&.align-right]:end-0 [&.drop-down]:bottom-auto [&.drop-down]:top-[calc(100%_+_4px)] [&.session-menu]:start-auto [&.session-menu]:end-1.5 [&.session-menu]:top-[calc(100%_-_2px)] [&.session-menu]:min-w-35 drop-down align-right",children:xF.map(i=>f.jsxs(sr,{onClick:()=>{n(i.id),r(!1)},children:[f.jsx("span",{children:i.label()}),e===i.id&&f.jsx(Na,{size:13})]},i.id))})]})}const f9t=14,h9t=500,_9t=1200;function wF({title:e,animate:n}){return n?f.jsx("span",{className:"title-reveal","aria-label":e,children:Array.from(e).map((t,r)=>t===" "?f.jsx("span",{"aria-hidden":!0,children:t},r):f.jsx("span",{"aria-hidden":!0,className:"title-reveal-char inline-block animate-[title-char-in_240ms_ease-out_both] [@media((prefers-reduced-motion:_reduce))]:animate-none",style:{animationDelay:`${Math.min(r*f9t,h9t)}ms`},children:t},r))}):f.jsx(f.Fragment,{children:e})}function p9t({session:e,active:n,unread:t,busy:r,waiting:s,revealTitle:i,onOpen:a,onRename:o,onSetArchived:l,onDelete:u}){var E;const{open:_,setOpen:d,ref:p}=ro(),m=((E=e.title)==null?void 0:E.trim())||"Untitled",[x,S]=R.useState(!1),[v,b]=R.useState(""),w=R.useRef(null);function y(){var N;b(((N=e.title)==null?void 0:N.trim())||""),S(!0)}function C(){var T;const N=v.trim();S(!1),N&&N!==(((T=e.title)==null?void 0:T.trim())||"")&&o(N)}return R.useEffect(()=>{var N,T;x&&((N=w.current)==null||N.focus(),(T=w.current)==null||T.select())},[x]),f.jsxs("div",{ref:p,role:"button",tabIndex:0,className:`session-row relative flex items-center gap-2 w-full text-start py-[7px] px-2.5 rounded-md text-sm text-text cursor-pointer select-none [&:hover:not(.active)]:bg-surface [&.active]:bg-panel [&.active]:font-medium [&_.session-dot:empty]:hidden [&_.session-dot]:w-4 [&_.session-dot]:inline-flex [&_.session-dot]:items-center [&_.session-dot]:justify-center [&_.session-dot]:shrink-0 [&_.session-title]:flex-1 [&_.session-title]:min-w-0 [&_.session-title]:overflow-hidden [&_.session-title]:[mask-image:linear-gradient(to_right,black_calc(100%_-_16px),transparent)] [&_.session-title]:whitespace-nowrap [&_.session-menu-btn]:hidden [&_.session-menu-btn]:items-center [&_.session-menu-btn]:justify-center [&_.session-menu-btn]:w-4 [&_.session-menu-btn]:h-4 [&_.session-menu-btn]:-my-0.5 [&_.session-menu-btn]:mx-0 [&_.session-menu-btn]:rounded-sm [&_.session-menu-btn]:text-muted [&_.session-menu-btn]:shrink-0 [&_.session-menu-btn:hover]:text-text [&_.session-menu-btn:hover]:bg-panel [&:hover_.session-menu-btn]:inline-flex [&:focus-visible_.session-menu-btn]:inline-flex [&_.session-menu-btn:focus-visible]:inline-flex [&.menu-open_.session-menu-btn]:inline-flex [&:hover_.session-dot]:hidden [&:focus-visible_.session-dot]:hidden [&:has(.session-menu-btn:focus-visible)_.session-dot]:hidden [&.menu-open_.session-dot]:hidden [&_.busy-dot]:w-[7px] [&_.busy-dot]:h-[7px] [&_.busy-dot]:rounded-full [&_.busy-dot]:bg-primary [&_.busy-dot]:animate-[or-pulse_1.2s_infinite] [&_.busy-dot]:shrink-0 [&_.unread-dot]:w-[7px] [&_.unread-dot]:h-[7px] [&_.unread-dot]:rounded-full [&_.unread-dot]:bg-primary [&_.unread-dot]:shrink-0 [&_.busy-dot.waiting]:animate-none [&_.session-title-input]:flex-1 [&_.session-title-input]:min-w-0 [&_.session-title-input]:py-px [&_.session-title-input]:px-[5px] [&_.session-title-input]:-my-0.5 [&_.session-title-input]:mx-0 [&_.session-title-input]:[font:inherit] [&_.session-title-input]:text-text [&_.session-title-input]:bg-background [&_.session-title-input]:border [&_.session-title-input]:border-primary [&_.session-title-input]:rounded-sm [&_.session-title-input]:outline-none [&.editing]:bg-surface [&.editing]:cursor-default [&.editing_.session-menu-btn]:hidden [&.editing_.session-dot]:hidden ${n?"active":""} ${t?"unread":""} ${_?"menu-open":""} ${x?"editing":""}`,title:`${E0[e.harness]}${e.model?` · ${e.model}`:""}${e.parentSessionId?i_e():""}`,onClick:()=>{x||(_?d(!1):a())},onKeyDown:N=>{N.target===N.currentTarget&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),_?d(!1):a())},children:[e.parentSessionId&&!x&&f.jsx(I6,{className:"text-muted shrink-0",size:12,"aria-hidden":!0}),x?f.jsx("input",{ref:w,className:"session-title-input","aria-label":qde(),value:v,onChange:N=>b(N.target.value),onClick:N=>N.stopPropagation(),onBlur:C,onKeyDown:N=>{N.stopPropagation(),N.key==="Enter"?(N.preventDefault(),C()):N.key==="Escape"&&(N.preventDefault(),S(!1))}}):f.jsx("span",{className:"session-title",children:f.jsx(wF,{title:m,animate:i!==void 0},i??"static")}),f.jsx("span",{className:"session-dot",children:r?f.jsx("span",{className:`busy-dot ${s?"waiting":""}`}):t&&f.jsx("span",{className:"unread-dot"})}),f.jsx("button",{className:"session-menu-btn",title:AE(),"aria-label":AE(),onClick:N=>{N.stopPropagation(),d(T=>!T)},children:f.jsx(A6,{size:14})}),_&&f.jsxs("div",{className:"option-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-95 flex flex-col bg-background border border-border rounded-lg shadow-menu z-50 overflow-hidden min-w-47.5 p-1.5 [&.align-right]:start-auto [&.align-right]:end-0 [&.drop-down]:bottom-auto [&.drop-down]:top-[calc(100%_+_4px)] [&.session-menu]:start-auto [&.session-menu]:end-1.5 [&.session-menu]:top-[calc(100%_-_2px)] [&.session-menu]:min-w-35 drop-down session-menu",children:[f.jsx(sr,{onClick:N=>{N.stopPropagation(),d(!1),y()},children:f.jsx("span",{children:xD()})}),f.jsx(sr,{onClick:N=>{N.stopPropagation(),d(!1),l(!e.archived)},children:f.jsx("span",{children:e.archived?q_e():nie()})}),f.jsx(sr,{danger:!0,onClick:N=>{N.stopPropagation(),d(!1),u()},children:f.jsx("span",{children:yD()})})]})]})}const SA=[OO,YO,c_,db],Ow=[{box:"border-accent-blue/45",icon:"text-accent-blue"},{box:"border-accent-green/45",icon:"text-accent-green"},{box:"border-accent-amber/45",icon:"text-accent-amber"},{box:"border-primary/45",icon:"text-primary"}],kA="mt-7 grid w-full max-w-readable grid-cols-1 gap-3 sm:grid-cols-2";function m9t({onClose:e,onConfigureSsh:n}){var v,b;const t=gn({mutationFn:w=>bdt(...w)}),r=ct(WL()),s=ct(Dft()),i=r.data??null,a=s.data??[],[o,l]=R.useState(""),u=i?null:((v=r.error)==null?void 0:v.message)??((b=s.error)==null?void 0:b.message)??null,[_,d]=R.useState(null),p=R.useRef(null);ib(p,e);async function m(w){const y=window.open("/remote-launch","_blank");if(!y){Kn(sLe(),"error");return}d(w);try{const C=await t.mutateAsync([w,{theme:_ht(),locale:j()}]);y.location.replace(C.gatewayUrl),e()}catch(C){y.close(),Kn(C instanceof Error?C.message:String(C),"error")}finally{d(null)}}const x=i==null?void 0:i.filter(w=>w.host.toLocaleLowerCase().includes(o.trim().toLocaleLowerCase())),S=new Map(a.map(w=>[w.host,w]));return no.createPortal(f.jsx("div",{className:"fixed inset-0 z-200 flex items-center justify-center bg-modal-backdrop p-5",onClick:w=>{w.target===w.currentTarget&&e()},children:f.jsxs("div",{ref:p,className:"relative flex h-[min(42rem,calc(100vh-2.5rem))] w-160 max-w-full flex-col overflow-hidden rounded-xl border border-border bg-background shadow-modal",role:"dialog","aria-modal":"true","aria-labelledby":"remote-host-dialog-title",tabIndex:-1,children:[f.jsx(Qt,{className:"absolute end-3.5 top-3.5","aria-label":$Me(),onClick:e,children:f.jsx(qr,{size:16})}),f.jsxs("div",{className:"shrink-0 px-6 pt-5 pb-4 pe-14",children:[f.jsx("h2",{id:"remote-host-dialog-title",className:"m-0 text-xl font-medium",children:ZD()}),f.jsx("p",{className:"mt-2 mb-0 text-sm leading-normal text-subtext",children:qMe()}),f.jsx(rs,{"data-initial-focus":!0,className:"mt-4",value:o,onChange:w=>l(w.target.value),placeholder:wN(),"aria-label":wN()})]}),f.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto border-t border-border-variant p-2",children:u?f.jsx("p",{className:"m-3 text-sm text-accent-red",children:u}):i===null?f.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-subtext",children:[f.jsx(Lt,{})," ",mL()]}):(x==null?void 0:x.length)===0?f.jsx("p",{className:"m-3 text-sm text-subtext",children:HDe()}):x==null?void 0:x.map(w=>{const y=S.get(w.host);return f.jsxs(Oe,{variant:"ghost",className:"w-full justify-start text-base font-normal",disabled:_===w.host,onClick:()=>void m(w.host),children:[f.jsx("span",{className:"min-w-0 flex-1 truncate text-start",children:w.host}),_===w.host?f.jsx(Lt,{}):y?f.jsx("span",{className:"text-sm text-subtext",children:YDe()}):null]},w.host)})}),f.jsx("div",{className:"shrink-0 border-t border-border-variant p-2",children:f.jsxs(Oe,{variant:"ghost",className:"w-full justify-start text-base font-normal",onClick:n,children:[f.jsx(ZO,{size:15}),EL()]})})]})}),document.body)}function g9t({projectId:e,projectName:n,railHeader:t,railOpen:r,onShowRail:s,mainView:i,onSelectMainView:a,onOpenFile:o,onOpenRun:l,runExperimentName:u,onOpenExperiment:_,experimentName:d,onOpenPlan:p,onOpenSubagent:m,runtime:x,onOpenDemoWelcome:S,composerPrefill:v=null,activeSessionId:b,onActiveSessionChange:w,preferredAgent:y,onPreferredAgentChange:C,children:E}){var Kr,ua,Ia,hc,tl;const N=gn({mutationFn:se=>cft(...se)}),T=gn({mutationFn:se=>lft(...se)}),z=gn({mutationFn:se=>sft(...se)}),M=gn({mutationFn:se=>aft(...se)}),O=gn({mutationFn:se=>oft(...se)}),B=gn({mutationFn:ift}),$=R.useMemo(()=>Ea(e),[e]),{data:U=CCt}=ct($),H=R.useCallback(se=>{Gr($.queryKey,be=>{if(!be)return;const Ae=typeof se=="function"?se(be):se,Le=new Map(be.map(Ue=>[Ue.id,Ue]));for(const Ue of Ae)Le.get(Ue.id)!==Ue&&Ga(nt,$.queryKey,Ue.id),Le.delete(Ue.id);for(const Ue of Le.keys())Ga(nt,$.queryKey,Ue);return Ae})},[$]),[Y,V]=R.useState(!1),[X,te]=R.useState(!1),I=b,L=R.useRef(w);L.current=w;const F=R.useRef({projectId:e});F.current.projectId!==e&&(F.current={projectId:e});const[q,G]=R.useState(new Set),[ee,ce]=R.useState("active"),[oe,ne]=R.useState(""),[Q,le]=R.useState([]),ae=R.useRef(0),ue=R.useRef({projectId:e,activeId:I,mainView:i});(ue.current.projectId!==e||ue.current.activeId!==I||ue.current.mainView!==i)&&(ue.current={projectId:e,activeId:I,mainView:i});const[pe,Se]=R.useState([]),[ye,qe]=R.useState(null),[Ie,ze]=R.useState(null),at=R.useRef(Promise.resolve()),bt=R.useRef(0),$t=R.useRef(0),[Pt,zt]=R.useState(null),ot=R.useRef(null),ft=R.useRef(!1),It=R.useRef(null),[we,Re,Ze]=Kft(e,i==="chat"?I:null),{data:ht=b9t}=ct(fu()),[xt,Vt]=R.useState(y);R.useEffect(()=>Vt(y),[y]);const[Ve,Ht]=R.useState({}),[sn,fn]=R.useState(b0),[Zt,Qn]=R.useState(null),Jt=R.useRef(!1),bn=R.useRef(null),[or,lr]=R.useState(null),br=R.useRef(!1),Dn=R.useRef(null),[Wr,Nr]=R.useState(new Map),vt=R.useRef(new Map),un=R.useRef(null),Cn=R.useRef(null),en=R.useRef(null),Jn=R.useRef(!0),[hn,En]=R.useState(!0),ln=R.useRef(null),pt=ro(),kt=R.useCallback(se=>{var be;ae.current+=1,le(Ae=>[...Ae,{id:`annotation-${ae.current}`,...se}]),(be=ln.current)==null||be.focus()},[]),Ge=gCt(Cn,kt);vCt(Q),R.useEffect(()=>{le([]),Ge.dismiss()},[I,e,Ge.dismiss]);const[mt,fr]=R.useState(0),[cn,qt]=R.useState(!1),[er,Ln]=R.useState(0),di=R.useRef(!1);function Xl(se){if(!gs)return;if(se.source==="command"&&se.name==="plan"){yr(oe,gs);return}const be=t5(se.name,ln.current),Ae=H8t(oe,gs,se.name,be);ne(Ae.text),window.requestAnimationFrame(()=>{var Le,Ue;(Le=ln.current)==null||Le.focus(),(Ue=ln.current)==null||Ue.setSelectionRange(Ae.cursor,Ae.cursor),Ln(Ae.cursor)})}function io(se){if(ao)return!1;const be=se.selectionStart;if(di.current||be!==se.selectionEnd)return!1;const Ae=oe.slice(0,be).replace(/[ \t]+$/,"").length,Le=jw(oe,Ae);if(!Le||Le.end!==Ae||!la(Le.query)||be>Ae&&be-Ae!==t5(Le.query,se))return!1;const Ue=dA(oe,{...Le,end:be});return ne(Ue.text),Ln(Ue.cursor),window.requestAnimationFrame(()=>se.setSelectionRange(Ue.cursor,Ue.cursor)),!0}function Ni(se){qe(null);let Le=pe.reduce((Ue,zn)=>Ue+zn.size,0);for(const Ue of se){if(!/^(image\/(png|jpeg|gif|webp)|application\/pdf)$/.test(Ue.type))continue;if(Ue.size>31457280){qe(vie({name:Ne(Ue.name)}));continue}if(Le+Ue.size>41943040){qe(wie());continue}Le+=Ue.size;const zn=new FileReader;zn.onload=()=>{const jn=zn.result;Se(dr=>[...dr,{dataUrl:jn,mediaType:Ue.type,name:Ue.name,size:Ue.size}])},zn.readAsDataURL(Ue)}}function Ra(se){const be=Array.from(se.clipboardData.items).filter(Ae=>Ae.kind==="file"&&(Ae.type.startsWith("image/")||Ae.type==="application/pdf")).map(Ae=>Ae.getAsFile()).filter(Ae=>Ae!==null);be.length>0&&(se.preventDefault(),Ni(be))}const tn=U.find(se=>se.id===I),Ys=xt??lgt(ht),cr=tn?{harness:tn.harness,model:Ve.model??tn.model,serviceTier:Ve.serviceTier!==void 0?Ve.serviceTier:tn.serviceTier,permissionMode:Ve.permissionMode??tn.permissionMode,reasoningLevel:Ve.reasoningLevel??tn.reasoningLevel}:Ys?{...Ys,...Ve}:null,{data:Rr=v9t}=ct($ft(cr==null?void 0:cr.harness)),Ke=cr?ht.find(se=>se.id===cr.harness):void 0,Ut=Ke==null?void 0:Ke.options,zi=R.useMemo(()=>q8t(Rr,Ut==null?void 0:Ut.planActivation),[Rr,Ut==null?void 0:Ut.planActivation]),os=_A(oe),ks=os!==null,gs=jw(oe,er),sa=(gs==null?void 0:gs.query)??null,Ma=sa===null?[]:zi.filter(se=>se.name.startsWith(sa)||se.plugin&&`${se.plugin}:${se.name}`.toLowerCase().startsWith(sa)),ao=!ks&&sa!==null&&(gs==null?void 0:gs.end)===er&&Ma.length>0,Cs=ao&&!cn?Ma:[],Da=Cs.length>0,Vr=Math.min(mt,Math.max(0,Cs.length-1));R.useEffect(()=>fr(0),[sa]);const Mr=cr&&Ke&&Ke.models.length>0&&!Ke.models.some(se=>se.id===cr.model)?Ke.models[0].id:(cr==null?void 0:cr.model)??null,nn=cr&&{...cr,model:Mr,serviceTier:rv(Ke,Mr,cr.serviceTier),reasoningLevel:qL(Ke,Mr,cr.reasoningLevel)},vs=tb(Ke,nn==null?void 0:nn.model),Xs=se=>{if(!nn)return;const be={...nn,...se},Ae={};se.model!==void 0&&se.model!==nn.model&&(Ae.model=se.model),se.serviceTier!==void 0&&se.serviceTier!==nn.serviceTier&&(Ae.serviceTier=se.serviceTier),se.permissionMode!==void 0&&se.permissionMode!==nn.permissionMode&&(Ae.permissionMode=se.permissionMode),se.reasoningLevel!==void 0&&se.reasoningLevel!==nn.reasoningLevel&&(Ae.reasoningLevel=se.reasoningLevel),fn(Le=>({...Le,...Ae})),Vt(be),C(be).catch(()=>{}),tn?Ht(Le=>({...Le,...se})):se.harness&&se.harness!==nn.harness&&Ht({})},ur=R.useCallback(se=>{const be=at.current.catch(()=>{}).then(()=>{if(!Pn($.queryKey))throw new DOMException("Workspace changed","AbortError");return se()});return at.current=be.then(()=>{},()=>{}),be},[$]),ls=se=>{if(se==="plan"&&(Ke==null?void 0:Ke.id)==="claude-code"?(fn(Le=>({...Le,permissionMode:se})),Ht(Le=>({...Le,permissionMode:se}))):(Ht(Le=>{const Ue={...Le};return delete Ue.permissionMode,Ue}),Xs({permissionMode:se})),!tn)return;const be=tn.id,Ae=++bt.current;ze(null),ur(()=>N.mutateAsync([be,se])).then(Le=>{H(Ue=>Ue.map(zn=>zn.id===Le.id?Le:zn)),bt.current===Ae&&Ht(Ue=>{const zn={...Ue};return delete zn.permissionMode,zn})}).catch(()=>{bt.current===Ae&&(Ht(Le=>{const Ue={...Le};return delete Ue.permissionMode,Ue}),ze(Y_e()))})},Ls=se=>Xs({reasoningLevel:se}),$r=(nn==null?void 0:nn.harness)==="claude-code"?nn.permissionMode==="plan":(Ut==null?void 0:Ut.planActivation)==="command"?Pt??(tn==null?void 0:tn.planMode)??!1:!1;R.useEffect(()=>{Pt===null||(tn==null?void 0:tn.planMode)!==Pt||(ot.current=null,zt(null))},[tn==null?void 0:tn.planMode,Pt]);async function Dr(se){if(fn(Le=>({...Le,planMode:se})),ot.current=se,zt(se),!tn)return;const be=tn.id,Ae=++$t.current;ze(null);try{const Le=await ur(()=>T.mutateAsync([be,se]));H(Ue=>Ue.map(zn=>zn.id===Le.id?Le:zn)),$t.current===Ae&&(ot.current=null,zt(null),ze(null))}catch(Le){throw $t.current===Ae&&(ot.current=null,zt(null)),Le}}async function cs(){if((nn==null?void 0:nn.harness)==="claude-code"){ls("auto");return}if(tn)try{await Dr(!1)}catch{ze(Jie())}}async function bs(){const se=!$r;try{if((nn==null?void 0:nn.harness)==="claude-code")ls(se?"plan":"auto");else if((Ut==null?void 0:Ut.planActivation)==="command")await Dr(se);else throw new Error(xx())}catch{ze(OE())}}function yr(se,be){const Ae=dA(se,be);ne(Ae.text),qt(!0),bs(),window.requestAnimationFrame(()=>{var Le,Ue;(Le=ln.current)==null||Le.focus(),(Ue=ln.current)==null||Ue.setSelectionRange(Ae.cursor,Ae.cursor),Ln(Ae.cursor)})}const ys=R.useCallback(async(se=!1)=>{const be=F.current;if(be.projectId!==e||!Pn($.queryKey))return null;const Ae=(nt.getQueryData($.queryKey)??[]).map(Le=>Le.id);try{const Le=await nt.fetchQuery({...$,...se?{staleTime:0}:{}});if(F.current!==be||!Pn($.queryKey))return null;const Ue=Le.filter(jn=>!uu.has(jn.id)),zn=new Set(Ue.map(jn=>jn.id));for(const jn of Ae)zn.has(jn)||cc(jn);return vt.current=new Map(Ue.map(jn=>[jn.id,jn.title])),Ue}catch{return null}},[e]),ia=R.useCallback(async se=>{F.current.projectId!==e||!Pn($.queryKey)||await Promise.all([nt.fetchQuery({...Bl(se),staleTime:0}),ys(!0)]).catch(()=>{})},[e,ys]);R.useEffect(()=>{const se=RO();G(e===Ex?new Set([h6,_6].filter(Ae=>!se.has(Ae))):new Set),ne(""),Se([]),Nr(new Map),vt.current=new Map,ys();const be=F.current;return()=>{F.current===be&&(F.current={projectId:e})}},[e,ys]),R.useEffect(()=>{fn(b0),Dn.current=null},[I]),R.useEffect(()=>iv(se=>{switch(se.type){case"session":{if(se.session.projectId!==e||uu.has(se.session.id))return;const be=vt.current.has(se.session.id),Ae=vt.current.get(se.session.id)!==se.session.title;vt.current.set(se.session.id,se.session.title),be&&Ae&&se.session.titleSource==="generated"&&(Nr(Le=>{const Ue=new Map(Le);return Ue.set(se.session.id,(Le.get(se.session.id)??0)+1),Ue}),window.setTimeout(()=>{Nr(Le=>{if(!Le.has(se.session.id))return Le;const Ue=new Map(Le);return Ue.delete(se.session.id),Ue})},_9t));break}case"sessionDeleted":cc(se.sessionId);break}}),[e]),R.useEffect(()=>iv(se=>{se.type==="reconnected"&&ys(!0)}),[ys]);const aa=I?we.messagesBySession[I]??bA:bA,Yo=I?we.activeLeafBySession[I]??null:null;bn.current=Yo;const Es=R.useMemo(()=>Wyt(aa,Yo),[aa,Yo]),Eu=R.useRef({projectId:e,ids:we.busySessions});R.useEffect(()=>{const se=Eu.current;Eu.current={projectId:e,ids:we.busySessions},se.projectId===e&&G(be=>Yyt(be,se.ids,we.busySessions,U,i==="chat"?I:null))},[e,we.busySessions,U,I,i]);const Bn=I?we.busySessions.has(I):!1,y_=!Bn&&!!(Ke!=null&&Ke.agentReady),Zl=Bn&&bB(Es)!=null,Xo=Bn&&Qyt(Es),Pr=I?we.queuedBySession[I]??[]:[],oa=Pr.some(se=>se.dispatchState==="retrying"),Jl=Pr.findIndex(se=>se.dispatchState==="blocked"),ji=Pr.reduce((se,be)=>be.dispatchState!=="retrying"||typeof be.nextRetryAt!="number"?se:se===null?be.nextRetryAt:Math.min(se,be.nextRetryAt),null),[La,ec]=R.useState(()=>Date.now());R.useEffect(()=>{if(!oa||ji===null||(ec(Date.now()),ji<=Date.now()))return;const se=window.setInterval(()=>{const be=Date.now();ec(be),be>=ji&&window.clearInterval(se)},1e3);return()=>window.clearInterval(se)},[oa,ji]),R.useEffect(()=>{const se=Pr.reduce((be,Ae)=>Ae.planMode??be,void 0);se!==void 0?(ft.current=!0,ot.current=se,zt(se)):ft.current&&(ft.current=!1,ot.current=null,zt(null))},[Pr]);const tc=!!I&&!(I in we.messagesBySession)&&Ze.isPending,nc=R.useMemo(()=>{const se=new Set;for(const be of we.busySessions)(we.messagesBySession[be]??[]).some(Ae=>Ae.parts.some(Le=>Le.type==="prompt"&&Le.prompt&&!Le.prompt.resolved&&Le.prompt.nativeId))&&se.add(be);return se},[we.busySessions,we.messagesBySession]),Ti=I?nc.has(I):!1,Nn=tn,rc=Nn?Wr.get(Nn.id):void 0,Rt=R.useMemo(()=>{var se;for(let be=Es.length-1;be>=0;be--)for(const Ae of Es[be].parts)if(Ae.type==="prompt"&&((se=Ae.prompt)==null?void 0:se.kind)==="plan"&&!Ae.prompt.resolved)return{promptId:Ae.id,plan:Ae.prompt.plan??"",synthesized:!!Ae.prompt.synthesized};return null},[Es]),hr=R.useMemo(()=>{const se=Nn==null?void 0:Nn.harness;if(!I||se!=="claude-code"&&se!=="codex")return null;for(let be=Es.length-1;be>=0;be--)for(const Ae of Es[be].parts)if(!(Ae.type!=="prompt"||!Ae.prompt||Ae.prompt.resolved)&&Ae.prompt.kind==="question")return Ae.prompt.nativeId&&!we.busySessions.has(I)?null:Ae.id;return null},[Es,Nn==null?void 0:Nn.harness,I,we.busySessions]),xs=ks&&!hr,la=se=>!hr&&!ks&&zi.some(be=>be.name===se),[Ai,oo]=R.useState(null),lo=Ai&&Ai.sessionId===I?Ai:null;R.useEffect(()=>{if(!Ai)return;const se=we.busySessions.has(Ai.sessionId),be=Ai.sessionId===I&&Rt&&Rt.promptId!==Ai.promptId;(!se||be)&&oo(null)},[Ai,Rt,we.busySessions,I]);const sc=R.useMemo(()=>bk(Es),[Es]),us=Bn&&!!(Ke!=null&&Ke.supportsSteering)&&!!(Ke!=null&&Ke.agentReady)&&!Rt&&!hr&&!sc&&pe.length===0&&Q.length===0,Os=R.useMemo(()=>p&&I?(se,be,Ae)=>p(se,I,be,Ae):void 0,[p,I]),ic=R.useMemo(()=>m&&I?(se,be,Ae)=>m(I,se,be,Ae):void 0,[m,I]),Zo=R.useMemo(()=>o&&((se,be,Ae,Le,Ue)=>o(se,I??void 0,be,Ae,Le,Ue)),[o,I]);R.useEffect(()=>{bt.current+=1,$t.current+=1;const se=(I?we.queuedBySession[I]??[]:[]).reduce((be,Ae)=>Ae.planMode??be,void 0);ft.current=se!==void 0,ot.current=se??null,zt(se??null),Ht({}),ze(null)},[I]);const Is=i==="chat"&&(Es.length>0||Bn),Oa=(nn==null?void 0:nn.harness)??null,Nu=(nn==null?void 0:nn.model)??null,Zs=Ze.data?null:Ze.error,Jo=i==="chat"&&!Is&&!tc&&!Zs,el=ct({...uht(e,Oa??"claude-code",Nu,j()),enabled:Jo&&Oa!==null,subscribed:Jo&&Oa!==null}),ac=((Kr=el.data)==null?void 0:Kr.prompts)??null,rf=Oa!==null&&el.isPending,zu=e===Ex?"demo":"project",ju=se=>{ne(se),qt(!1),window.requestAnimationFrame(()=>{const be=ln.current;be&&(be.focus(),be.setSelectionRange(se.length,se.length),Ln(se.length))})};R.useEffect(()=>{v&&(ne(v),qt(!1),Ln(v.length))},[v]);const co=R.useCallback(se=>{const be=se.scrollHeight-se.scrollTop-se.clientHeight<60;Jn.current=be,En(be)},[]),fi=R.useCallback(()=>{var se;Jn.current=!0,En(!0),(se=en.current)==null||se.call(en)},[]);R.useEffect(()=>{const se=un.current,be=Cn.current;if(!se||!be)return;const Ae=new ResizeObserver(()=>{var Le;Jn.current?(Le=en.current)==null||Le.call(en):En(se.scrollHeight-se.scrollTop-se.clientHeight<60)});return Ae.observe(se),Ae.observe(be),()=>Ae.disconnect()},[Is]);const oc=R.useCallback(se=>{se.currentTarget.blur(),fi()},[fi]);async function sf({queue:se=!1}={}){var Mt,Gn,Ns,zs,Ps,_i;if(sd({name:"first_action",surface:zu,action:"typed_prompt"}),br.current)return;const be=oe.trim(),Ae=hr?null:U8t(be,Ut==null?void 0:Ut.planActivation),Le=!!Ae,Ue=!$r,zn=fA(Ut==null?void 0:Ut.planActivation,Le?Ue:void 0,ot.current),jn=Le&&(Ke==null?void 0:Ke.id)==="claude-code"?Ue?"plan":"auto":void 0,dr=Ae?Ae.prompt:be,Mn=pe,_r=Q,da=_r.map(Tn=>({text:Tn.text})),hf=e,Ru=i;let nl=I;const $s=()=>{const Tn=ue.current;return Pn($.queryKey)&&Tn.projectId===hf&&Tn.activeId===nl&&Tn.mainView===Ru},fo=()=>{$s()&&(ne(Tn=>Tn||be),Se(Tn=>Tn.length?Tn:Mn),le(Tn=>Tn.length?Tn:_r))};if(Le&&!dr&&Mn.length===0&&_r.length===0){ne(""),qt(!1);try{if((Ke==null?void 0:Ke.id)==="claude-code")ls(Ue?"plan":"auto");else if((Ut==null?void 0:Ut.planActivation)==="command")await Dr(Ue);else throw new Error(xx())}catch{ze(OE()),fo()}return}const Z=nn?{...nn,...jn?{permissionMode:jn}:{}}:null;jn&&ls(jn);let ge=null;const Te=ot.current;Le&&(Ut==null?void 0:Ut.planActivation)==="command"&&(ge=++$t.current,ot.current=Ue,zt(Ue));const Pe=()=>{!$s()||ge===null||$t.current!==ge||(ot.current=Te,zt(Te))};if(!dr&&Mn.length===0&&_r.length===0)return;if((dr||_r.length>0)&&hr&&Mn.length===0){ne(""),le([]),uo({promptId:hr,answers:[],note:dr||void 0,annotations:da}).then(Tn=>{Tn||fo()});return}const Me=JSON.stringify({text:dr,images:Mn.map(Tn=>({mediaType:Tn.mediaType,name:Tn.name,dataUrl:Tn.dataUrl})),annotations:da,settings:Z?{model:Z.model,serviceTier:Z.serviceTier,permissionMode:Z.permissionMode,planMode:zn,reasoningLevel:Z.reasoningLevel}:null}),it=((Mt=Dn.current)==null?void 0:Mt.signature)===Me?Dn.current.id:`ct_${crypto.randomUUID()}`;if(Dn.current={signature:Me,id:it},Bn){if(!I||!(Ke!=null&&Ke.agentReady)){Pe();return}const Tn=I;ne(""),Se([]),le([]),qe(null);const Qr=Z?{model:Z.model,serviceTier:Z.serviceTier,permissionMode:Z.permissionMode,planMode:(Ut==null?void 0:Ut.planActivation)==="command"?zn??(tn==null?void 0:tn.planMode):zn,reasoningLevel:Z.reasoningLevel}:{};$s()&&Ht({});const Js=Mn.map(tr=>({mediaType:tr.mediaType,dataBase64:tr.dataUrl.slice(tr.dataUrl.indexOf(",")+1),name:tr.name}));try{(Gn=(await ur(()=>IN(Tn,dr,Qr,Js.length?Js:void 0,da,it,us&&!se&&!Le?"steer":void 0))).turn)!=null&&Gn.existing&&await ia(Tn),$s()&&fn(b0),((Ns=Dn.current)==null?void 0:Ns.id)===it&&(Dn.current=null)}catch{Pe(),fo()}return}if(!(Ke!=null&&Ke.agentReady)){Pe();return}if(!Z){Pe();return}let tt=I;try{br.current=!0;try{if(!tt){const ho=await Tu(Z,zn);tt=ho.id,nl=ho.id}if(!Pn($.queryKey))return;const pr=Bl(tt);await nt.fetchQuery({...pr,...((zs=nt.getQueryState(pr.queryKey))==null?void 0:zs.fetchStatus)==="fetching"?{staleTime:0}:{}})}finally{br.current=!1}if(!Pn($.queryKey))return;$s()&&(ne(pr=>pr===oe?"":pr),Se(pr=>pr===Mn?[]:pr),le(pr=>pr===_r?[]:pr),qe(null)),Re({type:"optimisticUser",sessionId:tt,text:dr||uie(),attachments:Mn.map(pr=>({url:pr.dataUrl,mediaType:pr.mediaType,name:pr.name})),annotations:_r}),Re({type:"busy",sessionId:tt,busy:!0}),$s()&&fi(),$s()&&ee==="archived"&&ce("active");const Tn=Z?{model:Z.model,serviceTier:Z.serviceTier,permissionMode:Z.permissionMode,planMode:zn,reasoningLevel:Z.reasoningLevel}:{};$s()&&Ht({});const Qr=Mn.map(pr=>({mediaType:pr.mediaType,dataBase64:pr.dataUrl.slice(pr.dataUrl.indexOf(",")+1),name:pr.name})),Js=tt;if(!Js)throw new Error(Xhe());(Ps=(await ur(()=>IN(Js,dr,Tn,Qr.length?Qr:void 0,da,it))).turn)!=null&&Ps.existing&&await ia(Js),$s()&&fn(b0),((_i=Dn.current)==null?void 0:_i.id)===it&&(Dn.current=null)}catch(Tn){if(!Pn($.queryKey)||(fo(),Pe(),!tt))return;const Qr=Tn instanceof Error?Tn.message:String(Tn);if(!/session is busy/i.test(Qr)&&await nt.fetchQuery({...Ea(e),staleTime:0}).then(tr=>{var _c;return!!((_c=tr.find(pr=>pr.id===tt))!=null&&_c.busy)}).catch(()=>!1)){$s()&&(ne(tr=>tr===dr?"":tr),Se(tr=>tr===Mn?[]:tr),le(tr=>tr===_r?[]:tr));return}Re({type:"busy",sessionId:tt,busy:!1}),Re({type:"localError",sessionId:tt,text:bae({error:Ne(Qr)})})}}async function Tu(se,be){const Ae=ue.current,Le=F.current,Ue=await z.mutateAsync([e,se.harness,{model:se.model,serviceTier:se.serviceTier,permissionMode:se.permissionMode,planMode:be,reasoningLevel:se.reasoningLevel}]);return F.current===Le&&(H(zn=>[Ue,...zn.filter(jn=>jn.id!==Ue.id)]),nt.getQueryData($.queryKey)||ys(!0)),F.current===Le&&ue.current===Ae&&(L.current(Ue.id,{replace:!0}),ue.current={...Ae,activeId:Ue.id}),Ue}function hi(){const se=eCt(oe);ne(se),window.requestAnimationFrame(()=>{var be,Ae;(be=ln.current)==null||be.focus(),(Ae=ln.current)==null||Ae.setSelectionRange(se.length,se.length),Ln(se.length)})}async function af(){const se=os;if(!se)return;if(ze(null),Bn){ze(Eie());return}const be=oe,Ae=ue.current;let Le=I;const Ue=()=>{const Mn=ue.current;return Mn.projectId===Ae.projectId&&Mn.activeId===Le&&Mn.mainView===Ae.mainView},zn=()=>{Ue()&&ne(Mn=>Mn||be)};ne(""),qt(!1);let jn=I;if(!jn){if(!(Ke!=null&&Ke.agentReady)||!nn){zn(),ze(xx());return}try{const Mn=fA(Ut==null?void 0:Ut.planActivation,void 0,ot.current);jn=(await Tu(nn,Mn)).id,Le=jn,Ue()&&Ht({})}catch(Mn){zn();const _r=Mn instanceof Error?Mn.message:String(Mn);Ue()&&ze(dE({error:Ne(_r)}));return}}Ue()&&ee==="archived"&&ce("active");const dr=`${Cd}shell-${Date.now()}`;Re({type:"localShell",sessionId:jn,id:dr,command:se}),Ue()&&fi();try{const{message:Mn}=await _ft(jn,se);Re({type:"upsertMessage",sessionId:jn,message:Mn})}catch(Mn){const _r=Mn instanceof Error?Mn.message:String(Mn);Re({type:"localShell",sessionId:jn,id:dr,command:se,error:dE({error:Ne(_r)})})}}function of(){I&&vft(I).catch(()=>{ze(g_e())})}const x_=R.useCallback(async(se,be)=>{if(!(!I||Jt.current)){Jt.current=!0,ze(null),Qn(se);try{const Ae=e2t({model:sn.model,serviceTier:sn.serviceTier,permissionMode:sn.permissionMode,planMode:sn.planMode,reasoningLevel:sn.reasoningLevel}),Le=I;(await pft(Le,se,be,Ae)).turn.existing&&await ia(Le),fn(b0)}catch{ze(ghe())}finally{Jt.current=!1,Qn(null)}}},[I,sn,ia]),w_=R.useCallback((se,be)=>{if(!I||Bn||!(Ke!=null&&Ke.agentReady))return;const Ae=I;Re({type:"busy",sessionId:Ae,busy:!0}),fi(),ur(()=>mft(Ae,se,be)).catch(Le=>{Re({type:"busy",sessionId:Ae,busy:!1});const Ue=Le instanceof Error?Le.message:String(Le);Re({type:"localError",sessionId:Ae,text:Che({error:Ne(Ue)})})})},[I,Bn,Ke==null?void 0:Ke.agentReady,fi,ur]),lc=R.useCallback(se=>{if(!I||Bn)return;const be=I,Ae=bn.current;Re({type:"activeLeaf",sessionId:be,leafId:se}),ur(()=>gft(be,se)).catch(Le=>{Re({type:"activeLeaf",sessionId:be,leafId:Ae});const Ue=Le instanceof Error?Le.message:String(Le);Re({type:"localError",sessionId:be,text:x_e({error:Ne(Ue)})})})},[I,Bn,ur]);function lf(se){if(!I)return;const be=I;dft(be,se).then(({removed:Ae})=>{if(Ae)return ia(be)}).catch(()=>ze(xhe()))}async function cf(se){if(!I||or)return;const be=I;ze(null),lr(se);try{await fft(be,se),await ia(be)}catch{ze(Mhe())}finally{lr(null)}}R.useEffect(()=>{if(!Bn||i!=="chat")return;function se(be){var Ae;be.key!=="Escape"||be.defaultPrevented||(be.preventDefault(),of(),(Ae=ln.current)==null||Ae.focus())}return document.addEventListener("keydown",se),()=>document.removeEventListener("keydown",se)},[Bn,I,i]);function cc(se){Zv(se),ue.current.projectId===e&&ue.current.activeId===se&&ue.current.mainView==="chat"&&L.current(null,{replace:!0}),G(be=>{if(!be.has(se))return be;const Ae=new Set(be);return Ae.delete(se),Ae}),vt.current.delete(se)}function uc(se,be){const Ae=se.archived;H(Le=>Le.map(Ue=>Ue.id===se.id?{...Ue,archived:be}:Ue)),M.mutateAsync([se.id,be]).catch(()=>{H(Le=>Le.map(Ue=>Ue.id===se.id?{...Ue,archived:Ae}:Ue))})}function uf(se,be){const Ae=se.title;H(Le=>Le.map(Ue=>Ue.id===se.id?{...Ue,title:be}:Ue)),O.mutateAsync([se.id,be]).catch(()=>{H(Le=>Le.map(Ue=>Ue.id===se.id?{...Ue,title:Ae}:Ue))})}async function S_(se){var Ae;const be=((Ae=se.title)==null?void 0:Ae.trim())||Eg();if(window.confirm(Gie({title:Do(be)}))){try{await B.mutateAsync(se.id)}catch(Le){Kn(Qie({title:Do(be),error:Ne(Le instanceof Error?Le.message:String(Le))}),"error");return}cc(se.id)}}const uo=R.useCallback(se=>{if(!I)return Promise.resolve(!1);const be=I;return Re({type:"busy",sessionId:be,busy:!0}),ur(()=>bft(be,se)).then(()=>!0).catch(()=>!1).finally(()=>{Pn($.queryKey)&&(nt.fetchQuery({...Bl(be),staleTime:0}).catch(()=>{}),nt.fetchQuery({...Ea(e),staleTime:0}).catch(()=>{}))})},[I,e,ur,$]),dc=U.filter(se=>u9t(ee,se.archived)),df=/Mac|iPhone|iPad/.test(navigator.platform),k_=df?"⌘ ⇧ ↵":"Ctrl + Shift + ↵",Bs=df?"⌘ Enter":"Ctrl + Enter",Rn=R.useCallback(()=>{ce("active"),w(null)},[w]),Au=R.useCallback(se=>{ce("all"),w(se)},[w]);R.useEffect(()=>{const se=be=>{be.repeat||be.key!=="Enter"||!be.metaKey&&!be.ctrlKey||be.altKey||!be.shiftKey||(be.preventDefault(),Rn())};return document.addEventListener("keydown",se),()=>document.removeEventListener("keydown",se)},[Rn]);const fc=f.jsxs("aside",{className:"session-rail w-68 shrink-0 flex flex-col mt-5 me-3.5 mb-5 ms-0 bg-background min-h-0 [&_.rail-body]:flex-1 [&_.rail-body]:min-h-0 [&_.rail-body]:overflow-y-auto [&_.rail-body]:pt-0 [&_.rail-body]:pb-1 [&_.rail-body]:px-2 border border-border rounded-lg overflow-visible shadow-elevated",children:[t,f.jsxs("nav",{className:"rail-nav flex flex-col gap-0.5 p-2 shrink-0",children:[f.jsxs("button",{className:"rail-nav-item flex items-center gap-2.5 py-[7px] px-2.5 text-base text-text rounded-md text-start hover:bg-surface [&[data-tip]::after]:top-auto [&[data-tip]::after]:bottom-[calc(100%_+_6px)]","data-onboarding":"new-session","data-tip":k_,"aria-keyshortcuts":"Meta+Shift+Enter Control+Shift+Enter",onClick:Rn,children:[f.jsx(em,{size:15}),Kce()]}),f.jsxs("button",{className:`rail-nav-item flex items-center gap-2.5 py-[7px] px-2.5 text-base text-text rounded-md text-start [&:hover:not(.active)]:bg-surface [&.active]:bg-panel [&.active]:font-medium ${i==="skills"?"active":""}`,onClick:()=>a("skills"),children:[f.jsx(LO,{size:15}),$le()]}),B8t.map(se=>f.jsxs("button",{className:`rail-nav-item flex items-center gap-2.5 py-[7px] px-2.5 text-base text-text rounded-md text-start [&:hover:not(.active)]:bg-surface [&.active]:bg-panel [&.active]:font-medium ${i!=="chat"&&i!=="skills"&&se.activeTabs.includes(i)?"active":""}`,"data-onboarding":se.id==="compute"?"nav-compute":void 0,onClick:()=>a(se.id),children:[se.icon,se.label()]},se.id))]}),f.jsxs("div",{className:"rail-section-head flex items-center justify-between shrink-0 pt-3.5 pe-2.5 pb-0 ps-4.5",children:[f.jsx("div",{className:"rail-section-label p-0 text-sm font-medium text-subtext",children:((ua=xF.find(se=>se.id===ee))==null?void 0:ua.railLabel())??kD()}),f.jsx("div",{className:"rail-section-actions flex items-center gap-0.5",children:f.jsx(d9t,{value:ee,onChange:ce})})]}),f.jsxs("div",{className:"rail-body",children:[dc.map(se=>f.jsx(p9t,{session:se,active:se.id===I&&i==="chat",unread:q.has(se.id),busy:we.busySessions.has(se.id),waiting:nc.has(se.id),revealTitle:Wr.get(se.id),onOpen:()=>{if(w(se.id),e===Ex){N0t(se.id);const be=eut[se.id];be&&(sd({name:"demo_experiment_started",kind:"curated",experiment:be}),sd({name:"first_action",surface:"demo",action:"open_experiment"}))}},onRename:be=>uf(se,be),onSetArchived:be=>uc(se,be),onDelete:()=>void S_(se)},se.id)),dc.length===0&&f.jsx("div",{className:"rail-empty py-1.5 px-2.5 text-sm text-muted",children:ee==="archived"?Bae():U.length>0?Tae():Hae()})]}),x.kind==="ssh"?f.jsx(uv,{runtime:x}):f.jsx("div",{className:"relative shrink-0 border-t border-border",children:f.jsxs("div",{className:"flex items-center gap-1.5 py-2 ps-1 pe-2.5",children:[f.jsx(Qt,{size:"small","aria-label":ZD(),"aria-haspopup":"dialog",onClick:()=>V(!0),children:f.jsx(e3,{size:14,className:"shrink-0"})}),f.jsxs("span",{className:"flex min-w-0 flex-col gap-1 text-start text-text",children:[f.jsx("span",{className:"truncate text-sm leading-tight",children:i6()}),f.jsxs("span",{className:"truncate text-xs leading-tight text-subtext",children:["OpenResearch ",Ne(x.version)]})]})]})}),Y&&f.jsx(m9t,{onClose:()=>V(!1),onConfigureSsh:()=>{V(!1),te(!0)}}),X&&f.jsx(KP,{onClose:()=>{te(!1),V(!0)}})]}),ca="chat-header flex items-center gap-2 py-0 px-4 bg-background shrink-0 h-12 relative z-4 w-full max-w-readable my-0 mx-auto [&::after]:content-[''] [&::after]:absolute [&::after]:top-full [&::after]:start-0 [&::after]:end-0 [&::after]:h-6 [&::after]:bg-[linear-gradient(to_bottom,_var(--base),_transparent)] [&::after]:pointer-events-none",ff=!r&&f.jsx(Qt,{title:RE(),"aria-label":RE(),onClick:s,children:f.jsx(KO,{size:20})});return i!=="chat"?f.jsxs(f.Fragment,{children:[r&&fc,f.jsxs("section",{className:"chat-pane flex-1 min-w-0 flex flex-col bg-background min-h-0",children:[!r&&f.jsx("div",{className:"flex h-12 shrink-0 items-center",children:ff}),f.jsx("div",{className:"settings-view-scroll flex-1 min-h-0 overflow-y-auto [scrollbar-gutter:stable_both-edges]",children:E})]})]}):f.jsxs(f.Fragment,{children:[r&&fc,f.jsxs("section",{className:"chat-pane flex-1 min-w-0 flex flex-col bg-background min-h-0 mt-5",children:[f.jsxs("div",{className:r?"contents":"grid shrink-0 grid-cols-[2rem_minmax(0,1fr)_2rem] items-center",children:[ff,f.jsxs("div",{className:ca,children:[f.jsx(op,{variant:"header",title:Nn?((Ia=Nn.title)==null?void 0:Ia.trim())||Eg():fE(),children:Nn?f.jsx(wF,{title:((hc=Nn.title)==null?void 0:hc.trim())||Eg(),animate:rc!==void 0},rc??"static"):fE()}),S&&f.jsx(Qt,{"data-tip":hE(),"aria-label":hE(),onClick:S,children:f.jsx(tpt,{size:15})})]})]}),Zs?f.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 p-5 text-subtext",role:"alert",children:[f.jsx("p",{children:Zs.message}),f.jsx(Oe,{onClick:()=>void Ze.refetch(),children:Ui()})]}):tc?f.jsxs("div",{className:"chat-loading flex-1 flex items-center justify-center gap-3 text-subtext text-xl p-5 [&_.spinner]:w-5.5 [&_.spinner]:h-5.5 [&_.spinner]:border-[3px]","aria-live":"polite","aria-busy":"true",children:[f.jsx(Lt,{}),f.jsx("span",{children:Uce()})]}):Is?f.jsx("div",{className:"chat-thread flex-1 min-h-0 overflow-y-auto [scrollbar-gutter:stable_both-edges]",ref:un,tabIndex:0,role:"region","aria-label":((tl=Nn==null?void 0:Nn.title)==null?void 0:tl.trim())||Eg(),onScroll:se=>{co(se.currentTarget),Ge.dismiss()},children:f.jsxs("div",{className:"chat-thread-inner max-w-readable my-0 mx-auto pt-4 px-4 pb-8 flex flex-col gap-4",ref:Cn,children:[f.jsx(c9t,{scrollRef:un,scrollToEndRef:en,stickToBottom:Jn,onPinToBottom:fi,messages:Es,allMessages:aa,canFork:y_,onFork:w_,onSelectFork:lc,busy:Bn,onOpenFile:Zo,onOpenRun:l,onOpenSpawnedSession:Au,runExperimentName:u,onOpenExperiment:_,experimentName:d,onRespond:uo,onOpenPlan:Os,onOpenSubagent:ic,recoveringTurnId:Zt,onRecover:x_,skills:zi},I),Bn&&Ti&&f.jsx("div",{className:"flex items-center gap-2 text-subtext text-sm pt-0.5 px-0 pb-2 italic",children:Tfe()}),Bn&&!Ti&&!Zl&&!Xo&&f.jsx("div",{className:"text-base pt-0.5 px-1 pb-2",children:f.jsx("span",{className:"tool-running-shimmer",children:j_e()})})]})}):f.jsxs("div",{className:"chat-empty flex-1 flex flex-col items-center justify-center text-text p-8 text-center [&_h2]:m-0 [&_h2]:text-5xl [&_h2]:font-medium [&_h2]:tracking-[-0.015em] [&_h2]:text-text",children:[f.jsx("div",{className:"chat-empty-mark w-10.5 h-10.5 mb-5.5 [&_svg]:block [&_svg]:w-full [&_svg]:h-full",children:f.jsx(B6,{})}),f.jsx("h2",{children:Dfe()}),f.jsxs("div",{className:"chat-empty-project inline-flex items-center gap-[7px] mt-3 py-1.5 px-3 border border-border rounded-full text-subtext bg-surface text-lg font-medium",children:[f.jsx(Dd,{size:19}),f.jsx("span",{children:n})]}),rf&&f.jsx("div",{className:kA,role:"status","aria-live":"polite","aria-label":efe(),"aria-busy":"true",children:SA.map((se,be)=>f.jsxs("div",{className:`flex min-h-22 animate-pulse flex-col items-start justify-center gap-2.5 rounded-xl border bg-background px-5 py-4 ${Ow[be].box}`,children:[f.jsxs("span",{className:`flex w-full items-center gap-2.5 ${Ow[be].icon}`,children:[f.jsx(se,{size:17}),f.jsx("span",{className:"h-3.5 w-2/5 rounded bg-surface-bright"})]}),f.jsx("span",{className:"h-3 w-4/5 rounded bg-surface"})]},be))}),ac&&ac.length>0&&f.jsx("div",{className:kA,role:"group","aria-label":sfe(),children:ac.map((se,be)=>{const Ae=SA[be],Le=Ow[be];return f.jsxs("button",{type:"button",className:`flex min-h-22 w-full min-w-0 cursor-pointer flex-col items-start justify-center gap-1.5 rounded-xl border bg-background px-5 py-4 text-start font-sans transition-colors duration-120 ease-standard hover:bg-surface ${Le.box}`,onClick:()=>{sd({name:"project_starter_clicked",slot:be+1}),sd({name:"first_action",surface:zu,action:"starter_click"}),ju(se.prompt)},children:[f.jsxs("span",{className:"flex items-center gap-2.5 text-base font-medium text-text",children:[f.jsx(Ae,{size:17,className:Le.icon}),se.title]}),f.jsx("span",{className:"w-full truncate text-sm text-subtext",children:se.prompt})]},be)})})]}),Ge.action&&f.jsxs(Oe,{type:"button",size:"small",className:"chat-selection-action fixed z-50 shadow-control",style:{left:Ge.action.x,top:Ge.action.top,transform:"translateX(-50%)"},onMouseDown:se=>se.preventDefault(),onClick:Ge.add,children:[f.jsx(VO,{size:14}),Toe()]}),f.jsxs("div",{className:"composer px-3 pb-5 shrink-0 relative z-4 bg-background w-full max-w-readable my-0 mx-auto [&_textarea]:border-0 [&_textarea]:bg-none [&_textarea]:bg-transparent [&_textarea]:resize-none [&_textarea]:pt-2.5 [&_textarea]:px-3 [&_textarea]:pb-1 [&_textarea]:text-base [&_textarea]:field-sizing-content [&_textarea]:min-h-18 [&_textarea]:max-h-45",children:[Is&&f.jsx(Qt,{className:`absolute bottom-full left-1/2 z-5 mb-6 h-9 w-9 -translate-x-1/2 rounded-full border border-border bg-background shadow-control transition-opacity duration-150 ease-standard ${hn?"opacity-0":"opacity-100"}`,title:LE(),"aria-label":LE(),inert:hn,onClick:oc,children:Bn&&!Ti?f.jsx(A6,{size:18,className:"tool-running-shimmer-icon"}):f.jsx(B0t,{size:16})}),Rt&&!(lo&&Rt.promptId===lo.promptId)&&f.jsx(K7t,{synthesized:Rt.synthesized,agentLabel:Nn?E0[Nn.harness]:C_e(),showResumeModes:(Nn==null?void 0:Nn.harness)==="claude-code",onView:se=>Os==null?void 0:Os(Rt.plan,Rt.promptId,se),onApprove:se=>uo({promptId:Rt.promptId,approve:!0,...se?{resumeMode:se}:{}}),onReject:()=>uo({promptId:Rt.promptId,approve:!1}),onRevise:se=>{I&&oo({sessionId:I,promptId:Rt.promptId}),uo({promptId:Rt.promptId,approve:!1,note:se})}}),Pr.length>0&&f.jsx("div",{className:"composer-queued flex flex-col gap-1 mb-1.5",children:Pr.map((se,be)=>f.jsxs("div",{className:"queued-chip flex flex-wrap items-center gap-x-2 gap-y-1 py-1.5 px-2.5 text-sm text-subtext bg-background border border-border rounded-sm",title:se.error?`${se.text} +`)}function dF(e){const n=e==null?void 0:e.replace(/[)'\"]+$/,"");return!n||n==="-"||/^\d+$/.test(n)||/[$`]/.test(n)||t2t(n)?null:n}function fF(e){const n=dF(e);if(!n)return null;const t=Zu(n);return n.includes("/")||n.startsWith(".")||/\.[A-Za-z0-9][A-Za-z0-9_-]*$/.test(t)||/^(?:Dockerfile|Makefile|README|LICENSE|NOTICE|CHANGELOG)$/i.test(t)?n:null}function hF(e){var s,i;const n=AS(e);let t=0;for(;["do","then","else","if","while","until"].includes(n[t]);)t++;for(;/^[A-Za-z_][A-Za-z0-9_]*=/.test(n[t]??"");)t++;if(n[t]==="command")for(t++;(s=n[t])!=null&&s.startsWith("-");)t++;if(n[t]==="env")for(t++;(i=n[t])!=null&&i.startsWith("-")||/^[A-Za-z_][A-Za-z0-9_]*=/.test(n[t]??"");)t++;const r=n[t];return r?{name:r.split("/").pop()??r,args:n.slice(t+1)}:null}function RCt(e){const{name:n,args:t}=e;if(n==="sed"){let s=0,i=!1;for(;s!i.startsWith("-")&&i.includes(":"));if(!n)return null;const t=n.indexOf(":"),r=n.slice(0,t),s=n.slice(t+1);return r&&fF(s)?{ref:r,path:s}:null}function DCt(e){const n=e.match(/\b(?:rg|grep)\b(?:\s+-[^\s]+)*\s+(?:"([^"]+)"|'([^']+)'|([^\s]+))/);return(n==null?void 0:n[1])??(n==null?void 0:n[2])??(n==null?void 0:n[3])??null}function yA(e,n){if(/[$`~]/.test(e)||/[$`~]/.test(n))return null;const t=n.startsWith("/")||!n.startsWith("/")&&e.startsWith("/"),r=n.startsWith("/")?[]:e.split("/").filter(Boolean);for(const i of n.split("/"))if(!(!i||i===".")){if(i===".."){r.length>0&&r[r.length-1]!==".."?r.pop():t||r.push(i);continue}r.push(i)}return`${t?"/":""}${r.join("/")}`||(t?"/":null)}function LCt(e,n,t,r){if(e.startsWith("/"))return e;let s=r??"";for(let i=0;i!u.startsWith("-"));if(!o)return null;const l=yA(s,o);if(!l)return null;s=l}return s?yA(s,e):e}const So="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",OCt=new RegExp(`\\bchat_(${So})\\b`,"gi"),Sd=`(?:${So}|[0-9a-f]{8})`;function uh(e){const n=[];let t="",r="",s=null,i=!1;const a=()=>{(t.trim()||r.trim())&&n.push({raw:t.trim(),code:r.trim()}),t="",r=""},o=u=>{let _=1,d=null,p=!1;for(let m=u;m{let _=!1;for(let d=u;da2t(t.raw,n))}function pa(e,n){return Jb(e,n).length>0}function ICt(e){if(!e)return[];const n=new Set;for(const t of e.slice(0,lF).matchAll(OCt))if(n.add(t[0].toLowerCase()),n.size>=cu)break;return[...n]}function i5(e,n){if(!e)return[];const t=new Set,r=e.slice(0,lF),s=n==="runs"?[new RegExp(`/runs/(${So})`,"gi"),new RegExp(`\\brun(?:_|\\s+)id:\\s*(${So})`,"gi"),new RegExp(`^\\s*RUN\\s+(${So})\\b`,"gim"),new RegExp(`={3,}\\s*(${So})\\s*={3,}`,"gi")]:[new RegExp(`/experiments/(${So})`,"gi"),new RegExp(`^\\s*id:\\s*(${So})`,"gim"),new RegExp(`={3,}\\s*(${So})\\s*={3,}`,"gi")];for(const a of s)for(const o of r.matchAll(a))if(t.add(o[1]),t.size>=cu)return[...t];const i=new RegExp(`^\\s*(${So})(?:\\s|$)`,"gim");for(const a of r.matchAll(i))if(t.add(a[1]),t.size>=cu)break;return[...t]}function _F(e,n){let t=0;return n.map(r=>{const s=e.indexOf(r.raw,t),i=s===-1?e.indexOf(r.raw):s;return t=Math.max(t,i+r.raw.length),{invocation:r,offset:Math.max(0,i)}})}function pF(e,n,t,r){const s=new RegExp(`(?:^|[\\s;])(?:export\\s+)?${n}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s;]+))`,"gi");let i="";for(const a of e.matchAll(s)){if((a.index??0)>=t)break;i=a[1]??a[2]??a[3]??""}return[...i.matchAll(new RegExp(r,"gi"))].map(a=>a[0])}function mF(e,n,t,r){const s=new RegExp(`\\bfor\\s+${n}\\s+in\\s+([\\s\\S]*?)(?:;|\\n)\\s*do\\b`,"gi");let i="";for(const a of e.matchAll(s)){const o=a.index??0;if(o>=t)break;const l=o+a[0].length;l<=t&&/\bdone\b/.test(e.slice(l,t))||(i=a[1])}return/\$\(|`/.test(i)?[]:[...i.matchAll(new RegExp(r,"gi"))].map(a=>a[0])}function BCt(e,n,t=[],r=[]){const s=Jb(e,"logs"),i=new Set;if(s.length===0){if(!pa(e,"logs"))return[];const o=t.length>0?[]:i5(n,"runs");for(const l of t.length>0?t:o.length>0?o:r)if(i.add(l),i.size>=cu)break;return ch([...i])}let a=!1;for(const{invocation:o,offset:l}of _F(e,s)){const u=Hh(o.raw);if((u==null?void 0:u[0])!=="logs")continue;const _=u.slice(1);let d=null;for(let v=0;v<_.length;v++){const b=_[v];if(b!=="--head"){if(b==="--bytes"||b==="--range"){v++;continue}if(!(b.startsWith("--bytes=")||b.startsWith("--range="))){d=b;break}}}if(!d){a=!0;continue}if(new RegExp(`^${Sd}$`,"i").test(d)){i.add(d);continue}const p=/^\$\{?([A-Za-z_][A-Za-z0-9_]*)\}?$/.exec(d);if(!p){a=!0;continue}const m=p[1],x=pF(e,m,l,Sd);for(const v of x)i.add(v);const S=mF(e,m,l,Sd);for(const v of S)i.add(v);x.length===0&&S.length===0&&(a=!0)}if(i.size===0||a){const o=t.length>0?[]:i5(n,"runs"),l=t.length>0?t:o.length>0?o:r;for(const u of l)if(i.add(u),i.size>=cu)break}return ch([...i])}function qf(e,n,t=[],r=[]){const s=Jb(e,"exp\\s+(?:status|desc)");if(s.length===0)return[];const i=new Set;let a=!1;for(const{invocation:o,offset:l}of _F(e,s)){const u=Hh(o.raw),_=(u==null?void 0:u[0])==="exp"&&(u[1]==="status"||u[1]==="desc")?u[2]:null;let d=!1;_&&new RegExp(`^${Sd}$`,"i").test(_)&&(i.add(_),d=!0);const p=_?/^\$\{?([A-Za-z_][A-Za-z0-9_]*)\}?$/.exec(_):null;if(p){const m=p[1],x=pF(e,m,l,Sd);if(x.length>0){for(const v of x)i.add(v);d=!0}const S=mF(e,m,l,Sd);for(const v of S)i.add(v);S.length>0&&(d=!0)}d||(a=!0)}if(i.size===0||a){const o=t.length>0?[]:i5(n,"experiments"),l=t.length>0?t:o.length>0?o:r;for(const u of l)if(i.add(u),i.size>=cu)break}return ch([...i])}const xA=new WeakMap;function Ld(e){const n=j(),t=xA.get(e);if((t==null?void 0:t.locale)===n)return t.activity;const r=$Ct(e);return xA.set(e,{locale:n,activity:r}),r}function $Ct(e){var b,w,y,C;const n=e.tool??"tool",t=((b=e.state)==null?void 0:b.input)??{},r=t.arguments,s=r&&typeof r=="object"&&!Array.isArray(r)?Object.fromEntries(Object.entries(r)):{},i={...t,...s},a=Ls(i,"command","cmd"),o=NCt(i,"commandArgv"),l=((w=e.state)==null?void 0:w.output)||((y=e.state)==null?void 0:y.error),u=ch(Dw(i,"targetIds")),_=ch(Dw(i,"runTargetIds")),d=ch(Dw(i,"experimentTargetIds")),p=Ls(i,"filePath","file_path","notebookPath","notebook_path","path"),m=Ls(i,"description"),x=n.toLowerCase().split(/(?::|\.|__)+/),S=x.at(-1)??n.toLowerCase();if(S==="run"&&x.includes("web")){const E=Mw(i,"search_query","q"),N=Mw(i,"image_query","q"),T=Mw(i,"find","pattern");return E?{kind:"web",label:nE({query:E})}:N?{kind:"web",label:FJ({query:N})}:T?{kind:"web",label:iee({pattern:T})}:Array.isArray(i.open)?{kind:"web",label:iue()}:Array.isArray(i.weather)?{kind:"web",label:zle()}:Array.isArray(i.finance)?{kind:"web",label:yle()}:Array.isArray(i.sports)?{kind:"web",label:kle()}:Array.isArray(i.time)?{kind:"web",label:mle()}:{kind:"web",label:mE()}}switch(new Map([["read_file","read"],["write_file","write"],["edit_file","edit"],["exec","bash"],["exec_command","bash"],["run_command","bash"],["agent","task"],["collabagenttoolcall","subagent"],["subagentactivity","subagent"]]).get(S)??S){case"bash":{if(!a&&!(o!=null&&o.length))return{kind:"command",label:Rue()};const E=jCt(a??(o==null?void 0:o.join(" "))??""),N=uh(E);let T=N.map(oe=>oe.raw);if(o!=null&&o.length){const oe=i2t(o);T=oe===null?[o]:uh(uF(oe)).map(te=>te.raw)}let z=null;for(const oe of T)if(z=o2t(oe),z)break;const M=T.some(oe=>{const te=Hh(oe);return te!==null&&te[0]!=="discover"&&te[0]!=="paper"});if(z&&!M){const oe=z.kind==="discover"?{keyword:SJ(),embedding:NJ(),openalex:ZJ(),biorxiv:AJ()}[z.strategy]:null,te=z.kind==="discover"?z.query?DX({activity:oe??tE(),query:z.query}):oe??tE():z.id?l0({target:Ne(z.id)}):kZ();return{kind:z.kind==="paper"?"read":"search",label:te,litCall:z}}if(pa(E,"agent\\s+spawn"))return{kind:"agent",label:Wle(),spawnedSessionIds:ICt(l),litCall:z??void 0};const I=N.map(oe=>hF(oe.raw)),B=pa(E,"exp\\s+status"),$=pa(E,"exp\\s+desc"),U=Jb(E,"exp\\s+desc").some(oe=>(Hh(oe.raw)??[]).some(Q=>Q==="--set"||Q.startsWith("--set=")||Q==="--stdin")),H=U?Mee():yZ(),Y=U?UY():sJ();if(pa(E,"logs")){const oe=BCt(E,l,_,u);return{kind:"project",label:oe.length===1?YZ():eJ(),runIds:oe,litCall:z??void 0}}if(pa(E,"exp\\s+run"))return{kind:"project",label:Yde(),litCall:z??void 0};if(pa(E,"exp\\s+wait"))return{kind:"project",label:Efe(),litCall:z??void 0};if(pa(E,"exp\\s+cancel"))return{kind:"project",label:Xoe(),litCall:z??void 0};const V=pa(E,"project\\s+view");if(V&&B&&$)return{kind:"project",label:Y,experimentIds:qf(E,l,d,u),litCall:z??void 0};if(V&&$)return{kind:"project",label:H,experimentIds:qf(E,l,d,u),litCall:z??void 0};if(V&&B)return{kind:"project",label:gE(),experimentIds:qf(E,l,d,u),litCall:z??void 0};if(V)return{kind:"project",label:Kue(),litCall:z??void 0};if(B&&$)return{kind:"project",label:Y,experimentIds:qf(E,l,d,u),litCall:z??void 0};if(B)return{kind:"project",label:gE(),experimentIds:qf(E,l,d,u),litCall:z??void 0};if($)return{kind:"project",label:H,experimentIds:qf(E,l,d,u),litCall:z??void 0};if(pa(E,"runs?"))return{kind:"project",label:Oce(),litCall:z??void 0};if(pa(E,"projects"))return{kind:"project",label:Pce(),litCall:z??void 0};if(pa(E,"compute"))return{kind:"project",label:ile(),litCall:z??void 0};const X=I.map(MCt).find(oe=>oe!=null);if(X){const oe=Rw(X.path);return{kind:oe?"skill":"read",label:oe?gx({name:Ne(oe)}):l0({target:Ne(Zu(X.path))}),filePath:X.path,fileRef:X.ref,labelTarget:oe?`${oe} skill`:Zu(X.path)}}const ee=I.findIndex(oe=>oe!=null&&["sed","cat","head","tail"].includes(oe.name)),O=ee>=0?I[ee]:null,L=O?RCt(O):null,F=L?LCt(L,N,ee,Ls(i,"cwd","workdir")):null;if(L&&F){const oe=Rw(F);return{kind:oe?"skill":"read",label:oe?gx({name:Ne(oe)}):l0({target:Ne(Zu(L))}),filePath:F,labelTarget:oe?`${oe} skill`:Zu(L)}}if(I.some(oe=>(oe==null?void 0:oe.name)==="find"||(oe==null?void 0:oe.name)==="ls"||(oe==null?void 0:oe.name)==="rg"&&oe.args.includes("--files")))return{kind:"search",label:kE()};const q=I.findIndex(oe=>(oe==null?void 0:oe.name)==="rg"||(oe==null?void 0:oe.name)==="grep");if(q>=0){const oe=DCt(N[q].raw);return{kind:"search",label:oe?bx({pattern:Ne(oe)}):vx(),searchPattern:oe??void 0}}const G=I.find(oe=>(oe==null?void 0:oe.name)==="git"),re=G==null?void 0:G.args[0];if(re==="grep"){const oe=G==null?void 0:G.args.slice(1).find(te=>!te.startsWith("-"));return{kind:"search",label:oe?bx({pattern:Ne(oe)}):vx(),searchPattern:oe}}if(re==="status")return{kind:"command",label:fle()};if(re==="diff")return{kind:"command",label:wde()};if(re==="log")return{kind:"command",label:Uue()};const ce=oe=>I.some(te=>!te||!["cargo","pnpm","npm","yarn"].includes(te.name)?!1:te.args[0]===oe||te.args[0]==="run"&&te.args[1]===oe);return ce("test")?{kind:"command",label:Oue()}:I.some(oe=>(oe==null?void 0:oe.name)==="tsc")||ce("typecheck")?{kind:"command",label:Rle()}:ce("lint")?{kind:"command",label:tle()}:ce("build")?{kind:"command",label:qoe()}:{kind:"command",label:lZ({command:Ne(E)})}}case"skill":{const E=Ls(i,"skill","name"),N=E?ECt(n,E):null;return{kind:"skill",label:E?YX({name:Ne(E)}):WX(),filePath:N??void 0,labelTarget:N&&E?`${E} skill`:void 0}}case"read":{const E=p?Zu(p):null,N=p?Rw(p):null;return N?{kind:"skill",label:gx({name:Ne(N)}),filePath:p??void 0,labelTarget:`${N} skill`}:E?{kind:"read",label:l0({target:Ne(E)}),filePath:p??void 0,labelTarget:E}:{kind:"read",label:Pue()}}case"edit":case"write":case"notebookedit":{const E=zCt(i),N=p??(E==null?void 0:E.path)??null,T=N?Zu(N):null,z=T?(E==null?void 0:E.type)==="add"?aX({target:Ne(T)}):(E==null?void 0:E.type)==="delete"?vX({target:Ne(T)}):EX({target:Ne(T)}):null;return T?{kind:"edit",label:z??yE(),filePath:N??void 0,labelTarget:T}:{kind:"edit",label:yE()}}case"grep":{const E=Ls(i,"pattern");return{kind:"search",label:E?bx({pattern:Ne(E)}):vx(),searchPattern:E??void 0}}case"glob":{const E=Ls(i,"pattern");return{kind:"search",label:E?BX({pattern:Ne(E)}):kE()}}case"websearch":{const E=Ls(i,"query"),N=Ls(i,"url"),T=Ls(i,"pattern");return E?{kind:"web",label:nE({query:E})}:T&&N?{kind:"web",label:KJ({pattern:T})}:N?{kind:"web",label:sZ({target:Ne(N)})}:{kind:"web",label:m??mE()}}case"webfetch":{const E=Ls(i,"url");return{kind:"web",label:E?l0({target:Ne(E)}):m??DZ()}}case"task":return{kind:"agent",label:m??fZ()};case"subagent":return{kind:"agent",label:PCt(i)};case"error":return{kind:"command",label:pfe()};case"contextcompaction":return{kind:"command",label:ZY(),progressLabel:nX()};default:{const E=m??p??a??((C=e.state)==null?void 0:C.title)??"";return{kind:"command",label:E?`${n}: ${E}`:n}}}}function PCt(e){const n=typeof e.nickname=="string"&&e.nickname?e.nickname.replace(/[_-]+/g," "):"",t=n&&n.charAt(0).toUpperCase()+n.slice(1);if(t)return t;switch(typeof e.tool=="string"?e.tool:""){case"spawnAgent":return gee();case"sendInput":return hee();case"resumeAgent":return HZ();case"wait":return Iee();case"closeAgent":return KY()}switch(typeof e.kind=="string"?e.kind:""){case"started":return jee();case"interacted":return RY();case"interrupted":return Cee()}return xee()}function Tv({activity:e,className:n=""}){const t={size:16,strokeWidth:1.75,className:"tool-kind-icon"};let r=f.jsx(i_,{...t});if(e.litCall)r=f.jsx(SB,{source:e.litCall.source,size:16,className:"tool-kind-icon"});else switch(e.kind){case"skill":r=f.jsx(LO,{...t});break;case"read":case"project":r=f.jsx(OO,{...t});break;case"search":r=f.jsx(YO,{...t});break;case"edit":r=f.jsx(D6,{...t});break;case"web":r=f.jsx(Opt,{...t});break;case"agent":r=f.jsx(I6,{...t});break}return f.jsx("span",{className:`flex h-6 shrink-0 items-center ${n}`,children:r})}function Lw({items:e,onOpen:n,onSelect:t,targetType:r}){const[s,i]=R.useState(!1),a=R.useRef(null),o=R.useRef(!1);return R.useEffect(()=>{var l,u;!s||!o.current||(o.current=!1,(u=(l=a.current)==null?void 0:l.querySelector("button"))==null||u.focus())},[s]),f.jsxs("span",{className:"tool-target-overflow inline",children:[s&&f.jsx("span",{className:"tool-target-reveal",ref:a,children:e.map((l,u)=>f.jsxs("span",{children:[u>0&&", ",n||t?f.jsx("button",{className:"tool-target",...n?Ur(_=>n(l.id,_),{stopPropagation:!0}):{onClick:_=>{_.stopPropagation(),t==null||t(l.id)}},children:l.label}):f.jsx("span",{children:l.label})]},l.id))}),s&&", ",f.jsx("button",{className:"tool-target-more","aria-expanded":s,"aria-label":s?eQ({target:r}):yY({count:Wt(e.length),target:r}),onClick:l=>{l.preventDefault(),l.stopPropagation(),o.current=!s&&l.detail===0,i(u=>!u)},children:s?zD():ope({count:Wt(e.length)})})]})}function a5({activity:e,onOpenFile:n,onOpenRun:t,onOpenSpawnedSession:r,runExperimentName:s,onOpenExperiment:i,experimentName:a}){var o,l,u,_;if(e.searchPattern)return e.label;if(((o=e.litCall)==null?void 0:o.kind)==="paper"&&e.litCall.id)return f.jsxs("a",{className:"tool-target",href:h2t(e.litCall.source,e.litCall.id),target:"_blank",rel:"noopener noreferrer",children:[e.label,f.jsx(H0t,{className:"inline ms-1 opacity-50",size:13,"aria-hidden":"true"})]});if(e.filePath&&e.labelTarget&&n){const d=e.filePath;return f.jsx("span",{className:"tool-target",role:"button",tabIndex:0,...Ur(p=>n(d,void 0,void 0,e.fileRef,p),{stopPropagation:!0}),children:e.label})}if((l=e.spawnedSessionIds)!=null&&l.length&&r){const d=e.spawnedSessionIds,p=d.slice(0,3),m=d.slice(p.length).map((x,S)=>({id:x,label:uE({number:Wt(p.length+S+1)})}));return f.jsxs(f.Fragment,{children:[e.label," — ",p.map((x,S)=>f.jsxs("span",{children:[S>0&&", ",f.jsx("button",{className:"tool-target",title:tue(),onClick:v=>{v.preventDefault(),v.stopPropagation(),r(x)},children:uE({number:Wt(S+1)})})]},x)),m.length>0&&f.jsxs(f.Fragment,{children:[", ",f.jsx(Lw,{items:m,onSelect:r,targetType:Gse()})]})]})}if((u=e.runIds)!=null&&u.length){const d=s?e.runIds.filter(x=>!!s(x)):e.runIds;if(d.length===0)return e.label;const p=d.slice(0,3),m=d.slice(p.length).map(x=>({id:x,label:(s==null?void 0:s(x))||Sl()}));return f.jsxs(f.Fragment,{children:[e.label," — ",p.map((x,S)=>f.jsxs("span",{children:[S>0&&", ",t?f.jsx("button",{className:"tool-target",title:AQ({run:Ne(x)}),...Ur(v=>t(x,v),{stopPropagation:!0}),children:(s==null?void 0:s(x))||Sl()}):f.jsx("span",{children:(s==null?void 0:s(x))||Sl()})]},x)),m.length>0&&f.jsxs(f.Fragment,{children:[", ",f.jsx(Lw,{items:m,onOpen:t,targetType:Ihe()})]})]})}if((_=e.experimentIds)!=null&&_.length){const d=a?e.experimentIds.filter(x=>!!a(x)):e.experimentIds;if(d.length===0)return e.label;const p=d.slice(0,3),m=d.slice(p.length).map(x=>({id:x,label:(a==null?void 0:a(x))||Sl()}));return f.jsxs(f.Fragment,{children:[e.label," — ",p.map((x,S)=>f.jsxs("span",{children:[S>0&&", ",i?f.jsx("button",{className:"tool-target",title:bQ({name:(a==null?void 0:a(x))||Ne(x)}),...Ur(v=>i(x,v),{stopPropagation:!0}),children:(a==null?void 0:a(x))||Sl()}):f.jsx("span",{children:(a==null?void 0:a(x))||Sl()})]},x)),m.length>0&&f.jsxs(f.Fragment,{children:[", ",f.jsx(Lw,{items:m,onOpen:i,targetType:oae()})]})]})}return e.label}function vk(e){const n=e.progressLabel??{skill:eZ(),read:BZ(),search:cee(),edit:TX(),project:lJ(),web:PY(),agent:_X(),command:_D()}[e.kind];return{...e,label:n}}function gF(e,n){const t=Ld({id:"permission-preview",type:"tool",tool:e,state:{status:"running",input:n}});return{skill:HX(),read:mZ(),search:bJ(),edit:wX(),project:WZ(),web:OY(),agent:uX(),command:fJ()}[t.kind]}function FCt(e){return e==null?!0:typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0}const HCt=250;function qCt(e,n){const[t,r]=R.useState(e),s=R.useRef(Date.now()),i=R.useRef(e);return R.useEffect(()=>{if(i.current=e,(e==null?void 0:e.label)===(t==null?void 0:t.label)||n&&e!=null&&t!=null)return;if(e==null||t==null){s.current=Date.now(),r(e);return}const a=HCt-(Date.now()-s.current);if(a<=0){s.current=Date.now(),r(e);return}const o=window.setTimeout(()=>{s.current=Date.now(),r(i.current)},a);return()=>window.clearTimeout(o)},[e,t,n]),e!=null&&e.label===(t==null?void 0:t.label)?e:t}const UCt=160;function vF(e){const[n,t]=R.useState(!1);return R.useEffect(()=>{if(!e){t(!1);return}const r=window.setTimeout(()=>t(!0),UCt);return()=>window.clearTimeout(r)},[e]),e&&n}function GCt(e){const n=["skill","read","search","edit","project","web","command","agent"];for(const t of n){const r=e.find(s=>s.kind===t);if(r)return r}return e[0]??{kind:"command",label:wD()}}function WCt(e,n){var t,r;return((t=e.state)==null?void 0:t.status)!=="completed"?null:JSON.stringify([n.kind,n.label,n.filePath??null,n.fileRef??null,((r=n.litCall)==null?void 0:r.kind)==="paper"?n.litCall.id??null:null,n.runIds??null,n.experimentIds??null,n.spawnedSessionIds??null])}function VCt(e){const n=[];let t=null;for(const r of e){const s=Ld(r),i=WCt(r,s),a=n[n.length-1];i&&a&&t===i?a.count++:n.push({part:r,activity:s,count:1}),t=i}return n}function bF({part:e,busy:n,recovering:t,onRecover:r,usageLimited:s=!1}){var x,S;const i=(x=e.state)==null?void 0:x.input,a=(i==null?void 0:i.nextRetryAt)??null,[o,l]=R.useState(Date.now());if(R.useEffect(()=>{if(typeof a!="number"||(l(Date.now()),a<=Date.now()))return;const v=window.setInterval(()=>{const b=Date.now();l(b),b>=a&&window.clearInterval(v)},1e3);return()=>window.clearInterval(v)},[a]),e.id==="turn-retry"){const v=Zyt(i??{},o);return f.jsxs("div",{className:"turn-retry-row flex items-center gap-2 py-1 px-1 text-sm text-subtext",children:[f.jsx(Lt,{}),f.jsx("span",{children:v})]})}const u=xB(i==null?void 0:i.recoveryAction),_=i==null?void 0:i.turnId,d=yB(e)?Sae():s?Vhe():IE(),p=s?Apt:O6,m=Zb(((S=e.state)==null?void 0:S.error)||IE());return f.jsxs("details",{className:"turn-usage-limit group/limit text-base text-subtext",children:[f.jsxs("summary",{className:"flex w-fit max-w-full items-center gap-2 cursor-pointer list-none rounded-sm focus-visible:outline-2 focus-visible:outline-text [&::-webkit-details-marker]:hidden",children:[f.jsx(p,{size:18,className:"shrink-0 text-accent-red","aria-hidden":"true"}),f.jsx("span",{children:d}),f.jsx(Ca,{size:16,className:"shrink-0 text-text transition-transform duration-120 ease-standard group-open/limit:rotate-90 motion-reduce:transition-none","aria-hidden":"true"})]}),f.jsx("pre",{className:"mt-2 rounded-md bg-surface p-2 text-sm font-mono whitespace-pre-wrap wrap-anywhere",children:m}),!s&&r&&_&&(u==="retry"||u==="continue")&&f.jsx(Le,{type:"button",size:"small",className:"mt-2",disabled:n||t,onClick:()=>r(_,u),children:t?c_e():u==="retry"?Fi():Fie()})]})}function wA({part:e,activity:n,repeatCount:t=1,onOpenFile:r,onOpenRun:s,onOpenSpawnedSession:i,runExperimentName:a,onOpenExperiment:o,experimentName:l}){const u=e.state,_=(u==null?void 0:u.status)==="error",d=Zb((u==null?void 0:u.error)||(u==null?void 0:u.output)||""),p=_&&!!d,[m,x]=R.useState(!1),S=`tool-error-${e.id.replace(/[^A-Za-z0-9_-]/g,"-")}`;if(e.tool==="error")return f.jsx(bF,{part:e,busy:!1,recovering:!1,usageLimited:v3(e)});const v=f.jsxs(f.Fragment,{children:[_&&f.jsxs("span",{className:"sr-only",children:[J5()," "]}),_?f.jsx("span",{className:"flex h-6 shrink-0 items-center text-accent-red",children:f.jsx(PO,{size:16,strokeWidth:1.75,className:"tool-kind-icon","aria-hidden":"true"})}):f.jsx(Tv,{activity:n,className:"text-muted"}),f.jsxs("span",{className:`${aF} ${_?"text-accent-red":"text-subtext"}`,children:[f.jsx(a5,{activity:n,onOpenFile:r,onOpenRun:s,onOpenSpawnedSession:i,runExperimentName:a,onOpenExperiment:o,experimentName:l}),t>1&&f.jsxs("span",{className:"tool-repeat-count ms-1 text-muted font-normal",title:lQ({count:Wt(t)}),children:["×",t]})]})]});return p?f.jsxs("div",{className:"tool-row tool-row-error flex flex-col min-w-0",children:[f.jsxs("div",{className:"flex items-start gap-2 w-fit max-w-full py-[3px] px-1 min-w-0 rounded-sm",children:[v,f.jsx("button",{type:"button",className:"tool-row-detail-toggle inline-flex h-6 shrink-0 items-center justify-center p-0.5 rounded-sm cursor-pointer hover:bg-surface","aria-expanded":m,"aria-controls":S,"aria-label":m?sQ({activity:n.label}):mY({activity:n.label}),onClick:()=>x(b=>!b),children:f.jsx(Ca,{size:16,className:`text-accent-red transition-transform duration-120 ease-standard ${m?"rotate-90":""}`})})]}),m&&f.jsx("div",{className:"tool-detail mt-1 me-0 mb-1 ms-6",id:S,children:f.jsx("div",{className:mk,children:d.slice(0,2e4)})})]}):f.jsx("div",{className:"tool-row flex items-start gap-2 min-w-0 py-[3px] px-1",children:v})}function KCt({parts:e,pendingTail:n,onOpenFile:t,onOpenRun:r,onOpenSpawnedSession:s,runExperimentName:i,onOpenExperiment:a,experimentName:o}){var z,M,I,B;const[l,u]=R.useState(!1),[_,d]=R.useState(!1),p=()=>{d(!0),u($=>!$)},m=VCt(e),x=m.map(({activity:$})=>$),S=n?m.at(-1):void 0,v=S==null?void 0:S.part,b=S==null?void 0:S.activity,w=((z=v==null?void 0:v.state)==null?void 0:z.status)!=="error"?(b&&vk(b))??null:null,y=!!v&&((M=v.state)==null?void 0:M.status)==="running"&&!(w!=null&&w.progressLabel)&&(FCt((I=v.state)==null?void 0:I.input)||(w==null?void 0:w.kind)==="command"&&!Ls(((B=v.state)==null?void 0:B.input)??{},"command","cmd")),C=qCt(w,y),E=vF(C!=null),N=C??GCt(x),T=C?C.label:wD();return e.length===1?C?f.jsx("div",{className:"tool-group my-3.5 mx-0",children:f.jsxs("div",{className:"tool-row flex items-start gap-2 min-w-0 py-[3px] px-1 text-base leading-6 text-subtext",children:[f.jsx(Tv,{activity:C,className:E?"tool-running-shimmer-icon":"text-muted"}),f.jsx("span",{className:`${E?"tool-running-shimmer":""} min-w-0 line-clamp-2 break-words`,title:T,children:f.jsx(a5,{activity:C,onOpenFile:t,onOpenRun:r,onOpenSpawnedSession:s,runExperimentName:i,onOpenExperiment:a,experimentName:o})})]})}):f.jsx("div",{className:"tool-group my-3.5 mx-0",children:f.jsx(wA,{part:e[0],activity:m[0].activity,onOpenFile:t,onOpenRun:r,onOpenSpawnedSession:s,runExperimentName:i,onOpenExperiment:a,experimentName:o})}):f.jsxs("div",{className:"tool-group my-3.5 mx-0",children:[f.jsxs("div",{className:"tool-group-summary flex items-start gap-2 w-fit max-w-full py-[3px] px-1 text-base leading-6 text-subtext text-start",children:[f.jsx(Tv,{activity:N,className:E?"tool-running-shimmer-icon":"text-muted"}),C?f.jsx("span",{className:`tool-group-label min-w-0 line-clamp-2 break-words ${E?"tool-running-shimmer":""}`,title:T,children:f.jsx(a5,{activity:C,onOpenFile:t,onOpenRun:r,onOpenSpawnedSession:s,runExperimentName:i,onOpenExperiment:a,experimentName:o})}):f.jsx("button",{type:"button",className:"tool-group-label min-w-0 whitespace-normal break-words cursor-pointer text-start",onClick:p,"aria-expanded":l,children:T}),f.jsx("button",{type:"button",className:"tool-group-chevron-button inline-flex h-6 shrink-0 items-center justify-center p-px cursor-pointer rounded-sm",onClick:p,"aria-expanded":l,"aria-label":l?Iie():rae(),children:f.jsx(Ca,{size:16,className:`tool-chevron text-muted transition-[transform,color] duration-120 ease-standard [&.open]:rotate-90 ${l?"open":""}`})})]}),f.jsx("div",{className:`tool-group-disclosure ${l?"open":""}`,"aria-hidden":!l,inert:!l,children:f.jsx("div",{className:"tool-group-disclosure-inner",children:f.jsx("div",{className:"tool-group-rows flex flex-col gap-px mt-0.5 me-0 mb-1 ms-6",children:_&&m.map(({part:$,count:U,activity:H})=>f.jsx(wA,{part:$,repeatCount:U,activity:H,onOpenFile:t,onOpenRun:r,onOpenSpawnedSession:s,runExperimentName:i,onOpenExperiment:a,experimentName:o},$.id))})})})]})}function QCt({part:e,onRespond:n,onOpenFile:t,onOpenPlan:r}){var _;const s=e.prompt,[i,a]=R.useState([]),o=!n,l=d=>n==null?void 0:n({promptId:e.id,...d});if(s.resolved){if(s.kind==="permission")return null;if(s.kind==="plan"){const m=s.approved===!0?{label:hue(),icon:wa,iconClass:"text-accent-green"}:s.approved===!1&&s.note?{label:Cue(),icon:D6,iconClass:"text-accent-amber"}:s.approved===!1?{label:gue(),icon:qr,iconClass:"text-accent-red"}:{label:xue(),icon:cb,iconClass:"text-muted"},x=m.icon;return f.jsxs("details",{className:SCt,children:[f.jsxs("summary",{children:[f.jsx("span",{className:"plan-resolved-label text-base font-[375] wrap-anywhere",children:s.synthesized?SD():DE()}),f.jsx(x,{size:17,strokeWidth:1.8,className:`shrink-0 ${m.iconClass}`}),f.jsx("span",{className:"plan-resolved-label prompt-outcome text-base font-[375] wrap-anywhere",children:m.label}),f.jsx(Ca,{size:12,className:"plan-chevron shrink-0 text-muted"})]}),f.jsxs("div",{className:`${vA} ms-6`,children:[f.jsx($o,{text:s.plan??"",onOpenFile:t}),s.note&&f.jsx("div",{className:"prompt-collapsed-note mt-1.5 italic",children:s.note})]})]})}const d=(s.answers??[]).join(", ")||s.note||"",p=(s.annotations??[]).map((m,x)=>({id:`${e.id}-annotation-${x}`,text:m.text}));return f.jsxs("div",{className:"flex flex-col items-end gap-1.5",children:[p.length>0&&f.jsx(gk,{annotations:p,variant:"sent"}),f.jsxs("details",{className:wCt,children:[f.jsxs("summary",{children:[f.jsx("span",{className:"prompt-collapsed-title font-[375] wrap-anywhere",children:s.header||s.question||nhe()}),f.jsx("span",{className:`prompt-outcome font-[375] text-subtext wrap-anywhere [&.approved]:text-accent-green [&.chosen]:text-accent-green [&.approved::before]:content-['✓_'] [&.chosen::before]:content-['✓_'] [&.revised]:text-accent-amber [&.rejected]:text-accent-amber ${d?"chosen":""}`,children:d||jhe()})]}),f.jsxs("div",{className:vA,children:[s.header&&s.question&&f.jsx("div",{className:"prompt-q text-base font-semibold leading-normal text-text",children:s.question}),(s.options??[]).length>0&&f.jsx("ul",{className:"prompt-collapsed-options mt-1.5 mx-0 mb-0 ps-4.5 [&_.sel]:text-text [&_.sel]:font-medium",children:(s.options??[]).map(m=>{var x;return f.jsx("li",{className:(x=s.answers)!=null&&x.includes(m.label)?"sel":"",children:m.label},m.label)})}),s.note&&s.note!==d&&f.jsx("div",{className:"prompt-collapsed-note mt-1.5 italic",children:s.note})]})]})]})}if(s.kind==="plan"){const d=!!r;return f.jsxs("div",{className:`prompt-card my-2 mx-0 py-3 px-3.5 border border-border border-s-[3px] border-s-border rounded-sm bg-surface flex flex-col gap-[9px] [&.plan]:border-s-accent-blue [&.permission]:border-s-accent-amber [&.question]:border-s-accent-purple [&.readonly]:opacity-60 plan ${o?"readonly":""}`,children:[f.jsx("div",{className:"prompt-head text-base font-semibold text-text",children:s.synthesized?Qfe():DE()}),f.jsx("div",{className:`prompt-plan text-base leading-[1.6] text-text max-h-85 overflow-y-auto [&.clamped]:max-h-[9.5em] [&.clamped]:overflow-hidden [&.clamped]:relative [&.clamped::after]:content-[''] [&.clamped::after]:absolute [&.clamped::after]:inset-x-0 [&.clamped::after]:bottom-0 [&.clamped::after]:top-auto [&.clamped::after]:h-8.5 [&.clamped::after]:bg-[linear-gradient(to_bottom,_transparent,_var(--surface))] [&.clamped::after]:pointer-events-none ${d?"clamped":""}`,children:f.jsx($o,{text:s.plan??"",onOpenFile:t})}),d&&f.jsx("button",{className:"prompt-plan-open self-start border-0 bg-transparent text-accent-blue text-sm p-0 cursor-pointer [&:hover]:underline",...Ur(p=>r(s.plan??"",e.id,p)),children:wfe()}),!o&&!d&&f.jsxs("div",{className:s5,children:[f.jsx(Le,{size:"small",variant:"primary",onClick:()=>l({approve:!0,resumeMode:"auto"}),children:roe()}),f.jsx(Le,{size:"small",onClick:()=>l({approve:!0,resumeMode:"bypassPermissions"}),children:ooe()}),f.jsx(Le,{size:"small",onClick:()=>l({approve:!1}),children:Zue()})]})]})}if(s.kind==="permission"){const d=s.toolInput??{},p=Ls(d,"command","cmd","filePath","file_path","path")||"",m=typeof((_=s.toolInput)==null?void 0:_.reason)=="string"&&s.toolInput.reason||"",x=Ls(d,"description")||"",S=m||x||gF(s.tool,d),v=`permission-heading-${e.id}`;return f.jsxs("div",{className:`prompt-card permission my-3 w-full max-w-2xl overflow-hidden rounded-md border border-border bg-background shadow-hairline [&.readonly]:opacity-60 ${o?"readonly":""}`,role:"group","aria-labelledby":v,children:[f.jsxs("div",{className:"flex items-center gap-2.5 px-3.5 pt-3 pb-0",children:[f.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-accent-amber-subtle text-accent-amber",children:f.jsx(O6,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),f.jsx("span",{id:v,className:"text-base font-semibold text-text",children:Soe()})]}),f.jsxs("div",{className:"flex flex-col gap-3 px-3.5 py-3",children:[f.jsx("div",{className:"prompt-sub text-base font-normal leading-normal text-text wrap-anywhere",children:S}),p&&f.jsx("code",{className:"prompt-command block max-h-36 overflow-auto whitespace-pre-wrap wrap-anywhere rounded-md border border-border-variant bg-surface px-3 py-2 font-mono text-sm leading-relaxed text-text",children:p}),!o&&f.jsxs("div",{className:"prompt-actions flex items-center justify-end gap-2 pt-0.5",children:[f.jsx(Le,{size:"small",variant:"ghost",onClick:()=>l({approve:!1}),children:Jle()}),f.jsx(Le,{size:"small",variant:"primary",onClick:()=>l({approve:!0}),children:boe()})]})]})]})}const u=d=>a(p=>s.multiSelect?p.includes(d)?p.filter(m=>m!==d):[...p,d]:[d]);return f.jsxs("div",{className:`prompt-card my-2 mx-0 py-3 px-3.5 border border-border border-s-[3px] border-s-border rounded-sm bg-surface flex flex-col gap-[9px] [&.plan]:border-s-accent-blue [&.permission]:border-s-accent-amber [&.question]:border-s-accent-purple [&.readonly]:opacity-60 question ${o?"readonly":""}`,children:[s.header&&f.jsx("div",{className:kCt,children:s.header}),s.question&&f.jsx("div",{className:"prompt-q text-base font-semibold leading-normal text-text",children:s.question}),f.jsx("div",{className:"prompt-options flex flex-col gap-1.5",children:(s.options??[]).map(d=>{const p=i.includes(d.label);return f.jsxs("button",{className:`prompt-option flex flex-col items-start gap-0.5 w-full py-2 px-[11px] text-start border border-border rounded-sm bg-background text-text cursor-pointer transition-[border-color,background] duration-80 ease-standard [&:hover:not(:disabled)]:border-border-strong [&:hover:not(:disabled)]:bg-surface [&.sel]:border-primary [&.sel]:bg-primary-subtle [&:disabled]:cursor-default ${p?"sel":""}`,disabled:o,onClick:()=>o?void 0:s.multiSelect?u(d.label):l({answers:[d.label]}),children:[f.jsx("span",{className:"prompt-option-label block text-sm font-medium",children:d.label}),d.description&&f.jsx("span",{className:"prompt-option-desc block text-sm font-normal leading-[1.45] text-subtext",children:d.description})]},d.label)})}),s.multiSelect&&!o&&f.jsx("div",{className:s5,children:f.jsx(Le,{size:"small",variant:"primary",disabled:i.length===0,onClick:()=>l({answers:i}),children:dfe()})})]})}function YCt(e,n){return e.role==="user"?!0:e.parts.some(t=>Fh(t,n))}function XCt(e){const n=e.text??"",t=n.startsWith("data:")?n:hft(n),r=n.startsWith("data:")?"":n.includes("__")?n.slice(n.indexOf("__")+2):n,s=e.name||r||"attachment",i=n.startsWith("data:application/pdf")||/\.pdf$/i.test(s)||/\.pdf$/i.test(n);return{src:t,isPdf:i,name:s}}function ZCt({text:e,createdAt:n,count:t,index:r,prevId:s,nextId:i,onSelect:a,pagerDisabled:o,onEdit:l,editDisabled:u}){const _=t>1,d=new Date(n),p=async()=>{try{if(!navigator.clipboard)throw new Error(AD());await navigator.clipboard.writeText(e),Vn(tp(),"success")}catch(m){Vn(m instanceof Error?m.message:String(m),"error")}};return f.jsxs("div",{className:`fork-controls flex items-center gap-0.5 transition-opacity duration-80 ease-standard ${_?"opacity-100":"opacity-0 group-hover/turn:opacity-100 group-focus-within/turn:opacity-100"}`,children:[_&&f.jsxs(f.Fragment,{children:[f.jsx(Yt,{size:"small",title:EE(),"aria-label":EE(),disabled:o||!s,onClick:()=>s&&a(s),children:f.jsx(IO,{size:14})}),f.jsxs("span",{className:"fork-count text-xs text-subtext tabular-nums select-none",children:[r+1,"/",t]}),f.jsx(Yt,{size:"small",title:CE(),"aria-label":CE(),disabled:o||!i,onClick:()=>i&&a(i),children:f.jsx(Ca,{size:14})})]}),f.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 group-hover/turn:opacity-100 group-focus-within/turn:opacity-100 transition-opacity duration-80 ease-standard",children:[f.jsx("time",{dateTime:d.toISOString(),className:"text-xs text-subtext tabular-nums me-2",children:d.toLocaleTimeString(j(),{hour:"numeric",minute:"2-digit"})}),f.jsx(Yt,{size:"small","aria-label":n6(),disabled:!e,onClick:p,children:f.jsx(lb,{size:13})})]}),f.jsx(Yt,{size:"small",title:bE(),"aria-label":bE(),disabled:u,onClick:l,children:f.jsx(D6,{size:13})})]})}const JCt=R.memo(function({message:n,activePermissionId:t,pendingTailToolId:r,onOpenFile:s,onOpenRun:i,onOpenSpawnedSession:a,runExperimentName:o,onOpenExperiment:l,experimentName:u,onRespond:_,onOpenPlan:d,onOpenSubagent:p,busy:m=!1,recoveringTurnId:x,onRecover:S,skills:v,predictTextTail:b=!1,forkCount:w,forkIndex:y=0,forkPrevId:C,forkNextId:E,forkDisabled:N,branchDisabled:T,onFork:z,onSelectFork:M}){var V,X;Gd();const[I,B]=R.useState(null),$=t9t(n);if($)return f.jsx(n9t,{part:$});if(n.role==="user"){const ee=n.parts.filter(re=>re.type==="text").map(re=>re.text??"").join(` +`),O=re=>!!(v!=null&&v.some(ce=>ce.name===re)),L=n.parts.filter(re=>re.type==="image"&&re.text).map(XCt),F=L.filter(re=>!re.isPdf),q=L.filter(re=>re.isPdf),G=n.parts.filter(re=>re.type==="annotation"&&re.text).map(re=>({id:re.id,text:re.text??""}));if(I!==null){const re=()=>{const ce=I.trim();!ce||N||(B(null),z(n.id,ce))};return f.jsx("div",{className:"msg-user-group ms-auto self-end flex w-full max-w-[88%] flex-col items-end gap-1.5",children:f.jsxs("div",{className:"msg-user-edit w-full bg-surface rounded-[16px] py-2.5 px-[15px] flex flex-col gap-2",children:[f.jsx("textarea",{dir:"auto",className:"w-full bg-transparent text-base text-text resize-none outline-none field-sizing-content min-h-16","aria-label":ace(),value:I,autoFocus:!0,onChange:ce=>B(ce.target.value),onKeyDown:ce=>{ce.key==="Escape"?(ce.preventDefault(),B(null)):ce.key==="Enter"&&!ce.shiftKey&&!ce.nativeEvent.isComposing&&(ce.preventDefault(),re())}}),f.jsxs("div",{className:`${s5} justify-end`,children:[f.jsx(Le,{size:"small",onClick:()=>B(null),children:Voe()}),f.jsx(Le,{size:"small",variant:"primary",onClick:re,disabled:N||!I.trim(),children:C4()})]})]})})}return f.jsxs("div",{className:"msg-user-group group/turn ms-auto self-end flex max-w-[88%] flex-col items-end gap-1.5",children:[G.length>0&&f.jsx(gk,{annotations:G,variant:"sent"}),f.jsxs("div",{dir:"auto",className:"msg-user max-w-full bg-surface rounded-[16px] py-2.5 px-[15px] text-base whitespace-pre-wrap wrap-anywhere [&_.skill-chip]:align-baseline",children:[f.jsx(Q8t,{text:ee,isCommand:O}),F.length>0&&f.jsx("div",{className:"msg-images flex flex-wrap gap-1.5 mt-2 [&_img]:max-w-55 [&_img]:max-h-40 [&_img]:border [&_img]:border-border-variant [&_img]:rounded-xs [&_img]:block",children:F.map((re,ce)=>f.jsx("a",{href:re.src,target:"_blank",rel:"noreferrer",children:f.jsx("img",{src:re.src,alt:_ie()})},ce))}),q.length>0&&f.jsx("div",{className:"msg-files flex flex-wrap gap-1.5 mt-2",children:q.map((re,ce)=>f.jsxs("a",{className:"msg-file inline-flex items-center gap-1.5 max-w-60 py-1.5 px-2.5 border border-border-variant rounded-sm text-text no-underline [&:hover]:border-text [&_span]:overflow-hidden [&_span]:text-ellipsis [&_span]:whitespace-nowrap",href:re.src,target:"_blank",rel:"noreferrer",children:[f.jsx(cb,{size:15}),f.jsx("span",{children:re.name})]},ce))})]}),w!==void 0&&f.jsx(ZCt,{text:ee,createdAt:n.createdAt,count:w,index:y,prevId:C,nextId:E,onSelect:M,pagerDisabled:T,onEdit:()=>B(ee),editDisabled:N})]})}const U=n.parts.find(ee=>ee.type==="tool"&&v3(ee)),H=n.parts.find(am)??U,Y=n.parts.filter(ee=>ee!==H&&!(U&&v3(ee)));return f.jsxs("div",{className:"msg-assistant group/turn text-base leading-[1.62] text-text min-w-0",children:[f.jsx(e9t,{message:n,parts:Y,options:{activePermissionId:t,pendingTailToolId:r,onOpenFile:s,onOpenRun:i,onOpenSpawnedSession:a,runExperimentName:o,onOpenExperiment:l,experimentName:u,onRespond:_,onOpenPlan:d,onOpenSubagent:p,predictTextTail:b}}),H&&f.jsx(bF,{part:H,usageLimited:!!U,busy:m,recovering:x===((X=(V=H.state)==null?void 0:V.input)==null?void 0:X.turnId),onRecover:S})]})});function e9t({message:e,parts:n,options:t}){const r=t.predictTextTail??!1,{work:s,answer:i}=Xyt(n,r),[a,o]=R.useState(!1),[,l]=R.useState(0);if(R.useEffect(()=>{if(!r||e.completedAt!=null||s.length===0)return;const p=window.setInterval(()=>l(m=>m+1),1e3);return()=>window.clearInterval(p)},[r,e.completedAt,s.length]),s.length===0)return f.jsx(f.Fragment,{children:D1(i,t)});const u=e.completedAt??(r?Date.now():null),_=u===null?null:u-e.createdAt,d=_===null?null:_<6e4||_>=36e5?np(_):s0e({minutes:Wt(Math.floor(_/6e4)),seconds:Wt(Math.floor(_/1e3)%60)});return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"turn-work mb-4",children:[f.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 border-b border-border/50 pb-2 text-start text-base text-subtext cursor-pointer hover:text-text focus-visible:outline-2 focus-visible:outline-primary","aria-expanded":a,"data-work-toggle":!0,onClick:()=>o(p=>!p),children:[f.jsx("span",{children:d===null?e0e():l0e({duration:d})}),f.jsx(Ca,{size:16,className:`shrink-0 text-muted transition-transform duration-200 ease-standard motion-reduce:transition-none ${a?"rotate-90":""}`})]}),f.jsx("div",{className:`tool-group-disclosure ${a?"open":""}`,"aria-hidden":!a,inert:!a,children:f.jsx("div",{className:"tool-group-disclosure-inner",children:f.jsx("div",{className:"turn-work-content pt-4",children:D1(s,{...t,predictTextTail:!1,pendingTailToolId:null})})})})]}),f.jsx("div",{className:"turn-answer",children:D1(i,t)})]})}function t9t(e){const n=e.parts.length===1?e.parts[0]:void 0;return e.role==="user"&&(n==null?void 0:n.type)==="tool"&&n.tool===VL?n:null}function n9t({part:e}){var l;const n=e.state,t=Ls((n==null?void 0:n.input)??{},"command")??"",r=(n==null?void 0:n.status)==="running",s=(n==null?void 0:n.status)==="error",i=typeof((l=n==null?void 0:n.input)==null?void 0:l.exitCode)=="number"?n.input.exitCode:null,a=[n==null?void 0:n.output,n==null?void 0:n.error].filter(Boolean).join(` +`),o=r?_D():s&&i!==null?Tie({code:Wt(i)}):null;return f.jsx("div",{className:"msg-shell ms-auto self-end flex w-full max-w-[88%] flex-col items-stretch gap-1.5",children:f.jsxs("div",{dir:"ltr",className:"max-w-full bg-surface rounded-[16px] py-2.5 px-[15px] text-base",children:[f.jsxs("div",{className:"flex items-start gap-2 font-mono text-sm text-text whitespace-pre-wrap wrap-anywhere",children:[f.jsxs("span",{className:"sr-only",children:[bD()," "]}),f.jsx(i_,{size:16,strokeWidth:1.6,className:`mt-0.5 shrink-0 ${s?"text-accent-red":"text-muted"}`,"aria-hidden":"true"}),f.jsx("span",{children:t})]}),a&&f.jsx("div",{className:`${mk} mt-2`,children:a.slice(0,2e4)}),o&&f.jsx("div",{className:`mt-1.5 text-xs ${s?"text-accent-red":"text-muted"}`,children:o})]})})}function D1(e,n){var w,y;const{activePermissionId:t,pendingTailToolId:r,onOpenFile:s,onOpenRun:i,onOpenSpawnedSession:a,runExperimentName:o,onOpenExperiment:l,experimentName:u,onRespond:_,onOpenPlan:d,onOpenSubagent:p,predictTextTail:m=!1}=n,x=e.filter(C=>C.type!=="steer"&&Fh(C,t)).at(-1),S=[];let v=[];const b=()=>{v.length!==0&&(S.push(f.jsx(KCt,{parts:v,pendingTail:v.some(C=>C.id===r),onOpenFile:s,onOpenRun:i,onOpenSpawnedSession:a,runExperimentName:o,onOpenExperiment:l,experimentName:u},`tg-${v[0].id}`)),v=[])};for(const C of e)if(Fh(C,t)){if(C.type==="tool"&&(s9t(C.tool)||(((w=C.children)==null?void 0:w.length)??0)>0)){b(),S.push(f.jsx(a9t,{part:C,pendingTail:m&&((y=C.state)==null?void 0:y.status)==="running"||C.id===r,onOpenSubagent:p},C.id));continue}if(C.type==="tool"){v.push(C);continue}b(),C.type==="text"?S.push(f.jsx($o,{text:C.text,onOpenFile:s,onOpenRun:i,predict:m&&C.id===(x==null?void 0:x.id)},C.id)):C.type==="steer"?S.push(f.jsx("div",{dir:"auto",role:"note","aria-label":Bfe(),className:"msg-steer my-2 ms-auto w-fit max-w-[88%] bg-surface rounded-[16px] py-2.5 px-[15px] text-base whitespace-pre-wrap wrap-anywhere",children:C.text},C.id)):C.type==="prompt"&&C.prompt&&S.push(f.jsx(QCt,{part:C,onRespond:_,onOpenFile:s,onOpenPlan:d},C.id))}return b(),S}function r9t(e){return Ld(e).label}function s9t(e){const n=(e??"").toLowerCase();return n==="subagent"||n==="task"||n==="agent"}function yF(e){var t,r;const n=((t=e.state)==null?void 0:t.status)==="completed"?((r=e.state)==null?void 0:r.output)??"":"";return n.startsWith("Async agent launched")?"":n}function ey(e,n){for(const t of e){if(t.id===n)return t;const r=t.children&&ey(t.children,n);if(r)return r}return null}function i9t({spawn:e,onOpenFile:n,onOpenRun:t,runExperimentName:r,onOpenExperiment:s,experimentName:i,onOpenSubagent:a}){var x,S,v,b;const o=e.children??[],l=((x=e.state)==null?void 0:x.status)==="running",u=((S=e.state)==null?void 0:S.status)==="error",_=u?Zb(((v=e.state)==null?void 0:v.error)||((b=e.state)==null?void 0:b.output)||""):"",d=D1(o,{onOpenFile:n,onOpenRun:t,runExperimentName:r,onOpenExperiment:s,experimentName:i,onOpenSubagent:a,predictTextTail:l,pendingTailToolId:l?vB(o):null}),m=o.some(w=>w.type==="text"&&!!w.text)?"":yF(e);return f.jsxs("div",{className:"msg-assistant text-base leading-[1.62] text-text min-w-0",children:[u&&f.jsxs("span",{className:"sr-only",children:[J5()," "]}),_&&f.jsx("div",{className:mk,children:_.slice(0,2e4)}),d.length===0&&!m&&!_?f.jsx("div",{className:"subagent-empty py-[3px] px-1 text-sm text-muted",children:l?e6():Dae()}):f.jsxs(f.Fragment,{children:[d,m&&f.jsx($o,{text:m,onOpenFile:n,onOpenRun:t})]})]})}function a9t({part:e,pendingTail:n,onOpenSubagent:t}){var u,_,d,p;const r=((u=e.state)==null?void 0:u.status)==="error",s=Zb(((_=e.state)==null?void 0:_.error)||((d=e.state)==null?void 0:d.output)||""),i=n&&!r?vk(Ld(e)):Ld(e),a=vF(!!(n&&!r)),o=(((p=e.children)==null?void 0:p.length)??0)===0&&!r&&!yF(e),l=f.jsxs(f.Fragment,{children:[r&&f.jsxs("span",{className:"sr-only",children:[J5()," "]}),r?f.jsx("span",{className:"flex h-6 shrink-0 items-center text-accent-red",children:f.jsx(PO,{size:16,strokeWidth:1.75,className:"subagent-icon","aria-hidden":"true"})}):f.jsx(Tv,{activity:i,className:`subagent-icon ${a?"tool-running-shimmer-icon":"text-muted"}`}),f.jsx("span",{className:`${aF} ${a?"tool-running-shimmer":r?"text-accent-red":"text-subtext"}`,children:i.label})]});return o?f.jsx("div",{className:"subagent-row flex items-start gap-2 w-full my-3.5 mx-0 py-[3px] px-1 text-text text-base text-start rounded-sm",children:l}):f.jsxs("button",{className:"subagent-row flex items-start gap-2 w-full my-3.5 mx-0 py-[3px] px-1 cursor-pointer text-text text-base text-start rounded-sm [&:hover:not(:disabled)]:bg-surface [&:disabled]:cursor-default",title:r&&s?s:Yae(),...Ur(m=>t==null?void 0:t(e.id,i.label,m)),disabled:!t,children:[l,f.jsx("span",{className:"subagent-row-chevron flex h-6 shrink-0 items-center text-muted",children:f.jsx(Ca,{size:12})})]})}function o9t(e){const n=new Map;let t;for(let s=e.length-1;s>=0;s--)if(e[s].role==="assistant"){t=e[s];break}if(!t)return{messageId:"",states:n};const r=(s,i)=>{var a,o;for(const l of s){const u=`${i}/${l.id}`;l.type==="tool"&&((a=l.state)!=null&&a.status)&&n.set(u,{status:l.state.status,part:l}),(o=l.children)!=null&&o.length&&r(l.children,u)}};return r(t.parts,t.id),{messageId:t.id,states:n}}function bk(e){const n=(t,r)=>{var s;for(const i of t){const a=i.prompt;if(i.type==="prompt"&&(a==null?void 0:a.kind)==="permission"&&!a.resolved){const o=a.toolInput??{},u=Ls(o,"reason","description")||gF(a.tool,o);return{id:i.id,path:`${r}/${i.id}`,label:u}}if((s=i.children)!=null&&s.length){const o=n(i.children,`${r}/${i.id}`);if(o)return o}}return null};for(const t of e){if(t.role!=="assistant")continue;const r=n(t.parts,t.id);if(r)return r}return null}function l9t(e){const[n,t]=R.useState({text:"",sequence:0}),r=R.useRef(null);return R.useEffect(()=>{var x,S,v,b,w;const s=((x=e[0])==null?void 0:x.id)??"",{messageId:i,states:a}=o9t(e),o=bk(e);if(!r.current||r.current.transcript!==s){r.current={transcript:s,messageId:i,states:a,permissionPath:(o==null?void 0:o.path)??null},t(y=>({text:o?rE({label:Do(o.label)}):"",sequence:y.sequence+1}));return}const l=r.current.messageId===i?r.current.states:new Map,u=r.current.permissionPath,_=[...a].filter(([y,C])=>{var E;return((E=l.get(y))==null?void 0:E.status)!==C.status});if(r.current={transcript:s,messageId:i,states:a,permissionPath:(o==null?void 0:o.path)??null},o&&o.path!==u){t(y=>({text:rE({label:Do(o.label)}),sequence:y.sequence+1}));return}const d=(S=_.find(([,y])=>am(y.part)))==null?void 0:S[1].part;if((d==null?void 0:d.id)==="turn-recovery"){const y=xB((b=(v=d.state)==null?void 0:v.input)==null?void 0:b.recoveryAction);t(C=>({text:`${vte()}${y?` ${y==="retry"?Zee():Kee()}`:""}`,sequence:C.sequence+1}));return}if((d==null?void 0:d.id)==="turn-retry"){t(y=>({text:Uee(),sequence:y.sequence+1}));return}const p=_.filter(([,y])=>y.status==="error");if(p.length>0){const y=p.slice(0,2).map(([,C])=>Ld(C.part).label).join(", ");t(C=>({text:p.length===1?ute({labels:y}):_te({count:Wt(p.length),labels:y}),sequence:C.sequence+1}));return}const m=_.filter(([,y])=>y.status==="running");if(m.length>0){const y=(w=m.at(-1))==null?void 0:w[1].part;t(C=>({text:y?vk(Ld(y)).label:nte(),sequence:C.sequence+1}));return}_.some(([,y])=>y.status==="completed")&&t(y=>({text:ate(),sequence:y.sequence+1}))},[e]),n}const c9t=R.memo(function({messages:n,scrollRef:t,scrollToEndRef:r,stickToBottom:s,onPinToBottom:i,allMessages:a,canFork:o,onFork:l,onSelectFork:u,busy:_,onOpenFile:d,onOpenRun:p,onOpenSpawnedSession:m,runExperimentName:x,onOpenExperiment:S,experimentName:v,onRespond:b,onOpenPlan:w,onOpenSubagent:y,recoveringTurnId:C,onRecover:E,skills:N}){var O,L,F;Gd();const T=((O=bk(n))==null?void 0:O.id)??null,z=R.useMemo(()=>n.filter(q=>YCt(q,T)),[n,T]),M=R.useMemo(()=>{const q=z.filter(G=>G.role==="user"&&!G.id.startsWith(xd));return Kyt(a,n,q,G=>G.startsWith(xd))},[n,z,a]),I=R.useRef(new Set),[B,$]=R.useState(!1),U=R.useCallback(q=>z[q].id,[z]),H=R.useCallback(q=>{if(B)return z.map((re,ce)=>ce);const G=new Set(mB(q));return z.forEach((re,ce)=>{I.current.has(re.id)&&G.add(ce)}),[...G].sort((re,ce)=>re-ce)},[z,B]),Y=Gyt({count:z.length,useFlushSync:!1,getScrollElement:()=>t.current,getItemKey:U,estimateSize:()=>400,overscan:1,initialRect:{width:((L=t.current)==null?void 0:L.clientWidth)??0,height:((F=t.current)==null?void 0:F.clientHeight)??0},initialOffset:()=>{var q;return Math.max(0,z.length*400-(((q=t.current)==null?void 0:q.clientHeight)??0))},anchorTo:s.current?"end":"start",followOnAppend:!0,scrollEndThreshold:60,rangeExtractor:H});R.useLayoutEffect(()=>{const q=()=>Y.scrollToEnd();return r.current=q,i(),()=>{r.current=null}},[Y,r,i]),R.useEffect(()=>{const q=()=>{var ce;const G=window.getSelection();if(!G||G.isCollapsed||!G.rangeCount)return;const re=G.getRangeAt(0);for(const oe of((ce=t.current)==null?void 0:ce.querySelectorAll("[data-message-id]"))??[])re.intersectsNode(oe)&&oe.dataset.messageId&&I.current.add(oe.dataset.messageId)};return document.addEventListener("selectionchange",q),()=>document.removeEventListener("selectionchange",q)},[t]);const V=z.at(-1),X=l9t(n),ee=_?bB(n):null;return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:f.jsx("span",{children:X.text},X.sequence)}),f.jsx("button",{type:"button",className:"sr-only focus:not-sr-only","aria-pressed":B,onClick:()=>$(q=>!q),children:t_e()}),f.jsx("div",{className:"relative",style:{height:Y.getTotalSize()},children:Y.getVirtualItems().map(q=>{var te,Q,le,ae,de,pe;const G=z[q.index],re=G.parts.find(am),ce=(Q=(te=re==null?void 0:re.state)==null?void 0:te.input)==null?void 0:Q.turnId,oe=re?_||C!==null:!1;return f.jsx("div",{"data-index":q.index,"data-message-id":G.id,ref:Y.measureElement,className:"absolute left-0 w-full pb-4",style:{top:q.start},onClickCapture:we=>{!(we.target instanceof Element)||!we.target.closest("[data-work-toggle]")||(s.current=!1,Y.setOptions({...Y.options,anchorTo:"start"}))},onPointerDownCapture:()=>I.current.add(G.id),onFocusCapture:()=>I.current.add(G.id),children:f.jsx(JCt,{message:G,forkCount:(le=M.get(G.id))==null?void 0:le.count,forkIndex:(ae=M.get(G.id))==null?void 0:ae.index,forkPrevId:(de=M.get(G.id))==null?void 0:de.prevId,forkNextId:(pe=M.get(G.id))==null?void 0:pe.nextId,forkDisabled:!o,branchDisabled:_,onFork:l,onSelectFork:u,activePermissionId:T,pendingTailToolId:(ee==null?void 0:ee.messageId)===G.id?ee.toolId:null,onOpenFile:d,onOpenRun:p,onOpenSpawnedSession:m,runExperimentName:x,onOpenExperiment:S,experimentName:v,onRespond:b,onOpenPlan:w,onOpenSubagent:y,busy:oe,recoveringTurnId:ce===C?C:null,onRecover:E,skills:N,predictTextTail:_&&G===V&&G.role==="assistant"})},G.id)})})]})}),u9t=(e,n)=>e==="all"?!0:e==="archived"?n:!n,xF=[{id:"active",label:doe,railLabel:kD},{id:"archived",label:_E,railLabel:_E},{id:"all",label:poe,railLabel:vD}];function d9t({value:e,onChange:n}){const{open:t,setOpen:r,ref:s}=to();return f.jsxs("div",{className:"rail-filter relative inline-flex",ref:s,children:[f.jsx(Yt,{size:"small",className:"rail-filter-btn",active:e!=="active",title:SE(),"aria-label":SE(),onClick:()=>r(i=>!i),children:f.jsx(ZO,{size:13})}),t&&f.jsx("div",{className:"option-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-95 flex flex-col bg-background border border-border rounded-lg shadow-menu z-50 overflow-hidden min-w-47.5 p-1.5 [&.align-right]:start-auto [&.align-right]:end-0 [&.drop-down]:bottom-auto [&.drop-down]:top-[calc(100%_+_4px)] [&.session-menu]:start-auto [&.session-menu]:end-1.5 [&.session-menu]:top-[calc(100%_-_2px)] [&.session-menu]:min-w-35 drop-down align-right",children:xF.map(i=>f.jsxs(ir,{onClick:()=>{n(i.id),r(!1)},children:[f.jsx("span",{children:i.label()}),e===i.id&&f.jsx(wa,{size:13})]},i.id))})]})}const f9t=14,h9t=500,_9t=1200;function wF({title:e,animate:n}){return n?f.jsx("span",{className:"title-reveal","aria-label":e,children:Array.from(e).map((t,r)=>t===" "?f.jsx("span",{"aria-hidden":!0,children:t},r):f.jsx("span",{"aria-hidden":!0,className:"title-reveal-char inline-block animate-[title-char-in_240ms_ease-out_both] [@media((prefers-reduced-motion:_reduce))]:animate-none",style:{animationDelay:`${Math.min(r*f9t,h9t)}ms`},children:t},r))}):f.jsx(f.Fragment,{children:e})}function p9t({session:e,active:n,unread:t,busy:r,waiting:s,revealTitle:i,onOpen:a,onRename:o,onSetArchived:l,onDelete:u}){var E;const{open:_,setOpen:d,ref:p}=to(),m=((E=e.title)==null?void 0:E.trim())||"Untitled",[x,S]=R.useState(!1),[v,b]=R.useState(""),w=R.useRef(null);function y(){var N;b(((N=e.title)==null?void 0:N.trim())||""),S(!0)}function C(){var T;const N=v.trim();S(!1),N&&N!==(((T=e.title)==null?void 0:T.trim())||"")&&o(N)}return R.useEffect(()=>{var N,T;x&&((N=w.current)==null||N.focus(),(T=w.current)==null||T.select())},[x]),f.jsxs("div",{ref:p,role:"button",tabIndex:0,className:`session-row relative flex items-center gap-2 w-full text-start py-[7px] px-2.5 rounded-md text-sm text-text cursor-pointer select-none [&:hover:not(.active)]:bg-surface [&.active]:bg-panel [&.active]:font-medium [&_.session-dot:empty]:hidden [&_.session-dot]:w-4 [&_.session-dot]:inline-flex [&_.session-dot]:items-center [&_.session-dot]:justify-center [&_.session-dot]:shrink-0 [&_.session-title]:flex-1 [&_.session-title]:min-w-0 [&_.session-title]:overflow-hidden [&_.session-title]:[mask-image:linear-gradient(to_right,black_calc(100%_-_16px),transparent)] [&_.session-title]:whitespace-nowrap [&_.session-menu-btn]:hidden [&_.session-menu-btn]:items-center [&_.session-menu-btn]:justify-center [&_.session-menu-btn]:w-4 [&_.session-menu-btn]:h-4 [&_.session-menu-btn]:-my-0.5 [&_.session-menu-btn]:mx-0 [&_.session-menu-btn]:rounded-sm [&_.session-menu-btn]:text-muted [&_.session-menu-btn]:shrink-0 [&_.session-menu-btn:hover]:text-text [&_.session-menu-btn:hover]:bg-panel [&:hover_.session-menu-btn]:inline-flex [&:focus-visible_.session-menu-btn]:inline-flex [&_.session-menu-btn:focus-visible]:inline-flex [&.menu-open_.session-menu-btn]:inline-flex [&:hover_.session-dot]:hidden [&:focus-visible_.session-dot]:hidden [&:has(.session-menu-btn:focus-visible)_.session-dot]:hidden [&.menu-open_.session-dot]:hidden [&_.busy-dot]:w-[7px] [&_.busy-dot]:h-[7px] [&_.busy-dot]:rounded-full [&_.busy-dot]:bg-primary [&_.busy-dot]:animate-[or-pulse_1.2s_infinite] [&_.busy-dot]:shrink-0 [&_.unread-dot]:w-[7px] [&_.unread-dot]:h-[7px] [&_.unread-dot]:rounded-full [&_.unread-dot]:bg-primary [&_.unread-dot]:shrink-0 [&_.busy-dot.waiting]:animate-none [&_.session-title-input]:flex-1 [&_.session-title-input]:min-w-0 [&_.session-title-input]:py-px [&_.session-title-input]:px-[5px] [&_.session-title-input]:-my-0.5 [&_.session-title-input]:mx-0 [&_.session-title-input]:[font:inherit] [&_.session-title-input]:text-text [&_.session-title-input]:bg-background [&_.session-title-input]:border [&_.session-title-input]:border-primary [&_.session-title-input]:rounded-sm [&_.session-title-input]:outline-none [&.editing]:bg-surface [&.editing]:cursor-default [&.editing_.session-menu-btn]:hidden [&.editing_.session-dot]:hidden ${n?"active":""} ${t?"unread":""} ${_?"menu-open":""} ${x?"editing":""}`,title:`${E0[e.harness]}${e.model?` · ${e.model}`:""}${e.parentSessionId?i_e():""}`,onClick:()=>{x||(_?d(!1):a())},onKeyDown:N=>{N.target===N.currentTarget&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),_?d(!1):a())},children:[e.parentSessionId&&!x&&f.jsx(I6,{className:"text-muted shrink-0",size:12,"aria-hidden":!0}),x?f.jsx("input",{ref:w,className:"session-title-input","aria-label":qde(),value:v,onChange:N=>b(N.target.value),onClick:N=>N.stopPropagation(),onBlur:C,onKeyDown:N=>{N.stopPropagation(),N.key==="Enter"?(N.preventDefault(),C()):N.key==="Escape"&&(N.preventDefault(),S(!1))}}):f.jsx("span",{className:"session-title",children:f.jsx(wF,{title:m,animate:i!==void 0},i??"static")}),f.jsx("span",{className:"session-dot",children:r?f.jsx("span",{className:`busy-dot ${s?"waiting":""}`}):t&&f.jsx("span",{className:"unread-dot"})}),f.jsx("button",{className:"session-menu-btn",title:AE(),"aria-label":AE(),onClick:N=>{N.stopPropagation(),d(T=>!T)},children:f.jsx(A6,{size:14})}),_&&f.jsxs("div",{className:"option-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-95 flex flex-col bg-background border border-border rounded-lg shadow-menu z-50 overflow-hidden min-w-47.5 p-1.5 [&.align-right]:start-auto [&.align-right]:end-0 [&.drop-down]:bottom-auto [&.drop-down]:top-[calc(100%_+_4px)] [&.session-menu]:start-auto [&.session-menu]:end-1.5 [&.session-menu]:top-[calc(100%_-_2px)] [&.session-menu]:min-w-35 drop-down session-menu",children:[f.jsx(ir,{onClick:N=>{N.stopPropagation(),d(!1),y()},children:f.jsx("span",{children:xD()})}),f.jsx(ir,{onClick:N=>{N.stopPropagation(),d(!1),l(!e.archived)},children:f.jsx("span",{children:e.archived?q_e():nie()})}),f.jsx(ir,{danger:!0,onClick:N=>{N.stopPropagation(),d(!1),u()},children:f.jsx("span",{children:yD()})})]})]})}const SA=[OO,YO,i_,ub],Ow=[{box:"border-accent-blue/45",icon:"text-accent-blue"},{box:"border-accent-green/45",icon:"text-accent-green"},{box:"border-accent-amber/45",icon:"text-accent-amber"},{box:"border-primary/45",icon:"text-primary"}],kA="mt-7 grid w-full max-w-readable grid-cols-1 gap-3 sm:grid-cols-2";function m9t({onClose:e,onConfigureSsh:n}){var v,b;const t=mn({mutationFn:w=>bdt(...w)}),r=ot(WL()),s=ot(Dft()),i=r.data??null,a=s.data??[],[o,l]=R.useState(""),u=i?null:((v=r.error)==null?void 0:v.message)??((b=s.error)==null?void 0:b.message)??null,[_,d]=R.useState(null),p=R.useRef(null);sb(p,e);async function m(w){const y=window.open("/remote-launch","_blank");if(!y){Vn(sLe(),"error");return}d(w);try{const C=await t.mutateAsync([w,{theme:_ht(),locale:j()}]);y.location.replace(C.gatewayUrl),e()}catch(C){y.close(),Vn(C instanceof Error?C.message:String(C),"error")}finally{d(null)}}const x=i==null?void 0:i.filter(w=>w.host.toLocaleLowerCase().includes(o.trim().toLocaleLowerCase())),S=new Map(a.map(w=>[w.host,w]));return eo.createPortal(f.jsx("div",{className:"fixed inset-0 z-200 flex items-center justify-center bg-modal-backdrop p-5",onClick:w=>{w.target===w.currentTarget&&e()},children:f.jsxs("div",{ref:p,className:"relative flex h-[min(42rem,calc(100vh-2.5rem))] w-160 max-w-full flex-col overflow-hidden rounded-xl border border-border bg-background shadow-modal",role:"dialog","aria-modal":"true","aria-labelledby":"remote-host-dialog-title",tabIndex:-1,children:[f.jsx(Yt,{className:"absolute end-3.5 top-3.5","aria-label":$Me(),onClick:e,children:f.jsx(qr,{size:16})}),f.jsxs("div",{className:"shrink-0 px-6 pt-5 pb-4 pe-14",children:[f.jsx("h2",{id:"remote-host-dialog-title",className:"m-0 text-xl font-medium",children:ZD()}),f.jsx("p",{className:"mt-2 mb-0 text-sm leading-normal text-subtext",children:qMe()}),f.jsx(ns,{"data-initial-focus":!0,className:"mt-4",value:o,onChange:w=>l(w.target.value),placeholder:wN(),"aria-label":wN()})]}),f.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto border-t border-border-variant p-2",children:u?f.jsx("p",{className:"m-3 text-sm text-accent-red",children:u}):i===null?f.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-subtext",children:[f.jsx(Lt,{})," ",mL()]}):(x==null?void 0:x.length)===0?f.jsx("p",{className:"m-3 text-sm text-subtext",children:HDe()}):x==null?void 0:x.map(w=>{const y=S.get(w.host);return f.jsxs(Le,{variant:"ghost",className:"w-full justify-start text-base font-normal",disabled:_===w.host,onClick:()=>void m(w.host),children:[f.jsx("span",{className:"min-w-0 flex-1 truncate text-start",children:w.host}),_===w.host?f.jsx(Lt,{}):y?f.jsx("span",{className:"text-sm text-subtext",children:YDe()}):null]},w.host)})}),f.jsx("div",{className:"shrink-0 border-t border-border-variant p-2",children:f.jsxs(Le,{variant:"ghost",className:"w-full justify-start text-base font-normal",onClick:n,children:[f.jsx(ZO,{size:15}),EL()]})})]})}),document.body)}function g9t({projectId:e,projectName:n,railHeader:t,railOpen:r,onShowRail:s,mainView:i,onSelectMainView:a,onOpenFile:o,onOpenRun:l,runExperimentName:u,onOpenExperiment:_,experimentName:d,onOpenPlan:p,onOpenSubagent:m,runtime:x,onOpenDemoWelcome:S,composerPrefill:v=null,activeSessionId:b,onActiveSessionChange:w,preferredAgent:y,onPreferredAgentChange:C,children:E}){var us,rc,Nu,zu,Ma;const N=mn({mutationFn:se=>cft(...se)}),T=mn({mutationFn:se=>lft(...se)}),z=mn({mutationFn:se=>sft(...se)}),M=mn({mutationFn:se=>aft(...se)}),I=mn({mutationFn:se=>oft(...se)}),B=mn({mutationFn:ift}),$=R.useMemo(()=>xa(e),[e]),{data:U=CCt}=ot($),H=R.useCallback(se=>{Gr($.queryKey,ye=>{if(!ye)return;const Te=typeof se=="function"?se(ye):se,$e=new Map(ye.map(Ue=>[Ue.id,Ue]));for(const Ue of Te)$e.get(Ue.id)!==Ue&&qa(tt,$.queryKey,Ue.id),$e.delete(Ue.id);for(const Ue of $e.keys())qa(tt,$.queryKey,Ue);return Te})},[$]),[Y,V]=R.useState(!1),[X,ee]=R.useState(!1),O=b,L=R.useRef(w);L.current=w;const F=R.useRef({projectId:e});F.current.projectId!==e&&(F.current={projectId:e});const[q,G]=R.useState(new Set),[re,ce]=R.useState("active"),[oe,te]=R.useState(""),[Q,le]=R.useState([]),ae=R.useRef(0),de=R.useRef({projectId:e,activeId:O,mainView:i});(de.current.projectId!==e||de.current.activeId!==O||de.current.mainView!==i)&&(de.current={projectId:e,activeId:O,mainView:i});const[pe,we]=R.useState([]),[be,Pe]=R.useState(null),[Be,ze]=R.useState(null),it=R.useRef(Promise.resolve()),bt=R.useRef(0),It=R.useRef(0),[$t,jt]=R.useState(null),ct=R.useRef(null),ut=R.useRef(!1),Ht=R.useRef(null),[Se,Ae,Ze]=Kft(e,i==="chat"?O:null),{data:ht=b9t}=ot(ru()),[wt,en]=R.useState(y);R.useEffect(()=>en(y),[y]);const[Ve,qt]=R.useState({}),[ln,cn]=R.useState(b0),[Mt,er]=R.useState(null),tn=R.useRef(!1),Mr=R.useRef(null),[tr,qn]=R.useState(null),Sr=R.useRef(!1),$n=R.useRef(null),[Wr,kr]=R.useState(new Map),gt=R.useRef(new Map),un=R.useRef(null),vn=R.useRef(null),Zt=R.useRef(null),Kn=R.useRef(!0),[fn,Nn]=R.useState(!0),Vt=R.useRef(null),xt=to(),At=R.useCallback(se=>{var ye;ae.current+=1,le(Te=>[...Te,{id:`annotation-${ae.current}`,...se}]),(ye=Vt.current)==null||ye.focus()},[]),Fe=gCt(vn,At);vCt(Q),R.useEffect(()=>{le([]),Fe.dismiss()},[O,e,Fe.dismiss]);const[_t,cr]=R.useState(0),[xn,Ut]=R.useState(!1),[ur,Qn]=R.useState(0),ki=R.useRef(!1);function Ql(se){if(!as)return;if(se.source==="command"&&se.name==="plan"){oi(oe,as);return}const ye=t5(se.name,Vt.current),Te=H8t(oe,as,se.name,ye);te(Te.text),window.requestAnimationFrame(()=>{var $e,Ue;($e=Vt.current)==null||$e.focus(),(Ue=Vt.current)==null||Ue.setSelectionRange(Te.cursor,Te.cursor),Qn(Te.cursor)})}function ro(se){if(Yl)return!1;const ye=se.selectionStart;if(ki.current||ye!==se.selectionEnd)return!1;const Te=oe.slice(0,ye).replace(/[ \t]+$/,"").length,$e=jw(oe,Te);if(!$e||$e.end!==Te||!ja($e.query)||ye>Te&&ye-Te!==t5($e.query,se))return!1;const Ue=dA(oe,{...$e,end:ye});return te(Ue.text),Qn(Ue.cursor),window.requestAnimationFrame(()=>se.setSelectionRange(Ue.cursor,Ue.cursor)),!0}function zs(se){Pe(null);let $e=pe.reduce((Ue,wn)=>Ue+wn.size,0);for(const Ue of se){if(!/^(image\/(png|jpeg|gif|webp)|application\/pdf)$/.test(Ue.type))continue;if(Ue.size>31457280){Pe(vie({name:Ne(Ue.name)}));continue}if($e+Ue.size>41943040){Pe(wie());continue}$e+=Ue.size;const wn=new FileReader;wn.onload=()=>{const Sn=wn.result;we(Nr=>[...Nr,{dataUrl:Sn,mediaType:Ue.type,name:Ue.name,size:Ue.size}])},wn.readAsDataURL(Ue)}}function Na(se){const ye=Array.from(se.clipboardData.items).filter(Te=>Te.kind==="file"&&(Te.type.startsWith("image/")||Te.type==="application/pdf")).map(Te=>Te.getAsFile()).filter(Te=>Te!==null);ye.length>0&&(se.preventDefault(),zs(ye))}const rn=U.find(se=>se.id===O),Dr=wt??lgt(ht),Rn=rn?{harness:rn.harness,model:Ve.model??rn.model,serviceTier:Ve.serviceTier!==void 0?Ve.serviceTier:rn.serviceTier,permissionMode:Ve.permissionMode??rn.permissionMode,reasoningLevel:Ve.reasoningLevel??rn.reasoningLevel}:Dr?{...Dr,...Ve}:null,{data:Ps=v9t}=ot($ft(Rn==null?void 0:Rn.harness)),Xe=Rn?ht.find(se=>se.id===Rn.harness):void 0,Pt=Xe==null?void 0:Xe.options,ri=R.useMemo(()=>q8t(Ps,Pt==null?void 0:Pt.planActivation),[Ps,Pt==null?void 0:Pt.planActivation]),Fs=_A(oe),si=Fs!==null,as=jw(oe,ur),ii=(as==null?void 0:as.query)??null,ta=ii===null?[]:ri.filter(se=>se.name.startsWith(ii)||se.plugin&&`${se.plugin}:${se.name}`.toLowerCase().startsWith(ii)),Yl=!si&&ii!==null&&(as==null?void 0:as.end)===ur&&ta.length>0,gs=Yl&&!xn?ta:[],Ci=gs.length>0,os=Math.min(_t,Math.max(0,gs.length-1));R.useEffect(()=>cr(0),[ii]);const Pn=Rn&&Xe&&Xe.models.length>0&&!Xe.models.some(se=>se.id===Rn.model)?Xe.models[0].id:(Rn==null?void 0:Rn.model)??null,Kt=Rn&&{...Rn,model:Pn,serviceTier:rv(Xe,Pn,Rn.serviceTier),reasoningLevel:qL(Xe,Pn,Rn.reasoningLevel)},ai=eb(Xe,Kt==null?void 0:Kt.model),js=se=>{if(!Kt)return;const ye={...Kt,...se},Te={};se.model!==void 0&&se.model!==Kt.model&&(Te.model=se.model),se.serviceTier!==void 0&&se.serviceTier!==Kt.serviceTier&&(Te.serviceTier=se.serviceTier),se.permissionMode!==void 0&&se.permissionMode!==Kt.permissionMode&&(Te.permissionMode=se.permissionMode),se.reasoningLevel!==void 0&&se.reasoningLevel!==Kt.reasoningLevel&&(Te.reasoningLevel=se.reasoningLevel),cn($e=>({...$e,...Te})),en(ye),C(ye).catch(()=>{}),rn?qt($e=>({...$e,...se})):se.harness&&se.harness!==Kt.harness&&qt({})},Yn=R.useCallback(se=>{const ye=it.current.catch(()=>{}).then(()=>{if(!Dn($.queryKey))throw new DOMException("Workspace changed","AbortError");return se()});return it.current=ye.then(()=>{},()=>{}),ye},[$]),Hs=se=>{if(se==="plan"&&(Xe==null?void 0:Xe.id)==="claude-code"?(cn($e=>({...$e,permissionMode:se})),qt($e=>({...$e,permissionMode:se}))):(qt($e=>{const Ue={...$e};return delete Ue.permissionMode,Ue}),js({permissionMode:se})),!rn)return;const ye=rn.id,Te=++bt.current;ze(null),Yn(()=>N.mutateAsync([ye,se])).then($e=>{H(Ue=>Ue.map(wn=>wn.id===$e.id?$e:wn)),bt.current===Te&&qt(Ue=>{const wn={...Ue};return delete wn.permissionMode,wn})}).catch(()=>{bt.current===Te&&(qt($e=>{const Ue={...$e};return delete Ue.permissionMode,Ue}),ze(Y_e()))})},ls=se=>js({reasoningLevel:se}),Un=(Kt==null?void 0:Kt.harness)==="claude-code"?Kt.permissionMode==="plan":(Pt==null?void 0:Pt.planActivation)==="command"?$t??(rn==null?void 0:rn.planMode)??!1:!1;R.useEffect(()=>{$t===null||(rn==null?void 0:rn.planMode)!==$t||(ct.current=null,jt(null))},[rn==null?void 0:rn.planMode,$t]);async function Vr(se){if(cn($e=>({...$e,planMode:se})),ct.current=se,jt(se),!rn)return;const ye=rn.id,Te=++It.current;ze(null);try{const $e=await Yn(()=>T.mutateAsync([ye,se]));H(Ue=>Ue.map(wn=>wn.id===$e.id?$e:wn)),It.current===Te&&(ct.current=null,jt(null),ze(null))}catch($e){throw It.current===Te&&(ct.current=null,jt(null)),$e}}async function $r(){if((Kt==null?void 0:Kt.harness)==="claude-code"){Hs("auto");return}if(rn)try{await Vr(!1)}catch{ze(Jie())}}async function na(){const se=!Un;try{if((Kt==null?void 0:Kt.harness)==="claude-code")Hs(se?"plan":"auto");else if((Pt==null?void 0:Pt.planActivation)==="command")await Vr(se);else throw new Error(xx())}catch{ze(OE())}}function oi(se,ye){const Te=dA(se,ye);te(Te.text),Ut(!0),na(),window.requestAnimationFrame(()=>{var $e,Ue;($e=Vt.current)==null||$e.focus(),(Ue=Vt.current)==null||Ue.setSelectionRange(Te.cursor,Te.cursor),Qn(Te.cursor)})}const qs=R.useCallback(async(se=!1)=>{const ye=F.current;if(ye.projectId!==e||!Dn($.queryKey))return null;const Te=(tt.getQueryData($.queryKey)??[]).map($e=>$e.id);try{const $e=await tt.fetchQuery({...$,...se?{staleTime:0}:{}});if(F.current!==ye||!Dn($.queryKey))return null;const Ue=$e.filter(Sn=>!tu.has(Sn.id)),wn=new Set(Ue.map(Sn=>Sn.id));for(const Sn of Te)wn.has(Sn)||vs(Sn);return gt.current=new Map(Ue.map(Sn=>[Sn.id,Sn.title])),Ue}catch{return null}},[e]),Ei=R.useCallback(async se=>{F.current.projectId!==e||!Dn($.queryKey)||await Promise.all([tt.fetchQuery({...Ol(se),staleTime:0}),qs(!0)]).catch(()=>{})},[e,qs]);R.useEffect(()=>{const se=RO();G(e===Ex?new Set([h6,_6].filter(Te=>!se.has(Te))):new Set),te(""),we([]),kr(new Map),gt.current=new Map,qs();const ye=F.current;return()=>{F.current===ye&&(F.current={projectId:e})}},[e,qs]),R.useEffect(()=>{cn(b0),$n.current=null},[O]),R.useEffect(()=>iv(se=>{switch(se.type){case"session":{if(se.session.projectId!==e||tu.has(se.session.id))return;const ye=gt.current.has(se.session.id),Te=gt.current.get(se.session.id)!==se.session.title;gt.current.set(se.session.id,se.session.title),ye&&Te&&se.session.titleSource==="generated"&&(kr($e=>{const Ue=new Map($e);return Ue.set(se.session.id,($e.get(se.session.id)??0)+1),Ue}),window.setTimeout(()=>{kr($e=>{if(!$e.has(se.session.id))return $e;const Ue=new Map($e);return Ue.delete(se.session.id),Ue})},_9t));break}case"sessionDeleted":vs(se.sessionId);break}}),[e]),R.useEffect(()=>iv(se=>{se.type==="reconnected"&&qs(!0)}),[qs]);const ra=O?Se.messagesBySession[O]??bA:bA,gu=O?Se.activeLeafBySession[O]??null:null;Mr.current=gu;const mr=R.useMemo(()=>Wyt(ra,gu),[ra,gu]),vu=R.useRef({projectId:e,ids:Se.busySessions});R.useEffect(()=>{const se=vu.current;vu.current={projectId:e,ids:Se.busySessions},se.projectId===e&&G(ye=>Yyt(ye,se.ids,Se.busySessions,U,i==="chat"?O:null))},[e,Se.busySessions,U,O,i]);const nr=O?Se.busySessions.has(O):!1,Jd=!nr&&!!(Xe!=null&&Xe.agentReady),ef=nr&&bB(mr)!=null,sa=nr&&Qyt(mr),Pr=O?Se.queuedBySession[O]??[]:[],Xl=Pr.some(se=>se.dispatchState==="retrying"),Zl=Pr.findIndex(se=>se.dispatchState==="blocked"),li=Pr.reduce((se,ye)=>ye.dispatchState!=="retrying"||typeof ye.nextRetryAt!="number"?se:se===null?ye.nextRetryAt:Math.min(se,ye.nextRetryAt),null),[so,Jl]=R.useState(()=>Date.now());R.useEffect(()=>{if(!Xl||li===null||(Jl(Date.now()),li<=Date.now()))return;const se=window.setInterval(()=>{const ye=Date.now();Jl(ye),ye>=li&&window.clearInterval(se)},1e3);return()=>window.clearInterval(se)},[Xl,li]),R.useEffect(()=>{const se=Pr.reduce((ye,Te)=>Te.planMode??ye,void 0);se!==void 0?(ut.current=!0,ct.current=se,jt(se)):ut.current&&(ut.current=!1,ct.current=null,jt(null))},[Pr]);const io=!!O&&!(O in Se.messagesBySession)&&Ze.isPending,Yo=R.useMemo(()=>{const se=new Set;for(const ye of Se.busySessions)(Se.messagesBySession[ye]??[]).some(Te=>Te.parts.some($e=>$e.type==="prompt"&&$e.prompt&&!$e.prompt.resolved&&$e.prompt.nativeId))&&se.add(ye);return se},[Se.busySessions,Se.messagesBySession]),za=O?Yo.has(O):!1,pt=rn,Ni=pt?Wr.get(pt.id):void 0,dr=R.useMemo(()=>{var se;for(let ye=mr.length-1;ye>=0;ye--)for(const Te of mr[ye].parts)if(Te.type==="prompt"&&((se=Te.prompt)==null?void 0:se.kind)==="plan"&&!Te.prompt.resolved)return{promptId:Te.id,plan:Te.prompt.plan??"",synthesized:!!Te.prompt.synthesized};return null},[mr]),Cr=R.useMemo(()=>{const se=pt==null?void 0:pt.harness;if(!O||se!=="claude-code"&&se!=="codex")return null;for(let ye=mr.length-1;ye>=0;ye--)for(const Te of mr[ye].parts)if(!(Te.type!=="prompt"||!Te.prompt||Te.prompt.resolved)&&Te.prompt.kind==="question")return Te.prompt.nativeId&&!Se.busySessions.has(O)?null:Te.id;return null},[mr,pt==null?void 0:pt.harness,O,Se.busySessions]),Us=si&&!Cr,ja=se=>!Cr&&!si&&ri.some(ye=>ye.name===se),[zi,xs]=R.useState(null),ao=zi&&zi.sessionId===O?zi:null;R.useEffect(()=>{if(!zi)return;const se=Se.busySessions.has(zi.sessionId),ye=zi.sessionId===O&&dr&&dr.promptId!==zi.promptId;(!se||ye)&&xs(null)},[zi,dr,Se.busySessions,O]);const tf=R.useMemo(()=>bk(mr),[mr]),Er=nr&&!!(Xe!=null&&Xe.supportsSteering)&&!!(Xe!=null&&Xe.agentReady)&&!dr&&!Cr&&!tf&&pe.length===0&&Q.length===0,ci=R.useMemo(()=>p&&O?(se,ye,Te)=>p(se,O,ye,Te):void 0,[p,O]),oo=R.useMemo(()=>m&&O?(se,ye,Te)=>m(O,se,ye,Te):void 0,[m,O]),lo=R.useMemo(()=>o&&((se,ye,Te,$e,Ue)=>o(se,O??void 0,ye,Te,$e,Ue)),[o,O]);R.useEffect(()=>{bt.current+=1,It.current+=1;const se=(O?Se.queuedBySession[O]??[]:[]).reduce((ye,Te)=>Te.planMode??ye,void 0);ut.current=se!==void 0,ct.current=se??null,jt(se??null),qt({}),ze(null)},[O]);const Xo=i==="chat"&&(mr.length>0||nr),Ta=(Kt==null?void 0:Kt.harness)??null,bu=(Kt==null?void 0:Kt.model)??null,Ts=Ze.data?null:Ze.error,ia=i==="chat"&&!Xo&&!io&&!Ts,co=ot({...uht(e,Ta??"claude-code",bu,j()),enabled:ia&&Ta!==null,subscribed:ia&&Ta!==null}),yu=((us=co.data)==null?void 0:us.prompts)??null,nf=Ta!==null&&co.isPending,ui=e===Ex?"demo":"project",xu=se=>{te(se),Ut(!1),window.requestAnimationFrame(()=>{const ye=Vt.current;ye&&(ye.focus(),ye.setSelectionRange(se.length,se.length),Qn(se.length))})};R.useEffect(()=>{v&&(te(v),Ut(!1),Qn(v.length))},[v]);const m_=R.useCallback(se=>{const ye=se.scrollHeight-se.scrollTop-se.clientHeight<60;Kn.current=ye,Nn(ye)},[]),Aa=R.useCallback(()=>{var se;Kn.current=!0,Nn(!0),(se=Zt.current)==null||se.call(Zt)},[]);R.useEffect(()=>{const se=un.current,ye=vn.current;if(!se||!ye)return;const Te=new ResizeObserver(()=>{var $e;Kn.current?($e=Zt.current)==null||$e.call(Zt):Nn(se.scrollHeight-se.scrollTop-se.clientHeight<60)});return Te.observe(se),Te.observe(ye),()=>Te.disconnect()},[Xo]);const g_=R.useCallback(se=>{se.currentTarget.blur(),Aa()},[Aa]);async function wu({queue:se=!1}={}){var sc,x_,w_,S_,k_,cf;if(ed({name:"first_action",surface:ui,action:"typed_prompt"}),Sr.current)return;const ye=oe.trim(),Te=Cr?null:U8t(ye,Pt==null?void 0:Pt.planActivation),$e=!!Te,Ue=!Un,wn=fA(Pt==null?void 0:Pt.planActivation,$e?Ue:void 0,ct.current),Sn=$e&&(Xe==null?void 0:Xe.id)==="claude-code"?Ue?"plan":"auto":void 0,Nr=Te?Te.prompt:ye,J=pe,ve=Q,Re=ve.map(Hn=>({text:Hn.text})),Ge=e,De=i;let at=O;const vt=()=>{const Hn=de.current;return Dn($.queryKey)&&Hn.projectId===Ge&&Hn.activeId===at&&Hn.mainView===De},sn=()=>{vt()&&(te(Hn=>Hn||ye),we(Hn=>Hn.length?Hn:J),le(Hn=>Hn.length?Hn:ve))};if($e&&!Nr&&J.length===0&&ve.length===0){te(""),Ut(!1);try{if((Xe==null?void 0:Xe.id)==="claude-code")Hs(Ue?"plan":"auto");else if((Pt==null?void 0:Pt.planActivation)==="command")await Vr(Ue);else throw new Error(xx())}catch{ze(OE()),sn()}return}const Fn=Kt?{...Kt,...Sn?{permissionMode:Sn}:{}}:null;Sn&&Hs(Sn);let Da=null;const fo=ct.current;$e&&(Pt==null?void 0:Pt.planActivation)==="command"&&(Da=++It.current,ct.current=Ue,jt(Ue));const Gs=()=>{!vt()||Da===null||It.current!==Da||(ct.current=fo,jt(fo))};if(!Nr&&J.length===0&&ve.length===0)return;if((Nr||ve.length>0)&&Cr&&J.length===0){te(""),le([]),aa({promptId:Cr,answers:[],note:Nr||void 0,annotations:Re}).then(Hn=>{Hn||sn()});return}const lf=JSON.stringify({text:Nr,images:J.map(Hn=>({mediaType:Hn.mediaType,name:Hn.name,dataUrl:Hn.dataUrl})),annotations:Re,settings:Fn?{model:Fn.model,serviceTier:Fn.serviceTier,permissionMode:Fn.permissionMode,planMode:wn,reasoningLevel:Fn.reasoningLevel}:null}),el=((sc=$n.current)==null?void 0:sc.signature)===lf?$n.current.id:`ct_${crypto.randomUUID()}`;if($n.current={signature:lf,id:el},nr){if(!O||!(Xe!=null&&Xe.agentReady)){Gs();return}const Hn=O;te(""),we([]),le([]),Pe(null);const di=Fn?{model:Fn.model,serviceTier:Fn.serviceTier,permissionMode:Fn.permissionMode,planMode:(Pt==null?void 0:Pt.planActivation)==="command"?wn??(rn==null?void 0:rn.planMode):wn,reasoningLevel:Fn.reasoningLevel}:{};vt()&&qt({});const La=J.map(zr=>({mediaType:zr.mediaType,dataBase64:zr.dataUrl.slice(zr.dataUrl.indexOf(",")+1),name:zr.name}));try{(x_=(await Yn(()=>IN(Hn,Nr,di,La.length?La:void 0,Re,el,Er&&!se&&!$e?"steer":void 0))).turn)!=null&&x_.existing&&await Ei(Hn),vt()&&cn(b0),((w_=$n.current)==null?void 0:w_.id)===el&&($n.current=null)}catch{Gs(),sn()}return}if(!(Xe!=null&&Xe.agentReady)){Gs();return}if(!Fn){Gs();return}let lr=O;try{Sr.current=!0;try{if(!lr){const ho=await rf(Fn,wn);lr=ho.id,at=ho.id}if(!Dn($.queryKey))return;const fr=Ol(lr);await tt.fetchQuery({...fr,...((S_=tt.getQueryState(fr.queryKey))==null?void 0:S_.fetchStatus)==="fetching"?{staleTime:0}:{}})}finally{Sr.current=!1}if(!Dn($.queryKey))return;vt()&&(te(fr=>fr===oe?"":fr),we(fr=>fr===J?[]:fr),le(fr=>fr===ve?[]:fr),Pe(null)),Ae({type:"optimisticUser",sessionId:lr,text:Nr||uie(),attachments:J.map(fr=>({url:fr.dataUrl,mediaType:fr.mediaType,name:fr.name})),annotations:ve}),Ae({type:"busy",sessionId:lr,busy:!0}),vt()&&Aa(),vt()&&re==="archived"&&ce("active");const Hn=Fn?{model:Fn.model,serviceTier:Fn.serviceTier,permissionMode:Fn.permissionMode,planMode:wn,reasoningLevel:Fn.reasoningLevel}:{};vt()&&qt({});const di=J.map(fr=>({mediaType:fr.mediaType,dataBase64:fr.dataUrl.slice(fr.dataUrl.indexOf(",")+1),name:fr.name})),La=lr;if(!La)throw new Error(Xhe());(k_=(await Yn(()=>IN(La,Nr,Hn,di.length?di:void 0,Re,el))).turn)!=null&&k_.existing&&await Ei(La),vt()&&cn(b0),((cf=$n.current)==null?void 0:cf.id)===el&&($n.current=null)}catch(Hn){if(!Dn($.queryKey)||(sn(),Gs(),!lr))return;const di=Hn instanceof Error?Hn.message:String(Hn);if(!/session is busy/i.test(di)&&await tt.fetchQuery({...xa(e),staleTime:0}).then(zr=>{var ic;return!!((ic=zr.find(fr=>fr.id===lr))!=null&&ic.busy)}).catch(()=>!1)){vt()&&(te(zr=>zr===Nr?"":zr),we(zr=>zr===J?[]:zr),le(zr=>zr===ve?[]:zr));return}Ae({type:"busy",sessionId:lr,busy:!1}),Ae({type:"localError",sessionId:lr,text:bae({error:Ne(di)})})}}async function rf(se,ye){const Te=de.current,$e=F.current,Ue=await z.mutateAsync([e,se.harness,{model:se.model,serviceTier:se.serviceTier,permissionMode:se.permissionMode,planMode:ye,reasoningLevel:se.reasoningLevel}]);return F.current===$e&&(H(wn=>[Ue,...wn.filter(Sn=>Sn.id!==Ue.id)]),tt.getQueryData($.queryKey)||qs(!0)),F.current===$e&&de.current===Te&&(L.current(Ue.id,{replace:!0}),de.current={...Te,activeId:Ue.id}),Ue}function Su(){const se=eCt(oe);te(se),window.requestAnimationFrame(()=>{var ye,Te;(ye=Vt.current)==null||ye.focus(),(Te=Vt.current)==null||Te.setSelectionRange(se.length,se.length),Qn(se.length)})}async function ec(){const se=Fs;if(!se)return;if(ze(null),nr){ze(Eie());return}const ye=oe,Te=de.current;let $e=O;const Ue=()=>{const J=de.current;return J.projectId===Te.projectId&&J.activeId===$e&&J.mainView===Te.mainView},wn=()=>{Ue()&&te(J=>J||ye)};te(""),Ut(!1);let Sn=O;if(!Sn){if(!(Xe!=null&&Xe.agentReady)||!Kt){wn(),ze(xx());return}try{const J=fA(Pt==null?void 0:Pt.planActivation,void 0,ct.current);Sn=(await rf(Kt,J)).id,$e=Sn,Ue()&&qt({})}catch(J){wn();const ve=J instanceof Error?J.message:String(J);Ue()&&ze(dE({error:Ne(ve)}));return}}Ue()&&re==="archived"&&ce("active");const Nr=`${xd}shell-${Date.now()}`;Ae({type:"localShell",sessionId:Sn,id:Nr,command:se}),Ue()&&Aa();try{const{message:J}=await _ft(Sn,se);Ae({type:"upsertMessage",sessionId:Sn,message:J})}catch(J){const ve=J instanceof Error?J.message:String(J);Ae({type:"localShell",sessionId:Sn,id:Nr,command:se,error:dE({error:Ne(ve)})})}}function ku(){O&&vft(O).catch(()=>{ze(g_e())})}const v_=R.useCallback(async(se,ye)=>{if(!(!O||tn.current)){tn.current=!0,ze(null),er(se);try{const Te=e2t({model:ln.model,serviceTier:ln.serviceTier,permissionMode:ln.permissionMode,planMode:ln.planMode,reasoningLevel:ln.reasoningLevel}),$e=O;(await pft($e,se,ye,Te)).turn.existing&&await Ei($e),cn(b0)}catch{ze(ghe())}finally{tn.current=!1,er(null)}}},[O,ln,Ei]),sf=R.useCallback((se,ye)=>{if(!O||nr||!(Xe!=null&&Xe.agentReady))return;const Te=O;Ae({type:"busy",sessionId:Te,busy:!0}),Aa(),Yn(()=>mft(Te,se,ye)).catch($e=>{Ae({type:"busy",sessionId:Te,busy:!1});const Ue=$e instanceof Error?$e.message:String($e);Ae({type:"localError",sessionId:Te,text:Che({error:Ne(Ue)})})})},[O,nr,Xe==null?void 0:Xe.agentReady,Aa,Yn]),Zo=R.useCallback(se=>{if(!O||nr)return;const ye=O,Te=Mr.current;Ae({type:"activeLeaf",sessionId:ye,leafId:se}),Yn(()=>gft(ye,se)).catch($e=>{Ae({type:"activeLeaf",sessionId:ye,leafId:Te});const Ue=$e instanceof Error?$e.message:String($e);Ae({type:"localError",sessionId:ye,text:x_e({error:Ne(Ue)})})})},[O,nr,Yn]);function af(se){if(!O)return;const ye=O;dft(ye,se).then(({removed:Te})=>{if(Te)return Ei(ye)}).catch(()=>ze(xhe()))}async function b_(se){if(!O||tr)return;const ye=O;ze(null),qn(se);try{await fft(ye,se),await Ei(ye)}catch{ze(Mhe())}finally{qn(null)}}R.useEffect(()=>{if(!nr||i!=="chat")return;function se(ye){var Te;ye.key!=="Escape"||ye.defaultPrevented||(ye.preventDefault(),ku(),(Te=Vt.current)==null||Te.focus())}return document.addEventListener("keydown",se),()=>document.removeEventListener("keydown",se)},[nr,O,i]);function vs(se){Xv(se),de.current.projectId===e&&de.current.activeId===se&&de.current.mainView==="chat"&&L.current(null,{replace:!0}),G(ye=>{if(!ye.has(se))return ye;const Te=new Set(ye);return Te.delete(se),Te}),gt.current.delete(se)}function jn(se,ye){const Te=se.archived;H($e=>$e.map(Ue=>Ue.id===se.id?{...Ue,archived:ye}:Ue)),M.mutateAsync([se.id,ye]).catch(()=>{H($e=>$e.map(Ue=>Ue.id===se.id?{...Ue,archived:Te}:Ue))})}function Cu(se,ye){const Te=se.title;H($e=>$e.map(Ue=>Ue.id===se.id?{...Ue,title:ye}:Ue)),I.mutateAsync([se.id,ye]).catch(()=>{H($e=>$e.map(Ue=>Ue.id===se.id?{...Ue,title:Te}:Ue))})}async function y_(se){var Te;const ye=((Te=se.title)==null?void 0:Te.trim())||Eg();if(window.confirm(Gie({title:Do(ye)}))){try{await B.mutateAsync(se.id)}catch($e){Vn(Qie({title:Do(ye),error:Ne($e instanceof Error?$e.message:String($e))}),"error");return}vs(se.id)}}const aa=R.useCallback(se=>{if(!O)return Promise.resolve(!1);const ye=O;return Ae({type:"busy",sessionId:ye,busy:!0}),Yn(()=>bft(ye,se)).then(()=>!0).catch(()=>!1).finally(()=>{Dn($.queryKey)&&(tt.fetchQuery({...Ol(ye),staleTime:0}).catch(()=>{}),tt.fetchQuery({...xa(e),staleTime:0}).catch(()=>{}))})},[O,e,Yn,$]),of=U.filter(se=>u9t(re,se.archived)),cs=/Mac|iPhone|iPad/.test(navigator.platform),uo=cs?"⌘ ⇧ ↵":"Ctrl + Shift + ↵",Jo=cs?"⌘ Enter":"Ctrl + Enter",tc=R.useCallback(()=>{ce("active"),w(null)},[w]),Eu=R.useCallback(se=>{ce("all"),w(se)},[w]);R.useEffect(()=>{const se=ye=>{ye.repeat||ye.key!=="Enter"||!ye.metaKey&&!ye.ctrlKey||ye.altKey||!ye.shiftKey||(ye.preventDefault(),tc())};return document.addEventListener("keydown",se),()=>document.removeEventListener("keydown",se)},[tc]);const Ra=f.jsxs("aside",{className:"session-rail w-68 shrink-0 flex flex-col mt-5 me-3.5 mb-5 ms-0 bg-background min-h-0 [&_.rail-body]:flex-1 [&_.rail-body]:min-h-0 [&_.rail-body]:overflow-y-auto [&_.rail-body]:pt-0 [&_.rail-body]:pb-1 [&_.rail-body]:px-2 border border-border rounded-lg overflow-visible shadow-elevated",children:[t,f.jsxs("nav",{className:"rail-nav flex flex-col gap-0.5 p-2 shrink-0",children:[f.jsxs("button",{className:"rail-nav-item flex items-center gap-2.5 py-[7px] px-2.5 text-base text-text rounded-md text-start hover:bg-surface [&[data-tip]::after]:top-auto [&[data-tip]::after]:bottom-[calc(100%_+_6px)]","data-onboarding":"new-session","data-tip":uo,"aria-keyshortcuts":"Meta+Shift+Enter Control+Shift+Enter",onClick:tc,children:[f.jsx(em,{size:15}),Kce()]}),f.jsxs("button",{className:`rail-nav-item flex items-center gap-2.5 py-[7px] px-2.5 text-base text-text rounded-md text-start [&:hover:not(.active)]:bg-surface [&.active]:bg-panel [&.active]:font-medium ${i==="skills"?"active":""}`,onClick:()=>a("skills"),children:[f.jsx(LO,{size:15}),$le()]}),B8t.map(se=>f.jsxs("button",{className:`rail-nav-item flex items-center gap-2.5 py-[7px] px-2.5 text-base text-text rounded-md text-start [&:hover:not(.active)]:bg-surface [&.active]:bg-panel [&.active]:font-medium ${i!=="chat"&&i!=="skills"&&se.activeTabs.includes(i)?"active":""}`,"data-onboarding":se.id==="compute"?"nav-compute":void 0,onClick:()=>a(se.id),children:[se.icon,se.label()]},se.id))]}),f.jsxs("div",{className:"rail-section-head flex items-center justify-between shrink-0 pt-3.5 pe-2.5 pb-0 ps-4.5",children:[f.jsx("div",{className:"rail-section-label p-0 text-sm font-medium text-subtext",children:((rc=xF.find(se=>se.id===re))==null?void 0:rc.railLabel())??kD()}),f.jsx("div",{className:"rail-section-actions flex items-center gap-0.5",children:f.jsx(d9t,{value:re,onChange:ce})})]}),f.jsxs("div",{className:"rail-body",children:[of.map(se=>f.jsx(p9t,{session:se,active:se.id===O&&i==="chat",unread:q.has(se.id),busy:Se.busySessions.has(se.id),waiting:Yo.has(se.id),revealTitle:Wr.get(se.id),onOpen:()=>{if(w(se.id),e===Ex){N0t(se.id);const ye=eut[se.id];ye&&(ed({name:"demo_experiment_started",kind:"curated",experiment:ye}),ed({name:"first_action",surface:"demo",action:"open_experiment"}))}},onRename:ye=>Cu(se,ye),onSetArchived:ye=>jn(se,ye),onDelete:()=>void y_(se)},se.id)),of.length===0&&f.jsx("div",{className:"rail-empty py-1.5 px-2.5 text-sm text-muted",children:re==="archived"?Bae():U.length>0?Tae():Hae()})]}),x.kind==="ssh"?f.jsx(uv,{runtime:x}):f.jsx("div",{className:"relative shrink-0 border-t border-border",children:f.jsxs("div",{className:"flex items-center gap-1.5 py-2 ps-1 pe-2.5",children:[f.jsx(Yt,{size:"small","aria-label":ZD(),"aria-haspopup":"dialog",onClick:()=>V(!0),children:f.jsx(e3,{size:14,className:"shrink-0"})}),f.jsxs("span",{className:"flex min-w-0 flex-col gap-1 text-start text-text",children:[f.jsx("span",{className:"truncate text-sm leading-tight",children:i6()}),f.jsxs("span",{className:"truncate text-xs leading-tight text-subtext",children:["OpenResearch ",Ne(x.version)]})]})]})}),Y&&f.jsx(m9t,{onClose:()=>V(!1),onConfigureSsh:()=>{V(!1),ee(!0)}}),X&&f.jsx(KP,{onClose:()=>{ee(!1),V(!0)}})]}),Kr="chat-header flex items-center gap-2 py-0 px-4 bg-background shrink-0 h-12 relative z-4 w-full max-w-readable my-0 mx-auto [&::after]:content-[''] [&::after]:absolute [&::after]:top-full [&::after]:start-0 [&::after]:end-0 [&::after]:h-6 [&::after]:bg-[linear-gradient(to_bottom,_var(--base),_transparent)] [&::after]:pointer-events-none",nc=!r&&f.jsx(Yt,{title:RE(),"aria-label":RE(),onClick:s,children:f.jsx(KO,{size:20})});return i!=="chat"?f.jsxs(f.Fragment,{children:[r&&Ra,f.jsxs("section",{className:"chat-pane flex-1 min-w-0 flex flex-col bg-background min-h-0",children:[!r&&f.jsx("div",{className:"flex h-12 shrink-0 items-center",children:nc}),f.jsx("div",{className:"settings-view-scroll flex-1 min-h-0 overflow-y-auto [scrollbar-gutter:stable_both-edges]",children:E})]})]}):f.jsxs(f.Fragment,{children:[r&&Ra,f.jsxs("section",{className:"chat-pane flex-1 min-w-0 flex flex-col bg-background min-h-0 mt-5",children:[f.jsxs("div",{className:r?"contents":"grid shrink-0 grid-cols-[2rem_minmax(0,1fr)_2rem] items-center",children:[nc,f.jsxs("div",{className:Kr,children:[f.jsx(op,{variant:"header",title:pt?((Nu=pt.title)==null?void 0:Nu.trim())||Eg():fE(),children:pt?f.jsx(wF,{title:((zu=pt.title)==null?void 0:zu.trim())||Eg(),animate:Ni!==void 0},Ni??"static"):fE()}),S&&f.jsx(Yt,{"data-tip":hE(),"aria-label":hE(),onClick:S,children:f.jsx(tpt,{size:15})})]})]}),Ts?f.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 p-5 text-subtext",role:"alert",children:[f.jsx("p",{children:Ts.message}),f.jsx(Le,{onClick:()=>void Ze.refetch(),children:Fi()})]}):io?f.jsxs("div",{className:"chat-loading flex-1 flex items-center justify-center gap-3 text-subtext text-xl p-5 [&_.spinner]:w-5.5 [&_.spinner]:h-5.5 [&_.spinner]:border-[3px]","aria-live":"polite","aria-busy":"true",children:[f.jsx(Lt,{}),f.jsx("span",{children:Uce()})]}):Xo?f.jsx("div",{className:"chat-thread flex-1 min-h-0 overflow-y-auto [scrollbar-gutter:stable_both-edges]",ref:un,tabIndex:0,role:"region","aria-label":((Ma=pt==null?void 0:pt.title)==null?void 0:Ma.trim())||Eg(),onScroll:se=>{m_(se.currentTarget),Fe.dismiss()},children:f.jsxs("div",{className:"chat-thread-inner max-w-readable my-0 mx-auto pt-4 px-4 pb-8 flex flex-col gap-4",ref:vn,children:[f.jsx(c9t,{scrollRef:un,scrollToEndRef:Zt,stickToBottom:Kn,onPinToBottom:Aa,messages:mr,allMessages:ra,canFork:Jd,onFork:sf,onSelectFork:Zo,busy:nr,onOpenFile:lo,onOpenRun:l,onOpenSpawnedSession:Eu,runExperimentName:u,onOpenExperiment:_,experimentName:d,onRespond:aa,onOpenPlan:ci,onOpenSubagent:oo,recoveringTurnId:Mt,onRecover:v_,skills:ri},O),nr&&za&&f.jsx("div",{className:"flex items-center gap-2 text-subtext text-sm pt-0.5 px-0 pb-2 italic",children:Tfe()}),nr&&!za&&!ef&&!sa&&f.jsx("div",{className:"text-base pt-0.5 px-1 pb-2",children:f.jsx("span",{className:"tool-running-shimmer",children:j_e()})})]})}):f.jsxs("div",{className:"chat-empty flex-1 flex flex-col items-center justify-center text-text p-8 text-center [&_h2]:m-0 [&_h2]:text-5xl [&_h2]:font-medium [&_h2]:tracking-[-0.015em] [&_h2]:text-text",children:[f.jsx("div",{className:"chat-empty-mark w-10.5 h-10.5 mb-5.5 [&_svg]:block [&_svg]:w-full [&_svg]:h-full",children:f.jsx(B6,{})}),f.jsx("h2",{children:Dfe()}),f.jsxs("div",{className:"chat-empty-project inline-flex items-center gap-[7px] mt-3 py-1.5 px-3 border border-border rounded-full text-subtext bg-surface text-lg font-medium",children:[f.jsx(Td,{size:19}),f.jsx("span",{children:n})]}),nf&&f.jsx("div",{className:kA,role:"status","aria-live":"polite","aria-label":efe(),"aria-busy":"true",children:SA.map((se,ye)=>f.jsxs("div",{className:`flex min-h-22 animate-pulse flex-col items-start justify-center gap-2.5 rounded-xl border bg-background px-5 py-4 ${Ow[ye].box}`,children:[f.jsxs("span",{className:`flex w-full items-center gap-2.5 ${Ow[ye].icon}`,children:[f.jsx(se,{size:17}),f.jsx("span",{className:"h-3.5 w-2/5 rounded bg-surface-bright"})]}),f.jsx("span",{className:"h-3 w-4/5 rounded bg-surface"})]},ye))}),yu&&yu.length>0&&f.jsx("div",{className:kA,role:"group","aria-label":sfe(),children:yu.map((se,ye)=>{const Te=SA[ye],$e=Ow[ye];return f.jsxs("button",{type:"button",className:`flex min-h-22 w-full min-w-0 cursor-pointer flex-col items-start justify-center gap-1.5 rounded-xl border bg-background px-5 py-4 text-start font-sans transition-colors duration-120 ease-standard hover:bg-surface ${$e.box}`,onClick:()=>{ed({name:"project_starter_clicked",slot:ye+1}),ed({name:"first_action",surface:ui,action:"starter_click"}),xu(se.prompt)},children:[f.jsxs("span",{className:"flex items-center gap-2.5 text-base font-medium text-text",children:[f.jsx(Te,{size:17,className:$e.icon}),se.title]}),f.jsx("span",{className:"w-full truncate text-sm text-subtext",children:se.prompt})]},ye)})})]}),Fe.action&&f.jsxs(Le,{type:"button",size:"small",className:"chat-selection-action fixed z-50 shadow-control",style:{left:Fe.action.x,top:Fe.action.top,transform:"translateX(-50%)"},onMouseDown:se=>se.preventDefault(),onClick:Fe.add,children:[f.jsx(VO,{size:14}),Toe()]}),f.jsxs("div",{className:"composer px-3 pb-5 shrink-0 relative z-4 bg-background w-full max-w-readable my-0 mx-auto [&_textarea]:border-0 [&_textarea]:bg-none [&_textarea]:bg-transparent [&_textarea]:resize-none [&_textarea]:pt-2.5 [&_textarea]:px-3 [&_textarea]:pb-1 [&_textarea]:text-base [&_textarea]:field-sizing-content [&_textarea]:min-h-18 [&_textarea]:max-h-45",children:[Xo&&f.jsx(Yt,{className:`absolute bottom-full left-1/2 z-5 mb-6 h-9 w-9 -translate-x-1/2 rounded-full border border-border bg-background shadow-control transition-opacity duration-150 ease-standard ${fn?"opacity-0":"opacity-100"}`,title:LE(),"aria-label":LE(),inert:fn,onClick:g_,children:nr&&!za?f.jsx(A6,{size:18,className:"tool-running-shimmer-icon"}):f.jsx(B0t,{size:16})}),dr&&!(ao&&dr.promptId===ao.promptId)&&f.jsx(K7t,{synthesized:dr.synthesized,agentLabel:pt?E0[pt.harness]:C_e(),showResumeModes:(pt==null?void 0:pt.harness)==="claude-code",onView:se=>ci==null?void 0:ci(dr.plan,dr.promptId,se),onApprove:se=>aa({promptId:dr.promptId,approve:!0,...se?{resumeMode:se}:{}}),onReject:()=>aa({promptId:dr.promptId,approve:!1}),onRevise:se=>{O&&xs({sessionId:O,promptId:dr.promptId}),aa({promptId:dr.promptId,approve:!1,note:se})}}),Pr.length>0&&f.jsx("div",{className:"composer-queued flex flex-col gap-1 mb-1.5",children:Pr.map((se,ye)=>f.jsxs("div",{className:"queued-chip flex flex-wrap items-center gap-x-2 gap-y-1 py-1.5 px-2.5 text-sm text-subtext bg-background border border-border rounded-sm",title:se.error?`${se.text} -${se.error}`:se.text,children:[se.dispatchState==="blocked"?f.jsx(O6,{size:13,className:"shrink-0 text-accent-amber"}):f.jsx(opt,{size:13,className:"shrink-0 text-muted"}),f.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-text",children:se.text}),se.dispatchState!=="blocked"&&f.jsx("span",{className:"shrink-0 text-sm text-muted",children:se.dispatchState==="retrying"?Jyt(se.nextRetryAt,La):ahe()}),se.dispatchState==="blocked"?f.jsxs(f.Fragment,{children:[f.jsx("button",{onClick:()=>void cf(se.id),"aria-label":lY({text:se.text}),disabled:or!==null,className:"shrink-0 px-1.5 py-0.5 border border-border rounded-sm text-sm text-text bg-background cursor-pointer disabled:opacity-50 disabled:cursor-default [&:hover:not(:disabled)]:border-text",children:or===se.id?tL():Ui()}),f.jsx("button",{onClick:()=>lf(se.id),"aria-label":sY({text:se.text}),disabled:or!==null,className:"shrink-0 px-1.5 py-0.5 border-0 text-sm text-muted bg-transparent cursor-pointer disabled:opacity-50 disabled:cursor-default [&:hover:not(:disabled)]:text-text",children:nde()}),be===Jl&&belf(se.id),className:"shrink-0 inline-flex items-center justify-center w-4 h-4 p-0 border-0 rounded-full text-muted cursor-pointer [&:hover]:bg-text [&:hover]:text-background",children:f.jsx(qr,{size:11})})]},se.id))}),f.jsxs("div",{className:`composer-box relative flex flex-col border ${xs?"border-accent-amber":"border-border"} rounded-lg bg-background shadow-elevated`,"data-onboarding":"composer",children:[Ke&&!Ke.agentReady&&f.jsxs("div",{className:"composer-harness-warning py-2 px-3 text-subtext text-sm leading-normal border-b border-b-border-variant [&_strong]:text-accent-amber [&_strong]:font-medium [&_code]:font-mono [&_code]:text-text",children:[f.jsxs("strong",{children:[Ke.name," ",Cce()]})," ",Ke.agentNote?tm(Ke.agentNote):hhe()]}),Da&&f.jsx(G8t,{skills:Cs,activeIndex:Vr,onPick:Xl,onHover:fr}),Q.length>0&&f.jsx(xCt,{annotations:Q,onClear:()=>{le([]),window.requestAnimationFrame(()=>{var se;return(se=ln.current)==null?void 0:se.focus()})},onRemove:se=>{const be=Q.filter(Ae=>Ae.id!==se);le(be),be.length===0&&window.requestAnimationFrame(()=>{var Ae;return(Ae=ln.current)==null?void 0:Ae.focus()})}}),pe.length>0&&f.jsx("div",{className:"composer-attachments flex flex-wrap gap-1.5 pt-2 px-3 pb-0",children:pe.map((se,be)=>{const Ae=()=>Se(Le=>Le.filter((Ue,zn)=>zn!==be));return se.mediaType==="application/pdf"?f.jsxs("div",{className:"attachment-file [&_button]:absolute [&_button]:-top-[5px] [&_button]:-right-[5px] [&_button]:inline-flex [&_button]:items-center [&_button]:justify-center [&_button]:w-4 [&_button]:h-4 [&_button]:p-0 [&_button]:border [&_button]:border-border [&_button]:rounded-full [&_button]:bg-surface [&_button]:text-text [&_button]:cursor-pointer [&_button:hover]:bg-text [&_button:hover]:text-background relative inline-flex items-center gap-2 max-w-55 py-2 px-2.5 border border-border rounded-sm text-text bg-surface [&_svg]:shrink-0 [&_svg]:text-muted",title:se.name,children:[f.jsx(ub,{size:22}),f.jsx("span",{className:"attachment-file-name overflow-hidden text-ellipsis whitespace-nowrap text-sm",children:se.name??"document.pdf"}),f.jsx("button",{title:NE(),"aria-label":NE(),onClick:Ae,children:f.jsx(qr,{size:11})})]},be):f.jsxs("div",{className:"attachment-thumb relative [&_img]:w-13 [&_img]:h-13 [&_img]:object-cover [&_img]:border [&_img]:border-border [&_img]:rounded-sm [&_img]:block [&_button]:absolute [&_button]:-top-[5px] [&_button]:-right-[5px] [&_button]:inline-flex [&_button]:items-center [&_button]:justify-center [&_button]:w-4 [&_button]:h-4 [&_button]:p-0 [&_button]:border [&_button]:border-border [&_button]:rounded-full [&_button]:bg-surface [&_button]:text-text [&_button]:cursor-pointer [&_button:hover]:bg-text [&_button:hover]:text-background",children:[f.jsx("img",{src:se.dataUrl,alt:Hfe()}),f.jsx("button",{title:zE(),"aria-label":zE(),onClick:Ae,children:f.jsx(qr,{size:11})})]},be)})}),ye&&f.jsx("div",{className:"composer-attach-error pt-1.5 px-3 pb-0 text-sm text-accent-red",role:"alert",children:ye}),Ie&&f.jsx("div",{className:"composer-settings-error pt-1.5 px-3 pb-0 text-sm text-accent-red",role:"alert",children:Ie}),f.jsxs("div",{className:`composer-input relative flex overflow-hidden [&_textarea]:flex-1 ${xs?"[&_textarea]:font-mono [&_textarea]:text-sm":""}`,children:[f.jsx("textarea",{dir:"auto",ref:ln,className:"relative z-1 bg-transparent",value:oe,placeholder:hr?$_e():us&&Ke?h_e({harness:Ne(E0[Ke.id]),shortcut:Ne(Bs)}):nn?Ke!=null&&Ke.agentReady?pae({harness:Ne(E0[nn.harness])}):dae({harness:Ne(E0[nn.harness])}):aie(),rows:2,onPaste:Ra,onDragOver:se=>{se.dataTransfer.types.includes("Files")&&se.preventDefault()},onDrop:se=>{se.dataTransfer.files.length!==0&&(se.preventDefault(),Ni(Array.from(se.dataTransfer.files)))},onChange:se=>{const be=se.target.value,Ae=se.target.selectionStart;Ln(Ae);const Le=Ae>0&&/\s/.test(be[Ae-1])&&!hr&&!di.current&&_A(be)===null?jw(be,Ae-1):null;if((Le==null?void 0:Le.query)==="plan"&&(Ut!=null&&Ut.planActivation)){yr(be,Le);return}ne(be),qt(!1)},onSelect:se=>Ln(se.currentTarget.selectionStart),onCompositionStart:()=>{di.current=!0},onCompositionEnd:()=>{di.current=!1},onKeyDown:se=>{if(Da){if(se.key==="ArrowDown"||se.key==="ArrowUp"){se.preventDefault();const be=se.key==="ArrowDown"?1:-1;fr((Vr+be+Cs.length)%Cs.length);return}if(se.key==="Tab"||se.key==="Enter"){se.preventDefault(),Xl(Cs[Vr]);return}if(se.key==="Escape"){se.preventDefault(),qt(!0);return}}if(se.key==="Backspace"&&io(se.currentTarget)){se.preventDefault();return}if(se.key==="Enter"&&!se.shiftKey&&!se.nativeEvent.isComposing){if(se.preventDefault(),xs){af();return}sf({queue:se.metaKey||se.ctrlKey})}}}),f.jsx(Y8t,{text:oe,editingTokenEnd:gs==null?void 0:gs.end,isCommand:la,skills:zi,projectId:e,textareaRef:ln})]}),f.jsxs("div",{className:"composer-actions flex min-w-0 justify-end items-center gap-2 pt-1.5 px-2 pb-2",children:[f.jsxs("div",{className:"option-picker relative inline-flex shrink-0",ref:pt.ref,children:[f.jsx(Qt,{type:"button",className:"composer-bare",title:yx(),"aria-label":yx(),"aria-haspopup":"dialog","aria-expanded":pt.open,onClick:()=>pt.setOpen(se=>!se),children:f.jsx(kmt,{size:16})}),pt.open&&f.jsxs("div",{className:"composer-sources-menu absolute bottom-[calc(100%_+_8px)] start-0 z-50 flex min-w-55 flex-col gap-1 rounded-md border border-border bg-background p-2 shadow-dropdown",children:[f.jsx("span",{className:"px-1 text-sm font-medium text-muted",children:yx()}),f.jsx(p2t,{})]})]}),f.jsx("input",{ref:It,type:"file",accept:"application/pdf,image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:se=>{Ni(Array.from(se.target.files??[])),se.target.value=""}}),f.jsx(Qt,{type:"button",className:"composer-attach",title:pE(),"aria-label":pE(),onClick:()=>{var se;return(se=It.current)==null?void 0:se.click()},children:f.jsx(lmt,{size:16})}),$r&&f.jsxs(Oe,{type:"button",variant:"ghost",active:!0,className:"group",title:wE(),"aria-label":wE(),onClick:()=>void cs(),children:[f.jsxs("span",{className:"relative size-4","aria-hidden":"true",children:[f.jsx(qpt,{className:"absolute inset-0 transition-opacity group-hover:opacity-0 group-focus-visible:opacity-0",size:16,strokeWidth:1.6}),f.jsx(qr,{className:"absolute inset-0 opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100",size:16,strokeWidth:1.8})]}),f.jsx("span",{children:cue()})]}),xs&&f.jsxs(Oe,{type:"button",variant:"ghost",active:!0,className:"group",title:xE(),"aria-label":xE(),onClick:hi,children:[f.jsxs("span",{className:"relative size-4","aria-hidden":"true",children:[f.jsx(c_,{className:"absolute inset-0 transition-opacity group-hover:opacity-0 group-focus-visible:opacity-0",size:16,strokeWidth:1.6}),f.jsx(qr,{className:"absolute inset-0 opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100",size:16,strokeWidth:1.8})]}),f.jsx("span",{children:bD()})]}),f.jsx("div",{className:"min-w-0 flex-1"}),f.jsxs("div",{className:"flex min-w-0 items-center",children:[f.jsx(cgt,{value:nn,onSelect:Xs,permissionChoices:Ke!=null&&Ke.agentReady?(Ut==null?void 0:Ut.permissionModes)??[]:[],defaultPermissionId:(Ut==null?void 0:Ut.defaultPermissionMode)??null,onSelectPermission:ls,reasoningChoices:Ke!=null&&Ke.agentReady?vs.choices:[],defaultReasoningId:vs.defaultId,onSelectReasoning:Ls,lockHarness:!!tn}),f.jsx(Z8t,{usage:tn==null?void 0:tn.contextUsage})]}),Bn&&!hr?f.jsx(Qt,{className:"send-btn",variant:"stop",title:ME(),"aria-label":ME(),onClick:of,children:f.jsx(qr,{size:16})}):f.jsx(Qt,{className:"send-btn",variant:"primary",title:xs?TE():C4(),"aria-label":xs?TE():C4(),onClick:()=>void(xs?af():sf()),disabled:xs?!os||!I&&!(Ke!=null&&Ke.agentReady):!(Ke!=null&&Ke.agentReady)||!oe.trim()&&pe.length===0&&Q.length===0,children:f.jsx(FO,{size:16})})]})]})]})]})]})}const v9t=[],b9t=[];function Fa({className:e,...n}){return f.jsx("div",{className:Ds("relative flex min-h-0 flex-1 flex-col",e),...n})}function ph({className:e,...n}){return f.jsx("div",{className:Ds("min-h-0 flex-1 overflow-auto bg-background",e),...n})}function Ao({className:e,...n}){return f.jsx("div",{className:Ds("shrink-0 border-b border-b-border-variant px-4 py-2 text-sm text-muted",e),...n})}const CA=["pane-content flex-1 min-h-0 relative subagent-tab-content overflow-y-auto","bg-background py-8 px-4"].join(" ");function y9t({sessionId:e,spawnPartId:n,onOpenFile:t,onOpenRun:r,runExperimentName:s,onOpenExperiment:i,experimentName:a,onOpenSubagent:o}){var x;const l=ct(Bl(e)),u=((x=l.data)==null?void 0:x.messages)??(l.isError?[]:null),_=R.useRef(null),d=R.useRef(null),p=R.useRef(!0);if(R.useLayoutEffect(()=>{p.current=!0;const S=_.current;S&&(S.scrollTop=S.scrollHeight)},[e,n]),R.useLayoutEffect(()=>{const S=_.current;S&&p.current&&(S.scrollTop=S.scrollHeight)},[u]),R.useEffect(()=>{const S=_.current,v=d.current;if(!S||!v)return;const b=new ResizeObserver(()=>{p.current&&(S.scrollTop=S.scrollHeight)});return b.observe(v),b.observe(S),()=>b.disconnect()},[u===null]),u===null)return f.jsx(Fa,{children:f.jsx("div",{className:CA,children:f.jsx("div",{className:"subagent-empty py-[3px] px-1 text-sm text-muted",children:Vit()})})});let m=null;for(const S of u)if(m=Av(S.parts,n),m)break;return f.jsx(Fa,{children:f.jsx("div",{className:CA,ref:_,onScroll:S=>{const v=S.currentTarget;p.current=v.scrollHeight-v.scrollTop-v.clientHeight<60},children:f.jsx("div",{ref:d,children:m?f.jsx(i9t,{spawn:m,onOpenFile:t,onOpenRun:r,runExperimentName:s,onOpenExperiment:i,experimentName:a,onOpenSubagent:o}):f.jsx("div",{className:"subagent-empty py-[3px] px-1 text-sm text-muted",children:Xit()})})})})}function x9t({experiment:e}){var s;const n=ct(fI(e.id)),t=n.data,r=(s=n.error)==null?void 0:s.message;return f.jsx(ph,{className:"branch-changes [&_>_.changes-note]:mx-4 [&_>_.changes-note]:my-3.5 [&_>_.diff-explorer]:mx-4 [&_>_.diff-explorer]:mb-0 [&_>_.diff-explorer]:mt-3.5 [&_>_.openresearch-diff]:mx-4 [&_>_.openresearch-diff]:mb-0 [&_>_.openresearch-diff]:mt-3.5 [&_>_.truncated-notice]:mx-4 [&_>_.truncated-notice]:mb-0 [&_>_.truncated-notice]:mt-3.5",children:r&&!t?f.jsxs(Ao,{children:[Tse()," ",Ne(r)]}):t?t.diff.trim()?f.jsxs(f.Fragment,{children:[t.truncated&&f.jsx(hB,{bytesRead:t.bytesRead,byteLimit:t.byteLimit}),f.jsx(pB,{diff:t.diff,partial:t.truncated})]}):f.jsx("div",{className:"changes-note text-sm text-muted",children:e.parentExperimentId?Bse():Ese()}):f.jsx(Ao,{children:Dse()})})}function SF({view:e,onViewChange:n,showViewToggle:t=!0,branchLabel:r,branchTitle:s,githubHref:i,githubTitle:a,refreshing:o,onRefresh:l}){return f.jsxs("div",{className:"code-tab-header flex items-center gap-2 py-1.5 px-3 border-b border-b-border-variant shrink-0 [&_>_.seg]:p-0.5 [&_>_.seg]:rounded-sm [&_>_.seg_button]:py-0.5 [&_>_.seg_button]:px-2 [&_>_.seg_button]:text-sm [&_>_.seg_button]:font-medium",children:[t&&f.jsxs("div",{className:"seg inline-flex items-center gap-0.5 p-[3px] rounded-md bg-hover-subtle [&_button]:py-[3px] [&_button]:px-3 [&_button]:text-sm [&_button]:font-medium [&_button]:text-text [&_button]:rounded-sm [&_button:not(:disabled):hover]:text-text [&_button.active]:bg-background [&_button.active]:shadow-segment [&_button:disabled]:text-muted [&_button:disabled]:cursor-default",role:"group","aria-label":w0e(),children:[f.jsx("button",{type:"button",className:e==="files"?"active":"","aria-pressed":e==="files",onClick:()=>n("files"),children:E0e()}),f.jsx("button",{type:"button",className:e==="changes"?"active":"","aria-pressed":e==="changes",onClick:()=>n("changes"),children:CD()})]}),r&&f.jsxs("span",{className:"wt-branch-chip inline-flex items-center gap-1 min-w-0 py-0.5 px-2 rounded-full bg-hover-muted text-subtext text-xs [&_>_svg]:shrink-0",title:s,children:[f.jsx(Jp,{size:12}),f.jsx("span",{className:"wt-branch-name overflow-hidden text-ellipsis whitespace-nowrap",children:r})]}),i&&f.jsx(rb,{href:i,target:"_blank",rel:"noopener noreferrer",title:a,"aria-label":a,children:f.jsx(hb,{size:13})}),f.jsx("span",{className:"flex-1"}),f.jsx(Qt,{title:BE(),"aria-label":BE(),onClick:l,children:o?f.jsx(Lt,{}):f.jsx(hmt,{size:13})})]})}const w9t=/\.(md|mdx|markdown)$/i,S9t=/\.tex$/i,k9t=/\.html?$/i,C9t=/\.(apng|avif|bmp|gif|heic|heif|ico|jpe?g|jfif|jxl|pbm|pgm|png|pnm|ppm|svg|tiff?|webp)$/i,E9t=/\.(csv|tsv|xlsx?|ods)$/i,N9t=/\.(c|cc|cpp|css|go|html?|java|js|jsx|json|mjs|py|rs|sh|toml|ts|tsx|ya?ml)$/i,z9t=/\.(7z|bz2|gz|rar|tar|tgz|zip)$/i,j9t=/\.pdf$/i,T9t=/\.(docx?|log|rtf|txt)$/i;function A9t(e){return C9t.test(e)}function yk(e){return w9t.test(e)}function kF(e){return S9t.test(e)}function R9t(e){return k9t.test(e)}function Zh({name:e}){const n=yk(e)?"markdown":A9t(e)?"image":E9t.test(e)?"spreadsheet":N9t.test(e)?"code":z9t.test(e)?"archive":j9t.test(e)?"pdf":T9t.test(e)||kF(e)?"document":"file";let t;return n==="markdown"?t=f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M1 3h14v10H1z",fill:"currentColor",opacity:".18"}),f.jsx("path",{d:"M2.6 10.5v-5h1.2l1.6 2 1.6-2h1.2v5H6.8V7.6L5.4 9.3 4 7.6v2.9H2.6Zm8.5-5v2.4h1.3L10.5 10 8.6 7.9h1.3V5.5h1.2Z",fill:"currentColor"})]}):n==="image"?t=f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"1.5",y:"2",width:"13",height:"12",rx:"2",fill:"currentColor",opacity:".18"}),f.jsx("circle",{cx:"5",cy:"5.5",r:"1.4",fill:"currentColor"}),f.jsx("path",{d:"m2.8 12 3.3-3.5 2.2 2 2.1-2.5 2.8 4H2.8Z",fill:"currentColor"})]}):n==="spreadsheet"?t=f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"2",y:"1.5",width:"12",height:"13",rx:"1.5",fill:"currentColor",opacity:".2"}),f.jsx("path",{d:"M3.5 4.5h9M3.5 8h9M3.5 11.5h9M7 3v10M10.5 3v10",stroke:"currentColor",strokeWidth:"1.1"})]}):n==="code"?t=f.jsx("path",{d:"M6.2 3 1.8 8l4.4 5 1.3-1.2L4.2 8l3.3-3.8L6.2 3Zm3.6 0-1.3 1.2L11.8 8l-3.3 3.8 1.3 1.2 4.4-5-4.4-5Z",fill:"currentColor"}):n==="archive"?t=f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M2 2h12v12H2z",fill:"currentColor",opacity:".18"}),f.jsx("path",{d:"M7 2h2v2H7V2Zm0 3h2v2H7V5Zm0 3h2v2H7V8Zm-0.5 3h3v2h-3v-2Z",fill:"currentColor"})]}):t=f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M3 1.5h6l4 4v9H3v-13Z",fill:"currentColor",opacity:".2"}),f.jsx("path",{d:"M9 1.5v4h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),f.jsx("path",{d:"M5 8h6M5 10.5h6M5 13h4",stroke:"currentColor",strokeWidth:"1.2"})]}),f.jsx("svg",{className:`file-tree-icon w-[15px] h-[15px] shrink-0 text-muted overflow-visible [&.markdown]:text-accent-blue [&.image]:text-accent-purple [&.spreadsheet]:text-accent-green [&.code]:text-accent-orange [&.archive]:text-accent-amber [&.pdf]:text-accent-red [&.document]:text-subtext ${n}`,viewBox:"0 0 16 16","aria-hidden":"true",children:t})}function CF(e,n){const t=navigator.clipboard;if(!t){Kn(AD(),"error");return}t.writeText(`${e.replace(/[\\/]+$/,"")}/${n}`).then(()=>Kn(tp(),"success")).catch(r=>Kn(r instanceof Error?r.message:String(r),"error"))}function EF({name:e,onCommit:n,onCancel:t}){const[r,s]=R.useState(e),i=R.useRef(!1),a=()=>{if(i.current)return;i.current=!0;const o=r.trim();!o||o===e?t():n(o)};return f.jsx(rs,{autoFocus:!0,variant:"inline",className:"min-w-0 flex-1",value:r,"aria-label":Obe({path:Ne(e)}),onFocus:o=>{const l=e.lastIndexOf(".");o.currentTarget.setSelectionRange(0,l>0?l:e.length)},onChange:o=>s(o.target.value),onClick:o=>o.stopPropagation(),onDoubleClick:o=>o.stopPropagation(),onBlur:a,onKeyDown:o=>{o.stopPropagation(),o.key==="Enter"?(o.preventDefault(),o.currentTarget.blur()):o.key==="Escape"&&(o.preventDefault(),i.current=!0,t())}})}function NF(e,n){const t=e.currentTarget.getBoundingClientRect(),r="clientX"in e?e.clientX:0,s="clientY"in e?e.clientY:0;return{path:n,x:r||t.left+16,y:s||t.top+t.height}}function zF({target:e,onOpen:n,onRename:t,onDuplicate:r,onCopyPath:s,onDelete:i,onClose:a}){const o=R.useRef(null),l=R.useRef(a);l.current=a;const[u,_]=R.useState({x:e.x,y:e.y});R.useLayoutEffect(()=>{var S;const m=o.current;if(!m)return;const x=document.activeElement instanceof HTMLElement?document.activeElement:null;return _({x:Math.max(8,Math.min(e.x,window.innerWidth-m.offsetWidth-8)),y:Math.max(8,Math.min(e.y,window.innerHeight-m.offsetHeight-8))}),(S=m.querySelector("button"))==null||S.focus(),()=>{m.contains(document.activeElement)&&(x==null||x.focus())}},[e]),R.useEffect(()=>{const m=()=>l.current(),x=v=>{var b;(b=o.current)!=null&&b.contains(v.target instanceof Node?v.target:null)||l.current()},S=v=>{if(v.key==="Tab"){v.preventDefault(),l.current();return}v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),l.current())};return document.addEventListener("pointerdown",x),window.addEventListener("blur",m),window.addEventListener("resize",m),window.addEventListener("scroll",m,!0),document.addEventListener("keydown",S,!0),()=>{document.removeEventListener("pointerdown",x),window.removeEventListener("blur",m),window.removeEventListener("resize",m),window.removeEventListener("scroll",m,!0),document.removeEventListener("keydown",S,!0)}},[]);const d=m=>{l.current(),m()},p=(m,x,S=!1)=>f.jsx(sr,{size:"compact",role:"menuitem",danger:S,onClick:()=>d(x),children:f.jsx("span",{children:m})});return no.createPortal(f.jsxs("div",{ref:o,role:"menu","aria-label":zbe({path:Ne(e.path)}),className:"option-menu fixed z-100 min-w-44 overflow-hidden rounded-md border border-border bg-background p-1 shadow-menu",style:{left:u.x,top:u.y},onContextMenu:m=>m.preventDefault(),onKeyDown:m=>{var b,w;if(m.key!=="ArrowDown"&&m.key!=="ArrowUp")return;m.preventDefault();const x=[...((b=o.current)==null?void 0:b.querySelectorAll("button"))??[]],S=x.indexOf(document.activeElement instanceof HTMLButtonElement?document.activeElement:x[0]),v=m.key==="ArrowDown"?1:-1;(w=x[(S+v+x.length)%x.length])==null||w.focus()},children:[p(Rbe(),n),t&&p(xD(),t),r&&p(kbe(),r),p(bre(),s),i&&p(yD(),i,!0)]}),document.body)}const o5=["file-tree-row flex items-center gap-1.5 w-full py-[3px] px-2.5 border-0","bg-transparent text-text text-start cursor-pointer font-[inherit]","[&:hover]:bg-panel [&_>_svg]:shrink-0","[&_>_svg]:text-subtext [&_>_svg.file-tree-chevron]:text-muted"].join(" "),EA=["file-tree-chevron text-muted shrink-0 [button&]:inline-flex","[button&]:items-center [button&]:justify-center [button&]:w-[13px]","[button&]:h-[13px] [button&]:p-0 [button&]:border-0 [button&]:bg-transparent","[button&_>_svg]:transition-transform [button&_>_svg]:duration-120 [button&_>_svg]:ease-standard [button&_>_svg.open]:rotate-90"].join(" ");function NA(){return{dirs:new Map,files:[]}}function jF(e){const n=NA();for(const t of e){const r=t.split("/");let s=n;for(let i=0;ii(t),title:t,children:[p?f.jsx(qo,{size:13,className:EA}):f.jsx(Ta,{size:13,className:EA}),f.jsx("span",{className:"file-tree-name flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:e})]}),p&&f.jsx(xk,{node:n,parentPath:t,depth:r+1,toggled:s,onToggle:i,onOpenFile:a,renamingPath:o,onContextMenu:l,onRename:u,onCancelRename:_})]})}function xk({node:e,parentPath:n,depth:t,toggled:r,onToggle:s,onOpenFile:i,renamingPath:a,onContextMenu:o,onRename:l,onCancelRename:u}){const _=[...e.dirs.keys()].sort((p,m)=>p.localeCompare(m)),d=[...e.files].sort((p,m)=>p.localeCompare(m));return f.jsxs(f.Fragment,{children:[_.map(p=>{const m=n?`${n}/${p}`:p;return f.jsx(M9t,{name:p,node:e.dirs.get(p),path:m,depth:t,toggled:r,onToggle:s,onOpenFile:i,renamingPath:a,onContextMenu:o,onRename:l,onCancelRename:u},`d:${m}`)}),d.map(p=>{const m=n?`${n}/${p}`:p;if(a===m&&l&&u)return f.jsxs("div",{className:o5,style:{paddingInlineStart:8+t*14},children:[f.jsx(Zh,{name:p}),f.jsx(EF,{name:p,onCommit:S=>l(m,S),onCancel:u})]},`f:${m}`);const x=Ur(S=>i(m,S));return f.jsxs("button",{type:"button",className:o5,style:{paddingInlineStart:8+t*14},...x,onContextMenu:S=>{o&&(S.preventDefault(),o(S,m))},onKeyDown:S=>{if(o&&(S.key==="ContextMenu"||S.shiftKey&&S.key==="F10")){S.preventDefault(),o(S,m);return}x.onKeyDown(S)},title:fQ({name:Ne(m)}),children:[f.jsx(Zh,{name:p}),f.jsx("span",{className:"file-tree-name flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:p})]},`f:${m}`)})]})}function D9t({projectId:e,project:n,experiment:t,view:r,toggled:s,onViewChange:i,onToggledChange:a,onOpenFile:o}){var E,N;const l=t.branchName,u=ct({..._I(e,{ref:l}),enabled:r==="files",subscribed:r==="files"}),_=ct({...fv(t.chatSessionId??""),enabled:r==="files"&&!!t.chatSessionId,subscribed:r==="files"&&!!t.chatSessionId}),d=u.data,p=(E=u.error)==null?void 0:E.message,m=u.isFetching,x=fI(t.id),S=IG({queryKey:x.queryKey})>0,v=(N=_.data)!=null&&N.exists&&_.data.branch===l?t.chatSessionId??void 0:void 0,b=()=>{u.refetch()},w=R.useMemo(()=>d?jF(d.entries):null,[d]),y=r==="files"?m:S,C=R.useCallback(T=>{const z=new Set(s);z.has(T)?z.delete(T):z.add(T),a(z)},[s,a]);return f.jsxs("div",{className:"code-tab flex flex-col h-full min-h-0",children:[f.jsx(SF,{view:r,onViewChange:i,branchLabel:l,branchTitle:`Committed branch ${l}`,githubHref:n.githubEnabled?eb(n.githubOwner,n.githubRepo,l):void 0,githubTitle:hD({branch:Ne(l)}),refreshing:y,onRefresh:()=>r==="files"?b():void nt.invalidateQueries(x)}),r==="changes"?f.jsx(x9t,{experiment:t},t.id):f.jsxs(f.Fragment,{children:[(d==null?void 0:d.truncated)&&f.jsx(Ao,{children:M0e()}),p&&w&&f.jsxs(Ao,{children:[F0e()," ",Ne(p)]}),f.jsx(ph,{children:w?w.dirs.size===0&&w.files.length===0?f.jsx(Ao,{children:I0e()}):f.jsx("div",{className:"file-tree py-1.5 px-0 text-sm",children:f.jsx(xk,{node:w,parentPath:"",depth:0,toggled:s,onToggle:C,onOpenFile:(T,z)=>v?o(T,v,void 0,z):o(T,void 0,l,z)})}):f.jsx(Ao,{children:p?ED({error:Ne(p)}):ND()})})]})]})}function wk({icon:e,title:n,description:t}){return f.jsxs("div",{className:"flex h-full w-full min-w-0 flex-1 flex-col items-center justify-center gap-1.5 bg-background p-6 text-center text-muted",children:[f.jsx(e,{size:36,strokeWidth:1.5,className:"shrink-0"}),f.jsx("h3",{className:"mt-1.5 mb-0 max-w-full wrap-anywhere text-xl font-medium text-text",children:n}),t&&f.jsx("p",{className:"m-0 w-full max-w-105 wrap-anywhere text-base leading-[1.55] text-subtext",children:t})]})}function L9t({sessionId:e,project:n,view:t,toggled:r,onViewChange:s,onToggledChange:i,onOpenFile:a,canRenameFile:o}){var I,L,F;const l=n.id,_=((I=ct(Ea(l)).data)==null?void 0:I.some(q=>q.id===e&&q.busy))??!1,d=ct({...fv(e??""),enabled:!!e,refetchInterval:_?5e3:!1}),p=d.data,m=e&&(p!=null&&p.exists)?{sessionId:e}:{ref:n.baselineBranch},x=ct({..._I(l,m),enabled:!e||d.isSuccess,refetchInterval:_?5e3:!1}),S=x.data,v=(L=d.error??x.error)==null?void 0:L.message,b=d.isFetching||x.isFetching,[w,y]=R.useState(null),[C,E]=R.useState(null),N=R.useCallback(()=>{e&&nt.invalidateQueries(fv(e)),nt.invalidateQueries({queryKey:Nt("getCodeTree",l),predicate:q=>!iD(q)})},[e,l]),T=R.useRef(_);R.useEffect(()=>{T.current&&!_&&N(),T.current=_},[_,N]);const z=R.useMemo(()=>S?jF(S.entries):null,[S]),M=R.useCallback(q=>{const G=new Set(r);G.has(q)?G.delete(q):G.add(q),i(G)},[r,i]),O=e&&(p!=null&&p.exists)?p:null,B=(O==null?void 0:O.branch)??(O!=null&&O.baselineBranch?Mct({branch:Ne(O.baselineBranch)}):o6()),$=((F=O==null?void 0:O.files)==null?void 0:F.length)??0,U=O?Cct({branch:Ne(`${B}${$>0?"*":""}`)}):jct({branch:Ne(n.baselineBranch)}),H=O?O.branch:n.baselineBranch,Y=(q,G)=>O?a(q,e,void 0,G):a(q,void 0,n.baselineBranch,G),V=(S==null?void 0:S.root)==="worktree",X=async(q,G)=>{try{await Aut(l,q,G,{sessionId:e}),N()}catch(ee){Kn(ee instanceof Error?ee.message:String(ee),"error")}},te=q=>{const G=(S==null?void 0:S.path)??n.repoPath;CF(G,q)};return f.jsxs("div",{className:"code-tab flex flex-col h-full min-h-0 wt-tab",children:[f.jsx(SF,{view:O?t:"files",onViewChange:s,showViewToggle:!!O,branchLabel:U,branchTitle:U,githubHref:n.githubEnabled&&H?eb(n.githubOwner,n.githubRepo,H):void 0,githubTitle:H?hD({branch:Ne(H)}):void 0,refreshing:b,onRefresh:N}),v&&(p||S)&&f.jsxs(Ao,{children:[Jct()," ",Ne(v)]}),!S||e&&!p?f.jsx(ph,{children:f.jsx(Ao,{children:v?ED({error:Ne(v)}):ND()})}):O&&t==="changes"?f.jsx(ph,{className:"wt-changes px-4 pb-6 pt-0 [&_>_:first-child]:mt-3.5",children:$===0||!O.diff?f.jsx("div",{className:"changes-note text-sm text-muted",children:Gct()}):f.jsxs(f.Fragment,{children:[O.diff.truncated&&f.jsx(hB,{bytesRead:O.diff.bytesRead,byteLimit:O.diff.byteLimit}),f.jsx(pB,{diff:O.diff.diff,partial:O.diff.truncated})]})}):f.jsxs(ph,{children:[S.truncated&&f.jsx(Ao,{children:Ict()}),z?z.dirs.size===0&&z.files.length===0?f.jsx(wk,{icon:Dd,title:Qct(),description:Gxe()}):f.jsx("div",{className:"file-tree py-1.5 px-0 text-sm",children:f.jsx(xk,{node:z,parentPath:"",depth:0,toggled:r,onToggle:M,onOpenFile:Y,renamingPath:C,onContextMenu:(q,G)=>{y(NF(q,G))},onRename:(q,G)=>{E(null),X(q,{action:"rename",newName:G})},onCancelRename:()=>E(null)})}):f.jsx(Ao,{children:Fct()})]}),w&&f.jsx(zF,{target:w,onOpen:()=>Y(w.path,"keepOpen"),onRename:V&&o(w.path)?()=>E(w.path):void 0,onDuplicate:V?()=>void X(w.path,{action:"duplicate"}):void 0,onCopyPath:()=>te(w.path),onDelete:V?()=>{window.confirm(ybe({path:Ne(w.path)}))&&X(w.path,{action:"delete"})}:void 0,onClose:()=>y(null)})]})}function TF({text:e,path:n,highlightLine:t,scrollRequest:r,onScrollRequestHandled:s}){const i=R.useMemo(()=>{if(!e)return[];const _=e.replace(/\r\n?/g,` +${se.error}`:se.text,children:[se.dispatchState==="blocked"?f.jsx(O6,{size:13,className:"shrink-0 text-accent-amber"}):f.jsx(opt,{size:13,className:"shrink-0 text-muted"}),f.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-text",children:se.text}),se.dispatchState!=="blocked"&&f.jsx("span",{className:"shrink-0 text-sm text-muted",children:se.dispatchState==="retrying"?Jyt(se.nextRetryAt,so):ahe()}),se.dispatchState==="blocked"?f.jsxs(f.Fragment,{children:[f.jsx("button",{onClick:()=>void b_(se.id),"aria-label":lY({text:se.text}),disabled:tr!==null,className:"shrink-0 px-1.5 py-0.5 border border-border rounded-sm text-sm text-text bg-background cursor-pointer disabled:opacity-50 disabled:cursor-default [&:hover:not(:disabled)]:border-text",children:tr===se.id?tL():Fi()}),f.jsx("button",{onClick:()=>af(se.id),"aria-label":sY({text:se.text}),disabled:tr!==null,className:"shrink-0 px-1.5 py-0.5 border-0 text-sm text-muted bg-transparent cursor-pointer disabled:opacity-50 disabled:cursor-default [&:hover:not(:disabled)]:text-text",children:nde()}),ye===Zl&&yeaf(se.id),className:"shrink-0 inline-flex items-center justify-center w-4 h-4 p-0 border-0 rounded-full text-muted cursor-pointer [&:hover]:bg-text [&:hover]:text-background",children:f.jsx(qr,{size:11})})]},se.id))}),f.jsxs("div",{className:`composer-box relative flex flex-col border ${Us?"border-accent-amber":"border-border"} rounded-lg bg-background shadow-elevated`,"data-onboarding":"composer",children:[Xe&&!Xe.agentReady&&f.jsxs("div",{className:"composer-harness-warning py-2 px-3 text-subtext text-sm leading-normal border-b border-b-border-variant [&_strong]:text-accent-amber [&_strong]:font-medium [&_code]:font-mono [&_code]:text-text",children:[f.jsxs("strong",{children:[Xe.name," ",Cce()]})," ",Xe.agentNote?tm(Xe.agentNote):hhe()]}),Ci&&f.jsx(G8t,{skills:gs,activeIndex:os,onPick:Ql,onHover:cr}),Q.length>0&&f.jsx(xCt,{annotations:Q,onClear:()=>{le([]),window.requestAnimationFrame(()=>{var se;return(se=Vt.current)==null?void 0:se.focus()})},onRemove:se=>{const ye=Q.filter(Te=>Te.id!==se);le(ye),ye.length===0&&window.requestAnimationFrame(()=>{var Te;return(Te=Vt.current)==null?void 0:Te.focus()})}}),pe.length>0&&f.jsx("div",{className:"composer-attachments flex flex-wrap gap-1.5 pt-2 px-3 pb-0",children:pe.map((se,ye)=>{const Te=()=>we($e=>$e.filter((Ue,wn)=>wn!==ye));return se.mediaType==="application/pdf"?f.jsxs("div",{className:"attachment-file [&_button]:absolute [&_button]:-top-[5px] [&_button]:-right-[5px] [&_button]:inline-flex [&_button]:items-center [&_button]:justify-center [&_button]:w-4 [&_button]:h-4 [&_button]:p-0 [&_button]:border [&_button]:border-border [&_button]:rounded-full [&_button]:bg-surface [&_button]:text-text [&_button]:cursor-pointer [&_button:hover]:bg-text [&_button:hover]:text-background relative inline-flex items-center gap-2 max-w-55 py-2 px-2.5 border border-border rounded-sm text-text bg-surface [&_svg]:shrink-0 [&_svg]:text-muted",title:se.name,children:[f.jsx(cb,{size:22}),f.jsx("span",{className:"attachment-file-name overflow-hidden text-ellipsis whitespace-nowrap text-sm",children:se.name??"document.pdf"}),f.jsx("button",{title:NE(),"aria-label":NE(),onClick:Te,children:f.jsx(qr,{size:11})})]},ye):f.jsxs("div",{className:"attachment-thumb relative [&_img]:w-13 [&_img]:h-13 [&_img]:object-cover [&_img]:border [&_img]:border-border [&_img]:rounded-sm [&_img]:block [&_button]:absolute [&_button]:-top-[5px] [&_button]:-right-[5px] [&_button]:inline-flex [&_button]:items-center [&_button]:justify-center [&_button]:w-4 [&_button]:h-4 [&_button]:p-0 [&_button]:border [&_button]:border-border [&_button]:rounded-full [&_button]:bg-surface [&_button]:text-text [&_button]:cursor-pointer [&_button:hover]:bg-text [&_button:hover]:text-background",children:[f.jsx("img",{src:se.dataUrl,alt:Hfe()}),f.jsx("button",{title:zE(),"aria-label":zE(),onClick:Te,children:f.jsx(qr,{size:11})})]},ye)})}),be&&f.jsx("div",{className:"composer-attach-error pt-1.5 px-3 pb-0 text-sm text-accent-red",role:"alert",children:be}),Be&&f.jsx("div",{className:"composer-settings-error pt-1.5 px-3 pb-0 text-sm text-accent-red",role:"alert",children:Be}),f.jsxs("div",{className:`composer-input relative flex overflow-hidden [&_textarea]:flex-1 ${Us?"[&_textarea]:font-mono [&_textarea]:text-sm":""}`,children:[f.jsx("textarea",{dir:"auto",ref:Vt,className:"relative z-1 bg-transparent",value:oe,placeholder:Cr?$_e():Er&&Xe?h_e({harness:Ne(E0[Xe.id]),shortcut:Ne(Jo)}):Kt?Xe!=null&&Xe.agentReady?pae({harness:Ne(E0[Kt.harness])}):dae({harness:Ne(E0[Kt.harness])}):aie(),rows:2,onPaste:Na,onDragOver:se=>{se.dataTransfer.types.includes("Files")&&se.preventDefault()},onDrop:se=>{se.dataTransfer.files.length!==0&&(se.preventDefault(),zs(Array.from(se.dataTransfer.files)))},onChange:se=>{const ye=se.target.value,Te=se.target.selectionStart;Qn(Te);const $e=Te>0&&/\s/.test(ye[Te-1])&&!Cr&&!ki.current&&_A(ye)===null?jw(ye,Te-1):null;if(($e==null?void 0:$e.query)==="plan"&&(Pt!=null&&Pt.planActivation)){oi(ye,$e);return}te(ye),Ut(!1)},onSelect:se=>Qn(se.currentTarget.selectionStart),onCompositionStart:()=>{ki.current=!0},onCompositionEnd:()=>{ki.current=!1},onKeyDown:se=>{if(Ci){if(se.key==="ArrowDown"||se.key==="ArrowUp"){se.preventDefault();const ye=se.key==="ArrowDown"?1:-1;cr((os+ye+gs.length)%gs.length);return}if(se.key==="Tab"||se.key==="Enter"){se.preventDefault(),Ql(gs[os]);return}if(se.key==="Escape"){se.preventDefault(),Ut(!0);return}}if(se.key==="Backspace"&&ro(se.currentTarget)){se.preventDefault();return}if(se.key==="Enter"&&!se.shiftKey&&!se.nativeEvent.isComposing){if(se.preventDefault(),Us){ec();return}wu({queue:se.metaKey||se.ctrlKey})}}}),f.jsx(Y8t,{text:oe,editingTokenEnd:as==null?void 0:as.end,isCommand:ja,skills:ri,projectId:e,textareaRef:Vt})]}),f.jsxs("div",{className:"composer-actions flex min-w-0 justify-end items-center gap-2 pt-1.5 px-2 pb-2",children:[f.jsxs("div",{className:"option-picker relative inline-flex shrink-0",ref:xt.ref,children:[f.jsx(Yt,{type:"button",className:"composer-bare",title:yx(),"aria-label":yx(),"aria-haspopup":"dialog","aria-expanded":xt.open,onClick:()=>xt.setOpen(se=>!se),children:f.jsx(kmt,{size:16})}),xt.open&&f.jsxs("div",{className:"composer-sources-menu absolute bottom-[calc(100%_+_8px)] start-0 z-50 flex min-w-55 flex-col gap-1 rounded-md border border-border bg-background p-2 shadow-dropdown",children:[f.jsx("span",{className:"px-1 text-sm font-medium text-muted",children:yx()}),f.jsx(p2t,{})]})]}),f.jsx("input",{ref:Ht,type:"file",accept:"application/pdf,image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:se=>{zs(Array.from(se.target.files??[])),se.target.value=""}}),f.jsx(Yt,{type:"button",className:"composer-attach",title:pE(),"aria-label":pE(),onClick:()=>{var se;return(se=Ht.current)==null?void 0:se.click()},children:f.jsx(lmt,{size:16})}),Un&&f.jsxs(Le,{type:"button",variant:"ghost",active:!0,className:"group",title:wE(),"aria-label":wE(),onClick:()=>void $r(),children:[f.jsxs("span",{className:"relative size-4","aria-hidden":"true",children:[f.jsx(qpt,{className:"absolute inset-0 transition-opacity group-hover:opacity-0 group-focus-visible:opacity-0",size:16,strokeWidth:1.6}),f.jsx(qr,{className:"absolute inset-0 opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100",size:16,strokeWidth:1.8})]}),f.jsx("span",{children:cue()})]}),Us&&f.jsxs(Le,{type:"button",variant:"ghost",active:!0,className:"group",title:xE(),"aria-label":xE(),onClick:Su,children:[f.jsxs("span",{className:"relative size-4","aria-hidden":"true",children:[f.jsx(i_,{className:"absolute inset-0 transition-opacity group-hover:opacity-0 group-focus-visible:opacity-0",size:16,strokeWidth:1.6}),f.jsx(qr,{className:"absolute inset-0 opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100",size:16,strokeWidth:1.8})]}),f.jsx("span",{children:bD()})]}),f.jsx("div",{className:"min-w-0 flex-1"}),f.jsxs("div",{className:"flex min-w-0 items-center",children:[f.jsx(cgt,{value:Kt,onSelect:js,permissionChoices:Xe!=null&&Xe.agentReady?(Pt==null?void 0:Pt.permissionModes)??[]:[],defaultPermissionId:(Pt==null?void 0:Pt.defaultPermissionMode)??null,onSelectPermission:Hs,reasoningChoices:Xe!=null&&Xe.agentReady?ai.choices:[],defaultReasoningId:ai.defaultId,onSelectReasoning:ls,lockHarness:!!rn}),f.jsx(Z8t,{usage:rn==null?void 0:rn.contextUsage})]}),nr&&!Cr?f.jsx(Yt,{className:"send-btn",variant:"stop",title:ME(),"aria-label":ME(),onClick:ku,children:f.jsx(qr,{size:16})}):f.jsx(Yt,{className:"send-btn",variant:"primary",title:Us?TE():C4(),"aria-label":Us?TE():C4(),onClick:()=>void(Us?ec():wu()),disabled:Us?!Fs||!O&&!(Xe!=null&&Xe.agentReady):!(Xe!=null&&Xe.agentReady)||!oe.trim()&&pe.length===0&&Q.length===0,children:f.jsx(FO,{size:16})})]})]})]})]})]})}const v9t=[],b9t=[];function $a({className:e,...n}){return f.jsx("div",{className:Ns("relative flex min-h-0 flex-1 flex-col",e),...n})}function dh({className:e,...n}){return f.jsx("div",{className:Ns("min-h-0 flex-1 overflow-auto bg-background",e),...n})}function Ao({className:e,...n}){return f.jsx("div",{className:Ns("shrink-0 border-b border-b-border-variant px-4 py-2 text-sm text-muted",e),...n})}const CA=["pane-content flex-1 min-h-0 relative subagent-tab-content overflow-y-auto","bg-background py-8 px-4"].join(" ");function y9t({sessionId:e,spawnPartId:n,onOpenFile:t,onOpenRun:r,runExperimentName:s,onOpenExperiment:i,experimentName:a,onOpenSubagent:o}){var x;const l=ot(Ol(e)),u=((x=l.data)==null?void 0:x.messages)??(l.isError?[]:null),_=R.useRef(null),d=R.useRef(null),p=R.useRef(!0);if(R.useLayoutEffect(()=>{p.current=!0;const S=_.current;S&&(S.scrollTop=S.scrollHeight)},[e,n]),R.useLayoutEffect(()=>{const S=_.current;S&&p.current&&(S.scrollTop=S.scrollHeight)},[u]),R.useEffect(()=>{const S=_.current,v=d.current;if(!S||!v)return;const b=new ResizeObserver(()=>{p.current&&(S.scrollTop=S.scrollHeight)});return b.observe(v),b.observe(S),()=>b.disconnect()},[u===null]),u===null)return f.jsx($a,{children:f.jsx("div",{className:CA,children:f.jsx("div",{className:"subagent-empty py-[3px] px-1 text-sm text-muted",children:Vit()})})});let m=null;for(const S of u)if(m=ey(S.parts,n),m)break;return f.jsx($a,{children:f.jsx("div",{className:CA,ref:_,onScroll:S=>{const v=S.currentTarget;p.current=v.scrollHeight-v.scrollTop-v.clientHeight<60},children:f.jsx("div",{ref:d,children:m?f.jsx(i9t,{spawn:m,onOpenFile:t,onOpenRun:r,runExperimentName:s,onOpenExperiment:i,experimentName:a,onOpenSubagent:o}):f.jsx("div",{className:"subagent-empty py-[3px] px-1 text-sm text-muted",children:Xit()})})})})}function x9t({experiment:e}){var s;const n=ot(fI(e.id)),t=n.data,r=(s=n.error)==null?void 0:s.message;return f.jsx(dh,{className:"branch-changes [&_>_.changes-note]:mx-4 [&_>_.changes-note]:my-3.5 [&_>_.diff-explorer]:mx-4 [&_>_.diff-explorer]:mb-0 [&_>_.diff-explorer]:mt-3.5 [&_>_.openresearch-diff]:mx-4 [&_>_.openresearch-diff]:mb-0 [&_>_.openresearch-diff]:mt-3.5 [&_>_.truncated-notice]:mx-4 [&_>_.truncated-notice]:mb-0 [&_>_.truncated-notice]:mt-3.5",children:r&&!t?f.jsxs(Ao,{children:[Tse()," ",Ne(r)]}):t?t.diff.trim()?f.jsxs(f.Fragment,{children:[t.truncated&&f.jsx(hB,{bytesRead:t.bytesRead,byteLimit:t.byteLimit}),f.jsx(pB,{diff:t.diff,partial:t.truncated})]}):f.jsx("div",{className:"changes-note text-sm text-muted",children:e.parentExperimentId?Bse():Ese()}):f.jsx(Ao,{children:Dse()})})}function SF({view:e,onViewChange:n,showViewToggle:t=!0,branchLabel:r,branchTitle:s,githubHref:i,githubTitle:a,refreshing:o,onRefresh:l}){return f.jsxs("div",{className:"code-tab-header flex items-center gap-2 py-1.5 px-3 border-b border-b-border-variant shrink-0 [&_>_.seg]:p-0.5 [&_>_.seg]:rounded-sm [&_>_.seg_button]:py-0.5 [&_>_.seg_button]:px-2 [&_>_.seg_button]:text-sm [&_>_.seg_button]:font-medium",children:[t&&f.jsxs("div",{className:"seg inline-flex items-center gap-0.5 p-[3px] rounded-md bg-hover-subtle [&_button]:py-[3px] [&_button]:px-3 [&_button]:text-sm [&_button]:font-medium [&_button]:text-text [&_button]:rounded-sm [&_button:not(:disabled):hover]:text-text [&_button.active]:bg-background [&_button.active]:shadow-segment [&_button:disabled]:text-muted [&_button:disabled]:cursor-default",role:"group","aria-label":w0e(),children:[f.jsx("button",{type:"button",className:e==="files"?"active":"","aria-pressed":e==="files",onClick:()=>n("files"),children:E0e()}),f.jsx("button",{type:"button",className:e==="changes"?"active":"","aria-pressed":e==="changes",onClick:()=>n("changes"),children:CD()})]}),r&&f.jsxs("span",{className:"wt-branch-chip inline-flex items-center gap-1 min-w-0 py-0.5 px-2 rounded-full bg-hover-muted text-subtext text-xs [&_>_svg]:shrink-0",title:s,children:[f.jsx(Jp,{size:12}),f.jsx("span",{className:"wt-branch-name overflow-hidden text-ellipsis whitespace-nowrap",children:r})]}),i&&f.jsx(nb,{href:i,target:"_blank",rel:"noopener noreferrer",title:a,"aria-label":a,children:f.jsx(fb,{size:13})}),f.jsx("span",{className:"flex-1"}),f.jsx(Yt,{title:BE(),"aria-label":BE(),onClick:l,children:o?f.jsx(Lt,{}):f.jsx(hmt,{size:13})})]})}const w9t=/\.(md|mdx|markdown)$/i,S9t=/\.tex$/i,k9t=/\.html?$/i,C9t=/\.(apng|avif|bmp|gif|heic|heif|ico|jpe?g|jfif|jxl|pbm|pgm|png|pnm|ppm|svg|tiff?|webp)$/i,E9t=/\.(csv|tsv|xlsx?|ods)$/i,N9t=/\.(c|cc|cpp|css|go|html?|java|js|jsx|json|mjs|py|rs|sh|toml|ts|tsx|ya?ml)$/i,z9t=/\.(7z|bz2|gz|rar|tar|tgz|zip)$/i,j9t=/\.pdf$/i,T9t=/\.(docx?|log|rtf|txt)$/i;function A9t(e){return C9t.test(e)}function yk(e){return w9t.test(e)}function kF(e){return S9t.test(e)}function R9t(e){return k9t.test(e)}function Kh({name:e}){const n=yk(e)?"markdown":A9t(e)?"image":E9t.test(e)?"spreadsheet":N9t.test(e)?"code":z9t.test(e)?"archive":j9t.test(e)?"pdf":T9t.test(e)||kF(e)?"document":"file";let t;return n==="markdown"?t=f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M1 3h14v10H1z",fill:"currentColor",opacity:".18"}),f.jsx("path",{d:"M2.6 10.5v-5h1.2l1.6 2 1.6-2h1.2v5H6.8V7.6L5.4 9.3 4 7.6v2.9H2.6Zm8.5-5v2.4h1.3L10.5 10 8.6 7.9h1.3V5.5h1.2Z",fill:"currentColor"})]}):n==="image"?t=f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"1.5",y:"2",width:"13",height:"12",rx:"2",fill:"currentColor",opacity:".18"}),f.jsx("circle",{cx:"5",cy:"5.5",r:"1.4",fill:"currentColor"}),f.jsx("path",{d:"m2.8 12 3.3-3.5 2.2 2 2.1-2.5 2.8 4H2.8Z",fill:"currentColor"})]}):n==="spreadsheet"?t=f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"2",y:"1.5",width:"12",height:"13",rx:"1.5",fill:"currentColor",opacity:".2"}),f.jsx("path",{d:"M3.5 4.5h9M3.5 8h9M3.5 11.5h9M7 3v10M10.5 3v10",stroke:"currentColor",strokeWidth:"1.1"})]}):n==="code"?t=f.jsx("path",{d:"M6.2 3 1.8 8l4.4 5 1.3-1.2L4.2 8l3.3-3.8L6.2 3Zm3.6 0-1.3 1.2L11.8 8l-3.3 3.8 1.3 1.2 4.4-5-4.4-5Z",fill:"currentColor"}):n==="archive"?t=f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M2 2h12v12H2z",fill:"currentColor",opacity:".18"}),f.jsx("path",{d:"M7 2h2v2H7V2Zm0 3h2v2H7V5Zm0 3h2v2H7V8Zm-0.5 3h3v2h-3v-2Z",fill:"currentColor"})]}):t=f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M3 1.5h6l4 4v9H3v-13Z",fill:"currentColor",opacity:".2"}),f.jsx("path",{d:"M9 1.5v4h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),f.jsx("path",{d:"M5 8h6M5 10.5h6M5 13h4",stroke:"currentColor",strokeWidth:"1.2"})]}),f.jsx("svg",{className:`file-tree-icon w-[15px] h-[15px] shrink-0 text-muted overflow-visible [&.markdown]:text-accent-blue [&.image]:text-accent-purple [&.spreadsheet]:text-accent-green [&.code]:text-accent-orange [&.archive]:text-accent-amber [&.pdf]:text-accent-red [&.document]:text-subtext ${n}`,viewBox:"0 0 16 16","aria-hidden":"true",children:t})}function CF(e,n){const t=navigator.clipboard;if(!t){Vn(AD(),"error");return}t.writeText(`${e.replace(/[\\/]+$/,"")}/${n}`).then(()=>Vn(tp(),"success")).catch(r=>Vn(r instanceof Error?r.message:String(r),"error"))}function EF({name:e,onCommit:n,onCancel:t}){const[r,s]=R.useState(e),i=R.useRef(!1),a=()=>{if(i.current)return;i.current=!0;const o=r.trim();!o||o===e?t():n(o)};return f.jsx(ns,{autoFocus:!0,variant:"inline",className:"min-w-0 flex-1",value:r,"aria-label":Obe({path:Ne(e)}),onFocus:o=>{const l=e.lastIndexOf(".");o.currentTarget.setSelectionRange(0,l>0?l:e.length)},onChange:o=>s(o.target.value),onClick:o=>o.stopPropagation(),onDoubleClick:o=>o.stopPropagation(),onBlur:a,onKeyDown:o=>{o.stopPropagation(),o.key==="Enter"?(o.preventDefault(),o.currentTarget.blur()):o.key==="Escape"&&(o.preventDefault(),i.current=!0,t())}})}function NF(e,n){const t=e.currentTarget.getBoundingClientRect(),r="clientX"in e?e.clientX:0,s="clientY"in e?e.clientY:0;return{path:n,x:r||t.left+16,y:s||t.top+t.height}}function zF({target:e,onOpen:n,onRename:t,onDuplicate:r,onCopyPath:s,onDelete:i,onClose:a}){const o=R.useRef(null),l=R.useRef(a);l.current=a;const[u,_]=R.useState({x:e.x,y:e.y});R.useLayoutEffect(()=>{var S;const m=o.current;if(!m)return;const x=document.activeElement instanceof HTMLElement?document.activeElement:null;return _({x:Math.max(8,Math.min(e.x,window.innerWidth-m.offsetWidth-8)),y:Math.max(8,Math.min(e.y,window.innerHeight-m.offsetHeight-8))}),(S=m.querySelector("button"))==null||S.focus(),()=>{m.contains(document.activeElement)&&(x==null||x.focus())}},[e]),R.useEffect(()=>{const m=()=>l.current(),x=v=>{var b;(b=o.current)!=null&&b.contains(v.target instanceof Node?v.target:null)||l.current()},S=v=>{if(v.key==="Tab"){v.preventDefault(),l.current();return}v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),l.current())};return document.addEventListener("pointerdown",x),window.addEventListener("blur",m),window.addEventListener("resize",m),window.addEventListener("scroll",m,!0),document.addEventListener("keydown",S,!0),()=>{document.removeEventListener("pointerdown",x),window.removeEventListener("blur",m),window.removeEventListener("resize",m),window.removeEventListener("scroll",m,!0),document.removeEventListener("keydown",S,!0)}},[]);const d=m=>{l.current(),m()},p=(m,x,S=!1)=>f.jsx(ir,{size:"compact",role:"menuitem",danger:S,onClick:()=>d(x),children:f.jsx("span",{children:m})});return eo.createPortal(f.jsxs("div",{ref:o,role:"menu","aria-label":zbe({path:Ne(e.path)}),className:"option-menu fixed z-100 min-w-44 overflow-hidden rounded-md border border-border bg-background p-1 shadow-menu",style:{left:u.x,top:u.y},onContextMenu:m=>m.preventDefault(),onKeyDown:m=>{var b,w;if(m.key!=="ArrowDown"&&m.key!=="ArrowUp")return;m.preventDefault();const x=[...((b=o.current)==null?void 0:b.querySelectorAll("button"))??[]],S=x.indexOf(document.activeElement instanceof HTMLButtonElement?document.activeElement:x[0]),v=m.key==="ArrowDown"?1:-1;(w=x[(S+v+x.length)%x.length])==null||w.focus()},children:[p(Rbe(),n),t&&p(xD(),t),r&&p(kbe(),r),p(bre(),s),i&&p(yD(),i,!0)]}),document.body)}const o5=["file-tree-row flex items-center gap-1.5 w-full py-[3px] px-2.5 border-0","bg-transparent text-text text-start cursor-pointer font-[inherit]","[&:hover]:bg-panel [&_>_svg]:shrink-0","[&_>_svg]:text-subtext [&_>_svg.file-tree-chevron]:text-muted"].join(" "),EA=["file-tree-chevron text-muted shrink-0 [button&]:inline-flex","[button&]:items-center [button&]:justify-center [button&]:w-[13px]","[button&]:h-[13px] [button&]:p-0 [button&]:border-0 [button&]:bg-transparent","[button&_>_svg]:transition-transform [button&_>_svg]:duration-120 [button&_>_svg]:ease-standard [button&_>_svg.open]:rotate-90"].join(" ");function NA(){return{dirs:new Map,files:[]}}function jF(e){const n=NA();for(const t of e){const r=t.split("/");let s=n;for(let i=0;ii(t),title:t,children:[p?f.jsx(qo,{size:13,className:EA}):f.jsx(Ca,{size:13,className:EA}),f.jsx("span",{className:"file-tree-name flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:e})]}),p&&f.jsx(xk,{node:n,parentPath:t,depth:r+1,toggled:s,onToggle:i,onOpenFile:a,renamingPath:o,onContextMenu:l,onRename:u,onCancelRename:_})]})}function xk({node:e,parentPath:n,depth:t,toggled:r,onToggle:s,onOpenFile:i,renamingPath:a,onContextMenu:o,onRename:l,onCancelRename:u}){const _=[...e.dirs.keys()].sort((p,m)=>p.localeCompare(m)),d=[...e.files].sort((p,m)=>p.localeCompare(m));return f.jsxs(f.Fragment,{children:[_.map(p=>{const m=n?`${n}/${p}`:p;return f.jsx(M9t,{name:p,node:e.dirs.get(p),path:m,depth:t,toggled:r,onToggle:s,onOpenFile:i,renamingPath:a,onContextMenu:o,onRename:l,onCancelRename:u},`d:${m}`)}),d.map(p=>{const m=n?`${n}/${p}`:p;if(a===m&&l&&u)return f.jsxs("div",{className:o5,style:{paddingInlineStart:8+t*14},children:[f.jsx(Kh,{name:p}),f.jsx(EF,{name:p,onCommit:S=>l(m,S),onCancel:u})]},`f:${m}`);const x=Ur(S=>i(m,S));return f.jsxs("button",{type:"button",className:o5,style:{paddingInlineStart:8+t*14},...x,onContextMenu:S=>{o&&(S.preventDefault(),o(S,m))},onKeyDown:S=>{if(o&&(S.key==="ContextMenu"||S.shiftKey&&S.key==="F10")){S.preventDefault(),o(S,m);return}x.onKeyDown(S)},title:fQ({name:Ne(m)}),children:[f.jsx(Kh,{name:p}),f.jsx("span",{className:"file-tree-name flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:p})]},`f:${m}`)})]})}function D9t({projectId:e,project:n,experiment:t,view:r,toggled:s,onViewChange:i,onToggledChange:a,onOpenFile:o}){var E,N;const l=t.branchName,u=ot({..._I(e,{ref:l}),enabled:r==="files",subscribed:r==="files"}),_=ot({...fv(t.chatSessionId??""),enabled:r==="files"&&!!t.chatSessionId,subscribed:r==="files"&&!!t.chatSessionId}),d=u.data,p=(E=u.error)==null?void 0:E.message,m=u.isFetching,x=fI(t.id),S=IG({queryKey:x.queryKey})>0,v=(N=_.data)!=null&&N.exists&&_.data.branch===l?t.chatSessionId??void 0:void 0,b=()=>{u.refetch()},w=R.useMemo(()=>d?jF(d.entries):null,[d]),y=r==="files"?m:S,C=R.useCallback(T=>{const z=new Set(s);z.has(T)?z.delete(T):z.add(T),a(z)},[s,a]);return f.jsxs("div",{className:"code-tab flex flex-col h-full min-h-0",children:[f.jsx(SF,{view:r,onViewChange:i,branchLabel:l,branchTitle:`Committed branch ${l}`,githubHref:n.githubEnabled?Jv(n.githubOwner,n.githubRepo,l):void 0,githubTitle:hD({branch:Ne(l)}),refreshing:y,onRefresh:()=>r==="files"?b():void tt.invalidateQueries(x)}),r==="changes"?f.jsx(x9t,{experiment:t},t.id):f.jsxs(f.Fragment,{children:[(d==null?void 0:d.truncated)&&f.jsx(Ao,{children:M0e()}),p&&w&&f.jsxs(Ao,{children:[F0e()," ",Ne(p)]}),f.jsx(dh,{children:w?w.dirs.size===0&&w.files.length===0?f.jsx(Ao,{children:I0e()}):f.jsx("div",{className:"file-tree py-1.5 px-0 text-sm",children:f.jsx(xk,{node:w,parentPath:"",depth:0,toggled:s,onToggle:C,onOpenFile:(T,z)=>v?o(T,v,void 0,z):o(T,void 0,l,z)})}):f.jsx(Ao,{children:p?ED({error:Ne(p)}):ND()})})]})]})}function wk({icon:e,title:n,description:t}){return f.jsxs("div",{className:"flex h-full w-full min-w-0 flex-1 flex-col items-center justify-center gap-1.5 bg-background p-6 text-center text-muted",children:[f.jsx(e,{size:36,strokeWidth:1.5,className:"shrink-0"}),f.jsx("h3",{className:"mt-1.5 mb-0 max-w-full wrap-anywhere text-xl font-medium text-text",children:n}),t&&f.jsx("p",{className:"m-0 w-full max-w-105 wrap-anywhere text-base leading-[1.55] text-subtext",children:t})]})}function L9t({sessionId:e,project:n,view:t,toggled:r,onViewChange:s,onToggledChange:i,onOpenFile:a,canRenameFile:o}){var O,L,F;const l=n.id,_=((O=ot(xa(l)).data)==null?void 0:O.some(q=>q.id===e&&q.busy))??!1,d=ot({...fv(e??""),enabled:!!e,refetchInterval:_?5e3:!1}),p=d.data,m=e&&(p!=null&&p.exists)?{sessionId:e}:{ref:n.baselineBranch},x=ot({..._I(l,m),enabled:!e||d.isSuccess,refetchInterval:_?5e3:!1}),S=x.data,v=(L=d.error??x.error)==null?void 0:L.message,b=d.isFetching||x.isFetching,[w,y]=R.useState(null),[C,E]=R.useState(null),N=R.useCallback(()=>{e&&tt.invalidateQueries(fv(e)),tt.invalidateQueries({queryKey:Nt("getCodeTree",l),predicate:q=>!iD(q)})},[e,l]),T=R.useRef(_);R.useEffect(()=>{T.current&&!_&&N(),T.current=_},[_,N]);const z=R.useMemo(()=>S?jF(S.entries):null,[S]),M=R.useCallback(q=>{const G=new Set(r);G.has(q)?G.delete(q):G.add(q),i(G)},[r,i]),I=e&&(p!=null&&p.exists)?p:null,B=(I==null?void 0:I.branch)??(I!=null&&I.baselineBranch?Mct({branch:Ne(I.baselineBranch)}):o6()),$=((F=I==null?void 0:I.files)==null?void 0:F.length)??0,U=I?Cct({branch:Ne(`${B}${$>0?"*":""}`)}):jct({branch:Ne(n.baselineBranch)}),H=I?I.branch:n.baselineBranch,Y=(q,G)=>I?a(q,e,void 0,G):a(q,void 0,n.baselineBranch,G),V=(S==null?void 0:S.root)==="worktree",X=async(q,G)=>{try{await Aut(l,q,G,{sessionId:e}),N()}catch(re){Vn(re instanceof Error?re.message:String(re),"error")}},ee=q=>{const G=(S==null?void 0:S.path)??n.repoPath;CF(G,q)};return f.jsxs("div",{className:"code-tab flex flex-col h-full min-h-0 wt-tab",children:[f.jsx(SF,{view:I?t:"files",onViewChange:s,showViewToggle:!!I,branchLabel:U,branchTitle:U,githubHref:n.githubEnabled&&H?Jv(n.githubOwner,n.githubRepo,H):void 0,githubTitle:H?hD({branch:Ne(H)}):void 0,refreshing:b,onRefresh:N}),v&&(p||S)&&f.jsxs(Ao,{children:[Jct()," ",Ne(v)]}),!S||e&&!p?f.jsx(dh,{children:f.jsx(Ao,{children:v?ED({error:Ne(v)}):ND()})}):I&&t==="changes"?f.jsx(dh,{className:"wt-changes px-4 pb-6 pt-0 [&_>_:first-child]:mt-3.5",children:$===0||!I.diff?f.jsx("div",{className:"changes-note text-sm text-muted",children:Gct()}):f.jsxs(f.Fragment,{children:[I.diff.truncated&&f.jsx(hB,{bytesRead:I.diff.bytesRead,byteLimit:I.diff.byteLimit}),f.jsx(pB,{diff:I.diff.diff,partial:I.diff.truncated})]})}):f.jsxs(dh,{children:[S.truncated&&f.jsx(Ao,{children:Ict()}),z?z.dirs.size===0&&z.files.length===0?f.jsx(wk,{icon:Td,title:Qct(),description:Gxe()}):f.jsx("div",{className:"file-tree py-1.5 px-0 text-sm",children:f.jsx(xk,{node:z,parentPath:"",depth:0,toggled:r,onToggle:M,onOpenFile:Y,renamingPath:C,onContextMenu:(q,G)=>{y(NF(q,G))},onRename:(q,G)=>{E(null),X(q,{action:"rename",newName:G})},onCancelRename:()=>E(null)})}):f.jsx(Ao,{children:Fct()})]}),w&&f.jsx(zF,{target:w,onOpen:()=>Y(w.path,"keepOpen"),onRename:V&&o(w.path)?()=>E(w.path):void 0,onDuplicate:V?()=>void X(w.path,{action:"duplicate"}):void 0,onCopyPath:()=>ee(w.path),onDelete:V?()=>{window.confirm(ybe({path:Ne(w.path)}))&&X(w.path,{action:"delete"})}:void 0,onClose:()=>y(null)})]})}function TF({text:e,path:n,highlightLine:t,scrollRequest:r,onScrollRequestHandled:s}){const i=R.useMemo(()=>{if(!e)return[];const _=e.replace(/\r\n?/g,` `),d=IP(_,TS(n));return _.endsWith(` -`)?d.slice(0,-1):d},[e,n]),a=t&&i.length>0?Math.min(Math.max(Math.trunc(t),1),i.length):void 0,o=R.useRef(null);R.useEffect(()=>{var _;r!==void 0&&(a?((_=o.current)==null||_.scrollIntoView({block:"center"}),s==null||s()):i.length===0&&(s==null||s()))},[i.length,s,r,a]);const{ruleCh:l}=WP(i.length),u=R.useMemo(()=>i.map((_,d)=>f.jsxs("div",{ref:d+1===a?o:void 0,className:`file-view-line flex items-stretch ${d+1===a?"file-view-line-highlight bg-accent-blue-subtle shadow-file-line":""}`,children:[f.jsx("span",{"data-line":d+1,className:`${GP} before:content-[attr(data-line)] shrink-0 pe-[1ch]`,style:{width:`${l}ch`},"aria-hidden":"true"}),f.jsx("code",{className:`file-view-code flex-1 min-w-0 ps-[2ch] pe-4 ${Nv} ${UP}`,children:BP(_)?f.jsx("br",{}):_})]},d)),[i,l,a]);return f.jsxs("div",{className:`file-view-codewrap relative py-3.5 ${Nv}`,children:[i.length>0&&f.jsx("div",{className:"absolute start-0 top-0 bottom-0 border-e border-e-border-variant pointer-events-none",style:{width:`${l}ch`},"aria-hidden":"true"}),u]})}function AF(e){return e==="image"||e==="audio"||e==="video"||e==="pdf"?e:null}function zA({url:e,name:n}){return f.jsxs("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:[W5e()," ",f.jsxs("a",{href:e,download:n,children:[$D()," ",Ne(n)]})]})}function l5({kind:e,url:n,name:t,downloadBar:r=!0}){const[s,i]=R.useState(!1);if(R.useEffect(()=>i(!1),[e,n]),s)return f.jsx(zA,{url:n,name:t});let a;return e==="image"?a=f.jsx("div",{className:"fpreview-image flex min-h-0 flex-1 items-start justify-center overflow-auto p-6 [&_img]:max-w-full [&_img]:h-auto [&_img]:border [&_img]:border-border [&_img]:rounded-sm",children:f.jsx("img",{src:n,alt:t,onError:()=>i(!0)})}):e==="audio"?a=f.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6",children:f.jsx("audio",{className:"w-full max-w-160",controls:!0,preload:"metadata",src:n,"aria-label":t,onError:()=>i(!0)})}):e==="video"?a=f.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6",children:f.jsx("video",{className:"max-h-full max-w-full rounded-sm border border-border",controls:!0,preload:"metadata",src:n,"aria-label":t,onError:()=>i(!0)})}):a=f.jsx("object",{className:"fpreview-pdf block min-h-0 flex-1 w-full border-0","aria-label":t,data:n,type:"application/pdf",onError:()=>i(!0),children:f.jsx(zA,{url:n,name:t})}),f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[a,r&&f.jsx("div",{className:"shrink-0 border-t border-border-variant py-1.5 px-3 text-end text-sm",children:f.jsxs("a",{href:n,download:t,children:[$D()," ",t]})})]})}const O9t=e=>({queryKey:Nt("fileVersion",e),staleTime:2e3,refetchOnMount:"always",refetchOnWindowFocus:"always",refetchInterval:2e3,queryFn:async({signal:n})=>{const t=await fetch(e,{method:"HEAD",cache:"no-store",signal:n});if(t.status===404)return"missing";if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.headers.get("etag")??t.headers.get("content-length")}});function RF(e,n=!0){return ct({...O9t(e),enabled:n,subscribed:n}).data??null}function I9t(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")}function B9t(e,n,t){const r=t.indexOf("#"),s=r===-1?t:t.slice(0,r),i=r===-1?"":t.slice(r),a=s.indexOf("?"),o=a===-1?s:s.slice(0,a),l=a===-1?"":s.slice(a+1),u=o.startsWith("/")?[]:n.split("/").filter(m=>m.length>0);for(const m of o.split("/"))if(!(!m||m==="."))if(m===".."){if(u.length===0)return null;u.pop()}else u.push(m);const _=u.join("/");if(!_)return null;const d=new URLSearchParams(l);d.delete("path");const p=d.toString();return{path:_,url:`${Ph(e,_)}${p?`&${p}`:""}${i}`}}function $9t(e){if(!e.startsWith("---"))return e;const n=e.indexOf(` ----`,3);return n===-1?e:e.slice(n+4).replace(/^\r?\n/,"")}const MF="orx:files-tree-width",DF="orx:artifacts-collapsed:",LF=180,OF=320,P9t=8,F9t=280;function H9t(){try{const e=Number(localStorage.getItem(MF));if(Number.isFinite(e)&&e>=LF&&e<=OF)return e}catch{}return F9t}function q9t(e){try{const n=localStorage.getItem(`${DF}${e}`);if(!n)return new Set;const t=JSON.parse(n);return Array.isArray(t)?new Set(t.filter(r=>typeof r=="string")):new Set}catch{return new Set}}function xp(e,n){for(const t of e){if(t.path===n)return t;if(t.isDir&&n.startsWith(t.path+"/")){const r=xp(t.children??[],n);if(r)return r}}return null}function IF({projectId:e,folder:n,markdown:t,entries:r}){const s=i=>{if(I9t(i))return i;const a=B9t(e,n,i);if(!a)return null;const o=xp(r,a.path);if(!o)return a.url;const l=a.url.indexOf("#"),u=l===-1?a.url:a.url.slice(0,l),_=l===-1?"":a.url.slice(l);return`${u}&v=${o.modifiedAt}:${o.size}${_}`};return f.jsx("div",{className:"md min-w-0 wrap-anywhere text-text leading-[1.62] [&_>_*:first-child]:mt-0 [&_>_*:last-child]:mb-0 [&_p]:my-2.5 [&_p]:mx-0 [&_strong]:text-text [&_strong]:font-semibold [&_pre]:bg-surface [&_pre]:border [&_pre]:border-border-muted [&_pre]:rounded-md [&_pre]:py-2 [&_pre]:px-3 [&_pre]:overflow-x-auto [&_pre]:text-sm [&_pre]:text-text [&_code]:font-mono [&_code]:text-sm [&_code]:font-medium [&_code]:text-primary [&_code]:bg-panel [&_code]:border [&_code]:border-border-variant [&_code]:rounded-xs [&_code]:py-px [&_code]:px-[5px] [&_.katex]:text-prose-emphasis [&_.katex-display]:my-3 [&_.katex-display]:mx-0 [&_.katex-display]:overflow-x-auto [&_.katex-display]:overflow-y-hidden [&_.katex-display]:py-0.5 [&_.katex-display]:px-0 [&_.file-chip]:inline-flex [&_.file-chip]:items-center [&_.file-chip]:gap-1 [&_.file-chip]:max-w-full [&_.file-chip]:my-0 [&_.file-chip]:mx-px [&_.file-chip]:py-0 [&_.file-chip]:px-1.5 [&_.file-chip]:align-baseline [&_.file-chip]:font-mono [&_.file-chip]:text-sm [&_.file-chip]:font-medium [&_.file-chip]:text-text [&_.file-chip]:bg-panel [&_.file-chip]:border [&_.file-chip]:border-border-variant [&_.file-chip]:rounded-xs [&_.file-chip]:cursor-pointer [&_.file-chip:hover:not(:disabled)]:bg-surface [&_.file-chip:hover:not(:disabled)]:text-primary [&_.file-chip_svg]:flex-none [&_.file-chip_svg]:opacity-60 [&_.file-chip-label]:max-w-65 [&_.file-chip-label]:overflow-hidden [&_.file-chip-label]:text-ellipsis [&_.file-chip-label]:whitespace-nowrap [&_.run-chip_svg]:opacity-100 [&_.run-chip_svg]:text-primary [&_pre_code]:bg-none [&_pre_code]:bg-transparent [&_pre_code]:border-0 [&_pre_code]:text-inherit [&_pre_code]:p-0 [&_pre_code]:font-normal [&_h1]:text-text [&_h1]:font-semibold [&_h2]:text-text [&_h2]:font-semibold [&_h3]:text-text [&_h3]:font-semibold [&_h4]:text-text [&_h4]:font-semibold [&_ul]:my-1.5 [&_ul]:mx-0 [&_ul]:ps-5.5 [&_ol]:my-1.5 [&_ol]:mx-0 [&_ol]:ps-5.5 [&_li::marker]:text-primary [&_a]:text-primary [&_table]:border-collapse [&_table]:text-sm [&_table]:my-2.5 [&_table]:mx-0 [&_table]:border [&_table]:border-border [&_table]:rounded-md [&_th]:border-b [&_th]:border-b-border-variant [&_th]:py-2 [&_th]:px-3.5 [&_th]:text-start [&_th]:text-text [&_th]:break-normal [&_th]:break-words [&_td]:border-b [&_td]:border-b-border-variant [&_td]:py-2 [&_td]:px-3.5 [&_td]:text-start [&_td]:text-text [&_td]:break-normal [&_td]:break-words [&_tr:last-child_td]:border-b-0 [&_thead_th]:bg-surface [&_thead_th]:font-medium [&_thead_th]:text-text [&_thead_th]:border-b [&_thead_th]:border-b-border [&_tbody_tr:hover_td]:bg-surface-bright [&_blockquote]:my-1.5 [&_blockquote]:mx-0 [&_blockquote]:pt-0.5 [&_blockquote]:pe-0 [&_blockquote]:pb-0.5 [&_blockquote]:ps-2.5 [&_blockquote]:border-s-[3px] [&_blockquote]:border-s-border [&_blockquote]:text-subtext [:is(&,_.openresearch-diff,_.file-view)_.token.comment]:italic [:is(&,_.openresearch-diff,_.file-view)_.token.prolog]:italic [:is(&,_.openresearch-diff,_.file-view)_.token.cdata]:italic [:is(&,_.openresearch-diff,_.file-view)_.token.operator]:text-syntax-cyan [:is(&,_.openresearch-diff,_.file-view)_.token.entity]:text-syntax-cyan [:is(&,_.openresearch-diff,_.file-view)_.token.url]:text-syntax-cyan [:is(&,_.openresearch-diff,_.file-view)_.token.comment]:text-syntax-comment [:is(&,_.openresearch-diff,_.file-view)_.token.prolog]:text-syntax-comment [:is(&,_.openresearch-diff,_.file-view)_.token.cdata]:text-syntax-comment [:is(&,_.openresearch-diff,_.file-view)_.token.punctuation]:text-syntax-text [:is(&,_.openresearch-diff,_.file-view)_.token.property]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.tag]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.deleted]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.constant]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.symbol]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.boolean]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.number]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.selector]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.attr-name]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.char]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.inserted]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.string]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.builtin]:text-syntax-yellow [:is(&,_.openresearch-diff,_.file-view)_.token.atrule]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.attr-value]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.keyword]:text-syntax-purple [:is(&,_.openresearch-diff,_.file-view)_.token.function]:text-syntax-blue [:is(&,_.openresearch-diff,_.file-view)_.token.decorator]:text-syntax-blue [:is(&,_.openresearch-diff,_.file-view)_.token.def]:text-syntax-blue [:is(&,_.openresearch-diff,_.file-view)_.token.class-name]:text-syntax-yellow [:is(&,_.openresearch-diff,_.file-view)_.token.namespace]:text-syntax-yellow [:is(&,_.openresearch-diff,_.file-view)_.token.regex]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.important]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.variable]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.parameter]:text-syntax-text artifact-md text-lg [&_h1]:text-4xl [&_h1]:leading-[1.18] [&_h1]:mt-7 [&_h1]:mx-0 [&_h1]:mb-3.5 [&_h2]:text-3xl [&_h2]:leading-tight [&_h2]:mt-7 [&_h2]:mx-0 [&_h2]:mb-2.5 [&_h3]:text-xl [&_h3]:leading-[1.35] [&_h3]:mt-5.5 [&_h3]:mx-0 [&_h3]:mb-2 [&_h4]:text-lg [&_h4]:leading-[1.4] [&_h4]:mt-4.5 [&_h4]:mx-0 [&_h4]:mb-1.5 [&_table]:block [&_table]:w-max [&_table]:max-w-full [&_table]:overflow-x-auto [&_.artifact-img]:block [&_.artifact-img]:my-3 [&_.artifact-img]:mx-0 [&_.artifact-img_img]:max-w-full [&_.artifact-img_img]:h-auto [&_.artifact-img_img]:border [&_.artifact-img_img]:border-border [&_.artifact-img_img]:rounded-sm [&_.artifact-img-caption]:block [&_.artifact-img-caption]:mt-1 [&_.artifact-img-caption]:text-center [&_.artifact-img-caption]:text-sm [&_.artifact-img-caption]:text-subtext",children:f.jsx(H3t,{remarkPlugins:[MP,[DP,FP]],rehypePlugins:[lP],components:{a:({href:i,children:a,...o})=>{const l=!i||i.startsWith("#"),u=l?i:s(i);return u?f.jsx("a",{...o,href:u,...l?{}:{target:"_blank",rel:"noopener noreferrer"},children:a}):f.jsx("span",{children:a})},img:({src:i,alt:a})=>{if(!i||typeof i!="string")return null;const o=s(i);return o?f.jsxs("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"artifact-img",children:[f.jsx("img",{src:o,alt:a??"",loading:"lazy"}),a&&f.jsx("span",{className:"artifact-img-caption",children:a})]}):null},...HP},children:$P($9t(t))})})}function U9t(e){return e.presentation==="text"&&yk(e.name)?"markdown":AF(e.presentation)??(e.presentation==="text"||e.presentation==="unknown"?"text":"download")}function G9t(e,n,t,r){var u;const s=t==="markdown"||t==="text"&&n.size<=PL,i=q6(e,n.path),a=ct({...i,enabled:s,subscribed:s}),o=R.useRef({projectId:e,path:n.path,modifiedAt:n.modifiedAt,size:n.size,version:r});R.useEffect(()=>{const _=o.current;o.current={projectId:e,path:n.path,modifiedAt:n.modifiedAt,size:n.size,version:r},s&&_.projectId===e&&_.path===n.path&&(_.modifiedAt!==n.modifiedAt||_.size!==n.size||_.version!==null&&_.version!==r)&&nt.invalidateQueries({queryKey:i.queryKey,exact:!0})},[e,n.path,n.modifiedAt,n.size,r,s]);const l=a.data;return{text:l&&!l.binary?l.content:null,binary:(l==null?void 0:l.binary)??!1,truncated:(l==null?void 0:l.truncated)??!1,error:l?null:((u=a.error)==null?void 0:u.message)??(l===null?Sre():null),wantsText:s}}function W9t({projectId:e,entry:n,onDelete:t,artifactEntries:r}){const s=U9t(n),i=RF(Ph(e,n.path)),{text:a,binary:o,truncated:l,error:u,wantsText:_}=G9t(e,n,s,i),[d,p]=R.useState(!1),m=s==="markdown",x=n.path.split("/").slice(0,-1).join("/"),S=`${Ph(e,n.path)}&v=${encodeURIComponent(i??`${n.modifiedAt}:${n.size}`)}`;let v;return s==="image"||s==="audio"||s==="video"||s==="pdf"?v=f.jsx(l5,{kind:s,url:S,name:n.name}):s==="download"||!_||o?v=f.jsxs("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:[s==="download"||o?pre():wse()," ",f.jsx("a",{href:S,...s==="download"||o?{download:n.name}:{target:"_blank",rel:"noopener noreferrer"},children:s==="download"||o?RD():Nre()})]}):u?v=f.jsxs("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:[Hre()," ",Ne(u)]}):a===null?v=f.jsxs(ss,{children:[f.jsx(Lt,{})," ",gD()]}):m&&!d?v=f.jsx(IF,{projectId:e,folder:x,markdown:a,entries:r}):v=f.jsx(TF,{text:a,path:n.path}),f.jsxs("div",{className:"fpreview flex-1 min-w-0 bg-background file-view flex flex-col h-full min-h-0 [@container((max-width:_720px))]:hidden",children:[f.jsxs("div",{className:"fpreview-head flex w-full min-w-0 min-h-9 items-center gap-1 px-4 py-1 bg-background text-subtext shrink-0",children:[f.jsx(Zh,{name:n.name}),f.jsx("span",{className:"fpreview-path flex-1 min-w-0 truncate text-sm text-subtext","data-tip":Ne(n.path),children:n.name}),f.jsxs("span",{dir:"auto",className:"fpreview-date text-xs text-muted whitespace-nowrap shrink-0",children:[ose()," ",new Date(n.modifiedAt).toLocaleString(j(),{dateStyle:"medium",timeStyle:"short"})]}),(s==="text"||s==="download")&&f.jsx("span",{className:"fpreview-size text-xs text-muted whitespace-nowrap shrink-0",children:Ml(n.size)}),m&&f.jsx(Qt,{size:"small",active:d,"data-tip":d?tv():nh(),"data-tip-align":"end","aria-label":d?tv():nh(),onClick:()=>p(b=>!b),children:f.jsx(Z4,{size:13})}),f.jsx(rb,{size:"small",href:S,target:"_blank",rel:"noopener noreferrer","data-tip":cE(),"data-tip-align":"end","aria-label":cE(),children:f.jsx(Md,{size:13})}),f.jsx(Qt,{size:"small","data-tip":lE(),"data-tip-align":"end","aria-label":lE(),onClick:()=>{window.confirm(Z5({path:Ne(n.path)}))&&t(n.path)},children:f.jsx(Xd,{size:13})})]}),f.jsxs("div",{className:`fpreview-body flex-1 min-h-0 overflow-auto [&.doc]:pt-4.5 [&.doc]:px-7 [&.doc]:pb-12 [&.doc_.artifact-md]:max-w-readable [&.doc_.artifact-md]:my-0 [&.doc_.artifact-md]:mx-auto ${m&&!d?"doc":""}`,children:[v,l&&f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:Wre()})]})]})}function BF({entries:e,depth:n,collapsed:t,selected:r,onToggle:s,onSelect:i,onOpenFile:a,onDelete:o,renamingPath:l,onContextMenu:u,onRename:_,onCancelRename:d}){return f.jsx("div",{className:"flex w-full max-w-full min-w-0 flex-col items-stretch",children:e.map(p=>{var x;const m={paddingInlineStart:8+Math.min(n,P9t)*14};if(p.isDir){const S=!t.has(p.path);return f.jsxs("div",{className:"min-w-0 max-w-full",children:[f.jsxs("div",{className:"file-tree-row flex w-full min-w-0 items-center gap-1.5 py-[3px] px-2.5 border-0 bg-transparent text-text text-start cursor-pointer font-[inherit] [&:hover]:bg-panel [&_>_svg]:shrink-0 [&_>_svg]:text-subtext [&_>_svg.file-tree-chevron]:text-muted artifact-tree-row [&.selected]:bg-panel [&.selected:hover]:bg-panel [&:hover_.ft-row-delete]:opacity-100",style:m,onClick:()=>s(p.path),children:[f.jsx("button",{className:"file-tree-chevron text-muted shrink-0 [button&]:inline-flex [button&]:items-center [button&]:justify-center [button&]:w-[13px] [button&]:h-[13px] [button&]:p-0 [button&]:border-0 [button&]:bg-transparent [button&_>_svg]:transition-transform [button&_>_svg]:duration-120 [button&_>_svg]:ease-standard [button&_>_svg.open]:rotate-90","aria-label":S?ere({name:Ne(p.name)}):dre({name:Ne(p.name)}),onClick:v=>{v.stopPropagation(),s(p.path)},children:f.jsx(Ta,{size:13,className:S?"open":""})}),f.jsx("span",{className:"file-tree-name flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:p.name}),f.jsx(Qt,{size:"small",className:"ft-row-delete opacity-35 focus-visible:opacity-100","data-tip":Bre(),"data-tip-align":"end","aria-label":ore({name:Ne(p.name)}),onClick:v=>{v.stopPropagation(),window.confirm(Z5({path:Ne(p.path)}))&&o(p.path)},children:f.jsx(Xd,{size:12})})]}),S&&(((x=p.children)==null?void 0:x.length)??0)>0&&f.jsx(BF,{entries:p.children??[],depth:n+1,collapsed:t,selected:r,onToggle:s,onSelect:i,onOpenFile:a,onDelete:o,renamingPath:l,onContextMenu:u,onRename:_,onCancelRename:d})]},p.path)}return l===p.path?f.jsxs("div",{className:"file-tree-row flex w-full min-w-0 items-center gap-1.5 py-[3px] px-2.5 border-0 bg-transparent text-text text-start font-[inherit] artifact-tree-row",style:m,children:[f.jsx(Zh,{name:p.name}),f.jsx(EF,{name:p.name,onCommit:S=>_(p.path,S),onCancel:d})]},p.path):f.jsxs("button",{type:"button",className:`file-tree-row flex w-full min-w-0 items-center gap-1.5 py-[3px] px-2.5 border-0 bg-transparent text-text text-start cursor-pointer font-[inherit] [&:hover]:bg-panel [&_>_svg]:shrink-0 [&_>_svg]:text-subtext [&_>_svg.file-tree-chevron]:text-muted artifact-tree-row [&.selected]:bg-panel [&.selected:hover]:bg-panel [&:hover_.ft-row-delete]:opacity-100 ${r===p.path?"selected":""}`,style:m,title:hK({path:Ne(p.path)}),"aria-keyshortcuts":"Space Enter","aria-pressed":r===p.path,onClick:()=>i(p.path),onDoubleClick:()=>a(p.path),onContextMenu:S=>{S.preventDefault(),i(p.path),u(S,p.path)},onAuxClick:S=>{S.button===1&&(S.preventDefault(),i(p.path),a(p.path))},onKeyDown:S=>{if(S.key==="ContextMenu"||S.shiftKey&&S.key==="F10"){S.preventDefault(),i(p.path),u(S,p.path);return}if(S.key===" "){S.preventDefault(),S.stopPropagation(),i(p.path);return}S.key==="Enter"&&(S.preventDefault(),S.stopPropagation(),i(p.path),a(p.path))},children:[f.jsx(Zh,{name:p.name}),f.jsx("span",{className:"file-tree-name flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:p.name})]},p.path)})})}function V9t({project:e,artifacts:n,onOpenFile:t,canRenameFile:r}){const[s,i]=R.useState(null),[a,o]=R.useState(()=>q9t(e.id)),[l,u]=R.useState(H9t),[_,d]=R.useState(null),[p,m]=R.useState(null),x=R.useRef(null);R.useEffect(()=>{try{localStorage.setItem(`${DF}${e.id}`,JSON.stringify([...a]))}catch{}},[e.id,a]);const S=N=>{var B;N.preventDefault(),N.currentTarget.setPointerCapture(N.pointerId);const T=(B=x.current)==null?void 0:B.getBoundingClientRect(),z=document.body.style.userSelect;document.body.style.userSelect="none";const M=$=>{const U=Math.round($.clientX-((T==null?void 0:T.left)??0)),H=Math.min(Math.max(U,LF),OF);u(H);try{localStorage.setItem(MF,String(H))}catch{}},O=()=>{window.removeEventListener("pointermove",M),window.removeEventListener("pointerup",O),window.removeEventListener("pointercancel",O),document.body.style.userSelect=z};window.addEventListener("pointermove",M),window.addEventListener("pointerup",O),window.addEventListener("pointercancel",O)};R.useEffect(()=>{if(!s||!n)return;const N=xp(n.entries,s);(!N||N.isDir)&&i(null)},[s,n]);const v=N=>o(T=>{const z=new Set(T);return z.has(N)?z.delete(N):z.add(N),z}),b=N=>{(s===N||s!=null&&s.startsWith(N+"/"))&&i(null),Mdt(e.id,N).catch(()=>{})},w=async(N,T)=>{try{await Ddt(e.id,N,T),T.action==="rename"&&s===N&&i(null)}catch(z){Kn(z instanceof Error?z.message:String(z),"error")}},y=N=>{n&&CF(n.dir,N)};if(!n)return f.jsx("div",{className:"files-tab h-full min-h-0 flex bg-background",children:f.jsxs(ss,{className:"p-5",children:[f.jsx(Lt,{})," ",rse()]})});const C=N=>f.jsx(BF,{entries:N,depth:0,collapsed:a,selected:s,onToggle:v,onSelect:i,onOpenFile:t,onDelete:b,renamingPath:p,onContextMenu:(T,z)=>{d(NF(T,z))},onRename:(T,z)=>{m(null),w(T,{action:"rename",newName:z})},onCancelRename:()=>m(null)}),E=s?xp(n.entries,s):null;return n.entries.length===0?f.jsx(wk,{icon:M6,title:dse(),description:vse()}):f.jsxs("div",{className:"files-tab h-full min-h-0 flex bg-background @container",children:[f.jsxs("div",{className:"ftree-pane relative shrink-0 flex flex-col min-h-0 border-s border-s-border-variant border-e border-e-border-variant bg-background [@container((max-width:_720px))]:!w-full",ref:x,style:{width:l},children:[f.jsx("div",{className:"ftree-resizer absolute -end-[3px] top-0 bottom-0 w-1.5 cursor-col-resize z-30 [&:hover]:bg-resizer-hover [&:active]:bg-resizer-hover [@container((max-width:_720px))]:hidden",onPointerDown:S}),f.jsxs("div",{className:"ftree-scroll flex-1 min-h-0 overflow-y-auto file-tree py-1.5 px-0 text-sm",children:[C(n.entries),n.truncated&&f.jsx("p",{className:"files-truncated m-0 py-2 px-3.5 text-sm text-muted",children:Yre()})]})]}),E?f.jsx(W9t,{projectId:e.id,entry:E,onDelete:b,artifactEntries:n.entries},E.path):f.jsxs("div",{className:"fpreview flex-1 min-w-0 flex flex-col min-h-0 bg-background fpreview-none items-center justify-center gap-2 text-sm text-muted [@container((max-width:_720px))]:hidden",children:[f.jsx(rmt,{size:22,strokeWidth:1.5}),f.jsx("span",{children:Are()})]}),_&&f.jsx(zF,{target:_,onOpen:()=>t(_.path),onRename:r(_.path)?()=>m(_.path):void 0,onDuplicate:()=>void w(_.path,{action:"duplicate"}),onCopyPath:()=>y(_.path),onDelete:()=>{window.confirm(Z5({path:Ne(_.path)}))&&b(_.path)},onClose:()=>d(null)})]})}const $F=20*1024*1024,PF="bg-background border border-border rounded-lg py-4 px-4.5 mb-4 [&_h3]:mt-0 [&_h3]:mx-0 [&_h3]:mb-2.5 [&_h3]:text-base [&_h3]:font-semibold [&_h3]:text-text",FF="mt-0 mx-0 mb-3 text-sm leading-relaxed text-text",K9t="flex items-start gap-3 py-2.5 border-t border-t-border first:border-t-0",Q9t="text-sm font-normal text-text",Y9t="mt-1 mb-0 text-sm leading-relaxed text-text";function HF(e){return new Promise((n,t)=>{const r=new FileReader;r.onload=()=>{const s=r.result;if(typeof s!="string"){t(new Error("could not read file"));return}const i=s.indexOf(",");n(i>=0?s.slice(i+1):s)},r.onerror=()=>t(r.error??new Error("could not read file")),r.readAsDataURL(e)})}function X9t(e){const n=e.toLowerCase();return n.endsWith(".md")||n.endsWith(".markdown")||n.endsWith(".zip")}function qF({accept:e,busy:n,prompt:t,onFile:r}){const[s,i]=R.useState(!1),a=R.useRef(null);return f.jsxs("div",{className:`flex flex-col items-center justify-center gap-2 py-6.5 px-4.5 border-[1.5px] border-dashed rounded-md text-center text-sm text-text transition-[border-color,background] duration-120 ${n?"cursor-default":"cursor-pointer"} ${s?"border-primary bg-surface text-text":"border-border-variant bg-surface [&:hover]:border-primary"}`,onDragOver:o=>{o.preventDefault(),i(!0)},onDragLeave:()=>i(!1),onDrop:o=>{var u;if(o.preventDefault(),i(!1),n)return;const l=(u=o.dataTransfer.files)==null?void 0:u[0];l&&r(l)},onClick:()=>{var o;n||(o=a.current)==null||o.click()},role:"button",tabIndex:0,"aria-disabled":n,"aria-busy":n,onKeyDown:o=>{var l;(o.key==="Enter"||o.key===" ")&&!n&&(o.preventDefault(),(l=a.current)==null||l.click())},children:[f.jsx("input",{ref:a,type:"file",accept:e,hidden:!0,onChange:o=>{var u;const l=(u=o.target.files)==null?void 0:u[0];l&&r(l),o.target.value=""}}),n?f.jsxs(f.Fragment,{children:[f.jsx(Lt,{}),f.jsx("span",{children:Rrt()})]}):f.jsxs(f.Fragment,{children:[f.jsx(zmt,{size:20,strokeWidth:1.5}),f.jsx("span",{children:t})]})]})}function UF({bytes:e,updatedAt:n}){return f.jsxs("div",{className:"shrink-0 text-end whitespace-nowrap pt-0.5 text-xs text-subtext",children:[Ml(e),n>0&&f.jsxs("span",{className:"text-muted",children:[" · ",Io(n)]})]})}function Z9t({skill:e,onError:n}){const t=gn({mutationFn:nft}),r=t.isPending;return f.jsxs("div",{className:"flex items-center gap-2 py-1 border-t border-t-border first:border-t-0",children:[f.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[f.jsx("span",{className:Q9t,children:e.name}),e.origin&&f.jsx(Ft,{size:"small",children:e.origin})]}),f.jsx(UF,{bytes:e.bytes,updatedAt:e.updatedAt}),f.jsx(Qt,{size:"small","data-tip":e.origin?Ent():ert(),"data-tip-align":"end","aria-label":e.origin?Dnt({name:Ne(e.name)}):Gtt({name:Ne(e.name)}),disabled:r,onClick:()=>{window.confirm(e.origin?Tnt({name:Ne(e.name)}):Ftt({name:Ne(e.name)}))&&t.mutateAsync(e.name).catch(s=>{n(s instanceof Error?s.message:String(s))})},children:f.jsx(Xd,{size:13})})]})}function J9t({template:e,onError:n}){const t=gn({mutationFn:Jdt}),r=t.isPending,s=e.supportFiles.length;return f.jsxs("div",{className:K9t,children:[f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("span",{className:"text-base font-medium text-text",children:e.name}),f.jsxs("p",{className:Y9t,children:[e.entry,s>0&&(s===1?vnt():Bnt({count:Wt(s)}))]})]}),f.jsx(UF,{bytes:e.bytes,updatedAt:e.updatedAt}),f.jsx(Qt,{"data-tip":srt(),"data-tip-align":"end","aria-label":Jtt({name:Ne(e.name)}),disabled:r,onClick:()=>{window.confirm(Qtt({name:Ne(e.name)}))&&t.mutateAsync(e.name).catch(i=>{n(i instanceof Error?i.message:String(i))})},children:f.jsx(Xd,{size:13})})]})}function eEt(){var w;const e=gn({mutationFn:tft}),n=ct(Hft()),t=n.data,r=R.useRef(null),[s,i]=R.useState(!1),[a,o]=R.useState(!1),l=R.useCallback(()=>{const y=r.current;i(!!y&&y.scrollTop>1),o(!!y&&y.scrollHeight-y.scrollTop-y.clientHeight>1)},[]);R.useLayoutEffect(()=>{l();const y=r.current;if(!y)return;const C=new ResizeObserver(l);return C.observe(y),()=>C.disconnect()},[t,l]);const u=n.isFetching,_=(w=n.error)==null?void 0:w.message,[d,p]=R.useState(!1),[m,x]=R.useState(null),S=()=>{n.refetch()},v=R.useRef(!1),b=R.useCallback(async y=>{if(!v.current){if(x(null),!X9t(y.name)){x(Prt());return}if(y.size>$F){x(CL());return}v.current=!0,p(!0);try{await e.mutateAsync({filename:y.name,contentBase64:await HF(y)})}catch(C){x(C instanceof Error?C.message:String(C))}finally{v.current=!1,p(!1)}}},[]);return f.jsxs("section",{className:PF,children:[f.jsxs("div",{className:"flex items-baseline gap-2.5",children:[f.jsx("h3",{children:zrt()}),f.jsxs(Oe,{className:"ms-auto",size:"small",onClick:S,disabled:u,children:[f.jsx(Aa,{size:12,className:u?"animate-[spin_0.9s_linear_infinite]":""})," ",Yp()]})]}),f.jsx("p",{className:FF,children:rnt()}),f.jsx(qF,{accept:".md,.markdown,.zip",busy:d,prompt:f.jsxs(f.Fragment,{children:[f.jsx("span",{children:ont()}),f.jsx("span",{className:"block ps-4 mt-1 text-text",children:Itt()})]}),onFile:y=>void b(y)}),m&&f.jsx("div",{role:"alert",className:"mt-2.5 text-base text-accent-red whitespace-pre-wrap",children:m}),_&&f.jsxs("div",{role:"alert",className:"pt-3 text-base text-accent-red",children:[Hnt()," ",_]}),t===void 0?_?null:f.jsxs("div",{className:"flex items-center gap-2 pt-3 text-sm text-subtext",children:[f.jsx(Lt,{})," ",frt()]}):t.length===0?f.jsx("div",{className:"pt-3 text-sm text-subtext",children:yrt()}):f.jsxs("div",{className:"relative mt-1",children:[f.jsx("div",{ref:r,onScroll:l,className:"flex flex-col max-h-120 overflow-y-auto overscroll-contain",children:t.map(y=>f.jsx(Z9t,{skill:y,onError:x},y.name))}),s&&f.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 top-0 h-10 bg-gradient-to-b from-background to-transparent"}),a&&f.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-background to-transparent"})]})]})}function tEt(){var _;const e=gn({mutationFn:Zdt}),n=ct(Fft()),t=n.data,r=(_=n.error)==null?void 0:_.message,[s,i]=R.useState(!1),[a,o]=R.useState(null),l=R.useRef(!1),u=R.useCallback(async d=>{if(l.current)return;o(null);const p=d.name.toLowerCase();if(!p.endsWith(".tex")&&!p.endsWith(".zip")){o(Urt());return}if(d.size>$F){o(CL());return}l.current=!0,i(!0);try{await e.mutateAsync({filename:d.name,contentBase64:await HF(d)})}catch(m){o(m instanceof Error?m.message:String(m))}finally{l.current=!1,i(!1)}},[]);return f.jsxs("section",{className:PF,children:[f.jsx("h3",{children:lrt()}),f.jsx("p",{className:FF,children:Ort()}),f.jsx(qF,{accept:".tex,.zip",busy:s,prompt:f.jsxs(f.Fragment,{children:[f.jsx("span",{children:dnt()}),f.jsx("span",{className:"block ps-4 mt-1 text-text",children:cat()})]}),onFile:d=>void u(d)}),a&&f.jsx("div",{role:"alert",className:"mt-2.5 text-base text-accent-red whitespace-pre-wrap",children:a}),r&&f.jsxs("div",{role:"alert",className:"pt-3 text-base text-accent-red",children:[Wnt()," ",r]}),t===void 0?r?null:f.jsxs("div",{className:"flex items-center gap-2 pt-3 text-sm text-subtext",children:[f.jsx(Lt,{})," ",mrt()]}):t.length===0?f.jsx("div",{className:"pt-3 text-sm text-subtext",children:krt()}):f.jsx("div",{className:"flex flex-col mt-1",children:t.map(d=>f.jsx(J9t,{template:d,onError:o},d.name))})]})}function nEt(){return f.jsxs("div",{className:"settings-view max-w-readable my-0 mx-auto pt-6 px-8 pb-15 [&_h1]:mt-0 [&_h1]:mx-0 [&_h1]:mb-1.5 [&_h1]:text-3xl",children:[f.jsx("h1",{children:Ynt()}),f.jsx("p",{className:"mt-0 mx-0 mb-5 text-base leading-relaxed text-text",children:wnt()}),f.jsx(eEt,{}),f.jsx(tEt,{})]})}const rEt="italic [&_.tab-label_>_span]:pe-1 [&_.tab-label::after]:pe-1";function Fc({active:e,label:n,icon:t,shimmer:r=!1,preview:s=!1,onSelect:i,onPromote:a,onClose:o}){return f.jsxs("button",{className:`tab [&.closable]:max-w-60 [&.closable]:pe-0.5 [&_.tab-label]:grid [&_.tab-label]:grid-cols-[minmax(0,_1fr)] [&_.tab-label]:min-w-0 [&_.tab-label]:overflow-hidden [&_.tab-label_>_span]:[grid-area:1_/_1] [&_.tab-label_>_span]:overflow-hidden [&_.tab-label_>_span]:text-ellipsis [&_.tab-label_>_span]:whitespace-nowrap [&_.tab-label::after]:[grid-area:1_/_1] [&_.tab-label::after]:overflow-hidden [&_.tab-label::after]:text-ellipsis [&_.tab-label::after]:whitespace-nowrap [&_.tab-label::after]:content-[attr(data-label)] [&_.tab-label::after]:invisible [&_.tab-label::after]:font-medium [&_.tab-close]:inline-flex [&_.tab-close]:items-center [&_.tab-close]:justify-center [&_.tab-close]:w-3.5 [&_.tab-close]:h-3.5 [&_.tab-close]:rounded-xs [&_.tab-close]:text-muted [&_.tab-close]:shrink-0 [&_.tab-close:hover]:bg-hover-strong [&_.tab-close:hover]:text-text relative inline-flex items-center gap-[5px] h-8 py-0 px-2 border border-transparent border-b-0 rounded-[var(--radius-md)_var(--radius-md)_0_0] text-sm font-normal text-subtext whitespace-nowrap select-none min-w-0 [&:hover]:bg-surface [&:hover]:text-text [&:not(.active)_+_.tab:not(.active)::before]:content-[''] [&:not(.active)_+_.tab:not(.active)::before]:absolute [&:not(.active)_+_.tab:not(.active)::before]:top-2.5 [&:not(.active)_+_.tab:not(.active)::before]:bottom-2.5 [&:not(.active)_+_.tab:not(.active)::before]:-start-px [&:not(.active)_+_.tab:not(.active)::before]:w-px [&:not(.active)_+_.tab:not(.active)::before]:bg-border [&.active]:border-border [&.active]:bg-background [&.active]:text-text [&.active]:font-medium [&.active::after]:content-[''] [&.active::after]:absolute [&.active::after]:end-0 [&.active::after]:-bottom-px [&.active::after]:start-0 [&.active::after]:h-px [&.active::after]:bg-background closable ${e?"active":""} ${s?rEt:""}`,onClick:i,onDoubleClick:a,title:s?iat({label:n}):n,"aria-label":s?tat({label:n}):n,children:[t,f.jsx("span",{className:"tab-label","data-label":n,children:f.jsx("span",{className:r?"tool-running-shimmer":"",children:n})}),f.jsx("span",{role:"button",className:"tab-close",title:p0e(),onPointerDown:l=>l.preventDefault(),onClick:l=>{l.stopPropagation(),o()},children:f.jsx(qr,{size:12})})]})}const jA=["files-pill inline-flex items-center gap-2 min-w-0 border border-border","rounded-md py-[7px] px-[11px] bg-background text-text","no-underline [&_code]:font-mono [&_code]:text-sm","[&_code]:overflow-hidden [&_code]:text-ellipsis [&_code]:whitespace-nowrap","[&_>_svg]:shrink-0 [&_>_svg]:text-muted [a&:hover]:border-muted"].join(" ");function sEt({owner:e,repo:n,branch:t}){return!e||!n?f.jsx("span",{className:jA,children:f.jsx("code",{children:t})}):f.jsxs("a",{className:jA,href:eb(e,n,t),target:"_blank",rel:"noopener noreferrer",title:J1({name:Ne(t)}),children:[f.jsx("code",{children:t}),f.jsx(hb,{size:12})]})}const Iw=["experiment-overview-section mt-5.5 pt-4.5 border-t border-t-border-variant","[&_h2]:mt-0 [&_h2]:mx-0 [&_h2]:mb-3.5 [&_h2]:text-text [&_h2]:text-sm","[&_h2]:font-semibold"].join(" "),TA=["experiment-overview-command block mt-[13px] text-text text-sm","wrap-anywhere"].join(" ");function AA(e){return new Date(e).toLocaleString(j(),{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function RA(e,n){return np((e.endedAt??n)-e.createdAt)}function iEt({experiment:e,parentExperiment:n,project:t,runs:r,onOpenLogs:s,onOpenCode:i}){const a=r[0]??null,o=r.some(_=>_.status==="running"||_.status==="starting"),[l,u]=R.useState(()=>Date.now());return R.useEffect(()=>{if(!o)return;u(Date.now());const _=window.setInterval(()=>u(Date.now()),1e3);return()=>window.clearInterval(_)},[o]),f.jsx("div",{className:"experiment-overview absolute inset-0 overflow-y-auto bg-background [&_h1]:m-0 [&_h1]:text-text [&_h1]:text-xl [&_h1]:leading-tight",children:f.jsxs("div",{className:"experiment-overview-inner w-full max-w-230 my-0 mx-auto pt-6.5 px-7 pb-10 [@media((max-width:_720px))]:pt-5 [@media((max-width:_720px))]:px-4.5 [@media((max-width:_720px))]:pb-8",children:[f.jsxs("header",{className:"experiment-overview-head flex items-start justify-between gap-6",children:[f.jsxs("div",{className:"experiment-overview-heading min-w-0",children:[f.jsx("h1",{children:e.title||e.slug}),f.jsx("div",{className:"experiment-overview-slug mt-[5px] text-muted text-sm",children:e.slug})]}),f.jsx($l,{status:a?Gi(a):"idle"})]}),f.jsxs("div",{className:"experiment-overview-actions flex gap-[7px] mt-4.5 [@media((max-width:_720px))]:flex-wrap",children:[a&&f.jsxs(Oe,{...Ur(_=>s(a.id,_)),children:[f.jsx(qh,{size:15}),J1e()]}),f.jsxs(Oe,{...Ur(i),children:[f.jsx(fb,{size:15}),C1e()]})]}),e.description&&f.jsxs("section",{className:"experiment-overview-section mt-5.5 pt-4.5 border-t border-t-border-variant [&_h2]:mt-0 [&_h2]:mx-0 [&_h2]:mb-3.5 [&_h2]:text-text [&_h2]:text-sm [&_h2]:font-semibold overview-description [&_.md]:text-text [&_.md]:leading-[1.65]",children:[f.jsx("h2",{children:I1e()}),f.jsx($o,{text:e.description})]}),f.jsxs("section",{className:Iw,children:[f.jsx("h2",{children:a?x1e():pve()}),a&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"experiment-overview-meta flex items-center flex-wrap gap-y-2.5 gap-x-4.5 text-text text-sm [&_svg]:text-muted [&_.backend-badge]:text-text [&_.status-badge]:text-text [&_>_span]:inline-flex [&_>_span]:items-center [&_>_span]:gap-[5px] [&_code]:text-text [&_code]:text-xs",children:[f.jsx($l,{status:Gi(a)}),f.jsx($6,{backend:a.backend}),f.jsxs("span",{title:dve(),children:[f.jsx(W0t,{size:13}),AA(a.createdAt)]}),f.jsxs("span",{title:F1e(),children:[f.jsx(ipt,{size:13}),RA(a,l)]}),a.commitSha&&f.jsxs("span",{title:j1e(),children:[f.jsx(Dpt,{size:14}),f.jsx("code",{children:a.commitSha.slice(0,7)})]}),a.exitCode!==null&&a.exitCode!==void 0&&a.exitCode!==0&&f.jsxs("span",{children:[G1e()," ",a.exitCode]})]}),a.command&&f.jsxs("code",{className:TA,children:["$ ",a.command]}),a.resultMarkdown&&f.jsx("div",{className:`experiment-overview-result mt-4 [&.failed]:text-accent-red ${a.status==="failed"?"failed":""}`,children:f.jsx($o,{text:a.resultMarkdown})})]})]}),f.jsxs("section",{className:Iw,children:[f.jsx("h2",{children:"Git"}),f.jsxs("div",{className:"experiment-overview-meta flex items-center flex-wrap text-text text-sm [&_svg]:text-muted [&_.backend-badge]:text-text [&_.status-badge]:text-text [&_>_span]:inline-flex [&_>_span]:items-center [&_>_span]:gap-[5px] [&_code]:text-text [&_code]:text-xs experiment-overview-git-meta gap-y-[9px] gap-x-3.5 [&_.files-pill]:py-[5px] [&_.files-pill]:px-2 [&_.files-pill]:rounded-sm [&_.files-pill_code]:text-xs",children:[f.jsx(sEt,{owner:t.githubEnabled?t.githubOwner:"",repo:t.githubEnabled?t.githubRepo:"",branch:e.branchName}),n&&f.jsxs("span",{children:[Q1e()," ",f.jsx("code",{children:n.slug})]}),f.jsxs("span",{title:AA(e.createdAt),children:[M1e()," ",Io(e.createdAt)]})]}),e.runCommand!==(a==null?void 0:a.command)&&f.jsxs("code",{className:TA,children:["$ ",e.runCommand]})]}),r.length>0&&f.jsxs("section",{className:Iw,children:[f.jsx("h2",{children:ove()}),f.jsx("div",{className:"experiment-run-history border-t border-t-border-variant [&_button]:w-full [&_button]:grid [&_button]:grid-cols-[minmax(72px,_0.7fr)_minmax(100px,_1fr)_minmax(70px,_0.7fr)_60px_16px] [&_button]:items-center [&_button]:gap-3.5 [&_button]:py-[11px] [&_button]:px-0.5 [&_button]:border-b [&_button]:border-b-border-variant [&_button]:text-text [&_button]:text-start [&_button]:text-sm [&_button:hover]:bg-surface [@media((max-width:_720px))]:[&_button]:grid-cols-[65px_1fr_60px_16px] [@media((max-width:_720px))]:[&_button_>_:nth-child(3)]:hidden",children:r.map((_,d)=>f.jsxs("button",{...Ur(p=>s(_.id,p)),children:[f.jsxs("span",{className:"experiment-run-number text-xs font-medium",children:[rve()," ",r.length-d]}),f.jsx($l,{status:Gi(_)}),f.jsx("span",{children:Io(_.createdAt)}),f.jsx("span",{children:RA(_,l)}),f.jsx(qh,{size:13})]},_.id))})]})]})})}function MA(e){const n=atob(e),t=new Uint8Array(n.length);for(let r=0;r{const t=n.current;if(!t)return;const{terminal:r,dispose:s}=S6(t,!0);let i=!1,a=0,o=!1,l=!1;async function u(){if(o){l=!0;return}o=!0;try{for(;;){const d=await kut(e,a);if(i)return;if(d.dataBase64&&r.write(MA(d.dataBase64)),a=d.nextOffset,d.eof)break}}catch{}finally{o=!1,l&&!i&&(l=!1,u())}}const _=Qft(e,d=>{if(i)return;const p=MA(d.dataBase64);!o&&d.offset===a?(r.write(p),a+=p.length):d.offset+p.length>a&&u()});return u(),()=>{i=!0,_(),s()}},[e]),f.jsx("div",{ref:n,className:"h-full w-full"})}function oEt({experiment:e,project:n,view:t,runs:r,selectedRunId:s,onSelectRun:i,parentExperiment:a,onOpenView:o,onOpenCode:l}){const u=r.filter(_=>_.experimentId===e.id).sort((_,d)=>d.createdAt-_.createdAt);return t==="overview"?f.jsx(iEt,{experiment:e,parentExperiment:a,project:n,runs:u,onOpenLogs:(_,d)=>o("terminal",_,d),onOpenCode:_=>l("files",_)}):f.jsx(lEt,{experiment:e,expRuns:u,selectedRunId:s,onSelectRun:i})}function lEt({experiment:e,expRuns:n,selectedRunId:t,onSelectRun:r}){const[s,i]=R.useState(null),[a,o]=R.useState(null),[l,u]=R.useState(!1),_=R.useRef(null),d=t?n.find(v=>v.id===t)??null:n[0]??null,p=(d==null?void 0:d.status)==="running"||(d==null?void 0:d.status)==="starting",m=!!(d&&p&&(d.cancelRequested||a===d.id)),x=v=>{const b=n.findIndex(w=>w.id===v);return b===-1?n.length:n.length-b};R.useEffect(()=>{if(!l)return;const v=b=>{var w;(w=_.current)!=null&&w.contains(b.target)||u(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[l]);async function S(){if(d){i(null),o(d.id);try{await ML(d.id)}catch(v){o(null),i(v instanceof Error?v.message:String(v))}}}return f.jsxs("div",{className:"term-view absolute inset-0 flex flex-col bg-background z-20",children:[f.jsxs("div",{className:"term-bar flex items-center gap-2 h-10 py-0 px-2.5 border-b border-b-border shrink-0 [&_.error]:text-sm [&_.error]:text-accent-red [&_.btn]:inline-flex [&_.btn]:items-center [&_.btn]:gap-[5px]",children:[f.jsx("div",{className:"term-title min-w-0 text-sm font-semibold text-text overflow-hidden text-ellipsis whitespace-nowrap",title:e.title||e.slug,children:e.title||e.slug}),f.jsx("span",{className:"flex-1"}),s&&f.jsx("span",{className:"error",role:"alert",children:s}),p&&f.jsxs(Oe,{size:"small",variant:"ghost",disabled:m,onClick:()=>void S(),children:[f.jsx($O,{size:13}),m?G0e():jD()]}),n.length>0&&d&&f.jsxs("div",{className:"run-history relative shrink-0",ref:_,children:[f.jsxs(Oe,{title:$ge(),"aria-expanded":l,onClick:()=>u(v=>!v),children:[f.jsxs("span",{children:[$E()," ",x(d.id)]}),f.jsx($l,{status:m?"cancelling":Gi(d)}),f.jsx(qo,{size:14,className:"run-picker-chev text-muted shrink-0"})]}),l&&f.jsx("div",{className:"history-menu absolute top-[calc(100%_+_6px)] end-0 min-w-57.5 max-h-80 overflow-y-auto bg-background border border-border rounded-lg shadow-menu p-[5px] z-50",children:n.map(v=>f.jsxs(sr,{className:"justify-start",active:v.id===(d==null?void 0:d.id),onClick:()=>{r(v.id),u(!1)},children:[f.jsxs("span",{className:"font-medium",children:[$E()," ",x(v.id)]}),f.jsx($l,{status:Gi(v)}),f.jsx("span",{className:"ms-auto text-xs text-muted",children:Io(v.createdAt)})]},v.id))})]})]}),f.jsx("div",{className:"term-fill flex-1 min-h-0 bg-terminal pt-1 pe-0 pb-1 ps-1.5",children:d?f.jsx(aEt,{runId:d.id},d.id):f.jsx("div",{className:"term-empty h-full flex items-center justify-center p-6 text-center text-sm text-muted",children:t?Ya():Rge()})})]})}let c5=!1;function DA(e){c5=!0;try{return window.confirm(e)}finally{c5=!1}}const u5=e=>e.replace(/\r\n/g,` +`)?d.slice(0,-1):d},[e,n]),a=t&&i.length>0?Math.min(Math.max(Math.trunc(t),1),i.length):void 0,o=R.useRef(null);R.useEffect(()=>{var _;r!==void 0&&(a?((_=o.current)==null||_.scrollIntoView({block:"center"}),s==null||s()):i.length===0&&(s==null||s()))},[i.length,s,r,a]);const{ruleCh:l}=WP(i.length),u=R.useMemo(()=>i.map((_,d)=>f.jsxs("div",{ref:d+1===a?o:void 0,className:`file-view-line flex items-stretch ${d+1===a?"file-view-line-highlight bg-accent-blue-subtle shadow-file-line":""}`,children:[f.jsx("span",{"data-line":d+1,className:`${GP} before:content-[attr(data-line)] shrink-0 pe-[1ch]`,style:{width:`${l}ch`},"aria-hidden":"true"}),f.jsx("code",{className:`file-view-code flex-1 min-w-0 ps-[2ch] pe-4 ${Nv} ${UP}`,children:BP(_)?f.jsx("br",{}):_})]},d)),[i,l,a]);return f.jsxs("div",{className:`file-view-codewrap relative py-3.5 ${Nv}`,children:[i.length>0&&f.jsx("div",{className:"absolute start-0 top-0 bottom-0 border-e border-e-border-variant pointer-events-none",style:{width:`${l}ch`},"aria-hidden":"true"}),u]})}function AF(e){return e==="image"||e==="audio"||e==="video"||e==="pdf"?e:null}function zA({url:e,name:n}){return f.jsxs("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:[W5e()," ",f.jsxs("a",{href:e,download:n,children:[$D()," ",Ne(n)]})]})}function l5({kind:e,url:n,name:t,downloadBar:r=!0}){const[s,i]=R.useState(!1);if(R.useEffect(()=>i(!1),[e,n]),s)return f.jsx(zA,{url:n,name:t});let a;return e==="image"?a=f.jsx("div",{className:"fpreview-image flex min-h-0 flex-1 items-start justify-center overflow-auto p-6 [&_img]:max-w-full [&_img]:h-auto [&_img]:border [&_img]:border-border [&_img]:rounded-sm",children:f.jsx("img",{src:n,alt:t,onError:()=>i(!0)})}):e==="audio"?a=f.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6",children:f.jsx("audio",{className:"w-full max-w-160",controls:!0,preload:"metadata",src:n,"aria-label":t,onError:()=>i(!0)})}):e==="video"?a=f.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6",children:f.jsx("video",{className:"max-h-full max-w-full rounded-sm border border-border",controls:!0,preload:"metadata",src:n,"aria-label":t,onError:()=>i(!0)})}):a=f.jsx("object",{className:"fpreview-pdf block min-h-0 flex-1 w-full border-0","aria-label":t,data:n,type:"application/pdf",onError:()=>i(!0),children:f.jsx(zA,{url:n,name:t})}),f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[a,r&&f.jsx("div",{className:"shrink-0 border-t border-border-variant py-1.5 px-3 text-end text-sm",children:f.jsxs("a",{href:n,download:t,children:[$D()," ",t]})})]})}const O9t=e=>({queryKey:Nt("fileVersion",e),staleTime:2e3,refetchOnMount:"always",refetchOnWindowFocus:"always",refetchInterval:2e3,queryFn:async({signal:n})=>{const t=await fetch(e,{method:"HEAD",cache:"no-store",signal:n});if(t.status===404)return"missing";if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.headers.get("etag")??t.headers.get("content-length")}});function RF(e,n=!0){return ot({...O9t(e),enabled:n,subscribed:n}).data??null}function I9t(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")}function B9t(e,n,t){const r=t.indexOf("#"),s=r===-1?t:t.slice(0,r),i=r===-1?"":t.slice(r),a=s.indexOf("?"),o=a===-1?s:s.slice(0,a),l=a===-1?"":s.slice(a+1),u=o.startsWith("/")?[]:n.split("/").filter(m=>m.length>0);for(const m of o.split("/"))if(!(!m||m==="."))if(m===".."){if(u.length===0)return null;u.pop()}else u.push(m);const _=u.join("/");if(!_)return null;const d=new URLSearchParams(l);d.delete("path");const p=d.toString();return{path:_,url:`${Oh(e,_)}${p?`&${p}`:""}${i}`}}function $9t(e){if(!e.startsWith("---"))return e;const n=e.indexOf(` +---`,3);return n===-1?e:e.slice(n+4).replace(/^\r?\n/,"")}const MF="orx:files-tree-width",DF="orx:artifacts-collapsed:",LF=180,OF=320,P9t=8,F9t=280;function H9t(){try{const e=Number(localStorage.getItem(MF));if(Number.isFinite(e)&&e>=LF&&e<=OF)return e}catch{}return F9t}function q9t(e){try{const n=localStorage.getItem(`${DF}${e}`);if(!n)return new Set;const t=JSON.parse(n);return Array.isArray(t)?new Set(t.filter(r=>typeof r=="string")):new Set}catch{return new Set}}function xp(e,n){for(const t of e){if(t.path===n)return t;if(t.isDir&&n.startsWith(t.path+"/")){const r=xp(t.children??[],n);if(r)return r}}return null}function IF({projectId:e,folder:n,markdown:t,entries:r}){const s=i=>{if(I9t(i))return i;const a=B9t(e,n,i);if(!a)return null;const o=xp(r,a.path);if(!o)return a.url;const l=a.url.indexOf("#"),u=l===-1?a.url:a.url.slice(0,l),_=l===-1?"":a.url.slice(l);return`${u}&v=${o.modifiedAt}:${o.size}${_}`};return f.jsx("div",{className:"md min-w-0 wrap-anywhere text-text leading-[1.62] [&_>_*:first-child]:mt-0 [&_>_*:last-child]:mb-0 [&_p]:my-2.5 [&_p]:mx-0 [&_strong]:text-text [&_strong]:font-semibold [&_pre]:bg-surface [&_pre]:border [&_pre]:border-border-muted [&_pre]:rounded-md [&_pre]:py-2 [&_pre]:px-3 [&_pre]:overflow-x-auto [&_pre]:text-sm [&_pre]:text-text [&_code]:font-mono [&_code]:text-sm [&_code]:font-medium [&_code]:text-primary [&_code]:bg-panel [&_code]:border [&_code]:border-border-variant [&_code]:rounded-xs [&_code]:py-px [&_code]:px-[5px] [&_.katex]:text-prose-emphasis [&_.katex-display]:my-3 [&_.katex-display]:mx-0 [&_.katex-display]:overflow-x-auto [&_.katex-display]:overflow-y-hidden [&_.katex-display]:py-0.5 [&_.katex-display]:px-0 [&_.file-chip]:inline-flex [&_.file-chip]:items-center [&_.file-chip]:gap-1 [&_.file-chip]:max-w-full [&_.file-chip]:my-0 [&_.file-chip]:mx-px [&_.file-chip]:py-0 [&_.file-chip]:px-1.5 [&_.file-chip]:align-baseline [&_.file-chip]:font-mono [&_.file-chip]:text-sm [&_.file-chip]:font-medium [&_.file-chip]:text-text [&_.file-chip]:bg-panel [&_.file-chip]:border [&_.file-chip]:border-border-variant [&_.file-chip]:rounded-xs [&_.file-chip]:cursor-pointer [&_.file-chip:hover:not(:disabled)]:bg-surface [&_.file-chip:hover:not(:disabled)]:text-primary [&_.file-chip_svg]:flex-none [&_.file-chip_svg]:opacity-60 [&_.file-chip-label]:max-w-65 [&_.file-chip-label]:overflow-hidden [&_.file-chip-label]:text-ellipsis [&_.file-chip-label]:whitespace-nowrap [&_.run-chip_svg]:opacity-100 [&_.run-chip_svg]:text-primary [&_pre_code]:bg-none [&_pre_code]:bg-transparent [&_pre_code]:border-0 [&_pre_code]:text-inherit [&_pre_code]:p-0 [&_pre_code]:font-normal [&_h1]:text-text [&_h1]:font-semibold [&_h2]:text-text [&_h2]:font-semibold [&_h3]:text-text [&_h3]:font-semibold [&_h4]:text-text [&_h4]:font-semibold [&_ul]:my-1.5 [&_ul]:mx-0 [&_ul]:ps-5.5 [&_ol]:my-1.5 [&_ol]:mx-0 [&_ol]:ps-5.5 [&_li::marker]:text-primary [&_a]:text-primary [&_table]:border-collapse [&_table]:text-sm [&_table]:my-2.5 [&_table]:mx-0 [&_table]:border [&_table]:border-border [&_table]:rounded-md [&_th]:border-b [&_th]:border-b-border-variant [&_th]:py-2 [&_th]:px-3.5 [&_th]:text-start [&_th]:text-text [&_th]:break-normal [&_th]:break-words [&_td]:border-b [&_td]:border-b-border-variant [&_td]:py-2 [&_td]:px-3.5 [&_td]:text-start [&_td]:text-text [&_td]:break-normal [&_td]:break-words [&_tr:last-child_td]:border-b-0 [&_thead_th]:bg-surface [&_thead_th]:font-medium [&_thead_th]:text-text [&_thead_th]:border-b [&_thead_th]:border-b-border [&_tbody_tr:hover_td]:bg-surface-bright [&_blockquote]:my-1.5 [&_blockquote]:mx-0 [&_blockquote]:pt-0.5 [&_blockquote]:pe-0 [&_blockquote]:pb-0.5 [&_blockquote]:ps-2.5 [&_blockquote]:border-s-[3px] [&_blockquote]:border-s-border [&_blockquote]:text-subtext [:is(&,_.openresearch-diff,_.file-view)_.token.comment]:italic [:is(&,_.openresearch-diff,_.file-view)_.token.prolog]:italic [:is(&,_.openresearch-diff,_.file-view)_.token.cdata]:italic [:is(&,_.openresearch-diff,_.file-view)_.token.operator]:text-syntax-cyan [:is(&,_.openresearch-diff,_.file-view)_.token.entity]:text-syntax-cyan [:is(&,_.openresearch-diff,_.file-view)_.token.url]:text-syntax-cyan [:is(&,_.openresearch-diff,_.file-view)_.token.comment]:text-syntax-comment [:is(&,_.openresearch-diff,_.file-view)_.token.prolog]:text-syntax-comment [:is(&,_.openresearch-diff,_.file-view)_.token.cdata]:text-syntax-comment [:is(&,_.openresearch-diff,_.file-view)_.token.punctuation]:text-syntax-text [:is(&,_.openresearch-diff,_.file-view)_.token.property]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.tag]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.deleted]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.constant]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.symbol]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.boolean]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.number]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.selector]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.attr-name]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.char]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.inserted]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.string]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.builtin]:text-syntax-yellow [:is(&,_.openresearch-diff,_.file-view)_.token.atrule]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.attr-value]:text-syntax-orange [:is(&,_.openresearch-diff,_.file-view)_.token.keyword]:text-syntax-purple [:is(&,_.openresearch-diff,_.file-view)_.token.function]:text-syntax-blue [:is(&,_.openresearch-diff,_.file-view)_.token.decorator]:text-syntax-blue [:is(&,_.openresearch-diff,_.file-view)_.token.def]:text-syntax-blue [:is(&,_.openresearch-diff,_.file-view)_.token.class-name]:text-syntax-yellow [:is(&,_.openresearch-diff,_.file-view)_.token.namespace]:text-syntax-yellow [:is(&,_.openresearch-diff,_.file-view)_.token.regex]:text-syntax-green [:is(&,_.openresearch-diff,_.file-view)_.token.important]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.variable]:text-syntax-red [:is(&,_.openresearch-diff,_.file-view)_.token.parameter]:text-syntax-text artifact-md text-lg [&_h1]:text-4xl [&_h1]:leading-[1.18] [&_h1]:mt-7 [&_h1]:mx-0 [&_h1]:mb-3.5 [&_h2]:text-3xl [&_h2]:leading-tight [&_h2]:mt-7 [&_h2]:mx-0 [&_h2]:mb-2.5 [&_h3]:text-xl [&_h3]:leading-[1.35] [&_h3]:mt-5.5 [&_h3]:mx-0 [&_h3]:mb-2 [&_h4]:text-lg [&_h4]:leading-[1.4] [&_h4]:mt-4.5 [&_h4]:mx-0 [&_h4]:mb-1.5 [&_table]:block [&_table]:w-max [&_table]:max-w-full [&_table]:overflow-x-auto [&_.artifact-img]:block [&_.artifact-img]:my-3 [&_.artifact-img]:mx-0 [&_.artifact-img_img]:max-w-full [&_.artifact-img_img]:h-auto [&_.artifact-img_img]:border [&_.artifact-img_img]:border-border [&_.artifact-img_img]:rounded-sm [&_.artifact-img-caption]:block [&_.artifact-img-caption]:mt-1 [&_.artifact-img-caption]:text-center [&_.artifact-img-caption]:text-sm [&_.artifact-img-caption]:text-subtext",children:f.jsx(H3t,{remarkPlugins:[MP,[DP,FP]],rehypePlugins:[lP],components:{a:({href:i,children:a,...o})=>{const l=!i||i.startsWith("#"),u=l?i:s(i);return u?f.jsx("a",{...o,href:u,...l?{}:{target:"_blank",rel:"noopener noreferrer"},children:a}):f.jsx("span",{children:a})},img:({src:i,alt:a})=>{if(!i||typeof i!="string")return null;const o=s(i);return o?f.jsxs("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"artifact-img",children:[f.jsx("img",{src:o,alt:a??"",loading:"lazy"}),a&&f.jsx("span",{className:"artifact-img-caption",children:a})]}):null},...HP},children:$P($9t(t))})})}function U9t(e){return e.presentation==="text"&&yk(e.name)?"markdown":AF(e.presentation)??(e.presentation==="text"||e.presentation==="unknown"?"text":"download")}function G9t(e,n,t,r){var u;const s=t==="markdown"||t==="text"&&n.size<=PL,i=q6(e,n.path),a=ot({...i,enabled:s,subscribed:s}),o=R.useRef({projectId:e,path:n.path,modifiedAt:n.modifiedAt,size:n.size,version:r});R.useEffect(()=>{const _=o.current;o.current={projectId:e,path:n.path,modifiedAt:n.modifiedAt,size:n.size,version:r},s&&_.projectId===e&&_.path===n.path&&(_.modifiedAt!==n.modifiedAt||_.size!==n.size||_.version!==null&&_.version!==r)&&tt.invalidateQueries({queryKey:i.queryKey,exact:!0})},[e,n.path,n.modifiedAt,n.size,r,s]);const l=a.data;return{text:l&&!l.binary?l.content:null,binary:(l==null?void 0:l.binary)??!1,truncated:(l==null?void 0:l.truncated)??!1,error:l?null:((u=a.error)==null?void 0:u.message)??(l===null?Sre():null),wantsText:s}}function W9t({projectId:e,entry:n,onDelete:t,artifactEntries:r}){const s=U9t(n),i=RF(Oh(e,n.path)),{text:a,binary:o,truncated:l,error:u,wantsText:_}=G9t(e,n,s,i),[d,p]=R.useState(!1),m=s==="markdown",x=n.path.split("/").slice(0,-1).join("/"),S=`${Oh(e,n.path)}&v=${encodeURIComponent(i??`${n.modifiedAt}:${n.size}`)}`;let v;return s==="image"||s==="audio"||s==="video"||s==="pdf"?v=f.jsx(l5,{kind:s,url:S,name:n.name}):s==="download"||!_||o?v=f.jsxs("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:[s==="download"||o?pre():wse()," ",f.jsx("a",{href:S,...s==="download"||o?{download:n.name}:{target:"_blank",rel:"noopener noreferrer"},children:s==="download"||o?RD():Nre()})]}):u?v=f.jsxs("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:[Hre()," ",Ne(u)]}):a===null?v=f.jsxs(rs,{children:[f.jsx(Lt,{})," ",gD()]}):m&&!d?v=f.jsx(IF,{projectId:e,folder:x,markdown:a,entries:r}):v=f.jsx(TF,{text:a,path:n.path}),f.jsxs("div",{className:"fpreview flex-1 min-w-0 bg-background file-view flex flex-col h-full min-h-0 [@container((max-width:_720px))]:hidden",children:[f.jsxs("div",{className:"fpreview-head flex w-full min-w-0 min-h-9 items-center gap-1 px-4 py-1 bg-background text-subtext shrink-0",children:[f.jsx(Kh,{name:n.name}),f.jsx("span",{className:"fpreview-path flex-1 min-w-0 truncate text-sm text-subtext","data-tip":Ne(n.path),children:n.name}),f.jsxs("span",{dir:"auto",className:"fpreview-date text-xs text-muted whitespace-nowrap shrink-0",children:[ose()," ",new Date(n.modifiedAt).toLocaleString(j(),{dateStyle:"medium",timeStyle:"short"})]}),(s==="text"||s==="download")&&f.jsx("span",{className:"fpreview-size text-xs text-muted whitespace-nowrap shrink-0",children:Al(n.size)}),m&&f.jsx(Yt,{size:"small",active:d,"data-tip":d?tv():Zf(),"data-tip-align":"end","aria-label":d?tv():Zf(),onClick:()=>p(b=>!b),children:f.jsx(Z4,{size:13})}),f.jsx(nb,{size:"small",href:S,target:"_blank",rel:"noopener noreferrer","data-tip":cE(),"data-tip-align":"end","aria-label":cE(),children:f.jsx(jd,{size:13})}),f.jsx(Yt,{size:"small","data-tip":lE(),"data-tip-align":"end","aria-label":lE(),onClick:()=>{window.confirm(Z5({path:Ne(n.path)}))&&t(n.path)},children:f.jsx(Vd,{size:13})})]}),f.jsxs("div",{className:`fpreview-body flex-1 min-h-0 overflow-auto [&.doc]:pt-4.5 [&.doc]:px-7 [&.doc]:pb-12 [&.doc_.artifact-md]:max-w-readable [&.doc_.artifact-md]:my-0 [&.doc_.artifact-md]:mx-auto ${m&&!d?"doc":""}`,children:[v,l&&f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:Wre()})]})]})}function BF({entries:e,depth:n,collapsed:t,selected:r,onToggle:s,onSelect:i,onOpenFile:a,onDelete:o,renamingPath:l,onContextMenu:u,onRename:_,onCancelRename:d}){return f.jsx("div",{className:"flex w-full max-w-full min-w-0 flex-col items-stretch",children:e.map(p=>{var x;const m={paddingInlineStart:8+Math.min(n,P9t)*14};if(p.isDir){const S=!t.has(p.path);return f.jsxs("div",{className:"min-w-0 max-w-full",children:[f.jsxs("div",{className:"file-tree-row flex w-full min-w-0 items-center gap-1.5 py-[3px] px-2.5 border-0 bg-transparent text-text text-start cursor-pointer font-[inherit] [&:hover]:bg-panel [&_>_svg]:shrink-0 [&_>_svg]:text-subtext [&_>_svg.file-tree-chevron]:text-muted artifact-tree-row [&.selected]:bg-panel [&.selected:hover]:bg-panel [&:hover_.ft-row-delete]:opacity-100",style:m,onClick:()=>s(p.path),children:[f.jsx("button",{className:"file-tree-chevron text-muted shrink-0 [button&]:inline-flex [button&]:items-center [button&]:justify-center [button&]:w-[13px] [button&]:h-[13px] [button&]:p-0 [button&]:border-0 [button&]:bg-transparent [button&_>_svg]:transition-transform [button&_>_svg]:duration-120 [button&_>_svg]:ease-standard [button&_>_svg.open]:rotate-90","aria-label":S?ere({name:Ne(p.name)}):dre({name:Ne(p.name)}),onClick:v=>{v.stopPropagation(),s(p.path)},children:f.jsx(Ca,{size:13,className:S?"open":""})}),f.jsx("span",{className:"file-tree-name flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:p.name}),f.jsx(Yt,{size:"small",className:"ft-row-delete opacity-35 focus-visible:opacity-100","data-tip":Bre(),"data-tip-align":"end","aria-label":ore({name:Ne(p.name)}),onClick:v=>{v.stopPropagation(),window.confirm(Z5({path:Ne(p.path)}))&&o(p.path)},children:f.jsx(Vd,{size:12})})]}),S&&(((x=p.children)==null?void 0:x.length)??0)>0&&f.jsx(BF,{entries:p.children??[],depth:n+1,collapsed:t,selected:r,onToggle:s,onSelect:i,onOpenFile:a,onDelete:o,renamingPath:l,onContextMenu:u,onRename:_,onCancelRename:d})]},p.path)}return l===p.path?f.jsxs("div",{className:"file-tree-row flex w-full min-w-0 items-center gap-1.5 py-[3px] px-2.5 border-0 bg-transparent text-text text-start font-[inherit] artifact-tree-row",style:m,children:[f.jsx(Kh,{name:p.name}),f.jsx(EF,{name:p.name,onCommit:S=>_(p.path,S),onCancel:d})]},p.path):f.jsxs("button",{type:"button",className:`file-tree-row flex w-full min-w-0 items-center gap-1.5 py-[3px] px-2.5 border-0 bg-transparent text-text text-start cursor-pointer font-[inherit] [&:hover]:bg-panel [&_>_svg]:shrink-0 [&_>_svg]:text-subtext [&_>_svg.file-tree-chevron]:text-muted artifact-tree-row [&.selected]:bg-panel [&.selected:hover]:bg-panel [&:hover_.ft-row-delete]:opacity-100 ${r===p.path?"selected":""}`,style:m,title:hK({path:Ne(p.path)}),"aria-keyshortcuts":"Space Enter","aria-pressed":r===p.path,onClick:()=>i(p.path),onDoubleClick:()=>a(p.path),onContextMenu:S=>{S.preventDefault(),i(p.path),u(S,p.path)},onAuxClick:S=>{S.button===1&&(S.preventDefault(),i(p.path),a(p.path))},onKeyDown:S=>{if(S.key==="ContextMenu"||S.shiftKey&&S.key==="F10"){S.preventDefault(),i(p.path),u(S,p.path);return}if(S.key===" "){S.preventDefault(),S.stopPropagation(),i(p.path);return}S.key==="Enter"&&(S.preventDefault(),S.stopPropagation(),i(p.path),a(p.path))},children:[f.jsx(Kh,{name:p.name}),f.jsx("span",{className:"file-tree-name flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",children:p.name})]},p.path)})})}function V9t({project:e,artifacts:n,onOpenFile:t,canRenameFile:r}){const[s,i]=R.useState(null),[a,o]=R.useState(()=>q9t(e.id)),[l,u]=R.useState(H9t),[_,d]=R.useState(null),[p,m]=R.useState(null),x=R.useRef(null);R.useEffect(()=>{try{localStorage.setItem(`${DF}${e.id}`,JSON.stringify([...a]))}catch{}},[e.id,a]);const S=N=>{var B;N.preventDefault(),N.currentTarget.setPointerCapture(N.pointerId);const T=(B=x.current)==null?void 0:B.getBoundingClientRect(),z=document.body.style.userSelect;document.body.style.userSelect="none";const M=$=>{const U=Math.round($.clientX-((T==null?void 0:T.left)??0)),H=Math.min(Math.max(U,LF),OF);u(H);try{localStorage.setItem(MF,String(H))}catch{}},I=()=>{window.removeEventListener("pointermove",M),window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",I),document.body.style.userSelect=z};window.addEventListener("pointermove",M),window.addEventListener("pointerup",I),window.addEventListener("pointercancel",I)};R.useEffect(()=>{if(!s||!n)return;const N=xp(n.entries,s);(!N||N.isDir)&&i(null)},[s,n]);const v=N=>o(T=>{const z=new Set(T);return z.has(N)?z.delete(N):z.add(N),z}),b=N=>{(s===N||s!=null&&s.startsWith(N+"/"))&&i(null),Mdt(e.id,N).catch(()=>{})},w=async(N,T)=>{try{await Ddt(e.id,N,T),T.action==="rename"&&s===N&&i(null)}catch(z){Vn(z instanceof Error?z.message:String(z),"error")}},y=N=>{n&&CF(n.dir,N)};if(!n)return f.jsx("div",{className:"files-tab h-full min-h-0 flex bg-background",children:f.jsxs(rs,{className:"p-5",children:[f.jsx(Lt,{})," ",rse()]})});const C=N=>f.jsx(BF,{entries:N,depth:0,collapsed:a,selected:s,onToggle:v,onSelect:i,onOpenFile:t,onDelete:b,renamingPath:p,onContextMenu:(T,z)=>{d(NF(T,z))},onRename:(T,z)=>{m(null),w(T,{action:"rename",newName:z})},onCancelRename:()=>m(null)}),E=s?xp(n.entries,s):null;return n.entries.length===0?f.jsx(wk,{icon:M6,title:dse(),description:vse()}):f.jsxs("div",{className:"files-tab h-full min-h-0 flex bg-background @container",children:[f.jsxs("div",{className:"ftree-pane relative shrink-0 flex flex-col min-h-0 border-s border-s-border-variant border-e border-e-border-variant bg-background [@container((max-width:_720px))]:!w-full",ref:x,style:{width:l},children:[f.jsx("div",{className:"ftree-resizer absolute -end-[3px] top-0 bottom-0 w-1.5 cursor-col-resize z-30 [&:hover]:bg-resizer-hover [&:active]:bg-resizer-hover [@container((max-width:_720px))]:hidden",onPointerDown:S}),f.jsxs("div",{className:"ftree-scroll flex-1 min-h-0 overflow-y-auto file-tree py-1.5 px-0 text-sm",children:[C(n.entries),n.truncated&&f.jsx("p",{className:"files-truncated m-0 py-2 px-3.5 text-sm text-muted",children:Yre()})]})]}),E?f.jsx(W9t,{projectId:e.id,entry:E,onDelete:b,artifactEntries:n.entries},E.path):f.jsxs("div",{className:"fpreview flex-1 min-w-0 flex flex-col min-h-0 bg-background fpreview-none items-center justify-center gap-2 text-sm text-muted [@container((max-width:_720px))]:hidden",children:[f.jsx(rmt,{size:22,strokeWidth:1.5}),f.jsx("span",{children:Are()})]}),_&&f.jsx(zF,{target:_,onOpen:()=>t(_.path),onRename:r(_.path)?()=>m(_.path):void 0,onDuplicate:()=>void w(_.path,{action:"duplicate"}),onCopyPath:()=>y(_.path),onDelete:()=>{window.confirm(Z5({path:Ne(_.path)}))&&b(_.path)},onClose:()=>d(null)})]})}const $F=20*1024*1024,PF="bg-background border border-border rounded-lg py-4 px-4.5 mb-4 [&_h3]:mt-0 [&_h3]:mx-0 [&_h3]:mb-2.5 [&_h3]:text-base [&_h3]:font-semibold [&_h3]:text-text",FF="mt-0 mx-0 mb-3 text-sm leading-relaxed text-text",K9t="flex items-start gap-3 py-2.5 border-t border-t-border first:border-t-0",Q9t="text-sm font-normal text-text",Y9t="mt-1 mb-0 text-sm leading-relaxed text-text";function HF(e){return new Promise((n,t)=>{const r=new FileReader;r.onload=()=>{const s=r.result;if(typeof s!="string"){t(new Error("could not read file"));return}const i=s.indexOf(",");n(i>=0?s.slice(i+1):s)},r.onerror=()=>t(r.error??new Error("could not read file")),r.readAsDataURL(e)})}function X9t(e){const n=e.toLowerCase();return n.endsWith(".md")||n.endsWith(".markdown")||n.endsWith(".zip")}function qF({accept:e,busy:n,prompt:t,onFile:r}){const[s,i]=R.useState(!1),a=R.useRef(null);return f.jsxs("div",{className:`flex flex-col items-center justify-center gap-2 py-6.5 px-4.5 border-[1.5px] border-dashed rounded-md text-center text-sm text-text transition-[border-color,background] duration-120 ${n?"cursor-default":"cursor-pointer"} ${s?"border-primary bg-surface text-text":"border-border-variant bg-surface [&:hover]:border-primary"}`,onDragOver:o=>{o.preventDefault(),i(!0)},onDragLeave:()=>i(!1),onDrop:o=>{var u;if(o.preventDefault(),i(!1),n)return;const l=(u=o.dataTransfer.files)==null?void 0:u[0];l&&r(l)},onClick:()=>{var o;n||(o=a.current)==null||o.click()},role:"button",tabIndex:0,"aria-disabled":n,"aria-busy":n,onKeyDown:o=>{var l;(o.key==="Enter"||o.key===" ")&&!n&&(o.preventDefault(),(l=a.current)==null||l.click())},children:[f.jsx("input",{ref:a,type:"file",accept:e,hidden:!0,onChange:o=>{var u;const l=(u=o.target.files)==null?void 0:u[0];l&&r(l),o.target.value=""}}),n?f.jsxs(f.Fragment,{children:[f.jsx(Lt,{}),f.jsx("span",{children:Rrt()})]}):f.jsxs(f.Fragment,{children:[f.jsx(zmt,{size:20,strokeWidth:1.5}),f.jsx("span",{children:t})]})]})}function UF({bytes:e,updatedAt:n}){return f.jsxs("div",{className:"shrink-0 text-end whitespace-nowrap pt-0.5 text-xs text-subtext",children:[Al(e),n>0&&f.jsxs("span",{className:"text-muted",children:[" · ",Io(n)]})]})}function Z9t({skill:e,onError:n}){const t=mn({mutationFn:nft}),r=t.isPending;return f.jsxs("div",{className:"flex items-center gap-2 py-1 border-t border-t-border first:border-t-0",children:[f.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[f.jsx("span",{className:Q9t,children:e.name}),e.origin&&f.jsx(Ft,{size:"small",children:e.origin})]}),f.jsx(UF,{bytes:e.bytes,updatedAt:e.updatedAt}),f.jsx(Yt,{size:"small","data-tip":e.origin?Ent():ert(),"data-tip-align":"end","aria-label":e.origin?Dnt({name:Ne(e.name)}):Gtt({name:Ne(e.name)}),disabled:r,onClick:()=>{window.confirm(e.origin?Tnt({name:Ne(e.name)}):Ftt({name:Ne(e.name)}))&&t.mutateAsync(e.name).catch(s=>{n(s instanceof Error?s.message:String(s))})},children:f.jsx(Vd,{size:13})})]})}function J9t({template:e,onError:n}){const t=mn({mutationFn:Jdt}),r=t.isPending,s=e.supportFiles.length;return f.jsxs("div",{className:K9t,children:[f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("span",{className:"text-base font-medium text-text",children:e.name}),f.jsxs("p",{className:Y9t,children:[e.entry,s>0&&(s===1?vnt():Bnt({count:Wt(s)}))]})]}),f.jsx(UF,{bytes:e.bytes,updatedAt:e.updatedAt}),f.jsx(Yt,{"data-tip":srt(),"data-tip-align":"end","aria-label":Jtt({name:Ne(e.name)}),disabled:r,onClick:()=>{window.confirm(Qtt({name:Ne(e.name)}))&&t.mutateAsync(e.name).catch(i=>{n(i instanceof Error?i.message:String(i))})},children:f.jsx(Vd,{size:13})})]})}function eEt(){var w;const e=mn({mutationFn:tft}),n=ot(Hft()),t=n.data,r=R.useRef(null),[s,i]=R.useState(!1),[a,o]=R.useState(!1),l=R.useCallback(()=>{const y=r.current;i(!!y&&y.scrollTop>1),o(!!y&&y.scrollHeight-y.scrollTop-y.clientHeight>1)},[]);R.useLayoutEffect(()=>{l();const y=r.current;if(!y)return;const C=new ResizeObserver(l);return C.observe(y),()=>C.disconnect()},[t,l]);const u=n.isFetching,_=(w=n.error)==null?void 0:w.message,[d,p]=R.useState(!1),[m,x]=R.useState(null),S=()=>{n.refetch()},v=R.useRef(!1),b=R.useCallback(async y=>{if(!v.current){if(x(null),!X9t(y.name)){x(Prt());return}if(y.size>$F){x(CL());return}v.current=!0,p(!0);try{await e.mutateAsync({filename:y.name,contentBase64:await HF(y)})}catch(C){x(C instanceof Error?C.message:String(C))}finally{v.current=!1,p(!1)}}},[]);return f.jsxs("section",{className:PF,children:[f.jsxs("div",{className:"flex items-baseline gap-2.5",children:[f.jsx("h3",{children:zrt()}),f.jsxs(Le,{className:"ms-auto",size:"small",onClick:S,disabled:u,children:[f.jsx(Ea,{size:12,className:u?"animate-[spin_0.9s_linear_infinite]":""})," ",Yp()]})]}),f.jsx("p",{className:FF,children:rnt()}),f.jsx(qF,{accept:".md,.markdown,.zip",busy:d,prompt:f.jsxs(f.Fragment,{children:[f.jsx("span",{children:ont()}),f.jsx("span",{className:"block ps-4 mt-1 text-text",children:Itt()})]}),onFile:y=>void b(y)}),m&&f.jsx("div",{role:"alert",className:"mt-2.5 text-base text-accent-red whitespace-pre-wrap",children:m}),_&&f.jsxs("div",{role:"alert",className:"pt-3 text-base text-accent-red",children:[Hnt()," ",_]}),t===void 0?_?null:f.jsxs("div",{className:"flex items-center gap-2 pt-3 text-sm text-subtext",children:[f.jsx(Lt,{})," ",frt()]}):t.length===0?f.jsx("div",{className:"pt-3 text-sm text-subtext",children:yrt()}):f.jsxs("div",{className:"relative mt-1",children:[f.jsx("div",{ref:r,onScroll:l,className:"flex flex-col max-h-120 overflow-y-auto overscroll-contain",children:t.map(y=>f.jsx(Z9t,{skill:y,onError:x},y.name))}),s&&f.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 top-0 h-10 bg-gradient-to-b from-background to-transparent"}),a&&f.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-background to-transparent"})]})]})}function tEt(){var _;const e=mn({mutationFn:Zdt}),n=ot(Fft()),t=n.data,r=(_=n.error)==null?void 0:_.message,[s,i]=R.useState(!1),[a,o]=R.useState(null),l=R.useRef(!1),u=R.useCallback(async d=>{if(l.current)return;o(null);const p=d.name.toLowerCase();if(!p.endsWith(".tex")&&!p.endsWith(".zip")){o(Urt());return}if(d.size>$F){o(CL());return}l.current=!0,i(!0);try{await e.mutateAsync({filename:d.name,contentBase64:await HF(d)})}catch(m){o(m instanceof Error?m.message:String(m))}finally{l.current=!1,i(!1)}},[]);return f.jsxs("section",{className:PF,children:[f.jsx("h3",{children:lrt()}),f.jsx("p",{className:FF,children:Ort()}),f.jsx(qF,{accept:".tex,.zip",busy:s,prompt:f.jsxs(f.Fragment,{children:[f.jsx("span",{children:dnt()}),f.jsx("span",{className:"block ps-4 mt-1 text-text",children:cat()})]}),onFile:d=>void u(d)}),a&&f.jsx("div",{role:"alert",className:"mt-2.5 text-base text-accent-red whitespace-pre-wrap",children:a}),r&&f.jsxs("div",{role:"alert",className:"pt-3 text-base text-accent-red",children:[Wnt()," ",r]}),t===void 0?r?null:f.jsxs("div",{className:"flex items-center gap-2 pt-3 text-sm text-subtext",children:[f.jsx(Lt,{})," ",mrt()]}):t.length===0?f.jsx("div",{className:"pt-3 text-sm text-subtext",children:krt()}):f.jsx("div",{className:"flex flex-col mt-1",children:t.map(d=>f.jsx(J9t,{template:d,onError:o},d.name))})]})}function nEt(){return f.jsxs("div",{className:"settings-view max-w-readable my-0 mx-auto pt-6 px-8 pb-15 [&_h1]:mt-0 [&_h1]:mx-0 [&_h1]:mb-1.5 [&_h1]:text-3xl",children:[f.jsx("h1",{children:Ynt()}),f.jsx("p",{className:"mt-0 mx-0 mb-5 text-base leading-relaxed text-text",children:wnt()}),f.jsx(eEt,{}),f.jsx(tEt,{})]})}const rEt="italic [&_.tab-label_>_span]:pe-1 [&_.tab-label::after]:pe-1";function Rc({active:e,label:n,icon:t,shimmer:r=!1,preview:s=!1,onSelect:i,onPromote:a,onClose:o}){return f.jsxs("button",{className:`tab [&.closable]:max-w-60 [&.closable]:pe-0.5 [&_.tab-label]:grid [&_.tab-label]:grid-cols-[minmax(0,_1fr)] [&_.tab-label]:min-w-0 [&_.tab-label]:overflow-hidden [&_.tab-label_>_span]:[grid-area:1_/_1] [&_.tab-label_>_span]:overflow-hidden [&_.tab-label_>_span]:text-ellipsis [&_.tab-label_>_span]:whitespace-nowrap [&_.tab-label::after]:[grid-area:1_/_1] [&_.tab-label::after]:overflow-hidden [&_.tab-label::after]:text-ellipsis [&_.tab-label::after]:whitespace-nowrap [&_.tab-label::after]:content-[attr(data-label)] [&_.tab-label::after]:invisible [&_.tab-label::after]:font-medium [&_.tab-close]:inline-flex [&_.tab-close]:items-center [&_.tab-close]:justify-center [&_.tab-close]:w-3.5 [&_.tab-close]:h-3.5 [&_.tab-close]:rounded-xs [&_.tab-close]:text-muted [&_.tab-close]:shrink-0 [&_.tab-close:hover]:bg-hover-strong [&_.tab-close:hover]:text-text relative inline-flex items-center gap-[5px] h-8 py-0 px-2 border border-transparent border-b-0 rounded-[var(--radius-md)_var(--radius-md)_0_0] text-sm font-normal text-subtext whitespace-nowrap select-none min-w-0 [&:hover]:bg-surface [&:hover]:text-text [&:not(.active)_+_.tab:not(.active)::before]:content-[''] [&:not(.active)_+_.tab:not(.active)::before]:absolute [&:not(.active)_+_.tab:not(.active)::before]:top-2.5 [&:not(.active)_+_.tab:not(.active)::before]:bottom-2.5 [&:not(.active)_+_.tab:not(.active)::before]:-start-px [&:not(.active)_+_.tab:not(.active)::before]:w-px [&:not(.active)_+_.tab:not(.active)::before]:bg-border [&.active]:border-border [&.active]:bg-background [&.active]:text-text [&.active]:font-medium [&.active::after]:content-[''] [&.active::after]:absolute [&.active::after]:end-0 [&.active::after]:-bottom-px [&.active::after]:start-0 [&.active::after]:h-px [&.active::after]:bg-background closable ${e?"active":""} ${s?rEt:""}`,onClick:i,onDoubleClick:a,title:s?iat({label:n}):n,"aria-label":s?tat({label:n}):n,children:[t,f.jsx("span",{className:"tab-label","data-label":n,children:f.jsx("span",{className:r?"tool-running-shimmer":"",children:n})}),f.jsx("span",{role:"button",className:"tab-close",title:p0e(),onPointerDown:l=>l.preventDefault(),onClick:l=>{l.stopPropagation(),o()},children:f.jsx(qr,{size:12})})]})}const jA=["files-pill inline-flex items-center gap-2 min-w-0 border border-border","rounded-md py-[7px] px-[11px] bg-background text-text","no-underline [&_code]:font-mono [&_code]:text-sm","[&_code]:overflow-hidden [&_code]:text-ellipsis [&_code]:whitespace-nowrap","[&_>_svg]:shrink-0 [&_>_svg]:text-muted [a&:hover]:border-muted"].join(" ");function sEt({owner:e,repo:n,branch:t}){return!e||!n?f.jsx("span",{className:jA,children:f.jsx("code",{children:t})}):f.jsxs("a",{className:jA,href:Jv(e,n,t),target:"_blank",rel:"noopener noreferrer",title:J1({name:Ne(t)}),children:[f.jsx("code",{children:t}),f.jsx(fb,{size:12})]})}const Iw=["experiment-overview-section mt-5.5 pt-4.5 border-t border-t-border-variant","[&_h2]:mt-0 [&_h2]:mx-0 [&_h2]:mb-3.5 [&_h2]:text-text [&_h2]:text-sm","[&_h2]:font-semibold"].join(" "),TA=["experiment-overview-command block mt-[13px] text-text text-sm","wrap-anywhere"].join(" ");function AA(e){return new Date(e).toLocaleString(j(),{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function RA(e,n){return np((e.endedAt??n)-e.createdAt)}function iEt({experiment:e,parentExperiment:n,project:t,runs:r,onOpenLogs:s,onOpenCode:i}){const a=r[0]??null,o=r.some(_=>_.status==="running"||_.status==="starting"),[l,u]=R.useState(()=>Date.now());return R.useEffect(()=>{if(!o)return;u(Date.now());const _=window.setInterval(()=>u(Date.now()),1e3);return()=>window.clearInterval(_)},[o]),f.jsx("div",{className:"experiment-overview absolute inset-0 overflow-y-auto bg-background [&_h1]:m-0 [&_h1]:text-text [&_h1]:text-xl [&_h1]:leading-tight",children:f.jsxs("div",{className:"experiment-overview-inner w-full max-w-230 my-0 mx-auto pt-6.5 px-7 pb-10 [@media((max-width:_720px))]:pt-5 [@media((max-width:_720px))]:px-4.5 [@media((max-width:_720px))]:pb-8",children:[f.jsxs("header",{className:"experiment-overview-head flex items-start justify-between gap-6",children:[f.jsxs("div",{className:"experiment-overview-heading min-w-0",children:[f.jsx("h1",{children:e.title||e.slug}),f.jsx("div",{className:"experiment-overview-slug mt-[5px] text-muted text-sm",children:e.slug})]}),f.jsx(Il,{status:a?Hi(a):"idle"})]}),f.jsxs("div",{className:"experiment-overview-actions flex gap-[7px] mt-4.5 [@media((max-width:_720px))]:flex-wrap",children:[a&&f.jsxs(Le,{...Ur(_=>s(a.id,_)),children:[f.jsx($h,{size:15}),J1e()]}),f.jsxs(Le,{...Ur(i),children:[f.jsx(db,{size:15}),C1e()]})]}),e.description&&f.jsxs("section",{className:"experiment-overview-section mt-5.5 pt-4.5 border-t border-t-border-variant [&_h2]:mt-0 [&_h2]:mx-0 [&_h2]:mb-3.5 [&_h2]:text-text [&_h2]:text-sm [&_h2]:font-semibold overview-description [&_.md]:text-text [&_.md]:leading-[1.65]",children:[f.jsx("h2",{children:I1e()}),f.jsx($o,{text:e.description})]}),f.jsxs("section",{className:Iw,children:[f.jsx("h2",{children:a?x1e():pve()}),a&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"experiment-overview-meta flex items-center flex-wrap gap-y-2.5 gap-x-4.5 text-text text-sm [&_svg]:text-muted [&_.backend-badge]:text-text [&_.status-badge]:text-text [&_>_span]:inline-flex [&_>_span]:items-center [&_>_span]:gap-[5px] [&_code]:text-text [&_code]:text-xs",children:[f.jsx(Il,{status:Hi(a)}),f.jsx($6,{backend:a.backend}),f.jsxs("span",{title:dve(),children:[f.jsx(W0t,{size:13}),AA(a.createdAt)]}),f.jsxs("span",{title:F1e(),children:[f.jsx(ipt,{size:13}),RA(a,l)]}),a.commitSha&&f.jsxs("span",{title:j1e(),children:[f.jsx(Dpt,{size:14}),f.jsx("code",{children:a.commitSha.slice(0,7)})]}),a.exitCode!==null&&a.exitCode!==void 0&&a.exitCode!==0&&f.jsxs("span",{children:[G1e()," ",a.exitCode]})]}),a.command&&f.jsxs("code",{className:TA,children:["$ ",a.command]}),a.resultMarkdown&&f.jsx("div",{className:`experiment-overview-result mt-4 [&.failed]:text-accent-red ${a.status==="failed"?"failed":""}`,children:f.jsx($o,{text:a.resultMarkdown})})]})]}),f.jsxs("section",{className:Iw,children:[f.jsx("h2",{children:"Git"}),f.jsxs("div",{className:"experiment-overview-meta flex items-center flex-wrap text-text text-sm [&_svg]:text-muted [&_.backend-badge]:text-text [&_.status-badge]:text-text [&_>_span]:inline-flex [&_>_span]:items-center [&_>_span]:gap-[5px] [&_code]:text-text [&_code]:text-xs experiment-overview-git-meta gap-y-[9px] gap-x-3.5 [&_.files-pill]:py-[5px] [&_.files-pill]:px-2 [&_.files-pill]:rounded-sm [&_.files-pill_code]:text-xs",children:[f.jsx(sEt,{owner:t.githubEnabled?t.githubOwner:"",repo:t.githubEnabled?t.githubRepo:"",branch:e.branchName}),n&&f.jsxs("span",{children:[Q1e()," ",f.jsx("code",{children:n.slug})]}),f.jsxs("span",{title:AA(e.createdAt),children:[M1e()," ",Io(e.createdAt)]})]}),e.runCommand!==(a==null?void 0:a.command)&&f.jsxs("code",{className:TA,children:["$ ",e.runCommand]})]}),r.length>0&&f.jsxs("section",{className:Iw,children:[f.jsx("h2",{children:ove()}),f.jsx("div",{className:"experiment-run-history border-t border-t-border-variant [&_button]:w-full [&_button]:grid [&_button]:grid-cols-[minmax(72px,_0.7fr)_minmax(100px,_1fr)_minmax(70px,_0.7fr)_60px_16px] [&_button]:items-center [&_button]:gap-3.5 [&_button]:py-[11px] [&_button]:px-0.5 [&_button]:border-b [&_button]:border-b-border-variant [&_button]:text-text [&_button]:text-start [&_button]:text-sm [&_button:hover]:bg-surface [@media((max-width:_720px))]:[&_button]:grid-cols-[65px_1fr_60px_16px] [@media((max-width:_720px))]:[&_button_>_:nth-child(3)]:hidden",children:r.map((_,d)=>f.jsxs("button",{...Ur(p=>s(_.id,p)),children:[f.jsxs("span",{className:"experiment-run-number text-xs font-medium",children:[rve()," ",r.length-d]}),f.jsx(Il,{status:Hi(_)}),f.jsx("span",{children:Io(_.createdAt)}),f.jsx("span",{children:RA(_,l)}),f.jsx($h,{size:13})]},_.id))})]})]})})}function MA(e){const n=atob(e),t=new Uint8Array(n.length);for(let r=0;r{const t=n.current;if(!t)return;const{terminal:r,dispose:s}=S6(t,!0);let i=!1,a=0,o=!1,l=!1;async function u(){if(o){l=!0;return}o=!0;try{for(;;){const d=await kut(e,a);if(i)return;if(d.dataBase64&&r.write(MA(d.dataBase64)),a=d.nextOffset,d.eof)break}}catch{}finally{o=!1,l&&!i&&(l=!1,u())}}const _=Qft(e,d=>{if(i)return;const p=MA(d.dataBase64);!o&&d.offset===a?(r.write(p),a+=p.length):d.offset+p.length>a&&u()});return u(),()=>{i=!0,_(),s()}},[e]),f.jsx("div",{ref:n,className:"h-full w-full"})}function oEt({experiment:e,project:n,view:t,runs:r,selectedRunId:s,onSelectRun:i,parentExperiment:a,onOpenView:o,onOpenCode:l}){const u=r.filter(_=>_.experimentId===e.id).sort((_,d)=>d.createdAt-_.createdAt);return t==="overview"?f.jsx(iEt,{experiment:e,parentExperiment:a,project:n,runs:u,onOpenLogs:(_,d)=>o("terminal",_,d),onOpenCode:_=>l("files",_)}):f.jsx(lEt,{experiment:e,expRuns:u,selectedRunId:s,onSelectRun:i})}function lEt({experiment:e,expRuns:n,selectedRunId:t,onSelectRun:r}){const[s,i]=R.useState(null),[a,o]=R.useState(null),[l,u]=R.useState(!1),_=R.useRef(null),d=t?n.find(v=>v.id===t)??null:n[0]??null,p=(d==null?void 0:d.status)==="running"||(d==null?void 0:d.status)==="starting",m=!!(d&&p&&(d.cancelRequested||a===d.id)),x=v=>{const b=n.findIndex(w=>w.id===v);return b===-1?n.length:n.length-b};R.useEffect(()=>{if(!l)return;const v=b=>{var w;(w=_.current)!=null&&w.contains(b.target)||u(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[l]);async function S(){if(d){i(null),o(d.id);try{await ML(d.id)}catch(v){o(null),i(v instanceof Error?v.message:String(v))}}}return f.jsxs("div",{className:"term-view absolute inset-0 flex flex-col bg-background z-20",children:[f.jsxs("div",{className:"term-bar flex items-center gap-2 h-10 py-0 px-2.5 border-b border-b-border shrink-0 [&_.error]:text-sm [&_.error]:text-accent-red [&_.btn]:inline-flex [&_.btn]:items-center [&_.btn]:gap-[5px]",children:[f.jsx("div",{className:"term-title min-w-0 text-sm font-semibold text-text overflow-hidden text-ellipsis whitespace-nowrap",title:e.title||e.slug,children:e.title||e.slug}),f.jsx("span",{className:"flex-1"}),s&&f.jsx("span",{className:"error",role:"alert",children:s}),p&&f.jsxs(Le,{size:"small",variant:"ghost",disabled:m,onClick:()=>void S(),children:[f.jsx($O,{size:13}),m?G0e():jD()]}),n.length>0&&d&&f.jsxs("div",{className:"run-history relative shrink-0",ref:_,children:[f.jsxs(Le,{title:$ge(),"aria-expanded":l,onClick:()=>u(v=>!v),children:[f.jsxs("span",{children:[$E()," ",x(d.id)]}),f.jsx(Il,{status:m?"cancelling":Hi(d)}),f.jsx(qo,{size:14,className:"run-picker-chev text-muted shrink-0"})]}),l&&f.jsx("div",{className:"history-menu absolute top-[calc(100%_+_6px)] end-0 min-w-57.5 max-h-80 overflow-y-auto bg-background border border-border rounded-lg shadow-menu p-[5px] z-50",children:n.map(v=>f.jsxs(ir,{className:"justify-start",active:v.id===(d==null?void 0:d.id),onClick:()=>{r(v.id),u(!1)},children:[f.jsxs("span",{className:"font-medium",children:[$E()," ",x(v.id)]}),f.jsx(Il,{status:Hi(v)}),f.jsx("span",{className:"ms-auto text-xs text-muted",children:Io(v.createdAt)})]},v.id))})]})]}),f.jsx("div",{className:"term-fill flex-1 min-h-0 bg-terminal pt-1 pe-0 pb-1 ps-1.5",children:d?f.jsx(aEt,{runId:d.id},d.id):f.jsx("div",{className:"term-empty h-full flex items-center justify-center p-6 text-center text-sm text-muted",children:t?Ka():Rge()})})]})}let c5=!1;function DA(e){c5=!0;try{return window.confirm(e)}finally{c5=!1}}const u5=e=>e.replace(/\r\n/g,` `),LA=(e,n,t)=>{const r=u5(n);return{path:e,draft:r,baseline:r,version:t,crlf:n.includes(`\r -`),conflict:null}},kl=e=>e.draft!==e.baseline,cEt=(e,n)=>({...e,draft:n,conflict:n===e.baseline?null:e.conflict}),uEt=e=>e.crlf?e.draft.replace(/\n/g,`\r -`):e.draft;function dEt(e,n,t){return!kl(e)||t&&n===e.version?null:{currentVersion:n,exists:t}}class fEt{constructor(){Fs(this,"buffer",null);Fs(this,"listeners",new Set);Fs(this,"saving",!1);Fs(this,"saveError",null);Fs(this,"revision",0);Fs(this,"saveRevision",0);Fs(this,"getSnapshot",()=>this.buffer);Fs(this,"getRevision",()=>this.revision);Fs(this,"subscribe",n=>(this.listeners.add(n),()=>{this.listeners.delete(n)}));Fs(this,"set",n=>{this.buffer=n,this.notify()});Fs(this,"setSaving",n=>{this.saving=n,n&&this.saveRevision++,this.notify()});Fs(this,"saved",(n,t)=>{this.buffer&&this.set({...this.buffer,baseline:n,version:t,conflict:null})});Fs(this,"setSaveError",n=>{this.saveError=n,this.notify()})}notify(){this.revision++;for(const n of this.listeners)n()}get needsProtection(){return this.saving||this.buffer!==null&&(kl(this.buffer)||this.buffer.conflict!==null)}}function hEt({projectId:e,filePath:n,sessionId:t,enabled:r,autoRun:s=!0,onManualAction:i,ready:a,source:o}){var X,te,I;const l=ct({...Sgt(),enabled:r,subscribed:r}),u=((X=l.data)==null?void 0:X.engine)??(l.isPending?void 0:null),_=((te=l.data)==null?void 0:te.hint)??null,d=((I=l.data)==null?void 0:I.installCommand)??null,[p,m]=R.useState(!1),[x,S]=R.useState(null),[v,b]=R.useState(null),[w,y]=R.useState(!1),[C,E]=R.useState(null),[N,T]=R.useState(null),[z,M]=R.useState(!1),[O,B]=R.useState(0),$=R.useCallback(L=>{M(L),L&&B(F=>F+1)},[]),U=R.useRef(o);U.current=o;const H=R.useRef(!1),Y=R.useRef(null),V=R.useCallback(()=>{if(H.current)return;Y.current=n,H.current=!0,m(!0);const L=U.current;T(null),b(null),E(null),Dut(e,n,{sessionId:t}).then(F=>{var G,ee;const q=F.pdfPath;if(F.ok&&q){S(ce=>({path:q,version:((ce==null?void 0:ce.version)??0)+1,source:L})),y(F.hadErrors),E(F.note),F.hadErrors&&b(((G=F.log)==null?void 0:G.trim())||null),$(!0);return}S(null),y(!1),E(F.note),M(!1),b(((ee=F.log)==null?void 0:ee.trim())||b3e())}).catch(F=>{S(null),y(!1),E(null),M(!1),T(F instanceof Error?F.message:String(F))}).finally(()=>{H.current=!1,m(!1)})},[e,n,t,$]);return R.useEffect(()=>{!r||!s||!a||!u||Y.current!==n&&V()},[r,s,a,u,n,V]),{engine:u,installHint:_,installCommand:d,compiling:p,compiled:x,stale:x!==null&&x.source!==o,log:v,builtWithErrors:w,note:C,error:N,showPdf:z,setShowPdf:$,viewNonce:O,compile:()=>{i==null||i(),V()},dismiss:()=>{T(null),b(null)}}}const _Et=3e4,pEt=3e4,mEt=5*6e4;function gEt({projectId:e,filePath:n,sessionId:t,enabled:r,autoRun:s=!0,onManualAction:i,savedSource:a,dirty:o,onPulled:l}){var oe,ne,Q,le;const u=R.useMemo(()=>Cgt(e,n,{sessionId:t}),[e,n,t]),_=ct({...u,enabled:r,subscribed:r}),d=((oe=_.data)==null?void 0:oe.hasToken)??!1,p=((ne=_.data)==null?void 0:ne.hasSession)??!1,m=((Q=_.data)==null?void 0:Q.link)??null,x=!_.isPending,[S,v]=R.useState(null),[b,w]=R.useState(0),[y,C]=R.useState(!1),[E,N]=R.useState(null),[T,z]=R.useState(null),[M,O]=R.useState(!1),B=R.useCallback(ae=>{Pn(u.queryKey)&&nt.setQueryData(u.queryKey,ue=>ue&&{...ue,hasSession:ae})},[u]),$=R.useCallback(ae=>{Pn(u.queryKey)&&nt.setQueryData(u.queryKey,ae)},[u]);R.useEffect(()=>{N(null),w(0),L.current=!1,z(null),O(!1),V.current=!1},[r,e,n,t]),R.useEffect(()=>{O(!1)},[a]);const U=R.useRef(!1),H=R.useRef(l);H.current=l;const Y=R.useRef(o);Y.current=o;const V=R.useRef(!1),X=R.useCallback(ae=>!d||!m||U.current||Y.current?!1:(U.current=!0,C(!0),z(null),Uut(e,n,{sessionId:t,resolve:ae}).then(ue=>{V.current=!1,N(ue),ue.pulled.includes(n)&&(Y.current?O(!0):H.current(ue.pulled))}).catch(ue=>{V.current=!0,N(null),z(ue instanceof Error?ue.message:String(ue))}).finally(()=>{U.current=!1,C(!1)}),!0),[e,n,t,d,m]),te=R.useRef(null),I=(S==null?void 0:S.state)==="live";R.useEffect(()=>{if(!r||!s||!x||!d||!m||o||I)return;const ae=`${n}:${m.projectId}:${a}`;te.current!==ae&&X()&&(te.current=ae)},[r,s,x,d,m,n,a,o,y,X,I]);const L=R.useRef(!1);!y&&E&&E.conflicts.length===0&&!T&&(L.current=!0);const F=r&&x&&!!m&&d&&p&&L.current,q=R.useRef(null),G=R.useRef(Promise.resolve()),ee=R.useRef(!1);ee.current=(S==null?void 0:S.state)==="stopped"&&S.error!=null;const ce=R.useRef(!1);return R.useEffect(()=>{if(!F)return;let ae=!1;const ue=()=>{const Se=ce.current;ce.current=!1,!(!Se&&ee.current)&&(G.current=G.current.then(()=>{if(!ae)return $ut(e,n,{sessionId:t,retry:Se}).then(ye=>{var qe;ae||((q.current===null||((qe=ye.status)==null?void 0:qe.state)==="stopped")&&v(ye.status),q.current=ye.key)}).catch(ye=>{ae||v({state:"stopped",error:ye instanceof Error?ye.message:String(ye),needsSession:!1,note:null})})}))};ue();const pe=setInterval(ue,pEt);return()=>{ae=!0,clearInterval(pe),q.current=null,v(null),G.current=G.current.then(()=>Put(e,n,{sessionId:t})).catch(()=>{})}},[F,b,e,n,t]),R.useEffect(()=>Jft(ae=>{if(ae.key===q.current){if(ae.type==="live"){v(ae.status);return}ae.paths.includes(n)&&(Y.current?O(!0):H.current(ae.paths))}}),[n]),R.useEffect(()=>{if(!r||!s||!x||!d||!m||o||I)return;const ae=setInterval(()=>{U.current||V.current||nt.fetchQuery({...Egt(e,n,{sessionId:t}),staleTime:0}).then(ue=>{ue.remoteChanged&&X()}).catch(ue=>{V.current=!0,z(ue instanceof Error?ue.message:String(ue))})},_Et);return()=>clearInterval(ae)},[r,s,x,d,m,o,e,n,t,X,I]),R.useEffect(()=>{if(!r||!s||!x||!d||!m||!I)return;const ae=setInterval(X,mEt);return()=>clearInterval(ae)},[r,s,x,d,m,I,X]),{hasToken:d,hasSession:p,live:S,retryLive:()=>{ce.current=!0,w(ae=>ae+1)},link:m,loaded:x,syncing:y,last:E,error:T??((le=_.error)==null?void 0:le.message)??null,blocked:o,staleOnDisk:M,reloaded:()=>O(!1),uploadUrl:Wut(e,n,{sessionId:t}),saveToken:async ae=>{const ue=await DL(ae);te.current=null,V.current=!1,z(null),Pn(u.queryKey)&&nt.setQueryData(u.queryKey,pe=>pe&&{...pe,hasToken:ue.hasToken})},saveSession:async ae=>{const ue=await LL(ae,{host:m==null?void 0:m.host});B(ue.hasSession),ce.current=!0,w(pe=>pe+1)},importSession:async()=>{const ae=await But({host:m==null?void 0:m.host});return B(ae.hasSession),ce.current=!0,w(ue=>ue+1),ae.source},linkProject:async ae=>{N(null),v(null),L.current=!1,te.current=null,$(await Hut(e,n,{project:ae,sessionId:t})),i==null||i()},unlink:async()=>{$(await qut(e,n,{sessionId:t})),te.current=null,V.current=!1,N(null),z(null)},sync:ae=>{V.current=!1,X(ae)&&(te.current=`${n}:${m==null?void 0:m.projectId}:${a}`,i==null||i())}}}function GF(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")}function OA(e,n,t=!1){const r=n.indexOf("#"),s=r===-1?n:n.slice(0,r),i=r===-1?"":n.slice(r),a=s.indexOf("?"),o=a===-1?s:s.slice(0,a),l=a===-1?"":s.slice(a+1);let u;try{u=decodeURI(o)}catch{return null}if(!u||u.includes("\0"))return null;const _=u.startsWith("/"),d=_?[]:e.split("/").filter(Boolean);for(const p of u.split("/"))if(!(!p||p===".")){if(p===".."){if(d.length===0)return null;d.pop();continue}d.push(p)}return d.length===0?null:{path:`${t&&(_||e.startsWith("/"))?"/":""}${d.join("/")}`,query:l,hash:i}}function vEt(e,n){return`${e}${n.query?`&${n.query}`:""}${n.hash}`}const IA=[{selector:"img[src]",attribute:"src",typePrefixes:["image/"]},{selector:"source[src]",attribute:"src",typePrefixes:["image/","audio/","video/"]},{selector:"video[poster]",attribute:"poster",typePrefixes:["image/"]},{selector:"video[src]",attribute:"src",typePrefixes:["video/"]},{selector:"audio[src]",attribute:"src",typePrefixes:["audio/"]},{selector:'link[rel~="stylesheet"][href]',attribute:"href",typePrefixes:["text/css"]},{selector:"script[src]",attribute:"src",typePrefixes:["text/javascript"]}],bEt=4e6,yEt=200,BA=16e6,xEt=e=>new Promise(n=>{const t=new FileReader;t.onload=()=>n(typeof t.result=="string"?t.result:null),t.onerror=()=>n(null),t.readAsDataURL(e)}),$A=e=>e.startsWith("//")?`https:${e}`:e;async function wEt(e,n){var s;let t=bEt;const r=new Map;for(const{element:i,attribute:a,url:o,typePrefixes:l}of e){if(r.has(o)){const x=r.get(o);x&&i.setAttribute(a,x);continue}if(n.aborted)return;if(r.size>=yEt)continue;r.set(o,null);const u=await fetch(o,{signal:n}).catch(()=>null);if(!(u!=null&&u.ok))continue;const _=u.headers.get("content-type")??"",d=Number(u.headers.get("content-length"));if(!l.some(x=>_.startsWith(x))||!(Number.isFinite(d)&&d>0&&d<=t)){await((s=u.body)==null?void 0:s.cancel().catch(()=>{}));continue}const p=await u.blob().catch(()=>null),m=p&&await xEt(p);!p||!m||(t-=p.size,r.set(o,m),i.setAttribute(a,m))}}async function SEt(e,n,t){var a;const r=new DOMParser().parseFromString(e,"text/html"),s=[];for(const o of r.querySelectorAll(IA.map(l=>l.selector).join(", ")))for(const{selector:l,attribute:u,typePrefixes:_}of IA){if(!o.matches(l))continue;const d=o.getAttribute(u);if(!d)continue;const p=n(d);p&&(p===d?o.setAttribute(u,$A(d)):s.push({element:o,attribute:u,url:p,typePrefixes:_}))}await wEt(s,t);for(const o of r.querySelectorAll("a[href]")){const l=o.getAttribute("href");!l||!GF(l)||(o.setAttribute("href",$A(l)),o.setAttribute("target","_blank"),o.setAttribute("rel","noopener noreferrer"))}const i=((a=r.querySelector("base[href]"))==null?void 0:a.getAttribute("href"))??"";if(!/^https?:\/\//i.test(i)){const o=r.createElement("base");o.setAttribute("href","about:srcdoc"),r.head.prepend(o)}return`${r.doctype?``:""}${r.documentElement.outerHTML}`}async function kEt(e,n,t,r){var o;if(!n)return{text:e,partial:!1};const s=await fetch(t,{signal:r,headers:{Range:`bytes=0-${BA-1}`}}).catch(()=>null),i=s!=null&&s.ok?await s.text().catch(()=>null):null;if(i===null)return{text:e,partial:!0};const a=Number((o=s==null?void 0:s.headers.get("content-range"))==null?void 0:o.split("/").pop());return{text:i,partial:Number.isFinite(a)&&a>BA}}function CEt({html:e,truncated:n,url:t,name:r,resolveSrc:s}){const[i,a]=R.useState(null);return R.useEffect(()=>{let o=!1;const l=new AbortController;return a(null),kEt(e,n,t,l.signal).then(async({text:u,partial:_})=>({source:await SEt(u,s,l.signal),partial:_})).then(u=>{o||a(u)}),()=>{o=!0,l.abort()}},[e,n,t,s]),i===null?f.jsxs("div",{className:"file-view-note flex items-center gap-2 py-2.5 px-4 text-sm text-muted",children:[f.jsx(Lt,{})," ",MD()]}):f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.partial&&f.jsx("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2 px-4 text-sm text-muted",children:Zye()}),f.jsx("iframe",{className:"block min-h-0 flex-1 w-full border-0 bg-white",title:n2e({name:Ne(r)}),sandbox:"allow-scripts allow-popups allow-downloads",referrerPolicy:"no-referrer",srcDoc:i.source})]})}function EEt({overleaf:e}){var d;const n=R.useRef(null),{open:t,setOpen:r,ref:s}=ro(n),i=R.useId(),[a,o]=R.useState({top:0,left:0,maxHeight:0}),l=((d=e.last)==null?void 0:d.conflicts.length)??0,u=e.hasToken&&!!e.error,_=u?z4():l?PNe():!e.hasToken||!e.link?oTe():e.syncing?YD():e.blocked?QD():WD();return R.useEffect(()=>{l&&r(!0)},[l,r]),R.useEffect(()=>{u&&Kn(z4(),"error",{id:i,duration:5e3})},[u,e.error,i]),R.useLayoutEffect(()=>{if(!t||!n.current||!s.current)return;const p=n.current.getBoundingClientRect(),m=Math.min(384,window.innerWidth-16),x=Math.min(p.bottom+6,window.innerHeight-80);o({top:x,left:Math.max(8,Math.min(p.right-m,window.innerWidth-m-8)),maxHeight:window.innerHeight-x-8}),(s.current.querySelector("input")??s.current).focus();const S=()=>r(!1),v=b=>{var w;b.target instanceof Node&&!((w=s.current)!=null&&w.contains(b.target))&&S()};return window.addEventListener("resize",S),window.addEventListener("scroll",v,!0),()=>{window.removeEventListener("resize",S),window.removeEventListener("scroll",v,!0)}},[t,s,r]),f.jsxs(f.Fragment,{children:[f.jsx(Qt,{ref:n,size:"small",active:t,disabled:!e.loaded,"data-tip":_,"data-tip-align":"end","aria-label":HQ({status:_}),"aria-haspopup":"dialog","aria-expanded":t,"aria-controls":t?i:void 0,onClick:()=>r(!t),children:e.syncing?f.jsx(Lt,{}):f.jsx(cpt,{size:13,className:u||l?"text-accent-red":e.hasToken&&e.link?"text-accent-green":void 0})}),t&&no.createPortal(f.jsxs("div",{ref:s,id:i,role:"dialog","aria-label":pL(),tabIndex:-1,className:"fixed z-100 w-96 max-w-[calc(100vw-1rem)] overflow-auto rounded-lg border border-border bg-background p-4 text-text shadow-popover",style:a,onBlur:p=>{var m;p.relatedTarget instanceof Node&&!p.currentTarget.contains(p.relatedTarget)&&!((m=n.current)!=null&&m.contains(p.relatedTarget))&&r(!1)},children:[f.jsx("div",{className:"absolute end-3 top-3",children:f.jsx(Qt,{size:"small","aria-label":Dye(),onClick:()=>{var p;r(!1),(p=n.current)==null||p.focus()},children:f.jsx(qr,{size:13})})}),f.jsx(AEt,{overleaf:e})]}),document.body)]})}const s1=e=>Do(new Intl.ListFormat(j()).format(e.map(Ne)));function NEt(e){if(e.error)return lze();if(e.syncing)return YD();if(e.blocked)return QD();const n=e.last;return n?n.pulled.length&&n.pushed.length?Bje({pulled:s1(n.pulled),pushed:s1(n.pushed)}):n.pulled.length?Dje({paths:s1(n.pulled)}):n.pushed.length?Hje({paths:s1(n.pushed)}):n.conflicts.length?$ze():WD():Eje()}function zEt({href:e}){return f.jsx("a",{className:"text-sm text-subtext whitespace-nowrap",href:e,target:"_blank",rel:"noreferrer",children:KD()})}function jEt(e){return e.state==="live"?yze():e.state==="connecting"?mze():e.error??zze()}function PA({overleaf:e,replacing:n}){const[t,r]=R.useState(""),[s,i]=R.useState(!1),[a,o]=R.useState(!1),[l,u]=R.useState(null),_=p=>{s||(i(!0),u(null),p().then(()=>o(!1)).catch(m=>{u(m instanceof Error?m.message:String(m)),o(!0)}).finally(()=>i(!1)))},d=a?_Te():n?Wje():XNe();return f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsx("p",{className:"text-sm text-subtext",children:d}),a&&f.jsx(rs,{className:"basis-full min-w-0","aria-label":N4(),type:"password",value:t,onChange:p=>r(p.target.value),placeholder:N4(),autoComplete:"off"}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s&&f.jsx(Lt,{}),a?f.jsx(Oe,{type:"button",disabled:s||!t.trim(),onClick:()=>_(()=>e.saveSession(t.trim())),children:s?ea():ONe()}):f.jsx(Oe,{type:"button",disabled:s,onClick:()=>_(e.importSession),children:tze()}),f.jsx(Oe,{variant:"ghost",type:"button",disabled:s,onClick:()=>o(!a),children:a?VD():Tje()})]}),l&&f.jsx("div",{role:"alert",className:"text-sm text-accent-red whitespace-pre-wrap break-words",children:l})]})}function TEt({overleaf:e}){if(!e.hasSession)return f.jsx(PA,{overleaf:e});const n=e.live;if(!n)return f.jsx("p",{className:"text-sm text-subtext",children:Rze()});const t=n.state==="stopped"&&n.needsSession,r=n.state==="live"?"bg-accent-green":n.state==="connecting"?"bg-accent-amber":"bg-accent-red";return f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsxs("div",{role:n.error?"alert":"status",className:`flex items-center gap-2 text-sm ${n.error?"text-accent-red":"text-subtext"}`,children:[f.jsx("span",{className:`inline-block w-2 h-2 rounded-full shrink-0 ${r}`}),f.jsx("span",{className:"min-w-0 break-words",children:jEt(n)})]}),n.note&&f.jsx("p",{className:"text-sm text-accent-amber",children:n.note}),n.state==="stopped"&&!t&&f.jsx("div",{children:f.jsx(Oe,{onClick:e.retryLive,children:kze()})}),t&&f.jsx(PA,{overleaf:e,replacing:!0})]})}function AEt({overleaf:e}){var p,m,x;const[n,t]=R.useState(""),[r,s]=R.useState(!1),[i,a]=R.useState(null),[o,l]=R.useState(!1),u=()=>{t(""),a(null),l(!0)},_=!e.hasToken||o;async function d(S){S.preventDefault();const v=n.trim();if(!(r||!v)){s(!0),a(null);try{_?(await e.saveToken(v),l(!1)):await e.linkProject(v),t("")}catch(b){a(b instanceof Error?b.message:String(b))}finally{s(!1)}}}if(e.link&&!_){const S=((p=e.last)==null?void 0:p.conflicts)??[];return f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsxs("div",{className:"space-y-1.5 pe-8",role:e.error?"alert":"status",children:[f.jsxs("div",{className:`flex items-center gap-2 text-sm font-medium ${e.error?"text-accent-red":"text-text"}`,children:[e.syncing&&f.jsx(Lt,{}),e.error?z4():NEt(e)]}),e.error&&f.jsx("p",{className:"text-sm text-text whitespace-pre-wrap break-words",children:e.error})]}),f.jsx(TEt,{overleaf:e}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Oe,{variant:e.error?"primary":"default",disabled:e.syncing||e.blocked,"data-tip":e.blocked?Yje():((m=e.live)==null?void 0:m.state)==="live"?xTe():void 0,onClick:()=>e.sync(),children:e.error?Ui():dje()}),f.jsxs(Hh,{variant:"ghost",href:e.link.url,target:"_blank",rel:"noreferrer",children:[sje()," ",f.jsx(Md,{size:12})]})]}),S.map(v=>f.jsxs("div",{className:"space-y-2 text-sm",children:[f.jsxs("p",{className:"break-words text-accent-red",children:[f.jsx("code",{className:"font-mono",children:v})," ",Yze()]}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx(Oe,{disabled:e.syncing||e.blocked,onClick:()=>e.sync({[v]:"keep-local"}),children:eje()}),f.jsx(Oe,{disabled:e.syncing||e.blocked,onClick:()=>e.sync({[v]:"take-overleaf"}),children:wje()})]})]},v)),((x=e.last)==null?void 0:x.note)&&f.jsx("div",{className:"text-sm text-accent-amber",children:e.last.note}),i&&f.jsx("div",{role:"alert",className:"text-sm text-accent-red whitespace-pre-wrap break-words",children:i}),f.jsxs("details",{className:"border-t border-border pt-3",children:[f.jsx("summary",{className:"cursor-pointer text-sm font-semibold text-text focus-visible:outline-2 focus-visible:outline-text",children:f.jsx("span",{className:"ms-2",children:f6()})}),f.jsxs("div",{className:"mt-2 flex flex-col items-start gap-1",children:[f.jsx(Oe,{variant:"ghost",className:"font-normal",type:"button",onClick:u,children:pN()}),f.jsx(Hh,{variant:"ghost",className:"font-normal",href:e.uploadUrl,target:"_blank",rel:"noreferrer",children:KD()}),f.jsx(Oe,{variant:"ghost",className:"font-normal",disabled:e.syncing,onClick:()=>void e.unlink().catch(v=>{a(v instanceof Error?v.message:String(v))}),children:pje()})]})]})]})}return f.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:d,children:[f.jsx("div",{className:"pe-8 text-sm text-subtext",children:_?zTe():RTe()}),f.jsxs("div",{className:"flex items-center flex-wrap gap-2",children:[f.jsx(rs,{className:"basis-full min-w-0","aria-label":_?hN():_N(),"aria-invalid":!!i,type:_?"password":"text",value:n,onChange:S=>t(S.target.value),placeholder:_?hN():"https://www.overleaf.com/project/…",autoComplete:"off"}),f.jsx(Oe,{type:"submit",disabled:r||!n.trim(),children:r?_?ea():Yi():_?rTe():fze()}),f.jsx("a",{className:"text-sm text-subtext whitespace-nowrap",href:_?"https://www.overleaf.com/user/settings":"https://www.overleaf.com/project",target:"_blank",rel:"noreferrer",children:_?UNe():_N()})]}),(i||e.error)&&f.jsx("div",{role:"alert",className:"text-sm text-accent-red whitespace-pre-wrap break-words",children:i||e.error}),f.jsxs("div",{className:"flex items-center flex-wrap gap-3",children:[f.jsx(zEt,{href:e.uploadUrl}),o?f.jsx(Oe,{variant:"ghost",type:"button",onClick:()=>l(!1),children:VD()}):e.hasToken&&f.jsx(Oe,{variant:"ghost",type:"button",onClick:u,children:pN()})]})]})}function REt({command:e}){const[n,t]=R.useState("idle"),r=R.useRef(null),s=async()=>{try{await navigator.clipboard.writeText(e),t("copied"),setTimeout(()=>t("idle"),1500)}catch{const i=r.current;if(i){const a=document.createRange();a.selectNodeContents(i);const o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(a)}t("select"),setTimeout(()=>t("idle"),4e3)}};return f.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[f.jsx("code",{ref:r,className:"font-mono text-xs text-text bg-panel border border-border-variant rounded-xs py-1 px-2",children:e}),f.jsx(Qt,{"data-tip":n==="copied"?tp():n==="select"?fxe():lye(),"aria-label":fye(),onClick:()=>void s(),children:n==="copied"?f.jsx(Na,{size:13}):f.jsx(cb,{size:13})})]})}function MEt({projectId:e,path:n,source:t="repo",sessionId:r,gitRef:s,line:i,branchLabel:a,onOpenFile:o,scrollPosition:l,onScrollPositionChange:u,lineScrollRequest:_,onLineScrollRequestHandled:d,onEdit:p,artifactVersion:m,artifactEntries:x=[],bufferSession:S,remote:v=!1,restored:b=!1,onRestoreActivated:w,showSource:y=!1,onShowSourceChange:C}){var pt,kt;const E=mI(e,n,t??"repo",r,s),N=ct({...E,enabled:!S.saving}),T=N.data??null,z=((pt=N.error)==null?void 0:pt.message)??null,M=Ge=>{Gr(E.queryKey,mt=>(typeof Ge=="function"?Ge(mt??null):Ge)??void 0)},[O,B]=R.useState(0),$=t==="artifacts",U=t==="abs",H=yk(n),Y=kF(n),V=R9t(n),X=H||V,[te,I]=R.useState(!1),L=!b||te,F=()=>{I(!0),w==null||w()};R.useSyncExternalStore(S.subscribe,S.getRevision);const q=S.getSnapshot(),G=S.set,ee=S.saving,ce=S.setSaving,oe=S.saveRevision,ne=S.saveError,Q=S.setSaveError,le=R.useRef(null),ae=R.useRef(l),ue=(T==null?void 0:T.file)??null,pe=q&&kl(q)?q.path:(T==null?void 0:T.source)==="checkout"?T.file.path:n,Se=pe.split("/").slice(0,-1).join("/"),ye=(T==null?void 0:T.source)==="artifact",qe=R.useCallback(Ge=>{var mt;return((mt=OA(Se,Ge,U))==null?void 0:mt.path)??null},[U,Se]),Ie=R.useCallback(Ge=>U?jut(Ge):ye?Ph(e,Ge):ON(e,Ge,{sessionId:r,ref:s}),[ye,s,U,e,r]),ze=R.useCallback(Ge=>{if(GF(Ge))return Ge;const mt=OA(Se,Ge,U);return mt?vEt(Ie(mt.path),mt):null},[U,Se,Ie]),at=AF(ue==null?void 0:ue.presentation),bt=(T==null?void 0:T.source)==="artifact"&&!$,$t=$&&(T==null?void 0:T.source)==="checkout",Pt=!s&&(T==null?void 0:T.source)==="checkout"&&ue!=null&&!ue.notFound,zt=r!=null&&(T==null?void 0:T.source)==="checkout"&&T.file.root==="clone",ot=Pt&&ue!=null&&!ue.binary&&!ue.truncated&&!at&&!zt,ft=ot&&ue.version===void 0,It=q!==null&&kl(q),we=!ft&&(ot&&typeof ue.version=="string"||It),Re=(q==null?void 0:q.draft)??u5((ue==null?void 0:ue.content)??""),Ze=(q==null?void 0:q.baseline)??u5((ue==null?void 0:ue.content)??""),ht=we&&q!==null&&kl(q),xt=async Ge=>{const mt=S.getSnapshot();if(!we||!mt||!kl(mt))return!0;if(S.saving)return!1;if(mt.conflict&&Ge===void 0)return Q(mt.conflict.exists?PE():HE()),!1;const fr=mt.draft,cn=uEt(mt);ce(!0),Q(null);try{await nt.cancelQueries(E);const qt=await Tut(e,pe,cn,{sessionId:r,expectedVersion:Ge??mt.version});return S.getSnapshot()?(S.saved(fr,qt.version),M(Ln=>Ln&&Ln.source==="checkout"?{source:"checkout",file:{...Ln.file,content:cn,version:qt.version}}:Ln),!0):!1}catch(qt){if(qt instanceof R4){const er=S.getSnapshot();return!er||!kl(er)||G({...er,conflict:{currentVersion:qt.currentVersion,exists:qt.exists}}),!1}return Q(qt instanceof Error?qt.message:String(qt)),!1}finally{ce(!1)}},Vt=Y&&Pt&&!zt,Ve=hEt({projectId:e,filePath:pe,sessionId:r,enabled:Vt,autoRun:L,onManualAction:F,ready:ue!=null&&!ue.notFound,source:we?Re:(ue==null?void 0:ue.content)??""}),Ht=gEt({projectId:e,filePath:pe,sessionId:r,enabled:Vt,autoRun:L,onManualAction:F,savedSource:Ze,dirty:ht,onPulled:R.useCallback(Ge=>{Ge.includes(pe)&&B(mt=>mt+1)},[pe])}),sn=Y&&Ve.showPdf&&Ve.compiled!=null,fn=ft&&It,Zt=(we||fn)&&!(X&&!y)&&!sn,Qn=Ve.compiled?`${ON(e,Ve.compiled.path,{sessionId:r})}&v=${Ve.compiled.version}`:null,Jt=Qn?`${Qn}&view=${Ve.viewNonce}#toolbar=0&navpanes=0&statusbar=0`:null,bn=Ve.compiled?Ve.compiled.path.split("/").pop()??Ve.compiled.path:null,or=async()=>{ht&&!await xt()||Y&&Ve.engine&&Ve.compile()},lr=async()=>{ht&&(L?await or():await xt())},[br,Dn]=R.useState(!1),[Wr,Nr]=R.useState(null),vt=async()=>{Dn(!0),Nr(null);try{await Rut(e,pe,{sessionId:r})}catch(Ge){Nr(Ge instanceof Error?Ge.message:String(Ge))}finally{Dn(!1)}},un=R.useCallback(()=>{S.saving||B(Ge=>Ge+1)},[S]),Cn=()=>{G(null),Q(null),un()},en=RF(Ie(pe),!s&&!ee);R.useEffect(()=>{if(!z||s)return;const Ge=window.setInterval(()=>{document.visibilityState!=="hidden"&&un()},2e3);return()=>window.clearInterval(Ge)},[z,s,un]);const Jn=`${Ie(pe)}&v=${encodeURIComponent(en??m??"")}&reload=${O}`;R.useEffect(()=>{var fr,cn;if(!T||S.saving)return;const Ge=T,mt=S.getSnapshot();if(mt&&kl(mt)){const qt=Ge.source==="checkout"?Ge.file:null,er=qt!==null&&qt.path===mt.path&&(!r||qt.root==="worktree"),Ln=dEt(mt,er&&typeof qt.version=="string"?qt.version:null,er&&!qt.notFound);Ln&&(Ln.currentVersion!==((fr=mt.conflict)==null?void 0:fr.currentVersion)||Ln.exists!==((cn=mt.conflict)==null?void 0:cn.exists))?G({...mt,conflict:Ln}):!Ln&&mt.conflict&&G({...mt,conflict:null})}(!mt||!kl(mt))&&Ge.source==="checkout"&&!Ge.file.notFound&&!Ge.file.binary&&!Ge.file.truncated&&typeof Ge.file.version=="string"&&(G(LA(Ge.file.path,Ge.file.content,Ge.file.version)),Q(null))},[T,S,r,ee,oe]);const hn=JSON.stringify(E.queryKey),En=R.useRef({sourceKey:hn,nonce:O,artifactVersion:m,diskVersion:en});R.useEffect(()=>{const Ge=En.current;En.current={sourceKey:hn,nonce:O,artifactVersion:m,diskVersion:en},Ge.sourceKey===hn&&(Ge.nonce!==O||Ge.diskVersion!==null&&Ge.diskVersion!==en||Ge.artifactVersion!=null&&Ge.artifactVersion!==m)&&Ngt(e,n,t??"repo",r,s)},[hn,O,m,en,e,n,t,r,s]),R.useLayoutEffect(()=>{const Ge=le.current,mt=ae.current;!Ge||!ue||!mt||(Ge.scrollTop=mt.top,Ge.scrollLeft=mt.left)},[ue]);const ln=Ge=>{if(Ge.source==="absolute")return x2e();if($)return h2e({root:r?zg():Ng()});if(s)return g2e({branch:Ne(s)});if(r&&Ge.source==="checkout"&&Ge.file.root==="clone")return Fxe();const mt=Ge.source==="checkout"?Ge.file.root:Ge.checkoutRoot;return C2e({root:mt==="worktree"?zg():Ng()})};return f.jsxs("div",{className:"file-view flex flex-col h-full min-h-0 min-w-0",children:[f.jsxs("div",{className:"file-view-header flex w-full min-w-0 min-h-9 items-center gap-1 px-4 py-1 bg-background text-text shrink-0",children:[f.jsx(Zh,{name:pe}),f.jsx("span",{className:"file-view-path flex-1 min-w-0 truncate text-sm text-subtext","data-tip":Ne(pe),children:pe.split("/").pop()||pe}),a&&f.jsxs("span",{className:"file-view-branch inline-flex items-center gap-1 min-w-0 text-xs text-muted border border-border-variant rounded-sm py-px px-1.5 max-w-65 overflow-hidden text-ellipsis whitespace-nowrap shrink-0 [&_svg]:flex-none",title:gK({branch:Ne(a)}),children:[f.jsx(Jp,{size:11}),a]}),Zt&&(ee||ht||ne)&&f.jsx("span",{className:`file-view-save-status inline-flex items-center gap-1 text-sm shrink-0 ${ne?"text-accent-red":"text-muted"}`,title:ne??(ee?ea():Mxe()),children:ee?f.jsxs(f.Fragment,{children:[f.jsx(Lt,{})," ",lxe()]}):ne?sxe():DD()}),Y&&Ve.compiled&&f.jsx(Qt,{size:"small",active:!Ve.showPdf,"data-tip":Ve.stale&&Ve.showPdf?U2e():Ve.showPdf?nh():VE(),"data-tip-align":"end","aria-label":Ve.showPdf?nh():VE(),onClick:()=>Ve.setShowPdf(!Ve.showPdf),children:Ve.showPdf?f.jsx(Z4,{size:13}):f.jsx(ub,{size:13,className:Ve.stale?"text-accent-amber":void 0})}),Y&&Qn&&bn&&f.jsx(rb,{size:"small","data-tip":Ve.stale?Fye({name:Ne(bn)}):eE({name:Ne(bn)}),"data-tip-align":"end","aria-label":eE({name:Ne(bn)}),href:Qn,download:bn,children:f.jsx(ppt,{size:13,className:Ve.stale?"text-accent-amber":void 0})}),Vt&&f.jsx(EEt,{overleaf:Ht}),Y&&Pt&&f.jsx(Qt,{size:"small","data-tip":Ve.compiled?WE():FE(),"data-tip-align":"end","aria-label":Ve.compiled?WE():FE(),disabled:Ve.compiling||!Ve.engine,onClick:()=>void or(),children:Ve.compiling?f.jsx(Lt,{}):f.jsx(ypt,{size:13})}),X&&f.jsx(Qt,{size:"small",active:y,"data-tip":y?tv():nh(),"data-tip-align":"end","aria-label":y?tv():nh(),onClick:()=>C==null?void 0:C(!y),children:f.jsx(Z4,{size:13})}),Pt&&!v&&f.jsx(Qt,{size:"small","data-tip":Wr??GE(),"data-tip-align":"end","aria-label":GE(),disabled:br,onClick:()=>void vt(),children:br?f.jsx(Lt,{}):f.jsx(Md,{size:13})})]}),!z&&$t&&(T==null?void 0:T.source)==="checkout"&&f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted border-b border-b-border-variant shrink-0",children:j2e({root:T.file.root==="worktree"?zg():Ng()})}),ft&&f.jsx("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2.5 px-4 text-sm text-accent-amber",children:Ixe()}),z&&ue!==null&&f.jsxs("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2.5 px-4 text-sm text-accent-red",children:[UE()," ",Ne(z)]}),(q==null?void 0:q.conflict)&&f.jsxs("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2.5 px-4 flex items-center flex-wrap gap-2 text-sm text-accent-amber",children:[f.jsx("span",{className:"flex-1 min-w-0",role:"status",children:q.conflict.exists?PE():HE()}),((kt=q==null?void 0:q.conflict)==null?void 0:kt.exists)&&q.conflict.currentVersion&&f.jsx(Oe,{disabled:ee,onPointerDown:Ge=>Ge.preventDefault(),onClick:()=>{var Ge;return void xt(((Ge=q.conflict)==null?void 0:Ge.currentVersion)??void 0)},children:P2e()}),f.jsx(Oe,{disabled:ee,onPointerDown:Ge=>Ge.preventDefault(),onClick:Cn,children:exe()})]}),(Ve.error||Ve.log)&&f.jsxs("div",{className:"file-view-note shrink-0 max-h-45 overflow-auto border-b border-b-border-variant py-2.5 px-4",children:[f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx("span",{className:`flex-1 min-w-0 text-sm ${Ve.builtWithErrors?"text-subtext":"text-accent-red"}`,children:Ve.error??(Ve.builtWithErrors?sye():Xbe())}),f.jsx(Qt,{"data-tip":Eye(),"data-tip-align":"end","aria-label":Tye(),onClick:Ve.dismiss,children:f.jsx(qr,{size:13})})]}),Ve.log&&f.jsx("pre",{className:"mt-1.5 mb-0 font-mono text-xs text-subtext whitespace-pre-wrap wrap-anywhere",children:Ve.log})]}),Vt&&Ht.staleOnDisk&&f.jsxs("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2.5 px-4 flex items-center flex-wrap gap-2 text-sm text-accent-amber",children:[f.jsx("span",{className:"flex-1 min-w-0",children:O2e()}),f.jsx(Oe,{onClick:()=>{Ht.reloaded(),B(Ge=>Ge+1)},children:bye()})]}),Y&&Pt&&Ve.engine===null&&Ve.installHint&&f.jsxs("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2.5 px-4 text-sm text-subtext",children:[Ve.installHint,Ve.installCommand&&f.jsx(REt,{command:Ve.installCommand})]}),Ve.note&&f.jsx("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2 px-4 text-sm text-accent-amber",children:Ve.note}),sn&&Ve.stale&&f.jsx("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2 px-4 text-sm text-subtext",children:wxe()}),f.jsxs("div",{ref:le,className:"file-view-body flex-1 min-h-0 overflow-auto bg-background",onScroll:Ge=>{const mt={top:Math.max(0,Ge.currentTarget.scrollTop),left:Math.max(0,Ge.currentTarget.scrollLeft)};ae.current=mt,u==null||u(mt)},children:[!Zt&&!z&&!$&&(T==null?void 0:T.source)==="checkout"&&!T.file.notFound&&!s&&r&&T.file.root==="clone"&&f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:Exe()}),!Zt&&!z&&(T==null?void 0:T.source)==="artifact"&&!T.file.notFound&&bt&&f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:Pbe({root:T.checkoutRoot==="worktree"?zg():Ng()})}),z&&ue===null?f.jsxs("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:[UE()," ",Ne(z)]}):ue===null?f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:MD()}):Zt?f.jsx(VP,{value:Re,onChange:Ge=>{const mt=S.getSnapshot()??(ue&&typeof ue.version=="string"?LA(ue.path,ue.content,ue.version):null);mt&&G(cEt(mt,Ge)),p==null||p(),ne&&Q(null)},onSave:()=>void lr(),onBlur:()=>{c5||lr()},readOnly:fn,path:n,highlightLine:i,scrollRequest:_,onScrollRequestHandled:d,scrollPosition:ae.current,onScrollPositionChange:Ge=>{ae.current=Ge,u==null||u(Ge)}}):ue.notFound?f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:T?ln(T):c2e()}):at?f.jsx(l5,{kind:at,url:Jn,name:n.split("/").pop()??n}):ue.binary?f.jsxs("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:[Ube()," ",f.jsx("a",{href:Jn,download:n.split("/").pop()??n,children:RD()})]}):sn&&Jt&&bn?f.jsx(l5,{kind:"pdf",url:Jt,name:bn,downloadBar:!1},Jt):H&&!y?f.jsx("div",{className:"file-view-md max-w-readable pt-4.5 px-5 pb-8 [&_.md]:text-base [&_.md_h1]:text-2xl [&_.md_h1]:mt-4.5 [&_.md_h1]:mx-0 [&_.md_h1]:mb-2 [&_.md_h2]:text-xl [&_.md_h2]:mt-4 [&_.md_h2]:mx-0 [&_.md_h2]:mb-2 [&_.md_h3]:text-lg",children:ye?f.jsx(IF,{projectId:e,folder:Se,markdown:ue.content,entries:x}):f.jsx($o,{text:ue.content,resolveFilePath:qe,resolveImageSrc:ze,onOpenFile:o&&((Ge,mt,fr,cn,qt)=>o(Ge,r,s,qt))})}):V&&!y?f.jsx(CEt,{html:ue.content,truncated:ue.truncated,url:Jn,name:pe,resolveSrc:ze}):f.jsxs(f.Fragment,{children:[f.jsx(TF,{text:ue.content,path:n,highlightLine:i,scrollRequest:_,onScrollRequestHandled:d}),ue.truncated&&f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:Kye()})]})]})]})}const Bw=["project-menu-label inline-flex items-center gap-2 min-w-0 overflow-hidden","text-ellipsis whitespace-nowrap"].join(" ");function DEt({projectName:e,onHome:n,onNewProject:t,onRepository:r,onCollapse:s}){const{open:i,setOpen:a,ref:o}=ro(),l=R.useRef(null);return R.useEffect(()=>{if(!i)return;const u=_=>{var d;_.key==="Escape"&&((d=l.current)==null||d.focus())};return document.addEventListener("keydown",u,!0),()=>document.removeEventListener("keydown",u,!0)},[i]),f.jsx("div",{className:"rail-brand px-3 py-1.5 border-b border-border shrink-0",children:f.jsxs("div",{className:"project-switcher relative min-w-0",ref:o,children:[f.jsxs("div",{className:"flex h-7 items-center justify-between gap-1 px-0.5",children:[f.jsx(Qt,{size:"small",className:"project-back text-text","aria-label":KE(),onClick:n,children:f.jsx(ap,{size:18})}),f.jsx("span",{className:"brand-project-label flex-1 text-xs font-medium tracking-wide uppercase text-subtext",children:c4e()}),s&&f.jsx(Qt,{size:"small","data-tip":QE(),"data-tip-align":"end","aria-label":QE(),onClick:s,children:f.jsx(KO,{size:18})})]}),f.jsxs("button",{ref:l,className:`brand group flex h-8 w-full min-w-0 items-center gap-2 rounded-md px-2 text-start text-text hover:bg-surface focus-visible:outline-2 focus-visible:outline-text ${i?"open bg-surface":""}`,onClick:()=>a(u=>!u),"aria-expanded":i,children:[f.jsx("span",{className:"brand-project min-w-0 flex-1 truncate text-xl font-semibold",children:e}),f.jsx(qo,{className:`project-chevron shrink-0 text-muted transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100 ${i?"rotate-180 opacity-100":"opacity-0"}`,size:14})]}),i&&f.jsxs("div",{className:"option-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-95 flex flex-col bg-background border border-border rounded-lg shadow-menu overflow-hidden min-w-47.5 p-1.5 [&.align-right]:start-auto [&.align-right]:end-0 [&.drop-down]:bottom-auto [&.drop-down]:top-[calc(100%_+_4px)] [&.session-menu]:start-auto [&.session-menu]:end-1.5 [&.session-menu]:top-[calc(100%_-_2px)] [&.session-menu]:min-w-35 drop-down project-menu w-52.5 z-70",children:[f.jsx(sr,{onClick:()=>{a(!1),r()},children:f.jsxs("span",{className:Bw,children:[f.jsx(UO,{size:14}),Zwe()]})}),f.jsx(sr,{onClick:()=>{a(!1),n()},children:f.jsxs("span",{className:Bw,children:[f.jsx(Bpt,{size:14}),KE()]})}),f.jsx(sr,{onClick:()=>{var u;(u=l.current)==null||u.focus(),a(!1),t()},children:f.jsxs("span",{className:Bw,children:[f.jsx(Ept,{size:14}),n4e()]})})]})]})})}function LEt({runs:e,experiments:n,emptyHint:t,onOpen:r,onOpenLogs:s,onOpenCode:i,onCancel:a}){const[o,l]=R.useState(new Set),[u,_]=R.useState(null),d=new Map;for(const x of e){const S=d.get(x.experimentId);S?S.push(x):d.set(x.experimentId,[x])}for(const x of d.values())x.sort((S,v)=>v.createdAt-S.createdAt);const p=[...n].sort((x,S)=>{var w,y,C,E;const v=((y=(w=d.get(x.id))==null?void 0:w[0])==null?void 0:y.createdAt)??x.createdAt;return(((E=(C=d.get(S.id))==null?void 0:C[0])==null?void 0:E.createdAt)??S.createdAt)-v});if(p.length===0)return f.jsx(wk,{icon:db,title:t??Nve(),description:t?void 0:bve()});async function m(x){_(null),l(S=>new Set(S).add(x));try{await a(x)}catch(S){l(v=>{const b=new Set(v);return b.delete(x),b}),_(S instanceof Error?S.message:String(S))}}return f.jsxs("div",{className:"experiments-table-wrap absolute inset-0 overflow-auto bg-background @container",children:[u&&f.jsxs("div",{className:"experiments-table-error py-2 px-3 text-accent-red text-sm border-b border-b-border",role:"alert",children:[hbe()," ",u]}),f.jsx("div",{className:"experiments-table w-full text-sm bg-background",role:"list","aria-label":ibe(),children:p.map(x=>{const S=d.get(x.id)??[],v=S[0]??null,b=S.find(E=>E.status==="running"||E.status==="starting"),w=b??v,y=!!(b&&(b.cancelRequested||o.has(b.id))),C=b?y?"cancelling":Gi(b):v?Gi(v):"idle";return f.jsxs("div",{className:"experiment-table-group grid grid-cols-[minmax(0,_1fr)_auto] [grid-template-areas:'name_meta'_'actions_actions'] gap-x-8 items-center py-4 px-5 gap-y-[7px] border-b border-b-divider-subtle bg-background cursor-pointer [&:hover]:bg-canvas [&:last-child]:border-b-0 [@container((max-width:_560px))]:grid-cols-[minmax(0,_1fr)_auto] [@container((max-width:_560px))]:gap-x-3.5 [@container((max-width:_560px))]:gap-y-[9px] [@container((max-width:_400px))]:grid-cols-[minmax(0,_1fr)] [@container((max-width:_400px))]:[grid-template-areas:'name'_'meta'_'actions']",role:"listitem",onClick:()=>r(x,"preview"),onDoubleClick:()=>r(x,"keepOpen"),onAuxClick:E=>{E.button===1&&(E.preventDefault(),r(x,"keepOpen"))},children:[f.jsxs("div",{className:"experiment-table-name [grid-area:name] self-start min-w-0",children:[f.jsx("button",{type:"button",className:"experiment-table-title block w-full overflow-hidden text-text font-semibold text-start text-ellipsis whitespace-nowrap",...Ur(E=>r(x,E),{stopPropagation:!0}),children:x.title||x.slug}),f.jsxs("span",{className:"experiment-table-subtitle flex items-center min-w-0 gap-1.5 mt-1 overflow-hidden text-subtext text-sm [&_>_svg]:shrink-0 [&_code]:min-w-0 [&_code]:overflow-hidden [&_code]:text-ellipsis [&_code]:whitespace-nowrap",title:x.branchName,children:[f.jsx(Jp,{size:14,"aria-hidden":"true"}),f.jsx("code",{children:x.branchName})]})]}),f.jsxs("div",{className:"experiment-table-meta [grid-area:meta] self-start flex items-center justify-end gap-4.5 whitespace-nowrap [@container((max-width:_560px))]:flex-col [@container((max-width:_560px))]:items-end [@container((max-width:_560px))]:gap-1.5 [@container((max-width:_400px))]:!flex-row [@container((max-width:_400px))]:!items-center [@container((max-width:_400px))]:flex-wrap [@container((max-width:_400px))]:justify-start [@container((max-width:_400px))]:gap-3",children:[f.jsx("div",{className:"experiment-table-status flex items-center min-w-0",children:f.jsx($l,{status:C})}),f.jsx("div",{className:"experiment-run-summary flex items-center min-w-0 gap-2 text-subtext text-sm font-medium",children:f.jsx("span",{children:S.length===1?Lve():qve({count:Wt(S.length)})})}),f.jsx("div",{className:"experiment-table-latest flex items-center gap-1.5 min-w-0 text-subtext text-sm font-medium whitespace-nowrap",children:f.jsx("span",{children:v?Io(v.createdAt):Ave()})})]}),f.jsxs("div",{className:"experiment-table-actions [grid-area:actions] flex flex-wrap items-center justify-start gap-2 mt-3",role:"group","aria-label":cK({name:x.title||x.slug}),onClick:E=>E.stopPropagation(),onDoubleClick:E=>E.stopPropagation(),onAuxClick:E=>E.stopPropagation(),children:[f.jsxs(Oe,{size:"small",disabled:!w,title:w?$ve():Sve(),...Ur(E=>{w&&s(x.id,w.id,E)},{stopPropagation:!0}),children:[f.jsx(qh,{size:15}),cbe()]}),f.jsxs(Oe,{size:"small",title:fD({branch:Ne(x.branchName)}),...Ur(E=>i(x.id,E),{stopPropagation:!0}),children:[f.jsx(fb,{size:15}),tbe()]}),b&&f.jsxs(Oe,{size:"small",variant:"danger",className:"[@container((max-width:_560px))]:ms-auto",disabled:y,title:y?Vve():Xve(),onClick:()=>void m(b.id),children:[f.jsx($O,{size:15}),y?Tpe():jD()]})]})]},x.id)})})]})}function OEt({onClose:e,onCreateProject:n}){const[t,r]=R.useState(!1),[s,i]=R.useState(null),a=R.useRef(null),o=R.useCallback(l=>{t||(r(!0),i(null),l().catch(()=>i(Fat())).finally(()=>r(!1)))},[t]);return R.useEffect(()=>{const l=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),o(e))};return document.addEventListener("keydown",l,!0),()=>document.removeEventListener("keydown",l,!0)},[e,o]),R.useEffect(()=>{const l=a.current;if(!l)return;const u=document.activeElement instanceof HTMLElement?document.activeElement:null,_=()=>[...l.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])')];(_()[0]??l).focus();const d=p=>{if(p.key!=="Tab")return;const m=_();if(m.length===0){p.preventDefault(),l.focus();return}const x=m[0],S=m[m.length-1];p.shiftKey&&document.activeElement===x?(p.preventDefault(),S.focus()):!p.shiftKey&&document.activeElement===S&&(p.preventDefault(),x.focus())};return document.addEventListener("keydown",d,!0),()=>{document.removeEventListener("keydown",d,!0),u==null||u.focus()}},[]),no.createPortal(f.jsx("div",{className:"fixed inset-0 z-200 flex items-center justify-center bg-modal-backdrop p-5",children:f.jsxs("div",{ref:a,className:"relative w-110 max-w-full rounded-xl border border-border bg-background p-6 shadow-modal",role:"dialog","aria-modal":"true","aria-labelledby":"demo-welcome-title",tabIndex:-1,children:[f.jsx(Qt,{className:"absolute end-3.5 top-3.5","aria-label":gat(),onClick:()=>o(e),disabled:t,children:f.jsx(qr,{size:16})}),f.jsxs("div",{className:"mb-5 flex items-center gap-3 pe-8",children:[f.jsx("span",{className:"block h-9 w-9 shrink-0 [&_svg]:block [&_svg]:h-full [&_svg]:w-full",children:f.jsx(B6,{})}),f.jsxs("div",{children:[f.jsx("div",{className:"mb-0.5 text-xs font-medium tracking-[0.08em] text-primary uppercase",children:Cat()}),f.jsx("h2",{id:"demo-welcome-title",className:"m-0 text-2xl leading-tight tracking-[-0.02em]",children:Qat()})]})]}),f.jsxs("div",{className:"text-base leading-relaxed text-text [&_p]:m-0 [&_p_+_p]:mt-3",children:[f.jsxs("p",{dir:"auto",children:[Gat()," ",f.jsx("a",{dir:"ltr",href:"https://github.com/karpathy/nanochat",target:"_blank",rel:"noreferrer",className:"font-medium text-primary underline decoration-border-strong underline-offset-3 hover:decoration-primary",children:Iat()}),hat()]}),f.jsx("p",{dir:"auto",children:Mat()})]}),s&&f.jsx("p",{className:"mt-3 mb-0 text-sm text-accent-red",children:s}),f.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-end gap-2.5",children:[f.jsx(Oe,{onClick:()=>o(n),disabled:t,children:xat()}),f.jsx(Oe,{variant:"primary",onClick:()=>o(e),disabled:t,children:t?ea():jat()})]})]})}),document.body)}function as(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let t=0,r;t{}};function ty(){for(var e=0,n=arguments.length,t={},r;e=0&&(r=t.slice(s+1),t=t.slice(0,s)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}})}L1.prototype=ty.prototype={constructor:L1,on:function(e,n){var t=this._,r=BEt(e+"",t),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var t=new Array(s),r=0,s,i;r=0&&(n=e.slice(0,t))!=="xmlns"&&(e=e.slice(t+1)),HA.hasOwnProperty(n)?{space:HA[n],local:e}:e}function PEt(e){return function(){var n=this.ownerDocument,t=this.namespaceURI;return t===d5&&n.documentElement.namespaceURI===d5?n.createElement(e):n.createElementNS(t,e)}}function FEt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function WF(e){var n=ny(e);return(n.local?FEt:PEt)(n)}function HEt(){}function Sk(e){return e==null?HEt:function(){return this.querySelector(e)}}function qEt(e){typeof e!="function"&&(e=Sk(e));for(var n=this._groups,t=n.length,r=new Array(t),s=0;s=y&&(y=w+1);!(E=v[y])&&++y=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function _Nt(e){e||(e=pNt);function n(d,p){return d&&p?e(d.__data__,p.__data__):!d-!p}for(var t=this._groups,r=t.length,s=new Array(r),i=0;in?1:e>=n?0:NaN}function mNt(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function gNt(){return Array.from(this)}function vNt(){for(var e=this._groups,n=0,t=e.length;n1?this.each((n==null?jNt:typeof n=="function"?ANt:TNt)(e,n,t??"")):Jh(this.node(),e)}function Jh(e,n){return e.style.getPropertyValue(n)||XF(e).getComputedStyle(e,null).getPropertyValue(n)}function MNt(e){return function(){delete this[e]}}function DNt(e,n){return function(){this[e]=n}}function LNt(e,n){return function(){var t=n.apply(this,arguments);t==null?delete this[e]:this[e]=t}}function ONt(e,n){return arguments.length>1?this.each((n==null?MNt:typeof n=="function"?LNt:DNt)(e,n)):this.node()[e]}function ZF(e){return e.trim().split(/^|\s+/)}function kk(e){return e.classList||new JF(e)}function JF(e){this._node=e,this._names=ZF(e.getAttribute("class")||"")}JF.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function eH(e,n){for(var t=kk(e),r=-1,s=n.length;++r=0&&(t=n.slice(r+1),n=n.slice(0,r)),{type:n,name:t}})}function uzt(e){return function(){var n=this.__on;if(n){for(var t=0,r=-1,s=n.length,i;t()=>e;function f5(e,{sourceEvent:n,subject:t,target:r,identifier:s,active:i,x:a,y:o,dx:l,dy:u,dispatch:_}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:_}})}f5.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yzt(e){return!e.ctrlKey&&!e.button}function xzt(){return this.parentNode}function wzt(e,n){return n??{x:e.x,y:e.y}}function Szt(){return navigator.maxTouchPoints||"ontouchstart"in this}function aH(){var e=yzt,n=xzt,t=wzt,r=Szt,s={},i=ty("start","drag","end"),a=0,o,l,u,_,d=0;function p(C){C.on("mousedown.drag",m).filter(r).on("touchstart.drag",v).on("touchmove.drag",b,bzt).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(C,E){if(!(_||!e.call(this,C,E))){var N=y(this,n.call(this,C,E),C,E,"mouse");N&&(Fi(C.view).on("mousemove.drag",x,wp).on("mouseup.drag",S,wp),sH(C.view),$w(C),u=!1,o=C.clientX,l=C.clientY,N("start",C))}}function x(C){if(mh(C),!u){var E=C.clientX-o,N=C.clientY-l;u=E*E+N*N>d}s.mouse("drag",C)}function S(C){Fi(C.view).on("mousemove.drag mouseup.drag",null),iH(C.view,u),mh(C),s.mouse("end",C)}function v(C,E){if(e.call(this,C,E)){var N=C.changedTouches,T=n.call(this,C,E),z=N.length,M,O;for(M=0;M>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):t===8?a1(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):t===4?a1(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=Czt.exec(e))?new Ci(n[1],n[2],n[3],1):(n=Ezt.exec(e))?new Ci(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=Nzt.exec(e))?a1(n[1],n[2],n[3],n[4]):(n=zzt.exec(e))?a1(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=jzt.exec(e))?QA(n[1],n[2]/100,n[3]/100,1):(n=Tzt.exec(e))?QA(n[1],n[2]/100,n[3]/100,n[4]):qA.hasOwnProperty(e)?WA(qA[e]):e==="transparent"?new Ci(NaN,NaN,NaN,0):null}function WA(e){return new Ci(e>>16&255,e>>8&255,e&255,1)}function a1(e,n,t,r){return r<=0&&(e=n=t=NaN),new Ci(e,n,t,r)}function Mzt(e){return e instanceof hm||(e=Pd(e)),e?(e=e.rgb(),new Ci(e.r,e.g,e.b,e.opacity)):new Ci}function h5(e,n,t,r){return arguments.length===1?Mzt(e):new Ci(e,n,t,r??1)}function Ci(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}Ck(Ci,h5,oH(hm,{brighter(e){return e=e==null?Mv:Math.pow(Mv,e),new Ci(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Sp:Math.pow(Sp,e),new Ci(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ci(zd(this.r),zd(this.g),zd(this.b),Dv(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:VA,formatHex:VA,formatHex8:Dzt,formatRgb:KA,toString:KA}));function VA(){return`#${cd(this.r)}${cd(this.g)}${cd(this.b)}`}function Dzt(){return`#${cd(this.r)}${cd(this.g)}${cd(this.b)}${cd((isNaN(this.opacity)?1:this.opacity)*255)}`}function KA(){const e=Dv(this.opacity);return`${e===1?"rgb(":"rgba("}${zd(this.r)}, ${zd(this.g)}, ${zd(this.b)}${e===1?")":`, ${e})`}`}function Dv(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function zd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function cd(e){return e=zd(e),(e<16?"0":"")+e.toString(16)}function QA(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new Qa(e,n,t,r)}function lH(e){if(e instanceof Qa)return new Qa(e.h,e.s,e.l,e.opacity);if(e instanceof hm||(e=Pd(e)),!e)return new Qa;if(e instanceof Qa)return e;e=e.rgb();var n=e.r/255,t=e.g/255,r=e.b/255,s=Math.min(n,t,r),i=Math.max(n,t,r),a=NaN,o=i-s,l=(i+s)/2;return o?(n===i?a=(t-r)/o+(t0&&l<1?0:a,new Qa(a,o,l,e.opacity)}function Lzt(e,n,t,r){return arguments.length===1?lH(e):new Qa(e,n,t,r??1)}function Qa(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}Ck(Qa,Lzt,oH(hm,{brighter(e){return e=e==null?Mv:Math.pow(Mv,e),new Qa(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Sp:Math.pow(Sp,e),new Qa(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,s=2*t-r;return new Ci(Pw(e>=240?e-240:e+120,s,r),Pw(e,s,r),Pw(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Qa(YA(this.h),o1(this.s),o1(this.l),Dv(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Dv(this.opacity);return`${e===1?"hsl(":"hsla("}${YA(this.h)}, ${o1(this.s)*100}%, ${o1(this.l)*100}%${e===1?")":`, ${e})`}`}}));function YA(e){return e=(e||0)%360,e<0?e+360:e}function o1(e){return Math.max(0,Math.min(1,e||0))}function Pw(e,n,t){return(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)*255}const Ek=e=>()=>e;function Ozt(e,n){return function(t){return e+t*n}}function Izt(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}function Bzt(e){return(e=+e)==1?cH:function(n,t){return t-n?Izt(n,t,e):Ek(isNaN(n)?t:n)}}function cH(e,n){var t=n-e;return t?Ozt(e,t):Ek(isNaN(e)?n:e)}const Lv=(function e(n){var t=Bzt(n);function r(s,i){var a=t((s=h5(s)).r,(i=h5(i)).r),o=t(s.g,i.g),l=t(s.b,i.b),u=cH(s.opacity,i.opacity);return function(_){return s.r=a(_),s.g=o(_),s.b=l(_),s.opacity=u(_),s+""}}return r.gamma=e,r})(1);function $zt(e,n){n||(n=[]);var t=e?Math.min(n.length,e.length):0,r=n.slice(),s;return function(i){for(s=0;st&&(i=n.slice(t,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:jo(r,s)})),t=Fw.lastIndex;return t180?_+=360:_-u>180&&(u+=360),p.push({i:d.push(s(d)+"rotate(",null,r)-2,x:jo(u,_)})):_&&d.push(s(d)+"rotate("+_+r)}function o(u,_,d,p){u!==_?p.push({i:d.push(s(d)+"skewX(",null,r)-2,x:jo(u,_)}):_&&d.push(s(d)+"skewX("+_+r)}function l(u,_,d,p,m,x){if(u!==d||_!==p){var S=m.push(s(m)+"scale(",null,",",null,")");x.push({i:S-4,x:jo(u,d)},{i:S-2,x:jo(_,p)})}else(d!==1||p!==1)&&m.push(s(m)+"scale("+d+","+p+")")}return function(u,_){var d=[],p=[];return u=e(u),_=e(_),i(u.translateX,u.translateY,_.translateX,_.translateY,d,p),a(u.rotate,_.rotate,d,p),o(u.skewX,_.skewX,d,p),l(u.scaleX,u.scaleY,_.scaleX,_.scaleY,d,p),u=_=null,function(m){for(var x=-1,S=p.length,v;++x=0&&e._call.call(void 0,n),e=e._next;--e_}function JA(){Fd=(Iv=Cp.now())+ry,e_=z0=0;try{ejt()}finally{e_=0,njt(),Fd=0}}function tjt(){var e=Cp.now(),n=e-Iv;n>hH&&(ry-=n,Iv=e)}function njt(){for(var e,n=Ov,t,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Ov=t);j0=e,m5(r)}function m5(e){if(!e_){z0&&(z0=clearTimeout(z0));var n=e-Fd;n>24?(e<1/0&&(z0=setTimeout(JA,e-Cp.now()-ry)),y0&&(y0=clearInterval(y0))):(y0||(Iv=Cp.now(),y0=setInterval(tjt,hH)),e_=1,_H(JA))}}function eR(e,n,t){var r=new Bv;return n=n==null?0:+n,r.restart(s=>{r.stop(),e(s+n)},n,t),r}var rjt=ty("start","end","cancel","interrupt"),sjt=[],mH=0,tR=1,g5=2,I1=3,nR=4,v5=5,B1=6;function sy(e,n,t,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(t in a)return;ijt(e,t,{name:n,index:r,group:s,on:rjt,tween:sjt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:mH})}function zk(e,n){var t=so(e,n);if(t.state>mH)throw new Error("too late; already scheduled");return t}function Qo(e,n){var t=so(e,n);if(t.state>I1)throw new Error("too late; already running");return t}function so(e,n){var t=e.__transition;if(!t||!(t=t[n]))throw new Error("transition not found");return t}function ijt(e,n,t){var r=e.__transition,s;r[n]=t,t.timer=pH(i,0,t.time);function i(u){t.state=tR,t.timer.restart(a,t.delay,t.time),t.delay<=u&&a(u-t.delay)}function a(u){var _,d,p,m;if(t.state!==tR)return l();for(_ in r)if(m=r[_],m.name===t.name){if(m.state===I1)return eR(a);m.state===nR?(m.state=B1,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[_]):+_g5&&r.state=0&&(n=n.slice(0,t)),!n||n==="start"})}function Ljt(e,n,t){var r,s,i=Djt(n)?zk:Qo;return function(){var a=i(this,e),o=a.on;o!==r&&(s=(r=o).copy()).on(n,t),a.on=s}}function Ojt(e,n){var t=this._id;return arguments.length<2?so(this.node(),t).on.on(e):this.each(Ljt(t,e,n))}function Ijt(e){return function(){var n=this.parentNode;for(var t in this.__transition)if(+t!==e)return;n&&n.removeChild(this)}}function Bjt(){return this.on("end.remove",Ijt(this._id))}function $jt(e){var n=this._name,t=this._id;typeof e!="function"&&(e=Sk(e));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>e;function uTt(e,{sourceEvent:n,target:t,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function Ol(e,n,t){this.k=e,this.x=n,this.y=t}Ol.prototype={constructor:Ol,scale:function(e){return e===1?this:new Ol(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Ol(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var iy=new Ol(1,0,0);yH.prototype=Ol.prototype;function yH(e){for(;!e.__zoom;)if(!(e=e.parentNode))return iy;return e.__zoom}function Hw(e){e.stopImmediatePropagation()}function x0(e){e.preventDefault(),e.stopImmediatePropagation()}function dTt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function fTt(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function rR(){return this.__zoom||iy}function hTt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function _Tt(){return navigator.maxTouchPoints||"ontouchstart"in this}function pTt(e,n,t){var r=e.invertX(n[0][0])-t[0][0],s=e.invertX(n[1][0])-t[1][0],i=e.invertY(n[0][1])-t[0][1],a=e.invertY(n[1][1])-t[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function xH(){var e=dTt,n=fTt,t=pTt,r=hTt,s=_Tt,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,l=O1,u=ty("start","zoom","end"),_,d,p,m=500,x=150,S=0,v=10;function b(H){H.property("__zoom",rR).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",O).filter(s).on("touchstart.zoom",B).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",U).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(H,Y,V,X){var te=H.selection?H.selection():H;te.property("__zoom",rR),H!==te?E(H,Y,V,X):te.interrupt().each(function(){N(this,arguments).event(X).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},b.scaleBy=function(H,Y,V,X){b.scaleTo(H,function(){var te=this.__zoom.k,I=typeof Y=="function"?Y.apply(this,arguments):Y;return te*I},V,X)},b.scaleTo=function(H,Y,V,X){b.transform(H,function(){var te=n.apply(this,arguments),I=this.__zoom,L=V==null?C(te):typeof V=="function"?V.apply(this,arguments):V,F=I.invert(L),q=typeof Y=="function"?Y.apply(this,arguments):Y;return t(y(w(I,q),L,F),te,a)},V,X)},b.translateBy=function(H,Y,V,X){b.transform(H,function(){return t(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof V=="function"?V.apply(this,arguments):V),n.apply(this,arguments),a)},null,X)},b.translateTo=function(H,Y,V,X,te){b.transform(H,function(){var I=n.apply(this,arguments),L=this.__zoom,F=X==null?C(I):typeof X=="function"?X.apply(this,arguments):X;return t(iy.translate(F[0],F[1]).scale(L.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof V=="function"?-V.apply(this,arguments):-V),I,a)},X,te)};function w(H,Y){return Y=Math.max(i[0],Math.min(i[1],Y)),Y===H.k?H:new Ol(Y,H.x,H.y)}function y(H,Y,V){var X=Y[0]-V[0]*H.k,te=Y[1]-V[1]*H.k;return X===H.x&&te===H.y?H:new Ol(H.k,X,te)}function C(H){return[(+H[0][0]+ +H[1][0])/2,(+H[0][1]+ +H[1][1])/2]}function E(H,Y,V,X){H.on("start.zoom",function(){N(this,arguments).event(X).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(X).end()}).tween("zoom",function(){var te=this,I=arguments,L=N(te,I).event(X),F=n.apply(te,I),q=V==null?C(F):typeof V=="function"?V.apply(te,I):V,G=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),ee=te.__zoom,ce=typeof Y=="function"?Y.apply(te,I):Y,oe=l(ee.invert(q).concat(G/ee.k),ce.invert(q).concat(G/ce.k));return function(ne){if(ne===1)ne=ce;else{var Q=oe(ne),le=G/Q[2];ne=new Ol(le,q[0]-Q[0]*le,q[1]-Q[1]*le)}L.zoom(null,ne)}})}function N(H,Y,V){return!V&&H.__zooming||new T(H,Y)}function T(H,Y){this.that=H,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=n.apply(H,Y),this.taps=0}T.prototype={event:function(H){return H&&(this.sourceEvent=H),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(H,Y){return this.mouse&&H!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&H!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&H!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(H){var Y=Fi(this.that).datum();u.call(H,this.that,new uTt(H,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:u}),Y)}};function z(H,...Y){if(!e.apply(this,arguments))return;var V=N(this,Y).event(H),X=this.__zoom,te=Math.max(i[0],Math.min(i[1],X.k*Math.pow(2,r.apply(this,arguments)))),I=Ua(H);if(V.wheel)(V.mouse[0][0]!==I[0]||V.mouse[0][1]!==I[1])&&(V.mouse[1]=X.invert(V.mouse[0]=I)),clearTimeout(V.wheel);else{if(X.k===te)return;V.mouse=[I,X.invert(I)],$1(this),V.start()}x0(H),V.wheel=setTimeout(L,x),V.zoom("mouse",t(y(w(X,te),V.mouse[0],V.mouse[1]),V.extent,a));function L(){V.wheel=null,V.end()}}function M(H,...Y){if(p||!e.apply(this,arguments))return;var V=H.currentTarget,X=N(this,Y,!0).event(H),te=Fi(H.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",G,!0),I=Ua(H,V),L=H.clientX,F=H.clientY;sH(H.view),Hw(H),X.mouse=[I,this.__zoom.invert(I)],$1(this),X.start();function q(ee){if(x0(ee),!X.moved){var ce=ee.clientX-L,oe=ee.clientY-F;X.moved=ce*ce+oe*oe>S}X.event(ee).zoom("mouse",t(y(X.that.__zoom,X.mouse[0]=Ua(ee,V),X.mouse[1]),X.extent,a))}function G(ee){te.on("mousemove.zoom mouseup.zoom",null),iH(ee.view,X.moved),x0(ee),X.event(ee).end()}}function O(H,...Y){if(e.apply(this,arguments)){var V=this.__zoom,X=Ua(H.changedTouches?H.changedTouches[0]:H,this),te=V.invert(X),I=V.k*(H.shiftKey?.5:2),L=t(y(w(V,I),X,te),n.apply(this,Y),a);x0(H),o>0?Fi(this).transition().duration(o).call(E,L,X,H):Fi(this).call(b.transform,L,X,H)}}function B(H,...Y){if(e.apply(this,arguments)){var V=H.touches,X=V.length,te=N(this,Y,H.changedTouches.length===X).event(H),I,L,F,q;for(Hw(H),L=0;L`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:n,sourceHandle:t,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?t:r}", edge id: ${n}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Ep=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],wH=["Enter"," ","Escape"],SH={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:n,y:t})=>`Moved selected node ${e}. New position, x: ${n}, y: ${t}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var t_;(function(e){e.Strict="strict",e.Loose="loose"})(t_||(t_={}));var jd;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(jd||(jd={}));var Np;(function(e){e.Partial="partial",e.Full="full"})(Np||(Np={}));const kH={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Vc;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Vc||(Vc={}));var $v;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})($v||($v={}));var Et;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Et||(Et={}));const sR={[Et.Left]:Et.Right,[Et.Right]:Et.Left,[Et.Top]:Et.Bottom,[Et.Bottom]:Et.Top};function CH(e){return e===null?null:e?"valid":"invalid"}const EH=e=>"id"in e&&"source"in e&&"target"in e,mTt=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Tk=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),_m=(e,n=[0,0])=>{const{width:t,height:r}=Yl(e),s=e.origin??n,i=t*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},gTt=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const t=e.reduce((r,s)=>{const i=typeof s=="string";let a=!n.nodeLookup&&!i?s:void 0;n.nodeLookup&&(a=i?n.nodeLookup.get(s):Tk(s)?s:n.nodeLookup.get(s.id));const o=a?Pv(a,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ay(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return oy(t)},pm=(e,n={})=>{let t={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(n.filter===void 0||n.filter(s))&&(t=ay(t,Pv(s)),r=!0)}),r?oy(t):{x:0,y:0,width:0,height:0}},Ak=(e,n,[t,r,s]=[0,0,1],i=!1,a=!1)=>{const o=(n.x-t)/s,l=(n.y-r)/s,u=n.width/s,_=n.height/s,d=[];for(const p of e.values()){const{measured:m,selectable:x=!0,hidden:S=!1}=p;if(a&&!x||S)continue;const v=m.width??p.width??p.initialWidth??0,b=m.height??p.height??p.initialHeight??0,{x:w,y}=p.internals.positionAbsolute,C=TH(o,l,u,_,w,y,v,b),E=v*b,N=i&&C>0;(!p.internals.handleBounds||N||C>=E||p.dragging)&&d.push(p)}return d},vTt=(e,n)=>{const t=new Set;return e.forEach(r=>{t.add(r.id)}),n.filter(r=>t.has(r.source)||t.has(r.target))};function bTt(e,n){const t=new Map,r=n!=null&&n.nodes?new Set(n.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((n==null?void 0:n.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&t.set(s.id,s)}),t}async function yTt({nodes:e,width:n,height:t,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return!0;const o=bTt(e,a),l=pm(o),u=Mk(l,n,t,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function NH({nodeId:e,nextPosition:n,nodeLookup:t,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const a=t.get(e),o=a.parentId?t.get(a.parentId):void 0,{x:l,y:u}=o?o.internals.positionAbsolute:{x:0,y:0},_=a.origin??r;let d=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!o)i==null||i("005",to.error005());else{const m=o.measured.width,x=o.measured.height;m&&x&&(d=[[l,u],[l+m,u+x]])}else o&&qd(a.extent)&&(d=[[a.extent[0][0]+l,a.extent[0][1]+u],[a.extent[1][0]+l,a.extent[1][1]+u]]);const p=qd(d)?Hd(n,d,a.measured):n;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",to.error015())),{position:{x:p.x-l+(a.measured.width??0)*_[0],y:p.y-u+(a.measured.height??0)*_[1]},positionAbsolute:p}}async function xTt({nodesToRemove:e=[],edgesToRemove:n=[],nodes:t,edges:r,onBeforeDelete:s}){const i=new Set(e.map(p=>p.id)),a=[];for(const p of t){if(p.deletable===!1)continue;const m=i.has(p.id),x=!m&&p.parentId&&a.find(S=>S.id===p.parentId);(m||x)&&a.push(p)}const o=new Set(n.map(p=>p.id)),l=r.filter(p=>p.deletable!==!1),_=vTt(a,l);for(const p of l)o.has(p.id)&&!_.find(x=>x.id===p.id)&&_.push(p);if(!s)return{edges:_,nodes:a};const d=await s({nodes:a,edges:_});return typeof d=="boolean"?d?{edges:_,nodes:a}:{edges:[],nodes:[]}:d}const n_=(e,n=0,t=1)=>Math.min(Math.max(e,n),t),Hd=(e={x:0,y:0},n,t)=>({x:n_(e.x,n[0][0],n[1][0]-((t==null?void 0:t.width)??0)),y:n_(e.y,n[0][1],n[1][1]-((t==null?void 0:t.height)??0))});function zH(e,n,t){const{width:r,height:s}=Yl(t),{x:i,y:a}=t.internals.positionAbsolute;return Hd(e,[[i,a],[i+r,a+s]],n)}const iR=(e,n,t)=>et?-n_(Math.abs(e-t),1,n)/n:0,Rk=(e,n,t=15,r=40)=>{const s=iR(e.x,r,n.width-r)*t,i=iR(e.y,r,n.height-r)*t;return[s,i]},ay=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),b5=({x:e,y:n,width:t,height:r})=>({x:e,y:n,x2:e+t,y2:n+r}),oy=({x:e,y:n,x2:t,y2:r})=>({x:e,y:n,width:t-e,height:r-n}),zp=(e,n=[0,0])=>{var s,i;const{x:t,y:r}=Tk(e)?e.internals.positionAbsolute:_m(e,n);return{x:t,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Pv=(e,n=[0,0])=>{var s,i;const{x:t,y:r}=Tk(e)?e.internals.positionAbsolute:_m(e,n);return{x:t,y:r,x2:t+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},jH=(e,n)=>oy(ay(b5(e),b5(n))),TH=(e,n,t,r,s,i,a,o)=>{const l=Math.max(0,Math.min(e+t,s+a)-Math.max(e,s)),u=Math.max(0,Math.min(n+r,i+o)-Math.max(n,i));return Math.ceil(l*u)},Fv=(e,n)=>TH(e.x,e.y,e.width,e.height,n.x,n.y,n.width,n.height),aR=e=>Xa(e.width)&&Xa(e.height)&&Xa(e.x)&&Xa(e.y),Xa=e=>!isNaN(e)&&isFinite(e),AH=(e,n)=>(t,r)=>{},mm=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),gm=({x:e,y:n},[t,r,s],i=!1,a=[1,1])=>{const o={x:(e-t)/s,y:(n-r)/s};return i?mm(o,a):o},r_=({x:e,y:n},[t,r,s])=>({x:e*s+t,y:n*s+r});function Kf(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e=="string"&&e.endsWith("%")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(n*t*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function wTt(e,n,t){if(typeof e=="string"||typeof e=="number"){const r=Kf(e,t),s=Kf(e,n);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Kf(e.top??e.y??0,t),s=Kf(e.bottom??e.y??0,t),i=Kf(e.left??e.x??0,n),a=Kf(e.right??e.x??0,n);return{top:r,right:a,bottom:s,left:i,x:i+a,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function STt(e,n,t,r,s,i){const{x:a,y:o}=r_(e,[n,t,r]),{x:l,y:u}=r_({x:e.x+e.width,y:e.y+e.height},[n,t,r]),_=s-l,d=i-u;return{left:Math.floor(a),top:Math.floor(o),right:Math.floor(_),bottom:Math.floor(d)}}const Mk=(e,n,t,r,s,i)=>{const a=wTt(i,n,t),o=(n-a.x)/e.width,l=(t-a.y)/e.height,u=Math.min(o,l),_=n_(u,r,s),d=e.x+e.width/2,p=e.y+e.height/2,m=n/2-d*_,x=t/2-p*_,S=STt(e,m,x,_,n,t),v={left:Math.min(S.left-a.left,0),top:Math.min(S.top-a.top,0),right:Math.min(S.right-a.right,0),bottom:Math.min(S.bottom-a.bottom,0)};return{x:m-v.left+v.right,y:x-v.top+v.bottom,zoom:_}},jp=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function qd(e){return e!=null&&e!=="parent"}function Yl(e){var n,t;return{width:((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth??0,height:((t=e.measured)==null?void 0:t.height)??e.height??e.initialHeight??0}}function RH(e){var n,t;return(((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth)!==void 0&&(((t=e.measured)==null?void 0:t.height)??e.height??e.initialHeight)!==void 0}function MH(e,n={width:0,height:0},t,r,s){const i={...e},a=r.get(t);if(a){const o=a.origin||s;i.x+=a.internals.positionAbsolute.x-(n.width??0)*o[0],i.y+=a.internals.positionAbsolute.y-(n.height??0)*o[1]}return i}function oR(e,n){if(e.size!==n.size)return!1;for(const t of e)if(!n.has(t))return!1;return!0}function kTt(){let e,n;return{promise:new Promise((r,s)=>{e=r,n=s}),resolve:e,reject:n}}function CTt(e){return{...SH,...e||{}}}function V0(e,{snapGrid:n=[0,0],snapToGrid:t=!1,transform:r,containerBounds:s}){const{x:i,y:a}=Za(e),o=gm({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:l,y:u}=t?mm(o,n):o;return{xSnapped:l,ySnapped:u,...o}}const Dk=e=>({width:e.offsetWidth,height:e.offsetHeight}),DH=e=>{var n;return((n=e==null?void 0:e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},ETt=["INPUT","SELECT","TEXTAREA"];function LH(e){var r,s;const n=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(n==null?void 0:n.nodeType)!==1?!1:ETt.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const OH=e=>"clientX"in e,Za=(e,n)=>{var i,a;const t=OH(e),r=t?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=t?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((n==null?void 0:n.left)??0),y:s-((n==null?void 0:n.top)??0)}},lR=(e,n,t,r,s)=>{const i=n.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(a=>{const o=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:s,position:a.getAttribute("data-handlepos"),x:(o.left-t.left)/r,y:(o.top-t.top)/r,...Dk(a)}})};function IH({sourceX:e,sourceY:n,targetX:t,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:o}){const l=e*.125+s*.375+a*.375+t*.125,u=n*.125+i*.375+o*.375+r*.125,_=Math.abs(l-e),d=Math.abs(u-n);return[l,u,_,d]}function u1(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function cR({pos:e,x1:n,y1:t,x2:r,y2:s,c:i}){switch(e){case Et.Left:return[n-u1(n-r,i),t];case Et.Right:return[n+u1(r-n,i),t];case Et.Top:return[n,t-u1(t-s,i)];case Et.Bottom:return[n,t+u1(s-t,i)]}}function BH({sourceX:e,sourceY:n,sourcePosition:t=Et.Bottom,targetX:r,targetY:s,targetPosition:i=Et.Top,curvature:a=.25}){const[o,l]=cR({pos:t,x1:e,y1:n,x2:r,y2:s,c:a}),[u,_]=cR({pos:i,x1:r,y1:s,x2:e,y2:n,c:a}),[d,p,m,x]=IH({sourceX:e,sourceY:n,targetX:r,targetY:s,sourceControlX:o,sourceControlY:l,targetControlX:u,targetControlY:_});return[`M${e},${n} C${o},${l} ${u},${_} ${r},${s}`,d,p,m,x]}function $H({sourceX:e,sourceY:n,targetX:t,targetY:r}){const s=Math.abs(t-e)/2,i=t0}const jTt=({source:e,sourceHandle:n,target:t,targetHandle:r})=>`xy-edge__${e}${n||""}-${t}${r||""}`,TTt=(e,n)=>n.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),ATt=(e,n,t={})=>{var i;if(!e.source||!e.target)return(i=t.onError)==null||i.call(t,"006",to.error006()),n;const r=t.getEdgeId||jTt;let s;return EH(e)?s={...e}:s={...e,id:r(e)},TTt(s,n)?n:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,n.concat(s))};function PH({sourceX:e,sourceY:n,targetX:t,targetY:r}){const[s,i,a,o]=$H({sourceX:e,sourceY:n,targetX:t,targetY:r});return[`M ${e},${n}L ${t},${r}`,s,i,a,o]}const uR={[Et.Left]:{x:-1,y:0},[Et.Right]:{x:1,y:0},[Et.Top]:{x:0,y:-1},[Et.Bottom]:{x:0,y:1}},RTt=({source:e,sourcePosition:n=Et.Bottom,target:t})=>n===Et.Left||n===Et.Right?e.xMath.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function MTt({source:e,sourcePosition:n=Et.Bottom,target:t,targetPosition:r=Et.Top,center:s,offset:i,stepPosition:a}){const o=uR[n],l=uR[r],u={x:e.x+o.x*i,y:e.y+o.y*i},_={x:t.x+l.x*i,y:t.y+l.y*i},d=RTt({source:u,sourcePosition:n,target:_}),p=d.x!==0?"x":"y",m=d[p];let x=[],S,v;const b={x:0,y:0},w={x:0,y:0},[,,y,C]=$H({sourceX:e.x,sourceY:e.y,targetX:t.x,targetY:t.y});if(o[p]*l[p]===-1){p==="x"?(S=s.x??u.x+(_.x-u.x)*a,v=s.y??(u.y+_.y)/2):(S=s.x??(u.x+_.x)/2,v=s.y??u.y+(_.y-u.y)*a);const z=[{x:S,y:u.y},{x:S,y:_.y}],M=[{x:u.x,y:v},{x:_.x,y:v}];o[p]===m?x=p==="x"?z:M:x=p==="x"?M:z}else{const z=[{x:u.x,y:_.y}],M=[{x:_.x,y:u.y}];if(p==="x"?x=o.x===m?M:z:x=o.y===m?z:M,n===r){const H=Math.abs(e[p]-t[p]);if(H<=i){const Y=Math.min(i-1,i-H);o[p]===m?b[p]=(u[p]>e[p]?-1:1)*Y:w[p]=(_[p]>t[p]?-1:1)*Y}}if(n!==r){const H=p==="x"?"y":"x",Y=o[p]===l[H],V=u[H]>_[H],X=u[H]<_[H];(o[p]===1&&(!Y&&V||Y&&X)||o[p]!==1&&(!Y&&X||Y&&V))&&(x=p==="x"?z:M)}const O={x:u.x+b.x,y:u.y+b.y},B={x:_.x+w.x,y:_.y+w.y},$=Math.max(Math.abs(O.x-x[0].x),Math.abs(B.x-x[0].x)),U=Math.max(Math.abs(O.y-x[0].y),Math.abs(B.y-x[0].y));$>=U?(S=(O.x+B.x)/2,v=x[0].y):(S=x[0].x,v=(O.y+B.y)/2)}const E={x:u.x+b.x,y:u.y+b.y},N={x:_.x+w.x,y:_.y+w.y};return[[e,...E.x!==x[0].x||E.y!==x[0].y?[E]:[],...x,...N.x!==x[x.length-1].x||N.y!==x[x.length-1].y?[N]:[],t],S,v,y,C]}function DTt(e,n,t,r){const s=Math.min(dR(e,n)/2,dR(n,t)/2,r),{x:i,y:a}=n;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return`L${i} ${a}`;if(e.y===a){const u=e.xt.id===n):e[0])||null}function x5(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function OTt(e,{id:n,defaultColor:t,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((a,o)=>([o.markerStart||r,o.markerEnd||s].forEach(l=>{if(l&&typeof l=="object"){const u=x5(l,n);i.has(u)||(a.push({id:u,color:l.color||t,...l}),i.add(u))}}),a),[]).sort((a,o)=>a.id.localeCompare(o.id))}const FH=1e3,ITt=10,Lk={nodeOrigin:[0,0],nodeExtent:Ep,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},BTt={...Lk,checkEquality:!0};function Ok(e,n){const t={...e};for(const r in n)n[r]!==void 0&&(t[r]=n[r]);return t}function $Tt(e,n,t){const r=Ok(Lk,t);for(const s of e.values())if(s.parentId)Bk(s,e,n,r);else{const i=_m(s,r.nodeOrigin),a=qd(s.extent)?s.extent:r.nodeExtent,o=Hd(i,a,Yl(s));s.internals.positionAbsolute=o}}function PTt(e,n){if(!e.handles)return e.measured?n==null?void 0:n.internals.handleBounds:void 0;const t=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?t.push(i):s.type==="target"&&r.push(i)}return{source:t,target:r}}function Ik(e){return e==="manual"}function w5(e,n,t,r={}){var _,d;const s=Ok(BTt,r),i={i:0},a=new Map(n),o=s!=null&&s.elevateNodesOnSelect&&!Ik(s.zIndexMode)?FH:0;let l=e.length>0,u=!1;n.clear(),t.clear();for(const p of e){let m=a.get(p.id);if(s.checkEquality&&p===(m==null?void 0:m.internals.userNode))n.set(p.id,m);else{const x=_m(p,s.nodeOrigin),S=qd(p.extent)?p.extent:s.nodeExtent,v=Hd(x,S,Yl(p));m={...s.defaults,...p,measured:{width:(_=p.measured)==null?void 0:_.width,height:(d=p.measured)==null?void 0:d.height},internals:{positionAbsolute:v,handleBounds:PTt(p,m),z:HH(p,o,s.zIndexMode),userNode:p}},n.set(p.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(l=!1),p.parentId&&Bk(m,n,t,r,i),u||(u=p.selected??!1)}return{nodesInitialized:l,hasSelectedNodes:u}}function FTt(e,n){if(!e.parentId)return;const t=n.get(e.parentId);t?t.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function Bk(e,n,t,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:o,zIndexMode:l}=Ok(Lk,r),u=e.parentId,_=n.get(u);if(!_){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}FTt(e,t),s&&!_.parentId&&_.internals.rootParentIndex===void 0&&l==="auto"&&(_.internals.rootParentIndex=++s.i,_.internals.z=_.internals.z+s.i*ITt),s&&_.internals.rootParentIndex!==void 0&&(s.i=_.internals.rootParentIndex);const d=i&&!Ik(l)?FH:0,{x:p,y:m,z:x}=HTt(e,_,a,o,d,l),{positionAbsolute:S}=e.internals,v=p!==S.x||m!==S.y;(v||x!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:p,y:m}:S,z:x}})}function HH(e,n,t){const r=Xa(e.zIndex)?e.zIndex:0;return Ik(t)?r:r+(e.selected?n:0)}function HTt(e,n,t,r,s,i){const{x:a,y:o}=n.internals.positionAbsolute,l=Yl(e),u=_m(e,t),_=qd(e.extent)?Hd(u,e.extent,l):u;let d=Hd({x:a+_.x,y:o+_.y},r,l);e.extent==="parent"&&(d=zH(d,l,n));const p=HH(e,s,i),m=n.internals.z??0;return{x:d.x,y:d.y,z:m>=p?m+1:p}}function $k(e,n,t,r=[0,0]){var a;const s=[],i=new Map;for(const o of e){const l=n.get(o.parentId);if(!l)continue;const u=((a=i.get(o.parentId))==null?void 0:a.expandedRect)??zp(l),_=jH(u,o.rect);i.set(o.parentId,{expandedRect:_,parent:l})}return i.size>0&&i.forEach(({expandedRect:o,parent:l},u)=>{var y;const _=l.internals.positionAbsolute,d=Yl(l),p=l.origin??r,m=o.x<_.x?Math.round(Math.abs(_.x-o.x)):0,x=o.y<_.y?Math.round(Math.abs(_.y-o.y)):0,S=Math.max(d.width,Math.round(o.width)),v=Math.max(d.height,Math.round(o.height)),b=(S-d.width)*p[0],w=(v-d.height)*p[1];(m>0||x>0||b||w)&&(s.push({id:u,type:"position",position:{x:l.position.x-m+b,y:l.position.y-x+w}}),(y=t.get(u))==null||y.forEach(C=>{e.some(E=>E.id===C.id)||s.push({id:C.id,type:"position",position:{x:C.position.x+m,y:C.position.y+x}})})),(d.width0){const m=$k(p,n,t,s);u.push(...m)}return{changes:u,updatedInternals:l}}async function UTt({delta:e,panZoom:n,transform:t,translateExtent:r,width:s,height:i}){if(!n||!e.x&&!e.y)return!1;const a=await n.setViewportConstrained({x:t[0]+e.x,y:t[1]+e.y,zoom:t[2]},[[0,0],[s,i]],r);return!!a&&(a.x!==t[0]||a.y!==t[1]||a.k!==t[2])}function pR(e,n,t,r,s,i){let a=s;const o=r.get(a)||new Map;r.set(a,o.set(t,n)),a=`${s}-${e}`;const l=r.get(a)||new Map;if(r.set(a,l.set(t,n)),i){a=`${s}-${e}-${i}`;const u=r.get(a)||new Map;r.set(a,u.set(t,n))}}function qH(e,n,t){e.clear(),n.clear();for(const r of t){const{source:s,target:i,sourceHandle:a=null,targetHandle:o=null}=r,l={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:o},u=`${s}-${a}--${i}-${o}`,_=`${i}-${o}--${s}-${a}`;pR("source",l,_,e,s,a),pR("target",l,u,e,i,o),n.set(r.id,r)}}function UH(e,n){if(!e.parentId)return!1;const t=n.get(e.parentId);return t?t.selected?!0:UH(t,n):!1}function mR(e,n,t){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,n))return!0;if(r===t)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function GTt(e,n,t,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!UH(a,e))&&(a.draggable||n&&typeof a.draggable>"u")){const o=e.get(i);o&&s.set(i,{id:i,position:o.position||{x:0,y:0},distance:{x:t.x-o.internals.positionAbsolute.x,y:t.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return s}function qw({nodeId:e,dragItems:n,nodeLookup:t,dragging:r=!0}){var a,o,l;const s=[];for(const[u,_]of n){const d=(a=t.get(u))==null?void 0:a.internals.userNode;d&&s.push({...d,position:_.position,dragging:r})}if(!e)return[s[0],s];const i=(o=t.get(e))==null?void 0:o.internals.userNode;return[i?{...i,position:((l=n.get(e))==null?void 0:l.position)||i.position,dragging:r}:s[0],s]}function WTt({dragItems:e,snapGrid:n,x:t,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:t-s.distance.x,y:r-s.distance.y},a=mm(i,n);return{x:a.x-i.x,y:a.y-i.y}}function VTt({onNodeMouseDown:e,getStoreItems:n,onDragStart:t,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,o=new Map,l=!1,u={x:0,y:0},_=null,d=!1,p=null,m=!1,x=!1,S=null;function v({noDragClassName:w,handleSelector:y,domNode:C,isSelectable:E,nodeId:N,nodeClickDistance:T=0}){p=Fi(C);function z({x:$,y:U}){const{nodeLookup:H,nodeExtent:Y,snapGrid:V,snapToGrid:X,nodeOrigin:te,onNodeDrag:I,onSelectionDrag:L,onError:F,updateNodePositions:q}=n();i={x:$,y:U};let G=!1;const ee=o.size>1,ce=ee&&Y?b5(pm(o)):null,oe=ee&&X?WTt({dragItems:o,snapGrid:V,x:$,y:U}):null;for(const[ne,Q]of o){if(!H.has(ne))continue;let le={x:$-Q.distance.x,y:U-Q.distance.y};X&&(le=oe?{x:Math.round(le.x+oe.x),y:Math.round(le.y+oe.y)}:mm(le,V));let ae=null;if(ee&&Y&&!Q.extent&&ce){const{positionAbsolute:Se}=Q.internals,ye=Se.x-ce.x+Y[0][0],qe=Se.x+Q.measured.width-ce.x2+Y[1][0],Ie=Se.y-ce.y+Y[0][1],ze=Se.y+Q.measured.height-ce.y2+Y[1][1];ae=[[ye,Ie],[qe,ze]]}const{position:ue,positionAbsolute:pe}=NH({nodeId:ne,nextPosition:le,nodeLookup:H,nodeExtent:ae||Y,nodeOrigin:te,onError:F});G=G||Q.position.x!==ue.x||Q.position.y!==ue.y,Q.position=ue,Q.internals.positionAbsolute=pe}if(x=x||G,!!G&&(q(o,!0),S&&(r||I||!N&&L))){const[ne,Q]=qw({nodeId:N,dragItems:o,nodeLookup:H});r==null||r(S,o,ne,Q),I==null||I(S,ne,Q),N||L==null||L(S,Q)}}async function M(){if(!_)return;const{transform:$,panBy:U,autoPanSpeed:H,autoPanOnNodeDrag:Y}=n();if(!Y){l=!1,cancelAnimationFrame(a);return}const[V,X]=Rk(u,_,H);(V!==0||X!==0)&&(i.x=(i.x??0)-V/$[2],i.y=(i.y??0)-X/$[2],await U({x:V,y:X})&&z(i)),a=requestAnimationFrame(M)}function O($){var ee;const{nodeLookup:U,multiSelectionActive:H,nodesDraggable:Y,transform:V,snapGrid:X,snapToGrid:te,selectNodesOnDrag:I,onNodeDragStart:L,onSelectionDragStart:F,unselectNodesAndEdges:q}=n();d=!0,(!I||!E)&&!H&&N&&((ee=U.get(N))!=null&&ee.selected||q()),E&&I&&N&&(e==null||e(N));const G=V0($.sourceEvent,{transform:V,snapGrid:X,snapToGrid:te,containerBounds:_});if(i=G,o=GTt(U,Y,G,N),o.size>0&&(t||L||!N&&F)){const[ce,oe]=qw({nodeId:N,dragItems:o,nodeLookup:U});t==null||t($.sourceEvent,o,ce,oe),L==null||L($.sourceEvent,ce,oe),N||F==null||F($.sourceEvent,oe)}}const B=aH().clickDistance(T).on("start",$=>{const{domNode:U,nodeDragThreshold:H,transform:Y,snapGrid:V,snapToGrid:X}=n();_=(U==null?void 0:U.getBoundingClientRect())||null,m=!1,x=!1,S=$.sourceEvent,H===0&&O($),i=V0($.sourceEvent,{transform:Y,snapGrid:V,snapToGrid:X,containerBounds:_}),u=Za($.sourceEvent,_)}).on("drag",$=>{const{autoPanOnNodeDrag:U,transform:H,snapGrid:Y,snapToGrid:V,nodeDragThreshold:X,nodeLookup:te}=n(),I=V0($.sourceEvent,{transform:H,snapGrid:Y,snapToGrid:V,containerBounds:_});if(S=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||N&&!te.has(N))&&(m=!0),!m){if(!l&&U&&d&&(l=!0,M()),!d){const L=Za($.sourceEvent,_),F=L.x-u.x,q=L.y-u.y;Math.sqrt(F*F+q*q)>X&&O($)}(i.x!==I.xSnapped||i.y!==I.ySnapped)&&o&&d&&(u=Za($.sourceEvent,_),z(I))}}).on("end",$=>{if(!d||m){m&&o.size>0&&n().updateNodePositions(o,!1);return}if(l=!1,d=!1,cancelAnimationFrame(a),o.size>0){const{nodeLookup:U,updateNodePositions:H,onNodeDragStop:Y,onSelectionDragStop:V}=n();if(x&&(H(o,!1),x=!1),s||Y||!N&&V){const[X,te]=qw({nodeId:N,dragItems:o,nodeLookup:U,dragging:!1});s==null||s($.sourceEvent,o,X,te),Y==null||Y($.sourceEvent,X,te),N||V==null||V($.sourceEvent,te)}}}).filter($=>{const U=$.target;return!$.button&&(!w||!mR(U,`.${w}`,C))&&(!y||mR(U,y,C))});p.call(B)}function b(){p==null||p.on(".drag",null)}return{update:v,destroy:b}}function KTt(e,n,t){const r=[],s={x:e.x-t,y:e.y-t,width:t*2,height:t*2};for(const i of n.values())Fv(s,zp(i))>0&&r.push(i);return r}const QTt=250;function YTt(e,n,t,r){var o,l;let s=[],i=1/0;const a=KTt(e,t,n+QTt);for(const u of a){const _=[...((o=u.internals.handleBounds)==null?void 0:o.source)??[],...((l=u.internals.handleBounds)==null?void 0:l.target)??[]];for(const d of _){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:p,y:m}=Ud(u,d,d.position,!0),x=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(m-e.y,2));x>n||(x1){const u=r.type==="source"?"target":"source";return s.find(_=>_.type===u)??s[0]}return s[0]}function GH(e,n,t,r,s,i=!1){var u,_,d;const a=r.get(e);if(!a)return null;const o=s==="strict"?(u=a.internals.handleBounds)==null?void 0:u[n]:[...((_=a.internals.handleBounds)==null?void 0:_.source)??[],...((d=a.internals.handleBounds)==null?void 0:d.target)??[]],l=(t?o==null?void 0:o.find(p=>p.id===t):o==null?void 0:o[0])??null;return l&&i?{...l,...Ud(a,l,l.position,!0)}:l}function WH(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function XTt(e,n){let t=null;return n?t=!0:e&&!n&&(t=!1),t}const VH=()=>!0;function ZTt(e,{connectionMode:n,connectionRadius:t,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:o,nodeLookup:l,lib:u,autoPanOnConnect:_,flowId:d,panBy:p,cancelConnection:m,onConnectStart:x,onConnect:S,onConnectEnd:v,isValidConnection:b=VH,onReconnectEnd:w,updateConnection:y,getTransform:C,getFromHandle:E,autoPanSpeed:N,dragThreshold:T=1,handleDomNode:z}){const M=DH(e.target);let O=0,B;const{x:$,y:U}=Za(e),H=WH(i,z),Y=o==null?void 0:o.getBoundingClientRect();let V=!1;if(!Y||!H)return;const X=GH(s,H,r,l,n);if(!X)return;let te=Za(e,Y),I=!1,L=null,F=!1,q=null;function G(){if(!_||!Y)return;const[ue,pe]=Rk(te,Y,N);p({x:ue,y:pe}),O=requestAnimationFrame(G)}const ee={...X,nodeId:s,type:H,position:X.position},ce=l.get(s);let ne={inProgress:!0,isValid:null,from:Ud(ce,ee,Et.Left,!0),fromHandle:ee,fromPosition:ee.position,fromNode:ce,to:te,toHandle:null,toPosition:sR[ee.position],toNode:null,pointer:te};function Q(){V=!0,y(ne),x==null||x(e,{nodeId:s,handleId:r,handleType:H})}T===0&&Q();function le(ue){if(!V){const{x:ze,y:at}=Za(ue),bt=ze-$,$t=at-U;if(!(bt*bt+$t*$t>T*T))return;Q()}if(!E()||!ee){ae(ue);return}const pe=C();te=Za(ue,Y),B=YTt(gm(te,pe,!1,[1,1]),t,l,ee),I||(G(),I=!0);const Se=KH(ue,{handle:B,connectionMode:n,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:b,doc:M,lib:u,flowId:d,nodeLookup:l});q=Se.handleDomNode,L=Se.connection,F=XTt(!!B,Se.isValid);const ye=l.get(s),qe=ye?Ud(ye,ee,Et.Left,!0):ne.from,Ie={...ne,from:qe,isValid:F,to:Se.toHandle&&F?r_({x:Se.toHandle.x,y:Se.toHandle.y},pe):te,toHandle:Se.toHandle,toPosition:F&&Se.toHandle?Se.toHandle.position:sR[ee.position],toNode:Se.toHandle?l.get(Se.toHandle.nodeId):null,pointer:te};y(Ie),ne=Ie}function ae(ue){if(!("touches"in ue&&ue.touches.length>0)){if(V){(B||q)&&L&&F&&(S==null||S(L));const{inProgress:pe,...Se}=ne,ye={...Se,toPosition:ne.toHandle?ne.toPosition:null};v==null||v(ue,ye),i&&(w==null||w(ue,ye))}m(),cancelAnimationFrame(O),I=!1,F=!1,L=null,q=null,M.removeEventListener("mousemove",le),M.removeEventListener("mouseup",ae),M.removeEventListener("touchmove",le),M.removeEventListener("touchend",ae)}}M.addEventListener("mousemove",le),M.addEventListener("mouseup",ae),M.addEventListener("touchmove",le),M.addEventListener("touchend",ae)}function KH(e,{handle:n,connectionMode:t,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:o,flowId:l,isValidConnection:u=VH,nodeLookup:_}){const d=i==="target",p=n?a.querySelector(`.${o}-flow__handle[data-id="${l}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:m,y:x}=Za(e),S=a.elementFromPoint(m,x),v=S!=null&&S.classList.contains(`${o}-flow__handle`)?S:p,b={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const w=WH(void 0,v),y=v.getAttribute("data-nodeid"),C=v.getAttribute("data-handleid"),E=v.classList.contains("connectable"),N=v.classList.contains("connectableend");if(!y||!w)return b;const T={source:d?y:r,sourceHandle:d?C:s,target:d?r:y,targetHandle:d?s:C};b.connection=T;const M=E&&N&&(t===t_.Strict?d&&w==="source"||!d&&w==="target":y!==r||C!==s);b.isValid=M&&u(T),b.toHandle=GH(y,w,C,_,t,!0)}return b}const S5={onPointerDown:ZTt,isValid:KH};function JTt({domNode:e,panZoom:n,getTransform:t,getViewScale:r}){const s=Fi(e);function i({translateExtent:o,width:l,height:u,zoomStep:_=1,pannable:d=!0,zoomable:p=!0,inversePan:m=!1}){const x=y=>{if(y.sourceEvent.type!=="wheel"||!n)return;const C=t(),E=y.sourceEvent.ctrlKey&&jp()?10:1,N=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*_,T=C[2]*Math.pow(2,N*E);n.scaleTo(T)};let S=[0,0];const v=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(S=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},b=y=>{const C=t();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!n)return;const E=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],N=[E[0]-S[0],E[1]-S[1]];S=E;const T=r()*Math.max(C[2],Math.log(C[2]))*(m?-1:1),z={x:C[0]-N[0]*T,y:C[1]-N[1]*T},M=[[0,0],[l,u]];n.setViewportConstrained({x:z.x,y:z.y,zoom:C[2]},M,o)},w=xH().on("start",v).on("zoom",d?b:null).on("zoom.wheel",p?x:null);s.call(w,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:Ua}}const ly=e=>({x:e.x,y:e.y,zoom:e.k}),Uw=({x:e,y:n,zoom:t})=>iy.translate(e,n).scale(t),ih=(e,n)=>e.target.closest(`.${n}`),QH=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),eAt=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Gw=(e,n=0,t=eAt,r=()=>{})=>{const s=typeof n=="number"&&n>0;return s||r(),s?e.transition().duration(n).ease(t).on("end",r):e},YH=e=>{const n=e.ctrlKey&&jp()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function tAt({zoomPanValues:e,noWheelClassName:n,d3Selection:t,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:o,onPanZoom:l,onPanZoomEnd:u}){return _=>{if(ih(_,n))return _.ctrlKey&&_.preventDefault(),!1;_.preventDefault(),_.stopImmediatePropagation();const d=t.property("__zoom").k||1;if(_.ctrlKey&&a){const v=Ua(_),b=YH(_),w=d*Math.pow(2,b);r.scaleTo(t,w,v,_);return}const p=_.deltaMode===1?20:1;let m=s===jd.Vertical?0:_.deltaX*p,x=s===jd.Horizontal?0:_.deltaY*p;!jp()&&_.shiftKey&&s!==jd.Vertical&&(m=_.deltaY*p,x=0),r.translateBy(t,-(m/d)*i,-(x/d)*i,{internal:!0});const S=ly(t.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l==null||l(_,S),e.panScrollTimeout=setTimeout(()=>{u==null||u(_,S),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,o==null||o(_,S))}}function nAt({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:t}){return function(r,s){const i=r.type==="wheel",a=!n&&i&&!r.ctrlKey,o=ih(r,e);if(r.ctrlKey&&i&&o&&r.preventDefault(),a||o)return null;r.preventDefault(),t.call(this,r,s)}}function rAt({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:t}){return r=>{var i,a,o;if((i=r.sourceEvent)!=null&&i.internal)return;const s=ly(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&n(!0),t&&(t==null||t(r.sourceEvent,s))}}function sAt({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:t,onTransformChange:r,onPanZoom:s}){return i=>{var a,o;e.usedRightMouseButton=!!(t&&QH(n,e.mouseButton??0)),(a=i.sourceEvent)!=null&&a.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((o=i.sourceEvent)!=null&&o.internal)&&(s==null||s(i.sourceEvent,ly(i.transform)))}}function iAt({zoomPanValues:e,panOnDrag:n,panOnScroll:t,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return a=>{var o;if(!((o=a.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,i&&QH(n,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const l=ly(a.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,l)},t?150:0)}}}function aAt({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:t,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:o,noPanClassName:l,lib:u,connectionInProgress:_}){return d=>{var v;const p=e||n,m=t&&d.ctrlKey,x=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(ih(d,`${u}-flow__node`)||ih(d,`${u}-flow__edge`)))return!0;if(!r&&!p&&!s&&!i&&!t||a||_&&!x||ih(d,o)&&x||ih(d,l)&&(!x||s&&x&&!e)||!t&&d.ctrlKey&&x)return!1;if(!t&&d.type==="touchstart"&&((v=d.touches)==null?void 0:v.length)>1)return d.preventDefault(),!1;if(!p&&!s&&!m&&x||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const S=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||x)&&S}}function oAt({domNode:e,minZoom:n,maxZoom:t,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:o,onDraggingChange:l}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},_=e.getBoundingClientRect(),d=xH().scaleExtent([n,t]).translateExtent(r),p=Fi(e).call(d);w({x:s.x,y:s.y,zoom:n_(s.zoom,n,t)},[[0,0],[_.width,_.height]],r);const m=p.on("wheel.zoom"),x=p.on("dblclick.zoom");d.wheelDelta(YH);async function S(B,$){return p?new Promise(U=>{d==null||d.interpolate(($==null?void 0:$.interpolate)==="linear"?W0:O1).transform(Gw(p,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>U(!0)),B)}):!1}function v({noWheelClassName:B,noPanClassName:$,onPaneContextMenu:U,userSelectionActive:H,panOnScroll:Y,panOnDrag:V,panOnScrollMode:X,panOnScrollSpeed:te,preventScrolling:I,zoomOnPinch:L,zoomOnScroll:F,zoomOnDoubleClick:q,zoomActivationKeyPressed:G,lib:ee,onTransformChange:ce,connectionInProgress:oe,paneClickDistance:ne,selectionOnDrag:Q}){H&&!u.isZoomingOrPanning&&b();const le=Y&&!G&&!H;d.clickDistance(Q?1/0:!Xa(ne)||ne<0?0:ne);const ae=le?tAt({zoomPanValues:u,noWheelClassName:B,d3Selection:p,d3Zoom:d,panOnScrollMode:X,panOnScrollSpeed:te,zoomOnPinch:L,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:o}):nAt({noWheelClassName:B,preventScrolling:I,d3ZoomHandler:m});p.on("wheel.zoom",ae,{passive:!1});const ue=rAt({zoomPanValues:u,onDraggingChange:l,onPanZoomStart:a});d.on("start",ue);const pe=sAt({zoomPanValues:u,panOnDrag:V,onPaneContextMenu:!!U,onPanZoom:i,onTransformChange:ce});d.on("zoom",pe);const Se=iAt({zoomPanValues:u,panOnDrag:V,panOnScroll:Y,onPaneContextMenu:U,onPanZoomEnd:o,onDraggingChange:l});d.on("end",Se);const ye=aAt({zoomActivationKeyPressed:G,panOnDrag:V,zoomOnScroll:F,panOnScroll:Y,zoomOnDoubleClick:q,zoomOnPinch:L,userSelectionActive:H,noPanClassName:$,noWheelClassName:B,lib:ee,connectionInProgress:oe});d.filter(ye),q?p.on("dblclick.zoom",x):p.on("dblclick.zoom",null)}function b(){d.on("zoom",null)}async function w(B,$,U){const H=Uw(B),Y=d==null?void 0:d.constrain()(H,$,U);return Y&&await S(Y),Y}async function y(B,$){const U=Uw(B);return await S(U,$),U}function C(B){if(p){const $=Uw(B),U=p.property("__zoom");(U.k!==B.zoom||U.x!==B.x||U.y!==B.y)&&(d==null||d.transform(p,$,null,{sync:!0}))}}function E(){const B=p?yH(p.node()):{x:0,y:0,k:1};return{x:B.x,y:B.y,zoom:B.k}}async function N(B,$){return p?new Promise(U=>{d==null||d.interpolate(($==null?void 0:$.interpolate)==="linear"?W0:O1).scaleTo(Gw(p,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>U(!0)),B)}):!1}async function T(B,$){return p?new Promise(U=>{d==null||d.interpolate(($==null?void 0:$.interpolate)==="linear"?W0:O1).scaleBy(Gw(p,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>U(!0)),B)}):!1}function z(B){d==null||d.scaleExtent(B)}function M(B){d==null||d.translateExtent(B)}function O(B){const $=!Xa(B)||B<0?0:B;d==null||d.clickDistance($)}return{update:v,destroy:b,setViewport:y,setViewportConstrained:w,getViewport:E,scaleTo:N,scaleBy:T,setScaleExtent:z,setTranslateExtent:M,syncViewport:C,setClickDistance:O}}var s_;(function(e){e.Line="line",e.Handle="handle"})(s_||(s_={}));function lAt({width:e,prevWidth:n,height:t,prevHeight:r,affectsX:s,affectsY:i}){const a=e-n,o=t-r,l=[a>0?1:a<0?-1:0,o>0?1:o<0?-1:0];return a&&s&&(l[0]=l[0]*-1),o&&i&&(l[1]=l[1]*-1),l}function gR(e){const n=e.includes("right")||e.includes("left"),t=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:n,isVertical:t,affectsX:r,affectsY:s}}function Hc(e,n){return Math.max(0,n-e)}function qc(e,n){return Math.max(0,e-n)}function d1(e,n,t){return Math.max(0,n-e,e-t)}function vR(e,n){return e?!n:n}function cAt(e,n,t,r,s,i,a,o){let{affectsX:l,affectsY:u}=n;const{isHorizontal:_,isVertical:d}=n,p=_&&d,{xSnapped:m,ySnapped:x}=t,{minWidth:S,maxWidth:v,minHeight:b,maxHeight:w}=r,{x:y,y:C,width:E,height:N,aspectRatio:T}=e;let z=Math.floor(_?m-e.pointerX:0),M=Math.floor(d?x-e.pointerY:0);const O=E+(l?-z:z),B=N+(u?-M:M),$=-i[0]*E,U=-i[1]*N;let H=d1(O,S,v),Y=d1(B,b,w);if(a){let te=0,I=0;l&&z<0?te=Hc(y+z+$,a[0][0]):!l&&z>0&&(te=qc(y+O+$,a[1][0])),u&&M<0?I=Hc(C+M+U,a[0][1]):!u&&M>0&&(I=qc(C+B+U,a[1][1])),H=Math.max(H,te),Y=Math.max(Y,I)}if(o){let te=0,I=0;l&&z>0?te=qc(y+z,o[0][0]):!l&&z<0&&(te=Hc(y+O,o[1][0])),u&&M>0?I=qc(C+M,o[0][1]):!u&&M<0&&(I=Hc(C+B,o[1][1])),H=Math.max(H,te),Y=Math.max(Y,I)}if(s){if(_){const te=d1(O/T,b,w)*T;if(H=Math.max(H,te),a){let I=0;!l&&!u||l&&!u&&p?I=qc(C+U+O/T,a[1][1])*T:I=Hc(C+U+(l?z:-z)/T,a[0][1])*T,H=Math.max(H,I)}if(o){let I=0;!l&&!u||l&&!u&&p?I=Hc(C+O/T,o[1][1])*T:I=qc(C+(l?z:-z)/T,o[0][1])*T,H=Math.max(H,I)}}if(d){const te=d1(B*T,S,v)/T;if(Y=Math.max(Y,te),a){let I=0;!l&&!u||u&&!l&&p?I=qc(y+B*T+$,a[1][0])/T:I=Hc(y+(u?M:-M)*T+$,a[0][0])/T,Y=Math.max(Y,I)}if(o){let I=0;!l&&!u||u&&!l&&p?I=Hc(y+B*T,o[1][0])/T:I=qc(y+(u?M:-M)*T,o[0][0])/T,Y=Math.max(Y,I)}}}M=M+(M<0?Y:-Y),z=z+(z<0?H:-H),s&&(p?O>B*T?M=(vR(l,u)?-z:z)/T:z=(vR(l,u)?-M:M)*T:_?(M=z/T,u=l):(z=M*T,l=u));const V=l?y+z:y,X=u?C+M:C;return{width:E+(l?-z:z),height:N+(u?-M:M),x:i[0]*z*(l?-1:1)+V,y:i[1]*M*(u?-1:1)+X}}const XH={width:0,height:0,x:0,y:0},uAt={...XH,pointerX:0,pointerY:0,aspectRatio:1};function dAt(e,n,t){const r=n.position.x+e.position.x,s=n.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,o=t[0]*i,l=t[1]*a;return[[r-o,s-l],[r+i-o,s+a-l]]}function fAt({domNode:e,nodeId:n,getStoreItems:t,onChange:r,onEnd:s}){const i=Fi(e);let a={controlDirection:gR("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:u,boundaries:_,keepAspectRatio:d,resizeDirection:p,onResizeStart:m,onResize:x,onResizeEnd:S,shouldResize:v}){let b={...XH},w={...uAt};a={boundaries:_,resizeDirection:p,keepAspectRatio:d,controlDirection:gR(u)};let y,C=null,E=[],N,T,z,M=!1;const O=aH().on("start",B=>{const{nodeLookup:$,transform:U,snapGrid:H,snapToGrid:Y,nodeOrigin:V,paneDomNode:X}=t();if(y=$.get(n),!y)return;C=(X==null?void 0:X.getBoundingClientRect())??null;const{xSnapped:te,ySnapped:I}=V0(B.sourceEvent,{transform:U,snapGrid:H,snapToGrid:Y,containerBounds:C});b={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},w={...b,pointerX:te,pointerY:I,aspectRatio:b.width/b.height},N=void 0,T=qd(y.extent)?y.extent:void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(N=$.get(y.parentId)),N&&y.extent==="parent"&&(T=[[0,0],[N.measured.width,N.measured.height]]),E=[],z=void 0;for(const[L,F]of $)if(F.parentId===n&&(E.push({id:L,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const q=dAt(F,y,F.origin??V);z?z=[[Math.min(q[0][0],z[0][0]),Math.min(q[0][1],z[0][1])],[Math.max(q[1][0],z[1][0]),Math.max(q[1][1],z[1][1])]]:z=q}m==null||m(B,{...b})}).on("drag",B=>{const{transform:$,snapGrid:U,snapToGrid:H,nodeOrigin:Y}=t(),V=V0(B.sourceEvent,{transform:$,snapGrid:U,snapToGrid:H,containerBounds:C}),X=[];if(!y)return;const{x:te,y:I,width:L,height:F}=b,q={},G=y.origin??Y,{width:ee,height:ce,x:oe,y:ne}=cAt(w,a.controlDirection,V,a.boundaries,a.keepAspectRatio,G,T,z),Q=ee!==L,le=ce!==F,ae=oe!==te&&Q,ue=ne!==I&≤if(!ae&&!ue&&!Q&&!le)return;if((ae||ue||G[0]===1||G[1]===1)&&(q.x=ae?oe:b.x,q.y=ue?ne:b.y,b.x=q.x,b.y=q.y,E.length>0)){const qe=oe-te,Ie=ne-I;for(const ze of E)ze.position={x:ze.position.x-qe+G[0]*(ee-L),y:ze.position.y-Ie+G[1]*(ce-F)},X.push(ze)}if((Q||le)&&(q.width=Q&&(!a.resizeDirection||a.resizeDirection==="horizontal")?ee:b.width,q.height=le&&(!a.resizeDirection||a.resizeDirection==="vertical")?ce:b.height,b.width=q.width,b.height=q.height),N&&y.expandParent){const qe=G[0]*(q.width??0);q.x&&q.x{M&&(S==null||S(B,{...b}),s==null||s({...b}),M=!1)});i.call(O)}function l(){i.on(".drag",null)}return{update:o,destroy:l}}const hAt={},bR=e=>{let n;const t=new Set,r=(_,d)=>{const p=typeof _=="function"?_(n):_;if(!Object.is(p,n)){const m=n;n=d??(typeof p!="object"||p===null)?p:Object.assign({},n,p),t.forEach(x=>x(n,m))}},s=()=>n,l={setState:r,getState:s,getInitialState:()=>u,subscribe:_=>(t.add(_),()=>t.delete(_)),destroy:()=>{(hAt?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},u=n=e(r,s,l);return l},_At=e=>e?bR(e):bR,{useDebugValue:pAt}=Je,{useSyncExternalStoreWithSelector:mAt}=hV,gAt=e=>e;function ZH(e,n=gAt,t){const r=mAt(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,t);return pAt(r),r}const yR=(e,n)=>{const t=_At(e),r=(s,i=n)=>ZH(t,s,i);return Object.assign(r,t),r},vAt=(e,n)=>e?yR(e,n):yR;function kr(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[r,s]of e)if(!Object.is(s,n.get(r)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}const t=Object.keys(e);if(t.length!==Object.keys(n).length)return!1;for(const r of t)if(!Object.prototype.hasOwnProperty.call(n,r)||!Object.is(e[r],n[r]))return!1;return!0}const cy=R.createContext(null),bAt=cy.Provider,JH=to.error001("react");function An(e,n){const t=R.useContext(cy);if(t===null)throw new Error(JH);return ZH(t,e,n)}function Er(){const e=R.useContext(cy);if(e===null)throw new Error(JH);return R.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const xR={display:"none"},yAt={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},eq="react-flow__node-desc",tq="react-flow__edge-desc",xAt="react-flow__aria-live",wAt=e=>e.ariaLiveMessage,SAt=e=>e.ariaLabelConfig;function kAt({rfId:e}){const n=An(wAt);return f.jsx("div",{id:`${xAt}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:yAt,children:n})}function CAt({rfId:e,disableKeyboardA11y:n}){const t=An(SAt);return f.jsxs(f.Fragment,{children:[f.jsx("div",{id:`${eq}-${e}`,style:xR,children:n?t["node.a11yDescription.default"]:t["node.a11yDescription.keyboardDisabled"]}),f.jsx("div",{id:`${tq}-${e}`,style:xR,children:t["edge.a11yDescription.default"]}),!n&&f.jsx(kAt,{rfId:e})]})}const uy=R.forwardRef(({position:e="top-left",children:n,className:t,style:r,...s},i)=>{const a=`${e}`.split("-");return f.jsx("div",{className:as(["react-flow__panel",t,...a]),style:r,ref:i,...s,children:n})});uy.displayName="Panel";const wR="https://reactflow.dev?utm_source=attribution";function EAt({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:f.jsx(uy,{position:n,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${wR}`,children:f.jsx("a",{href:wR,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const NAt=e=>{const n=[],t=[];for(const[,r]of e.nodeLookup)r.selected&&n.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&t.push(r);return{selectedNodes:n,selectedEdges:t}},f1=e=>e.id;function zAt(e,n){return kr(e.selectedNodes.map(f1),n.selectedNodes.map(f1))&&kr(e.selectedEdges.map(f1),n.selectedEdges.map(f1))}function jAt({onSelectionChange:e}){const n=Er(),{selectedNodes:t,selectedEdges:r}=An(NAt,zAt);return R.useEffect(()=>{const s={nodes:t,edges:r};e==null||e(s),n.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[t,r,e]),null}const TAt=e=>!!e.onSelectionChangeHandlers;function AAt({onSelectionChange:e}){const n=An(TAt);return e||n?f.jsx(jAt,{onSelectionChange:e}):null}const nq=[0,0],RAt={x:0,y:0,zoom:1},MAt=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],SR=[...MAt,"rfId"],DAt=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),kR={translateExtent:Ep,nodeOrigin:nq,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function LAt(e){const{setNodes:n,setEdges:t,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:o,setDefaultNodesAndEdges:l}=An(DAt,kr),u=Er();R.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{_.current=kR,o()}),[]);const _=R.useRef(kR);return R.useEffect(()=>{for(const d of SR){const p=e[d],m=_.current[d];p!==m&&(typeof e[d]>"u"||(d==="nodes"?n(p):d==="edges"?t(p):d==="minZoom"?r(p):d==="maxZoom"?s(p):d==="translateExtent"?i(p):d==="nodeExtent"?a(p):d==="ariaLabelConfig"?u.setState({ariaLabelConfig:CTt(p)}):d==="fitView"?u.setState({fitViewQueued:p}):d==="fitViewOptions"?u.setState({fitViewOptions:p}):u.setState({[d]:p})))}_.current=e},SR.map(d=>e[d])),null}function CR(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function OAt(e){var r;const[n,t]=R.useState(e==="system"?null:e);return R.useEffect(()=>{if(e!=="system"){t(e);return}const s=CR(),i=()=>t(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),n!==null?n:(r=CR())!=null&&r.matches?"dark":"light"}const ER=typeof document<"u"?document:null;function Tp(e=null,n={target:ER,actInsideInputWithModifier:!0}){const[t,r]=R.useState(!1),s=R.useRef(!1),i=R.useRef(new Set([])),[a,o]=R.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",` +`),conflict:null}},wl=e=>e.draft!==e.baseline,cEt=(e,n)=>({...e,draft:n,conflict:n===e.baseline?null:e.conflict}),uEt=e=>e.crlf?e.draft.replace(/\n/g,`\r +`):e.draft;function dEt(e,n,t){return!wl(e)||t&&n===e.version?null:{currentVersion:n,exists:t}}class fEt{constructor(){As(this,"buffer",null);As(this,"listeners",new Set);As(this,"saving",!1);As(this,"saveError",null);As(this,"revision",0);As(this,"saveRevision",0);As(this,"getSnapshot",()=>this.buffer);As(this,"getRevision",()=>this.revision);As(this,"subscribe",n=>(this.listeners.add(n),()=>{this.listeners.delete(n)}));As(this,"set",n=>{this.buffer=n,this.notify()});As(this,"setSaving",n=>{this.saving=n,n&&this.saveRevision++,this.notify()});As(this,"saved",(n,t)=>{this.buffer&&this.set({...this.buffer,baseline:n,version:t,conflict:null})});As(this,"setSaveError",n=>{this.saveError=n,this.notify()})}notify(){this.revision++;for(const n of this.listeners)n()}get needsProtection(){return this.saving||this.buffer!==null&&(wl(this.buffer)||this.buffer.conflict!==null)}}function hEt({projectId:e,filePath:n,sessionId:t,enabled:r,autoRun:s=!0,onManualAction:i,ready:a,source:o}){var X,ee,O;const l=ot({...Sgt(),enabled:r,subscribed:r}),u=((X=l.data)==null?void 0:X.engine)??(l.isPending?void 0:null),_=((ee=l.data)==null?void 0:ee.hint)??null,d=((O=l.data)==null?void 0:O.installCommand)??null,[p,m]=R.useState(!1),[x,S]=R.useState(null),[v,b]=R.useState(null),[w,y]=R.useState(!1),[C,E]=R.useState(null),[N,T]=R.useState(null),[z,M]=R.useState(!1),[I,B]=R.useState(0),$=R.useCallback(L=>{M(L),L&&B(F=>F+1)},[]),U=R.useRef(o);U.current=o;const H=R.useRef(!1),Y=R.useRef(null),V=R.useCallback(()=>{if(H.current)return;Y.current=n,H.current=!0,m(!0);const L=U.current;T(null),b(null),E(null),Dut(e,n,{sessionId:t}).then(F=>{var G,re;const q=F.pdfPath;if(F.ok&&q){S(ce=>({path:q,version:((ce==null?void 0:ce.version)??0)+1,source:L})),y(F.hadErrors),E(F.note),F.hadErrors&&b(((G=F.log)==null?void 0:G.trim())||null),$(!0);return}S(null),y(!1),E(F.note),M(!1),b(((re=F.log)==null?void 0:re.trim())||b3e())}).catch(F=>{S(null),y(!1),E(null),M(!1),T(F instanceof Error?F.message:String(F))}).finally(()=>{H.current=!1,m(!1)})},[e,n,t,$]);return R.useEffect(()=>{!r||!s||!a||!u||Y.current!==n&&V()},[r,s,a,u,n,V]),{engine:u,installHint:_,installCommand:d,compiling:p,compiled:x,stale:x!==null&&x.source!==o,log:v,builtWithErrors:w,note:C,error:N,showPdf:z,setShowPdf:$,viewNonce:I,compile:()=>{i==null||i(),V()},dismiss:()=>{T(null),b(null)}}}const _Et=3e4,pEt=3e4,mEt=5*6e4;function gEt({projectId:e,filePath:n,sessionId:t,enabled:r,autoRun:s=!0,onManualAction:i,savedSource:a,dirty:o,onPulled:l}){var oe,te,Q,le;const u=R.useMemo(()=>Cgt(e,n,{sessionId:t}),[e,n,t]),_=ot({...u,enabled:r,subscribed:r}),d=((oe=_.data)==null?void 0:oe.hasToken)??!1,p=((te=_.data)==null?void 0:te.hasSession)??!1,m=((Q=_.data)==null?void 0:Q.link)??null,x=!_.isPending,[S,v]=R.useState(null),[b,w]=R.useState(0),[y,C]=R.useState(!1),[E,N]=R.useState(null),[T,z]=R.useState(null),[M,I]=R.useState(!1),B=R.useCallback(ae=>{Dn(u.queryKey)&&tt.setQueryData(u.queryKey,de=>de&&{...de,hasSession:ae})},[u]),$=R.useCallback(ae=>{Dn(u.queryKey)&&tt.setQueryData(u.queryKey,ae)},[u]);R.useEffect(()=>{N(null),w(0),L.current=!1,z(null),I(!1),V.current=!1},[r,e,n,t]),R.useEffect(()=>{I(!1)},[a]);const U=R.useRef(!1),H=R.useRef(l);H.current=l;const Y=R.useRef(o);Y.current=o;const V=R.useRef(!1),X=R.useCallback(ae=>!d||!m||U.current||Y.current?!1:(U.current=!0,C(!0),z(null),Uut(e,n,{sessionId:t,resolve:ae}).then(de=>{V.current=!1,N(de),de.pulled.includes(n)&&(Y.current?I(!0):H.current(de.pulled))}).catch(de=>{V.current=!0,N(null),z(de instanceof Error?de.message:String(de))}).finally(()=>{U.current=!1,C(!1)}),!0),[e,n,t,d,m]),ee=R.useRef(null),O=(S==null?void 0:S.state)==="live";R.useEffect(()=>{if(!r||!s||!x||!d||!m||o||O)return;const ae=`${n}:${m.projectId}:${a}`;ee.current!==ae&&X()&&(ee.current=ae)},[r,s,x,d,m,n,a,o,y,X,O]);const L=R.useRef(!1);!y&&E&&E.conflicts.length===0&&!T&&(L.current=!0);const F=r&&x&&!!m&&d&&p&&L.current,q=R.useRef(null),G=R.useRef(Promise.resolve()),re=R.useRef(!1);re.current=(S==null?void 0:S.state)==="stopped"&&S.error!=null;const ce=R.useRef(!1);return R.useEffect(()=>{if(!F)return;let ae=!1;const de=()=>{const we=ce.current;ce.current=!1,!(!we&&re.current)&&(G.current=G.current.then(()=>{if(!ae)return $ut(e,n,{sessionId:t,retry:we}).then(be=>{var Pe;ae||((q.current===null||((Pe=be.status)==null?void 0:Pe.state)==="stopped")&&v(be.status),q.current=be.key)}).catch(be=>{ae||v({state:"stopped",error:be instanceof Error?be.message:String(be),needsSession:!1,note:null})})}))};de();const pe=setInterval(de,pEt);return()=>{ae=!0,clearInterval(pe),q.current=null,v(null),G.current=G.current.then(()=>Put(e,n,{sessionId:t})).catch(()=>{})}},[F,b,e,n,t]),R.useEffect(()=>Jft(ae=>{if(ae.key===q.current){if(ae.type==="live"){v(ae.status);return}ae.paths.includes(n)&&(Y.current?I(!0):H.current(ae.paths))}}),[n]),R.useEffect(()=>{if(!r||!s||!x||!d||!m||o||O)return;const ae=setInterval(()=>{U.current||V.current||tt.fetchQuery({...Egt(e,n,{sessionId:t}),staleTime:0}).then(de=>{de.remoteChanged&&X()}).catch(de=>{V.current=!0,z(de instanceof Error?de.message:String(de))})},_Et);return()=>clearInterval(ae)},[r,s,x,d,m,o,e,n,t,X,O]),R.useEffect(()=>{if(!r||!s||!x||!d||!m||!O)return;const ae=setInterval(X,mEt);return()=>clearInterval(ae)},[r,s,x,d,m,O,X]),{hasToken:d,hasSession:p,live:S,retryLive:()=>{ce.current=!0,w(ae=>ae+1)},link:m,loaded:x,syncing:y,last:E,error:T??((le=_.error)==null?void 0:le.message)??null,blocked:o,staleOnDisk:M,reloaded:()=>I(!1),uploadUrl:Wut(e,n,{sessionId:t}),saveToken:async ae=>{const de=await DL(ae);ee.current=null,V.current=!1,z(null),Dn(u.queryKey)&&tt.setQueryData(u.queryKey,pe=>pe&&{...pe,hasToken:de.hasToken})},saveSession:async ae=>{const de=await LL(ae,{host:m==null?void 0:m.host});B(de.hasSession),ce.current=!0,w(pe=>pe+1)},importSession:async()=>{const ae=await But({host:m==null?void 0:m.host});return B(ae.hasSession),ce.current=!0,w(de=>de+1),ae.source},linkProject:async ae=>{N(null),v(null),L.current=!1,ee.current=null,$(await Hut(e,n,{project:ae,sessionId:t})),i==null||i()},unlink:async()=>{$(await qut(e,n,{sessionId:t})),ee.current=null,V.current=!1,N(null),z(null)},sync:ae=>{V.current=!1,X(ae)&&(ee.current=`${n}:${m==null?void 0:m.projectId}:${a}`,i==null||i())}}}function GF(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")}function OA(e,n,t=!1){const r=n.indexOf("#"),s=r===-1?n:n.slice(0,r),i=r===-1?"":n.slice(r),a=s.indexOf("?"),o=a===-1?s:s.slice(0,a),l=a===-1?"":s.slice(a+1);let u;try{u=decodeURI(o)}catch{return null}if(!u||u.includes("\0"))return null;const _=u.startsWith("/"),d=_?[]:e.split("/").filter(Boolean);for(const p of u.split("/"))if(!(!p||p===".")){if(p===".."){if(d.length===0)return null;d.pop();continue}d.push(p)}return d.length===0?null:{path:`${t&&(_||e.startsWith("/"))?"/":""}${d.join("/")}`,query:l,hash:i}}function vEt(e,n){return`${e}${n.query?`&${n.query}`:""}${n.hash}`}const IA=[{selector:"img[src]",attribute:"src",typePrefixes:["image/"]},{selector:"source[src]",attribute:"src",typePrefixes:["image/","audio/","video/"]},{selector:"video[poster]",attribute:"poster",typePrefixes:["image/"]},{selector:"video[src]",attribute:"src",typePrefixes:["video/"]},{selector:"audio[src]",attribute:"src",typePrefixes:["audio/"]},{selector:'link[rel~="stylesheet"][href]',attribute:"href",typePrefixes:["text/css"]},{selector:"script[src]",attribute:"src",typePrefixes:["text/javascript"]}],bEt=4e6,yEt=200,BA=16e6,xEt=e=>new Promise(n=>{const t=new FileReader;t.onload=()=>n(typeof t.result=="string"?t.result:null),t.onerror=()=>n(null),t.readAsDataURL(e)}),$A=e=>e.startsWith("//")?`https:${e}`:e;async function wEt(e,n){var s;let t=bEt;const r=new Map;for(const{element:i,attribute:a,url:o,typePrefixes:l}of e){if(r.has(o)){const x=r.get(o);x&&i.setAttribute(a,x);continue}if(n.aborted)return;if(r.size>=yEt)continue;r.set(o,null);const u=await fetch(o,{signal:n}).catch(()=>null);if(!(u!=null&&u.ok))continue;const _=u.headers.get("content-type")??"",d=Number(u.headers.get("content-length"));if(!l.some(x=>_.startsWith(x))||!(Number.isFinite(d)&&d>0&&d<=t)){await((s=u.body)==null?void 0:s.cancel().catch(()=>{}));continue}const p=await u.blob().catch(()=>null),m=p&&await xEt(p);!p||!m||(t-=p.size,r.set(o,m),i.setAttribute(a,m))}}async function SEt(e,n,t){var a;const r=new DOMParser().parseFromString(e,"text/html"),s=[];for(const o of r.querySelectorAll(IA.map(l=>l.selector).join(", ")))for(const{selector:l,attribute:u,typePrefixes:_}of IA){if(!o.matches(l))continue;const d=o.getAttribute(u);if(!d)continue;const p=n(d);p&&(p===d?o.setAttribute(u,$A(d)):s.push({element:o,attribute:u,url:p,typePrefixes:_}))}await wEt(s,t);for(const o of r.querySelectorAll("a[href]")){const l=o.getAttribute("href");!l||!GF(l)||(o.setAttribute("href",$A(l)),o.setAttribute("target","_blank"),o.setAttribute("rel","noopener noreferrer"))}const i=((a=r.querySelector("base[href]"))==null?void 0:a.getAttribute("href"))??"";if(!/^https?:\/\//i.test(i)){const o=r.createElement("base");o.setAttribute("href","about:srcdoc"),r.head.prepend(o)}return`${r.doctype?``:""}${r.documentElement.outerHTML}`}async function kEt(e,n,t,r){var o;if(!n)return{text:e,partial:!1};const s=await fetch(t,{signal:r,headers:{Range:`bytes=0-${BA-1}`}}).catch(()=>null),i=s!=null&&s.ok?await s.text().catch(()=>null):null;if(i===null)return{text:e,partial:!0};const a=Number((o=s==null?void 0:s.headers.get("content-range"))==null?void 0:o.split("/").pop());return{text:i,partial:Number.isFinite(a)&&a>BA}}function CEt({html:e,truncated:n,url:t,name:r,resolveSrc:s}){const[i,a]=R.useState(null);return R.useEffect(()=>{let o=!1;const l=new AbortController;return a(null),kEt(e,n,t,l.signal).then(async({text:u,partial:_})=>({source:await SEt(u,s,l.signal),partial:_})).then(u=>{o||a(u)}),()=>{o=!0,l.abort()}},[e,n,t,s]),i===null?f.jsxs("div",{className:"file-view-note flex items-center gap-2 py-2.5 px-4 text-sm text-muted",children:[f.jsx(Lt,{})," ",MD()]}):f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.partial&&f.jsx("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2 px-4 text-sm text-muted",children:Zye()}),f.jsx("iframe",{className:"block min-h-0 flex-1 w-full border-0 bg-white",title:n2e({name:Ne(r)}),sandbox:"allow-scripts allow-popups allow-downloads",referrerPolicy:"no-referrer",srcDoc:i.source})]})}function EEt({overleaf:e}){var d;const n=R.useRef(null),{open:t,setOpen:r,ref:s}=to(n),i=R.useId(),[a,o]=R.useState({top:0,left:0,maxHeight:0}),l=((d=e.last)==null?void 0:d.conflicts.length)??0,u=e.hasToken&&!!e.error,_=u?z4():l?PNe():!e.hasToken||!e.link?oTe():e.syncing?YD():e.blocked?QD():WD();return R.useEffect(()=>{l&&r(!0)},[l,r]),R.useEffect(()=>{u&&Vn(z4(),"error",{id:i,duration:5e3})},[u,e.error,i]),R.useLayoutEffect(()=>{if(!t||!n.current||!s.current)return;const p=n.current.getBoundingClientRect(),m=Math.min(384,window.innerWidth-16),x=Math.min(p.bottom+6,window.innerHeight-80);o({top:x,left:Math.max(8,Math.min(p.right-m,window.innerWidth-m-8)),maxHeight:window.innerHeight-x-8}),(s.current.querySelector("input")??s.current).focus();const S=()=>r(!1),v=b=>{var w;b.target instanceof Node&&!((w=s.current)!=null&&w.contains(b.target))&&S()};return window.addEventListener("resize",S),window.addEventListener("scroll",v,!0),()=>{window.removeEventListener("resize",S),window.removeEventListener("scroll",v,!0)}},[t,s,r]),f.jsxs(f.Fragment,{children:[f.jsx(Yt,{ref:n,size:"small",active:t,disabled:!e.loaded,"data-tip":_,"data-tip-align":"end","aria-label":HQ({status:_}),"aria-haspopup":"dialog","aria-expanded":t,"aria-controls":t?i:void 0,onClick:()=>r(!t),children:e.syncing?f.jsx(Lt,{}):f.jsx(cpt,{size:13,className:u||l?"text-accent-red":e.hasToken&&e.link?"text-accent-green":void 0})}),t&&eo.createPortal(f.jsxs("div",{ref:s,id:i,role:"dialog","aria-label":pL(),tabIndex:-1,className:"fixed z-100 w-96 max-w-[calc(100vw-1rem)] overflow-auto rounded-lg border border-border bg-background p-4 text-text shadow-popover",style:a,onBlur:p=>{var m;p.relatedTarget instanceof Node&&!p.currentTarget.contains(p.relatedTarget)&&!((m=n.current)!=null&&m.contains(p.relatedTarget))&&r(!1)},children:[f.jsx("div",{className:"absolute end-3 top-3",children:f.jsx(Yt,{size:"small","aria-label":Dye(),onClick:()=>{var p;r(!1),(p=n.current)==null||p.focus()},children:f.jsx(qr,{size:13})})}),f.jsx(AEt,{overleaf:e})]}),document.body)]})}const s1=e=>Do(new Intl.ListFormat(j()).format(e.map(Ne)));function NEt(e){if(e.error)return lze();if(e.syncing)return YD();if(e.blocked)return QD();const n=e.last;return n?n.pulled.length&&n.pushed.length?Bje({pulled:s1(n.pulled),pushed:s1(n.pushed)}):n.pulled.length?Dje({paths:s1(n.pulled)}):n.pushed.length?Hje({paths:s1(n.pushed)}):n.conflicts.length?$ze():WD():Eje()}function zEt({href:e}){return f.jsx("a",{className:"text-sm text-subtext whitespace-nowrap",href:e,target:"_blank",rel:"noreferrer",children:KD()})}function jEt(e){return e.state==="live"?yze():e.state==="connecting"?mze():e.error??zze()}function PA({overleaf:e,replacing:n}){const[t,r]=R.useState(""),[s,i]=R.useState(!1),[a,o]=R.useState(!1),[l,u]=R.useState(null),_=p=>{s||(i(!0),u(null),p().then(()=>o(!1)).catch(m=>{u(m instanceof Error?m.message:String(m)),o(!0)}).finally(()=>i(!1)))},d=a?_Te():n?Wje():XNe();return f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsx("p",{className:"text-sm text-subtext",children:d}),a&&f.jsx(ns,{className:"basis-full min-w-0","aria-label":N4(),type:"password",value:t,onChange:p=>r(p.target.value),placeholder:N4(),autoComplete:"off"}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s&&f.jsx(Lt,{}),a?f.jsx(Le,{type:"button",disabled:s||!t.trim(),onClick:()=>_(()=>e.saveSession(t.trim())),children:s?Xi():ONe()}):f.jsx(Le,{type:"button",disabled:s,onClick:()=>_(e.importSession),children:tze()}),f.jsx(Le,{variant:"ghost",type:"button",disabled:s,onClick:()=>o(!a),children:a?VD():Tje()})]}),l&&f.jsx("div",{role:"alert",className:"text-sm text-accent-red whitespace-pre-wrap break-words",children:l})]})}function TEt({overleaf:e}){if(!e.hasSession)return f.jsx(PA,{overleaf:e});const n=e.live;if(!n)return f.jsx("p",{className:"text-sm text-subtext",children:Rze()});const t=n.state==="stopped"&&n.needsSession,r=n.state==="live"?"bg-accent-green":n.state==="connecting"?"bg-accent-amber":"bg-accent-red";return f.jsxs("div",{className:"flex flex-col gap-1.5",children:[f.jsxs("div",{role:n.error?"alert":"status",className:`flex items-center gap-2 text-sm ${n.error?"text-accent-red":"text-subtext"}`,children:[f.jsx("span",{className:`inline-block w-2 h-2 rounded-full shrink-0 ${r}`}),f.jsx("span",{className:"min-w-0 break-words",children:jEt(n)})]}),n.note&&f.jsx("p",{className:"text-sm text-accent-amber",children:n.note}),n.state==="stopped"&&!t&&f.jsx("div",{children:f.jsx(Le,{onClick:e.retryLive,children:kze()})}),t&&f.jsx(PA,{overleaf:e,replacing:!0})]})}function AEt({overleaf:e}){var p,m,x;const[n,t]=R.useState(""),[r,s]=R.useState(!1),[i,a]=R.useState(null),[o,l]=R.useState(!1),u=()=>{t(""),a(null),l(!0)},_=!e.hasToken||o;async function d(S){S.preventDefault();const v=n.trim();if(!(r||!v)){s(!0),a(null);try{_?(await e.saveToken(v),l(!1)):await e.linkProject(v),t("")}catch(b){a(b instanceof Error?b.message:String(b))}finally{s(!1)}}}if(e.link&&!_){const S=((p=e.last)==null?void 0:p.conflicts)??[];return f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsxs("div",{className:"space-y-1.5 pe-8",role:e.error?"alert":"status",children:[f.jsxs("div",{className:`flex items-center gap-2 text-sm font-medium ${e.error?"text-accent-red":"text-text"}`,children:[e.syncing&&f.jsx(Lt,{}),e.error?z4():NEt(e)]}),e.error&&f.jsx("p",{className:"text-sm text-text whitespace-pre-wrap break-words",children:e.error})]}),f.jsx(TEt,{overleaf:e}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(Le,{variant:e.error?"primary":"default",disabled:e.syncing||e.blocked,"data-tip":e.blocked?Yje():((m=e.live)==null?void 0:m.state)==="live"?xTe():void 0,onClick:()=>e.sync(),children:e.error?Fi():dje()}),f.jsxs(Bh,{variant:"ghost",href:e.link.url,target:"_blank",rel:"noreferrer",children:[sje()," ",f.jsx(jd,{size:12})]})]}),S.map(v=>f.jsxs("div",{className:"space-y-2 text-sm",children:[f.jsxs("p",{className:"break-words text-accent-red",children:[f.jsx("code",{className:"font-mono",children:v})," ",Yze()]}),f.jsxs("div",{className:"flex flex-wrap gap-2",children:[f.jsx(Le,{disabled:e.syncing||e.blocked,onClick:()=>e.sync({[v]:"keep-local"}),children:eje()}),f.jsx(Le,{disabled:e.syncing||e.blocked,onClick:()=>e.sync({[v]:"take-overleaf"}),children:wje()})]})]},v)),((x=e.last)==null?void 0:x.note)&&f.jsx("div",{className:"text-sm text-accent-amber",children:e.last.note}),i&&f.jsx("div",{role:"alert",className:"text-sm text-accent-red whitespace-pre-wrap break-words",children:i}),f.jsxs("details",{className:"border-t border-border pt-3",children:[f.jsx("summary",{className:"cursor-pointer text-sm font-semibold text-text focus-visible:outline-2 focus-visible:outline-text",children:f.jsx("span",{className:"ms-2",children:f6()})}),f.jsxs("div",{className:"mt-2 flex flex-col items-start gap-1",children:[f.jsx(Le,{variant:"ghost",className:"font-normal",type:"button",onClick:u,children:pN()}),f.jsx(Bh,{variant:"ghost",className:"font-normal",href:e.uploadUrl,target:"_blank",rel:"noreferrer",children:KD()}),f.jsx(Le,{variant:"ghost",className:"font-normal",disabled:e.syncing,onClick:()=>void e.unlink().catch(v=>{a(v instanceof Error?v.message:String(v))}),children:pje()})]})]})]})}return f.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:d,children:[f.jsx("div",{className:"pe-8 text-sm text-subtext",children:_?zTe():RTe()}),f.jsxs("div",{className:"flex items-center flex-wrap gap-2",children:[f.jsx(ns,{className:"basis-full min-w-0","aria-label":_?hN():_N(),"aria-invalid":!!i,type:_?"password":"text",value:n,onChange:S=>t(S.target.value),placeholder:_?hN():"https://www.overleaf.com/project/…",autoComplete:"off"}),f.jsx(Le,{type:"submit",disabled:r||!n.trim(),children:r?_?Xi():Vi():_?rTe():fze()}),f.jsx("a",{className:"text-sm text-subtext whitespace-nowrap",href:_?"https://www.overleaf.com/user/settings":"https://www.overleaf.com/project",target:"_blank",rel:"noreferrer",children:_?UNe():_N()})]}),(i||e.error)&&f.jsx("div",{role:"alert",className:"text-sm text-accent-red whitespace-pre-wrap break-words",children:i||e.error}),f.jsxs("div",{className:"flex items-center flex-wrap gap-3",children:[f.jsx(zEt,{href:e.uploadUrl}),o?f.jsx(Le,{variant:"ghost",type:"button",onClick:()=>l(!1),children:VD()}):e.hasToken&&f.jsx(Le,{variant:"ghost",type:"button",onClick:u,children:pN()})]})]})}function REt({command:e}){const[n,t]=R.useState("idle"),r=R.useRef(null),s=async()=>{try{await navigator.clipboard.writeText(e),t("copied"),setTimeout(()=>t("idle"),1500)}catch{const i=r.current;if(i){const a=document.createRange();a.selectNodeContents(i);const o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(a)}t("select"),setTimeout(()=>t("idle"),4e3)}};return f.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[f.jsx("code",{ref:r,className:"font-mono text-xs text-text bg-panel border border-border-variant rounded-xs py-1 px-2",children:e}),f.jsx(Yt,{"data-tip":n==="copied"?tp():n==="select"?fxe():lye(),"aria-label":fye(),onClick:()=>void s(),children:n==="copied"?f.jsx(wa,{size:13}):f.jsx(lb,{size:13})})]})}function MEt({projectId:e,path:n,source:t="repo",sessionId:r,gitRef:s,line:i,branchLabel:a,onOpenFile:o,scrollPosition:l,onScrollPositionChange:u,lineScrollRequest:_,onLineScrollRequestHandled:d,onEdit:p,artifactVersion:m,artifactEntries:x=[],bufferSession:S,remote:v=!1,restored:b=!1,onRestoreActivated:w,showSource:y=!1,onShowSourceChange:C}){var xt,At;const E=mI(e,n,t??"repo",r,s),N=ot({...E,enabled:!S.saving}),T=N.data??null,z=((xt=N.error)==null?void 0:xt.message)??null,M=Fe=>{Gr(E.queryKey,_t=>(typeof Fe=="function"?Fe(_t??null):Fe)??void 0)},[I,B]=R.useState(0),$=t==="artifacts",U=t==="abs",H=yk(n),Y=kF(n),V=R9t(n),X=H||V,[ee,O]=R.useState(!1),L=!b||ee,F=()=>{O(!0),w==null||w()};R.useSyncExternalStore(S.subscribe,S.getRevision);const q=S.getSnapshot(),G=S.set,re=S.saving,ce=S.setSaving,oe=S.saveRevision,te=S.saveError,Q=S.setSaveError,le=R.useRef(null),ae=R.useRef(l),de=(T==null?void 0:T.file)??null,pe=q&&wl(q)?q.path:(T==null?void 0:T.source)==="checkout"?T.file.path:n,we=pe.split("/").slice(0,-1).join("/"),be=(T==null?void 0:T.source)==="artifact",Pe=R.useCallback(Fe=>{var _t;return((_t=OA(we,Fe,U))==null?void 0:_t.path)??null},[U,we]),Be=R.useCallback(Fe=>U?jut(Fe):be?Oh(e,Fe):ON(e,Fe,{sessionId:r,ref:s}),[be,s,U,e,r]),ze=R.useCallback(Fe=>{if(GF(Fe))return Fe;const _t=OA(we,Fe,U);return _t?vEt(Be(_t.path),_t):null},[U,we,Be]),it=AF(de==null?void 0:de.presentation),bt=(T==null?void 0:T.source)==="artifact"&&!$,It=$&&(T==null?void 0:T.source)==="checkout",$t=!s&&(T==null?void 0:T.source)==="checkout"&&de!=null&&!de.notFound,jt=r!=null&&(T==null?void 0:T.source)==="checkout"&&T.file.root==="clone",ct=$t&&de!=null&&!de.binary&&!de.truncated&&!it&&!jt,ut=ct&&de.version===void 0,Ht=q!==null&&wl(q),Se=!ut&&(ct&&typeof de.version=="string"||Ht),Ae=(q==null?void 0:q.draft)??u5((de==null?void 0:de.content)??""),Ze=(q==null?void 0:q.baseline)??u5((de==null?void 0:de.content)??""),ht=Se&&q!==null&&wl(q),wt=async Fe=>{const _t=S.getSnapshot();if(!Se||!_t||!wl(_t))return!0;if(S.saving)return!1;if(_t.conflict&&Fe===void 0)return Q(_t.conflict.exists?PE():HE()),!1;const cr=_t.draft,xn=uEt(_t);ce(!0),Q(null);try{await tt.cancelQueries(E);const Ut=await Tut(e,pe,xn,{sessionId:r,expectedVersion:Fe??_t.version});return S.getSnapshot()?(S.saved(cr,Ut.version),M(Qn=>Qn&&Qn.source==="checkout"?{source:"checkout",file:{...Qn.file,content:xn,version:Ut.version}}:Qn),!0):!1}catch(Ut){if(Ut instanceof R4){const ur=S.getSnapshot();return!ur||!wl(ur)||G({...ur,conflict:{currentVersion:Ut.currentVersion,exists:Ut.exists}}),!1}return Q(Ut instanceof Error?Ut.message:String(Ut)),!1}finally{ce(!1)}},en=Y&&$t&&!jt,Ve=hEt({projectId:e,filePath:pe,sessionId:r,enabled:en,autoRun:L,onManualAction:F,ready:de!=null&&!de.notFound,source:Se?Ae:(de==null?void 0:de.content)??""}),qt=gEt({projectId:e,filePath:pe,sessionId:r,enabled:en,autoRun:L,onManualAction:F,savedSource:Ze,dirty:ht,onPulled:R.useCallback(Fe=>{Fe.includes(pe)&&B(_t=>_t+1)},[pe])}),ln=Y&&Ve.showPdf&&Ve.compiled!=null,cn=ut&&Ht,Mt=(Se||cn)&&!(X&&!y)&&!ln,er=Ve.compiled?`${ON(e,Ve.compiled.path,{sessionId:r})}&v=${Ve.compiled.version}`:null,tn=er?`${er}&view=${Ve.viewNonce}#toolbar=0&navpanes=0&statusbar=0`:null,Mr=Ve.compiled?Ve.compiled.path.split("/").pop()??Ve.compiled.path:null,tr=async()=>{ht&&!await wt()||Y&&Ve.engine&&Ve.compile()},qn=async()=>{ht&&(L?await tr():await wt())},[Sr,$n]=R.useState(!1),[Wr,kr]=R.useState(null),gt=async()=>{$n(!0),kr(null);try{await Rut(e,pe,{sessionId:r})}catch(Fe){kr(Fe instanceof Error?Fe.message:String(Fe))}finally{$n(!1)}},un=R.useCallback(()=>{S.saving||B(Fe=>Fe+1)},[S]),vn=()=>{G(null),Q(null),un()},Zt=RF(Be(pe),!s&&!re);R.useEffect(()=>{if(!z||s)return;const Fe=window.setInterval(()=>{document.visibilityState!=="hidden"&&un()},2e3);return()=>window.clearInterval(Fe)},[z,s,un]);const Kn=`${Be(pe)}&v=${encodeURIComponent(Zt??m??"")}&reload=${I}`;R.useEffect(()=>{var cr,xn;if(!T||S.saving)return;const Fe=T,_t=S.getSnapshot();if(_t&&wl(_t)){const Ut=Fe.source==="checkout"?Fe.file:null,ur=Ut!==null&&Ut.path===_t.path&&(!r||Ut.root==="worktree"),Qn=dEt(_t,ur&&typeof Ut.version=="string"?Ut.version:null,ur&&!Ut.notFound);Qn&&(Qn.currentVersion!==((cr=_t.conflict)==null?void 0:cr.currentVersion)||Qn.exists!==((xn=_t.conflict)==null?void 0:xn.exists))?G({..._t,conflict:Qn}):!Qn&&_t.conflict&&G({..._t,conflict:null})}(!_t||!wl(_t))&&Fe.source==="checkout"&&!Fe.file.notFound&&!Fe.file.binary&&!Fe.file.truncated&&typeof Fe.file.version=="string"&&(G(LA(Fe.file.path,Fe.file.content,Fe.file.version)),Q(null))},[T,S,r,re,oe]);const fn=JSON.stringify(E.queryKey),Nn=R.useRef({sourceKey:fn,nonce:I,artifactVersion:m,diskVersion:Zt});R.useEffect(()=>{const Fe=Nn.current;Nn.current={sourceKey:fn,nonce:I,artifactVersion:m,diskVersion:Zt},Fe.sourceKey===fn&&(Fe.nonce!==I||Fe.diskVersion!==null&&Fe.diskVersion!==Zt||Fe.artifactVersion!=null&&Fe.artifactVersion!==m)&&Ngt(e,n,t??"repo",r,s)},[fn,I,m,Zt,e,n,t,r,s]),R.useLayoutEffect(()=>{const Fe=le.current,_t=ae.current;!Fe||!de||!_t||(Fe.scrollTop=_t.top,Fe.scrollLeft=_t.left)},[de]);const Vt=Fe=>{if(Fe.source==="absolute")return x2e();if($)return h2e({root:r?zg():Ng()});if(s)return g2e({branch:Ne(s)});if(r&&Fe.source==="checkout"&&Fe.file.root==="clone")return Fxe();const _t=Fe.source==="checkout"?Fe.file.root:Fe.checkoutRoot;return C2e({root:_t==="worktree"?zg():Ng()})};return f.jsxs("div",{className:"file-view flex flex-col h-full min-h-0 min-w-0",children:[f.jsxs("div",{className:"file-view-header flex w-full min-w-0 min-h-9 items-center gap-1 px-4 py-1 bg-background text-text shrink-0",children:[f.jsx(Kh,{name:pe}),f.jsx("span",{className:"file-view-path flex-1 min-w-0 truncate text-sm text-subtext","data-tip":Ne(pe),children:pe.split("/").pop()||pe}),a&&f.jsxs("span",{className:"file-view-branch inline-flex items-center gap-1 min-w-0 text-xs text-muted border border-border-variant rounded-sm py-px px-1.5 max-w-65 overflow-hidden text-ellipsis whitespace-nowrap shrink-0 [&_svg]:flex-none",title:gK({branch:Ne(a)}),children:[f.jsx(Jp,{size:11}),a]}),Mt&&(re||ht||te)&&f.jsx("span",{className:`file-view-save-status inline-flex items-center gap-1 text-sm shrink-0 ${te?"text-accent-red":"text-muted"}`,title:te??(re?Xi():Mxe()),children:re?f.jsxs(f.Fragment,{children:[f.jsx(Lt,{})," ",lxe()]}):te?sxe():DD()}),Y&&Ve.compiled&&f.jsx(Yt,{size:"small",active:!Ve.showPdf,"data-tip":Ve.stale&&Ve.showPdf?U2e():Ve.showPdf?Zf():VE(),"data-tip-align":"end","aria-label":Ve.showPdf?Zf():VE(),onClick:()=>Ve.setShowPdf(!Ve.showPdf),children:Ve.showPdf?f.jsx(Z4,{size:13}):f.jsx(cb,{size:13,className:Ve.stale?"text-accent-amber":void 0})}),Y&&er&&Mr&&f.jsx(nb,{size:"small","data-tip":Ve.stale?Fye({name:Ne(Mr)}):eE({name:Ne(Mr)}),"data-tip-align":"end","aria-label":eE({name:Ne(Mr)}),href:er,download:Mr,children:f.jsx(ppt,{size:13,className:Ve.stale?"text-accent-amber":void 0})}),en&&f.jsx(EEt,{overleaf:qt}),Y&&$t&&f.jsx(Yt,{size:"small","data-tip":Ve.compiled?WE():FE(),"data-tip-align":"end","aria-label":Ve.compiled?WE():FE(),disabled:Ve.compiling||!Ve.engine,onClick:()=>void tr(),children:Ve.compiling?f.jsx(Lt,{}):f.jsx(ypt,{size:13})}),X&&f.jsx(Yt,{size:"small",active:y,"data-tip":y?tv():Zf(),"data-tip-align":"end","aria-label":y?tv():Zf(),onClick:()=>C==null?void 0:C(!y),children:f.jsx(Z4,{size:13})}),$t&&!v&&f.jsx(Yt,{size:"small","data-tip":Wr??GE(),"data-tip-align":"end","aria-label":GE(),disabled:Sr,onClick:()=>void gt(),children:Sr?f.jsx(Lt,{}):f.jsx(jd,{size:13})})]}),!z&&It&&(T==null?void 0:T.source)==="checkout"&&f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted border-b border-b-border-variant shrink-0",children:j2e({root:T.file.root==="worktree"?zg():Ng()})}),ut&&f.jsx("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2.5 px-4 text-sm text-accent-amber",children:Ixe()}),z&&de!==null&&f.jsxs("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2.5 px-4 text-sm text-accent-red",children:[UE()," ",Ne(z)]}),(q==null?void 0:q.conflict)&&f.jsxs("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2.5 px-4 flex items-center flex-wrap gap-2 text-sm text-accent-amber",children:[f.jsx("span",{className:"flex-1 min-w-0",role:"status",children:q.conflict.exists?PE():HE()}),((At=q==null?void 0:q.conflict)==null?void 0:At.exists)&&q.conflict.currentVersion&&f.jsx(Le,{disabled:re,onPointerDown:Fe=>Fe.preventDefault(),onClick:()=>{var Fe;return void wt(((Fe=q.conflict)==null?void 0:Fe.currentVersion)??void 0)},children:P2e()}),f.jsx(Le,{disabled:re,onPointerDown:Fe=>Fe.preventDefault(),onClick:vn,children:exe()})]}),(Ve.error||Ve.log)&&f.jsxs("div",{className:"file-view-note shrink-0 max-h-45 overflow-auto border-b border-b-border-variant py-2.5 px-4",children:[f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx("span",{className:`flex-1 min-w-0 text-sm ${Ve.builtWithErrors?"text-subtext":"text-accent-red"}`,children:Ve.error??(Ve.builtWithErrors?sye():Xbe())}),f.jsx(Yt,{"data-tip":Eye(),"data-tip-align":"end","aria-label":Tye(),onClick:Ve.dismiss,children:f.jsx(qr,{size:13})})]}),Ve.log&&f.jsx("pre",{className:"mt-1.5 mb-0 font-mono text-xs text-subtext whitespace-pre-wrap wrap-anywhere",children:Ve.log})]}),en&&qt.staleOnDisk&&f.jsxs("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2.5 px-4 flex items-center flex-wrap gap-2 text-sm text-accent-amber",children:[f.jsx("span",{className:"flex-1 min-w-0",children:O2e()}),f.jsx(Le,{onClick:()=>{qt.reloaded(),B(Fe=>Fe+1)},children:bye()})]}),Y&&$t&&Ve.engine===null&&Ve.installHint&&f.jsxs("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2.5 px-4 text-sm text-subtext",children:[Ve.installHint,Ve.installCommand&&f.jsx(REt,{command:Ve.installCommand})]}),Ve.note&&f.jsx("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2 px-4 text-sm text-accent-amber",children:Ve.note}),ln&&Ve.stale&&f.jsx("div",{className:"file-view-note shrink-0 border-b border-b-border-variant py-2 px-4 text-sm text-subtext",children:wxe()}),f.jsxs("div",{ref:le,className:"file-view-body flex-1 min-h-0 overflow-auto bg-background",onScroll:Fe=>{const _t={top:Math.max(0,Fe.currentTarget.scrollTop),left:Math.max(0,Fe.currentTarget.scrollLeft)};ae.current=_t,u==null||u(_t)},children:[!Mt&&!z&&!$&&(T==null?void 0:T.source)==="checkout"&&!T.file.notFound&&!s&&r&&T.file.root==="clone"&&f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:Exe()}),!Mt&&!z&&(T==null?void 0:T.source)==="artifact"&&!T.file.notFound&&bt&&f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:Pbe({root:T.checkoutRoot==="worktree"?zg():Ng()})}),z&&de===null?f.jsxs("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:[UE()," ",Ne(z)]}):de===null?f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:MD()}):Mt?f.jsx(VP,{value:Ae,onChange:Fe=>{const _t=S.getSnapshot()??(de&&typeof de.version=="string"?LA(de.path,de.content,de.version):null);_t&&G(cEt(_t,Fe)),p==null||p(),te&&Q(null)},onSave:()=>void qn(),onBlur:()=>{c5||qn()},readOnly:cn,path:n,highlightLine:i,scrollRequest:_,onScrollRequestHandled:d,scrollPosition:ae.current,onScrollPositionChange:Fe=>{ae.current=Fe,u==null||u(Fe)}}):de.notFound?f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:T?Vt(T):c2e()}):it?f.jsx(l5,{kind:it,url:Kn,name:n.split("/").pop()??n}):de.binary?f.jsxs("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:[Ube()," ",f.jsx("a",{href:Kn,download:n.split("/").pop()??n,children:RD()})]}):ln&&tn&&Mr?f.jsx(l5,{kind:"pdf",url:tn,name:Mr,downloadBar:!1},tn):H&&!y?f.jsx("div",{className:"file-view-md max-w-readable pt-4.5 px-5 pb-8 [&_.md]:text-base [&_.md_h1]:text-2xl [&_.md_h1]:mt-4.5 [&_.md_h1]:mx-0 [&_.md_h1]:mb-2 [&_.md_h2]:text-xl [&_.md_h2]:mt-4 [&_.md_h2]:mx-0 [&_.md_h2]:mb-2 [&_.md_h3]:text-lg",children:be?f.jsx(IF,{projectId:e,folder:we,markdown:de.content,entries:x}):f.jsx($o,{text:de.content,resolveFilePath:Pe,resolveImageSrc:ze,onOpenFile:o&&((Fe,_t,cr,xn,Ut)=>o(Fe,r,s,Ut))})}):V&&!y?f.jsx(CEt,{html:de.content,truncated:de.truncated,url:Kn,name:pe,resolveSrc:ze}):f.jsxs(f.Fragment,{children:[f.jsx(TF,{text:de.content,path:n,highlightLine:i,scrollRequest:_,onScrollRequestHandled:d}),de.truncated&&f.jsx("div",{className:"file-view-note py-2.5 px-4 text-sm text-muted",children:Kye()})]})]})]})}const Bw=["project-menu-label inline-flex items-center gap-2 min-w-0 overflow-hidden","text-ellipsis whitespace-nowrap"].join(" ");function DEt({projectName:e,onHome:n,onNewProject:t,onRepository:r,onCollapse:s}){const{open:i,setOpen:a,ref:o}=to(),l=R.useRef(null);return R.useEffect(()=>{if(!i)return;const u=_=>{var d;_.key==="Escape"&&((d=l.current)==null||d.focus())};return document.addEventListener("keydown",u,!0),()=>document.removeEventListener("keydown",u,!0)},[i]),f.jsx("div",{className:"rail-brand px-3 py-1.5 border-b border-border shrink-0",children:f.jsxs("div",{className:"project-switcher relative min-w-0",ref:o,children:[f.jsxs("div",{className:"flex h-7 items-center justify-between gap-1 px-0.5",children:[f.jsx(Yt,{size:"small",className:"project-back text-text","aria-label":KE(),onClick:n,children:f.jsx(ap,{size:18})}),f.jsx("span",{className:"brand-project-label flex-1 text-xs font-medium tracking-wide uppercase text-subtext",children:c4e()}),s&&f.jsx(Yt,{size:"small","data-tip":QE(),"data-tip-align":"end","aria-label":QE(),onClick:s,children:f.jsx(KO,{size:18})})]}),f.jsxs("button",{ref:l,className:`brand group flex h-8 w-full min-w-0 items-center gap-2 rounded-md px-2 text-start text-text hover:bg-surface focus-visible:outline-2 focus-visible:outline-text ${i?"open bg-surface":""}`,onClick:()=>a(u=>!u),"aria-expanded":i,children:[f.jsx("span",{className:"brand-project min-w-0 flex-1 truncate text-xl font-semibold",children:e}),f.jsx(qo,{className:`project-chevron shrink-0 text-muted transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100 ${i?"rotate-180 opacity-100":"opacity-0"}`,size:14})]}),i&&f.jsxs("div",{className:"option-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-95 flex flex-col bg-background border border-border rounded-lg shadow-menu overflow-hidden min-w-47.5 p-1.5 [&.align-right]:start-auto [&.align-right]:end-0 [&.drop-down]:bottom-auto [&.drop-down]:top-[calc(100%_+_4px)] [&.session-menu]:start-auto [&.session-menu]:end-1.5 [&.session-menu]:top-[calc(100%_-_2px)] [&.session-menu]:min-w-35 drop-down project-menu w-52.5 z-70",children:[f.jsx(ir,{onClick:()=>{a(!1),r()},children:f.jsxs("span",{className:Bw,children:[f.jsx(UO,{size:14}),Zwe()]})}),f.jsx(ir,{onClick:()=>{a(!1),n()},children:f.jsxs("span",{className:Bw,children:[f.jsx(Bpt,{size:14}),KE()]})}),f.jsx(ir,{onClick:()=>{var u;(u=l.current)==null||u.focus(),a(!1),t()},children:f.jsxs("span",{className:Bw,children:[f.jsx(Ept,{size:14}),n4e()]})})]})]})})}function LEt({runs:e,experiments:n,emptyHint:t,onOpen:r,onOpenLogs:s,onOpenCode:i,onCancel:a}){const[o,l]=R.useState(new Set),[u,_]=R.useState(null),d=new Map;for(const x of e){const S=d.get(x.experimentId);S?S.push(x):d.set(x.experimentId,[x])}for(const x of d.values())x.sort((S,v)=>v.createdAt-S.createdAt);const p=[...n].sort((x,S)=>{var w,y,C,E;const v=((y=(w=d.get(x.id))==null?void 0:w[0])==null?void 0:y.createdAt)??x.createdAt;return(((E=(C=d.get(S.id))==null?void 0:C[0])==null?void 0:E.createdAt)??S.createdAt)-v});if(p.length===0)return f.jsx(wk,{icon:ub,title:t??Nve(),description:t?void 0:bve()});async function m(x){_(null),l(S=>new Set(S).add(x));try{await a(x)}catch(S){l(v=>{const b=new Set(v);return b.delete(x),b}),_(S instanceof Error?S.message:String(S))}}return f.jsxs("div",{className:"experiments-table-wrap absolute inset-0 overflow-auto bg-background @container",children:[u&&f.jsxs("div",{className:"experiments-table-error py-2 px-3 text-accent-red text-sm border-b border-b-border",role:"alert",children:[hbe()," ",u]}),f.jsx("div",{className:"experiments-table w-full text-sm bg-background",role:"list","aria-label":ibe(),children:p.map(x=>{const S=d.get(x.id)??[],v=S[0]??null,b=S.find(E=>E.status==="running"||E.status==="starting"),w=b??v,y=!!(b&&(b.cancelRequested||o.has(b.id))),C=b?y?"cancelling":Hi(b):v?Hi(v):"idle";return f.jsxs("div",{className:"experiment-table-group grid grid-cols-[minmax(0,_1fr)_auto] [grid-template-areas:'name_meta'_'actions_actions'] gap-x-8 items-center py-4 px-5 gap-y-[7px] border-b border-b-divider-subtle bg-background cursor-pointer [&:hover]:bg-canvas [&:last-child]:border-b-0 [@container((max-width:_560px))]:grid-cols-[minmax(0,_1fr)_auto] [@container((max-width:_560px))]:gap-x-3.5 [@container((max-width:_560px))]:gap-y-[9px] [@container((max-width:_400px))]:grid-cols-[minmax(0,_1fr)] [@container((max-width:_400px))]:[grid-template-areas:'name'_'meta'_'actions']",role:"listitem",onClick:()=>r(x,"preview"),onDoubleClick:()=>r(x,"keepOpen"),onAuxClick:E=>{E.button===1&&(E.preventDefault(),r(x,"keepOpen"))},children:[f.jsxs("div",{className:"experiment-table-name [grid-area:name] self-start min-w-0",children:[f.jsx("button",{type:"button",className:"experiment-table-title block w-full overflow-hidden text-text font-semibold text-start text-ellipsis whitespace-nowrap",...Ur(E=>r(x,E),{stopPropagation:!0}),children:x.title||x.slug}),f.jsxs("span",{className:"experiment-table-subtitle flex items-center min-w-0 gap-1.5 mt-1 overflow-hidden text-subtext text-sm [&_>_svg]:shrink-0 [&_code]:min-w-0 [&_code]:overflow-hidden [&_code]:text-ellipsis [&_code]:whitespace-nowrap",title:x.branchName,children:[f.jsx(Jp,{size:14,"aria-hidden":"true"}),f.jsx("code",{children:x.branchName})]})]}),f.jsxs("div",{className:"experiment-table-meta [grid-area:meta] self-start flex items-center justify-end gap-4.5 whitespace-nowrap [@container((max-width:_560px))]:flex-col [@container((max-width:_560px))]:items-end [@container((max-width:_560px))]:gap-1.5 [@container((max-width:_400px))]:!flex-row [@container((max-width:_400px))]:!items-center [@container((max-width:_400px))]:flex-wrap [@container((max-width:_400px))]:justify-start [@container((max-width:_400px))]:gap-3",children:[f.jsx("div",{className:"experiment-table-status flex items-center min-w-0",children:f.jsx(Il,{status:C})}),f.jsx("div",{className:"experiment-run-summary flex items-center min-w-0 gap-2 text-subtext text-sm font-medium",children:f.jsx("span",{children:S.length===1?Lve():qve({count:Wt(S.length)})})}),f.jsx("div",{className:"experiment-table-latest flex items-center gap-1.5 min-w-0 text-subtext text-sm font-medium whitespace-nowrap",children:f.jsx("span",{children:v?Io(v.createdAt):Ave()})})]}),f.jsxs("div",{className:"experiment-table-actions [grid-area:actions] flex flex-wrap items-center justify-start gap-2 mt-3",role:"group","aria-label":cK({name:x.title||x.slug}),onClick:E=>E.stopPropagation(),onDoubleClick:E=>E.stopPropagation(),onAuxClick:E=>E.stopPropagation(),children:[f.jsxs(Le,{size:"small",disabled:!w,title:w?$ve():Sve(),...Ur(E=>{w&&s(x.id,w.id,E)},{stopPropagation:!0}),children:[f.jsx($h,{size:15}),cbe()]}),f.jsxs(Le,{size:"small",title:fD({branch:Ne(x.branchName)}),...Ur(E=>i(x.id,E),{stopPropagation:!0}),children:[f.jsx(db,{size:15}),tbe()]}),b&&f.jsxs(Le,{size:"small",variant:"danger",className:"[@container((max-width:_560px))]:ms-auto",disabled:y,title:y?Vve():Xve(),onClick:()=>void m(b.id),children:[f.jsx($O,{size:15}),y?Tpe():jD()]})]})]},x.id)})})]})}function OEt({onClose:e,onCreateProject:n}){const[t,r]=R.useState(!1),[s,i]=R.useState(null),a=R.useRef(null),o=R.useCallback(l=>{t||(r(!0),i(null),l().catch(()=>i(Fat())).finally(()=>r(!1)))},[t]);return R.useEffect(()=>{const l=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),o(e))};return document.addEventListener("keydown",l,!0),()=>document.removeEventListener("keydown",l,!0)},[e,o]),R.useEffect(()=>{const l=a.current;if(!l)return;const u=document.activeElement instanceof HTMLElement?document.activeElement:null,_=()=>[...l.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])')];(_()[0]??l).focus();const d=p=>{if(p.key!=="Tab")return;const m=_();if(m.length===0){p.preventDefault(),l.focus();return}const x=m[0],S=m[m.length-1];p.shiftKey&&document.activeElement===x?(p.preventDefault(),S.focus()):!p.shiftKey&&document.activeElement===S&&(p.preventDefault(),x.focus())};return document.addEventListener("keydown",d,!0),()=>{document.removeEventListener("keydown",d,!0),u==null||u.focus()}},[]),eo.createPortal(f.jsx("div",{className:"fixed inset-0 z-200 flex items-center justify-center bg-modal-backdrop p-5",children:f.jsxs("div",{ref:a,className:"relative w-110 max-w-full rounded-xl border border-border bg-background p-6 shadow-modal",role:"dialog","aria-modal":"true","aria-labelledby":"demo-welcome-title",tabIndex:-1,children:[f.jsx(Yt,{className:"absolute end-3.5 top-3.5","aria-label":gat(),onClick:()=>o(e),disabled:t,children:f.jsx(qr,{size:16})}),f.jsxs("div",{className:"mb-5 flex items-center gap-3 pe-8",children:[f.jsx("span",{className:"block h-9 w-9 shrink-0 [&_svg]:block [&_svg]:h-full [&_svg]:w-full",children:f.jsx(B6,{})}),f.jsxs("div",{children:[f.jsx("div",{className:"mb-0.5 text-xs font-medium tracking-[0.08em] text-primary uppercase",children:Cat()}),f.jsx("h2",{id:"demo-welcome-title",className:"m-0 text-2xl leading-tight tracking-[-0.02em]",children:Qat()})]})]}),f.jsxs("div",{className:"text-base leading-relaxed text-text [&_p]:m-0 [&_p_+_p]:mt-3",children:[f.jsxs("p",{dir:"auto",children:[Gat()," ",f.jsx("a",{dir:"ltr",href:"https://github.com/karpathy/nanochat",target:"_blank",rel:"noreferrer",className:"font-medium text-primary underline decoration-border-strong underline-offset-3 hover:decoration-primary",children:Iat()}),hat()]}),f.jsx("p",{dir:"auto",children:Mat()})]}),s&&f.jsx("p",{className:"mt-3 mb-0 text-sm text-accent-red",children:s}),f.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-end gap-2.5",children:[f.jsx(Le,{onClick:()=>o(n),disabled:t,children:xat()}),f.jsx(Le,{variant:"primary",onClick:()=>o(e),disabled:t,children:t?Xi():jat()})]})]})}),document.body)}function is(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let t=0,r;t{}};function ty(){for(var e=0,n=arguments.length,t={},r;e=0&&(r=t.slice(s+1),t=t.slice(0,s)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}})}L1.prototype=ty.prototype={constructor:L1,on:function(e,n){var t=this._,r=BEt(e+"",t),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var t=new Array(s),r=0,s,i;r=0&&(n=e.slice(0,t))!=="xmlns"&&(e=e.slice(t+1)),HA.hasOwnProperty(n)?{space:HA[n],local:e}:e}function PEt(e){return function(){var n=this.ownerDocument,t=this.namespaceURI;return t===d5&&n.documentElement.namespaceURI===d5?n.createElement(e):n.createElementNS(t,e)}}function FEt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function WF(e){var n=ny(e);return(n.local?FEt:PEt)(n)}function HEt(){}function Sk(e){return e==null?HEt:function(){return this.querySelector(e)}}function qEt(e){typeof e!="function"&&(e=Sk(e));for(var n=this._groups,t=n.length,r=new Array(t),s=0;s=y&&(y=w+1);!(E=v[y])&&++y=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function _Nt(e){e||(e=pNt);function n(d,p){return d&&p?e(d.__data__,p.__data__):!d-!p}for(var t=this._groups,r=t.length,s=new Array(r),i=0;in?1:e>=n?0:NaN}function mNt(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function gNt(){return Array.from(this)}function vNt(){for(var e=this._groups,n=0,t=e.length;n1?this.each((n==null?jNt:typeof n=="function"?ANt:TNt)(e,n,t??"")):Qh(this.node(),e)}function Qh(e,n){return e.style.getPropertyValue(n)||XF(e).getComputedStyle(e,null).getPropertyValue(n)}function MNt(e){return function(){delete this[e]}}function DNt(e,n){return function(){this[e]=n}}function LNt(e,n){return function(){var t=n.apply(this,arguments);t==null?delete this[e]:this[e]=t}}function ONt(e,n){return arguments.length>1?this.each((n==null?MNt:typeof n=="function"?LNt:DNt)(e,n)):this.node()[e]}function ZF(e){return e.trim().split(/^|\s+/)}function kk(e){return e.classList||new JF(e)}function JF(e){this._node=e,this._names=ZF(e.getAttribute("class")||"")}JF.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function eH(e,n){for(var t=kk(e),r=-1,s=n.length;++r=0&&(t=n.slice(r+1),n=n.slice(0,r)),{type:n,name:t}})}function uzt(e){return function(){var n=this.__on;if(n){for(var t=0,r=-1,s=n.length,i;t()=>e;function f5(e,{sourceEvent:n,subject:t,target:r,identifier:s,active:i,x:a,y:o,dx:l,dy:u,dispatch:_}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:_}})}f5.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function yzt(e){return!e.ctrlKey&&!e.button}function xzt(){return this.parentNode}function wzt(e,n){return n??{x:e.x,y:e.y}}function Szt(){return navigator.maxTouchPoints||"ontouchstart"in this}function aH(){var e=yzt,n=xzt,t=wzt,r=Szt,s={},i=ty("start","drag","end"),a=0,o,l,u,_,d=0;function p(C){C.on("mousedown.drag",m).filter(r).on("touchstart.drag",v).on("touchmove.drag",b,bzt).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(C,E){if(!(_||!e.call(this,C,E))){var N=y(this,n.call(this,C,E),C,E,"mouse");N&&(Bi(C.view).on("mousemove.drag",x,wp).on("mouseup.drag",S,wp),sH(C.view),$w(C),u=!1,o=C.clientX,l=C.clientY,N("start",C))}}function x(C){if(fh(C),!u){var E=C.clientX-o,N=C.clientY-l;u=E*E+N*N>d}s.mouse("drag",C)}function S(C){Bi(C.view).on("mousemove.drag mouseup.drag",null),iH(C.view,u),fh(C),s.mouse("end",C)}function v(C,E){if(e.call(this,C,E)){var N=C.changedTouches,T=n.call(this,C,E),z=N.length,M,I;for(M=0;M>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):t===8?a1(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):t===4?a1(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=Czt.exec(e))?new wi(n[1],n[2],n[3],1):(n=Ezt.exec(e))?new wi(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=Nzt.exec(e))?a1(n[1],n[2],n[3],n[4]):(n=zzt.exec(e))?a1(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=jzt.exec(e))?QA(n[1],n[2]/100,n[3]/100,1):(n=Tzt.exec(e))?QA(n[1],n[2]/100,n[3]/100,n[4]):qA.hasOwnProperty(e)?WA(qA[e]):e==="transparent"?new wi(NaN,NaN,NaN,0):null}function WA(e){return new wi(e>>16&255,e>>8&255,e&255,1)}function a1(e,n,t,r){return r<=0&&(e=n=t=NaN),new wi(e,n,t,r)}function Mzt(e){return e instanceof hm||(e=Od(e)),e?(e=e.rgb(),new wi(e.r,e.g,e.b,e.opacity)):new wi}function h5(e,n,t,r){return arguments.length===1?Mzt(e):new wi(e,n,t,r??1)}function wi(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}Ck(wi,h5,oH(hm,{brighter(e){return e=e==null?Rv:Math.pow(Rv,e),new wi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Sp:Math.pow(Sp,e),new wi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wi(kd(this.r),kd(this.g),kd(this.b),Mv(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:VA,formatHex:VA,formatHex8:Dzt,formatRgb:KA,toString:KA}));function VA(){return`#${id(this.r)}${id(this.g)}${id(this.b)}`}function Dzt(){return`#${id(this.r)}${id(this.g)}${id(this.b)}${id((isNaN(this.opacity)?1:this.opacity)*255)}`}function KA(){const e=Mv(this.opacity);return`${e===1?"rgb(":"rgba("}${kd(this.r)}, ${kd(this.g)}, ${kd(this.b)}${e===1?")":`, ${e})`}`}function Mv(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function kd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function id(e){return e=kd(e),(e<16?"0":"")+e.toString(16)}function QA(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new Va(e,n,t,r)}function lH(e){if(e instanceof Va)return new Va(e.h,e.s,e.l,e.opacity);if(e instanceof hm||(e=Od(e)),!e)return new Va;if(e instanceof Va)return e;e=e.rgb();var n=e.r/255,t=e.g/255,r=e.b/255,s=Math.min(n,t,r),i=Math.max(n,t,r),a=NaN,o=i-s,l=(i+s)/2;return o?(n===i?a=(t-r)/o+(t0&&l<1?0:a,new Va(a,o,l,e.opacity)}function Lzt(e,n,t,r){return arguments.length===1?lH(e):new Va(e,n,t,r??1)}function Va(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}Ck(Va,Lzt,oH(hm,{brighter(e){return e=e==null?Rv:Math.pow(Rv,e),new Va(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Sp:Math.pow(Sp,e),new Va(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,s=2*t-r;return new wi(Pw(e>=240?e-240:e+120,s,r),Pw(e,s,r),Pw(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Va(YA(this.h),o1(this.s),o1(this.l),Mv(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Mv(this.opacity);return`${e===1?"hsl(":"hsla("}${YA(this.h)}, ${o1(this.s)*100}%, ${o1(this.l)*100}%${e===1?")":`, ${e})`}`}}));function YA(e){return e=(e||0)%360,e<0?e+360:e}function o1(e){return Math.max(0,Math.min(1,e||0))}function Pw(e,n,t){return(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)*255}const Ek=e=>()=>e;function Ozt(e,n){return function(t){return e+t*n}}function Izt(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}function Bzt(e){return(e=+e)==1?cH:function(n,t){return t-n?Izt(n,t,e):Ek(isNaN(n)?t:n)}}function cH(e,n){var t=n-e;return t?Ozt(e,t):Ek(isNaN(e)?n:e)}const Dv=(function e(n){var t=Bzt(n);function r(s,i){var a=t((s=h5(s)).r,(i=h5(i)).r),o=t(s.g,i.g),l=t(s.b,i.b),u=cH(s.opacity,i.opacity);return function(_){return s.r=a(_),s.g=o(_),s.b=l(_),s.opacity=u(_),s+""}}return r.gamma=e,r})(1);function $zt(e,n){n||(n=[]);var t=e?Math.min(n.length,e.length):0,r=n.slice(),s;return function(i){for(s=0;st&&(i=n.slice(t,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:jo(r,s)})),t=Fw.lastIndex;return t180?_+=360:_-u>180&&(u+=360),p.push({i:d.push(s(d)+"rotate(",null,r)-2,x:jo(u,_)})):_&&d.push(s(d)+"rotate("+_+r)}function o(u,_,d,p){u!==_?p.push({i:d.push(s(d)+"skewX(",null,r)-2,x:jo(u,_)}):_&&d.push(s(d)+"skewX("+_+r)}function l(u,_,d,p,m,x){if(u!==d||_!==p){var S=m.push(s(m)+"scale(",null,",",null,")");x.push({i:S-4,x:jo(u,d)},{i:S-2,x:jo(_,p)})}else(d!==1||p!==1)&&m.push(s(m)+"scale("+d+","+p+")")}return function(u,_){var d=[],p=[];return u=e(u),_=e(_),i(u.translateX,u.translateY,_.translateX,_.translateY,d,p),a(u.rotate,_.rotate,d,p),o(u.skewX,_.skewX,d,p),l(u.scaleX,u.scaleY,_.scaleX,_.scaleY,d,p),u=_=null,function(m){for(var x=-1,S=p.length,v;++x=0&&e._call.call(void 0,n),e=e._next;--Yh}function JA(){Id=(Ov=Cp.now())+ry,Yh=z0=0;try{ejt()}finally{Yh=0,njt(),Id=0}}function tjt(){var e=Cp.now(),n=e-Ov;n>hH&&(ry-=n,Ov=e)}function njt(){for(var e,n=Lv,t,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Lv=t);j0=e,m5(r)}function m5(e){if(!Yh){z0&&(z0=clearTimeout(z0));var n=e-Id;n>24?(e<1/0&&(z0=setTimeout(JA,e-Cp.now()-ry)),y0&&(y0=clearInterval(y0))):(y0||(Ov=Cp.now(),y0=setInterval(tjt,hH)),Yh=1,_H(JA))}}function eR(e,n,t){var r=new Iv;return n=n==null?0:+n,r.restart(s=>{r.stop(),e(s+n)},n,t),r}var rjt=ty("start","end","cancel","interrupt"),sjt=[],mH=0,tR=1,g5=2,I1=3,nR=4,v5=5,B1=6;function sy(e,n,t,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(t in a)return;ijt(e,t,{name:n,index:r,group:s,on:rjt,tween:sjt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:mH})}function zk(e,n){var t=no(e,n);if(t.state>mH)throw new Error("too late; already scheduled");return t}function Qo(e,n){var t=no(e,n);if(t.state>I1)throw new Error("too late; already running");return t}function no(e,n){var t=e.__transition;if(!t||!(t=t[n]))throw new Error("transition not found");return t}function ijt(e,n,t){var r=e.__transition,s;r[n]=t,t.timer=pH(i,0,t.time);function i(u){t.state=tR,t.timer.restart(a,t.delay,t.time),t.delay<=u&&a(u-t.delay)}function a(u){var _,d,p,m;if(t.state!==tR)return l();for(_ in r)if(m=r[_],m.name===t.name){if(m.state===I1)return eR(a);m.state===nR?(m.state=B1,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[_]):+_g5&&r.state=0&&(n=n.slice(0,t)),!n||n==="start"})}function Ljt(e,n,t){var r,s,i=Djt(n)?zk:Qo;return function(){var a=i(this,e),o=a.on;o!==r&&(s=(r=o).copy()).on(n,t),a.on=s}}function Ojt(e,n){var t=this._id;return arguments.length<2?no(this.node(),t).on.on(e):this.each(Ljt(t,e,n))}function Ijt(e){return function(){var n=this.parentNode;for(var t in this.__transition)if(+t!==e)return;n&&n.removeChild(this)}}function Bjt(){return this.on("end.remove",Ijt(this._id))}function $jt(e){var n=this._name,t=this._id;typeof e!="function"&&(e=Sk(e));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>e;function uTt(e,{sourceEvent:n,target:t,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function Dl(e,n,t){this.k=e,this.x=n,this.y=t}Dl.prototype={constructor:Dl,scale:function(e){return e===1?this:new Dl(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Dl(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var iy=new Dl(1,0,0);yH.prototype=Dl.prototype;function yH(e){for(;!e.__zoom;)if(!(e=e.parentNode))return iy;return e.__zoom}function Hw(e){e.stopImmediatePropagation()}function x0(e){e.preventDefault(),e.stopImmediatePropagation()}function dTt(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function fTt(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function rR(){return this.__zoom||iy}function hTt(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function _Tt(){return navigator.maxTouchPoints||"ontouchstart"in this}function pTt(e,n,t){var r=e.invertX(n[0][0])-t[0][0],s=e.invertX(n[1][0])-t[1][0],i=e.invertY(n[0][1])-t[0][1],a=e.invertY(n[1][1])-t[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function xH(){var e=dTt,n=fTt,t=pTt,r=hTt,s=_Tt,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,l=O1,u=ty("start","zoom","end"),_,d,p,m=500,x=150,S=0,v=10;function b(H){H.property("__zoom",rR).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",I).filter(s).on("touchstart.zoom",B).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",U).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(H,Y,V,X){var ee=H.selection?H.selection():H;ee.property("__zoom",rR),H!==ee?E(H,Y,V,X):ee.interrupt().each(function(){N(this,arguments).event(X).start().zoom(null,typeof Y=="function"?Y.apply(this,arguments):Y).end()})},b.scaleBy=function(H,Y,V,X){b.scaleTo(H,function(){var ee=this.__zoom.k,O=typeof Y=="function"?Y.apply(this,arguments):Y;return ee*O},V,X)},b.scaleTo=function(H,Y,V,X){b.transform(H,function(){var ee=n.apply(this,arguments),O=this.__zoom,L=V==null?C(ee):typeof V=="function"?V.apply(this,arguments):V,F=O.invert(L),q=typeof Y=="function"?Y.apply(this,arguments):Y;return t(y(w(O,q),L,F),ee,a)},V,X)},b.translateBy=function(H,Y,V,X){b.transform(H,function(){return t(this.__zoom.translate(typeof Y=="function"?Y.apply(this,arguments):Y,typeof V=="function"?V.apply(this,arguments):V),n.apply(this,arguments),a)},null,X)},b.translateTo=function(H,Y,V,X,ee){b.transform(H,function(){var O=n.apply(this,arguments),L=this.__zoom,F=X==null?C(O):typeof X=="function"?X.apply(this,arguments):X;return t(iy.translate(F[0],F[1]).scale(L.k).translate(typeof Y=="function"?-Y.apply(this,arguments):-Y,typeof V=="function"?-V.apply(this,arguments):-V),O,a)},X,ee)};function w(H,Y){return Y=Math.max(i[0],Math.min(i[1],Y)),Y===H.k?H:new Dl(Y,H.x,H.y)}function y(H,Y,V){var X=Y[0]-V[0]*H.k,ee=Y[1]-V[1]*H.k;return X===H.x&&ee===H.y?H:new Dl(H.k,X,ee)}function C(H){return[(+H[0][0]+ +H[1][0])/2,(+H[0][1]+ +H[1][1])/2]}function E(H,Y,V,X){H.on("start.zoom",function(){N(this,arguments).event(X).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(X).end()}).tween("zoom",function(){var ee=this,O=arguments,L=N(ee,O).event(X),F=n.apply(ee,O),q=V==null?C(F):typeof V=="function"?V.apply(ee,O):V,G=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),re=ee.__zoom,ce=typeof Y=="function"?Y.apply(ee,O):Y,oe=l(re.invert(q).concat(G/re.k),ce.invert(q).concat(G/ce.k));return function(te){if(te===1)te=ce;else{var Q=oe(te),le=G/Q[2];te=new Dl(le,q[0]-Q[0]*le,q[1]-Q[1]*le)}L.zoom(null,te)}})}function N(H,Y,V){return!V&&H.__zooming||new T(H,Y)}function T(H,Y){this.that=H,this.args=Y,this.active=0,this.sourceEvent=null,this.extent=n.apply(H,Y),this.taps=0}T.prototype={event:function(H){return H&&(this.sourceEvent=H),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(H,Y){return this.mouse&&H!=="mouse"&&(this.mouse[1]=Y.invert(this.mouse[0])),this.touch0&&H!=="touch"&&(this.touch0[1]=Y.invert(this.touch0[0])),this.touch1&&H!=="touch"&&(this.touch1[1]=Y.invert(this.touch1[0])),this.that.__zoom=Y,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(H){var Y=Bi(this.that).datum();u.call(H,this.that,new uTt(H,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:u}),Y)}};function z(H,...Y){if(!e.apply(this,arguments))return;var V=N(this,Y).event(H),X=this.__zoom,ee=Math.max(i[0],Math.min(i[1],X.k*Math.pow(2,r.apply(this,arguments)))),O=Ha(H);if(V.wheel)(V.mouse[0][0]!==O[0]||V.mouse[0][1]!==O[1])&&(V.mouse[1]=X.invert(V.mouse[0]=O)),clearTimeout(V.wheel);else{if(X.k===ee)return;V.mouse=[O,X.invert(O)],$1(this),V.start()}x0(H),V.wheel=setTimeout(L,x),V.zoom("mouse",t(y(w(X,ee),V.mouse[0],V.mouse[1]),V.extent,a));function L(){V.wheel=null,V.end()}}function M(H,...Y){if(p||!e.apply(this,arguments))return;var V=H.currentTarget,X=N(this,Y,!0).event(H),ee=Bi(H.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",G,!0),O=Ha(H,V),L=H.clientX,F=H.clientY;sH(H.view),Hw(H),X.mouse=[O,this.__zoom.invert(O)],$1(this),X.start();function q(re){if(x0(re),!X.moved){var ce=re.clientX-L,oe=re.clientY-F;X.moved=ce*ce+oe*oe>S}X.event(re).zoom("mouse",t(y(X.that.__zoom,X.mouse[0]=Ha(re,V),X.mouse[1]),X.extent,a))}function G(re){ee.on("mousemove.zoom mouseup.zoom",null),iH(re.view,X.moved),x0(re),X.event(re).end()}}function I(H,...Y){if(e.apply(this,arguments)){var V=this.__zoom,X=Ha(H.changedTouches?H.changedTouches[0]:H,this),ee=V.invert(X),O=V.k*(H.shiftKey?.5:2),L=t(y(w(V,O),X,ee),n.apply(this,Y),a);x0(H),o>0?Bi(this).transition().duration(o).call(E,L,X,H):Bi(this).call(b.transform,L,X,H)}}function B(H,...Y){if(e.apply(this,arguments)){var V=H.touches,X=V.length,ee=N(this,Y,H.changedTouches.length===X).event(H),O,L,F,q;for(Hw(H),L=0;L`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:n,sourceHandle:t,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?t:r}", edge id: ${n}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Ep=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],wH=["Enter"," ","Escape"],SH={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:n,y:t})=>`Moved selected node ${e}. New position, x: ${n}, y: ${t}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Xh;(function(e){e.Strict="strict",e.Loose="loose"})(Xh||(Xh={}));var Cd;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Cd||(Cd={}));var Np;(function(e){e.Partial="partial",e.Full="full"})(Np||(Np={}));const kH={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Bc;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Bc||(Bc={}));var Bv;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Bv||(Bv={}));var Et;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Et||(Et={}));const sR={[Et.Left]:Et.Right,[Et.Right]:Et.Left,[Et.Top]:Et.Bottom,[Et.Bottom]:Et.Top};function CH(e){return e===null?null:e?"valid":"invalid"}const EH=e=>"id"in e&&"source"in e&&"target"in e,mTt=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Tk=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),_m=(e,n=[0,0])=>{const{width:t,height:r}=Kl(e),s=e.origin??n,i=t*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},gTt=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const t=e.reduce((r,s)=>{const i=typeof s=="string";let a=!n.nodeLookup&&!i?s:void 0;n.nodeLookup&&(a=i?n.nodeLookup.get(s):Tk(s)?s:n.nodeLookup.get(s.id));const o=a?$v(a,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ay(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return oy(t)},pm=(e,n={})=>{let t={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(n.filter===void 0||n.filter(s))&&(t=ay(t,$v(s)),r=!0)}),r?oy(t):{x:0,y:0,width:0,height:0}},Ak=(e,n,[t,r,s]=[0,0,1],i=!1,a=!1)=>{const o=(n.x-t)/s,l=(n.y-r)/s,u=n.width/s,_=n.height/s,d=[];for(const p of e.values()){const{measured:m,selectable:x=!0,hidden:S=!1}=p;if(a&&!x||S)continue;const v=m.width??p.width??p.initialWidth??0,b=m.height??p.height??p.initialHeight??0,{x:w,y}=p.internals.positionAbsolute,C=TH(o,l,u,_,w,y,v,b),E=v*b,N=i&&C>0;(!p.internals.handleBounds||N||C>=E||p.dragging)&&d.push(p)}return d},vTt=(e,n)=>{const t=new Set;return e.forEach(r=>{t.add(r.id)}),n.filter(r=>t.has(r.source)||t.has(r.target))};function bTt(e,n){const t=new Map,r=n!=null&&n.nodes?new Set(n.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((n==null?void 0:n.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&t.set(s.id,s)}),t}async function yTt({nodes:e,width:n,height:t,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return!0;const o=bTt(e,a),l=pm(o),u=Mk(l,n,t,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function NH({nodeId:e,nextPosition:n,nodeLookup:t,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const a=t.get(e),o=a.parentId?t.get(a.parentId):void 0,{x:l,y:u}=o?o.internals.positionAbsolute:{x:0,y:0},_=a.origin??r;let d=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!o)i==null||i("005",Ja.error005());else{const m=o.measured.width,x=o.measured.height;m&&x&&(d=[[l,u],[l+m,u+x]])}else o&&$d(a.extent)&&(d=[[a.extent[0][0]+l,a.extent[0][1]+u],[a.extent[1][0]+l,a.extent[1][1]+u]]);const p=$d(d)?Bd(n,d,a.measured):n;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",Ja.error015())),{position:{x:p.x-l+(a.measured.width??0)*_[0],y:p.y-u+(a.measured.height??0)*_[1]},positionAbsolute:p}}async function xTt({nodesToRemove:e=[],edgesToRemove:n=[],nodes:t,edges:r,onBeforeDelete:s}){const i=new Set(e.map(p=>p.id)),a=[];for(const p of t){if(p.deletable===!1)continue;const m=i.has(p.id),x=!m&&p.parentId&&a.find(S=>S.id===p.parentId);(m||x)&&a.push(p)}const o=new Set(n.map(p=>p.id)),l=r.filter(p=>p.deletable!==!1),_=vTt(a,l);for(const p of l)o.has(p.id)&&!_.find(x=>x.id===p.id)&&_.push(p);if(!s)return{edges:_,nodes:a};const d=await s({nodes:a,edges:_});return typeof d=="boolean"?d?{edges:_,nodes:a}:{edges:[],nodes:[]}:d}const Zh=(e,n=0,t=1)=>Math.min(Math.max(e,n),t),Bd=(e={x:0,y:0},n,t)=>({x:Zh(e.x,n[0][0],n[1][0]-((t==null?void 0:t.width)??0)),y:Zh(e.y,n[0][1],n[1][1]-((t==null?void 0:t.height)??0))});function zH(e,n,t){const{width:r,height:s}=Kl(t),{x:i,y:a}=t.internals.positionAbsolute;return Bd(e,[[i,a],[i+r,a+s]],n)}const iR=(e,n,t)=>et?-Zh(Math.abs(e-t),1,n)/n:0,Rk=(e,n,t=15,r=40)=>{const s=iR(e.x,r,n.width-r)*t,i=iR(e.y,r,n.height-r)*t;return[s,i]},ay=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),b5=({x:e,y:n,width:t,height:r})=>({x:e,y:n,x2:e+t,y2:n+r}),oy=({x:e,y:n,x2:t,y2:r})=>({x:e,y:n,width:t-e,height:r-n}),zp=(e,n=[0,0])=>{var s,i;const{x:t,y:r}=Tk(e)?e.internals.positionAbsolute:_m(e,n);return{x:t,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},$v=(e,n=[0,0])=>{var s,i;const{x:t,y:r}=Tk(e)?e.internals.positionAbsolute:_m(e,n);return{x:t,y:r,x2:t+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},jH=(e,n)=>oy(ay(b5(e),b5(n))),TH=(e,n,t,r,s,i,a,o)=>{const l=Math.max(0,Math.min(e+t,s+a)-Math.max(e,s)),u=Math.max(0,Math.min(n+r,i+o)-Math.max(n,i));return Math.ceil(l*u)},Pv=(e,n)=>TH(e.x,e.y,e.width,e.height,n.x,n.y,n.width,n.height),aR=e=>Qa(e.width)&&Qa(e.height)&&Qa(e.x)&&Qa(e.y),Qa=e=>!isNaN(e)&&isFinite(e),AH=(e,n)=>(t,r)=>{},mm=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),gm=({x:e,y:n},[t,r,s],i=!1,a=[1,1])=>{const o={x:(e-t)/s,y:(n-r)/s};return i?mm(o,a):o},Jh=({x:e,y:n},[t,r,s])=>({x:e*s+t,y:n*s+r});function Uf(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e=="string"&&e.endsWith("%")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(n*t*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function wTt(e,n,t){if(typeof e=="string"||typeof e=="number"){const r=Uf(e,t),s=Uf(e,n);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Uf(e.top??e.y??0,t),s=Uf(e.bottom??e.y??0,t),i=Uf(e.left??e.x??0,n),a=Uf(e.right??e.x??0,n);return{top:r,right:a,bottom:s,left:i,x:i+a,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function STt(e,n,t,r,s,i){const{x:a,y:o}=Jh(e,[n,t,r]),{x:l,y:u}=Jh({x:e.x+e.width,y:e.y+e.height},[n,t,r]),_=s-l,d=i-u;return{left:Math.floor(a),top:Math.floor(o),right:Math.floor(_),bottom:Math.floor(d)}}const Mk=(e,n,t,r,s,i)=>{const a=wTt(i,n,t),o=(n-a.x)/e.width,l=(t-a.y)/e.height,u=Math.min(o,l),_=Zh(u,r,s),d=e.x+e.width/2,p=e.y+e.height/2,m=n/2-d*_,x=t/2-p*_,S=STt(e,m,x,_,n,t),v={left:Math.min(S.left-a.left,0),top:Math.min(S.top-a.top,0),right:Math.min(S.right-a.right,0),bottom:Math.min(S.bottom-a.bottom,0)};return{x:m-v.left+v.right,y:x-v.top+v.bottom,zoom:_}},jp=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function $d(e){return e!=null&&e!=="parent"}function Kl(e){var n,t;return{width:((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth??0,height:((t=e.measured)==null?void 0:t.height)??e.height??e.initialHeight??0}}function RH(e){var n,t;return(((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth)!==void 0&&(((t=e.measured)==null?void 0:t.height)??e.height??e.initialHeight)!==void 0}function MH(e,n={width:0,height:0},t,r,s){const i={...e},a=r.get(t);if(a){const o=a.origin||s;i.x+=a.internals.positionAbsolute.x-(n.width??0)*o[0],i.y+=a.internals.positionAbsolute.y-(n.height??0)*o[1]}return i}function oR(e,n){if(e.size!==n.size)return!1;for(const t of e)if(!n.has(t))return!1;return!0}function kTt(){let e,n;return{promise:new Promise((r,s)=>{e=r,n=s}),resolve:e,reject:n}}function CTt(e){return{...SH,...e||{}}}function W0(e,{snapGrid:n=[0,0],snapToGrid:t=!1,transform:r,containerBounds:s}){const{x:i,y:a}=Ya(e),o=gm({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:l,y:u}=t?mm(o,n):o;return{xSnapped:l,ySnapped:u,...o}}const Dk=e=>({width:e.offsetWidth,height:e.offsetHeight}),DH=e=>{var n;return((n=e==null?void 0:e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},ETt=["INPUT","SELECT","TEXTAREA"];function LH(e){var r,s;const n=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(n==null?void 0:n.nodeType)!==1?!1:ETt.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const OH=e=>"clientX"in e,Ya=(e,n)=>{var i,a;const t=OH(e),r=t?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=t?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((n==null?void 0:n.left)??0),y:s-((n==null?void 0:n.top)??0)}},lR=(e,n,t,r,s)=>{const i=n.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(a=>{const o=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:s,position:a.getAttribute("data-handlepos"),x:(o.left-t.left)/r,y:(o.top-t.top)/r,...Dk(a)}})};function IH({sourceX:e,sourceY:n,targetX:t,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:o}){const l=e*.125+s*.375+a*.375+t*.125,u=n*.125+i*.375+o*.375+r*.125,_=Math.abs(l-e),d=Math.abs(u-n);return[l,u,_,d]}function u1(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function cR({pos:e,x1:n,y1:t,x2:r,y2:s,c:i}){switch(e){case Et.Left:return[n-u1(n-r,i),t];case Et.Right:return[n+u1(r-n,i),t];case Et.Top:return[n,t-u1(t-s,i)];case Et.Bottom:return[n,t+u1(s-t,i)]}}function BH({sourceX:e,sourceY:n,sourcePosition:t=Et.Bottom,targetX:r,targetY:s,targetPosition:i=Et.Top,curvature:a=.25}){const[o,l]=cR({pos:t,x1:e,y1:n,x2:r,y2:s,c:a}),[u,_]=cR({pos:i,x1:r,y1:s,x2:e,y2:n,c:a}),[d,p,m,x]=IH({sourceX:e,sourceY:n,targetX:r,targetY:s,sourceControlX:o,sourceControlY:l,targetControlX:u,targetControlY:_});return[`M${e},${n} C${o},${l} ${u},${_} ${r},${s}`,d,p,m,x]}function $H({sourceX:e,sourceY:n,targetX:t,targetY:r}){const s=Math.abs(t-e)/2,i=t0}const jTt=({source:e,sourceHandle:n,target:t,targetHandle:r})=>`xy-edge__${e}${n||""}-${t}${r||""}`,TTt=(e,n)=>n.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),ATt=(e,n,t={})=>{var i;if(!e.source||!e.target)return(i=t.onError)==null||i.call(t,"006",Ja.error006()),n;const r=t.getEdgeId||jTt;let s;return EH(e)?s={...e}:s={...e,id:r(e)},TTt(s,n)?n:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,n.concat(s))};function PH({sourceX:e,sourceY:n,targetX:t,targetY:r}){const[s,i,a,o]=$H({sourceX:e,sourceY:n,targetX:t,targetY:r});return[`M ${e},${n}L ${t},${r}`,s,i,a,o]}const uR={[Et.Left]:{x:-1,y:0},[Et.Right]:{x:1,y:0},[Et.Top]:{x:0,y:-1},[Et.Bottom]:{x:0,y:1}},RTt=({source:e,sourcePosition:n=Et.Bottom,target:t})=>n===Et.Left||n===Et.Right?e.xMath.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function MTt({source:e,sourcePosition:n=Et.Bottom,target:t,targetPosition:r=Et.Top,center:s,offset:i,stepPosition:a}){const o=uR[n],l=uR[r],u={x:e.x+o.x*i,y:e.y+o.y*i},_={x:t.x+l.x*i,y:t.y+l.y*i},d=RTt({source:u,sourcePosition:n,target:_}),p=d.x!==0?"x":"y",m=d[p];let x=[],S,v;const b={x:0,y:0},w={x:0,y:0},[,,y,C]=$H({sourceX:e.x,sourceY:e.y,targetX:t.x,targetY:t.y});if(o[p]*l[p]===-1){p==="x"?(S=s.x??u.x+(_.x-u.x)*a,v=s.y??(u.y+_.y)/2):(S=s.x??(u.x+_.x)/2,v=s.y??u.y+(_.y-u.y)*a);const z=[{x:S,y:u.y},{x:S,y:_.y}],M=[{x:u.x,y:v},{x:_.x,y:v}];o[p]===m?x=p==="x"?z:M:x=p==="x"?M:z}else{const z=[{x:u.x,y:_.y}],M=[{x:_.x,y:u.y}];if(p==="x"?x=o.x===m?M:z:x=o.y===m?z:M,n===r){const H=Math.abs(e[p]-t[p]);if(H<=i){const Y=Math.min(i-1,i-H);o[p]===m?b[p]=(u[p]>e[p]?-1:1)*Y:w[p]=(_[p]>t[p]?-1:1)*Y}}if(n!==r){const H=p==="x"?"y":"x",Y=o[p]===l[H],V=u[H]>_[H],X=u[H]<_[H];(o[p]===1&&(!Y&&V||Y&&X)||o[p]!==1&&(!Y&&X||Y&&V))&&(x=p==="x"?z:M)}const I={x:u.x+b.x,y:u.y+b.y},B={x:_.x+w.x,y:_.y+w.y},$=Math.max(Math.abs(I.x-x[0].x),Math.abs(B.x-x[0].x)),U=Math.max(Math.abs(I.y-x[0].y),Math.abs(B.y-x[0].y));$>=U?(S=(I.x+B.x)/2,v=x[0].y):(S=x[0].x,v=(I.y+B.y)/2)}const E={x:u.x+b.x,y:u.y+b.y},N={x:_.x+w.x,y:_.y+w.y};return[[e,...E.x!==x[0].x||E.y!==x[0].y?[E]:[],...x,...N.x!==x[x.length-1].x||N.y!==x[x.length-1].y?[N]:[],t],S,v,y,C]}function DTt(e,n,t,r){const s=Math.min(dR(e,n)/2,dR(n,t)/2,r),{x:i,y:a}=n;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return`L${i} ${a}`;if(e.y===a){const u=e.xt.id===n):e[0])||null}function x5(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function OTt(e,{id:n,defaultColor:t,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((a,o)=>([o.markerStart||r,o.markerEnd||s].forEach(l=>{if(l&&typeof l=="object"){const u=x5(l,n);i.has(u)||(a.push({id:u,color:l.color||t,...l}),i.add(u))}}),a),[]).sort((a,o)=>a.id.localeCompare(o.id))}const FH=1e3,ITt=10,Lk={nodeOrigin:[0,0],nodeExtent:Ep,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},BTt={...Lk,checkEquality:!0};function Ok(e,n){const t={...e};for(const r in n)n[r]!==void 0&&(t[r]=n[r]);return t}function $Tt(e,n,t){const r=Ok(Lk,t);for(const s of e.values())if(s.parentId)Bk(s,e,n,r);else{const i=_m(s,r.nodeOrigin),a=$d(s.extent)?s.extent:r.nodeExtent,o=Bd(i,a,Kl(s));s.internals.positionAbsolute=o}}function PTt(e,n){if(!e.handles)return e.measured?n==null?void 0:n.internals.handleBounds:void 0;const t=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?t.push(i):s.type==="target"&&r.push(i)}return{source:t,target:r}}function Ik(e){return e==="manual"}function w5(e,n,t,r={}){var _,d;const s=Ok(BTt,r),i={i:0},a=new Map(n),o=s!=null&&s.elevateNodesOnSelect&&!Ik(s.zIndexMode)?FH:0;let l=e.length>0,u=!1;n.clear(),t.clear();for(const p of e){let m=a.get(p.id);if(s.checkEquality&&p===(m==null?void 0:m.internals.userNode))n.set(p.id,m);else{const x=_m(p,s.nodeOrigin),S=$d(p.extent)?p.extent:s.nodeExtent,v=Bd(x,S,Kl(p));m={...s.defaults,...p,measured:{width:(_=p.measured)==null?void 0:_.width,height:(d=p.measured)==null?void 0:d.height},internals:{positionAbsolute:v,handleBounds:PTt(p,m),z:HH(p,o,s.zIndexMode),userNode:p}},n.set(p.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(l=!1),p.parentId&&Bk(m,n,t,r,i),u||(u=p.selected??!1)}return{nodesInitialized:l,hasSelectedNodes:u}}function FTt(e,n){if(!e.parentId)return;const t=n.get(e.parentId);t?t.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function Bk(e,n,t,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:o,zIndexMode:l}=Ok(Lk,r),u=e.parentId,_=n.get(u);if(!_){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}FTt(e,t),s&&!_.parentId&&_.internals.rootParentIndex===void 0&&l==="auto"&&(_.internals.rootParentIndex=++s.i,_.internals.z=_.internals.z+s.i*ITt),s&&_.internals.rootParentIndex!==void 0&&(s.i=_.internals.rootParentIndex);const d=i&&!Ik(l)?FH:0,{x:p,y:m,z:x}=HTt(e,_,a,o,d,l),{positionAbsolute:S}=e.internals,v=p!==S.x||m!==S.y;(v||x!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:p,y:m}:S,z:x}})}function HH(e,n,t){const r=Qa(e.zIndex)?e.zIndex:0;return Ik(t)?r:r+(e.selected?n:0)}function HTt(e,n,t,r,s,i){const{x:a,y:o}=n.internals.positionAbsolute,l=Kl(e),u=_m(e,t),_=$d(e.extent)?Bd(u,e.extent,l):u;let d=Bd({x:a+_.x,y:o+_.y},r,l);e.extent==="parent"&&(d=zH(d,l,n));const p=HH(e,s,i),m=n.internals.z??0;return{x:d.x,y:d.y,z:m>=p?m+1:p}}function $k(e,n,t,r=[0,0]){var a;const s=[],i=new Map;for(const o of e){const l=n.get(o.parentId);if(!l)continue;const u=((a=i.get(o.parentId))==null?void 0:a.expandedRect)??zp(l),_=jH(u,o.rect);i.set(o.parentId,{expandedRect:_,parent:l})}return i.size>0&&i.forEach(({expandedRect:o,parent:l},u)=>{var y;const _=l.internals.positionAbsolute,d=Kl(l),p=l.origin??r,m=o.x<_.x?Math.round(Math.abs(_.x-o.x)):0,x=o.y<_.y?Math.round(Math.abs(_.y-o.y)):0,S=Math.max(d.width,Math.round(o.width)),v=Math.max(d.height,Math.round(o.height)),b=(S-d.width)*p[0],w=(v-d.height)*p[1];(m>0||x>0||b||w)&&(s.push({id:u,type:"position",position:{x:l.position.x-m+b,y:l.position.y-x+w}}),(y=t.get(u))==null||y.forEach(C=>{e.some(E=>E.id===C.id)||s.push({id:C.id,type:"position",position:{x:C.position.x+m,y:C.position.y+x}})})),(d.width0){const m=$k(p,n,t,s);u.push(...m)}return{changes:u,updatedInternals:l}}async function UTt({delta:e,panZoom:n,transform:t,translateExtent:r,width:s,height:i}){if(!n||!e.x&&!e.y)return!1;const a=await n.setViewportConstrained({x:t[0]+e.x,y:t[1]+e.y,zoom:t[2]},[[0,0],[s,i]],r);return!!a&&(a.x!==t[0]||a.y!==t[1]||a.k!==t[2])}function pR(e,n,t,r,s,i){let a=s;const o=r.get(a)||new Map;r.set(a,o.set(t,n)),a=`${s}-${e}`;const l=r.get(a)||new Map;if(r.set(a,l.set(t,n)),i){a=`${s}-${e}-${i}`;const u=r.get(a)||new Map;r.set(a,u.set(t,n))}}function qH(e,n,t){e.clear(),n.clear();for(const r of t){const{source:s,target:i,sourceHandle:a=null,targetHandle:o=null}=r,l={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:o},u=`${s}-${a}--${i}-${o}`,_=`${i}-${o}--${s}-${a}`;pR("source",l,_,e,s,a),pR("target",l,u,e,i,o),n.set(r.id,r)}}function UH(e,n){if(!e.parentId)return!1;const t=n.get(e.parentId);return t?t.selected?!0:UH(t,n):!1}function mR(e,n,t){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,n))return!0;if(r===t)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function GTt(e,n,t,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!UH(a,e))&&(a.draggable||n&&typeof a.draggable>"u")){const o=e.get(i);o&&s.set(i,{id:i,position:o.position||{x:0,y:0},distance:{x:t.x-o.internals.positionAbsolute.x,y:t.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return s}function qw({nodeId:e,dragItems:n,nodeLookup:t,dragging:r=!0}){var a,o,l;const s=[];for(const[u,_]of n){const d=(a=t.get(u))==null?void 0:a.internals.userNode;d&&s.push({...d,position:_.position,dragging:r})}if(!e)return[s[0],s];const i=(o=t.get(e))==null?void 0:o.internals.userNode;return[i?{...i,position:((l=n.get(e))==null?void 0:l.position)||i.position,dragging:r}:s[0],s]}function WTt({dragItems:e,snapGrid:n,x:t,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:t-s.distance.x,y:r-s.distance.y},a=mm(i,n);return{x:a.x-i.x,y:a.y-i.y}}function VTt({onNodeMouseDown:e,getStoreItems:n,onDragStart:t,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,o=new Map,l=!1,u={x:0,y:0},_=null,d=!1,p=null,m=!1,x=!1,S=null;function v({noDragClassName:w,handleSelector:y,domNode:C,isSelectable:E,nodeId:N,nodeClickDistance:T=0}){p=Bi(C);function z({x:$,y:U}){const{nodeLookup:H,nodeExtent:Y,snapGrid:V,snapToGrid:X,nodeOrigin:ee,onNodeDrag:O,onSelectionDrag:L,onError:F,updateNodePositions:q}=n();i={x:$,y:U};let G=!1;const re=o.size>1,ce=re&&Y?b5(pm(o)):null,oe=re&&X?WTt({dragItems:o,snapGrid:V,x:$,y:U}):null;for(const[te,Q]of o){if(!H.has(te))continue;let le={x:$-Q.distance.x,y:U-Q.distance.y};X&&(le=oe?{x:Math.round(le.x+oe.x),y:Math.round(le.y+oe.y)}:mm(le,V));let ae=null;if(re&&Y&&!Q.extent&&ce){const{positionAbsolute:we}=Q.internals,be=we.x-ce.x+Y[0][0],Pe=we.x+Q.measured.width-ce.x2+Y[1][0],Be=we.y-ce.y+Y[0][1],ze=we.y+Q.measured.height-ce.y2+Y[1][1];ae=[[be,Be],[Pe,ze]]}const{position:de,positionAbsolute:pe}=NH({nodeId:te,nextPosition:le,nodeLookup:H,nodeExtent:ae||Y,nodeOrigin:ee,onError:F});G=G||Q.position.x!==de.x||Q.position.y!==de.y,Q.position=de,Q.internals.positionAbsolute=pe}if(x=x||G,!!G&&(q(o,!0),S&&(r||O||!N&&L))){const[te,Q]=qw({nodeId:N,dragItems:o,nodeLookup:H});r==null||r(S,o,te,Q),O==null||O(S,te,Q),N||L==null||L(S,Q)}}async function M(){if(!_)return;const{transform:$,panBy:U,autoPanSpeed:H,autoPanOnNodeDrag:Y}=n();if(!Y){l=!1,cancelAnimationFrame(a);return}const[V,X]=Rk(u,_,H);(V!==0||X!==0)&&(i.x=(i.x??0)-V/$[2],i.y=(i.y??0)-X/$[2],await U({x:V,y:X})&&z(i)),a=requestAnimationFrame(M)}function I($){var re;const{nodeLookup:U,multiSelectionActive:H,nodesDraggable:Y,transform:V,snapGrid:X,snapToGrid:ee,selectNodesOnDrag:O,onNodeDragStart:L,onSelectionDragStart:F,unselectNodesAndEdges:q}=n();d=!0,(!O||!E)&&!H&&N&&((re=U.get(N))!=null&&re.selected||q()),E&&O&&N&&(e==null||e(N));const G=W0($.sourceEvent,{transform:V,snapGrid:X,snapToGrid:ee,containerBounds:_});if(i=G,o=GTt(U,Y,G,N),o.size>0&&(t||L||!N&&F)){const[ce,oe]=qw({nodeId:N,dragItems:o,nodeLookup:U});t==null||t($.sourceEvent,o,ce,oe),L==null||L($.sourceEvent,ce,oe),N||F==null||F($.sourceEvent,oe)}}const B=aH().clickDistance(T).on("start",$=>{const{domNode:U,nodeDragThreshold:H,transform:Y,snapGrid:V,snapToGrid:X}=n();_=(U==null?void 0:U.getBoundingClientRect())||null,m=!1,x=!1,S=$.sourceEvent,H===0&&I($),i=W0($.sourceEvent,{transform:Y,snapGrid:V,snapToGrid:X,containerBounds:_}),u=Ya($.sourceEvent,_)}).on("drag",$=>{const{autoPanOnNodeDrag:U,transform:H,snapGrid:Y,snapToGrid:V,nodeDragThreshold:X,nodeLookup:ee}=n(),O=W0($.sourceEvent,{transform:H,snapGrid:Y,snapToGrid:V,containerBounds:_});if(S=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||N&&!ee.has(N))&&(m=!0),!m){if(!l&&U&&d&&(l=!0,M()),!d){const L=Ya($.sourceEvent,_),F=L.x-u.x,q=L.y-u.y;Math.sqrt(F*F+q*q)>X&&I($)}(i.x!==O.xSnapped||i.y!==O.ySnapped)&&o&&d&&(u=Ya($.sourceEvent,_),z(O))}}).on("end",$=>{if(!d||m){m&&o.size>0&&n().updateNodePositions(o,!1);return}if(l=!1,d=!1,cancelAnimationFrame(a),o.size>0){const{nodeLookup:U,updateNodePositions:H,onNodeDragStop:Y,onSelectionDragStop:V}=n();if(x&&(H(o,!1),x=!1),s||Y||!N&&V){const[X,ee]=qw({nodeId:N,dragItems:o,nodeLookup:U,dragging:!1});s==null||s($.sourceEvent,o,X,ee),Y==null||Y($.sourceEvent,X,ee),N||V==null||V($.sourceEvent,ee)}}}).filter($=>{const U=$.target;return!$.button&&(!w||!mR(U,`.${w}`,C))&&(!y||mR(U,y,C))});p.call(B)}function b(){p==null||p.on(".drag",null)}return{update:v,destroy:b}}function KTt(e,n,t){const r=[],s={x:e.x-t,y:e.y-t,width:t*2,height:t*2};for(const i of n.values())Pv(s,zp(i))>0&&r.push(i);return r}const QTt=250;function YTt(e,n,t,r){var o,l;let s=[],i=1/0;const a=KTt(e,t,n+QTt);for(const u of a){const _=[...((o=u.internals.handleBounds)==null?void 0:o.source)??[],...((l=u.internals.handleBounds)==null?void 0:l.target)??[]];for(const d of _){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:p,y:m}=Pd(u,d,d.position,!0),x=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(m-e.y,2));x>n||(x1){const u=r.type==="source"?"target":"source";return s.find(_=>_.type===u)??s[0]}return s[0]}function GH(e,n,t,r,s,i=!1){var u,_,d;const a=r.get(e);if(!a)return null;const o=s==="strict"?(u=a.internals.handleBounds)==null?void 0:u[n]:[...((_=a.internals.handleBounds)==null?void 0:_.source)??[],...((d=a.internals.handleBounds)==null?void 0:d.target)??[]],l=(t?o==null?void 0:o.find(p=>p.id===t):o==null?void 0:o[0])??null;return l&&i?{...l,...Pd(a,l,l.position,!0)}:l}function WH(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function XTt(e,n){let t=null;return n?t=!0:e&&!n&&(t=!1),t}const VH=()=>!0;function ZTt(e,{connectionMode:n,connectionRadius:t,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:o,nodeLookup:l,lib:u,autoPanOnConnect:_,flowId:d,panBy:p,cancelConnection:m,onConnectStart:x,onConnect:S,onConnectEnd:v,isValidConnection:b=VH,onReconnectEnd:w,updateConnection:y,getTransform:C,getFromHandle:E,autoPanSpeed:N,dragThreshold:T=1,handleDomNode:z}){const M=DH(e.target);let I=0,B;const{x:$,y:U}=Ya(e),H=WH(i,z),Y=o==null?void 0:o.getBoundingClientRect();let V=!1;if(!Y||!H)return;const X=GH(s,H,r,l,n);if(!X)return;let ee=Ya(e,Y),O=!1,L=null,F=!1,q=null;function G(){if(!_||!Y)return;const[de,pe]=Rk(ee,Y,N);p({x:de,y:pe}),I=requestAnimationFrame(G)}const re={...X,nodeId:s,type:H,position:X.position},ce=l.get(s);let te={inProgress:!0,isValid:null,from:Pd(ce,re,Et.Left,!0),fromHandle:re,fromPosition:re.position,fromNode:ce,to:ee,toHandle:null,toPosition:sR[re.position],toNode:null,pointer:ee};function Q(){V=!0,y(te),x==null||x(e,{nodeId:s,handleId:r,handleType:H})}T===0&&Q();function le(de){if(!V){const{x:ze,y:it}=Ya(de),bt=ze-$,It=it-U;if(!(bt*bt+It*It>T*T))return;Q()}if(!E()||!re){ae(de);return}const pe=C();ee=Ya(de,Y),B=YTt(gm(ee,pe,!1,[1,1]),t,l,re),O||(G(),O=!0);const we=KH(de,{handle:B,connectionMode:n,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:b,doc:M,lib:u,flowId:d,nodeLookup:l});q=we.handleDomNode,L=we.connection,F=XTt(!!B,we.isValid);const be=l.get(s),Pe=be?Pd(be,re,Et.Left,!0):te.from,Be={...te,from:Pe,isValid:F,to:we.toHandle&&F?Jh({x:we.toHandle.x,y:we.toHandle.y},pe):ee,toHandle:we.toHandle,toPosition:F&&we.toHandle?we.toHandle.position:sR[re.position],toNode:we.toHandle?l.get(we.toHandle.nodeId):null,pointer:ee};y(Be),te=Be}function ae(de){if(!("touches"in de&&de.touches.length>0)){if(V){(B||q)&&L&&F&&(S==null||S(L));const{inProgress:pe,...we}=te,be={...we,toPosition:te.toHandle?te.toPosition:null};v==null||v(de,be),i&&(w==null||w(de,be))}m(),cancelAnimationFrame(I),O=!1,F=!1,L=null,q=null,M.removeEventListener("mousemove",le),M.removeEventListener("mouseup",ae),M.removeEventListener("touchmove",le),M.removeEventListener("touchend",ae)}}M.addEventListener("mousemove",le),M.addEventListener("mouseup",ae),M.addEventListener("touchmove",le),M.addEventListener("touchend",ae)}function KH(e,{handle:n,connectionMode:t,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:o,flowId:l,isValidConnection:u=VH,nodeLookup:_}){const d=i==="target",p=n?a.querySelector(`.${o}-flow__handle[data-id="${l}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:m,y:x}=Ya(e),S=a.elementFromPoint(m,x),v=S!=null&&S.classList.contains(`${o}-flow__handle`)?S:p,b={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const w=WH(void 0,v),y=v.getAttribute("data-nodeid"),C=v.getAttribute("data-handleid"),E=v.classList.contains("connectable"),N=v.classList.contains("connectableend");if(!y||!w)return b;const T={source:d?y:r,sourceHandle:d?C:s,target:d?r:y,targetHandle:d?s:C};b.connection=T;const M=E&&N&&(t===Xh.Strict?d&&w==="source"||!d&&w==="target":y!==r||C!==s);b.isValid=M&&u(T),b.toHandle=GH(y,w,C,_,t,!0)}return b}const S5={onPointerDown:ZTt,isValid:KH};function JTt({domNode:e,panZoom:n,getTransform:t,getViewScale:r}){const s=Bi(e);function i({translateExtent:o,width:l,height:u,zoomStep:_=1,pannable:d=!0,zoomable:p=!0,inversePan:m=!1}){const x=y=>{if(y.sourceEvent.type!=="wheel"||!n)return;const C=t(),E=y.sourceEvent.ctrlKey&&jp()?10:1,N=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*_,T=C[2]*Math.pow(2,N*E);n.scaleTo(T)};let S=[0,0];const v=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(S=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},b=y=>{const C=t();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!n)return;const E=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],N=[E[0]-S[0],E[1]-S[1]];S=E;const T=r()*Math.max(C[2],Math.log(C[2]))*(m?-1:1),z={x:C[0]-N[0]*T,y:C[1]-N[1]*T},M=[[0,0],[l,u]];n.setViewportConstrained({x:z.x,y:z.y,zoom:C[2]},M,o)},w=xH().on("start",v).on("zoom",d?b:null).on("zoom.wheel",p?x:null);s.call(w,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:Ha}}const ly=e=>({x:e.x,y:e.y,zoom:e.k}),Uw=({x:e,y:n,zoom:t})=>iy.translate(e,n).scale(t),th=(e,n)=>e.target.closest(`.${n}`),QH=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),eAt=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Gw=(e,n=0,t=eAt,r=()=>{})=>{const s=typeof n=="number"&&n>0;return s||r(),s?e.transition().duration(n).ease(t).on("end",r):e},YH=e=>{const n=e.ctrlKey&&jp()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function tAt({zoomPanValues:e,noWheelClassName:n,d3Selection:t,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:o,onPanZoom:l,onPanZoomEnd:u}){return _=>{if(th(_,n))return _.ctrlKey&&_.preventDefault(),!1;_.preventDefault(),_.stopImmediatePropagation();const d=t.property("__zoom").k||1;if(_.ctrlKey&&a){const v=Ha(_),b=YH(_),w=d*Math.pow(2,b);r.scaleTo(t,w,v,_);return}const p=_.deltaMode===1?20:1;let m=s===Cd.Vertical?0:_.deltaX*p,x=s===Cd.Horizontal?0:_.deltaY*p;!jp()&&_.shiftKey&&s!==Cd.Vertical&&(m=_.deltaY*p,x=0),r.translateBy(t,-(m/d)*i,-(x/d)*i,{internal:!0});const S=ly(t.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l==null||l(_,S),e.panScrollTimeout=setTimeout(()=>{u==null||u(_,S),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,o==null||o(_,S))}}function nAt({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:t}){return function(r,s){const i=r.type==="wheel",a=!n&&i&&!r.ctrlKey,o=th(r,e);if(r.ctrlKey&&i&&o&&r.preventDefault(),a||o)return null;r.preventDefault(),t.call(this,r,s)}}function rAt({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:t}){return r=>{var i,a,o;if((i=r.sourceEvent)!=null&&i.internal)return;const s=ly(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&n(!0),t&&(t==null||t(r.sourceEvent,s))}}function sAt({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:t,onTransformChange:r,onPanZoom:s}){return i=>{var a,o;e.usedRightMouseButton=!!(t&&QH(n,e.mouseButton??0)),(a=i.sourceEvent)!=null&&a.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((o=i.sourceEvent)!=null&&o.internal)&&(s==null||s(i.sourceEvent,ly(i.transform)))}}function iAt({zoomPanValues:e,panOnDrag:n,panOnScroll:t,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return a=>{var o;if(!((o=a.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,i&&QH(n,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const l=ly(a.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,l)},t?150:0)}}}function aAt({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:t,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:o,noPanClassName:l,lib:u,connectionInProgress:_}){return d=>{var v;const p=e||n,m=t&&d.ctrlKey,x=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(th(d,`${u}-flow__node`)||th(d,`${u}-flow__edge`)))return!0;if(!r&&!p&&!s&&!i&&!t||a||_&&!x||th(d,o)&&x||th(d,l)&&(!x||s&&x&&!e)||!t&&d.ctrlKey&&x)return!1;if(!t&&d.type==="touchstart"&&((v=d.touches)==null?void 0:v.length)>1)return d.preventDefault(),!1;if(!p&&!s&&!m&&x||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const S=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||x)&&S}}function oAt({domNode:e,minZoom:n,maxZoom:t,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:o,onDraggingChange:l}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},_=e.getBoundingClientRect(),d=xH().scaleExtent([n,t]).translateExtent(r),p=Bi(e).call(d);w({x:s.x,y:s.y,zoom:Zh(s.zoom,n,t)},[[0,0],[_.width,_.height]],r);const m=p.on("wheel.zoom"),x=p.on("dblclick.zoom");d.wheelDelta(YH);async function S(B,$){return p?new Promise(U=>{d==null||d.interpolate(($==null?void 0:$.interpolate)==="linear"?G0:O1).transform(Gw(p,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>U(!0)),B)}):!1}function v({noWheelClassName:B,noPanClassName:$,onPaneContextMenu:U,userSelectionActive:H,panOnScroll:Y,panOnDrag:V,panOnScrollMode:X,panOnScrollSpeed:ee,preventScrolling:O,zoomOnPinch:L,zoomOnScroll:F,zoomOnDoubleClick:q,zoomActivationKeyPressed:G,lib:re,onTransformChange:ce,connectionInProgress:oe,paneClickDistance:te,selectionOnDrag:Q}){H&&!u.isZoomingOrPanning&&b();const le=Y&&!G&&!H;d.clickDistance(Q?1/0:!Qa(te)||te<0?0:te);const ae=le?tAt({zoomPanValues:u,noWheelClassName:B,d3Selection:p,d3Zoom:d,panOnScrollMode:X,panOnScrollSpeed:ee,zoomOnPinch:L,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:o}):nAt({noWheelClassName:B,preventScrolling:O,d3ZoomHandler:m});p.on("wheel.zoom",ae,{passive:!1});const de=rAt({zoomPanValues:u,onDraggingChange:l,onPanZoomStart:a});d.on("start",de);const pe=sAt({zoomPanValues:u,panOnDrag:V,onPaneContextMenu:!!U,onPanZoom:i,onTransformChange:ce});d.on("zoom",pe);const we=iAt({zoomPanValues:u,panOnDrag:V,panOnScroll:Y,onPaneContextMenu:U,onPanZoomEnd:o,onDraggingChange:l});d.on("end",we);const be=aAt({zoomActivationKeyPressed:G,panOnDrag:V,zoomOnScroll:F,panOnScroll:Y,zoomOnDoubleClick:q,zoomOnPinch:L,userSelectionActive:H,noPanClassName:$,noWheelClassName:B,lib:re,connectionInProgress:oe});d.filter(be),q?p.on("dblclick.zoom",x):p.on("dblclick.zoom",null)}function b(){d.on("zoom",null)}async function w(B,$,U){const H=Uw(B),Y=d==null?void 0:d.constrain()(H,$,U);return Y&&await S(Y),Y}async function y(B,$){const U=Uw(B);return await S(U,$),U}function C(B){if(p){const $=Uw(B),U=p.property("__zoom");(U.k!==B.zoom||U.x!==B.x||U.y!==B.y)&&(d==null||d.transform(p,$,null,{sync:!0}))}}function E(){const B=p?yH(p.node()):{x:0,y:0,k:1};return{x:B.x,y:B.y,zoom:B.k}}async function N(B,$){return p?new Promise(U=>{d==null||d.interpolate(($==null?void 0:$.interpolate)==="linear"?G0:O1).scaleTo(Gw(p,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>U(!0)),B)}):!1}async function T(B,$){return p?new Promise(U=>{d==null||d.interpolate(($==null?void 0:$.interpolate)==="linear"?G0:O1).scaleBy(Gw(p,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>U(!0)),B)}):!1}function z(B){d==null||d.scaleExtent(B)}function M(B){d==null||d.translateExtent(B)}function I(B){const $=!Qa(B)||B<0?0:B;d==null||d.clickDistance($)}return{update:v,destroy:b,setViewport:y,setViewportConstrained:w,getViewport:E,scaleTo:N,scaleBy:T,setScaleExtent:z,setTranslateExtent:M,syncViewport:C,setClickDistance:I}}var e_;(function(e){e.Line="line",e.Handle="handle"})(e_||(e_={}));function lAt({width:e,prevWidth:n,height:t,prevHeight:r,affectsX:s,affectsY:i}){const a=e-n,o=t-r,l=[a>0?1:a<0?-1:0,o>0?1:o<0?-1:0];return a&&s&&(l[0]=l[0]*-1),o&&i&&(l[1]=l[1]*-1),l}function gR(e){const n=e.includes("right")||e.includes("left"),t=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:n,isVertical:t,affectsX:r,affectsY:s}}function Mc(e,n){return Math.max(0,n-e)}function Dc(e,n){return Math.max(0,e-n)}function d1(e,n,t){return Math.max(0,n-e,e-t)}function vR(e,n){return e?!n:n}function cAt(e,n,t,r,s,i,a,o){let{affectsX:l,affectsY:u}=n;const{isHorizontal:_,isVertical:d}=n,p=_&&d,{xSnapped:m,ySnapped:x}=t,{minWidth:S,maxWidth:v,minHeight:b,maxHeight:w}=r,{x:y,y:C,width:E,height:N,aspectRatio:T}=e;let z=Math.floor(_?m-e.pointerX:0),M=Math.floor(d?x-e.pointerY:0);const I=E+(l?-z:z),B=N+(u?-M:M),$=-i[0]*E,U=-i[1]*N;let H=d1(I,S,v),Y=d1(B,b,w);if(a){let ee=0,O=0;l&&z<0?ee=Mc(y+z+$,a[0][0]):!l&&z>0&&(ee=Dc(y+I+$,a[1][0])),u&&M<0?O=Mc(C+M+U,a[0][1]):!u&&M>0&&(O=Dc(C+B+U,a[1][1])),H=Math.max(H,ee),Y=Math.max(Y,O)}if(o){let ee=0,O=0;l&&z>0?ee=Dc(y+z,o[0][0]):!l&&z<0&&(ee=Mc(y+I,o[1][0])),u&&M>0?O=Dc(C+M,o[0][1]):!u&&M<0&&(O=Mc(C+B,o[1][1])),H=Math.max(H,ee),Y=Math.max(Y,O)}if(s){if(_){const ee=d1(I/T,b,w)*T;if(H=Math.max(H,ee),a){let O=0;!l&&!u||l&&!u&&p?O=Dc(C+U+I/T,a[1][1])*T:O=Mc(C+U+(l?z:-z)/T,a[0][1])*T,H=Math.max(H,O)}if(o){let O=0;!l&&!u||l&&!u&&p?O=Mc(C+I/T,o[1][1])*T:O=Dc(C+(l?z:-z)/T,o[0][1])*T,H=Math.max(H,O)}}if(d){const ee=d1(B*T,S,v)/T;if(Y=Math.max(Y,ee),a){let O=0;!l&&!u||u&&!l&&p?O=Dc(y+B*T+$,a[1][0])/T:O=Mc(y+(u?M:-M)*T+$,a[0][0])/T,Y=Math.max(Y,O)}if(o){let O=0;!l&&!u||u&&!l&&p?O=Mc(y+B*T,o[1][0])/T:O=Dc(y+(u?M:-M)*T,o[0][0])/T,Y=Math.max(Y,O)}}}M=M+(M<0?Y:-Y),z=z+(z<0?H:-H),s&&(p?I>B*T?M=(vR(l,u)?-z:z)/T:z=(vR(l,u)?-M:M)*T:_?(M=z/T,u=l):(z=M*T,l=u));const V=l?y+z:y,X=u?C+M:C;return{width:E+(l?-z:z),height:N+(u?-M:M),x:i[0]*z*(l?-1:1)+V,y:i[1]*M*(u?-1:1)+X}}const XH={width:0,height:0,x:0,y:0},uAt={...XH,pointerX:0,pointerY:0,aspectRatio:1};function dAt(e,n,t){const r=n.position.x+e.position.x,s=n.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,o=t[0]*i,l=t[1]*a;return[[r-o,s-l],[r+i-o,s+a-l]]}function fAt({domNode:e,nodeId:n,getStoreItems:t,onChange:r,onEnd:s}){const i=Bi(e);let a={controlDirection:gR("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:u,boundaries:_,keepAspectRatio:d,resizeDirection:p,onResizeStart:m,onResize:x,onResizeEnd:S,shouldResize:v}){let b={...XH},w={...uAt};a={boundaries:_,resizeDirection:p,keepAspectRatio:d,controlDirection:gR(u)};let y,C=null,E=[],N,T,z,M=!1;const I=aH().on("start",B=>{const{nodeLookup:$,transform:U,snapGrid:H,snapToGrid:Y,nodeOrigin:V,paneDomNode:X}=t();if(y=$.get(n),!y)return;C=(X==null?void 0:X.getBoundingClientRect())??null;const{xSnapped:ee,ySnapped:O}=W0(B.sourceEvent,{transform:U,snapGrid:H,snapToGrid:Y,containerBounds:C});b={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},w={...b,pointerX:ee,pointerY:O,aspectRatio:b.width/b.height},N=void 0,T=$d(y.extent)?y.extent:void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(N=$.get(y.parentId)),N&&y.extent==="parent"&&(T=[[0,0],[N.measured.width,N.measured.height]]),E=[],z=void 0;for(const[L,F]of $)if(F.parentId===n&&(E.push({id:L,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const q=dAt(F,y,F.origin??V);z?z=[[Math.min(q[0][0],z[0][0]),Math.min(q[0][1],z[0][1])],[Math.max(q[1][0],z[1][0]),Math.max(q[1][1],z[1][1])]]:z=q}m==null||m(B,{...b})}).on("drag",B=>{const{transform:$,snapGrid:U,snapToGrid:H,nodeOrigin:Y}=t(),V=W0(B.sourceEvent,{transform:$,snapGrid:U,snapToGrid:H,containerBounds:C}),X=[];if(!y)return;const{x:ee,y:O,width:L,height:F}=b,q={},G=y.origin??Y,{width:re,height:ce,x:oe,y:te}=cAt(w,a.controlDirection,V,a.boundaries,a.keepAspectRatio,G,T,z),Q=re!==L,le=ce!==F,ae=oe!==ee&&Q,de=te!==O&≤if(!ae&&!de&&!Q&&!le)return;if((ae||de||G[0]===1||G[1]===1)&&(q.x=ae?oe:b.x,q.y=de?te:b.y,b.x=q.x,b.y=q.y,E.length>0)){const Pe=oe-ee,Be=te-O;for(const ze of E)ze.position={x:ze.position.x-Pe+G[0]*(re-L),y:ze.position.y-Be+G[1]*(ce-F)},X.push(ze)}if((Q||le)&&(q.width=Q&&(!a.resizeDirection||a.resizeDirection==="horizontal")?re:b.width,q.height=le&&(!a.resizeDirection||a.resizeDirection==="vertical")?ce:b.height,b.width=q.width,b.height=q.height),N&&y.expandParent){const Pe=G[0]*(q.width??0);q.x&&q.x{M&&(S==null||S(B,{...b}),s==null||s({...b}),M=!1)});i.call(I)}function l(){i.on(".drag",null)}return{update:o,destroy:l}}const hAt={},bR=e=>{let n;const t=new Set,r=(_,d)=>{const p=typeof _=="function"?_(n):_;if(!Object.is(p,n)){const m=n;n=d??(typeof p!="object"||p===null)?p:Object.assign({},n,p),t.forEach(x=>x(n,m))}},s=()=>n,l={setState:r,getState:s,getInitialState:()=>u,subscribe:_=>(t.add(_),()=>t.delete(_)),destroy:()=>{(hAt?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},u=n=e(r,s,l);return l},_At=e=>e?bR(e):bR,{useDebugValue:pAt}=Je,{useSyncExternalStoreWithSelector:mAt}=hV,gAt=e=>e;function ZH(e,n=gAt,t){const r=mAt(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,t);return pAt(r),r}const yR=(e,n)=>{const t=_At(e),r=(s,i=n)=>ZH(t,s,i);return Object.assign(r,t),r},vAt=(e,n)=>e?yR(e,n):yR;function yr(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[r,s]of e)if(!Object.is(s,n.get(r)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}const t=Object.keys(e);if(t.length!==Object.keys(n).length)return!1;for(const r of t)if(!Object.prototype.hasOwnProperty.call(n,r)||!Object.is(e[r],n[r]))return!1;return!0}const cy=R.createContext(null),bAt=cy.Provider,JH=Ja.error001("react");function zn(e,n){const t=R.useContext(cy);if(t===null)throw new Error(JH);return ZH(t,e,n)}function wr(){const e=R.useContext(cy);if(e===null)throw new Error(JH);return R.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const xR={display:"none"},yAt={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},eq="react-flow__node-desc",tq="react-flow__edge-desc",xAt="react-flow__aria-live",wAt=e=>e.ariaLiveMessage,SAt=e=>e.ariaLabelConfig;function kAt({rfId:e}){const n=zn(wAt);return f.jsx("div",{id:`${xAt}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:yAt,children:n})}function CAt({rfId:e,disableKeyboardA11y:n}){const t=zn(SAt);return f.jsxs(f.Fragment,{children:[f.jsx("div",{id:`${eq}-${e}`,style:xR,children:n?t["node.a11yDescription.default"]:t["node.a11yDescription.keyboardDisabled"]}),f.jsx("div",{id:`${tq}-${e}`,style:xR,children:t["edge.a11yDescription.default"]}),!n&&f.jsx(kAt,{rfId:e})]})}const uy=R.forwardRef(({position:e="top-left",children:n,className:t,style:r,...s},i)=>{const a=`${e}`.split("-");return f.jsx("div",{className:is(["react-flow__panel",t,...a]),style:r,ref:i,...s,children:n})});uy.displayName="Panel";const wR="https://reactflow.dev?utm_source=attribution";function EAt({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:f.jsx(uy,{position:n,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${wR}`,children:f.jsx("a",{href:wR,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const NAt=e=>{const n=[],t=[];for(const[,r]of e.nodeLookup)r.selected&&n.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&t.push(r);return{selectedNodes:n,selectedEdges:t}},f1=e=>e.id;function zAt(e,n){return yr(e.selectedNodes.map(f1),n.selectedNodes.map(f1))&&yr(e.selectedEdges.map(f1),n.selectedEdges.map(f1))}function jAt({onSelectionChange:e}){const n=wr(),{selectedNodes:t,selectedEdges:r}=zn(NAt,zAt);return R.useEffect(()=>{const s={nodes:t,edges:r};e==null||e(s),n.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[t,r,e]),null}const TAt=e=>!!e.onSelectionChangeHandlers;function AAt({onSelectionChange:e}){const n=zn(TAt);return e||n?f.jsx(jAt,{onSelectionChange:e}):null}const nq=[0,0],RAt={x:0,y:0,zoom:1},MAt=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],SR=[...MAt,"rfId"],DAt=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),kR={translateExtent:Ep,nodeOrigin:nq,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function LAt(e){const{setNodes:n,setEdges:t,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:o,setDefaultNodesAndEdges:l}=zn(DAt,yr),u=wr();R.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{_.current=kR,o()}),[]);const _=R.useRef(kR);return R.useEffect(()=>{for(const d of SR){const p=e[d],m=_.current[d];p!==m&&(typeof e[d]>"u"||(d==="nodes"?n(p):d==="edges"?t(p):d==="minZoom"?r(p):d==="maxZoom"?s(p):d==="translateExtent"?i(p):d==="nodeExtent"?a(p):d==="ariaLabelConfig"?u.setState({ariaLabelConfig:CTt(p)}):d==="fitView"?u.setState({fitViewQueued:p}):d==="fitViewOptions"?u.setState({fitViewOptions:p}):u.setState({[d]:p})))}_.current=e},SR.map(d=>e[d])),null}function CR(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function OAt(e){var r;const[n,t]=R.useState(e==="system"?null:e);return R.useEffect(()=>{if(e!=="system"){t(e);return}const s=CR(),i=()=>t(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),n!==null?n:(r=CR())!=null&&r.matches?"dark":"light"}const ER=typeof document<"u"?document:null;function Tp(e=null,n={target:ER,actInsideInputWithModifier:!0}){const[t,r]=R.useState(!1),s=R.useRef(!1),i=R.useRef(new Set([])),[a,o]=R.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",` `).replace(` `,` +`).split(` -`)),_=u.reduce((d,p)=>d.concat(...p),[]);return[u,_]}return[[],[]]},[e]);return R.useEffect(()=>{const l=(n==null?void 0:n.target)??ER,u=(n==null?void 0:n.actInsideInputWithModifier)??!0;if(e!==null){const _=m=>{var v,b;if(s.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!s.current||s.current&&!u)&&LH(m))return!1;const S=zR(m.code,o);if(i.current.add(m[S]),NR(a,i.current,!1)){const w=((b=(v=m.composedPath)==null?void 0:v.call(m))==null?void 0:b[0])||m.target,y=(w==null?void 0:w.nodeName)==="BUTTON"||(w==null?void 0:w.nodeName)==="A";n.preventDefault!==!1&&(s.current||!y)&&m.preventDefault(),r(!0)}},d=m=>{const x=zR(m.code,o);NR(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(m[x]),m.key==="Meta"&&i.current.clear(),s.current=!1},p=()=>{i.current.clear(),r(!1)};return l==null||l.addEventListener("keydown",_),l==null||l.addEventListener("keyup",d),window.addEventListener("blur",p),window.addEventListener("contextmenu",p),()=>{l==null||l.removeEventListener("keydown",_),l==null||l.removeEventListener("keyup",d),window.removeEventListener("blur",p),window.removeEventListener("contextmenu",p)}}},[e,r]),t}function NR(e,n,t){return e.filter(r=>t||r.length===n.size).some(r=>r.every(s=>n.has(s)))}function zR(e,n){return n.includes(e)?"code":"key"}const IAt=()=>{const e=Er();return R.useMemo(()=>({zoomIn:async n=>{const{panZoom:t}=e.getState();return t?t.scaleBy(1.2,n):!1},zoomOut:async n=>{const{panZoom:t}=e.getState();return t?t.scaleBy(1/1.2,n):!1},zoomTo:async(n,t)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(n,t):!1},getZoom:()=>e.getState().transform[2],setViewport:async(n,t)=>{const{transform:[r,s,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:n.x??r,y:n.y??s,zoom:n.zoom??i},t),!0):!1},getViewport:()=>{const[n,t,r]=e.getState().transform;return{x:n,y:t,zoom:r}},setCenter:async(n,t,r)=>e.getState().setCenter(n,t,r),fitBounds:async(n,t)=>{const{width:r,height:s,minZoom:i,maxZoom:a,panZoom:o}=e.getState(),l=Mk(n,r,s,i,a,(t==null?void 0:t.padding)??.1);return o?(await o.setViewport(l,{duration:t==null?void 0:t.duration,ease:t==null?void 0:t.ease,interpolate:t==null?void 0:t.interpolate}),!0):!1},screenToFlowPosition:(n,t={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:a}=e.getState();if(!a)return n;const{x:o,y:l}=a.getBoundingClientRect(),u={x:n.x-o,y:n.y-l},_=t.snapGrid??s,d=t.snapToGrid??i;return gm(u,r,d,_)},flowToScreenPosition:n=>{const{transform:t,domNode:r}=e.getState();if(!r)return n;const{x:s,y:i}=r.getBoundingClientRect(),a=r_(n,t);return{x:a.x+s,y:a.y+i}}}),[])};function rq(e,n){const t=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of n){const a=r.get(i.id);if(!a){t.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){t.push({...a[0].item});continue}const o={...i};for(const l of a)BAt(l,o);t.push(o)}return s.length&&s.forEach(i=>{i.index!==void 0?t.splice(i.index,0,{...i.item}):t.push({...i.item})}),t}function BAt(e,n){switch(e.type){case"select":{n.selected=e.selected;break}case"position":{typeof e.position<"u"&&(n.position=e.position),typeof e.dragging<"u"&&(n.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(n.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(n.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(n.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(n.resizing=e.resizing);break}}}function $At(e,n){return rq(e,n)}function PAt(e,n){return rq(e,n)}function rd(e,n){return{id:e,type:"select",selected:n}}function ah(e,n=new Set,t=!1){const r=[];for(const[s,i]of e){const a=n.has(s);!(i.selected===void 0&&!a)&&i.selected!==a&&(t&&(i.selected=a),r.push(rd(i.id,a)))}return r}function jR({items:e=[],lookup:n}){var s;const t=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const o=n.get(a.id),l=((s=o==null?void 0:o.internals)==null?void 0:s.userNode)??o;l!==void 0&&l!==a&&t.push({id:a.id,item:a,type:"replace"}),l===void 0&&t.push({item:a,type:"add",index:i})}for(const[i]of n)r.get(i)===void 0&&t.push({id:i,type:"remove"});return t}function TR(e){return{id:e.id,type:"remove"}}const FAt=AH();function HAt(e,n,t={}){return ATt(e,n,{...t,onError:t.onError??FAt})}const AR=e=>mTt(e),qAt=e=>EH(e);function sq(e){return R.forwardRef(e)}const UAt=typeof window<"u"?R.useLayoutEffect:R.useEffect;function RR(e){const[n,t]=R.useState(BigInt(0)),[r]=R.useState(()=>GAt(()=>t(s=>s+BigInt(1))));return UAt(()=>{const s=r.get();s.length&&(e(s),r.reset())},[n]),r}function GAt(e){let n=[];return{get:()=>n,reset:()=>{n=[]},push:t=>{n.push(t),e()}}}const iq=R.createContext(null);function WAt({children:e}){const n=Er(),t=R.useCallback(o=>{const{nodes:l=[],setNodes:u,hasDefaultNodes:_,onNodesChange:d,nodeLookup:p,fitViewQueued:m,onNodesChangeMiddlewareMap:x}=n.getState();let S=l;for(const b of o)S=typeof b=="function"?b(S):b;let v=jR({items:S,lookup:p});for(const b of x.values())v=b(v);_&&u(S),v.length>0?d==null||d(v):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:b,nodes:w,setNodes:y}=n.getState();b&&y(w)})},[]),r=RR(t),s=R.useCallback(o=>{const{edges:l=[],setEdges:u,hasDefaultEdges:_,onEdgesChange:d,edgeLookup:p}=n.getState();let m=l;for(const x of o)m=typeof x=="function"?x(m):x;_?u(m):d&&d(jR({items:m,lookup:p}))},[]),i=RR(s),a=R.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return f.jsx(iq.Provider,{value:a,children:e})}function VAt(){const e=R.useContext(iq);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const KAt=e=>!!e.panZoom;function Pk(){const e=IAt(),n=Er(),t=VAt(),r=An(KAt),s=R.useMemo(()=>{const i=d=>n.getState().nodeLookup.get(d),a=d=>{t.nodeQueue.push(d)},o=d=>{t.edgeQueue.push(d)},l=d=>{var b,w;const{nodeLookup:p,nodeOrigin:m}=n.getState(),x=AR(d)?d:p.get(d.id),S=x.parentId?MH(x.position,x.measured,x.parentId,p,m):x.position,v={...x,position:S,width:((b=x.measured)==null?void 0:b.width)??x.width,height:((w=x.measured)==null?void 0:w.height)??x.height};return zp(v)},u=(d,p,m={replace:!1})=>{a(x=>x.map(S=>{if(S.id===d){const v=typeof p=="function"?p(S):p;return m.replace&&AR(v)?v:{...S,...v}}return S}))},_=(d,p,m={replace:!1})=>{o(x=>x.map(S=>{if(S.id===d){const v=typeof p=="function"?p(S):p;return m.replace&&qAt(v)?v:{...S,...v}}return S}))};return{getNodes:()=>n.getState().nodes.map(d=>({...d})),getNode:d=>{var p;return(p=i(d))==null?void 0:p.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:d=[]}=n.getState();return d.map(p=>({...p}))},getEdge:d=>n.getState().edgeLookup.get(d),setNodes:a,setEdges:o,addNodes:d=>{const p=Array.isArray(d)?d:[d];t.nodeQueue.push(m=>[...m,...p])},addEdges:d=>{const p=Array.isArray(d)?d:[d];t.edgeQueue.push(m=>[...m,...p])},toObject:()=>{const{nodes:d=[],edges:p=[],transform:m}=n.getState(),[x,S,v]=m;return{nodes:d.map(b=>({...b})),edges:p.map(b=>({...b})),viewport:{x,y:S,zoom:v}}},deleteElements:async({nodes:d=[],edges:p=[]})=>{const{nodes:m,edges:x,onNodesDelete:S,onEdgesDelete:v,triggerNodeChanges:b,triggerEdgeChanges:w,onDelete:y,onBeforeDelete:C}=n.getState(),{nodes:E,edges:N}=await xTt({nodesToRemove:d,edgesToRemove:p,nodes:m,edges:x,onBeforeDelete:C}),T=N.length>0,z=E.length>0;if(T){const M=N.map(TR);v==null||v(N),w(M)}if(z){const M=E.map(TR);S==null||S(E),b(M)}return(z||T)&&(y==null||y({nodes:E,edges:N})),{deletedNodes:E,deletedEdges:N}},getIntersectingNodes:(d,p=!0,m)=>{const x=aR(d),S=x?d:l(d),v=m!==void 0;return S?(m||n.getState().nodes).filter(b=>{const w=n.getState().nodeLookup.get(b.id);if(w&&!x&&(b.id===d.id||!w.internals.positionAbsolute))return!1;const y=zp(v?b:w),C=Fv(y,S);return p&&C>0||C>=y.width*y.height||C>=S.width*S.height}):[]},isNodeIntersecting:(d,p,m=!0)=>{const S=aR(d)?d:l(d);if(!S)return!1;const v=Fv(S,p);return m&&v>0||v>=p.width*p.height||v>=S.width*S.height},updateNode:u,updateNodeData:(d,p,m={replace:!1})=>{u(d,x=>{const S=typeof p=="function"?p(x):p;return m.replace?{...x,data:S}:{...x,data:{...x.data,...S}}},m)},updateEdge:_,updateEdgeData:(d,p,m={replace:!1})=>{_(d,x=>{const S=typeof p=="function"?p(x):p;return m.replace?{...x,data:S}:{...x,data:{...x.data,...S}}},m)},getNodesBounds:d=>{const{nodeLookup:p,nodeOrigin:m}=n.getState();return gTt(d,{nodeLookup:p,nodeOrigin:m})},getHandleConnections:({type:d,id:p,nodeId:m})=>{var x;return Array.from(((x=n.getState().connectionLookup.get(`${m}-${d}${p?`-${p}`:""}`))==null?void 0:x.values())??[])},getNodeConnections:({type:d,handleId:p,nodeId:m})=>{var x;return Array.from(((x=n.getState().connectionLookup.get(`${m}${d?p?`-${d}-${p}`:`-${d}`:""}`))==null?void 0:x.values())??[])},fitView:async d=>{const p=n.getState().fitViewResolver??kTt();return n.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:p}),t.nodeQueue.push(m=>[...m]),p.promise}}},[]);return R.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const MR=e=>e.selected,QAt=typeof window<"u"?window:void 0;function YAt({deleteKeyCode:e,multiSelectionKeyCode:n}){const t=Er(),{deleteElements:r}=Pk(),s=Tp(e,{actInsideInputWithModifier:!1}),i=Tp(n,{target:QAt});R.useEffect(()=>{if(s){const{edges:a,nodes:o}=t.getState();r({nodes:o.filter(MR),edges:a.filter(MR)}),t.setState({nodesSelectionActive:!1})}},[s]),R.useEffect(()=>{t.setState({multiSelectionActive:i})},[i])}function XAt(e){const n=Er();R.useEffect(()=>{const t=()=>{var s,i,a,o;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=Dk(e.current);(r.height===0||r.width===0)&&((o=(a=n.getState()).onError)==null||o.call(a,"004",to.error004())),n.setState({width:r.width||500,height:r.height||500})};if(e.current){t(),window.addEventListener("resize",t);const r=new ResizeObserver(()=>t());return r.observe(e.current),()=>{window.removeEventListener("resize",t),r&&e.current&&r.unobserve(e.current)}}},[])}const dy={position:"absolute",width:"100%",height:"100%",top:0,left:0},ZAt=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function JAt({onPaneContextMenu:e,zoomOnScroll:n=!0,zoomOnPinch:t=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=jd.Free,zoomOnDoubleClick:a=!0,panOnDrag:o=!0,defaultViewport:l,translateExtent:u,minZoom:_,maxZoom:d,zoomActivationKeyCode:p,preventScrolling:m=!0,children:x,noWheelClassName:S,noPanClassName:v,onViewportChange:b,isControlledViewport:w,paneClickDistance:y,selectionOnDrag:C}){const E=Er(),N=R.useRef(null),{userSelectionActive:T,lib:z,connectionInProgress:M}=An(ZAt,kr),O=Tp(p),B=R.useRef();XAt(N);const $=R.useCallback(U=>{b==null||b({x:U[0],y:U[1],zoom:U[2]}),w||E.setState({transform:U})},[b,w]);return R.useEffect(()=>{if(N.current){B.current=oAt({domNode:N.current,minZoom:_,maxZoom:d,translateExtent:u,viewport:l,onDraggingChange:V=>E.setState(X=>X.paneDragging===V?X:{paneDragging:V}),onPanZoomStart:(V,X)=>{const{onViewportChangeStart:te,onMoveStart:I}=E.getState();I==null||I(V,X),te==null||te(X)},onPanZoom:(V,X)=>{const{onViewportChange:te,onMove:I}=E.getState();I==null||I(V,X),te==null||te(X)},onPanZoomEnd:(V,X)=>{const{onViewportChangeEnd:te,onMoveEnd:I}=E.getState();I==null||I(V,X),te==null||te(X)}});const{x:U,y:H,zoom:Y}=B.current.getViewport();return E.setState({panZoom:B.current,transform:[U,H,Y],domNode:N.current.closest(".react-flow")}),()=>{var V;(V=B.current)==null||V.destroy()}}},[]),R.useEffect(()=>{var U;(U=B.current)==null||U.update({onPaneContextMenu:e,zoomOnScroll:n,zoomOnPinch:t,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:o,zoomActivationKeyPressed:O,preventScrolling:m,noPanClassName:v,userSelectionActive:T,noWheelClassName:S,lib:z,onTransformChange:$,connectionInProgress:M,selectionOnDrag:C,paneClickDistance:y})},[e,n,t,r,s,i,a,o,O,m,v,T,S,z,$,M,C,y]),f.jsx("div",{className:"react-flow__renderer",ref:N,style:dy,children:x})}const eRt=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function tRt(){const{userSelectionActive:e,userSelectionRect:n}=An(eRt,kr);return e&&n?f.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const Ww=(e,n)=>t=>{t.target===n.current&&(e==null||e(t))},nRt=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function rRt({isSelecting:e,selectionKeyPressed:n,selectionMode:t=Np.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:l,onPaneClick:u,onPaneContextMenu:_,onPaneScroll:d,onPaneMouseEnter:p,onPaneMouseMove:m,onPaneMouseLeave:x,children:S}){const v=R.useRef(0),b=Er(),{userSelectionActive:w,elementsSelectable:y,dragging:C,panBy:E,autoPanSpeed:N}=An(nRt,kr),T=y&&(e||w),z=R.useRef(null),M=R.useRef(),O=R.useRef(new Set),B=R.useRef(new Set),$=R.useRef(!1),U=R.useRef(!1),H=R.useRef({x:0,y:0}),Y=R.useRef(!1),V=Q=>{if(U.current||$.current||b.getState().connection.inProgress){U.current=!1,$.current=!1;return}u==null||u(Q),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},X=Q=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){Q.preventDefault();return}_==null||_(Q)},te=d?Q=>d(Q):void 0,I=Q=>{U.current&&(Q.stopPropagation(),U.current=!1)},L=Q=>{var ze,at;const{domNode:le,transform:ae}=b.getState();if(M.current=le==null?void 0:le.getBoundingClientRect(),!M.current)return;const ue=Q.target===z.current;if(!ue&&!!Q.target.closest(".nokey")||!e||!(a&&ue||n)||Q.button!==0||!Q.isPrimary)return;(at=(ze=Q.target)==null?void 0:ze.setPointerCapture)==null||at.call(ze,Q.pointerId),U.current=!1;const{x:ye,y:qe}=Za(Q.nativeEvent,M.current),Ie=gm({x:ye,y:qe},ae);b.setState({userSelectionRect:{width:0,height:0,startX:Ie.x,startY:Ie.y,x:ye,y:qe}}),ue||(Q.stopPropagation(),Q.preventDefault())};function F(Q,le){const{userSelectionRect:ae}=b.getState();if(!ae)return;const{transform:ue,nodeLookup:pe,edgeLookup:Se,connectionLookup:ye,triggerNodeChanges:qe,triggerEdgeChanges:Ie,defaultEdgeOptions:ze}=b.getState(),at={x:ae.startX,y:ae.startY},{x:bt,y:$t}=r_(at,ue),Pt={startX:at.x,startY:at.y,x:QIt.id)),B.current=new Set;const ft=(ze==null?void 0:ze.selectable)??!0;for(const It of O.current){const we=ye.get(It);if(we)for(const{edgeId:Re}of we.values()){const Ze=Se.get(Re);Ze&&(Ze.selectable??ft)&&B.current.add(Re)}}if(!oR(zt,O.current)){const It=ah(pe,O.current,!0);qe(It)}if(!oR(ot,B.current)){const It=ah(Se,B.current);Ie(It)}b.setState({userSelectionRect:Pt,userSelectionActive:!0,nodesSelectionActive:!1})}function q(){if(!s||!M.current)return;const[Q,le]=Rk(H.current,M.current,N);E({x:Q,y:le}).then(ae=>{if(!U.current||!ae){v.current=requestAnimationFrame(q);return}const{x:ue,y:pe}=H.current;F(ue,pe),v.current=requestAnimationFrame(q)})}const G=()=>{cancelAnimationFrame(v.current),v.current=0,Y.current=!1};R.useEffect(()=>()=>G(),[]);const ee=Q=>{const{userSelectionRect:le,transform:ae,resetSelectedElements:ue}=b.getState();if(!M.current||!le)return;const{x:pe,y:Se}=Za(Q.nativeEvent,M.current);H.current={x:pe,y:Se};const ye=r_({x:le.startX,y:le.startY},ae);if(!U.current){const qe=n?0:i;if(Math.hypot(pe-ye.x,Se-ye.y)<=qe)return;ue(),o==null||o(Q)}U.current=!0,Y.current||(q(),Y.current=!0),F(pe,Se)},ce=Q=>{var le,ae;if(!T){Q.target===z.current&&b.getState().connection.inProgress&&($.current=!0);return}Q.button===0&&((ae=(le=Q.target)==null?void 0:le.releasePointerCapture)==null||ae.call(le,Q.pointerId),!w&&Q.target===z.current&&b.getState().userSelectionRect&&(V==null||V(Q)),b.setState({userSelectionActive:!1,userSelectionRect:null}),U.current&&(l==null||l(Q),b.setState({nodesSelectionActive:O.current.size>0})),G())},oe=Q=>{var le,ae;(ae=(le=Q.target)==null?void 0:le.releasePointerCapture)==null||ae.call(le,Q.pointerId),G()},ne=r===!0||Array.isArray(r)&&r.includes(0);return f.jsxs("div",{className:as(["react-flow__pane",{draggable:ne,dragging:C,selection:e}]),onClick:T?void 0:Ww(V,z),onContextMenu:Ww(X,z),onWheel:Ww(te,z),onPointerEnter:T?void 0:p,onPointerMove:T?ee:m,onPointerUp:ce,onPointerCancel:T?oe:void 0,onPointerDownCapture:T?L:void 0,onClickCapture:T?I:void 0,onPointerLeave:x,ref:z,style:dy,children:[S,f.jsx(tRt,{})]})}function k5({id:e,store:n,unselect:t=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:o,onError:l}=n.getState(),u=o.get(e);if(!u){l==null||l("012",to.error012(e));return}n.setState({nodesSelectionActive:!1}),u.selected?(t||u.selected&&a)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var _;return(_=r==null?void 0:r.current)==null?void 0:_.blur()})):s([e])}function aq({nodeRef:e,disabled:n=!1,noDragClassName:t,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const o=Er(),[l,u]=R.useState(!1),_=R.useRef();return R.useEffect(()=>{_.current=VTt({getStoreItems:()=>o.getState(),onNodeMouseDown:d=>{k5({id:d,store:o,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),R.useEffect(()=>{if(!(n||!e.current||!_.current))return _.current.update({noDragClassName:t,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var d;(d=_.current)==null||d.destroy()}},[t,r,n,i,e,s,a]),l}const sRt=e=>n=>n.selected&&(n.draggable||e&&typeof n.draggable>"u");function oq(){const e=Er();return R.useCallback(t=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:l,nodeLookup:u,nodeOrigin:_}=e.getState(),d=new Map,p=sRt(a),m=s?i[0]:5,x=s?i[1]:5,S=t.direction.x*m*t.factor,v=t.direction.y*x*t.factor;for(const[,b]of u){if(!p(b))continue;let w={x:b.internals.positionAbsolute.x+S,y:b.internals.positionAbsolute.y+v};s&&(w=mm(w,i));const{position:y,positionAbsolute:C}=NH({nodeId:b.id,nextPosition:w,nodeLookup:u,nodeExtent:r,nodeOrigin:_,onError:o});b.position=y,b.internals.positionAbsolute=C,d.set(b.id,b)}l(d)},[])}const Fk=R.createContext(null),iRt=Fk.Provider;Fk.Consumer;const lq=()=>R.useContext(Fk),aRt=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),cq=R.createContext(null);function oRt({children:e}){const n=An(aRt,kr);return f.jsx(cq.Provider,{value:n,children:e})}function lRt(){const e=R.useContext(cq);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const cRt={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},uRt=(e,n,t)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:o,toHandle:l,isValid:u}=a;if(!o&&!s)return cRt;const _=(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===n&&(l==null?void 0:l.type)===t;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===n&&(o==null?void 0:o.type)===t,connectingTo:_,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===n&&(s==null?void 0:s.type)===t,isPossibleEndHandle:i===t_.Strict?(o==null?void 0:o.type)!==t:e!==(o==null?void 0:o.nodeId)||n!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!s,valid:_&&u}};function dRt({type:e="source",position:n=Et.Top,isValidConnection:t,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:o,children:l,className:u,onMouseDown:_,onTouchStart:d,...p},m){var Y,V;const x=a||null,S=e==="target",v=Er(),b=lq(),{connectOnClick:w,noPanClassName:y,rfId:C}=lRt(),{connectingFrom:E,connectingTo:N,clickConnecting:T,isPossibleEndHandle:z,connectionInProcess:M,clickConnectionInProcess:O,valid:B}=An(uRt(b,x,e),kr);b||(V=(Y=v.getState()).onError)==null||V.call(Y,"010",to.error010());const $=X=>{const{defaultEdgeOptions:te,onConnect:I,hasDefaultEdges:L}=v.getState(),F={...te,...X};if(L){const{edges:q,setEdges:G,onError:ee}=v.getState();G(HAt(F,q,{onError:ee}))}I==null||I(F),o==null||o(F)},U=X=>{if(!b)return;const te=OH(X.nativeEvent);if(s&&(te&&X.button===0||!te)){const I=v.getState();S5.onPointerDown(X.nativeEvent,{handleDomNode:X.currentTarget,autoPanOnConnect:I.autoPanOnConnect,connectionMode:I.connectionMode,connectionRadius:I.connectionRadius,domNode:I.domNode,nodeLookup:I.nodeLookup,lib:I.lib,isTarget:S,handleId:x,nodeId:b,flowId:I.rfId,panBy:I.panBy,cancelConnection:I.cancelConnection,onConnectStart:I.onConnectStart,onConnectEnd:(...L)=>{var F,q;return(q=(F=v.getState()).onConnectEnd)==null?void 0:q.call(F,...L)},updateConnection:I.updateConnection,onConnect:$,isValidConnection:t||((...L)=>{var F,q;return((q=(F=v.getState()).isValidConnection)==null?void 0:q.call(F,...L))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:I.autoPanSpeed,dragThreshold:I.connectionDragThreshold})}te?_==null||_(X):d==null||d(X)},H=X=>{const{onClickConnectStart:te,onClickConnectEnd:I,connectionClickStartHandle:L,connectionMode:F,isValidConnection:q,lib:G,rfId:ee,nodeLookup:ce,connection:oe}=v.getState();if(!b||!L&&!s)return;if(!L){te==null||te(X.nativeEvent,{nodeId:b,handleId:x,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:b,type:e,id:x}});return}const ne=DH(X.target),Q=t||q,{connection:le,isValid:ae}=S5.isValid(X.nativeEvent,{handle:{nodeId:b,id:x,type:e},connectionMode:F,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:Q,flowId:ee,doc:ne,lib:G,nodeLookup:ce});ae&&le&&$(le);const ue=structuredClone(oe);delete ue.inProgress,ue.toPosition=ue.toHandle?ue.toHandle.position:null,I==null||I(X,ue),v.setState({connectionClickStartHandle:null})};return f.jsx("div",{"data-handleid":x,"data-nodeid":b,"data-handlepos":n,"data-id":`${C}-${b}-${x}-${e}`,className:as(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",y,u,{source:!S,target:S,connectable:r,connectablestart:s,connectableend:i,clickconnecting:T,connectingfrom:E,connectingto:N,valid:B,connectionindicator:r&&(!M||z)&&(M||O?i:s)}]),onMouseDown:U,onTouchStart:U,onClick:w?H:void 0,ref:m,...p,children:l})}const bu=R.memo(sq(dRt));function fRt({data:e,isConnectable:n,sourcePosition:t=Et.Bottom}){return f.jsxs(f.Fragment,{children:[e==null?void 0:e.label,f.jsx(bu,{type:"source",position:t,isConnectable:n})]})}function hRt({data:e,isConnectable:n,targetPosition:t=Et.Top,sourcePosition:r=Et.Bottom}){return f.jsxs(f.Fragment,{children:[f.jsx(bu,{type:"target",position:t,isConnectable:n}),e==null?void 0:e.label,f.jsx(bu,{type:"source",position:r,isConnectable:n})]})}function _Rt(){return null}function pRt({data:e,isConnectable:n,targetPosition:t=Et.Top}){return f.jsxs(f.Fragment,{children:[f.jsx(bu,{type:"target",position:t,isConnectable:n}),e==null?void 0:e.label]})}const Hv={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},DR={input:fRt,default:hRt,output:pRt,group:_Rt};function mRt(e){var n,t,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((n=e.style)==null?void 0:n.width),height:e.height??e.initialHeight??((t=e.style)==null?void 0:t.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const gRt=e=>{const{width:n,height:t,x:r,y:s}=pm(e.nodeLookup,{filter:i=>!!i.selected});return{width:Xa(n)?n:null,height:Xa(t)?t:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function vRt({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:t}){const r=Er(),{width:s,height:i,transformString:a,userSelectionActive:o}=An(gRt,kr),l=oq(),u=R.useRef(null);R.useEffect(()=>{var m;t||(m=u.current)==null||m.focus({preventScroll:!0})},[t]);const _=!o&&s!==null&&i!==null;if(aq({nodeRef:u,disabled:!_}),!_)return null;const d=e?m=>{const x=r.getState().nodes.filter(S=>S.selected);e(m,x)}:void 0,p=m=>{Object.prototype.hasOwnProperty.call(Hv,m.key)&&(m.preventDefault(),l({direction:Hv[m.key],factor:m.shiftKey?4:1}))};return f.jsx("div",{className:as(["react-flow__nodesselection","react-flow__container",n]),style:{transform:a},children:f.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:t?void 0:-1,onKeyDown:t?void 0:p,style:{width:s,height:i}})})}const LR=typeof window<"u"?window:void 0,bRt=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function uq({children:e,onPaneClick:n,onPaneMouseEnter:t,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:o,deleteKeyCode:l,selectionKeyCode:u,selectionOnDrag:_,selectionMode:d,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:v,elementsSelectable:b,zoomOnScroll:w,zoomOnPinch:y,panOnScroll:C,panOnScrollSpeed:E,panOnScrollMode:N,zoomOnDoubleClick:T,panOnDrag:z,autoPanOnSelection:M,defaultViewport:O,translateExtent:B,minZoom:$,maxZoom:U,preventScrolling:H,onSelectionContextMenu:Y,noWheelClassName:V,noPanClassName:X,disableKeyboardA11y:te,onViewportChange:I,isControlledViewport:L}){const{nodesSelectionActive:F,userSelectionActive:q}=An(bRt,kr),G=Tp(u,{target:LR}),ee=Tp(S,{target:LR}),ce=ee||z,oe=ee||C,ne=_&&ce!==!0,Q=G||q||ne;return YAt({deleteKeyCode:l,multiSelectionKeyCode:x}),f.jsx(JAt,{onPaneContextMenu:i,elementsSelectable:b,zoomOnScroll:w,zoomOnPinch:y,panOnScroll:oe,panOnScrollSpeed:E,panOnScrollMode:N,zoomOnDoubleClick:T,panOnDrag:!G&&ce,defaultViewport:O,translateExtent:B,minZoom:$,maxZoom:U,zoomActivationKeyCode:v,preventScrolling:H,noWheelClassName:V,noPanClassName:X,onViewportChange:I,isControlledViewport:L,paneClickDistance:o,selectionOnDrag:ne,children:f.jsxs(rRt,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:n,onPaneMouseEnter:t,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:ce,autoPanOnSelection:M,isSelecting:!!Q,selectionMode:d,selectionKeyPressed:G,paneClickDistance:o,selectionOnDrag:ne,children:[e,F&&f.jsx(vRt,{onSelectionContextMenu:Y,noPanClassName:X,disableKeyboardA11y:te})]})})}uq.displayName="FlowRenderer";const yRt=R.memo(uq),xRt=e=>n=>e?Ak(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map(t=>t.id):Array.from(n.nodeLookup.keys());function wRt(e){return An(R.useCallback(xRt(e),[e]),kr)}const SRt=e=>e.updateNodeInternals;function kRt(){const e=An(SRt),[n]=R.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(t=>{const r=new Map;t.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return R.useEffect(()=>()=>{n==null||n.disconnect()},[n]),n}function CRt({node:e,nodeType:n,hasDimensions:t,resizeObserver:r}){const s=Er(),i=R.useRef(null),a=R.useRef(null),o=R.useRef(e.sourcePosition),l=R.useRef(e.targetPosition),u=R.useRef(n),_=t&&!!e.internals.handleBounds;return R.useEffect(()=>{i.current&&!e.hidden&&(!_||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[_,e.hidden]),R.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),R.useEffect(()=>{if(i.current){const d=u.current!==n,p=o.current!==e.sourcePosition,m=l.current!==e.targetPosition;(d||p||m)&&(u.current=n,o.current=e.sourcePosition,l.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),i}function ERt({id:e,onClick:n,onMouseEnter:t,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:o,elementsSelectable:l,nodesConnectable:u,nodesFocusable:_,resizeObserver:d,noDragClassName:p,noPanClassName:m,disableKeyboardA11y:x,rfId:S,nodeTypes:v,nodeClickDistance:b,onError:w}){const{node:y,internals:C,isParent:E}=An(Q=>{const le=Q.nodeLookup.get(e),ae=Q.parentLookup.has(e);return{node:le,internals:le.internals,isParent:ae}},kr);let N=y.type||"default",T=(v==null?void 0:v[N])||DR[N];T===void 0&&(w==null||w("003",to.error003(N)),N="default",T=(v==null?void 0:v.default)||DR.default);const z=!!(y.draggable||o&&typeof y.draggable>"u"),M=!!(y.selectable||l&&typeof y.selectable>"u"),O=!!(y.connectable||u&&typeof y.connectable>"u"),B=!!(y.focusable||_&&typeof y.focusable>"u"),$=Er(),U=RH(y),H=CRt({node:y,nodeType:N,hasDimensions:U,resizeObserver:d}),Y=aq({nodeRef:H,disabled:y.hidden||!z,noDragClassName:p,handleSelector:y.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:b}),V=oq();if(y.hidden)return null;const X=Yl(y),te=mRt(y),I=M||z||n||t||r||s,L=t?Q=>t(Q,{...C.userNode}):void 0,F=r?Q=>r(Q,{...C.userNode}):void 0,q=s?Q=>s(Q,{...C.userNode}):void 0,G=i?Q=>i(Q,{...C.userNode}):void 0,ee=a?Q=>a(Q,{...C.userNode}):void 0,ce=Q=>{const{selectNodesOnDrag:le,nodeDragThreshold:ae}=$.getState();M&&(!le||!z||ae>0)&&k5({id:e,store:$,nodeRef:H}),n&&n(Q,{...C.userNode})},oe=Q=>{if(!(LH(Q.nativeEvent)||x)){if(wH.includes(Q.key)&&M){const le=Q.key==="Escape";k5({id:e,store:$,unselect:le,nodeRef:H})}else if(z&&y.selected&&Object.prototype.hasOwnProperty.call(Hv,Q.key)){Q.preventDefault();const{ariaLabelConfig:le}=$.getState();$.setState({ariaLiveMessage:le["node.a11yDescription.ariaLiveMessage"]({direction:Q.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),V({direction:Hv[Q.key],factor:Q.shiftKey?4:1})}}},ne=()=>{var ye;if(x||!((ye=H.current)!=null&&ye.matches(":focus-visible")))return;const{transform:Q,width:le,height:ae,autoPanOnNodeFocus:ue,setCenter:pe}=$.getState();if(!ue)return;Ak(new Map([[e,y]]),{x:0,y:0,width:le,height:ae},Q,!0).length>0||pe(y.position.x+X.width/2,y.position.y+X.height/2,{zoom:Q[2]})};return f.jsx("div",{className:as(["react-flow__node",`react-flow__node-${N}`,{[m]:z},y.className,{selected:y.selected,selectable:M,parent:E,draggable:z,dragging:Y}]),ref:H,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:I?"all":"none",visibility:U?"visible":"hidden",...y.style,...te},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:F,onMouseLeave:q,onContextMenu:G,onClick:ce,onDoubleClick:ee,onKeyDown:B?oe:void 0,tabIndex:B?0:void 0,onFocus:B?ne:void 0,role:y.ariaRole??(B?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${eq}-${S}`,"aria-label":y.ariaLabel,...y.domAttributes,children:f.jsx(iRt,{value:e,children:f.jsx(T,{id:e,data:y.data,type:N,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:y.selected??!1,selectable:M,draggable:z,deletable:y.deletable??!0,isConnectable:O,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:Y,dragHandle:y.dragHandle,zIndex:C.z,parentId:y.parentId,...X})})})}var NRt=R.memo(ERt);const zRt=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function dq(e){const{nodesDraggable:n,nodesConnectable:t,nodesFocusable:r,elementsSelectable:s,onError:i}=An(zRt,kr),a=wRt(e.onlyRenderVisibleElements),o=kRt();return f.jsx("div",{className:"react-flow__nodes",style:dy,children:a.map(l=>f.jsx(NRt,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:n,nodesConnectable:t,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},l))})}dq.displayName="NodeRenderer";const jRt=R.memo(dq);function TRt(e){return An(R.useCallback(t=>{if(!e)return t.edges.map(s=>s.id);const r=[];if(t.width&&t.height)for(const s of t.edges){const i=t.nodeLookup.get(s.source),a=t.nodeLookup.get(s.target);i&&a&&zTt({sourceNode:i,targetNode:a,width:t.width,height:t.height,transform:t.transform})&&r.push(s.id)}return r},[e]),kr)}const ARt=({color:e="none",strokeWidth:n=1})=>{const t={strokeWidth:n,...e&&{stroke:e}};return f.jsx("polyline",{className:"arrow",style:t,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},RRt=({color:e="none",strokeWidth:n=1})=>{const t={strokeWidth:n,...e&&{stroke:e,fill:e}};return f.jsx("polyline",{className:"arrowclosed",style:t,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},OR={[$v.Arrow]:ARt,[$v.ArrowClosed]:RRt};function MRt(e){const n=Er();return R.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(OR,e)?OR[e]:((i=(s=n.getState()).onError)==null||i.call(s,"009",to.error009(e)),null)},[e])}const DRt=({id:e,type:n,color:t,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const l=MRt(n);return l?f.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:o,refX:"0",refY:"0",children:f.jsx(l,{color:t,strokeWidth:a})}):null},fq=({defaultColor:e,rfId:n})=>{const t=An(i=>i.edges),r=An(i=>i.defaultEdgeOptions),s=R.useMemo(()=>OTt(t,{id:n,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[t,r,n,e]);return s.length?f.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:f.jsx("defs",{children:s.map(i=>f.jsx(DRt,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};fq.displayName="MarkerDefinitions";var LRt=R.memo(fq);function hq({x:e,y:n,label:t,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:l,className:u,..._}){const[d,p]=R.useState({x:1,y:0,width:0,height:0}),m=as(["react-flow__edge-textwrapper",u]),x=R.useRef(null);return R.useEffect(()=>{if(x.current){const S=x.current.getBBox();p({x:S.x,y:S.y,width:S.width,height:S.height})}},[t]),t?f.jsxs("g",{transform:`translate(${e-d.width/2} ${n-d.height/2})`,className:m,visibility:d.width?"visible":"hidden",..._,children:[s&&f.jsx("rect",{width:d.width+2*a[0],x:-a[0],y:-a[1],height:d.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:o,ry:o}),f.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:x,style:r,children:t}),l]}):null}hq.displayName="EdgeText";const ORt=R.memo(hq);function fy({path:e,labelX:n,labelY:t,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:l,interactionWidth:u=20,..._}){return f.jsxs(f.Fragment,{children:[f.jsx("path",{..._,d:e,fill:"none",className:as(["react-flow__edge-path",_.className])}),u?f.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&Xa(n)&&Xa(t)?f.jsx(ORt,{x:n,y:t,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:l}):null]})}function IR({pos:e,x1:n,y1:t,x2:r,y2:s}){return e===Et.Left||e===Et.Right?[.5*(n+r),t]:[n,.5*(t+s)]}function _q({sourceX:e,sourceY:n,sourcePosition:t=Et.Bottom,targetX:r,targetY:s,targetPosition:i=Et.Top}){const[a,o]=IR({pos:t,x1:e,y1:n,x2:r,y2:s}),[l,u]=IR({pos:i,x1:r,y1:s,x2:e,y2:n}),[_,d,p,m]=IH({sourceX:e,sourceY:n,targetX:r,targetY:s,sourceControlX:a,sourceControlY:o,targetControlX:l,targetControlY:u});return[`M${e},${n} C${a},${o} ${l},${u} ${r},${s}`,_,d,p,m]}function pq(e){return R.memo(({id:n,sourceX:t,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:o,label:l,labelStyle:u,labelShowBg:_,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:S,markerStart:v,interactionWidth:b})=>{const[w,y,C]=_q({sourceX:t,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o}),E=e.isInternal?void 0:n;return f.jsx(fy,{id:E,path:w,labelX:y,labelY:C,label:l,labelStyle:u,labelShowBg:_,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:S,markerStart:v,interactionWidth:b})})}const IRt=pq({isInternal:!1}),mq=pq({isInternal:!0});IRt.displayName="SimpleBezierEdge";mq.displayName="SimpleBezierEdgeInternal";function gq(e){return R.memo(({id:n,sourceX:t,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:_,labelBgBorderRadius:d,style:p,sourcePosition:m=Et.Bottom,targetPosition:x=Et.Top,markerEnd:S,markerStart:v,pathOptions:b,interactionWidth:w})=>{const[y,C,E]=y5({sourceX:t,sourceY:r,sourcePosition:m,targetX:s,targetY:i,targetPosition:x,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset,stepPosition:b==null?void 0:b.stepPosition}),N=e.isInternal?void 0:n;return f.jsx(fy,{id:N,path:y,labelX:C,labelY:E,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:_,labelBgBorderRadius:d,style:p,markerEnd:S,markerStart:v,interactionWidth:w})})}const vq=gq({isInternal:!1}),bq=gq({isInternal:!0});vq.displayName="SmoothStepEdge";bq.displayName="SmoothStepEdgeInternal";function yq(e){return R.memo(({id:n,...t})=>{var s;const r=e.isInternal?void 0:n;return f.jsx(vq,{...t,id:r,pathOptions:R.useMemo(()=>{var i;return{borderRadius:0,offset:(i=t.pathOptions)==null?void 0:i.offset}},[(s=t.pathOptions)==null?void 0:s.offset])})})}const BRt=yq({isInternal:!1}),xq=yq({isInternal:!0});BRt.displayName="StepEdge";xq.displayName="StepEdgeInternal";function wq(e){return R.memo(({id:n,sourceX:t,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:_,labelBgBorderRadius:d,style:p,markerEnd:m,markerStart:x,interactionWidth:S})=>{const[v,b,w]=PH({sourceX:t,sourceY:r,targetX:s,targetY:i}),y=e.isInternal?void 0:n;return f.jsx(fy,{id:y,path:v,labelX:b,labelY:w,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:_,labelBgBorderRadius:d,style:p,markerEnd:m,markerStart:x,interactionWidth:S})})}const $Rt=wq({isInternal:!1}),Sq=wq({isInternal:!0});$Rt.displayName="StraightEdge";Sq.displayName="StraightEdgeInternal";function kq(e){return R.memo(({id:n,sourceX:t,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Et.Bottom,targetPosition:o=Et.Top,label:l,labelStyle:u,labelShowBg:_,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:S,markerStart:v,pathOptions:b,interactionWidth:w})=>{const[y,C,E]=BH({sourceX:t,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o,curvature:b==null?void 0:b.curvature}),N=e.isInternal?void 0:n;return f.jsx(fy,{id:N,path:y,labelX:C,labelY:E,label:l,labelStyle:u,labelShowBg:_,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:S,markerStart:v,interactionWidth:w})})}const PRt=kq({isInternal:!1}),Cq=kq({isInternal:!0});PRt.displayName="BezierEdge";Cq.displayName="BezierEdgeInternal";const BR={default:Cq,straight:Sq,step:xq,smoothstep:bq,simplebezier:mq},$R={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},FRt=(e,n,t)=>t===Et.Left?e-n:t===Et.Right?e+n:e,HRt=(e,n,t)=>t===Et.Top?e-n:t===Et.Bottom?e+n:e,PR="react-flow__edgeupdater";function FR({position:e,centerX:n,centerY:t,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:o}){return f.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:as([PR,`${PR}-${o}`]),cx:FRt(n,r,e),cy:HRt(t,r,e),r,stroke:"transparent",fill:"transparent"})}function qRt({isReconnectable:e,reconnectRadius:n,edge:t,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:o,targetPosition:l,onReconnect:u,onReconnectStart:_,onReconnectEnd:d,setReconnecting:p,setUpdateHover:m}){const x=Er(),S=(C,E)=>{if(C.button!==0)return;const{autoPanOnConnect:N,domNode:T,connectionMode:z,connectionRadius:M,lib:O,onConnectStart:B,cancelConnection:$,nodeLookup:U,rfId:H,panBy:Y,updateConnection:V}=x.getState(),X=E.type==="target",te=(F,q)=>{p(!1),d==null||d(F,t,E.type,q)},I=F=>u==null?void 0:u(t,F),L=(F,q)=>{p(!0),_==null||_(C,t,E.type),B==null||B(F,q)};S5.onPointerDown(C.nativeEvent,{autoPanOnConnect:N,connectionMode:z,connectionRadius:M,domNode:T,handleId:E.id,nodeId:E.nodeId,nodeLookup:U,isTarget:X,edgeUpdaterType:E.type,lib:O,flowId:H,cancelConnection:$,panBy:Y,isValidConnection:(...F)=>{var q,G;return((G=(q=x.getState()).isValidConnection)==null?void 0:G.call(q,...F))??!0},onConnect:I,onConnectStart:L,onConnectEnd:(...F)=>{var q,G;return(G=(q=x.getState()).onConnectEnd)==null?void 0:G.call(q,...F)},onReconnectEnd:te,updateConnection:V,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},v=C=>S(C,{nodeId:t.target,id:t.targetHandle??null,type:"target"}),b=C=>S(C,{nodeId:t.source,id:t.sourceHandle??null,type:"source"}),w=()=>m(!0),y=()=>m(!1);return f.jsxs(f.Fragment,{children:[(e===!0||e==="source")&&f.jsx(FR,{position:o,centerX:r,centerY:s,radius:n,onMouseDown:v,onMouseEnter:w,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&f.jsx(FR,{position:l,centerX:i,centerY:a,radius:n,onMouseDown:b,onMouseEnter:w,onMouseOut:y,type:"target"})]})}function URt({id:e,edgesFocusable:n,edgesReconnectable:t,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:o,onMouseMove:l,onMouseLeave:u,reconnectRadius:_,onReconnect:d,onReconnectStart:p,onReconnectEnd:m,rfId:x,edgeTypes:S,noPanClassName:v,onError:b,disableKeyboardA11y:w}){let y=An(pe=>pe.edgeLookup.get(e));const C=An(pe=>pe.defaultEdgeOptions);y=C?{...C,...y}:y;let E=y.type||"default",N=(S==null?void 0:S[E])||BR[E];N===void 0&&(b==null||b("011",to.error011(E)),E="default",N=(S==null?void 0:S.default)||BR.default);const T=!!(y.focusable||n&&typeof y.focusable>"u"),z=typeof d<"u"&&(y.reconnectable||t&&typeof y.reconnectable>"u"),M=!!(y.selectable||r&&typeof y.selectable>"u"),O=R.useRef(null),[B,$]=R.useState(!1),[U,H]=R.useState(!1),Y=Er(),{zIndex:V=y.zIndex,sourceX:X,sourceY:te,targetX:I,targetY:L,sourcePosition:F,targetPosition:q}=An(R.useCallback(pe=>{const Se=pe.nodeLookup.get(y.source),ye=pe.nodeLookup.get(y.target);if(!Se||!ye)return $R;const qe=LTt({id:e,sourceNode:Se,targetNode:ye,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:pe.connectionMode,onError:b}),Ie=NTt({selected:y.selected,zIndex:y.zIndex,sourceNode:Se,targetNode:ye,elevateOnSelect:pe.elevateEdgesOnSelect,zIndexMode:pe.zIndexMode});return{...qe||$R,zIndex:Ie}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),kr),G=R.useMemo(()=>y.markerStart?`url('#${x5(y.markerStart,x)}')`:void 0,[y.markerStart,x]),ee=R.useMemo(()=>y.markerEnd?`url('#${x5(y.markerEnd,x)}')`:void 0,[y.markerEnd,x]);if(y.hidden||X===null||te===null||I===null||L===null)return null;const ce=pe=>{var Ie;const{addSelectedEdges:Se,unselectNodesAndEdges:ye,multiSelectionActive:qe}=Y.getState();M&&(Y.setState({nodesSelectionActive:!1}),y.selected&&qe?(ye({nodes:[],edges:[y]}),(Ie=O.current)==null||Ie.blur()):Se([e])),s&&s(pe,y)},oe=i?pe=>{i(pe,{...y})}:void 0,ne=a?pe=>{a(pe,{...y})}:void 0,Q=o?pe=>{o(pe,{...y})}:void 0,le=l?pe=>{l(pe,{...y})}:void 0,ae=u?pe=>{u(pe,{...y})}:void 0,ue=pe=>{var Se;if(!w&&wH.includes(pe.key)&&M){const{unselectNodesAndEdges:ye,addSelectedEdges:qe}=Y.getState();pe.key==="Escape"?((Se=O.current)==null||Se.blur(),ye({edges:[y]})):qe([e])}};return f.jsx("svg",{style:{zIndex:V},children:f.jsxs("g",{className:as(["react-flow__edge",`react-flow__edge-${E}`,y.className,v,{selected:y.selected,animated:y.animated,inactive:!M&&!s,updating:B,selectable:M}]),onClick:ce,onDoubleClick:oe,onContextMenu:ne,onMouseEnter:Q,onMouseMove:le,onMouseLeave:ae,onKeyDown:T?ue:void 0,tabIndex:T?0:void 0,role:y.ariaRole??(T?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":T?`${tq}-${x}`:void 0,ref:O,...y.domAttributes,children:[!U&&f.jsx(N,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:M,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:X,sourceY:te,targetX:I,targetY:L,sourcePosition:F,targetPosition:q,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:G,markerEnd:ee,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),z&&f.jsx(qRt,{edge:y,isReconnectable:z,reconnectRadius:_,onReconnect:d,onReconnectStart:p,onReconnectEnd:m,sourceX:X,sourceY:te,targetX:I,targetY:L,sourcePosition:F,targetPosition:q,setUpdateHover:$,setReconnecting:H})]})})}var GRt=R.memo(URt);const WRt=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Eq({defaultMarkerColor:e,onlyRenderVisibleElements:n,rfId:t,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:l,onEdgeMouseLeave:u,onEdgeClick:_,reconnectRadius:d,onEdgeDoubleClick:p,onReconnectStart:m,onReconnectEnd:x,disableKeyboardA11y:S}){const{edgesFocusable:v,edgesReconnectable:b,elementsSelectable:w,onError:y}=An(WRt,kr),C=TRt(n);return f.jsxs("div",{className:"react-flow__edges",children:[f.jsx(LRt,{defaultColor:e,rfId:t}),C.map(E=>f.jsx(GRt,{id:E,edgesFocusable:v,edgesReconnectable:b,elementsSelectable:w,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:o,onMouseMove:l,onMouseLeave:u,onClick:_,reconnectRadius:d,onDoubleClick:p,onReconnectStart:m,onReconnectEnd:x,rfId:t,onError:y,edgeTypes:r,disableKeyboardA11y:S},E))]})}Eq.displayName="EdgeRenderer";const VRt=R.memo(Eq),KRt=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function QRt({children:e}){const n=An(KRt);return f.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}function YRt(e){const n=Pk(),t=R.useRef(!1);R.useEffect(()=>{!t.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),t.current=!0)},[e,n.viewportInitialized])}const XRt=e=>{var n;return(n=e.panZoom)==null?void 0:n.syncViewport};function ZRt(e){const n=An(XRt),t=Er();return R.useEffect(()=>{e&&(n==null||n(e),t.setState({transform:[e.x,e.y,e.zoom]}))},[e,n]),null}function JRt(e){return e.connection.inProgress?{...e.connection,to:gm(e.connection.to,e.transform)}:{...e.connection}}function eMt(e){return JRt}function tMt(e){const n=eMt();return An(n,kr)}const nMt=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function rMt({containerStyle:e,style:n,type:t,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:o,inProgress:l}=An(nMt,kr);return!(i&&s&&l)?null:f.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:f.jsx("g",{className:as(["react-flow__connection",CH(o)]),children:f.jsx(Nq,{style:n,type:t,CustomComponent:r,isValid:o})})})}const Nq=({style:e,type:n=Vc.Bezier,CustomComponent:t,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:o,fromPosition:l,to:u,toNode:_,toHandle:d,toPosition:p,pointer:m}=tMt();if(!s)return;if(t)return f.jsx(t,{connectionLineType:n,connectionLineStyle:e,fromNode:a,fromHandle:o,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:l,toPosition:p,connectionStatus:CH(r),toNode:_,toHandle:d,pointer:m});let x="";const S={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:u.x,targetY:u.y,targetPosition:p};switch(n){case Vc.Bezier:[x]=BH(S);break;case Vc.SimpleBezier:[x]=_q(S);break;case Vc.Step:[x]=y5({...S,borderRadius:0});break;case Vc.SmoothStep:[x]=y5(S);break;default:[x]=PH(S)}return f.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:e})};Nq.displayName="ConnectionLine";const sMt={};function HR(e=sMt){R.useRef(e),Er(),R.useEffect(()=>{},[e])}function iMt(){Er(),R.useRef(!1),R.useEffect(()=>{},[])}function zq({nodeTypes:e,edgeTypes:n,onInit:t,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:o,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:_,onSelectionContextMenu:d,onSelectionStart:p,onSelectionEnd:m,connectionLineType:x,connectionLineStyle:S,connectionLineComponent:v,connectionLineContainerStyle:b,selectionKeyCode:w,selectionOnDrag:y,selectionMode:C,multiSelectionKeyCode:E,panActivationKeyCode:N,zoomActivationKeyCode:T,deleteKeyCode:z,onlyRenderVisibleElements:M,elementsSelectable:O,defaultViewport:B,translateExtent:$,minZoom:U,maxZoom:H,preventScrolling:Y,defaultMarkerColor:V,zoomOnScroll:X,zoomOnPinch:te,panOnScroll:I,panOnScrollSpeed:L,panOnScrollMode:F,zoomOnDoubleClick:q,panOnDrag:G,autoPanOnSelection:ee,onPaneClick:ce,onPaneMouseEnter:oe,onPaneMouseMove:ne,onPaneMouseLeave:Q,onPaneScroll:le,onPaneContextMenu:ae,paneClickDistance:ue,nodeClickDistance:pe,onEdgeContextMenu:Se,onEdgeMouseEnter:ye,onEdgeMouseMove:qe,onEdgeMouseLeave:Ie,reconnectRadius:ze,onReconnect:at,onReconnectStart:bt,onReconnectEnd:$t,noDragClassName:Pt,noWheelClassName:zt,noPanClassName:ot,disableKeyboardA11y:ft,nodeExtent:It,rfId:we,viewport:Re,onViewportChange:Ze}){return HR(e),HR(n),iMt(),YRt(t),ZRt(Re),f.jsx(yRt,{onPaneClick:ce,onPaneMouseEnter:oe,onPaneMouseMove:ne,onPaneMouseLeave:Q,onPaneContextMenu:ae,onPaneScroll:le,paneClickDistance:ue,deleteKeyCode:z,selectionKeyCode:w,selectionOnDrag:y,selectionMode:C,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:E,panActivationKeyCode:N,zoomActivationKeyCode:T,elementsSelectable:O,zoomOnScroll:X,zoomOnPinch:te,zoomOnDoubleClick:q,panOnScroll:I,panOnScrollSpeed:L,panOnScrollMode:F,panOnDrag:G,autoPanOnSelection:ee,defaultViewport:B,translateExtent:$,minZoom:U,maxZoom:H,onSelectionContextMenu:d,preventScrolling:Y,noDragClassName:Pt,noWheelClassName:zt,noPanClassName:ot,disableKeyboardA11y:ft,onViewportChange:Ze,isControlledViewport:!!Re,children:f.jsxs(QRt,{children:[f.jsx(VRt,{edgeTypes:n,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:at,onReconnectStart:bt,onReconnectEnd:$t,onlyRenderVisibleElements:M,onEdgeContextMenu:Se,onEdgeMouseEnter:ye,onEdgeMouseMove:qe,onEdgeMouseLeave:Ie,reconnectRadius:ze,defaultMarkerColor:V,noPanClassName:ot,disableKeyboardA11y:ft,rfId:we}),f.jsx(rMt,{style:S,type:x,component:v,containerStyle:b}),f.jsx("div",{className:"react-flow__edgelabel-renderer"}),f.jsx(jRt,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:o,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:_,nodeClickDistance:pe,onlyRenderVisibleElements:M,noPanClassName:ot,noDragClassName:Pt,disableKeyboardA11y:ft,nodeExtent:It,rfId:we}),f.jsx("div",{className:"react-flow__viewport-portal"})]})})}zq.displayName="GraphView";const aMt=R.memo(zq),oMt=AH(),qR=({nodes:e,edges:n,defaultNodes:t,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:l=.5,maxZoom:u=2,nodeOrigin:_,nodeExtent:d,zIndexMode:p="basic"}={})=>{const m=new Map,x=new Map,S=new Map,v=new Map,b=r??n??[],w=t??e??[],y=_??[0,0],C=d??Ep;qH(S,v,b);const{nodesInitialized:E}=w5(w,m,x,{nodeOrigin:y,nodeExtent:C,zIndexMode:p});let N=[0,0,1];if(a&&s&&i){const T=pm(m,{filter:B=>!!((B.width||B.initialWidth)&&(B.height||B.initialHeight))}),{x:z,y:M,zoom:O}=Mk(T,s,i,l,u,(o==null?void 0:o.padding)??.1);N=[z,M,O]}return{rfId:"1",width:s??0,height:i??0,transform:N,nodes:w,nodesInitialized:E,nodeLookup:m,parentLookup:x,edges:b,edgeLookup:v,connectionLookup:S,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:t!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:l,maxZoom:u,translateExtent:Ep,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:t_.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:o,fitViewResolver:null,connection:{...kH},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:oMt,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:SH,zIndexMode:p,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},lMt=({nodes:e,edges:n,defaultNodes:t,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:l,maxZoom:u,nodeOrigin:_,nodeExtent:d,zIndexMode:p})=>vAt((m,x)=>{async function S(){const{nodeLookup:v,panZoom:b,fitViewOptions:w,fitViewResolver:y,width:C,height:E,minZoom:N,maxZoom:T}=x();b&&(await yTt({nodes:v,width:C,height:E,panZoom:b,minZoom:N,maxZoom:T},w),y==null||y.resolve(!0),m({fitViewResolver:null}))}return{...qR({nodes:e,edges:n,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:l,maxZoom:u,nodeOrigin:_,nodeExtent:d,defaultNodes:t,defaultEdges:r,zIndexMode:p}),setNodes:v=>{const{nodeLookup:b,parentLookup:w,nodeOrigin:y,elevateNodesOnSelect:C,fitViewQueued:E,zIndexMode:N,nodesSelectionActive:T}=x(),{nodesInitialized:z,hasSelectedNodes:M}=w5(v,b,w,{nodeOrigin:y,nodeExtent:d,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:N}),O=T&&M;E&&z?(S(),m({nodes:v,nodesInitialized:z,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:O})):m({nodes:v,nodesInitialized:z,nodesSelectionActive:O})},setEdges:v=>{const{connectionLookup:b,edgeLookup:w}=x();qH(b,w,v),m({edges:v})},setDefaultNodesAndEdges:(v,b)=>{if(v){const{setNodes:w}=x();w(v),m({hasDefaultNodes:!0})}if(b){const{setEdges:w}=x();w(b),m({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:b,nodeLookup:w,parentLookup:y,domNode:C,nodeOrigin:E,nodeExtent:N,debug:T,fitViewQueued:z,zIndexMode:M}=x(),{changes:O,updatedInternals:B}=qTt(v,w,y,C,E,N,M);B&&($Tt(w,y,{nodeOrigin:E,nodeExtent:N,zIndexMode:M}),z?(S(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(O==null?void 0:O.length)>0&&(T&&console.log("React Flow: trigger node changes",O),b==null||b(O)))},updateNodePositions:(v,b=!1)=>{const w=[];let y=[];const{nodeLookup:C,triggerNodeChanges:E,connection:N,updateConnection:T,onNodesChangeMiddlewareMap:z}=x();for(const[M,O]of v){const B=C.get(M),$=!!(B!=null&&B.expandParent&&(B!=null&&B.parentId)&&(O!=null&&O.position)),U={id:M,type:"position",position:$?{x:Math.max(0,O.position.x),y:Math.max(0,O.position.y)}:O.position,dragging:b};if(B&&N.inProgress&&N.fromNode.id===B.id){const H=Ud(B,N.fromHandle,Et.Left,!0);T({...N,from:H})}$&&B.parentId&&w.push({id:M,parentId:B.parentId,rect:{...O.internals.positionAbsolute,width:O.measured.width??0,height:O.measured.height??0}}),y.push(U)}if(w.length>0){const{parentLookup:M,nodeOrigin:O}=x(),B=$k(w,C,M,O);y.push(...B)}for(const M of z.values())y=M(y);E(y)},triggerNodeChanges:v=>{const{onNodesChange:b,setNodes:w,nodes:y,hasDefaultNodes:C,debug:E}=x();if(v!=null&&v.length){if(C){const N=$At(v,y);w(N)}E&&console.log("React Flow: trigger node changes",v),b==null||b(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:b,setEdges:w,edges:y,hasDefaultEdges:C,debug:E}=x();if(v!=null&&v.length){if(C){const N=PAt(v,y);w(N)}E&&console.log("React Flow: trigger edge changes",v),b==null||b(v)}},addSelectedNodes:v=>{const{multiSelectionActive:b,edgeLookup:w,nodeLookup:y,triggerNodeChanges:C,triggerEdgeChanges:E}=x();if(b){const N=v.map(T=>rd(T,!0));C(N);return}C(ah(y,new Set([...v]),!0)),E(ah(w))},addSelectedEdges:v=>{const{multiSelectionActive:b,edgeLookup:w,nodeLookup:y,triggerNodeChanges:C,triggerEdgeChanges:E}=x();if(b){const N=v.map(T=>rd(T,!0));E(N);return}E(ah(w,new Set([...v]))),C(ah(y,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:b}={})=>{const{edges:w,nodes:y,nodeLookup:C,triggerNodeChanges:E,triggerEdgeChanges:N}=x(),T=v||y,z=b||w,M=[];for(const B of T){if(!B.selected)continue;const $=C.get(B.id);$&&($.selected=!1),M.push(rd(B.id,!1))}const O=[];for(const B of z)B.selected&&O.push(rd(B.id,!1));E(M),N(O)},setMinZoom:v=>{const{panZoom:b,maxZoom:w}=x();b==null||b.setScaleExtent([v,w]),m({minZoom:v})},setMaxZoom:v=>{const{panZoom:b,minZoom:w}=x();b==null||b.setScaleExtent([w,v]),m({maxZoom:v})},setTranslateExtent:v=>{var b;(b=x().panZoom)==null||b.setTranslateExtent(v),m({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:b,triggerNodeChanges:w,triggerEdgeChanges:y,elementsSelectable:C}=x();if(!C)return;const E=b.reduce((T,z)=>z.selected?[...T,rd(z.id,!1)]:T,[]),N=v.reduce((T,z)=>z.selected?[...T,rd(z.id,!1)]:T,[]);w(E),y(N)},setNodeExtent:v=>{const{nodes:b,nodeLookup:w,parentLookup:y,nodeOrigin:C,elevateNodesOnSelect:E,nodeExtent:N,zIndexMode:T}=x();v[0][0]===N[0][0]&&v[0][1]===N[0][1]&&v[1][0]===N[1][0]&&v[1][1]===N[1][1]||(w5(b,w,y,{nodeOrigin:C,nodeExtent:v,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:T}),m({nodeExtent:v}))},panBy:v=>{const{transform:b,width:w,height:y,panZoom:C,translateExtent:E}=x();return UTt({delta:v,panZoom:C,transform:b,translateExtent:E,width:w,height:y})},setCenter:async(v,b,w)=>{const{width:y,height:C,maxZoom:E,panZoom:N}=x();if(!N)return!1;const T=typeof(w==null?void 0:w.zoom)<"u"?w.zoom:E;return await N.setViewport({x:y/2-v*T,y:C/2-b*T,zoom:T},{duration:w==null?void 0:w.duration,ease:w==null?void 0:w.ease,interpolate:w==null?void 0:w.interpolate}),!0},cancelConnection:()=>{m({connection:{...kH}})},updateConnection:v=>{m({connection:v})},reset:()=>m({...qR()})}},Object.is);function cMt({initialNodes:e,initialEdges:n,defaultNodes:t,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:o,initialFitViewOptions:l,fitView:u,nodeOrigin:_,nodeExtent:d,zIndexMode:p,children:m}){const[x]=R.useState(()=>lMt({nodes:e,edges:n,defaultNodes:t,defaultEdges:r,width:s,height:i,fitView:u,minZoom:a,maxZoom:o,fitViewOptions:l,nodeOrigin:_,nodeExtent:d,zIndexMode:p}));return f.jsx(bAt,{value:x,children:f.jsx(WAt,{children:f.jsx(oRt,{children:m})})})}function uMt({children:e,nodes:n,edges:t,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:o,fitViewOptions:l,minZoom:u,maxZoom:_,nodeOrigin:d,nodeExtent:p,zIndexMode:m}){return R.useContext(cy)?f.jsx(f.Fragment,{children:e}):f.jsx(cMt,{initialNodes:n,initialEdges:t,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:o,initialFitViewOptions:l,initialMinZoom:u,initialMaxZoom:_,nodeOrigin:d,nodeExtent:p,zIndexMode:m,children:e})}const dMt={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function fMt({nodes:e,edges:n,defaultNodes:t,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:o,onEdgeClick:l,onInit:u,onMove:_,onMoveStart:d,onMoveEnd:p,onConnect:m,onConnectStart:x,onConnectEnd:S,onClickConnectStart:v,onClickConnectEnd:b,onNodeMouseEnter:w,onNodeMouseMove:y,onNodeMouseLeave:C,onNodeContextMenu:E,onNodeDoubleClick:N,onNodeDragStart:T,onNodeDrag:z,onNodeDragStop:M,onNodesDelete:O,onEdgesDelete:B,onDelete:$,onSelectionChange:U,onSelectionDragStart:H,onSelectionDrag:Y,onSelectionDragStop:V,onSelectionContextMenu:X,onSelectionStart:te,onSelectionEnd:I,onBeforeDelete:L,connectionMode:F,connectionLineType:q=Vc.Bezier,connectionLineStyle:G,connectionLineComponent:ee,connectionLineContainerStyle:ce,deleteKeyCode:oe="Backspace",selectionKeyCode:ne="Shift",selectionOnDrag:Q=!1,selectionMode:le=Np.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:ue=jp()?"Meta":"Control",zoomActivationKeyCode:pe=jp()?"Meta":"Control",snapToGrid:Se,snapGrid:ye,onlyRenderVisibleElements:qe=!1,selectNodesOnDrag:Ie,nodesDraggable:ze,autoPanOnNodeFocus:at,nodesConnectable:bt,nodesFocusable:$t,nodeOrigin:Pt=nq,edgesFocusable:zt,edgesReconnectable:ot,elementsSelectable:ft=!0,defaultViewport:It=RAt,minZoom:we=.5,maxZoom:Re=2,translateExtent:Ze=Ep,preventScrolling:ht=!0,nodeExtent:xt,defaultMarkerColor:Vt="#b1b1b7",zoomOnScroll:Ve=!0,zoomOnPinch:Ht=!0,panOnScroll:sn=!1,panOnScrollSpeed:fn=.5,panOnScrollMode:Zt=jd.Free,zoomOnDoubleClick:Qn=!0,panOnDrag:Jt=!0,onPaneClick:bn,onPaneMouseEnter:or,onPaneMouseMove:lr,onPaneMouseLeave:br,onPaneScroll:Dn,onPaneContextMenu:Wr,paneClickDistance:Nr=1,nodeClickDistance:vt=0,children:un,onReconnect:Cn,onReconnectStart:en,onReconnectEnd:Jn,onEdgeContextMenu:hn,onEdgeDoubleClick:En,onEdgeMouseEnter:ln,onEdgeMouseMove:pt,onEdgeMouseLeave:kt,reconnectRadius:Ge=10,onNodesChange:mt,onEdgesChange:fr,noDragClassName:cn="nodrag",noWheelClassName:qt="nowheel",noPanClassName:er="nopan",fitView:Ln,fitViewOptions:di,connectOnClick:Xl,attributionPosition:io,proOptions:Ni,defaultEdgeOptions:Ra,elevateNodesOnSelect:tn=!0,elevateEdgesOnSelect:Ys=!1,disableKeyboardA11y:cr=!1,autoPanOnConnect:Rr,autoPanOnNodeDrag:Ke,autoPanOnSelection:Ut=!0,autoPanSpeed:zi,connectionRadius:os,isValidConnection:ks,onError:gs,style:sa,id:Ma,nodeDragThreshold:ao,connectionDragThreshold:Cs,viewport:Da,onViewportChange:Vr,width:Mr,height:nn,colorMode:vs="light",debug:Xs,onScroll:ur,ariaLabelConfig:ls,zIndexMode:Ls="basic",...$r},Dr){const cs=Ma||"1",bs=OAt(vs),yr=R.useCallback(ys=>{ys.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),ur==null||ur(ys)},[ur]);return f.jsx("div",{"data-testid":"rf__wrapper",...$r,onScroll:yr,style:{...sa,...dMt},ref:Dr,className:as(["react-flow",s,bs]),id:Ma,role:"application",children:f.jsxs(uMt,{nodes:e,edges:n,width:Mr,height:nn,fitView:Ln,fitViewOptions:di,minZoom:we,maxZoom:Re,nodeOrigin:Pt,nodeExtent:xt,zIndexMode:Ls,children:[f.jsx(LAt,{nodes:e,edges:n,defaultNodes:t,defaultEdges:r,onConnect:m,onConnectStart:x,onConnectEnd:S,onClickConnectStart:v,onClickConnectEnd:b,nodesDraggable:ze,autoPanOnNodeFocus:at,nodesConnectable:bt,nodesFocusable:$t,edgesFocusable:zt,edgesReconnectable:ot,elementsSelectable:ft,elevateNodesOnSelect:tn,elevateEdgesOnSelect:Ys,minZoom:we,maxZoom:Re,nodeExtent:xt,onNodesChange:mt,onEdgesChange:fr,snapToGrid:Se,snapGrid:ye,connectionMode:F,translateExtent:Ze,connectOnClick:Xl,defaultEdgeOptions:Ra,fitView:Ln,fitViewOptions:di,onNodesDelete:O,onEdgesDelete:B,onDelete:$,onNodeDragStart:T,onNodeDrag:z,onNodeDragStop:M,onSelectionDrag:Y,onSelectionDragStart:H,onSelectionDragStop:V,onMove:_,onMoveStart:d,onMoveEnd:p,noPanClassName:er,nodeOrigin:Pt,rfId:cs,autoPanOnConnect:Rr,autoPanOnNodeDrag:Ke,autoPanSpeed:zi,onError:gs,connectionRadius:os,isValidConnection:ks,selectNodesOnDrag:Ie,nodeDragThreshold:ao,connectionDragThreshold:Cs,onBeforeDelete:L,debug:Xs,ariaLabelConfig:ls,zIndexMode:Ls}),f.jsx(aMt,{onInit:u,onNodeClick:o,onEdgeClick:l,onNodeMouseEnter:w,onNodeMouseMove:y,onNodeMouseLeave:C,onNodeContextMenu:E,onNodeDoubleClick:N,nodeTypes:i,edgeTypes:a,connectionLineType:q,connectionLineStyle:G,connectionLineComponent:ee,connectionLineContainerStyle:ce,selectionKeyCode:ne,selectionOnDrag:Q,selectionMode:le,deleteKeyCode:oe,multiSelectionKeyCode:ue,panActivationKeyCode:ae,zoomActivationKeyCode:pe,onlyRenderVisibleElements:qe,defaultViewport:It,translateExtent:Ze,minZoom:we,maxZoom:Re,preventScrolling:ht,zoomOnScroll:Ve,zoomOnPinch:Ht,zoomOnDoubleClick:Qn,panOnScroll:sn,panOnScrollSpeed:fn,panOnScrollMode:Zt,panOnDrag:Jt,autoPanOnSelection:Ut,onPaneClick:bn,onPaneMouseEnter:or,onPaneMouseMove:lr,onPaneMouseLeave:br,onPaneScroll:Dn,onPaneContextMenu:Wr,paneClickDistance:Nr,nodeClickDistance:vt,onSelectionContextMenu:X,onSelectionStart:te,onSelectionEnd:I,onReconnect:Cn,onReconnectStart:en,onReconnectEnd:Jn,onEdgeContextMenu:hn,onEdgeDoubleClick:En,onEdgeMouseEnter:ln,onEdgeMouseMove:pt,onEdgeMouseLeave:kt,reconnectRadius:Ge,defaultMarkerColor:Vt,noDragClassName:cn,noWheelClassName:qt,noPanClassName:er,rfId:cs,disableKeyboardA11y:cr,nodeExtent:xt,viewport:Da,onViewportChange:Vr}),f.jsx(AAt,{onSelectionChange:U}),un,f.jsx(EAt,{proOptions:Ni,position:io}),f.jsx(CAt,{rfId:cs,disableKeyboardA11y:cr})]})})}var hMt=sq(fMt);function _Mt({dimensions:e,lineWidth:n,variant:t,className:r}){return f.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:as(["react-flow__background-pattern",t,r])})}function pMt({radius:e,className:n}){return f.jsx("circle",{cx:e,cy:e,r:e,className:as(["react-flow__background-pattern","dots",n])})}var Fl;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Fl||(Fl={}));const mMt={[Fl.Dots]:1,[Fl.Lines]:1,[Fl.Cross]:6},gMt=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function jq({id:e,variant:n=Fl.Dots,gap:t=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:o,style:l,className:u,patternClassName:_}){const d=R.useRef(null),{transform:p,patternId:m}=An(gMt,kr),x=r||mMt[n],S=n===Fl.Dots,v=n===Fl.Cross,b=Array.isArray(t)?t:[t,t],w=[b[0]*p[2]||1,b[1]*p[2]||1],y=x*p[2],C=Array.isArray(i)?i:[i,i],E=v?[y,y]:w,N=[C[0]*p[2]||1+E[0]/2,C[1]*p[2]||1+E[1]/2],T=`${m}${e||""}`;return f.jsxs("svg",{className:as(["react-flow__background",u]),style:{...l,...dy,"--xy-background-color-props":o,"--xy-background-pattern-color-props":a},ref:d,"data-testid":"rf__background",children:[f.jsx("pattern",{id:T,x:p[0]%w[0],y:p[1]%w[1],width:w[0],height:w[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:S?f.jsx(pMt,{radius:y/2,className:_}):f.jsx(_Mt,{dimensions:E,lineWidth:s,variant:n,className:_})}),f.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${T})`})]})}jq.displayName="Background";const vMt=R.memo(jq);function bMt(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:f.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function yMt(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:f.jsx("path",{d:"M0 0h32v4.2H0z"})})}function xMt(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:f.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function wMt(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:f.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function SMt(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:f.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function h1({children:e,className:n,...t}){return f.jsx("button",{type:"button",className:as(["react-flow__controls-button",n]),...t,children:e})}const kMt=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Tq({style:e,showZoom:n=!0,showFitView:t=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:o,onInteractiveChange:l,className:u,children:_,position:d="bottom-left",orientation:p="vertical","aria-label":m}){const x=Er(),{isInteractive:S,minZoomReached:v,maxZoomReached:b,ariaLabelConfig:w}=An(kMt,kr),{zoomIn:y,zoomOut:C,fitView:E}=Pk(),N=()=>{y(),i==null||i()},T=()=>{C(),a==null||a()},z=()=>{E(s),o==null||o()},M=()=>{x.setState({nodesDraggable:!S,nodesConnectable:!S,elementsSelectable:!S}),l==null||l(!S)},O=p==="horizontal"?"horizontal":"vertical";return f.jsxs(uy,{className:as(["react-flow__controls",O,u]),position:d,style:e,"data-testid":"rf__controls","aria-label":m??w["controls.ariaLabel"],children:[n&&f.jsxs(f.Fragment,{children:[f.jsx(h1,{onClick:N,className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:b,children:f.jsx(bMt,{})}),f.jsx(h1,{onClick:T,className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:v,children:f.jsx(yMt,{})})]}),t&&f.jsx(h1,{className:"react-flow__controls-fitview",onClick:z,title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:f.jsx(xMt,{})}),r&&f.jsx(h1,{className:"react-flow__controls-interactive",onClick:M,title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:S?f.jsx(SMt,{}):f.jsx(wMt,{})}),_]})}Tq.displayName="Controls";R.memo(Tq);function CMt({id:e,x:n,y:t,width:r,height:s,style:i,color:a,strokeColor:o,strokeWidth:l,className:u,borderRadius:_,shapeRendering:d,selected:p,onClick:m}){const{background:x,backgroundColor:S}=i||{},v=a||x||S;return f.jsx("rect",{className:as(["react-flow__minimap-node",{selected:p},u]),x:n,y:t,rx:_,ry:_,width:r,height:s,style:{fill:v,stroke:o,strokeWidth:l},shapeRendering:d,onClick:m?b=>m(b,e):void 0})}const EMt=R.memo(CMt),NMt=e=>e.nodes.map(n=>n.id),Vw=e=>e instanceof Function?e:()=>e;function zMt({nodeStrokeColor:e,nodeColor:n,nodeClassName:t="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=EMt,onClick:a}){const o=An(NMt,kr),l=Vw(n),u=Vw(e),_=Vw(t),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return f.jsx(f.Fragment,{children:o.map(p=>f.jsx(TMt,{id:p,nodeColorFunc:l,nodeStrokeColorFunc:u,nodeClassNameFunc:_,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:d},p))})}function jMt({id:e,nodeColorFunc:n,nodeStrokeColorFunc:t,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:o,onClick:l}){const{node:u,x:_,y:d,width:p,height:m}=An(x=>{const S=x.nodeLookup.get(e);if(!S)return{node:void 0,x:0,y:0,width:0,height:0};const v=S.internals.userNode,{x:b,y:w}=S.internals.positionAbsolute,{width:y,height:C}=Yl(v);return{node:v,x:b,y:w,width:y,height:C}},kr);return!u||u.hidden||!RH(u)?null:f.jsx(o,{x:_,y:d,width:p,height:m,style:u.style,selected:!!u.selected,className:r(u),color:n(u),borderRadius:s,strokeColor:t(u),strokeWidth:i,shapeRendering:a,onClick:l,id:u.id})}const TMt=R.memo(jMt);var AMt=R.memo(zMt);const RMt=200,MMt=150,DMt=e=>!e.hidden,LMt=e=>{const n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:e.nodeLookup.size>0?jH(pm(e.nodeLookup,{filter:DMt}),n):n,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},OMt="react-flow__minimap-desc";function Aq({style:e,className:n,nodeStrokeColor:t,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:o,bgColor:l,maskColor:u,maskStrokeColor:_,maskStrokeWidth:d,position:p="bottom-right",onClick:m,onNodeClick:x,pannable:S=!1,zoomable:v=!1,ariaLabel:b,inversePan:w,zoomStep:y=1,offsetScale:C=5}){const E=Er(),N=R.useRef(null),{boundingRect:T,viewBB:z,rfId:M,panZoom:O,translateExtent:B,flowWidth:$,flowHeight:U,ariaLabelConfig:H}=An(LMt,kr),Y=(e==null?void 0:e.width)??RMt,V=(e==null?void 0:e.height)??MMt,X=T.width/Y,te=T.height/V,I=Math.max(X,te),L=I*Y,F=I*V,q=C*I,G=T.x-(L-T.width)/2-q,ee=T.y-(F-T.height)/2-q,ce=L+q*2,oe=F+q*2,ne=`${OMt}-${M}`,Q=R.useRef(0),le=R.useRef();Q.current=I,R.useEffect(()=>{if(N.current&&O)return le.current=JTt({domNode:N.current,panZoom:O,getTransform:()=>E.getState().transform,getViewScale:()=>Q.current}),()=>{var Se;(Se=le.current)==null||Se.destroy()}},[O]),R.useEffect(()=>{var Se;(Se=le.current)==null||Se.update({translateExtent:B,width:$,height:U,inversePan:w,pannable:S,zoomStep:y,zoomable:v})},[S,v,w,y,B,$,U]);const ae=m?Se=>{var Ie;const[ye,qe]=((Ie=le.current)==null?void 0:Ie.pointer(Se))||[0,0];m(Se,{x:ye,y:qe})}:void 0,ue=x?R.useCallback((Se,ye)=>{const qe=E.getState().nodeLookup.get(ye).internals.userNode;x(Se,qe)},[]):void 0,pe=b??H["minimap.ariaLabel"];return f.jsx(uy,{position:p,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof _=="string"?_:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*I:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof t=="string"?t:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:as(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:f.jsxs("svg",{width:Y,height:V,viewBox:`${G} ${ee} ${ce} ${oe}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ne,ref:N,onClick:ae,children:[pe&&f.jsx("title",{id:ne,children:pe}),f.jsx(AMt,{onClick:ue,nodeColor:r,nodeStrokeColor:t,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:o}),f.jsx("path",{className:"react-flow__minimap-mask",d:`M${G-q},${ee-q}h${ce+q*2}v${oe+q*2}h${-ce-q*2}z - M${z.x},${z.y}h${z.width}v${z.height}h${-z.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Aq.displayName="MiniMap";R.memo(Aq);const IMt=e=>n=>e?`${Math.max(1/n.transform[2],1)}`:void 0,BMt={[s_.Line]:"right",[s_.Handle]:"bottom-right"};function $Mt({nodeId:e,position:n,variant:t=s_.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:o=10,minHeight:l=10,maxWidth:u=Number.MAX_VALUE,maxHeight:_=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:p,autoScale:m=!0,shouldResize:x,onResizeStart:S,onResize:v,onResizeEnd:b}){const w=lq(),y=typeof e=="string"?e:w,C=Er(),E=R.useRef(null),N=t===s_.Handle,T=An(R.useCallback(IMt(N&&m),[N,m]),kr),z=R.useRef(null),M=n??BMt[t];R.useEffect(()=>{if(!(!E.current||!y))return z.current||(z.current=fAt({domNode:E.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:B,transform:$,snapGrid:U,snapToGrid:H,nodeOrigin:Y,domNode:V}=C.getState();return{nodeLookup:B,transform:$,snapGrid:U,snapToGrid:H,nodeOrigin:Y,paneDomNode:V}},onChange:(B,$)=>{const{triggerNodeChanges:U,nodeLookup:H,parentLookup:Y,nodeOrigin:V}=C.getState(),X=[],te={x:B.x,y:B.y},I=H.get(y);if(I&&I.expandParent&&I.parentId){const L=I.origin??V,F=B.width??I.measured.width??0,q=B.height??I.measured.height??0,G={id:I.id,parentId:I.parentId,rect:{width:F,height:q,...MH({x:B.x??I.position.x,y:B.y??I.position.y},{width:F,height:q},I.parentId,H,L)}},ee=$k([G],H,Y,V);X.push(...ee),te.x=B.x?Math.max(L[0]*F,B.x):void 0,te.y=B.y?Math.max(L[1]*q,B.y):void 0}if(te.x!==void 0&&te.y!==void 0){const L={id:y,type:"position",position:{...te}};X.push(L)}if(B.width!==void 0&&B.height!==void 0){const F={id:y,type:"dimensions",resizing:!0,setAttributes:p?p==="horizontal"?"width":"height":!0,dimensions:{width:B.width,height:B.height}};X.push(F)}for(const L of $){const F={...L,type:"position"};X.push(F)}U(X)},onEnd:({width:B,height:$})=>{const U={id:y,type:"dimensions",resizing:!1,dimensions:{width:B,height:$}};C.getState().triggerNodeChanges([U])}})),z.current.update({controlPosition:M,boundaries:{minWidth:o,minHeight:l,maxWidth:u,maxHeight:_},keepAspectRatio:d,resizeDirection:p,onResizeStart:S,onResize:v,onResizeEnd:b,shouldResize:x}),()=>{var B;(B=z.current)==null||B.destroy()}},[M,o,l,u,_,d,S,v,b,x]);const O=M.split("-");return f.jsx("div",{className:as(["react-flow__resize-control","nodrag",...O,t,r]),ref:E,style:{...s,scale:T,...a&&{[N?"backgroundColor":"borderColor"]:a}},children:i})}R.memo($Mt);function PMt(){const[e,n]=R.useState(0),[t,r]=R.useState(0);return{ref:R.useCallback(i=>{if(!i)return;function a(){n(i.offsetWidth),r(i.offsetHeight)}const o=new ResizeObserver(a),l=new MutationObserver(a);return o.observe(i),l.observe(i,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),a(),()=>{o.disconnect(),l.disconnect()}},[]),offsetWidth:e,offsetHeight:t}}const _1=8;function FMt(e,n){const{offsetWidth:t,offsetHeight:r}=n,[{viewHeight:s,viewWidth:i},a]=R.useState({viewWidth:0,viewHeight:0});R.useEffect(()=>{function _(){a({viewWidth:window.innerWidth,viewHeight:window.innerHeight})}return window.addEventListener("resize",_),_(),()=>window.removeEventListener("resize",_)},[]);let o=0,l=0,u=0;if(e){const{distance:_}=e;switch(e.anchor){case"left":o=e.x-t-_,l=e.y+e.height/2-r/2;break;case"right":o=e.x+e.width+_,l=e.y+e.height/2-r/2;break;case"below":o=e.x+e.width/2-t/2,l=e.y+e.height+_;break;case"above":o=e.x+e.width/2-t/2,l=e.y-r-_;break}const d=o,p=l;o=Math.min(Math.max(o,_1),i-t-_1),l=Math.min(Math.max(l,_1),s-r-_1),u=e.anchor==="left"||e.anchor==="right"?p-l:d-o}return{x:o,y:l,arrowAdjustment:u}}const Kw=380,Qw=12,HMt=350,qMt=150,C5=new EventTarget;function UMt(){C5.dispatchEvent(new Event("move"))}function GMt(e,n){const[t,r]=R.useState(null),s=R.useRef(void 0),i=R.useRef(void 0);R.useEffect(()=>{const u=()=>{window.clearTimeout(s.current),window.clearTimeout(i.current),r(null)};return C5.addEventListener("move",u),()=>{C5.removeEventListener("move",u),window.clearTimeout(s.current),window.clearTimeout(i.current)}},[]),R.useEffect(()=>{r(u=>{var d;if(!u)return u;const _=((d=e.current)==null?void 0:d.getBoundingClientRect())??null;return _&&u.x===_.x&&u.y===_.y&&u.width===_.width&&u.height===_.height?u:_})},[e,n]);const a=R.useCallback(()=>{window.clearTimeout(i.current),window.clearTimeout(s.current),s.current=window.setTimeout(()=>{var u;r(((u=e.current)==null?void 0:u.getBoundingClientRect())??null)},HMt)},[e]),o=R.useCallback(()=>{window.clearTimeout(s.current),window.clearTimeout(i.current),i.current=window.setTimeout(()=>r(null),qMt)},[]),l=R.useCallback(()=>window.clearTimeout(i.current),[]);return{rect:t,onMouseEnter:a,onMouseLeave:o,keepOpen:l}}function WMt(e){const n=new Date(e),t=n.getFullYear()===new Date().getFullYear()?{month:"short",day:"numeric"}:{month:"short",day:"numeric",year:"numeric"};return n.toLocaleDateString(j(),t)}function VMt({exp:e,runs:n,latestRun:t,parentSlug:r,anchor:s,onOpenLogs:i,onOpenCode:a,onMouseEnter:o,onMouseLeave:l}){const u=PMt(),_=s.right+Qw+Kw<=window.innerWidth,d=s.x-Qw-Kw>=0,p=_?"right":d?"left":s.y>window.innerHeight/2?"above":"below",{x:m,y:x}=FMt({x:s.x,y:s.y,width:s.width,height:s.height,anchor:p,distance:Qw},u),S=e.parentExperimentId&&(t!=null&&t.commitSha)?t.id:null,{data:v}=ct({...xgt(S??""),enabled:!!S,subscribed:!!S}),b=R.useMemo(()=>{if(!v)return null;const B=v;let $=B.diff;if(B.truncated){const V=$.lastIndexOf(` +`)),_=u.reduce((d,p)=>d.concat(...p),[]);return[u,_]}return[[],[]]},[e]);return R.useEffect(()=>{const l=(n==null?void 0:n.target)??ER,u=(n==null?void 0:n.actInsideInputWithModifier)??!0;if(e!==null){const _=m=>{var v,b;if(s.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!s.current||s.current&&!u)&&LH(m))return!1;const S=zR(m.code,o);if(i.current.add(m[S]),NR(a,i.current,!1)){const w=((b=(v=m.composedPath)==null?void 0:v.call(m))==null?void 0:b[0])||m.target,y=(w==null?void 0:w.nodeName)==="BUTTON"||(w==null?void 0:w.nodeName)==="A";n.preventDefault!==!1&&(s.current||!y)&&m.preventDefault(),r(!0)}},d=m=>{const x=zR(m.code,o);NR(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(m[x]),m.key==="Meta"&&i.current.clear(),s.current=!1},p=()=>{i.current.clear(),r(!1)};return l==null||l.addEventListener("keydown",_),l==null||l.addEventListener("keyup",d),window.addEventListener("blur",p),window.addEventListener("contextmenu",p),()=>{l==null||l.removeEventListener("keydown",_),l==null||l.removeEventListener("keyup",d),window.removeEventListener("blur",p),window.removeEventListener("contextmenu",p)}}},[e,r]),t}function NR(e,n,t){return e.filter(r=>t||r.length===n.size).some(r=>r.every(s=>n.has(s)))}function zR(e,n){return n.includes(e)?"code":"key"}const IAt=()=>{const e=wr();return R.useMemo(()=>({zoomIn:async n=>{const{panZoom:t}=e.getState();return t?t.scaleBy(1.2,n):!1},zoomOut:async n=>{const{panZoom:t}=e.getState();return t?t.scaleBy(1/1.2,n):!1},zoomTo:async(n,t)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(n,t):!1},getZoom:()=>e.getState().transform[2],setViewport:async(n,t)=>{const{transform:[r,s,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:n.x??r,y:n.y??s,zoom:n.zoom??i},t),!0):!1},getViewport:()=>{const[n,t,r]=e.getState().transform;return{x:n,y:t,zoom:r}},setCenter:async(n,t,r)=>e.getState().setCenter(n,t,r),fitBounds:async(n,t)=>{const{width:r,height:s,minZoom:i,maxZoom:a,panZoom:o}=e.getState(),l=Mk(n,r,s,i,a,(t==null?void 0:t.padding)??.1);return o?(await o.setViewport(l,{duration:t==null?void 0:t.duration,ease:t==null?void 0:t.ease,interpolate:t==null?void 0:t.interpolate}),!0):!1},screenToFlowPosition:(n,t={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:a}=e.getState();if(!a)return n;const{x:o,y:l}=a.getBoundingClientRect(),u={x:n.x-o,y:n.y-l},_=t.snapGrid??s,d=t.snapToGrid??i;return gm(u,r,d,_)},flowToScreenPosition:n=>{const{transform:t,domNode:r}=e.getState();if(!r)return n;const{x:s,y:i}=r.getBoundingClientRect(),a=Jh(n,t);return{x:a.x+s,y:a.y+i}}}),[])};function rq(e,n){const t=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of n){const a=r.get(i.id);if(!a){t.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){t.push({...a[0].item});continue}const o={...i};for(const l of a)BAt(l,o);t.push(o)}return s.length&&s.forEach(i=>{i.index!==void 0?t.splice(i.index,0,{...i.item}):t.push({...i.item})}),t}function BAt(e,n){switch(e.type){case"select":{n.selected=e.selected;break}case"position":{typeof e.position<"u"&&(n.position=e.position),typeof e.dragging<"u"&&(n.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(n.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(n.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(n.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(n.resizing=e.resizing);break}}}function $At(e,n){return rq(e,n)}function PAt(e,n){return rq(e,n)}function Ju(e,n){return{id:e,type:"select",selected:n}}function nh(e,n=new Set,t=!1){const r=[];for(const[s,i]of e){const a=n.has(s);!(i.selected===void 0&&!a)&&i.selected!==a&&(t&&(i.selected=a),r.push(Ju(i.id,a)))}return r}function jR({items:e=[],lookup:n}){var s;const t=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const o=n.get(a.id),l=((s=o==null?void 0:o.internals)==null?void 0:s.userNode)??o;l!==void 0&&l!==a&&t.push({id:a.id,item:a,type:"replace"}),l===void 0&&t.push({item:a,type:"add",index:i})}for(const[i]of n)r.get(i)===void 0&&t.push({id:i,type:"remove"});return t}function TR(e){return{id:e.id,type:"remove"}}const FAt=AH();function HAt(e,n,t={}){return ATt(e,n,{...t,onError:t.onError??FAt})}const AR=e=>mTt(e),qAt=e=>EH(e);function sq(e){return R.forwardRef(e)}const UAt=typeof window<"u"?R.useLayoutEffect:R.useEffect;function RR(e){const[n,t]=R.useState(BigInt(0)),[r]=R.useState(()=>GAt(()=>t(s=>s+BigInt(1))));return UAt(()=>{const s=r.get();s.length&&(e(s),r.reset())},[n]),r}function GAt(e){let n=[];return{get:()=>n,reset:()=>{n=[]},push:t=>{n.push(t),e()}}}const iq=R.createContext(null);function WAt({children:e}){const n=wr(),t=R.useCallback(o=>{const{nodes:l=[],setNodes:u,hasDefaultNodes:_,onNodesChange:d,nodeLookup:p,fitViewQueued:m,onNodesChangeMiddlewareMap:x}=n.getState();let S=l;for(const b of o)S=typeof b=="function"?b(S):b;let v=jR({items:S,lookup:p});for(const b of x.values())v=b(v);_&&u(S),v.length>0?d==null||d(v):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:b,nodes:w,setNodes:y}=n.getState();b&&y(w)})},[]),r=RR(t),s=R.useCallback(o=>{const{edges:l=[],setEdges:u,hasDefaultEdges:_,onEdgesChange:d,edgeLookup:p}=n.getState();let m=l;for(const x of o)m=typeof x=="function"?x(m):x;_?u(m):d&&d(jR({items:m,lookup:p}))},[]),i=RR(s),a=R.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return f.jsx(iq.Provider,{value:a,children:e})}function VAt(){const e=R.useContext(iq);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const KAt=e=>!!e.panZoom;function Pk(){const e=IAt(),n=wr(),t=VAt(),r=zn(KAt),s=R.useMemo(()=>{const i=d=>n.getState().nodeLookup.get(d),a=d=>{t.nodeQueue.push(d)},o=d=>{t.edgeQueue.push(d)},l=d=>{var b,w;const{nodeLookup:p,nodeOrigin:m}=n.getState(),x=AR(d)?d:p.get(d.id),S=x.parentId?MH(x.position,x.measured,x.parentId,p,m):x.position,v={...x,position:S,width:((b=x.measured)==null?void 0:b.width)??x.width,height:((w=x.measured)==null?void 0:w.height)??x.height};return zp(v)},u=(d,p,m={replace:!1})=>{a(x=>x.map(S=>{if(S.id===d){const v=typeof p=="function"?p(S):p;return m.replace&&AR(v)?v:{...S,...v}}return S}))},_=(d,p,m={replace:!1})=>{o(x=>x.map(S=>{if(S.id===d){const v=typeof p=="function"?p(S):p;return m.replace&&qAt(v)?v:{...S,...v}}return S}))};return{getNodes:()=>n.getState().nodes.map(d=>({...d})),getNode:d=>{var p;return(p=i(d))==null?void 0:p.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:d=[]}=n.getState();return d.map(p=>({...p}))},getEdge:d=>n.getState().edgeLookup.get(d),setNodes:a,setEdges:o,addNodes:d=>{const p=Array.isArray(d)?d:[d];t.nodeQueue.push(m=>[...m,...p])},addEdges:d=>{const p=Array.isArray(d)?d:[d];t.edgeQueue.push(m=>[...m,...p])},toObject:()=>{const{nodes:d=[],edges:p=[],transform:m}=n.getState(),[x,S,v]=m;return{nodes:d.map(b=>({...b})),edges:p.map(b=>({...b})),viewport:{x,y:S,zoom:v}}},deleteElements:async({nodes:d=[],edges:p=[]})=>{const{nodes:m,edges:x,onNodesDelete:S,onEdgesDelete:v,triggerNodeChanges:b,triggerEdgeChanges:w,onDelete:y,onBeforeDelete:C}=n.getState(),{nodes:E,edges:N}=await xTt({nodesToRemove:d,edgesToRemove:p,nodes:m,edges:x,onBeforeDelete:C}),T=N.length>0,z=E.length>0;if(T){const M=N.map(TR);v==null||v(N),w(M)}if(z){const M=E.map(TR);S==null||S(E),b(M)}return(z||T)&&(y==null||y({nodes:E,edges:N})),{deletedNodes:E,deletedEdges:N}},getIntersectingNodes:(d,p=!0,m)=>{const x=aR(d),S=x?d:l(d),v=m!==void 0;return S?(m||n.getState().nodes).filter(b=>{const w=n.getState().nodeLookup.get(b.id);if(w&&!x&&(b.id===d.id||!w.internals.positionAbsolute))return!1;const y=zp(v?b:w),C=Pv(y,S);return p&&C>0||C>=y.width*y.height||C>=S.width*S.height}):[]},isNodeIntersecting:(d,p,m=!0)=>{const S=aR(d)?d:l(d);if(!S)return!1;const v=Pv(S,p);return m&&v>0||v>=p.width*p.height||v>=S.width*S.height},updateNode:u,updateNodeData:(d,p,m={replace:!1})=>{u(d,x=>{const S=typeof p=="function"?p(x):p;return m.replace?{...x,data:S}:{...x,data:{...x.data,...S}}},m)},updateEdge:_,updateEdgeData:(d,p,m={replace:!1})=>{_(d,x=>{const S=typeof p=="function"?p(x):p;return m.replace?{...x,data:S}:{...x,data:{...x.data,...S}}},m)},getNodesBounds:d=>{const{nodeLookup:p,nodeOrigin:m}=n.getState();return gTt(d,{nodeLookup:p,nodeOrigin:m})},getHandleConnections:({type:d,id:p,nodeId:m})=>{var x;return Array.from(((x=n.getState().connectionLookup.get(`${m}-${d}${p?`-${p}`:""}`))==null?void 0:x.values())??[])},getNodeConnections:({type:d,handleId:p,nodeId:m})=>{var x;return Array.from(((x=n.getState().connectionLookup.get(`${m}${d?p?`-${d}-${p}`:`-${d}`:""}`))==null?void 0:x.values())??[])},fitView:async d=>{const p=n.getState().fitViewResolver??kTt();return n.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:p}),t.nodeQueue.push(m=>[...m]),p.promise}}},[]);return R.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const MR=e=>e.selected,QAt=typeof window<"u"?window:void 0;function YAt({deleteKeyCode:e,multiSelectionKeyCode:n}){const t=wr(),{deleteElements:r}=Pk(),s=Tp(e,{actInsideInputWithModifier:!1}),i=Tp(n,{target:QAt});R.useEffect(()=>{if(s){const{edges:a,nodes:o}=t.getState();r({nodes:o.filter(MR),edges:a.filter(MR)}),t.setState({nodesSelectionActive:!1})}},[s]),R.useEffect(()=>{t.setState({multiSelectionActive:i})},[i])}function XAt(e){const n=wr();R.useEffect(()=>{const t=()=>{var s,i,a,o;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=Dk(e.current);(r.height===0||r.width===0)&&((o=(a=n.getState()).onError)==null||o.call(a,"004",Ja.error004())),n.setState({width:r.width||500,height:r.height||500})};if(e.current){t(),window.addEventListener("resize",t);const r=new ResizeObserver(()=>t());return r.observe(e.current),()=>{window.removeEventListener("resize",t),r&&e.current&&r.unobserve(e.current)}}},[])}const dy={position:"absolute",width:"100%",height:"100%",top:0,left:0},ZAt=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function JAt({onPaneContextMenu:e,zoomOnScroll:n=!0,zoomOnPinch:t=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=Cd.Free,zoomOnDoubleClick:a=!0,panOnDrag:o=!0,defaultViewport:l,translateExtent:u,minZoom:_,maxZoom:d,zoomActivationKeyCode:p,preventScrolling:m=!0,children:x,noWheelClassName:S,noPanClassName:v,onViewportChange:b,isControlledViewport:w,paneClickDistance:y,selectionOnDrag:C}){const E=wr(),N=R.useRef(null),{userSelectionActive:T,lib:z,connectionInProgress:M}=zn(ZAt,yr),I=Tp(p),B=R.useRef();XAt(N);const $=R.useCallback(U=>{b==null||b({x:U[0],y:U[1],zoom:U[2]}),w||E.setState({transform:U})},[b,w]);return R.useEffect(()=>{if(N.current){B.current=oAt({domNode:N.current,minZoom:_,maxZoom:d,translateExtent:u,viewport:l,onDraggingChange:V=>E.setState(X=>X.paneDragging===V?X:{paneDragging:V}),onPanZoomStart:(V,X)=>{const{onViewportChangeStart:ee,onMoveStart:O}=E.getState();O==null||O(V,X),ee==null||ee(X)},onPanZoom:(V,X)=>{const{onViewportChange:ee,onMove:O}=E.getState();O==null||O(V,X),ee==null||ee(X)},onPanZoomEnd:(V,X)=>{const{onViewportChangeEnd:ee,onMoveEnd:O}=E.getState();O==null||O(V,X),ee==null||ee(X)}});const{x:U,y:H,zoom:Y}=B.current.getViewport();return E.setState({panZoom:B.current,transform:[U,H,Y],domNode:N.current.closest(".react-flow")}),()=>{var V;(V=B.current)==null||V.destroy()}}},[]),R.useEffect(()=>{var U;(U=B.current)==null||U.update({onPaneContextMenu:e,zoomOnScroll:n,zoomOnPinch:t,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:o,zoomActivationKeyPressed:I,preventScrolling:m,noPanClassName:v,userSelectionActive:T,noWheelClassName:S,lib:z,onTransformChange:$,connectionInProgress:M,selectionOnDrag:C,paneClickDistance:y})},[e,n,t,r,s,i,a,o,I,m,v,T,S,z,$,M,C,y]),f.jsx("div",{className:"react-flow__renderer",ref:N,style:dy,children:x})}const eRt=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function tRt(){const{userSelectionActive:e,userSelectionRect:n}=zn(eRt,yr);return e&&n?f.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const Ww=(e,n)=>t=>{t.target===n.current&&(e==null||e(t))},nRt=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function rRt({isSelecting:e,selectionKeyPressed:n,selectionMode:t=Np.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:l,onPaneClick:u,onPaneContextMenu:_,onPaneScroll:d,onPaneMouseEnter:p,onPaneMouseMove:m,onPaneMouseLeave:x,children:S}){const v=R.useRef(0),b=wr(),{userSelectionActive:w,elementsSelectable:y,dragging:C,panBy:E,autoPanSpeed:N}=zn(nRt,yr),T=y&&(e||w),z=R.useRef(null),M=R.useRef(),I=R.useRef(new Set),B=R.useRef(new Set),$=R.useRef(!1),U=R.useRef(!1),H=R.useRef({x:0,y:0}),Y=R.useRef(!1),V=Q=>{if(U.current||$.current||b.getState().connection.inProgress){U.current=!1,$.current=!1;return}u==null||u(Q),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},X=Q=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){Q.preventDefault();return}_==null||_(Q)},ee=d?Q=>d(Q):void 0,O=Q=>{U.current&&(Q.stopPropagation(),U.current=!1)},L=Q=>{var ze,it;const{domNode:le,transform:ae}=b.getState();if(M.current=le==null?void 0:le.getBoundingClientRect(),!M.current)return;const de=Q.target===z.current;if(!de&&!!Q.target.closest(".nokey")||!e||!(a&&de||n)||Q.button!==0||!Q.isPrimary)return;(it=(ze=Q.target)==null?void 0:ze.setPointerCapture)==null||it.call(ze,Q.pointerId),U.current=!1;const{x:be,y:Pe}=Ya(Q.nativeEvent,M.current),Be=gm({x:be,y:Pe},ae);b.setState({userSelectionRect:{width:0,height:0,startX:Be.x,startY:Be.y,x:be,y:Pe}}),de||(Q.stopPropagation(),Q.preventDefault())};function F(Q,le){const{userSelectionRect:ae}=b.getState();if(!ae)return;const{transform:de,nodeLookup:pe,edgeLookup:we,connectionLookup:be,triggerNodeChanges:Pe,triggerEdgeChanges:Be,defaultEdgeOptions:ze}=b.getState(),it={x:ae.startX,y:ae.startY},{x:bt,y:It}=Jh(it,de),$t={startX:it.x,startY:it.y,x:QHt.id)),B.current=new Set;const ut=(ze==null?void 0:ze.selectable)??!0;for(const Ht of I.current){const Se=be.get(Ht);if(Se)for(const{edgeId:Ae}of Se.values()){const Ze=we.get(Ae);Ze&&(Ze.selectable??ut)&&B.current.add(Ae)}}if(!oR(jt,I.current)){const Ht=nh(pe,I.current,!0);Pe(Ht)}if(!oR(ct,B.current)){const Ht=nh(we,B.current);Be(Ht)}b.setState({userSelectionRect:$t,userSelectionActive:!0,nodesSelectionActive:!1})}function q(){if(!s||!M.current)return;const[Q,le]=Rk(H.current,M.current,N);E({x:Q,y:le}).then(ae=>{if(!U.current||!ae){v.current=requestAnimationFrame(q);return}const{x:de,y:pe}=H.current;F(de,pe),v.current=requestAnimationFrame(q)})}const G=()=>{cancelAnimationFrame(v.current),v.current=0,Y.current=!1};R.useEffect(()=>()=>G(),[]);const re=Q=>{const{userSelectionRect:le,transform:ae,resetSelectedElements:de}=b.getState();if(!M.current||!le)return;const{x:pe,y:we}=Ya(Q.nativeEvent,M.current);H.current={x:pe,y:we};const be=Jh({x:le.startX,y:le.startY},ae);if(!U.current){const Pe=n?0:i;if(Math.hypot(pe-be.x,we-be.y)<=Pe)return;de(),o==null||o(Q)}U.current=!0,Y.current||(q(),Y.current=!0),F(pe,we)},ce=Q=>{var le,ae;if(!T){Q.target===z.current&&b.getState().connection.inProgress&&($.current=!0);return}Q.button===0&&((ae=(le=Q.target)==null?void 0:le.releasePointerCapture)==null||ae.call(le,Q.pointerId),!w&&Q.target===z.current&&b.getState().userSelectionRect&&(V==null||V(Q)),b.setState({userSelectionActive:!1,userSelectionRect:null}),U.current&&(l==null||l(Q),b.setState({nodesSelectionActive:I.current.size>0})),G())},oe=Q=>{var le,ae;(ae=(le=Q.target)==null?void 0:le.releasePointerCapture)==null||ae.call(le,Q.pointerId),G()},te=r===!0||Array.isArray(r)&&r.includes(0);return f.jsxs("div",{className:is(["react-flow__pane",{draggable:te,dragging:C,selection:e}]),onClick:T?void 0:Ww(V,z),onContextMenu:Ww(X,z),onWheel:Ww(ee,z),onPointerEnter:T?void 0:p,onPointerMove:T?re:m,onPointerUp:ce,onPointerCancel:T?oe:void 0,onPointerDownCapture:T?L:void 0,onClickCapture:T?O:void 0,onPointerLeave:x,ref:z,style:dy,children:[S,f.jsx(tRt,{})]})}function k5({id:e,store:n,unselect:t=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:o,onError:l}=n.getState(),u=o.get(e);if(!u){l==null||l("012",Ja.error012(e));return}n.setState({nodesSelectionActive:!1}),u.selected?(t||u.selected&&a)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var _;return(_=r==null?void 0:r.current)==null?void 0:_.blur()})):s([e])}function aq({nodeRef:e,disabled:n=!1,noDragClassName:t,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const o=wr(),[l,u]=R.useState(!1),_=R.useRef();return R.useEffect(()=>{_.current=VTt({getStoreItems:()=>o.getState(),onNodeMouseDown:d=>{k5({id:d,store:o,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),R.useEffect(()=>{if(!(n||!e.current||!_.current))return _.current.update({noDragClassName:t,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var d;(d=_.current)==null||d.destroy()}},[t,r,n,i,e,s,a]),l}const sRt=e=>n=>n.selected&&(n.draggable||e&&typeof n.draggable>"u");function oq(){const e=wr();return R.useCallback(t=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:l,nodeLookup:u,nodeOrigin:_}=e.getState(),d=new Map,p=sRt(a),m=s?i[0]:5,x=s?i[1]:5,S=t.direction.x*m*t.factor,v=t.direction.y*x*t.factor;for(const[,b]of u){if(!p(b))continue;let w={x:b.internals.positionAbsolute.x+S,y:b.internals.positionAbsolute.y+v};s&&(w=mm(w,i));const{position:y,positionAbsolute:C}=NH({nodeId:b.id,nextPosition:w,nodeLookup:u,nodeExtent:r,nodeOrigin:_,onError:o});b.position=y,b.internals.positionAbsolute=C,d.set(b.id,b)}l(d)},[])}const Fk=R.createContext(null),iRt=Fk.Provider;Fk.Consumer;const lq=()=>R.useContext(Fk),aRt=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),cq=R.createContext(null);function oRt({children:e}){const n=zn(aRt,yr);return f.jsx(cq.Provider,{value:n,children:e})}function lRt(){const e=R.useContext(cq);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const cRt={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},uRt=(e,n,t)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:o,toHandle:l,isValid:u}=a;if(!o&&!s)return cRt;const _=(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===n&&(l==null?void 0:l.type)===t;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===n&&(o==null?void 0:o.type)===t,connectingTo:_,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===n&&(s==null?void 0:s.type)===t,isPossibleEndHandle:i===Xh.Strict?(o==null?void 0:o.type)!==t:e!==(o==null?void 0:o.nodeId)||n!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!s,valid:_&&u}};function dRt({type:e="source",position:n=Et.Top,isValidConnection:t,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:o,children:l,className:u,onMouseDown:_,onTouchStart:d,...p},m){var Y,V;const x=a||null,S=e==="target",v=wr(),b=lq(),{connectOnClick:w,noPanClassName:y,rfId:C}=lRt(),{connectingFrom:E,connectingTo:N,clickConnecting:T,isPossibleEndHandle:z,connectionInProcess:M,clickConnectionInProcess:I,valid:B}=zn(uRt(b,x,e),yr);b||(V=(Y=v.getState()).onError)==null||V.call(Y,"010",Ja.error010());const $=X=>{const{defaultEdgeOptions:ee,onConnect:O,hasDefaultEdges:L}=v.getState(),F={...ee,...X};if(L){const{edges:q,setEdges:G,onError:re}=v.getState();G(HAt(F,q,{onError:re}))}O==null||O(F),o==null||o(F)},U=X=>{if(!b)return;const ee=OH(X.nativeEvent);if(s&&(ee&&X.button===0||!ee)){const O=v.getState();S5.onPointerDown(X.nativeEvent,{handleDomNode:X.currentTarget,autoPanOnConnect:O.autoPanOnConnect,connectionMode:O.connectionMode,connectionRadius:O.connectionRadius,domNode:O.domNode,nodeLookup:O.nodeLookup,lib:O.lib,isTarget:S,handleId:x,nodeId:b,flowId:O.rfId,panBy:O.panBy,cancelConnection:O.cancelConnection,onConnectStart:O.onConnectStart,onConnectEnd:(...L)=>{var F,q;return(q=(F=v.getState()).onConnectEnd)==null?void 0:q.call(F,...L)},updateConnection:O.updateConnection,onConnect:$,isValidConnection:t||((...L)=>{var F,q;return((q=(F=v.getState()).isValidConnection)==null?void 0:q.call(F,...L))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:O.autoPanSpeed,dragThreshold:O.connectionDragThreshold})}ee?_==null||_(X):d==null||d(X)},H=X=>{const{onClickConnectStart:ee,onClickConnectEnd:O,connectionClickStartHandle:L,connectionMode:F,isValidConnection:q,lib:G,rfId:re,nodeLookup:ce,connection:oe}=v.getState();if(!b||!L&&!s)return;if(!L){ee==null||ee(X.nativeEvent,{nodeId:b,handleId:x,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:b,type:e,id:x}});return}const te=DH(X.target),Q=t||q,{connection:le,isValid:ae}=S5.isValid(X.nativeEvent,{handle:{nodeId:b,id:x,type:e},connectionMode:F,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:Q,flowId:re,doc:te,lib:G,nodeLookup:ce});ae&&le&&$(le);const de=structuredClone(oe);delete de.inProgress,de.toPosition=de.toHandle?de.toHandle.position:null,O==null||O(X,de),v.setState({connectionClickStartHandle:null})};return f.jsx("div",{"data-handleid":x,"data-nodeid":b,"data-handlepos":n,"data-id":`${C}-${b}-${x}-${e}`,className:is(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",y,u,{source:!S,target:S,connectable:r,connectablestart:s,connectableend:i,clickconnecting:T,connectingfrom:E,connectingto:N,valid:B,connectionindicator:r&&(!M||z)&&(M||I?i:s)}]),onMouseDown:U,onTouchStart:U,onClick:w?H:void 0,ref:m,...p,children:l})}const uu=R.memo(sq(dRt));function fRt({data:e,isConnectable:n,sourcePosition:t=Et.Bottom}){return f.jsxs(f.Fragment,{children:[e==null?void 0:e.label,f.jsx(uu,{type:"source",position:t,isConnectable:n})]})}function hRt({data:e,isConnectable:n,targetPosition:t=Et.Top,sourcePosition:r=Et.Bottom}){return f.jsxs(f.Fragment,{children:[f.jsx(uu,{type:"target",position:t,isConnectable:n}),e==null?void 0:e.label,f.jsx(uu,{type:"source",position:r,isConnectable:n})]})}function _Rt(){return null}function pRt({data:e,isConnectable:n,targetPosition:t=Et.Top}){return f.jsxs(f.Fragment,{children:[f.jsx(uu,{type:"target",position:t,isConnectable:n}),e==null?void 0:e.label]})}const Fv={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},DR={input:fRt,default:hRt,output:pRt,group:_Rt};function mRt(e){var n,t,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((n=e.style)==null?void 0:n.width),height:e.height??e.initialHeight??((t=e.style)==null?void 0:t.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const gRt=e=>{const{width:n,height:t,x:r,y:s}=pm(e.nodeLookup,{filter:i=>!!i.selected});return{width:Qa(n)?n:null,height:Qa(t)?t:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function vRt({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:t}){const r=wr(),{width:s,height:i,transformString:a,userSelectionActive:o}=zn(gRt,yr),l=oq(),u=R.useRef(null);R.useEffect(()=>{var m;t||(m=u.current)==null||m.focus({preventScroll:!0})},[t]);const _=!o&&s!==null&&i!==null;if(aq({nodeRef:u,disabled:!_}),!_)return null;const d=e?m=>{const x=r.getState().nodes.filter(S=>S.selected);e(m,x)}:void 0,p=m=>{Object.prototype.hasOwnProperty.call(Fv,m.key)&&(m.preventDefault(),l({direction:Fv[m.key],factor:m.shiftKey?4:1}))};return f.jsx("div",{className:is(["react-flow__nodesselection","react-flow__container",n]),style:{transform:a},children:f.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:t?void 0:-1,onKeyDown:t?void 0:p,style:{width:s,height:i}})})}const LR=typeof window<"u"?window:void 0,bRt=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function uq({children:e,onPaneClick:n,onPaneMouseEnter:t,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:o,deleteKeyCode:l,selectionKeyCode:u,selectionOnDrag:_,selectionMode:d,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:v,elementsSelectable:b,zoomOnScroll:w,zoomOnPinch:y,panOnScroll:C,panOnScrollSpeed:E,panOnScrollMode:N,zoomOnDoubleClick:T,panOnDrag:z,autoPanOnSelection:M,defaultViewport:I,translateExtent:B,minZoom:$,maxZoom:U,preventScrolling:H,onSelectionContextMenu:Y,noWheelClassName:V,noPanClassName:X,disableKeyboardA11y:ee,onViewportChange:O,isControlledViewport:L}){const{nodesSelectionActive:F,userSelectionActive:q}=zn(bRt,yr),G=Tp(u,{target:LR}),re=Tp(S,{target:LR}),ce=re||z,oe=re||C,te=_&&ce!==!0,Q=G||q||te;return YAt({deleteKeyCode:l,multiSelectionKeyCode:x}),f.jsx(JAt,{onPaneContextMenu:i,elementsSelectable:b,zoomOnScroll:w,zoomOnPinch:y,panOnScroll:oe,panOnScrollSpeed:E,panOnScrollMode:N,zoomOnDoubleClick:T,panOnDrag:!G&&ce,defaultViewport:I,translateExtent:B,minZoom:$,maxZoom:U,zoomActivationKeyCode:v,preventScrolling:H,noWheelClassName:V,noPanClassName:X,onViewportChange:O,isControlledViewport:L,paneClickDistance:o,selectionOnDrag:te,children:f.jsxs(rRt,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:n,onPaneMouseEnter:t,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:ce,autoPanOnSelection:M,isSelecting:!!Q,selectionMode:d,selectionKeyPressed:G,paneClickDistance:o,selectionOnDrag:te,children:[e,F&&f.jsx(vRt,{onSelectionContextMenu:Y,noPanClassName:X,disableKeyboardA11y:ee})]})})}uq.displayName="FlowRenderer";const yRt=R.memo(uq),xRt=e=>n=>e?Ak(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map(t=>t.id):Array.from(n.nodeLookup.keys());function wRt(e){return zn(R.useCallback(xRt(e),[e]),yr)}const SRt=e=>e.updateNodeInternals;function kRt(){const e=zn(SRt),[n]=R.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(t=>{const r=new Map;t.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return R.useEffect(()=>()=>{n==null||n.disconnect()},[n]),n}function CRt({node:e,nodeType:n,hasDimensions:t,resizeObserver:r}){const s=wr(),i=R.useRef(null),a=R.useRef(null),o=R.useRef(e.sourcePosition),l=R.useRef(e.targetPosition),u=R.useRef(n),_=t&&!!e.internals.handleBounds;return R.useEffect(()=>{i.current&&!e.hidden&&(!_||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[_,e.hidden]),R.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),R.useEffect(()=>{if(i.current){const d=u.current!==n,p=o.current!==e.sourcePosition,m=l.current!==e.targetPosition;(d||p||m)&&(u.current=n,o.current=e.sourcePosition,l.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),i}function ERt({id:e,onClick:n,onMouseEnter:t,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:o,elementsSelectable:l,nodesConnectable:u,nodesFocusable:_,resizeObserver:d,noDragClassName:p,noPanClassName:m,disableKeyboardA11y:x,rfId:S,nodeTypes:v,nodeClickDistance:b,onError:w}){const{node:y,internals:C,isParent:E}=zn(Q=>{const le=Q.nodeLookup.get(e),ae=Q.parentLookup.has(e);return{node:le,internals:le.internals,isParent:ae}},yr);let N=y.type||"default",T=(v==null?void 0:v[N])||DR[N];T===void 0&&(w==null||w("003",Ja.error003(N)),N="default",T=(v==null?void 0:v.default)||DR.default);const z=!!(y.draggable||o&&typeof y.draggable>"u"),M=!!(y.selectable||l&&typeof y.selectable>"u"),I=!!(y.connectable||u&&typeof y.connectable>"u"),B=!!(y.focusable||_&&typeof y.focusable>"u"),$=wr(),U=RH(y),H=CRt({node:y,nodeType:N,hasDimensions:U,resizeObserver:d}),Y=aq({nodeRef:H,disabled:y.hidden||!z,noDragClassName:p,handleSelector:y.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:b}),V=oq();if(y.hidden)return null;const X=Kl(y),ee=mRt(y),O=M||z||n||t||r||s,L=t?Q=>t(Q,{...C.userNode}):void 0,F=r?Q=>r(Q,{...C.userNode}):void 0,q=s?Q=>s(Q,{...C.userNode}):void 0,G=i?Q=>i(Q,{...C.userNode}):void 0,re=a?Q=>a(Q,{...C.userNode}):void 0,ce=Q=>{const{selectNodesOnDrag:le,nodeDragThreshold:ae}=$.getState();M&&(!le||!z||ae>0)&&k5({id:e,store:$,nodeRef:H}),n&&n(Q,{...C.userNode})},oe=Q=>{if(!(LH(Q.nativeEvent)||x)){if(wH.includes(Q.key)&&M){const le=Q.key==="Escape";k5({id:e,store:$,unselect:le,nodeRef:H})}else if(z&&y.selected&&Object.prototype.hasOwnProperty.call(Fv,Q.key)){Q.preventDefault();const{ariaLabelConfig:le}=$.getState();$.setState({ariaLiveMessage:le["node.a11yDescription.ariaLiveMessage"]({direction:Q.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),V({direction:Fv[Q.key],factor:Q.shiftKey?4:1})}}},te=()=>{var be;if(x||!((be=H.current)!=null&&be.matches(":focus-visible")))return;const{transform:Q,width:le,height:ae,autoPanOnNodeFocus:de,setCenter:pe}=$.getState();if(!de)return;Ak(new Map([[e,y]]),{x:0,y:0,width:le,height:ae},Q,!0).length>0||pe(y.position.x+X.width/2,y.position.y+X.height/2,{zoom:Q[2]})};return f.jsx("div",{className:is(["react-flow__node",`react-flow__node-${N}`,{[m]:z},y.className,{selected:y.selected,selectable:M,parent:E,draggable:z,dragging:Y}]),ref:H,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:O?"all":"none",visibility:U?"visible":"hidden",...y.style,...ee},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:F,onMouseLeave:q,onContextMenu:G,onClick:ce,onDoubleClick:re,onKeyDown:B?oe:void 0,tabIndex:B?0:void 0,onFocus:B?te:void 0,role:y.ariaRole??(B?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${eq}-${S}`,"aria-label":y.ariaLabel,...y.domAttributes,children:f.jsx(iRt,{value:e,children:f.jsx(T,{id:e,data:y.data,type:N,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:y.selected??!1,selectable:M,draggable:z,deletable:y.deletable??!0,isConnectable:I,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:Y,dragHandle:y.dragHandle,zIndex:C.z,parentId:y.parentId,...X})})})}var NRt=R.memo(ERt);const zRt=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function dq(e){const{nodesDraggable:n,nodesConnectable:t,nodesFocusable:r,elementsSelectable:s,onError:i}=zn(zRt,yr),a=wRt(e.onlyRenderVisibleElements),o=kRt();return f.jsx("div",{className:"react-flow__nodes",style:dy,children:a.map(l=>f.jsx(NRt,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:n,nodesConnectable:t,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},l))})}dq.displayName="NodeRenderer";const jRt=R.memo(dq);function TRt(e){return zn(R.useCallback(t=>{if(!e)return t.edges.map(s=>s.id);const r=[];if(t.width&&t.height)for(const s of t.edges){const i=t.nodeLookup.get(s.source),a=t.nodeLookup.get(s.target);i&&a&&zTt({sourceNode:i,targetNode:a,width:t.width,height:t.height,transform:t.transform})&&r.push(s.id)}return r},[e]),yr)}const ARt=({color:e="none",strokeWidth:n=1})=>{const t={strokeWidth:n,...e&&{stroke:e}};return f.jsx("polyline",{className:"arrow",style:t,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},RRt=({color:e="none",strokeWidth:n=1})=>{const t={strokeWidth:n,...e&&{stroke:e,fill:e}};return f.jsx("polyline",{className:"arrowclosed",style:t,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},OR={[Bv.Arrow]:ARt,[Bv.ArrowClosed]:RRt};function MRt(e){const n=wr();return R.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(OR,e)?OR[e]:((i=(s=n.getState()).onError)==null||i.call(s,"009",Ja.error009(e)),null)},[e])}const DRt=({id:e,type:n,color:t,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const l=MRt(n);return l?f.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:o,refX:"0",refY:"0",children:f.jsx(l,{color:t,strokeWidth:a})}):null},fq=({defaultColor:e,rfId:n})=>{const t=zn(i=>i.edges),r=zn(i=>i.defaultEdgeOptions),s=R.useMemo(()=>OTt(t,{id:n,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[t,r,n,e]);return s.length?f.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:f.jsx("defs",{children:s.map(i=>f.jsx(DRt,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};fq.displayName="MarkerDefinitions";var LRt=R.memo(fq);function hq({x:e,y:n,label:t,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:l,className:u,..._}){const[d,p]=R.useState({x:1,y:0,width:0,height:0}),m=is(["react-flow__edge-textwrapper",u]),x=R.useRef(null);return R.useEffect(()=>{if(x.current){const S=x.current.getBBox();p({x:S.x,y:S.y,width:S.width,height:S.height})}},[t]),t?f.jsxs("g",{transform:`translate(${e-d.width/2} ${n-d.height/2})`,className:m,visibility:d.width?"visible":"hidden",..._,children:[s&&f.jsx("rect",{width:d.width+2*a[0],x:-a[0],y:-a[1],height:d.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:o,ry:o}),f.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:x,style:r,children:t}),l]}):null}hq.displayName="EdgeText";const ORt=R.memo(hq);function fy({path:e,labelX:n,labelY:t,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:l,interactionWidth:u=20,..._}){return f.jsxs(f.Fragment,{children:[f.jsx("path",{..._,d:e,fill:"none",className:is(["react-flow__edge-path",_.className])}),u?f.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&Qa(n)&&Qa(t)?f.jsx(ORt,{x:n,y:t,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:l}):null]})}function IR({pos:e,x1:n,y1:t,x2:r,y2:s}){return e===Et.Left||e===Et.Right?[.5*(n+r),t]:[n,.5*(t+s)]}function _q({sourceX:e,sourceY:n,sourcePosition:t=Et.Bottom,targetX:r,targetY:s,targetPosition:i=Et.Top}){const[a,o]=IR({pos:t,x1:e,y1:n,x2:r,y2:s}),[l,u]=IR({pos:i,x1:r,y1:s,x2:e,y2:n}),[_,d,p,m]=IH({sourceX:e,sourceY:n,targetX:r,targetY:s,sourceControlX:a,sourceControlY:o,targetControlX:l,targetControlY:u});return[`M${e},${n} C${a},${o} ${l},${u} ${r},${s}`,_,d,p,m]}function pq(e){return R.memo(({id:n,sourceX:t,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:o,label:l,labelStyle:u,labelShowBg:_,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:S,markerStart:v,interactionWidth:b})=>{const[w,y,C]=_q({sourceX:t,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o}),E=e.isInternal?void 0:n;return f.jsx(fy,{id:E,path:w,labelX:y,labelY:C,label:l,labelStyle:u,labelShowBg:_,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:S,markerStart:v,interactionWidth:b})})}const IRt=pq({isInternal:!1}),mq=pq({isInternal:!0});IRt.displayName="SimpleBezierEdge";mq.displayName="SimpleBezierEdgeInternal";function gq(e){return R.memo(({id:n,sourceX:t,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:_,labelBgBorderRadius:d,style:p,sourcePosition:m=Et.Bottom,targetPosition:x=Et.Top,markerEnd:S,markerStart:v,pathOptions:b,interactionWidth:w})=>{const[y,C,E]=y5({sourceX:t,sourceY:r,sourcePosition:m,targetX:s,targetY:i,targetPosition:x,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset,stepPosition:b==null?void 0:b.stepPosition}),N=e.isInternal?void 0:n;return f.jsx(fy,{id:N,path:y,labelX:C,labelY:E,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:_,labelBgBorderRadius:d,style:p,markerEnd:S,markerStart:v,interactionWidth:w})})}const vq=gq({isInternal:!1}),bq=gq({isInternal:!0});vq.displayName="SmoothStepEdge";bq.displayName="SmoothStepEdgeInternal";function yq(e){return R.memo(({id:n,...t})=>{var s;const r=e.isInternal?void 0:n;return f.jsx(vq,{...t,id:r,pathOptions:R.useMemo(()=>{var i;return{borderRadius:0,offset:(i=t.pathOptions)==null?void 0:i.offset}},[(s=t.pathOptions)==null?void 0:s.offset])})})}const BRt=yq({isInternal:!1}),xq=yq({isInternal:!0});BRt.displayName="StepEdge";xq.displayName="StepEdgeInternal";function wq(e){return R.memo(({id:n,sourceX:t,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:_,labelBgBorderRadius:d,style:p,markerEnd:m,markerStart:x,interactionWidth:S})=>{const[v,b,w]=PH({sourceX:t,sourceY:r,targetX:s,targetY:i}),y=e.isInternal?void 0:n;return f.jsx(fy,{id:y,path:v,labelX:b,labelY:w,label:a,labelStyle:o,labelShowBg:l,labelBgStyle:u,labelBgPadding:_,labelBgBorderRadius:d,style:p,markerEnd:m,markerStart:x,interactionWidth:S})})}const $Rt=wq({isInternal:!1}),Sq=wq({isInternal:!0});$Rt.displayName="StraightEdge";Sq.displayName="StraightEdgeInternal";function kq(e){return R.memo(({id:n,sourceX:t,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Et.Bottom,targetPosition:o=Et.Top,label:l,labelStyle:u,labelShowBg:_,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:S,markerStart:v,pathOptions:b,interactionWidth:w})=>{const[y,C,E]=BH({sourceX:t,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o,curvature:b==null?void 0:b.curvature}),N=e.isInternal?void 0:n;return f.jsx(fy,{id:N,path:y,labelX:C,labelY:E,label:l,labelStyle:u,labelShowBg:_,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:m,style:x,markerEnd:S,markerStart:v,interactionWidth:w})})}const PRt=kq({isInternal:!1}),Cq=kq({isInternal:!0});PRt.displayName="BezierEdge";Cq.displayName="BezierEdgeInternal";const BR={default:Cq,straight:Sq,step:xq,smoothstep:bq,simplebezier:mq},$R={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},FRt=(e,n,t)=>t===Et.Left?e-n:t===Et.Right?e+n:e,HRt=(e,n,t)=>t===Et.Top?e-n:t===Et.Bottom?e+n:e,PR="react-flow__edgeupdater";function FR({position:e,centerX:n,centerY:t,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:o}){return f.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:is([PR,`${PR}-${o}`]),cx:FRt(n,r,e),cy:HRt(t,r,e),r,stroke:"transparent",fill:"transparent"})}function qRt({isReconnectable:e,reconnectRadius:n,edge:t,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:o,targetPosition:l,onReconnect:u,onReconnectStart:_,onReconnectEnd:d,setReconnecting:p,setUpdateHover:m}){const x=wr(),S=(C,E)=>{if(C.button!==0)return;const{autoPanOnConnect:N,domNode:T,connectionMode:z,connectionRadius:M,lib:I,onConnectStart:B,cancelConnection:$,nodeLookup:U,rfId:H,panBy:Y,updateConnection:V}=x.getState(),X=E.type==="target",ee=(F,q)=>{p(!1),d==null||d(F,t,E.type,q)},O=F=>u==null?void 0:u(t,F),L=(F,q)=>{p(!0),_==null||_(C,t,E.type),B==null||B(F,q)};S5.onPointerDown(C.nativeEvent,{autoPanOnConnect:N,connectionMode:z,connectionRadius:M,domNode:T,handleId:E.id,nodeId:E.nodeId,nodeLookup:U,isTarget:X,edgeUpdaterType:E.type,lib:I,flowId:H,cancelConnection:$,panBy:Y,isValidConnection:(...F)=>{var q,G;return((G=(q=x.getState()).isValidConnection)==null?void 0:G.call(q,...F))??!0},onConnect:O,onConnectStart:L,onConnectEnd:(...F)=>{var q,G;return(G=(q=x.getState()).onConnectEnd)==null?void 0:G.call(q,...F)},onReconnectEnd:ee,updateConnection:V,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},v=C=>S(C,{nodeId:t.target,id:t.targetHandle??null,type:"target"}),b=C=>S(C,{nodeId:t.source,id:t.sourceHandle??null,type:"source"}),w=()=>m(!0),y=()=>m(!1);return f.jsxs(f.Fragment,{children:[(e===!0||e==="source")&&f.jsx(FR,{position:o,centerX:r,centerY:s,radius:n,onMouseDown:v,onMouseEnter:w,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&f.jsx(FR,{position:l,centerX:i,centerY:a,radius:n,onMouseDown:b,onMouseEnter:w,onMouseOut:y,type:"target"})]})}function URt({id:e,edgesFocusable:n,edgesReconnectable:t,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:o,onMouseMove:l,onMouseLeave:u,reconnectRadius:_,onReconnect:d,onReconnectStart:p,onReconnectEnd:m,rfId:x,edgeTypes:S,noPanClassName:v,onError:b,disableKeyboardA11y:w}){let y=zn(pe=>pe.edgeLookup.get(e));const C=zn(pe=>pe.defaultEdgeOptions);y=C?{...C,...y}:y;let E=y.type||"default",N=(S==null?void 0:S[E])||BR[E];N===void 0&&(b==null||b("011",Ja.error011(E)),E="default",N=(S==null?void 0:S.default)||BR.default);const T=!!(y.focusable||n&&typeof y.focusable>"u"),z=typeof d<"u"&&(y.reconnectable||t&&typeof y.reconnectable>"u"),M=!!(y.selectable||r&&typeof y.selectable>"u"),I=R.useRef(null),[B,$]=R.useState(!1),[U,H]=R.useState(!1),Y=wr(),{zIndex:V=y.zIndex,sourceX:X,sourceY:ee,targetX:O,targetY:L,sourcePosition:F,targetPosition:q}=zn(R.useCallback(pe=>{const we=pe.nodeLookup.get(y.source),be=pe.nodeLookup.get(y.target);if(!we||!be)return $R;const Pe=LTt({id:e,sourceNode:we,targetNode:be,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:pe.connectionMode,onError:b}),Be=NTt({selected:y.selected,zIndex:y.zIndex,sourceNode:we,targetNode:be,elevateOnSelect:pe.elevateEdgesOnSelect,zIndexMode:pe.zIndexMode});return{...Pe||$R,zIndex:Be}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),yr),G=R.useMemo(()=>y.markerStart?`url('#${x5(y.markerStart,x)}')`:void 0,[y.markerStart,x]),re=R.useMemo(()=>y.markerEnd?`url('#${x5(y.markerEnd,x)}')`:void 0,[y.markerEnd,x]);if(y.hidden||X===null||ee===null||O===null||L===null)return null;const ce=pe=>{var Be;const{addSelectedEdges:we,unselectNodesAndEdges:be,multiSelectionActive:Pe}=Y.getState();M&&(Y.setState({nodesSelectionActive:!1}),y.selected&&Pe?(be({nodes:[],edges:[y]}),(Be=I.current)==null||Be.blur()):we([e])),s&&s(pe,y)},oe=i?pe=>{i(pe,{...y})}:void 0,te=a?pe=>{a(pe,{...y})}:void 0,Q=o?pe=>{o(pe,{...y})}:void 0,le=l?pe=>{l(pe,{...y})}:void 0,ae=u?pe=>{u(pe,{...y})}:void 0,de=pe=>{var we;if(!w&&wH.includes(pe.key)&&M){const{unselectNodesAndEdges:be,addSelectedEdges:Pe}=Y.getState();pe.key==="Escape"?((we=I.current)==null||we.blur(),be({edges:[y]})):Pe([e])}};return f.jsx("svg",{style:{zIndex:V},children:f.jsxs("g",{className:is(["react-flow__edge",`react-flow__edge-${E}`,y.className,v,{selected:y.selected,animated:y.animated,inactive:!M&&!s,updating:B,selectable:M}]),onClick:ce,onDoubleClick:oe,onContextMenu:te,onMouseEnter:Q,onMouseMove:le,onMouseLeave:ae,onKeyDown:T?de:void 0,tabIndex:T?0:void 0,role:y.ariaRole??(T?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":T?`${tq}-${x}`:void 0,ref:I,...y.domAttributes,children:[!U&&f.jsx(N,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:M,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:X,sourceY:ee,targetX:O,targetY:L,sourcePosition:F,targetPosition:q,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:G,markerEnd:re,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),z&&f.jsx(qRt,{edge:y,isReconnectable:z,reconnectRadius:_,onReconnect:d,onReconnectStart:p,onReconnectEnd:m,sourceX:X,sourceY:ee,targetX:O,targetY:L,sourcePosition:F,targetPosition:q,setUpdateHover:$,setReconnecting:H})]})})}var GRt=R.memo(URt);const WRt=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Eq({defaultMarkerColor:e,onlyRenderVisibleElements:n,rfId:t,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:l,onEdgeMouseLeave:u,onEdgeClick:_,reconnectRadius:d,onEdgeDoubleClick:p,onReconnectStart:m,onReconnectEnd:x,disableKeyboardA11y:S}){const{edgesFocusable:v,edgesReconnectable:b,elementsSelectable:w,onError:y}=zn(WRt,yr),C=TRt(n);return f.jsxs("div",{className:"react-flow__edges",children:[f.jsx(LRt,{defaultColor:e,rfId:t}),C.map(E=>f.jsx(GRt,{id:E,edgesFocusable:v,edgesReconnectable:b,elementsSelectable:w,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:o,onMouseMove:l,onMouseLeave:u,onClick:_,reconnectRadius:d,onDoubleClick:p,onReconnectStart:m,onReconnectEnd:x,rfId:t,onError:y,edgeTypes:r,disableKeyboardA11y:S},E))]})}Eq.displayName="EdgeRenderer";const VRt=R.memo(Eq),KRt=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function QRt({children:e}){const n=zn(KRt);return f.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}function YRt(e){const n=Pk(),t=R.useRef(!1);R.useEffect(()=>{!t.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),t.current=!0)},[e,n.viewportInitialized])}const XRt=e=>{var n;return(n=e.panZoom)==null?void 0:n.syncViewport};function ZRt(e){const n=zn(XRt),t=wr();return R.useEffect(()=>{e&&(n==null||n(e),t.setState({transform:[e.x,e.y,e.zoom]}))},[e,n]),null}function JRt(e){return e.connection.inProgress?{...e.connection,to:gm(e.connection.to,e.transform)}:{...e.connection}}function eMt(e){return JRt}function tMt(e){const n=eMt();return zn(n,yr)}const nMt=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function rMt({containerStyle:e,style:n,type:t,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:o,inProgress:l}=zn(nMt,yr);return!(i&&s&&l)?null:f.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:f.jsx("g",{className:is(["react-flow__connection",CH(o)]),children:f.jsx(Nq,{style:n,type:t,CustomComponent:r,isValid:o})})})}const Nq=({style:e,type:n=Bc.Bezier,CustomComponent:t,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:o,fromPosition:l,to:u,toNode:_,toHandle:d,toPosition:p,pointer:m}=tMt();if(!s)return;if(t)return f.jsx(t,{connectionLineType:n,connectionLineStyle:e,fromNode:a,fromHandle:o,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:l,toPosition:p,connectionStatus:CH(r),toNode:_,toHandle:d,pointer:m});let x="";const S={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:u.x,targetY:u.y,targetPosition:p};switch(n){case Bc.Bezier:[x]=BH(S);break;case Bc.SimpleBezier:[x]=_q(S);break;case Bc.Step:[x]=y5({...S,borderRadius:0});break;case Bc.SmoothStep:[x]=y5(S);break;default:[x]=PH(S)}return f.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:e})};Nq.displayName="ConnectionLine";const sMt={};function HR(e=sMt){R.useRef(e),wr(),R.useEffect(()=>{},[e])}function iMt(){wr(),R.useRef(!1),R.useEffect(()=>{},[])}function zq({nodeTypes:e,edgeTypes:n,onInit:t,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:o,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:_,onSelectionContextMenu:d,onSelectionStart:p,onSelectionEnd:m,connectionLineType:x,connectionLineStyle:S,connectionLineComponent:v,connectionLineContainerStyle:b,selectionKeyCode:w,selectionOnDrag:y,selectionMode:C,multiSelectionKeyCode:E,panActivationKeyCode:N,zoomActivationKeyCode:T,deleteKeyCode:z,onlyRenderVisibleElements:M,elementsSelectable:I,defaultViewport:B,translateExtent:$,minZoom:U,maxZoom:H,preventScrolling:Y,defaultMarkerColor:V,zoomOnScroll:X,zoomOnPinch:ee,panOnScroll:O,panOnScrollSpeed:L,panOnScrollMode:F,zoomOnDoubleClick:q,panOnDrag:G,autoPanOnSelection:re,onPaneClick:ce,onPaneMouseEnter:oe,onPaneMouseMove:te,onPaneMouseLeave:Q,onPaneScroll:le,onPaneContextMenu:ae,paneClickDistance:de,nodeClickDistance:pe,onEdgeContextMenu:we,onEdgeMouseEnter:be,onEdgeMouseMove:Pe,onEdgeMouseLeave:Be,reconnectRadius:ze,onReconnect:it,onReconnectStart:bt,onReconnectEnd:It,noDragClassName:$t,noWheelClassName:jt,noPanClassName:ct,disableKeyboardA11y:ut,nodeExtent:Ht,rfId:Se,viewport:Ae,onViewportChange:Ze}){return HR(e),HR(n),iMt(),YRt(t),ZRt(Ae),f.jsx(yRt,{onPaneClick:ce,onPaneMouseEnter:oe,onPaneMouseMove:te,onPaneMouseLeave:Q,onPaneContextMenu:ae,onPaneScroll:le,paneClickDistance:de,deleteKeyCode:z,selectionKeyCode:w,selectionOnDrag:y,selectionMode:C,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:E,panActivationKeyCode:N,zoomActivationKeyCode:T,elementsSelectable:I,zoomOnScroll:X,zoomOnPinch:ee,zoomOnDoubleClick:q,panOnScroll:O,panOnScrollSpeed:L,panOnScrollMode:F,panOnDrag:G,autoPanOnSelection:re,defaultViewport:B,translateExtent:$,minZoom:U,maxZoom:H,onSelectionContextMenu:d,preventScrolling:Y,noDragClassName:$t,noWheelClassName:jt,noPanClassName:ct,disableKeyboardA11y:ut,onViewportChange:Ze,isControlledViewport:!!Ae,children:f.jsxs(QRt,{children:[f.jsx(VRt,{edgeTypes:n,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:it,onReconnectStart:bt,onReconnectEnd:It,onlyRenderVisibleElements:M,onEdgeContextMenu:we,onEdgeMouseEnter:be,onEdgeMouseMove:Pe,onEdgeMouseLeave:Be,reconnectRadius:ze,defaultMarkerColor:V,noPanClassName:ct,disableKeyboardA11y:ut,rfId:Se}),f.jsx(rMt,{style:S,type:x,component:v,containerStyle:b}),f.jsx("div",{className:"react-flow__edgelabel-renderer"}),f.jsx(jRt,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:o,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:_,nodeClickDistance:pe,onlyRenderVisibleElements:M,noPanClassName:ct,noDragClassName:$t,disableKeyboardA11y:ut,nodeExtent:Ht,rfId:Se}),f.jsx("div",{className:"react-flow__viewport-portal"})]})})}zq.displayName="GraphView";const aMt=R.memo(zq),oMt=AH(),qR=({nodes:e,edges:n,defaultNodes:t,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:l=.5,maxZoom:u=2,nodeOrigin:_,nodeExtent:d,zIndexMode:p="basic"}={})=>{const m=new Map,x=new Map,S=new Map,v=new Map,b=r??n??[],w=t??e??[],y=_??[0,0],C=d??Ep;qH(S,v,b);const{nodesInitialized:E}=w5(w,m,x,{nodeOrigin:y,nodeExtent:C,zIndexMode:p});let N=[0,0,1];if(a&&s&&i){const T=pm(m,{filter:B=>!!((B.width||B.initialWidth)&&(B.height||B.initialHeight))}),{x:z,y:M,zoom:I}=Mk(T,s,i,l,u,(o==null?void 0:o.padding)??.1);N=[z,M,I]}return{rfId:"1",width:s??0,height:i??0,transform:N,nodes:w,nodesInitialized:E,nodeLookup:m,parentLookup:x,edges:b,edgeLookup:v,connectionLookup:S,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:t!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:l,maxZoom:u,translateExtent:Ep,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Xh.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:o,fitViewResolver:null,connection:{...kH},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:oMt,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:SH,zIndexMode:p,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},lMt=({nodes:e,edges:n,defaultNodes:t,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:l,maxZoom:u,nodeOrigin:_,nodeExtent:d,zIndexMode:p})=>vAt((m,x)=>{async function S(){const{nodeLookup:v,panZoom:b,fitViewOptions:w,fitViewResolver:y,width:C,height:E,minZoom:N,maxZoom:T}=x();b&&(await yTt({nodes:v,width:C,height:E,panZoom:b,minZoom:N,maxZoom:T},w),y==null||y.resolve(!0),m({fitViewResolver:null}))}return{...qR({nodes:e,edges:n,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:l,maxZoom:u,nodeOrigin:_,nodeExtent:d,defaultNodes:t,defaultEdges:r,zIndexMode:p}),setNodes:v=>{const{nodeLookup:b,parentLookup:w,nodeOrigin:y,elevateNodesOnSelect:C,fitViewQueued:E,zIndexMode:N,nodesSelectionActive:T}=x(),{nodesInitialized:z,hasSelectedNodes:M}=w5(v,b,w,{nodeOrigin:y,nodeExtent:d,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:N}),I=T&&M;E&&z?(S(),m({nodes:v,nodesInitialized:z,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:I})):m({nodes:v,nodesInitialized:z,nodesSelectionActive:I})},setEdges:v=>{const{connectionLookup:b,edgeLookup:w}=x();qH(b,w,v),m({edges:v})},setDefaultNodesAndEdges:(v,b)=>{if(v){const{setNodes:w}=x();w(v),m({hasDefaultNodes:!0})}if(b){const{setEdges:w}=x();w(b),m({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:b,nodeLookup:w,parentLookup:y,domNode:C,nodeOrigin:E,nodeExtent:N,debug:T,fitViewQueued:z,zIndexMode:M}=x(),{changes:I,updatedInternals:B}=qTt(v,w,y,C,E,N,M);B&&($Tt(w,y,{nodeOrigin:E,nodeExtent:N,zIndexMode:M}),z?(S(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(I==null?void 0:I.length)>0&&(T&&console.log("React Flow: trigger node changes",I),b==null||b(I)))},updateNodePositions:(v,b=!1)=>{const w=[];let y=[];const{nodeLookup:C,triggerNodeChanges:E,connection:N,updateConnection:T,onNodesChangeMiddlewareMap:z}=x();for(const[M,I]of v){const B=C.get(M),$=!!(B!=null&&B.expandParent&&(B!=null&&B.parentId)&&(I!=null&&I.position)),U={id:M,type:"position",position:$?{x:Math.max(0,I.position.x),y:Math.max(0,I.position.y)}:I.position,dragging:b};if(B&&N.inProgress&&N.fromNode.id===B.id){const H=Pd(B,N.fromHandle,Et.Left,!0);T({...N,from:H})}$&&B.parentId&&w.push({id:M,parentId:B.parentId,rect:{...I.internals.positionAbsolute,width:I.measured.width??0,height:I.measured.height??0}}),y.push(U)}if(w.length>0){const{parentLookup:M,nodeOrigin:I}=x(),B=$k(w,C,M,I);y.push(...B)}for(const M of z.values())y=M(y);E(y)},triggerNodeChanges:v=>{const{onNodesChange:b,setNodes:w,nodes:y,hasDefaultNodes:C,debug:E}=x();if(v!=null&&v.length){if(C){const N=$At(v,y);w(N)}E&&console.log("React Flow: trigger node changes",v),b==null||b(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:b,setEdges:w,edges:y,hasDefaultEdges:C,debug:E}=x();if(v!=null&&v.length){if(C){const N=PAt(v,y);w(N)}E&&console.log("React Flow: trigger edge changes",v),b==null||b(v)}},addSelectedNodes:v=>{const{multiSelectionActive:b,edgeLookup:w,nodeLookup:y,triggerNodeChanges:C,triggerEdgeChanges:E}=x();if(b){const N=v.map(T=>Ju(T,!0));C(N);return}C(nh(y,new Set([...v]),!0)),E(nh(w))},addSelectedEdges:v=>{const{multiSelectionActive:b,edgeLookup:w,nodeLookup:y,triggerNodeChanges:C,triggerEdgeChanges:E}=x();if(b){const N=v.map(T=>Ju(T,!0));E(N);return}E(nh(w,new Set([...v]))),C(nh(y,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:b}={})=>{const{edges:w,nodes:y,nodeLookup:C,triggerNodeChanges:E,triggerEdgeChanges:N}=x(),T=v||y,z=b||w,M=[];for(const B of T){if(!B.selected)continue;const $=C.get(B.id);$&&($.selected=!1),M.push(Ju(B.id,!1))}const I=[];for(const B of z)B.selected&&I.push(Ju(B.id,!1));E(M),N(I)},setMinZoom:v=>{const{panZoom:b,maxZoom:w}=x();b==null||b.setScaleExtent([v,w]),m({minZoom:v})},setMaxZoom:v=>{const{panZoom:b,minZoom:w}=x();b==null||b.setScaleExtent([w,v]),m({maxZoom:v})},setTranslateExtent:v=>{var b;(b=x().panZoom)==null||b.setTranslateExtent(v),m({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:b,triggerNodeChanges:w,triggerEdgeChanges:y,elementsSelectable:C}=x();if(!C)return;const E=b.reduce((T,z)=>z.selected?[...T,Ju(z.id,!1)]:T,[]),N=v.reduce((T,z)=>z.selected?[...T,Ju(z.id,!1)]:T,[]);w(E),y(N)},setNodeExtent:v=>{const{nodes:b,nodeLookup:w,parentLookup:y,nodeOrigin:C,elevateNodesOnSelect:E,nodeExtent:N,zIndexMode:T}=x();v[0][0]===N[0][0]&&v[0][1]===N[0][1]&&v[1][0]===N[1][0]&&v[1][1]===N[1][1]||(w5(b,w,y,{nodeOrigin:C,nodeExtent:v,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:T}),m({nodeExtent:v}))},panBy:v=>{const{transform:b,width:w,height:y,panZoom:C,translateExtent:E}=x();return UTt({delta:v,panZoom:C,transform:b,translateExtent:E,width:w,height:y})},setCenter:async(v,b,w)=>{const{width:y,height:C,maxZoom:E,panZoom:N}=x();if(!N)return!1;const T=typeof(w==null?void 0:w.zoom)<"u"?w.zoom:E;return await N.setViewport({x:y/2-v*T,y:C/2-b*T,zoom:T},{duration:w==null?void 0:w.duration,ease:w==null?void 0:w.ease,interpolate:w==null?void 0:w.interpolate}),!0},cancelConnection:()=>{m({connection:{...kH}})},updateConnection:v=>{m({connection:v})},reset:()=>m({...qR()})}},Object.is);function cMt({initialNodes:e,initialEdges:n,defaultNodes:t,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:o,initialFitViewOptions:l,fitView:u,nodeOrigin:_,nodeExtent:d,zIndexMode:p,children:m}){const[x]=R.useState(()=>lMt({nodes:e,edges:n,defaultNodes:t,defaultEdges:r,width:s,height:i,fitView:u,minZoom:a,maxZoom:o,fitViewOptions:l,nodeOrigin:_,nodeExtent:d,zIndexMode:p}));return f.jsx(bAt,{value:x,children:f.jsx(WAt,{children:f.jsx(oRt,{children:m})})})}function uMt({children:e,nodes:n,edges:t,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:o,fitViewOptions:l,minZoom:u,maxZoom:_,nodeOrigin:d,nodeExtent:p,zIndexMode:m}){return R.useContext(cy)?f.jsx(f.Fragment,{children:e}):f.jsx(cMt,{initialNodes:n,initialEdges:t,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:o,initialFitViewOptions:l,initialMinZoom:u,initialMaxZoom:_,nodeOrigin:d,nodeExtent:p,zIndexMode:m,children:e})}const dMt={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function fMt({nodes:e,edges:n,defaultNodes:t,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:o,onEdgeClick:l,onInit:u,onMove:_,onMoveStart:d,onMoveEnd:p,onConnect:m,onConnectStart:x,onConnectEnd:S,onClickConnectStart:v,onClickConnectEnd:b,onNodeMouseEnter:w,onNodeMouseMove:y,onNodeMouseLeave:C,onNodeContextMenu:E,onNodeDoubleClick:N,onNodeDragStart:T,onNodeDrag:z,onNodeDragStop:M,onNodesDelete:I,onEdgesDelete:B,onDelete:$,onSelectionChange:U,onSelectionDragStart:H,onSelectionDrag:Y,onSelectionDragStop:V,onSelectionContextMenu:X,onSelectionStart:ee,onSelectionEnd:O,onBeforeDelete:L,connectionMode:F,connectionLineType:q=Bc.Bezier,connectionLineStyle:G,connectionLineComponent:re,connectionLineContainerStyle:ce,deleteKeyCode:oe="Backspace",selectionKeyCode:te="Shift",selectionOnDrag:Q=!1,selectionMode:le=Np.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:de=jp()?"Meta":"Control",zoomActivationKeyCode:pe=jp()?"Meta":"Control",snapToGrid:we,snapGrid:be,onlyRenderVisibleElements:Pe=!1,selectNodesOnDrag:Be,nodesDraggable:ze,autoPanOnNodeFocus:it,nodesConnectable:bt,nodesFocusable:It,nodeOrigin:$t=nq,edgesFocusable:jt,edgesReconnectable:ct,elementsSelectable:ut=!0,defaultViewport:Ht=RAt,minZoom:Se=.5,maxZoom:Ae=2,translateExtent:Ze=Ep,preventScrolling:ht=!0,nodeExtent:wt,defaultMarkerColor:en="#b1b1b7",zoomOnScroll:Ve=!0,zoomOnPinch:qt=!0,panOnScroll:ln=!1,panOnScrollSpeed:cn=.5,panOnScrollMode:Mt=Cd.Free,zoomOnDoubleClick:er=!0,panOnDrag:tn=!0,onPaneClick:Mr,onPaneMouseEnter:tr,onPaneMouseMove:qn,onPaneMouseLeave:Sr,onPaneScroll:$n,onPaneContextMenu:Wr,paneClickDistance:kr=1,nodeClickDistance:gt=0,children:un,onReconnect:vn,onReconnectStart:Zt,onReconnectEnd:Kn,onEdgeContextMenu:fn,onEdgeDoubleClick:Nn,onEdgeMouseEnter:Vt,onEdgeMouseMove:xt,onEdgeMouseLeave:At,reconnectRadius:Fe=10,onNodesChange:_t,onEdgesChange:cr,noDragClassName:xn="nodrag",noWheelClassName:Ut="nowheel",noPanClassName:ur="nopan",fitView:Qn,fitViewOptions:ki,connectOnClick:Ql,attributionPosition:ro,proOptions:zs,defaultEdgeOptions:Na,elevateNodesOnSelect:rn=!0,elevateEdgesOnSelect:Dr=!1,disableKeyboardA11y:Rn=!1,autoPanOnConnect:Ps,autoPanOnNodeDrag:Xe,autoPanOnSelection:Pt=!0,autoPanSpeed:ri,connectionRadius:Fs,isValidConnection:si,onError:as,style:ii,id:ta,nodeDragThreshold:Yl,connectionDragThreshold:gs,viewport:Ci,onViewportChange:os,width:Pn,height:Kt,colorMode:ai="light",debug:js,onScroll:Yn,ariaLabelConfig:Hs,zIndexMode:ls="basic",...Un},Vr){const $r=ta||"1",na=OAt(ai),oi=R.useCallback(qs=>{qs.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Yn==null||Yn(qs)},[Yn]);return f.jsx("div",{"data-testid":"rf__wrapper",...Un,onScroll:oi,style:{...ii,...dMt},ref:Vr,className:is(["react-flow",s,na]),id:ta,role:"application",children:f.jsxs(uMt,{nodes:e,edges:n,width:Pn,height:Kt,fitView:Qn,fitViewOptions:ki,minZoom:Se,maxZoom:Ae,nodeOrigin:$t,nodeExtent:wt,zIndexMode:ls,children:[f.jsx(LAt,{nodes:e,edges:n,defaultNodes:t,defaultEdges:r,onConnect:m,onConnectStart:x,onConnectEnd:S,onClickConnectStart:v,onClickConnectEnd:b,nodesDraggable:ze,autoPanOnNodeFocus:it,nodesConnectable:bt,nodesFocusable:It,edgesFocusable:jt,edgesReconnectable:ct,elementsSelectable:ut,elevateNodesOnSelect:rn,elevateEdgesOnSelect:Dr,minZoom:Se,maxZoom:Ae,nodeExtent:wt,onNodesChange:_t,onEdgesChange:cr,snapToGrid:we,snapGrid:be,connectionMode:F,translateExtent:Ze,connectOnClick:Ql,defaultEdgeOptions:Na,fitView:Qn,fitViewOptions:ki,onNodesDelete:I,onEdgesDelete:B,onDelete:$,onNodeDragStart:T,onNodeDrag:z,onNodeDragStop:M,onSelectionDrag:Y,onSelectionDragStart:H,onSelectionDragStop:V,onMove:_,onMoveStart:d,onMoveEnd:p,noPanClassName:ur,nodeOrigin:$t,rfId:$r,autoPanOnConnect:Ps,autoPanOnNodeDrag:Xe,autoPanSpeed:ri,onError:as,connectionRadius:Fs,isValidConnection:si,selectNodesOnDrag:Be,nodeDragThreshold:Yl,connectionDragThreshold:gs,onBeforeDelete:L,debug:js,ariaLabelConfig:Hs,zIndexMode:ls}),f.jsx(aMt,{onInit:u,onNodeClick:o,onEdgeClick:l,onNodeMouseEnter:w,onNodeMouseMove:y,onNodeMouseLeave:C,onNodeContextMenu:E,onNodeDoubleClick:N,nodeTypes:i,edgeTypes:a,connectionLineType:q,connectionLineStyle:G,connectionLineComponent:re,connectionLineContainerStyle:ce,selectionKeyCode:te,selectionOnDrag:Q,selectionMode:le,deleteKeyCode:oe,multiSelectionKeyCode:de,panActivationKeyCode:ae,zoomActivationKeyCode:pe,onlyRenderVisibleElements:Pe,defaultViewport:Ht,translateExtent:Ze,minZoom:Se,maxZoom:Ae,preventScrolling:ht,zoomOnScroll:Ve,zoomOnPinch:qt,zoomOnDoubleClick:er,panOnScroll:ln,panOnScrollSpeed:cn,panOnScrollMode:Mt,panOnDrag:tn,autoPanOnSelection:Pt,onPaneClick:Mr,onPaneMouseEnter:tr,onPaneMouseMove:qn,onPaneMouseLeave:Sr,onPaneScroll:$n,onPaneContextMenu:Wr,paneClickDistance:kr,nodeClickDistance:gt,onSelectionContextMenu:X,onSelectionStart:ee,onSelectionEnd:O,onReconnect:vn,onReconnectStart:Zt,onReconnectEnd:Kn,onEdgeContextMenu:fn,onEdgeDoubleClick:Nn,onEdgeMouseEnter:Vt,onEdgeMouseMove:xt,onEdgeMouseLeave:At,reconnectRadius:Fe,defaultMarkerColor:en,noDragClassName:xn,noWheelClassName:Ut,noPanClassName:ur,rfId:$r,disableKeyboardA11y:Rn,nodeExtent:wt,viewport:Ci,onViewportChange:os}),f.jsx(AAt,{onSelectionChange:U}),un,f.jsx(EAt,{proOptions:zs,position:ro}),f.jsx(CAt,{rfId:$r,disableKeyboardA11y:Rn})]})})}var hMt=sq(fMt);function _Mt({dimensions:e,lineWidth:n,variant:t,className:r}){return f.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:is(["react-flow__background-pattern",t,r])})}function pMt({radius:e,className:n}){return f.jsx("circle",{cx:e,cy:e,r:e,className:is(["react-flow__background-pattern","dots",n])})}var $l;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})($l||($l={}));const mMt={[$l.Dots]:1,[$l.Lines]:1,[$l.Cross]:6},gMt=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function jq({id:e,variant:n=$l.Dots,gap:t=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:o,style:l,className:u,patternClassName:_}){const d=R.useRef(null),{transform:p,patternId:m}=zn(gMt,yr),x=r||mMt[n],S=n===$l.Dots,v=n===$l.Cross,b=Array.isArray(t)?t:[t,t],w=[b[0]*p[2]||1,b[1]*p[2]||1],y=x*p[2],C=Array.isArray(i)?i:[i,i],E=v?[y,y]:w,N=[C[0]*p[2]||1+E[0]/2,C[1]*p[2]||1+E[1]/2],T=`${m}${e||""}`;return f.jsxs("svg",{className:is(["react-flow__background",u]),style:{...l,...dy,"--xy-background-color-props":o,"--xy-background-pattern-color-props":a},ref:d,"data-testid":"rf__background",children:[f.jsx("pattern",{id:T,x:p[0]%w[0],y:p[1]%w[1],width:w[0],height:w[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:S?f.jsx(pMt,{radius:y/2,className:_}):f.jsx(_Mt,{dimensions:E,lineWidth:s,variant:n,className:_})}),f.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${T})`})]})}jq.displayName="Background";const vMt=R.memo(jq);function bMt(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:f.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function yMt(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:f.jsx("path",{d:"M0 0h32v4.2H0z"})})}function xMt(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:f.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function wMt(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:f.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function SMt(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:f.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function h1({children:e,className:n,...t}){return f.jsx("button",{type:"button",className:is(["react-flow__controls-button",n]),...t,children:e})}const kMt=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Tq({style:e,showZoom:n=!0,showFitView:t=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:o,onInteractiveChange:l,className:u,children:_,position:d="bottom-left",orientation:p="vertical","aria-label":m}){const x=wr(),{isInteractive:S,minZoomReached:v,maxZoomReached:b,ariaLabelConfig:w}=zn(kMt,yr),{zoomIn:y,zoomOut:C,fitView:E}=Pk(),N=()=>{y(),i==null||i()},T=()=>{C(),a==null||a()},z=()=>{E(s),o==null||o()},M=()=>{x.setState({nodesDraggable:!S,nodesConnectable:!S,elementsSelectable:!S}),l==null||l(!S)},I=p==="horizontal"?"horizontal":"vertical";return f.jsxs(uy,{className:is(["react-flow__controls",I,u]),position:d,style:e,"data-testid":"rf__controls","aria-label":m??w["controls.ariaLabel"],children:[n&&f.jsxs(f.Fragment,{children:[f.jsx(h1,{onClick:N,className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:b,children:f.jsx(bMt,{})}),f.jsx(h1,{onClick:T,className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:v,children:f.jsx(yMt,{})})]}),t&&f.jsx(h1,{className:"react-flow__controls-fitview",onClick:z,title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:f.jsx(xMt,{})}),r&&f.jsx(h1,{className:"react-flow__controls-interactive",onClick:M,title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:S?f.jsx(SMt,{}):f.jsx(wMt,{})}),_]})}Tq.displayName="Controls";R.memo(Tq);function CMt({id:e,x:n,y:t,width:r,height:s,style:i,color:a,strokeColor:o,strokeWidth:l,className:u,borderRadius:_,shapeRendering:d,selected:p,onClick:m}){const{background:x,backgroundColor:S}=i||{},v=a||x||S;return f.jsx("rect",{className:is(["react-flow__minimap-node",{selected:p},u]),x:n,y:t,rx:_,ry:_,width:r,height:s,style:{fill:v,stroke:o,strokeWidth:l},shapeRendering:d,onClick:m?b=>m(b,e):void 0})}const EMt=R.memo(CMt),NMt=e=>e.nodes.map(n=>n.id),Vw=e=>e instanceof Function?e:()=>e;function zMt({nodeStrokeColor:e,nodeColor:n,nodeClassName:t="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=EMt,onClick:a}){const o=zn(NMt,yr),l=Vw(n),u=Vw(e),_=Vw(t),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return f.jsx(f.Fragment,{children:o.map(p=>f.jsx(TMt,{id:p,nodeColorFunc:l,nodeStrokeColorFunc:u,nodeClassNameFunc:_,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:d},p))})}function jMt({id:e,nodeColorFunc:n,nodeStrokeColorFunc:t,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:o,onClick:l}){const{node:u,x:_,y:d,width:p,height:m}=zn(x=>{const S=x.nodeLookup.get(e);if(!S)return{node:void 0,x:0,y:0,width:0,height:0};const v=S.internals.userNode,{x:b,y:w}=S.internals.positionAbsolute,{width:y,height:C}=Kl(v);return{node:v,x:b,y:w,width:y,height:C}},yr);return!u||u.hidden||!RH(u)?null:f.jsx(o,{x:_,y:d,width:p,height:m,style:u.style,selected:!!u.selected,className:r(u),color:n(u),borderRadius:s,strokeColor:t(u),strokeWidth:i,shapeRendering:a,onClick:l,id:u.id})}const TMt=R.memo(jMt);var AMt=R.memo(zMt);const RMt=200,MMt=150,DMt=e=>!e.hidden,LMt=e=>{const n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:e.nodeLookup.size>0?jH(pm(e.nodeLookup,{filter:DMt}),n):n,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},OMt="react-flow__minimap-desc";function Aq({style:e,className:n,nodeStrokeColor:t,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:o,bgColor:l,maskColor:u,maskStrokeColor:_,maskStrokeWidth:d,position:p="bottom-right",onClick:m,onNodeClick:x,pannable:S=!1,zoomable:v=!1,ariaLabel:b,inversePan:w,zoomStep:y=1,offsetScale:C=5}){const E=wr(),N=R.useRef(null),{boundingRect:T,viewBB:z,rfId:M,panZoom:I,translateExtent:B,flowWidth:$,flowHeight:U,ariaLabelConfig:H}=zn(LMt,yr),Y=(e==null?void 0:e.width)??RMt,V=(e==null?void 0:e.height)??MMt,X=T.width/Y,ee=T.height/V,O=Math.max(X,ee),L=O*Y,F=O*V,q=C*O,G=T.x-(L-T.width)/2-q,re=T.y-(F-T.height)/2-q,ce=L+q*2,oe=F+q*2,te=`${OMt}-${M}`,Q=R.useRef(0),le=R.useRef();Q.current=O,R.useEffect(()=>{if(N.current&&I)return le.current=JTt({domNode:N.current,panZoom:I,getTransform:()=>E.getState().transform,getViewScale:()=>Q.current}),()=>{var we;(we=le.current)==null||we.destroy()}},[I]),R.useEffect(()=>{var we;(we=le.current)==null||we.update({translateExtent:B,width:$,height:U,inversePan:w,pannable:S,zoomStep:y,zoomable:v})},[S,v,w,y,B,$,U]);const ae=m?we=>{var Be;const[be,Pe]=((Be=le.current)==null?void 0:Be.pointer(we))||[0,0];m(we,{x:be,y:Pe})}:void 0,de=x?R.useCallback((we,be)=>{const Pe=E.getState().nodeLookup.get(be).internals.userNode;x(we,Pe)},[]):void 0,pe=b??H["minimap.ariaLabel"];return f.jsx(uy,{position:p,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof _=="string"?_:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*O:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof t=="string"?t:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:is(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:f.jsxs("svg",{width:Y,height:V,viewBox:`${G} ${re} ${ce} ${oe}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":te,ref:N,onClick:ae,children:[pe&&f.jsx("title",{id:te,children:pe}),f.jsx(AMt,{onClick:de,nodeColor:r,nodeStrokeColor:t,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:o}),f.jsx("path",{className:"react-flow__minimap-mask",d:`M${G-q},${re-q}h${ce+q*2}v${oe+q*2}h${-ce-q*2}z + M${z.x},${z.y}h${z.width}v${z.height}h${-z.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Aq.displayName="MiniMap";R.memo(Aq);const IMt=e=>n=>e?`${Math.max(1/n.transform[2],1)}`:void 0,BMt={[e_.Line]:"right",[e_.Handle]:"bottom-right"};function $Mt({nodeId:e,position:n,variant:t=e_.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:o=10,minHeight:l=10,maxWidth:u=Number.MAX_VALUE,maxHeight:_=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:p,autoScale:m=!0,shouldResize:x,onResizeStart:S,onResize:v,onResizeEnd:b}){const w=lq(),y=typeof e=="string"?e:w,C=wr(),E=R.useRef(null),N=t===e_.Handle,T=zn(R.useCallback(IMt(N&&m),[N,m]),yr),z=R.useRef(null),M=n??BMt[t];R.useEffect(()=>{if(!(!E.current||!y))return z.current||(z.current=fAt({domNode:E.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:B,transform:$,snapGrid:U,snapToGrid:H,nodeOrigin:Y,domNode:V}=C.getState();return{nodeLookup:B,transform:$,snapGrid:U,snapToGrid:H,nodeOrigin:Y,paneDomNode:V}},onChange:(B,$)=>{const{triggerNodeChanges:U,nodeLookup:H,parentLookup:Y,nodeOrigin:V}=C.getState(),X=[],ee={x:B.x,y:B.y},O=H.get(y);if(O&&O.expandParent&&O.parentId){const L=O.origin??V,F=B.width??O.measured.width??0,q=B.height??O.measured.height??0,G={id:O.id,parentId:O.parentId,rect:{width:F,height:q,...MH({x:B.x??O.position.x,y:B.y??O.position.y},{width:F,height:q},O.parentId,H,L)}},re=$k([G],H,Y,V);X.push(...re),ee.x=B.x?Math.max(L[0]*F,B.x):void 0,ee.y=B.y?Math.max(L[1]*q,B.y):void 0}if(ee.x!==void 0&&ee.y!==void 0){const L={id:y,type:"position",position:{...ee}};X.push(L)}if(B.width!==void 0&&B.height!==void 0){const F={id:y,type:"dimensions",resizing:!0,setAttributes:p?p==="horizontal"?"width":"height":!0,dimensions:{width:B.width,height:B.height}};X.push(F)}for(const L of $){const F={...L,type:"position"};X.push(F)}U(X)},onEnd:({width:B,height:$})=>{const U={id:y,type:"dimensions",resizing:!1,dimensions:{width:B,height:$}};C.getState().triggerNodeChanges([U])}})),z.current.update({controlPosition:M,boundaries:{minWidth:o,minHeight:l,maxWidth:u,maxHeight:_},keepAspectRatio:d,resizeDirection:p,onResizeStart:S,onResize:v,onResizeEnd:b,shouldResize:x}),()=>{var B;(B=z.current)==null||B.destroy()}},[M,o,l,u,_,d,S,v,b,x]);const I=M.split("-");return f.jsx("div",{className:is(["react-flow__resize-control","nodrag",...I,t,r]),ref:E,style:{...s,scale:T,...a&&{[N?"backgroundColor":"borderColor"]:a}},children:i})}R.memo($Mt);function PMt(){const[e,n]=R.useState(0),[t,r]=R.useState(0);return{ref:R.useCallback(i=>{if(!i)return;function a(){n(i.offsetWidth),r(i.offsetHeight)}const o=new ResizeObserver(a),l=new MutationObserver(a);return o.observe(i),l.observe(i,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),a(),()=>{o.disconnect(),l.disconnect()}},[]),offsetWidth:e,offsetHeight:t}}const _1=8;function FMt(e,n){const{offsetWidth:t,offsetHeight:r}=n,[{viewHeight:s,viewWidth:i},a]=R.useState({viewWidth:0,viewHeight:0});R.useEffect(()=>{function _(){a({viewWidth:window.innerWidth,viewHeight:window.innerHeight})}return window.addEventListener("resize",_),_(),()=>window.removeEventListener("resize",_)},[]);let o=0,l=0,u=0;if(e){const{distance:_}=e;switch(e.anchor){case"left":o=e.x-t-_,l=e.y+e.height/2-r/2;break;case"right":o=e.x+e.width+_,l=e.y+e.height/2-r/2;break;case"below":o=e.x+e.width/2-t/2,l=e.y+e.height+_;break;case"above":o=e.x+e.width/2-t/2,l=e.y-r-_;break}const d=o,p=l;o=Math.min(Math.max(o,_1),i-t-_1),l=Math.min(Math.max(l,_1),s-r-_1),u=e.anchor==="left"||e.anchor==="right"?p-l:d-o}return{x:o,y:l,arrowAdjustment:u}}const Kw=380,Qw=12,HMt=350,qMt=150,C5=new EventTarget;function UMt(){C5.dispatchEvent(new Event("move"))}function GMt(e,n){const[t,r]=R.useState(null),s=R.useRef(void 0),i=R.useRef(void 0);R.useEffect(()=>{const u=()=>{window.clearTimeout(s.current),window.clearTimeout(i.current),r(null)};return C5.addEventListener("move",u),()=>{C5.removeEventListener("move",u),window.clearTimeout(s.current),window.clearTimeout(i.current)}},[]),R.useEffect(()=>{r(u=>{var d;if(!u)return u;const _=((d=e.current)==null?void 0:d.getBoundingClientRect())??null;return _&&u.x===_.x&&u.y===_.y&&u.width===_.width&&u.height===_.height?u:_})},[e,n]);const a=R.useCallback(()=>{window.clearTimeout(i.current),window.clearTimeout(s.current),s.current=window.setTimeout(()=>{var u;r(((u=e.current)==null?void 0:u.getBoundingClientRect())??null)},HMt)},[e]),o=R.useCallback(()=>{window.clearTimeout(s.current),window.clearTimeout(i.current),i.current=window.setTimeout(()=>r(null),qMt)},[]),l=R.useCallback(()=>window.clearTimeout(i.current),[]);return{rect:t,onMouseEnter:a,onMouseLeave:o,keepOpen:l}}function WMt(e){const n=new Date(e),t=n.getFullYear()===new Date().getFullYear()?{month:"short",day:"numeric"}:{month:"short",day:"numeric",year:"numeric"};return n.toLocaleDateString(j(),t)}function VMt({exp:e,runs:n,latestRun:t,parentSlug:r,anchor:s,onOpenLogs:i,onOpenCode:a,onMouseEnter:o,onMouseLeave:l}){const u=PMt(),_=s.right+Qw+Kw<=window.innerWidth,d=s.x-Qw-Kw>=0,p=_?"right":d?"left":s.y>window.innerHeight/2?"above":"below",{x:m,y:x}=FMt({x:s.x,y:s.y,width:s.width,height:s.height,anchor:p,distance:Qw},u),S=e.parentExperimentId&&(t!=null&&t.commitSha)?t.id:null,{data:v}=ot({...xgt(S??""),enabled:!!S,subscribed:!!S}),b=R.useMemo(()=>{if(!v)return null;const B=v;let $=B.diff;if(B.truncated){const V=$.lastIndexOf(` diff --git `);$=V!==-1?$.slice(0,V+1):$.slice(0,$.lastIndexOf(` -`)+1)}let U=[];try{U=$.trim()?r3($):[]}catch{return null}if(B.truncated&&U.every(V=>V.hunks.length===0))return null;let H=0,Y=0;for(const V of U){const X=Mb(V);H+=X.additions,Y+=X.deletions}return{fileCount:U.length,additions:H,deletions:Y,truncated:B.truncated}},[v]),w={done:0,failed:0,cancelled:0,live:0};for(const B of n)B.status==="done"?w.done+=1:B.status==="failed"?w.failed+=1:B.status==="cancelled"?w.cancelled+=1:w.live+=1;const y=t?np((t.endedAt??Date.now())-t.createdAt):null,C=(t==null?void 0:t.status)==="failed"&&t.resultMarkdown?t.resultMarkdown:null,E=e.description||(C?null:t==null?void 0:t.resultMarkdown)||null,N=R.useRef(null),[T,z]=R.useState(!1),[M,O]=R.useState(!1);return R.useEffect(()=>{z(!1)},[E]),R.useEffect(()=>{const B=N.current;B&&O(B.scrollHeight>B.clientHeight+1)},[E,T]),no.createPortal(f.jsxs("div",{ref:u.ref,className:"exp-hover-card fixed z-60 bg-background border border-border rounded-lg shadow-menu py-3.5 px-4 text-sm text-text [&_.hc-head]:flex [&_.hc-head]:items-baseline [&_.hc-head]:justify-between [&_.hc-head]:gap-2.5 [&_.hc-slug]:text-sm [&_.hc-slug]:font-semibold [&_.hc-slug]:min-w-0 [&_.hc-slug]:overflow-hidden [&_.hc-slug]:text-ellipsis [&_.hc-slug]:whitespace-nowrap [&_.hc-title]:mt-[3px] [&_.hc-title]:text-text [&_.hc-actions]:flex [&_.hc-actions]:items-center [&_.hc-actions]:gap-1.5 [&_.hc-actions]:mt-2.5 [&_.hc-actions_button]:inline-flex [&_.hc-actions_button]:items-center [&_.hc-actions_button]:justify-center [&_.hc-actions_button]:gap-[5px] [&_.hc-actions_button]:min-w-21 [&_.hc-actions_button]:py-1.5 [&_.hc-actions_button]:px-2.5 [&_.hc-actions_button]:border [&_.hc-actions_button]:border-border [&_.hc-actions_button]:rounded-md [&_.hc-actions_button]:bg-background [&_.hc-actions_button]:text-text [&_.hc-actions_button]:text-sm [&_.hc-actions_button]:font-medium [&_.hc-actions_button:hover]:border-border-hover-strong [&_.hc-actions_button:hover]:bg-canvas [&_.hc-body]:mt-2.5 [&_.hc-body]:border-t [&_.hc-body]:border-t-border-variant [&_.hc-body]:pt-2.5 [&_.hc-body]:leading-[1.6] [&_.hc-body]:whitespace-pre-line [&_.hc-body]:line-clamp-10 [&_.hc-body.expanded]:block [&_.hc-body.expanded]:line-clamp-none [&_.hc-body.expanded]:max-h-[45vh] [&_.hc-body.expanded]:overflow-y-auto [&_.hc-body.expanded]:overflow-x-hidden [&_.hc-body.expanded]:pb-1 [&_.hc-toggle]:mt-1 [&_.hc-toggle]:text-sm [&_.hc-toggle]:font-medium [&_.hc-toggle]:text-muted [&_.hc-toggle:hover]:text-text [&_.hc-failure]:mt-2 [&_.hc-failure]:text-accent-red [&_.hc-failure]:line-clamp-3 [&_.hc-stats]:mt-2.5 [&_.hc-stats]:border-t [&_.hc-stats]:border-t-border-variant [&_.hc-stats]:pt-2.5 [&_.hc-stats]:flex [&_.hc-stats]:items-center [&_.hc-stats]:gap-3 [&_.hc-stats]:flex-wrap [&_.hc-stats]:text-xs [&_.hc-stats]:text-text [&_.hc-git]:mt-2.5 [&_.hc-git]:pt-2 [&_.hc-git]:border-t [&_.hc-git]:border-t-border-variant [&_.hc-git]:text-xs [&_.hc-git]:text-text [&_.hc-git]:flex [&_.hc-git]:flex-col [&_.hc-git]:gap-1 [&_.hc-git-row]:flex [&_.hc-git-row]:items-center [&_.hc-git-row]:gap-2.5 [&_.hc-git-row]:flex-wrap [&_.hc-git-row]:min-w-0 [&_.hc-branch]:inline-flex [&_.hc-branch]:items-center [&_.hc-branch]:gap-1 [&_.hc-branch]:min-w-0 [&_.hc-branch]:overflow-hidden [&_.hc-branch]:text-ellipsis [&_.hc-branch]:whitespace-nowrap [&_.hc-foot]:mt-2 [&_.hc-foot]:flex [&_.hc-foot]:items-center [&_.hc-foot]:justify-between [&_.hc-foot]:gap-2.5 [&_.hc-foot]:text-xs [&_.hc-foot]:text-muted [&_.hc-foot_.hc-command]:min-w-0 [&_.hc-foot_.hc-command]:overflow-hidden [&_.hc-foot_.hc-command]:text-ellipsis [&_.hc-foot_.hc-command]:whitespace-nowrap",style:{width:Kw,left:m,top:x,visibility:u.offsetHeight===0?"hidden":void 0},onMouseEnter:o,onMouseLeave:l,children:[f.jsxs("div",{className:"hc-head",children:[f.jsx("span",{className:"hc-slug",children:e.slug}),f.jsx($l,{status:t?Gi(t):"idle"})]}),e.title&&f.jsx("div",{className:"hc-title",children:e.title}),f.jsxs("div",{className:"hc-actions",children:[i&&f.jsxs("button",{type:"button",...Ur(i),children:[f.jsx(qh,{size:13}),g1e()]}),f.jsxs("button",{type:"button",...Ur(a),children:[f.jsx(fb,{size:13}),i1e()]})]}),E&&f.jsx("div",{className:`hc-body${T?" expanded":""}`,ref:N,children:E}),E&&(M||T)&&f.jsx("button",{type:"button",className:"hc-toggle",onClick:()=>z(B=>!B),children:T?zD():Spe()}),C&&f.jsx("div",{className:"hc-failure",children:C}),f.jsxs("div",{className:"hc-stats",children:[f.jsx("span",{children:new Intl.ListFormat(j(),{style:"short"}).format([n.length===1?F4e():G4e({count:Wt(n.length)}),...w.done>0?[g4e({count:Wt(w.done)})]:[],...w.failed>0?[x4e({count:Wt(w.failed)})]:[],...w.cancelled>0?[h4e({count:Wt(w.cancelled)})]:[],...w.live>0?[M4e({count:Wt(w.live)})]:[]])}),t&&p6(t.backend)&&f.jsx($6,{backend:t.backend}),y&&f.jsx("span",{children:y}),t&&f.jsx("span",{children:Io(t.createdAt)})]}),f.jsxs("div",{className:"hc-git",children:[f.jsxs("div",{className:"hc-git-row",children:[f.jsxs("span",{className:"hc-branch",title:e.branchName,children:[f.jsx(Jp,{size:12}),e.branchName]}),r&&f.jsxs("span",{children:[h1e()," ",f.jsx("span",{children:r})]})]}),b&&b.fileCount>0&&f.jsx("div",{className:"hc-git-row",title:b.truncated?OK({parent:Ne(r??"parent")}):RK({parent:Ne(r??"parent")}),children:f.jsxs("span",{children:[b.truncated&&"≥ ",f.jsxs("span",{className:"diff-stat-add text-accent-green",children:["+",b.additions]})," ",f.jsxs("span",{className:"diff-stat-del text-accent-red",children:["−",b.deletions]})," · ",b.fileCount===1&&!b.truncated?I4e():b.truncated?j4e({count:Wt(b.fileCount)}):C4e({count:Wt(b.fileCount)})]})})]}),f.jsxs("div",{className:"hc-foot",children:[f.jsxs("span",{className:"hc-command font-mono",children:["$ ",e.runCommand]}),f.jsxs("span",{children:[c1e()," ",WMt(e.createdAt)]})]})]}),document.body)}const UR=["empty-state absolute inset-0 flex flex-col items-center","justify-center p-6 text-center text-subtext [&_p]:max-w-[46ch]","[&_p]:m-0 [&_p]:text-sm [&_p]:leading-normal [&_p]:text-balance","[&_p.empty-state-title]:text-2xl [&_p.empty-state-title]:font-normal","[&_p.empty-state-title]:text-text [&_p.empty-state-hint]:text-lg","[&_p.empty-state-hint]:text-subtext empty-state-cta gap-1.5"].join(" "),KMt=264,GR=132,P1=44,QMt=72,YMt=148,XMt=44;function ZMt(e){const n=new Map(e.map(i=>[i.id,{exp:i,children:[]}])),t=[];for(const i of e){const a=n.get(i.id),o=i.parentExperimentId?n.get(i.parentExperimentId):void 0;o?o.children.push(a):t.push(a)}const r=(i,a)=>i.exp.createdAt-a.exp.createdAt,s=i=>{i.children.sort(r),i.children.forEach(s)};return t.sort(r),t.forEach(s),t}function JMt(e,n){const t=new Map,r=o=>{const l=t.get(o)??1+o.children.reduce((u,_)=>u+r(_),0);return t.set(o,l),l},s=new Map,i=o=>{const l=s.get(o)??(n(o)||o.children.some(i));return s.set(o,l),l};function a(o){if(n(o)){const _=[];let d=0;for(const p of o.children)i(p)?_.push(...a(p)):d+=r(p);return d>0&&_.push({kind:"elided",id:`el-${o.exp.id}`,count:d,children:[]}),[{kind:"exp",exp:o.exp,children:_}]}if(!i(o))return[];let l=0;const u=[];return(function _(d){l+=1;for(const p of d.children)n(p)?u.push(...a(p)):i(p)?_(p):l+=r(p)})(o),[{kind:"elided",id:`el-${o.exp.id}`,count:l,children:u}]}return e.flatMap(a)}function E5(e){return e.kind==="exp"?KMt:YMt}function p1(e){return e.kind==="exp"?e.exp.id:e.id}function F1(e){if(e.children.length===0)return E5(e);const n=e.children.reduce((t,r)=>t+F1(r),0)+P1*(e.children.length-1);return Math.max(E5(e),n)}function eDt(e){return e==="done"?"pass":e==="failed"?"fail":e==="running"||e==="starting"||e==="cancelling"?"live":"other"}const tDt=R.memo(function({data:n}){Qd();const{exp:t,latestRun:r,runs:s,isBaseline:i,parentSlug:a,githubOwner:o,githubRepo:l,onOpenView:u,onOpenCode:_}=n,d=r?Gi(r):void 0,p=d==="running"||d==="starting"||d==="cancelling",m=i?Jat():p?_ot():Cl(),x=s.slice(-8),S=R.useRef(null),v=GMt(S,n);return f.jsxs("div",{ref:S,className:`exp-node w-66 border border-border rounded-md bg-background py-2.5 px-3 shadow-tree text-sm transition-[box-shadow] duration-120 ease-standard [&:hover]:shadow-tree-hover [&.live]:border-accent-teal [&.live]:shadow-tree-live [&_.node-overview-link]:block [&_.node-overview-link]:w-full [&_.node-overview-link]:p-0 [&_.node-overview-link]:border-0 [&_.node-overview-link]:bg-transparent [&_.node-overview-link]:text-inherit [&_.node-overview-link]:[font:inherit] [&_.node-overview-link]:text-start [&_.node-overview-link]:cursor-pointer [&_.node-overview-link:hover_.node-slug]:underline [&_.node-overview-link:hover_.node-slug]:underline-offset-[3px] [&_.node-overview-link:focus-visible]:outline-2 [&_.node-overview-link:focus-visible]:outline-solid [&_.node-overview-link:focus-visible]:outline-accent [&_.node-overview-link:focus-visible]:outline-offset-4 [&_.node-overview-link:focus-visible]:rounded-xs [&_.node-eyebrow]:flex [&_.node-eyebrow]:items-center [&_.node-eyebrow]:justify-between [&_.node-eyebrow]:gap-2 [&_.node-eyebrow]:mb-1.5 [&_.node-eyebrow]:text-xs [&_.node-eyebrow]:font-medium [&_.node-eyebrow]:text-muted [&_.node-head]:flex [&_.node-head]:items-center [&_.node-head]:gap-[7px] [&_.node-head]:min-w-0 [&_.node-status]:w-2 [&_.node-status]:h-2 [&_.node-status]:rounded-full [&_.node-status]:shrink-0 [&_.node-slug]:text-sm [&_.node-slug]:font-semibold [&_.node-slug]:text-text [&_.node-slug]:flex-1 [&_.node-slug]:min-w-0 [&_.node-slug]:overflow-hidden [&_.node-slug]:text-ellipsis [&_.node-slug]:whitespace-nowrap [&_.node-title]:mt-1 [&_.node-title]:text-text [&_.node-title]:text-sm [&_.node-title]:line-clamp-2 [&_.node-meta]:mt-2 [&_.node-meta]:flex [&_.node-meta]:items-center [&_.node-meta]:gap-2 [&_.node-meta]:text-xs [&_.node-meta]:text-muted [&_.node-actions]:mt-2 [&_.node-actions]:pt-1.5 [&_.node-actions]:border-t [&_.node-actions]:border-t-border-variant [&_.node-actions]:flex [&_.node-actions]:items-center [&_.node-actions]:gap-[3px] [&_.node-action]:inline-flex [&_.node-action]:items-center [&_.node-action]:gap-[5px] [&_.node-action]:py-[3px] [&_.node-action]:px-1.5 [&_.node-action]:text-sm [&_.node-action]:font-medium [&_.node-action]:text-text [&_.node-action]:rounded-sm [&_.node-action]:no-underline [&_.node-action:hover]:text-text [&_.node-action:hover]:bg-surface [&_.node-action-ext]:ms-auto [&_.node-action-ext]:py-[3px] [&_.node-action-ext]:px-[5px] ${p?"live":""}`,onMouseEnter:v.onMouseEnter,onMouseLeave:v.onMouseLeave,children:[f.jsx(bu,{type:"target",position:Et.Top}),f.jsxs("div",{role:"button",tabIndex:0,className:"node-overview-link nodrag",...Ur(b=>u(t.id,"overview",b)),children:[f.jsxs("div",{className:"node-eyebrow",children:[f.jsx("span",{children:m}),f.jsx($l,{status:d??"idle"})]}),f.jsx("div",{className:"node-head",children:f.jsx("span",{className:"node-slug",children:t.slug})}),(t.title||t.description)&&f.jsx("div",{className:"node-title",children:t.title||t.description}),f.jsxs("div",{className:"node-meta",children:[f.jsx("span",{children:Jot()}),x.length>0?f.jsx("span",{className:"run-squares flex items-center gap-[3px]",children:x.map(b=>f.jsx("span",{className:`run-sq w-[9px] h-[9px] shrink-0 [&.pass]:bg-accent-green [&.fail]:border-[1.5px] [&.fail]:border-danger-outline [&.live]:bg-accent-teal [&.live]:animate-[or-pulse_1.2s_ease-in-out_infinite] [&.other]:border-[1.5px] [&.other]:border-border ${eDt(Gi(b))}`,title:U6(Gi(b))},b.id))}):f.jsx("span",{children:Fot()}),f.jsx("span",{className:"flex-1"}),r&&f.jsx("span",{children:Io(r.createdAt)})]})]}),f.jsxs("div",{className:"node-actions",onClick:b=>b.stopPropagation(),children:[s.length>0&&f.jsxs("button",{className:"node-action",title:Got(),...Ur(b=>u(t.id,"terminal",b)),children:[f.jsx(qh,{size:13}),NL()]}),f.jsxs("button",{className:"node-action",title:fD({branch:Ne(t.branchName)}),...Ur(b=>_(t.id,t.branchName,"files",b)),children:[f.jsx(fb,{size:13}),Eot()]}),o&&l&&f.jsx("a",{className:"node-action node-action-ext",title:J1({name:Ne(t.branchName)}),"aria-label":J1({name:Ne(t.branchName)}),href:eb(o,l,t.branchName),target:"_blank",rel:"noopener noreferrer",onClick:b=>b.stopPropagation(),children:f.jsx(hb,{size:13})})]}),f.jsx(bu,{type:"source",position:Et.Bottom}),v.rect&&f.jsx(VMt,{exp:t,runs:s,latestRun:r,parentSlug:a,anchor:v.rect,onOpenLogs:s.length>0?b=>u(t.id,"terminal",b):void 0,onOpenCode:b=>_(t.id,t.branchName,"files",b),onMouseEnter:v.keepOpen,onMouseLeave:v.onMouseLeave})]})}),nDt=R.memo(function({data:n}){Qd();const{count:t,onShowProjectScope:r}=n;return f.jsxs("div",{className:"elided-node w-37 h-11 flex items-center gap-2 py-1.5 px-2.5 border border-dashed border-border rounded-md bg-hover-faint text-muted text-sm font-medium text-start transition-[border-color,color] duration-120 ease-standard [&:hover]:border-text [&:hover]:text-text [&_.elided-node-label]:flex [&_.elided-node-label]:flex-col [&_.elided-node-label]:leading-[1.3] [&_.elided-node-sub]:text-muted",role:"button",tabIndex:0,title:rlt(),onClick:r,onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),r())},children:[f.jsx(bu,{type:"target",position:Et.Top}),f.jsx(A6,{size:14}),f.jsxs("span",{className:"elided-node-label",children:[t===1?uot():aot({count:Wt(t)}),f.jsx("span",{className:"elided-node-sub",children:Qot()})]}),f.jsx(bu,{type:"source",position:Et.Bottom})]})}),rDt={exp:tDt,elided:nDt},Rq={type:"default",style:{stroke:"var(--text)",strokeWidth:1.5,opacity:.3}},sDt={...Rq.style,strokeDasharray:"4 4"};function iDt({experiments:e,runs:n,project:t,onOpenView:r,onOpenCode:s,agentSessionId:i,onShowProjectScope:a,viewport:o,onViewportChange:l}){const{nodes:u,edges:_}=R.useMemo(()=>{const d=new Map;for(const y of n){const C=d.get(y.experimentId);C?C.push(y):d.set(y.experimentId,[y])}for(const y of d.values())y.sort((C,E)=>C.createdAt-E.createdAt);const p=[],m=[],x=y=>!i||y.exp.chatSessionId===i,S=JMt(ZMt(e),x),v=new Map(e.map(y=>[y.id,y.slug]));function b(y,C,E){const N=C-E5(y)/2;if(y.kind==="exp"){const M=d.get(y.exp.id)??[];p.push({id:y.exp.id,type:"exp",position:{x:N,y:E},data:{exp:y.exp,latestRun:M[M.length-1]??null,runs:M,isBaseline:!y.exp.parentExperimentId,parentSlug:y.exp.parentExperimentId?v.get(y.exp.parentExperimentId)??null:null,githubOwner:t.githubEnabled?t.githubOwner:"",githubRepo:t.githubEnabled?t.githubRepo:"",onOpenView:r,onOpenCode:s}})}else p.push({id:y.id,type:"elided",position:{x:N,y:E+(GR-XMt)/2},data:{count:y.count,onShowProjectScope:a}});if(y.children.length===0)return;const T=y.children.reduce((M,O)=>M+F1(O),0)+P1*(y.children.length-1);let z=C-T/2;for(const M of y.children){const O=F1(M),B=y.kind==="elided"||M.kind==="elided";m.push({id:`e-${p1(y)}-${p1(M)}`,source:p1(y),target:p1(M),...B?{style:sDt}:{}}),b(M,z+O/2,E+GR+QMt),z+=O+P1}}let w=0;for(const y of S){const C=F1(y);b(y,w+C/2,0),w+=C+P1}return{nodes:p,edges:m}},[e,n,r,s,t.githubOwner,t.githubRepo,t.githubEnabled,i,a]);return e.length===0?f.jsxs("div",{className:UR,children:[f.jsx("p",{className:"empty-state-title",children:Iot()}),f.jsx("p",{className:"empty-state-hint",children:wot()})]}):u.length===0&&i?f.jsxs("div",{className:UR,children:[f.jsx("p",{className:"empty-state-title",children:Mot()}),f.jsx("p",{className:"empty-state-hint",children:vot()})]}):f.jsx(hMt,{className:"[&_.react-flow\\_\\_node.react-flow\\_\\_node-exp.selectable]:cursor-default [&_.react-flow\\_\\_node.react-flow\\_\\_node-elided.selectable]:cursor-pointer [&_.react-flow\\_\\_handle]:opacity-0 [&_.react-flow\\_\\_handle]:pointer-events-none [&_.react-flow\\_\\_attribution]:hidden!",nodes:u,edges:_,nodeTypes:rDt,defaultEdgeOptions:Rq,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,onMoveStart:UMt,onMoveEnd:(d,p)=>{d&&l(p)},minZoom:.15,defaultViewport:o??void 0,fitView:o===null,fitViewOptions:{padding:.25,maxZoom:1},children:f.jsx(vMt,{variant:Fl.Dots,color:"var(--dots-strong)",gap:28,size:1.6})},i??"project")}const w0=["empty-state absolute inset-0 flex flex-col items-center","justify-center gap-2.5 p-6 text-center text-subtext","[&_p]:max-w-[46ch] [&_p]:m-0 [&_p]:text-sm [&_p]:leading-normal","[&_p]:text-balance [&_p.empty-state-title]:text-2xl","[&_p.empty-state-title]:font-normal [&_p.empty-state-title]:text-text","[&_p.empty-state-hint]:text-lg [&_p.empty-state-hint]:text-subtext"].join(" ");function aDt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function oDt(e,n,t,r,s){let i=e,a;const o=n==null?void 0:n.replace(/\/+$/,""),l=r==null?void 0:r.replace(/\/+$/,"");if(i.startsWith("artifacts/"))return i=i.slice(10),i?{path:i,source:"artifacts"}:null;if(i==="~"||i.startsWith("~/"))return{path:i,source:"abs"};const u=p=>{const m=v=>v.replace(/^\/private(?=\/(?:tmp|var)(?:\/|$))/,""),[x,S]=[m(i),m(p)];return x===S?"":x.startsWith(`${S}/`)?x.slice(S.length).replace(/^\/+/,""):null},_=i.startsWith("/")&&l?u(l):null,d=i.startsWith("/")&&o?u(o):null;if(!i.startsWith("/"))a=t;else{if(_!==null)return _?{path:_,source:"artifacts"}:null;if(d!==null)i=d;else{const p=s?aDt(s):"[^/]+",m=i.match(new RegExp(`/files/${p}/(.+)$`)),x=m?null:i.match(/\/openresearch\/worktrees\/[^/]+\/([^/]+)\/(.+)$/),S=m||x?null:i.match(/\/openresearch\/repos\/[^/]+\/[^/]+\/(.+)$/);if(m)return{path:m[1],source:"artifacts"};x?(a=x[1],i=x[2]):S&&(i=S[1])}}return i?i.startsWith("/")?{path:i,source:"abs"}:{path:i,sessionId:a}:null}function lDt(e,n){if(!(e.source==="artifacts"||e.source==="abs"))return e.ref??e.branchLabel??n}const qv=360,cDt=10,WR=1448,uDt=272,dDt=380,fDt=uDt+56,hDt=80,_Dt=48;function T0(){return Math.max(qv,window.innerWidth-fDt-dDt)}function pDt(){const e=T0();return Math.max(qv,Math.min(760,e,Math.round(window.innerWidth*.4)))}function VR(e,n){const t=e.findIndex(s=>s.id===n.id);if(t<0)return[...e,n];const r=e.slice();return r[t]=n,r}function KR(e){const n=R.useRef(e);return n.current.size===e.size&&[...e].every(([r,s])=>n.current.get(r)===s)||(n.current=e),n.current}function mDt({runtime:e,projectId:n,pane:t}){var nl,$s,fo;const r=gn({mutationFn:lut}),s=li(),i=sD({select:Z=>Z.location}),a=Rd(i.pathname),o=(a==null?void 0:a.kind)==="skills"?"skills":(a==null?void 0:a.kind)==="settings"?a.section??"settings":"chat",l=R.useRef(null),u=(a==null?void 0:a.kind)==="task"?a.sessionId??null:l.current;(a==null?void 0:a.kind)==="task"&&(l.current=u);const _=t!==void 0,d=(t==null?void 0:t.kind)==="experiment"?t.runId??null:null,[p,m]=R.useState(null),[x,S]=R.useState(0),v=R.useRef({href:"",jump:0,value:0});(v.current.href!==i.href||v.current.jump!==x)&&(v.current={href:i.href,jump:x,value:v.current.value+1});const b=R.useMemo(()=>{const Z=t?Wa(t):"experiments";return typeof Z=="object"&&"path"in Z&&Z.line&&p!==v.current.value?{...Z,lineScrollRequest:v.current.value}:Z},[t,p,i.href,x]),w=ct(Ea(n)),y=R.useMemo(()=>{var Z;return((Z=w.data)==null?void 0:Z.map(ge=>ge.id))??null},[w.data]),C=R.useRef(new Set),E=R.useRef(new Set),N=R.useRef({}),[T,z]=R.useState(0),M=R.useRef({projectId:n,activeSessionId:u,pane:t,isTask:(a==null?void 0:a.kind)==="task"});M.current={projectId:n,activeSessionId:u,pane:t,isTask:(a==null?void 0:a.kind)==="task"};const O=R.useCallback((Z,ge=!1)=>{const Te=M.current;Te.projectId&&s.navigate({href:k1(Te.projectId,Te.activeSessionId,Z),replace:ge})},[s]),B=R.useCallback(Z=>{const ge=Dl(Z);O(ge.kind==="file"?{...ge,line:void 0}:ge)},[O]),$=R.useCallback(()=>O(void 0),[O]),U=R.useCallback(Z=>{(t==null?void 0:t.kind)==="experiment"&&O({...t,runId:Z??void 0})},[t,O]),H=R.useCallback(Z=>{s.navigate({href:Z?`/projects/${encodeURIComponent(Z)}`:"/projects"})},[s]),Y=R.useCallback(Z=>{var ge;if(n)if(Z==="chat"){const Te=l.current;s.navigate({href:k1(n,Te,(ge=lu(oa.current,Te??"new"))==null?void 0:ge.active)})}else s.navigate({href:`/projects/${encodeURIComponent(n)}/${Z==="skills"?"skills":`settings/${Z}`}`})},[s,n]),V=Qd(),{status:X}=P6(e.kind==="local"),te=R.useMemo(()=>rp(),[n]),I=ct(te),L=I.data??null,F=R.useCallback(Z=>{Gr(te.queryKey,ge=>(typeof Z=="function"?Z(ge??null):Z)??void 0)},[te]),q=R.useMemo(()=>Xp(),[n]),G=ct(q),ee=G.data??null,ce=R.useCallback(Z=>{Gr(q.queryKey,ge=>(typeof Z=="function"?Z(ge??null):Z)??void 0)},[q]),oe=R.useRef(void 0);oe.current=ee==null?void 0:ee.tourCompleted;const ne=[!w.data&&w.error?vD():null,!I.data&&I.error?D0():null,!G.data&&G.error?Dne():null].filter(Z=>Z!==null),Q=ne.length?Bne({items:new Intl.ListFormat(V).format(ne)}):null,le=R.useRef(null),ae=ct(U4(n)),ue=ae.data??[],pe=!ae.isPending,[Se,ye]=R.useState(!1),Ie=ct(su(n)).data??[],ze=R.useRef(Ie);ze.current=Ie;const at=R.useRef(new Map),bt=R.useRef(new Set),$t=R.useRef(null),Pt=R.useRef(!1),zt=R.useRef(new Map),ot=R.useRef(new Map),ft=R.useRef(0),It=R.useRef(ue);It.current=ue;const Re=ct(wgt(n)).data??null,[Ze,ht]=R.useState("table"),[xt,Vt]=R.useState("project"),Ve=R.useRef(null),{open:Ht,setOpen:sn,ref:fn}=ro(Ve),[Zt,Qn]=R.useState(!1),Jt=ue.every(Z=>Z.chatSessionId),bn=u&&Jt?xt:"project",or=R.useMemo(()=>bn!=="agent"?ue:ue.filter(Z=>Z.chatSessionId===u),[ue,bn,u]),lr=R.useMemo(()=>{if(bn!=="agent")return Ie;const Z=new Set(or.map(ge=>ge.id));return Ie.filter(ge=>Z.has(ge.experimentId))},[Ie,or,bn]),[br,Dn]=R.useState([]),[Wr,Nr]=R.useState(!1),[vt,un]=R.useState(!1),[Cn,en]=R.useState(!1),[Jn,hn]=R.useState([]),[En,ln]=R.useState([]),pt=R.useRef(new Map),kt=R.useRef(new Map),Ge=Z=>{let ge=kt.current.get(Z);return ge||(ge=new fEt,kt.current.set(Z,ge)),ge},[mt,fr]=R.useState([]),[cn,qt]=R.useState([]),[er,Ln]=R.useState([]),[di,Xl]=R.useState([]),[io,Ni]=R.useState(null),[Ra,tn]=R.useState("files"),[Ys,cr]=R.useState(new Set),[Rr,Ke]=R.useState(!1),[Ut,zi]=R.useState(null),[os,ks]=R.useState(pDt),[gs,sa]=R.useState(()=>window.innerWidth>=WR),Ma=o==="chat"&&!_&&gs,[ao,Cs]=R.useState(!0),[Da,Vr]=R.useState(!1),Mr=R.useRef(z6()),nn=R.useRef(u);nn.current=u;const vs=R.useRef(br);vs.current=br;const Xs=R.useRef(di);Xs.current=di;const ur=R.useRef(null),ls=R.useCallback(Z=>{const ge=[...Z];Xs.current=ge,Xl(ge)},[]),Ls=R.useCallback(Z=>{ur.current=Z,Ni(Z)},[]),$r=R.useCallback(Z=>{const ge=Ct(Z);hn(Me=>u0(Me,ge)),ln(Me=>u0(Me,ge)),fr(Me=>u0(Me,ge)),qt(Me=>u0(Me,ge)),Ln(Me=>u0(Me,ge));const Te=hr.current;if(Te&&"path"in Z){const Me=Ms(Te,nn.current,Z);pt.current.delete(Me),kt.current.delete(Me),E.current.delete(Me),C.current.delete(Me)}const Pe=vs.current.filter(Me=>Ct(Me)!==ge);vs.current=Pe,Dn(Pe)},[]),Dr=R.useCallback(Z=>{const ge=Ct(Z),Te=[...vs.current.filter(Pe=>Ct(Pe)!==ge),Ig(Z)];vs.current=Te,Dn(Te),B(Z)},[B]),cs=R.useCallback((Z,ge,Te)=>{const Pe=Ct(Z),Me=ur.current,it=I7t({order:Xs.current,previewKey:Me?Ct(Me):null},Pe,ge);it.replacedKey&&Me&&typeof Me!="string"&&Ct(Me)===it.replacedKey&&$r(Me),ls(it.order),it.previewKey===null?Ls(null):it.previewKey===Pe&&Ls(Ig(Z));const tt=[...vs.current.filter(Mt=>Ct(Mt)!==Pe),Ig(Z)];vs.current=tt,Dn(tt),O(Dl(Z,Te))},[$r,ls,Ls,O]),bs=R.useCallback(Z=>{const ge=ur.current;ge&&Ct(ge)===Ct(Z)&&Ls(null)},[Ls]);R.useEffect(()=>{let Z=!1;const ge=Pe=>{const Me=ur.current,it=Pe.target;if(it instanceof Element&&it.closest("input, textarea, [contenteditable='true']")!==null){Z=!1;return}if(Me&&Ct(Me)===Ct(Mr.current.rightTab)&&(Pe.metaKey||Pe.ctrlKey)&&!Pe.altKey&&!Pe.shiftKey&&Pe.key.toLowerCase()==="k"){Pe.preventDefault(),Z=!0;return}if(Z&&Pe.key==="Enter"){Pe.preventDefault(),Z=!1;const Mt=ur.current;Mt&&bs(Mt);return}Z=!1},Te=()=>{Z=!1};return window.addEventListener("keydown",ge),window.addEventListener("blur",Te),window.addEventListener("pointerdown",Te),()=>{window.removeEventListener("keydown",ge),window.removeEventListener("blur",Te),window.removeEventListener("pointerdown",Te)}},[bs]);const yr=R.useCallback((Z,ge)=>{const Te=Ct(Z),Pe=ur.current;Pe&&Ct(Pe)===Te&&Ls(null);const Me=B7t({order:Xs.current,previewKey:Pe?Ct(Pe):null},Te,vs.current.map(Ct));ls(Me.order);const it=vs.current.filter(Mt=>Ct(Mt)!==Te);if(vs.current=it,Dn(it),!ge)return;const tt=Me.fallbackKey?it.find(Mt=>Ct(Mt)===Me.fallbackKey):void 0;tt?B(tt):($(),Ke(!1))},[ls,Ls,B,$]),ys=Y,ia=R.useMemo(()=>({rightTab:Ig(b),tabHistory:br,experimentsTabOpen:Wr,filesTabOpen:vt,artifactsTabOpen:Cn,expTabs:Jn,fileTabs:En,planTabs:mt,subagentTabs:cn,codeTabs:er,contentTabOrder:Xs.current,previewTab:ur.current,filesView:Ra,filesToggled:Ys,selectedRunId:d,scope:xt,panelOpen:_,panelMax:Rr,treeViewport:Ut}),[b,br,Wr,vt,Cn,Jn,En,mt,cn,er,di,io,Ra,Ys,d,xt,_,Rr,Ut]);Mr.current=ia;const aa=R.useCallback(()=>Object.fromEntries(pt.current),[]),Yo=R.useRef(void 0),Es=R.useCallback(()=>{clearTimeout(Yo.current),Yo.current=setTimeout(()=>z(Z=>Z+1),200)},[]);R.useEffect(()=>()=>clearTimeout(Yo.current),[]);const Eu=R.useCallback((Z,ge,Te)=>{if(Dn(Z.tabHistory),vs.current=Z.tabHistory,Nr(Z.experimentsTabOpen),un(Z.filesTabOpen),en(Z.artifactsTabOpen),hn(Z.expTabs),ln(Z.fileTabs),fr(Me=>Me===Z.planTabs?Me:Z.planTabs.map(it=>{var tt;return{...it,plan:((tt=Me.find(Mt=>Mt.sessionId===it.sessionId&&Mt.promptId===it.promptId))==null?void 0:tt.plan)??""}})),qt(Z.subagentTabs),Ln(Z.codeTabs),ls(Z.contentTabOrder),Ls(Z.previewTab),tn(Z.filesView),cr(Z.filesToggled),Vt(Z.scope),Ke(Z.panelMax),zi(Z.treeViewport),Qn(M.current.activeSessionId===O0&&Z.fileTabs.some(Me=>Qu(Me,{path:w1,source:"artifacts"}))),Te){for(const[Me,it]of Object.entries((ge==null?void 0:ge.scroll)??{}))pt.current.set(Me,it);Object.assign(N.current,ge==null?void 0:ge.sourceModes)}const Pe=M.current;if(Pe.projectId)for(const Me of Z.fileTabs){const it=Ms(Pe.projectId,Pe.activeSessionId,Me);E.current.has(it)||C.current.add(it)}},[ls,Ls]),{ready:Bn,loaded:y_,error:Zl,retry:Xo,capture:Pr,workspace:oa}=b0t({projectId:ee&&y!==null&&((a==null?void 0:a.kind)!=="task"||!u||y.includes(u))?n:null,taskKey:u??"new",location:i.href,pane:t,isTask:(a==null?void 0:a.kind)==="task",demoOverview:(ee==null?void 0:ee.tourCompleted)===!1,state:ia,apply:Eu,getScroll:aa,sourceModes:N.current,revision:T}),Jl=R.useRef(null);R.useLayoutEffect(()=>{if(!Bn||!pe||(a==null?void 0:a.kind)!=="task")return;const Z=Jl.current;(Z==null?void 0:Z.projectId)===n&&Z.taskId===u&&Z.scope!==bn&&zi(null),Jl.current={projectId:n,taskId:u,scope:bn}},[Bn,pe,a==null?void 0:a.kind,n,u,bn]);const ji=R.useCallback((Z,ge)=>{var it;if(!n)return;Z&&ge!=null&&ge.replace&&u===null&&(Pr(),g0t(n,Z));const Te=lu(TO(n),Z??"new"),Pe=Te?Te.active:Wc(n)?(it=j6(Z??void 0,oe.current===!1))==null?void 0:it.active:void 0,Me=ge!=null&&ge.replace&&Z&&u===null?M.current.pane:Pe;s.navigate({href:k1(n,Z,Me),replace:ge==null?void 0:ge.replace})},[s,n,u,Pr]);R.useEffect(()=>{Bn&&(a==null?void 0:a.kind)!=="task"&&!l.current&&oa.current.lastTaskId&&(y!=null&&y.includes(oa.current.lastTaskId))&&(l.current=oa.current.lastTaskId,z(Z=>Z+1))},[Bn,a==null?void 0:a.kind,oa,y]),HV({shouldBlockFn:({next:Z})=>{var ge;return((ge=Rd(Z.pathname))==null?void 0:ge.projectId)!==n&&[...kt.current.values()].some(Te=>Te.needsProtection)&&!DA(qE())},enableBeforeUnload:()=>[...kt.current.values()].some(Z=>Z.needsProtection)});const La=R.useRef(null);R.useEffect(()=>{const Z=ab(i.href);!ee||!Bn||!Z||(ob.queue({lastLocation:Z,railOpen:ao,panelWidth:os,experimentsView:Ze},La.current===Z?250:0),La.current=Z)},[i.href,ee,Bn,ao,os,Ze]);const ec=(ee==null?void 0:ee.onboardingCompleted)??!1,[tc,nc]=R.useState(!1),Ti=R.useCallback(()=>nc(!0),[]),Nn=R.useCallback(async()=>{const Z=await r.mutateAsync({tourCompleted:!0});ce(ge=>ge&&{...ge,tourCompleted:Z.tourCompleted}),nc(!1)},[]),rc=R.useCallback(async()=>{await Nn(),Vr(!0)},[Nn]);R.useEffect(()=>{!n||!Wc(n)||!ec||ee!=null&&ee.tourCompleted||Ti()},[n,ec,Ti,ee==null?void 0:ee.tourCompleted]);const Rt=(L==null?void 0:L.find(Z=>Z.id===n))??null;R.useEffect(()=>{const Z=Q||ee===null?null:Rt==null?void 0:Rt.name;document.title=Z?`${Do(Z)} — OpenResearch`:"OpenResearch"},[Q,ee,Rt]);const hr=R.useRef(n);hr.current=n;const xs=R.useCallback(Z=>{n&&sd({name:"first_action",surface:Wc(n)?"demo":"project",action:Z})},[n]);R.useEffect(()=>{o!=="chat"&&o!=="skills"&&xs("open_settings")},[o,xs]);const la=R.useCallback((Z=!1)=>{Z&&(!M.current.isTask||M.current.pane)||(xs("open_experiment"),Nr(!0),O({kind:"home",view:"experiments"},Z))},[O,xs]),Ai=()=>{I.refetch(),G.refetch(),w.refetch()},oo=R.useRef(!1);R.useEffect(()=>{if(!ee||oo.current)return;oo.current=!0,le.current=ee.preferredAgent;const Z=E6()??ee.workspace;Z&&(Cs(Z.railOpen),ks(Math.min(Z.panelWidth,T0())),ht(Z.experimentsView))},[ee]),R.useEffect(()=>{y&&l.current&&!y.includes(l.current)&&(l.current=null)},[y]);const lo=R.useRef(Promise.resolve()),sc=R.useRef(0),us=R.useCallback(Z=>{const ge=++sc.current;ce(Pe=>Pe&&{...Pe,preferredAgent:Z});const Te=lo.current.then(()=>r.mutateAsync({preferredAgent:Z})).then(Pe=>{le.current=Pe.preferredAgent,ge===sc.current&&ce(Me=>Me&&{...Me,preferredAgent:Pe.preferredAgent})}).catch(Pe=>{throw ge===sc.current&&ce(Me=>Me&&{...Me,preferredAgent:le.current}),Pe});return lo.current=Te.catch(()=>{}),Te},[]);R.useEffect(()=>{const Z=()=>{ks(ge=>Math.min(ge,T0())),sa(window.innerWidth>=WR)};return window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)},[]);const Os=R.useCallback(Z=>{Pt.current=!1,zt.current.clear(),ot.current.clear();const ge=++ft.current;nt.fetchQuery(su(Z)).then(Te=>{if(hr.current!==Z||$t.current!==Z||ft.current!==ge)return;zt.current=new Map(Te.map(Me=>[Me.id,Me]));const Pe=[...ot.current.values()].some(Me=>{const it=zt.current.get(Me.id);return!it||it.status!=="running"&&it.updatedAt<=Me.updatedAt});ot.current.clear();for(const Me of Te){const it=at.current.get(Me.id);(!it||it.updatedAt{ft.current===ge&&(ot.current.clear(),ye(!0))})},[la]);R.useEffect(()=>{if(n)return $t.current=n,at.current.clear(),bt.current.clear(),yut(n).catch(()=>{}),Os(n),()=>{ft.current++}},[Os,n]);const ic=R.useCallback(()=>{en(!0),Dr("artifacts")},[Dr]);aht({onReconnect:()=>{const Z=hr.current;Z&&($t.current=Z,at.current.clear(),bt.current.clear(),Os(Z))},onRun:Z=>{if(Z.projectId!==hr.current||Z.projectId!==$t.current)return;const ge=at.current.get(Z.id),Te=bt.current.has(Z.id);if(ge&&ge.updatedAt>Z.updatedAt||(at.current.set(Z.id,Z),bt.current.add(Z.id),Z.status!=="running"||(ge==null?void 0:ge.status)==="running"))return;const Pe=zt.current.get(Z.id),Me=Pt.current&&(!Pe||Pe.status!=="running"&&Pe.updatedAt<=Z.updatedAt);Te&&ge||Me?la(!0):Pt.current||ot.current.set(Z.id,Z)}});const Zo=R.useCallback(()=>Vt("project"),[]),Is=R.useCallback((Z,ge="overview",Te="preview",Pe)=>{xs("open_experiment");const Me={id:Z,view:ge};hn(it=>it.some(tt=>Rx(tt,Me))?it:[...it,Me]),cs(Me,Te,Pe)},[cs]),Oa=R.useCallback((Z,ge="preview")=>{const Te=ze.current.filter(Me=>Me.id===Z||Me.id.startsWith(Z)),Pe=Te.length===1?Te[0]:null;Pe&&Is(Pe.experimentId,"terminal",ge,Pe.id)},[Is]),Nu=R.useMemo(()=>new Map(ue.map(Z=>{var ge;return[Z.id,((ge=Z.title)==null?void 0:ge.trim())||Z.slug||Cl()]})),[ue,V]),Zs=KR(Nu),Jo=R.useMemo(()=>{const Z=new Map;for(const ge of Ie)Z.set(ge.id,Zs.get(ge.experimentId)??Cl());return Z},[Zs,Ie,V]),el=KR(Jo),ac=R.useCallback(Z=>{const ge=el.get(Z);if(ge)return ge;const Te=[...el].filter(([Pe])=>Pe.startsWith(Z));return Te.length===1?Te[0][1]:""},[el]),rf=R.useCallback(Z=>{const ge=Zs.get(Z);if(ge)return ge;const Te=[...Zs].filter(([Pe])=>Pe.startsWith(Z));return Te.length===1?Te[0][1]:""},[Zs]),zu=R.useCallback((Z,ge="preview")=>{const Te=It.current.filter(Pe=>Pe.id===Z||Pe.id.startsWith(Z));Te.length===1&&Is(Te[0].id,"overview",ge)},[Is]),ju=R.useCallback(Z=>{const ge=Jn.findIndex(Te=>Rx(Te,Z));ge!==-1&&(hn(Te=>Te.filter((Pe,Me)=>Me!==ge)),yr(Z,Ct(b)===Ct(Z)))},[Jn,yr,b]),co=R.useCallback((Z,ge="preview")=>{Z.line!=null&&S(Me=>Me+1);const Te=hr.current;if(Te){const Me=Ms(Te,nn.current,Z);Mr.current.fileTabs.some(it=>Qu(it,Z))||C.current.delete(Me),E.current.add(Me)}const Pe=zO(Z);ln(Me=>{const it=Me.findIndex(Mt=>Qu(Mt,Z));if(it===-1)return[...Me,Pe];const tt=Me.slice();return tt[it]=Pe,tt}),cs(Z,ge)},[cs]),fi=R.useCallback((Z,ge,Te,Pe,Me,it)=>{const tt=L==null?void 0:L.find(Ps=>Ps.id===n),Mt=oDt(Z,tt==null?void 0:tt.repoPath,ge,(tt==null?void 0:tt.artifactsDir)??(tt==null?void 0:tt.filesDir),tt==null?void 0:tt.slug);if(!Mt)return null;const Gn=Me?It.current.find(Ps=>Ps.id===Me||Me.length>=6&&Ps.id.startsWith(Me)):void 0,Ns=Te??(Gn==null?void 0:Gn.branchName),zs=Mt.source==null||Mt.source==="repo";return Ns&&zs&&(Mt.ref=Ns),it&&!Mt.ref&&zs&&(Mt.branchLabel=it),Pe!=null&&(Mt.line=Pe),Mt},[L,n]),oc=R.useCallback((Z,ge,Te,Pe,Me,it,tt="preview")=>{const Mt=fi(Z,ge,Te,Pe,Me,it);Mt&&co(Mt,tt)},[co,fi]),sf=R.useCallback(Z=>co({path:Z,source:"artifacts"},"keepOpen"),[co]),Tu=R.useCallback((Z,ge,Te,Pe,Me,it="preview")=>{const tt=fi(Z,ge,Me,Te,Pe);tt&&co(tt,it)},[co,fi]),hi=R.useCallback((Z,ge)=>{bs(Z),ge()},[bs]),af=R.useCallback(Z=>{var Pe;const ge=En.findIndex(Me=>Qu(Me,Z));if(ge===-1)return;const Te=n?Ms(n,u,Z):null;Te&&((Pe=kt.current.get(Te))!=null&&Pe.needsProtection)&&!DA(qE())||(ln(Me=>Me.filter((it,tt)=>tt!==ge)),Te&&(pt.current.delete(Te),kt.current.delete(Te),E.current.delete(Te),C.current.delete(Te),delete N.current[Te]),u===O0&&Qu(Z,{path:w1,source:"artifacts"})&&Qn(!1),yr(Z,Ct(b)===Ct(Z)))},[u,En,yr,n,b]),of=R.useCallback(Z=>{Z.lineScrollRequest!==void 0&&m(Z.lineScrollRequest)},[]),x_=R.useCallback((Z,ge,Te,Pe="preview")=>{const Me={kind:"plan",sessionId:ge,promptId:Te,plan:Z};fr(it=>{const tt=it.findIndex(Gn=>Gn.promptId===Te);if(tt===-1)return[...it,Me];const Mt=it.slice();return Mt[tt]=Me,Mt}),cs(Me,Pe)},[cs]),w_=R.useCallback(Z=>{const ge=mt.findIndex(Te=>Te.promptId===Z.promptId);ge!==-1&&(fr(Te=>Te.filter((Pe,Me)=>Me!==ge)),yr(Z,Ct(b)===Ct(Z)))},[yr,mt,b]),lc=R.useCallback((Z,ge,Te,Pe="preview")=>{const Me={kind:"subagent",sessionId:Z,spawnPartId:ge,label:Te};qt(it=>it.some(tt=>tt.spawnPartId===ge)?it:[...it,Me]),cs(Me,Pe)},[cs]),lf=R.useCallback(Z=>{const ge=cn.findIndex(Te=>Te.spawnPartId===Z.spawnPartId);ge!==-1&&(qt(Te=>Te.filter((Pe,Me)=>Me!==ge)),yr(Z,Ct(b)===Ct(Z)))},[yr,b,cn]),[cf,cc]=R.useState({});R.useEffect(()=>{if(cc(tt=>{const Mt=new Set(cn.map(Gn=>Gn.spawnPartId));return Object.keys(tt).every(Gn=>Mt.has(Gn))?tt:Object.fromEntries(Object.entries(tt).filter(([Gn])=>Mt.has(Gn)))}),cn.length===0)return;let Z=!0;const ge=new Set,Te=(tt,Mt,Gn)=>{cc(Ns=>{var Ps;let zs=Ns;for(const _i of Mt)if(!(Gn&&ge.has(_i.spawnPartId)))for(const Tn of tt){const Qr=Av(Tn.parts,_i.spawnPartId);if(!Qr)continue;Gn||ge.add(_i.spawnPartId);const Js={label:r9t(Qr),running:((Ps=Qr.state)==null?void 0:Ps.status)==="running"},tr=zs[_i.spawnPartId];(!tr||tr.label!==Js.label||tr.running!==Js.running)&&(zs===Ns&&(zs={...Ns}),zs[_i.spawnPartId]=Js);break}return zs})};let Pe=0;const Me=()=>{const tt=++Pe;for(const Mt of new Set(cn.map(Gn=>Gn.sessionId)))nt.fetchQuery({...Bl(Mt),staleTime:0}).then(({messages:Gn})=>{Z&&tt===Pe&&Te(Gn,cn.filter(Ns=>Ns.sessionId===Mt),!0)}).catch(()=>{})};Me();const it=iv(tt=>{if(tt.type==="reconnected"){ge.clear(),Me();return}if(tt.type!=="message")return;const Mt=cn.filter(Gn=>Gn.sessionId===tt.sessionId);Mt.length&&Te([tt.message],Mt,!1)});return()=>{Z=!1,it()}},[cn]);const uc=R.useCallback((Z,ge,Te="files",Pe="preview")=>{const Me={code:!0,experimentId:Z,branch:ge,view:Te,toggled:new Set};Ln(it=>it.some(tt=>Hf(tt,Me))?it.map(tt=>Hf(tt,Me)?{...tt,experimentId:Z,view:Te}:tt):[...it,Me]),cs(Me,Pe)},[cs]),uf=R.useCallback((Z,ge)=>{Ln(Te=>Te.map(Pe=>Hf(Pe,Z)?{...Pe,...ge}:Pe)),ge.view&&O(Dl({...Z,...ge}))},[]),S_=R.useCallback(Z=>{const ge=er.findIndex(Te=>Hf(Te,Z));ge!==-1&&(Ln(Te=>Te.filter((Pe,Me)=>Me!==ge)),yr(Z,Ct(b)===Ct(Z)))},[er,yr,b]),uo=R.useCallback(()=>{un(!0),Dr("files")},[Dr]),dc=R.useCallback(Z=>{Z==="experiments"?Nr(!1):Z==="files"?un(!1):en(!1),yr(Z,b===Z)},[yr,b]),df=Z=>{Z.preventDefault(),Z.currentTarget.setPointerCapture(Z.pointerId);const Te=document.body.style.userSelect;document.body.style.userSelect="none";const Pe=Rr,Me=Z.clientX,it=os;let tt=!1;function Mt(){window.removeEventListener("pointermove",Gn),window.removeEventListener("pointerup",Mt),window.removeEventListener("pointercancel",Mt),document.body.style.userSelect=Te}function Gn(Ns){if(Pe){const Tn=Ns.clientX-Me;if(tt||Tn<_Dt)return;tt=!0,Ke(!1);const Qr=Math.min(Math.max(it,qv),T0());ks(Qr),window.removeEventListener("pointermove",Gn);return}const zs=Math.round(window.innerWidth-Ns.clientX-cDt),Ps=T0();if(zs>Ps+hDt){Ke(!0);return}Ke(!1);const _i=Math.min(Math.max(zs,qv),Ps);ks(_i)}window.addEventListener("pointermove",Gn),window.addEventListener("pointerup",Mt),window.addEventListener("pointercancel",Mt)},k_=(Z,ge)=>{F(Te=>Te?VR(Te,Z):[Z]),s.navigate({href:`/projects/${encodeURIComponent(Z.id)}${ge?"/settings/git":""}`}),ge&&Kn(ge,"error")},Bs=typeof b=="object"&&"id"in b?b:null,Rn=typeof b=="object"&&"path"in b?b:null,Au=(Rn==null?void 0:Rn.source)==="artifacts"&&Re?xp(Re.entries,Rn.path):null,fc=Au?`${Au.modifiedAt}:${Au.size}`:null,ca=u===O0&&Zt?En.find(Z=>Qu(Z,{path:w1,source:"artifacts"})):void 0,ff=ca?[ca]:[],Kr=typeof b=="object"&&"kind"in b&&b.kind==="plan"?b:null,ua=Kr==null?void 0:Kr.sessionId,Ia=Kr==null?void 0:Kr.promptId,hc=!!(ua&&Ia&&(y!=null&&y.includes(ua))),tl=ct({...Bl(ua??""),enabled:hc,subscribed:hc}),se=R.useMemo(()=>{var ge;if(!ua||!Ia||!tl.data)return null;const Z=tl.data.messages.flatMap(Te=>{const Pe=Av(Te.parts,Ia);return Pe?[Pe]:[]})[0];return{key:`${ua}:${Ia}`,text:((ge=Z==null?void 0:Z.prompt)==null?void 0:ge.plan)??null}},[ua,Ia,tl.data]),be=typeof b=="object"&&"kind"in b&&b.kind==="subagent"?b:null,Ae=typeof b=="object"&&"code"in b?b:null,Le=Ae?er.find(Z=>Hf(Z,Ae))??null:null,Ue=new Map;for(const Z of[...Jn,...En,...mt,...cn,...er])Ue.set(Ct(Z),Z);const zn=ca?Ct(ca):null,jn=di.filter(Z=>Z!==zn).map(Z=>Ue.get(Z)).filter(_0t),dr=Z=>io!==null&&Ct(io)===Ct(Z),Mn=Z=>f.jsx(Fc,{active:Rn!==null&&Qu(Rn,Z),label:Z.path.split("/").pop()||Z.path,icon:f.jsx(qO,{size:12,className:"shrink-0"}),preview:dr(Z),onSelect:()=>Dr(Z),onPromote:()=>bs(Z),onClose:()=>af(Z)},`file:${N6(Z)}`),_r=Bs?ue.find(Z=>Z.id===Bs.id)??null:null,da=Le?ue.find(Z=>Z.id===Le.experimentId&&Z.branchName===Le.branch)??null:null,hf=Z=>{var Te,Pe;if("path"in Z)return Mn(Z);if("id"in Z){const Me=ue.find(it=>it.id===Z.id);return f.jsx(Fc,{active:Bs!==null&&Rx(Bs,Z),label:Me?Me.title||Me.slug:"…",icon:Z.view==="overview"?f.jsx(K0t,{size:12,className:"shrink-0"}):f.jsx(qh,{size:12,className:"shrink-0"}),preview:dr(Z),onSelect:()=>Dr(Z),onPromote:()=>bs(Z),onClose:()=>ju(Z)},Ct(Z))}if("kind"in Z&&Z.kind==="plan")return f.jsx(Fc,{active:Kr!==null&&Kr.promptId===Z.promptId,label:SD(),icon:f.jsx(L6,{size:12,className:"shrink-0"}),preview:dr(Z),onSelect:()=>Dr(Z),onPromote:()=>bs(Z),onClose:()=>w_(Z)},Ct(Z));if("kind"in Z)return f.jsx(Fc,{active:be!==null&&be.spawnPartId===Z.spawnPartId,label:((Te=cf[Z.spawnPartId])==null?void 0:Te.label)??Z.label??Hne(),shimmer:((Pe=cf[Z.spawnPartId])==null?void 0:Pe.running)??!1,icon:f.jsx(I6,{size:12,className:"shrink-0"}),preview:dr(Z),onSelect:()=>Dr(Z),onPromote:()=>bs(Z),onClose:()=>lf(Z)},Ct(Z));const ge=ue.find(Me=>Me.id===Z.experimentId);return f.jsx(Fc,{active:Le!==null&&Hf(Le,Z),label:(ge==null?void 0:ge.slug)??Z.branch,icon:f.jsx(Dd,{size:12,className:"shrink-0"}),preview:dr(Z),onSelect:()=>Dr(Z),onPromote:()=>bs(Z),onClose:()=>S_(Z)},Ct(Z))};if(!a||a.kind==="resume")return null;if(Q)return f.jsxs("div",{className:"app flex flex-col h-full",children:[f.jsxs("div",{className:w0,children:[f.jsx("p",{children:Q}),f.jsx(Oe,{variant:"primary",onClick:Ai,children:Ui()})]}),e.kind==="ssh"&&f.jsx(uv,{runtime:e,corner:!0})]});if(L&&!Rt)return f.jsxs("div",{className:w0,children:[Ya(),f.jsx(Oe,{onClick:()=>H(null),children:D0()})]});if(Zl&&!Bn)return f.jsxs("div",{className:w0,children:[f.jsx("p",{role:"alert",children:Zl}),f.jsx(Oe,{onClick:Xo,children:Ui()})]});if(L===null||ee===null||!y_||y===null)return f.jsxs("div",{className:"app flex flex-col h-full",children:[f.jsx("div",{className:w0,children:f.jsx(Lt,{})}),e.kind==="ssh"&&f.jsx(uv,{runtime:e,corner:!0})]});if(!Rt||(a==null?void 0:a.kind)==="task"&&u&&!(y!=null&&y.includes(u)))return f.jsxs("div",{className:w0,children:[Ya(),f.jsx(Oe,{onClick:()=>H(null),children:D0()})]});const Ru=f.jsx(DEt,{projectName:((nl=L.find(Z=>Z.id===n))==null?void 0:nl.name)??"",onHome:()=>void s.navigate({to:"/projects"}),onNewProject:()=>Vr(!0),onRepository:()=>ys("git"),onCollapse:()=>Cs(!1)});return f.jsxs("div",{className:"app flex flex-col h-full",children:[e.kind==="local"&&f.jsx(iI,{}),e.kind==="local"&&f.jsx(uI,{status:X}),Zl&&f.jsxs("div",{role:"alert",className:"flex items-center gap-2 px-4 py-2 text-subtext",children:[f.jsx("span",{children:Zl}),f.jsx(Oe,{onClick:Xo,children:Ui()})]}),f.jsxs("div",{className:`app-body workspace-body relative flex flex-1 min-h-0 py-0 px-3.5 ${Ma?"workspace-card-visible":""}`,children:[n&&f.jsx(g9t,{projectId:n,projectName:(Rt==null?void 0:Rt.name)??"",railHeader:Ru,railOpen:ao,onShowRail:()=>Cs(!0),mainView:o,onSelectMainView:ys,onOpenFile:Tu,onOpenRun:Oa,runExperimentName:ac,onOpenExperiment:zu,experimentName:rf,onOpenPlan:x_,onOpenSubagent:lc,composerPrefill:Rt&&Wc(Rt.id)&&(ee==null?void 0:ee.tourCompleted)===!1?tut:null,runtime:e,onOpenDemoWelcome:Rt&&Wc(Rt.id)?Ti:void 0,activeSessionId:u,onActiveSessionChange:ji,preferredAgent:ee.preferredAgent,onPreferredAgentChange:us,children:o==="skills"?f.jsx(nEt,{}):o!=="chat"?f.jsx(P8t,{remote:e.kind==="ssh",tab:o,project:Rt,onProjectUpdate:Z=>{F(ge=>ge?VR(ge,Z):[Z])},onSelectTab:ys}):null}),o==="chat"&&f.jsx(zyt,{expanded:Ma,experiments:ue,runs:Ie,onOpenExperiment:(Z,ge)=>Is(Z,"overview","preview",ge),rightOffset:_?os+28:void 0,activeView:_&&(b==="files"||b==="artifacts"||b==="experiments")?b:null,projectId:Rt.id,onCompute:()=>ys("compute"),sessionId:u,busy:(($s=w.data)==null?void 0:$s.some(Z=>Z.id===u&&Z.busy))??!1,onChanges:()=>{tn("changes"),uo()},onFiles:()=>{tn("files"),uo()},onArtifacts:ic,onExperiments:()=>la()}),o==="chat"&&_&&f.jsxs("aside",{className:`right-pane relative shrink-0 min-w-0 flex flex-col mt-5 me-0 mb-5 ms-3.5 bg-canvas [&.max]:fixed [&.max]:inset-2.5 [&.max]:m-0 [&.max]:z-60 [&.max]:shadow-panel-max border border-border rounded-lg overflow-hidden shadow-elevated ${Rr?"max":""}`,style:Rr?void 0:{width:os},"data-onboarding":"experiments",children:[f.jsx("div",{className:`panel-resizer absolute start-0 top-0 bottom-0 w-1.5 z-30 [&:hover]:bg-resizer-hover [&:active]:bg-resizer-hover ${Rr?"cursor-e-resize":"cursor-col-resize"}`,title:Rr?Lte():Ate(),onPointerDown:df}),f.jsxs("div",{className:"tabs flex items-end gap-0 pt-1 pe-1.5 pb-0 ps-2 h-10 border-b border-b-border bg-background shrink-0",children:[f.jsxs("div",{className:"tab-strip flex items-end gap-0.5 flex-1 min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[ff.map(Mn),vt&&f.jsx(Fc,{active:b==="files",label:k4(),icon:f.jsx(Dd,{size:12,className:"shrink-0"}),onSelect:()=>Dr("files"),onClose:()=>dc("files")}),Cn&&f.jsx(Fc,{active:b==="artifacts",label:pD(),icon:f.jsx(M6,{size:12,className:"shrink-0"}),onSelect:()=>Dr("artifacts"),onClose:()=>dc("artifacts")}),Wr&&f.jsx(Fc,{active:b==="experiments",label:mD(),icon:f.jsx(db,{size:12,className:"shrink-0"}),onSelect:()=>Dr("experiments"),onClose:()=>dc("experiments")}),jn.map(hf)]}),f.jsxs("div",{className:"panel-controls inline-flex items-center gap-0.5 self-center py-0 px-1.5 shrink-0",children:[f.jsx(Qt,{title:Rr?oE():aE(),"aria-label":Rr?oE():aE(),onClick:()=>Ke(Z=>!Z),children:Rr?f.jsx(Xpt,{size:14}):f.jsx(Kpt,{size:14})}),f.jsx(Qt,{title:ev(),"aria-label":ev(),onClick:()=>{$(),Ke(!1)},children:f.jsx(qr,{size:14})})]})]}),!Bn||((t==null?void 0:t.kind)==="experiment"||(t==null?void 0:t.kind)==="code")&&!pe||(t==null?void 0:t.kind)==="experiment"&&t.runId&&!Se?f.jsx(Fa,{children:f.jsx(Lt,{})}):Bs&&(!_r||d&&!Ie.some(Z=>Z.id===d&&Z.experimentId===Bs.id))||Ae&&!da||t&&"sessionId"in t&&t.sessionId&&!(y!=null&&y.includes(t.sessionId))?f.jsx(Fa,{children:f.jsx("div",{className:"p-6 text-subtext",children:Ya()})}):b==="artifacts"?f.jsx(Fa,{children:Rt&&f.jsx(V9t,{project:Rt,artifacts:Re,onOpenFile:sf,canRenameFile:Z=>{var ge;return!((ge=kt.current.get(Ms(Rt.id,u,{path:Z,source:"artifacts"})))!=null&&ge.needsProtection)}},Rt.id)}):b==="experiments"?f.jsxs(Fa,{children:[f.jsxs("div",{className:"pane-toolbar flex shrink-0 flex-wrap items-center gap-2 bg-background px-3 pt-2.5 pb-2",children:[f.jsx("span",{className:"flex-1"}),f.jsxs("div",{className:"experiments-toolbar-controls inline-flex items-center gap-[5px]",children:[f.jsxs("div",{className:"option-picker relative inline-flex",ref:fn,children:[f.jsx(Qt,{size:"small",ref:Ve,className:"experiment-scope-trigger",active:bn==="agent",title:Gte({scope:bn==="agent"?sE():iE()}),"aria-label":ine(),"aria-expanded":Ht,onClick:()=>sn(Z=>!Z),children:f.jsx(jpt,{size:16,strokeWidth:2.5})}),Ht&&f.jsxs("div",{className:"option-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-95 flex flex-col bg-background border border-border rounded-lg shadow-menu z-50 overflow-hidden min-w-47.5 p-1.5 [&.align-right]:start-auto [&.align-right]:end-0 [&.drop-down]:bottom-auto [&.drop-down]:top-[calc(100%_+_4px)] [&.session-menu]:start-auto [&.session-menu]:end-1.5 [&.session-menu]:top-[calc(100%_-_2px)] [&.session-menu]:min-w-35 drop-down align-right experiment-scope-menu [&_.model-item]:whitespace-nowrap [&_.model-item:disabled]:text-muted [&_.model-item:disabled]:cursor-default [&_.model-item:disabled:hover]:bg-transparent",children:[f.jsxs(sr,{"aria-pressed":bn==="agent",disabled:!u||!Jt,title:u?Jt?void 0:cne():gne(),onClick:()=>{Vt("agent"),sn(!1)},children:[f.jsx("span",{children:sE()}),bn==="agent"&&f.jsx(Na,{size:13})]}),f.jsxs(sr,{"aria-pressed":bn==="project",onClick:()=>{Vt("project"),sn(!1)},children:[f.jsx("span",{children:iE()}),bn==="project"&&f.jsx(Na,{size:13})]})]})]}),f.jsxs("div",{className:"seg inline-flex items-center gap-0.5 rounded-md bg-hover-subtle [&_button]:font-medium [&_button]:text-text [&_button]:rounded-sm [&_button:not(:disabled):hover]:text-text [&_button.active]:bg-background [&_button.active]:shadow-segment [&_button:disabled]:text-muted [&_button:disabled]:cursor-default experiments-view-toggle p-0.5 [&_button]:py-0.5 [&_button]:px-2 [&_button]:text-sm",role:"group","aria-label":Qte(),children:[f.jsx("button",{className:Ze==="table"?"active":"","aria-pressed":Ze==="table",onClick:()=>ht("table"),children:Wne()}),f.jsx("button",{className:Ze==="tree"?"active":"","aria-pressed":Ze==="tree",onClick:()=>ht("tree"),children:Yne()})]})]})]}),f.jsx("div",{className:"pane-content flex-1 min-h-0 relative bg-background",children:Ze==="tree"?Rt&&f.jsx(iDt,{experiments:ue,runs:lr,project:Rt,onOpenView:Is,onOpenCode:uc,agentSessionId:bn==="agent"?u:null,onShowProjectScope:Zo,viewport:Ut,onViewportChange:zi}):f.jsx(LEt,{runs:lr,emptyHint:bn==="agent"&&ue.length>0?hne():void 0,experiments:or,onOpen:(Z,ge)=>{Is(Z.id,"overview",ge)},onOpenLogs:(Z,ge,Te)=>{Is(Z,"terminal",Te,ge)},onOpenCode:(Z,ge)=>{const Te=ue.find(Pe=>Pe.id===Z);Te&&uc(Te.id,Te.branchName,"files",ge)},onCancel:ML})})]}):b==="files"?f.jsx(Fa,{children:Rt?f.jsx(L9t,{sessionId:u??void 0,project:Rt,view:Ra,toggled:Ys,onViewChange:tn,onToggledChange:cr,canRenameFile:Z=>{var ge;return!((ge=kt.current.get(Ms(Rt.id,u,{path:Z,source:"repo",sessionId:u??void 0})))!=null&&ge.needsProtection)},onOpenFile:(Z,ge,Te,Pe)=>oc(Z,ge,Te,void 0,void 0,void 0,Pe)},`files:${u??`project:${Rt.id}`}`):f.jsx("div",{className:"code-tab flex flex-col h-full min-h-0 wt-tab",children:f.jsx(ph,{children:f.jsxs("div",{className:"wt-empty flex flex-col items-center gap-2.5 py-12 px-6 text-center text-muted [&_>_svg]:text-subtext [&_p]:m-0 [&_p]:max-w-80 [&_p]:text-sm",children:[f.jsx(UO,{size:22}),f.jsx("p",{children:Tne()})]})})})}):Rn?f.jsx(Fa,{children:n&&f.jsx(MEt,{remote:e.kind==="ssh",restored:C.current.has(Ms(n,u,Rn)),onRestoreActivated:()=>{const Z=Ms(n,u,Rn);C.current.delete(Z),E.current.add(Z)},showSource:N.current[Ms(n,u,Rn)]??!1,onShowSourceChange:Z=>{N.current[Ms(n,u,Rn)]=Z,z(ge=>ge+1)},projectId:n,path:Rn.path,source:Rn.source,sessionId:Rn.source==="artifacts"?u??void 0:Rn.sessionId,gitRef:Rn.ref,line:Rn.line,branchLabel:lDt(Rn,Rt==null?void 0:Rt.baselineBranch),artifactVersion:fc,artifactEntries:Rn.source==="artifacts"?Re==null?void 0:Re.entries:void 0,bufferSession:Ge(Ms(n,u,Rn)),onOpenFile:(Z,ge,Te,Pe)=>hi(Rn,()=>oc(Z,ge,Te,void 0,void 0,void 0,Pe)),scrollPosition:pt.current.get(Ms(n,u,Rn)),onScrollPositionChange:Z=>{pt.current.set(Ms(n,u,Rn),Z),Es()},lineScrollRequest:Rn.lineScrollRequest,onLineScrollRequestHandled:()=>of(Rn),onEdit:()=>bs(Rn)},Ms(n,u,Rn))}):Kr?f.jsx(Fa,{children:f.jsx("div",{className:"pane-content flex-1 min-h-0 relative plan-tab-content overflow-y-auto bg-background py-4.5 px-6 [&_.md]:max-w-readable",children:f.jsx($o,{text:(se==null?void 0:se.key)===`${Kr.sessionId}:${Kr.promptId}`?se.text??Ya():((fo=mt.find(Z=>Z.promptId===Kr.promptId))==null?void 0:fo.plan)||gD(),onOpenFile:(Z,ge,Te,Pe,Me)=>hi(Kr,()=>oc(Z,Kr.sessionId,Pe,ge,Te,void 0,Me))})})}):be?f.jsx(y9t,{sessionId:be.sessionId,spawnPartId:be.spawnPartId,onOpenFile:(Z,ge,Te,Pe,Me)=>hi(be,()=>Tu(Z,be.sessionId,ge,Te,Pe,Me)),onOpenRun:(Z,ge)=>hi(be,()=>Oa(Z,ge)),runExperimentName:ac,onOpenExperiment:(Z,ge)=>hi(be,()=>zu(Z,ge)),experimentName:rf,onOpenSubagent:(Z,ge,Te)=>hi(be,()=>lc(be.sessionId,Z,ge,Te))},be.spawnPartId):Le?f.jsx(Fa,{children:n&&Rt&&Le&&da&&f.jsx(D9t,{projectId:n,project:Rt,experiment:da,view:Le.view,toggled:Le.toggled,onViewChange:Z=>uf(Le,{view:Z}),onToggledChange:Z=>uf(Le,{toggled:Z}),onOpenFile:(Z,ge,Te,Pe)=>hi(Le,()=>oc(Z,ge,Te,void 0,void 0,da.branchName,Pe))},`code:${Le.branch}`)}):f.jsx(Fa,{children:Bs&&_r&&Rt&&f.jsx(oEt,{experiment:_r,project:Rt,view:Bs.view,runs:Ie,selectedRunId:d,onSelectRun:U,parentExperiment:ue.find(Z=>Z.id===_r.parentExperimentId)??null,onOpenView:(Z,ge,Te)=>{hi(Bs,()=>Is(_r.id,Z,Te,ge))},onOpenCode:(Z,ge)=>hi(Bs,()=>uc(_r.id,_r.branchName,Z,ge))},`${Bs.id}:${Bs.view}`)})]})]}),Da&&f.jsx(sI,{remote:e.kind==="ssh",onClose:()=>Vr(!1),onCreated:(Z,ge)=>{Vr(!1),k_(Z,ge)}}),tc&&Rt&&Wc(Rt.id)&&f.jsx(OEt,{onClose:Nn,onCreateProject:rc})]})}const N5=Fo()({validateSearch:e=>({pane:C6(e.pane)}),beforeLoad:({location:e})=>{if(!Rd(e.pathname))throw pW()},component:gDt});function gDt(){const{projectId:e}=N5.useParams(),{pane:n}=N5.useSearch(),t=li(),r=sD({select:s=>s.location});return R.useEffect(()=>{const s=vDt(r.searchStr);s!==null&&t.navigate({href:`${r.pathname}${s}${r.hash?`#${r.hash}`:""}`,replace:!0})},[r,t]),f.jsxs(f.Fragment,{children:[f.jsx(Z0,{}),f.jsx(mDt,{projectId:e,pane:n,runtime:AO()},e)]})}function vDt(e){const n=new URLSearchParams(e);if(!n.has("pane"))return null;try{if(n.getAll("pane").length===1&&C6(JSON.parse(n.get("pane")??"")))return null}catch{}n.delete("pane");const t=n.toString();return t?`?${t}`:""}const Mq=Fo()({component:bDt});function bDt(){const{projectId:e}=Mq.useParams();return f.jsx(pgt,{projectId:e})}const yDt=Fo()({}),xDt=Fo()({}),wDt=Fo()({}),SDt=Fo()({}),kDt=ggt.update({id:"/",path:"/",getParentRoute:()=>lb}),Hk=vgt.update({id:"/projects",path:"/projects",getParentRoute:()=>lb}),CDt=bgt.update({id:"/remote-launch",path:"/remote-launch",getParentRoute:()=>lb}),EDt=ygt.update({id:"/",path:"/",getParentRoute:()=>Hk}),b_=N5.update({id:"/$projectId",path:"/$projectId",getParentRoute:()=>Hk}),NDt=Mq.update({id:"/",path:"/",getParentRoute:()=>b_}),zDt=yDt.update({id:"/skills",path:"/skills",getParentRoute:()=>b_}),jDt=xDt.update({id:"/settings/$tab",path:"/settings/$tab",getParentRoute:()=>b_}),TDt=wDt.update({id:"/tasks/$sessionId",path:"/tasks/$sessionId",getParentRoute:()=>b_}),ADt=SDt.update({id:"/tasks/new",path:"/tasks/new",getParentRoute:()=>b_}),RDt={ProjectsProjectIdSkillsRoute:zDt,ProjectsProjectIdIndexRoute:NDt,ProjectsProjectIdSettingsTabRoute:jDt,ProjectsProjectIdTasksSessionIdRoute:TDt,ProjectsProjectIdTasksNewRoute:ADt},MDt=b_._addFileChildren(RDt),DDt={ProjectsProjectIdRoute:MDt,ProjectsIndexRoute:EDt},LDt=Hk._addFileChildren(DDt),ODt={IndexRoute:kDt,ProjectsRoute:LDt,RemoteLaunchRoute:CDt},IDt=lb._addFileChildren(ODt)._addFileTypes(),BDt=IV({routeTree:IDt,context:{queryClient:nt},trailingSlash:"never",defaultPendingComponent:F6,defaultErrorComponent:H6,defaultNotFoundComponent:hgt}),$Dt=j();document.documentElement.lang=$Dt;document.documentElement.dir="ltr";GG.createRoot(document.getElementById("root")).render(f.jsxs(R.StrictMode,{children:[f.jsx(iG,{client:nt,children:f.jsx(PV,{router:BDt})}),f.jsx(Q_t,{})]})); +`)+1)}let U=[];try{U=$.trim()?r3($):[]}catch{return null}if(B.truncated&&U.every(V=>V.hunks.length===0))return null;let H=0,Y=0;for(const V of U){const X=Rb(V);H+=X.additions,Y+=X.deletions}return{fileCount:U.length,additions:H,deletions:Y,truncated:B.truncated}},[v]),w={done:0,failed:0,cancelled:0,live:0};for(const B of n)B.status==="done"?w.done+=1:B.status==="failed"?w.failed+=1:B.status==="cancelled"?w.cancelled+=1:w.live+=1;const y=t?np((t.endedAt??Date.now())-t.createdAt):null,C=(t==null?void 0:t.status)==="failed"&&t.resultMarkdown?t.resultMarkdown:null,E=e.description||(C?null:t==null?void 0:t.resultMarkdown)||null,N=R.useRef(null),[T,z]=R.useState(!1),[M,I]=R.useState(!1);return R.useEffect(()=>{z(!1)},[E]),R.useEffect(()=>{const B=N.current;B&&I(B.scrollHeight>B.clientHeight+1)},[E,T]),eo.createPortal(f.jsxs("div",{ref:u.ref,className:"exp-hover-card fixed z-60 bg-background border border-border rounded-lg shadow-menu py-3.5 px-4 text-sm text-text [&_.hc-head]:flex [&_.hc-head]:items-baseline [&_.hc-head]:justify-between [&_.hc-head]:gap-2.5 [&_.hc-slug]:text-sm [&_.hc-slug]:font-semibold [&_.hc-slug]:min-w-0 [&_.hc-slug]:overflow-hidden [&_.hc-slug]:text-ellipsis [&_.hc-slug]:whitespace-nowrap [&_.hc-title]:mt-[3px] [&_.hc-title]:text-text [&_.hc-actions]:flex [&_.hc-actions]:items-center [&_.hc-actions]:gap-1.5 [&_.hc-actions]:mt-2.5 [&_.hc-actions_button]:inline-flex [&_.hc-actions_button]:items-center [&_.hc-actions_button]:justify-center [&_.hc-actions_button]:gap-[5px] [&_.hc-actions_button]:min-w-21 [&_.hc-actions_button]:py-1.5 [&_.hc-actions_button]:px-2.5 [&_.hc-actions_button]:border [&_.hc-actions_button]:border-border [&_.hc-actions_button]:rounded-md [&_.hc-actions_button]:bg-background [&_.hc-actions_button]:text-text [&_.hc-actions_button]:text-sm [&_.hc-actions_button]:font-medium [&_.hc-actions_button:hover]:border-border-hover-strong [&_.hc-actions_button:hover]:bg-canvas [&_.hc-body]:mt-2.5 [&_.hc-body]:border-t [&_.hc-body]:border-t-border-variant [&_.hc-body]:pt-2.5 [&_.hc-body]:leading-[1.6] [&_.hc-body]:whitespace-pre-line [&_.hc-body]:line-clamp-10 [&_.hc-body.expanded]:block [&_.hc-body.expanded]:line-clamp-none [&_.hc-body.expanded]:max-h-[45vh] [&_.hc-body.expanded]:overflow-y-auto [&_.hc-body.expanded]:overflow-x-hidden [&_.hc-body.expanded]:pb-1 [&_.hc-toggle]:mt-1 [&_.hc-toggle]:text-sm [&_.hc-toggle]:font-medium [&_.hc-toggle]:text-muted [&_.hc-toggle:hover]:text-text [&_.hc-failure]:mt-2 [&_.hc-failure]:text-accent-red [&_.hc-failure]:line-clamp-3 [&_.hc-stats]:mt-2.5 [&_.hc-stats]:border-t [&_.hc-stats]:border-t-border-variant [&_.hc-stats]:pt-2.5 [&_.hc-stats]:flex [&_.hc-stats]:items-center [&_.hc-stats]:gap-3 [&_.hc-stats]:flex-wrap [&_.hc-stats]:text-xs [&_.hc-stats]:text-text [&_.hc-git]:mt-2.5 [&_.hc-git]:pt-2 [&_.hc-git]:border-t [&_.hc-git]:border-t-border-variant [&_.hc-git]:text-xs [&_.hc-git]:text-text [&_.hc-git]:flex [&_.hc-git]:flex-col [&_.hc-git]:gap-1 [&_.hc-git-row]:flex [&_.hc-git-row]:items-center [&_.hc-git-row]:gap-2.5 [&_.hc-git-row]:flex-wrap [&_.hc-git-row]:min-w-0 [&_.hc-branch]:inline-flex [&_.hc-branch]:items-center [&_.hc-branch]:gap-1 [&_.hc-branch]:min-w-0 [&_.hc-branch]:overflow-hidden [&_.hc-branch]:text-ellipsis [&_.hc-branch]:whitespace-nowrap [&_.hc-foot]:mt-2 [&_.hc-foot]:flex [&_.hc-foot]:items-center [&_.hc-foot]:justify-between [&_.hc-foot]:gap-2.5 [&_.hc-foot]:text-xs [&_.hc-foot]:text-muted [&_.hc-foot_.hc-command]:min-w-0 [&_.hc-foot_.hc-command]:overflow-hidden [&_.hc-foot_.hc-command]:text-ellipsis [&_.hc-foot_.hc-command]:whitespace-nowrap",style:{width:Kw,left:m,top:x,visibility:u.offsetHeight===0?"hidden":void 0},onMouseEnter:o,onMouseLeave:l,children:[f.jsxs("div",{className:"hc-head",children:[f.jsx("span",{className:"hc-slug",children:e.slug}),f.jsx(Il,{status:t?Hi(t):"idle"})]}),e.title&&f.jsx("div",{className:"hc-title",children:e.title}),f.jsxs("div",{className:"hc-actions",children:[i&&f.jsxs("button",{type:"button",...Ur(i),children:[f.jsx($h,{size:13}),g1e()]}),f.jsxs("button",{type:"button",...Ur(a),children:[f.jsx(db,{size:13}),i1e()]})]}),E&&f.jsx("div",{className:`hc-body${T?" expanded":""}`,ref:N,children:E}),E&&(M||T)&&f.jsx("button",{type:"button",className:"hc-toggle",onClick:()=>z(B=>!B),children:T?zD():Spe()}),C&&f.jsx("div",{className:"hc-failure",children:C}),f.jsxs("div",{className:"hc-stats",children:[f.jsx("span",{children:new Intl.ListFormat(j(),{style:"short"}).format([n.length===1?F4e():G4e({count:Wt(n.length)}),...w.done>0?[g4e({count:Wt(w.done)})]:[],...w.failed>0?[x4e({count:Wt(w.failed)})]:[],...w.cancelled>0?[h4e({count:Wt(w.cancelled)})]:[],...w.live>0?[M4e({count:Wt(w.live)})]:[]])}),t&&p6(t.backend)&&f.jsx($6,{backend:t.backend}),y&&f.jsx("span",{children:y}),t&&f.jsx("span",{children:Io(t.createdAt)})]}),f.jsxs("div",{className:"hc-git",children:[f.jsxs("div",{className:"hc-git-row",children:[f.jsxs("span",{className:"hc-branch",title:e.branchName,children:[f.jsx(Jp,{size:12}),e.branchName]}),r&&f.jsxs("span",{children:[h1e()," ",f.jsx("span",{children:r})]})]}),b&&b.fileCount>0&&f.jsx("div",{className:"hc-git-row",title:b.truncated?OK({parent:Ne(r??"parent")}):RK({parent:Ne(r??"parent")}),children:f.jsxs("span",{children:[b.truncated&&"≥ ",f.jsxs("span",{className:"diff-stat-add text-accent-green",children:["+",b.additions]})," ",f.jsxs("span",{className:"diff-stat-del text-accent-red",children:["−",b.deletions]})," · ",b.fileCount===1&&!b.truncated?I4e():b.truncated?j4e({count:Wt(b.fileCount)}):C4e({count:Wt(b.fileCount)})]})})]}),f.jsxs("div",{className:"hc-foot",children:[f.jsxs("span",{className:"hc-command font-mono",children:["$ ",e.runCommand]}),f.jsxs("span",{children:[c1e()," ",WMt(e.createdAt)]})]})]}),document.body)}const UR=["empty-state absolute inset-0 flex flex-col items-center","justify-center p-6 text-center text-subtext [&_p]:max-w-[46ch]","[&_p]:m-0 [&_p]:text-sm [&_p]:leading-normal [&_p]:text-balance","[&_p.empty-state-title]:text-2xl [&_p.empty-state-title]:font-normal","[&_p.empty-state-title]:text-text [&_p.empty-state-hint]:text-lg","[&_p.empty-state-hint]:text-subtext empty-state-cta gap-1.5"].join(" "),KMt=264,GR=132,P1=44,QMt=72,YMt=148,XMt=44;function ZMt(e){const n=new Map(e.map(i=>[i.id,{exp:i,children:[]}])),t=[];for(const i of e){const a=n.get(i.id),o=i.parentExperimentId?n.get(i.parentExperimentId):void 0;o?o.children.push(a):t.push(a)}const r=(i,a)=>i.exp.createdAt-a.exp.createdAt,s=i=>{i.children.sort(r),i.children.forEach(s)};return t.sort(r),t.forEach(s),t}function JMt(e,n){const t=new Map,r=o=>{const l=t.get(o)??1+o.children.reduce((u,_)=>u+r(_),0);return t.set(o,l),l},s=new Map,i=o=>{const l=s.get(o)??(n(o)||o.children.some(i));return s.set(o,l),l};function a(o){if(n(o)){const _=[];let d=0;for(const p of o.children)i(p)?_.push(...a(p)):d+=r(p);return d>0&&_.push({kind:"elided",id:`el-${o.exp.id}`,count:d,children:[]}),[{kind:"exp",exp:o.exp,children:_}]}if(!i(o))return[];let l=0;const u=[];return(function _(d){l+=1;for(const p of d.children)n(p)?u.push(...a(p)):i(p)?_(p):l+=r(p)})(o),[{kind:"elided",id:`el-${o.exp.id}`,count:l,children:u}]}return e.flatMap(a)}function E5(e){return e.kind==="exp"?KMt:YMt}function p1(e){return e.kind==="exp"?e.exp.id:e.id}function F1(e){if(e.children.length===0)return E5(e);const n=e.children.reduce((t,r)=>t+F1(r),0)+P1*(e.children.length-1);return Math.max(E5(e),n)}function eDt(e){return e==="done"?"pass":e==="failed"?"fail":e==="running"||e==="starting"||e==="cancelling"?"live":"other"}const tDt=R.memo(function({data:n}){Gd();const{exp:t,latestRun:r,runs:s,isBaseline:i,parentSlug:a,githubOwner:o,githubRepo:l,onOpenView:u,onOpenCode:_}=n,d=r?Hi(r):void 0,p=d==="running"||d==="starting"||d==="cancelling",m=i?Jat():p?_ot():Sl(),x=s.slice(-8),S=R.useRef(null),v=GMt(S,n);return f.jsxs("div",{ref:S,className:`exp-node w-66 border border-border rounded-md bg-background py-2.5 px-3 shadow-tree text-sm transition-[box-shadow] duration-120 ease-standard [&:hover]:shadow-tree-hover [&.live]:border-accent-teal [&.live]:shadow-tree-live [&_.node-overview-link]:block [&_.node-overview-link]:w-full [&_.node-overview-link]:p-0 [&_.node-overview-link]:border-0 [&_.node-overview-link]:bg-transparent [&_.node-overview-link]:text-inherit [&_.node-overview-link]:[font:inherit] [&_.node-overview-link]:text-start [&_.node-overview-link]:cursor-pointer [&_.node-overview-link:hover_.node-slug]:underline [&_.node-overview-link:hover_.node-slug]:underline-offset-[3px] [&_.node-overview-link:focus-visible]:outline-2 [&_.node-overview-link:focus-visible]:outline-solid [&_.node-overview-link:focus-visible]:outline-accent [&_.node-overview-link:focus-visible]:outline-offset-4 [&_.node-overview-link:focus-visible]:rounded-xs [&_.node-eyebrow]:flex [&_.node-eyebrow]:items-center [&_.node-eyebrow]:justify-between [&_.node-eyebrow]:gap-2 [&_.node-eyebrow]:mb-1.5 [&_.node-eyebrow]:text-xs [&_.node-eyebrow]:font-medium [&_.node-eyebrow]:text-muted [&_.node-head]:flex [&_.node-head]:items-center [&_.node-head]:gap-[7px] [&_.node-head]:min-w-0 [&_.node-status]:w-2 [&_.node-status]:h-2 [&_.node-status]:rounded-full [&_.node-status]:shrink-0 [&_.node-slug]:text-sm [&_.node-slug]:font-semibold [&_.node-slug]:text-text [&_.node-slug]:flex-1 [&_.node-slug]:min-w-0 [&_.node-slug]:overflow-hidden [&_.node-slug]:text-ellipsis [&_.node-slug]:whitespace-nowrap [&_.node-title]:mt-1 [&_.node-title]:text-text [&_.node-title]:text-sm [&_.node-title]:line-clamp-2 [&_.node-meta]:mt-2 [&_.node-meta]:flex [&_.node-meta]:items-center [&_.node-meta]:gap-2 [&_.node-meta]:text-xs [&_.node-meta]:text-muted [&_.node-actions]:mt-2 [&_.node-actions]:pt-1.5 [&_.node-actions]:border-t [&_.node-actions]:border-t-border-variant [&_.node-actions]:flex [&_.node-actions]:items-center [&_.node-actions]:gap-[3px] [&_.node-action]:inline-flex [&_.node-action]:items-center [&_.node-action]:gap-[5px] [&_.node-action]:py-[3px] [&_.node-action]:px-1.5 [&_.node-action]:text-sm [&_.node-action]:font-medium [&_.node-action]:text-text [&_.node-action]:rounded-sm [&_.node-action]:no-underline [&_.node-action:hover]:text-text [&_.node-action:hover]:bg-surface [&_.node-action-ext]:ms-auto [&_.node-action-ext]:py-[3px] [&_.node-action-ext]:px-[5px] ${p?"live":""}`,onMouseEnter:v.onMouseEnter,onMouseLeave:v.onMouseLeave,children:[f.jsx(uu,{type:"target",position:Et.Top}),f.jsxs("div",{role:"button",tabIndex:0,className:"node-overview-link nodrag",...Ur(b=>u(t.id,"overview",b)),children:[f.jsxs("div",{className:"node-eyebrow",children:[f.jsx("span",{children:m}),f.jsx(Il,{status:d??"idle"})]}),f.jsx("div",{className:"node-head",children:f.jsx("span",{className:"node-slug",children:t.slug})}),(t.title||t.description)&&f.jsx("div",{className:"node-title",children:t.title||t.description}),f.jsxs("div",{className:"node-meta",children:[f.jsx("span",{children:Jot()}),x.length>0?f.jsx("span",{className:"run-squares flex items-center gap-[3px]",children:x.map(b=>f.jsx("span",{className:`run-sq w-[9px] h-[9px] shrink-0 [&.pass]:bg-accent-green [&.fail]:border-[1.5px] [&.fail]:border-danger-outline [&.live]:bg-accent-teal [&.live]:animate-[or-pulse_1.2s_ease-in-out_infinite] [&.other]:border-[1.5px] [&.other]:border-border ${eDt(Hi(b))}`,title:U6(Hi(b))},b.id))}):f.jsx("span",{children:Fot()}),f.jsx("span",{className:"flex-1"}),r&&f.jsx("span",{children:Io(r.createdAt)})]})]}),f.jsxs("div",{className:"node-actions",onClick:b=>b.stopPropagation(),children:[s.length>0&&f.jsxs("button",{className:"node-action",title:Got(),...Ur(b=>u(t.id,"terminal",b)),children:[f.jsx($h,{size:13}),NL()]}),f.jsxs("button",{className:"node-action",title:fD({branch:Ne(t.branchName)}),...Ur(b=>_(t.id,t.branchName,"files",b)),children:[f.jsx(db,{size:13}),Eot()]}),o&&l&&f.jsx("a",{className:"node-action node-action-ext",title:J1({name:Ne(t.branchName)}),"aria-label":J1({name:Ne(t.branchName)}),href:Jv(o,l,t.branchName),target:"_blank",rel:"noopener noreferrer",onClick:b=>b.stopPropagation(),children:f.jsx(fb,{size:13})})]}),f.jsx(uu,{type:"source",position:Et.Bottom}),v.rect&&f.jsx(VMt,{exp:t,runs:s,latestRun:r,parentSlug:a,anchor:v.rect,onOpenLogs:s.length>0?b=>u(t.id,"terminal",b):void 0,onOpenCode:b=>_(t.id,t.branchName,"files",b),onMouseEnter:v.keepOpen,onMouseLeave:v.onMouseLeave})]})}),nDt=R.memo(function({data:n}){Gd();const{count:t,onShowProjectScope:r}=n;return f.jsxs("div",{className:"elided-node w-37 h-11 flex items-center gap-2 py-1.5 px-2.5 border border-dashed border-border rounded-md bg-hover-faint text-muted text-sm font-medium text-start transition-[border-color,color] duration-120 ease-standard [&:hover]:border-text [&:hover]:text-text [&_.elided-node-label]:flex [&_.elided-node-label]:flex-col [&_.elided-node-label]:leading-[1.3] [&_.elided-node-sub]:text-muted",role:"button",tabIndex:0,title:rlt(),onClick:r,onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),r())},children:[f.jsx(uu,{type:"target",position:Et.Top}),f.jsx(A6,{size:14}),f.jsxs("span",{className:"elided-node-label",children:[t===1?uot():aot({count:Wt(t)}),f.jsx("span",{className:"elided-node-sub",children:Qot()})]}),f.jsx(uu,{type:"source",position:Et.Bottom})]})}),rDt={exp:tDt,elided:nDt},Rq={type:"default",style:{stroke:"var(--text)",strokeWidth:1.5,opacity:.3}},sDt={...Rq.style,strokeDasharray:"4 4"};function iDt({experiments:e,runs:n,project:t,onOpenView:r,onOpenCode:s,agentSessionId:i,onShowProjectScope:a,viewport:o,onViewportChange:l}){const{nodes:u,edges:_}=R.useMemo(()=>{const d=new Map;for(const y of n){const C=d.get(y.experimentId);C?C.push(y):d.set(y.experimentId,[y])}for(const y of d.values())y.sort((C,E)=>C.createdAt-E.createdAt);const p=[],m=[],x=y=>!i||y.exp.chatSessionId===i,S=JMt(ZMt(e),x),v=new Map(e.map(y=>[y.id,y.slug]));function b(y,C,E){const N=C-E5(y)/2;if(y.kind==="exp"){const M=d.get(y.exp.id)??[];p.push({id:y.exp.id,type:"exp",position:{x:N,y:E},data:{exp:y.exp,latestRun:M[M.length-1]??null,runs:M,isBaseline:!y.exp.parentExperimentId,parentSlug:y.exp.parentExperimentId?v.get(y.exp.parentExperimentId)??null:null,githubOwner:t.githubEnabled?t.githubOwner:"",githubRepo:t.githubEnabled?t.githubRepo:"",onOpenView:r,onOpenCode:s}})}else p.push({id:y.id,type:"elided",position:{x:N,y:E+(GR-XMt)/2},data:{count:y.count,onShowProjectScope:a}});if(y.children.length===0)return;const T=y.children.reduce((M,I)=>M+F1(I),0)+P1*(y.children.length-1);let z=C-T/2;for(const M of y.children){const I=F1(M),B=y.kind==="elided"||M.kind==="elided";m.push({id:`e-${p1(y)}-${p1(M)}`,source:p1(y),target:p1(M),...B?{style:sDt}:{}}),b(M,z+I/2,E+GR+QMt),z+=I+P1}}let w=0;for(const y of S){const C=F1(y);b(y,w+C/2,0),w+=C+P1}return{nodes:p,edges:m}},[e,n,r,s,t.githubOwner,t.githubRepo,t.githubEnabled,i,a]);return e.length===0?f.jsxs("div",{className:UR,children:[f.jsx("p",{className:"empty-state-title",children:Iot()}),f.jsx("p",{className:"empty-state-hint",children:wot()})]}):u.length===0&&i?f.jsxs("div",{className:UR,children:[f.jsx("p",{className:"empty-state-title",children:Mot()}),f.jsx("p",{className:"empty-state-hint",children:vot()})]}):f.jsx(hMt,{className:"[&_.react-flow\\_\\_node.react-flow\\_\\_node-exp.selectable]:cursor-default [&_.react-flow\\_\\_node.react-flow\\_\\_node-elided.selectable]:cursor-pointer [&_.react-flow\\_\\_handle]:opacity-0 [&_.react-flow\\_\\_handle]:pointer-events-none [&_.react-flow\\_\\_attribution]:hidden!",nodes:u,edges:_,nodeTypes:rDt,defaultEdgeOptions:Rq,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,onMoveStart:UMt,onMoveEnd:(d,p)=>{d&&l(p)},minZoom:.15,defaultViewport:o??void 0,fitView:o===null,fitViewOptions:{padding:.25,maxZoom:1},children:f.jsx(vMt,{variant:$l.Dots,color:"var(--dots-strong)",gap:28,size:1.6})},i??"project")}function aDt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function oDt(e,n,t,r,s){let i=e,a;const o=n==null?void 0:n.replace(/\/+$/,""),l=r==null?void 0:r.replace(/\/+$/,"");if(i.startsWith("artifacts/"))return i=i.slice(10),i?{path:i,source:"artifacts"}:null;if(i==="~"||i.startsWith("~/"))return{path:i,source:"abs"};const u=p=>{const m=v=>v.replace(/^\/private(?=\/(?:tmp|var)(?:\/|$))/,""),[x,S]=[m(i),m(p)];return x===S?"":x.startsWith(`${S}/`)?x.slice(S.length).replace(/^\/+/,""):null},_=i.startsWith("/")&&l?u(l):null,d=i.startsWith("/")&&o?u(o):null;if(!i.startsWith("/"))a=t;else{if(_!==null)return _?{path:_,source:"artifacts"}:null;if(d!==null)i=d;else{const p=s?aDt(s):"[^/]+",m=i.match(new RegExp(`/files/${p}/(.+)$`)),x=m?null:i.match(/\/openresearch\/worktrees\/[^/]+\/([^/]+)\/(.+)$/),S=m||x?null:i.match(/\/openresearch\/repos\/[^/]+\/[^/]+\/(.+)$/);if(m)return{path:m[1],source:"artifacts"};x?(a=x[1],i=x[2]):S&&(i=S[1])}}return i?i.startsWith("/")?{path:i,source:"abs"}:{path:i,sessionId:a}:null}function lDt(e,n){if(!(e.source==="artifacts"||e.source==="abs"))return e.ref??e.branchLabel??n}const Hv=360,cDt=10,WR=1448,uDt=272,dDt=380,fDt=uDt+56,hDt=80,_Dt=48;function T0(){return Math.max(Hv,window.innerWidth-fDt-dDt)}function pDt(){const e=T0();return Math.max(Hv,Math.min(760,e,Math.round(window.innerWidth*.4)))}function VR(e,n){const t=e.findIndex(s=>s.id===n.id);if(t<0)return[...e,n];const r=e.slice();return r[t]=n,r}function KR(e){const n=R.useRef(e);return n.current.size===e.size&&[...e].every(([r,s])=>n.current.get(r)===s)||(n.current=e),n.current}function mDt(e,n){const t=ot(xa(e)),r=R.useMemo(()=>{var S;return((S=t.data)==null?void 0:S.map(v=>v.id))??null},[t.data]),s=R.useMemo(()=>rp(),[e]),i=ot(s),a=i.data??null,o=R.useCallback(S=>{Gr(s.queryKey,v=>(typeof S=="function"?S(v??null):S)??void 0)},[s]),l=R.useMemo(()=>Xp(),[e]),u=ot(l),_=u.data??null,d=R.useCallback(S=>{Gr(l.queryKey,v=>(typeof S=="function"?S(v??null):S)??void 0)},[l]),p=[!t.data&&t.error?vD():null,!i.data&&i.error?ep():null,!u.data&&u.error?Dne():null].filter(S=>S!==null),m=p.length?Bne({items:new Intl.ListFormat(n).format(p)}):null;return{sessionsQuery:t,sessions:r,projectsQuery:i,projects:a,setProjects:o,uiStateQuery:u,uiState:_,setUiState:d,startupError:m,loadInitialState:()=>{i.refetch(),u.refetch(),t.refetch()}}}function gDt(e,n,t){const[r,s]=R.useState("table"),[i,a]=R.useState("project"),o=R.useRef(null),{open:l,setOpen:u,ref:_}=to(o),d=e.every(v=>v.chatSessionId),p=t&&d?i:"project",m=R.useMemo(()=>p!=="agent"?e:e.filter(v=>v.chatSessionId===t),[e,p,t]),x=R.useMemo(()=>{if(p!=="agent")return n;const v=new Set(m.map(b=>b.id));return n.filter(b=>v.has(b.experimentId))},[n,m,p]),S=R.useCallback(()=>a("project"),[]);return{view:r,setView:s,scope:i,setScope:a,scopeTriggerRef:o,scopeMenuOpen:l,setScopeMenuOpen:u,scopeMenuRef:_,allExperimentsAttributed:d,effectiveScope:p,scopedExperiments:m,scopedRuns:x,showProjectScope:S}}function vDt(e){const[n,t]=R.useState({});return R.useEffect(()=>{if(t(u=>{const _=new Set(e.map(d=>d.spawnPartId));return Object.keys(u).every(d=>_.has(d))?u:Object.fromEntries(Object.entries(u).filter(([d])=>_.has(d)))}),e.length===0)return;let r=!0;const s=new Set,i=(u,_,d)=>{t(p=>{var x;let m=p;for(const S of _)if(!(d&&s.has(S.spawnPartId)))for(const v of u){const b=ey(v.parts,S.spawnPartId);if(!b)continue;d||s.add(S.spawnPartId);const w={label:r9t(b),running:((x=b.state)==null?void 0:x.status)==="running"},y=m[S.spawnPartId];(!y||y.label!==w.label||y.running!==w.running)&&(m===p&&(m={...p}),m[S.spawnPartId]=w);break}return m})};let a=0;const o=()=>{const u=++a;for(const _ of new Set(e.map(d=>d.sessionId)))tt.fetchQuery({...Ol(_),staleTime:0}).then(({messages:d})=>{r&&u===a&&i(d,e.filter(p=>p.sessionId===_),!0)}).catch(()=>{})};o();const l=iv(u=>{if(u.type==="reconnected"){s.clear(),o();return}if(u.type!=="message")return;const _=e.filter(d=>d.sessionId===u.sessionId);_.length&&i([u.message],_,!1)});return()=>{r=!1,l()}},[e]),n}function bDt(e,n){const t=R.useRef(null),r=R.useRef(Promise.resolve()),s=R.useRef(0),i=R.useCallback(a=>{const o=++s.current;e(u=>u&&{...u,preferredAgent:a});const l=r.current.then(()=>n({preferredAgent:a})).then(u=>{t.current=u.preferredAgent,o===s.current&&e(_=>_&&{..._,preferredAgent:u.preferredAgent})}).catch(u=>{throw o===s.current&&e(_=>_&&{..._,preferredAgent:t.current}),u});return r.current=l.catch(()=>{}),l},[e,n]);return{persistedPreferredAgent:t,persistPreferredAgent:i}}const w0=["empty-state absolute inset-0 flex flex-col items-center","justify-center gap-2.5 p-6 text-center text-subtext","[&_p]:max-w-[46ch] [&_p]:m-0 [&_p]:text-sm [&_p]:leading-normal","[&_p]:text-balance [&_p.empty-state-title]:text-2xl","[&_p.empty-state-title]:font-normal [&_p.empty-state-title]:text-text","[&_p.empty-state-hint]:text-lg [&_p.empty-state-hint]:text-subtext"].join(" ");function yDt({runtime:e,projectId:n,pane:t}){var wn,Sn,Nr;const r=mn({mutationFn:lut}),s=ei(),i=sD({select:J=>J.location}),a=zd(i.pathname),o=(a==null?void 0:a.kind)==="skills"?"skills":(a==null?void 0:a.kind)==="settings"?a.section??"settings":"chat",l=R.useRef(null),u=(a==null?void 0:a.kind)==="task"?a.sessionId??null:l.current;(a==null?void 0:a.kind)==="task"&&(l.current=u);const _=t!==void 0,d=(t==null?void 0:t.kind)==="experiment"?t.runId??null:null,[p,m]=R.useState(null),[x,S]=R.useState(0),v=R.useRef({href:"",jump:0,value:0});(v.current.href!==i.href||v.current.jump!==x)&&(v.current={href:i.href,jump:x,value:v.current.value+1});const b=R.useMemo(()=>{const J=t?Ua(t):"experiments";return typeof J=="object"&&"path"in J&&J.line&&p!==v.current.value?{...J,lineScrollRequest:v.current.value}:J},[t,p,i.href,x]),w=R.useRef(new Set),y=R.useRef(new Set),C=R.useRef({}),[E,N]=R.useState(0),T=R.useRef({projectId:n,activeSessionId:u,pane:t,isTask:(a==null?void 0:a.kind)==="task"});T.current={projectId:n,activeSessionId:u,pane:t,isTask:(a==null?void 0:a.kind)==="task"};const z=R.useCallback((J,ve=!1)=>{const Re=T.current;Re.projectId&&s.navigate({href:k1(Re.projectId,Re.activeSessionId,J),replace:ve})},[s]),M=R.useCallback(J=>{const ve=Rl(J);z(ve.kind==="file"?{...ve,line:void 0}:ve)},[z]),I=R.useCallback(()=>z(void 0),[z]),B=R.useCallback(J=>{(t==null?void 0:t.kind)==="experiment"&&z({...t,runId:J??void 0})},[t,z]),$=R.useCallback(J=>{s.navigate({href:J?`/projects/${encodeURIComponent(J)}`:"/projects"})},[s]),U=R.useCallback(J=>{var ve;if(n)if(J==="chat"){const Re=l.current;s.navigate({href:k1(n,Re,(ve=Jc(sa.current,Re??"new"))==null?void 0:ve.active)})}else s.navigate({href:`/projects/${encodeURIComponent(n)}/${J==="skills"?"skills":`settings/${J}`}`})},[s,n]),H=Gd(),{status:Y}=P6(e.kind==="local"),{sessionsQuery:V,sessions:X,projects:ee,setProjects:O,uiState:L,setUiState:F,startupError:q,loadInitialState:G}=mDt(n,H),re=R.useRef(void 0);re.current=L==null?void 0:L.tourCompleted;const{persistedPreferredAgent:ce,persistPreferredAgent:oe}=bDt(F,R.useCallback(J=>r.mutateAsync(J),[r])),te=ot(U4(n)),Q=te.data??[],le=!te.isPending,[ae,de]=R.useState(!1),we=ot(Qc(n)).data??[],be=R.useRef(we);be.current=we;const Pe=R.useRef(new Map),Be=R.useRef(new Set),ze=R.useRef(null),it=R.useRef(!1),bt=R.useRef(new Map),It=R.useRef(new Map),$t=R.useRef(0),jt=R.useRef(Q);jt.current=Q;const ut=ot(wgt(n)).data??null,[Ht,Se]=R.useState(!1),{view:Ae,setView:Ze,scope:ht,setScope:wt,scopeTriggerRef:en,scopeMenuOpen:Ve,setScopeMenuOpen:qt,scopeMenuRef:ln,allExperimentsAttributed:cn,effectiveScope:Mt,scopedExperiments:er,scopedRuns:tn,showProjectScope:Mr}=gDt(Q,we,u),[tr,qn]=R.useState([]),[Sr,$n]=R.useState(!1),[Wr,kr]=R.useState(!1),[gt,un]=R.useState(!1),[vn,Zt]=R.useState([]),[Kn,fn]=R.useState([]),Nn=R.useRef(new Map),Vt=R.useRef(new Map),xt=J=>{let ve=Vt.current.get(J);return ve||(ve=new fEt,Vt.current.set(J,ve)),ve},[At,Fe]=R.useState([]),[_t,cr]=R.useState([]),[xn,Ut]=R.useState([]),[ur,Qn]=R.useState([]),[ki,Ql]=R.useState(null),[ro,zs]=R.useState("files"),[Na,rn]=R.useState(new Set),[Dr,Rn]=R.useState(!1),[Ps,Xe]=R.useState(null),[Pt,ri]=R.useState(pDt),[Fs,si]=R.useState(()=>window.innerWidth>=WR),as=o==="chat"&&!_&&Fs,[ii,ta]=R.useState(!0),[Yl,gs]=R.useState(!1),Ci=R.useRef(z6()),os=R.useRef(u);os.current=u;const Pn=R.useRef(tr);Pn.current=tr;const Kt=R.useRef(ur);Kt.current=ur;const ai=R.useRef(null),js=R.useCallback(J=>{const ve=[...J];Kt.current=ve,Qn(ve)},[]),Yn=R.useCallback(J=>{ai.current=J,Ql(J)},[]),Hs=R.useCallback(J=>{const ve=Ct(J);Zt(De=>u0(De,ve)),fn(De=>u0(De,ve)),Fe(De=>u0(De,ve)),cr(De=>u0(De,ve)),Ut(De=>u0(De,ve));const Re=Ni.current;if(Re&&"path"in J){const De=Es(Re,os.current,J);Nn.current.delete(De),Vt.current.delete(De),y.current.delete(De),w.current.delete(De)}const Ge=Pn.current.filter(De=>Ct(De)!==ve);Pn.current=Ge,qn(Ge)},[]),ls=R.useCallback(J=>{const ve=Ct(J),Re=[...Pn.current.filter(Ge=>Ct(Ge)!==ve),Ig(J)];Pn.current=Re,qn(Re),M(J)},[M]),Un=R.useCallback((J,ve,Re)=>{const Ge=Ct(J),De=ai.current,at=I7t({order:Kt.current,previewKey:De?Ct(De):null},Ge,ve);at.replacedKey&&De&&typeof De!="string"&&Ct(De)===at.replacedKey&&Hs(De),js(at.order),at.previewKey===null?Yn(null):at.previewKey===Ge&&Yn(Ig(J));const vt=[...Pn.current.filter(sn=>Ct(sn)!==Ge),Ig(J)];Pn.current=vt,qn(vt),z(Rl(J,Re))},[Hs,js,Yn,z]),Vr=R.useCallback(J=>{const ve=ai.current;ve&&Ct(ve)===Ct(J)&&Yn(null)},[Yn]);R.useEffect(()=>{let J=!1;const ve=Ge=>{const De=ai.current,at=Ge.target;if(at instanceof Element&&at.closest("input, textarea, [contenteditable='true']")!==null){J=!1;return}if(De&&Ct(De)===Ct(Ci.current.rightTab)&&(Ge.metaKey||Ge.ctrlKey)&&!Ge.altKey&&!Ge.shiftKey&&Ge.key.toLowerCase()==="k"){Ge.preventDefault(),J=!0;return}if(J&&Ge.key==="Enter"){Ge.preventDefault(),J=!1;const sn=ai.current;sn&&Vr(sn);return}J=!1},Re=()=>{J=!1};return window.addEventListener("keydown",ve),window.addEventListener("blur",Re),window.addEventListener("pointerdown",Re),()=>{window.removeEventListener("keydown",ve),window.removeEventListener("blur",Re),window.removeEventListener("pointerdown",Re)}},[Vr]);const $r=R.useCallback((J,ve)=>{const Re=Ct(J),Ge=ai.current;Ge&&Ct(Ge)===Re&&Yn(null);const De=B7t({order:Kt.current,previewKey:Ge?Ct(Ge):null},Re,Pn.current.map(Ct));js(De.order);const at=Pn.current.filter(sn=>Ct(sn)!==Re);if(Pn.current=at,qn(at),!ve)return;const vt=De.fallbackKey?at.find(sn=>Ct(sn)===De.fallbackKey):void 0;vt?M(vt):(I(),Rn(!1))},[js,Yn,M,I]),na=U,oi=R.useMemo(()=>({rightTab:Ig(b),tabHistory:tr,experimentsTabOpen:Sr,filesTabOpen:Wr,artifactsTabOpen:gt,expTabs:vn,fileTabs:Kn,planTabs:At,subagentTabs:_t,codeTabs:xn,contentTabOrder:Kt.current,previewTab:ai.current,filesView:ro,filesToggled:Na,selectedRunId:d,scope:ht,panelOpen:_,panelMax:Dr,treeViewport:Ps}),[b,tr,Sr,Wr,gt,vn,Kn,At,_t,xn,ur,ki,ro,Na,d,ht,_,Dr,Ps]);Ci.current=oi;const qs=R.useCallback(()=>Object.fromEntries(Nn.current),[]),Ei=R.useRef(void 0),ra=R.useCallback(()=>{clearTimeout(Ei.current),Ei.current=setTimeout(()=>N(J=>J+1),200)},[]);R.useEffect(()=>()=>clearTimeout(Ei.current),[]);const gu=R.useCallback((J,ve,Re)=>{if(qn(J.tabHistory),Pn.current=J.tabHistory,$n(J.experimentsTabOpen),kr(J.filesTabOpen),un(J.artifactsTabOpen),Zt(J.expTabs),fn(J.fileTabs),Fe(De=>De===J.planTabs?De:J.planTabs.map(at=>{var vt;return{...at,plan:((vt=De.find(sn=>sn.sessionId===at.sessionId&&sn.promptId===at.promptId))==null?void 0:vt.plan)??""}})),cr(J.subagentTabs),Ut(J.codeTabs),js(J.contentTabOrder),Yn(J.previewTab),zs(J.filesView),rn(J.filesToggled),wt(J.scope),Rn(J.panelMax),Xe(J.treeViewport),Se(T.current.activeSessionId===L0&&J.fileTabs.some(De=>Gu(De,{path:w1,source:"artifacts"}))),Re){for(const[De,at]of Object.entries((ve==null?void 0:ve.scroll)??{}))Nn.current.set(De,at);Object.assign(C.current,ve==null?void 0:ve.sourceModes)}const Ge=T.current;if(Ge.projectId)for(const De of J.fileTabs){const at=Es(Ge.projectId,Ge.activeSessionId,De);y.current.has(at)||w.current.add(at)}},[js,Yn]),{ready:mr,loaded:vu,error:nr,retry:Jd,capture:ef,workspace:sa}=b0t({projectId:L&&X!==null&&((a==null?void 0:a.kind)!=="task"||!u||X.includes(u))?n:null,taskKey:u??"new",location:i.href,pane:t,isTask:(a==null?void 0:a.kind)==="task",demoOverview:(L==null?void 0:L.tourCompleted)===!1,state:oi,apply:gu,getScroll:qs,sourceModes:C.current,revision:E}),Pr=R.useRef(null);R.useLayoutEffect(()=>{if(!mr||!le||(a==null?void 0:a.kind)!=="task")return;const J=Pr.current;(J==null?void 0:J.projectId)===n&&J.taskId===u&&J.scope!==Mt&&Xe(null),Pr.current={projectId:n,taskId:u,scope:Mt}},[mr,le,a==null?void 0:a.kind,n,u,Mt]);const Xl=R.useCallback((J,ve)=>{var at;if(!n)return;J&&ve!=null&&ve.replace&&u===null&&(ef(),g0t(n,J));const Re=Jc(TO(n),J??"new"),Ge=Re?Re.active:Ic(n)?(at=j6(J??void 0,re.current===!1))==null?void 0:at.active:void 0,De=ve!=null&&ve.replace&&J&&u===null?T.current.pane:Ge;s.navigate({href:k1(n,J,De),replace:ve==null?void 0:ve.replace})},[s,n,u,ef]);R.useEffect(()=>{mr&&(a==null?void 0:a.kind)!=="task"&&!l.current&&sa.current.lastTaskId&&(X!=null&&X.includes(sa.current.lastTaskId))&&(l.current=sa.current.lastTaskId,N(J=>J+1))},[mr,a==null?void 0:a.kind,sa,X]),HV({shouldBlockFn:({next:J})=>{var ve;return((ve=zd(J.pathname))==null?void 0:ve.projectId)!==n&&[...Vt.current.values()].some(Re=>Re.needsProtection)&&!DA(qE())},enableBeforeUnload:()=>[...Vt.current.values()].some(J=>J.needsProtection)});const Zl=R.useRef(null);R.useEffect(()=>{const J=ib(i.href);!L||!mr||!J||(ab.queue({lastLocation:J,railOpen:ii,panelWidth:Pt,experimentsView:Ae},Zl.current===J?250:0),Zl.current=J)},[i.href,L,mr,ii,Pt,Ae]);const li=(L==null?void 0:L.onboardingCompleted)??!1,[so,Jl]=R.useState(!1),io=R.useCallback(()=>Jl(!0),[]),Yo=R.useCallback(async()=>{const J=await r.mutateAsync({tourCompleted:!0});F(ve=>ve&&{...ve,tourCompleted:J.tourCompleted}),Jl(!1)},[]),za=R.useCallback(async()=>{await Yo(),gs(!0)},[Yo]);R.useEffect(()=>{!n||!Ic(n)||!li||L!=null&&L.tourCompleted||io()},[n,li,io,L==null?void 0:L.tourCompleted]);const pt=(ee==null?void 0:ee.find(J=>J.id===n))??null;R.useEffect(()=>{const J=q||L===null?null:pt==null?void 0:pt.name;document.title=J?`${Do(J)} — OpenResearch`:"OpenResearch"},[q,L,pt]);const Ni=R.useRef(n);Ni.current=n;const dr=R.useCallback(J=>{n&&ed({name:"first_action",surface:Ic(n)?"demo":"project",action:J})},[n]);R.useEffect(()=>{o!=="chat"&&o!=="skills"&&dr("open_settings")},[o,dr]);const Cr=R.useCallback((J=!1)=>{J&&(!T.current.isTask||T.current.pane)||(dr("open_experiment"),$n(!0),z({kind:"home",view:"experiments"},J))},[z,dr]),Us=R.useRef(!1);R.useEffect(()=>{if(!L||Us.current)return;Us.current=!0,ce.current=L.preferredAgent;const J=E6()??L.workspace;J&&(ta(J.railOpen),ri(Math.min(J.panelWidth,T0())),Ze(J.experimentsView))},[L]),R.useEffect(()=>{X&&l.current&&!X.includes(l.current)&&(l.current=null)},[X]),R.useEffect(()=>{const J=()=>{ri(ve=>Math.min(ve,T0())),si(window.innerWidth>=WR)};return window.addEventListener("resize",J),()=>window.removeEventListener("resize",J)},[]);const ja=R.useCallback(J=>{it.current=!1,bt.current.clear(),It.current.clear();const ve=++$t.current;tt.fetchQuery(Qc(J)).then(Re=>{if(Ni.current!==J||ze.current!==J||$t.current!==ve)return;bt.current=new Map(Re.map(De=>[De.id,De]));const Ge=[...It.current.values()].some(De=>{const at=bt.current.get(De.id);return!at||at.status!=="running"&&at.updatedAt<=De.updatedAt});It.current.clear();for(const De of Re){const at=Pe.current.get(De.id);(!at||at.updatedAt{$t.current===ve&&(It.current.clear(),de(!0))})},[Cr]);R.useEffect(()=>{if(n)return ze.current=n,Pe.current.clear(),Be.current.clear(),yut(n).catch(()=>{}),ja(n),()=>{$t.current++}},[ja,n]);const zi=R.useCallback(()=>{un(!0),ls("artifacts")},[ls]);aht({onReconnect:()=>{const J=Ni.current;J&&(ze.current=J,Pe.current.clear(),Be.current.clear(),ja(J))},onRun:J=>{if(J.projectId!==Ni.current||J.projectId!==ze.current)return;const ve=Pe.current.get(J.id),Re=Be.current.has(J.id);if(ve&&ve.updatedAt>J.updatedAt||(Pe.current.set(J.id,J),Be.current.add(J.id),J.status!=="running"||(ve==null?void 0:ve.status)==="running"))return;const Ge=bt.current.get(J.id),De=it.current&&(!Ge||Ge.status!=="running"&&Ge.updatedAt<=J.updatedAt);Re&&ve||De?Cr(!0):it.current||It.current.set(J.id,J)}});const xs=R.useCallback((J,ve="overview",Re="preview",Ge)=>{dr("open_experiment");const De={id:J,view:ve};Zt(at=>at.some(vt=>Rx(vt,De))?at:[...at,De]),Un(De,Re,Ge)},[Un]),ao=R.useCallback((J,ve="preview")=>{const Re=be.current.filter(De=>De.id===J||De.id.startsWith(J)),Ge=Re.length===1?Re[0]:null;Ge&&xs(Ge.experimentId,"terminal",ve,Ge.id)},[xs]),tf=R.useMemo(()=>new Map(Q.map(J=>{var ve;return[J.id,((ve=J.title)==null?void 0:ve.trim())||J.slug||Sl()]})),[Q,H]),Er=KR(tf),ci=R.useMemo(()=>{const J=new Map;for(const ve of we)J.set(ve.id,Er.get(ve.experimentId)??Sl());return J},[Er,we,H]),oo=KR(ci),lo=R.useCallback(J=>{const ve=oo.get(J);if(ve)return ve;const Re=[...oo].filter(([Ge])=>Ge.startsWith(J));return Re.length===1?Re[0][1]:""},[oo]),Xo=R.useCallback(J=>{const ve=Er.get(J);if(ve)return ve;const Re=[...Er].filter(([Ge])=>Ge.startsWith(J));return Re.length===1?Re[0][1]:""},[Er]),Ta=R.useCallback((J,ve="preview")=>{const Re=jt.current.filter(Ge=>Ge.id===J||Ge.id.startsWith(J));Re.length===1&&xs(Re[0].id,"overview",ve)},[xs]),bu=R.useCallback(J=>{const ve=vn.findIndex(Re=>Rx(Re,J));ve!==-1&&(Zt(Re=>Re.filter((Ge,De)=>De!==ve)),$r(J,Ct(b)===Ct(J)))},[vn,$r,b]),Ts=R.useCallback((J,ve="preview")=>{J.line!=null&&S(De=>De+1);const Re=Ni.current;if(Re){const De=Es(Re,os.current,J);Ci.current.fileTabs.some(at=>Gu(at,J))||w.current.delete(De),y.current.add(De)}const Ge=zO(J);fn(De=>{const at=De.findIndex(sn=>Gu(sn,J));if(at===-1)return[...De,Ge];const vt=De.slice();return vt[at]=Ge,vt}),Un(J,ve)},[Un]),ia=R.useCallback((J,ve,Re,Ge,De,at)=>{const vt=ee==null?void 0:ee.find(Gs=>Gs.id===n),sn=oDt(J,vt==null?void 0:vt.repoPath,ve,(vt==null?void 0:vt.artifactsDir)??(vt==null?void 0:vt.filesDir),vt==null?void 0:vt.slug);if(!sn)return null;const Fn=De?jt.current.find(Gs=>Gs.id===De||De.length>=6&&Gs.id.startsWith(De)):void 0,Da=Re??(Fn==null?void 0:Fn.branchName),fo=sn.source==null||sn.source==="repo";return Da&&fo&&(sn.ref=Da),at&&!sn.ref&&fo&&(sn.branchLabel=at),Ge!=null&&(sn.line=Ge),sn},[ee,n]),co=R.useCallback((J,ve,Re,Ge,De,at,vt="preview")=>{const sn=ia(J,ve,Re,Ge,De,at);sn&&Ts(sn,vt)},[Ts,ia]),yu=R.useCallback(J=>Ts({path:J,source:"artifacts"},"keepOpen"),[Ts]),nf=R.useCallback((J,ve,Re,Ge,De,at="preview")=>{const vt=ia(J,ve,De,Re,Ge);vt&&Ts(vt,at)},[Ts,ia]),ui=R.useCallback((J,ve)=>{Vr(J),ve()},[Vr]),xu=R.useCallback(J=>{var Ge;const ve=Kn.findIndex(De=>Gu(De,J));if(ve===-1)return;const Re=n?Es(n,u,J):null;Re&&((Ge=Vt.current.get(Re))!=null&&Ge.needsProtection)&&!DA(qE())||(fn(De=>De.filter((at,vt)=>vt!==ve)),Re&&(Nn.current.delete(Re),Vt.current.delete(Re),y.current.delete(Re),w.current.delete(Re),delete C.current[Re]),u===L0&&Gu(J,{path:w1,source:"artifacts"})&&Se(!1),$r(J,Ct(b)===Ct(J)))},[u,Kn,$r,n,b]),m_=R.useCallback(J=>{J.lineScrollRequest!==void 0&&m(J.lineScrollRequest)},[]),Aa=R.useCallback((J,ve,Re,Ge="preview")=>{const De={kind:"plan",sessionId:ve,promptId:Re,plan:J};Fe(at=>{const vt=at.findIndex(Fn=>Fn.promptId===Re);if(vt===-1)return[...at,De];const sn=at.slice();return sn[vt]=De,sn}),Un(De,Ge)},[Un]),g_=R.useCallback(J=>{const ve=At.findIndex(Re=>Re.promptId===J.promptId);ve!==-1&&(Fe(Re=>Re.filter((Ge,De)=>De!==ve)),$r(J,Ct(b)===Ct(J)))},[$r,At,b]),wu=R.useCallback((J,ve,Re,Ge="preview")=>{const De={kind:"subagent",sessionId:J,spawnPartId:ve,label:Re};cr(at=>at.some(vt=>vt.spawnPartId===ve)?at:[...at,De]),Un(De,Ge)},[Un]),rf=R.useCallback(J=>{const ve=_t.findIndex(Re=>Re.spawnPartId===J.spawnPartId);ve!==-1&&(cr(Re=>Re.filter((Ge,De)=>De!==ve)),$r(J,Ct(b)===Ct(J)))},[$r,b,_t]),Su=vDt(_t),ec=R.useCallback((J,ve,Re="files",Ge="preview")=>{const De={code:!0,experimentId:J,branch:ve,view:Re,toggled:new Set};Ut(at=>at.some(vt=>Bf(vt,De))?at.map(vt=>Bf(vt,De)?{...vt,experimentId:J,view:Re}:vt):[...at,De]),Un(De,Ge)},[Un]),ku=R.useCallback((J,ve)=>{Ut(Re=>Re.map(Ge=>Bf(Ge,J)?{...Ge,...ve}:Ge)),ve.view&&z(Rl({...J,...ve}))},[]),v_=R.useCallback(J=>{const ve=xn.findIndex(Re=>Bf(Re,J));ve!==-1&&(Ut(Re=>Re.filter((Ge,De)=>De!==ve)),$r(J,Ct(b)===Ct(J)))},[xn,$r,b]),sf=R.useCallback(()=>{kr(!0),ls("files")},[ls]),Zo=R.useCallback(J=>{J==="experiments"?$n(!1):J==="files"?kr(!1):un(!1),$r(J,b===J)},[$r,b]),af=J=>{J.preventDefault(),J.currentTarget.setPointerCapture(J.pointerId);const Re=document.body.style.userSelect;document.body.style.userSelect="none";const Ge=Dr,De=J.clientX,at=Pt;let vt=!1;function sn(){window.removeEventListener("pointermove",Fn),window.removeEventListener("pointerup",sn),window.removeEventListener("pointercancel",sn),document.body.style.userSelect=Re}function Fn(Da){if(Ge){const el=Da.clientX-De;if(vt||el<_Dt)return;vt=!0,Rn(!1);const lr=Math.min(Math.max(at,Hv),T0());ri(lr),window.removeEventListener("pointermove",Fn);return}const fo=Math.round(window.innerWidth-Da.clientX-cDt),Gs=T0();if(fo>Gs+hDt){Rn(!0);return}Rn(!1);const lf=Math.min(Math.max(fo,Hv),Gs);ri(lf)}window.addEventListener("pointermove",Fn),window.addEventListener("pointerup",sn),window.addEventListener("pointercancel",sn)},b_=(J,ve)=>{O(Re=>Re?VR(Re,J):[J]),s.navigate({href:`/projects/${encodeURIComponent(J.id)}${ve?"/settings/git":""}`}),ve&&Vn(ve,"error")},vs=typeof b=="object"&&"id"in b?b:null,jn=typeof b=="object"&&"path"in b?b:null,Cu=(jn==null?void 0:jn.source)==="artifacts"&&ut?xp(ut.entries,jn.path):null,y_=Cu?`${Cu.modifiedAt}:${Cu.size}`:null,aa=u===L0&&Ht?Kn.find(J=>Gu(J,{path:w1,source:"artifacts"})):void 0,of=aa?[aa]:[],cs=typeof b=="object"&&"kind"in b&&b.kind==="plan"?b:null,uo=cs==null?void 0:cs.sessionId,Jo=cs==null?void 0:cs.promptId,tc=!!(uo&&Jo&&(X!=null&&X.includes(uo))),Eu=ot({...Ol(uo??""),enabled:tc,subscribed:tc}),Ra=R.useMemo(()=>{var ve;if(!uo||!Jo||!Eu.data)return null;const J=Eu.data.messages.flatMap(Re=>{const Ge=ey(Re.parts,Jo);return Ge?[Ge]:[]})[0];return{key:`${uo}:${Jo}`,text:((ve=J==null?void 0:J.prompt)==null?void 0:ve.plan)??null}},[uo,Jo,Eu.data]),Kr=typeof b=="object"&&"kind"in b&&b.kind==="subagent"?b:null,nc=typeof b=="object"&&"code"in b?b:null,us=nc?xn.find(J=>Bf(J,nc))??null:null,rc=new Map;for(const J of[...vn,...Kn,...At,..._t,...xn])rc.set(Ct(J),J);const Nu=aa?Ct(aa):null,zu=ur.filter(J=>J!==Nu).map(J=>rc.get(J)).filter(_0t),Ma=J=>ki!==null&&Ct(ki)===Ct(J),se=J=>f.jsx(Rc,{active:jn!==null&&Gu(jn,J),label:J.path.split("/").pop()||J.path,icon:f.jsx(qO,{size:12,className:"shrink-0"}),preview:Ma(J),onSelect:()=>ls(J),onPromote:()=>Vr(J),onClose:()=>xu(J)},`file:${N6(J)}`),ye=vs?Q.find(J=>J.id===vs.id)??null:null,Te=us?Q.find(J=>J.id===us.experimentId&&J.branchName===us.branch)??null:null,$e=J=>{var Re,Ge;if("path"in J)return se(J);if("id"in J){const De=Q.find(at=>at.id===J.id);return f.jsx(Rc,{active:vs!==null&&Rx(vs,J),label:De?De.title||De.slug:"…",icon:J.view==="overview"?f.jsx(K0t,{size:12,className:"shrink-0"}):f.jsx($h,{size:12,className:"shrink-0"}),preview:Ma(J),onSelect:()=>ls(J),onPromote:()=>Vr(J),onClose:()=>bu(J)},Ct(J))}if("kind"in J&&J.kind==="plan")return f.jsx(Rc,{active:cs!==null&&cs.promptId===J.promptId,label:SD(),icon:f.jsx(L6,{size:12,className:"shrink-0"}),preview:Ma(J),onSelect:()=>ls(J),onPromote:()=>Vr(J),onClose:()=>g_(J)},Ct(J));if("kind"in J)return f.jsx(Rc,{active:Kr!==null&&Kr.spawnPartId===J.spawnPartId,label:((Re=Su[J.spawnPartId])==null?void 0:Re.label)??J.label??Hne(),shimmer:((Ge=Su[J.spawnPartId])==null?void 0:Ge.running)??!1,icon:f.jsx(I6,{size:12,className:"shrink-0"}),preview:Ma(J),onSelect:()=>ls(J),onPromote:()=>Vr(J),onClose:()=>rf(J)},Ct(J));const ve=Q.find(De=>De.id===J.experimentId);return f.jsx(Rc,{active:us!==null&&Bf(us,J),label:(ve==null?void 0:ve.slug)??J.branch,icon:f.jsx(Td,{size:12,className:"shrink-0"}),preview:Ma(J),onSelect:()=>ls(J),onPromote:()=>Vr(J),onClose:()=>v_(J)},Ct(J))};if(!a||a.kind==="resume")return null;if(q)return f.jsxs("div",{className:"app flex flex-col h-full",children:[f.jsxs("div",{className:w0,children:[f.jsx("p",{children:q}),f.jsx(Le,{variant:"primary",onClick:G,children:Fi()})]}),e.kind==="ssh"&&f.jsx(uv,{runtime:e,corner:!0})]});if(ee&&!pt)return f.jsxs("div",{className:w0,children:[Ka(),f.jsx(Le,{onClick:()=>$(null),children:ep()})]});if(nr&&!mr)return f.jsxs("div",{className:w0,children:[f.jsx("p",{role:"alert",children:nr}),f.jsx(Le,{onClick:Jd,children:Fi()})]});if(ee===null||L===null||!vu||X===null)return f.jsxs("div",{className:"app flex flex-col h-full",children:[f.jsx("div",{className:w0,children:f.jsx(Lt,{})}),e.kind==="ssh"&&f.jsx(uv,{runtime:e,corner:!0})]});if(!pt||(a==null?void 0:a.kind)==="task"&&u&&!(X!=null&&X.includes(u)))return f.jsxs("div",{className:w0,children:[Ka(),f.jsx(Le,{onClick:()=>$(null),children:ep()})]});const Ue=f.jsx(DEt,{projectName:((wn=ee.find(J=>J.id===n))==null?void 0:wn.name)??"",onHome:()=>void s.navigate({to:"/projects"}),onNewProject:()=>gs(!0),onRepository:()=>na("git"),onCollapse:()=>ta(!1)});return f.jsxs("div",{className:"app flex flex-col h-full",children:[e.kind==="local"&&f.jsx(iI,{}),e.kind==="local"&&f.jsx(uI,{status:Y}),nr&&f.jsxs("div",{role:"alert",className:"flex items-center gap-2 px-4 py-2 text-subtext",children:[f.jsx("span",{children:nr}),f.jsx(Le,{onClick:Jd,children:Fi()})]}),f.jsxs("div",{className:`app-body workspace-body relative flex flex-1 min-h-0 py-0 px-3.5 ${as?"workspace-card-visible":""}`,children:[n&&f.jsx(g9t,{projectId:n,projectName:(pt==null?void 0:pt.name)??"",railHeader:Ue,railOpen:ii,onShowRail:()=>ta(!0),mainView:o,onSelectMainView:na,onOpenFile:nf,onOpenRun:ao,runExperimentName:lo,onOpenExperiment:Ta,experimentName:Xo,onOpenPlan:Aa,onOpenSubagent:wu,composerPrefill:pt&&Ic(pt.id)&&(L==null?void 0:L.tourCompleted)===!1?tut:null,runtime:e,onOpenDemoWelcome:pt&&Ic(pt.id)?io:void 0,activeSessionId:u,onActiveSessionChange:Xl,preferredAgent:L.preferredAgent,onPreferredAgentChange:oe,children:o==="skills"?f.jsx(nEt,{}):o!=="chat"?f.jsx(P8t,{remote:e.kind==="ssh",tab:o,project:pt,onProjectUpdate:J=>{O(ve=>ve?VR(ve,J):[J])},onSelectTab:na}):null}),o==="chat"&&f.jsx(zyt,{expanded:as,experiments:Q,runs:we,onOpenExperiment:(J,ve)=>xs(J,"overview","preview",ve),rightOffset:_?Pt+28:void 0,activeView:_&&(b==="files"||b==="artifacts"||b==="experiments")?b:null,projectId:pt.id,onCompute:()=>na("compute"),sessionId:u,busy:((Sn=V.data)==null?void 0:Sn.some(J=>J.id===u&&J.busy))??!1,onChanges:()=>{zs("changes"),sf()},onFiles:()=>{zs("files"),sf()},onArtifacts:zi,onExperiments:()=>Cr()}),o==="chat"&&_&&f.jsxs("aside",{className:`right-pane relative shrink-0 min-w-0 flex flex-col mt-5 me-0 mb-5 ms-3.5 bg-canvas [&.max]:fixed [&.max]:inset-2.5 [&.max]:m-0 [&.max]:z-60 [&.max]:shadow-panel-max border border-border rounded-lg overflow-hidden shadow-elevated ${Dr?"max":""}`,style:Dr?void 0:{width:Pt},"data-onboarding":"experiments",children:[f.jsx("div",{className:`panel-resizer absolute start-0 top-0 bottom-0 w-1.5 z-30 [&:hover]:bg-resizer-hover [&:active]:bg-resizer-hover ${Dr?"cursor-e-resize":"cursor-col-resize"}`,title:Dr?Lte():Ate(),onPointerDown:af}),f.jsxs("div",{className:"tabs flex items-end gap-0 pt-1 pe-1.5 pb-0 ps-2 h-10 border-b border-b-border bg-background shrink-0",children:[f.jsxs("div",{className:"tab-strip flex items-end gap-0.5 flex-1 min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[of.map(se),Wr&&f.jsx(Rc,{active:b==="files",label:k4(),icon:f.jsx(Td,{size:12,className:"shrink-0"}),onSelect:()=>ls("files"),onClose:()=>Zo("files")}),gt&&f.jsx(Rc,{active:b==="artifacts",label:pD(),icon:f.jsx(M6,{size:12,className:"shrink-0"}),onSelect:()=>ls("artifacts"),onClose:()=>Zo("artifacts")}),Sr&&f.jsx(Rc,{active:b==="experiments",label:mD(),icon:f.jsx(ub,{size:12,className:"shrink-0"}),onSelect:()=>ls("experiments"),onClose:()=>Zo("experiments")}),zu.map($e)]}),f.jsxs("div",{className:"panel-controls inline-flex items-center gap-0.5 self-center py-0 px-1.5 shrink-0",children:[f.jsx(Yt,{title:Dr?oE():aE(),"aria-label":Dr?oE():aE(),onClick:()=>Rn(J=>!J),children:Dr?f.jsx(Xpt,{size:14}):f.jsx(Kpt,{size:14})}),f.jsx(Yt,{title:ev(),"aria-label":ev(),onClick:()=>{I(),Rn(!1)},children:f.jsx(qr,{size:14})})]})]}),!mr||((t==null?void 0:t.kind)==="experiment"||(t==null?void 0:t.kind)==="code")&&!le||(t==null?void 0:t.kind)==="experiment"&&t.runId&&!ae?f.jsx($a,{children:f.jsx(Lt,{})}):vs&&(!ye||d&&!we.some(J=>J.id===d&&J.experimentId===vs.id))||nc&&!Te||t&&"sessionId"in t&&t.sessionId&&!(X!=null&&X.includes(t.sessionId))?f.jsx($a,{children:f.jsx("div",{className:"p-6 text-subtext",children:Ka()})}):b==="artifacts"?f.jsx($a,{children:pt&&f.jsx(V9t,{project:pt,artifacts:ut,onOpenFile:yu,canRenameFile:J=>{var ve;return!((ve=Vt.current.get(Es(pt.id,u,{path:J,source:"artifacts"})))!=null&&ve.needsProtection)}},pt.id)}):b==="experiments"?f.jsxs($a,{children:[f.jsxs("div",{className:"pane-toolbar flex shrink-0 flex-wrap items-center gap-2 bg-background px-3 pt-2.5 pb-2",children:[f.jsx("span",{className:"flex-1"}),f.jsxs("div",{className:"experiments-toolbar-controls inline-flex items-center gap-[5px]",children:[f.jsxs("div",{className:"option-picker relative inline-flex",ref:ln,children:[f.jsx(Yt,{size:"small",ref:en,className:"experiment-scope-trigger",active:Mt==="agent",title:Gte({scope:Mt==="agent"?sE():iE()}),"aria-label":ine(),"aria-expanded":Ve,onClick:()=>qt(J=>!J),children:f.jsx(jpt,{size:16,strokeWidth:2.5})}),Ve&&f.jsxs("div",{className:"option-menu absolute bottom-[calc(100%_+_8px)] start-0 max-h-95 flex flex-col bg-background border border-border rounded-lg shadow-menu z-50 overflow-hidden min-w-47.5 p-1.5 [&.align-right]:start-auto [&.align-right]:end-0 [&.drop-down]:bottom-auto [&.drop-down]:top-[calc(100%_+_4px)] [&.session-menu]:start-auto [&.session-menu]:end-1.5 [&.session-menu]:top-[calc(100%_-_2px)] [&.session-menu]:min-w-35 drop-down align-right experiment-scope-menu [&_.model-item]:whitespace-nowrap [&_.model-item:disabled]:text-muted [&_.model-item:disabled]:cursor-default [&_.model-item:disabled:hover]:bg-transparent",children:[f.jsxs(ir,{"aria-pressed":Mt==="agent",disabled:!u||!cn,title:u?cn?void 0:cne():gne(),onClick:()=>{wt("agent"),qt(!1)},children:[f.jsx("span",{children:sE()}),Mt==="agent"&&f.jsx(wa,{size:13})]}),f.jsxs(ir,{"aria-pressed":Mt==="project",onClick:()=>{wt("project"),qt(!1)},children:[f.jsx("span",{children:iE()}),Mt==="project"&&f.jsx(wa,{size:13})]})]})]}),f.jsxs("div",{className:"seg inline-flex items-center gap-0.5 rounded-md bg-hover-subtle [&_button]:font-medium [&_button]:text-text [&_button]:rounded-sm [&_button:not(:disabled):hover]:text-text [&_button.active]:bg-background [&_button.active]:shadow-segment [&_button:disabled]:text-muted [&_button:disabled]:cursor-default experiments-view-toggle p-0.5 [&_button]:py-0.5 [&_button]:px-2 [&_button]:text-sm",role:"group","aria-label":Qte(),children:[f.jsx("button",{className:Ae==="table"?"active":"","aria-pressed":Ae==="table",onClick:()=>Ze("table"),children:Wne()}),f.jsx("button",{className:Ae==="tree"?"active":"","aria-pressed":Ae==="tree",onClick:()=>Ze("tree"),children:Yne()})]})]})]}),f.jsx("div",{className:"pane-content flex-1 min-h-0 relative bg-background",children:Ae==="tree"?pt&&f.jsx(iDt,{experiments:Q,runs:tn,project:pt,onOpenView:xs,onOpenCode:ec,agentSessionId:Mt==="agent"?u:null,onShowProjectScope:Mr,viewport:Ps,onViewportChange:Xe}):f.jsx(LEt,{runs:tn,emptyHint:Mt==="agent"&&Q.length>0?hne():void 0,experiments:er,onOpen:(J,ve)=>{xs(J.id,"overview",ve)},onOpenLogs:(J,ve,Re)=>{xs(J,"terminal",Re,ve)},onOpenCode:(J,ve)=>{const Re=Q.find(Ge=>Ge.id===J);Re&&ec(Re.id,Re.branchName,"files",ve)},onCancel:ML})})]}):b==="files"?f.jsx($a,{children:pt?f.jsx(L9t,{sessionId:u??void 0,project:pt,view:ro,toggled:Na,onViewChange:zs,onToggledChange:rn,canRenameFile:J=>{var ve;return!((ve=Vt.current.get(Es(pt.id,u,{path:J,source:"repo",sessionId:u??void 0})))!=null&&ve.needsProtection)},onOpenFile:(J,ve,Re,Ge)=>co(J,ve,Re,void 0,void 0,void 0,Ge)},`files:${u??`project:${pt.id}`}`):f.jsx("div",{className:"code-tab flex flex-col h-full min-h-0 wt-tab",children:f.jsx(dh,{children:f.jsxs("div",{className:"wt-empty flex flex-col items-center gap-2.5 py-12 px-6 text-center text-muted [&_>_svg]:text-subtext [&_p]:m-0 [&_p]:max-w-80 [&_p]:text-sm",children:[f.jsx(UO,{size:22}),f.jsx("p",{children:Tne()})]})})})}):jn?f.jsx($a,{children:n&&f.jsx(MEt,{remote:e.kind==="ssh",restored:w.current.has(Es(n,u,jn)),onRestoreActivated:()=>{const J=Es(n,u,jn);w.current.delete(J),y.current.add(J)},showSource:C.current[Es(n,u,jn)]??!1,onShowSourceChange:J=>{C.current[Es(n,u,jn)]=J,N(ve=>ve+1)},projectId:n,path:jn.path,source:jn.source,sessionId:jn.source==="artifacts"?u??void 0:jn.sessionId,gitRef:jn.ref,line:jn.line,branchLabel:lDt(jn,pt==null?void 0:pt.baselineBranch),artifactVersion:y_,artifactEntries:jn.source==="artifacts"?ut==null?void 0:ut.entries:void 0,bufferSession:xt(Es(n,u,jn)),onOpenFile:(J,ve,Re,Ge)=>ui(jn,()=>co(J,ve,Re,void 0,void 0,void 0,Ge)),scrollPosition:Nn.current.get(Es(n,u,jn)),onScrollPositionChange:J=>{Nn.current.set(Es(n,u,jn),J),ra()},lineScrollRequest:jn.lineScrollRequest,onLineScrollRequestHandled:()=>m_(jn),onEdit:()=>Vr(jn)},Es(n,u,jn))}):cs?f.jsx($a,{children:f.jsx("div",{className:"pane-content flex-1 min-h-0 relative plan-tab-content overflow-y-auto bg-background py-4.5 px-6 [&_.md]:max-w-readable",children:f.jsx($o,{text:(Ra==null?void 0:Ra.key)===`${cs.sessionId}:${cs.promptId}`?Ra.text??Ka():((Nr=At.find(J=>J.promptId===cs.promptId))==null?void 0:Nr.plan)||gD(),onOpenFile:(J,ve,Re,Ge,De)=>ui(cs,()=>co(J,cs.sessionId,Ge,ve,Re,void 0,De))})})}):Kr?f.jsx(y9t,{sessionId:Kr.sessionId,spawnPartId:Kr.spawnPartId,onOpenFile:(J,ve,Re,Ge,De)=>ui(Kr,()=>nf(J,Kr.sessionId,ve,Re,Ge,De)),onOpenRun:(J,ve)=>ui(Kr,()=>ao(J,ve)),runExperimentName:lo,onOpenExperiment:(J,ve)=>ui(Kr,()=>Ta(J,ve)),experimentName:Xo,onOpenSubagent:(J,ve,Re)=>ui(Kr,()=>wu(Kr.sessionId,J,ve,Re))},Kr.spawnPartId):us?f.jsx($a,{children:n&&pt&&us&&Te&&f.jsx(D9t,{projectId:n,project:pt,experiment:Te,view:us.view,toggled:us.toggled,onViewChange:J=>ku(us,{view:J}),onToggledChange:J=>ku(us,{toggled:J}),onOpenFile:(J,ve,Re,Ge)=>ui(us,()=>co(J,ve,Re,void 0,void 0,Te.branchName,Ge))},`code:${us.branch}`)}):f.jsx($a,{children:vs&&ye&&pt&&f.jsx(oEt,{experiment:ye,project:pt,view:vs.view,runs:we,selectedRunId:d,onSelectRun:B,parentExperiment:Q.find(J=>J.id===ye.parentExperimentId)??null,onOpenView:(J,ve,Re)=>{ui(vs,()=>xs(ye.id,J,Re,ve))},onOpenCode:(J,ve)=>ui(vs,()=>ec(ye.id,ye.branchName,J,ve))},`${vs.id}:${vs.view}`)})]})]}),Yl&&f.jsx(sI,{remote:e.kind==="ssh",onClose:()=>gs(!1),onCreated:(J,ve)=>{gs(!1),b_(J,ve)}}),so&&pt&&Ic(pt.id)&&f.jsx(OEt,{onClose:Yo,onCreateProject:za})]})}const N5=Fo()({validateSearch:e=>({pane:C6(e.pane)}),beforeLoad:({location:e})=>{if(!zd(e.pathname))throw pW()},component:xDt});function xDt(){const{projectId:e}=N5.useParams(),{pane:n}=N5.useSearch(),t=ei(),r=sD({select:s=>s.location});return R.useEffect(()=>{const s=wDt(r.searchStr);s!==null&&t.navigate({href:`${r.pathname}${s}${r.hash?`#${r.hash}`:""}`,replace:!0})},[r,t]),f.jsxs(f.Fragment,{children:[f.jsx(X0,{}),f.jsx(yDt,{projectId:e,pane:n,runtime:AO()},e)]})}function wDt(e){const n=new URLSearchParams(e);if(!n.has("pane"))return null;try{if(n.getAll("pane").length===1&&C6(JSON.parse(n.get("pane")??"")))return null}catch{}n.delete("pane");const t=n.toString();return t?`?${t}`:""}const Mq=Fo()({component:SDt});function SDt(){const{projectId:e}=Mq.useParams();return f.jsx(pgt,{projectId:e})}const kDt=Fo()({}),CDt=Fo()({}),EDt=Fo()({}),NDt=Fo()({}),zDt=ggt.update({id:"/",path:"/",getParentRoute:()=>ob}),Hk=vgt.update({id:"/projects",path:"/projects",getParentRoute:()=>ob}),jDt=bgt.update({id:"/remote-launch",path:"/remote-launch",getParentRoute:()=>ob}),TDt=ygt.update({id:"/",path:"/",getParentRoute:()=>Hk}),p_=N5.update({id:"/$projectId",path:"/$projectId",getParentRoute:()=>Hk}),ADt=Mq.update({id:"/",path:"/",getParentRoute:()=>p_}),RDt=kDt.update({id:"/skills",path:"/skills",getParentRoute:()=>p_}),MDt=CDt.update({id:"/settings/$tab",path:"/settings/$tab",getParentRoute:()=>p_}),DDt=EDt.update({id:"/tasks/$sessionId",path:"/tasks/$sessionId",getParentRoute:()=>p_}),LDt=NDt.update({id:"/tasks/new",path:"/tasks/new",getParentRoute:()=>p_}),ODt={ProjectsProjectIdSkillsRoute:RDt,ProjectsProjectIdIndexRoute:ADt,ProjectsProjectIdSettingsTabRoute:MDt,ProjectsProjectIdTasksSessionIdRoute:DDt,ProjectsProjectIdTasksNewRoute:LDt},IDt=p_._addFileChildren(ODt),BDt={ProjectsProjectIdRoute:IDt,ProjectsIndexRoute:TDt},$Dt=Hk._addFileChildren(BDt),PDt={IndexRoute:zDt,ProjectsRoute:$Dt,RemoteLaunchRoute:jDt},FDt=ob._addFileChildren(PDt)._addFileTypes(),HDt=IV({routeTree:FDt,context:{queryClient:tt},trailingSlash:"never",defaultPendingComponent:F6,defaultErrorComponent:H6,defaultNotFoundComponent:hgt}),qDt=j();document.documentElement.lang=qDt;document.documentElement.dir="ltr";GG.createRoot(document.getElementById("root")).render(f.jsxs(R.StrictMode,{children:[f.jsx(iG,{client:tt,children:f.jsx(PV,{router:HDt})}),f.jsx(Q_t,{})]})); diff --git a/ui/dist/index.html b/ui/dist/index.html index 67ca3bd1..5ecd77cc 100644 --- a/ui/dist/index.html +++ b/ui/dist/index.html @@ -49,7 +49,7 @@ html { background: #ffffff; } html[data-theme="dark"] { background: #0e0c0c; } - + diff --git a/ui/src/App.tsx b/ui/src/App.tsx index b8538a5f..cdb0f567 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -1,12 +1,10 @@ import { - setScopedQueryData, queryClient, } from "./queries/client"; import { useMutation, useQuery } from "@tanstack/react-query"; import type { Viewport } from "@xyflow/react"; import { - type SetStateAction, useCallback, useEffect, useLayoutEffect, @@ -15,8 +13,8 @@ import { useState, } from "react"; -import { listChatSessionsQuery, getChatMessagesQuery } from "./queries/chat"; -import { listProjectsQuery, getUiStateQuery, listRunsQuery, listExperimentsQuery } from "./queries/projects"; +import { getChatMessagesQuery } from "./queries/chat"; +import { listRunsQuery, listExperimentsQuery } from "./queries/projects"; import { getArtifactsQuery } from "./queries/files"; import { useBlocker, useRouter, useRouterState } from "@tanstack/react-router"; import { @@ -88,16 +86,12 @@ import { type FirstAction, openProject, updateUiState, - type AgentSelection, type Project, type RuntimeInfo, type Run, - type ChatMessage, - type UiState, } from "./api"; import { WorkspaceTools } from "./components/WorkspaceTools"; -import { ChatPanel, findPartById, spawnRowTitle } from "./components/ChatPanel"; -import { usePopover } from "./components/ModelPicker"; +import { ChatPanel, findPartById } from "./components/ChatPanel"; import { SubagentTab } from "./components/SubagentTab"; import { CodeTab, type CodeView } from "./components/CodeTab"; import { WorktreeTab, type WorktreeView } from "./components/WorktreeTab"; @@ -116,11 +110,27 @@ import { Md } from "./components/Md"; import { SettingsView, type SettingsTab } from "./components/SettingsPage"; import { DemoWelcomeModal } from "./components/Tour"; import { TreeView } from "./components/TreeView"; -import { onChatEvent, useOrxEvents } from "./events"; +import { useOrxEvents } from "./events"; import { closeTab, openTab, type TabOpenIntent } from "./tabPreview"; import { Button, IconButton, MenuItem, showAlert, Spinner } from "./components/ui"; import { CodeTabBody, TabBody } from "./components/layout/TabBody"; import { RemoteStatus } from "./components/RemoteStatus"; +import { parseFilePath, fileBranchLabel } from "./filePathResolution"; +import { + PANEL_MIN_WIDTH, + PANEL_MARGIN, + WORKSPACE_CARD_MIN_WIDTH, + FULLSCREEN_SNAP_SLOP, + FULLSCREEN_RESTORE_DRAG, + panelMaxWidth, + initialPanelWidth, +} from "./panelSizing"; +import { upsertById } from "./listUpsert"; +import { useStableStringMap } from "./useStableStringMap"; +import { useAppData } from "./useAppData"; +import { useExperimentScope } from "./useExperimentScope"; +import { useSpawnTabMeta } from "./useSpawnTabMeta"; +import { usePreferredAgent } from "./usePreferredAgent"; const EMPTY_STATE_CLASS_NAME = [ "empty-state absolute inset-0 flex flex-col items-center", @@ -131,138 +141,6 @@ const EMPTY_STATE_CLASS_NAME = [ "[&_p.empty-state-hint]:text-lg [&_p.empty-state-hint]:text-subtext", ].join(" "); -/** Escape a string for literal use inside a RegExp. */ -function escapeRegExp(s: string): string { - return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); -} - -// Map a path an agent reported to a right-pane file tab. An artifact path under -// the compatibility /files// layout is stripped to a relative -// path and tagged source:"artifacts". Otherwise it's a repo/worktree path stripped to -// repo-relative, keeping the session id when it points into a per-session -// worktree. Relative paths name files in the click context's checkout and -// inherit `contextSessionId`; the regex fallbacks encode the -// managed storage layouts from src/local/git.rs: -// worktrees///… and the legacy repos///…. -function parseFilePath( - rawPath: string, - repoPath?: string, - contextSessionId?: string, - artifactsDir?: string, - slug?: string, -): FileViewDef | null { - let path = rawPath; - let sessionId: string | undefined; - const clone = repoPath?.replace(/\/+$/, ""); - const artifacts = artifactsDir?.replace(/\/+$/, ""); - if (path.startsWith("artifacts/")) { - path = path.slice("artifacts/".length); - return path ? { path, source: "artifacts" } : null; - } - // A home-anchored path (`~` or `~/…`) is disk, never a repo file — the backend - // expands the `~`, so hand it over verbatim. - if (path === "~" || path.startsWith("~/")) return { path, source: "abs" }; - // `path` relative to `base` (`""` when equal), else null. macOS symlinks - // `/tmp`→`/private/tmp` and `/var`→`/private/var`, so an agent-inlined path - // and the stored dir can differ only by that prefix — strip it on both sides. - const relUnder = (base: string): string | null => { - const strip = (p: string) => p.replace(/^\/private(?=\/(?:tmp|var)(?:\/|$))/, ""); - const [p, b] = [strip(path), strip(base)]; - if (p === b) return ""; - return p.startsWith(`${b}/`) ? p.slice(b.length).replace(/^\/+/, "") : null; - }; - // A relative path names a file in the click context's checkout; the absolute - // branches below are keyed off the (non-canonical) stored dirs. - const artifactRel = path.startsWith("/") && artifacts ? relUnder(artifacts) : null; - const cloneRel = path.startsWith("/") && clone ? relUnder(clone) : null; - if (!path.startsWith("/")) { - sessionId = contextSessionId; - } else if (artifactRel !== null) { - // Artifact — prefix match against the non-canonical dir the backend - // surfaced, which mirrors what the agent inlines. - return artifactRel ? { path: artifactRel, source: "artifacts" } : null; - } else if (cloneRel !== null) { - path = cloneRel; - } else { - // Artifact fallback for a symlink-divergent path (e.g. /tmp vs - // /private/tmp) where the exact prefix missed: match the …/files// - // layout, requiring the slug segment when we know it. (Legacy artifacts/ is - // migrated to files/ in place, so it never appears in a live path.) - const slugPat = slug ? escapeRegExp(slug) : "[^/]+"; - const fd = path.match(new RegExp(`/files/${slugPat}/(.+)$`)); - const wt = fd ? null : path.match(/\/openresearch\/worktrees\/[^/]+\/([^/]+)\/(.+)$/); - const hub = fd || wt ? null : path.match(/\/openresearch\/repos\/[^/]+\/[^/]+\/(.+)$/); - if (fd) { - return { path: fd[1], source: "artifacts" }; - } else if (wt) { - sessionId = wt[1]; - path = wt[2]; - } else if (hub) { - path = hub[1]; - } - } - if (!path) return null; - // An absolute path none of the checkout/artifacts branches recognized (e.g. - // /Users/me/.ssh/config) reads straight off disk — the repo /file endpoint - // only takes repo-relative paths and would reject it. - if (path.startsWith("/")) return { path, source: "abs" }; - return { path, sessionId }; -} - -/** The git branch a code file tab is showing, for the header pill — a cited - * experiment's branch (or any ref view) names that branch, and a worktree/clone - * file falls back to the baseline branch, so a code tab always says which - * branch its contents came from. Artifacts and absolute-path files have no - * branch. */ -function fileBranchLabel(tab: FileViewDef, baselineBranch?: string): string | undefined { - if (tab.source === "artifacts" || tab.source === "abs") return undefined; - return tab.ref ?? tab.branchLabel ?? baselineBranch; -} - -type ExperimentsView = "tree" | "table"; - -/** Floating panel sizing: keep both the panel and the chat column usable. */ -const PANEL_MIN_WIDTH = 360; -const PANEL_MARGIN = 10; -const WORKSPACE_CARD_MIN_WIDTH = 1448; // 1420px content plus the body’s 14px gutters. -// Space the rest of the layout needs beside the panel: the 272px rail, the -// chat column's minimum, and the gutters/margins between the three columns -// (app-body padding 14×2, rail inner margin 14, end-pane inner margin 14). -const RAIL_WIDTH = 272; -const CHAT_MIN_SPACE = 380; -const LAYOUT_CHROME = RAIL_WIDTH + 14 * 4; -// Once a drag pushes the panel past its usable max by this much, it snaps to -// fullscreen — a bit of resistance you have to overcome deliberately. -const FULLSCREEN_SNAP_SLOP = 80; -// Inward drag needed before snapping back to the last non-fullscreen width. -const FULLSCREEN_RESTORE_DRAG = 48; - -/** The widest the floating panel can be while leaving the rail + chat usable. */ -function panelMaxWidth(): number { - return Math.max(PANEL_MIN_WIDTH, window.innerWidth - LAYOUT_CHROME - CHAT_MIN_SPACE); -} - -function initialPanelWidth(): number { - const max = panelMaxWidth(); - return Math.max(PANEL_MIN_WIDTH, Math.min(760, max, Math.round(window.innerWidth * 0.4))); -} - -function upsert(list: T[], item: T): T[] { - const i = list.findIndex((x) => x.id === item.id); - if (i < 0) return [...list, item]; - const next = list.slice(); - next[i] = item; - return next; -} - -function useStableStringMap(next: Map): Map { - const current = useRef(next); - const unchanged = current.current.size === next.size - && [...next].every(([key, value]) => current.current.get(key) === value); - if (!unchanged) current.current = next; - return current.current; -} - export default function App({ runtime, projectId, pane }: { runtime: RuntimeInfo; projectId: string; pane?: Pane }) { const updateUiStateMutation = useMutation({ mutationFn: updateUiState }); @@ -284,8 +162,6 @@ export default function App({ runtime, projectId, pane }: { runtime: RuntimeInfo return typeof tab === "object" && "path" in tab && tab.line && consumedLine !== lineVisit.current.value ? { ...tab, lineScrollRequest: lineVisit.current.value } : tab; }, [pane, consumedLine, location.href, lineJump]); - const sessionsQuery = useQuery(listChatSessionsQuery(projectId)); - const sessions = useMemo(() => sessionsQuery.data?.map((session) => session.id) ?? null, [sessionsQuery.data]); const restoredFilesRef = useRef(new Set()); const intentionalFilesRef = useRef(new Set()); const sourceModesRef = useRef>({}); @@ -317,35 +193,18 @@ export default function App({ runtime, projectId, pane }: { runtime: RuntimeInfo const locale = useLocale(); const { status: updateStatus } = useUpdateStatus(runtime.kind === "local"); - const projectsOptions = useMemo(() => listProjectsQuery(), [projectId]); - const projectsQuery = useQuery(projectsOptions); - const projects = projectsQuery.data ?? null; - const setProjects = useCallback((value: SetStateAction) => { - setScopedQueryData(projectsOptions.queryKey, (current) => { - const next = typeof value === "function" ? value(current ?? null) : value; - return next ?? undefined; - }); - }, [projectsOptions]); - const uiStateOptions = useMemo(() => getUiStateQuery(), [projectId]); - const uiStateQuery = useQuery(uiStateOptions); - const uiState = uiStateQuery.data ?? null; - const setUiState = useCallback((value: SetStateAction) => { - setScopedQueryData(uiStateOptions.queryKey, (current) => { - const next = typeof value === "function" ? value(current ?? null) : value; - return next ?? undefined; - }); - }, [uiStateOptions]); + const { + sessionsQuery, sessions, + projects, setProjects, + uiState, setUiState, + startupError, loadInitialState, + } = useAppData(projectId, locale); const tourCompletedRef = useRef(undefined); tourCompletedRef.current = uiState?.tourCompleted; - const failedStartupItems = [ - !sessionsQuery.data && sessionsQuery.error ? m.chat_all_sessions() : null, - !projectsQuery.data && projectsQuery.error ? m.app_projects() : null, - !uiStateQuery.data && uiStateQuery.error ? m.app_settings() : null, - ].filter((item) => item !== null); - const startupError = failedStartupItems.length - ? m.app_startup_load_failed({ items: new Intl.ListFormat(locale).format(failedStartupItems) }) - : null; - const persistedPreferredAgent = useRef(null); + const { persistedPreferredAgent, persistPreferredAgent } = usePreferredAgent( + setUiState, + useCallback((patch) => updateUiStateMutation.mutateAsync(patch), [updateUiStateMutation]), + ); const experimentsQuery = useQuery(listExperimentsQuery(projectId)); const experiments = experimentsQuery.data ?? []; const experimentDataReady = !experimentsQuery.isPending; @@ -370,26 +229,15 @@ export default function App({ runtime, projectId, pane }: { runtime: RuntimeInfo const artifactsQuery = useQuery(getArtifactsQuery(projectId)); const artifacts = artifactsQuery.data ?? null; - const [view, setView] = useState("table"); - // Experiments pane scope: "agent" narrows to the open chat session's work. - // Falls back to "project" whenever there is no usable experiment attribution. - const [scope, setScope] = useState<"agent" | "project">("project"); - const scopeTriggerRef = useRef(null); - const { open: scopeMenuOpen, setOpen: setScopeMenuOpen, ref: scopeMenuRef } = - usePopover(scopeTriggerRef); const [demoOverviewLeading, setDemoOverviewLeading] = useState(false); - const allExperimentsAttributed = experiments.every((experiment) => experiment.chatSessionId); - const effectiveScope = activeSessionId && allExperimentsAttributed ? scope : "project"; - const scopedExperiments = useMemo(() => { - if (effectiveScope !== "agent") return experiments; - return experiments.filter((experiment) => experiment.chatSessionId === activeSessionId); - }, [experiments, effectiveScope, activeSessionId]); - // Runs are scoped by their experiment's owner, not by which session launched them. - const scopedRuns = useMemo(() => { - if (effectiveScope !== "agent") return runs; - const mine = new Set(scopedExperiments.map((experiment) => experiment.id)); - return runs.filter((r) => mine.has(r.experimentId)); - }, [runs, scopedExperiments, effectiveScope]); + const { + view, setView, + scope, setScope, + scopeTriggerRef, scopeMenuOpen, setScopeMenuOpen, scopeMenuRef, + allExperimentsAttributed, effectiveScope, + scopedExperiments, scopedRuns, + showProjectScope, + } = useExperimentScope(experiments, runs, activeSessionId); // Right-panel tab strip: closable home and working tabs. The same experiment // can keep both its overview and terminal open. @@ -751,11 +599,6 @@ export default function App({ runtime, projectId, pane }: { runtime: RuntimeInfo navigatePane({ kind: "home", view: "experiments" }, replace); }, [navigatePane, reportFirstAction]); - const loadInitialState = () => { - void projectsQuery.refetch(); - void uiStateQuery.refetch(); - void sessionsQuery.refetch(); - }; const preferencesLoaded = useRef(false); useEffect(() => { if (!uiState || preferencesLoaded.current) return; @@ -772,31 +615,6 @@ export default function App({ runtime, projectId, pane }: { runtime: RuntimeInfo if (sessions && rememberedSessionRef.current && !sessions.includes(rememberedSessionRef.current)) rememberedSessionRef.current = null; }, [sessions]); - const preferredAgentWrite = useRef>(Promise.resolve()); - const preferredAgentSaveSeq = useRef(0); - const persistPreferredAgent = useCallback((selection: AgentSelection) => { - const saveSeq = ++preferredAgentSaveSeq.current; - setUiState((current) => current && { ...current, preferredAgent: selection }); - const write = preferredAgentWrite.current - .then(() => updateUiStateMutation.mutateAsync({ preferredAgent: selection })) - .then((saved) => { - persistedPreferredAgent.current = saved.preferredAgent; - if (saveSeq === preferredAgentSaveSeq.current) { - setUiState((current) => current && { ...current, preferredAgent: saved.preferredAgent }); - } - }) - .catch((error: unknown) => { - if (saveSeq === preferredAgentSaveSeq.current) { - setUiState((current) => - current && { ...current, preferredAgent: persistedPreferredAgent.current }, - ); - } - throw error; - }); - preferredAgentWrite.current = write.catch(() => {}); - return write; - }, []); - // Shrinking the window can push a fixed-width panel past its usable max — // reclamp so it never overflows the viewport. useEffect(() => { @@ -896,10 +714,6 @@ export default function App({ runtime, projectId, pane }: { runtime: RuntimeInfo }, }); - // Stable identity: in TreeView's layout-memo deps, so an inline arrow would - // recompute the graph on every render. - const showProjectScope = useCallback(() => setScope("project"), []); - // Open an experiment view as a right-panel tab (creating it if needed) and // focus it. const openExperimentTab = useCallback(( @@ -1179,76 +993,7 @@ export default function App({ runtime, projectId, pane }: { runtime: RuntimeInfo [forgetRightTab, rightTab, subagentTabs], ); - // Live title + running state for open sub-agent tabs, straight off the spawn - // parts' message stream — so a tab is named for its task and shimmers while - // the agent still works (the open-time `label` is only the seed/fallback). - const [spawnMeta, setSpawnMeta] = useState>({}); - useEffect(() => { - // Closed tabs drop their metadata — the map only ever holds open tabs. - setSpawnMeta((prev) => { - const open = new Set(subagentTabs.map((t) => t.spawnPartId)); - if (Object.keys(prev).every((id) => open.has(id))) return prev; - return Object.fromEntries(Object.entries(prev).filter(([id]) => open.has(id))); - }); - if (subagentTabs.length === 0) return; - let live = true; - // Spawn ids a live event already updated: the initial fetch can resolve - // AFTER newer stream frames and must not roll those tabs back (a stale - // `running` snapshot would shimmer forever). - const liveUpdated = new Set(); - const apply = (msgs: ChatMessage[], tabs: SubagentViewDef[], fromSeed: boolean) => { - setSpawnMeta((prev) => { - let next = prev; - for (const t of tabs) { - if (fromSeed && liveUpdated.has(t.spawnPartId)) continue; - for (const m of msgs) { - const part = findPartById(m.parts, t.spawnPartId); - if (!part) continue; - if (!fromSeed) liveUpdated.add(t.spawnPartId); - const meta = { label: spawnRowTitle(part), running: part.state?.status === "running" }; - const cur = next[t.spawnPartId]; - if (!cur || cur.label !== meta.label || cur.running !== meta.running) { - if (next === prev) next = { ...prev }; - next[t.spawnPartId] = meta; - } - break; - } - } - return next; - }); - }; - // Generation token: a reconnect starts fresh seeds, and a stale in-flight - // response from an earlier generation must not land after them. - let seedGen = 0; - const seed = () => { - const gen = ++seedGen; - for (const sid of new Set(subagentTabs.map((t) => t.sessionId))) { - queryClient.fetchQuery({ ...getChatMessagesQuery(sid), staleTime: 0 }) - .then(({ messages }) => { - if (live && gen === seedGen) - apply(messages, subagentTabs.filter((t) => t.sessionId === sid), true); - }) - .catch(() => {}); - } - }; - seed(); - const off = onChatEvent((ev) => { - if (ev.type === "reconnected") { - // Frames lost during the outage may include the terminal update — - // refetch, letting the fresh seed overwrite everything. - liveUpdated.clear(); - seed(); - return; - } - if (ev.type !== "message") return; - const tabs = subagentTabs.filter((t) => t.sessionId === ev.sessionId); - if (tabs.length) apply([ev.message], tabs, false); - }); - return () => { - live = false; - off(); - }; - }, [subagentTabs]); + const spawnMeta = useSpawnTabMeta(subagentTabs); // One Git-backed code tab per branch. Reopening the same branch focuses it // at the requested subview; another branch gets its own tab. @@ -1364,7 +1109,7 @@ export default function App({ runtime, projectId, pane }: { runtime: RuntimeInfo }; const onProjectCreated = (project: Project, publicationError: string | null) => { - setProjects((cur) => (cur ? upsert(cur, project) : [project])); + setProjects((cur) => (cur ? upsertById(cur, project) : [project])); void router.navigate({ href: `/projects/${encodeURIComponent(project.id)}${publicationError ? "/settings/git" : ""}` }); if (publicationError) { showAlert(publicationError, "error"); @@ -1608,7 +1353,7 @@ export default function App({ runtime, projectId, pane }: { runtime: RuntimeInfo tab={mainView} project={activeProject} onProjectUpdate={(project) => { - setProjects((current) => (current ? upsert(current, project) : [project])); + setProjects((current) => (current ? upsertById(current, project) : [project])); }} onSelectTab={selectMainView} /> diff --git a/ui/src/filePathResolution.ts b/ui/src/filePathResolution.ts new file mode 100644 index 00000000..73c6873c --- /dev/null +++ b/ui/src/filePathResolution.ts @@ -0,0 +1,89 @@ +import type { FileViewDef } from "./workspaceTabs"; + +/** Escape a string for literal use inside a RegExp. */ +export function escapeRegExp(s: string): string { + return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} + +// Map a path an agent reported to a right-pane file tab. An artifact path under +// the compatibility /files// layout is stripped to a relative +// path and tagged source:"artifacts". Otherwise it's a repo/worktree path stripped to +// repo-relative, keeping the session id when it points into a per-session +// worktree. Relative paths name files in the click context's checkout and +// inherit `contextSessionId`; the regex fallbacks encode the +// managed storage layouts from src/local/git.rs: +// worktrees///… and the legacy repos///…. +export function parseFilePath( + rawPath: string, + repoPath?: string, + contextSessionId?: string, + artifactsDir?: string, + slug?: string, +): FileViewDef | null { + let path = rawPath; + let sessionId: string | undefined; + const clone = repoPath?.replace(/\/+$/, ""); + const artifacts = artifactsDir?.replace(/\/+$/, ""); + if (path.startsWith("artifacts/")) { + path = path.slice("artifacts/".length); + return path ? { path, source: "artifacts" } : null; + } + // A home-anchored path (`~` or `~/…`) is disk, never a repo file — the backend + // expands the `~`, so hand it over verbatim. + if (path === "~" || path.startsWith("~/")) return { path, source: "abs" }; + // `path` relative to `base` (`""` when equal), else null. macOS symlinks + // `/tmp`→`/private/tmp` and `/var`→`/private/var`, so an agent-inlined path + // and the stored dir can differ only by that prefix — strip it on both sides. + const relUnder = (base: string): string | null => { + const strip = (p: string) => p.replace(/^\/private(?=\/(?:tmp|var)(?:\/|$))/, ""); + const [p, b] = [strip(path), strip(base)]; + if (p === b) return ""; + return p.startsWith(`${b}/`) ? p.slice(b.length).replace(/^\/+/, "") : null; + }; + // A relative path names a file in the click context's checkout; the absolute + // branches below are keyed off the (non-canonical) stored dirs. + const artifactRel = path.startsWith("/") && artifacts ? relUnder(artifacts) : null; + const cloneRel = path.startsWith("/") && clone ? relUnder(clone) : null; + if (!path.startsWith("/")) { + sessionId = contextSessionId; + } else if (artifactRel !== null) { + // Artifact — prefix match against the non-canonical dir the backend + // surfaced, which mirrors what the agent inlines. + return artifactRel ? { path: artifactRel, source: "artifacts" } : null; + } else if (cloneRel !== null) { + path = cloneRel; + } else { + // Artifact fallback for a symlink-divergent path (e.g. /tmp vs + // /private/tmp) where the exact prefix missed: match the …/files// + // layout, requiring the slug segment when we know it. (Legacy artifacts/ is + // migrated to files/ in place, so it never appears in a live path.) + const slugPat = slug ? escapeRegExp(slug) : "[^/]+"; + const fd = path.match(new RegExp(`/files/${slugPat}/(.+)$`)); + const wt = fd ? null : path.match(/\/openresearch\/worktrees\/[^/]+\/([^/]+)\/(.+)$/); + const hub = fd || wt ? null : path.match(/\/openresearch\/repos\/[^/]+\/[^/]+\/(.+)$/); + if (fd) { + return { path: fd[1], source: "artifacts" }; + } else if (wt) { + sessionId = wt[1]; + path = wt[2]; + } else if (hub) { + path = hub[1]; + } + } + if (!path) return null; + // An absolute path none of the checkout/artifacts branches recognized (e.g. + // /Users/me/.ssh/config) reads straight off disk — the repo /file endpoint + // only takes repo-relative paths and would reject it. + if (path.startsWith("/")) return { path, source: "abs" }; + return { path, sessionId }; +} + +/** The git branch a code file tab is showing, for the header pill — a cited + * experiment's branch (or any ref view) names that branch, and a worktree/clone + * file falls back to the baseline branch, so a code tab always says which + * branch its contents came from. Artifacts and absolute-path files have no + * branch. */ +export function fileBranchLabel(tab: FileViewDef, baselineBranch?: string): string | undefined { + if (tab.source === "artifacts" || tab.source === "abs") return undefined; + return tab.ref ?? tab.branchLabel ?? baselineBranch; +} diff --git a/ui/src/listUpsert.ts b/ui/src/listUpsert.ts new file mode 100644 index 00000000..b05f6c67 --- /dev/null +++ b/ui/src/listUpsert.ts @@ -0,0 +1,8 @@ +/** Replace the item sharing `item.id`, or append it when none matches. */ +export function upsertById(list: T[], item: T): T[] { + const i = list.findIndex((x) => x.id === item.id); + if (i < 0) return [...list, item]; + const next = list.slice(); + next[i] = item; + return next; +} diff --git a/ui/src/panelSizing.ts b/ui/src/panelSizing.ts new file mode 100644 index 00000000..c4e63c89 --- /dev/null +++ b/ui/src/panelSizing.ts @@ -0,0 +1,25 @@ +/** Floating panel sizing: keep both the panel and the chat column usable. */ +export const PANEL_MIN_WIDTH = 360; +export const PANEL_MARGIN = 10; +export const WORKSPACE_CARD_MIN_WIDTH = 1448; // 1420px content plus the body’s 14px gutters. +// Space the rest of the layout needs beside the panel: the 272px rail, the +// chat column's minimum, and the gutters/margins between the three columns +// (app-body padding 14×2, rail inner margin 14, end-pane inner margin 14). +export const RAIL_WIDTH = 272; +export const CHAT_MIN_SPACE = 380; +export const LAYOUT_CHROME = RAIL_WIDTH + 14 * 4; +// Once a drag pushes the panel past its usable max by this much, it snaps to +// fullscreen — a bit of resistance you have to overcome deliberately. +export const FULLSCREEN_SNAP_SLOP = 80; +// Inward drag needed before snapping back to the last non-fullscreen width. +export const FULLSCREEN_RESTORE_DRAG = 48; + +/** The widest the floating panel can be while leaving the rail + chat usable. */ +export function panelMaxWidth(): number { + return Math.max(PANEL_MIN_WIDTH, window.innerWidth - LAYOUT_CHROME - CHAT_MIN_SPACE); +} + +export function initialPanelWidth(): number { + const max = panelMaxWidth(); + return Math.max(PANEL_MIN_WIDTH, Math.min(760, max, Math.round(window.innerWidth * 0.4))); +} diff --git a/ui/src/useAppData.ts b/ui/src/useAppData.ts new file mode 100644 index 00000000..1b2d467e --- /dev/null +++ b/ui/src/useAppData.ts @@ -0,0 +1,58 @@ +import { type SetStateAction, useCallback, useMemo } from "react"; +import { useQuery } from "@tanstack/react-query"; + +import { setScopedQueryData } from "./queries/client"; +import { listChatSessionsQuery } from "./queries/chat"; +import { listProjectsQuery, getUiStateQuery } from "./queries/projects"; +import { type Project, type UiState } from "./api"; +import { m } from "./paraglide/messages.js"; + +/** Loads the top-level, project-scoped data App needs before it can render: + * the project list, ui state, and the current project's chat sessions — plus + * a combined startup error and a retry that re-fetches all three. */ +export function useAppData(projectId: string, locale: string) { + const sessionsQuery = useQuery(listChatSessionsQuery(projectId)); + const sessions = useMemo(() => sessionsQuery.data?.map((session) => session.id) ?? null, [sessionsQuery.data]); + + const projectsOptions = useMemo(() => listProjectsQuery(), [projectId]); + const projectsQuery = useQuery(projectsOptions); + const projects = projectsQuery.data ?? null; + const setProjects = useCallback((value: SetStateAction) => { + setScopedQueryData(projectsOptions.queryKey, (current) => { + const next = typeof value === "function" ? value(current ?? null) : value; + return next ?? undefined; + }); + }, [projectsOptions]); + + const uiStateOptions = useMemo(() => getUiStateQuery(), [projectId]); + const uiStateQuery = useQuery(uiStateOptions); + const uiState = uiStateQuery.data ?? null; + const setUiState = useCallback((value: SetStateAction) => { + setScopedQueryData(uiStateOptions.queryKey, (current) => { + const next = typeof value === "function" ? value(current ?? null) : value; + return next ?? undefined; + }); + }, [uiStateOptions]); + + const failedStartupItems = [ + !sessionsQuery.data && sessionsQuery.error ? m.chat_all_sessions() : null, + !projectsQuery.data && projectsQuery.error ? m.app_projects() : null, + !uiStateQuery.data && uiStateQuery.error ? m.app_settings() : null, + ].filter((item) => item !== null); + const startupError = failedStartupItems.length + ? m.app_startup_load_failed({ items: new Intl.ListFormat(locale).format(failedStartupItems) }) + : null; + + const loadInitialState = () => { + void projectsQuery.refetch(); + void uiStateQuery.refetch(); + void sessionsQuery.refetch(); + }; + + return { + sessionsQuery, sessions, + projectsQuery, projects, setProjects, + uiStateQuery, uiState, setUiState, + startupError, loadInitialState, + }; +} diff --git a/ui/src/useExperimentScope.ts b/ui/src/useExperimentScope.ts new file mode 100644 index 00000000..68bb6262 --- /dev/null +++ b/ui/src/useExperimentScope.ts @@ -0,0 +1,45 @@ +import { useCallback, useMemo, useRef, useState } from "react"; + +import { usePopover } from "./components/ModelPicker"; +import { type Experiment, type Run } from "./api"; + +export type ExperimentsView = "tree" | "table"; + +/** The experiments pane's view toggle (tree/table) and its "agent" vs + * "project" scope filter — "agent" narrows to the open chat session's work, + * falling back to "project" whenever there is no usable experiment + * attribution. */ +export function useExperimentScope(experiments: Experiment[], runs: Run[], activeSessionId: string | null) { + const [view, setView] = useState("table"); + // Experiments pane scope: "agent" narrows to the open chat session's work. + // Falls back to "project" whenever there is no usable experiment attribution. + const [scope, setScope] = useState<"agent" | "project">("project"); + const scopeTriggerRef = useRef(null); + const { open: scopeMenuOpen, setOpen: setScopeMenuOpen, ref: scopeMenuRef } = + usePopover(scopeTriggerRef); + const allExperimentsAttributed = experiments.every((experiment) => experiment.chatSessionId); + const effectiveScope = activeSessionId && allExperimentsAttributed ? scope : "project"; + const scopedExperiments = useMemo(() => { + if (effectiveScope !== "agent") return experiments; + return experiments.filter((experiment) => experiment.chatSessionId === activeSessionId); + }, [experiments, effectiveScope, activeSessionId]); + // Runs are scoped by their experiment's owner, not by which session launched them. + const scopedRuns = useMemo(() => { + if (effectiveScope !== "agent") return runs; + const mine = new Set(scopedExperiments.map((experiment) => experiment.id)); + return runs.filter((r) => mine.has(r.experimentId)); + }, [runs, scopedExperiments, effectiveScope]); + + // Stable identity: in TreeView's layout-memo deps, so an inline arrow would + // recompute the graph on every render. + const showProjectScope = useCallback(() => setScope("project"), []); + + return { + view, setView, + scope, setScope, + scopeTriggerRef, scopeMenuOpen, setScopeMenuOpen, scopeMenuRef, + allExperimentsAttributed, effectiveScope, + scopedExperiments, scopedRuns, + showProjectScope, + }; +} diff --git a/ui/src/usePreferredAgent.ts b/ui/src/usePreferredAgent.ts new file mode 100644 index 00000000..9f1d7f1a --- /dev/null +++ b/ui/src/usePreferredAgent.ts @@ -0,0 +1,39 @@ +import { type SetStateAction, useCallback, useRef } from "react"; + +import { type AgentSelection, type UiState } from "./api"; + +/** Persists the preferred-agent selection with an optimistic update, a + * serialized write queue (so out-of-order saves can't clobber a newer + * selection), and rollback to the last-saved value on failure. */ +export function usePreferredAgent( + setUiState: (value: SetStateAction) => void, + saveUiState: (patch: { preferredAgent: AgentSelection }) => Promise, +) { + const persistedPreferredAgent = useRef(null); + const preferredAgentWrite = useRef>(Promise.resolve()); + const preferredAgentSaveSeq = useRef(0); + const persistPreferredAgent = useCallback((selection: AgentSelection) => { + const saveSeq = ++preferredAgentSaveSeq.current; + setUiState((current) => current && { ...current, preferredAgent: selection }); + const write = preferredAgentWrite.current + .then(() => saveUiState({ preferredAgent: selection })) + .then((saved) => { + persistedPreferredAgent.current = saved.preferredAgent; + if (saveSeq === preferredAgentSaveSeq.current) { + setUiState((current) => current && { ...current, preferredAgent: saved.preferredAgent }); + } + }) + .catch((error: unknown) => { + if (saveSeq === preferredAgentSaveSeq.current) { + setUiState((current) => + current && { ...current, preferredAgent: persistedPreferredAgent.current }, + ); + } + throw error; + }); + preferredAgentWrite.current = write.catch(() => {}); + return write; + }, [setUiState, saveUiState]); + + return { persistedPreferredAgent, persistPreferredAgent }; +} diff --git a/ui/src/useSpawnTabMeta.ts b/ui/src/useSpawnTabMeta.ts new file mode 100644 index 00000000..b1be51c6 --- /dev/null +++ b/ui/src/useSpawnTabMeta.ts @@ -0,0 +1,83 @@ +import { useEffect, useState } from "react"; + +import { queryClient } from "./queries/client"; +import { getChatMessagesQuery } from "./queries/chat"; +import { findPartById, spawnRowTitle } from "./components/ChatPanel"; +import { onChatEvent } from "./events"; +import { type SubagentViewDef } from "./workspaceTabs"; +import { type ChatMessage } from "./api"; + +/** Live title + running state for open sub-agent tabs, straight off the spawn + * parts' message stream — so a tab is named for its task and shimmers while + * the agent still works (the open-time `label` is only the seed/fallback). */ +export function useSpawnTabMeta(subagentTabs: SubagentViewDef[]) { + const [spawnMeta, setSpawnMeta] = useState>({}); + useEffect(() => { + // Closed tabs drop their metadata — the map only ever holds open tabs. + setSpawnMeta((prev) => { + const open = new Set(subagentTabs.map((t) => t.spawnPartId)); + if (Object.keys(prev).every((id) => open.has(id))) return prev; + return Object.fromEntries(Object.entries(prev).filter(([id]) => open.has(id))); + }); + if (subagentTabs.length === 0) return; + let live = true; + // Spawn ids a live event already updated: the initial fetch can resolve + // AFTER newer stream frames and must not roll those tabs back (a stale + // `running` snapshot would shimmer forever). + const liveUpdated = new Set(); + const apply = (msgs: ChatMessage[], tabs: SubagentViewDef[], fromSeed: boolean) => { + setSpawnMeta((prev) => { + let next = prev; + for (const t of tabs) { + if (fromSeed && liveUpdated.has(t.spawnPartId)) continue; + for (const m of msgs) { + const part = findPartById(m.parts, t.spawnPartId); + if (!part) continue; + if (!fromSeed) liveUpdated.add(t.spawnPartId); + const meta = { label: spawnRowTitle(part), running: part.state?.status === "running" }; + const cur = next[t.spawnPartId]; + if (!cur || cur.label !== meta.label || cur.running !== meta.running) { + if (next === prev) next = { ...prev }; + next[t.spawnPartId] = meta; + } + break; + } + } + return next; + }); + }; + // Generation token: a reconnect starts fresh seeds, and a stale in-flight + // response from an earlier generation must not land after them. + let seedGen = 0; + const seed = () => { + const gen = ++seedGen; + for (const sid of new Set(subagentTabs.map((t) => t.sessionId))) { + queryClient.fetchQuery({ ...getChatMessagesQuery(sid), staleTime: 0 }) + .then(({ messages }) => { + if (live && gen === seedGen) + apply(messages, subagentTabs.filter((t) => t.sessionId === sid), true); + }) + .catch(() => {}); + } + }; + seed(); + const off = onChatEvent((ev) => { + if (ev.type === "reconnected") { + // Frames lost during the outage may include the terminal update — + // refetch, letting the fresh seed overwrite everything. + liveUpdated.clear(); + seed(); + return; + } + if (ev.type !== "message") return; + const tabs = subagentTabs.filter((t) => t.sessionId === ev.sessionId); + if (tabs.length) apply([ev.message], tabs, false); + }); + return () => { + live = false; + off(); + }; + }, [subagentTabs]); + + return spawnMeta; +} diff --git a/ui/src/useStableStringMap.ts b/ui/src/useStableStringMap.ts new file mode 100644 index 00000000..e52ba10e --- /dev/null +++ b/ui/src/useStableStringMap.ts @@ -0,0 +1,13 @@ +import { useRef } from "react"; + +/** Keeps referential identity across renders while the map's contents are + * unchanged (same size, same key→value pairs) — so a derived map can sit in a + * memo/callback dependency list without recomputing on every render that + * happens to rebuild an equal map. */ +export function useStableStringMap(next: Map): Map { + const current = useRef(next); + const unchanged = current.current.size === next.size + && [...next].every(([key, value]) => current.current.get(key) === value); + if (!unchanged) current.current = next; + return current.current; +} diff --git a/ui/tests/filePathResolution.test.mjs b/ui/tests/filePathResolution.test.mjs new file mode 100644 index 00000000..80ffdb57 --- /dev/null +++ b/ui/tests/filePathResolution.test.mjs @@ -0,0 +1,108 @@ +import assert from "node:assert/strict"; +import test from "node:test"; + +import { escapeRegExp, parseFilePath, fileBranchLabel } from "../src/filePathResolution.ts"; + +test("escapeRegExp escapes every regex metacharacter", () => { + const raw = "a.b*c+d?e^f$g{h}i(j)k|l[m]n\\o"; + const pattern = new RegExp(`^${escapeRegExp(raw)}$`); + assert.ok(pattern.test(raw)); +}); + +test("an artifacts/-prefixed path strips the prefix and is tagged artifacts", () => { + assert.deepEqual(parseFilePath("artifacts/figure.svg"), { path: "figure.svg", source: "artifacts" }); +}); + +test("artifacts/ with nothing after it resolves to nothing", () => { + assert.equal(parseFilePath("artifacts/"), null); +}); + +test("a home-anchored path is disk, never a repo file", () => { + assert.deepEqual(parseFilePath("~"), { path: "~", source: "abs" }); + assert.deepEqual(parseFilePath("~/notes.md"), { path: "~/notes.md", source: "abs" }); +}); + +test("a relative path inherits the click context's session and has no source tag", () => { + const tab = parseFilePath("src/main.rs", "/repo/clone", "session-1"); + assert.equal(tab?.path, "src/main.rs"); + assert.equal(tab?.sessionId, "session-1"); + assert.equal(tab?.source, undefined); +}); + +test("an absolute path under the repo clone strips to repo-relative with no session", () => { + const tab = parseFilePath("/repo/clone/src/main.rs", "/repo/clone", "session-1"); + assert.equal(tab?.path, "src/main.rs"); + assert.equal(tab?.sessionId, undefined); + assert.equal(tab?.source, undefined); +}); + +test("an absolute path exactly at the repo clone root resolves to an empty relative path, which is unusable", () => { + assert.equal(parseFilePath("/repo/clone", "/repo/clone"), null); +}); + +test("an absolute path under the artifacts dir is tagged artifacts, stripped to relative", () => { + const tab = parseFilePath("/data/proj/files/paper.tex", undefined, undefined, "/data/proj/files"); + assert.deepEqual(tab, { path: "paper.tex", source: "artifacts" }); +}); + +test("macOS's /private symlink prefix is stripped from both the reported path and the stored dir", () => { + const viaPrivate = parseFilePath("/private/tmp/clone/src/main.rs", "/tmp/clone"); + assert.equal(viaPrivate?.path, "src/main.rs"); + const viaBoth = parseFilePath("/tmp/clone/src/main.rs", "/private/tmp/clone"); + assert.equal(viaBoth?.path, "src/main.rs"); +}); + +test("a worktree-layout path falls back to extracting the session id and relative path", () => { + const tab = parseFilePath("/home/user/.local/share/openresearch/worktrees/proj-1/session-9/src/lib.rs"); + assert.deepEqual(tab, { path: "src/lib.rs", sessionId: "session-9" }); +}); + +test("a legacy repos-layout path falls back to a bare repo-relative path", () => { + const tab = parseFilePath("/home/user/.local/share/openresearch/repos/owner/repo/src/lib.rs"); + assert.equal(tab?.path, "src/lib.rs"); + assert.equal(tab?.sessionId, undefined); +}); + +test("the files// fallback requires the exact slug when one is known", () => { + const path = "/some/other/root/files/my-proj/notes.md"; + assert.deepEqual(parseFilePath(path, undefined, undefined, undefined, "my-proj"), { + path: "notes.md", + source: "artifacts", + }); + // A mismatched slug matches none of the fallbacks, so the path falls through + // to the disk-read case unchanged. + assert.deepEqual(parseFilePath(path, undefined, undefined, undefined, "other-proj"), { + path, + source: "abs", + }); +}); + +test("a slug containing regex metacharacters is matched literally, not as a pattern", () => { + const path = "/root/files/a.b+c/notes.md"; + assert.deepEqual(parseFilePath(path, undefined, undefined, undefined, "a.b+c"), { + path: "notes.md", + source: "artifacts", + }); +}); + +test("an unrecognized absolute path reads straight off disk", () => { + assert.deepEqual(parseFilePath("/Users/me/.ssh/config"), { path: "/Users/me/.ssh/config", source: "abs" }); +}); + +test("fileBranchLabel: artifacts and abs files never carry a branch", () => { + assert.equal(fileBranchLabel({ path: "x", source: "artifacts" }, "main"), undefined); + assert.equal(fileBranchLabel({ path: "x", source: "abs" }, "main"), undefined); +}); + +test("fileBranchLabel: an explicit ref wins over the branch label and baseline", () => { + assert.equal(fileBranchLabel({ path: "x", ref: "feature", branchLabel: "other" }, "main"), "feature"); +}); + +test("fileBranchLabel: a branch label is used when there is no ref", () => { + assert.equal(fileBranchLabel({ path: "x", branchLabel: "feature" }, "main"), "feature"); +}); + +test("fileBranchLabel: falls back to the baseline branch when neither ref nor label is set", () => { + assert.equal(fileBranchLabel({ path: "x" }, "main"), "main"); + assert.equal(fileBranchLabel({ path: "x" }), undefined); +}); diff --git a/ui/tests/listUpsert.test.mjs b/ui/tests/listUpsert.test.mjs new file mode 100644 index 00000000..9733a617 --- /dev/null +++ b/ui/tests/listUpsert.test.mjs @@ -0,0 +1,20 @@ +import assert from "node:assert/strict"; +import test from "node:test"; + +import { upsertById } from "../src/listUpsert.ts"; + +test("upsertById appends an item whose id is not yet in the list", () => { + assert.deepEqual(upsertById([{ id: "a" }], { id: "b" }), [{ id: "a" }, { id: "b" }]); +}); + +test("upsertById replaces the item sharing the same id in place", () => { + const list = [{ id: "a", n: 1 }, { id: "b", n: 2 }, { id: "c", n: 3 }]; + assert.deepEqual(upsertById(list, { id: "b", n: 20 }), [{ id: "a", n: 1 }, { id: "b", n: 20 }, { id: "c", n: 3 }]); +}); + +test("upsertById does not mutate the input list", () => { + const list = [{ id: "a", n: 1 }]; + const next = upsertById(list, { id: "a", n: 2 }); + assert.deepEqual(list, [{ id: "a", n: 1 }]); + assert.notEqual(next, list); +});