diff --git a/.gitignore b/.gitignore index 81c92558..ea8f36ed 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,11 @@ Claude.local.md # never be committed — they get recorded as orphan gitlinks with no .gitmodules # entry, which breaks `git checkout --recurse-submodules` in CI. .claude/worktrees/ + +# Stray SQLite store if the binary is ever run from the repo root +/orx.db +/orx.db-wal +/orx.db-shm + +# This repo uses pnpm; ignore an accidental npm lockfile +ui/package-lock.json diff --git a/Cargo.lock b/Cargo.lock index 044cf7f2..137f894b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -938,6 +938,7 @@ dependencies = [ "dirs", "fd-lock", "futures", + "libc", "reqwest", "rusqlite", "rust-embed", diff --git a/Cargo.toml b/Cargo.toml index d007edca..7f97e462 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,6 +36,11 @@ futures = "0.3" # async fns in the Harness trait (object-safe `dyn Harness` in the registry). async-trait = "0.1" +[target.'cfg(unix)'.dependencies] +# Free-space pre-check for the data-dir move (statvfs). Already in the tree +# transitively; taken as a direct dep only on unix, where we call it. +libc = "0.2" + # The profile that 'dist' will build with [profile.dist] inherits = "release" diff --git a/src/commands/artifacts.rs b/src/commands/artifacts.rs index a622e086..97f6d15c 100644 --- a/src/commands/artifacts.rs +++ b/src/commands/artifacts.rs @@ -27,7 +27,12 @@ pub async fn run(args: crate::ArtifactsArgs) -> Result<()> { let rows: Vec> = artifacts .iter() - .map(|a| vec![a.key.clone(), human_bytes(a.size)]) + .map(|a| { + vec![ + a.key.clone(), + crate::store::human_bytes(a.size.max(0) as u64), + ] + }) .collect(); print_table(&["KEY", "SIZE"], &rows); @@ -38,18 +43,3 @@ pub async fn run(args: crate::ArtifactsArgs) -> Result<()> { ); Ok(()) } - -/// Compact human-readable byte size (e.g. `1.2 KB`, `3.4 MB`). -fn human_bytes(n: i64) -> String { - const UNITS: [&str; 5] = ["B", "KB", "MB", "GB", "TB"]; - if n < 1024 { - return format!("{} B", n); - } - let mut size = n as f64; - let mut unit = 0; - while size >= 1024.0 && unit < UNITS.len() - 1 { - size /= 1024.0; - unit += 1; - } - format!("{:.1} {}", size, UNITS[unit]) -} diff --git a/src/commands/up.rs b/src/commands/up.rs index a5a39da2..33a62c33 100644 --- a/src/commands/up.rs +++ b/src/commands/up.rs @@ -52,6 +52,7 @@ pub async fn run(args: UpArgs) -> Result<()> { agent: agent.clone(), chat: Arc::new(ChatHost::new(agent.clone(), codex.clone())), harnesses: Arc::new(tokio::sync::Mutex::new(None)), + data_dir_move_in_progress: Arc::new(std::sync::atomic::AtomicBool::new(false)), }; spawn_hf_preflight(); @@ -129,6 +130,10 @@ struct AppState { /// Harness detection cache — detection shells out to CLIs, so it's rate- /// limited to once per TTL unless the UI asks for a refresh. harnesses: Arc>>, + /// Set while a data-dir move is running. New chat turns and run launches + /// check it and refuse (409) so nothing starts writing the store mid-move — + /// closing the window between the move's in-flight check and its completion. + data_dir_move_in_progress: Arc, } fn router(state: AppState) -> Router { @@ -180,6 +185,12 @@ fn router(state: AppState) -> Router { "/api/settings/env/{key}", axum::routing::delete(delete_env_var), ) + .route( + "/api/settings/data-dir", + get(data_dir_settings).post(set_data_dir), + ) + .route("/api/settings/data-dir/validate", post(validate_data_dir)) + .route("/api/settings/data-dir/move", post(move_data_dir)) .route( "/api/settings/git", get(git_settings).post(set_git_settings), @@ -377,7 +388,11 @@ struct CreateProjectReq { fork_repo: bool, } -async fn create_project(Json(req): Json) -> ApiResult { +async fn create_project( + State(state): State, + Json(req): Json, +) -> ApiResult { + reject_if_moving(&state)?; let name = req.name.trim().to_string(); if name.is_empty() { return Err(bad_request("name is required")); @@ -476,7 +491,12 @@ struct UpdateProjectReq { run_command: Option>, } -async fn update_project(Path(id): Path, Json(req): Json) -> ApiResult { +async fn update_project( + State(state): State, + Path(id): Path, + Json(req): Json, +) -> ApiResult { + reject_if_moving(&state)?; if req.name.is_none() && req.run_command.is_none() { return Err(bad_request( "nothing to update: pass name and/or runCommand", @@ -509,6 +529,7 @@ async fn update_project(Path(id): Path, Json(req): Json, Path(id): Path) -> ApiResult { + reject_if_moving(&state)?; let store = Store::open()?; let project = store .get_local_project(&id)? @@ -604,9 +625,11 @@ struct CreateExperimentReq { } async fn create_experiment( + State(state): State, Path(id): Path, Json(req): Json, ) -> ApiResult { + reject_if_moving(&state)?; // Branch create + push shells out to git (network); off the async workers. let experiment = tokio::task::spawn_blocking(move || { let store = Store::open()?; @@ -655,7 +678,12 @@ struct RunReq { org: Option, } -async fn run_experiment(Path(id): Path, body: Bytes) -> ApiResult { +async fn run_experiment( + State(state): State, + Path(id): Path, + body: Bytes, +) -> ApiResult { + reject_if_moving(&state)?; // Tolerate an empty body — every field is optional in the schema. let req: RunReq = if body.is_empty() { RunReq::default() @@ -1013,7 +1041,12 @@ async fn file_report(Path(id): Path, Query(q): Query) -> } /// Delete a file or report folder in the files dir, by relative path. -async fn delete_file(Path(id): Path, Query(q): Query) -> ApiResult { +async fn delete_file( + State(state): State, + Path(id): Path, + Query(q): Query, +) -> ApiResult { + reject_if_moving(&state)?; blocking_api(move || { let store = Store::open()?; let project = store @@ -1364,6 +1397,263 @@ async fn delete_env_var(Path(key): Path) -> ApiResult { .map_err(|e| ApiError::from(anyhow!("env task failed: {e}")))? } +// --- data directory --------------------------------------------------------- + +/// Current data-dir state for the Storage settings card: where it resolves, +/// whether that's the default, the path we'd fall back to, and *why* it resolves +/// where it does (so the UI can lock the field when `$ORX_DATA_DIR` forces it). +fn data_dir_json() -> Value { + use crate::store::DataDirSource; + let current = crate::store::data_dir(); + let default = crate::store::default_data_dir(); + let source = crate::store::data_dir_source(); + json!({ + "current": current.to_string_lossy(), + "defaultPath": default.to_string_lossy(), + // "On the fallback chain" = no explicit choice (env pin or saved config). + // Env can happen to equal the default path but is still a forced override. + "isDefault": matches!(source, DataDirSource::Xdg | DataDirSource::Default), + // env | config | xdg | default — env means a forced override (read-only). + "source": source, + }) +} + +async fn data_dir_settings() -> ApiResult { + tokio::task::spawn_blocking(|| Ok(Json(data_dir_json()))) + .await + .map_err(|e| ApiError::from(anyhow!("data-dir task failed: {e}")))? +} + +#[derive(Deserialize)] +struct DataDirReq { + path: String, +} + +/// Reject a mutation when `$ORX_DATA_DIR` is forcing the path — the config value +/// would be shadowed, so honoring the request would silently do nothing. +fn ensure_not_env_forced() -> std::result::Result<(), ApiError> { + if crate::store::data_dir_source() == crate::store::DataDirSource::Env { + return Err(ApiError( + StatusCode::CONFLICT, + "The data directory is pinned by the ORX_DATA_DIR environment \ + variable, which overrides this setting. Unset it to choose a path here." + .into(), + )); + } + Ok(()) +} + +/// Pre-flight a candidate path for a **move** without committing: absolute? empty +/// target? room? Returns `{ ok, error?, treeBytes, freeBytes?, sameFilesystem }`. +async fn validate_data_dir(Json(req): Json) -> ApiResult { + use crate::local::datadir::TargetIntent; + let path = req.path.trim().to_string(); + if path.is_empty() { + return Err(bad_request("path is required")); + } + tokio::task::spawn_blocking(move || { + match crate::local::datadir::validate_target( + std::path::Path::new(&path), + TargetIntent::Move, + ) { + Ok(report) => Ok(Json(json!({ + "ok": true, + "treeBytes": report.tree_bytes, + "freeBytes": report.free_bytes, + "sameFilesystem": report.same_filesystem, + }))), + Err(e) => Ok(Json(json!({ "ok": false, "error": e.to_string() }))), + } + }) + .await + .map_err(|e| ApiError::from(anyhow!("validate task failed: {e}")))? +} + +/// Set the data dir *without moving* — for onboarding on an empty install, or +/// reconnecting to an already-populated location (a second machine, after config +/// loss). The UI routes here only when the current dir has nothing to migrate; +/// otherwise it calls `/move`. Uses `TargetIntent::Set`, which (unlike `Move`) +/// permits a populated existing dir since nothing is copied. +async fn set_data_dir(State(state): State, Json(req): Json) -> ApiResult { + use crate::local::datadir::TargetIntent; + reject_if_moving(&state)?; + ensure_not_env_forced()?; + let path = req.path.trim().to_string(); + if path.is_empty() { + return Err(bad_request("path is required")); + } + // Validate before persisting so we never store a bad path. + let validate_path = path.clone(); + tokio::task::spawn_blocking(move || { + crate::local::datadir::validate_target( + std::path::Path::new(&validate_path), + TargetIntent::Set, + ) + }) + .await + .map_err(|e| ApiError::from(anyhow!("validate task failed: {e}")))? + .map_err(bad_request)?; + + tokio::task::spawn_blocking(move || crate::config::set_settings_data_dir(Some(path))) + .await + .map_err(|e| ApiError::from(anyhow!("settings task failed: {e}")))??; + Ok(Json(data_dir_json())) +} + +/// Relocate the data dir to `path`, streaming `datadir.move.*` progress events +/// over `/api/events`. Returns 202 immediately; the UI watches the SSE stream. +/// +/// Concurrency safety: sets `data_dir_move_in_progress` *first*, then refuses +/// (409) if a run or chat turn is already active. The substantive store-mutating +/// handlers (`send`/`launch`, project/experiment/chat CRUD, file delete, +/// `set_data_dir`) check the flag on entry and back off, so once the move is +/// underway nothing new writes the store. Even the residual races don't lose +/// data: a request that passed its own flag check in the tiny window before this +/// one set the flag — or an unguarded incidental write (an `open_project` +/// timestamp touch, an `ssh_preflight` test row) — lands in the *old* dir, but +/// the cross-filesystem path never deletes it (it's returned as `oldPathLeft`), +/// so the write is preserved there; only the atomic same-filesystem rename +/// consumes the old dir, and that path has no copy window. +async fn move_data_dir(State(state): State, Json(req): Json) -> Response { + use crate::local::datadir::TargetIntent; + use std::sync::atomic::Ordering; + + if let Err(e) = ensure_not_env_forced() { + return e.into_response(); + } + let path = req.path.trim().to_string(); + if path.is_empty() { + return bad_request("path is required").into_response(); + } + + // Claim the move slot first (compare-exchange): only one move at a time, and + // once claimed, new turns/launches see the flag and back off. + if state + .data_dir_move_in_progress + .compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst) + .is_err() + { + return ApiError( + StatusCode::CONFLICT, + "A data-directory move is already in progress.".into(), + ) + .into_response(); + } + + // Helper to release the slot on any early return. + let release = |state: &AppState| { + state + .data_dir_move_in_progress + .store(false, Ordering::SeqCst); + }; + + // In-flight guard: block if a chat turn or a run is active right now. (The + // flag we just set prevents *new* ones from starting past this point.) + let busy = state.chat.busy_sessions().await; + let active_runs = tokio::task::spawn_blocking(active_run_count) + .await + .unwrap_or(0); + if !busy.is_empty() || active_runs > 0 { + release(&state); + return ApiError( + StatusCode::CONFLICT, + format!( + "Can't move while work is in progress ({} active chat turn(s), \ + {active_runs} active run(s)). Finish or stop them, then retry.", + busy.len() + ), + ) + .into_response(); + } + + // Validate before kicking off the background move. + let vpath = path.clone(); + let validated = tokio::task::spawn_blocking(move || { + crate::local::datadir::validate_target(std::path::Path::new(&vpath), TargetIntent::Move) + }) + .await; + match validated { + Ok(Ok(_)) => {} + Ok(Err(e)) => { + release(&state); + return bad_request(e).into_response(); + } + Err(e) => { + release(&state); + return ApiError::from(anyhow!("validate task failed: {e}")).into_response(); + } + } + + // Spawn the move on a blocking task (it does synchronous FS work); forward + // throttled progress onto the SSE broadcast, clear the flag when done. + let chat = state.chat.clone(); + let flag = state.data_dir_move_in_progress.clone(); + let target = std::path::PathBuf::from(path); + tokio::spawn(async move { + use crate::local::datadir::MoveProgress; + let chat_for_progress = chat.clone(); + // Throttle: forward at most one progress event per ~120ms of copy, but + // always emit phase edges (copied==0 or ==total) so the first/last tick + // of every phase gets through. + let last = std::sync::Mutex::new(0i64); + let on_progress = move |p: MoveProgress| { + let now = crate::store::now_ms(); + let mut guard = last.lock().unwrap(); + let is_edge = p.copied_bytes == 0 || p.copied_bytes >= p.total_bytes; + if is_edge || now - *guard >= 120 { + *guard = now; + chat_for_progress.emit_event("datadir.move.progress", json!(p)); + } + }; + let target_for_move = target.clone(); + let result = tokio::task::spawn_blocking(move || { + crate::local::datadir::move_data_dir(target_for_move, on_progress) + }) + .await; + + match result { + Ok(Ok(outcome)) => { + // Restart harness children so any that pinned the old data dir + // (Codex hard-pins $ORX_DATA_DIR at spawn) respawn on the new one. + chat.shutdown_harnesses().await; + chat.emit_event("datadir.move.done", json!(outcome)); + } + Ok(Err(e)) => chat.emit_event("datadir.move.error", json!({ "error": e.to_string() })), + Err(e) => chat.emit_event( + "datadir.move.error", + json!({ "error": format!("move task panicked: {e}") }), + ), + } + flag.store(false, Ordering::SeqCst); + }); + + (StatusCode::ACCEPTED, Json(json!({ "started": true }))).into_response() +} + +/// Count runs currently in an active state (`starting`/`running`), for the +/// data-dir move's in-flight guard. SQL-side and unbounded (see +/// `Store::count_active_runs`). +fn active_run_count() -> usize { + Store::open() + .and_then(|s| s.count_active_runs()) + .unwrap_or(0) +} + +/// Refuse an operation that would write the store while a data-dir move is in +/// progress — the move relies on nothing new touching the old dir mid-flight. +fn reject_if_moving(state: &AppState) -> std::result::Result<(), ApiError> { + if state + .data_dir_move_in_progress + .load(std::sync::atomic::Ordering::SeqCst) + { + return Err(ApiError( + StatusCode::CONFLICT, + "A data-directory move is in progress. Try again once it finishes.".into(), + )); + } + Ok(()) +} + // --- git settings ----------------------------------------------------------- fn git_out(args: &[&str]) -> Option { @@ -1799,7 +2089,11 @@ struct CreateChatSessionReq { reasoning_level: Option, } -async fn create_chat_session(Json(req): Json) -> ApiResult { +async fn create_chat_session( + State(state): State, + Json(req): Json, +) -> ApiResult { + reject_if_moving(&state)?; if !local::harness::is_chat_harness(&req.harness) { return Err(bad_request(format!("unknown harness: {}", req.harness))); } @@ -1828,6 +2122,7 @@ async fn create_chat_session(Json(req): Json) -> ApiResult } async fn delete_chat_session(State(state): State, Path(id): Path) -> ApiResult { + reject_if_moving(&state)?; state.chat.delete_session(&id).await?; Ok(Json(json!({ "ok": true }))) } @@ -1844,6 +2139,7 @@ async fn update_chat_session( Path(id): Path, Json(req): Json, ) -> ApiResult { + reject_if_moving(&state)?; let session = if let Some(title) = req.title { let title = title.trim(); if title.is_empty() { @@ -1893,6 +2189,7 @@ async fn send_chat_message( Path(id): Path, Json(req): Json, ) -> ApiResult { + reject_if_moving(&state)?; let text = req.text.trim().to_string(); if text.is_empty() && req.images.is_empty() { return Err(bad_request("text is required")); diff --git a/src/config.rs b/src/config.rs index 9a5cbd3c..5dfb49c1 100644 --- a/src/config.rs +++ b/src/config.rs @@ -100,6 +100,27 @@ pub async fn clear_credentials() -> Result<()> { } } +/// The user-chosen data dir, if one is persisted and non-empty. Consumed by +/// `store::data_dir()` between the `$ORX_DATA_DIR` override and the XDG default. +/// +/// `settings.json` (in `config_dir()`, deliberately *outside* the data dir so it +/// can point *at* it without a chicken-and-egg) is owned by `crate::telemetry`, +/// which already guards it with an in-process mutex + cross-process flock + +/// atomic temp-and-rename RMW. We delegate rather than add a second writer — a +/// naive whole-object write here would clobber `installId`/`telemetryDisabled` +/// (and vice-versa). Sync because `store::data_dir()` calls it on every open. +pub fn settings_data_dir() -> Option { + crate::telemetry::persisted_data_dir().map(PathBuf::from) +} + +/// Set or clear the persisted data dir, preserving every other settings field. +/// Delegates to `telemetry::set_persisted_data_dir` (the locked, atomic RMW). +/// `None` clears it (revert to the env/XDG/default chain). +pub fn set_settings_data_dir(data_dir: Option) -> Result<()> { + crate::telemetry::set_persisted_data_dir(data_dir)?; + Ok(()) +} + /// Look up a var from the box's synced env file (`~/.openresearch/env`, written /// by the api's env sync). Needed because non-interactive shells never source /// it via .bashrc (Ubuntu's interactive guard returns first), so an agent's diff --git a/src/local/chat/mod.rs b/src/local/chat/mod.rs index a3cc0145..ab1423f6 100644 --- a/src/local/chat/mod.rs +++ b/src/local/chat/mod.rs @@ -373,6 +373,22 @@ impl ChatHost { let _ = self.events.send((name, data)); } + /// Publish an arbitrary named event onto the SSE broadcast that `/api/events` + /// forwards. Used by non-chat features (e.g. the data-dir move) that want to + /// stream progress to the UI without standing up a second channel. + pub fn emit_event(&self, name: &'static str, data: Value) { + self.emit(name, data); + } + + /// Shut down both harness hosts' long-lived child processes. They respawn + /// lazily on the next turn — used after a data-dir move so a child that + /// captured the old path (Codex hard-pins `$ORX_DATA_DIR` at spawn) comes + /// back resolving the new one. + pub async fn shutdown_harnesses(&self) { + self.opencode.shutdown().await; + self.codex.shutdown().await; + } + pub async fn busy_sessions(&self) -> Vec { self.turns.lock().await.keys().cloned().collect() } diff --git a/src/local/datadir.rs b/src/local/datadir.rs new file mode 100644 index 00000000..b730856b --- /dev/null +++ b/src/local/datadir.rs @@ -0,0 +1,437 @@ +//! Relocating the orx data dir (`orx.db` + `run-logs/` + `artifacts/` + +//! `chat-attachments/` + `agent-*.log`) to a user-chosen path. +//! +//! The whole dir is a self-contained, relocatable unit (the api already tars it +//! for R2 snapshot/restore), so a move is: validate target → checkpoint the DB → +//! copy the tree (streaming byte progress) → verify → swap the persisted path in +//! `settings.json` (after which `store::data_dir()` returns the new path) → +//! delete the old copy. Non-destructive: the old tree survives until the copy is +//! verified and the path is swapped, so an interruption never loses data. +//! +//! The caller (the `up` handler) is responsible for refusing a move while a run +//! or chat turn is in flight — this module assumes writers are quiesced enough +//! that the source tree is stable for the copy. + +use std::path::{Path, PathBuf}; + +use serde::Serialize; + +use crate::error::{anyhow, Result}; +use crate::store::{self, human_bytes, Store}; + +/// Outcome of `validate_target`, carried to the UI so it can show free/needed +/// bytes before the user commits. +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct ValidateReport { + /// Total bytes the current data dir occupies (what will be copied). + pub tree_bytes: u64, + /// Free bytes on the target's filesystem, if determinable. + #[serde(skip_serializing_if = "Option::is_none")] + pub free_bytes: Option, + /// True when source and target resolve to the same filesystem, so the move + /// can use an instant `rename` instead of a copy. + pub same_filesystem: bool, +} + +/// Validate a proposed data-dir path, returning a report for the UI. Errors are +/// human-readable (surfaced inline in the Storage settings form). +/// +/// What the caller intends to do with the validated target — the emptiness rule +/// differs. A **move** copies the current tree in, so the target must be absent +/// or empty. A **set-without-move** just re-points at a location, so an existing +/// populated orx dir (reconnecting on a second machine, after config loss) is +/// allowed — only a plain file or the current dir is rejected. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum TargetIntent { + Move, + Set, +} + +/// Validate a proposed data-dir `target` for the given `intent`, returning a +/// report for the UI. +/// +/// Always rejects: non-absolute paths, the current data dir itself, any path +/// *inside* the current data dir (a move would copy into itself), a plain file, +/// and a non-existent parent. For `Move`, additionally rejects a non-empty +/// existing target and a target volume without room for the tree; for `Set`, a +/// populated existing dir is allowed (nothing is copied). +pub fn validate_target(target: &Path, intent: TargetIntent) -> Result { + if !target.is_absolute() { + return Err(anyhow!("Path must be absolute (start with /).")); + } + + let current = store::data_dir(); + // Normalize both for comparison without requiring the target to exist yet. + let current_norm = current.canonicalize().unwrap_or_else(|_| current.clone()); + if paths_equal(target, ¤t_norm) { + return Err(anyhow!("That's already the current data directory.")); + } + if target.starts_with(¤t_norm) { + return Err(anyhow!( + "Can't put the data directory inside itself ({}).", + current_norm.display() + )); + } + + // The parent must exist (a move/create won't `mkdir -p` arbitrary ancestors). + let parent = target + .parent() + .ok_or_else(|| anyhow!("Path has no parent directory."))?; + if !parent.exists() { + return Err(anyhow!( + "Parent directory doesn't exist: {}", + parent.display() + )); + } + + // A plain file (or symlink) at the target is never valid. + if target.exists() { + let md = std::fs::symlink_metadata(target) + .map_err(|e| anyhow!("Can't stat {}: {e}", target.display()))?; + if md.is_file() || md.file_type().is_symlink() { + return Err(anyhow!("A file already exists at {}.", target.display())); + } + // A move copies into the target, so it must be empty. A set just points + // at it, so an existing (possibly populated) dir is fine. + if intent == TargetIntent::Move + && md.is_dir() + && std::fs::read_dir(target) + .map(|mut d| d.next().is_some()) + .unwrap_or(false) + { + return Err(anyhow!( + "Directory {} already exists and isn't empty. Choose an empty \ + or new folder to move into.", + target.display() + )); + } + } + + // Free-space only matters for a move (a set copies nothing). + let tree_bytes = dir_size(¤t); + let free_bytes = available_bytes(parent); + if intent == TargetIntent::Move { + if let Some(free) = free_bytes { + if free < tree_bytes { + return Err(anyhow!( + "Not enough space: need {}, only {} free on the target volume.", + human_bytes(tree_bytes), + human_bytes(free) + )); + } + } + } + + let same_filesystem = same_device(¤t, parent); + + Ok(ValidateReport { + tree_bytes, + free_bytes, + same_filesystem, + }) +} + +/// Phase of an in-progress move, for the UI's progress label. +#[derive(Debug, Clone, Copy, Serialize)] +#[serde(rename_all = "lowercase")] +pub enum MovePhase { + Preparing, + Copying, + Verifying, + Finalizing, +} + +/// How a completed move disposed of the old directory. Returned so the handler +/// can tell the user whether a copy was left behind to delete manually. +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct MoveOutcome { + /// The new (now-active) data dir. + pub path: String, + /// The old dir, if it still exists (cross-filesystem copy leaves it in place; + /// a same-filesystem rename consumes it). `None` = nothing left behind. + #[serde(skip_serializing_if = "Option::is_none")] + pub old_path_left: Option, +} + +/// A progress tick: bytes copied so far out of the total, plus the phase. +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct MoveProgress { + pub phase: MovePhase, + pub copied_bytes: u64, + pub total_bytes: u64, +} + +/// Move the current data dir to `target`, invoking `on_progress` as bytes are +/// copied. Persists the new path only after the copy verifies. +/// +/// Disposal of the old tree is deliberately conservative: +/// * **Same filesystem** → `rename`, which atomically consumes the old dir (no +/// copy, no window where a stray writer's data could be deleted). +/// * **Cross filesystem** → copy, then **leave the old dir in place**. Deleting +/// it would be unsafe: a detached `supervise` process, an idle harness child +/// pinned to the old path, or a request that resolved the old path just before +/// the swap could still be writing there, and a `remove_dir_all` would drop +/// that data. The old copy is instead reported back so the user (or a later +/// cleanup) can remove it once nothing references it. +/// +/// `on_progress` is called frequently during copy; the caller should throttle +/// before forwarding to SSE. This function blocks — run it on a blocking task. +pub fn move_data_dir( + target: PathBuf, + on_progress: impl Fn(MoveProgress) + Send, +) -> Result { + let source = store::data_dir(); + on_progress(MoveProgress { + phase: MovePhase::Preparing, + copied_bytes: 0, + total_bytes: 0, + }); + + // Coalesce the WAL into orx.db so a file copy captures a consistent DB. + // Failure is fatal for a cross-fs copy (the sidecar files would be copied in + // an inconsistent state); the rename path is atomic so it wouldn't matter, + // but we checkpoint unconditionally and bail rather than risk a torn copy. + match Store::open() { + Ok(store) => store + .checkpoint() + .map_err(|e| anyhow!("Could not checkpoint the database before moving: {e}"))?, + Err(e) => return Err(anyhow!("Could not open the store to checkpoint it: {e}")), + } + + // Size the tree AFTER the checkpoint — TRUNCATE reclaims the WAL, so a + // pre-checkpoint total would mismatch the post-checkpoint copy and fail + // verification (or mask a short copy). + let total = dir_size(&source); + + // Same-filesystem + non-existent target → instant, atomic rename. + let target_parent = target.parent().unwrap_or(&target); + if same_device(&source, target_parent) && !target.exists() { + on_progress(MoveProgress { + phase: MovePhase::Copying, + copied_bytes: 0, + total_bytes: total, + }); + match std::fs::rename(&source, &target) { + Ok(()) => { + finalize(&target, total, &on_progress)?; + return Ok(MoveOutcome { + path: target.to_string_lossy().into_owned(), + old_path_left: None, + }); + } + // EXDEV: the ancestor-walk mis-judged the device (e.g. the volume + // mounts *at* the target). Fall through to the copy path. + Err(e) if e.raw_os_error() == Some(libc::EXDEV) => {} + Err(e) => return Err(anyhow!("Rename to {} failed: {e}", target.display())), + } + } + + // Cross-filesystem: recursive copy with byte-level progress, old dir kept. + std::fs::create_dir_all(&target) + .map_err(|e| anyhow!("Can't create {}: {e}", target.display()))?; + let mut copied = 0u64; + copy_tree(&source, &target, &mut copied, total, &on_progress) + .map_err(|e| anyhow!("Copy failed: {e}"))?; + + // Verify aggregate size (checkpoint made orx.db the single source of truth, + // so a size match is a strong signal the copy is complete). + on_progress(MoveProgress { + phase: MovePhase::Verifying, + copied_bytes: copied, + total_bytes: total, + }); + let copied_size = dir_size(&target); + if copied_size < total { + return Err(anyhow!( + "Verification failed: copied {} but expected {}. Old data left untouched.", + human_bytes(copied_size), + human_bytes(total) + )); + } + + finalize(&target, total, &on_progress)?; + Ok(MoveOutcome { + path: target.to_string_lossy().into_owned(), + // Copy path leaves the source in place — reported so it can be cleaned up. + old_path_left: Some(source.to_string_lossy().into_owned()), + }) +} + +/// Persist the new path and emit the finalizing tick. After this, every +/// subsequent `Store::open()` resolves `store::data_dir()` to `target`. +fn finalize(target: &Path, total: u64, on_progress: &impl Fn(MoveProgress)) -> Result<()> { + on_progress(MoveProgress { + phase: MovePhase::Finalizing, + copied_bytes: total, + total_bytes: total, + }); + crate::config::set_settings_data_dir(Some(target.to_string_lossy().into_owned())) +} + +/// Recursively copy `src` into `dst` (both dirs), accumulating copied bytes into +/// `*copied` and reporting progress. Preserves mtimes best-effort. +fn copy_tree( + src: &Path, + dst: &Path, + copied: &mut u64, + total: u64, + on_progress: &impl Fn(MoveProgress), +) -> std::io::Result<()> { + for entry in std::fs::read_dir(src)? { + let entry = entry?; + let from = entry.path(); + let to = dst.join(entry.file_name()); + let ft = entry.file_type()?; + if ft.is_dir() { + std::fs::create_dir_all(&to)?; + copy_tree(&from, &to, copied, total, on_progress)?; + } else if ft.is_file() { + let n = std::fs::copy(&from, &to)?; + *copied += n; + on_progress(MoveProgress { + phase: MovePhase::Copying, + copied_bytes: *copied, + total_bytes: total, + }); + } + // Symlinks and other special files are skipped — the data dir holds none. + } + Ok(()) +} + +/// Recursive byte size of a directory tree (files only). Missing dir → 0. +fn dir_size(dir: &Path) -> u64 { + let mut total = 0u64; + let Ok(entries) = std::fs::read_dir(dir) else { + return 0; + }; + for entry in entries.flatten() { + let Ok(ft) = entry.file_type() else { continue }; + if ft.is_dir() { + total += dir_size(&entry.path()); + } else if ft.is_file() { + total += entry.metadata().map(|m| m.len()).unwrap_or(0); + } + } + total +} + +/// Case/normalization-tolerant path equality after best-effort canonicalization. +fn paths_equal(a: &Path, b: &Path) -> bool { + let ca = a.canonicalize(); + match ca { + Ok(ca) => ca == *b || ca == b.canonicalize().unwrap_or_else(|_| b.to_path_buf()), + Err(_) => a == b, + } +} + +/// Whether two paths live on the same filesystem device (so a `rename` works). +/// Best-effort: unknown → false (forces the safe copy path). +fn same_device(a: &Path, b: &Path) -> bool { + match (device_of(a), device_of(b)) { + (Some(da), Some(db)) => da == db, + _ => false, + } +} + +#[cfg(unix)] +fn device_of(path: &Path) -> Option { + use std::os::unix::fs::MetadataExt; + // Walk up to the first existing ancestor (target may not exist yet). + let mut p = path; + loop { + if let Ok(md) = std::fs::metadata(p) { + return Some(md.dev()); + } + p = p.parent()?; + } +} + +#[cfg(not(unix))] +fn device_of(_path: &Path) -> Option { + None +} + +/// Free bytes available to a non-root user on the filesystem containing `path`. +/// `None` when it can't be determined (non-unix, or the syscall fails). +#[cfg(unix)] +fn available_bytes(path: &Path) -> Option { + use std::ffi::CString; + use std::os::unix::ffi::OsStrExt; + + // Walk up to the first existing ancestor. + let mut p = path; + while !p.exists() { + p = p.parent()?; + } + let c = CString::new(p.as_os_str().as_bytes()).ok()?; + // SAFETY: `stat` is zeroed then filled by statvfs; c is a valid CString. + let mut stat: libc::statvfs = unsafe { std::mem::zeroed() }; + let rc = unsafe { libc::statvfs(c.as_ptr(), &mut stat) }; + if rc != 0 { + return None; + } + // Available blocks to non-root × fragment size. + Some(stat.f_bavail as u64 * stat.f_frsize as u64) +} + +#[cfg(not(unix))] +fn available_bytes(_path: &Path) -> Option { + None +} + +#[cfg(test)] +mod tests { + use super::*; + + fn tmp() -> PathBuf { + // Unique-enough temp dir without external crates: pid + a monotonic-ish + // counter baked into the caller's path. + std::env::temp_dir().join(format!("orx-datadir-test-{}", std::process::id())) + } + + #[test] + fn rejects_non_absolute() { + let err = validate_target(Path::new("relative/path"), TargetIntent::Move).unwrap_err(); + assert!(err.to_string().contains("absolute")); + } + + #[test] + fn dir_size_sums_files() { + let base = tmp().join("size"); + let _ = std::fs::remove_dir_all(&base); + std::fs::create_dir_all(base.join("sub")).unwrap(); + std::fs::write(base.join("a.txt"), b"hello").unwrap(); // 5 + std::fs::write(base.join("sub/b.txt"), b"world!!").unwrap(); // 7 + assert_eq!(dir_size(&base), 12); + std::fs::remove_dir_all(&base).unwrap(); + } + + #[test] + fn copy_tree_roundtrip() { + let base = tmp().join("copy"); + let _ = std::fs::remove_dir_all(&base); + let src = base.join("src"); + let dst = base.join("dst"); + std::fs::create_dir_all(src.join("run-logs")).unwrap(); + std::fs::write(src.join("orx.db"), vec![7u8; 2048]).unwrap(); + std::fs::write(src.join("run-logs/r.log"), b"log line\n").unwrap(); + std::fs::create_dir_all(&dst).unwrap(); + + let total = dir_size(&src); + let mut copied = 0u64; + copy_tree(&src, &dst, &mut copied, total, &|_| {}).unwrap(); + + assert_eq!(dir_size(&dst), total); + assert_eq!(copied, total); + assert_eq!(std::fs::read(dst.join("orx.db")).unwrap().len(), 2048); + assert_eq!( + std::fs::read(dst.join("run-logs/r.log")).unwrap(), + b"log line\n" + ); + std::fs::remove_dir_all(&base).unwrap(); + } +} diff --git a/src/local/mod.rs b/src/local/mod.rs index d8b4ee70..405e6463 100644 --- a/src/local/mod.rs +++ b/src/local/mod.rs @@ -10,6 +10,7 @@ pub mod chat; pub mod codex; +pub mod datadir; pub mod experiments; pub mod files; pub mod git; diff --git a/src/store.rs b/src/store.rs index c904fdf2..8f4a1922 100644 --- a/src/store.rs +++ b/src/store.rs @@ -19,20 +19,100 @@ use crate::error::{anyhow, Result}; use crate::local::model::{LocalExperiment, LocalProject}; pub fn data_dir() -> PathBuf { - if let Some(dir) = std::env::var_os("ORX_DATA_DIR") { - return PathBuf::from(dir); + // Resolution order (most to least authoritative): + // 1. $ORX_DATA_DIR — explicit imperative override (launch.json, tests, + // the Codex sandbox pin). Stays on top so a forced path always wins. + // 2. persisted user choice (config_dir()/settings.json `dataDir`) — set + // from the UI's Storage settings. Read fresh every call (no cache) so a + // just-completed data-dir move is picked up by the next Store::open(). + // 3. $XDG_DATA_HOME/openresearch — ambient system default *base*; an + // explicit UI choice rightly beats it, so it sits below (2). + // 4. ~/.local/share/openresearch — hardcoded default. + if let Some(dir) = env_path("ORX_DATA_DIR") { + return dir; } - let base = std::env::var_os("XDG_DATA_HOME") + if let Some(dir) = crate::config::settings_data_dir() { + return dir; + } + xdg_default_data_dir() +} + +/// Read an env var as a path, treating unset **and empty** the same (an empty +/// `export ORX_DATA_DIR=` is a shell footgun that must not resolve to `""`). +fn env_path(key: &str) -> Option { + std::env::var_os(key) + .filter(|v| !v.is_empty()) .map(PathBuf::from) - .unwrap_or_else(|| { - dirs::home_dir() - .unwrap_or_else(|| PathBuf::from(".")) - .join(".local") - .join("share") - }); +} + +/// `$XDG_DATA_HOME/openresearch` else `~/.local/share/openresearch` — the tail +/// of the resolution chain, shared by `data_dir()` and `default_data_dir()`. +fn xdg_default_data_dir() -> PathBuf { + let base = env_path("XDG_DATA_HOME").unwrap_or_else(|| { + dirs::home_dir() + .unwrap_or_else(|| PathBuf::from(".")) + .join(".local") + .join("share") + }); base.join("openresearch") } +/// The data dir ignoring any persisted user choice — where resolution would +/// land if `settings.json` had no `dataDir`. Used by the Storage UI to show the +/// "(default)" path and offer resetting to it. `$ORX_DATA_DIR` still wins, since +/// it's a forced override. +pub fn default_data_dir() -> PathBuf { + if let Some(dir) = env_path("ORX_DATA_DIR") { + return dir; + } + xdg_default_data_dir() +} + +/// Where `data_dir()`'s answer came from — surfaced by the Storage settings API +/// so the UI can explain a forced env override (read-only) vs. a user choice. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] +#[serde(rename_all = "lowercase")] +pub enum DataDirSource { + /// `$ORX_DATA_DIR` is set — forces the path, UI field is read-only. + Env, + /// Persisted user choice in `settings.json`. + Config, + /// Derived from `$XDG_DATA_HOME` (no user choice). + Xdg, + /// Hardcoded `~/.local/share/openresearch`. + Default, +} + +/// Classify the current `data_dir()` resolution for the Storage settings UI. +pub fn data_dir_source() -> DataDirSource { + if env_path("ORX_DATA_DIR").is_some() { + return DataDirSource::Env; + } + if crate::config::settings_data_dir().is_some() { + return DataDirSource::Config; + } + if env_path("XDG_DATA_HOME").is_some() { + return DataDirSource::Xdg; + } + DataDirSource::Default +} + +/// Compact human-readable byte size (e.g. `1.2 KB`, `3.4 MB`). Shared by the +/// artifacts listing and the data-dir move so the two don't drift. +pub fn human_bytes(n: u64) -> String { + const UNITS: [&str; 5] = ["B", "KB", "MB", "GB", "TB"]; + if n < 1024 { + return format!("{n} B"); + } + let mut size = n as f64; + let mut unit = 0; + while size >= 1024.0 && unit < UNITS.len() - 1 { + size /= 1024.0; + unit += 1; + } + format!("{:.1} {}", size, UNITS[unit]) +} + pub fn log_path(run_id: &str) -> PathBuf { // Run ids are server-issued UUIDs; sanitize anyway so a hostile id can't // escape the log dir. @@ -211,6 +291,17 @@ impl Store { Ok(self.conn.unchecked_transaction()?) } + /// Coalesce the WAL back into the main `orx.db` file and truncate it, so a + /// filesystem-level copy of `orx.db` alone captures all committed data. + /// Best-effort — used before relocating the data dir. Errors are returned so + /// the caller can decide, but a busy checkpoint is non-fatal (the WAL sidecar + /// gets copied too when present). + pub fn checkpoint(&self) -> Result<()> { + self.conn + .pragma_update(None, "wal_checkpoint", "TRUNCATE")?; + Ok(()) + } + pub fn upsert_run(&self, run: &StoredRun) -> Result<()> { self.conn.execute( "INSERT INTO runs (id, experiment_id, project_id, status, backend_json, command, @@ -281,6 +372,18 @@ impl Store { Ok(rows.collect::, _>>()?) } + /// Count runs in an active state (`starting`/`running`) — SQL-side and + /// unbounded, so a long-running job older than the newest N rows still + /// counts. Used by the data-dir move's in-flight guard. + pub fn count_active_runs(&self) -> Result { + let n: i64 = self.conn.query_row( + "SELECT COUNT(*) FROM runs WHERE status IN ('starting', 'running')", + [], + |r| r.get(0), + )?; + Ok(n as usize) + } + pub fn list_runs_by_project(&self, project_id: &str) -> Result> { let mut stmt = self.conn.prepare(&format!( "{SELECT_RUN} WHERE project_id = ?1 ORDER BY created_at DESC" @@ -798,3 +901,15 @@ pub fn now_ms() -> i64 { .map(|d| d.as_millis() as i64) .unwrap_or(0) } + +#[cfg(test)] +mod tests { + use super::human_bytes; + + #[test] + fn human_bytes_scales() { + assert_eq!(human_bytes(512), "512 B"); + assert_eq!(human_bytes(2048), "2.0 KB"); + assert_eq!(human_bytes(5 * 1024 * 1024), "5.0 MB"); + } +} diff --git a/src/telemetry.rs b/src/telemetry.rs index 423bc217..8deb9103 100644 --- a/src/telemetry.rs +++ b/src/telemetry.rs @@ -83,6 +83,30 @@ pub(crate) struct Settings { /// Set by `orx telemetry off`. `Some(true)` = user opted out persistently. #[serde(default)] pub telemetry_disabled: Option, + /// User-chosen data directory (Storage settings). Absent = fall back to the + /// env/XDG/default chain in `store::data_dir()`. Persisted here — in the one + /// `settings.json` — so a write can't clobber `install_id`/`telemetry_disabled` + /// (each mutation re-reads and patches only its own field via `mutate_settings`). + #[serde(default)] + pub data_dir: Option, +} + +/// The persisted data-dir choice, if any (non-empty). Read by `store::data_dir()` +/// on every open — so it goes through the plain `load_settings` reader, not the +/// locked RMW path. `crate::config` re-exports this as `settings_data_dir`. +pub(crate) fn persisted_data_dir() -> Option { + load_settings() + .and_then(|s| s.data_dir) + .filter(|s| !s.is_empty()) +} + +/// Set or clear the persisted data dir, preserving every other settings field. +/// Routes through `mutate_settings` so it inherits the in-process mutex, the +/// cross-process flock, the atomic temp+rename, and the corrupt-file refusal — +/// the same guarantees `orx telemetry off` relies on. `crate::config` re-exports +/// this as `set_settings_data_dir`. +pub(crate) fn set_persisted_data_dir(data_dir: Option) -> std::io::Result<()> { + mutate_settings(|s| s.data_dir = data_dir.filter(|v| !v.is_empty())) } fn settings_path() -> PathBuf { @@ -690,6 +714,44 @@ mod tests { let _ = std::fs::remove_dir_all(&dir); } + #[test] + fn data_dir_and_telemetry_fields_dont_clobber_each_other() { + // Regression: the Storage feature persists `data_dir` in the *same* + // settings.json telemetry owns. Both must go through mutate_settings so a + // data-dir write preserves install_id/telemetry_disabled and vice-versa — + // otherwise a completed data-dir move reverts on the next CLI run. + let _g = EnvGuard::new(OPT_VARS); + let dir = std::env::temp_dir().join(format!("orx-tel-datadir-{}", uuid::Uuid::new_v4())); + std::env::set_var("XDG_CONFIG_HOME", &dir); + + set_persisted_disabled(true).unwrap(); // telemetry_disabled + let id = install_id().expect("install id"); // install_id + set_persisted_data_dir(Some("/tmp/orx-moved".into())).unwrap(); // data_dir + + let s = load_settings().expect("settings present"); + assert_eq!(s.data_dir.as_deref(), Some("/tmp/orx-moved")); + assert_eq!( + s.telemetry_disabled, + Some(true), + "opt-out survived data-dir write" + ); + assert_eq!( + s.install_id.as_deref(), + Some(id.as_str()), + "install id survived" + ); + assert_eq!(persisted_data_dir().as_deref(), Some("/tmp/orx-moved")); + + // Clearing the data dir leaves the telemetry fields intact. + set_persisted_data_dir(None).unwrap(); + let s = load_settings().expect("settings present"); + assert!(s.data_dir.is_none(), "data_dir cleared"); + assert_eq!(s.telemetry_disabled, Some(true), "opt-out still intact"); + assert!(persisted_data_dir().is_none()); + + let _ = std::fs::remove_dir_all(&dir); + } + #[test] fn install_id_is_stable() { let _g = EnvGuard::new(OPT_VARS); diff --git a/ui/dist/assets/index-CtziJBfO.css b/ui/dist/assets/index-CdGBhMp-.css similarity index 51% rename from ui/dist/assets/index-CtziJBfO.css rename to ui/dist/assets/index-CdGBhMp-.css index fd040e38..05dd3df4 100644 --- a/ui/dist/assets/index-CtziJBfO.css +++ b/ui/dist/assets/index-CdGBhMp-.css @@ -1,4 +1,4 @@ -:root{--diff-background-color:initial;--diff-text-color:initial;--diff-font-family:Consolas,Courier,monospace;--diff-selection-background-color:#b3d7ff;--diff-selection-text-color:var(--diff-text-color);--diff-gutter-insert-background-color:#d6fedb;--diff-gutter-insert-text-color:var(--diff-text-color);--diff-gutter-delete-background-color:#fadde0;--diff-gutter-delete-text-color:var(--diff-text-color);--diff-gutter-selected-background-color:#fffce0;--diff-gutter-selected-text-color:var(--diff-text-color);--diff-code-insert-background-color:#eaffee;--diff-code-insert-text-color:var(--diff-text-color);--diff-code-delete-background-color:#fdeff0;--diff-code-delete-text-color:var(--diff-text-color);--diff-code-insert-edit-background-color:#c0dc91;--diff-code-insert-edit-text-color:var(--diff-text-color);--diff-code-delete-edit-background-color:#f39ea2;--diff-code-delete-edit-text-color:var(--diff-text-color);--diff-code-selected-background-color:#fffce0;--diff-code-selected-text-color:var(--diff-text-color);--diff-omit-gutter-line-color:#cb2a1d}.diff{background-color:var(--diff-background-color);border-collapse:collapse;color:var(--diff-text-color);table-layout:fixed;width:100%}.diff::-moz-selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff::selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff td{padding-bottom:0;padding-top:0;vertical-align:top}.diff-line{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);line-height:1.5}.diff-gutter>a{color:inherit;display:block}.diff-gutter{cursor:pointer;padding:0 1ch;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-gutter-insert{background-color:#d6fedb;background-color:var(--diff-gutter-insert-background-color);color:var(--diff-text-color);color:var(--diff-gutter-insert-text-color)}.diff-gutter-delete{background-color:#fadde0;background-color:var(--diff-gutter-delete-background-color);color:var(--diff-text-color);color:var(--diff-gutter-delete-text-color)}.diff-gutter-omit{cursor:default}.diff-gutter-selected{background-color:#fffce0;background-color:var(--diff-gutter-selected-background-color);color:var(--diff-text-color);color:var(--diff-gutter-selected-text-color)}.diff-code{word-wrap:break-word;padding:0 0 0 .5em;white-space:pre-wrap;word-break:break-all}.diff-code-edit{color:inherit}.diff-code-insert{background-color:#eaffee;background-color:var(--diff-code-insert-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-text-color)}.diff-code-insert .diff-code-edit{background-color:#c0dc91;background-color:var(--diff-code-insert-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-edit-text-color)}.diff-code-delete{background-color:#fdeff0;background-color:var(--diff-code-delete-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-text-color)}.diff-code-delete .diff-code-edit{background-color:#f39ea2;background-color:var(--diff-code-delete-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-edit-text-color)}.diff-code-selected{background-color:#fffce0;background-color:var(--diff-code-selected-background-color);color:var(--diff-text-color);color:var(--diff-code-selected-text-color)}.diff-widget-content{vertical-align:top}.diff-gutter-col{width:7ch}.diff-gutter-omit{height:0}.diff-gutter-omit:before{background-color:#cb2a1d;background-color:var(--diff-omit-gutter-line-color);content:" ";display:block;height:100%;margin-left:4.6ch;overflow:hidden;white-space:pre;width:2px}.diff-decoration{line-height:1.5;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-decoration-content{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);padding:0}:root{--base: #ffffff;--canvas: #faf8f4;--panel: #f3f0ea;--surface: #faf7f2;--surface-bright: #fdfbfb;--highlight: #fdf3f1;--text: #1d1b1a;--subtext: #737373;--muted: #a1a1a1;--primary: #9a2036;--primary-subtle: #f7e9ec;--secondary: #4a90e2;--error: #e2a100;--border: #d4d4d4;--border-variant: #e5e5e5;--accent-orange: #da642c;--accent-red: #d94654;--accent-teal: #209a84;--accent-blue: #3a8dff;--accent-pink: #ff2b90;--accent-amber: #da9100;--accent-green: #5eb64c;--accent-purple: #9c5cff;--accent-green-subtle: #e7f4e5;--accent-amber-subtle: #fff3e1;--accent-teal-subtle: #e1f3f0;--accent-red-subtle: #fbe9ea;--accent-blue-subtle: #e5f0ff;--accent-purple-subtle: #f1e8ff;--dots-muted: #e3ded5;--dots-strong: #bdb6a8;--mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;--readable-col: 760px;--bg: var(--base);--bg-canvas: var(--canvas);--surface-2: var(--panel);--border-strong: var(--border);--accent: var(--primary);--teal: var(--accent-teal);--green: var(--accent-green);--red: var(--accent-red);--amber: var(--accent-amber);--purple: var(--accent-purple);color-scheme:light}@media(prefers-color-scheme:dark){:root{--base: #0e0c0c;--canvas: #141110;--panel: #221f1e;--surface: #1d1b1a;--surface-bright: #130f0f;--highlight: #393433;--text: #e6e1e0;--subtext: #a68e8b;--muted: #737373;--primary: #ffb3ad;--primary-subtle: #33191b;--secondary: #3e7fcf;--error: #ffb951;--border: #525252;--border-variant: #404040;--accent-amber: #e67e22;--accent-green-subtle: #1c2b18;--accent-amber-subtle: #33260f;--accent-teal-subtle: #12332d;--accent-red-subtle: #331418;--accent-blue-subtle: #10233a;--accent-purple-subtle: #251933;--dots-muted: #2a2523;--dots-strong: #555555;color-scheme:dark}}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--base);color:var(--text);font-family:var(--sans);font-size:14px;line-height:1.45;overflow:hidden}::selection{background:var(--highlight)}button{font:inherit;color:inherit;background:none;border:none;cursor:pointer;padding:0}input,textarea,select{font:inherit;color:var(--text);background:var(--base);border:1px solid var(--border);border-radius:0;padding:6px 10px;outline:none}input:focus,textarea:focus,select:focus{border-color:var(--text)}input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background:var(--border);border-radius:5px;border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-track{background:transparent}@keyframes pulse{50%{opacity:.35}}@keyframes spin{to{transform:rotate(360deg)}}.app{display:flex;flex-direction:column;height:100%}.app-body{display:flex;flex:1;min-height:0;padding:0 14px}.home{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges;background:var(--canvas)}.home-inner{max-width:620px;margin:0 auto;padding:48px 24px 64px}.home-brand{font-weight:800;font-size:28px;letter-spacing:-.02em;margin-bottom:36px}.home-brand span{color:var(--primary)}.home-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.home-head h2{margin:0;font-size:18px;letter-spacing:-.01em}.home-list{display:flex;flex-direction:column;gap:10px}.project-card{position:relative;display:flex;flex-direction:column;gap:4px;text-align:left;padding:14px 16px;background:var(--base);border:1px solid var(--border);border-radius:10px;cursor:pointer;transition:border-color .12s ease,box-shadow .12s ease}.project-card:hover{border-color:var(--text);box-shadow:0 2px 10px #0000000f}.project-delete{position:absolute;top:10px;right:10px;display:none;padding:5px;border-radius:6px;color:var(--muted);line-height:0}.project-card:hover .project-delete{display:block}.project-delete:hover{color:var(--danger, #d33);background:var(--overlay, rgba(0, 0, 0, .05))}.project-card .name{font-weight:600;font-size:14px}.project-card .repo{color:var(--subtext)}.project-card .paper,.project-card .time{font-size:11px;color:var(--muted)}.rail-brand{display:flex;align-items:center;gap:4px;height:48px;padding:0 8px 0 12px;border-bottom:1px solid var(--border);flex-shrink:0}.rail-brand .brand{display:flex;align-items:center;gap:8px;flex:1;min-width:0;font-weight:600;font-size:13px;color:var(--text);padding:4px 6px 4px 0;border-radius:6px}.rail-brand .brand:hover{color:var(--subtext)}.rail-brand .brand svg{flex-shrink:0}.rail-brand .brand .brand-project{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;color:var(--subtext)}.icon-btn:hover{color:var(--text);background:var(--surface)}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:6px 14px;font-size:12px;font-weight:600;border:1px solid var(--border);border-radius:8px;background:var(--base);color:var(--text);white-space:nowrap;transition:background .12s ease,border-color .12s ease,color .12s ease}.btn:hover:not(:disabled){background:var(--surface)}.btn:active:not(:disabled){background:var(--highlight)}.btn:disabled{opacity:.45;cursor:default}.btn.primary{background:var(--primary);border-color:var(--primary);color:var(--base)}.btn.primary:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text));border-color:color-mix(in oklab,var(--primary) 88%,var(--text))}.btn.primary:active:not(:disabled){background:color-mix(in oklab,var(--primary) 80%,var(--text));border-color:color-mix(in oklab,var(--primary) 80%,var(--text))}.btn.danger{color:var(--accent-red)}.btn.danger:hover:not(:disabled){background:color-mix(in oklab,var(--accent-red) 8%,transparent)}.btn.danger:active:not(:disabled){background:color-mix(in oklab,var(--accent-red) 14%,transparent)}.btn.ghost{border-color:transparent;color:var(--subtext)}.btn.ghost:hover:not(:disabled){color:var(--text);background:var(--surface)}.btn.sm{padding:3px 9px;font-size:11px;border-radius:6px}.status-badge{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:var(--subtext);text-transform:capitalize;white-space:nowrap}.status-badge .dot{width:7px;height:7px;border-radius:50%;background:currentColor;flex-shrink:0}.status-badge.live .dot{animation:pulse 1.2s ease-in-out infinite}.st-done .dot{color:var(--accent-green)}.st-failed .dot{color:var(--accent-red)}.st-running .dot{color:var(--accent-teal)}.st-starting .dot{color:var(--accent-amber)}.st-cancelled .dot{color:var(--accent-orange)}.st-editing .dot{color:var(--accent-purple)}.st-idle .dot{color:var(--muted)}.floating-panel{border:1px solid var(--border);border-radius:10px;box-shadow:0 6px 24px color-mix(in oklab,var(--text) 5%,transparent),0 1px 4px color-mix(in oklab,var(--text) 4%,transparent);overflow:hidden}.session-rail{width:232px;flex-shrink:0;display:flex;flex-direction:column;margin:10px 14px 10px 0;background:var(--base);min-height:0}.rail-nav{display:flex;flex-direction:column;gap:2px;padding:8px;flex-shrink:0}.rail-nav-item{display:flex;align-items:center;gap:10px;padding:7px 10px;font-size:12.5px;color:var(--subtext);border-radius:8px;text-align:left}.rail-nav-item:hover{background:var(--surface);color:var(--text)}.rail-nav-item.active{background:var(--panel);color:var(--text);font-weight:600}.rail-section-label{padding:10px 10px 6px;font-size:12px;font-weight:500;color:var(--muted)}.rail-section-head{display:flex;align-items:center;justify-content:space-between}.rail-filter{position:relative;display:inline-flex;margin-right:2px}.rail-filter-btn{width:24px;height:24px;border-radius:6px}.rail-empty{padding:6px 10px;font-size:12px;color:var(--muted)}.session-rail .rail-body{flex:1;min-height:0;overflow-y:auto;padding:4px 8px}.chat-pane{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--base);min-height:0}.right-pane{position:relative;flex-shrink:0;min-width:0;display:flex;flex-direction:column;margin:10px 0 10px 14px;background:var(--canvas)}.right-pane.max{position:fixed;top:10px;right:10px;bottom:10px;left:10px;margin:0;z-index:60;box-shadow:0 12px 40px color-mix(in oklab,var(--text) 22%,transparent)}.panel-resizer{position:absolute;left:0;top:0;bottom:0;width:6px;cursor:col-resize;z-index:30}.panel-resizer:hover,.panel-resizer:active{background:color-mix(in oklab,var(--text) 12%,transparent)}.panel-controls{display:inline-flex;align-items:center;gap:2px;flex-shrink:0}.tabs{display:flex;align-items:center;gap:4px;padding:0 10px;height:40px;border-bottom:1px solid var(--border);background:var(--base);flex-shrink:0}.tab-strip{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow-x:auto;scrollbar-width:none}.tab-strip::-webkit-scrollbar{display:none}.tab.closable{max-width:176px;padding-right:4px}.tab .tab-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tab .tab-close{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:4px;color:var(--muted);flex-shrink:0}.tab .tab-close:hover{background:color-mix(in oklab,var(--text) 15%,transparent);color:var(--text)}.tab{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;font-size:12px;font-weight:600;color:var(--subtext);border-radius:6px;white-space:nowrap;flex-shrink:0}.tab:hover{color:var(--text)}.tab.active{color:var(--text);background:var(--surface)}.tab .tab-count{font-family:var(--mono);font-weight:400;color:var(--muted)}.tab-body{flex:1;min-height:0;position:relative;display:flex;flex-direction:column}.pane-toolbar{display:flex;align-items:center;justify-content:flex-end;padding:10px 12px 0;flex-shrink:0}.pane-content{flex:1;min-height:0;position:relative}.seg{display:inline-flex;align-items:center;gap:2px;padding:3px;border-radius:9px;background:color-mix(in oklab,var(--text) 10%,transparent)}.seg button{padding:3px 12px;font-size:12px;font-weight:600;color:var(--subtext);border-radius:6px}.seg button:hover{color:var(--text)}.seg button.active{background:var(--base);color:var(--text);box-shadow:0 1px 3px color-mix(in oklab,var(--text) 25%,transparent)}.chat-header{display:flex;align-items:center;gap:8px;padding:0 16px;background:var(--base);flex-shrink:0;height:48px;position:relative;z-index:4;width:100%;max-width:var(--readable-col);margin:0 auto}.chat-header.rail-hidden{max-width:none;padding:0 2px}.chat-header.rail-hidden>.icon-btn:first-child{margin-right:12px}.chat-header:after{content:"";position:absolute;top:100%;left:0;right:0;height:24px;background:linear-gradient(to bottom,var(--base),transparent);pointer-events:none}.chat-header .title{font-size:13px;font-weight:600;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row{position:relative;display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:7px 10px;border-radius:8px;font-size:12.5px;color:var(--subtext);cursor:pointer;-webkit-user-select:none;user-select:none}.session-row:hover{background:var(--surface);color:var(--text)}.session-row.active{color:var(--text);background:var(--surface);font-weight:500}.session-row .session-dot{width:14px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.session-row .session-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row .session-time{font-size:10px;font-family:var(--mono);color:var(--muted);flex-shrink:0}.session-row .session-menu-btn{display:none;align-items:center;justify-content:center;width:18px;height:18px;margin:-2px 0;border-radius:5px;color:var(--muted);flex-shrink:0}.session-row .session-menu-btn:hover{color:var(--text);background:var(--panel)}.session-row:hover .session-menu-btn,.session-row:focus-within .session-menu-btn,.session-row.menu-open .session-menu-btn{display:inline-flex}.session-row:hover .session-time,.session-row:focus-within .session-time,.session-row.menu-open .session-time{display:none}.session-row .busy-dot{width:7px;height:7px;border-radius:50%;background:var(--primary);animation:pulse 1.2s infinite;flex-shrink:0}.session-row .session-title-input{flex:1;min-width:0;padding:1px 5px;margin:-2px 0;font:inherit;color:var(--text);background:var(--base);border:1px solid var(--primary);border-radius:5px;outline:none}.session-row.editing{background:var(--surface);cursor:default}.session-row.editing .session-menu-btn,.session-row.editing .session-time{display:none}.chat-thread{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.chat-thread-inner{max-width:var(--readable-col);margin:0 auto;padding:16px 16px 32px;display:flex;flex-direction:column;gap:16px}.chat-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:var(--subtext);padding:20px;text-align:center}.chat-empty h2{margin:0;font-size:34px;font-weight:700;letter-spacing:-.02em;color:var(--text)}.chat-empty h2 span{color:var(--primary)}.chat-empty .chat-empty-hint{font-size:12px;color:var(--muted);max-width:340px;text-align:center}.chat-empty p{margin:0;font-size:13px;max-width:320px}.chat-empty .chat-suggest{font-family:var(--mono);font-size:12px;color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:999px;padding:6px 14px;cursor:pointer;transition:border-color .12s ease}.chat-empty .chat-suggest:hover{border-color:var(--text)}.msg-user{align-self:flex-end;max-width:88%;background:var(--surface);border-radius:16px;padding:10px 15px;font-size:13px;white-space:pre-wrap;word-break:break-word}.msg-images{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}.msg-images img{max-width:220px;max-height:160px;border:1px solid var(--border-variant);border-radius:4px;display:block}.msg-assistant{font-size:14px;line-height:1.62;color:var(--text);min-width:0}.reasoning{color:var(--muted);font-size:12px;margin:2px 0}.reasoning summary{cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;font-weight:600}.reasoning[open]{white-space:pre-wrap}.tool-group{margin:2px 0}.tool-group-summary{display:flex;align-items:center;gap:8px;width:100%;padding:3px 2px;cursor:pointer;color:var(--muted);font-size:12.5px;text-align:left;border-radius:6px}.tool-group-summary:hover{color:var(--subtext);background:var(--surface)}.tool-group.has-error .tool-group-summary{color:var(--accent-red)}.tool-chevron{flex-shrink:0;color:var(--muted);transition:transform .12s ease}.tool-chevron.open{transform:rotate(90deg)}.tool-group-rows{display:flex;flex-direction:column;gap:1px;margin:2px 0 4px 7px;padding-left:10px;border-left:1px solid var(--border-variant)}.tool-row{display:flex;flex-direction:column}.tool-row summary{display:flex;align-items:center;gap:8px;padding:3px 4px;cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;min-width:0;border-radius:5px}.tool-row summary:hover{background:var(--surface)}.tool-row summary::-webkit-details-marker{display:none}.tool-line{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;color:var(--subtext)}.tool-open{flex-shrink:0;font-size:11px;color:var(--primary)}.tool-open:hover{text-decoration:underline}.tool-status{width:6px;height:6px;border-radius:50%;flex-shrink:0;background:var(--muted)}.tool-status.running{background:var(--accent-amber);animation:pulse 1.2s ease-in-out infinite}.tool-status.error{background:var(--accent-red)}.tool-detail{margin:2px 0 4px 14px}.tool-cmd-full{padding:6px 10px;font-family:var(--mono);font-size:11px;color:var(--text);background:var(--surface);border-radius:5px;white-space:pre-wrap;word-break:break-word}.tool-output{margin-top:3px;padding:6px 10px;font-family:var(--mono);font-size:11px;color:var(--subtext);white-space:pre-wrap;word-break:break-word;max-height:260px;overflow-y:auto;background:var(--base);border:1px solid var(--border-variant);border-radius:5px}.working{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:12.5px;padding:2px 0 8px}.spinner{width:13px;height:13px;border:2px solid var(--border);border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite;flex-shrink:0}.composer{padding:0 12px 12px;flex-shrink:0;position:relative;z-index:4;background:var(--base);width:100%;max-width:var(--readable-col);margin:0 auto}.composer:before{content:"";position:absolute;bottom:100%;left:0;right:0;height:24px;background:linear-gradient(to top,var(--base),transparent);pointer-events:none}.composer-box{position:relative;display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;background:var(--base)}.composer textarea{border:none;background:none;resize:none;padding:10px 12px 4px;font-size:13px;min-height:42px;max-height:180px}.composer-attachments{display:flex;flex-wrap:wrap;gap:6px;padding:8px 12px 0}.attachment-thumb{position:relative}.attachment-thumb img{width:52px;height:52px;object-fit:cover;border:1px solid var(--border);border-radius:6px;display:block}.attachment-thumb button{position:absolute;top:-5px;right:-5px;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:1px solid var(--border);border-radius:50%;background:var(--surface);color:var(--text);cursor:pointer}.attachment-thumb button:hover{background:var(--text);color:var(--base)}.composer-actions{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:6px 8px 8px}.send-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--primary);color:var(--base);transition:background .1s ease,opacity .1s ease}.send-btn:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text))}.send-btn:disabled{opacity:.4;cursor:default}.send-btn.stop{background:var(--surface);color:var(--text)}.send-btn.stop:hover:not(:disabled){background:color-mix(in oklab,var(--surface) 88%,var(--text))}.md{min-width:0;word-break:break-word;color:var(--text);line-height:1.62}.md>*:first-child{margin-top:0}.md>*:last-child{margin-bottom:0}.md p{margin:10px 0}.md strong{color:var(--text);font-weight:600}.md pre{background:var(--surface);border:1px solid color-mix(in oklab,var(--border) 50%,transparent);border-radius:8px;padding:8px 12px;overflow-x:auto;font-size:12px;color:var(--text)}.md code{font-family:var(--mono);font-size:.9em;font-weight:500;color:var(--primary);background:var(--panel);border:1px solid var(--border-variant);padding:1px 5px}.md .file-chip{display:inline-flex;align-items:center;gap:4px;max-width:100%;margin:0 1px;padding:0 6px;vertical-align:baseline;font-family:var(--mono);font-size:.9em;font-weight:500;color:var(--text);background:var(--panel);border:1px solid var(--border-variant);cursor:pointer}.md .file-chip:hover:not(:disabled){background:var(--surface);color:var(--primary)}.md .file-chip svg{flex:none;opacity:.6}.md .file-chip-label{max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.md pre code{background:none;border:none;color:inherit;padding:0;font-weight:400}.md-code{position:relative;margin:10px 0}.md-code pre{margin:0}.md-code-copy{position:absolute;top:6px;right:6px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:var(--muted);background:var(--base);border:1px solid var(--border-variant);border-radius:6px;opacity:0;transition:opacity .12s ease,color .12s ease}.md-code:hover .md-code-copy{opacity:1}.md-code-copy:hover{color:var(--text);border-color:var(--muted)}.md h1,.md h2,.md h3,.md h4{color:var(--text);font-size:1.05em;font-weight:600;margin:12px 0 6px}.md ul,.md ol{margin:6px 0;padding-left:22px}.md li::marker{color:var(--primary)}.md a{color:var(--primary)}.md table{border-collapse:collapse;width:100%;font-size:13px;margin:10px 0;border:1px solid var(--border);border-radius:8px;overflow:hidden}.md th,.md td{border-bottom:1px solid var(--border-variant);padding:8px 14px;text-align:left;color:var(--text)}.md tr:last-child td{border-bottom:none}.md thead th{background:var(--surface);font-weight:500;color:var(--subtext);border-bottom:1px solid var(--border)}.md tbody tr:hover td{background:var(--surface-bright)}.md blockquote{margin:6px 0;padding:2px 0 2px 10px;border-left:3px solid var(--border);color:var(--subtext)}.exp-node{width:240px;border:1px solid var(--border);background:var(--base);padding:10px 12px;cursor:pointer;box-shadow:0 1px 2px #0000000a;font-size:12.5px;transition:box-shadow .12s ease}.exp-node:hover{box-shadow:0 2px 8px #00000014}.exp-node.selected{border-color:var(--text);box-shadow:0 0 0 1px var(--text)}.exp-node.live{border-color:var(--accent-teal);box-shadow:0 2px 12px #209a8433}.exp-node .node-eyebrow{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;font-family:var(--mono);font-size:9.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}.exp-node .node-head{display:flex;align-items:center;gap:7px;min-width:0}.exp-node .node-status{width:8px;height:8px;border-radius:50%;flex-shrink:0}.exp-node .node-slug{font-family:var(--mono);font-size:12px;font-weight:700;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.exp-node .node-title{margin-top:4px;color:var(--subtext);font-size:11.5px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.exp-node .node-meta{margin-top:8px;display:flex;align-items:center;gap:8px;font-size:10px;color:var(--muted);font-family:var(--mono);text-transform:uppercase;letter-spacing:.05em}.exp-node .baseline-chip{font-size:9px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);border:1px solid var(--border);padding:0 4px;flex-shrink:0}.exp-node .node-actions{margin-top:8px;padding-top:6px;border-top:1px solid var(--border-variant);display:flex;align-items:center;gap:4px}.exp-node .node-action{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;font-size:10.5px;font-weight:700;color:var(--subtext);border-radius:6px}.exp-node .node-action:hover{color:var(--text);background:var(--surface)}.run-squares{display:flex;align-items:center;gap:3px}.run-sq{width:9px;height:9px;flex-shrink:0}.run-sq.pass{background:var(--accent-green)}.run-sq.fail{border:1.5px solid color-mix(in oklab,var(--accent-red) 55%,transparent)}.run-sq.live{background:var(--accent-teal);animation:pulse 1.2s ease-in-out infinite}.run-sq.other{border:1.5px solid var(--border)}.react-flow__handle{opacity:0;pointer-events:none}.react-flow__attribution{display:none!important}.runs-table-wrap{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto;padding:12px}.runs-table{width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px;background:var(--base);border:1px solid var(--border);border-radius:10px;overflow:hidden}.runs-table th{text-align:left;color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;padding:8px 12px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--base);z-index:1}.runs-table td{padding:8px 12px;border-bottom:1px solid color-mix(in oklab,var(--text) 6%,transparent);white-space:nowrap}.runs-table tr:last-child td{border-bottom:none}.runs-table tr.clickable{cursor:pointer}.runs-table tr.clickable:hover td{background:var(--canvas)}.mono{font-family:var(--mono);font-size:11.5px}.instances-section-title{display:flex;align-items:center;gap:8px;margin:22px 0 10px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.instances-section-title .count-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--canvas);border:1px solid var(--border);font-size:11px;font-weight:500;letter-spacing:0;color:var(--text)}.instances-table-wrap{overflow-x:auto}.instances-empty{margin:0;padding:14px 16px;border:1px solid var(--border);border-radius:10px;background:var(--base);color:var(--subtext);font-size:12.5px}.backend-cell{display:inline-flex;align-items:center;gap:2px}.backend-cell .icon-btn{width:22px;height:22px}.backend-badge{display:inline-flex;align-items:center;gap:7px}.backend-badge svg{flex:none;display:block}.backend-badge .backend-name{font-weight:500}.backend-badge .backend-detail,.backend-badge.muted{color:var(--muted)}.status-chip{display:inline-flex;align-items:center;gap:6px;font-size:10px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;font-family:var(--mono)}.status-chip .dot{width:8px;height:8px;border-radius:50%}.drawer{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--base);display:flex;flex-direction:column;z-index:20}.drawer-body{flex:1;min-height:0;overflow-y:auto;padding:0 16px 24px;display:flex;flex-direction:column;gap:22px}.drawer-body>:first-child{margin-top:18px}.drawer-section h3{margin:0 0 10px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.kv{display:grid;grid-template-columns:auto 1fr;gap:3px 14px;font-size:12.5px}.kv .k{color:var(--muted)}.kv .v{font-family:var(--mono);font-size:11.5px;word-break:break-all}.term-view{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;background:var(--base);z-index:20}.term-bar{display:flex;align-items:center;gap:8px;height:40px;padding:0 10px;border-bottom:1px solid var(--border);flex-shrink:0}.term-title{min-width:0;font-size:13px;font-weight:600;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.term-bar .error{font-size:11.5px;color:var(--accent-red)}.term-bar .btn{display:inline-flex;align-items:center;gap:5px}.term-fill{flex:1;min-height:0;background:#1a1a1a;padding:4px 0 4px 6px}.term-empty{height:100%;display:flex;align-items:center;justify-content:center;padding:24px;text-align:center;font-size:12.5px;color:var(--muted)}.run-history{position:relative;flex-shrink:0}.run-picker{display:inline-flex;align-items:center;gap:8px;padding:4px 6px 4px 10px;border:1px solid var(--border);border-radius:8px;background:var(--base);color:var(--text)}.run-picker:hover{background:var(--surface)}.run-picker .run-label{font-size:12px;font-weight:600}.run-picker-chev{color:var(--muted);flex-shrink:0}.history-menu{position:absolute;top:calc(100% + 6px);right:0;min-width:230px;max-height:320px;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;padding:5px;z-index:50}.history-item{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:12px;border-radius:6px}.history-item:hover,.history-item.active{background:var(--surface)}.history-item .run-label{font-weight:600}.history-item .when{margin-left:auto;font-size:11px;color:var(--muted)}.commit-picker{display:flex;align-items:center;gap:8px}.commit-picker select{flex:1;min-width:0;font-family:var(--mono);font-size:11.5px}.uncommitted-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--accent-purple);flex-shrink:0}.changes-note{font-size:11.5px;color:var(--muted)}.empty-state{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:24px;text-align:center;color:var(--subtext)}.empty-state p{max-width:46ch;margin:0;font-size:13px;line-height:1.5;text-wrap:balance}.empty-state-cta{gap:6px}.empty-state p.empty-state-title{font-size:18px;font-weight:400;color:var(--text)}.empty-state p.empty-state-hint{font-size:15px;color:var(--subtext)}.onboarding .home-inner{max-width:560px;padding-top:96px}.onb-eyebrow{font-family:var(--mono);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:14px}.onb-eyebrow span{color:var(--primary)}.onb-title{margin:0 0 6px;font-size:22px;letter-spacing:-.01em}.onb-sub{color:var(--subtext);font-size:13.5px;line-height:1.55;margin:0 0 22px;max-width:480px}.onb-cards{display:flex;flex-direction:column;gap:10px}.onb-card{display:flex;flex-direction:column;gap:5px;background:var(--base);border:1px solid var(--border);border-radius:10px;padding:18px 20px}.onb-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.onb-card-name{font-weight:600;font-size:14px}.onb-card-detail{font-size:12px}.onb-card-meta{font-size:12px;color:var(--subtext)}.onb-card-meta code{font-family:var(--mono);font-size:11px}.onb-card-row{display:grid;grid-template-columns:56px 1fr auto;align-items:baseline;gap:12px;padding:3px 0}.onb-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:13px;padding:8px 0}.onb-gh-options{display:flex;flex-direction:column;gap:16px;margin-top:12px;padding-top:14px;border-top:1px solid var(--border-variant)}.onb-gh-option{display:flex;flex-direction:column;gap:8px}.onb-gh-option-label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--subtext)}.onb-gh-option-body{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.onb-gh-cmd{font-family:var(--mono);font-size:12px;background:var(--panel);border:1px solid var(--border-variant);border-radius:5px;padding:3px 8px}.onb-gh-hint{font-size:12px;color:var(--subtext)}.onb-gh-hint code{font-family:var(--mono);font-size:11px}.onb-gh-or{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.05em}.onb-gh-or:before,.onb-gh-or:after{content:"";flex:1;height:1px;background:var(--border-variant)}.onb-gh-option .onb-token-form{flex:1;min-width:0;margin-top:0}.onb-token-form{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:8px}.onb-token-form input{flex:1;min-width:220px;font-family:var(--mono);font-size:12px}.onb-token-form a{font-size:12px;color:var(--subtext);white-space:nowrap}.onb-token-form .error{flex-basis:100%;color:var(--accent-red);font-size:12.5px;white-space:pre-wrap}.onb-actions{display:flex;align-items:center;gap:10px;margin-top:22px}.form .form-seg{align-self:flex-start;margin-bottom:2px}.form .form-seg button{padding:5px 12px}.form .repo-hint{font-family:var(--mono);font-weight:400;text-transform:none;letter-spacing:normal;font-size:11px;color:var(--muted)}.form .repo-hint.ok{color:var(--accent-teal)}.form .paper-results{display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;max-height:240px;overflow-y:auto}.form .paper-results button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:8px 10px;background:none;border:none;border-bottom:1px solid var(--border-variant);text-align:left;font:inherit;color:var(--text);cursor:pointer}.form .paper-results button:last-child{border-bottom:none}.form .paper-results button:hover{background:var(--surface)}.form .paper-results .title{font-size:12.5px;font-weight:500}.form .paper-results .id,.form .paper-pick .id{font-family:var(--mono);font-size:11px;color:var(--muted)}.form .paper-pick{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border:1px solid var(--border);border-radius:8px;background:var(--surface)}.form .paper-pick .meta{min-width:0}.form .paper-pick .title{font-size:13px;font-weight:600}.form{display:flex;flex-direction:column;gap:10px}.form label{display:flex;flex-direction:column;gap:4px;font-size:11px;color:var(--subtext);font-weight:700;text-transform:uppercase;letter-spacing:.05em}.form .row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}.form .actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.form .error,.report-view .error,.settings-card>.error{color:var(--accent-red);font-size:12.5px;white-space:pre-wrap;text-transform:none}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#1d1b1a66;display:flex;align-items:center;justify-content:center;z-index:100}.modal{width:480px;max-width:94vw;max-height:88vh;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:12px;box-shadow:0 24px 60px #00000038;padding:24px}.modal h2{margin:0 0 14px;font-size:16px}:is(.modal,.home) :is(input,select,textarea){border-radius:8px}.settings-section+.settings-section{margin-top:18px;padding-top:16px;border-top:1px solid var(--border)}.settings-section h3{margin:0 0 8px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.settings-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:12.5px;padding:4px 0}.settings-note{margin:10px 0 0;font-size:12px;padding:8px 10px;border:2px solid var(--accent-amber);background:var(--accent-amber-subtle);color:var(--accent-amber);font-weight:600}.settings-form{margin-top:14px;padding-top:14px;border-top:1px solid var(--border)}.badge{display:inline-flex;align-items:center;font-size:10px;font-weight:700;font-family:var(--mono);text-transform:uppercase;letter-spacing:.06em;padding:1px 7px;border:1px solid var(--border);color:var(--muted)}.badge.ok{color:var(--accent-green);border-color:var(--accent-green);background:var(--accent-green-subtle)}.badge.err{color:var(--accent-red);border-color:var(--accent-red);background:var(--accent-red-subtle)}.badge.warn{color:var(--accent-amber);border-color:var(--accent-amber);background:var(--accent-amber-subtle)}.files-tab{height:100%;overflow-y:auto;padding:20px 24px 48px}.files-col{max-width:var(--readable-col);margin:0 auto;display:flex;flex-direction:column;gap:10px}.files-meta{display:flex;gap:8px;flex-wrap:wrap}.files-pill{display:inline-flex;align-items:center;gap:8px;min-width:0;border:1px solid var(--border);border-radius:8px;padding:7px 11px;background:var(--base);color:var(--text);text-decoration:none}.files-pill code{font-family:var(--mono);font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.files-pill>svg{flex-shrink:0;color:var(--muted)}a.files-pill:hover{border-color:var(--muted)}.files-pill-dir{flex:1;min-width:240px}.files-pill-dir code{flex:1;color:var(--subtext)}.files-pill-dir .icon-btn{width:22px;height:22px;margin:-4px -6px -4px 0}.files-hint{margin:0;font-size:11.5px;line-height:1.5;color:var(--muted)}.files-hint code{font-family:var(--mono);font-size:10.5px}.files-card{border:1px solid var(--border);border-radius:10px;background:var(--base);overflow:hidden;margin-top:4px}.files-card>*+*{border-top:1px solid var(--border-variant)}.ftree-row{display:flex;align-items:center;gap:8px;padding:8px 14px}.ftree-row.clickable{cursor:pointer}.ftree-row:hover{background:var(--surface)}.ftree-children{background:var(--canvas);border-top:1px solid var(--border-variant)}.ftree-children .ftree-row:hover{background:var(--panel)}.ftree-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;flex-shrink:0;color:var(--muted);transition:transform .12s ease}.ftree-chevron.open{transform:rotate(90deg)}.ftree-chevron.spacer{visibility:hidden}.ftree-dirname{flex:1;min-width:0;font-family:var(--mono);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-title{flex:1;min-width:0;font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-tag{flex-shrink:0;font-size:11px;color:var(--primary)}.ftree-status{flex-shrink:0;font-family:var(--mono);font-size:10.5px;color:var(--subtext)}.ftree-link{flex:1;min-width:0;display:flex;align-items:center;gap:8px;color:var(--text);text-decoration:none}.ftree-link:hover .ftree-name{text-decoration:underline}.ftree-name{min-width:0;font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-thumb{width:22px;height:22px;object-fit:cover;border-radius:4px;border:1px solid var(--border-variant);flex-shrink:0}.ftree-del{width:22px;height:22px;visibility:hidden}.ftree-row:hover .ftree-del{visibility:visible}.ftree-del:hover{color:var(--accent-red)}.ftree-date,.ftree-size{flex-shrink:0}.ftree-size{font-family:var(--mono);font-size:10.5px;color:var(--muted);white-space:nowrap}.ftree-divider{padding:10px 14px 4px;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}.files-empty{font-size:12.5px;line-height:1.55;color:var(--subtext);border:1px solid var(--border);border-radius:10px;background:var(--base);padding:18px;margin:4px 0 0}.files-empty code{font-family:var(--mono);font-size:11.5px}.files-truncated{margin:0;padding:8px 14px;font-size:11px;color:var(--muted)}.report-date,.ftree-date{font-size:11px;color:var(--muted);white-space:nowrap}.report-view{height:100%;overflow-y:auto;padding:16px 24px 48px}.report-view-col{max-width:var(--readable-col);margin:0 auto}.report-view-head{display:flex;align-items:center;gap:10px;margin-bottom:16px;padding-bottom:10px;border-bottom:1px solid var(--border-variant)}.report-md table{display:block;width:max-content;max-width:100%;overflow-x:auto}.report-md .report-img{display:block;margin:12px 0}.report-md .report-img img{max-width:100%;height:auto;border:1px solid var(--border)}.report-md .report-img-caption{display:block;margin-top:4px;text-align:center;font-size:11.5px;color:var(--subtext)}.openresearch-diff{display:flex;flex-direction:column;gap:16px}.diff-file-card{border:1px solid var(--border);border-radius:8px;background:var(--base)}.diff-file-header{position:sticky;top:0;z-index:10;display:flex;align-items:center;justify-content:space-between;gap:12px;margin:-1px -1px 0;width:calc(100% + 2px);text-align:left;padding:8px 12px;cursor:pointer}.diff-file-header:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-2;background:var(--base)}.diff-file-header:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;background:var(--canvas);border:1px solid var(--border);border-radius:8px 8px 0 0}.diff-file-header .chev{color:var(--muted);font-size:10px;flex-shrink:0;width:12px}.diff-file-header .path{display:flex;align-items:center;gap:8px;min-width:0;flex:1}.diff-file-header .path code{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--mono);font-size:.7rem;font-weight:700;color:var(--text)}.diff-file-header .stats{display:flex;align-items:center;gap:8px;flex-shrink:0;font-family:var(--mono);font-size:.65rem;font-weight:700;font-variant-numeric:tabular-nums}.diff-stat-add{color:var(--accent-green)}.diff-stat-del{color:var(--accent-red)}.diff-empty{padding:8px 12px;color:var(--muted);font-size:12.5px}.truncated-notice{border:2px solid var(--accent-amber);background:var(--accent-amber-subtle);padding:12px 14px;font-size:12.5px}.truncated-notice h4{margin:0 0 4px;font-size:13px;color:var(--accent-amber)}.truncated-notice p{margin:0;color:var(--subtext)}.openresearch-diff .openresearch-diff-file{--openresearch-diff-selection-background-color: color-mix( in oklab, var(--surface) 76%, var(--primary) );--openresearch-diff-gutter-selection-background-color: color-mix( in oklab, var(--surface) 68%, var(--primary) );--openresearch-diff-insert-gutter-background-color: color-mix( in oklab, var(--base) 84%, var(--accent-green) );--openresearch-diff-delete-gutter-background-color: color-mix( in oklab, var(--base) 86%, var(--accent-red) );--openresearch-diff-insert-code-background-color: color-mix( in oklab, var(--base) 91%, var(--accent-green) );--openresearch-diff-delete-code-background-color: color-mix( in oklab, var(--base) 92%, var(--accent-red) );--openresearch-diff-insert-edit-background-color: color-mix( in oklab, var(--base) 72%, var(--accent-green) );--openresearch-diff-delete-edit-background-color: color-mix( in oklab, var(--base) 78%, var(--accent-red) );--openresearch-diff-divider-color: var(--border);--openresearch-diff-omit-gutter-line-color: color-mix(in oklab, var(--base) 86%, var(--text));--openresearch-diff-unified-gutter-text-color: color-mix(in oklab, var(--text) 45%, var(--base));--diff-background-color: var(--base);--diff-text-color: var(--text);--diff-font-family: var(--mono);--diff-selection-text-color: var(--primary);--diff-selection-background-color: var(--openresearch-diff-selection-background-color);--diff-gutter-selected-text-color: var(--diff-selection-text-color);--diff-gutter-selected-background-color: var( --openresearch-diff-gutter-selection-background-color );--diff-code-selected-text-color: var(--diff-selection-text-color);--diff-code-selected-background-color: var(--diff-selection-background-color);--diff-gutter-insert-text-color: var(--accent-green);--diff-gutter-insert-background-color: var(--openresearch-diff-insert-gutter-background-color);--diff-gutter-delete-text-color: var(--accent-red);--diff-gutter-delete-background-color: var(--openresearch-diff-delete-gutter-background-color);--diff-code-insert-text-color: var(--diff-text-color);--diff-code-insert-background-color: var(--openresearch-diff-insert-code-background-color);--diff-code-delete-text-color: var(--diff-text-color);--diff-code-delete-background-color: var(--openresearch-diff-delete-code-background-color);--diff-code-insert-edit-text-color: var(--diff-text-color);--diff-code-insert-edit-background-color: var(--openresearch-diff-insert-edit-background-color);--diff-code-delete-edit-text-color: var(--diff-text-color);--diff-code-delete-edit-background-color: var(--openresearch-diff-delete-edit-background-color);--diff-omit-gutter-line-color: var(--openresearch-diff-omit-gutter-line-color);width:100%;font-size:12px;line-height:1.5}.openresearch-diff .openresearch-diff-file.diff-unified{table-layout:auto}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:first-child{display:none}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:nth-child(2){width:0%;padding:0 .5rem 0 .625rem;white-space:nowrap;text-align:right;color:var(--openresearch-diff-unified-gutter-text-color);border-right:1px solid var(--openresearch-diff-divider-color);-webkit-user-select:none;user-select:none;cursor:default}.openresearch-diff .openresearch-diff-file .diff-line{line-height:1.5}.openresearch-diff .openresearch-diff-file .diff-hunk+.diff-hunk .diff-line:first-child>td{border-top:1px solid var(--openresearch-diff-divider-color)}:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#a0a1a7}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#383a42}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#a626a4}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#4078f2}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#383a42}@media(prefers-color-scheme:dark){:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#7f848e}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#abb2bf}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#c678dd}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#61afef}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#abb2bf}}.report-back{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;color:var(--subtext);padding:4px 8px;border-radius:6px}.report-back:hover{color:var(--text);background:var(--surface)}.settings-view-scroll{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.settings-view{max-width:var(--readable-col);margin:0 auto;padding:24px 32px 60px}.settings-view h1{margin:0 0 6px;font-size:22px}.settings-head-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.settings-head-row h1{margin:0}.settings-view>.error{color:var(--accent-red);font-size:12.5px;white-space:pre-wrap;text-transform:none;margin:0 0 12px}.settings-sub{margin:0 0 18px;color:var(--subtext);font-size:13px}.settings-card{background:var(--base);border:1px solid var(--border);border-radius:10px;padding:16px 18px;margin-bottom:16px}.settings-card h3{margin:0 0 10px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.settings-card .settings-sub{margin-bottom:12px}.settings-card-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}.settings-card .kv{gap:6px 18px}.settings-empty{color:var(--muted);font-size:12.5px;margin:4px 0 0}.muted{color:var(--muted)}.harness-tabs{display:flex;gap:4px;margin-bottom:14px;border-bottom:1px solid var(--border-variant)}.harness-tabs button{display:inline-flex;align-items:center;gap:7px;padding:7px 12px;font-size:13px;font-weight:600;color:var(--subtext);border-bottom:2px solid transparent;margin-bottom:-1px}.harness-tabs button:hover{color:var(--text)}.harness-tabs button.active{color:var(--text);border-bottom-color:var(--primary)}.harness-dot{width:7px;height:7px;border-radius:50%;background:var(--muted)}.harness-dot.ok{background:var(--accent-green)}.harness-dot.err{background:var(--accent-red)}.harness-dot.warn{background:var(--accent-amber)}.env-table{width:100%;border-collapse:collapse;font-size:12.5px;table-layout:fixed}.env-table td:first-child{width:32%;overflow-wrap:anywhere}.env-table .badge{margin-left:8px}.env-table input{width:100%;border:none;background:transparent;padding:0}.env-table input:focus{box-shadow:0 1px 0 0 var(--text)}.env-table td{height:36px;padding:0 10px 0 0;vertical-align:middle;border-bottom:1px solid var(--border-variant)}.env-table td:last-child{width:116px;white-space:nowrap;text-align:right}.env-table td[colspan]{white-space:normal;text-align:left}.env-table .icon-btn{margin-left:8px;vertical-align:middle}.env-table .icon-btn:hover{color:var(--accent-red)}.flavor-table{width:100%;border-collapse:collapse;font-size:12.5px}.flavor-table th{padding:5px 10px 5px 0;border-bottom:1px solid var(--border);text-align:left;font-weight:500;color:var(--muted)}.flavor-table td{padding:5px 10px 5px 0;border-bottom:1px solid var(--border-variant)}.ssh-table{table-layout:fixed}.ssh-table th:nth-child(1){width:20%}.ssh-table th:nth-child(2){width:26%}.ssh-table th:nth-child(4){width:108px}.ssh-table th:nth-child(5){width:52px}.ssh-table td{overflow-wrap:anywhere}.ssh-table td:last-child{padding-right:0;text-align:right}.ssh-tested-at{display:block;margin-top:2px;color:var(--muted);font-size:11px}@keyframes settings-spin{to{transform:rotate(360deg)}}.spin{animation:settings-spin .9s linear infinite}.model-picker,.option-picker{position:relative;display:inline-flex}.composer-pill{display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:11.5px;color:var(--subtext);padding:5px 8px;border-radius:6px}.composer-pill:hover{background:var(--surface);color:var(--text)}.composer-bare{display:inline-flex;align-items:center;gap:3px;font-size:11.5px;color:var(--subtext);padding:5px 4px;border-radius:6px}.composer-bare:hover{color:var(--text)}.model-menu,.option-menu{position:absolute;bottom:calc(100% + 8px);left:0;max-height:380px;display:flex;flex-direction:column;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.model-menu{width:320px}.option-menu{min-width:190px;padding:6px}.model-menu.align-right,.option-menu.align-right{left:auto;right:0}.option-menu.drop-down{bottom:auto;top:calc(100% + 4px)}.option-menu.session-menu{left:auto;right:6px;top:calc(100% - 2px);min-width:140px}.model-item.danger,.model-item.danger:hover{color:var(--accent-red)}.option-default{color:var(--muted);font-weight:400}.option-sep{height:1px;margin:5px 4px;background:var(--border-variant)}.option-num{color:var(--muted);font-size:11px;font-variant-numeric:tabular-nums}.model-menu input{border:none;border-bottom:1px solid var(--border-variant);background:none;padding:9px 12px;font-size:12.5px;outline:none}.model-menu-list{overflow-y:auto;padding:6px}.model-group{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);padding:8px 8px 4px}.model-item{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:12.5px;border-radius:6px}.model-item:hover{background:var(--surface)}.model-item .model-id{display:block;font-family:var(--mono);font-size:10px;color:var(--muted)}.model-more{padding:4px 8px 8px;font-size:11px;color:var(--muted)}.model-locked-note{display:flex;align-items:center;gap:6px;padding:7px 12px;font-size:11px;color:var(--muted);border-top:1px solid var(--border-variant)}.model-locked-note svg{flex-shrink:0}.skill-menu{position:absolute;bottom:calc(100% + 8px);left:0;min-width:340px;max-width:100%;padding:6px;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.skill-item{display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;padding:7px 8px;border-radius:6px}.skill-item.active{background:var(--surface)}.skill-item .skill-name{font-family:var(--mono);font-size:12px}.skill-item .skill-hint{color:var(--muted)}.skill-item .skill-desc{font-size:11px;color:var(--subtext)}.file-view{display:flex;flex-direction:column;height:100%;min-height:0}.file-view-header{display:flex;align-items:center;gap:8px;padding:10px 14px;border-bottom:1px solid var(--border-variant);color:var(--subtext);flex-shrink:0}.file-view-path{font-family:var(--mono);font-size:12px;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-view-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.file-view-code{margin:0;padding:14px 16px;font-family:var(--mono);font-size:12px;line-height:1.55;-moz-tab-size:4;tab-size:4;min-width:max-content}.file-view-note{padding:10px 16px;font-size:12px;color:var(--muted)}.file-view-md{max-width:var(--readable-col);padding:18px 20px 32px}.file-view-md .md{font-size:13.5px}.file-view-md .md h1{font-size:1.5em;margin:18px 0 8px}.file-view-md .md h2{font-size:1.25em;margin:16px 0 8px}.file-view-md .md h3{font-size:1.1em}.icon-btn.active{color:var(--primary);background:var(--surface)}.prompt-card{margin:8px 0;padding:12px 14px;border:1px solid var(--border);border-left:3px solid var(--border);border-radius:6px;background:var(--surface);display:flex;flex-direction:column;gap:9px}.prompt-card.plan{border-left-color:var(--accent-blue)}.prompt-card.permission{border-left-color:var(--accent-amber)}.prompt-card.question{border-left-color:var(--accent-purple)}.prompt-card.resolved{opacity:.6}.prompt-head{font-size:11px;font-weight:600;letter-spacing:.03em;text-transform:uppercase;color:var(--muted)}.prompt-head code{font-family:var(--mono);font-size:11.5px;text-transform:none;color:var(--text)}.prompt-sub{font-family:var(--mono);font-size:12px;color:var(--subtext);word-break:break-word}.prompt-q{font-size:14px;font-weight:600;line-height:1.5;color:var(--text)}.prompt-plan{font-size:13.5px;line-height:1.6;color:var(--text);max-height:340px;overflow-y:auto}.prompt-options{display:flex;flex-direction:column;gap:6px}.prompt-option{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;padding:8px 11px;text-align:left;border:1px solid var(--border);border-radius:5px;background:var(--base);color:var(--text);cursor:pointer;transition:border-color 80ms ease,background 80ms ease}.prompt-option:hover:not(:disabled){border-color:var(--border-strong);background:var(--surface)}.prompt-option.sel{border-color:var(--primary);background:var(--primary-subtle)}.prompt-option:disabled{cursor:default}.prompt-option-label{display:block;font-size:13px;font-weight:600}.prompt-option-desc{display:block;font-size:12px;font-weight:400;line-height:1.45;color:var(--subtext)}.prompt-actions{display:flex;flex-wrap:wrap;gap:8px}.prompt-actions .btn-primary,.prompt-actions .btn-ghost{display:inline-flex;align-items:center;gap:6px;padding:6px 13px;font-family:inherit;font-size:12px;font-weight:600;border:1px solid transparent;border-radius:5px;cursor:pointer;transition:background 80ms ease,border-color 80ms ease}.prompt-actions .btn-primary{background:var(--primary);color:var(--base)}.prompt-actions .btn-primary:hover:not(:disabled){opacity:.9}.prompt-actions .btn-ghost{background:transparent;border-color:var(--border);color:var(--subtext)}.prompt-actions .btn-ghost:hover:not(:disabled){border-color:var(--border-strong);color:var(--text);background:var(--surface)}.prompt-actions button:disabled{opacity:.5;cursor:default}.prompt-resolved{font-size:11px;font-weight:600;color:var(--muted)}.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #555;--xy-background-pattern-lines-color-default: #333;--xy-background-pattern-cross-color-default: #333;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}/** +:root{--diff-background-color:initial;--diff-text-color:initial;--diff-font-family:Consolas,Courier,monospace;--diff-selection-background-color:#b3d7ff;--diff-selection-text-color:var(--diff-text-color);--diff-gutter-insert-background-color:#d6fedb;--diff-gutter-insert-text-color:var(--diff-text-color);--diff-gutter-delete-background-color:#fadde0;--diff-gutter-delete-text-color:var(--diff-text-color);--diff-gutter-selected-background-color:#fffce0;--diff-gutter-selected-text-color:var(--diff-text-color);--diff-code-insert-background-color:#eaffee;--diff-code-insert-text-color:var(--diff-text-color);--diff-code-delete-background-color:#fdeff0;--diff-code-delete-text-color:var(--diff-text-color);--diff-code-insert-edit-background-color:#c0dc91;--diff-code-insert-edit-text-color:var(--diff-text-color);--diff-code-delete-edit-background-color:#f39ea2;--diff-code-delete-edit-text-color:var(--diff-text-color);--diff-code-selected-background-color:#fffce0;--diff-code-selected-text-color:var(--diff-text-color);--diff-omit-gutter-line-color:#cb2a1d}.diff{background-color:var(--diff-background-color);border-collapse:collapse;color:var(--diff-text-color);table-layout:fixed;width:100%}.diff::-moz-selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff::selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff td{padding-bottom:0;padding-top:0;vertical-align:top}.diff-line{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);line-height:1.5}.diff-gutter>a{color:inherit;display:block}.diff-gutter{cursor:pointer;padding:0 1ch;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-gutter-insert{background-color:#d6fedb;background-color:var(--diff-gutter-insert-background-color);color:var(--diff-text-color);color:var(--diff-gutter-insert-text-color)}.diff-gutter-delete{background-color:#fadde0;background-color:var(--diff-gutter-delete-background-color);color:var(--diff-text-color);color:var(--diff-gutter-delete-text-color)}.diff-gutter-omit{cursor:default}.diff-gutter-selected{background-color:#fffce0;background-color:var(--diff-gutter-selected-background-color);color:var(--diff-text-color);color:var(--diff-gutter-selected-text-color)}.diff-code{word-wrap:break-word;padding:0 0 0 .5em;white-space:pre-wrap;word-break:break-all}.diff-code-edit{color:inherit}.diff-code-insert{background-color:#eaffee;background-color:var(--diff-code-insert-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-text-color)}.diff-code-insert .diff-code-edit{background-color:#c0dc91;background-color:var(--diff-code-insert-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-edit-text-color)}.diff-code-delete{background-color:#fdeff0;background-color:var(--diff-code-delete-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-text-color)}.diff-code-delete .diff-code-edit{background-color:#f39ea2;background-color:var(--diff-code-delete-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-edit-text-color)}.diff-code-selected{background-color:#fffce0;background-color:var(--diff-code-selected-background-color);color:var(--diff-text-color);color:var(--diff-code-selected-text-color)}.diff-widget-content{vertical-align:top}.diff-gutter-col{width:7ch}.diff-gutter-omit{height:0}.diff-gutter-omit:before{background-color:#cb2a1d;background-color:var(--diff-omit-gutter-line-color);content:" ";display:block;height:100%;margin-left:4.6ch;overflow:hidden;white-space:pre;width:2px}.diff-decoration{line-height:1.5;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-decoration-content{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);padding:0}:root{--base: #ffffff;--canvas: #faf8f4;--panel: #f3f0ea;--surface: #faf7f2;--surface-bright: #fdfbfb;--highlight: #fdf3f1;--text: #1d1b1a;--subtext: #737373;--muted: #a1a1a1;--primary: #9a2036;--primary-subtle: #f7e9ec;--secondary: #4a90e2;--error: #e2a100;--border: #d4d4d4;--border-variant: #e5e5e5;--accent-orange: #da642c;--accent-red: #d94654;--accent-teal: #209a84;--accent-blue: #3a8dff;--accent-pink: #ff2b90;--accent-amber: #da9100;--accent-green: #5eb64c;--accent-purple: #9c5cff;--accent-green-subtle: #e7f4e5;--accent-amber-subtle: #fff3e1;--accent-teal-subtle: #e1f3f0;--accent-red-subtle: #fbe9ea;--accent-blue-subtle: #e5f0ff;--accent-purple-subtle: #f1e8ff;--dots-muted: #e3ded5;--dots-strong: #bdb6a8;--mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;--readable-col: 760px;--bg: var(--base);--bg-canvas: var(--canvas);--surface-2: var(--panel);--border-strong: var(--border);--accent: var(--primary);--teal: var(--accent-teal);--green: var(--accent-green);--red: var(--accent-red);--amber: var(--accent-amber);--purple: var(--accent-purple);color-scheme:light}@media(prefers-color-scheme:dark){:root{--base: #0e0c0c;--canvas: #141110;--panel: #221f1e;--surface: #1d1b1a;--surface-bright: #130f0f;--highlight: #393433;--text: #e6e1e0;--subtext: #a68e8b;--muted: #737373;--primary: #ffb3ad;--primary-subtle: #33191b;--secondary: #3e7fcf;--error: #ffb951;--border: #525252;--border-variant: #404040;--accent-amber: #e67e22;--accent-green-subtle: #1c2b18;--accent-amber-subtle: #33260f;--accent-teal-subtle: #12332d;--accent-red-subtle: #331418;--accent-blue-subtle: #10233a;--accent-purple-subtle: #251933;--dots-muted: #2a2523;--dots-strong: #555555;color-scheme:dark}}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--base);color:var(--text);font-family:var(--sans);font-size:14px;line-height:1.45;overflow:hidden}::selection{background:var(--highlight)}button{font:inherit;color:inherit;background:none;border:none;cursor:pointer;padding:0}input,textarea,select{font:inherit;color:var(--text);background:var(--base);border:1px solid var(--border);border-radius:0;padding:6px 10px;outline:none}input:focus,textarea:focus,select:focus{border-color:var(--text)}input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background:var(--border);border-radius:5px;border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-track{background:transparent}@keyframes pulse{50%{opacity:.35}}@keyframes spin{to{transform:rotate(360deg)}}.app{display:flex;flex-direction:column;height:100%}.app-body{display:flex;flex:1;min-height:0;padding:0 14px}.home{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges;background:var(--canvas)}.home-inner{max-width:620px;margin:0 auto;padding:48px 24px 64px}.home-brand{font-weight:800;font-size:28px;letter-spacing:-.02em;margin-bottom:36px}.home-brand span{color:var(--primary)}.home-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.home-head h2{margin:0;font-size:18px;letter-spacing:-.01em}.home-list{display:flex;flex-direction:column;gap:10px}.project-card{position:relative;display:flex;flex-direction:column;gap:4px;text-align:left;padding:14px 16px;background:var(--base);border:1px solid var(--border);border-radius:10px;cursor:pointer;transition:border-color .12s ease,box-shadow .12s ease}.project-card:hover{border-color:var(--text);box-shadow:0 2px 10px #0000000f}.project-delete{position:absolute;top:10px;right:10px;display:none;padding:5px;border-radius:6px;color:var(--muted);line-height:0}.project-card:hover .project-delete{display:block}.project-delete:hover{color:var(--danger, #d33);background:var(--overlay, rgba(0, 0, 0, .05))}.project-card .name{font-weight:600;font-size:14px}.project-card .repo{color:var(--subtext)}.project-card .paper,.project-card .time{font-size:11px;color:var(--muted)}.rail-brand{display:flex;align-items:center;gap:4px;height:48px;padding:0 8px 0 12px;border-bottom:1px solid var(--border);flex-shrink:0}.rail-brand .brand{display:flex;align-items:center;gap:8px;flex:1;min-width:0;font-weight:600;font-size:13px;color:var(--text);padding:4px 6px 4px 0;border-radius:6px}.rail-brand .brand:hover{color:var(--subtext)}.rail-brand .brand svg{flex-shrink:0}.rail-brand .brand .brand-project{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;color:var(--subtext)}.icon-btn:hover{color:var(--text);background:var(--surface)}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:6px 14px;font-size:12px;font-weight:600;border:1px solid var(--border);border-radius:8px;background:var(--base);color:var(--text);white-space:nowrap;transition:background .12s ease,border-color .12s ease,color .12s ease}.btn:hover:not(:disabled){background:var(--surface)}.btn:active:not(:disabled){background:var(--highlight)}.btn:disabled{opacity:.45;cursor:default}.btn.primary{background:var(--primary);border-color:var(--primary);color:var(--base)}.btn.primary:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text));border-color:color-mix(in oklab,var(--primary) 88%,var(--text))}.btn.primary:active:not(:disabled){background:color-mix(in oklab,var(--primary) 80%,var(--text));border-color:color-mix(in oklab,var(--primary) 80%,var(--text))}.btn.danger{color:var(--accent-red)}.btn.danger:hover:not(:disabled){background:color-mix(in oklab,var(--accent-red) 8%,transparent)}.btn.danger:active:not(:disabled){background:color-mix(in oklab,var(--accent-red) 14%,transparent)}.btn.ghost{border-color:transparent;color:var(--subtext)}.btn.ghost:hover:not(:disabled){color:var(--text);background:var(--surface)}.btn.sm{padding:3px 9px;font-size:11px;border-radius:6px}.status-badge{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:500;color:var(--subtext);text-transform:capitalize;white-space:nowrap}.status-badge .dot{width:7px;height:7px;border-radius:50%;background:currentColor;flex-shrink:0}.status-badge.live .dot{animation:pulse 1.2s ease-in-out infinite}.st-done .dot{color:var(--accent-green)}.st-failed .dot{color:var(--accent-red)}.st-running .dot{color:var(--accent-teal)}.st-starting .dot{color:var(--accent-amber)}.st-cancelled .dot{color:var(--accent-orange)}.st-editing .dot{color:var(--accent-purple)}.st-idle .dot{color:var(--muted)}.floating-panel{border:1px solid var(--border);border-radius:10px;box-shadow:0 6px 24px color-mix(in oklab,var(--text) 5%,transparent),0 1px 4px color-mix(in oklab,var(--text) 4%,transparent);overflow:hidden}.session-rail{width:232px;flex-shrink:0;display:flex;flex-direction:column;margin:10px 14px 10px 0;background:var(--base);min-height:0}.rail-nav{display:flex;flex-direction:column;gap:2px;padding:8px;flex-shrink:0}.rail-nav-item{display:flex;align-items:center;gap:10px;padding:7px 10px;font-size:12.5px;color:var(--subtext);border-radius:8px;text-align:left}.rail-nav-item:hover{background:var(--surface);color:var(--text)}.rail-nav-item.active{background:var(--panel);color:var(--text);font-weight:600}.rail-section-label{padding:10px 10px 6px;font-size:12px;font-weight:500;color:var(--muted)}.rail-section-head{display:flex;align-items:center;justify-content:space-between}.rail-filter{position:relative;display:inline-flex;margin-right:2px}.rail-filter-btn{width:24px;height:24px;border-radius:6px}.rail-empty{padding:6px 10px;font-size:12px;color:var(--muted)}.session-rail .rail-body{flex:1;min-height:0;overflow-y:auto;padding:4px 8px}.chat-pane{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--base);min-height:0}.right-pane{position:relative;flex-shrink:0;min-width:0;display:flex;flex-direction:column;margin:10px 0 10px 14px;background:var(--canvas)}.right-pane.max{position:fixed;top:10px;right:10px;bottom:10px;left:10px;margin:0;z-index:60;box-shadow:0 12px 40px color-mix(in oklab,var(--text) 22%,transparent)}.panel-resizer{position:absolute;left:0;top:0;bottom:0;width:6px;cursor:col-resize;z-index:30}.panel-resizer:hover,.panel-resizer:active{background:color-mix(in oklab,var(--text) 12%,transparent)}.panel-controls{display:inline-flex;align-items:center;gap:2px;flex-shrink:0}.tabs{display:flex;align-items:center;gap:4px;padding:0 10px;height:40px;border-bottom:1px solid var(--border);background:var(--base);flex-shrink:0}.tab-strip{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow-x:auto;scrollbar-width:none}.tab-strip::-webkit-scrollbar{display:none}.tab.closable{max-width:176px;padding-right:4px}.tab .tab-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tab .tab-close{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:4px;color:var(--muted);flex-shrink:0}.tab .tab-close:hover{background:color-mix(in oklab,var(--text) 15%,transparent);color:var(--text)}.tab{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;font-size:12px;font-weight:600;color:var(--subtext);border-radius:6px;white-space:nowrap;flex-shrink:0}.tab:hover{color:var(--text)}.tab.active{color:var(--text);background:var(--surface)}.tab .tab-count{font-family:var(--mono);font-weight:400;color:var(--muted)}.tab-body{flex:1;min-height:0;position:relative;display:flex;flex-direction:column}.pane-toolbar{display:flex;align-items:center;justify-content:flex-end;padding:10px 12px 0;flex-shrink:0}.pane-content{flex:1;min-height:0;position:relative}.seg{display:inline-flex;align-items:center;gap:2px;padding:3px;border-radius:9px;background:color-mix(in oklab,var(--text) 10%,transparent)}.seg button{padding:3px 12px;font-size:12px;font-weight:600;color:var(--subtext);border-radius:6px}.seg button:hover{color:var(--text)}.seg button.active{background:var(--base);color:var(--text);box-shadow:0 1px 3px color-mix(in oklab,var(--text) 25%,transparent)}.chat-header{display:flex;align-items:center;gap:8px;padding:0 16px;background:var(--base);flex-shrink:0;height:48px;position:relative;z-index:4;width:100%;max-width:var(--readable-col);margin:0 auto}.chat-header.rail-hidden{max-width:none;padding:0 2px}.chat-header.rail-hidden>.icon-btn:first-child{margin-right:12px}.chat-header:after{content:"";position:absolute;top:100%;left:0;right:0;height:24px;background:linear-gradient(to bottom,var(--base),transparent);pointer-events:none}.chat-header .title{font-size:13px;font-weight:600;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row{position:relative;display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:7px 10px;border-radius:8px;font-size:12.5px;color:var(--subtext);cursor:pointer;-webkit-user-select:none;user-select:none}.session-row:hover{background:var(--surface);color:var(--text)}.session-row.active{color:var(--text);background:var(--surface);font-weight:500}.session-row .session-dot{width:14px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.session-row .session-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row .session-time{font-size:10px;font-family:var(--mono);color:var(--muted);flex-shrink:0}.session-row .session-menu-btn{display:none;align-items:center;justify-content:center;width:18px;height:18px;margin:-2px 0;border-radius:5px;color:var(--muted);flex-shrink:0}.session-row .session-menu-btn:hover{color:var(--text);background:var(--panel)}.session-row:hover .session-menu-btn,.session-row:focus-within .session-menu-btn,.session-row.menu-open .session-menu-btn{display:inline-flex}.session-row:hover .session-time,.session-row:focus-within .session-time,.session-row.menu-open .session-time{display:none}.session-row .busy-dot{width:7px;height:7px;border-radius:50%;background:var(--primary);animation:pulse 1.2s infinite;flex-shrink:0}.session-row .session-title-input{flex:1;min-width:0;padding:1px 5px;margin:-2px 0;font:inherit;color:var(--text);background:var(--base);border:1px solid var(--primary);border-radius:5px;outline:none}.session-row.editing{background:var(--surface);cursor:default}.session-row.editing .session-menu-btn,.session-row.editing .session-time{display:none}.chat-thread{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.chat-thread-inner{max-width:var(--readable-col);margin:0 auto;padding:16px 16px 32px;display:flex;flex-direction:column;gap:16px}.chat-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:var(--subtext);padding:20px;text-align:center}.chat-empty h2{margin:0;font-size:34px;font-weight:700;letter-spacing:-.02em;color:var(--text)}.chat-empty h2 span{color:var(--primary)}.chat-empty .chat-empty-hint{font-size:12px;color:var(--muted);max-width:340px;text-align:center}.chat-empty p{margin:0;font-size:13px;max-width:320px}.chat-empty .chat-suggest{font-family:var(--mono);font-size:12px;color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:999px;padding:6px 14px;cursor:pointer;transition:border-color .12s ease}.chat-empty .chat-suggest:hover{border-color:var(--text)}.msg-user{align-self:flex-end;max-width:88%;background:var(--surface);border-radius:16px;padding:10px 15px;font-size:13px;white-space:pre-wrap;word-break:break-word}.msg-images{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}.msg-images img{max-width:220px;max-height:160px;border:1px solid var(--border-variant);border-radius:4px;display:block}.msg-assistant{font-size:14px;line-height:1.62;color:var(--text);min-width:0}.reasoning{color:var(--muted);font-size:12px;margin:2px 0}.reasoning summary{cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;font-weight:600}.reasoning[open]{white-space:pre-wrap}.tool-group{margin:2px 0}.tool-group-summary{display:flex;align-items:center;gap:8px;width:100%;padding:3px 2px;cursor:pointer;color:var(--muted);font-size:12.5px;text-align:left;border-radius:6px}.tool-group-summary:hover{color:var(--subtext);background:var(--surface)}.tool-group.has-error .tool-group-summary{color:var(--accent-red)}.tool-chevron{flex-shrink:0;color:var(--muted);transition:transform .12s ease}.tool-chevron.open{transform:rotate(90deg)}.tool-group-rows{display:flex;flex-direction:column;gap:1px;margin:2px 0 4px 7px;padding-left:10px;border-left:1px solid var(--border-variant)}.tool-row{display:flex;flex-direction:column}.tool-row summary{display:flex;align-items:center;gap:8px;padding:3px 4px;cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;min-width:0;border-radius:5px}.tool-row summary:hover{background:var(--surface)}.tool-row summary::-webkit-details-marker{display:none}.tool-line{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;color:var(--subtext)}.tool-open{flex-shrink:0;font-size:11px;color:var(--primary)}.tool-open:hover{text-decoration:underline}.tool-status{width:6px;height:6px;border-radius:50%;flex-shrink:0;background:var(--muted)}.tool-status.running{background:var(--accent-amber);animation:pulse 1.2s ease-in-out infinite}.tool-status.error{background:var(--accent-red)}.tool-detail{margin:2px 0 4px 14px}.tool-cmd-full{padding:6px 10px;font-family:var(--mono);font-size:11px;color:var(--text);background:var(--surface);border-radius:5px;white-space:pre-wrap;word-break:break-word}.tool-output{margin-top:3px;padding:6px 10px;font-family:var(--mono);font-size:11px;color:var(--subtext);white-space:pre-wrap;word-break:break-word;max-height:260px;overflow-y:auto;background:var(--base);border:1px solid var(--border-variant);border-radius:5px}.working{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:12.5px;padding:2px 0 8px}.spinner{width:13px;height:13px;border:2px solid var(--border);border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite;flex-shrink:0}.composer{padding:0 12px 12px;flex-shrink:0;position:relative;z-index:4;background:var(--base);width:100%;max-width:var(--readable-col);margin:0 auto}.composer:before{content:"";position:absolute;bottom:100%;left:0;right:0;height:24px;background:linear-gradient(to top,var(--base),transparent);pointer-events:none}.composer-box{position:relative;display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;background:var(--base)}.composer textarea{border:none;background:none;resize:none;padding:10px 12px 4px;font-size:13px;min-height:42px;max-height:180px}.composer-attachments{display:flex;flex-wrap:wrap;gap:6px;padding:8px 12px 0}.attachment-thumb{position:relative}.attachment-thumb img{width:52px;height:52px;object-fit:cover;border:1px solid var(--border);border-radius:6px;display:block}.attachment-thumb button{position:absolute;top:-5px;right:-5px;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:1px solid var(--border);border-radius:50%;background:var(--surface);color:var(--text);cursor:pointer}.attachment-thumb button:hover{background:var(--text);color:var(--base)}.composer-actions{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:6px 8px 8px}.send-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;background:var(--primary);color:var(--base);transition:background .1s ease,opacity .1s ease}.send-btn:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text))}.send-btn:disabled{opacity:.4;cursor:default}.send-btn.stop{background:var(--surface);color:var(--text)}.send-btn.stop:hover:not(:disabled){background:color-mix(in oklab,var(--surface) 88%,var(--text))}.md{min-width:0;word-break:break-word;color:var(--text);line-height:1.62}.md>*:first-child{margin-top:0}.md>*:last-child{margin-bottom:0}.md p{margin:10px 0}.md strong{color:var(--text);font-weight:600}.md pre{background:var(--surface);border:1px solid color-mix(in oklab,var(--border) 50%,transparent);border-radius:8px;padding:8px 12px;overflow-x:auto;font-size:12px;color:var(--text)}.md code{font-family:var(--mono);font-size:.9em;font-weight:500;color:var(--primary);background:var(--panel);border:1px solid var(--border-variant);padding:1px 5px}.md .file-chip{display:inline-flex;align-items:center;gap:4px;max-width:100%;margin:0 1px;padding:0 6px;vertical-align:baseline;font-family:var(--mono);font-size:.9em;font-weight:500;color:var(--text);background:var(--panel);border:1px solid var(--border-variant);cursor:pointer}.md .file-chip:hover:not(:disabled){background:var(--surface);color:var(--primary)}.md .file-chip svg{flex:none;opacity:.6}.md .file-chip-label{max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.md pre code{background:none;border:none;color:inherit;padding:0;font-weight:400}.md-code{position:relative;margin:10px 0}.md-code pre{margin:0}.md-code-copy{position:absolute;top:6px;right:6px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:var(--muted);background:var(--base);border:1px solid var(--border-variant);border-radius:6px;opacity:0;transition:opacity .12s ease,color .12s ease}.md-code:hover .md-code-copy{opacity:1}.md-code-copy:hover{color:var(--text);border-color:var(--muted)}.md h1,.md h2,.md h3,.md h4{color:var(--text);font-size:1.05em;font-weight:600;margin:12px 0 6px}.md ul,.md ol{margin:6px 0;padding-left:22px}.md li::marker{color:var(--primary)}.md a{color:var(--primary)}.md table{border-collapse:collapse;width:100%;font-size:13px;margin:10px 0;border:1px solid var(--border);border-radius:8px;overflow:hidden}.md th,.md td{border-bottom:1px solid var(--border-variant);padding:8px 14px;text-align:left;color:var(--text)}.md tr:last-child td{border-bottom:none}.md thead th{background:var(--surface);font-weight:500;color:var(--subtext);border-bottom:1px solid var(--border)}.md tbody tr:hover td{background:var(--surface-bright)}.md blockquote{margin:6px 0;padding:2px 0 2px 10px;border-left:3px solid var(--border);color:var(--subtext)}.exp-node{width:240px;border:1px solid var(--border);background:var(--base);padding:10px 12px;cursor:pointer;box-shadow:0 1px 2px #0000000a;font-size:12.5px;transition:box-shadow .12s ease}.exp-node:hover{box-shadow:0 2px 8px #00000014}.exp-node.selected{border-color:var(--text);box-shadow:0 0 0 1px var(--text)}.exp-node.live{border-color:var(--accent-teal);box-shadow:0 2px 12px #209a8433}.exp-node .node-eyebrow{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;font-family:var(--mono);font-size:9.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}.exp-node .node-head{display:flex;align-items:center;gap:7px;min-width:0}.exp-node .node-status{width:8px;height:8px;border-radius:50%;flex-shrink:0}.exp-node .node-slug{font-family:var(--mono);font-size:12px;font-weight:700;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.exp-node .node-title{margin-top:4px;color:var(--subtext);font-size:11.5px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.exp-node .node-meta{margin-top:8px;display:flex;align-items:center;gap:8px;font-size:10px;color:var(--muted);font-family:var(--mono);text-transform:uppercase;letter-spacing:.05em}.exp-node .baseline-chip{font-size:9px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);border:1px solid var(--border);padding:0 4px;flex-shrink:0}.exp-node .node-actions{margin-top:8px;padding-top:6px;border-top:1px solid var(--border-variant);display:flex;align-items:center;gap:4px}.exp-node .node-action{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;font-size:10.5px;font-weight:700;color:var(--subtext);border-radius:6px}.exp-node .node-action:hover{color:var(--text);background:var(--surface)}.run-squares{display:flex;align-items:center;gap:3px}.run-sq{width:9px;height:9px;flex-shrink:0}.run-sq.pass{background:var(--accent-green)}.run-sq.fail{border:1.5px solid color-mix(in oklab,var(--accent-red) 55%,transparent)}.run-sq.live{background:var(--accent-teal);animation:pulse 1.2s ease-in-out infinite}.run-sq.other{border:1.5px solid var(--border)}.react-flow__handle{opacity:0;pointer-events:none}.react-flow__attribution{display:none!important}.runs-table-wrap{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto;padding:12px}.runs-table{width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px;background:var(--base);border:1px solid var(--border);border-radius:10px;overflow:hidden}.runs-table th{text-align:left;color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;padding:8px 12px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--base);z-index:1}.runs-table td{padding:8px 12px;border-bottom:1px solid color-mix(in oklab,var(--text) 6%,transparent);white-space:nowrap}.runs-table tr:last-child td{border-bottom:none}.runs-table tr.clickable{cursor:pointer}.runs-table tr.clickable:hover td{background:var(--canvas)}.mono{font-family:var(--mono);font-size:11.5px}.instances-section-title{display:flex;align-items:center;gap:8px;margin:22px 0 10px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.instances-section-title .count-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--canvas);border:1px solid var(--border);font-size:11px;font-weight:500;letter-spacing:0;color:var(--text)}.instances-table-wrap{overflow-x:auto}.instances-empty{margin:0;padding:14px 16px;border:1px solid var(--border);border-radius:10px;background:var(--base);color:var(--subtext);font-size:12.5px}.backend-cell{display:inline-flex;align-items:center;gap:2px}.backend-cell .icon-btn{width:22px;height:22px}.backend-badge{display:inline-flex;align-items:center;gap:7px}.backend-badge svg{flex:none;display:block}.backend-badge .backend-name{font-weight:500}.backend-badge .backend-detail,.backend-badge.muted{color:var(--muted)}.status-chip{display:inline-flex;align-items:center;gap:6px;font-size:10px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;font-family:var(--mono)}.status-chip .dot{width:8px;height:8px;border-radius:50%}.drawer{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--base);display:flex;flex-direction:column;z-index:20}.drawer-body{flex:1;min-height:0;overflow-y:auto;padding:0 16px 24px;display:flex;flex-direction:column;gap:22px}.drawer-body>:first-child{margin-top:18px}.drawer-section h3{margin:0 0 10px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.kv{display:grid;grid-template-columns:auto 1fr;gap:3px 14px;font-size:12.5px}.kv .k{color:var(--muted)}.kv .v{font-family:var(--mono);font-size:11.5px;word-break:break-all}.term-view{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;background:var(--base);z-index:20}.term-bar{display:flex;align-items:center;gap:8px;height:40px;padding:0 10px;border-bottom:1px solid var(--border);flex-shrink:0}.term-title{min-width:0;font-size:13px;font-weight:600;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.term-bar .error{font-size:11.5px;color:var(--accent-red)}.term-bar .btn{display:inline-flex;align-items:center;gap:5px}.term-fill{flex:1;min-height:0;background:#1a1a1a;padding:4px 0 4px 6px}.term-empty{height:100%;display:flex;align-items:center;justify-content:center;padding:24px;text-align:center;font-size:12.5px;color:var(--muted)}.run-history{position:relative;flex-shrink:0}.run-picker{display:inline-flex;align-items:center;gap:8px;padding:4px 6px 4px 10px;border:1px solid var(--border);border-radius:8px;background:var(--base);color:var(--text)}.run-picker:hover{background:var(--surface)}.run-picker .run-label{font-size:12px;font-weight:600}.run-picker-chev{color:var(--muted);flex-shrink:0}.history-menu{position:absolute;top:calc(100% + 6px);right:0;min-width:230px;max-height:320px;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;padding:5px;z-index:50}.history-item{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:12px;border-radius:6px}.history-item:hover,.history-item.active{background:var(--surface)}.history-item .run-label{font-weight:600}.history-item .when{margin-left:auto;font-size:11px;color:var(--muted)}.commit-picker{display:flex;align-items:center;gap:8px}.commit-picker select{flex:1;min-width:0;font-family:var(--mono);font-size:11.5px}.uncommitted-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--accent-purple);flex-shrink:0}.changes-note{font-size:11.5px;color:var(--muted)}.empty-state{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:24px;text-align:center;color:var(--subtext)}.empty-state p{max-width:46ch;margin:0;font-size:13px;line-height:1.5;text-wrap:balance}.empty-state-cta{gap:6px}.empty-state p.empty-state-title{font-size:18px;font-weight:400;color:var(--text)}.empty-state p.empty-state-hint{font-size:15px;color:var(--subtext)}.onboarding .home-inner{max-width:560px;padding-top:96px}.onb-eyebrow{font-family:var(--mono);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:14px}.onb-eyebrow span{color:var(--primary)}.onb-title{margin:0 0 6px;font-size:22px;letter-spacing:-.01em}.onb-sub{color:var(--subtext);font-size:13.5px;line-height:1.55;margin:0 0 22px;max-width:480px}.onb-cards{display:flex;flex-direction:column;gap:10px}.onb-card{display:flex;flex-direction:column;gap:5px;background:var(--base);border:1px solid var(--border);border-radius:10px;padding:18px 20px}.onb-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.onb-card-name{font-weight:600;font-size:14px}.onb-card-detail{font-size:12px}.onb-card-meta{font-size:12px;color:var(--subtext)}.onb-card-meta code{font-family:var(--mono);font-size:11px}.onb-card-row{display:grid;grid-template-columns:56px 1fr auto;align-items:baseline;gap:12px;padding:3px 0}.onb-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:13px;padding:8px 0}.onb-gh-options{display:flex;flex-direction:column;gap:16px;margin-top:12px;padding-top:14px;border-top:1px solid var(--border-variant)}.onb-gh-option{display:flex;flex-direction:column;gap:8px}.onb-gh-option-label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--subtext)}.onb-gh-option-body{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.onb-gh-cmd{font-family:var(--mono);font-size:12px;background:var(--panel);border:1px solid var(--border-variant);border-radius:5px;padding:3px 8px}.onb-gh-hint{font-size:12px;color:var(--subtext)}.onb-gh-hint code{font-family:var(--mono);font-size:11px}.onb-gh-or{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.05em}.onb-gh-or:before,.onb-gh-or:after{content:"";flex:1;height:1px;background:var(--border-variant)}.onb-gh-option .onb-token-form{flex:1;min-width:0;margin-top:0}.onb-token-form{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:8px}.onb-token-form input{flex:1;min-width:220px;font-family:var(--mono);font-size:12px}.onb-token-form a{font-size:12px;color:var(--subtext);white-space:nowrap}.onb-token-form .error{flex-basis:100%;color:var(--accent-red);font-size:12.5px;white-space:pre-wrap}.onb-actions{display:flex;align-items:center;gap:10px;margin-top:22px}.form .form-seg{align-self:flex-start;margin-bottom:2px}.form .form-seg button{padding:5px 12px}.form .repo-hint{font-family:var(--mono);font-weight:400;text-transform:none;letter-spacing:normal;font-size:11px;color:var(--muted)}.form .repo-hint.ok{color:var(--accent-teal)}.form .paper-results{display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;max-height:240px;overflow-y:auto}.form .paper-results button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:8px 10px;background:none;border:none;border-bottom:1px solid var(--border-variant);text-align:left;font:inherit;color:var(--text);cursor:pointer}.form .paper-results button:last-child{border-bottom:none}.form .paper-results button:hover{background:var(--surface)}.form .paper-results .title{font-size:12.5px;font-weight:500}.form .paper-results .id,.form .paper-pick .id{font-family:var(--mono);font-size:11px;color:var(--muted)}.form .paper-pick{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border:1px solid var(--border);border-radius:8px;background:var(--surface)}.form .paper-pick .meta{min-width:0}.form .paper-pick .title{font-size:13px;font-weight:600}.form{display:flex;flex-direction:column;gap:10px}.form label{display:flex;flex-direction:column;gap:4px;font-size:11px;color:var(--subtext);font-weight:700;text-transform:uppercase;letter-spacing:.05em}.form .row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}.form .actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.form .error,.report-view .error,.settings-card>.error{color:var(--accent-red);font-size:12.5px;white-space:pre-wrap;text-transform:none}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#1d1b1a66;display:flex;align-items:center;justify-content:center;z-index:100}.modal{width:480px;max-width:94vw;max-height:88vh;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:12px;box-shadow:0 24px 60px #00000038;padding:24px}.modal h2{margin:0 0 14px;font-size:16px}:is(.modal,.home) :is(input,select,textarea){border-radius:8px}.settings-section+.settings-section{margin-top:18px;padding-top:16px;border-top:1px solid var(--border)}.settings-section h3{margin:0 0 8px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.settings-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:12.5px;padding:4px 0}.settings-note{margin:10px 0 0;font-size:12px;padding:8px 10px;border:2px solid var(--accent-amber);background:var(--accent-amber-subtle);color:var(--accent-amber);font-weight:600}.progress{margin:12px 0 4px}.progress-track{height:8px;border-radius:999px;background:var(--surface);border:1px solid var(--border);overflow:hidden}.progress-fill{height:100%;background:var(--accent);border-radius:999px;transition:width .2s ease}.progress-caption{display:flex;justify-content:space-between;margin-top:6px;font-size:12px;color:var(--muted)}.settings-form{margin-top:14px;padding-top:14px;border-top:1px solid var(--border)}.badge{display:inline-flex;align-items:center;font-size:10px;font-weight:700;font-family:var(--mono);text-transform:uppercase;letter-spacing:.06em;padding:1px 7px;border:1px solid var(--border);color:var(--muted)}.badge.ok{color:var(--accent-green);border-color:var(--accent-green);background:var(--accent-green-subtle)}.badge.err{color:var(--accent-red);border-color:var(--accent-red);background:var(--accent-red-subtle)}.badge.warn{color:var(--accent-amber);border-color:var(--accent-amber);background:var(--accent-amber-subtle)}.files-tab{height:100%;overflow-y:auto;padding:20px 24px 48px}.files-col{max-width:var(--readable-col);margin:0 auto;display:flex;flex-direction:column;gap:10px}.files-meta{display:flex;gap:8px;flex-wrap:wrap}.files-pill{display:inline-flex;align-items:center;gap:8px;min-width:0;border:1px solid var(--border);border-radius:8px;padding:7px 11px;background:var(--base);color:var(--text);text-decoration:none}.files-pill code{font-family:var(--mono);font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.files-pill>svg{flex-shrink:0;color:var(--muted)}a.files-pill:hover{border-color:var(--muted)}.files-pill-dir{flex:1;min-width:240px}.files-pill-dir code{flex:1;color:var(--subtext)}.files-pill-dir .icon-btn{width:22px;height:22px;margin:-4px -6px -4px 0}button.files-pill-link{cursor:pointer;font:inherit;font-size:12px;color:var(--muted);white-space:nowrap}button.files-pill-link:hover{border-color:var(--muted);color:var(--text)}.files-hint{margin:0;font-size:11.5px;line-height:1.5;color:var(--muted)}.files-hint code{font-family:var(--mono);font-size:10.5px}.files-card{border:1px solid var(--border);border-radius:10px;background:var(--base);overflow:hidden;margin-top:4px}.files-card>*+*{border-top:1px solid var(--border-variant)}.ftree-row{display:flex;align-items:center;gap:8px;padding:8px 14px}.ftree-row.clickable{cursor:pointer}.ftree-row:hover{background:var(--surface)}.ftree-children{background:var(--canvas);border-top:1px solid var(--border-variant)}.ftree-children .ftree-row:hover{background:var(--panel)}.ftree-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;flex-shrink:0;color:var(--muted);transition:transform .12s ease}.ftree-chevron.open{transform:rotate(90deg)}.ftree-chevron.spacer{visibility:hidden}.ftree-dirname{flex:1;min-width:0;font-family:var(--mono);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-title{flex:1;min-width:0;font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-tag{flex-shrink:0;font-size:11px;color:var(--primary)}.ftree-status{flex-shrink:0;font-family:var(--mono);font-size:10.5px;color:var(--subtext)}.ftree-link{flex:1;min-width:0;display:flex;align-items:center;gap:8px;color:var(--text);text-decoration:none}.ftree-link:hover .ftree-name{text-decoration:underline}.ftree-name{min-width:0;font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-thumb{width:22px;height:22px;object-fit:cover;border-radius:4px;border:1px solid var(--border-variant);flex-shrink:0}.ftree-del{width:22px;height:22px;visibility:hidden}.ftree-row:hover .ftree-del{visibility:visible}.ftree-del:hover{color:var(--accent-red)}.ftree-date,.ftree-size{flex-shrink:0}.ftree-size{font-family:var(--mono);font-size:10.5px;color:var(--muted);white-space:nowrap}.ftree-divider{padding:10px 14px 4px;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}.files-empty{font-size:12.5px;line-height:1.55;color:var(--subtext);border:1px solid var(--border);border-radius:10px;background:var(--base);padding:18px;margin:4px 0 0}.files-empty code{font-family:var(--mono);font-size:11.5px}.files-truncated{margin:0;padding:8px 14px;font-size:11px;color:var(--muted)}.report-date,.ftree-date{font-size:11px;color:var(--muted);white-space:nowrap}.report-view{height:100%;overflow-y:auto;padding:16px 24px 48px}.report-view-col{max-width:var(--readable-col);margin:0 auto}.report-view-head{display:flex;align-items:center;gap:10px;margin-bottom:16px;padding-bottom:10px;border-bottom:1px solid var(--border-variant)}.report-md table{display:block;width:max-content;max-width:100%;overflow-x:auto}.report-md .report-img{display:block;margin:12px 0}.report-md .report-img img{max-width:100%;height:auto;border:1px solid var(--border)}.report-md .report-img-caption{display:block;margin-top:4px;text-align:center;font-size:11.5px;color:var(--subtext)}.openresearch-diff{display:flex;flex-direction:column;gap:16px}.diff-file-card{border:1px solid var(--border);border-radius:8px;background:var(--base)}.diff-file-header{position:sticky;top:0;z-index:10;display:flex;align-items:center;justify-content:space-between;gap:12px;margin:-1px -1px 0;width:calc(100% + 2px);text-align:left;padding:8px 12px;cursor:pointer}.diff-file-header:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-2;background:var(--base)}.diff-file-header:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;background:var(--canvas);border:1px solid var(--border);border-radius:8px 8px 0 0}.diff-file-header .chev{color:var(--muted);font-size:10px;flex-shrink:0;width:12px}.diff-file-header .path{display:flex;align-items:center;gap:8px;min-width:0;flex:1}.diff-file-header .path code{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--mono);font-size:.7rem;font-weight:700;color:var(--text)}.diff-file-header .stats{display:flex;align-items:center;gap:8px;flex-shrink:0;font-family:var(--mono);font-size:.65rem;font-weight:700;font-variant-numeric:tabular-nums}.diff-stat-add{color:var(--accent-green)}.diff-stat-del{color:var(--accent-red)}.diff-empty{padding:8px 12px;color:var(--muted);font-size:12.5px}.truncated-notice{border:2px solid var(--accent-amber);background:var(--accent-amber-subtle);padding:12px 14px;font-size:12.5px}.truncated-notice h4{margin:0 0 4px;font-size:13px;color:var(--accent-amber)}.truncated-notice p{margin:0;color:var(--subtext)}.openresearch-diff .openresearch-diff-file{--openresearch-diff-selection-background-color: color-mix( in oklab, var(--surface) 76%, var(--primary) );--openresearch-diff-gutter-selection-background-color: color-mix( in oklab, var(--surface) 68%, var(--primary) );--openresearch-diff-insert-gutter-background-color: color-mix( in oklab, var(--base) 84%, var(--accent-green) );--openresearch-diff-delete-gutter-background-color: color-mix( in oklab, var(--base) 86%, var(--accent-red) );--openresearch-diff-insert-code-background-color: color-mix( in oklab, var(--base) 91%, var(--accent-green) );--openresearch-diff-delete-code-background-color: color-mix( in oklab, var(--base) 92%, var(--accent-red) );--openresearch-diff-insert-edit-background-color: color-mix( in oklab, var(--base) 72%, var(--accent-green) );--openresearch-diff-delete-edit-background-color: color-mix( in oklab, var(--base) 78%, var(--accent-red) );--openresearch-diff-divider-color: var(--border);--openresearch-diff-omit-gutter-line-color: color-mix(in oklab, var(--base) 86%, var(--text));--openresearch-diff-unified-gutter-text-color: color-mix(in oklab, var(--text) 45%, var(--base));--diff-background-color: var(--base);--diff-text-color: var(--text);--diff-font-family: var(--mono);--diff-selection-text-color: var(--primary);--diff-selection-background-color: var(--openresearch-diff-selection-background-color);--diff-gutter-selected-text-color: var(--diff-selection-text-color);--diff-gutter-selected-background-color: var( --openresearch-diff-gutter-selection-background-color );--diff-code-selected-text-color: var(--diff-selection-text-color);--diff-code-selected-background-color: var(--diff-selection-background-color);--diff-gutter-insert-text-color: var(--accent-green);--diff-gutter-insert-background-color: var(--openresearch-diff-insert-gutter-background-color);--diff-gutter-delete-text-color: var(--accent-red);--diff-gutter-delete-background-color: var(--openresearch-diff-delete-gutter-background-color);--diff-code-insert-text-color: var(--diff-text-color);--diff-code-insert-background-color: var(--openresearch-diff-insert-code-background-color);--diff-code-delete-text-color: var(--diff-text-color);--diff-code-delete-background-color: var(--openresearch-diff-delete-code-background-color);--diff-code-insert-edit-text-color: var(--diff-text-color);--diff-code-insert-edit-background-color: var(--openresearch-diff-insert-edit-background-color);--diff-code-delete-edit-text-color: var(--diff-text-color);--diff-code-delete-edit-background-color: var(--openresearch-diff-delete-edit-background-color);--diff-omit-gutter-line-color: var(--openresearch-diff-omit-gutter-line-color);width:100%;font-size:12px;line-height:1.5}.openresearch-diff .openresearch-diff-file.diff-unified{table-layout:auto}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:first-child{display:none}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:nth-child(2){width:0%;padding:0 .5rem 0 .625rem;white-space:nowrap;text-align:right;color:var(--openresearch-diff-unified-gutter-text-color);border-right:1px solid var(--openresearch-diff-divider-color);-webkit-user-select:none;user-select:none;cursor:default}.openresearch-diff .openresearch-diff-file .diff-line{line-height:1.5}.openresearch-diff .openresearch-diff-file .diff-hunk+.diff-hunk .diff-line:first-child>td{border-top:1px solid var(--openresearch-diff-divider-color)}:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#a0a1a7}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#383a42}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#a626a4}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#4078f2}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#383a42}@media(prefers-color-scheme:dark){:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#7f848e}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#abb2bf}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#c678dd}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#61afef}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#abb2bf}}.report-back{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;color:var(--subtext);padding:4px 8px;border-radius:6px}.report-back:hover{color:var(--text);background:var(--surface)}.settings-view-scroll{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.settings-view{max-width:var(--readable-col);margin:0 auto;padding:24px 32px 60px}.settings-view h1{margin:0 0 6px;font-size:22px}.settings-head-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.settings-head-row h1{margin:0}.settings-view>.error{color:var(--accent-red);font-size:12.5px;white-space:pre-wrap;text-transform:none;margin:0 0 12px}.settings-sub{margin:0 0 18px;color:var(--subtext);font-size:13px}.settings-card{background:var(--base);border:1px solid var(--border);border-radius:10px;padding:16px 18px;margin-bottom:16px}.settings-card h3{margin:0 0 10px;font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;color:var(--muted)}.settings-card .settings-sub{margin-bottom:12px}.settings-card-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}.settings-card .kv{gap:6px 18px}.settings-empty{color:var(--muted);font-size:12.5px;margin:4px 0 0}.muted{color:var(--muted)}.harness-tabs{display:flex;gap:4px;margin-bottom:14px;border-bottom:1px solid var(--border-variant)}.harness-tabs button{display:inline-flex;align-items:center;gap:7px;padding:7px 12px;font-size:13px;font-weight:600;color:var(--subtext);border-bottom:2px solid transparent;margin-bottom:-1px}.harness-tabs button:hover{color:var(--text)}.harness-tabs button.active{color:var(--text);border-bottom-color:var(--primary)}.harness-dot{width:7px;height:7px;border-radius:50%;background:var(--muted)}.harness-dot.ok{background:var(--accent-green)}.harness-dot.err{background:var(--accent-red)}.harness-dot.warn{background:var(--accent-amber)}.env-table{width:100%;border-collapse:collapse;font-size:12.5px;table-layout:fixed}.env-table td:first-child{width:32%;overflow-wrap:anywhere}.env-table .badge{margin-left:8px}.env-table input{width:100%;border:none;background:transparent;padding:0}.env-table input:focus{box-shadow:0 1px 0 0 var(--text)}.env-table td{height:36px;padding:0 10px 0 0;vertical-align:middle;border-bottom:1px solid var(--border-variant)}.env-table td:last-child{width:116px;white-space:nowrap;text-align:right}.env-table td[colspan]{white-space:normal;text-align:left}.env-table .icon-btn{margin-left:8px;vertical-align:middle}.env-table .icon-btn:hover{color:var(--accent-red)}.flavor-table{width:100%;border-collapse:collapse;font-size:12.5px}.flavor-table th{padding:5px 10px 5px 0;border-bottom:1px solid var(--border);text-align:left;font-weight:500;color:var(--muted)}.flavor-table td{padding:5px 10px 5px 0;border-bottom:1px solid var(--border-variant)}.ssh-table{table-layout:fixed}.ssh-table th:nth-child(1){width:20%}.ssh-table th:nth-child(2){width:26%}.ssh-table th:nth-child(4){width:108px}.ssh-table th:nth-child(5){width:52px}.ssh-table td{overflow-wrap:anywhere}.ssh-table td:last-child{padding-right:0;text-align:right}.ssh-tested-at{display:block;margin-top:2px;color:var(--muted);font-size:11px}@keyframes settings-spin{to{transform:rotate(360deg)}}.spin{animation:settings-spin .9s linear infinite}.model-picker,.option-picker{position:relative;display:inline-flex}.composer-pill{display:inline-flex;align-items:center;gap:5px;font-family:var(--mono);font-size:11.5px;color:var(--subtext);padding:5px 8px;border-radius:6px}.composer-pill:hover{background:var(--surface);color:var(--text)}.composer-bare{display:inline-flex;align-items:center;gap:3px;font-size:11.5px;color:var(--subtext);padding:5px 4px;border-radius:6px}.composer-bare:hover{color:var(--text)}.model-menu,.option-menu{position:absolute;bottom:calc(100% + 8px);left:0;max-height:380px;display:flex;flex-direction:column;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.model-menu{width:320px}.option-menu{min-width:190px;padding:6px}.model-menu.align-right,.option-menu.align-right{left:auto;right:0}.option-menu.drop-down{bottom:auto;top:calc(100% + 4px)}.option-menu.session-menu{left:auto;right:6px;top:calc(100% - 2px);min-width:140px}.model-item.danger,.model-item.danger:hover{color:var(--accent-red)}.option-default{color:var(--muted);font-weight:400}.option-sep{height:1px;margin:5px 4px;background:var(--border-variant)}.option-num{color:var(--muted);font-size:11px;font-variant-numeric:tabular-nums}.model-menu input{border:none;border-bottom:1px solid var(--border-variant);background:none;padding:9px 12px;font-size:12.5px;outline:none}.model-menu-list{overflow-y:auto;padding:6px}.model-group{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);padding:8px 8px 4px}.model-item{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:12.5px;border-radius:6px}.model-item:hover{background:var(--surface)}.model-item .model-id{display:block;font-family:var(--mono);font-size:10px;color:var(--muted)}.model-more{padding:4px 8px 8px;font-size:11px;color:var(--muted)}.model-locked-note{display:flex;align-items:center;gap:6px;padding:7px 12px;font-size:11px;color:var(--muted);border-top:1px solid var(--border-variant)}.model-locked-note svg{flex-shrink:0}.skill-menu{position:absolute;bottom:calc(100% + 8px);left:0;min-width:340px;max-width:100%;padding:6px;background:var(--base);border:1px solid var(--border);border-radius:10px;box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.skill-item{display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;padding:7px 8px;border-radius:6px}.skill-item.active{background:var(--surface)}.skill-item .skill-name{font-family:var(--mono);font-size:12px}.skill-item .skill-hint{color:var(--muted)}.skill-item .skill-desc{font-size:11px;color:var(--subtext)}.file-view{display:flex;flex-direction:column;height:100%;min-height:0}.file-view-header{display:flex;align-items:center;gap:8px;padding:10px 14px;border-bottom:1px solid var(--border-variant);color:var(--subtext);flex-shrink:0}.file-view-path{font-family:var(--mono);font-size:12px;color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-view-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.file-view-code{margin:0;padding:14px 16px;font-family:var(--mono);font-size:12px;line-height:1.55;-moz-tab-size:4;tab-size:4;min-width:max-content}.file-view-note{padding:10px 16px;font-size:12px;color:var(--muted)}.file-view-md{max-width:var(--readable-col);padding:18px 20px 32px}.file-view-md .md{font-size:13.5px}.file-view-md .md h1{font-size:1.5em;margin:18px 0 8px}.file-view-md .md h2{font-size:1.25em;margin:16px 0 8px}.file-view-md .md h3{font-size:1.1em}.icon-btn.active{color:var(--primary);background:var(--surface)}.prompt-card{margin:8px 0;padding:12px 14px;border:1px solid var(--border);border-left:3px solid var(--border);border-radius:6px;background:var(--surface);display:flex;flex-direction:column;gap:9px}.prompt-card.plan{border-left-color:var(--accent-blue)}.prompt-card.permission{border-left-color:var(--accent-amber)}.prompt-card.question{border-left-color:var(--accent-purple)}.prompt-card.resolved{opacity:.6}.prompt-head{font-size:11px;font-weight:600;letter-spacing:.03em;text-transform:uppercase;color:var(--muted)}.prompt-head code{font-family:var(--mono);font-size:11.5px;text-transform:none;color:var(--text)}.prompt-sub{font-family:var(--mono);font-size:12px;color:var(--subtext);word-break:break-word}.prompt-q{font-size:14px;font-weight:600;line-height:1.5;color:var(--text)}.prompt-plan{font-size:13.5px;line-height:1.6;color:var(--text);max-height:340px;overflow-y:auto}.prompt-options{display:flex;flex-direction:column;gap:6px}.prompt-option{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;padding:8px 11px;text-align:left;border:1px solid var(--border);border-radius:5px;background:var(--base);color:var(--text);cursor:pointer;transition:border-color 80ms ease,background 80ms ease}.prompt-option:hover:not(:disabled){border-color:var(--border-strong);background:var(--surface)}.prompt-option.sel{border-color:var(--primary);background:var(--primary-subtle)}.prompt-option:disabled{cursor:default}.prompt-option-label{display:block;font-size:13px;font-weight:600}.prompt-option-desc{display:block;font-size:12px;font-weight:400;line-height:1.45;color:var(--subtext)}.prompt-actions{display:flex;flex-wrap:wrap;gap:8px}.prompt-actions .btn-primary,.prompt-actions .btn-ghost{display:inline-flex;align-items:center;gap:6px;padding:6px 13px;font-family:inherit;font-size:12px;font-weight:600;border:1px solid transparent;border-radius:5px;cursor:pointer;transition:background 80ms ease,border-color 80ms ease}.prompt-actions .btn-primary{background:var(--primary);color:var(--base)}.prompt-actions .btn-primary:hover:not(:disabled){opacity:.9}.prompt-actions .btn-ghost{background:transparent;border-color:var(--border);color:var(--subtext)}.prompt-actions .btn-ghost:hover:not(:disabled){border-color:var(--border-strong);color:var(--text);background:var(--surface)}.prompt-actions button:disabled{opacity:.5;cursor:default}.prompt-resolved{font-size:11px;font-weight:600;color:var(--muted)}.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #555;--xy-background-pattern-lines-color-default: #333;--xy-background-pattern-cross-color-default: #333;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}/** * Copyright (c) 2014 The xterm.js authors. All rights reserved. * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) * https://github.com/chjj/term.js diff --git a/ui/dist/assets/index-CdAQVowh.js b/ui/dist/assets/index-kwecO5jT.js similarity index 56% rename from ui/dist/assets/index-CdAQVowh.js rename to ui/dist/assets/index-kwecO5jT.js index d457d76b..82574ddb 100644 --- a/ui/dist/assets/index-CdAQVowh.js +++ b/ui/dist/assets/index-kwecO5jT.js @@ -1,4 +1,4 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();function Lu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rd={exports:{}},po={};/** +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();function Bu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Od={exports:{}},po={};/** * @license React * react-jsx-runtime.production.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var _y;function Gk(){if(_y)return po;_y=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,l){var c=null;if(l!==void 0&&(c=""+l),a.key!==void 0&&(c=""+a.key),"key"in a){l={};for(var o in a)o!=="key"&&(l[o]=a[o])}else l=a;return a=l.ref,{$$typeof:e,type:r,key:c,ref:a!==void 0?a:null,props:l}}return po.Fragment=t,po.jsx=n,po.jsxs=n,po}var vy;function qk(){return vy||(vy=1,Rd.exports=Gk()),Rd.exports}var S=qk(),Md={exports:{}},ze={};/** + */var xy;function Wk(){if(xy)return po;xy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,l){var c=null;if(l!==void 0&&(c=""+l),a.key!==void 0&&(c=""+a.key),"key"in a){l={};for(var o in a)o!=="key"&&(l[o]=a[o])}else l=a;return a=l.ref,{$$typeof:e,type:r,key:c,ref:a!==void 0?a:null,props:l}}return po.Fragment=t,po.jsx=n,po.jsxs=n,po}var wy;function Xk(){return wy||(wy=1,Od.exports=Wk()),Od.exports}var v=Xk(),jd={exports:{}},ze={};/** * @license React * react.production.js * @@ -14,7 +14,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var yy;function Vk(){if(yy)return ze;yy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),m=Symbol.iterator;function _(j){return j===null||typeof j!="object"?null:(j=m&&j[m]||j["@@iterator"],typeof j=="function"?j:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,y={};function b(j,$,U){this.props=j,this.context=$,this.refs=y,this.updater=U||w}b.prototype.isReactComponent={},b.prototype.setState=function(j,$){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,$,"setState")},b.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function x(){}x.prototype=b.prototype;function v(j,$,U){this.props=j,this.context=$,this.refs=y,this.updater=U||w}var k=v.prototype=new x;k.constructor=v,C(k,b.prototype),k.isPureReactComponent=!0;var D=Array.isArray;function T(){}var R={H:null,A:null,T:null,S:null},N=Object.prototype.hasOwnProperty;function L(j,$,U){var Q=U.ref;return{$$typeof:e,type:j,key:$,ref:Q!==void 0?Q:null,props:U}}function I(j,$){return L(j.type,$,j.props)}function F(j){return typeof j=="object"&&j!==null&&j.$$typeof===e}function V(j){var $={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(U){return $[U]})}var H=/\/+/g;function z(j,$){return typeof j=="object"&&j!==null&&j.key!=null?V(""+j.key):$.toString(36)}function q(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(T,T):(j.status="pending",j.then(function($){j.status==="pending"&&(j.status="fulfilled",j.value=$)},function($){j.status==="pending"&&(j.status="rejected",j.reason=$)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function G(j,$,U,Q,ie){var se=typeof j;(se==="undefined"||se==="boolean")&&(j=null);var Z=!1;if(j===null)Z=!0;else switch(se){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(j.$$typeof){case e:case t:Z=!0;break;case g:return Z=j._init,G(Z(j._payload),$,U,Q,ie)}}if(Z)return ie=ie(j),Z=Q===""?"."+z(j,0):Q,D(ie)?(U="",Z!=null&&(U=Z.replace(H,"$&/")+"/"),G(ie,$,U,"",function(te){return te})):ie!=null&&(F(ie)&&(ie=I(ie,U+(ie.key==null||j&&j.key===ie.key?"":(""+ie.key).replace(H,"$&/")+"/")+Z)),$.push(ie)),1;Z=0;var P=Q===""?".":Q+":";if(D(j))for(var ee=0;ee>>1,M=G[O];if(0>>1;Oa(U,K))Qa(ie,U)?(G[O]=ie,G[Q]=K,O=Q):(G[O]=U,G[$]=K,O=$);else if(Qa(ie,K))G[O]=ie,G[Q]=K,O=Q;else break e}}return X}function a(G,X){var K=G.sortIndex-X.sortIndex;return K!==0?K:G.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,o=c.now();e.unstable_now=function(){return c.now()-o}}var u=[],f=[],g=1,d=null,m=3,_=!1,w=!1,C=!1,y=!1,b=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;function k(G){for(var X=n(f);X!==null;){if(X.callback===null)r(f);else if(X.startTime<=G)r(f),X.sortIndex=X.expirationTime,t(u,X);else break;X=n(f)}}function D(G){if(C=!1,k(G),!w)if(n(u)!==null)w=!0,T||(T=!0,V());else{var X=n(f);X!==null&&q(D,X.startTime-G)}}var T=!1,R=-1,N=5,L=-1;function I(){return y?!0:!(e.unstable_now()-LG&&I());){var O=d.callback;if(typeof O=="function"){d.callback=null,m=d.priorityLevel;var M=O(d.expirationTime<=G);if(G=e.unstable_now(),typeof M=="function"){d.callback=M,k(G),X=!0;break t}d===n(u)&&r(u),k(G)}else r(u);d=n(u)}if(d!==null)X=!0;else{var j=n(f);j!==null&&q(D,j.startTime-G),X=!1}}break e}finally{d=null,m=K,_=!1}X=void 0}}finally{X?V():T=!1}}}var V;if(typeof v=="function")V=function(){v(F)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,z=H.port2;H.port1.onmessage=F,V=function(){z.postMessage(null)}}else V=function(){b(F,0)};function q(G,X){R=b(function(){G(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(G){G.callback=null},e.unstable_forceFrameRate=function(G){0>G||125O?(G.sortIndex=K,t(f,G),n(u)===null&&G===n(f)&&(C?(x(R),R=-1):C=!0,q(D,K-O))):(G.sortIndex=M,t(u,G),w||_||(w=!0,T||(T=!0,V()))),G},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(G){var X=m;return function(){var K=m;m=X;try{return G.apply(this,arguments)}finally{m=K}}}})(jd)),jd}var xy;function Xk(){return xy||(xy=1,Od.exports=Wk()),Od.exports}var Bd={exports:{}},Qt={};/** + */var ky;function Qk(){return ky||(ky=1,(function(e){function t(G,X){var K=G.length;G.push(X);e:for(;0>>1,M=G[O];if(0>>1;Oa(U,K))Qa(ie,U)?(G[O]=ie,G[Q]=K,O=Q):(G[O]=U,G[$]=K,O=$);else if(Qa(ie,K))G[O]=ie,G[Q]=K,O=Q;else break e}}return X}function a(G,X){var K=G.sortIndex-X.sortIndex;return K!==0?K:G.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,o=c.now();e.unstable_now=function(){return c.now()-o}}var u=[],f=[],g=1,d=null,m=3,_=!1,w=!1,C=!1,b=!1,S=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;function k(G){for(var X=n(f);X!==null;){if(X.callback===null)r(f);else if(X.startTime<=G)r(f),X.sortIndex=X.expirationTime,t(u,X);else break;X=n(f)}}function D(G){if(C=!1,k(G),!w)if(n(u)!==null)w=!0,T||(T=!0,V());else{var X=n(f);X!==null&&q(D,X.startTime-G)}}var T=!1,R=-1,N=5,L=-1;function I(){return b?!0:!(e.unstable_now()-LG&&I());){var O=d.callback;if(typeof O=="function"){d.callback=null,m=d.priorityLevel;var M=O(d.expirationTime<=G);if(G=e.unstable_now(),typeof M=="function"){d.callback=M,k(G),X=!0;break t}d===n(u)&&r(u),k(G)}else r(u);d=n(u)}if(d!==null)X=!0;else{var j=n(f);j!==null&&q(D,j.startTime-G),X=!1}}break e}finally{d=null,m=K,_=!1}X=void 0}}finally{X?V():T=!1}}}var V;if(typeof y=="function")V=function(){y(F)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,z=H.port2;H.port1.onmessage=F,V=function(){z.postMessage(null)}}else V=function(){S(F,0)};function q(G,X){R=S(function(){G(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(G){G.callback=null},e.unstable_forceFrameRate=function(G){0>G||125O?(G.sortIndex=K,t(f,G),n(u)===null&&G===n(f)&&(C?(x(R),R=-1):C=!0,q(D,K-O))):(G.sortIndex=M,t(u,G),w||_||(w=!0,T||(T=!0,V()))),G},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(G){var X=m;return function(){var K=m;m=X;try{return G.apply(this,arguments)}finally{m=K}}}})(zd)),zd}var Ay;function Jk(){return Ay||(Ay=1,Id.exports=Qk()),Id.exports}var Hd={exports:{}},Jt={};/** * @license React * react-dom.production.js * @@ -30,7 +30,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var wy;function Kk(){if(wy)return Qt;wy=1;var e=Ko();function t(u){var f="https://react.dev/errors/"+u;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Bd.exports=Kk(),Bd.exports}/** + */var Ty;function eA(){if(Ty)return Jt;Ty=1;var e=Qo();function t(u){var f="https://react.dev/errors/"+u;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Hd.exports=eA(),Hd.exports}/** * @license React * react-dom-client.production.js * @@ -38,289 +38,297 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ey;function Zk(){if(Ey)return go;Ey=1;var e=Xk(),t=Ko(),n=TS();function r(i){var s="https://react.dev/errors/"+i;if(1M||(i.current=O[M],O[M]=null,M--)}function U(i,s){M++,O[M]=i.current,i.current=s}var Q=j(null),ie=j(null),se=j(null),Z=j(null);function P(i,s){switch(U(se,s),U(ie,i),U(Q,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?Fv(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=Fv(s),i=Pv(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}$(Q),U(Q,i)}function ee(){$(Q),$(ie),$(se)}function te(i){i.memoizedState!==null&&U(Z,i);var s=Q.current,h=Pv(s,i.type);s!==h&&(U(ie,i),U(Q,h))}function pe(i){ie.current===i&&($(Q),$(ie)),Z.current===i&&($(Z),co._currentValue=K)}var ue,me;function we(i){if(ue===void 0)try{throw Error()}catch(h){var s=h.stack.trim().match(/\n( *(at )?)/);ue=s&&s[1]||"",me=-1M||(i.current=O[M],O[M]=null,M--)}function U(i,s){M++,O[M]=i.current,i.current=s}var Q=j(null),ie=j(null),se=j(null),Z=j(null);function P(i,s){switch(U(se,s),U(ie,i),U(Q,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?qv(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=qv(s),i=Vv(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}$(Q),U(Q,i)}function ee(){$(Q),$(ie),$(se)}function te(i){i.memoizedState!==null&&U(Z,i);var s=Q.current,h=Vv(s,i.type);s!==h&&(U(ie,i),U(Q,h))}function pe(i){ie.current===i&&($(Q),$(ie)),Z.current===i&&($(Z),co._currentValue=K)}var ue,me;function we(i){if(ue===void 0)try{throw Error()}catch(h){var s=h.stack.trim().match(/\n( *(at )?)/);ue=s&&s[1]||"",me=-1)":-1E||J[p]!==oe[E]){var ge=` `+J[p].replace(" at new "," at ");return i.displayName&&ge.includes("")&&(ge=ge.replace("",i.displayName)),ge}while(1<=p&&0<=E);break}}}finally{le=!1,Error.prepareStackTrace=h}return(h=i?i.displayName||i.name:"")?we(h):""}function be(i,s){switch(i.tag){case 26:case 27:case 5:return we(i.type);case 16:return we("Lazy");case 13:return i.child!==s&&s!==null?we("Suspense Fallback"):we("Suspense");case 19:return we("SuspenseList");case 0:case 15:return ye(i.type,!1);case 11:return ye(i.type.render,!1);case 1:return ye(i.type,!0);case 31:return we("Activity");default:return""}}function Be(i){try{var s="",h=null;do s+=be(i,h),h=i,i=i.return;while(i);return s}catch(p){return` Error generating stack: `+p.message+` -`+p.stack}}var Ve=Object.prototype.hasOwnProperty,Pe=e.unstable_scheduleCallback,lt=e.unstable_cancelCallback,Rt=e.unstable_shouldYield,gt=e.unstable_requestPaint,tt=e.unstable_now,ct=e.unstable_getCurrentPriorityLevel,de=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,Ee=e.unstable_NormalPriority,Le=e.unstable_LowPriority,je=e.unstable_IdlePriority,wt=e.log,Ue=e.unstable_setDisableYieldValue,Tt=null,Ct=null;function Ut(i){if(typeof wt=="function"&&Ue(i),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Tt,i)}catch{}}var nt=Math.clz32?Math.clz32:Oe,he=Math.log,Ce=Math.LN2;function Oe(i){return i>>>=0,i===0?32:31-(he(i)/Ce|0)|0}var Ze=256,ot=262144,fi=4194304;function Ot(i){var s=i&42;if(s!==0)return s;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Hi(i,s,h){var p=i.pendingLanes;if(p===0)return 0;var E=0,A=i.suspendedLanes,B=i.pingedLanes;i=i.warmLanes;var Y=p&134217727;return Y!==0?(p=Y&~A,p!==0?E=Ot(p):(B&=Y,B!==0?E=Ot(B):h||(h=Y&~i,h!==0&&(E=Ot(h))))):(Y=p&~A,Y!==0?E=Ot(Y):B!==0?E=Ot(B):h||(h=p&~i,h!==0&&(E=Ot(h)))),E===0?0:s!==0&&s!==E&&(s&A)===0&&(A=E&-E,h=s&-s,A>=h||A===32&&(h&4194048)!==0)?s:E}function wr(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function bh(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 cl(){var i=fi;return fi<<=1,(fi&62914560)===0&&(fi=4194304),i}function _a(i){for(var s=[],h=0;31>h;h++)s.push(i);return s}function Cr(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Sh(i,s,h,p,E,A){var B=i.pendingLanes;i.pendingLanes=h,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=h,i.entangledLanes&=h,i.errorRecoveryDisabledLanes&=h,i.shellSuspendCounter=0;var Y=i.entanglements,J=i.expirationTimes,oe=i.hiddenUpdates;for(h=B&~h;0"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var Sl=/[\n"\\]/g;function an(i){return i.replace(Sl,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function wa(i,s,h,p,E,A,B,Y){i.name="",B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?i.type=B:i.removeAttribute("type"),s!=null?B==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+sn(s)):i.value!==""+sn(s)&&(i.value=""+sn(s)):B!=="submit"&&B!=="reset"||i.removeAttribute("value"),s!=null?Ca(i,B,sn(s)):h!=null?Ca(i,B,sn(h)):p!=null&&i.removeAttribute("value"),E==null&&A!=null&&(i.defaultChecked=!!A),E!=null&&(i.checked=E&&typeof E!="function"&&typeof E!="symbol"),Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?i.name=""+sn(Y):i.removeAttribute("name")}function hs(i,s,h,p,E,A,B,Y){if(A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(i.type=A),s!=null||h!=null){if(!(A!=="submit"&&A!=="reset"||s!=null)){xa(i);return}h=h!=null?""+sn(h):"",s=s!=null?""+sn(s):h,Y||s===i.value||(i.value=s),i.defaultValue=s}p=p??E,p=typeof p!="function"&&typeof p!="symbol"&&!!p,i.checked=Y?i.checked:!!p,i.defaultChecked=!!p,B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"&&(i.name=B),xa(i)}function Ca(i,s,h){s==="number"&&us(i.ownerDocument)===i||i.defaultValue===""+h||(i.defaultValue=""+h)}function qi(i,s,h,p){if(i=i.options,s){s={};for(var E=0;E"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Dh=!1;if(mi)try{var Aa={};Object.defineProperty(Aa,"passive",{get:function(){Dh=!0}}),window.addEventListener("test",Aa,Aa),window.removeEventListener("test",Aa,Aa)}catch{Dh=!1}var Vi=null,Rh=null,wl=null;function Pm(){if(wl)return wl;var i,s=Rh,h=s.length,p,E="value"in Vi?Vi.value:Vi.textContent,A=E.length;for(i=0;i=Da),Ym=" ",Wm=!1;function Xm(i,s){switch(i){case"keyup":return f2.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Km(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var gs=!1;function p2(i,s){switch(i){case"compositionend":return Km(s);case"keypress":return s.which!==32?null:(Wm=!0,Ym);case"textInput":return i=s.data,i===Ym&&Wm?null:i;default:return null}}function g2(i,s){if(gs)return i==="compositionend"||!Bh&&Xm(i,s)?(i=Pm(),wl=Rh=Vi=null,gs=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:h,offset:s-i};i=p}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=r0(h)}}function a0(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?a0(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function o0(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=us(i.document);s instanceof i.HTMLIFrameElement;){try{var h=typeof s.contentWindow.location.href=="string"}catch{h=!1}if(h)i=s.contentWindow;else break;s=us(i.document)}return s}function Hh(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var w2=mi&&"documentMode"in document&&11>=document.documentMode,ms=null,Fh=null,Oa=null,Ph=!1;function l0(i,s,h){var p=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Ph||ms==null||ms!==us(p)||(p=ms,"selectionStart"in p&&Hh(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Oa&&La(Oa,p)||(Oa=p,p=mc(Fh,"onSelect"),0>=B,E-=B,Jn=1<<32-nt(s)+E|h<Fe?(We=Ae,Ae=null):We=Ae.sibling;var rt=ce(re,Ae,ae[Fe],_e);if(rt===null){Ae===null&&(Ae=We);break}i&&Ae&&rt.alternate===null&&s(re,Ae),ne=A(rt,ne,Fe),it===null?De=rt:it.sibling=rt,it=rt,Ae=We}if(Fe===ae.length)return h(re,Ae),Xe&&vi(re,Fe),De;if(Ae===null){for(;FeFe?(We=Ae,Ae=null):We=Ae.sibling;var pr=ce(re,Ae,rt.value,_e);if(pr===null){Ae===null&&(Ae=We);break}i&&Ae&&pr.alternate===null&&s(re,Ae),ne=A(pr,ne,Fe),it===null?De=pr:it.sibling=pr,it=pr,Ae=We}if(rt.done)return h(re,Ae),Xe&&vi(re,Fe),De;if(Ae===null){for(;!rt.done;Fe++,rt=ae.next())rt=ve(re,rt.value,_e),rt!==null&&(ne=A(rt,ne,Fe),it===null?De=rt:it.sibling=rt,it=rt);return Xe&&vi(re,Fe),De}for(Ae=p(Ae);!rt.done;Fe++,rt=ae.next())rt=fe(Ae,re,Fe,rt.value,_e),rt!==null&&(i&&rt.alternate!==null&&Ae.delete(rt.key===null?Fe:rt.key),ne=A(rt,ne,Fe),it===null?De=rt:it.sibling=rt,it=rt);return i&&Ae.forEach(function($k){return s(re,$k)}),Xe&&vi(re,Fe),De}function pt(re,ne,ae,_e){if(typeof ae=="object"&&ae!==null&&ae.type===C&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case _:e:{for(var De=ae.key;ne!==null;){if(ne.key===De){if(De=ae.type,De===C){if(ne.tag===7){h(re,ne.sibling),_e=E(ne,ae.props.children),_e.return=re,re=_e;break e}}else if(ne.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===N&&Br(De)===ne.type){h(re,ne.sibling),_e=E(ne,ae.props),Fa(_e,ae),_e.return=re,re=_e;break e}h(re,ne);break}else s(re,ne);ne=ne.sibling}ae.type===C?(_e=Rr(ae.props.children,re.mode,_e,ae.key),_e.return=re,re=_e):(_e=Ll(ae.type,ae.key,ae.props,null,re.mode,_e),Fa(_e,ae),_e.return=re,re=_e)}return B(re);case w:e:{for(De=ae.key;ne!==null;){if(ne.key===De)if(ne.tag===4&&ne.stateNode.containerInfo===ae.containerInfo&&ne.stateNode.implementation===ae.implementation){h(re,ne.sibling),_e=E(ne,ae.children||[]),_e.return=re,re=_e;break e}else{h(re,ne);break}else s(re,ne);ne=ne.sibling}_e=Wh(ae,re.mode,_e),_e.return=re,re=_e}return B(re);case N:return ae=Br(ae),pt(re,ne,ae,_e)}if(q(ae))return ke(re,ne,ae,_e);if(V(ae)){if(De=V(ae),typeof De!="function")throw Error(r(150));return ae=De.call(ae),Me(re,ne,ae,_e)}if(typeof ae.then=="function")return pt(re,ne,Fl(ae),_e);if(ae.$$typeof===v)return pt(re,ne,Bl(re,ae),_e);Pl(re,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,ne!==null&&ne.tag===6?(h(re,ne.sibling),_e=E(ne,ae),_e.return=re,re=_e):(h(re,ne),_e=Yh(ae,re.mode,_e),_e.return=re,re=_e),B(re)):h(re,ne)}return function(re,ne,ae,_e){try{Ha=0;var De=pt(re,ne,ae,_e);return As=null,De}catch(Ae){if(Ae===ks||Ae===zl)throw Ae;var it=vn(29,Ae,null,re.mode);return it.lanes=_e,it.return=re,it}finally{}}}var zr=R0(!0),M0=R0(!1),Zi=!1;function of(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lf(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Qi(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Ji(i,s,h){var p=i.updateQueue;if(p===null)return null;if(p=p.shared,(st&2)!==0){var E=p.pending;return E===null?s.next=s:(s.next=E.next,E.next=s),p.pending=s,s=Ml(i),g0(i,null,h),s}return Rl(i,p,s,h),Ml(i)}function Pa(i,s,h){if(s=s.updateQueue,s!==null&&(s=s.shared,(h&4194048)!==0)){var p=s.lanes;p&=i.pendingLanes,h|=p,s.lanes=h,hl(i,h)}}function cf(i,s){var h=i.updateQueue,p=i.alternate;if(p!==null&&(p=p.updateQueue,h===p)){var E=null,A=null;if(h=h.firstBaseUpdate,h!==null){do{var B={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};A===null?E=A=B:A=A.next=B,h=h.next}while(h!==null);A===null?E=A=s:A=A.next=s}else E=A=s;h={baseState:p.baseState,firstBaseUpdate:E,lastBaseUpdate:A,shared:p.shared,callbacks:p.callbacks},i.updateQueue=h;return}i=h.lastBaseUpdate,i===null?h.firstBaseUpdate=s:i.next=s,h.lastBaseUpdate=s}var uf=!1;function Ua(){if(uf){var i=Es;if(i!==null)throw i}}function $a(i,s,h,p){uf=!1;var E=i.updateQueue;Zi=!1;var A=E.firstBaseUpdate,B=E.lastBaseUpdate,Y=E.shared.pending;if(Y!==null){E.shared.pending=null;var J=Y,oe=J.next;J.next=null,B===null?A=oe:B.next=oe,B=J;var ge=i.alternate;ge!==null&&(ge=ge.updateQueue,Y=ge.lastBaseUpdate,Y!==B&&(Y===null?ge.firstBaseUpdate=oe:Y.next=oe,ge.lastBaseUpdate=J))}if(A!==null){var ve=E.baseState;B=0,ge=oe=J=null,Y=A;do{var ce=Y.lane&-536870913,fe=ce!==Y.lane;if(fe?(Ye&ce)===ce:(p&ce)===ce){ce!==0&&ce===Cs&&(uf=!0),ge!==null&&(ge=ge.next={lane:0,tag:Y.tag,payload:Y.payload,callback:null,next:null});e:{var ke=i,Me=Y;ce=s;var pt=h;switch(Me.tag){case 1:if(ke=Me.payload,typeof ke=="function"){ve=ke.call(pt,ve,ce);break e}ve=ke;break e;case 3:ke.flags=ke.flags&-65537|128;case 0:if(ke=Me.payload,ce=typeof ke=="function"?ke.call(pt,ve,ce):ke,ce==null)break e;ve=d({},ve,ce);break e;case 2:Zi=!0}}ce=Y.callback,ce!==null&&(i.flags|=64,fe&&(i.flags|=8192),fe=E.callbacks,fe===null?E.callbacks=[ce]:fe.push(ce))}else fe={lane:ce,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},ge===null?(oe=ge=fe,J=ve):ge=ge.next=fe,B|=ce;if(Y=Y.next,Y===null){if(Y=E.shared.pending,Y===null)break;fe=Y,Y=fe.next,fe.next=null,E.lastBaseUpdate=fe,E.shared.pending=null}}while(!0);ge===null&&(J=ve),E.baseState=J,E.firstBaseUpdate=oe,E.lastBaseUpdate=ge,A===null&&(E.shared.lanes=0),rr|=B,i.lanes=B,i.memoizedState=ve}}function L0(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function O0(i,s){var h=i.callbacks;if(h!==null)for(i.callbacks=null,i=0;iA?A:8;var B=G.T,Y={};G.T=Y,Nf(i,!1,s,h);try{var J=E(),oe=G.S;if(oe!==null&&oe(Y,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var ge=M2(J,p);Va(i,s,ge,wn(i))}else Va(i,s,p,wn(i))}catch(ve){Va(i,s,{then:function(){},status:"rejected",reason:ve},wn())}finally{X.p=A,B!==null&&Y.types!==null&&(B.types=Y.types),G.T=B}}function z2(){}function Af(i,s,h,p){if(i.tag!==5)throw Error(r(476));var E=f_(i).queue;h_(i,E,s,K,h===null?z2:function(){return d_(i),h(p)})}function f_(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xi,lastRenderedState:K},next:null};var h={};return s.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xi,lastRenderedState:h},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function d_(i){var s=f_(i);s.next===null&&(s=i.alternate.memoizedState),Va(i,s.next.queue,{},wn())}function Tf(){return Wt(co)}function p_(){return Lt().memoizedState}function g_(){return Lt().memoizedState}function H2(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var h=wn();i=Qi(h);var p=Ji(s,i,h);p!==null&&(fn(p,s,h),Pa(p,s,h)),s={cache:nf()},i.payload=s;return}s=s.return}}function F2(i,s,h){var p=wn();h={lane:p,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Zl(i)?__(s,h):(h=qh(i,s,h,p),h!==null&&(fn(h,i,p),v_(h,s,p)))}function m_(i,s,h){var p=wn();Va(i,s,h,p)}function Va(i,s,h,p){var E={lane:p,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(Zl(i))__(s,E);else{var A=i.alternate;if(i.lanes===0&&(A===null||A.lanes===0)&&(A=s.lastRenderedReducer,A!==null))try{var B=s.lastRenderedState,Y=A(B,h);if(E.hasEagerState=!0,E.eagerState=Y,_n(Y,B))return Rl(i,s,E,0),mt===null&&Dl(),!1}catch{}finally{}if(h=qh(i,s,E,p),h!==null)return fn(h,i,p),v_(h,s,p),!0}return!1}function Nf(i,s,h,p){if(p={lane:2,revertLane:od(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Zl(i)){if(s)throw Error(r(479))}else s=qh(i,h,p,2),s!==null&&fn(s,i,2)}function Zl(i){var s=i.alternate;return i===He||s!==null&&s===He}function __(i,s){Ns=Gl=!0;var h=i.pending;h===null?s.next=s:(s.next=h.next,h.next=s),i.pending=s}function v_(i,s,h){if((h&4194048)!==0){var p=s.lanes;p&=i.pendingLanes,h|=p,s.lanes=h,hl(i,h)}}var Ya={readContext:Wt,use:Yl,useCallback:Nt,useContext:Nt,useEffect:Nt,useImperativeHandle:Nt,useLayoutEffect:Nt,useInsertionEffect:Nt,useMemo:Nt,useReducer:Nt,useRef:Nt,useState:Nt,useDebugValue:Nt,useDeferredValue:Nt,useTransition:Nt,useSyncExternalStore:Nt,useId:Nt,useHostTransitionStatus:Nt,useFormState:Nt,useActionState:Nt,useOptimistic:Nt,useMemoCache:Nt,useCacheRefresh:Nt};Ya.useEffectEvent=Nt;var y_={readContext:Wt,use:Yl,useCallback:function(i,s){return nn().memoizedState=[i,s===void 0?null:s],i},useContext:Wt,useEffect:n_,useImperativeHandle:function(i,s,h){h=h!=null?h.concat([i]):null,Xl(4194308,4,a_.bind(null,s,i),h)},useLayoutEffect:function(i,s){return Xl(4194308,4,i,s)},useInsertionEffect:function(i,s){Xl(4,2,i,s)},useMemo:function(i,s){var h=nn();s=s===void 0?null:s;var p=i();if(Hr){Ut(!0);try{i()}finally{Ut(!1)}}return h.memoizedState=[p,s],p},useReducer:function(i,s,h){var p=nn();if(h!==void 0){var E=h(s);if(Hr){Ut(!0);try{h(s)}finally{Ut(!1)}}}else E=s;return p.memoizedState=p.baseState=E,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:E},p.queue=i,i=i.dispatch=F2.bind(null,He,i),[p.memoizedState,i]},useRef:function(i){var s=nn();return i={current:i},s.memoizedState=i},useState:function(i){i=xf(i);var s=i.queue,h=m_.bind(null,He,s);return s.dispatch=h,[i.memoizedState,h]},useDebugValue:Ef,useDeferredValue:function(i,s){var h=nn();return kf(h,i,s)},useTransition:function(){var i=xf(!1);return i=h_.bind(null,He,i.queue,!0,!1),nn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,h){var p=He,E=nn();if(Xe){if(h===void 0)throw Error(r(407));h=h()}else{if(h=s(),mt===null)throw Error(r(349));(Ye&127)!==0||F0(p,s,h)}E.memoizedState=h;var A={value:h,getSnapshot:s};return E.queue=A,n_(U0.bind(null,p,A,i),[i]),p.flags|=2048,Rs(9,{destroy:void 0},P0.bind(null,p,A,h,s),null),h},useId:function(){var i=nn(),s=mt.identifierPrefix;if(Xe){var h=ei,p=Jn;h=(p&~(1<<32-nt(p)-1)).toString(32)+h,s="_"+s+"R_"+h,h=ql++,0<\/script>",A=A.removeChild(A.firstChild);break;case"select":A=typeof p.is=="string"?B.createElement("select",{is:p.is}):B.createElement("select"),p.multiple?A.multiple=!0:p.size&&(A.size=p.size);break;default:A=typeof p.is=="string"?B.createElement(E,{is:p.is}):B.createElement(E)}}A[$t]=s,A[Zt]=p;e:for(B=s.child;B!==null;){if(B.tag===5||B.tag===6)A.appendChild(B.stateNode);else if(B.tag!==4&&B.tag!==27&&B.child!==null){B.child.return=B,B=B.child;continue}if(B===s)break e;for(;B.sibling===null;){if(B.return===null||B.return===s)break e;B=B.return}B.sibling.return=B.return,B=B.sibling}s.stateNode=A;e:switch(Kt(A,E,p),E){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&Ci(s)}}return bt(s),$f(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,h),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==p&&Ci(s);else{if(typeof p!="string"&&s.stateNode===null)throw Error(r(166));if(i=se.current,xs(s)){if(i=s.stateNode,h=s.memoizedProps,p=null,E=Yt,E!==null)switch(E.tag){case 27:case 5:p=E.memoizedProps}i[$t]=s,i=!!(i.nodeValue===h||p!==null&&p.suppressHydrationWarning===!0||zv(i.nodeValue,h)),i||Xi(s,!0)}else i=_c(i).createTextNode(p),i[$t]=s,s.stateNode=i}return bt(s),null;case 31:if(h=s.memoizedState,i===null||i.memoizedState!==null){if(p=xs(s),h!==null){if(i===null){if(!p)throw Error(r(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[$t]=s}else Mr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;bt(s),i=!1}else h=Qh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=h),i=!0;if(!i)return s.flags&256?(bn(s),s):(bn(s),null);if((s.flags&128)!==0)throw Error(r(558))}return bt(s),null;case 13:if(p=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(E=xs(s),p!==null&&p.dehydrated!==null){if(i===null){if(!E)throw Error(r(318));if(E=s.memoizedState,E=E!==null?E.dehydrated:null,!E)throw Error(r(317));E[$t]=s}else Mr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;bt(s),E=!1}else E=Qh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=E),E=!0;if(!E)return s.flags&256?(bn(s),s):(bn(s),null)}return bn(s),(s.flags&128)!==0?(s.lanes=h,s):(h=p!==null,i=i!==null&&i.memoizedState!==null,h&&(p=s.child,E=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(E=p.alternate.memoizedState.cachePool.pool),A=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(A=p.memoizedState.cachePool.pool),A!==E&&(p.flags|=2048)),h!==i&&h&&(s.child.flags|=8192),nc(s,s.updateQueue),bt(s),null);case 4:return ee(),i===null&&hd(s.stateNode.containerInfo),bt(s),null;case 10:return bi(s.type),bt(s),null;case 19:if($(Mt),p=s.memoizedState,p===null)return bt(s),null;if(E=(s.flags&128)!==0,A=p.rendering,A===null)if(E)Xa(p,!1);else{if(Dt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(A=$l(i),A!==null){for(s.flags|=128,Xa(p,!1),i=A.updateQueue,s.updateQueue=i,nc(s,i),s.subtreeFlags=0,i=h,h=s.child;h!==null;)m0(h,i),h=h.sibling;return U(Mt,Mt.current&1|2),Xe&&vi(s,p.treeForkCount),s.child}i=i.sibling}p.tail!==null&&tt()>oc&&(s.flags|=128,E=!0,Xa(p,!1),s.lanes=4194304)}else{if(!E)if(i=$l(A),i!==null){if(s.flags|=128,E=!0,i=i.updateQueue,s.updateQueue=i,nc(s,i),Xa(p,!0),p.tail===null&&p.tailMode==="hidden"&&!A.alternate&&!Xe)return bt(s),null}else 2*tt()-p.renderingStartTime>oc&&h!==536870912&&(s.flags|=128,E=!0,Xa(p,!1),s.lanes=4194304);p.isBackwards?(A.sibling=s.child,s.child=A):(i=p.last,i!==null?i.sibling=A:s.child=A,p.last=A)}return p.tail!==null?(i=p.tail,p.rendering=i,p.tail=i.sibling,p.renderingStartTime=tt(),i.sibling=null,h=Mt.current,U(Mt,E?h&1|2:h&1),Xe&&vi(s,p.treeForkCount),i):(bt(s),null);case 22:case 23:return bn(s),ff(),p=s.memoizedState!==null,i!==null?i.memoizedState!==null!==p&&(s.flags|=8192):p&&(s.flags|=8192),p?(h&536870912)!==0&&(s.flags&128)===0&&(bt(s),s.subtreeFlags&6&&(s.flags|=8192)):bt(s),h=s.updateQueue,h!==null&&nc(s,h.retryQueue),h=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),p=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),p!==h&&(s.flags|=2048),i!==null&&$(jr),null;case 24:return h=null,i!==null&&(h=i.memoizedState.cache),s.memoizedState.cache!==h&&(s.flags|=2048),bi(Bt),bt(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function q2(i,s){switch(Kh(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return bi(Bt),ee(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return pe(s),null;case 31:if(s.memoizedState!==null){if(bn(s),s.alternate===null)throw Error(r(340));Mr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(bn(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Mr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return $(Mt),null;case 4:return ee(),null;case 10:return bi(s.type),null;case 22:case 23:return bn(s),ff(),i!==null&&$(jr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return bi(Bt),null;case 25:return null;default:return null}}function $_(i,s){switch(Kh(s),s.tag){case 3:bi(Bt),ee();break;case 26:case 27:case 5:pe(s);break;case 4:ee();break;case 31:s.memoizedState!==null&&bn(s);break;case 13:bn(s);break;case 19:$(Mt);break;case 10:bi(s.type);break;case 22:case 23:bn(s),ff(),i!==null&&$(jr);break;case 24:bi(Bt)}}function Ka(i,s){try{var h=s.updateQueue,p=h!==null?h.lastEffect:null;if(p!==null){var E=p.next;h=E;do{if((h.tag&i)===i){p=void 0;var A=h.create,B=h.inst;p=A(),B.destroy=p}h=h.next}while(h!==E)}}catch(Y){ht(s,s.return,Y)}}function nr(i,s,h){try{var p=s.updateQueue,E=p!==null?p.lastEffect:null;if(E!==null){var A=E.next;p=A;do{if((p.tag&i)===i){var B=p.inst,Y=B.destroy;if(Y!==void 0){B.destroy=void 0,E=s;var J=h,oe=Y;try{oe()}catch(ge){ht(E,J,ge)}}}p=p.next}while(p!==A)}}catch(ge){ht(s,s.return,ge)}}function G_(i){var s=i.updateQueue;if(s!==null){var h=i.stateNode;try{O0(s,h)}catch(p){ht(i,i.return,p)}}}function q_(i,s,h){h.props=Fr(i.type,i.memoizedProps),h.state=i.memoizedState;try{h.componentWillUnmount()}catch(p){ht(i,s,p)}}function Za(i,s){try{var h=i.ref;if(h!==null){switch(i.tag){case 26:case 27:case 5:var p=i.stateNode;break;case 30:p=i.stateNode;break;default:p=i.stateNode}typeof h=="function"?i.refCleanup=h(p):h.current=p}}catch(E){ht(i,s,E)}}function ti(i,s){var h=i.ref,p=i.refCleanup;if(h!==null)if(typeof p=="function")try{p()}catch(E){ht(i,s,E)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(E){ht(i,s,E)}else h.current=null}function V_(i){var s=i.type,h=i.memoizedProps,p=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":h.autoFocus&&p.focus();break e;case"img":h.src?p.src=h.src:h.srcSet&&(p.srcset=h.srcSet)}}catch(E){ht(i,i.return,E)}}function Gf(i,s,h){try{var p=i.stateNode;dk(p,i.type,h,s),p[Zt]=s}catch(E){ht(i,i.return,E)}}function Y_(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&cr(i.type)||i.tag===4}function qf(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Y_(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&cr(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Vf(i,s,h){var p=i.tag;if(p===5||p===6)i=i.stateNode,s?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(i,s):(s=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,s.appendChild(i),h=h._reactRootContainer,h!=null||s.onclick!==null||(s.onclick=gi));else if(p!==4&&(p===27&&cr(i.type)&&(h=i.stateNode,s=null),i=i.child,i!==null))for(Vf(i,s,h),i=i.sibling;i!==null;)Vf(i,s,h),i=i.sibling}function ic(i,s,h){var p=i.tag;if(p===5||p===6)i=i.stateNode,s?h.insertBefore(i,s):h.appendChild(i);else if(p!==4&&(p===27&&cr(i.type)&&(h=i.stateNode),i=i.child,i!==null))for(ic(i,s,h),i=i.sibling;i!==null;)ic(i,s,h),i=i.sibling}function W_(i){var s=i.stateNode,h=i.memoizedProps;try{for(var p=i.type,E=s.attributes;E.length;)s.removeAttributeNode(E[0]);Kt(s,p,h),s[$t]=i,s[Zt]=h}catch(A){ht(i,i.return,A)}}var Ei=!1,Ht=!1,Yf=!1,X_=typeof WeakSet=="function"?WeakSet:Set,qt=null;function V2(i,s){if(i=i.containerInfo,pd=Cc,i=o0(i),Hh(i)){if("selectionStart"in i)var h={start:i.selectionStart,end:i.selectionEnd};else e:{h=(h=i.ownerDocument)&&h.defaultView||window;var p=h.getSelection&&h.getSelection();if(p&&p.rangeCount!==0){h=p.anchorNode;var E=p.anchorOffset,A=p.focusNode;p=p.focusOffset;try{h.nodeType,A.nodeType}catch{h=null;break e}var B=0,Y=-1,J=-1,oe=0,ge=0,ve=i,ce=null;t:for(;;){for(var fe;ve!==h||E!==0&&ve.nodeType!==3||(Y=B+E),ve!==A||p!==0&&ve.nodeType!==3||(J=B+p),ve.nodeType===3&&(B+=ve.nodeValue.length),(fe=ve.firstChild)!==null;)ce=ve,ve=fe;for(;;){if(ve===i)break t;if(ce===h&&++oe===E&&(Y=B),ce===A&&++ge===p&&(J=B),(fe=ve.nextSibling)!==null)break;ve=ce,ce=ve.parentNode}ve=fe}h=Y===-1||J===-1?null:{start:Y,end:J}}else h=null}h=h||{start:0,end:0}}else h=null;for(gd={focusedElem:i,selectionRange:h},Cc=!1,qt=s;qt!==null;)if(s=qt,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,qt=i;else for(;qt!==null;){switch(s=qt,A=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(h=0;h title"))),Kt(A,p,h),A[$t]=i,jt(A),p=A;break e;case"link":var B=ty("link","href",E).get(p+(h.href||""));if(B){for(var Y=0;Ypt&&(B=pt,pt=Me,Me=B);var re=s0(Y,Me),ne=s0(Y,pt);if(re&&ne&&(fe.rangeCount!==1||fe.anchorNode!==re.node||fe.anchorOffset!==re.offset||fe.focusNode!==ne.node||fe.focusOffset!==ne.offset)){var ae=ve.createRange();ae.setStart(re.node,re.offset),fe.removeAllRanges(),Me>pt?(fe.addRange(ae),fe.extend(ne.node,ne.offset)):(ae.setEnd(ne.node,ne.offset),fe.addRange(ae))}}}}for(ve=[],fe=Y;fe=fe.parentNode;)fe.nodeType===1&&ve.push({element:fe,left:fe.scrollLeft,top:fe.scrollTop});for(typeof Y.focus=="function"&&Y.focus(),Y=0;Yh?32:h,G.T=null,h=ed,ed=null;var A=ar,B=Di;if(Gt=0,Bs=ar=null,Di=0,(st&6)!==0)throw Error(r(331));var Y=st;if(st|=4,av(A.current),iv(A,A.current,B,h),st=Y,io(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Tt,A)}catch{}return!0}finally{X.p=E,G.T=p,Cv(i,s)}}function kv(i,s,h){s=Ln(h,s),s=Lf(i.stateNode,s,2),i=Ji(i,s,2),i!==null&&(Cr(i,2),ni(i))}function ht(i,s,h){if(i.tag===3)kv(i,i,h);else for(;s!==null;){if(s.tag===3){kv(s,i,h);break}else if(s.tag===1){var p=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(sr===null||!sr.has(p))){i=Ln(h,i),h=A_(2),p=Ji(s,h,2),p!==null&&(T_(h,p,s,i),Cr(p,2),ni(p));break}}s=s.return}}function rd(i,s,h){var p=i.pingCache;if(p===null){p=i.pingCache=new X2;var E=new Set;p.set(s,E)}else E=p.get(s),E===void 0&&(E=new Set,p.set(s,E));E.has(h)||(Kf=!0,E.add(h),i=ek.bind(null,i,s,h),s.then(i,i))}function ek(i,s,h){var p=i.pingCache;p!==null&&p.delete(s),i.pingedLanes|=i.suspendedLanes&h,i.warmLanes&=~h,mt===i&&(Ye&h)===h&&(Dt===4||Dt===3&&(Ye&62914560)===Ye&&300>tt()-ac?(st&2)===0&&Is(i,0):Zf|=h,js===Ye&&(js=0)),ni(i)}function Av(i,s){s===0&&(s=cl()),i=Dr(i,s),i!==null&&(Cr(i,s),ni(i))}function tk(i){var s=i.memoizedState,h=0;s!==null&&(h=s.retryLane),Av(i,h)}function nk(i,s){var h=0;switch(i.tag){case 31:case 13:var p=i.stateNode,E=i.memoizedState;E!==null&&(h=E.retryLane);break;case 19:p=i.stateNode;break;case 22:p=i.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(s),Av(i,h)}function ik(i,s){return Pe(i,s)}var dc=null,Hs=null,sd=!1,pc=!1,ad=!1,lr=0;function ni(i){i!==Hs&&i.next===null&&(Hs===null?dc=Hs=i:Hs=Hs.next=i),pc=!0,sd||(sd=!0,sk())}function io(i,s){if(!ad&&pc){ad=!0;do for(var h=!1,p=dc;p!==null;){if(i!==0){var E=p.pendingLanes;if(E===0)var A=0;else{var B=p.suspendedLanes,Y=p.pingedLanes;A=(1<<31-nt(42|i)+1)-1,A&=E&~(B&~Y),A=A&201326741?A&201326741|1:A?A|2:0}A!==0&&(h=!0,Rv(p,A))}else A=Ye,A=Hi(p,p===mt?A:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(A&3)===0||wr(p,A)||(h=!0,Rv(p,A));p=p.next}while(h);ad=!1}}function rk(){Tv()}function Tv(){pc=sd=!1;var i=0;lr!==0&&gk()&&(i=lr);for(var s=tt(),h=null,p=dc;p!==null;){var E=p.next,A=Nv(p,s);A===0?(p.next=null,h===null?dc=E:h.next=E,E===null&&(Hs=h)):(h=p,(i!==0||(A&3)!==0)&&(pc=!0)),p=E}Gt!==0&&Gt!==5||io(i),lr!==0&&(lr=0)}function Nv(i,s){for(var h=i.suspendedLanes,p=i.pingedLanes,E=i.expirationTimes,A=i.pendingLanes&-62914561;0Y)break;var ge=J.transferSize,ve=J.initiatorType;ge&&Hv(ve)&&(J=J.responseEnd,B+=ge*(J"u"?null:document;function Zv(i,s,h){var p=Fs;if(p&&typeof s=="string"&&s){var E=an(s);E='link[rel="'+i+'"][href="'+E+'"]',typeof h=="string"&&(E+='[crossorigin="'+h+'"]'),Kv.has(E)||(Kv.add(E),i={rel:i,crossOrigin:h,href:s},p.querySelector(E)===null&&(s=p.createElement("link"),Kt(s,"link",i),jt(s),p.head.appendChild(s)))}}function Ck(i){Ri.D(i),Zv("dns-prefetch",i,null)}function Ek(i,s){Ri.C(i,s),Zv("preconnect",i,s)}function kk(i,s,h){Ri.L(i,s,h);var p=Fs;if(p&&i&&s){var E='link[rel="preload"][as="'+an(s)+'"]';s==="image"&&h&&h.imageSrcSet?(E+='[imagesrcset="'+an(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(E+='[imagesizes="'+an(h.imageSizes)+'"]')):E+='[href="'+an(i)+'"]';var A=E;switch(s){case"style":A=Ps(i);break;case"script":A=Us(i)}Hn.has(A)||(i=d({rel:"preload",href:s==="image"&&h&&h.imageSrcSet?void 0:i,as:s},h),Hn.set(A,i),p.querySelector(E)!==null||s==="style"&&p.querySelector(oo(A))||s==="script"&&p.querySelector(lo(A))||(s=p.createElement("link"),Kt(s,"link",i),jt(s),p.head.appendChild(s)))}}function Ak(i,s){Ri.m(i,s);var h=Fs;if(h&&i){var p=s&&typeof s.as=="string"?s.as:"script",E='link[rel="modulepreload"][as="'+an(p)+'"][href="'+an(i)+'"]',A=E;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":A=Us(i)}if(!Hn.has(A)&&(i=d({rel:"modulepreload",href:i},s),Hn.set(A,i),h.querySelector(E)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(lo(A)))return}p=h.createElement("link"),Kt(p,"link",i),jt(p),h.head.appendChild(p)}}}function Tk(i,s,h){Ri.S(i,s,h);var p=Fs;if(p&&i){var E=$i(p).hoistableStyles,A=Ps(i);s=s||"default";var B=E.get(A);if(!B){var Y={loading:0,preload:null};if(B=p.querySelector(oo(A)))Y.loading=5;else{i=d({rel:"stylesheet",href:i,"data-precedence":s},h),(h=Hn.get(A))&&xd(i,h);var J=B=p.createElement("link");jt(J),Kt(J,"link",i),J._p=new Promise(function(oe,ge){J.onload=oe,J.onerror=ge}),J.addEventListener("load",function(){Y.loading|=1}),J.addEventListener("error",function(){Y.loading|=2}),Y.loading|=4,yc(B,s,p)}B={type:"stylesheet",instance:B,count:1,state:Y},E.set(A,B)}}}function Nk(i,s){Ri.X(i,s);var h=Fs;if(h&&i){var p=$i(h).hoistableScripts,E=Us(i),A=p.get(E);A||(A=h.querySelector(lo(E)),A||(i=d({src:i,async:!0},s),(s=Hn.get(E))&&wd(i,s),A=h.createElement("script"),jt(A),Kt(A,"link",i),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},p.set(E,A))}}function Dk(i,s){Ri.M(i,s);var h=Fs;if(h&&i){var p=$i(h).hoistableScripts,E=Us(i),A=p.get(E);A||(A=h.querySelector(lo(E)),A||(i=d({src:i,async:!0,type:"module"},s),(s=Hn.get(E))&&wd(i,s),A=h.createElement("script"),jt(A),Kt(A,"link",i),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},p.set(E,A))}}function Qv(i,s,h,p){var E=(E=se.current)?vc(E):null;if(!E)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(s=Ps(h.href),h=$i(E).hoistableStyles,p=h.get(s),p||(p={type:"style",instance:null,count:0,state:null},h.set(s,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){i=Ps(h.href);var A=$i(E).hoistableStyles,B=A.get(i);if(B||(E=E.ownerDocument||E,B={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},A.set(i,B),(A=E.querySelector(oo(i)))&&!A._p&&(B.instance=A,B.state.loading=5),Hn.has(i)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},Hn.set(i,h),A||Rk(E,i,h,B.state))),s&&p===null)throw Error(r(528,""));return B}if(s&&p!==null)throw Error(r(529,""));return null;case"script":return s=h.async,h=h.src,typeof h=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Us(h),h=$i(E).hoistableScripts,p=h.get(s),p||(p={type:"script",instance:null,count:0,state:null},h.set(s,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Ps(i){return'href="'+an(i)+'"'}function oo(i){return'link[rel="stylesheet"]['+i+"]"}function Jv(i){return d({},i,{"data-precedence":i.precedence,precedence:null})}function Rk(i,s,h,p){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?p.loading=1:(s=i.createElement("link"),p.preload=s,s.addEventListener("load",function(){return p.loading|=1}),s.addEventListener("error",function(){return p.loading|=2}),Kt(s,"link",h),jt(s),i.head.appendChild(s))}function Us(i){return'[src="'+an(i)+'"]'}function lo(i){return"script[async]"+i}function ey(i,s,h){if(s.count++,s.instance===null)switch(s.type){case"style":var p=i.querySelector('style[data-href~="'+an(h.href)+'"]');if(p)return s.instance=p,jt(p),p;var E=d({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return p=(i.ownerDocument||i).createElement("style"),jt(p),Kt(p,"style",E),yc(p,h.precedence,i),s.instance=p;case"stylesheet":E=Ps(h.href);var A=i.querySelector(oo(E));if(A)return s.state.loading|=4,s.instance=A,jt(A),A;p=Jv(h),(E=Hn.get(E))&&xd(p,E),A=(i.ownerDocument||i).createElement("link"),jt(A);var B=A;return B._p=new Promise(function(Y,J){B.onload=Y,B.onerror=J}),Kt(A,"link",p),s.state.loading|=4,yc(A,h.precedence,i),s.instance=A;case"script":return A=Us(h.src),(E=i.querySelector(lo(A)))?(s.instance=E,jt(E),E):(p=h,(E=Hn.get(A))&&(p=d({},h),wd(p,E)),i=i.ownerDocument||i,E=i.createElement("script"),jt(E),Kt(E,"link",p),i.head.appendChild(E),s.instance=E);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(p=s.instance,s.state.loading|=4,yc(p,h.precedence,i));return s.instance}function yc(i,s,h){for(var p=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),E=p.length?p[p.length-1]:null,A=E,B=0;B title"):null)}function Mk(i,s,h){if(h===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return i=s.disabled,typeof s.precedence=="string"&&i==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function iy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function Lk(i,s,h,p){if(h.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var E=Ps(p.href),A=s.querySelector(oo(E));if(A){s=A._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Sc.bind(i),s.then(i,i)),h.state.loading|=4,h.instance=A,jt(A);return}A=s.ownerDocument||s,p=Jv(p),(E=Hn.get(E))&&xd(p,E),A=A.createElement("link"),jt(A);var B=A;B._p=new Promise(function(Y,J){B.onload=Y,B.onerror=J}),Kt(A,"link",p),h.instance=A}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(h,s),(s=h.state.preload)&&(h.state.loading&3)===0&&(i.count++,h=Sc.bind(i),s.addEventListener("load",h),s.addEventListener("error",h))}}var Cd=0;function Ok(i,s){return i.stylesheets&&i.count===0&&wc(i,i.stylesheets),0Cd?50:800)+s);return i.unsuspend=h,function(){i.unsuspend=null,clearTimeout(p),clearTimeout(E)}}:null}function Sc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)wc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var xc=null;function wc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,xc=new Map,s.forEach(jk,i),xc=null,Sc.call(i))}function jk(i,s){if(!(s.state.loading&4)){var h=xc.get(i);if(h)var p=h.get(null);else{h=new Map,xc.set(i,h);for(var E=i.querySelectorAll("link[data-precedence],style[data-precedence]"),A=0;A"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ld.exports=Zk(),Ld.exports}var Jk=Qk();/** +`+p.stack}}var Ve=Object.prototype.hasOwnProperty,Pe=e.unstable_scheduleCallback,lt=e.unstable_cancelCallback,Rt=e.unstable_shouldYield,gt=e.unstable_requestPaint,nt=e.unstable_now,ct=e.unstable_getCurrentPriorityLevel,de=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,Ee=e.unstable_NormalPriority,Le=e.unstable_LowPriority,je=e.unstable_IdlePriority,Ct=e.log,Ue=e.unstable_setDisableYieldValue,Tt=null,Et=null;function $t(i){if(typeof Ct=="function"&&Ue(i),Et&&typeof Et.setStrictMode=="function")try{Et.setStrictMode(Tt,i)}catch{}}var it=Math.clz32?Math.clz32:Oe,he=Math.log,Ce=Math.LN2;function Oe(i){return i>>>=0,i===0?32:31-(he(i)/Ce|0)|0}var Xe=256,Je=262144,nn=4194304;function jt(i){var s=i&42;if(s!==0)return s;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Hi(i,s,h){var p=i.pendingLanes;if(p===0)return 0;var E=0,A=i.suspendedLanes,B=i.pingedLanes;i=i.warmLanes;var W=p&134217727;return W!==0?(p=W&~A,p!==0?E=jt(p):(B&=W,B!==0?E=jt(B):h||(h=W&~i,h!==0&&(E=jt(h))))):(W=p&~A,W!==0?E=jt(W):B!==0?E=jt(B):h||(h=p&~i,h!==0&&(E=jt(h)))),E===0?0:s!==0&&s!==E&&(s&A)===0&&(A=E&-E,h=s&-s,A>=h||A===32&&(h&4194048)!==0)?s:E}function wr(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function wh(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 hl(){var i=nn;return nn<<=1,(nn&62914560)===0&&(nn=4194304),i}function _a(i){for(var s=[],h=0;31>h;h++)s.push(i);return s}function Cr(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Ch(i,s,h,p,E,A){var B=i.pendingLanes;i.pendingLanes=h,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=h,i.entangledLanes&=h,i.errorRecoveryDisabledLanes&=h,i.shellSuspendCounter=0;var W=i.entanglements,J=i.expirationTimes,oe=i.hiddenUpdates;for(h=B&~h;0"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var wl=/[\n"\\]/g;function on(i){return i.replace(wl,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function wa(i,s,h,p,E,A,B,W){i.name="",B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?i.type=B:i.removeAttribute("type"),s!=null?B==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+an(s)):i.value!==""+an(s)&&(i.value=""+an(s)):B!=="submit"&&B!=="reset"||i.removeAttribute("value"),s!=null?Ca(i,B,an(s)):h!=null?Ca(i,B,an(h)):p!=null&&i.removeAttribute("value"),E==null&&A!=null&&(i.defaultChecked=!!A),E!=null&&(i.checked=E&&typeof E!="function"&&typeof E!="symbol"),W!=null&&typeof W!="function"&&typeof W!="symbol"&&typeof W!="boolean"?i.name=""+an(W):i.removeAttribute("name")}function hs(i,s,h,p,E,A,B,W){if(A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(i.type=A),s!=null||h!=null){if(!(A!=="submit"&&A!=="reset"||s!=null)){xa(i);return}h=h!=null?""+an(h):"",s=s!=null?""+an(s):h,W||s===i.value||(i.value=s),i.defaultValue=s}p=p??E,p=typeof p!="function"&&typeof p!="symbol"&&!!p,i.checked=W?i.checked:!!p,i.defaultChecked=!!p,B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"&&(i.name=B),xa(i)}function Ca(i,s,h){s==="number"&&us(i.ownerDocument)===i||i.defaultValue===""+h||(i.defaultValue=""+h)}function qi(i,s,h,p){if(i=i.options,s){s={};for(var E=0;E"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Lh=!1;if(mi)try{var Aa={};Object.defineProperty(Aa,"passive",{get:function(){Lh=!0}}),window.addEventListener("test",Aa,Aa),window.removeEventListener("test",Aa,Aa)}catch{Lh=!1}var Vi=null,Oh=null,El=null;function Vm(){if(El)return El;var i,s=Oh,h=s.length,p,E="value"in Vi?Vi.value:Vi.textContent,A=E.length;for(i=0;i=Da),Qm=" ",Jm=!1;function e0(i,s){switch(i){case"keyup":return m2.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function t0(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var gs=!1;function v2(i,s){switch(i){case"compositionend":return t0(s);case"keypress":return s.which!==32?null:(Jm=!0,Qm);case"textInput":return i=s.data,i===Qm&&Jm?null:i;default:return null}}function y2(i,s){if(gs)return i==="compositionend"||!Hh&&e0(i,s)?(i=Vm(),El=Oh=Vi=null,gs=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:h,offset:s-i};i=p}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=c0(h)}}function h0(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?h0(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function f0(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=us(i.document);s instanceof i.HTMLIFrameElement;){try{var h=typeof s.contentWindow.location.href=="string"}catch{h=!1}if(h)i=s.contentWindow;else break;s=us(i.document)}return s}function Uh(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var A2=mi&&"documentMode"in document&&11>=document.documentMode,ms=null,$h=null,Oa=null,Gh=!1;function d0(i,s,h){var p=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Gh||ms==null||ms!==us(p)||(p=ms,"selectionStart"in p&&Uh(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Oa&&La(Oa,p)||(Oa=p,p=vc($h,"onSelect"),0>=B,E-=B,ti=1<<32-it(s)+E|h<Fe?(We=Ae,Ae=null):We=Ae.sibling;var st=ce(re,Ae,ae[Fe],_e);if(st===null){Ae===null&&(Ae=We);break}i&&Ae&&st.alternate===null&&s(re,Ae),ne=A(st,ne,Fe),rt===null?De=st:rt.sibling=st,rt=st,Ae=We}if(Fe===ae.length)return h(re,Ae),Ke&&vi(re,Fe),De;if(Ae===null){for(;FeFe?(We=Ae,Ae=null):We=Ae.sibling;var pr=ce(re,Ae,st.value,_e);if(pr===null){Ae===null&&(Ae=We);break}i&&Ae&&pr.alternate===null&&s(re,Ae),ne=A(pr,ne,Fe),rt===null?De=pr:rt.sibling=pr,rt=pr,Ae=We}if(st.done)return h(re,Ae),Ke&&vi(re,Fe),De;if(Ae===null){for(;!st.done;Fe++,st=ae.next())st=ve(re,st.value,_e),st!==null&&(ne=A(st,ne,Fe),rt===null?De=st:rt.sibling=st,rt=st);return Ke&&vi(re,Fe),De}for(Ae=p(Ae);!st.done;Fe++,st=ae.next())st=fe(Ae,re,Fe,st.value,_e),st!==null&&(i&&st.alternate!==null&&Ae.delete(st.key===null?Fe:st.key),ne=A(st,ne,Fe),rt===null?De=st:rt.sibling=st,rt=st);return i&&Ae.forEach(function(Yk){return s(re,Yk)}),Ke&&vi(re,Fe),De}function pt(re,ne,ae,_e){if(typeof ae=="object"&&ae!==null&&ae.type===C&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case _:e:{for(var De=ae.key;ne!==null;){if(ne.key===De){if(De=ae.type,De===C){if(ne.tag===7){h(re,ne.sibling),_e=E(ne,ae.props.children),_e.return=re,re=_e;break e}}else if(ne.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===N&&Br(De)===ne.type){h(re,ne.sibling),_e=E(ne,ae.props),Fa(_e,ae),_e.return=re,re=_e;break e}h(re,ne);break}else s(re,ne);ne=ne.sibling}ae.type===C?(_e=Rr(ae.props.children,re.mode,_e,ae.key),_e.return=re,re=_e):(_e=jl(ae.type,ae.key,ae.props,null,re.mode,_e),Fa(_e,ae),_e.return=re,re=_e)}return B(re);case w:e:{for(De=ae.key;ne!==null;){if(ne.key===De)if(ne.tag===4&&ne.stateNode.containerInfo===ae.containerInfo&&ne.stateNode.implementation===ae.implementation){h(re,ne.sibling),_e=E(ne,ae.children||[]),_e.return=re,re=_e;break e}else{h(re,ne);break}else s(re,ne);ne=ne.sibling}_e=Zh(ae,re.mode,_e),_e.return=re,re=_e}return B(re);case N:return ae=Br(ae),pt(re,ne,ae,_e)}if(q(ae))return ke(re,ne,ae,_e);if(V(ae)){if(De=V(ae),typeof De!="function")throw Error(r(150));return ae=De.call(ae),Me(re,ne,ae,_e)}if(typeof ae.then=="function")return pt(re,ne,Ul(ae),_e);if(ae.$$typeof===y)return pt(re,ne,zl(re,ae),_e);$l(re,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,ne!==null&&ne.tag===6?(h(re,ne.sibling),_e=E(ne,ae),_e.return=re,re=_e):(h(re,ne),_e=Kh(ae,re.mode,_e),_e.return=re,re=_e),B(re)):h(re,ne)}return function(re,ne,ae,_e){try{Ha=0;var De=pt(re,ne,ae,_e);return As=null,De}catch(Ae){if(Ae===ks||Ae===Fl)throw Ae;var rt=bn(29,Ae,null,re.mode);return rt.lanes=_e,rt.return=re,rt}finally{}}}var zr=B0(!0),I0=B0(!1),Zi=!1;function uf(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hf(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Qi(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Ji(i,s,h){var p=i.updateQueue;if(p===null)return null;if(p=p.shared,(at&2)!==0){var E=p.pending;return E===null?s.next=s:(s.next=E.next,E.next=s),p.pending=s,s=Ol(i),b0(i,null,h),s}return Ll(i,p,s,h),Ol(i)}function Pa(i,s,h){if(s=s.updateQueue,s!==null&&(s=s.shared,(h&4194048)!==0)){var p=s.lanes;p&=i.pendingLanes,h|=p,s.lanes=h,dl(i,h)}}function ff(i,s){var h=i.updateQueue,p=i.alternate;if(p!==null&&(p=p.updateQueue,h===p)){var E=null,A=null;if(h=h.firstBaseUpdate,h!==null){do{var B={lane:h.lane,tag:h.tag,payload:h.payload,callback:null,next:null};A===null?E=A=B:A=A.next=B,h=h.next}while(h!==null);A===null?E=A=s:A=A.next=s}else E=A=s;h={baseState:p.baseState,firstBaseUpdate:E,lastBaseUpdate:A,shared:p.shared,callbacks:p.callbacks},i.updateQueue=h;return}i=h.lastBaseUpdate,i===null?h.firstBaseUpdate=s:i.next=s,h.lastBaseUpdate=s}var df=!1;function Ua(){if(df){var i=Es;if(i!==null)throw i}}function $a(i,s,h,p){df=!1;var E=i.updateQueue;Zi=!1;var A=E.firstBaseUpdate,B=E.lastBaseUpdate,W=E.shared.pending;if(W!==null){E.shared.pending=null;var J=W,oe=J.next;J.next=null,B===null?A=oe:B.next=oe,B=J;var ge=i.alternate;ge!==null&&(ge=ge.updateQueue,W=ge.lastBaseUpdate,W!==B&&(W===null?ge.firstBaseUpdate=oe:W.next=oe,ge.lastBaseUpdate=J))}if(A!==null){var ve=E.baseState;B=0,ge=oe=J=null,W=A;do{var ce=W.lane&-536870913,fe=ce!==W.lane;if(fe?(Ye&ce)===ce:(p&ce)===ce){ce!==0&&ce===Cs&&(df=!0),ge!==null&&(ge=ge.next={lane:0,tag:W.tag,payload:W.payload,callback:null,next:null});e:{var ke=i,Me=W;ce=s;var pt=h;switch(Me.tag){case 1:if(ke=Me.payload,typeof ke=="function"){ve=ke.call(pt,ve,ce);break e}ve=ke;break e;case 3:ke.flags=ke.flags&-65537|128;case 0:if(ke=Me.payload,ce=typeof ke=="function"?ke.call(pt,ve,ce):ke,ce==null)break e;ve=d({},ve,ce);break e;case 2:Zi=!0}}ce=W.callback,ce!==null&&(i.flags|=64,fe&&(i.flags|=8192),fe=E.callbacks,fe===null?E.callbacks=[ce]:fe.push(ce))}else fe={lane:ce,tag:W.tag,payload:W.payload,callback:W.callback,next:null},ge===null?(oe=ge=fe,J=ve):ge=ge.next=fe,B|=ce;if(W=W.next,W===null){if(W=E.shared.pending,W===null)break;fe=W,W=fe.next,fe.next=null,E.lastBaseUpdate=fe,E.shared.pending=null}}while(!0);ge===null&&(J=ve),E.baseState=J,E.firstBaseUpdate=oe,E.lastBaseUpdate=ge,A===null&&(E.shared.lanes=0),rr|=B,i.lanes=B,i.memoizedState=ve}}function z0(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function H0(i,s){var h=i.callbacks;if(h!==null)for(i.callbacks=null,i=0;iA?A:8;var B=G.T,W={};G.T=W,Mf(i,!1,s,h);try{var J=E(),oe=G.S;if(oe!==null&&oe(W,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var ge=B2(J,p);Va(i,s,ge,En(i))}else Va(i,s,p,En(i))}catch(ve){Va(i,s,{then:function(){},status:"rejected",reason:ve},En())}finally{X.p=A,B!==null&&W.types!==null&&(B.types=W.types),G.T=B}}function U2(){}function Df(i,s,h,p){if(i.tag!==5)throw Error(r(476));var E=__(i).queue;m_(i,E,s,K,h===null?U2:function(){return v_(i),h(p)})}function __(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xi,lastRenderedState:K},next:null};var h={};return s.next={memoizedState:h,baseState:h,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xi,lastRenderedState:h},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function v_(i){var s=__(i);s.next===null&&(s=i.alternate.memoizedState),Va(i,s.next.queue,{},En())}function Rf(){return Xt(co)}function y_(){return Lt().memoizedState}function b_(){return Lt().memoizedState}function $2(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var h=En();i=Qi(h);var p=Ji(s,i,h);p!==null&&(dn(p,s,h),Pa(p,s,h)),s={cache:af()},i.payload=s;return}s=s.return}}function G2(i,s,h){var p=En();h={lane:p,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Jl(i)?x_(s,h):(h=Wh(i,s,h,p),h!==null&&(dn(h,i,p),w_(h,s,p)))}function S_(i,s,h){var p=En();Va(i,s,h,p)}function Va(i,s,h,p){var E={lane:p,revertLane:0,gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null};if(Jl(i))x_(s,E);else{var A=i.alternate;if(i.lanes===0&&(A===null||A.lanes===0)&&(A=s.lastRenderedReducer,A!==null))try{var B=s.lastRenderedState,W=A(B,h);if(E.hasEagerState=!0,E.eagerState=W,yn(W,B))return Ll(i,s,E,0),mt===null&&Ml(),!1}catch{}finally{}if(h=Wh(i,s,E,p),h!==null)return dn(h,i,p),w_(h,s,p),!0}return!1}function Mf(i,s,h,p){if(p={lane:2,revertLane:ud(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Jl(i)){if(s)throw Error(r(479))}else s=Wh(i,h,p,2),s!==null&&dn(s,i,2)}function Jl(i){var s=i.alternate;return i===He||s!==null&&s===He}function x_(i,s){Ns=Vl=!0;var h=i.pending;h===null?s.next=s:(s.next=h.next,h.next=s),i.pending=s}function w_(i,s,h){if((h&4194048)!==0){var p=s.lanes;p&=i.pendingLanes,h|=p,s.lanes=h,dl(i,h)}}var Ya={readContext:Xt,use:Xl,useCallback:Nt,useContext:Nt,useEffect:Nt,useImperativeHandle:Nt,useLayoutEffect:Nt,useInsertionEffect:Nt,useMemo:Nt,useReducer:Nt,useRef:Nt,useState:Nt,useDebugValue:Nt,useDeferredValue:Nt,useTransition:Nt,useSyncExternalStore:Nt,useId:Nt,useHostTransitionStatus:Nt,useFormState:Nt,useActionState:Nt,useOptimistic:Nt,useMemoCache:Nt,useCacheRefresh:Nt};Ya.useEffectEvent=Nt;var C_={readContext:Xt,use:Xl,useCallback:function(i,s){return rn().memoizedState=[i,s===void 0?null:s],i},useContext:Xt,useEffect:o_,useImperativeHandle:function(i,s,h){h=h!=null?h.concat([i]):null,Zl(4194308,4,h_.bind(null,s,i),h)},useLayoutEffect:function(i,s){return Zl(4194308,4,i,s)},useInsertionEffect:function(i,s){Zl(4,2,i,s)},useMemo:function(i,s){var h=rn();s=s===void 0?null:s;var p=i();if(Hr){$t(!0);try{i()}finally{$t(!1)}}return h.memoizedState=[p,s],p},useReducer:function(i,s,h){var p=rn();if(h!==void 0){var E=h(s);if(Hr){$t(!0);try{h(s)}finally{$t(!1)}}}else E=s;return p.memoizedState=p.baseState=E,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:E},p.queue=i,i=i.dispatch=G2.bind(null,He,i),[p.memoizedState,i]},useRef:function(i){var s=rn();return i={current:i},s.memoizedState=i},useState:function(i){i=Ef(i);var s=i.queue,h=S_.bind(null,He,s);return s.dispatch=h,[i.memoizedState,h]},useDebugValue:Tf,useDeferredValue:function(i,s){var h=rn();return Nf(h,i,s)},useTransition:function(){var i=Ef(!1);return i=m_.bind(null,He,i.queue,!0,!1),rn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,h){var p=He,E=rn();if(Ke){if(h===void 0)throw Error(r(407));h=h()}else{if(h=s(),mt===null)throw Error(r(349));(Ye&127)!==0||q0(p,s,h)}E.memoizedState=h;var A={value:h,getSnapshot:s};return E.queue=A,o_(Y0.bind(null,p,A,i),[i]),p.flags|=2048,Rs(9,{destroy:void 0},V0.bind(null,p,A,h,s),null),h},useId:function(){var i=rn(),s=mt.identifierPrefix;if(Ke){var h=ni,p=ti;h=(p&~(1<<32-it(p)-1)).toString(32)+h,s="_"+s+"R_"+h,h=Yl++,0<\/script>",A=A.removeChild(A.firstChild);break;case"select":A=typeof p.is=="string"?B.createElement("select",{is:p.is}):B.createElement("select"),p.multiple?A.multiple=!0:p.size&&(A.size=p.size);break;default:A=typeof p.is=="string"?B.createElement(E,{is:p.is}):B.createElement(E)}}A[Gt]=s,A[Qt]=p;e:for(B=s.child;B!==null;){if(B.tag===5||B.tag===6)A.appendChild(B.stateNode);else if(B.tag!==4&&B.tag!==27&&B.child!==null){B.child.return=B,B=B.child;continue}if(B===s)break e;for(;B.sibling===null;){if(B.return===null||B.return===s)break e;B=B.return}B.sibling.return=B.return,B=B.sibling}s.stateNode=A;e:switch(Zt(A,E,p),E){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&Ci(s)}}return St(s),Vf(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,h),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==p&&Ci(s);else{if(typeof p!="string"&&s.stateNode===null)throw Error(r(166));if(i=se.current,xs(s)){if(i=s.stateNode,h=s.memoizedProps,p=null,E=Wt,E!==null)switch(E.tag){case 27:case 5:p=E.memoizedProps}i[Gt]=s,i=!!(i.nodeValue===h||p!==null&&p.suppressHydrationWarning===!0||$v(i.nodeValue,h)),i||Xi(s,!0)}else i=yc(i).createTextNode(p),i[Gt]=s,s.stateNode=i}return St(s),null;case 31:if(h=s.memoizedState,i===null||i.memoizedState!==null){if(p=xs(s),h!==null){if(i===null){if(!p)throw Error(r(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[Gt]=s}else Mr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;St(s),i=!1}else h=tf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=h),i=!0;if(!i)return s.flags&256?(xn(s),s):(xn(s),null);if((s.flags&128)!==0)throw Error(r(558))}return St(s),null;case 13:if(p=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(E=xs(s),p!==null&&p.dehydrated!==null){if(i===null){if(!E)throw Error(r(318));if(E=s.memoizedState,E=E!==null?E.dehydrated:null,!E)throw Error(r(317));E[Gt]=s}else Mr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;St(s),E=!1}else E=tf(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=E),E=!0;if(!E)return s.flags&256?(xn(s),s):(xn(s),null)}return xn(s),(s.flags&128)!==0?(s.lanes=h,s):(h=p!==null,i=i!==null&&i.memoizedState!==null,h&&(p=s.child,E=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(E=p.alternate.memoizedState.cachePool.pool),A=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(A=p.memoizedState.cachePool.pool),A!==E&&(p.flags|=2048)),h!==i&&h&&(s.child.flags|=8192),rc(s,s.updateQueue),St(s),null);case 4:return ee(),i===null&&pd(s.stateNode.containerInfo),St(s),null;case 10:return bi(s.type),St(s),null;case 19:if($(Mt),p=s.memoizedState,p===null)return St(s),null;if(E=(s.flags&128)!==0,A=p.rendering,A===null)if(E)Xa(p,!1);else{if(Dt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(A=ql(i),A!==null){for(s.flags|=128,Xa(p,!1),i=A.updateQueue,s.updateQueue=i,rc(s,i),s.subtreeFlags=0,i=h,h=s.child;h!==null;)S0(h,i),h=h.sibling;return U(Mt,Mt.current&1|2),Ke&&vi(s,p.treeForkCount),s.child}i=i.sibling}p.tail!==null&&nt()>cc&&(s.flags|=128,E=!0,Xa(p,!1),s.lanes=4194304)}else{if(!E)if(i=ql(A),i!==null){if(s.flags|=128,E=!0,i=i.updateQueue,s.updateQueue=i,rc(s,i),Xa(p,!0),p.tail===null&&p.tailMode==="hidden"&&!A.alternate&&!Ke)return St(s),null}else 2*nt()-p.renderingStartTime>cc&&h!==536870912&&(s.flags|=128,E=!0,Xa(p,!1),s.lanes=4194304);p.isBackwards?(A.sibling=s.child,s.child=A):(i=p.last,i!==null?i.sibling=A:s.child=A,p.last=A)}return p.tail!==null?(i=p.tail,p.rendering=i,p.tail=i.sibling,p.renderingStartTime=nt(),i.sibling=null,h=Mt.current,U(Mt,E?h&1|2:h&1),Ke&&vi(s,p.treeForkCount),i):(St(s),null);case 22:case 23:return xn(s),gf(),p=s.memoizedState!==null,i!==null?i.memoizedState!==null!==p&&(s.flags|=8192):p&&(s.flags|=8192),p?(h&536870912)!==0&&(s.flags&128)===0&&(St(s),s.subtreeFlags&6&&(s.flags|=8192)):St(s),h=s.updateQueue,h!==null&&rc(s,h.retryQueue),h=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),p=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),p!==h&&(s.flags|=2048),i!==null&&$(jr),null;case 24:return h=null,i!==null&&(h=i.memoizedState.cache),s.memoizedState.cache!==h&&(s.flags|=2048),bi(It),St(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function X2(i,s){switch(Jh(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return bi(It),ee(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return pe(s),null;case 31:if(s.memoizedState!==null){if(xn(s),s.alternate===null)throw Error(r(340));Mr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(xn(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Mr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return $(Mt),null;case 4:return ee(),null;case 10:return bi(s.type),null;case 22:case 23:return xn(s),gf(),i!==null&&$(jr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return bi(It),null;case 25:return null;default:return null}}function W_(i,s){switch(Jh(s),s.tag){case 3:bi(It),ee();break;case 26:case 27:case 5:pe(s);break;case 4:ee();break;case 31:s.memoizedState!==null&&xn(s);break;case 13:xn(s);break;case 19:$(Mt);break;case 10:bi(s.type);break;case 22:case 23:xn(s),gf(),i!==null&&$(jr);break;case 24:bi(It)}}function Ka(i,s){try{var h=s.updateQueue,p=h!==null?h.lastEffect:null;if(p!==null){var E=p.next;h=E;do{if((h.tag&i)===i){p=void 0;var A=h.create,B=h.inst;p=A(),B.destroy=p}h=h.next}while(h!==E)}}catch(W){ht(s,s.return,W)}}function nr(i,s,h){try{var p=s.updateQueue,E=p!==null?p.lastEffect:null;if(E!==null){var A=E.next;p=A;do{if((p.tag&i)===i){var B=p.inst,W=B.destroy;if(W!==void 0){B.destroy=void 0,E=s;var J=h,oe=W;try{oe()}catch(ge){ht(E,J,ge)}}}p=p.next}while(p!==A)}}catch(ge){ht(s,s.return,ge)}}function X_(i){var s=i.updateQueue;if(s!==null){var h=i.stateNode;try{H0(s,h)}catch(p){ht(i,i.return,p)}}}function K_(i,s,h){h.props=Fr(i.type,i.memoizedProps),h.state=i.memoizedState;try{h.componentWillUnmount()}catch(p){ht(i,s,p)}}function Za(i,s){try{var h=i.ref;if(h!==null){switch(i.tag){case 26:case 27:case 5:var p=i.stateNode;break;case 30:p=i.stateNode;break;default:p=i.stateNode}typeof h=="function"?i.refCleanup=h(p):h.current=p}}catch(E){ht(i,s,E)}}function ii(i,s){var h=i.ref,p=i.refCleanup;if(h!==null)if(typeof p=="function")try{p()}catch(E){ht(i,s,E)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof h=="function")try{h(null)}catch(E){ht(i,s,E)}else h.current=null}function Z_(i){var s=i.type,h=i.memoizedProps,p=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":h.autoFocus&&p.focus();break e;case"img":h.src?p.src=h.src:h.srcSet&&(p.srcset=h.srcSet)}}catch(E){ht(i,i.return,E)}}function Yf(i,s,h){try{var p=i.stateNode;_k(p,i.type,h,s),p[Qt]=s}catch(E){ht(i,i.return,E)}}function Q_(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&cr(i.type)||i.tag===4}function Wf(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Q_(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&cr(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Xf(i,s,h){var p=i.tag;if(p===5||p===6)i=i.stateNode,s?(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h).insertBefore(i,s):(s=h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,s.appendChild(i),h=h._reactRootContainer,h!=null||s.onclick!==null||(s.onclick=gi));else if(p!==4&&(p===27&&cr(i.type)&&(h=i.stateNode,s=null),i=i.child,i!==null))for(Xf(i,s,h),i=i.sibling;i!==null;)Xf(i,s,h),i=i.sibling}function sc(i,s,h){var p=i.tag;if(p===5||p===6)i=i.stateNode,s?h.insertBefore(i,s):h.appendChild(i);else if(p!==4&&(p===27&&cr(i.type)&&(h=i.stateNode),i=i.child,i!==null))for(sc(i,s,h),i=i.sibling;i!==null;)sc(i,s,h),i=i.sibling}function J_(i){var s=i.stateNode,h=i.memoizedProps;try{for(var p=i.type,E=s.attributes;E.length;)s.removeAttributeNode(E[0]);Zt(s,p,h),s[Gt]=i,s[Qt]=h}catch(A){ht(i,i.return,A)}}var Ei=!1,Ft=!1,Kf=!1,ev=typeof WeakSet=="function"?WeakSet:Set,Vt=null;function K2(i,s){if(i=i.containerInfo,_d=kc,i=f0(i),Uh(i)){if("selectionStart"in i)var h={start:i.selectionStart,end:i.selectionEnd};else e:{h=(h=i.ownerDocument)&&h.defaultView||window;var p=h.getSelection&&h.getSelection();if(p&&p.rangeCount!==0){h=p.anchorNode;var E=p.anchorOffset,A=p.focusNode;p=p.focusOffset;try{h.nodeType,A.nodeType}catch{h=null;break e}var B=0,W=-1,J=-1,oe=0,ge=0,ve=i,ce=null;t:for(;;){for(var fe;ve!==h||E!==0&&ve.nodeType!==3||(W=B+E),ve!==A||p!==0&&ve.nodeType!==3||(J=B+p),ve.nodeType===3&&(B+=ve.nodeValue.length),(fe=ve.firstChild)!==null;)ce=ve,ve=fe;for(;;){if(ve===i)break t;if(ce===h&&++oe===E&&(W=B),ce===A&&++ge===p&&(J=B),(fe=ve.nextSibling)!==null)break;ve=ce,ce=ve.parentNode}ve=fe}h=W===-1||J===-1?null:{start:W,end:J}}else h=null}h=h||{start:0,end:0}}else h=null;for(vd={focusedElem:i,selectionRange:h},kc=!1,Vt=s;Vt!==null;)if(s=Vt,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,Vt=i;else for(;Vt!==null;){switch(s=Vt,A=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(h=0;h title"))),Zt(A,p,h),A[Gt]=i,Bt(A),p=A;break e;case"link":var B=ay("link","href",E).get(p+(h.href||""));if(B){for(var W=0;Wpt&&(B=pt,pt=Me,Me=B);var re=u0(W,Me),ne=u0(W,pt);if(re&&ne&&(fe.rangeCount!==1||fe.anchorNode!==re.node||fe.anchorOffset!==re.offset||fe.focusNode!==ne.node||fe.focusOffset!==ne.offset)){var ae=ve.createRange();ae.setStart(re.node,re.offset),fe.removeAllRanges(),Me>pt?(fe.addRange(ae),fe.extend(ne.node,ne.offset)):(ae.setEnd(ne.node,ne.offset),fe.addRange(ae))}}}}for(ve=[],fe=W;fe=fe.parentNode;)fe.nodeType===1&&ve.push({element:fe,left:fe.scrollLeft,top:fe.scrollTop});for(typeof W.focus=="function"&&W.focus(),W=0;Wh?32:h,G.T=null,h=id,id=null;var A=ar,B=Di;if(qt=0,Bs=ar=null,Di=0,(at&6)!==0)throw Error(r(331));var W=at;if(at|=4,hv(A.current),lv(A,A.current,B,h),at=W,io(0,!1),Et&&typeof Et.onPostCommitFiberRoot=="function")try{Et.onPostCommitFiberRoot(Tt,A)}catch{}return!0}finally{X.p=E,G.T=p,Nv(i,s)}}function Rv(i,s,h){s=jn(h,s),s=Bf(i.stateNode,s,2),i=Ji(i,s,2),i!==null&&(Cr(i,2),ri(i))}function ht(i,s,h){if(i.tag===3)Rv(i,i,h);else for(;s!==null;){if(s.tag===3){Rv(s,i,h);break}else if(s.tag===1){var p=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(sr===null||!sr.has(p))){i=jn(h,i),h=M_(2),p=Ji(s,h,2),p!==null&&(L_(h,p,s,i),Cr(p,2),ri(p));break}}s=s.return}}function od(i,s,h){var p=i.pingCache;if(p===null){p=i.pingCache=new J2;var E=new Set;p.set(s,E)}else E=p.get(s),E===void 0&&(E=new Set,p.set(s,E));E.has(h)||(Jf=!0,E.add(h),i=rk.bind(null,i,s,h),s.then(i,i))}function rk(i,s,h){var p=i.pingCache;p!==null&&p.delete(s),i.pingedLanes|=i.suspendedLanes&h,i.warmLanes&=~h,mt===i&&(Ye&h)===h&&(Dt===4||Dt===3&&(Ye&62914560)===Ye&&300>nt()-lc?(at&2)===0&&Is(i,0):ed|=h,js===Ye&&(js=0)),ri(i)}function Mv(i,s){s===0&&(s=hl()),i=Dr(i,s),i!==null&&(Cr(i,s),ri(i))}function sk(i){var s=i.memoizedState,h=0;s!==null&&(h=s.retryLane),Mv(i,h)}function ak(i,s){var h=0;switch(i.tag){case 31:case 13:var p=i.stateNode,E=i.memoizedState;E!==null&&(h=E.retryLane);break;case 19:p=i.stateNode;break;case 22:p=i.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(s),Mv(i,h)}function ok(i,s){return Pe(i,s)}var gc=null,Hs=null,ld=!1,mc=!1,cd=!1,lr=0;function ri(i){i!==Hs&&i.next===null&&(Hs===null?gc=Hs=i:Hs=Hs.next=i),mc=!0,ld||(ld=!0,ck())}function io(i,s){if(!cd&&mc){cd=!0;do for(var h=!1,p=gc;p!==null;){if(i!==0){var E=p.pendingLanes;if(E===0)var A=0;else{var B=p.suspendedLanes,W=p.pingedLanes;A=(1<<31-it(42|i)+1)-1,A&=E&~(B&~W),A=A&201326741?A&201326741|1:A?A|2:0}A!==0&&(h=!0,Bv(p,A))}else A=Ye,A=Hi(p,p===mt?A:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(A&3)===0||wr(p,A)||(h=!0,Bv(p,A));p=p.next}while(h);cd=!1}}function lk(){Lv()}function Lv(){mc=ld=!1;var i=0;lr!==0&&yk()&&(i=lr);for(var s=nt(),h=null,p=gc;p!==null;){var E=p.next,A=Ov(p,s);A===0?(p.next=null,h===null?gc=E:h.next=E,E===null&&(Hs=h)):(h=p,(i!==0||(A&3)!==0)&&(mc=!0)),p=E}qt!==0&&qt!==5||io(i),lr!==0&&(lr=0)}function Ov(i,s){for(var h=i.suspendedLanes,p=i.pingedLanes,E=i.expirationTimes,A=i.pendingLanes&-62914561;0W)break;var ge=J.transferSize,ve=J.initiatorType;ge&&Gv(ve)&&(J=J.responseEnd,B+=ge*(J"u"?null:document;function ny(i,s,h){var p=Fs;if(p&&typeof s=="string"&&s){var E=on(s);E='link[rel="'+i+'"][href="'+E+'"]',typeof h=="string"&&(E+='[crossorigin="'+h+'"]'),ty.has(E)||(ty.add(E),i={rel:i,crossOrigin:h,href:s},p.querySelector(E)===null&&(s=p.createElement("link"),Zt(s,"link",i),Bt(s),p.head.appendChild(s)))}}function Tk(i){Ri.D(i),ny("dns-prefetch",i,null)}function Nk(i,s){Ri.C(i,s),ny("preconnect",i,s)}function Dk(i,s,h){Ri.L(i,s,h);var p=Fs;if(p&&i&&s){var E='link[rel="preload"][as="'+on(s)+'"]';s==="image"&&h&&h.imageSrcSet?(E+='[imagesrcset="'+on(h.imageSrcSet)+'"]',typeof h.imageSizes=="string"&&(E+='[imagesizes="'+on(h.imageSizes)+'"]')):E+='[href="'+on(i)+'"]';var A=E;switch(s){case"style":A=Ps(i);break;case"script":A=Us(i)}Pn.has(A)||(i=d({rel:"preload",href:s==="image"&&h&&h.imageSrcSet?void 0:i,as:s},h),Pn.set(A,i),p.querySelector(E)!==null||s==="style"&&p.querySelector(oo(A))||s==="script"&&p.querySelector(lo(A))||(s=p.createElement("link"),Zt(s,"link",i),Bt(s),p.head.appendChild(s)))}}function Rk(i,s){Ri.m(i,s);var h=Fs;if(h&&i){var p=s&&typeof s.as=="string"?s.as:"script",E='link[rel="modulepreload"][as="'+on(p)+'"][href="'+on(i)+'"]',A=E;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":A=Us(i)}if(!Pn.has(A)&&(i=d({rel:"modulepreload",href:i},s),Pn.set(A,i),h.querySelector(E)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(h.querySelector(lo(A)))return}p=h.createElement("link"),Zt(p,"link",i),Bt(p),h.head.appendChild(p)}}}function Mk(i,s,h){Ri.S(i,s,h);var p=Fs;if(p&&i){var E=$i(p).hoistableStyles,A=Ps(i);s=s||"default";var B=E.get(A);if(!B){var W={loading:0,preload:null};if(B=p.querySelector(oo(A)))W.loading=5;else{i=d({rel:"stylesheet",href:i,"data-precedence":s},h),(h=Pn.get(A))&&Ed(i,h);var J=B=p.createElement("link");Bt(J),Zt(J,"link",i),J._p=new Promise(function(oe,ge){J.onload=oe,J.onerror=ge}),J.addEventListener("load",function(){W.loading|=1}),J.addEventListener("error",function(){W.loading|=2}),W.loading|=4,Sc(B,s,p)}B={type:"stylesheet",instance:B,count:1,state:W},E.set(A,B)}}}function Lk(i,s){Ri.X(i,s);var h=Fs;if(h&&i){var p=$i(h).hoistableScripts,E=Us(i),A=p.get(E);A||(A=h.querySelector(lo(E)),A||(i=d({src:i,async:!0},s),(s=Pn.get(E))&&kd(i,s),A=h.createElement("script"),Bt(A),Zt(A,"link",i),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},p.set(E,A))}}function Ok(i,s){Ri.M(i,s);var h=Fs;if(h&&i){var p=$i(h).hoistableScripts,E=Us(i),A=p.get(E);A||(A=h.querySelector(lo(E)),A||(i=d({src:i,async:!0,type:"module"},s),(s=Pn.get(E))&&kd(i,s),A=h.createElement("script"),Bt(A),Zt(A,"link",i),h.head.appendChild(A)),A={type:"script",instance:A,count:1,state:null},p.set(E,A))}}function iy(i,s,h,p){var E=(E=se.current)?bc(E):null;if(!E)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof h.precedence=="string"&&typeof h.href=="string"?(s=Ps(h.href),h=$i(E).hoistableStyles,p=h.get(s),p||(p={type:"style",instance:null,count:0,state:null},h.set(s,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(h.rel==="stylesheet"&&typeof h.href=="string"&&typeof h.precedence=="string"){i=Ps(h.href);var A=$i(E).hoistableStyles,B=A.get(i);if(B||(E=E.ownerDocument||E,B={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},A.set(i,B),(A=E.querySelector(oo(i)))&&!A._p&&(B.instance=A,B.state.loading=5),Pn.has(i)||(h={rel:"preload",as:"style",href:h.href,crossOrigin:h.crossOrigin,integrity:h.integrity,media:h.media,hrefLang:h.hrefLang,referrerPolicy:h.referrerPolicy},Pn.set(i,h),A||jk(E,i,h,B.state))),s&&p===null)throw Error(r(528,""));return B}if(s&&p!==null)throw Error(r(529,""));return null;case"script":return s=h.async,h=h.src,typeof h=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Us(h),h=$i(E).hoistableScripts,p=h.get(s),p||(p={type:"script",instance:null,count:0,state:null},h.set(s,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function Ps(i){return'href="'+on(i)+'"'}function oo(i){return'link[rel="stylesheet"]['+i+"]"}function ry(i){return d({},i,{"data-precedence":i.precedence,precedence:null})}function jk(i,s,h,p){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?p.loading=1:(s=i.createElement("link"),p.preload=s,s.addEventListener("load",function(){return p.loading|=1}),s.addEventListener("error",function(){return p.loading|=2}),Zt(s,"link",h),Bt(s),i.head.appendChild(s))}function Us(i){return'[src="'+on(i)+'"]'}function lo(i){return"script[async]"+i}function sy(i,s,h){if(s.count++,s.instance===null)switch(s.type){case"style":var p=i.querySelector('style[data-href~="'+on(h.href)+'"]');if(p)return s.instance=p,Bt(p),p;var E=d({},h,{"data-href":h.href,"data-precedence":h.precedence,href:null,precedence:null});return p=(i.ownerDocument||i).createElement("style"),Bt(p),Zt(p,"style",E),Sc(p,h.precedence,i),s.instance=p;case"stylesheet":E=Ps(h.href);var A=i.querySelector(oo(E));if(A)return s.state.loading|=4,s.instance=A,Bt(A),A;p=ry(h),(E=Pn.get(E))&&Ed(p,E),A=(i.ownerDocument||i).createElement("link"),Bt(A);var B=A;return B._p=new Promise(function(W,J){B.onload=W,B.onerror=J}),Zt(A,"link",p),s.state.loading|=4,Sc(A,h.precedence,i),s.instance=A;case"script":return A=Us(h.src),(E=i.querySelector(lo(A)))?(s.instance=E,Bt(E),E):(p=h,(E=Pn.get(A))&&(p=d({},h),kd(p,E)),i=i.ownerDocument||i,E=i.createElement("script"),Bt(E),Zt(E,"link",p),i.head.appendChild(E),s.instance=E);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(p=s.instance,s.state.loading|=4,Sc(p,h.precedence,i));return s.instance}function Sc(i,s,h){for(var p=h.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),E=p.length?p[p.length-1]:null,A=E,B=0;B title"):null)}function Bk(i,s,h){if(h===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return i=s.disabled,typeof s.precedence=="string"&&i==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function ly(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function Ik(i,s,h,p){if(h.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(h.state.loading&4)===0){if(h.instance===null){var E=Ps(p.href),A=s.querySelector(oo(E));if(A){s=A._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=wc.bind(i),s.then(i,i)),h.state.loading|=4,h.instance=A,Bt(A);return}A=s.ownerDocument||s,p=ry(p),(E=Pn.get(E))&&Ed(p,E),A=A.createElement("link"),Bt(A);var B=A;B._p=new Promise(function(W,J){B.onload=W,B.onerror=J}),Zt(A,"link",p),h.instance=A}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(h,s),(s=h.state.preload)&&(h.state.loading&3)===0&&(i.count++,h=wc.bind(i),s.addEventListener("load",h),s.addEventListener("error",h))}}var Ad=0;function zk(i,s){return i.stylesheets&&i.count===0&&Ec(i,i.stylesheets),0Ad?50:800)+s);return i.unsuspend=h,function(){i.unsuspend=null,clearTimeout(p),clearTimeout(E)}}:null}function wc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ec(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Cc=null;function Ec(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Cc=new Map,s.forEach(Hk,i),Cc=null,wc.call(i))}function Hk(i,s){if(!(s.state.loading&4)){var h=Cc.get(i);if(h)var p=h.get(null);else{h=new Map,Cc.set(i,h);for(var E=i.querySelectorAll("link[data-precedence],style[data-precedence]"),A=0;A"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Bd.exports=tA(),Bd.exports}var iA=nA();/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NS=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** + */const LS=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const eA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** + */const rA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tA=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/** + */const sA=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ay=e=>{const t=tA(e);return t.charAt(0).toUpperCase()+t.slice(1)};/** + */const My=e=>{const t=sA(e);return t.charAt(0).toUpperCase()+t.slice(1)};/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var Id={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var Fd={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nA=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},iA=W.createContext({}),rA=()=>W.useContext(iA),sA=W.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:a="",children:l,iconNode:c,...o},u)=>{const{size:f=24,strokeWidth:g=2,absoluteStrokeWidth:d=!1,color:m="currentColor",className:_=""}=rA()??{},w=r??d?Number(n??g)*24/Number(t??f):n??g;return W.createElement("svg",{ref:u,...Id,width:t??f??Id.width,height:t??f??Id.height,stroke:e??m,strokeWidth:w,className:NS("lucide",_,a),...!l&&!nA(o)&&{"aria-hidden":"true"},...o},[...c.map(([C,y])=>W.createElement(C,y)),...Array.isArray(l)?l:[l]])});/** + */const aA=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},oA=Y.createContext({}),lA=()=>Y.useContext(oA),cA=Y.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:a="",children:l,iconNode:c,...o},u)=>{const{size:f=24,strokeWidth:g=2,absoluteStrokeWidth:d=!1,color:m="currentColor",className:_=""}=lA()??{},w=r??d?Number(n??g)*24/Number(t??f):n??g;return Y.createElement("svg",{ref:u,...Fd,width:t??f??Fd.width,height:t??f??Fd.height,stroke:e??m,strokeWidth:w,className:LS("lucide",_,a),...!l&&!aA(o)&&{"aria-hidden":"true"},...o},[...c.map(([C,b])=>Y.createElement(C,b)),...Array.isArray(l)?l:[l]])});/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Je=(e,t)=>{const n=W.forwardRef(({className:r,...a},l)=>W.createElement(sA,{ref:l,iconNode:t,className:NS(`lucide-${eA(Ay(e))}`,`lucide-${e}`,r),...a}));return n.displayName=Ay(e),n};/** + */const Qe=(e,t)=>{const n=Y.forwardRef(({className:r,...a},l)=>Y.createElement(cA,{ref:l,iconNode:t,className:LS(`lucide-${rA(My(e))}`,`lucide-${e}`,r),...a}));return n.displayName=My(e),n};/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],hg=Je("arrow-left",aA);/** + */const uA=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Eo=Qe("arrow-left",uA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const oA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ty=Je("arrow-right",oA);/** + */const hA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Lc=Qe("arrow-right",hA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lA=[["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"}]],cA=Je("blocks",lA);/** + */const fA=[["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"}]],dA=Qe("blocks",fA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uA=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],hA=Je("boxes",uA);/** + */const pA=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],gA=Qe("boxes",pA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],si=Je("check",fA);/** + */const mA=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],_n=Qe("check",mA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dA=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ou=Je("chevron-down",dA);/** + */const _A=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Iu=Qe("chevron-down",_A);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],fg=Je("chevron-right",pA);/** + */const vA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],_g=Qe("chevron-right",vA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],mA=Je("circle-stop",gA);/** + */const yA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],bA=Qe("circle-stop",yA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _A=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],vA=Je("cloud",_A);/** + */const SA=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],xA=Qe("cloud",SA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yA=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],bA=Je("code",yA);/** + */const wA=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],CA=Qe("code",wA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const SA=[["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"}]],dg=Je("copy",SA);/** + */const EA=[["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"}]],vg=Qe("copy",EA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xA=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],wA=Je("corner-down-left",xA);/** + */const kA=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],AA=Qe("corner-down-left",kA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const CA=[["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"}]],EA=Je("cpu",CA);/** + */const TA=[["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"}]],NA=Qe("cpu",TA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kA=[["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"}]],AA=Je("ellipsis",kA);/** + */const DA=[["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"}]],RA=Qe("ellipsis",DA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const TA=[["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"}]],DS=Je("external-link",TA);/** + */const MA=[["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"}]],OS=Qe("external-link",MA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NA=[["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"}]],RS=Je("file-code",NA);/** + */const LA=[["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"}]],jS=Qe("file-code",LA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const DA=[["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"}]],RA=Je("file-text",DA);/** + */const OA=[["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"}]],jA=Qe("file-text",OA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const MA=[["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"}]],LA=Je("flask-conical",MA);/** + */const BA=[["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"}]],IA=Qe("flask-conical",BA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const OA=[["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"}]],jA=Je("folder-open",OA);/** + */const zA=[["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"}]],HA=Qe("folder-open",zA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const BA=[["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"}]],ju=Je("git-branch",BA);/** + */const FA=[["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"}]],zu=Qe("git-branch",FA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const IA=[["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"}]],zA=Je("laptop",IA);/** + */const PA=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],UA=Qe("hard-drive",PA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const HA=[["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"}]],FA=Je("lock",HA);/** + */const $A=[["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"}]],GA=Qe("laptop",$A);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const PA=[["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"}]],UA=Je("maximize-2",PA);/** + */const qA=[["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"}]],VA=Qe("lock",qA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $A=[["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"}]],GA=Je("minimize-2",$A);/** + */const YA=[["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"}]],WA=Qe("maximize-2",YA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],MS=Je("panel-left",qA);/** + */const XA=[["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"}]],KA=Qe("minimize-2",XA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const VA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],pg=Je("plus",VA);/** + */const ZA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],BS=Qe("panel-left",ZA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const YA=[["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"}]],du=Je("refresh-cw",YA);/** + */const QA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],yg=Qe("plus",QA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const WA=[["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"}]],LS=Je("rotate-cw",WA);/** + */const JA=[["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"}]],mu=Qe("refresh-cw",JA);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const XA=[["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"}]],bp=Je("server",XA);/** + */const eT=[["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"}]],IS=Qe("rotate-cw",eT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const KA=[["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"}]],ZA=Je("sliders-horizontal",KA);/** + */const tT=[["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"}]],Cp=Qe("server",tT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const QA=[["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"}]],JA=Je("square-terminal",QA);/** + */const nT=[["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"}]],iT=Qe("sliders-horizontal",nT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const eT=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],OS=Je("terminal",eT);/** + */const rT=[["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"}]],sT=Qe("square-terminal",rT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tT=[["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"}]],Bu=Je("trash-2",tT);/** + */const aT=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],zS=Qe("terminal",aT);/** * @license lucide-react v1.24.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nT=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ro=Je("x",nT);async function is(e){if(!e.ok){const t=await e.text().catch(()=>"");let n=t;try{const r=JSON.parse(t);r.error&&(n=r.error)}catch{}throw new Error(n||`HTTP ${e.status}`)}return await e.json()}const kt=e=>fetch(e).then(t=>is(t)),en=(e,t)=>fetch(e,{method:"POST",headers:t===void 0?{}:{"content-type":"application/json"},body:t===void 0?void 0:JSON.stringify(t)}).then(n=>is(n)),jS=(e,t)=>fetch(e,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}).then(n=>is(n)),iT=()=>kt("/api/projects").then(e=>e.projects),rT=e=>en("/api/projects",e).then(t=>t.project),sT=e=>kt(`/api/papers/search?q=${encodeURIComponent(e)}`).then(t=>t.papers),aT=e=>kt(`/api/papers/resolve?id=${encodeURIComponent(e)}`).then(t=>t.paper),oT=e=>en(`/api/projects/${e}/open`).then(t=>t.project),lT=e=>fetch(`/api/projects/${e}`,{method:"DELETE"}).then(async t=>{if(!t.ok){const n=await t.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`delete failed (${t.status})`)}}),cT=e=>kt(`/api/projects/${e}/experiments`).then(t=>t.experiments),uT=e=>kt(`/api/projects/${e}/runs`).then(t=>t.runs),hT=()=>kt("/api/instances").then(e=>e.instances),BS=e=>en(`/api/runs/${e}/cancel`),fT=(e,t)=>kt(`/api/runs/${e}/log?offset=${t}`),dT=e=>kt(`/api/experiments/${e}/commits`).then(t=>t.commits),pT=(e,t)=>kt(`/api/experiments/${e}/commits/${t}/diff`),Ny=e=>kt(`/api/projects/${e}/working-tree`),gT=(e,t,n)=>kt(`/api/projects/${e}/file?path=${encodeURIComponent(t)}`+(n?`&sessionId=${encodeURIComponent(n)}`:"")),mT=()=>kt("/api/settings/hf"),_T=e=>en("/api/settings/hf",{token:e}),vT=()=>kt("/api/settings/k8s"),yT=e=>en("/api/settings/k8s",e),bT=()=>kt("/api/settings/modal"),ST=()=>en("/api/settings/modal/provision"),xT=()=>kt("/api/settings/env").then(e=>e.vars),IS=(e,t)=>en("/api/settings/env",{key:e,value:t}).then(n=>n.vars),wT=e=>fetch(`/api/settings/env/${encodeURIComponent(e)}`,{method:"DELETE"}).then(t=>is(t)).then(t=>t.vars),CT=()=>kt("/api/settings/ssh").then(e=>e.hosts),ET=e=>en("/api/settings/ssh/preflight",{host:e}),kT=()=>kt("/api/settings/slurm"),AT=e=>en("/api/settings/slurm",e),TT=e=>en("/api/settings/slurm/preflight",{host:e}),Dy=e=>kt(`/api/projects/${e}/files`),NT=(e,t)=>kt(`/api/projects/${e}/files/report?path=${encodeURIComponent(t)}`),DT=(e,t)=>fetch(`/api/projects/${e}/files?path=${encodeURIComponent(t)}`,{method:"DELETE"}).then(n=>is(n)),Sp=(e,t)=>`/api/projects/${e}/files/file?path=${encodeURIComponent(t)}`,zS=()=>kt("/api/settings/git"),RT=e=>en("/api/settings/git",e),MT=e=>en("/api/settings/git/token",{token:e}),LT=()=>fetch("/api/settings/git/token",{method:"DELETE"}).then(e=>is(e)),gg=(e=!1)=>kt(`/api/harnesses${e?"?refresh=1":""}`).then(t=>t.harnesses),OT=()=>kt("/api/skills").then(e=>e.skills);function pu(e){const t=(e.split("/").pop()??e).replace(/^~/,"").replace(/^claude-/,""),n=[],r=[];for(const a of t.split("-"))/^\d+(\.\d+)?$/.test(a)?r.push(a):(r.length&&n.push(r.splice(0).join(".")),n.push(a==="gpt"?"GPT":a.charAt(0).toUpperCase()+a.slice(1)));return r.length&&n.push(r.join(".")),n.join(" ")}const jT=e=>kt(`/api/chat/sessions?projectId=${encodeURIComponent(e)}`).then(t=>t.sessions),BT=(e,t,n={})=>en("/api/chat/sessions",{projectId:e,harness:t,...n}).then(r=>r.session),IT=e=>fetch(`/api/chat/sessions/${e}`,{method:"DELETE"}).then(t=>is(t)),zT=(e,t)=>jS(`/api/chat/sessions/${e}`,{archived:t}).then(n=>n.session),HT=(e,t)=>jS(`/api/chat/sessions/${e}`,{title:t}).then(n=>n.session),FT=e=>kt(`/api/chat/sessions/${e}/messages`).then(t=>t.messages),PT=e=>`/api/chat/attachments/${encodeURIComponent(e)}`,UT=(e,t,n={},r)=>en(`/api/chat/sessions/${e}/message`,{text:t,model:n.model,permissionMode:n.permissionMode,reasoningLevel:n.reasoningLevel,images:r}),$T=e=>en(`/api/chat/sessions/${e}/interrupt`),GT=(e,t)=>en(`/api/chat/sessions/${e}/respond`,t);function fa(e){const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return`${t}s ago`;const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Ry(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function xp(e){return e.length>10?`${e.slice(0,10)}…`:e}function HS(e){return e?typeof e.kind=="string"?e.kind:typeof e.type=="string"?e.type:"":""}function FS(e){return e?typeof e.flavor=="string"&&e.flavor?e.flavor:typeof e.manifest=="string"&&e.manifest?e.manifest:typeof e.namespace=="string"&&e.namespace?e.namespace:"":""}const tu=new Map;function qT(e,t){let n=tu.get(e);return n||(n=new Set,tu.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&tu.delete(e)}}function VT(e){var t;(t=tu.get(e.runId))==null||t.forEach(n=>n(e))}const wp=new Set;function YT(e){return wp.add(e),()=>{wp.delete(e)}}function Rc(e){wp.forEach(t=>t(e))}function WT(e){const t=W.useRef(e);t.current=e,W.useEffect(()=>{const n=new EventSource("/api/events"),r=a=>{try{return JSON.parse(a.data)}catch{return null}};return n.addEventListener("run.updated",a=>{const l=r(a);l!=null&&l.run&&t.current.onRun(l.run)}),n.addEventListener("experiment.updated",a=>{const l=r(a);l!=null&&l.experiment&&t.current.onExperiment(l.experiment)}),n.addEventListener("project.updated",a=>{const l=r(a);l!=null&&l.project&&t.current.onProject(l.project)}),n.addEventListener("files.updated",a=>{var c,o;const l=r(a);l!=null&&l.projectId&&((o=(c=t.current).onFiles)==null||o.call(c,l.projectId))}),n.addEventListener("run.log",a=>{const l=r(a);l!=null&&l.runId&&VT(l)}),n.addEventListener("chat.session",a=>{const l=r(a);l!=null&&l.session&&Rc({type:"session",session:l.session})}),n.addEventListener("chat.session.deleted",a=>{const l=r(a);l!=null&&l.sessionId&&Rc({type:"sessionDeleted",sessionId:l.sessionId})}),n.addEventListener("chat.message",a=>{const l=r(a);l!=null&&l.message&&Rc({type:"message",sessionId:l.sessionId,message:l.message})}),n.addEventListener("chat.busy",a=>{const l=r(a);l!=null&&l.sessionId&&Rc({type:"busy",sessionId:l.sessionId,busy:l.busy})}),()=>n.close()},[])}function My(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,l=!1;for(;!l;){r===-1&&(r=n.length,l=!0);const c=n.slice(a,r).trim();(c||!l)&&t.push(c),a=r+1,r=n.indexOf(",",a)}return t}function XT(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const KT=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ZT=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,QT={};function Ly(e,t){return(QT.jsx?ZT:KT).test(e)}const JT=/[ \t\n\f\r]/g;function e3(e){return typeof e=="object"?e.type==="text"?Oy(e.value):!1:Oy(e)}function Oy(e){return e.replace(JT,"")===""}class Zo{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Zo.prototype.normal={};Zo.prototype.property={};Zo.prototype.space=void 0;function PS(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Zo(n,r,t)}function Mo(e){return e.toLowerCase()}class mn{constructor(t,n){this.attribute=n,this.property=t}}mn.prototype.attribute="";mn.prototype.booleanish=!1;mn.prototype.boolean=!1;mn.prototype.commaOrSpaceSeparated=!1;mn.prototype.commaSeparated=!1;mn.prototype.defined=!1;mn.prototype.mustUseProperty=!1;mn.prototype.number=!1;mn.prototype.overloadedBoolean=!1;mn.prototype.property="";mn.prototype.spaceSeparated=!1;mn.prototype.space=void 0;let t3=0;const Ie=rs(),Ft=rs(),Cp=rs(),xe=rs(),_t=rs(),Wr=rs(),Cn=rs();function rs(){return 2**++t3}const Ep=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ie,booleanish:Ft,commaOrSpaceSeparated:Cn,commaSeparated:Wr,number:xe,overloadedBoolean:Cp,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),zd=Object.keys(Ep);class mg extends mn{constructor(t,n,r,a){let l=-1;if(super(t,n),jy(this,"space",a),typeof r=="number")for(;++l4&&n.slice(0,4)==="data"&&a3.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(By,l3);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!By.test(l)){let c=l.replace(s3,o3);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=mg}return new a(r,t)}function o3(e){return"-"+e.toLowerCase()}function l3(e){return e.charAt(1).toUpperCase()}const XS=PS([US,n3,qS,VS,YS],"html"),Iu=PS([US,i3,qS,VS,YS],"svg");function Iy(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function c3(e){return e.join(" ").trim()}var Gs={},Hd,zy;function u3(){if(zy)return Hd;zy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,o=/^\s+|\s+$/g,u=` -`,f="/",g="*",d="",m="comment",_="declaration";function w(y,b){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];b=b||{};var x=1,v=1;function k(z){var q=z.match(t);q&&(x+=q.length);var G=z.lastIndexOf(u);v=~G?z.length-G:v+z.length}function D(){var z={line:x,column:v};return function(q){return q.position=new T(z),L(),q}}function T(z){this.start=z,this.end={line:x,column:v},this.source=b.source}T.prototype.content=y;function R(z){var q=new Error(b.source+":"+x+":"+v+": "+z);if(q.reason=z,q.filename=b.source,q.line=x,q.column=v,q.source=y,!b.silent)throw q}function N(z){var q=z.exec(y);if(q){var G=q[0];return k(G),y=y.slice(G.length),q}}function L(){N(n)}function I(z){var q;for(z=z||[];q=F();)q!==!1&&z.push(q);return z}function F(){var z=D();if(!(f!=y.charAt(0)||g!=y.charAt(1))){for(var q=2;d!=y.charAt(q)&&(g!=y.charAt(q)||f!=y.charAt(q+1));)++q;if(q+=2,d===y.charAt(q-1))return R("End of comment missing");var G=y.slice(2,q-2);return v+=2,k(G),y=y.slice(q),v+=2,z({type:m,comment:G})}}function V(){var z=D(),q=N(r);if(q){if(F(),!N(a))return R("property missing ':'");var G=N(l),X=z({type:_,property:C(q[0].replace(e,d)),value:G?C(G[0].replace(e,d)):d});return N(c),X}}function H(){var z=[];I(z);for(var q;q=V();)q!==!1&&(z.push(q),I(z));return z}return L(),H()}function C(y){return y?y.replace(o,d):d}return Hd=w,Hd}var Hy;function h3(){if(Hy)return Gs;Hy=1;var e=Gs&&Gs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Gs,"__esModule",{value:!0}),Gs.default=n;const t=e(u3());function n(r,a){let l=null;if(!r||typeof r!="string")return l;const c=(0,t.default)(r),o=typeof a=="function";return c.forEach(u=>{if(u.type!=="declaration")return;const{property:f,value:g}=u;o?a(f,g,u):g&&(l=l||{},l[f]=g)}),l}return Gs}var mo={},Fy;function f3(){if(Fy)return mo;Fy=1,Object.defineProperty(mo,"__esModule",{value:!0}),mo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(f){return!f||n.test(f)||e.test(f)},c=function(f,g){return g.toUpperCase()},o=function(f,g){return"".concat(g,"-")},u=function(f,g){return g===void 0&&(g={}),l(f)?f:(f=f.toLowerCase(),g.reactCompat?f=f.replace(a,o):f=f.replace(r,o),f.replace(t,c))};return mo.camelCase=u,mo}var _o,Py;function d3(){if(Py)return _o;Py=1;var e=_o&&_o.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(h3()),n=f3();function r(a,l){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(o,u){o&&u&&(c[(0,n.camelCase)(o,l)]=u)}),c}return r.default=r,_o=r,_o}var p3=d3();const g3=Lu(p3),KS=ZS("end"),_g=ZS("start");function ZS(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&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 m3(e){const t=_g(e),n=KS(e);if(t&&n)return{start:t,end:n}}function Eo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Uy(e.position):"start"in e||"end"in e?Uy(e):"line"in e||"column"in e?kp(e):""}function kp(e){return $y(e&&e.line)+":"+$y(e&&e.column)}function Uy(e){return kp(e&&e.start)+"-"+kp(e&&e.end)}function $y(e){return e&&typeof e=="number"?e:1}class tn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",l={},c=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?a=t:!l.cause&&t&&(c=!0,a=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?l.ruleId=r:(l.source=r.slice(0,u),l.ruleId=r.slice(u+1))}if(!l.place&&l.ancestors&&l.ancestors){const u=l.ancestors[l.ancestors.length-1];u&&(l.place=u.position)}const o=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=o?o.line:void 0,this.name=Eo(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=c&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}tn.prototype.file="";tn.prototype.name="";tn.prototype.reason="";tn.prototype.message="";tn.prototype.stack="";tn.prototype.column=void 0;tn.prototype.line=void 0;tn.prototype.ancestors=void 0;tn.prototype.cause=void 0;tn.prototype.fatal=void 0;tn.prototype.place=void 0;tn.prototype.ruleId=void 0;tn.prototype.source=void 0;const vg={}.hasOwnProperty,_3=new Map,v3=/[A-Z]/g,y3=new Set(["table","tbody","thead","tfoot","tr"]),b3=new Set(["td","th"]),QS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function S3(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=N3(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=T3(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Iu:XS,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=JS(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function JS(e,t,n){if(t.type==="element")return x3(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return w3(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return E3(e,t,n);if(t.type==="mdxjsEsm")return C3(e,t);if(t.type==="root")return k3(e,t,n);if(t.type==="text")return A3(e,t)}function x3(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=Iu,e.schema=a),e.ancestors.push(t);const l=tx(e,t.tagName,!1),c=D3(e,t);let o=bg(e,t);return y3.has(t.tagName)&&(o=o.filter(function(u){return typeof u=="string"?!e3(u):!0})),ex(e,c,l,t),yg(c,o),e.ancestors.pop(),e.schema=r,e.create(t,l,c,n)}function w3(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Lo(e,t.position)}function C3(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Lo(e,t.position)}function E3(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=Iu,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:tx(e,t.name,!0),c=R3(e,t),o=bg(e,t);return ex(e,c,l,t),yg(c,o),e.ancestors.pop(),e.schema=r,e.create(t,l,c,n)}function k3(e,t,n){const r={};return yg(r,bg(e,t)),e.create(t,e.Fragment,r,n)}function A3(e,t){return t.value}function ex(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function yg(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function T3(e,t,n){return r;function r(a,l,c,o){const f=Array.isArray(c.children)?n:t;return o?f(l,c,o):f(l,c)}}function N3(e,t){return n;function n(r,a,l,c){const o=Array.isArray(l.children),u=_g(r);return t(a,l,c,o,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function D3(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&vg.call(t.properties,a)){const l=M3(e,a,t.properties[a]);if(l){const[c,o]=l;e.tableCellAlignToStyle&&c==="align"&&typeof o=="string"&&b3.has(t.tagName)?r=o:n[c]=o}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function R3(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const c=l.expression;c.type;const o=c.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Lo(e,t.position);else{const a=r.name;let l;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,l=e.evaluater.evaluateExpression(o.expression)}else Lo(e,t.position);else l=r.value===null?!0:r.value;n[a]=l}return n}function bg(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:_3;for(;++ra?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)c=Array.from(r),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);l0?(An(e,e.length,0,t),e):t}const Vy={}.hasOwnProperty;function ix(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Xn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const rn=Sr(/[A-Za-z]/),Jt=Sr(/[\dA-Za-z]/),P3=Sr(/[#-'*+\--9=?A-Z^-~]/);function gu(e){return e!==null&&(e<32||e===127)}const Ap=Sr(/\d/),U3=Sr(/[\dA-Fa-f]/),$3=Sr(/[!-/:-@[-`{-~]/);function Re(e){return e!==null&&e<-2}function vt(e){return e!==null&&(e<0||e===32)}function qe(e){return e===-2||e===-1||e===32}const zu=Sr(new RegExp("\\p{P}|\\p{S}","u")),Zr=Sr(/\s/);function Sr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function pa(e){const t=[];let n=-1,r=0,a=0;for(;++n55295&&l<57344){const o=e.charCodeAt(n+1);l<56320&&o>56319&&o<57344?(c=String.fromCharCode(l,o),a=1):c="�"}else c=String.fromCharCode(l);c&&(t.push(e.slice(r,n),encodeURIComponent(c)),r=n+a+1,c=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Qe(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let l=0;return c;function c(u){return qe(u)?(e.enter(n),o(u)):t(u)}function o(u){return qe(u)&&l++c))return;const R=t.events.length;let N=R,L,I;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){if(L){I=t.events[N][1].end;break}L=!0}for(b(r),T=R;Tv;){const D=n[k];t.containerState=D[1],D[0].exit.call(t,e)}n.length=v}function x(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function W3(e,t,n){return Qe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ia(e){if(e===null||vt(e)||Zr(e))return 1;if(zu(e))return 2}function Hu(e,t,n){const r=[];let a=-1;for(;++a1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},m={...e[n][1].start};Wy(d,-u),Wy(m,u),c={type:u>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},l={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:u>1?"strong":"emphasis",start:{...c.start},end:{...o.end}},e[r][1].end={...c.start},e[n][1].start={...o.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=Fn(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=Fn(f,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",l,t]]),f=Fn(f,Hu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=Fn(f,[["exit",l,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,f=Fn(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,An(e,r-1,n-r+3,f),n=r+f.length-g-2;break}}for(n=-1;++n0&&qe(T)?Qe(e,x,"linePrefix",l+1)(T):x(T)}function x(T){return T===null||Re(T)?e.check(Xy,C,k)(T):(e.enter("codeFlowValue"),v(T))}function v(T){return T===null||Re(T)?(e.exit("codeFlowValue"),x(T)):(e.consume(T),v)}function k(T){return e.exit("codeFenced"),t(T)}function D(T,R,N){let L=0;return I;function I(q){return T.enter("lineEnding"),T.consume(q),T.exit("lineEnding"),F}function F(q){return T.enter("codeFencedFence"),qe(q)?Qe(T,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):V(q)}function V(q){return q===o?(T.enter("codeFencedFenceSequence"),H(q)):N(q)}function H(q){return q===o?(L++,T.consume(q),H):L>=c?(T.exit("codeFencedFenceSequence"),qe(q)?Qe(T,z,"whitespace")(q):z(q)):N(q)}function z(q){return q===null||Re(q)?(T.exit("codeFencedFence"),R(q)):N(q)}}}function aN(e,t,n){const r=this;return a;function a(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l)}function l(c){return r.parser.lazy[r.now().line]?n(c):t(c)}}const Pd={name:"codeIndented",tokenize:lN},oN={partial:!0,tokenize:cN};function lN(e,t,n){const r=this;return a;function a(f){return e.enter("codeIndented"),Qe(e,l,"linePrefix",5)(f)}function l(f){const g=r.events[r.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(f):n(f)}function c(f){return f===null?u(f):Re(f)?e.attempt(oN,c,u)(f):(e.enter("codeFlowValue"),o(f))}function o(f){return f===null||Re(f)?(e.exit("codeFlowValue"),c(f)):(e.consume(f),o)}function u(f){return e.exit("codeIndented"),t(f)}}function cN(e,t,n){const r=this;return a;function a(c){return r.parser.lazy[r.now().line]?n(c):Re(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):Qe(e,l,"linePrefix",5)(c)}function l(c){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(c):Re(c)?a(c):n(c)}}const uN={name:"codeText",previous:fN,resolve:hN,tokenize:dN};function hN(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&vo(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),vo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),vo(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(c):e.interrupt(r.parser.constructs.flow,n,t)(c)}}function cx(e,t,n,r,a,l,c,o,u){const f=u||Number.POSITIVE_INFINITY;let g=0;return d;function d(b){return b===60?(e.enter(r),e.enter(a),e.enter(l),e.consume(b),e.exit(l),m):b===null||b===32||b===41||gu(b)?n(b):(e.enter(r),e.enter(c),e.enter(o),e.enter("chunkString",{contentType:"string"}),C(b))}function m(b){return b===62?(e.enter(l),e.consume(b),e.exit(l),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),_(b))}function _(b){return b===62?(e.exit("chunkString"),e.exit(o),m(b)):b===null||b===60||Re(b)?n(b):(e.consume(b),b===92?w:_)}function w(b){return b===60||b===62||b===92?(e.consume(b),_):_(b)}function C(b){return!g&&(b===null||b===41||vt(b))?(e.exit("chunkString"),e.exit(o),e.exit(c),e.exit(r),t(b)):g999||_===null||_===91||_===93&&!u||_===94&&!o&&"_hiddenFootnoteSupport"in c.parser.constructs?n(_):_===93?(e.exit(l),e.enter(a),e.consume(_),e.exit(a),e.exit(r),t):Re(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),d(_))}function d(_){return _===null||_===91||_===93||Re(_)||o++>999?(e.exit("chunkString"),g(_)):(e.consume(_),u||(u=!qe(_)),_===92?m:d)}function m(_){return _===91||_===92||_===93?(e.consume(_),o++,d):d(_)}}function hx(e,t,n,r,a,l){let c;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),c=m===40?41:m,u):n(m)}function u(m){return m===c?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(l),f(m))}function f(m){return m===c?(e.exit(l),u(c)):m===null?n(m):Re(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Qe(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(m))}function g(m){return m===c||m===null||Re(m)?(e.exit("chunkString"),f(m)):(e.consume(m),m===92?d:g)}function d(m){return m===c||m===92?(e.consume(m),g):g(m)}}function ko(e,t){let n;return r;function r(a){return Re(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):qe(a)?Qe(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const SN={name:"definition",tokenize:wN},xN={partial:!0,tokenize:CN};function wN(e,t,n){const r=this;let a;return l;function l(_){return e.enter("definition"),c(_)}function c(_){return ux.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function o(_){return a=Xn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),_===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),u):n(_)}function u(_){return vt(_)?ko(e,f)(_):f(_)}function f(_){return cx(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function g(_){return e.attempt(xN,d,d)(_)}function d(_){return qe(_)?Qe(e,m,"whitespace")(_):m(_)}function m(_){return _===null||Re(_)?(e.exit("definition"),r.parser.defined.push(a),t(_)):n(_)}}function CN(e,t,n){return r;function r(o){return vt(o)?ko(e,a)(o):n(o)}function a(o){return hx(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function l(o){return qe(o)?Qe(e,c,"whitespace")(o):c(o)}function c(o){return o===null||Re(o)?t(o):n(o)}}const EN={name:"hardBreakEscape",tokenize:kN};function kN(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),a}function a(l){return Re(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const AN={name:"headingAtx",resolve:TN,tokenize:NN};function TN(e,t){let n=e.length-2,r=3,a,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},An(e,r,n-r+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function NN(e,t,n){let r=0;return a;function a(g){return e.enter("atxHeading"),l(g)}function l(g){return e.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&r++<6?(e.consume(g),c):g===null||vt(g)?(e.exit("atxHeadingSequence"),o(g)):n(g)}function o(g){return g===35?(e.enter("atxHeadingSequence"),u(g)):g===null||Re(g)?(e.exit("atxHeading"),t(g)):qe(g)?Qe(e,o,"whitespace")(g):(e.enter("atxHeadingText"),f(g))}function u(g){return g===35?(e.consume(g),u):(e.exit("atxHeadingSequence"),o(g))}function f(g){return g===null||g===35||vt(g)?(e.exit("atxHeadingText"),o(g)):(e.consume(g),f)}}const DN=["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"],Zy=["pre","script","style","textarea"],RN={concrete:!0,name:"htmlFlow",resolveTo:ON,tokenize:jN},MN={partial:!0,tokenize:IN},LN={partial:!0,tokenize:BN};function ON(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function jN(e,t,n){const r=this;let a,l,c,o,u;return f;function f(U){return g(U)}function g(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),d}function d(U){return U===33?(e.consume(U),m):U===47?(e.consume(U),l=!0,C):U===63?(e.consume(U),a=3,r.interrupt?t:M):rn(U)?(e.consume(U),c=String.fromCharCode(U),y):n(U)}function m(U){return U===45?(e.consume(U),a=2,_):U===91?(e.consume(U),a=5,o=0,w):rn(U)?(e.consume(U),a=4,r.interrupt?t:M):n(U)}function _(U){return U===45?(e.consume(U),r.interrupt?t:M):n(U)}function w(U){const Q="CDATA[";return U===Q.charCodeAt(o++)?(e.consume(U),o===Q.length?r.interrupt?t:V:w):n(U)}function C(U){return rn(U)?(e.consume(U),c=String.fromCharCode(U),y):n(U)}function y(U){if(U===null||U===47||U===62||vt(U)){const Q=U===47,ie=c.toLowerCase();return!Q&&!l&&Zy.includes(ie)?(a=1,r.interrupt?t(U):V(U)):DN.includes(c.toLowerCase())?(a=6,Q?(e.consume(U),b):r.interrupt?t(U):V(U)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(U):l?x(U):v(U))}return U===45||Jt(U)?(e.consume(U),c+=String.fromCharCode(U),y):n(U)}function b(U){return U===62?(e.consume(U),r.interrupt?t:V):n(U)}function x(U){return qe(U)?(e.consume(U),x):I(U)}function v(U){return U===47?(e.consume(U),I):U===58||U===95||rn(U)?(e.consume(U),k):qe(U)?(e.consume(U),v):I(U)}function k(U){return U===45||U===46||U===58||U===95||Jt(U)?(e.consume(U),k):D(U)}function D(U){return U===61?(e.consume(U),T):qe(U)?(e.consume(U),D):v(U)}function T(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),u=U,R):qe(U)?(e.consume(U),T):N(U)}function R(U){return U===u?(e.consume(U),u=null,L):U===null||Re(U)?n(U):(e.consume(U),R)}function N(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||vt(U)?D(U):(e.consume(U),N)}function L(U){return U===47||U===62||qe(U)?v(U):n(U)}function I(U){return U===62?(e.consume(U),F):n(U)}function F(U){return U===null||Re(U)?V(U):qe(U)?(e.consume(U),F):n(U)}function V(U){return U===45&&a===2?(e.consume(U),G):U===60&&a===1?(e.consume(U),X):U===62&&a===4?(e.consume(U),j):U===63&&a===3?(e.consume(U),M):U===93&&a===5?(e.consume(U),O):Re(U)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(MN,$,H)(U)):U===null||Re(U)?(e.exit("htmlFlowData"),H(U)):(e.consume(U),V)}function H(U){return e.check(LN,z,$)(U)}function z(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),q}function q(U){return U===null||Re(U)?H(U):(e.enter("htmlFlowData"),V(U))}function G(U){return U===45?(e.consume(U),M):V(U)}function X(U){return U===47?(e.consume(U),c="",K):V(U)}function K(U){if(U===62){const Q=c.toLowerCase();return Zy.includes(Q)?(e.consume(U),j):V(U)}return rn(U)&&c.length<8?(e.consume(U),c+=String.fromCharCode(U),K):V(U)}function O(U){return U===93?(e.consume(U),M):V(U)}function M(U){return U===62?(e.consume(U),j):U===45&&a===2?(e.consume(U),M):V(U)}function j(U){return U===null||Re(U)?(e.exit("htmlFlowData"),$(U)):(e.consume(U),j)}function $(U){return e.exit("htmlFlow"),t(U)}}function BN(e,t,n){const r=this;return a;function a(c){return Re(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):n(c)}function l(c){return r.parser.lazy[r.now().line]?n(c):t(c)}}function IN(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Qo,t,n)}}const zN={name:"htmlText",tokenize:HN};function HN(e,t,n){const r=this;let a,l,c;return o;function o(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),u}function u(M){return M===33?(e.consume(M),f):M===47?(e.consume(M),D):M===63?(e.consume(M),v):rn(M)?(e.consume(M),N):n(M)}function f(M){return M===45?(e.consume(M),g):M===91?(e.consume(M),l=0,w):rn(M)?(e.consume(M),x):n(M)}function g(M){return M===45?(e.consume(M),_):n(M)}function d(M){return M===null?n(M):M===45?(e.consume(M),m):Re(M)?(c=d,X(M)):(e.consume(M),d)}function m(M){return M===45?(e.consume(M),_):d(M)}function _(M){return M===62?G(M):M===45?m(M):d(M)}function w(M){const j="CDATA[";return M===j.charCodeAt(l++)?(e.consume(M),l===j.length?C:w):n(M)}function C(M){return M===null?n(M):M===93?(e.consume(M),y):Re(M)?(c=C,X(M)):(e.consume(M),C)}function y(M){return M===93?(e.consume(M),b):C(M)}function b(M){return M===62?G(M):M===93?(e.consume(M),b):C(M)}function x(M){return M===null||M===62?G(M):Re(M)?(c=x,X(M)):(e.consume(M),x)}function v(M){return M===null?n(M):M===63?(e.consume(M),k):Re(M)?(c=v,X(M)):(e.consume(M),v)}function k(M){return M===62?G(M):v(M)}function D(M){return rn(M)?(e.consume(M),T):n(M)}function T(M){return M===45||Jt(M)?(e.consume(M),T):R(M)}function R(M){return Re(M)?(c=R,X(M)):qe(M)?(e.consume(M),R):G(M)}function N(M){return M===45||Jt(M)?(e.consume(M),N):M===47||M===62||vt(M)?L(M):n(M)}function L(M){return M===47?(e.consume(M),G):M===58||M===95||rn(M)?(e.consume(M),I):Re(M)?(c=L,X(M)):qe(M)?(e.consume(M),L):G(M)}function I(M){return M===45||M===46||M===58||M===95||Jt(M)?(e.consume(M),I):F(M)}function F(M){return M===61?(e.consume(M),V):Re(M)?(c=F,X(M)):qe(M)?(e.consume(M),F):L(M)}function V(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),a=M,H):Re(M)?(c=V,X(M)):qe(M)?(e.consume(M),V):(e.consume(M),z)}function H(M){return M===a?(e.consume(M),a=void 0,q):M===null?n(M):Re(M)?(c=H,X(M)):(e.consume(M),H)}function z(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||vt(M)?L(M):(e.consume(M),z)}function q(M){return M===47||M===62||vt(M)?L(M):n(M)}function G(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function X(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),K}function K(M){return qe(M)?Qe(e,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):O(M)}function O(M){return e.enter("htmlTextData"),c(M)}}const xg={name:"labelEnd",resolveAll:$N,resolveTo:GN,tokenize:qN},FN={tokenize:VN},PN={tokenize:YN},UN={tokenize:WN};function $N(e){let t=-1;const n=[];for(;++t=3&&(f===null||Re(f))?(e.exit("thematicBreak"),t(f)):n(f)}function u(f){return f===a?(e.consume(f),r++,u):(e.exit("thematicBreakSequence"),qe(f)?Qe(e,o,"whitespace")(f):o(f))}}const dn={continuation:{tokenize:r5},exit:a5,name:"list",tokenize:i5},t5={partial:!0,tokenize:o5},n5={partial:!0,tokenize:s5};function i5(e,t,n){const r=this,a=r.events[r.events.length-1];let l=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,c=0;return o;function o(_){const w=r.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||_===r.containerState.marker:Ap(_)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(nu,n,f)(_):f(_);if(!r.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(_)}return n(_)}function u(_){return Ap(_)&&++c<10?(e.consume(_),u):(!r.interrupt||c<2)&&(r.containerState.marker?_===r.containerState.marker:_===41||_===46)?(e.exit("listItemValue"),f(_)):n(_)}function f(_){return e.enter("listItemMarker"),e.consume(_),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||_,e.check(Qo,r.interrupt?n:g,e.attempt(t5,m,d))}function g(_){return r.containerState.initialBlankLine=!0,l++,m(_)}function d(_){return qe(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),m):n(_)}function m(_){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(_)}}function r5(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Qo,a,l);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Qe(e,t,"listItemIndent",r.containerState.size+1)(o)}function l(o){return r.containerState.furtherBlankLines||!qe(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,c(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(n5,t,c)(o))}function c(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Qe(e,e.attempt(dn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function s5(e,t,n){const r=this;return Qe(e,a,"listItemIndent",r.containerState.size+1);function a(l){const c=r.events[r.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===r.containerState.size?t(l):n(l)}}function a5(e){e.exit(this.containerState.type)}function o5(e,t,n){const r=this;return Qe(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(l){const c=r.events[r.events.length-1];return!qe(l)&&c&&c[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const Qy={name:"setextUnderline",resolveTo:l5,tokenize:c5};function l5(e,t){let n=e.length,r,a,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const c={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(e.splice(a,0,["enter",c,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=c,e.push(["exit",c,t]),e}function c5(e,t,n){const r=this;let a;return l;function l(f){let g=r.events.length,d;for(;g--;)if(r.events[g][1].type!=="lineEnding"&&r.events[g][1].type!=="linePrefix"&&r.events[g][1].type!=="content"){d=r.events[g][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),a=f,c(f)):n(f)}function c(f){return e.enter("setextHeadingLineSequence"),o(f)}function o(f){return f===a?(e.consume(f),o):(e.exit("setextHeadingLineSequence"),qe(f)?Qe(e,u,"lineSuffix")(f):u(f))}function u(f){return f===null||Re(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const u5={tokenize:h5};function h5(e){const t=this,n=e.attempt(Qo,r,e.attempt(this.parser.constructs.flowInitial,a,Qe(e,e.attempt(this.parser.constructs.flow,a,e.attempt(mN,a)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const f5={resolveAll:dx()},d5=fx("string"),p5=fx("text");function fx(e){return{resolveAll:dx(e==="text"?g5:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],l=n.attempt(a,c,o);return c;function c(g){return f(g)?l(g):o(g)}function o(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),u}function u(g){return f(g)?(n.exit("data"),l(g)):(n.consume(g),u)}function f(g){if(g===null)return!0;const d=a[g];let m=-1;if(d)for(;++m-1){const o=c[0];typeof o=="string"?c[0]=o.slice(r):c.shift()}l>0&&c.push(e[a].slice(0,l))}return c}function T5(e,t){let n=-1;const r=[];let a;for(;++n"");let n=t;try{const r=JSON.parse(t);r.error&&(n=r.error)}catch{}throw new Error(n||`HTTP ${e.status}`)}return await e.json()}const yt=e=>fetch(e).then(t=>is(t)),Ot=(e,t)=>fetch(e,{method:"POST",headers:t===void 0?{}:{"content-type":"application/json"},body:t===void 0?void 0:JSON.stringify(t)}).then(n=>is(n)),HS=(e,t)=>fetch(e,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}).then(n=>is(n)),cT=()=>yt("/api/projects").then(e=>e.projects),uT=e=>Ot("/api/projects",e).then(t=>t.project),hT=e=>yt(`/api/papers/search?q=${encodeURIComponent(e)}`).then(t=>t.papers),fT=e=>yt(`/api/papers/resolve?id=${encodeURIComponent(e)}`).then(t=>t.paper),dT=e=>Ot(`/api/projects/${e}/open`).then(t=>t.project),pT=e=>fetch(`/api/projects/${e}`,{method:"DELETE"}).then(async t=>{if(!t.ok){const n=await t.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`delete failed (${t.status})`)}}),gT=e=>yt(`/api/projects/${e}/experiments`).then(t=>t.experiments),mT=e=>yt(`/api/projects/${e}/runs`).then(t=>t.runs),_T=()=>yt("/api/instances").then(e=>e.instances),FS=e=>Ot(`/api/runs/${e}/cancel`),vT=(e,t)=>yt(`/api/runs/${e}/log?offset=${t}`),yT=e=>yt(`/api/experiments/${e}/commits`).then(t=>t.commits),bT=(e,t)=>yt(`/api/experiments/${e}/commits/${t}/diff`),Ly=e=>yt(`/api/projects/${e}/working-tree`),ST=(e,t,n)=>yt(`/api/projects/${e}/file?path=${encodeURIComponent(t)}`+(n?`&sessionId=${encodeURIComponent(n)}`:"")),xT=()=>yt("/api/settings/hf"),wT=e=>Ot("/api/settings/hf",{token:e}),CT=()=>yt("/api/settings/k8s"),ET=e=>Ot("/api/settings/k8s",e),kT=()=>yt("/api/settings/modal"),AT=()=>Ot("/api/settings/modal/provision"),TT=()=>yt("/api/settings/env").then(e=>e.vars),PS=(e,t)=>Ot("/api/settings/env",{key:e,value:t}).then(n=>n.vars),NT=e=>fetch(`/api/settings/env/${encodeURIComponent(e)}`,{method:"DELETE"}).then(t=>is(t)).then(t=>t.vars),US=()=>yt("/api/settings/data-dir"),DT=e=>Ot("/api/settings/data-dir/validate",{path:e}),RT=e=>Ot("/api/settings/data-dir",{path:e}),MT=e=>Ot("/api/settings/data-dir/move",{path:e}),LT=()=>yt("/api/settings/ssh").then(e=>e.hosts),OT=e=>Ot("/api/settings/ssh/preflight",{host:e}),jT=()=>yt("/api/settings/slurm"),BT=e=>Ot("/api/settings/slurm",e),IT=e=>Ot("/api/settings/slurm/preflight",{host:e}),Oy=e=>yt(`/api/projects/${e}/files`),zT=(e,t)=>yt(`/api/projects/${e}/files/report?path=${encodeURIComponent(t)}`),HT=(e,t)=>fetch(`/api/projects/${e}/files?path=${encodeURIComponent(t)}`,{method:"DELETE"}).then(n=>is(n)),Ep=(e,t)=>`/api/projects/${e}/files/file?path=${encodeURIComponent(t)}`,$S=()=>yt("/api/settings/git"),FT=e=>Ot("/api/settings/git",e),PT=e=>Ot("/api/settings/git/token",{token:e}),UT=()=>fetch("/api/settings/git/token",{method:"DELETE"}).then(e=>is(e)),$T=()=>yt("/api/settings/telemetry"),GT=e=>Ot("/api/settings/telemetry",{enabled:e}),qT=e=>Ot("/api/settings/telemetry/consent",{enabled:e}),bg=(e=!1)=>yt(`/api/harnesses${e?"?refresh=1":""}`).then(t=>t.harnesses),VT=()=>yt("/api/skills").then(e=>e.skills);function _u(e){const t=(e.split("/").pop()??e).replace(/^~/,"").replace(/^claude-/,""),n=[],r=[];for(const a of t.split("-"))/^\d+(\.\d+)?$/.test(a)?r.push(a):(r.length&&n.push(r.splice(0).join(".")),n.push(a==="gpt"?"GPT":a.charAt(0).toUpperCase()+a.slice(1)));return r.length&&n.push(r.join(".")),n.join(" ")}const YT=e=>yt(`/api/chat/sessions?projectId=${encodeURIComponent(e)}`).then(t=>t.sessions),WT=(e,t,n={})=>Ot("/api/chat/sessions",{projectId:e,harness:t,...n}).then(r=>r.session),XT=e=>fetch(`/api/chat/sessions/${e}`,{method:"DELETE"}).then(t=>is(t)),KT=(e,t)=>HS(`/api/chat/sessions/${e}`,{archived:t}).then(n=>n.session),ZT=(e,t)=>HS(`/api/chat/sessions/${e}`,{title:t}).then(n=>n.session),QT=e=>yt(`/api/chat/sessions/${e}/messages`).then(t=>t.messages),JT=e=>`/api/chat/attachments/${encodeURIComponent(e)}`,eN=(e,t,n={},r)=>Ot(`/api/chat/sessions/${e}/message`,{text:t,model:n.model,permissionMode:n.permissionMode,reasoningLevel:n.reasoningLevel,images:r}),tN=e=>Ot(`/api/chat/sessions/${e}/interrupt`),nN=(e,t)=>Ot(`/api/chat/sessions/${e}/respond`,t);function fa(e){const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return`${t}s ago`;const n=Math.floor(t/60);if(n<60)return`${n}m ago`;const r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function jy(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function Lo(e){const t=["B","KB","MB","GB","TB"];let n=e,r=0;for(;n>=1024&&r10?`${e.slice(0,10)}…`:e}function GS(e){return e?typeof e.kind=="string"?e.kind:typeof e.type=="string"?e.type:"":""}function qS(e){return e?typeof e.flavor=="string"&&e.flavor?e.flavor:typeof e.manifest=="string"&&e.manifest?e.manifest:typeof e.namespace=="string"&&e.namespace?e.namespace:"":""}const ru=new Map;function iN(e,t){let n=ru.get(e);return n||(n=new Set,ru.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&ru.delete(e)}}function rN(e){var t;(t=ru.get(e.runId))==null||t.forEach(n=>n(e))}const Ap=new Set;function sN(e){return Ap.add(e),()=>{Ap.delete(e)}}function Oc(e){Ap.forEach(t=>t(e))}const Tp=new Set;function aN(e){return Tp.add(e),()=>{Tp.delete(e)}}function Pd(e){Tp.forEach(t=>t(e))}function oN(e){const t=Y.useRef(e);t.current=e,Y.useEffect(()=>{const n=new EventSource("/api/events"),r=a=>{try{return JSON.parse(a.data)}catch{return null}};return n.addEventListener("run.updated",a=>{const l=r(a);l!=null&&l.run&&t.current.onRun(l.run)}),n.addEventListener("experiment.updated",a=>{const l=r(a);l!=null&&l.experiment&&t.current.onExperiment(l.experiment)}),n.addEventListener("project.updated",a=>{const l=r(a);l!=null&&l.project&&t.current.onProject(l.project)}),n.addEventListener("files.updated",a=>{var c,o;const l=r(a);l!=null&&l.projectId&&((o=(c=t.current).onFiles)==null||o.call(c,l.projectId))}),n.addEventListener("run.log",a=>{const l=r(a);l!=null&&l.runId&&rN(l)}),n.addEventListener("chat.session",a=>{const l=r(a);l!=null&&l.session&&Oc({type:"session",session:l.session})}),n.addEventListener("chat.session.deleted",a=>{const l=r(a);l!=null&&l.sessionId&&Oc({type:"sessionDeleted",sessionId:l.sessionId})}),n.addEventListener("chat.message",a=>{const l=r(a);l!=null&&l.message&&Oc({type:"message",sessionId:l.sessionId,message:l.message})}),n.addEventListener("chat.busy",a=>{const l=r(a);l!=null&&l.sessionId&&Oc({type:"busy",sessionId:l.sessionId,busy:l.busy})}),n.addEventListener("datadir.move.progress",a=>{const l=r(a);l&&Pd({type:"progress",...l})}),n.addEventListener("datadir.move.done",a=>{const l=r(a);l&&Pd({type:"done",path:l.path,oldPathLeft:l.oldPathLeft})}),n.addEventListener("datadir.move.error",a=>{const l=r(a);l&&Pd({type:"error",error:l.error})}),()=>n.close()},[])}function By(e){const t=[],n=String(e||"");let r=n.indexOf(","),a=0,l=!1;for(;!l;){r===-1&&(r=n.length,l=!0);const c=n.slice(a,r).trim();(c||!l)&&t.push(c),a=r+1,r=n.indexOf(",",a)}return t}function lN(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const cN=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,uN=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hN={};function Iy(e,t){return(hN.jsx?uN:cN).test(e)}const fN=/[ \t\n\f\r]/g;function dN(e){return typeof e=="object"?e.type==="text"?zy(e.value):!1:zy(e)}function zy(e){return e.replace(fN,"")===""}class Jo{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Jo.prototype.normal={};Jo.prototype.property={};Jo.prototype.space=void 0;function VS(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Jo(n,r,t)}function Oo(e){return e.toLowerCase()}class vn{constructor(t,n){this.attribute=n,this.property=t}}vn.prototype.attribute="";vn.prototype.booleanish=!1;vn.prototype.boolean=!1;vn.prototype.commaOrSpaceSeparated=!1;vn.prototype.commaSeparated=!1;vn.prototype.defined=!1;vn.prototype.mustUseProperty=!1;vn.prototype.number=!1;vn.prototype.overloadedBoolean=!1;vn.prototype.property="";vn.prototype.spaceSeparated=!1;vn.prototype.space=void 0;let pN=0;const Ie=rs(),Pt=rs(),Np=rs(),xe=rs(),_t=rs(),Wr=rs(),kn=rs();function rs(){return 2**++pN}const Dp=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ie,booleanish:Pt,commaOrSpaceSeparated:kn,commaSeparated:Wr,number:xe,overloadedBoolean:Np,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),Ud=Object.keys(Dp);class Sg extends vn{constructor(t,n,r,a){let l=-1;if(super(t,n),Hy(this,"space",a),typeof r=="number")for(;++l4&&n.slice(0,4)==="data"&&yN.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(Fy,SN);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Fy.test(l)){let c=l.replace(vN,bN);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Sg}return new a(r,t)}function bN(e){return"-"+e.toLowerCase()}function SN(e){return e.charAt(1).toUpperCase()}const ex=VS([YS,gN,KS,ZS,QS],"html"),Fu=VS([YS,mN,KS,ZS,QS],"svg");function Py(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function xN(e){return e.join(" ").trim()}var Gs={},$d,Uy;function wN(){if(Uy)return $d;Uy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,o=/^\s+|\s+$/g,u=` +`,f="/",g="*",d="",m="comment",_="declaration";function w(b,S){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];S=S||{};var x=1,y=1;function k(z){var q=z.match(t);q&&(x+=q.length);var G=z.lastIndexOf(u);y=~G?z.length-G:y+z.length}function D(){var z={line:x,column:y};return function(q){return q.position=new T(z),L(),q}}function T(z){this.start=z,this.end={line:x,column:y},this.source=S.source}T.prototype.content=b;function R(z){var q=new Error(S.source+":"+x+":"+y+": "+z);if(q.reason=z,q.filename=S.source,q.line=x,q.column=y,q.source=b,!S.silent)throw q}function N(z){var q=z.exec(b);if(q){var G=q[0];return k(G),b=b.slice(G.length),q}}function L(){N(n)}function I(z){var q;for(z=z||[];q=F();)q!==!1&&z.push(q);return z}function F(){var z=D();if(!(f!=b.charAt(0)||g!=b.charAt(1))){for(var q=2;d!=b.charAt(q)&&(g!=b.charAt(q)||f!=b.charAt(q+1));)++q;if(q+=2,d===b.charAt(q-1))return R("End of comment missing");var G=b.slice(2,q-2);return y+=2,k(G),b=b.slice(q),y+=2,z({type:m,comment:G})}}function V(){var z=D(),q=N(r);if(q){if(F(),!N(a))return R("property missing ':'");var G=N(l),X=z({type:_,property:C(q[0].replace(e,d)),value:G?C(G[0].replace(e,d)):d});return N(c),X}}function H(){var z=[];I(z);for(var q;q=V();)q!==!1&&(z.push(q),I(z));return z}return L(),H()}function C(b){return b?b.replace(o,d):d}return $d=w,$d}var $y;function CN(){if($y)return Gs;$y=1;var e=Gs&&Gs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Gs,"__esModule",{value:!0}),Gs.default=n;const t=e(wN());function n(r,a){let l=null;if(!r||typeof r!="string")return l;const c=(0,t.default)(r),o=typeof a=="function";return c.forEach(u=>{if(u.type!=="declaration")return;const{property:f,value:g}=u;o?a(f,g,u):g&&(l=l||{},l[f]=g)}),l}return Gs}var mo={},Gy;function EN(){if(Gy)return mo;Gy=1,Object.defineProperty(mo,"__esModule",{value:!0}),mo.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(f){return!f||n.test(f)||e.test(f)},c=function(f,g){return g.toUpperCase()},o=function(f,g){return"".concat(g,"-")},u=function(f,g){return g===void 0&&(g={}),l(f)?f:(f=f.toLowerCase(),g.reactCompat?f=f.replace(a,o):f=f.replace(r,o),f.replace(t,c))};return mo.camelCase=u,mo}var _o,qy;function kN(){if(qy)return _o;qy=1;var e=_o&&_o.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(CN()),n=EN();function r(a,l){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(o,u){o&&u&&(c[(0,n.camelCase)(o,l)]=u)}),c}return r.default=r,_o=r,_o}var AN=kN();const TN=Bu(AN),tx=nx("end"),xg=nx("start");function nx(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&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 NN(e){const t=xg(e),n=tx(e);if(t&&n)return{start:t,end:n}}function ko(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Vy(e.position):"start"in e||"end"in e?Vy(e):"line"in e||"column"in e?Rp(e):""}function Rp(e){return Yy(e&&e.line)+":"+Yy(e&&e.column)}function Vy(e){return Rp(e&&e.start)+"-"+Rp(e&&e.end)}function Yy(e){return e&&typeof e=="number"?e:1}class tn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",l={},c=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?a=t:!l.cause&&t&&(c=!0,a=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?l.ruleId=r:(l.source=r.slice(0,u),l.ruleId=r.slice(u+1))}if(!l.place&&l.ancestors&&l.ancestors){const u=l.ancestors[l.ancestors.length-1];u&&(l.place=u.position)}const o=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=o?o.line:void 0,this.name=ko(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=c&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}tn.prototype.file="";tn.prototype.name="";tn.prototype.reason="";tn.prototype.message="";tn.prototype.stack="";tn.prototype.column=void 0;tn.prototype.line=void 0;tn.prototype.ancestors=void 0;tn.prototype.cause=void 0;tn.prototype.fatal=void 0;tn.prototype.place=void 0;tn.prototype.ruleId=void 0;tn.prototype.source=void 0;const wg={}.hasOwnProperty,DN=new Map,RN=/[A-Z]/g,MN=new Set(["table","tbody","thead","tfoot","tr"]),LN=new Set(["td","th"]),ix="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ON(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=UN(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=PN(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Fu:ex,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=rx(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function rx(e,t,n){if(t.type==="element")return jN(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return BN(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return zN(e,t,n);if(t.type==="mdxjsEsm")return IN(e,t);if(t.type==="root")return HN(e,t,n);if(t.type==="text")return FN(e,t)}function jN(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=Fu,e.schema=a),e.ancestors.push(t);const l=ax(e,t.tagName,!1),c=$N(e,t);let o=Eg(e,t);return MN.has(t.tagName)&&(o=o.filter(function(u){return typeof u=="string"?!dN(u):!0})),sx(e,c,l,t),Cg(c,o),e.ancestors.pop(),e.schema=r,e.create(t,l,c,n)}function BN(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}jo(e,t.position)}function IN(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);jo(e,t.position)}function zN(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=Fu,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:ax(e,t.name,!0),c=GN(e,t),o=Eg(e,t);return sx(e,c,l,t),Cg(c,o),e.ancestors.pop(),e.schema=r,e.create(t,l,c,n)}function HN(e,t,n){const r={};return Cg(r,Eg(e,t)),e.create(t,e.Fragment,r,n)}function FN(e,t){return t.value}function sx(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Cg(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function PN(e,t,n){return r;function r(a,l,c,o){const f=Array.isArray(c.children)?n:t;return o?f(l,c,o):f(l,c)}}function UN(e,t){return n;function n(r,a,l,c){const o=Array.isArray(l.children),u=xg(r);return t(a,l,c,o,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function $N(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&wg.call(t.properties,a)){const l=qN(e,a,t.properties[a]);if(l){const[c,o]=l;e.tableCellAlignToStyle&&c==="align"&&typeof o=="string"&&LN.has(t.tagName)?r=o:n[c]=o}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function GN(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const c=l.expression;c.type;const o=c.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else jo(e,t.position);else{const a=r.name;let l;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,l=e.evaluater.evaluateExpression(o.expression)}else jo(e,t.position);else l=r.value===null?!0:r.value;n[a]=l}return n}function Eg(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:DN;for(;++ra?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)c=Array.from(r),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);l0?(Nn(e,e.length,0,t),e):t}const Ky={}.hasOwnProperty;function lx(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Zn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const sn=Sr(/[A-Za-z]/),en=Sr(/[\dA-Za-z]/),e3=Sr(/[#-'*+\--9=?A-Z^-~]/);function vu(e){return e!==null&&(e<32||e===127)}const Mp=Sr(/\d/),t3=Sr(/[\dA-Fa-f]/),n3=Sr(/[!-/:-@[-`{-~]/);function Re(e){return e!==null&&e<-2}function vt(e){return e!==null&&(e<0||e===32)}function qe(e){return e===-2||e===-1||e===32}const Pu=Sr(new RegExp("\\p{P}|\\p{S}","u")),Zr=Sr(/\s/);function Sr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function pa(e){const t=[];let n=-1,r=0,a=0;for(;++n55295&&l<57344){const o=e.charCodeAt(n+1);l<56320&&o>56319&&o<57344?(c=String.fromCharCode(l,o),a=1):c="�"}else c=String.fromCharCode(l);c&&(t.push(e.slice(r,n),encodeURIComponent(c)),r=n+a+1,c=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function et(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let l=0;return c;function c(u){return qe(u)?(e.enter(n),o(u)):t(u)}function o(u){return qe(u)&&l++c))return;const R=t.events.length;let N=R,L,I;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){if(L){I=t.events[N][1].end;break}L=!0}for(S(r),T=R;Ty;){const D=n[k];t.containerState=D[1],D[0].exit.call(t,e)}n.length=y}function x(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function o3(e,t,n){return et(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ia(e){if(e===null||vt(e)||Zr(e))return 1;if(Pu(e))return 2}function Uu(e,t,n){const r=[];let a=-1;for(;++a1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},m={...e[n][1].start};Qy(d,-u),Qy(m,u),c={type:u>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},o={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},l={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:u>1?"strong":"emphasis",start:{...c.start},end:{...o.end}},e[r][1].end={...c.start},e[n][1].start={...o.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=Un(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=Un(f,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",l,t]]),f=Un(f,Uu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=Un(f,[["exit",l,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,f=Un(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,Nn(e,r-1,n-r+3,f),n=r+f.length-g-2;break}}for(n=-1;++n0&&qe(T)?et(e,x,"linePrefix",l+1)(T):x(T)}function x(T){return T===null||Re(T)?e.check(Jy,C,k)(T):(e.enter("codeFlowValue"),y(T))}function y(T){return T===null||Re(T)?(e.exit("codeFlowValue"),x(T)):(e.consume(T),y)}function k(T){return e.exit("codeFenced"),t(T)}function D(T,R,N){let L=0;return I;function I(q){return T.enter("lineEnding"),T.consume(q),T.exit("lineEnding"),F}function F(q){return T.enter("codeFencedFence"),qe(q)?et(T,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):V(q)}function V(q){return q===o?(T.enter("codeFencedFenceSequence"),H(q)):N(q)}function H(q){return q===o?(L++,T.consume(q),H):L>=c?(T.exit("codeFencedFenceSequence"),qe(q)?et(T,z,"whitespace")(q):z(q)):N(q)}function z(q){return q===null||Re(q)?(T.exit("codeFencedFence"),R(q)):N(q)}}}function y3(e,t,n){const r=this;return a;function a(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l)}function l(c){return r.parser.lazy[r.now().line]?n(c):t(c)}}const qd={name:"codeIndented",tokenize:S3},b3={partial:!0,tokenize:x3};function S3(e,t,n){const r=this;return a;function a(f){return e.enter("codeIndented"),et(e,l,"linePrefix",5)(f)}function l(f){const g=r.events[r.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(f):n(f)}function c(f){return f===null?u(f):Re(f)?e.attempt(b3,c,u)(f):(e.enter("codeFlowValue"),o(f))}function o(f){return f===null||Re(f)?(e.exit("codeFlowValue"),c(f)):(e.consume(f),o)}function u(f){return e.exit("codeIndented"),t(f)}}function x3(e,t,n){const r=this;return a;function a(c){return r.parser.lazy[r.now().line]?n(c):Re(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):et(e,l,"linePrefix",5)(c)}function l(c){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(c):Re(c)?a(c):n(c)}}const w3={name:"codeText",previous:E3,resolve:C3,tokenize:k3};function C3(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&vo(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),vo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),vo(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(c):e.interrupt(r.parser.constructs.flow,n,t)(c)}}function px(e,t,n,r,a,l,c,o,u){const f=u||Number.POSITIVE_INFINITY;let g=0;return d;function d(S){return S===60?(e.enter(r),e.enter(a),e.enter(l),e.consume(S),e.exit(l),m):S===null||S===32||S===41||vu(S)?n(S):(e.enter(r),e.enter(c),e.enter(o),e.enter("chunkString",{contentType:"string"}),C(S))}function m(S){return S===62?(e.enter(l),e.consume(S),e.exit(l),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),_(S))}function _(S){return S===62?(e.exit("chunkString"),e.exit(o),m(S)):S===null||S===60||Re(S)?n(S):(e.consume(S),S===92?w:_)}function w(S){return S===60||S===62||S===92?(e.consume(S),_):_(S)}function C(S){return!g&&(S===null||S===41||vt(S))?(e.exit("chunkString"),e.exit(o),e.exit(c),e.exit(r),t(S)):g999||_===null||_===91||_===93&&!u||_===94&&!o&&"_hiddenFootnoteSupport"in c.parser.constructs?n(_):_===93?(e.exit(l),e.enter(a),e.consume(_),e.exit(a),e.exit(r),t):Re(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),d(_))}function d(_){return _===null||_===91||_===93||Re(_)||o++>999?(e.exit("chunkString"),g(_)):(e.consume(_),u||(u=!qe(_)),_===92?m:d)}function m(_){return _===91||_===92||_===93?(e.consume(_),o++,d):d(_)}}function mx(e,t,n,r,a,l){let c;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),c=m===40?41:m,u):n(m)}function u(m){return m===c?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(l),f(m))}function f(m){return m===c?(e.exit(l),u(c)):m===null?n(m):Re(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),et(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(m))}function g(m){return m===c||m===null||Re(m)?(e.exit("chunkString"),f(m)):(e.consume(m),m===92?d:g)}function d(m){return m===c||m===92?(e.consume(m),g):g(m)}}function Ao(e,t){let n;return r;function r(a){return Re(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):qe(a)?et(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const O3={name:"definition",tokenize:B3},j3={partial:!0,tokenize:I3};function B3(e,t,n){const r=this;let a;return l;function l(_){return e.enter("definition"),c(_)}function c(_){return gx.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function o(_){return a=Zn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),_===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),u):n(_)}function u(_){return vt(_)?Ao(e,f)(_):f(_)}function f(_){return px(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function g(_){return e.attempt(j3,d,d)(_)}function d(_){return qe(_)?et(e,m,"whitespace")(_):m(_)}function m(_){return _===null||Re(_)?(e.exit("definition"),r.parser.defined.push(a),t(_)):n(_)}}function I3(e,t,n){return r;function r(o){return vt(o)?Ao(e,a)(o):n(o)}function a(o){return mx(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function l(o){return qe(o)?et(e,c,"whitespace")(o):c(o)}function c(o){return o===null||Re(o)?t(o):n(o)}}const z3={name:"hardBreakEscape",tokenize:H3};function H3(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),a}function a(l){return Re(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const F3={name:"headingAtx",resolve:P3,tokenize:U3};function P3(e,t){let n=e.length-2,r=3,a,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Nn(e,r,n-r+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function U3(e,t,n){let r=0;return a;function a(g){return e.enter("atxHeading"),l(g)}function l(g){return e.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&r++<6?(e.consume(g),c):g===null||vt(g)?(e.exit("atxHeadingSequence"),o(g)):n(g)}function o(g){return g===35?(e.enter("atxHeadingSequence"),u(g)):g===null||Re(g)?(e.exit("atxHeading"),t(g)):qe(g)?et(e,o,"whitespace")(g):(e.enter("atxHeadingText"),f(g))}function u(g){return g===35?(e.consume(g),u):(e.exit("atxHeadingSequence"),o(g))}function f(g){return g===null||g===35||vt(g)?(e.exit("atxHeadingText"),o(g)):(e.consume(g),f)}}const $3=["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"],t1=["pre","script","style","textarea"],G3={concrete:!0,name:"htmlFlow",resolveTo:Y3,tokenize:W3},q3={partial:!0,tokenize:K3},V3={partial:!0,tokenize:X3};function Y3(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function W3(e,t,n){const r=this;let a,l,c,o,u;return f;function f(U){return g(U)}function g(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),d}function d(U){return U===33?(e.consume(U),m):U===47?(e.consume(U),l=!0,C):U===63?(e.consume(U),a=3,r.interrupt?t:M):sn(U)?(e.consume(U),c=String.fromCharCode(U),b):n(U)}function m(U){return U===45?(e.consume(U),a=2,_):U===91?(e.consume(U),a=5,o=0,w):sn(U)?(e.consume(U),a=4,r.interrupt?t:M):n(U)}function _(U){return U===45?(e.consume(U),r.interrupt?t:M):n(U)}function w(U){const Q="CDATA[";return U===Q.charCodeAt(o++)?(e.consume(U),o===Q.length?r.interrupt?t:V:w):n(U)}function C(U){return sn(U)?(e.consume(U),c=String.fromCharCode(U),b):n(U)}function b(U){if(U===null||U===47||U===62||vt(U)){const Q=U===47,ie=c.toLowerCase();return!Q&&!l&&t1.includes(ie)?(a=1,r.interrupt?t(U):V(U)):$3.includes(c.toLowerCase())?(a=6,Q?(e.consume(U),S):r.interrupt?t(U):V(U)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(U):l?x(U):y(U))}return U===45||en(U)?(e.consume(U),c+=String.fromCharCode(U),b):n(U)}function S(U){return U===62?(e.consume(U),r.interrupt?t:V):n(U)}function x(U){return qe(U)?(e.consume(U),x):I(U)}function y(U){return U===47?(e.consume(U),I):U===58||U===95||sn(U)?(e.consume(U),k):qe(U)?(e.consume(U),y):I(U)}function k(U){return U===45||U===46||U===58||U===95||en(U)?(e.consume(U),k):D(U)}function D(U){return U===61?(e.consume(U),T):qe(U)?(e.consume(U),D):y(U)}function T(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),u=U,R):qe(U)?(e.consume(U),T):N(U)}function R(U){return U===u?(e.consume(U),u=null,L):U===null||Re(U)?n(U):(e.consume(U),R)}function N(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||vt(U)?D(U):(e.consume(U),N)}function L(U){return U===47||U===62||qe(U)?y(U):n(U)}function I(U){return U===62?(e.consume(U),F):n(U)}function F(U){return U===null||Re(U)?V(U):qe(U)?(e.consume(U),F):n(U)}function V(U){return U===45&&a===2?(e.consume(U),G):U===60&&a===1?(e.consume(U),X):U===62&&a===4?(e.consume(U),j):U===63&&a===3?(e.consume(U),M):U===93&&a===5?(e.consume(U),O):Re(U)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(q3,$,H)(U)):U===null||Re(U)?(e.exit("htmlFlowData"),H(U)):(e.consume(U),V)}function H(U){return e.check(V3,z,$)(U)}function z(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),q}function q(U){return U===null||Re(U)?H(U):(e.enter("htmlFlowData"),V(U))}function G(U){return U===45?(e.consume(U),M):V(U)}function X(U){return U===47?(e.consume(U),c="",K):V(U)}function K(U){if(U===62){const Q=c.toLowerCase();return t1.includes(Q)?(e.consume(U),j):V(U)}return sn(U)&&c.length<8?(e.consume(U),c+=String.fromCharCode(U),K):V(U)}function O(U){return U===93?(e.consume(U),M):V(U)}function M(U){return U===62?(e.consume(U),j):U===45&&a===2?(e.consume(U),M):V(U)}function j(U){return U===null||Re(U)?(e.exit("htmlFlowData"),$(U)):(e.consume(U),j)}function $(U){return e.exit("htmlFlow"),t(U)}}function X3(e,t,n){const r=this;return a;function a(c){return Re(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):n(c)}function l(c){return r.parser.lazy[r.now().line]?n(c):t(c)}}function K3(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(el,t,n)}}const Z3={name:"htmlText",tokenize:Q3};function Q3(e,t,n){const r=this;let a,l,c;return o;function o(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),u}function u(M){return M===33?(e.consume(M),f):M===47?(e.consume(M),D):M===63?(e.consume(M),y):sn(M)?(e.consume(M),N):n(M)}function f(M){return M===45?(e.consume(M),g):M===91?(e.consume(M),l=0,w):sn(M)?(e.consume(M),x):n(M)}function g(M){return M===45?(e.consume(M),_):n(M)}function d(M){return M===null?n(M):M===45?(e.consume(M),m):Re(M)?(c=d,X(M)):(e.consume(M),d)}function m(M){return M===45?(e.consume(M),_):d(M)}function _(M){return M===62?G(M):M===45?m(M):d(M)}function w(M){const j="CDATA[";return M===j.charCodeAt(l++)?(e.consume(M),l===j.length?C:w):n(M)}function C(M){return M===null?n(M):M===93?(e.consume(M),b):Re(M)?(c=C,X(M)):(e.consume(M),C)}function b(M){return M===93?(e.consume(M),S):C(M)}function S(M){return M===62?G(M):M===93?(e.consume(M),S):C(M)}function x(M){return M===null||M===62?G(M):Re(M)?(c=x,X(M)):(e.consume(M),x)}function y(M){return M===null?n(M):M===63?(e.consume(M),k):Re(M)?(c=y,X(M)):(e.consume(M),y)}function k(M){return M===62?G(M):y(M)}function D(M){return sn(M)?(e.consume(M),T):n(M)}function T(M){return M===45||en(M)?(e.consume(M),T):R(M)}function R(M){return Re(M)?(c=R,X(M)):qe(M)?(e.consume(M),R):G(M)}function N(M){return M===45||en(M)?(e.consume(M),N):M===47||M===62||vt(M)?L(M):n(M)}function L(M){return M===47?(e.consume(M),G):M===58||M===95||sn(M)?(e.consume(M),I):Re(M)?(c=L,X(M)):qe(M)?(e.consume(M),L):G(M)}function I(M){return M===45||M===46||M===58||M===95||en(M)?(e.consume(M),I):F(M)}function F(M){return M===61?(e.consume(M),V):Re(M)?(c=F,X(M)):qe(M)?(e.consume(M),F):L(M)}function V(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),a=M,H):Re(M)?(c=V,X(M)):qe(M)?(e.consume(M),V):(e.consume(M),z)}function H(M){return M===a?(e.consume(M),a=void 0,q):M===null?n(M):Re(M)?(c=H,X(M)):(e.consume(M),H)}function z(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||vt(M)?L(M):(e.consume(M),z)}function q(M){return M===47||M===62||vt(M)?L(M):n(M)}function G(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function X(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),K}function K(M){return qe(M)?et(e,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):O(M)}function O(M){return e.enter("htmlTextData"),c(M)}}const Ag={name:"labelEnd",resolveAll:nD,resolveTo:iD,tokenize:rD},J3={tokenize:sD},eD={tokenize:aD},tD={tokenize:oD};function nD(e){let t=-1;const n=[];for(;++t=3&&(f===null||Re(f))?(e.exit("thematicBreak"),t(f)):n(f)}function u(f){return f===a?(e.consume(f),r++,u):(e.exit("thematicBreakSequence"),qe(f)?et(e,o,"whitespace")(f):o(f))}}const pn={continuation:{tokenize:_D},exit:yD,name:"list",tokenize:mD},pD={partial:!0,tokenize:bD},gD={partial:!0,tokenize:vD};function mD(e,t,n){const r=this,a=r.events[r.events.length-1];let l=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,c=0;return o;function o(_){const w=r.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||_===r.containerState.marker:Mp(_)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(su,n,f)(_):f(_);if(!r.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(_)}return n(_)}function u(_){return Mp(_)&&++c<10?(e.consume(_),u):(!r.interrupt||c<2)&&(r.containerState.marker?_===r.containerState.marker:_===41||_===46)?(e.exit("listItemValue"),f(_)):n(_)}function f(_){return e.enter("listItemMarker"),e.consume(_),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||_,e.check(el,r.interrupt?n:g,e.attempt(pD,m,d))}function g(_){return r.containerState.initialBlankLine=!0,l++,m(_)}function d(_){return qe(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),m):n(_)}function m(_){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(_)}}function _D(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(el,a,l);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,et(e,t,"listItemIndent",r.containerState.size+1)(o)}function l(o){return r.containerState.furtherBlankLines||!qe(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,c(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(gD,t,c)(o))}function c(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,et(e,e.attempt(pn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function vD(e,t,n){const r=this;return et(e,a,"listItemIndent",r.containerState.size+1);function a(l){const c=r.events[r.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===r.containerState.size?t(l):n(l)}}function yD(e){e.exit(this.containerState.type)}function bD(e,t,n){const r=this;return et(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(l){const c=r.events[r.events.length-1];return!qe(l)&&c&&c[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const n1={name:"setextUnderline",resolveTo:SD,tokenize:xD};function SD(e,t){let n=e.length,r,a,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const c={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(e.splice(a,0,["enter",c,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=c,e.push(["exit",c,t]),e}function xD(e,t,n){const r=this;let a;return l;function l(f){let g=r.events.length,d;for(;g--;)if(r.events[g][1].type!=="lineEnding"&&r.events[g][1].type!=="linePrefix"&&r.events[g][1].type!=="content"){d=r.events[g][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),a=f,c(f)):n(f)}function c(f){return e.enter("setextHeadingLineSequence"),o(f)}function o(f){return f===a?(e.consume(f),o):(e.exit("setextHeadingLineSequence"),qe(f)?et(e,u,"lineSuffix")(f):u(f))}function u(f){return f===null||Re(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const wD={tokenize:CD};function CD(e){const t=this,n=e.attempt(el,r,e.attempt(this.parser.constructs.flowInitial,a,et(e,e.attempt(this.parser.constructs.flow,a,e.attempt(N3,a)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const ED={resolveAll:vx()},kD=_x("string"),AD=_x("text");function _x(e){return{resolveAll:vx(e==="text"?TD:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],l=n.attempt(a,c,o);return c;function c(g){return f(g)?l(g):o(g)}function o(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),u}function u(g){return f(g)?(n.exit("data"),l(g)):(n.consume(g),u)}function f(g){if(g===null)return!0;const d=a[g];let m=-1;if(d)for(;++m-1){const o=c[0];typeof o=="string"?c[0]=o.slice(r):c.shift()}l>0&&c.push(e[a].slice(0,l))}return c}function PD(e,t){let n=-1;const r=[];let a;for(;++n0){const wt=Ee.tokenStack[Ee.tokenStack.length-1];(wt[1]||e1).call(Ee,void 0,wt[0])}for(Se.position={start:gr(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:gr(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},je=-1;++je0&&(r.className=["language-"+a[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function U5(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $5(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function G5(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=pa(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let c,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),c=e.footnoteOrder.length):c=l+1,o+=1,e.footnoteCounts.set(r,o);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,u);const f={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,f),e.applyData(t,f)}function q5(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function V5(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function mx(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),l=a[0];l&&l.type==="text"?l.value="["+l.value:a.unshift({type:"text",value:"["});const c=a[a.length-1];return c&&c.type==="text"?c.value+=r:a.push({type:"text",value:r}),a}function Y5(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return mx(e,t);const a={src:pa(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,l),e.applyData(t,l)}function W5(e,t){const n={src:pa(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function X5(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function K5(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return mx(e,t);const a={href:pa(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function Z5(e,t){const n={href:pa(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Q5(e,t,n){const r=e.all(t),a=n?J5(n):_x(t),l={},c=[];if(typeof t.checked=="boolean"){const g=r[0];let d;g&&g.type==="element"&&g.tagName==="p"?d=g:(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:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let o=-1;for(;++o0){const Ct=Ee.tokenStack[Ee.tokenStack.length-1];(Ct[1]||r1).call(Ee,void 0,Ct[0])}for(Se.position={start:gr(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:gr(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},je=-1;++je0&&(r.className=["language-"+a[0]]);let l={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function t5(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function n5(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function i5(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=pa(r.toLowerCase()),l=e.footnoteOrder.indexOf(r);let c,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),c=e.footnoteOrder.length):c=l+1,o+=1,e.footnoteCounts.set(r,o);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,u);const f={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,f),e.applyData(t,f)}function r5(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function s5(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Sx(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),l=a[0];l&&l.type==="text"?l.value="["+l.value:a.unshift({type:"text",value:"["});const c=a[a.length-1];return c&&c.type==="text"?c.value+=r:a.push({type:"text",value:r}),a}function a5(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Sx(e,t);const a={src:pa(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,l),e.applyData(t,l)}function o5(e,t){const n={src:pa(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function l5(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function c5(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Sx(e,t);const a={href:pa(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function u5(e,t){const n={href:pa(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function h5(e,t,n){const r=e.all(t),a=n?f5(n):xx(t),l={},c=[];if(typeof t.checked=="boolean"){const g=r[0];let d;g&&g.type==="element"&&g.tagName==="p"?d=g:(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:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let o=-1;for(;++o1}function e4(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=_g(t.children[1]),u=KS(t.children[t.children.length-1]);o&&u&&(c.position={start:o,end:u}),a.push(c)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)}function s4(e,t,n){const r=n?n.children:void 0,l=(r?r.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,o=c?c.length:t.children.length;let u=-1;const f=[];for(;++u0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return l.push(i1(t.slice(a),a>0,!1)),l.join("")}function i1(e,t,n){let r=0,a=e.length;if(t){let l=e.codePointAt(r);for(;l===t1||l===n1;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(a-1);for(;l===t1||l===n1;)a--,l=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function l4(e,t){const n={type:"text",value:o4(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function c4(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const u4={blockquote:H5,break:F5,code:P5,delete:U5,emphasis:$5,footnoteReference:G5,heading:q5,html:V5,imageReference:Y5,image:W5,inlineCode:X5,linkReference:K5,link:Z5,listItem:Q5,list:e4,paragraph:t4,root:n4,strong:i4,table:r4,tableCell:a4,tableRow:s4,text:l4,thematicBreak:c4,toml:Mc,yaml:Mc,definition:Mc,footnoteDefinition:Mc};function Mc(){}const vx=-1,Fu=0,Ao=1,mu=2,wg=3,Cg=4,Eg=5,kg=6,yx=7,bx=8,Sx=typeof self=="object"?self:globalThis,r1=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Sx[e](t)},h4=(e,t)=>{const n=(a,l)=>(e.set(l,a),a),r=a=>{if(e.has(a))return e.get(a);const[l,c]=t[a];switch(l){case Fu:case vx:return n(c,a);case Ao:{const o=n([],a);for(const u of c)o.push(r(u));return o}case mu:{const o=n({},a);for(const[u,f]of c)o[r(u)]=r(f);return o}case wg:return n(new Date(c),a);case Cg:{const{source:o,flags:u}=c;return n(new RegExp(o,u),a)}case Eg:{const o=n(new Map,a);for(const[u,f]of c)o.set(r(u),r(f));return o}case kg:{const o=n(new Set,a);for(const u of c)o.add(r(u));return o}case yx:{const{name:o,message:u}=c;return n(typeof Sx[o]=="function"?r1(o,u):new Error(u),a)}case bx:return n(BigInt(c),a);case"BigInt":return n(Object(BigInt(c)),a);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:o}=new Uint8Array(c);return n(new DataView(o),c)}}return n(r1(l,c),a)};return r},s1=e=>h4(new Map,e)(0),Gr="",{toString:f4}={},{keys:d4}=Object,yo=e=>{const t=typeof e;if(t!=="object"||!e)return[Fu,t];const n=f4.call(e).slice(8,-1);switch(n){case"Array":return[Ao,Gr];case"Object":return[mu,Gr];case"Date":return[wg,Gr];case"RegExp":return[Cg,Gr];case"Map":return[Eg,Gr];case"Set":return[kg,Gr];case"DataView":return[Ao,n]}return n.includes("Array")?[Ao,n]:e instanceof Error?[yx,e.name||"Error"]:[mu,n]},Lc=([e,t])=>e===Fu&&(t==="function"||t==="symbol"),p4=(e,t,n,r)=>{const a=(c,o)=>{const u=r.push(c)-1;return n.set(o,u),u},l=c=>{if(n.has(c))return n.get(c);let[o,u]=yo(c);switch(o){case Fu:{let g=c;switch(u){case"bigint":o=bx,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);g=null;break;case"undefined":return a([vx],c)}return a([o,g],c)}case Ao:{if(u){let m=c;return u==="DataView"?m=new Uint8Array(c.buffer):u==="ArrayBuffer"&&(m=new Uint8Array(c)),a([u,[...m]],c)}const g=[],d=a([o,g],c);for(const m of c)g.push(l(m));return d}case mu:{if(u)switch(u){case"BigInt":return a([u,c.toString()],c);case"Boolean":case"Number":case"String":return a([u,c.valueOf()],c)}if(t&&"toJSON"in c)return l(c.toJSON());const g=[],d=a([o,g],c);for(const m of d4(c))(e||!Lc(yo(c[m])))&&g.push([l(m),l(c[m])]);return d}case wg:return a([o,isNaN(c.getTime())?Gr:c.toISOString()],c);case Cg:{const{source:g,flags:d}=c;return a([o,{source:g,flags:d}],c)}case Eg:{const g=[],d=a([o,g],c);for(const[m,_]of c)(e||!(Lc(yo(m))||Lc(yo(_))))&&g.push([l(m),l(_)]);return d}case kg:{const g=[],d=a([o,g],c);for(const m of c)(e||!Lc(yo(m)))&&g.push(l(m));return d}}const{message:f}=c;return a([o,{name:u,message:f}],c)};return l},a1=(e,{json:t,lossy:n}={})=>{const r=[];return p4(!(t||n),!!t,new Map,r)(e),r},_u=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?s1(a1(e,t)):structuredClone(e):(e,t)=>s1(a1(e,t));function g4(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function m4(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function _4(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||g4,r=e.options.footnoteBackLabel||m4,a=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let u=-1;for(;++u0&&w.push({type:"text",value:" "});let x=typeof n=="string"?n:n(u,_);typeof x=="string"&&(x={type:"text",value:x}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(_>1?"-"+_:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,_),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const y=g[g.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const x=y.children[y.children.length-1];x&&x.type==="text"?x.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...w)}else g.push(...w);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(g,!0)};e.patch(f,b),o.push(b)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{..._u(c),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:` +`});const f={type:"element",tagName:"li",properties:l,children:c};return e.patch(t,f),e.applyData(t,f)}function f5(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r1}function d5(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=xg(t.children[1]),u=tx(t.children[t.children.length-1]);o&&u&&(c.position={start:o,end:u}),a.push(c)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)}function v5(e,t,n){const r=n?n.children:void 0,l=(r?r.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,o=c?c.length:t.children.length;let u=-1;const f=[];for(;++u0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return l.push(o1(t.slice(a),a>0,!1)),l.join("")}function o1(e,t,n){let r=0,a=e.length;if(t){let l=e.codePointAt(r);for(;l===s1||l===a1;)r++,l=e.codePointAt(r)}if(n){let l=e.codePointAt(a-1);for(;l===s1||l===a1;)a--,l=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function S5(e,t){const n={type:"text",value:b5(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function x5(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const w5={blockquote:QD,break:JD,code:e5,delete:t5,emphasis:n5,footnoteReference:i5,heading:r5,html:s5,imageReference:a5,image:o5,inlineCode:l5,linkReference:c5,link:u5,listItem:h5,list:d5,paragraph:p5,root:g5,strong:m5,table:_5,tableCell:y5,tableRow:v5,text:S5,thematicBreak:x5,toml:jc,yaml:jc,definition:jc,footnoteDefinition:jc};function jc(){}const wx=-1,$u=0,To=1,yu=2,Tg=3,Ng=4,Dg=5,Rg=6,Cx=7,Ex=8,kx=typeof self=="object"?self:globalThis,l1=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new kx[e](t)},C5=(e,t)=>{const n=(a,l)=>(e.set(l,a),a),r=a=>{if(e.has(a))return e.get(a);const[l,c]=t[a];switch(l){case $u:case wx:return n(c,a);case To:{const o=n([],a);for(const u of c)o.push(r(u));return o}case yu:{const o=n({},a);for(const[u,f]of c)o[r(u)]=r(f);return o}case Tg:return n(new Date(c),a);case Ng:{const{source:o,flags:u}=c;return n(new RegExp(o,u),a)}case Dg:{const o=n(new Map,a);for(const[u,f]of c)o.set(r(u),r(f));return o}case Rg:{const o=n(new Set,a);for(const u of c)o.add(r(u));return o}case Cx:{const{name:o,message:u}=c;return n(typeof kx[o]=="function"?l1(o,u):new Error(u),a)}case Ex:return n(BigInt(c),a);case"BigInt":return n(Object(BigInt(c)),a);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:o}=new Uint8Array(c);return n(new DataView(o),c)}}return n(l1(l,c),a)};return r},c1=e=>C5(new Map,e)(0),Gr="",{toString:E5}={},{keys:k5}=Object,yo=e=>{const t=typeof e;if(t!=="object"||!e)return[$u,t];const n=E5.call(e).slice(8,-1);switch(n){case"Array":return[To,Gr];case"Object":return[yu,Gr];case"Date":return[Tg,Gr];case"RegExp":return[Ng,Gr];case"Map":return[Dg,Gr];case"Set":return[Rg,Gr];case"DataView":return[To,n]}return n.includes("Array")?[To,n]:e instanceof Error?[Cx,e.name||"Error"]:[yu,n]},Bc=([e,t])=>e===$u&&(t==="function"||t==="symbol"),A5=(e,t,n,r)=>{const a=(c,o)=>{const u=r.push(c)-1;return n.set(o,u),u},l=c=>{if(n.has(c))return n.get(c);let[o,u]=yo(c);switch(o){case $u:{let g=c;switch(u){case"bigint":o=Ex,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);g=null;break;case"undefined":return a([wx],c)}return a([o,g],c)}case To:{if(u){let m=c;return u==="DataView"?m=new Uint8Array(c.buffer):u==="ArrayBuffer"&&(m=new Uint8Array(c)),a([u,[...m]],c)}const g=[],d=a([o,g],c);for(const m of c)g.push(l(m));return d}case yu:{if(u)switch(u){case"BigInt":return a([u,c.toString()],c);case"Boolean":case"Number":case"String":return a([u,c.valueOf()],c)}if(t&&"toJSON"in c)return l(c.toJSON());const g=[],d=a([o,g],c);for(const m of k5(c))(e||!Bc(yo(c[m])))&&g.push([l(m),l(c[m])]);return d}case Tg:return a([o,isNaN(c.getTime())?Gr:c.toISOString()],c);case Ng:{const{source:g,flags:d}=c;return a([o,{source:g,flags:d}],c)}case Dg:{const g=[],d=a([o,g],c);for(const[m,_]of c)(e||!(Bc(yo(m))||Bc(yo(_))))&&g.push([l(m),l(_)]);return d}case Rg:{const g=[],d=a([o,g],c);for(const m of c)(e||!Bc(yo(m)))&&g.push(l(m));return d}}const{message:f}=c;return a([o,{name:u,message:f}],c)};return l},u1=(e,{json:t,lossy:n}={})=>{const r=[];return A5(!(t||n),!!t,new Map,r)(e),r},bu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?c1(u1(e,t)):structuredClone(e):(e,t)=>c1(u1(e,t));function T5(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function N5(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function D5(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||T5,r=e.options.footnoteBackLabel||N5,a=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let u=-1;for(;++u0&&w.push({type:"text",value:" "});let x=typeof n=="string"?n:n(u,_);typeof x=="string"&&(x={type:"text",value:x}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(_>1?"-"+_:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,_),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const b=g[g.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const x=b.children[b.children.length-1];x&&x.type==="text"?x.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...w)}else g.push(...w);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(g,!0)};e.patch(f,S),o.push(S)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...bu(c),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:` -`}]}}const Pu=(function(e){if(e==null)return S4;if(typeof e=="function")return Uu(e);if(typeof e=="object")return Array.isArray(e)?v4(e):y4(e);if(typeof e=="string")return b4(e);throw new Error("Expected function, string, or object as test")});function v4(e){const t=[];let n=-1;for(;++n":""))+")"})}return m;function m(){let _=xx,w,C,y;if((!t||l(u,f,g[g.length-1]||void 0))&&(_=E4(n(u,g)),_[0]===Np))return _;if("children"in u&&u.children){const b=u;if(b.children&&_[0]!==C4)for(C=(r?b.children.length:-1)+c,y=g.concat(b);C>-1&&C":""))+")"})}return m;function m(){let _=Ax,w,C,b;if((!t||l(u,f,g[g.length-1]||void 0))&&(_=z5(n(u,g)),_[0]===Op))return _;if("children"in u&&u.children){const S=u;if(S.children&&_[0]!==I5)for(C=(r?S.children.length:-1)+c,b=g.concat(S);C>-1&&C0&&n.push({type:"text",value:` -`}),n}function o1(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function l1(e,t){const n=A4(e,t),r=n.one(e,void 0),a=_4(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&l.children.push({type:"text",value:` -`},a),l}function M4(e,t){return e&&"run"in e?async function(n,r){const a=l1(n,{file:r,...t});await e.run(a,r)}:function(n,r){return l1(n,{file:r,...e||t})}}function c1(e){if(e)throw e}var $d,u1;function L4(){if(u1)return $d;u1=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},l=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var g=e.call(f,"constructor"),d=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!g&&!d)return!1;var m;for(m in f);return typeof m>"u"||e.call(f,m)},c=function(f,g){n&&g.name==="__proto__"?n(f,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):f[g.name]=g.newValue},o=function(f,g){if(g==="__proto__")if(e.call(f,g)){if(r)return r(f,g).value}else return;return f[g]};return $d=function u(){var f,g,d,m,_,w,C=arguments[0],y=1,b=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},y=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});yc.length;let u;o&&c.push(a);try{u=e.apply(this,c)}catch(f){const g=f;if(o&&n)throw g;return a(g)}o||(u&&u.then&&typeof u.then=="function"?u.then(l,a):u instanceof Error?a(u):l(u))}function a(c,...o){n||(n=!0,t(c,...o))}function l(c){a(null,c)}}const ii={basename:I4,dirname:z4,extname:H4,join:F4,sep:"/"};function I4(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Jo(e);let n=0,r=-1,a=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else r<0&&(l=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let c=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else c<0&&(l=!0,c=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=c));return n===r?r=c:r<0&&(r=e.length),e.slice(n,r)}function z4(e){if(Jo(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function H4(e){Jo(e);let t=e.length,n=-1,r=0,a=-1,l=0,c;for(;t--;){const o=e.codePointAt(t);if(o===47){if(c){r=t+1;break}continue}n<0&&(c=!0,n=t+1),o===46?a<0?a=t:l!==1&&(l=1):a>-1&&(l=-1)}return a<0||n<0||l===0||l===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function F4(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function U4(e,t){let n="",r=0,a=-1,l=0,c=-1,o,u;for(;++c<=e.length;){if(c2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),a=c,l=0;continue}}else if(n.length>0){n="",r=0,a=c,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,c):n=e.slice(a+1,c),r=c-a-1;a=c,l=0}else o===46&&l>-1?l++:l=-1}return n}function Jo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const $4={cwd:G4};function G4(){return"/"}function Mp(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function q4(e){if(typeof e=="string")e=new URL(e);else if(!Mp(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return V4(e)}function V4(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 t=e.pathname;let n=-1;for(;++n0){let[_,...w]=g;const C=r[m][1];Rp(C)&&Rp(_)&&(_=Gd(!0,C,_)),r[m]=[f,_,...w]}}}}const K4=new Tg().freeze();function Wd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Xd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Kd(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function f1(e){if(!Rp(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function d1(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Oc(e){return Z4(e)?e:new Cx(e)}function Z4(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Q4(e){return typeof e=="string"||J4(e)}function J4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const eD="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",p1=[],g1={allowDangerousHtml:!0},tD=/^(https?|ircs?|mailto|xmpp)$/i,nD=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ex(e){const t=iD(e),n=rD(e);return sD(t.runSync(t.parse(n),n),e)}function iD(e){const t=e.rehypePlugins||p1,n=e.remarkPlugins||p1,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...g1}:g1;return K4().use(z5).use(n).use(M4,r).use(t)}function rD(e){const t=e.children||"",n=new Cx;return typeof t=="string"&&(n.value=t),n}function sD(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,l=t.disallowedElements,c=t.skipHtml,o=t.unwrapDisallowed,u=t.urlTransform||aD;for(const g of nD)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+eD+g.id,void 0);return Ag(e,f),S3(e,{Fragment:S.Fragment,components:a,ignoreInvalidStyle:!0,jsx:S.jsx,jsxs:S.jsxs,passKeys:!0,passNode:!0});function f(g,d,m){if(g.type==="raw"&&m&&typeof d=="number")return c?m.children.splice(d,1):m.children[d]={type:"text",value:g.value},d;if(g.type==="element"){let _;for(_ in Fd)if(Object.hasOwn(Fd,_)&&Object.hasOwn(g.properties,_)){const w=g.properties[_],C=Fd[_];(C===null||C.includes(g.tagName))&&(g.properties[_]=u(String(w||""),_,g))}}if(g.type==="element"){let _=n?!n.includes(g.tagName):l?l.includes(g.tagName):!1;if(!_&&r&&typeof d=="number"&&(_=!r(g,d,m)),_&&m&&typeof d=="number")return o&&g.children?m.children.splice(d,1,...g.children):m.children.splice(d,1),d}}}function aD(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||tD.test(e.slice(0,t))?e:""}function m1(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function oD(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function lD(e,t,n){const a=Pu((n||{}).ignore||[]),l=cD(t);let c=-1;for(;++c0?{type:"text",value:T}:void 0),T===!1?m.lastIndex=k+1:(w!==k&&x.push({type:"text",value:f.value.slice(w,k)}),Array.isArray(T)?x.push(...T):T&&x.push(T),w=k+v[0].length,b=!0),!m.global)break;v=m.exec(f.value)}return b?(w?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=m1(e,"(");let l=m1(e,")");for(;r!==-1&&a>l;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),l++;return[e,n]}function kx(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Zr(n)||zu(n))&&(!t||n!==47)}Ax.peek=MD;function CD(){this.buffer()}function ED(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function kD(){this.buffer()}function AD(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function TD(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function ND(e){this.exit(e)}function DD(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function RD(e){this.exit(e)}function MD(){return"["}function Ax(e,t,n,r){const a=n.createTracker(r);let l=a.move("[^");const c=n.enter("footnoteReference"),o=n.enter("reference");return l+=a.move(n.safe(n.associationId(e),{after:"]",before:l})),o(),c(),l+=a.move("]"),l}function LD(){return{enter:{gfmFootnoteCallString:CD,gfmFootnoteCall:ED,gfmFootnoteDefinitionLabelString:kD,gfmFootnoteDefinition:AD},exit:{gfmFootnoteCallString:TD,gfmFootnoteCall:ND,gfmFootnoteDefinitionLabelString:DD,gfmFootnoteDefinition:RD}}}function OD(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Ax},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,l,c){const o=l.createTracker(c);let u=o.move("[^");const f=l.enter("footnoteDefinition"),g=l.enter("label");return u+=o.move(l.safe(l.associationId(r),{before:u,after:"]"})),g(),u+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),u+=o.move((t?` -`:" ")+l.indentLines(l.containerFlow(r,o.current()),t?Tx:jD))),f(),u}}function jD(e,t,n){return t===0?e:Tx(e,t,n)}function Tx(e,t,n){return(n?"":" ")+e}const BD=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Nx.peek=PD;function ID(){return{canContainEols:["delete"],enter:{strikethrough:HD},exit:{strikethrough:FD}}}function zD(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:BD}],handlers:{delete:Nx}}}function HD(e){this.enter({type:"delete",children:[]},e)}function FD(e){this.exit(e)}function Nx(e,t,n,r){const a=n.createTracker(r),l=n.enter("strikethrough");let c=a.move("~~");return c+=n.containerPhrasing(e,{...a.current(),before:c,after:"~"}),c+=a.move("~~"),l(),c}function PD(){return"~"}function UD(e){return e.length}function $D(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||UD,l=[],c=[],o=[],u=[];let f=0,g=-1;for(;++gf&&(f=e[g].length);++bu[b])&&(u[b]=v)}C.push(x)}c[g]=C,o[g]=y}let d=-1;if(typeof r=="object"&&"length"in r)for(;++du[d]&&(u[d]=x),_[d]=x),m[d]=v}c.splice(1,0,m),o.splice(1,0,_),g=-1;const w=[];for(;++g "),l.shift(2);const c=n.indentLines(n.containerFlow(e,l.current()),VD);return a(),c}function VD(e,t,n){return">"+(n?"":" ")+e}function YD(e,t){return v1(e,t.inConstruct,!0)&&!v1(e,t.notInConstruct,!1)}function v1(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++rc&&(c=l):l=1,a=r+t.length,r=n.indexOf(t,a);return c}function XD(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function KD(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function ZD(e,t,n,r){const a=KD(n),l=e.value||"",c=a==="`"?"GraveAccent":"Tilde";if(XD(e,n)){const d=n.enter("codeIndented"),m=n.indentLines(l,QD);return d(),m}const o=n.createTracker(r),u=a.repeat(Math.max(WD(l,a)+1,3)),f=n.enter("codeFenced");let g=o.move(u);if(e.lang){const d=n.enter(`codeFencedLang${c}`);g+=o.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...o.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${c}`);g+=o.move(" "),g+=o.move(n.safe(e.meta,{before:g,after:` +`}),n}function h1(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function f1(e,t){const n=F5(e,t),r=n.one(e,void 0),a=D5(n),l=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&l.children.push({type:"text",value:` +`},a),l}function q5(e,t){return e&&"run"in e?async function(n,r){const a=f1(n,{file:r,...t});await e.run(a,r)}:function(n,r){return f1(n,{file:r,...e||t})}}function d1(e){if(e)throw e}var Yd,p1;function V5(){if(p1)return Yd;p1=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},l=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var g=e.call(f,"constructor"),d=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!g&&!d)return!1;var m;for(m in f);return typeof m>"u"||e.call(f,m)},c=function(f,g){n&&g.name==="__proto__"?n(f,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):f[g.name]=g.newValue},o=function(f,g){if(g==="__proto__")if(e.call(f,g)){if(r)return r(f,g).value}else return;return f[g]};return Yd=function u(){var f,g,d,m,_,w,C=arguments[0],b=1,S=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},b=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});bc.length;let u;o&&c.push(a);try{u=e.apply(this,c)}catch(f){const g=f;if(o&&n)throw g;return a(g)}o||(u&&u.then&&typeof u.then=="function"?u.then(l,a):u instanceof Error?a(u):l(u))}function a(c,...o){n||(n=!0,t(c,...o))}function l(c){a(null,c)}}const si={basename:K5,dirname:Z5,extname:Q5,join:J5,sep:"/"};function K5(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');tl(e);let n=0,r=-1,a=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else r<0&&(l=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let c=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else c<0&&(l=!0,c=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=c));return n===r?r=c:r<0&&(r=e.length),e.slice(n,r)}function Z5(e){if(tl(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Q5(e){tl(e);let t=e.length,n=-1,r=0,a=-1,l=0,c;for(;t--;){const o=e.codePointAt(t);if(o===47){if(c){r=t+1;break}continue}n<0&&(c=!0,n=t+1),o===46?a<0?a=t:l!==1&&(l=1):a>-1&&(l=-1)}return a<0||n<0||l===0||l===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function J5(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function tR(e,t){let n="",r=0,a=-1,l=0,c=-1,o,u;for(;++c<=e.length;){if(c2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),a=c,l=0;continue}}else if(n.length>0){n="",r=0,a=c,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,c):n=e.slice(a+1,c),r=c-a-1;a=c,l=0}else o===46&&l>-1?l++:l=-1}return n}function tl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const nR={cwd:iR};function iR(){return"/"}function Ip(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function rR(e){if(typeof e=="string")e=new URL(e);else if(!Ip(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return sR(e)}function sR(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 t=e.pathname;let n=-1;for(;++n0){let[_,...w]=g;const C=r[m][1];Bp(C)&&Bp(_)&&(_=Wd(!0,C,_)),r[m]=[f,_,...w]}}}}const cR=new Lg().freeze();function Qd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Jd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ep(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function m1(e){if(!Bp(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function _1(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Ic(e){return uR(e)?e:new Nx(e)}function uR(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function hR(e){return typeof e=="string"||fR(e)}function fR(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dR="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",v1=[],y1={allowDangerousHtml:!0},pR=/^(https?|ircs?|mailto|xmpp)$/i,gR=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Dx(e){const t=mR(e),n=_R(e);return vR(t.runSync(t.parse(n),n),e)}function mR(e){const t=e.rehypePlugins||v1,n=e.remarkPlugins||v1,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...y1}:y1;return cR().use(ZD).use(n).use(q5,r).use(t)}function _R(e){const t=e.children||"",n=new Nx;return typeof t=="string"&&(n.value=t),n}function vR(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,l=t.disallowedElements,c=t.skipHtml,o=t.unwrapDisallowed,u=t.urlTransform||yR;for(const g of gR)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+dR+g.id,void 0);return Mg(e,f),ON(e,{Fragment:v.Fragment,components:a,ignoreInvalidStyle:!0,jsx:v.jsx,jsxs:v.jsxs,passKeys:!0,passNode:!0});function f(g,d,m){if(g.type==="raw"&&m&&typeof d=="number")return c?m.children.splice(d,1):m.children[d]={type:"text",value:g.value},d;if(g.type==="element"){let _;for(_ in Gd)if(Object.hasOwn(Gd,_)&&Object.hasOwn(g.properties,_)){const w=g.properties[_],C=Gd[_];(C===null||C.includes(g.tagName))&&(g.properties[_]=u(String(w||""),_,g))}}if(g.type==="element"){let _=n?!n.includes(g.tagName):l?l.includes(g.tagName):!1;if(!_&&r&&typeof d=="number"&&(_=!r(g,d,m)),_&&m&&typeof d=="number")return o&&g.children?m.children.splice(d,1,...g.children):m.children.splice(d,1),d}}}function yR(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||pR.test(e.slice(0,t))?e:""}function b1(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function bR(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function SR(e,t,n){const a=Gu((n||{}).ignore||[]),l=xR(t);let c=-1;for(;++c0?{type:"text",value:T}:void 0),T===!1?m.lastIndex=k+1:(w!==k&&x.push({type:"text",value:f.value.slice(w,k)}),Array.isArray(T)?x.push(...T):T&&x.push(T),w=k+y[0].length,S=!0),!m.global)break;y=m.exec(f.value)}return S?(w?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=b1(e,"(");let l=b1(e,")");for(;r!==-1&&a>l;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),l++;return[e,n]}function Rx(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Zr(n)||Pu(n))&&(!t||n!==47)}Mx.peek=qR;function IR(){this.buffer()}function zR(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function HR(){this.buffer()}function FR(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function PR(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Zn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function UR(e){this.exit(e)}function $R(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Zn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function GR(e){this.exit(e)}function qR(){return"["}function Mx(e,t,n,r){const a=n.createTracker(r);let l=a.move("[^");const c=n.enter("footnoteReference"),o=n.enter("reference");return l+=a.move(n.safe(n.associationId(e),{after:"]",before:l})),o(),c(),l+=a.move("]"),l}function VR(){return{enter:{gfmFootnoteCallString:IR,gfmFootnoteCall:zR,gfmFootnoteDefinitionLabelString:HR,gfmFootnoteDefinition:FR},exit:{gfmFootnoteCallString:PR,gfmFootnoteCall:UR,gfmFootnoteDefinitionLabelString:$R,gfmFootnoteDefinition:GR}}}function YR(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Mx},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,l,c){const o=l.createTracker(c);let u=o.move("[^");const f=l.enter("footnoteDefinition"),g=l.enter("label");return u+=o.move(l.safe(l.associationId(r),{before:u,after:"]"})),g(),u+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),u+=o.move((t?` +`:" ")+l.indentLines(l.containerFlow(r,o.current()),t?Lx:WR))),f(),u}}function WR(e,t,n){return t===0?e:Lx(e,t,n)}function Lx(e,t,n){return(n?"":" ")+e}const XR=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Ox.peek=e4;function KR(){return{canContainEols:["delete"],enter:{strikethrough:QR},exit:{strikethrough:JR}}}function ZR(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:XR}],handlers:{delete:Ox}}}function QR(e){this.enter({type:"delete",children:[]},e)}function JR(e){this.exit(e)}function Ox(e,t,n,r){const a=n.createTracker(r),l=n.enter("strikethrough");let c=a.move("~~");return c+=n.containerPhrasing(e,{...a.current(),before:c,after:"~"}),c+=a.move("~~"),l(),c}function e4(){return"~"}function t4(e){return e.length}function n4(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||t4,l=[],c=[],o=[],u=[];let f=0,g=-1;for(;++gf&&(f=e[g].length);++Su[S])&&(u[S]=y)}C.push(x)}c[g]=C,o[g]=b}let d=-1;if(typeof r=="object"&&"length"in r)for(;++du[d]&&(u[d]=x),_[d]=x),m[d]=y}c.splice(1,0,m),o.splice(1,0,_),g=-1;const w=[];for(;++g "),l.shift(2);const c=n.indentLines(n.containerFlow(e,l.current()),s4);return a(),c}function s4(e,t,n){return">"+(n?"":" ")+e}function a4(e,t){return x1(e,t.inConstruct,!0)&&!x1(e,t.notInConstruct,!1)}function x1(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++rc&&(c=l):l=1,a=r+t.length,r=n.indexOf(t,a);return c}function l4(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function c4(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function u4(e,t,n,r){const a=c4(n),l=e.value||"",c=a==="`"?"GraveAccent":"Tilde";if(l4(e,n)){const d=n.enter("codeIndented"),m=n.indentLines(l,h4);return d(),m}const o=n.createTracker(r),u=a.repeat(Math.max(o4(l,a)+1,3)),f=n.enter("codeFenced");let g=o.move(u);if(e.lang){const d=n.enter(`codeFencedLang${c}`);g+=o.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...o.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${c}`);g+=o.move(" "),g+=o.move(n.safe(e.meta,{before:g,after:` `,encode:["`"],...o.current()})),d()}return g+=o.move(` `),l&&(g+=o.move(l+` -`)),g+=o.move(u),f(),g}function QD(e,t,n){return(n?"":" ")+e}function Ng(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function JD(e,t,n,r){const a=Ng(n),l=a==='"'?"Quote":"Apostrophe",c=n.enter("definition");let o=n.enter("label");const u=n.createTracker(r);let f=u.move("[");return f+=u.move(n.safe(n.associationId(e),{before:f,after:"]",...u.current()})),f+=u.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),f+=u.move("<"),f+=u.move(n.safe(e.url,{before:f,after:">",...u.current()})),f+=u.move(">")):(o=n.enter("destinationRaw"),f+=u.move(n.safe(e.url,{before:f,after:e.title?" ":` -`,...u.current()}))),o(),e.title&&(o=n.enter(`title${l}`),f+=u.move(" "+a),f+=u.move(n.safe(e.title,{before:f,after:a,...u.current()})),f+=u.move(a),o()),c(),f}function eR(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function jo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function vu(e,t,n){const r=ia(e),a=ia(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Dx.peek=tR;function Dx(e,t,n,r){const a=eR(n),l=n.enter("emphasis"),c=n.createTracker(r),o=c.move(a);let u=c.move(n.containerPhrasing(e,{after:a,before:o,...c.current()}));const f=u.charCodeAt(0),g=vu(r.before.charCodeAt(r.before.length-1),f,a);g.inside&&(u=jo(f)+u.slice(1));const d=u.charCodeAt(u.length-1),m=vu(r.after.charCodeAt(0),d,a);m.inside&&(u=u.slice(0,-1)+jo(d));const _=c.move(a);return l(),n.attentionEncodeSurroundingInfo={after:m.outside,before:g.outside},o+u+_}function tR(e,t,n){return n.options.emphasis||"*"}function nR(e,t){let n=!1;return Ag(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Np}),!!((!e.depth||e.depth<3)&&Sg(e)&&(t.options.setext||n))}function iR(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);if(nR(e,n)){const g=n.enter("headingSetext"),d=n.enter("phrasing"),m=n.containerPhrasing(e,{...l.current(),before:` +`)),g+=o.move(u),f(),g}function h4(e,t,n){return(n?"":" ")+e}function Og(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function f4(e,t,n,r){const a=Og(n),l=a==='"'?"Quote":"Apostrophe",c=n.enter("definition");let o=n.enter("label");const u=n.createTracker(r);let f=u.move("[");return f+=u.move(n.safe(n.associationId(e),{before:f,after:"]",...u.current()})),f+=u.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),f+=u.move("<"),f+=u.move(n.safe(e.url,{before:f,after:">",...u.current()})),f+=u.move(">")):(o=n.enter("destinationRaw"),f+=u.move(n.safe(e.url,{before:f,after:e.title?" ":` +`,...u.current()}))),o(),e.title&&(o=n.enter(`title${l}`),f+=u.move(" "+a),f+=u.move(n.safe(e.title,{before:f,after:a,...u.current()})),f+=u.move(a),o()),c(),f}function d4(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Io(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Su(e,t,n){const r=ia(e),a=ia(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}jx.peek=p4;function jx(e,t,n,r){const a=d4(n),l=n.enter("emphasis"),c=n.createTracker(r),o=c.move(a);let u=c.move(n.containerPhrasing(e,{after:a,before:o,...c.current()}));const f=u.charCodeAt(0),g=Su(r.before.charCodeAt(r.before.length-1),f,a);g.inside&&(u=Io(f)+u.slice(1));const d=u.charCodeAt(u.length-1),m=Su(r.after.charCodeAt(0),d,a);m.inside&&(u=u.slice(0,-1)+Io(d));const _=c.move(a);return l(),n.attentionEncodeSurroundingInfo={after:m.outside,before:g.outside},o+u+_}function p4(e,t,n){return n.options.emphasis||"*"}function g4(e,t){let n=!1;return Mg(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Op}),!!((!e.depth||e.depth<3)&&kg(e)&&(t.options.setext||n))}function m4(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),l=n.createTracker(r);if(g4(e,n)){const g=n.enter("headingSetext"),d=n.enter("phrasing"),m=n.containerPhrasing(e,{...l.current(),before:` `,after:` `});return d(),g(),m+` `+(a===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(` `))+1))}const c="#".repeat(a),o=n.enter("headingAtx"),u=n.enter("phrasing");l.move(c+" ");let f=n.containerPhrasing(e,{before:"# ",after:` -`,...l.current()});return/^[\t ]/.test(f)&&(f=jo(f.charCodeAt(0))+f.slice(1)),f=f?c+" "+f:c,n.options.closeAtx&&(f+=" "+c),u(),o(),f}Rx.peek=rR;function Rx(e){return e.value||""}function rR(){return"<"}Mx.peek=sR;function Mx(e,t,n,r){const a=Ng(n),l=a==='"'?"Quote":"Apostrophe",c=n.enter("image");let o=n.enter("label");const u=n.createTracker(r);let f=u.move("![");return f+=u.move(n.safe(e.alt,{before:f,after:"]",...u.current()})),f+=u.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),f+=u.move("<"),f+=u.move(n.safe(e.url,{before:f,after:">",...u.current()})),f+=u.move(">")):(o=n.enter("destinationRaw"),f+=u.move(n.safe(e.url,{before:f,after:e.title?" ":")",...u.current()}))),o(),e.title&&(o=n.enter(`title${l}`),f+=u.move(" "+a),f+=u.move(n.safe(e.title,{before:f,after:a,...u.current()})),f+=u.move(a),o()),f+=u.move(")"),c(),f}function sR(){return"!"}Lx.peek=aR;function Lx(e,t,n,r){const a=e.referenceType,l=n.enter("imageReference");let c=n.enter("label");const o=n.createTracker(r);let u=o.move("![");const f=n.safe(e.alt,{before:u,after:"]",...o.current()});u+=o.move(f+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const d=n.safe(n.associationId(e),{before:u,after:"]",...o.current()});return c(),n.stack=g,l(),a==="full"||!f||f!==d?u+=o.move(d+"]"):a==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function aR(){return"!"}Ox.peek=oR;function Ox(e,t,n){let r=e.value||"",a="`",l=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l\u007F]/.test(e.url))}Bx.peek=lR;function Bx(e,t,n,r){const a=Ng(n),l=a==='"'?"Quote":"Apostrophe",c=n.createTracker(r);let o,u;if(jx(e,n)){const g=n.stack;n.stack=[],o=n.enter("autolink");let d=c.move("<");return d+=c.move(n.containerPhrasing(e,{before:d,after:">",...c.current()})),d+=c.move(">"),o(),n.stack=g,d}o=n.enter("link"),u=n.enter("label");let f=c.move("[");return f+=c.move(n.containerPhrasing(e,{before:f,after:"](",...c.current()})),f+=c.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(u=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),u(),e.title&&(u=n.enter(`title${l}`),f+=c.move(" "+a),f+=c.move(n.safe(e.title,{before:f,after:a,...c.current()})),f+=c.move(a),u()),f+=c.move(")"),o(),f}function lR(e,t,n){return jx(e,n)?"<":"["}Ix.peek=cR;function Ix(e,t,n,r){const a=e.referenceType,l=n.enter("linkReference");let c=n.enter("label");const o=n.createTracker(r);let u=o.move("[");const f=n.containerPhrasing(e,{before:u,after:"]",...o.current()});u+=o.move(f+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const d=n.safe(n.associationId(e),{before:u,after:"]",...o.current()});return c(),n.stack=g,l(),a==="full"||!f||f!==d?u+=o.move(d+"]"):a==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function cR(){return"["}function Dg(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function uR(e){const t=Dg(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function hR(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function zx(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function fR(e,t,n,r){const a=n.enter("list"),l=n.bulletCurrent;let c=e.ordered?hR(n):Dg(n);const o=e.ordered?c==="."?")":".":uR(n);let u=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),zx(n)===c&&g){let d=-1;for(;++d-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let c=l.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const o=n.createTracker(r);o.move(l+" ".repeat(c-l.length)),o.shift(c);const u=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,o.current()),g);return u(),f;function g(d,m,_){return m?(_?"":" ".repeat(c))+d:(_?l:l+" ".repeat(c-l.length))+d}}function gR(e,t,n,r){const a=n.enter("paragraph"),l=n.enter("phrasing"),c=n.containerPhrasing(e,r);return l(),a(),c}const mR=Pu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function _R(e,t,n,r){return(e.children.some(function(c){return mR(c)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function vR(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Hx.peek=yR;function Hx(e,t,n,r){const a=vR(n),l=n.enter("strong"),c=n.createTracker(r),o=c.move(a+a);let u=c.move(n.containerPhrasing(e,{after:a,before:o,...c.current()}));const f=u.charCodeAt(0),g=vu(r.before.charCodeAt(r.before.length-1),f,a);g.inside&&(u=jo(f)+u.slice(1));const d=u.charCodeAt(u.length-1),m=vu(r.after.charCodeAt(0),d,a);m.inside&&(u=u.slice(0,-1)+jo(d));const _=c.move(a+a);return l(),n.attentionEncodeSurroundingInfo={after:m.outside,before:g.outside},o+u+_}function yR(e,t,n){return n.options.strong||"*"}function bR(e,t,n,r){return n.safe(e.value,r)}function SR(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function xR(e,t,n){const r=(zx(n)+(n.options.ruleSpaces?" ":"")).repeat(SR(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Fx={blockquote:qD,break:y1,code:ZD,definition:JD,emphasis:Dx,hardBreak:y1,heading:iR,html:Rx,image:Mx,imageReference:Lx,inlineCode:Ox,link:Bx,linkReference:Ix,list:fR,listItem:pR,paragraph:gR,root:_R,strong:Hx,text:bR,thematicBreak:xR};function wR(){return{enter:{table:CR,tableData:b1,tableHeader:b1,tableRow:kR},exit:{codeText:AR,table:ER,tableData:ep,tableHeader:ep,tableRow:ep}}}function CR(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function ER(e){this.exit(e),this.data.inTable=void 0}function kR(e){this.enter({type:"tableRow",children:[]},e)}function ep(e){this.exit(e)}function b1(e){this.enter({type:"tableCell",children:[]},e)}function AR(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,TR));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function TR(e,t){return t==="|"?t:e}function NR(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:c,tableCell:u,tableRow:o}};function c(_,w,C,y){return f(g(_,C,y),_.align)}function o(_,w,C,y){const b=d(_,C,y),x=f([b]);return x.slice(0,x.indexOf(` -`))}function u(_,w,C,y){const b=C.enter("tableCell"),x=C.enter("phrasing"),v=C.containerPhrasing(_,{...y,before:l,after:l});return x(),b(),v}function f(_,w){return $D(_,{align:w,alignDelimiters:r,padding:n,stringLength:a})}function g(_,w,C){const y=_.children;let b=-1;const x=[],v=w.enter("table");for(;++b0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const YR={tokenize:tM,partial:!0};function WR(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:QR,continuation:{tokenize:JR},exit:eM}},text:{91:{name:"gfmFootnoteCall",tokenize:ZR},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:XR,resolveTo:KR}}}}function XR(e,t,n){const r=this;let a=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c;for(;a--;){const u=r.events[a][1];if(u.type==="labelImage"){c=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return o;function o(u){if(!c||!c._balanced)return n(u);const f=Xn(r.sliceSerialize({start:c.end,end:r.now()}));return f.codePointAt(0)!==94||!l.includes(f.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function KR(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",l,t],["enter",c,t],["exit",c,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function ZR(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,c;return o;function o(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),u}function u(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(d){if(l>999||d===93&&!c||d===null||d===91||vt(d))return n(d);if(d===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return a.includes(Xn(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return vt(d)||(c=!0),l++,e.consume(d),d===92?g:f}function g(d){return d===91||d===92||d===93?(e.consume(d),l++,f):f(d)}}function QR(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,c=0,o;return u;function u(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(w)}function g(w){if(c>999||w===93&&!o||w===null||w===91||vt(w))return n(w);if(w===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return l=Xn(r.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return vt(w)||(o=!0),c++,e.consume(w),w===92?d:g}function d(w){return w===91||w===92||w===93?(e.consume(w),c++,g):g(w)}function m(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),a.includes(l)||a.push(l),Qe(e,_,"gfmFootnoteDefinitionWhitespace")):n(w)}function _(w){return t(w)}}function JR(e,t,n){return e.check(Qo,t,e.attempt(YR,t,n))}function eM(e){e.exit("gfmFootnoteDefinition")}function tM(e,t,n){const r=this;return Qe(e,a,"gfmFootnoteDefinitionIndent",5);function a(l){const c=r.events[r.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(l):n(l)}}function nM(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(c,o){let u=-1;for(;++u1?u(w):(c.consume(w),d++,_);if(d<2&&!n)return u(w);const y=c.exit("strikethroughSequenceTemporary"),b=ia(w);return y._open=!b||b===2&&!!C,y._close=!C||C===2&&!!b,o(w)}}}class iM{constructor(){this.map=[]}add(t,n,r){rM(this,t,n,r)}consume(t){if(this.map.sort(function(l,c){return l[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const l of a)t.push(l);a=r.pop()}this.map.length=0}}function rM(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a-1;){const z=r.events[F][1].type;if(z==="lineEnding"||z==="linePrefix")F--;else break}const V=F>-1?r.events[F][1].type:null,H=V==="tableHead"||V==="tableRow"?T:u;return H===T&&r.parser.lazy[r.now().line]?n(I):H(I)}function u(I){return e.enter("tableHead"),e.enter("tableRow"),f(I)}function f(I){return I===124||(c=!0,l+=1),g(I)}function g(I){return I===null?n(I):Re(I)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),_):n(I):qe(I)?Qe(e,g,"whitespace")(I):(l+=1,c&&(c=!1,a+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),d(I)))}function d(I){return I===null||I===124||vt(I)?(e.exit("data"),g(I)):(e.consume(I),I===92?m:d)}function m(I){return I===92||I===124?(e.consume(I),d):d(I)}function _(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(e.enter("tableDelimiterRow"),c=!1,qe(I)?Qe(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):w(I))}function w(I){return I===45||I===58?y(I):I===124?(c=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),C):D(I)}function C(I){return qe(I)?Qe(e,y,"whitespace")(I):y(I)}function y(I){return I===58?(l+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),b):I===45?(l+=1,b(I)):I===null||Re(I)?k(I):D(I)}function b(I){return I===45?(e.enter("tableDelimiterFiller"),x(I)):D(I)}function x(I){return I===45?(e.consume(I),x):I===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(I))}function v(I){return qe(I)?Qe(e,k,"whitespace")(I):k(I)}function k(I){return I===124?w(I):I===null||Re(I)?!c||a!==l?D(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):D(I)}function D(I){return n(I)}function T(I){return e.enter("tableRow"),R(I)}function R(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),R):I===null||Re(I)?(e.exit("tableRow"),t(I)):qe(I)?Qe(e,R,"whitespace")(I):(e.enter("data"),N(I))}function N(I){return I===null||I===124||vt(I)?(e.exit("data"),R(I)):(e.consume(I),I===92?L:N)}function L(I){return I===92||I===124?(e.consume(I),N):N(I)}}function lM(e,t){let n=-1,r=!0,a=0,l=[0,0,0,0],c=[0,0,0,0],o=!1,u=0,f,g,d;const m=new iM;for(;++nn[2]+1){const w=n[2]+1,C=n[3]-n[2]-1;e.add(w,C,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return a!==void 0&&(l.end=Object.assign({},Ys(t.events,a)),e.add(a,0,[["exit",l,t]]),l=void 0),l}function x1(e,t,n,r,a){const l=[],c=Ys(t.events,n);a&&(a.end=Object.assign({},c),l.push(["exit",a,t])),r.end=Object.assign({},c),l.push(["exit",r,t]),e.add(n+1,0,l)}function Ys(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const cM={name:"tasklistCheck",tokenize:hM};function uM(){return{text:{91:cM}}}function hM(e,t,n){const r=this;return a;function a(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),l)}function l(u){return vt(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),c):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),c):n(u)}function c(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(u)}function o(u){return Re(u)?t(u):qe(u)?e.check({tokenize:fM},t,n)(u):n(u)}}function fM(e,t,n){return Qe(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function dM(e){return ix([zR(),WR(),nM(e),aM(),uM()])}const pM={};function Xx(e){const t=this,n=e||pM,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),c=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(dM(n)),l.push(OR()),c.push(jR(n))}const gM={cjs:"javascript",console:"bash",cts:"typescript",fish:"bash",html:"markup",js:"javascript",jsx:"javascript",md:"markdown",mjs:"javascript",mts:"typescript",py:"python",rb:"ruby",sh:"bash",shell:"bash",svg:"markup",terminal:"bash",ts:"typescript",tsx:"typescript",xml:"markup",yml:"yaml",zsh:"bash"},mM={containerfile:"docker",dockerfile:"docker",justfile:"makefile",makefile:"makefile"};function Op(e){const t=e.trim().toLowerCase();return gM[t]??t}function Kx(e){var a;if(!e)return null;const t=((a=e.split("/").pop())==null?void 0:a.toLowerCase())??"",n=mM[t];if(n)return Op(n);const r=t.lastIndexOf(".");return r===-1||r===t.length-1?null:Op(t.slice(r+1))}ci.displayName="clike";ci.aliases=[];function ci(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:/[{}[\];(),.:]/}}el.displayName="c";el.aliases=[];function el(e){e.register(ci),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}$u.displayName="cpp";$u.aliases=[];function $u(e){e.register(el),(function(t){var n=/\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 n.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,function(){return n.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:n,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/}),t.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}}),t.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:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])})(e)}Mg.displayName="arduino";Mg.aliases=["ino"];function Mg(e){e.register($u),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}Lg.displayName="bash";Lg.aliases=["sh","shell"];function Lg(e){(function(t){var n="\\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},a={bash:r,environment:{pattern:RegExp("\\$"+n),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("(\\{)"+n),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})/};t.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;|&]|[<>]\\()"+n),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:a},{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:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:a.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=t.languages.bash;for(var l=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],c=a.variable[1].inside,o=0;o>/g,function($,U){return"(?:"+j[+U]+")"})}function r(M,j,$){return RegExp(n(M,j),"")}function a(M,j){for(var $=0;$>/g,function(){return"(?:"+M+")"});return M.replace(/<>/g,"[^\\s\\S]")}var l={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 c(M){return"\\b(?:"+M.trim().replace(/ /g,"|")+")\\b"}var o=c(l.typeDeclaration),u=RegExp(c(l.type+" "+l.typeDeclaration+" "+l.contextual+" "+l.other)),f=c(l.typeDeclaration+" "+l.contextual+" "+l.other),g=c(l.type+" "+l.typeDeclaration+" "+l.other),d=a(/<(?:[^<>;=+\-*/%&|^]|<>)*>/.source,2),m=a(/\((?:[^()]|<>)*\)/.source,2),_=/@?\b[A-Za-z_]\w*\b/.source,w=n(/<<0>>(?:\s*<<1>>)?/.source,[_,d]),C=n(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[f,w]),y=/\[\s*(?:,\s*)*\]/.source,b=n(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[C,y]),x=n(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[d,m,y]),v=n(/\(<<0>>+(?:,<<0>>+)+\)/.source,[x]),k=n(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[v,C,y]),D={keyword:u,punctuation:/[<>()?,.:[\]]/},T=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,R=/"(?:\\.|[^\\"\r\n])*"/.source,N=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;t.languages.csharp=t.languages.extend("clike",{string:[{pattern:r(/(^|[^$\\])<<0>>/.source,[N]),lookbehind:!0,greedy:!0},{pattern:r(/(^|[^@$\\])<<0>>/.source,[R]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:r(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[C]),lookbehind:!0,inside:D},{pattern:r(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[_,k]),lookbehind:!0,inside:D},{pattern:r(/(\busing\s+)<<0>>(?=\s*=)/.source,[_]),lookbehind:!0},{pattern:r(/(\b<<0>>\s+)<<1>>/.source,[o,w]),lookbehind:!0,inside:D},{pattern:r(/(\bcatch\s*\(\s*)<<0>>/.source,[C]),lookbehind:!0,inside:D},{pattern:r(/(\bwhere\s+)<<0>>/.source,[_]),lookbehind:!0},{pattern:r(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[b]),lookbehind:!0,inside:D},{pattern:r(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[k,g,_]),inside:D}],keyword:u,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:/\?\.?|::|[{}[\];(),.:]/}),t.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),t.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:r(/([(,]\s*)<<0>>(?=\s*:)/.source,[_]),lookbehind:!0,alias:"punctuation"}}),t.languages.insertBefore("csharp","class-name",{namespace:{pattern:r(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[_]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:r(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[m]),lookbehind:!0,alias:"class-name",inside:D},"return-type":{pattern:r(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[k,C]),inside:D,alias:"class-name"},"constructor-invocation":{pattern:r(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[k]),lookbehind:!0,inside:D,alias:"class-name"},"generic-method":{pattern:r(/<<0>>\s*<<1>>(?=\s*\()/.source,[_,d]),inside:{function:r(/^<<0>>/.source,[_]),generic:{pattern:RegExp(d),alias:"class-name",inside:D}}},"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,w,_,k,u.source,m,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:r(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[w,m]),lookbehind:!0,greedy:!0,inside:t.languages.csharp},keyword:u,"class-name":{pattern:RegExp(k),greedy:!0,inside:D},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 L=R+"|"+T,I=n(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[L]),F=a(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[I]),2),V=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,H=n(/<<0>>(?:\s*\(<<1>>*\))?/.source,[C,F]);t.languages.insertBefore("csharp","class-name",{attribute:{pattern:r(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[V,H]),lookbehind:!0,greedy:!0,inside:{target:{pattern:r(/^<<0>>(?=\s*:)/.source,[V]),alias:"keyword"},"attribute-arguments":{pattern:r(/\(<<0>>*\)/.source,[F]),inside:t.languages.csharp},"class-name":{pattern:RegExp(C),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var z=/:[^}\r\n]+/.source,q=a(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[I]),2),G=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[q,z]),X=a(n(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<>*\)/.source,[L]),2),K=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[X,z]);function O(M,j){return{interpolation:{pattern:r(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[M]),lookbehind:!0,inside:{"format-string":{pattern:r(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[j,z]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:t.languages.csharp}}},string:/[\s\S]+/}}t.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:r(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[G]),lookbehind:!0,greedy:!0,inside:O(G,q)},{pattern:r(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[K]),lookbehind:!0,greedy:!0,inside:O(K,X)}],char:{pattern:RegExp(T),greedy:!0}}),t.languages.dotnet=t.languages.cs=t.languages.csharp})(e)}tl.displayName="markup";tl.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function tl(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(t){t.type==="entity"&&(t.attributes.title=t.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(n,r){var a={};a["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[r]},a.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:a}};l["language-"+r]={pattern:/[\s\S]+/,inside:e.languages[r]};var c={};c[n]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:l},e.languages.insertBefore("markup","cdata",c)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\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:[n,"language-"+n],inside:e.languages[n]},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}ga.displayName="css";ga.aliases=[];function ga(e){(function(t){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.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\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,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:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(e)}jg.displayName="diff";jg.aliases=[];function jg(e){(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(n).forEach(function(r){var a=n[r],l=[];/^\w+$/.test(r)||l.push(/\w+/.exec(r)[0]),r==="diff"&&l.push("bold"),t.languages.diff[r]={pattern:RegExp("^(?:["+a+`].*(?:\r +`,...l.current()});return/^[\t ]/.test(f)&&(f=Io(f.charCodeAt(0))+f.slice(1)),f=f?c+" "+f:c,n.options.closeAtx&&(f+=" "+c),u(),o(),f}Bx.peek=_4;function Bx(e){return e.value||""}function _4(){return"<"}Ix.peek=v4;function Ix(e,t,n,r){const a=Og(n),l=a==='"'?"Quote":"Apostrophe",c=n.enter("image");let o=n.enter("label");const u=n.createTracker(r);let f=u.move("![");return f+=u.move(n.safe(e.alt,{before:f,after:"]",...u.current()})),f+=u.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),f+=u.move("<"),f+=u.move(n.safe(e.url,{before:f,after:">",...u.current()})),f+=u.move(">")):(o=n.enter("destinationRaw"),f+=u.move(n.safe(e.url,{before:f,after:e.title?" ":")",...u.current()}))),o(),e.title&&(o=n.enter(`title${l}`),f+=u.move(" "+a),f+=u.move(n.safe(e.title,{before:f,after:a,...u.current()})),f+=u.move(a),o()),f+=u.move(")"),c(),f}function v4(){return"!"}zx.peek=y4;function zx(e,t,n,r){const a=e.referenceType,l=n.enter("imageReference");let c=n.enter("label");const o=n.createTracker(r);let u=o.move("![");const f=n.safe(e.alt,{before:u,after:"]",...o.current()});u+=o.move(f+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const d=n.safe(n.associationId(e),{before:u,after:"]",...o.current()});return c(),n.stack=g,l(),a==="full"||!f||f!==d?u+=o.move(d+"]"):a==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function y4(){return"!"}Hx.peek=b4;function Hx(e,t,n){let r=e.value||"",a="`",l=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l\u007F]/.test(e.url))}Px.peek=S4;function Px(e,t,n,r){const a=Og(n),l=a==='"'?"Quote":"Apostrophe",c=n.createTracker(r);let o,u;if(Fx(e,n)){const g=n.stack;n.stack=[],o=n.enter("autolink");let d=c.move("<");return d+=c.move(n.containerPhrasing(e,{before:d,after:">",...c.current()})),d+=c.move(">"),o(),n.stack=g,d}o=n.enter("link"),u=n.enter("label");let f=c.move("[");return f+=c.move(n.containerPhrasing(e,{before:f,after:"](",...c.current()})),f+=c.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(u=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),u(),e.title&&(u=n.enter(`title${l}`),f+=c.move(" "+a),f+=c.move(n.safe(e.title,{before:f,after:a,...c.current()})),f+=c.move(a),u()),f+=c.move(")"),o(),f}function S4(e,t,n){return Fx(e,n)?"<":"["}Ux.peek=x4;function Ux(e,t,n,r){const a=e.referenceType,l=n.enter("linkReference");let c=n.enter("label");const o=n.createTracker(r);let u=o.move("[");const f=n.containerPhrasing(e,{before:u,after:"]",...o.current()});u+=o.move(f+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const d=n.safe(n.associationId(e),{before:u,after:"]",...o.current()});return c(),n.stack=g,l(),a==="full"||!f||f!==d?u+=o.move(d+"]"):a==="shortcut"?u=u.slice(0,-1):u+=o.move("]"),u}function x4(){return"["}function jg(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function w4(e){const t=jg(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function C4(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function $x(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function E4(e,t,n,r){const a=n.enter("list"),l=n.bulletCurrent;let c=e.ordered?C4(n):jg(n);const o=e.ordered?c==="."?")":".":w4(n);let u=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),$x(n)===c&&g){let d=-1;for(;++d-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let c=l.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const o=n.createTracker(r);o.move(l+" ".repeat(c-l.length)),o.shift(c);const u=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,o.current()),g);return u(),f;function g(d,m,_){return m?(_?"":" ".repeat(c))+d:(_?l:l+" ".repeat(c-l.length))+d}}function T4(e,t,n,r){const a=n.enter("paragraph"),l=n.enter("phrasing"),c=n.containerPhrasing(e,r);return l(),a(),c}const N4=Gu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function D4(e,t,n,r){return(e.children.some(function(c){return N4(c)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function R4(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Gx.peek=M4;function Gx(e,t,n,r){const a=R4(n),l=n.enter("strong"),c=n.createTracker(r),o=c.move(a+a);let u=c.move(n.containerPhrasing(e,{after:a,before:o,...c.current()}));const f=u.charCodeAt(0),g=Su(r.before.charCodeAt(r.before.length-1),f,a);g.inside&&(u=Io(f)+u.slice(1));const d=u.charCodeAt(u.length-1),m=Su(r.after.charCodeAt(0),d,a);m.inside&&(u=u.slice(0,-1)+Io(d));const _=c.move(a+a);return l(),n.attentionEncodeSurroundingInfo={after:m.outside,before:g.outside},o+u+_}function M4(e,t,n){return n.options.strong||"*"}function L4(e,t,n,r){return n.safe(e.value,r)}function O4(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function j4(e,t,n){const r=($x(n)+(n.options.ruleSpaces?" ":"")).repeat(O4(n));return n.options.ruleSpaces?r.slice(0,-1):r}const qx={blockquote:r4,break:w1,code:u4,definition:f4,emphasis:jx,hardBreak:w1,heading:m4,html:Bx,image:Ix,imageReference:zx,inlineCode:Hx,link:Px,linkReference:Ux,list:E4,listItem:A4,paragraph:T4,root:D4,strong:Gx,text:L4,thematicBreak:j4};function B4(){return{enter:{table:I4,tableData:C1,tableHeader:C1,tableRow:H4},exit:{codeText:F4,table:z4,tableData:rp,tableHeader:rp,tableRow:rp}}}function I4(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function z4(e){this.exit(e),this.data.inTable=void 0}function H4(e){this.enter({type:"tableRow",children:[]},e)}function rp(e){this.exit(e)}function C1(e){this.enter({type:"tableCell",children:[]},e)}function F4(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,P4));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function P4(e,t){return t==="|"?t:e}function U4(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:c,tableCell:u,tableRow:o}};function c(_,w,C,b){return f(g(_,C,b),_.align)}function o(_,w,C,b){const S=d(_,C,b),x=f([S]);return x.slice(0,x.indexOf(` +`))}function u(_,w,C,b){const S=C.enter("tableCell"),x=C.enter("phrasing"),y=C.containerPhrasing(_,{...b,before:l,after:l});return x(),S(),y}function f(_,w){return n4(_,{align:w,alignDelimiters:r,padding:n,stringLength:a})}function g(_,w,C){const b=_.children;let S=-1;const x=[],y=w.enter("table");for(;++S0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const aM={tokenize:pM,partial:!0};function oM(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:hM,continuation:{tokenize:fM},exit:dM}},text:{91:{name:"gfmFootnoteCall",tokenize:uM},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:lM,resolveTo:cM}}}}function lM(e,t,n){const r=this;let a=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c;for(;a--;){const u=r.events[a][1];if(u.type==="labelImage"){c=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return o;function o(u){if(!c||!c._balanced)return n(u);const f=Zn(r.sliceSerialize({start:c.end,end:r.now()}));return f.codePointAt(0)!==94||!l.includes(f.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function cM(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",l,t],["enter",c,t],["exit",c,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function uM(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,c;return o;function o(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),u}function u(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(d){if(l>999||d===93&&!c||d===null||d===91||vt(d))return n(d);if(d===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return a.includes(Zn(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return vt(d)||(c=!0),l++,e.consume(d),d===92?g:f}function g(d){return d===91||d===92||d===93?(e.consume(d),l++,f):f(d)}}function hM(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,c=0,o;return u;function u(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(w)}function g(w){if(c>999||w===93&&!o||w===null||w===91||vt(w))return n(w);if(w===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return l=Zn(r.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return vt(w)||(o=!0),c++,e.consume(w),w===92?d:g}function d(w){return w===91||w===92||w===93?(e.consume(w),c++,g):g(w)}function m(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),a.includes(l)||a.push(l),et(e,_,"gfmFootnoteDefinitionWhitespace")):n(w)}function _(w){return t(w)}}function fM(e,t,n){return e.check(el,t,e.attempt(aM,t,n))}function dM(e){e.exit("gfmFootnoteDefinition")}function pM(e,t,n){const r=this;return et(e,a,"gfmFootnoteDefinitionIndent",5);function a(l){const c=r.events[r.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(l):n(l)}}function gM(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(c,o){let u=-1;for(;++u1?u(w):(c.consume(w),d++,_);if(d<2&&!n)return u(w);const b=c.exit("strikethroughSequenceTemporary"),S=ia(w);return b._open=!S||S===2&&!!C,b._close=!C||C===2&&!!S,o(w)}}}class mM{constructor(){this.map=[]}add(t,n,r){_M(this,t,n,r)}consume(t){if(this.map.sort(function(l,c){return l[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const l of a)t.push(l);a=r.pop()}this.map.length=0}}function _M(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a-1;){const z=r.events[F][1].type;if(z==="lineEnding"||z==="linePrefix")F--;else break}const V=F>-1?r.events[F][1].type:null,H=V==="tableHead"||V==="tableRow"?T:u;return H===T&&r.parser.lazy[r.now().line]?n(I):H(I)}function u(I){return e.enter("tableHead"),e.enter("tableRow"),f(I)}function f(I){return I===124||(c=!0,l+=1),g(I)}function g(I){return I===null?n(I):Re(I)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),_):n(I):qe(I)?et(e,g,"whitespace")(I):(l+=1,c&&(c=!1,a+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),d(I)))}function d(I){return I===null||I===124||vt(I)?(e.exit("data"),g(I)):(e.consume(I),I===92?m:d)}function m(I){return I===92||I===124?(e.consume(I),d):d(I)}function _(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(e.enter("tableDelimiterRow"),c=!1,qe(I)?et(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):w(I))}function w(I){return I===45||I===58?b(I):I===124?(c=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),C):D(I)}function C(I){return qe(I)?et(e,b,"whitespace")(I):b(I)}function b(I){return I===58?(l+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),S):I===45?(l+=1,S(I)):I===null||Re(I)?k(I):D(I)}function S(I){return I===45?(e.enter("tableDelimiterFiller"),x(I)):D(I)}function x(I){return I===45?(e.consume(I),x):I===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),y):(e.exit("tableDelimiterFiller"),y(I))}function y(I){return qe(I)?et(e,k,"whitespace")(I):k(I)}function k(I){return I===124?w(I):I===null||Re(I)?!c||a!==l?D(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):D(I)}function D(I){return n(I)}function T(I){return e.enter("tableRow"),R(I)}function R(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),R):I===null||Re(I)?(e.exit("tableRow"),t(I)):qe(I)?et(e,R,"whitespace")(I):(e.enter("data"),N(I))}function N(I){return I===null||I===124||vt(I)?(e.exit("data"),R(I)):(e.consume(I),I===92?L:N)}function L(I){return I===92||I===124?(e.consume(I),N):N(I)}}function SM(e,t){let n=-1,r=!0,a=0,l=[0,0,0,0],c=[0,0,0,0],o=!1,u=0,f,g,d;const m=new mM;for(;++nn[2]+1){const w=n[2]+1,C=n[3]-n[2]-1;e.add(w,C,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return a!==void 0&&(l.end=Object.assign({},Ys(t.events,a)),e.add(a,0,[["exit",l,t]]),l=void 0),l}function k1(e,t,n,r,a){const l=[],c=Ys(t.events,n);a&&(a.end=Object.assign({},c),l.push(["exit",a,t])),r.end=Object.assign({},c),l.push(["exit",r,t]),e.add(n+1,0,l)}function Ys(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const xM={name:"tasklistCheck",tokenize:CM};function wM(){return{text:{91:xM}}}function CM(e,t,n){const r=this;return a;function a(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),l)}function l(u){return vt(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),c):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),c):n(u)}function c(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(u)}function o(u){return Re(u)?t(u):qe(u)?e.check({tokenize:EM},t,n)(u):n(u)}}function EM(e,t,n){return et(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function kM(e){return lx([Z4(),oM(),gM(e),yM(),wM()])}const AM={};function ew(e){const t=this,n=e||AM,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),c=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(kM(n)),l.push(Y4()),c.push(W4(n))}const TM={cjs:"javascript",console:"bash",cts:"typescript",fish:"bash",html:"markup",js:"javascript",jsx:"javascript",md:"markdown",mjs:"javascript",mts:"typescript",py:"python",rb:"ruby",sh:"bash",shell:"bash",svg:"markup",terminal:"bash",ts:"typescript",tsx:"typescript",xml:"markup",yml:"yaml",zsh:"bash"},NM={containerfile:"docker",dockerfile:"docker",justfile:"makefile",makefile:"makefile"};function Hp(e){const t=e.trim().toLowerCase();return TM[t]??t}function tw(e){var a;if(!e)return null;const t=((a=e.split("/").pop())==null?void 0:a.toLowerCase())??"",n=NM[t];if(n)return Hp(n);const r=t.lastIndexOf(".");return r===-1||r===t.length-1?null:Hp(t.slice(r+1))}ui.displayName="clike";ui.aliases=[];function ui(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:/[{}[\];(),.:]/}}nl.displayName="c";nl.aliases=[];function nl(e){e.register(ui),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}Vu.displayName="cpp";Vu.aliases=[];function Vu(e){e.register(nl),(function(t){var n=/\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 n.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,function(){return n.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:n,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/}),t.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}}),t.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:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])})(e)}Ig.displayName="arduino";Ig.aliases=["ino"];function Ig(e){e.register(Vu),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}zg.displayName="bash";zg.aliases=["sh","shell"];function zg(e){(function(t){var n="\\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},a={bash:r,environment:{pattern:RegExp("\\$"+n),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("(\\{)"+n),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})/};t.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;|&]|[<>]\\()"+n),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:a},{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:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:a.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=t.languages.bash;for(var l=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],c=a.variable[1].inside,o=0;o>/g,function($,U){return"(?:"+j[+U]+")"})}function r(M,j,$){return RegExp(n(M,j),"")}function a(M,j){for(var $=0;$>/g,function(){return"(?:"+M+")"});return M.replace(/<>/g,"[^\\s\\S]")}var l={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 c(M){return"\\b(?:"+M.trim().replace(/ /g,"|")+")\\b"}var o=c(l.typeDeclaration),u=RegExp(c(l.type+" "+l.typeDeclaration+" "+l.contextual+" "+l.other)),f=c(l.typeDeclaration+" "+l.contextual+" "+l.other),g=c(l.type+" "+l.typeDeclaration+" "+l.other),d=a(/<(?:[^<>;=+\-*/%&|^]|<>)*>/.source,2),m=a(/\((?:[^()]|<>)*\)/.source,2),_=/@?\b[A-Za-z_]\w*\b/.source,w=n(/<<0>>(?:\s*<<1>>)?/.source,[_,d]),C=n(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[f,w]),b=/\[\s*(?:,\s*)*\]/.source,S=n(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[C,b]),x=n(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[d,m,b]),y=n(/\(<<0>>+(?:,<<0>>+)+\)/.source,[x]),k=n(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[y,C,b]),D={keyword:u,punctuation:/[<>()?,.:[\]]/},T=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,R=/"(?:\\.|[^\\"\r\n])*"/.source,N=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;t.languages.csharp=t.languages.extend("clike",{string:[{pattern:r(/(^|[^$\\])<<0>>/.source,[N]),lookbehind:!0,greedy:!0},{pattern:r(/(^|[^@$\\])<<0>>/.source,[R]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:r(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[C]),lookbehind:!0,inside:D},{pattern:r(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[_,k]),lookbehind:!0,inside:D},{pattern:r(/(\busing\s+)<<0>>(?=\s*=)/.source,[_]),lookbehind:!0},{pattern:r(/(\b<<0>>\s+)<<1>>/.source,[o,w]),lookbehind:!0,inside:D},{pattern:r(/(\bcatch\s*\(\s*)<<0>>/.source,[C]),lookbehind:!0,inside:D},{pattern:r(/(\bwhere\s+)<<0>>/.source,[_]),lookbehind:!0},{pattern:r(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[S]),lookbehind:!0,inside:D},{pattern:r(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[k,g,_]),inside:D}],keyword:u,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:/\?\.?|::|[{}[\];(),.:]/}),t.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),t.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:r(/([(,]\s*)<<0>>(?=\s*:)/.source,[_]),lookbehind:!0,alias:"punctuation"}}),t.languages.insertBefore("csharp","class-name",{namespace:{pattern:r(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[_]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:r(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[m]),lookbehind:!0,alias:"class-name",inside:D},"return-type":{pattern:r(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[k,C]),inside:D,alias:"class-name"},"constructor-invocation":{pattern:r(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[k]),lookbehind:!0,inside:D,alias:"class-name"},"generic-method":{pattern:r(/<<0>>\s*<<1>>(?=\s*\()/.source,[_,d]),inside:{function:r(/^<<0>>/.source,[_]),generic:{pattern:RegExp(d),alias:"class-name",inside:D}}},"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,w,_,k,u.source,m,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:r(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[w,m]),lookbehind:!0,greedy:!0,inside:t.languages.csharp},keyword:u,"class-name":{pattern:RegExp(k),greedy:!0,inside:D},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 L=R+"|"+T,I=n(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[L]),F=a(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[I]),2),V=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,H=n(/<<0>>(?:\s*\(<<1>>*\))?/.source,[C,F]);t.languages.insertBefore("csharp","class-name",{attribute:{pattern:r(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[V,H]),lookbehind:!0,greedy:!0,inside:{target:{pattern:r(/^<<0>>(?=\s*:)/.source,[V]),alias:"keyword"},"attribute-arguments":{pattern:r(/\(<<0>>*\)/.source,[F]),inside:t.languages.csharp},"class-name":{pattern:RegExp(C),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var z=/:[^}\r\n]+/.source,q=a(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[I]),2),G=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[q,z]),X=a(n(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<>*\)/.source,[L]),2),K=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[X,z]);function O(M,j){return{interpolation:{pattern:r(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[M]),lookbehind:!0,inside:{"format-string":{pattern:r(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[j,z]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:t.languages.csharp}}},string:/[\s\S]+/}}t.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:r(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[G]),lookbehind:!0,greedy:!0,inside:O(G,q)},{pattern:r(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[K]),lookbehind:!0,greedy:!0,inside:O(K,X)}],char:{pattern:RegExp(T),greedy:!0}}),t.languages.dotnet=t.languages.cs=t.languages.csharp})(e)}il.displayName="markup";il.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function il(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(t){t.type==="entity"&&(t.attributes.title=t.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(n,r){var a={};a["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[r]},a.cdata=/^$/i;var l={"included-cdata":{pattern://i,inside:a}};l["language-"+r]={pattern:/[\s\S]+/,inside:e.languages[r]};var c={};c[n]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:l},e.languages.insertBefore("markup","cdata",c)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\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:[n,"language-"+n],inside:e.languages[n]},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}ga.displayName="css";ga.aliases=[];function ga(e){(function(t){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.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\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,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:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(e)}Fg.displayName="diff";Fg.aliases=[];function Fg(e){(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(n).forEach(function(r){var a=n[r],l=[];/^\w+$/.test(r)||l.push(/\w+/.exec(r)[0]),r==="diff"&&l.push("bold"),t.languages.diff[r]={pattern:RegExp("^(?:["+a+`].*(?:\r ?| -|(?![\\s\\S])))+`,"m"),alias:l,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(r)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:n})})(e)}Bg.displayName="go";Bg.aliases=[];function Bg(e){e.register(ci),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"]}Ig.displayName="ini";Ig.aliases=[];function Ig(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:/=/}}zg.displayName="java";zg.aliases=[];function zg(e){e.register(ci),(function(t){var n=/\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,a={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:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[a,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:a.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:a.inside}],keyword:n,function:[t.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/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.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":a,keyword:n,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:a.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:a.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 n.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}Hg.displayName="regex";Hg.aliases=[];function Hg(e){(function(t){var n={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]|.)/,a={pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},l={pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},c="(?:[^\\\\-]|"+r.source+")",o=RegExp(c+"-"+c),u={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"};t.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":n,"char-set":l,escape:r}},"special-escape":n,"char-set":a,backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":u}}],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}Fg.displayName="json";Fg.aliases=["webmanifest"];function Fg(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}Pg.displayName="kotlin";Pg.aliases=["kt","kts"];function Pg(e){e.register(ci),(function(t){t.languages.kotlin=t.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 t.languages.kotlin["class-name"];var n={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:t.languages.kotlin}};t.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:n},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:n},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete t.languages.kotlin.string,t.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),t.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),t.languages.kt=t.languages.kotlin,t.languages.kts=t.languages.kotlin})(e)}Ug.displayName="less";Ug.aliases=[];function Ug(e){e.register(ga),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"}})}$g.displayName="lua";$g.aliases=[];function $g(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:/[\[\](){},;]|\.+|:+/}}Gg.displayName="makefile";Gg.aliases=[];function Gg(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:/[:;(){}]/}}qg.displayName="yaml";qg.aliases=["yml"];function qg(e){(function(t){var n=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,a="(?:"+r.source+"(?:[ ]+"+n.source+")?|"+n.source+"(?:[ ]+"+r.source+")?)",l=/(?:[^\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}),c=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(u,f){f=(f||"").replace(/m/g,"")+"m";var g=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return a}).replace(/<>/g,function(){return u});return RegExp(g,f)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return a})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return a}).replace(/<>/g,function(){return"(?:"+l+"|"+c+")"})),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(c),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:n,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(e)}Vg.displayName="markdown";Vg.aliases=["md"];function Vg(e){e.register(tl),(function(t){var n=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(o){return o=o.replace(//g,function(){return n}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+o+")")}var a=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,l=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return a}),c=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.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:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+l+c+"(?:"+l+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+l+c+")(?:"+l+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(a),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+l+")"+c+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+l+"$"),inside:{"table-header":{pattern:RegExp(a),alias:"important",inside:t.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(u){o!==u&&(t.languages.markdown[o].inside.content.inside[u]=t.languages.markdown[u])})}),t.hooks.add("after-tokenize",function(o){if(o.language!=="markdown"&&o.language!=="md")return;function u(f){if(!(!f||typeof f=="string"))for(var g=0,d=f.length;g]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete e.languages.objectivec["class-name"],e.languages.objc=e.languages.objectivec}Wg.displayName="perl";Wg.aliases=[];function Wg(e){(function(t){var n=/(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;t.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,n].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,n].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,n+/\s*/.source+n].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)}qu.displayName="markup-templating";qu.aliases=[];function qu(e){e.register(tl),(function(t){function n(r,a){return"___"+r.toUpperCase()+a+"___"}Object.defineProperties(t.languages["markup-templating"]={},{buildPlaceholders:{value:function(r,a,l,c){if(r.language===a){var o=r.tokenStack=[];r.code=r.code.replace(l,function(u){if(typeof c=="function"&&!c(u))return u;for(var f=o.length,g;r.code.indexOf(g=n(a,f))!==-1;)++f;return o[f]=u,g}),r.grammar=t.languages.markup}}},tokenizePlaceholders:{value:function(r,a){if(r.language!==a||!r.tokenStack)return;r.grammar=t.languages[a];var l=0,c=Object.keys(r.tokenStack);function o(u){for(var f=0;f=c.length);f++){var g=u[f];if(typeof g=="string"||g.content&&typeof g.content=="string"){var d=c[l],m=r.tokenStack[d],_=typeof g=="string"?g:g.content,w=n(a,d),C=_.indexOf(w);if(C>-1){++l;var y=_.substring(0,C),b=new t.Token(a,t.tokenize(m,r.grammar),"language-"+a,m),x=_.substring(C+w.length),v=[];y&&v.push.apply(v,o([y])),v.push(b),x&&v.push.apply(v,o([x])),typeof g=="string"?u.splice.apply(u,[f,1].concat(v)):g.content=v}}else g.content&&o(g.content)}return u}o(r.tokens)}}})})(e)}Xg.displayName="php";Xg.aliases=[];function Xg(e){e.register(qu),(function(t){var n=/\/\*[\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*\()/],a=/\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,l=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,c=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:n,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:a,operator:l,punctuation:c};var o={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:t.languages.php},u=[{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}}];t.languages.insertBefore("php","variable",{string:u,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:n,string:u,"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:a,operator:l,punctuation:c}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",function(f){if(/<\?/.test(f.code)){var g=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;t.languages["markup-templating"].buildPlaceholders(f,"php",g)}}),t.hooks.add("after-tokenize",function(f){t.languages["markup-templating"].tokenizePlaceholders(f,"php")})})(e)}Kg.displayName="python";Kg.aliases=["py"];function Kg(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}Zg.displayName="r";Zg.aliases=[];function Zg(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:/[(){}\[\],;]/}}Qg.displayName="ruby";Qg.aliases=["rb"];function Qg(e){e.register(ci),(function(t){t.languages.ruby=t.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:/[(){}[\].,;]/}),t.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var n={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:t.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete t.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("|")+")",a=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;t.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+r+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+a),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+a+/(?=:(?!:))/.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:/\./}}}),t.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+r),greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:n,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:n,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:n,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete t.languages.ruby.string,t.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)/}),t.languages.rb=t.languages.ruby})(e)}Jg.displayName="rust";Jg.aliases=[];function Jg(e){(function(t){for(var n=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,r=0;r<2;r++)n=n.replace(//g,function(){return n});n=n.replace(//g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+n),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:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(e)}em.displayName="sass";em.aliases=[];function em(e){e.register(ga),(function(t){t.languages.sass=t.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),t.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete t.languages.sass.atrule;var n=/\$[-\w]+|#\{\$[-\w]+\}/,r=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];t.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:n,operator:r}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:n,operator:r,important:t.languages.sass.important}}}),delete t.languages.sass.property,delete t.languages.sass.important,t.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)}tm.displayName="scss";tm.aliases=[];function tm(e){e.register(ga),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}nm.displayName="sql";nm.aliases=[];function nm(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:/[;[\]()`,.]/}}im.displayName="swift";im.aliases=[];function im(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(t){t.inside.interpolation.inside=e.languages.swift})}rm.displayName="typescript";rm.aliases=["ts"];function rm(e){e.register(Gu),(function(t){t.languages.typescript=t.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/}),t.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 t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var n=t.languages.extend("typescript",{});delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.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:n}}}}),t.languages.ts=t.languages.typescript})(e)}Vu.displayName="basic";Vu.aliases=[];function Vu(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:/[,;:()]/}}sm.displayName="vbnet";sm.aliases=[];function sm(e){e.register(Vu),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:/[,;:(){}]/})}const w1=/[#.]/g;function _M(e,t){const n=e||"",r={};let a=0,l,c;for(;a=48&&t<=57}function EM(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function kM(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function k1(e){return kM(e)||Qx(e)}const AM=["","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 TM(e,t){const n={},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,a=[];let l=0,c=-1,o="",u,f;n.position&&("start"in n.position||"indent"in n.position?(f=n.position.indent,u=n.position.start):u=n.position);let g=(u?u.line:0)||1,d=(u?u.column:0)||1,m=w(),_;for(l--;++l<=e.length;)if(_===10&&(d=(f?f[c]:0)||1),_=e.charCodeAt(l),_===38){const b=e.charCodeAt(l+1);if(b===9||b===10||b===12||b===32||b===38||b===60||Number.isNaN(b)||r&&b===r){o+=String.fromCharCode(_),d++;continue}const x=l+1;let v=x,k=x,D;if(b===35){k=++v;const H=e.charCodeAt(k);H===88||H===120?(D="hexadecimal",k=++v):D="decimal"}else D="named";let T="",R="",N="";const L=D==="named"?k1:D==="decimal"?Qx:EM;for(k--;++k<=e.length;){const H=e.charCodeAt(k);if(!L(H))break;N+=String.fromCharCode(H),D==="named"&&CM.includes(N)&&(T=N,R=Oo(N))}let I=e.charCodeAt(k)===59;if(I){k++;const H=D==="named"?Oo(N):!1;H&&(T=N,R=H)}let F=1+k-x,V="";if(!(!I&&n.nonTerminated===!1))if(!N)D!=="named"&&C(4,F);else if(D==="named"){if(I&&!R)C(5,1);else if(T!==N&&(k=v+T.length,F=1+k-v,I=!1),!I){const H=T?1:3;if(n.attribute){const z=e.charCodeAt(k);z===61?(C(H,F),R=""):k1(z)?R="":C(H,F)}else C(H,F)}V=R}else{I||C(2,F);let H=Number.parseInt(N,D==="hexadecimal"?16:10);if(NM(H))C(7,F),V="�";else if(H in E1)C(6,F),V=E1[H];else{let z="";DM(H)&&C(6,F),H>65535&&(H-=65536,z+=String.fromCharCode(H>>>10|55296),H=56320|H&1023),V=z+String.fromCharCode(H)}}if(V){y(),m=w(),l=k-1,d+=k-x+1,a.push(V);const H=w();H.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,V,{start:m,end:H},e.slice(x-1,k)),m=H}else N=e.slice(x-1,k),o+=N,d+=N.length,l=k-1}else _===10&&(g++,c++,d=0),Number.isNaN(_)?y():(o+=String.fromCharCode(_),d++);return a.join("");function w(){return{line:g,column:d,offset:l+((u?u.offset:0)||0)}}function C(b,x){let v;n.warning&&(v=w(),v.column+=x,v.offset+=x,n.warning.call(n.warningContext||void 0,AM[b],v,b))}function y(){o&&(a.push(o),n.text&&n.text.call(n.textContext||void 0,o,{start:m,end:w()}),o="")}}function NM(e){return e>=55296&&e<=57343||e>1114111}function DM(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 RM=0,Bc={},Vt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++RM}),e.__id},clone:function e(t,n){n=n||{};var r,a;switch(Vt.util.type(t)){case"Object":if(a=Vt.util.objId(t),n[a])return n[a];r={},n[a]=r;for(var l in t)t.hasOwnProperty(l)&&(r[l]=e(t[l],n));return r;case"Array":return a=Vt.util.objId(t),n[a]?n[a]:(r=[],n[a]=r,t.forEach(function(c,o){r[o]=e(c,n)}),r);default:return t}}},languages:{plain:Bc,plaintext:Bc,text:Bc,txt:Bc,extend:function(e,t){var n=Vt.util.clone(Vt.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r=r||Vt.languages;var a=r[e],l={};for(var c in a)if(a.hasOwnProperty(c)){if(c==t)for(var o in n)n.hasOwnProperty(o)&&(l[o]=n[o]);n.hasOwnProperty(c)||(l[c]=a[c])}var u=r[e];return r[e]=l,Vt.languages.DFS(Vt.languages,function(f,g){g===u&&f!=e&&(this[f]=l)}),l},DFS:function e(t,n,r,a){a=a||{};var l=Vt.util.objId;for(var c in t)if(t.hasOwnProperty(c)){n.call(t,c,t[c],r||c);var o=t[c],u=Vt.util.type(o);u==="Object"&&!a[l(o)]?(a[l(o)]=!0,e(o,n,null,a)):u==="Array"&&!a[l(o)]&&(a[l(o)]=!0,e(o,n,c,a))}}},plugins:{},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(Vt.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=Vt.tokenize(r.code,r.grammar),Vt.hooks.run("after-tokenize",r),To.stringify(Vt.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var a=new MM;return iu(a,a.head,e),Jx(e,a,t,a.head,0),OM(a)},hooks:{all:{},add:function(e,t){var n=Vt.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=Vt.hooks.all[e];if(!(!n||!n.length))for(var r=0,a;a=n[r++];)a(t)}},Token:To};function To(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||"").length|0}function A1(e,t,n,r){e.lastIndex=t;var a=e.exec(n);if(a&&r&&a[1]){var l=a[1].length;a.index+=l,a[0]=a[0].slice(l)}return a}function Jx(e,t,n,r,a,l){for(var c in n)if(!(!n.hasOwnProperty(c)||!n[c])){var o=n[c];o=Array.isArray(o)?o:[o];for(var u=0;u=l.reach);b+=y.value.length,y=y.next){var x=y.value;if(t.length>e.length)return;if(!(x instanceof To)){var v=1,k;if(m){if(k=A1(C,b,e,d),!k||k.index>=e.length)break;var N=k.index,D=k.index+k[0].length,T=b;for(T+=y.value.length;N>=T;)y=y.next,T+=y.value.length;if(T-=y.value.length,b=T,y.value instanceof To)continue;for(var R=y;R!==t.tail&&(Tl.reach&&(l.reach=V);var H=y.prev;I&&(H=iu(t,H,I),b+=I.length),LM(t,H,v);var z=new To(c,g?Vt.tokenize(L,g):L,_,L);if(y=iu(t,H,z),F&&iu(t,y,F),v>1){var q={cause:c+","+u,reach:V};Jx(e,t,n,y.prev,b,q),l&&q.reach>l.reach&&(l.reach=q.reach)}}}}}}function MM(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function iu(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function LM(e,t,n){for(var r=t.next,a=0;an)return e;try{return Ne.highlight(e,t).children.map(nw)}catch{return e}}const UM=1e5;function $M({code:e,lang:t}){const[n,r]=W.useState(!1),a=()=>{var l;(l=navigator.clipboard)==null||l.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};return S.jsxs("div",{className:"md-code",children:[S.jsx("button",{className:"md-code-copy",title:"Copy","aria-label":"Copy code",onClick:a,children:n?S.jsx(si,{size:13}):S.jsx(dg,{size:13})}),S.jsx("pre",{children:S.jsx("code",{children:iw(e,t,UM)})})]})}function GM(e){const t={};for(const n of e.matchAll(/([\w-]+)=(["'])(.*?)\2/g)){const r=n[1];r&&(t[r.toLowerCase()]=n[3]??"")}return t}function qM(e){const t=/]*?)\/?>/gi,n=[];let r=0,a=!1;for(const l of e.matchAll(t)){const c=GM(l[1]??"");c.path&&(a=!0,l.index>r&&n.push({type:"text",value:e.slice(r,l.index)}),n.push({children:[],data:{hName:"file-mention",hProperties:c},type:"fileMention"}),r=l.index+l[0].length)}return a?(rrw(e)}function T1({path:e,lines:t,onOpenFile:n}){const r=e.split("/").pop()||e,a=t&&Number.parseInt(t,10)||void 0,l=a!=null?`${r}:${a}`:r;return S.jsxs("button",{className:"file-chip",title:`Open ${e}`,onClick:()=>n==null?void 0:n(e),disabled:!n,children:[S.jsx(RS,{size:12}),S.jsx("span",{className:"file-chip-label",children:l})]})}function YM(e){return!(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("#")||e.startsWith("//"))}const sw={code:({node:e,className:t,children:n,...r})=>{const a=t??"",l=/language-(\w+)/.exec(a),c=String(n??"").replace(/\n$/,"");if(!(l!=null||c.includes(` -`)))return S.jsx("code",{className:a,...r,children:n});const u=l?Op(l[1]):null;return S.jsx($M,{code:c,lang:u})},pre:({children:e})=>S.jsx(S.Fragment,{children:e})};function am({text:e,onOpenFile:t}){const n={"file-mention":r=>S.jsx(T1,{path:r.path,lines:r.lines,onOpenFile:t}),a:({node:r,href:a,children:l,...c})=>a&&YM(a)&&t?S.jsx(T1,{path:decodeURI(a),onOpenFile:t}):S.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",...c,children:l}),...sw};return S.jsx("div",{className:"md",children:S.jsx(Ex,{remarkPlugins:[Xx,VM],components:n,children:e})})}function aw({onSaved:e}){const[t,n]=W.useState(""),[r,a]=W.useState(!1),[l,c]=W.useState(null);async function o(u){if(u.preventDefault(),!(r||!t.trim())){a(!0),c(null);try{e(await MT(t.trim())),n("")}catch(f){c(f instanceof Error?f.message:String(f))}finally{a(!1)}}}return S.jsxs("form",{className:"onb-token-form",onSubmit:o,children:[S.jsx("input",{type:"password",value:t,onChange:u=>n(u.target.value),placeholder:"ghp_… personal access token",autoComplete:"off"}),S.jsx("button",{type:"submit",className:"btn",disabled:r||!t.trim(),children:r?"Checking…":"Save"}),S.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,workflow&description=orx",target:"_blank",rel:"noreferrer",children:"Create a token ↗"}),l&&S.jsx("div",{className:"error",children:l})]})}function WM(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"openresearch_job":return"OpenResearch";case"local_job":return"This machine";default:return e||"—"}}function XM({size:e=16}){return S.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",children:[S.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"}),S.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"}),S.jsx("path",{d:"M11.875 15.113c2.457 0 3.25-2.156 3.25-3.263 0-.576-.393-.394-1.023-.089-.582.283-1.365.675-2.224.675-1.798 0-3.25-1.693-3.25-.586 0 1.107.79 3.263 3.25 3.263h-.003z",fill:"#FF323D"}),S.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"}),S.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"}),S.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-.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-.553.718-.694.244-.162.523-.265.814-.3l.176-.012z",fill:"#FF9D0B"}),S.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-.573.534-.375-.677-1.405-2.416-1.94-2.751-.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-.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-.537-.425.79 2.913 1.718 2.94 1.725 1.075.276 3.813.859 4.77-.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-.537.423.79-2.912 1.718-2.94 1.725-1.077.276-3.815.859-4.77-.522z",fill:"#FFD21E"})]})}function KM({size:e=16}){return S.jsxs("svg",{width:e,height:e,viewBox:"0 0 300 300",fill:"none","aria-hidden":"true",children:[S.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"}),S.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)"}),S.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)"}),S.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"}),S.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"}),S.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)"}),S.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)"}),S.jsxs("defs",{children:[S.jsxs("linearGradient",{id:"orxModalA",x1:"127.348",y1:"137",x2:"82.9561",y2:"59.6398",gradientUnits:"userSpaceOnUse",children:[S.jsx("stop",{stopColor:"#BFF9B4"}),S.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),S.jsxs("linearGradient",{id:"orxModalB",x1:"7.04774",y1:"214.131",x2:"81.1284",y2:"85.0556",gradientUnits:"userSpaceOnUse",children:[S.jsx("stop",{stopColor:"#80EE64"}),S.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),S.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),S.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),S.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),S.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),S.jsx("stop",{offset:"1",stopColor:"#09AF58"})]}),S.jsxs("linearGradient",{id:"orxModalC",x1:"278.103",y1:"188.561",x2:"204.022",y2:"59.4863",gradientUnits:"userSpaceOnUse",children:[S.jsx("stop",{stopColor:"#BFF9B4"}),S.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),S.jsxs("linearGradient",{id:"orxModalD",x1:"232.804",y1:"214.569",x2:"158.724",y2:"85.4864",gradientUnits:"userSpaceOnUse",children:[S.jsx("stop",{stopColor:"#80EE64"}),S.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),S.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),S.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),S.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),S.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),S.jsx("stop",{offset:"1",stopColor:"#09AF58"})]})]})]})}function ZM({size:e=16}){return S.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#326CE5","aria-hidden":"true",children:S.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-.5-.623h-.804l-.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-.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-.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-.52.123-.736-.172-.216-.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-.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-.555-.5-.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-.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-.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-.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 QM({kind:e,size:t=16}){switch(e){case"modal_job":return S.jsx(KM,{size:t});case"hf_job":return S.jsx(XM,{size:t});case"k8s_job":return S.jsx(ZM,{size:t});case"ssh_job":return S.jsx(bp,{size:t});case"slurm_job":return S.jsx(hA,{size:t});case"openresearch_job":return S.jsx(vA,{size:t});case"local_job":return S.jsx(zA,{size:t});default:return S.jsx(bp,{size:t})}}function JM({backend:e}){const t=HS(e),n=FS(e);return t?S.jsxs("span",{className:"backend-badge",children:[S.jsx(QM,{kind:t}),S.jsx("span",{className:"backend-name",children:WM(t)}),n&&S.jsx("span",{className:"backend-detail mono",children:n})]}):S.jsx("span",{className:"backend-badge muted",children:"—"})}const N1={done:{className:"st-done",live:!1},failed:{className:"st-failed",live:!1},running:{className:"st-running",live:!0},starting:{className:"st-starting",live:!0},cancelled:{className:"st-cancelled",live:!1},editing:{className:"st-editing",live:!0},idle:{className:"st-idle",live:!1}};function eL(e){return N1[e]??N1.idle}function Bo({status:e,label:t}){const n=eL(e);return S.jsxs("span",{className:`status-badge ${n.className}${n.live?" live":""}`,children:[S.jsx("span",{className:"dot"}),t??e]})}function tp(e){return e.installed&&e.authenticated?{cls:"ok",label:"Connected"}:e.installed?{cls:"warn",label:"Not signed in"}:{cls:"warn",label:"Not installed"}}function tL({h:e}){return e.authMethod?S.jsx(S.Fragment,{children:e.authMethod==="oauth"?"OAuth (subscription login)":"API key"}):S.jsx(S.Fragment,{children:"—"})}function nL(){const[e,t]=W.useState(null),[n,r]=W.useState("claude-code"),[a,l]=W.useState(!1),c=u=>{l(!0),gg(u).then(t).catch(()=>{}).finally(()=>l(!1))};W.useEffect(()=>c(!1),[]);const o=e==null?void 0:e.find(u=>u.id===n);return S.jsxs(S.Fragment,{children:[S.jsx("h1",{children:"Harnesses"}),S.jsx("p",{className:"settings-sub",children:"Coding-agent setups detected on this machine. The research agent chat is served by OpenCode; Claude Code and Codex accounts surface their models in the composer's model picker."}),S.jsx("div",{className:"harness-tabs",children:(e??[]).map(u=>S.jsxs("button",{className:u.id===n?"active":"",onClick:()=>r(u.id),children:[u.name,S.jsx("span",{className:`harness-dot ${tp(u).cls}`})]},u.id))}),e?o?S.jsxs("div",{className:"settings-card",children:[S.jsxs("div",{className:"settings-card-head",children:[S.jsx("span",{className:`badge ${tp(o).cls}`,children:tp(o).label}),S.jsx("div",{className:"spacer",style:{flex:1}}),S.jsxs("button",{className:"btn sm",onClick:()=>c(!0),disabled:a,children:[S.jsx(du,{size:12,className:a?"spin":""})," Refresh"]})]}),S.jsxs("div",{className:"kv",children:[S.jsx("span",{className:"k",children:"Binary"}),S.jsx("span",{className:"v",children:o.binPath??"not found on PATH"}),S.jsx("span",{className:"k",children:"Version"}),S.jsx("span",{className:"v",children:o.version??"—"}),S.jsx("span",{className:"k",children:"Auth"}),S.jsx("span",{className:"v",children:S.jsx(tL,{h:o})}),o.account&&S.jsxs(S.Fragment,{children:[S.jsx("span",{className:"k",children:o.id==="opencode"?"Providers":"Account"}),S.jsx("span",{className:"v",children:o.account})]}),o.org&&S.jsxs(S.Fragment,{children:[S.jsx("span",{className:"k",children:"Org"}),S.jsx("span",{className:"v",children:o.org})]}),o.plan&&S.jsxs(S.Fragment,{children:[S.jsx("span",{className:"k",children:"Plan"}),S.jsx("span",{className:"v",children:o.plan})]}),S.jsx("span",{className:"k",children:"Agent models"}),S.jsx("span",{className:"v",children:o.models.length>0?`${o.models.length} available — ${o.models.slice(0,4).map(u=>pu(u.id)).join(", ")}${o.models.length>4?", …":""}`:"none"})]}),!o.agentReady&&o.agentNote&&S.jsx("p",{className:"settings-note",children:o.agentNote})]}):null:S.jsxs("div",{className:"settings-loading",children:[S.jsx("span",{className:"spinner"})," Detecting harnesses…"]})]})}function iL({s:e}){if(!e.configured)return S.jsx("span",{className:"badge",children:"not configured"});const t=e.preflight;return t.kubectlFound?t.reachable?t.canCreateJobs?S.jsx("span",{className:"badge ok",children:"connected"}):S.jsx("span",{className:"badge err",children:"no job-create permission"}):S.jsx("span",{className:"badge err",children:"cluster unreachable"}):S.jsx("span",{className:"badge err",children:"kubectl not found"})}function rL(){const[e,t]=W.useState(null),[n,r]=W.useState(null),[a,l]=W.useState(""),[c,o]=W.useState(""),[u,f]=W.useState(!1),[g,d]=W.useState(null),m=C=>{t(C),l(C.context??""),o(C.namespace)};W.useEffect(()=>{vT().then(m).catch(C=>r(C instanceof Error?C.message:String(C)))},[]);const _=e!==null&&a===(e.context??"")&&c.trim()===e.namespace;async function w(C){if(C.preventDefault(),!u){f(!0),d(null);try{m(await yT({context:a,namespace:c.trim()}))}catch(y){d(y instanceof Error?y.message:String(y))}finally{f(!1)}}}return S.jsxs(S.Fragment,{children:[S.jsxs("p",{className:"settings-sub",children:[S.jsx("strong",{children:"Kubernetes"})," — run on your own cluster with ",S.jsx("code",{children:"--backend k8s"}),". The run's resources (image, GPUs, topology) come from a manifest committed on the experiment branch (default ",S.jsx("code",{children:".orx/k8s.yaml"}),"); only the cluster context and namespace live here. Auth comes from your kubeconfig."]}),n?S.jsx("div",{className:"settings-card",children:S.jsx("div",{className:"error",children:n})}):e?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"settings-card",children:[S.jsxs("div",{className:"settings-card-head",children:[S.jsx("h3",{children:"Kubernetes cluster"}),S.jsx("div",{className:"spacer",style:{flex:1}}),S.jsx(iL,{s:e})]}),e.preflight.error&&S.jsx("p",{className:"settings-note",children:e.preflight.error}),S.jsxs("form",{className:"form settings-form",onSubmit:w,children:[S.jsxs("div",{className:"row2",children:[S.jsxs("label",{children:["Context",S.jsxs("select",{value:a,onChange:C=>l(C.target.value),children:[S.jsxs("option",{value:"",children:["kubectl default",e.currentContext?` (${e.currentContext})`:""]}),e.contexts.map(C=>S.jsx("option",{value:C,children:C},C))]})]}),S.jsxs("label",{children:["Namespace",S.jsx("input",{className:"mono",type:"text",value:c,onChange:C=>o(C.target.value),placeholder:"default",autoComplete:"off",spellCheck:!1})]})]}),g&&S.jsx("div",{className:"error",children:g}),S.jsx("div",{className:"actions",children:S.jsx("button",{type:"submit",className:"btn primary",disabled:u||_,children:u?"Saving…":"Save"})})]})]}),S.jsxs("div",{className:"settings-card",children:[S.jsx("div",{className:"settings-card-head",children:S.jsx("h3",{children:"Run manifest"})}),S.jsxs("p",{className:"settings-sub",children:["Each run applies the manifest committed on its experiment branch — default"," ",S.jsx("code",{children:".orx/k8s.yaml"}),", or ",S.jsx("code",{children:"--manifest "}),". It declares whatever the run needs (image, GPU requests, an Indexed Job across nodes, extra Services, …); orx injects the run script as ",S.jsx("code",{children:"$ORX_SCRIPT"}),", the"," ",S.jsx("code",{children:"orx-env"})," Secret, run labels, and a default timeout, and requires exactly one Job (or one labelled ",S.jsx("code",{children:'orx-primary: "true"'}),") whose completion is the run's. Logs follow that Job's leader pod. Use"," ",S.jsx("code",{children:"{{ORX_RUN}}"})," in resource names to keep re-runs collision-free."]})]})]}):S.jsxs("div",{className:"settings-loading",children:[S.jsx("span",{className:"spinner"})," Checking kubectl…"]})]})}const sL={env:"MODAL_TOKEN_ID env var",syncedEnv:"~/.openresearch/env",modalToml:"~/.modal.toml (modal token new)"};function aL({s:e}){return e.ready?S.jsx("span",{className:"badge ok",children:"connected"}):!e.tokenConfigured&&!e.modalImportable?S.jsx("span",{className:"badge",children:"not set up"}):e.modalImportable?e.tokenConfigured?S.jsx("span",{className:"badge",children:"unknown"}):S.jsx("span",{className:"badge err",children:"no token"}):S.jsx("span",{className:"badge err",children:e.envProvisioned?"env broken":"env not built"})}function oL(){const[e,t]=W.useState(null),[n,r]=W.useState(null),[a,l]=W.useState(!1),[c,o]=W.useState(null);W.useEffect(()=>{bT().then(t).catch(f=>r(f instanceof Error?f.message:String(f)))},[]);async function u(){if(!a){l(!0),o(null);try{t(await ST())}catch(f){o(f instanceof Error?f.message:String(f))}finally{l(!1)}}}return S.jsxs("div",{className:"settings-card",children:[S.jsxs("div",{className:"settings-card-head",children:[S.jsx("h3",{children:"Modal"}),S.jsx("div",{className:"spacer",style:{flex:1}}),e&&S.jsx(aL,{s:e})]}),S.jsxs("p",{className:"settings-sub",children:["Serverless GPUs on your own Modal account with"," ",S.jsx("code",{children:"--backend modal --flavor "})," (t4, a10g, a100-80gb, h100, …). orx manages a dedicated Python env with the Modal SDK; sandboxes scale to zero between runs."]}),n?S.jsx("div",{className:"error",children:n}):e?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"kv",children:[S.jsx("span",{className:"k",children:"Environment"}),S.jsx("span",{className:"v",children:e.modalImportable?"ready":e.envProvisioned?"provisioned (modal import failing)":"not built yet"}),S.jsx("span",{className:"k",children:"Token"}),S.jsx("span",{className:"v",children:e.tokenSource?sL[e.tokenSource]:"not configured"})]}),!e.tokenConfigured&&S.jsxs("p",{className:"settings-note",children:["No Modal token found. Run ",S.jsx("code",{children:"modal token new"}),", or add"," ",S.jsx("code",{children:"MODAL_TOKEN_ID"})," and ",S.jsx("code",{children:"MODAL_TOKEN_SECRET"})," in the Environment tab."]}),e.error&&e.envProvisioned&&!e.modalImportable&&S.jsx("p",{className:"settings-note",children:e.error}),c&&S.jsx("div",{className:"error",children:c}),!e.modalImportable&&S.jsx("div",{className:"actions",children:S.jsx("button",{className:"btn primary",onClick:()=>void u(),disabled:a,children:a?"Setting up… (~30–60s)":"Set up environment"})})]}):S.jsxs("div",{className:"settings-loading",children:[S.jsx("span",{className:"spinner"})," Checking Modal…"]})]})}function lL({test:e}){if(e===void 0)return S.jsx("span",{className:"muted",children:"never tested"});if(e==="testing")return S.jsx("span",{className:"spinner"});const t=e.reachable?e.gitFound?S.jsx("span",{className:"badge ok",children:"ready"}):S.jsx("span",{className:"badge err",children:"no git"}):S.jsx("span",{className:"badge err",title:e.error??void 0,children:"unreachable"});return S.jsxs(S.Fragment,{children:[t,S.jsx("span",{className:"ssh-tested-at",children:fa(e.testedAt)})]})}function cL(){const[e,t]=W.useState(null),[n,r]=W.useState({});W.useEffect(()=>{CT().then(t).catch(()=>t([]))},[]);async function a(l){r(c=>({...c,[l]:"testing"}));try{const c=await ET(l);r(o=>({...o,[l]:c}))}catch(c){r(o=>({...o,[l]:{reachable:!1,gitFound:!1,error:c instanceof Error?c.message:String(c),testedAt:Date.now()}}))}}return S.jsxs("div",{className:"settings-card",children:[S.jsx("h3",{children:"SSH hosts"}),S.jsxs("p",{className:"settings-sub",children:["Run experiments directly on your own boxes with"," ",S.jsx("code",{children:"--backend ssh --host "}),". Hosts come from"," ",S.jsx("code",{children:"~/.ssh/config"}),"; auth uses your keys/agent (orx never reads a key). The host just needs ",S.jsx("code",{children:"git"})," and ",S.jsx("code",{children:"bash"}),"."]}),e===null?S.jsxs("div",{className:"settings-loading",children:[S.jsx("span",{className:"spinner"})," Reading ~/.ssh/config…"]}):e.length===0?S.jsx("p",{className:"settings-empty",children:"No hosts found in ~/.ssh/config."}):S.jsxs("table",{className:"flavor-table ssh-table",children:[S.jsx("thead",{children:S.jsxs("tr",{children:[S.jsx("th",{children:"Host"}),S.jsx("th",{children:"Address"}),S.jsx("th",{children:"Identity"}),S.jsx("th",{children:"Status"}),S.jsx("th",{})]})}),S.jsx("tbody",{children:e.map(l=>S.jsxs("tr",{children:[S.jsx("td",{className:"mono",children:l.host}),S.jsxs("td",{className:"mono muted",children:[[l.user,l.hostname??"—"].filter(Boolean).join("@"),l.port?`:${l.port}`:""]}),S.jsx("td",{className:"mono muted",children:l.identityFile??"—"}),S.jsx("td",{children:S.jsx(lL,{test:n[l.host]??l.lastTest})}),S.jsx("td",{children:S.jsx("button",{className:"btn sm",onClick:()=>void a(l.host),disabled:n[l.host]==="testing",children:"Test"})})]},l.host))})]})]})}function uL({test:e}){return e===null?null:e==="testing"?S.jsx("span",{className:"spinner"}):e.reachable?e.slurmFound?e.gitFound?S.jsx("span",{className:"badge ok",children:"ready"}):S.jsx("span",{className:"badge err",children:"no git"}):S.jsx("span",{className:"badge err",children:"no slurm CLI"}):S.jsx("span",{className:"badge err",title:e.error??void 0,children:"unreachable"})}function hL(){const[e,t]=W.useState(null),[n,r]=W.useState(null),[a,l]=W.useState(""),[c,o]=W.useState(""),[u,f]=W.useState(""),[g,d]=W.useState(""),[m,_]=W.useState(!1),[w,C]=W.useState(null),[y,b]=W.useState(null),x=y!==null&&y!=="testing"?y:null,v=R=>{t(R),l(R.host??""),o(R.partition??""),f(R.account??""),d(R.timeLimit??"")};W.useEffect(()=>{kT().then(v).catch(R=>r(R instanceof Error?R.message:String(R)))},[]);const k=e!==null&&a===(e.host??"")&&c.trim()===(e.partition??"")&&u.trim()===(e.account??"")&&g.trim()===(e.timeLimit??"");async function D(R){if(R.preventDefault(),!m){_(!0),C(null);try{v(await AT({host:a,partition:c.trim(),account:u.trim(),timeLimit:g.trim()}))}catch(N){C(N instanceof Error?N.message:String(N))}finally{_(!1)}}}async function T(R){b("testing");try{b(await TT(R))}catch(N){b({reachable:!1,slurmFound:!1,gitFound:!1,partitions:[],error:N instanceof Error?N.message:String(N)})}}return S.jsxs(S.Fragment,{children:[S.jsxs("p",{className:"settings-sub",children:[S.jsx("strong",{children:"Slurm"})," — run on your own cluster with"," ",S.jsx("code",{children:"--backend slurm [--flavor h100:2]"}),". orx submits via ",S.jsx("code",{children:"sbatch"})," on the login node over ssh (auth is your keys/agent; orx never reads a key) and the job runs in your cluster environment. The defaults below apply when a launch doesn't override them."]}),n?S.jsx("div",{className:"settings-card",children:S.jsx("div",{className:"error",children:n})}):e?S.jsxs("div",{className:"settings-card",children:[S.jsxs("div",{className:"settings-card-head",children:[S.jsx("h3",{children:"Slurm cluster"}),S.jsx("div",{className:"spacer",style:{flex:1}}),S.jsx(uL,{test:y})]}),(x==null?void 0:x.error)&&S.jsx("p",{className:"settings-note",children:x.error}),x&&x.partitions.length>0&&S.jsxs("p",{className:"settings-note",children:["Partitions: ",S.jsx("code",{children:x.partitions.join(", ")})]}),S.jsxs("form",{className:"form settings-form",onSubmit:D,children:[S.jsxs("div",{className:"row2",children:[S.jsxs("label",{children:["Login node",S.jsxs("select",{value:a,onChange:R=>{l(R.target.value),b(null)},children:[S.jsx("option",{value:"",children:"not set (pass --host per launch)"}),a&&!e.hosts.some(R=>R.host===a)&&S.jsxs("option",{value:a,children:[a," (not in ~/.ssh/config)"]}),e.hosts.map(R=>S.jsx("option",{value:R.host,children:R.host},R.host))]})]}),S.jsxs("label",{children:["Partition",S.jsx("input",{className:"mono",type:"text",list:"slurm-partitions",value:c,onChange:R=>o(R.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1}),S.jsx("datalist",{id:"slurm-partitions",children:x==null?void 0:x.partitions.map(R=>S.jsx("option",{value:R},R))})]})]}),S.jsxs("div",{className:"row2",children:[S.jsxs("label",{children:["Account",S.jsx("input",{className:"mono",type:"text",value:u,onChange:R=>f(R.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1})]}),S.jsxs("label",{children:["Time limit",S.jsx("input",{className:"mono",type:"text",value:g,onChange:R=>d(R.target.value),placeholder:"cluster default (e.g. 4h, 30m)",autoComplete:"off",spellCheck:!1})]})]}),w&&S.jsx("div",{className:"error",children:w}),S.jsxs("div",{className:"actions",children:[S.jsx("button",{type:"submit",className:"btn primary",disabled:m||k,children:m?"Saving…":"Save"}),S.jsx("button",{type:"button",className:"btn",onClick:()=>void T(a),disabled:!a||y==="testing",title:a?void 0:"Pick a login node first",children:"Test connection"})]})]})]}):S.jsxs("div",{className:"settings-loading",children:[S.jsx("span",{className:"spinner"})," Loading slurm settings…"]})]})}const fL=[{id:"hf",label:"HF Jobs"},{id:"modal",label:"Modal"},{id:"k8s",label:"Kubernetes"},{id:"ssh",label:"SSH"},{id:"slurm",label:"Slurm"}];function dL(){const[e,t]=W.useState("hf");return S.jsxs(S.Fragment,{children:[S.jsx("h1",{children:"Compute"}),S.jsxs("p",{className:"settings-sub",children:["Run experiments on external compute with"," ",S.jsx("code",{children:"--backend --flavor "}),"."]}),S.jsx("div",{className:"harness-tabs",children:fL.map(n=>S.jsx("button",{className:n.id===e?"active":"",onClick:()=>t(n.id),children:n.label},n.id))}),e==="hf"&&S.jsx(_L,{}),e==="modal"&&S.jsx(oL,{}),e==="k8s"&&S.jsx(rL,{}),e==="ssh"&&S.jsx(cL,{}),e==="slurm"&&S.jsx(hL,{})]})}const pL={env:"HF_TOKEN env var",openresearchEnv:"~/.openresearch/env",hfCache:"~/.cache/huggingface/token (hf auth login)"};function gL({settings:e}){return e.configured?e.valid?S.jsx("span",{className:"badge ok",children:"connected"}):S.jsx("span",{className:"badge err",children:"invalid token"}):S.jsx("span",{className:"badge",children:"not configured"})}function mL({settings:e}){return!e.configured||!e.valid?null:e.jobsWrite===!0?S.jsx("span",{className:"badge ok",children:"jobs: write OK"}):e.jobsWrite===!1?S.jsx("span",{className:"badge err",children:"no job.write permission"}):S.jsx("span",{className:"badge",children:"jobs permission unknown"})}function _L(){const[e,t]=W.useState(null),[n,r]=W.useState(null),[a,l]=W.useState(""),[c,o]=W.useState(!1),[u,f]=W.useState(null),g=W.useRef(!1);W.useEffect(()=>{mT().then(m=>{g.current||t(m)}).catch(m=>{g.current||r(m instanceof Error?m.message:String(m))})},[]);async function d(m){if(m.preventDefault(),!(!a.trim()||c)){o(!0),f(null);try{const _=await _T(a.trim());g.current=!0,t(_),r(null),l("")}catch(_){f(_ instanceof Error?_.message:String(_))}finally{o(!1)}}}return S.jsxs("div",{className:"settings-card",children:[S.jsxs("div",{className:"settings-card-head",children:[S.jsx("h3",{children:"Hugging Face Jobs"}),S.jsx("div",{className:"spacer",style:{flex:1}}),e&&S.jsx(gL,{settings:e})]}),S.jsxs("p",{className:"settings-sub",children:["Run experiments on your Hugging Face account with"," ",S.jsx("code",{children:"--backend hf --flavor "})," (t4-small, a10g-small, a100-large, …). Billed to HF per minute."]}),n?S.jsx("div",{className:"error",children:n}):e?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"kv",children:[S.jsx("span",{className:"k",children:"Account"}),S.jsx("span",{className:"v",children:e.username??"—"}),S.jsx("span",{className:"k",children:"Token"}),S.jsx("span",{className:"v",children:e.maskedToken??"—"}),S.jsx("span",{className:"k",children:"Source"}),S.jsx("span",{className:"v",children:e.source?pL[e.source]:"not configured"}),S.jsx("span",{className:"k",children:"Jobs"}),S.jsxs("span",{className:"v",children:[S.jsx(mL,{settings:e}),(!e.configured||!e.valid)&&"—"]})]}),e.source==="env"&&S.jsx("p",{className:"settings-note",children:"HF_TOKEN is set in the environment and overrides any token saved here."}),e.valid&&e.jobsWrite===null&&S.jsxs("p",{className:"settings-note",children:["This token is valid but doesn't report whether it can launch Jobs — OAuth tokens from ",S.jsx("code",{children:"hf auth login"})," never do. Launches may still work; for a definitive check, save a write-scoped token from"," ",S.jsx("a",{href:"https://huggingface.co/settings/tokens",target:"_blank",rel:"noreferrer",children:"huggingface.co/settings/tokens"}),"."]})]}):S.jsxs("div",{className:"settings-loading",children:[S.jsx("span",{className:"spinner"})," Loading status…"]}),S.jsxs("form",{className:"form settings-form",onSubmit:d,children:[S.jsxs("label",{children:[e!=null&&e.configured?"Replace token":"New token",S.jsx("input",{type:"password",value:a,onChange:m=>l(m.target.value),placeholder:"hf_…",autoComplete:"off"})]}),u&&S.jsx("div",{className:"error",children:u}),S.jsx("div",{className:"actions",children:S.jsx("button",{type:"submit",className:"btn primary",disabled:!a.trim()||c,children:c?"Validating…":"Save"})})]})]})}const ow=/^hf_[A-Za-z0-9]{10,}$/;function lw(){return S.jsx("tr",{children:S.jsx("td",{colSpan:3,children:S.jsxs("p",{className:"settings-note",children:["This value looks like a Hugging Face token — compute runs only read it from"," ",S.jsx("code",{children:"HF_TOKEN"}),". Save it under that key if it's meant for HF Jobs."]})})})}const D1=["HF_TOKEN","WANDB_API_KEY"];function vL({name:e,entry:t,onVars:n,onError:r}){const[a,l]=W.useState(""),[c,o]=W.useState(!1),u=d=>r(`${e}: ${d instanceof Error?d.message:String(d)}`);async function f(){if(!(!a.trim()||c)){o(!0);try{n(await IS(e,a.trim())),l("")}catch(d){u(d)}finally{o(!1)}}}async function g(){if(!c){o(!0);try{n(await wT(e))}catch(d){u(d)}finally{o(!1)}}}return S.jsxs(S.Fragment,{children:[S.jsxs("tr",{children:[S.jsx("td",{className:"mono",children:e}),S.jsx("td",{className:"mono muted",children:t?S.jsxs(S.Fragment,{children:[t.maskedValue,t.inProcessEnv&&S.jsx("span",{className:"badge",children:"overridden by env"})]}):S.jsx("input",{className:"mono",type:"password",value:a,onChange:d=>l(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),f()),d.key==="Escape"&&!c&&l("")},placeholder:"value","aria-label":`Value for ${e}`,autoComplete:"new-password",disabled:c})}),S.jsx("td",{children:t?S.jsx("button",{className:"icon-btn",title:`Delete ${e}`,"aria-label":`Delete ${e}`,onClick:()=>void g(),disabled:c,children:S.jsx(Bu,{size:13})}):a.trim()&&S.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:c,children:c?"Saving…":"Save"})})]}),!t&&e!=="HF_TOKEN"&&ow.test(a.trim())&&S.jsx(lw,{})]})}function yL({onVars:e,onError:t,onDone:n}){const[r,a]=W.useState(""),[l,c]=W.useState(""),[o,u]=W.useState(!1);async function f(){if(!(!r.trim()||!l.trim()||o)){u(!0);try{e(await IS(r.trim(),l.trim())),n()}catch(d){t(`${r.trim()}: ${d instanceof Error?d.message:String(d)}`)}finally{u(!1)}}}const g=d=>{d.key==="Enter"&&(d.preventDefault(),f()),d.key==="Escape"&&!o&&n()};return S.jsxs(S.Fragment,{children:[S.jsxs("tr",{children:[S.jsx("td",{children:S.jsx("input",{autoFocus:!0,className:"mono",type:"text",value:r,onChange:d=>a(d.target.value),onKeyDown:g,placeholder:"MY_API_KEY","aria-label":"New variable key",autoComplete:"off",spellCheck:!1,disabled:o})}),S.jsx("td",{children:S.jsx("input",{className:"mono",type:"password",value:l,onChange:d=>c(d.target.value),onKeyDown:g,placeholder:"value","aria-label":"New variable value",autoComplete:"new-password",disabled:o})}),S.jsxs("td",{children:[S.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:o||!r.trim()||!l.trim(),children:o?"Saving…":"Save"}),S.jsx("button",{className:"icon-btn",title:"Cancel","aria-label":"Cancel new variable",onClick:n,disabled:o,children:S.jsx(Ro,{size:13})})]})]}),r.trim()!=="HF_TOKEN"&&ow.test(l.trim())&&S.jsx(lw,{})]})}function bL(){const[e,t]=W.useState(null),[n,r]=W.useState(null),[a,l]=W.useState(!1),[c,o]=W.useState(null);W.useEffect(()=>{xT().then(t).catch(d=>r(d instanceof Error?d.message:String(d)))},[]);const u=d=>{t(d),o(null)},f=e===null?[]:e.map(d=>d.key).filter(d=>!D1.includes(d)),g=[...D1,...f];return S.jsxs("div",{className:"settings-card",children:[S.jsxs("div",{className:"settings-card-head",children:[S.jsx("h3",{children:"Environment variables"}),S.jsx("div",{className:"spacer",style:{flex:1}}),S.jsxs("button",{className:"btn sm",onClick:()=>l(!0),disabled:a||e===null,children:[S.jsx(pg,{size:12})," Add variable"]})]}),S.jsxs("p",{className:"settings-sub",children:["Stored in ",S.jsx("code",{children:"~/.openresearch/env"})," and passed to runs and the research agent."," ",S.jsx("code",{children:"HF_TOKEN"})," and ",S.jsx("code",{children:"WANDB_API_KEY"})," are always listed since runs typically need them. Variables set in orx's own environment win on conflicts."]}),n?S.jsx("div",{className:"error",children:n}):e===null?S.jsxs("div",{className:"settings-loading",children:[S.jsx("span",{className:"spinner"})," Loading…"]}):S.jsx("table",{className:"env-table",children:S.jsxs("tbody",{children:[g.map(d=>S.jsx(vL,{name:d,entry:e.find(m=>m.key===d),onVars:u,onError:o},d)),a&&S.jsx(yL,{onVars:u,onError:o,onDone:()=>l(!1)})]})}),c&&S.jsx("div",{className:"error",children:c})]})}function SL(){const[e,t]=W.useState(null),[n,r]=W.useState(""),[a,l]=W.useState(""),[c,o]=W.useState(!1),[u,f]=W.useState(null);W.useEffect(()=>{zS().then(m=>{t(m),r(m.userName??""),l(m.userEmail??"")}).catch(()=>{})},[]);const g=e!==null&&n.trim()===(e.userName??"")&&a.trim()===(e.userEmail??"");async function d(m){if(m.preventDefault(),!(c||g)){o(!0),f(null);try{const _=await RT({userName:n.trim(),userEmail:a.trim()});t(_),r(_.userName??""),l(_.userEmail??"")}catch(_){f(_ instanceof Error?_.message:String(_))}finally{o(!1)}}}return S.jsxs(S.Fragment,{children:[S.jsx("h1",{children:"Git"}),S.jsx("p",{className:"settings-sub",children:"Experiment branches are committed and pushed from local clones with this identity."}),e?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"settings-card",children:[S.jsx("h3",{children:"Identity"}),S.jsxs("form",{className:"form",onSubmit:d,children:[S.jsxs("div",{className:"row2",children:[S.jsxs("label",{children:["user.name",S.jsx("input",{type:"text",value:n,onChange:m=>r(m.target.value),autoComplete:"off"})]}),S.jsxs("label",{children:["user.email",S.jsx("input",{type:"text",value:a,onChange:m=>l(m.target.value),autoComplete:"off"})]})]}),u&&S.jsx("div",{className:"error",children:u}),S.jsx("div",{className:"actions",children:S.jsx("button",{type:"submit",className:"btn primary",disabled:c||g||!n.trim()&&!a.trim(),children:c?"Saving…":"Save"})})]})]}),S.jsxs("div",{className:"settings-card",children:[S.jsx("h3",{children:"GitHub access"}),S.jsxs("div",{className:"kv",children:[S.jsx("span",{className:"k",children:"git"}),S.jsx("span",{className:"v",children:e.gitVersion??"not found"}),S.jsx("span",{className:"k",children:"Token"}),S.jsx("span",{className:"v",children:e.githubTokenSource==="env"?"GITHUB_TOKEN env var":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"gh CLI (gh auth token)":"none found"})]}),!e.githubTokenSource&&S.jsxs(S.Fragment,{children:[S.jsxs("p",{className:"settings-note",children:["No GitHub token found — private repo clones and branch pushes will fail. Run"," ",S.jsx("code",{children:"gh auth login"}),", or paste a personal access token:"]}),S.jsx(aw,{onSaved:t})]}),e.githubTokenSource==="stored"&&S.jsx("div",{className:"actions",children:S.jsx("button",{className:"btn",onClick:()=>{LT().then(t).catch(()=>{})},children:"Remove saved token"})})]})]}):S.jsxs("div",{className:"settings-loading",children:[S.jsx("span",{className:"spinner"})," Loading…"]})]})}const Ip=e=>e==="running"||e==="starting";function xL(e){return Ip(e.status)?Ry(Date.now()-e.createdAt):e.endedAt?Ry(e.endedAt-e.createdAt):"—"}function R1({instances:e,emptyLabel:t}){return e.length===0?S.jsx("p",{className:"instances-empty",children:t}):S.jsx("div",{className:"instances-table-wrap",children:S.jsxs("table",{className:"runs-table",children:[S.jsx("thead",{children:S.jsxs("tr",{children:[S.jsx("th",{children:"Backend"}),S.jsx("th",{children:"Project"}),S.jsx("th",{children:"Status"}),S.jsx("th",{children:"Started"}),S.jsx("th",{children:"Runtime"})]})}),S.jsx("tbody",{children:e.map(n=>{var a;const r=typeof((a=n.backend)==null?void 0:a.url)=="string"?n.backend.url:void 0;return S.jsxs("tr",{children:[S.jsx("td",{children:S.jsxs("span",{className:"backend-cell",children:[S.jsx(JM,{backend:n.backend}),r&&S.jsx("a",{className:"icon-btn",href:r,target:"_blank",rel:"noreferrer",title:"Open job page","aria-label":"Open job page",onClick:l=>l.stopPropagation(),children:S.jsx(DS,{size:12})})]})}),S.jsx("td",{children:n.projectName??xp(n.projectId)}),S.jsx("td",{children:S.jsx(Bo,{status:n.status})}),S.jsx("td",{children:fa(n.createdAt)}),S.jsx("td",{className:"mono",children:xL(n)})]},n.id)})})]})})}function wL(){const[e,t]=W.useState(null),[n,r]=W.useState(null),[a,l]=W.useState(!1),[,c]=W.useState(0);W.useEffect(()=>{const d=setInterval(()=>c(m=>m+1),3e4);return()=>clearInterval(d)},[]);const o=()=>{l(!0),hT().then(d=>{t(d),r(null)}).catch(d=>{r(d instanceof Error?d.message:String(d)),t(m=>m??[])}).finally(()=>l(!1))};W.useEffect(()=>o(),[]);const u=(d,m)=>m.createdAt-d.createdAt,f=e==null?void 0:e.filter(d=>Ip(d.status)).sort(u),g=e==null?void 0:e.filter(d=>!Ip(d.status)).sort(u);return S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"settings-head-row",children:[S.jsx("h1",{children:"Instances"}),S.jsxs("button",{className:"btn sm",onClick:o,disabled:a,children:[S.jsx(du,{size:12,className:a?"spin":""})," Refresh"]})]}),S.jsx("p",{className:"settings-sub",children:"Compute spun up across all projects — Modal, Hugging Face, SSH, Kubernetes, Slurm, and OpenResearch."}),n&&S.jsx("div",{className:"error",children:n}),!f||!g?S.jsxs("div",{className:"settings-loading",children:[S.jsx("span",{className:"spinner"})," Loading…"]}):S.jsxs(S.Fragment,{children:[S.jsxs("h2",{className:"instances-section-title",children:["Running",f.length>0&&S.jsx("span",{className:"count-badge",children:f.length})]}),S.jsx(R1,{instances:f,emptyLabel:"Nothing running right now."}),S.jsx("h2",{className:"instances-section-title",children:"Past"}),S.jsx(R1,{instances:g,emptyLabel:"No past instances yet."})]})]})}const CL=[{id:"harnesses",label:"Harnesses",icon:S.jsx(cA,{size:15})},{id:"compute",label:"Compute",icon:S.jsx(EA,{size:15})},{id:"instances",label:"Instances",icon:S.jsx(bp,{size:15})},{id:"environment",label:"Environment",icon:S.jsx(JA,{size:15})},{id:"git",label:"Git",icon:S.jsx(ju,{size:15})}];function EL({tab:e}){return S.jsxs("div",{className:"settings-view",children:[e==="harnesses"&&S.jsx(nL,{}),e==="compute"&&S.jsx(dL,{}),e==="environment"&&S.jsxs(S.Fragment,{children:[S.jsx("h1",{children:"Environment"}),S.jsx("p",{className:"settings-sub",children:"Variables available to runs and the research agent (API keys, tokens)."}),S.jsx(bL,{})]}),e==="instances"&&S.jsx(wL,{}),e==="git"&&S.jsx(SL,{})]})}function kL({skills:e,activeIndex:t,onPick:n,onHover:r}){return S.jsx("div",{className:"skill-menu",children:e.map((a,l)=>S.jsxs("button",{type:"button",className:`skill-item ${l===t?"active":""}`,onMouseDown:c=>{c.preventDefault(),n(a)},onMouseEnter:()=>r(l),children:[S.jsxs("span",{className:"skill-name",children:["/",a.name," ",S.jsx("span",{className:"skill-hint",children:a.argHint})]}),S.jsx("span",{className:"skill-desc",children:a.description})]},a.name))})}const cw={"claude-code":"Claude Code",codex:"Codex",opencode:"OpenCode"};function M1(e){var n,r,a;const t=e.find(l=>l.agentReady);return t?{harness:t.id,model:((n=t.models[0])==null?void 0:n.id)??null,permissionMode:((r=t.options)==null?void 0:r.defaultPermissionMode)??null,reasoningLevel:((a=t.options)==null?void 0:a.defaultReasoningLevel)??null}:null}function Yu(){const[e,t]=W.useState(!1),n=W.useRef(null);return W.useEffect(()=>{if(!e)return;const r=l=>{var c;(c=n.current)!=null&&c.contains(l.target)||t(!1)},a=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t(!1))};return document.addEventListener("mousedown",r),document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",a,!0)}},[e]),{open:e,setOpen:t,ref:n}}function AL({value:e,onSelect:t,onHarnesses:n,lockHarness:r=!1}){const[a,l]=W.useState([]),{open:c,setOpen:o,ref:u}=Yu(),[f,g]=W.useState("");W.useEffect(()=>{gg().then(w=>{l(w),n==null||n(w)}).catch(()=>{})},[]);const d=W.useMemo(()=>{const w=f.trim().toLowerCase();return(r&&e?a.filter(y=>y.id===e.harness):a).map(y=>{let b=y.models;return w?b=b.filter(x=>x.id.toLowerCase().includes(w)):y.id==="opencode"&&(b=b.slice(0,6)),{harness:y,models:b,hidden:w?0:y.models.length-b.length}})},[a,f,r,e]),m=(w,C)=>{var b,x;const y=(e==null?void 0:e.harness)===w.id;t({harness:w.id,model:C,permissionMode:y?e.permissionMode:((b=w.options)==null?void 0:b.defaultPermissionMode)??null,reasoningLevel:y?e.reasoningLevel:((x=w.options)==null?void 0:x.defaultReasoningLevel)??null}),o(!1),g("")},_=e?e.model?pu(e.model):"Default model":"Model";return S.jsxs("div",{className:"model-picker",ref:u,children:[S.jsxs("button",{type:"button",className:"composer-pill",title:"Harness + model for this chat",onClick:()=>o(w=>!w),children:[_,S.jsx(Ou,{size:12})]}),c&&S.jsxs("div",{className:"model-menu align-right",children:[S.jsx("input",{autoFocus:!0,type:"text",placeholder:"Search models…",value:f,onChange:w=>g(w.target.value)}),S.jsxs("div",{className:"model-menu-list",children:[d.map(({harness:w,models:C,hidden:y})=>S.jsxs("div",{children:[S.jsx("div",{className:"model-group",children:w.name}),w.agentReady?S.jsxs(S.Fragment,{children:[C.map(b=>S.jsxs("button",{className:"model-item",onClick:()=>m(w,b.id),children:[S.jsxs("span",{children:[pu(b.id),S.jsx("span",{className:"model-id",children:b.id})]}),(e==null?void 0:e.harness)===w.id&&(e==null?void 0:e.model)===b.id&&S.jsx(si,{size:13})]},b.id)),y>0&&S.jsxs("div",{className:"model-more",children:[y," more — search to find"]})]}):S.jsx("div",{className:"model-more",children:w.agentNote??"Not available"})]},w.id)),a.length===0&&S.jsx("div",{className:"model-more",children:"Detecting harnesses…"})]}),r&&e&&a.length>1&&S.jsxs("div",{className:"model-locked-note",children:[S.jsx(FA,{size:11}),"Sessions keep their harness — new chat to switch"]})]})]})}function L1({choices:e,value:t,defaultId:n,header:r,align:a="left",variant:l="pill",title:c,numbered:o=!1,onSelect:u}){var b,x;const{open:f,setOpen:g,ref:d}=Yu();if(e.length===0)return null;const m=t??n??((b=e[0])==null?void 0:b.id)??null,_=e.find(v=>v.id===m),w=e.find(v=>v.id===n),C=(_==null?void 0:_.label)??((x=e[0])==null?void 0:x.label)??"",y=v=>{u(v),g(!1)};return S.jsxs("div",{className:"option-picker",ref:d,children:[S.jsxs("button",{type:"button",className:l==="pill"?"composer-pill":"composer-bare",title:c,onClick:()=>g(v=>!v),children:[C,S.jsx(Ou,{size:12})]}),f&&S.jsxs("div",{className:`option-menu ${a==="right"?"align-right":""}`,children:[r&&S.jsx("div",{className:"model-group",children:r}),w&&S.jsxs(S.Fragment,{children:[S.jsxs("button",{className:"model-item",onClick:()=>y(w.id),children:[S.jsxs("span",{children:[w.label," ",S.jsx("span",{className:"option-default",children:"· Default"})]}),m===w.id&&S.jsx(si,{size:13})]}),S.jsx("div",{className:"option-sep"})]}),e.map((v,k)=>S.jsxs("button",{className:"model-item",onClick:()=>y(v.id),children:[S.jsx("span",{children:v.label}),m===v.id?S.jsx(si,{size:13}):o&&S.jsx("span",{className:"option-num",children:k+1})]},v.id))]})]})}const uw="orx:agent-selection";function TL(){try{const e=localStorage.getItem(uw);return e?JSON.parse(e):null}catch{return null}}const hw="local-";function NL(e,t){const n=e.findIndex(a=>a.id===t.id);if(n>=0){const a=e.slice();return a[n]=t,a}return[...t.role==="user"?e.filter(a=>!a.id.startsWith(hw)):e,t]}function DL(e,t){switch(t.type){case"reset":return{messagesBySession:{},busySessions:new Set};case"seed":return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:t.messages}};case"upsertMessage":{const n=e.messagesBySession[t.sessionId]??[];return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:NL(n,t.message)}}}case"optimisticUser":{const n=e.messagesBySession[t.sessionId]??[],r=t.text?[{id:"p0",type:"text",text:t.text}]:[];t.imageUrls.forEach((l,c)=>r.push({id:`img${c}`,type:"image",text:l}));const a={id:`${hw}${Date.now()}`,role:"user",parts:r,createdAt:Date.now()};return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:[...n,a]}}}case"busy":{const n=new Set(e.busySessions);return t.busy?n.add(t.sessionId):n.delete(t.sessionId),{...e,busySessions:n}}case"seedBusy":return{...e,busySessions:new Set(t.sessions)};case"forget":{const n={...e.messagesBySession};delete n[t.sessionId];const r=new Set(e.busySessions);return r.delete(t.sessionId),{messagesBySession:n,busySessions:r}}}}function RL({harnesses:e,selection:t}){if(e.length===0)return null;const n=t?e.find(r=>r.id===t.harness):void 0;return n?S.jsxs("p",{className:"chat-empty-hint",children:["Chatting with ",n.name,n.account?` as ${n.account}`:""," — detected automatically, switch in the model picker below."]}):S.jsx("p",{className:"chat-empty-hint",children:"No coding agent detected on this machine — install Claude Code, Codex or opencode and sign in, then re-open the model picker below."})}function fw(e){return e==="error"?"tool-status error":e==="completed"?"tool-status":"tool-status running"}function ML(e){if(!e)return"";const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return"now";const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function O1(e){const t=e.replace(/\/+$/,"");return t.slice(t.lastIndexOf("/")+1)||t}function zp(e){var c,o;const t=e.tool??"tool",n=((c=e.state)==null?void 0:c.input)??{},r=typeof n.command=="string"?n.command:null,a=typeof n.filePath=="string"?n.filePath:null,l=typeof n.description=="string"?n.description:null;switch(t){case"Bash":case"bash":return r?`Ran ${r}`:"Ran command";case"Read":return a?`Read ${O1(a)}`:"Read file";case"Edit":case"Write":case"NotebookEdit":return a?`Edited ${O1(a)}`:"Edited file";case"Grep":return typeof n.pattern=="string"?`Searched “${n.pattern}”`:"Searched";case"Glob":return typeof n.pattern=="string"?`Found ${n.pattern}`:"Listed files";case"WebFetch":case"WebSearch":return l??"Searched the web";case"Task":return l??"Ran a subagent";case"error":return"Error";default:{const u=l??a??r??((o=e.state)==null?void 0:o.title)??"";return u?`${t}: ${u}`:t}}}function LL({part:e,onOpenFile:t}){var o,u;const n=e.state,r=(n==null?void 0:n.error)||(n==null?void 0:n.output)||"",a=typeof((o=n==null?void 0:n.input)==null?void 0:o.command)=="string"?n.input.command:null,l=typeof((u=n==null?void 0:n.input)==null?void 0:u.filePath)=="string"?n.input.filePath:null,c=!!(r||a||l);return S.jsxs("details",{className:"tool-row",open:!1,children:[S.jsxs("summary",{children:[S.jsx("span",{className:fw(n==null?void 0:n.status)}),S.jsx("span",{className:"tool-line",children:zp(e)}),l&&t&&S.jsx("button",{className:"tool-open file-link",title:`Open ${l}`,onClick:f=>{f.preventDefault(),f.stopPropagation(),t(l)},children:"open"})]}),c&&S.jsxs("div",{className:"tool-detail",children:[a&&S.jsx("div",{className:"tool-cmd-full",children:a}),r&&S.jsx("div",{className:"tool-output",children:r.slice(0,2e4)})]})]})}function OL({parts:e,onOpenFile:t}){const n=e.some(u=>{var f;return((f=u.state)==null?void 0:f.status)==="running"}),r=e.some(u=>{var f;return((f=u.state)==null?void 0:f.status)==="error"}),[a,l]=W.useState(!1),c=a||n,o=e.length===1?zp(e[0]):n?zp(e.find(u=>{var f;return((f=u.state)==null?void 0:f.status)==="running"})??e[e.length-1]):`Used ${e.length} tools`;return S.jsxs("div",{className:`tool-group ${r?"has-error":""}`,children:[S.jsxs("button",{className:"tool-group-summary",onClick:()=>l(u=>!u),children:[S.jsx("span",{className:fw(n?"running":r?"error":"completed")}),S.jsx("span",{className:"tool-line",children:o}),S.jsx(fg,{size:12,className:`tool-chevron ${c?"open":""}`})]}),c&&S.jsx("div",{className:"tool-group-rows",children:e.map(u=>S.jsx(LL,{part:u,onOpenFile:t},u.id))})]})}function jL({part:e,onRespond:t,onOpenFile:n}){var f,g,d;const r=e.prompt,[a,l]=W.useState([]),c=r.resolved||!t,o=m=>t==null?void 0:t({promptId:e.id,...m});if(r.kind==="plan")return S.jsxs("div",{className:`prompt-card plan ${c?"resolved":""}`,children:[S.jsx("div",{className:"prompt-head",children:"Proposed plan"}),S.jsx("div",{className:"prompt-plan",children:S.jsx(am,{text:r.plan??"",onOpenFile:n})}),c?S.jsx("div",{className:"prompt-resolved",children:"Resolved"}):S.jsxs("div",{className:"prompt-actions",children:[S.jsx("button",{className:"btn-primary",onClick:()=>o({approve:!0,resumeMode:"auto"}),children:"Approve & run"}),S.jsx("button",{className:"btn-ghost",onClick:()=>o({approve:!0,resumeMode:"bypass"}),children:"Approve & bypass all"}),S.jsx("button",{className:"btn-ghost",onClick:()=>o({approve:!1}),children:"Keep planning"})]})]});if(r.kind==="permission"){const m=typeof((f=r.toolInput)==null?void 0:f.command)=="string"&&r.toolInput.command||typeof((g=r.toolInput)==null?void 0:g.filePath)=="string"&&r.toolInput.filePath||"",_=typeof((d=r.toolInput)==null?void 0:d.reason)=="string"&&r.toolInput.reason||"";return S.jsxs("div",{className:`prompt-card permission ${c?"resolved":""}`,children:[S.jsxs("div",{className:"prompt-head",children:["Permission needed: ",S.jsx("code",{children:r.tool})]}),m&&S.jsx("div",{className:"prompt-sub",children:m}),_&&S.jsx("div",{className:"prompt-sub",children:_}),c?S.jsx("div",{className:"prompt-resolved",children:"Resolved"}):S.jsxs("div",{className:"prompt-actions",children:[S.jsx("button",{className:"btn-primary",onClick:()=>o({approve:!0}),children:"Allow"}),S.jsx("button",{className:"btn-ghost",onClick:()=>o({approve:!1}),children:"Deny"})]})]})}const u=m=>l(_=>r.multiSelect?_.includes(m)?_.filter(w=>w!==m):[..._,m]:[m]);return S.jsxs("div",{className:`prompt-card question ${c?"resolved":""}`,children:[r.header&&S.jsx("div",{className:"prompt-head",children:r.header}),r.question&&S.jsx("div",{className:"prompt-q",children:r.question}),S.jsx("div",{className:"prompt-options",children:(r.options??[]).map(m=>{const _=a.includes(m.label);return S.jsxs("button",{className:`prompt-option ${_?"sel":""}`,disabled:c,onClick:()=>c?void 0:r.multiSelect?u(m.label):o({answers:[m.label]}),children:[S.jsx("span",{className:"prompt-option-label",children:m.label}),m.description&&S.jsx("span",{className:"prompt-option-desc",children:m.description})]},m.label)})}),r.multiSelect&&!c&&S.jsx("div",{className:"prompt-actions",children:S.jsx("button",{className:"btn-primary",disabled:a.length===0,onClick:()=>o({answers:a}),children:"Submit"})}),c&&S.jsx("div",{className:"prompt-resolved",children:"Resolved"})]})}function BL({message:e,onOpenFile:t,onRespond:n}){if(e.role==="user"){const c=e.parts.filter(u=>u.type==="text").map(u=>u.text??"").join(` -`),o=e.parts.filter(u=>u.type==="image"&&u.text).map(u=>u.text.startsWith("data:")?u.text:PT(u.text));return S.jsxs("div",{className:"msg-user",children:[c,o.length>0&&S.jsx("div",{className:"msg-images",children:o.map((u,f)=>S.jsx("a",{href:u,target:"_blank",rel:"noreferrer",children:S.jsx("img",{src:u,alt:"attachment"})},f))})]})}const r=[];let a=[];const l=()=>{a.length!==0&&(r.push(S.jsx(OL,{parts:a,onOpenFile:t},`tg-${a[0].id}`)),a=[])};for(const c of e.parts){if(c.type==="tool"){a.push(c);continue}l(),c.type==="text"&&c.text?r.push(S.jsx(am,{text:c.text,onOpenFile:t},c.id)):c.type==="reasoning"&&c.text?r.push(S.jsxs("details",{className:"reasoning",children:[S.jsx("summary",{children:"thinking…"}),c.text]},c.id)):c.type==="prompt"&&c.prompt&&r.push(S.jsx(jL,{part:c,onRespond:n,onOpenFile:t},c.id))}return l(),S.jsx("div",{className:"msg-assistant",children:r})}const dw=[{id:"active",label:"Active",railLabel:"Recents"},{id:"archived",label:"Archived",railLabel:"Archived"},{id:"all",label:"All",railLabel:"All sessions"}];function IL({value:e,onChange:t}){const{open:n,setOpen:r,ref:a}=Yu();return S.jsxs("div",{className:"rail-filter",ref:a,children:[S.jsx("button",{className:`icon-btn rail-filter-btn ${e!=="active"?"active":""}`,title:"Filter sessions","aria-label":"Filter sessions",onClick:()=>r(l=>!l),children:S.jsx(ZA,{size:13})}),n&&S.jsx("div",{className:"option-menu drop-down align-right",children:dw.map(l=>S.jsxs("button",{className:"model-item",onClick:()=>{t(l.id),r(!1)},children:[S.jsx("span",{children:l.label}),e===l.id&&S.jsx(si,{size:13})]},l.id))})]})}function zL({session:e,active:t,busy:n,onOpen:r,onRename:a,onSetArchived:l,onDelete:c}){var x;const{open:o,setOpen:u,ref:f}=Yu(),g=((x=e.title)==null?void 0:x.trim())||"Untitled",[d,m]=W.useState(!1),[_,w]=W.useState(""),C=W.useRef(null);function y(){var v;w(((v=e.title)==null?void 0:v.trim())||""),m(!0)}function b(){var k;const v=_.trim();m(!1),v&&v!==(((k=e.title)==null?void 0:k.trim())||"")&&a(v)}return W.useEffect(()=>{var v,k;d&&((v=C.current)==null||v.focus(),(k=C.current)==null||k.select())},[d]),S.jsxs("div",{ref:f,role:"button",tabIndex:0,className:`session-row ${t?"active":""} ${o?"menu-open":""} ${d?"editing":""}`,title:`${cw[e.harness]}${e.model?` · ${e.model}`:""}`,onClick:()=>{d||(o?u(!1):r())},onKeyDown:v=>{v.target===v.currentTarget&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),o?u(!1):r())},children:[S.jsx("span",{className:"session-dot",children:n&&S.jsx("span",{className:"busy-dot"})}),d?S.jsx("input",{ref:C,className:"session-title-input","aria-label":"Session title",value:_,onChange:v=>w(v.target.value),onClick:v=>v.stopPropagation(),onBlur:b,onKeyDown:v=>{v.stopPropagation(),v.key==="Enter"?(v.preventDefault(),b()):v.key==="Escape"&&(v.preventDefault(),m(!1))}}):S.jsx("span",{className:"session-title",children:g}),S.jsx("span",{className:"session-time",children:ML(e.updatedAt)}),S.jsx("button",{className:"session-menu-btn",title:"Session options","aria-label":"Session options",onClick:v=>{v.stopPropagation(),u(k=>!k)},children:S.jsx(AA,{size:14})}),o&&S.jsxs("div",{className:"option-menu drop-down session-menu",children:[S.jsx("button",{className:"model-item",onClick:v=>{v.stopPropagation(),u(!1),y()},children:S.jsx("span",{children:"Rename"})}),S.jsx("button",{className:"model-item",onClick:v=>{v.stopPropagation(),u(!1),l(!e.archived)},children:S.jsx("span",{children:e.archived?"Unarchive":"Archive"})}),S.jsx("button",{className:"model-item danger",onClick:v=>{v.stopPropagation(),u(!1),c()},children:S.jsx("span",{children:"Delete"})})]})]})}function HL({projectId:e,paperId:t,railHeader:n,railOpen:r,onShowRail:a,mainView:l,onSelectMainView:c,panelOpen:o,onTogglePanel:u,onOpenFile:f,children:g}){var Ct,Ut,nt;const[d,m]=W.useState([]),[_,w]=W.useState(null),[C,y]=W.useState("active"),[b,x]=W.useState(""),[v,k]=W.useState([]),[D,T]=W.useReducer(DL,{messagesBySession:{},busySessions:new Set}),[R,N]=W.useState([]),[L,I]=W.useState(TL),[F,V]=W.useState({}),H=W.useRef(new Set),z=W.useRef(new Set),q=W.useRef(null),G=W.useRef(null),X=W.useRef(!0),K=W.useRef(null),[O,M]=W.useState([]),[j,$]=W.useState(0),[U,Q]=W.useState(!1);W.useEffect(()=>{OT().then(M).catch(()=>{})},[]);const ie=b.startsWith("/")&&!/\s/.test(b)?b.slice(1):null,se=ie!==null&&!U?O.filter(he=>he.name.startsWith(ie.toLowerCase())):[],Z=se.length>0,P=Math.min(j,Math.max(0,se.length-1));W.useEffect(()=>$(0),[ie]);function ee(he){var Ce;x(`/${he.name} `),(Ce=K.current)==null||Ce.focus()}function te(he){for(const Ce of he){if(!/^image\/(png|jpeg|gif|webp)$/.test(Ce.type))continue;const Oe=new FileReader;Oe.onload=()=>{const Ze=Oe.result;k(ot=>[...ot,{dataUrl:Ze,mediaType:Ce.type}])},Oe.readAsDataURL(Ce)}}function pe(he){const Ce=Array.from(he.clipboardData.items).filter(Oe=>Oe.kind==="file"&&Oe.type.startsWith("image/")).map(Oe=>Oe.getAsFile()).filter(Oe=>Oe!==null);Ce.length>0&&(he.preventDefault(),te(Ce))}const ue=d.find(he=>he.id===_),me=ue?{harness:ue.harness,model:F.model??ue.model,permissionMode:F.permissionMode??ue.permissionMode,reasoningLevel:F.reasoningLevel??ue.reasoningLevel}:L??M1(R),we=me?R.find(he=>he.id===me.harness):void 0,le=we==null?void 0:we.options,ye=he=>{ue?V({model:he.model,permissionMode:he.permissionMode,reasoningLevel:he.reasoningLevel}):(I(he),localStorage.setItem(uw,JSON.stringify(he)))},be=he=>{me&&ye({...me,permissionMode:he})},Be=he=>{me&&ye({...me,reasoningLevel:he})};W.useEffect(()=>{m([]),w(null),x(""),k([]),T({type:"reset"}),H.current=new Set,jT(e).then(he=>{m(he),w(Ce=>{var Oe;return Ce??((Oe=he.find(Ze=>!Ze.archived))==null?void 0:Oe.id)??null}),T({type:"seedBusy",sessions:he.filter(Ce=>Ce.busy).map(Ce=>Ce.id)})}).catch(()=>{})},[e]),W.useEffect(()=>{!_||H.current.has(_)||(H.current.add(_),FT(_).then(he=>T({type:"seed",sessionId:_,messages:he})).catch(()=>H.current.delete(_)))},[_]),W.useEffect(()=>YT(he=>{switch(he.type){case"session":if(he.session.projectId!==e||z.current.has(he.session.id))return;m(Ce=>{const Oe=Ce.findIndex(ot=>ot.id===he.session.id);if(Oe<0)return[he.session,...Ce];const Ze=Ce.slice();return Ze[Oe]=he.session,Ze});break;case"sessionDeleted":ct(he.sessionId);break;case"message":T({type:"upsertMessage",sessionId:he.sessionId,message:he.message});break;case"busy":T({type:"busy",sessionId:he.sessionId,busy:he.busy});break}}),[e]);const Ve=_?D.messagesBySession[_]??[]:[],Pe=_?D.busySessions.has(_):!1,lt=ue;W.useEffect(()=>V({}),[_]);const Rt=l==="chat"&&(Ve.length>0||Pe);W.useLayoutEffect(()=>{X.current=!0;const he=q.current;he&&(he.scrollTop=he.scrollHeight)},[_,Rt]),W.useLayoutEffect(()=>{const he=q.current;he&&X.current&&(he.scrollTop=he.scrollHeight)},[Ve,Pe]),W.useEffect(()=>{const he=q.current,Ce=G.current;if(!he||!Ce)return;const Oe=new ResizeObserver(()=>{X.current&&(he.scrollTop=he.scrollHeight)});return Oe.observe(Ce),Oe.observe(he),()=>Oe.disconnect()},[Rt]);async function gt(){const he=b.trim(),Ce=v;if(!he&&Ce.length===0||Pe)return;const Oe=me;if(!Oe&&!_)return;x(""),k([]);let Ze=_;try{if(!Ze){const Ot=await BT(e,Oe.harness,{model:Oe.model,permissionMode:Oe.permissionMode,reasoningLevel:Oe.reasoningLevel});H.current.add(Ot.id),m(Hi=>[Ot,...Hi]),w(Ot.id),Ze=Ot.id}T({type:"optimisticUser",sessionId:Ze,text:he,imageUrls:Ce.map(Ot=>Ot.dataUrl)}),T({type:"busy",sessionId:Ze,busy:!0}),X.current=!0,C==="archived"&&y("active");const ot=Oe?{model:Oe.model,permissionMode:Oe.permissionMode,reasoningLevel:Oe.reasoningLevel}:{};V({});const fi=Ce.map(Ot=>({mediaType:Ot.mediaType,dataBase64:Ot.dataUrl.slice(Ot.dataUrl.indexOf(",")+1)}));await UT(Ze,he,ot,fi.length?fi:void 0)}catch{Ze&&T({type:"busy",sessionId:Ze,busy:!1})}}function tt(){_&&$T(_)}W.useEffect(()=>{if(!Pe||l!=="chat")return;function he(Ce){var Oe;Ce.key!=="Escape"||Ce.defaultPrevented||(Ce.preventDefault(),tt(),(Oe=K.current)==null||Oe.focus())}return document.addEventListener("keydown",he),()=>document.removeEventListener("keydown",he)},[Pe,_,l]);function ct(he){z.current.add(he),m(Ce=>Ce.filter(Oe=>Oe.id!==he)),w(Ce=>Ce===he?null:Ce),H.current.delete(he),T({type:"forget",sessionId:he})}function de(he,Ce){const Oe=he.archived;m(Ze=>Ze.map(ot=>ot.id===he.id?{...ot,archived:Ce}:ot)),zT(he.id,Ce).catch(()=>{m(Ze=>Ze.map(ot=>ot.id===he.id?{...ot,archived:Oe}:ot))})}function Se(he,Ce){const Oe=he.title;m(Ze=>Ze.map(ot=>ot.id===he.id?{...ot,title:Ce}:ot)),HT(he.id,Ce).catch(()=>{m(Ze=>Ze.map(ot=>ot.id===he.id?{...ot,title:Oe}:ot))})}async function Ee(he){var Oe;const Ce=((Oe=he.title)==null?void 0:Oe.trim())||"Untitled";if(window.confirm(`Delete "${Ce}"? +|(?![\\s\\S])))+`,"m"),alias:l,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(r)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:n})})(e)}Pg.displayName="go";Pg.aliases=[];function Pg(e){e.register(ui),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"]}Ug.displayName="ini";Ug.aliases=[];function Ug(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:/=/}}$g.displayName="java";$g.aliases=[];function $g(e){e.register(ui),(function(t){var n=/\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,a={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:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[a,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:a.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:a.inside}],keyword:n,function:[t.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/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.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":a,keyword:n,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:a.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:a.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 n.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}Gg.displayName="regex";Gg.aliases=[];function Gg(e){(function(t){var n={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]|.)/,a={pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},l={pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},c="(?:[^\\\\-]|"+r.source+")",o=RegExp(c+"-"+c),u={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"};t.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":n,"char-set":l,escape:r}},"special-escape":n,"char-set":a,backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":u}}],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}qg.displayName="json";qg.aliases=["webmanifest"];function qg(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}Vg.displayName="kotlin";Vg.aliases=["kt","kts"];function Vg(e){e.register(ui),(function(t){t.languages.kotlin=t.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 t.languages.kotlin["class-name"];var n={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:t.languages.kotlin}};t.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:n},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:n},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete t.languages.kotlin.string,t.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),t.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),t.languages.kt=t.languages.kotlin,t.languages.kts=t.languages.kotlin})(e)}Yg.displayName="less";Yg.aliases=[];function Yg(e){e.register(ga),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"}})}Wg.displayName="lua";Wg.aliases=[];function Wg(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:/[\[\](){},;]|\.+|:+/}}Xg.displayName="makefile";Xg.aliases=[];function Xg(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:/[:;(){}]/}}Kg.displayName="yaml";Kg.aliases=["yml"];function Kg(e){(function(t){var n=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,a="(?:"+r.source+"(?:[ ]+"+n.source+")?|"+n.source+"(?:[ ]+"+r.source+")?)",l=/(?:[^\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}),c=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function o(u,f){f=(f||"").replace(/m/g,"")+"m";var g=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return a}).replace(/<>/g,function(){return u});return RegExp(g,f)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return a})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return a}).replace(/<>/g,function(){return"(?:"+l+"|"+c+")"})),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(c),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:n,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(e)}Zg.displayName="markdown";Zg.aliases=["md"];function Zg(e){e.register(il),(function(t){var n=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(o){return o=o.replace(//g,function(){return n}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+o+")")}var a=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,l=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return a}),c=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.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:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+l+c+"(?:"+l+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+l+c+")(?:"+l+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(a),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+l+")"+c+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+l+"$"),inside:{"table-header":{pattern:RegExp(a),alias:"important",inside:t.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(u){o!==u&&(t.languages.markdown[o].inside.content.inside[u]=t.languages.markdown[u])})}),t.hooks.add("after-tokenize",function(o){if(o.language!=="markdown"&&o.language!=="md")return;function u(f){if(!(!f||typeof f=="string"))for(var g=0,d=f.length;g]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete e.languages.objectivec["class-name"],e.languages.objc=e.languages.objectivec}Jg.displayName="perl";Jg.aliases=[];function Jg(e){(function(t){var n=/(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;t.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,n].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,n].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,n+/\s*/.source+n].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)}Wu.displayName="markup-templating";Wu.aliases=[];function Wu(e){e.register(il),(function(t){function n(r,a){return"___"+r.toUpperCase()+a+"___"}Object.defineProperties(t.languages["markup-templating"]={},{buildPlaceholders:{value:function(r,a,l,c){if(r.language===a){var o=r.tokenStack=[];r.code=r.code.replace(l,function(u){if(typeof c=="function"&&!c(u))return u;for(var f=o.length,g;r.code.indexOf(g=n(a,f))!==-1;)++f;return o[f]=u,g}),r.grammar=t.languages.markup}}},tokenizePlaceholders:{value:function(r,a){if(r.language!==a||!r.tokenStack)return;r.grammar=t.languages[a];var l=0,c=Object.keys(r.tokenStack);function o(u){for(var f=0;f=c.length);f++){var g=u[f];if(typeof g=="string"||g.content&&typeof g.content=="string"){var d=c[l],m=r.tokenStack[d],_=typeof g=="string"?g:g.content,w=n(a,d),C=_.indexOf(w);if(C>-1){++l;var b=_.substring(0,C),S=new t.Token(a,t.tokenize(m,r.grammar),"language-"+a,m),x=_.substring(C+w.length),y=[];b&&y.push.apply(y,o([b])),y.push(S),x&&y.push.apply(y,o([x])),typeof g=="string"?u.splice.apply(u,[f,1].concat(y)):g.content=y}}else g.content&&o(g.content)}return u}o(r.tokens)}}})})(e)}em.displayName="php";em.aliases=[];function em(e){e.register(Wu),(function(t){var n=/\/\*[\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*\()/],a=/\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,l=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,c=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:n,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:a,operator:l,punctuation:c};var o={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:t.languages.php},u=[{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}}];t.languages.insertBefore("php","variable",{string:u,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:n,string:u,"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:a,operator:l,punctuation:c}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",function(f){if(/<\?/.test(f.code)){var g=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;t.languages["markup-templating"].buildPlaceholders(f,"php",g)}}),t.hooks.add("after-tokenize",function(f){t.languages["markup-templating"].tokenizePlaceholders(f,"php")})})(e)}tm.displayName="python";tm.aliases=["py"];function tm(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}nm.displayName="r";nm.aliases=[];function nm(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:/[(){}\[\],;]/}}im.displayName="ruby";im.aliases=["rb"];function im(e){e.register(ui),(function(t){t.languages.ruby=t.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:/[(){}[\].,;]/}),t.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var n={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:t.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete t.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("|")+")",a=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;t.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+r+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+a),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+a+/(?=:(?!:))/.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:/\./}}}),t.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+r),greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:n,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:n,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:n,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete t.languages.ruby.string,t.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)/}),t.languages.rb=t.languages.ruby})(e)}rm.displayName="rust";rm.aliases=[];function rm(e){(function(t){for(var n=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,r=0;r<2;r++)n=n.replace(//g,function(){return n});n=n.replace(//g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+n),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:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(e)}sm.displayName="sass";sm.aliases=[];function sm(e){e.register(ga),(function(t){t.languages.sass=t.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),t.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete t.languages.sass.atrule;var n=/\$[-\w]+|#\{\$[-\w]+\}/,r=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];t.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:n,operator:r}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:n,operator:r,important:t.languages.sass.important}}}),delete t.languages.sass.property,delete t.languages.sass.important,t.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)}am.displayName="scss";am.aliases=[];function am(e){e.register(ga),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}om.displayName="sql";om.aliases=[];function om(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:/[;[\]()`,.]/}}lm.displayName="swift";lm.aliases=[];function lm(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(t){t.inside.interpolation.inside=e.languages.swift})}cm.displayName="typescript";cm.aliases=["ts"];function cm(e){e.register(Yu),(function(t){t.languages.typescript=t.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/}),t.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 t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var n=t.languages.extend("typescript",{});delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.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:n}}}}),t.languages.ts=t.languages.typescript})(e)}Xu.displayName="basic";Xu.aliases=[];function Xu(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:/[,;:()]/}}um.displayName="vbnet";um.aliases=[];function um(e){e.register(Xu),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:/[,;:(){}]/})}const A1=/[#.]/g;function DM(e,t){const n=e||"",r={};let a=0,l,c;for(;a=48&&t<=57}function zM(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function HM(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function D1(e){return HM(e)||iw(e)}const FM=["","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 PM(e,t){const n={},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,a=[];let l=0,c=-1,o="",u,f;n.position&&("start"in n.position||"indent"in n.position?(f=n.position.indent,u=n.position.start):u=n.position);let g=(u?u.line:0)||1,d=(u?u.column:0)||1,m=w(),_;for(l--;++l<=e.length;)if(_===10&&(d=(f?f[c]:0)||1),_=e.charCodeAt(l),_===38){const S=e.charCodeAt(l+1);if(S===9||S===10||S===12||S===32||S===38||S===60||Number.isNaN(S)||r&&S===r){o+=String.fromCharCode(_),d++;continue}const x=l+1;let y=x,k=x,D;if(S===35){k=++y;const H=e.charCodeAt(k);H===88||H===120?(D="hexadecimal",k=++y):D="decimal"}else D="named";let T="",R="",N="";const L=D==="named"?D1:D==="decimal"?iw:zM;for(k--;++k<=e.length;){const H=e.charCodeAt(k);if(!L(H))break;N+=String.fromCharCode(H),D==="named"&&IM.includes(N)&&(T=N,R=Bo(N))}let I=e.charCodeAt(k)===59;if(I){k++;const H=D==="named"?Bo(N):!1;H&&(T=N,R=H)}let F=1+k-x,V="";if(!(!I&&n.nonTerminated===!1))if(!N)D!=="named"&&C(4,F);else if(D==="named"){if(I&&!R)C(5,1);else if(T!==N&&(k=y+T.length,F=1+k-y,I=!1),!I){const H=T?1:3;if(n.attribute){const z=e.charCodeAt(k);z===61?(C(H,F),R=""):D1(z)?R="":C(H,F)}else C(H,F)}V=R}else{I||C(2,F);let H=Number.parseInt(N,D==="hexadecimal"?16:10);if(UM(H))C(7,F),V="�";else if(H in N1)C(6,F),V=N1[H];else{let z="";$M(H)&&C(6,F),H>65535&&(H-=65536,z+=String.fromCharCode(H>>>10|55296),H=56320|H&1023),V=z+String.fromCharCode(H)}}if(V){b(),m=w(),l=k-1,d+=k-x+1,a.push(V);const H=w();H.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,V,{start:m,end:H},e.slice(x-1,k)),m=H}else N=e.slice(x-1,k),o+=N,d+=N.length,l=k-1}else _===10&&(g++,c++,d=0),Number.isNaN(_)?b():(o+=String.fromCharCode(_),d++);return a.join("");function w(){return{line:g,column:d,offset:l+((u?u.offset:0)||0)}}function C(S,x){let y;n.warning&&(y=w(),y.column+=x,y.offset+=x,n.warning.call(n.warningContext||void 0,FM[S],y,S))}function b(){o&&(a.push(o),n.text&&n.text.call(n.textContext||void 0,o,{start:m,end:w()}),o="")}}function UM(e){return e>=55296&&e<=57343||e>1114111}function $M(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 GM=0,Hc={},Yt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++GM}),e.__id},clone:function e(t,n){n=n||{};var r,a;switch(Yt.util.type(t)){case"Object":if(a=Yt.util.objId(t),n[a])return n[a];r={},n[a]=r;for(var l in t)t.hasOwnProperty(l)&&(r[l]=e(t[l],n));return r;case"Array":return a=Yt.util.objId(t),n[a]?n[a]:(r=[],n[a]=r,t.forEach(function(c,o){r[o]=e(c,n)}),r);default:return t}}},languages:{plain:Hc,plaintext:Hc,text:Hc,txt:Hc,extend:function(e,t){var n=Yt.util.clone(Yt.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r=r||Yt.languages;var a=r[e],l={};for(var c in a)if(a.hasOwnProperty(c)){if(c==t)for(var o in n)n.hasOwnProperty(o)&&(l[o]=n[o]);n.hasOwnProperty(c)||(l[c]=a[c])}var u=r[e];return r[e]=l,Yt.languages.DFS(Yt.languages,function(f,g){g===u&&f!=e&&(this[f]=l)}),l},DFS:function e(t,n,r,a){a=a||{};var l=Yt.util.objId;for(var c in t)if(t.hasOwnProperty(c)){n.call(t,c,t[c],r||c);var o=t[c],u=Yt.util.type(o);u==="Object"&&!a[l(o)]?(a[l(o)]=!0,e(o,n,null,a)):u==="Array"&&!a[l(o)]&&(a[l(o)]=!0,e(o,n,c,a))}}},plugins:{},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(Yt.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=Yt.tokenize(r.code,r.grammar),Yt.hooks.run("after-tokenize",r),No.stringify(Yt.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var a=new qM;return au(a,a.head,e),rw(e,a,t,a.head,0),YM(a)},hooks:{all:{},add:function(e,t){var n=Yt.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=Yt.hooks.all[e];if(!(!n||!n.length))for(var r=0,a;a=n[r++];)a(t)}},Token:No};function No(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||"").length|0}function R1(e,t,n,r){e.lastIndex=t;var a=e.exec(n);if(a&&r&&a[1]){var l=a[1].length;a.index+=l,a[0]=a[0].slice(l)}return a}function rw(e,t,n,r,a,l){for(var c in n)if(!(!n.hasOwnProperty(c)||!n[c])){var o=n[c];o=Array.isArray(o)?o:[o];for(var u=0;u=l.reach);S+=b.value.length,b=b.next){var x=b.value;if(t.length>e.length)return;if(!(x instanceof No)){var y=1,k;if(m){if(k=R1(C,S,e,d),!k||k.index>=e.length)break;var N=k.index,D=k.index+k[0].length,T=S;for(T+=b.value.length;N>=T;)b=b.next,T+=b.value.length;if(T-=b.value.length,S=T,b.value instanceof No)continue;for(var R=b;R!==t.tail&&(Tl.reach&&(l.reach=V);var H=b.prev;I&&(H=au(t,H,I),S+=I.length),VM(t,H,y);var z=new No(c,g?Yt.tokenize(L,g):L,_,L);if(b=au(t,H,z),F&&au(t,b,F),y>1){var q={cause:c+","+u,reach:V};rw(e,t,n,b.prev,S,q),l&&q.reach>l.reach&&(l.reach=q.reach)}}}}}}function qM(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function au(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function VM(e,t,n){for(var r=t.next,a=0;an)return e;try{return Ne.highlight(e,t).children.map(ow)}catch{return e}}const tL=1e5;function nL({code:e,lang:t}){const[n,r]=Y.useState(!1),a=()=>{var l;(l=navigator.clipboard)==null||l.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};return v.jsxs("div",{className:"md-code",children:[v.jsx("button",{className:"md-code-copy",title:"Copy","aria-label":"Copy code",onClick:a,children:n?v.jsx(_n,{size:13}):v.jsx(vg,{size:13})}),v.jsx("pre",{children:v.jsx("code",{children:lw(e,t,tL)})})]})}function iL(e){const t={};for(const n of e.matchAll(/([\w-]+)=(["'])(.*?)\2/g)){const r=n[1];r&&(t[r.toLowerCase()]=n[3]??"")}return t}function rL(e){const t=/]*?)\/?>/gi,n=[];let r=0,a=!1;for(const l of e.matchAll(t)){const c=iL(l[1]??"");c.path&&(a=!0,l.index>r&&n.push({type:"text",value:e.slice(r,l.index)}),n.push({children:[],data:{hName:"file-mention",hProperties:c},type:"fileMention"}),r=l.index+l[0].length)}return a?(rcw(e)}function M1({path:e,lines:t,onOpenFile:n}){const r=e.split("/").pop()||e,a=t&&Number.parseInt(t,10)||void 0,l=a!=null?`${r}:${a}`:r;return v.jsxs("button",{className:"file-chip",title:`Open ${e}`,onClick:()=>n==null?void 0:n(e),disabled:!n,children:[v.jsx(jS,{size:12}),v.jsx("span",{className:"file-chip-label",children:l})]})}function aL(e){return!(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("#")||e.startsWith("//"))}const uw={code:({node:e,className:t,children:n,...r})=>{const a=t??"",l=/language-(\w+)/.exec(a),c=String(n??"").replace(/\n$/,"");if(!(l!=null||c.includes(` +`)))return v.jsx("code",{className:a,...r,children:n});const u=l?Hp(l[1]):null;return v.jsx(nL,{code:c,lang:u})},pre:({children:e})=>v.jsx(v.Fragment,{children:e})};function hm({text:e,onOpenFile:t}){const n={"file-mention":r=>v.jsx(M1,{path:r.path,lines:r.lines,onOpenFile:t}),a:({node:r,href:a,children:l,...c})=>a&&aL(a)&&t?v.jsx(M1,{path:decodeURI(a),onOpenFile:t}):v.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",...c,children:l}),...uw};return v.jsx("div",{className:"md",children:v.jsx(Dx,{remarkPlugins:[ew,sL],components:n,children:e})})}function hw({onSaved:e}){const[t,n]=Y.useState(""),[r,a]=Y.useState(!1),[l,c]=Y.useState(null);async function o(u){if(u.preventDefault(),!(r||!t.trim())){a(!0),c(null);try{e(await PT(t.trim())),n("")}catch(f){c(f instanceof Error?f.message:String(f))}finally{a(!1)}}}return v.jsxs("form",{className:"onb-token-form",onSubmit:o,children:[v.jsx("input",{type:"password",value:t,onChange:u=>n(u.target.value),placeholder:"ghp_… personal access token",autoComplete:"off"}),v.jsx("button",{type:"submit",className:"btn",disabled:r||!t.trim(),children:r?"Checking…":"Save"}),v.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,workflow&description=orx",target:"_blank",rel:"noreferrer",children:"Create a token ↗"}),l&&v.jsx("div",{className:"error",children:l})]})}function oL(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"openresearch_job":return"OpenResearch";case"local_job":return"This machine";default:return e||"—"}}function lL({size:e=16}){return v.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",children:[v.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"}),v.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"}),v.jsx("path",{d:"M11.875 15.113c2.457 0 3.25-2.156 3.25-3.263 0-.576-.393-.394-1.023-.089-.582.283-1.365.675-2.224.675-1.798 0-3.25-1.693-3.25-.586 0 1.107.79 3.263 3.25 3.263h-.003z",fill:"#FF323D"}),v.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"}),v.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"}),v.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-.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-.553.718-.694.244-.162.523-.265.814-.3l.176-.012z",fill:"#FF9D0B"}),v.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-.573.534-.375-.677-1.405-2.416-1.94-2.751-.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-.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-.537-.425.79 2.913 1.718 2.94 1.725 1.075.276 3.813.859 4.77-.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-.537.423.79-2.912 1.718-2.94 1.725-1.077.276-3.815.859-4.77-.522z",fill:"#FFD21E"})]})}function cL({size:e=16}){return v.jsxs("svg",{width:e,height:e,viewBox:"0 0 300 300",fill:"none","aria-hidden":"true",children:[v.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"}),v.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)"}),v.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)"}),v.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"}),v.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"}),v.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)"}),v.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)"}),v.jsxs("defs",{children:[v.jsxs("linearGradient",{id:"orxModalA",x1:"127.348",y1:"137",x2:"82.9561",y2:"59.6398",gradientUnits:"userSpaceOnUse",children:[v.jsx("stop",{stopColor:"#BFF9B4"}),v.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),v.jsxs("linearGradient",{id:"orxModalB",x1:"7.04774",y1:"214.131",x2:"81.1284",y2:"85.0556",gradientUnits:"userSpaceOnUse",children:[v.jsx("stop",{stopColor:"#80EE64"}),v.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),v.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),v.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),v.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),v.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),v.jsx("stop",{offset:"1",stopColor:"#09AF58"})]}),v.jsxs("linearGradient",{id:"orxModalC",x1:"278.103",y1:"188.561",x2:"204.022",y2:"59.4863",gradientUnits:"userSpaceOnUse",children:[v.jsx("stop",{stopColor:"#BFF9B4"}),v.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),v.jsxs("linearGradient",{id:"orxModalD",x1:"232.804",y1:"214.569",x2:"158.724",y2:"85.4864",gradientUnits:"userSpaceOnUse",children:[v.jsx("stop",{stopColor:"#80EE64"}),v.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),v.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),v.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),v.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),v.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),v.jsx("stop",{offset:"1",stopColor:"#09AF58"})]})]})]})}function uL({size:e=16}){return v.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#326CE5","aria-hidden":"true",children:v.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-.5-.623h-.804l-.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-.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-.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-.52.123-.736-.172-.216-.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-.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-.555-.5-.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-.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-.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-.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 hL({kind:e,size:t=16}){switch(e){case"modal_job":return v.jsx(cL,{size:t});case"hf_job":return v.jsx(lL,{size:t});case"k8s_job":return v.jsx(uL,{size:t});case"ssh_job":return v.jsx(Cp,{size:t});case"slurm_job":return v.jsx(gA,{size:t});case"openresearch_job":return v.jsx(xA,{size:t});case"local_job":return v.jsx(GA,{size:t});default:return v.jsx(Cp,{size:t})}}function fL({backend:e}){const t=GS(e),n=qS(e);return t?v.jsxs("span",{className:"backend-badge",children:[v.jsx(hL,{kind:t}),v.jsx("span",{className:"backend-name",children:oL(t)}),n&&v.jsx("span",{className:"backend-detail mono",children:n})]}):v.jsx("span",{className:"backend-badge muted",children:"—"})}const L1={done:{className:"st-done",live:!1},failed:{className:"st-failed",live:!1},running:{className:"st-running",live:!0},starting:{className:"st-starting",live:!0},cancelled:{className:"st-cancelled",live:!1},editing:{className:"st-editing",live:!0},idle:{className:"st-idle",live:!1}};function dL(e){return L1[e]??L1.idle}function zo({status:e,label:t}){const n=dL(e);return v.jsxs("span",{className:`status-badge ${n.className}${n.live?" live":""}`,children:[v.jsx("span",{className:"dot"}),t??e]})}function sp(e){return e.installed&&e.authenticated?{cls:"ok",label:"Connected"}:e.installed?{cls:"warn",label:"Not signed in"}:{cls:"warn",label:"Not installed"}}function pL({h:e}){return e.authMethod?v.jsx(v.Fragment,{children:e.authMethod==="oauth"?"OAuth (subscription login)":"API key"}):v.jsx(v.Fragment,{children:"—"})}function gL(){const[e,t]=Y.useState(null),[n,r]=Y.useState("claude-code"),[a,l]=Y.useState(!1),c=u=>{l(!0),bg(u).then(t).catch(()=>{}).finally(()=>l(!1))};Y.useEffect(()=>c(!1),[]);const o=e==null?void 0:e.find(u=>u.id===n);return v.jsxs(v.Fragment,{children:[v.jsx("h1",{children:"Harnesses"}),v.jsx("p",{className:"settings-sub",children:"Coding-agent setups detected on this machine. The research agent chat is served by OpenCode; Claude Code and Codex accounts surface their models in the composer's model picker."}),v.jsx("div",{className:"harness-tabs",children:(e??[]).map(u=>v.jsxs("button",{className:u.id===n?"active":"",onClick:()=>r(u.id),children:[u.name,v.jsx("span",{className:`harness-dot ${sp(u).cls}`})]},u.id))}),e?o?v.jsxs("div",{className:"settings-card",children:[v.jsxs("div",{className:"settings-card-head",children:[v.jsx("span",{className:`badge ${sp(o).cls}`,children:sp(o).label}),v.jsx("div",{className:"spacer",style:{flex:1}}),v.jsxs("button",{className:"btn sm",onClick:()=>c(!0),disabled:a,children:[v.jsx(mu,{size:12,className:a?"spin":""})," Refresh"]})]}),v.jsxs("div",{className:"kv",children:[v.jsx("span",{className:"k",children:"Binary"}),v.jsx("span",{className:"v",children:o.binPath??"not found on PATH"}),v.jsx("span",{className:"k",children:"Version"}),v.jsx("span",{className:"v",children:o.version??"—"}),v.jsx("span",{className:"k",children:"Auth"}),v.jsx("span",{className:"v",children:v.jsx(pL,{h:o})}),o.account&&v.jsxs(v.Fragment,{children:[v.jsx("span",{className:"k",children:o.id==="opencode"?"Providers":"Account"}),v.jsx("span",{className:"v",children:o.account})]}),o.org&&v.jsxs(v.Fragment,{children:[v.jsx("span",{className:"k",children:"Org"}),v.jsx("span",{className:"v",children:o.org})]}),o.plan&&v.jsxs(v.Fragment,{children:[v.jsx("span",{className:"k",children:"Plan"}),v.jsx("span",{className:"v",children:o.plan})]}),v.jsx("span",{className:"k",children:"Agent models"}),v.jsx("span",{className:"v",children:o.models.length>0?`${o.models.length} available — ${o.models.slice(0,4).map(u=>_u(u.id)).join(", ")}${o.models.length>4?", …":""}`:"none"})]}),!o.agentReady&&o.agentNote&&v.jsx("p",{className:"settings-note",children:o.agentNote})]}):null:v.jsxs("div",{className:"settings-loading",children:[v.jsx("span",{className:"spinner"})," Detecting harnesses…"]})]})}function mL({s:e}){if(!e.configured)return v.jsx("span",{className:"badge",children:"not configured"});const t=e.preflight;return t.kubectlFound?t.reachable?t.canCreateJobs?v.jsx("span",{className:"badge ok",children:"connected"}):v.jsx("span",{className:"badge err",children:"no job-create permission"}):v.jsx("span",{className:"badge err",children:"cluster unreachable"}):v.jsx("span",{className:"badge err",children:"kubectl not found"})}function _L(){const[e,t]=Y.useState(null),[n,r]=Y.useState(null),[a,l]=Y.useState(""),[c,o]=Y.useState(""),[u,f]=Y.useState(!1),[g,d]=Y.useState(null),m=C=>{t(C),l(C.context??""),o(C.namespace)};Y.useEffect(()=>{CT().then(m).catch(C=>r(C instanceof Error?C.message:String(C)))},[]);const _=e!==null&&a===(e.context??"")&&c.trim()===e.namespace;async function w(C){if(C.preventDefault(),!u){f(!0),d(null);try{m(await ET({context:a,namespace:c.trim()}))}catch(b){d(b instanceof Error?b.message:String(b))}finally{f(!1)}}}return v.jsxs(v.Fragment,{children:[v.jsxs("p",{className:"settings-sub",children:[v.jsx("strong",{children:"Kubernetes"})," — run on your own cluster with ",v.jsx("code",{children:"--backend k8s"}),". The run's resources (image, GPUs, topology) come from a manifest committed on the experiment branch (default ",v.jsx("code",{children:".orx/k8s.yaml"}),"); only the cluster context and namespace live here. Auth comes from your kubeconfig."]}),n?v.jsx("div",{className:"settings-card",children:v.jsx("div",{className:"error",children:n})}):e?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"settings-card",children:[v.jsxs("div",{className:"settings-card-head",children:[v.jsx("h3",{children:"Kubernetes cluster"}),v.jsx("div",{className:"spacer",style:{flex:1}}),v.jsx(mL,{s:e})]}),e.preflight.error&&v.jsx("p",{className:"settings-note",children:e.preflight.error}),v.jsxs("form",{className:"form settings-form",onSubmit:w,children:[v.jsxs("div",{className:"row2",children:[v.jsxs("label",{children:["Context",v.jsxs("select",{value:a,onChange:C=>l(C.target.value),children:[v.jsxs("option",{value:"",children:["kubectl default",e.currentContext?` (${e.currentContext})`:""]}),e.contexts.map(C=>v.jsx("option",{value:C,children:C},C))]})]}),v.jsxs("label",{children:["Namespace",v.jsx("input",{className:"mono",type:"text",value:c,onChange:C=>o(C.target.value),placeholder:"default",autoComplete:"off",spellCheck:!1})]})]}),g&&v.jsx("div",{className:"error",children:g}),v.jsx("div",{className:"actions",children:v.jsx("button",{type:"submit",className:"btn primary",disabled:u||_,children:u?"Saving…":"Save"})})]})]}),v.jsxs("div",{className:"settings-card",children:[v.jsx("div",{className:"settings-card-head",children:v.jsx("h3",{children:"Run manifest"})}),v.jsxs("p",{className:"settings-sub",children:["Each run applies the manifest committed on its experiment branch — default"," ",v.jsx("code",{children:".orx/k8s.yaml"}),", or ",v.jsx("code",{children:"--manifest "}),". It declares whatever the run needs (image, GPU requests, an Indexed Job across nodes, extra Services, …); orx injects the run script as ",v.jsx("code",{children:"$ORX_SCRIPT"}),", the"," ",v.jsx("code",{children:"orx-env"})," Secret, run labels, and a default timeout, and requires exactly one Job (or one labelled ",v.jsx("code",{children:'orx-primary: "true"'}),") whose completion is the run's. Logs follow that Job's leader pod. Use"," ",v.jsx("code",{children:"{{ORX_RUN}}"})," in resource names to keep re-runs collision-free."]})]})]}):v.jsxs("div",{className:"settings-loading",children:[v.jsx("span",{className:"spinner"})," Checking kubectl…"]})]})}const vL={env:"MODAL_TOKEN_ID env var",syncedEnv:"~/.openresearch/env",modalToml:"~/.modal.toml (modal token new)"};function yL({s:e}){return e.ready?v.jsx("span",{className:"badge ok",children:"connected"}):!e.tokenConfigured&&!e.modalImportable?v.jsx("span",{className:"badge",children:"not set up"}):e.modalImportable?e.tokenConfigured?v.jsx("span",{className:"badge",children:"unknown"}):v.jsx("span",{className:"badge err",children:"no token"}):v.jsx("span",{className:"badge err",children:e.envProvisioned?"env broken":"env not built"})}function bL(){const[e,t]=Y.useState(null),[n,r]=Y.useState(null),[a,l]=Y.useState(!1),[c,o]=Y.useState(null);Y.useEffect(()=>{kT().then(t).catch(f=>r(f instanceof Error?f.message:String(f)))},[]);async function u(){if(!a){l(!0),o(null);try{t(await AT())}catch(f){o(f instanceof Error?f.message:String(f))}finally{l(!1)}}}return v.jsxs("div",{className:"settings-card",children:[v.jsxs("div",{className:"settings-card-head",children:[v.jsx("h3",{children:"Modal"}),v.jsx("div",{className:"spacer",style:{flex:1}}),e&&v.jsx(yL,{s:e})]}),v.jsxs("p",{className:"settings-sub",children:["Serverless GPUs on your own Modal account with"," ",v.jsx("code",{children:"--backend modal --flavor "})," (t4, a10g, a100-80gb, h100, …). orx manages a dedicated Python env with the Modal SDK; sandboxes scale to zero between runs."]}),n?v.jsx("div",{className:"error",children:n}):e?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"kv",children:[v.jsx("span",{className:"k",children:"Environment"}),v.jsx("span",{className:"v",children:e.modalImportable?"ready":e.envProvisioned?"provisioned (modal import failing)":"not built yet"}),v.jsx("span",{className:"k",children:"Token"}),v.jsx("span",{className:"v",children:e.tokenSource?vL[e.tokenSource]:"not configured"})]}),!e.tokenConfigured&&v.jsxs("p",{className:"settings-note",children:["No Modal token found. Run ",v.jsx("code",{children:"modal token new"}),", or add"," ",v.jsx("code",{children:"MODAL_TOKEN_ID"})," and ",v.jsx("code",{children:"MODAL_TOKEN_SECRET"})," in the Environment tab."]}),e.error&&e.envProvisioned&&!e.modalImportable&&v.jsx("p",{className:"settings-note",children:e.error}),c&&v.jsx("div",{className:"error",children:c}),!e.modalImportable&&v.jsx("div",{className:"actions",children:v.jsx("button",{className:"btn primary",onClick:()=>void u(),disabled:a,children:a?"Setting up… (~30–60s)":"Set up environment"})})]}):v.jsxs("div",{className:"settings-loading",children:[v.jsx("span",{className:"spinner"})," Checking Modal…"]})]})}function SL({test:e}){if(e===void 0)return v.jsx("span",{className:"muted",children:"never tested"});if(e==="testing")return v.jsx("span",{className:"spinner"});const t=e.reachable?e.gitFound?v.jsx("span",{className:"badge ok",children:"ready"}):v.jsx("span",{className:"badge err",children:"no git"}):v.jsx("span",{className:"badge err",title:e.error??void 0,children:"unreachable"});return v.jsxs(v.Fragment,{children:[t,v.jsx("span",{className:"ssh-tested-at",children:fa(e.testedAt)})]})}function xL(){const[e,t]=Y.useState(null),[n,r]=Y.useState({});Y.useEffect(()=>{LT().then(t).catch(()=>t([]))},[]);async function a(l){r(c=>({...c,[l]:"testing"}));try{const c=await OT(l);r(o=>({...o,[l]:c}))}catch(c){r(o=>({...o,[l]:{reachable:!1,gitFound:!1,error:c instanceof Error?c.message:String(c),testedAt:Date.now()}}))}}return v.jsxs("div",{className:"settings-card",children:[v.jsx("h3",{children:"SSH hosts"}),v.jsxs("p",{className:"settings-sub",children:["Run experiments directly on your own boxes with"," ",v.jsx("code",{children:"--backend ssh --host "}),". Hosts come from"," ",v.jsx("code",{children:"~/.ssh/config"}),"; auth uses your keys/agent (orx never reads a key). The host just needs ",v.jsx("code",{children:"git"})," and ",v.jsx("code",{children:"bash"}),"."]}),e===null?v.jsxs("div",{className:"settings-loading",children:[v.jsx("span",{className:"spinner"})," Reading ~/.ssh/config…"]}):e.length===0?v.jsx("p",{className:"settings-empty",children:"No hosts found in ~/.ssh/config."}):v.jsxs("table",{className:"flavor-table ssh-table",children:[v.jsx("thead",{children:v.jsxs("tr",{children:[v.jsx("th",{children:"Host"}),v.jsx("th",{children:"Address"}),v.jsx("th",{children:"Identity"}),v.jsx("th",{children:"Status"}),v.jsx("th",{})]})}),v.jsx("tbody",{children:e.map(l=>v.jsxs("tr",{children:[v.jsx("td",{className:"mono",children:l.host}),v.jsxs("td",{className:"mono muted",children:[[l.user,l.hostname??"—"].filter(Boolean).join("@"),l.port?`:${l.port}`:""]}),v.jsx("td",{className:"mono muted",children:l.identityFile??"—"}),v.jsx("td",{children:v.jsx(SL,{test:n[l.host]??l.lastTest})}),v.jsx("td",{children:v.jsx("button",{className:"btn sm",onClick:()=>void a(l.host),disabled:n[l.host]==="testing",children:"Test"})})]},l.host))})]})]})}function wL({test:e}){return e===null?null:e==="testing"?v.jsx("span",{className:"spinner"}):e.reachable?e.slurmFound?e.gitFound?v.jsx("span",{className:"badge ok",children:"ready"}):v.jsx("span",{className:"badge err",children:"no git"}):v.jsx("span",{className:"badge err",children:"no slurm CLI"}):v.jsx("span",{className:"badge err",title:e.error??void 0,children:"unreachable"})}function CL(){const[e,t]=Y.useState(null),[n,r]=Y.useState(null),[a,l]=Y.useState(""),[c,o]=Y.useState(""),[u,f]=Y.useState(""),[g,d]=Y.useState(""),[m,_]=Y.useState(!1),[w,C]=Y.useState(null),[b,S]=Y.useState(null),x=b!==null&&b!=="testing"?b:null,y=R=>{t(R),l(R.host??""),o(R.partition??""),f(R.account??""),d(R.timeLimit??"")};Y.useEffect(()=>{jT().then(y).catch(R=>r(R instanceof Error?R.message:String(R)))},[]);const k=e!==null&&a===(e.host??"")&&c.trim()===(e.partition??"")&&u.trim()===(e.account??"")&&g.trim()===(e.timeLimit??"");async function D(R){if(R.preventDefault(),!m){_(!0),C(null);try{y(await BT({host:a,partition:c.trim(),account:u.trim(),timeLimit:g.trim()}))}catch(N){C(N instanceof Error?N.message:String(N))}finally{_(!1)}}}async function T(R){S("testing");try{S(await IT(R))}catch(N){S({reachable:!1,slurmFound:!1,gitFound:!1,partitions:[],error:N instanceof Error?N.message:String(N)})}}return v.jsxs(v.Fragment,{children:[v.jsxs("p",{className:"settings-sub",children:[v.jsx("strong",{children:"Slurm"})," — run on your own cluster with"," ",v.jsx("code",{children:"--backend slurm [--flavor h100:2]"}),". orx submits via ",v.jsx("code",{children:"sbatch"})," on the login node over ssh (auth is your keys/agent; orx never reads a key) and the job runs in your cluster environment. The defaults below apply when a launch doesn't override them."]}),n?v.jsx("div",{className:"settings-card",children:v.jsx("div",{className:"error",children:n})}):e?v.jsxs("div",{className:"settings-card",children:[v.jsxs("div",{className:"settings-card-head",children:[v.jsx("h3",{children:"Slurm cluster"}),v.jsx("div",{className:"spacer",style:{flex:1}}),v.jsx(wL,{test:b})]}),(x==null?void 0:x.error)&&v.jsx("p",{className:"settings-note",children:x.error}),x&&x.partitions.length>0&&v.jsxs("p",{className:"settings-note",children:["Partitions: ",v.jsx("code",{children:x.partitions.join(", ")})]}),v.jsxs("form",{className:"form settings-form",onSubmit:D,children:[v.jsxs("div",{className:"row2",children:[v.jsxs("label",{children:["Login node",v.jsxs("select",{value:a,onChange:R=>{l(R.target.value),S(null)},children:[v.jsx("option",{value:"",children:"not set (pass --host per launch)"}),a&&!e.hosts.some(R=>R.host===a)&&v.jsxs("option",{value:a,children:[a," (not in ~/.ssh/config)"]}),e.hosts.map(R=>v.jsx("option",{value:R.host,children:R.host},R.host))]})]}),v.jsxs("label",{children:["Partition",v.jsx("input",{className:"mono",type:"text",list:"slurm-partitions",value:c,onChange:R=>o(R.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1}),v.jsx("datalist",{id:"slurm-partitions",children:x==null?void 0:x.partitions.map(R=>v.jsx("option",{value:R},R))})]})]}),v.jsxs("div",{className:"row2",children:[v.jsxs("label",{children:["Account",v.jsx("input",{className:"mono",type:"text",value:u,onChange:R=>f(R.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1})]}),v.jsxs("label",{children:["Time limit",v.jsx("input",{className:"mono",type:"text",value:g,onChange:R=>d(R.target.value),placeholder:"cluster default (e.g. 4h, 30m)",autoComplete:"off",spellCheck:!1})]})]}),w&&v.jsx("div",{className:"error",children:w}),v.jsxs("div",{className:"actions",children:[v.jsx("button",{type:"submit",className:"btn primary",disabled:m||k,children:m?"Saving…":"Save"}),v.jsx("button",{type:"button",className:"btn",onClick:()=>void T(a),disabled:!a||b==="testing",title:a?void 0:"Pick a login node first",children:"Test connection"})]})]})]}):v.jsxs("div",{className:"settings-loading",children:[v.jsx("span",{className:"spinner"})," Loading slurm settings…"]})]})}const EL=[{id:"hf",label:"HF Jobs"},{id:"modal",label:"Modal"},{id:"k8s",label:"Kubernetes"},{id:"ssh",label:"SSH"},{id:"slurm",label:"Slurm"}];function kL(){const[e,t]=Y.useState("hf");return v.jsxs(v.Fragment,{children:[v.jsx("h1",{children:"Compute"}),v.jsxs("p",{className:"settings-sub",children:["Run experiments on external compute with"," ",v.jsx("code",{children:"--backend --flavor "}),"."]}),v.jsx("div",{className:"harness-tabs",children:EL.map(n=>v.jsx("button",{className:n.id===e?"active":"",onClick:()=>t(n.id),children:n.label},n.id))}),e==="hf"&&v.jsx(DL,{}),e==="modal"&&v.jsx(bL,{}),e==="k8s"&&v.jsx(_L,{}),e==="ssh"&&v.jsx(xL,{}),e==="slurm"&&v.jsx(CL,{})]})}const AL={env:"HF_TOKEN env var",openresearchEnv:"~/.openresearch/env",hfCache:"~/.cache/huggingface/token (hf auth login)"};function TL({settings:e}){return e.configured?e.valid?v.jsx("span",{className:"badge ok",children:"connected"}):v.jsx("span",{className:"badge err",children:"invalid token"}):v.jsx("span",{className:"badge",children:"not configured"})}function NL({settings:e}){return!e.configured||!e.valid?null:e.jobsWrite===!0?v.jsx("span",{className:"badge ok",children:"jobs: write OK"}):e.jobsWrite===!1?v.jsx("span",{className:"badge err",children:"no job.write permission"}):v.jsx("span",{className:"badge",children:"jobs permission unknown"})}function DL(){const[e,t]=Y.useState(null),[n,r]=Y.useState(null),[a,l]=Y.useState(""),[c,o]=Y.useState(!1),[u,f]=Y.useState(null),g=Y.useRef(!1);Y.useEffect(()=>{xT().then(m=>{g.current||t(m)}).catch(m=>{g.current||r(m instanceof Error?m.message:String(m))})},[]);async function d(m){if(m.preventDefault(),!(!a.trim()||c)){o(!0),f(null);try{const _=await wT(a.trim());g.current=!0,t(_),r(null),l("")}catch(_){f(_ instanceof Error?_.message:String(_))}finally{o(!1)}}}return v.jsxs("div",{className:"settings-card",children:[v.jsxs("div",{className:"settings-card-head",children:[v.jsx("h3",{children:"Hugging Face Jobs"}),v.jsx("div",{className:"spacer",style:{flex:1}}),e&&v.jsx(TL,{settings:e})]}),v.jsxs("p",{className:"settings-sub",children:["Run experiments on your Hugging Face account with"," ",v.jsx("code",{children:"--backend hf --flavor "})," (t4-small, a10g-small, a100-large, …). Billed to HF per minute."]}),n?v.jsx("div",{className:"error",children:n}):e?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"kv",children:[v.jsx("span",{className:"k",children:"Account"}),v.jsx("span",{className:"v",children:e.username??"—"}),v.jsx("span",{className:"k",children:"Token"}),v.jsx("span",{className:"v",children:e.maskedToken??"—"}),v.jsx("span",{className:"k",children:"Source"}),v.jsx("span",{className:"v",children:e.source?AL[e.source]:"not configured"}),v.jsx("span",{className:"k",children:"Jobs"}),v.jsxs("span",{className:"v",children:[v.jsx(NL,{settings:e}),(!e.configured||!e.valid)&&"—"]})]}),e.source==="env"&&v.jsx("p",{className:"settings-note",children:"HF_TOKEN is set in the environment and overrides any token saved here."}),e.valid&&e.jobsWrite===null&&v.jsxs("p",{className:"settings-note",children:["This token is valid but doesn't report whether it can launch Jobs — OAuth tokens from ",v.jsx("code",{children:"hf auth login"})," never do. Launches may still work; for a definitive check, save a write-scoped token from"," ",v.jsx("a",{href:"https://huggingface.co/settings/tokens",target:"_blank",rel:"noreferrer",children:"huggingface.co/settings/tokens"}),"."]})]}):v.jsxs("div",{className:"settings-loading",children:[v.jsx("span",{className:"spinner"})," Loading status…"]}),v.jsxs("form",{className:"form settings-form",onSubmit:d,children:[v.jsxs("label",{children:[e!=null&&e.configured?"Replace token":"New token",v.jsx("input",{type:"password",value:a,onChange:m=>l(m.target.value),placeholder:"hf_…",autoComplete:"off"})]}),u&&v.jsx("div",{className:"error",children:u}),v.jsx("div",{className:"actions",children:v.jsx("button",{type:"submit",className:"btn primary",disabled:!a.trim()||c,children:c?"Validating…":"Save"})})]})]})}const fw=/^hf_[A-Za-z0-9]{10,}$/;function dw(){return v.jsx("tr",{children:v.jsx("td",{colSpan:3,children:v.jsxs("p",{className:"settings-note",children:["This value looks like a Hugging Face token — compute runs only read it from"," ",v.jsx("code",{children:"HF_TOKEN"}),". Save it under that key if it's meant for HF Jobs."]})})})}const O1=["HF_TOKEN","WANDB_API_KEY"];function RL({name:e,entry:t,onVars:n,onError:r}){const[a,l]=Y.useState(""),[c,o]=Y.useState(!1),u=d=>r(`${e}: ${d instanceof Error?d.message:String(d)}`);async function f(){if(!(!a.trim()||c)){o(!0);try{n(await PS(e,a.trim())),l("")}catch(d){u(d)}finally{o(!1)}}}async function g(){if(!c){o(!0);try{n(await NT(e))}catch(d){u(d)}finally{o(!1)}}}return v.jsxs(v.Fragment,{children:[v.jsxs("tr",{children:[v.jsx("td",{className:"mono",children:e}),v.jsx("td",{className:"mono muted",children:t?v.jsxs(v.Fragment,{children:[t.maskedValue,t.inProcessEnv&&v.jsx("span",{className:"badge",children:"overridden by env"})]}):v.jsx("input",{className:"mono",type:"password",value:a,onChange:d=>l(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),f()),d.key==="Escape"&&!c&&l("")},placeholder:"value","aria-label":`Value for ${e}`,autoComplete:"new-password",disabled:c})}),v.jsx("td",{children:t?v.jsx("button",{className:"icon-btn",title:`Delete ${e}`,"aria-label":`Delete ${e}`,onClick:()=>void g(),disabled:c,children:v.jsx(Hu,{size:13})}):a.trim()&&v.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:c,children:c?"Saving…":"Save"})})]}),!t&&e!=="HF_TOKEN"&&fw.test(a.trim())&&v.jsx(dw,{})]})}function ML({onVars:e,onError:t,onDone:n}){const[r,a]=Y.useState(""),[l,c]=Y.useState(""),[o,u]=Y.useState(!1);async function f(){if(!(!r.trim()||!l.trim()||o)){u(!0);try{e(await PS(r.trim(),l.trim())),n()}catch(d){t(`${r.trim()}: ${d instanceof Error?d.message:String(d)}`)}finally{u(!1)}}}const g=d=>{d.key==="Enter"&&(d.preventDefault(),f()),d.key==="Escape"&&!o&&n()};return v.jsxs(v.Fragment,{children:[v.jsxs("tr",{children:[v.jsx("td",{children:v.jsx("input",{autoFocus:!0,className:"mono",type:"text",value:r,onChange:d=>a(d.target.value),onKeyDown:g,placeholder:"MY_API_KEY","aria-label":"New variable key",autoComplete:"off",spellCheck:!1,disabled:o})}),v.jsx("td",{children:v.jsx("input",{className:"mono",type:"password",value:l,onChange:d=>c(d.target.value),onKeyDown:g,placeholder:"value","aria-label":"New variable value",autoComplete:"new-password",disabled:o})}),v.jsxs("td",{children:[v.jsx("button",{className:"btn sm",onClick:()=>void f(),disabled:o||!r.trim()||!l.trim(),children:o?"Saving…":"Save"}),v.jsx("button",{className:"icon-btn",title:"Cancel","aria-label":"Cancel new variable",onClick:n,disabled:o,children:v.jsx(Mo,{size:13})})]})]}),r.trim()!=="HF_TOKEN"&&fw.test(l.trim())&&v.jsx(dw,{})]})}function LL(){const[e,t]=Y.useState(null),[n,r]=Y.useState(null),[a,l]=Y.useState(!1),[c,o]=Y.useState(null);Y.useEffect(()=>{TT().then(t).catch(d=>r(d instanceof Error?d.message:String(d)))},[]);const u=d=>{t(d),o(null)},f=e===null?[]:e.map(d=>d.key).filter(d=>!O1.includes(d)),g=[...O1,...f];return v.jsxs("div",{className:"settings-card",children:[v.jsxs("div",{className:"settings-card-head",children:[v.jsx("h3",{children:"Environment variables"}),v.jsx("div",{className:"spacer",style:{flex:1}}),v.jsxs("button",{className:"btn sm",onClick:()=>l(!0),disabled:a||e===null,children:[v.jsx(yg,{size:12})," Add variable"]})]}),v.jsxs("p",{className:"settings-sub",children:["Stored in ",v.jsx("code",{children:"~/.openresearch/env"})," and passed to runs and the research agent."," ",v.jsx("code",{children:"HF_TOKEN"})," and ",v.jsx("code",{children:"WANDB_API_KEY"})," are always listed since runs typically need them. Variables set in orx's own environment win on conflicts."]}),n?v.jsx("div",{className:"error",children:n}):e===null?v.jsxs("div",{className:"settings-loading",children:[v.jsx("span",{className:"spinner"})," Loading…"]}):v.jsx("table",{className:"env-table",children:v.jsxs("tbody",{children:[g.map(d=>v.jsx(RL,{name:d,entry:e.find(m=>m.key===d),onVars:u,onError:o},d)),a&&v.jsx(ML,{onVars:u,onError:o,onDone:()=>l(!1)})]})}),c&&v.jsx("div",{className:"error",children:c})]})}function OL(){const[e,t]=Y.useState(null),[n,r]=Y.useState(""),[a,l]=Y.useState(""),[c,o]=Y.useState(!1),[u,f]=Y.useState(null);Y.useEffect(()=>{$S().then(m=>{t(m),r(m.userName??""),l(m.userEmail??"")}).catch(()=>{})},[]);const g=e!==null&&n.trim()===(e.userName??"")&&a.trim()===(e.userEmail??"");async function d(m){if(m.preventDefault(),!(c||g)){o(!0),f(null);try{const _=await FT({userName:n.trim(),userEmail:a.trim()});t(_),r(_.userName??""),l(_.userEmail??"")}catch(_){f(_ instanceof Error?_.message:String(_))}finally{o(!1)}}}return v.jsxs(v.Fragment,{children:[v.jsx("h1",{children:"Git"}),v.jsx("p",{className:"settings-sub",children:"Experiment branches are committed and pushed from local clones with this identity."}),e?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"settings-card",children:[v.jsx("h3",{children:"Identity"}),v.jsxs("form",{className:"form",onSubmit:d,children:[v.jsxs("div",{className:"row2",children:[v.jsxs("label",{children:["user.name",v.jsx("input",{type:"text",value:n,onChange:m=>r(m.target.value),autoComplete:"off"})]}),v.jsxs("label",{children:["user.email",v.jsx("input",{type:"text",value:a,onChange:m=>l(m.target.value),autoComplete:"off"})]})]}),u&&v.jsx("div",{className:"error",children:u}),v.jsx("div",{className:"actions",children:v.jsx("button",{type:"submit",className:"btn primary",disabled:c||g||!n.trim()&&!a.trim(),children:c?"Saving…":"Save"})})]})]}),v.jsxs("div",{className:"settings-card",children:[v.jsx("h3",{children:"GitHub access"}),v.jsxs("div",{className:"kv",children:[v.jsx("span",{className:"k",children:"git"}),v.jsx("span",{className:"v",children:e.gitVersion??"not found"}),v.jsx("span",{className:"k",children:"Token"}),v.jsx("span",{className:"v",children:e.githubTokenSource==="env"?"GITHUB_TOKEN env var":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"gh CLI (gh auth token)":"none found"})]}),!e.githubTokenSource&&v.jsxs(v.Fragment,{children:[v.jsxs("p",{className:"settings-note",children:["No GitHub token found — private repo clones and branch pushes will fail. Run"," ",v.jsx("code",{children:"gh auth login"}),", or paste a personal access token:"]}),v.jsx(hw,{onSaved:t})]}),e.githubTokenSource==="stored"&&v.jsx("div",{className:"actions",children:v.jsx("button",{className:"btn",onClick:()=>{UT().then(t).catch(()=>{})},children:"Remove saved token"})})]})]}):v.jsxs("div",{className:"settings-loading",children:[v.jsx("span",{className:"spinner"})," Loading…"]})]})}function jL({value:e,max:t,label:n}){const r=t>0?Math.min(100,Math.round(e/t*100)):0;return v.jsxs("div",{className:"progress",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,children:[v.jsx("div",{className:"progress-track",children:v.jsx("div",{className:"progress-fill",style:{width:`${r}%`}})}),v.jsxs("div",{className:"progress-caption",children:[v.jsx("span",{children:n??`${r}%`}),t>0&&v.jsxs("span",{className:"mono",children:[Lo(e)," / ",Lo(t)]})]})]})}const BL={env:"ORX_DATA_DIR environment variable",config:"your saved setting",xdg:"XDG_DATA_HOME",default:"default location"};function IL(){const[e,t]=Y.useState(null),[n,r]=Y.useState(null),[a,l]=Y.useState(""),[c,o]=Y.useState(!1),[u,f]=Y.useState(null),[g,d]=Y.useState({kind:"idle"}),[m,_]=Y.useState(null),w=()=>US().then(k=>{t(k),l(D=>D||k.current)}).catch(k=>r(k instanceof Error?k.message:String(k)));Y.useEffect(()=>{w()},[]),Y.useEffect(()=>aN(k=>{k.type==="progress"?d(D=>{const T=D.kind==="moving"?D.total:0;return{kind:"moving",phase:k.phase,copied:k.copiedBytes,total:k.totalBytes||T}}):k.type==="done"?(d({kind:"done",oldPathLeft:k.oldPathLeft}),f(null),l(""),w()):k.type==="error"&&d({kind:"error",message:k.error})}),[]);const C=(e==null?void 0:e.source)==="env",b=a.trim(),S=e!==null&&b===e.current;async function x(){if(!(c||!b)){o(!0),_(null),f(null);try{f(await DT(b))}catch(k){_(k instanceof Error?k.message:String(k))}finally{o(!1)}}}async function y(k){if(k.preventDefault(),!(g.kind==="moving"||!b||S)&&(_(null),!!window.confirm(`Move all orx data to: +${b} -Its transcript is permanently removed.`)){try{await IT(he.id)}catch(Ze){window.alert(`Failed to delete "${Ce}": ${Ze instanceof Error?Ze.message:String(Ze)}`);return}ct(he.id)}}function Le(he){_&&(T({type:"busy",sessionId:_,busy:!0}),GT(_,he).catch(()=>{_&&T({type:"busy",sessionId:_,busy:!1})}))}const je=d.filter(he=>C==="all"?!0:C==="archived"?he.archived:!he.archived),wt=S.jsxs("aside",{className:"session-rail floating-panel",children:[n,S.jsxs("nav",{className:"rail-nav",children:[S.jsxs("button",{className:"rail-nav-item",onClick:()=>{w(null),c("chat")},children:[S.jsx(pg,{size:15}),"New session"]}),S.jsxs("button",{className:`rail-nav-item ${l==="files"?"active":""}`,onClick:()=>c("files"),children:[S.jsx(jA,{size:15}),"Files"]}),CL.map(he=>S.jsxs("button",{className:`rail-nav-item ${l===he.id?"active":""}`,onClick:()=>c(he.id),children:[he.icon,he.label]},he.id))]}),S.jsxs("div",{className:"rail-body",children:[S.jsxs("div",{className:"rail-section-head",children:[S.jsx("div",{className:"rail-section-label",children:((Ct=dw.find(he=>he.id===C))==null?void 0:Ct.railLabel)??"Recents"}),S.jsx(IL,{value:C,onChange:y})]}),je.map(he=>S.jsx(zL,{session:he,active:he.id===_&&l==="chat",busy:D.busySessions.has(he.id),onOpen:()=>{w(he.id),c("chat")},onRename:Ce=>Se(he,Ce),onSetArchived:Ce=>de(he,Ce),onDelete:()=>void Ee(he)},he.id)),je.length===0&&S.jsx("div",{className:"rail-empty",children:C==="archived"?"No archived sessions":d.length>0?"No active sessions":"No sessions yet"})]})]}),Ue=`chat-header${r?"":" rail-hidden"}`,Tt=!r&&S.jsx("button",{className:"icon-btn",title:"Show sidebar","aria-label":"Show sidebar",onClick:a,children:S.jsx(MS,{size:15})});return l!=="chat"?S.jsxs(S.Fragment,{children:[r&&wt,S.jsxs("section",{className:"chat-pane",children:[!r&&S.jsx("div",{className:Ue,children:Tt}),S.jsx("div",{className:"settings-view-scroll",children:g})]})]}):S.jsxs(S.Fragment,{children:[r&&wt,S.jsxs("section",{className:"chat-pane",children:[S.jsxs("div",{className:Ue,children:[Tt,S.jsx("div",{className:"title",title:lt?((Ut=lt.title)==null?void 0:Ut.trim())||"Untitled":"New session",children:lt?((nt=lt.title)==null?void 0:nt.trim())||"Untitled":"New session"}),S.jsx("button",{className:`icon-btn ${o?"active":""}`,title:"Experiments","aria-label":"Experiments",onClick:u,children:S.jsx(LA,{size:15})})]}),Rt?S.jsx("div",{className:"chat-thread",ref:q,onScroll:he=>{const Ce=he.currentTarget;X.current=Ce.scrollHeight-Ce.scrollTop-Ce.clientHeight<60},children:S.jsxs("div",{className:"chat-thread-inner",ref:G,children:[Ve.map(he=>S.jsx(BL,{message:he,onOpenFile:f&&(Ce=>f(Ce,_??void 0)),onRespond:Le},he.id)),Pe&&S.jsxs("div",{className:"working",children:[S.jsx("span",{className:"spinner"})," Working…"]})]})}):S.jsxs("div",{className:"chat-empty",children:[S.jsxs("h2",{children:["Open",S.jsx("span",{children:"Research"})]}),S.jsx("p",{children:"Ask the agent to explore your codebase, create and run your baseline experiment, and branch variants off it."}),S.jsx(RL,{harnesses:R,selection:L??M1(R)}),t&&S.jsxs("button",{type:"button",className:"chat-suggest mono",title:"Prefills the composer — add the compute to run on, then send",onClick:()=>{var he;x(`/reproduce-paper ${t} on `),(he=K.current)==null||he.focus()},children:["/reproduce-paper ",t," on [describe your compute setup]"]})]}),S.jsx("div",{className:"composer",children:S.jsxs("div",{className:"composer-box",children:[Z&&S.jsx(kL,{skills:se,activeIndex:P,onPick:ee,onHover:$}),v.length>0&&S.jsx("div",{className:"composer-attachments",children:v.map((he,Ce)=>S.jsxs("div",{className:"attachment-thumb",children:[S.jsx("img",{src:he.dataUrl,alt:"pasted"}),S.jsx("button",{title:"Remove image","aria-label":"Remove image",onClick:()=>k(Oe=>Oe.filter((Ze,ot)=>ot!==Ce)),children:S.jsx(Ro,{size:11})})]},Ce))}),S.jsx("textarea",{ref:K,value:b,placeholder:me?`Message ${cw[me.harness]}… ( / for skills)`:"Ask the research agent… ( / for skills)",rows:2,onPaste:pe,onDragOver:he=>{he.dataTransfer.types.includes("Files")&&he.preventDefault()},onDrop:he=>{he.dataTransfer.files.length!==0&&(he.preventDefault(),te(Array.from(he.dataTransfer.files)))},onChange:he=>{x(he.target.value),Q(!1)},onKeyDown:he=>{if(Z){if(he.key==="ArrowDown"||he.key==="ArrowUp"){he.preventDefault();const Ce=he.key==="ArrowDown"?1:-1;$((P+Ce+se.length)%se.length);return}if(he.key==="Enter"||he.key==="Tab"){he.preventDefault(),ee(se[P]);return}if(he.key==="Escape"){he.preventDefault(),Q(!0);return}}he.key==="Enter"&&!he.shiftKey&&(he.preventDefault(),gt())}}),S.jsxs("div",{className:"composer-actions",children:[S.jsx(L1,{choices:(le==null?void 0:le.permissionModes)??[],value:(me==null?void 0:me.permissionMode)??null,defaultId:(le==null?void 0:le.defaultPermissionMode)??null,header:"Mode",align:"left",variant:"pill",numbered:!0,title:"Permission mode for this chat",onSelect:be}),S.jsx("div",{style:{flex:1}}),S.jsx(AL,{value:me,onSelect:ye,onHarnesses:N,lockHarness:!!ue}),S.jsx(L1,{choices:(le==null?void 0:le.reasoningLevels)??[],value:(me==null?void 0:me.reasoningLevel)??null,defaultId:(le==null?void 0:le.defaultReasoningLevel)??null,header:"Reasoning",align:"right",variant:"bare",title:"Reasoning level for this chat",onSelect:Be}),Pe?S.jsx("button",{className:"send-btn stop",title:"Stop","aria-label":"Stop",onClick:tt,children:S.jsx(Ro,{size:16})}):S.jsx("button",{className:"send-btn",title:"Send","aria-label":"Send",onClick:()=>void gt(),disabled:!b.trim()&&v.length===0,children:S.jsx(wA,{size:16})})]})]})})]})]})}const FL="project";function PL(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")}function UL(e){if(!e.startsWith("---"))return e;const t=e.indexOf(` ----`,3);return t===-1?e:e.slice(t+4).replace(/^\r?\n/,"")}function $L(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const GL=/\.(png|jpe?g|gif|webp|svg)$/i;function Hp(e,t){for(const n of e){if(n.path===t)return n;if(n.isDir&&t.startsWith(n.path+"/")){const r=Hp(n.children??[],t);if(r)return r}}return null}function qL({projectId:e,folder:t,markdown:n}){const r=a=>PL(a)?a:Sp(e,`${t}/${a.replace(/^\.?\//,"")}`);return S.jsx("div",{className:"md report-md",children:S.jsx(Ex,{remarkPlugins:[Xx],components:{a:({href:a,children:l,...c})=>{const o=!a||a.startsWith("#");return S.jsx("a",{...c,href:o?a:r(a),...o?{}:{target:"_blank",rel:"noopener noreferrer"},children:l})},img:({src:a,alt:l})=>{if(!a||typeof a!="string")return null;const c=r(a);return S.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"report-img",children:[S.jsx("img",{src:c,alt:l??"",loading:"lazy"}),l&&S.jsx("span",{className:"report-img-caption",children:l})]})},...sw},children:UL(n)})})}function VL({projectId:e,entry:t,onBack:n,onDelete:r}){const[a,l]=W.useState(null),[c,o]=W.useState(null);return W.useEffect(()=>{NT(e,t.path).then(u=>l(u.markdown)).catch(u=>o(u instanceof Error?u.message:String(u)))},[e,t.path,t.modifiedAt]),S.jsx("div",{className:"report-view",children:S.jsxs("div",{className:"report-view-col",children:[S.jsxs("div",{className:"report-view-head",children:[S.jsxs("button",{className:"report-back",onClick:n,children:[S.jsx(hg,{size:13})," Files"]}),S.jsx("span",{style:{flex:1}}),S.jsx("span",{className:"report-date",children:new Date(t.modifiedAt).toLocaleString()}),S.jsx("button",{className:"icon-btn",title:"Delete report folder","aria-label":"Delete report folder",onClick:()=>{window.confirm(`Delete the "${t.path}" folder from the files dir?`)&&r()},children:S.jsx(Bu,{size:14})})]}),c?S.jsx("div",{className:"error",children:c}):a===null?S.jsxs("div",{className:"settings-loading",children:[S.jsx("span",{className:"spinner"})," Loading report…"]}):S.jsx(qL,{projectId:e,folder:t.path,markdown:a})]})})}function YL({dir:e}){const[t,n]=W.useState(!1);return S.jsxs("div",{className:"files-pill files-pill-dir",title:e,children:[S.jsx("code",{children:e}),S.jsx("button",{className:"icon-btn",title:"Copy path","aria-label":"Copy files directory path",onClick:()=>{var r;(r=navigator.clipboard)==null||r.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},children:t?S.jsx(si,{size:13}):S.jsx(dg,{size:13})})]})}function pw({projectId:e,entries:t,depth:n,expanded:r,onToggle:a,onOpenReport:l,onDelete:c}){return S.jsx(S.Fragment,{children:t.map(o=>{var g;const u={paddingLeft:14+n*22},f=S.jsx("button",{className:"icon-btn ftree-del",title:`Delete ${o.path}`,"aria-label":`Delete ${o.path}`,onClick:d=>{d.stopPropagation(),window.confirm(`Delete "${o.path}" from the files dir?`)&&c(o.path)},children:S.jsx(Bu,{size:13})});if(o.isDir){const d=o.reportTitle!==void 0,m=r.has(o.path),_=n===0?o.experiment:void 0,w=d&&n>0,C=_?[_.title,_.branchName].filter(Boolean).join(" — "):d&&!w?o.reportTitle:void 0;return S.jsxs("div",{children:[S.jsxs("div",{className:"ftree-row clickable",style:u,title:C,onClick:()=>d?l(o.path):a(o.path),children:[S.jsx("button",{className:`ftree-chevron ${m?"open":""}`,"aria-label":m?`Collapse ${o.name}`:`Expand ${o.name}`,onClick:y=>{y.stopPropagation(),a(o.path)},children:S.jsx(fg,{size:13})}),w?S.jsx("span",{className:"ftree-title",children:o.reportTitle}):S.jsxs("span",{className:"ftree-dirname",children:[o.name,"/"]}),d&&S.jsx("span",{className:"ftree-tag",children:"report"}),(_==null?void 0:_.latestRunStatus)&&S.jsx("span",{className:"ftree-status",children:_.latestRunStatus}),f,S.jsx("span",{className:"ftree-date",children:new Date(o.modifiedAt).toLocaleDateString()})]}),m&&(((g=o.children)==null?void 0:g.length)??0)>0&&S.jsx("div",{className:"ftree-children",children:S.jsx(pw,{projectId:e,entries:o.children??[],depth:n+1,expanded:r,onToggle:a,onOpenReport:l,onDelete:c})})]},o.path)}return S.jsxs("div",{className:"ftree-row",style:u,children:[S.jsx("span",{className:"ftree-chevron spacer"}),S.jsxs("a",{className:"ftree-link",href:Sp(e,o.path),target:"_blank",rel:"noopener noreferrer",title:o.path,children:[GL.test(o.name)&&S.jsx("img",{className:"ftree-thumb",src:Sp(e,o.path),alt:"",loading:"lazy"}),S.jsx("span",{className:"ftree-name",children:o.name})]}),f,S.jsx("span",{className:"ftree-size",children:$L(o.size)})]},o.path)})})}function WL(e){const t=[],n=[],r=[];for(const a of e)a.isDir&&a.name===FL?t.push(a):a.isDir&&a.experiment?n.push(a):r.push(a);return{project:t,experiments:n,other:r}}function XL({project:e,files:t,onChanged:n}){const[r,a]=W.useState(null),[l,c]=W.useState(new Set),o=r&&t?Hp(t.entries,r):null;W.useEffect(()=>{var C;r&&t&&!((C=Hp(t.entries,r))!=null&&C.reportTitle)&&a(null)},[r,t]);const u=C=>c(y=>{const b=new Set(y);return b.has(C)?b.delete(C):b.add(C),b}),f=C=>{DT(e.id,C).catch(()=>{}).finally(n)};if(o!=null&&o.reportTitle)return S.jsx(VL,{projectId:e.id,entry:o,onBack:()=>a(null),onDelete:()=>{f(o.path),a(null)}});if(!t)return S.jsx("div",{className:"files-tab",children:S.jsx("div",{className:"files-col",children:S.jsxs("div",{className:"settings-loading",children:[S.jsx("span",{className:"spinner"})," Loading files…"]})})});const{project:g,experiments:d,other:m}=WL(t.entries),_=C=>S.jsx(pw,{projectId:e.id,entries:C,depth:0,expanded:l,onToggle:u,onOpenReport:a,onDelete:f}),w=`https://github.com/${e.githubOwner}/${e.githubRepo}`;return S.jsx("div",{className:"files-tab",children:S.jsxs("div",{className:"files-col",children:[S.jsxs("div",{className:"files-meta",children:[S.jsxs("a",{className:"files-pill",href:w,target:"_blank",rel:"noopener noreferrer",children:[S.jsxs("code",{children:[e.githubOwner,"/",e.githubRepo]}),S.jsx(DS,{size:12})]}),S.jsx(YL,{dir:t.dir})]}),S.jsxs("p",{className:"files-hint",children:["An explorer over this folder — the agent writes each experiment's reports and figures into the folder named for its slug (project-wide reports under ",S.jsx("code",{children:"project/"}),"), and you can drop in your own files."]}),t.entries.length===0?S.jsxs("p",{className:"files-empty",children:["Nothing here yet. Ask the agent for a write-up of its findings — it saves each experiment's report folder (",S.jsx("code",{children:"report.md"})," + images) into the folder above."]}):S.jsxs("div",{className:"files-card",children:[_(g),_(d),m.length>0&&(d.length>0||g.length>0)&&S.jsx("div",{className:"ftree-divider",children:"Not linked to an experiment"}),_(m),t.truncated&&S.jsx("p",{className:"files-truncated",children:"Listing truncated — the folder has more files."})]})]})})}function j1({active:e,label:t,icon:n,onSelect:r,onClose:a}){return S.jsxs("button",{className:`tab closable ${e?"active":""}`,onClick:r,title:t,children:[n,S.jsx("span",{className:"tab-label",children:t}),S.jsx("span",{role:"button",className:"tab-close",title:"Close tab",onClick:l=>{l.stopPropagation(),a()},children:S.jsx(Ro,{size:12})})]})}function B1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function at(e){for(var t=1;t=0||(g[u]=c[u]);return g})(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Ke(e,t){return mw(e)||(function(n,r){var a=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(a!=null){var l,c,o,u,f=[],g=!0,d=!1;try{if(o=(a=a.call(n)).next,r===0){if(Object(a)!==a)return;g=!1}else for(;!(g=(l=o.call(a)).done)&&(f.push(l.value),f.length!==r);g=!0);}catch(m){d=!0,c=m}finally{try{if(!g&&a.return!=null&&(u=a.return(),Object(u)!==u))return}finally{if(d)throw c}}return f}})(e,t)||Wu(e,t)||vw()}function gw(e){return mw(e)||_w(e)||Wu(e)||vw()}function Tn(e){return(function(t){if(Array.isArray(t))return Pp(t)})(e)||_w(e)||Wu(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 mw(e){if(Array.isArray(e))return e}function _w(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Wu(e,t){if(e){if(typeof e=="string")return Pp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pp(e,t):void 0}}function Pp(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:a}}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 l,c=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return c=u.done,u},e:function(u){o=!0,l=u},f:function(){try{c||n.return==null||n.return()}finally{if(o)throw l}}}}var Ic=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nl(e,t){return e(t={exports:{}},t.exports),t.exports}var kn=nl((function(e){/*! +The store is copied to the new location and activated there. Active runs or chats will block the move.`))){d({kind:"moving",phase:"preparing",copied:0,total:(u==null?void 0:u.treeBytes)??0});try{await MT(b)}catch(D){d({kind:"idle"}),_(D instanceof Error?D.message:String(D))}}}return v.jsxs(v.Fragment,{children:[v.jsx("h1",{children:"Storage"}),v.jsxs("p",{className:"settings-sub",children:["Where orx keeps everything on this machine — the local database, run logs, artifacts, and chat attachments for ",v.jsx("strong",{children:"all"})," projects. Moving it copies the whole store to the new location and activates it there."]}),n?v.jsx("div",{className:"settings-card",children:v.jsx("div",{className:"error",children:n})}):e?v.jsxs("div",{className:"settings-card",children:[v.jsxs("div",{className:"settings-card-head",children:[v.jsx("h3",{children:"Data directory"}),v.jsx("div",{className:"spacer",style:{flex:1}}),v.jsx("span",{className:"badge",children:e.isDefault?"default":"custom"})]}),v.jsxs("div",{className:"kv",children:[v.jsx("span",{className:"k",children:"Current"}),v.jsx("span",{className:"v mono",children:e.current}),v.jsx("span",{className:"k",children:"Source"}),v.jsx("span",{className:"v",children:BL[e.source]}),!e.isDefault&&v.jsxs(v.Fragment,{children:[v.jsx("span",{className:"k",children:"Default"}),v.jsx("span",{className:"v mono",children:e.defaultPath})]})]}),C?v.jsxs("p",{className:"settings-note",children:["The data directory is pinned by the ",v.jsx("code",{children:"ORX_DATA_DIR"})," environment variable, which overrides this setting. Unset it to choose a location here."]}):v.jsxs("form",{className:"form settings-form",onSubmit:y,children:[v.jsxs("label",{children:["New location",v.jsx("input",{className:"mono",type:"text",value:a,onChange:k=>{l(k.target.value),f(null)},placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,disabled:g.kind==="moving"})]}),u&&!u.error&&u.ok&&v.jsxs("p",{className:"settings-note",children:["Ready to move ",Lo(u.treeBytes??0),u.freeBytes!=null&&` — ${Lo(u.freeBytes)} free at target`,u.sameFilesystem?" (same disk, instant)":"","."]}),u&&u.ok===!1&&u.error&&v.jsx("div",{className:"error",children:u.error}),m&&v.jsx("div",{className:"error",children:m}),g.kind==="moving"&&v.jsx(jL,{value:g.copied,max:g.total,label:`${g.phase.charAt(0).toUpperCase()}${g.phase.slice(1)}…`}),g.kind==="done"&&v.jsxs("p",{className:"settings-note",children:["Moved. orx is now using the new location.",g.oldPathLeft&&v.jsxs(v.Fragment,{children:[" ","The old copy was left at ",v.jsx("code",{children:g.oldPathLeft})," (different disk) — you can delete it once you've confirmed everything works."]})]}),g.kind==="error"&&v.jsxs("div",{className:"error",children:["Move failed: ",g.message]}),v.jsxs("div",{className:"actions",children:[v.jsx("button",{type:"button",className:"btn",onClick:x,disabled:c||!b||S||g.kind==="moving",children:c?"Checking…":"Check"}),v.jsx("button",{type:"submit",className:"btn primary",disabled:!b||S||g.kind==="moving",children:g.kind==="moving"?"Moving…":"Move data here"})]})]})]}):v.jsxs("div",{className:"settings-loading",children:[v.jsx("span",{className:"spinner"})," Loading…"]})]})}const Up=e=>e==="running"||e==="starting";function zL(e){return Up(e.status)?jy(Date.now()-e.createdAt):e.endedAt?jy(e.endedAt-e.createdAt):"—"}function j1({instances:e,emptyLabel:t}){return e.length===0?v.jsx("p",{className:"instances-empty",children:t}):v.jsx("div",{className:"instances-table-wrap",children:v.jsxs("table",{className:"runs-table",children:[v.jsx("thead",{children:v.jsxs("tr",{children:[v.jsx("th",{children:"Backend"}),v.jsx("th",{children:"Project"}),v.jsx("th",{children:"Status"}),v.jsx("th",{children:"Started"}),v.jsx("th",{children:"Runtime"})]})}),v.jsx("tbody",{children:e.map(n=>{var a;const r=typeof((a=n.backend)==null?void 0:a.url)=="string"?n.backend.url:void 0;return v.jsxs("tr",{children:[v.jsx("td",{children:v.jsxs("span",{className:"backend-cell",children:[v.jsx(fL,{backend:n.backend}),r&&v.jsx("a",{className:"icon-btn",href:r,target:"_blank",rel:"noreferrer",title:"Open job page","aria-label":"Open job page",onClick:l=>l.stopPropagation(),children:v.jsx(OS,{size:12})})]})}),v.jsx("td",{children:n.projectName??kp(n.projectId)}),v.jsx("td",{children:v.jsx(zo,{status:n.status})}),v.jsx("td",{children:fa(n.createdAt)}),v.jsx("td",{className:"mono",children:zL(n)})]},n.id)})})]})})}function HL(){const[e,t]=Y.useState(null),[n,r]=Y.useState(null),[a,l]=Y.useState(!1),[,c]=Y.useState(0);Y.useEffect(()=>{const d=setInterval(()=>c(m=>m+1),3e4);return()=>clearInterval(d)},[]);const o=()=>{l(!0),_T().then(d=>{t(d),r(null)}).catch(d=>{r(d instanceof Error?d.message:String(d)),t(m=>m??[])}).finally(()=>l(!1))};Y.useEffect(()=>o(),[]);const u=(d,m)=>m.createdAt-d.createdAt,f=e==null?void 0:e.filter(d=>Up(d.status)).sort(u),g=e==null?void 0:e.filter(d=>!Up(d.status)).sort(u);return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"settings-head-row",children:[v.jsx("h1",{children:"Instances"}),v.jsxs("button",{className:"btn sm",onClick:o,disabled:a,children:[v.jsx(mu,{size:12,className:a?"spin":""})," Refresh"]})]}),v.jsx("p",{className:"settings-sub",children:"Compute spun up across all projects — Modal, Hugging Face, SSH, Kubernetes, Slurm, and OpenResearch."}),n&&v.jsx("div",{className:"error",children:n}),!f||!g?v.jsxs("div",{className:"settings-loading",children:[v.jsx("span",{className:"spinner"})," Loading…"]}):v.jsxs(v.Fragment,{children:[v.jsxs("h2",{className:"instances-section-title",children:["Running",f.length>0&&v.jsx("span",{className:"count-badge",children:f.length})]}),v.jsx(j1,{instances:f,emptyLabel:"Nothing running right now."}),v.jsx("h2",{className:"instances-section-title",children:"Past"}),v.jsx(j1,{instances:g,emptyLabel:"No past instances yet."})]})]})}const FL=[{id:"harnesses",label:"Harnesses",icon:v.jsx(dA,{size:15})},{id:"compute",label:"Compute",icon:v.jsx(NA,{size:15})},{id:"instances",label:"Instances",icon:v.jsx(Cp,{size:15})},{id:"environment",label:"Environment",icon:v.jsx(sT,{size:15})},{id:"git",label:"Git",icon:v.jsx(zu,{size:15})},{id:"storage",label:"Storage",icon:v.jsx(UA,{size:15})}];function PL({tab:e}){return v.jsxs("div",{className:"settings-view",children:[e==="harnesses"&&v.jsx(gL,{}),e==="compute"&&v.jsx(kL,{}),e==="environment"&&v.jsxs(v.Fragment,{children:[v.jsx("h1",{children:"Environment"}),v.jsx("p",{className:"settings-sub",children:"Variables available to runs and the research agent (API keys, tokens)."}),v.jsx(LL,{})]}),e==="instances"&&v.jsx(HL,{}),e==="git"&&v.jsx(OL,{}),e==="storage"&&v.jsx(IL,{})]})}function UL({skills:e,activeIndex:t,onPick:n,onHover:r}){return v.jsx("div",{className:"skill-menu",children:e.map((a,l)=>v.jsxs("button",{type:"button",className:`skill-item ${l===t?"active":""}`,onMouseDown:c=>{c.preventDefault(),n(a)},onMouseEnter:()=>r(l),children:[v.jsxs("span",{className:"skill-name",children:["/",a.name," ",v.jsx("span",{className:"skill-hint",children:a.argHint})]}),v.jsx("span",{className:"skill-desc",children:a.description})]},a.name))})}const pw={"claude-code":"Claude Code",codex:"Codex",opencode:"OpenCode"};function B1(e){var n,r,a;const t=e.find(l=>l.agentReady);return t?{harness:t.id,model:((n=t.models[0])==null?void 0:n.id)??null,permissionMode:((r=t.options)==null?void 0:r.defaultPermissionMode)??null,reasoningLevel:((a=t.options)==null?void 0:a.defaultReasoningLevel)??null}:null}function Ku(){const[e,t]=Y.useState(!1),n=Y.useRef(null);return Y.useEffect(()=>{if(!e)return;const r=l=>{var c;(c=n.current)!=null&&c.contains(l.target)||t(!1)},a=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t(!1))};return document.addEventListener("mousedown",r),document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",a,!0)}},[e]),{open:e,setOpen:t,ref:n}}function $L({value:e,onSelect:t,onHarnesses:n,lockHarness:r=!1}){const[a,l]=Y.useState([]),{open:c,setOpen:o,ref:u}=Ku(),[f,g]=Y.useState("");Y.useEffect(()=>{bg().then(w=>{l(w),n==null||n(w)}).catch(()=>{})},[]);const d=Y.useMemo(()=>{const w=f.trim().toLowerCase();return(r&&e?a.filter(b=>b.id===e.harness):a).map(b=>{let S=b.models;return w?S=S.filter(x=>x.id.toLowerCase().includes(w)):b.id==="opencode"&&(S=S.slice(0,6)),{harness:b,models:S,hidden:w?0:b.models.length-S.length}})},[a,f,r,e]),m=(w,C)=>{var S,x;const b=(e==null?void 0:e.harness)===w.id;t({harness:w.id,model:C,permissionMode:b?e.permissionMode:((S=w.options)==null?void 0:S.defaultPermissionMode)??null,reasoningLevel:b?e.reasoningLevel:((x=w.options)==null?void 0:x.defaultReasoningLevel)??null}),o(!1),g("")},_=e?e.model?_u(e.model):"Default model":"Model";return v.jsxs("div",{className:"model-picker",ref:u,children:[v.jsxs("button",{type:"button",className:"composer-pill",title:"Harness + model for this chat",onClick:()=>o(w=>!w),children:[_,v.jsx(Iu,{size:12})]}),c&&v.jsxs("div",{className:"model-menu align-right",children:[v.jsx("input",{autoFocus:!0,type:"text",placeholder:"Search models…",value:f,onChange:w=>g(w.target.value)}),v.jsxs("div",{className:"model-menu-list",children:[d.map(({harness:w,models:C,hidden:b})=>v.jsxs("div",{children:[v.jsx("div",{className:"model-group",children:w.name}),w.agentReady?v.jsxs(v.Fragment,{children:[C.map(S=>v.jsxs("button",{className:"model-item",onClick:()=>m(w,S.id),children:[v.jsxs("span",{children:[_u(S.id),v.jsx("span",{className:"model-id",children:S.id})]}),(e==null?void 0:e.harness)===w.id&&(e==null?void 0:e.model)===S.id&&v.jsx(_n,{size:13})]},S.id)),b>0&&v.jsxs("div",{className:"model-more",children:[b," more — search to find"]})]}):v.jsx("div",{className:"model-more",children:w.agentNote??"Not available"})]},w.id)),a.length===0&&v.jsx("div",{className:"model-more",children:"Detecting harnesses…"})]}),r&&e&&a.length>1&&v.jsxs("div",{className:"model-locked-note",children:[v.jsx(VA,{size:11}),"Sessions keep their harness — new chat to switch"]})]})]})}function I1({choices:e,value:t,defaultId:n,header:r,align:a="left",variant:l="pill",title:c,numbered:o=!1,onSelect:u}){var S,x;const{open:f,setOpen:g,ref:d}=Ku();if(e.length===0)return null;const m=t??n??((S=e[0])==null?void 0:S.id)??null,_=e.find(y=>y.id===m),w=e.find(y=>y.id===n),C=(_==null?void 0:_.label)??((x=e[0])==null?void 0:x.label)??"",b=y=>{u(y),g(!1)};return v.jsxs("div",{className:"option-picker",ref:d,children:[v.jsxs("button",{type:"button",className:l==="pill"?"composer-pill":"composer-bare",title:c,onClick:()=>g(y=>!y),children:[C,v.jsx(Iu,{size:12})]}),f&&v.jsxs("div",{className:`option-menu ${a==="right"?"align-right":""}`,children:[r&&v.jsx("div",{className:"model-group",children:r}),w&&v.jsxs(v.Fragment,{children:[v.jsxs("button",{className:"model-item",onClick:()=>b(w.id),children:[v.jsxs("span",{children:[w.label," ",v.jsx("span",{className:"option-default",children:"· Default"})]}),m===w.id&&v.jsx(_n,{size:13})]}),v.jsx("div",{className:"option-sep"})]}),e.map((y,k)=>v.jsxs("button",{className:"model-item",onClick:()=>b(y.id),children:[v.jsx("span",{children:y.label}),m===y.id?v.jsx(_n,{size:13}):o&&v.jsx("span",{className:"option-num",children:k+1})]},y.id))]})]})}const gw="orx:agent-selection";function GL(){try{const e=localStorage.getItem(gw);return e?JSON.parse(e):null}catch{return null}}const $p="local-";function qL(e,t){const n=e.findIndex(a=>a.id===t.id);if(n>=0){const a=e.slice();return a[n]=t,a}return[...t.role==="user"?e.filter(a=>!a.id.startsWith($p)):e,t]}function VL(e,t){switch(t.type){case"reset":return{messagesBySession:{},busySessions:new Set};case"seed":return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:t.messages}};case"upsertMessage":{const n=e.messagesBySession[t.sessionId]??[];return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:qL(n,t.message)}}}case"optimisticUser":{const n=e.messagesBySession[t.sessionId]??[],r=t.text?[{id:"p0",type:"text",text:t.text}]:[];t.imageUrls.forEach((l,c)=>r.push({id:`img${c}`,type:"image",text:l}));const a={id:`${$p}${Date.now()}`,role:"user",parts:r,createdAt:Date.now()};return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:[...n,a]}}}case"dropOptimisticUser":{const n=e.messagesBySession[t.sessionId];if(!(n!=null&&n.length))return e;const r=n[n.length-1];return r.role!=="user"||!r.id.startsWith($p)?e:{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:n.slice(0,-1)}}}case"busy":{const n=new Set(e.busySessions);return t.busy?n.add(t.sessionId):n.delete(t.sessionId),{...e,busySessions:n}}case"seedBusy":return{...e,busySessions:new Set(t.sessions)};case"forget":{const n={...e.messagesBySession};delete n[t.sessionId];const r=new Set(e.busySessions);return r.delete(t.sessionId),{messagesBySession:n,busySessions:r}}}}function YL({harnesses:e,selection:t}){if(e.length===0)return null;const n=t?e.find(r=>r.id===t.harness):void 0;return n?v.jsxs("p",{className:"chat-empty-hint",children:["Chatting with ",n.name,n.account?` as ${n.account}`:""," — detected automatically, switch in the model picker below."]}):v.jsx("p",{className:"chat-empty-hint",children:"No coding agent detected on this machine — install Claude Code, Codex or opencode and sign in, then re-open the model picker below."})}function mw(e){return e==="error"?"tool-status error":e==="completed"?"tool-status":"tool-status running"}function WL(e){if(!e)return"";const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return"now";const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function z1(e){const t=e.replace(/\/+$/,"");return t.slice(t.lastIndexOf("/")+1)||t}function Gp(e){var c,o;const t=e.tool??"tool",n=((c=e.state)==null?void 0:c.input)??{},r=typeof n.command=="string"?n.command:null,a=typeof n.filePath=="string"?n.filePath:null,l=typeof n.description=="string"?n.description:null;switch(t){case"Bash":case"bash":return r?`Ran ${r}`:"Ran command";case"Read":return a?`Read ${z1(a)}`:"Read file";case"Edit":case"Write":case"NotebookEdit":return a?`Edited ${z1(a)}`:"Edited file";case"Grep":return typeof n.pattern=="string"?`Searched “${n.pattern}”`:"Searched";case"Glob":return typeof n.pattern=="string"?`Found ${n.pattern}`:"Listed files";case"WebFetch":case"WebSearch":return l??"Searched the web";case"Task":return l??"Ran a subagent";case"error":return"Error";default:{const u=l??a??r??((o=e.state)==null?void 0:o.title)??"";return u?`${t}: ${u}`:t}}}function XL({part:e,onOpenFile:t}){var o,u;const n=e.state,r=(n==null?void 0:n.error)||(n==null?void 0:n.output)||"",a=typeof((o=n==null?void 0:n.input)==null?void 0:o.command)=="string"?n.input.command:null,l=typeof((u=n==null?void 0:n.input)==null?void 0:u.filePath)=="string"?n.input.filePath:null,c=!!(r||a||l);return v.jsxs("details",{className:"tool-row",open:!1,children:[v.jsxs("summary",{children:[v.jsx("span",{className:mw(n==null?void 0:n.status)}),v.jsx("span",{className:"tool-line",children:Gp(e)}),l&&t&&v.jsx("button",{className:"tool-open file-link",title:`Open ${l}`,onClick:f=>{f.preventDefault(),f.stopPropagation(),t(l)},children:"open"})]}),c&&v.jsxs("div",{className:"tool-detail",children:[a&&v.jsx("div",{className:"tool-cmd-full",children:a}),r&&v.jsx("div",{className:"tool-output",children:r.slice(0,2e4)})]})]})}function KL({parts:e,onOpenFile:t}){const n=e.some(u=>{var f;return((f=u.state)==null?void 0:f.status)==="running"}),r=e.some(u=>{var f;return((f=u.state)==null?void 0:f.status)==="error"}),[a,l]=Y.useState(!1),c=a||n,o=e.length===1?Gp(e[0]):n?Gp(e.find(u=>{var f;return((f=u.state)==null?void 0:f.status)==="running"})??e[e.length-1]):`Used ${e.length} tools`;return v.jsxs("div",{className:`tool-group ${r?"has-error":""}`,children:[v.jsxs("button",{className:"tool-group-summary",onClick:()=>l(u=>!u),children:[v.jsx("span",{className:mw(n?"running":r?"error":"completed")}),v.jsx("span",{className:"tool-line",children:o}),v.jsx(_g,{size:12,className:`tool-chevron ${c?"open":""}`})]}),c&&v.jsx("div",{className:"tool-group-rows",children:e.map(u=>v.jsx(XL,{part:u,onOpenFile:t},u.id))})]})}function ZL({part:e,onRespond:t,onOpenFile:n}){var f,g,d;const r=e.prompt,[a,l]=Y.useState([]),c=r.resolved||!t,o=m=>t==null?void 0:t({promptId:e.id,...m});if(r.kind==="plan")return v.jsxs("div",{className:`prompt-card plan ${c?"resolved":""}`,children:[v.jsx("div",{className:"prompt-head",children:"Proposed plan"}),v.jsx("div",{className:"prompt-plan",children:v.jsx(hm,{text:r.plan??"",onOpenFile:n})}),c?v.jsx("div",{className:"prompt-resolved",children:"Resolved"}):v.jsxs("div",{className:"prompt-actions",children:[v.jsx("button",{className:"btn-primary",onClick:()=>o({approve:!0,resumeMode:"auto"}),children:"Approve & run"}),v.jsx("button",{className:"btn-ghost",onClick:()=>o({approve:!0,resumeMode:"bypass"}),children:"Approve & bypass all"}),v.jsx("button",{className:"btn-ghost",onClick:()=>o({approve:!1}),children:"Keep planning"})]})]});if(r.kind==="permission"){const m=typeof((f=r.toolInput)==null?void 0:f.command)=="string"&&r.toolInput.command||typeof((g=r.toolInput)==null?void 0:g.filePath)=="string"&&r.toolInput.filePath||"",_=typeof((d=r.toolInput)==null?void 0:d.reason)=="string"&&r.toolInput.reason||"";return v.jsxs("div",{className:`prompt-card permission ${c?"resolved":""}`,children:[v.jsxs("div",{className:"prompt-head",children:["Permission needed: ",v.jsx("code",{children:r.tool})]}),m&&v.jsx("div",{className:"prompt-sub",children:m}),_&&v.jsx("div",{className:"prompt-sub",children:_}),c?v.jsx("div",{className:"prompt-resolved",children:"Resolved"}):v.jsxs("div",{className:"prompt-actions",children:[v.jsx("button",{className:"btn-primary",onClick:()=>o({approve:!0}),children:"Allow"}),v.jsx("button",{className:"btn-ghost",onClick:()=>o({approve:!1}),children:"Deny"})]})]})}const u=m=>l(_=>r.multiSelect?_.includes(m)?_.filter(w=>w!==m):[..._,m]:[m]);return v.jsxs("div",{className:`prompt-card question ${c?"resolved":""}`,children:[r.header&&v.jsx("div",{className:"prompt-head",children:r.header}),r.question&&v.jsx("div",{className:"prompt-q",children:r.question}),v.jsx("div",{className:"prompt-options",children:(r.options??[]).map(m=>{const _=a.includes(m.label);return v.jsxs("button",{className:`prompt-option ${_?"sel":""}`,disabled:c,onClick:()=>c?void 0:r.multiSelect?u(m.label):o({answers:[m.label]}),children:[v.jsx("span",{className:"prompt-option-label",children:m.label}),m.description&&v.jsx("span",{className:"prompt-option-desc",children:m.description})]},m.label)})}),r.multiSelect&&!c&&v.jsx("div",{className:"prompt-actions",children:v.jsx("button",{className:"btn-primary",disabled:a.length===0,onClick:()=>o({answers:a}),children:"Submit"})}),c&&v.jsx("div",{className:"prompt-resolved",children:"Resolved"})]})}function QL({message:e,onOpenFile:t,onRespond:n}){if(e.role==="user"){const c=e.parts.filter(u=>u.type==="text").map(u=>u.text??"").join(` +`),o=e.parts.filter(u=>u.type==="image"&&u.text).map(u=>u.text.startsWith("data:")?u.text:JT(u.text));return v.jsxs("div",{className:"msg-user",children:[c,o.length>0&&v.jsx("div",{className:"msg-images",children:o.map((u,f)=>v.jsx("a",{href:u,target:"_blank",rel:"noreferrer",children:v.jsx("img",{src:u,alt:"attachment"})},f))})]})}const r=[];let a=[];const l=()=>{a.length!==0&&(r.push(v.jsx(KL,{parts:a,onOpenFile:t},`tg-${a[0].id}`)),a=[])};for(const c of e.parts){if(c.type==="tool"){a.push(c);continue}l(),c.type==="text"&&c.text?r.push(v.jsx(hm,{text:c.text,onOpenFile:t},c.id)):c.type==="reasoning"&&c.text?r.push(v.jsxs("details",{className:"reasoning",children:[v.jsx("summary",{children:"thinking…"}),c.text]},c.id)):c.type==="prompt"&&c.prompt&&r.push(v.jsx(ZL,{part:c,onRespond:n,onOpenFile:t},c.id))}return l(),v.jsx("div",{className:"msg-assistant",children:r})}const _w=[{id:"active",label:"Active",railLabel:"Recents"},{id:"archived",label:"Archived",railLabel:"Archived"},{id:"all",label:"All",railLabel:"All sessions"}];function JL({value:e,onChange:t}){const{open:n,setOpen:r,ref:a}=Ku();return v.jsxs("div",{className:"rail-filter",ref:a,children:[v.jsx("button",{className:`icon-btn rail-filter-btn ${e!=="active"?"active":""}`,title:"Filter sessions","aria-label":"Filter sessions",onClick:()=>r(l=>!l),children:v.jsx(iT,{size:13})}),n&&v.jsx("div",{className:"option-menu drop-down align-right",children:_w.map(l=>v.jsxs("button",{className:"model-item",onClick:()=>{t(l.id),r(!1)},children:[v.jsx("span",{children:l.label}),e===l.id&&v.jsx(_n,{size:13})]},l.id))})]})}function eO({session:e,active:t,busy:n,onOpen:r,onRename:a,onSetArchived:l,onDelete:c}){var x;const{open:o,setOpen:u,ref:f}=Ku(),g=((x=e.title)==null?void 0:x.trim())||"Untitled",[d,m]=Y.useState(!1),[_,w]=Y.useState(""),C=Y.useRef(null);function b(){var y;w(((y=e.title)==null?void 0:y.trim())||""),m(!0)}function S(){var k;const y=_.trim();m(!1),y&&y!==(((k=e.title)==null?void 0:k.trim())||"")&&a(y)}return Y.useEffect(()=>{var y,k;d&&((y=C.current)==null||y.focus(),(k=C.current)==null||k.select())},[d]),v.jsxs("div",{ref:f,role:"button",tabIndex:0,className:`session-row ${t?"active":""} ${o?"menu-open":""} ${d?"editing":""}`,title:`${pw[e.harness]}${e.model?` · ${e.model}`:""}`,onClick:()=>{d||(o?u(!1):r())},onKeyDown:y=>{y.target===y.currentTarget&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),o?u(!1):r())},children:[v.jsx("span",{className:"session-dot",children:n&&v.jsx("span",{className:"busy-dot"})}),d?v.jsx("input",{ref:C,className:"session-title-input","aria-label":"Session title",value:_,onChange:y=>w(y.target.value),onClick:y=>y.stopPropagation(),onBlur:S,onKeyDown:y=>{y.stopPropagation(),y.key==="Enter"?(y.preventDefault(),S()):y.key==="Escape"&&(y.preventDefault(),m(!1))}}):v.jsx("span",{className:"session-title",children:g}),v.jsx("span",{className:"session-time",children:WL(e.updatedAt)}),v.jsx("button",{className:"session-menu-btn",title:"Session options","aria-label":"Session options",onClick:y=>{y.stopPropagation(),u(k=>!k)},children:v.jsx(RA,{size:14})}),o&&v.jsxs("div",{className:"option-menu drop-down session-menu",children:[v.jsx("button",{className:"model-item",onClick:y=>{y.stopPropagation(),u(!1),b()},children:v.jsx("span",{children:"Rename"})}),v.jsx("button",{className:"model-item",onClick:y=>{y.stopPropagation(),u(!1),l(!e.archived)},children:v.jsx("span",{children:e.archived?"Unarchive":"Archive"})}),v.jsx("button",{className:"model-item danger",onClick:y=>{y.stopPropagation(),u(!1),c()},children:v.jsx("span",{children:"Delete"})})]})]})}function tO({projectId:e,paperId:t,railHeader:n,railOpen:r,onShowRail:a,mainView:l,onSelectMainView:c,panelOpen:o,onTogglePanel:u,onOpenFile:f,children:g}){var Et,$t,it;const[d,m]=Y.useState([]),[_,w]=Y.useState(null),[C,b]=Y.useState("active"),[S,x]=Y.useState(""),[y,k]=Y.useState([]),[D,T]=Y.useReducer(VL,{messagesBySession:{},busySessions:new Set}),[R,N]=Y.useState([]),[L,I]=Y.useState(GL),[F,V]=Y.useState({}),H=Y.useRef(new Set),z=Y.useRef(new Set),q=Y.useRef(null),G=Y.useRef(null),X=Y.useRef(!0),K=Y.useRef(null),[O,M]=Y.useState([]),[j,$]=Y.useState(0),[U,Q]=Y.useState(!1);Y.useEffect(()=>{VT().then(M).catch(()=>{})},[]);const ie=S.startsWith("/")&&!/\s/.test(S)?S.slice(1):null,se=ie!==null&&!U?O.filter(he=>he.name.startsWith(ie.toLowerCase())):[],Z=se.length>0,P=Math.min(j,Math.max(0,se.length-1));Y.useEffect(()=>$(0),[ie]);function ee(he){var Ce;x(`/${he.name} `),(Ce=K.current)==null||Ce.focus()}function te(he){for(const Ce of he){if(!/^image\/(png|jpeg|gif|webp)$/.test(Ce.type))continue;const Oe=new FileReader;Oe.onload=()=>{const Xe=Oe.result;k(Je=>[...Je,{dataUrl:Xe,mediaType:Ce.type}])},Oe.readAsDataURL(Ce)}}function pe(he){const Ce=Array.from(he.clipboardData.items).filter(Oe=>Oe.kind==="file"&&Oe.type.startsWith("image/")).map(Oe=>Oe.getAsFile()).filter(Oe=>Oe!==null);Ce.length>0&&(he.preventDefault(),te(Ce))}const ue=d.find(he=>he.id===_),me=ue?{harness:ue.harness,model:F.model??ue.model,permissionMode:F.permissionMode??ue.permissionMode,reasoningLevel:F.reasoningLevel??ue.reasoningLevel}:L??B1(R),we=me?R.find(he=>he.id===me.harness):void 0,le=we==null?void 0:we.options,ye=he=>{ue?V({model:he.model,permissionMode:he.permissionMode,reasoningLevel:he.reasoningLevel}):(I(he),localStorage.setItem(gw,JSON.stringify(he)))},be=he=>{me&&ye({...me,permissionMode:he})},Be=he=>{me&&ye({...me,reasoningLevel:he})};Y.useEffect(()=>{m([]),w(null),x(""),k([]),T({type:"reset"}),H.current=new Set,YT(e).then(he=>{m(he),w(Ce=>{var Oe;return Ce??((Oe=he.find(Xe=>!Xe.archived))==null?void 0:Oe.id)??null}),T({type:"seedBusy",sessions:he.filter(Ce=>Ce.busy).map(Ce=>Ce.id)})}).catch(()=>{})},[e]),Y.useEffect(()=>{!_||H.current.has(_)||(H.current.add(_),QT(_).then(he=>T({type:"seed",sessionId:_,messages:he})).catch(()=>H.current.delete(_)))},[_]),Y.useEffect(()=>sN(he=>{switch(he.type){case"session":if(he.session.projectId!==e||z.current.has(he.session.id))return;m(Ce=>{const Oe=Ce.findIndex(Je=>Je.id===he.session.id);if(Oe<0)return[he.session,...Ce];const Xe=Ce.slice();return Xe[Oe]=he.session,Xe});break;case"sessionDeleted":ct(he.sessionId);break;case"message":T({type:"upsertMessage",sessionId:he.sessionId,message:he.message});break;case"busy":T({type:"busy",sessionId:he.sessionId,busy:he.busy});break}}),[e]);const Ve=_?D.messagesBySession[_]??[]:[],Pe=_?D.busySessions.has(_):!1,lt=ue;Y.useEffect(()=>V({}),[_]);const Rt=l==="chat"&&(Ve.length>0||Pe);Y.useLayoutEffect(()=>{X.current=!0;const he=q.current;he&&(he.scrollTop=he.scrollHeight)},[_,Rt]),Y.useLayoutEffect(()=>{const he=q.current;he&&X.current&&(he.scrollTop=he.scrollHeight)},[Ve,Pe]),Y.useEffect(()=>{const he=q.current,Ce=G.current;if(!he||!Ce)return;const Oe=new ResizeObserver(()=>{X.current&&(he.scrollTop=he.scrollHeight)});return Oe.observe(Ce),Oe.observe(he),()=>Oe.disconnect()},[Rt]);async function gt(){const he=S.trim(),Ce=y;if(!he&&Ce.length===0||Pe)return;const Oe=me;if(!Oe&&!_)return;x(""),k([]);let Xe=_;try{if(!Xe){const jt=await WT(e,Oe.harness,{model:Oe.model,permissionMode:Oe.permissionMode,reasoningLevel:Oe.reasoningLevel});H.current.add(jt.id),m(Hi=>[jt,...Hi]),w(jt.id),Xe=jt.id}T({type:"optimisticUser",sessionId:Xe,text:he,imageUrls:Ce.map(jt=>jt.dataUrl)}),T({type:"busy",sessionId:Xe,busy:!0}),X.current=!0,C==="archived"&&b("active");const Je=Oe?{model:Oe.model,permissionMode:Oe.permissionMode,reasoningLevel:Oe.reasoningLevel}:{};V({});const nn=Ce.map(jt=>({mediaType:jt.mediaType,dataBase64:jt.dataUrl.slice(jt.dataUrl.indexOf(",")+1)}));await eN(Xe,he,Je,nn.length?nn:void 0)}catch(Je){Xe&&(T({type:"busy",sessionId:Xe,busy:!1}),T({type:"dropOptimisticUser",sessionId:Xe})),x(nn=>nn||he),k(nn=>nn.length?nn:Ce),window.alert(`Couldn't send: ${Je instanceof Error?Je.message:String(Je)}`)}}function nt(){_&&tN(_)}Y.useEffect(()=>{if(!Pe||l!=="chat")return;function he(Ce){var Oe;Ce.key!=="Escape"||Ce.defaultPrevented||(Ce.preventDefault(),nt(),(Oe=K.current)==null||Oe.focus())}return document.addEventListener("keydown",he),()=>document.removeEventListener("keydown",he)},[Pe,_,l]);function ct(he){z.current.add(he),m(Ce=>Ce.filter(Oe=>Oe.id!==he)),w(Ce=>Ce===he?null:Ce),H.current.delete(he),T({type:"forget",sessionId:he})}function de(he,Ce){const Oe=he.archived;m(Xe=>Xe.map(Je=>Je.id===he.id?{...Je,archived:Ce}:Je)),KT(he.id,Ce).catch(()=>{m(Xe=>Xe.map(Je=>Je.id===he.id?{...Je,archived:Oe}:Je))})}function Se(he,Ce){const Oe=he.title;m(Xe=>Xe.map(Je=>Je.id===he.id?{...Je,title:Ce}:Je)),ZT(he.id,Ce).catch(()=>{m(Xe=>Xe.map(Je=>Je.id===he.id?{...Je,title:Oe}:Je))})}async function Ee(he){var Oe;const Ce=((Oe=he.title)==null?void 0:Oe.trim())||"Untitled";if(window.confirm(`Delete "${Ce}"? + +Its transcript is permanently removed.`)){try{await XT(he.id)}catch(Xe){window.alert(`Failed to delete "${Ce}": ${Xe instanceof Error?Xe.message:String(Xe)}`);return}ct(he.id)}}function Le(he){_&&(T({type:"busy",sessionId:_,busy:!0}),nN(_,he).catch(()=>{_&&T({type:"busy",sessionId:_,busy:!1})}))}const je=d.filter(he=>C==="all"?!0:C==="archived"?he.archived:!he.archived),Ct=v.jsxs("aside",{className:"session-rail floating-panel",children:[n,v.jsxs("nav",{className:"rail-nav",children:[v.jsxs("button",{className:"rail-nav-item",onClick:()=>{w(null),c("chat")},children:[v.jsx(yg,{size:15}),"New session"]}),v.jsxs("button",{className:`rail-nav-item ${l==="files"?"active":""}`,onClick:()=>c("files"),children:[v.jsx(HA,{size:15}),"Files"]}),FL.map(he=>v.jsxs("button",{className:`rail-nav-item ${l===he.id?"active":""}`,onClick:()=>c(he.id),children:[he.icon,he.label]},he.id))]}),v.jsxs("div",{className:"rail-body",children:[v.jsxs("div",{className:"rail-section-head",children:[v.jsx("div",{className:"rail-section-label",children:((Et=_w.find(he=>he.id===C))==null?void 0:Et.railLabel)??"Recents"}),v.jsx(JL,{value:C,onChange:b})]}),je.map(he=>v.jsx(eO,{session:he,active:he.id===_&&l==="chat",busy:D.busySessions.has(he.id),onOpen:()=>{w(he.id),c("chat")},onRename:Ce=>Se(he,Ce),onSetArchived:Ce=>de(he,Ce),onDelete:()=>void Ee(he)},he.id)),je.length===0&&v.jsx("div",{className:"rail-empty",children:C==="archived"?"No archived sessions":d.length>0?"No active sessions":"No sessions yet"})]})]}),Ue=`chat-header${r?"":" rail-hidden"}`,Tt=!r&&v.jsx("button",{className:"icon-btn",title:"Show sidebar","aria-label":"Show sidebar",onClick:a,children:v.jsx(BS,{size:15})});return l!=="chat"?v.jsxs(v.Fragment,{children:[r&&Ct,v.jsxs("section",{className:"chat-pane",children:[!r&&v.jsx("div",{className:Ue,children:Tt}),v.jsx("div",{className:"settings-view-scroll",children:g})]})]}):v.jsxs(v.Fragment,{children:[r&&Ct,v.jsxs("section",{className:"chat-pane",children:[v.jsxs("div",{className:Ue,children:[Tt,v.jsx("div",{className:"title",title:lt?(($t=lt.title)==null?void 0:$t.trim())||"Untitled":"New session",children:lt?((it=lt.title)==null?void 0:it.trim())||"Untitled":"New session"}),v.jsx("button",{className:`icon-btn ${o?"active":""}`,title:"Experiments","aria-label":"Experiments",onClick:u,children:v.jsx(IA,{size:15})})]}),Rt?v.jsx("div",{className:"chat-thread",ref:q,onScroll:he=>{const Ce=he.currentTarget;X.current=Ce.scrollHeight-Ce.scrollTop-Ce.clientHeight<60},children:v.jsxs("div",{className:"chat-thread-inner",ref:G,children:[Ve.map(he=>v.jsx(QL,{message:he,onOpenFile:f&&(Ce=>f(Ce,_??void 0)),onRespond:Le},he.id)),Pe&&v.jsxs("div",{className:"working",children:[v.jsx("span",{className:"spinner"})," Working…"]})]})}):v.jsxs("div",{className:"chat-empty",children:[v.jsxs("h2",{children:["Open",v.jsx("span",{children:"Research"})]}),v.jsx("p",{children:"Ask the agent to explore your codebase, create and run your baseline experiment, and branch variants off it."}),v.jsx(YL,{harnesses:R,selection:L??B1(R)}),t&&v.jsxs("button",{type:"button",className:"chat-suggest mono",title:"Prefills the composer — add the compute to run on, then send",onClick:()=>{var he;x(`/reproduce-paper ${t} on `),(he=K.current)==null||he.focus()},children:["/reproduce-paper ",t," on [describe your compute setup]"]})]}),v.jsx("div",{className:"composer",children:v.jsxs("div",{className:"composer-box",children:[Z&&v.jsx(UL,{skills:se,activeIndex:P,onPick:ee,onHover:$}),y.length>0&&v.jsx("div",{className:"composer-attachments",children:y.map((he,Ce)=>v.jsxs("div",{className:"attachment-thumb",children:[v.jsx("img",{src:he.dataUrl,alt:"pasted"}),v.jsx("button",{title:"Remove image","aria-label":"Remove image",onClick:()=>k(Oe=>Oe.filter((Xe,Je)=>Je!==Ce)),children:v.jsx(Mo,{size:11})})]},Ce))}),v.jsx("textarea",{ref:K,value:S,placeholder:me?`Message ${pw[me.harness]}… ( / for skills)`:"Ask the research agent… ( / for skills)",rows:2,onPaste:pe,onDragOver:he=>{he.dataTransfer.types.includes("Files")&&he.preventDefault()},onDrop:he=>{he.dataTransfer.files.length!==0&&(he.preventDefault(),te(Array.from(he.dataTransfer.files)))},onChange:he=>{x(he.target.value),Q(!1)},onKeyDown:he=>{if(Z){if(he.key==="ArrowDown"||he.key==="ArrowUp"){he.preventDefault();const Ce=he.key==="ArrowDown"?1:-1;$((P+Ce+se.length)%se.length);return}if(he.key==="Enter"||he.key==="Tab"){he.preventDefault(),ee(se[P]);return}if(he.key==="Escape"){he.preventDefault(),Q(!0);return}}he.key==="Enter"&&!he.shiftKey&&(he.preventDefault(),gt())}}),v.jsxs("div",{className:"composer-actions",children:[v.jsx(I1,{choices:(le==null?void 0:le.permissionModes)??[],value:(me==null?void 0:me.permissionMode)??null,defaultId:(le==null?void 0:le.defaultPermissionMode)??null,header:"Mode",align:"left",variant:"pill",numbered:!0,title:"Permission mode for this chat",onSelect:be}),v.jsx("div",{style:{flex:1}}),v.jsx($L,{value:me,onSelect:ye,onHarnesses:N,lockHarness:!!ue}),v.jsx(I1,{choices:(le==null?void 0:le.reasoningLevels)??[],value:(me==null?void 0:me.reasoningLevel)??null,defaultId:(le==null?void 0:le.defaultReasoningLevel)??null,header:"Reasoning",align:"right",variant:"bare",title:"Reasoning level for this chat",onSelect:Be}),Pe?v.jsx("button",{className:"send-btn stop",title:"Stop","aria-label":"Stop",onClick:nt,children:v.jsx(Mo,{size:16})}):v.jsx("button",{className:"send-btn",title:"Send","aria-label":"Send",onClick:()=>void gt(),disabled:!S.trim()&&y.length===0,children:v.jsx(AA,{size:16})})]})]})})]})]})}const nO="project";function iO(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")}function rO(e){if(!e.startsWith("---"))return e;const t=e.indexOf(` +---`,3);return t===-1?e:e.slice(t+4).replace(/^\r?\n/,"")}const sO=/\.(png|jpe?g|gif|webp|svg)$/i;function qp(e,t){for(const n of e){if(n.path===t)return n;if(n.isDir&&t.startsWith(n.path+"/")){const r=qp(n.children??[],t);if(r)return r}}return null}function aO({projectId:e,folder:t,markdown:n}){const r=a=>iO(a)?a:Ep(e,`${t}/${a.replace(/^\.?\//,"")}`);return v.jsx("div",{className:"md report-md",children:v.jsx(Dx,{remarkPlugins:[ew],components:{a:({href:a,children:l,...c})=>{const o=!a||a.startsWith("#");return v.jsx("a",{...c,href:o?a:r(a),...o?{}:{target:"_blank",rel:"noopener noreferrer"},children:l})},img:({src:a,alt:l})=>{if(!a||typeof a!="string")return null;const c=r(a);return v.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"report-img",children:[v.jsx("img",{src:c,alt:l??"",loading:"lazy"}),l&&v.jsx("span",{className:"report-img-caption",children:l})]})},...uw},children:rO(n)})})}function oO({projectId:e,entry:t,onBack:n,onDelete:r}){const[a,l]=Y.useState(null),[c,o]=Y.useState(null);return Y.useEffect(()=>{zT(e,t.path).then(u=>l(u.markdown)).catch(u=>o(u instanceof Error?u.message:String(u)))},[e,t.path,t.modifiedAt]),v.jsx("div",{className:"report-view",children:v.jsxs("div",{className:"report-view-col",children:[v.jsxs("div",{className:"report-view-head",children:[v.jsxs("button",{className:"report-back",onClick:n,children:[v.jsx(Eo,{size:13})," Files"]}),v.jsx("span",{style:{flex:1}}),v.jsx("span",{className:"report-date",children:new Date(t.modifiedAt).toLocaleString()}),v.jsx("button",{className:"icon-btn",title:"Delete report folder","aria-label":"Delete report folder",onClick:()=>{window.confirm(`Delete the "${t.path}" folder from the files dir?`)&&r()},children:v.jsx(Hu,{size:14})})]}),c?v.jsx("div",{className:"error",children:c}):a===null?v.jsxs("div",{className:"settings-loading",children:[v.jsx("span",{className:"spinner"})," Loading report…"]}):v.jsx(aO,{projectId:e,folder:t.path,markdown:a})]})})}function lO({dir:e}){const[t,n]=Y.useState(!1);return v.jsxs("div",{className:"files-pill files-pill-dir",title:e,children:[v.jsx("code",{children:e}),v.jsx("button",{className:"icon-btn",title:"Copy path","aria-label":"Copy files directory path",onClick:()=>{var r;(r=navigator.clipboard)==null||r.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},children:t?v.jsx(_n,{size:13}):v.jsx(vg,{size:13})})]})}function vw({projectId:e,entries:t,depth:n,expanded:r,onToggle:a,onOpenReport:l,onDelete:c}){return v.jsx(v.Fragment,{children:t.map(o=>{var g;const u={paddingLeft:14+n*22},f=v.jsx("button",{className:"icon-btn ftree-del",title:`Delete ${o.path}`,"aria-label":`Delete ${o.path}`,onClick:d=>{d.stopPropagation(),window.confirm(`Delete "${o.path}" from the files dir?`)&&c(o.path)},children:v.jsx(Hu,{size:13})});if(o.isDir){const d=o.reportTitle!==void 0,m=r.has(o.path),_=n===0?o.experiment:void 0,w=d&&n>0,C=_?[_.title,_.branchName].filter(Boolean).join(" — "):d&&!w?o.reportTitle:void 0;return v.jsxs("div",{children:[v.jsxs("div",{className:"ftree-row clickable",style:u,title:C,onClick:()=>d?l(o.path):a(o.path),children:[v.jsx("button",{className:`ftree-chevron ${m?"open":""}`,"aria-label":m?`Collapse ${o.name}`:`Expand ${o.name}`,onClick:b=>{b.stopPropagation(),a(o.path)},children:v.jsx(_g,{size:13})}),w?v.jsx("span",{className:"ftree-title",children:o.reportTitle}):v.jsxs("span",{className:"ftree-dirname",children:[o.name,"/"]}),d&&v.jsx("span",{className:"ftree-tag",children:"report"}),(_==null?void 0:_.latestRunStatus)&&v.jsx("span",{className:"ftree-status",children:_.latestRunStatus}),f,v.jsx("span",{className:"ftree-date",children:new Date(o.modifiedAt).toLocaleDateString()})]}),m&&(((g=o.children)==null?void 0:g.length)??0)>0&&v.jsx("div",{className:"ftree-children",children:v.jsx(vw,{projectId:e,entries:o.children??[],depth:n+1,expanded:r,onToggle:a,onOpenReport:l,onDelete:c})})]},o.path)}return v.jsxs("div",{className:"ftree-row",style:u,children:[v.jsx("span",{className:"ftree-chevron spacer"}),v.jsxs("a",{className:"ftree-link",href:Ep(e,o.path),target:"_blank",rel:"noopener noreferrer",title:o.path,children:[sO.test(o.name)&&v.jsx("img",{className:"ftree-thumb",src:Ep(e,o.path),alt:"",loading:"lazy"}),v.jsx("span",{className:"ftree-name",children:o.name})]}),f,v.jsx("span",{className:"ftree-size",children:Lo(o.size)})]},o.path)})})}function cO(e){const t=[],n=[],r=[];for(const a of e)a.isDir&&a.name===nO?t.push(a):a.isDir&&a.experiment?n.push(a):r.push(a);return{project:t,experiments:n,other:r}}function uO({project:e,files:t,onChanged:n,onOpenStorage:r}){const[a,l]=Y.useState(null),[c,o]=Y.useState(new Set),u=a&&t?qp(t.entries,a):null;Y.useEffect(()=>{var b;a&&t&&!((b=qp(t.entries,a))!=null&&b.reportTitle)&&l(null)},[a,t]);const f=b=>o(S=>{const x=new Set(S);return x.has(b)?x.delete(b):x.add(b),x}),g=b=>{HT(e.id,b).catch(()=>{}).finally(n)};if(u!=null&&u.reportTitle)return v.jsx(oO,{projectId:e.id,entry:u,onBack:()=>l(null),onDelete:()=>{g(u.path),l(null)}});if(!t)return v.jsx("div",{className:"files-tab",children:v.jsx("div",{className:"files-col",children:v.jsxs("div",{className:"settings-loading",children:[v.jsx("span",{className:"spinner"})," Loading files…"]})})});const{project:d,experiments:m,other:_}=cO(t.entries),w=b=>v.jsx(vw,{projectId:e.id,entries:b,depth:0,expanded:c,onToggle:f,onOpenReport:l,onDelete:g}),C=`https://github.com/${e.githubOwner}/${e.githubRepo}`;return v.jsx("div",{className:"files-tab",children:v.jsxs("div",{className:"files-col",children:[v.jsxs("div",{className:"files-meta",children:[v.jsxs("a",{className:"files-pill",href:C,target:"_blank",rel:"noopener noreferrer",children:[v.jsxs("code",{children:[e.githubOwner,"/",e.githubRepo]}),v.jsx(OS,{size:12})]}),v.jsx(lO,{dir:t.dir}),v.jsx("button",{type:"button",className:"files-pill files-pill-link",onClick:r,children:"Change storage location →"})]}),v.jsxs("p",{className:"files-hint",children:["An explorer over this folder — the agent writes each experiment's reports and figures into the folder named for its slug (project-wide reports under ",v.jsx("code",{children:"project/"}),"), and you can drop in your own files."]}),t.entries.length===0?v.jsxs("p",{className:"files-empty",children:["Nothing here yet. Ask the agent for a write-up of its findings — it saves each experiment's report folder (",v.jsx("code",{children:"report.md"})," + images) into the folder above."]}):v.jsxs("div",{className:"files-card",children:[w(d),w(m),_.length>0&&(m.length>0||d.length>0)&&v.jsx("div",{className:"ftree-divider",children:"Not linked to an experiment"}),w(_),t.truncated&&v.jsx("p",{className:"files-truncated",children:"Listing truncated — the folder has more files."})]})]})})}function H1({active:e,label:t,icon:n,onSelect:r,onClose:a}){return v.jsxs("button",{className:`tab closable ${e?"active":""}`,onClick:r,title:t,children:[n,v.jsx("span",{className:"tab-label",children:t}),v.jsx("span",{role:"button",className:"tab-close",title:"Close tab",onClick:l=>{l.stopPropagation(),a()},children:v.jsx(Mo,{size:12})})]})}function F1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function ot(e){for(var t=1;t=0||(g[u]=c[u]);return g})(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Ze(e,t){return bw(e)||(function(n,r){var a=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(a!=null){var l,c,o,u,f=[],g=!0,d=!1;try{if(o=(a=a.call(n)).next,r===0){if(Object(a)!==a)return;g=!1}else for(;!(g=(l=o.call(a)).done)&&(f.push(l.value),f.length!==r);g=!0);}catch(m){d=!0,c=m}finally{try{if(!g&&a.return!=null&&(u=a.return(),Object(u)!==u))return}finally{if(d)throw c}}return f}})(e,t)||Zu(e,t)||xw()}function yw(e){return bw(e)||Sw(e)||Zu(e)||xw()}function Dn(e){return(function(t){if(Array.isArray(t))return Yp(t)})(e)||Sw(e)||Zu(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 bw(e){if(Array.isArray(e))return e}function Sw(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Zu(e,t){if(e){if(typeof e=="string")return Yp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yp(e,t):void 0}}function Yp(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:a}}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 l,c=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return c=u.done,u},e:function(u){o=!0,l=u},f:function(){try{c||n.return==null||n.return()}finally{if(o)throw l}}}}var Fc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rl(e,t){return e(t={exports:{}},t.exports),t.exports}var Tn=rl((function(e){/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a-1?b.slice(0,v):k;switch(k){case"diff":C--;break e;case"deleted":case"new":var D=b.slice(v+1);D.indexOf("file mode")===0&&(c[k==="new"?"newMode":"oldMode"]=D.slice(10));break;case"similarity":c.similarity=parseInt(b.split(" ")[2],10);break;case"index":var T=b.slice(v+1).split(" "),R=T[0].split("..");c.oldRevision=R[0],c.newRevision=R[1],T[1]&&(c.oldMode=c.newMode=T[1]);break;case"copy":case"rename":var N=b.slice(v+1);N.indexOf("from")===0?c.oldPath=N.slice(5):c.newPath=N.slice(3),x=k;break;case"---":var L=b.slice(v+1),I=_[++C].slice(4);L==="/dev/null"?(I=I.slice(2),x="add"):I==="/dev/null"?(L=L.slice(2),x="delete"):(x="modify",L=L.slice(2),I=I.slice(2)),L&&(c.oldPath=L),I&&(c.newPath=I),m=5;break e}}c.type=x||"modify"}else if(y.indexOf("Binary")===0)c.isBinary=!0,c.type=y.indexOf("/dev/null and")>=0?"add":y.indexOf("and /dev/null")>=0?"delete":"modify",m=2,c=null;else if(m===5)if(y.indexOf("@@")===0){var F=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(y);o={content:y,oldStart:F[1]-0,newStart:F[4]-0,oldLines:F[3]-0||1,newLines:F[6]-0||1,changes:[]},c.hunks.push(o),u=o.oldStart,f=o.newStart}else{var V=y.slice(0,1),H={content:y.slice(1)};switch(V){case"+":H.type="insert",H.isInsert=!0,H.lineNumber=f,f++;break;case"-":H.type="delete",H.isDelete=!0,H.lineNumber=u,u++;break;case" ":H.type="normal",H.isNormal=!0,H.oldLineNumber=u,H.newLineNumber=f,u++,f++;break;case"\\":var z=o.changes[o.changes.length-1];z.isDelete||(c.newEndingNewLine=!1),z.isInsert||(c.oldEndingNewLine=!1)}H.type&&o.changes.push(H)}C++}return d}};e.exports=a})()}));function xr(e){return e.type==="insert"}function Nn(e){return e.type==="delete"}function ji(e){return e.type==="normal"}function JL(e,t){var n=t.nearbySequences==="zip"?(function(r){var a=r.reduce((function(l,c,o){var u=Ke(l,3),f=u[0],g=u[1],d=u[2];return g?xr(c)&&d>=0?(f.splice(d+1,0,c),[f,c,d+2]):(f.push(c),[f,c,Nn(c)&&Nn(g)?d:o]):(f.push(c),[f,c,Nn(c)?o:-1])}),[[],null,-1]);return Ke(a,1)[0]})(e.changes):e.changes;return at(at({},e),{},{isPlain:!1,changes:n})}function eO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=(function(r){if(r.startsWith("diff --git"))return r;var a=r.indexOf(` +*/(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a-1?S.slice(0,y):k;switch(k){case"diff":C--;break e;case"deleted":case"new":var D=S.slice(y+1);D.indexOf("file mode")===0&&(c[k==="new"?"newMode":"oldMode"]=D.slice(10));break;case"similarity":c.similarity=parseInt(S.split(" ")[2],10);break;case"index":var T=S.slice(y+1).split(" "),R=T[0].split("..");c.oldRevision=R[0],c.newRevision=R[1],T[1]&&(c.oldMode=c.newMode=T[1]);break;case"copy":case"rename":var N=S.slice(y+1);N.indexOf("from")===0?c.oldPath=N.slice(5):c.newPath=N.slice(3),x=k;break;case"---":var L=S.slice(y+1),I=_[++C].slice(4);L==="/dev/null"?(I=I.slice(2),x="add"):I==="/dev/null"?(L=L.slice(2),x="delete"):(x="modify",L=L.slice(2),I=I.slice(2)),L&&(c.oldPath=L),I&&(c.newPath=I),m=5;break e}}c.type=x||"modify"}else if(b.indexOf("Binary")===0)c.isBinary=!0,c.type=b.indexOf("/dev/null and")>=0?"add":b.indexOf("and /dev/null")>=0?"delete":"modify",m=2,c=null;else if(m===5)if(b.indexOf("@@")===0){var F=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(b);o={content:b,oldStart:F[1]-0,newStart:F[4]-0,oldLines:F[3]-0||1,newLines:F[6]-0||1,changes:[]},c.hunks.push(o),u=o.oldStart,f=o.newStart}else{var V=b.slice(0,1),H={content:b.slice(1)};switch(V){case"+":H.type="insert",H.isInsert=!0,H.lineNumber=f,f++;break;case"-":H.type="delete",H.isDelete=!0,H.lineNumber=u,u++;break;case" ":H.type="normal",H.isNormal=!0,H.oldLineNumber=u,H.newLineNumber=f,u++,f++;break;case"\\":var z=o.changes[o.changes.length-1];z.isDelete||(c.newEndingNewLine=!1),z.isInsert||(c.oldEndingNewLine=!1)}H.type&&o.changes.push(H)}C++}return d}};e.exports=a})()}));function xr(e){return e.type==="insert"}function Rn(e){return e.type==="delete"}function ji(e){return e.type==="normal"}function pO(e,t){var n=t.nearbySequences==="zip"?(function(r){var a=r.reduce((function(l,c,o){var u=Ze(l,3),f=u[0],g=u[1],d=u[2];return g?xr(c)&&d>=0?(f.splice(d+1,0,c),[f,c,d+2]):(f.push(c),[f,c,Rn(c)&&Rn(g)?d:o]):(f.push(c),[f,c,Rn(c)?o:-1])}),[[],null,-1]);return Ze(a,1)[0]})(e.changes):e.changes;return ot(ot({},e),{},{isPlain:!1,changes:n})}function gO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=(function(r){if(r.startsWith("diff --git"))return r;var a=r.indexOf(` `),l=r.indexOf(` `,a+1),c=r.slice(0,a),o=r.slice(a+1,l),u=c.split(" ").slice(1,-3).join(" "),f=o.split(" ").slice(1,-3).join(" ");return["diff --git a/".concat(u," b/").concat(f),"index 1111111..2222222 100644","--- a/".concat(u),"+++ b/".concat(f),r.slice(l+1)].join(` -`)})(e.trimStart());return QL.parse(n).map((function(r){return(function(a,l){var c=a.hunks.map((function(o){return JL(o,l)}));return at(at({},a),{},{hunks:c})})(r,t)}))}function tO(e){return e[0]}function nO(e){return e[e.length-1]}function Up(e){return["".concat(e,"Start"),"".concat(e,"Lines")]}function Io(e){return e==="old"?function(t){return xr(t)?-1:ji(t)?t.oldLineNumber:t.lineNumber}:function(t){return Nn(t)?-1:ji(t)?t.newLineNumber:t.lineNumber}}function bw(e,t){return function(n,r){var a=n[e],l=a+n[t];return r>=a&&r=l&&a-1},uO=function(e,t){var n=this.__data__,r=Xu(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function Ws(e){var t=-1,n=e==null?0:e.length;for(this.clear();++to))return!1;var f=l.get(e),g=l.get(t);if(f&&g)return f==t&&g==e;var d=-1,m=!0,_=2&n?new YO:void 0;for(l.set(e,t),l.set(t,e);++d-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},St={};St["[object Float32Array]"]=St["[object Float64Array]"]=St["[object Int8Array]"]=St["[object Int16Array]"]=St["[object Int32Array]"]=St["[object Uint8Array]"]=St["[object Uint8ClampedArray]"]=St["[object Uint16Array]"]=St["[object Uint32Array]"]=!0,St["[object Arguments]"]=St["[object Array]"]=St["[object ArrayBuffer]"]=St["[object Boolean]"]=St["[object DataView]"]=St["[object Date]"]=St["[object Error]"]=St["[object Function]"]=St["[object Map]"]=St["[object Number]"]=St["[object Object]"]=St["[object RegExp]"]=St["[object Set]"]=St["[object String]"]=St["[object WeakMap]"]=!1;var c6=function(e){return ra(e)&&cm(e.length)&&!!St[ma(e)]},u6=function(e){return function(t){return e(t)}},G1=nl((function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,a=r&&r.exports===n&&ww.process,l=(function(){try{var c=r&&r.require&&r.require("util").types;return c||a&&a.binding&&a.binding("util")}catch{}})();e.exports=l})),q1=G1&&G1.isTypedArray,um=q1?u6(q1):c6,h6=Object.prototype.hasOwnProperty,f6=function(e,t){var n=Dn(e),r=!n&&Ju(e),a=!n&&!r&&yu(e),l=!n&&!r&&!a&&um(e),c=n||r||a||l,o=c?r6(e.length,String):[],u=o.length;for(var f in e)!h6.call(e,f)||c&&(f=="length"||a&&(f=="offset"||f=="parent")||l&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Nw(f,u))||o.push(f);return o},d6=Object.prototype,Dw=function(e){var t=e&&e.constructor;return e===(typeof t=="function"&&t.prototype||d6)},p6=(function(e,t){return function(n){return e(t(n))}})(Object.keys,Object),g6=Object.prototype.hasOwnProperty,Rw=function(e){if(!Dw(e))return p6(e);var t=[];for(var n in Object(e))g6.call(e,n)&&n!="constructor"&&t.push(n);return t},eh=function(e){return e!=null&&cm(e.length)&&!Ew(e)},hm=function(e){return eh(e)?f6(e):Rw(e)},V1=function(e){return JO(e,hm,i6)},m6=Object.prototype.hasOwnProperty,_6=function(e,t,n,r,a,l){var c=1&n,o=V1(e),u=o.length;if(u!=V1(t).length&&!c)return!1;for(var f=u;f--;){var g=o[f];if(!(c?g in t:m6.call(t,g)))return!1}var d=l.get(e),m=l.get(t);if(d&&m)return d==t&&m==e;var _=!0;l.set(e,t),l.set(t,e);for(var w=c;++f1)return!1;if(e.length===1){var t=Ke(e,1)[0];return t.type==="text"&&!t.value}return!0}function sj(e){var t=e.changeKey,n=e.text,r=e.tokens,a=e.renderToken,l=br(e,ij),c=a?function(o,u){return a(o,Z1,u)}:Z1;return S.jsx("td",at(at({},l),{},{"data-change-key":t,children:r?rj(r)?" ":r.map(c):n||" "}))}var Hw=W.memo(sj);function Fw(e,t){return function(){var n=t==="old"?sh(e):ah(e);return n===-1?void 0:n}}function Pw(e,t){return function(n){return e&&n?S.jsx("a",{href:t?"#"+t:void 0,children:n}):n}}function bu(e,t){return t?function(n){e(),t(n)}:e}function Q1(e,t,n,r){return W.useMemo((function(){var a=zw(e,(function(l){return function(c){return l&&l(t,c)}}));return a.onMouseEnter=bu(n,a.onMouseEnter),a.onMouseLeave=bu(r,a.onMouseLeave),a}),[e,n,r,t])}function J1(e,t,n,r,a,l,c,o,u){var f={change:t,side:r,inHoverState:o,renderDefault:Fw(t,r),wrapInAnchor:Pw(a,l)};return S.jsx("td",at(at({className:e},c),{},{"data-change-key":n,children:u(f)}))}function aj(e){var t,n,r,a=e.change,l=e.selected,c=e.tokens,o=e.className,u=e.generateLineClassName,f=e.gutterClassName,g=e.codeClassName,d=e.gutterEvents,m=e.codeEvents,_=e.hideGutter,w=e.gutterAnchor,C=e.generateAnchorID,y=e.renderToken,b=e.renderGutter,x=a.type,v=a.content,k=yr(a),D=(t=Ke(W.useState(!1),2),n=t[0],r=t[1],[n,W.useCallback((function(){return r(!0)}),[]),W.useCallback((function(){return r(!1)}),[])]),T=Ke(D,3),R=T[0],N=T[1],L=T[2],I=W.useMemo((function(){return{change:a}}),[a]),F=Q1(d,I,N,L),V=Q1(m,I,N,L),H=C(a),z=u({changes:[a],defaultGenerate:function(){return o}}),q=kn("diff-gutter","diff-gutter-".concat(x),f,{"diff-gutter-selected":l}),G=kn("diff-code","diff-code-".concat(x),g,{"diff-code-selected":l});return S.jsxs("tr",{id:H,className:kn("diff-line",z),children:[!_&&J1(q,a,k,"old",w,H,F,R,b),!_&&J1(q,a,k,"new",w,H,F,R,b),S.jsx(Hw,at({className:G,changeKey:k,text:v,tokens:c,renderToken:y},V))]})}var oj=W.memo(aj);function lj(e){var t=e.hideGutter,n=e.element;return S.jsx("tr",{className:"diff-widget",children:S.jsx("td",{colSpan:t?1:3,className:"diff-widget-content",children:n})})}var cj=["hideGutter","selectedChanges","tokens","lineClassName"],uj=["hunk","widgets","className"];function hj(e){var t=e.hunk,n=e.widgets,r=e.className,a=br(e,uj),l=(function(c,o){return c.reduce((function(u,f){var g=yr(f);u.push(["change",g,f]);var d=o[g];return d&&u.push(["widget",g,d]),u}),[])})(t.changes,n);return S.jsx("tbody",{className:kn("diff-hunk",r),children:l.map((function(c){return(function(o,u){var f=Ke(o,3),g=f[0],d=f[1],m=f[2],_=u.hideGutter,w=u.selectedChanges,C=u.tokens,y=u.lineClassName,b=br(u,cj);if(g==="change"){var x=Nn(m)?"old":"new",v=Nn(m)?sh(m):ah(m),k=C?C[x][v-1]:null;return S.jsx(oj,at({className:y,change:m,hideGutter:_,selected:w.includes(d),tokens:k},b),"change".concat(d))}return g==="widget"?S.jsx(lj,{hideGutter:_,element:m},"widget".concat(d)):null})(c,a)}))})}var Uw=0;function Hc(e,t,n,r){var a=W.useCallback((function(){return t(e)}),[e,t]),l=W.useCallback((function(){return t("")}),[t]);return W.useMemo((function(){var c=zw(r,(function(o){return function(u){return o&&o({side:e,change:n},u)}}));return c.onMouseEnter=bu(a,c.onMouseEnter),c.onMouseLeave=bu(l,c.onMouseLeave),c}),[n,r,a,e,l])}function rp(e){var t=e.change,n=e.side,r=e.selected,a=e.tokens,l=e.gutterClassName,c=e.codeClassName,o=e.gutterEvents,u=e.codeEvents,f=e.anchorID,g=e.gutterAnchor,d=e.gutterAnchorTarget,m=e.hideGutter,_=e.hover,w=e.renderToken,C=e.renderGutter;if(!t){var y=kn("diff-gutter","diff-gutter-omit",l),b=kn("diff-code","diff-code-omit",c);return[!m&&S.jsx("td",{className:y},"gutter"),S.jsx("td",{className:b},"code")]}var x=t.type,v=t.content,k=yr(t),D=n===Uw?"old":"new",T=at({id:f||void 0,className:kn("diff-gutter","diff-gutter-".concat(x),Fp({"diff-gutter-selected":r},"diff-line-hover-"+D,_),l),children:C({change:t,side:D,inHoverState:_,renderDefault:Fw(t,D),wrapInAnchor:Pw(g,d)})},o),R=kn("diff-code","diff-code-".concat(x),Fp({"diff-code-selected":r},"diff-line-hover-"+D,_),c);return[!m&&S.jsx("td",at(at({},T),{},{"data-change-key":k}),"gutter"),S.jsx(Hw,at({className:R,changeKey:k,text:v,tokens:a,renderToken:w},u),"code")]}function fj(e){var t=e.className,n=e.oldChange,r=e.newChange,a=e.oldSelected,l=e.newSelected,c=e.oldTokens,o=e.newTokens,u=e.monotonous,f=e.gutterClassName,g=e.codeClassName,d=e.gutterEvents,m=e.codeEvents,_=e.hideGutter,w=e.generateAnchorID,C=e.generateLineClassName,y=e.gutterAnchor,b=e.renderToken,x=e.renderGutter,v=Ke(W.useState(""),2),k=v[0],D=v[1],T=Hc("old",D,n,d),R=Hc("new",D,r,d),N=Hc("old",D,n,m),L=Hc("new",D,r,m),I=n&&w(n),F=r&&w(r),V=C({changes:[n,r],defaultGenerate:function(){return t}}),H={monotonous:u,hideGutter:_,gutterClassName:f,codeClassName:g,gutterEvents:d,codeEvents:m,renderToken:b,renderGutter:x},z=at(at({},H),{},{change:n,side:Uw,selected:a,tokens:c,gutterEvents:T,codeEvents:N,anchorID:I,gutterAnchor:y,gutterAnchorTarget:I,hover:k==="old"}),q=at(at({},H),{},{change:r,side:1,selected:l,tokens:o,gutterEvents:R,codeEvents:L,anchorID:n===r?null:F,gutterAnchor:y,gutterAnchorTarget:n===r?I:F,hover:k==="new"});if(u)return S.jsx("tr",{className:kn("diff-line",V),children:rp(n?z:q)});var G=(function(X,K){return X&&!K?"diff-line-old-only":!X&&K?"diff-line-new-only":X===K?"diff-line-normal":"diff-line-compare"})(n,r);return S.jsxs("tr",{className:kn("diff-line",G,V),children:[rp(z),rp(q)]})}var dj=W.memo(fj);function pj(e){var t=e.hideGutter,n=e.oldElement,r=e.newElement;return e.monotonous?S.jsx("tr",{className:"diff-widget",children:S.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n||r})}):n===r?S.jsx("tr",{className:"diff-widget",children:S.jsx("td",{colSpan:t?2:4,className:"diff-widget-content",children:n})}):S.jsxs("tr",{className:"diff-widget",children:[S.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n}),S.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:r})]})}var gj=["selectedChanges","monotonous","hideGutter","tokens","lineClassName"],mj=["hunk","widgets","className"];function Fc(e,t){return(e?yr(e):"00")+(t?yr(t):"00")}function _j(e){var t=e.hunk,n=e.widgets,r=e.className,a=br(e,mj),l=(function(c,o){for(var u=function(b){if(!b)return null;var x=yr(b);return o[x]||null},f=[],g=0;g=a&&r=l&&a-1},EO=function(e,t){var n=this.__data__,r=Qu(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function Ws(e){var t=-1,n=e==null?0:e.length;for(this.clear();++to))return!1;var f=l.get(e),g=l.get(t);if(f&&g)return f==t&&g==e;var d=-1,m=!0,_=2&n?new l6:void 0;for(l.set(e,t),l.set(t,e);++d-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},xt={};xt["[object Float32Array]"]=xt["[object Float64Array]"]=xt["[object Int8Array]"]=xt["[object Int16Array]"]=xt["[object Int32Array]"]=xt["[object Uint8Array]"]=xt["[object Uint8ClampedArray]"]=xt["[object Uint16Array]"]=xt["[object Uint32Array]"]=!0,xt["[object Arguments]"]=xt["[object Array]"]=xt["[object ArrayBuffer]"]=xt["[object Boolean]"]=xt["[object DataView]"]=xt["[object Date]"]=xt["[object Error]"]=xt["[object Function]"]=xt["[object Map]"]=xt["[object Number]"]=xt["[object Object]"]=xt["[object RegExp]"]=xt["[object Set]"]=xt["[object String]"]=xt["[object WeakMap]"]=!1;var C6=function(e){return ra(e)&&pm(e.length)&&!!xt[ma(e)]},E6=function(e){return function(t){return e(t)}},W1=rl((function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,a=r&&r.exports===n&&Aw.process,l=(function(){try{var c=r&&r.require&&r.require("util").types;return c||a&&a.binding&&a.binding("util")}catch{}})();e.exports=l})),X1=W1&&W1.isTypedArray,gm=X1?E6(X1):C6,k6=Object.prototype.hasOwnProperty,A6=function(e,t){var n=Mn(e),r=!n&&nh(e),a=!n&&!r&&xu(e),l=!n&&!r&&!a&&gm(e),c=n||r||a||l,o=c?y6(e.length,String):[],u=o.length;for(var f in e)!k6.call(e,f)||c&&(f=="length"||a&&(f=="offset"||f=="parent")||l&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Lw(f,u))||o.push(f);return o},T6=Object.prototype,Ow=function(e){var t=e&&e.constructor;return e===(typeof t=="function"&&t.prototype||T6)},N6=(function(e,t){return function(n){return e(t(n))}})(Object.keys,Object),D6=Object.prototype.hasOwnProperty,jw=function(e){if(!Ow(e))return N6(e);var t=[];for(var n in Object(e))D6.call(e,n)&&n!="constructor"&&t.push(n);return t},ih=function(e){return e!=null&&pm(e.length)&&!Nw(e)},mm=function(e){return ih(e)?A6(e):jw(e)},K1=function(e){return p6(e,mm,v6)},R6=Object.prototype.hasOwnProperty,M6=function(e,t,n,r,a,l){var c=1&n,o=K1(e),u=o.length;if(u!=K1(t).length&&!c)return!1;for(var f=u;f--;){var g=o[f];if(!(c?g in t:R6.call(t,g)))return!1}var d=l.get(e),m=l.get(t);if(d&&m)return d==t&&m==e;var _=!0;l.set(e,t),l.set(t,e);for(var w=c;++f1)return!1;if(e.length===1){var t=Ze(e,1)[0];return t.type==="text"&&!t.value}return!0}function bj(e){var t=e.changeKey,n=e.text,r=e.tokens,a=e.renderToken,l=br(e,vj),c=a?function(o,u){return a(o,tb,u)}:tb;return v.jsx("td",ot(ot({},l),{},{"data-change-key":t,children:r?yj(r)?" ":r.map(c):n||" "}))}var $w=Y.memo(bj);function Gw(e,t){return function(){var n=t==="old"?lh(e):ch(e);return n===-1?void 0:n}}function qw(e,t){return function(n){return e&&n?v.jsx("a",{href:t?"#"+t:void 0,children:n}):n}}function wu(e,t){return t?function(n){e(),t(n)}:e}function nb(e,t,n,r){return Y.useMemo((function(){var a=Uw(e,(function(l){return function(c){return l&&l(t,c)}}));return a.onMouseEnter=wu(n,a.onMouseEnter),a.onMouseLeave=wu(r,a.onMouseLeave),a}),[e,n,r,t])}function ib(e,t,n,r,a,l,c,o,u){var f={change:t,side:r,inHoverState:o,renderDefault:Gw(t,r),wrapInAnchor:qw(a,l)};return v.jsx("td",ot(ot({className:e},c),{},{"data-change-key":n,children:u(f)}))}function Sj(e){var t,n,r,a=e.change,l=e.selected,c=e.tokens,o=e.className,u=e.generateLineClassName,f=e.gutterClassName,g=e.codeClassName,d=e.gutterEvents,m=e.codeEvents,_=e.hideGutter,w=e.gutterAnchor,C=e.generateAnchorID,b=e.renderToken,S=e.renderGutter,x=a.type,y=a.content,k=yr(a),D=(t=Ze(Y.useState(!1),2),n=t[0],r=t[1],[n,Y.useCallback((function(){return r(!0)}),[]),Y.useCallback((function(){return r(!1)}),[])]),T=Ze(D,3),R=T[0],N=T[1],L=T[2],I=Y.useMemo((function(){return{change:a}}),[a]),F=nb(d,I,N,L),V=nb(m,I,N,L),H=C(a),z=u({changes:[a],defaultGenerate:function(){return o}}),q=Tn("diff-gutter","diff-gutter-".concat(x),f,{"diff-gutter-selected":l}),G=Tn("diff-code","diff-code-".concat(x),g,{"diff-code-selected":l});return v.jsxs("tr",{id:H,className:Tn("diff-line",z),children:[!_&&ib(q,a,k,"old",w,H,F,R,S),!_&&ib(q,a,k,"new",w,H,F,R,S),v.jsx($w,ot({className:G,changeKey:k,text:y,tokens:c,renderToken:b},V))]})}var xj=Y.memo(Sj);function wj(e){var t=e.hideGutter,n=e.element;return v.jsx("tr",{className:"diff-widget",children:v.jsx("td",{colSpan:t?1:3,className:"diff-widget-content",children:n})})}var Cj=["hideGutter","selectedChanges","tokens","lineClassName"],Ej=["hunk","widgets","className"];function kj(e){var t=e.hunk,n=e.widgets,r=e.className,a=br(e,Ej),l=(function(c,o){return c.reduce((function(u,f){var g=yr(f);u.push(["change",g,f]);var d=o[g];return d&&u.push(["widget",g,d]),u}),[])})(t.changes,n);return v.jsx("tbody",{className:Tn("diff-hunk",r),children:l.map((function(c){return(function(o,u){var f=Ze(o,3),g=f[0],d=f[1],m=f[2],_=u.hideGutter,w=u.selectedChanges,C=u.tokens,b=u.lineClassName,S=br(u,Cj);if(g==="change"){var x=Rn(m)?"old":"new",y=Rn(m)?lh(m):ch(m),k=C?C[x][y-1]:null;return v.jsx(xj,ot({className:b,change:m,hideGutter:_,selected:w.includes(d),tokens:k},S),"change".concat(d))}return g==="widget"?v.jsx(wj,{hideGutter:_,element:m},"widget".concat(d)):null})(c,a)}))})}var Vw=0;function Uc(e,t,n,r){var a=Y.useCallback((function(){return t(e)}),[e,t]),l=Y.useCallback((function(){return t("")}),[t]);return Y.useMemo((function(){var c=Uw(r,(function(o){return function(u){return o&&o({side:e,change:n},u)}}));return c.onMouseEnter=wu(a,c.onMouseEnter),c.onMouseLeave=wu(l,c.onMouseLeave),c}),[n,r,a,e,l])}function lp(e){var t=e.change,n=e.side,r=e.selected,a=e.tokens,l=e.gutterClassName,c=e.codeClassName,o=e.gutterEvents,u=e.codeEvents,f=e.anchorID,g=e.gutterAnchor,d=e.gutterAnchorTarget,m=e.hideGutter,_=e.hover,w=e.renderToken,C=e.renderGutter;if(!t){var b=Tn("diff-gutter","diff-gutter-omit",l),S=Tn("diff-code","diff-code-omit",c);return[!m&&v.jsx("td",{className:b},"gutter"),v.jsx("td",{className:S},"code")]}var x=t.type,y=t.content,k=yr(t),D=n===Vw?"old":"new",T=ot({id:f||void 0,className:Tn("diff-gutter","diff-gutter-".concat(x),Vp({"diff-gutter-selected":r},"diff-line-hover-"+D,_),l),children:C({change:t,side:D,inHoverState:_,renderDefault:Gw(t,D),wrapInAnchor:qw(g,d)})},o),R=Tn("diff-code","diff-code-".concat(x),Vp({"diff-code-selected":r},"diff-line-hover-"+D,_),c);return[!m&&v.jsx("td",ot(ot({},T),{},{"data-change-key":k}),"gutter"),v.jsx($w,ot({className:R,changeKey:k,text:y,tokens:a,renderToken:w},u),"code")]}function Aj(e){var t=e.className,n=e.oldChange,r=e.newChange,a=e.oldSelected,l=e.newSelected,c=e.oldTokens,o=e.newTokens,u=e.monotonous,f=e.gutterClassName,g=e.codeClassName,d=e.gutterEvents,m=e.codeEvents,_=e.hideGutter,w=e.generateAnchorID,C=e.generateLineClassName,b=e.gutterAnchor,S=e.renderToken,x=e.renderGutter,y=Ze(Y.useState(""),2),k=y[0],D=y[1],T=Uc("old",D,n,d),R=Uc("new",D,r,d),N=Uc("old",D,n,m),L=Uc("new",D,r,m),I=n&&w(n),F=r&&w(r),V=C({changes:[n,r],defaultGenerate:function(){return t}}),H={monotonous:u,hideGutter:_,gutterClassName:f,codeClassName:g,gutterEvents:d,codeEvents:m,renderToken:S,renderGutter:x},z=ot(ot({},H),{},{change:n,side:Vw,selected:a,tokens:c,gutterEvents:T,codeEvents:N,anchorID:I,gutterAnchor:b,gutterAnchorTarget:I,hover:k==="old"}),q=ot(ot({},H),{},{change:r,side:1,selected:l,tokens:o,gutterEvents:R,codeEvents:L,anchorID:n===r?null:F,gutterAnchor:b,gutterAnchorTarget:n===r?I:F,hover:k==="new"});if(u)return v.jsx("tr",{className:Tn("diff-line",V),children:lp(n?z:q)});var G=(function(X,K){return X&&!K?"diff-line-old-only":!X&&K?"diff-line-new-only":X===K?"diff-line-normal":"diff-line-compare"})(n,r);return v.jsxs("tr",{className:Tn("diff-line",G,V),children:[lp(z),lp(q)]})}var Tj=Y.memo(Aj);function Nj(e){var t=e.hideGutter,n=e.oldElement,r=e.newElement;return e.monotonous?v.jsx("tr",{className:"diff-widget",children:v.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n||r})}):n===r?v.jsx("tr",{className:"diff-widget",children:v.jsx("td",{colSpan:t?2:4,className:"diff-widget-content",children:n})}):v.jsxs("tr",{className:"diff-widget",children:[v.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n}),v.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:r})]})}var Dj=["selectedChanges","monotonous","hideGutter","tokens","lineClassName"],Rj=["hunk","widgets","className"];function $c(e,t){return(e?yr(e):"00")+(t?yr(t):"00")}function Mj(e){var t=e.hunk,n=e.widgets,r=e.className,a=br(e,Rj),l=(function(c,o){for(var u=function(S){if(!S)return null;var x=yr(S);return o[x]||null},f=[],g=0;g=(l==null?void 0:l.value.length))return[e];var o=function(d,m){var _=l.value.slice(d,m);return[].concat(Tn(a),[at(at({},l),{},{value:_})])};if(t>0){var u=o(0,t);c.push(Qs(u))}var f=o(Math.max(t,0),n);if(c.push(r?(function(d,m){return[m].concat(Tn(Qs(d)))})(f,r):Qs(f)),n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(e.children){var r=e.children,a=br(e,Ij);n.push(a);var l,c=om(r);try{for(c.s();!(l=c.n()).done;)Vw(l.value,t,n)}catch(o){c.e(o)}finally{c.f()}n.pop()}else t.push(Qs([].concat(Tn(n.slice(1)),[e])));return t}function zj(e){return e.reduce((function(t,n){var r=t[t.length-1],a=(function(u){var f=mm(u);return f.value.includes(` +`)})(t.oldSource,e),r=t.highlight?function(u){return t.refractor.highlight(u,t.language)}:function(u){return[{type:"text",value:u}]};return[Gc(r(t.oldSource)),Gc(r(n))]}var a=Ze(Yj(e),2),l=a[0],c=a[1],o=t.highlight?function(u){return Gc(t.refractor.highlight(u,t.language))}:function(u){return Gc([{type:"text",value:u}])};return[o(l),o(c)]}function Qs(e){return e.map((function(t){return ot({},t)}))}function Xj(e,t){return[].concat(Dn(Qs(e.slice(0,-1))),[t])}function Kj(e){return e.type==="text"}function Sm(e){var t=e[e.length-1];if(Kj(t))return t;throw new Error("Invalid token path with leaf of type ".concat(t.type))}function Zj(e,t,n,r){var a=e.slice(0,-1),l=Sm(e),c=[];if(n<=0||t>=(l==null?void 0:l.value.length))return[e];var o=function(d,m){var _=l.value.slice(d,m);return[].concat(Dn(a),[ot(ot({},l),{},{value:_})])};if(t>0){var u=o(0,t);c.push(Qs(u))}var f=o(Math.max(t,0),n);if(c.push(r?(function(d,m){return[m].concat(Dn(Qs(d)))})(f,r):Qs(f)),n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(e.children){var r=e.children,a=br(e,Qj);n.push(a);var l,c=fm(r);try{for(c.s();!(l=c.n()).done;)Kw(l.value,t,n)}catch(o){c.e(o)}finally{c.f()}n.pop()}else t.push(Qs([].concat(Dn(n.slice(1)),[e])));return t}function Jj(e){return e.reduce((function(t,n){var r=t[t.length-1],a=(function(u){var f=Sm(u);return f.value.includes(` `)?f.value.split(` -`).map((function(g){return Oj(u,at(at({},f),{},{value:g}))})):[u]})(n),l=gw(a),c=l[0],o=l.slice(1);return[].concat(Tn(t.slice(0,-1)),[[].concat(Tn(r),[c])],Tn(o.map((function(u){return[u]}))))}),[[]])}function ib(e){return zj(Vw(e))}var Hj=function(e,t,n){var r=(n=typeof n=="function"?n:void 0)?n(e,t):void 0;return r===void 0?th(e,t,void 0,n):!!r},Fj=function(e,t){return th(e,t)},Pj=function(e){var t=e==null?0:e.length;return t?e[t-1]:void 0};function Uj(e,t){if(!e.children)throw new Error("parent node missing children property");var n,r,a=Pj(e.children);return a&&(r=t,(n=a).type===r.type&&(n.type==="text"||n.children&&r.children&&Hj(n,r,(function(l,c,o){return o==="chlidren"||Fj(l,c)}))))?e.children[e.children.length-1]=(function(l,c){return"value"in l&&"value"in c?at(at({},l),{},{value:"".concat(l.value).concat(c.value)}):l})(a,t):e.children.push(t),e.children[e.children.length-1]}function rb(e){var t,n={type:"root",children:[]},r=om(e);try{var a=function(){var l=t.value;l.reduce((function(c,o,u){return Uj(c,u===l.length-1?at({},o):at(at({},o),{},{children:[]}))}),n)};for(r.s();!(t=r.n()).done;)a()}catch(l){r.e(l)}finally{r.f()}return n}var $j=Object.prototype.hasOwnProperty,Gj=Gw((function(e,t,n){$j.call(e,n)?e[n].push(t):pm(e,n,[t])})),qj=Object.prototype.hasOwnProperty,Vj=function(e){if(e==null)return!0;if(eh(e)&&(Dn(e)||typeof e=="string"||typeof e.splice=="function"||yu(e)||um(e)||Ju(e)))return!e.length;var t=Yp(e);if(t=="[object Map]"||t=="[object Set]")return!e.size;if(Dw(e))return!Rw(e).length;for(var n in e)if(qj.call(e,n))return!1;return!0},Yj=function(e,t){var n=t.start,r=t.length,a=n+r,l=e.reduce((function(c,o){var u=Ke(c,2),f=u[0],g=u[1],d=g+mm(o).value.length;if(g>a||dr.length?n:r,u=n.length>r.length?r:n,f=o.indexOf(u);if(f!=-1)return c=[new t.Diff(1,o.substring(0,f)),new t.Diff(0,u),new t.Diff(1,o.substring(f+u.length))],n.length>r.length&&(c[0][0]=c[2][0]=-1),c;if(u.length==1)return[new t.Diff(-1,n),new t.Diff(1,r)];var g=this.diff_halfMatch_(n,r);if(g){var d=g[0],m=g[1],_=g[2],w=g[3],C=g[4],y=this.diff_main(d,_,a,l),b=this.diff_main(m,w,a,l);return y.concat([new t.Diff(0,C)],b)}return a&&n.length>100&&r.length>100?this.diff_lineMode_(n,r,l):this.diff_bisect_(n,r,l)},t.prototype.diff_lineMode_=function(n,r,a){var l=this.diff_linesToChars_(n,r);n=l.chars1,r=l.chars2;var c=l.lineArray,o=this.diff_main(n,r,!1,a);this.diff_charsToLines_(o,c),this.diff_cleanupSemantic(o),o.push(new t.Diff(0,""));for(var u=0,f=0,g=0,d="",m="";u=1&&g>=1){o.splice(u-f-g,f+g),u=u-f-g;for(var _=this.diff_main(d,m,!1,a),w=_.length-1;w>=0;w--)o.splice(u,0,_[w]);u+=_.length}g=0,f=0,d="",m=""}u++}return o.pop(),o},t.prototype.diff_bisect_=function(n,r,a){for(var l=n.length,c=r.length,o=Math.ceil((l+c)/2),u=o,f=2*o,g=new Array(f),d=new Array(f),m=0;ma);v++){for(var k=-v+C;k<=v-y;k+=2){for(var D=u+k,T=(F=k==-v||k!=v&&g[D-1]l)y+=2;else if(T>c)C+=2;else if(w&&(L=u+_-k)>=0&&L=(N=l-d[L]))return this.diff_bisectSplit_(n,r,F,T,a)}for(var R=-v+b;R<=v-x;R+=2){for(var N,L=u+R,I=(N=R==-v||R!=v&&d[L-1]l)x+=2;else if(I>c)b+=2;else if(!w&&(D=u+_-R)>=0&&D=(N=l-N))return this.diff_bisectSplit_(n,r,F,T,a)}}}return[new t.Diff(-1,n),new t.Diff(1,r)]},t.prototype.diff_bisectSplit_=function(n,r,a,l,c){var o=n.substring(0,a),u=r.substring(0,l),f=n.substring(a),g=r.substring(l),d=this.diff_main(o,u,!1,c),m=this.diff_main(f,g,!1,c);return d.concat(m)},t.prototype.diff_linesToChars_=function(n,r){var a=[],l={};function c(f){for(var g="",d=0,m=-1,_=a.length;ml?n=n.substring(a-l):ar.length?n:r,l=n.length>r.length?r:n;if(a.length<4||2*l.length=C.length?[x,v,k,D,N]:null}var u,f,g,d,m,_=o(a,l,Math.ceil(a.length/4)),w=o(a,l,Math.ceil(a.length/2));return _||w?(u=w?_&&_[4].length>w[4].length?_:w:_,n.length>r.length?(f=u[0],g=u[1],d=u[2],m=u[3]):(d=u[0],m=u[1],f=u[2],g=u[3]),[f,g,d,m,u[4]]):null},t.prototype.diff_cleanupSemantic=function(n){for(var r=!1,a=[],l=0,c=null,o=0,u=0,f=0,g=0,d=0;o0?a[l-1]:-1,u=0,f=0,g=0,d=0,c=null,r=!0)),o++;for(r&&this.diff_cleanupMerge(n),this.diff_cleanupSemanticLossless(n),o=1;o=C?(w>=m.length/2||w>=_.length/2)&&(n.splice(o,0,new t.Diff(0,_.substring(0,w))),n[o-1][1]=m.substring(0,m.length-w),n[o+1][1]=_.substring(w),o++):(C>=m.length/2||C>=_.length/2)&&(n.splice(o,0,new t.Diff(0,m.substring(0,C))),n[o-1][0]=1,n[o-1][1]=_.substring(0,_.length-C),n[o+1][0]=-1,n[o+1][1]=m.substring(C),o++),o++}o++}},t.prototype.diff_cleanupSemanticLossless=function(n){function r(C,y){if(!C||!y)return 6;var b=C.charAt(C.length-1),x=y.charAt(0),v=b.match(t.nonAlphaNumericRegex_),k=x.match(t.nonAlphaNumericRegex_),D=v&&b.match(t.whitespaceRegex_),T=k&&x.match(t.whitespaceRegex_),R=D&&b.match(t.linebreakRegex_),N=T&&x.match(t.linebreakRegex_),L=R&&C.match(t.blanklineEndRegex_),I=N&&y.match(t.blanklineStartRegex_);return L||I?5:R||N?4:v&&!D&&T?3:D||T?2:v||k?1:0}for(var a=1;a=_&&(_=w,g=l,d=c,m=o)}n[a-1][1]!=g&&(g?n[a-1][1]=g:(n.splice(a-1,1),a--),n[a][1]=d,m?n[a+1][1]=m:(n.splice(a+1,1),a--))}a++}},t.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,t.whitespaceRegex_=/\s/,t.linebreakRegex_=/[\r\n]/,t.blanklineEndRegex_=/\n\r?\n$/,t.blanklineStartRegex_=/^\r?\n\r?\n/,t.prototype.diff_cleanupEfficiency=function(n){for(var r=!1,a=[],l=0,c=null,o=0,u=!1,f=!1,g=!1,d=!1;o0?a[l-1]:-1,g=d=!1),r=!0)),o++;r&&this.diff_cleanupMerge(n)},t.prototype.diff_cleanupMerge=function(n){n.push(new t.Diff(0,""));for(var r,a=0,l=0,c=0,o="",u="";a1?(l!==0&&c!==0&&((r=this.diff_commonPrefix(u,o))!==0&&(a-l-c>0&&n[a-l-c-1][0]==0?n[a-l-c-1][1]+=u.substring(0,r):(n.splice(0,0,new t.Diff(0,u.substring(0,r))),a++),u=u.substring(r),o=o.substring(r)),(r=this.diff_commonSuffix(u,o))!==0&&(n[a][1]=u.substring(u.length-r)+n[a][1],u=u.substring(0,u.length-r),o=o.substring(0,o.length-r))),a-=l+c,n.splice(a,l+c),o.length&&(n.splice(a,0,new t.Diff(-1,o)),a++),u.length&&(n.splice(a,0,new t.Diff(1,u)),a++),a++):a!==0&&n[a-1][0]==0?(n[a-1][1]+=n[a][1],n.splice(a,1)):a++,c=0,l=0,o="",u=""}n[n.length-1][1]===""&&n.pop();var f=!1;for(a=1;ar));a++)o=l,u=c;return n.length!=a&&n[a][0]===-1?u:u+(r-o)},t.prototype.diff_prettyHtml=function(n){for(var r=[],a=/&/g,l=//g,o=/\n/g,u=0;u");switch(f){case 1:r[u]=''+g+"";break;case-1:r[u]=''+g+"";break;case 0:r[u]=""+g+""}}return r.join("")},t.prototype.diff_text1=function(n){for(var r=[],a=0;athis.Match_MaxBits)throw new Error("Pattern too long for this browser.");var l=this.match_alphabet_(r),c=this;function o(T,R){var N=T/r.length,L=Math.abs(a-R);return c.Match_Distance?N+L/c.Match_Distance:L?1:N}var u=this.Match_Threshold,f=n.indexOf(r,a);f!=-1&&(u=Math.min(o(0,f),u),(f=n.lastIndexOf(r,a+r.length))!=-1&&(u=Math.min(o(0,f),u)));var g,d,m=1<=y;v--){var k=l[n.charAt(v-1)];if(x[v]=C===0?(x[v+1]<<1|1)&k:(x[v+1]<<1|1)&k|(_[v+1]|_[v])<<1|1|_[v+1],x[v]&m){var D=o(C,v-1);if(D<=u){if(u=D,!((f=v-1)>a))break;y=Math.max(1,2*a-f)}}}if(o(C+1,a)>u)break;_=x}return f},t.prototype.match_alphabet_=function(n){for(var r={},a=0;a2&&(this.diff_cleanupSemantic(c),this.diff_cleanupEfficiency(c));else if(n&&typeof n=="object"&&r===void 0&&a===void 0)c=n,l=this.diff_text1(c);else if(typeof n=="string"&&r&&typeof r=="object"&&a===void 0)l=n,c=r;else{if(typeof n!="string"||typeof r!="string"||!a||typeof a!="object")throw new Error("Unknown call format to patch_make.");l=n,c=a}if(c.length===0)return[];for(var o=[],u=new t.patch_obj,f=0,g=0,d=0,m=l,_=l,w=0;w=2*this.Patch_Margin&&f&&(this.patch_addContext_(u,m),o.push(u),u=new t.patch_obj,f=0,m=_,g=d)}C!==1&&(g+=y.length),C!==-1&&(d+=y.length)}return f&&(this.patch_addContext_(u,m),o.push(u)),o},t.prototype.patch_deepCopy=function(n){for(var r=[],a=0;athis.Match_MaxBits?(u=this.match_main(r,d.substring(0,this.Match_MaxBits),g))!=-1&&((m=this.match_main(r,d.substring(d.length-this.Match_MaxBits),g+d.length-this.Match_MaxBits))==-1||u>=m)&&(u=-1):u=this.match_main(r,d,g),u==-1)c[o]=!1,l-=n[o].length2-n[o].length1;else if(c[o]=!0,l=u-g,d==(f=m==-1?r.substring(u,u+d.length):r.substring(u,m+this.Match_MaxBits)))r=r.substring(0,u)+this.diff_text2(n[o].diffs)+r.substring(u+d.length);else{var _=this.diff_main(d,f,!1);if(d.length>this.Match_MaxBits&&this.diff_levenshtein(_)/d.length>this.Patch_DeleteThreshold)c[o]=!1;else{this.diff_cleanupSemanticLossless(_);for(var w,C=0,y=0;yo[0][1].length){var u=r-o[0][1].length;o[0][1]=a.substring(o[0][1].length)+o[0][1],c.start1-=u,c.start2-=u,c.length1+=u,c.length2+=u}return(o=(c=n[n.length-1]).diffs).length==0||o[o.length-1][0]!=0?(o.push(new t.Diff(0,a)),c.length1+=r,c.length2+=r):r>o[o.length-1][1].length&&(u=r-o[o.length-1][1].length,o[o.length-1][1]+=a.substring(0,u),c.length1+=u,c.length2+=u),a},t.prototype.patch_splitMax=function(n){for(var r=this.Match_MaxBits,a=0;a2*r?(f.length1+=m.length,c+=m.length,g=!1,f.diffs.push(new t.Diff(d,m)),l.diffs.shift()):(m=m.substring(0,r-f.length1-this.Patch_Margin),f.length1+=m.length,c+=m.length,d===0?(f.length2+=m.length,o+=m.length):g=!1,f.diffs.push(new t.Diff(d,m)),m==l.diffs[0][1]?l.diffs.shift():l.diffs[0][1]=l.diffs[0][1].substring(m.length))}u=(u=this.diff_text2(f.diffs)).substring(u.length-this.Patch_Margin);var _=this.diff_text1(l.diffs).substring(0,this.Patch_Margin);_!==""&&(f.length1+=_.length,f.length2+=_.length,f.diffs.length!==0&&f.diffs[f.diffs.length-1][0]===0?f.diffs[f.diffs.length-1][1]+=_:f.diffs.push(new t.Diff(0,_))),g||n.splice(++a,0,f)}}},t.prototype.patch_toText=function(n){for(var r=[],a=0;aa||dr.length?n:r,u=n.length>r.length?r:n,f=o.indexOf(u);if(f!=-1)return c=[new t.Diff(1,o.substring(0,f)),new t.Diff(0,u),new t.Diff(1,o.substring(f+u.length))],n.length>r.length&&(c[0][0]=c[2][0]=-1),c;if(u.length==1)return[new t.Diff(-1,n),new t.Diff(1,r)];var g=this.diff_halfMatch_(n,r);if(g){var d=g[0],m=g[1],_=g[2],w=g[3],C=g[4],b=this.diff_main(d,_,a,l),S=this.diff_main(m,w,a,l);return b.concat([new t.Diff(0,C)],S)}return a&&n.length>100&&r.length>100?this.diff_lineMode_(n,r,l):this.diff_bisect_(n,r,l)},t.prototype.diff_lineMode_=function(n,r,a){var l=this.diff_linesToChars_(n,r);n=l.chars1,r=l.chars2;var c=l.lineArray,o=this.diff_main(n,r,!1,a);this.diff_charsToLines_(o,c),this.diff_cleanupSemantic(o),o.push(new t.Diff(0,""));for(var u=0,f=0,g=0,d="",m="";u=1&&g>=1){o.splice(u-f-g,f+g),u=u-f-g;for(var _=this.diff_main(d,m,!1,a),w=_.length-1;w>=0;w--)o.splice(u,0,_[w]);u+=_.length}g=0,f=0,d="",m=""}u++}return o.pop(),o},t.prototype.diff_bisect_=function(n,r,a){for(var l=n.length,c=r.length,o=Math.ceil((l+c)/2),u=o,f=2*o,g=new Array(f),d=new Array(f),m=0;ma);y++){for(var k=-y+C;k<=y-b;k+=2){for(var D=u+k,T=(F=k==-y||k!=y&&g[D-1]l)b+=2;else if(T>c)C+=2;else if(w&&(L=u+_-k)>=0&&L=(N=l-d[L]))return this.diff_bisectSplit_(n,r,F,T,a)}for(var R=-y+S;R<=y-x;R+=2){for(var N,L=u+R,I=(N=R==-y||R!=y&&d[L-1]l)x+=2;else if(I>c)S+=2;else if(!w&&(D=u+_-R)>=0&&D=(N=l-N))return this.diff_bisectSplit_(n,r,F,T,a)}}}return[new t.Diff(-1,n),new t.Diff(1,r)]},t.prototype.diff_bisectSplit_=function(n,r,a,l,c){var o=n.substring(0,a),u=r.substring(0,l),f=n.substring(a),g=r.substring(l),d=this.diff_main(o,u,!1,c),m=this.diff_main(f,g,!1,c);return d.concat(m)},t.prototype.diff_linesToChars_=function(n,r){var a=[],l={};function c(f){for(var g="",d=0,m=-1,_=a.length;ml?n=n.substring(a-l):ar.length?n:r,l=n.length>r.length?r:n;if(a.length<4||2*l.length=C.length?[x,y,k,D,N]:null}var u,f,g,d,m,_=o(a,l,Math.ceil(a.length/4)),w=o(a,l,Math.ceil(a.length/2));return _||w?(u=w?_&&_[4].length>w[4].length?_:w:_,n.length>r.length?(f=u[0],g=u[1],d=u[2],m=u[3]):(d=u[0],m=u[1],f=u[2],g=u[3]),[f,g,d,m,u[4]]):null},t.prototype.diff_cleanupSemantic=function(n){for(var r=!1,a=[],l=0,c=null,o=0,u=0,f=0,g=0,d=0;o0?a[l-1]:-1,u=0,f=0,g=0,d=0,c=null,r=!0)),o++;for(r&&this.diff_cleanupMerge(n),this.diff_cleanupSemanticLossless(n),o=1;o=C?(w>=m.length/2||w>=_.length/2)&&(n.splice(o,0,new t.Diff(0,_.substring(0,w))),n[o-1][1]=m.substring(0,m.length-w),n[o+1][1]=_.substring(w),o++):(C>=m.length/2||C>=_.length/2)&&(n.splice(o,0,new t.Diff(0,m.substring(0,C))),n[o-1][0]=1,n[o-1][1]=_.substring(0,_.length-C),n[o+1][0]=-1,n[o+1][1]=m.substring(C),o++),o++}o++}},t.prototype.diff_cleanupSemanticLossless=function(n){function r(C,b){if(!C||!b)return 6;var S=C.charAt(C.length-1),x=b.charAt(0),y=S.match(t.nonAlphaNumericRegex_),k=x.match(t.nonAlphaNumericRegex_),D=y&&S.match(t.whitespaceRegex_),T=k&&x.match(t.whitespaceRegex_),R=D&&S.match(t.linebreakRegex_),N=T&&x.match(t.linebreakRegex_),L=R&&C.match(t.blanklineEndRegex_),I=N&&b.match(t.blanklineStartRegex_);return L||I?5:R||N?4:y&&!D&&T?3:D||T?2:y||k?1:0}for(var a=1;a=_&&(_=w,g=l,d=c,m=o)}n[a-1][1]!=g&&(g?n[a-1][1]=g:(n.splice(a-1,1),a--),n[a][1]=d,m?n[a+1][1]=m:(n.splice(a+1,1),a--))}a++}},t.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,t.whitespaceRegex_=/\s/,t.linebreakRegex_=/[\r\n]/,t.blanklineEndRegex_=/\n\r?\n$/,t.blanklineStartRegex_=/^\r?\n\r?\n/,t.prototype.diff_cleanupEfficiency=function(n){for(var r=!1,a=[],l=0,c=null,o=0,u=!1,f=!1,g=!1,d=!1;o0?a[l-1]:-1,g=d=!1),r=!0)),o++;r&&this.diff_cleanupMerge(n)},t.prototype.diff_cleanupMerge=function(n){n.push(new t.Diff(0,""));for(var r,a=0,l=0,c=0,o="",u="";a1?(l!==0&&c!==0&&((r=this.diff_commonPrefix(u,o))!==0&&(a-l-c>0&&n[a-l-c-1][0]==0?n[a-l-c-1][1]+=u.substring(0,r):(n.splice(0,0,new t.Diff(0,u.substring(0,r))),a++),u=u.substring(r),o=o.substring(r)),(r=this.diff_commonSuffix(u,o))!==0&&(n[a][1]=u.substring(u.length-r)+n[a][1],u=u.substring(0,u.length-r),o=o.substring(0,o.length-r))),a-=l+c,n.splice(a,l+c),o.length&&(n.splice(a,0,new t.Diff(-1,o)),a++),u.length&&(n.splice(a,0,new t.Diff(1,u)),a++),a++):a!==0&&n[a-1][0]==0?(n[a-1][1]+=n[a][1],n.splice(a,1)):a++,c=0,l=0,o="",u=""}n[n.length-1][1]===""&&n.pop();var f=!1;for(a=1;ar));a++)o=l,u=c;return n.length!=a&&n[a][0]===-1?u:u+(r-o)},t.prototype.diff_prettyHtml=function(n){for(var r=[],a=/&/g,l=//g,o=/\n/g,u=0;u");switch(f){case 1:r[u]=''+g+"";break;case-1:r[u]=''+g+"";break;case 0:r[u]=""+g+""}}return r.join("")},t.prototype.diff_text1=function(n){for(var r=[],a=0;athis.Match_MaxBits)throw new Error("Pattern too long for this browser.");var l=this.match_alphabet_(r),c=this;function o(T,R){var N=T/r.length,L=Math.abs(a-R);return c.Match_Distance?N+L/c.Match_Distance:L?1:N}var u=this.Match_Threshold,f=n.indexOf(r,a);f!=-1&&(u=Math.min(o(0,f),u),(f=n.lastIndexOf(r,a+r.length))!=-1&&(u=Math.min(o(0,f),u)));var g,d,m=1<=b;y--){var k=l[n.charAt(y-1)];if(x[y]=C===0?(x[y+1]<<1|1)&k:(x[y+1]<<1|1)&k|(_[y+1]|_[y])<<1|1|_[y+1],x[y]&m){var D=o(C,y-1);if(D<=u){if(u=D,!((f=y-1)>a))break;b=Math.max(1,2*a-f)}}}if(o(C+1,a)>u)break;_=x}return f},t.prototype.match_alphabet_=function(n){for(var r={},a=0;a2&&(this.diff_cleanupSemantic(c),this.diff_cleanupEfficiency(c));else if(n&&typeof n=="object"&&r===void 0&&a===void 0)c=n,l=this.diff_text1(c);else if(typeof n=="string"&&r&&typeof r=="object"&&a===void 0)l=n,c=r;else{if(typeof n!="string"||typeof r!="string"||!a||typeof a!="object")throw new Error("Unknown call format to patch_make.");l=n,c=a}if(c.length===0)return[];for(var o=[],u=new t.patch_obj,f=0,g=0,d=0,m=l,_=l,w=0;w=2*this.Patch_Margin&&f&&(this.patch_addContext_(u,m),o.push(u),u=new t.patch_obj,f=0,m=_,g=d)}C!==1&&(g+=b.length),C!==-1&&(d+=b.length)}return f&&(this.patch_addContext_(u,m),o.push(u)),o},t.prototype.patch_deepCopy=function(n){for(var r=[],a=0;athis.Match_MaxBits?(u=this.match_main(r,d.substring(0,this.Match_MaxBits),g))!=-1&&((m=this.match_main(r,d.substring(d.length-this.Match_MaxBits),g+d.length-this.Match_MaxBits))==-1||u>=m)&&(u=-1):u=this.match_main(r,d,g),u==-1)c[o]=!1,l-=n[o].length2-n[o].length1;else if(c[o]=!0,l=u-g,d==(f=m==-1?r.substring(u,u+d.length):r.substring(u,m+this.Match_MaxBits)))r=r.substring(0,u)+this.diff_text2(n[o].diffs)+r.substring(u+d.length);else{var _=this.diff_main(d,f,!1);if(d.length>this.Match_MaxBits&&this.diff_levenshtein(_)/d.length>this.Patch_DeleteThreshold)c[o]=!1;else{this.diff_cleanupSemanticLossless(_);for(var w,C=0,b=0;bo[0][1].length){var u=r-o[0][1].length;o[0][1]=a.substring(o[0][1].length)+o[0][1],c.start1-=u,c.start2-=u,c.length1+=u,c.length2+=u}return(o=(c=n[n.length-1]).diffs).length==0||o[o.length-1][0]!=0?(o.push(new t.Diff(0,a)),c.length1+=r,c.length2+=r):r>o[o.length-1][1].length&&(u=r-o[o.length-1][1].length,o[o.length-1][1]+=a.substring(0,u),c.length1+=u,c.length2+=u),a},t.prototype.patch_splitMax=function(n){for(var r=this.Match_MaxBits,a=0;a2*r?(f.length1+=m.length,c+=m.length,g=!1,f.diffs.push(new t.Diff(d,m)),l.diffs.shift()):(m=m.substring(0,r-f.length1-this.Patch_Margin),f.length1+=m.length,c+=m.length,d===0?(f.length2+=m.length,o+=m.length):g=!1,f.diffs.push(new t.Diff(d,m)),m==l.diffs[0][1]?l.diffs.shift():l.diffs[0][1]=l.diffs[0][1].substring(m.length))}u=(u=this.diff_text2(f.diffs)).substring(u.length-this.Patch_Margin);var _=this.diff_text1(l.diffs).substring(0,this.Patch_Margin);_!==""&&(f.length1+=_.length,f.length2+=_.length,f.diffs.length!==0&&f.diffs[f.diffs.length-1][0]===0?f.diffs[f.diffs.length-1][1]+=_:f.diffs.push(new t.Diff(0,_))),g||n.splice(++a,0,f)}}},t.prototype.patch_toText=function(n){for(var r=[],a=0;a1&&arguments[1]!==void 0?arguments[1]:{}).type,n=(t===void 0?"block":t)==="block"?Jj:e8,r=gm(e.map((function(o){return o.changes})),Yw).map(n).reduce((function(o,u){var f=Ke(o,2),g=f[0],d=f[1],m=Ke(u,2),_=m[0],w=m[1];return[g.concat(_),d.concat(w)]}),[[],[]]),a=Ke(r,2),l=a[0],c=a[1];return Wj(ab(l),ab(c))}var n8=["enhancers"],ub=function(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.enhancers,a=r===void 0?[]:r,l=Ke(Lj(e,br(n,n8)),2),c=l[0],o=l[1],u=[ib(c),ib(o)],f=(t=[u[0],u[1]],a.reduce((function(C,y){return y(C)}),t)),g=Ke(f,2),d=g[0],m=g[1],_=[d.map(rb),m.map(rb)],w=_[1];return{old:_[0].map((function(C){var y;return(y=C.children)!==null&&y!==void 0?y:[]})),new:w.map((function(C){var y;return(y=C.children)!==null&&y!==void 0?y:[]}))}};const i8=2e3,r8={highlight(e,t){return Ne.highlight(e,t).children}};function s8(e){return e.type==="normal"?e.newLineNumber:e.lineNumber}function a8(e){let t=0,n=0;for(const r of e.hunks)for(const a of r.changes)a.type==="insert"?t++:a.type==="delete"&&n++;return{additions:t,deletions:n}}function o8(e){return e.newPath==="/dev/null"?e.oldPath:(e.oldPath==="/dev/null",e.newPath)}function l8(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 c8(e){const t=[t8(e.hunks,{type:"line"})],n=Kx(o8(e));return n&&Ne.registered(n)?ub(e.hunks,{enhancers:t,highlight:!0,language:n,refractor:r8}):ub(e.hunks,{enhancers:t,highlight:!1})}const u8=({change:e,side:t})=>t==="old"?null:s8(e);function hb(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/1024).toFixed(1)} KB`}function h8({bytesRead:e,byteLimit:t}){return S.jsxs("div",{className:"truncated-notice",children:[S.jsx("h4",{children:"Diff too large to display"}),S.jsxs("p",{children:["This diff is larger than ",hb(t)," (",hb(e)," read). View it locally with git."]})]})}function f8({file:e,defaultExpanded:t}){const[n,r]=W.useState(t),{additions:a,deletions:l}=W.useMemo(()=>a8(e),[e]),c=n&&a+l<=i8,o=W.useMemo(()=>{if(c)try{return c8(e)}catch{return}},[e,c]);return S.jsxs("section",{className:"diff-file-card",children:[S.jsxs("button",{className:"diff-file-header",onClick:()=>r(u=>!u),children:[S.jsx("span",{className:"chev",children:n?S.jsx(Ou,{size:14}):S.jsx(fg,{size:14})}),S.jsx("span",{className:"path",children:S.jsx("code",{children:l8(e)})}),S.jsxs("span",{className:"stats",children:[S.jsxs("span",{className:"diff-stat-add",children:["+",a]}),S.jsxs("span",{className:"diff-stat-del",children:["−",l]})]})]}),n&&(e.hunks.length===0?S.jsx("div",{className:"diff-empty",children:"No textual diff for this file."}):S.jsx(wj,{className:"openresearch-diff-file",diffType:e.type,gutterType:"default",hunks:e.hunks,renderGutter:u8,tokens:o,viewType:"unified"}))]})}function Xw({diff:e,className:t}){const n=W.useMemo(()=>{if(!e.trim())return[];try{return eO(e,{nearbySequences:"zip"})}catch{return[]}},[e]);return n.length===0?S.jsx("div",{className:"diff-empty",children:"No changes."}):S.jsx("div",{className:t?`openresearch-diff ${t}`:"openresearch-diff",children:n.map((r,a)=>S.jsx(f8,{file:r,defaultExpanded:a===0},`${r.oldPath}→${r.newPath}#${a}`))})}var sp={exports:{}},fb;function d8(){return fb||(fb=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(a){this._terminal=a}dispose(){}fit(){const a=this.proposeDimensions();if(!a||!this._terminal||isNaN(a.cols)||isNaN(a.rows))return;const l=this._terminal._core;this._terminal.rows===a.rows&&this._terminal.cols===a.cols||(l._renderService.clear(),this._terminal.resize(a.cols,a.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const a=this._terminal._core,l=a._renderService.dimensions;if(l.css.cell.width===0||l.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:a.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),u=parseInt(o.getPropertyValue("height")),f=Math.max(0,parseInt(o.getPropertyValue("width"))),g=window.getComputedStyle(this._terminal.element),d=u-(parseInt(g.getPropertyValue("padding-top"))+parseInt(g.getPropertyValue("padding-bottom"))),m=f-(parseInt(g.getPropertyValue("padding-right"))+parseInt(g.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(m/l.css.cell.width)),rows:Math.max(1,Math.floor(d/l.css.cell.height))}}}})(),n})()))})(sp)),sp.exports}var p8=d8(),ap={exports:{}},db;function g8(){return db||(db=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(c,o,u){var f=this&&this.__decorate||function(x,v,k,D){var T,R=arguments.length,N=R<3?v:D===null?D=Object.getOwnPropertyDescriptor(v,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,v,k,D);else for(var L=x.length-1;L>=0;L--)(T=x[L])&&(N=(R<3?T(N):R>3?T(v,k,N):T(v,k))||N);return R>3&&N&&Object.defineProperty(v,k,N),N},g=this&&this.__param||function(x,v){return function(k,D){v(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=u(9042),m=u(9924),_=u(844),w=u(4725),C=u(2585),y=u(3656);let b=o.AccessibilityManager=class extends _.Disposable{constructor(x,v,k,D){super(),this._terminal=x,this._coreBrowserService=k,this._renderService=D,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 T=0;Tthis._handleBoundaryFocus(T,0),this._bottomBoundaryFocusListener=T=>this._handleBoundaryFocus(T,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 m.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((T=>this._handleResize(T.rows)))),this.register(this._terminal.onRender((T=>this._refreshRows(T.start,T.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((T=>this._handleChar(T)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` -`)))),this.register(this._terminal.onA11yTab((T=>this._handleTab(T)))),this.register(this._terminal.onKey((T=>this._handleKey(T.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,y.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,_.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let v=0;v0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===` -`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,v){this._liveRegionDebouncer.refresh(x,v,this._terminal.rows)}_renderRows(x,v){const k=this._terminal.buffer,D=k.lines.length.toString();for(let T=x;T<=v;T++){const R=k.lines.get(k.ydisp+T),N=[],L=(R==null?void 0:R.translateToString(!0,void 0,void 0,N))||"",I=(k.ydisp+T+1).toString(),F=this._rowElements[T];F&&(L.length===0?(F.innerText=" ",this._rowColumns.set(F,[0,1])):(F.textContent=L,this._rowColumns.set(F,N)),F.setAttribute("aria-posinset",I),F.setAttribute("aria-setsize",D))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,v){const k=x.target,D=this._rowElements[v===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(v===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==D)return;let T,R;if(v===0?(T=k,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(T=this._rowElements.shift(),R=k,this._rowContainer.removeChild(T)),T.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),v===0){const N=this._createAccessibilityTreeNode();this._rowElements.unshift(N),this._rowContainer.insertAdjacentElement("afterbegin",N)}else{const N=this._createAccessibilityTreeNode();this._rowElements.push(N),this._rowContainer.appendChild(N)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(v===0?-1:1),this._rowElements[v===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var L;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let v={node:x.anchorNode,offset:x.anchorOffset},k={node:x.focusNode,offset:x.focusOffset};if((v.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||v.node===k.node&&v.offset>k.offset)&&([v,k]=[k,v]),v.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(v={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(v.node))return;const D=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(D)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:D,offset:((L=D.textContent)==null?void 0:L.length)??0}),!this._rowContainer.contains(k.node))return;const T=({node:I,offset:F})=>{const V=I instanceof Text?I.parentNode:I;let H=parseInt(V==null?void 0:V.getAttribute("aria-posinset"),10)-1;if(isNaN(H))return console.warn("row is invalid. Race condition?"),null;const z=this._rowColumns.get(V);if(!z)return console.warn("columns is null. Race condition?"),null;let q=F=this._terminal.cols&&(++H,q=0),{row:H,column:q}},R=T(v),N=T(k);if(R&&N){if(R.row>N.row||R.row===N.row&&R.column>=N.column)throw new Error("invalid range");this._terminal.select(R.column,R.row,(N.row-R.row)*this._terminal.cols-R.column+N.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let v=this._rowContainer.children.length;vx;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_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 x=0;x{function u(m){return m.replace(/\r?\n/g,"\r")}function f(m,_){return _?"\x1B[200~"+m+"\x1B[201~":m}function g(m,_,w,C){m=f(m=u(m),w.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),w.triggerDataEvent(m,!0),_.value=""}function d(m,_,w){const C=w.getBoundingClientRect(),y=m.clientX-C.left-10,b=m.clientY-C.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${y}px`,_.style.top=`${b}px`,_.style.zIndex="1000",_.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=u,o.bracketTextForPaste=f,o.copyHandler=function(m,_){m.clipboardData&&m.clipboardData.setData("text/plain",_.selectionText),m.preventDefault()},o.handlePasteEvent=function(m,_,w,C){m.stopPropagation(),m.clipboardData&&g(m.clipboardData.getData("text/plain"),_,w,C)},o.paste=g,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(m,_,w,C,y){d(m,_,w),y&&C.rightClickSelect(m),_.value=C.selectionText,_.select()}},7239:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const f=u(1505);o.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(g,d,m){this._css.set(g,d,m)}getCss(g,d){return this._css.get(g,d)}setColor(g,d,m){this._color.set(g,d,m)}getColor(g,d){return this._color.get(g,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(u,f,g,d){u.addEventListener(f,g,d);let m=!1;return{dispose:()=>{m||(m=!0,u.removeEventListener(f,g,d))}}}},3551:function(c,o,u){var f=this&&this.__decorate||function(b,x,v,k){var D,T=arguments.length,R=T<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,v):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(b,x,v,k);else for(var N=b.length-1;N>=0;N--)(D=b[N])&&(R=(T<3?D(R):T>3?D(x,v,R):D(x,v))||R);return T>3&&R&&Object.defineProperty(x,v,R),R},g=this&&this.__param||function(b,x){return function(v,k){x(v,k,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=u(3656),m=u(8460),_=u(844),w=u(2585),C=u(4725);let y=o.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(b,x,v,k,D){super(),this._element=b,this._mouseService=x,this._renderService=v,this._bufferService=k,this._linkProviderService=D,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new m.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new m.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)((()=>{var T;this._lastMouseEvent=void 0,(T=this._activeProviderReplies)==null||T.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 x=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const v=b.composedPath();for(let k=0;k{T==null||T.forEach((R=>{R.link.dispose&&R.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let v=!1;for(const[T,R]of this._linkProviderService.linkProviders.entries())x?(D=this._activeProviderReplies)!=null&&D.get(T)&&(v=this._checkLinkProviderResult(T,b,v)):R.provideLinks(b.y,(N=>{var I,F;if(this._isMouseOut)return;const L=N==null?void 0:N.map((V=>({link:V})));(I=this._activeProviderReplies)==null||I.set(T,L),v=this._checkLinkProviderResult(T,b,v),((F=this._activeProviderReplies)==null?void 0:F.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,x){const v=new Set;for(let k=0;kb?this._bufferService.cols:R.link.range.end.x;for(let I=N;I<=L;I++){if(v.has(I)){D.splice(T--,1);break}v.add(I)}}}}_checkLinkProviderResult(b,x,v){var T;if(!this._activeProviderReplies)return v;const k=this._activeProviderReplies.get(b);let D=!1;for(let R=0;Rthis._linkAtPosition(N.link,x)));R&&(v=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!v)for(let R=0;Rthis._linkAtPosition(L.link,x)));if(N){v=!0,this._handleNewLink(N);break}}return v}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const x=this._positionFromMouseEvent(b,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,x){this._currentLink&&this._lastMouseEvent&&(!b||!x||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(b.link,x)&&(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 v,k;return(k=(v=this._currentLink)==null?void 0:v.state)==null?void 0:k.decorations.pointerCursor},set:v=>{var k;(k=this._currentLink)!=null&&k.state&&this._currentLink.state.decorations.pointerCursor!==v&&(this._currentLink.state.decorations.pointerCursor=v,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",v))}},underline:{get:()=>{var v,k;return(k=(v=this._currentLink)==null?void 0:v.state)==null?void 0:k.decorations.underline},set:v=>{var k,D,T;(k=this._currentLink)!=null&&k.state&&((T=(D=this._currentLink)==null?void 0:D.state)==null?void 0:T.decorations.underline)!==v&&(this._currentLink.state.decorations.underline=v,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,v))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((v=>{if(!this._currentLink)return;const k=v.start===0?0:v.start+1+this._bufferService.buffer.ydisp,D=this._bufferService.buffer.ydisp+1+v.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=D&&(this._clearCurrentLink(k,D),this._lastMouseEvent)){const T=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);T&&this._askForLink(T,!1)}}))))}_linkHover(b,x,v){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(v,x.text)}_fireUnderlineEvent(b,x){const v=b.range,k=this._bufferService.buffer.ydisp,D=this._createLinkUnderlineEvent(v.start.x-1,v.start.y-k-1,v.end.x,v.end.y-k-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(D)}_linkLeave(b,x,v){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(v,x.text)}_linkAtPosition(b,x){const v=b.range.start.y*this._bufferService.cols+b.range.start.x,k=b.range.end.y*this._bufferService.cols+b.range.end.x,D=x.y*this._bufferService.cols+x.x;return v<=D&&D<=k}_positionFromMouseEvent(b,x,v){const k=v.getCoords(b,x,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,x,v,k,D){return{x1:b,y1:x,x2:v,y2:k,cols:this._bufferService.cols,fg:D}}};o.Linkifier=y=f([g(1,C.IMouseService),g(2,C.IRenderService),g(3,w.IBufferService),g(4,C.ILinkProviderService)],y)},9042:(c,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(c,o,u){var f=this&&this.__decorate||function(C,y,b,x){var v,k=arguments.length,D=k<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,y,b,x);else for(var T=C.length-1;T>=0;T--)(v=C[T])&&(D=(k<3?v(D):k>3?v(y,b,D):v(y,b))||D);return k>3&&D&&Object.defineProperty(y,b,D),D},g=this&&this.__param||function(C,y){return function(b,x){y(b,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=u(511),m=u(2585);let _=o.OscLinkProvider=class{constructor(C,y,b){this._bufferService=C,this._optionsService=y,this._oscLinkService=b}provideLinks(C,y){var L;const b=this._bufferService.buffer.lines.get(C-1);if(!b)return void y(void 0);const x=[],v=this._optionsService.rawOptions.linkHandler,k=new d.CellData,D=b.getTrimmedLength();let T=-1,R=-1,N=!1;for(let I=0;Iv?v.activate(z,q,V):w(0,q),hover:(z,q)=>{var G;return(G=v==null?void 0:v.hover)==null?void 0:G.call(v,z,q,V)},leave:(z,q)=>{var G;return(G=v==null?void 0:v.leave)==null?void 0:G.call(v,z,q,V)}})}N=!1,k.hasExtendedAttrs()&&k.extended.urlId?(R=I,T=k.extended.urlId):(R=-1,T=-1)}}y(x)}};function w(C,y){if(confirm(`Do you want to navigate to ${y}? +`:"")+g.content]}),["",""]),n=Ze(t,2),r=Ze(Qw(n[0],n[1]),2),a=r[0],l=r[1];if(a.length===0&&l.length===0)return[[],[]];var c=function(f){if(f&&!ji(f))return f.lineNumber},o=c(e.find(Rn)),u=c(e.find(xr));if(o===void 0||u===void 0)throw new Error("Could not find start line number for edit");return[db(fb(a),o),db(fb(l),u)]}function g8(e){var t=e.reduce((function(r,a){var l=Ze(r,3),c=l[0],o=l[1],u=l[2];if(!u||!Rn(u)||!xr(a))return[c,o,a];var f=Ze(Qw(u.content,a.content),2),g=f[0],d=f[1];return[c.concat(eg(g,u.lineNumber)),o.concat(eg(d,a.lineNumber)),a]}),[[],[],null]),n=Ze(t,2);return[n[0],n[1]]}function m8(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).type,n=(t===void 0?"block":t)==="block"?p8:g8,r=bm(e.map((function(o){return o.changes})),Zw).map(n).reduce((function(o,u){var f=Ze(o,2),g=f[0],d=f[1],m=Ze(u,2),_=m[0],w=m[1];return[g.concat(_),d.concat(w)]}),[[],[]]),a=Ze(r,2),l=a[0],c=a[1];return c8(ub(l),ub(c))}var _8=["enhancers"],pb=function(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.enhancers,a=r===void 0?[]:r,l=Ze(Wj(e,br(n,_8)),2),c=l[0],o=l[1],u=[ob(c),ob(o)],f=(t=[u[0],u[1]],a.reduce((function(C,b){return b(C)}),t)),g=Ze(f,2),d=g[0],m=g[1],_=[d.map(lb),m.map(lb)],w=_[1];return{old:_[0].map((function(C){var b;return(b=C.children)!==null&&b!==void 0?b:[]})),new:w.map((function(C){var b;return(b=C.children)!==null&&b!==void 0?b:[]}))}};const v8=2e3,y8={highlight(e,t){return Ne.highlight(e,t).children}};function b8(e){return e.type==="normal"?e.newLineNumber:e.lineNumber}function S8(e){let t=0,n=0;for(const r of e.hunks)for(const a of r.changes)a.type==="insert"?t++:a.type==="delete"&&n++;return{additions:t,deletions:n}}function x8(e){return e.newPath==="/dev/null"?e.oldPath:(e.oldPath==="/dev/null",e.newPath)}function w8(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 C8(e){const t=[m8(e.hunks,{type:"line"})],n=tw(x8(e));return n&&Ne.registered(n)?pb(e.hunks,{enhancers:t,highlight:!0,language:n,refractor:y8}):pb(e.hunks,{enhancers:t,highlight:!1})}const E8=({change:e,side:t})=>t==="old"?null:b8(e);function gb(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/1024).toFixed(1)} KB`}function k8({bytesRead:e,byteLimit:t}){return v.jsxs("div",{className:"truncated-notice",children:[v.jsx("h4",{children:"Diff too large to display"}),v.jsxs("p",{children:["This diff is larger than ",gb(t)," (",gb(e)," read). View it locally with git."]})]})}function A8({file:e,defaultExpanded:t}){const[n,r]=Y.useState(t),{additions:a,deletions:l}=Y.useMemo(()=>S8(e),[e]),c=n&&a+l<=v8,o=Y.useMemo(()=>{if(c)try{return C8(e)}catch{return}},[e,c]);return v.jsxs("section",{className:"diff-file-card",children:[v.jsxs("button",{className:"diff-file-header",onClick:()=>r(u=>!u),children:[v.jsx("span",{className:"chev",children:n?v.jsx(Iu,{size:14}):v.jsx(_g,{size:14})}),v.jsx("span",{className:"path",children:v.jsx("code",{children:w8(e)})}),v.jsxs("span",{className:"stats",children:[v.jsxs("span",{className:"diff-stat-add",children:["+",a]}),v.jsxs("span",{className:"diff-stat-del",children:["−",l]})]})]}),n&&(e.hunks.length===0?v.jsx("div",{className:"diff-empty",children:"No textual diff for this file."}):v.jsx(zj,{className:"openresearch-diff-file",diffType:e.type,gutterType:"default",hunks:e.hunks,renderGutter:E8,tokens:o,viewType:"unified"}))]})}function Jw({diff:e,className:t}){const n=Y.useMemo(()=>{if(!e.trim())return[];try{return gO(e,{nearbySequences:"zip"})}catch{return[]}},[e]);return n.length===0?v.jsx("div",{className:"diff-empty",children:"No changes."}):v.jsx("div",{className:t?`openresearch-diff ${t}`:"openresearch-diff",children:n.map((r,a)=>v.jsx(A8,{file:r,defaultExpanded:a===0},`${r.oldPath}→${r.newPath}#${a}`))})}var cp={exports:{}},mb;function T8(){return mb||(mb=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(a){this._terminal=a}dispose(){}fit(){const a=this.proposeDimensions();if(!a||!this._terminal||isNaN(a.cols)||isNaN(a.rows))return;const l=this._terminal._core;this._terminal.rows===a.rows&&this._terminal.cols===a.cols||(l._renderService.clear(),this._terminal.resize(a.cols,a.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const a=this._terminal._core,l=a._renderService.dimensions;if(l.css.cell.width===0||l.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:a.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),u=parseInt(o.getPropertyValue("height")),f=Math.max(0,parseInt(o.getPropertyValue("width"))),g=window.getComputedStyle(this._terminal.element),d=u-(parseInt(g.getPropertyValue("padding-top"))+parseInt(g.getPropertyValue("padding-bottom"))),m=f-(parseInt(g.getPropertyValue("padding-right"))+parseInt(g.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(m/l.css.cell.width)),rows:Math.max(1,Math.floor(d/l.css.cell.height))}}}})(),n})()))})(cp)),cp.exports}var N8=T8(),up={exports:{}},_b;function D8(){return _b||(_b=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(c,o,u){var f=this&&this.__decorate||function(x,y,k,D){var T,R=arguments.length,N=R<3?y:D===null?D=Object.getOwnPropertyDescriptor(y,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,y,k,D);else for(var L=x.length-1;L>=0;L--)(T=x[L])&&(N=(R<3?T(N):R>3?T(y,k,N):T(y,k))||N);return R>3&&N&&Object.defineProperty(y,k,N),N},g=this&&this.__param||function(x,y){return function(k,D){y(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=u(9042),m=u(9924),_=u(844),w=u(4725),C=u(2585),b=u(3656);let S=o.AccessibilityManager=class extends _.Disposable{constructor(x,y,k,D){super(),this._terminal=x,this._coreBrowserService=k,this._renderService=D,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 T=0;Tthis._handleBoundaryFocus(T,0),this._bottomBoundaryFocusListener=T=>this._handleBoundaryFocus(T,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 m.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((T=>this._handleResize(T.rows)))),this.register(this._terminal.onRender((T=>this._refreshRows(T.start,T.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((T=>this._handleChar(T)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` +`)))),this.register(this._terminal.onA11yTab((T=>this._handleTab(T)))),this.register(this._terminal.onKey((T=>this._handleKey(T.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,b.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,_.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let y=0;y0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===` +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,y){this._liveRegionDebouncer.refresh(x,y,this._terminal.rows)}_renderRows(x,y){const k=this._terminal.buffer,D=k.lines.length.toString();for(let T=x;T<=y;T++){const R=k.lines.get(k.ydisp+T),N=[],L=(R==null?void 0:R.translateToString(!0,void 0,void 0,N))||"",I=(k.ydisp+T+1).toString(),F=this._rowElements[T];F&&(L.length===0?(F.innerText=" ",this._rowColumns.set(F,[0,1])):(F.textContent=L,this._rowColumns.set(F,N)),F.setAttribute("aria-posinset",I),F.setAttribute("aria-setsize",D))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,y){const k=x.target,D=this._rowElements[y===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(y===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==D)return;let T,R;if(y===0?(T=k,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(T=this._rowElements.shift(),R=k,this._rowContainer.removeChild(T)),T.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),y===0){const N=this._createAccessibilityTreeNode();this._rowElements.unshift(N),this._rowContainer.insertAdjacentElement("afterbegin",N)}else{const N=this._createAccessibilityTreeNode();this._rowElements.push(N),this._rowContainer.appendChild(N)}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(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var L;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let y={node:x.anchorNode,offset:x.anchorOffset},k={node:x.focusNode,offset:x.focusOffset};if((y.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||y.node===k.node&&y.offset>k.offset)&&([y,k]=[k,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 D=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(D)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:D,offset:((L=D.textContent)==null?void 0:L.length)??0}),!this._rowContainer.contains(k.node))return;const T=({node:I,offset:F})=>{const V=I instanceof Text?I.parentNode:I;let H=parseInt(V==null?void 0:V.getAttribute("aria-posinset"),10)-1;if(isNaN(H))return console.warn("row is invalid. Race condition?"),null;const z=this._rowColumns.get(V);if(!z)return console.warn("columns is null. Race condition?"),null;let q=F=this._terminal.cols&&(++H,q=0),{row:H,column:q}},R=T(y),N=T(k);if(R&&N){if(R.row>N.row||R.row===N.row&&R.column>=N.column)throw new Error("invalid range");this._terminal.select(R.column,R.row,(N.row-R.row)*this._terminal.cols-R.column+N.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let y=this._rowContainer.children.length;yx;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_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 x=0;x{function u(m){return m.replace(/\r?\n/g,"\r")}function f(m,_){return _?"\x1B[200~"+m+"\x1B[201~":m}function g(m,_,w,C){m=f(m=u(m),w.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),w.triggerDataEvent(m,!0),_.value=""}function d(m,_,w){const C=w.getBoundingClientRect(),b=m.clientX-C.left-10,S=m.clientY-C.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${b}px`,_.style.top=`${S}px`,_.style.zIndex="1000",_.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=u,o.bracketTextForPaste=f,o.copyHandler=function(m,_){m.clipboardData&&m.clipboardData.setData("text/plain",_.selectionText),m.preventDefault()},o.handlePasteEvent=function(m,_,w,C){m.stopPropagation(),m.clipboardData&&g(m.clipboardData.getData("text/plain"),_,w,C)},o.paste=g,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(m,_,w,C,b){d(m,_,w),b&&C.rightClickSelect(m),_.value=C.selectionText,_.select()}},7239:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const f=u(1505);o.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(g,d,m){this._css.set(g,d,m)}getCss(g,d){return this._css.get(g,d)}setColor(g,d,m){this._color.set(g,d,m)}getColor(g,d){return this._color.get(g,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(u,f,g,d){u.addEventListener(f,g,d);let m=!1;return{dispose:()=>{m||(m=!0,u.removeEventListener(f,g,d))}}}},3551:function(c,o,u){var f=this&&this.__decorate||function(S,x,y,k){var D,T=arguments.length,R=T<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(S,x,y,k);else for(var N=S.length-1;N>=0;N--)(D=S[N])&&(R=(T<3?D(R):T>3?D(x,y,R):D(x,y))||R);return T>3&&R&&Object.defineProperty(x,y,R),R},g=this&&this.__param||function(S,x){return function(y,k){x(y,k,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=u(3656),m=u(8460),_=u(844),w=u(2585),C=u(4725);let b=o.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(S,x,y,k,D){super(),this._element=S,this._mouseService=x,this._renderService=y,this._bufferService=k,this._linkProviderService=D,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new m.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new m.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)((()=>{var T;this._lastMouseEvent=void 0,(T=this._activeProviderReplies)==null||T.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(S){this._lastMouseEvent=S;const x=this._positionFromMouseEvent(S,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const y=S.composedPath();for(let k=0;k{T==null||T.forEach((R=>{R.link.dispose&&R.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=S.y);let y=!1;for(const[T,R]of this._linkProviderService.linkProviders.entries())x?(D=this._activeProviderReplies)!=null&&D.get(T)&&(y=this._checkLinkProviderResult(T,S,y)):R.provideLinks(S.y,(N=>{var I,F;if(this._isMouseOut)return;const L=N==null?void 0:N.map((V=>({link:V})));(I=this._activeProviderReplies)==null||I.set(T,L),y=this._checkLinkProviderResult(T,S,y),((F=this._activeProviderReplies)==null?void 0:F.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(S.y,this._activeProviderReplies)}))}_removeIntersectingLinks(S,x){const y=new Set;for(let k=0;kS?this._bufferService.cols:R.link.range.end.x;for(let I=N;I<=L;I++){if(y.has(I)){D.splice(T--,1);break}y.add(I)}}}}_checkLinkProviderResult(S,x,y){var T;if(!this._activeProviderReplies)return y;const k=this._activeProviderReplies.get(S);let D=!1;for(let R=0;Rthis._linkAtPosition(N.link,x)));R&&(y=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!y)for(let R=0;Rthis._linkAtPosition(L.link,x)));if(N){y=!0,this._handleNewLink(N);break}}return y}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(S){if(!this._currentLink)return;const x=this._positionFromMouseEvent(S,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(S,this._currentLink.link.text)}_clearCurrentLink(S,x){this._currentLink&&this._lastMouseEvent&&(!S||!x||this._currentLink.link.range.start.y>=S&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(S){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(S.link,x)&&(this._currentLink=S,this._currentLink.state={decorations:{underline:S.link.decorations===void 0||S.link.decorations.underline,pointerCursor:S.link.decorations===void 0||S.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,S.link,this._lastMouseEvent),S.link.decorations={},Object.defineProperties(S.link.decorations,{pointerCursor:{get:()=>{var y,k;return(k=(y=this._currentLink)==null?void 0:y.state)==null?void 0:k.decorations.pointerCursor},set:y=>{var k;(k=this._currentLink)!=null&&k.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,k;return(k=(y=this._currentLink)==null?void 0:y.state)==null?void 0:k.decorations.underline},set:y=>{var k,D,T;(k=this._currentLink)!=null&&k.state&&((T=(D=this._currentLink)==null?void 0:D.state)==null?void 0:T.decorations.underline)!==y&&(this._currentLink.state.decorations.underline=y,this._currentLink.state.isHovered&&this._fireUnderlineEvent(S.link,y))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((y=>{if(!this._currentLink)return;const k=y.start===0?0:y.start+1+this._bufferService.buffer.ydisp,D=this._bufferService.buffer.ydisp+1+y.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=D&&(this._clearCurrentLink(k,D),this._lastMouseEvent)){const T=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);T&&this._askForLink(T,!1)}}))))}_linkHover(S,x,y){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&S.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(y,x.text)}_fireUnderlineEvent(S,x){const y=S.range,k=this._bufferService.buffer.ydisp,D=this._createLinkUnderlineEvent(y.start.x-1,y.start.y-k-1,y.end.x,y.end.y-k-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(D)}_linkLeave(S,x,y){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&S.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(y,x.text)}_linkAtPosition(S,x){const y=S.range.start.y*this._bufferService.cols+S.range.start.x,k=S.range.end.y*this._bufferService.cols+S.range.end.x,D=x.y*this._bufferService.cols+x.x;return y<=D&&D<=k}_positionFromMouseEvent(S,x,y){const k=y.getCoords(S,x,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(S,x,y,k,D){return{x1:S,y1:x,x2:y,y2:k,cols:this._bufferService.cols,fg:D}}};o.Linkifier=b=f([g(1,C.IMouseService),g(2,C.IRenderService),g(3,w.IBufferService),g(4,C.ILinkProviderService)],b)},9042:(c,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(c,o,u){var f=this&&this.__decorate||function(C,b,S,x){var y,k=arguments.length,D=k<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,b,S,x);else for(var T=C.length-1;T>=0;T--)(y=C[T])&&(D=(k<3?y(D):k>3?y(b,S,D):y(b,S))||D);return k>3&&D&&Object.defineProperty(b,S,D),D},g=this&&this.__param||function(C,b){return function(S,x){b(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=u(511),m=u(2585);let _=o.OscLinkProvider=class{constructor(C,b,S){this._bufferService=C,this._optionsService=b,this._oscLinkService=S}provideLinks(C,b){var L;const S=this._bufferService.buffer.lines.get(C-1);if(!S)return void b(void 0);const x=[],y=this._optionsService.rawOptions.linkHandler,k=new d.CellData,D=S.getTrimmedLength();let T=-1,R=-1,N=!1;for(let I=0;Iy?y.activate(z,q,V):w(0,q),hover:(z,q)=>{var G;return(G=y==null?void 0:y.hover)==null?void 0:G.call(y,z,q,V)},leave:(z,q)=>{var G;return(G=y==null?void 0:y.leave)==null?void 0:G.call(y,z,q,V)}})}N=!1,k.hasExtendedAttrs()&&k.extended.urlId?(R=I,T=k.extended.urlId):(R=-1,T=-1)}}b(x)}};function w(C,b){if(confirm(`Do you want to navigate to ${b}? -WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=y}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=_=f([g(0,m.IBufferService),g(1,m.IOptionsService),g(2,m.IOscLinkService)],_)},6193:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(u,f){this._renderCallback=u,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(u){return this._refreshCallbacks.push(u),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(u,f,g){this._rowCount=g,u=u!==void 0?u:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,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 u=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},3236:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const f=u(3614),g=u(3656),d=u(3551),m=u(9042),_=u(3730),w=u(1680),C=u(3107),y=u(5744),b=u(2950),x=u(1296),v=u(428),k=u(4269),D=u(5114),T=u(8934),R=u(3230),N=u(9312),L=u(4725),I=u(6731),F=u(8055),V=u(8969),H=u(8460),z=u(844),q=u(6114),G=u(8437),X=u(2584),K=u(7399),O=u(5941),M=u(9074),j=u(2585),$=u(5435),U=u(4567),Q=u(779);class ie extends V.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(Z={}){super(Z),this.browser=q,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new z.MutableDisposable),this._onCursorMove=this.register(new H.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new H.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new H.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new H.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new H.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new H.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new H.EventEmitter),this._onBlur=this.register(new H.EventEmitter),this._onA11yCharEmitter=this.register(new H.EventEmitter),this._onA11yTabEmitter=this.register(new H.EventEmitter),this._onWillOpen=this.register(new H.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(M.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Q.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((P,ee)=>this.refresh(P,ee)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((P=>this._reportWindowsOptions(P)))),this.register(this._inputHandler.onColor((P=>this._handleColorEvent(P)))),this.register((0,H.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,H.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,H.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,H.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((P=>this._afterResize(P.cols,P.rows)))),this.register((0,z.toDisposable)((()=>{var P,ee;this._customKeyEventHandler=void 0,(ee=(P=this.element)==null?void 0:P.parentNode)==null||ee.removeChild(this.element)})))}_handleColorEvent(Z){if(this._themeService)for(const P of Z){let ee,te="";switch(P.index){case 256:ee="foreground",te="10";break;case 257:ee="background",te="11";break;case 258:ee="cursor",te="12";break;default:ee="ansi",te="4;"+P.index}switch(P.type){case 0:const pe=F.color.toColorRGB(ee==="ansi"?this._themeService.colors.ansi[P.index]:this._themeService.colors[ee]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${te};${(0,O.toRgbString)(pe)}${X.C1_ESCAPED.ST}`);break;case 1:if(ee==="ansi")this._themeService.modifyColors((ue=>ue.ansi[P.index]=F.channels.toColor(...P.color)));else{const ue=ee;this._themeService.modifyColors((me=>me[ue]=F.channels.toColor(...P.color)))}break;case 2:this._themeService.restoreColor(P.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Z){Z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Z;return(Z=this.textarea)==null?void 0:Z.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 Z=this.buffer.ybase+this.buffer.y,P=this.buffer.lines.get(Z);if(!P)return;const ee=Math.min(this.buffer.x,this.cols-1),te=this._renderService.dimensions.css.cell.height,pe=P.getWidth(ee),ue=this._renderService.dimensions.css.cell.width*pe,me=this.buffer.y*this._renderService.dimensions.css.cell.height,we=ee*this._renderService.dimensions.css.cell.width;this.textarea.style.left=we+"px",this.textarea.style.top=me+"px",this.textarea.style.width=ue+"px",this.textarea.style.height=te+"px",this.textarea.style.lineHeight=te+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",(P=>{this.hasSelection()&&(0,f.copyHandler)(P,this._selectionService)})));const Z=P=>(0,f.handlePasteEvent)(P,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",Z)),this.register((0,g.addDisposableDomListener)(this.element,"paste",Z)),q.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(P=>{P.button===2&&(0,f.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(P=>{(0,f.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),q.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(P=>{P.button===1&&(0,f.moveTextAreaUnderMouseCursor)(P,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(Z=>this._keyUp(Z)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(Z=>this._keyDown(Z)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(Z=>this._keyPress(Z)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(Z=>this._compositionHelper.compositionupdate(Z)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(Z=>this._inputEvent(Z)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Z){var ee;if(!Z)throw new Error("Terminal requires a parent element.");if(Z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ee=this.element)==null?void 0:ee.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Z.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"),Z.appendChild(this.element);const P=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),P.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,g.addDisposableDomListener)(this.screenElement,"mousemove",(te=>this.updateCursorStyle(te)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),P.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",m.promptLabel),q.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(D.CoreBrowserService,this.textarea,Z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(L.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(te=>this._handleTextAreaFocus(te)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(v.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(I.ThemeService),this._instantiationService.setService(L.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(L.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(R.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((te=>this._onRender.fire(te)))),this.onResize((te=>this._renderService.resize(te.cols,te.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(T.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.Linkifier,this.screenElement)),this.element.appendChild(P);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((te=>this.scrollLines(te.amount,te.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(N.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((te=>this.scrollLines(te.amount,te.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((te=>this._renderService.handleSelectionChanged(te.start,te.end,te.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((te=>{this.textarea.value=te,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((te=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(te=>this._selectionService.handleMouseDown(te)))),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(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(te=>this._handleScreenReaderModeOptionChange(te)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(te=>{!this._overviewRulerRenderer&&te&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(y.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(x.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Z=this,P=this.element;function ee(ue){const me=Z._mouseService.getMouseReportCoords(ue,Z.screenElement);if(!me)return!1;let we,le;switch(ue.overrideType||ue.type){case"mousemove":le=32,ue.buttons===void 0?(we=3,ue.button!==void 0&&(we=ue.button<3?ue.button:3)):we=1&ue.buttons?0:4&ue.buttons?1:2&ue.buttons?2:3;break;case"mouseup":le=0,we=ue.button<3?ue.button:3;break;case"mousedown":le=1,we=ue.button<3?ue.button:3;break;case"wheel":if(Z._customWheelEventHandler&&Z._customWheelEventHandler(ue)===!1||Z.viewport.getLinesScrolled(ue)===0)return!1;le=ue.deltaY<0?0:1,we=4;break;default:return!1}return!(le===void 0||we===void 0||we>4)&&Z.coreMouseService.triggerMouseEvent({col:me.col,row:me.row,x:me.x,y:me.y,button:we,action:le,ctrl:ue.ctrlKey,alt:ue.altKey,shift:ue.shiftKey})}const te={mouseup:null,wheel:null,mousedrag:null,mousemove:null},pe={mouseup:ue=>(ee(ue),ue.buttons||(this._document.removeEventListener("mouseup",te.mouseup),te.mousedrag&&this._document.removeEventListener("mousemove",te.mousedrag)),this.cancel(ue)),wheel:ue=>(ee(ue),this.cancel(ue,!0)),mousedrag:ue=>{ue.buttons&&ee(ue)},mousemove:ue=>{ue.buttons||ee(ue)}};this.register(this.coreMouseService.onProtocolChange((ue=>{ue?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ue)),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&ue?te.mousemove||(P.addEventListener("mousemove",pe.mousemove),te.mousemove=pe.mousemove):(P.removeEventListener("mousemove",te.mousemove),te.mousemove=null),16&ue?te.wheel||(P.addEventListener("wheel",pe.wheel,{passive:!1}),te.wheel=pe.wheel):(P.removeEventListener("wheel",te.wheel),te.wheel=null),2&ue?te.mouseup||(te.mouseup=pe.mouseup):(this._document.removeEventListener("mouseup",te.mouseup),te.mouseup=null),4&ue?te.mousedrag||(te.mousedrag=pe.mousedrag):(this._document.removeEventListener("mousemove",te.mousedrag),te.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(P,"mousedown",(ue=>{if(ue.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ue))return ee(ue),te.mouseup&&this._document.addEventListener("mouseup",te.mouseup),te.mousedrag&&this._document.addEventListener("mousemove",te.mousedrag),this.cancel(ue)}))),this.register((0,g.addDisposableDomListener)(P,"wheel",(ue=>{if(!te.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ue)===!1)return!1;if(!this.buffer.hasScrollback){const me=this.viewport.getLinesScrolled(ue);if(me===0)return;const we=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ue.deltaY<0?"A":"B");let le="";for(let ye=0;ye{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ue),this.cancel(ue)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(P,"touchmove",(ue=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ue)?void 0:this.cancel(ue)}),{passive:!1}))}refresh(Z,P){var ee;(ee=this._renderService)==null||ee.refreshRows(Z,P)}updateCursorStyle(Z){var P;(P=this._selectionService)!=null&&P.shouldColumnSelect(Z)?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(Z,P,ee=0){var te;ee===1?(super.scrollLines(Z,P,ee),this.refresh(0,this.rows-1)):(te=this.viewport)==null||te.scrollLines(Z)}paste(Z){(0,f.paste)(Z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Z){this._customKeyEventHandler=Z}attachCustomWheelEventHandler(Z){this._customWheelEventHandler=Z}registerLinkProvider(Z){return this._linkProviderService.registerLinkProvider(Z)}registerCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const P=this._characterJoinerService.register(Z);return this.refresh(0,this.rows-1),P}deregisterCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Z)}registerDecoration(Z){return this._decorationService.registerDecoration(Z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Z,P,ee){this._selectionService.setSelection(Z,P,ee)}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 Z;(Z=this._selectionService)==null||Z.clearSelection()}selectAll(){var Z;(Z=this._selectionService)==null||Z.selectAll()}selectLines(Z,P){var ee;(ee=this._selectionService)==null||ee.selectLines(Z,P)}_keyDown(Z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;const P=this.browser.isMac&&this.options.macOptionIsMeta&&Z.altKey;if(!P&&!this._compositionHelper.keydown(Z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;P||Z.key!=="Dead"&&Z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ee=(0,K.evaluateKeyboardEvent)(Z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Z),ee.type===3||ee.type===2){const te=this.rows-1;return this.scrollLines(ee.type===2?-te:te),this.cancel(Z,!0)}return ee.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Z)||(ee.cancel&&this.cancel(Z,!0),!ee.key||!!(Z.key&&!Z.ctrlKey&&!Z.altKey&&!Z.metaKey&&Z.key.length===1&&Z.key.charCodeAt(0)>=65&&Z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ee.key!==X.C0.ETX&&ee.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ee.key,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(ee.key,!0),!this.optionsService.rawOptions.screenReaderMode||Z.altKey||Z.ctrlKey?this.cancel(Z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Z,P){const ee=Z.isMac&&!this.options.macOptionIsMeta&&P.altKey&&!P.ctrlKey&&!P.metaKey||Z.isWindows&&P.altKey&&P.ctrlKey&&!P.metaKey||Z.isWindows&&P.getModifierState("AltGraph");return P.type==="keypress"?ee:ee&&(!P.keyCode||P.keyCode>47)}_keyUp(Z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1||((function(P){return P.keyCode===16||P.keyCode===17||P.keyCode===18})(Z)||this.focus(),this.updateCursorStyle(Z),this._keyPressHandled=!1)}_keyPress(Z){let P;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;if(this.cancel(Z),Z.charCode)P=Z.charCode;else if(Z.which===null||Z.which===void 0)P=Z.keyCode;else{if(Z.which===0||Z.charCode===0)return!1;P=Z.which}return!(!P||(Z.altKey||Z.ctrlKey||Z.metaKey)&&!this._isThirdLevelShift(this.browser,Z)||(P=String.fromCharCode(P),this._onKey.fire({key:P,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(P,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Z){if(Z.data&&Z.inputType==="insertText"&&(!Z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const P=Z.data;return this.coreService.triggerDataEvent(P,!0),this.cancel(Z),!0}return!1}resize(Z,P){Z!==this.cols||P!==this.rows?super.resize(Z,P):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Z,P){var ee,te;(ee=this._charSizeService)==null||ee.measure(),(te=this.viewport)==null||te.syncScrollArea(!0)}clear(){var Z;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 P=1;P{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(u,f=1e3){this._renderCallback=u,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,f,g){this._rowCount=g,u=u!==void 0?u:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const m=d-this._lastRefreshMs,_=this._debounceThresholdMS-m;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),_)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const u=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,f)}}},1680:function(c,o,u){var f=this&&this.__decorate||function(b,x,v,k){var D,T=arguments.length,R=T<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,v):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(b,x,v,k);else for(var N=b.length-1;N>=0;N--)(D=b[N])&&(R=(T<3?D(R):T>3?D(x,v,R):D(x,v))||R);return T>3&&R&&Object.defineProperty(x,v,R),R},g=this&&this.__param||function(b,x){return function(v,k){x(v,k,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const d=u(3656),m=u(4725),_=u(8460),w=u(844),C=u(2585);let y=o.Viewport=class extends w.Disposable{constructor(b,x,v,k,D,T,R,N){super(),this._viewportElement=b,this._scrollArea=x,this._bufferService=v,this._optionsService=k,this._charSizeService=D,this._renderService=T,this._coreBrowserService=R,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 _.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((L=>this._activeBuffer=L.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((L=>this._renderDimensions=L))),this._handleThemeChange(N.colors),this.register(N.onChangeColors((L=>this._handleThemeChange(L)))),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 x=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==x&&(this._lastRecordedBufferHeight=x,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 x=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:x,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,x){const v=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&v0&&(v=V),k=""}}return{bufferElements:D,cursorElement:v}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let x=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(x/=this._currentRowHeight+0,this._wheelPartialScroll+=x,x=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(b,x){const v=this._optionsService.rawOptions.fastScrollModifier;return v==="alt"&&x.altKey||v==="ctrl"&&x.ctrlKey||v==="shift"&&x.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 x=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(b,x))}};o.Viewport=y=f([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,m.ICharSizeService),g(5,m.IRenderService),g(6,m.ICoreBrowserService),g(7,m.IThemeService)],y)},3107:function(c,o,u){var f=this&&this.__decorate||function(C,y,b,x){var v,k=arguments.length,D=k<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,y,b,x);else for(var T=C.length-1;T>=0;T--)(v=C[T])&&(D=(k<3?v(D):k>3?v(y,b,D):v(y,b))||D);return k>3&&D&&Object.defineProperty(y,b,D),D},g=this&&this.__param||function(C,y){return function(b,x){y(b,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const d=u(4725),m=u(844),_=u(2585);let w=o.BufferDecorationRenderer=class extends m.Disposable{constructor(C,y,b,x,v){super(),this._screenElement=C,this._bufferService=y,this._coreBrowserService=b,this._decorationService=x,this._renderService=v,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((k=>this._removeDecoration(k)))),this.register((0,m.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 C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var x;const y=this._coreBrowserService.mainDocument.createElement("div");y.classList.add("xterm-decoration"),y.classList.toggle("xterm-decoration-top-layer",((x=C==null?void 0:C.options)==null?void 0:x.layer)==="top"),y.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,y.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",y.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",y.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=C.options.x??0;return b&&b>this._bufferService.cols&&(y.style.display="none"),this._refreshXPosition(C,y),y}_refreshStyle(C){const y=C.marker.line-this._bufferService.buffers.active.ydisp;if(y<0||y>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let b=this._decorationElements.get(C);b||(b=this._createElement(C),C.element=b,this._decorationElements.set(C,b),this._container.appendChild(b),C.onDispose((()=>{this._decorationElements.delete(C),b.remove()}))),b.style.top=y*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(b)}}_refreshXPosition(C,y=C.element){if(!y)return;const b=C.options.x??0;(C.options.anchor||"left")==="right"?y.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":y.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var y;(y=this._decorationElements.get(C))==null||y.remove(),this._decorationElements.delete(C),C.dispose()}};o.BufferDecorationRenderer=w=f([g(1,_.IBufferService),g(2,d.ICoreBrowserService),g(3,_.IDecorationService),g(4,d.IRenderService)],w)},5871:(c,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(u){if(u.options.overviewRulerOptions){for(const f of this._zones)if(f.color===u.options.overviewRulerOptions.color&&f.position===u.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,u.marker.line))return;if(this._lineAdjacentToZone(f,u.marker.line,u.options.overviewRulerOptions.position))return void this._addLineToZone(f,u.marker.line)}if(this._zonePoolIndex=u.startBufferLine&&f<=u.endBufferLine}_lineAdjacentToZone(u,f,g){return f>=u.startBufferLine-this._linePadding[g||"full"]&&f<=u.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(u,f){u.startBufferLine=Math.min(u.startBufferLine,f),u.endBufferLine=Math.max(u.endBufferLine,f)}}},5744:function(c,o,u){var f=this&&this.__decorate||function(v,k,D,T){var R,N=arguments.length,L=N<3?k:T===null?T=Object.getOwnPropertyDescriptor(k,D):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(v,k,D,T);else for(var I=v.length-1;I>=0;I--)(R=v[I])&&(L=(N<3?R(L):N>3?R(k,D,L):R(k,D))||L);return N>3&&L&&Object.defineProperty(k,D,L),L},g=this&&this.__param||function(v,k){return function(D,T){k(D,T,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const d=u(5871),m=u(4725),_=u(844),w=u(2585),C={full:0,left:0,center:0,right:0},y={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let x=o.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(v,k,D,T,R,N,L){var F;super(),this._viewportElement=v,this._screenElement=k,this._bufferService=D,this._decorationService=T,this._renderService=R,this._optionsService=N,this._coreBrowserService=L,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(),(F=this._viewportElement.parentElement)==null||F.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,_.toDisposable)((()=>{var V;(V=this._canvas)==null||V.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 v=Math.floor(this._canvas.width/3),k=Math.ceil(this._canvas.width/3);y.full=this._canvas.width,y.left=v,y.center=k,y.right=v,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=y.left,b.right=y.left+y.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const v=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(v,12),6)*this._coreBrowserService.dpr);C.left=k,C.center=k,C.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.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 k of this._decorationService.decorations)this._colorZoneStore.addDecoration(k);this._ctx.lineWidth=1;const v=this._colorZoneStore.zones;for(const k of v)k.position!=="full"&&this._renderColorZone(k);for(const k of v)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(v){this._ctx.fillStyle=v.color,this._ctx.fillRect(b[v.position||"full"],Math.round((this._canvas.height-1)*(v.startBufferLine/this._bufferService.buffers.active.lines.length)-C[v.position||"full"]/2),y[v.position||"full"],Math.round((this._canvas.height-1)*((v.endBufferLine-v.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[v.position||"full"]))}_queueRefresh(v,k){this._shouldUpdateDimensions=v||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=x=f([g(2,w.IBufferService),g(3,w.IDecorationService),g(4,m.IRenderService),g(5,w.IOptionsService),g(6,m.ICoreBrowserService)],x)},2950:function(c,o,u){var f=this&&this.__decorate||function(C,y,b,x){var v,k=arguments.length,D=k<3?y:x===null?x=Object.getOwnPropertyDescriptor(y,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,y,b,x);else for(var T=C.length-1;T>=0;T--)(v=C[T])&&(D=(k<3?v(D):k>3?v(y,b,D):v(y,b))||D);return k>3&&D&&Object.defineProperty(y,b,D),D},g=this&&this.__param||function(C,y){return function(b,x){y(b,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const d=u(4725),m=u(2585),_=u(2584);let w=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,y,b,x,v,k){this._textarea=C,this._compositionView=y,this._bufferService=b,this._optionsService=x,this._coreService=v,this._renderService=k,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(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const y={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,y.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(y.start,y.end):this._textarea.value.substring(y.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const y=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(y,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const y=this._textarea.value,b=y.replace(C,"");this._dataAlreadySent=b,y.length>C.length?this._coreService.triggerDataEvent(b,!0):y.lengththis.updateCompositionElements(!0)),0)}}};o.CompositionHelper=w=f([g(2,m.IBufferService),g(3,m.IOptionsService),g(4,m.ICoreService),g(5,d.IRenderService)],w)},9806:(c,o)=>{function u(f,g,d){const m=d.getBoundingClientRect(),_=f.getComputedStyle(d),w=parseInt(_.getPropertyValue("padding-left")),C=parseInt(_.getPropertyValue("padding-top"));return[g.clientX-m.left-w,g.clientY-m.top-C]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=u,o.getCoords=function(f,g,d,m,_,w,C,y,b){if(!w)return;const x=u(f,g,d);return x?(x[0]=Math.ceil((x[0]+(b?C/2:0))/C),x[1]=Math.ceil(x[1]/y),x[0]=Math.min(Math.max(x[0],1),m+(b?1:0)),x[1]=Math.min(Math.max(x[1],1),_),x):void 0}},9504:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const f=u(2584);function g(y,b,x,v){const k=y-d(y,x),D=b-d(b,x),T=Math.abs(k-D)-(function(R,N,L){let I=0;const F=R-d(R,L),V=N-d(N,L);for(let H=0;H=0&&yb?"A":"B"}function _(y,b,x,v,k,D){let T=y,R=b,N="";for(;T!==x||R!==v;)T+=k?1:-1,k&&T>D.cols-1?(N+=D.buffer.translateBufferLineToString(R,!1,y,T),T=0,y=0,R++):!k&&T<0&&(N+=D.buffer.translateBufferLineToString(R,!1,0,y+1),T=D.cols-1,y=T,R--);return N+D.buffer.translateBufferLineToString(R,!1,y,T)}function w(y,b){const x=b?"O":"[";return f.C0.ESC+x+y}function C(y,b){y=Math.floor(y);let x="";for(let v=0;v0?F-d(F,V):L;const q=F,G=(function(X,K,O,M,j,$){let U;return U=g(O,M,j,$).length>0?M-d(M,j):K,X=O&&Uy?"D":"C",C(Math.abs(k-y),w(T,v));T=D>b?"D":"C";const R=Math.abs(D-b);return C((function(N,L){return L.cols-N})(D>b?y:k,x)+(R-1)*x.cols+1+((D>b?k:y)-1),w(T,v))}},1296:function(c,o,u){var f=this&&this.__decorate||function(H,z,q,G){var X,K=arguments.length,O=K<3?z:G===null?G=Object.getOwnPropertyDescriptor(z,q):G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(H,z,q,G);else for(var M=H.length-1;M>=0;M--)(X=H[M])&&(O=(K<3?X(O):K>3?X(z,q,O):X(z,q))||O);return K>3&&O&&Object.defineProperty(z,q,O),O},g=this&&this.__param||function(H,z){return function(q,G){z(q,G,H)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const d=u(3787),m=u(2550),_=u(2223),w=u(6171),C=u(6052),y=u(4725),b=u(8055),x=u(8460),v=u(844),k=u(2585),D="xterm-dom-renderer-owner-",T="xterm-rows",R="xterm-fg-",N="xterm-bg-",L="xterm-focus",I="xterm-selection";let F=1,V=o.DomRenderer=class extends v.Disposable{constructor(H,z,q,G,X,K,O,M,j,$,U,Q,ie){super(),this._terminal=H,this._document=z,this._element=q,this._screenElement=G,this._viewportElement=X,this._helperContainer=K,this._linkifier2=O,this._charSizeService=j,this._optionsService=$,this._bufferService=U,this._coreBrowserService=Q,this._themeService=ie,this._terminalClass=F++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(T),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,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((se=>this._injectCss(se)))),this._injectCss(this._themeService.colors),this._rowFactory=M.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(D+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((se=>this._handleLinkHover(se)))),this.register(this._linkifier2.onHideLinkUnderline((se=>this._handleLinkLeave(se)))),this.register((0,v.toDisposable)((()=>{this._element.classList.remove(D+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new m.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 H=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*H,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*H),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/H),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/H),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 q of this._rowElements)q.style.width=`${this.dimensions.css.canvas.width}px`,q.style.height=`${this.dimensions.css.cell.height}px`,q.style.lineHeight=`${this.dimensions.css.cell.height}px`,q.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const z=`${this._terminalSelector} .${T} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=z,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(H){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let z=`${this._terminalSelector} .${T} { color: ${H.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;z+=`${this._terminalSelector} .${T} .xterm-dim { color: ${b.color.multiplyOpacity(H.foreground,.5).css};}`,z+=`${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 q=`blink_underline_${this._terminalClass}`,G=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;z+=`@keyframes ${q} { 50% { border-bottom-style: hidden; }}`,z+=`@keyframes ${G} { 50% { box-shadow: none; }}`,z+=`@keyframes ${X} { 0% { background-color: ${H.cursor.css}; color: ${H.cursorAccent.css}; } 50% { background-color: inherit; color: ${H.cursor.css}; }}`,z+=`${this._terminalSelector} .${T}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${T}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${T}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block { background-color: ${H.cursor.css}; color: ${H.cursorAccent.css};}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${H.cursor.css} !important; color: ${H.cursorAccent.css} !important;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${H.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${H.cursor.css} inset;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${H.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,z+=`${this._terminalSelector} .${I} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${I} div { position: absolute; background-color: ${H.selectionBackgroundOpaque.css};}${this._terminalSelector} .${I} div { position: absolute; background-color: ${H.selectionInactiveBackgroundOpaque.css};}`;for(const[K,O]of H.ansi.entries())z+=`${this._terminalSelector} .${R}${K} { color: ${O.css}; }${this._terminalSelector} .${R}${K}.xterm-dim { color: ${b.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${N}${K} { background-color: ${O.css}; }`;z+=`${this._terminalSelector} .${R}${_.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(H.background).css}; }${this._terminalSelector} .${R}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(H.background),.5).css}; }${this._terminalSelector} .${N}${_.INVERTED_DEFAULT_COLOR} { background-color: ${H.foreground.css}; }`,this._themeStyleElement.textContent=z}_setDefaultSpacing(){const H=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${H}px`,this._rowFactory.defaultSpacing=H}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(H,z){for(let q=this._rowElements.length;q<=z;q++){const G=this._document.createElement("div");this._rowContainer.appendChild(G),this._rowElements.push(G)}for(;this._rowElements.length>z;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(H,z){this._refreshRowElements(H,z),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(L),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(L),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(H,z,q){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(H,z,q),this.renderRows(0,this._bufferService.rows-1),!H||!z)return;this._selectionRenderModel.update(this._terminal,H,z,q);const G=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,K=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(K>=this._bufferService.rows||O<0)return;const M=this._document.createDocumentFragment();if(q){const j=H[0]>z[0];M.appendChild(this._createSelectionElement(K,j?z[0]:H[0],j?H[0]:z[0],O-K+1))}else{const j=G===K?H[0]:0,$=K===X?z[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(K,j,$));const U=O-K-1;if(M.appendChild(this._createSelectionElement(K+1,0,this._bufferService.cols,U)),K!==O){const Q=X===O?z[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(O,0,Q))}}this._selectionContainer.appendChild(M)}_createSelectionElement(H,z,q,G=1){const X=this._document.createElement("div"),K=z*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(q-z);return K+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-K),X.style.height=G*this.dimensions.css.cell.height+"px",X.style.top=H*this.dimensions.css.cell.height+"px",X.style.left=`${K}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 H of this._rowElements)H.replaceChildren()}renderRows(H,z){const q=this._bufferService.buffer,G=q.ybase+q.y,X=Math.min(q.x,this._bufferService.cols-1),K=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,M=this._optionsService.rawOptions.cursorInactiveStyle;for(let j=H;j<=z;j++){const $=j+q.ydisp,U=this._rowElements[j],Q=q.lines.get($);if(!U||!Q)break;U.replaceChildren(...this._rowFactory.createRow(Q,$,$===G,O,M,X,K,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${D}${this._terminalClass}`}_handleLinkHover(H){this._setCellUnderline(H.x1,H.x2,H.y1,H.y2,H.cols,!0)}_handleLinkLeave(H){this._setCellUnderline(H.x1,H.x2,H.y1,H.y2,H.cols,!1)}_setCellUnderline(H,z,q,G,X,K){q<0&&(H=0),G<0&&(z=0);const O=this._bufferService.rows-1;q=Math.max(Math.min(q,O),0),G=Math.max(Math.min(G,O),0),X=Math.min(X,this._bufferService.cols);const M=this._bufferService.buffer,j=M.ybase+M.y,$=Math.min(M.x,X-1),U=this._optionsService.rawOptions.cursorBlink,Q=this._optionsService.rawOptions.cursorStyle,ie=this._optionsService.rawOptions.cursorInactiveStyle;for(let se=q;se<=G;++se){const Z=se+M.ydisp,P=this._rowElements[se],ee=M.lines.get(Z);if(!P||!ee)break;P.replaceChildren(...this._rowFactory.createRow(ee,Z,Z===j,Q,ie,$,U,this.dimensions.css.cell.width,this._widthCache,K?se===q?H:0:-1,K?(se===G?z:X)-1:-1))}}};o.DomRenderer=V=f([g(7,k.IInstantiationService),g(8,y.ICharSizeService),g(9,k.IOptionsService),g(10,k.IBufferService),g(11,y.ICoreBrowserService),g(12,y.IThemeService)],V)},3787:function(c,o,u){var f=this&&this.__decorate||function(T,R,N,L){var I,F=arguments.length,V=F<3?R:L===null?L=Object.getOwnPropertyDescriptor(R,N):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(T,R,N,L);else for(var H=T.length-1;H>=0;H--)(I=T[H])&&(V=(F<3?I(V):F>3?I(R,N,V):I(R,N))||V);return F>3&&V&&Object.defineProperty(R,N,V),V},g=this&&this.__param||function(T,R){return function(N,L){R(N,L,T)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const d=u(2223),m=u(643),_=u(511),w=u(2585),C=u(8055),y=u(4725),b=u(4269),x=u(6171),v=u(3734);let k=o.DomRendererRowFactory=class{constructor(T,R,N,L,I,F,V){this._document=T,this._characterJoinerService=R,this._optionsService=N,this._coreBrowserService=L,this._coreService=I,this._decorationService=F,this._themeService=V,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(T,R,N){this._selectionStart=T,this._selectionEnd=R,this._columnSelectMode=N}createRow(T,R,N,L,I,F,V,H,z,q,G){const X=[],K=this._characterJoinerService.getJoinedCharacters(R),O=this._themeService.colors;let M,j=T.getNoBgTrimmedLength();N&&j0&&me===K[0][0]){le=!0;const Ue=K.shift();be=new b.JoinedCellData(this._workCell,T.translateToString(!0,Ue[0],Ue[1]),Ue[1]-Ue[0]),ye=Ue[1]-1,we=be.getWidth()}const Be=this._isCellInSelection(me,R),Ve=N&&me===F,Pe=ue&&me>=q&&me<=G;let lt=!1;this._decorationService.forEachDecorationAtCell(me,R,void 0,(Ue=>{lt=!0}));let Rt=be.getChars()||m.WHITESPACE_CELL_CHAR;if(Rt===" "&&(be.isUnderline()||be.isOverline())&&(Rt=" "),te=we*H-z.get(Rt,be.isBold(),be.isItalic()),M){if($&&(Be&&ee||!Be&&!ee&&be.bg===Q)&&(Be&&ee&&O.selectionForeground||be.fg===ie)&&be.extended.ext===se&&Pe===Z&&te===P&&!Ve&&!le&&!lt){be.isInvisible()?U+=m.WHITESPACE_CELL_CHAR:U+=Rt,$++;continue}$&&(M.textContent=U),M=this._document.createElement("span"),$=0,U=""}else M=this._document.createElement("span");if(Q=be.bg,ie=be.fg,se=be.extended.ext,Z=Pe,P=te,ee=Be,le&&F>=me&&F<=ye&&(F=me),!this._coreService.isCursorHidden&&Ve&&this._coreService.isCursorInitialized){if(pe.push("xterm-cursor"),this._coreBrowserService.isFocused)V&&pe.push("xterm-cursor-blink"),pe.push(L==="bar"?"xterm-cursor-bar":L==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(I)switch(I){case"outline":pe.push("xterm-cursor-outline");break;case"block":pe.push("xterm-cursor-block");break;case"bar":pe.push("xterm-cursor-bar");break;case"underline":pe.push("xterm-cursor-underline")}}if(be.isBold()&&pe.push("xterm-bold"),be.isItalic()&&pe.push("xterm-italic"),be.isDim()&&pe.push("xterm-dim"),U=be.isInvisible()?m.WHITESPACE_CELL_CHAR:be.getChars()||m.WHITESPACE_CELL_CHAR,be.isUnderline()&&(pe.push(`xterm-underline-${be.extended.underlineStyle}`),U===" "&&(U=" "),!be.isUnderlineColorDefault()))if(be.isUnderlineColorRGB())M.style.textDecorationColor=`rgb(${v.AttributeData.toColorRGB(be.getUnderlineColor()).join(",")})`;else{let Ue=be.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&be.isBold()&&Ue<8&&(Ue+=8),M.style.textDecorationColor=O.ansi[Ue].css}be.isOverline()&&(pe.push("xterm-overline"),U===" "&&(U=" ")),be.isStrikethrough()&&pe.push("xterm-strikethrough"),Pe&&(M.style.textDecoration="underline");let gt=be.getFgColor(),tt=be.getFgColorMode(),ct=be.getBgColor(),de=be.getBgColorMode();const Se=!!be.isInverse();if(Se){const Ue=gt;gt=ct,ct=Ue;const Tt=tt;tt=de,de=Tt}let Ee,Le,je,wt=!1;switch(this._decorationService.forEachDecorationAtCell(me,R,void 0,(Ue=>{Ue.options.layer!=="top"&&wt||(Ue.backgroundColorRGB&&(de=50331648,ct=Ue.backgroundColorRGB.rgba>>8&16777215,Ee=Ue.backgroundColorRGB),Ue.foregroundColorRGB&&(tt=50331648,gt=Ue.foregroundColorRGB.rgba>>8&16777215,Le=Ue.foregroundColorRGB),wt=Ue.options.layer==="top")})),!wt&&Be&&(Ee=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,ct=Ee.rgba>>8&16777215,de=50331648,wt=!0,O.selectionForeground&&(tt=50331648,gt=O.selectionForeground.rgba>>8&16777215,Le=O.selectionForeground)),wt&&pe.push("xterm-decoration-top"),de){case 16777216:case 33554432:je=O.ansi[ct],pe.push(`xterm-bg-${ct}`);break;case 50331648:je=C.channels.toColor(ct>>16,ct>>8&255,255&ct),this._addStyle(M,`background-color:#${D((ct>>>0).toString(16),"0",6)}`);break;default:Se?(je=O.foreground,pe.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):je=O.background}switch(Ee||be.isDim()&&(Ee=C.color.multiplyOpacity(je,.5)),tt){case 16777216:case 33554432:be.isBold()&><8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(gt+=8),this._applyMinimumContrast(M,je,O.ansi[gt],be,Ee,void 0)||pe.push(`xterm-fg-${gt}`);break;case 50331648:const Ue=C.channels.toColor(gt>>16&255,gt>>8&255,255>);this._applyMinimumContrast(M,je,Ue,be,Ee,Le)||this._addStyle(M,`color:#${D(gt.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(M,je,O.foreground,be,Ee,Le)||Se&&pe.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}pe.length&&(M.className=pe.join(" "),pe.length=0),Ve||le||lt?M.textContent=U:$++,te!==this.defaultSpacing&&(M.style.letterSpacing=`${te}px`),X.push(M),me=ye}return M&&$&&(M.textContent=U),X}_applyMinimumContrast(T,R,N,L,I,F){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const V=this._getContrastCache(L);let H;if(I||F||(H=V.getColor(R.rgba,N.rgba)),H===void 0){const z=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);H=C.color.ensureContrastRatio(I||R,F||N,z),V.setColor((I||R).rgba,(F||N).rgba,H??null)}return!!H&&(this._addStyle(T,`color:${H.css}`),!0)}_getContrastCache(T){return T.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(T,R){T.setAttribute("style",`${T.getAttribute("style")||""}${R};`)}_isCellInSelection(T,R){const N=this._selectionStart,L=this._selectionEnd;return!(!N||!L)&&(this._columnSelectMode?N[0]<=L[0]?T>=N[0]&&R>=N[1]&&T=N[1]&&T>=L[0]&&R<=L[1]:R>N[1]&&R=N[0]&&T=N[0])}};function D(T,R,N){for(;T.length{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(u,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=u.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 g=u.createElement("span");g.classList.add("xterm-char-measure-element");const d=u.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const m=u.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontStyle="italic";const _=u.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[g,d,m,_],this._container.appendChild(g),this._container.appendChild(d),this._container.appendChild(m),this._container.appendChild(_),f.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(u,f,g,d){u===this._font&&f===this._fontSize&&g===this._weight&&d===this._weightBold||(this._font=u,this._fontSize=f,this._weight=g,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(u,f,g){let d=0;if(!f&&!g&&u.length===1&&(d=u.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const w=this._measure(u,0);return w>0&&(this._flat[d]=w),w}let m=u;f&&(m+="B"),g&&(m+="I");let _=this._holey.get(m);if(_===void 0){let w=0;f&&(w|=1),g&&(w|=2),_=this._measure(u,w),_>0&&this._holey.set(m,_)}return _}_measure(u,f){const g=this._measureElements[f];return g.textContent=u.repeat(32),g.offsetWidth/32}}},2223:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const f=u(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(c,o)=>{function u(g){return 57508<=g&&g<=57558}function f(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=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(g){if(!g)throw new Error("value must not be falsy");return g},o.isPowerlineGlyph=u,o.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},o.isEmoji=f,o.allowRescaling=function(g,d,m,_){return d===1&&m>Math.ceil(1.5*_)&&g!==void 0&&g>255&&!f(g)&&!u(g)&&!(function(w){return 57344<=w&&w<=63743})(g)},o.treatGlyphAsBackgroundColor=function(g){return u(g)||(function(d){return 9472<=d&&d<=9631})(g)},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(g,d,m=0){return(g-(2*Math.round(d)-m))%(2*Math.round(d))}},6052:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class u{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(g,d,m,_=!1){if(this.selectionStart=d,this.selectionEnd=m,!d||!m||d[0]===m[0]&&d[1]===m[1])return void this.clear();const w=g.buffers.active.ydisp,C=d[1]-w,y=m[1]-w,b=Math.max(C,0),x=Math.min(y,g.rows-1);b>=g.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=C,this.viewportEndRow=y,this.viewportCappedStartRow=b,this.viewportCappedEndRow=x,this.startCol=d[0],this.endCol=m[0])}isCellSelected(g,d,m){return!!this.hasSelection&&(m-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&m>=this.viewportCappedStartRow&&d=this.viewportCappedStartRow&&d>=this.endCol&&m<=this.viewportCappedEndRow:m>this.viewportStartRow&&m=this.startCol&&d=this.startCol)}}o.createSelectionRenderModel=function(){return new u}},456:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.SelectionModel=class{constructor(u){this._bufferService=u,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 u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?u%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)-1]:[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[u,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[Math.max(u,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const u=this.selectionStart,f=this.selectionEnd;return!(!u||!f)&&(u[1]>f[1]||u[1]===f[1]&&u[0]>f[0])}handleTrim(u){return this.selectionStart&&(this.selectionStart[1]-=u),this.selectionEnd&&(this.selectionEnd[1]-=u),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(c,o,u){var f=this&&this.__decorate||function(x,v,k,D){var T,R=arguments.length,N=R<3?v:D===null?D=Object.getOwnPropertyDescriptor(v,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,v,k,D);else for(var L=x.length-1;L>=0;L--)(T=x[L])&&(N=(R<3?T(N):R>3?T(v,k,N):T(v,k))||N);return R>3&&N&&Object.defineProperty(v,k,N),N},g=this&&this.__param||function(x,v){return function(k,D){v(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const d=u(2585),m=u(8460),_=u(844);let w=o.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,v,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new m.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new y(x,v,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const x=this._measureStrategy.measure();x.width===this.width&&x.height===this.height||(this.width=x.width,this.height=x.height,this._onCharSizeChange.fire())}};o.CharSizeService=w=f([g(2,d.IOptionsService)],w);class C extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(v,k){v!==void 0&&v>0&&k!==void 0&&k>0&&(this._result.width=v,this._result.height=k)}}class y extends C{constructor(v,k,D){super(),this._document=v,this._parentElement=k,this._optionsService=D,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 C{constructor(v){super(),this._optionsService=v,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const k=this._ctx.measureText("W");if(!("width"in k&&"fontBoundingBoxAscent"in k&&"fontBoundingBoxDescent"in k))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const v=this._ctx.measureText("W");return this._validateAndSet(v.width,v.fontBoundingBoxAscent+v.fontBoundingBoxDescent),this._result}}},4269:function(c,o,u){var f=this&&this.__decorate||function(b,x,v,k){var D,T=arguments.length,R=T<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,v):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(b,x,v,k);else for(var N=b.length-1;N>=0;N--)(D=b[N])&&(R=(T<3?D(R):T>3?D(x,v,R):D(x,v))||R);return T>3&&R&&Object.defineProperty(x,v,R),R},g=this&&this.__param||function(b,x){return function(v,k){x(v,k,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const d=u(3734),m=u(643),_=u(511),w=u(2585);class C extends d.AttributeData{constructor(x,v,k){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=v,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(x){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=C;let y=o.CharacterJoinerService=class Kw{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(x){const v={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(v),v.id}deregister(x){for(let v=0;v1){const V=this._getJoinedRanges(D,N,R,v,T);for(let H=0;H1){const F=this._getJoinedRanges(D,N,R,v,T);for(let V=0;V{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const f=u(844),g=u(8460),d=u(3656);class m extends f.Disposable{constructor(C,y,b){super(),this._textarea=C,this._window=y,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,g.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(C){this._window!==C&&(this._window=C,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=m;class _ extends f.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,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 C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.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:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const f=u(844);class g extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(m){return this.linkProviders.push(m),{dispose:()=>{const _=this.linkProviders.indexOf(m);_!==-1&&this.linkProviders.splice(_,1)}}}}o.LinkProviderService=g},8934:function(c,o,u){var f=this&&this.__decorate||function(w,C,y,b){var x,v=arguments.length,k=v<3?C:b===null?b=Object.getOwnPropertyDescriptor(C,y):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(w,C,y,b);else for(var D=w.length-1;D>=0;D--)(x=w[D])&&(k=(v<3?x(k):v>3?x(C,y,k):x(C,y))||k);return v>3&&k&&Object.defineProperty(C,y,k),k},g=this&&this.__param||function(w,C){return function(y,b){C(y,b,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const d=u(4725),m=u(9806);let _=o.MouseService=class{constructor(w,C){this._renderService=w,this._charSizeService=C}getCoords(w,C,y,b,x){return(0,m.getCoords)(window,w,C,y,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(w,C){const y=(0,m.getCoordsRelativeToElement)(window,w,C);if(this._charSizeService.hasValidSize)return y[0]=Math.min(Math.max(y[0],0),this._renderService.dimensions.css.canvas.width-1),y[1]=Math.min(Math.max(y[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(y[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(y[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(y[0]),y:Math.floor(y[1])}}};o.MouseService=_=f([g(0,d.IRenderService),g(1,d.ICharSizeService)],_)},3230:function(c,o,u){var f=this&&this.__decorate||function(x,v,k,D){var T,R=arguments.length,N=R<3?v:D===null?D=Object.getOwnPropertyDescriptor(v,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,v,k,D);else for(var L=x.length-1;L>=0;L--)(T=x[L])&&(N=(R<3?T(N):R>3?T(v,k,N):T(v,k))||N);return R>3&&N&&Object.defineProperty(v,k,N),N},g=this&&this.__param||function(x,v){return function(k,D){v(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const d=u(6193),m=u(4725),_=u(8460),w=u(844),C=u(7226),y=u(2585);let b=o.RenderService=class extends w.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,v,k,D,T,R,N,L){super(),this._rowCount=x,this._charSizeService=D,this._renderer=this.register(new w.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new w.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 _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((I,F)=>this._renderRows(I,F)),N),this.register(this._renderDebouncer),this.register(N.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(R.onResize((()=>this._fullRefresh()))),this.register(R.buffers.onBufferActivate((()=>{var I;return(I=this._renderer.value)==null?void 0:I.clear()}))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(T.onDecorationRegistered((()=>this._fullRefresh()))),this.register(T.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(R.buffer.y,R.buffer.y,!0)))),this.register(L.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(N.window,v),this.register(N.onWindowChange((I=>this._registerIntersectionObserver(I,v))))}_registerIntersectionObserver(x,v){if("IntersectionObserver"in x){const k=new x.IntersectionObserver((D=>this._handleIntersectionChange(D[D.length-1])),{threshold:0});k.observe(v),this._observerDisposable.value=(0,w.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(x){this._isPaused=x.isIntersecting===void 0?x.intersectionRatio===0:!x.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(x,v,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,v,this._rowCount))}_renderRows(x,v){this._renderer.value&&(x=Math.min(x,this._rowCount-1),v=Math.min(v,this._rowCount-1),this._renderer.value.renderRows(x,v),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:x,end:v}),this._onRender.fire({start:x,end:v}),this._isNextRenderRedrawOnly=!0)}resize(x,v){this._rowCount=v,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(x){this._renderer.value=x,this._renderer.value&&(this._renderer.value.onRequestRedraw((v=>this.refreshRows(v.start,v.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(x){return this._renderDebouncer.addRefreshCallback(x)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var x,v;this._renderer.value&&((v=(x=this._renderer.value).clearTextureAtlas)==null||v.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,v){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var k;return(k=this._renderer.value)==null?void 0:k.handleResize(x,v)})):this._renderer.value.handleResize(x,v),this._fullRefresh())}handleCharSizeChanged(){var x;(x=this._renderer.value)==null||x.handleCharSizeChanged()}handleBlur(){var x;(x=this._renderer.value)==null||x.handleBlur()}handleFocus(){var x;(x=this._renderer.value)==null||x.handleFocus()}handleSelectionChanged(x,v,k){var D;this._selectionState.start=x,this._selectionState.end=v,this._selectionState.columnSelectMode=k,(D=this._renderer.value)==null||D.handleSelectionChanged(x,v,k)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};o.RenderService=b=f([g(2,y.IOptionsService),g(3,m.ICharSizeService),g(4,y.IDecorationService),g(5,y.IBufferService),g(6,m.ICoreBrowserService),g(7,m.IThemeService)],b)},9312:function(c,o,u){var f=this&&this.__decorate||function(N,L,I,F){var V,H=arguments.length,z=H<3?L:F===null?F=Object.getOwnPropertyDescriptor(L,I):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(N,L,I,F);else for(var q=N.length-1;q>=0;q--)(V=N[q])&&(z=(H<3?V(z):H>3?V(L,I,z):V(L,I))||z);return H>3&&z&&Object.defineProperty(L,I,z),z},g=this&&this.__param||function(N,L){return function(I,F){L(I,F,N)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const d=u(9806),m=u(9504),_=u(456),w=u(4725),C=u(8460),y=u(844),b=u(6114),x=u(4841),v=u(511),k=u(2585),D=" ",T=new RegExp(D,"g");let R=o.SelectionService=class extends y.Disposable{constructor(N,L,I,F,V,H,z,q,G){super(),this._element=N,this._screenElement=L,this._linkifier=I,this._bufferService=F,this._coreService=V,this._mouseService=H,this._optionsService=z,this._renderService=q,this._coreBrowserService=G,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new v.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.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 _.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,y.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 N=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!N||!L||N[0]===L[0]&&N[1]===L[1])}get selectionText(){const N=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;if(!N||!L)return"";const I=this._bufferService.buffer,F=[];if(this._activeSelectionMode===3){if(N[0]===L[0])return"";const V=N[0]V.replace(T," "))).join(b.isWindows?`\r +WARNING: This link could potentially be dangerous`)){const S=window.open();if(S){try{S.opener=null}catch{}S.location.href=b}else console.warn("Opening link blocked as opener could not be cleared")}}o.OscLinkProvider=_=f([g(0,m.IBufferService),g(1,m.IOptionsService),g(2,m.IOscLinkService)],_)},6193:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.RenderDebouncer=void 0,o.RenderDebouncer=class{constructor(u,f){this._renderCallback=u,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(u){return this._refreshCallbacks.push(u),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(u,f,g){this._rowCount=g,u=u!==void 0?u:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,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 u=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},3236:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Terminal=void 0;const f=u(3614),g=u(3656),d=u(3551),m=u(9042),_=u(3730),w=u(1680),C=u(3107),b=u(5744),S=u(2950),x=u(1296),y=u(428),k=u(4269),D=u(5114),T=u(8934),R=u(3230),N=u(9312),L=u(4725),I=u(6731),F=u(8055),V=u(8969),H=u(8460),z=u(844),q=u(6114),G=u(8437),X=u(2584),K=u(7399),O=u(5941),M=u(9074),j=u(2585),$=u(5435),U=u(4567),Q=u(779);class ie extends V.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(Z={}){super(Z),this.browser=q,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new z.MutableDisposable),this._onCursorMove=this.register(new H.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new H.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new H.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new H.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new H.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new H.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new H.EventEmitter),this._onBlur=this.register(new H.EventEmitter),this._onA11yCharEmitter=this.register(new H.EventEmitter),this._onA11yTabEmitter=this.register(new H.EventEmitter),this._onWillOpen=this.register(new H.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(M.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Q.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(_.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((P,ee)=>this.refresh(P,ee)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((P=>this._reportWindowsOptions(P)))),this.register(this._inputHandler.onColor((P=>this._handleColorEvent(P)))),this.register((0,H.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,H.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,H.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,H.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((P=>this._afterResize(P.cols,P.rows)))),this.register((0,z.toDisposable)((()=>{var P,ee;this._customKeyEventHandler=void 0,(ee=(P=this.element)==null?void 0:P.parentNode)==null||ee.removeChild(this.element)})))}_handleColorEvent(Z){if(this._themeService)for(const P of Z){let ee,te="";switch(P.index){case 256:ee="foreground",te="10";break;case 257:ee="background",te="11";break;case 258:ee="cursor",te="12";break;default:ee="ansi",te="4;"+P.index}switch(P.type){case 0:const pe=F.color.toColorRGB(ee==="ansi"?this._themeService.colors.ansi[P.index]:this._themeService.colors[ee]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${te};${(0,O.toRgbString)(pe)}${X.C1_ESCAPED.ST}`);break;case 1:if(ee==="ansi")this._themeService.modifyColors((ue=>ue.ansi[P.index]=F.channels.toColor(...P.color)));else{const ue=ee;this._themeService.modifyColors((me=>me[ue]=F.channels.toColor(...P.color)))}break;case 2:this._themeService.restoreColor(P.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Z){Z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(U.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(X.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Z;return(Z=this.textarea)==null?void 0:Z.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 Z=this.buffer.ybase+this.buffer.y,P=this.buffer.lines.get(Z);if(!P)return;const ee=Math.min(this.buffer.x,this.cols-1),te=this._renderService.dimensions.css.cell.height,pe=P.getWidth(ee),ue=this._renderService.dimensions.css.cell.width*pe,me=this.buffer.y*this._renderService.dimensions.css.cell.height,we=ee*this._renderService.dimensions.css.cell.width;this.textarea.style.left=we+"px",this.textarea.style.top=me+"px",this.textarea.style.width=ue+"px",this.textarea.style.height=te+"px",this.textarea.style.lineHeight=te+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",(P=>{this.hasSelection()&&(0,f.copyHandler)(P,this._selectionService)})));const Z=P=>(0,f.handlePasteEvent)(P,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",Z)),this.register((0,g.addDisposableDomListener)(this.element,"paste",Z)),q.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(P=>{P.button===2&&(0,f.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(P=>{(0,f.rightClickHandler)(P,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),q.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(P=>{P.button===1&&(0,f.moveTextAreaUnderMouseCursor)(P,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(Z=>this._keyUp(Z)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(Z=>this._keyDown(Z)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(Z=>this._keyPress(Z)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(Z=>this._compositionHelper.compositionupdate(Z)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(Z=>this._inputEvent(Z)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Z){var ee;if(!Z)throw new Error("Terminal requires a parent element.");if(Z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ee=this.element)==null?void 0:ee.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Z.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"),Z.appendChild(this.element);const P=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),P.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,g.addDisposableDomListener)(this.screenElement,"mousemove",(te=>this.updateCursorStyle(te)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),P.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",m.promptLabel),q.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(D.CoreBrowserService,this.textarea,Z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(L.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(te=>this._handleTextAreaFocus(te)))),this.register((0,g.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(L.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(I.ThemeService),this._instantiationService.setService(L.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(L.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(R.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((te=>this._onRender.fire(te)))),this.onResize((te=>this._renderService.resize(te.cols,te.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(S.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(T.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.Linkifier,this.screenElement)),this.element.appendChild(P);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(w.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((te=>this.scrollLines(te.amount,te.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(N.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((te=>this.scrollLines(te.amount,te.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((te=>this._renderService.handleSelectionChanged(te.start,te.end,te.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((te=>{this.textarea.value=te,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((te=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(C.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(te=>this._selectionService.handleMouseDown(te)))),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(U.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(te=>this._handleScreenReaderModeOptionChange(te)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(te=>{!this._overviewRulerRenderer&&te&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(x.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Z=this,P=this.element;function ee(ue){const me=Z._mouseService.getMouseReportCoords(ue,Z.screenElement);if(!me)return!1;let we,le;switch(ue.overrideType||ue.type){case"mousemove":le=32,ue.buttons===void 0?(we=3,ue.button!==void 0&&(we=ue.button<3?ue.button:3)):we=1&ue.buttons?0:4&ue.buttons?1:2&ue.buttons?2:3;break;case"mouseup":le=0,we=ue.button<3?ue.button:3;break;case"mousedown":le=1,we=ue.button<3?ue.button:3;break;case"wheel":if(Z._customWheelEventHandler&&Z._customWheelEventHandler(ue)===!1||Z.viewport.getLinesScrolled(ue)===0)return!1;le=ue.deltaY<0?0:1,we=4;break;default:return!1}return!(le===void 0||we===void 0||we>4)&&Z.coreMouseService.triggerMouseEvent({col:me.col,row:me.row,x:me.x,y:me.y,button:we,action:le,ctrl:ue.ctrlKey,alt:ue.altKey,shift:ue.shiftKey})}const te={mouseup:null,wheel:null,mousedrag:null,mousemove:null},pe={mouseup:ue=>(ee(ue),ue.buttons||(this._document.removeEventListener("mouseup",te.mouseup),te.mousedrag&&this._document.removeEventListener("mousemove",te.mousedrag)),this.cancel(ue)),wheel:ue=>(ee(ue),this.cancel(ue,!0)),mousedrag:ue=>{ue.buttons&&ee(ue)},mousemove:ue=>{ue.buttons||ee(ue)}};this.register(this.coreMouseService.onProtocolChange((ue=>{ue?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ue)),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&ue?te.mousemove||(P.addEventListener("mousemove",pe.mousemove),te.mousemove=pe.mousemove):(P.removeEventListener("mousemove",te.mousemove),te.mousemove=null),16&ue?te.wheel||(P.addEventListener("wheel",pe.wheel,{passive:!1}),te.wheel=pe.wheel):(P.removeEventListener("wheel",te.wheel),te.wheel=null),2&ue?te.mouseup||(te.mouseup=pe.mouseup):(this._document.removeEventListener("mouseup",te.mouseup),te.mouseup=null),4&ue?te.mousedrag||(te.mousedrag=pe.mousedrag):(this._document.removeEventListener("mousemove",te.mousedrag),te.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(P,"mousedown",(ue=>{if(ue.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ue))return ee(ue),te.mouseup&&this._document.addEventListener("mouseup",te.mouseup),te.mousedrag&&this._document.addEventListener("mousemove",te.mousedrag),this.cancel(ue)}))),this.register((0,g.addDisposableDomListener)(P,"wheel",(ue=>{if(!te.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ue)===!1)return!1;if(!this.buffer.hasScrollback){const me=this.viewport.getLinesScrolled(ue);if(me===0)return;const we=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ue.deltaY<0?"A":"B");let le="";for(let ye=0;ye{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ue),this.cancel(ue)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(P,"touchmove",(ue=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ue)?void 0:this.cancel(ue)}),{passive:!1}))}refresh(Z,P){var ee;(ee=this._renderService)==null||ee.refreshRows(Z,P)}updateCursorStyle(Z){var P;(P=this._selectionService)!=null&&P.shouldColumnSelect(Z)?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(Z,P,ee=0){var te;ee===1?(super.scrollLines(Z,P,ee),this.refresh(0,this.rows-1)):(te=this.viewport)==null||te.scrollLines(Z)}paste(Z){(0,f.paste)(Z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Z){this._customKeyEventHandler=Z}attachCustomWheelEventHandler(Z){this._customWheelEventHandler=Z}registerLinkProvider(Z){return this._linkProviderService.registerLinkProvider(Z)}registerCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const P=this._characterJoinerService.register(Z);return this.refresh(0,this.rows-1),P}deregisterCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Z)}registerDecoration(Z){return this._decorationService.registerDecoration(Z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Z,P,ee){this._selectionService.setSelection(Z,P,ee)}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 Z;(Z=this._selectionService)==null||Z.clearSelection()}selectAll(){var Z;(Z=this._selectionService)==null||Z.selectAll()}selectLines(Z,P){var ee;(ee=this._selectionService)==null||ee.selectLines(Z,P)}_keyDown(Z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;const P=this.browser.isMac&&this.options.macOptionIsMeta&&Z.altKey;if(!P&&!this._compositionHelper.keydown(Z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;P||Z.key!=="Dead"&&Z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ee=(0,K.evaluateKeyboardEvent)(Z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Z),ee.type===3||ee.type===2){const te=this.rows-1;return this.scrollLines(ee.type===2?-te:te),this.cancel(Z,!0)}return ee.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Z)||(ee.cancel&&this.cancel(Z,!0),!ee.key||!!(Z.key&&!Z.ctrlKey&&!Z.altKey&&!Z.metaKey&&Z.key.length===1&&Z.key.charCodeAt(0)>=65&&Z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ee.key!==X.C0.ETX&&ee.key!==X.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ee.key,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(ee.key,!0),!this.optionsService.rawOptions.screenReaderMode||Z.altKey||Z.ctrlKey?this.cancel(Z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Z,P){const ee=Z.isMac&&!this.options.macOptionIsMeta&&P.altKey&&!P.ctrlKey&&!P.metaKey||Z.isWindows&&P.altKey&&P.ctrlKey&&!P.metaKey||Z.isWindows&&P.getModifierState("AltGraph");return P.type==="keypress"?ee:ee&&(!P.keyCode||P.keyCode>47)}_keyUp(Z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1||((function(P){return P.keyCode===16||P.keyCode===17||P.keyCode===18})(Z)||this.focus(),this.updateCursorStyle(Z),this._keyPressHandled=!1)}_keyPress(Z){let P;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;if(this.cancel(Z),Z.charCode)P=Z.charCode;else if(Z.which===null||Z.which===void 0)P=Z.keyCode;else{if(Z.which===0||Z.charCode===0)return!1;P=Z.which}return!(!P||(Z.altKey||Z.ctrlKey||Z.metaKey)&&!this._isThirdLevelShift(this.browser,Z)||(P=String.fromCharCode(P),this._onKey.fire({key:P,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(P,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Z){if(Z.data&&Z.inputType==="insertText"&&(!Z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const P=Z.data;return this.coreService.triggerDataEvent(P,!0),this.cancel(Z),!0}return!1}resize(Z,P){Z!==this.cols||P!==this.rows?super.resize(Z,P):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Z,P){var ee,te;(ee=this._charSizeService)==null||ee.measure(),(te=this.viewport)==null||te.syncScrollArea(!0)}clear(){var Z;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 P=1;P{Object.defineProperty(o,"__esModule",{value:!0}),o.TimeBasedDebouncer=void 0,o.TimeBasedDebouncer=class{constructor(u,f=1e3){this._renderCallback=u,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,f,g){this._rowCount=g,u=u!==void 0?u:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const m=d-this._lastRefreshMs,_=this._debounceThresholdMS-m;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),_)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const u=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,f)}}},1680:function(c,o,u){var f=this&&this.__decorate||function(S,x,y,k){var D,T=arguments.length,R=T<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(S,x,y,k);else for(var N=S.length-1;N>=0;N--)(D=S[N])&&(R=(T<3?D(R):T>3?D(x,y,R):D(x,y))||R);return T>3&&R&&Object.defineProperty(x,y,R),R},g=this&&this.__param||function(S,x){return function(y,k){x(y,k,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Viewport=void 0;const d=u(3656),m=u(4725),_=u(8460),w=u(844),C=u(2585);let b=o.Viewport=class extends w.Disposable{constructor(S,x,y,k,D,T,R,N){super(),this._viewportElement=S,this._scrollArea=x,this._bufferService=y,this._optionsService=k,this._charSizeService=D,this._renderService=T,this._coreBrowserService=R,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 _.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((L=>this._activeBuffer=L.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((L=>this._renderDimensions=L))),this._handleThemeChange(N.colors),this.register(N.onChangeColors((L=>this._handleThemeChange(L)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(S){this._viewportElement.style.backgroundColor=S.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(S){if(S)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 x=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==x&&(this._lastRecordedBufferHeight=x,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const S=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==S&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=S),this._refreshAnimationFrame=null}syncScrollArea(S=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(S);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(S)}_handleScroll(S){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 x=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const S=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(S*(this._smoothScrollState.target-this._smoothScrollState.origin)),S<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(S,x){const y=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&y0&&(y=V),k=""}}return{bufferElements:D,cursorElement:y}}getLinesScrolled(S){if(S.deltaY===0||S.shiftKey)return 0;let x=this._applyScrollModifier(S.deltaY,S);return S.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(x/=this._currentRowHeight+0,this._wheelPartialScroll+=x,x=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):S.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(S,x){const y=this._optionsService.rawOptions.fastScrollModifier;return y==="alt"&&x.altKey||y==="ctrl"&&x.ctrlKey||y==="shift"&&x.shiftKey?S*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:S*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(S){this._lastTouchY=S.touches[0].pageY}handleTouchMove(S){const x=this._lastTouchY-S.touches[0].pageY;return this._lastTouchY=S.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(S,x))}};o.Viewport=b=f([g(2,C.IBufferService),g(3,C.IOptionsService),g(4,m.ICharSizeService),g(5,m.IRenderService),g(6,m.ICoreBrowserService),g(7,m.IThemeService)],b)},3107:function(c,o,u){var f=this&&this.__decorate||function(C,b,S,x){var y,k=arguments.length,D=k<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,b,S,x);else for(var T=C.length-1;T>=0;T--)(y=C[T])&&(D=(k<3?y(D):k>3?y(b,S,D):y(b,S))||D);return k>3&&D&&Object.defineProperty(b,S,D),D},g=this&&this.__param||function(C,b){return function(S,x){b(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferDecorationRenderer=void 0;const d=u(4725),m=u(844),_=u(2585);let w=o.BufferDecorationRenderer=class extends m.Disposable{constructor(C,b,S,x,y){super(),this._screenElement=C,this._bufferService=b,this._coreBrowserService=S,this._decorationService=x,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((k=>this._removeDecoration(k)))),this.register((0,m.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 C of this._decorationService.decorations)this._renderDecoration(C);this._dimensionsChanged=!1}_renderDecoration(C){this._refreshStyle(C),this._dimensionsChanged&&this._refreshXPosition(C)}_createElement(C){var x;const b=this._coreBrowserService.mainDocument.createElement("div");b.classList.add("xterm-decoration"),b.classList.toggle("xterm-decoration-top-layer",((x=C==null?void 0:C.options)==null?void 0:x.layer)==="top"),b.style.width=`${Math.round((C.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,b.style.height=(C.options.height||1)*this._renderService.dimensions.css.cell.height+"px",b.style.top=(C.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",b.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const S=C.options.x??0;return S&&S>this._bufferService.cols&&(b.style.display="none"),this._refreshXPosition(C,b),b}_refreshStyle(C){const b=C.marker.line-this._bufferService.buffers.active.ydisp;if(b<0||b>=this._bufferService.rows)C.element&&(C.element.style.display="none",C.onRenderEmitter.fire(C.element));else{let S=this._decorationElements.get(C);S||(S=this._createElement(C),C.element=S,this._decorationElements.set(C,S),this._container.appendChild(S),C.onDispose((()=>{this._decorationElements.delete(C),S.remove()}))),S.style.top=b*this._renderService.dimensions.css.cell.height+"px",S.style.display=this._altBufferIsActive?"none":"block",C.onRenderEmitter.fire(S)}}_refreshXPosition(C,b=C.element){if(!b)return;const S=C.options.x??0;(C.options.anchor||"left")==="right"?b.style.right=S?S*this._renderService.dimensions.css.cell.width+"px":"":b.style.left=S?S*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(C){var b;(b=this._decorationElements.get(C))==null||b.remove(),this._decorationElements.delete(C),C.dispose()}};o.BufferDecorationRenderer=w=f([g(1,_.IBufferService),g(2,d.ICoreBrowserService),g(3,_.IDecorationService),g(4,d.IRenderService)],w)},5871:(c,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(u){if(u.options.overviewRulerOptions){for(const f of this._zones)if(f.color===u.options.overviewRulerOptions.color&&f.position===u.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,u.marker.line))return;if(this._lineAdjacentToZone(f,u.marker.line,u.options.overviewRulerOptions.position))return void this._addLineToZone(f,u.marker.line)}if(this._zonePoolIndex=u.startBufferLine&&f<=u.endBufferLine}_lineAdjacentToZone(u,f,g){return f>=u.startBufferLine-this._linePadding[g||"full"]&&f<=u.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(u,f){u.startBufferLine=Math.min(u.startBufferLine,f),u.endBufferLine=Math.max(u.endBufferLine,f)}}},5744:function(c,o,u){var f=this&&this.__decorate||function(y,k,D,T){var R,N=arguments.length,L=N<3?k:T===null?T=Object.getOwnPropertyDescriptor(k,D):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(y,k,D,T);else for(var I=y.length-1;I>=0;I--)(R=y[I])&&(L=(N<3?R(L):N>3?R(k,D,L):R(k,D))||L);return N>3&&L&&Object.defineProperty(k,D,L),L},g=this&&this.__param||function(y,k){return function(D,T){k(D,T,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OverviewRulerRenderer=void 0;const d=u(5871),m=u(4725),_=u(844),w=u(2585),C={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0},S={full:0,left:0,center:0,right:0};let x=o.OverviewRulerRenderer=class extends _.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(y,k,D,T,R,N,L){var F;super(),this._viewportElement=y,this._screenElement=k,this._bufferService=D,this._decorationService=T,this._renderService=R,this._optionsService=N,this._coreBrowserService=L,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(),(F=this._viewportElement.parentElement)==null||F.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,_.toDisposable)((()=>{var V;(V=this._canvas)==null||V.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),k=Math.ceil(this._canvas.width/3);b.full=this._canvas.width,b.left=y,b.center=k,b.right=y,this._refreshDrawHeightConstants(),S.full=0,S.left=0,S.center=b.left,S.right=b.left+b.center}_refreshDrawHeightConstants(){C.full=Math.round(2*this._coreBrowserService.dpr);const y=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(y,12),6)*this._coreBrowserService.dpr);C.left=k,C.center=k,C.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*C.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 k of this._decorationService.decorations)this._colorZoneStore.addDecoration(k);this._ctx.lineWidth=1;const y=this._colorZoneStore.zones;for(const k of y)k.position!=="full"&&this._renderColorZone(k);for(const k of y)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(y){this._ctx.fillStyle=y.color,this._ctx.fillRect(S[y.position||"full"],Math.round((this._canvas.height-1)*(y.startBufferLine/this._bufferService.buffers.active.lines.length)-C[y.position||"full"]/2),b[y.position||"full"],Math.round((this._canvas.height-1)*((y.endBufferLine-y.startBufferLine)/this._bufferService.buffers.active.lines.length)+C[y.position||"full"]))}_queueRefresh(y,k){this._shouldUpdateDimensions=y||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};o.OverviewRulerRenderer=x=f([g(2,w.IBufferService),g(3,w.IDecorationService),g(4,m.IRenderService),g(5,w.IOptionsService),g(6,m.ICoreBrowserService)],x)},2950:function(c,o,u){var f=this&&this.__decorate||function(C,b,S,x){var y,k=arguments.length,D=k<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,S):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,b,S,x);else for(var T=C.length-1;T>=0;T--)(y=C[T])&&(D=(k<3?y(D):k>3?y(b,S,D):y(b,S))||D);return k>3&&D&&Object.defineProperty(b,S,D),D},g=this&&this.__param||function(C,b){return function(S,x){b(S,x,C)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CompositionHelper=void 0;const d=u(4725),m=u(2585),_=u(2584);let w=o.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(C,b,S,x,y,k){this._textarea=C,this._compositionView=b,this._bufferService=S,this._optionsService=x,this._coreService=y,this._renderService=k,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(C){this._compositionView.textContent=C.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(C){if(this._isComposing||this._isSendingComposition){if(C.keyCode===229||C.keyCode===16||C.keyCode===17||C.keyCode===18)return!1;this._finalizeComposition(!1)}return C.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(C){if(this._compositionView.classList.remove("active"),this._isComposing=!1,C){const b={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let S;this._isSendingComposition=!1,b.start+=this._dataAlreadySent.length,S=this._isComposing?this._textarea.value.substring(b.start,b.end):this._textarea.value.substring(b.start),S.length>0&&this._coreService.triggerDataEvent(S,!0)}}),0)}else{this._isSendingComposition=!1;const b=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(b,!0)}}_handleAnyTextareaChanges(){const C=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const b=this._textarea.value,S=b.replace(C,"");this._dataAlreadySent=S,b.length>C.length?this._coreService.triggerDataEvent(S,!0):b.lengththis.updateCompositionElements(!0)),0)}}};o.CompositionHelper=w=f([g(2,m.IBufferService),g(3,m.IOptionsService),g(4,m.ICoreService),g(5,d.IRenderService)],w)},9806:(c,o)=>{function u(f,g,d){const m=d.getBoundingClientRect(),_=f.getComputedStyle(d),w=parseInt(_.getPropertyValue("padding-left")),C=parseInt(_.getPropertyValue("padding-top"));return[g.clientX-m.left-w,g.clientY-m.top-C]}Object.defineProperty(o,"__esModule",{value:!0}),o.getCoords=o.getCoordsRelativeToElement=void 0,o.getCoordsRelativeToElement=u,o.getCoords=function(f,g,d,m,_,w,C,b,S){if(!w)return;const x=u(f,g,d);return x?(x[0]=Math.ceil((x[0]+(S?C/2:0))/C),x[1]=Math.ceil(x[1]/b),x[0]=Math.min(Math.max(x[0],1),m+(S?1:0)),x[1]=Math.min(Math.max(x[1],1),_),x):void 0}},9504:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.moveToCellSequence=void 0;const f=u(2584);function g(b,S,x,y){const k=b-d(b,x),D=S-d(S,x),T=Math.abs(k-D)-(function(R,N,L){let I=0;const F=R-d(R,L),V=N-d(N,L);for(let H=0;H=0&&bS?"A":"B"}function _(b,S,x,y,k,D){let T=b,R=S,N="";for(;T!==x||R!==y;)T+=k?1:-1,k&&T>D.cols-1?(N+=D.buffer.translateBufferLineToString(R,!1,b,T),T=0,b=0,R++):!k&&T<0&&(N+=D.buffer.translateBufferLineToString(R,!1,0,b+1),T=D.cols-1,b=T,R--);return N+D.buffer.translateBufferLineToString(R,!1,b,T)}function w(b,S){const x=S?"O":"[";return f.C0.ESC+x+b}function C(b,S){b=Math.floor(b);let x="";for(let y=0;y0?F-d(F,V):L;const q=F,G=(function(X,K,O,M,j,$){let U;return U=g(O,M,j,$).length>0?M-d(M,j):K,X=O&&Ub?"D":"C",C(Math.abs(k-b),w(T,y));T=D>S?"D":"C";const R=Math.abs(D-S);return C((function(N,L){return L.cols-N})(D>S?b:k,x)+(R-1)*x.cols+1+((D>S?k:b)-1),w(T,y))}},1296:function(c,o,u){var f=this&&this.__decorate||function(H,z,q,G){var X,K=arguments.length,O=K<3?z:G===null?G=Object.getOwnPropertyDescriptor(z,q):G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(H,z,q,G);else for(var M=H.length-1;M>=0;M--)(X=H[M])&&(O=(K<3?X(O):K>3?X(z,q,O):X(z,q))||O);return K>3&&O&&Object.defineProperty(z,q,O),O},g=this&&this.__param||function(H,z){return function(q,G){z(q,G,H)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRenderer=void 0;const d=u(3787),m=u(2550),_=u(2223),w=u(6171),C=u(6052),b=u(4725),S=u(8055),x=u(8460),y=u(844),k=u(2585),D="xterm-dom-renderer-owner-",T="xterm-rows",R="xterm-fg-",N="xterm-bg-",L="xterm-focus",I="xterm-selection";let F=1,V=o.DomRenderer=class extends y.Disposable{constructor(H,z,q,G,X,K,O,M,j,$,U,Q,ie){super(),this._terminal=H,this._document=z,this._element=q,this._screenElement=G,this._viewportElement=X,this._helperContainer=K,this._linkifier2=O,this._charSizeService=j,this._optionsService=$,this._bufferService=U,this._coreBrowserService=Q,this._themeService=ie,this._terminalClass=F++,this._rowElements=[],this._selectionRenderModel=(0,C.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(T),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,w.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((se=>this._injectCss(se)))),this._injectCss(this._themeService.colors),this._rowFactory=M.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(D+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((se=>this._handleLinkHover(se)))),this.register(this._linkifier2.onHideLinkUnderline((se=>this._handleLinkLeave(se)))),this.register((0,y.toDisposable)((()=>{this._element.classList.remove(D+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new m.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 H=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*H,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*H),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/H),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/H),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 q of this._rowElements)q.style.width=`${this.dimensions.css.canvas.width}px`,q.style.height=`${this.dimensions.css.cell.height}px`,q.style.lineHeight=`${this.dimensions.css.cell.height}px`,q.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const z=`${this._terminalSelector} .${T} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=z,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(H){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let z=`${this._terminalSelector} .${T} { color: ${H.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;z+=`${this._terminalSelector} .${T} .xterm-dim { color: ${S.color.multiplyOpacity(H.foreground,.5).css};}`,z+=`${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 q=`blink_underline_${this._terminalClass}`,G=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;z+=`@keyframes ${q} { 50% { border-bottom-style: hidden; }}`,z+=`@keyframes ${G} { 50% { box-shadow: none; }}`,z+=`@keyframes ${X} { 0% { background-color: ${H.cursor.css}; color: ${H.cursorAccent.css}; } 50% { background-color: inherit; color: ${H.cursor.css}; }}`,z+=`${this._terminalSelector} .${T}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${T}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${T}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block { background-color: ${H.cursor.css}; color: ${H.cursorAccent.css};}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${H.cursor.css} !important; color: ${H.cursorAccent.css} !important;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${H.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${H.cursor.css} inset;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${H.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,z+=`${this._terminalSelector} .${I} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${I} div { position: absolute; background-color: ${H.selectionBackgroundOpaque.css};}${this._terminalSelector} .${I} div { position: absolute; background-color: ${H.selectionInactiveBackgroundOpaque.css};}`;for(const[K,O]of H.ansi.entries())z+=`${this._terminalSelector} .${R}${K} { color: ${O.css}; }${this._terminalSelector} .${R}${K}.xterm-dim { color: ${S.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${N}${K} { background-color: ${O.css}; }`;z+=`${this._terminalSelector} .${R}${_.INVERTED_DEFAULT_COLOR} { color: ${S.color.opaque(H.background).css}; }${this._terminalSelector} .${R}${_.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${S.color.multiplyOpacity(S.color.opaque(H.background),.5).css}; }${this._terminalSelector} .${N}${_.INVERTED_DEFAULT_COLOR} { background-color: ${H.foreground.css}; }`,this._themeStyleElement.textContent=z}_setDefaultSpacing(){const H=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${H}px`,this._rowFactory.defaultSpacing=H}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(H,z){for(let q=this._rowElements.length;q<=z;q++){const G=this._document.createElement("div");this._rowContainer.appendChild(G),this._rowElements.push(G)}for(;this._rowElements.length>z;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(H,z){this._refreshRowElements(H,z),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(L),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(L),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(H,z,q){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(H,z,q),this.renderRows(0,this._bufferService.rows-1),!H||!z)return;this._selectionRenderModel.update(this._terminal,H,z,q);const G=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,K=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(K>=this._bufferService.rows||O<0)return;const M=this._document.createDocumentFragment();if(q){const j=H[0]>z[0];M.appendChild(this._createSelectionElement(K,j?z[0]:H[0],j?H[0]:z[0],O-K+1))}else{const j=G===K?H[0]:0,$=K===X?z[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(K,j,$));const U=O-K-1;if(M.appendChild(this._createSelectionElement(K+1,0,this._bufferService.cols,U)),K!==O){const Q=X===O?z[0]:this._bufferService.cols;M.appendChild(this._createSelectionElement(O,0,Q))}}this._selectionContainer.appendChild(M)}_createSelectionElement(H,z,q,G=1){const X=this._document.createElement("div"),K=z*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(q-z);return K+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-K),X.style.height=G*this.dimensions.css.cell.height+"px",X.style.top=H*this.dimensions.css.cell.height+"px",X.style.left=`${K}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 H of this._rowElements)H.replaceChildren()}renderRows(H,z){const q=this._bufferService.buffer,G=q.ybase+q.y,X=Math.min(q.x,this._bufferService.cols-1),K=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,M=this._optionsService.rawOptions.cursorInactiveStyle;for(let j=H;j<=z;j++){const $=j+q.ydisp,U=this._rowElements[j],Q=q.lines.get($);if(!U||!Q)break;U.replaceChildren(...this._rowFactory.createRow(Q,$,$===G,O,M,X,K,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${D}${this._terminalClass}`}_handleLinkHover(H){this._setCellUnderline(H.x1,H.x2,H.y1,H.y2,H.cols,!0)}_handleLinkLeave(H){this._setCellUnderline(H.x1,H.x2,H.y1,H.y2,H.cols,!1)}_setCellUnderline(H,z,q,G,X,K){q<0&&(H=0),G<0&&(z=0);const O=this._bufferService.rows-1;q=Math.max(Math.min(q,O),0),G=Math.max(Math.min(G,O),0),X=Math.min(X,this._bufferService.cols);const M=this._bufferService.buffer,j=M.ybase+M.y,$=Math.min(M.x,X-1),U=this._optionsService.rawOptions.cursorBlink,Q=this._optionsService.rawOptions.cursorStyle,ie=this._optionsService.rawOptions.cursorInactiveStyle;for(let se=q;se<=G;++se){const Z=se+M.ydisp,P=this._rowElements[se],ee=M.lines.get(Z);if(!P||!ee)break;P.replaceChildren(...this._rowFactory.createRow(ee,Z,Z===j,Q,ie,$,U,this.dimensions.css.cell.width,this._widthCache,K?se===q?H:0:-1,K?(se===G?z:X)-1:-1))}}};o.DomRenderer=V=f([g(7,k.IInstantiationService),g(8,b.ICharSizeService),g(9,k.IOptionsService),g(10,k.IBufferService),g(11,b.ICoreBrowserService),g(12,b.IThemeService)],V)},3787:function(c,o,u){var f=this&&this.__decorate||function(T,R,N,L){var I,F=arguments.length,V=F<3?R:L===null?L=Object.getOwnPropertyDescriptor(R,N):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(T,R,N,L);else for(var H=T.length-1;H>=0;H--)(I=T[H])&&(V=(F<3?I(V):F>3?I(R,N,V):I(R,N))||V);return F>3&&V&&Object.defineProperty(R,N,V),V},g=this&&this.__param||function(T,R){return function(N,L){R(N,L,T)}};Object.defineProperty(o,"__esModule",{value:!0}),o.DomRendererRowFactory=void 0;const d=u(2223),m=u(643),_=u(511),w=u(2585),C=u(8055),b=u(4725),S=u(4269),x=u(6171),y=u(3734);let k=o.DomRendererRowFactory=class{constructor(T,R,N,L,I,F,V){this._document=T,this._characterJoinerService=R,this._optionsService=N,this._coreBrowserService=L,this._coreService=I,this._decorationService=F,this._themeService=V,this._workCell=new _.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(T,R,N){this._selectionStart=T,this._selectionEnd=R,this._columnSelectMode=N}createRow(T,R,N,L,I,F,V,H,z,q,G){const X=[],K=this._characterJoinerService.getJoinedCharacters(R),O=this._themeService.colors;let M,j=T.getNoBgTrimmedLength();N&&j0&&me===K[0][0]){le=!0;const Ue=K.shift();be=new S.JoinedCellData(this._workCell,T.translateToString(!0,Ue[0],Ue[1]),Ue[1]-Ue[0]),ye=Ue[1]-1,we=be.getWidth()}const Be=this._isCellInSelection(me,R),Ve=N&&me===F,Pe=ue&&me>=q&&me<=G;let lt=!1;this._decorationService.forEachDecorationAtCell(me,R,void 0,(Ue=>{lt=!0}));let Rt=be.getChars()||m.WHITESPACE_CELL_CHAR;if(Rt===" "&&(be.isUnderline()||be.isOverline())&&(Rt=" "),te=we*H-z.get(Rt,be.isBold(),be.isItalic()),M){if($&&(Be&&ee||!Be&&!ee&&be.bg===Q)&&(Be&&ee&&O.selectionForeground||be.fg===ie)&&be.extended.ext===se&&Pe===Z&&te===P&&!Ve&&!le&&!lt){be.isInvisible()?U+=m.WHITESPACE_CELL_CHAR:U+=Rt,$++;continue}$&&(M.textContent=U),M=this._document.createElement("span"),$=0,U=""}else M=this._document.createElement("span");if(Q=be.bg,ie=be.fg,se=be.extended.ext,Z=Pe,P=te,ee=Be,le&&F>=me&&F<=ye&&(F=me),!this._coreService.isCursorHidden&&Ve&&this._coreService.isCursorInitialized){if(pe.push("xterm-cursor"),this._coreBrowserService.isFocused)V&&pe.push("xterm-cursor-blink"),pe.push(L==="bar"?"xterm-cursor-bar":L==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(I)switch(I){case"outline":pe.push("xterm-cursor-outline");break;case"block":pe.push("xterm-cursor-block");break;case"bar":pe.push("xterm-cursor-bar");break;case"underline":pe.push("xterm-cursor-underline")}}if(be.isBold()&&pe.push("xterm-bold"),be.isItalic()&&pe.push("xterm-italic"),be.isDim()&&pe.push("xterm-dim"),U=be.isInvisible()?m.WHITESPACE_CELL_CHAR:be.getChars()||m.WHITESPACE_CELL_CHAR,be.isUnderline()&&(pe.push(`xterm-underline-${be.extended.underlineStyle}`),U===" "&&(U=" "),!be.isUnderlineColorDefault()))if(be.isUnderlineColorRGB())M.style.textDecorationColor=`rgb(${y.AttributeData.toColorRGB(be.getUnderlineColor()).join(",")})`;else{let Ue=be.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&be.isBold()&&Ue<8&&(Ue+=8),M.style.textDecorationColor=O.ansi[Ue].css}be.isOverline()&&(pe.push("xterm-overline"),U===" "&&(U=" ")),be.isStrikethrough()&&pe.push("xterm-strikethrough"),Pe&&(M.style.textDecoration="underline");let gt=be.getFgColor(),nt=be.getFgColorMode(),ct=be.getBgColor(),de=be.getBgColorMode();const Se=!!be.isInverse();if(Se){const Ue=gt;gt=ct,ct=Ue;const Tt=nt;nt=de,de=Tt}let Ee,Le,je,Ct=!1;switch(this._decorationService.forEachDecorationAtCell(me,R,void 0,(Ue=>{Ue.options.layer!=="top"&&Ct||(Ue.backgroundColorRGB&&(de=50331648,ct=Ue.backgroundColorRGB.rgba>>8&16777215,Ee=Ue.backgroundColorRGB),Ue.foregroundColorRGB&&(nt=50331648,gt=Ue.foregroundColorRGB.rgba>>8&16777215,Le=Ue.foregroundColorRGB),Ct=Ue.options.layer==="top")})),!Ct&&Be&&(Ee=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,ct=Ee.rgba>>8&16777215,de=50331648,Ct=!0,O.selectionForeground&&(nt=50331648,gt=O.selectionForeground.rgba>>8&16777215,Le=O.selectionForeground)),Ct&&pe.push("xterm-decoration-top"),de){case 16777216:case 33554432:je=O.ansi[ct],pe.push(`xterm-bg-${ct}`);break;case 50331648:je=C.channels.toColor(ct>>16,ct>>8&255,255&ct),this._addStyle(M,`background-color:#${D((ct>>>0).toString(16),"0",6)}`);break;default:Se?(je=O.foreground,pe.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):je=O.background}switch(Ee||be.isDim()&&(Ee=C.color.multiplyOpacity(je,.5)),nt){case 16777216:case 33554432:be.isBold()&><8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(gt+=8),this._applyMinimumContrast(M,je,O.ansi[gt],be,Ee,void 0)||pe.push(`xterm-fg-${gt}`);break;case 50331648:const Ue=C.channels.toColor(gt>>16&255,gt>>8&255,255>);this._applyMinimumContrast(M,je,Ue,be,Ee,Le)||this._addStyle(M,`color:#${D(gt.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(M,je,O.foreground,be,Ee,Le)||Se&&pe.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}pe.length&&(M.className=pe.join(" "),pe.length=0),Ve||le||lt?M.textContent=U:$++,te!==this.defaultSpacing&&(M.style.letterSpacing=`${te}px`),X.push(M),me=ye}return M&&$&&(M.textContent=U),X}_applyMinimumContrast(T,R,N,L,I,F){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const V=this._getContrastCache(L);let H;if(I||F||(H=V.getColor(R.rgba,N.rgba)),H===void 0){const z=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);H=C.color.ensureContrastRatio(I||R,F||N,z),V.setColor((I||R).rgba,(F||N).rgba,H??null)}return!!H&&(this._addStyle(T,`color:${H.css}`),!0)}_getContrastCache(T){return T.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(T,R){T.setAttribute("style",`${T.getAttribute("style")||""}${R};`)}_isCellInSelection(T,R){const N=this._selectionStart,L=this._selectionEnd;return!(!N||!L)&&(this._columnSelectMode?N[0]<=L[0]?T>=N[0]&&R>=N[1]&&T=N[1]&&T>=L[0]&&R<=L[1]:R>N[1]&&R=N[0]&&T=N[0])}};function D(T,R,N){for(;T.length{Object.defineProperty(o,"__esModule",{value:!0}),o.WidthCache=void 0,o.WidthCache=class{constructor(u,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=u.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 g=u.createElement("span");g.classList.add("xterm-char-measure-element");const d=u.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const m=u.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontStyle="italic";const _=u.createElement("span");_.classList.add("xterm-char-measure-element"),_.style.fontWeight="bold",_.style.fontStyle="italic",this._measureElements=[g,d,m,_],this._container.appendChild(g),this._container.appendChild(d),this._container.appendChild(m),this._container.appendChild(_),f.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(u,f,g,d){u===this._font&&f===this._fontSize&&g===this._weight&&d===this._weightBold||(this._font=u,this._fontSize=f,this._weight=g,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(u,f,g){let d=0;if(!f&&!g&&u.length===1&&(d=u.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const w=this._measure(u,0);return w>0&&(this._flat[d]=w),w}let m=u;f&&(m+="B"),g&&(m+="I");let _=this._holey.get(m);if(_===void 0){let w=0;f&&(w|=1),g&&(w|=2),_=this._measure(u,w),_>0&&this._holey.set(m,_)}return _}_measure(u,f){const g=this._measureElements[f];return g.textContent=u.repeat(32),g.offsetWidth/32}}},2223:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.TEXT_BASELINE=o.DIM_OPACITY=o.INVERTED_DEFAULT_COLOR=void 0;const f=u(6114);o.INVERTED_DEFAULT_COLOR=257,o.DIM_OPACITY=.5,o.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(c,o)=>{function u(g){return 57508<=g&&g<=57558}function f(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=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(g){if(!g)throw new Error("value must not be falsy");return g},o.isPowerlineGlyph=u,o.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},o.isEmoji=f,o.allowRescaling=function(g,d,m,_){return d===1&&m>Math.ceil(1.5*_)&&g!==void 0&&g>255&&!f(g)&&!u(g)&&!(function(w){return 57344<=w&&w<=63743})(g)},o.treatGlyphAsBackgroundColor=function(g){return u(g)||(function(d){return 9472<=d&&d<=9631})(g)},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(g,d,m=0){return(g-(2*Math.round(d)-m))%(2*Math.round(d))}},6052:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createSelectionRenderModel=void 0;class u{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(g,d,m,_=!1){if(this.selectionStart=d,this.selectionEnd=m,!d||!m||d[0]===m[0]&&d[1]===m[1])return void this.clear();const w=g.buffers.active.ydisp,C=d[1]-w,b=m[1]-w,S=Math.max(C,0),x=Math.min(b,g.rows-1);S>=g.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=_,this.viewportStartRow=C,this.viewportEndRow=b,this.viewportCappedStartRow=S,this.viewportCappedEndRow=x,this.startCol=d[0],this.endCol=m[0])}isCellSelected(g,d,m){return!!this.hasSelection&&(m-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&m>=this.viewportCappedStartRow&&d=this.viewportCappedStartRow&&d>=this.endCol&&m<=this.viewportCappedEndRow:m>this.viewportStartRow&&m=this.startCol&&d=this.startCol)}}o.createSelectionRenderModel=function(){return new u}},456:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionModel=void 0,o.SelectionModel=class{constructor(u){this._bufferService=u,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 u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?u%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)-1]:[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[u,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[Math.max(u,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const u=this.selectionStart,f=this.selectionEnd;return!(!u||!f)&&(u[1]>f[1]||u[1]===f[1]&&u[0]>f[0])}handleTrim(u){return this.selectionStart&&(this.selectionStart[1]-=u),this.selectionEnd&&(this.selectionEnd[1]-=u),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(c,o,u){var f=this&&this.__decorate||function(x,y,k,D){var T,R=arguments.length,N=R<3?y:D===null?D=Object.getOwnPropertyDescriptor(y,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,y,k,D);else for(var L=x.length-1;L>=0;L--)(T=x[L])&&(N=(R<3?T(N):R>3?T(y,k,N):T(y,k))||N);return R>3&&N&&Object.defineProperty(y,k,N),N},g=this&&this.__param||function(x,y){return function(k,D){y(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharSizeService=void 0;const d=u(2585),m=u(8460),_=u(844);let w=o.CharSizeService=class extends _.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,y,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new m.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new S(this._optionsService))}catch{this._measureStrategy=this.register(new b(x,y,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const x=this._measureStrategy.measure();x.width===this.width&&x.height===this.height||(this.width=x.width,this.height=x.height,this._onCharSizeChange.fire())}};o.CharSizeService=w=f([g(2,d.IOptionsService)],w);class C extends _.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(y,k){y!==void 0&&y>0&&k!==void 0&&k>0&&(this._result.width=y,this._result.height=k)}}class b extends C{constructor(y,k,D){super(),this._document=y,this._parentElement=k,this._optionsService=D,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 S extends C{constructor(y){super(),this._optionsService=y,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const k=this._ctx.measureText("W");if(!("width"in k&&"fontBoundingBoxAscent"in k&&"fontBoundingBoxDescent"in k))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(c,o,u){var f=this&&this.__decorate||function(S,x,y,k){var D,T=arguments.length,R=T<3?x:k===null?k=Object.getOwnPropertyDescriptor(x,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(S,x,y,k);else for(var N=S.length-1;N>=0;N--)(D=S[N])&&(R=(T<3?D(R):T>3?D(x,y,R):D(x,y))||R);return T>3&&R&&Object.defineProperty(x,y,R),R},g=this&&this.__param||function(S,x){return function(y,k){x(y,k,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CharacterJoinerService=o.JoinedCellData=void 0;const d=u(3734),m=u(643),_=u(511),w=u(2585);class C extends d.AttributeData{constructor(x,y,k){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=y,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(x){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.JoinedCellData=C;let b=o.CharacterJoinerService=class eC{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}register(x){const y={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(y),y.id}deregister(x){for(let y=0;y1){const V=this._getJoinedRanges(D,N,R,y,T);for(let H=0;H1){const F=this._getJoinedRanges(D,N,R,y,T);for(let V=0;V{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreBrowserService=void 0;const f=u(844),g=u(8460),d=u(3656);class m extends f.Disposable{constructor(C,b,S){super(),this._textarea=C,this._window=b,this.mainDocument=S,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new _(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,g.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(C){this._window!==C&&(this._window=C,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=m;class _ extends f.Disposable{constructor(C){super(),this._parentWindow=C,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(C){this._parentWindow=C,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 C;this._outerListener&&((C=this._resolutionMediaMatchList)==null||C.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:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.LinkProviderService=void 0;const f=u(844);class g extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(m){return this.linkProviders.push(m),{dispose:()=>{const _=this.linkProviders.indexOf(m);_!==-1&&this.linkProviders.splice(_,1)}}}}o.LinkProviderService=g},8934:function(c,o,u){var f=this&&this.__decorate||function(w,C,b,S){var x,y=arguments.length,k=y<3?C:S===null?S=Object.getOwnPropertyDescriptor(C,b):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(w,C,b,S);else for(var D=w.length-1;D>=0;D--)(x=w[D])&&(k=(y<3?x(k):y>3?x(C,b,k):x(C,b))||k);return y>3&&k&&Object.defineProperty(C,b,k),k},g=this&&this.__param||function(w,C){return function(b,S){C(b,S,w)}};Object.defineProperty(o,"__esModule",{value:!0}),o.MouseService=void 0;const d=u(4725),m=u(9806);let _=o.MouseService=class{constructor(w,C){this._renderService=w,this._charSizeService=C}getCoords(w,C,b,S,x){return(0,m.getCoords)(window,w,C,b,S,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(w,C){const b=(0,m.getCoordsRelativeToElement)(window,w,C);if(this._charSizeService.hasValidSize)return b[0]=Math.min(Math.max(b[0],0),this._renderService.dimensions.css.canvas.width-1),b[1]=Math.min(Math.max(b[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(b[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(b[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(b[0]),y:Math.floor(b[1])}}};o.MouseService=_=f([g(0,d.IRenderService),g(1,d.ICharSizeService)],_)},3230:function(c,o,u){var f=this&&this.__decorate||function(x,y,k,D){var T,R=arguments.length,N=R<3?y:D===null?D=Object.getOwnPropertyDescriptor(y,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,y,k,D);else for(var L=x.length-1;L>=0;L--)(T=x[L])&&(N=(R<3?T(N):R>3?T(y,k,N):T(y,k))||N);return R>3&&N&&Object.defineProperty(y,k,N),N},g=this&&this.__param||function(x,y){return function(k,D){y(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.RenderService=void 0;const d=u(6193),m=u(4725),_=u(8460),w=u(844),C=u(7226),b=u(2585);let S=o.RenderService=class extends w.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,y,k,D,T,R,N,L){super(),this._rowCount=x,this._charSizeService=D,this._renderer=this.register(new w.MutableDisposable),this._pausedResizeTask=new C.DebouncedIdleTask,this._observerDisposable=this.register(new w.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 _.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new _.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new _.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new _.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((I,F)=>this._renderRows(I,F)),N),this.register(this._renderDebouncer),this.register(N.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(R.onResize((()=>this._fullRefresh()))),this.register(R.buffers.onBufferActivate((()=>{var I;return(I=this._renderer.value)==null?void 0:I.clear()}))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(T.onDecorationRegistered((()=>this._fullRefresh()))),this.register(T.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(R.buffer.y,R.buffer.y,!0)))),this.register(L.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(N.window,y),this.register(N.onWindowChange((I=>this._registerIntersectionObserver(I,y))))}_registerIntersectionObserver(x,y){if("IntersectionObserver"in x){const k=new x.IntersectionObserver((D=>this._handleIntersectionChange(D[D.length-1])),{threshold:0});k.observe(y),this._observerDisposable.value=(0,w.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(x){this._isPaused=x.isIntersecting===void 0?x.intersectionRatio===0:!x.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(x,y,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,y,this._rowCount))}_renderRows(x,y){this._renderer.value&&(x=Math.min(x,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(x,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:x,end:y}),this._onRender.fire({start:x,end:y}),this._isNextRenderRedrawOnly=!0)}resize(x,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(x){this._renderer.value=x,this._renderer.value&&(this._renderer.value.onRequestRedraw((y=>this.refreshRows(y.start,y.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(x){return this._renderDebouncer.addRefreshCallback(x)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var x,y;this._renderer.value&&((y=(x=this._renderer.value).clearTextureAtlas)==null||y.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var k;return(k=this._renderer.value)==null?void 0:k.handleResize(x,y)})):this._renderer.value.handleResize(x,y),this._fullRefresh())}handleCharSizeChanged(){var x;(x=this._renderer.value)==null||x.handleCharSizeChanged()}handleBlur(){var x;(x=this._renderer.value)==null||x.handleBlur()}handleFocus(){var x;(x=this._renderer.value)==null||x.handleFocus()}handleSelectionChanged(x,y,k){var D;this._selectionState.start=x,this._selectionState.end=y,this._selectionState.columnSelectMode=k,(D=this._renderer.value)==null||D.handleSelectionChanged(x,y,k)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};o.RenderService=S=f([g(2,b.IOptionsService),g(3,m.ICharSizeService),g(4,b.IDecorationService),g(5,b.IBufferService),g(6,m.ICoreBrowserService),g(7,m.IThemeService)],S)},9312:function(c,o,u){var f=this&&this.__decorate||function(N,L,I,F){var V,H=arguments.length,z=H<3?L:F===null?F=Object.getOwnPropertyDescriptor(L,I):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(N,L,I,F);else for(var q=N.length-1;q>=0;q--)(V=N[q])&&(z=(H<3?V(z):H>3?V(L,I,z):V(L,I))||z);return H>3&&z&&Object.defineProperty(L,I,z),z},g=this&&this.__param||function(N,L){return function(I,F){L(I,F,N)}};Object.defineProperty(o,"__esModule",{value:!0}),o.SelectionService=void 0;const d=u(9806),m=u(9504),_=u(456),w=u(4725),C=u(8460),b=u(844),S=u(6114),x=u(4841),y=u(511),k=u(2585),D=" ",T=new RegExp(D,"g");let R=o.SelectionService=class extends b.Disposable{constructor(N,L,I,F,V,H,z,q,G){super(),this._element=N,this._screenElement=L,this._linkifier=I,this._bufferService=F,this._coreService=V,this._mouseService=H,this._optionsService=z,this._renderService=q,this._coreBrowserService=G,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 C.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new C.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new C.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 _.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,b.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 N=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!N||!L||N[0]===L[0]&&N[1]===L[1])}get selectionText(){const N=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;if(!N||!L)return"";const I=this._bufferService.buffer,F=[];if(this._activeSelectionMode===3){if(N[0]===L[0])return"";const V=N[0]V.replace(T," "))).join(S.isWindows?`\r `:` -`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(N){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&N&&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(N){const L=this._getMouseBufferCoords(N),I=this._model.finalSelectionStart,F=this._model.finalSelectionEnd;return!!(I&&F&&L)&&this._areCoordsInSelection(L,I,F)}isCellInSelection(N,L){const I=this._model.finalSelectionStart,F=this._model.finalSelectionEnd;return!(!I||!F)&&this._areCoordsInSelection([N,L],I,F)}_areCoordsInSelection(N,L,I){return N[1]>L[1]&&N[1]=L[0]&&N[0]=L[0]}_selectWordAtCursor(N,L){var V,H;const I=(H=(V=this._linkifier.currentLink)==null?void 0:V.link)==null?void 0:H.range;if(I)return this._model.selectionStart=[I.start.x-1,I.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(I,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const F=this._getMouseBufferCoords(N);return!!F&&(this._selectWordAt(F,L),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(N,L){this._model.clearSelection(),N=Math.max(N,0),L=Math.min(L,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,N],this._model.selectionEnd=[this._bufferService.cols,L],this.refresh(),this._onSelectionChange.fire()}_handleTrim(N){this._model.handleTrim(N)&&this.refresh()}_getMouseBufferCoords(N){const L=this._mouseService.getCoords(N,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(L)return L[0]--,L[1]--,L[1]+=this._bufferService.buffer.ydisp,L}_getMouseEventScrollAmount(N){let L=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,N,this._screenElement)[1];const I=this._renderService.dimensions.css.canvas.height;return L>=0&&L<=I?0:(L>I&&(L-=I),L=Math.min(Math.max(L,-50),50),L/=50,L/Math.abs(L)+Math.round(14*L))}shouldForceSelection(N){return b.isMac?N.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:N.shiftKey}handleMouseDown(N){if(this._mouseDownTimeStamp=N.timeStamp,(N.button!==2||!this.hasSelection)&&N.button===0){if(!this._enabled){if(!this.shouldForceSelection(N))return;N.stopPropagation()}N.preventDefault(),this._dragScrollAmount=0,this._enabled&&N.shiftKey?this._handleIncrementalClick(N):N.detail===1?this._handleSingleClick(N):N.detail===2?this._handleDoubleClick(N):N.detail===3&&this._handleTripleClick(N),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(N){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(N))}_handleSingleClick(N){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(N)?3:0,this._model.selectionStart=this._getMouseBufferCoords(N),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const L=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);L&&L.length!==this._model.selectionStart[0]&&L.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(N){this._selectWordAtCursor(N,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(N){const L=this._getMouseBufferCoords(N);L&&(this._activeSelectionMode=2,this._selectLineAt(L[1]))}shouldColumnSelect(N){return N.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(N){if(N.stopImmediatePropagation(),!this._model.selectionStart)return;const L=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(N),!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(N.ydisp+this._bufferService.rows,N.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=N.ydisp),this.refresh()}}_handleMouseUp(N){const L=N.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&L<500&&N.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const I=this._mouseService.getCoords(N,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(I&&I[0]!==void 0&&I[1]!==void 0){const F=(0,m.moveToCellSequence)(I[0]-1,I[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(F,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const N=this._model.finalSelectionStart,L=this._model.finalSelectionEnd,I=!(!N||!L||N[0]===L[0]&&N[1]===L[1]);I?N&&L&&(this._oldSelectionStart&&this._oldSelectionEnd&&N[0]===this._oldSelectionStart[0]&&N[1]===this._oldSelectionStart[1]&&L[0]===this._oldSelectionEnd[0]&&L[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(N,L,I)):this._oldHasSelection&&this._fireOnSelectionChange(N,L,I)}_fireOnSelectionChange(N,L,I){this._oldSelectionStart=N,this._oldSelectionEnd=L,this._oldHasSelection=I,this._onSelectionChange.fire()}_handleBufferActivate(N){this.clearSelection(),this._trimListener.dispose(),this._trimListener=N.activeBuffer.lines.onTrim((L=>this._handleTrim(L)))}_convertViewportColToCharacterIndex(N,L){let I=L;for(let F=0;L>=F;F++){const V=N.loadCell(F,this._workCell).getChars().length;this._workCell.getWidth()===0?I--:V>1&&L!==F&&(I+=V-1)}return I}setSelection(N,L,I){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[N,L],this._model.selectionStartLength=I,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(N){this._isClickInSelection(N)||(this._selectWordAtCursor(N,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(N,L,I=!0,F=!0){if(N[0]>=this._bufferService.cols)return;const V=this._bufferService.buffer,H=V.lines.get(N[1]);if(!H)return;const z=V.translateBufferLineToString(N[1],!1);let q=this._convertViewportColToCharacterIndex(H,N[0]),G=q;const X=N[0]-q;let K=0,O=0,M=0,j=0;if(z.charAt(q)===" "){for(;q>0&&z.charAt(q-1)===" ";)q--;for(;G1&&(j+=se-1,G+=se-1);Q>0&&q>0&&!this._isCharWordSeparator(H.loadCell(Q-1,this._workCell));){H.loadCell(Q-1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===0?(K++,Q--):Z>1&&(M+=Z-1,q-=Z-1),q--,Q--}for(;ie1&&(j+=Z-1,G+=Z-1),G++,ie++}}G++;let $=q+X-K+M,U=Math.min(this._bufferService.cols,G-q+K+O-M-j);if(L||z.slice(q,G).trim()!==""){if(I&&$===0&&H.getCodePoint(0)!==32){const Q=V.lines.get(N[1]-1);if(Q&&H.isWrapped&&Q.getCodePoint(this._bufferService.cols-1)!==32){const ie=this._getWordAt([this._bufferService.cols-1,N[1]-1],!1,!0,!1);if(ie){const se=this._bufferService.cols-ie.start;$-=se,U+=se}}}if(F&&$+U===this._bufferService.cols&&H.getCodePoint(this._bufferService.cols-1)!==32){const Q=V.lines.get(N[1]+1);if(Q!=null&&Q.isWrapped&&Q.getCodePoint(0)!==32){const ie=this._getWordAt([0,N[1]+1],!1,!1,!0);ie&&(U+=ie.length)}}return{start:$,length:U}}}_selectWordAt(N,L){const I=this._getWordAt(N,L);if(I){for(;I.start<0;)I.start+=this._bufferService.cols,N[1]--;this._model.selectionStart=[I.start,N[1]],this._model.selectionStartLength=I.length}}_selectToWordAt(N){const L=this._getWordAt(N,!0);if(L){let I=N[1];for(;L.start<0;)L.start+=this._bufferService.cols,I--;if(!this._model.areSelectionValuesReversed())for(;L.start+L.length>this._bufferService.cols;)L.length-=this._bufferService.cols,I++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?L.start:L.start+L.length,I]}}_isCharWordSeparator(N){return N.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(N.getChars())>=0}_selectLineAt(N){const L=this._bufferService.buffer.getWrappedRangeForLine(N),I={start:{x:0,y:L.first},end:{x:this._bufferService.cols-1,y:L.last}};this._model.selectionStart=[0,L.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(I,this._bufferService.cols)}};o.SelectionService=R=f([g(3,k.IBufferService),g(4,k.ICoreService),g(5,w.IMouseService),g(6,k.IOptionsService),g(7,w.IRenderService),g(8,w.ICoreBrowserService)],R)},4725:(c,o,u)=>{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 f=u(8343);o.ICharSizeService=(0,f.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),o.IMouseService=(0,f.createDecorator)("MouseService"),o.IRenderService=(0,f.createDecorator)("RenderService"),o.ISelectionService=(0,f.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,f.createDecorator)("ThemeService"),o.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(c,o,u){var f=this&&this.__decorate||function(R,N,L,I){var F,V=arguments.length,H=V<3?N:I===null?I=Object.getOwnPropertyDescriptor(N,L):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(R,N,L,I);else for(var z=R.length-1;z>=0;z--)(F=R[z])&&(H=(V<3?F(H):V>3?F(N,L,H):F(N,L))||H);return V>3&&H&&Object.defineProperty(N,L,H),H},g=this&&this.__param||function(R,N){return function(L,I){N(L,I,R)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=u(7239),m=u(8055),_=u(8460),w=u(844),C=u(2585),y=m.css.toColor("#ffffff"),b=m.css.toColor("#000000"),x=m.css.toColor("#ffffff"),v=m.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const R=[m.css.toColor("#2e3436"),m.css.toColor("#cc0000"),m.css.toColor("#4e9a06"),m.css.toColor("#c4a000"),m.css.toColor("#3465a4"),m.css.toColor("#75507b"),m.css.toColor("#06989a"),m.css.toColor("#d3d7cf"),m.css.toColor("#555753"),m.css.toColor("#ef2929"),m.css.toColor("#8ae234"),m.css.toColor("#fce94f"),m.css.toColor("#729fcf"),m.css.toColor("#ad7fa8"),m.css.toColor("#34e2e2"),m.css.toColor("#eeeeec")],N=[0,95,135,175,215,255];for(let L=0;L<216;L++){const I=N[L/36%6|0],F=N[L/6%6|0],V=N[L%6];R.push({css:m.channels.toCss(I,F,V),rgba:m.channels.toRgba(I,F,V)})}for(let L=0;L<24;L++){const I=8+10*L;R.push({css:m.channels.toCss(I,I,I),rgba:m.channels.toRgba(I,I,I)})}return R})());let D=o.ThemeService=class extends w.Disposable{get colors(){return this._colors}constructor(R){super(),this._optionsService=R,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:y,background:b,cursor:x,cursorAccent:v,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:m.color.blend(b,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:m.color.blend(b,k),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(R={}){const N=this._colors;if(N.foreground=T(R.foreground,y),N.background=T(R.background,b),N.cursor=T(R.cursor,x),N.cursorAccent=T(R.cursorAccent,v),N.selectionBackgroundTransparent=T(R.selectionBackground,k),N.selectionBackgroundOpaque=m.color.blend(N.background,N.selectionBackgroundTransparent),N.selectionInactiveBackgroundTransparent=T(R.selectionInactiveBackground,N.selectionBackgroundTransparent),N.selectionInactiveBackgroundOpaque=m.color.blend(N.background,N.selectionInactiveBackgroundTransparent),N.selectionForeground=R.selectionForeground?T(R.selectionForeground,m.NULL_COLOR):void 0,N.selectionForeground===m.NULL_COLOR&&(N.selectionForeground=void 0),m.color.isOpaque(N.selectionBackgroundTransparent)&&(N.selectionBackgroundTransparent=m.color.opacity(N.selectionBackgroundTransparent,.3)),m.color.isOpaque(N.selectionInactiveBackgroundTransparent)&&(N.selectionInactiveBackgroundTransparent=m.color.opacity(N.selectionInactiveBackgroundTransparent,.3)),N.ansi=o.DEFAULT_ANSI_COLORS.slice(),N.ansi[0]=T(R.black,o.DEFAULT_ANSI_COLORS[0]),N.ansi[1]=T(R.red,o.DEFAULT_ANSI_COLORS[1]),N.ansi[2]=T(R.green,o.DEFAULT_ANSI_COLORS[2]),N.ansi[3]=T(R.yellow,o.DEFAULT_ANSI_COLORS[3]),N.ansi[4]=T(R.blue,o.DEFAULT_ANSI_COLORS[4]),N.ansi[5]=T(R.magenta,o.DEFAULT_ANSI_COLORS[5]),N.ansi[6]=T(R.cyan,o.DEFAULT_ANSI_COLORS[6]),N.ansi[7]=T(R.white,o.DEFAULT_ANSI_COLORS[7]),N.ansi[8]=T(R.brightBlack,o.DEFAULT_ANSI_COLORS[8]),N.ansi[9]=T(R.brightRed,o.DEFAULT_ANSI_COLORS[9]),N.ansi[10]=T(R.brightGreen,o.DEFAULT_ANSI_COLORS[10]),N.ansi[11]=T(R.brightYellow,o.DEFAULT_ANSI_COLORS[11]),N.ansi[12]=T(R.brightBlue,o.DEFAULT_ANSI_COLORS[12]),N.ansi[13]=T(R.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),N.ansi[14]=T(R.brightCyan,o.DEFAULT_ANSI_COLORS[14]),N.ansi[15]=T(R.brightWhite,o.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const L=Math.min(N.ansi.length-16,R.extendedAnsi.length);for(let I=0;I{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const f=u(8460),g=u(844);class d extends g.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.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(_){if(this._maxLength===_)return;const w=new Array(_);for(let C=0;Cthis._length)for(let w=this._length;w<_;w++)this._array[w]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,w){this._array[this._getCyclicIndex(_)]=w}push(_){this._array[this._getCyclicIndex(this._length)]=_,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(_,w,...C){if(w){for(let y=_;y=_;y--)this._array[this._getCyclicIndex(y+C.length)]=this._array[this._getCyclicIndex(y)];for(let y=0;ythis._maxLength){const y=this._length+C.length-this._maxLength;this._startIndex+=y,this._length=this._maxLength,this.onTrimEmitter.fire(y)}else this._length+=C.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,w,C){if(!(w<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let b=w-1;b>=0;b--)this.set(_+b+C,this.get(_+b));const y=_+w+C-this._length;if(y>0)for(this._length+=y;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let y=0;y{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function u(f,g=5){if(typeof f!="object")return f;const d=Array.isArray(f)?[]:{};for(const m in f)d[m]=g<=1?f[m]:f[m]&&u(f[m],g-1);return d}},8055:(c,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 u=0,f=0,g=0,d=0;var m,_,w,C,y;function b(v){const k=v.toString(16);return k.length<2?"0"+k:k}function x(v,k){return v>>0},v.toColor=function(k,D,T,R){return{css:v.toCss(k,D,T,R),rgba:v.toRgba(k,D,T,R)}}})(m||(o.channels=m={})),(function(v){function k(D,T){return d=Math.round(255*T),[u,f,g]=y.toChannels(D.rgba),{css:m.toCss(u,f,g,d),rgba:m.toRgba(u,f,g,d)}}v.blend=function(D,T){if(d=(255&T.rgba)/255,d===1)return{css:T.css,rgba:T.rgba};const R=T.rgba>>24&255,N=T.rgba>>16&255,L=T.rgba>>8&255,I=D.rgba>>24&255,F=D.rgba>>16&255,V=D.rgba>>8&255;return u=I+Math.round((R-I)*d),f=F+Math.round((N-F)*d),g=V+Math.round((L-V)*d),{css:m.toCss(u,f,g),rgba:m.toRgba(u,f,g)}},v.isOpaque=function(D){return(255&D.rgba)==255},v.ensureContrastRatio=function(D,T,R){const N=y.ensureContrastRatio(D.rgba,T.rgba,R);if(N)return m.toColor(N>>24&255,N>>16&255,N>>8&255)},v.opaque=function(D){const T=(255|D.rgba)>>>0;return[u,f,g]=y.toChannels(T),{css:m.toCss(u,f,g),rgba:T}},v.opacity=k,v.multiplyOpacity=function(D,T){return d=255&D.rgba,k(D,d*T/255)},v.toColorRGB=function(D){return[D.rgba>>24&255,D.rgba>>16&255,D.rgba>>8&255]}})(_||(o.color=_={})),(function(v){let k,D;try{const T=document.createElement("canvas");T.width=1,T.height=1;const R=T.getContext("2d",{willReadFrequently:!0});R&&(k=R,k.globalCompositeOperation="copy",D=k.createLinearGradient(0,0,1,1))}catch{}v.toColor=function(T){if(T.match(/#[\da-f]{3,8}/i))switch(T.length){case 4:return u=parseInt(T.slice(1,2).repeat(2),16),f=parseInt(T.slice(2,3).repeat(2),16),g=parseInt(T.slice(3,4).repeat(2),16),m.toColor(u,f,g);case 5:return u=parseInt(T.slice(1,2).repeat(2),16),f=parseInt(T.slice(2,3).repeat(2),16),g=parseInt(T.slice(3,4).repeat(2),16),d=parseInt(T.slice(4,5).repeat(2),16),m.toColor(u,f,g,d);case 7:return{css:T,rgba:(parseInt(T.slice(1),16)<<8|255)>>>0};case 9:return{css:T,rgba:parseInt(T.slice(1),16)>>>0}}const R=T.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return u=parseInt(R[1]),f=parseInt(R[2]),g=parseInt(R[3]),d=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),m.toColor(u,f,g,d);if(!k||!D)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=D,k.fillStyle=T,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[u,f,g,d]=k.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:m.toRgba(u,f,g,d),css:T}}})(w||(o.css=w={})),(function(v){function k(D,T,R){const N=D/255,L=T/255,I=R/255;return .2126*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}v.relativeLuminance=function(D){return k(D>>16&255,D>>8&255,255&D)},v.relativeLuminance2=k})(C||(o.rgb=C={})),(function(v){function k(T,R,N){const L=T>>24&255,I=T>>16&255,F=T>>8&255;let V=R>>24&255,H=R>>16&255,z=R>>8&255,q=x(C.relativeLuminance2(V,H,z),C.relativeLuminance2(L,I,F));for(;q0||H>0||z>0);)V-=Math.max(0,Math.ceil(.1*V)),H-=Math.max(0,Math.ceil(.1*H)),z-=Math.max(0,Math.ceil(.1*z)),q=x(C.relativeLuminance2(V,H,z),C.relativeLuminance2(L,I,F));return(V<<24|H<<16|z<<8|255)>>>0}function D(T,R,N){const L=T>>24&255,I=T>>16&255,F=T>>8&255;let V=R>>24&255,H=R>>16&255,z=R>>8&255,q=x(C.relativeLuminance2(V,H,z),C.relativeLuminance2(L,I,F));for(;q>>0}v.blend=function(T,R){if(d=(255&R)/255,d===1)return R;const N=R>>24&255,L=R>>16&255,I=R>>8&255,F=T>>24&255,V=T>>16&255,H=T>>8&255;return u=F+Math.round((N-F)*d),f=V+Math.round((L-V)*d),g=H+Math.round((I-H)*d),m.toRgba(u,f,g)},v.ensureContrastRatio=function(T,R,N){const L=C.relativeLuminance(T>>8),I=C.relativeLuminance(R>>8);if(x(L,I)>8));if(zx(L,C.relativeLuminance(q>>8))?H:q}return H}const F=D(T,R,N),V=x(L,C.relativeLuminance(F>>8));if(Vx(L,C.relativeLuminance(H>>8))?F:H}return F}},v.reduceLuminance=k,v.increaseLuminance=D,v.toChannels=function(T){return[T>>24&255,T>>16&255,T>>8&255,255&T]}})(y||(o.rgba=y={})),o.toPaddedHex=b,o.contrastRatio=x},8969:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const f=u(844),g=u(2585),d=u(4348),m=u(7866),_=u(744),w=u(7302),C=u(6975),y=u(8460),b=u(1753),x=u(1480),v=u(7994),k=u(9282),D=u(5435),T=u(5981),R=u(2660);let N=!1;class L extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new y.EventEmitter),this._onScroll.event((F=>{var V;(V=this._onScrollApi)==null||V.fire(F.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(F){for(const V in F)this.optionsService.options[V]=F[V]}constructor(F){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new y.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new y.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new y.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new y.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new y.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new w.OptionsService(F)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(m.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(v.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new D.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,y.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,y.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,y.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,y.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((V=>{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((V=>{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 T.WriteBuffer(((V,H)=>this._inputHandler.parse(V,H)))),this.register((0,y.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(F,V){this._writeBuffer.write(F,V)}writeSync(F,V){this._logService.logLevel<=g.LogLevelEnum.WARN&&!N&&(this._logService.warn("writeSync is unreliable and will be removed soon."),N=!0),this._writeBuffer.writeSync(F,V)}input(F,V=!0){this.coreService.triggerDataEvent(F,V)}resize(F,V){isNaN(F)||isNaN(V)||(F=Math.max(F,_.MINIMUM_COLS),V=Math.max(V,_.MINIMUM_ROWS),this._bufferService.resize(F,V))}scroll(F,V=!1){this._bufferService.scroll(F,V)}scrollLines(F,V,H){this._bufferService.scrollLines(F,V,H)}scrollPages(F){this.scrollLines(F*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(F){const V=F-this._bufferService.buffer.ydisp;V!==0&&this.scrollLines(V)}registerEscHandler(F,V){return this._inputHandler.registerEscHandler(F,V)}registerDcsHandler(F,V){return this._inputHandler.registerDcsHandler(F,V)}registerCsiHandler(F,V){return this._inputHandler.registerCsiHandler(F,V)}registerOscHandler(F,V){return this._inputHandler.registerOscHandler(F,V)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let F=!1;const V=this.optionsService.rawOptions.windowsPty;V&&V.buildNumber!==void 0&&V.buildNumber!==void 0?F=V.backend==="conpty"&&V.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(F=!0),F?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const F=[];F.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),F.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const V of F)V.dispose()}))}}}o.CoreTerminal=L},8460:(c,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=u=>(this._listeners.push(u),{dispose:()=>{if(!this._disposed){for(let f=0;ff.fire(g)))},o.runAndSubscribe=function(u,f){return f(void 0),u((g=>f(g)))}},5435:function(c,o,u){var f=this&&this.__decorate||function(K,O,M,j){var $,U=arguments.length,Q=U<3?O:j===null?j=Object.getOwnPropertyDescriptor(O,M):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Q=Reflect.decorate(K,O,M,j);else for(var ie=K.length-1;ie>=0;ie--)($=K[ie])&&(Q=(U<3?$(Q):U>3?$(O,M,Q):$(O,M))||Q);return U>3&&Q&&Object.defineProperty(O,M,Q),Q},g=this&&this.__param||function(K,O){return function(M,j){O(M,j,K)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=u(2584),m=u(7116),_=u(2015),w=u(844),C=u(482),y=u(8437),b=u(8460),x=u(643),v=u(511),k=u(3734),D=u(2585),T=u(1480),R=u(6242),N=u(6351),L=u(5941),I={"(":0,")":1,"*":2,"+":3,"-":1,".":2},F=131072;function V(K,O){if(K>24)return O.setWinLines||!1;switch(K){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 H;(function(K){K[K.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",K[K.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(H||(o.WindowsOptionsReportType=H={}));let z=0;class q extends w.Disposable{getAttrData(){return this._curAttrData}constructor(O,M,j,$,U,Q,ie,se,Z=new _.EscapeSequenceParser){super(),this._bufferService=O,this._charsetService=M,this._coreService=j,this._logService=$,this._optionsService=U,this._oscLinkService=Q,this._coreMouseService=ie,this._unicodeService=se,this._parser=Z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new v.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.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 G(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((P=>this._activeBuffer=P.activeBuffer))),this._parser.setCsiHandlerFallback(((P,ee)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(P),params:ee.toArray()})})),this._parser.setEscHandlerFallback((P=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(P)})})),this._parser.setExecuteHandlerFallback((P=>{this._logService.debug("Unknown EXECUTE code: ",{code:P})})),this._parser.setOscHandlerFallback(((P,ee,te)=>{this._logService.debug("Unknown OSC code: ",{identifier:P,action:ee,data:te})})),this._parser.setDcsHandlerFallback(((P,ee,te)=>{ee==="HOOK"&&(te=te.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(P),action:ee,payload:te})})),this._parser.setPrintHandler(((P,ee,te)=>this.print(P,ee,te))),this._parser.registerCsiHandler({final:"@"},(P=>this.insertChars(P))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(P=>this.scrollLeft(P))),this._parser.registerCsiHandler({final:"A"},(P=>this.cursorUp(P))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(P=>this.scrollRight(P))),this._parser.registerCsiHandler({final:"B"},(P=>this.cursorDown(P))),this._parser.registerCsiHandler({final:"C"},(P=>this.cursorForward(P))),this._parser.registerCsiHandler({final:"D"},(P=>this.cursorBackward(P))),this._parser.registerCsiHandler({final:"E"},(P=>this.cursorNextLine(P))),this._parser.registerCsiHandler({final:"F"},(P=>this.cursorPrecedingLine(P))),this._parser.registerCsiHandler({final:"G"},(P=>this.cursorCharAbsolute(P))),this._parser.registerCsiHandler({final:"H"},(P=>this.cursorPosition(P))),this._parser.registerCsiHandler({final:"I"},(P=>this.cursorForwardTab(P))),this._parser.registerCsiHandler({final:"J"},(P=>this.eraseInDisplay(P,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(P=>this.eraseInDisplay(P,!0))),this._parser.registerCsiHandler({final:"K"},(P=>this.eraseInLine(P,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(P=>this.eraseInLine(P,!0))),this._parser.registerCsiHandler({final:"L"},(P=>this.insertLines(P))),this._parser.registerCsiHandler({final:"M"},(P=>this.deleteLines(P))),this._parser.registerCsiHandler({final:"P"},(P=>this.deleteChars(P))),this._parser.registerCsiHandler({final:"S"},(P=>this.scrollUp(P))),this._parser.registerCsiHandler({final:"T"},(P=>this.scrollDown(P))),this._parser.registerCsiHandler({final:"X"},(P=>this.eraseChars(P))),this._parser.registerCsiHandler({final:"Z"},(P=>this.cursorBackwardTab(P))),this._parser.registerCsiHandler({final:"`"},(P=>this.charPosAbsolute(P))),this._parser.registerCsiHandler({final:"a"},(P=>this.hPositionRelative(P))),this._parser.registerCsiHandler({final:"b"},(P=>this.repeatPrecedingCharacter(P))),this._parser.registerCsiHandler({final:"c"},(P=>this.sendDeviceAttributesPrimary(P))),this._parser.registerCsiHandler({prefix:">",final:"c"},(P=>this.sendDeviceAttributesSecondary(P))),this._parser.registerCsiHandler({final:"d"},(P=>this.linePosAbsolute(P))),this._parser.registerCsiHandler({final:"e"},(P=>this.vPositionRelative(P))),this._parser.registerCsiHandler({final:"f"},(P=>this.hVPosition(P))),this._parser.registerCsiHandler({final:"g"},(P=>this.tabClear(P))),this._parser.registerCsiHandler({final:"h"},(P=>this.setMode(P))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(P=>this.setModePrivate(P))),this._parser.registerCsiHandler({final:"l"},(P=>this.resetMode(P))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(P=>this.resetModePrivate(P))),this._parser.registerCsiHandler({final:"m"},(P=>this.charAttributes(P))),this._parser.registerCsiHandler({final:"n"},(P=>this.deviceStatus(P))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(P=>this.deviceStatusPrivate(P))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(P=>this.softReset(P))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(P=>this.setCursorStyle(P))),this._parser.registerCsiHandler({final:"r"},(P=>this.setScrollRegion(P))),this._parser.registerCsiHandler({final:"s"},(P=>this.saveCursor(P))),this._parser.registerCsiHandler({final:"t"},(P=>this.windowOptions(P))),this._parser.registerCsiHandler({final:"u"},(P=>this.restoreCursor(P))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(P=>this.insertColumns(P))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(P=>this.deleteColumns(P))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(P=>this.selectProtected(P))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(P=>this.requestMode(P,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(P=>this.requestMode(P,!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 R.OscHandler((P=>(this.setTitle(P),this.setIconName(P),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((P=>this.setIconName(P)))),this._parser.registerOscHandler(2,new R.OscHandler((P=>this.setTitle(P)))),this._parser.registerOscHandler(4,new R.OscHandler((P=>this.setOrReportIndexedColor(P)))),this._parser.registerOscHandler(8,new R.OscHandler((P=>this.setHyperlink(P)))),this._parser.registerOscHandler(10,new R.OscHandler((P=>this.setOrReportFgColor(P)))),this._parser.registerOscHandler(11,new R.OscHandler((P=>this.setOrReportBgColor(P)))),this._parser.registerOscHandler(12,new R.OscHandler((P=>this.setOrReportCursorColor(P)))),this._parser.registerOscHandler(104,new R.OscHandler((P=>this.restoreIndexedColor(P)))),this._parser.registerOscHandler(110,new R.OscHandler((P=>this.restoreFgColor(P)))),this._parser.registerOscHandler(111,new R.OscHandler((P=>this.restoreBgColor(P)))),this._parser.registerOscHandler(112,new R.OscHandler((P=>this.restoreCursorColor(P)))),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 P in m.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:P},(()=>this.selectCharset("("+P))),this._parser.registerEscHandler({intermediates:")",final:P},(()=>this.selectCharset(")"+P))),this._parser.registerEscHandler({intermediates:"*",final:P},(()=>this.selectCharset("*"+P))),this._parser.registerEscHandler({intermediates:"+",final:P},(()=>this.selectCharset("+"+P))),this._parser.registerEscHandler({intermediates:"-",final:P},(()=>this.selectCharset("-"+P))),this._parser.registerEscHandler({intermediates:".",final:P},(()=>this.selectCharset("."+P))),this._parser.registerEscHandler({intermediates:"/",final:P},(()=>this.selectCharset("/"+P)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((P=>(this._logService.error("Parsing error: ",P),P))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new N.DcsHandler(((P,ee)=>this.requestStatusString(P,ee))))}_preserveStack(O,M,j,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=O,this._parseStack.cursorStartY=M,this._parseStack.decodedLength=j,this._parseStack.position=$}_logSlowResolvingAsync(O){this._logService.logLevel<=D.LogLevelEnum.WARN&&Promise.race([O,new Promise(((M,j)=>setTimeout((()=>j("#SLOW_TIMEOUT")),5e3)))]).catch((M=>{if(M!=="#SLOW_TIMEOUT")throw M;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(O,M){let j,$=this._activeBuffer.x,U=this._activeBuffer.y,Q=0;const ie=this._parseStack.paused;if(ie){if(j=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,M))return this._logSlowResolvingAsync(j),j;$=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,O.length>F&&(Q=this._parseStack.position+F)}if(this._logService.logLevel<=D.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof O=="string"?` "${O}"`:` "${Array.prototype.map.call(O,(P=>String.fromCharCode(P))).join("")}"`),typeof O=="string"?O.split("").map((P=>P.charCodeAt(0))):O),this._parseBuffer.lengthF)for(let P=Q;P0&&te.getWidth(this._activeBuffer.x-1)===2&&te.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ee);let pe=this._parser.precedingJoinState;for(let ue=M;uese){if(Z){const ye=te;let be=this._activeBuffer.x-le;for(this._activeBuffer.x=le,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),te=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),le>0&&te instanceof y.BufferLine&&te.copyCellsFrom(ye,be,0,le,!1);be=0;)te.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}else if(P&&(te.insertCells(this._activeBuffer.x,U-le,this._activeBuffer.getNullCell(ee)),te.getWidth(se-1)===2&&te.setCellFromCodepoint(se-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,ee)),te.setCellFromCodepoint(this._activeBuffer.x++,$,U,ee),U>0)for(;--U;)te.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}this._parser.precedingJoinState=pe,this._activeBuffer.x0&&te.getWidth(this._activeBuffer.x)===0&&!te.hasContent(this._activeBuffer.x)&&te.setCellFromCodepoint(this._activeBuffer.x,0,1,ee),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(O,M){return O.final!=="t"||O.prefix||O.intermediates?this._parser.registerCsiHandler(O,M):this._parser.registerCsiHandler(O,(j=>!V(j.params[0],this._optionsService.rawOptions.windowOptions)||M(j)))}registerDcsHandler(O,M){return this._parser.registerDcsHandler(O,new N.DcsHandler(M))}registerEscHandler(O,M){return this._parser.registerEscHandler(O,M)}registerOscHandler(O,M){return this._parser.registerOscHandler(O,new R.OscHandler(M))}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 M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);M.hasWidth(this._activeBuffer.x)&&!M.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,M){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=O,this._activeBuffer.y=this._activeBuffer.scrollTop+M):(this._activeBuffer.x=O,this._activeBuffer.y=M),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(O,M){this._restrictCursor(),this._setCursor(this._activeBuffer.x+O,this._activeBuffer.y+M)}cursorUp(O){const M=this._activeBuffer.y-this._activeBuffer.scrollTop;return M>=0?this._moveCursor(0,-Math.min(M,O.params[0]||1)):this._moveCursor(0,-(O.params[0]||1)),!0}cursorDown(O){const M=this._activeBuffer.scrollBottom-this._activeBuffer.y;return M>=0?this._moveCursor(0,Math.min(M,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 M=O.params[0];return M===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:M===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=O.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=O.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(O){const M=O.params[0];return M===1&&(this._curAttrData.bg|=536870912),M!==2&&M!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(O,M,j,$=!1,U=!1){const Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);Q.replaceCells(M,j,this._activeBuffer.getNullCell(this._eraseAttrData()),U),$&&(Q.isWrapped=!1)}_resetBufferLine(O,M=!1){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);j&&(j.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),M),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+O),j.isWrapped=!1)}eraseInDisplay(O,M=!1){let j;switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:for(j=this._activeBuffer.y,this._dirtyRowTracker.markDirty(j),this._eraseInBufferLine(j++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);j=this._bufferService.cols&&(this._activeBuffer.lines.get(j+1).isWrapped=!1);j--;)this._resetBufferLine(j,M);this._dirtyRowTracker.markDirty(0);break;case 2:for(j=this._bufferService.rows,this._dirtyRowTracker.markDirty(j-1);j--;)this._resetBufferLine(j,M);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(O,M=!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,M);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,M);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,M)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(O){this._restrictCursor();let M=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 Z=se;for(let P=1;P0||(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 M=0;Mwe?1:2,pe=O.params[0];return ue=pe,me=M?pe===2?4:pe===4?te(Q.modes.insertMode):pe===12?3:pe===20?te(ee.convertEol):0:pe===1?te(j.applicationCursorKeys):pe===3?ee.windowOptions.setWinLines?se===80?2:se===132?1:0:0:pe===6?te(j.origin):pe===7?te(j.wraparound):pe===8?3:pe===9?te($==="X10"):pe===12?te(ee.cursorBlink):pe===25?te(!Q.isCursorHidden):pe===45?te(j.reverseWraparound):pe===66?te(j.applicationKeypad):pe===67?4:pe===1e3?te($==="VT200"):pe===1002?te($==="DRAG"):pe===1003?te($==="ANY"):pe===1004?te(j.sendFocus):pe===1005?4:pe===1006?te(U==="SGR"):pe===1015?4:pe===1016?te(U==="SGR_PIXELS"):pe===1048?1:pe===47||pe===1047||pe===1049?te(Z===P):pe===2004?te(j.bracketedPasteMode):0,Q.triggerDataEvent(`${d.C0.ESC}[${M?"":"?"}${ue};${me}$y`),!0;var ue,me}_updateAttrColor(O,M,j,$,U){return M===2?(O|=50331648,O&=-16777216,O|=k.AttributeData.fromColorRGB([j,$,U])):M===5&&(O&=-50331904,O|=33554432|255&j),O}_extractColor(O,M,j){const $=[0,0,-1,0,0,0];let U=0,Q=0;do{if($[Q+U]=O.params[M+Q],O.hasSubParams(M+Q)){const ie=O.getSubParams(M+Q);let se=0;do $[1]===5&&(U=1),$[Q+se+1+U]=ie[se];while(++se=2||$[1]===2&&Q+U>=5)break;$[1]&&(U=1)}while(++Q+M5)&&(O=1),M.extended.underlineStyle=O,M.fg|=268435456,O===0&&(M.fg&=-268435457),M.updateExtended()}_processSGR0(O){O.fg=y.DEFAULT_ATTR_DATA.fg,O.bg=y.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 M=O.length;let j;const $=this._curAttrData;for(let U=0;U=30&&j<=37?($.fg&=-50331904,$.fg|=16777216|j-30):j>=40&&j<=47?($.bg&=-50331904,$.bg|=16777216|j-40):j>=90&&j<=97?($.fg&=-50331904,$.fg|=16777224|j-90):j>=100&&j<=107?($.bg&=-50331904,$.bg|=16777224|j-100):j===0?this._processSGR0($):j===1?$.fg|=134217728:j===3?$.bg|=67108864:j===4?($.fg|=268435456,this._processUnderline(O.hasSubParams(U)?O.getSubParams(U)[0]:1,$)):j===5?$.fg|=536870912:j===7?$.fg|=67108864:j===8?$.fg|=1073741824:j===9?$.fg|=2147483648:j===2?$.bg|=134217728:j===21?this._processUnderline(2,$):j===22?($.fg&=-134217729,$.bg&=-134217729):j===23?$.bg&=-67108865:j===24?($.fg&=-268435457,this._processUnderline(0,$)):j===25?$.fg&=-536870913:j===27?$.fg&=-67108865:j===28?$.fg&=-1073741825:j===29?$.fg&=2147483647:j===39?($.fg&=-67108864,$.fg|=16777215&y.DEFAULT_ATTR_DATA.fg):j===49?($.bg&=-67108864,$.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):j===38||j===48||j===58?U+=this._extractColor(O,U,$):j===53?$.bg|=1073741824:j===55?$.bg&=-1073741825:j===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):j===100?($.fg&=-67108864,$.fg|=16777215&y.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&y.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",j);return!0}deviceStatus(O){switch(O.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const M=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${M};${j}R`)}return!0}deviceStatusPrivate(O){if(O.params[0]===6){const M=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${M};${j}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=y.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 M=O.params[0]||1;switch(M){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 j=M%2==1;return this._optionsService.options.cursorBlink=j,!0}setScrollRegion(O){const M=O.params[0]||1;let j;return(O.length<2||(j=O.params[1])>this._bufferService.rows||j===0)&&(j=this._bufferService.rows),j>M&&(this._activeBuffer.scrollTop=M-1,this._activeBuffer.scrollBottom=j-1,this._setCursor(0,0)),!0}windowOptions(O){if(!V(O.params[0],this._optionsService.rawOptions.windowOptions))return!0;const M=O.length>1?O.params[1]:0;switch(O.params[0]){case 14:M!==2&&this._onRequestWindowsOptionsReport.fire(H.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(H.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:M!==0&&M!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),M!==0&&M!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:M!==0&&M!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),M!==0&&M!==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 M=[],j=O.split(";");for(;j.length>1;){const $=j.shift(),U=j.shift();if(/^\d+$/.exec($)){const Q=parseInt($);if(X(Q))if(U==="?")M.push({type:0,index:Q});else{const ie=(0,L.parseColor)(U);ie&&M.push({type:1,index:Q,color:ie})}}}return M.length&&this._onColor.fire(M),!0}setHyperlink(O){const M=O.split(";");return!(M.length<2)&&(M[1]?this._createHyperlink(M[0],M[1]):!M[0]&&this._finishHyperlink())}_createHyperlink(O,M){this._getCurrentLinkId()&&this._finishHyperlink();const j=O.split(":");let $;const U=j.findIndex((Q=>Q.startsWith("id=")));return U!==-1&&($=j[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,uri:M}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(O,M){const j=O.split(";");for(let $=0;$=this._specialColors.length);++$,++M)if(j[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[M]}]);else{const U=(0,L.parseColor)(j[$]);U&&this._onColor.fire([{type:1,index:this._specialColors[M],color:U}])}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 M=[],j=O.split(";");for(let $=0;$=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=y.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=y.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 v.CellData;O.content=4194373,O.fg=this._curAttrData.fg,O.bg=this._curAttrData.bg,this._setCursor(0,0);for(let M=0;M(this._coreService.triggerDataEvent(`${d.C0.ESC}${U}${d.C0.ESC}\\`),!0))(O==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:O==='"p'?'P1$r61;1"p':O==="r"?`P1$r${j.scrollTop+1};${j.scrollBottom+1}r`:O==="m"?"P1$r0m":O===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(O,M){this._dirtyRowTracker.markRangeDirty(O,M)}}o.InputHandler=q;let G=class{constructor(K){this._bufferService=K,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(K){Kthis.end&&(this.end=K)}markRangeDirty(K,O){K>O&&(z=K,K=O,O=z),Kthis.end&&(this.end=O)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(K){return 0<=K&&K<256}G=f([g(0,D.IBufferService)],G)},844:(c,o)=>{function u(f){for(const g of f)g.dispose();f.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 f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const g=this._disposables.indexOf(f);g!==-1&&this._disposables.splice(g,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var g;this._isDisposed||f===this._value||((g=this._value)==null||g.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},o.toDisposable=function(f){return{dispose:f}},o.disposeArray=u,o.getDisposeArrayDisposable=function(f){return{dispose:()=>u(f)}}},1505:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(g,d,m){this._data[g]||(this._data[g]={}),this._data[g][d]=m}get(g,d){return this._data[g]?this._data[g][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=u,o.FourKeyMap=class{constructor(){this._data=new u}set(f,g,d,m,_){this._data.get(f,g)||this._data.set(f,g,new u),this._data.get(f,g).set(d,m,_)}get(f,g,d,m){var _;return(_=this._data.get(f,g))==null?void 0:_.get(d,m)}clear(){this._data.clear()}}},6114:(c,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 u=o.isNode?"node":navigator.userAgent,f=o.isNode?"node":navigator.platform;o.isFirefox=u.includes("Firefox"),o.isLegacyEdge=u.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(u),o.getSafariVersion=function(){if(!o.isSafari)return 0;const g=u.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),o.isIpad=f==="iPad",o.isIphone=f==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),o.isLinux=f.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(u)},6106:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let u=0;o.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(u=this._search(this._getKey(f)),this._array.splice(u,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const g=this._getKey(f);if(g===void 0||(u=this._search(g),u===-1)||this._getKey(this._array[u])!==g)return!1;do if(this._array[u]===f)return this._array.splice(u,1),!0;while(++u=this._array.length)&&this._getKey(this._array[u])===f))do yield this._array[u];while(++u=this._array.length)&&this._getKey(this._array[u])===f))do g(this._array[u]);while(++u=g;){let m=g+d>>1;const _=this._getKey(this._array[m]);if(_>f)d=m-1;else{if(!(_0&&this._getKey(this._array[m-1])===f;)m--;return m}g=m+1}}return g}}},7226:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const f=u(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),this._start()}flush(){for(;this._ib)return y-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(y-w))}ms`),void this._start();y=b}this.clear()}}class d extends g{_requestCallback(_){return setTimeout((()=>_(this._createDeadline(16))))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const w=Date.now()+_;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(m){return requestIdleCallback(m)}_cancelCallback(m){cancelIdleCallback(m)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(m){this._queue.clear(),this._queue.enqueue(m)}flush(){this._queue.flush()}}},9282:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const f=u(643);o.updateWindowsModeWrappedState=function(g){const d=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),m=d==null?void 0:d.get(g.cols-1),_=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);_&&m&&(_.isWrapped=m[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&m[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class u{constructor(){this.fg=0,this.bg=0,this.extended=new f}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 u;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=u;class f{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,m=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=m}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=f},9092:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const f=u(6349),g=u(7226),d=u(3734),m=u(8437),_=u(4634),w=u(511),C=u(643),y=u(4863),b=u(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(x,v,k){this._hasScrollback=x,this._optionsService=v,this._bufferService=k,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=m.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(x){return x?(this._nullCell.fg=x.fg,this._nullCell.bg=x.bg,this._nullCell.extended=x.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(x){return x?(this._whitespaceCell.fg=x.fg,this._whitespaceCell.bg=x.bg,this._whitespaceCell.extended=x.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,v){return new m.BufferLine(this._bufferService.cols,this.getNullCell(x),v)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&xo.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:v}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=m.DEFAULT_ATTR_DATA);let v=this._rows;for(;v--;)this.lines.push(this.getBlankLine(x))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(x,v){const k=this.getNullCell(m.DEFAULT_ATTR_DATA);let D=0;const T=this._getCorrectBufferLength(v);if(T>this.lines.maxLength&&(this.lines.maxLength=T),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+R+1?(this.ybase--,R++,this.ydisp>0&&this.ydisp--):this.lines.push(new m.BufferLine(x,k)));else for(let N=this._rows;N>v;N--)this.lines.length>v+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(T0&&(this.lines.trimStart(N),this.ybase=Math.max(this.ybase-N,0),this.ydisp=Math.max(this.ydisp-N,0),this.savedY=Math.max(this.savedY-N,0)),this.lines.maxLength=T}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,v-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=v-1,this._isReflowEnabled&&(this._reflow(x,v),this._cols>x))for(let R=0;R.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let x=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,x=!1);let v=0;for(;this._memoryCleanupPosition100)return!0;return x}get _isReflowEnabled(){const x=this._optionsService.rawOptions.windowsPty;return x&&x.buildNumber?this._hasScrollback&&x.backend==="conpty"&&x.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(x,v){this._cols!==x&&(x>this._cols?this._reflowLarger(x,v):this._reflowSmaller(x,v))}_reflowLarger(x,v){const k=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(m.DEFAULT_ATTR_DATA));if(k.length>0){const D=(0,_.reflowLargerCreateNewLayout)(this.lines,k);(0,_.reflowLargerApplyNewLayout)(this.lines,D.layout),this._reflowLargerAdjustViewport(x,v,D.countRemoved)}}_reflowLargerAdjustViewport(x,v,k){const D=this.getNullCell(m.DEFAULT_ATTR_DATA);let T=k;for(;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;R--){let N=this.lines.get(R);if(!N||!N.isWrapped&&N.getTrimmedLength()<=x)continue;const L=[N];for(;N.isWrapped&&R>0;)N=this.lines.get(--R),L.unshift(N);const I=this.ybase+this.y;if(I>=R&&I0&&(D.push({start:R+L.length+T,newLines:q}),T+=q.length),L.push(...q);let G=V.length-1,X=V[G];X===0&&(G--,X=V[G]);let K=L.length-H-1,O=F;for(;K>=0;){const j=Math.min(O,X);if(L[G]===void 0)break;if(L[G].copyCellsFrom(L[K],O-j,X-j,j,!0),X-=j,X===0&&(G--,X=V[G]),O-=j,O===0){K--;const $=Math.max(K,0);O=(0,_.getWrappedLineTrimmedLength)(L,$,this._cols)}}for(let j=0;j0;)this.ybase===0?this.y0){const R=[],N=[];for(let G=0;G=0;G--)if(V&&V.start>I+H){for(let X=V.newLines.length-1;X>=0;X--)this.lines.set(G--,V.newLines[X]);G++,R.push({index:I+1,amount:V.newLines.length}),H+=V.newLines.length,V=D[++F]}else this.lines.set(G,N[I--]);let z=0;for(let G=R.length-1;G>=0;G--)R[G].index+=z,this.lines.onInsertEmitter.fire(R[G]),z+=R[G].amount;const q=Math.max(0,L+T-this.lines.maxLength);q>0&&this.lines.onTrimEmitter.fire(q)}}translateBufferLineToString(x,v,k=0,D){const T=this.lines.get(x);return T?T.translateToString(v,k,D):""}getWrappedRangeForLine(x){let v=x,k=x;for(;v>0&&this.lines.get(v).isWrapped;)v--;for(;k+10;);return x>=this._cols?this._cols-1:x<0?0:x}nextStop(x){for(x==null&&(x=this.x);!this.tabs[++x]&&x=this._cols?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let v=0;v{v.line-=k,v.line<0&&v.dispose()}))),v.register(this.lines.onInsert((k=>{v.line>=k.index&&(v.line+=k.amount)}))),v.register(this.lines.onDelete((k=>{v.line>=k.index&&v.linek.index&&(v.line-=k.amount)}))),v.register(v.onDispose((()=>this._removeMarker(v)))),v}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const f=u(3734),g=u(511),d=u(643),m=u(482);o.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let _=0;class w{constructor(y,b,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*y);const v=b||g.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let k=0;k>22,2097152&b?this._combined[y].charCodeAt(this._combined[y].length-1):x]}set(y,b){this._data[3*y+1]=b[d.CHAR_DATA_ATTR_INDEX],b[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[y]=b[1],this._data[3*y+0]=2097152|y|b[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*y+0]=b[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(y){return this._data[3*y+0]>>22}hasWidth(y){return 12582912&this._data[3*y+0]}getFg(y){return this._data[3*y+1]}getBg(y){return this._data[3*y+2]}hasContent(y){return 4194303&this._data[3*y+0]}getCodePoint(y){const b=this._data[3*y+0];return 2097152&b?this._combined[y].charCodeAt(this._combined[y].length-1):2097151&b}isCombined(y){return 2097152&this._data[3*y+0]}getString(y){const b=this._data[3*y+0];return 2097152&b?this._combined[y]:2097151&b?(0,m.stringFromCodePoint)(2097151&b):""}isProtected(y){return 536870912&this._data[3*y+2]}loadCell(y,b){return _=3*y,b.content=this._data[_+0],b.fg=this._data[_+1],b.bg=this._data[_+2],2097152&b.content&&(b.combinedData=this._combined[y]),268435456&b.bg&&(b.extended=this._extendedAttrs[y]),b}setCell(y,b){2097152&b.content&&(this._combined[y]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[y]=b.extended),this._data[3*y+0]=b.content,this._data[3*y+1]=b.fg,this._data[3*y+2]=b.bg}setCellFromCodepoint(y,b,x,v){268435456&v.bg&&(this._extendedAttrs[y]=v.extended),this._data[3*y+0]=b|x<<22,this._data[3*y+1]=v.fg,this._data[3*y+2]=v.bg}addCodepointToCell(y,b,x){let v=this._data[3*y+0];2097152&v?this._combined[y]+=(0,m.stringFromCodePoint)(b):2097151&v?(this._combined[y]=(0,m.stringFromCodePoint)(2097151&v)+(0,m.stringFromCodePoint)(b),v&=-2097152,v|=2097152):v=b|4194304,x&&(v&=-12582913,v|=x<<22),this._data[3*y+0]=v}insertCells(y,b,x){if((y%=this.length)&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y-1,0,1,x),b=0;--k)this.setCell(y+b+k,this.loadCell(y+k,v));for(let k=0;kthis.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const v=new Uint32Array(x);v.set(this._data),this._data=v}for(let v=this.length;v=y&&delete this._combined[T]}const k=Object.keys(this._extendedAttrs);for(let D=0;D=y&&delete this._extendedAttrs[T]}}return this.length=y,4*x*2=0;--y)if(4194303&this._data[3*y+0])return y+(this._data[3*y+0]>>22);return 0}getNoBgTrimmedLength(){for(let y=this.length-1;y>=0;--y)if(4194303&this._data[3*y+0]||50331648&this._data[3*y+2])return y+(this._data[3*y+0]>>22);return 0}copyCellsFrom(y,b,x,v,k){const D=y._data;if(k)for(let R=v-1;R>=0;R--){for(let N=0;N<3;N++)this._data[3*(x+R)+N]=D[3*(b+R)+N];268435456&D[3*(b+R)+2]&&(this._extendedAttrs[x+R]=y._extendedAttrs[b+R])}else for(let R=0;R=b&&(this._combined[N-b+x]=y._combined[N])}}translateToString(y,b,x,v){b=b??0,x=x??this.length,y&&(x=Math.min(x,this.getTrimmedLength())),v&&(v.length=0);let k="";for(;b>22||1}return v&&v.push(b),k}}o.BufferLine=w},4841:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(u,f){if(u.start.y>u.end.y)throw new Error(`Buffer range end (${u.end.x}, ${u.end.y}) cannot be before start (${u.start.x}, ${u.start.y})`);return f*(u.end.y-u.start.y)+(u.end.x-u.start.x+1)}},4634:(c,o)=>{function u(f,g,d){if(g===f.length-1)return f[g].getTrimmedLength();const m=!f[g].hasContent(d-1)&&f[g].getWidth(d-1)===1,_=f[g+1].getWidth(0)===2;return 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(f,g,d,m,_){const w=[];for(let C=0;C=C&&m0&&(N>v||x[N].getTrimmedLength()===0);N--)R++;R>0&&(w.push(C+x.length-R),w.push(R)),C+=x.length-1}return w},o.reflowLargerCreateNewLayout=function(f,g){const d=[];let m=0,_=g[m],w=0;for(let C=0;Cu(f,x,g))).reduce(((b,x)=>b+x));let w=0,C=0,y=0;for(;y<_;){if(_-yb&&(w-=b,C++);const x=f[C].getWidth(w-1)===2;x&&w--;const v=x?d-1:d;m.push(v),y+=v}return m},o.getWrappedLineTrimmedLength=u},5295:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const f=u(8460),g=u(844),d=u(9092);class m extends g.Disposable{constructor(w,C){super(),this._optionsService=w,this._bufferService=C,this._onBufferActivate=this.register(new f.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(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),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(w,C){this._normal.resize(w,C),this._alt.resize(w,C),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}o.BufferSet=m},511:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const f=u(482),g=u(643),d=u(3734);class m extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(w){const C=new m;return C.setFromCharData(w),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(w[g.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(w[g.CHAR_DATA_CHAR_INDEX].length===2){const y=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=y&&y<=56319){const b=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(y-55296)+b-56320+65536|w[g.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[g.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=w[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=m},643:(c,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:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const f=u(8460),g=u(844);class d{get id(){return this._id}constructor(_){this.line=_,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}o.Marker=d,d._nextId=1},7116:(c,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:(c,o)=>{var u,f,g;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=""})(u||(o.C0=u={})),(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="Ÿ"})(f||(o.C1=f={})),(function(d){d.ST=`${u.ESC}\\`})(g||(o.C1_ESCAPED=g={}))},7399:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const f=u(2584),g={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,m,_,w){const C={type:0,cancel:!1,key:void 0},y=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?C.key=m?f.C0.ESC+"OA":f.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?C.key=m?f.C0.ESC+"OD":f.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?C.key=m?f.C0.ESC+"OC":f.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(C.key=m?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:C.key=d.ctrlKey?"\b":f.C0.DEL,d.altKey&&(C.key=f.C0.ESC+C.key);break;case 9:if(d.shiftKey){C.key=f.C0.ESC+"[Z";break}C.key=f.C0.HT,C.cancel=!0;break;case 13:C.key=d.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,C.cancel=!0;break;case 27:C.key=f.C0.ESC,d.altKey&&(C.key=f.C0.ESC+f.C0.ESC),C.cancel=!0;break;case 37:if(d.metaKey)break;y?(C.key=f.C0.ESC+"[1;"+(y+1)+"D",C.key===f.C0.ESC+"[1;3D"&&(C.key=f.C0.ESC+(_?"b":"[1;5D"))):C.key=m?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(d.metaKey)break;y?(C.key=f.C0.ESC+"[1;"+(y+1)+"C",C.key===f.C0.ESC+"[1;3C"&&(C.key=f.C0.ESC+(_?"f":"[1;5C"))):C.key=m?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(d.metaKey)break;y?(C.key=f.C0.ESC+"[1;"+(y+1)+"A",_||C.key!==f.C0.ESC+"[1;3A"||(C.key=f.C0.ESC+"[1;5A")):C.key=m?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(d.metaKey)break;y?(C.key=f.C0.ESC+"[1;"+(y+1)+"B",_||C.key!==f.C0.ESC+"[1;3B"||(C.key=f.C0.ESC+"[1;5B")):C.key=m?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(C.key=f.C0.ESC+"[2~");break;case 46:C.key=y?f.C0.ESC+"[3;"+(y+1)+"~":f.C0.ESC+"[3~";break;case 36:C.key=y?f.C0.ESC+"[1;"+(y+1)+"H":m?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:C.key=y?f.C0.ESC+"[1;"+(y+1)+"F":m?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:d.shiftKey?C.type=2:d.ctrlKey?C.key=f.C0.ESC+"[5;"+(y+1)+"~":C.key=f.C0.ESC+"[5~";break;case 34:d.shiftKey?C.type=3:d.ctrlKey?C.key=f.C0.ESC+"[6;"+(y+1)+"~":C.key=f.C0.ESC+"[6~";break;case 112:C.key=y?f.C0.ESC+"[1;"+(y+1)+"P":f.C0.ESC+"OP";break;case 113:C.key=y?f.C0.ESC+"[1;"+(y+1)+"Q":f.C0.ESC+"OQ";break;case 114:C.key=y?f.C0.ESC+"[1;"+(y+1)+"R":f.C0.ESC+"OR";break;case 115:C.key=y?f.C0.ESC+"[1;"+(y+1)+"S":f.C0.ESC+"OS";break;case 116:C.key=y?f.C0.ESC+"[15;"+(y+1)+"~":f.C0.ESC+"[15~";break;case 117:C.key=y?f.C0.ESC+"[17;"+(y+1)+"~":f.C0.ESC+"[17~";break;case 118:C.key=y?f.C0.ESC+"[18;"+(y+1)+"~":f.C0.ESC+"[18~";break;case 119:C.key=y?f.C0.ESC+"[19;"+(y+1)+"~":f.C0.ESC+"[19~";break;case 120:C.key=y?f.C0.ESC+"[20;"+(y+1)+"~":f.C0.ESC+"[20~";break;case 121:C.key=y?f.C0.ESC+"[21;"+(y+1)+"~":f.C0.ESC+"[21~";break;case 122:C.key=y?f.C0.ESC+"[23;"+(y+1)+"~":f.C0.ESC+"[23~";break;case 123:C.key=y?f.C0.ESC+"[24;"+(y+1)+"~":f.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(_&&!w||!d.altKey||d.metaKey)!_||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?C.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(C.key=f.C0.US),d.key==="@"&&(C.key=f.C0.NUL)):d.keyCode===65&&(C.type=1);else{const b=g[d.keyCode],x=b==null?void 0:b[d.shiftKey?1:0];if(x)C.key=f.C0.ESC+x;else if(d.keyCode>=65&&d.keyCode<=90){const v=d.ctrlKey?d.keyCode-64:d.keyCode+32;let k=String.fromCharCode(v);d.shiftKey&&(k=k.toUpperCase()),C.key=f.C0.ESC+k}else if(d.keyCode===32)C.key=f.C0.ESC+(d.ctrlKey?f.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let v=d.code.slice(3,4);d.shiftKey||(v=v.toLowerCase()),C.key=f.C0.ESC+v,C.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?C.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?C.key=f.C0.NUL:d.keyCode>=51&&d.keyCode<=55?C.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?C.key=f.C0.DEL:d.keyCode===219?C.key=f.C0.ESC:d.keyCode===220?C.key=f.C0.FS:d.keyCode===221&&(C.key=f.C0.GS)}return C}},482:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(u){return u>65535?(u-=65536,String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):String.fromCharCode(u)},o.utf32ToString=function(u,f=0,g=u.length){let d="";for(let m=f;m65535?(_-=65536,d+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):d+=String.fromCharCode(_)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(u,f){const g=u.length;if(!g)return 0;let d=0,m=0;if(this._interim){const _=u.charCodeAt(m++);56320<=_&&_<=57343?f[d++]=1024*(this._interim-55296)+_-56320+65536:(f[d++]=this._interim,f[d++]=_),this._interim=0}for(let _=m;_=g)return this._interim=w,d;const C=u.charCodeAt(_);56320<=C&&C<=57343?f[d++]=1024*(w-55296)+C-56320+65536:(f[d++]=w,f[d++]=C)}else w!==65279&&(f[d++]=w)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(u,f){const g=u.length;if(!g)return 0;let d,m,_,w,C=0,y=0,b=0;if(this.interim[0]){let k=!1,D=this.interim[0];D&=(224&D)==192?31:(240&D)==224?15:7;let T,R=0;for(;(T=63&this.interim[++R])&&R<4;)D<<=6,D|=T;const N=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=N-R;for(;b=g)return 0;if(T=u[b++],(192&T)!=128){b--,k=!0;break}this.interim[R++]=T,D<<=6,D|=63&T}k||(N===2?D<128?b--:f[C++]=D:N===3?D<2048||D>=55296&&D<=57343||D===65279||(f[C++]=D):D<65536||D>1114111||(f[C++]=D)),this.interim.fill(0)}const x=g-4;let v=b;for(;v=g)return this.interim[0]=d,C;if(m=u[v++],(192&m)!=128){v--;continue}if(y=(31&d)<<6|63&m,y<128){v--;continue}f[C++]=y}else if((240&d)==224){if(v>=g)return this.interim[0]=d,C;if(m=u[v++],(192&m)!=128){v--;continue}if(v>=g)return this.interim[0]=d,this.interim[1]=m,C;if(_=u[v++],(192&_)!=128){v--;continue}if(y=(15&d)<<12|(63&m)<<6|63&_,y<2048||y>=55296&&y<=57343||y===65279)continue;f[C++]=y}else if((248&d)==240){if(v>=g)return this.interim[0]=d,C;if(m=u[v++],(192&m)!=128){v--;continue}if(v>=g)return this.interim[0]=d,this.interim[1]=m,C;if(_=u[v++],(192&_)!=128){v--;continue}if(v>=g)return this.interim[0]=d,this.interim[1]=m,this.interim[2]=_,C;if(w=u[v++],(192&w)!=128){v--;continue}if(y=(7&d)<<18|(63&m)<<12|(63&_)<<6|63&w,y<65536||y>1114111)continue;f[C++]=y}}return C}}},225:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const f=u(1480),g=[[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 m;o.UnicodeV6=class{constructor(){if(this.version="6",!m){m=new Uint8Array(65536),m.fill(1),m[0]=0,m.fill(0,1,32),m.fill(0,127,160),m.fill(2,4352,4448),m[9001]=2,m[9002]=2,m.fill(2,11904,42192),m[12351]=1,m.fill(2,44032,55204),m.fill(2,63744,64256),m.fill(2,65040,65050),m.fill(2,65072,65136),m.fill(2,65280,65377),m.fill(2,65504,65511);for(let _=0;_C[x][1])return!1;for(;x>=b;)if(y=b+x>>1,w>C[y][1])b=y+1;else{if(!(w=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,w){let C=this.wcwidth(_),y=C===0&&w!==0;if(y){const b=f.UnicodeService.extractWidth(w);b===0?y=!1:b>C&&(C=b)}return f.UnicodeService.createPropertyValue(0,C,y)}}},5981:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const f=u(8460),g=u(844);class d extends g.Disposable{constructor(_){super(),this._action=_,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(_,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const y=this._callbacks.shift();y&&y()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(_,w){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+=_.length,this._writeBuffer.push(_),this._callbacks.push(w),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(w)}_innerWrite(_=0,w=!0){const C=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const y=this._writeBuffer[this._bufferOffset],b=this._action(y,w);if(b){const v=k=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(C,k);return void b.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(v)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=y.length,Date.now()-C>=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:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const u=/^([\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})$/,f=/^[\da-f]+$/;function g(d,m){const _=d.toString(16),w=_.length<2?"0"+_:_;switch(m){case 4:return _[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}o.parseColor=function(d){if(!d)return;let m=d.toLowerCase();if(m.indexOf("rgb:")===0){m=m.slice(4);const _=u.exec(m);if(_){const w=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/w*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/w*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/w*255)]}}else if(m.indexOf("#")===0&&(m=m.slice(1),f.exec(m)&&[3,6,9,12].includes(m.length))){const _=m.length/3,w=[0,0,0];for(let C=0;C<3;++C){const y=parseInt(m.slice(_*C,_*C+_),16);w[C]=_===1?y<<4:_===2?y:_===3?y>>4:y>>8}return w}},o.toRgbString=function(d,m=16){const[_,w,C]=d;return`rgb:${g(_,m)}/${g(w,m)}/${g(C,m)}`}},5770:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const f=u(482),g=u(8742),d=u(5770),m=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=m,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}registerHandler(w,C){this._handlers[w]===void 0&&(this._handlers[w]=[]);const y=this._handlers[w];return y.push(C),{dispose:()=>{const b=y.indexOf(C);b!==-1&&y.splice(b,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=m,this._ident=0}hook(w,C){if(this.reset(),this._ident=w,this._active=this._handlers[w]||m,this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(w,C,y){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(w,C,y);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(w,C,y))}unhook(w,C=!0){if(this._active.length){let y=!1,b=this._active.length-1,x=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,y=C,x=this._stack.fallThrough,this._stack.paused=!1),!x&&y===!1){for(;b>=0&&(y=this._active[b].unhook(w),y!==!0);b--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,y;b--}for(;b>=0;b--)if(y=this._active[b].unhook(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,y}else this._handlerFb(this._ident,"UNHOOK",w);this._active=m,this._ident=0}};const _=new g.Params;_.addParam(0),o.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=_,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():_,this._data="",this._hitLimit=!1}put(w,C,y){this._hitLimit||(this._data+=(0,f.utf32ToString)(w,C,y),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let C=!1;if(this._hitLimit)C=!1;else if(w&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((y=>(this._params=_,this._data="",this._hitLimit=!1,y)));return this._params=_,this._data="",this._hitLimit=!1,C}}},2015:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const f=u(844),g=u(8742),d=u(6242),m=u(6351);class _{constructor(b){this.table=new Uint8Array(b)}setDefault(b,x){this.table.fill(b<<4|x)}add(b,x,v,k){this.table[x<<8|b]=v<<4|k}addMany(b,x,v,k){for(let D=0;DN)),x=(R,N)=>b.slice(R,N),v=x(32,127),k=x(0,24);k.push(25),k.push.apply(k,x(28,32));const D=x(0,14);let T;for(T in y.setDefault(1,0),y.addMany(v,0,2,0),D)y.addMany([24,26,153,154],T,3,0),y.addMany(x(128,144),T,3,0),y.addMany(x(144,152),T,3,0),y.add(156,T,0,0),y.add(27,T,11,1),y.add(157,T,4,8),y.addMany([152,158,159],T,0,7),y.add(155,T,11,3),y.add(144,T,11,9);return y.addMany(k,0,3,0),y.addMany(k,1,3,1),y.add(127,1,0,1),y.addMany(k,8,0,8),y.addMany(k,3,3,3),y.add(127,3,0,3),y.addMany(k,4,3,4),y.add(127,4,0,4),y.addMany(k,6,3,6),y.addMany(k,5,3,5),y.add(127,5,0,5),y.addMany(k,2,3,2),y.add(127,2,0,2),y.add(93,1,4,8),y.addMany(v,8,5,8),y.add(127,8,5,8),y.addMany([156,27,24,26,7],8,6,0),y.addMany(x(28,32),8,0,8),y.addMany([88,94,95],1,0,7),y.addMany(v,7,0,7),y.addMany(k,7,0,7),y.add(156,7,0,0),y.add(127,7,0,7),y.add(91,1,11,3),y.addMany(x(64,127),3,7,0),y.addMany(x(48,60),3,8,4),y.addMany([60,61,62,63],3,9,4),y.addMany(x(48,60),4,8,4),y.addMany(x(64,127),4,7,0),y.addMany([60,61,62,63],4,0,6),y.addMany(x(32,64),6,0,6),y.add(127,6,0,6),y.addMany(x(64,127),6,0,0),y.addMany(x(32,48),3,9,5),y.addMany(x(32,48),5,9,5),y.addMany(x(48,64),5,0,6),y.addMany(x(64,127),5,7,0),y.addMany(x(32,48),4,9,5),y.addMany(x(32,48),1,9,2),y.addMany(x(32,48),2,9,2),y.addMany(x(48,127),2,10,0),y.addMany(x(48,80),1,10,0),y.addMany(x(81,88),1,10,0),y.addMany([89,90,92],1,10,0),y.addMany(x(96,127),1,10,0),y.add(80,1,11,9),y.addMany(k,9,0,9),y.add(127,9,0,9),y.addMany(x(28,32),9,0,9),y.addMany(x(32,48),9,9,12),y.addMany(x(48,60),9,8,10),y.addMany([60,61,62,63],9,9,10),y.addMany(k,11,0,11),y.addMany(x(32,128),11,0,11),y.addMany(x(28,32),11,0,11),y.addMany(k,10,0,10),y.add(127,10,0,10),y.addMany(x(28,32),10,0,10),y.addMany(x(48,60),10,8,10),y.addMany([60,61,62,63],10,0,11),y.addMany(x(32,48),10,9,12),y.addMany(k,12,0,12),y.add(127,12,0,12),y.addMany(x(28,32),12,0,12),y.addMany(x(32,48),12,9,12),y.addMany(x(48,64),12,0,11),y.addMany(x(64,127),12,12,13),y.addMany(x(64,127),10,12,13),y.addMany(x(64,127),9,12,13),y.addMany(k,13,13,13),y.addMany(v,13,13,13),y.add(127,13,0,13),y.addMany([27,156,24,26],13,14,0),y.add(w,0,2,0),y.add(w,8,5,8),y.add(w,6,0,6),y.add(w,11,0,11),y.add(w,13,13,13),y})();class C extends f.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 g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,v,k)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,v)=>{},this._escHandlerFb=x=>{},this._errorHandlerFb=x=>x,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.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 m.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,x=[64,126]){let v=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(v=b.prefix.charCodeAt(0),v&&60>v||v>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 D=0;DT||T>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");v<<=8,v|=T}}if(b.final.length!==1)throw new Error("final must be a single byte");const k=b.final.charCodeAt(0);if(x[0]>k||k>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return v<<=8,v|=k,v}identToString(b){const x=[];for(;b;)x.push(String.fromCharCode(255&b)),b>>=8;return x.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,x){const v=this._identifier(b,[48,126]);this._escHandlers[v]===void 0&&(this._escHandlers[v]=[]);const k=this._escHandlers[v];return k.push(x),{dispose:()=>{const D=k.indexOf(x);D!==-1&&k.splice(D,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,x){this._executeHandlers[b.charCodeAt(0)]=x}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,x){const v=this._identifier(b);this._csiHandlers[v]===void 0&&(this._csiHandlers[v]=[]);const k=this._csiHandlers[v];return k.push(x),{dispose:()=>{const D=k.indexOf(x);D!==-1&&k.splice(D,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,x){return this._dcsParser.registerHandler(this._identifier(b),x)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,x){return this._oscParser.registerHandler(b,x)}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,x,v,k,D){this._parseStack.state=b,this._parseStack.handlers=x,this._parseStack.handlerPos=v,this._parseStack.transition=k,this._parseStack.chunkPos=D}parse(b,x,v){let k,D=0,T=0,R=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,R=this._parseStack.chunkPos+1;else{if(v===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const N=this._parseStack.handlers;let L=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(v===!1&&L>-1){for(;L>=0&&(k=N[L](this._params),k!==!0);L--)if(k instanceof Promise)return this._parseStack.handlerPos=L,k}this._parseStack.handlers=[];break;case 4:if(v===!1&&L>-1){for(;L>=0&&(k=N[L](),k!==!0);L--)if(k instanceof Promise)return this._parseStack.handlerPos=L,k}this._parseStack.handlers=[];break;case 6:if(D=b[this._parseStack.chunkPos],k=this._dcsParser.unhook(D!==24&&D!==26,v),k)return k;D===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(D=b[this._parseStack.chunkPos],k=this._oscParser.end(D!==24&&D!==26,v),k)return k;D===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,R=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let N=R;N>4){case 2:for(let H=N+1;;++H){if(H>=x||(D=b[H])<32||D>126&&D=x||(D=b[H])<32||D>126&&D=x||(D=b[H])<32||D>126&&D=x||(D=b[H])<32||D>126&&D=0&&(k=L[I](this._params),k!==!0);I--)if(k instanceof Promise)return this._preserveStack(3,L,I,T,N),k;I<0&&this._csiHandlerFb(this._collect<<8|D,this._params),this.precedingJoinState=0;break;case 8:do switch(D){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(D-48)}while(++N47&&D<60);N--;break;case 9:this._collect<<=8,this._collect|=D;break;case 10:const F=this._escHandlers[this._collect<<8|D];let V=F?F.length-1:-1;for(;V>=0&&(k=F[V](),k!==!0);V--)if(k instanceof Promise)return this._preserveStack(4,F,V,T,N),k;V<0&&this._escHandlerFb(this._collect<<8|D),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|D,this._params);break;case 13:for(let H=N+1;;++H)if(H>=x||(D=b[H])===24||D===26||D===27||D>127&&D=x||(D=b[H])<32||D>127&&D{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const f=u(5770),g=u(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(m,_){this._handlers[m]===void 0&&(this._handlers[m]=[]);const w=this._handlers[m];return w.push(_),{dispose:()=>{const C=w.indexOf(_);C!==-1&&w.splice(C,1)}}}clearHandler(m){this._handlers[m]&&delete this._handlers[m]}setHandlerFallback(m){this._handlerFb=m}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let m=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;m>=0;--m)this._active[m].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 m=this._active.length-1;m>=0;m--)this._active[m].start();else this._handlerFb(this._id,"START")}_put(m,_,w){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(m,_,w);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(m,_,w))}start(){this.reset(),this._state=1}put(m,_,w){if(this._state!==3){if(this._state===1)for(;_0&&this._put(m,_,w)}}end(m,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,C=this._active.length-1,y=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,w=_,y=this._stack.fallThrough,this._stack.paused=!1),!y&&w===!1){for(;C>=0&&(w=this._active[C].end(m),w!==!0);C--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,w;C--}for(;C>=0;C--)if(w=this._active[C].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",m);this._active=d,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(m){this._handler=m,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(m,_,w){this._hitLimit||(this._data+=(0,g.utf32ToString)(m,_,w),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(m){let _=!1;if(this._hitLimit)_=!1;else if(m&&(_=this._handler(this._data),_ instanceof Promise))return _.then((w=>(this._data="",this._hitLimit=!1,w)));return this._data="",this._hitLimit=!1,_}}},8742:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const u=2147483647;class f{static fromArray(d){const m=new f;if(!d.length)return m;for(let _=Array.isArray(d[0])?1:0;_256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(m),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new f(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 m=0;m>8,w=255&this._subParamsIdx[m];w-_>0&&d.push(Array.prototype.slice.call(this._subParams,_,w))}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>u?u: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>u?u:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const m=this._subParamsIdx[d]>>8,_=255&this._subParamsIdx[d];return _-m>0?this._subParams.subarray(m,_):null}getSubParamsAll(){const d={};for(let m=0;m>8,w=255&this._subParamsIdx[m];w-_>0&&(d[m]=this._subParams.slice(_,w))}return d}addDigit(d){let m;if(this._rejectDigits||!(m=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,w=_[m-1];_[m-1]=~w?Math.min(10*w+d,u):d}}o.Params=f},5741:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let u=this._addons.length-1;u>=0;u--)this._addons[u].instance.dispose()}loadAddon(u,f){const g={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(g),f.dispose=()=>this._wrappedAddonDispose(g),f.activate(u)}_wrappedAddonDispose(u){if(u.isDisposed)return;let f=-1;for(let g=0;g{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const f=u(3785),g=u(511);o.BufferApiView=class{constructor(d,m){this._buffer=d,this.type=m}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 m=this._buffer.lines.get(d);if(m)return new f.BufferLineApiView(m)}getNullCell(){return new g.CellData}}},3785:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const f=u(511);o.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,d){if(!(g<0||g>=this._line.length))return d?(this._line.loadCell(g,d),d):this._line.loadCell(g,new f.CellData)}translateToString(g,d,m){return this._line.translateToString(g,d,m)}}},8285:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const f=u(8771),g=u(8460),d=u(844);class m extends d.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.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=m},7975:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(u){this._core=u}registerCsiHandler(u,f){return this._core.registerCsiHandler(u,(g=>f(g.toArray())))}addCsiHandler(u,f){return this.registerCsiHandler(u,f)}registerDcsHandler(u,f){return this._core.registerDcsHandler(u,((g,d)=>f(g,d.toArray())))}addDcsHandler(u,f){return this.registerDcsHandler(u,f)}registerEscHandler(u,f){return this._core.registerEscHandler(u,f)}addEscHandler(u,f){return this.registerEscHandler(u,f)}registerOscHandler(u,f){return this._core.registerOscHandler(u,f)}addOscHandler(u,f){return this.registerOscHandler(u,f)}}},7090:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.UnicodeApi=class{constructor(u){this._core=u}register(u){this._core.unicodeService.register(u)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(u){this._core.unicodeService.activeVersion=u}}},744:function(c,o,u){var f=this&&this.__decorate||function(y,b,x,v){var k,D=arguments.length,T=D<3?b:v===null?v=Object.getOwnPropertyDescriptor(b,x):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(y,b,x,v);else for(var R=y.length-1;R>=0;R--)(k=y[R])&&(T=(D<3?k(T):D>3?k(b,x,T):k(b,x))||T);return D>3&&T&&Object.defineProperty(b,x,T),T},g=this&&this.__param||function(y,b){return function(x,v){b(x,v,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=u(8460),m=u(844),_=u(5295),w=u(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let C=o.BufferService=class extends m.Disposable{get buffer(){return this.buffers.active}constructor(y){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(y.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(y.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(y,this))}resize(y,b){this.cols=y,this.rows=b,this.buffers.resize(y,b),this._onResize.fire({cols:y,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(y,b=!1){const x=this.buffer;let v;v=this._cachedBlankLine,v&&v.length===this.cols&&v.getFg(0)===y.fg&&v.getBg(0)===y.bg||(v=x.getBlankLine(y,b),this._cachedBlankLine=v),v.isWrapped=b;const k=x.ybase+x.scrollTop,D=x.ybase+x.scrollBottom;if(x.scrollTop===0){const T=x.lines.isFull;D===x.lines.length-1?T?x.lines.recycle().copyFrom(v):x.lines.push(v.clone()):x.lines.splice(D+1,0,v.clone()),T?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const T=D-k+1;x.lines.shiftElements(k+1,T-1,-1),x.lines.set(D,v.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(y,b,x){const v=this.buffer;if(y<0){if(v.ydisp===0)return;this.isUserScrolling=!0}else y+v.ydisp>=v.ybase&&(this.isUserScrolling=!1);const k=v.ydisp;v.ydisp=Math.max(Math.min(v.ydisp+y,v.ybase),0),k!==v.ydisp&&(b||this._onScroll.fire(v.ydisp))}};o.BufferService=C=f([g(0,w.IOptionsService)],C)},7994:(c,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(u){this.glevel=u,this.charset=this._charsets[u]}setgCharset(u,f){this._charsets[u]=f,this.glevel===u&&(this.charset=f)}}},1753:function(c,o,u){var f=this&&this.__decorate||function(v,k,D,T){var R,N=arguments.length,L=N<3?k:T===null?T=Object.getOwnPropertyDescriptor(k,D):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(v,k,D,T);else for(var I=v.length-1;I>=0;I--)(R=v[I])&&(L=(N<3?R(L):N>3?R(k,D,L):R(k,D))||L);return N>3&&L&&Object.defineProperty(k,D,L),L},g=this&&this.__param||function(v,k){return function(D,T){k(D,T,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=u(2585),m=u(8460),_=u(844),w={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:v=>v.button!==4&&v.action===1&&(v.ctrl=!1,v.alt=!1,v.shift=!1,!0)},VT200:{events:19,restrict:v=>v.action!==32},DRAG:{events:23,restrict:v=>v.action!==32||v.button!==3},ANY:{events:31,restrict:v=>!0}};function C(v,k){let D=(v.ctrl?16:0)|(v.shift?4:0)|(v.alt?8:0);return v.button===4?(D|=64,D|=v.action):(D|=3&v.button,4&v.button&&(D|=64),8&v.button&&(D|=128),v.action===32?D|=32:v.action!==0||k||(D|=3)),D}const y=String.fromCharCode,b={DEFAULT:v=>{const k=[C(v,!1)+32,v.col+32,v.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${y(k[0])}${y(k[1])}${y(k[2])}`},SGR:v=>{const k=v.action===0&&v.button!==4?"m":"M";return`\x1B[<${C(v,!0)};${v.col};${v.row}${k}`},SGR_PIXELS:v=>{const k=v.action===0&&v.button!==4?"m":"M";return`\x1B[<${C(v,!0)};${v.x};${v.y}${k}`}};let x=o.CoreMouseService=class extends _.Disposable{constructor(v,k){super(),this._bufferService=v,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new m.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const D of Object.keys(w))this.addProtocol(D,w[D]);for(const D of Object.keys(b))this.addEncoding(D,b[D]);this.reset()}addProtocol(v,k){this._protocols[v]=k}addEncoding(v,k){this._encodings[v]=k}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(v){if(!this._protocols[v])throw new Error(`unknown protocol "${v}"`);this._activeProtocol=v,this._onProtocolChange.fire(this._protocols[v].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(v){if(!this._encodings[v])throw new Error(`unknown encoding "${v}"`);this._activeEncoding=v}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(v){if(v.col<0||v.col>=this._bufferService.cols||v.row<0||v.row>=this._bufferService.rows||v.button===4&&v.action===32||v.button===3&&v.action!==32||v.button!==4&&(v.action===2||v.action===3)||(v.col++,v.row++,v.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,v,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(v))return!1;const k=this._encodings[this._activeEncoding](v);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!0)),this._lastEvent=v,!0}explainEvents(v){return{down:!!(1&v),up:!!(2&v),drag:!!(4&v),move:!!(8&v),wheel:!!(16&v)}}_equalEvents(v,k,D){if(D){if(v.x!==k.x||v.y!==k.y)return!1}else if(v.col!==k.col||v.row!==k.row)return!1;return v.button===k.button&&v.action===k.action&&v.ctrl===k.ctrl&&v.alt===k.alt&&v.shift===k.shift}};o.CoreMouseService=x=f([g(0,d.IBufferService),g(1,d.ICoreService)],x)},6975:function(c,o,u){var f=this&&this.__decorate||function(x,v,k,D){var T,R=arguments.length,N=R<3?v:D===null?D=Object.getOwnPropertyDescriptor(v,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,v,k,D);else for(var L=x.length-1;L>=0;L--)(T=x[L])&&(N=(R<3?T(N):R>3?T(v,k,N):T(v,k))||N);return R>3&&N&&Object.defineProperty(v,k,N),N},g=this&&this.__param||function(x,v){return function(k,D){v(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=u(1439),m=u(8460),_=u(844),w=u(2585),C=Object.freeze({insertMode:!1}),y=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=o.CoreService=class extends _.Disposable{constructor(x,v,k){super(),this._bufferService=x,this._logService=v,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new m.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new m.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new m.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new m.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(C),this.decPrivateModes=(0,d.clone)(y)}reset(){this.modes=(0,d.clone)(C),this.decPrivateModes=(0,d.clone)(y)}triggerDataEvent(x,v=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;v&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),v&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((D=>D.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((v=>v.charCodeAt(0))))),this._onBinary.fire(x))}};o.CoreService=b=f([g(0,w.IBufferService),g(1,w.ILogService),g(2,w.IOptionsService)],b)},9074:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const f=u(8055),g=u(8460),d=u(844),m=u(6106);let _=0,w=0;class C extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new m.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const v=new y(x);if(v){const k=v.marker.onDispose((()=>v.dispose()));v.onDispose((()=>{v&&(this._decorations.delete(v)&&this._onDecorationRemoved.fire(v),k.dispose())})),this._decorations.insert(v),this._onDecorationRegistered.fire(v)}return v}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,v,k){let D=0,T=0;for(const R of this._decorations.getKeyIterator(v))D=R.options.x??0,T=D+(R.options.width??1),x>=D&&x{_=T.options.x??0,w=_+(T.options.width??1),x>=_&&x{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const f=u(2585),g=u(8343);class d{constructor(..._){this._entries=new Map;for(const[w,C]of _)this.set(w,C)}set(_,w){const C=this._entries.get(_);return this._entries.set(_,w),C}forEach(_){for(const[w,C]of this._entries.entries())_(w,C)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(f.IInstantiationService,this)}setService(m,_){this._services.set(m,_)}getService(m){return this._services.get(m)}createInstance(m,..._){const w=(0,g.getServiceDependencies)(m).sort(((b,x)=>b.index-x.index)),C=[];for(const b of w){const x=this._services.get(b.id);if(!x)throw new Error(`[createInstance] ${m.name} depends on UNKNOWN service ${b.id}.`);C.push(x)}const y=w.length>0?w[0].index:_.length;if(_.length!==y)throw new Error(`[createInstance] First service dependency of ${m.name} at position ${y+1} conflicts with ${_.length} static arguments`);return new m(..._,...C)}}},7866:function(c,o,u){var f=this&&this.__decorate||function(y,b,x,v){var k,D=arguments.length,T=D<3?b:v===null?v=Object.getOwnPropertyDescriptor(b,x):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(y,b,x,v);else for(var R=y.length-1;R>=0;R--)(k=y[R])&&(T=(D<3?k(T):D>3?k(b,x,T):k(b,x))||T);return D>3&&T&&Object.defineProperty(b,x,T),T},g=this&&this.__param||function(y,b){return function(x,v){b(x,v,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=u(844),m=u(2585),_={trace:m.LogLevelEnum.TRACE,debug:m.LogLevelEnum.DEBUG,info:m.LogLevelEnum.INFO,warn:m.LogLevelEnum.WARN,error:m.LogLevelEnum.ERROR,off:m.LogLevelEnum.OFF};let w,C=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(y){super(),this._optionsService=y,this._logLevel=m.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),w=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(y){for(let b=0;bJSON.stringify(T))).join(", ")})`);const D=v.apply(this,k);return w.trace(`GlyphRenderer#${v.name} return`,D),D}}},7302:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const f=u(8460),g=u(844),d=u(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 m=["normal","bold","100","200","300","400","500","600","700","800","900"];class _ extends g.Disposable{constructor(C){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const y={...o.DEFAULT_OPTIONS};for(const b in C)if(b in y)try{const x=C[b];y[b]=this._sanitizeAndValidateOption(b,x)}catch(x){console.error(x)}this.rawOptions=y,this.options={...y},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,y){return this.onOptionChange((b=>{b===C&&y(this.rawOptions[C])}))}onMultipleOptionChange(C,y){return this.onOptionChange((b=>{C.indexOf(b)!==-1&&y()}))}_setupOptions(){const C=b=>{if(!(b in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},y=(b,x)=>{if(!(b in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);x=this._sanitizeAndValidateOption(b,x),this.rawOptions[b]!==x&&(this.rawOptions[b]=x,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const x={get:C.bind(this,b),set:y.bind(this,b)};Object.defineProperty(this.options,b,x)}}_sanitizeAndValidateOption(C,y){switch(C){case"cursorStyle":if(y||(y=o.DEFAULT_OPTIONS[C]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(y))throw new Error(`"${y}" is not a valid value for ${C}`);break;case"wordSeparator":y||(y=o.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof y=="number"&&1<=y&&y<=1e3)break;y=m.includes(y)?y:o.DEFAULT_OPTIONS[C];break;case"cursorWidth":y=Math.floor(y);case"lineHeight":case"tabStopWidth":if(y<1)throw new Error(`${C} cannot be less than 1, value: ${y}`);break;case"minimumContrastRatio":y=Math.max(1,Math.min(21,Math.round(10*y)/10));break;case"scrollback":if((y=Math.min(y,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${y}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(y<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${y}`);break;case"rows":case"cols":if(!y&&y!==0)throw new Error(`${C} must be numeric, value: ${y}`);break;case"windowsPty":y=y??{}}return y}}o.OptionsService=_},2660:function(c,o,u){var f=this&&this.__decorate||function(_,w,C,y){var b,x=arguments.length,v=x<3?w:y===null?y=Object.getOwnPropertyDescriptor(w,C):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(_,w,C,y);else for(var k=_.length-1;k>=0;k--)(b=_[k])&&(v=(x<3?b(v):x>3?b(w,C,v):b(w,C))||v);return x>3&&v&&Object.defineProperty(w,C,v),v},g=this&&this.__param||function(_,w){return function(C,y){w(C,y,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=u(2585);let m=o.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const w=this._bufferService.buffer;if(_.id===void 0){const k=w.addMarker(w.ybase+w.y),D={data:_,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(D,k))),this._dataByLinkId.set(D.id,D),D.id}const C=_,y=this._getEntryIdKey(C),b=this._entriesWithId.get(y);if(b)return this.addLineToLink(b.id,w.ybase+w.y),b.id;const x=w.addMarker(w.ybase+w.y),v={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(v,x))),this._entriesWithId.set(v.key,v),this._dataByLinkId.set(v.id,v),v.id}addLineToLink(_,w){const C=this._dataByLinkId.get(_);if(C&&C.lines.every((y=>y.line!==w))){const y=this._bufferService.buffer.addMarker(w);C.lines.push(y),y.onDispose((()=>this._removeMarkerFromLink(C,y)))}}getLinkData(_){var w;return(w=this._dataByLinkId.get(_))==null?void 0:w.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,w){const C=_.lines.indexOf(w);C!==-1&&(_.lines.splice(C,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};o.OscLinkService=m=f([g(0,d.IBufferService)],m)},8343:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const u="di$target",f="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(g){return g[f]||[]},o.createDecorator=function(g){if(o.serviceRegistry.has(g))return o.serviceRegistry.get(g);const d=function(m,_,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,y,b){y[u]===y?y[f].push({id:C,index:b}):(y[f]=[{id:C,index:b}],y[u]=y)})(d,m,w)};return d.toString=()=>g,o.serviceRegistry.set(g,d),d}},2585:(c,o,u)=>{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 f=u(8343);var g;o.IBufferService=(0,f.createDecorator)("BufferService"),o.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),o.ICoreService=(0,f.createDecorator)("CoreService"),o.ICharsetService=(0,f.createDecorator)("CharsetService"),o.IInstantiationService=(0,f.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"})(g||(o.LogLevelEnum=g={})),o.ILogService=(0,f.createDecorator)("LogService"),o.IOptionsService=(0,f.createDecorator)("OptionsService"),o.IOscLinkService=(0,f.createDecorator)("OscLinkService"),o.IUnicodeService=(0,f.createDecorator)("UnicodeService"),o.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const f=u(8460),g=u(225);class d{static extractShouldJoin(_){return(1&_)!=0}static extractWidth(_){return _>>1&3}static extractCharKind(_){return _>>3}static createPropertyValue(_,w,C=!1){return(16777215&_)<<3|(3&w)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const _=new g.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(_){if(!this._providers[_])throw new Error(`unknown Unicode version "${_}"`);this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)}register(_){this._providers[_.version]=_}wcwidth(_){return this._activeProvider.wcwidth(_)}getStringCellWidth(_){let w=0,C=0;const y=_.length;for(let b=0;b=y)return w+this.wcwidth(x);const D=_.charCodeAt(b);56320<=D&&D<=57343?x=1024*(x-55296)+D-56320+65536:w+=this.wcwidth(D)}const v=this.charProperties(x,C);let k=d.extractWidth(v);d.extractShouldJoin(v)&&(k-=d.extractWidth(C)),w+=k,C=v}return w}charProperties(_,w){return this._activeProvider.charProperties(_,w)}}o.UnicodeService=d}},r={};function a(c){var o=r[c];if(o!==void 0)return o.exports;var u=r[c]={exports:{}};return n[c].call(u.exports,u,u.exports,a),u.exports}var l={};return(()=>{var c=l;Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const o=a(9042),u=a(3236),f=a(844),g=a(5741),d=a(8285),m=a(7975),_=a(7090),w=["cols","rows"];class C extends f.Disposable{constructor(b){super(),this._core=this.register(new u.Terminal(b)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const x=k=>this._core.options[k],v=(k,D)=>{this._checkReadonlyOptions(k),this._core.options[k]=D};for(const k in this._core.options){const D={get:x.bind(this,k),set:v.bind(this,k)};Object.defineProperty(this._publicOptions,k,D)}}_checkReadonlyOptions(b){if(w.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 m.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.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 x="none";switch(this._core.coreMouseService.activeProtocol){case"X10":x="x10";break;case"VT200":x="vt200";break;case"DRAG":x="drag";break;case"ANY":x="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const x in b)this._publicOptions[x]=b[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,x=!0){this._core.input(b,x)}resize(b,x){this._verifyIntegers(b,x),this._core.resize(b,x)}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,x,v){this._verifyIntegers(b,x,v),this._core.select(b,x,v)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,x){this._verifyIntegers(b,x),this._core.selectLines(b,x)}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,x){this._core.write(b,x)}writeln(b,x){this._core.write(b),this._core.write(`\r -`,x)}paste(b){this._core.paste(b)}refresh(b,x){this._verifyIntegers(b,x),this._core.refresh(b,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return o}_verifyIntegers(...b){for(const x of b)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const x of b)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}c.Terminal=C})(),l})()))})(ap)),ap.exports}var m8=g8();function pb(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r{const n=t.current;if(!n)return;const r=new m8.Terminal({convertEol:!0,disableStdin:!0,fontSize:12,fontFamily:'ui-monospace, "SF Mono", Menlo, Consolas, monospace',scrollback:2e4,theme:{background:"#1a1a1a",foreground:"#e6e1e0",cursor:"#1a1a1a",selectionBackground:"#2c3441"}}),a=new p8.FitAddon;r.loadAddon(a),r.open(n);try{a.fit()}catch{}const l=new ResizeObserver(()=>{try{a.fit()}catch{}});l.observe(n);let c=!1,o=0,u=!1,f=!1;async function g(){if(u){f=!0;return}u=!0;try{for(;;){const m=await fT(e,o);if(c)return;if(m.dataBase64&&r.write(pb(m.dataBase64)),o=m.nextOffset,m.eof)break}}catch{}finally{u=!1,f&&!c&&(f=!1,g())}}const d=qT(e,m=>{if(c)return;const _=pb(m.dataBase64);!u&&m.offset===o?(r.write(_),o+=_.length):m.offset+_.length>o&&g()});return g(),()=>{c=!0,d(),l.disconnect(),r.dispose()}},[e]),S.jsx("div",{ref:t,style:{width:"100%",height:"100%"}})}const qs="__uncommitted__";function v8({state:e}){return!e||e.loading?S.jsx("div",{className:"changes-note",children:"Loading diff…"}):e.error?S.jsx("div",{className:"error",children:e.error}):e.payload?e.payload.truncated?S.jsx(h8,{bytesRead:e.payload.bytesRead,byteLimit:e.payload.byteLimit}):S.jsx(Xw,{diff:e.payload.diff}):S.jsx("div",{className:"diff-empty",children:"No changes."})}function y8({experiment:e,view:t,runs:n,selectedRunId:r,onSelectRun:a}){const l=n.filter(c=>c.experimentId===e.id).sort((c,o)=>o.createdAt-c.createdAt);return t==="terminal"?S.jsx(b8,{experiment:e,expRuns:l,selectedRunId:r,onSelectRun:a}):S.jsx(S8,{experiment:e})}function b8({experiment:e,expRuns:t,selectedRunId:n,onSelectRun:r}){const[a,l]=W.useState(null),[c,o]=W.useState(!1),u=W.useRef(null),f=n&&t.find(w=>w.id===n)||t[0]||null,g=(f==null?void 0:f.status)==="running"||(f==null?void 0:f.status)==="starting",d=w=>{const C=t.findIndex(y=>y.id===w);return C===-1?t.length:t.length-C},m=W.useRef(null);W.useEffect(()=>{if(m.current===null){m.current=new Set(t.map(C=>C.id));return}const w=t.find(C=>!m.current.has(C.id));for(const C of t)m.current.add(C.id);w&&r(w.id)},[t,r]),W.useEffect(()=>{if(!c)return;const w=C=>{var y;(y=u.current)!=null&&y.contains(C.target)||o(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]);async function _(){if(f){l(null);try{await BS(f.id)}catch(w){l(w instanceof Error?w.message:String(w))}}}return S.jsxs("div",{className:"term-view",children:[S.jsxs("div",{className:"term-bar",children:[S.jsx("div",{className:"term-title",title:e.title||e.slug,children:e.title||e.slug}),S.jsx("span",{style:{flex:1}}),a&&S.jsx("span",{className:"error",children:a}),g&&S.jsxs("button",{className:"btn sm ghost",onClick:()=>void _(),children:[S.jsx(mA,{size:13}),"Stop"]}),t.length>0&&f&&S.jsxs("div",{className:"run-history",ref:u,children:[S.jsxs("button",{className:"run-picker",title:"Switch run",onClick:()=>o(w=>!w),children:[S.jsxs("span",{className:"run-label",children:["Run ",d(f.id)]}),S.jsx(Bo,{status:f.status}),S.jsx(Ou,{size:14,className:"run-picker-chev"})]}),c&&S.jsx("div",{className:"history-menu",children:t.map(w=>S.jsxs("button",{className:`history-item ${w.id===(f==null?void 0:f.id)?"active":""}`,onClick:()=>{r(w.id),o(!1)},children:[S.jsxs("span",{className:"run-label",children:["Run ",d(w.id)]}),S.jsx(Bo,{status:w.status}),S.jsx("span",{className:"when",children:fa(w.createdAt)})]},w.id))})]})]}),S.jsx("div",{className:"term-fill",children:f?S.jsx(_8,{runId:f.id},f.id):S.jsx("div",{className:"term-empty",children:"No runs yet — ask the agent to launch one."})})]})}function S8({experiment:e}){const[t,n]=W.useState(null),[r,a]=W.useState(null),[l,c]=W.useState(null),[o,u]=W.useState(null),[f,g]=W.useState({}),d=!!(l&&l.diff.trim()!==""&&l.experimentId===e.id);async function m(){a(null);try{const[w,C]=await Promise.all([dT(e.id),Ny(e.projectId)]);n(w),c(C),u(y=>{var x;return y!==null?y:C.diff.trim()!==""&&C.experimentId===e.id?qs:((x=w[0])==null?void 0:x.sha)??null})}catch(w){a(w instanceof Error?w.message:String(w))}}W.useEffect(()=>{t===null&&!r&&m()},[t,r,e.id]),W.useEffect(()=>{const w=setInterval(()=>{Ny(e.projectId).then(c).catch(()=>{})},5e3);return()=>clearInterval(w)},[e.projectId]),W.useEffect(()=>{var w;o===qs&&l&&!d&&u(((w=t==null?void 0:t[0])==null?void 0:w.sha)??null)},[o,l,d,t]),W.useEffect(()=>{if(!o||o===qs||f[o])return;const w=o;g(C=>({...C,[w]:{loading:!0}})),pT(e.id,w).then(C=>g(y=>({...y,[w]:{loading:!1,payload:C}}))).catch(C=>g(y=>({...y,[w]:{loading:!1,error:C instanceof Error?C.message:String(C)}})))},[o,f,e.id]);const _=!d&&((t==null?void 0:t.length)??0)===0;return S.jsx("div",{className:"drawer",children:S.jsx("div",{className:"drawer-body",children:S.jsx("div",{className:"drawer-section",children:r?S.jsx("div",{className:"error",children:r}):t===null?S.jsx("div",{className:"changes-note",children:"Loading changes…"}):_?S.jsx("div",{className:"changes-note",children:"No changes yet — the agent hasn't committed on this branch."}):S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"commit-picker",children:[o===qs&&S.jsx("span",{className:"uncommitted-dot"}),S.jsxs("select",{className:"input sm",value:o??"",onChange:w=>u(w.target.value),children:[d&&S.jsx("option",{value:qs,children:"● Uncommitted changes"}),t.map(w=>S.jsxs("option",{value:w.sha,children:[w.sha.slice(0,7)," — ",w.subject]},w.sha))]}),S.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:()=>void m(),children:S.jsx(LS,{size:14})})]}),S.jsx("div",{style:{marginTop:10},children:o===qs&&l?l.truncated?S.jsxs("div",{className:"truncated-notice",children:[S.jsx("h4",{children:"Diff too large to display"}),S.jsx("p",{children:"The uncommitted diff is too large to display. View it locally with git."})]}):S.jsx(Xw,{diff:l.diff}):o?S.jsx(v8,{state:f[o]}):S.jsx("div",{className:"changes-note",children:"Select a commit to view its diff."})})]})})})})}function x8(e,t){return iw(e,Kx(t))}function w8({projectId:e,path:t,sessionId:n,onOpenFile:r}){const[a,l]=W.useState(null),[c,o]=W.useState(null),[u,f]=W.useState(!0),[g,d]=W.useState(0),m=/\.(md|mdx|markdown)$/i.test(t),[_,w]=W.useState(!1);W.useEffect(()=>{let y=!1;return f(!0),gT(e,t,n).then(b=>{y||(l(b),o(null))}).catch(b=>{y||o(b.message)}).finally(()=>{y||f(!1)}),()=>{y=!0}},[e,t,n,g]);const C=W.useMemo(()=>a&&!a.notFound?x8(a.content,t):null,[a,t]);return S.jsxs("div",{className:"file-view",children:[S.jsxs("div",{className:"file-view-header",children:[S.jsx(RA,{size:13,style:{flexShrink:0}}),S.jsx("code",{className:"file-view-path",title:t,children:t}),m&&S.jsx("button",{className:`icon-btn ${_?"active":""}`,title:_?"Rendered view":"Source view","aria-label":_?"Rendered view":"Source view",onClick:()=>w(y=>!y),children:S.jsx(bA,{size:13})}),S.jsx("button",{className:"icon-btn",title:"Reload file","aria-label":"Reload file",onClick:()=>d(y=>y+1),children:u?S.jsx("span",{className:"spinner"}):S.jsx(LS,{size:13})})]}),S.jsx("div",{className:"file-view-body",children:c?S.jsxs("div",{className:"file-view-note",children:["Failed to load file: ",c]}):a===null?S.jsx("div",{className:"file-view-note",children:"Loading…"}):a.notFound?S.jsx("div",{className:"file-view-note",children:n&&a.root==="clone"?"This session's worktree isn't available, and the file isn't in the project clone.":`File not found in the ${a.root==="worktree"?"session's worktree":"project clone"}.`}):S.jsxs(S.Fragment,{children:[n&&a.root==="clone"&&S.jsx("div",{className:"file-view-note",children:"This session's worktree isn't available — showing the project clone's copy."}),m&&!_?S.jsx("div",{className:"file-view-md",children:S.jsx(am,{text:a.content,onOpenFile:r&&(y=>r(y,n))})}):S.jsx("pre",{className:"file-view-code",children:S.jsx("code",{children:C})}),a.truncated&&S.jsx("div",{className:"file-view-note",children:"File truncated — showing the first 512 KB."})]})})]})}function C8({projectName:e,onHome:t,onCollapse:n}){return S.jsxs("div",{className:"rail-brand",children:[S.jsxs("button",{className:"brand",onClick:t,title:"All projects",children:[S.jsx(hg,{size:15}),S.jsx("span",{className:"brand-project",children:e})]}),n&&S.jsx("button",{className:"icon-btn",title:"Hide sidebar","aria-label":"Hide sidebar",onClick:n,children:S.jsx(MS,{size:15})})]})}function E8({onDone:e}){const[t,n]=W.useState(0),[r,a]=W.useState(null),[l,c]=W.useState(null),[o,u]=W.useState(!1),f=g=>{u(!0),Promise.allSettled([gg(g).then(a),zS().then(c)]).finally(()=>u(!1))};return W.useEffect(()=>f(!1),[]),S.jsx("div",{className:"home onboarding",children:S.jsx("div",{className:"home-inner",children:t===0?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"onb-eyebrow",children:["Open",S.jsx("span",{children:"Research"})," · step 1 of 2"]}),S.jsx("h2",{className:"onb-title",children:"Your coding agents"}),S.jsx("p",{className:"onb-sub",children:"orx found the agent CLIs on this machine and drives them directly — chat and autoresearch run on your own logins, no extra API keys."}),S.jsx("div",{className:"onb-cards",children:r===null?S.jsxs("div",{className:"onb-loading",children:[S.jsx("span",{className:"spinner"})," Detecting Claude Code, Codex, OpenCode…"]}):r.map(g=>S.jsx(A8,{h:g},g.id))}),S.jsxs("div",{className:"onb-actions",children:[S.jsxs("button",{className:"btn ghost",onClick:()=>f(!0),disabled:o,children:[S.jsx(du,{size:12,className:o?"spin":""})," Re-check"]}),S.jsx("div",{style:{flex:1}}),S.jsxs("button",{className:"btn primary",onClick:()=>n(1),children:["Continue ",S.jsx(Ty,{size:13})]})]})]}):S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"onb-eyebrow",children:["Open",S.jsx("span",{children:"Research"})," · step 2 of 2"]}),S.jsx("h2",{className:"onb-title",children:"Git & GitHub"}),S.jsx("p",{className:"onb-sub",children:"A project is a clone of one of your GitHub repos, made with your own git credentials. Every experiment becomes a branch pushed to that repo — compute jobs clone it from there."}),S.jsx("div",{className:"onb-cards",children:S.jsx(T8,{git:l,onUpdate:c})}),S.jsxs("div",{className:"onb-actions",children:[S.jsxs("button",{className:"btn ghost",onClick:()=>n(0),children:[S.jsx(hg,{size:12})," Back"]}),S.jsxs("button",{className:"btn ghost",onClick:()=>f(!1),disabled:o,children:[S.jsx(du,{size:12,className:o?"spin":""})," Re-check"]}),S.jsx("div",{style:{flex:1}}),S.jsxs("button",{className:"btn primary",onClick:e,children:["Create your first project ",S.jsx(Ty,{size:13})]})]})]})})})}function k8(e){return e.agentReady?{cls:"st-done",label:"connected"}:e.installed?{cls:"st-starting",label:"not signed in"}:{cls:"st-idle",label:"not detected"}}function A8({h:e}){var r,a;const t=k8(e),n=(r=e.version)==null?void 0:r.replace(/\s*\(.*\)$/,"");return S.jsxs("div",{className:"onb-card",children:[S.jsxs("div",{className:"onb-card-head",children:[S.jsx("span",{className:"onb-card-name",children:e.name}),S.jsxs("span",{className:`status-badge ${t.cls}`,children:[e.agentReady?S.jsx(si,{size:12,strokeWidth:3}):S.jsx("span",{className:"dot"}),t.label]})]}),e.agentReady?S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"onb-card-detail mono",children:[e.account??"API key",e.plan?` · ${e.plan}`:""]}),S.jsx("div",{className:"onb-card-meta",children:[n,e.models.length>0&&`${e.models.length} model${e.models.length===1?"":"s"} — ${e.models.slice(0,3).map(l=>pu(l.id)).join(", ")}${e.models.length>3?", …":""}`].filter(Boolean).join(" · ")})]}):S.jsx("div",{className:"onb-card-meta",children:(a=e.agentNote)==null?void 0:a.replace(/`/g,"")})]})}function T8({git:e,onUpdate:t}){const[n,r]=W.useState(!1),a=()=>{navigator.clipboard.writeText("gh auth login").then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};if(e===null)return S.jsxs("div",{className:"onb-loading",children:[S.jsx("span",{className:"spinner"})," Checking git…"]});if(!e.gitVersion)return S.jsxs("div",{className:"onb-card",children:[S.jsxs("div",{className:"onb-card-head",children:[S.jsx("span",{className:"onb-card-name",children:"git"}),S.jsxs("span",{className:"status-badge st-failed",children:[S.jsx("span",{className:"dot"})," not found"]})]}),S.jsx("div",{className:"onb-card-meta",children:"Install git to clone projects, then re-open orx."})]});const l=[e.userName,e.userEmail&&`<${e.userEmail}>`].filter(Boolean).join(" ");return S.jsxs("div",{className:"onb-card",children:[S.jsxs("div",{className:"onb-card-row",children:[S.jsx("span",{className:"onb-card-name",children:"git"}),S.jsxs("span",{className:"onb-card-detail mono",children:[e.gitVersion.replace(/^git version /,""),l?` · ${l}`:""]}),S.jsxs("span",{className:`status-badge ${l?"st-done":"st-starting"}`,children:[l?S.jsx(si,{size:12,strokeWidth:3}):S.jsx("span",{className:"dot"}),l?"ready":"no identity"]})]}),S.jsxs("div",{className:"onb-card-row",children:[S.jsx("span",{className:"onb-card-name",children:"GitHub"}),S.jsx("span",{className:"onb-card-detail mono",children:e.githubTokenSource==="env"?"token from GITHUB_TOKEN":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"signed in via gh CLI":"not connected"}),S.jsxs("span",{className:`status-badge ${e.githubTokenSource?"st-done":"st-starting"}`,children:[e.githubTokenSource?S.jsx(si,{size:12,strokeWidth:3}):S.jsx("span",{className:"dot"}),e.githubTokenSource?"ready":"check"]})]}),!l&&S.jsxs("div",{className:"onb-card-meta",children:["Set ",S.jsx("code",{children:"git config --global user.name / user.email"})," so the agent can commit."]}),!e.githubTokenSource&&S.jsxs("div",{className:"onb-gh-options",children:[S.jsx("div",{className:"onb-card-meta",children:"GitHub access is used to clone your repos and push experiment branches. Connect either way:"}),S.jsxs("div",{className:"onb-gh-option",children:[S.jsx("span",{className:"onb-gh-option-label",children:"GitHub CLI"}),S.jsx("div",{className:"onb-gh-option-body",children:e.ghInstalled?S.jsxs(S.Fragment,{children:[S.jsx("code",{className:"onb-gh-cmd",children:"gh auth login"}),S.jsxs("button",{className:"btn ghost",onClick:a,children:[n?S.jsx(si,{size:12,strokeWidth:3}):S.jsx(dg,{size:12}),n?"Copied":"Copy"]}),S.jsx("span",{className:"onb-gh-hint",children:"run in a terminal, then Re-check"})]}):S.jsxs("span",{className:"onb-gh-hint",children:["install the GitHub CLI, run ",S.jsx("code",{children:"gh auth login"}),", then Re-check"]})})]}),S.jsx("div",{className:"onb-gh-or",children:"or"}),S.jsxs("div",{className:"onb-gh-option",children:[S.jsx("span",{className:"onb-gh-option-label",children:"Paste a token"}),S.jsx(aw,{onSaved:t})]})]})]})}function Uc(e){const t=e.trim().replace(/^git@github\.com:/i,"").replace(/^https?:\/\/(www\.)?github\.com\//i,"").replace(/\.git$/i,"").replace(/^\/+|\/+$/g,""),[n,r]=t.split("/");return!n||!r||/[\s:@]/.test(n)||/[\s:@]/.test(r)?null:{owner:n,repo:r}}function gb(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/-+$/,"")||"experiment"}function N8(e){const r=(e.trim().split(/[?#]/)[0].split("/").filter(Boolean).pop()??"").replace(/\.(pdf|md)$/i,"");return/^\d{4}\.\d{4,5}(v\d+)?$/.test(r)?r:null}function D8(e){return e.replace(/^\[[^\]]*\]\s*/,"").replace(/\s*[-–|]\s*arXiv\s*$/i,"")}function R8({onCreated:e,onCancel:t}){var U;const[n,r]=W.useState("paper"),[a,l]=W.useState("use"),[c,o]=W.useState(""),[u,f]=W.useState(""),[g,d]=W.useState(!1),[m,_]=W.useState("main"),[w,C]=W.useState(!1),[y,b]=W.useState(null),[x,v]=W.useState(""),[k,D]=W.useState([]),[T,R]=W.useState(!1),[N,L]=W.useState(null),[I,F]=W.useState(!1),[V,H]=W.useState(null),z=W.useRef(0),q=Uc(c),G=!!(u.trim()&&(n==="new"||n==="existing"&&q!==null||n==="paper"&&N!==null&&(c.trim()===""||q!==null))),X=Q=>{var ie;o(Q),g||f(((ie=Uc(Q))==null?void 0:ie.repo)??"")};async function K(Q){const ie=++z.current;D([]),R(!1),F(!0),H(null);try{const se=await aT(Q);if(ie!==z.current)return;L(se);const Z=se.repoUrl?Uc(se.repoUrl):null;o(Z?`${Z.owner}/${Z.repo}`:""),l("fork"),g||f((Z==null?void 0:Z.repo)??(se.title??"").trim().slice(0,60))}catch(se){if(ie!==z.current)return;H(se instanceof Error?se.message:String(se))}finally{ie===z.current&&F(!1)}}function O(){z.current++,L(null),v(""),D([]),H(null),o(""),g||f("")}W.useEffect(()=>{if(n!=="paper"||N)return;const Q=x.trim(),ie=N8(Q);if(!ie&&Q.length<3){D([]),R(!1);return}const se=++z.current;ie||R(!0);const Z=setTimeout(()=>{if(ie){K(ie);return}sT(Q).then(P=>{se===z.current&&D(P)}).catch(P=>{se===z.current&&(D([]),H(P instanceof Error?P.message:String(P)))}).finally(()=>{se===z.current&&R(!1)})},350);return()=>clearTimeout(Z)},[n,N,x]);async function M(Q){if(Q.preventDefault(),!(!G||w)){C(!0),b(null);try{const ie=await rT(n==="new"?{name:u.trim(),createRepo:!0}:n==="paper"&&!q?{name:u.trim(),createRepo:!0,paperId:N.paperId}:{name:u.trim(),githubOwner:q.owner,githubRepo:q.repo,baselineBranch:m.trim()||"main",forkRepo:a==="fork",...n==="paper"?{paperId:N.paperId}:{}});e(ie)}catch(ie){b(ie instanceof Error?ie.message:String(ie))}finally{C(!1)}}}const j=n==="new"||n==="paper"&&!q,$=S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"seg form-seg",children:[S.jsx("button",{type:"button",className:a==="use"?"active":"",onClick:()=>l("use"),children:"Use this repo"}),S.jsx("button",{type:"button",className:a==="fork"?"active":"",onClick:()=>l("fork"),children:"Fork a copy"})]}),S.jsx("span",{className:"repo-hint",children:a==="fork"?`snapshots ${q?`${q.owner}/${q.repo}`:"the repo"} into a private repo on your account`:"experiments push branches here — if you can't push to it, a fork is made automatically"}),S.jsxs("div",{className:"row2",children:[S.jsxs("label",{children:["Project name",S.jsx("input",{value:u,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research"})]}),S.jsxs("label",{children:["Branch",S.jsx("input",{value:m,onChange:Q=>_(Q.target.value),placeholder:"main"})]})]})]});return S.jsxs("form",{className:"form",onSubmit:M,children:[S.jsxs("div",{className:"seg form-seg",children:[S.jsx("button",{type:"button",className:n==="paper"?"active":"",onClick:()=>r("paper"),children:"From a paper"}),S.jsx("button",{type:"button",className:n==="existing"?"active":"",onClick:()=>r("existing"),children:"Existing repo"}),S.jsx("button",{type:"button",className:n==="new"?"active":"",onClick:()=>r("new"),children:"New blank repo"})]}),n==="existing"&&S.jsxs(S.Fragment,{children:[S.jsxs("label",{children:["GitHub repository",S.jsx("input",{value:c,onChange:Q=>X(Q.target.value),placeholder:"https://github.com/karpathy/nanoGPT",autoFocus:!0,spellCheck:!1}),S.jsx("span",{className:`repo-hint mono ${q?"ok":""}`,children:q?`${q.owner} / ${q.repo}`:c.trim()?"paste a GitHub URL or owner/repo":"URL or owner/repo — cloned with your git credentials"})]}),$]}),n==="paper"&&(N===null?S.jsxs(S.Fragment,{children:[S.jsxs("label",{children:["Paper",S.jsx("input",{value:x,onChange:Q=>v(Q.target.value),placeholder:"arXiv id, URL, or title — e.g. 1706.03762",autoFocus:!0,spellCheck:!1}),S.jsx("span",{className:`repo-hint ${V?"":"mono"}`,children:I?"looking up paper…":T?"searching alphaXiv…":V??"searches alphaXiv by title — or paste an arXiv id / URL"})]}),k.length>0&&S.jsx("div",{className:"paper-results",children:k.map(Q=>S.jsxs("button",{type:"button",onClick:()=>void K(Q.paperId),children:[S.jsx("span",{className:"title",children:D8(Q.title)}),S.jsx("span",{className:"id",children:Q.paperId})]},Q.paperId))})]}):S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"paper-pick",children:[S.jsxs("div",{className:"meta",children:[S.jsx("div",{className:"title",children:N.title||N.paperId}),S.jsxs("div",{className:"id",children:["arXiv ",N.paperId]})]}),S.jsx("button",{type:"button",className:"btn ghost",onClick:O,children:"Change"})]}),S.jsxs("label",{children:["GitHub repository",N.repoUrl?"":" (optional)",S.jsx("input",{value:c,onChange:Q=>X(Q.target.value),placeholder:"owner/repo — leave blank for a new private repo",spellCheck:!1}),S.jsx("span",{className:`repo-hint mono ${q?"ok":""}`,children:q?`${q.owner} / ${q.repo}`+(N.repoUrl&&((U=Uc(N.repoUrl))==null?void 0:U.repo)===q.repo?` · linked on alphaXiv${N.repoStars!=null?` · ★ ${N.repoStars}`:""}`:""):c.trim()?"paste a GitHub URL or owner/repo":"no code linked to this paper — a blank private repo will be created"})]}),q?$:S.jsxs("label",{children:["Project name",S.jsx("input",{value:u,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research"}),S.jsx("span",{className:`repo-hint mono ${u.trim()?"ok":""}`,children:u.trim()?`creates github.com/you/${gb(u)} · private`:"a blank private repo is created on your GitHub account"})]})]})),n==="new"&&S.jsxs("label",{children:["Project name",S.jsx("input",{value:u,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research",autoFocus:!0}),S.jsx("span",{className:`repo-hint mono ${u.trim()?"ok":""}`,children:u.trim()?`creates github.com/you/${gb(u)} · private`:"a blank private repo is created on your GitHub account"})]}),y&&S.jsx("div",{className:"error",children:y}),S.jsxs("div",{className:"actions",children:[t&&S.jsx("button",{type:"button",className:"btn ghost",onClick:t,children:"Cancel"}),S.jsx("button",{type:"submit",className:"btn primary",disabled:!G||w,children:w?j?"Creating repo…":a==="fork"?"Forking repo…":"Cloning repo…":"Create project"})]})]})}function mb({projects:e,onOpen:t,onCreated:n,onDeleted:r}){const[a,l]=W.useState(!1),[c,o]=W.useState(null);async function u(f){if(window.confirm(`Delete project "${f.name}"? +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(N){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),S.isLinux&&N&&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(N){const L=this._getMouseBufferCoords(N),I=this._model.finalSelectionStart,F=this._model.finalSelectionEnd;return!!(I&&F&&L)&&this._areCoordsInSelection(L,I,F)}isCellInSelection(N,L){const I=this._model.finalSelectionStart,F=this._model.finalSelectionEnd;return!(!I||!F)&&this._areCoordsInSelection([N,L],I,F)}_areCoordsInSelection(N,L,I){return N[1]>L[1]&&N[1]=L[0]&&N[0]=L[0]}_selectWordAtCursor(N,L){var V,H;const I=(H=(V=this._linkifier.currentLink)==null?void 0:V.link)==null?void 0:H.range;if(I)return this._model.selectionStart=[I.start.x-1,I.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(I,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const F=this._getMouseBufferCoords(N);return!!F&&(this._selectWordAt(F,L),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(N,L){this._model.clearSelection(),N=Math.max(N,0),L=Math.min(L,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,N],this._model.selectionEnd=[this._bufferService.cols,L],this.refresh(),this._onSelectionChange.fire()}_handleTrim(N){this._model.handleTrim(N)&&this.refresh()}_getMouseBufferCoords(N){const L=this._mouseService.getCoords(N,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(L)return L[0]--,L[1]--,L[1]+=this._bufferService.buffer.ydisp,L}_getMouseEventScrollAmount(N){let L=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,N,this._screenElement)[1];const I=this._renderService.dimensions.css.canvas.height;return L>=0&&L<=I?0:(L>I&&(L-=I),L=Math.min(Math.max(L,-50),50),L/=50,L/Math.abs(L)+Math.round(14*L))}shouldForceSelection(N){return S.isMac?N.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:N.shiftKey}handleMouseDown(N){if(this._mouseDownTimeStamp=N.timeStamp,(N.button!==2||!this.hasSelection)&&N.button===0){if(!this._enabled){if(!this.shouldForceSelection(N))return;N.stopPropagation()}N.preventDefault(),this._dragScrollAmount=0,this._enabled&&N.shiftKey?this._handleIncrementalClick(N):N.detail===1?this._handleSingleClick(N):N.detail===2?this._handleDoubleClick(N):N.detail===3&&this._handleTripleClick(N),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(N){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(N))}_handleSingleClick(N){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(N)?3:0,this._model.selectionStart=this._getMouseBufferCoords(N),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const L=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);L&&L.length!==this._model.selectionStart[0]&&L.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(N){this._selectWordAtCursor(N,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(N){const L=this._getMouseBufferCoords(N);L&&(this._activeSelectionMode=2,this._selectLineAt(L[1]))}shouldColumnSelect(N){return N.altKey&&!(S.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(N){if(N.stopImmediatePropagation(),!this._model.selectionStart)return;const L=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(N),!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(N.ydisp+this._bufferService.rows,N.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=N.ydisp),this.refresh()}}_handleMouseUp(N){const L=N.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&L<500&&N.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const I=this._mouseService.getCoords(N,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(I&&I[0]!==void 0&&I[1]!==void 0){const F=(0,m.moveToCellSequence)(I[0]-1,I[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(F,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const N=this._model.finalSelectionStart,L=this._model.finalSelectionEnd,I=!(!N||!L||N[0]===L[0]&&N[1]===L[1]);I?N&&L&&(this._oldSelectionStart&&this._oldSelectionEnd&&N[0]===this._oldSelectionStart[0]&&N[1]===this._oldSelectionStart[1]&&L[0]===this._oldSelectionEnd[0]&&L[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(N,L,I)):this._oldHasSelection&&this._fireOnSelectionChange(N,L,I)}_fireOnSelectionChange(N,L,I){this._oldSelectionStart=N,this._oldSelectionEnd=L,this._oldHasSelection=I,this._onSelectionChange.fire()}_handleBufferActivate(N){this.clearSelection(),this._trimListener.dispose(),this._trimListener=N.activeBuffer.lines.onTrim((L=>this._handleTrim(L)))}_convertViewportColToCharacterIndex(N,L){let I=L;for(let F=0;L>=F;F++){const V=N.loadCell(F,this._workCell).getChars().length;this._workCell.getWidth()===0?I--:V>1&&L!==F&&(I+=V-1)}return I}setSelection(N,L,I){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[N,L],this._model.selectionStartLength=I,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(N){this._isClickInSelection(N)||(this._selectWordAtCursor(N,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(N,L,I=!0,F=!0){if(N[0]>=this._bufferService.cols)return;const V=this._bufferService.buffer,H=V.lines.get(N[1]);if(!H)return;const z=V.translateBufferLineToString(N[1],!1);let q=this._convertViewportColToCharacterIndex(H,N[0]),G=q;const X=N[0]-q;let K=0,O=0,M=0,j=0;if(z.charAt(q)===" "){for(;q>0&&z.charAt(q-1)===" ";)q--;for(;G1&&(j+=se-1,G+=se-1);Q>0&&q>0&&!this._isCharWordSeparator(H.loadCell(Q-1,this._workCell));){H.loadCell(Q-1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===0?(K++,Q--):Z>1&&(M+=Z-1,q-=Z-1),q--,Q--}for(;ie1&&(j+=Z-1,G+=Z-1),G++,ie++}}G++;let $=q+X-K+M,U=Math.min(this._bufferService.cols,G-q+K+O-M-j);if(L||z.slice(q,G).trim()!==""){if(I&&$===0&&H.getCodePoint(0)!==32){const Q=V.lines.get(N[1]-1);if(Q&&H.isWrapped&&Q.getCodePoint(this._bufferService.cols-1)!==32){const ie=this._getWordAt([this._bufferService.cols-1,N[1]-1],!1,!0,!1);if(ie){const se=this._bufferService.cols-ie.start;$-=se,U+=se}}}if(F&&$+U===this._bufferService.cols&&H.getCodePoint(this._bufferService.cols-1)!==32){const Q=V.lines.get(N[1]+1);if(Q!=null&&Q.isWrapped&&Q.getCodePoint(0)!==32){const ie=this._getWordAt([0,N[1]+1],!1,!1,!0);ie&&(U+=ie.length)}}return{start:$,length:U}}}_selectWordAt(N,L){const I=this._getWordAt(N,L);if(I){for(;I.start<0;)I.start+=this._bufferService.cols,N[1]--;this._model.selectionStart=[I.start,N[1]],this._model.selectionStartLength=I.length}}_selectToWordAt(N){const L=this._getWordAt(N,!0);if(L){let I=N[1];for(;L.start<0;)L.start+=this._bufferService.cols,I--;if(!this._model.areSelectionValuesReversed())for(;L.start+L.length>this._bufferService.cols;)L.length-=this._bufferService.cols,I++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?L.start:L.start+L.length,I]}}_isCharWordSeparator(N){return N.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(N.getChars())>=0}_selectLineAt(N){const L=this._bufferService.buffer.getWrappedRangeForLine(N),I={start:{x:0,y:L.first},end:{x:this._bufferService.cols-1,y:L.last}};this._model.selectionStart=[0,L.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(I,this._bufferService.cols)}};o.SelectionService=R=f([g(3,k.IBufferService),g(4,k.ICoreService),g(5,w.IMouseService),g(6,k.IOptionsService),g(7,w.IRenderService),g(8,w.ICoreBrowserService)],R)},4725:(c,o,u)=>{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 f=u(8343);o.ICharSizeService=(0,f.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),o.IMouseService=(0,f.createDecorator)("MouseService"),o.IRenderService=(0,f.createDecorator)("RenderService"),o.ISelectionService=(0,f.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,f.createDecorator)("ThemeService"),o.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(c,o,u){var f=this&&this.__decorate||function(R,N,L,I){var F,V=arguments.length,H=V<3?N:I===null?I=Object.getOwnPropertyDescriptor(N,L):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(R,N,L,I);else for(var z=R.length-1;z>=0;z--)(F=R[z])&&(H=(V<3?F(H):V>3?F(N,L,H):F(N,L))||H);return V>3&&H&&Object.defineProperty(N,L,H),H},g=this&&this.__param||function(R,N){return function(L,I){N(L,I,R)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=u(7239),m=u(8055),_=u(8460),w=u(844),C=u(2585),b=m.css.toColor("#ffffff"),S=m.css.toColor("#000000"),x=m.css.toColor("#ffffff"),y=m.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const R=[m.css.toColor("#2e3436"),m.css.toColor("#cc0000"),m.css.toColor("#4e9a06"),m.css.toColor("#c4a000"),m.css.toColor("#3465a4"),m.css.toColor("#75507b"),m.css.toColor("#06989a"),m.css.toColor("#d3d7cf"),m.css.toColor("#555753"),m.css.toColor("#ef2929"),m.css.toColor("#8ae234"),m.css.toColor("#fce94f"),m.css.toColor("#729fcf"),m.css.toColor("#ad7fa8"),m.css.toColor("#34e2e2"),m.css.toColor("#eeeeec")],N=[0,95,135,175,215,255];for(let L=0;L<216;L++){const I=N[L/36%6|0],F=N[L/6%6|0],V=N[L%6];R.push({css:m.channels.toCss(I,F,V),rgba:m.channels.toRgba(I,F,V)})}for(let L=0;L<24;L++){const I=8+10*L;R.push({css:m.channels.toCss(I,I,I),rgba:m.channels.toRgba(I,I,I)})}return R})());let D=o.ThemeService=class extends w.Disposable{get colors(){return this._colors}constructor(R){super(),this._optionsService=R,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new _.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:b,background:S,cursor:x,cursorAccent:y,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:m.color.blend(S,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:m.color.blend(S,k),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(R={}){const N=this._colors;if(N.foreground=T(R.foreground,b),N.background=T(R.background,S),N.cursor=T(R.cursor,x),N.cursorAccent=T(R.cursorAccent,y),N.selectionBackgroundTransparent=T(R.selectionBackground,k),N.selectionBackgroundOpaque=m.color.blend(N.background,N.selectionBackgroundTransparent),N.selectionInactiveBackgroundTransparent=T(R.selectionInactiveBackground,N.selectionBackgroundTransparent),N.selectionInactiveBackgroundOpaque=m.color.blend(N.background,N.selectionInactiveBackgroundTransparent),N.selectionForeground=R.selectionForeground?T(R.selectionForeground,m.NULL_COLOR):void 0,N.selectionForeground===m.NULL_COLOR&&(N.selectionForeground=void 0),m.color.isOpaque(N.selectionBackgroundTransparent)&&(N.selectionBackgroundTransparent=m.color.opacity(N.selectionBackgroundTransparent,.3)),m.color.isOpaque(N.selectionInactiveBackgroundTransparent)&&(N.selectionInactiveBackgroundTransparent=m.color.opacity(N.selectionInactiveBackgroundTransparent,.3)),N.ansi=o.DEFAULT_ANSI_COLORS.slice(),N.ansi[0]=T(R.black,o.DEFAULT_ANSI_COLORS[0]),N.ansi[1]=T(R.red,o.DEFAULT_ANSI_COLORS[1]),N.ansi[2]=T(R.green,o.DEFAULT_ANSI_COLORS[2]),N.ansi[3]=T(R.yellow,o.DEFAULT_ANSI_COLORS[3]),N.ansi[4]=T(R.blue,o.DEFAULT_ANSI_COLORS[4]),N.ansi[5]=T(R.magenta,o.DEFAULT_ANSI_COLORS[5]),N.ansi[6]=T(R.cyan,o.DEFAULT_ANSI_COLORS[6]),N.ansi[7]=T(R.white,o.DEFAULT_ANSI_COLORS[7]),N.ansi[8]=T(R.brightBlack,o.DEFAULT_ANSI_COLORS[8]),N.ansi[9]=T(R.brightRed,o.DEFAULT_ANSI_COLORS[9]),N.ansi[10]=T(R.brightGreen,o.DEFAULT_ANSI_COLORS[10]),N.ansi[11]=T(R.brightYellow,o.DEFAULT_ANSI_COLORS[11]),N.ansi[12]=T(R.brightBlue,o.DEFAULT_ANSI_COLORS[12]),N.ansi[13]=T(R.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),N.ansi[14]=T(R.brightCyan,o.DEFAULT_ANSI_COLORS[14]),N.ansi[15]=T(R.brightWhite,o.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const L=Math.min(N.ansi.length-16,R.extendedAnsi.length);for(let I=0;I{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const f=u(8460),g=u(844);class d extends g.Disposable{constructor(_){super(),this._maxLength=_,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.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(_){if(this._maxLength===_)return;const w=new Array(_);for(let C=0;Cthis._length)for(let w=this._length;w<_;w++)this._array[w]=void 0;this._length=_}get(_){return this._array[this._getCyclicIndex(_)]}set(_,w){this._array[this._getCyclicIndex(_)]=w}push(_){this._array[this._getCyclicIndex(this._length)]=_,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(_,w,...C){if(w){for(let b=_;b=_;b--)this._array[this._getCyclicIndex(b+C.length)]=this._array[this._getCyclicIndex(b)];for(let b=0;bthis._maxLength){const b=this._length+C.length-this._maxLength;this._startIndex+=b,this._length=this._maxLength,this.onTrimEmitter.fire(b)}else this._length+=C.length}trimStart(_){_>this._length&&(_=this._length),this._startIndex+=_,this._length-=_,this.onTrimEmitter.fire(_)}shiftElements(_,w,C){if(!(w<=0)){if(_<0||_>=this._length)throw new Error("start argument out of range");if(_+C<0)throw new Error("Cannot shift elements in list beyond index 0");if(C>0){for(let S=w-1;S>=0;S--)this.set(_+S+C,this.get(_+S));const b=_+w+C-this._length;if(b>0)for(this._length+=b;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let b=0;b{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function u(f,g=5){if(typeof f!="object")return f;const d=Array.isArray(f)?[]:{};for(const m in f)d[m]=g<=1?f[m]:f[m]&&u(f[m],g-1);return d}},8055:(c,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 u=0,f=0,g=0,d=0;var m,_,w,C,b;function S(y){const k=y.toString(16);return k.length<2?"0"+k:k}function x(y,k){return y>>0},y.toColor=function(k,D,T,R){return{css:y.toCss(k,D,T,R),rgba:y.toRgba(k,D,T,R)}}})(m||(o.channels=m={})),(function(y){function k(D,T){return d=Math.round(255*T),[u,f,g]=b.toChannels(D.rgba),{css:m.toCss(u,f,g,d),rgba:m.toRgba(u,f,g,d)}}y.blend=function(D,T){if(d=(255&T.rgba)/255,d===1)return{css:T.css,rgba:T.rgba};const R=T.rgba>>24&255,N=T.rgba>>16&255,L=T.rgba>>8&255,I=D.rgba>>24&255,F=D.rgba>>16&255,V=D.rgba>>8&255;return u=I+Math.round((R-I)*d),f=F+Math.round((N-F)*d),g=V+Math.round((L-V)*d),{css:m.toCss(u,f,g),rgba:m.toRgba(u,f,g)}},y.isOpaque=function(D){return(255&D.rgba)==255},y.ensureContrastRatio=function(D,T,R){const N=b.ensureContrastRatio(D.rgba,T.rgba,R);if(N)return m.toColor(N>>24&255,N>>16&255,N>>8&255)},y.opaque=function(D){const T=(255|D.rgba)>>>0;return[u,f,g]=b.toChannels(T),{css:m.toCss(u,f,g),rgba:T}},y.opacity=k,y.multiplyOpacity=function(D,T){return d=255&D.rgba,k(D,d*T/255)},y.toColorRGB=function(D){return[D.rgba>>24&255,D.rgba>>16&255,D.rgba>>8&255]}})(_||(o.color=_={})),(function(y){let k,D;try{const T=document.createElement("canvas");T.width=1,T.height=1;const R=T.getContext("2d",{willReadFrequently:!0});R&&(k=R,k.globalCompositeOperation="copy",D=k.createLinearGradient(0,0,1,1))}catch{}y.toColor=function(T){if(T.match(/#[\da-f]{3,8}/i))switch(T.length){case 4:return u=parseInt(T.slice(1,2).repeat(2),16),f=parseInt(T.slice(2,3).repeat(2),16),g=parseInt(T.slice(3,4).repeat(2),16),m.toColor(u,f,g);case 5:return u=parseInt(T.slice(1,2).repeat(2),16),f=parseInt(T.slice(2,3).repeat(2),16),g=parseInt(T.slice(3,4).repeat(2),16),d=parseInt(T.slice(4,5).repeat(2),16),m.toColor(u,f,g,d);case 7:return{css:T,rgba:(parseInt(T.slice(1),16)<<8|255)>>>0};case 9:return{css:T,rgba:parseInt(T.slice(1),16)>>>0}}const R=T.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return u=parseInt(R[1]),f=parseInt(R[2]),g=parseInt(R[3]),d=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),m.toColor(u,f,g,d);if(!k||!D)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=D,k.fillStyle=T,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[u,f,g,d]=k.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:m.toRgba(u,f,g,d),css:T}}})(w||(o.css=w={})),(function(y){function k(D,T,R){const N=D/255,L=T/255,I=R/255;return .2126*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}y.relativeLuminance=function(D){return k(D>>16&255,D>>8&255,255&D)},y.relativeLuminance2=k})(C||(o.rgb=C={})),(function(y){function k(T,R,N){const L=T>>24&255,I=T>>16&255,F=T>>8&255;let V=R>>24&255,H=R>>16&255,z=R>>8&255,q=x(C.relativeLuminance2(V,H,z),C.relativeLuminance2(L,I,F));for(;q0||H>0||z>0);)V-=Math.max(0,Math.ceil(.1*V)),H-=Math.max(0,Math.ceil(.1*H)),z-=Math.max(0,Math.ceil(.1*z)),q=x(C.relativeLuminance2(V,H,z),C.relativeLuminance2(L,I,F));return(V<<24|H<<16|z<<8|255)>>>0}function D(T,R,N){const L=T>>24&255,I=T>>16&255,F=T>>8&255;let V=R>>24&255,H=R>>16&255,z=R>>8&255,q=x(C.relativeLuminance2(V,H,z),C.relativeLuminance2(L,I,F));for(;q>>0}y.blend=function(T,R){if(d=(255&R)/255,d===1)return R;const N=R>>24&255,L=R>>16&255,I=R>>8&255,F=T>>24&255,V=T>>16&255,H=T>>8&255;return u=F+Math.round((N-F)*d),f=V+Math.round((L-V)*d),g=H+Math.round((I-H)*d),m.toRgba(u,f,g)},y.ensureContrastRatio=function(T,R,N){const L=C.relativeLuminance(T>>8),I=C.relativeLuminance(R>>8);if(x(L,I)>8));if(zx(L,C.relativeLuminance(q>>8))?H:q}return H}const F=D(T,R,N),V=x(L,C.relativeLuminance(F>>8));if(Vx(L,C.relativeLuminance(H>>8))?F:H}return F}},y.reduceLuminance=k,y.increaseLuminance=D,y.toChannels=function(T){return[T>>24&255,T>>16&255,T>>8&255,255&T]}})(b||(o.rgba=b={})),o.toPaddedHex=S,o.contrastRatio=x},8969:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const f=u(844),g=u(2585),d=u(4348),m=u(7866),_=u(744),w=u(7302),C=u(6975),b=u(8460),S=u(1753),x=u(1480),y=u(7994),k=u(9282),D=u(5435),T=u(5981),R=u(2660);let N=!1;class L extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new b.EventEmitter),this._onScroll.event((F=>{var V;(V=this._onScrollApi)==null||V.fire(F.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(F){for(const V in F)this.optionsService.options[V]=F[V]}constructor(F){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new b.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new b.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new b.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new w.OptionsService(F)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(_.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(m.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(C.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(S.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(y.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new D.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,b.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,b.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,b.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,b.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((V=>{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((V=>{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 T.WriteBuffer(((V,H)=>this._inputHandler.parse(V,H)))),this.register((0,b.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(F,V){this._writeBuffer.write(F,V)}writeSync(F,V){this._logService.logLevel<=g.LogLevelEnum.WARN&&!N&&(this._logService.warn("writeSync is unreliable and will be removed soon."),N=!0),this._writeBuffer.writeSync(F,V)}input(F,V=!0){this.coreService.triggerDataEvent(F,V)}resize(F,V){isNaN(F)||isNaN(V)||(F=Math.max(F,_.MINIMUM_COLS),V=Math.max(V,_.MINIMUM_ROWS),this._bufferService.resize(F,V))}scroll(F,V=!1){this._bufferService.scroll(F,V)}scrollLines(F,V,H){this._bufferService.scrollLines(F,V,H)}scrollPages(F){this.scrollLines(F*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(F){const V=F-this._bufferService.buffer.ydisp;V!==0&&this.scrollLines(V)}registerEscHandler(F,V){return this._inputHandler.registerEscHandler(F,V)}registerDcsHandler(F,V){return this._inputHandler.registerDcsHandler(F,V)}registerCsiHandler(F,V){return this._inputHandler.registerCsiHandler(F,V)}registerOscHandler(F,V){return this._inputHandler.registerOscHandler(F,V)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let F=!1;const V=this.optionsService.rawOptions.windowsPty;V&&V.buildNumber!==void 0&&V.buildNumber!==void 0?F=V.backend==="conpty"&&V.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(F=!0),F?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const F=[];F.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),F.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const V of F)V.dispose()}))}}}o.CoreTerminal=L},8460:(c,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=u=>(this._listeners.push(u),{dispose:()=>{if(!this._disposed){for(let f=0;ff.fire(g)))},o.runAndSubscribe=function(u,f){return f(void 0),u((g=>f(g)))}},5435:function(c,o,u){var f=this&&this.__decorate||function(K,O,M,j){var $,U=arguments.length,Q=U<3?O:j===null?j=Object.getOwnPropertyDescriptor(O,M):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Q=Reflect.decorate(K,O,M,j);else for(var ie=K.length-1;ie>=0;ie--)($=K[ie])&&(Q=(U<3?$(Q):U>3?$(O,M,Q):$(O,M))||Q);return U>3&&Q&&Object.defineProperty(O,M,Q),Q},g=this&&this.__param||function(K,O){return function(M,j){O(M,j,K)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=u(2584),m=u(7116),_=u(2015),w=u(844),C=u(482),b=u(8437),S=u(8460),x=u(643),y=u(511),k=u(3734),D=u(2585),T=u(1480),R=u(6242),N=u(6351),L=u(5941),I={"(":0,")":1,"*":2,"+":3,"-":1,".":2},F=131072;function V(K,O){if(K>24)return O.setWinLines||!1;switch(K){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 H;(function(K){K[K.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",K[K.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(H||(o.WindowsOptionsReportType=H={}));let z=0;class q extends w.Disposable{getAttrData(){return this._curAttrData}constructor(O,M,j,$,U,Q,ie,se,Z=new _.EscapeSequenceParser){super(),this._bufferService=O,this._charsetService=M,this._coreService=j,this._logService=$,this._optionsService=U,this._oscLinkService=Q,this._coreMouseService=ie,this._unicodeService=se,this._parser=Z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new C.StringToUtf32,this._utf8Decoder=new C.Utf8ToUtf32,this._workCell=new y.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new S.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new S.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new S.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new S.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new S.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new S.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new S.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new S.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new S.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new S.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new S.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new S.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new S.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 G(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((P=>this._activeBuffer=P.activeBuffer))),this._parser.setCsiHandlerFallback(((P,ee)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(P),params:ee.toArray()})})),this._parser.setEscHandlerFallback((P=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(P)})})),this._parser.setExecuteHandlerFallback((P=>{this._logService.debug("Unknown EXECUTE code: ",{code:P})})),this._parser.setOscHandlerFallback(((P,ee,te)=>{this._logService.debug("Unknown OSC code: ",{identifier:P,action:ee,data:te})})),this._parser.setDcsHandlerFallback(((P,ee,te)=>{ee==="HOOK"&&(te=te.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(P),action:ee,payload:te})})),this._parser.setPrintHandler(((P,ee,te)=>this.print(P,ee,te))),this._parser.registerCsiHandler({final:"@"},(P=>this.insertChars(P))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(P=>this.scrollLeft(P))),this._parser.registerCsiHandler({final:"A"},(P=>this.cursorUp(P))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(P=>this.scrollRight(P))),this._parser.registerCsiHandler({final:"B"},(P=>this.cursorDown(P))),this._parser.registerCsiHandler({final:"C"},(P=>this.cursorForward(P))),this._parser.registerCsiHandler({final:"D"},(P=>this.cursorBackward(P))),this._parser.registerCsiHandler({final:"E"},(P=>this.cursorNextLine(P))),this._parser.registerCsiHandler({final:"F"},(P=>this.cursorPrecedingLine(P))),this._parser.registerCsiHandler({final:"G"},(P=>this.cursorCharAbsolute(P))),this._parser.registerCsiHandler({final:"H"},(P=>this.cursorPosition(P))),this._parser.registerCsiHandler({final:"I"},(P=>this.cursorForwardTab(P))),this._parser.registerCsiHandler({final:"J"},(P=>this.eraseInDisplay(P,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(P=>this.eraseInDisplay(P,!0))),this._parser.registerCsiHandler({final:"K"},(P=>this.eraseInLine(P,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(P=>this.eraseInLine(P,!0))),this._parser.registerCsiHandler({final:"L"},(P=>this.insertLines(P))),this._parser.registerCsiHandler({final:"M"},(P=>this.deleteLines(P))),this._parser.registerCsiHandler({final:"P"},(P=>this.deleteChars(P))),this._parser.registerCsiHandler({final:"S"},(P=>this.scrollUp(P))),this._parser.registerCsiHandler({final:"T"},(P=>this.scrollDown(P))),this._parser.registerCsiHandler({final:"X"},(P=>this.eraseChars(P))),this._parser.registerCsiHandler({final:"Z"},(P=>this.cursorBackwardTab(P))),this._parser.registerCsiHandler({final:"`"},(P=>this.charPosAbsolute(P))),this._parser.registerCsiHandler({final:"a"},(P=>this.hPositionRelative(P))),this._parser.registerCsiHandler({final:"b"},(P=>this.repeatPrecedingCharacter(P))),this._parser.registerCsiHandler({final:"c"},(P=>this.sendDeviceAttributesPrimary(P))),this._parser.registerCsiHandler({prefix:">",final:"c"},(P=>this.sendDeviceAttributesSecondary(P))),this._parser.registerCsiHandler({final:"d"},(P=>this.linePosAbsolute(P))),this._parser.registerCsiHandler({final:"e"},(P=>this.vPositionRelative(P))),this._parser.registerCsiHandler({final:"f"},(P=>this.hVPosition(P))),this._parser.registerCsiHandler({final:"g"},(P=>this.tabClear(P))),this._parser.registerCsiHandler({final:"h"},(P=>this.setMode(P))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(P=>this.setModePrivate(P))),this._parser.registerCsiHandler({final:"l"},(P=>this.resetMode(P))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(P=>this.resetModePrivate(P))),this._parser.registerCsiHandler({final:"m"},(P=>this.charAttributes(P))),this._parser.registerCsiHandler({final:"n"},(P=>this.deviceStatus(P))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(P=>this.deviceStatusPrivate(P))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(P=>this.softReset(P))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(P=>this.setCursorStyle(P))),this._parser.registerCsiHandler({final:"r"},(P=>this.setScrollRegion(P))),this._parser.registerCsiHandler({final:"s"},(P=>this.saveCursor(P))),this._parser.registerCsiHandler({final:"t"},(P=>this.windowOptions(P))),this._parser.registerCsiHandler({final:"u"},(P=>this.restoreCursor(P))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(P=>this.insertColumns(P))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(P=>this.deleteColumns(P))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(P=>this.selectProtected(P))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(P=>this.requestMode(P,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(P=>this.requestMode(P,!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 R.OscHandler((P=>(this.setTitle(P),this.setIconName(P),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((P=>this.setIconName(P)))),this._parser.registerOscHandler(2,new R.OscHandler((P=>this.setTitle(P)))),this._parser.registerOscHandler(4,new R.OscHandler((P=>this.setOrReportIndexedColor(P)))),this._parser.registerOscHandler(8,new R.OscHandler((P=>this.setHyperlink(P)))),this._parser.registerOscHandler(10,new R.OscHandler((P=>this.setOrReportFgColor(P)))),this._parser.registerOscHandler(11,new R.OscHandler((P=>this.setOrReportBgColor(P)))),this._parser.registerOscHandler(12,new R.OscHandler((P=>this.setOrReportCursorColor(P)))),this._parser.registerOscHandler(104,new R.OscHandler((P=>this.restoreIndexedColor(P)))),this._parser.registerOscHandler(110,new R.OscHandler((P=>this.restoreFgColor(P)))),this._parser.registerOscHandler(111,new R.OscHandler((P=>this.restoreBgColor(P)))),this._parser.registerOscHandler(112,new R.OscHandler((P=>this.restoreCursorColor(P)))),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 P in m.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:P},(()=>this.selectCharset("("+P))),this._parser.registerEscHandler({intermediates:")",final:P},(()=>this.selectCharset(")"+P))),this._parser.registerEscHandler({intermediates:"*",final:P},(()=>this.selectCharset("*"+P))),this._parser.registerEscHandler({intermediates:"+",final:P},(()=>this.selectCharset("+"+P))),this._parser.registerEscHandler({intermediates:"-",final:P},(()=>this.selectCharset("-"+P))),this._parser.registerEscHandler({intermediates:".",final:P},(()=>this.selectCharset("."+P))),this._parser.registerEscHandler({intermediates:"/",final:P},(()=>this.selectCharset("/"+P)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((P=>(this._logService.error("Parsing error: ",P),P))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new N.DcsHandler(((P,ee)=>this.requestStatusString(P,ee))))}_preserveStack(O,M,j,$){this._parseStack.paused=!0,this._parseStack.cursorStartX=O,this._parseStack.cursorStartY=M,this._parseStack.decodedLength=j,this._parseStack.position=$}_logSlowResolvingAsync(O){this._logService.logLevel<=D.LogLevelEnum.WARN&&Promise.race([O,new Promise(((M,j)=>setTimeout((()=>j("#SLOW_TIMEOUT")),5e3)))]).catch((M=>{if(M!=="#SLOW_TIMEOUT")throw M;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(O,M){let j,$=this._activeBuffer.x,U=this._activeBuffer.y,Q=0;const ie=this._parseStack.paused;if(ie){if(j=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,M))return this._logSlowResolvingAsync(j),j;$=this._parseStack.cursorStartX,U=this._parseStack.cursorStartY,this._parseStack.paused=!1,O.length>F&&(Q=this._parseStack.position+F)}if(this._logService.logLevel<=D.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof O=="string"?` "${O}"`:` "${Array.prototype.map.call(O,(P=>String.fromCharCode(P))).join("")}"`),typeof O=="string"?O.split("").map((P=>P.charCodeAt(0))):O),this._parseBuffer.lengthF)for(let P=Q;P0&&te.getWidth(this._activeBuffer.x-1)===2&&te.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ee);let pe=this._parser.precedingJoinState;for(let ue=M;uese){if(Z){const ye=te;let be=this._activeBuffer.x-le;for(this._activeBuffer.x=le,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),te=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),le>0&&te instanceof b.BufferLine&&te.copyCellsFrom(ye,be,0,le,!1);be=0;)te.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}else if(P&&(te.insertCells(this._activeBuffer.x,U-le,this._activeBuffer.getNullCell(ee)),te.getWidth(se-1)===2&&te.setCellFromCodepoint(se-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,ee)),te.setCellFromCodepoint(this._activeBuffer.x++,$,U,ee),U>0)for(;--U;)te.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}this._parser.precedingJoinState=pe,this._activeBuffer.x0&&te.getWidth(this._activeBuffer.x)===0&&!te.hasContent(this._activeBuffer.x)&&te.setCellFromCodepoint(this._activeBuffer.x,0,1,ee),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(O,M){return O.final!=="t"||O.prefix||O.intermediates?this._parser.registerCsiHandler(O,M):this._parser.registerCsiHandler(O,(j=>!V(j.params[0],this._optionsService.rawOptions.windowOptions)||M(j)))}registerDcsHandler(O,M){return this._parser.registerDcsHandler(O,new N.DcsHandler(M))}registerEscHandler(O,M){return this._parser.registerEscHandler(O,M)}registerOscHandler(O,M){return this._parser.registerOscHandler(O,new R.OscHandler(M))}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 M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);M.hasWidth(this._activeBuffer.x)&&!M.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,M){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=O,this._activeBuffer.y=this._activeBuffer.scrollTop+M):(this._activeBuffer.x=O,this._activeBuffer.y=M),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(O,M){this._restrictCursor(),this._setCursor(this._activeBuffer.x+O,this._activeBuffer.y+M)}cursorUp(O){const M=this._activeBuffer.y-this._activeBuffer.scrollTop;return M>=0?this._moveCursor(0,-Math.min(M,O.params[0]||1)):this._moveCursor(0,-(O.params[0]||1)),!0}cursorDown(O){const M=this._activeBuffer.scrollBottom-this._activeBuffer.y;return M>=0?this._moveCursor(0,Math.min(M,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 M=O.params[0];return M===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:M===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=O.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let M=O.params[0]||1;for(;M--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(O){const M=O.params[0];return M===1&&(this._curAttrData.bg|=536870912),M!==2&&M!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(O,M,j,$=!1,U=!1){const Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);Q.replaceCells(M,j,this._activeBuffer.getNullCell(this._eraseAttrData()),U),$&&(Q.isWrapped=!1)}_resetBufferLine(O,M=!1){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);j&&(j.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),M),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+O),j.isWrapped=!1)}eraseInDisplay(O,M=!1){let j;switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:for(j=this._activeBuffer.y,this._dirtyRowTracker.markDirty(j),this._eraseInBufferLine(j++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,M);j=this._bufferService.cols&&(this._activeBuffer.lines.get(j+1).isWrapped=!1);j--;)this._resetBufferLine(j,M);this._dirtyRowTracker.markDirty(0);break;case 2:for(j=this._bufferService.rows,this._dirtyRowTracker.markDirty(j-1);j--;)this._resetBufferLine(j,M);this._dirtyRowTracker.markDirty(0);break;case 3:const $=this._activeBuffer.lines.length-this._bufferService.rows;$>0&&(this._activeBuffer.lines.trimStart($),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-$,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-$,0),this._onScroll.fire(0))}return!0}eraseInLine(O,M=!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,M);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,M);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,M)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(O){this._restrictCursor();let M=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 Z=se;for(let P=1;P0||(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 M=0;Mwe?1:2,pe=O.params[0];return ue=pe,me=M?pe===2?4:pe===4?te(Q.modes.insertMode):pe===12?3:pe===20?te(ee.convertEol):0:pe===1?te(j.applicationCursorKeys):pe===3?ee.windowOptions.setWinLines?se===80?2:se===132?1:0:0:pe===6?te(j.origin):pe===7?te(j.wraparound):pe===8?3:pe===9?te($==="X10"):pe===12?te(ee.cursorBlink):pe===25?te(!Q.isCursorHidden):pe===45?te(j.reverseWraparound):pe===66?te(j.applicationKeypad):pe===67?4:pe===1e3?te($==="VT200"):pe===1002?te($==="DRAG"):pe===1003?te($==="ANY"):pe===1004?te(j.sendFocus):pe===1005?4:pe===1006?te(U==="SGR"):pe===1015?4:pe===1016?te(U==="SGR_PIXELS"):pe===1048?1:pe===47||pe===1047||pe===1049?te(Z===P):pe===2004?te(j.bracketedPasteMode):0,Q.triggerDataEvent(`${d.C0.ESC}[${M?"":"?"}${ue};${me}$y`),!0;var ue,me}_updateAttrColor(O,M,j,$,U){return M===2?(O|=50331648,O&=-16777216,O|=k.AttributeData.fromColorRGB([j,$,U])):M===5&&(O&=-50331904,O|=33554432|255&j),O}_extractColor(O,M,j){const $=[0,0,-1,0,0,0];let U=0,Q=0;do{if($[Q+U]=O.params[M+Q],O.hasSubParams(M+Q)){const ie=O.getSubParams(M+Q);let se=0;do $[1]===5&&(U=1),$[Q+se+1+U]=ie[se];while(++se=2||$[1]===2&&Q+U>=5)break;$[1]&&(U=1)}while(++Q+M5)&&(O=1),M.extended.underlineStyle=O,M.fg|=268435456,O===0&&(M.fg&=-268435457),M.updateExtended()}_processSGR0(O){O.fg=b.DEFAULT_ATTR_DATA.fg,O.bg=b.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 M=O.length;let j;const $=this._curAttrData;for(let U=0;U=30&&j<=37?($.fg&=-50331904,$.fg|=16777216|j-30):j>=40&&j<=47?($.bg&=-50331904,$.bg|=16777216|j-40):j>=90&&j<=97?($.fg&=-50331904,$.fg|=16777224|j-90):j>=100&&j<=107?($.bg&=-50331904,$.bg|=16777224|j-100):j===0?this._processSGR0($):j===1?$.fg|=134217728:j===3?$.bg|=67108864:j===4?($.fg|=268435456,this._processUnderline(O.hasSubParams(U)?O.getSubParams(U)[0]:1,$)):j===5?$.fg|=536870912:j===7?$.fg|=67108864:j===8?$.fg|=1073741824:j===9?$.fg|=2147483648:j===2?$.bg|=134217728:j===21?this._processUnderline(2,$):j===22?($.fg&=-134217729,$.bg&=-134217729):j===23?$.bg&=-67108865:j===24?($.fg&=-268435457,this._processUnderline(0,$)):j===25?$.fg&=-536870913:j===27?$.fg&=-67108865:j===28?$.fg&=-1073741825:j===29?$.fg&=2147483647:j===39?($.fg&=-67108864,$.fg|=16777215&b.DEFAULT_ATTR_DATA.fg):j===49?($.bg&=-67108864,$.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):j===38||j===48||j===58?U+=this._extractColor(O,U,$):j===53?$.bg|=1073741824:j===55?$.bg&=-1073741825:j===59?($.extended=$.extended.clone(),$.extended.underlineColor=-1,$.updateExtended()):j===100?($.fg&=-67108864,$.fg|=16777215&b.DEFAULT_ATTR_DATA.fg,$.bg&=-67108864,$.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",j);return!0}deviceStatus(O){switch(O.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const M=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${M};${j}R`)}return!0}deviceStatusPrivate(O){if(O.params[0]===6){const M=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${M};${j}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=b.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 M=O.params[0]||1;switch(M){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 j=M%2==1;return this._optionsService.options.cursorBlink=j,!0}setScrollRegion(O){const M=O.params[0]||1;let j;return(O.length<2||(j=O.params[1])>this._bufferService.rows||j===0)&&(j=this._bufferService.rows),j>M&&(this._activeBuffer.scrollTop=M-1,this._activeBuffer.scrollBottom=j-1,this._setCursor(0,0)),!0}windowOptions(O){if(!V(O.params[0],this._optionsService.rawOptions.windowOptions))return!0;const M=O.length>1?O.params[1]:0;switch(O.params[0]){case 14:M!==2&&this._onRequestWindowsOptionsReport.fire(H.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(H.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:M!==0&&M!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),M!==0&&M!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:M!==0&&M!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),M!==0&&M!==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 M=[],j=O.split(";");for(;j.length>1;){const $=j.shift(),U=j.shift();if(/^\d+$/.exec($)){const Q=parseInt($);if(X(Q))if(U==="?")M.push({type:0,index:Q});else{const ie=(0,L.parseColor)(U);ie&&M.push({type:1,index:Q,color:ie})}}}return M.length&&this._onColor.fire(M),!0}setHyperlink(O){const M=O.split(";");return!(M.length<2)&&(M[1]?this._createHyperlink(M[0],M[1]):!M[0]&&this._finishHyperlink())}_createHyperlink(O,M){this._getCurrentLinkId()&&this._finishHyperlink();const j=O.split(":");let $;const U=j.findIndex((Q=>Q.startsWith("id=")));return U!==-1&&($=j[U].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:$,uri:M}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(O,M){const j=O.split(";");for(let $=0;$=this._specialColors.length);++$,++M)if(j[$]==="?")this._onColor.fire([{type:0,index:this._specialColors[M]}]);else{const U=(0,L.parseColor)(j[$]);U&&this._onColor.fire([{type:1,index:this._specialColors[M],color:U}])}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 M=[],j=O.split(";");for(let $=0;$=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=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.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 M=0;M(this._coreService.triggerDataEvent(`${d.C0.ESC}${U}${d.C0.ESC}\\`),!0))(O==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:O==='"p'?'P1$r61;1"p':O==="r"?`P1$r${j.scrollTop+1};${j.scrollBottom+1}r`:O==="m"?"P1$r0m":O===" q"?`P1$r${{block:2,underline:4,bar:6}[$.cursorStyle]-($.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(O,M){this._dirtyRowTracker.markRangeDirty(O,M)}}o.InputHandler=q;let G=class{constructor(K){this._bufferService=K,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(K){Kthis.end&&(this.end=K)}markRangeDirty(K,O){K>O&&(z=K,K=O,O=z),Kthis.end&&(this.end=O)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(K){return 0<=K&&K<256}G=f([g(0,D.IBufferService)],G)},844:(c,o)=>{function u(f){for(const g of f)g.dispose();f.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 f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const g=this._disposables.indexOf(f);g!==-1&&this._disposables.splice(g,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var g;this._isDisposed||f===this._value||((g=this._value)==null||g.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},o.toDisposable=function(f){return{dispose:f}},o.disposeArray=u,o.getDisposeArrayDisposable=function(f){return{dispose:()=>u(f)}}},1505:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(g,d,m){this._data[g]||(this._data[g]={}),this._data[g][d]=m}get(g,d){return this._data[g]?this._data[g][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=u,o.FourKeyMap=class{constructor(){this._data=new u}set(f,g,d,m,_){this._data.get(f,g)||this._data.set(f,g,new u),this._data.get(f,g).set(d,m,_)}get(f,g,d,m){var _;return(_=this._data.get(f,g))==null?void 0:_.get(d,m)}clear(){this._data.clear()}}},6114:(c,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 u=o.isNode?"node":navigator.userAgent,f=o.isNode?"node":navigator.platform;o.isFirefox=u.includes("Firefox"),o.isLegacyEdge=u.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(u),o.getSafariVersion=function(){if(!o.isSafari)return 0;const g=u.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),o.isIpad=f==="iPad",o.isIphone=f==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),o.isLinux=f.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(u)},6106:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let u=0;o.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(u=this._search(this._getKey(f)),this._array.splice(u,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const g=this._getKey(f);if(g===void 0||(u=this._search(g),u===-1)||this._getKey(this._array[u])!==g)return!1;do if(this._array[u]===f)return this._array.splice(u,1),!0;while(++u=this._array.length)&&this._getKey(this._array[u])===f))do yield this._array[u];while(++u=this._array.length)&&this._getKey(this._array[u])===f))do g(this._array[u]);while(++u=g;){let m=g+d>>1;const _=this._getKey(this._array[m]);if(_>f)d=m-1;else{if(!(_0&&this._getKey(this._array[m-1])===f;)m--;return m}g=m+1}}return g}}},7226:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const f=u(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(_){this._tasks.push(_),this._start()}flush(){for(;this._iS)return b-w<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(b-w))}ms`),void this._start();b=S}this.clear()}}class d extends g{_requestCallback(_){return setTimeout((()=>_(this._createDeadline(16))))}_cancelCallback(_){clearTimeout(_)}_createDeadline(_){const w=Date.now()+_;return{timeRemaining:()=>Math.max(0,w-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(m){return requestIdleCallback(m)}_cancelCallback(m){cancelIdleCallback(m)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(m){this._queue.clear(),this._queue.enqueue(m)}flush(){this._queue.flush()}}},9282:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const f=u(643);o.updateWindowsModeWrappedState=function(g){const d=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),m=d==null?void 0:d.get(g.cols-1),_=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);_&&m&&(_.isWrapped=m[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&m[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class u{constructor(){this.fg=0,this.bg=0,this.extended=new f}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 u;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=u;class f{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,m=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=m}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=f},9092:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const f=u(6349),g=u(7226),d=u(3734),m=u(8437),_=u(4634),w=u(511),C=u(643),b=u(4863),S=u(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(x,y,k){this._hasScrollback=x,this._optionsService=y,this._bufferService=k,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=m.DEFAULT_ATTR_DATA.clone(),this.savedCharset=S.DEFAULT_CHARSET,this.markers=[],this._nullCell=w.CellData.fromCharData([0,C.NULL_CELL_CHAR,C.NULL_CELL_WIDTH,C.NULL_CELL_CODE]),this._whitespaceCell=w.CellData.fromCharData([0,C.WHITESPACE_CELL_CHAR,C.WHITESPACE_CELL_WIDTH,C.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(x){return x?(this._nullCell.fg=x.fg,this._nullCell.bg=x.bg,this._nullCell.extended=x.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(x){return x?(this._whitespaceCell.fg=x.fg,this._whitespaceCell.bg=x.bg,this._whitespaceCell.extended=x.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,y){return new m.BufferLine(this._bufferService.cols,this.getNullCell(x),y)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&xo.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:y}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=m.DEFAULT_ATTR_DATA);let y=this._rows;for(;y--;)this.lines.push(this.getBlankLine(x))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(x,y){const k=this.getNullCell(m.DEFAULT_ATTR_DATA);let D=0;const T=this._getCorrectBufferLength(y);if(T>this.lines.maxLength&&(this.lines.maxLength=T),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+R+1?(this.ybase--,R++,this.ydisp>0&&this.ydisp--):this.lines.push(new m.BufferLine(x,k)));else for(let N=this._rows;N>y;N--)this.lines.length>y+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(T0&&(this.lines.trimStart(N),this.ybase=Math.max(this.ybase-N,0),this.ydisp=Math.max(this.ydisp-N,0),this.savedY=Math.max(this.savedY-N,0)),this.lines.maxLength=T}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,y-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=y-1,this._isReflowEnabled&&(this._reflow(x,y),this._cols>x))for(let R=0;R.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let x=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,x=!1);let y=0;for(;this._memoryCleanupPosition100)return!0;return x}get _isReflowEnabled(){const x=this._optionsService.rawOptions.windowsPty;return x&&x.buildNumber?this._hasScrollback&&x.backend==="conpty"&&x.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(x,y){this._cols!==x&&(x>this._cols?this._reflowLarger(x,y):this._reflowSmaller(x,y))}_reflowLarger(x,y){const k=(0,_.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(m.DEFAULT_ATTR_DATA));if(k.length>0){const D=(0,_.reflowLargerCreateNewLayout)(this.lines,k);(0,_.reflowLargerApplyNewLayout)(this.lines,D.layout),this._reflowLargerAdjustViewport(x,y,D.countRemoved)}}_reflowLargerAdjustViewport(x,y,k){const D=this.getNullCell(m.DEFAULT_ATTR_DATA);let T=k;for(;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;R--){let N=this.lines.get(R);if(!N||!N.isWrapped&&N.getTrimmedLength()<=x)continue;const L=[N];for(;N.isWrapped&&R>0;)N=this.lines.get(--R),L.unshift(N);const I=this.ybase+this.y;if(I>=R&&I0&&(D.push({start:R+L.length+T,newLines:q}),T+=q.length),L.push(...q);let G=V.length-1,X=V[G];X===0&&(G--,X=V[G]);let K=L.length-H-1,O=F;for(;K>=0;){const j=Math.min(O,X);if(L[G]===void 0)break;if(L[G].copyCellsFrom(L[K],O-j,X-j,j,!0),X-=j,X===0&&(G--,X=V[G]),O-=j,O===0){K--;const $=Math.max(K,0);O=(0,_.getWrappedLineTrimmedLength)(L,$,this._cols)}}for(let j=0;j0;)this.ybase===0?this.y0){const R=[],N=[];for(let G=0;G=0;G--)if(V&&V.start>I+H){for(let X=V.newLines.length-1;X>=0;X--)this.lines.set(G--,V.newLines[X]);G++,R.push({index:I+1,amount:V.newLines.length}),H+=V.newLines.length,V=D[++F]}else this.lines.set(G,N[I--]);let z=0;for(let G=R.length-1;G>=0;G--)R[G].index+=z,this.lines.onInsertEmitter.fire(R[G]),z+=R[G].amount;const q=Math.max(0,L+T-this.lines.maxLength);q>0&&this.lines.onTrimEmitter.fire(q)}}translateBufferLineToString(x,y,k=0,D){const T=this.lines.get(x);return T?T.translateToString(y,k,D):""}getWrappedRangeForLine(x){let y=x,k=x;for(;y>0&&this.lines.get(y).isWrapped;)y--;for(;k+10;);return x>=this._cols?this._cols-1:x<0?0:x}nextStop(x){for(x==null&&(x=this.x);!this.tabs[++x]&&x=this._cols?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let y=0;y{y.line-=k,y.line<0&&y.dispose()}))),y.register(this.lines.onInsert((k=>{y.line>=k.index&&(y.line+=k.amount)}))),y.register(this.lines.onDelete((k=>{y.line>=k.index&&y.linek.index&&(y.line-=k.amount)}))),y.register(y.onDispose((()=>this._removeMarker(y)))),y}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const f=u(3734),g=u(511),d=u(643),m=u(482);o.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let _=0;class w{constructor(b,S,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*b);const y=S||g.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let k=0;k>22,2097152&S?this._combined[b].charCodeAt(this._combined[b].length-1):x]}set(b,S){this._data[3*b+1]=S[d.CHAR_DATA_ATTR_INDEX],S[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[b]=S[1],this._data[3*b+0]=2097152|b|S[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*b+0]=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(b){return this._data[3*b+0]>>22}hasWidth(b){return 12582912&this._data[3*b+0]}getFg(b){return this._data[3*b+1]}getBg(b){return this._data[3*b+2]}hasContent(b){return 4194303&this._data[3*b+0]}getCodePoint(b){const S=this._data[3*b+0];return 2097152&S?this._combined[b].charCodeAt(this._combined[b].length-1):2097151&S}isCombined(b){return 2097152&this._data[3*b+0]}getString(b){const S=this._data[3*b+0];return 2097152&S?this._combined[b]:2097151&S?(0,m.stringFromCodePoint)(2097151&S):""}isProtected(b){return 536870912&this._data[3*b+2]}loadCell(b,S){return _=3*b,S.content=this._data[_+0],S.fg=this._data[_+1],S.bg=this._data[_+2],2097152&S.content&&(S.combinedData=this._combined[b]),268435456&S.bg&&(S.extended=this._extendedAttrs[b]),S}setCell(b,S){2097152&S.content&&(this._combined[b]=S.combinedData),268435456&S.bg&&(this._extendedAttrs[b]=S.extended),this._data[3*b+0]=S.content,this._data[3*b+1]=S.fg,this._data[3*b+2]=S.bg}setCellFromCodepoint(b,S,x,y){268435456&y.bg&&(this._extendedAttrs[b]=y.extended),this._data[3*b+0]=S|x<<22,this._data[3*b+1]=y.fg,this._data[3*b+2]=y.bg}addCodepointToCell(b,S,x){let y=this._data[3*b+0];2097152&y?this._combined[b]+=(0,m.stringFromCodePoint)(S):2097151&y?(this._combined[b]=(0,m.stringFromCodePoint)(2097151&y)+(0,m.stringFromCodePoint)(S),y&=-2097152,y|=2097152):y=S|4194304,x&&(y&=-12582913,y|=x<<22),this._data[3*b+0]=y}insertCells(b,S,x){if((b%=this.length)&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,x),S=0;--k)this.setCell(b+S+k,this.loadCell(b+k,y));for(let k=0;kthis.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const y=new Uint32Array(x);y.set(this._data),this._data=y}for(let y=this.length;y=b&&delete this._combined[T]}const k=Object.keys(this._extendedAttrs);for(let D=0;D=b&&delete this._extendedAttrs[T]}}return this.length=b,4*x*2=0;--b)if(4194303&this._data[3*b+0])return b+(this._data[3*b+0]>>22);return 0}getNoBgTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0]||50331648&this._data[3*b+2])return b+(this._data[3*b+0]>>22);return 0}copyCellsFrom(b,S,x,y,k){const D=b._data;if(k)for(let R=y-1;R>=0;R--){for(let N=0;N<3;N++)this._data[3*(x+R)+N]=D[3*(S+R)+N];268435456&D[3*(S+R)+2]&&(this._extendedAttrs[x+R]=b._extendedAttrs[S+R])}else for(let R=0;R=S&&(this._combined[N-S+x]=b._combined[N])}}translateToString(b,S,x,y){S=S??0,x=x??this.length,b&&(x=Math.min(x,this.getTrimmedLength())),y&&(y.length=0);let k="";for(;S>22||1}return y&&y.push(S),k}}o.BufferLine=w},4841:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(u,f){if(u.start.y>u.end.y)throw new Error(`Buffer range end (${u.end.x}, ${u.end.y}) cannot be before start (${u.start.x}, ${u.start.y})`);return f*(u.end.y-u.start.y)+(u.end.x-u.start.x+1)}},4634:(c,o)=>{function u(f,g,d){if(g===f.length-1)return f[g].getTrimmedLength();const m=!f[g].hasContent(d-1)&&f[g].getWidth(d-1)===1,_=f[g+1].getWidth(0)===2;return 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(f,g,d,m,_){const w=[];for(let C=0;C=C&&m0&&(N>y||x[N].getTrimmedLength()===0);N--)R++;R>0&&(w.push(C+x.length-R),w.push(R)),C+=x.length-1}return w},o.reflowLargerCreateNewLayout=function(f,g){const d=[];let m=0,_=g[m],w=0;for(let C=0;Cu(f,x,g))).reduce(((S,x)=>S+x));let w=0,C=0,b=0;for(;b<_;){if(_-bS&&(w-=S,C++);const x=f[C].getWidth(w-1)===2;x&&w--;const y=x?d-1:d;m.push(y),b+=y}return m},o.getWrappedLineTrimmedLength=u},5295:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const f=u(8460),g=u(844),d=u(9092);class m extends g.Disposable{constructor(w,C){super(),this._optionsService=w,this._bufferService=C,this._onBufferActivate=this.register(new f.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(w){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(w),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(w,C){this._normal.resize(w,C),this._alt.resize(w,C),this.setupTabStops(w)}setupTabStops(w){this._normal.setupTabStops(w),this._alt.setupTabStops(w)}}o.BufferSet=m},511:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const f=u(482),g=u(643),d=u(3734);class m extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(w){const C=new m;return C.setFromCharData(w),C}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(w){this.fg=w[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let C=!1;if(w[g.CHAR_DATA_CHAR_INDEX].length>2)C=!0;else if(w[g.CHAR_DATA_CHAR_INDEX].length===2){const b=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=b&&b<=56319){const S=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=S&&S<=57343?this.content=1024*(b-55296)+S-56320+65536|w[g.CHAR_DATA_WIDTH_INDEX]<<22:C=!0}else C=!0}else this.content=w[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|w[g.CHAR_DATA_WIDTH_INDEX]<<22;C&&(this.combinedData=w[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|w[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=m},643:(c,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:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const f=u(8460),g=u(844);class d{get id(){return this._id}constructor(_){this.line=_,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(_){return this._disposables.push(_),_}}o.Marker=d,d._nextId=1},7116:(c,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:(c,o)=>{var u,f,g;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=""})(u||(o.C0=u={})),(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="Ÿ"})(f||(o.C1=f={})),(function(d){d.ST=`${u.ESC}\\`})(g||(o.C1_ESCAPED=g={}))},7399:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const f=u(2584),g={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,m,_,w){const C={type:0,cancel:!1,key:void 0},b=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?C.key=m?f.C0.ESC+"OA":f.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?C.key=m?f.C0.ESC+"OD":f.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?C.key=m?f.C0.ESC+"OC":f.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(C.key=m?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:C.key=d.ctrlKey?"\b":f.C0.DEL,d.altKey&&(C.key=f.C0.ESC+C.key);break;case 9:if(d.shiftKey){C.key=f.C0.ESC+"[Z";break}C.key=f.C0.HT,C.cancel=!0;break;case 13:C.key=d.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,C.cancel=!0;break;case 27:C.key=f.C0.ESC,d.altKey&&(C.key=f.C0.ESC+f.C0.ESC),C.cancel=!0;break;case 37:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"D",C.key===f.C0.ESC+"[1;3D"&&(C.key=f.C0.ESC+(_?"b":"[1;5D"))):C.key=m?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"C",C.key===f.C0.ESC+"[1;3C"&&(C.key=f.C0.ESC+(_?"f":"[1;5C"))):C.key=m?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"A",_||C.key!==f.C0.ESC+"[1;3A"||(C.key=f.C0.ESC+"[1;5A")):C.key=m?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(d.metaKey)break;b?(C.key=f.C0.ESC+"[1;"+(b+1)+"B",_||C.key!==f.C0.ESC+"[1;3B"||(C.key=f.C0.ESC+"[1;5B")):C.key=m?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(C.key=f.C0.ESC+"[2~");break;case 46:C.key=b?f.C0.ESC+"[3;"+(b+1)+"~":f.C0.ESC+"[3~";break;case 36:C.key=b?f.C0.ESC+"[1;"+(b+1)+"H":m?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:C.key=b?f.C0.ESC+"[1;"+(b+1)+"F":m?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:d.shiftKey?C.type=2:d.ctrlKey?C.key=f.C0.ESC+"[5;"+(b+1)+"~":C.key=f.C0.ESC+"[5~";break;case 34:d.shiftKey?C.type=3:d.ctrlKey?C.key=f.C0.ESC+"[6;"+(b+1)+"~":C.key=f.C0.ESC+"[6~";break;case 112:C.key=b?f.C0.ESC+"[1;"+(b+1)+"P":f.C0.ESC+"OP";break;case 113:C.key=b?f.C0.ESC+"[1;"+(b+1)+"Q":f.C0.ESC+"OQ";break;case 114:C.key=b?f.C0.ESC+"[1;"+(b+1)+"R":f.C0.ESC+"OR";break;case 115:C.key=b?f.C0.ESC+"[1;"+(b+1)+"S":f.C0.ESC+"OS";break;case 116:C.key=b?f.C0.ESC+"[15;"+(b+1)+"~":f.C0.ESC+"[15~";break;case 117:C.key=b?f.C0.ESC+"[17;"+(b+1)+"~":f.C0.ESC+"[17~";break;case 118:C.key=b?f.C0.ESC+"[18;"+(b+1)+"~":f.C0.ESC+"[18~";break;case 119:C.key=b?f.C0.ESC+"[19;"+(b+1)+"~":f.C0.ESC+"[19~";break;case 120:C.key=b?f.C0.ESC+"[20;"+(b+1)+"~":f.C0.ESC+"[20~";break;case 121:C.key=b?f.C0.ESC+"[21;"+(b+1)+"~":f.C0.ESC+"[21~";break;case 122:C.key=b?f.C0.ESC+"[23;"+(b+1)+"~":f.C0.ESC+"[23~";break;case 123:C.key=b?f.C0.ESC+"[24;"+(b+1)+"~":f.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(_&&!w||!d.altKey||d.metaKey)!_||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?C.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(C.key=f.C0.US),d.key==="@"&&(C.key=f.C0.NUL)):d.keyCode===65&&(C.type=1);else{const S=g[d.keyCode],x=S==null?void 0:S[d.shiftKey?1:0];if(x)C.key=f.C0.ESC+x;else if(d.keyCode>=65&&d.keyCode<=90){const y=d.ctrlKey?d.keyCode-64:d.keyCode+32;let k=String.fromCharCode(y);d.shiftKey&&(k=k.toUpperCase()),C.key=f.C0.ESC+k}else if(d.keyCode===32)C.key=f.C0.ESC+(d.ctrlKey?f.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let y=d.code.slice(3,4);d.shiftKey||(y=y.toLowerCase()),C.key=f.C0.ESC+y,C.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?C.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?C.key=f.C0.NUL:d.keyCode>=51&&d.keyCode<=55?C.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?C.key=f.C0.DEL:d.keyCode===219?C.key=f.C0.ESC:d.keyCode===220?C.key=f.C0.FS:d.keyCode===221&&(C.key=f.C0.GS)}return C}},482:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(u){return u>65535?(u-=65536,String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):String.fromCharCode(u)},o.utf32ToString=function(u,f=0,g=u.length){let d="";for(let m=f;m65535?(_-=65536,d+=String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):d+=String.fromCharCode(_)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(u,f){const g=u.length;if(!g)return 0;let d=0,m=0;if(this._interim){const _=u.charCodeAt(m++);56320<=_&&_<=57343?f[d++]=1024*(this._interim-55296)+_-56320+65536:(f[d++]=this._interim,f[d++]=_),this._interim=0}for(let _=m;_=g)return this._interim=w,d;const C=u.charCodeAt(_);56320<=C&&C<=57343?f[d++]=1024*(w-55296)+C-56320+65536:(f[d++]=w,f[d++]=C)}else w!==65279&&(f[d++]=w)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(u,f){const g=u.length;if(!g)return 0;let d,m,_,w,C=0,b=0,S=0;if(this.interim[0]){let k=!1,D=this.interim[0];D&=(224&D)==192?31:(240&D)==224?15:7;let T,R=0;for(;(T=63&this.interim[++R])&&R<4;)D<<=6,D|=T;const N=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=N-R;for(;S=g)return 0;if(T=u[S++],(192&T)!=128){S--,k=!0;break}this.interim[R++]=T,D<<=6,D|=63&T}k||(N===2?D<128?S--:f[C++]=D:N===3?D<2048||D>=55296&&D<=57343||D===65279||(f[C++]=D):D<65536||D>1114111||(f[C++]=D)),this.interim.fill(0)}const x=g-4;let y=S;for(;y=g)return this.interim[0]=d,C;if(m=u[y++],(192&m)!=128){y--;continue}if(b=(31&d)<<6|63&m,b<128){y--;continue}f[C++]=b}else if((240&d)==224){if(y>=g)return this.interim[0]=d,C;if(m=u[y++],(192&m)!=128){y--;continue}if(y>=g)return this.interim[0]=d,this.interim[1]=m,C;if(_=u[y++],(192&_)!=128){y--;continue}if(b=(15&d)<<12|(63&m)<<6|63&_,b<2048||b>=55296&&b<=57343||b===65279)continue;f[C++]=b}else if((248&d)==240){if(y>=g)return this.interim[0]=d,C;if(m=u[y++],(192&m)!=128){y--;continue}if(y>=g)return this.interim[0]=d,this.interim[1]=m,C;if(_=u[y++],(192&_)!=128){y--;continue}if(y>=g)return this.interim[0]=d,this.interim[1]=m,this.interim[2]=_,C;if(w=u[y++],(192&w)!=128){y--;continue}if(b=(7&d)<<18|(63&m)<<12|(63&_)<<6|63&w,b<65536||b>1114111)continue;f[C++]=b}}return C}}},225:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const f=u(1480),g=[[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 m;o.UnicodeV6=class{constructor(){if(this.version="6",!m){m=new Uint8Array(65536),m.fill(1),m[0]=0,m.fill(0,1,32),m.fill(0,127,160),m.fill(2,4352,4448),m[9001]=2,m[9002]=2,m.fill(2,11904,42192),m[12351]=1,m.fill(2,44032,55204),m.fill(2,63744,64256),m.fill(2,65040,65050),m.fill(2,65072,65136),m.fill(2,65280,65377),m.fill(2,65504,65511);for(let _=0;_C[x][1])return!1;for(;x>=S;)if(b=S+x>>1,w>C[b][1])S=b+1;else{if(!(w=131072&&_<=196605||_>=196608&&_<=262141?2:1}charProperties(_,w){let C=this.wcwidth(_),b=C===0&&w!==0;if(b){const S=f.UnicodeService.extractWidth(w);S===0?b=!1:S>C&&(C=S)}return f.UnicodeService.createPropertyValue(0,C,b)}}},5981:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const f=u(8460),g=u(844);class d extends g.Disposable{constructor(_){super(),this._action=_,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(_,w){if(w!==void 0&&this._syncCalls>w)return void(this._syncCalls=0);if(this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let C;for(this._isSyncWriting=!0;C=this._writeBuffer.shift();){this._action(C);const b=this._callbacks.shift();b&&b()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(_,w){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+=_.length,this._writeBuffer.push(_),this._callbacks.push(w),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=_.length,this._writeBuffer.push(_),this._callbacks.push(w)}_innerWrite(_=0,w=!0){const C=_||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const b=this._writeBuffer[this._bufferOffset],S=this._action(b,w);if(S){const y=k=>Date.now()-C>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(C,k);return void S.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(y)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=b.length,Date.now()-C>=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:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const u=/^([\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})$/,f=/^[\da-f]+$/;function g(d,m){const _=d.toString(16),w=_.length<2?"0"+_:_;switch(m){case 4:return _[0];case 8:return w;case 12:return(w+w).slice(0,3);default:return w+w}}o.parseColor=function(d){if(!d)return;let m=d.toLowerCase();if(m.indexOf("rgb:")===0){m=m.slice(4);const _=u.exec(m);if(_){const w=_[1]?15:_[4]?255:_[7]?4095:65535;return[Math.round(parseInt(_[1]||_[4]||_[7]||_[10],16)/w*255),Math.round(parseInt(_[2]||_[5]||_[8]||_[11],16)/w*255),Math.round(parseInt(_[3]||_[6]||_[9]||_[12],16)/w*255)]}}else if(m.indexOf("#")===0&&(m=m.slice(1),f.exec(m)&&[3,6,9,12].includes(m.length))){const _=m.length/3,w=[0,0,0];for(let C=0;C<3;++C){const b=parseInt(m.slice(_*C,_*C+_),16);w[C]=_===1?b<<4:_===2?b:_===3?b>>4:b>>8}return w}},o.toRgbString=function(d,m=16){const[_,w,C]=d;return`rgb:${g(_,m)}/${g(w,m)}/${g(C,m)}`}},5770:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const f=u(482),g=u(8742),d=u(5770),m=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=m,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}registerHandler(w,C){this._handlers[w]===void 0&&(this._handlers[w]=[]);const b=this._handlers[w];return b.push(C),{dispose:()=>{const S=b.indexOf(C);S!==-1&&b.splice(S,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}reset(){if(this._active.length)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].unhook(!1);this._stack.paused=!1,this._active=m,this._ident=0}hook(w,C){if(this.reset(),this._ident=w,this._active=this._handlers[w]||m,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].hook(C);else this._handlerFb(this._ident,"HOOK",C)}put(w,C,b){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(w,C,b);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(w,C,b))}unhook(w,C=!0){if(this._active.length){let b=!1,S=this._active.length-1,x=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,b=C,x=this._stack.fallThrough,this._stack.paused=!1),!x&&b===!1){for(;S>=0&&(b=this._active[S].unhook(w),b!==!0);S--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,b;S--}for(;S>=0;S--)if(b=this._active[S].unhook(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,b}else this._handlerFb(this._ident,"UNHOOK",w);this._active=m,this._ident=0}};const _=new g.Params;_.addParam(0),o.DcsHandler=class{constructor(w){this._handler=w,this._data="",this._params=_,this._hitLimit=!1}hook(w){this._params=w.length>1||w.params[0]?w.clone():_,this._data="",this._hitLimit=!1}put(w,C,b){this._hitLimit||(this._data+=(0,f.utf32ToString)(w,C,b),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(w){let C=!1;if(this._hitLimit)C=!1;else if(w&&(C=this._handler(this._data,this._params),C instanceof Promise))return C.then((b=>(this._params=_,this._data="",this._hitLimit=!1,b)));return this._params=_,this._data="",this._hitLimit=!1,C}}},2015:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const f=u(844),g=u(8742),d=u(6242),m=u(6351);class _{constructor(S){this.table=new Uint8Array(S)}setDefault(S,x){this.table.fill(S<<4|x)}add(S,x,y,k){this.table[x<<8|S]=y<<4|k}addMany(S,x,y,k){for(let D=0;DN)),x=(R,N)=>S.slice(R,N),y=x(32,127),k=x(0,24);k.push(25),k.push.apply(k,x(28,32));const D=x(0,14);let T;for(T in b.setDefault(1,0),b.addMany(y,0,2,0),D)b.addMany([24,26,153,154],T,3,0),b.addMany(x(128,144),T,3,0),b.addMany(x(144,152),T,3,0),b.add(156,T,0,0),b.add(27,T,11,1),b.add(157,T,4,8),b.addMany([152,158,159],T,0,7),b.add(155,T,11,3),b.add(144,T,11,9);return b.addMany(k,0,3,0),b.addMany(k,1,3,1),b.add(127,1,0,1),b.addMany(k,8,0,8),b.addMany(k,3,3,3),b.add(127,3,0,3),b.addMany(k,4,3,4),b.add(127,4,0,4),b.addMany(k,6,3,6),b.addMany(k,5,3,5),b.add(127,5,0,5),b.addMany(k,2,3,2),b.add(127,2,0,2),b.add(93,1,4,8),b.addMany(y,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(x(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(y,7,0,7),b.addMany(k,7,0,7),b.add(156,7,0,0),b.add(127,7,0,7),b.add(91,1,11,3),b.addMany(x(64,127),3,7,0),b.addMany(x(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(x(48,60),4,8,4),b.addMany(x(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(x(32,64),6,0,6),b.add(127,6,0,6),b.addMany(x(64,127),6,0,0),b.addMany(x(32,48),3,9,5),b.addMany(x(32,48),5,9,5),b.addMany(x(48,64),5,0,6),b.addMany(x(64,127),5,7,0),b.addMany(x(32,48),4,9,5),b.addMany(x(32,48),1,9,2),b.addMany(x(32,48),2,9,2),b.addMany(x(48,127),2,10,0),b.addMany(x(48,80),1,10,0),b.addMany(x(81,88),1,10,0),b.addMany([89,90,92],1,10,0),b.addMany(x(96,127),1,10,0),b.add(80,1,11,9),b.addMany(k,9,0,9),b.add(127,9,0,9),b.addMany(x(28,32),9,0,9),b.addMany(x(32,48),9,9,12),b.addMany(x(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(k,11,0,11),b.addMany(x(32,128),11,0,11),b.addMany(x(28,32),11,0,11),b.addMany(k,10,0,10),b.add(127,10,0,10),b.addMany(x(28,32),10,0,10),b.addMany(x(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(x(32,48),10,9,12),b.addMany(k,12,0,12),b.add(127,12,0,12),b.addMany(x(28,32),12,0,12),b.addMany(x(32,48),12,9,12),b.addMany(x(48,64),12,0,11),b.addMany(x(64,127),12,12,13),b.addMany(x(64,127),10,12,13),b.addMany(x(64,127),9,12,13),b.addMany(k,13,13,13),b.addMany(y,13,13,13),b.add(127,13,0,13),b.addMany([27,156,24,26],13,14,0),b.add(w,0,2,0),b.add(w,8,5,8),b.add(w,6,0,6),b.add(w,11,0,11),b.add(w,13,13,13),b})();class C extends f.Disposable{constructor(S=o.VT500_TRANSITION_TABLE){super(),this._transitions=S,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,y,k)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,y)=>{},this._escHandlerFb=x=>{},this._errorHandlerFb=x=>x,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.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 m.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(S,x=[64,126]){let y=0;if(S.prefix){if(S.prefix.length>1)throw new Error("only one byte as prefix supported");if(y=S.prefix.charCodeAt(0),y&&60>y||y>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(S.intermediates){if(S.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let D=0;DT||T>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");y<<=8,y|=T}}if(S.final.length!==1)throw new Error("final must be a single byte");const k=S.final.charCodeAt(0);if(x[0]>k||k>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return y<<=8,y|=k,y}identToString(S){const x=[];for(;S;)x.push(String.fromCharCode(255&S)),S>>=8;return x.reverse().join("")}setPrintHandler(S){this._printHandler=S}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(S,x){const y=this._identifier(S,[48,126]);this._escHandlers[y]===void 0&&(this._escHandlers[y]=[]);const k=this._escHandlers[y];return k.push(x),{dispose:()=>{const D=k.indexOf(x);D!==-1&&k.splice(D,1)}}}clearEscHandler(S){this._escHandlers[this._identifier(S,[48,126])]&&delete this._escHandlers[this._identifier(S,[48,126])]}setEscHandlerFallback(S){this._escHandlerFb=S}setExecuteHandler(S,x){this._executeHandlers[S.charCodeAt(0)]=x}clearExecuteHandler(S){this._executeHandlers[S.charCodeAt(0)]&&delete this._executeHandlers[S.charCodeAt(0)]}setExecuteHandlerFallback(S){this._executeHandlerFb=S}registerCsiHandler(S,x){const y=this._identifier(S);this._csiHandlers[y]===void 0&&(this._csiHandlers[y]=[]);const k=this._csiHandlers[y];return k.push(x),{dispose:()=>{const D=k.indexOf(x);D!==-1&&k.splice(D,1)}}}clearCsiHandler(S){this._csiHandlers[this._identifier(S)]&&delete this._csiHandlers[this._identifier(S)]}setCsiHandlerFallback(S){this._csiHandlerFb=S}registerDcsHandler(S,x){return this._dcsParser.registerHandler(this._identifier(S),x)}clearDcsHandler(S){this._dcsParser.clearHandler(this._identifier(S))}setDcsHandlerFallback(S){this._dcsParser.setHandlerFallback(S)}registerOscHandler(S,x){return this._oscParser.registerHandler(S,x)}clearOscHandler(S){this._oscParser.clearHandler(S)}setOscHandlerFallback(S){this._oscParser.setHandlerFallback(S)}setErrorHandler(S){this._errorHandler=S}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(S,x,y,k,D){this._parseStack.state=S,this._parseStack.handlers=x,this._parseStack.handlerPos=y,this._parseStack.transition=k,this._parseStack.chunkPos=D}parse(S,x,y){let k,D=0,T=0,R=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,R=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 N=this._parseStack.handlers;let L=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(y===!1&&L>-1){for(;L>=0&&(k=N[L](this._params),k!==!0);L--)if(k instanceof Promise)return this._parseStack.handlerPos=L,k}this._parseStack.handlers=[];break;case 4:if(y===!1&&L>-1){for(;L>=0&&(k=N[L](),k!==!0);L--)if(k instanceof Promise)return this._parseStack.handlerPos=L,k}this._parseStack.handlers=[];break;case 6:if(D=S[this._parseStack.chunkPos],k=this._dcsParser.unhook(D!==24&&D!==26,y),k)return k;D===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(D=S[this._parseStack.chunkPos],k=this._oscParser.end(D!==24&&D!==26,y),k)return k;D===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,R=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let N=R;N>4){case 2:for(let H=N+1;;++H){if(H>=x||(D=S[H])<32||D>126&&D=x||(D=S[H])<32||D>126&&D=x||(D=S[H])<32||D>126&&D=x||(D=S[H])<32||D>126&&D=0&&(k=L[I](this._params),k!==!0);I--)if(k instanceof Promise)return this._preserveStack(3,L,I,T,N),k;I<0&&this._csiHandlerFb(this._collect<<8|D,this._params),this.precedingJoinState=0;break;case 8:do switch(D){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(D-48)}while(++N47&&D<60);N--;break;case 9:this._collect<<=8,this._collect|=D;break;case 10:const F=this._escHandlers[this._collect<<8|D];let V=F?F.length-1:-1;for(;V>=0&&(k=F[V](),k!==!0);V--)if(k instanceof Promise)return this._preserveStack(4,F,V,T,N),k;V<0&&this._escHandlerFb(this._collect<<8|D),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|D,this._params);break;case 13:for(let H=N+1;;++H)if(H>=x||(D=S[H])===24||D===26||D===27||D>127&&D=x||(D=S[H])<32||D>127&&D{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const f=u(5770),g=u(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(m,_){this._handlers[m]===void 0&&(this._handlers[m]=[]);const w=this._handlers[m];return w.push(_),{dispose:()=>{const C=w.indexOf(_);C!==-1&&w.splice(C,1)}}}clearHandler(m){this._handlers[m]&&delete this._handlers[m]}setHandlerFallback(m){this._handlerFb=m}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let m=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;m>=0;--m)this._active[m].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 m=this._active.length-1;m>=0;m--)this._active[m].start();else this._handlerFb(this._id,"START")}_put(m,_,w){if(this._active.length)for(let C=this._active.length-1;C>=0;C--)this._active[C].put(m,_,w);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(m,_,w))}start(){this.reset(),this._state=1}put(m,_,w){if(this._state!==3){if(this._state===1)for(;_0&&this._put(m,_,w)}}end(m,_=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let w=!1,C=this._active.length-1,b=!1;if(this._stack.paused&&(C=this._stack.loopPosition-1,w=_,b=this._stack.fallThrough,this._stack.paused=!1),!b&&w===!1){for(;C>=0&&(w=this._active[C].end(m),w!==!0);C--)if(w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!1,w;C--}for(;C>=0;C--)if(w=this._active[C].end(!1),w instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=C,this._stack.fallThrough=!0,w}else this._handlerFb(this._id,"END",m);this._active=d,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(m){this._handler=m,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(m,_,w){this._hitLimit||(this._data+=(0,g.utf32ToString)(m,_,w),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(m){let _=!1;if(this._hitLimit)_=!1;else if(m&&(_=this._handler(this._data),_ instanceof Promise))return _.then((w=>(this._data="",this._hitLimit=!1,w)));return this._data="",this._hitLimit=!1,_}}},8742:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const u=2147483647;class f{static fromArray(d){const m=new f;if(!d.length)return m;for(let _=Array.isArray(d[0])?1:0;_256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(m),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new f(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 m=0;m>8,w=255&this._subParamsIdx[m];w-_>0&&d.push(Array.prototype.slice.call(this._subParams,_,w))}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>u?u: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>u?u:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const m=this._subParamsIdx[d]>>8,_=255&this._subParamsIdx[d];return _-m>0?this._subParams.subarray(m,_):null}getSubParamsAll(){const d={};for(let m=0;m>8,w=255&this._subParamsIdx[m];w-_>0&&(d[m]=this._subParams.slice(_,w))}return d}addDigit(d){let m;if(this._rejectDigits||!(m=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const _=this._digitIsSub?this._subParams:this.params,w=_[m-1];_[m-1]=~w?Math.min(10*w+d,u):d}}o.Params=f},5741:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let u=this._addons.length-1;u>=0;u--)this._addons[u].instance.dispose()}loadAddon(u,f){const g={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(g),f.dispose=()=>this._wrappedAddonDispose(g),f.activate(u)}_wrappedAddonDispose(u){if(u.isDisposed)return;let f=-1;for(let g=0;g{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const f=u(3785),g=u(511);o.BufferApiView=class{constructor(d,m){this._buffer=d,this.type=m}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 m=this._buffer.lines.get(d);if(m)return new f.BufferLineApiView(m)}getNullCell(){return new g.CellData}}},3785:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const f=u(511);o.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,d){if(!(g<0||g>=this._line.length))return d?(this._line.loadCell(g,d),d):this._line.loadCell(g,new f.CellData)}translateToString(g,d,m){return this._line.translateToString(g,d,m)}}},8285:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const f=u(8771),g=u(8460),d=u(844);class m extends d.Disposable{constructor(w){super(),this._core=w,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.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=m},7975:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(u){this._core=u}registerCsiHandler(u,f){return this._core.registerCsiHandler(u,(g=>f(g.toArray())))}addCsiHandler(u,f){return this.registerCsiHandler(u,f)}registerDcsHandler(u,f){return this._core.registerDcsHandler(u,((g,d)=>f(g,d.toArray())))}addDcsHandler(u,f){return this.registerDcsHandler(u,f)}registerEscHandler(u,f){return this._core.registerEscHandler(u,f)}addEscHandler(u,f){return this.registerEscHandler(u,f)}registerOscHandler(u,f){return this._core.registerOscHandler(u,f)}addOscHandler(u,f){return this.registerOscHandler(u,f)}}},7090:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.UnicodeApi=class{constructor(u){this._core=u}register(u){this._core.unicodeService.register(u)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(u){this._core.unicodeService.activeVersion=u}}},744:function(c,o,u){var f=this&&this.__decorate||function(b,S,x,y){var k,D=arguments.length,T=D<3?S:y===null?y=Object.getOwnPropertyDescriptor(S,x):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,S,x,y);else for(var R=b.length-1;R>=0;R--)(k=b[R])&&(T=(D<3?k(T):D>3?k(S,x,T):k(S,x))||T);return D>3&&T&&Object.defineProperty(S,x,T),T},g=this&&this.__param||function(b,S){return function(x,y){S(x,y,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=u(8460),m=u(844),_=u(5295),w=u(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let C=o.BufferService=class extends m.Disposable{get buffer(){return this.buffers.active}constructor(b){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(b.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(b.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new _.BufferSet(b,this))}resize(b,S){this.cols=b,this.rows=S,this.buffers.resize(b,S),this._onResize.fire({cols:b,rows:S})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(b,S=!1){const x=this.buffer;let y;y=this._cachedBlankLine,y&&y.length===this.cols&&y.getFg(0)===b.fg&&y.getBg(0)===b.bg||(y=x.getBlankLine(b,S),this._cachedBlankLine=y),y.isWrapped=S;const k=x.ybase+x.scrollTop,D=x.ybase+x.scrollBottom;if(x.scrollTop===0){const T=x.lines.isFull;D===x.lines.length-1?T?x.lines.recycle().copyFrom(y):x.lines.push(y.clone()):x.lines.splice(D+1,0,y.clone()),T?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const T=D-k+1;x.lines.shiftElements(k+1,T-1,-1),x.lines.set(D,y.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(b,S,x){const y=this.buffer;if(b<0){if(y.ydisp===0)return;this.isUserScrolling=!0}else b+y.ydisp>=y.ybase&&(this.isUserScrolling=!1);const k=y.ydisp;y.ydisp=Math.max(Math.min(y.ydisp+b,y.ybase),0),k!==y.ydisp&&(S||this._onScroll.fire(y.ydisp))}};o.BufferService=C=f([g(0,w.IOptionsService)],C)},7994:(c,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(u){this.glevel=u,this.charset=this._charsets[u]}setgCharset(u,f){this._charsets[u]=f,this.glevel===u&&(this.charset=f)}}},1753:function(c,o,u){var f=this&&this.__decorate||function(y,k,D,T){var R,N=arguments.length,L=N<3?k:T===null?T=Object.getOwnPropertyDescriptor(k,D):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(y,k,D,T);else for(var I=y.length-1;I>=0;I--)(R=y[I])&&(L=(N<3?R(L):N>3?R(k,D,L):R(k,D))||L);return N>3&&L&&Object.defineProperty(k,D,L),L},g=this&&this.__param||function(y,k){return function(D,T){k(D,T,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=u(2585),m=u(8460),_=u(844),w={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 C(y,k){let D=(y.ctrl?16:0)|(y.shift?4:0)|(y.alt?8:0);return y.button===4?(D|=64,D|=y.action):(D|=3&y.button,4&y.button&&(D|=64),8&y.button&&(D|=128),y.action===32?D|=32:y.action!==0||k||(D|=3)),D}const b=String.fromCharCode,S={DEFAULT:y=>{const k=[C(y,!1)+32,y.col+32,y.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${b(k[0])}${b(k[1])}${b(k[2])}`},SGR:y=>{const k=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.col};${y.row}${k}`},SGR_PIXELS:y=>{const k=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${C(y,!0)};${y.x};${y.y}${k}`}};let x=o.CoreMouseService=class extends _.Disposable{constructor(y,k){super(),this._bufferService=y,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new m.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const D of Object.keys(w))this.addProtocol(D,w[D]);for(const D of Object.keys(S))this.addEncoding(D,S[D]);this.reset()}addProtocol(y,k){this._protocols[y]=k}addEncoding(y,k){this._encodings[y]=k}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 k=this._encodings[this._activeEncoding](y);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!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,k,D){if(D){if(y.x!==k.x||y.y!==k.y)return!1}else if(y.col!==k.col||y.row!==k.row)return!1;return y.button===k.button&&y.action===k.action&&y.ctrl===k.ctrl&&y.alt===k.alt&&y.shift===k.shift}};o.CoreMouseService=x=f([g(0,d.IBufferService),g(1,d.ICoreService)],x)},6975:function(c,o,u){var f=this&&this.__decorate||function(x,y,k,D){var T,R=arguments.length,N=R<3?y:D===null?D=Object.getOwnPropertyDescriptor(y,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,y,k,D);else for(var L=x.length-1;L>=0;L--)(T=x[L])&&(N=(R<3?T(N):R>3?T(y,k,N):T(y,k))||N);return R>3&&N&&Object.defineProperty(y,k,N),N},g=this&&this.__param||function(x,y){return function(k,D){y(k,D,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=u(1439),m=u(8460),_=u(844),w=u(2585),C=Object.freeze({insertMode:!1}),b=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let S=o.CoreService=class extends _.Disposable{constructor(x,y,k){super(),this._bufferService=x,this._logService=y,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new m.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new m.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new m.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new m.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(C),this.decPrivateModes=(0,d.clone)(b)}reset(){this.modes=(0,d.clone)(C),this.decPrivateModes=(0,d.clone)(b)}triggerDataEvent(x,y=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;y&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),y&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((D=>D.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((y=>y.charCodeAt(0))))),this._onBinary.fire(x))}};o.CoreService=S=f([g(0,w.IBufferService),g(1,w.ILogService),g(2,w.IOptionsService)],S)},9074:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const f=u(8055),g=u(8460),d=u(844),m=u(6106);let _=0,w=0;class C extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new m.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const y=new b(x);if(y){const k=y.marker.onDispose((()=>y.dispose()));y.onDispose((()=>{y&&(this._decorations.delete(y)&&this._onDecorationRemoved.fire(y),k.dispose())})),this._decorations.insert(y),this._onDecorationRegistered.fire(y)}return y}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,y,k){let D=0,T=0;for(const R of this._decorations.getKeyIterator(y))D=R.options.x??0,T=D+(R.options.width??1),x>=D&&x{_=T.options.x??0,w=_+(T.options.width??1),x>=_&&x{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const f=u(2585),g=u(8343);class d{constructor(..._){this._entries=new Map;for(const[w,C]of _)this.set(w,C)}set(_,w){const C=this._entries.get(_);return this._entries.set(_,w),C}forEach(_){for(const[w,C]of this._entries.entries())_(w,C)}has(_){return this._entries.has(_)}get(_){return this._entries.get(_)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(f.IInstantiationService,this)}setService(m,_){this._services.set(m,_)}getService(m){return this._services.get(m)}createInstance(m,..._){const w=(0,g.getServiceDependencies)(m).sort(((S,x)=>S.index-x.index)),C=[];for(const S of w){const x=this._services.get(S.id);if(!x)throw new Error(`[createInstance] ${m.name} depends on UNKNOWN service ${S.id}.`);C.push(x)}const b=w.length>0?w[0].index:_.length;if(_.length!==b)throw new Error(`[createInstance] First service dependency of ${m.name} at position ${b+1} conflicts with ${_.length} static arguments`);return new m(..._,...C)}}},7866:function(c,o,u){var f=this&&this.__decorate||function(b,S,x,y){var k,D=arguments.length,T=D<3?S:y===null?y=Object.getOwnPropertyDescriptor(S,x):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(b,S,x,y);else for(var R=b.length-1;R>=0;R--)(k=b[R])&&(T=(D<3?k(T):D>3?k(S,x,T):k(S,x))||T);return D>3&&T&&Object.defineProperty(S,x,T),T},g=this&&this.__param||function(b,S){return function(x,y){S(x,y,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=u(844),m=u(2585),_={trace:m.LogLevelEnum.TRACE,debug:m.LogLevelEnum.DEBUG,info:m.LogLevelEnum.INFO,warn:m.LogLevelEnum.WARN,error:m.LogLevelEnum.ERROR,off:m.LogLevelEnum.OFF};let w,C=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(b){super(),this._optionsService=b,this._logLevel=m.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),w=this}_updateLogLevel(){this._logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(b){for(let S=0;SJSON.stringify(T))).join(", ")})`);const D=y.apply(this,k);return w.trace(`GlyphRenderer#${y.name} return`,D),D}}},7302:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const f=u(8460),g=u(844),d=u(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 m=["normal","bold","100","200","300","400","500","600","700","800","900"];class _ extends g.Disposable{constructor(C){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const b={...o.DEFAULT_OPTIONS};for(const S in C)if(S in b)try{const x=C[S];b[S]=this._sanitizeAndValidateOption(S,x)}catch(x){console.error(x)}this.rawOptions=b,this.options={...b},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(C,b){return this.onOptionChange((S=>{S===C&&b(this.rawOptions[C])}))}onMultipleOptionChange(C,b){return this.onOptionChange((S=>{C.indexOf(S)!==-1&&b()}))}_setupOptions(){const C=S=>{if(!(S in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);return this.rawOptions[S]},b=(S,x)=>{if(!(S in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${S}"`);x=this._sanitizeAndValidateOption(S,x),this.rawOptions[S]!==x&&(this.rawOptions[S]=x,this._onOptionChange.fire(S))};for(const S in this.rawOptions){const x={get:C.bind(this,S),set:b.bind(this,S)};Object.defineProperty(this.options,S,x)}}_sanitizeAndValidateOption(C,b){switch(C){case"cursorStyle":if(b||(b=o.DEFAULT_OPTIONS[C]),!(function(S){return S==="block"||S==="underline"||S==="bar"})(b))throw new Error(`"${b}" is not a valid value for ${C}`);break;case"wordSeparator":b||(b=o.DEFAULT_OPTIONS[C]);break;case"fontWeight":case"fontWeightBold":if(typeof b=="number"&&1<=b&&b<=1e3)break;b=m.includes(b)?b:o.DEFAULT_OPTIONS[C];break;case"cursorWidth":b=Math.floor(b);case"lineHeight":case"tabStopWidth":if(b<1)throw new Error(`${C} cannot be less than 1, value: ${b}`);break;case"minimumContrastRatio":b=Math.max(1,Math.min(21,Math.round(10*b)/10));break;case"scrollback":if((b=Math.min(b,4294967295))<0)throw new Error(`${C} cannot be less than 0, value: ${b}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(b<=0)throw new Error(`${C} cannot be less than or equal to 0, value: ${b}`);break;case"rows":case"cols":if(!b&&b!==0)throw new Error(`${C} must be numeric, value: ${b}`);break;case"windowsPty":b=b??{}}return b}}o.OptionsService=_},2660:function(c,o,u){var f=this&&this.__decorate||function(_,w,C,b){var S,x=arguments.length,y=x<3?w:b===null?b=Object.getOwnPropertyDescriptor(w,C):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(_,w,C,b);else for(var k=_.length-1;k>=0;k--)(S=_[k])&&(y=(x<3?S(y):x>3?S(w,C,y):S(w,C))||y);return x>3&&y&&Object.defineProperty(w,C,y),y},g=this&&this.__param||function(_,w){return function(C,b){w(C,b,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=u(2585);let m=o.OscLinkService=class{constructor(_){this._bufferService=_,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(_){const w=this._bufferService.buffer;if(_.id===void 0){const k=w.addMarker(w.ybase+w.y),D={data:_,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(D,k))),this._dataByLinkId.set(D.id,D),D.id}const C=_,b=this._getEntryIdKey(C),S=this._entriesWithId.get(b);if(S)return this.addLineToLink(S.id,w.ybase+w.y),S.id;const x=w.addMarker(w.ybase+w.y),y={id:this._nextId++,key:this._getEntryIdKey(C),data:C,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(y,x))),this._entriesWithId.set(y.key,y),this._dataByLinkId.set(y.id,y),y.id}addLineToLink(_,w){const C=this._dataByLinkId.get(_);if(C&&C.lines.every((b=>b.line!==w))){const b=this._bufferService.buffer.addMarker(w);C.lines.push(b),b.onDispose((()=>this._removeMarkerFromLink(C,b)))}}getLinkData(_){var w;return(w=this._dataByLinkId.get(_))==null?void 0:w.data}_getEntryIdKey(_){return`${_.id};;${_.uri}`}_removeMarkerFromLink(_,w){const C=_.lines.indexOf(w);C!==-1&&(_.lines.splice(C,1),_.lines.length===0&&(_.data.id!==void 0&&this._entriesWithId.delete(_.key),this._dataByLinkId.delete(_.id)))}};o.OscLinkService=m=f([g(0,d.IBufferService)],m)},8343:(c,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const u="di$target",f="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(g){return g[f]||[]},o.createDecorator=function(g){if(o.serviceRegistry.has(g))return o.serviceRegistry.get(g);const d=function(m,_,w){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(C,b,S){b[u]===b?b[f].push({id:C,index:S}):(b[f]=[{id:C,index:S}],b[u]=b)})(d,m,w)};return d.toString=()=>g,o.serviceRegistry.set(g,d),d}},2585:(c,o,u)=>{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 f=u(8343);var g;o.IBufferService=(0,f.createDecorator)("BufferService"),o.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),o.ICoreService=(0,f.createDecorator)("CoreService"),o.ICharsetService=(0,f.createDecorator)("CharsetService"),o.IInstantiationService=(0,f.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"})(g||(o.LogLevelEnum=g={})),o.ILogService=(0,f.createDecorator)("LogService"),o.IOptionsService=(0,f.createDecorator)("OptionsService"),o.IOscLinkService=(0,f.createDecorator)("OscLinkService"),o.IUnicodeService=(0,f.createDecorator)("UnicodeService"),o.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(c,o,u)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const f=u(8460),g=u(225);class d{static extractShouldJoin(_){return(1&_)!=0}static extractWidth(_){return _>>1&3}static extractCharKind(_){return _>>3}static createPropertyValue(_,w,C=!1){return(16777215&_)<<3|(3&w)<<1|(C?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const _=new g.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(_){if(!this._providers[_])throw new Error(`unknown Unicode version "${_}"`);this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)}register(_){this._providers[_.version]=_}wcwidth(_){return this._activeProvider.wcwidth(_)}getStringCellWidth(_){let w=0,C=0;const b=_.length;for(let S=0;S=b)return w+this.wcwidth(x);const D=_.charCodeAt(S);56320<=D&&D<=57343?x=1024*(x-55296)+D-56320+65536:w+=this.wcwidth(D)}const y=this.charProperties(x,C);let k=d.extractWidth(y);d.extractShouldJoin(y)&&(k-=d.extractWidth(C)),w+=k,C=y}return w}charProperties(_,w){return this._activeProvider.charProperties(_,w)}}o.UnicodeService=d}},r={};function a(c){var o=r[c];if(o!==void 0)return o.exports;var u=r[c]={exports:{}};return n[c].call(u.exports,u,u.exports,a),u.exports}var l={};return(()=>{var c=l;Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const o=a(9042),u=a(3236),f=a(844),g=a(5741),d=a(8285),m=a(7975),_=a(7090),w=["cols","rows"];class C extends f.Disposable{constructor(S){super(),this._core=this.register(new u.Terminal(S)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const x=k=>this._core.options[k],y=(k,D)=>{this._checkReadonlyOptions(k),this._core.options[k]=D};for(const k in this._core.options){const D={get:x.bind(this,k),set:y.bind(this,k)};Object.defineProperty(this._publicOptions,k,D)}}_checkReadonlyOptions(S){if(w.includes(S))throw new Error(`Option "${S}" 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 m.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _.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 S=this._core.coreService.decPrivateModes;let x="none";switch(this._core.coreMouseService.activeProtocol){case"X10":x="x10";break;case"VT200":x="vt200";break;case"DRAG":x="drag";break;case"ANY":x="any"}return{applicationCursorKeysMode:S.applicationCursorKeys,applicationKeypadMode:S.applicationKeypad,bracketedPasteMode:S.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:S.origin,reverseWraparoundMode:S.reverseWraparound,sendFocusMode:S.sendFocus,wraparoundMode:S.wraparound}}get options(){return this._publicOptions}set options(S){for(const x in S)this._publicOptions[x]=S[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(S,x=!0){this._core.input(S,x)}resize(S,x){this._verifyIntegers(S,x),this._core.resize(S,x)}open(S){this._core.open(S)}attachCustomKeyEventHandler(S){this._core.attachCustomKeyEventHandler(S)}attachCustomWheelEventHandler(S){this._core.attachCustomWheelEventHandler(S)}registerLinkProvider(S){return this._core.registerLinkProvider(S)}registerCharacterJoiner(S){return this._checkProposedApi(),this._core.registerCharacterJoiner(S)}deregisterCharacterJoiner(S){this._checkProposedApi(),this._core.deregisterCharacterJoiner(S)}registerMarker(S=0){return this._verifyIntegers(S),this._core.registerMarker(S)}registerDecoration(S){return this._checkProposedApi(),this._verifyPositiveIntegers(S.x??0,S.width??0,S.height??0),this._core.registerDecoration(S)}hasSelection(){return this._core.hasSelection()}select(S,x,y){this._verifyIntegers(S,x,y),this._core.select(S,x,y)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(S,x){this._verifyIntegers(S,x),this._core.selectLines(S,x)}dispose(){super.dispose()}scrollLines(S){this._verifyIntegers(S),this._core.scrollLines(S)}scrollPages(S){this._verifyIntegers(S),this._core.scrollPages(S)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(S){this._verifyIntegers(S),this._core.scrollToLine(S)}clear(){this._core.clear()}write(S,x){this._core.write(S,x)}writeln(S,x){this._core.write(S),this._core.write(`\r +`,x)}paste(S){this._core.paste(S)}refresh(S,x){this._verifyIntegers(S,x),this._core.refresh(S,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(S){this._addonManager.loadAddon(this,S)}static get strings(){return o}_verifyIntegers(...S){for(const x of S)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...S){for(const x of S)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}c.Terminal=C})(),l})()))})(up)),up.exports}var R8=D8();function vb(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r{const n=t.current;if(!n)return;const r=new R8.Terminal({convertEol:!0,disableStdin:!0,fontSize:12,fontFamily:'ui-monospace, "SF Mono", Menlo, Consolas, monospace',scrollback:2e4,theme:{background:"#1a1a1a",foreground:"#e6e1e0",cursor:"#1a1a1a",selectionBackground:"#2c3441"}}),a=new N8.FitAddon;r.loadAddon(a),r.open(n);try{a.fit()}catch{}const l=new ResizeObserver(()=>{try{a.fit()}catch{}});l.observe(n);let c=!1,o=0,u=!1,f=!1;async function g(){if(u){f=!0;return}u=!0;try{for(;;){const m=await vT(e,o);if(c)return;if(m.dataBase64&&r.write(vb(m.dataBase64)),o=m.nextOffset,m.eof)break}}catch{}finally{u=!1,f&&!c&&(f=!1,g())}}const d=iN(e,m=>{if(c)return;const _=vb(m.dataBase64);!u&&m.offset===o?(r.write(_),o+=_.length):m.offset+_.length>o&&g()});return g(),()=>{c=!0,d(),l.disconnect(),r.dispose()}},[e]),v.jsx("div",{ref:t,style:{width:"100%",height:"100%"}})}const qs="__uncommitted__";function L8({state:e}){return!e||e.loading?v.jsx("div",{className:"changes-note",children:"Loading diff…"}):e.error?v.jsx("div",{className:"error",children:e.error}):e.payload?e.payload.truncated?v.jsx(k8,{bytesRead:e.payload.bytesRead,byteLimit:e.payload.byteLimit}):v.jsx(Jw,{diff:e.payload.diff}):v.jsx("div",{className:"diff-empty",children:"No changes."})}function O8({experiment:e,view:t,runs:n,selectedRunId:r,onSelectRun:a}){const l=n.filter(c=>c.experimentId===e.id).sort((c,o)=>o.createdAt-c.createdAt);return t==="terminal"?v.jsx(j8,{experiment:e,expRuns:l,selectedRunId:r,onSelectRun:a}):v.jsx(B8,{experiment:e})}function j8({experiment:e,expRuns:t,selectedRunId:n,onSelectRun:r}){const[a,l]=Y.useState(null),[c,o]=Y.useState(!1),u=Y.useRef(null),f=n&&t.find(w=>w.id===n)||t[0]||null,g=(f==null?void 0:f.status)==="running"||(f==null?void 0:f.status)==="starting",d=w=>{const C=t.findIndex(b=>b.id===w);return C===-1?t.length:t.length-C},m=Y.useRef(null);Y.useEffect(()=>{if(m.current===null){m.current=new Set(t.map(C=>C.id));return}const w=t.find(C=>!m.current.has(C.id));for(const C of t)m.current.add(C.id);w&&r(w.id)},[t,r]),Y.useEffect(()=>{if(!c)return;const w=C=>{var b;(b=u.current)!=null&&b.contains(C.target)||o(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]);async function _(){if(f){l(null);try{await FS(f.id)}catch(w){l(w instanceof Error?w.message:String(w))}}}return v.jsxs("div",{className:"term-view",children:[v.jsxs("div",{className:"term-bar",children:[v.jsx("div",{className:"term-title",title:e.title||e.slug,children:e.title||e.slug}),v.jsx("span",{style:{flex:1}}),a&&v.jsx("span",{className:"error",children:a}),g&&v.jsxs("button",{className:"btn sm ghost",onClick:()=>void _(),children:[v.jsx(bA,{size:13}),"Stop"]}),t.length>0&&f&&v.jsxs("div",{className:"run-history",ref:u,children:[v.jsxs("button",{className:"run-picker",title:"Switch run",onClick:()=>o(w=>!w),children:[v.jsxs("span",{className:"run-label",children:["Run ",d(f.id)]}),v.jsx(zo,{status:f.status}),v.jsx(Iu,{size:14,className:"run-picker-chev"})]}),c&&v.jsx("div",{className:"history-menu",children:t.map(w=>v.jsxs("button",{className:`history-item ${w.id===(f==null?void 0:f.id)?"active":""}`,onClick:()=>{r(w.id),o(!1)},children:[v.jsxs("span",{className:"run-label",children:["Run ",d(w.id)]}),v.jsx(zo,{status:w.status}),v.jsx("span",{className:"when",children:fa(w.createdAt)})]},w.id))})]})]}),v.jsx("div",{className:"term-fill",children:f?v.jsx(M8,{runId:f.id},f.id):v.jsx("div",{className:"term-empty",children:"No runs yet — ask the agent to launch one."})})]})}function B8({experiment:e}){const[t,n]=Y.useState(null),[r,a]=Y.useState(null),[l,c]=Y.useState(null),[o,u]=Y.useState(null),[f,g]=Y.useState({}),d=!!(l&&l.diff.trim()!==""&&l.experimentId===e.id);async function m(){a(null);try{const[w,C]=await Promise.all([yT(e.id),Ly(e.projectId)]);n(w),c(C),u(b=>{var x;return b!==null?b:C.diff.trim()!==""&&C.experimentId===e.id?qs:((x=w[0])==null?void 0:x.sha)??null})}catch(w){a(w instanceof Error?w.message:String(w))}}Y.useEffect(()=>{t===null&&!r&&m()},[t,r,e.id]),Y.useEffect(()=>{const w=setInterval(()=>{Ly(e.projectId).then(c).catch(()=>{})},5e3);return()=>clearInterval(w)},[e.projectId]),Y.useEffect(()=>{var w;o===qs&&l&&!d&&u(((w=t==null?void 0:t[0])==null?void 0:w.sha)??null)},[o,l,d,t]),Y.useEffect(()=>{if(!o||o===qs||f[o])return;const w=o;g(C=>({...C,[w]:{loading:!0}})),bT(e.id,w).then(C=>g(b=>({...b,[w]:{loading:!1,payload:C}}))).catch(C=>g(b=>({...b,[w]:{loading:!1,error:C instanceof Error?C.message:String(C)}})))},[o,f,e.id]);const _=!d&&((t==null?void 0:t.length)??0)===0;return v.jsx("div",{className:"drawer",children:v.jsx("div",{className:"drawer-body",children:v.jsx("div",{className:"drawer-section",children:r?v.jsx("div",{className:"error",children:r}):t===null?v.jsx("div",{className:"changes-note",children:"Loading changes…"}):_?v.jsx("div",{className:"changes-note",children:"No changes yet — the agent hasn't committed on this branch."}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"commit-picker",children:[o===qs&&v.jsx("span",{className:"uncommitted-dot"}),v.jsxs("select",{className:"input sm",value:o??"",onChange:w=>u(w.target.value),children:[d&&v.jsx("option",{value:qs,children:"● Uncommitted changes"}),t.map(w=>v.jsxs("option",{value:w.sha,children:[w.sha.slice(0,7)," — ",w.subject]},w.sha))]}),v.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:()=>void m(),children:v.jsx(IS,{size:14})})]}),v.jsx("div",{style:{marginTop:10},children:o===qs&&l?l.truncated?v.jsxs("div",{className:"truncated-notice",children:[v.jsx("h4",{children:"Diff too large to display"}),v.jsx("p",{children:"The uncommitted diff is too large to display. View it locally with git."})]}):v.jsx(Jw,{diff:l.diff}):o?v.jsx(L8,{state:f[o]}):v.jsx("div",{className:"changes-note",children:"Select a commit to view its diff."})})]})})})})}function I8(e,t){return lw(e,tw(t))}function z8({projectId:e,path:t,sessionId:n,onOpenFile:r}){const[a,l]=Y.useState(null),[c,o]=Y.useState(null),[u,f]=Y.useState(!0),[g,d]=Y.useState(0),m=/\.(md|mdx|markdown)$/i.test(t),[_,w]=Y.useState(!1);Y.useEffect(()=>{let b=!1;return f(!0),ST(e,t,n).then(S=>{b||(l(S),o(null))}).catch(S=>{b||o(S.message)}).finally(()=>{b||f(!1)}),()=>{b=!0}},[e,t,n,g]);const C=Y.useMemo(()=>a&&!a.notFound?I8(a.content,t):null,[a,t]);return v.jsxs("div",{className:"file-view",children:[v.jsxs("div",{className:"file-view-header",children:[v.jsx(jA,{size:13,style:{flexShrink:0}}),v.jsx("code",{className:"file-view-path",title:t,children:t}),m&&v.jsx("button",{className:`icon-btn ${_?"active":""}`,title:_?"Rendered view":"Source view","aria-label":_?"Rendered view":"Source view",onClick:()=>w(b=>!b),children:v.jsx(CA,{size:13})}),v.jsx("button",{className:"icon-btn",title:"Reload file","aria-label":"Reload file",onClick:()=>d(b=>b+1),children:u?v.jsx("span",{className:"spinner"}):v.jsx(IS,{size:13})})]}),v.jsx("div",{className:"file-view-body",children:c?v.jsxs("div",{className:"file-view-note",children:["Failed to load file: ",c]}):a===null?v.jsx("div",{className:"file-view-note",children:"Loading…"}):a.notFound?v.jsx("div",{className:"file-view-note",children:n&&a.root==="clone"?"This session's worktree isn't available, and the file isn't in the project clone.":`File not found in the ${a.root==="worktree"?"session's worktree":"project clone"}.`}):v.jsxs(v.Fragment,{children:[n&&a.root==="clone"&&v.jsx("div",{className:"file-view-note",children:"This session's worktree isn't available — showing the project clone's copy."}),m&&!_?v.jsx("div",{className:"file-view-md",children:v.jsx(hm,{text:a.content,onOpenFile:r&&(b=>r(b,n))})}):v.jsx("pre",{className:"file-view-code",children:v.jsx("code",{children:C})}),a.truncated&&v.jsx("div",{className:"file-view-note",children:"File truncated — showing the first 512 KB."})]})})]})}function H8({projectName:e,onHome:t,onCollapse:n}){return v.jsxs("div",{className:"rail-brand",children:[v.jsxs("button",{className:"brand",onClick:t,title:"All projects",children:[v.jsx(Eo,{size:15}),v.jsx("span",{className:"brand-project",children:e})]}),n&&v.jsx("button",{className:"icon-btn",title:"Hide sidebar","aria-label":"Hide sidebar",onClick:n,children:v.jsx(BS,{size:15})})]})}function F8({onDone:e}){const[t,n]=Y.useState(0),[r,a]=Y.useState(null),[l,c]=Y.useState(null),[o,u]=Y.useState(null),[f,g]=Y.useState(null),[d,m]=Y.useState(!1),_=C=>{m(!0),Promise.allSettled([bg(C).then(a),$S().then(c),US().then(u),$T().then(g)]).finally(()=>m(!1))};Y.useEffect(()=>_(!1),[]);const w=()=>{qT((f==null?void 0:f.enabled)??!0).catch(()=>{}),e()};return v.jsx("div",{className:"home onboarding",children:v.jsx("div",{className:"home-inner",children:t===0?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"onb-eyebrow",children:["Open",v.jsx("span",{children:"Research"})," · step 1 of 4"]}),v.jsx("h2",{className:"onb-title",children:"Your coding agents"}),v.jsx("p",{className:"onb-sub",children:"orx found the agent CLIs on this machine and drives them directly — chat and autoresearch run on your own logins, no extra API keys."}),v.jsx("div",{className:"onb-cards",children:r===null?v.jsxs("div",{className:"onb-loading",children:[v.jsx("span",{className:"spinner"})," Detecting Claude Code, Codex, OpenCode…"]}):r.map(C=>v.jsx(U8,{h:C},C.id))}),v.jsxs("div",{className:"onb-actions",children:[v.jsxs("button",{className:"btn ghost",onClick:()=>_(!0),disabled:d,children:[v.jsx(mu,{size:12,className:d?"spin":""})," Re-check"]}),v.jsx("div",{style:{flex:1}}),v.jsxs("button",{className:"btn primary",onClick:()=>n(1),children:["Continue ",v.jsx(Lc,{size:13})]})]})]}):t===1?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"onb-eyebrow",children:["Open",v.jsx("span",{children:"Research"})," · step 2 of 4"]}),v.jsx("h2",{className:"onb-title",children:"Git & GitHub"}),v.jsx("p",{className:"onb-sub",children:"A project is a clone of one of your GitHub repos, made with your own git credentials. Every experiment becomes a branch pushed to that repo — compute jobs clone it from there."}),v.jsx("div",{className:"onb-cards",children:v.jsx($8,{git:l,onUpdate:c})}),v.jsxs("div",{className:"onb-actions",children:[v.jsxs("button",{className:"btn ghost",onClick:()=>n(0),children:[v.jsx(Eo,{size:12})," Back"]}),v.jsxs("button",{className:"btn ghost",onClick:()=>_(!1),disabled:d,children:[v.jsx(mu,{size:12,className:d?"spin":""})," Re-check"]}),v.jsx("div",{style:{flex:1}}),v.jsxs("button",{className:"btn primary",onClick:()=>n(2),children:["Continue ",v.jsx(Lc,{size:13})]})]})]}):t===2?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"onb-eyebrow",children:["Open",v.jsx("span",{children:"Research"})," · step 3 of 4"]}),v.jsx("h2",{className:"onb-title",children:"Where orx keeps your data"}),v.jsx("p",{className:"onb-sub",children:"Your local database, run logs, artifacts, and chat attachments live in one folder on this machine. The default works for most people — change it if you'd rather keep it on another disk."}),v.jsx("div",{className:"onb-cards",children:v.jsx(G8,{dataDir:o,onUpdate:u})}),v.jsxs("div",{className:"onb-actions",children:[v.jsxs("button",{className:"btn ghost",onClick:()=>n(1),children:[v.jsx(Eo,{size:12})," Back"]}),v.jsx("div",{style:{flex:1}}),v.jsxs("button",{className:"btn primary",onClick:()=>n(3),children:["Continue ",v.jsx(Lc,{size:13})]})]})]}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"onb-eyebrow",children:["Open",v.jsx("span",{children:"Research"})," · step 4 of 4"]}),v.jsx("h2",{className:"onb-title",children:"Usage analytics"}),v.jsx("p",{className:"onb-sub",children:"orx can send anonymous usage analytics to help improve the tool. No code, prompts, file contents, or identifiers are ever sent — just a random per-install id, the command run, and your OS."}),v.jsx("div",{className:"onb-cards",children:v.jsx(q8,{telemetry:f,onUpdate:g})}),v.jsxs("div",{className:"onb-actions",children:[v.jsxs("button",{className:"btn ghost",onClick:()=>n(2),children:[v.jsx(Eo,{size:12})," Back"]}),v.jsx("div",{style:{flex:1}}),v.jsxs("button",{className:"btn primary",onClick:w,children:["Create your first project ",v.jsx(Lc,{size:13})]})]})]})})})}function P8(e){return e.agentReady?{cls:"st-done",label:"connected"}:e.installed?{cls:"st-starting",label:"not signed in"}:{cls:"st-idle",label:"not detected"}}function U8({h:e}){var r,a;const t=P8(e),n=(r=e.version)==null?void 0:r.replace(/\s*\(.*\)$/,"");return v.jsxs("div",{className:"onb-card",children:[v.jsxs("div",{className:"onb-card-head",children:[v.jsx("span",{className:"onb-card-name",children:e.name}),v.jsxs("span",{className:`status-badge ${t.cls}`,children:[e.agentReady?v.jsx(_n,{size:12,strokeWidth:3}):v.jsx("span",{className:"dot"}),t.label]})]}),e.agentReady?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"onb-card-detail mono",children:[e.account??"API key",e.plan?` · ${e.plan}`:""]}),v.jsx("div",{className:"onb-card-meta",children:[n,e.models.length>0&&`${e.models.length} model${e.models.length===1?"":"s"} — ${e.models.slice(0,3).map(l=>_u(l.id)).join(", ")}${e.models.length>3?", …":""}`].filter(Boolean).join(" · ")})]}):v.jsx("div",{className:"onb-card-meta",children:(a=e.agentNote)==null?void 0:a.replace(/`/g,"")})]})}function $8({git:e,onUpdate:t}){const[n,r]=Y.useState(!1),a=()=>{navigator.clipboard.writeText("gh auth login").then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};if(e===null)return v.jsxs("div",{className:"onb-loading",children:[v.jsx("span",{className:"spinner"})," Checking git…"]});if(!e.gitVersion)return v.jsxs("div",{className:"onb-card",children:[v.jsxs("div",{className:"onb-card-head",children:[v.jsx("span",{className:"onb-card-name",children:"git"}),v.jsxs("span",{className:"status-badge st-failed",children:[v.jsx("span",{className:"dot"})," not found"]})]}),v.jsx("div",{className:"onb-card-meta",children:"Install git to clone projects, then re-open orx."})]});const l=[e.userName,e.userEmail&&`<${e.userEmail}>`].filter(Boolean).join(" ");return v.jsxs("div",{className:"onb-card",children:[v.jsxs("div",{className:"onb-card-row",children:[v.jsx("span",{className:"onb-card-name",children:"git"}),v.jsxs("span",{className:"onb-card-detail mono",children:[e.gitVersion.replace(/^git version /,""),l?` · ${l}`:""]}),v.jsxs("span",{className:`status-badge ${l?"st-done":"st-starting"}`,children:[l?v.jsx(_n,{size:12,strokeWidth:3}):v.jsx("span",{className:"dot"}),l?"ready":"no identity"]})]}),v.jsxs("div",{className:"onb-card-row",children:[v.jsx("span",{className:"onb-card-name",children:"GitHub"}),v.jsx("span",{className:"onb-card-detail mono",children:e.githubTokenSource==="env"?"token from GITHUB_TOKEN":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"signed in via gh CLI":"not connected"}),v.jsxs("span",{className:`status-badge ${e.githubTokenSource?"st-done":"st-starting"}`,children:[e.githubTokenSource?v.jsx(_n,{size:12,strokeWidth:3}):v.jsx("span",{className:"dot"}),e.githubTokenSource?"ready":"check"]})]}),!l&&v.jsxs("div",{className:"onb-card-meta",children:["Set ",v.jsx("code",{children:"git config --global user.name / user.email"})," so the agent can commit."]}),!e.githubTokenSource&&v.jsxs("div",{className:"onb-gh-options",children:[v.jsx("div",{className:"onb-card-meta",children:"GitHub access is used to clone your repos and push experiment branches. Connect either way:"}),v.jsxs("div",{className:"onb-gh-option",children:[v.jsx("span",{className:"onb-gh-option-label",children:"GitHub CLI"}),v.jsx("div",{className:"onb-gh-option-body",children:e.ghInstalled?v.jsxs(v.Fragment,{children:[v.jsx("code",{className:"onb-gh-cmd",children:"gh auth login"}),v.jsxs("button",{className:"btn ghost",onClick:a,children:[n?v.jsx(_n,{size:12,strokeWidth:3}):v.jsx(vg,{size:12}),n?"Copied":"Copy"]}),v.jsx("span",{className:"onb-gh-hint",children:"run in a terminal, then Re-check"})]}):v.jsxs("span",{className:"onb-gh-hint",children:["install the GitHub CLI, run ",v.jsx("code",{children:"gh auth login"}),", then Re-check"]})})]}),v.jsx("div",{className:"onb-gh-or",children:"or"}),v.jsxs("div",{className:"onb-gh-option",children:[v.jsx("span",{className:"onb-gh-option-label",children:"Paste a token"}),v.jsx(hw,{onSaved:t})]})]})]})}function G8({dataDir:e,onUpdate:t}){const[n,r]=Y.useState(""),[a,l]=Y.useState(!1),[c,o]=Y.useState(!1),[u,f]=Y.useState(null);if(Y.useEffect(()=>{e&&!n&&r(e.current)},[e,n]),e===null)return v.jsxs("div",{className:"onb-loading",children:[v.jsx("span",{className:"spinner"})," Checking storage…"]});if(e.source==="env")return v.jsxs("div",{className:"onb-card",children:[v.jsxs("div",{className:"onb-card-row",children:[v.jsx("span",{className:"onb-card-name",children:"Data folder"}),v.jsx("span",{className:"onb-card-detail mono",children:e.current}),v.jsxs("span",{className:"status-badge st-done",children:[v.jsx(_n,{size:12,strokeWidth:3})," pinned"]})]}),v.jsxs("div",{className:"onb-card-meta",children:["Set by the ",v.jsx("code",{children:"ORX_DATA_DIR"})," environment variable."]})]});const g=n.trim(),d=g!==""&&g!==e.current;async function m(){if(!(c||!d)){o(!0),f(null);try{t(await RT(g)),l(!1)}catch(_){f(_ instanceof Error?_.message:String(_))}finally{o(!1)}}}return v.jsxs("div",{className:"onb-card",children:[v.jsxs("div",{className:"onb-card-row",children:[v.jsx("span",{className:"onb-card-name",children:"Data folder"}),v.jsx("span",{className:"onb-card-detail mono",children:e.current}),v.jsxs("span",{className:`status-badge ${e.isDefault?"st-idle":"st-done"}`,children:[e.isDefault?v.jsx("span",{className:"dot"}):v.jsx(_n,{size:12,strokeWidth:3}),e.isDefault?"default":"custom"]})]}),a?v.jsxs(v.Fragment,{children:[v.jsx("input",{className:"mono",type:"text",value:n,onChange:_=>r(_.target.value),placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,style:{width:"100%",marginTop:10}}),u&&v.jsx("div",{className:"error",style:{marginTop:8},children:u}),v.jsxs("div",{style:{display:"flex",gap:6,marginTop:10},children:[v.jsx("button",{className:"btn primary",onClick:m,disabled:c||!d,children:c?"Saving…":"Use this folder"}),v.jsx("button",{className:"btn ghost",onClick:()=>{l(!1),r(e.current),f(null)},disabled:c,children:"Cancel"})]})]}):v.jsxs("div",{className:"onb-card-meta",style:{display:"flex",gap:10,alignItems:"center"},children:["The default is fine for most setups.",v.jsx("button",{className:"btn ghost",onClick:()=>l(!0),children:"Change…"})]})]})}function q8({telemetry:e,onUpdate:t}){const[n,r]=Y.useState(!1);if(e===null)return v.jsxs("div",{className:"onb-loading",children:[v.jsx("span",{className:"spinner"})," Checking analytics…"]});const a=e.enabled,l=!a&&e.reason!==null&&e.reason!=="disabled via `orx telemetry off`",c=o=>{n||o===a||(r(!0),GT(o).then(t).finally(()=>r(!1)))};return v.jsxs("div",{className:"onb-card",children:[v.jsxs("div",{className:"onb-card-head",children:[v.jsxs("div",{children:[v.jsx("div",{className:"onb-card-name",children:"Share anonymous usage analytics"}),v.jsx("div",{className:"onb-card-meta",style:{marginTop:2},children:a?"On — helps prioritize what to build next.":l?`Off — ${e.reason}.`:"Off — you can turn it back on anytime."})]}),v.jsxs("div",{style:{display:"flex",gap:6,flex:"none"},children:[v.jsxs("button",{className:`btn ${a?"primary":"ghost"}`,onClick:()=>c(!0),disabled:n,"aria-pressed":a,children:[a?v.jsx(_n,{size:12,strokeWidth:3}):null," On"]}),v.jsxs("button",{className:`btn ${a?"ghost":"primary"}`,onClick:()=>c(!1),disabled:n,"aria-pressed":!a,children:[a?null:v.jsx(_n,{size:12,strokeWidth:3})," Off"]})]})]}),v.jsxs("div",{className:"onb-card-meta",style:{marginTop:12},children:["Sent: a random per-install id, the command run, CLI version, and OS. Never sent: code, prompts, file contents, paths, or repo names. Change anytime in Settings or with"," ",v.jsx("code",{children:"orx telemetry off"}),"."]}),l&&v.jsxs("div",{className:"onb-card-meta",style:{marginTop:8},children:["Note: this run is off because of ",e.reason,", which overrides the saved choice."]})]})}function qc(e){const t=e.trim().replace(/^git@github\.com:/i,"").replace(/^https?:\/\/(www\.)?github\.com\//i,"").replace(/\.git$/i,"").replace(/^\/+|\/+$/g,""),[n,r]=t.split("/");return!n||!r||/[\s:@]/.test(n)||/[\s:@]/.test(r)?null:{owner:n,repo:r}}function yb(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/-+$/,"")||"experiment"}function V8(e){const r=(e.trim().split(/[?#]/)[0].split("/").filter(Boolean).pop()??"").replace(/\.(pdf|md)$/i,"");return/^\d{4}\.\d{4,5}(v\d+)?$/.test(r)?r:null}function Y8(e){return e.replace(/^\[[^\]]*\]\s*/,"").replace(/\s*[-–|]\s*arXiv\s*$/i,"")}function W8({onCreated:e,onCancel:t}){var U;const[n,r]=Y.useState("paper"),[a,l]=Y.useState("use"),[c,o]=Y.useState(""),[u,f]=Y.useState(""),[g,d]=Y.useState(!1),[m,_]=Y.useState("main"),[w,C]=Y.useState(!1),[b,S]=Y.useState(null),[x,y]=Y.useState(""),[k,D]=Y.useState([]),[T,R]=Y.useState(!1),[N,L]=Y.useState(null),[I,F]=Y.useState(!1),[V,H]=Y.useState(null),z=Y.useRef(0),q=qc(c),G=!!(u.trim()&&(n==="new"||n==="existing"&&q!==null||n==="paper"&&N!==null&&(c.trim()===""||q!==null))),X=Q=>{var ie;o(Q),g||f(((ie=qc(Q))==null?void 0:ie.repo)??"")};async function K(Q){const ie=++z.current;D([]),R(!1),F(!0),H(null);try{const se=await fT(Q);if(ie!==z.current)return;L(se);const Z=se.repoUrl?qc(se.repoUrl):null;o(Z?`${Z.owner}/${Z.repo}`:""),l("fork"),g||f((Z==null?void 0:Z.repo)??(se.title??"").trim().slice(0,60))}catch(se){if(ie!==z.current)return;H(se instanceof Error?se.message:String(se))}finally{ie===z.current&&F(!1)}}function O(){z.current++,L(null),y(""),D([]),H(null),o(""),g||f("")}Y.useEffect(()=>{if(n!=="paper"||N)return;const Q=x.trim(),ie=V8(Q);if(!ie&&Q.length<3){D([]),R(!1);return}const se=++z.current;ie||R(!0);const Z=setTimeout(()=>{if(ie){K(ie);return}hT(Q).then(P=>{se===z.current&&D(P)}).catch(P=>{se===z.current&&(D([]),H(P instanceof Error?P.message:String(P)))}).finally(()=>{se===z.current&&R(!1)})},350);return()=>clearTimeout(Z)},[n,N,x]);async function M(Q){if(Q.preventDefault(),!(!G||w)){C(!0),S(null);try{const ie=await uT(n==="new"?{name:u.trim(),createRepo:!0}:n==="paper"&&!q?{name:u.trim(),createRepo:!0,paperId:N.paperId}:{name:u.trim(),githubOwner:q.owner,githubRepo:q.repo,baselineBranch:m.trim()||"main",forkRepo:a==="fork",...n==="paper"?{paperId:N.paperId}:{}});e(ie)}catch(ie){S(ie instanceof Error?ie.message:String(ie))}finally{C(!1)}}}const j=n==="new"||n==="paper"&&!q,$=v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"seg form-seg",children:[v.jsx("button",{type:"button",className:a==="use"?"active":"",onClick:()=>l("use"),children:"Use this repo"}),v.jsx("button",{type:"button",className:a==="fork"?"active":"",onClick:()=>l("fork"),children:"Fork a copy"})]}),v.jsx("span",{className:"repo-hint",children:a==="fork"?`snapshots ${q?`${q.owner}/${q.repo}`:"the repo"} into a private repo on your account`:"experiments push branches here — if you can't push to it, a fork is made automatically"}),v.jsxs("div",{className:"row2",children:[v.jsxs("label",{children:["Project name",v.jsx("input",{value:u,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research"})]}),v.jsxs("label",{children:["Branch",v.jsx("input",{value:m,onChange:Q=>_(Q.target.value),placeholder:"main"})]})]})]});return v.jsxs("form",{className:"form",onSubmit:M,children:[v.jsxs("div",{className:"seg form-seg",children:[v.jsx("button",{type:"button",className:n==="paper"?"active":"",onClick:()=>r("paper"),children:"From a paper"}),v.jsx("button",{type:"button",className:n==="existing"?"active":"",onClick:()=>r("existing"),children:"Existing repo"}),v.jsx("button",{type:"button",className:n==="new"?"active":"",onClick:()=>r("new"),children:"New blank repo"})]}),n==="existing"&&v.jsxs(v.Fragment,{children:[v.jsxs("label",{children:["GitHub repository",v.jsx("input",{value:c,onChange:Q=>X(Q.target.value),placeholder:"https://github.com/karpathy/nanoGPT",autoFocus:!0,spellCheck:!1}),v.jsx("span",{className:`repo-hint mono ${q?"ok":""}`,children:q?`${q.owner} / ${q.repo}`:c.trim()?"paste a GitHub URL or owner/repo":"URL or owner/repo — cloned with your git credentials"})]}),$]}),n==="paper"&&(N===null?v.jsxs(v.Fragment,{children:[v.jsxs("label",{children:["Paper",v.jsx("input",{value:x,onChange:Q=>y(Q.target.value),placeholder:"arXiv id, URL, or title — e.g. 1706.03762",autoFocus:!0,spellCheck:!1}),v.jsx("span",{className:`repo-hint ${V?"":"mono"}`,children:I?"looking up paper…":T?"searching alphaXiv…":V??"searches alphaXiv by title — or paste an arXiv id / URL"})]}),k.length>0&&v.jsx("div",{className:"paper-results",children:k.map(Q=>v.jsxs("button",{type:"button",onClick:()=>void K(Q.paperId),children:[v.jsx("span",{className:"title",children:Y8(Q.title)}),v.jsx("span",{className:"id",children:Q.paperId})]},Q.paperId))})]}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"paper-pick",children:[v.jsxs("div",{className:"meta",children:[v.jsx("div",{className:"title",children:N.title||N.paperId}),v.jsxs("div",{className:"id",children:["arXiv ",N.paperId]})]}),v.jsx("button",{type:"button",className:"btn ghost",onClick:O,children:"Change"})]}),v.jsxs("label",{children:["GitHub repository",N.repoUrl?"":" (optional)",v.jsx("input",{value:c,onChange:Q=>X(Q.target.value),placeholder:"owner/repo — leave blank for a new private repo",spellCheck:!1}),v.jsx("span",{className:`repo-hint mono ${q?"ok":""}`,children:q?`${q.owner} / ${q.repo}`+(N.repoUrl&&((U=qc(N.repoUrl))==null?void 0:U.repo)===q.repo?` · linked on alphaXiv${N.repoStars!=null?` · ★ ${N.repoStars}`:""}`:""):c.trim()?"paste a GitHub URL or owner/repo":"no code linked to this paper — a blank private repo will be created"})]}),q?$:v.jsxs("label",{children:["Project name",v.jsx("input",{value:u,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research"}),v.jsx("span",{className:`repo-hint mono ${u.trim()?"ok":""}`,children:u.trim()?`creates github.com/you/${yb(u)} · private`:"a blank private repo is created on your GitHub account"})]})]})),n==="new"&&v.jsxs("label",{children:["Project name",v.jsx("input",{value:u,onChange:Q=>{d(!0),f(Q.target.value)},placeholder:"my-research",autoFocus:!0}),v.jsx("span",{className:`repo-hint mono ${u.trim()?"ok":""}`,children:u.trim()?`creates github.com/you/${yb(u)} · private`:"a blank private repo is created on your GitHub account"})]}),b&&v.jsx("div",{className:"error",children:b}),v.jsxs("div",{className:"actions",children:[t&&v.jsx("button",{type:"button",className:"btn ghost",onClick:t,children:"Cancel"}),v.jsx("button",{type:"submit",className:"btn primary",disabled:!G||w,children:w?j?"Creating repo…":a==="fork"?"Forking repo…":"Cloning repo…":"Create project"})]})]})}function bb({projects:e,onOpen:t,onCreated:n,onDeleted:r}){const[a,l]=Y.useState(!1),[c,o]=Y.useState(null);async function u(f){if(window.confirm(`Delete project "${f.name}"? -Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githubOwner}/${f.githubRepo}) is kept.`)){o(f.id);try{await lT(f.id),r(f.id)}catch(d){window.alert(d instanceof Error?d.message:String(d))}finally{o(null)}}}return S.jsxs("div",{className:"home",children:[S.jsxs("div",{className:"home-inner",children:[S.jsxs("div",{className:"home-brand",children:["Open",S.jsx("span",{children:"Research"})]}),S.jsxs("div",{className:"home-head",children:[S.jsx("h2",{children:"Projects"}),S.jsxs("button",{className:"btn sm",onClick:()=>l(!0),children:[S.jsx(pg,{size:13})," New project"]})]}),S.jsx("div",{className:"home-list",children:e.length===0?S.jsx("div",{className:"changes-note",children:"No projects yet — create one to get started."}):[...e].sort((f,g)=>g.updatedAt-f.updatedAt).map(f=>S.jsxs("div",{className:"project-card",role:"button",tabIndex:0,onClick:()=>t(f.id),onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&t(f.id)},children:[S.jsx("span",{className:"name",children:f.name}),S.jsxs("span",{className:"repo mono",children:[f.githubOwner,"/",f.githubRepo," · ",f.baselineBranch]}),f.paperId&&S.jsxs("span",{className:"paper mono",children:["arXiv ",f.paperId]}),S.jsxs("span",{className:"time",children:["created ",fa(f.createdAt)]}),S.jsx("button",{className:"project-delete",title:`Delete ${f.name}`,disabled:c===f.id,onClick:g=>{g.stopPropagation(),u(f)},children:S.jsx(Bu,{size:14})})]},f.id))})]}),a&&S.jsx("div",{className:"modal-backdrop",onClick:()=>l(!1),children:S.jsxs("div",{className:"modal",onClick:f=>f.stopPropagation(),children:[S.jsx("h2",{children:"New project"}),S.jsx(R8,{onCancel:()=>l(!1),onCreated:f=>{l(!1),n(f)}})]})})]})}function M8(e){const t=HS(e.backend);return t?[t,FS(e.backend)].filter(Boolean).join(" · "):"—"}function L8({runs:e,experiments:t,onOpen:n,onOpenChanges:r,onCancel:a}){const l=new Map(t.map(o=>[o.id,o.slug])),c=[...e].sort((o,u)=>u.createdAt-o.createdAt);return c.length===0?S.jsx("div",{className:"empty-state",children:S.jsx("p",{children:"No runs yet."})}):S.jsx("div",{className:"runs-table-wrap",children:S.jsxs("table",{className:"runs-table",children:[S.jsx("thead",{children:S.jsxs("tr",{children:[S.jsx("th",{children:"Run"}),S.jsx("th",{children:"Experiment"}),S.jsx("th",{children:"Status"}),S.jsx("th",{children:"Backend"}),S.jsx("th",{children:"Commit"}),S.jsx("th",{children:"Started"}),S.jsx("th",{children:"Exit"}),S.jsx("th",{})]})}),S.jsx("tbody",{children:c.map(o=>{const u=o.status==="running"||o.status==="starting";return S.jsxs("tr",{className:"clickable",onClick:()=>n(o),children:[S.jsx("td",{className:"mono",children:xp(o.id)}),S.jsx("td",{className:"mono",children:l.get(o.experimentId)??xp(o.experimentId)}),S.jsx("td",{children:S.jsx(Bo,{status:o.status})}),S.jsx("td",{className:"mono",children:M8(o)}),S.jsx("td",{className:"mono",children:o.commitSha?o.commitSha.slice(0,7):"—"}),S.jsx("td",{children:fa(o.createdAt)}),S.jsx("td",{className:"mono",children:o.exitCode??"—"}),S.jsx("td",{children:S.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[S.jsx("button",{className:"icon-btn",title:"Open changes",onClick:f=>{f.stopPropagation(),r(o.experimentId)},children:S.jsx(ju,{size:14})}),u&&S.jsx("button",{className:"btn sm danger",onClick:f=>{f.stopPropagation(),a(o.id)},children:"Cancel"})]})})]},o.id)})})]})})}function Pt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function lh(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}au.prototype=lh.prototype={constructor:au,on:function(e,t){var n=this._,r=j8(e+"",n),a,l=-1,c=r.length;if(arguments.length<2){for(;++l0)for(var n=new Array(a),r=0,a,l;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),vb.hasOwnProperty(t)?{space:vb[t],local:e}:e}function I8(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Xp&&t.documentElement.namespaceURI===Xp?t.createElement(e):t.createElementNS(n,e)}}function z8(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Zw(e){var t=ch(e);return(t.local?z8:I8)(t)}function H8(){}function _m(e){return e==null?H8:function(){return this.querySelector(e)}}function F8(e){typeof e!="function"&&(e=_m(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a=v&&(v=x+1);!(D=y[v])&&++v=0;)(c=r[a])&&(l&&c.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(c,l),l=c);return this}function hB(e){e||(e=fB);function t(d,m){return d&&m?e(d.__data__,m.__data__):!d-!m}for(var n=this._groups,r=n.length,a=new Array(r),l=0;lt?1:e>=t?0:NaN}function dB(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pB(){return Array.from(this)}function gB(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?kB:typeof t=="function"?TB:AB)(e,t,n??"")):sa(this.node(),e)}function sa(e,t){return e.style.getPropertyValue(t)||nC(e).getComputedStyle(e,null).getPropertyValue(t)}function DB(e){return function(){delete this[e]}}function RB(e,t){return function(){this[e]=t}}function MB(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function LB(e,t){return arguments.length>1?this.each((t==null?DB:typeof t=="function"?MB:RB)(e,t)):this.node()[e]}function iC(e){return e.trim().split(/^|\s+/)}function vm(e){return e.classList||new rC(e)}function rC(e){this._node=e,this._names=iC(e.getAttribute("class")||"")}rC.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function sC(e,t){for(var n=vm(e),r=-1,a=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function oI(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,l;n()=>e;function Kp(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:l,x:c,y:o,dx:u,dy:f,dispatch:g}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:g}})}Kp.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function _I(e){return!e.ctrlKey&&!e.button}function vI(){return this.parentNode}function yI(e,t){return t??{x:e.x,y:e.y}}function bI(){return navigator.maxTouchPoints||"ontouchstart"in this}function hC(){var e=_I,t=vI,n=yI,r=bI,a={},l=lh("start","drag","end"),c=0,o,u,f,g,d=0;function m(k){k.on("mousedown.drag",_).filter(r).on("touchstart.drag",y).on("touchmove.drag",b,mI).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(k,D){if(!(g||!e.call(this,k,D))){var T=v(this,t.call(this,k,D),k,D,"mouse");T&&(En(k.view).on("mousemove.drag",w,Po).on("mouseup.drag",C,Po),cC(k.view),op(k),f=!1,o=k.clientX,u=k.clientY,T("start",k))}}function w(k){if(ta(k),!f){var D=k.clientX-o,T=k.clientY-u;f=D*D+T*T>d}a.mouse("drag",k)}function C(k){En(k.view).on("mousemove.drag mouseup.drag",null),uC(k.view,f),ta(k),a.mouse("end",k)}function y(k,D){if(e.call(this,k,D)){var T=k.changedTouches,R=t.call(this,k,D),N=T.length,L,I;for(L=0;L>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Gc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Gc(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=xI.exec(e))?new gn(t[1],t[2],t[3],1):(t=wI.exec(e))?new gn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=CI.exec(e))?Gc(t[1],t[2],t[3],t[4]):(t=EI.exec(e))?Gc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=kI.exec(e))?Eb(t[1],t[2]/100,t[3]/100,1):(t=AI.exec(e))?Eb(t[1],t[2]/100,t[3]/100,t[4]):yb.hasOwnProperty(e)?xb(yb[e]):e==="transparent"?new gn(NaN,NaN,NaN,0):null}function xb(e){return new gn(e>>16&255,e>>8&255,e&255,1)}function Gc(e,t,n,r){return r<=0&&(e=t=n=NaN),new gn(e,t,n,r)}function DI(e){return e instanceof rl||(e=Qr(e)),e?(e=e.rgb(),new gn(e.r,e.g,e.b,e.opacity)):new gn}function Zp(e,t,n,r){return arguments.length===1?DI(e):new gn(e,t,n,r??1)}function gn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ym(gn,Zp,fC(rl,{brighter(e){return e=e==null?xu:Math.pow(xu,e),new gn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Uo:Math.pow(Uo,e),new gn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new gn(Xr(this.r),Xr(this.g),Xr(this.b),wu(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:wb,formatHex:wb,formatHex8:RI,formatRgb:Cb,toString:Cb}));function wb(){return`#${Yr(this.r)}${Yr(this.g)}${Yr(this.b)}`}function RI(){return`#${Yr(this.r)}${Yr(this.g)}${Yr(this.b)}${Yr((isNaN(this.opacity)?1:this.opacity)*255)}`}function Cb(){const e=wu(this.opacity);return`${e===1?"rgb(":"rgba("}${Xr(this.r)}, ${Xr(this.g)}, ${Xr(this.b)}${e===1?")":`, ${e})`}`}function wu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Xr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Yr(e){return e=Xr(e),(e<16?"0":"")+e.toString(16)}function Eb(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Vn(e,t,n,r)}function dC(e){if(e instanceof Vn)return new Vn(e.h,e.s,e.l,e.opacity);if(e instanceof rl||(e=Qr(e)),!e)return new Vn;if(e instanceof Vn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),l=Math.max(t,n,r),c=NaN,o=l-a,u=(l+a)/2;return o?(t===l?c=(n-r)/o+(n0&&u<1?0:c,new Vn(c,o,u,e.opacity)}function MI(e,t,n,r){return arguments.length===1?dC(e):new Vn(e,t,n,r??1)}function Vn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ym(Vn,MI,fC(rl,{brighter(e){return e=e==null?xu:Math.pow(xu,e),new Vn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Uo:Math.pow(Uo,e),new Vn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new gn(lp(e>=240?e-240:e+120,a,r),lp(e,a,r),lp(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Vn(kb(this.h),qc(this.s),qc(this.l),wu(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=wu(this.opacity);return`${e===1?"hsl(":"hsla("}${kb(this.h)}, ${qc(this.s)*100}%, ${qc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function kb(e){return e=(e||0)%360,e<0?e+360:e}function qc(e){return Math.max(0,Math.min(1,e||0))}function lp(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const bm=e=>()=>e;function LI(e,t){return function(n){return e+n*t}}function OI(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function jI(e){return(e=+e)==1?pC:function(t,n){return n-t?OI(t,n,e):bm(isNaN(t)?n:t)}}function pC(e,t){var n=t-e;return n?LI(e,n):bm(isNaN(e)?t:e)}const Cu=(function e(t){var n=jI(t);function r(a,l){var c=n((a=Zp(a)).r,(l=Zp(l)).r),o=n(a.g,l.g),u=n(a.b,l.b),f=pC(a.opacity,l.opacity);return function(g){return a.r=c(g),a.g=o(g),a.b=u(g),a.opacity=f(g),a+""}}return r.gamma=e,r})(1);function BI(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(l){for(a=0;an&&(l=t.slice(n,l),o[c]?o[c]+=l:o[++c]=l),(r=r[0])===(a=a[0])?o[c]?o[c]+=a:o[++c]=a:(o[++c]=null,u.push({i:c,x:ri(r,a)})),n=cp.lastIndex;return n180?g+=360:g-f>180&&(f+=360),m.push({i:d.push(a(d)+"rotate(",null,r)-2,x:ri(f,g)})):g&&d.push(a(d)+"rotate("+g+r)}function o(f,g,d,m){f!==g?m.push({i:d.push(a(d)+"skewX(",null,r)-2,x:ri(f,g)}):g&&d.push(a(d)+"skewX("+g+r)}function u(f,g,d,m,_,w){if(f!==d||g!==m){var C=_.push(a(_)+"scale(",null,",",null,")");w.push({i:C-4,x:ri(f,d)},{i:C-2,x:ri(g,m)})}else(d!==1||m!==1)&&_.push(a(_)+"scale("+d+","+m+")")}return function(f,g){var d=[],m=[];return f=e(f),g=e(g),l(f.translateX,f.translateY,g.translateX,g.translateY,d,m),c(f.rotate,g.rotate,d,m),o(f.skewX,g.skewX,d,m),u(f.scaleX,f.scaleY,g.scaleX,g.scaleY,d,m),f=g=null,function(_){for(var w=-1,C=m.length,y;++w=0&&e._call.call(void 0,t),e=e._next;--aa}function Nb(){Jr=(ku=Go.now())+uh,aa=wo=0;try{ZI()}finally{aa=0,JI(),Jr=0}}function QI(){var e=Go.now(),t=e-ku;t>vC&&(uh-=t,ku=e)}function JI(){for(var e,t=Eu,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Eu=n);Co=e,eg(r)}function eg(e){if(!aa){wo&&(wo=clearTimeout(wo));var t=e-Jr;t>24?(e<1/0&&(wo=setTimeout(Nb,e-Go.now()-uh)),So&&(So=clearInterval(So))):(So||(ku=Go.now(),So=setInterval(QI,vC)),aa=1,yC(Nb))}}function Db(e,t,n){var r=new Au;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var e7=lh("start","end","cancel","interrupt"),t7=[],SC=0,Rb=1,tg=2,lu=3,Mb=4,ng=5,cu=6;function hh(e,t,n,r,a,l){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;n7(e,n,{name:t,index:r,group:a,on:e7,tween:t7,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:SC})}function xm(e,t){var n=Zn(e,t);if(n.state>SC)throw new Error("too late; already scheduled");return n}function ui(e,t){var n=Zn(e,t);if(n.state>lu)throw new Error("too late; already running");return n}function Zn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function n7(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=bC(l,0,n.time);function l(f){n.state=Rb,n.timer.restart(c,n.delay,n.time),n.delay<=f&&c(f-n.delay)}function c(f){var g,d,m,_;if(n.state!==Rb)return u();for(g in r)if(_=r[g],_.name===n.name){if(_.state===lu)return Db(c);_.state===Mb?(_.state=cu,_.timer.stop(),_.on.call("interrupt",e,e.__data__,_.index,_.group),delete r[g]):+gtg&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function M7(e,t,n){var r,a,l=R7(t)?xm:ui;return function(){var c=l(this,e),o=c.on;o!==r&&(a=(r=o).copy()).on(t,n),c.on=a}}function L7(e,t){var n=this._id;return arguments.length<2?Zn(this.node(),n).on.on(e):this.each(M7(n,e,t))}function O7(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function j7(){return this.on("end.remove",O7(this._id))}function B7(e){var t=this._name,n=this._id;typeof e!="function"&&(e=_m(e));for(var r=this._groups,a=r.length,l=new Array(a),c=0;c()=>e;function o9(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:a}})}function Li(e,t,n){this.k=e,this.x=t,this.y=n}Li.prototype={constructor:Li,scale:function(e){return e===1?this:new Li(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Li(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var fh=new Li(1,0,0);EC.prototype=Li.prototype;function EC(e){for(;!e.__zoom;)if(!(e=e.parentNode))return fh;return e.__zoom}function up(e){e.stopImmediatePropagation()}function xo(e){e.preventDefault(),e.stopImmediatePropagation()}function l9(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function c9(){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 Lb(){return this.__zoom||fh}function u9(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function h9(){return navigator.maxTouchPoints||"ontouchstart"in this}function f9(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),c>l?(l+c)/2:Math.min(0,l)||Math.max(0,c))}function kC(){var e=l9,t=c9,n=f9,r=u9,a=h9,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],o=250,u=ou,f=lh("start","zoom","end"),g,d,m,_=500,w=150,C=0,y=10;function b(z){z.property("__zoom",Lb).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",I).filter(a).on("touchstart.zoom",F).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(z,q,G,X){var K=z.selection?z.selection():z;K.property("__zoom",Lb),z!==K?D(z,q,G,X):K.interrupt().each(function(){T(this,arguments).event(X).start().zoom(null,typeof q=="function"?q.apply(this,arguments):q).end()})},b.scaleBy=function(z,q,G,X){b.scaleTo(z,function(){var K=this.__zoom.k,O=typeof q=="function"?q.apply(this,arguments):q;return K*O},G,X)},b.scaleTo=function(z,q,G,X){b.transform(z,function(){var K=t.apply(this,arguments),O=this.__zoom,M=G==null?k(K):typeof G=="function"?G.apply(this,arguments):G,j=O.invert(M),$=typeof q=="function"?q.apply(this,arguments):q;return n(v(x(O,$),M,j),K,c)},G,X)},b.translateBy=function(z,q,G,X){b.transform(z,function(){return n(this.__zoom.translate(typeof q=="function"?q.apply(this,arguments):q,typeof G=="function"?G.apply(this,arguments):G),t.apply(this,arguments),c)},null,X)},b.translateTo=function(z,q,G,X,K){b.transform(z,function(){var O=t.apply(this,arguments),M=this.__zoom,j=X==null?k(O):typeof X=="function"?X.apply(this,arguments):X;return n(fh.translate(j[0],j[1]).scale(M.k).translate(typeof q=="function"?-q.apply(this,arguments):-q,typeof G=="function"?-G.apply(this,arguments):-G),O,c)},X,K)};function x(z,q){return q=Math.max(l[0],Math.min(l[1],q)),q===z.k?z:new Li(q,z.x,z.y)}function v(z,q,G){var X=q[0]-G[0]*z.k,K=q[1]-G[1]*z.k;return X===z.x&&K===z.y?z:new Li(z.k,X,K)}function k(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function D(z,q,G,X){z.on("start.zoom",function(){T(this,arguments).event(X).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(X).end()}).tween("zoom",function(){var K=this,O=arguments,M=T(K,O).event(X),j=t.apply(K,O),$=G==null?k(j):typeof G=="function"?G.apply(K,O):G,U=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),Q=K.__zoom,ie=typeof q=="function"?q.apply(K,O):q,se=u(Q.invert($).concat(U/Q.k),ie.invert($).concat(U/ie.k));return function(Z){if(Z===1)Z=ie;else{var P=se(Z),ee=U/P[2];Z=new Li(ee,$[0]-P[0]*ee,$[1]-P[1]*ee)}M.zoom(null,Z)}})}function T(z,q,G){return!G&&z.__zooming||new R(z,q)}function R(z,q){this.that=z,this.args=q,this.active=0,this.sourceEvent=null,this.extent=t.apply(z,q),this.taps=0}R.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,q){return this.mouse&&z!=="mouse"&&(this.mouse[1]=q.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=q.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=q.invert(this.touch1[0])),this.that.__zoom=q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var q=En(this.that).datum();f.call(z,this.that,new o9(z,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:f}),q)}};function N(z,...q){if(!e.apply(this,arguments))return;var G=T(this,q).event(z),X=this.__zoom,K=Math.max(l[0],Math.min(l[1],X.k*Math.pow(2,r.apply(this,arguments)))),O=qn(z);if(G.wheel)(G.mouse[0][0]!==O[0]||G.mouse[0][1]!==O[1])&&(G.mouse[1]=X.invert(G.mouse[0]=O)),clearTimeout(G.wheel);else{if(X.k===K)return;G.mouse=[O,X.invert(O)],uu(this),G.start()}xo(z),G.wheel=setTimeout(M,w),G.zoom("mouse",n(v(x(X,K),G.mouse[0],G.mouse[1]),G.extent,c));function M(){G.wheel=null,G.end()}}function L(z,...q){if(m||!e.apply(this,arguments))return;var G=z.currentTarget,X=T(this,q,!0).event(z),K=En(z.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",U,!0),O=qn(z,G),M=z.clientX,j=z.clientY;cC(z.view),up(z),X.mouse=[O,this.__zoom.invert(O)],uu(this),X.start();function $(Q){if(xo(Q),!X.moved){var ie=Q.clientX-M,se=Q.clientY-j;X.moved=ie*ie+se*se>C}X.event(Q).zoom("mouse",n(v(X.that.__zoom,X.mouse[0]=qn(Q,G),X.mouse[1]),X.extent,c))}function U(Q){K.on("mousemove.zoom mouseup.zoom",null),uC(Q.view,X.moved),xo(Q),X.event(Q).end()}}function I(z,...q){if(e.apply(this,arguments)){var G=this.__zoom,X=qn(z.changedTouches?z.changedTouches[0]:z,this),K=G.invert(X),O=G.k*(z.shiftKey?.5:2),M=n(v(x(G,O),X,K),t.apply(this,q),c);xo(z),o>0?En(this).transition().duration(o).call(D,M,X,z):En(this).call(b.transform,M,X,z)}}function F(z,...q){if(e.apply(this,arguments)){var G=z.touches,X=G.length,K=T(this,q,z.changedTouches.length===X).event(z),O,M,j,$;for(up(z),M=0;M`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:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},qo=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],AC=["Enter"," ","Escape"],TC={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var oa;(function(e){e.Strict="strict",e.Loose="loose"})(oa||(oa={}));var Kr;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Kr||(Kr={}));var Vo;(function(e){e.Partial="partial",e.Full="full"})(Vo||(Vo={}));const NC={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var vr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(vr||(vr={}));var Tu;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Tu||(Tu={}));var Te;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Te||(Te={}));const Ob={[Te.Left]:Te.Right,[Te.Right]:Te.Left,[Te.Top]:Te.Bottom,[Te.Bottom]:Te.Top};function DC(e){return e===null?null:e?"valid":"invalid"}const RC=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,d9=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Cm=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),sl=(e,t=[0,0])=>{const{width:n,height:r}=hi(e),a=e.origin??t,l=n*a[0],c=r*a[1];return{x:e.position.x-l,y:e.position.y-c}},p9=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const l=typeof a=="string";let c=!t.nodeLookup&&!l?a:void 0;t.nodeLookup&&(c=l?t.nodeLookup.get(a):Cm(a)?a:t.nodeLookup.get(a.id));const o=c?Nu(c,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return dh(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ph(n)},al=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(a=>{(t.filter===void 0||t.filter(a))&&(n=dh(n,Nu(a)),r=!0)}),r?ph(n):{x:0,y:0,width:0,height:0}},Em=(e,t,[n,r,a]=[0,0,1],l=!1,c=!1)=>{const o=(t.x-n)/a,u=(t.y-r)/a,f=t.width/a,g=t.height/a,d=[];for(const m of e.values()){const{measured:_,selectable:w=!0,hidden:C=!1}=m;if(c&&!w||C)continue;const y=_.width??m.width??m.initialWidth??0,b=_.height??m.height??m.initialHeight??0,{x,y:v}=m.internals.positionAbsolute,k=jC(o,u,f,g,x,v,y,b),D=y*b,T=l&&k>0;(!m.internals.handleBounds||T||k>=D||m.dragging)&&d.push(m)}return d},g9=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function m9(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{let l;if(t!=null&&t.includeHiddenNodes){const{width:c,height:o}=hi(a);l=c>0&&o>0}else l=!!(a.measured.width&&a.measured.height&&!a.hidden);l&&(!r||r.has(a.id))&&n.set(a.id,a)}),n}async function _9({nodes:e,width:t,height:n,panZoom:r,minZoom:a,maxZoom:l},c){if(e.size===0)return!0;const o=m9(e,c),u=al(o),f=Am(u,t,n,(c==null?void 0:c.minZoom)??a,(c==null?void 0:c.maxZoom)??l,(c==null?void 0:c.padding)??.1);return await r.setViewport(f,{duration:c==null?void 0:c.duration,ease:c==null?void 0:c.ease,interpolate:c==null?void 0:c.interpolate}),!0}function MC({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:a,onError:l}){const c=n.get(e),o=c.parentId?n.get(c.parentId):void 0,{x:u,y:f}=o?o.internals.positionAbsolute:{x:0,y:0},g=c.origin??r;let d=c.extent||a;if(c.extent==="parent"&&!c.expandParent)if(!o)l==null||l("005",Kn.error005());else{const _=o.measured.width,w=o.measured.height;_&&w&&(d=[[u,f],[u+_,f+w]])}else o&&ts(c.extent)&&(d=[[c.extent[0][0]+u,c.extent[0][1]+f],[c.extent[1][0]+u,c.extent[1][1]+f]]);const m=ts(d)?es(t,d,c.measured):t;return(c.measured.width===void 0||c.measured.height===void 0)&&(l==null||l("015",Kn.error015())),{position:{x:m.x-u+(c.measured.width??0)*g[0],y:m.y-f+(c.measured.height??0)*g[1]},positionAbsolute:m}}async function v9({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:a}){const l=new Set(e.map(m=>m.id)),c=[];for(const m of n){if(m.deletable===!1)continue;const _=l.has(m.id),w=!_&&m.parentId&&c.find(C=>C.id===m.parentId);(_||w)&&c.push(m)}const o=new Set(t.map(m=>m.id)),u=r.filter(m=>m.deletable!==!1),g=g9(c,u);for(const m of u)o.has(m.id)&&!g.find(w=>w.id===m.id)&&g.push(m);if(!a)return{edges:g,nodes:c};const d=await a({nodes:c,edges:g});return typeof d=="boolean"?d?{edges:g,nodes:c}:{edges:[],nodes:[]}:d}const la=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),es=(e={x:0,y:0},t,n)=>({x:la(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:la(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function LC(e,t,n){const{width:r,height:a}=hi(n),{x:l,y:c}=n.internals.positionAbsolute;return es(e,[[l,c],[l+r,c+a]],t)}const jb=(e,t,n)=>en?-la(Math.abs(e-n),1,t)/t:0,km=(e,t,n=15,r=40)=>{const a=jb(e.x,r,t.width-r)*n,l=jb(e.y,r,t.height-r)*n;return[a,l]},dh=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),ig=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),ph=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Yo=(e,t=[0,0])=>{var a,l;const{x:n,y:r}=Cm(e)?e.internals.positionAbsolute:sl(e,t);return{x:n,y:r,width:((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0,height:((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0}},Nu=(e,t=[0,0])=>{var a,l;const{x:n,y:r}=Cm(e)?e.internals.positionAbsolute:sl(e,t);return{x:n,y:r,x2:n+(((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0),y2:r+(((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0)}},OC=(e,t)=>ph(dh(ig(e),ig(t))),jC=(e,t,n,r,a,l,c,o)=>{const u=Math.max(0,Math.min(e+n,a+c)-Math.max(e,a)),f=Math.max(0,Math.min(t+r,l+o)-Math.max(t,l));return Math.ceil(u*f)},Du=(e,t)=>jC(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Bb=e=>Yn(e.width)&&Yn(e.height)&&Yn(e.x)&&Yn(e.y),Yn=e=>!isNaN(e)&&isFinite(e),BC=(e,t)=>(n,r)=>{},ol=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),ll=({x:e,y:t},[n,r,a],l=!1,c=[1,1])=>{const o={x:(e-n)/a,y:(t-r)/a};return l?ol(o,c):o},ca=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r});function Vs(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function y9(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Vs(e,n),a=Vs(e,t);return{top:r,right:a,bottom:r,left:a,x:a*2,y:r*2}}if(typeof e=="object"){const r=Vs(e.top??e.y??0,n),a=Vs(e.bottom??e.y??0,n),l=Vs(e.left??e.x??0,t),c=Vs(e.right??e.x??0,t);return{top:r,right:c,bottom:a,left:l,x:l+c,y:r+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function b9(e,t,n,r,a,l){const{x:c,y:o}=ca(e,[t,n,r]),{x:u,y:f}=ca({x:e.x+e.width,y:e.y+e.height},[t,n,r]),g=a-u,d=l-f;return{left:Math.floor(c),top:Math.floor(o),right:Math.floor(g),bottom:Math.floor(d)}}const Am=(e,t,n,r,a,l)=>{const c=y9(l,t,n),o=(t-c.x)/e.width,u=(n-c.y)/e.height,f=Math.min(o,u),g=la(f,r,a),d=e.x+e.width/2,m=e.y+e.height/2,_=t/2-d*g,w=n/2-m*g,C=b9(e,_,w,g,t,n),y={left:Math.min(C.left-c.left,0),top:Math.min(C.top-c.top,0),right:Math.min(C.right-c.right,0),bottom:Math.min(C.bottom-c.bottom,0)};return{x:_-y.left+y.right,y:w-y.top+y.bottom,zoom:g}},Wo=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ts(e){return e!=null&&e!=="parent"}function hi(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function IC(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function zC(e,t={width:0,height:0},n,r,a){const l={...e},c=r.get(n);if(c){const o=c.origin||a;l.x+=c.internals.positionAbsolute.x-(t.width??0)*o[0],l.y+=c.internals.positionAbsolute.y-(t.height??0)*o[1]}return l}function Ib(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function S9(){let e,t;return{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t}}function x9(e){return{...TC,...e||{}}}function Do(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:a}){const{x:l,y:c}=Wn(e),o=ll({x:l-((a==null?void 0:a.left)??0),y:c-((a==null?void 0:a.top)??0)},r),{x:u,y:f}=n?ol(o,t):o;return{xSnapped:u,ySnapped:f,...o}}const Tm=e=>({width:e.offsetWidth,height:e.offsetHeight}),HC=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},w9=["INPUT","SELECT","TEXTAREA"];function FC(e){var r,a;const t=((a=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:a[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:w9.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const PC=e=>"clientX"in e,Wn=(e,t)=>{var l,c;const n=PC(e),r=n?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,a=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},zb=(e,t,n,r,a)=>{const l=t.querySelectorAll(`.${e}`);return!l||!l.length?null:Array.from(l).map(c=>{const o=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),type:e,nodeId:a,position:c.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r,...Tm(c)}})};function UC({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:o}){const u=e*.125+a*.375+c*.375+n*.125,f=t*.125+l*.375+o*.375+r*.125,g=Math.abs(u-e),d=Math.abs(f-t);return[u,f,g,d]}function Wc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Hb({pos:e,x1:t,y1:n,x2:r,y2:a,c:l}){switch(e){case Te.Left:return[t-Wc(t-r,l),n];case Te.Right:return[t+Wc(r-t,l),n];case Te.Top:return[t,n-Wc(n-a,l)];case Te.Bottom:return[t,n+Wc(a-n,l)]}}function $C({sourceX:e,sourceY:t,sourcePosition:n=Te.Bottom,targetX:r,targetY:a,targetPosition:l=Te.Top,curvature:c=.25}){const[o,u]=Hb({pos:n,x1:e,y1:t,x2:r,y2:a,c}),[f,g]=Hb({pos:l,x1:r,y1:a,x2:e,y2:t,c}),[d,m,_,w]=UC({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:o,sourceControlY:u,targetControlX:f,targetControlY:g});return[`M${e},${t} C${o},${u} ${f},${g} ${r},${a}`,d,m,_,w]}function GC({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,l=n0}const k9=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,A9=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),T9=(e,t,n={})=>{var l;if(!e.source||!e.target)return(l=n.onError)==null||l.call(n,"006",Kn.error006()),t;const r=n.getEdgeId||k9;let a;return RC(e)?a={...e}:a={...e,id:r(e)},A9(a,t)?t:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,t.concat(a))};function qC({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,c,o]=GC({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,c,o]}const Fb={[Te.Left]:{x:-1,y:0},[Te.Right]:{x:1,y:0},[Te.Top]:{x:0,y:-1},[Te.Bottom]:{x:0,y:1}},N9=({source:e,sourcePosition:t=Te.Bottom,target:n})=>t===Te.Left||t===Te.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function D9({source:e,sourcePosition:t=Te.Bottom,target:n,targetPosition:r=Te.Top,center:a,offset:l,stepPosition:c}){const o=Fb[t],u=Fb[r],f={x:e.x+o.x*l,y:e.y+o.y*l},g={x:n.x+u.x*l,y:n.y+u.y*l},d=N9({source:f,sourcePosition:t,target:g}),m=d.x!==0?"x":"y",_=d[m];let w=[],C,y;const b={x:0,y:0},x={x:0,y:0},[,,v,k]=GC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[m]*u[m]===-1){m==="x"?(C=a.x??f.x+(g.x-f.x)*c,y=a.y??(f.y+g.y)/2):(C=a.x??(f.x+g.x)/2,y=a.y??f.y+(g.y-f.y)*c);const N=[{x:C,y:f.y},{x:C,y:g.y}],L=[{x:f.x,y},{x:g.x,y}];o[m]===_?w=m==="x"?N:L:w=m==="x"?L:N}else{const N=[{x:f.x,y:g.y}],L=[{x:g.x,y:f.y}];if(m==="x"?w=o.x===_?L:N:w=o.y===_?N:L,t===r){const z=Math.abs(e[m]-n[m]);if(z<=l){const q=Math.min(l-1,l-z);o[m]===_?b[m]=(f[m]>e[m]?-1:1)*q:x[m]=(g[m]>n[m]?-1:1)*q}}if(t!==r){const z=m==="x"?"y":"x",q=o[m]===u[z],G=f[z]>g[z],X=f[z]=H?(C=(I.x+F.x)/2,y=w[0].y):(C=w[0].x,y=(I.y+F.y)/2)}const D={x:f.x+b.x,y:f.y+b.y},T={x:g.x+x.x,y:g.y+x.y};return[[e,...D.x!==w[0].x||D.y!==w[0].y?[D]:[],...w,...T.x!==w[w.length-1].x||T.y!==w[w.length-1].y?[T]:[],n],C,y,v,k]}function R9(e,t,n,r){const a=Math.min(Pb(e,t)/2,Pb(t,n)/2,r),{x:l,y:c}=t;if(e.x===l&&l===n.x||e.y===c&&c===n.y)return`L${l} ${c}`;if(e.y===c){const f=e.xn.id===t):e[0])||null}function sg(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function L9(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:a}){const l=new Set;return e.reduce((c,o)=>([o.markerStart||r,o.markerEnd||a].forEach(u=>{if(u&&typeof u=="object"){const f=sg(u,t);l.has(f)||(c.push({id:f,color:u.color||n,...u}),l.add(f))}}),c),[]).sort((c,o)=>c.id.localeCompare(o.id))}const VC=1e3,O9=10,Nm={nodeOrigin:[0,0],nodeExtent:qo,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},j9={...Nm,checkEquality:!0};function Dm(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function B9(e,t,n){const r=Dm(Nm,n);for(const a of e.values())if(a.parentId)Mm(a,e,t,r);else{const l=sl(a,r.nodeOrigin),c=ts(a.extent)?a.extent:r.nodeExtent,o=es(l,c,hi(a));a.internals.positionAbsolute=o}}function I9(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const a of e.handles){const l={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?n.push(l):a.type==="target"&&r.push(l)}return{source:n,target:r}}function Rm(e){return e==="manual"}function ag(e,t,n,r={}){var g,d;const a=Dm(j9,r),l={i:0},c=new Map(t),o=a!=null&&a.elevateNodesOnSelect&&!Rm(a.zIndexMode)?VC:0;let u=e.length>0,f=!1;t.clear(),n.clear();for(const m of e){let _=c.get(m.id);if(a.checkEquality&&m===(_==null?void 0:_.internals.userNode))t.set(m.id,_);else{const w=sl(m,a.nodeOrigin),C=ts(m.extent)?m.extent:a.nodeExtent,y=es(w,C,hi(m));_={...a.defaults,...m,measured:{width:(g=m.measured)==null?void 0:g.width,height:(d=m.measured)==null?void 0:d.height},internals:{positionAbsolute:y,handleBounds:I9(m,_),z:YC(m,o,a.zIndexMode),userNode:m}},t.set(m.id,_)}(_.measured===void 0||_.measured.width===void 0||_.measured.height===void 0)&&!_.hidden&&(u=!1),m.parentId&&Mm(_,t,n,r,l),f||(f=m.selected??!1)}return{nodesInitialized:u,hasSelectedNodes:f}}function z9(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Mm(e,t,n,r,a){const{elevateNodesOnSelect:l,nodeOrigin:c,nodeExtent:o,zIndexMode:u}=Dm(Nm,r),f=e.parentId,g=t.get(f);if(!g){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}z9(e,n),a&&!g.parentId&&g.internals.rootParentIndex===void 0&&u==="auto"&&(g.internals.rootParentIndex=++a.i,g.internals.z=g.internals.z+a.i*O9),a&&g.internals.rootParentIndex!==void 0&&(a.i=g.internals.rootParentIndex);const d=l&&!Rm(u)?VC:0,{x:m,y:_,z:w}=H9(e,g,c,o,d,u),{positionAbsolute:C}=e.internals,y=m!==C.x||_!==C.y;(y||w!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:m,y:_}:C,z:w}})}function YC(e,t,n){const r=Yn(e.zIndex)?e.zIndex:0;return Rm(n)?r:r+(e.selected?t:0)}function H9(e,t,n,r,a,l){const{x:c,y:o}=t.internals.positionAbsolute,u=hi(e),f=sl(e,n),g=ts(e.extent)?es(f,e.extent,u):f;let d=es({x:c+g.x,y:o+g.y},r,u);e.extent==="parent"&&(d=LC(d,u,t));const m=YC(e,a,l),_=t.internals.z??0;return{x:d.x,y:d.y,z:_>=m?_+1:m}}function Lm(e,t,n,r=[0,0]){var c;const a=[],l=new Map;for(const o of e){const u=t.get(o.parentId);if(!u)continue;const f=((c=l.get(o.parentId))==null?void 0:c.expandedRect)??Yo(u),g=OC(f,o.rect);l.set(o.parentId,{expandedRect:g,parent:u})}return l.size>0&&l.forEach(({expandedRect:o,parent:u},f)=>{var v;const g=u.internals.positionAbsolute,d=hi(u),m=u.origin??r,_=o.x0||w>0||b||x)&&(a.push({id:f,type:"position",position:{x:u.position.x-_+b,y:u.position.y-w+x}}),(v=n.get(f))==null||v.forEach(k=>{e.some(D=>D.id===k.id)||a.push({id:k.id,type:"position",position:{x:k.position.x+_,y:k.position.y+w}})})),(d.width0){const _=Lm(m,t,n,a);f.push(..._)}return{changes:f,updatedInternals:u}}async function P9({delta:e,panZoom:t,transform:n,translateExtent:r,width:a,height:l}){if(!t||!e.x&&!e.y)return!1;const c=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[a,l]],r);return!!c&&(c.x!==n[0]||c.y!==n[1]||c.k!==n[2])}function qb(e,t,n,r,a,l){let c=a;const o=r.get(c)||new Map;r.set(c,o.set(n,t)),c=`${a}-${e}`;const u=r.get(c)||new Map;if(r.set(c,u.set(n,t)),l){c=`${a}-${e}-${l}`;const f=r.get(c)||new Map;r.set(c,f.set(n,t))}}function WC(e,t,n){e.clear(),t.clear();for(const r of n){const{source:a,target:l,sourceHandle:c=null,targetHandle:o=null}=r,u={edgeId:r.id,source:a,target:l,sourceHandle:c,targetHandle:o},f=`${a}-${c}--${l}-${o}`,g=`${l}-${o}--${a}-${c}`;qb("source",u,g,e,a,c),qb("target",u,f,e,l,o),t.set(r.id,r)}}function XC(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:XC(n,t):!1}function Vb(e,t,n){var a;let r=e;do{if((a=r==null?void 0:r.matches)!=null&&a.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function U9(e,t,n,r){const a=new Map;for(const[l,c]of e)if((c.selected||c.id===r)&&(!c.parentId||!XC(c,e))&&(c.draggable||t&&typeof c.draggable>"u")){const o=e.get(l);o&&a.set(l,{id:l,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.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 a}function hp({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var c,o,u;const a=[];for(const[f,g]of t){const d=(c=n.get(f))==null?void 0:c.internals.userNode;d&&a.push({...d,position:g.position,dragging:r})}if(!e)return[a[0],a];const l=(o=n.get(e))==null?void 0:o.internals.userNode;return[l?{...l,position:((u=t.get(e))==null?void 0:u.position)||l.position,dragging:r}:a[0],a]}function $9({dragItems:e,snapGrid:t,x:n,y:r}){const a=e.values().next().value;if(!a)return null;const l={x:n-a.distance.x,y:r-a.distance.y},c=ol(l,t);return{x:c.x-l.x,y:c.y-l.y}}function G9({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:a}){let l={x:null,y:null},c=0,o=new Map,u=!1,f={x:0,y:0},g=null,d=!1,m=null,_=!1,w=!1,C=null;function y({noDragClassName:x,handleSelector:v,domNode:k,isSelectable:D,nodeId:T,nodeClickDistance:R=0}){m=En(k);function N({x:V,y:H}){const{nodeLookup:z,nodeExtent:q,snapGrid:G,snapToGrid:X,nodeOrigin:K,onNodeDrag:O,onSelectionDrag:M,onError:j,updateNodePositions:$}=t();l={x:V,y:H};let U=!1;const Q=o.size>1,ie=Q&&q?ig(al(o)):null,se=Q&&X?$9({dragItems:o,snapGrid:G,x:V,y:H}):null;for(const[Z,P]of o){if(!z.has(Z))continue;let ee={x:V-P.distance.x,y:H-P.distance.y};X&&(ee=se?{x:Math.round(ee.x+se.x),y:Math.round(ee.y+se.y)}:ol(ee,G));let te=null;if(Q&&q&&!P.extent&&ie){const{positionAbsolute:me}=P.internals,we=me.x-ie.x+q[0][0],le=me.x+P.measured.width-ie.x2+q[1][0],ye=me.y-ie.y+q[0][1],be=me.y+P.measured.height-ie.y2+q[1][1];te=[[we,ye],[le,be]]}const{position:pe,positionAbsolute:ue}=MC({nodeId:Z,nextPosition:ee,nodeLookup:z,nodeExtent:te||q,nodeOrigin:K,onError:j});U=U||P.position.x!==pe.x||P.position.y!==pe.y,P.position=pe,P.internals.positionAbsolute=ue}if(w=w||U,!!U&&($(o,!0),C&&(r||O||!T&&M))){const[Z,P]=hp({nodeId:T,dragItems:o,nodeLookup:z});r==null||r(C,o,Z,P),O==null||O(C,Z,P),T||M==null||M(C,P)}}async function L(){if(!g)return;const{transform:V,panBy:H,autoPanSpeed:z,autoPanOnNodeDrag:q}=t();if(!q){u=!1,cancelAnimationFrame(c);return}const[G,X]=km(f,g,z);(G!==0||X!==0)&&(l.x=(l.x??0)-G/V[2],l.y=(l.y??0)-X/V[2],await H({x:G,y:X})&&N(l)),c=requestAnimationFrame(L)}function I(V){var Q;const{nodeLookup:H,multiSelectionActive:z,nodesDraggable:q,transform:G,snapGrid:X,snapToGrid:K,selectNodesOnDrag:O,onNodeDragStart:M,onSelectionDragStart:j,unselectNodesAndEdges:$}=t();d=!0,(!O||!D)&&!z&&T&&((Q=H.get(T))!=null&&Q.selected||$()),D&&O&&T&&(e==null||e(T));const U=Do(V.sourceEvent,{transform:G,snapGrid:X,snapToGrid:K,containerBounds:g});if(l=U,o=U9(H,q,U,T),o.size>0&&(n||M||!T&&j)){const[ie,se]=hp({nodeId:T,dragItems:o,nodeLookup:H});n==null||n(V.sourceEvent,o,ie,se),M==null||M(V.sourceEvent,ie,se),T||j==null||j(V.sourceEvent,se)}}const F=hC().clickDistance(R).on("start",V=>{const{domNode:H,nodeDragThreshold:z,transform:q,snapGrid:G,snapToGrid:X}=t();g=(H==null?void 0:H.getBoundingClientRect())||null,_=!1,w=!1,C=V.sourceEvent,z===0&&I(V),l=Do(V.sourceEvent,{transform:q,snapGrid:G,snapToGrid:X,containerBounds:g}),f=Wn(V.sourceEvent,g)}).on("drag",V=>{const{autoPanOnNodeDrag:H,transform:z,snapGrid:q,snapToGrid:G,nodeDragThreshold:X,nodeLookup:K}=t(),O=Do(V.sourceEvent,{transform:z,snapGrid:q,snapToGrid:G,containerBounds:g});if(C=V.sourceEvent,(V.sourceEvent.type==="touchmove"&&V.sourceEvent.touches.length>1||T&&!K.has(T))&&(_=!0),!_){if(!u&&H&&d&&(u=!0,L()),!d){const M=Wn(V.sourceEvent,g),j=M.x-f.x,$=M.y-f.y;Math.sqrt(j*j+$*$)>X&&I(V)}(l.x!==O.xSnapped||l.y!==O.ySnapped)&&o&&d&&(f=Wn(V.sourceEvent,g),N(O))}}).on("end",V=>{if(!d||_){_&&o.size>0&&t().updateNodePositions(o,!1);return}if(u=!1,d=!1,cancelAnimationFrame(c),o.size>0){const{nodeLookup:H,updateNodePositions:z,onNodeDragStop:q,onSelectionDragStop:G}=t();if(w&&(z(o,!1),w=!1),a||q||!T&&G){const[X,K]=hp({nodeId:T,dragItems:o,nodeLookup:H,dragging:!1});a==null||a(V.sourceEvent,o,X,K),q==null||q(V.sourceEvent,X,K),T||G==null||G(V.sourceEvent,K)}}}).filter(V=>{const H=V.target;return!V.button&&(!x||!Vb(H,`.${x}`,k))&&(!v||Vb(H,v,k))});m.call(F)}function b(){m==null||m.on(".drag",null)}return{update:y,destroy:b}}function q9(e,t,n){const r=[],a={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const l of t.values())Du(a,Yo(l))>0&&r.push(l);return r}const V9=250;function Y9(e,t,n,r){var o,u;let a=[],l=1/0;const c=q9(e,n,t+V9);for(const f of c){const g=[...((o=f.internals.handleBounds)==null?void 0:o.source)??[],...((u=f.internals.handleBounds)==null?void 0:u.target)??[]];for(const d of g){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:m,y:_}=ns(f,d,d.position,!0),w=Math.sqrt(Math.pow(m-e.x,2)+Math.pow(_-e.y,2));w>t||(w1){const f=r.type==="source"?"target":"source";return a.find(g=>g.type===f)??a[0]}return a[0]}function KC(e,t,n,r,a,l=!1){var f,g,d;const c=r.get(e);if(!c)return null;const o=a==="strict"?(f=c.internals.handleBounds)==null?void 0:f[t]:[...((g=c.internals.handleBounds)==null?void 0:g.source)??[],...((d=c.internals.handleBounds)==null?void 0:d.target)??[]],u=(n?o==null?void 0:o.find(m=>m.id===n):o==null?void 0:o[0])??null;return u&&l?{...u,...ns(c,u,u.position,!0)}:u}function ZC(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function W9(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const QC=()=>!0;function X9(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:a,edgeUpdaterType:l,isTarget:c,domNode:o,nodeLookup:u,lib:f,autoPanOnConnect:g,flowId:d,panBy:m,cancelConnection:_,onConnectStart:w,onConnect:C,onConnectEnd:y,isValidConnection:b=QC,onReconnectEnd:x,updateConnection:v,getTransform:k,getFromHandle:D,autoPanSpeed:T,dragThreshold:R=1,handleDomNode:N}){const L=HC(e.target);let I=0,F;const{x:V,y:H}=Wn(e),z=ZC(l,N),q=o==null?void 0:o.getBoundingClientRect();let G=!1;if(!q||!z)return;const X=KC(a,z,r,u,t);if(!X)return;let K=Wn(e,q),O=!1,M=null,j=!1,$=null;function U(){if(!g||!q)return;const[pe,ue]=km(K,q,T);m({x:pe,y:ue}),I=requestAnimationFrame(U)}const Q={...X,nodeId:a,type:z,position:X.position},ie=u.get(a);let Z={inProgress:!0,isValid:null,from:ns(ie,Q,Te.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:ie,to:K,toHandle:null,toPosition:Ob[Q.position],toNode:null,pointer:K};function P(){G=!0,v(Z),w==null||w(e,{nodeId:a,handleId:r,handleType:z})}R===0&&P();function ee(pe){if(!G){const{x:be,y:Be}=Wn(pe),Ve=be-V,Pe=Be-H;if(!(Ve*Ve+Pe*Pe>R*R))return;P()}if(!D()||!Q){te(pe);return}const ue=k();K=Wn(pe,q),F=Y9(ll(K,ue,!1,[1,1]),n,u,Q),O||(U(),O=!0);const me=JC(pe,{handle:F,connectionMode:t,fromNodeId:a,fromHandleId:r,fromType:c?"target":"source",isValidConnection:b,doc:L,lib:f,flowId:d,nodeLookup:u});$=me.handleDomNode,M=me.connection,j=W9(!!F,me.isValid);const we=u.get(a),le=we?ns(we,Q,Te.Left,!0):Z.from,ye={...Z,from:le,isValid:j,to:me.toHandle&&j?ca({x:me.toHandle.x,y:me.toHandle.y},ue):K,toHandle:me.toHandle,toPosition:j&&me.toHandle?me.toHandle.position:Ob[Q.position],toNode:me.toHandle?u.get(me.toHandle.nodeId):null,pointer:K};v(ye),Z=ye}function te(pe){if(!("touches"in pe&&pe.touches.length>0)){if(G){(F||$)&&M&&j&&(C==null||C(M));const{inProgress:ue,...me}=Z,we={...me,toPosition:Z.toHandle?Z.toPosition:null};y==null||y(pe,we),l&&(x==null||x(pe,we))}_(),cancelAnimationFrame(I),O=!1,j=!1,M=null,$=null,L.removeEventListener("mousemove",ee),L.removeEventListener("mouseup",te),L.removeEventListener("touchmove",ee),L.removeEventListener("touchend",te)}}L.addEventListener("mousemove",ee),L.addEventListener("mouseup",te),L.addEventListener("touchmove",ee),L.addEventListener("touchend",te)}function JC(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:a,fromType:l,doc:c,lib:o,flowId:u,isValidConnection:f=QC,nodeLookup:g}){const d=l==="target",m=t?c.querySelector(`.${o}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:_,y:w}=Wn(e),C=c.elementFromPoint(_,w),y=C!=null&&C.classList.contains(`${o}-flow__handle`)?C:m,b={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const x=ZC(void 0,y),v=y.getAttribute("data-nodeid"),k=y.getAttribute("data-handleid"),D=y.classList.contains("connectable"),T=y.classList.contains("connectableend");if(!v||!x)return b;const R={source:d?v:r,sourceHandle:d?k:a,target:d?r:v,targetHandle:d?a:k};b.connection=R;const L=D&&T&&(n===oa.Strict?d&&x==="source"||!d&&x==="target":v!==r||k!==a);b.isValid=L&&f(R),b.toHandle=KC(v,x,k,g,n,!0)}return b}const og={onPointerDown:X9,isValid:JC};function K9({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const a=En(e);function l({translateExtent:o,width:u,height:f,zoomStep:g=1,pannable:d=!0,zoomable:m=!0,inversePan:_=!1}){const w=v=>{if(v.sourceEvent.type!=="wheel"||!t)return;const k=n(),D=v.sourceEvent.ctrlKey&&Wo()?10:1,T=-v.sourceEvent.deltaY*(v.sourceEvent.deltaMode===1?.05:v.sourceEvent.deltaMode?1:.002)*g,R=k[2]*Math.pow(2,T*D);t.scaleTo(R)};let C=[0,0];const y=v=>{(v.sourceEvent.type==="mousedown"||v.sourceEvent.type==="touchstart")&&(C=[v.sourceEvent.clientX??v.sourceEvent.touches[0].clientX,v.sourceEvent.clientY??v.sourceEvent.touches[0].clientY])},b=v=>{const k=n();if(v.sourceEvent.type!=="mousemove"&&v.sourceEvent.type!=="touchmove"||!t)return;const D=[v.sourceEvent.clientX??v.sourceEvent.touches[0].clientX,v.sourceEvent.clientY??v.sourceEvent.touches[0].clientY],T=[D[0]-C[0],D[1]-C[1]];C=D;const R=r()*Math.max(k[2],Math.log(k[2]))*(_?-1:1),N={x:k[0]-T[0]*R,y:k[1]-T[1]*R},L=[[0,0],[u,f]];t.setViewportConstrained({x:N.x,y:N.y,zoom:k[2]},L,o)},x=kC().on("start",y).on("zoom",d?b:null).on("zoom.wheel",m?w:null);a.call(x,{})}function c(){a.on("zoom",null)}return{update:l,destroy:c,pointer:qn}}const gh=e=>({x:e.x,y:e.y,zoom:e.k}),fp=({x:e,y:t,zoom:n})=>fh.translate(e,t).scale(n),Js=(e,t)=>e.target.closest(`.${t}`),eE=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Z9=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,dp=(e,t=0,n=Z9,r=()=>{})=>{const a=typeof t=="number"&&t>0;return a||r(),a?e.transition().duration(t).ease(n).on("end",r):e},tE=e=>{const t=e.ctrlKey&&Wo()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Q9({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:a,panOnScrollSpeed:l,zoomOnPinch:c,onPanZoomStart:o,onPanZoom:u,onPanZoomEnd:f}){return g=>{if(Js(g,t))return g.ctrlKey&&g.preventDefault(),!1;g.preventDefault(),g.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(g.ctrlKey&&c){const y=qn(g),b=tE(g),x=d*Math.pow(2,b);r.scaleTo(n,x,y,g);return}const m=g.deltaMode===1?20:1;let _=a===Kr.Vertical?0:g.deltaX*m,w=a===Kr.Horizontal?0:g.deltaY*m;!Wo()&&g.shiftKey&&a!==Kr.Vertical&&(_=g.deltaY*m,w=0),r.translateBy(n,-(_/d)*l,-(w/d)*l,{internal:!0});const C=gh(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?u==null||u(g,C):(e.isPanScrolling=!0,o==null||o(g,C)),e.panScrollTimeout=setTimeout(()=>{f==null||f(g,C),e.isPanScrolling=!1},150)}}function J9({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,a){const l=r.type==="wheel",c=!t&&l&&!r.ctrlKey,o=Js(r,e);if(r.ctrlKey&&l&&o&&r.preventDefault(),c||o)return null;r.preventDefault(),n.call(this,r,a)}}function ez({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var l,c,o;if((l=r.sourceEvent)!=null&&l.internal)return;const a=gh(r.transform);e.mouseButton=((c=r.sourceEvent)==null?void 0:c.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,a))}}function tz({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:a}){return l=>{var c,o;e.usedRightMouseButton=!!(n&&eE(t,e.mouseButton??0)),(c=l.sourceEvent)!=null&&c.sync||r([l.transform.x,l.transform.y,l.transform.k]),a&&!((o=l.sourceEvent)!=null&&o.internal)&&(a==null||a(l.sourceEvent,gh(l.transform)))}}function nz({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:a,onPaneContextMenu:l}){return c=>{var o;if(!((o=c.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,l&&eE(t,e.mouseButton??0)&&!e.usedRightMouseButton&&c.sourceEvent&&l(c.sourceEvent),e.usedRightMouseButton=!1,r(!1),a)){const u=gh(c.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(c.sourceEvent,u)},n?150:0)}}}function iz({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:a,zoomOnDoubleClick:l,userSelectionActive:c,noWheelClassName:o,noPanClassName:u,lib:f,connectionInProgress:g}){return d=>{var y;const m=e||t,_=n&&d.ctrlKey,w=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Js(d,`${f}-flow__node`)||Js(d,`${f}-flow__edge`)))return!0;if(!r&&!m&&!a&&!l&&!n||c||g&&!w||Js(d,o)&&w||Js(d,u)&&(!w||a&&w&&!e)||!n&&d.ctrlKey&&w)return!1;if(!n&&d.type==="touchstart"&&((y=d.touches)==null?void 0:y.length)>1)return d.preventDefault(),!1;if(!m&&!a&&!_&&w||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const C=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||w)&&C}}function rz({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:a,onPanZoom:l,onPanZoomStart:c,onPanZoomEnd:o,onDraggingChange:u}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},g=e.getBoundingClientRect();let d=[[0,0],[g.width,g.height]];const m=typeof ResizeObserver<"u"?new ResizeObserver(H=>{const z=H[0];z&&(d=[[0,0],[z.contentRect.width,z.contentRect.height]])}):null;m==null||m.observe(e);const _=kC().extent(()=>d).scaleExtent([t,n]).translateExtent(r),w=En(e).call(_);k({x:a.x,y:a.y,zoom:la(a.zoom,t,n)},[[0,0],[g.width,g.height]],r);const C=w.on("wheel.zoom"),y=w.on("dblclick.zoom");_.wheelDelta(tE);async function b(H,z){return w?new Promise(q=>{_==null||_.interpolate((z==null?void 0:z.interpolate)==="linear"?No:ou).transform(dp(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>q(!0)),H)}):!1}function x({noWheelClassName:H,noPanClassName:z,onPaneContextMenu:q,userSelectionActive:G,panOnScroll:X,panOnDrag:K,panOnScrollMode:O,panOnScrollSpeed:M,preventScrolling:j,zoomOnPinch:$,zoomOnScroll:U,zoomOnDoubleClick:Q,zoomActivationKeyPressed:ie,lib:se,onTransformChange:Z,connectionInProgress:P,paneClickDistance:ee,selectionOnDrag:te}){G&&!f.isZoomingOrPanning&&v();const pe=X&&!ie&&!G;_.clickDistance(te?1/0:!Yn(ee)||ee<0?0:ee);const ue=pe?Q9({zoomPanValues:f,noWheelClassName:H,d3Selection:w,d3Zoom:_,panOnScrollMode:O,panOnScrollSpeed:M,zoomOnPinch:$,onPanZoomStart:c,onPanZoom:l,onPanZoomEnd:o}):J9({noWheelClassName:H,preventScrolling:j,d3ZoomHandler:C});w.on("wheel.zoom",ue,{passive:!1});const me=ez({zoomPanValues:f,onDraggingChange:u,onPanZoomStart:c});_.on("start",me);const we=tz({zoomPanValues:f,panOnDrag:K,onPaneContextMenu:!!q,onPanZoom:l,onTransformChange:Z});_.on("zoom",we);const le=nz({zoomPanValues:f,panOnDrag:K,panOnScroll:X,onPaneContextMenu:q,onPanZoomEnd:o,onDraggingChange:u});_.on("end",le);const ye=iz({zoomActivationKeyPressed:ie,panOnDrag:K,zoomOnScroll:U,panOnScroll:X,zoomOnDoubleClick:Q,zoomOnPinch:$,userSelectionActive:G,noPanClassName:z,noWheelClassName:H,lib:se,connectionInProgress:P});_.filter(ye),Q?w.on("dblclick.zoom",y):w.on("dblclick.zoom",null)}function v(){_.on("zoom",null)}async function k(H,z,q){const G=fp(H),X=_==null?void 0:_.constrain()(G,z,q);return X&&await b(X),X}async function D(H,z){const q=fp(H);return await b(q,z),q}function T(H){if(w){const z=fp(H),q=w.property("__zoom");(q.k!==H.zoom||q.x!==H.x||q.y!==H.y)&&(_==null||_.transform(w,z,null,{sync:!0}))}}function R(){const H=w?EC(w.node()):{x:0,y:0,k:1};return{x:H.x,y:H.y,zoom:H.k}}async function N(H,z){return w?new Promise(q=>{_==null||_.interpolate((z==null?void 0:z.interpolate)==="linear"?No:ou).scaleTo(dp(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>q(!0)),H)}):!1}async function L(H,z){return w?new Promise(q=>{_==null||_.interpolate((z==null?void 0:z.interpolate)==="linear"?No:ou).scaleBy(dp(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>q(!0)),H)}):!1}function I(H){_==null||_.scaleExtent(H)}function F(H){_==null||_.translateExtent(H)}function V(H){const z=!Yn(H)||H<0?0:H;_==null||_.clickDistance(z)}return{update:x,destroy:v,setViewport:D,setViewportConstrained:k,getViewport:R,scaleTo:N,scaleBy:L,setScaleExtent:I,setTranslateExtent:F,syncViewport:T,setClickDistance:V}}var ua;(function(e){e.Line="line",e.Handle="handle"})(ua||(ua={}));function sz({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:a,affectsY:l}){const c=e-t,o=n-r,u=[c>0?1:c<0?-1:0,o>0?1:o<0?-1:0];return c&&a&&(u[0]=u[0]*-1),o&&l&&(u[1]=u[1]*-1),u}function Yb(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),a=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:a}}function mr(e,t){return Math.max(0,t-e)}function _r(e,t){return Math.max(0,e-t)}function Xc(e,t,n){return Math.max(0,t-e,e-n)}function Wb(e,t){return e?!t:t}function az(e,t,n,r,a,l,c,o){let{affectsX:u,affectsY:f}=t;const{isHorizontal:g,isVertical:d}=t,m=g&&d,{xSnapped:_,ySnapped:w}=n,{minWidth:C,maxWidth:y,minHeight:b,maxHeight:x}=r,{x:v,y:k,width:D,height:T,aspectRatio:R}=e;let N=Math.floor(g?_-e.pointerX:0),L=Math.floor(d?w-e.pointerY:0);const I=D+(u?-N:N),F=T+(f?-L:L),V=-l[0]*D,H=-l[1]*T;let z=Xc(I,C,y),q=Xc(F,b,x);if(c){let K=0,O=0;u&&N<0?K=mr(v+N+V,c[0][0]):!u&&N>0&&(K=_r(v+I+V,c[1][0])),f&&L<0?O=mr(k+L+H,c[0][1]):!f&&L>0&&(O=_r(k+F+H,c[1][1])),z=Math.max(z,K),q=Math.max(q,O)}if(o){let K=0,O=0;u&&N>0?K=_r(v+N,o[0][0]):!u&&N<0&&(K=mr(v+I,o[1][0])),f&&L>0?O=_r(k+L,o[0][1]):!f&&L<0&&(O=mr(k+F,o[1][1])),z=Math.max(z,K),q=Math.max(q,O)}if(a){if(g){const K=Xc(I/R,b,x)*R;if(z=Math.max(z,K),c){let O=0;!u&&!f||u&&!f&&m?O=_r(k+H+I/R,c[1][1])*R:O=mr(k+H+(u?N:-N)/R,c[0][1])*R,z=Math.max(z,O)}if(o){let O=0;!u&&!f||u&&!f&&m?O=mr(k+I/R,o[1][1])*R:O=_r(k+(u?N:-N)/R,o[0][1])*R,z=Math.max(z,O)}}if(d){const K=Xc(F*R,C,y)/R;if(q=Math.max(q,K),c){let O=0;!u&&!f||f&&!u&&m?O=_r(v+F*R+V,c[1][0])/R:O=mr(v+(f?L:-L)*R+V,c[0][0])/R,q=Math.max(q,O)}if(o){let O=0;!u&&!f||f&&!u&&m?O=mr(v+F*R,o[1][0])/R:O=_r(v+(f?L:-L)*R,o[0][0])/R,q=Math.max(q,O)}}}L=L+(L<0?q:-q),N=N+(N<0?z:-z),a&&(m?I>F*R?L=(Wb(u,f)?-N:N)/R:N=(Wb(u,f)?-L:L)*R:g?(L=N/R,f=u):(N=L*R,u=f));const G=u?v+N:v,X=f?k+L:k;return{width:D+(u?-N:N),height:T+(f?-L:L),x:l[0]*N*(u?-1:1)+G,y:l[1]*L*(f?-1:1)+X}}const nE={width:0,height:0,x:0,y:0},oz={...nE,pointerX:0,pointerY:0,aspectRatio:1};function lz(e,t,n){const r=t.position.x+e.position.x,a=t.position.y+e.position.y,l=e.measured.width??0,c=e.measured.height??0,o=n[0]*l,u=n[1]*c;return[[r-o,a-u],[r+l-o,a+c-u]]}function cz({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:a}){const l=En(e);let c={controlDirection:Yb("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:f,boundaries:g,keepAspectRatio:d,resizeDirection:m,onResizeStart:_,onResize:w,onResizeEnd:C,shouldResize:y}){let b={...nE},x={...oz};c={boundaries:g,resizeDirection:m,keepAspectRatio:d,controlDirection:Yb(f)};let v,k=null,D=[],T,R,N,L=!1;const I=hC().on("start",F=>{const{nodeLookup:V,transform:H,snapGrid:z,snapToGrid:q,nodeOrigin:G,paneDomNode:X}=n();if(v=V.get(t),!v)return;k=(X==null?void 0:X.getBoundingClientRect())??null;const{xSnapped:K,ySnapped:O}=Do(F.sourceEvent,{transform:H,snapGrid:z,snapToGrid:q,containerBounds:k});b={width:v.measured.width??0,height:v.measured.height??0,x:v.position.x??0,y:v.position.y??0},x={...b,pointerX:K,pointerY:O,aspectRatio:b.width/b.height},T=void 0,R=ts(v.extent)?v.extent:void 0,v.parentId&&(v.extent==="parent"||v.expandParent)&&(T=V.get(v.parentId)),T&&v.extent==="parent"&&(R=[[0,0],[T.measured.width,T.measured.height]]),D=[],N=void 0;for(const[M,j]of V)if(j.parentId===t&&(D.push({id:M,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const $=lz(j,v,j.origin??G);N?N=[[Math.min($[0][0],N[0][0]),Math.min($[0][1],N[0][1])],[Math.max($[1][0],N[1][0]),Math.max($[1][1],N[1][1])]]:N=$}_==null||_(F,{...b})}).on("drag",F=>{const{transform:V,snapGrid:H,snapToGrid:z,nodeOrigin:q}=n(),G=Do(F.sourceEvent,{transform:V,snapGrid:H,snapToGrid:z,containerBounds:k}),X=[];if(!v)return;const{x:K,y:O,width:M,height:j}=b,$={},U=v.origin??q,{width:Q,height:ie,x:se,y:Z}=az(x,c.controlDirection,G,c.boundaries,c.keepAspectRatio,U,R,N),P=Q!==M,ee=ie!==j,te=se!==K&&P,pe=Z!==O&ⅇif(!te&&!pe&&!P&&!ee)return;if((te||pe||U[0]===1||U[1]===1)&&($.x=te?se:b.x,$.y=pe?Z:b.y,b.x=$.x,b.y=$.y,D.length>0)){const le=se-K,ye=Z-O;for(const be of D)be.position={x:be.position.x-le+U[0]*(Q-M),y:be.position.y-ye+U[1]*(ie-j)},X.push(be)}if((P||ee)&&($.width=P&&(!c.resizeDirection||c.resizeDirection==="horizontal")?Q:b.width,$.height=ee&&(!c.resizeDirection||c.resizeDirection==="vertical")?ie:b.height,b.width=$.width,b.height=$.height),T&&v.expandParent){const le=U[0]*($.width??0);$.x&&$.x{L&&(C==null||C(F,{...b}),a==null||a({...b}),L=!1)});l.call(I)}function u(){l.on(".drag",null)}return{update:o,destroy:u}}var pp={exports:{}},gp={},mp={exports:{}},_p={};/** +Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githubOwner}/${f.githubRepo}) is kept.`)){o(f.id);try{await pT(f.id),r(f.id)}catch(d){window.alert(d instanceof Error?d.message:String(d))}finally{o(null)}}}return v.jsxs("div",{className:"home",children:[v.jsxs("div",{className:"home-inner",children:[v.jsxs("div",{className:"home-brand",children:["Open",v.jsx("span",{children:"Research"})]}),v.jsxs("div",{className:"home-head",children:[v.jsx("h2",{children:"Projects"}),v.jsxs("button",{className:"btn sm",onClick:()=>l(!0),children:[v.jsx(yg,{size:13})," New project"]})]}),v.jsx("div",{className:"home-list",children:e.length===0?v.jsx("div",{className:"changes-note",children:"No projects yet — create one to get started."}):[...e].sort((f,g)=>g.updatedAt-f.updatedAt).map(f=>v.jsxs("div",{className:"project-card",role:"button",tabIndex:0,onClick:()=>t(f.id),onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&t(f.id)},children:[v.jsx("span",{className:"name",children:f.name}),v.jsxs("span",{className:"repo mono",children:[f.githubOwner,"/",f.githubRepo," · ",f.baselineBranch]}),f.paperId&&v.jsxs("span",{className:"paper mono",children:["arXiv ",f.paperId]}),v.jsxs("span",{className:"time",children:["created ",fa(f.createdAt)]}),v.jsx("button",{className:"project-delete",title:`Delete ${f.name}`,disabled:c===f.id,onClick:g=>{g.stopPropagation(),u(f)},children:v.jsx(Hu,{size:14})})]},f.id))})]}),a&&v.jsx("div",{className:"modal-backdrop",onClick:()=>l(!1),children:v.jsxs("div",{className:"modal",onClick:f=>f.stopPropagation(),children:[v.jsx("h2",{children:"New project"}),v.jsx(W8,{onCancel:()=>l(!1),onCreated:f=>{l(!1),n(f)}})]})})]})}function X8(e){const t=GS(e.backend);return t?[t,qS(e.backend)].filter(Boolean).join(" · "):"—"}function K8({runs:e,experiments:t,onOpen:n,onOpenChanges:r,onCancel:a}){const l=new Map(t.map(o=>[o.id,o.slug])),c=[...e].sort((o,u)=>u.createdAt-o.createdAt);return c.length===0?v.jsx("div",{className:"empty-state",children:v.jsx("p",{children:"No runs yet."})}):v.jsx("div",{className:"runs-table-wrap",children:v.jsxs("table",{className:"runs-table",children:[v.jsx("thead",{children:v.jsxs("tr",{children:[v.jsx("th",{children:"Run"}),v.jsx("th",{children:"Experiment"}),v.jsx("th",{children:"Status"}),v.jsx("th",{children:"Backend"}),v.jsx("th",{children:"Commit"}),v.jsx("th",{children:"Started"}),v.jsx("th",{children:"Exit"}),v.jsx("th",{})]})}),v.jsx("tbody",{children:c.map(o=>{const u=o.status==="running"||o.status==="starting";return v.jsxs("tr",{className:"clickable",onClick:()=>n(o),children:[v.jsx("td",{className:"mono",children:kp(o.id)}),v.jsx("td",{className:"mono",children:l.get(o.experimentId)??kp(o.experimentId)}),v.jsx("td",{children:v.jsx(zo,{status:o.status})}),v.jsx("td",{className:"mono",children:X8(o)}),v.jsx("td",{className:"mono",children:o.commitSha?o.commitSha.slice(0,7):"—"}),v.jsx("td",{children:fa(o.createdAt)}),v.jsx("td",{className:"mono",children:o.exitCode??"—"}),v.jsx("td",{children:v.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[v.jsx("button",{className:"icon-btn",title:"Open changes",onClick:f=>{f.stopPropagation(),r(o.experimentId)},children:v.jsx(zu,{size:14})}),u&&v.jsx("button",{className:"btn sm danger",onClick:f=>{f.stopPropagation(),a(o.id)},children:"Cancel"})]})})]},o.id)})})]})})}function Ut(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function hh(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}cu.prototype=hh.prototype={constructor:cu,on:function(e,t){var n=this._,r=Q8(e+"",n),a,l=-1,c=r.length;if(arguments.length<2){for(;++l0)for(var n=new Array(a),r=0,a,l;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),xb.hasOwnProperty(t)?{space:xb[t],local:e}:e}function eB(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===tg&&t.documentElement.namespaceURI===tg?t.createElement(e):t.createElementNS(n,e)}}function tB(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function tC(e){var t=fh(e);return(t.local?tB:eB)(t)}function nB(){}function xm(e){return e==null?nB:function(){return this.querySelector(e)}}function iB(e){typeof e!="function"&&(e=xm(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a=y&&(y=x+1);!(D=b[y])&&++y=0;)(c=r[a])&&(l&&c.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(c,l),l=c);return this}function TB(e){e||(e=NB);function t(d,m){return d&&m?e(d.__data__,m.__data__):!d-!m}for(var n=this._groups,r=n.length,a=new Array(r),l=0;lt?1:e>=t?0:NaN}function DB(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function RB(){return Array.from(this)}function MB(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?$B:typeof t=="function"?qB:GB)(e,t,n??"")):sa(this.node(),e)}function sa(e,t){return e.style.getPropertyValue(t)||aC(e).getComputedStyle(e,null).getPropertyValue(t)}function YB(e){return function(){delete this[e]}}function WB(e,t){return function(){this[e]=t}}function XB(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function KB(e,t){return arguments.length>1?this.each((t==null?YB:typeof t=="function"?XB:WB)(e,t)):this.node()[e]}function oC(e){return e.trim().split(/^|\s+/)}function wm(e){return e.classList||new lC(e)}function lC(e){this._node=e,this._names=oC(e.getAttribute("class")||"")}lC.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function cC(e,t){for(var n=wm(e),r=-1,a=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function CI(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,l;n()=>e;function ng(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:l,x:c,y:o,dx:u,dy:f,dispatch:g}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:g}})}ng.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function OI(e){return!e.ctrlKey&&!e.button}function jI(){return this.parentNode}function BI(e,t){return t??{x:e.x,y:e.y}}function II(){return navigator.maxTouchPoints||"ontouchstart"in this}function gC(){var e=OI,t=jI,n=BI,r=II,a={},l=hh("start","drag","end"),c=0,o,u,f,g,d=0;function m(k){k.on("mousedown.drag",_).filter(r).on("touchstart.drag",b).on("touchmove.drag",S,LI).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(k,D){if(!(g||!e.call(this,k,D))){var T=y(this,t.call(this,k,D),k,D,"mouse");T&&(An(k.view).on("mousemove.drag",w,$o).on("mouseup.drag",C,$o),dC(k.view),hp(k),f=!1,o=k.clientX,u=k.clientY,T("start",k))}}function w(k){if(ta(k),!f){var D=k.clientX-o,T=k.clientY-u;f=D*D+T*T>d}a.mouse("drag",k)}function C(k){An(k.view).on("mousemove.drag mouseup.drag",null),pC(k.view,f),ta(k),a.mouse("end",k)}function b(k,D){if(e.call(this,k,D)){var T=k.changedTouches,R=t.call(this,k,D),N=T.length,L,I;for(L=0;L>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Yc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Yc(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=HI.exec(e))?new mn(t[1],t[2],t[3],1):(t=FI.exec(e))?new mn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=PI.exec(e))?Yc(t[1],t[2],t[3],t[4]):(t=UI.exec(e))?Yc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=$I.exec(e))?Nb(t[1],t[2]/100,t[3]/100,1):(t=GI.exec(e))?Nb(t[1],t[2]/100,t[3]/100,t[4]):wb.hasOwnProperty(e)?kb(wb[e]):e==="transparent"?new mn(NaN,NaN,NaN,0):null}function kb(e){return new mn(e>>16&255,e>>8&255,e&255,1)}function Yc(e,t,n,r){return r<=0&&(e=t=n=NaN),new mn(e,t,n,r)}function YI(e){return e instanceof al||(e=Qr(e)),e?(e=e.rgb(),new mn(e.r,e.g,e.b,e.opacity)):new mn}function ig(e,t,n,r){return arguments.length===1?YI(e):new mn(e,t,n,r??1)}function mn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Cm(mn,ig,mC(al,{brighter(e){return e=e==null?Eu:Math.pow(Eu,e),new mn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Go:Math.pow(Go,e),new mn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new mn(Xr(this.r),Xr(this.g),Xr(this.b),ku(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:Ab,formatHex:Ab,formatHex8:WI,formatRgb:Tb,toString:Tb}));function Ab(){return`#${Yr(this.r)}${Yr(this.g)}${Yr(this.b)}`}function WI(){return`#${Yr(this.r)}${Yr(this.g)}${Yr(this.b)}${Yr((isNaN(this.opacity)?1:this.opacity)*255)}`}function Tb(){const e=ku(this.opacity);return`${e===1?"rgb(":"rgba("}${Xr(this.r)}, ${Xr(this.g)}, ${Xr(this.b)}${e===1?")":`, ${e})`}`}function ku(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Xr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Yr(e){return e=Xr(e),(e<16?"0":"")+e.toString(16)}function Nb(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Wn(e,t,n,r)}function _C(e){if(e instanceof Wn)return new Wn(e.h,e.s,e.l,e.opacity);if(e instanceof al||(e=Qr(e)),!e)return new Wn;if(e instanceof Wn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),l=Math.max(t,n,r),c=NaN,o=l-a,u=(l+a)/2;return o?(t===l?c=(n-r)/o+(n0&&u<1?0:c,new Wn(c,o,u,e.opacity)}function XI(e,t,n,r){return arguments.length===1?_C(e):new Wn(e,t,n,r??1)}function Wn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Cm(Wn,XI,mC(al,{brighter(e){return e=e==null?Eu:Math.pow(Eu,e),new Wn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Go:Math.pow(Go,e),new Wn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new mn(fp(e>=240?e-240:e+120,a,r),fp(e,a,r),fp(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Wn(Db(this.h),Wc(this.s),Wc(this.l),ku(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=ku(this.opacity);return`${e===1?"hsl(":"hsla("}${Db(this.h)}, ${Wc(this.s)*100}%, ${Wc(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Db(e){return e=(e||0)%360,e<0?e+360:e}function Wc(e){return Math.max(0,Math.min(1,e||0))}function fp(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Em=e=>()=>e;function KI(e,t){return function(n){return e+n*t}}function ZI(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function QI(e){return(e=+e)==1?vC:function(t,n){return n-t?ZI(t,n,e):Em(isNaN(t)?n:t)}}function vC(e,t){var n=t-e;return n?KI(e,n):Em(isNaN(e)?t:e)}const Au=(function e(t){var n=QI(t);function r(a,l){var c=n((a=ig(a)).r,(l=ig(l)).r),o=n(a.g,l.g),u=n(a.b,l.b),f=vC(a.opacity,l.opacity);return function(g){return a.r=c(g),a.g=o(g),a.b=u(g),a.opacity=f(g),a+""}}return r.gamma=e,r})(1);function JI(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(l){for(a=0;an&&(l=t.slice(n,l),o[c]?o[c]+=l:o[++c]=l),(r=r[0])===(a=a[0])?o[c]?o[c]+=a:o[++c]=a:(o[++c]=null,u.push({i:c,x:ai(r,a)})),n=dp.lastIndex;return n180?g+=360:g-f>180&&(f+=360),m.push({i:d.push(a(d)+"rotate(",null,r)-2,x:ai(f,g)})):g&&d.push(a(d)+"rotate("+g+r)}function o(f,g,d,m){f!==g?m.push({i:d.push(a(d)+"skewX(",null,r)-2,x:ai(f,g)}):g&&d.push(a(d)+"skewX("+g+r)}function u(f,g,d,m,_,w){if(f!==d||g!==m){var C=_.push(a(_)+"scale(",null,",",null,")");w.push({i:C-4,x:ai(f,d)},{i:C-2,x:ai(g,m)})}else(d!==1||m!==1)&&_.push(a(_)+"scale("+d+","+m+")")}return function(f,g){var d=[],m=[];return f=e(f),g=e(g),l(f.translateX,f.translateY,g.translateX,g.translateY,d,m),c(f.rotate,g.rotate,d,m),o(f.skewX,g.skewX,d,m),u(f.scaleX,f.scaleY,g.scaleX,g.scaleY,d,m),f=g=null,function(_){for(var w=-1,C=m.length,b;++w=0&&e._call.call(void 0,t),e=e._next;--aa}function Lb(){Jr=(Nu=Vo.now())+dh,aa=wo=0;try{p7()}finally{aa=0,m7(),Jr=0}}function g7(){var e=Vo.now(),t=e-Nu;t>xC&&(dh-=t,Nu=e)}function m7(){for(var e,t=Tu,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Tu=n);Co=e,ag(r)}function ag(e){if(!aa){wo&&(wo=clearTimeout(wo));var t=e-Jr;t>24?(e<1/0&&(wo=setTimeout(Lb,e-Vo.now()-dh)),So&&(So=clearInterval(So))):(So||(Nu=Vo.now(),So=setInterval(g7,xC)),aa=1,wC(Lb))}}function Ob(e,t,n){var r=new Du;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var _7=hh("start","end","cancel","interrupt"),v7=[],EC=0,jb=1,og=2,hu=3,Bb=4,lg=5,fu=6;function ph(e,t,n,r,a,l){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;y7(e,n,{name:t,index:r,group:a,on:_7,tween:v7,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:EC})}function Am(e,t){var n=Jn(e,t);if(n.state>EC)throw new Error("too late; already scheduled");return n}function hi(e,t){var n=Jn(e,t);if(n.state>hu)throw new Error("too late; already running");return n}function Jn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function y7(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=CC(l,0,n.time);function l(f){n.state=jb,n.timer.restart(c,n.delay,n.time),n.delay<=f&&c(f-n.delay)}function c(f){var g,d,m,_;if(n.state!==jb)return u();for(g in r)if(_=r[g],_.name===n.name){if(_.state===hu)return Ob(c);_.state===Bb?(_.state=fu,_.timer.stop(),_.on.call("interrupt",e,e.__data__,_.index,_.group),delete r[g]):+gog&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function X7(e,t,n){var r,a,l=W7(t)?Am:hi;return function(){var c=l(this,e),o=c.on;o!==r&&(a=(r=o).copy()).on(t,n),c.on=a}}function K7(e,t){var n=this._id;return arguments.length<2?Jn(this.node(),n).on.on(e):this.each(X7(n,e,t))}function Z7(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Q7(){return this.on("end.remove",Z7(this._id))}function J7(e){var t=this._name,n=this._id;typeof e!="function"&&(e=xm(e));for(var r=this._groups,a=r.length,l=new Array(a),c=0;c()=>e;function C9(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:a}})}function Li(e,t,n){this.k=e,this.x=t,this.y=n}Li.prototype={constructor:Li,scale:function(e){return e===1?this:new Li(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Li(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var gh=new Li(1,0,0);NC.prototype=Li.prototype;function NC(e){for(;!e.__zoom;)if(!(e=e.parentNode))return gh;return e.__zoom}function pp(e){e.stopImmediatePropagation()}function xo(e){e.preventDefault(),e.stopImmediatePropagation()}function E9(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function k9(){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 Ib(){return this.__zoom||gh}function A9(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function T9(){return navigator.maxTouchPoints||"ontouchstart"in this}function N9(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),c>l?(l+c)/2:Math.min(0,l)||Math.max(0,c))}function DC(){var e=E9,t=k9,n=N9,r=A9,a=T9,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],o=250,u=uu,f=hh("start","zoom","end"),g,d,m,_=500,w=150,C=0,b=10;function S(z){z.property("__zoom",Ib).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",I).filter(a).on("touchstart.zoom",F).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(z,q,G,X){var K=z.selection?z.selection():z;K.property("__zoom",Ib),z!==K?D(z,q,G,X):K.interrupt().each(function(){T(this,arguments).event(X).start().zoom(null,typeof q=="function"?q.apply(this,arguments):q).end()})},S.scaleBy=function(z,q,G,X){S.scaleTo(z,function(){var K=this.__zoom.k,O=typeof q=="function"?q.apply(this,arguments):q;return K*O},G,X)},S.scaleTo=function(z,q,G,X){S.transform(z,function(){var K=t.apply(this,arguments),O=this.__zoom,M=G==null?k(K):typeof G=="function"?G.apply(this,arguments):G,j=O.invert(M),$=typeof q=="function"?q.apply(this,arguments):q;return n(y(x(O,$),M,j),K,c)},G,X)},S.translateBy=function(z,q,G,X){S.transform(z,function(){return n(this.__zoom.translate(typeof q=="function"?q.apply(this,arguments):q,typeof G=="function"?G.apply(this,arguments):G),t.apply(this,arguments),c)},null,X)},S.translateTo=function(z,q,G,X,K){S.transform(z,function(){var O=t.apply(this,arguments),M=this.__zoom,j=X==null?k(O):typeof X=="function"?X.apply(this,arguments):X;return n(gh.translate(j[0],j[1]).scale(M.k).translate(typeof q=="function"?-q.apply(this,arguments):-q,typeof G=="function"?-G.apply(this,arguments):-G),O,c)},X,K)};function x(z,q){return q=Math.max(l[0],Math.min(l[1],q)),q===z.k?z:new Li(q,z.x,z.y)}function y(z,q,G){var X=q[0]-G[0]*z.k,K=q[1]-G[1]*z.k;return X===z.x&&K===z.y?z:new Li(z.k,X,K)}function k(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function D(z,q,G,X){z.on("start.zoom",function(){T(this,arguments).event(X).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(X).end()}).tween("zoom",function(){var K=this,O=arguments,M=T(K,O).event(X),j=t.apply(K,O),$=G==null?k(j):typeof G=="function"?G.apply(K,O):G,U=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),Q=K.__zoom,ie=typeof q=="function"?q.apply(K,O):q,se=u(Q.invert($).concat(U/Q.k),ie.invert($).concat(U/ie.k));return function(Z){if(Z===1)Z=ie;else{var P=se(Z),ee=U/P[2];Z=new Li(ee,$[0]-P[0]*ee,$[1]-P[1]*ee)}M.zoom(null,Z)}})}function T(z,q,G){return!G&&z.__zooming||new R(z,q)}function R(z,q){this.that=z,this.args=q,this.active=0,this.sourceEvent=null,this.extent=t.apply(z,q),this.taps=0}R.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,q){return this.mouse&&z!=="mouse"&&(this.mouse[1]=q.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=q.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=q.invert(this.touch1[0])),this.that.__zoom=q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var q=An(this.that).datum();f.call(z,this.that,new C9(z,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:f}),q)}};function N(z,...q){if(!e.apply(this,arguments))return;var G=T(this,q).event(z),X=this.__zoom,K=Math.max(l[0],Math.min(l[1],X.k*Math.pow(2,r.apply(this,arguments)))),O=Yn(z);if(G.wheel)(G.mouse[0][0]!==O[0]||G.mouse[0][1]!==O[1])&&(G.mouse[1]=X.invert(G.mouse[0]=O)),clearTimeout(G.wheel);else{if(X.k===K)return;G.mouse=[O,X.invert(O)],du(this),G.start()}xo(z),G.wheel=setTimeout(M,w),G.zoom("mouse",n(y(x(X,K),G.mouse[0],G.mouse[1]),G.extent,c));function M(){G.wheel=null,G.end()}}function L(z,...q){if(m||!e.apply(this,arguments))return;var G=z.currentTarget,X=T(this,q,!0).event(z),K=An(z.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",U,!0),O=Yn(z,G),M=z.clientX,j=z.clientY;dC(z.view),pp(z),X.mouse=[O,this.__zoom.invert(O)],du(this),X.start();function $(Q){if(xo(Q),!X.moved){var ie=Q.clientX-M,se=Q.clientY-j;X.moved=ie*ie+se*se>C}X.event(Q).zoom("mouse",n(y(X.that.__zoom,X.mouse[0]=Yn(Q,G),X.mouse[1]),X.extent,c))}function U(Q){K.on("mousemove.zoom mouseup.zoom",null),pC(Q.view,X.moved),xo(Q),X.event(Q).end()}}function I(z,...q){if(e.apply(this,arguments)){var G=this.__zoom,X=Yn(z.changedTouches?z.changedTouches[0]:z,this),K=G.invert(X),O=G.k*(z.shiftKey?.5:2),M=n(y(x(G,O),X,K),t.apply(this,q),c);xo(z),o>0?An(this).transition().duration(o).call(D,M,X,z):An(this).call(S.transform,M,X,z)}}function F(z,...q){if(e.apply(this,arguments)){var G=z.touches,X=G.length,K=T(this,q,z.changedTouches.length===X).event(z),O,M,j,$;for(pp(z),M=0;M`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:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Yo=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],RC=["Enter"," ","Escape"],MC={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var oa;(function(e){e.Strict="strict",e.Loose="loose"})(oa||(oa={}));var Kr;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Kr||(Kr={}));var Wo;(function(e){e.Partial="partial",e.Full="full"})(Wo||(Wo={}));const LC={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var vr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(vr||(vr={}));var Ru;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ru||(Ru={}));var Te;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Te||(Te={}));const zb={[Te.Left]:Te.Right,[Te.Right]:Te.Left,[Te.Top]:Te.Bottom,[Te.Bottom]:Te.Top};function OC(e){return e===null?null:e?"valid":"invalid"}const jC=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,D9=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Nm=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ol=(e,t=[0,0])=>{const{width:n,height:r}=fi(e),a=e.origin??t,l=n*a[0],c=r*a[1];return{x:e.position.x-l,y:e.position.y-c}},R9=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const l=typeof a=="string";let c=!t.nodeLookup&&!l?a:void 0;t.nodeLookup&&(c=l?t.nodeLookup.get(a):Nm(a)?a:t.nodeLookup.get(a.id));const o=c?Mu(c,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return mh(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return _h(n)},ll=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(a=>{(t.filter===void 0||t.filter(a))&&(n=mh(n,Mu(a)),r=!0)}),r?_h(n):{x:0,y:0,width:0,height:0}},Dm=(e,t,[n,r,a]=[0,0,1],l=!1,c=!1)=>{const o=(t.x-n)/a,u=(t.y-r)/a,f=t.width/a,g=t.height/a,d=[];for(const m of e.values()){const{measured:_,selectable:w=!0,hidden:C=!1}=m;if(c&&!w||C)continue;const b=_.width??m.width??m.initialWidth??0,S=_.height??m.height??m.initialHeight??0,{x,y}=m.internals.positionAbsolute,k=HC(o,u,f,g,x,y,b,S),D=b*S,T=l&&k>0;(!m.internals.handleBounds||T||k>=D||m.dragging)&&d.push(m)}return d},M9=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function L9(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{let l;if(t!=null&&t.includeHiddenNodes){const{width:c,height:o}=fi(a);l=c>0&&o>0}else l=!!(a.measured.width&&a.measured.height&&!a.hidden);l&&(!r||r.has(a.id))&&n.set(a.id,a)}),n}async function O9({nodes:e,width:t,height:n,panZoom:r,minZoom:a,maxZoom:l},c){if(e.size===0)return!0;const o=L9(e,c),u=ll(o),f=Mm(u,t,n,(c==null?void 0:c.minZoom)??a,(c==null?void 0:c.maxZoom)??l,(c==null?void 0:c.padding)??.1);return await r.setViewport(f,{duration:c==null?void 0:c.duration,ease:c==null?void 0:c.ease,interpolate:c==null?void 0:c.interpolate}),!0}function BC({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:a,onError:l}){const c=n.get(e),o=c.parentId?n.get(c.parentId):void 0,{x:u,y:f}=o?o.internals.positionAbsolute:{x:0,y:0},g=c.origin??r;let d=c.extent||a;if(c.extent==="parent"&&!c.expandParent)if(!o)l==null||l("005",Qn.error005());else{const _=o.measured.width,w=o.measured.height;_&&w&&(d=[[u,f],[u+_,f+w]])}else o&&ts(c.extent)&&(d=[[c.extent[0][0]+u,c.extent[0][1]+f],[c.extent[1][0]+u,c.extent[1][1]+f]]);const m=ts(d)?es(t,d,c.measured):t;return(c.measured.width===void 0||c.measured.height===void 0)&&(l==null||l("015",Qn.error015())),{position:{x:m.x-u+(c.measured.width??0)*g[0],y:m.y-f+(c.measured.height??0)*g[1]},positionAbsolute:m}}async function j9({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:a}){const l=new Set(e.map(m=>m.id)),c=[];for(const m of n){if(m.deletable===!1)continue;const _=l.has(m.id),w=!_&&m.parentId&&c.find(C=>C.id===m.parentId);(_||w)&&c.push(m)}const o=new Set(t.map(m=>m.id)),u=r.filter(m=>m.deletable!==!1),g=M9(c,u);for(const m of u)o.has(m.id)&&!g.find(w=>w.id===m.id)&&g.push(m);if(!a)return{edges:g,nodes:c};const d=await a({nodes:c,edges:g});return typeof d=="boolean"?d?{edges:g,nodes:c}:{edges:[],nodes:[]}:d}const la=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),es=(e={x:0,y:0},t,n)=>({x:la(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:la(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function IC(e,t,n){const{width:r,height:a}=fi(n),{x:l,y:c}=n.internals.positionAbsolute;return es(e,[[l,c],[l+r,c+a]],t)}const Hb=(e,t,n)=>en?-la(Math.abs(e-n),1,t)/t:0,Rm=(e,t,n=15,r=40)=>{const a=Hb(e.x,r,t.width-r)*n,l=Hb(e.y,r,t.height-r)*n;return[a,l]},mh=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),cg=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),_h=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Xo=(e,t=[0,0])=>{var a,l;const{x:n,y:r}=Nm(e)?e.internals.positionAbsolute:ol(e,t);return{x:n,y:r,width:((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0,height:((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0}},Mu=(e,t=[0,0])=>{var a,l;const{x:n,y:r}=Nm(e)?e.internals.positionAbsolute:ol(e,t);return{x:n,y:r,x2:n+(((a=e.measured)==null?void 0:a.width)??e.width??e.initialWidth??0),y2:r+(((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0)}},zC=(e,t)=>_h(mh(cg(e),cg(t))),HC=(e,t,n,r,a,l,c,o)=>{const u=Math.max(0,Math.min(e+n,a+c)-Math.max(e,a)),f=Math.max(0,Math.min(t+r,l+o)-Math.max(t,l));return Math.ceil(u*f)},Lu=(e,t)=>HC(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Fb=e=>Xn(e.width)&&Xn(e.height)&&Xn(e.x)&&Xn(e.y),Xn=e=>!isNaN(e)&&isFinite(e),FC=(e,t)=>(n,r)=>{},cl=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),ul=({x:e,y:t},[n,r,a],l=!1,c=[1,1])=>{const o={x:(e-n)/a,y:(t-r)/a};return l?cl(o,c):o},ca=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r});function Vs(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function B9(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Vs(e,n),a=Vs(e,t);return{top:r,right:a,bottom:r,left:a,x:a*2,y:r*2}}if(typeof e=="object"){const r=Vs(e.top??e.y??0,n),a=Vs(e.bottom??e.y??0,n),l=Vs(e.left??e.x??0,t),c=Vs(e.right??e.x??0,t);return{top:r,right:c,bottom:a,left:l,x:l+c,y:r+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function I9(e,t,n,r,a,l){const{x:c,y:o}=ca(e,[t,n,r]),{x:u,y:f}=ca({x:e.x+e.width,y:e.y+e.height},[t,n,r]),g=a-u,d=l-f;return{left:Math.floor(c),top:Math.floor(o),right:Math.floor(g),bottom:Math.floor(d)}}const Mm=(e,t,n,r,a,l)=>{const c=B9(l,t,n),o=(t-c.x)/e.width,u=(n-c.y)/e.height,f=Math.min(o,u),g=la(f,r,a),d=e.x+e.width/2,m=e.y+e.height/2,_=t/2-d*g,w=n/2-m*g,C=I9(e,_,w,g,t,n),b={left:Math.min(C.left-c.left,0),top:Math.min(C.top-c.top,0),right:Math.min(C.right-c.right,0),bottom:Math.min(C.bottom-c.bottom,0)};return{x:_-b.left+b.right,y:w-b.top+b.bottom,zoom:g}},Ko=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ts(e){return e!=null&&e!=="parent"}function fi(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function PC(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function UC(e,t={width:0,height:0},n,r,a){const l={...e},c=r.get(n);if(c){const o=c.origin||a;l.x+=c.internals.positionAbsolute.x-(t.width??0)*o[0],l.y+=c.internals.positionAbsolute.y-(t.height??0)*o[1]}return l}function Pb(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function z9(){let e,t;return{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t}}function H9(e){return{...MC,...e||{}}}function Ro(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:a}){const{x:l,y:c}=Kn(e),o=ul({x:l-((a==null?void 0:a.left)??0),y:c-((a==null?void 0:a.top)??0)},r),{x:u,y:f}=n?cl(o,t):o;return{xSnapped:u,ySnapped:f,...o}}const Lm=e=>({width:e.offsetWidth,height:e.offsetHeight}),$C=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},F9=["INPUT","SELECT","TEXTAREA"];function GC(e){var r,a;const t=((a=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:a[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:F9.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const qC=e=>"clientX"in e,Kn=(e,t)=>{var l,c;const n=qC(e),r=n?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,a=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}},Ub=(e,t,n,r,a)=>{const l=t.querySelectorAll(`.${e}`);return!l||!l.length?null:Array.from(l).map(c=>{const o=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),type:e,nodeId:a,position:c.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r,...Lm(c)}})};function VC({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:o}){const u=e*.125+a*.375+c*.375+n*.125,f=t*.125+l*.375+o*.375+r*.125,g=Math.abs(u-e),d=Math.abs(f-t);return[u,f,g,d]}function Zc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function $b({pos:e,x1:t,y1:n,x2:r,y2:a,c:l}){switch(e){case Te.Left:return[t-Zc(t-r,l),n];case Te.Right:return[t+Zc(r-t,l),n];case Te.Top:return[t,n-Zc(n-a,l)];case Te.Bottom:return[t,n+Zc(a-n,l)]}}function YC({sourceX:e,sourceY:t,sourcePosition:n=Te.Bottom,targetX:r,targetY:a,targetPosition:l=Te.Top,curvature:c=.25}){const[o,u]=$b({pos:n,x1:e,y1:t,x2:r,y2:a,c}),[f,g]=$b({pos:l,x1:r,y1:a,x2:e,y2:t,c}),[d,m,_,w]=VC({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:o,sourceControlY:u,targetControlX:f,targetControlY:g});return[`M${e},${t} C${o},${u} ${f},${g} ${r},${a}`,d,m,_,w]}function WC({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,l=n0}const $9=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,G9=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),q9=(e,t,n={})=>{var l;if(!e.source||!e.target)return(l=n.onError)==null||l.call(n,"006",Qn.error006()),t;const r=n.getEdgeId||$9;let a;return jC(e)?a={...e}:a={...e,id:r(e)},G9(a,t)?t:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,t.concat(a))};function XC({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,c,o]=WC({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,c,o]}const Gb={[Te.Left]:{x:-1,y:0},[Te.Right]:{x:1,y:0},[Te.Top]:{x:0,y:-1},[Te.Bottom]:{x:0,y:1}},V9=({source:e,sourcePosition:t=Te.Bottom,target:n})=>t===Te.Left||t===Te.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Y9({source:e,sourcePosition:t=Te.Bottom,target:n,targetPosition:r=Te.Top,center:a,offset:l,stepPosition:c}){const o=Gb[t],u=Gb[r],f={x:e.x+o.x*l,y:e.y+o.y*l},g={x:n.x+u.x*l,y:n.y+u.y*l},d=V9({source:f,sourcePosition:t,target:g}),m=d.x!==0?"x":"y",_=d[m];let w=[],C,b;const S={x:0,y:0},x={x:0,y:0},[,,y,k]=WC({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[m]*u[m]===-1){m==="x"?(C=a.x??f.x+(g.x-f.x)*c,b=a.y??(f.y+g.y)/2):(C=a.x??(f.x+g.x)/2,b=a.y??f.y+(g.y-f.y)*c);const N=[{x:C,y:f.y},{x:C,y:g.y}],L=[{x:f.x,y:b},{x:g.x,y:b}];o[m]===_?w=m==="x"?N:L:w=m==="x"?L:N}else{const N=[{x:f.x,y:g.y}],L=[{x:g.x,y:f.y}];if(m==="x"?w=o.x===_?L:N:w=o.y===_?N:L,t===r){const z=Math.abs(e[m]-n[m]);if(z<=l){const q=Math.min(l-1,l-z);o[m]===_?S[m]=(f[m]>e[m]?-1:1)*q:x[m]=(g[m]>n[m]?-1:1)*q}}if(t!==r){const z=m==="x"?"y":"x",q=o[m]===u[z],G=f[z]>g[z],X=f[z]=H?(C=(I.x+F.x)/2,b=w[0].y):(C=w[0].x,b=(I.y+F.y)/2)}const D={x:f.x+S.x,y:f.y+S.y},T={x:g.x+x.x,y:g.y+x.y};return[[e,...D.x!==w[0].x||D.y!==w[0].y?[D]:[],...w,...T.x!==w[w.length-1].x||T.y!==w[w.length-1].y?[T]:[],n],C,b,y,k]}function W9(e,t,n,r){const a=Math.min(qb(e,t)/2,qb(t,n)/2,r),{x:l,y:c}=t;if(e.x===l&&l===n.x||e.y===c&&c===n.y)return`L${l} ${c}`;if(e.y===c){const f=e.xn.id===t):e[0])||null}function hg(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function K9(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:a}){const l=new Set;return e.reduce((c,o)=>([o.markerStart||r,o.markerEnd||a].forEach(u=>{if(u&&typeof u=="object"){const f=hg(u,t);l.has(f)||(c.push({id:f,color:u.color||n,...u}),l.add(f))}}),c),[]).sort((c,o)=>c.id.localeCompare(o.id))}const KC=1e3,Z9=10,Om={nodeOrigin:[0,0],nodeExtent:Yo,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Q9={...Om,checkEquality:!0};function jm(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function J9(e,t,n){const r=jm(Om,n);for(const a of e.values())if(a.parentId)Im(a,e,t,r);else{const l=ol(a,r.nodeOrigin),c=ts(a.extent)?a.extent:r.nodeExtent,o=es(l,c,fi(a));a.internals.positionAbsolute=o}}function ez(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const a of e.handles){const l={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?n.push(l):a.type==="target"&&r.push(l)}return{source:n,target:r}}function Bm(e){return e==="manual"}function fg(e,t,n,r={}){var g,d;const a=jm(Q9,r),l={i:0},c=new Map(t),o=a!=null&&a.elevateNodesOnSelect&&!Bm(a.zIndexMode)?KC:0;let u=e.length>0,f=!1;t.clear(),n.clear();for(const m of e){let _=c.get(m.id);if(a.checkEquality&&m===(_==null?void 0:_.internals.userNode))t.set(m.id,_);else{const w=ol(m,a.nodeOrigin),C=ts(m.extent)?m.extent:a.nodeExtent,b=es(w,C,fi(m));_={...a.defaults,...m,measured:{width:(g=m.measured)==null?void 0:g.width,height:(d=m.measured)==null?void 0:d.height},internals:{positionAbsolute:b,handleBounds:ez(m,_),z:ZC(m,o,a.zIndexMode),userNode:m}},t.set(m.id,_)}(_.measured===void 0||_.measured.width===void 0||_.measured.height===void 0)&&!_.hidden&&(u=!1),m.parentId&&Im(_,t,n,r,l),f||(f=m.selected??!1)}return{nodesInitialized:u,hasSelectedNodes:f}}function tz(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Im(e,t,n,r,a){const{elevateNodesOnSelect:l,nodeOrigin:c,nodeExtent:o,zIndexMode:u}=jm(Om,r),f=e.parentId,g=t.get(f);if(!g){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}tz(e,n),a&&!g.parentId&&g.internals.rootParentIndex===void 0&&u==="auto"&&(g.internals.rootParentIndex=++a.i,g.internals.z=g.internals.z+a.i*Z9),a&&g.internals.rootParentIndex!==void 0&&(a.i=g.internals.rootParentIndex);const d=l&&!Bm(u)?KC:0,{x:m,y:_,z:w}=nz(e,g,c,o,d,u),{positionAbsolute:C}=e.internals,b=m!==C.x||_!==C.y;(b||w!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:m,y:_}:C,z:w}})}function ZC(e,t,n){const r=Xn(e.zIndex)?e.zIndex:0;return Bm(n)?r:r+(e.selected?t:0)}function nz(e,t,n,r,a,l){const{x:c,y:o}=t.internals.positionAbsolute,u=fi(e),f=ol(e,n),g=ts(e.extent)?es(f,e.extent,u):f;let d=es({x:c+g.x,y:o+g.y},r,u);e.extent==="parent"&&(d=IC(d,u,t));const m=ZC(e,a,l),_=t.internals.z??0;return{x:d.x,y:d.y,z:_>=m?_+1:m}}function zm(e,t,n,r=[0,0]){var c;const a=[],l=new Map;for(const o of e){const u=t.get(o.parentId);if(!u)continue;const f=((c=l.get(o.parentId))==null?void 0:c.expandedRect)??Xo(u),g=zC(f,o.rect);l.set(o.parentId,{expandedRect:g,parent:u})}return l.size>0&&l.forEach(({expandedRect:o,parent:u},f)=>{var y;const g=u.internals.positionAbsolute,d=fi(u),m=u.origin??r,_=o.x0||w>0||S||x)&&(a.push({id:f,type:"position",position:{x:u.position.x-_+S,y:u.position.y-w+x}}),(y=n.get(f))==null||y.forEach(k=>{e.some(D=>D.id===k.id)||a.push({id:k.id,type:"position",position:{x:k.position.x+_,y:k.position.y+w}})})),(d.width0){const _=zm(m,t,n,a);f.push(..._)}return{changes:f,updatedInternals:u}}async function rz({delta:e,panZoom:t,transform:n,translateExtent:r,width:a,height:l}){if(!t||!e.x&&!e.y)return!1;const c=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[a,l]],r);return!!c&&(c.x!==n[0]||c.y!==n[1]||c.k!==n[2])}function Xb(e,t,n,r,a,l){let c=a;const o=r.get(c)||new Map;r.set(c,o.set(n,t)),c=`${a}-${e}`;const u=r.get(c)||new Map;if(r.set(c,u.set(n,t)),l){c=`${a}-${e}-${l}`;const f=r.get(c)||new Map;r.set(c,f.set(n,t))}}function QC(e,t,n){e.clear(),t.clear();for(const r of n){const{source:a,target:l,sourceHandle:c=null,targetHandle:o=null}=r,u={edgeId:r.id,source:a,target:l,sourceHandle:c,targetHandle:o},f=`${a}-${c}--${l}-${o}`,g=`${l}-${o}--${a}-${c}`;Xb("source",u,g,e,a,c),Xb("target",u,f,e,l,o),t.set(r.id,r)}}function JC(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:JC(n,t):!1}function Kb(e,t,n){var a;let r=e;do{if((a=r==null?void 0:r.matches)!=null&&a.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function sz(e,t,n,r){const a=new Map;for(const[l,c]of e)if((c.selected||c.id===r)&&(!c.parentId||!JC(c,e))&&(c.draggable||t&&typeof c.draggable>"u")){const o=e.get(l);o&&a.set(l,{id:l,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.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 a}function gp({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var c,o,u;const a=[];for(const[f,g]of t){const d=(c=n.get(f))==null?void 0:c.internals.userNode;d&&a.push({...d,position:g.position,dragging:r})}if(!e)return[a[0],a];const l=(o=n.get(e))==null?void 0:o.internals.userNode;return[l?{...l,position:((u=t.get(e))==null?void 0:u.position)||l.position,dragging:r}:a[0],a]}function az({dragItems:e,snapGrid:t,x:n,y:r}){const a=e.values().next().value;if(!a)return null;const l={x:n-a.distance.x,y:r-a.distance.y},c=cl(l,t);return{x:c.x-l.x,y:c.y-l.y}}function oz({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:a}){let l={x:null,y:null},c=0,o=new Map,u=!1,f={x:0,y:0},g=null,d=!1,m=null,_=!1,w=!1,C=null;function b({noDragClassName:x,handleSelector:y,domNode:k,isSelectable:D,nodeId:T,nodeClickDistance:R=0}){m=An(k);function N({x:V,y:H}){const{nodeLookup:z,nodeExtent:q,snapGrid:G,snapToGrid:X,nodeOrigin:K,onNodeDrag:O,onSelectionDrag:M,onError:j,updateNodePositions:$}=t();l={x:V,y:H};let U=!1;const Q=o.size>1,ie=Q&&q?cg(ll(o)):null,se=Q&&X?az({dragItems:o,snapGrid:G,x:V,y:H}):null;for(const[Z,P]of o){if(!z.has(Z))continue;let ee={x:V-P.distance.x,y:H-P.distance.y};X&&(ee=se?{x:Math.round(ee.x+se.x),y:Math.round(ee.y+se.y)}:cl(ee,G));let te=null;if(Q&&q&&!P.extent&&ie){const{positionAbsolute:me}=P.internals,we=me.x-ie.x+q[0][0],le=me.x+P.measured.width-ie.x2+q[1][0],ye=me.y-ie.y+q[0][1],be=me.y+P.measured.height-ie.y2+q[1][1];te=[[we,ye],[le,be]]}const{position:pe,positionAbsolute:ue}=BC({nodeId:Z,nextPosition:ee,nodeLookup:z,nodeExtent:te||q,nodeOrigin:K,onError:j});U=U||P.position.x!==pe.x||P.position.y!==pe.y,P.position=pe,P.internals.positionAbsolute=ue}if(w=w||U,!!U&&($(o,!0),C&&(r||O||!T&&M))){const[Z,P]=gp({nodeId:T,dragItems:o,nodeLookup:z});r==null||r(C,o,Z,P),O==null||O(C,Z,P),T||M==null||M(C,P)}}async function L(){if(!g)return;const{transform:V,panBy:H,autoPanSpeed:z,autoPanOnNodeDrag:q}=t();if(!q){u=!1,cancelAnimationFrame(c);return}const[G,X]=Rm(f,g,z);(G!==0||X!==0)&&(l.x=(l.x??0)-G/V[2],l.y=(l.y??0)-X/V[2],await H({x:G,y:X})&&N(l)),c=requestAnimationFrame(L)}function I(V){var Q;const{nodeLookup:H,multiSelectionActive:z,nodesDraggable:q,transform:G,snapGrid:X,snapToGrid:K,selectNodesOnDrag:O,onNodeDragStart:M,onSelectionDragStart:j,unselectNodesAndEdges:$}=t();d=!0,(!O||!D)&&!z&&T&&((Q=H.get(T))!=null&&Q.selected||$()),D&&O&&T&&(e==null||e(T));const U=Ro(V.sourceEvent,{transform:G,snapGrid:X,snapToGrid:K,containerBounds:g});if(l=U,o=sz(H,q,U,T),o.size>0&&(n||M||!T&&j)){const[ie,se]=gp({nodeId:T,dragItems:o,nodeLookup:H});n==null||n(V.sourceEvent,o,ie,se),M==null||M(V.sourceEvent,ie,se),T||j==null||j(V.sourceEvent,se)}}const F=gC().clickDistance(R).on("start",V=>{const{domNode:H,nodeDragThreshold:z,transform:q,snapGrid:G,snapToGrid:X}=t();g=(H==null?void 0:H.getBoundingClientRect())||null,_=!1,w=!1,C=V.sourceEvent,z===0&&I(V),l=Ro(V.sourceEvent,{transform:q,snapGrid:G,snapToGrid:X,containerBounds:g}),f=Kn(V.sourceEvent,g)}).on("drag",V=>{const{autoPanOnNodeDrag:H,transform:z,snapGrid:q,snapToGrid:G,nodeDragThreshold:X,nodeLookup:K}=t(),O=Ro(V.sourceEvent,{transform:z,snapGrid:q,snapToGrid:G,containerBounds:g});if(C=V.sourceEvent,(V.sourceEvent.type==="touchmove"&&V.sourceEvent.touches.length>1||T&&!K.has(T))&&(_=!0),!_){if(!u&&H&&d&&(u=!0,L()),!d){const M=Kn(V.sourceEvent,g),j=M.x-f.x,$=M.y-f.y;Math.sqrt(j*j+$*$)>X&&I(V)}(l.x!==O.xSnapped||l.y!==O.ySnapped)&&o&&d&&(f=Kn(V.sourceEvent,g),N(O))}}).on("end",V=>{if(!d||_){_&&o.size>0&&t().updateNodePositions(o,!1);return}if(u=!1,d=!1,cancelAnimationFrame(c),o.size>0){const{nodeLookup:H,updateNodePositions:z,onNodeDragStop:q,onSelectionDragStop:G}=t();if(w&&(z(o,!1),w=!1),a||q||!T&&G){const[X,K]=gp({nodeId:T,dragItems:o,nodeLookup:H,dragging:!1});a==null||a(V.sourceEvent,o,X,K),q==null||q(V.sourceEvent,X,K),T||G==null||G(V.sourceEvent,K)}}}).filter(V=>{const H=V.target;return!V.button&&(!x||!Kb(H,`.${x}`,k))&&(!y||Kb(H,y,k))});m.call(F)}function S(){m==null||m.on(".drag",null)}return{update:b,destroy:S}}function lz(e,t,n){const r=[],a={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const l of t.values())Lu(a,Xo(l))>0&&r.push(l);return r}const cz=250;function uz(e,t,n,r){var o,u;let a=[],l=1/0;const c=lz(e,n,t+cz);for(const f of c){const g=[...((o=f.internals.handleBounds)==null?void 0:o.source)??[],...((u=f.internals.handleBounds)==null?void 0:u.target)??[]];for(const d of g){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:m,y:_}=ns(f,d,d.position,!0),w=Math.sqrt(Math.pow(m-e.x,2)+Math.pow(_-e.y,2));w>t||(w1){const f=r.type==="source"?"target":"source";return a.find(g=>g.type===f)??a[0]}return a[0]}function eE(e,t,n,r,a,l=!1){var f,g,d;const c=r.get(e);if(!c)return null;const o=a==="strict"?(f=c.internals.handleBounds)==null?void 0:f[t]:[...((g=c.internals.handleBounds)==null?void 0:g.source)??[],...((d=c.internals.handleBounds)==null?void 0:d.target)??[]],u=(n?o==null?void 0:o.find(m=>m.id===n):o==null?void 0:o[0])??null;return u&&l?{...u,...ns(c,u,u.position,!0)}:u}function tE(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function hz(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const nE=()=>!0;function fz(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:a,edgeUpdaterType:l,isTarget:c,domNode:o,nodeLookup:u,lib:f,autoPanOnConnect:g,flowId:d,panBy:m,cancelConnection:_,onConnectStart:w,onConnect:C,onConnectEnd:b,isValidConnection:S=nE,onReconnectEnd:x,updateConnection:y,getTransform:k,getFromHandle:D,autoPanSpeed:T,dragThreshold:R=1,handleDomNode:N}){const L=$C(e.target);let I=0,F;const{x:V,y:H}=Kn(e),z=tE(l,N),q=o==null?void 0:o.getBoundingClientRect();let G=!1;if(!q||!z)return;const X=eE(a,z,r,u,t);if(!X)return;let K=Kn(e,q),O=!1,M=null,j=!1,$=null;function U(){if(!g||!q)return;const[pe,ue]=Rm(K,q,T);m({x:pe,y:ue}),I=requestAnimationFrame(U)}const Q={...X,nodeId:a,type:z,position:X.position},ie=u.get(a);let Z={inProgress:!0,isValid:null,from:ns(ie,Q,Te.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:ie,to:K,toHandle:null,toPosition:zb[Q.position],toNode:null,pointer:K};function P(){G=!0,y(Z),w==null||w(e,{nodeId:a,handleId:r,handleType:z})}R===0&&P();function ee(pe){if(!G){const{x:be,y:Be}=Kn(pe),Ve=be-V,Pe=Be-H;if(!(Ve*Ve+Pe*Pe>R*R))return;P()}if(!D()||!Q){te(pe);return}const ue=k();K=Kn(pe,q),F=uz(ul(K,ue,!1,[1,1]),n,u,Q),O||(U(),O=!0);const me=iE(pe,{handle:F,connectionMode:t,fromNodeId:a,fromHandleId:r,fromType:c?"target":"source",isValidConnection:S,doc:L,lib:f,flowId:d,nodeLookup:u});$=me.handleDomNode,M=me.connection,j=hz(!!F,me.isValid);const we=u.get(a),le=we?ns(we,Q,Te.Left,!0):Z.from,ye={...Z,from:le,isValid:j,to:me.toHandle&&j?ca({x:me.toHandle.x,y:me.toHandle.y},ue):K,toHandle:me.toHandle,toPosition:j&&me.toHandle?me.toHandle.position:zb[Q.position],toNode:me.toHandle?u.get(me.toHandle.nodeId):null,pointer:K};y(ye),Z=ye}function te(pe){if(!("touches"in pe&&pe.touches.length>0)){if(G){(F||$)&&M&&j&&(C==null||C(M));const{inProgress:ue,...me}=Z,we={...me,toPosition:Z.toHandle?Z.toPosition:null};b==null||b(pe,we),l&&(x==null||x(pe,we))}_(),cancelAnimationFrame(I),O=!1,j=!1,M=null,$=null,L.removeEventListener("mousemove",ee),L.removeEventListener("mouseup",te),L.removeEventListener("touchmove",ee),L.removeEventListener("touchend",te)}}L.addEventListener("mousemove",ee),L.addEventListener("mouseup",te),L.addEventListener("touchmove",ee),L.addEventListener("touchend",te)}function iE(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:a,fromType:l,doc:c,lib:o,flowId:u,isValidConnection:f=nE,nodeLookup:g}){const d=l==="target",m=t?c.querySelector(`.${o}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:_,y:w}=Kn(e),C=c.elementFromPoint(_,w),b=C!=null&&C.classList.contains(`${o}-flow__handle`)?C:m,S={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const x=tE(void 0,b),y=b.getAttribute("data-nodeid"),k=b.getAttribute("data-handleid"),D=b.classList.contains("connectable"),T=b.classList.contains("connectableend");if(!y||!x)return S;const R={source:d?y:r,sourceHandle:d?k:a,target:d?r:y,targetHandle:d?a:k};S.connection=R;const L=D&&T&&(n===oa.Strict?d&&x==="source"||!d&&x==="target":y!==r||k!==a);S.isValid=L&&f(R),S.toHandle=eE(y,x,k,g,n,!0)}return S}const dg={onPointerDown:fz,isValid:iE};function dz({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const a=An(e);function l({translateExtent:o,width:u,height:f,zoomStep:g=1,pannable:d=!0,zoomable:m=!0,inversePan:_=!1}){const w=y=>{if(y.sourceEvent.type!=="wheel"||!t)return;const k=n(),D=y.sourceEvent.ctrlKey&&Ko()?10:1,T=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*g,R=k[2]*Math.pow(2,T*D);t.scaleTo(R)};let C=[0,0];const b=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(C=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},S=y=>{const k=n();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!t)return;const D=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],T=[D[0]-C[0],D[1]-C[1]];C=D;const R=r()*Math.max(k[2],Math.log(k[2]))*(_?-1:1),N={x:k[0]-T[0]*R,y:k[1]-T[1]*R},L=[[0,0],[u,f]];t.setViewportConstrained({x:N.x,y:N.y,zoom:k[2]},L,o)},x=DC().on("start",b).on("zoom",d?S:null).on("zoom.wheel",m?w:null);a.call(x,{})}function c(){a.on("zoom",null)}return{update:l,destroy:c,pointer:Yn}}const vh=e=>({x:e.x,y:e.y,zoom:e.k}),mp=({x:e,y:t,zoom:n})=>gh.translate(e,t).scale(n),Js=(e,t)=>e.target.closest(`.${t}`),rE=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),pz=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,_p=(e,t=0,n=pz,r=()=>{})=>{const a=typeof t=="number"&&t>0;return a||r(),a?e.transition().duration(t).ease(n).on("end",r):e},sE=e=>{const t=e.ctrlKey&&Ko()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function gz({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:a,panOnScrollSpeed:l,zoomOnPinch:c,onPanZoomStart:o,onPanZoom:u,onPanZoomEnd:f}){return g=>{if(Js(g,t))return g.ctrlKey&&g.preventDefault(),!1;g.preventDefault(),g.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(g.ctrlKey&&c){const b=Yn(g),S=sE(g),x=d*Math.pow(2,S);r.scaleTo(n,x,b,g);return}const m=g.deltaMode===1?20:1;let _=a===Kr.Vertical?0:g.deltaX*m,w=a===Kr.Horizontal?0:g.deltaY*m;!Ko()&&g.shiftKey&&a!==Kr.Vertical&&(_=g.deltaY*m,w=0),r.translateBy(n,-(_/d)*l,-(w/d)*l,{internal:!0});const C=vh(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?u==null||u(g,C):(e.isPanScrolling=!0,o==null||o(g,C)),e.panScrollTimeout=setTimeout(()=>{f==null||f(g,C),e.isPanScrolling=!1},150)}}function mz({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,a){const l=r.type==="wheel",c=!t&&l&&!r.ctrlKey,o=Js(r,e);if(r.ctrlKey&&l&&o&&r.preventDefault(),c||o)return null;r.preventDefault(),n.call(this,r,a)}}function _z({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var l,c,o;if((l=r.sourceEvent)!=null&&l.internal)return;const a=vh(r.transform);e.mouseButton=((c=r.sourceEvent)==null?void 0:c.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,a))}}function vz({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:a}){return l=>{var c,o;e.usedRightMouseButton=!!(n&&rE(t,e.mouseButton??0)),(c=l.sourceEvent)!=null&&c.sync||r([l.transform.x,l.transform.y,l.transform.k]),a&&!((o=l.sourceEvent)!=null&&o.internal)&&(a==null||a(l.sourceEvent,vh(l.transform)))}}function yz({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:a,onPaneContextMenu:l}){return c=>{var o;if(!((o=c.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,l&&rE(t,e.mouseButton??0)&&!e.usedRightMouseButton&&c.sourceEvent&&l(c.sourceEvent),e.usedRightMouseButton=!1,r(!1),a)){const u=vh(c.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a==null||a(c.sourceEvent,u)},n?150:0)}}}function bz({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:a,zoomOnDoubleClick:l,userSelectionActive:c,noWheelClassName:o,noPanClassName:u,lib:f,connectionInProgress:g}){return d=>{var b;const m=e||t,_=n&&d.ctrlKey,w=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Js(d,`${f}-flow__node`)||Js(d,`${f}-flow__edge`)))return!0;if(!r&&!m&&!a&&!l&&!n||c||g&&!w||Js(d,o)&&w||Js(d,u)&&(!w||a&&w&&!e)||!n&&d.ctrlKey&&w)return!1;if(!n&&d.type==="touchstart"&&((b=d.touches)==null?void 0:b.length)>1)return d.preventDefault(),!1;if(!m&&!a&&!_&&w||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const C=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||w)&&C}}function Sz({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:a,onPanZoom:l,onPanZoomStart:c,onPanZoomEnd:o,onDraggingChange:u}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},g=e.getBoundingClientRect();let d=[[0,0],[g.width,g.height]];const m=typeof ResizeObserver<"u"?new ResizeObserver(H=>{const z=H[0];z&&(d=[[0,0],[z.contentRect.width,z.contentRect.height]])}):null;m==null||m.observe(e);const _=DC().extent(()=>d).scaleExtent([t,n]).translateExtent(r),w=An(e).call(_);k({x:a.x,y:a.y,zoom:la(a.zoom,t,n)},[[0,0],[g.width,g.height]],r);const C=w.on("wheel.zoom"),b=w.on("dblclick.zoom");_.wheelDelta(sE);async function S(H,z){return w?new Promise(q=>{_==null||_.interpolate((z==null?void 0:z.interpolate)==="linear"?Do:uu).transform(_p(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>q(!0)),H)}):!1}function x({noWheelClassName:H,noPanClassName:z,onPaneContextMenu:q,userSelectionActive:G,panOnScroll:X,panOnDrag:K,panOnScrollMode:O,panOnScrollSpeed:M,preventScrolling:j,zoomOnPinch:$,zoomOnScroll:U,zoomOnDoubleClick:Q,zoomActivationKeyPressed:ie,lib:se,onTransformChange:Z,connectionInProgress:P,paneClickDistance:ee,selectionOnDrag:te}){G&&!f.isZoomingOrPanning&&y();const pe=X&&!ie&&!G;_.clickDistance(te?1/0:!Xn(ee)||ee<0?0:ee);const ue=pe?gz({zoomPanValues:f,noWheelClassName:H,d3Selection:w,d3Zoom:_,panOnScrollMode:O,panOnScrollSpeed:M,zoomOnPinch:$,onPanZoomStart:c,onPanZoom:l,onPanZoomEnd:o}):mz({noWheelClassName:H,preventScrolling:j,d3ZoomHandler:C});w.on("wheel.zoom",ue,{passive:!1});const me=_z({zoomPanValues:f,onDraggingChange:u,onPanZoomStart:c});_.on("start",me);const we=vz({zoomPanValues:f,panOnDrag:K,onPaneContextMenu:!!q,onPanZoom:l,onTransformChange:Z});_.on("zoom",we);const le=yz({zoomPanValues:f,panOnDrag:K,panOnScroll:X,onPaneContextMenu:q,onPanZoomEnd:o,onDraggingChange:u});_.on("end",le);const ye=bz({zoomActivationKeyPressed:ie,panOnDrag:K,zoomOnScroll:U,panOnScroll:X,zoomOnDoubleClick:Q,zoomOnPinch:$,userSelectionActive:G,noPanClassName:z,noWheelClassName:H,lib:se,connectionInProgress:P});_.filter(ye),Q?w.on("dblclick.zoom",b):w.on("dblclick.zoom",null)}function y(){_.on("zoom",null)}async function k(H,z,q){const G=mp(H),X=_==null?void 0:_.constrain()(G,z,q);return X&&await S(X),X}async function D(H,z){const q=mp(H);return await S(q,z),q}function T(H){if(w){const z=mp(H),q=w.property("__zoom");(q.k!==H.zoom||q.x!==H.x||q.y!==H.y)&&(_==null||_.transform(w,z,null,{sync:!0}))}}function R(){const H=w?NC(w.node()):{x:0,y:0,k:1};return{x:H.x,y:H.y,zoom:H.k}}async function N(H,z){return w?new Promise(q=>{_==null||_.interpolate((z==null?void 0:z.interpolate)==="linear"?Do:uu).scaleTo(_p(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>q(!0)),H)}):!1}async function L(H,z){return w?new Promise(q=>{_==null||_.interpolate((z==null?void 0:z.interpolate)==="linear"?Do:uu).scaleBy(_p(w,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>q(!0)),H)}):!1}function I(H){_==null||_.scaleExtent(H)}function F(H){_==null||_.translateExtent(H)}function V(H){const z=!Xn(H)||H<0?0:H;_==null||_.clickDistance(z)}return{update:x,destroy:y,setViewport:D,setViewportConstrained:k,getViewport:R,scaleTo:N,scaleBy:L,setScaleExtent:I,setTranslateExtent:F,syncViewport:T,setClickDistance:V}}var ua;(function(e){e.Line="line",e.Handle="handle"})(ua||(ua={}));function xz({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:a,affectsY:l}){const c=e-t,o=n-r,u=[c>0?1:c<0?-1:0,o>0?1:o<0?-1:0];return c&&a&&(u[0]=u[0]*-1),o&&l&&(u[1]=u[1]*-1),u}function Zb(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),a=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:a}}function mr(e,t){return Math.max(0,t-e)}function _r(e,t){return Math.max(0,e-t)}function Qc(e,t,n){return Math.max(0,t-e,e-n)}function Qb(e,t){return e?!t:t}function wz(e,t,n,r,a,l,c,o){let{affectsX:u,affectsY:f}=t;const{isHorizontal:g,isVertical:d}=t,m=g&&d,{xSnapped:_,ySnapped:w}=n,{minWidth:C,maxWidth:b,minHeight:S,maxHeight:x}=r,{x:y,y:k,width:D,height:T,aspectRatio:R}=e;let N=Math.floor(g?_-e.pointerX:0),L=Math.floor(d?w-e.pointerY:0);const I=D+(u?-N:N),F=T+(f?-L:L),V=-l[0]*D,H=-l[1]*T;let z=Qc(I,C,b),q=Qc(F,S,x);if(c){let K=0,O=0;u&&N<0?K=mr(y+N+V,c[0][0]):!u&&N>0&&(K=_r(y+I+V,c[1][0])),f&&L<0?O=mr(k+L+H,c[0][1]):!f&&L>0&&(O=_r(k+F+H,c[1][1])),z=Math.max(z,K),q=Math.max(q,O)}if(o){let K=0,O=0;u&&N>0?K=_r(y+N,o[0][0]):!u&&N<0&&(K=mr(y+I,o[1][0])),f&&L>0?O=_r(k+L,o[0][1]):!f&&L<0&&(O=mr(k+F,o[1][1])),z=Math.max(z,K),q=Math.max(q,O)}if(a){if(g){const K=Qc(I/R,S,x)*R;if(z=Math.max(z,K),c){let O=0;!u&&!f||u&&!f&&m?O=_r(k+H+I/R,c[1][1])*R:O=mr(k+H+(u?N:-N)/R,c[0][1])*R,z=Math.max(z,O)}if(o){let O=0;!u&&!f||u&&!f&&m?O=mr(k+I/R,o[1][1])*R:O=_r(k+(u?N:-N)/R,o[0][1])*R,z=Math.max(z,O)}}if(d){const K=Qc(F*R,C,b)/R;if(q=Math.max(q,K),c){let O=0;!u&&!f||f&&!u&&m?O=_r(y+F*R+V,c[1][0])/R:O=mr(y+(f?L:-L)*R+V,c[0][0])/R,q=Math.max(q,O)}if(o){let O=0;!u&&!f||f&&!u&&m?O=mr(y+F*R,o[1][0])/R:O=_r(y+(f?L:-L)*R,o[0][0])/R,q=Math.max(q,O)}}}L=L+(L<0?q:-q),N=N+(N<0?z:-z),a&&(m?I>F*R?L=(Qb(u,f)?-N:N)/R:N=(Qb(u,f)?-L:L)*R:g?(L=N/R,f=u):(N=L*R,u=f));const G=u?y+N:y,X=f?k+L:k;return{width:D+(u?-N:N),height:T+(f?-L:L),x:l[0]*N*(u?-1:1)+G,y:l[1]*L*(f?-1:1)+X}}const aE={width:0,height:0,x:0,y:0},Cz={...aE,pointerX:0,pointerY:0,aspectRatio:1};function Ez(e,t,n){const r=t.position.x+e.position.x,a=t.position.y+e.position.y,l=e.measured.width??0,c=e.measured.height??0,o=n[0]*l,u=n[1]*c;return[[r-o,a-u],[r+l-o,a+c-u]]}function kz({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:a}){const l=An(e);let c={controlDirection:Zb("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:f,boundaries:g,keepAspectRatio:d,resizeDirection:m,onResizeStart:_,onResize:w,onResizeEnd:C,shouldResize:b}){let S={...aE},x={...Cz};c={boundaries:g,resizeDirection:m,keepAspectRatio:d,controlDirection:Zb(f)};let y,k=null,D=[],T,R,N,L=!1;const I=gC().on("start",F=>{const{nodeLookup:V,transform:H,snapGrid:z,snapToGrid:q,nodeOrigin:G,paneDomNode:X}=n();if(y=V.get(t),!y)return;k=(X==null?void 0:X.getBoundingClientRect())??null;const{xSnapped:K,ySnapped:O}=Ro(F.sourceEvent,{transform:H,snapGrid:z,snapToGrid:q,containerBounds:k});S={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},x={...S,pointerX:K,pointerY:O,aspectRatio:S.width/S.height},T=void 0,R=ts(y.extent)?y.extent:void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(T=V.get(y.parentId)),T&&y.extent==="parent"&&(R=[[0,0],[T.measured.width,T.measured.height]]),D=[],N=void 0;for(const[M,j]of V)if(j.parentId===t&&(D.push({id:M,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const $=Ez(j,y,j.origin??G);N?N=[[Math.min($[0][0],N[0][0]),Math.min($[0][1],N[0][1])],[Math.max($[1][0],N[1][0]),Math.max($[1][1],N[1][1])]]:N=$}_==null||_(F,{...S})}).on("drag",F=>{const{transform:V,snapGrid:H,snapToGrid:z,nodeOrigin:q}=n(),G=Ro(F.sourceEvent,{transform:V,snapGrid:H,snapToGrid:z,containerBounds:k}),X=[];if(!y)return;const{x:K,y:O,width:M,height:j}=S,$={},U=y.origin??q,{width:Q,height:ie,x:se,y:Z}=wz(x,c.controlDirection,G,c.boundaries,c.keepAspectRatio,U,R,N),P=Q!==M,ee=ie!==j,te=se!==K&&P,pe=Z!==O&ⅇif(!te&&!pe&&!P&&!ee)return;if((te||pe||U[0]===1||U[1]===1)&&($.x=te?se:S.x,$.y=pe?Z:S.y,S.x=$.x,S.y=$.y,D.length>0)){const le=se-K,ye=Z-O;for(const be of D)be.position={x:be.position.x-le+U[0]*(Q-M),y:be.position.y-ye+U[1]*(ie-j)},X.push(be)}if((P||ee)&&($.width=P&&(!c.resizeDirection||c.resizeDirection==="horizontal")?Q:S.width,$.height=ee&&(!c.resizeDirection||c.resizeDirection==="vertical")?ie:S.height,S.width=$.width,S.height=$.height),T&&y.expandParent){const le=U[0]*($.width??0);$.x&&$.x{L&&(C==null||C(F,{...S}),a==null||a({...S}),L=!1)});l.call(I)}function u(){l.on(".drag",null)}return{update:o,destroy:u}}var vp={exports:{}},yp={},bp={exports:{}},Sp={};/** * @license React * use-sync-external-store-shim.production.js * @@ -328,7 +336,7 @@ Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githu * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Xb;function uz(){if(Xb)return _p;Xb=1;var e=Ko();function t(d,m){return d===m&&(d!==0||1/d===1/m)||d!==d&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,l=e.useLayoutEffect,c=e.useDebugValue;function o(d,m){var _=m(),w=r({inst:{value:_,getSnapshot:m}}),C=w[0].inst,y=w[1];return l(function(){C.value=_,C.getSnapshot=m,u(C)&&y({inst:C})},[d,_,m]),a(function(){return u(C)&&y({inst:C}),d(function(){u(C)&&y({inst:C})})},[d]),c(_),_}function u(d){var m=d.getSnapshot;d=d.value;try{var _=m();return!n(d,_)}catch{return!0}}function f(d,m){return m()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:o;return _p.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,_p}var Kb;function hz(){return Kb||(Kb=1,mp.exports=uz()),mp.exports}/** + */var Jb;function Az(){if(Jb)return Sp;Jb=1;var e=Qo();function t(d,m){return d===m&&(d!==0||1/d===1/m)||d!==d&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,l=e.useLayoutEffect,c=e.useDebugValue;function o(d,m){var _=m(),w=r({inst:{value:_,getSnapshot:m}}),C=w[0].inst,b=w[1];return l(function(){C.value=_,C.getSnapshot=m,u(C)&&b({inst:C})},[d,_,m]),a(function(){return u(C)&&b({inst:C}),d(function(){u(C)&&b({inst:C})})},[d]),c(_),_}function u(d){var m=d.getSnapshot;d=d.value;try{var _=m();return!n(d,_)}catch{return!0}}function f(d,m){return m()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:o;return Sp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Sp}var eS;function Tz(){return eS||(eS=1,bp.exports=Az()),bp.exports}/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -336,10 +344,10 @@ Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githu * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Zb;function fz(){if(Zb)return gp;Zb=1;var e=Ko(),t=hz();function n(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,l=e.useRef,c=e.useEffect,o=e.useMemo,u=e.useDebugValue;return gp.useSyncExternalStoreWithSelector=function(f,g,d,m,_){var w=l(null);if(w.current===null){var C={hasValue:!1,value:null};w.current=C}else C=w.current;w=o(function(){function b(T){if(!x){if(x=!0,v=T,T=m(T),_!==void 0&&C.hasValue){var R=C.value;if(_(R,T))return k=R}return k=T}if(R=k,r(v,T))return R;var N=m(T);return _!==void 0&&_(R,N)?(v=T,R):(v=T,k=N)}var x=!1,v,k,D=d===void 0?null:d;return[function(){return b(g())},D===null?void 0:function(){return b(D())}]},[g,d,m,_]);var y=a(f,w[0],w[1]);return c(function(){C.hasValue=!0,C.value=y},[y]),u(y),y},gp}var Qb;function dz(){return Qb||(Qb=1,pp.exports=fz()),pp.exports}var pz=dz();const gz=Lu(pz),mz={},Jb=e=>{let t;const n=new Set,r=(g,d)=>{const m=typeof g=="function"?g(t):g;if(!Object.is(m,t)){const _=t;t=d??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(w=>w(t,_))}},a=()=>t,u={setState:r,getState:a,getInitialState:()=>f,subscribe:g=>(n.add(g),()=>n.delete(g)),destroy:()=>{(mz?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=t=e(r,a,u);return u},_z=e=>e?Jb(e):Jb,{useDebugValue:vz}=Yk,{useSyncExternalStoreWithSelector:yz}=gz,bz=e=>e;function iE(e,t=bz,n){const r=yz(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return vz(r),r}const eS=(e,t)=>{const n=_z(e),r=(a,l=t)=>iE(n,a,l);return Object.assign(r,n),r},Sz=(e,t)=>e?eS(e,t):eS;function At(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}TS();const mh=W.createContext(null),xz=mh.Provider,rE=Kn.error001("react");function et(e,t){const n=W.useContext(mh);if(n===null)throw new Error(rE);return iE(n,e,t)}function xt(){const e=W.useContext(mh);if(e===null)throw new Error(rE);return W.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const tS={display:"none"},wz={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},sE="react-flow__node-desc",aE="react-flow__edge-desc",Cz="react-flow__aria-live",Ez=e=>e.ariaLiveMessage,kz=e=>e.ariaLabelConfig;function Az({rfId:e}){const t=et(Ez);return S.jsx("div",{id:`${Cz}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:wz,children:t})}function Tz({rfId:e,disableKeyboardA11y:t}){const n=et(kz);return S.jsxs(S.Fragment,{children:[S.jsx("div",{id:`${sE}-${e}`,style:tS,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),S.jsx("div",{id:`${aE}-${e}`,style:tS,children:n["edge.a11yDescription.default"]}),!t&&S.jsx(Az,{rfId:e})]})}const _h=W.forwardRef(({position:e="top-left",children:t,className:n,style:r,...a},l)=>{const c=`${e}`.split("-");return S.jsx("div",{className:Pt(["react-flow__panel",n,...c]),style:r,ref:l,...a,children:t})});_h.displayName="Panel";const nS="https://reactflow.dev?utm_source=attribution";function Nz({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:S.jsx(_h,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${nS}`,children:S.jsx("a",{href:nS,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Dz=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Kc=e=>e.id;function Rz(e,t){return At(e.selectedNodes.map(Kc),t.selectedNodes.map(Kc))&&At(e.selectedEdges.map(Kc),t.selectedEdges.map(Kc))}function Mz({onSelectionChange:e}){const t=xt(),{selectedNodes:n,selectedEdges:r}=et(Dz,Rz);return W.useEffect(()=>{const a={nodes:n,edges:r};e==null||e(a),t.getState().onSelectionChangeHandlers.forEach(l=>l(a))},[n,r,e]),null}const Lz=e=>!!e.onSelectionChangeHandlers;function Oz({onSelectionChange:e}){const t=et(Lz);return e||t?S.jsx(Mz,{onSelectionChange:e}):null}const oE=[0,0],jz={x:0,y:0,zoom:1},Bz=["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"],iS=[...Bz,"rfId"],Iz=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}),rS={translateExtent:qo,nodeOrigin:oE,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function zz(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:a,setTranslateExtent:l,setNodeExtent:c,reset:o,setDefaultNodesAndEdges:u}=et(Iz,At),f=xt();W.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{g.current=rS,o()}),[]);const g=W.useRef(rS);return W.useEffect(()=>{for(const d of iS){const m=e[d],_=g.current[d];m!==_&&(typeof e[d]>"u"||(d==="nodes"?t(m):d==="edges"?n(m):d==="minZoom"?r(m):d==="maxZoom"?a(m):d==="translateExtent"?l(m):d==="nodeExtent"?c(m):d==="ariaLabelConfig"?f.setState({ariaLabelConfig:x9(m)}):d==="fitView"?f.setState({fitViewQueued:m}):d==="fitViewOptions"?f.setState({fitViewOptions:m}):f.setState({[d]:m})))}g.current=e},iS.map(d=>e[d])),null}function sS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Hz(e){var r;const[t,n]=W.useState(e==="system"?null:e);return W.useEffect(()=>{if(e!=="system"){n(e);return}const a=sS(),l=()=>n(a!=null&&a.matches?"dark":"light");return l(),a==null||a.addEventListener("change",l),()=>{a==null||a.removeEventListener("change",l)}},[e]),t!==null?t:(r=sS())!=null&&r.matches?"dark":"light"}const aS=typeof document<"u"?document:null;function Xo(e=null,t={target:aS,actInsideInputWithModifier:!0}){const[n,r]=W.useState(!1),a=W.useRef(!1),l=W.useRef(new Set([])),[c,o]=W.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",` + */var tS;function Nz(){if(tS)return yp;tS=1;var e=Qo(),t=Tz();function n(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,l=e.useRef,c=e.useEffect,o=e.useMemo,u=e.useDebugValue;return yp.useSyncExternalStoreWithSelector=function(f,g,d,m,_){var w=l(null);if(w.current===null){var C={hasValue:!1,value:null};w.current=C}else C=w.current;w=o(function(){function S(T){if(!x){if(x=!0,y=T,T=m(T),_!==void 0&&C.hasValue){var R=C.value;if(_(R,T))return k=R}return k=T}if(R=k,r(y,T))return R;var N=m(T);return _!==void 0&&_(R,N)?(y=T,R):(y=T,k=N)}var x=!1,y,k,D=d===void 0?null:d;return[function(){return S(g())},D===null?void 0:function(){return S(D())}]},[g,d,m,_]);var b=a(f,w[0],w[1]);return c(function(){C.hasValue=!0,C.value=b},[b]),u(b),b},yp}var nS;function Dz(){return nS||(nS=1,vp.exports=Nz()),vp.exports}var Rz=Dz();const Mz=Bu(Rz),Lz={},iS=e=>{let t;const n=new Set,r=(g,d)=>{const m=typeof g=="function"?g(t):g;if(!Object.is(m,t)){const _=t;t=d??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(w=>w(t,_))}},a=()=>t,u={setState:r,getState:a,getInitialState:()=>f,subscribe:g=>(n.add(g),()=>n.delete(g)),destroy:()=>{(Lz?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=t=e(r,a,u);return u},Oz=e=>e?iS(e):iS,{useDebugValue:jz}=Zk,{useSyncExternalStoreWithSelector:Bz}=Mz,Iz=e=>e;function oE(e,t=Iz,n){const r=Bz(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return jz(r),r}const rS=(e,t)=>{const n=Oz(e),r=(a,l=t)=>oE(n,a,l);return Object.assign(r,n),r},zz=(e,t)=>e?rS(e,t):rS;function At(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}MS();const yh=Y.createContext(null),Hz=yh.Provider,lE=Qn.error001("react");function tt(e,t){const n=Y.useContext(yh);if(n===null)throw new Error(lE);return oE(n,e,t)}function wt(){const e=Y.useContext(yh);if(e===null)throw new Error(lE);return Y.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const sS={display:"none"},Fz={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},cE="react-flow__node-desc",uE="react-flow__edge-desc",Pz="react-flow__aria-live",Uz=e=>e.ariaLiveMessage,$z=e=>e.ariaLabelConfig;function Gz({rfId:e}){const t=tt(Uz);return v.jsx("div",{id:`${Pz}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Fz,children:t})}function qz({rfId:e,disableKeyboardA11y:t}){const n=tt($z);return v.jsxs(v.Fragment,{children:[v.jsx("div",{id:`${cE}-${e}`,style:sS,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),v.jsx("div",{id:`${uE}-${e}`,style:sS,children:n["edge.a11yDescription.default"]}),!t&&v.jsx(Gz,{rfId:e})]})}const bh=Y.forwardRef(({position:e="top-left",children:t,className:n,style:r,...a},l)=>{const c=`${e}`.split("-");return v.jsx("div",{className:Ut(["react-flow__panel",n,...c]),style:r,ref:l,...a,children:t})});bh.displayName="Panel";const aS="https://reactflow.dev?utm_source=attribution";function Vz({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:v.jsx(bh,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${aS}`,children:v.jsx("a",{href:aS,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Yz=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Jc=e=>e.id;function Wz(e,t){return At(e.selectedNodes.map(Jc),t.selectedNodes.map(Jc))&&At(e.selectedEdges.map(Jc),t.selectedEdges.map(Jc))}function Xz({onSelectionChange:e}){const t=wt(),{selectedNodes:n,selectedEdges:r}=tt(Yz,Wz);return Y.useEffect(()=>{const a={nodes:n,edges:r};e==null||e(a),t.getState().onSelectionChangeHandlers.forEach(l=>l(a))},[n,r,e]),null}const Kz=e=>!!e.onSelectionChangeHandlers;function Zz({onSelectionChange:e}){const t=tt(Kz);return e||t?v.jsx(Xz,{onSelectionChange:e}):null}const hE=[0,0],Qz={x:0,y:0,zoom:1},Jz=["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"],oS=[...Jz,"rfId"],eH=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}),lS={translateExtent:Yo,nodeOrigin:hE,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function tH(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:a,setTranslateExtent:l,setNodeExtent:c,reset:o,setDefaultNodesAndEdges:u}=tt(eH,At),f=wt();Y.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{g.current=lS,o()}),[]);const g=Y.useRef(lS);return Y.useEffect(()=>{for(const d of oS){const m=e[d],_=g.current[d];m!==_&&(typeof e[d]>"u"||(d==="nodes"?t(m):d==="edges"?n(m):d==="minZoom"?r(m):d==="maxZoom"?a(m):d==="translateExtent"?l(m):d==="nodeExtent"?c(m):d==="ariaLabelConfig"?f.setState({ariaLabelConfig:H9(m)}):d==="fitView"?f.setState({fitViewQueued:m}):d==="fitViewOptions"?f.setState({fitViewOptions:m}):f.setState({[d]:m})))}g.current=e},oS.map(d=>e[d])),null}function cS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function nH(e){var r;const[t,n]=Y.useState(e==="system"?null:e);return Y.useEffect(()=>{if(e!=="system"){n(e);return}const a=cS(),l=()=>n(a!=null&&a.matches?"dark":"light");return l(),a==null||a.addEventListener("change",l),()=>{a==null||a.removeEventListener("change",l)}},[e]),t!==null?t:(r=cS())!=null&&r.matches?"dark":"light"}const uS=typeof document<"u"?document:null;function Zo(e=null,t={target:uS,actInsideInputWithModifier:!0}){const[n,r]=Y.useState(!1),a=Y.useRef(!1),l=Y.useRef(new Set([])),[c,o]=Y.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",` `).replace(` `,` +`).split(` -`)),g=f.reduce((d,m)=>d.concat(...m),[]);return[f,g]}return[[],[]]},[e]);return W.useEffect(()=>{const u=(t==null?void 0:t.target)??aS,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const g=_=>{var y,b;if(a.current=_.ctrlKey||_.metaKey||_.shiftKey||_.altKey,(!a.current||a.current&&!f)&&FC(_))return!1;const C=lS(_.code,o);if(l.current.add(_[C]),oS(c,l.current,!1)){const x=((b=(y=_.composedPath)==null?void 0:y.call(_))==null?void 0:b[0])||_.target,v=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(a.current||!v)&&_.preventDefault(),r(!0)}},d=_=>{const w=lS(_.code,o);oS(c,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(_[w]),_.key==="Meta"&&l.current.clear(),a.current=!1},m=()=>{l.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",g),u==null||u.addEventListener("keyup",d),window.addEventListener("blur",m),window.addEventListener("contextmenu",m),()=>{u==null||u.removeEventListener("keydown",g),u==null||u.removeEventListener("keyup",d),window.removeEventListener("blur",m),window.removeEventListener("contextmenu",m)}}},[e,r]),n}function oS(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function lS(e,t){return t.includes(e)?"code":"key"}const Fz=()=>{const e=xt();return W.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,a,l],panZoom:c}=e.getState();return c?(await c.setViewport({x:t.x??r,y:t.y??a,zoom:t.zoom??l},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:a,minZoom:l,maxZoom:c,panZoom:o}=e.getState(),u=Am(t,r,a,l,c,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(u,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:a,snapToGrid:l,domNode:c}=e.getState();if(!c)return t;const{x:o,y:u}=c.getBoundingClientRect(),f={x:t.x-o,y:t.y-u},g=n.snapGrid??a,d=n.snapToGrid??l;return ll(f,r,d,g)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:a,y:l}=r.getBoundingClientRect(),c=ca(t,n);return{x:c.x+a,y:c.y+l}}}),[])};function lE(e,t){const n=[],r=new Map,a=[];for(const l of e)if(l.type==="add"){a.push(l);continue}else if(l.type==="remove"||l.type==="replace")r.set(l.id,[l]);else{const c=r.get(l.id);c?c.push(l):r.set(l.id,[l])}for(const l of t){const c=r.get(l.id);if(!c){n.push(l);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){n.push({...c[0].item});continue}const o={...l};for(const u of c)Pz(u,o);n.push(o)}return a.length&&a.forEach(l=>{l.index!==void 0?n.splice(l.index,0,{...l.item}):n.push({...l.item})}),n}function Pz(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Uz(e,t){return lE(e,t)}function $z(e,t){return lE(e,t)}function Vr(e,t){return{id:e,type:"select",selected:t}}function ea(e,t=new Set,n=!1){const r=[];for(const[a,l]of e){const c=t.has(a);!(l.selected===void 0&&!c)&&l.selected!==c&&(n&&(l.selected=c),r.push(Vr(l.id,c)))}return r}function cS({items:e=[],lookup:t}){var a;const n=[],r=new Map(e.map(l=>[l.id,l]));for(const[l,c]of e.entries()){const o=t.get(c.id),u=((a=o==null?void 0:o.internals)==null?void 0:a.userNode)??o;u!==void 0&&u!==c&&n.push({id:c.id,item:c,type:"replace"}),u===void 0&&n.push({item:c,type:"add",index:l})}for(const[l]of t)r.get(l)===void 0&&n.push({id:l,type:"remove"});return n}function uS(e){return{id:e.id,type:"remove"}}const Gz=BC();function qz(e,t,n={}){return T9(e,t,{...n,onError:n.onError??Gz})}const hS=e=>d9(e),Vz=e=>RC(e);function cE(e){return W.forwardRef(e)}const uE=typeof window<"u"?W.useLayoutEffect:W.useEffect;function fS(e){const[t,n]=W.useState(BigInt(0)),[r]=W.useState(()=>Yz(()=>n(a=>a+BigInt(1))));return uE(()=>{const a=r.get();a.length&&(e(a),r.reset())},[t]),r}function Yz(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const hE=W.createContext(null);function Wz({children:e}){const t=xt(),n=W.useCallback(o=>{const{nodes:u=[],setNodes:f,hasDefaultNodes:g,onNodesChange:d,nodeLookup:m,fitViewQueued:_,onNodesChangeMiddlewareMap:w}=t.getState();let C=u;for(const b of o)C=typeof b=="function"?b(C):b;let y=cS({items:C,lookup:m});for(const b of w.values())y=b(y);g&&f(C),y.length>0?d==null||d(y):_&&window.requestAnimationFrame(()=>{const{fitViewQueued:b,nodes:x,setNodes:v}=t.getState();b&&v(x)})},[]),r=fS(n),a=W.useCallback(o=>{const{edges:u=[],setEdges:f,hasDefaultEdges:g,onEdgesChange:d,edgeLookup:m}=t.getState();let _=u;for(const w of o)_=typeof w=="function"?w(_):w;g?f(_):d&&d(cS({items:_,lookup:m}))},[]),l=fS(a),c=W.useMemo(()=>({nodeQueue:r,edgeQueue:l}),[]);return S.jsx(hE.Provider,{value:c,children:e})}function Xz(){const e=W.useContext(hE);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Kz=e=>!!e.panZoom;function Om(){const e=Fz(),t=xt(),n=Xz(),r=et(Kz),a=W.useMemo(()=>{const l=d=>t.getState().nodeLookup.get(d),c=d=>{n.nodeQueue.push(d)},o=d=>{n.edgeQueue.push(d)},u=d=>{var b,x;const{nodeLookup:m,nodeOrigin:_}=t.getState(),w=hS(d)?d:m.get(d.id),C=w.parentId?zC(w.position,w.measured,w.parentId,m,_):w.position,y={...w,position:C,width:((b=w.measured)==null?void 0:b.width)??w.width,height:((x=w.measured)==null?void 0:x.height)??w.height};return Yo(y)},f=(d,m,_={replace:!1})=>{c(w=>w.map(C=>{if(C.id===d){const y=typeof m=="function"?m(C):m;return _.replace&&hS(y)?y:{...C,...y}}return C}))},g=(d,m,_={replace:!1})=>{o(w=>w.map(C=>{if(C.id===d){const y=typeof m=="function"?m(C):m;return _.replace&&Vz(y)?y:{...C,...y}}return C}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>{var m;return(m=l(d))==null?void 0:m.internals.userNode},getInternalNode:l,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(m=>({...m}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:c,setEdges:o,addNodes:d=>{const m=Array.isArray(d)?d:[d];n.nodeQueue.push(_=>[..._,...m])},addEdges:d=>{const m=Array.isArray(d)?d:[d];n.edgeQueue.push(_=>[..._,...m])},toObject:()=>{const{nodes:d=[],edges:m=[],transform:_}=t.getState(),[w,C,y]=_;return{nodes:d.map(b=>({...b})),edges:m.map(b=>({...b})),viewport:{x:w,y:C,zoom:y}}},deleteElements:async({nodes:d=[],edges:m=[]})=>{const{nodes:_,edges:w,onNodesDelete:C,onEdgesDelete:y,triggerNodeChanges:b,triggerEdgeChanges:x,onDelete:v,onBeforeDelete:k}=t.getState(),{nodes:D,edges:T}=await v9({nodesToRemove:d,edgesToRemove:m,nodes:_,edges:w,onBeforeDelete:k}),R=T.length>0,N=D.length>0;if(R){const L=T.map(uS);y==null||y(T),x(L)}if(N){const L=D.map(uS);C==null||C(D),b(L)}return(N||R)&&(v==null||v({nodes:D,edges:T})),{deletedNodes:D,deletedEdges:T}},getIntersectingNodes:(d,m=!0,_)=>{const w=Bb(d),C=w?d:u(d),y=_!==void 0;return C?(_||t.getState().nodes).filter(b=>{const x=t.getState().nodeLookup.get(b.id);if(x&&!w&&(b.id===d.id||!x.internals.positionAbsolute))return!1;const v=Yo(y?b:x),k=Du(v,C);return m&&k>0||k>=v.width*v.height||k>=C.width*C.height}):[]},isNodeIntersecting:(d,m,_=!0)=>{const C=Bb(d)?d:u(d);if(!C)return!1;const y=Du(C,m);return _&&y>0||y>=m.width*m.height||y>=C.width*C.height},updateNode:f,updateNodeData:(d,m,_={replace:!1})=>{f(d,w=>{const C=typeof m=="function"?m(w):m;return _.replace?{...w,data:C}:{...w,data:{...w.data,...C}}},_)},updateEdge:g,updateEdgeData:(d,m,_={replace:!1})=>{g(d,w=>{const C=typeof m=="function"?m(w):m;return _.replace?{...w,data:C}:{...w,data:{...w.data,...C}}},_)},getNodesBounds:d=>{const{nodeLookup:m,nodeOrigin:_}=t.getState();return p9(d,{nodeLookup:m,nodeOrigin:_})},getHandleConnections:({type:d,id:m,nodeId:_})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${_}-${d}${m?`-${m}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:d,handleId:m,nodeId:_})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${_}${d?m?`-${d}-${m}`:`-${d}`:""}`))==null?void 0:w.values())??[])},fitView:async d=>{const m=t.getState().fitViewResolver??S9();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:m}),n.nodeQueue.push(_=>[..._]),m.promise}}},[]);return W.useMemo(()=>({...a,...e,viewportInitialized:r}),[r])}const dS=e=>e.selected,Zz=typeof window<"u"?window:void 0;function Qz({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=xt(),{deleteElements:r}=Om(),a=Xo(e,{actInsideInputWithModifier:!1}),l=Xo(t,{target:Zz});W.useEffect(()=>{if(a){const{edges:c,nodes:o}=n.getState();r({nodes:o.filter(dS),edges:c.filter(dS)}),n.setState({nodesSelectionActive:!1})}},[a]),W.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])}function Jz(e){const t=xt();W.useEffect(()=>{const n=()=>{var a,l,c,o;if(!e.current||!(((l=(a=e.current).checkVisibility)==null?void 0:l.call(a))??!0))return!1;const r=Tm(e.current);(r.height===0||r.width===0)&&((o=(c=t.getState()).onError)==null||o.call(c,"004",Kn.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const vh={position:"absolute",width:"100%",height:"100%",top:0,left:0},eH=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function tH({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=Kr.Free,zoomOnDoubleClick:c=!0,panOnDrag:o=!0,defaultViewport:u,translateExtent:f,minZoom:g,maxZoom:d,zoomActivationKeyCode:m,preventScrolling:_=!0,children:w,noWheelClassName:C,noPanClassName:y,onViewportChange:b,isControlledViewport:x,paneClickDistance:v,selectionOnDrag:k}){const D=xt(),T=W.useRef(null),{userSelectionActive:R,lib:N,connectionInProgress:L}=et(eH,At),I=Xo(m),F=W.useRef();Jz(T);const V=W.useCallback(H=>{b==null||b({x:H[0],y:H[1],zoom:H[2]}),x||D.setState({transform:H})},[b,x]);return W.useEffect(()=>{if(T.current){F.current=rz({domNode:T.current,minZoom:g,maxZoom:d,translateExtent:f,viewport:u,onDraggingChange:G=>D.setState(X=>X.paneDragging===G?X:{paneDragging:G}),onPanZoomStart:(G,X)=>{const{onViewportChangeStart:K,onMoveStart:O}=D.getState();O==null||O(G,X),K==null||K(X)},onPanZoom:(G,X)=>{const{onViewportChange:K,onMove:O}=D.getState();O==null||O(G,X),K==null||K(X)},onPanZoomEnd:(G,X)=>{const{onViewportChangeEnd:K,onMoveEnd:O}=D.getState();O==null||O(G,X),K==null||K(X)}});const{x:H,y:z,zoom:q}=F.current.getViewport();return D.setState({panZoom:F.current,transform:[H,z,q],domNode:T.current.closest(".react-flow")}),()=>{var G;(G=F.current)==null||G.destroy()}}},[]),W.useEffect(()=>{var H;(H=F.current)==null||H.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:a,panOnScrollMode:l,zoomOnDoubleClick:c,panOnDrag:o,zoomActivationKeyPressed:I,preventScrolling:_,noPanClassName:y,userSelectionActive:R,noWheelClassName:C,lib:N,onTransformChange:V,connectionInProgress:L,selectionOnDrag:k,paneClickDistance:v})},[e,t,n,r,a,l,c,o,I,_,y,R,C,N,V,L,k,v]),S.jsx("div",{className:"react-flow__renderer",ref:T,style:vh,children:w})}const nH=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function iH(){const{userSelectionActive:e,userSelectionRect:t}=et(nH,At);return e&&t?S.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const vp=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},rH=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function sH({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Vo.Full,panOnDrag:r,autoPanOnSelection:a,paneClickDistance:l,selectionOnDrag:c,onSelectionStart:o,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:g,onPaneScroll:d,onPaneMouseEnter:m,onPaneMouseMove:_,onPaneMouseLeave:w,children:C}){const y=W.useRef(0),b=xt(),{userSelectionActive:x,elementsSelectable:v,dragging:k,panBy:D,autoPanSpeed:T}=et(rH,At),R=v&&(e||x),N=W.useRef(null),L=W.useRef(),I=W.useRef(new Set),F=W.useRef(new Set),V=W.useRef(!1),H=W.useRef(!1),z=W.useRef({x:0,y:0}),q=W.useRef(!1),G=P=>{if(H.current||V.current||b.getState().connection.inProgress){H.current=!1,V.current=!1;return}f==null||f(P),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},X=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}g==null||g(P)},K=d?P=>d(P):void 0,O=P=>{H.current&&(P.stopPropagation(),H.current=!1)},M=P=>{var be,Be;const{domNode:ee,transform:te}=b.getState();if(L.current=ee==null?void 0:ee.getBoundingClientRect(),!L.current)return;const pe=P.target===N.current;if(!pe&&!!P.target.closest(".nokey")||!e||!(c&&pe||t)||P.button!==0||!P.isPrimary)return;(Be=(be=P.target)==null?void 0:be.setPointerCapture)==null||Be.call(be,P.pointerId),H.current=!1;const{x:we,y:le}=Wn(P.nativeEvent,L.current),ye=ll({x:we,y:le},te);b.setState({userSelectionRect:{width:0,height:0,startX:ye.x,startY:ye.y,x:we,y:le}}),pe||(P.stopPropagation(),P.preventDefault())};function j(P,ee){const{userSelectionRect:te}=b.getState();if(!te)return;const{transform:pe,nodeLookup:ue,edgeLookup:me,connectionLookup:we,triggerNodeChanges:le,triggerEdgeChanges:ye,defaultEdgeOptions:be}=b.getState(),Be={x:te.startX,y:te.startY},{x:Ve,y:Pe}=ca(Be,pe),lt={startX:Be.x,startY:Be.y,x:Pct.id)),F.current=new Set;const tt=(be==null?void 0:be.selectable)??!0;for(const ct of I.current){const de=we.get(ct);if(de)for(const{edgeId:Se}of de.values()){const Ee=me.get(Se);Ee&&(Ee.selectable??tt)&&F.current.add(Se)}}if(!Ib(Rt,I.current)){const ct=ea(ue,I.current,!0);le(ct)}if(!Ib(gt,F.current)){const ct=ea(me,F.current);ye(ct)}b.setState({userSelectionRect:lt,userSelectionActive:!0,nodesSelectionActive:!1})}function $(){if(!a||!L.current)return;const[P,ee]=km(z.current,L.current,T);D({x:P,y:ee}).then(te=>{if(!H.current||!te){y.current=requestAnimationFrame($);return}const{x:pe,y:ue}=z.current;j(pe,ue),y.current=requestAnimationFrame($)})}const U=()=>{cancelAnimationFrame(y.current),y.current=0,q.current=!1};W.useEffect(()=>()=>U(),[]);const Q=P=>{const{userSelectionRect:ee,transform:te,resetSelectedElements:pe}=b.getState();if(!L.current||!ee)return;const{x:ue,y:me}=Wn(P.nativeEvent,L.current);z.current={x:ue,y:me};const we=ca({x:ee.startX,y:ee.startY},te);if(!H.current){const le=t?0:l;if(Math.hypot(ue-we.x,me-we.y)<=le)return;pe(),o==null||o(P)}H.current=!0,q.current||($(),q.current=!0),j(ue,me)},ie=P=>{var ee,te;if(!R){P.target===N.current&&b.getState().connection.inProgress&&(V.current=!0);return}P.button===0&&((te=(ee=P.target)==null?void 0:ee.releasePointerCapture)==null||te.call(ee,P.pointerId),!x&&P.target===N.current&&b.getState().userSelectionRect&&(G==null||G(P)),b.setState({userSelectionActive:!1,userSelectionRect:null}),H.current&&(u==null||u(P),b.setState({nodesSelectionActive:I.current.size>0})),U())},se=P=>{var ee,te;(te=(ee=P.target)==null?void 0:ee.releasePointerCapture)==null||te.call(ee,P.pointerId),U()},Z=r===!0||Array.isArray(r)&&r.includes(0);return S.jsxs("div",{className:Pt(["react-flow__pane",{draggable:Z,dragging:k,selection:e}]),onClick:R?void 0:vp(G,N),onContextMenu:vp(X,N),onWheel:vp(K,N),onPointerEnter:R?void 0:m,onPointerMove:R?Q:_,onPointerUp:ie,onPointerCancel:R?se:void 0,onPointerDownCapture:R?M:void 0,onClickCapture:R?O:void 0,onPointerLeave:w,ref:N,style:vh,children:[C,S.jsx(iH,{})]})}function lg({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:c,nodeLookup:o,onError:u}=t.getState(),f=o.get(e);if(!f){u==null||u("012",Kn.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&c)&&(l({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var g;return(g=r==null?void 0:r.current)==null?void 0:g.blur()})):a([e])}function fE({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:l,nodeClickDistance:c}){const o=xt(),[u,f]=W.useState(!1),g=W.useRef();return W.useEffect(()=>{if(!t)return g.current=G9({getStoreItems:()=>o.getState(),onNodeMouseDown:d=>{lg({id:d,store:o,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}}),()=>{var d;(d=g.current)==null||d.destroy(),g.current=void 0}},[t,o,e]),W.useEffect(()=>{t||!e.current||!g.current||g.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:l,nodeId:a,nodeClickDistance:c})},[n,r,t,l,e,a,c]),u}const aH=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function dE(){const e=xt();return W.useCallback(n=>{const{nodeExtent:r,snapToGrid:a,snapGrid:l,nodesDraggable:c,onError:o,updateNodePositions:u,nodeLookup:f,nodeOrigin:g}=e.getState(),d=new Map,m=aH(c),_=a?l[0]:5,w=a?l[1]:5,C=n.direction.x*_*n.factor,y=n.direction.y*w*n.factor;for(const[,b]of f){if(!m(b))continue;let x={x:b.internals.positionAbsolute.x+C,y:b.internals.positionAbsolute.y+y};a&&(x=ol(x,l));const{position:v,positionAbsolute:k}=MC({nodeId:b.id,nextPosition:x,nodeLookup:f,nodeExtent:r,nodeOrigin:g,onError:o});b.position=v,b.internals.positionAbsolute=k,d.set(b.id,b)}u(d)},[])}const jm=W.createContext(null),oH=jm.Provider;jm.Consumer;const pE=()=>W.useContext(jm),lH=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),gE=W.createContext(null);function cH({children:e}){const t=et(lH,At);return S.jsx(gE.Provider,{value:t,children:e})}function uH(){const e=W.useContext(gE);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const hH={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},fH=(e,t,n)=>r=>{const{connectionClickStartHandle:a,connectionMode:l,connection:c}=r,{fromHandle:o,toHandle:u,isValid:f}=c;if(!o&&!a)return hH;const g=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:g,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,isPossibleEndHandle:l===oa.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!a,valid:g&&f}};function dH({type:e="source",position:t=Te.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:c,onConnect:o,children:u,className:f,onMouseDown:g,onTouchStart:d,...m},_){var q,G;const w=c||null,C=e==="target",y=xt(),b=pE(),{connectOnClick:x,noPanClassName:v,rfId:k}=uH(),{connectingFrom:D,connectingTo:T,clickConnecting:R,isPossibleEndHandle:N,connectionInProcess:L,clickConnectionInProcess:I,valid:F}=et(fH(b,w,e),At);b||(G=(q=y.getState()).onError)==null||G.call(q,"010",Kn.error010());const V=X=>{const{defaultEdgeOptions:K,onConnect:O,hasDefaultEdges:M}=y.getState(),j={...K,...X};if(M){const{edges:$,setEdges:U,onError:Q}=y.getState();U(qz(j,$,{onError:Q}))}O==null||O(j),o==null||o(j)},H=X=>{if(!b)return;const K=PC(X.nativeEvent);if(a&&(K&&X.button===0||!K)){const O=y.getState();og.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:C,handleId:w,nodeId:b,flowId:O.rfId,panBy:O.panBy,cancelConnection:O.cancelConnection,onConnectStart:O.onConnectStart,onConnectEnd:(...M)=>{var j,$;return($=(j=y.getState()).onConnectEnd)==null?void 0:$.call(j,...M)},updateConnection:O.updateConnection,onConnect:V,isValidConnection:n||((...M)=>{var j,$;return(($=(j=y.getState()).isValidConnection)==null?void 0:$.call(j,...M))??!0}),getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,autoPanSpeed:O.autoPanSpeed,dragThreshold:O.connectionDragThreshold})}K?g==null||g(X):d==null||d(X)},z=X=>{const{onClickConnectStart:K,onClickConnectEnd:O,connectionClickStartHandle:M,connectionMode:j,isValidConnection:$,lib:U,rfId:Q,nodeLookup:ie,connection:se}=y.getState();if(!b||!M&&!a)return;if(!M){K==null||K(X.nativeEvent,{nodeId:b,handleId:w,handleType:e}),y.setState({connectionClickStartHandle:{nodeId:b,type:e,id:w}});return}const Z=HC(X.target),P=n||$,{connection:ee,isValid:te}=og.isValid(X.nativeEvent,{handle:{nodeId:b,id:w,type:e},connectionMode:j,fromNodeId:M.nodeId,fromHandleId:M.id||null,fromType:M.type,isValidConnection:P,flowId:Q,doc:Z,lib:U,nodeLookup:ie});te&&ee&&V(ee);const pe=structuredClone(se);delete pe.inProgress,pe.toPosition=pe.toHandle?pe.toHandle.position:null,O==null||O(X,pe),y.setState({connectionClickStartHandle:null})};return S.jsx("div",{"data-handleid":w,"data-nodeid":b,"data-handlepos":t,"data-id":`${k}-${b}-${w}-${e}`,className:Pt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",v,f,{source:!C,target:C,connectable:r,connectablestart:a,connectableend:l,clickconnecting:R,connectingfrom:D,connectingto:T,valid:F,connectionindicator:r&&(!L||N)&&(L||I?l:a)}]),onMouseDown:H,onTouchStart:H,onClick:x?z:void 0,ref:_,...m,children:u})}const ha=W.memo(cE(dH));function pH({data:e,isConnectable:t,sourcePosition:n=Te.Bottom}){return S.jsxs(S.Fragment,{children:[e==null?void 0:e.label,S.jsx(ha,{type:"source",position:n,isConnectable:t})]})}function gH({data:e,isConnectable:t,targetPosition:n=Te.Top,sourcePosition:r=Te.Bottom}){return S.jsxs(S.Fragment,{children:[S.jsx(ha,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,S.jsx(ha,{type:"source",position:r,isConnectable:t})]})}function mH(){return null}function _H({data:e,isConnectable:t,targetPosition:n=Te.Top}){return S.jsxs(S.Fragment,{children:[S.jsx(ha,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Ru={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},pS={input:pH,default:gH,output:_H,group:mH};function vH(e){var t,n,r,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const yH=e=>{const{width:t,height:n,x:r,y:a}=al(e.nodeLookup,{filter:l=>!!l.selected});return{width:Yn(t)?t:null,height:Yn(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${a}px)`}};function bH({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=xt(),{width:a,height:l,transformString:c,userSelectionActive:o}=et(yH,At),u=dE(),f=W.useRef(null);W.useEffect(()=>{var _;n||(_=f.current)==null||_.focus({preventScroll:!0})},[n]);const g=!o&&a!==null&&l!==null;if(fE({nodeRef:f,disabled:!g}),!g)return null;const d=e?_=>{const w=r.getState().nodes.filter(C=>C.selected);e(_,w)}:void 0,m=_=>{Object.prototype.hasOwnProperty.call(Ru,_.key)&&(_.preventDefault(),u({direction:Ru[_.key],factor:_.shiftKey?4:1}))};return S.jsx("div",{className:Pt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c},children:S.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m,style:{width:a,height:l}})})}const gS=typeof window<"u"?window:void 0,SH=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function mE({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,paneClickDistance:o,deleteKeyCode:u,selectionKeyCode:f,selectionOnDrag:g,selectionMode:d,onSelectionStart:m,onSelectionEnd:_,multiSelectionKeyCode:w,panActivationKeyCode:C,zoomActivationKeyCode:y,elementsSelectable:b,zoomOnScroll:x,zoomOnPinch:v,panOnScroll:k,panOnScrollSpeed:D,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:N,autoPanOnSelection:L,defaultViewport:I,translateExtent:F,minZoom:V,maxZoom:H,preventScrolling:z,onSelectionContextMenu:q,noWheelClassName:G,noPanClassName:X,disableKeyboardA11y:K,onViewportChange:O,isControlledViewport:M}){const{nodesSelectionActive:j,userSelectionActive:$}=et(SH,At),U=Xo(f,{target:gS}),Q=Xo(C,{target:gS}),ie=Q||N,se=Q||k,Z=g&&ie!==!0,P=U||$||Z;return Qz({deleteKeyCode:u,multiSelectionKeyCode:w}),S.jsx(tH,{onPaneContextMenu:l,elementsSelectable:b,zoomOnScroll:x,zoomOnPinch:v,panOnScroll:se,panOnScrollSpeed:D,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:!U&&ie,defaultViewport:I,translateExtent:F,minZoom:V,maxZoom:H,zoomActivationKeyCode:y,preventScrolling:z,noWheelClassName:G,noPanClassName:X,onViewportChange:O,isControlledViewport:M,paneClickDistance:o,selectionOnDrag:Z,children:S.jsxs(sH,{onSelectionStart:m,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,panOnDrag:ie,autoPanOnSelection:L,isSelecting:!!P,selectionMode:d,selectionKeyPressed:U,paneClickDistance:o,selectionOnDrag:Z,children:[e,j&&S.jsx(bH,{onSelectionContextMenu:q,noPanClassName:X,disableKeyboardA11y:K})]})})}mE.displayName="FlowRenderer";const xH=W.memo(mE),wH=e=>t=>e?Em(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function CH(e){return et(W.useCallback(wH(e),[e]),At)}const EH=e=>e.updateNodeInternals;function kH(){const e=et(EH),[t]=W.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(a=>{const l=a.target.getAttribute("data-id");r.set(l,{id:l,nodeElement:a.target,force:!0})}),e(r)}));return W.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function AH({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const a=xt(),l=W.useRef(null),c=W.useRef(null),o=W.useRef(e.sourcePosition),u=W.useRef(e.targetPosition),f=W.useRef(t),g=n&&!!e.internals.handleBounds;return W.useEffect(()=>{l.current&&!e.hidden&&(!g||c.current!==l.current)&&(c.current&&(r==null||r.unobserve(c.current)),r==null||r.observe(l.current),c.current=l.current)},[g,e.hidden]),W.useEffect(()=>()=>{c.current&&(r==null||r.unobserve(c.current),c.current=null)},[]),W.useEffect(()=>{if(l.current){const d=f.current!==t,m=o.current!==e.sourcePosition,_=u.current!==e.targetPosition;(d||m||_)&&(f.current=t,o.current=e.sourcePosition,u.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:l.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),l}function TH({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:a,onContextMenu:l,onDoubleClick:c,nodesDraggable:o,elementsSelectable:u,nodesConnectable:f,nodesFocusable:g,resizeObserver:d,noDragClassName:m,noPanClassName:_,disableKeyboardA11y:w,rfId:C,nodeTypes:y,nodeClickDistance:b,onError:x}){const{node:v,internals:k,isParent:D}=et(P=>{const ee=P.nodeLookup.get(e),te=P.parentLookup.has(e);return{node:ee,internals:ee.internals,isParent:te}},At);let T=v.type||"default",R=(y==null?void 0:y[T])||pS[T];R===void 0&&(x==null||x("003",Kn.error003(T)),T="default",R=(y==null?void 0:y.default)||pS.default);const N=!!(v.draggable||o&&typeof v.draggable>"u"),L=!!(v.selectable||u&&typeof v.selectable>"u"),I=!!(v.connectable||f&&typeof v.connectable>"u"),F=!!(v.focusable||g&&typeof v.focusable>"u"),V=xt(),H=IC(v),z=AH({node:v,nodeType:T,hasDimensions:H,resizeObserver:d}),q=fE({nodeRef:z,disabled:v.hidden||!N,noDragClassName:m,handleSelector:v.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:b}),G=dE();if(v.hidden)return null;const X=hi(v),K=vH(v),O=L||N||t||n||r||a,M=n?P=>n(P,{...k.userNode}):void 0,j=r?P=>r(P,{...k.userNode}):void 0,$=a?P=>a(P,{...k.userNode}):void 0,U=l?P=>l(P,{...k.userNode}):void 0,Q=c?P=>c(P,{...k.userNode}):void 0,ie=P=>{const{selectNodesOnDrag:ee,nodeDragThreshold:te}=V.getState();L&&(!ee||!N||te>0)&&lg({id:e,store:V,nodeRef:z}),t&&t(P,{...k.userNode})},se=P=>{if(!(FC(P.nativeEvent)||w)){if(AC.includes(P.key)&&L){const ee=P.key==="Escape";lg({id:e,store:V,unselect:ee,nodeRef:z})}else if(N&&v.selected&&Object.prototype.hasOwnProperty.call(Ru,P.key)){P.preventDefault();const{ariaLabelConfig:ee}=V.getState();V.setState({ariaLiveMessage:ee["node.a11yDescription.ariaLiveMessage"]({direction:P.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),G({direction:Ru[P.key],factor:P.shiftKey?4:1})}}},Z=()=>{var we;if(w||!((we=z.current)!=null&&we.matches(":focus-visible")))return;const{transform:P,width:ee,height:te,autoPanOnNodeFocus:pe,setCenter:ue}=V.getState();if(!pe)return;Em(new Map([[e,v]]),{x:0,y:0,width:ee,height:te},P,!0).length>0||ue(v.position.x+X.width/2,v.position.y+X.height/2,{zoom:P[2]})};return S.jsx("div",{className:Pt(["react-flow__node",`react-flow__node-${T}`,{[_]:N},v.className,{selected:v.selected,selectable:L,parent:D,draggable:N,dragging:q}]),ref:z,style:{zIndex:k.z,transform:`translate(${k.positionAbsolute.x}px,${k.positionAbsolute.y}px)`,pointerEvents:O?"all":"none",visibility:H?"visible":"hidden",...v.style,...K},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:M,onMouseMove:j,onMouseLeave:$,onContextMenu:U,onClick:ie,onDoubleClick:Q,onKeyDown:F?se:void 0,tabIndex:F?0:void 0,onFocus:F?Z:void 0,role:v.ariaRole??(F?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${sE}-${C}`,"aria-label":v.ariaLabel,...v.domAttributes,children:S.jsx(oH,{value:e,children:S.jsx(R,{id:e,data:v.data,type:T,positionAbsoluteX:k.positionAbsolute.x,positionAbsoluteY:k.positionAbsolute.y,selected:v.selected??!1,selectable:L,draggable:N,deletable:v.deletable??!0,isConnectable:I,sourcePosition:v.sourcePosition,targetPosition:v.targetPosition,dragging:q,dragHandle:v.dragHandle,zIndex:k.z,parentId:v.parentId,...X})})})}var NH=W.memo(TH);const DH=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function _E(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:a}=et(DH,At),l=CH(e.onlyRenderVisibleElements),c=kH();return S.jsx("div",{className:"react-flow__nodes",style:vh,children:l.map(o=>S.jsx(NH,{id:o,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:c,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}_E.displayName="NodeRenderer";const RH=W.memo(_E);function MH(e){return et(W.useCallback(n=>{if(!e)return n.edges.map(a=>a.id);const r=[];if(n.width&&n.height)for(const a of n.edges){const l=n.nodeLookup.get(a.source),c=n.nodeLookup.get(a.target);l&&c&&E9({sourceNode:l,targetNode:c,width:n.width,height:n.height,transform:n.transform})&&r.push(a.id)}return r},[e]),At)}const LH=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return S.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},OH=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return S.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},mS={[Tu.Arrow]:LH,[Tu.ArrowClosed]:OH};function jH(e){const t=xt();return W.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(mS,e)?mS[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",Kn.error009(e)),null)},[e])}const BH=({id:e,type:t,color:n,width:r=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:c,orient:o="auto-start-reverse"})=>{const u=jH(t);return u?S.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:o,refX:"0",refY:"0",children:S.jsx(u,{color:n,strokeWidth:c})}):null},vE=({defaultColor:e,rfId:t})=>{const n=et(l=>l.edges),r=et(l=>l.defaultEdgeOptions),a=W.useMemo(()=>L9(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return a.length?S.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:S.jsx("defs",{children:a.map(l=>S.jsx(BH,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};vE.displayName="MarkerDefinitions";var IH=W.memo(vE);function yE({x:e,y:t,label:n,labelStyle:r,labelShowBg:a=!0,labelBgStyle:l,labelBgPadding:c=[2,4],labelBgBorderRadius:o=2,children:u,className:f,...g}){const[d,m]=W.useState({x:1,y:0,width:0,height:0}),_=Pt(["react-flow__edge-textwrapper",f]),w=W.useRef(null);return W.useEffect(()=>{if(w.current){const C=w.current.getBBox();m({x:C.x,y:C.y,width:C.width,height:C.height})}},[n]),n?S.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:_,visibility:d.width?"visible":"hidden",...g,children:[a&&S.jsx("rect",{width:d.width+2*c[0],x:-c[0],y:-c[1],height:d.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:o,ry:o}),S.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:w,style:r,children:n}),u]}):null}yE.displayName="EdgeText";const zH=W.memo(yE);function yh({path:e,labelX:t,labelY:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:o,labelBgBorderRadius:u,interactionWidth:f=20,...g}){return S.jsxs(S.Fragment,{children:[S.jsx("path",{...g,d:e,fill:"none",className:Pt(["react-flow__edge-path",g.className])}),f?S.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&Yn(t)&&Yn(n)?S.jsx(zH,{x:t,y:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:o,labelBgBorderRadius:u}):null]})}function _S({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===Te.Left||e===Te.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function bE({sourceX:e,sourceY:t,sourcePosition:n=Te.Bottom,targetX:r,targetY:a,targetPosition:l=Te.Top}){const[c,o]=_S({pos:n,x1:e,y1:t,x2:r,y2:a}),[u,f]=_S({pos:l,x1:r,y1:a,x2:e,y2:t}),[g,d,m,_]=UC({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:c,sourceControlY:o,targetControlX:u,targetControlY:f});return[`M${e},${t} C${c},${o} ${u},${f} ${r},${a}`,g,d,m,_]}function SE(e){return W.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:c,targetPosition:o,label:u,labelStyle:f,labelShowBg:g,labelBgStyle:d,labelBgPadding:m,labelBgBorderRadius:_,style:w,markerEnd:C,markerStart:y,interactionWidth:b})=>{const[x,v,k]=bE({sourceX:n,sourceY:r,sourcePosition:c,targetX:a,targetY:l,targetPosition:o}),D=e.isInternal?void 0:t;return S.jsx(yh,{id:D,path:x,labelX:v,labelY:k,label:u,labelStyle:f,labelShowBg:g,labelBgStyle:d,labelBgPadding:m,labelBgBorderRadius:_,style:w,markerEnd:C,markerStart:y,interactionWidth:b})})}const HH=SE({isInternal:!1}),xE=SE({isInternal:!0});HH.displayName="SimpleBezierEdge";xE.displayName="SimpleBezierEdgeInternal";function wE(e){return W.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:c,labelStyle:o,labelShowBg:u,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:d,style:m,sourcePosition:_=Te.Bottom,targetPosition:w=Te.Top,markerEnd:C,markerStart:y,pathOptions:b,interactionWidth:x})=>{const[v,k,D]=rg({sourceX:n,sourceY:r,sourcePosition:_,targetX:a,targetY:l,targetPosition:w,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset,stepPosition:b==null?void 0:b.stepPosition}),T=e.isInternal?void 0:t;return S.jsx(yh,{id:T,path:v,labelX:k,labelY:D,label:c,labelStyle:o,labelShowBg:u,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:d,style:m,markerEnd:C,markerStart:y,interactionWidth:x})})}const CE=wE({isInternal:!1}),EE=wE({isInternal:!0});CE.displayName="SmoothStepEdge";EE.displayName="SmoothStepEdgeInternal";function kE(e){return W.memo(({id:t,...n})=>{var a;const r=e.isInternal?void 0:t;return S.jsx(CE,{...n,id:r,pathOptions:W.useMemo(()=>{var l;return{borderRadius:0,offset:(l=n.pathOptions)==null?void 0:l.offset}},[(a=n.pathOptions)==null?void 0:a.offset])})})}const FH=kE({isInternal:!1}),AE=kE({isInternal:!0});FH.displayName="StepEdge";AE.displayName="StepEdgeInternal";function TE(e){return W.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:c,labelStyle:o,labelShowBg:u,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:d,style:m,markerEnd:_,markerStart:w,interactionWidth:C})=>{const[y,b,x]=qC({sourceX:n,sourceY:r,targetX:a,targetY:l}),v=e.isInternal?void 0:t;return S.jsx(yh,{id:v,path:y,labelX:b,labelY:x,label:c,labelStyle:o,labelShowBg:u,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:d,style:m,markerEnd:_,markerStart:w,interactionWidth:C})})}const PH=TE({isInternal:!1}),NE=TE({isInternal:!0});PH.displayName="StraightEdge";NE.displayName="StraightEdgeInternal";function DE(e){return W.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:c=Te.Bottom,targetPosition:o=Te.Top,label:u,labelStyle:f,labelShowBg:g,labelBgStyle:d,labelBgPadding:m,labelBgBorderRadius:_,style:w,markerEnd:C,markerStart:y,pathOptions:b,interactionWidth:x})=>{const[v,k,D]=$C({sourceX:n,sourceY:r,sourcePosition:c,targetX:a,targetY:l,targetPosition:o,curvature:b==null?void 0:b.curvature}),T=e.isInternal?void 0:t;return S.jsx(yh,{id:T,path:v,labelX:k,labelY:D,label:u,labelStyle:f,labelShowBg:g,labelBgStyle:d,labelBgPadding:m,labelBgBorderRadius:_,style:w,markerEnd:C,markerStart:y,interactionWidth:x})})}const UH=DE({isInternal:!1}),RE=DE({isInternal:!0});UH.displayName="BezierEdge";RE.displayName="BezierEdgeInternal";const vS={default:RE,straight:NE,step:AE,smoothstep:EE,simplebezier:xE},yS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},$H=(e,t,n)=>n===Te.Left?e-t:n===Te.Right?e+t:e,GH=(e,t,n)=>n===Te.Top?e-t:n===Te.Bottom?e+t:e,bS="react-flow__edgeupdater";function SS({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:l,onMouseOut:c,type:o}){return S.jsx("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:c,className:Pt([bS,`${bS}-${o}`]),cx:$H(t,r,e),cy:GH(n,r,e),r,stroke:"transparent",fill:"transparent"})}function qH({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:a,targetX:l,targetY:c,sourcePosition:o,targetPosition:u,onReconnect:f,onReconnectStart:g,onReconnectEnd:d,setReconnecting:m,setUpdateHover:_}){const w=xt(),C=(k,D)=>{if(k.button!==0)return;const{autoPanOnConnect:T,domNode:R,connectionMode:N,connectionRadius:L,lib:I,onConnectStart:F,cancelConnection:V,nodeLookup:H,rfId:z,panBy:q,updateConnection:G}=w.getState(),X=D.type==="target",K=(j,$)=>{m(!1),d==null||d(j,n,D.type,$)},O=j=>f==null?void 0:f(n,j),M=(j,$)=>{m(!0),g==null||g(k,n,D.type),F==null||F(j,$)};og.onPointerDown(k.nativeEvent,{autoPanOnConnect:T,connectionMode:N,connectionRadius:L,domNode:R,handleId:D.id,nodeId:D.nodeId,nodeLookup:H,isTarget:X,edgeUpdaterType:D.type,lib:I,flowId:z,cancelConnection:V,panBy:q,isValidConnection:(...j)=>{var $,U;return((U=($=w.getState()).isValidConnection)==null?void 0:U.call($,...j))??!0},onConnect:O,onConnectStart:M,onConnectEnd:(...j)=>{var $,U;return(U=($=w.getState()).onConnectEnd)==null?void 0:U.call($,...j)},onReconnectEnd:K,updateConnection:G,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:k.currentTarget})},y=k=>C(k,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),b=k=>C(k,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>_(!0),v=()=>_(!1);return S.jsxs(S.Fragment,{children:[(e===!0||e==="source")&&S.jsx(SS,{position:o,centerX:r,centerY:a,radius:t,onMouseDown:y,onMouseEnter:x,onMouseOut:v,type:"source"}),(e===!0||e==="target")&&S.jsx(SS,{position:u,centerX:l,centerY:c,radius:t,onMouseDown:b,onMouseEnter:x,onMouseOut:v,type:"target"})]})}function VH({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:a,onDoubleClick:l,onContextMenu:c,onMouseEnter:o,onMouseMove:u,onMouseLeave:f,reconnectRadius:g,onReconnect:d,onReconnectStart:m,onReconnectEnd:_,rfId:w,edgeTypes:C,noPanClassName:y,onError:b,disableKeyboardA11y:x}){let v=et(ue=>ue.edgeLookup.get(e));const k=et(ue=>ue.defaultEdgeOptions);v=k?{...k,...v}:v;let D=v.type||"default",T=(C==null?void 0:C[D])||vS[D];T===void 0&&(b==null||b("011",Kn.error011(D)),D="default",T=(C==null?void 0:C.default)||vS.default);const R=!!(v.focusable||t&&typeof v.focusable>"u"),N=typeof d<"u"&&(v.reconnectable||n&&typeof v.reconnectable>"u"),L=!!(v.selectable||r&&typeof v.selectable>"u"),I=W.useRef(null),[F,V]=W.useState(!1),[H,z]=W.useState(!1),q=xt(),{zIndex:G=v.zIndex,sourceX:X,sourceY:K,targetX:O,targetY:M,sourcePosition:j,targetPosition:$}=et(W.useCallback(ue=>{const me=ue.nodeLookup.get(v.source),we=ue.nodeLookup.get(v.target);if(!me||!we)return yS;const le=M9({id:e,sourceNode:me,targetNode:we,sourceHandle:v.sourceHandle||null,targetHandle:v.targetHandle||null,connectionMode:ue.connectionMode,onError:b}),ye=C9({selected:v.selected,zIndex:v.zIndex,sourceNode:me,targetNode:we,elevateOnSelect:ue.elevateEdgesOnSelect,zIndexMode:ue.zIndexMode});return{...le||yS,zIndex:ye}},[v.source,v.target,v.sourceHandle,v.targetHandle,v.selected,v.zIndex]),At),U=W.useMemo(()=>v.markerStart?`url('#${sg(v.markerStart,w)}')`:void 0,[v.markerStart,w]),Q=W.useMemo(()=>v.markerEnd?`url('#${sg(v.markerEnd,w)}')`:void 0,[v.markerEnd,w]);if(v.hidden||X===null||K===null||O===null||M===null)return null;const ie=ue=>{var ye;const{addSelectedEdges:me,unselectNodesAndEdges:we,multiSelectionActive:le}=q.getState();L&&(q.setState({nodesSelectionActive:!1}),v.selected&&le?(we({nodes:[],edges:[v]}),(ye=I.current)==null||ye.blur()):me([e])),a&&a(ue,v)},se=l?ue=>{l(ue,{...v})}:void 0,Z=c?ue=>{c(ue,{...v})}:void 0,P=o?ue=>{o(ue,{...v})}:void 0,ee=u?ue=>{u(ue,{...v})}:void 0,te=f?ue=>{f(ue,{...v})}:void 0,pe=ue=>{var me;if(!x&&AC.includes(ue.key)&&L){const{unselectNodesAndEdges:we,addSelectedEdges:le}=q.getState();ue.key==="Escape"?((me=I.current)==null||me.blur(),we({edges:[v]})):le([e])}};return S.jsx("svg",{style:{zIndex:G},children:S.jsxs("g",{className:Pt(["react-flow__edge",`react-flow__edge-${D}`,v.className,y,{selected:v.selected,animated:v.animated,inactive:!L&&!a,updating:F,selectable:L}]),onClick:ie,onDoubleClick:se,onContextMenu:Z,onMouseEnter:P,onMouseMove:ee,onMouseLeave:te,onKeyDown:R?pe:void 0,tabIndex:R?0:void 0,role:v.ariaRole??(R?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":v.ariaLabel===null?void 0:v.ariaLabel||`Edge from ${v.source} to ${v.target}`,"aria-describedby":R?`${aE}-${w}`:void 0,ref:I,...v.domAttributes,children:[!H&&S.jsx(T,{id:e,source:v.source,target:v.target,type:v.type,selected:v.selected,animated:v.animated,selectable:L,deletable:v.deletable??!0,label:v.label,labelStyle:v.labelStyle,labelShowBg:v.labelShowBg,labelBgStyle:v.labelBgStyle,labelBgPadding:v.labelBgPadding,labelBgBorderRadius:v.labelBgBorderRadius,sourceX:X,sourceY:K,targetX:O,targetY:M,sourcePosition:j,targetPosition:$,data:v.data,style:v.style,sourceHandleId:v.sourceHandle,targetHandleId:v.targetHandle,markerStart:U,markerEnd:Q,pathOptions:"pathOptions"in v?v.pathOptions:void 0,interactionWidth:v.interactionWidth}),N&&S.jsx(qH,{edge:v,isReconnectable:N,reconnectRadius:g,onReconnect:d,onReconnectStart:m,onReconnectEnd:_,sourceX:X,sourceY:K,targetX:O,targetY:M,sourcePosition:j,targetPosition:$,setUpdateHover:V,setReconnecting:z})]})})}var YH=W.memo(VH);const WH=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ME({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:a,onReconnect:l,onEdgeContextMenu:c,onEdgeMouseEnter:o,onEdgeMouseMove:u,onEdgeMouseLeave:f,onEdgeClick:g,reconnectRadius:d,onEdgeDoubleClick:m,onReconnectStart:_,onReconnectEnd:w,disableKeyboardA11y:C}){const{edgesFocusable:y,edgesReconnectable:b,elementsSelectable:x,onError:v}=et(WH,At),k=MH(t);return S.jsxs("div",{className:"react-flow__edges",children:[S.jsx(IH,{defaultColor:e,rfId:n}),k.map(D=>S.jsx(YH,{id:D,edgesFocusable:y,edgesReconnectable:b,elementsSelectable:x,noPanClassName:a,onReconnect:l,onContextMenu:c,onMouseEnter:o,onMouseMove:u,onMouseLeave:f,onClick:g,reconnectRadius:d,onDoubleClick:m,onReconnectStart:_,onReconnectEnd:w,rfId:n,onError:v,edgeTypes:r,disableKeyboardA11y:C},D))]})}ME.displayName="EdgeRenderer";const XH=W.memo(ME),xS=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function KH({children:e}){const t=xt(),n=W.useRef(null),[r]=W.useState(()=>t.getState().transform);return uE(()=>{let a=null;const l=()=>{const c=t.getState().transform;a&&c[0]===a[0]&&c[1]===a[1]&&c[2]===a[2]||(a=c,n.current&&(n.current.style.transform=xS(c)))};return l(),t.subscribe(l)},[t]),S.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:xS(r)},children:e})}function ZH(e){const t=Om(),n=W.useRef(!1);W.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const QH=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function JH(e){const t=et(QH),n=xt();return W.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function eF(e){return e.connection.inProgress?{...e.connection,to:ll(e.connection.to,e.transform)}:{...e.connection}}function tF(e){return eF}function nF(e){const t=tF();return et(t,At)}const iF=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function rF({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:a,width:l,height:c,isValid:o,inProgress:u}=et(iF,At);return!(l&&a&&u)?null:S.jsx("svg",{style:e,width:l,height:c,className:"react-flow__connectionline react-flow__container",children:S.jsx("g",{className:Pt(["react-flow__connection",DC(o)]),children:S.jsx(LE,{style:t,type:n,CustomComponent:r,isValid:o})})})}const LE=({style:e,type:t=vr.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:a,from:l,fromNode:c,fromHandle:o,fromPosition:u,to:f,toNode:g,toHandle:d,toPosition:m,pointer:_}=nF();if(!a)return;if(n)return S.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:c,fromHandle:o,fromX:l.x,fromY:l.y,toX:f.x,toY:f.y,fromPosition:u,toPosition:m,connectionStatus:DC(r),toNode:g,toHandle:d,pointer:_});let w="";const C={sourceX:l.x,sourceY:l.y,sourcePosition:u,targetX:f.x,targetY:f.y,targetPosition:m};switch(t){case vr.Bezier:[w]=$C(C);break;case vr.SimpleBezier:[w]=bE(C);break;case vr.Step:[w]=rg({...C,borderRadius:0});break;case vr.SmoothStep:[w]=rg(C);break;default:[w]=qC(C)}return S.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};LE.displayName="ConnectionLine";const sF={};function wS(e=sF){W.useRef(e),xt(),W.useEffect(()=>{},[e])}function aF(){xt(),W.useRef(!1),W.useEffect(()=>{},[])}function OE({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:o,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:g,onSelectionContextMenu:d,onSelectionStart:m,onSelectionEnd:_,connectionLineType:w,connectionLineStyle:C,connectionLineComponent:y,connectionLineContainerStyle:b,selectionKeyCode:x,selectionOnDrag:v,selectionMode:k,multiSelectionKeyCode:D,panActivationKeyCode:T,zoomActivationKeyCode:R,deleteKeyCode:N,onlyRenderVisibleElements:L,elementsSelectable:I,defaultViewport:F,translateExtent:V,minZoom:H,maxZoom:z,preventScrolling:q,defaultMarkerColor:G,zoomOnScroll:X,zoomOnPinch:K,panOnScroll:O,panOnScrollSpeed:M,panOnScrollMode:j,zoomOnDoubleClick:$,panOnDrag:U,autoPanOnSelection:Q,onPaneClick:ie,onPaneMouseEnter:se,onPaneMouseMove:Z,onPaneMouseLeave:P,onPaneScroll:ee,onPaneContextMenu:te,paneClickDistance:pe,nodeClickDistance:ue,onEdgeContextMenu:me,onEdgeMouseEnter:we,onEdgeMouseMove:le,onEdgeMouseLeave:ye,reconnectRadius:be,onReconnect:Be,onReconnectStart:Ve,onReconnectEnd:Pe,noDragClassName:lt,noWheelClassName:Rt,noPanClassName:gt,disableKeyboardA11y:tt,nodeExtent:ct,rfId:de,viewport:Se,onViewportChange:Ee,nodesDraggable:Le}){return wS(e),wS(t),aF(),ZH(n),JH(Se),S.jsx(xH,{onPaneClick:ie,onPaneMouseEnter:se,onPaneMouseMove:Z,onPaneMouseLeave:P,onPaneContextMenu:te,onPaneScroll:ee,paneClickDistance:pe,deleteKeyCode:N,selectionKeyCode:x,selectionOnDrag:v,selectionMode:k,onSelectionStart:m,onSelectionEnd:_,multiSelectionKeyCode:D,panActivationKeyCode:T,zoomActivationKeyCode:R,elementsSelectable:I,zoomOnScroll:X,zoomOnPinch:K,zoomOnDoubleClick:$,panOnScroll:O,panOnScrollSpeed:M,panOnScrollMode:j,panOnDrag:U,autoPanOnSelection:Q,defaultViewport:F,translateExtent:V,minZoom:H,maxZoom:z,onSelectionContextMenu:d,preventScrolling:q,noDragClassName:lt,noWheelClassName:Rt,noPanClassName:gt,disableKeyboardA11y:tt,onViewportChange:Ee,isControlledViewport:!!Se,children:S.jsxs(KH,{children:[S.jsx(XH,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:c,onReconnect:Be,onReconnectStart:Ve,onReconnectEnd:Pe,onlyRenderVisibleElements:L,onEdgeContextMenu:me,onEdgeMouseEnter:we,onEdgeMouseMove:le,onEdgeMouseLeave:ye,reconnectRadius:be,defaultMarkerColor:G,noPanClassName:gt,disableKeyboardA11y:tt,rfId:de}),S.jsx(rF,{style:C,type:w,component:y,containerStyle:b}),S.jsx("div",{className:"react-flow__edgelabel-renderer"}),S.jsx(RH,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:l,onNodeMouseEnter:o,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:g,nodeClickDistance:ue,onlyRenderVisibleElements:L,noPanClassName:gt,noDragClassName:lt,disableKeyboardA11y:tt,nodeExtent:ct,rfId:de,nodesDraggable:Le}),S.jsx("div",{className:"react-flow__viewport-portal"})]})})}OE.displayName="GraphView";const oF=W.memo(OE),lF=BC(),CS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:c,fitViewOptions:o,minZoom:u=.5,maxZoom:f=2,nodeOrigin:g,nodeExtent:d,zIndexMode:m="basic"}={})=>{const _=new Map,w=new Map,C=new Map,y=new Map,b=r??t??[],x=n??e??[],v=g??[0,0],k=d??qo;WC(C,y,b);const{nodesInitialized:D}=ag(x,_,w,{nodeOrigin:v,nodeExtent:k,zIndexMode:m});let T=[0,0,1];if(c&&a&&l){const R=al(_,{filter:F=>!!((F.width||F.initialWidth)&&(F.height||F.initialHeight))}),{x:N,y:L,zoom:I}=Am(R,a,l,u,f,(o==null?void 0:o.padding)??.1);T=[N,L,I]}return{rfId:"1",width:a??0,height:l??0,transform:T,nodes:x,nodesInitialized:D,nodeLookup:_,parentLookup:w,edges:b,edgeLookup:y,connectionLookup:C,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:f,translateExtent:qo,nodeExtent:k,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:oa.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,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:c??!1,fitViewOptions:o,fitViewResolver:null,connection:{...NC},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:lF,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:TC,zIndexMode:m,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},cF=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:c,fitViewOptions:o,minZoom:u,maxZoom:f,nodeOrigin:g,nodeExtent:d,zIndexMode:m})=>Sz((_,w)=>{async function C(){const{nodeLookup:y,panZoom:b,fitViewOptions:x,fitViewResolver:v,width:k,height:D,minZoom:T,maxZoom:R}=w();b&&(await _9({nodes:y,width:k,height:D,panZoom:b,minZoom:T,maxZoom:R},x),v==null||v.resolve(!0),_({fitViewResolver:null}))}return{...CS({nodes:e,edges:t,width:a,height:l,fitView:c,fitViewOptions:o,minZoom:u,maxZoom:f,nodeOrigin:g,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:m}),setNodes:y=>{const{nodeLookup:b,parentLookup:x,nodeOrigin:v,elevateNodesOnSelect:k,fitViewQueued:D,zIndexMode:T,nodesSelectionActive:R}=w(),{nodesInitialized:N,hasSelectedNodes:L}=ag(y,b,x,{nodeOrigin:v,nodeExtent:d,elevateNodesOnSelect:k,checkEquality:!0,zIndexMode:T}),I=R&&L;D&&N?(C(),_({nodes:y,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:I})):_({nodes:y,nodesInitialized:N,nodesSelectionActive:I})},setEdges:y=>{const{connectionLookup:b,edgeLookup:x}=w();WC(b,x,y),_({edges:y})},setDefaultNodesAndEdges:(y,b)=>{if(y){const{setNodes:x}=w();x(y),_({hasDefaultNodes:!0})}if(b){const{setEdges:x}=w();x(b),_({hasDefaultEdges:!0})}},updateNodeInternals:y=>{const{triggerNodeChanges:b,nodeLookup:x,parentLookup:v,domNode:k,nodeOrigin:D,nodeExtent:T,debug:R,fitViewQueued:N,zIndexMode:L}=w(),{changes:I,updatedInternals:F}=F9(y,x,v,k,D,T,L);F&&(B9(x,v,{nodeOrigin:D,nodeExtent:T,zIndexMode:L}),N?(C(),_({fitViewQueued:!1,fitViewOptions:void 0})):_({}),(I==null?void 0:I.length)>0&&(R&&console.log("React Flow: trigger node changes",I),b==null||b(I)))},updateNodePositions:(y,b=!1)=>{const x=[];let v=[];const{nodeLookup:k,triggerNodeChanges:D,connection:T,updateConnection:R,onNodesChangeMiddlewareMap:N}=w();for(const[L,I]of y){const F=k.get(L),V=!!(F!=null&&F.expandParent&&(F!=null&&F.parentId)&&(I!=null&&I.position)),H={id:L,type:"position",position:V?{x:Math.max(0,I.position.x),y:Math.max(0,I.position.y)}:I.position,dragging:b};if(F&&T.inProgress&&T.fromNode.id===F.id){const z=ns(F,T.fromHandle,Te.Left,!0);R({...T,from:z})}V&&F.parentId&&x.push({id:L,parentId:F.parentId,rect:{...I.internals.positionAbsolute,width:I.measured.width??0,height:I.measured.height??0}}),v.push(H)}if(x.length>0){const{parentLookup:L,nodeOrigin:I}=w(),F=Lm(x,k,L,I);v.push(...F)}for(const L of N.values())v=L(v);D(v)},triggerNodeChanges:y=>{const{onNodesChange:b,setNodes:x,nodes:v,hasDefaultNodes:k,debug:D}=w();if(y!=null&&y.length){if(k){const T=Uz(y,v);x(T)}D&&console.log("React Flow: trigger node changes",y),b==null||b(y)}},triggerEdgeChanges:y=>{const{onEdgesChange:b,setEdges:x,edges:v,hasDefaultEdges:k,debug:D}=w();if(y!=null&&y.length){if(k){const T=$z(y,v);x(T)}D&&console.log("React Flow: trigger edge changes",y),b==null||b(y)}},addSelectedNodes:y=>{const{multiSelectionActive:b,edgeLookup:x,nodeLookup:v,triggerNodeChanges:k,triggerEdgeChanges:D}=w();if(b){const T=y.map(R=>Vr(R,!0));k(T);return}k(ea(v,new Set([...y]),!0)),D(ea(x))},addSelectedEdges:y=>{const{multiSelectionActive:b,edgeLookup:x,nodeLookup:v,triggerNodeChanges:k,triggerEdgeChanges:D}=w();if(b){const T=y.map(R=>Vr(R,!0));D(T);return}D(ea(x,new Set([...y]))),k(ea(v,new Set,!0))},unselectNodesAndEdges:({nodes:y,edges:b}={})=>{const{edges:x,nodes:v,nodeLookup:k,triggerNodeChanges:D,triggerEdgeChanges:T}=w(),R=y||v,N=b||x,L=[];for(const F of R){if(!F.selected)continue;const V=k.get(F.id);V&&(V.selected=!1),L.push(Vr(F.id,!1))}const I=[];for(const F of N)F.selected&&I.push(Vr(F.id,!1));D(L),T(I)},setMinZoom:y=>{const{panZoom:b,maxZoom:x}=w();b==null||b.setScaleExtent([y,x]),_({minZoom:y})},setMaxZoom:y=>{const{panZoom:b,minZoom:x}=w();b==null||b.setScaleExtent([x,y]),_({maxZoom:y})},setTranslateExtent:y=>{var b;(b=w().panZoom)==null||b.setTranslateExtent(y),_({translateExtent:y})},resetSelectedElements:()=>{const{edges:y,nodes:b,triggerNodeChanges:x,triggerEdgeChanges:v,elementsSelectable:k}=w();if(!k)return;const D=b.reduce((R,N)=>N.selected?[...R,Vr(N.id,!1)]:R,[]),T=y.reduce((R,N)=>N.selected?[...R,Vr(N.id,!1)]:R,[]);x(D),v(T)},setNodeExtent:y=>{const{nodes:b,nodeLookup:x,parentLookup:v,nodeOrigin:k,elevateNodesOnSelect:D,nodeExtent:T,zIndexMode:R}=w();y[0][0]===T[0][0]&&y[0][1]===T[0][1]&&y[1][0]===T[1][0]&&y[1][1]===T[1][1]||(ag(b,x,v,{nodeOrigin:k,nodeExtent:y,elevateNodesOnSelect:D,checkEquality:!1,zIndexMode:R}),_({nodeExtent:y}))},panBy:y=>{const{transform:b,width:x,height:v,panZoom:k,translateExtent:D}=w();return P9({delta:y,panZoom:k,transform:b,translateExtent:D,width:x,height:v})},setCenter:async(y,b,x)=>{const{width:v,height:k,maxZoom:D,panZoom:T}=w();if(!T)return!1;const R=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:D;return await T.setViewport({x:v/2-y*R,y:k/2-b*R,zoom:R},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{_({connection:{...NC}})},updateConnection:y=>{_({connection:y})},reset:()=>_({...CS()})}},Object.is);function uF({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:a,initialHeight:l,initialMinZoom:c,initialMaxZoom:o,initialFitViewOptions:u,fitView:f,nodeOrigin:g,nodeExtent:d,zIndexMode:m,children:_}){const[w]=W.useState(()=>cF({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:f,minZoom:c,maxZoom:o,fitViewOptions:u,nodeOrigin:g,nodeExtent:d,zIndexMode:m}));return S.jsx(xz,{value:w,children:S.jsx(Wz,{children:S.jsx(cH,{children:_})})})}function hF({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:a,width:l,height:c,fitView:o,fitViewOptions:u,minZoom:f,maxZoom:g,nodeOrigin:d,nodeExtent:m,zIndexMode:_}){return W.useContext(mh)?S.jsx(S.Fragment,{children:e}):S.jsx(uF,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:a,initialWidth:l,initialHeight:c,fitView:o,initialFitViewOptions:u,initialMinZoom:f,initialMaxZoom:g,nodeOrigin:d,nodeExtent:m,zIndexMode:_,children:e})}const fF={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function dF({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:l,edgeTypes:c,onNodeClick:o,onEdgeClick:u,onInit:f,onMove:g,onMoveStart:d,onMoveEnd:m,onConnect:_,onConnectStart:w,onConnectEnd:C,onClickConnectStart:y,onClickConnectEnd:b,onNodeMouseEnter:x,onNodeMouseMove:v,onNodeMouseLeave:k,onNodeContextMenu:D,onNodeDoubleClick:T,onNodeDragStart:R,onNodeDrag:N,onNodeDragStop:L,onNodesDelete:I,onEdgesDelete:F,onDelete:V,onSelectionChange:H,onSelectionDragStart:z,onSelectionDrag:q,onSelectionDragStop:G,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:O,onBeforeDelete:M,connectionMode:j,connectionLineType:$=vr.Bezier,connectionLineStyle:U,connectionLineComponent:Q,connectionLineContainerStyle:ie,deleteKeyCode:se="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:P=!1,selectionMode:ee=Vo.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:pe=Wo()?"Meta":"Control",zoomActivationKeyCode:ue=Wo()?"Meta":"Control",snapToGrid:me,snapGrid:we,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:ye,nodesDraggable:be,autoPanOnNodeFocus:Be,nodesConnectable:Ve,nodesFocusable:Pe,nodeOrigin:lt=oE,edgesFocusable:Rt,edgesReconnectable:gt,elementsSelectable:tt=!0,defaultViewport:ct=jz,minZoom:de=.5,maxZoom:Se=2,translateExtent:Ee=qo,preventScrolling:Le=!0,nodeExtent:je,defaultMarkerColor:wt="#b1b1b7",zoomOnScroll:Ue=!0,zoomOnPinch:Tt=!0,panOnScroll:Ct=!1,panOnScrollSpeed:Ut=.5,panOnScrollMode:nt=Kr.Free,zoomOnDoubleClick:he=!0,panOnDrag:Ce=!0,onPaneClick:Oe,onPaneMouseEnter:Ze,onPaneMouseMove:ot,onPaneMouseLeave:fi,onPaneScroll:Ot,onPaneContextMenu:Hi,paneClickDistance:wr=1,nodeClickDistance:bh=0,children:cl,onReconnect:_a,onReconnectStart:Cr,onReconnectEnd:Sh,onEdgeContextMenu:ul,onEdgeDoubleClick:hl,onEdgeMouseEnter:fl,onEdgeMouseMove:va,onEdgeMouseLeave:ya,reconnectRadius:dl=10,onNodesChange:pl,onEdgesChange:Qn,noDragClassName:$t="nodrag",noWheelClassName:Zt="nowheel",noPanClassName:di="nopan",fitView:os,fitViewOptions:gl,connectOnClick:xh,attributionPosition:ml,proOptions:Er,defaultEdgeOptions:ba,elevateNodesOnSelect:Fi=!0,elevateEdgesOnSelect:Pi=!1,disableKeyboardA11y:Ui=!1,autoPanOnConnect:$i,autoPanOnNodeDrag:jt,autoPanOnSelection:_l=!0,autoPanSpeed:vl,connectionRadius:pi,isValidConnection:Gi,onError:wh,style:yl,id:Sa,nodeDragThreshold:Ch,connectionDragThreshold:ls,viewport:cs,onViewportChange:Pn,width:sn,height:bl,colorMode:Eh="light",debug:xa,onScroll:kr,ariaLabelConfig:us,zIndexMode:Sl="basic",...an},wa){const hs=Sa||"1",Ca=Hz(Eh),qi=W.useCallback(Ea=>{Ea.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),kr==null||kr(Ea)},[kr]);return S.jsx("div",{"data-testid":"rf__wrapper",...an,onScroll:qi,style:{...yl,...fF},ref:wa,className:Pt(["react-flow",a,Ca]),id:Sa,role:"application",children:S.jsxs(hF,{nodes:e,edges:t,width:sn,height:bl,fitView:os,fitViewOptions:gl,minZoom:de,maxZoom:Se,nodeOrigin:lt,nodeExtent:je,zIndexMode:Sl,children:[S.jsx(zz,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:_,onConnectStart:w,onConnectEnd:C,onClickConnectStart:y,onClickConnectEnd:b,nodesDraggable:be,autoPanOnNodeFocus:Be,nodesConnectable:Ve,nodesFocusable:Pe,edgesFocusable:Rt,edgesReconnectable:gt,elementsSelectable:tt,elevateNodesOnSelect:Fi,elevateEdgesOnSelect:Pi,minZoom:de,maxZoom:Se,nodeExtent:je,onNodesChange:pl,onEdgesChange:Qn,snapToGrid:me,snapGrid:we,connectionMode:j,translateExtent:Ee,connectOnClick:xh,defaultEdgeOptions:ba,fitView:os,fitViewOptions:gl,onNodesDelete:I,onEdgesDelete:F,onDelete:V,onNodeDragStart:R,onNodeDrag:N,onNodeDragStop:L,onSelectionDrag:q,onSelectionDragStart:z,onSelectionDragStop:G,onMove:g,onMoveStart:d,onMoveEnd:m,noPanClassName:di,nodeOrigin:lt,rfId:hs,autoPanOnConnect:$i,autoPanOnNodeDrag:jt,autoPanSpeed:vl,onError:wh,connectionRadius:pi,isValidConnection:Gi,selectNodesOnDrag:ye,nodeDragThreshold:Ch,connectionDragThreshold:ls,onBeforeDelete:M,debug:xa,ariaLabelConfig:us,zIndexMode:Sl}),S.jsx(oF,{onInit:f,onNodeClick:o,onEdgeClick:u,onNodeMouseEnter:x,onNodeMouseMove:v,onNodeMouseLeave:k,onNodeContextMenu:D,onNodeDoubleClick:T,nodeTypes:l,edgeTypes:c,connectionLineType:$,connectionLineStyle:U,connectionLineComponent:Q,connectionLineContainerStyle:ie,selectionKeyCode:Z,selectionOnDrag:P,selectionMode:ee,deleteKeyCode:se,multiSelectionKeyCode:pe,panActivationKeyCode:te,zoomActivationKeyCode:ue,onlyRenderVisibleElements:le,defaultViewport:ct,translateExtent:Ee,minZoom:de,maxZoom:Se,preventScrolling:Le,zoomOnScroll:Ue,zoomOnPinch:Tt,zoomOnDoubleClick:he,panOnScroll:Ct,panOnScrollSpeed:Ut,panOnScrollMode:nt,panOnDrag:Ce,autoPanOnSelection:_l,onPaneClick:Oe,onPaneMouseEnter:Ze,onPaneMouseMove:ot,onPaneMouseLeave:fi,onPaneScroll:Ot,onPaneContextMenu:Hi,paneClickDistance:wr,nodeClickDistance:bh,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:O,onReconnect:_a,onReconnectStart:Cr,onReconnectEnd:Sh,onEdgeContextMenu:ul,onEdgeDoubleClick:hl,onEdgeMouseEnter:fl,onEdgeMouseMove:va,onEdgeMouseLeave:ya,reconnectRadius:dl,defaultMarkerColor:wt,noDragClassName:$t,noWheelClassName:Zt,noPanClassName:di,rfId:hs,disableKeyboardA11y:Ui,nodeExtent:je,viewport:cs,onViewportChange:Pn,nodesDraggable:be}),S.jsx(Oz,{onSelectionChange:H}),cl,S.jsx(Nz,{proOptions:Er,position:ml}),S.jsx(Tz,{rfId:hs,disableKeyboardA11y:Ui})]})})}var pF=cE(dF);function gF({dimensions:e,lineWidth:t,variant:n,className:r}){return S.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Pt(["react-flow__background-pattern",n,r])})}function mF({radius:e,className:t}){return S.jsx("circle",{cx:e,cy:e,r:e,className:Pt(["react-flow__background-pattern","dots",t])})}var Oi;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Oi||(Oi={}));const _F={[Oi.Dots]:1,[Oi.Lines]:1,[Oi.Cross]:6},vF=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function jE({id:e,variant:t=Oi.Dots,gap:n=20,size:r,lineWidth:a=1,offset:l=0,color:c,bgColor:o,style:u,className:f,patternClassName:g}){const d=W.useRef(null),{transform:m,patternId:_}=et(vF,At),w=r||_F[t],C=t===Oi.Dots,y=t===Oi.Cross,b=Array.isArray(n)?n:[n,n],x=[b[0]*m[2]||1,b[1]*m[2]||1],v=w*m[2],k=Array.isArray(l)?l:[l,l],D=y?[v,v]:x,T=[k[0]*m[2]||1+D[0]/2,k[1]*m[2]||1+D[1]/2],R=`${_}${e||""}`;return S.jsxs("svg",{className:Pt(["react-flow__background",f]),style:{...u,...vh,"--xy-background-color-props":o,"--xy-background-pattern-color-props":c},ref:d,"data-testid":"rf__background",children:[S.jsx("pattern",{id:R,x:m[0]%x[0],y:m[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:C?S.jsx(mF,{radius:v/2,className:g}):S.jsx(gF,{dimensions:D,lineWidth:a,variant:t,className:g})}),S.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${R})`})]})}jE.displayName="Background";const yF=W.memo(jE);function bF(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:S.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function SF(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:S.jsx("path",{d:"M0 0h32v4.2H0z"})})}function xF(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:S.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 wF(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.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 CF(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.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 Zc({children:e,className:t,...n}){return S.jsx("button",{type:"button",className:Pt(["react-flow__controls-button",t]),...n,children:e})}const EF=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function BE({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:c,onFitView:o,onInteractiveChange:u,className:f,children:g,position:d="bottom-left",orientation:m="vertical","aria-label":_}){const w=xt(),{isInteractive:C,minZoomReached:y,maxZoomReached:b,ariaLabelConfig:x}=et(EF,At),{zoomIn:v,zoomOut:k,fitView:D}=Om(),T=()=>{v(),l==null||l()},R=()=>{k(),c==null||c()},N=()=>{D(a),o==null||o()},L=()=>{w.setState({nodesDraggable:!C,nodesConnectable:!C,elementsSelectable:!C}),u==null||u(!C)},I=m==="horizontal"?"horizontal":"vertical";return S.jsxs(_h,{className:Pt(["react-flow__controls",I,f]),position:d,style:e,"data-testid":"rf__controls","aria-label":_??x["controls.ariaLabel"],children:[t&&S.jsxs(S.Fragment,{children:[S.jsx(Zc,{onClick:T,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:b,children:S.jsx(bF,{})}),S.jsx(Zc,{onClick:R,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:y,children:S.jsx(SF,{})})]}),n&&S.jsx(Zc,{className:"react-flow__controls-fitview",onClick:N,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:S.jsx(xF,{})}),r&&S.jsx(Zc,{className:"react-flow__controls-interactive",onClick:L,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:C?S.jsx(CF,{}):S.jsx(wF,{})}),g]})}BE.displayName="Controls";W.memo(BE);function kF({id:e,x:t,y:n,width:r,height:a,style:l,color:c,strokeColor:o,strokeWidth:u,className:f,borderRadius:g,shapeRendering:d,selected:m,onClick:_}){const{background:w,backgroundColor:C}=l||{},y=c||w||C;return S.jsx("rect",{className:Pt(["react-flow__minimap-node",{selected:m},f]),x:t,y:n,rx:g,ry:g,width:r,height:a,style:{fill:y,stroke:o,strokeWidth:u},shapeRendering:d,onClick:_?b=>_(b,e):void 0})}const AF=W.memo(kF),TF=e=>e.nodes.map(t=>t.id),yp=e=>e instanceof Function?e:()=>e;function NF({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l=AF,onClick:c}){const o=et(TF,At),u=yp(t),f=yp(e),g=yp(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return S.jsx(S.Fragment,{children:o.map(m=>S.jsx(RF,{id:m,nodeColorFunc:u,nodeStrokeColorFunc:f,nodeClassNameFunc:g,nodeBorderRadius:r,nodeStrokeWidth:a,NodeComponent:l,onClick:c,shapeRendering:d},m))})}function DF({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:a,nodeStrokeWidth:l,shapeRendering:c,NodeComponent:o,onClick:u}){const{node:f,x:g,y:d,width:m,height:_}=et(w=>{const C=w.nodeLookup.get(e);if(!C)return{node:void 0,x:0,y:0,width:0,height:0};const y=C.internals.userNode,{x:b,y:x}=C.internals.positionAbsolute,{width:v,height:k}=hi(y);return{node:y,x:b,y:x,width:v,height:k}},At);return!f||f.hidden||!IC(f)?null:S.jsx(o,{x:g,y:d,width:m,height:_,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:a,strokeColor:n(f),strokeWidth:l,shapeRendering:c,onClick:u,id:f.id})}const RF=W.memo(DF);var MF=W.memo(NF);const LF=200,OF=150,jF=e=>!e.hidden,BF=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?OC(al(e.nodeLookup,{filter:jF}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},ES=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,IF=(e,t)=>ES(e.viewBB,t.viewBB)&&ES(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,zF="react-flow__minimap-desc";function IE({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:c,nodeComponent:o,bgColor:u,maskColor:f,maskStrokeColor:g,maskStrokeWidth:d,position:m="bottom-right",onClick:_,onNodeClick:w,pannable:C=!1,zoomable:y=!1,ariaLabel:b,inversePan:x,zoomStep:v=1,offsetScale:k=5}){const D=xt(),T=W.useRef(null),{boundingRect:R,viewBB:N,rfId:L,panZoom:I,translateExtent:F,flowWidth:V,flowHeight:H,ariaLabelConfig:z}=et(BF,IF),q=(e==null?void 0:e.width)??LF,G=(e==null?void 0:e.height)??OF,X=R.width/q,K=R.height/G,O=Math.max(X,K),M=O*q,j=O*G,$=k*O,U=R.x-(M-R.width)/2-$,Q=R.y-(j-R.height)/2-$,ie=M+$*2,se=j+$*2,Z=`${zF}-${L}`,P=W.useRef(0),ee=W.useRef();P.current=O,W.useEffect(()=>{if(T.current&&I)return ee.current=K9({domNode:T.current,panZoom:I,getTransform:()=>D.getState().transform,getViewScale:()=>P.current}),()=>{var me;(me=ee.current)==null||me.destroy()}},[I]),W.useEffect(()=>{var me;(me=ee.current)==null||me.update({translateExtent:F,width:V,height:H,inversePan:x,pannable:C,zoomStep:v,zoomable:y})},[C,y,x,v,F,V,H]);const te=_?me=>{var ye;const[we,le]=((ye=ee.current)==null?void 0:ye.pointer(me))||[0,0];_(me,{x:we,y:le})}:void 0,pe=w?W.useCallback((me,we)=>{const le=D.getState().nodeLookup.get(we).internals.userNode;w(me,le)},[]):void 0,ue=b??z["minimap.ariaLabel"];return S.jsx(_h,{position:m,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof g=="string"?g: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 n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof c=="number"?c:void 0},className:Pt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:S.jsxs("svg",{width:q,height:G,viewBox:`${U} ${Q} ${ie} ${se}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:T,onClick:te,children:[ue&&S.jsx("title",{id:Z,children:ue}),S.jsx(MF,{onClick:pe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:o}),S.jsx("path",{className:"react-flow__minimap-mask",d:`M${U-$},${Q-$}h${ie+$*2}v${se+$*2}h${-ie-$*2}z - M${N.x},${N.y}h${N.width}v${N.height}h${-N.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}IE.displayName="MiniMap";W.memo(IE);const HF=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,FF={[ua.Line]:"right",[ua.Handle]:"bottom-right"};function PF({nodeId:e,position:t,variant:n=ua.Handle,className:r,style:a=void 0,children:l,color:c,minWidth:o=10,minHeight:u=10,maxWidth:f=Number.MAX_VALUE,maxHeight:g=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:m,autoScale:_=!0,shouldResize:w,onResizeStart:C,onResize:y,onResizeEnd:b}){const x=pE(),v=typeof e=="string"?e:x,k=xt(),D=W.useRef(null),T=n===ua.Handle,R=et(W.useCallback(HF(T&&_),[T,_]),At),N=W.useRef(null),L=t??FF[n];W.useEffect(()=>{if(!(!D.current||!v))return N.current||(N.current=cz({domNode:D.current,nodeId:v,getStoreItems:()=>{const{nodeLookup:F,transform:V,snapGrid:H,snapToGrid:z,nodeOrigin:q,domNode:G}=k.getState();return{nodeLookup:F,transform:V,snapGrid:H,snapToGrid:z,nodeOrigin:q,paneDomNode:G}},onChange:(F,V)=>{const{triggerNodeChanges:H,nodeLookup:z,parentLookup:q,nodeOrigin:G}=k.getState(),X=[],K={x:F.x,y:F.y},O=z.get(v);if(O&&O.expandParent&&O.parentId){const M=O.origin??G,j=F.width??O.measured.width??0,$=F.height??O.measured.height??0,U={id:O.id,parentId:O.parentId,rect:{width:j,height:$,...zC({x:F.x??O.position.x,y:F.y??O.position.y},{width:j,height:$},O.parentId,z,M)}},Q=Lm([U],z,q,G);X.push(...Q),K.x=F.x?Math.max(M[0]*j,F.x):void 0,K.y=F.y?Math.max(M[1]*$,F.y):void 0}if(K.x!==void 0&&K.y!==void 0){const M={id:v,type:"position",position:{...K}};X.push(M)}if(F.width!==void 0&&F.height!==void 0){const j={id:v,type:"dimensions",resizing:!0,setAttributes:m?m==="horizontal"?"width":"height":!0,dimensions:{width:F.width,height:F.height}};X.push(j)}for(const M of V){const j={...M,type:"position"};X.push(j)}H(X)},onEnd:({width:F,height:V})=>{const H={id:v,type:"dimensions",resizing:!1,dimensions:{width:F,height:V}};k.getState().triggerNodeChanges([H])}})),N.current.update({controlPosition:L,boundaries:{minWidth:o,minHeight:u,maxWidth:f,maxHeight:g},keepAspectRatio:d,resizeDirection:m,onResizeStart:C,onResize:y,onResizeEnd:b,shouldResize:w}),()=>{var F;(F=N.current)==null||F.destroy()}},[L,o,u,f,g,d,C,y,b,w]);const I=L.split("-");return S.jsx("div",{className:Pt(["react-flow__resize-control","nodrag",...I,n,r]),ref:D,style:{...a,scale:R,...c&&{[T?"backgroundColor":"borderColor"]:c}},children:l})}W.memo(PF);const cg=240,UF=132,hu=44,$F=72;function GF(e){const t=new Map(e.map(l=>[l.id,{exp:l,children:[]}])),n=[];for(const l of e){const c=t.get(l.id),o=l.parentExperimentId?t.get(l.parentExperimentId):void 0;o?o.children.push(c):n.push(c)}const r=(l,c)=>l.exp.createdAt-c.exp.createdAt,a=l=>{l.children.sort(r),l.children.forEach(a)};return n.sort(r),n.forEach(a),n}function fu(e){if(e.children.length===0)return cg;const t=e.children.reduce((n,r)=>n+fu(r),0)+hu*(e.children.length-1);return Math.max(cg,t)}function qF(e){return e==="done"?"pass":e==="failed"?"fail":e==="running"||e==="starting"?"live":"other"}const VF=W.memo(function({data:t}){const{exp:n,latestRun:r,runs:a,isBaseline:l,selected:c,onOpenView:o}=t,u=r==null?void 0:r.status,f=u==="running"||u==="starting",g=l?"BASELINE":f?"RUNNING":"EXPERIMENT",d=a.slice(-8);return S.jsxs("div",{className:`exp-node ${c?"selected":""} ${f?"live":""}`,children:[S.jsx(ha,{type:"target",position:Te.Top}),S.jsxs("div",{className:"node-eyebrow",children:[S.jsx("span",{children:g}),S.jsx(Bo,{status:u??"idle"})]}),S.jsx("div",{className:"node-head",children:S.jsx("span",{className:"node-slug",children:n.slug})}),(n.title||n.description)&&S.jsx("div",{className:"node-title",children:n.title||n.description}),S.jsxs("div",{className:"node-meta",children:[S.jsx("span",{children:"RUNS"}),d.length>0?S.jsx("span",{className:"run-squares",children:d.map(m=>S.jsx("span",{className:`run-sq ${qF(m.status)}`,title:m.status},m.id))}):S.jsx("span",{children:"no runs"}),S.jsx("span",{style:{flex:1}}),r&&S.jsx("span",{children:fa(r.createdAt)})]}),S.jsxs("div",{className:"node-actions",onClick:m=>m.stopPropagation(),children:[S.jsxs("button",{className:"node-action",title:"Open changes",onClick:()=>o(n.id,"changes"),children:[S.jsx(ju,{size:13}),"Changes"]}),a.length>0&&S.jsxs("button",{className:"node-action",title:"Open terminal",onClick:()=>o(n.id,"terminal"),children:[S.jsx(OS,{size:13}),"Terminal"]})]}),S.jsx(ha,{type:"source",position:Te.Bottom})]})}),YF={exp:VF},WF={type:"default",style:{stroke:"var(--text)",strokeWidth:1.5,opacity:.3}};function XF({experiments:e,runs:t,selectedId:n,onSelect:r,onOpenView:a}){const{nodes:l,edges:c}=W.useMemo(()=>{const o=new Map;for(const _ of t){const w=o.get(_.experimentId);w?w.push(_):o.set(_.experimentId,[_])}for(const _ of o.values())_.sort((w,C)=>w.createdAt-C.createdAt);const u=[],f=[],g=GF(e);function d(_,w,C){const y=o.get(_.exp.id)??[];if(u.push({id:_.exp.id,type:"exp",position:{x:w-cg/2,y:C},data:{exp:_.exp,latestRun:y[y.length-1]??null,runs:y,isBaseline:!_.exp.parentExperimentId,selected:_.exp.id===n,onOpenView:a}}),_.children.length===0)return;const b=_.children.reduce((v,k)=>v+fu(k),0)+hu*(_.children.length-1);let x=w-b/2;for(const v of _.children){const k=fu(v);f.push({id:`e-${_.exp.id}-${v.exp.id}`,source:_.exp.id,target:v.exp.id}),d(v,x+k/2,C+UF+$F),x+=k+hu}}let m=0;for(const _ of g){const w=fu(_);d(_,m+w/2,0),m+=w+hu}return{nodes:u,edges:f}},[e,t,n,a]);return e.length===0?S.jsxs("div",{className:"empty-state empty-state-cta",children:[S.jsx("p",{className:"empty-state-title",children:"No experiments yet"}),S.jsx("p",{className:"empty-state-hint",children:"Ask the agent in chat to create and run your first experiment."})]}):S.jsx(pF,{nodes:l,edges:c,nodeTypes:YF,defaultEdgeOptions:WF,nodesDraggable:!1,nodesConnectable:!1,minZoom:.15,fitView:!0,fitViewOptions:{padding:.25,maxZoom:1},onNodeClick:(o,u)=>r(u.id),onPaneClick:()=>r(null),children:S.jsx(yF,{variant:Oi.Dots,color:"var(--dots-strong)",gap:28,size:1.6})})}const Qc=(e,t)=>e.id===t.id&&e.view===t.view,Jc=(e,t)=>e.path===t.path&&e.sessionId===t.sessionId,kS=e=>`${e.sessionId??""}:${e.path}`;function KF(e,t,n){let r=e,a;const l=t==null?void 0:t.replace(/\/+$/,"");if(!r.startsWith("/"))a=n;else if(l&&(r===l||r.startsWith(`${l}/`)))r=r.slice(l.length).replace(/^\/+/,"");else{const c=r.match(/\/openresearch\/worktrees\/[^/]+\/[^/]+\/([^/]+)\/(.+)$/),o=c?null:r.match(/\/openresearch\/repos\/[^/]+\/[^/]+\/(.+)$/);c?(a=c[1],r=c[2]):o&&(r=o[1])}return r?{path:r,sessionId:a}:null}const AS="orx:onboarded",zE="orx:panel-width",Mu=360,ZF=10,QF=232,JF=380,eP=QF+56,tP=80;function ug(){return Math.max(Mu,window.innerWidth-eP-JF)}function nP(){const e=ug();try{const t=Number(localStorage.getItem(zE));if(Number.isFinite(t)&&t>=Mu)return Math.min(t,e)}catch{}return Math.max(Mu,Math.min(760,e,Math.round(window.innerWidth*.42)))}function eu(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const r=e.slice();return r[n]=t,r}function iP(){var me,we;const[e,t]=W.useState(null),[n,r]=W.useState(null),[a,l]=W.useState([]),[c,o]=W.useState([]),[u,f]=W.useState(null),[g,d]=W.useState("tree"),[m,_]=W.useState(null),[w,C]=W.useState(null),[y,b]=W.useState("experiments"),[x,v]=W.useState([]),[k,D]=W.useState([]),[T,R]=W.useState(!0),[N,L]=W.useState(!1),[I,F]=W.useState(nP),[V,H]=W.useState(!0),[z,q]=W.useState(!1),[G,X]=W.useState("chat"),[K,O]=W.useState(()=>{try{return localStorage.getItem(AS)==="1"}catch{return!0}}),M=W.useRef(n);M.current=n,W.useEffect(()=>{iT().then(le=>{t(le),r(ye=>{var be;return ye??((be=le[0])==null?void 0:be.id)??null})}).catch(()=>t([]))},[]),W.useEffect(()=>{const le=()=>F(ye=>Math.min(ye,ug()));return window.addEventListener("resize",le),()=>window.removeEventListener("resize",le)},[]),W.useEffect(()=>{n&&(oT(n).catch(()=>{}),l([]),o([]),f(null),_(null),C(null),v([]),D([]),b("experiments"),cT(n).then(l).catch(()=>{}),uT(n).then(o).catch(()=>{}),Dy(n).then(f).catch(()=>{}))},[n]);const j=W.useCallback(()=>{const le=M.current;le&&Dy(le).then(f).catch(()=>{})},[]);WT({onRun:le=>{le.projectId===M.current&&o(ye=>eu(ye,le))},onExperiment:le=>{le.projectId===M.current&&l(ye=>eu(ye,le))},onProject:le=>{t(ye=>ye?eu(ye,le):[le])},onFiles:le=>{le===M.current&&j()}});const $=W.useCallback((le,ye="changes")=>{_(le);const be={id:le,view:ye};v(Be=>Be.some(Ve=>Qc(Ve,be))?Be:[...Be,be]),b(be),R(!0)},[]),U=W.useCallback(le=>{const ye=x.findIndex(Be=>Qc(Be,le));if(ye===-1)return;const be=x.filter((Be,Ve)=>Ve!==ye);v(be),typeof y=="object"&&"view"in y&&Qc(y,le)&&b(be[Math.min(ye,be.length-1)]??"experiments")},[x,y]),Q=W.useCallback((le,ye)=>{var Ve;const be=(Ve=e==null?void 0:e.find(Pe=>Pe.id===n))==null?void 0:Ve.repoPath,Be=KF(le,be,ye);Be&&(D(Pe=>Pe.some(lt=>Jc(lt,Be))?Pe:[...Pe,Be]),b(Be),R(!0))},[e,n]),ie=W.useCallback(le=>{const ye=k.findIndex(Be=>Jc(Be,le));if(ye===-1)return;const be=k.filter((Be,Ve)=>Ve!==ye);D(be),typeof y=="object"&&"path"in y&&Jc(y,le)&&b(be[Math.min(ye,be.length-1)]??"experiments")},[k,y]),se=le=>{le.preventDefault(),le.currentTarget.setPointerCapture(le.pointerId);const ye=document.body.style.userSelect;document.body.style.userSelect="none";const be=Ve=>{const Pe=Math.round(window.innerWidth-Ve.clientX-ZF),lt=ug();if(Pe>lt+tP){L(!0);return}L(!1);const Rt=Math.min(Math.max(Pe,Mu),lt);F(Rt);try{localStorage.setItem(zE,String(Rt))}catch{}},Be=()=>{window.removeEventListener("pointermove",be),window.removeEventListener("pointerup",Be),window.removeEventListener("pointercancel",Be),document.body.style.userSelect=ye};window.addEventListener("pointermove",be),window.addEventListener("pointerup",Be),window.addEventListener("pointercancel",Be)},Z=le=>{t(ye=>ye?eu(ye,le):[le]),r(le.id),q(!1)},P=le=>{t(ye=>ye&&ye.filter(be=>be.id!==le)),n===le&&r(null)},ee=typeof y=="object"&&"view"in y?y:null,te=typeof y=="object"&&"path"in y?y:null,pe=ee?a.find(le=>le.id===ee.id)??null:null;if(e===null)return S.jsx("div",{className:"app",children:S.jsx("div",{className:"empty-state",children:S.jsx("span",{className:"spinner"})})});if(e.length===0)return S.jsx("div",{className:"app",children:K?S.jsx(mb,{projects:e,onOpen:r,onCreated:Z,onDeleted:P}):S.jsx(E8,{onDone:()=>{try{localStorage.setItem(AS,"1")}catch{}O(!0)}})});const ue=S.jsx(C8,{projectName:((me=e.find(le=>le.id===n))==null?void 0:me.name)??"",onHome:()=>q(!0),onCollapse:()=>H(!1)});return S.jsx("div",{className:"app",children:z?S.jsx(mb,{projects:e,onOpen:le=>{r(le),q(!1)},onCreated:Z,onDeleted:P}):S.jsxs("div",{className:"app-body",children:[n&&S.jsx(HL,{projectId:n,paperId:(we=e.find(le=>le.id===n))==null?void 0:we.paperId,railHeader:ue,railOpen:V,onShowRail:()=>H(!0),mainView:G,onSelectMainView:X,panelOpen:T,onTogglePanel:()=>{T&&L(!1),R(!T)},onOpenFile:Q,children:G==="files"?(()=>{const le=e.find(ye=>ye.id===n);return le?S.jsx(XL,{project:le,files:u,onChanged:j}):null})():G!=="chat"?S.jsx(EL,{tab:G}):null}),G==="chat"&&T&&S.jsxs("aside",{className:`right-pane floating-panel ${N?"max":""}`,style:N?void 0:{width:I},children:[!N&&S.jsx("div",{className:"panel-resizer",onPointerDown:se}),S.jsxs("div",{className:"tabs",children:[S.jsxs("div",{className:"tab-strip",children:[S.jsx("button",{className:`tab ${y==="experiments"?"active":""}`,onClick:()=>b("experiments"),children:"Experiments"}),x.map(le=>{const ye=a.find(be=>be.id===le.id);return S.jsx(j1,{active:ee!==null&&Qc(ee,le),label:ye?ye.title||ye.slug:"…",icon:le.view==="terminal"?S.jsx(OS,{size:12,style:{flexShrink:0}}):S.jsx(ju,{size:12,style:{flexShrink:0}}),onSelect:()=>{b(le),_(le.id)},onClose:()=>U(le)},`${le.id}:${le.view}`)}),k.map(le=>S.jsx(j1,{active:te!==null&&Jc(te,le),label:le.path.split("/").pop()||le.path,icon:S.jsx(RS,{size:12,style:{flexShrink:0}}),onSelect:()=>b(le),onClose:()=>ie(le)},`file:${kS(le)}`))]}),S.jsxs("div",{className:"panel-controls",children:[S.jsx("button",{className:"icon-btn",title:N?"Restore panel":"Expand panel","aria-label":N?"Restore panel":"Expand panel",onClick:()=>L(le=>!le),children:N?S.jsx(GA,{size:14}):S.jsx(UA,{size:14})}),S.jsx("button",{className:"icon-btn",title:"Close panel","aria-label":"Close panel",onClick:()=>{R(!1),L(!1)},children:S.jsx(Ro,{size:14})})]})]}),y==="experiments"?S.jsxs("div",{className:"tab-body",children:[S.jsx("div",{className:"pane-toolbar",children:S.jsxs("div",{className:"seg",children:[S.jsx("button",{className:g==="tree"?"active":"",onClick:()=>d("tree"),children:"Tree"}),S.jsx("button",{className:g==="table"?"active":"",onClick:()=>d("table"),children:"Table"})]})}),S.jsx("div",{className:"pane-content",children:g==="tree"?S.jsx(XF,{experiments:a,runs:c,selectedId:m,onSelect:le=>{C(null),_(le)},onOpenView:$}):S.jsx(L8,{runs:c,experiments:a,onOpen:le=>{C(le.id),$(le.experimentId,"terminal")},onOpenChanges:le=>$(le,"changes"),onCancel:le=>void BS(le).catch(()=>{})})})]}):te?S.jsx("div",{className:"tab-body",children:n&&S.jsx(w8,{projectId:n,path:te.path,sessionId:te.sessionId,onOpenFile:Q},kS(te))}):S.jsx("div",{className:"tab-body",children:ee&&pe&&S.jsx(y8,{experiment:pe,view:ee.view,runs:c,selectedRunId:w,onSelectRun:C},`${ee.id}:${ee.view}`)})]})]})})}Jk.createRoot(document.getElementById("root")).render(S.jsx(W.StrictMode,{children:S.jsx(iP,{})})); +`)),g=f.reduce((d,m)=>d.concat(...m),[]);return[f,g]}return[[],[]]},[e]);return Y.useEffect(()=>{const u=(t==null?void 0:t.target)??uS,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const g=_=>{var b,S;if(a.current=_.ctrlKey||_.metaKey||_.shiftKey||_.altKey,(!a.current||a.current&&!f)&&GC(_))return!1;const C=fS(_.code,o);if(l.current.add(_[C]),hS(c,l.current,!1)){const x=((S=(b=_.composedPath)==null?void 0:b.call(_))==null?void 0:S[0])||_.target,y=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(a.current||!y)&&_.preventDefault(),r(!0)}},d=_=>{const w=fS(_.code,o);hS(c,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(_[w]),_.key==="Meta"&&l.current.clear(),a.current=!1},m=()=>{l.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",g),u==null||u.addEventListener("keyup",d),window.addEventListener("blur",m),window.addEventListener("contextmenu",m),()=>{u==null||u.removeEventListener("keydown",g),u==null||u.removeEventListener("keyup",d),window.removeEventListener("blur",m),window.removeEventListener("contextmenu",m)}}},[e,r]),n}function hS(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function fS(e,t){return t.includes(e)?"code":"key"}const iH=()=>{const e=wt();return Y.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,a,l],panZoom:c}=e.getState();return c?(await c.setViewport({x:t.x??r,y:t.y??a,zoom:t.zoom??l},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:a,minZoom:l,maxZoom:c,panZoom:o}=e.getState(),u=Mm(t,r,a,l,c,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(u,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:a,snapToGrid:l,domNode:c}=e.getState();if(!c)return t;const{x:o,y:u}=c.getBoundingClientRect(),f={x:t.x-o,y:t.y-u},g=n.snapGrid??a,d=n.snapToGrid??l;return ul(f,r,d,g)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:a,y:l}=r.getBoundingClientRect(),c=ca(t,n);return{x:c.x+a,y:c.y+l}}}),[])};function fE(e,t){const n=[],r=new Map,a=[];for(const l of e)if(l.type==="add"){a.push(l);continue}else if(l.type==="remove"||l.type==="replace")r.set(l.id,[l]);else{const c=r.get(l.id);c?c.push(l):r.set(l.id,[l])}for(const l of t){const c=r.get(l.id);if(!c){n.push(l);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){n.push({...c[0].item});continue}const o={...l};for(const u of c)rH(u,o);n.push(o)}return a.length&&a.forEach(l=>{l.index!==void 0?n.splice(l.index,0,{...l.item}):n.push({...l.item})}),n}function rH(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function sH(e,t){return fE(e,t)}function aH(e,t){return fE(e,t)}function Vr(e,t){return{id:e,type:"select",selected:t}}function ea(e,t=new Set,n=!1){const r=[];for(const[a,l]of e){const c=t.has(a);!(l.selected===void 0&&!c)&&l.selected!==c&&(n&&(l.selected=c),r.push(Vr(l.id,c)))}return r}function dS({items:e=[],lookup:t}){var a;const n=[],r=new Map(e.map(l=>[l.id,l]));for(const[l,c]of e.entries()){const o=t.get(c.id),u=((a=o==null?void 0:o.internals)==null?void 0:a.userNode)??o;u!==void 0&&u!==c&&n.push({id:c.id,item:c,type:"replace"}),u===void 0&&n.push({item:c,type:"add",index:l})}for(const[l]of t)r.get(l)===void 0&&n.push({id:l,type:"remove"});return n}function pS(e){return{id:e.id,type:"remove"}}const oH=FC();function lH(e,t,n={}){return q9(e,t,{...n,onError:n.onError??oH})}const gS=e=>D9(e),cH=e=>jC(e);function dE(e){return Y.forwardRef(e)}const pE=typeof window<"u"?Y.useLayoutEffect:Y.useEffect;function mS(e){const[t,n]=Y.useState(BigInt(0)),[r]=Y.useState(()=>uH(()=>n(a=>a+BigInt(1))));return pE(()=>{const a=r.get();a.length&&(e(a),r.reset())},[t]),r}function uH(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const gE=Y.createContext(null);function hH({children:e}){const t=wt(),n=Y.useCallback(o=>{const{nodes:u=[],setNodes:f,hasDefaultNodes:g,onNodesChange:d,nodeLookup:m,fitViewQueued:_,onNodesChangeMiddlewareMap:w}=t.getState();let C=u;for(const S of o)C=typeof S=="function"?S(C):S;let b=dS({items:C,lookup:m});for(const S of w.values())b=S(b);g&&f(C),b.length>0?d==null||d(b):_&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:x,setNodes:y}=t.getState();S&&y(x)})},[]),r=mS(n),a=Y.useCallback(o=>{const{edges:u=[],setEdges:f,hasDefaultEdges:g,onEdgesChange:d,edgeLookup:m}=t.getState();let _=u;for(const w of o)_=typeof w=="function"?w(_):w;g?f(_):d&&d(dS({items:_,lookup:m}))},[]),l=mS(a),c=Y.useMemo(()=>({nodeQueue:r,edgeQueue:l}),[]);return v.jsx(gE.Provider,{value:c,children:e})}function fH(){const e=Y.useContext(gE);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const dH=e=>!!e.panZoom;function Hm(){const e=iH(),t=wt(),n=fH(),r=tt(dH),a=Y.useMemo(()=>{const l=d=>t.getState().nodeLookup.get(d),c=d=>{n.nodeQueue.push(d)},o=d=>{n.edgeQueue.push(d)},u=d=>{var S,x;const{nodeLookup:m,nodeOrigin:_}=t.getState(),w=gS(d)?d:m.get(d.id),C=w.parentId?UC(w.position,w.measured,w.parentId,m,_):w.position,b={...w,position:C,width:((S=w.measured)==null?void 0:S.width)??w.width,height:((x=w.measured)==null?void 0:x.height)??w.height};return Xo(b)},f=(d,m,_={replace:!1})=>{c(w=>w.map(C=>{if(C.id===d){const b=typeof m=="function"?m(C):m;return _.replace&&gS(b)?b:{...C,...b}}return C}))},g=(d,m,_={replace:!1})=>{o(w=>w.map(C=>{if(C.id===d){const b=typeof m=="function"?m(C):m;return _.replace&&cH(b)?b:{...C,...b}}return C}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>{var m;return(m=l(d))==null?void 0:m.internals.userNode},getInternalNode:l,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(m=>({...m}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:c,setEdges:o,addNodes:d=>{const m=Array.isArray(d)?d:[d];n.nodeQueue.push(_=>[..._,...m])},addEdges:d=>{const m=Array.isArray(d)?d:[d];n.edgeQueue.push(_=>[..._,...m])},toObject:()=>{const{nodes:d=[],edges:m=[],transform:_}=t.getState(),[w,C,b]=_;return{nodes:d.map(S=>({...S})),edges:m.map(S=>({...S})),viewport:{x:w,y:C,zoom:b}}},deleteElements:async({nodes:d=[],edges:m=[]})=>{const{nodes:_,edges:w,onNodesDelete:C,onEdgesDelete:b,triggerNodeChanges:S,triggerEdgeChanges:x,onDelete:y,onBeforeDelete:k}=t.getState(),{nodes:D,edges:T}=await j9({nodesToRemove:d,edgesToRemove:m,nodes:_,edges:w,onBeforeDelete:k}),R=T.length>0,N=D.length>0;if(R){const L=T.map(pS);b==null||b(T),x(L)}if(N){const L=D.map(pS);C==null||C(D),S(L)}return(N||R)&&(y==null||y({nodes:D,edges:T})),{deletedNodes:D,deletedEdges:T}},getIntersectingNodes:(d,m=!0,_)=>{const w=Fb(d),C=w?d:u(d),b=_!==void 0;return C?(_||t.getState().nodes).filter(S=>{const x=t.getState().nodeLookup.get(S.id);if(x&&!w&&(S.id===d.id||!x.internals.positionAbsolute))return!1;const y=Xo(b?S:x),k=Lu(y,C);return m&&k>0||k>=y.width*y.height||k>=C.width*C.height}):[]},isNodeIntersecting:(d,m,_=!0)=>{const C=Fb(d)?d:u(d);if(!C)return!1;const b=Lu(C,m);return _&&b>0||b>=m.width*m.height||b>=C.width*C.height},updateNode:f,updateNodeData:(d,m,_={replace:!1})=>{f(d,w=>{const C=typeof m=="function"?m(w):m;return _.replace?{...w,data:C}:{...w,data:{...w.data,...C}}},_)},updateEdge:g,updateEdgeData:(d,m,_={replace:!1})=>{g(d,w=>{const C=typeof m=="function"?m(w):m;return _.replace?{...w,data:C}:{...w,data:{...w.data,...C}}},_)},getNodesBounds:d=>{const{nodeLookup:m,nodeOrigin:_}=t.getState();return R9(d,{nodeLookup:m,nodeOrigin:_})},getHandleConnections:({type:d,id:m,nodeId:_})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${_}-${d}${m?`-${m}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:d,handleId:m,nodeId:_})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${_}${d?m?`-${d}-${m}`:`-${d}`:""}`))==null?void 0:w.values())??[])},fitView:async d=>{const m=t.getState().fitViewResolver??z9();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:m}),n.nodeQueue.push(_=>[..._]),m.promise}}},[]);return Y.useMemo(()=>({...a,...e,viewportInitialized:r}),[r])}const _S=e=>e.selected,pH=typeof window<"u"?window:void 0;function gH({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=wt(),{deleteElements:r}=Hm(),a=Zo(e,{actInsideInputWithModifier:!1}),l=Zo(t,{target:pH});Y.useEffect(()=>{if(a){const{edges:c,nodes:o}=n.getState();r({nodes:o.filter(_S),edges:c.filter(_S)}),n.setState({nodesSelectionActive:!1})}},[a]),Y.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])}function mH(e){const t=wt();Y.useEffect(()=>{const n=()=>{var a,l,c,o;if(!e.current||!(((l=(a=e.current).checkVisibility)==null?void 0:l.call(a))??!0))return!1;const r=Lm(e.current);(r.height===0||r.width===0)&&((o=(c=t.getState()).onError)==null||o.call(c,"004",Qn.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Sh={position:"absolute",width:"100%",height:"100%",top:0,left:0},_H=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function vH({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=Kr.Free,zoomOnDoubleClick:c=!0,panOnDrag:o=!0,defaultViewport:u,translateExtent:f,minZoom:g,maxZoom:d,zoomActivationKeyCode:m,preventScrolling:_=!0,children:w,noWheelClassName:C,noPanClassName:b,onViewportChange:S,isControlledViewport:x,paneClickDistance:y,selectionOnDrag:k}){const D=wt(),T=Y.useRef(null),{userSelectionActive:R,lib:N,connectionInProgress:L}=tt(_H,At),I=Zo(m),F=Y.useRef();mH(T);const V=Y.useCallback(H=>{S==null||S({x:H[0],y:H[1],zoom:H[2]}),x||D.setState({transform:H})},[S,x]);return Y.useEffect(()=>{if(T.current){F.current=Sz({domNode:T.current,minZoom:g,maxZoom:d,translateExtent:f,viewport:u,onDraggingChange:G=>D.setState(X=>X.paneDragging===G?X:{paneDragging:G}),onPanZoomStart:(G,X)=>{const{onViewportChangeStart:K,onMoveStart:O}=D.getState();O==null||O(G,X),K==null||K(X)},onPanZoom:(G,X)=>{const{onViewportChange:K,onMove:O}=D.getState();O==null||O(G,X),K==null||K(X)},onPanZoomEnd:(G,X)=>{const{onViewportChangeEnd:K,onMoveEnd:O}=D.getState();O==null||O(G,X),K==null||K(X)}});const{x:H,y:z,zoom:q}=F.current.getViewport();return D.setState({panZoom:F.current,transform:[H,z,q],domNode:T.current.closest(".react-flow")}),()=>{var G;(G=F.current)==null||G.destroy()}}},[]),Y.useEffect(()=>{var H;(H=F.current)==null||H.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:a,panOnScrollMode:l,zoomOnDoubleClick:c,panOnDrag:o,zoomActivationKeyPressed:I,preventScrolling:_,noPanClassName:b,userSelectionActive:R,noWheelClassName:C,lib:N,onTransformChange:V,connectionInProgress:L,selectionOnDrag:k,paneClickDistance:y})},[e,t,n,r,a,l,c,o,I,_,b,R,C,N,V,L,k,y]),v.jsx("div",{className:"react-flow__renderer",ref:T,style:Sh,children:w})}const yH=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function bH(){const{userSelectionActive:e,userSelectionRect:t}=tt(yH,At);return e&&t?v.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const xp=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},SH=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function xH({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Wo.Full,panOnDrag:r,autoPanOnSelection:a,paneClickDistance:l,selectionOnDrag:c,onSelectionStart:o,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:g,onPaneScroll:d,onPaneMouseEnter:m,onPaneMouseMove:_,onPaneMouseLeave:w,children:C}){const b=Y.useRef(0),S=wt(),{userSelectionActive:x,elementsSelectable:y,dragging:k,panBy:D,autoPanSpeed:T}=tt(SH,At),R=y&&(e||x),N=Y.useRef(null),L=Y.useRef(),I=Y.useRef(new Set),F=Y.useRef(new Set),V=Y.useRef(!1),H=Y.useRef(!1),z=Y.useRef({x:0,y:0}),q=Y.useRef(!1),G=P=>{if(H.current||V.current||S.getState().connection.inProgress){H.current=!1,V.current=!1;return}f==null||f(P),S.getState().resetSelectedElements(),S.setState({nodesSelectionActive:!1})},X=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}g==null||g(P)},K=d?P=>d(P):void 0,O=P=>{H.current&&(P.stopPropagation(),H.current=!1)},M=P=>{var be,Be;const{domNode:ee,transform:te}=S.getState();if(L.current=ee==null?void 0:ee.getBoundingClientRect(),!L.current)return;const pe=P.target===N.current;if(!pe&&!!P.target.closest(".nokey")||!e||!(c&&pe||t)||P.button!==0||!P.isPrimary)return;(Be=(be=P.target)==null?void 0:be.setPointerCapture)==null||Be.call(be,P.pointerId),H.current=!1;const{x:we,y:le}=Kn(P.nativeEvent,L.current),ye=ul({x:we,y:le},te);S.setState({userSelectionRect:{width:0,height:0,startX:ye.x,startY:ye.y,x:we,y:le}}),pe||(P.stopPropagation(),P.preventDefault())};function j(P,ee){const{userSelectionRect:te}=S.getState();if(!te)return;const{transform:pe,nodeLookup:ue,edgeLookup:me,connectionLookup:we,triggerNodeChanges:le,triggerEdgeChanges:ye,defaultEdgeOptions:be}=S.getState(),Be={x:te.startX,y:te.startY},{x:Ve,y:Pe}=ca(Be,pe),lt={startX:Be.x,startY:Be.y,x:Pct.id)),F.current=new Set;const nt=(be==null?void 0:be.selectable)??!0;for(const ct of I.current){const de=we.get(ct);if(de)for(const{edgeId:Se}of de.values()){const Ee=me.get(Se);Ee&&(Ee.selectable??nt)&&F.current.add(Se)}}if(!Pb(Rt,I.current)){const ct=ea(ue,I.current,!0);le(ct)}if(!Pb(gt,F.current)){const ct=ea(me,F.current);ye(ct)}S.setState({userSelectionRect:lt,userSelectionActive:!0,nodesSelectionActive:!1})}function $(){if(!a||!L.current)return;const[P,ee]=Rm(z.current,L.current,T);D({x:P,y:ee}).then(te=>{if(!H.current||!te){b.current=requestAnimationFrame($);return}const{x:pe,y:ue}=z.current;j(pe,ue),b.current=requestAnimationFrame($)})}const U=()=>{cancelAnimationFrame(b.current),b.current=0,q.current=!1};Y.useEffect(()=>()=>U(),[]);const Q=P=>{const{userSelectionRect:ee,transform:te,resetSelectedElements:pe}=S.getState();if(!L.current||!ee)return;const{x:ue,y:me}=Kn(P.nativeEvent,L.current);z.current={x:ue,y:me};const we=ca({x:ee.startX,y:ee.startY},te);if(!H.current){const le=t?0:l;if(Math.hypot(ue-we.x,me-we.y)<=le)return;pe(),o==null||o(P)}H.current=!0,q.current||($(),q.current=!0),j(ue,me)},ie=P=>{var ee,te;if(!R){P.target===N.current&&S.getState().connection.inProgress&&(V.current=!0);return}P.button===0&&((te=(ee=P.target)==null?void 0:ee.releasePointerCapture)==null||te.call(ee,P.pointerId),!x&&P.target===N.current&&S.getState().userSelectionRect&&(G==null||G(P)),S.setState({userSelectionActive:!1,userSelectionRect:null}),H.current&&(u==null||u(P),S.setState({nodesSelectionActive:I.current.size>0})),U())},se=P=>{var ee,te;(te=(ee=P.target)==null?void 0:ee.releasePointerCapture)==null||te.call(ee,P.pointerId),U()},Z=r===!0||Array.isArray(r)&&r.includes(0);return v.jsxs("div",{className:Ut(["react-flow__pane",{draggable:Z,dragging:k,selection:e}]),onClick:R?void 0:xp(G,N),onContextMenu:xp(X,N),onWheel:xp(K,N),onPointerEnter:R?void 0:m,onPointerMove:R?Q:_,onPointerUp:ie,onPointerCancel:R?se:void 0,onPointerDownCapture:R?M:void 0,onClickCapture:R?O:void 0,onPointerLeave:w,ref:N,style:Sh,children:[C,v.jsx(bH,{})]})}function pg({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:c,nodeLookup:o,onError:u}=t.getState(),f=o.get(e);if(!f){u==null||u("012",Qn.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&c)&&(l({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var g;return(g=r==null?void 0:r.current)==null?void 0:g.blur()})):a([e])}function mE({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:l,nodeClickDistance:c}){const o=wt(),[u,f]=Y.useState(!1),g=Y.useRef();return Y.useEffect(()=>{if(!t)return g.current=oz({getStoreItems:()=>o.getState(),onNodeMouseDown:d=>{pg({id:d,store:o,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}}),()=>{var d;(d=g.current)==null||d.destroy(),g.current=void 0}},[t,o,e]),Y.useEffect(()=>{t||!e.current||!g.current||g.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:l,nodeId:a,nodeClickDistance:c})},[n,r,t,l,e,a,c]),u}const wH=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function _E(){const e=wt();return Y.useCallback(n=>{const{nodeExtent:r,snapToGrid:a,snapGrid:l,nodesDraggable:c,onError:o,updateNodePositions:u,nodeLookup:f,nodeOrigin:g}=e.getState(),d=new Map,m=wH(c),_=a?l[0]:5,w=a?l[1]:5,C=n.direction.x*_*n.factor,b=n.direction.y*w*n.factor;for(const[,S]of f){if(!m(S))continue;let x={x:S.internals.positionAbsolute.x+C,y:S.internals.positionAbsolute.y+b};a&&(x=cl(x,l));const{position:y,positionAbsolute:k}=BC({nodeId:S.id,nextPosition:x,nodeLookup:f,nodeExtent:r,nodeOrigin:g,onError:o});S.position=y,S.internals.positionAbsolute=k,d.set(S.id,S)}u(d)},[])}const Fm=Y.createContext(null),CH=Fm.Provider;Fm.Consumer;const vE=()=>Y.useContext(Fm),EH=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),yE=Y.createContext(null);function kH({children:e}){const t=tt(EH,At);return v.jsx(yE.Provider,{value:t,children:e})}function AH(){const e=Y.useContext(yE);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const TH={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},NH=(e,t,n)=>r=>{const{connectionClickStartHandle:a,connectionMode:l,connection:c}=r,{fromHandle:o,toHandle:u,isValid:f}=c;if(!o&&!a)return TH;const g=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:g,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,isPossibleEndHandle:l===oa.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!a,valid:g&&f}};function DH({type:e="source",position:t=Te.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:c,onConnect:o,children:u,className:f,onMouseDown:g,onTouchStart:d,...m},_){var q,G;const w=c||null,C=e==="target",b=wt(),S=vE(),{connectOnClick:x,noPanClassName:y,rfId:k}=AH(),{connectingFrom:D,connectingTo:T,clickConnecting:R,isPossibleEndHandle:N,connectionInProcess:L,clickConnectionInProcess:I,valid:F}=tt(NH(S,w,e),At);S||(G=(q=b.getState()).onError)==null||G.call(q,"010",Qn.error010());const V=X=>{const{defaultEdgeOptions:K,onConnect:O,hasDefaultEdges:M}=b.getState(),j={...K,...X};if(M){const{edges:$,setEdges:U,onError:Q}=b.getState();U(lH(j,$,{onError:Q}))}O==null||O(j),o==null||o(j)},H=X=>{if(!S)return;const K=qC(X.nativeEvent);if(a&&(K&&X.button===0||!K)){const O=b.getState();dg.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:C,handleId:w,nodeId:S,flowId:O.rfId,panBy:O.panBy,cancelConnection:O.cancelConnection,onConnectStart:O.onConnectStart,onConnectEnd:(...M)=>{var j,$;return($=(j=b.getState()).onConnectEnd)==null?void 0:$.call(j,...M)},updateConnection:O.updateConnection,onConnect:V,isValidConnection:n||((...M)=>{var j,$;return(($=(j=b.getState()).isValidConnection)==null?void 0:$.call(j,...M))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:O.autoPanSpeed,dragThreshold:O.connectionDragThreshold})}K?g==null||g(X):d==null||d(X)},z=X=>{const{onClickConnectStart:K,onClickConnectEnd:O,connectionClickStartHandle:M,connectionMode:j,isValidConnection:$,lib:U,rfId:Q,nodeLookup:ie,connection:se}=b.getState();if(!S||!M&&!a)return;if(!M){K==null||K(X.nativeEvent,{nodeId:S,handleId:w,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:S,type:e,id:w}});return}const Z=$C(X.target),P=n||$,{connection:ee,isValid:te}=dg.isValid(X.nativeEvent,{handle:{nodeId:S,id:w,type:e},connectionMode:j,fromNodeId:M.nodeId,fromHandleId:M.id||null,fromType:M.type,isValidConnection:P,flowId:Q,doc:Z,lib:U,nodeLookup:ie});te&&ee&&V(ee);const pe=structuredClone(se);delete pe.inProgress,pe.toPosition=pe.toHandle?pe.toHandle.position:null,O==null||O(X,pe),b.setState({connectionClickStartHandle:null})};return v.jsx("div",{"data-handleid":w,"data-nodeid":S,"data-handlepos":t,"data-id":`${k}-${S}-${w}-${e}`,className:Ut(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",y,f,{source:!C,target:C,connectable:r,connectablestart:a,connectableend:l,clickconnecting:R,connectingfrom:D,connectingto:T,valid:F,connectionindicator:r&&(!L||N)&&(L||I?l:a)}]),onMouseDown:H,onTouchStart:H,onClick:x?z:void 0,ref:_,...m,children:u})}const ha=Y.memo(dE(DH));function RH({data:e,isConnectable:t,sourcePosition:n=Te.Bottom}){return v.jsxs(v.Fragment,{children:[e==null?void 0:e.label,v.jsx(ha,{type:"source",position:n,isConnectable:t})]})}function MH({data:e,isConnectable:t,targetPosition:n=Te.Top,sourcePosition:r=Te.Bottom}){return v.jsxs(v.Fragment,{children:[v.jsx(ha,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,v.jsx(ha,{type:"source",position:r,isConnectable:t})]})}function LH(){return null}function OH({data:e,isConnectable:t,targetPosition:n=Te.Top}){return v.jsxs(v.Fragment,{children:[v.jsx(ha,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Ou={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},vS={input:RH,default:MH,output:OH,group:LH};function jH(e){var t,n,r,a;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((a=e.style)==null?void 0:a.height)}}const BH=e=>{const{width:t,height:n,x:r,y:a}=ll(e.nodeLookup,{filter:l=>!!l.selected});return{width:Xn(t)?t:null,height:Xn(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${a}px)`}};function IH({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=wt(),{width:a,height:l,transformString:c,userSelectionActive:o}=tt(BH,At),u=_E(),f=Y.useRef(null);Y.useEffect(()=>{var _;n||(_=f.current)==null||_.focus({preventScroll:!0})},[n]);const g=!o&&a!==null&&l!==null;if(mE({nodeRef:f,disabled:!g}),!g)return null;const d=e?_=>{const w=r.getState().nodes.filter(C=>C.selected);e(_,w)}:void 0,m=_=>{Object.prototype.hasOwnProperty.call(Ou,_.key)&&(_.preventDefault(),u({direction:Ou[_.key],factor:_.shiftKey?4:1}))};return v.jsx("div",{className:Ut(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c},children:v.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m,style:{width:a,height:l}})})}const yS=typeof window<"u"?window:void 0,zH=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function bE({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,paneClickDistance:o,deleteKeyCode:u,selectionKeyCode:f,selectionOnDrag:g,selectionMode:d,onSelectionStart:m,onSelectionEnd:_,multiSelectionKeyCode:w,panActivationKeyCode:C,zoomActivationKeyCode:b,elementsSelectable:S,zoomOnScroll:x,zoomOnPinch:y,panOnScroll:k,panOnScrollSpeed:D,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:N,autoPanOnSelection:L,defaultViewport:I,translateExtent:F,minZoom:V,maxZoom:H,preventScrolling:z,onSelectionContextMenu:q,noWheelClassName:G,noPanClassName:X,disableKeyboardA11y:K,onViewportChange:O,isControlledViewport:M}){const{nodesSelectionActive:j,userSelectionActive:$}=tt(zH,At),U=Zo(f,{target:yS}),Q=Zo(C,{target:yS}),ie=Q||N,se=Q||k,Z=g&&ie!==!0,P=U||$||Z;return gH({deleteKeyCode:u,multiSelectionKeyCode:w}),v.jsx(vH,{onPaneContextMenu:l,elementsSelectable:S,zoomOnScroll:x,zoomOnPinch:y,panOnScroll:se,panOnScrollSpeed:D,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:!U&&ie,defaultViewport:I,translateExtent:F,minZoom:V,maxZoom:H,zoomActivationKeyCode:b,preventScrolling:z,noWheelClassName:G,noPanClassName:X,onViewportChange:O,isControlledViewport:M,paneClickDistance:o,selectionOnDrag:Z,children:v.jsxs(xH,{onSelectionStart:m,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:c,panOnDrag:ie,autoPanOnSelection:L,isSelecting:!!P,selectionMode:d,selectionKeyPressed:U,paneClickDistance:o,selectionOnDrag:Z,children:[e,j&&v.jsx(IH,{onSelectionContextMenu:q,noPanClassName:X,disableKeyboardA11y:K})]})})}bE.displayName="FlowRenderer";const HH=Y.memo(bE),FH=e=>t=>e?Dm(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function PH(e){return tt(Y.useCallback(FH(e),[e]),At)}const UH=e=>e.updateNodeInternals;function $H(){const e=tt(UH),[t]=Y.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(a=>{const l=a.target.getAttribute("data-id");r.set(l,{id:l,nodeElement:a.target,force:!0})}),e(r)}));return Y.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function GH({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const a=wt(),l=Y.useRef(null),c=Y.useRef(null),o=Y.useRef(e.sourcePosition),u=Y.useRef(e.targetPosition),f=Y.useRef(t),g=n&&!!e.internals.handleBounds;return Y.useEffect(()=>{l.current&&!e.hidden&&(!g||c.current!==l.current)&&(c.current&&(r==null||r.unobserve(c.current)),r==null||r.observe(l.current),c.current=l.current)},[g,e.hidden]),Y.useEffect(()=>()=>{c.current&&(r==null||r.unobserve(c.current),c.current=null)},[]),Y.useEffect(()=>{if(l.current){const d=f.current!==t,m=o.current!==e.sourcePosition,_=u.current!==e.targetPosition;(d||m||_)&&(f.current=t,o.current=e.sourcePosition,u.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:l.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),l}function qH({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:a,onContextMenu:l,onDoubleClick:c,nodesDraggable:o,elementsSelectable:u,nodesConnectable:f,nodesFocusable:g,resizeObserver:d,noDragClassName:m,noPanClassName:_,disableKeyboardA11y:w,rfId:C,nodeTypes:b,nodeClickDistance:S,onError:x}){const{node:y,internals:k,isParent:D}=tt(P=>{const ee=P.nodeLookup.get(e),te=P.parentLookup.has(e);return{node:ee,internals:ee.internals,isParent:te}},At);let T=y.type||"default",R=(b==null?void 0:b[T])||vS[T];R===void 0&&(x==null||x("003",Qn.error003(T)),T="default",R=(b==null?void 0:b.default)||vS.default);const N=!!(y.draggable||o&&typeof y.draggable>"u"),L=!!(y.selectable||u&&typeof y.selectable>"u"),I=!!(y.connectable||f&&typeof y.connectable>"u"),F=!!(y.focusable||g&&typeof y.focusable>"u"),V=wt(),H=PC(y),z=GH({node:y,nodeType:T,hasDimensions:H,resizeObserver:d}),q=mE({nodeRef:z,disabled:y.hidden||!N,noDragClassName:m,handleSelector:y.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:S}),G=_E();if(y.hidden)return null;const X=fi(y),K=jH(y),O=L||N||t||n||r||a,M=n?P=>n(P,{...k.userNode}):void 0,j=r?P=>r(P,{...k.userNode}):void 0,$=a?P=>a(P,{...k.userNode}):void 0,U=l?P=>l(P,{...k.userNode}):void 0,Q=c?P=>c(P,{...k.userNode}):void 0,ie=P=>{const{selectNodesOnDrag:ee,nodeDragThreshold:te}=V.getState();L&&(!ee||!N||te>0)&&pg({id:e,store:V,nodeRef:z}),t&&t(P,{...k.userNode})},se=P=>{if(!(GC(P.nativeEvent)||w)){if(RC.includes(P.key)&&L){const ee=P.key==="Escape";pg({id:e,store:V,unselect:ee,nodeRef:z})}else if(N&&y.selected&&Object.prototype.hasOwnProperty.call(Ou,P.key)){P.preventDefault();const{ariaLabelConfig:ee}=V.getState();V.setState({ariaLiveMessage:ee["node.a11yDescription.ariaLiveMessage"]({direction:P.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),G({direction:Ou[P.key],factor:P.shiftKey?4:1})}}},Z=()=>{var we;if(w||!((we=z.current)!=null&&we.matches(":focus-visible")))return;const{transform:P,width:ee,height:te,autoPanOnNodeFocus:pe,setCenter:ue}=V.getState();if(!pe)return;Dm(new Map([[e,y]]),{x:0,y:0,width:ee,height:te},P,!0).length>0||ue(y.position.x+X.width/2,y.position.y+X.height/2,{zoom:P[2]})};return v.jsx("div",{className:Ut(["react-flow__node",`react-flow__node-${T}`,{[_]:N},y.className,{selected:y.selected,selectable:L,parent:D,draggable:N,dragging:q}]),ref:z,style:{zIndex:k.z,transform:`translate(${k.positionAbsolute.x}px,${k.positionAbsolute.y}px)`,pointerEvents:O?"all":"none",visibility:H?"visible":"hidden",...y.style,...K},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:M,onMouseMove:j,onMouseLeave:$,onContextMenu:U,onClick:ie,onDoubleClick:Q,onKeyDown:F?se:void 0,tabIndex:F?0:void 0,onFocus:F?Z:void 0,role:y.ariaRole??(F?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${cE}-${C}`,"aria-label":y.ariaLabel,...y.domAttributes,children:v.jsx(CH,{value:e,children:v.jsx(R,{id:e,data:y.data,type:T,positionAbsoluteX:k.positionAbsolute.x,positionAbsoluteY:k.positionAbsolute.y,selected:y.selected??!1,selectable:L,draggable:N,deletable:y.deletable??!0,isConnectable:I,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:q,dragHandle:y.dragHandle,zIndex:k.z,parentId:y.parentId,...X})})})}var VH=Y.memo(qH);const YH=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function SE(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:a}=tt(YH,At),l=PH(e.onlyRenderVisibleElements),c=$H();return v.jsx("div",{className:"react-flow__nodes",style:Sh,children:l.map(o=>v.jsx(VH,{id:o,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:c,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}SE.displayName="NodeRenderer";const WH=Y.memo(SE);function XH(e){return tt(Y.useCallback(n=>{if(!e)return n.edges.map(a=>a.id);const r=[];if(n.width&&n.height)for(const a of n.edges){const l=n.nodeLookup.get(a.source),c=n.nodeLookup.get(a.target);l&&c&&U9({sourceNode:l,targetNode:c,width:n.width,height:n.height,transform:n.transform})&&r.push(a.id)}return r},[e]),At)}const KH=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return v.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},ZH=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return v.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},bS={[Ru.Arrow]:KH,[Ru.ArrowClosed]:ZH};function QH(e){const t=wt();return Y.useMemo(()=>{var a,l;return Object.prototype.hasOwnProperty.call(bS,e)?bS[e]:((l=(a=t.getState()).onError)==null||l.call(a,"009",Qn.error009(e)),null)},[e])}const JH=({id:e,type:t,color:n,width:r=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:c,orient:o="auto-start-reverse"})=>{const u=QH(t);return u?v.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:o,refX:"0",refY:"0",children:v.jsx(u,{color:n,strokeWidth:c})}):null},xE=({defaultColor:e,rfId:t})=>{const n=tt(l=>l.edges),r=tt(l=>l.defaultEdgeOptions),a=Y.useMemo(()=>K9(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return a.length?v.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:v.jsx("defs",{children:a.map(l=>v.jsx(JH,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};xE.displayName="MarkerDefinitions";var eF=Y.memo(xE);function wE({x:e,y:t,label:n,labelStyle:r,labelShowBg:a=!0,labelBgStyle:l,labelBgPadding:c=[2,4],labelBgBorderRadius:o=2,children:u,className:f,...g}){const[d,m]=Y.useState({x:1,y:0,width:0,height:0}),_=Ut(["react-flow__edge-textwrapper",f]),w=Y.useRef(null);return Y.useEffect(()=>{if(w.current){const C=w.current.getBBox();m({x:C.x,y:C.y,width:C.width,height:C.height})}},[n]),n?v.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:_,visibility:d.width?"visible":"hidden",...g,children:[a&&v.jsx("rect",{width:d.width+2*c[0],x:-c[0],y:-c[1],height:d.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:o,ry:o}),v.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:w,style:r,children:n}),u]}):null}wE.displayName="EdgeText";const tF=Y.memo(wE);function xh({path:e,labelX:t,labelY:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:o,labelBgBorderRadius:u,interactionWidth:f=20,...g}){return v.jsxs(v.Fragment,{children:[v.jsx("path",{...g,d:e,fill:"none",className:Ut(["react-flow__edge-path",g.className])}),f?v.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&Xn(t)&&Xn(n)?v.jsx(tF,{x:t,y:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:o,labelBgBorderRadius:u}):null]})}function SS({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===Te.Left||e===Te.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function CE({sourceX:e,sourceY:t,sourcePosition:n=Te.Bottom,targetX:r,targetY:a,targetPosition:l=Te.Top}){const[c,o]=SS({pos:n,x1:e,y1:t,x2:r,y2:a}),[u,f]=SS({pos:l,x1:r,y1:a,x2:e,y2:t}),[g,d,m,_]=VC({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:c,sourceControlY:o,targetControlX:u,targetControlY:f});return[`M${e},${t} C${c},${o} ${u},${f} ${r},${a}`,g,d,m,_]}function EE(e){return Y.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:c,targetPosition:o,label:u,labelStyle:f,labelShowBg:g,labelBgStyle:d,labelBgPadding:m,labelBgBorderRadius:_,style:w,markerEnd:C,markerStart:b,interactionWidth:S})=>{const[x,y,k]=CE({sourceX:n,sourceY:r,sourcePosition:c,targetX:a,targetY:l,targetPosition:o}),D=e.isInternal?void 0:t;return v.jsx(xh,{id:D,path:x,labelX:y,labelY:k,label:u,labelStyle:f,labelShowBg:g,labelBgStyle:d,labelBgPadding:m,labelBgBorderRadius:_,style:w,markerEnd:C,markerStart:b,interactionWidth:S})})}const nF=EE({isInternal:!1}),kE=EE({isInternal:!0});nF.displayName="SimpleBezierEdge";kE.displayName="SimpleBezierEdgeInternal";function AE(e){return Y.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:c,labelStyle:o,labelShowBg:u,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:d,style:m,sourcePosition:_=Te.Bottom,targetPosition:w=Te.Top,markerEnd:C,markerStart:b,pathOptions:S,interactionWidth:x})=>{const[y,k,D]=ug({sourceX:n,sourceY:r,sourcePosition:_,targetX:a,targetY:l,targetPosition:w,borderRadius:S==null?void 0:S.borderRadius,offset:S==null?void 0:S.offset,stepPosition:S==null?void 0:S.stepPosition}),T=e.isInternal?void 0:t;return v.jsx(xh,{id:T,path:y,labelX:k,labelY:D,label:c,labelStyle:o,labelShowBg:u,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:d,style:m,markerEnd:C,markerStart:b,interactionWidth:x})})}const TE=AE({isInternal:!1}),NE=AE({isInternal:!0});TE.displayName="SmoothStepEdge";NE.displayName="SmoothStepEdgeInternal";function DE(e){return Y.memo(({id:t,...n})=>{var a;const r=e.isInternal?void 0:t;return v.jsx(TE,{...n,id:r,pathOptions:Y.useMemo(()=>{var l;return{borderRadius:0,offset:(l=n.pathOptions)==null?void 0:l.offset}},[(a=n.pathOptions)==null?void 0:a.offset])})})}const iF=DE({isInternal:!1}),RE=DE({isInternal:!0});iF.displayName="StepEdge";RE.displayName="StepEdgeInternal";function ME(e){return Y.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:c,labelStyle:o,labelShowBg:u,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:d,style:m,markerEnd:_,markerStart:w,interactionWidth:C})=>{const[b,S,x]=XC({sourceX:n,sourceY:r,targetX:a,targetY:l}),y=e.isInternal?void 0:t;return v.jsx(xh,{id:y,path:b,labelX:S,labelY:x,label:c,labelStyle:o,labelShowBg:u,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:d,style:m,markerEnd:_,markerStart:w,interactionWidth:C})})}const rF=ME({isInternal:!1}),LE=ME({isInternal:!0});rF.displayName="StraightEdge";LE.displayName="StraightEdgeInternal";function OE(e){return Y.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:c=Te.Bottom,targetPosition:o=Te.Top,label:u,labelStyle:f,labelShowBg:g,labelBgStyle:d,labelBgPadding:m,labelBgBorderRadius:_,style:w,markerEnd:C,markerStart:b,pathOptions:S,interactionWidth:x})=>{const[y,k,D]=YC({sourceX:n,sourceY:r,sourcePosition:c,targetX:a,targetY:l,targetPosition:o,curvature:S==null?void 0:S.curvature}),T=e.isInternal?void 0:t;return v.jsx(xh,{id:T,path:y,labelX:k,labelY:D,label:u,labelStyle:f,labelShowBg:g,labelBgStyle:d,labelBgPadding:m,labelBgBorderRadius:_,style:w,markerEnd:C,markerStart:b,interactionWidth:x})})}const sF=OE({isInternal:!1}),jE=OE({isInternal:!0});sF.displayName="BezierEdge";jE.displayName="BezierEdgeInternal";const xS={default:jE,straight:LE,step:RE,smoothstep:NE,simplebezier:kE},wS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},aF=(e,t,n)=>n===Te.Left?e-t:n===Te.Right?e+t:e,oF=(e,t,n)=>n===Te.Top?e-t:n===Te.Bottom?e+t:e,CS="react-flow__edgeupdater";function ES({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:l,onMouseOut:c,type:o}){return v.jsx("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:c,className:Ut([CS,`${CS}-${o}`]),cx:aF(t,r,e),cy:oF(n,r,e),r,stroke:"transparent",fill:"transparent"})}function lF({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:a,targetX:l,targetY:c,sourcePosition:o,targetPosition:u,onReconnect:f,onReconnectStart:g,onReconnectEnd:d,setReconnecting:m,setUpdateHover:_}){const w=wt(),C=(k,D)=>{if(k.button!==0)return;const{autoPanOnConnect:T,domNode:R,connectionMode:N,connectionRadius:L,lib:I,onConnectStart:F,cancelConnection:V,nodeLookup:H,rfId:z,panBy:q,updateConnection:G}=w.getState(),X=D.type==="target",K=(j,$)=>{m(!1),d==null||d(j,n,D.type,$)},O=j=>f==null?void 0:f(n,j),M=(j,$)=>{m(!0),g==null||g(k,n,D.type),F==null||F(j,$)};dg.onPointerDown(k.nativeEvent,{autoPanOnConnect:T,connectionMode:N,connectionRadius:L,domNode:R,handleId:D.id,nodeId:D.nodeId,nodeLookup:H,isTarget:X,edgeUpdaterType:D.type,lib:I,flowId:z,cancelConnection:V,panBy:q,isValidConnection:(...j)=>{var $,U;return((U=($=w.getState()).isValidConnection)==null?void 0:U.call($,...j))??!0},onConnect:O,onConnectStart:M,onConnectEnd:(...j)=>{var $,U;return(U=($=w.getState()).onConnectEnd)==null?void 0:U.call($,...j)},onReconnectEnd:K,updateConnection:G,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:k.currentTarget})},b=k=>C(k,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),S=k=>C(k,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>_(!0),y=()=>_(!1);return v.jsxs(v.Fragment,{children:[(e===!0||e==="source")&&v.jsx(ES,{position:o,centerX:r,centerY:a,radius:t,onMouseDown:b,onMouseEnter:x,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&v.jsx(ES,{position:u,centerX:l,centerY:c,radius:t,onMouseDown:S,onMouseEnter:x,onMouseOut:y,type:"target"})]})}function cF({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:a,onDoubleClick:l,onContextMenu:c,onMouseEnter:o,onMouseMove:u,onMouseLeave:f,reconnectRadius:g,onReconnect:d,onReconnectStart:m,onReconnectEnd:_,rfId:w,edgeTypes:C,noPanClassName:b,onError:S,disableKeyboardA11y:x}){let y=tt(ue=>ue.edgeLookup.get(e));const k=tt(ue=>ue.defaultEdgeOptions);y=k?{...k,...y}:y;let D=y.type||"default",T=(C==null?void 0:C[D])||xS[D];T===void 0&&(S==null||S("011",Qn.error011(D)),D="default",T=(C==null?void 0:C.default)||xS.default);const R=!!(y.focusable||t&&typeof y.focusable>"u"),N=typeof d<"u"&&(y.reconnectable||n&&typeof y.reconnectable>"u"),L=!!(y.selectable||r&&typeof y.selectable>"u"),I=Y.useRef(null),[F,V]=Y.useState(!1),[H,z]=Y.useState(!1),q=wt(),{zIndex:G=y.zIndex,sourceX:X,sourceY:K,targetX:O,targetY:M,sourcePosition:j,targetPosition:$}=tt(Y.useCallback(ue=>{const me=ue.nodeLookup.get(y.source),we=ue.nodeLookup.get(y.target);if(!me||!we)return wS;const le=X9({id:e,sourceNode:me,targetNode:we,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:ue.connectionMode,onError:S}),ye=P9({selected:y.selected,zIndex:y.zIndex,sourceNode:me,targetNode:we,elevateOnSelect:ue.elevateEdgesOnSelect,zIndexMode:ue.zIndexMode});return{...le||wS,zIndex:ye}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),At),U=Y.useMemo(()=>y.markerStart?`url('#${hg(y.markerStart,w)}')`:void 0,[y.markerStart,w]),Q=Y.useMemo(()=>y.markerEnd?`url('#${hg(y.markerEnd,w)}')`:void 0,[y.markerEnd,w]);if(y.hidden||X===null||K===null||O===null||M===null)return null;const ie=ue=>{var ye;const{addSelectedEdges:me,unselectNodesAndEdges:we,multiSelectionActive:le}=q.getState();L&&(q.setState({nodesSelectionActive:!1}),y.selected&&le?(we({nodes:[],edges:[y]}),(ye=I.current)==null||ye.blur()):me([e])),a&&a(ue,y)},se=l?ue=>{l(ue,{...y})}:void 0,Z=c?ue=>{c(ue,{...y})}:void 0,P=o?ue=>{o(ue,{...y})}:void 0,ee=u?ue=>{u(ue,{...y})}:void 0,te=f?ue=>{f(ue,{...y})}:void 0,pe=ue=>{var me;if(!x&&RC.includes(ue.key)&&L){const{unselectNodesAndEdges:we,addSelectedEdges:le}=q.getState();ue.key==="Escape"?((me=I.current)==null||me.blur(),we({edges:[y]})):le([e])}};return v.jsx("svg",{style:{zIndex:G},children:v.jsxs("g",{className:Ut(["react-flow__edge",`react-flow__edge-${D}`,y.className,b,{selected:y.selected,animated:y.animated,inactive:!L&&!a,updating:F,selectable:L}]),onClick:ie,onDoubleClick:se,onContextMenu:Z,onMouseEnter:P,onMouseMove:ee,onMouseLeave:te,onKeyDown:R?pe:void 0,tabIndex:R?0:void 0,role:y.ariaRole??(R?"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":R?`${uE}-${w}`:void 0,ref:I,...y.domAttributes,children:[!H&&v.jsx(T,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:L,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:K,targetX:O,targetY:M,sourcePosition:j,targetPosition:$,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:U,markerEnd:Q,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),N&&v.jsx(lF,{edge:y,isReconnectable:N,reconnectRadius:g,onReconnect:d,onReconnectStart:m,onReconnectEnd:_,sourceX:X,sourceY:K,targetX:O,targetY:M,sourcePosition:j,targetPosition:$,setUpdateHover:V,setReconnecting:z})]})})}var uF=Y.memo(cF);const hF=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function BE({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:a,onReconnect:l,onEdgeContextMenu:c,onEdgeMouseEnter:o,onEdgeMouseMove:u,onEdgeMouseLeave:f,onEdgeClick:g,reconnectRadius:d,onEdgeDoubleClick:m,onReconnectStart:_,onReconnectEnd:w,disableKeyboardA11y:C}){const{edgesFocusable:b,edgesReconnectable:S,elementsSelectable:x,onError:y}=tt(hF,At),k=XH(t);return v.jsxs("div",{className:"react-flow__edges",children:[v.jsx(eF,{defaultColor:e,rfId:n}),k.map(D=>v.jsx(uF,{id:D,edgesFocusable:b,edgesReconnectable:S,elementsSelectable:x,noPanClassName:a,onReconnect:l,onContextMenu:c,onMouseEnter:o,onMouseMove:u,onMouseLeave:f,onClick:g,reconnectRadius:d,onDoubleClick:m,onReconnectStart:_,onReconnectEnd:w,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:C},D))]})}BE.displayName="EdgeRenderer";const fF=Y.memo(BE),kS=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function dF({children:e}){const t=wt(),n=Y.useRef(null),[r]=Y.useState(()=>t.getState().transform);return pE(()=>{let a=null;const l=()=>{const c=t.getState().transform;a&&c[0]===a[0]&&c[1]===a[1]&&c[2]===a[2]||(a=c,n.current&&(n.current.style.transform=kS(c)))};return l(),t.subscribe(l)},[t]),v.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:kS(r)},children:e})}function pF(e){const t=Hm(),n=Y.useRef(!1);Y.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const gF=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function mF(e){const t=tt(gF),n=wt();return Y.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function _F(e){return e.connection.inProgress?{...e.connection,to:ul(e.connection.to,e.transform)}:{...e.connection}}function vF(e){return _F}function yF(e){const t=vF();return tt(t,At)}const bF=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function SF({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:a,width:l,height:c,isValid:o,inProgress:u}=tt(bF,At);return!(l&&a&&u)?null:v.jsx("svg",{style:e,width:l,height:c,className:"react-flow__connectionline react-flow__container",children:v.jsx("g",{className:Ut(["react-flow__connection",OC(o)]),children:v.jsx(IE,{style:t,type:n,CustomComponent:r,isValid:o})})})}const IE=({style:e,type:t=vr.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:a,from:l,fromNode:c,fromHandle:o,fromPosition:u,to:f,toNode:g,toHandle:d,toPosition:m,pointer:_}=yF();if(!a)return;if(n)return v.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:c,fromHandle:o,fromX:l.x,fromY:l.y,toX:f.x,toY:f.y,fromPosition:u,toPosition:m,connectionStatus:OC(r),toNode:g,toHandle:d,pointer:_});let w="";const C={sourceX:l.x,sourceY:l.y,sourcePosition:u,targetX:f.x,targetY:f.y,targetPosition:m};switch(t){case vr.Bezier:[w]=YC(C);break;case vr.SimpleBezier:[w]=CE(C);break;case vr.Step:[w]=ug({...C,borderRadius:0});break;case vr.SmoothStep:[w]=ug(C);break;default:[w]=XC(C)}return v.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};IE.displayName="ConnectionLine";const xF={};function AS(e=xF){Y.useRef(e),wt(),Y.useEffect(()=>{},[e])}function wF(){wt(),Y.useRef(!1),Y.useEffect(()=>{},[])}function zE({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:o,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:g,onSelectionContextMenu:d,onSelectionStart:m,onSelectionEnd:_,connectionLineType:w,connectionLineStyle:C,connectionLineComponent:b,connectionLineContainerStyle:S,selectionKeyCode:x,selectionOnDrag:y,selectionMode:k,multiSelectionKeyCode:D,panActivationKeyCode:T,zoomActivationKeyCode:R,deleteKeyCode:N,onlyRenderVisibleElements:L,elementsSelectable:I,defaultViewport:F,translateExtent:V,minZoom:H,maxZoom:z,preventScrolling:q,defaultMarkerColor:G,zoomOnScroll:X,zoomOnPinch:K,panOnScroll:O,panOnScrollSpeed:M,panOnScrollMode:j,zoomOnDoubleClick:$,panOnDrag:U,autoPanOnSelection:Q,onPaneClick:ie,onPaneMouseEnter:se,onPaneMouseMove:Z,onPaneMouseLeave:P,onPaneScroll:ee,onPaneContextMenu:te,paneClickDistance:pe,nodeClickDistance:ue,onEdgeContextMenu:me,onEdgeMouseEnter:we,onEdgeMouseMove:le,onEdgeMouseLeave:ye,reconnectRadius:be,onReconnect:Be,onReconnectStart:Ve,onReconnectEnd:Pe,noDragClassName:lt,noWheelClassName:Rt,noPanClassName:gt,disableKeyboardA11y:nt,nodeExtent:ct,rfId:de,viewport:Se,onViewportChange:Ee,nodesDraggable:Le}){return AS(e),AS(t),wF(),pF(n),mF(Se),v.jsx(HH,{onPaneClick:ie,onPaneMouseEnter:se,onPaneMouseMove:Z,onPaneMouseLeave:P,onPaneContextMenu:te,onPaneScroll:ee,paneClickDistance:pe,deleteKeyCode:N,selectionKeyCode:x,selectionOnDrag:y,selectionMode:k,onSelectionStart:m,onSelectionEnd:_,multiSelectionKeyCode:D,panActivationKeyCode:T,zoomActivationKeyCode:R,elementsSelectable:I,zoomOnScroll:X,zoomOnPinch:K,zoomOnDoubleClick:$,panOnScroll:O,panOnScrollSpeed:M,panOnScrollMode:j,panOnDrag:U,autoPanOnSelection:Q,defaultViewport:F,translateExtent:V,minZoom:H,maxZoom:z,onSelectionContextMenu:d,preventScrolling:q,noDragClassName:lt,noWheelClassName:Rt,noPanClassName:gt,disableKeyboardA11y:nt,onViewportChange:Ee,isControlledViewport:!!Se,children:v.jsxs(dF,{children:[v.jsx(fF,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:c,onReconnect:Be,onReconnectStart:Ve,onReconnectEnd:Pe,onlyRenderVisibleElements:L,onEdgeContextMenu:me,onEdgeMouseEnter:we,onEdgeMouseMove:le,onEdgeMouseLeave:ye,reconnectRadius:be,defaultMarkerColor:G,noPanClassName:gt,disableKeyboardA11y:nt,rfId:de}),v.jsx(SF,{style:C,type:w,component:b,containerStyle:S}),v.jsx("div",{className:"react-flow__edgelabel-renderer"}),v.jsx(WH,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:l,onNodeMouseEnter:o,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:g,nodeClickDistance:ue,onlyRenderVisibleElements:L,noPanClassName:gt,noDragClassName:lt,disableKeyboardA11y:nt,nodeExtent:ct,rfId:de,nodesDraggable:Le}),v.jsx("div",{className:"react-flow__viewport-portal"})]})})}zE.displayName="GraphView";const CF=Y.memo(zE),EF=FC(),TS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:c,fitViewOptions:o,minZoom:u=.5,maxZoom:f=2,nodeOrigin:g,nodeExtent:d,zIndexMode:m="basic"}={})=>{const _=new Map,w=new Map,C=new Map,b=new Map,S=r??t??[],x=n??e??[],y=g??[0,0],k=d??Yo;QC(C,b,S);const{nodesInitialized:D}=fg(x,_,w,{nodeOrigin:y,nodeExtent:k,zIndexMode:m});let T=[0,0,1];if(c&&a&&l){const R=ll(_,{filter:F=>!!((F.width||F.initialWidth)&&(F.height||F.initialHeight))}),{x:N,y:L,zoom:I}=Mm(R,a,l,u,f,(o==null?void 0:o.padding)??.1);T=[N,L,I]}return{rfId:"1",width:a??0,height:l??0,transform:T,nodes:x,nodesInitialized:D,nodeLookup:_,parentLookup:w,edges:S,edgeLookup:b,connectionLookup:C,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:f,translateExtent:Yo,nodeExtent:k,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:oa.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:c??!1,fitViewOptions:o,fitViewResolver:null,connection:{...LC},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:EF,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:MC,zIndexMode:m,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},kF=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:c,fitViewOptions:o,minZoom:u,maxZoom:f,nodeOrigin:g,nodeExtent:d,zIndexMode:m})=>zz((_,w)=>{async function C(){const{nodeLookup:b,panZoom:S,fitViewOptions:x,fitViewResolver:y,width:k,height:D,minZoom:T,maxZoom:R}=w();S&&(await O9({nodes:b,width:k,height:D,panZoom:S,minZoom:T,maxZoom:R},x),y==null||y.resolve(!0),_({fitViewResolver:null}))}return{...TS({nodes:e,edges:t,width:a,height:l,fitView:c,fitViewOptions:o,minZoom:u,maxZoom:f,nodeOrigin:g,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:m}),setNodes:b=>{const{nodeLookup:S,parentLookup:x,nodeOrigin:y,elevateNodesOnSelect:k,fitViewQueued:D,zIndexMode:T,nodesSelectionActive:R}=w(),{nodesInitialized:N,hasSelectedNodes:L}=fg(b,S,x,{nodeOrigin:y,nodeExtent:d,elevateNodesOnSelect:k,checkEquality:!0,zIndexMode:T}),I=R&&L;D&&N?(C(),_({nodes:b,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:I})):_({nodes:b,nodesInitialized:N,nodesSelectionActive:I})},setEdges:b=>{const{connectionLookup:S,edgeLookup:x}=w();QC(S,x,b),_({edges:b})},setDefaultNodesAndEdges:(b,S)=>{if(b){const{setNodes:x}=w();x(b),_({hasDefaultNodes:!0})}if(S){const{setEdges:x}=w();x(S),_({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:S,nodeLookup:x,parentLookup:y,domNode:k,nodeOrigin:D,nodeExtent:T,debug:R,fitViewQueued:N,zIndexMode:L}=w(),{changes:I,updatedInternals:F}=iz(b,x,y,k,D,T,L);F&&(J9(x,y,{nodeOrigin:D,nodeExtent:T,zIndexMode:L}),N?(C(),_({fitViewQueued:!1,fitViewOptions:void 0})):_({}),(I==null?void 0:I.length)>0&&(R&&console.log("React Flow: trigger node changes",I),S==null||S(I)))},updateNodePositions:(b,S=!1)=>{const x=[];let y=[];const{nodeLookup:k,triggerNodeChanges:D,connection:T,updateConnection:R,onNodesChangeMiddlewareMap:N}=w();for(const[L,I]of b){const F=k.get(L),V=!!(F!=null&&F.expandParent&&(F!=null&&F.parentId)&&(I!=null&&I.position)),H={id:L,type:"position",position:V?{x:Math.max(0,I.position.x),y:Math.max(0,I.position.y)}:I.position,dragging:S};if(F&&T.inProgress&&T.fromNode.id===F.id){const z=ns(F,T.fromHandle,Te.Left,!0);R({...T,from:z})}V&&F.parentId&&x.push({id:L,parentId:F.parentId,rect:{...I.internals.positionAbsolute,width:I.measured.width??0,height:I.measured.height??0}}),y.push(H)}if(x.length>0){const{parentLookup:L,nodeOrigin:I}=w(),F=zm(x,k,L,I);y.push(...F)}for(const L of N.values())y=L(y);D(y)},triggerNodeChanges:b=>{const{onNodesChange:S,setNodes:x,nodes:y,hasDefaultNodes:k,debug:D}=w();if(b!=null&&b.length){if(k){const T=sH(b,y);x(T)}D&&console.log("React Flow: trigger node changes",b),S==null||S(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:S,setEdges:x,edges:y,hasDefaultEdges:k,debug:D}=w();if(b!=null&&b.length){if(k){const T=aH(b,y);x(T)}D&&console.log("React Flow: trigger edge changes",b),S==null||S(b)}},addSelectedNodes:b=>{const{multiSelectionActive:S,edgeLookup:x,nodeLookup:y,triggerNodeChanges:k,triggerEdgeChanges:D}=w();if(S){const T=b.map(R=>Vr(R,!0));k(T);return}k(ea(y,new Set([...b]),!0)),D(ea(x))},addSelectedEdges:b=>{const{multiSelectionActive:S,edgeLookup:x,nodeLookup:y,triggerNodeChanges:k,triggerEdgeChanges:D}=w();if(S){const T=b.map(R=>Vr(R,!0));D(T);return}D(ea(x,new Set([...b]))),k(ea(y,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:S}={})=>{const{edges:x,nodes:y,nodeLookup:k,triggerNodeChanges:D,triggerEdgeChanges:T}=w(),R=b||y,N=S||x,L=[];for(const F of R){if(!F.selected)continue;const V=k.get(F.id);V&&(V.selected=!1),L.push(Vr(F.id,!1))}const I=[];for(const F of N)F.selected&&I.push(Vr(F.id,!1));D(L),T(I)},setMinZoom:b=>{const{panZoom:S,maxZoom:x}=w();S==null||S.setScaleExtent([b,x]),_({minZoom:b})},setMaxZoom:b=>{const{panZoom:S,minZoom:x}=w();S==null||S.setScaleExtent([x,b]),_({maxZoom:b})},setTranslateExtent:b=>{var S;(S=w().panZoom)==null||S.setTranslateExtent(b),_({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:S,triggerNodeChanges:x,triggerEdgeChanges:y,elementsSelectable:k}=w();if(!k)return;const D=S.reduce((R,N)=>N.selected?[...R,Vr(N.id,!1)]:R,[]),T=b.reduce((R,N)=>N.selected?[...R,Vr(N.id,!1)]:R,[]);x(D),y(T)},setNodeExtent:b=>{const{nodes:S,nodeLookup:x,parentLookup:y,nodeOrigin:k,elevateNodesOnSelect:D,nodeExtent:T,zIndexMode:R}=w();b[0][0]===T[0][0]&&b[0][1]===T[0][1]&&b[1][0]===T[1][0]&&b[1][1]===T[1][1]||(fg(S,x,y,{nodeOrigin:k,nodeExtent:b,elevateNodesOnSelect:D,checkEquality:!1,zIndexMode:R}),_({nodeExtent:b}))},panBy:b=>{const{transform:S,width:x,height:y,panZoom:k,translateExtent:D}=w();return rz({delta:b,panZoom:k,transform:S,translateExtent:D,width:x,height:y})},setCenter:async(b,S,x)=>{const{width:y,height:k,maxZoom:D,panZoom:T}=w();if(!T)return!1;const R=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:D;return await T.setViewport({x:y/2-b*R,y:k/2-S*R,zoom:R},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{_({connection:{...LC}})},updateConnection:b=>{_({connection:b})},reset:()=>_({...TS()})}},Object.is);function AF({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:a,initialHeight:l,initialMinZoom:c,initialMaxZoom:o,initialFitViewOptions:u,fitView:f,nodeOrigin:g,nodeExtent:d,zIndexMode:m,children:_}){const[w]=Y.useState(()=>kF({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:f,minZoom:c,maxZoom:o,fitViewOptions:u,nodeOrigin:g,nodeExtent:d,zIndexMode:m}));return v.jsx(Hz,{value:w,children:v.jsx(hH,{children:v.jsx(kH,{children:_})})})}function TF({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:a,width:l,height:c,fitView:o,fitViewOptions:u,minZoom:f,maxZoom:g,nodeOrigin:d,nodeExtent:m,zIndexMode:_}){return Y.useContext(yh)?v.jsx(v.Fragment,{children:e}):v.jsx(AF,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:a,initialWidth:l,initialHeight:c,fitView:o,initialFitViewOptions:u,initialMinZoom:f,initialMaxZoom:g,nodeOrigin:d,nodeExtent:m,zIndexMode:_,children:e})}const NF={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function DF({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:l,edgeTypes:c,onNodeClick:o,onEdgeClick:u,onInit:f,onMove:g,onMoveStart:d,onMoveEnd:m,onConnect:_,onConnectStart:w,onConnectEnd:C,onClickConnectStart:b,onClickConnectEnd:S,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:k,onNodeContextMenu:D,onNodeDoubleClick:T,onNodeDragStart:R,onNodeDrag:N,onNodeDragStop:L,onNodesDelete:I,onEdgesDelete:F,onDelete:V,onSelectionChange:H,onSelectionDragStart:z,onSelectionDrag:q,onSelectionDragStop:G,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:O,onBeforeDelete:M,connectionMode:j,connectionLineType:$=vr.Bezier,connectionLineStyle:U,connectionLineComponent:Q,connectionLineContainerStyle:ie,deleteKeyCode:se="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:P=!1,selectionMode:ee=Wo.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:pe=Ko()?"Meta":"Control",zoomActivationKeyCode:ue=Ko()?"Meta":"Control",snapToGrid:me,snapGrid:we,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:ye,nodesDraggable:be,autoPanOnNodeFocus:Be,nodesConnectable:Ve,nodesFocusable:Pe,nodeOrigin:lt=hE,edgesFocusable:Rt,edgesReconnectable:gt,elementsSelectable:nt=!0,defaultViewport:ct=Qz,minZoom:de=.5,maxZoom:Se=2,translateExtent:Ee=Yo,preventScrolling:Le=!0,nodeExtent:je,defaultMarkerColor:Ct="#b1b1b7",zoomOnScroll:Ue=!0,zoomOnPinch:Tt=!0,panOnScroll:Et=!1,panOnScrollSpeed:$t=.5,panOnScrollMode:it=Kr.Free,zoomOnDoubleClick:he=!0,panOnDrag:Ce=!0,onPaneClick:Oe,onPaneMouseEnter:Xe,onPaneMouseMove:Je,onPaneMouseLeave:nn,onPaneScroll:jt,onPaneContextMenu:Hi,paneClickDistance:wr=1,nodeClickDistance:wh=0,children:hl,onReconnect:_a,onReconnectStart:Cr,onReconnectEnd:Ch,onEdgeContextMenu:fl,onEdgeDoubleClick:dl,onEdgeMouseEnter:pl,onEdgeMouseMove:va,onEdgeMouseLeave:ya,reconnectRadius:gl=10,onNodesChange:ml,onEdgesChange:ei,noDragClassName:Gt="nodrag",noWheelClassName:Qt="nowheel",noPanClassName:di="nopan",fitView:os,fitViewOptions:_l,connectOnClick:Eh,attributionPosition:vl,proOptions:Er,defaultEdgeOptions:ba,elevateNodesOnSelect:Fi=!0,elevateEdgesOnSelect:Pi=!1,disableKeyboardA11y:Ui=!1,autoPanOnConnect:$i,autoPanOnNodeDrag:Bt,autoPanOnSelection:yl=!0,autoPanSpeed:bl,connectionRadius:pi,isValidConnection:Gi,onError:kh,style:Sl,id:Sa,nodeDragThreshold:Ah,connectionDragThreshold:ls,viewport:cs,onViewportChange:$n,width:an,height:xl,colorMode:Th="light",debug:xa,onScroll:kr,ariaLabelConfig:us,zIndexMode:wl="basic",...on},wa){const hs=Sa||"1",Ca=nH(Th),qi=Y.useCallback(Ea=>{Ea.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),kr==null||kr(Ea)},[kr]);return v.jsx("div",{"data-testid":"rf__wrapper",...on,onScroll:qi,style:{...Sl,...NF},ref:wa,className:Ut(["react-flow",a,Ca]),id:Sa,role:"application",children:v.jsxs(TF,{nodes:e,edges:t,width:an,height:xl,fitView:os,fitViewOptions:_l,minZoom:de,maxZoom:Se,nodeOrigin:lt,nodeExtent:je,zIndexMode:wl,children:[v.jsx(tH,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:_,onConnectStart:w,onConnectEnd:C,onClickConnectStart:b,onClickConnectEnd:S,nodesDraggable:be,autoPanOnNodeFocus:Be,nodesConnectable:Ve,nodesFocusable:Pe,edgesFocusable:Rt,edgesReconnectable:gt,elementsSelectable:nt,elevateNodesOnSelect:Fi,elevateEdgesOnSelect:Pi,minZoom:de,maxZoom:Se,nodeExtent:je,onNodesChange:ml,onEdgesChange:ei,snapToGrid:me,snapGrid:we,connectionMode:j,translateExtent:Ee,connectOnClick:Eh,defaultEdgeOptions:ba,fitView:os,fitViewOptions:_l,onNodesDelete:I,onEdgesDelete:F,onDelete:V,onNodeDragStart:R,onNodeDrag:N,onNodeDragStop:L,onSelectionDrag:q,onSelectionDragStart:z,onSelectionDragStop:G,onMove:g,onMoveStart:d,onMoveEnd:m,noPanClassName:di,nodeOrigin:lt,rfId:hs,autoPanOnConnect:$i,autoPanOnNodeDrag:Bt,autoPanSpeed:bl,onError:kh,connectionRadius:pi,isValidConnection:Gi,selectNodesOnDrag:ye,nodeDragThreshold:Ah,connectionDragThreshold:ls,onBeforeDelete:M,debug:xa,ariaLabelConfig:us,zIndexMode:wl}),v.jsx(CF,{onInit:f,onNodeClick:o,onEdgeClick:u,onNodeMouseEnter:x,onNodeMouseMove:y,onNodeMouseLeave:k,onNodeContextMenu:D,onNodeDoubleClick:T,nodeTypes:l,edgeTypes:c,connectionLineType:$,connectionLineStyle:U,connectionLineComponent:Q,connectionLineContainerStyle:ie,selectionKeyCode:Z,selectionOnDrag:P,selectionMode:ee,deleteKeyCode:se,multiSelectionKeyCode:pe,panActivationKeyCode:te,zoomActivationKeyCode:ue,onlyRenderVisibleElements:le,defaultViewport:ct,translateExtent:Ee,minZoom:de,maxZoom:Se,preventScrolling:Le,zoomOnScroll:Ue,zoomOnPinch:Tt,zoomOnDoubleClick:he,panOnScroll:Et,panOnScrollSpeed:$t,panOnScrollMode:it,panOnDrag:Ce,autoPanOnSelection:yl,onPaneClick:Oe,onPaneMouseEnter:Xe,onPaneMouseMove:Je,onPaneMouseLeave:nn,onPaneScroll:jt,onPaneContextMenu:Hi,paneClickDistance:wr,nodeClickDistance:wh,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:O,onReconnect:_a,onReconnectStart:Cr,onReconnectEnd:Ch,onEdgeContextMenu:fl,onEdgeDoubleClick:dl,onEdgeMouseEnter:pl,onEdgeMouseMove:va,onEdgeMouseLeave:ya,reconnectRadius:gl,defaultMarkerColor:Ct,noDragClassName:Gt,noWheelClassName:Qt,noPanClassName:di,rfId:hs,disableKeyboardA11y:Ui,nodeExtent:je,viewport:cs,onViewportChange:$n,nodesDraggable:be}),v.jsx(Zz,{onSelectionChange:H}),hl,v.jsx(Vz,{proOptions:Er,position:vl}),v.jsx(qz,{rfId:hs,disableKeyboardA11y:Ui})]})})}var RF=dE(DF);function MF({dimensions:e,lineWidth:t,variant:n,className:r}){return v.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ut(["react-flow__background-pattern",n,r])})}function LF({radius:e,className:t}){return v.jsx("circle",{cx:e,cy:e,r:e,className:Ut(["react-flow__background-pattern","dots",t])})}var Oi;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Oi||(Oi={}));const OF={[Oi.Dots]:1,[Oi.Lines]:1,[Oi.Cross]:6},jF=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function HE({id:e,variant:t=Oi.Dots,gap:n=20,size:r,lineWidth:a=1,offset:l=0,color:c,bgColor:o,style:u,className:f,patternClassName:g}){const d=Y.useRef(null),{transform:m,patternId:_}=tt(jF,At),w=r||OF[t],C=t===Oi.Dots,b=t===Oi.Cross,S=Array.isArray(n)?n:[n,n],x=[S[0]*m[2]||1,S[1]*m[2]||1],y=w*m[2],k=Array.isArray(l)?l:[l,l],D=b?[y,y]:x,T=[k[0]*m[2]||1+D[0]/2,k[1]*m[2]||1+D[1]/2],R=`${_}${e||""}`;return v.jsxs("svg",{className:Ut(["react-flow__background",f]),style:{...u,...Sh,"--xy-background-color-props":o,"--xy-background-pattern-color-props":c},ref:d,"data-testid":"rf__background",children:[v.jsx("pattern",{id:R,x:m[0]%x[0],y:m[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:C?v.jsx(LF,{radius:y/2,className:g}):v.jsx(MF,{dimensions:D,lineWidth:a,variant:t,className:g})}),v.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${R})`})]})}HE.displayName="Background";const BF=Y.memo(HE);function IF(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:v.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function zF(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:v.jsx("path",{d:"M0 0h32v4.2H0z"})})}function HF(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:v.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 FF(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.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 PF(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.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 eu({children:e,className:t,...n}){return v.jsx("button",{type:"button",className:Ut(["react-flow__controls-button",t]),...n,children:e})}const UF=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function FE({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:c,onFitView:o,onInteractiveChange:u,className:f,children:g,position:d="bottom-left",orientation:m="vertical","aria-label":_}){const w=wt(),{isInteractive:C,minZoomReached:b,maxZoomReached:S,ariaLabelConfig:x}=tt(UF,At),{zoomIn:y,zoomOut:k,fitView:D}=Hm(),T=()=>{y(),l==null||l()},R=()=>{k(),c==null||c()},N=()=>{D(a),o==null||o()},L=()=>{w.setState({nodesDraggable:!C,nodesConnectable:!C,elementsSelectable:!C}),u==null||u(!C)},I=m==="horizontal"?"horizontal":"vertical";return v.jsxs(bh,{className:Ut(["react-flow__controls",I,f]),position:d,style:e,"data-testid":"rf__controls","aria-label":_??x["controls.ariaLabel"],children:[t&&v.jsxs(v.Fragment,{children:[v.jsx(eu,{onClick:T,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:S,children:v.jsx(IF,{})}),v.jsx(eu,{onClick:R,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:b,children:v.jsx(zF,{})})]}),n&&v.jsx(eu,{className:"react-flow__controls-fitview",onClick:N,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:v.jsx(HF,{})}),r&&v.jsx(eu,{className:"react-flow__controls-interactive",onClick:L,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:C?v.jsx(PF,{}):v.jsx(FF,{})}),g]})}FE.displayName="Controls";Y.memo(FE);function $F({id:e,x:t,y:n,width:r,height:a,style:l,color:c,strokeColor:o,strokeWidth:u,className:f,borderRadius:g,shapeRendering:d,selected:m,onClick:_}){const{background:w,backgroundColor:C}=l||{},b=c||w||C;return v.jsx("rect",{className:Ut(["react-flow__minimap-node",{selected:m},f]),x:t,y:n,rx:g,ry:g,width:r,height:a,style:{fill:b,stroke:o,strokeWidth:u},shapeRendering:d,onClick:_?S=>_(S,e):void 0})}const GF=Y.memo($F),qF=e=>e.nodes.map(t=>t.id),wp=e=>e instanceof Function?e:()=>e;function VF({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l=GF,onClick:c}){const o=tt(qF,At),u=wp(t),f=wp(e),g=wp(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return v.jsx(v.Fragment,{children:o.map(m=>v.jsx(WF,{id:m,nodeColorFunc:u,nodeStrokeColorFunc:f,nodeClassNameFunc:g,nodeBorderRadius:r,nodeStrokeWidth:a,NodeComponent:l,onClick:c,shapeRendering:d},m))})}function YF({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:a,nodeStrokeWidth:l,shapeRendering:c,NodeComponent:o,onClick:u}){const{node:f,x:g,y:d,width:m,height:_}=tt(w=>{const C=w.nodeLookup.get(e);if(!C)return{node:void 0,x:0,y:0,width:0,height:0};const b=C.internals.userNode,{x:S,y:x}=C.internals.positionAbsolute,{width:y,height:k}=fi(b);return{node:b,x:S,y:x,width:y,height:k}},At);return!f||f.hidden||!PC(f)?null:v.jsx(o,{x:g,y:d,width:m,height:_,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:a,strokeColor:n(f),strokeWidth:l,shapeRendering:c,onClick:u,id:f.id})}const WF=Y.memo(YF);var XF=Y.memo(VF);const KF=200,ZF=150,QF=e=>!e.hidden,JF=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?zC(ll(e.nodeLookup,{filter:QF}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},NS=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,eP=(e,t)=>NS(e.viewBB,t.viewBB)&&NS(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,tP="react-flow__minimap-desc";function PE({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:c,nodeComponent:o,bgColor:u,maskColor:f,maskStrokeColor:g,maskStrokeWidth:d,position:m="bottom-right",onClick:_,onNodeClick:w,pannable:C=!1,zoomable:b=!1,ariaLabel:S,inversePan:x,zoomStep:y=1,offsetScale:k=5}){const D=wt(),T=Y.useRef(null),{boundingRect:R,viewBB:N,rfId:L,panZoom:I,translateExtent:F,flowWidth:V,flowHeight:H,ariaLabelConfig:z}=tt(JF,eP),q=(e==null?void 0:e.width)??KF,G=(e==null?void 0:e.height)??ZF,X=R.width/q,K=R.height/G,O=Math.max(X,K),M=O*q,j=O*G,$=k*O,U=R.x-(M-R.width)/2-$,Q=R.y-(j-R.height)/2-$,ie=M+$*2,se=j+$*2,Z=`${tP}-${L}`,P=Y.useRef(0),ee=Y.useRef();P.current=O,Y.useEffect(()=>{if(T.current&&I)return ee.current=dz({domNode:T.current,panZoom:I,getTransform:()=>D.getState().transform,getViewScale:()=>P.current}),()=>{var me;(me=ee.current)==null||me.destroy()}},[I]),Y.useEffect(()=>{var me;(me=ee.current)==null||me.update({translateExtent:F,width:V,height:H,inversePan:x,pannable:C,zoomStep:y,zoomable:b})},[C,b,x,y,F,V,H]);const te=_?me=>{var ye;const[we,le]=((ye=ee.current)==null?void 0:ye.pointer(me))||[0,0];_(me,{x:we,y:le})}:void 0,pe=w?Y.useCallback((me,we)=>{const le=D.getState().nodeLookup.get(we).internals.userNode;w(me,le)},[]):void 0,ue=S??z["minimap.ariaLabel"];return v.jsx(bh,{position:m,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof g=="string"?g: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 n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof c=="number"?c:void 0},className:Ut(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:v.jsxs("svg",{width:q,height:G,viewBox:`${U} ${Q} ${ie} ${se}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:T,onClick:te,children:[ue&&v.jsx("title",{id:Z,children:ue}),v.jsx(XF,{onClick:pe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:o}),v.jsx("path",{className:"react-flow__minimap-mask",d:`M${U-$},${Q-$}h${ie+$*2}v${se+$*2}h${-ie-$*2}z + M${N.x},${N.y}h${N.width}v${N.height}h${-N.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}PE.displayName="MiniMap";Y.memo(PE);const nP=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,iP={[ua.Line]:"right",[ua.Handle]:"bottom-right"};function rP({nodeId:e,position:t,variant:n=ua.Handle,className:r,style:a=void 0,children:l,color:c,minWidth:o=10,minHeight:u=10,maxWidth:f=Number.MAX_VALUE,maxHeight:g=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:m,autoScale:_=!0,shouldResize:w,onResizeStart:C,onResize:b,onResizeEnd:S}){const x=vE(),y=typeof e=="string"?e:x,k=wt(),D=Y.useRef(null),T=n===ua.Handle,R=tt(Y.useCallback(nP(T&&_),[T,_]),At),N=Y.useRef(null),L=t??iP[n];Y.useEffect(()=>{if(!(!D.current||!y))return N.current||(N.current=kz({domNode:D.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:F,transform:V,snapGrid:H,snapToGrid:z,nodeOrigin:q,domNode:G}=k.getState();return{nodeLookup:F,transform:V,snapGrid:H,snapToGrid:z,nodeOrigin:q,paneDomNode:G}},onChange:(F,V)=>{const{triggerNodeChanges:H,nodeLookup:z,parentLookup:q,nodeOrigin:G}=k.getState(),X=[],K={x:F.x,y:F.y},O=z.get(y);if(O&&O.expandParent&&O.parentId){const M=O.origin??G,j=F.width??O.measured.width??0,$=F.height??O.measured.height??0,U={id:O.id,parentId:O.parentId,rect:{width:j,height:$,...UC({x:F.x??O.position.x,y:F.y??O.position.y},{width:j,height:$},O.parentId,z,M)}},Q=zm([U],z,q,G);X.push(...Q),K.x=F.x?Math.max(M[0]*j,F.x):void 0,K.y=F.y?Math.max(M[1]*$,F.y):void 0}if(K.x!==void 0&&K.y!==void 0){const M={id:y,type:"position",position:{...K}};X.push(M)}if(F.width!==void 0&&F.height!==void 0){const j={id:y,type:"dimensions",resizing:!0,setAttributes:m?m==="horizontal"?"width":"height":!0,dimensions:{width:F.width,height:F.height}};X.push(j)}for(const M of V){const j={...M,type:"position"};X.push(j)}H(X)},onEnd:({width:F,height:V})=>{const H={id:y,type:"dimensions",resizing:!1,dimensions:{width:F,height:V}};k.getState().triggerNodeChanges([H])}})),N.current.update({controlPosition:L,boundaries:{minWidth:o,minHeight:u,maxWidth:f,maxHeight:g},keepAspectRatio:d,resizeDirection:m,onResizeStart:C,onResize:b,onResizeEnd:S,shouldResize:w}),()=>{var F;(F=N.current)==null||F.destroy()}},[L,o,u,f,g,d,C,b,S,w]);const I=L.split("-");return v.jsx("div",{className:Ut(["react-flow__resize-control","nodrag",...I,n,r]),ref:D,style:{...a,scale:R,...c&&{[T?"backgroundColor":"borderColor"]:c}},children:l})}Y.memo(rP);const gg=240,sP=132,pu=44,aP=72;function oP(e){const t=new Map(e.map(l=>[l.id,{exp:l,children:[]}])),n=[];for(const l of e){const c=t.get(l.id),o=l.parentExperimentId?t.get(l.parentExperimentId):void 0;o?o.children.push(c):n.push(c)}const r=(l,c)=>l.exp.createdAt-c.exp.createdAt,a=l=>{l.children.sort(r),l.children.forEach(a)};return n.sort(r),n.forEach(a),n}function gu(e){if(e.children.length===0)return gg;const t=e.children.reduce((n,r)=>n+gu(r),0)+pu*(e.children.length-1);return Math.max(gg,t)}function lP(e){return e==="done"?"pass":e==="failed"?"fail":e==="running"||e==="starting"?"live":"other"}const cP=Y.memo(function({data:t}){const{exp:n,latestRun:r,runs:a,isBaseline:l,selected:c,onOpenView:o}=t,u=r==null?void 0:r.status,f=u==="running"||u==="starting",g=l?"BASELINE":f?"RUNNING":"EXPERIMENT",d=a.slice(-8);return v.jsxs("div",{className:`exp-node ${c?"selected":""} ${f?"live":""}`,children:[v.jsx(ha,{type:"target",position:Te.Top}),v.jsxs("div",{className:"node-eyebrow",children:[v.jsx("span",{children:g}),v.jsx(zo,{status:u??"idle"})]}),v.jsx("div",{className:"node-head",children:v.jsx("span",{className:"node-slug",children:n.slug})}),(n.title||n.description)&&v.jsx("div",{className:"node-title",children:n.title||n.description}),v.jsxs("div",{className:"node-meta",children:[v.jsx("span",{children:"RUNS"}),d.length>0?v.jsx("span",{className:"run-squares",children:d.map(m=>v.jsx("span",{className:`run-sq ${lP(m.status)}`,title:m.status},m.id))}):v.jsx("span",{children:"no runs"}),v.jsx("span",{style:{flex:1}}),r&&v.jsx("span",{children:fa(r.createdAt)})]}),v.jsxs("div",{className:"node-actions",onClick:m=>m.stopPropagation(),children:[v.jsxs("button",{className:"node-action",title:"Open changes",onClick:()=>o(n.id,"changes"),children:[v.jsx(zu,{size:13}),"Changes"]}),a.length>0&&v.jsxs("button",{className:"node-action",title:"Open terminal",onClick:()=>o(n.id,"terminal"),children:[v.jsx(zS,{size:13}),"Terminal"]})]}),v.jsx(ha,{type:"source",position:Te.Bottom})]})}),uP={exp:cP},hP={type:"default",style:{stroke:"var(--text)",strokeWidth:1.5,opacity:.3}};function fP({experiments:e,runs:t,selectedId:n,onSelect:r,onOpenView:a}){const{nodes:l,edges:c}=Y.useMemo(()=>{const o=new Map;for(const _ of t){const w=o.get(_.experimentId);w?w.push(_):o.set(_.experimentId,[_])}for(const _ of o.values())_.sort((w,C)=>w.createdAt-C.createdAt);const u=[],f=[],g=oP(e);function d(_,w,C){const b=o.get(_.exp.id)??[];if(u.push({id:_.exp.id,type:"exp",position:{x:w-gg/2,y:C},data:{exp:_.exp,latestRun:b[b.length-1]??null,runs:b,isBaseline:!_.exp.parentExperimentId,selected:_.exp.id===n,onOpenView:a}}),_.children.length===0)return;const S=_.children.reduce((y,k)=>y+gu(k),0)+pu*(_.children.length-1);let x=w-S/2;for(const y of _.children){const k=gu(y);f.push({id:`e-${_.exp.id}-${y.exp.id}`,source:_.exp.id,target:y.exp.id}),d(y,x+k/2,C+sP+aP),x+=k+pu}}let m=0;for(const _ of g){const w=gu(_);d(_,m+w/2,0),m+=w+pu}return{nodes:u,edges:f}},[e,t,n,a]);return e.length===0?v.jsxs("div",{className:"empty-state empty-state-cta",children:[v.jsx("p",{className:"empty-state-title",children:"No experiments yet"}),v.jsx("p",{className:"empty-state-hint",children:"Ask the agent in chat to create and run your first experiment."})]}):v.jsx(RF,{nodes:l,edges:c,nodeTypes:uP,defaultEdgeOptions:hP,nodesDraggable:!1,nodesConnectable:!1,minZoom:.15,fitView:!0,fitViewOptions:{padding:.25,maxZoom:1},onNodeClick:(o,u)=>r(u.id),onPaneClick:()=>r(null),children:v.jsx(BF,{variant:Oi.Dots,color:"var(--dots-strong)",gap:28,size:1.6})})}const tu=(e,t)=>e.id===t.id&&e.view===t.view,nu=(e,t)=>e.path===t.path&&e.sessionId===t.sessionId,DS=e=>`${e.sessionId??""}:${e.path}`;function dP(e,t,n){let r=e,a;const l=t==null?void 0:t.replace(/\/+$/,"");if(!r.startsWith("/"))a=n;else if(l&&(r===l||r.startsWith(`${l}/`)))r=r.slice(l.length).replace(/^\/+/,"");else{const c=r.match(/\/openresearch\/worktrees\/[^/]+\/[^/]+\/([^/]+)\/(.+)$/),o=c?null:r.match(/\/openresearch\/repos\/[^/]+\/[^/]+\/(.+)$/);c?(a=c[1],r=c[2]):o&&(r=o[1])}return r?{path:r,sessionId:a}:null}const RS="orx:onboarded",UE="orx:panel-width",ju=360,pP=10,gP=232,mP=380,_P=gP+56,vP=80;function mg(){return Math.max(ju,window.innerWidth-_P-mP)}function yP(){const e=mg();try{const t=Number(localStorage.getItem(UE));if(Number.isFinite(t)&&t>=ju)return Math.min(t,e)}catch{}return Math.max(ju,Math.min(760,e,Math.round(window.innerWidth*.42)))}function iu(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const r=e.slice();return r[n]=t,r}function bP(){var me,we;const[e,t]=Y.useState(null),[n,r]=Y.useState(null),[a,l]=Y.useState([]),[c,o]=Y.useState([]),[u,f]=Y.useState(null),[g,d]=Y.useState("tree"),[m,_]=Y.useState(null),[w,C]=Y.useState(null),[b,S]=Y.useState("experiments"),[x,y]=Y.useState([]),[k,D]=Y.useState([]),[T,R]=Y.useState(!0),[N,L]=Y.useState(!1),[I,F]=Y.useState(yP),[V,H]=Y.useState(!0),[z,q]=Y.useState(!1),[G,X]=Y.useState("chat"),[K,O]=Y.useState(()=>{try{return localStorage.getItem(RS)==="1"}catch{return!0}}),M=Y.useRef(n);M.current=n,Y.useEffect(()=>{cT().then(le=>{t(le),r(ye=>{var be;return ye??((be=le[0])==null?void 0:be.id)??null})}).catch(()=>t([]))},[]),Y.useEffect(()=>{const le=()=>F(ye=>Math.min(ye,mg()));return window.addEventListener("resize",le),()=>window.removeEventListener("resize",le)},[]),Y.useEffect(()=>{n&&(dT(n).catch(()=>{}),l([]),o([]),f(null),_(null),C(null),y([]),D([]),S("experiments"),gT(n).then(l).catch(()=>{}),mT(n).then(o).catch(()=>{}),Oy(n).then(f).catch(()=>{}))},[n]);const j=Y.useCallback(()=>{const le=M.current;le&&Oy(le).then(f).catch(()=>{})},[]);oN({onRun:le=>{le.projectId===M.current&&o(ye=>iu(ye,le))},onExperiment:le=>{le.projectId===M.current&&l(ye=>iu(ye,le))},onProject:le=>{t(ye=>ye?iu(ye,le):[le])},onFiles:le=>{le===M.current&&j()}});const $=Y.useCallback((le,ye="changes")=>{_(le);const be={id:le,view:ye};y(Be=>Be.some(Ve=>tu(Ve,be))?Be:[...Be,be]),S(be),R(!0)},[]),U=Y.useCallback(le=>{const ye=x.findIndex(Be=>tu(Be,le));if(ye===-1)return;const be=x.filter((Be,Ve)=>Ve!==ye);y(be),typeof b=="object"&&"view"in b&&tu(b,le)&&S(be[Math.min(ye,be.length-1)]??"experiments")},[x,b]),Q=Y.useCallback((le,ye)=>{var Ve;const be=(Ve=e==null?void 0:e.find(Pe=>Pe.id===n))==null?void 0:Ve.repoPath,Be=dP(le,be,ye);Be&&(D(Pe=>Pe.some(lt=>nu(lt,Be))?Pe:[...Pe,Be]),S(Be),R(!0))},[e,n]),ie=Y.useCallback(le=>{const ye=k.findIndex(Be=>nu(Be,le));if(ye===-1)return;const be=k.filter((Be,Ve)=>Ve!==ye);D(be),typeof b=="object"&&"path"in b&&nu(b,le)&&S(be[Math.min(ye,be.length-1)]??"experiments")},[k,b]),se=le=>{le.preventDefault(),le.currentTarget.setPointerCapture(le.pointerId);const ye=document.body.style.userSelect;document.body.style.userSelect="none";const be=Ve=>{const Pe=Math.round(window.innerWidth-Ve.clientX-pP),lt=mg();if(Pe>lt+vP){L(!0);return}L(!1);const Rt=Math.min(Math.max(Pe,ju),lt);F(Rt);try{localStorage.setItem(UE,String(Rt))}catch{}},Be=()=>{window.removeEventListener("pointermove",be),window.removeEventListener("pointerup",Be),window.removeEventListener("pointercancel",Be),document.body.style.userSelect=ye};window.addEventListener("pointermove",be),window.addEventListener("pointerup",Be),window.addEventListener("pointercancel",Be)},Z=le=>{t(ye=>ye?iu(ye,le):[le]),r(le.id),q(!1)},P=le=>{t(ye=>ye&&ye.filter(be=>be.id!==le)),n===le&&r(null)},ee=typeof b=="object"&&"view"in b?b:null,te=typeof b=="object"&&"path"in b?b:null,pe=ee?a.find(le=>le.id===ee.id)??null:null;if(e===null)return v.jsx("div",{className:"app",children:v.jsx("div",{className:"empty-state",children:v.jsx("span",{className:"spinner"})})});if(e.length===0)return v.jsx("div",{className:"app",children:K?v.jsx(bb,{projects:e,onOpen:r,onCreated:Z,onDeleted:P}):v.jsx(F8,{onDone:()=>{try{localStorage.setItem(RS,"1")}catch{}O(!0)}})});const ue=v.jsx(H8,{projectName:((me=e.find(le=>le.id===n))==null?void 0:me.name)??"",onHome:()=>q(!0),onCollapse:()=>H(!1)});return v.jsx("div",{className:"app",children:z?v.jsx(bb,{projects:e,onOpen:le=>{r(le),q(!1)},onCreated:Z,onDeleted:P}):v.jsxs("div",{className:"app-body",children:[n&&v.jsx(tO,{projectId:n,paperId:(we=e.find(le=>le.id===n))==null?void 0:we.paperId,railHeader:ue,railOpen:V,onShowRail:()=>H(!0),mainView:G,onSelectMainView:X,panelOpen:T,onTogglePanel:()=>{T&&L(!1),R(!T)},onOpenFile:Q,children:G==="files"?(()=>{const le=e.find(ye=>ye.id===n);return le?v.jsx(uO,{project:le,files:u,onChanged:j,onOpenStorage:()=>X("storage")}):null})():G!=="chat"?v.jsx(PL,{tab:G}):null}),G==="chat"&&T&&v.jsxs("aside",{className:`right-pane floating-panel ${N?"max":""}`,style:N?void 0:{width:I},children:[!N&&v.jsx("div",{className:"panel-resizer",onPointerDown:se}),v.jsxs("div",{className:"tabs",children:[v.jsxs("div",{className:"tab-strip",children:[v.jsx("button",{className:`tab ${b==="experiments"?"active":""}`,onClick:()=>S("experiments"),children:"Experiments"}),x.map(le=>{const ye=a.find(be=>be.id===le.id);return v.jsx(H1,{active:ee!==null&&tu(ee,le),label:ye?ye.title||ye.slug:"…",icon:le.view==="terminal"?v.jsx(zS,{size:12,style:{flexShrink:0}}):v.jsx(zu,{size:12,style:{flexShrink:0}}),onSelect:()=>{S(le),_(le.id)},onClose:()=>U(le)},`${le.id}:${le.view}`)}),k.map(le=>v.jsx(H1,{active:te!==null&&nu(te,le),label:le.path.split("/").pop()||le.path,icon:v.jsx(jS,{size:12,style:{flexShrink:0}}),onSelect:()=>S(le),onClose:()=>ie(le)},`file:${DS(le)}`))]}),v.jsxs("div",{className:"panel-controls",children:[v.jsx("button",{className:"icon-btn",title:N?"Restore panel":"Expand panel","aria-label":N?"Restore panel":"Expand panel",onClick:()=>L(le=>!le),children:N?v.jsx(KA,{size:14}):v.jsx(WA,{size:14})}),v.jsx("button",{className:"icon-btn",title:"Close panel","aria-label":"Close panel",onClick:()=>{R(!1),L(!1)},children:v.jsx(Mo,{size:14})})]})]}),b==="experiments"?v.jsxs("div",{className:"tab-body",children:[v.jsx("div",{className:"pane-toolbar",children:v.jsxs("div",{className:"seg",children:[v.jsx("button",{className:g==="tree"?"active":"",onClick:()=>d("tree"),children:"Tree"}),v.jsx("button",{className:g==="table"?"active":"",onClick:()=>d("table"),children:"Table"})]})}),v.jsx("div",{className:"pane-content",children:g==="tree"?v.jsx(fP,{experiments:a,runs:c,selectedId:m,onSelect:le=>{C(null),_(le)},onOpenView:$}):v.jsx(K8,{runs:c,experiments:a,onOpen:le=>{C(le.id),$(le.experimentId,"terminal")},onOpenChanges:le=>$(le,"changes"),onCancel:le=>void FS(le).catch(()=>{})})})]}):te?v.jsx("div",{className:"tab-body",children:n&&v.jsx(z8,{projectId:n,path:te.path,sessionId:te.sessionId,onOpenFile:Q},DS(te))}):v.jsx("div",{className:"tab-body",children:ee&&pe&&v.jsx(O8,{experiment:pe,view:ee.view,runs:c,selectedRunId:w,onSelectRun:C},`${ee.id}:${ee.view}`)})]})]})})}iA.createRoot(document.getElementById("root")).render(v.jsx(Y.StrictMode,{children:v.jsx(bP,{})})); diff --git a/ui/dist/index.html b/ui/dist/index.html index 99ee969c..81cc0306 100644 --- a/ui/dist/index.html +++ b/ui/dist/index.html @@ -8,8 +8,8 @@ html { background: #ffffff; } @media (prefers-color-scheme: dark) { html { background: #0e0c0c; } } - - + +
diff --git a/ui/src/App.tsx b/ui/src/App.tsx index fc1f2fe2..6fca5ef6 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -395,7 +395,12 @@ export default function App() { (() => { const project = projects.find((p) => p.id === projectId); return project ? ( - + setMainView("storage")} + /> ) : null; })() ) : mainView !== "chat" ? ( diff --git a/ui/src/api.ts b/ui/src/api.ts index d7b032af..9cc34b4b 100644 --- a/ui/src/api.ts +++ b/ui/src/api.ts @@ -325,6 +325,40 @@ export const deleteEnvVar = (key: string) => .then((r) => json<{ vars: EnvVar[] }>(r)) .then((r) => r.vars); +/** Where `source` says the resolved data dir came from. `env` means the + * `$ORX_DATA_DIR` override forces it — the UI shows the field read-only. */ +export type DataDirSource = "env" | "config" | "xdg" | "default"; + +export interface DataDirSettings { + current: string; + defaultPath: string; + isDefault: boolean; + source: DataDirSource; +} + +export const getDataDir = () => get("/api/settings/data-dir"); + +export interface DataDirValidation { + ok: boolean; + error?: string; + treeBytes?: number; + freeBytes?: number; + sameFilesystem?: boolean; +} + +export const validateDataDir = (path: string) => + post("/api/settings/data-dir/validate", { path }); + +/** Set the path without moving (onboarding / already-populated target). */ +export const setDataDir = (path: string) => + post("/api/settings/data-dir", { path }); + +/** Kick off a relocate. Resolves once the move has *started* (HTTP 202); watch + * `onDataDirMove` (events.ts) for `progress` / `done` / `error`. Throws on the + * 409 in-flight guard with the server's message. */ +export const moveDataDir = (path: string) => + post<{ started: boolean }>("/api/settings/data-dir/move", { path }); + export interface SshHost { host: string; hostname?: string; @@ -725,6 +759,19 @@ export function fmtDuration(ms: number): string { return `${Math.floor(h / 24)}d ${h % 24}h`; } +/** Compact byte size, e.g. "512 B", "2.0 KB", "5.3 MB". Mirrors the backend's + * `store::human_bytes`. */ +export function fmtBytes(n: number): string { + const units = ["B", "KB", "MB", "GB", "TB"]; + let v = n; + let u = 0; + while (v >= 1024 && u < units.length - 1) { + v /= 1024; + u += 1; + } + return u === 0 ? `${n} B` : `${v.toFixed(1)} ${units[u]}`; +} + export function shortId(id: string): string { return id.length > 10 ? `${id.slice(0, 10)}…` : id; } diff --git a/ui/src/components/ChatPanel.tsx b/ui/src/components/ChatPanel.tsx index 0a23b4d3..3c6adbc5 100644 --- a/ui/src/components/ChatPanel.tsx +++ b/ui/src/components/ChatPanel.tsx @@ -68,6 +68,7 @@ type Action = | { type: "seed"; sessionId: string; messages: ChatMessage[] } | { type: "upsertMessage"; sessionId: string; message: ChatMessage } | { type: "optimisticUser"; sessionId: string; text: string; imageUrls: string[] } + | { type: "dropOptimisticUser"; sessionId: string } | { type: "busy"; sessionId: string; busy: boolean } | { type: "seedBusy"; sessions: string[] } | { type: "forget"; sessionId: string }; @@ -126,6 +127,22 @@ function reducer(state: ChatState, action: Action): ChatState { messagesBySession: { ...state.messagesBySession, [action.sessionId]: [...list, msg] }, }; } + case "dropOptimisticUser": { + // Roll back the last optimistic user bubble when the send failed (e.g. a + // 409 during a data-dir move) — otherwise it lingers until reload since no + // server message ever arrives to replace it. + const list = state.messagesBySession[action.sessionId]; + if (!list?.length) return state; + const last = list[list.length - 1]; + if (last.role !== "user" || !last.id.startsWith(LOCAL_PREFIX)) return state; + return { + ...state, + messagesBySession: { + ...state.messagesBySession, + [action.sessionId]: list.slice(0, -1), + }, + }; + } case "busy": { const busySessions = new Set(state.busySessions); if (action.busy) busySessions.add(action.sessionId); @@ -1008,8 +1025,20 @@ export function ChatPanel({ dataBase64: a.dataUrl.slice(a.dataUrl.indexOf(",") + 1), })); await sendChatMessage(sid, text, turnOpts, images.length ? images : undefined); - } catch { - if (sid) dispatch({ type: "busy", sessionId: sid, busy: false }); + } catch (err) { + if (sid) { + dispatch({ type: "busy", sessionId: sid, busy: false }); + // Roll back the optimistic bubble so a failed send leaves no phantom. + dispatch({ type: "dropOptimisticUser", sessionId: sid }); + } + // Surface the failure and restore the composer so the message isn't lost. + // A data-dir move in progress returns 409 with an explanatory message — + // now a reachable outcome, so it must be shown rather than swallowed. + setDraft((d) => (d ? d : text)); + setAttachments((a) => (a.length ? a : pending)); + window.alert( + `Couldn't send: ${err instanceof Error ? err.message : String(err)}`, + ); } } diff --git a/ui/src/components/FilesTab.tsx b/ui/src/components/FilesTab.tsx index 38adeda6..d6891fbe 100644 --- a/ui/src/components/FilesTab.tsx +++ b/ui/src/components/FilesTab.tsx @@ -5,6 +5,7 @@ import remarkGfm from "remark-gfm"; import { deleteFile, fileUrl, + fmtBytes, getFileReport, type FileEntry, type Project, @@ -28,12 +29,6 @@ function stripFrontmatter(md: string): string { return end === -1 ? md : md.slice(end + 4).replace(/^\r?\n/, ""); } -function fmtBytes(n: number): string { - if (n < 1024) return `${n} B`; - if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`; - return `${(n / (1024 * 1024)).toFixed(1)} MB`; -} - const IMAGE_RE = /\.(png|jpe?g|gif|webp|svg)$/i; /** Depth-first lookup of a tree entry by its dir-relative path. */ @@ -329,10 +324,13 @@ export function FilesTab({ project, files, onChanged, + onOpenStorage, }: { project: Project; files: ProjectFiles | null; onChanged: () => void; + /** Navigate to Settings → Storage (where the data dir can be changed). */ + onOpenStorage: () => void; }) { const [openPath, setOpenPath] = useState(null); const [expanded, setExpanded] = useState>(new Set()); @@ -409,6 +407,9 @@ export function FilesTab({ +

An explorer over this folder — the agent writes each experiment's reports and figures diff --git a/ui/src/components/Onboarding.tsx b/ui/src/components/Onboarding.tsx index cf14b23f..b90d86d1 100644 --- a/ui/src/components/Onboarding.tsx +++ b/ui/src/components/Onboarding.tsx @@ -1,12 +1,15 @@ import { ArrowLeft, ArrowRight, Check, Copy, RefreshCw } from "lucide-react"; import { useEffect, useState } from "react"; import { + getDataDir, getGitSettings, getHarnesses, getTelemetry, modelLabel, + setDataDir, recordTelemetryConsent, setTelemetry, + type DataDirSettings, type GitSettings, type Harness, type TelemetrySettings, @@ -17,9 +20,10 @@ import { GitTokenForm } from "./GitTokenForm"; * model, then the usage-analytics choice, then hand off to the (empty) * projects page. Purely informative — nothing here gates anything. */ export function Onboarding({ onDone }: { onDone: () => void }) { - const [step, setStep] = useState<0 | 1 | 2>(0); + const [step, setStep] = useState<0 | 1 | 2 | 3>(0); const [harnesses, setHarnesses] = useState(null); const [git, setGit] = useState(null); + const [dataDir, setDataDirState] = useState(null); const [telemetry, setTelemetryState] = useState(null); const [checking, setChecking] = useState(false); @@ -28,6 +32,7 @@ export function Onboarding({ onDone }: { onDone: () => void }) { void Promise.allSettled([ getHarnesses(refresh).then(setHarnesses), getGitSettings().then(setGit), + getDataDir().then(setDataDirState), getTelemetry().then(setTelemetryState), ]).finally(() => setChecking(false)); }; @@ -48,7 +53,7 @@ export function Onboarding({ onDone }: { onDone: () => void }) { {step === 0 ? ( <>

- OpenResearch · step 1 of 3 + OpenResearch · step 1 of 4

Your coding agents

@@ -77,7 +82,7 @@ export function Onboarding({ onDone }: { onDone: () => void }) { ) : step === 1 ? ( <>

- OpenResearch · step 2 of 3 + OpenResearch · step 2 of 4

Git & GitHub

@@ -101,10 +106,34 @@ export function Onboarding({ onDone }: { onDone: () => void }) { + ) : step === 2 ? ( + <> +

+ OpenResearch · step 3 of 4 +
+

Where orx keeps your data

+

+ Your local database, run logs, artifacts, and chat attachments live in one folder on + this machine. The default works for most people — change it if you'd rather keep + it on another disk. +

+
+ +
+
+ +
+ +
+ ) : ( <>
- OpenResearch · step 3 of 3 + OpenResearch · step 4 of 4

Usage analytics

@@ -116,7 +145,7 @@ export function Onboarding({ onDone }: { onDone: () => void }) {

-
@@ -282,6 +311,118 @@ function GitCard({ ); } +function StorageCard({ + dataDir, + onUpdate, +}: { + dataDir: DataDirSettings | null; + onUpdate: (d: DataDirSettings) => void; +}) { + const [path, setPath] = useState(""); + const [editing, setEditing] = useState(false); + const [saving, setSaving] = useState(false); + const [error, setError] = useState(null); + + // Seed the input once the current path loads. + useEffect(() => { + if (dataDir && !path) setPath(dataDir.current); + }, [dataDir, path]); + + if (dataDir === null) { + return ( +
+ Checking storage… +
+ ); + } + + // $ORX_DATA_DIR forces the path — nothing to choose here. + if (dataDir.source === "env") { + return ( +
+
+ Data folder + {dataDir.current} + + pinned + +
+
+ Set by the ORX_DATA_DIR environment variable. +
+
+ ); + } + + const trimmed = path.trim(); + const changed = trimmed !== "" && trimmed !== dataDir.current; + + async function save() { + if (saving || !changed) return; + setSaving(true); + setError(null); + try { + onUpdate(await setDataDir(trimmed)); + setEditing(false); + } catch (err) { + setError(err instanceof Error ? err.message : String(err)); + } finally { + setSaving(false); + } + } + + return ( +
+
+ Data folder + {dataDir.current} + + {dataDir.isDefault ? : } + {dataDir.isDefault ? "default" : "custom"} + +
+ {editing ? ( + <> + setPath(e.target.value)} + placeholder="/absolute/path/to/openresearch" + autoComplete="off" + spellCheck={false} + style={{ width: "100%", marginTop: 10 }} + /> + {error &&
{error}
} +
+ + +
+ + ) : ( +
+ The default is fine for most setups. + +
+ )} +
+ ); +} + function TelemetryCard({ telemetry, onUpdate, diff --git a/ui/src/components/SettingsPage.tsx b/ui/src/components/SettingsPage.tsx index f93a381c..efa3bd15 100644 --- a/ui/src/components/SettingsPage.tsx +++ b/ui/src/components/SettingsPage.tsx @@ -3,6 +3,7 @@ import { Cpu, ExternalLink, GitBranch, + HardDrive, Plus, RefreshCw, Server, @@ -13,6 +14,7 @@ import { import { useEffect, useRef, useState } from "react"; import { deleteEnvVar, + fmtBytes, fmtDuration, getEnvVars, getGitSettings, @@ -30,6 +32,11 @@ import { saveK8sSettings, saveSlurmSettings, setEnvVar, + getDataDir, + validateDataDir, + moveDataDir, + type DataDirSettings, + type DataDirValidation, shortId, slurmPreflight, sshPreflight, @@ -50,11 +57,18 @@ import { type SshPreflight, modelLabel, } from "../api"; +import { onDataDirMove } from "../events"; import { GitTokenForm } from "./GitTokenForm"; import { BackendBadge } from "./BackendLogos"; import { StatusBadge } from "./StatusBadge"; -export type SettingsTab = "harnesses" | "compute" | "instances" | "environment" | "git"; +export type SettingsTab = + | "harnesses" + | "compute" + | "instances" + | "environment" + | "git" + | "storage"; type Tab = SettingsTab; // --- harnesses --------------------------------------------------------------- @@ -1308,6 +1322,251 @@ function GitTab() { ); } +// --- storage (data directory) ------------------------------------------------ + +/** Determinate progress bar with a percent + optional byte caption. */ +function ProgressBar({ value, max, label }: { value: number; max: number; label?: string }) { + const pct = max > 0 ? Math.min(100, Math.round((value / max) * 100)) : 0; + return ( +
+
+
+
+
+ {label ?? `${pct}%`} + {max > 0 && ( + + {fmtBytes(value)} / {fmtBytes(max)} + + )} +
+
+ ); +} + +const DATA_DIR_SOURCE_LABEL: Record = { + env: "ORX_DATA_DIR environment variable", + config: "your saved setting", + xdg: "XDG_DATA_HOME", + default: "default location", +}; + +type MoveState = + | { kind: "idle" } + | { kind: "moving"; phase: string; copied: number; total: number } + | { kind: "done"; oldPathLeft?: string } + | { kind: "error"; message: string }; + +function StorageTab() { + const [settings, setSettings] = useState(null); + const [loadError, setLoadError] = useState(null); + const [path, setPath] = useState(""); + const [checking, setChecking] = useState(false); + const [validation, setValidation] = useState(null); + const [move, setMove] = useState({ kind: "idle" }); + const [error, setError] = useState(null); + + const load = () => + getDataDir() + .then((s) => { + setSettings(s); + // Seed the input to the current path only when empty — preserves an + // in-progress edit, and (after a move clears it) re-seeds to the new path. + setPath((p) => (p ? p : s.current)); + }) + .catch((err) => setLoadError(err instanceof Error ? err.message : String(err))); + + useEffect(() => { + void load(); + }, []); + + // Subscribe to move progress streamed over the shared SSE. + useEffect(() => { + return onDataDirMove((ev) => { + if (ev.type === "progress") { + // The "preparing" tick reports total 0 (sized after the checkpoint); + // keep the last known non-zero total so the bar doesn't flicker to 0. + setMove((m) => { + const prevTotal = m.kind === "moving" ? m.total : 0; + return { + kind: "moving", + phase: ev.phase, + copied: ev.copiedBytes, + total: ev.totalBytes || prevTotal, + }; + }); + } else if (ev.type === "done") { + setMove({ kind: "done", oldPathLeft: ev.oldPathLeft }); + setValidation(null); + // Clear so load()'s empty-guard re-seeds the input to the new path. + setPath(""); + void load(); + } else if (ev.type === "error") { + setMove({ kind: "error", message: ev.error }); + } + }); + }, []); + + const envForced = settings?.source === "env"; + const trimmed = path.trim(); + const unchanged = settings !== null && trimmed === settings.current; + + async function check() { + if (checking || !trimmed) return; + setChecking(true); + setError(null); + setValidation(null); + try { + setValidation(await validateDataDir(trimmed)); + } catch (err) { + setError(err instanceof Error ? err.message : String(err)); + } finally { + setChecking(false); + } + } + + async function startMove(e: React.FormEvent) { + e.preventDefault(); + if (move.kind === "moving" || !trimmed || unchanged) return; + setError(null); + // Confirm — this relocates all projects' data. Same-disk moves are atomic; + // cross-disk moves copy and leave the old folder for you to remove. + if ( + !window.confirm( + `Move all orx data to:\n${trimmed}\n\nThe store is copied to the new location and ` + + `activated there. Active runs or chats will block the move.`, + ) + ) + return; + setMove({ kind: "moving", phase: "preparing", copied: 0, total: validation?.treeBytes ?? 0 }); + try { + await moveDataDir(trimmed); + // 202 accepted — progress/done arrive over SSE. Nothing else to do here. + } catch (err) { + // 409 in-flight guard or a validation error surfaces here. + setMove({ kind: "idle" }); + setError(err instanceof Error ? err.message : String(err)); + } + } + + return ( + <> +

Storage

+

+ Where orx keeps everything on this machine — the local database, run logs, artifacts, and + chat attachments for all projects. Moving it copies the whole store to the + new location and activates it there. +

+ {loadError ? ( +
+
{loadError}
+
+ ) : !settings ? ( +
+ Loading… +
+ ) : ( +
+
+

Data directory

+
+ {settings.isDefault ? "default" : "custom"} +
+
+ Current + {settings.current} + Source + {DATA_DIR_SOURCE_LABEL[settings.source]} + {!settings.isDefault && ( + <> + Default + {settings.defaultPath} + + )} +
+ + {envForced ? ( +

+ The data directory is pinned by the ORX_DATA_DIR environment variable, + which overrides this setting. Unset it to choose a location here. +

+ ) : ( +
+ + + {validation && !validation.error && validation.ok && ( +

+ Ready to move {fmtBytes(validation.treeBytes ?? 0)} + {validation.freeBytes != null && ` — ${fmtBytes(validation.freeBytes)} free at target`} + {validation.sameFilesystem ? " (same disk, instant)" : ""}. +

+ )} + {validation && validation.ok === false && validation.error && ( +
{validation.error}
+ )} + {error &&
{error}
} + + {move.kind === "moving" && ( + + )} + {move.kind === "done" && ( +

+ Moved. orx is now using the new location. + {move.oldPathLeft && ( + <> + {" "} + The old copy was left at {move.oldPathLeft} (different disk) — you + can delete it once you've confirmed everything works. + + )} +

+ )} + {move.kind === "error" &&
Move failed: {move.message}
} + +
+ + +
+ + )} +
+ )} + + ); +} + // --- instances --------------------------------------------------------------- const isLive = (status: string) => status === "running" || status === "starting"; @@ -1452,6 +1711,7 @@ export const SETTINGS_NAV: { id: Tab; label: string; icon: React.ReactNode }[] = { id: "instances", label: "Instances", icon: }, { id: "environment", label: "Environment", icon: }, { id: "git", label: "Git", icon: }, + { id: "storage", label: "Storage", icon: }, ]; /** One settings section's content, shown in the middle pane in place of chat. */ @@ -1471,6 +1731,7 @@ export function SettingsView({ tab }: { tab: Tab }) { )} {tab === "instances" && } {tab === "git" && } + {tab === "storage" && }
); } diff --git a/ui/src/events.ts b/ui/src/events.ts index ed14adc1..154a6acd 100644 --- a/ui/src/events.ts +++ b/ui/src/events.ts @@ -52,6 +52,27 @@ function emitChat(ev: ChatEvent) { chatListeners.forEach((fn) => fn(ev)); } +// Data-dir move progress fans out the same way so the Storage settings card can +// subscribe without touching the shared useOrxEvents handler set. +export type DataDirMoveEvent = + | { type: "progress"; phase: string; copiedBytes: number; totalBytes: number } + | { type: "done"; path: string; oldPathLeft?: string } + | { type: "error"; error: string }; + +type DataDirMoveListener = (ev: DataDirMoveEvent) => void; +const dataDirMoveListeners = new Set(); + +export function onDataDirMove(fn: DataDirMoveListener): () => void { + dataDirMoveListeners.add(fn); + return () => { + dataDirMoveListeners.delete(fn); + }; +} + +function emitDataDirMove(ev: DataDirMoveEvent) { + dataDirMoveListeners.forEach((fn) => fn(ev)); +} + export interface OrxEventHandlers { onRun: (run: Run) => void; onExperiment: (experiment: Experiment) => void; @@ -109,6 +130,20 @@ export function useOrxEvents(handlers: OrxEventHandlers) { const d = parse<{ sessionId: string; busy: boolean }>(e as MessageEvent); if (d?.sessionId) emitChat({ type: "busy", sessionId: d.sessionId, busy: d.busy }); }); + es.addEventListener("datadir.move.progress", (e) => { + const d = parse<{ phase: string; copiedBytes: number; totalBytes: number }>( + e as MessageEvent, + ); + if (d) emitDataDirMove({ type: "progress", ...d }); + }); + es.addEventListener("datadir.move.done", (e) => { + const d = parse<{ path: string; oldPathLeft?: string }>(e as MessageEvent); + if (d) emitDataDirMove({ type: "done", path: d.path, oldPathLeft: d.oldPathLeft }); + }); + es.addEventListener("datadir.move.error", (e) => { + const d = parse<{ error: string }>(e as MessageEvent); + if (d) emitDataDirMove({ type: "error", error: d.error }); + }); return () => es.close(); }, []); } diff --git a/ui/src/styles.css b/ui/src/styles.css index 599bb22e..44289d50 100644 --- a/ui/src/styles.css +++ b/ui/src/styles.css @@ -2283,6 +2283,31 @@ textarea::placeholder { font-weight: 600; } +/* Determinate progress bar (data-dir move). */ +.progress { + margin: 12px 0 4px; +} +.progress-track { + height: 8px; + border-radius: 999px; + background: var(--surface); + border: 1px solid var(--border); + overflow: hidden; +} +.progress-fill { + height: 100%; + background: var(--accent); + border-radius: 999px; + transition: width 0.2s ease; +} +.progress-caption { + display: flex; + justify-content: space-between; + margin-top: 6px; + font-size: 12px; + color: var(--muted); +} + .settings-form { margin-top: 14px; padding-top: 14px; @@ -2376,6 +2401,18 @@ a.files-pill:hover { height: 22px; margin: -4px -6px -4px 0; } +/* "Change storage location →" — a pill-shaped button, not a path pill. */ +button.files-pill-link { + cursor: pointer; + font: inherit; + font-size: 12px; + color: var(--muted); + white-space: nowrap; +} +button.files-pill-link:hover { + border-color: var(--muted); + color: var(--text); +} .files-hint { margin: 0; font-size: 11.5px;