From ca96a53b6d443767017abd0f00312c9c288aae30 Mon Sep 17 00:00:00 2001 From: ishaan1124 Date: Sat, 15 Aug 2026 10:58:15 +0530 Subject: [PATCH 1/3] fix(harness): make research tools resilient by default --- CHANGELOG.md | 7 + README.md | 2 +- SECURITY.md | 4 +- backend/cli/src/agent/agent.ts | 30 ++- backend/cli/src/agent/prompt/research.txt | 6 +- backend/cli/src/config/config.ts | 4 +- backend/cli/src/project/trust.ts | 18 +- backend/cli/src/science/kernel/interpreter.ts | 11 +- backend/cli/src/server/routes/project.ts | 4 +- backend/cli/src/session/prompt/core.txt | 5 +- backend/cli/src/tool/apply_patch.ts | 218 +++++++++++------- backend/cli/src/tool/apply_patch.txt | 2 +- backend/cli/src/tool/artifact.ts | 10 +- backend/cli/src/tool/notebook.ts | 5 +- backend/cli/src/tool/read.ts | 19 +- backend/cli/src/tool/task.txt | 5 +- backend/cli/src/tool/webfetch.ts | 51 +++- backend/cli/src/tool/webfetch.txt | 4 +- backend/cli/test/agent/agent.test.ts | 13 +- .../cli/test/agent/harness-contract.test.ts | 1 + backend/cli/test/config/config.test.ts | 8 +- backend/cli/test/project/trust.test.ts | 60 +++-- .../test/science/kernel/interpreter.test.ts | 17 ++ backend/cli/test/tool/apply_patch.test.ts | 56 ++++- .../cli/test/tool/artifact-save-file.test.ts | 43 ++++ backend/cli/test/tool/read.test.ts | 24 +- .../cli/test/tool/webfetch-network.test.ts | 53 +++-- .../docs/src/content/openscience/commands.mdx | 2 +- .../docs/src/content/openscience/sandbox.mdx | 22 +- .../docs/src/content/openscience/security.mdx | 4 +- .../{index-DsOx0Kfh.js => index-cGvyzDje.js} | 80 ++++--- frontend/landing/public/docs/index.html | 2 +- .../components/prompt-input-surface.test.ts | 17 +- .../workspace/src/components/prompt-input.css | 109 ++++++++- .../workspace/src/components/prompt-input.tsx | 204 +++++++++++++++- .../src/components/research-access.test.ts | 26 +++ .../src/components/research-access.ts | 59 +++++ .../src/components/settings/Sandbox.test.ts | 3 +- .../src/components/settings/Sandbox.tsx | 2 +- tooling/sdk/js/src/v2/gen/sdk.gen.ts | 4 +- tooling/sdk/js/src/v2/gen/types.gen.ts | 34 +-- tooling/sdk/openapi.json | 6 +- 42 files changed, 989 insertions(+), 265 deletions(-) rename frontend/landing/public/docs/assets/{index-DsOx0Kfh.js => index-cGvyzDje.js} (86%) create mode 100644 frontend/workspace/src/components/research-access.test.ts create mode 100644 frontend/workspace/src/components/research-access.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index b62a37d6..a42cf855 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ tagged release also ships native binaries for Linux, macOS, and Windows. ### Changed +- Added Ask for approval, Approve for me, and Full access presets directly to + the composer’s Research tools menu, with trusted Full access as the default + for new local projects and explicit or managed restrictions preserved. - Simplified the project sidebar, model and effort controls, chat typography, sent-message surfaces, and Compute into a quieter results-first workspace. - Unified logical model names while keeping API-key and ChatGPT access routes @@ -27,6 +30,10 @@ tagged release also ships native binaries for Linux, macOS, and Windows. ### Fixed +- Made the research harness normalize WebFetch download destinations, authorize + Explore retrieval consistently, apply multi-file patches transactionally, + resolve the default Python environment, enforce image limits by the active + provider, and accept valid manual-run provenance. - Hardened research runs against repeated terminal URLs, guessed download-size escalation, substantially identical timed-out kernel work, stale tool outcomes, cross-process cancellation races, and orphaned kernel lifecycles. diff --git a/README.md b/README.md index 2557e324..84c29be7 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ See [ARCHITECTURE.md](ARCHITECTURE.md) for how the system fits together, [CONTRI ## Security -The permission system keeps you aware of what the agent is doing; it is not an isolation boundary by itself. OpenScience enables its OS execution sandbox by default: macOS Seatbelt or Linux bubblewrap confines commands to the workspace and approved paths and denies network egress. Routine terminals, kernels, shell commands, and local jobs can run immediately inside that verified boundary; remote jobs, kernel environment changes, project extensions, and host execution still require explicit project trust. The default fails closed when no backend is available, and the sandbox is not a full jail, so run inside a container or VM for hostile code. Managed Atlas tokens stay out of general subprocess environments, arbitrary Python/R kernels receive a minimal environment, and credential-shaped values are redacted from output. To inspect or verify containment, run `openscience sandbox` and `openscience sandbox test`; to report a vulnerability, see [SECURITY.md](SECURITY.md). +The permission system keeps you aware of what the agent is doing; it is not an isolation boundary by itself. New local installs start in **Full access** so a trusted project can use files, commands, and the internet without setup. The composer’s **Research tools → Action approval** menu can switch to **Approve for me** (trusted project inside macOS Seatbelt or Linux bubblewrap) or **Ask for approval** (sandboxed and project trust revoked) at any time. Managed policy may enforce a stricter boundary. The sandbox is not a full jail, so use a container or VM for hostile code. Managed Atlas tokens stay out of general subprocess environments, arbitrary Python/R kernels receive a minimal environment, and credential-shaped values are redacted from output. To inspect or verify containment, run `openscience sandbox` and `openscience sandbox test`; to report a vulnerability, see [SECURITY.md](SECURITY.md). ## License diff --git a/SECURITY.md b/SECURITY.md index 25fa1938..6b006c30 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,9 +6,9 @@ OpenScience is an AI agent that runs locally on your machine. The agent can run ### Execution sandbox -The permission system decides whether the agent may take an action. A permission prompt is not an isolation boundary by itself. OpenScience enables its execution sandbox by default and refuses to run when a native backend is unavailable unless you explicitly choose a fallback policy. +The permission system decides whether the agent may take an action. A permission prompt is not an isolation boundary by itself. New local installs default to **Full access**: the project is trusted and the execution sandbox is off. This prioritizes an immediately working research environment and means agent-run commands have your user account's filesystem and network authority. -OpenScience wraps terminal and shell commands, Python/R kernels, and local compute jobs in macOS Seatbelt or Linux bubblewrap. It confines reads and writes to the session workspace and explicitly granted paths and denies network egress. Routine work can run immediately inside that verified boundary; remote jobs, kernel environment changes, project-owned extensions, and host execution still require explicit project trust. Run `openscience sandbox test`; if it does not report **Containment verified**, do not rely on that backend. Windows has no sandbox backend, and the boundary is not a full VM. Use a container or VM for hostile code. +Use **Research tools → Action approval** beneath the composer to switch to **Approve for me** (trust the current project while enabling native containment) or **Ask for approval** (enable containment and revoke project trust). OpenScience then wraps terminal and shell commands, Python/R kernels, and local compute jobs in macOS Seatbelt or Linux bubblewrap, confines reads and writes to the session workspace and explicitly granted paths, and denies network egress. Run `openscience sandbox test`; if it does not report **Containment verified**, do not rely on that backend. Windows has no sandbox backend, and the boundary is not a full VM. Use a container or VM for hostile code. ### Server mode diff --git a/backend/cli/src/agent/agent.ts b/backend/cli/src/agent/agent.ts index bc9d838c..2b85f1ce 100644 --- a/backend/cli/src/agent/agent.ts +++ b/backend/cli/src/agent/agent.ts @@ -50,26 +50,29 @@ export namespace Agent { export type Info = z.infer const compute = async () => { - const cfg = await Config.getExecution() + const [cfg, sandbox] = await Promise.all([Config.getExecution(), Config.trustedSandbox()]) + const boundaryAction = sandbox.enabled ? "ask" : "allow" const defaults = PermissionNext.fromConfig({ "*": "allow", - mcp: "ask", - doom_loop: "ask", + mcp: boundaryAction, + doom_loop: boundaryAction, external_directory: { - "*": "ask", + "*": boundaryAction, }, question: "deny", plan_enter: "deny", plan_exit: "deny", - compute_job: "ask", + compute_job: boundaryAction, // mirrors github.com/github/gitignore Node.gitignore pattern for .env files - read: { - "*": "allow", - "*.env": "ask", - "*.env.*": "ask", - "*.env.example": "allow", - }, + read: sandbox.enabled + ? { + "*": "allow", + "*.env": "ask", + "*.env.*": "ask", + "*.env.example": "allow", + } + : "allow", }) const user = PermissionNext.fromConfig(cfg.permission ?? {}) @@ -260,6 +263,10 @@ export namespace Agent { glob: "allow", list: "allow", bash: "allow", + // WebFetch owns a narrowly scoped brokered transfer. Without this + // explicit rule the profile's wildcard deny blocks the broker's + // per-host authorization before the webfetch allow can apply. + network: "allow", webfetch: "allow", websearch: "allow", codesearch: "allow", @@ -283,6 +290,7 @@ export namespace Agent { PermissionNext.fromConfig({ "*": "deny", bash: "allow", + network: "allow", read: "allow", glob: "allow", grep: "allow", diff --git a/backend/cli/src/agent/prompt/research.txt b/backend/cli/src/agent/prompt/research.txt index aa0920f1..59e9879a 100644 --- a/backend/cli/src/agent/prompt/research.txt +++ b/backend/cli/src/agent/prompt/research.txt @@ -35,10 +35,12 @@ result; internal profiles and skills are implementation details, not user-facing Kernel state is working memory, not reproducibility: save source, inputs, parameters, and outputs, and clean-rerun material results when practical. - Use WebFetch text mode only for bounded pages and APIs. Download large or binary scientific data to a root - basename. For `papers/foo.pdf`, use `output_path:"foo.pdf"`; only after success run sandboxed Bash - `mkdir -p -- 'papers' && test ! -e 'papers/foo.pdf' && mv -- 'foo.pdf' 'papers/foo.pdf'`. Never probe folder paths or send retired + basename; absolute and nested destinations are normalized automatically. For `papers/foo.pdf`, the root download is + `output_path:"foo.pdf"`; only after success run sandboxed Bash + `mkdir -p -- 'papers' && test ! -e 'papers/foo.pdf' && mv -- 'foo.pdf' 'papers/foo.pdf'`. Never send retired cap/size-evidence fields; WebFetch uses live free disk minus its reserve. Verify the brokered download, process it locally, and paginate APIs. Do not assume Shell has network access. +- Treat optional binaries as capabilities: probe once, use an installed equivalent when possible, and do not stall on a missing validator. Keep downloaded toolchain caches out of Results. - Treat an explicitly requested immutable data release as an evidence constraint. If it cannot be retrieved and verified, disclose that early; stop that branch or clearly bound and label any live-release fallback rather than silently mixing releases. diff --git a/backend/cli/src/config/config.ts b/backend/cli/src/config/config.ts index 737806bf..8d9025e3 100644 --- a/backend/cli/src/config/config.ts +++ b/backend/cli/src/config/config.ts @@ -764,7 +764,7 @@ export namespace Config { .boolean() .optional() .describe( - "Run local terminals, kernels, and shell commands inside an OS sandbox (macOS Seatbelt / Linux bubblewrap) that confines writes to authorized project roots. Enabled by default.", + "Run local terminals, kernels, and shell commands inside an OS sandbox (macOS Seatbelt / Linux bubblewrap) that confines writes to authorized project roots. Disabled by default; enable it from the composer or Sandbox settings.", ), network: z .enum(["allow", "deny"]) @@ -1786,7 +1786,7 @@ export namespace Config { } const policy = { ...(base ?? {}), ...(managed ?? {}) } return { - enabled: policy.enabled ?? true, + enabled: policy.enabled ?? false, network: policy.network ?? "deny", allowWrite: policy.allowWrite ?? [], onUnavailable: policy.onUnavailable ?? "error", diff --git a/backend/cli/src/project/trust.ts b/backend/cli/src/project/trust.ts index ebf8f982..48c41214 100644 --- a/backend/cli/src/project/trust.ts +++ b/backend/cli/src/project/trust.ts @@ -143,15 +143,25 @@ export namespace ProjectTrust { export async function status(project: Project.Info): Promise { const canonical = root(project) const saved = await record(project) - if (!saved || saved.root !== canonical) { + if (!saved) { return { projectID: project.id, root: canonical, - revision: saved?.revision ?? 1, + revision: 1, + state: "trusted", + source: "default", + canExecuteProjectCode: true, + } + } + if (saved.root !== canonical) { + return { + projectID: project.id, + root: canonical, + revision: saved.revision, state: "untrusted", - source: saved ? "persisted" : "default", + source: "persisted", canExecuteProjectCode: false, - time: saved?.time, + time: saved.time, remediation: remediation(project), } } diff --git a/backend/cli/src/science/kernel/interpreter.ts b/backend/cli/src/science/kernel/interpreter.ts index 0434b102..96068bec 100644 --- a/backend/cli/src/science/kernel/interpreter.ts +++ b/backend/cli/src/science/kernel/interpreter.ts @@ -10,6 +10,7 @@ export const KernelEnvironmentName = z .min(1) .max(64) .regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/, "Use a simple environment name without path separators") + .transform((value) => (value.toLowerCase() === "default" ? "python" : value)) export class KernelEnvironmentUnavailable extends Error { constructor( @@ -17,7 +18,9 @@ export class KernelEnvironmentUnavailable extends Error { readonly candidates: string[], ) { super( - `Python environment '${environmentName}' was not found. Expected an interpreter at ${candidates.join(" or ")}.`, + `Python environment '${environmentName}' was not found. Expected an interpreter at ${candidates.join(" or ")}. ` + + "Omit environment (or use 'default') for the host/conventional .venv runtime. " + + "Named venv or Conda-prefix environments belong at .venv/.", ) this.name = "KernelEnvironmentUnavailable" } @@ -40,9 +43,9 @@ async function executable(file: string) { /** * Resolve a named project Python environment without accepting arbitrary paths. * - * Named environments live under `.venv/`. The conventional `.venv` - * layout remains a fallback for the default `python` environment so existing - * projects use their dependencies without configuration. + * Named venv or Conda-prefix environments live under `.venv/`. The + * conventional `.venv` layout and host interpreter remain fallbacks for the + * default `python` environment so existing projects work without setup. */ export async function pythonEnvironment(projectRoot: string, input?: string): Promise { const environmentName = KernelEnvironmentName.parse(input ?? "python") diff --git a/backend/cli/src/server/routes/project.ts b/backend/cli/src/server/routes/project.ts index fa1a8a68..011a2819 100644 --- a/backend/cli/src/server/routes/project.ts +++ b/backend/cli/src/server/routes/project.ts @@ -68,7 +68,7 @@ export const ProjectRoutes = lazy(() => describeRoute({ summary: "Inspect project trust", description: - "Inspect whether project-local code may execute. New and relocated projects are untrusted until their canonical root is explicitly approved.", + "Inspect whether project-local code may execute. New projects are trusted by default; an explicit revocation or canonical-root mismatch blocks project code.", operationId: "project.trust.get", responses: { 200: { @@ -94,7 +94,7 @@ export const ProjectRoutes = lazy(() => describeRoute({ summary: "Update project trust", description: - "Allow project-local code only after submitting the canonical root returned by the trust status endpoint, or revoke that permission immediately.", + "Trust project-local code by submitting the canonical root returned by the status endpoint, or revoke that permission immediately.", operationId: "project.trust.update", responses: { 200: { diff --git a/backend/cli/src/session/prompt/core.txt b/backend/cli/src/session/prompt/core.txt index 8646ef0c..d1bedd9a 100644 --- a/backend/cli/src/session/prompt/core.txt +++ b/backend/cli/src/session/prompt/core.txt @@ -48,8 +48,9 @@ verify, and save useful outputs with the smallest sufficient evidence. expected duration, and estimated price. - Do not promise isolation, checkpointing, lifecycle, or recovery beyond the active runtime. - Use WebFetch text mode for bounded text. Download large or binary scientific data to a root basename. For - `papers/foo.pdf`, use `output_path:"foo.pdf"`; only after success run sandboxed Bash - `mkdir -p -- 'papers' && test ! -e 'papers/foo.pdf' && mv -- 'foo.pdf' 'papers/foo.pdf'`. Never probe folder paths or send cap + absolute and nested destinations are reduced to a safe root filename. For `papers/foo.pdf`, the download is + `output_path:"foo.pdf"`; only after success run sandboxed Bash + `mkdir -p -- 'papers' && test ! -e 'papers/foo.pdf' && mv -- 'foo.pdf' 'papers/foo.pdf'`. Never send cap or size-evidence fields; WebFetch uses live free disk minus its reserve. Paginate APIs; Shell need not have network. If an immutable release cannot be verified, disclose it and label any live-release fallback. diff --git a/backend/cli/src/tool/apply_patch.ts b/backend/cli/src/tool/apply_patch.ts index 5c607381..1f1fdb50 100644 --- a/backend/cli/src/tool/apply_patch.ts +++ b/backend/cli/src/tool/apply_patch.ts @@ -16,6 +16,7 @@ import { Filesystem } from "../util/filesystem" import DESCRIPTION from "./apply_patch.txt" import { File } from "../file" import { FileTrash } from "../file/trash" +import { Lock } from "@/util/lock" const PatchParams = z.object({ patchText: z.string().describe("The full patch text that describes all changes to be made"), @@ -29,6 +30,18 @@ type ApprovedFile = { mode: number } +type FileChange = { + filePath: string + oldContent: string + newContent: string + type: "add" | "update" | "delete" | "move" + movePath?: string + diff: string + additions: number + deletions: number + approved?: ApprovedFile +} + async function readApprovedFile(filepath: string): Promise { const requested = await fs.lstat(filepath) if (requested.isSymbolicLink()) throw new Error(`Refusing to edit a symbolic link: ${filepath}`) @@ -93,31 +106,132 @@ async function installExclusive(staged: string, target: string) { } } -async function applyUpdate(change: { filePath: string; newContent: string; approved: ApprovedFile }) { - const staged = await stageFile(change.filePath, change.newContent, change.approved.mode) - const backup = path.join(path.dirname(change.filePath), `.openscience-approved-${crypto.randomUUID()}.bak`) - let moved = false - let installed = false +type PreparedChange = { + change: FileChange + target?: string + staged?: string + stagedApproved?: ApprovedFile + backup?: string + sourceMoved: boolean + installed: boolean + removed?: FileTrash.Record +} + +async function prepareChange(change: FileChange): Promise { + if (change.type === "delete") return { change, sourceMoved: false, installed: false } + const target = change.movePath ?? change.filePath + const mode = change.approved?.mode ?? 0o644 + const staged = await stageFile(target, change.newContent, mode) + try { + return { + change, + target, + staged, + stagedApproved: await readApprovedFile(staged), + ...(change.type === "update" + ? { backup: path.join(path.dirname(change.filePath), `.openscience-approved-${crypto.randomUUID()}.bak`) } + : {}), + sourceMoved: false, + installed: false, + } + } catch (error) { + await fs.rm(staged, { force: true }) + throw error + } +} + +async function removeInstalled(item: PreparedChange) { + if (!item.installed || !item.target || !item.stagedApproved) return + await assertApprovedFile(item.target, item.stagedApproved) + await fs.unlink(item.target) + item.installed = false +} + +async function applyTransaction(changes: FileChange[], ctx: Tool.Context) { + const prepared: PreparedChange[] = [] try { - await fs.rename(change.filePath, backup) - moved = true - await assertApprovedFile(backup, change.approved) - await installExclusive(staged, change.filePath) - installed = true - await fs.unlink(staged) - await fs.unlink(backup) + for (const change of changes) prepared.push(await prepareChange(change)) } catch (error) { - if (moved && !installed) { + await Promise.all(prepared.map((item) => (item.staged ? fs.rm(item.staged, { force: true }) : undefined))) + throw error + } + + const started: PreparedChange[] = [] + try { + for (const item of prepared) { + const change = item.change + started.push(item) + switch (change.type) { + case "add": + await installExclusive(item.staged!, change.filePath) + item.installed = true + break + case "update": + if (!change.approved || !item.backup) throw new Error(`Missing approved file snapshot for ${change.filePath}`) + await fs.rename(change.filePath, item.backup) + item.sourceMoved = true + await assertApprovedFile(item.backup, change.approved) + await installExclusive(item.staged!, change.filePath) + item.installed = true + break + case "move": + if (!change.approved || !change.movePath) { + throw new Error(`Missing approved move state for ${change.filePath}`) + } + item.removed = await FileTrash.trash({ + projectID: Instance.project.id, + sessionID: ctx.sessionID, + path: change.filePath, + expectedContent: change.approved.bytes, + }) + await installExclusive(item.staged!, change.movePath) + item.installed = true + break + case "delete": + if (!change.approved) throw new Error(`Missing approved file snapshot for ${change.filePath}`) + item.removed = await FileTrash.trash({ + projectID: Instance.project.id, + sessionID: ctx.sessionID, + path: change.filePath, + expectedContent: change.approved.bytes, + }) + break + } + } + + await Promise.all( + prepared.map(async (item) => { + // Cleanup is post-commit housekeeping. A transient unlink failure must + // not convert a fully committed transaction into an unsafe rollback. + if (item.backup) await fs.rm(item.backup, { force: true }).catch(() => undefined) + if (item.staged) await fs.rm(item.staged, { force: true }).catch(() => undefined) + }), + ) + return prepared.flatMap((item) => (item.removed ? [item.removed] : [])) + } catch (error) { + const rollbackErrors: unknown[] = [] + for (const item of started.toReversed()) { try { - await installExclusive(backup, change.filePath) - await fs.unlink(backup) + await removeInstalled(item) + if (item.removed) await FileTrash.rollback(item.removed) + if (item.sourceMoved && item.backup) { + await installExclusive(item.backup, item.change.filePath) + await fs.unlink(item.backup) + item.sourceMoved = false + } } catch (rollbackError) { - throw new AggregateError([error, rollbackError], `Edit failed; approved original retained at ${backup}`) + rollbackErrors.push(rollbackError) } } + if (rollbackErrors.length) { + throw new AggregateError( + [error, ...rollbackErrors], + "Multi-file patch failed and one or more rollback steps need manual recovery", + ) + } throw error } finally { - await fs.rm(staged, { force: true }) + await Promise.all(prepared.map((item) => (item.staged ? fs.rm(item.staged, { force: true }) : undefined))) } } @@ -146,25 +260,8 @@ export const ApplyPatchTool = Tool.define("apply_patch", { throw new Error("apply_patch verification failed: no hunks found") } - // There is no cross-file filesystem transaction primitive available to - // this broker. Refuse multi-file patches before permission prompts or - // writes so a later-file failure can never leave a partial patch. - if (hunks.length > 1) { - throw new Error("apply_patch verification failed: multi-file patches are not atomic; submit one file per patch") - } - // Validate file paths and check permissions - const fileChanges: Array<{ - filePath: string - oldContent: string - newContent: string - type: "add" | "update" | "delete" | "move" - movePath?: string - diff: string - additions: number - deletions: number - approved?: ApprovedFile - }> = [] + const fileChanges: FileChange[] = [] let totalDiff = "" @@ -303,78 +400,39 @@ export const ApplyPatchTool = Tool.define("apply_patch", { }, }) - // Approval is bound to exact source bytes+inode and to an absent add/move - // destination. Revalidate after the user answers, before any side effect. + // Approval is bound to exact source bytes+inode and to absent add/move + // destinations. Serialize the full preflight + commit and roll every + // completed file back if a later commit step fails. + using _transaction = await Lock.write(`apply-patch:${Instance.project.id}`) for (const change of fileChanges) { if (change.approved) await assertApprovedFile(change.filePath, change.approved) if (change.type === "add") await assertAbsent(change.filePath) if (change.type === "move" && change.movePath) await assertAbsent(change.movePath) } - // Apply the changes + const trash = await applyTransaction(fileChanges, ctx) const updates: Array<{ file: string; event: "add" | "change" | "unlink" }> = [] - const trash: FileTrash.Record[] = [] - for (const change of fileChanges) { const edited = change.type === "delete" ? undefined : (change.movePath ?? change.filePath) switch (change.type) { case "add": - { - const staged = await stageFile(change.filePath, change.newContent, 0o644) - try { - await installExclusive(staged, change.filePath) - } finally { - await fs.rm(staged, { force: true }) - } - } updates.push({ file: change.filePath, event: "add" }) break case "update": - if (!change.approved) throw new Error(`Missing approved file snapshot for ${change.filePath}`) - await applyUpdate({ filePath: change.filePath, newContent: change.newContent, approved: change.approved }) updates.push({ file: change.filePath, event: "change" }) break case "move": if (change.movePath) { - if (!change.approved) throw new Error(`Missing approved file snapshot for ${change.filePath}`) - const staged = await stageFile(change.movePath, change.newContent, change.approved.mode) - let removed: FileTrash.Record | undefined - try { - removed = await FileTrash.trash({ - projectID: Instance.project.id, - sessionID: ctx.sessionID, - path: change.filePath, - expectedContent: change.approved.bytes, - }) - try { - await installExclusive(staged, change.movePath) - } catch (error) { - await FileTrash.rollback(removed) - throw error - } - } finally { - await fs.rm(staged, { force: true }) - } - trash.push(removed) updates.push({ file: change.filePath, event: "unlink" }) updates.push({ file: change.movePath, event: "add" }) } break - case "delete": { - if (!change.approved) throw new Error(`Missing approved file snapshot for ${change.filePath}`) - const removed = await FileTrash.trash({ - projectID: Instance.project.id, - sessionID: ctx.sessionID, - path: change.filePath, - expectedContent: change.approved.bytes, - }) - trash.push(removed) + case "delete": updates.push({ file: change.filePath, event: "unlink" }) break - } } if (edited) { diff --git a/backend/cli/src/tool/apply_patch.txt b/backend/cli/src/tool/apply_patch.txt index 5b2d9560..e54ab85f 100644 --- a/backend/cli/src/tool/apply_patch.txt +++ b/backend/cli/src/tool/apply_patch.txt @@ -4,7 +4,7 @@ Use the `apply_patch` tool to edit files. Your patch language is a stripped‑do [ one or more file sections ] *** End Patch -Within that envelope, you get a sequence of file operations. +Within that envelope, you get a sequence of file operations. Multi-file patches are supported: the harness validates every file before writing and rolls back completed file operations if a later operation fails. You MUST include a header to specify the action you are taking. Each operation starts with one of three headers: diff --git a/backend/cli/src/tool/artifact.ts b/backend/cli/src/tool/artifact.ts index 91eb1460..4eec0bc9 100644 --- a/backend/cli/src/tool/artifact.ts +++ b/backend/cli/src/tool/artifact.ts @@ -45,7 +45,7 @@ function savedExecution(run: Run): Omit, with .venv itself also used for the default python environment.", + "Optional project Python environment. Omit it or use 'default' for the host/conventional .venv runtime. " + + "Named venv or Conda-prefix interpreters live at .venv/.", ), timeout: z.number().default(120_000).describe("Execution timeout in ms (default: 120s, max: 600s)"), } @@ -921,7 +922,7 @@ const PythonDefinition: Awaited["i description: [ "Run Python code in one long-lived managed process per conversation and selected environment. Variables, imports, and state persist across calls in that environment; child conversations and other environments are isolated.", "Treat persistent state as working memory, not reproducibility. For a material result, save the source, declared inputs, parameters, and outputs and clean-rerun when practical.", - "Choose `environment` to address a project interpreter under .venv/; the default python environment also discovers a conventional .venv.", + "Omit `environment` or use `default` for the host/conventional .venv runtime. Named venv or Conda-prefix interpreters live under .venv/.", "Always set `title` to a concise description of the scientific action, not a code fragment or import.", "Set `source` when the execution belongs to a script so Activity can identify that source.", "Use `action: stop` with the same environment when its in-memory state should be cleared.", diff --git a/backend/cli/src/tool/read.ts b/backend/cli/src/tool/read.ts index 2822a300..e7360ec5 100644 --- a/backend/cli/src/tool/read.ts +++ b/backend/cli/src/tool/read.ts @@ -15,14 +15,19 @@ import { SafeFileIO } from "@/file/safe-io" const DEFAULT_READ_LIMIT = 2000 const MAX_LINE_LENGTH = 2000 const MAX_BYTES = 50 * 1024 -// Anthropic's API caps base64-embedded PDFs/images at ~32 MB. Reject bigger -// files up front instead of OOMing while encoding. +// Bound base64 attachments before encoding so one file cannot exhaust the +// local process or provider request budget. const MAX_ATTACHMENT_BYTES = 32 * 1024 * 1024 -// Anthropic rejects images with any dimension > 2000px when a request contains -// multiple images. Reject at attach time so a single oversized figure cannot -// poison the entire session's history (which would fail every follow-up turn). +// Anthropic rejects images with any dimension > 2000px in multi-image turns. const MAX_IMAGE_DIMENSION = 2000 +function usesAnthropicImageLimit(ctx: Tool.Context) { + const model = ctx.extra?.model as { providerID?: unknown; id?: unknown; modelID?: unknown } | undefined + const provider = String(model?.providerID ?? "").toLowerCase() + const id = String(model?.id ?? model?.modelID ?? "").toLowerCase() + return provider === "anthropic" || id.includes("anthropic/") || id.includes("claude") +} + export const ReadTool = Tool.define("read", { description: DESCRIPTION, parameters: z.object({ @@ -82,7 +87,7 @@ export const ReadTool = Tool.define("read", { if (snapshot.bytes.byteLength > MAX_ATTACHMENT_BYTES) { throw new Error( `${kind} too large to attach (${snapshot.bytes.byteLength} bytes > ${MAX_ATTACHMENT_BYTES}). ` + - `Anthropic's API caps base64 attachments at ~32 MB. ` + + `The harness caps base64 attachments at 32 MiB. ` + (isPdf ? "Use the liteparse skill to extract text via the `lit` CLI instead " + "(install with `npm i -g @llamaindex/liteparse` if missing)." @@ -93,7 +98,7 @@ export const ReadTool = Tool.define("read", { const fileBytes = snapshot.bytes if (isImage) { const dims = readImageDimensions(fileBytes) - if (dims && Math.max(dims.width, dims.height) > MAX_IMAGE_DIMENSION) { + if (usesAnthropicImageLimit(ctx) && dims && Math.max(dims.width, dims.height) > MAX_IMAGE_DIMENSION) { throw new Error( `Image too large to attach (${dims.width}x${dims.height}). ` + `Anthropic's API rejects any image dimension > ${MAX_IMAGE_DIMENSION}px in multi-image requests, ` + diff --git a/backend/cli/src/tool/task.txt b/backend/cli/src/tool/task.txt index f29b0ec2..6bd6b65c 100644 --- a/backend/cli/src/tool/task.txt +++ b/backend/cli/src/tool/task.txt @@ -31,8 +31,9 @@ Rules: parallelism is worthwhile. Continue a child only for new missing work, never merely to restate or reformat a result already returned. 7. WebFetch text mode is for bounded text and APIs. Download large or binary scientific data to a root basename. - For `papers/foo.pdf`, use `output_path:"foo.pdf"`; only after success run sandboxed Bash - `mkdir -p -- 'papers' && test ! -e 'papers/foo.pdf' && mv -- 'foo.pdf' 'papers/foo.pdf'`. Never probe folder paths or send retired + Absolute and nested destinations are normalized to a safe root filename. For `papers/foo.pdf`, the root download is + `output_path:"foo.pdf"`; only after success run sandboxed Bash + `mkdir -p -- 'papers' && test ! -e 'papers/foo.pdf' && mv -- 'foo.pdf' 'papers/foo.pdf'`. Never send retired cap/size-evidence fields; WebFetch uses live free disk minus its reserve. Verify locally and paginate APIs; Shell need not have network access. 8. If a requested immutable release cannot be retrieved and verified, report the constraint early. diff --git a/backend/cli/src/tool/webfetch.ts b/backend/cli/src/tool/webfetch.ts index 3cacd2e2..45bf1e50 100644 --- a/backend/cli/src/tool/webfetch.ts +++ b/backend/cli/src/tool/webfetch.ts @@ -9,6 +9,7 @@ import { SafeFileIO } from "@/file/safe-io" import crypto from "node:crypto" import { constants as FS } from "node:fs" import fs from "node:fs/promises" +import os from "node:os" import path from "node:path" import { ToolRetryGuard } from "@/session/tool-retry-guard" @@ -19,6 +20,40 @@ const DEFAULT_DOWNLOAD_TIMEOUT = 10 * 60 * 1000 // 10 minutes const MAX_DOWNLOAD_TIMEOUT = 30 * 60 * 1000 // 30 minutes export const DOWNLOAD_DISK_RESERVE_BYTES = 512 * 1024 * 1024 // preserve 512 MiB for the host +function generatedDownloadName(url: unknown, format: unknown) { + const suffix = format === "html" ? "html" : format === "markdown" ? "md" : "txt" + return `download-${crypto + .createHash("sha256") + .update(String(url ?? "download")) + .digest("hex") + .slice(0, 12)}.${suffix}` +} + +/** + * Models naturally express destinations as absolute temp paths or nested + * workspace paths. The broker never honors those directories: it reduces the + * request to one safe root filename before validation or permission checks. + */ +export function normalizeDownloadOutputPath(args: unknown) { + if (!args || typeof args !== "object" || Array.isArray(args)) return args + const result = { ...(args as Record) } + const requested = result.output_path + if (typeof requested !== "string" || !requested || requested !== requested.trim()) return result + + const portable = requested.replaceAll("\\", "/") + const absolute = path.posix.isAbsolute(portable) || path.win32.isAbsolute(requested) + const normalizedTemp = path.resolve(requested) + const commonTempDirectory = ["/tmp", "/var/tmp", os.tmpdir()].some( + (candidate) => normalizedTemp === path.resolve(candidate), + ) + const basename = path.posix.basename(portable.replace(/\/+$/, "")) + const useGenerated = !basename || basename === "." || basename === "/" || (absolute && commonTempDirectory) + if (absolute || portable.includes("/")) { + result.output_path = useGenerated ? generatedDownloadName(result.url, result.format) : basename + } + return result +} + const parameters = z .object({ url: z.string().describe("The URL to fetch content from"), @@ -37,8 +72,9 @@ const parameters = z .refine((value) => value === value.trim(), "output_path must not be blank or have surrounding whitespace") .optional() .describe( - "Optional new filename at the root of this session's workspace. Folder paths are rejected so mutable intermediate " + - 'directories cannot redirect a brokered write. For papers/foo.pdf, download with output_path:"foo.pdf"; only after ' + + "Optional destination. Absolute and folder paths are reduced to a new filename at the root of this session's workspace, " + + "so mutable intermediate directories can never redirect a brokered write. For papers/foo.pdf, the broker downloads " + + 'to output_path:"foo.pdf"; only after ' + "success run sandboxed Bash: mkdir -p -- 'papers' && test ! -e 'papers/foo.pdf' && mv -- 'foo.pdf' 'papers/foo.pdf'. " + "Use download mode for archives, " + "compressed datasets, binary files, or text responses larger than 5 MiB.", @@ -52,8 +88,9 @@ export const WebFetchTool = Tool.define("webfetch", { // Parse defaults and strip retired max_bytes / declared-size fields from // older callers. Download authority now comes only from live disk capacity. normalizeInput(args) { - if (!args || typeof args !== "object" || Array.isArray(args)) return args - const result = { ...(args as Record) } + const normalized = normalizeDownloadOutputPath(args) + if (!normalized || typeof normalized !== "object" || Array.isArray(normalized)) return normalized + const result = { ...(normalized as Record) } delete result.max_bytes delete result.declared_size_bytes delete result.declared_size_evidence_call_id @@ -64,6 +101,10 @@ export const WebFetchTool = Tool.define("webfetch", { if (!params.url.startsWith("http://") && !params.url.startsWith("https://")) { throw new Error("URL must start with http:// or https://") } + // Resolve the complete local write contract before asking for network or + // tool permission. Invalid destinations must never create approval noise. + const download = + params.output_path !== undefined ? await resolveDownloadTarget(ctx.sessionID, params.output_path) : undefined await ToolRetryGuard.assertWebFetch(ctx, params) // A domain outside the enforced allow-list asks instead of failing. // Answering "always" adds the domain to the persisted allow-list (visible @@ -108,8 +149,6 @@ export const WebFetchTool = Tool.define("webfetch", { }, }) - const download = - params.output_path !== undefined ? await resolveDownloadTarget(ctx.sessionID, params.output_path) : undefined const downloadCapacity = download ? await safeDownloadCapacity(download).catch((error) => { if (error instanceof DownloadCapacityError) { diff --git a/backend/cli/src/tool/webfetch.txt b/backend/cli/src/tool/webfetch.txt index 7b28d73e..8a5a73c0 100644 --- a/backend/cli/src/tool/webfetch.txt +++ b/backend/cli/src/tool/webfetch.txt @@ -9,9 +9,9 @@ Usage notes: - The URL must be a fully-formed valid URL - HTTP and HTTPS URLs are supported - Format options: "markdown" (default), "text", or "html" - - Text mode is read-only. Download mode writes only the new `output_path` filename at the root of this session's authorized workspace and refuses to overwrite existing files. This root-only rule prevents a mutable intermediate directory from redirecting a brokered write. + - Text mode is read-only. Download mode reduces absolute or nested `output_path` values to a new filename at the root of this session's authorized workspace and refuses to overwrite existing files. This root-only write prevents a mutable intermediate directory from redirecting a brokered download. - Text responses are limited to 5 MiB. Longer results within that limit may be shown as a preview while the full text is retained in managed tool-output storage. - - Use text mode for bounded pages and API responses. For archives, compressed datasets, binary files, or larger text, use a root filename with no directories. For `papers/foo.pdf`, call WebFetch with `output_path:"foo.pdf"`; only after that download succeeds run sandboxed Bash: `mkdir -p -- 'papers' && test ! -e 'papers/foo.pdf' && mv -- 'foo.pdf' 'papers/foo.pdf'`. Never submit `papers/foo.pdf` as `output_path` or probe nested paths. The response streams through the authorized network broker and never enters model context. + - Use text mode for bounded pages and API responses. For archives, compressed datasets, binary files, or larger text, set `output_path`; the broker safely chooses the root filename. For `papers/foo.pdf`, the resulting root download is `output_path:"foo.pdf"`; only after that download succeeds run sandboxed Bash: `mkdir -p -- 'papers' && test ! -e 'papers/foo.pdf' && mv -- 'foo.pdf' 'papers/foo.pdf'`. The response streams through the authorized network broker and never enters model context. - WebFetch derives one safe download capacity from live free disk minus a 512 MiB host reserve. A declared Content-Length is accepted automatically when it fits; an unknown or understated body is streamed only to the same byte capacity. Do not send download-cap or claimed-size override fields. On a capacity error, use a smaller/paginated source, free disk, a provider-native client, or a dedicated approved transfer instead of retrying unchanged. - Downloads refuse to overwrite an existing file and return the destination filename, byte count, SHA-256 digest, and content type. - For large JSON APIs that support it, prefer a small page and follow pagination metadata. Do not retry a 404 or 405 with the same URL. diff --git a/backend/cli/test/agent/agent.test.ts b/backend/cli/test/agent/agent.test.ts index 57ed3956..d75acf4c 100644 --- a/backend/cli/test/agent/agent.test.ts +++ b/backend/cli/test/agent/agent.test.ts @@ -3,6 +3,7 @@ import { tmpdir, trustProject } from "../fixture/fixture" import { Instance } from "../../src/project/instance" import { Agent } from "../../src/agent/agent" import { PermissionNext } from "../../src/permission/next" +import { ProjectTrust } from "../../src/project/trust" // Helper to evaluate permission for a tool with wildcard pattern function evalPerm(agent: Agent.Info | undefined, permission: string): PermissionNext.Action | undefined { @@ -117,6 +118,8 @@ test("explore agent denies edit and write", async () => { expect(explore?.mode).toBe("subagent") expect(evalPerm(explore, "edit")).toBe("deny") expect(evalPerm(explore, "write")).toBe("deny") + expect(evalPerm(explore, "webfetch")).toBe("allow") + expect(evalPerm(explore, "network")).toBe("allow") expect(evalPerm(explore, "todoread")).toBe("deny") expect(evalPerm(explore, "todowrite")).toBe("deny") }, @@ -173,6 +176,7 @@ test("untrusted project agent configuration stays inert", async () => { await Instance.provide({ directory: tmp.path, fn: async () => { + await ProjectTrust.update(Instance.project, { trusted: false }) expect(await Agent.get("repo-agent")).toBeUndefined() const research = await Agent.get("research") expect(research?.prompt).toBeUndefined() @@ -493,14 +497,17 @@ test("Agent.get returns undefined for non-existent agent", async () => { }) }) -test("default permission includes doom_loop and external_directory as ask", async () => { +test("default Full access removes routine approval prompts", async () => { await using tmp = await tmpdir() await Instance.provide({ directory: tmp.path, fn: async () => { const research = await Agent.get("research") - expect(evalPerm(research, "doom_loop")).toBe("ask") - expect(evalPerm(research, "external_directory")).toBe("ask") + expect(evalPerm(research, "mcp")).toBe("allow") + expect(evalPerm(research, "doom_loop")).toBe("allow") + expect(evalPerm(research, "external_directory")).toBe("allow") + expect(evalPerm(research, "compute_job")).toBe("allow") + expect(PermissionNext.evaluate("read", ".env", research!.permission).action).toBe("allow") }, }) }) diff --git a/backend/cli/test/agent/harness-contract.test.ts b/backend/cli/test/agent/harness-contract.test.ts index 1c83ff46..ef247f6a 100644 --- a/backend/cli/test/agent/harness-contract.test.ts +++ b/backend/cli/test/agent/harness-contract.test.ts @@ -66,6 +66,7 @@ test("the primary and domain prompts stay adaptive instead of procedural", async expect(research).toContain("lazy skills") expect(research).toContain("bounded pages") expect(research).toContain("output_path") + expect(research).toContain("optional binaries as capabilities") expect(research).not.toContain("data once to the workspace with Shell") expect(research).toContain("immutable data release") expect(ml).toContain("simplest method") diff --git a/backend/cli/test/config/config.test.ts b/backend/cli/test/config/config.test.ts index a58f0679..892dd692 100644 --- a/backend/cli/test/config/config.test.ts +++ b/backend/cli/test/config/config.test.ts @@ -35,8 +35,8 @@ test("loads config with defaults when no files exist", async () => { }) }) -test("trusted sandbox defaults project trust enforcement off and managed config can require it", async () => { - expect((await Config.trustedSandbox()).requireProjectTrust).toBe(false) +test("trusted sandbox defaults to full access while managed config can require containment", async () => { + expect(await Config.trustedSandbox()).toMatchObject({ enabled: false, requireProjectTrust: false }) await using tmp = await tmpdir({ init: (dir) => writeConfig(dir, { sandbox: { requireProjectTrust: true } }), @@ -46,9 +46,9 @@ test("trusted sandbox defaults project trust enforcement off and managed config fn: async () => expect((await Config.trustedSandbox()).requireProjectTrust).toBe(false), }) - await writeManagedSettings({ sandbox: { requireProjectTrust: true } }) + await writeManagedSettings({ sandbox: { enabled: true, requireProjectTrust: true } }) - expect((await Config.trustedSandbox()).requireProjectTrust).toBe(true) + expect(await Config.trustedSandbox()).toMatchObject({ enabled: true, requireProjectTrust: true }) }) test("loads JSON config file", async () => { diff --git a/backend/cli/test/project/trust.test.ts b/backend/cli/test/project/trust.test.ts index a12577e7..4425de93 100644 --- a/backend/cli/test/project/trust.test.ts +++ b/backend/cli/test/project/trust.test.ts @@ -29,6 +29,16 @@ description: ${name} trust test skill. ) } +async function containedExecution() { + const previous = (await Config.trustedSandbox()).enabled + await Config.setSandbox({ enabled: true }) + return { + async [Symbol.asyncDispose]() { + await Config.setSandbox({ enabled: previous }) + }, + } +} + test("repeated trust decisions preserve authority until the state actually changes", async () => { await using tmp = await tmpdir() await using stale = await tmpdir() @@ -98,6 +108,7 @@ test("an identical trust decision retries cleanup left pending by a failed reape }) test("project code is inspectable but in-process plugins stay blocked by the execution sandbox", async () => { + await using _sandbox = await containedExecution() await using tmp = await tmpdir({ init: async (dir) => { const local = path.join(dir, ".openscience") @@ -147,6 +158,12 @@ export default async function Probe() { }, }) + await Instance.provide({ + directory: tmp.path, + fn: () => ProjectTrust.update(Instance.project, { trusted: false }), + }) + await Instance.disposeAll() + await Instance.provide({ directory: tmp.path, init: Plugin.init, @@ -157,8 +174,8 @@ export default async function Probe() { const skills = await Skill.all() const mcps = await MCP.status() - expect(status.state).toBe("untrusted") - expect(status.source).toBe("default") + expect(status.state).toBe("revoked") + expect(status.source).toBe("persisted") expect(status.canExecuteProjectCode).toBe(false) expect(status.remediation?.body).toEqual({ trusted: true, root: status.root }) expect(visible.mcp?.probe).toBeDefined() @@ -189,6 +206,7 @@ export default async function Probe() { }) test("trust is canonical and project-isolated while sandboxed project hooks remain inert", async () => { + await using _sandbox = await containedExecution() await using first = await tmpdir({ init: async (dir) => { const marker = path.join(dir, "hook-ran") @@ -240,12 +258,12 @@ test("trust is canonical and project-isolated while sandboxed project hooks rema }) const isolated = await Instance.provide({ directory: second.path, - fn: () => ProjectTrust.status(Instance.project), + fn: () => ProjectTrust.update(Instance.project, { trusted: false }), }) expect(alias.state).toBe("trusted") expect(alias.root).toBe(trusted.root) - expect(isolated.state).toBe("untrusted") - expect(isolated.source).toBe("default") + expect(isolated.state).toBe("revoked") + expect(isolated.source).toBe("persisted") expect(isolated.canExecuteProjectCode).toBe(false) expect(isolated.projectID).not.toBe(trusted.projectID) @@ -304,6 +322,11 @@ test("user-global code stays available while project-local skills require trust" }, }) + await Instance.provide({ + directory: tmp.path, + fn: () => ProjectTrust.update(Instance.project, { trusted: false }), + }) + await Instance.disposeAll() await Instance.provide({ directory: tmp.path, init: Plugin.init, @@ -376,7 +399,7 @@ test("revoked startup scripts fail closed before spawning a shell", async () => expect(await Bun.file(marker).text()).toBe("startup") }) -test("default denial is inspectable, trustable, and revocable through the project permission surface", async () => { +test("default trust is inspectable, revocable, and restorable through the project permission surface", async () => { await using tmp = await tmpdir() const project = await Project.fromDirectory(tmp.path) const fetch = Server.internalFetch() @@ -391,20 +414,8 @@ test("default denial is inspectable, trustable, and revocable through the projec expect(status).toMatchObject({ projectID: project.project.id, root: project.project.worktree, - state: "untrusted", - source: "default", - canExecuteProjectCode: false, - remediation: { code: "trust_project_required" }, - }) - - const trusted = await fetch(`http://openscience.internal/project/${project.project.id}/trust`, { - method: "PUT", - headers, - body: JSON.stringify(status.remediation?.body), - }) - expect(trusted.status).toBe(200) - expect(await trusted.json()).toMatchObject({ state: "trusted", + source: "default", canExecuteProjectCode: true, }) @@ -419,4 +430,15 @@ test("default denial is inspectable, trustable, and revocable through the projec canExecuteProjectCode: false, remediation: { code: "trust_project_required" }, }) + + const trusted = await fetch(`http://openscience.internal/project/${project.project.id}/trust`, { + method: "PUT", + headers, + body: JSON.stringify({ trusted: true, root: status.root }), + }) + expect(trusted.status).toBe(200) + expect(await trusted.json()).toMatchObject({ + state: "trusted", + canExecuteProjectCode: true, + }) }) diff --git a/backend/cli/test/science/kernel/interpreter.test.ts b/backend/cli/test/science/kernel/interpreter.test.ts index 40380d6c..3abf2f61 100644 --- a/backend/cli/test/science/kernel/interpreter.test.ts +++ b/backend/cli/test/science/kernel/interpreter.test.ts @@ -16,17 +16,31 @@ import { KernelRuntime, type KernelIdentity } from "../../../src/science/kernel/ import { AuthorityProcessLedger } from "../../../src/project/authority-process" import { Sandbox } from "../../../src/sandbox/sandbox" import { Global } from "../../../src/global" +import { Config } from "../../../src/config/config" import "../../../src/tool/rkernel" +async function containedExecution() { + const previous = (await Config.trustedSandbox()).enabled + await Config.setSandbox({ enabled: true }) + return { + async [Symbol.asyncDispose]() { + await Config.setSandbox({ enabled: previous }) + }, + } +} + test("Python environment names cannot escape the project virtual-environment directory", () => { expect(() => KernelEnvironmentName.parse("../nbody")).toThrow("path separators") expect(() => KernelEnvironmentName.parse("nbody/main")).toThrow("path separators") expect(KernelEnvironmentName.parse("nbody-3.12")).toBe("nbody-3.12") + expect(KernelEnvironmentName.parse("default")).toBe("python") + expect(KernelEnvironmentName.parse("DEFAULT")).toBe("python") }) test("the default Python environment falls back to the host but a missing named environment fails closed", async () => { await using tmp = await tmpdir() expect(await pythonEnvironment(tmp.path)).toEqual({ environmentName: "python" }) + expect(await pythonEnvironment(tmp.path, "default")).toEqual({ environmentName: "python" }) await expect(pythonEnvironment(tmp.path, "nbody")).rejects.toBeInstanceOf(KernelEnvironmentUnavailable) }) @@ -47,6 +61,7 @@ test("a named Python environment resolves only its fixed project-local interpret }) test("project .venv discovery is side-effect free before sandboxed execution", async () => { + await using _sandbox = await containedExecution() await using tmp = await tmpdir({ git: true, init: async (dir) => { @@ -110,6 +125,7 @@ test("project .venv discovery is side-effect free before sandboxed execution", a test.skipIf(process.platform === "win32")( "an R override is discovered without execution and reports its version only after durable READY", async () => { + await using _sandbox = await containedExecution() await using tmp = await tmpdir({ git: true, init: async (dir) => { @@ -182,6 +198,7 @@ test.skipIf(process.platform === "win32")( "spontaneous built-in launcher exits complete durable ownership without accumulation", async () => { if (!Bun.which("python3")) return + await using _sandbox = await containedExecution() await using tmp = await tmpdir({ git: true }) await Instance.provide({ directory: tmp.path, diff --git a/backend/cli/test/tool/apply_patch.test.ts b/backend/cli/test/tool/apply_patch.test.ts index fbe22738..726dca4c 100644 --- a/backend/cli/test/tool/apply_patch.test.ts +++ b/backend/cli/test/tool/apply_patch.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from "bun:test" +import { describe, expect, spyOn, test } from "bun:test" import path from "path" import * as fs from "fs/promises" import { ApplyPatchTool } from "../../src/tool/apply_patch" @@ -75,7 +75,7 @@ describe("tool.apply_patch freeform", () => { await expect(execute({ patchText: emptyPatch }, ctx)).rejects.toThrow("patch rejected: empty patch") }) - test("rejects multi-file patches before permission or side effects", async () => { + test("applies a fully preflighted multi-file patch in one transaction", async () => { await using fixture = await tmpdir({ git: true }) const { ctx, calls } = makeCtx() @@ -90,11 +90,53 @@ describe("tool.apply_patch freeform", () => { const patchText = "*** Begin Patch\n*** Add File: nested/new.txt\n+created\n*** Delete File: delete.txt\n*** Update File: modify.txt\n@@\n-line2\n+changed\n*** End Patch" - await expect(execute({ patchText }, ctx)).rejects.toThrow("multi-file patches are not atomic") - expect(calls).toEqual([]) - await expect(fs.readFile(path.join(fixture.path, "nested", "new.txt"), "utf-8")).rejects.toThrow() - expect(await fs.readFile(modifyPath, "utf-8")).toBe("line1\nline2\n") - expect(await fs.readFile(deletePath, "utf-8")).toBe("obsolete\n") + const result = await execute({ patchText }, ctx) + expect(calls).toHaveLength(1) + expect(calls[0]?.metadata.files.map((file) => file.type)).toEqual(["add", "delete", "update"]) + expect(await fs.readFile(path.join(fixture.path, "nested", "new.txt"), "utf-8")).toBe("created\n") + expect(await fs.readFile(modifyPath, "utf-8")).toBe("line1\nchanged\n") + await expect(fs.readFile(deletePath, "utf-8")).rejects.toThrow() + expect(result.output).toContain("A nested/new.txt") + expect(await FileTrash.list(Instance.project.id)).toHaveLength(1) + }, + }) + }) + + test("rolls back earlier files when a later multi-file commit fails", async () => { + await using fixture = await tmpdir({ git: true }) + const { ctx, calls } = makeCtx() + + await Instance.provide({ + directory: fixture.path, + fn: async () => { + const original = path.join(fixture.path, "original.txt") + const later = path.join(fixture.path, "later.txt") + await fs.writeFile(original, "before\n", "utf8") + const realLink = fs.link.bind(fs) + const link = spyOn(fs, "link").mockImplementation(async (source, destination) => { + if (path.resolve(String(destination)) === later) { + throw Object.assign(new Error("injected later-file failure"), { code: "EIO" }) + } + return realLink(source, destination) + }) + try { + await expect( + execute( + { + patchText: + "*** Begin Patch\n*** Update File: original.txt\n@@\n-before\n+after\n*** Add File: later.txt\n+later\n*** End Patch", + }, + ctx, + ), + ).rejects.toThrow("injected later-file failure") + } finally { + link.mockRestore() + } + + expect(calls).toHaveLength(1) + expect(await fs.readFile(original, "utf8")).toBe("before\n") + await expect(fs.readFile(later)).rejects.toThrow() + expect((await fs.readdir(fixture.path)).filter((name) => name.startsWith(".openscience-"))).toEqual([]) expect(await FileTrash.list(Instance.project.id)).toEqual([]) }, }) diff --git a/backend/cli/test/tool/artifact-save-file.test.ts b/backend/cli/test/tool/artifact-save-file.test.ts index e8b7bd30..0ae6ec6b 100644 --- a/backend/cli/test/tool/artifact-save-file.test.ts +++ b/backend/cli/test/tool/artifact-save-file.test.ts @@ -144,3 +144,46 @@ test("artifact save_file binds the immutable result to its exact producing execu }, }) }) + +test("artifact save_file accepts a project-owned manually recorded run from the same session", async () => { + await using tmp = await tmpdir({ git: true }) + await Instance.provide({ + directory: tmp.path, + fn: async () => { + const session = await executionSession() + const tool = await ArtifactTool.init() + const workspace = await SessionFilesystem.workspace(session.id) + await Bun.write(path.join(workspace, "review.pdf"), "%PDF-1.5\nmanual result\n") + const scope = { projectID: Instance.project.id, directory: Instance.directory } + const run = await Provenance.recordOwned(scope, { + kind: "run", + label: "Compile review", + tool: "tectonic, pdfinfo", + meta: { + sessionID: session.id, + projectID: Instance.project.id, + stdout: "review.pdf validated", + }, + } as Parameters[0]) + + const response = await tool.execute( + { action: "save_file", path: "review.pdf", provenance_id: run.id }, + context(session.id), + ) + const saved = response.metadata.savedArtifact as { id: string; versionID: string } + const detail = await ArtifactStore.get(Instance.project.id, saved.id) + expect(detail?.execution).toMatchObject({ + command: "tectonic, pdfinfo", + status: "unknown", + stdout: "review.pdf validated", + source: run.id, + captureQuality: "declared", + }) + expect((await Provenance.project(scope)).edges).toContainEqual({ + from: run.id, + to: ArtifactStore.reviewTargetID(saved.versionID, detail!.current.sha256), + relation: "produced", + }) + }, + }) +}) diff --git a/backend/cli/test/tool/read.test.ts b/backend/cli/test/tool/read.test.ts index e1e53539..d4200ef9 100644 --- a/backend/cli/test/tool/read.test.ts +++ b/backend/cli/test/tool/read.test.ts @@ -351,7 +351,7 @@ describe("tool.read truncation", () => { }) }) - test("images with any dimension > 2000px are rejected to avoid poisoning session history", async () => { + test("Anthropic images with any dimension > 2000px are rejected to avoid poisoning session history", async () => { // The fixture at large-image.png is 2560x1422. Anthropic's API rejects // images with any dimension > 2000px in multi-image requests, and a single // rejected image poisons every subsequent turn in the session. The Read @@ -360,9 +360,27 @@ describe("tool.read truncation", () => { directory: FIXTURES_DIR, fn: async () => { const read = await ReadTool.init() - await expect(read.execute({ filePath: path.join(FIXTURES_DIR, "large-image.png") }, ctx)).rejects.toThrow( - /Image too large to attach \(2560x1422\)/, + await expect( + read.execute( + { filePath: path.join(FIXTURES_DIR, "large-image.png") }, + { ...ctx, extra: { model: { providerID: "anthropic", id: "claude-sonnet" } } }, + ), + ).rejects.toThrow(/Image too large to attach \(2560x1422\)/) + }, + }) + }) + + test("does not apply Anthropic's image dimension limit to an OpenAI model routed through OpenRouter", async () => { + await Instance.provide({ + directory: FIXTURES_DIR, + fn: async () => { + const read = await ReadTool.init() + const result = await read.execute( + { filePath: path.join(FIXTURES_DIR, "large-image.png") }, + { ...ctx, extra: { model: { providerID: "openrouter", id: "openai/gpt-5.6-sol" } } }, ) + expect(result.attachments).toHaveLength(1) + expect(result.output).toBe("Image read successfully") }, }) }) diff --git a/backend/cli/test/tool/webfetch-network.test.ts b/backend/cli/test/tool/webfetch-network.test.ts index 4f210549..34977a92 100644 --- a/backend/cli/test/tool/webfetch-network.test.ts +++ b/backend/cli/test/tool/webfetch-network.test.ts @@ -1,6 +1,11 @@ import { afterEach, expect, spyOn, test } from "bun:test" import { Network } from "../../src/settings/network" -import { DOWNLOAD_DISK_RESERVE_BYTES, MAX_RESPONSE_SIZE, WebFetchTool } from "../../src/tool/webfetch" +import { + DOWNLOAD_DISK_RESERVE_BYTES, + MAX_RESPONSE_SIZE, + WebFetchTool, + normalizeDownloadOutputPath, +} from "../../src/tool/webfetch" import type { Tool } from "../../src/tool/tool" import { SessionFilesystem } from "../../src/session/filesystem" import crypto from "node:crypto" @@ -73,6 +78,7 @@ test("webfetch schema teaches the root-download then sandboxed-move sequence", a properties?: Record } const description = schema.properties?.output_path?.description + expect(description).toContain("Absolute and folder paths are reduced") expect(description).toContain('output_path:"foo.pdf"') expect(description).toContain("only after success") expect(description).toContain( @@ -83,6 +89,30 @@ test("webfetch schema teaches the root-download then sandboxed-move sequence", a expect(schema.properties?.declared_size_evidence_call_id).toBeUndefined() }) +test("webfetch reduces absolute, temp-directory, and nested destinations to safe root filenames", () => { + expect( + normalizeDownloadOutputPath({ + url: "https://example.com/archive.pdf", + format: "text", + output_path: "/tmp/papers/archive.pdf", + }), + ).toMatchObject({ output_path: "archive.pdf" }) + expect( + normalizeDownloadOutputPath({ + url: "https://example.com/query?id=42", + format: "text", + output_path: "/tmp", + }), + ).toMatchObject({ output_path: expect.stringMatching(/^download-[a-f0-9]{12}\.txt$/) }) + expect( + normalizeDownloadOutputPath({ + url: "https://example.com/archive.pdf", + format: "text", + output_path: "papers/archive.pdf", + }), + ).toMatchObject({ output_path: "archive.pdf" }) +}) + test("webfetch rejects empty or whitespace-padded download paths before permission or network access", async () => { await Network.set({ allowlistEnabled: false, enabled: [], custom: [] }) let fetches = 0 @@ -483,7 +513,7 @@ test("webfetch streams a brokered binary download through a reauthorized redirec } }) -test("webfetch download gives a copy-ready root-first fallback for a folder destination", async () => { +test("webfetch validates the normalized root target before permission or network access", async () => { const root = await fs.mkdtemp(path.join(os.tmpdir(), "webfetch-contained-")) await fs.writeFile(path.join(root, "existing.bin"), "keep") const workspace = spyOn(SessionFilesystem, "workspace").mockResolvedValue(root) @@ -498,24 +528,7 @@ test("webfetch download gives a copy-ready root-first fallback for a folder dest try { await expect( - webfetch.execute({ url: "https://example.com/data", format: "text", output_path: "../outside.bin" }, ctx), - ).rejects.toThrow("must be a filename at the root of this session's workspace, without directories") - const nested = await captureError( - webfetch.execute({ url: "https://example.com/data", format: "text", output_path: "papers/foo.pdf" }, ctx), - ) - expect(nested.message).toBe( - "output_path is root-only by design: brokered downloads must not traverse mutable intermediate directories. " + - 'Retry with output_path:"foo.pdf". Only after that download succeeds, run sandboxed Bash from the workspace: ' + - "mkdir -p -- 'papers' && test ! -e 'papers/foo.pdf' && mv -- 'foo.pdf' 'papers/foo.pdf'", - ) - await expect( - webfetch.execute( - { url: "https://example.com/data", format: "text", output_path: path.join(root, "absolute.bin") }, - ctx, - ), - ).rejects.toThrow("must be a workspace-root filename, not an absolute path") - await expect( - webfetch.execute({ url: "https://example.com/data", format: "text", output_path: "existing.bin" }, ctx), + webfetch.execute({ url: "https://example.com/data", format: "text", output_path: "/tmp/existing.bin" }, ctx), ).rejects.toThrow("Refusing to overwrite") expect(fetches).toBe(0) expect(await fs.readFile(path.join(root, "existing.bin"), "utf8")).toBe("keep") diff --git a/frontend/docs/src/content/openscience/commands.mdx b/frontend/docs/src/content/openscience/commands.mdx index e61ab1dd..5fbda091 100644 --- a/frontend/docs/src/content/openscience/commands.mdx +++ b/frontend/docs/src/content/openscience/commands.mdx @@ -70,7 +70,7 @@ Connecting an Atlas account is optional — see [Atlas](/openscience/atlas). Ope | `openscience sandbox disable` | Turn the sandbox off. | | `openscience sandbox test` | Prove containment on this machine (writes inside/outside the workspace, network egress). | -Enabled and fail-closed by default. Routine contained work does not require project trust; remote jobs, kernel environment changes, project extensions, and host execution do. See [Sandbox and project trust](/openscience/sandbox). +Disabled in the default **Full access** preset. Use the composer’s **Research tools → Action approval** menu or `sandbox enable` to turn on fail-closed containment; managed policy can require it. See [Sandbox and project trust](/openscience/sandbox). ## Agent profiles diff --git a/frontend/docs/src/content/openscience/sandbox.mdx b/frontend/docs/src/content/openscience/sandbox.mdx index f66ce582..a935d25f 100644 --- a/frontend/docs/src/content/openscience/sandbox.mdx +++ b/frontend/docs/src/content/openscience/sandbox.mdx @@ -10,7 +10,13 @@ OpenScience separates three controls that solve different problems: - **The execution sandbox** limits what a spawned terminal, shell command, Python/R kernel, or local compute job can reach. - **Project trust** controls remote jobs, kernel environment changes such as package installs, project-owned executable code such as plugins and MCP servers, and execution with full host authority. -This separation keeps routine work moving without treating every newly opened project as trusted code. By default, terminals, kernels, shell commands, and local jobs may run immediately **only when OpenScience can enforce the OS sandbox**. Remote jobs, kernel environment changes, project extensions, and unsandboxed execution remain blocked until you explicitly trust that project. +The composer exposes those controls as three practical presets under **Research tools → Action approval**: + +- **Ask for approval** enables containment and revokes trust for the current project. +- **Approve for me** enables containment and trusts the current project, so only actions outside the chosen boundary need intervention. +- **Full access** trusts the current project and disables containment. + +New local installs default to **Full access** for an immediately working research environment. Choose one of the contained modes before opening code you do not trust. Managed configuration can enforce a stricter policy than the selected preset. ## Default behavior @@ -19,7 +25,7 @@ The global defaults are: ```jsonc { "sandbox": { - "enabled": true, + "enabled": false, "network": "deny", "allowWrite": [], "onUnavailable": "error", @@ -28,9 +34,9 @@ The global defaults are: } ``` -With a working native backend, routine commands can read and write only the active session workspace and explicitly granted paths. Network access is denied, including loopback, LAN, link-local, and metadata endpoints. When no backend is available, the default `onUnavailable: "error"` refuses to run rather than silently falling back to the host. +With this default, a trusted project runs with the same filesystem and network authority as your user account. Selecting **Approve for me** or **Ask for approval** writes `enabled: true`; with a working native backend, routine commands can then read and write only the active session workspace and explicitly granted paths, and network access is denied, including loopback, LAN, link-local, and metadata endpoints. When containment is requested but no backend is available, `onUnavailable: "error"` refuses to run rather than silently falling back to the host. -Set `requireProjectTrust: true` if you prefer the stricter posture where every new project must be trusted before it starts any local process, even inside a verified sandbox. +Set `requireProjectTrust: true` if you want a revoked or root-mismatched project blocked from every local process, even inside a verified sandbox. ## Permissions and sandboxing @@ -40,7 +46,7 @@ This means ordinary approved work can continue autonomously inside a boundary yo ## Project trust -A new project starts with project-owned executable code disabled. You can still use sandboxed terminals, Python/R kernels, shell commands, and local compute unless **Require project trust** is enabled. +New projects start trusted unless an explicit trust record or managed policy says otherwise. The **Ask for approval** preset revokes that trust for the current project; **Approve for me** and **Full access** restore it after verifying the canonical project root. Trust a project only after reviewing its local configuration and code. Trust enables remote jobs, kernel environment changes such as package installs, project plugins, MCP processes, formatters, LSP commands, provider token commands/modules, publication exporters, repository/startup commands, and other project-defined executable hooks. It also allows routine execution when you intentionally turn the sandbox off or configure an unsandboxed fallback. @@ -52,7 +58,7 @@ Open **Settings → Permissions → Project code** to trust or revoke the curren | --- | --- | --- | | macOS | Seatbelt (`sandbox-exec`) | Built in. | | Linux | bubblewrap (`bwrap`) | Install `bubblewrap`; unprivileged user namespaces must work. | -| Windows | unavailable | Commands follow `onUnavailable`; the default is to refuse. | +| Windows | unavailable | Contained modes follow `onUnavailable`; the default is to refuse. | On Ubuntu/Debian: @@ -97,7 +103,7 @@ Sandbox policy is read only from global and managed configuration. A project's ` | Key | Meaning | Default | | --- | --- | --- | -| `enabled` | Request the native sandbox for local execution. | `true` | +| `enabled` | Request the native sandbox for local execution. | `false` | | `network` | Requested network policy. Current native backends enforce deny-all. | `"deny"` | | `allowWrite` | Extra absolute writable roots beyond session grants. | `[]` | | `onUnavailable` | `"error"`, `"warn"`, or `"allow"` when no backend can run. | `"error"` | @@ -115,4 +121,4 @@ The sandbox applies to spawned commands, including shell utilities, compilers, p - Linux requires a working bubblewrap/user-namespace setup. Windows currently has no filesystem sandbox backend. - For actively hostile code or stronger kernel isolation, run OpenScience itself inside a container or VM as an additional boundary. -The safe low-friction preset is the default: sandbox enabled, unavailable backend refused, project trust not required for routine contained work. Full host access is an explicit combination: disable containment (or allow fallback) **and** trust the current project. +Full host access is the default: containment disabled and the current project trusted. Use the composer preset or Settings to enable containment. **Ask for approval** additionally revokes the current project's trust; **Approve for me** keeps it trusted inside the sandbox. Explicit saved choices survive restarts, and managed policy remains authoritative. diff --git a/frontend/docs/src/content/openscience/security.mdx b/frontend/docs/src/content/openscience/security.mdx index ca4d1403..ec3d7d84 100644 --- a/frontend/docs/src/content/openscience/security.mdx +++ b/frontend/docs/src/content/openscience/security.mdx @@ -4,13 +4,13 @@ description: "The trust boundary, credential storage, execution sandbox, and sub icon: "shield-check" --- -OpenScience is open source under Apache-2.0, so the whole security model below is auditable in the [repository](https://github.com/synthetic-sciences/openscience). The agent runs locally, while spawned commands are constrained by the native sandbox and explicit filesystem grants by default. Two principles anchor the design: keep credentials out of subprocesses that do not need them, and make each trust boundary explicit instead of treating permissions, sandboxing, and project trust as the same control. +OpenScience is open source under Apache-2.0, so the whole security model below is auditable in the [repository](https://github.com/synthetic-sciences/openscience). The agent runs locally. New local installs default to trusted **Full access**, while two contained presets are available directly beneath the composer. Two principles anchor the design: keep credentials out of subprocesses that do not need them, and make each trust boundary explicit instead of treating permissions, sandboxing, and project trust as the same control. ## Permissions are not the sandbox The permission system decides whether an agent may take an action. It is not, on its own, an isolation boundary. -OpenScience enables a real [execution sandbox](/openscience/sandbox) by default. It wraps terminals, shell commands, Python/R kernels, and local jobs in macOS Seatbelt or Linux bubblewrap, limits them to the workspace and approved paths, and denies network egress. Routine work can start immediately when that boundary is enforced; remote jobs, kernel environment changes, project-owned extensions, and host execution still require explicit project trust. The default refuses to run when no native backend is available rather than silently falling back to the host. Verify the effective boundary with `openscience sandbox test`. It is OS containment, not a full VM — for actively hostile code, still run OpenScience inside a container or VM. +OpenScience ships a real [execution sandbox](/openscience/sandbox), but **Full access** is the default. In that mode a trusted project has your user account's filesystem and network authority. Open **Research tools → Action approval** and select **Approve for me** to trust the project inside macOS Seatbelt or Linux bubblewrap, or **Ask for approval** to enable that boundary and revoke project trust. Containment limits commands to the workspace and approved paths and denies network egress; if the selected boundary is unavailable, the default policy refuses to run rather than silently falling back to the host. Verify it with `openscience sandbox test`. It is OS containment, not a full VM — for actively hostile code, still run OpenScience inside a container or VM. ## Credential storage diff --git a/frontend/landing/public/docs/assets/index-DsOx0Kfh.js b/frontend/landing/public/docs/assets/index-cGvyzDje.js similarity index 86% rename from frontend/landing/public/docs/assets/index-DsOx0Kfh.js rename to frontend/landing/public/docs/assets/index-cGvyzDje.js index 74a78146..715212a6 100644 --- a/frontend/landing/public/docs/assets/index-DsOx0Kfh.js +++ b/frontend/landing/public/docs/assets/index-cGvyzDje.js @@ -1,4 +1,4 @@ -(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const f of d.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function a(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function o(c){if(c.ep)return;c.ep=!0;const d=a(c);fetch(c.href,d)}})();function yc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ns={exports:{}},va={};/** +(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const f of d.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function a(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function o(c){if(c.ep)return;c.ep=!0;const d=a(c);fetch(c.href,d)}})();function yc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var js={exports:{}},va={};/** * @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 Bp;function fb(){if(Bp)return va;Bp=1;var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function a(o,c,d){var f=null;if(d!==void 0&&(f=""+d),c.key!==void 0&&(f=""+c.key),"key"in c){d={};for(var p in c)p!=="key"&&(d[p]=c[p])}else d=c;return c=d.ref,{$$typeof:n,type:o,key:f,ref:c!==void 0?c:null,props:d}}return va.Fragment=r,va.jsx=a,va.jsxs=a,va}var Hp;function db(){return Hp||(Hp=1,Ns.exports=fb()),Ns.exports}var H=db(),Ls={exports:{}},ye={};/** + */var Bp;function fb(){if(Bp)return va;Bp=1;var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function a(o,c,d){var f=null;if(d!==void 0&&(f=""+d),c.key!==void 0&&(f=""+c.key),"key"in c){d={};for(var p in c)p!=="key"&&(d[p]=c[p])}else d=c;return c=d.ref,{$$typeof:n,type:o,key:f,ref:c!==void 0?c:null,props:d}}return va.Fragment=r,va.jsx=a,va.jsxs=a,va}var Hp;function db(){return Hp||(Hp=1,js.exports=fb()),js.exports}var H=db(),Ls={exports:{}},ye={};/** * @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 qp;function hb(){if(qp)return ye;qp=1;var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),f=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),k=Symbol.iterator;function x(E){return E===null||typeof E!="object"?null:(E=k&&E[k]||E["@@iterator"],typeof E=="function"?E:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},U=Object.assign,Z={};function D(E,Y,S){this.props=E,this.context=Y,this.refs=Z,this.updater=S||T}D.prototype.isReactComponent={},D.prototype.setState=function(E,Y){if(typeof E!="object"&&typeof E!="function"&&E!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,E,Y,"setState")},D.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function F(){}F.prototype=D.prototype;function Q(E,Y,S){this.props=E,this.context=Y,this.refs=Z,this.updater=S||T}var oe=Q.prototype=new F;oe.constructor=Q,U(oe,D.prototype),oe.isPureReactComponent=!0;var re=Array.isArray;function L(){}var P={H:null,A:null,T:null,S:null},he=Object.prototype.hasOwnProperty;function me(E,Y,S){var ee=S.ref;return{$$typeof:n,type:E,key:Y,ref:ee!==void 0?ee:null,props:S}}function j(E,Y){return me(E.type,Y,E.props)}function te(E){return typeof E=="object"&&E!==null&&E.$$typeof===n}function B(E){var Y={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(S){return Y[S]})}var le=/\/+/g;function J(E,Y){return typeof E=="object"&&E!==null&&E.key!=null?B(""+E.key):Y.toString(36)}function $(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(L,L):(E.status="pending",E.then(function(Y){E.status==="pending"&&(E.status="fulfilled",E.value=Y)},function(Y){E.status==="pending"&&(E.status="rejected",E.reason=Y)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function O(E,Y,S,ee,de){var ue=typeof E;(ue==="undefined"||ue==="boolean")&&(E=null);var Ee=!1;if(E===null)Ee=!0;else switch(ue){case"bigint":case"string":case"number":Ee=!0;break;case"object":switch(E.$$typeof){case n:case r:Ee=!0;break;case b:return Ee=E._init,O(Ee(E._payload),Y,S,ee,de)}}if(Ee)return de=de(E),Ee=ee===""?"."+J(E,0):ee,re(de)?(S="",Ee!=null&&(S=Ee.replace(le,"$&/")+"/"),O(de,Y,S,"",function(Yt){return Yt})):de!=null&&(te(de)&&(de=j(de,S+(de.key==null||E&&E.key===de.key?"":(""+de.key).replace(le,"$&/")+"/")+Ee)),Y.push(de)),1;Ee=0;var Ze=ee===""?".":ee+":";if(re(E))for(var Le=0;Le>>1,w=O[xe];if(0>>1;xec(S,ae))eec(de,S)?(O[xe]=de,O[ee]=ae,xe=ee):(O[xe]=S,O[Y]=ae,xe=Y);else if(eec(de,ae))O[xe]=de,O[ee]=ae,xe=ee;else break e}}return K}function c(O,K){var ae=O.sortIndex-K.sortIndex;return ae!==0?ae:O.id-K.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var m=[],h=[],b=1,y=null,k=3,x=!1,T=!1,U=!1,Z=!1,D=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,Q=typeof setImmediate<"u"?setImmediate:null;function oe(O){for(var K=a(h);K!==null;){if(K.callback===null)o(h);else if(K.startTime<=O)o(h),K.sortIndex=K.expirationTime,r(m,K);else break;K=a(h)}}function re(O){if(U=!1,oe(O),!T)if(a(m)!==null)T=!0,L||(L=!0,B());else{var K=a(h);K!==null&&$(re,K.startTime-O)}}var L=!1,P=-1,he=5,me=-1;function j(){return Z?!0:!(n.unstable_now()-meO&&j());){var xe=y.callback;if(typeof xe=="function"){y.callback=null,k=y.priorityLevel;var w=xe(y.expirationTime<=O);if(O=n.unstable_now(),typeof w=="function"){y.callback=w,oe(O),K=!0;break t}y===a(m)&&o(m),oe(O)}else o(m);y=a(m)}if(y!==null)K=!0;else{var E=a(h);E!==null&&$(re,E.startTime-O),K=!1}}break e}finally{y=null,k=ae,x=!1}K=void 0}}finally{K?B():L=!1}}}var B;if(typeof Q=="function")B=function(){Q(te)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,J=le.port2;le.port1.onmessage=te,B=function(){J.postMessage(null)}}else B=function(){D(te,0)};function $(O,K){P=D(function(){O(n.unstable_now())},K)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(O){O.callback=null},n.unstable_forceFrameRate=function(O){0>O||125xe?(O.sortIndex=ae,r(h,O),a(m)===null&&O===a(h)&&(U?(F(P),P=-1):U=!0,$(re,ae-xe))):(O.sortIndex=w,r(m,O),T||x||(T=!0,L||(L=!0,B()))),O},n.unstable_shouldYield=j,n.unstable_wrapCallback=function(O){var K=k;return function(){var ae=k;k=K;try{return O.apply(this,arguments)}finally{k=ae}}}})(Hs)),Hs}var Vp;function gb(){return Vp||(Vp=1,Bs.exports=mb()),Bs.exports}var qs={exports:{}},pt={};/** + */var Gp;function mb(){return Gp||(Gp=1,(function(n){function r(O,K){var ae=O.length;O.push(K);e:for(;0>>1,w=O[xe];if(0>>1;xec(S,ae))eec(de,S)?(O[xe]=de,O[ee]=ae,xe=ee):(O[xe]=S,O[Y]=ae,xe=Y);else if(eec(de,ae))O[xe]=de,O[ee]=ae,xe=ee;else break e}}return K}function c(O,K){var ae=O.sortIndex-K.sortIndex;return ae!==0?ae:O.id-K.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var m=[],h=[],b=1,y=null,k=3,x=!1,T=!1,U=!1,Z=!1,D=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,Q=typeof setImmediate<"u"?setImmediate:null;function oe(O){for(var K=a(h);K!==null;){if(K.callback===null)o(h);else if(K.startTime<=O)o(h),K.sortIndex=K.expirationTime,r(m,K);else break;K=a(h)}}function re(O){if(U=!1,oe(O),!T)if(a(m)!==null)T=!0,L||(L=!0,B());else{var K=a(h);K!==null&&$(re,K.startTime-O)}}var L=!1,P=-1,he=5,me=-1;function N(){return Z?!0:!(n.unstable_now()-meO&&N());){var xe=y.callback;if(typeof xe=="function"){y.callback=null,k=y.priorityLevel;var w=xe(y.expirationTime<=O);if(O=n.unstable_now(),typeof w=="function"){y.callback=w,oe(O),K=!0;break t}y===a(m)&&o(m),oe(O)}else o(m);y=a(m)}if(y!==null)K=!0;else{var A=a(h);A!==null&&$(re,A.startTime-O),K=!1}}break e}finally{y=null,k=ae,x=!1}K=void 0}}finally{K?B():L=!1}}}var B;if(typeof Q=="function")B=function(){Q(te)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,J=le.port2;le.port1.onmessage=te,B=function(){J.postMessage(null)}}else B=function(){D(te,0)};function $(O,K){P=D(function(){O(n.unstable_now())},K)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(O){O.callback=null},n.unstable_forceFrameRate=function(O){0>O||125xe?(O.sortIndex=ae,r(h,O),a(m)===null&&O===a(h)&&(U?(F(P),P=-1):U=!0,$(re,ae-xe))):(O.sortIndex=w,r(m,O),T||x||(T=!0,L||(L=!0,B()))),O},n.unstable_shouldYield=N,n.unstable_wrapCallback=function(O){var K=k;return function(){var ae=k;k=K;try{return O.apply(this,arguments)}finally{k=ae}}}})(Hs)),Hs}var Vp;function gb(){return Vp||(Vp=1,Bs.exports=mb()),Bs.exports}var qs={exports:{}},pt={};/** * @license React * react-dom.production.js * @@ -38,15 +38,15 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Zp;function vb(){if(Zp)return xa;Zp=1;var n=gb(),r=bc(),a=bb();function o(e){var t="https://react.dev/errors/"+e;if(1w||(e.current=xe[w],xe[w]=null,w--)}function S(e,t){w++,xe[w]=e.current,e.current=t}var ee=E(null),de=E(null),ue=E(null),Ee=E(null);function Ze(e,t){switch(S(ue,t),S(de,e),S(ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?op(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=op(t),e=up(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Y(ee),S(ee,e)}function Le(){Y(ee),Y(de),Y(ue)}function Yt(e){e.memoizedState!==null&&S(Ee,e);var t=ee.current,l=up(t,e.type);t!==l&&(S(de,e),S(ee,l))}function pn(e){de.current===e&&(Y(ee),Y(de)),Ee.current===e&&(Y(Ee),ma._currentValue=ae)}var Ai,La;function mn(e){if(Ai===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);Ai=t&&t[1]||"",La=-1w||(e.current=xe[w],xe[w]=null,w--)}function S(e,t){w++,xe[w]=e.current,e.current=t}var ee=A(null),de=A(null),ue=A(null),Ae=A(null);function Ze(e,t){switch(S(ue,t),S(de,e),S(ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?op(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=op(t),e=up(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Y(ee),S(ee,e)}function Le(){Y(ee),Y(de),Y(ue)}function Yt(e){e.memoizedState!==null&&S(Ae,e);var t=ee.current,l=up(t,e.type);t!==l&&(S(de,e),S(ee,l))}function pn(e){de.current===e&&(Y(ee),Y(de)),Ae.current===e&&(Y(Ae),ma._currentValue=ae)}var Ei,La;function mn(e){if(Ei===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);Ei=t&&t[1]||"",La=-1)":-1u||C[i]!==M[u]){var q=` `+C[i].replace(" at new "," at ");return e.displayName&&q.includes("")&&(q=q.replace("",e.displayName)),q}while(1<=i&&0<=u);break}}}finally{Ml=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?mn(l):""}function Ua(e,t){switch(e.tag){case 26:case 27:case 5:return mn(e.type);case 16:return mn("Lazy");case 13:return e.child!==t&&t!==null?mn("Suspense Fallback"):mn("Suspense");case 19:return mn("SuspenseList");case 0:case 15:return Dl(e.type,!1);case 11:return Dl(e.type.render,!1);case 1:return Dl(e.type,!0);case 31:return mn("Activity");default:return""}}function Ba(e){try{var t="",l=null;do t+=Ua(e,l),l=e,e=e.return;while(e);return t}catch(i){return` Error generating stack: `+i.message+` -`+i.stack}}var Rl=Object.prototype.hasOwnProperty,jl=n.unstable_scheduleCallback,Ti=n.unstable_cancelCallback,xo=n.unstable_shouldYield,ko=n.unstable_requestPaint,yt=n.unstable_now,So=n.unstable_getCurrentPriorityLevel,G=n.unstable_ImmediatePriority,W=n.unstable_UserBlockingPriority,pe=n.unstable_NormalPriority,ke=n.unstable_LowPriority,Re=n.unstable_IdlePriority,Mt=n.log,gn=n.unstable_setDisableYieldValue,bt=null,it=null;function kt(e){if(typeof Mt=="function"&&gn(e),it&&typeof it.setStrictMode=="function")try{it.setStrictMode(bt,e)}catch{}}var qe=Math.clz32?Math.clz32:$g,Ln=Math.log,en=Math.LN2;function $g(e){return e>>>=0,e===0?32:31-(Ln(e)/en|0)|0}var Ha=256,qa=262144,Ya=4194304;function sl(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ga(e,t,l){var i=e.pendingLanes;if(i===0)return 0;var u=0,s=e.suspendedLanes,g=e.pingedLanes;e=e.warmLanes;var v=i&134217727;return v!==0?(i=v&~s,i!==0?u=sl(i):(g&=v,g!==0?u=sl(g):l||(l=v&~e,l!==0&&(u=sl(l))))):(v=i&~s,v!==0?u=sl(v):g!==0?u=sl(g):l||(l=i&~e,l!==0&&(u=sl(l)))),u===0?0:t!==0&&t!==u&&(t&s)===0&&(s=u&-u,l=t&-t,s>=l||s===32&&(l&4194048)!==0)?t:u}function zi(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Wg(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Yc(){var e=Ya;return Ya<<=1,(Ya&62914560)===0&&(Ya=4194304),e}function wo(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function Oi(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Pg(e,t,l,i,u,s){var g=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var v=e.entanglements,C=e.expirationTimes,M=e.hiddenUpdates;for(l=g&~l;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var ay=/[\n"\\]/g;function Vt(e){return e.replace(ay,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Oo(e,t,l,i,u,s,g,v){e.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.type=g:e.removeAttribute("type"),t!=null?g==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Gt(t)):e.value!==""+Gt(t)&&(e.value=""+Gt(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?_o(e,g,Gt(t)):l!=null?_o(e,g,Gt(l)):i!=null&&e.removeAttribute("value"),u==null&&s!=null&&(e.defaultChecked=!!s),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.name=""+Gt(v):e.removeAttribute("name")}function ef(e,t,l,i,u,s,g,v){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||l!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){zo(e);return}l=l!=null?""+Gt(l):"",t=t!=null?""+Gt(t):l,v||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=v?e.checked:!!i,e.defaultChecked=!!i,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.name=g),zo(e)}function _o(e,t,l){t==="number"&&Qa(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function ql(e,t,l,i){if(e=e.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),No=!1;if(vn)try{var Ri={};Object.defineProperty(Ri,"passive",{get:function(){No=!0}}),window.addEventListener("test",Ri,Ri),window.removeEventListener("test",Ri,Ri)}catch{No=!1}var Bn=null,Lo=null,Ka=null;function uf(){if(Ka)return Ka;var e,t=Lo,l=t.length,i,u="value"in Bn?Bn.value:Bn.textContent,s=u.length;for(e=0;e=Li),pf=" ",mf=!1;function gf(e,t){switch(e){case"keyup":return Ry.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xl=!1;function Ny(e,t){switch(e){case"compositionend":return yf(t);case"keypress":return t.which!==32?null:(mf=!0,pf);case"textInput":return e=t.data,e===pf&&mf?null:e;default:return null}}function Ly(e,t){if(Xl)return e==="compositionend"||!Yo&&gf(e,t)?(e=uf(),Ka=Lo=Bn=null,Xl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:l,offset:t-e};e=i}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Ef(l)}}function Tf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Qa(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=Qa(e.document)}return t}function Xo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Xy=vn&&"documentMode"in document&&11>=document.documentMode,Ql=null,Qo=null,qi=null,Zo=!1;function Of(e,t,l){var i=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Zo||Ql==null||Ql!==Qa(i)||(i=Ql,"selectionStart"in i&&Xo(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),qi&&Hi(qi,i)||(qi=i,i=qr(Qo,"onSelect"),0>=g,u-=g,un=1<<32-qe(t)+u|l<ve?(Te=ie,ie=null):Te=ie.sibling;var Me=R(z,ie,_[ve],V);if(Me===null){ie===null&&(ie=Te);break}e&&ie&&Me.alternate===null&&t(z,ie),A=s(Me,A,ve),_e===null?se=Me:_e.sibling=Me,_e=Me,ie=Te}if(ve===_.length)return l(z,ie),ze&&kn(z,ve),se;if(ie===null){for(;ve<_.length;ve++)ie=X(z,_[ve],V),ie!==null&&(A=s(ie,A,ve),_e===null?se=ie:_e.sibling=ie,_e=ie);return ze&&kn(z,ve),se}for(ie=i(ie);ve<_.length;ve++)Te=N(ie,z,ve,_[ve],V),Te!==null&&(e&&Te.alternate!==null&&ie.delete(Te.key===null?ve:Te.key),A=s(Te,A,ve),_e===null?se=Te:_e.sibling=Te,_e=Te);return e&&ie.forEach(function(rl){return t(z,rl)}),ze&&kn(z,ve),se}function fe(z,A,_,V){if(_==null)throw Error(o(151));for(var se=null,_e=null,ie=A,ve=A=0,Te=null,Me=_.next();ie!==null&&!Me.done;ve++,Me=_.next()){ie.index>ve?(Te=ie,ie=null):Te=ie.sibling;var rl=R(z,ie,Me.value,V);if(rl===null){ie===null&&(ie=Te);break}e&&ie&&rl.alternate===null&&t(z,ie),A=s(rl,A,ve),_e===null?se=rl:_e.sibling=rl,_e=rl,ie=Te}if(Me.done)return l(z,ie),ze&&kn(z,ve),se;if(ie===null){for(;!Me.done;ve++,Me=_.next())Me=X(z,Me.value,V),Me!==null&&(A=s(Me,A,ve),_e===null?se=Me:_e.sibling=Me,_e=Me);return ze&&kn(z,ve),se}for(ie=i(ie);!Me.done;ve++,Me=_.next())Me=N(ie,z,ve,Me.value,V),Me!==null&&(e&&Me.alternate!==null&&ie.delete(Me.key===null?ve:Me.key),A=s(Me,A,ve),_e===null?se=Me:_e.sibling=Me,_e=Me);return e&&ie.forEach(function(cb){return t(z,cb)}),ze&&kn(z,ve),se}function He(z,A,_,V){if(typeof _=="object"&&_!==null&&_.type===U&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case x:e:{for(var se=_.key;A!==null;){if(A.key===se){if(se=_.type,se===U){if(A.tag===7){l(z,A.sibling),V=u(A,_.props.children),V.return=z,z=V;break e}}else if(A.elementType===se||typeof se=="object"&&se!==null&&se.$$typeof===he&&xl(se)===A.type){l(z,A.sibling),V=u(A,_.props),Zi(V,_),V.return=z,z=V;break e}l(z,A);break}else t(z,A);A=A.sibling}_.type===U?(V=ml(_.props.children,z.mode,V,_.key),V.return=z,z=V):(V=lr(_.type,_.key,_.props,null,z.mode,V),Zi(V,_),V.return=z,z=V)}return g(z);case T:e:{for(se=_.key;A!==null;){if(A.key===se)if(A.tag===4&&A.stateNode.containerInfo===_.containerInfo&&A.stateNode.implementation===_.implementation){l(z,A.sibling),V=u(A,_.children||[]),V.return=z,z=V;break e}else{l(z,A);break}else t(z,A);A=A.sibling}V=Po(_,z.mode,V),V.return=z,z=V}return g(z);case he:return _=xl(_),He(z,A,_,V)}if($(_))return ne(z,A,_,V);if(B(_)){if(se=B(_),typeof se!="function")throw Error(o(150));return _=se.call(_),fe(z,A,_,V)}if(typeof _.then=="function")return He(z,A,cr(_),V);if(_.$$typeof===Q)return He(z,A,rr(z,_),V);fr(z,_)}return typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint"?(_=""+_,A!==null&&A.tag===6?(l(z,A.sibling),V=u(A,_),V.return=z,z=V):(l(z,A),V=Wo(_,z.mode,V),V.return=z,z=V),g(z)):l(z,A)}return function(z,A,_,V){try{Qi=0;var se=He(z,A,_,V);return ni=null,se}catch(ie){if(ie===ti||ie===ur)throw ie;var _e=Rt(29,ie,null,z.mode);return _e.lanes=V,_e.return=z,_e}finally{}}}var Sl=Wf(!0),Pf=Wf(!1),Vn=!1;function fu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function du(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Xn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Qn(e,t,l){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(De&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=nr(e),Lf(e,null,l),t}return tr(e,i,t,l),nr(e)}function Ki(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,Vc(e,l)}}function hu(e,t){var l=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,l===i)){var u=null,s=null;if(l=l.firstBaseUpdate,l!==null){do{var g={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};s===null?u=s=g:s=s.next=g,l=l.next}while(l!==null);s===null?u=s=t:s=s.next=t}else u=s=t;l={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:s,shared:i.shared,callbacks:i.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var pu=!1;function Fi(){if(pu){var e=ei;if(e!==null)throw e}}function Ii(e,t,l,i){pu=!1;var u=e.updateQueue;Vn=!1;var s=u.firstBaseUpdate,g=u.lastBaseUpdate,v=u.shared.pending;if(v!==null){u.shared.pending=null;var C=v,M=C.next;C.next=null,g===null?s=M:g.next=M,g=C;var q=e.alternate;q!==null&&(q=q.updateQueue,v=q.lastBaseUpdate,v!==g&&(v===null?q.firstBaseUpdate=M:v.next=M,q.lastBaseUpdate=C))}if(s!==null){var X=u.baseState;g=0,q=M=C=null,v=s;do{var R=v.lane&-536870913,N=R!==v.lane;if(N?(Ae&R)===R:(i&R)===R){R!==0&&R===Pl&&(pu=!0),q!==null&&(q=q.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var ne=e,fe=v;R=t;var He=l;switch(fe.tag){case 1:if(ne=fe.payload,typeof ne=="function"){X=ne.call(He,X,R);break e}X=ne;break e;case 3:ne.flags=ne.flags&-65537|128;case 0:if(ne=fe.payload,R=typeof ne=="function"?ne.call(He,X,R):ne,R==null)break e;X=y({},X,R);break e;case 2:Vn=!0}}R=v.callback,R!==null&&(e.flags|=64,N&&(e.flags|=8192),N=u.callbacks,N===null?u.callbacks=[R]:N.push(R))}else N={lane:R,tag:v.tag,payload:v.payload,callback:v.callback,next:null},q===null?(M=q=N,C=X):q=q.next=N,g|=R;if(v=v.next,v===null){if(v=u.shared.pending,v===null)break;N=v,v=N.next,N.next=null,u.lastBaseUpdate=N,u.shared.pending=null}}while(!0);q===null&&(C=X),u.baseState=C,u.firstBaseUpdate=M,u.lastBaseUpdate=q,s===null&&(u.shared.lanes=0),Jn|=g,e.lanes=g,e.memoizedState=X}}function ed(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function td(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;es?s:8;var g=O.T,v={};O.T=v,Ru(e,!1,t,l);try{var C=u(),M=O.S;if(M!==null&&M(v,C),C!==null&&typeof C=="object"&&typeof C.then=="function"){var q=Py(C,i);Wi(e,t,q,Bt(e))}else Wi(e,t,i,Bt(e))}catch(X){Wi(e,t,{then:function(){},status:"rejected",reason:X},Bt())}finally{K.p=s,g!==null&&v.types!==null&&(g.types=v.types),O.T=g}}function a1(){}function Mu(e,t,l,i){if(e.tag!==5)throw Error(o(476));var u=Rd(e).queue;Dd(e,u,t,ae,l===null?a1:function(){return jd(e),l(i)})}function Rd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:En,lastRenderedState:ae},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:En,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function jd(e){var t=Rd(e);t.next===null&&(t=e.alternate.memoizedState),Wi(e,t.next.queue,{},Bt())}function Du(){return ft(ma)}function Nd(){return $e().memoizedState}function Ld(){return $e().memoizedState}function r1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=Bt();e=Xn(l);var i=Qn(t,e,l);i!==null&&(zt(i,t,l),Ki(i,t,l)),t={cache:ou()},e.payload=t;return}t=t.return}}function o1(e,t,l){var i=Bt();l={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},kr(e)?Bd(t,l):(l=Jo(e,t,l,i),l!==null&&(zt(l,e,i),Hd(l,t,i)))}function Ud(e,t,l){var i=Bt();Wi(e,t,l,i)}function Wi(e,t,l,i){var u={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(kr(e))Bd(t,u);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var g=t.lastRenderedState,v=s(g,l);if(u.hasEagerState=!0,u.eagerState=v,Dt(v,g))return tr(e,t,u,0),Ye===null&&er(),!1}catch{}finally{}if(l=Jo(e,t,u,i),l!==null)return zt(l,e,i),Hd(l,t,i),!0}return!1}function Ru(e,t,l,i){if(i={lane:2,revertLane:fs(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},kr(e)){if(t)throw Error(o(479))}else t=Jo(e,l,i,2),t!==null&&zt(t,e,2)}function kr(e){var t=e.alternate;return e===be||t!==null&&t===be}function Bd(e,t){ii=pr=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Hd(e,t,l){if((l&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,Vc(e,l)}}var Pi={readContext:ft,use:yr,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useLayoutEffect:Fe,useInsertionEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useSyncExternalStore:Fe,useId:Fe,useHostTransitionStatus:Fe,useFormState:Fe,useActionState:Fe,useOptimistic:Fe,useMemoCache:Fe,useCacheRefresh:Fe};Pi.useEffectEvent=Fe;var qd={readContext:ft,use:yr,useCallback:function(e,t){return vt().memoizedState=[e,t===void 0?null:t],e},useContext:ft,useEffect:wd,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,vr(4194308,4,Td.bind(null,t,e),l)},useLayoutEffect:function(e,t){return vr(4194308,4,e,t)},useInsertionEffect:function(e,t){vr(4,2,e,t)},useMemo:function(e,t){var l=vt();t=t===void 0?null:t;var i=e();if(wl){kt(!0);try{e()}finally{kt(!1)}}return l.memoizedState=[i,t],i},useReducer:function(e,t,l){var i=vt();if(l!==void 0){var u=l(t);if(wl){kt(!0);try{l(t)}finally{kt(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=o1.bind(null,be,e),[i.memoizedState,e]},useRef:function(e){var t=vt();return e={current:e},t.memoizedState=e},useState:function(e){e=Au(e);var t=e.queue,l=Ud.bind(null,be,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Ou,useDeferredValue:function(e,t){var l=vt();return _u(l,e,t)},useTransition:function(){var e=Au(!1);return e=Dd.bind(null,be,e.queue,!0,!1),vt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var i=be,u=vt();if(ze){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),Ye===null)throw Error(o(349));(Ae&127)!==0||od(i,t,l)}u.memoizedState=l;var s={value:l,getSnapshot:t};return u.queue=s,wd(sd.bind(null,i,s,e),[e]),i.flags|=2048,ri(9,{destroy:void 0},ud.bind(null,i,s,l,t),null),l},useId:function(){var e=vt(),t=Ye.identifierPrefix;if(ze){var l=sn,i=un;l=(i&~(1<<32-qe(i)-1)).toString(32)+l,t="_"+t+"R_"+l,l=mr++,0<\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof i.is=="string"?g.createElement("select",{is:i.is}):g.createElement("select"),i.multiple?s.multiple=!0:i.size&&(s.size=i.size);break;default:s=typeof i.is=="string"?g.createElement(u,{is:i.is}):g.createElement(u)}}s[st]=t,s[St]=i;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)s.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===t)break e;for(;g.sibling===null;){if(g.return===null||g.return===t)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}t.stateNode=s;e:switch(ht(s,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Tn(t)}}return Qe(t),Ku(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Tn(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(o(166));if(e=ue.current,$l(t)){if(e=t.stateNode,l=t.memoizedProps,i=null,u=ct,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[st]=t,e=!!(e.nodeValue===l||i!==null&&i.suppressHydrationWarning===!0||ap(e.nodeValue,l)),e||Yn(t,!0)}else e=Yr(e).createTextNode(i),e[st]=t,t.stateNode=e}return Qe(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(i=$l(t),l!==null){if(e===null){if(!i)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[st]=t}else gl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),e=!1}else l=lu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(Nt(t),t):(Nt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Qe(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=$l(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[st]=t}else gl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),u=!1}else u=lu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Nt(t),t):(Nt(t),null)}return Nt(t),(t.flags&128)!==0?(t.lanes=l,t):(l=i!==null,e=e!==null&&e.memoizedState!==null,l&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==u&&(i.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),Ar(t,t.updateQueue),Qe(t),null);case 4:return Le(),e===null&&ms(t.stateNode.containerInfo),Qe(t),null;case 10:return wn(t.type),Qe(t),null;case 19:if(Y(Je),i=t.memoizedState,i===null)return Qe(t),null;if(u=(t.flags&128)!==0,s=i.rendering,s===null)if(u)ta(i,!1);else{if(Ie!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=hr(e),s!==null){for(t.flags|=128,ta(i,!1),e=s.updateQueue,t.updateQueue=e,Ar(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Uf(l,e),l=l.sibling;return S(Je,Je.current&1|2),ze&&kn(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&yt()>Mr&&(t.flags|=128,u=!0,ta(i,!1),t.lanes=4194304)}else{if(!u)if(e=hr(s),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Ar(t,e),ta(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!ze)return Qe(t),null}else 2*yt()-i.renderingStartTime>Mr&&l!==536870912&&(t.flags|=128,u=!0,ta(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(e=i.last,e!==null?e.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=yt(),e.sibling=null,l=Je.current,S(Je,u?l&1|2:l&1),ze&&kn(t,i.treeForkCount),e):(Qe(t),null);case 22:case 23:return Nt(t),gu(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(l&536870912)!==0&&(t.flags&128)===0&&(Qe(t),t.subtreeFlags&6&&(t.flags|=8192)):Qe(t),l=t.updateQueue,l!==null&&Ar(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==l&&(t.flags|=2048),e!==null&&Y(vl),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),wn(Pe),Qe(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function d1(e,t){switch(tu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return wn(Pe),Le(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pn(t),null;case 31:if(t.memoizedState!==null){if(Nt(t),t.alternate===null)throw Error(o(340));gl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Nt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));gl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Y(Je),null;case 4:return Le(),null;case 10:return wn(t.type),null;case 22:case 23:return Nt(t),gu(),e!==null&&Y(vl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return wn(Pe),null;case 25:return null;default:return null}}function ch(e,t){switch(tu(t),t.tag){case 3:wn(Pe),Le();break;case 26:case 27:case 5:pn(t);break;case 4:Le();break;case 31:t.memoizedState!==null&&Nt(t);break;case 13:Nt(t);break;case 19:Y(Je);break;case 10:wn(t.type);break;case 22:case 23:Nt(t),gu(),e!==null&&Y(vl);break;case 24:wn(Pe)}}function na(e,t){try{var l=t.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var u=i.next;l=u;do{if((l.tag&e)===e){i=void 0;var s=l.create,g=l.inst;i=s(),g.destroy=i}l=l.next}while(l!==u)}}catch(v){Ne(t,t.return,v)}}function Fn(e,t,l){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var s=u.next;i=s;do{if((i.tag&e)===e){var g=i.inst,v=g.destroy;if(v!==void 0){g.destroy=void 0,u=t;var C=l,M=v;try{M()}catch(q){Ne(u,C,q)}}}i=i.next}while(i!==s)}}catch(q){Ne(t,t.return,q)}}function fh(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{td(t,l)}catch(i){Ne(e,e.return,i)}}}function dh(e,t,l){l.props=Cl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(i){Ne(e,t,i)}}function la(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof l=="function"?e.refCleanup=l(i):l.current=i}}catch(u){Ne(e,t,u)}}function cn(e,t){var l=e.ref,i=e.refCleanup;if(l!==null)if(typeof i=="function")try{i()}catch(u){Ne(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(u){Ne(e,t,u)}else l.current=null}function hh(e){var t=e.type,l=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break e;case"img":l.src?i.src=l.src:l.srcSet&&(i.srcset=l.srcSet)}}catch(u){Ne(e,e.return,u)}}function Fu(e,t,l){try{var i=e.stateNode;j1(i,e.type,l,t),i[St]=t}catch(u){Ne(e,e.return,u)}}function ph(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tl(e.type)||e.tag===4}function Iu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ph(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&tl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ju(e,t,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=bn));else if(i!==4&&(i===27&&tl(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Ju(e,t,l),e=e.sibling;e!==null;)Ju(e,t,l),e=e.sibling}function Tr(e,t,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(i!==4&&(i===27&&tl(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Tr(e,t,l),e=e.sibling;e!==null;)Tr(e,t,l),e=e.sibling}function mh(e){var t=e.stateNode,l=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);ht(t,i,l),t[st]=e,t[St]=l}catch(s){Ne(e,e.return,s)}}var zn=!1,nt=!1,$u=!1,gh=typeof WeakSet=="function"?WeakSet:Set,ot=null;function h1(e,t){if(e=e.containerInfo,bs=Fr,e=zf(e),Xo(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var i=l.getSelection&&l.getSelection();if(i&&i.rangeCount!==0){l=i.anchorNode;var u=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{l.nodeType,s.nodeType}catch{l=null;break e}var g=0,v=-1,C=-1,M=0,q=0,X=e,R=null;t:for(;;){for(var N;X!==l||u!==0&&X.nodeType!==3||(v=g+u),X!==s||i!==0&&X.nodeType!==3||(C=g+i),X.nodeType===3&&(g+=X.nodeValue.length),(N=X.firstChild)!==null;)R=X,X=N;for(;;){if(X===e)break t;if(R===l&&++M===u&&(v=g),R===s&&++q===i&&(C=g),(N=X.nextSibling)!==null)break;X=R,R=X.parentNode}X=N}l=v===-1||C===-1?null:{start:v,end:C}}else l=null}l=l||{start:0,end:0}}else l=null;for(vs={focusedElem:e,selectionRange:l},Fr=!1,ot=t;ot!==null;)if(t=ot,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ot=e;else for(;ot!==null;){switch(t=ot,s=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l title"))),ht(s,i,l),s[st]=e,rt(s),i=s;break e;case"link":var g=Sp("link","href",u).get(i+(l.href||""));if(g){for(var v=0;vHe&&(g=He,He=fe,fe=g);var z=Af(v,fe),A=Af(v,He);if(z&&A&&(N.rangeCount!==1||N.anchorNode!==z.node||N.anchorOffset!==z.offset||N.focusNode!==A.node||N.focusOffset!==A.offset)){var _=X.createRange();_.setStart(z.node,z.offset),N.removeAllRanges(),fe>He?(N.addRange(_),N.extend(A.node,A.offset)):(_.setEnd(A.node,A.offset),N.addRange(_))}}}}for(X=[],N=v;N=N.parentNode;)N.nodeType===1&&X.push({element:N,left:N.scrollLeft,top:N.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;vl?32:l,O.T=null,l=is,is=null;var s=Wn,g=Rn;if(at=0,fi=Wn=null,Rn=0,(De&6)!==0)throw Error(o(331));var v=De;if(De|=4,Th(s.current),Ch(s,s.current,g,l),De=v,sa(0,!1),it&&typeof it.onPostCommitFiberRoot=="function")try{it.onPostCommitFiberRoot(bt,s)}catch{}return!0}finally{K.p=u,O.T=i,Qh(e,t)}}function Kh(e,t,l){t=Qt(l,t),t=Uu(e.stateNode,t,2),e=Qn(e,t,2),e!==null&&(Oi(e,2),fn(e))}function Ne(e,t,l){if(e.tag===3)Kh(e,e,l);else for(;t!==null;){if(t.tag===3){Kh(t,e,l);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&($n===null||!$n.has(i))){e=Qt(l,e),l=Fd(2),i=Qn(t,l,2),i!==null&&(Id(l,i,t,e),Oi(i,2),fn(i));break}}t=t.return}}function us(e,t,l){var i=e.pingCache;if(i===null){i=e.pingCache=new g1;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(l)||(es=!0,u.add(l),e=k1.bind(null,e,t,l),t.then(e,e))}function k1(e,t,l){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Ye===e&&(Ae&l)===l&&(Ie===4||Ie===3&&(Ae&62914560)===Ae&&300>yt()-_r?(De&2)===0&&di(e,0):ts|=l,ci===Ae&&(ci=0)),fn(e)}function Fh(e,t){t===0&&(t=Yc()),e=pl(e,t),e!==null&&(Oi(e,t),fn(e))}function S1(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Fh(e,l)}function w1(e,t){var l=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(l=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(o(314))}i!==null&&i.delete(t),Fh(e,l)}function C1(e,t){return jl(e,t)}var Ur=null,pi=null,ss=!1,Br=!1,cs=!1,el=0;function fn(e){e!==pi&&e.next===null&&(pi===null?Ur=pi=e:pi=pi.next=e),Br=!0,ss||(ss=!0,A1())}function sa(e,t){if(!cs&&Br){cs=!0;do for(var l=!1,i=Ur;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var s=0;else{var g=i.suspendedLanes,v=i.pingedLanes;s=(1<<31-qe(42|e)+1)-1,s&=u&~(g&~v),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(l=!0,Wh(i,s))}else s=Ae,s=Ga(i,i===Ye?s:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(s&3)===0||zi(i,s)||(l=!0,Wh(i,s));i=i.next}while(l);cs=!1}}function E1(){Ih()}function Ih(){Br=ss=!1;var e=0;el!==0&&L1()&&(e=el);for(var t=yt(),l=null,i=Ur;i!==null;){var u=i.next,s=Jh(i,t);s===0?(i.next=null,l===null?Ur=u:l.next=u,u===null&&(pi=l)):(l=i,(e!==0||(s&3)!==0)&&(Br=!0)),i=u}at!==0&&at!==5||sa(e),el!==0&&(el=0)}function Jh(e,t){for(var l=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,s=e.pendingLanes&-62914561;0v)break;var q=C.transferSize,X=C.initiatorType;q&&rp(X)&&(C=C.responseEnd,g+=q*(C"u"?null:document;function bp(e,t,l){var i=mi;if(i&&typeof t=="string"&&t){var u=Vt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof l=="string"&&(u+='[crossorigin="'+l+'"]'),yp.has(u)||(yp.add(u),e={rel:e,crossOrigin:l,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),ht(t,"link",e),rt(t),i.head.appendChild(t)))}}function Q1(e){jn.D(e),bp("dns-prefetch",e,null)}function Z1(e,t){jn.C(e,t),bp("preconnect",e,t)}function K1(e,t,l){jn.L(e,t,l);var i=mi;if(i&&e&&t){var u='link[rel="preload"][as="'+Vt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(u+='[imagesrcset="'+Vt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(u+='[imagesizes="'+Vt(l.imageSizes)+'"]')):u+='[href="'+Vt(e)+'"]';var s=u;switch(t){case"style":s=gi(e);break;case"script":s=yi(e)}$t.has(s)||(e=y({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),$t.set(s,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(ha(s))||t==="script"&&i.querySelector(pa(s))||(t=i.createElement("link"),ht(t,"link",e),rt(t),i.head.appendChild(t)))}}function F1(e,t){jn.m(e,t);var l=mi;if(l&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Vt(i)+'"][href="'+Vt(e)+'"]',s=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=yi(e)}if(!$t.has(s)&&(e=y({rel:"modulepreload",href:e},t),$t.set(s,e),l.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(pa(s)))return}i=l.createElement("link"),ht(i,"link",e),rt(i),l.head.appendChild(i)}}}function I1(e,t,l){jn.S(e,t,l);var i=mi;if(i&&e){var u=Bl(i).hoistableStyles,s=gi(e);t=t||"default";var g=u.get(s);if(!g){var v={loading:0,preload:null};if(g=i.querySelector(ha(s)))v.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":t},l),(l=$t.get(s))&&As(e,l);var C=g=i.createElement("link");rt(C),ht(C,"link",e),C._p=new Promise(function(M,q){C.onload=M,C.onerror=q}),C.addEventListener("load",function(){v.loading|=1}),C.addEventListener("error",function(){v.loading|=2}),v.loading|=4,Vr(g,t,i)}g={type:"stylesheet",instance:g,count:1,state:v},u.set(s,g)}}}function J1(e,t){jn.X(e,t);var l=mi;if(l&&e){var i=Bl(l).hoistableScripts,u=yi(e),s=i.get(u);s||(s=l.querySelector(pa(u)),s||(e=y({src:e,async:!0},t),(t=$t.get(u))&&Ts(e,t),s=l.createElement("script"),rt(s),ht(s,"link",e),l.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(u,s))}}function $1(e,t){jn.M(e,t);var l=mi;if(l&&e){var i=Bl(l).hoistableScripts,u=yi(e),s=i.get(u);s||(s=l.querySelector(pa(u)),s||(e=y({src:e,async:!0,type:"module"},t),(t=$t.get(u))&&Ts(e,t),s=l.createElement("script"),rt(s),ht(s,"link",e),l.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(u,s))}}function vp(e,t,l,i){var u=(u=ue.current)?Gr(u):null;if(!u)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=gi(l.href),l=Bl(u).hoistableStyles,i=l.get(t),i||(i={type:"style",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=gi(l.href);var s=Bl(u).hoistableStyles,g=s.get(e);if(g||(u=u.ownerDocument||u,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,g),(s=u.querySelector(ha(e)))&&!s._p&&(g.instance=s,g.state.loading=5),$t.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},$t.set(e,l),s||W1(u,e,l,g.state))),t&&i===null)throw Error(o(528,""));return g}if(t&&i!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=yi(l),l=Bl(u).hoistableScripts,i=l.get(t),i||(i={type:"script",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function gi(e){return'href="'+Vt(e)+'"'}function ha(e){return'link[rel="stylesheet"]['+e+"]"}function xp(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function W1(e,t,l,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),ht(t,"link",l),rt(t),e.head.appendChild(t))}function yi(e){return'[src="'+Vt(e)+'"]'}function pa(e){return"script[async]"+e}function kp(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Vt(l.href)+'"]');if(i)return t.instance=i,rt(i),i;var u=y({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),rt(i),ht(i,"style",u),Vr(i,l.precedence,e),t.instance=i;case"stylesheet":u=gi(l.href);var s=e.querySelector(ha(u));if(s)return t.state.loading|=4,t.instance=s,rt(s),s;i=xp(l),(u=$t.get(u))&&As(i,u),s=(e.ownerDocument||e).createElement("link"),rt(s);var g=s;return g._p=new Promise(function(v,C){g.onload=v,g.onerror=C}),ht(s,"link",i),t.state.loading|=4,Vr(s,l.precedence,e),t.instance=s;case"script":return s=yi(l.src),(u=e.querySelector(pa(s)))?(t.instance=u,rt(u),u):(i=l,(u=$t.get(s))&&(i=y({},l),Ts(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),rt(u),ht(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Vr(i,l.precedence,e));return t.instance}function Vr(e,t,l){for(var i=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,s=u,g=0;g title"):null)}function P1(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Cp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function eb(e,t,l,i){if(l.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var u=gi(i.href),s=t.querySelector(ha(u));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Qr.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=s,rt(s);return}s=t.ownerDocument||t,i=xp(i),(u=$t.get(u))&&As(i,u),s=s.createElement("link"),rt(s);var g=s;g._p=new Promise(function(v,C){g.onload=v,g.onerror=C}),ht(s,"link",i),l.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Qr.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var zs=0;function tb(e,t){return e.stylesheets&&e.count===0&&Kr(e,e.stylesheets),0zs?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function Qr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Kr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Zr=null;function Kr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Zr=new Map,t.forEach(nb,e),Zr=null,Qr.call(e))}function nb(e,t){if(!(t.state.loading&4)){var l=Zr.get(e);if(l)var i=l.get(null);else{l=new Map,Zr.set(e,l);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),Us.exports=vb(),Us.exports}var kb=xb();const Sb=`--- +`+i.stack}}var Rl=Object.prototype.hasOwnProperty,Nl=n.unstable_scheduleCallback,Ti=n.unstable_cancelCallback,xo=n.unstable_shouldYield,ko=n.unstable_requestPaint,yt=n.unstable_now,So=n.unstable_getCurrentPriorityLevel,G=n.unstable_ImmediatePriority,W=n.unstable_UserBlockingPriority,pe=n.unstable_NormalPriority,ke=n.unstable_LowPriority,Re=n.unstable_IdlePriority,Mt=n.log,gn=n.unstable_setDisableYieldValue,bt=null,it=null;function kt(e){if(typeof Mt=="function"&&gn(e),it&&typeof it.setStrictMode=="function")try{it.setStrictMode(bt,e)}catch{}}var qe=Math.clz32?Math.clz32:$g,Ln=Math.log,en=Math.LN2;function $g(e){return e>>>=0,e===0?32:31-(Ln(e)/en|0)|0}var Ha=256,qa=262144,Ya=4194304;function sl(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ga(e,t,l){var i=e.pendingLanes;if(i===0)return 0;var u=0,s=e.suspendedLanes,g=e.pingedLanes;e=e.warmLanes;var v=i&134217727;return v!==0?(i=v&~s,i!==0?u=sl(i):(g&=v,g!==0?u=sl(g):l||(l=v&~e,l!==0&&(u=sl(l))))):(v=i&~s,v!==0?u=sl(v):g!==0?u=sl(g):l||(l=i&~e,l!==0&&(u=sl(l)))),u===0?0:t!==0&&t!==u&&(t&s)===0&&(s=u&-u,l=t&-t,s>=l||s===32&&(l&4194048)!==0)?t:u}function zi(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Wg(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Yc(){var e=Ya;return Ya<<=1,(Ya&62914560)===0&&(Ya=4194304),e}function wo(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function Oi(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Pg(e,t,l,i,u,s){var g=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var v=e.entanglements,C=e.expirationTimes,M=e.hiddenUpdates;for(l=g&~l;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var ay=/[\n"\\]/g;function Vt(e){return e.replace(ay,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Oo(e,t,l,i,u,s,g,v){e.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.type=g:e.removeAttribute("type"),t!=null?g==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Gt(t)):e.value!==""+Gt(t)&&(e.value=""+Gt(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?_o(e,g,Gt(t)):l!=null?_o(e,g,Gt(l)):i!=null&&e.removeAttribute("value"),u==null&&s!=null&&(e.defaultChecked=!!s),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.name=""+Gt(v):e.removeAttribute("name")}function ef(e,t,l,i,u,s,g,v){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||l!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){zo(e);return}l=l!=null?""+Gt(l):"",t=t!=null?""+Gt(t):l,v||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=v?e.checked:!!i,e.defaultChecked=!!i,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.name=g),zo(e)}function _o(e,t,l){t==="number"&&Qa(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function ql(e,t,l,i){if(e=e.options,t){t={};for(var u=0;u"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jo=!1;if(vn)try{var Ri={};Object.defineProperty(Ri,"passive",{get:function(){jo=!0}}),window.addEventListener("test",Ri,Ri),window.removeEventListener("test",Ri,Ri)}catch{jo=!1}var Bn=null,Lo=null,Ka=null;function uf(){if(Ka)return Ka;var e,t=Lo,l=t.length,i,u="value"in Bn?Bn.value:Bn.textContent,s=u.length;for(e=0;e=Li),pf=" ",mf=!1;function gf(e,t){switch(e){case"keyup":return Ry.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Xl=!1;function jy(e,t){switch(e){case"compositionend":return yf(t);case"keypress":return t.which!==32?null:(mf=!0,pf);case"textInput":return e=t.data,e===pf&&mf?null:e;default:return null}}function Ly(e,t){if(Xl)return e==="compositionend"||!Yo&&gf(e,t)?(e=uf(),Ka=Lo=Bn=null,Xl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:l,offset:t-e};e=i}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Af(l)}}function Tf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Qa(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=Qa(e.document)}return t}function Xo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Xy=vn&&"documentMode"in document&&11>=document.documentMode,Ql=null,Qo=null,qi=null,Zo=!1;function Of(e,t,l){var i=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Zo||Ql==null||Ql!==Qa(i)||(i=Ql,"selectionStart"in i&&Xo(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),qi&&Hi(qi,i)||(qi=i,i=qr(Qo,"onSelect"),0>=g,u-=g,un=1<<32-qe(t)+u|l<ve?(Te=ie,ie=null):Te=ie.sibling;var Me=R(z,ie,_[ve],V);if(Me===null){ie===null&&(ie=Te);break}e&&ie&&Me.alternate===null&&t(z,ie),E=s(Me,E,ve),_e===null?se=Me:_e.sibling=Me,_e=Me,ie=Te}if(ve===_.length)return l(z,ie),ze&&kn(z,ve),se;if(ie===null){for(;ve<_.length;ve++)ie=X(z,_[ve],V),ie!==null&&(E=s(ie,E,ve),_e===null?se=ie:_e.sibling=ie,_e=ie);return ze&&kn(z,ve),se}for(ie=i(ie);ve<_.length;ve++)Te=j(ie,z,ve,_[ve],V),Te!==null&&(e&&Te.alternate!==null&&ie.delete(Te.key===null?ve:Te.key),E=s(Te,E,ve),_e===null?se=Te:_e.sibling=Te,_e=Te);return e&&ie.forEach(function(rl){return t(z,rl)}),ze&&kn(z,ve),se}function fe(z,E,_,V){if(_==null)throw Error(o(151));for(var se=null,_e=null,ie=E,ve=E=0,Te=null,Me=_.next();ie!==null&&!Me.done;ve++,Me=_.next()){ie.index>ve?(Te=ie,ie=null):Te=ie.sibling;var rl=R(z,ie,Me.value,V);if(rl===null){ie===null&&(ie=Te);break}e&&ie&&rl.alternate===null&&t(z,ie),E=s(rl,E,ve),_e===null?se=rl:_e.sibling=rl,_e=rl,ie=Te}if(Me.done)return l(z,ie),ze&&kn(z,ve),se;if(ie===null){for(;!Me.done;ve++,Me=_.next())Me=X(z,Me.value,V),Me!==null&&(E=s(Me,E,ve),_e===null?se=Me:_e.sibling=Me,_e=Me);return ze&&kn(z,ve),se}for(ie=i(ie);!Me.done;ve++,Me=_.next())Me=j(ie,z,ve,Me.value,V),Me!==null&&(e&&Me.alternate!==null&&ie.delete(Me.key===null?ve:Me.key),E=s(Me,E,ve),_e===null?se=Me:_e.sibling=Me,_e=Me);return e&&ie.forEach(function(cb){return t(z,cb)}),ze&&kn(z,ve),se}function He(z,E,_,V){if(typeof _=="object"&&_!==null&&_.type===U&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case x:e:{for(var se=_.key;E!==null;){if(E.key===se){if(se=_.type,se===U){if(E.tag===7){l(z,E.sibling),V=u(E,_.props.children),V.return=z,z=V;break e}}else if(E.elementType===se||typeof se=="object"&&se!==null&&se.$$typeof===he&&xl(se)===E.type){l(z,E.sibling),V=u(E,_.props),Zi(V,_),V.return=z,z=V;break e}l(z,E);break}else t(z,E);E=E.sibling}_.type===U?(V=ml(_.props.children,z.mode,V,_.key),V.return=z,z=V):(V=lr(_.type,_.key,_.props,null,z.mode,V),Zi(V,_),V.return=z,z=V)}return g(z);case T:e:{for(se=_.key;E!==null;){if(E.key===se)if(E.tag===4&&E.stateNode.containerInfo===_.containerInfo&&E.stateNode.implementation===_.implementation){l(z,E.sibling),V=u(E,_.children||[]),V.return=z,z=V;break e}else{l(z,E);break}else t(z,E);E=E.sibling}V=Po(_,z.mode,V),V.return=z,z=V}return g(z);case he:return _=xl(_),He(z,E,_,V)}if($(_))return ne(z,E,_,V);if(B(_)){if(se=B(_),typeof se!="function")throw Error(o(150));return _=se.call(_),fe(z,E,_,V)}if(typeof _.then=="function")return He(z,E,cr(_),V);if(_.$$typeof===Q)return He(z,E,rr(z,_),V);fr(z,_)}return typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint"?(_=""+_,E!==null&&E.tag===6?(l(z,E.sibling),V=u(E,_),V.return=z,z=V):(l(z,E),V=Wo(_,z.mode,V),V.return=z,z=V),g(z)):l(z,E)}return function(z,E,_,V){try{Qi=0;var se=He(z,E,_,V);return ni=null,se}catch(ie){if(ie===ti||ie===ur)throw ie;var _e=Rt(29,ie,null,z.mode);return _e.lanes=V,_e.return=z,_e}finally{}}}var Sl=Wf(!0),Pf=Wf(!1),Vn=!1;function fu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function du(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Xn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Qn(e,t,l){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(De&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=nr(e),Lf(e,null,l),t}return tr(e,i,t,l),nr(e)}function Ki(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,Vc(e,l)}}function hu(e,t){var l=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,l===i)){var u=null,s=null;if(l=l.firstBaseUpdate,l!==null){do{var g={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};s===null?u=s=g:s=s.next=g,l=l.next}while(l!==null);s===null?u=s=t:s=s.next=t}else u=s=t;l={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:s,shared:i.shared,callbacks:i.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var pu=!1;function Fi(){if(pu){var e=ei;if(e!==null)throw e}}function Ii(e,t,l,i){pu=!1;var u=e.updateQueue;Vn=!1;var s=u.firstBaseUpdate,g=u.lastBaseUpdate,v=u.shared.pending;if(v!==null){u.shared.pending=null;var C=v,M=C.next;C.next=null,g===null?s=M:g.next=M,g=C;var q=e.alternate;q!==null&&(q=q.updateQueue,v=q.lastBaseUpdate,v!==g&&(v===null?q.firstBaseUpdate=M:v.next=M,q.lastBaseUpdate=C))}if(s!==null){var X=u.baseState;g=0,q=M=C=null,v=s;do{var R=v.lane&-536870913,j=R!==v.lane;if(j?(Ee&R)===R:(i&R)===R){R!==0&&R===Pl&&(pu=!0),q!==null&&(q=q.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var ne=e,fe=v;R=t;var He=l;switch(fe.tag){case 1:if(ne=fe.payload,typeof ne=="function"){X=ne.call(He,X,R);break e}X=ne;break e;case 3:ne.flags=ne.flags&-65537|128;case 0:if(ne=fe.payload,R=typeof ne=="function"?ne.call(He,X,R):ne,R==null)break e;X=y({},X,R);break e;case 2:Vn=!0}}R=v.callback,R!==null&&(e.flags|=64,j&&(e.flags|=8192),j=u.callbacks,j===null?u.callbacks=[R]:j.push(R))}else j={lane:R,tag:v.tag,payload:v.payload,callback:v.callback,next:null},q===null?(M=q=j,C=X):q=q.next=j,g|=R;if(v=v.next,v===null){if(v=u.shared.pending,v===null)break;j=v,v=j.next,j.next=null,u.lastBaseUpdate=j,u.shared.pending=null}}while(!0);q===null&&(C=X),u.baseState=C,u.firstBaseUpdate=M,u.lastBaseUpdate=q,s===null&&(u.shared.lanes=0),Jn|=g,e.lanes=g,e.memoizedState=X}}function ed(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function td(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;es?s:8;var g=O.T,v={};O.T=v,Ru(e,!1,t,l);try{var C=u(),M=O.S;if(M!==null&&M(v,C),C!==null&&typeof C=="object"&&typeof C.then=="function"){var q=Py(C,i);Wi(e,t,q,Bt(e))}else Wi(e,t,i,Bt(e))}catch(X){Wi(e,t,{then:function(){},status:"rejected",reason:X},Bt())}finally{K.p=s,g!==null&&v.types!==null&&(g.types=v.types),O.T=g}}function a1(){}function Mu(e,t,l,i){if(e.tag!==5)throw Error(o(476));var u=Rd(e).queue;Dd(e,u,t,ae,l===null?a1:function(){return Nd(e),l(i)})}function Rd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:An,lastRenderedState:ae},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:An,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Nd(e){var t=Rd(e);t.next===null&&(t=e.alternate.memoizedState),Wi(e,t.next.queue,{},Bt())}function Du(){return ft(ma)}function jd(){return $e().memoizedState}function Ld(){return $e().memoizedState}function r1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=Bt();e=Xn(l);var i=Qn(t,e,l);i!==null&&(zt(i,t,l),Ki(i,t,l)),t={cache:ou()},e.payload=t;return}t=t.return}}function o1(e,t,l){var i=Bt();l={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},kr(e)?Bd(t,l):(l=Jo(e,t,l,i),l!==null&&(zt(l,e,i),Hd(l,t,i)))}function Ud(e,t,l){var i=Bt();Wi(e,t,l,i)}function Wi(e,t,l,i){var u={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(kr(e))Bd(t,u);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var g=t.lastRenderedState,v=s(g,l);if(u.hasEagerState=!0,u.eagerState=v,Dt(v,g))return tr(e,t,u,0),Ye===null&&er(),!1}catch{}finally{}if(l=Jo(e,t,u,i),l!==null)return zt(l,e,i),Hd(l,t,i),!0}return!1}function Ru(e,t,l,i){if(i={lane:2,revertLane:fs(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},kr(e)){if(t)throw Error(o(479))}else t=Jo(e,l,i,2),t!==null&&zt(t,e,2)}function kr(e){var t=e.alternate;return e===be||t!==null&&t===be}function Bd(e,t){ii=pr=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Hd(e,t,l){if((l&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,Vc(e,l)}}var Pi={readContext:ft,use:yr,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useLayoutEffect:Fe,useInsertionEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useSyncExternalStore:Fe,useId:Fe,useHostTransitionStatus:Fe,useFormState:Fe,useActionState:Fe,useOptimistic:Fe,useMemoCache:Fe,useCacheRefresh:Fe};Pi.useEffectEvent=Fe;var qd={readContext:ft,use:yr,useCallback:function(e,t){return vt().memoizedState=[e,t===void 0?null:t],e},useContext:ft,useEffect:wd,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,vr(4194308,4,Td.bind(null,t,e),l)},useLayoutEffect:function(e,t){return vr(4194308,4,e,t)},useInsertionEffect:function(e,t){vr(4,2,e,t)},useMemo:function(e,t){var l=vt();t=t===void 0?null:t;var i=e();if(wl){kt(!0);try{e()}finally{kt(!1)}}return l.memoizedState=[i,t],i},useReducer:function(e,t,l){var i=vt();if(l!==void 0){var u=l(t);if(wl){kt(!0);try{l(t)}finally{kt(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=o1.bind(null,be,e),[i.memoizedState,e]},useRef:function(e){var t=vt();return e={current:e},t.memoizedState=e},useState:function(e){e=Eu(e);var t=e.queue,l=Ud.bind(null,be,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Ou,useDeferredValue:function(e,t){var l=vt();return _u(l,e,t)},useTransition:function(){var e=Eu(!1);return e=Dd.bind(null,be,e.queue,!0,!1),vt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var i=be,u=vt();if(ze){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),Ye===null)throw Error(o(349));(Ee&127)!==0||od(i,t,l)}u.memoizedState=l;var s={value:l,getSnapshot:t};return u.queue=s,wd(sd.bind(null,i,s,e),[e]),i.flags|=2048,ri(9,{destroy:void 0},ud.bind(null,i,s,l,t),null),l},useId:function(){var e=vt(),t=Ye.identifierPrefix;if(ze){var l=sn,i=un;l=(i&~(1<<32-qe(i)-1)).toString(32)+l,t="_"+t+"R_"+l,l=mr++,0<\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof i.is=="string"?g.createElement("select",{is:i.is}):g.createElement("select"),i.multiple?s.multiple=!0:i.size&&(s.size=i.size);break;default:s=typeof i.is=="string"?g.createElement(u,{is:i.is}):g.createElement(u)}}s[st]=t,s[St]=i;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)s.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===t)break e;for(;g.sibling===null;){if(g.return===null||g.return===t)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}t.stateNode=s;e:switch(ht(s,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Tn(t)}}return Qe(t),Ku(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Tn(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(o(166));if(e=ue.current,$l(t)){if(e=t.stateNode,l=t.memoizedProps,i=null,u=ct,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[st]=t,e=!!(e.nodeValue===l||i!==null&&i.suppressHydrationWarning===!0||ap(e.nodeValue,l)),e||Yn(t,!0)}else e=Yr(e).createTextNode(i),e[st]=t,t.stateNode=e}return Qe(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(i=$l(t),l!==null){if(e===null){if(!i)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[st]=t}else gl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),e=!1}else l=lu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(jt(t),t):(jt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Qe(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=$l(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[st]=t}else gl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),u=!1}else u=lu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(jt(t),t):(jt(t),null)}return jt(t),(t.flags&128)!==0?(t.lanes=l,t):(l=i!==null,e=e!==null&&e.memoizedState!==null,l&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==u&&(i.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),Er(t,t.updateQueue),Qe(t),null);case 4:return Le(),e===null&&ms(t.stateNode.containerInfo),Qe(t),null;case 10:return wn(t.type),Qe(t),null;case 19:if(Y(Je),i=t.memoizedState,i===null)return Qe(t),null;if(u=(t.flags&128)!==0,s=i.rendering,s===null)if(u)ta(i,!1);else{if(Ie!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=hr(e),s!==null){for(t.flags|=128,ta(i,!1),e=s.updateQueue,t.updateQueue=e,Er(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Uf(l,e),l=l.sibling;return S(Je,Je.current&1|2),ze&&kn(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&yt()>Mr&&(t.flags|=128,u=!0,ta(i,!1),t.lanes=4194304)}else{if(!u)if(e=hr(s),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Er(t,e),ta(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!ze)return Qe(t),null}else 2*yt()-i.renderingStartTime>Mr&&l!==536870912&&(t.flags|=128,u=!0,ta(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(e=i.last,e!==null?e.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=yt(),e.sibling=null,l=Je.current,S(Je,u?l&1|2:l&1),ze&&kn(t,i.treeForkCount),e):(Qe(t),null);case 22:case 23:return jt(t),gu(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(l&536870912)!==0&&(t.flags&128)===0&&(Qe(t),t.subtreeFlags&6&&(t.flags|=8192)):Qe(t),l=t.updateQueue,l!==null&&Er(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==l&&(t.flags|=2048),e!==null&&Y(vl),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),wn(Pe),Qe(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function d1(e,t){switch(tu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return wn(Pe),Le(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pn(t),null;case 31:if(t.memoizedState!==null){if(jt(t),t.alternate===null)throw Error(o(340));gl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));gl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Y(Je),null;case 4:return Le(),null;case 10:return wn(t.type),null;case 22:case 23:return jt(t),gu(),e!==null&&Y(vl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return wn(Pe),null;case 25:return null;default:return null}}function ch(e,t){switch(tu(t),t.tag){case 3:wn(Pe),Le();break;case 26:case 27:case 5:pn(t);break;case 4:Le();break;case 31:t.memoizedState!==null&&jt(t);break;case 13:jt(t);break;case 19:Y(Je);break;case 10:wn(t.type);break;case 22:case 23:jt(t),gu(),e!==null&&Y(vl);break;case 24:wn(Pe)}}function na(e,t){try{var l=t.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var u=i.next;l=u;do{if((l.tag&e)===e){i=void 0;var s=l.create,g=l.inst;i=s(),g.destroy=i}l=l.next}while(l!==u)}}catch(v){je(t,t.return,v)}}function Fn(e,t,l){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var s=u.next;i=s;do{if((i.tag&e)===e){var g=i.inst,v=g.destroy;if(v!==void 0){g.destroy=void 0,u=t;var C=l,M=v;try{M()}catch(q){je(u,C,q)}}}i=i.next}while(i!==s)}}catch(q){je(t,t.return,q)}}function fh(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{td(t,l)}catch(i){je(e,e.return,i)}}}function dh(e,t,l){l.props=Cl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(i){je(e,t,i)}}function la(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof l=="function"?e.refCleanup=l(i):l.current=i}}catch(u){je(e,t,u)}}function cn(e,t){var l=e.ref,i=e.refCleanup;if(l!==null)if(typeof i=="function")try{i()}catch(u){je(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(u){je(e,t,u)}else l.current=null}function hh(e){var t=e.type,l=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break e;case"img":l.src?i.src=l.src:l.srcSet&&(i.srcset=l.srcSet)}}catch(u){je(e,e.return,u)}}function Fu(e,t,l){try{var i=e.stateNode;N1(i,e.type,l,t),i[St]=t}catch(u){je(e,e.return,u)}}function ph(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tl(e.type)||e.tag===4}function Iu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ph(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&tl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ju(e,t,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=bn));else if(i!==4&&(i===27&&tl(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Ju(e,t,l),e=e.sibling;e!==null;)Ju(e,t,l),e=e.sibling}function Tr(e,t,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(i!==4&&(i===27&&tl(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Tr(e,t,l),e=e.sibling;e!==null;)Tr(e,t,l),e=e.sibling}function mh(e){var t=e.stateNode,l=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);ht(t,i,l),t[st]=e,t[St]=l}catch(s){je(e,e.return,s)}}var zn=!1,nt=!1,$u=!1,gh=typeof WeakSet=="function"?WeakSet:Set,ot=null;function h1(e,t){if(e=e.containerInfo,bs=Fr,e=zf(e),Xo(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var i=l.getSelection&&l.getSelection();if(i&&i.rangeCount!==0){l=i.anchorNode;var u=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{l.nodeType,s.nodeType}catch{l=null;break e}var g=0,v=-1,C=-1,M=0,q=0,X=e,R=null;t:for(;;){for(var j;X!==l||u!==0&&X.nodeType!==3||(v=g+u),X!==s||i!==0&&X.nodeType!==3||(C=g+i),X.nodeType===3&&(g+=X.nodeValue.length),(j=X.firstChild)!==null;)R=X,X=j;for(;;){if(X===e)break t;if(R===l&&++M===u&&(v=g),R===s&&++q===i&&(C=g),(j=X.nextSibling)!==null)break;X=R,R=X.parentNode}X=j}l=v===-1||C===-1?null:{start:v,end:C}}else l=null}l=l||{start:0,end:0}}else l=null;for(vs={focusedElem:e,selectionRange:l},Fr=!1,ot=t;ot!==null;)if(t=ot,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ot=e;else for(;ot!==null;){switch(t=ot,s=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l title"))),ht(s,i,l),s[st]=e,rt(s),i=s;break e;case"link":var g=Sp("link","href",u).get(i+(l.href||""));if(g){for(var v=0;vHe&&(g=He,He=fe,fe=g);var z=Ef(v,fe),E=Ef(v,He);if(z&&E&&(j.rangeCount!==1||j.anchorNode!==z.node||j.anchorOffset!==z.offset||j.focusNode!==E.node||j.focusOffset!==E.offset)){var _=X.createRange();_.setStart(z.node,z.offset),j.removeAllRanges(),fe>He?(j.addRange(_),j.extend(E.node,E.offset)):(_.setEnd(E.node,E.offset),j.addRange(_))}}}}for(X=[],j=v;j=j.parentNode;)j.nodeType===1&&X.push({element:j,left:j.scrollLeft,top:j.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;vl?32:l,O.T=null,l=is,is=null;var s=Wn,g=Rn;if(at=0,fi=Wn=null,Rn=0,(De&6)!==0)throw Error(o(331));var v=De;if(De|=4,Th(s.current),Ch(s,s.current,g,l),De=v,sa(0,!1),it&&typeof it.onPostCommitFiberRoot=="function")try{it.onPostCommitFiberRoot(bt,s)}catch{}return!0}finally{K.p=u,O.T=i,Qh(e,t)}}function Kh(e,t,l){t=Qt(l,t),t=Uu(e.stateNode,t,2),e=Qn(e,t,2),e!==null&&(Oi(e,2),fn(e))}function je(e,t,l){if(e.tag===3)Kh(e,e,l);else for(;t!==null;){if(t.tag===3){Kh(t,e,l);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&($n===null||!$n.has(i))){e=Qt(l,e),l=Fd(2),i=Qn(t,l,2),i!==null&&(Id(l,i,t,e),Oi(i,2),fn(i));break}}t=t.return}}function us(e,t,l){var i=e.pingCache;if(i===null){i=e.pingCache=new g1;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(l)||(es=!0,u.add(l),e=k1.bind(null,e,t,l),t.then(e,e))}function k1(e,t,l){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Ye===e&&(Ee&l)===l&&(Ie===4||Ie===3&&(Ee&62914560)===Ee&&300>yt()-_r?(De&2)===0&&di(e,0):ts|=l,ci===Ee&&(ci=0)),fn(e)}function Fh(e,t){t===0&&(t=Yc()),e=pl(e,t),e!==null&&(Oi(e,t),fn(e))}function S1(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Fh(e,l)}function w1(e,t){var l=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(l=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(o(314))}i!==null&&i.delete(t),Fh(e,l)}function C1(e,t){return Nl(e,t)}var Ur=null,pi=null,ss=!1,Br=!1,cs=!1,el=0;function fn(e){e!==pi&&e.next===null&&(pi===null?Ur=pi=e:pi=pi.next=e),Br=!0,ss||(ss=!0,E1())}function sa(e,t){if(!cs&&Br){cs=!0;do for(var l=!1,i=Ur;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var s=0;else{var g=i.suspendedLanes,v=i.pingedLanes;s=(1<<31-qe(42|e)+1)-1,s&=u&~(g&~v),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(l=!0,Wh(i,s))}else s=Ee,s=Ga(i,i===Ye?s:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(s&3)===0||zi(i,s)||(l=!0,Wh(i,s));i=i.next}while(l);cs=!1}}function A1(){Ih()}function Ih(){Br=ss=!1;var e=0;el!==0&&L1()&&(e=el);for(var t=yt(),l=null,i=Ur;i!==null;){var u=i.next,s=Jh(i,t);s===0?(i.next=null,l===null?Ur=u:l.next=u,u===null&&(pi=l)):(l=i,(e!==0||(s&3)!==0)&&(Br=!0)),i=u}at!==0&&at!==5||sa(e),el!==0&&(el=0)}function Jh(e,t){for(var l=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,s=e.pendingLanes&-62914561;0v)break;var q=C.transferSize,X=C.initiatorType;q&&rp(X)&&(C=C.responseEnd,g+=q*(C"u"?null:document;function bp(e,t,l){var i=mi;if(i&&typeof t=="string"&&t){var u=Vt(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof l=="string"&&(u+='[crossorigin="'+l+'"]'),yp.has(u)||(yp.add(u),e={rel:e,crossOrigin:l,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),ht(t,"link",e),rt(t),i.head.appendChild(t)))}}function Q1(e){Nn.D(e),bp("dns-prefetch",e,null)}function Z1(e,t){Nn.C(e,t),bp("preconnect",e,t)}function K1(e,t,l){Nn.L(e,t,l);var i=mi;if(i&&e&&t){var u='link[rel="preload"][as="'+Vt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(u+='[imagesrcset="'+Vt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(u+='[imagesizes="'+Vt(l.imageSizes)+'"]')):u+='[href="'+Vt(e)+'"]';var s=u;switch(t){case"style":s=gi(e);break;case"script":s=yi(e)}$t.has(s)||(e=y({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),$t.set(s,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(ha(s))||t==="script"&&i.querySelector(pa(s))||(t=i.createElement("link"),ht(t,"link",e),rt(t),i.head.appendChild(t)))}}function F1(e,t){Nn.m(e,t);var l=mi;if(l&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Vt(i)+'"][href="'+Vt(e)+'"]',s=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=yi(e)}if(!$t.has(s)&&(e=y({rel:"modulepreload",href:e},t),$t.set(s,e),l.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(pa(s)))return}i=l.createElement("link"),ht(i,"link",e),rt(i),l.head.appendChild(i)}}}function I1(e,t,l){Nn.S(e,t,l);var i=mi;if(i&&e){var u=Bl(i).hoistableStyles,s=gi(e);t=t||"default";var g=u.get(s);if(!g){var v={loading:0,preload:null};if(g=i.querySelector(ha(s)))v.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":t},l),(l=$t.get(s))&&Es(e,l);var C=g=i.createElement("link");rt(C),ht(C,"link",e),C._p=new Promise(function(M,q){C.onload=M,C.onerror=q}),C.addEventListener("load",function(){v.loading|=1}),C.addEventListener("error",function(){v.loading|=2}),v.loading|=4,Vr(g,t,i)}g={type:"stylesheet",instance:g,count:1,state:v},u.set(s,g)}}}function J1(e,t){Nn.X(e,t);var l=mi;if(l&&e){var i=Bl(l).hoistableScripts,u=yi(e),s=i.get(u);s||(s=l.querySelector(pa(u)),s||(e=y({src:e,async:!0},t),(t=$t.get(u))&&Ts(e,t),s=l.createElement("script"),rt(s),ht(s,"link",e),l.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(u,s))}}function $1(e,t){Nn.M(e,t);var l=mi;if(l&&e){var i=Bl(l).hoistableScripts,u=yi(e),s=i.get(u);s||(s=l.querySelector(pa(u)),s||(e=y({src:e,async:!0,type:"module"},t),(t=$t.get(u))&&Ts(e,t),s=l.createElement("script"),rt(s),ht(s,"link",e),l.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},i.set(u,s))}}function vp(e,t,l,i){var u=(u=ue.current)?Gr(u):null;if(!u)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=gi(l.href),l=Bl(u).hoistableStyles,i=l.get(t),i||(i={type:"style",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=gi(l.href);var s=Bl(u).hoistableStyles,g=s.get(e);if(g||(u=u.ownerDocument||u,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,g),(s=u.querySelector(ha(e)))&&!s._p&&(g.instance=s,g.state.loading=5),$t.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},$t.set(e,l),s||W1(u,e,l,g.state))),t&&i===null)throw Error(o(528,""));return g}if(t&&i!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=yi(l),l=Bl(u).hoistableScripts,i=l.get(t),i||(i={type:"script",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function gi(e){return'href="'+Vt(e)+'"'}function ha(e){return'link[rel="stylesheet"]['+e+"]"}function xp(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function W1(e,t,l,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),ht(t,"link",l),rt(t),e.head.appendChild(t))}function yi(e){return'[src="'+Vt(e)+'"]'}function pa(e){return"script[async]"+e}function kp(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Vt(l.href)+'"]');if(i)return t.instance=i,rt(i),i;var u=y({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),rt(i),ht(i,"style",u),Vr(i,l.precedence,e),t.instance=i;case"stylesheet":u=gi(l.href);var s=e.querySelector(ha(u));if(s)return t.state.loading|=4,t.instance=s,rt(s),s;i=xp(l),(u=$t.get(u))&&Es(i,u),s=(e.ownerDocument||e).createElement("link"),rt(s);var g=s;return g._p=new Promise(function(v,C){g.onload=v,g.onerror=C}),ht(s,"link",i),t.state.loading|=4,Vr(s,l.precedence,e),t.instance=s;case"script":return s=yi(l.src),(u=e.querySelector(pa(s)))?(t.instance=u,rt(u),u):(i=l,(u=$t.get(s))&&(i=y({},l),Ts(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),rt(u),ht(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Vr(i,l.precedence,e));return t.instance}function Vr(e,t,l){for(var i=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,s=u,g=0;g title"):null)}function P1(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Cp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function eb(e,t,l,i){if(l.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var u=gi(i.href),s=t.querySelector(ha(u));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Qr.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=s,rt(s);return}s=t.ownerDocument||t,i=xp(i),(u=$t.get(u))&&Es(i,u),s=s.createElement("link"),rt(s);var g=s;g._p=new Promise(function(v,C){g.onload=v,g.onerror=C}),ht(s,"link",i),l.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Qr.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var zs=0;function tb(e,t){return e.stylesheets&&e.count===0&&Kr(e,e.stylesheets),0zs?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function Qr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Kr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Zr=null;function Kr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Zr=new Map,t.forEach(nb,e),Zr=null,Qr.call(e))}function nb(e,t){if(!(t.state.loading&4)){var l=Zr.get(e);if(l)var i=l.get(null);else{l=new Map,Zr.set(e,l);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),Us.exports=vb(),Us.exports}var kb=xb();const Sb=`--- title: "Agents" description: "One adaptive Research agent, bounded internal task profiles, a read-only plan mode, and custom agent profiles." icon: "bot" @@ -217,7 +217,7 @@ Connected, your account holds the canonical copy of every synced credential; the What leaves your machine in each mode. -`,Cb='---\ntitle: "Command reference"\ndescription: "Every openscience subcommand: workspace, run, sessions, models, agents, skills, and lifecycle."\nicon: "terminal"\n---\n\nThe OpenScience command surface. For live help, run `openscience --help` and `openscience --help`.\n\nThe bare `openscience` (no arguments) starts the local server and opens the **browser workspace** in your working directory. Everything else is grouped below.\n\n## Global flags\n\n| Flag | Use |\n| --- | --- |\n| `-v, --version` | Print the installed version. |\n| `-h, --help` | Print help for a command. |\n| `--print-logs` | Stream agent diagnostics to stderr. |\n| `--log-level ` | Override the log threshold. |\n\n## Workspace and runs\n\n| Command | Use |\n| --- | --- |\n| `openscience` | Start the server and open the browser workspace. |\n| `openscience run [message..]` | One-shot prompt in the terminal; streams, then exits. |\n| `openscience session list` | List recent sessions (`-n`, `--format`). |\n\n`run` flags: `-c/--continue`, `-s/--session `, `-m/--model `, `--variant ` (provider-specific reasoning effort), `--effort ` (Research breadth), `--format `, `-f/--file `, `--attach ` (attach to a running server, e.g. `http://localhost:4096`), `--port`, `--title `.\n\n```bash\nopenscience run "Plot the attention entropy across layers for this checkpoint"\nopenscience run -c "Now sweep the temperature and re-plot"\nopenscience run --format json "Summarize the experiment in results/" > summary.json\n```\n\n## Account\n\nConnecting an Atlas account is optional — see [Atlas](/openscience/atlas). OpenScience runs fully standalone with your own provider keys.\n\n| Command | Use |\n| --- | --- |\n| `openscience init` | First-run setup wizard — choose managed models, your own keys, or skip. Rerun anytime (alias `onboard`). |\n| `openscience login` | Connect your Atlas account (browser flow, or `--key thk_…`). |\n| `openscience status` | One view of your Atlas state — account, synced services, subscription, wallet balance + lifetime spend, recent usage, managed-compute availability, and the bundled `atlas` companion version (alias `whoami`). |\n| `openscience sync` | Re-pull synced credentials. |\n| `openscience devices` | List authorized devices. |\n| `openscience logout` | Disconnect this device from Atlas. |\n| `openscience doctor` | Report what\'s configured: account, provider keys, wallet, default model. |\n\n`openscience connect …` still works as an alias for `login` / `logout` / `status` / `sync` / `devices`.\n\n## Providers and routing\n\n| Command | Use |\n| --- | --- |\n| `openscience keys add` | Add a provider API key (BYOK; OAuth sign-in where supported). Alias: `auth`. |\n| `openscience keys signin` | Sign in with ChatGPT / Codex (subscription). |\n| `openscience keys list` | List saved provider keys and active env vars. |\n| `openscience keys rm` | Remove a saved provider key. |\n| `openscience models` | List configured providers and their models. |\n| `openscience wallet` | Wallet balance and key routing (alias `billing`). |\n| `openscience wallet topup` | Open the app to add credit. |\n\n## Sandbox\n\n| Command | Use |\n| --- | --- |\n| `openscience sandbox` | Show sandbox status: OS backend + current policy. |\n| `openscience sandbox enable` | Confine local execution to approved paths (`--network deny`, `--allow `, `--on-unavailable `, `--[no-]require-project-trust`). |\n| `openscience sandbox disable` | Turn the sandbox off. |\n| `openscience sandbox test` | Prove containment on this machine (writes inside/outside the workspace, network egress). |\n\nEnabled and fail-closed by default. Routine contained work does not require project trust; remote jobs, kernel environment changes, project extensions, and host execution do. See [Sandbox and project trust](/openscience/sandbox).\n\n## Agent profiles\n\n| Command | Use |\n| --- | --- |\n| `openscience agent list` | Print the agent roster on this install. |\n| `openscience agent create` | Scaffold a custom agent (system prompt + tool set + routing policy). |\n\nFlags: `--path`, `--description`, `--mode `, `--tools`, `--model`. See [Agents](/openscience/agents).\n\n## Skills\n\n| Command | Use |\n| --- | --- |\n| `openscience skill list` | Show installed skills (`--all` for the bundled set). |\n| `openscience skill show ` | Print a skill\'s metadata and entrypoints. |\n| `openscience skill add ` | Install a skill (URL or `gh:owner/repo`). |\n| `openscience skill new` / `edit` / `validate` | Author, edit, and check user skills. |\n| `openscience skill remove ` | Uninstall a skill. |\n| `openscience skill set-entries ` | Update which skills surface in the `/` picker. |\n\n## Local server and protocols\n\n| Command | Use |\n| --- | --- |\n| `openscience web` | Start the server and open the browser workspace (prints the URL, e.g. `http://localhost:4096`). |\n| `openscience serve` | Headless local server — loopback-only (`127.0.0.1`), no browser. |\n| `openscience acp` | Start an Agent Client Protocol server for editors like Zed. |\n| `openscience mcp` | Manage MCP servers (`list`, `add`, `remove`, `auth`). |\n\n`web` and `serve` take `--port` and `--cors`. See [Workspace](/openscience/workspace).\n\n## GitHub and PRs\n\n| Command | Use |\n| --- | --- |\n| `openscience github` | GitHub agent for CI/Actions (`install`, `run`). |\n| `openscience pr ` | Check out a PR branch, then launch the agent on it. |\n\n## Project and lifecycle\n\n| Command | Use |\n| --- | --- |\n| `openscience project` | Pin the Atlas project root for this folder (`merge`). |\n| `openscience export` / `openscience import` | Export or import a session as JSON. |\n| `openscience generate` | Emit the OpenAPI spec for the local server to stdout. |\n| `openscience stats` | Local token-usage and cost stats. |\n| `openscience debug` | Structured diagnostics for support (`debug paths` shows data/config dirs). |\n| `openscience upgrade` | Update to the latest version. |\n| `openscience uninstall` | Remove the binary and local config. |\n| `openscience completion` | Shell completion for bash, zsh, or fish. |\n\n```bash\nopenscience upgrade\nopenscience completion zsh > ~/.zsh/completions/_openscience\n```\n\n## What\'s next\n\n\n \n The browser workspace: files, editor, sessions, and inline scientific rendering.\n \n \n Credential boundary, env hygiene, the trust boundary.\n \n \n 295 bundled research skills and the scientific databases.\n \n \n The Research harness, effort levels, plan mode, and custom profiles.\n \n\n',Eb=`--- +`,Cb='---\ntitle: "Command reference"\ndescription: "Every openscience subcommand: workspace, run, sessions, models, agents, skills, and lifecycle."\nicon: "terminal"\n---\n\nThe OpenScience command surface. For live help, run `openscience --help` and `openscience --help`.\n\nThe bare `openscience` (no arguments) starts the local server and opens the **browser workspace** in your working directory. Everything else is grouped below.\n\n## Global flags\n\n| Flag | Use |\n| --- | --- |\n| `-v, --version` | Print the installed version. |\n| `-h, --help` | Print help for a command. |\n| `--print-logs` | Stream agent diagnostics to stderr. |\n| `--log-level ` | Override the log threshold. |\n\n## Workspace and runs\n\n| Command | Use |\n| --- | --- |\n| `openscience` | Start the server and open the browser workspace. |\n| `openscience run [message..]` | One-shot prompt in the terminal; streams, then exits. |\n| `openscience session list` | List recent sessions (`-n`, `--format`). |\n\n`run` flags: `-c/--continue`, `-s/--session `, `-m/--model `, `--variant ` (provider-specific reasoning effort), `--effort ` (Research breadth), `--format `, `-f/--file `, `--attach ` (attach to a running server, e.g. `http://localhost:4096`), `--port`, `--title `.\n\n```bash\nopenscience run "Plot the attention entropy across layers for this checkpoint"\nopenscience run -c "Now sweep the temperature and re-plot"\nopenscience run --format json "Summarize the experiment in results/" > summary.json\n```\n\n## Account\n\nConnecting an Atlas account is optional — see [Atlas](/openscience/atlas). OpenScience runs fully standalone with your own provider keys.\n\n| Command | Use |\n| --- | --- |\n| `openscience init` | First-run setup wizard — choose managed models, your own keys, or skip. Rerun anytime (alias `onboard`). |\n| `openscience login` | Connect your Atlas account (browser flow, or `--key thk_…`). |\n| `openscience status` | One view of your Atlas state — account, synced services, subscription, wallet balance + lifetime spend, recent usage, managed-compute availability, and the bundled `atlas` companion version (alias `whoami`). |\n| `openscience sync` | Re-pull synced credentials. |\n| `openscience devices` | List authorized devices. |\n| `openscience logout` | Disconnect this device from Atlas. |\n| `openscience doctor` | Report what\'s configured: account, provider keys, wallet, default model. |\n\n`openscience connect …` still works as an alias for `login` / `logout` / `status` / `sync` / `devices`.\n\n## Providers and routing\n\n| Command | Use |\n| --- | --- |\n| `openscience keys add` | Add a provider API key (BYOK; OAuth sign-in where supported). Alias: `auth`. |\n| `openscience keys signin` | Sign in with ChatGPT / Codex (subscription). |\n| `openscience keys list` | List saved provider keys and active env vars. |\n| `openscience keys rm` | Remove a saved provider key. |\n| `openscience models` | List configured providers and their models. |\n| `openscience wallet` | Wallet balance and key routing (alias `billing`). |\n| `openscience wallet topup` | Open the app to add credit. |\n\n## Sandbox\n\n| Command | Use |\n| --- | --- |\n| `openscience sandbox` | Show sandbox status: OS backend + current policy. |\n| `openscience sandbox enable` | Confine local execution to approved paths (`--network deny`, `--allow `, `--on-unavailable `, `--[no-]require-project-trust`). |\n| `openscience sandbox disable` | Turn the sandbox off. |\n| `openscience sandbox test` | Prove containment on this machine (writes inside/outside the workspace, network egress). |\n\nDisabled in the default **Full access** preset. Use the composer’s **Research tools → Action approval** menu or `sandbox enable` to turn on fail-closed containment; managed policy can require it. See [Sandbox and project trust](/openscience/sandbox).\n\n## Agent profiles\n\n| Command | Use |\n| --- | --- |\n| `openscience agent list` | Print the agent roster on this install. |\n| `openscience agent create` | Scaffold a custom agent (system prompt + tool set + routing policy). |\n\nFlags: `--path`, `--description`, `--mode `, `--tools`, `--model`. See [Agents](/openscience/agents).\n\n## Skills\n\n| Command | Use |\n| --- | --- |\n| `openscience skill list` | Show installed skills (`--all` for the bundled set). |\n| `openscience skill show ` | Print a skill\'s metadata and entrypoints. |\n| `openscience skill add ` | Install a skill (URL or `gh:owner/repo`). |\n| `openscience skill new` / `edit` / `validate` | Author, edit, and check user skills. |\n| `openscience skill remove ` | Uninstall a skill. |\n| `openscience skill set-entries ` | Update which skills surface in the `/` picker. |\n\n## Local server and protocols\n\n| Command | Use |\n| --- | --- |\n| `openscience web` | Start the server and open the browser workspace (prints the URL, e.g. `http://localhost:4096`). |\n| `openscience serve` | Headless local server — loopback-only (`127.0.0.1`), no browser. |\n| `openscience acp` | Start an Agent Client Protocol server for editors like Zed. |\n| `openscience mcp` | Manage MCP servers (`list`, `add`, `remove`, `auth`). |\n\n`web` and `serve` take `--port` and `--cors`. See [Workspace](/openscience/workspace).\n\n## GitHub and PRs\n\n| Command | Use |\n| --- | --- |\n| `openscience github` | GitHub agent for CI/Actions (`install`, `run`). |\n| `openscience pr ` | Check out a PR branch, then launch the agent on it. |\n\n## Project and lifecycle\n\n| Command | Use |\n| --- | --- |\n| `openscience project` | Pin the Atlas project root for this folder (`merge`). |\n| `openscience export` / `openscience import` | Export or import a session as JSON. |\n| `openscience generate` | Emit the OpenAPI spec for the local server to stdout. |\n| `openscience stats` | Local token-usage and cost stats. |\n| `openscience debug` | Structured diagnostics for support (`debug paths` shows data/config dirs). |\n| `openscience upgrade` | Update to the latest version. |\n| `openscience uninstall` | Remove the binary and local config. |\n| `openscience completion` | Shell completion for bash, zsh, or fish. |\n\n```bash\nopenscience upgrade\nopenscience completion zsh > ~/.zsh/completions/_openscience\n```\n\n## What\'s next\n\n\n \n The browser workspace: files, editor, sessions, and inline scientific rendering.\n \n \n Credential boundary, env hygiene, the trust boundary.\n \n \n 295 bundled research skills and the scientific databases.\n \n \n The Research harness, effort levels, plan mode, and custom profiles.\n \n\n',Ab=`--- title: "OpenScience" description: "The open-source AI workbench for scientific research. Give it a goal — it reads the literature, writes and runs code, runs the experiments, and writes up what it found." icon: "flask-conical" @@ -295,7 +295,7 @@ Connect an Atlas account and OpenScience records its research into [Atlas graphs A tour of the browser workspace and the local server behind it. -`,Ab='---\ntitle: "Local models"\ndescription: "Run OpenScience against a local LLM — Ollama, LM Studio, llama.cpp, vLLM, or any OpenAI-compatible endpoint. Free, offline, no API key."\nicon: "server"\n---\n\nOpenScience talks to any **OpenAI-compatible** endpoint running on your machine. That covers [Ollama](https://ollama.com), [LM Studio](https://lmstudio.ai), [llama.cpp](https://github.com/ggml-org/llama.cpp)\'s server, [vLLM](https://github.com/vllm-project/vllm), [Jan](https://jan.ai), and anything else that speaks the OpenAI `/v1` API. Local models run entirely on your hardware and are **free, offline, and never metered against Credits**.\n\n## Quick start (Ollama)\n\n```bash\nollama serve # start the server (usually already running)\nollama pull llama3.1 # pull a model if you haven\'t\n\nopenscience local add # detects Ollama, lists its models, registers them\nopenscience run --model ollama/llama3.1 "explain diffusion models"\n```\n\n`openscience local add` probes the well-known local ports, discovers the models each running server exposes (`GET /v1/models`), lets you pick which to add, writes them to your config, and offers to set a default. That\'s it — the model then shows up in `openscience models` and the [workspace](/openscience/workspace) picker like any other provider.\n\n## The `local` command\n\n```bash\nopenscience local # interactive wizard (same as `local add`)\nopenscience local add # detect + add a local endpoint\nopenscience local list # show configured local providers\nopenscience local remove \n```\n\nNon-interactive (scripting / CI):\n\n```bash\n# Register every model an endpoint exposes:\nopenscience local add --url http://localhost:11434/v1 --id ollama --default\n\n# Register a specific model without discovery:\nopenscience local add --url http://localhost:1234/v1 --id lmstudio --model qwen2.5-coder\n```\n\n| Flag | Meaning |\n| --- | --- |\n| `--url` | Endpoint base URL (a bare `host:port` is normalized to `http://host:port/v1`). |\n| `--model` | Model id(s) to register; repeatable. Omit to auto-discover all. |\n| `--id` | Provider id to register under (defaults to the runtime name or `local-`). |\n| `--key` | API key, if your endpoint requires one (most local servers don\'t). |\n| `--project` | Write to the project\'s `openscience.json` instead of the global config. |\n| `--default` | Set the first model as the default. |\n\n## Common endpoints\n\n| Runtime | Default base URL |\n| --- | --- |\n| Ollama | `http://localhost:11434/v1` |\n| LM Studio | `http://localhost:1234/v1` |\n| llama.cpp (`llama-server`) | `http://localhost:8080/v1` |\n| vLLM | `http://localhost:8000/v1` |\n| Jan | `http://localhost:1337/v1` |\n\n## From the workspace GUI\n\nOpen **Settings → Local models**. You can start a detected runtime, copy commands for your system terminal, or connect an endpoint:\n\n- **Run a model locally** — for a detected runtime (Ollama, LM Studio), click **start** and OpenScience launches the server for you (`ollama serve`), waits for it, and adds its models. If the runtime isn\'t installed, the button links to its installer.\n- **Pull a model** — type a model name and click **Copy command**. Paste and run `ollama pull ` in your system terminal; OpenScience copies the command but does not execute it.\n- **Custom endpoint** — paste any `http://host:port/v1`, list its models, and pick which to add.\n\nThe workspace does not provide a Terminal tab. To run `ollama serve` or `ollama pull ` yourself, copy the command from the Local models panel and paste it into your system terminal. When the command finishes, return to the panel and click **rescan**; OpenScience detects the running server automatically.\n\n## By hand (config)\n\nA local endpoint is just a provider block in `openscience.json`. `openscience local add` writes this for you, but you can edit it directly:\n\n```jsonc\n{\n "provider": {\n "ollama": {\n "name": "Ollama (local)",\n "npm": "@ai-sdk/openai-compatible",\n "options": { "baseURL": "http://localhost:11434/v1" },\n "models": {\n "llama3.1": { "limit": { "context": 32768, "output": 8192 } }\n }\n }\n }\n}\n```\n\n- `models` is **required** — an id with no models is dropped.\n- `apiKey` under `options` is optional; omit it for a keyless server.\n- Give the block a loopback `baseURL` (`localhost` / `127.0.0.1`) and OpenScience treats it as a local, free, BYOK-class provider.\n\n## Notes\n\n- **Billing:** local providers are always classified as your-own (BYOK) — never wallet-gated, never billed. They stay available even if your Atlas LLM spend is set to *managed* (the wallet routes through the curated OpenRouter catalog and the direct Meta/Muse proxy, never through local endpoints).\n- **Tools & reasoning:** models are registered with `tool_call: true` by default. If a local model doesn\'t support tool calling, set `"tool_call": false` on that model in config.\n- **New models:** after `ollama pull `, re-run `openscience local add` to register it, or add it under `models` in config.\n',Tb='---\ntitle: "Models & providers"\ndescription: "Bring your own keys for any provider, switch models per run, and optionally route through Atlas managed."\nicon: "package-check"\n---\n\nOpenScience is model-agnostic. A **model** is one inference endpoint the agent routes through; a **provider** is a vendor that exposes models. Routing happens on your machine: with your own keys (the default), each call goes straight from your machine to the provider — no gateway in the middle, no account required.\n\n## Bring your own keys\n\nSet a key from any provider and start working:\n\n```bash\nexport ANTHROPIC_API_KEY=sk-ant-... # or OPENAI_API_KEY, GEMINI_API_KEY, ...\nopenscience\n```\n\nKeys stay on your machine. Anthropic, OpenAI, Google, OpenRouter, Groq, Mistral, xAI, Meta Model API, DeepSeek, and dozens more work the same way — the catalogue is models.dev-backed, so any `provider/model` id a provider currently exposes is addressable. You can also paste keys into the Credentials panel in the [workspace](/openscience/workspace) instead of exporting them, and OpenAI Codex signs in via OAuth.\n\nThe current frontier families are available on both paths:\n\n| Family | BYOK model | Atlas managed model |\n| --- | --- | --- |\n| GPT-5.6 Sol / Terra / Luna | `openai/gpt-5.6-*` | `openrouter/openai/gpt-5.6-*` |\n| Grok 4.5 | `xai/grok-4.5` | `openrouter/x-ai/grok-4.5` |\n| Muse Spark 1.1 | `meta/muse-spark-1.1` | `meta/muse-spark-1.1` through the Atlas Meta proxy |\n\nFor BYOK, use `OPENAI_API_KEY`, `XAI_API_KEY`, or `META_MODEL_API_KEY`. The managed Meta route sends only your Atlas session token and proxy URL to OpenScience; Atlas keeps its shared Meta credential server-side.\n\nCurrent frontier families include:\n\n| Provider | Model IDs |\n| --- | --- |\n| Anthropic | `claude-opus-5`, `claude-sonnet-5` |\n| OpenAI | `gpt-5.6`, `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna` |\n| xAI | `grok-4.5`, `grok-4.3`, `grok-build-0.1`, and Grok 4.20 reasoning, non-reasoning, and multi-agent models |\n| Moonshot AI | `kimi-k3` |\n| Vercel AI Gateway | `meta/muse-spark-1.1` |\n\nThis is not a hardcoded allowlist for your own provider keys. OpenScience refreshes models.dev at startup and hourly, so newly published models appear without waiting for an OpenScience release. The OpenAI Codex OAuth provider is the exception: it only shows models verified to work through a ChatGPT subscription, currently including the full GPT-5.6 family.\n\n## Local models\n\nPrefer to run offline? OpenScience talks to any OpenAI-compatible endpoint on your machine — Ollama, LM Studio, llama.cpp, vLLM, and more:\n\n```bash\nopenscience local add # detects Ollama / LM Studio, lists + adds their models\nopenscience run --model ollama/llama3.1 "hello"\n```\n\nLocal models are free and never metered. See **[Local models](/openscience/local-models)** for the full guide.\n\n## List what is configured\n\n```bash\nopenscience models # grouped by provider, with a routing label per provider\nopenscience models anthropic # one provider\n```\n\nEach provider is labeled `your key`, `managed`, `local`, `Signed in with Codex`, or `unconfigured`, so you always know which route a model takes. `--verbose` adds per-model metadata like costs, `--refresh` refetches the catalogue, and `--flat` prints one `provider/model` id per line for scripting.\n\n## Pick a model per run\n\n```bash\nopenscience run --model anthropic/claude-opus-5 --variant xhigh "Design the ablation study"\nopenscience run --model anthropic/claude-sonnet-5 "Clean up the plotting code"\nopenscience run --model openai/gpt-5.6-terra --variant max "Review the analysis"\nopenscience run --model moonshotai/kimi-k3 "Implement the pipeline"\n```\n\n`--model /` overrides the default for one run; in the workspace, use the model selector per session. `--variant` picks a reasoning-effort tier — `minimal`, `high`, `max`, and so on. Available tiers depend on the model: Claude Opus 5 and GPT-5.6 extend through `xhigh` and `max`, Kimi K3 supports `low`, `high`, and `max`, and current Grok models expose their provider-supported ladders.\n\n## Atlas managed (optional)\n\n[Atlas](/openscience/atlas) is the managed platform. Connecting adds a curated set of frontier models billed from a prepaid wallet, so you can skip per-provider keys entirely:\n\n```bash\nopenscience login # defaults to app.syntheticsciences.ai\n```\n\nOnce connected, launching the workspace syncs your provider config and credentials, and Settings → Billing has independent managed/BYOK spend toggles for LLM calls and compute — mix routes freely, per concern. BYOK usage is always free and never gated; Atlas only meters the models it serves.\n\n| Path | What runs where | Billing |\n| --- | --- | --- |\n| BYOK (default) | Your machine calls the provider directly. | Your provider account. |\n| Atlas managed | Your machine calls Atlas, which calls the provider. | Prepaid wallet. See [Connect to Atlas](/openscience/atlas). |\n\n## Key hygiene\n\nProvider keys and synced credentials are filtered out of the environment of every subprocess the agent spawns and redacted from output. The agent talks to providers itself; the code it runs never needs your keys. Credentials are stored per user in your home directory, never in the project\'s `.openscience/` directory, so they cannot end up in a commit. See [Security](/openscience/security).\n\n## What\'s next\n\n\n \n First key to first result.\n \n \n Per-run model and variant flags in context.\n \n \n What connecting to Atlas adds.\n \n \n The env allow-list and trust boundary.\n \n\n',zb=`--- +`,Eb='---\ntitle: "Local models"\ndescription: "Run OpenScience against a local LLM — Ollama, LM Studio, llama.cpp, vLLM, or any OpenAI-compatible endpoint. Free, offline, no API key."\nicon: "server"\n---\n\nOpenScience talks to any **OpenAI-compatible** endpoint running on your machine. That covers [Ollama](https://ollama.com), [LM Studio](https://lmstudio.ai), [llama.cpp](https://github.com/ggml-org/llama.cpp)\'s server, [vLLM](https://github.com/vllm-project/vllm), [Jan](https://jan.ai), and anything else that speaks the OpenAI `/v1` API. Local models run entirely on your hardware and are **free, offline, and never metered against Credits**.\n\n## Quick start (Ollama)\n\n```bash\nollama serve # start the server (usually already running)\nollama pull llama3.1 # pull a model if you haven\'t\n\nopenscience local add # detects Ollama, lists its models, registers them\nopenscience run --model ollama/llama3.1 "explain diffusion models"\n```\n\n`openscience local add` probes the well-known local ports, discovers the models each running server exposes (`GET /v1/models`), lets you pick which to add, writes them to your config, and offers to set a default. That\'s it — the model then shows up in `openscience models` and the [workspace](/openscience/workspace) picker like any other provider.\n\n## The `local` command\n\n```bash\nopenscience local # interactive wizard (same as `local add`)\nopenscience local add # detect + add a local endpoint\nopenscience local list # show configured local providers\nopenscience local remove \n```\n\nNon-interactive (scripting / CI):\n\n```bash\n# Register every model an endpoint exposes:\nopenscience local add --url http://localhost:11434/v1 --id ollama --default\n\n# Register a specific model without discovery:\nopenscience local add --url http://localhost:1234/v1 --id lmstudio --model qwen2.5-coder\n```\n\n| Flag | Meaning |\n| --- | --- |\n| `--url` | Endpoint base URL (a bare `host:port` is normalized to `http://host:port/v1`). |\n| `--model` | Model id(s) to register; repeatable. Omit to auto-discover all. |\n| `--id` | Provider id to register under (defaults to the runtime name or `local-`). |\n| `--key` | API key, if your endpoint requires one (most local servers don\'t). |\n| `--project` | Write to the project\'s `openscience.json` instead of the global config. |\n| `--default` | Set the first model as the default. |\n\n## Common endpoints\n\n| Runtime | Default base URL |\n| --- | --- |\n| Ollama | `http://localhost:11434/v1` |\n| LM Studio | `http://localhost:1234/v1` |\n| llama.cpp (`llama-server`) | `http://localhost:8080/v1` |\n| vLLM | `http://localhost:8000/v1` |\n| Jan | `http://localhost:1337/v1` |\n\n## From the workspace GUI\n\nOpen **Settings → Local models**. You can start a detected runtime, copy commands for your system terminal, or connect an endpoint:\n\n- **Run a model locally** — for a detected runtime (Ollama, LM Studio), click **start** and OpenScience launches the server for you (`ollama serve`), waits for it, and adds its models. If the runtime isn\'t installed, the button links to its installer.\n- **Pull a model** — type a model name and click **Copy command**. Paste and run `ollama pull ` in your system terminal; OpenScience copies the command but does not execute it.\n- **Custom endpoint** — paste any `http://host:port/v1`, list its models, and pick which to add.\n\nThe workspace does not provide a Terminal tab. To run `ollama serve` or `ollama pull ` yourself, copy the command from the Local models panel and paste it into your system terminal. When the command finishes, return to the panel and click **rescan**; OpenScience detects the running server automatically.\n\n## By hand (config)\n\nA local endpoint is just a provider block in `openscience.json`. `openscience local add` writes this for you, but you can edit it directly:\n\n```jsonc\n{\n "provider": {\n "ollama": {\n "name": "Ollama (local)",\n "npm": "@ai-sdk/openai-compatible",\n "options": { "baseURL": "http://localhost:11434/v1" },\n "models": {\n "llama3.1": { "limit": { "context": 32768, "output": 8192 } }\n }\n }\n }\n}\n```\n\n- `models` is **required** — an id with no models is dropped.\n- `apiKey` under `options` is optional; omit it for a keyless server.\n- Give the block a loopback `baseURL` (`localhost` / `127.0.0.1`) and OpenScience treats it as a local, free, BYOK-class provider.\n\n## Notes\n\n- **Billing:** local providers are always classified as your-own (BYOK) — never wallet-gated, never billed. They stay available even if your Atlas LLM spend is set to *managed* (the wallet routes through the curated OpenRouter catalog and the direct Meta/Muse proxy, never through local endpoints).\n- **Tools & reasoning:** models are registered with `tool_call: true` by default. If a local model doesn\'t support tool calling, set `"tool_call": false` on that model in config.\n- **New models:** after `ollama pull `, re-run `openscience local add` to register it, or add it under `models` in config.\n',Tb='---\ntitle: "Models & providers"\ndescription: "Bring your own keys for any provider, switch models per run, and optionally route through Atlas managed."\nicon: "package-check"\n---\n\nOpenScience is model-agnostic. A **model** is one inference endpoint the agent routes through; a **provider** is a vendor that exposes models. Routing happens on your machine: with your own keys (the default), each call goes straight from your machine to the provider — no gateway in the middle, no account required.\n\n## Bring your own keys\n\nSet a key from any provider and start working:\n\n```bash\nexport ANTHROPIC_API_KEY=sk-ant-... # or OPENAI_API_KEY, GEMINI_API_KEY, ...\nopenscience\n```\n\nKeys stay on your machine. Anthropic, OpenAI, Google, OpenRouter, Groq, Mistral, xAI, Meta Model API, DeepSeek, and dozens more work the same way — the catalogue is models.dev-backed, so any `provider/model` id a provider currently exposes is addressable. You can also paste keys into the Credentials panel in the [workspace](/openscience/workspace) instead of exporting them, and OpenAI Codex signs in via OAuth.\n\nThe current frontier families are available on both paths:\n\n| Family | BYOK model | Atlas managed model |\n| --- | --- | --- |\n| GPT-5.6 Sol / Terra / Luna | `openai/gpt-5.6-*` | `openrouter/openai/gpt-5.6-*` |\n| Grok 4.5 | `xai/grok-4.5` | `openrouter/x-ai/grok-4.5` |\n| Muse Spark 1.1 | `meta/muse-spark-1.1` | `meta/muse-spark-1.1` through the Atlas Meta proxy |\n\nFor BYOK, use `OPENAI_API_KEY`, `XAI_API_KEY`, or `META_MODEL_API_KEY`. The managed Meta route sends only your Atlas session token and proxy URL to OpenScience; Atlas keeps its shared Meta credential server-side.\n\nCurrent frontier families include:\n\n| Provider | Model IDs |\n| --- | --- |\n| Anthropic | `claude-opus-5`, `claude-sonnet-5` |\n| OpenAI | `gpt-5.6`, `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna` |\n| xAI | `grok-4.5`, `grok-4.3`, `grok-build-0.1`, and Grok 4.20 reasoning, non-reasoning, and multi-agent models |\n| Moonshot AI | `kimi-k3` |\n| Vercel AI Gateway | `meta/muse-spark-1.1` |\n\nThis is not a hardcoded allowlist for your own provider keys. OpenScience refreshes models.dev at startup and hourly, so newly published models appear without waiting for an OpenScience release. The OpenAI Codex OAuth provider is the exception: it only shows models verified to work through a ChatGPT subscription, currently including the full GPT-5.6 family.\n\n## Local models\n\nPrefer to run offline? OpenScience talks to any OpenAI-compatible endpoint on your machine — Ollama, LM Studio, llama.cpp, vLLM, and more:\n\n```bash\nopenscience local add # detects Ollama / LM Studio, lists + adds their models\nopenscience run --model ollama/llama3.1 "hello"\n```\n\nLocal models are free and never metered. See **[Local models](/openscience/local-models)** for the full guide.\n\n## List what is configured\n\n```bash\nopenscience models # grouped by provider, with a routing label per provider\nopenscience models anthropic # one provider\n```\n\nEach provider is labeled `your key`, `managed`, `local`, `Signed in with Codex`, or `unconfigured`, so you always know which route a model takes. `--verbose` adds per-model metadata like costs, `--refresh` refetches the catalogue, and `--flat` prints one `provider/model` id per line for scripting.\n\n## Pick a model per run\n\n```bash\nopenscience run --model anthropic/claude-opus-5 --variant xhigh "Design the ablation study"\nopenscience run --model anthropic/claude-sonnet-5 "Clean up the plotting code"\nopenscience run --model openai/gpt-5.6-terra --variant max "Review the analysis"\nopenscience run --model moonshotai/kimi-k3 "Implement the pipeline"\n```\n\n`--model /` overrides the default for one run; in the workspace, use the model selector per session. `--variant` picks a reasoning-effort tier — `minimal`, `high`, `max`, and so on. Available tiers depend on the model: Claude Opus 5 and GPT-5.6 extend through `xhigh` and `max`, Kimi K3 supports `low`, `high`, and `max`, and current Grok models expose their provider-supported ladders.\n\n## Atlas managed (optional)\n\n[Atlas](/openscience/atlas) is the managed platform. Connecting adds a curated set of frontier models billed from a prepaid wallet, so you can skip per-provider keys entirely:\n\n```bash\nopenscience login # defaults to app.syntheticsciences.ai\n```\n\nOnce connected, launching the workspace syncs your provider config and credentials, and Settings → Billing has independent managed/BYOK spend toggles for LLM calls and compute — mix routes freely, per concern. BYOK usage is always free and never gated; Atlas only meters the models it serves.\n\n| Path | What runs where | Billing |\n| --- | --- | --- |\n| BYOK (default) | Your machine calls the provider directly. | Your provider account. |\n| Atlas managed | Your machine calls Atlas, which calls the provider. | Prepaid wallet. See [Connect to Atlas](/openscience/atlas). |\n\n## Key hygiene\n\nProvider keys and synced credentials are filtered out of the environment of every subprocess the agent spawns and redacted from output. The agent talks to providers itself; the code it runs never needs your keys. Credentials are stored per user in your home directory, never in the project\'s `.openscience/` directory, so they cannot end up in a commit. See [Security](/openscience/security).\n\n## What\'s next\n\n\n \n First key to first result.\n \n \n Per-run model and variant flags in context.\n \n \n What connecting to Atlas adds.\n \n \n The env allow-list and trust boundary.\n \n\n',zb=`--- title: "Quickstart" description: "Install OpenScience, set a provider key, and run your first research session." icon: "rocket" @@ -380,7 +380,13 @@ OpenScience separates three controls that solve different problems: - **The execution sandbox** limits what a spawned terminal, shell command, Python/R kernel, or local compute job can reach. - **Project trust** controls remote jobs, kernel environment changes such as package installs, project-owned executable code such as plugins and MCP servers, and execution with full host authority. -This separation keeps routine work moving without treating every newly opened project as trusted code. By default, terminals, kernels, shell commands, and local jobs may run immediately **only when OpenScience can enforce the OS sandbox**. Remote jobs, kernel environment changes, project extensions, and unsandboxed execution remain blocked until you explicitly trust that project. +The composer exposes those controls as three practical presets under **Research tools → Action approval**: + +- **Ask for approval** enables containment and revokes trust for the current project. +- **Approve for me** enables containment and trusts the current project, so only actions outside the chosen boundary need intervention. +- **Full access** trusts the current project and disables containment. + +New local installs default to **Full access** for an immediately working research environment. Choose one of the contained modes before opening code you do not trust. Managed configuration can enforce a stricter policy than the selected preset. ## Default behavior @@ -389,7 +395,7 @@ The global defaults are: \`\`\`jsonc { "sandbox": { - "enabled": true, + "enabled": false, "network": "deny", "allowWrite": [], "onUnavailable": "error", @@ -398,9 +404,9 @@ The global defaults are: } \`\`\` -With a working native backend, routine commands can read and write only the active session workspace and explicitly granted paths. Network access is denied, including loopback, LAN, link-local, and metadata endpoints. When no backend is available, the default \`onUnavailable: "error"\` refuses to run rather than silently falling back to the host. +With this default, a trusted project runs with the same filesystem and network authority as your user account. Selecting **Approve for me** or **Ask for approval** writes \`enabled: true\`; with a working native backend, routine commands can then read and write only the active session workspace and explicitly granted paths, and network access is denied, including loopback, LAN, link-local, and metadata endpoints. When containment is requested but no backend is available, \`onUnavailable: "error"\` refuses to run rather than silently falling back to the host. -Set \`requireProjectTrust: true\` if you prefer the stricter posture where every new project must be trusted before it starts any local process, even inside a verified sandbox. +Set \`requireProjectTrust: true\` if you want a revoked or root-mismatched project blocked from every local process, even inside a verified sandbox. ## Permissions and sandboxing @@ -410,7 +416,7 @@ This means ordinary approved work can continue autonomously inside a boundary yo ## Project trust -A new project starts with project-owned executable code disabled. You can still use sandboxed terminals, Python/R kernels, shell commands, and local compute unless **Require project trust** is enabled. +New projects start trusted unless an explicit trust record or managed policy says otherwise. The **Ask for approval** preset revokes that trust for the current project; **Approve for me** and **Full access** restore it after verifying the canonical project root. Trust a project only after reviewing its local configuration and code. Trust enables remote jobs, kernel environment changes such as package installs, project plugins, MCP processes, formatters, LSP commands, provider token commands/modules, publication exporters, repository/startup commands, and other project-defined executable hooks. It also allows routine execution when you intentionally turn the sandbox off or configure an unsandboxed fallback. @@ -422,7 +428,7 @@ Open **Settings → Permissions → Project code** to trust or revoke the curren | --- | --- | --- | | macOS | Seatbelt (\`sandbox-exec\`) | Built in. | | Linux | bubblewrap (\`bwrap\`) | Install \`bubblewrap\`; unprivileged user namespaces must work. | -| Windows | unavailable | Commands follow \`onUnavailable\`; the default is to refuse. | +| Windows | unavailable | Contained modes follow \`onUnavailable\`; the default is to refuse. | On Ubuntu/Debian: @@ -467,7 +473,7 @@ Sandbox policy is read only from global and managed configuration. A project's \ | Key | Meaning | Default | | --- | --- | --- | -| \`enabled\` | Request the native sandbox for local execution. | \`true\` | +| \`enabled\` | Request the native sandbox for local execution. | \`false\` | | \`network\` | Requested network policy. Current native backends enforce deny-all. | \`"deny"\` | | \`allowWrite\` | Extra absolute writable roots beyond session grants. | \`[]\` | | \`onUnavailable\` | \`"error"\`, \`"warn"\`, or \`"allow"\` when no backend can run. | \`"error"\` | @@ -485,20 +491,20 @@ The sandbox applies to spawned commands, including shell utilities, compilers, p - Linux requires a working bubblewrap/user-namespace setup. Windows currently has no filesystem sandbox backend. - For actively hostile code or stronger kernel isolation, run OpenScience itself inside a container or VM as an additional boundary. -The safe low-friction preset is the default: sandbox enabled, unavailable backend refused, project trust not required for routine contained work. Full host access is an explicit combination: disable containment (or allow fallback) **and** trust the current project. +Full host access is the default: containment disabled and the current project trusted. Use the composer preset or Settings to enable containment. **Ask for approval** additionally revokes the current project's trust; **Approve for me** keeps it trusted inside the sandbox. Explicit saved choices survive restarts, and managed policy remains authoritative. `,_b=`--- title: "Security" description: "The trust boundary, credential storage, execution sandbox, and subprocess environment hygiene — in an open-source agent you can audit end to end." icon: "shield-check" --- -OpenScience is open source under Apache-2.0, so the whole security model below is auditable in the [repository](https://github.com/synthetic-sciences/openscience). The agent runs locally, while spawned commands are constrained by the native sandbox and explicit filesystem grants by default. Two principles anchor the design: keep credentials out of subprocesses that do not need them, and make each trust boundary explicit instead of treating permissions, sandboxing, and project trust as the same control. +OpenScience is open source under Apache-2.0, so the whole security model below is auditable in the [repository](https://github.com/synthetic-sciences/openscience). The agent runs locally. New local installs default to trusted **Full access**, while two contained presets are available directly beneath the composer. Two principles anchor the design: keep credentials out of subprocesses that do not need them, and make each trust boundary explicit instead of treating permissions, sandboxing, and project trust as the same control. ## Permissions are not the sandbox The permission system decides whether an agent may take an action. It is not, on its own, an isolation boundary. -OpenScience enables a real [execution sandbox](/openscience/sandbox) by default. It wraps terminals, shell commands, Python/R kernels, and local jobs in macOS Seatbelt or Linux bubblewrap, limits them to the workspace and approved paths, and denies network egress. Routine work can start immediately when that boundary is enforced; remote jobs, kernel environment changes, project-owned extensions, and host execution still require explicit project trust. The default refuses to run when no native backend is available rather than silently falling back to the host. Verify the effective boundary with \`openscience sandbox test\`. It is OS containment, not a full VM — for actively hostile code, still run OpenScience inside a container or VM. +OpenScience ships a real [execution sandbox](/openscience/sandbox), but **Full access** is the default. In that mode a trusted project has your user account's filesystem and network authority. Open **Research tools → Action approval** and select **Approve for me** to trust the project inside macOS Seatbelt or Linux bubblewrap, or **Ask for approval** to enable that boundary and revoke project trust. Containment limits commands to the workspace and approved paths and denies network egress; if the selected boundary is unavailable, the default policy refuses to run rather than silently falling back to the host. Verify it with \`openscience sandbox test\`. It is OS containment, not a full VM — for actively hostile code, still run OpenScience inside a container or VM. ## Credential storage @@ -704,35 +710,35 @@ On macOS, launching the workspace probes whether the binary can read \`~/Desktop The trust boundary and credential handling. -`,jb="https://mintlify.com/docs.json",Nb="OpenScience",Lb={tabs:[{tab:"Guides",groups:[{group:"Start",pages:["index","quickstart","workspace"]},{group:"Use the agent",pages:["agents","models","local-models","skills","sessions","atlas"]}]},{tab:"Reference",groups:[{group:"CLI",pages:["commands","security","sandbox"]}]}],global:{anchors:[{anchor:"openscience.sh",href:"https://openscience.sh"},{anchor:"GitHub",href:"https://github.com/synthetic-sciences/openscience"},{anchor:"npm",href:"https://www.npmjs.com/package/@synsci/openscience"},{anchor:"Releases",href:"https://github.com/synthetic-sciences/openscience/releases"}]}},Ub={primary:{type:"button",label:"Star on GitHub",href:"https://github.com/synthetic-sciences/openscience"}},Bb={$schema:jb,name:Nb,navigation:Lb,navbar:Ub};function Hb(n,r){const a={};return(n[n.length-1]===""?[...n,""]:n).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const qb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Yb=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gb={};function Fp(n,r){return(Gb.jsx?Yb:qb).test(n)}const Vb=/[ \t\n\f\r]/g;function Xb(n){return typeof n=="object"?n.type==="text"?Ip(n.value):!1:Ip(n)}function Ip(n){return n.replace(Vb,"")===""}class Ra{constructor(r,a,o){this.normal=a,this.property=r,o&&(this.space=o)}}Ra.prototype.normal={};Ra.prototype.property={};Ra.prototype.space=void 0;function Vm(n,r){const a={},o={};for(const c of n)Object.assign(a,c.property),Object.assign(o,c.normal);return new Ra(a,o,r)}function ac(n){return n.toLowerCase()}class _t{constructor(r,a){this.attribute=a,this.property=r}}_t.prototype.attribute="";_t.prototype.booleanish=!1;_t.prototype.boolean=!1;_t.prototype.commaOrSpaceSeparated=!1;_t.prototype.commaSeparated=!1;_t.prototype.defined=!1;_t.prototype.mustUseProperty=!1;_t.prototype.number=!1;_t.prototype.overloadedBoolean=!1;_t.prototype.property="";_t.prototype.spaceSeparated=!1;_t.prototype.space=void 0;let Qb=0;const ge=_l(),lt=_l(),rc=_l(),I=_l(),Ge=_l(),zl=_l(),Ht=_l();function _l(){return 2**++Qb}const oc=Object.freeze(Object.defineProperty({__proto__:null,boolean:ge,booleanish:lt,commaOrSpaceSeparated:Ht,commaSeparated:zl,number:I,overloadedBoolean:rc,spaceSeparated:Ge},Symbol.toStringTag,{value:"Module"})),Ys=Object.keys(oc);class vc extends _t{constructor(r,a,o,c){let d=-1;if(super(r,a),Jp(this,"space",c),typeof o=="number")for(;++d4&&a.slice(0,4)==="data"&&Jb.test(r)){if(r.charAt(4)==="-"){const d=r.slice(5).replace($p,Pb);o="data"+d.charAt(0).toUpperCase()+d.slice(1)}else{const d=r.slice(4);if(!$p.test(d)){let f=d.replace(Ib,Wb);f.charAt(0)!=="-"&&(f="-"+f),r="data"+f}}c=vc}return new c(o,r)}function Wb(n){return"-"+n.toLowerCase()}function Pb(n){return n.charAt(1).toUpperCase()}const e0=Vm([Xm,Zb,Km,Fm,Im],"html"),xc=Vm([Xm,Kb,Km,Fm,Im],"svg");function t0(n){return n.join(" ").trim()}var vi={},Gs,Wp;function n0(){if(Wp)return Gs;Wp=1;var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,a=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,d=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,p=/^\s+|\s+$/g,m=` -`,h="/",b="*",y="",k="comment",x="declaration";function T(Z,D){if(typeof Z!="string")throw new TypeError("First argument must be a string");if(!Z)return[];D=D||{};var F=1,Q=1;function oe(J){var $=J.match(r);$&&(F+=$.length);var O=J.lastIndexOf(m);Q=~O?J.length-O:Q+J.length}function re(){var J={line:F,column:Q};return function($){return $.position=new L(J),me(),$}}function L(J){this.start=J,this.end={line:F,column:Q},this.source=D.source}L.prototype.content=Z;function P(J){var $=new Error(D.source+":"+F+":"+Q+": "+J);if($.reason=J,$.filename=D.source,$.line=F,$.column=Q,$.source=Z,!D.silent)throw $}function he(J){var $=J.exec(Z);if($){var O=$[0];return oe(O),Z=Z.slice(O.length),$}}function me(){he(a)}function j(J){var $;for(J=J||[];$=te();)$!==!1&&J.push($);return J}function te(){var J=re();if(!(h!=Z.charAt(0)||b!=Z.charAt(1))){for(var $=2;y!=Z.charAt($)&&(b!=Z.charAt($)||h!=Z.charAt($+1));)++$;if($+=2,y===Z.charAt($-1))return P("End of comment missing");var O=Z.slice(2,$-2);return Q+=2,oe(O),Z=Z.slice($),Q+=2,J({type:k,comment:O})}}function B(){var J=re(),$=he(o);if($){if(te(),!he(c))return P("property missing ':'");var O=he(d),K=J({type:x,property:U($[0].replace(n,y)),value:O?U(O[0].replace(n,y)):y});return he(f),K}}function le(){var J=[];j(J);for(var $;$=B();)$!==!1&&(J.push($),j(J));return J}return me(),le()}function U(Z){return Z?Z.replace(p,y):y}return Gs=T,Gs}var Pp;function l0(){if(Pp)return vi;Pp=1;var n=vi&&vi.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(vi,"__esModule",{value:!0}),vi.default=a;const r=n(n0());function a(o,c){let d=null;if(!o||typeof o!="string")return d;const f=(0,r.default)(o),p=typeof c=="function";return f.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:b}=m;p?c(h,b,m):b&&(d=d||{},d[h]=b)}),d}return vi}var ka={},em;function i0(){if(em)return ka;em=1,Object.defineProperty(ka,"__esModule",{value:!0}),ka.camelCase=void 0;var n=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,a=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,d=function(h){return!h||a.test(h)||n.test(h)},f=function(h,b){return b.toUpperCase()},p=function(h,b){return"".concat(b,"-")},m=function(h,b){return b===void 0&&(b={}),d(h)?h:(h=h.toLowerCase(),b.reactCompat?h=h.replace(c,p):h=h.replace(o,p),h.replace(r,f))};return ka.camelCase=m,ka}var Sa,tm;function a0(){if(tm)return Sa;tm=1;var n=Sa&&Sa.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},r=n(l0()),a=i0();function o(c,d){var f={};return!c||typeof c!="string"||(0,r.default)(c,function(p,m){p&&m&&(f[(0,a.camelCase)(p,d)]=m)}),f}return o.default=o,Sa=o,Sa}var r0=a0();const o0=yc(r0),Jm=$m("end"),kc=$m("start");function $m(n){return r;function r(a){const o=a&&a.position&&a.position[n]||{};if(typeof o.line=="number"&&o.line>0&&typeof o.column=="number"&&o.column>0)return{line:o.line,column:o.column,offset:typeof o.offset=="number"&&o.offset>-1?o.offset:void 0}}}function u0(n){const r=kc(n),a=Jm(n);if(r&&a)return{start:r,end:a}}function Ea(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?nm(n.position):"start"in n||"end"in n?nm(n):"line"in n||"column"in n?uc(n):""}function uc(n){return lm(n&&n.line)+":"+lm(n&&n.column)}function nm(n){return uc(n&&n.start)+"-"+uc(n&&n.end)}function lm(n){return n&&typeof n=="number"?n:1}class gt extends Error{constructor(r,a,o){super(),typeof a=="string"&&(o=a,a=void 0);let c="",d={},f=!1;if(a&&("line"in a&&"column"in a?d={place:a}:"start"in a&&"end"in a?d={place:a}:"type"in a?d={ancestors:[a],place:a.position}:d={...a}),typeof r=="string"?c=r:!d.cause&&r&&(f=!0,c=r.message,d.cause=r),!d.ruleId&&!d.source&&typeof o=="string"){const m=o.indexOf(":");m===-1?d.ruleId=o:(d.source=o.slice(0,m),d.ruleId=o.slice(m+1))}if(!d.place&&d.ancestors&&d.ancestors){const m=d.ancestors[d.ancestors.length-1];m&&(d.place=m.position)}const p=d.place&&"start"in d.place?d.place.start:d.place;this.ancestors=d.ancestors||void 0,this.cause=d.cause||void 0,this.column=p?p.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=p?p.line:void 0,this.name=Ea(d.place)||"1:1",this.place=d.place||void 0,this.reason=this.message,this.ruleId=d.ruleId||void 0,this.source=d.source||void 0,this.stack=f&&d.cause&&typeof d.cause.stack=="string"?d.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}gt.prototype.file="";gt.prototype.name="";gt.prototype.reason="";gt.prototype.message="";gt.prototype.stack="";gt.prototype.column=void 0;gt.prototype.line=void 0;gt.prototype.ancestors=void 0;gt.prototype.cause=void 0;gt.prototype.fatal=void 0;gt.prototype.place=void 0;gt.prototype.ruleId=void 0;gt.prototype.source=void 0;const Sc={}.hasOwnProperty,s0=new Map,c0=/[A-Z]/g,f0=new Set(["table","tbody","thead","tfoot","tr"]),d0=new Set(["td","th"]),Wm="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function h0(n,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=r.filePath||void 0;let o;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=k0(a,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=x0(a,r.jsx,r.jsxs)}const c={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:o,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?xc:e0,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},d=Pm(c,n,void 0);return d&&typeof d!="string"?d:c.create(n,c.Fragment,{children:d||void 0},void 0)}function Pm(n,r,a){if(r.type==="element")return p0(n,r,a);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return m0(n,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return y0(n,r,a);if(r.type==="mdxjsEsm")return g0(n,r);if(r.type==="root")return b0(n,r,a);if(r.type==="text")return v0(n,r)}function p0(n,r,a){const o=n.schema;let c=o;r.tagName.toLowerCase()==="svg"&&o.space==="html"&&(c=xc,n.schema=c),n.ancestors.push(r);const d=tg(n,r.tagName,!1),f=S0(n,r);let p=Cc(n,r);return f0.has(r.tagName)&&(p=p.filter(function(m){return typeof m=="string"?!Xb(m):!0})),eg(n,f,d,r),wc(f,p),n.ancestors.pop(),n.schema=o,n.create(r,d,f,a)}function m0(n,r){if(r.data&&r.data.estree&&n.evaluater){const o=r.data.estree.body[0];return o.type,n.evaluater.evaluateExpression(o.expression)}Ma(n,r.position)}function g0(n,r){if(r.data&&r.data.estree&&n.evaluater)return n.evaluater.evaluateProgram(r.data.estree);Ma(n,r.position)}function y0(n,r,a){const o=n.schema;let c=o;r.name==="svg"&&o.space==="html"&&(c=xc,n.schema=c),n.ancestors.push(r);const d=r.name===null?n.Fragment:tg(n,r.name,!0),f=w0(n,r),p=Cc(n,r);return eg(n,f,d,r),wc(f,p),n.ancestors.pop(),n.schema=o,n.create(r,d,f,a)}function b0(n,r,a){const o={};return wc(o,Cc(n,r)),n.create(r,n.Fragment,o,a)}function v0(n,r){return r.value}function eg(n,r,a,o){typeof a!="string"&&a!==n.Fragment&&n.passNode&&(r.node=o)}function wc(n,r){if(r.length>0){const a=r.length>1?r:r[0];a&&(n.children=a)}}function x0(n,r,a){return o;function o(c,d,f,p){const h=Array.isArray(f.children)?a:r;return p?h(d,f,p):h(d,f)}}function k0(n,r){return a;function a(o,c,d,f){const p=Array.isArray(d.children),m=kc(o);return r(c,d,f,p,{columnNumber:m?m.column-1:void 0,fileName:n,lineNumber:m?m.line:void 0},void 0)}}function S0(n,r){const a={};let o,c;for(c in r.properties)if(c!=="children"&&Sc.call(r.properties,c)){const d=C0(n,c,r.properties[c]);if(d){const[f,p]=d;n.tableCellAlignToStyle&&f==="align"&&typeof p=="string"&&d0.has(r.tagName)?o=p:a[f]=p}}if(o){const d=a.style||(a.style={});d[n.stylePropertyNameCase==="css"?"text-align":"textAlign"]=o}return a}function w0(n,r){const a={};for(const o of r.attributes)if(o.type==="mdxJsxExpressionAttribute")if(o.data&&o.data.estree&&n.evaluater){const d=o.data.estree.body[0];d.type;const f=d.expression;f.type;const p=f.properties[0];p.type,Object.assign(a,n.evaluater.evaluateExpression(p.argument))}else Ma(n,r.position);else{const c=o.name;let d;if(o.value&&typeof o.value=="object")if(o.value.data&&o.value.data.estree&&n.evaluater){const p=o.value.data.estree.body[0];p.type,d=n.evaluater.evaluateExpression(p.expression)}else Ma(n,r.position);else d=o.value===null?!0:o.value;a[c]=d}return a}function Cc(n,r){const a=[];let o=-1;const c=n.passKeys?new Map:s0;for(;++oc?0:c+r:r=r>c?c:r,a=a>0?a:0,o.length<1e4)f=Array.from(o),f.unshift(r,a),n.splice(...f);else for(a&&n.splice(r,a);d0?(qt(n,n.length,0,r),n):r}const rm={}.hasOwnProperty;function lg(n){const r={};let a=-1;for(;++a13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function on(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const xt=ul(/[A-Za-z]/),mt=ul(/[\dA-Za-z]/),R0=ul(/[#-'*+\--9=?A-Z^-~]/);function uo(n){return n!==null&&(n<32||n===127)}const sc=ul(/\d/),j0=ul(/[\dA-Fa-f]/),N0=ul(/[!-/:-@[-`{-~]/);function ce(n){return n!==null&&n<-2}function Ve(n){return n!==null&&(n<0||n===32)}function Ce(n){return n===-2||n===-1||n===32}const mo=ul(new RegExp("\\p{P}|\\p{S}","u")),Ol=ul(/\s/);function ul(n){return r;function r(a){return a!==null&&a>-1&&n.test(String.fromCharCode(a))}}function Ei(n){const r=[];let a=-1,o=0,c=0;for(;++a55295&&d<57344){const p=n.charCodeAt(a+1);d<56320&&p>56319&&p<57344?(f=String.fromCharCode(d,p),c=1):f="�"}else f=String.fromCharCode(d);f&&(r.push(n.slice(o,a),encodeURIComponent(f)),o=a+c+1,f=""),c&&(a+=c,c=0)}return r.join("")+n.slice(o)}function Oe(n,r,a,o){const c=o?o-1:Number.POSITIVE_INFINITY;let d=0;return f;function f(m){return Ce(m)?(n.enter(a),p(m)):r(m)}function p(m){return Ce(m)&&d++f))return;const P=r.events.length;let he=P,me,j;for(;he--;)if(r.events[he][0]==="exit"&&r.events[he][1].type==="chunkFlow"){if(me){j=r.events[he][1].end;break}me=!0}for(D(o),L=P;LQ;){const re=a[oe];r.containerState=re[1],re[0].exit.call(r,n)}a.length=Q}function F(){c.write([null]),d=void 0,c=void 0,r.containerState._closeFlow=void 0}}function q0(n,r,a){return Oe(n,n.attempt(this.parser.constructs.document,r,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function wi(n){if(n===null||Ve(n)||Ol(n))return 1;if(mo(n))return 2}function go(n,r,a){const o=[];let c=-1;for(;++c1&&n[a][1].end.offset-n[a][1].start.offset>1?2:1;const y={...n[o][1].end},k={...n[a][1].start};um(y,-m),um(k,m),f={type:m>1?"strongSequence":"emphasisSequence",start:y,end:{...n[o][1].end}},p={type:m>1?"strongSequence":"emphasisSequence",start:{...n[a][1].start},end:k},d={type:m>1?"strongText":"emphasisText",start:{...n[o][1].end},end:{...n[a][1].start}},c={type:m>1?"strong":"emphasis",start:{...f.start},end:{...p.end}},n[o][1].end={...f.start},n[a][1].start={...p.end},h=[],n[o][1].end.offset-n[o][1].start.offset&&(h=Pt(h,[["enter",n[o][1],r],["exit",n[o][1],r]])),h=Pt(h,[["enter",c,r],["enter",f,r],["exit",f,r],["enter",d,r]]),h=Pt(h,go(r.parser.constructs.insideSpan.null,n.slice(o+1,a),r)),h=Pt(h,[["exit",d,r],["enter",p,r],["exit",p,r],["exit",c,r]]),n[a][1].end.offset-n[a][1].start.offset?(b=2,h=Pt(h,[["enter",n[a][1],r],["exit",n[a][1],r]])):b=0,qt(n,o-1,a-o+3,h),a=o+h.length-b-2;break}}for(a=-1;++a0&&Ce(L)?Oe(n,F,"linePrefix",d+1)(L):F(L)}function F(L){return L===null||ce(L)?n.check(sm,U,oe)(L):(n.enter("codeFlowValue"),Q(L))}function Q(L){return L===null||ce(L)?(n.exit("codeFlowValue"),F(L)):(n.consume(L),Q)}function oe(L){return n.exit("codeFenced"),r(L)}function re(L,P,he){let me=0;return j;function j($){return L.enter("lineEnding"),L.consume($),L.exit("lineEnding"),te}function te($){return L.enter("codeFencedFence"),Ce($)?Oe(L,B,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):B($)}function B($){return $===p?(L.enter("codeFencedFenceSequence"),le($)):he($)}function le($){return $===p?(me++,L.consume($),le):me>=f?(L.exit("codeFencedFenceSequence"),Ce($)?Oe(L,J,"whitespace")($):J($)):he($)}function J($){return $===null||ce($)?(L.exit("codeFencedFence"),P($)):he($)}}}function W0(n,r,a){const o=this;return c;function c(f){return f===null?a(f):(n.enter("lineEnding"),n.consume(f),n.exit("lineEnding"),d)}function d(f){return o.parser.lazy[o.now().line]?a(f):r(f)}}const Xs={name:"codeIndented",tokenize:ev},P0={partial:!0,tokenize:tv};function ev(n,r,a){const o=this;return c;function c(h){return n.enter("codeIndented"),Oe(n,d,"linePrefix",5)(h)}function d(h){const b=o.events[o.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?f(h):a(h)}function f(h){return h===null?m(h):ce(h)?n.attempt(P0,f,m)(h):(n.enter("codeFlowValue"),p(h))}function p(h){return h===null||ce(h)?(n.exit("codeFlowValue"),f(h)):(n.consume(h),p)}function m(h){return n.exit("codeIndented"),r(h)}}function tv(n,r,a){const o=this;return c;function c(f){return o.parser.lazy[o.now().line]?a(f):ce(f)?(n.enter("lineEnding"),n.consume(f),n.exit("lineEnding"),c):Oe(n,d,"linePrefix",5)(f)}function d(f){const p=o.events[o.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?r(f):ce(f)?c(f):a(f)}}const nv={name:"codeText",previous:iv,resolve:lv,tokenize:av};function lv(n){let r=n.length-4,a=3,o,c;if((n[a][1].type==="lineEnding"||n[a][1].type==="space")&&(n[r][1].type==="lineEnding"||n[r][1].type==="space")){for(o=a;++o=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return rthis.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(r,a,o){const c=a||0;this.setCursor(Math.trunc(r));const d=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return o&&wa(this.left,o),d.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),wa(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),wa(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r=4?r(f):n.interrupt(o.parser.constructs.flow,a,r)(f)}}function sg(n,r,a,o,c,d,f,p,m){const h=m||Number.POSITIVE_INFINITY;let b=0;return y;function y(D){return D===60?(n.enter(o),n.enter(c),n.enter(d),n.consume(D),n.exit(d),k):D===null||D===32||D===41||uo(D)?a(D):(n.enter(o),n.enter(f),n.enter(p),n.enter("chunkString",{contentType:"string"}),U(D))}function k(D){return D===62?(n.enter(d),n.consume(D),n.exit(d),n.exit(c),n.exit(o),r):(n.enter(p),n.enter("chunkString",{contentType:"string"}),x(D))}function x(D){return D===62?(n.exit("chunkString"),n.exit(p),k(D)):D===null||D===60||ce(D)?a(D):(n.consume(D),D===92?T:x)}function T(D){return D===60||D===62||D===92?(n.consume(D),x):x(D)}function U(D){return!b&&(D===null||D===41||Ve(D))?(n.exit("chunkString"),n.exit(p),n.exit(f),n.exit(o),r(D)):b999||x===null||x===91||x===93&&!m||x===94&&!p&&"_hiddenFootnoteSupport"in f.parser.constructs?a(x):x===93?(n.exit(d),n.enter(c),n.consume(x),n.exit(c),n.exit(o),r):ce(x)?(n.enter("lineEnding"),n.consume(x),n.exit("lineEnding"),b):(n.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===null||x===91||x===93||ce(x)||p++>999?(n.exit("chunkString"),b(x)):(n.consume(x),m||(m=!Ce(x)),x===92?k:y)}function k(x){return x===91||x===92||x===93?(n.consume(x),p++,y):y(x)}}function fg(n,r,a,o,c,d){let f;return p;function p(k){return k===34||k===39||k===40?(n.enter(o),n.enter(c),n.consume(k),n.exit(c),f=k===40?41:k,m):a(k)}function m(k){return k===f?(n.enter(c),n.consume(k),n.exit(c),n.exit(o),r):(n.enter(d),h(k))}function h(k){return k===f?(n.exit(d),m(f)):k===null?a(k):ce(k)?(n.enter("lineEnding"),n.consume(k),n.exit("lineEnding"),Oe(n,h,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===f||k===null||ce(k)?(n.exit("chunkString"),h(k)):(n.consume(k),k===92?y:b)}function y(k){return k===f||k===92?(n.consume(k),b):b(k)}}function Aa(n,r){let a;return o;function o(c){return ce(c)?(n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),a=!0,o):Ce(c)?Oe(n,o,a?"linePrefix":"lineSuffix")(c):r(c)}}const hv={name:"definition",tokenize:mv},pv={partial:!0,tokenize:gv};function mv(n,r,a){const o=this;let c;return d;function d(x){return n.enter("definition"),f(x)}function f(x){return cg.call(o,n,p,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function p(x){return c=on(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),x===58?(n.enter("definitionMarker"),n.consume(x),n.exit("definitionMarker"),m):a(x)}function m(x){return Ve(x)?Aa(n,h)(x):h(x)}function h(x){return sg(n,b,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function b(x){return n.attempt(pv,y,y)(x)}function y(x){return Ce(x)?Oe(n,k,"whitespace")(x):k(x)}function k(x){return x===null||ce(x)?(n.exit("definition"),o.parser.defined.push(c),r(x)):a(x)}}function gv(n,r,a){return o;function o(p){return Ve(p)?Aa(n,c)(p):a(p)}function c(p){return fg(n,d,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(p)}function d(p){return Ce(p)?Oe(n,f,"whitespace")(p):f(p)}function f(p){return p===null||ce(p)?r(p):a(p)}}const yv={name:"hardBreakEscape",tokenize:bv};function bv(n,r,a){return o;function o(d){return n.enter("hardBreakEscape"),n.consume(d),c}function c(d){return ce(d)?(n.exit("hardBreakEscape"),r(d)):a(d)}}const vv={name:"headingAtx",resolve:xv,tokenize:kv};function xv(n,r){let a=n.length-2,o=3,c,d;return n[o][1].type==="whitespace"&&(o+=2),a-2>o&&n[a][1].type==="whitespace"&&(a-=2),n[a][1].type==="atxHeadingSequence"&&(o===a-1||a-4>o&&n[a-2][1].type==="whitespace")&&(a-=o+1===a?2:4),a>o&&(c={type:"atxHeadingText",start:n[o][1].start,end:n[a][1].end},d={type:"chunkText",start:n[o][1].start,end:n[a][1].end,contentType:"text"},qt(n,o,a-o+1,[["enter",c,r],["enter",d,r],["exit",d,r],["exit",c,r]])),n}function kv(n,r,a){let o=0;return c;function c(b){return n.enter("atxHeading"),d(b)}function d(b){return n.enter("atxHeadingSequence"),f(b)}function f(b){return b===35&&o++<6?(n.consume(b),f):b===null||Ve(b)?(n.exit("atxHeadingSequence"),p(b)):a(b)}function p(b){return b===35?(n.enter("atxHeadingSequence"),m(b)):b===null||ce(b)?(n.exit("atxHeading"),r(b)):Ce(b)?Oe(n,p,"whitespace")(b):(n.enter("atxHeadingText"),h(b))}function m(b){return b===35?(n.consume(b),m):(n.exit("atxHeadingSequence"),p(b))}function h(b){return b===null||b===35||Ve(b)?(n.exit("atxHeadingText"),p(b)):(n.consume(b),h)}}const Sv=["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"],fm=["pre","script","style","textarea"],wv={concrete:!0,name:"htmlFlow",resolveTo:Av,tokenize:Tv},Cv={partial:!0,tokenize:Ov},Ev={partial:!0,tokenize:zv};function Av(n){let r=n.length;for(;r--&&!(n[r][0]==="enter"&&n[r][1].type==="htmlFlow"););return r>1&&n[r-2][1].type==="linePrefix"&&(n[r][1].start=n[r-2][1].start,n[r+1][1].start=n[r-2][1].start,n.splice(r-2,2)),n}function Tv(n,r,a){const o=this;let c,d,f,p,m;return h;function h(S){return b(S)}function b(S){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(S),y}function y(S){return S===33?(n.consume(S),k):S===47?(n.consume(S),d=!0,U):S===63?(n.consume(S),c=3,o.interrupt?r:w):xt(S)?(n.consume(S),f=String.fromCharCode(S),Z):a(S)}function k(S){return S===45?(n.consume(S),c=2,x):S===91?(n.consume(S),c=5,p=0,T):xt(S)?(n.consume(S),c=4,o.interrupt?r:w):a(S)}function x(S){return S===45?(n.consume(S),o.interrupt?r:w):a(S)}function T(S){const ee="CDATA[";return S===ee.charCodeAt(p++)?(n.consume(S),p===ee.length?o.interrupt?r:B:T):a(S)}function U(S){return xt(S)?(n.consume(S),f=String.fromCharCode(S),Z):a(S)}function Z(S){if(S===null||S===47||S===62||Ve(S)){const ee=S===47,de=f.toLowerCase();return!ee&&!d&&fm.includes(de)?(c=1,o.interrupt?r(S):B(S)):Sv.includes(f.toLowerCase())?(c=6,ee?(n.consume(S),D):o.interrupt?r(S):B(S)):(c=7,o.interrupt&&!o.parser.lazy[o.now().line]?a(S):d?F(S):Q(S))}return S===45||mt(S)?(n.consume(S),f+=String.fromCharCode(S),Z):a(S)}function D(S){return S===62?(n.consume(S),o.interrupt?r:B):a(S)}function F(S){return Ce(S)?(n.consume(S),F):j(S)}function Q(S){return S===47?(n.consume(S),j):S===58||S===95||xt(S)?(n.consume(S),oe):Ce(S)?(n.consume(S),Q):j(S)}function oe(S){return S===45||S===46||S===58||S===95||mt(S)?(n.consume(S),oe):re(S)}function re(S){return S===61?(n.consume(S),L):Ce(S)?(n.consume(S),re):Q(S)}function L(S){return S===null||S===60||S===61||S===62||S===96?a(S):S===34||S===39?(n.consume(S),m=S,P):Ce(S)?(n.consume(S),L):he(S)}function P(S){return S===m?(n.consume(S),m=null,me):S===null||ce(S)?a(S):(n.consume(S),P)}function he(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||Ve(S)?re(S):(n.consume(S),he)}function me(S){return S===47||S===62||Ce(S)?Q(S):a(S)}function j(S){return S===62?(n.consume(S),te):a(S)}function te(S){return S===null||ce(S)?B(S):Ce(S)?(n.consume(S),te):a(S)}function B(S){return S===45&&c===2?(n.consume(S),O):S===60&&c===1?(n.consume(S),K):S===62&&c===4?(n.consume(S),E):S===63&&c===3?(n.consume(S),w):S===93&&c===5?(n.consume(S),xe):ce(S)&&(c===6||c===7)?(n.exit("htmlFlowData"),n.check(Cv,Y,le)(S)):S===null||ce(S)?(n.exit("htmlFlowData"),le(S)):(n.consume(S),B)}function le(S){return n.check(Ev,J,Y)(S)}function J(S){return n.enter("lineEnding"),n.consume(S),n.exit("lineEnding"),$}function $(S){return S===null||ce(S)?le(S):(n.enter("htmlFlowData"),B(S))}function O(S){return S===45?(n.consume(S),w):B(S)}function K(S){return S===47?(n.consume(S),f="",ae):B(S)}function ae(S){if(S===62){const ee=f.toLowerCase();return fm.includes(ee)?(n.consume(S),E):B(S)}return xt(S)&&f.length<8?(n.consume(S),f+=String.fromCharCode(S),ae):B(S)}function xe(S){return S===93?(n.consume(S),w):B(S)}function w(S){return S===62?(n.consume(S),E):S===45&&c===2?(n.consume(S),w):B(S)}function E(S){return S===null||ce(S)?(n.exit("htmlFlowData"),Y(S)):(n.consume(S),E)}function Y(S){return n.exit("htmlFlow"),r(S)}}function zv(n,r,a){const o=this;return c;function c(f){return ce(f)?(n.enter("lineEnding"),n.consume(f),n.exit("lineEnding"),d):a(f)}function d(f){return o.parser.lazy[o.now().line]?a(f):r(f)}}function Ov(n,r,a){return o;function o(c){return n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),n.attempt(ja,r,a)}}const _v={name:"htmlText",tokenize:Mv};function Mv(n,r,a){const o=this;let c,d,f;return p;function p(w){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(w),m}function m(w){return w===33?(n.consume(w),h):w===47?(n.consume(w),re):w===63?(n.consume(w),Q):xt(w)?(n.consume(w),he):a(w)}function h(w){return w===45?(n.consume(w),b):w===91?(n.consume(w),d=0,T):xt(w)?(n.consume(w),F):a(w)}function b(w){return w===45?(n.consume(w),x):a(w)}function y(w){return w===null?a(w):w===45?(n.consume(w),k):ce(w)?(f=y,K(w)):(n.consume(w),y)}function k(w){return w===45?(n.consume(w),x):y(w)}function x(w){return w===62?O(w):w===45?k(w):y(w)}function T(w){const E="CDATA[";return w===E.charCodeAt(d++)?(n.consume(w),d===E.length?U:T):a(w)}function U(w){return w===null?a(w):w===93?(n.consume(w),Z):ce(w)?(f=U,K(w)):(n.consume(w),U)}function Z(w){return w===93?(n.consume(w),D):U(w)}function D(w){return w===62?O(w):w===93?(n.consume(w),D):U(w)}function F(w){return w===null||w===62?O(w):ce(w)?(f=F,K(w)):(n.consume(w),F)}function Q(w){return w===null?a(w):w===63?(n.consume(w),oe):ce(w)?(f=Q,K(w)):(n.consume(w),Q)}function oe(w){return w===62?O(w):Q(w)}function re(w){return xt(w)?(n.consume(w),L):a(w)}function L(w){return w===45||mt(w)?(n.consume(w),L):P(w)}function P(w){return ce(w)?(f=P,K(w)):Ce(w)?(n.consume(w),P):O(w)}function he(w){return w===45||mt(w)?(n.consume(w),he):w===47||w===62||Ve(w)?me(w):a(w)}function me(w){return w===47?(n.consume(w),O):w===58||w===95||xt(w)?(n.consume(w),j):ce(w)?(f=me,K(w)):Ce(w)?(n.consume(w),me):O(w)}function j(w){return w===45||w===46||w===58||w===95||mt(w)?(n.consume(w),j):te(w)}function te(w){return w===61?(n.consume(w),B):ce(w)?(f=te,K(w)):Ce(w)?(n.consume(w),te):me(w)}function B(w){return w===null||w===60||w===61||w===62||w===96?a(w):w===34||w===39?(n.consume(w),c=w,le):ce(w)?(f=B,K(w)):Ce(w)?(n.consume(w),B):(n.consume(w),J)}function le(w){return w===c?(n.consume(w),c=void 0,$):w===null?a(w):ce(w)?(f=le,K(w)):(n.consume(w),le)}function J(w){return w===null||w===34||w===39||w===60||w===61||w===96?a(w):w===47||w===62||Ve(w)?me(w):(n.consume(w),J)}function $(w){return w===47||w===62||Ve(w)?me(w):a(w)}function O(w){return w===62?(n.consume(w),n.exit("htmlTextData"),n.exit("htmlText"),r):a(w)}function K(w){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(w),n.exit("lineEnding"),ae}function ae(w){return Ce(w)?Oe(n,xe,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):xe(w)}function xe(w){return n.enter("htmlTextData"),f(w)}}const Tc={name:"labelEnd",resolveAll:Nv,resolveTo:Lv,tokenize:Uv},Dv={tokenize:Bv},Rv={tokenize:Hv},jv={tokenize:qv};function Nv(n){let r=-1;const a=[];for(;++r=3&&(h===null||ce(h))?(n.exit("thematicBreak"),r(h)):a(h)}function m(h){return h===c?(n.consume(h),o++,m):(n.exit("thematicBreakSequence"),Ce(h)?Oe(n,p,"whitespace")(h):p(h))}}const Ot={continuation:{tokenize:Jv},exit:Wv,name:"list",tokenize:Iv},Kv={partial:!0,tokenize:Pv},Fv={partial:!0,tokenize:$v};function Iv(n,r,a){const o=this,c=o.events[o.events.length-1];let d=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,f=0;return p;function p(x){const T=o.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(T==="listUnordered"?!o.containerState.marker||x===o.containerState.marker:sc(x)){if(o.containerState.type||(o.containerState.type=T,n.enter(T,{_container:!0})),T==="listUnordered")return n.enter("listItemPrefix"),x===42||x===45?n.check(ro,a,h)(x):h(x);if(!o.interrupt||x===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),m(x)}return a(x)}function m(x){return sc(x)&&++f<10?(n.consume(x),m):(!o.interrupt||f<2)&&(o.containerState.marker?x===o.containerState.marker:x===41||x===46)?(n.exit("listItemValue"),h(x)):a(x)}function h(x){return n.enter("listItemMarker"),n.consume(x),n.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||x,n.check(ja,o.interrupt?a:b,n.attempt(Kv,k,y))}function b(x){return o.containerState.initialBlankLine=!0,d++,k(x)}function y(x){return Ce(x)?(n.enter("listItemPrefixWhitespace"),n.consume(x),n.exit("listItemPrefixWhitespace"),k):a(x)}function k(x){return o.containerState.size=d+o.sliceSerialize(n.exit("listItemPrefix"),!0).length,r(x)}}function Jv(n,r,a){const o=this;return o.containerState._closeFlow=void 0,n.check(ja,c,d);function c(p){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,Oe(n,r,"listItemIndent",o.containerState.size+1)(p)}function d(p){return o.containerState.furtherBlankLines||!Ce(p)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,f(p)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,n.attempt(Fv,r,f)(p))}function f(p){return o.containerState._closeFlow=!0,o.interrupt=void 0,Oe(n,n.attempt(Ot,r,a),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(p)}}function $v(n,r,a){const o=this;return Oe(n,c,"listItemIndent",o.containerState.size+1);function c(d){const f=o.events[o.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===o.containerState.size?r(d):a(d)}}function Wv(n){n.exit(this.containerState.type)}function Pv(n,r,a){const o=this;return Oe(n,c,"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(d){const f=o.events[o.events.length-1];return!Ce(d)&&f&&f[1].type==="listItemPrefixWhitespace"?r(d):a(d)}}const dm={name:"setextUnderline",resolveTo:ex,tokenize:tx};function ex(n,r){let a=n.length,o,c,d;for(;a--;)if(n[a][0]==="enter"){if(n[a][1].type==="content"){o=a;break}n[a][1].type==="paragraph"&&(c=a)}else n[a][1].type==="content"&&n.splice(a,1),!d&&n[a][1].type==="definition"&&(d=a);const f={type:"setextHeading",start:{...n[o][1].start},end:{...n[n.length-1][1].end}};return n[c][1].type="setextHeadingText",d?(n.splice(c,0,["enter",f,r]),n.splice(d+1,0,["exit",n[o][1],r]),n[o][1].end={...n[d][1].end}):n[o][1]=f,n.push(["exit",f,r]),n}function tx(n,r,a){const o=this;let c;return d;function d(h){let b=o.events.length,y;for(;b--;)if(o.events[b][1].type!=="lineEnding"&&o.events[b][1].type!=="linePrefix"&&o.events[b][1].type!=="content"){y=o.events[b][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||y)?(n.enter("setextHeadingLine"),c=h,f(h)):a(h)}function f(h){return n.enter("setextHeadingLineSequence"),p(h)}function p(h){return h===c?(n.consume(h),p):(n.exit("setextHeadingLineSequence"),Ce(h)?Oe(n,m,"lineSuffix")(h):m(h))}function m(h){return h===null||ce(h)?(n.exit("setextHeadingLine"),r(h)):a(h)}}const nx={tokenize:lx};function lx(n){const r=this,a=n.attempt(ja,o,n.attempt(this.parser.constructs.flowInitial,c,Oe(n,n.attempt(this.parser.constructs.flow,c,n.attempt(uv,c)),"linePrefix")));return a;function o(d){if(d===null){n.consume(d);return}return n.enter("lineEndingBlank"),n.consume(d),n.exit("lineEndingBlank"),r.currentConstruct=void 0,a}function c(d){if(d===null){n.consume(d);return}return n.enter("lineEnding"),n.consume(d),n.exit("lineEnding"),r.currentConstruct=void 0,a}}const ix={resolveAll:hg()},ax=dg("string"),rx=dg("text");function dg(n){return{resolveAll:hg(n==="text"?ox:void 0),tokenize:r};function r(a){const o=this,c=this.parser.constructs[n],d=a.attempt(c,f,p);return f;function f(b){return h(b)?d(b):p(b)}function p(b){if(b===null){a.consume(b);return}return a.enter("data"),a.consume(b),m}function m(b){return h(b)?(a.exit("data"),d(b)):(a.consume(b),m)}function h(b){if(b===null)return!0;const y=c[b];let k=-1;if(y)for(;++k-1){const p=f[0];typeof p=="string"?f[0]=p.slice(o):f.shift()}d>0&&f.push(n[c].slice(0,d))}return f}function xx(n,r){let a=-1;const o=[];let c;for(;++a4&&a.slice(0,4)==="data"&&Jb.test(r)){if(r.charAt(4)==="-"){const d=r.slice(5).replace($p,Pb);o="data"+d.charAt(0).toUpperCase()+d.slice(1)}else{const d=r.slice(4);if(!$p.test(d)){let f=d.replace(Ib,Wb);f.charAt(0)!=="-"&&(f="-"+f),r="data"+f}}c=vc}return new c(o,r)}function Wb(n){return"-"+n.toLowerCase()}function Pb(n){return n.charAt(1).toUpperCase()}const ev=Vm([Xm,Zb,Km,Fm,Im],"html"),xc=Vm([Xm,Kb,Km,Fm,Im],"svg");function tv(n){return n.join(" ").trim()}var vi={},Gs,Wp;function nv(){if(Wp)return Gs;Wp=1;var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,a=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,d=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,p=/^\s+|\s+$/g,m=` +`,h="/",b="*",y="",k="comment",x="declaration";function T(Z,D){if(typeof Z!="string")throw new TypeError("First argument must be a string");if(!Z)return[];D=D||{};var F=1,Q=1;function oe(J){var $=J.match(r);$&&(F+=$.length);var O=J.lastIndexOf(m);Q=~O?J.length-O:Q+J.length}function re(){var J={line:F,column:Q};return function($){return $.position=new L(J),me(),$}}function L(J){this.start=J,this.end={line:F,column:Q},this.source=D.source}L.prototype.content=Z;function P(J){var $=new Error(D.source+":"+F+":"+Q+": "+J);if($.reason=J,$.filename=D.source,$.line=F,$.column=Q,$.source=Z,!D.silent)throw $}function he(J){var $=J.exec(Z);if($){var O=$[0];return oe(O),Z=Z.slice(O.length),$}}function me(){he(a)}function N(J){var $;for(J=J||[];$=te();)$!==!1&&J.push($);return J}function te(){var J=re();if(!(h!=Z.charAt(0)||b!=Z.charAt(1))){for(var $=2;y!=Z.charAt($)&&(b!=Z.charAt($)||h!=Z.charAt($+1));)++$;if($+=2,y===Z.charAt($-1))return P("End of comment missing");var O=Z.slice(2,$-2);return Q+=2,oe(O),Z=Z.slice($),Q+=2,J({type:k,comment:O})}}function B(){var J=re(),$=he(o);if($){if(te(),!he(c))return P("property missing ':'");var O=he(d),K=J({type:x,property:U($[0].replace(n,y)),value:O?U(O[0].replace(n,y)):y});return he(f),K}}function le(){var J=[];N(J);for(var $;$=B();)$!==!1&&(J.push($),N(J));return J}return me(),le()}function U(Z){return Z?Z.replace(p,y):y}return Gs=T,Gs}var Pp;function lv(){if(Pp)return vi;Pp=1;var n=vi&&vi.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(vi,"__esModule",{value:!0}),vi.default=a;const r=n(nv());function a(o,c){let d=null;if(!o||typeof o!="string")return d;const f=(0,r.default)(o),p=typeof c=="function";return f.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:b}=m;p?c(h,b,m):b&&(d=d||{},d[h]=b)}),d}return vi}var ka={},em;function iv(){if(em)return ka;em=1,Object.defineProperty(ka,"__esModule",{value:!0}),ka.camelCase=void 0;var n=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,a=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,d=function(h){return!h||a.test(h)||n.test(h)},f=function(h,b){return b.toUpperCase()},p=function(h,b){return"".concat(b,"-")},m=function(h,b){return b===void 0&&(b={}),d(h)?h:(h=h.toLowerCase(),b.reactCompat?h=h.replace(c,p):h=h.replace(o,p),h.replace(r,f))};return ka.camelCase=m,ka}var Sa,tm;function av(){if(tm)return Sa;tm=1;var n=Sa&&Sa.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},r=n(lv()),a=iv();function o(c,d){var f={};return!c||typeof c!="string"||(0,r.default)(c,function(p,m){p&&m&&(f[(0,a.camelCase)(p,d)]=m)}),f}return o.default=o,Sa=o,Sa}var rv=av();const ov=yc(rv),Jm=$m("end"),kc=$m("start");function $m(n){return r;function r(a){const o=a&&a.position&&a.position[n]||{};if(typeof o.line=="number"&&o.line>0&&typeof o.column=="number"&&o.column>0)return{line:o.line,column:o.column,offset:typeof o.offset=="number"&&o.offset>-1?o.offset:void 0}}}function uv(n){const r=kc(n),a=Jm(n);if(r&&a)return{start:r,end:a}}function Aa(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?nm(n.position):"start"in n||"end"in n?nm(n):"line"in n||"column"in n?uc(n):""}function uc(n){return lm(n&&n.line)+":"+lm(n&&n.column)}function nm(n){return uc(n&&n.start)+"-"+uc(n&&n.end)}function lm(n){return n&&typeof n=="number"?n:1}class gt extends Error{constructor(r,a,o){super(),typeof a=="string"&&(o=a,a=void 0);let c="",d={},f=!1;if(a&&("line"in a&&"column"in a?d={place:a}:"start"in a&&"end"in a?d={place:a}:"type"in a?d={ancestors:[a],place:a.position}:d={...a}),typeof r=="string"?c=r:!d.cause&&r&&(f=!0,c=r.message,d.cause=r),!d.ruleId&&!d.source&&typeof o=="string"){const m=o.indexOf(":");m===-1?d.ruleId=o:(d.source=o.slice(0,m),d.ruleId=o.slice(m+1))}if(!d.place&&d.ancestors&&d.ancestors){const m=d.ancestors[d.ancestors.length-1];m&&(d.place=m.position)}const p=d.place&&"start"in d.place?d.place.start:d.place;this.ancestors=d.ancestors||void 0,this.cause=d.cause||void 0,this.column=p?p.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=p?p.line:void 0,this.name=Aa(d.place)||"1:1",this.place=d.place||void 0,this.reason=this.message,this.ruleId=d.ruleId||void 0,this.source=d.source||void 0,this.stack=f&&d.cause&&typeof d.cause.stack=="string"?d.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}gt.prototype.file="";gt.prototype.name="";gt.prototype.reason="";gt.prototype.message="";gt.prototype.stack="";gt.prototype.column=void 0;gt.prototype.line=void 0;gt.prototype.ancestors=void 0;gt.prototype.cause=void 0;gt.prototype.fatal=void 0;gt.prototype.place=void 0;gt.prototype.ruleId=void 0;gt.prototype.source=void 0;const Sc={}.hasOwnProperty,sv=new Map,cv=/[A-Z]/g,fv=new Set(["table","tbody","thead","tfoot","tr"]),dv=new Set(["td","th"]),Wm="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hv(n,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=r.filePath||void 0;let o;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");o=kv(a,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");o=xv(a,r.jsx,r.jsxs)}const c={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:o,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?xc:ev,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},d=Pm(c,n,void 0);return d&&typeof d!="string"?d:c.create(n,c.Fragment,{children:d||void 0},void 0)}function Pm(n,r,a){if(r.type==="element")return pv(n,r,a);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return mv(n,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return yv(n,r,a);if(r.type==="mdxjsEsm")return gv(n,r);if(r.type==="root")return bv(n,r,a);if(r.type==="text")return vv(n,r)}function pv(n,r,a){const o=n.schema;let c=o;r.tagName.toLowerCase()==="svg"&&o.space==="html"&&(c=xc,n.schema=c),n.ancestors.push(r);const d=tg(n,r.tagName,!1),f=Sv(n,r);let p=Cc(n,r);return fv.has(r.tagName)&&(p=p.filter(function(m){return typeof m=="string"?!Xb(m):!0})),eg(n,f,d,r),wc(f,p),n.ancestors.pop(),n.schema=o,n.create(r,d,f,a)}function mv(n,r){if(r.data&&r.data.estree&&n.evaluater){const o=r.data.estree.body[0];return o.type,n.evaluater.evaluateExpression(o.expression)}Ma(n,r.position)}function gv(n,r){if(r.data&&r.data.estree&&n.evaluater)return n.evaluater.evaluateProgram(r.data.estree);Ma(n,r.position)}function yv(n,r,a){const o=n.schema;let c=o;r.name==="svg"&&o.space==="html"&&(c=xc,n.schema=c),n.ancestors.push(r);const d=r.name===null?n.Fragment:tg(n,r.name,!0),f=wv(n,r),p=Cc(n,r);return eg(n,f,d,r),wc(f,p),n.ancestors.pop(),n.schema=o,n.create(r,d,f,a)}function bv(n,r,a){const o={};return wc(o,Cc(n,r)),n.create(r,n.Fragment,o,a)}function vv(n,r){return r.value}function eg(n,r,a,o){typeof a!="string"&&a!==n.Fragment&&n.passNode&&(r.node=o)}function wc(n,r){if(r.length>0){const a=r.length>1?r:r[0];a&&(n.children=a)}}function xv(n,r,a){return o;function o(c,d,f,p){const h=Array.isArray(f.children)?a:r;return p?h(d,f,p):h(d,f)}}function kv(n,r){return a;function a(o,c,d,f){const p=Array.isArray(d.children),m=kc(o);return r(c,d,f,p,{columnNumber:m?m.column-1:void 0,fileName:n,lineNumber:m?m.line:void 0},void 0)}}function Sv(n,r){const a={};let o,c;for(c in r.properties)if(c!=="children"&&Sc.call(r.properties,c)){const d=Cv(n,c,r.properties[c]);if(d){const[f,p]=d;n.tableCellAlignToStyle&&f==="align"&&typeof p=="string"&&dv.has(r.tagName)?o=p:a[f]=p}}if(o){const d=a.style||(a.style={});d[n.stylePropertyNameCase==="css"?"text-align":"textAlign"]=o}return a}function wv(n,r){const a={};for(const o of r.attributes)if(o.type==="mdxJsxExpressionAttribute")if(o.data&&o.data.estree&&n.evaluater){const d=o.data.estree.body[0];d.type;const f=d.expression;f.type;const p=f.properties[0];p.type,Object.assign(a,n.evaluater.evaluateExpression(p.argument))}else Ma(n,r.position);else{const c=o.name;let d;if(o.value&&typeof o.value=="object")if(o.value.data&&o.value.data.estree&&n.evaluater){const p=o.value.data.estree.body[0];p.type,d=n.evaluater.evaluateExpression(p.expression)}else Ma(n,r.position);else d=o.value===null?!0:o.value;a[c]=d}return a}function Cc(n,r){const a=[];let o=-1;const c=n.passKeys?new Map:sv;for(;++oc?0:c+r:r=r>c?c:r,a=a>0?a:0,o.length<1e4)f=Array.from(o),f.unshift(r,a),n.splice(...f);else for(a&&n.splice(r,a);d0?(qt(n,n.length,0,r),n):r}const rm={}.hasOwnProperty;function lg(n){const r={};let a=-1;for(;++a13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function on(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const xt=ul(/[A-Za-z]/),mt=ul(/[\dA-Za-z]/),Rv=ul(/[#-'*+\--9=?A-Z^-~]/);function uo(n){return n!==null&&(n<32||n===127)}const sc=ul(/\d/),Nv=ul(/[\dA-Fa-f]/),jv=ul(/[!-/:-@[-`{-~]/);function ce(n){return n!==null&&n<-2}function Ve(n){return n!==null&&(n<0||n===32)}function Ce(n){return n===-2||n===-1||n===32}const mo=ul(new RegExp("\\p{P}|\\p{S}","u")),Ol=ul(/\s/);function ul(n){return r;function r(a){return a!==null&&a>-1&&n.test(String.fromCharCode(a))}}function Ai(n){const r=[];let a=-1,o=0,c=0;for(;++a55295&&d<57344){const p=n.charCodeAt(a+1);d<56320&&p>56319&&p<57344?(f=String.fromCharCode(d,p),c=1):f="�"}else f=String.fromCharCode(d);f&&(r.push(n.slice(o,a),encodeURIComponent(f)),o=a+c+1,f=""),c&&(a+=c,c=0)}return r.join("")+n.slice(o)}function Oe(n,r,a,o){const c=o?o-1:Number.POSITIVE_INFINITY;let d=0;return f;function f(m){return Ce(m)?(n.enter(a),p(m)):r(m)}function p(m){return Ce(m)&&d++f))return;const P=r.events.length;let he=P,me,N;for(;he--;)if(r.events[he][0]==="exit"&&r.events[he][1].type==="chunkFlow"){if(me){N=r.events[he][1].end;break}me=!0}for(D(o),L=P;LQ;){const re=a[oe];r.containerState=re[1],re[0].exit.call(r,n)}a.length=Q}function F(){c.write([null]),d=void 0,c=void 0,r.containerState._closeFlow=void 0}}function qv(n,r,a){return Oe(n,n.attempt(this.parser.constructs.document,r,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function wi(n){if(n===null||Ve(n)||Ol(n))return 1;if(mo(n))return 2}function go(n,r,a){const o=[];let c=-1;for(;++c1&&n[a][1].end.offset-n[a][1].start.offset>1?2:1;const y={...n[o][1].end},k={...n[a][1].start};um(y,-m),um(k,m),f={type:m>1?"strongSequence":"emphasisSequence",start:y,end:{...n[o][1].end}},p={type:m>1?"strongSequence":"emphasisSequence",start:{...n[a][1].start},end:k},d={type:m>1?"strongText":"emphasisText",start:{...n[o][1].end},end:{...n[a][1].start}},c={type:m>1?"strong":"emphasis",start:{...f.start},end:{...p.end}},n[o][1].end={...f.start},n[a][1].start={...p.end},h=[],n[o][1].end.offset-n[o][1].start.offset&&(h=Pt(h,[["enter",n[o][1],r],["exit",n[o][1],r]])),h=Pt(h,[["enter",c,r],["enter",f,r],["exit",f,r],["enter",d,r]]),h=Pt(h,go(r.parser.constructs.insideSpan.null,n.slice(o+1,a),r)),h=Pt(h,[["exit",d,r],["enter",p,r],["exit",p,r],["exit",c,r]]),n[a][1].end.offset-n[a][1].start.offset?(b=2,h=Pt(h,[["enter",n[a][1],r],["exit",n[a][1],r]])):b=0,qt(n,o-1,a-o+3,h),a=o+h.length-b-2;break}}for(a=-1;++a0&&Ce(L)?Oe(n,F,"linePrefix",d+1)(L):F(L)}function F(L){return L===null||ce(L)?n.check(sm,U,oe)(L):(n.enter("codeFlowValue"),Q(L))}function Q(L){return L===null||ce(L)?(n.exit("codeFlowValue"),F(L)):(n.consume(L),Q)}function oe(L){return n.exit("codeFenced"),r(L)}function re(L,P,he){let me=0;return N;function N($){return L.enter("lineEnding"),L.consume($),L.exit("lineEnding"),te}function te($){return L.enter("codeFencedFence"),Ce($)?Oe(L,B,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):B($)}function B($){return $===p?(L.enter("codeFencedFenceSequence"),le($)):he($)}function le($){return $===p?(me++,L.consume($),le):me>=f?(L.exit("codeFencedFenceSequence"),Ce($)?Oe(L,J,"whitespace")($):J($)):he($)}function J($){return $===null||ce($)?(L.exit("codeFencedFence"),P($)):he($)}}}function Wv(n,r,a){const o=this;return c;function c(f){return f===null?a(f):(n.enter("lineEnding"),n.consume(f),n.exit("lineEnding"),d)}function d(f){return o.parser.lazy[o.now().line]?a(f):r(f)}}const Xs={name:"codeIndented",tokenize:e0},Pv={partial:!0,tokenize:t0};function e0(n,r,a){const o=this;return c;function c(h){return n.enter("codeIndented"),Oe(n,d,"linePrefix",5)(h)}function d(h){const b=o.events[o.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?f(h):a(h)}function f(h){return h===null?m(h):ce(h)?n.attempt(Pv,f,m)(h):(n.enter("codeFlowValue"),p(h))}function p(h){return h===null||ce(h)?(n.exit("codeFlowValue"),f(h)):(n.consume(h),p)}function m(h){return n.exit("codeIndented"),r(h)}}function t0(n,r,a){const o=this;return c;function c(f){return o.parser.lazy[o.now().line]?a(f):ce(f)?(n.enter("lineEnding"),n.consume(f),n.exit("lineEnding"),c):Oe(n,d,"linePrefix",5)(f)}function d(f){const p=o.events[o.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?r(f):ce(f)?c(f):a(f)}}const n0={name:"codeText",previous:i0,resolve:l0,tokenize:a0};function l0(n){let r=n.length-4,a=3,o,c;if((n[a][1].type==="lineEnding"||n[a][1].type==="space")&&(n[r][1].type==="lineEnding"||n[r][1].type==="space")){for(o=a;++o=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return rthis.left.length?this.right.slice(this.right.length-o+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-o+this.left.length).reverse())}splice(r,a,o){const c=a||0;this.setCursor(Math.trunc(r));const d=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return o&&wa(this.left,o),d.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),wa(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),wa(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r=4?r(f):n.interrupt(o.parser.constructs.flow,a,r)(f)}}function sg(n,r,a,o,c,d,f,p,m){const h=m||Number.POSITIVE_INFINITY;let b=0;return y;function y(D){return D===60?(n.enter(o),n.enter(c),n.enter(d),n.consume(D),n.exit(d),k):D===null||D===32||D===41||uo(D)?a(D):(n.enter(o),n.enter(f),n.enter(p),n.enter("chunkString",{contentType:"string"}),U(D))}function k(D){return D===62?(n.enter(d),n.consume(D),n.exit(d),n.exit(c),n.exit(o),r):(n.enter(p),n.enter("chunkString",{contentType:"string"}),x(D))}function x(D){return D===62?(n.exit("chunkString"),n.exit(p),k(D)):D===null||D===60||ce(D)?a(D):(n.consume(D),D===92?T:x)}function T(D){return D===60||D===62||D===92?(n.consume(D),x):x(D)}function U(D){return!b&&(D===null||D===41||Ve(D))?(n.exit("chunkString"),n.exit(p),n.exit(f),n.exit(o),r(D)):b999||x===null||x===91||x===93&&!m||x===94&&!p&&"_hiddenFootnoteSupport"in f.parser.constructs?a(x):x===93?(n.exit(d),n.enter(c),n.consume(x),n.exit(c),n.exit(o),r):ce(x)?(n.enter("lineEnding"),n.consume(x),n.exit("lineEnding"),b):(n.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===null||x===91||x===93||ce(x)||p++>999?(n.exit("chunkString"),b(x)):(n.consume(x),m||(m=!Ce(x)),x===92?k:y)}function k(x){return x===91||x===92||x===93?(n.consume(x),p++,y):y(x)}}function fg(n,r,a,o,c,d){let f;return p;function p(k){return k===34||k===39||k===40?(n.enter(o),n.enter(c),n.consume(k),n.exit(c),f=k===40?41:k,m):a(k)}function m(k){return k===f?(n.enter(c),n.consume(k),n.exit(c),n.exit(o),r):(n.enter(d),h(k))}function h(k){return k===f?(n.exit(d),m(f)):k===null?a(k):ce(k)?(n.enter("lineEnding"),n.consume(k),n.exit("lineEnding"),Oe(n,h,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===f||k===null||ce(k)?(n.exit("chunkString"),h(k)):(n.consume(k),k===92?y:b)}function y(k){return k===f||k===92?(n.consume(k),b):b(k)}}function Ea(n,r){let a;return o;function o(c){return ce(c)?(n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),a=!0,o):Ce(c)?Oe(n,o,a?"linePrefix":"lineSuffix")(c):r(c)}}const h0={name:"definition",tokenize:m0},p0={partial:!0,tokenize:g0};function m0(n,r,a){const o=this;let c;return d;function d(x){return n.enter("definition"),f(x)}function f(x){return cg.call(o,n,p,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function p(x){return c=on(o.sliceSerialize(o.events[o.events.length-1][1]).slice(1,-1)),x===58?(n.enter("definitionMarker"),n.consume(x),n.exit("definitionMarker"),m):a(x)}function m(x){return Ve(x)?Ea(n,h)(x):h(x)}function h(x){return sg(n,b,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function b(x){return n.attempt(p0,y,y)(x)}function y(x){return Ce(x)?Oe(n,k,"whitespace")(x):k(x)}function k(x){return x===null||ce(x)?(n.exit("definition"),o.parser.defined.push(c),r(x)):a(x)}}function g0(n,r,a){return o;function o(p){return Ve(p)?Ea(n,c)(p):a(p)}function c(p){return fg(n,d,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(p)}function d(p){return Ce(p)?Oe(n,f,"whitespace")(p):f(p)}function f(p){return p===null||ce(p)?r(p):a(p)}}const y0={name:"hardBreakEscape",tokenize:b0};function b0(n,r,a){return o;function o(d){return n.enter("hardBreakEscape"),n.consume(d),c}function c(d){return ce(d)?(n.exit("hardBreakEscape"),r(d)):a(d)}}const v0={name:"headingAtx",resolve:x0,tokenize:k0};function x0(n,r){let a=n.length-2,o=3,c,d;return n[o][1].type==="whitespace"&&(o+=2),a-2>o&&n[a][1].type==="whitespace"&&(a-=2),n[a][1].type==="atxHeadingSequence"&&(o===a-1||a-4>o&&n[a-2][1].type==="whitespace")&&(a-=o+1===a?2:4),a>o&&(c={type:"atxHeadingText",start:n[o][1].start,end:n[a][1].end},d={type:"chunkText",start:n[o][1].start,end:n[a][1].end,contentType:"text"},qt(n,o,a-o+1,[["enter",c,r],["enter",d,r],["exit",d,r],["exit",c,r]])),n}function k0(n,r,a){let o=0;return c;function c(b){return n.enter("atxHeading"),d(b)}function d(b){return n.enter("atxHeadingSequence"),f(b)}function f(b){return b===35&&o++<6?(n.consume(b),f):b===null||Ve(b)?(n.exit("atxHeadingSequence"),p(b)):a(b)}function p(b){return b===35?(n.enter("atxHeadingSequence"),m(b)):b===null||ce(b)?(n.exit("atxHeading"),r(b)):Ce(b)?Oe(n,p,"whitespace")(b):(n.enter("atxHeadingText"),h(b))}function m(b){return b===35?(n.consume(b),m):(n.exit("atxHeadingSequence"),p(b))}function h(b){return b===null||b===35||Ve(b)?(n.exit("atxHeadingText"),p(b)):(n.consume(b),h)}}const S0=["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"],fm=["pre","script","style","textarea"],w0={concrete:!0,name:"htmlFlow",resolveTo:E0,tokenize:T0},C0={partial:!0,tokenize:O0},A0={partial:!0,tokenize:z0};function E0(n){let r=n.length;for(;r--&&!(n[r][0]==="enter"&&n[r][1].type==="htmlFlow"););return r>1&&n[r-2][1].type==="linePrefix"&&(n[r][1].start=n[r-2][1].start,n[r+1][1].start=n[r-2][1].start,n.splice(r-2,2)),n}function T0(n,r,a){const o=this;let c,d,f,p,m;return h;function h(S){return b(S)}function b(S){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(S),y}function y(S){return S===33?(n.consume(S),k):S===47?(n.consume(S),d=!0,U):S===63?(n.consume(S),c=3,o.interrupt?r:w):xt(S)?(n.consume(S),f=String.fromCharCode(S),Z):a(S)}function k(S){return S===45?(n.consume(S),c=2,x):S===91?(n.consume(S),c=5,p=0,T):xt(S)?(n.consume(S),c=4,o.interrupt?r:w):a(S)}function x(S){return S===45?(n.consume(S),o.interrupt?r:w):a(S)}function T(S){const ee="CDATA[";return S===ee.charCodeAt(p++)?(n.consume(S),p===ee.length?o.interrupt?r:B:T):a(S)}function U(S){return xt(S)?(n.consume(S),f=String.fromCharCode(S),Z):a(S)}function Z(S){if(S===null||S===47||S===62||Ve(S)){const ee=S===47,de=f.toLowerCase();return!ee&&!d&&fm.includes(de)?(c=1,o.interrupt?r(S):B(S)):S0.includes(f.toLowerCase())?(c=6,ee?(n.consume(S),D):o.interrupt?r(S):B(S)):(c=7,o.interrupt&&!o.parser.lazy[o.now().line]?a(S):d?F(S):Q(S))}return S===45||mt(S)?(n.consume(S),f+=String.fromCharCode(S),Z):a(S)}function D(S){return S===62?(n.consume(S),o.interrupt?r:B):a(S)}function F(S){return Ce(S)?(n.consume(S),F):N(S)}function Q(S){return S===47?(n.consume(S),N):S===58||S===95||xt(S)?(n.consume(S),oe):Ce(S)?(n.consume(S),Q):N(S)}function oe(S){return S===45||S===46||S===58||S===95||mt(S)?(n.consume(S),oe):re(S)}function re(S){return S===61?(n.consume(S),L):Ce(S)?(n.consume(S),re):Q(S)}function L(S){return S===null||S===60||S===61||S===62||S===96?a(S):S===34||S===39?(n.consume(S),m=S,P):Ce(S)?(n.consume(S),L):he(S)}function P(S){return S===m?(n.consume(S),m=null,me):S===null||ce(S)?a(S):(n.consume(S),P)}function he(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||Ve(S)?re(S):(n.consume(S),he)}function me(S){return S===47||S===62||Ce(S)?Q(S):a(S)}function N(S){return S===62?(n.consume(S),te):a(S)}function te(S){return S===null||ce(S)?B(S):Ce(S)?(n.consume(S),te):a(S)}function B(S){return S===45&&c===2?(n.consume(S),O):S===60&&c===1?(n.consume(S),K):S===62&&c===4?(n.consume(S),A):S===63&&c===3?(n.consume(S),w):S===93&&c===5?(n.consume(S),xe):ce(S)&&(c===6||c===7)?(n.exit("htmlFlowData"),n.check(C0,Y,le)(S)):S===null||ce(S)?(n.exit("htmlFlowData"),le(S)):(n.consume(S),B)}function le(S){return n.check(A0,J,Y)(S)}function J(S){return n.enter("lineEnding"),n.consume(S),n.exit("lineEnding"),$}function $(S){return S===null||ce(S)?le(S):(n.enter("htmlFlowData"),B(S))}function O(S){return S===45?(n.consume(S),w):B(S)}function K(S){return S===47?(n.consume(S),f="",ae):B(S)}function ae(S){if(S===62){const ee=f.toLowerCase();return fm.includes(ee)?(n.consume(S),A):B(S)}return xt(S)&&f.length<8?(n.consume(S),f+=String.fromCharCode(S),ae):B(S)}function xe(S){return S===93?(n.consume(S),w):B(S)}function w(S){return S===62?(n.consume(S),A):S===45&&c===2?(n.consume(S),w):B(S)}function A(S){return S===null||ce(S)?(n.exit("htmlFlowData"),Y(S)):(n.consume(S),A)}function Y(S){return n.exit("htmlFlow"),r(S)}}function z0(n,r,a){const o=this;return c;function c(f){return ce(f)?(n.enter("lineEnding"),n.consume(f),n.exit("lineEnding"),d):a(f)}function d(f){return o.parser.lazy[o.now().line]?a(f):r(f)}}function O0(n,r,a){return o;function o(c){return n.enter("lineEnding"),n.consume(c),n.exit("lineEnding"),n.attempt(Na,r,a)}}const _0={name:"htmlText",tokenize:M0};function M0(n,r,a){const o=this;let c,d,f;return p;function p(w){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(w),m}function m(w){return w===33?(n.consume(w),h):w===47?(n.consume(w),re):w===63?(n.consume(w),Q):xt(w)?(n.consume(w),he):a(w)}function h(w){return w===45?(n.consume(w),b):w===91?(n.consume(w),d=0,T):xt(w)?(n.consume(w),F):a(w)}function b(w){return w===45?(n.consume(w),x):a(w)}function y(w){return w===null?a(w):w===45?(n.consume(w),k):ce(w)?(f=y,K(w)):(n.consume(w),y)}function k(w){return w===45?(n.consume(w),x):y(w)}function x(w){return w===62?O(w):w===45?k(w):y(w)}function T(w){const A="CDATA[";return w===A.charCodeAt(d++)?(n.consume(w),d===A.length?U:T):a(w)}function U(w){return w===null?a(w):w===93?(n.consume(w),Z):ce(w)?(f=U,K(w)):(n.consume(w),U)}function Z(w){return w===93?(n.consume(w),D):U(w)}function D(w){return w===62?O(w):w===93?(n.consume(w),D):U(w)}function F(w){return w===null||w===62?O(w):ce(w)?(f=F,K(w)):(n.consume(w),F)}function Q(w){return w===null?a(w):w===63?(n.consume(w),oe):ce(w)?(f=Q,K(w)):(n.consume(w),Q)}function oe(w){return w===62?O(w):Q(w)}function re(w){return xt(w)?(n.consume(w),L):a(w)}function L(w){return w===45||mt(w)?(n.consume(w),L):P(w)}function P(w){return ce(w)?(f=P,K(w)):Ce(w)?(n.consume(w),P):O(w)}function he(w){return w===45||mt(w)?(n.consume(w),he):w===47||w===62||Ve(w)?me(w):a(w)}function me(w){return w===47?(n.consume(w),O):w===58||w===95||xt(w)?(n.consume(w),N):ce(w)?(f=me,K(w)):Ce(w)?(n.consume(w),me):O(w)}function N(w){return w===45||w===46||w===58||w===95||mt(w)?(n.consume(w),N):te(w)}function te(w){return w===61?(n.consume(w),B):ce(w)?(f=te,K(w)):Ce(w)?(n.consume(w),te):me(w)}function B(w){return w===null||w===60||w===61||w===62||w===96?a(w):w===34||w===39?(n.consume(w),c=w,le):ce(w)?(f=B,K(w)):Ce(w)?(n.consume(w),B):(n.consume(w),J)}function le(w){return w===c?(n.consume(w),c=void 0,$):w===null?a(w):ce(w)?(f=le,K(w)):(n.consume(w),le)}function J(w){return w===null||w===34||w===39||w===60||w===61||w===96?a(w):w===47||w===62||Ve(w)?me(w):(n.consume(w),J)}function $(w){return w===47||w===62||Ve(w)?me(w):a(w)}function O(w){return w===62?(n.consume(w),n.exit("htmlTextData"),n.exit("htmlText"),r):a(w)}function K(w){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(w),n.exit("lineEnding"),ae}function ae(w){return Ce(w)?Oe(n,xe,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):xe(w)}function xe(w){return n.enter("htmlTextData"),f(w)}}const Tc={name:"labelEnd",resolveAll:j0,resolveTo:L0,tokenize:U0},D0={tokenize:B0},R0={tokenize:H0},N0={tokenize:q0};function j0(n){let r=-1;const a=[];for(;++r=3&&(h===null||ce(h))?(n.exit("thematicBreak"),r(h)):a(h)}function m(h){return h===c?(n.consume(h),o++,m):(n.exit("thematicBreakSequence"),Ce(h)?Oe(n,p,"whitespace")(h):p(h))}}const Ot={continuation:{tokenize:J0},exit:W0,name:"list",tokenize:I0},K0={partial:!0,tokenize:P0},F0={partial:!0,tokenize:$0};function I0(n,r,a){const o=this,c=o.events[o.events.length-1];let d=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,f=0;return p;function p(x){const T=o.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(T==="listUnordered"?!o.containerState.marker||x===o.containerState.marker:sc(x)){if(o.containerState.type||(o.containerState.type=T,n.enter(T,{_container:!0})),T==="listUnordered")return n.enter("listItemPrefix"),x===42||x===45?n.check(ro,a,h)(x):h(x);if(!o.interrupt||x===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),m(x)}return a(x)}function m(x){return sc(x)&&++f<10?(n.consume(x),m):(!o.interrupt||f<2)&&(o.containerState.marker?x===o.containerState.marker:x===41||x===46)?(n.exit("listItemValue"),h(x)):a(x)}function h(x){return n.enter("listItemMarker"),n.consume(x),n.exit("listItemMarker"),o.containerState.marker=o.containerState.marker||x,n.check(Na,o.interrupt?a:b,n.attempt(K0,k,y))}function b(x){return o.containerState.initialBlankLine=!0,d++,k(x)}function y(x){return Ce(x)?(n.enter("listItemPrefixWhitespace"),n.consume(x),n.exit("listItemPrefixWhitespace"),k):a(x)}function k(x){return o.containerState.size=d+o.sliceSerialize(n.exit("listItemPrefix"),!0).length,r(x)}}function J0(n,r,a){const o=this;return o.containerState._closeFlow=void 0,n.check(Na,c,d);function c(p){return o.containerState.furtherBlankLines=o.containerState.furtherBlankLines||o.containerState.initialBlankLine,Oe(n,r,"listItemIndent",o.containerState.size+1)(p)}function d(p){return o.containerState.furtherBlankLines||!Ce(p)?(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,f(p)):(o.containerState.furtherBlankLines=void 0,o.containerState.initialBlankLine=void 0,n.attempt(F0,r,f)(p))}function f(p){return o.containerState._closeFlow=!0,o.interrupt=void 0,Oe(n,n.attempt(Ot,r,a),"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(p)}}function $0(n,r,a){const o=this;return Oe(n,c,"listItemIndent",o.containerState.size+1);function c(d){const f=o.events[o.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===o.containerState.size?r(d):a(d)}}function W0(n){n.exit(this.containerState.type)}function P0(n,r,a){const o=this;return Oe(n,c,"listItemPrefixWhitespace",o.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(d){const f=o.events[o.events.length-1];return!Ce(d)&&f&&f[1].type==="listItemPrefixWhitespace"?r(d):a(d)}}const dm={name:"setextUnderline",resolveTo:ex,tokenize:tx};function ex(n,r){let a=n.length,o,c,d;for(;a--;)if(n[a][0]==="enter"){if(n[a][1].type==="content"){o=a;break}n[a][1].type==="paragraph"&&(c=a)}else n[a][1].type==="content"&&n.splice(a,1),!d&&n[a][1].type==="definition"&&(d=a);const f={type:"setextHeading",start:{...n[o][1].start},end:{...n[n.length-1][1].end}};return n[c][1].type="setextHeadingText",d?(n.splice(c,0,["enter",f,r]),n.splice(d+1,0,["exit",n[o][1],r]),n[o][1].end={...n[d][1].end}):n[o][1]=f,n.push(["exit",f,r]),n}function tx(n,r,a){const o=this;let c;return d;function d(h){let b=o.events.length,y;for(;b--;)if(o.events[b][1].type!=="lineEnding"&&o.events[b][1].type!=="linePrefix"&&o.events[b][1].type!=="content"){y=o.events[b][1].type==="paragraph";break}return!o.parser.lazy[o.now().line]&&(o.interrupt||y)?(n.enter("setextHeadingLine"),c=h,f(h)):a(h)}function f(h){return n.enter("setextHeadingLineSequence"),p(h)}function p(h){return h===c?(n.consume(h),p):(n.exit("setextHeadingLineSequence"),Ce(h)?Oe(n,m,"lineSuffix")(h):m(h))}function m(h){return h===null||ce(h)?(n.exit("setextHeadingLine"),r(h)):a(h)}}const nx={tokenize:lx};function lx(n){const r=this,a=n.attempt(Na,o,n.attempt(this.parser.constructs.flowInitial,c,Oe(n,n.attempt(this.parser.constructs.flow,c,n.attempt(u0,c)),"linePrefix")));return a;function o(d){if(d===null){n.consume(d);return}return n.enter("lineEndingBlank"),n.consume(d),n.exit("lineEndingBlank"),r.currentConstruct=void 0,a}function c(d){if(d===null){n.consume(d);return}return n.enter("lineEnding"),n.consume(d),n.exit("lineEnding"),r.currentConstruct=void 0,a}}const ix={resolveAll:hg()},ax=dg("string"),rx=dg("text");function dg(n){return{resolveAll:hg(n==="text"?ox:void 0),tokenize:r};function r(a){const o=this,c=this.parser.constructs[n],d=a.attempt(c,f,p);return f;function f(b){return h(b)?d(b):p(b)}function p(b){if(b===null){a.consume(b);return}return a.enter("data"),a.consume(b),m}function m(b){return h(b)?(a.exit("data"),d(b)):(a.consume(b),m)}function h(b){if(b===null)return!0;const y=c[b];let k=-1;if(y)for(;++k-1){const p=f[0];typeof p=="string"?f[0]=p.slice(o):f.shift()}d>0&&f.push(n[c].slice(0,d))}return f}function xx(n,r){let a=-1;const o=[];let c;for(;++a0){const Mt=pe.tokenStack[pe.tokenStack.length-1];(Mt[1]||pm).call(pe,void 0,Mt[0])}for(W.position={start:ol(G.length>0?G[0][1].start:{line:1,column:1,offset:0}),end:ol(G.length>0?G[G.length-2][1].end:{line:1,column:1,offset:0})},Re=-1;++Re0){const Mt=pe.tokenStack[pe.tokenStack.length-1];(Mt[1]||pm).call(pe,void 0,Mt[0])}for(W.position={start:ol(G.length>0?G[0][1].start:{line:1,column:1,offset:0}),end:ol(G.length>0?G[G.length-2][1].end:{line:1,column:1,offset:0})},Re=-1;++Re0&&(o.className=["language-"+c[0]]);let d={type:"element",tagName:"code",properties:o,children:[{type:"text",value:a}]};return r.meta&&(d.data={meta:r.meta}),n.patch(r,d),d=n.applyData(r,d),d={type:"element",tagName:"pre",properties:{},children:[d]},n.patch(r,d),d}function jx(n,r){const a={type:"element",tagName:"del",properties:{},children:n.all(r)};return n.patch(r,a),n.applyData(r,a)}function Nx(n,r){const a={type:"element",tagName:"em",properties:{},children:n.all(r)};return n.patch(r,a),n.applyData(r,a)}function Lx(n,r){const a=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",o=String(r.identifier).toUpperCase(),c=Ei(o.toLowerCase()),d=n.footnoteOrder.indexOf(o);let f,p=n.footnoteCounts.get(o);p===void 0?(p=0,n.footnoteOrder.push(o),f=n.footnoteOrder.length):f=d+1,p+=1,n.footnoteCounts.set(o,p);const m={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+c,id:a+"fnref-"+c+(p>1?"-"+p:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(f)}]};n.patch(r,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return n.patch(r,h),n.applyData(r,h)}function Ux(n,r){const a={type:"element",tagName:"h"+r.depth,properties:{},children:n.all(r)};return n.patch(r,a),n.applyData(r,a)}function Bx(n,r){if(n.options.allowDangerousHtml){const a={type:"raw",value:r.value};return n.patch(r,a),n.applyData(r,a)}}function gg(n,r){const a=r.referenceType;let o="]";if(a==="collapsed"?o+="[]":a==="full"&&(o+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+o}];const c=n.all(r),d=c[0];d&&d.type==="text"?d.value="["+d.value:c.unshift({type:"text",value:"["});const f=c[c.length-1];return f&&f.type==="text"?f.value+=o:c.push({type:"text",value:o}),c}function Hx(n,r){const a=String(r.identifier).toUpperCase(),o=n.definitionById.get(a);if(!o)return gg(n,r);const c={src:Ei(o.url||""),alt:r.alt};o.title!==null&&o.title!==void 0&&(c.title=o.title);const d={type:"element",tagName:"img",properties:c,children:[]};return n.patch(r,d),n.applyData(r,d)}function qx(n,r){const a={src:Ei(r.url)};r.alt!==null&&r.alt!==void 0&&(a.alt=r.alt),r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"img",properties:a,children:[]};return n.patch(r,o),n.applyData(r,o)}function Yx(n,r){const a={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};n.patch(r,a);const o={type:"element",tagName:"code",properties:{},children:[a]};return n.patch(r,o),n.applyData(r,o)}function Gx(n,r){const a=String(r.identifier).toUpperCase(),o=n.definitionById.get(a);if(!o)return gg(n,r);const c={href:Ei(o.url||"")};o.title!==null&&o.title!==void 0&&(c.title=o.title);const d={type:"element",tagName:"a",properties:c,children:n.all(r)};return n.patch(r,d),n.applyData(r,d)}function Vx(n,r){const a={href:Ei(r.url)};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"a",properties:a,children:n.all(r)};return n.patch(r,o),n.applyData(r,o)}function Xx(n,r,a){const o=n.all(r),c=a?Qx(a):yg(r),d={},f=[];if(typeof r.checked=="boolean"){const b=o[0];let y;b&&b.type==="element"&&b.tagName==="p"?y=b:(y={type:"element",tagName:"p",properties:{},children:[]},o.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),d.className=["task-list-item"]}let p=-1;for(;++p0&&(o.className=["language-"+c[0]]);let d={type:"element",tagName:"code",properties:o,children:[{type:"text",value:a}]};return r.meta&&(d.data={meta:r.meta}),n.patch(r,d),d=n.applyData(r,d),d={type:"element",tagName:"pre",properties:{},children:[d]},n.patch(r,d),d}function Nx(n,r){const a={type:"element",tagName:"del",properties:{},children:n.all(r)};return n.patch(r,a),n.applyData(r,a)}function jx(n,r){const a={type:"element",tagName:"em",properties:{},children:n.all(r)};return n.patch(r,a),n.applyData(r,a)}function Lx(n,r){const a=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",o=String(r.identifier).toUpperCase(),c=Ai(o.toLowerCase()),d=n.footnoteOrder.indexOf(o);let f,p=n.footnoteCounts.get(o);p===void 0?(p=0,n.footnoteOrder.push(o),f=n.footnoteOrder.length):f=d+1,p+=1,n.footnoteCounts.set(o,p);const m={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+c,id:a+"fnref-"+c+(p>1?"-"+p:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(f)}]};n.patch(r,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return n.patch(r,h),n.applyData(r,h)}function Ux(n,r){const a={type:"element",tagName:"h"+r.depth,properties:{},children:n.all(r)};return n.patch(r,a),n.applyData(r,a)}function Bx(n,r){if(n.options.allowDangerousHtml){const a={type:"raw",value:r.value};return n.patch(r,a),n.applyData(r,a)}}function gg(n,r){const a=r.referenceType;let o="]";if(a==="collapsed"?o+="[]":a==="full"&&(o+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+o}];const c=n.all(r),d=c[0];d&&d.type==="text"?d.value="["+d.value:c.unshift({type:"text",value:"["});const f=c[c.length-1];return f&&f.type==="text"?f.value+=o:c.push({type:"text",value:o}),c}function Hx(n,r){const a=String(r.identifier).toUpperCase(),o=n.definitionById.get(a);if(!o)return gg(n,r);const c={src:Ai(o.url||""),alt:r.alt};o.title!==null&&o.title!==void 0&&(c.title=o.title);const d={type:"element",tagName:"img",properties:c,children:[]};return n.patch(r,d),n.applyData(r,d)}function qx(n,r){const a={src:Ai(r.url)};r.alt!==null&&r.alt!==void 0&&(a.alt=r.alt),r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"img",properties:a,children:[]};return n.patch(r,o),n.applyData(r,o)}function Yx(n,r){const a={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};n.patch(r,a);const o={type:"element",tagName:"code",properties:{},children:[a]};return n.patch(r,o),n.applyData(r,o)}function Gx(n,r){const a=String(r.identifier).toUpperCase(),o=n.definitionById.get(a);if(!o)return gg(n,r);const c={href:Ai(o.url||"")};o.title!==null&&o.title!==void 0&&(c.title=o.title);const d={type:"element",tagName:"a",properties:c,children:n.all(r)};return n.patch(r,d),n.applyData(r,d)}function Vx(n,r){const a={href:Ai(r.url)};r.title!==null&&r.title!==void 0&&(a.title=r.title);const o={type:"element",tagName:"a",properties:a,children:n.all(r)};return n.patch(r,o),n.applyData(r,o)}function Xx(n,r,a){const o=n.all(r),c=a?Qx(a):yg(r),d={},f=[];if(typeof r.checked=="boolean"){const b=o[0];let y;b&&b.type==="element"&&b.tagName==="p"?y=b:(y={type:"element",tagName:"p",properties:{},children:[]},o.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),d.className=["task-list-item"]}let p=-1;for(;++p1}function Zx(n,r){const a={},o=n.all(r);let c=-1;for(typeof r.start=="number"&&r.start!==1&&(a.start=r.start);++c0){const f={type:"element",tagName:"tbody",properties:{},children:n.wrap(a,!0)},p=kc(r.children[1]),m=Jm(r.children[r.children.length-1]);p&&m&&(f.position={start:p,end:m}),c.push(f)}const d={type:"element",tagName:"table",properties:{},children:n.wrap(c,!0)};return n.patch(r,d),n.applyData(r,d)}function $x(n,r,a){const o=a?a.children:void 0,d=(o?o.indexOf(r):1)===0?"th":"td",f=a&&a.type==="table"?a.align:void 0,p=f?f.length:r.children.length;let m=-1;const h=[];for(;++m0,!0),o[0]),c=o.index+o[0].length,o=a.exec(r);return d.push(ym(r.slice(c),c>0,!1)),d.join("")}function ym(n,r,a){let o=0,c=n.length;if(r){let d=n.codePointAt(o);for(;d===mm||d===gm;)o++,d=n.codePointAt(o)}if(a){let d=n.codePointAt(c-1);for(;d===mm||d===gm;)c--,d=n.codePointAt(c-1)}return c>o?n.slice(o,c):""}function ek(n,r){const a={type:"text",value:Px(String(r.value))};return n.patch(r,a),n.applyData(r,a)}function tk(n,r){const a={type:"element",tagName:"hr",properties:{},children:[]};return n.patch(r,a),n.applyData(r,a)}const nk={blockquote:Mx,break:Dx,code:Rx,delete:jx,emphasis:Nx,footnoteReference:Lx,heading:Ux,html:Bx,imageReference:Hx,image:qx,inlineCode:Yx,linkReference:Gx,link:Vx,listItem:Xx,list:Zx,paragraph:Kx,root:Fx,strong:Ix,table:Jx,tableCell:Wx,tableRow:$x,text:ek,thematicBreak:tk,toml:to,yaml:to,definition:to,footnoteDefinition:to};function to(){}const bg=-1,yo=0,Ta=1,so=2,zc=3,Oc=4,_c=5,Mc=6,vg=7,xg=8,lk=typeof self=="object"?self:globalThis,bm=(n,r)=>{switch(n){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+n)}return new lk[n](r)},ik=(n,r)=>{const a=(c,d)=>(n.set(d,c),c),o=c=>{if(n.has(c))return n.get(c);const[d,f]=r[c];switch(d){case yo:case bg:return a(f,c);case Ta:{const p=a([],c);for(const m of f)p.push(o(m));return p}case so:{const p=a({},c);for(const[m,h]of f)p[o(m)]=o(h);return p}case zc:return a(new Date(f),c);case Oc:{const{source:p,flags:m}=f;return a(new RegExp(p,m),c)}case _c:{const p=a(new Map,c);for(const[m,h]of f)p.set(o(m),o(h));return p}case Mc:{const p=a(new Set,c);for(const m of f)p.add(o(m));return p}case vg:{const{name:p,message:m}=f;return a(bm(p,m),c)}case xg:return a(BigInt(f),c);case"BigInt":return a(Object(BigInt(f)),c);case"ArrayBuffer":return a(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:p}=new Uint8Array(f);return a(new DataView(p),f)}}return a(bm(d,f),c)};return o},vm=n=>ik(new Map,n)(0),xi="",{toString:ak}={},{keys:rk}=Object,Ca=n=>{const r=typeof n;if(r!=="object"||!n)return[yo,r];const a=ak.call(n).slice(8,-1);switch(a){case"Array":return[Ta,xi];case"Object":return[so,xi];case"Date":return[zc,xi];case"RegExp":return[Oc,xi];case"Map":return[_c,xi];case"Set":return[Mc,xi];case"DataView":return[Ta,a]}return a.includes("Array")?[Ta,a]:a.includes("Error")?[vg,a]:[so,a]},no=([n,r])=>n===yo&&(r==="function"||r==="symbol"),ok=(n,r,a,o)=>{const c=(f,p)=>{const m=o.push(f)-1;return a.set(p,m),m},d=f=>{if(a.has(f))return a.get(f);let[p,m]=Ca(f);switch(p){case yo:{let b=f;switch(m){case"bigint":p=xg,b=f.toString();break;case"function":case"symbol":if(n)throw new TypeError("unable to serialize "+m);b=null;break;case"undefined":return c([bg],f)}return c([p,b],f)}case Ta:{if(m){let k=f;return m==="DataView"?k=new Uint8Array(f.buffer):m==="ArrayBuffer"&&(k=new Uint8Array(f)),c([m,[...k]],f)}const b=[],y=c([p,b],f);for(const k of f)b.push(d(k));return y}case so:{if(m)switch(m){case"BigInt":return c([m,f.toString()],f);case"Boolean":case"Number":case"String":return c([m,f.valueOf()],f)}if(r&&"toJSON"in f)return d(f.toJSON());const b=[],y=c([p,b],f);for(const k of rk(f))(n||!no(Ca(f[k])))&&b.push([d(k),d(f[k])]);return y}case zc:return c([p,f.toISOString()],f);case Oc:{const{source:b,flags:y}=f;return c([p,{source:b,flags:y}],f)}case _c:{const b=[],y=c([p,b],f);for(const[k,x]of f)(n||!(no(Ca(k))||no(Ca(x))))&&b.push([d(k),d(x)]);return y}case Mc:{const b=[],y=c([p,b],f);for(const k of f)(n||!no(Ca(k)))&&b.push(d(k));return y}}const{message:h}=f;return c([p,{name:m,message:h}],f)};return d},xm=(n,{json:r,lossy:a}={})=>{const o=[];return ok(!(r||a),!!r,new Map,o)(n),o},co=typeof structuredClone=="function"?(n,r)=>r&&("json"in r||"lossy"in r)?vm(xm(n,r)):structuredClone(n):(n,r)=>vm(xm(n,r));function uk(n,r){const a=[{type:"text",value:"↩"}];return r>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),a}function sk(n,r){return"Back to reference "+(n+1)+(r>1?"-"+r:"")}function ck(n){const r=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",a=n.options.footnoteBackContent||uk,o=n.options.footnoteBackLabel||sk,c=n.options.footnoteLabel||"Footnotes",d=n.options.footnoteLabelTagName||"h2",f=n.options.footnoteLabelProperties||{className:["sr-only"]},p=[];let m=-1;for(;++m0&&T.push({type:"text",value:" "});let F=typeof a=="string"?a:a(m,x);typeof F=="string"&&(F={type:"text",value:F}),T.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+k+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof o=="string"?o:o(m,x),className:["data-footnote-backref"]},children:Array.isArray(F)?F:[F]})}const Z=b[b.length-1];if(Z&&Z.type==="element"&&Z.tagName==="p"){const F=Z.children[Z.children.length-1];F&&F.type==="text"?F.value+=" ":Z.children.push({type:"text",value:" "}),Z.children.push(...T)}else b.push(...T);const D={type:"element",tagName:"li",properties:{id:r+"fn-"+k},children:n.wrap(b,!0)};n.patch(h,D),p.push(D)}if(p.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:d,properties:{...co(f),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:` +`});const h={type:"element",tagName:"li",properties:d,children:f};return n.patch(r,h),n.applyData(r,h)}function Qx(n){let r=!1;if(n.type==="list"){r=n.spread||!1;const a=n.children;let o=-1;for(;!r&&++o1}function Zx(n,r){const a={},o=n.all(r);let c=-1;for(typeof r.start=="number"&&r.start!==1&&(a.start=r.start);++c0){const f={type:"element",tagName:"tbody",properties:{},children:n.wrap(a,!0)},p=kc(r.children[1]),m=Jm(r.children[r.children.length-1]);p&&m&&(f.position={start:p,end:m}),c.push(f)}const d={type:"element",tagName:"table",properties:{},children:n.wrap(c,!0)};return n.patch(r,d),n.applyData(r,d)}function $x(n,r,a){const o=a?a.children:void 0,d=(o?o.indexOf(r):1)===0?"th":"td",f=a&&a.type==="table"?a.align:void 0,p=f?f.length:r.children.length;let m=-1;const h=[];for(;++m0,!0),o[0]),c=o.index+o[0].length,o=a.exec(r);return d.push(ym(r.slice(c),c>0,!1)),d.join("")}function ym(n,r,a){let o=0,c=n.length;if(r){let d=n.codePointAt(o);for(;d===mm||d===gm;)o++,d=n.codePointAt(o)}if(a){let d=n.codePointAt(c-1);for(;d===mm||d===gm;)c--,d=n.codePointAt(c-1)}return c>o?n.slice(o,c):""}function ek(n,r){const a={type:"text",value:Px(String(r.value))};return n.patch(r,a),n.applyData(r,a)}function tk(n,r){const a={type:"element",tagName:"hr",properties:{},children:[]};return n.patch(r,a),n.applyData(r,a)}const nk={blockquote:Mx,break:Dx,code:Rx,delete:Nx,emphasis:jx,footnoteReference:Lx,heading:Ux,html:Bx,imageReference:Hx,image:qx,inlineCode:Yx,linkReference:Gx,link:Vx,listItem:Xx,list:Zx,paragraph:Kx,root:Fx,strong:Ix,table:Jx,tableCell:Wx,tableRow:$x,text:ek,thematicBreak:tk,toml:to,yaml:to,definition:to,footnoteDefinition:to};function to(){}const bg=-1,yo=0,Ta=1,so=2,zc=3,Oc=4,_c=5,Mc=6,vg=7,xg=8,lk=typeof self=="object"?self:globalThis,bm=(n,r)=>{switch(n){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+n)}return new lk[n](r)},ik=(n,r)=>{const a=(c,d)=>(n.set(d,c),c),o=c=>{if(n.has(c))return n.get(c);const[d,f]=r[c];switch(d){case yo:case bg:return a(f,c);case Ta:{const p=a([],c);for(const m of f)p.push(o(m));return p}case so:{const p=a({},c);for(const[m,h]of f)p[o(m)]=o(h);return p}case zc:return a(new Date(f),c);case Oc:{const{source:p,flags:m}=f;return a(new RegExp(p,m),c)}case _c:{const p=a(new Map,c);for(const[m,h]of f)p.set(o(m),o(h));return p}case Mc:{const p=a(new Set,c);for(const m of f)p.add(o(m));return p}case vg:{const{name:p,message:m}=f;return a(bm(p,m),c)}case xg:return a(BigInt(f),c);case"BigInt":return a(Object(BigInt(f)),c);case"ArrayBuffer":return a(new Uint8Array(f).buffer,f);case"DataView":{const{buffer:p}=new Uint8Array(f);return a(new DataView(p),f)}}return a(bm(d,f),c)};return o},vm=n=>ik(new Map,n)(0),xi="",{toString:ak}={},{keys:rk}=Object,Ca=n=>{const r=typeof n;if(r!=="object"||!n)return[yo,r];const a=ak.call(n).slice(8,-1);switch(a){case"Array":return[Ta,xi];case"Object":return[so,xi];case"Date":return[zc,xi];case"RegExp":return[Oc,xi];case"Map":return[_c,xi];case"Set":return[Mc,xi];case"DataView":return[Ta,a]}return a.includes("Array")?[Ta,a]:a.includes("Error")?[vg,a]:[so,a]},no=([n,r])=>n===yo&&(r==="function"||r==="symbol"),ok=(n,r,a,o)=>{const c=(f,p)=>{const m=o.push(f)-1;return a.set(p,m),m},d=f=>{if(a.has(f))return a.get(f);let[p,m]=Ca(f);switch(p){case yo:{let b=f;switch(m){case"bigint":p=xg,b=f.toString();break;case"function":case"symbol":if(n)throw new TypeError("unable to serialize "+m);b=null;break;case"undefined":return c([bg],f)}return c([p,b],f)}case Ta:{if(m){let k=f;return m==="DataView"?k=new Uint8Array(f.buffer):m==="ArrayBuffer"&&(k=new Uint8Array(f)),c([m,[...k]],f)}const b=[],y=c([p,b],f);for(const k of f)b.push(d(k));return y}case so:{if(m)switch(m){case"BigInt":return c([m,f.toString()],f);case"Boolean":case"Number":case"String":return c([m,f.valueOf()],f)}if(r&&"toJSON"in f)return d(f.toJSON());const b=[],y=c([p,b],f);for(const k of rk(f))(n||!no(Ca(f[k])))&&b.push([d(k),d(f[k])]);return y}case zc:return c([p,f.toISOString()],f);case Oc:{const{source:b,flags:y}=f;return c([p,{source:b,flags:y}],f)}case _c:{const b=[],y=c([p,b],f);for(const[k,x]of f)(n||!(no(Ca(k))||no(Ca(x))))&&b.push([d(k),d(x)]);return y}case Mc:{const b=[],y=c([p,b],f);for(const k of f)(n||!no(Ca(k)))&&b.push(d(k));return y}}const{message:h}=f;return c([p,{name:m,message:h}],f)};return d},xm=(n,{json:r,lossy:a}={})=>{const o=[];return ok(!(r||a),!!r,new Map,o)(n),o},co=typeof structuredClone=="function"?(n,r)=>r&&("json"in r||"lossy"in r)?vm(xm(n,r)):structuredClone(n):(n,r)=>vm(xm(n,r));function uk(n,r){const a=[{type:"text",value:"↩"}];return r>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),a}function sk(n,r){return"Back to reference "+(n+1)+(r>1?"-"+r:"")}function ck(n){const r=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",a=n.options.footnoteBackContent||uk,o=n.options.footnoteBackLabel||sk,c=n.options.footnoteLabel||"Footnotes",d=n.options.footnoteLabelTagName||"h2",f=n.options.footnoteLabelProperties||{className:["sr-only"]},p=[];let m=-1;for(;++m0&&T.push({type:"text",value:" "});let F=typeof a=="string"?a:a(m,x);typeof F=="string"&&(F={type:"text",value:F}),T.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+k+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof o=="string"?o:o(m,x),className:["data-footnote-backref"]},children:Array.isArray(F)?F:[F]})}const Z=b[b.length-1];if(Z&&Z.type==="element"&&Z.tagName==="p"){const F=Z.children[Z.children.length-1];F&&F.type==="text"?F.value+=" ":Z.children.push({type:"text",value:" "}),Z.children.push(...T)}else b.push(...T);const D={type:"element",tagName:"li",properties:{id:r+"fn-"+k},children:n.wrap(b,!0)};n.patch(h,D),p.push(D)}if(p.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:d,properties:{...co(f),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:n.wrap(p,!0)},{type:"text",value:` -`}]}}const bo=(function(n){if(n==null)return pk;if(typeof n=="function")return vo(n);if(typeof n=="object")return Array.isArray(n)?fk(n):dk(n);if(typeof n=="string")return hk(n);throw new Error("Expected function, string, or object as test")});function fk(n){const r=[];let a=-1;for(;++a":""))+")"})}return k;function k(){let x=kg,T,U,Z;if((!r||d(m,h,b[b.length-1]||void 0))&&(x=bk(a(m,b)),x[0]===fc))return x;if("children"in m&&m.children){const D=m;if(D.children&&x[0]!==yk)for(U=(o?D.children.length:-1)+f,Z=b.concat(D);U>-1&&U":""))+")"})}return k;function k(){let x=kg,T,U,Z;if((!r||d(m,h,b[b.length-1]||void 0))&&(x=bk(a(m,b)),x[0]===fc))return x;if("children"in m&&m.children){const D=m;if(D.children&&x[0]!==yk)for(U=(o?D.children.length:-1)+f,Z=b.concat(D);U>-1&&U0&&a.push({type:"text",value:` `}),a}function km(n){let r=0,a=n.charCodeAt(r);for(;a===9||a===32;)r++,a=n.charCodeAt(r);return n.slice(r)}function Sm(n,r){const a=xk(n,r),o=a.one(n,void 0),c=ck(a),d=Array.isArray(o)?{type:"root",children:o}:o||{type:"root",children:[]};return c&&d.children.push({type:"text",value:` -`},c),d}function Ek(n,r){return n&&"run"in n?async function(a,o){const c=Sm(a,{file:o,...r});await n.run(c,o)}:function(a,o){return Sm(a,{file:o,...n||r})}}function wm(n){if(n)throw n}var Zs,Cm;function Ak(){if(Cm)return Zs;Cm=1;var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,c=function(h){return typeof Array.isArray=="function"?Array.isArray(h):r.call(h)==="[object Array]"},d=function(h){if(!h||r.call(h)!=="[object Object]")return!1;var b=n.call(h,"constructor"),y=h.constructor&&h.constructor.prototype&&n.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!b&&!y)return!1;var k;for(k in h);return typeof k>"u"||n.call(h,k)},f=function(h,b){a&&b.name==="__proto__"?a(h,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):h[b.name]=b.newValue},p=function(h,b){if(b==="__proto__")if(n.call(h,b)){if(o)return o(h,b).value}else return;return h[b]};return Zs=function m(){var h,b,y,k,x,T,U=arguments[0],Z=1,D=arguments.length,F=!1;for(typeof U=="boolean"&&(F=U,U=arguments[1]||{},Z=2),(U==null||typeof U!="object"&&typeof U!="function")&&(U={});Zf.length;let m;p&&f.push(c);try{m=n.apply(this,f)}catch(h){const b=h;if(p&&a)throw b;return c(b)}p||(m&&m.then&&typeof m.then=="function"?m.then(d,c):m instanceof Error?c(m):d(m))}function c(f,...p){a||(a=!0,r(f,...p))}function d(f){c(null,f)}}const dn={basename:_k,dirname:Mk,extname:Dk,join:Rk,sep:"/"};function _k(n,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Na(n);let a=0,o=-1,c=n.length,d;if(r===void 0||r.length===0||r.length>n.length){for(;c--;)if(n.codePointAt(c)===47){if(d){a=c+1;break}}else o<0&&(d=!0,o=c+1);return o<0?"":n.slice(a,o)}if(r===n)return"";let f=-1,p=r.length-1;for(;c--;)if(n.codePointAt(c)===47){if(d){a=c+1;break}}else f<0&&(d=!0,f=c+1),p>-1&&(n.codePointAt(c)===r.codePointAt(p--)?p<0&&(o=c):(p=-1,o=f));return a===o?o=f:o<0&&(o=n.length),n.slice(a,o)}function Mk(n){if(Na(n),n.length===0)return".";let r=-1,a=n.length,o;for(;--a;)if(n.codePointAt(a)===47){if(o){r=a;break}}else o||(o=!0);return r<0?n.codePointAt(0)===47?"/":".":r===1&&n.codePointAt(0)===47?"//":n.slice(0,r)}function Dk(n){Na(n);let r=n.length,a=-1,o=0,c=-1,d=0,f;for(;r--;){const p=n.codePointAt(r);if(p===47){if(f){o=r+1;break}continue}a<0&&(f=!0,a=r+1),p===46?c<0?c=r:d!==1&&(d=1):c>-1&&(d=-1)}return c<0||a<0||d===0||d===1&&c===a-1&&c===o+1?"":n.slice(c,a)}function Rk(...n){let r=-1,a;for(;++r0&&n.codePointAt(n.length-1)===47&&(a+="/"),r?"/"+a:a}function Nk(n,r){let a="",o=0,c=-1,d=0,f=-1,p,m;for(;++f<=n.length;){if(f2){if(m=a.lastIndexOf("/"),m!==a.length-1){m<0?(a="",o=0):(a=a.slice(0,m),o=a.length-1-a.lastIndexOf("/")),c=f,d=0;continue}}else if(a.length>0){a="",o=0,c=f,d=0;continue}}r&&(a=a.length>0?a+"/..":"..",o=2)}else a.length>0?a+="/"+n.slice(c+1,f):a=n.slice(c+1,f),o=f-c-1;c=f,d=0}else p===46&&d>-1?d++:d=-1}return a}function Na(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const Lk={cwd:Uk};function Uk(){return"/"}function pc(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function Bk(n){if(typeof n=="string")n=new URL(n);else if(!pc(n)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(n.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return Hk(n)}function Hk(n){if(n.hostname!==""){const o=new TypeError('File URL host must be "localhost" or empty on darwin');throw o.code="ERR_INVALID_FILE_URL_HOST",o}const r=n.pathname;let a=-1;for(;++a0){let[x,...T]=b;const U=o[k][1];hc(U)&&hc(x)&&(x=Ks(!0,U,x)),o[k]=[h,x,...T]}}}}const Vk=new Rc().freeze();function $s(n,r){if(typeof r!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function Ws(n,r){if(typeof r!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function Ps(n,r){if(r)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Am(n){if(!hc(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function Tm(n,r,a){if(!a)throw new Error("`"+n+"` finished async. Use `"+r+"` instead")}function lo(n){return Xk(n)?n:new wg(n)}function Xk(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function Qk(n){return typeof n=="string"||Zk(n)}function Zk(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const Kk="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",zm=[],Om={allowDangerousHtml:!0},Fk=/^(https?|ircs?|mailto|xmpp)$/i,Ik=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Jk(n){const r=$k(n),a=Wk(n);return Pk(r.runSync(r.parse(a),a),n)}function $k(n){const r=n.rehypePlugins||zm,a=n.remarkPlugins||zm,o=n.remarkRehypeOptions?{...n.remarkRehypeOptions,...Om}:Om;return Vk().use(_x).use(a).use(Ek,o).use(r)}function Wk(n){const r=n.children||"",a=new wg;return typeof r=="string"&&(a.value=r),a}function Pk(n,r){const a=r.allowedElements,o=r.allowElement,c=r.components,d=r.disallowedElements,f=r.skipHtml,p=r.unwrapDisallowed,m=r.urlTransform||eS;for(const b of Ik)Object.hasOwn(r,b.from)&&(""+b.from+(b.to?"use `"+b.to+"` instead":"remove it")+Kk+b.id,void 0);return r.className&&(n={type:"element",tagName:"div",properties:{className:r.className},children:n.type==="root"?n.children:[n]}),Dc(n,h),h0(n,{Fragment:H.Fragment,components:c,ignoreInvalidStyle:!0,jsx:H.jsx,jsxs:H.jsxs,passKeys:!0,passNode:!0});function h(b,y,k){if(b.type==="raw"&&k&&typeof y=="number")return f?k.children.splice(y,1):k.children[y]={type:"text",value:b.value},y;if(b.type==="element"){let x;for(x in Vs)if(Object.hasOwn(Vs,x)&&Object.hasOwn(b.properties,x)){const T=b.properties[x],U=Vs[x];(U===null||U.includes(b.tagName))&&(b.properties[x]=m(String(T||""),x,b))}}if(b.type==="element"){let x=a?!a.includes(b.tagName):d?d.includes(b.tagName):!1;if(!x&&o&&typeof y=="number"&&(x=!o(b,y,k)),x&&k&&typeof y=="number")return p&&b.children?k.children.splice(y,1,...b.children):k.children.splice(y,1),y}}}function eS(n){const r=n.indexOf(":"),a=n.indexOf("?"),o=n.indexOf("#"),c=n.indexOf("/");return r===-1||c!==-1&&r>c||a!==-1&&r>a||o!==-1&&r>o||Fk.test(n.slice(0,r))?n:""}function _m(n,r){const a=String(n);if(typeof r!="string")throw new TypeError("Expected character");let o=0,c=a.indexOf(r);for(;c!==-1;)o++,c=a.indexOf(r,c+r.length);return o}function tS(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function nS(n,r,a){const c=bo((a||{}).ignore||[]),d=lS(r);let f=-1;for(;++f0?{type:"text",value:L}:void 0),L===!1?k.lastIndex=oe+1:(T!==oe&&F.push({type:"text",value:h.value.slice(T,oe)}),Array.isArray(L)?F.push(...L):L&&F.push(L),T=oe+Q[0].length,D=!0),!k.global)break;Q=k.exec(h.value)}return D?(T?\]}]+$/.exec(n);if(!r)return[n,void 0];n=n.slice(0,r.index);let a=r[0],o=a.indexOf(")");const c=_m(n,"(");let d=_m(n,")");for(;o!==-1&&c>d;)n+=a.slice(0,o+1),a=a.slice(o+1),o=a.indexOf(")"),d++;return[n,a]}function Cg(n,r){const a=n.input.charCodeAt(n.index-1);return(n.index===0||Ol(a)||mo(a))&&(!r||a!==47)}Eg.peek=AS;function bS(){this.buffer()}function vS(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function xS(){this.buffer()}function kS(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function SS(n){const r=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=on(this.sliceSerialize(n)).toLowerCase(),a.label=r}function wS(n){this.exit(n)}function CS(n){const r=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=on(this.sliceSerialize(n)).toLowerCase(),a.label=r}function ES(n){this.exit(n)}function AS(){return"["}function Eg(n,r,a,o){const c=a.createTracker(o);let d=c.move("[^");const f=a.enter("footnoteReference"),p=a.enter("reference");return d+=c.move(a.safe(a.associationId(n),{after:"]",before:d})),p(),f(),d+=c.move("]"),d}function TS(){return{enter:{gfmFootnoteCallString:bS,gfmFootnoteCall:vS,gfmFootnoteDefinitionLabelString:xS,gfmFootnoteDefinition:kS},exit:{gfmFootnoteCallString:SS,gfmFootnoteCall:wS,gfmFootnoteDefinitionLabelString:CS,gfmFootnoteDefinition:ES}}}function zS(n){let r=!1;return n&&n.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:a,footnoteReference:Eg},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(o,c,d,f){const p=d.createTracker(f);let m=p.move("[^");const h=d.enter("footnoteDefinition"),b=d.enter("label");return m+=p.move(d.safe(d.associationId(o),{before:m,after:"]"})),b(),m+=p.move("]:"),o.children&&o.children.length>0&&(p.shift(4),m+=p.move((r?` -`:" ")+d.indentLines(d.containerFlow(o,p.current()),r?Ag:OS))),h(),m}}function OS(n,r,a){return r===0?n:Ag(n,r,a)}function Ag(n,r,a){return(a?"":" ")+n}const _S=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Tg.peek=NS;function MS(){return{canContainEols:["delete"],enter:{strikethrough:RS},exit:{strikethrough:jS}}}function DS(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:_S}],handlers:{delete:Tg}}}function RS(n){this.enter({type:"delete",children:[]},n)}function jS(n){this.exit(n)}function Tg(n,r,a,o){const c=a.createTracker(o),d=a.enter("strikethrough");let f=c.move("~~");return f+=a.containerPhrasing(n,{...c.current(),before:f,after:"~"}),f+=c.move("~~"),d(),f}function NS(){return"~"}function LS(n){return n.length}function US(n,r){const a=r||{},o=(a.align||[]).concat(),c=a.stringLength||LS,d=[],f=[],p=[],m=[];let h=0,b=-1;for(;++bh&&(h=n[b].length);++Dm[D])&&(m[D]=Q)}U.push(F)}f[b]=U,p[b]=Z}let y=-1;if(typeof o=="object"&&"length"in o)for(;++ym[y]&&(m[y]=F),x[y]=F),k[y]=Q}f.splice(1,0,k),p.splice(1,0,x),b=-1;const T=[];for(;++b"u"||n.call(h,k)},f=function(h,b){a&&b.name==="__proto__"?a(h,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):h[b.name]=b.newValue},p=function(h,b){if(b==="__proto__")if(n.call(h,b)){if(o)return o(h,b).value}else return;return h[b]};return Zs=function m(){var h,b,y,k,x,T,U=arguments[0],Z=1,D=arguments.length,F=!1;for(typeof U=="boolean"&&(F=U,U=arguments[1]||{},Z=2),(U==null||typeof U!="object"&&typeof U!="function")&&(U={});Zf.length;let m;p&&f.push(c);try{m=n.apply(this,f)}catch(h){const b=h;if(p&&a)throw b;return c(b)}p||(m&&m.then&&typeof m.then=="function"?m.then(d,c):m instanceof Error?c(m):d(m))}function c(f,...p){a||(a=!0,r(f,...p))}function d(f){c(null,f)}}const dn={basename:_k,dirname:Mk,extname:Dk,join:Rk,sep:"/"};function _k(n,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');ja(n);let a=0,o=-1,c=n.length,d;if(r===void 0||r.length===0||r.length>n.length){for(;c--;)if(n.codePointAt(c)===47){if(d){a=c+1;break}}else o<0&&(d=!0,o=c+1);return o<0?"":n.slice(a,o)}if(r===n)return"";let f=-1,p=r.length-1;for(;c--;)if(n.codePointAt(c)===47){if(d){a=c+1;break}}else f<0&&(d=!0,f=c+1),p>-1&&(n.codePointAt(c)===r.codePointAt(p--)?p<0&&(o=c):(p=-1,o=f));return a===o?o=f:o<0&&(o=n.length),n.slice(a,o)}function Mk(n){if(ja(n),n.length===0)return".";let r=-1,a=n.length,o;for(;--a;)if(n.codePointAt(a)===47){if(o){r=a;break}}else o||(o=!0);return r<0?n.codePointAt(0)===47?"/":".":r===1&&n.codePointAt(0)===47?"//":n.slice(0,r)}function Dk(n){ja(n);let r=n.length,a=-1,o=0,c=-1,d=0,f;for(;r--;){const p=n.codePointAt(r);if(p===47){if(f){o=r+1;break}continue}a<0&&(f=!0,a=r+1),p===46?c<0?c=r:d!==1&&(d=1):c>-1&&(d=-1)}return c<0||a<0||d===0||d===1&&c===a-1&&c===o+1?"":n.slice(c,a)}function Rk(...n){let r=-1,a;for(;++r0&&n.codePointAt(n.length-1)===47&&(a+="/"),r?"/"+a:a}function jk(n,r){let a="",o=0,c=-1,d=0,f=-1,p,m;for(;++f<=n.length;){if(f2){if(m=a.lastIndexOf("/"),m!==a.length-1){m<0?(a="",o=0):(a=a.slice(0,m),o=a.length-1-a.lastIndexOf("/")),c=f,d=0;continue}}else if(a.length>0){a="",o=0,c=f,d=0;continue}}r&&(a=a.length>0?a+"/..":"..",o=2)}else a.length>0?a+="/"+n.slice(c+1,f):a=n.slice(c+1,f),o=f-c-1;c=f,d=0}else p===46&&d>-1?d++:d=-1}return a}function ja(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const Lk={cwd:Uk};function Uk(){return"/"}function pc(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function Bk(n){if(typeof n=="string")n=new URL(n);else if(!pc(n)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(n.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return Hk(n)}function Hk(n){if(n.hostname!==""){const o=new TypeError('File URL host must be "localhost" or empty on darwin');throw o.code="ERR_INVALID_FILE_URL_HOST",o}const r=n.pathname;let a=-1;for(;++a0){let[x,...T]=b;const U=o[k][1];hc(U)&&hc(x)&&(x=Ks(!0,U,x)),o[k]=[h,x,...T]}}}}const Vk=new Rc().freeze();function $s(n,r){if(typeof r!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function Ws(n,r){if(typeof r!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function Ps(n,r){if(r)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Em(n){if(!hc(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function Tm(n,r,a){if(!a)throw new Error("`"+n+"` finished async. Use `"+r+"` instead")}function lo(n){return Xk(n)?n:new wg(n)}function Xk(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function Qk(n){return typeof n=="string"||Zk(n)}function Zk(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const Kk="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",zm=[],Om={allowDangerousHtml:!0},Fk=/^(https?|ircs?|mailto|xmpp)$/i,Ik=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Jk(n){const r=$k(n),a=Wk(n);return Pk(r.runSync(r.parse(a),a),n)}function $k(n){const r=n.rehypePlugins||zm,a=n.remarkPlugins||zm,o=n.remarkRehypeOptions?{...n.remarkRehypeOptions,...Om}:Om;return Vk().use(_x).use(a).use(Ak,o).use(r)}function Wk(n){const r=n.children||"",a=new wg;return typeof r=="string"&&(a.value=r),a}function Pk(n,r){const a=r.allowedElements,o=r.allowElement,c=r.components,d=r.disallowedElements,f=r.skipHtml,p=r.unwrapDisallowed,m=r.urlTransform||eS;for(const b of Ik)Object.hasOwn(r,b.from)&&(""+b.from+(b.to?"use `"+b.to+"` instead":"remove it")+Kk+b.id,void 0);return r.className&&(n={type:"element",tagName:"div",properties:{className:r.className},children:n.type==="root"?n.children:[n]}),Dc(n,h),hv(n,{Fragment:H.Fragment,components:c,ignoreInvalidStyle:!0,jsx:H.jsx,jsxs:H.jsxs,passKeys:!0,passNode:!0});function h(b,y,k){if(b.type==="raw"&&k&&typeof y=="number")return f?k.children.splice(y,1):k.children[y]={type:"text",value:b.value},y;if(b.type==="element"){let x;for(x in Vs)if(Object.hasOwn(Vs,x)&&Object.hasOwn(b.properties,x)){const T=b.properties[x],U=Vs[x];(U===null||U.includes(b.tagName))&&(b.properties[x]=m(String(T||""),x,b))}}if(b.type==="element"){let x=a?!a.includes(b.tagName):d?d.includes(b.tagName):!1;if(!x&&o&&typeof y=="number"&&(x=!o(b,y,k)),x&&k&&typeof y=="number")return p&&b.children?k.children.splice(y,1,...b.children):k.children.splice(y,1),y}}}function eS(n){const r=n.indexOf(":"),a=n.indexOf("?"),o=n.indexOf("#"),c=n.indexOf("/");return r===-1||c!==-1&&r>c||a!==-1&&r>a||o!==-1&&r>o||Fk.test(n.slice(0,r))?n:""}function _m(n,r){const a=String(n);if(typeof r!="string")throw new TypeError("Expected character");let o=0,c=a.indexOf(r);for(;c!==-1;)o++,c=a.indexOf(r,c+r.length);return o}function tS(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function nS(n,r,a){const c=bo((a||{}).ignore||[]),d=lS(r);let f=-1;for(;++f0?{type:"text",value:L}:void 0),L===!1?k.lastIndex=oe+1:(T!==oe&&F.push({type:"text",value:h.value.slice(T,oe)}),Array.isArray(L)?F.push(...L):L&&F.push(L),T=oe+Q[0].length,D=!0),!k.global)break;Q=k.exec(h.value)}return D?(T?\]}]+$/.exec(n);if(!r)return[n,void 0];n=n.slice(0,r.index);let a=r[0],o=a.indexOf(")");const c=_m(n,"(");let d=_m(n,")");for(;o!==-1&&c>d;)n+=a.slice(0,o+1),a=a.slice(o+1),o=a.indexOf(")"),d++;return[n,a]}function Cg(n,r){const a=n.input.charCodeAt(n.index-1);return(n.index===0||Ol(a)||mo(a))&&(!r||a!==47)}Ag.peek=ES;function bS(){this.buffer()}function vS(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function xS(){this.buffer()}function kS(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function SS(n){const r=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=on(this.sliceSerialize(n)).toLowerCase(),a.label=r}function wS(n){this.exit(n)}function CS(n){const r=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=on(this.sliceSerialize(n)).toLowerCase(),a.label=r}function AS(n){this.exit(n)}function ES(){return"["}function Ag(n,r,a,o){const c=a.createTracker(o);let d=c.move("[^");const f=a.enter("footnoteReference"),p=a.enter("reference");return d+=c.move(a.safe(a.associationId(n),{after:"]",before:d})),p(),f(),d+=c.move("]"),d}function TS(){return{enter:{gfmFootnoteCallString:bS,gfmFootnoteCall:vS,gfmFootnoteDefinitionLabelString:xS,gfmFootnoteDefinition:kS},exit:{gfmFootnoteCallString:SS,gfmFootnoteCall:wS,gfmFootnoteDefinitionLabelString:CS,gfmFootnoteDefinition:AS}}}function zS(n){let r=!1;return n&&n.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:a,footnoteReference:Ag},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(o,c,d,f){const p=d.createTracker(f);let m=p.move("[^");const h=d.enter("footnoteDefinition"),b=d.enter("label");return m+=p.move(d.safe(d.associationId(o),{before:m,after:"]"})),b(),m+=p.move("]:"),o.children&&o.children.length>0&&(p.shift(4),m+=p.move((r?` +`:" ")+d.indentLines(d.containerFlow(o,p.current()),r?Eg:OS))),h(),m}}function OS(n,r,a){return r===0?n:Eg(n,r,a)}function Eg(n,r,a){return(a?"":" ")+n}const _S=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Tg.peek=jS;function MS(){return{canContainEols:["delete"],enter:{strikethrough:RS},exit:{strikethrough:NS}}}function DS(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:_S}],handlers:{delete:Tg}}}function RS(n){this.enter({type:"delete",children:[]},n)}function NS(n){this.exit(n)}function Tg(n,r,a,o){const c=a.createTracker(o),d=a.enter("strikethrough");let f=c.move("~~");return f+=a.containerPhrasing(n,{...c.current(),before:f,after:"~"}),f+=c.move("~~"),d(),f}function jS(){return"~"}function LS(n){return n.length}function US(n,r){const a=r||{},o=(a.align||[]).concat(),c=a.stringLength||LS,d=[],f=[],p=[],m=[];let h=0,b=-1;for(;++bh&&(h=n[b].length);++Dm[D])&&(m[D]=Q)}U.push(F)}f[b]=U,p[b]=Z}let y=-1;if(typeof o=="object"&&"length"in o)for(;++ym[y]&&(m[y]=F),x[y]=F),k[y]=Q}f.splice(1,0,k),p.splice(1,0,x),b=-1;const T=[];for(;++b "),d.shift(2);const f=a.indentLines(a.containerFlow(n,d.current()),qS);return c(),f}function qS(n,r,a){return">"+(a?"":" ")+n}function YS(n,r){return Dm(n,r.inConstruct,!0)&&!Dm(n,r.notInConstruct,!1)}function Dm(n,r,a){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return a;let o=-1;for(;++of&&(f=d):d=1,c=o+r.length,o=a.indexOf(r,c);return f}function VS(n,r){return!!(r.options.fences===!1&&n.value&&!n.lang&&/[^ \r\n]/.test(n.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(n.value))}function XS(n){const r=n.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function QS(n,r,a,o){const c=XS(a),d=n.value||"",f=c==="`"?"GraveAccent":"Tilde";if(VS(n,a)){const y=a.enter("codeIndented"),k=a.indentLines(d,ZS);return y(),k}const p=a.createTracker(o),m=c.repeat(Math.max(GS(d,c)+1,3)),h=a.enter("codeFenced");let b=p.move(m);if(n.lang){const y=a.enter(`codeFencedLang${f}`);b+=p.move(a.safe(n.lang,{before:b,after:" ",encode:["`"],...p.current()})),y()}if(n.lang&&n.meta){const y=a.enter(`codeFencedMeta${f}`);b+=p.move(" "),b+=p.move(a.safe(n.meta,{before:b,after:` `,encode:["`"],...p.current()})),y()}return b+=p.move(` `),d&&(b+=p.move(d+` -`)),b+=p.move(m),h(),b}function ZS(n,r,a){return(a?"":" ")+n}function jc(n){const r=n.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function KS(n,r,a,o){const c=jc(a),d=c==='"'?"Quote":"Apostrophe",f=a.enter("definition");let p=a.enter("label");const m=a.createTracker(o);let h=m.move("[");return h+=m.move(a.safe(a.associationId(n),{before:h,after:"]",...m.current()})),h+=m.move("]: "),p(),!n.url||/[\0- \u007F]/.test(n.url)?(p=a.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(a.safe(n.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(p=a.enter("destinationRaw"),h+=m.move(a.safe(n.url,{before:h,after:n.title?" ":` -`,...m.current()}))),p(),n.title&&(p=a.enter(`title${d}`),h+=m.move(" "+c),h+=m.move(a.safe(n.title,{before:h,after:c,...m.current()})),h+=m.move(c),p()),f(),h}function FS(n){const r=n.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function Da(n){return"&#x"+n.toString(16).toUpperCase()+";"}function fo(n,r,a){const o=wi(n),c=wi(r);return o===void 0?c===void 0?a==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:o===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}zg.peek=IS;function zg(n,r,a,o){const c=FS(a),d=a.enter("emphasis"),f=a.createTracker(o),p=f.move(c);let m=f.move(a.containerPhrasing(n,{after:c,before:p,...f.current()}));const h=m.charCodeAt(0),b=fo(o.before.charCodeAt(o.before.length-1),h,c);b.inside&&(m=Da(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=fo(o.after.charCodeAt(0),y,c);k.inside&&(m=m.slice(0,-1)+Da(y));const x=f.move(c);return d(),a.attentionEncodeSurroundingInfo={after:k.outside,before:b.outside},p+m+x}function IS(n,r,a){return a.options.emphasis||"*"}function JS(n,r){let a=!1;return Dc(n,function(o){if("value"in o&&/\r?\n|\r/.test(o.value)||o.type==="break")return a=!0,fc}),!!((!n.depth||n.depth<3)&&Ec(n)&&(r.options.setext||a))}function $S(n,r,a,o){const c=Math.max(Math.min(6,n.depth||1),1),d=a.createTracker(o);if(JS(n,a)){const b=a.enter("headingSetext"),y=a.enter("phrasing"),k=a.containerPhrasing(n,{...d.current(),before:` +`)),b+=p.move(m),h(),b}function ZS(n,r,a){return(a?"":" ")+n}function Nc(n){const r=n.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function KS(n,r,a,o){const c=Nc(a),d=c==='"'?"Quote":"Apostrophe",f=a.enter("definition");let p=a.enter("label");const m=a.createTracker(o);let h=m.move("[");return h+=m.move(a.safe(a.associationId(n),{before:h,after:"]",...m.current()})),h+=m.move("]: "),p(),!n.url||/[\0- \u007F]/.test(n.url)?(p=a.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(a.safe(n.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(p=a.enter("destinationRaw"),h+=m.move(a.safe(n.url,{before:h,after:n.title?" ":` +`,...m.current()}))),p(),n.title&&(p=a.enter(`title${d}`),h+=m.move(" "+c),h+=m.move(a.safe(n.title,{before:h,after:c,...m.current()})),h+=m.move(c),p()),f(),h}function FS(n){const r=n.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function Da(n){return"&#x"+n.toString(16).toUpperCase()+";"}function fo(n,r,a){const o=wi(n),c=wi(r);return o===void 0?c===void 0?a==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:o===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}zg.peek=IS;function zg(n,r,a,o){const c=FS(a),d=a.enter("emphasis"),f=a.createTracker(o),p=f.move(c);let m=f.move(a.containerPhrasing(n,{after:c,before:p,...f.current()}));const h=m.charCodeAt(0),b=fo(o.before.charCodeAt(o.before.length-1),h,c);b.inside&&(m=Da(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=fo(o.after.charCodeAt(0),y,c);k.inside&&(m=m.slice(0,-1)+Da(y));const x=f.move(c);return d(),a.attentionEncodeSurroundingInfo={after:k.outside,before:b.outside},p+m+x}function IS(n,r,a){return a.options.emphasis||"*"}function JS(n,r){let a=!1;return Dc(n,function(o){if("value"in o&&/\r?\n|\r/.test(o.value)||o.type==="break")return a=!0,fc}),!!((!n.depth||n.depth<3)&&Ac(n)&&(r.options.setext||a))}function $S(n,r,a,o){const c=Math.max(Math.min(6,n.depth||1),1),d=a.createTracker(o);if(JS(n,a)){const b=a.enter("headingSetext"),y=a.enter("phrasing"),k=a.containerPhrasing(n,{...d.current(),before:` `,after:` `});return y(),b(),k+` `+(c===1?"=":"-").repeat(k.length-(Math.max(k.lastIndexOf("\r"),k.lastIndexOf(` `))+1))}const f="#".repeat(c),p=a.enter("headingAtx"),m=a.enter("phrasing");d.move(f+" ");let h=a.containerPhrasing(n,{before:"# ",after:` -`,...d.current()});return/^[\t ]/.test(h)&&(h=Da(h.charCodeAt(0))+h.slice(1)),h=h?f+" "+h:f,a.options.closeAtx&&(h+=" "+f),m(),p(),h}Og.peek=WS;function Og(n){return n.value||""}function WS(){return"<"}_g.peek=PS;function _g(n,r,a,o){const c=jc(a),d=c==='"'?"Quote":"Apostrophe",f=a.enter("image");let p=a.enter("label");const m=a.createTracker(o);let h=m.move("![");return h+=m.move(a.safe(n.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),p(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(p=a.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(a.safe(n.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(p=a.enter("destinationRaw"),h+=m.move(a.safe(n.url,{before:h,after:n.title?" ":")",...m.current()}))),p(),n.title&&(p=a.enter(`title${d}`),h+=m.move(" "+c),h+=m.move(a.safe(n.title,{before:h,after:c,...m.current()})),h+=m.move(c),p()),h+=m.move(")"),f(),h}function PS(){return"!"}Mg.peek=e2;function Mg(n,r,a,o){const c=n.referenceType,d=a.enter("imageReference");let f=a.enter("label");const p=a.createTracker(o);let m=p.move("![");const h=a.safe(n.alt,{before:m,after:"]",...p.current()});m+=p.move(h+"]["),f();const b=a.stack;a.stack=[],f=a.enter("reference");const y=a.safe(a.associationId(n),{before:m,after:"]",...p.current()});return f(),a.stack=b,d(),c==="full"||!h||h!==y?m+=p.move(y+"]"):c==="shortcut"?m=m.slice(0,-1):m+=p.move("]"),m}function e2(){return"!"}Dg.peek=t2;function Dg(n,r,a){let o=n.value||"",c="`",d=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(o);)c+="`";for(/[^ \r\n]/.test(o)&&(/^[ \r\n]/.test(o)&&/[ \r\n]$/.test(o)||/^`|`$/.test(o))&&(o=" "+o+" ");++d\u007F]/.test(n.url))}jg.peek=n2;function jg(n,r,a,o){const c=jc(a),d=c==='"'?"Quote":"Apostrophe",f=a.createTracker(o);let p,m;if(Rg(n,a)){const b=a.stack;a.stack=[],p=a.enter("autolink");let y=f.move("<");return y+=f.move(a.containerPhrasing(n,{before:y,after:">",...f.current()})),y+=f.move(">"),p(),a.stack=b,y}p=a.enter("link"),m=a.enter("label");let h=f.move("[");return h+=f.move(a.containerPhrasing(n,{before:h,after:"](",...f.current()})),h+=f.move("]("),m(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(m=a.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(a.safe(n.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(m=a.enter("destinationRaw"),h+=f.move(a.safe(n.url,{before:h,after:n.title?" ":")",...f.current()}))),m(),n.title&&(m=a.enter(`title${d}`),h+=f.move(" "+c),h+=f.move(a.safe(n.title,{before:h,after:c,...f.current()})),h+=f.move(c),m()),h+=f.move(")"),p(),h}function n2(n,r,a){return Rg(n,a)?"<":"["}Ng.peek=l2;function Ng(n,r,a,o){const c=n.referenceType,d=a.enter("linkReference");let f=a.enter("label");const p=a.createTracker(o);let m=p.move("[");const h=a.containerPhrasing(n,{before:m,after:"]",...p.current()});m+=p.move(h+"]["),f();const b=a.stack;a.stack=[],f=a.enter("reference");const y=a.safe(a.associationId(n),{before:m,after:"]",...p.current()});return f(),a.stack=b,d(),c==="full"||!h||h!==y?m+=p.move(y+"]"):c==="shortcut"?m=m.slice(0,-1):m+=p.move("]"),m}function l2(){return"["}function Nc(n){const r=n.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function i2(n){const r=Nc(n),a=n.options.bulletOther;if(!a)return r==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+a+"`) to be different");return a}function a2(n){const r=n.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function Lg(n){const r=n.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function r2(n,r,a,o){const c=a.enter("list"),d=a.bulletCurrent;let f=n.ordered?a2(a):Nc(a);const p=n.ordered?f==="."?")":".":i2(a);let m=r&&a.bulletLastUsed?f===a.bulletLastUsed:!1;if(!n.ordered){const b=n.children?n.children[0]:void 0;if((f==="*"||f==="-")&&b&&(!b.children||!b.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(m=!0),Lg(a)===f&&b){let y=-1;for(;++y-1?r.start:1)+(a.options.incrementListMarker===!1?0:r.children.indexOf(n))+d);let f=d.length+1;(c==="tab"||c==="mixed"&&(r&&r.type==="list"&&r.spread||n.spread))&&(f=Math.ceil(f/4)*4);const p=a.createTracker(o);p.move(d+" ".repeat(f-d.length)),p.shift(f);const m=a.enter("listItem"),h=a.indentLines(a.containerFlow(n,p.current()),b);return m(),h;function b(y,k,x){return k?(x?"":" ".repeat(f))+y:(x?d:d+" ".repeat(f-d.length))+y}}function s2(n,r,a,o){const c=a.enter("paragraph"),d=a.enter("phrasing"),f=a.containerPhrasing(n,o);return d(),c(),f}const c2=bo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function f2(n,r,a,o){return(n.children.some(function(f){return c2(f)})?a.containerPhrasing:a.containerFlow).call(a,n,o)}function d2(n){const r=n.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}Ug.peek=h2;function Ug(n,r,a,o){const c=d2(a),d=a.enter("strong"),f=a.createTracker(o),p=f.move(c+c);let m=f.move(a.containerPhrasing(n,{after:c,before:p,...f.current()}));const h=m.charCodeAt(0),b=fo(o.before.charCodeAt(o.before.length-1),h,c);b.inside&&(m=Da(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=fo(o.after.charCodeAt(0),y,c);k.inside&&(m=m.slice(0,-1)+Da(y));const x=f.move(c+c);return d(),a.attentionEncodeSurroundingInfo={after:k.outside,before:b.outside},p+m+x}function h2(n,r,a){return a.options.strong||"*"}function p2(n,r,a,o){return a.safe(n.value,o)}function m2(n){const r=n.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function g2(n,r,a){const o=(Lg(a)+(a.options.ruleSpaces?" ":"")).repeat(m2(a));return a.options.ruleSpaces?o.slice(0,-1):o}const Bg={blockquote:HS,break:Rm,code:QS,definition:KS,emphasis:zg,hardBreak:Rm,heading:$S,html:Og,image:_g,imageReference:Mg,inlineCode:Dg,link:jg,linkReference:Ng,list:r2,listItem:u2,paragraph:s2,root:f2,strong:Ug,text:p2,thematicBreak:g2};function y2(){return{enter:{table:b2,tableData:jm,tableHeader:jm,tableRow:x2},exit:{codeText:k2,table:v2,tableData:lc,tableHeader:lc,tableRow:lc}}}function b2(n){const r=n._align;this.enter({type:"table",align:r.map(function(a){return a==="none"?null:a}),children:[]},n),this.data.inTable=!0}function v2(n){this.exit(n),this.data.inTable=void 0}function x2(n){this.enter({type:"tableRow",children:[]},n)}function lc(n){this.exit(n)}function jm(n){this.enter({type:"tableCell",children:[]},n)}function k2(n){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,S2));const a=this.stack[this.stack.length-1];a.type,a.value=r,this.exit(n)}function S2(n,r){return r==="|"?r:n}function w2(n){const r=n||{},a=r.tableCellPadding,o=r.tablePipeAlign,c=r.stringLength,d=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,...d.current()});return/^[\t ]/.test(h)&&(h=Da(h.charCodeAt(0))+h.slice(1)),h=h?f+" "+h:f,a.options.closeAtx&&(h+=" "+f),m(),p(),h}Og.peek=WS;function Og(n){return n.value||""}function WS(){return"<"}_g.peek=PS;function _g(n,r,a,o){const c=Nc(a),d=c==='"'?"Quote":"Apostrophe",f=a.enter("image");let p=a.enter("label");const m=a.createTracker(o);let h=m.move("![");return h+=m.move(a.safe(n.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),p(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(p=a.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(a.safe(n.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(p=a.enter("destinationRaw"),h+=m.move(a.safe(n.url,{before:h,after:n.title?" ":")",...m.current()}))),p(),n.title&&(p=a.enter(`title${d}`),h+=m.move(" "+c),h+=m.move(a.safe(n.title,{before:h,after:c,...m.current()})),h+=m.move(c),p()),h+=m.move(")"),f(),h}function PS(){return"!"}Mg.peek=e2;function Mg(n,r,a,o){const c=n.referenceType,d=a.enter("imageReference");let f=a.enter("label");const p=a.createTracker(o);let m=p.move("![");const h=a.safe(n.alt,{before:m,after:"]",...p.current()});m+=p.move(h+"]["),f();const b=a.stack;a.stack=[],f=a.enter("reference");const y=a.safe(a.associationId(n),{before:m,after:"]",...p.current()});return f(),a.stack=b,d(),c==="full"||!h||h!==y?m+=p.move(y+"]"):c==="shortcut"?m=m.slice(0,-1):m+=p.move("]"),m}function e2(){return"!"}Dg.peek=t2;function Dg(n,r,a){let o=n.value||"",c="`",d=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(o);)c+="`";for(/[^ \r\n]/.test(o)&&(/^[ \r\n]/.test(o)&&/[ \r\n]$/.test(o)||/^`|`$/.test(o))&&(o=" "+o+" ");++d\u007F]/.test(n.url))}Ng.peek=n2;function Ng(n,r,a,o){const c=Nc(a),d=c==='"'?"Quote":"Apostrophe",f=a.createTracker(o);let p,m;if(Rg(n,a)){const b=a.stack;a.stack=[],p=a.enter("autolink");let y=f.move("<");return y+=f.move(a.containerPhrasing(n,{before:y,after:">",...f.current()})),y+=f.move(">"),p(),a.stack=b,y}p=a.enter("link"),m=a.enter("label");let h=f.move("[");return h+=f.move(a.containerPhrasing(n,{before:h,after:"](",...f.current()})),h+=f.move("]("),m(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(m=a.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(a.safe(n.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(m=a.enter("destinationRaw"),h+=f.move(a.safe(n.url,{before:h,after:n.title?" ":")",...f.current()}))),m(),n.title&&(m=a.enter(`title${d}`),h+=f.move(" "+c),h+=f.move(a.safe(n.title,{before:h,after:c,...f.current()})),h+=f.move(c),m()),h+=f.move(")"),p(),h}function n2(n,r,a){return Rg(n,a)?"<":"["}jg.peek=l2;function jg(n,r,a,o){const c=n.referenceType,d=a.enter("linkReference");let f=a.enter("label");const p=a.createTracker(o);let m=p.move("[");const h=a.containerPhrasing(n,{before:m,after:"]",...p.current()});m+=p.move(h+"]["),f();const b=a.stack;a.stack=[],f=a.enter("reference");const y=a.safe(a.associationId(n),{before:m,after:"]",...p.current()});return f(),a.stack=b,d(),c==="full"||!h||h!==y?m+=p.move(y+"]"):c==="shortcut"?m=m.slice(0,-1):m+=p.move("]"),m}function l2(){return"["}function jc(n){const r=n.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function i2(n){const r=jc(n),a=n.options.bulletOther;if(!a)return r==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+a+"`) to be different");return a}function a2(n){const r=n.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function Lg(n){const r=n.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function r2(n,r,a,o){const c=a.enter("list"),d=a.bulletCurrent;let f=n.ordered?a2(a):jc(a);const p=n.ordered?f==="."?")":".":i2(a);let m=r&&a.bulletLastUsed?f===a.bulletLastUsed:!1;if(!n.ordered){const b=n.children?n.children[0]:void 0;if((f==="*"||f==="-")&&b&&(!b.children||!b.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(m=!0),Lg(a)===f&&b){let y=-1;for(;++y-1?r.start:1)+(a.options.incrementListMarker===!1?0:r.children.indexOf(n))+d);let f=d.length+1;(c==="tab"||c==="mixed"&&(r&&r.type==="list"&&r.spread||n.spread))&&(f=Math.ceil(f/4)*4);const p=a.createTracker(o);p.move(d+" ".repeat(f-d.length)),p.shift(f);const m=a.enter("listItem"),h=a.indentLines(a.containerFlow(n,p.current()),b);return m(),h;function b(y,k,x){return k?(x?"":" ".repeat(f))+y:(x?d:d+" ".repeat(f-d.length))+y}}function s2(n,r,a,o){const c=a.enter("paragraph"),d=a.enter("phrasing"),f=a.containerPhrasing(n,o);return d(),c(),f}const c2=bo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function f2(n,r,a,o){return(n.children.some(function(f){return c2(f)})?a.containerPhrasing:a.containerFlow).call(a,n,o)}function d2(n){const r=n.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}Ug.peek=h2;function Ug(n,r,a,o){const c=d2(a),d=a.enter("strong"),f=a.createTracker(o),p=f.move(c+c);let m=f.move(a.containerPhrasing(n,{after:c,before:p,...f.current()}));const h=m.charCodeAt(0),b=fo(o.before.charCodeAt(o.before.length-1),h,c);b.inside&&(m=Da(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=fo(o.after.charCodeAt(0),y,c);k.inside&&(m=m.slice(0,-1)+Da(y));const x=f.move(c+c);return d(),a.attentionEncodeSurroundingInfo={after:k.outside,before:b.outside},p+m+x}function h2(n,r,a){return a.options.strong||"*"}function p2(n,r,a,o){return a.safe(n.value,o)}function m2(n){const r=n.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function g2(n,r,a){const o=(Lg(a)+(a.options.ruleSpaces?" ":"")).repeat(m2(a));return a.options.ruleSpaces?o.slice(0,-1):o}const Bg={blockquote:HS,break:Rm,code:QS,definition:KS,emphasis:zg,hardBreak:Rm,heading:$S,html:Og,image:_g,imageReference:Mg,inlineCode:Dg,link:Ng,linkReference:jg,list:r2,listItem:u2,paragraph:s2,root:f2,strong:Ug,text:p2,thematicBreak:g2};function y2(){return{enter:{table:b2,tableData:Nm,tableHeader:Nm,tableRow:x2},exit:{codeText:k2,table:v2,tableData:lc,tableHeader:lc,tableRow:lc}}}function b2(n){const r=n._align;this.enter({type:"table",align:r.map(function(a){return a==="none"?null:a}),children:[]},n),this.data.inTable=!0}function v2(n){this.exit(n),this.data.inTable=void 0}function x2(n){this.enter({type:"tableRow",children:[]},n)}function lc(n){this.exit(n)}function Nm(n){this.enter({type:"tableCell",children:[]},n)}function k2(n){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,S2));const a=this.stack[this.stack.length-1];a.type,a.value=r,this.exit(n)}function S2(n,r){return r==="|"?r:n}function w2(n){const r=n||{},a=r.tableCellPadding,o=r.tablePipeAlign,c=r.stringLength,d=a?" ":"|";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:k,table:f,tableCell:m,tableRow:p}};function f(x,T,U,Z){return h(b(x,U,Z),x.align)}function p(x,T,U,Z){const D=y(x,U,Z),F=h([D]);return F.slice(0,F.indexOf(` -`))}function m(x,T,U,Z){const D=U.enter("tableCell"),F=U.enter("phrasing"),Q=U.containerPhrasing(x,{...Z,before:d,after:d});return F(),D(),Q}function h(x,T){return US(x,{align:T,alignDelimiters:o,padding:a,stringLength:c})}function b(x,T,U){const Z=x.children;let D=-1;const F=[],Q=T.enter("table");for(;++D0&&!a&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const Y2={tokenize:I2,partial:!0};function G2(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Z2,continuation:{tokenize:K2},exit:F2}},text:{91:{name:"gfmFootnoteCall",tokenize:Q2},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:V2,resolveTo:X2}}}}function V2(n,r,a){const o=this;let c=o.events.length;const d=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);let f;for(;c--;){const m=o.events[c][1];if(m.type==="labelImage"){f=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return p;function p(m){if(!f||!f._balanced)return a(m);const h=on(o.sliceSerialize({start:f.end,end:o.now()}));return h.codePointAt(0)!==94||!d.includes(h.slice(1))?a(m):(n.enter("gfmFootnoteCallLabelMarker"),n.consume(m),n.exit("gfmFootnoteCallLabelMarker"),r(m))}}function X2(n,r){let a=n.length;for(;a--;)if(n[a][1].type==="labelImage"&&n[a][0]==="enter"){n[a][1];break}n[a+1][1].type="data",n[a+3][1].type="gfmFootnoteCallLabelMarker";const o={type:"gfmFootnoteCall",start:Object.assign({},n[a+3][1].start),end:Object.assign({},n[n.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},n[a+3][1].end),end:Object.assign({},n[a+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const d={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},n[n.length-1][1].start)},f={type:"chunkString",contentType:"string",start:Object.assign({},d.start),end:Object.assign({},d.end)},p=[n[a+1],n[a+2],["enter",o,r],n[a+3],n[a+4],["enter",c,r],["exit",c,r],["enter",d,r],["enter",f,r],["exit",f,r],["exit",d,r],n[n.length-2],n[n.length-1],["exit",o,r]];return n.splice(a,n.length-a+1,...p),n}function Q2(n,r,a){const o=this,c=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);let d=0,f;return p;function p(y){return n.enter("gfmFootnoteCall"),n.enter("gfmFootnoteCallLabelMarker"),n.consume(y),n.exit("gfmFootnoteCallLabelMarker"),m}function m(y){return y!==94?a(y):(n.enter("gfmFootnoteCallMarker"),n.consume(y),n.exit("gfmFootnoteCallMarker"),n.enter("gfmFootnoteCallString"),n.enter("chunkString").contentType="string",h)}function h(y){if(d>999||y===93&&!f||y===null||y===91||Ve(y))return a(y);if(y===93){n.exit("chunkString");const k=n.exit("gfmFootnoteCallString");return c.includes(on(o.sliceSerialize(k)))?(n.enter("gfmFootnoteCallLabelMarker"),n.consume(y),n.exit("gfmFootnoteCallLabelMarker"),n.exit("gfmFootnoteCall"),r):a(y)}return Ve(y)||(f=!0),d++,n.consume(y),y===92?b:h}function b(y){return y===91||y===92||y===93?(n.consume(y),d++,h):h(y)}}function Z2(n,r,a){const o=this,c=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);let d,f=0,p;return m;function m(T){return n.enter("gfmFootnoteDefinition")._container=!0,n.enter("gfmFootnoteDefinitionLabel"),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(T),n.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(T){return T===94?(n.enter("gfmFootnoteDefinitionMarker"),n.consume(T),n.exit("gfmFootnoteDefinitionMarker"),n.enter("gfmFootnoteDefinitionLabelString"),n.enter("chunkString").contentType="string",b):a(T)}function b(T){if(f>999||T===93&&!p||T===null||T===91||Ve(T))return a(T);if(T===93){n.exit("chunkString");const U=n.exit("gfmFootnoteDefinitionLabelString");return d=on(o.sliceSerialize(U)),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(T),n.exit("gfmFootnoteDefinitionLabelMarker"),n.exit("gfmFootnoteDefinitionLabel"),k}return Ve(T)||(p=!0),f++,n.consume(T),T===92?y:b}function y(T){return T===91||T===92||T===93?(n.consume(T),f++,b):b(T)}function k(T){return T===58?(n.enter("definitionMarker"),n.consume(T),n.exit("definitionMarker"),c.includes(d)||c.push(d),Oe(n,x,"gfmFootnoteDefinitionWhitespace")):a(T)}function x(T){return r(T)}}function K2(n,r,a){return n.check(ja,r,n.attempt(Y2,r,a))}function F2(n){n.exit("gfmFootnoteDefinition")}function I2(n,r,a){const o=this;return Oe(n,c,"gfmFootnoteDefinitionIndent",5);function c(d){const f=o.events[o.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?r(d):a(d)}}function J2(n){let a=(n||{}).singleTilde;const o={name:"strikethrough",tokenize:d,resolveAll:c};return a==null&&(a=!0),{text:{126:o},insideSpan:{null:[o]},attentionMarkers:{null:[126]}};function c(f,p){let m=-1;for(;++m1?m(T):(f.consume(T),y++,x);if(y<2&&!a)return m(T);const Z=f.exit("strikethroughSequenceTemporary"),D=wi(T);return Z._open=!D||D===2&&!!U,Z._close=!U||U===2&&!!D,p(T)}}}class $2{constructor(){this.map=[]}add(r,a,o){W2(this,r,a,o)}consume(r){if(this.map.sort(function(d,f){return d[0]-f[0]}),this.map.length===0)return;let a=this.map.length;const o=[];for(;a>0;)a-=1,o.push(r.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),r.length=this.map[a][0];o.push(r.slice()),r.length=0;let c=o.pop();for(;c;){for(const d of c)r.push(d);c=o.pop()}this.map.length=0}}function W2(n,r,a,o){let c=0;if(!(a===0&&o.length===0)){for(;c-1;){const J=o.events[te][1].type;if(J==="lineEnding"||J==="linePrefix")te--;else break}const B=te>-1?o.events[te][1].type:null,le=B==="tableHead"||B==="tableRow"?L:m;return le===L&&o.parser.lazy[o.now().line]?a(j):le(j)}function m(j){return n.enter("tableHead"),n.enter("tableRow"),h(j)}function h(j){return j===124||(f=!0,d+=1),b(j)}function b(j){return j===null?a(j):ce(j)?d>1?(d=0,o.interrupt=!0,n.exit("tableRow"),n.enter("lineEnding"),n.consume(j),n.exit("lineEnding"),x):a(j):Ce(j)?Oe(n,b,"whitespace")(j):(d+=1,f&&(f=!1,c+=1),j===124?(n.enter("tableCellDivider"),n.consume(j),n.exit("tableCellDivider"),f=!0,b):(n.enter("data"),y(j)))}function y(j){return j===null||j===124||Ve(j)?(n.exit("data"),b(j)):(n.consume(j),j===92?k:y)}function k(j){return j===92||j===124?(n.consume(j),y):y(j)}function x(j){return o.interrupt=!1,o.parser.lazy[o.now().line]?a(j):(n.enter("tableDelimiterRow"),f=!1,Ce(j)?Oe(n,T,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):T(j))}function T(j){return j===45||j===58?Z(j):j===124?(f=!0,n.enter("tableCellDivider"),n.consume(j),n.exit("tableCellDivider"),U):re(j)}function U(j){return Ce(j)?Oe(n,Z,"whitespace")(j):Z(j)}function Z(j){return j===58?(d+=1,f=!0,n.enter("tableDelimiterMarker"),n.consume(j),n.exit("tableDelimiterMarker"),D):j===45?(d+=1,D(j)):j===null||ce(j)?oe(j):re(j)}function D(j){return j===45?(n.enter("tableDelimiterFiller"),F(j)):re(j)}function F(j){return j===45?(n.consume(j),F):j===58?(f=!0,n.exit("tableDelimiterFiller"),n.enter("tableDelimiterMarker"),n.consume(j),n.exit("tableDelimiterMarker"),Q):(n.exit("tableDelimiterFiller"),Q(j))}function Q(j){return Ce(j)?Oe(n,oe,"whitespace")(j):oe(j)}function oe(j){return j===124?T(j):j===null||ce(j)?!f||c!==d?re(j):(n.exit("tableDelimiterRow"),n.exit("tableHead"),r(j)):re(j)}function re(j){return a(j)}function L(j){return n.enter("tableRow"),P(j)}function P(j){return j===124?(n.enter("tableCellDivider"),n.consume(j),n.exit("tableCellDivider"),P):j===null||ce(j)?(n.exit("tableRow"),r(j)):Ce(j)?Oe(n,P,"whitespace")(j):(n.enter("data"),he(j))}function he(j){return j===null||j===124||Ve(j)?(n.exit("data"),P(j)):(n.consume(j),j===92?me:he)}function me(j){return j===92||j===124?(n.consume(j),he):he(j)}}function nw(n,r){let a=-1,o=!0,c=0,d=[0,0,0,0],f=[0,0,0,0],p=!1,m=0,h,b,y;const k=new $2;for(;++aa[2]+1){const T=a[2]+1,U=a[3]-a[2]-1;n.add(T,U,[])}}n.add(a[3]+1,0,[["exit",y,r]])}return c!==void 0&&(d.end=Object.assign({},Si(r.events,c)),n.add(c,0,[["exit",d,r]]),d=void 0),d}function Lm(n,r,a,o,c){const d=[],f=Si(r.events,a);c&&(c.end=Object.assign({},f),d.push(["exit",c,r])),o.end=Object.assign({},f),d.push(["exit",o,r]),n.add(a+1,0,d)}function Si(n,r){const a=n[r],o=a[0]==="enter"?"start":"end";return a[1][o]}const lw={name:"tasklistCheck",tokenize:aw};function iw(){return{text:{91:lw}}}function aw(n,r,a){const o=this;return c;function c(m){return o.previous!==null||!o._gfmTasklistFirstContentOfListItem?a(m):(n.enter("taskListCheck"),n.enter("taskListCheckMarker"),n.consume(m),n.exit("taskListCheckMarker"),d)}function d(m){return Ve(m)?(n.enter("taskListCheckValueUnchecked"),n.consume(m),n.exit("taskListCheckValueUnchecked"),f):m===88||m===120?(n.enter("taskListCheckValueChecked"),n.consume(m),n.exit("taskListCheckValueChecked"),f):a(m)}function f(m){return m===93?(n.enter("taskListCheckMarker"),n.consume(m),n.exit("taskListCheckMarker"),n.exit("taskListCheck"),p):a(m)}function p(m){return ce(m)?r(m):Ce(m)?n.check({tokenize:rw},r,a)(m):a(m)}}function rw(n,r,a){return Oe(n,o,"whitespace");function o(c){return c===null?a(c):r(c)}}function ow(n){return lg([D2(),G2(),J2(n),ew(),iw()])}const uw={};function sw(n){const r=this,a=n||uw,o=r.data(),c=o.micromarkExtensions||(o.micromarkExtensions=[]),d=o.fromMarkdownExtensions||(o.fromMarkdownExtensions=[]),f=o.toMarkdownExtensions||(o.toMarkdownExtensions=[]);c.push(ow(a)),d.push(z2()),f.push(O2(a))}/** +`))}function m(x,T,U,Z){const D=U.enter("tableCell"),F=U.enter("phrasing"),Q=U.containerPhrasing(x,{...Z,before:d,after:d});return F(),D(),Q}function h(x,T){return US(x,{align:T,alignDelimiters:o,padding:a,stringLength:c})}function b(x,T,U){const Z=x.children;let D=-1;const F=[],Q=T.enter("table");for(;++D0&&!a&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const Y2={tokenize:I2,partial:!0};function G2(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Z2,continuation:{tokenize:K2},exit:F2}},text:{91:{name:"gfmFootnoteCall",tokenize:Q2},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:V2,resolveTo:X2}}}}function V2(n,r,a){const o=this;let c=o.events.length;const d=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);let f;for(;c--;){const m=o.events[c][1];if(m.type==="labelImage"){f=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return p;function p(m){if(!f||!f._balanced)return a(m);const h=on(o.sliceSerialize({start:f.end,end:o.now()}));return h.codePointAt(0)!==94||!d.includes(h.slice(1))?a(m):(n.enter("gfmFootnoteCallLabelMarker"),n.consume(m),n.exit("gfmFootnoteCallLabelMarker"),r(m))}}function X2(n,r){let a=n.length;for(;a--;)if(n[a][1].type==="labelImage"&&n[a][0]==="enter"){n[a][1];break}n[a+1][1].type="data",n[a+3][1].type="gfmFootnoteCallLabelMarker";const o={type:"gfmFootnoteCall",start:Object.assign({},n[a+3][1].start),end:Object.assign({},n[n.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},n[a+3][1].end),end:Object.assign({},n[a+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const d={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},n[n.length-1][1].start)},f={type:"chunkString",contentType:"string",start:Object.assign({},d.start),end:Object.assign({},d.end)},p=[n[a+1],n[a+2],["enter",o,r],n[a+3],n[a+4],["enter",c,r],["exit",c,r],["enter",d,r],["enter",f,r],["exit",f,r],["exit",d,r],n[n.length-2],n[n.length-1],["exit",o,r]];return n.splice(a,n.length-a+1,...p),n}function Q2(n,r,a){const o=this,c=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);let d=0,f;return p;function p(y){return n.enter("gfmFootnoteCall"),n.enter("gfmFootnoteCallLabelMarker"),n.consume(y),n.exit("gfmFootnoteCallLabelMarker"),m}function m(y){return y!==94?a(y):(n.enter("gfmFootnoteCallMarker"),n.consume(y),n.exit("gfmFootnoteCallMarker"),n.enter("gfmFootnoteCallString"),n.enter("chunkString").contentType="string",h)}function h(y){if(d>999||y===93&&!f||y===null||y===91||Ve(y))return a(y);if(y===93){n.exit("chunkString");const k=n.exit("gfmFootnoteCallString");return c.includes(on(o.sliceSerialize(k)))?(n.enter("gfmFootnoteCallLabelMarker"),n.consume(y),n.exit("gfmFootnoteCallLabelMarker"),n.exit("gfmFootnoteCall"),r):a(y)}return Ve(y)||(f=!0),d++,n.consume(y),y===92?b:h}function b(y){return y===91||y===92||y===93?(n.consume(y),d++,h):h(y)}}function Z2(n,r,a){const o=this,c=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]);let d,f=0,p;return m;function m(T){return n.enter("gfmFootnoteDefinition")._container=!0,n.enter("gfmFootnoteDefinitionLabel"),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(T),n.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(T){return T===94?(n.enter("gfmFootnoteDefinitionMarker"),n.consume(T),n.exit("gfmFootnoteDefinitionMarker"),n.enter("gfmFootnoteDefinitionLabelString"),n.enter("chunkString").contentType="string",b):a(T)}function b(T){if(f>999||T===93&&!p||T===null||T===91||Ve(T))return a(T);if(T===93){n.exit("chunkString");const U=n.exit("gfmFootnoteDefinitionLabelString");return d=on(o.sliceSerialize(U)),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(T),n.exit("gfmFootnoteDefinitionLabelMarker"),n.exit("gfmFootnoteDefinitionLabel"),k}return Ve(T)||(p=!0),f++,n.consume(T),T===92?y:b}function y(T){return T===91||T===92||T===93?(n.consume(T),f++,b):b(T)}function k(T){return T===58?(n.enter("definitionMarker"),n.consume(T),n.exit("definitionMarker"),c.includes(d)||c.push(d),Oe(n,x,"gfmFootnoteDefinitionWhitespace")):a(T)}function x(T){return r(T)}}function K2(n,r,a){return n.check(Na,r,n.attempt(Y2,r,a))}function F2(n){n.exit("gfmFootnoteDefinition")}function I2(n,r,a){const o=this;return Oe(n,c,"gfmFootnoteDefinitionIndent",5);function c(d){const f=o.events[o.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?r(d):a(d)}}function J2(n){let a=(n||{}).singleTilde;const o={name:"strikethrough",tokenize:d,resolveAll:c};return a==null&&(a=!0),{text:{126:o},insideSpan:{null:[o]},attentionMarkers:{null:[126]}};function c(f,p){let m=-1;for(;++m1?m(T):(f.consume(T),y++,x);if(y<2&&!a)return m(T);const Z=f.exit("strikethroughSequenceTemporary"),D=wi(T);return Z._open=!D||D===2&&!!U,Z._close=!U||U===2&&!!D,p(T)}}}class $2{constructor(){this.map=[]}add(r,a,o){W2(this,r,a,o)}consume(r){if(this.map.sort(function(d,f){return d[0]-f[0]}),this.map.length===0)return;let a=this.map.length;const o=[];for(;a>0;)a-=1,o.push(r.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),r.length=this.map[a][0];o.push(r.slice()),r.length=0;let c=o.pop();for(;c;){for(const d of c)r.push(d);c=o.pop()}this.map.length=0}}function W2(n,r,a,o){let c=0;if(!(a===0&&o.length===0)){for(;c-1;){const J=o.events[te][1].type;if(J==="lineEnding"||J==="linePrefix")te--;else break}const B=te>-1?o.events[te][1].type:null,le=B==="tableHead"||B==="tableRow"?L:m;return le===L&&o.parser.lazy[o.now().line]?a(N):le(N)}function m(N){return n.enter("tableHead"),n.enter("tableRow"),h(N)}function h(N){return N===124||(f=!0,d+=1),b(N)}function b(N){return N===null?a(N):ce(N)?d>1?(d=0,o.interrupt=!0,n.exit("tableRow"),n.enter("lineEnding"),n.consume(N),n.exit("lineEnding"),x):a(N):Ce(N)?Oe(n,b,"whitespace")(N):(d+=1,f&&(f=!1,c+=1),N===124?(n.enter("tableCellDivider"),n.consume(N),n.exit("tableCellDivider"),f=!0,b):(n.enter("data"),y(N)))}function y(N){return N===null||N===124||Ve(N)?(n.exit("data"),b(N)):(n.consume(N),N===92?k:y)}function k(N){return N===92||N===124?(n.consume(N),y):y(N)}function x(N){return o.interrupt=!1,o.parser.lazy[o.now().line]?a(N):(n.enter("tableDelimiterRow"),f=!1,Ce(N)?Oe(n,T,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):T(N))}function T(N){return N===45||N===58?Z(N):N===124?(f=!0,n.enter("tableCellDivider"),n.consume(N),n.exit("tableCellDivider"),U):re(N)}function U(N){return Ce(N)?Oe(n,Z,"whitespace")(N):Z(N)}function Z(N){return N===58?(d+=1,f=!0,n.enter("tableDelimiterMarker"),n.consume(N),n.exit("tableDelimiterMarker"),D):N===45?(d+=1,D(N)):N===null||ce(N)?oe(N):re(N)}function D(N){return N===45?(n.enter("tableDelimiterFiller"),F(N)):re(N)}function F(N){return N===45?(n.consume(N),F):N===58?(f=!0,n.exit("tableDelimiterFiller"),n.enter("tableDelimiterMarker"),n.consume(N),n.exit("tableDelimiterMarker"),Q):(n.exit("tableDelimiterFiller"),Q(N))}function Q(N){return Ce(N)?Oe(n,oe,"whitespace")(N):oe(N)}function oe(N){return N===124?T(N):N===null||ce(N)?!f||c!==d?re(N):(n.exit("tableDelimiterRow"),n.exit("tableHead"),r(N)):re(N)}function re(N){return a(N)}function L(N){return n.enter("tableRow"),P(N)}function P(N){return N===124?(n.enter("tableCellDivider"),n.consume(N),n.exit("tableCellDivider"),P):N===null||ce(N)?(n.exit("tableRow"),r(N)):Ce(N)?Oe(n,P,"whitespace")(N):(n.enter("data"),he(N))}function he(N){return N===null||N===124||Ve(N)?(n.exit("data"),P(N)):(n.consume(N),N===92?me:he)}function me(N){return N===92||N===124?(n.consume(N),he):he(N)}}function nw(n,r){let a=-1,o=!0,c=0,d=[0,0,0,0],f=[0,0,0,0],p=!1,m=0,h,b,y;const k=new $2;for(;++aa[2]+1){const T=a[2]+1,U=a[3]-a[2]-1;n.add(T,U,[])}}n.add(a[3]+1,0,[["exit",y,r]])}return c!==void 0&&(d.end=Object.assign({},Si(r.events,c)),n.add(c,0,[["exit",d,r]]),d=void 0),d}function Lm(n,r,a,o,c){const d=[],f=Si(r.events,a);c&&(c.end=Object.assign({},f),d.push(["exit",c,r])),o.end=Object.assign({},f),d.push(["exit",o,r]),n.add(a+1,0,d)}function Si(n,r){const a=n[r],o=a[0]==="enter"?"start":"end";return a[1][o]}const lw={name:"tasklistCheck",tokenize:aw};function iw(){return{text:{91:lw}}}function aw(n,r,a){const o=this;return c;function c(m){return o.previous!==null||!o._gfmTasklistFirstContentOfListItem?a(m):(n.enter("taskListCheck"),n.enter("taskListCheckMarker"),n.consume(m),n.exit("taskListCheckMarker"),d)}function d(m){return Ve(m)?(n.enter("taskListCheckValueUnchecked"),n.consume(m),n.exit("taskListCheckValueUnchecked"),f):m===88||m===120?(n.enter("taskListCheckValueChecked"),n.consume(m),n.exit("taskListCheckValueChecked"),f):a(m)}function f(m){return m===93?(n.enter("taskListCheckMarker"),n.consume(m),n.exit("taskListCheckMarker"),n.exit("taskListCheck"),p):a(m)}function p(m){return ce(m)?r(m):Ce(m)?n.check({tokenize:rw},r,a)(m):a(m)}}function rw(n,r,a){return Oe(n,o,"whitespace");function o(c){return c===null?a(c):r(c)}}function ow(n){return lg([D2(),G2(),J2(n),ew(),iw()])}const uw={};function sw(n){const r=this,a=n||uw,o=r.data(),c=o.micromarkExtensions||(o.micromarkExtensions=[]),d=o.fromMarkdownExtensions||(o.fromMarkdownExtensions=[]),f=o.toMarkdownExtensions||(o.toMarkdownExtensions=[]);c.push(ow(a)),d.push(z2()),f.push(O2(a))}/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. @@ -837,16 +843,16 @@ On macOS, launching the workspace probes whether the binary can read \`~/Desktop * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ew=ut("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** + */const Aw=ut("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Hm=ut("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);function Aw(){if(typeof window>"u")return"light";try{const n=window.localStorage.getItem("docs-theme");if(n==="light"||n==="dark")return n}catch{}return"light"}function Tw(n){typeof document>"u"||(document.documentElement.classList.toggle("dark",n==="dark"),document.documentElement.style.colorScheme=n)}function zw(){const[n,r]=We.useState(Aw);return We.useEffect(()=>{Tw(n);try{window.localStorage.setItem("docs-theme",n)}catch{}},[n]),{theme:n,toggle:()=>r(o=>o==="dark"?"light":"dark")}}const an='"JetBrains Mono", "SF Mono", ui-monospace, monospace',Wt='"Computer Modern Concrete", "Concrete Roman", Georgia, "Times New Roman", serif',oo=[{key:"openscience",label:"OpenScience",short:"OpenScience",tagline:"Open-source AI workbench",lead:!1}],Uc=oo.map(n=>n.key),Ow=Object.assign({"./content/openscience/agents.mdx":Sb,"./content/openscience/atlas.mdx":wb,"./content/openscience/commands.mdx":Cb,"./content/openscience/index.mdx":Eb,"./content/openscience/local-models.mdx":Ab,"./content/openscience/models.mdx":Tb,"./content/openscience/quickstart.mdx":zb,"./content/openscience/sandbox.mdx":Ob,"./content/openscience/security.mdx":_b,"./content/openscience/sessions.mdx":Mb,"./content/openscience/skills.mdx":Db,"./content/openscience/workspace.mdx":Rb}),_w=Object.assign({"./content/openscience/docs.json":Bb}),qm={index:H.jsx(Bm,{size:17,strokeWidth:1.8}),quickstart:H.jsx(kw,{size:17,strokeWidth:1.8}),workspace:H.jsx(bw,{size:17,strokeWidth:1.8}),agents:H.jsx(hw,{size:17,strokeWidth:1.8}),models:H.jsx(xw,{size:17,strokeWidth:1.8}),skills:H.jsx(Fg,{size:17,strokeWidth:1.8}),sessions:H.jsx(Hm,{size:17,strokeWidth:1.8}),atlas:H.jsx(Bm,{size:17,strokeWidth:1.8}),commands:H.jsx(Hm,{size:17,strokeWidth:1.8}),security:H.jsx(ww,{size:17,strokeWidth:1.8})},Mw={openscience:H.jsx(yw,{size:17,strokeWidth:1.8})},Dw=/^---\n([\s\S]*?)\n---\n?/;function Rw(n){const r=n.match(Dw);if(!r)return{title:"Untitled",description:"",body:n};const a=r[1],o=n.slice(r[0].length),c=d=>{const f=a.split(` -`).find(p=>p.trim().startsWith(`${d}:`));return f?f.split(":").slice(1).join(":").trim().replace(/^["']|["']$/g,""):""};return{title:c("title")||"Untitled",description:c("description"),body:o}}function jw(n){return n.split(` -`).filter(r=>r.startsWith("## ")).map(r=>r.replace(/^##\s+/,"").trim()).slice(0,10)}function ki(n){return n.flatMap(r=>typeof r=="string"?[r]:r.pages)}function Nw(n,r){const a=n.split("/").pop()??n;return qm[n]??qm[a]??Mw[r]}function Lw(n){const r=`./content/${n}/`,a={};for(const[o,c]of Object.entries(Ow)){if(!o.startsWith(r))continue;const d=o.slice(r.length).replace(/\.(mdx|md)$/,""),f=Rw(c);a[d]={path:d,title:f.title,description:f.description,icon:Nw(d,n),body:f.body,headings:jw(f.body)}}return a}const za={openscience:Lw("openscience")},Ym={openscience:_w["./content/openscience/docs.json"]};function Oa(n,r){var a;return!!((a=za[n])!=null&&a[r])}const Uw={"agent-cli":"openscience"},Bw={"first-session":"sessions","sub-agents":"agents","web-ui":"workspace",credentials:"atlas"},Hw={"cli:index":{section:"openscience",path:"index"},"cli:installation":{section:"openscience",path:"quickstart"},"cli:quickstart":{section:"openscience",path:"quickstart"},"cli:first-session":{section:"openscience",path:"sessions"},"cli:sessions":{section:"openscience",path:"sessions"},"cli:models":{section:"openscience",path:"models"},"cli:codex":{section:"openscience",path:"models"},"cli:sub-agents":{section:"openscience",path:"agents"},"cli:skills":{section:"openscience",path:"skills"},"cli:cli-runtime":{section:"openscience",path:"commands"},"cli:connect":{section:"openscience",path:"atlas"},"cli:credentials":{section:"openscience",path:"atlas"},"cli:security":{section:"openscience",path:"security"},"cli:feature-map":{section:"openscience",path:"commands"},"cli:commands":{section:"openscience",path:"commands"},"cli:web-ui":{section:"openscience",path:"workspace"},"cli:server-mode":{section:"openscience",path:"workspace"}};function ic(){return{section:"openscience",path:"index"}}function Gm(){if(typeof window>"u")return ic();const n=decodeURIComponent(window.location.hash.replace(/^#\/?/,"")).replace(/\/$/,"");if(!n)return ic();const r=n.split("/"),a=r[0];if(Uc.includes(a)){const d=r.slice(1).join("/")||"index";return Oa(a,d)?{section:a,path:d}:{section:a,path:"index"}}const o=Uw[r[0]];if(o){const d=r.slice(1).join("/")||"index",f=Bw[d]??d;return Oa(o,f)?{section:o,path:f}:{section:o,path:"index"}}const c=Hw[`cli:${n}`];return c&&Oa(c.section,c.path)?c:ic()}function rn(n,r){return`#/${n}/${r}`}let _a="openscience";function Bc(n){if(!n||n.startsWith("http")||n.startsWith("#")||n.startsWith("mailto:"))return n;if(n.startsWith("/")){const r=n.slice(1).replace(/\/$/,"");if(!r)return rn(_a,"index");const a=r.split("/"),o=a[0];if(Uc.includes(o)){const c=a.slice(1).join("/")||"index";if(Oa(o,c))return rn(o,c)}if(Oa(_a,r))return rn(_a,r)}return n}function qw(n){const o=n.replace(/^#\/?/,"").replace(/\/$/,"").split("/")[0];return Uc.includes(o)?o:_a}function Hc(n){const r={};for(const a of n.matchAll(/([\w-]+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]*)\}))?/g)){const o=a[1];o&&(r[o]=a[2]??a[3]??a[4]??!0)}return r}function qc(n){const r=n.replace(/\t/g," ").split(` + */const Hm=ut("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);function Ew(){if(typeof window>"u")return"light";try{const n=window.localStorage.getItem("docs-theme");if(n==="light"||n==="dark")return n}catch{}return"light"}function Tw(n){typeof document>"u"||(document.documentElement.classList.toggle("dark",n==="dark"),document.documentElement.style.colorScheme=n)}function zw(){const[n,r]=We.useState(Ew);return We.useEffect(()=>{Tw(n);try{window.localStorage.setItem("docs-theme",n)}catch{}},[n]),{theme:n,toggle:()=>r(o=>o==="dark"?"light":"dark")}}const an='"JetBrains Mono", "SF Mono", ui-monospace, monospace',Wt='"Computer Modern Concrete", "Concrete Roman", Georgia, "Times New Roman", serif',oo=[{key:"openscience",label:"OpenScience",short:"OpenScience",tagline:"Open-source AI workbench",lead:!1}],Uc=oo.map(n=>n.key),Ow=Object.assign({"./content/openscience/agents.mdx":Sb,"./content/openscience/atlas.mdx":wb,"./content/openscience/commands.mdx":Cb,"./content/openscience/index.mdx":Ab,"./content/openscience/local-models.mdx":Eb,"./content/openscience/models.mdx":Tb,"./content/openscience/quickstart.mdx":zb,"./content/openscience/sandbox.mdx":Ob,"./content/openscience/security.mdx":_b,"./content/openscience/sessions.mdx":Mb,"./content/openscience/skills.mdx":Db,"./content/openscience/workspace.mdx":Rb}),_w=Object.assign({"./content/openscience/docs.json":Bb}),qm={index:H.jsx(Bm,{size:17,strokeWidth:1.8}),quickstart:H.jsx(kw,{size:17,strokeWidth:1.8}),workspace:H.jsx(bw,{size:17,strokeWidth:1.8}),agents:H.jsx(hw,{size:17,strokeWidth:1.8}),models:H.jsx(xw,{size:17,strokeWidth:1.8}),skills:H.jsx(Fg,{size:17,strokeWidth:1.8}),sessions:H.jsx(Hm,{size:17,strokeWidth:1.8}),atlas:H.jsx(Bm,{size:17,strokeWidth:1.8}),commands:H.jsx(Hm,{size:17,strokeWidth:1.8}),security:H.jsx(ww,{size:17,strokeWidth:1.8})},Mw={openscience:H.jsx(yw,{size:17,strokeWidth:1.8})},Dw=/^---\n([\s\S]*?)\n---\n?/;function Rw(n){const r=n.match(Dw);if(!r)return{title:"Untitled",description:"",body:n};const a=r[1],o=n.slice(r[0].length),c=d=>{const f=a.split(` +`).find(p=>p.trim().startsWith(`${d}:`));return f?f.split(":").slice(1).join(":").trim().replace(/^["']|["']$/g,""):""};return{title:c("title")||"Untitled",description:c("description"),body:o}}function Nw(n){return n.split(` +`).filter(r=>r.startsWith("## ")).map(r=>r.replace(/^##\s+/,"").trim()).slice(0,10)}function ki(n){return n.flatMap(r=>typeof r=="string"?[r]:r.pages)}function jw(n,r){const a=n.split("/").pop()??n;return qm[n]??qm[a]??Mw[r]}function Lw(n){const r=`./content/${n}/`,a={};for(const[o,c]of Object.entries(Ow)){if(!o.startsWith(r))continue;const d=o.slice(r.length).replace(/\.(mdx|md)$/,""),f=Rw(c);a[d]={path:d,title:f.title,description:f.description,icon:jw(d,n),body:f.body,headings:Nw(f.body)}}return a}const za={openscience:Lw("openscience")},Ym={openscience:_w["./content/openscience/docs.json"]};function Oa(n,r){var a;return!!((a=za[n])!=null&&a[r])}const Uw={"agent-cli":"openscience"},Bw={"first-session":"sessions","sub-agents":"agents","web-ui":"workspace",credentials:"atlas"},Hw={"cli:index":{section:"openscience",path:"index"},"cli:installation":{section:"openscience",path:"quickstart"},"cli:quickstart":{section:"openscience",path:"quickstart"},"cli:first-session":{section:"openscience",path:"sessions"},"cli:sessions":{section:"openscience",path:"sessions"},"cli:models":{section:"openscience",path:"models"},"cli:codex":{section:"openscience",path:"models"},"cli:sub-agents":{section:"openscience",path:"agents"},"cli:skills":{section:"openscience",path:"skills"},"cli:cli-runtime":{section:"openscience",path:"commands"},"cli:connect":{section:"openscience",path:"atlas"},"cli:credentials":{section:"openscience",path:"atlas"},"cli:security":{section:"openscience",path:"security"},"cli:feature-map":{section:"openscience",path:"commands"},"cli:commands":{section:"openscience",path:"commands"},"cli:web-ui":{section:"openscience",path:"workspace"},"cli:server-mode":{section:"openscience",path:"workspace"}};function ic(){return{section:"openscience",path:"index"}}function Gm(){if(typeof window>"u")return ic();const n=decodeURIComponent(window.location.hash.replace(/^#\/?/,"")).replace(/\/$/,"");if(!n)return ic();const r=n.split("/"),a=r[0];if(Uc.includes(a)){const d=r.slice(1).join("/")||"index";return Oa(a,d)?{section:a,path:d}:{section:a,path:"index"}}const o=Uw[r[0]];if(o){const d=r.slice(1).join("/")||"index",f=Bw[d]??d;return Oa(o,f)?{section:o,path:f}:{section:o,path:"index"}}const c=Hw[`cli:${n}`];return c&&Oa(c.section,c.path)?c:ic()}function rn(n,r){return`#/${n}/${r}`}let _a="openscience";function Bc(n){if(!n||n.startsWith("http")||n.startsWith("#")||n.startsWith("mailto:"))return n;if(n.startsWith("/")){const r=n.slice(1).replace(/\/$/,"");if(!r)return rn(_a,"index");const a=r.split("/"),o=a[0];if(Uc.includes(o)){const c=a.slice(1).join("/")||"index";if(Oa(o,c))return rn(o,c)}if(Oa(_a,r))return rn(_a,r)}return n}function qw(n){const o=n.replace(/^#\/?/,"").replace(/\/$/,"").split("/")[0];return Uc.includes(o)?o:_a}function Hc(n){const r={};for(const a of n.matchAll(/([\w-]+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]*)\}))?/g)){const o=a[1];o&&(r[o]=a[2]??a[3]??a[4]??!0)}return r}function qc(n){const r=n.replace(/\t/g," ").split(` `);let a=1/0;for(const o of r){if(o.trim()==="")continue;const c=o.match(/^( *)/);c&&(a=Math.min(a,c[1].length))}return!Number.isFinite(a)||a===0?n:r.map(o=>o.length>=a?o.slice(a):o).join(` -`)}function Ig(n){return Array.from(n.matchAll(/]*)>\s*([\s\S]*?)\s*<\/Card>/g)).map(r=>{const a=Hc(r[1]??"");return{title:String(a.title??"Untitled"),href:String(a.href??"#"),icon:a.icon?String(a.icon):void 0,horizontal:!!a.horizontal,body:qc(r[2]??"").trim()}})}function Yw(n){var a;const r=Bc(n.href);if(r&&r.startsWith("#/")){const o=qw(r),c=r.replace(/^#\/?/,"").replace(/\/$/,"").split("/").slice(1).join("/"),d=(a=za[o])==null?void 0:a[c];if(d)return d.icon}return H.jsx(Fg,{size:17,strokeWidth:1.8})}const ao="synthetic-sciences/openscience";function Gw(n){return n>=1e3?`${(n/1e3).toFixed(1).replace(/\.0$/,"")}k`:String(n)}function Vw(){const[n,r]=We.useState(null);return We.useEffect(()=>{let a=!1;const o=`docs-gh-stars:${ao}`;try{const c=JSON.parse(window.localStorage.getItem(o)??"null");if(c&&Date.now()-c.at<3600*1e3){r(c.stars);return}}catch{}return fetch(`https://api.github.com/repos/${ao}`).then(c=>c.ok?c.json():null).then(c=>{const d=c==null?void 0:c.stargazers_count;if(!(typeof d!="number"||a)){r(d);try{window.localStorage.setItem(o,JSON.stringify({stars:d,at:Date.now()}))}catch{}}}).catch(()=>{}),()=>{a=!0}},[]),H.jsxs("div",{className:"docs-ghstars",children:[H.jsxs("a",{className:"docs-ghstars-primary",href:`https://github.com/${ao}`,target:"_blank",rel:"noreferrer",children:[H.jsx(Cw,{size:13,strokeWidth:1.8}),H.jsx("span",{children:"Star on GitHub"}),n!==null?H.jsx("em",{children:Gw(n)}):null]}),H.jsx("a",{href:`https://github.com/${ao}/blob/main/LICENSE`,target:"_blank",rel:"noreferrer",children:"Apache-2.0"}),H.jsx("a",{href:"https://www.npmjs.com/package/@synsci/openscience",target:"_blank",rel:"noreferrer",children:"npm · @synsci/openscience"})]})}function Xw({text:n}){const[r,a]=We.useState(!1);return H.jsxs("button",{type:"button",className:"docs-copy",onClick:()=>{navigator.clipboard.writeText(n),a(!0),window.setTimeout(()=>a(!1),1200)},"aria-label":"copy code",title:"copy code",children:[r?H.jsx(pw,{size:13,strokeWidth:1.8}):H.jsx(gw,{size:13,strokeWidth:1.8}),H.jsx("span",{children:r?"copied":"copy"})]})}const Qw={h2({children:n}){const r=String(n).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return H.jsx("h2",{id:r,children:n})},a({href:n,children:r}){const a=n==null?void 0:n.startsWith("http"),o=n?Bc(n):void 0;return H.jsxs("a",{href:o,target:a?"_blank":void 0,rel:a?"noreferrer":void 0,children:[r,a?H.jsx(ho,{size:12,strokeWidth:1.8}):null]})},pre({children:n}){const r=gc(n);return H.jsxs("div",{className:"docs-code-wrap",children:[H.jsx(Xw,{text:r}),H.jsx("pre",{children:n})]})},code({className:n,children:r}){const a=n==null?void 0:n.startsWith("language-");return H.jsx("code",{className:a?n:"docs-inline-code",children:r})},table({children:n}){return H.jsx("div",{className:"docs-table-wrap",children:H.jsx("table",{children:n})})},blockquote({children:n}){return H.jsx("blockquote",{className:"docs-callout",children:n})}};function gc(n){if(typeof n=="string")return n;if(Array.isArray(n))return n.map(gc).join("");if(n&&typeof n=="object"&&"props"in n){const r=n.props;return gc((r==null?void 0:r.children)??"")}return""}function po({children:n}){return n.trim()?H.jsx(Jk,{remarkPlugins:[sw],components:Qw,children:n}):null}function Jg({card:n}){const r=n.href.startsWith("http");return H.jsxs("a",{className:n.horizontal?"docs-card docs-card-horizontal":"docs-card",href:Bc(n.href),target:r?"_blank":void 0,rel:r?"noreferrer":void 0,children:[H.jsx("span",{className:"docs-card-icon",children:Yw(n)}),H.jsxs("span",{className:"docs-card-copy",children:[H.jsx("strong",{children:n.title}),H.jsx("small",{children:n.body})]}),H.jsx(ho,{size:14,strokeWidth:1.8})]})}function Zw({source:n,cols:r}){const a=Ig(n);return a.length===0?null:H.jsx("div",{className:"docs-card-grid",style:{"--docs-card-cols":String(r)},children:a.map(o=>H.jsx(Jg,{card:o},`${o.title}-${o.href}`))})}function Kw({source:n}){const r=Array.from(n.matchAll(/]*)>\s*([\s\S]*?)\s*<\/Step>/g)).map(a=>{const o=Hc(a[1]??"");return{title:String(o.title??"Step"),body:qc(a[2]??"").trim()}});return r.length===0?null:H.jsx("div",{className:"docs-step-list",children:r.map((a,o)=>H.jsxs("section",{className:"docs-step",children:[H.jsx("span",{children:o+1}),H.jsxs("div",{children:[H.jsx("h3",{children:a.title}),H.jsx(po,{children:a.body})]})]},`${a.title}-${o}`))})}function Fw({children:n}){return H.jsx("blockquote",{className:"docs-callout docs-callout-warning",children:H.jsx(po,{children:qc(n).trim()})})}function Iw(n){const r=[],a=/<(Columns|CardGroup)\b([^>]*)>\s*([\s\S]*?)\s*<\/\1>|]*)>\s*([\s\S]*?)\s*<\/Card>|\s*([\s\S]*?)\s*<\/Steps>|\s*([\s\S]*?)\s*<\/Warning>|/g;let o=0,c=0;for(const f of n.matchAll(a)){const p=f.index??0,m=n.slice(o,p);if(m.trim()&&r.push(H.jsx(po,{children:m},`md-${c++}`)),f[1]){const h=Hc(f[2]??""),b=Number(h.cols??2);r.push(H.jsx(Zw,{source:f[3]??"",cols:Number.isFinite(b)&&b>0?b:2},`cards-${c++}`))}else if(f[4]!==void 0){const h=Ig(`${f[5]??""}`)[0];h&&r.push(H.jsx(Jg,{card:h},`card-${c++}`))}else f[6]!==void 0?r.push(H.jsx(Kw,{source:f[6]??""},`steps-${c++}`)):f[7]!==void 0?r.push(H.jsx(Fw,{children:f[7]??""},`warning-${c++}`)):f[0].startsWith("Gm()),c=a.section;_a=c;const d=za[c],f=Ym[c],p=oo.find(B=>B.key===c)??oo[0],m=d[a.path]??d.index,[h,b]=We.useState(""),[y,k]=We.useState(!1),x=f.navigation.tabs,T=We.useMemo(()=>x.flatMap(B=>B.groups.flatMap(le=>ki(le.pages))).filter(B=>d[B]),[x,d]),U=We.useMemo(()=>x.find(B=>B.groups.some(le=>ki(le.pages).includes(m.path)))??x[0],[m.path,x]),Z=We.useMemo(()=>U==null?void 0:U.groups.find(B=>ki(B.pages).includes(m.path)),[m.path,U]),D=T.indexOf(m.path),F=D>0?d[T[D-1]]:null,Q=D>=0&&D{const B=oo.flatMap(J=>Ym[J.key].navigation.tabs.flatMap(O=>O.groups.flatMap(K=>ki(K.pages))).map(O=>za[J.key][O]).filter(Boolean).map(O=>({path:O.path,title:O.title,description:O.description,icon:O.icon,section:J.key,sectionLabel:J.label}))),le=h.trim().toLowerCase();return le?B.filter(J=>{var K;const $=((K=za[J.section][J.path])==null?void 0:K.body)??"";return`${J.title} ${J.description} ${J.sectionLabel} ${$}`.toLowerCase().includes(le)}).slice(0,8):B.filter(J=>J.section===c).slice(0,6)},[h,c]),re=B=>{window.location.hash=rn(B.section,B.path),o(B)};return We.useEffect(()=>{const B=()=>o(Gm());return window.addEventListener("hashchange",B),()=>window.removeEventListener("hashchange",B)},[]),We.useEffect(()=>{const B=rn(a.section,a.path);window.location.hash!==B&&window.history.replaceState(null,"",B)},[a.section,a.path]),We.useEffect(()=>{const B=le=>{var J;(le.metaKey||le.ctrlKey)&&le.key.toLowerCase()==="k"&&(le.preventDefault(),k(!0),(J=document.querySelector(".docs-search-input"))==null||J.focus())};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[]),H.jsxs("div",{className:"docs-page",children:[H.jsxs("header",{className:"docs-topbar",children:[H.jsxs("a",{href:"https://openscience.sh",className:"docs-brand",children:[H.jsx("img",{src:"/docs/favicon.svg",alt:""}),H.jsxs("span",{className:"docs-brand-text",children:[H.jsx("small",{children:"OpenScience"}),H.jsx("strong",{children:"Docs"})]})]}),H.jsxs("div",{className:"docs-search",role:"search",children:[H.jsx(Sw,{size:14,strokeWidth:1.8}),H.jsx("input",{className:"docs-search-input","aria-label":"Search documentation",value:h,onBlur:()=>window.setTimeout(()=>k(!1),120),onChange:B=>{b(B.target.value),k(!0)},onFocus:()=>k(!0),placeholder:"Search all docs...",type:"search"}),H.jsx("kbd",{children:"⌘K"}),y?H.jsx("div",{className:"docs-search-results",role:"listbox","aria-label":"documentation search results",children:oe.length>0?oe.map(B=>H.jsxs("a",{href:rn(B.section,B.path),role:"option","aria-selected":c===B.section&&a.path===B.path,onMouseDown:le=>{le.preventDefault(),re({section:B.section,path:B.path}),b(""),k(!1)},children:[H.jsx("span",{children:B.icon}),H.jsx("strong",{children:B.title}),H.jsx("small",{children:B.sectionLabel})]},`${B.section}/${B.path}`)):H.jsx("span",{className:"docs-search-empty",children:"No docs match that query."})}):null]}),H.jsxs("nav",{className:"docs-actions","aria-label":"documentation actions",children:[H.jsxs("button",{type:"button",className:"docs-theme-toggle",onClick:r,"aria-label":n==="dark"?"switch to light mode":"switch to dark mode",title:n==="dark"?"light mode":"dark mode",children:[n==="dark"?H.jsx(Ew,{size:14,strokeWidth:1.8}):H.jsx(vw,{size:14,strokeWidth:1.8}),H.jsx("span",{children:n==="dark"?"light":"dark"})]}),H.jsxs("a",{className:"docs-topbar-cta",href:((P=(L=f.navbar)==null?void 0:L.primary)==null?void 0:P.href)??"https://github.com/synthetic-sciences/openscience",children:[(((me=(he=f.navbar)==null?void 0:he.primary)==null?void 0:me.label)??"Star on GitHub").toLowerCase(),H.jsx(ho,{size:13,strokeWidth:1.8})]})]})]}),H.jsxs("div",{className:"docs-shell",children:[H.jsxs("aside",{className:"docs-sidebar","aria-label":"documentation navigation",children:[H.jsxs("div",{className:"docs-sidebar-title",children:[H.jsx("span",{children:p.label}),H.jsx("small",{children:p.tagline})]}),x.length>1?H.jsx("nav",{className:"docs-section-tabs","aria-label":"documentation sections",children:x.map(B=>{const le=B.groups.flatMap(J=>ki(J.pages)).find(J=>d[J]);return le?H.jsx("a",{className:(U==null?void 0:U.tab)===B.tab?"active":void 0,href:rn(c,le),onClick:()=>re({section:c,path:le}),children:B.tab},B.tab):null})}):null,U?H.jsx("div",{children:U.groups.map(B=>H.jsxs("div",{className:"docs-sidebar-group",children:[H.jsx("span",{children:B.group}),ki(B.pages).map(le=>{const J=d[le];return J?H.jsxs("a",{href:rn(c,le),className:a.path===le?"active":void 0,onClick:()=>re({section:c,path:le}),children:[H.jsx("span",{children:J.icon}),J.title]},le):null})]},B.group))},U.tab):null]}),H.jsxs("main",{className:"docs-main",children:[H.jsxs("nav",{className:"docs-breadcrumbs","aria-label":"breadcrumbs",children:[H.jsx("a",{href:rn(c,"index"),children:p.label}),H.jsx(Um,{size:13,strokeWidth:1.8}),Z?H.jsx("span",{children:Z.group}):null]}),H.jsxs("section",{className:"docs-hero",children:[H.jsx("h1",{children:m.title}),m.description?H.jsx("p",{children:m.description}):null]}),H.jsx("article",{className:"docs-markdown",children:Iw(m.body)}),H.jsxs("nav",{className:"docs-pagination","aria-label":"documentation pagination",children:[F?H.jsxs("a",{href:rn(c,F.path),onClick:()=>re({section:c,path:F.path}),children:[H.jsx(mw,{size:16,strokeWidth:1.8}),H.jsxs("span",{children:[H.jsx("small",{children:"Previous"}),F.title]})]}):H.jsx("span",{}),Q?H.jsxs("a",{href:rn(c,Q.path),onClick:()=>re({section:c,path:Q.path}),children:[H.jsxs("span",{children:[H.jsx("small",{children:"Next"}),Q.title]}),H.jsx(Um,{size:16,strokeWidth:1.8})]}):H.jsx("span",{})]})]}),H.jsxs("aside",{className:"docs-toc","aria-label":"on this page",children:[H.jsx("span",{children:"On this page"}),m.headings.length>0?m.headings.map(B=>H.jsx("a",{href:`#${B.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}`,children:B},B)):H.jsx("span",{className:"docs-toc-empty",children:"No sections"}),(((j=f.navigation.global)==null?void 0:j.anchors)??[]).length>0?H.jsxs("div",{className:"docs-agent-links",children:[H.jsx("span",{children:"Agent resources"}),(((te=f.navigation.global)==null?void 0:te.anchors)??[]).map(B=>H.jsxs("a",{href:B.href,target:B.href.startsWith("http")?"_blank":void 0,rel:"noreferrer",children:[B.anchor,H.jsx(ho,{size:11,strokeWidth:1.8})]},B.href))]}):null]})]}),H.jsx("style",{children:$w})]})}const $w=` +`)}function Ig(n){return Array.from(n.matchAll(/]*)>\s*([\s\S]*?)\s*<\/Card>/g)).map(r=>{const a=Hc(r[1]??"");return{title:String(a.title??"Untitled"),href:String(a.href??"#"),icon:a.icon?String(a.icon):void 0,horizontal:!!a.horizontal,body:qc(r[2]??"").trim()}})}function Yw(n){var a;const r=Bc(n.href);if(r&&r.startsWith("#/")){const o=qw(r),c=r.replace(/^#\/?/,"").replace(/\/$/,"").split("/").slice(1).join("/"),d=(a=za[o])==null?void 0:a[c];if(d)return d.icon}return H.jsx(Fg,{size:17,strokeWidth:1.8})}const ao="synthetic-sciences/openscience";function Gw(n){return n>=1e3?`${(n/1e3).toFixed(1).replace(/\.0$/,"")}k`:String(n)}function Vw(){const[n,r]=We.useState(null);return We.useEffect(()=>{let a=!1;const o=`docs-gh-stars:${ao}`;try{const c=JSON.parse(window.localStorage.getItem(o)??"null");if(c&&Date.now()-c.at<3600*1e3){r(c.stars);return}}catch{}return fetch(`https://api.github.com/repos/${ao}`).then(c=>c.ok?c.json():null).then(c=>{const d=c==null?void 0:c.stargazers_count;if(!(typeof d!="number"||a)){r(d);try{window.localStorage.setItem(o,JSON.stringify({stars:d,at:Date.now()}))}catch{}}}).catch(()=>{}),()=>{a=!0}},[]),H.jsxs("div",{className:"docs-ghstars",children:[H.jsxs("a",{className:"docs-ghstars-primary",href:`https://github.com/${ao}`,target:"_blank",rel:"noreferrer",children:[H.jsx(Cw,{size:13,strokeWidth:1.8}),H.jsx("span",{children:"Star on GitHub"}),n!==null?H.jsx("em",{children:Gw(n)}):null]}),H.jsx("a",{href:`https://github.com/${ao}/blob/main/LICENSE`,target:"_blank",rel:"noreferrer",children:"Apache-2.0"}),H.jsx("a",{href:"https://www.npmjs.com/package/@synsci/openscience",target:"_blank",rel:"noreferrer",children:"npm · @synsci/openscience"})]})}function Xw({text:n}){const[r,a]=We.useState(!1);return H.jsxs("button",{type:"button",className:"docs-copy",onClick:()=>{navigator.clipboard.writeText(n),a(!0),window.setTimeout(()=>a(!1),1200)},"aria-label":"copy code",title:"copy code",children:[r?H.jsx(pw,{size:13,strokeWidth:1.8}):H.jsx(gw,{size:13,strokeWidth:1.8}),H.jsx("span",{children:r?"copied":"copy"})]})}const Qw={h2({children:n}){const r=String(n).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return H.jsx("h2",{id:r,children:n})},a({href:n,children:r}){const a=n==null?void 0:n.startsWith("http"),o=n?Bc(n):void 0;return H.jsxs("a",{href:o,target:a?"_blank":void 0,rel:a?"noreferrer":void 0,children:[r,a?H.jsx(ho,{size:12,strokeWidth:1.8}):null]})},pre({children:n}){const r=gc(n);return H.jsxs("div",{className:"docs-code-wrap",children:[H.jsx(Xw,{text:r}),H.jsx("pre",{children:n})]})},code({className:n,children:r}){const a=n==null?void 0:n.startsWith("language-");return H.jsx("code",{className:a?n:"docs-inline-code",children:r})},table({children:n}){return H.jsx("div",{className:"docs-table-wrap",children:H.jsx("table",{children:n})})},blockquote({children:n}){return H.jsx("blockquote",{className:"docs-callout",children:n})}};function gc(n){if(typeof n=="string")return n;if(Array.isArray(n))return n.map(gc).join("");if(n&&typeof n=="object"&&"props"in n){const r=n.props;return gc((r==null?void 0:r.children)??"")}return""}function po({children:n}){return n.trim()?H.jsx(Jk,{remarkPlugins:[sw],components:Qw,children:n}):null}function Jg({card:n}){const r=n.href.startsWith("http");return H.jsxs("a",{className:n.horizontal?"docs-card docs-card-horizontal":"docs-card",href:Bc(n.href),target:r?"_blank":void 0,rel:r?"noreferrer":void 0,children:[H.jsx("span",{className:"docs-card-icon",children:Yw(n)}),H.jsxs("span",{className:"docs-card-copy",children:[H.jsx("strong",{children:n.title}),H.jsx("small",{children:n.body})]}),H.jsx(ho,{size:14,strokeWidth:1.8})]})}function Zw({source:n,cols:r}){const a=Ig(n);return a.length===0?null:H.jsx("div",{className:"docs-card-grid",style:{"--docs-card-cols":String(r)},children:a.map(o=>H.jsx(Jg,{card:o},`${o.title}-${o.href}`))})}function Kw({source:n}){const r=Array.from(n.matchAll(/]*)>\s*([\s\S]*?)\s*<\/Step>/g)).map(a=>{const o=Hc(a[1]??"");return{title:String(o.title??"Step"),body:qc(a[2]??"").trim()}});return r.length===0?null:H.jsx("div",{className:"docs-step-list",children:r.map((a,o)=>H.jsxs("section",{className:"docs-step",children:[H.jsx("span",{children:o+1}),H.jsxs("div",{children:[H.jsx("h3",{children:a.title}),H.jsx(po,{children:a.body})]})]},`${a.title}-${o}`))})}function Fw({children:n}){return H.jsx("blockquote",{className:"docs-callout docs-callout-warning",children:H.jsx(po,{children:qc(n).trim()})})}function Iw(n){const r=[],a=/<(Columns|CardGroup)\b([^>]*)>\s*([\s\S]*?)\s*<\/\1>|]*)>\s*([\s\S]*?)\s*<\/Card>|\s*([\s\S]*?)\s*<\/Steps>|\s*([\s\S]*?)\s*<\/Warning>|/g;let o=0,c=0;for(const f of n.matchAll(a)){const p=f.index??0,m=n.slice(o,p);if(m.trim()&&r.push(H.jsx(po,{children:m},`md-${c++}`)),f[1]){const h=Hc(f[2]??""),b=Number(h.cols??2);r.push(H.jsx(Zw,{source:f[3]??"",cols:Number.isFinite(b)&&b>0?b:2},`cards-${c++}`))}else if(f[4]!==void 0){const h=Ig(`${f[5]??""}`)[0];h&&r.push(H.jsx(Jg,{card:h},`card-${c++}`))}else f[6]!==void 0?r.push(H.jsx(Kw,{source:f[6]??""},`steps-${c++}`)):f[7]!==void 0?r.push(H.jsx(Fw,{children:f[7]??""},`warning-${c++}`)):f[0].startsWith("Gm()),c=a.section;_a=c;const d=za[c],f=Ym[c],p=oo.find(B=>B.key===c)??oo[0],m=d[a.path]??d.index,[h,b]=We.useState(""),[y,k]=We.useState(!1),x=f.navigation.tabs,T=We.useMemo(()=>x.flatMap(B=>B.groups.flatMap(le=>ki(le.pages))).filter(B=>d[B]),[x,d]),U=We.useMemo(()=>x.find(B=>B.groups.some(le=>ki(le.pages).includes(m.path)))??x[0],[m.path,x]),Z=We.useMemo(()=>U==null?void 0:U.groups.find(B=>ki(B.pages).includes(m.path)),[m.path,U]),D=T.indexOf(m.path),F=D>0?d[T[D-1]]:null,Q=D>=0&&D{const B=oo.flatMap(J=>Ym[J.key].navigation.tabs.flatMap(O=>O.groups.flatMap(K=>ki(K.pages))).map(O=>za[J.key][O]).filter(Boolean).map(O=>({path:O.path,title:O.title,description:O.description,icon:O.icon,section:J.key,sectionLabel:J.label}))),le=h.trim().toLowerCase();return le?B.filter(J=>{var K;const $=((K=za[J.section][J.path])==null?void 0:K.body)??"";return`${J.title} ${J.description} ${J.sectionLabel} ${$}`.toLowerCase().includes(le)}).slice(0,8):B.filter(J=>J.section===c).slice(0,6)},[h,c]),re=B=>{window.location.hash=rn(B.section,B.path),o(B)};return We.useEffect(()=>{const B=()=>o(Gm());return window.addEventListener("hashchange",B),()=>window.removeEventListener("hashchange",B)},[]),We.useEffect(()=>{const B=rn(a.section,a.path);window.location.hash!==B&&window.history.replaceState(null,"",B)},[a.section,a.path]),We.useEffect(()=>{const B=le=>{var J;(le.metaKey||le.ctrlKey)&&le.key.toLowerCase()==="k"&&(le.preventDefault(),k(!0),(J=document.querySelector(".docs-search-input"))==null||J.focus())};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[]),H.jsxs("div",{className:"docs-page",children:[H.jsxs("header",{className:"docs-topbar",children:[H.jsxs("a",{href:"https://openscience.sh",className:"docs-brand",children:[H.jsx("img",{src:"/docs/favicon.svg",alt:""}),H.jsxs("span",{className:"docs-brand-text",children:[H.jsx("small",{children:"OpenScience"}),H.jsx("strong",{children:"Docs"})]})]}),H.jsxs("div",{className:"docs-search",role:"search",children:[H.jsx(Sw,{size:14,strokeWidth:1.8}),H.jsx("input",{className:"docs-search-input","aria-label":"Search documentation",value:h,onBlur:()=>window.setTimeout(()=>k(!1),120),onChange:B=>{b(B.target.value),k(!0)},onFocus:()=>k(!0),placeholder:"Search all docs...",type:"search"}),H.jsx("kbd",{children:"⌘K"}),y?H.jsx("div",{className:"docs-search-results",role:"listbox","aria-label":"documentation search results",children:oe.length>0?oe.map(B=>H.jsxs("a",{href:rn(B.section,B.path),role:"option","aria-selected":c===B.section&&a.path===B.path,onMouseDown:le=>{le.preventDefault(),re({section:B.section,path:B.path}),b(""),k(!1)},children:[H.jsx("span",{children:B.icon}),H.jsx("strong",{children:B.title}),H.jsx("small",{children:B.sectionLabel})]},`${B.section}/${B.path}`)):H.jsx("span",{className:"docs-search-empty",children:"No docs match that query."})}):null]}),H.jsxs("nav",{className:"docs-actions","aria-label":"documentation actions",children:[H.jsxs("button",{type:"button",className:"docs-theme-toggle",onClick:r,"aria-label":n==="dark"?"switch to light mode":"switch to dark mode",title:n==="dark"?"light mode":"dark mode",children:[n==="dark"?H.jsx(Aw,{size:14,strokeWidth:1.8}):H.jsx(vw,{size:14,strokeWidth:1.8}),H.jsx("span",{children:n==="dark"?"light":"dark"})]}),H.jsxs("a",{className:"docs-topbar-cta",href:((P=(L=f.navbar)==null?void 0:L.primary)==null?void 0:P.href)??"https://github.com/synthetic-sciences/openscience",children:[(((me=(he=f.navbar)==null?void 0:he.primary)==null?void 0:me.label)??"Star on GitHub").toLowerCase(),H.jsx(ho,{size:13,strokeWidth:1.8})]})]})]}),H.jsxs("div",{className:"docs-shell",children:[H.jsxs("aside",{className:"docs-sidebar","aria-label":"documentation navigation",children:[H.jsxs("div",{className:"docs-sidebar-title",children:[H.jsx("span",{children:p.label}),H.jsx("small",{children:p.tagline})]}),x.length>1?H.jsx("nav",{className:"docs-section-tabs","aria-label":"documentation sections",children:x.map(B=>{const le=B.groups.flatMap(J=>ki(J.pages)).find(J=>d[J]);return le?H.jsx("a",{className:(U==null?void 0:U.tab)===B.tab?"active":void 0,href:rn(c,le),onClick:()=>re({section:c,path:le}),children:B.tab},B.tab):null})}):null,U?H.jsx("div",{children:U.groups.map(B=>H.jsxs("div",{className:"docs-sidebar-group",children:[H.jsx("span",{children:B.group}),ki(B.pages).map(le=>{const J=d[le];return J?H.jsxs("a",{href:rn(c,le),className:a.path===le?"active":void 0,onClick:()=>re({section:c,path:le}),children:[H.jsx("span",{children:J.icon}),J.title]},le):null})]},B.group))},U.tab):null]}),H.jsxs("main",{className:"docs-main",children:[H.jsxs("nav",{className:"docs-breadcrumbs","aria-label":"breadcrumbs",children:[H.jsx("a",{href:rn(c,"index"),children:p.label}),H.jsx(Um,{size:13,strokeWidth:1.8}),Z?H.jsx("span",{children:Z.group}):null]}),H.jsxs("section",{className:"docs-hero",children:[H.jsx("h1",{children:m.title}),m.description?H.jsx("p",{children:m.description}):null]}),H.jsx("article",{className:"docs-markdown",children:Iw(m.body)}),H.jsxs("nav",{className:"docs-pagination","aria-label":"documentation pagination",children:[F?H.jsxs("a",{href:rn(c,F.path),onClick:()=>re({section:c,path:F.path}),children:[H.jsx(mw,{size:16,strokeWidth:1.8}),H.jsxs("span",{children:[H.jsx("small",{children:"Previous"}),F.title]})]}):H.jsx("span",{}),Q?H.jsxs("a",{href:rn(c,Q.path),onClick:()=>re({section:c,path:Q.path}),children:[H.jsxs("span",{children:[H.jsx("small",{children:"Next"}),Q.title]}),H.jsx(Um,{size:16,strokeWidth:1.8})]}):H.jsx("span",{})]})]}),H.jsxs("aside",{className:"docs-toc","aria-label":"on this page",children:[H.jsx("span",{children:"On this page"}),m.headings.length>0?m.headings.map(B=>H.jsx("a",{href:`#${B.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}`,children:B},B)):H.jsx("span",{className:"docs-toc-empty",children:"No sections"}),(((N=f.navigation.global)==null?void 0:N.anchors)??[]).length>0?H.jsxs("div",{className:"docs-agent-links",children:[H.jsx("span",{children:"Agent resources"}),(((te=f.navigation.global)==null?void 0:te.anchors)??[]).map(B=>H.jsxs("a",{href:B.href,target:B.href.startsWith("http")?"_blank":void 0,rel:"noreferrer",children:[B.anchor,H.jsx(ho,{size:11,strokeWidth:1.8})]},B.href))]}):null]})]}),H.jsx("style",{children:$w})]})}const $w=` .docs-page { --color-bg: #fafbfc; --color-bg-subtle: #f1f3f5; diff --git a/frontend/landing/public/docs/index.html b/frontend/landing/public/docs/index.html index 42d75ea9..cdbe4ab8 100644 --- a/frontend/landing/public/docs/index.html +++ b/frontend/landing/public/docs/index.html @@ -14,7 +14,7 @@ - + diff --git a/frontend/workspace/src/components/prompt-input-surface.test.ts b/frontend/workspace/src/components/prompt-input-surface.test.ts index cd2120fe..df1e21ce 100644 --- a/frontend/workspace/src/components/prompt-input-surface.test.ts +++ b/frontend/workspace/src/components/prompt-input-surface.test.ts @@ -58,7 +58,9 @@ describe("floating prompt surface", () => { expect(source).toContain('role="group"') expect(source).toContain('aria-label="Composer tools"') expect(source).toContain('aria-label="Model and send"') - expect(source).toContain("aria-label={`Research tools, ${researchEffortLabel(effort())} effort`}") + expect(source).toContain( + "aria-label={`Research tools, ${researchEffortLabel(effort())} effort, ${researchAccessLabel()}`}", + ) expect(popover).toContain("aria-label={`Model: ${control().trigger}`}") expect(source).not.toContain('aria-label="Research capabilities"') expect(source).not.toContain("workspace-composer__overflow") @@ -176,6 +178,19 @@ describe("composer control consolidation", () => { expect(componentCss).not.toContain(".workspace-composer__effort") }) + test("offers three real action-approval modes inside Research tools", () => { + expect(source).toContain("data-research-access={option.value}") + expect(source).toContain('aria-label="How should OpenScience actions be approved?"') + expect(source).toContain("sdk.client.project.trust.get({ projectID, directory: sdk.directory })") + expect(source).toContain("sdk.client.project.trust.update({") + expect(source).toContain('sdk.request("/settings/sandbox", init)') + expect(source).toContain('sdk.event.on("project.trust.changed"') + expect(source).toContain('sdk.event.on("server.instance.disposed"') + expect(source).toContain("onKeyDown={navigateResearchAccess}") + expect(componentCss).toContain(".workspace-composer__research-access-options > button") + expect(componentCss).toContain('button[data-tone="warning"][aria-checked="true"]') + }) + test("sends the selected research effort through the SDK prompt", () => { expect(source).toContain("const researchEffort = effort()") expect(source).toContain("effort: researchEffort") diff --git a/frontend/workspace/src/components/prompt-input.css b/frontend/workspace/src/components/prompt-input.css index 70ca8f0e..2c1a786e 100644 --- a/frontend/workspace/src/components/prompt-input.css +++ b/frontend/workspace/src/components/prompt-input.css @@ -507,7 +507,7 @@ form.workspace-composer .workspace-composer__research-tools-menu { bottom: calc(100% + var(--space-2)); left: 0; z-index: 40; - width: min(292px, calc(100vw - 24px)); + width: min(336px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 0; @@ -606,6 +606,113 @@ form.workspace-composer .workspace-composer__research-effort-options > button:ac transform: scale(0.98); } +form.workspace-composer .workspace-composer__research-access { + padding: 7px; + border-top: 1px solid var(--color-border); +} + +form.workspace-composer .workspace-composer__research-access-options { + display: flex; + flex-direction: column; + gap: 2px; + margin-top: 5px; +} + +form.workspace-composer .workspace-composer__research-access-options > button { + width: 100%; + min-height: 48px; + display: grid; + grid-template-columns: 18px minmax(0, 1fr) 16px; + align-items: center; + gap: 8px; + padding: 6px 8px; + border: 0; + border-radius: var(--radius-sm); + background: transparent; + color: var(--text-base); + font: inherit; + text-align: left; + cursor: pointer; + transition: + background-color 150ms var(--ease-standard), + color 150ms var(--ease-standard), + transform 120ms var(--ease-standard); +} + +form.workspace-composer .workspace-composer__research-access-options > button:hover:not(:disabled), +form.workspace-composer .workspace-composer__research-access-options > button:focus-visible, +form.workspace-composer .workspace-composer__research-access-options > button[aria-checked="true"] { + background: var(--color-bg-subtle, var(--surface-raised-base-hover)); +} + +form.workspace-composer .workspace-composer__research-access-options > button:focus-visible { + outline: 2px solid var(--focus-lit-ring); + outline-offset: -2px; +} + +form.workspace-composer .workspace-composer__research-access-options > button:active:not(:disabled) { + transform: scale(0.985); +} + +form.workspace-composer .workspace-composer__research-access-options > button:disabled { + cursor: wait; + opacity: 0.62; +} + +form.workspace-composer .workspace-composer__research-access-options > button > [data-component="icon"] { + color: var(--text-weaker); +} + +form.workspace-composer .workspace-composer__research-access-options > button[data-tone="warning"][aria-checked="true"], +form.workspace-composer + .workspace-composer__research-access-options + > button[data-tone="warning"][aria-checked="true"] + > [data-component="icon"] { + color: var(--color-warning, var(--text-warning-base)); +} + +form.workspace-composer .workspace-composer__research-access-copy { + min-width: 0; + display: flex; + flex-direction: column; + gap: 1px; +} + +form.workspace-composer .workspace-composer__research-access-copy strong { + color: currentColor; + font-size: 12px; + font-weight: var(--font-weight-medium); + line-height: 16px; +} + +form.workspace-composer .workspace-composer__research-access-copy small { + overflow: hidden; + color: var(--text-weak); + font-size: 11px; + font-weight: var(--font-weight-regular); + line-height: 15px; + text-overflow: ellipsis; + white-space: nowrap; +} + +form.workspace-composer .workspace-composer__research-access-retry { + width: 100%; + min-height: 32px; + margin-top: 5px; + border: 0; + border-radius: var(--radius-sm); + background: var(--surface-critical-weak); + color: var(--text-critical-base); + font: inherit; + font-size: 11px; + cursor: pointer; +} + +form.workspace-composer .workspace-composer__research-access-retry:focus-visible { + outline: 2px solid var(--focus-lit-ring); + outline-offset: -2px; +} + form.workspace-composer .workspace-composer__research-tools-actions { display: flex; flex-direction: column; diff --git a/frontend/workspace/src/components/prompt-input.tsx b/frontend/workspace/src/components/prompt-input.tsx index 5fc4541e..7759bf46 100644 --- a/frontend/workspace/src/components/prompt-input.tsx +++ b/frontend/workspace/src/components/prompt-input.tsx @@ -10,6 +10,7 @@ import { Switch, Match, createMemo, + createResource, createSignal, } from "solid-js" import { createStore, produce } from "solid-js/store" @@ -68,6 +69,12 @@ import { type ResearchEffort, } from "./prompt-capabilities" import { canRestoreFailedSubmission } from "./prompt-submission" +import { + RESEARCH_ACCESS_OPTIONS, + researchAccessMode, + researchAccessMutations, + type ResearchAccessMode, +} from "./research-access" type PendingPrompt = { abort: AbortController @@ -93,6 +100,16 @@ interface SlashCommand { type: "builtin" | "custom" | "skill" } +interface ResearchAccessSnapshot { + root: string + trusted: boolean + sandboxEnabled: boolean +} + +interface SandboxSettingsPayload { + config: { enabled?: boolean } +} + export const PromptInput: Component = (props) => { const navigate = useNavigate() const sdk = useSDK() @@ -141,6 +158,106 @@ export const PromptInput: Component = (props) => { if (sessionID) setEfforts("sessions", sessionID, value) } + const readSandboxSettings = async (init?: RequestInit) => { + const response = await sdk.request("/settings/sandbox", init) + if (!response.ok) { + const detail = await response.text().catch(() => "") + throw new Error(detail || `${response.status} ${response.statusText}`) + } + return (await response.json()) as SandboxSettingsPayload + } + const loadResearchAccess = async (projectID: string): Promise => { + const [trust, sandbox] = await Promise.all([ + sdk.client.project.trust.get({ projectID, directory: sdk.directory }), + readSandboxSettings(), + ]) + if (!trust.data) throw new Error("Project trust status was empty.") + return { + root: trust.data.root, + trusted: trust.data.canExecuteProjectCode, + sandboxEnabled: sandbox.config.enabled !== false, + } + } + const [researchAccess, researchAccessControls] = createResource(() => sdk.projectID || false, loadResearchAccess) + const [researchAccessSaving, setResearchAccessSaving] = createSignal(false) + const selectedResearchAccess = createMemo(() => { + const current = researchAccess() + return current ? researchAccessMode(current) : "full" + }) + const researchAccessLabel = createMemo( + () => RESEARCH_ACCESS_OPTIONS.find((option) => option.value === selectedResearchAccess())?.label ?? "Full access", + ) + + const applyResearchAccess = async (mode: ResearchAccessMode, target: HTMLButtonElement) => { + target.focus() + const projectID = sdk.projectID + const initial = researchAccess() + if (!projectID || !initial || researchAccessSaving()) return + if (researchAccessMode(initial) === mode) return + + setResearchAccessSaving(true) + try { + let current = { ...initial } + for (const mutation of researchAccessMutations(mode)) { + if (mutation.kind === "sandbox") { + if (current.sandboxEnabled === mutation.enabled) continue + const sandbox = await readSandboxSettings({ + method: "PUT", + headers: { "content-type": "application/json" }, + body: JSON.stringify({ enabled: mutation.enabled }), + }) + current.sandboxEnabled = sandbox.config.enabled !== false + continue + } + + if (current.trusted === mutation.trusted) continue + const trust = await sdk.client.project.trust.update({ + projectID, + directory: sdk.directory, + body: mutation.trusted ? { trusted: true, root: current.root } : { trusted: false }, + }) + if (!trust.data) throw new Error("Project trust update was empty.") + current = { + ...current, + root: trust.data.root, + trusted: trust.data.canExecuteProjectCode, + } + } + + const confirmed = await loadResearchAccess(projectID) + researchAccessControls.mutate(confirmed) + const effective = researchAccessMode(confirmed) + if (effective !== mode) { + showToast({ + title: "Access is limited by managed settings", + description: `The effective mode remains ${RESEARCH_ACCESS_OPTIONS.find((option) => option.value === effective)?.label}.`, + }) + return + } + showToast({ variant: "success", title: `${researchAccessLabel()} enabled` }) + } catch (error) { + showToast({ + title: "Couldn't update action approval", + description: error instanceof Error ? error.message : String(error), + }) + void researchAccessControls.refetch() + } finally { + setResearchAccessSaving(false) + } + } + + const refreshResearchAccess = () => { + if (!sdk.projectID || researchAccessSaving()) return + void researchAccessControls.refetch() + } + const trustSubscription = sdk.event.on("project.trust.changed", (event) => { + if (event.properties.status.projectID !== sdk.projectID) return + refreshResearchAccess() + }) + const instanceSubscription = sdk.event.on("server.instance.disposed", refreshResearchAccess) + onCleanup(trustSubscription) + onCleanup(instanceSubscription) + const mirror = { input: false } const scrollCursorIntoView = () => { @@ -229,6 +346,30 @@ export const PromptInput: Component = (props) => { selectResearchEffort(value, choice) } + const navigateResearchAccess = (event: KeyboardEvent) => { + if (!["ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) return + const target = event.target + const scope = event.currentTarget + if (!(target instanceof HTMLButtonElement) || target.getAttribute("role") !== "radio") return + if (!(scope instanceof HTMLElement)) return + const choices = Array.from(scope.querySelectorAll('[role="radio"]')) + const index = choices.indexOf(target) + if (index < 0 || choices.length === 0) return + const next = + event.key === "Home" + ? 0 + : event.key === "End" + ? choices.length - 1 + : event.key === "ArrowDown" + ? (index + 1) % choices.length + : (index <= 0 ? choices.length : index) - 1 + const choice = choices[next] + const value = choice?.dataset.researchAccess + if (!choice || (value !== "ask" && value !== "approve" && value !== "full")) return + event.preventDefault() + void applyResearchAccess(value, choice) + } + const dismissResearchTools = (event: PointerEvent) => { if (!researchToolsRef?.open) return if (event.target instanceof Node && researchToolsRef.contains(event.target)) return @@ -2124,7 +2265,9 @@ export const PromptInput: Component = (props) => { researchToolsRef?.querySelector("summary")?.focus() }} > - + Research