diff --git a/.env.example b/.env.example index f9264920..fc93639a 100644 --- a/.env.example +++ b/.env.example @@ -72,9 +72,21 @@ # DASHBOARD_SESSION_SYNC_MS=30000 # Hourly database upkeep: a non-blocking WAL checkpoint (the WAL then shrinks -# to 64 MB) and PRAGMA optimize. 0 turns it off. Never VACUUMs. +# to 64 MB), PRAGMA optimize, the opt-in retention below and a bounded +# incremental_vacuum. 0 turns it off. Never a full VACUUM (that is Settings → +# Data → Compact, on a click). # DASHBOARD_DB_MAINTAIN_MS=3600000 +# Automatic retention (OFF unless set): finished sessions that started more +# than N days ago (1–3650) are purged by the hourly upkeep. Usually set from +# Settings → Data → Session cleanup, which writes it to the settings file. +# AGENTHUB_RETENTION_DAYS=90 + +# Update check interval (ms, default 3600000 = 1 h, minimum 60000). A tick +# with no browser connected is skipped; the next browser to connect gets one. +# DASHBOARD_UPDATE_CHECK=0 turns the scheduled check off. +# DASHBOARD_UPDATE_CHECK_INTERVAL_MS=3600000 + # Poll interval (ms) for Antigravity CLI sessions and tokens, read from agy's # own ~/.gemini/antigravity-cli/conversations/*.db (0 disables; default: 15000). # DASHBOARD_ANTIGRAVITY_POLL_MS=15000 diff --git a/.prettierignore b/.prettierignore index 897a6bb5..fd9abeae 100644 --- a/.prettierignore +++ b/.prettierignore @@ -11,3 +11,4 @@ client/package-lock.json *.md *.yml *.yaml +server/vendor/ diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 427eafc7..cdc72f61 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -310,7 +310,7 @@ graph TD |---------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `server/index.js` | Express app setup, middleware, route mounting, static file serving in production, HTTP server creation. Static middleware sets explicit `Cache-Control` headers — `immutable` for `/assets/*`, `no-cache, must-revalidate` for `index.html` / `sw.js` / `manifest.json`, a short revalidation window otherwise — so a rebuild always replaces the in-browser bundle without a hard refresh. Runs a periodic maintenance sweep — cadence derived from `DASHBOARD_STALE_MINUTES` (¼ of the threshold, clamped to 60 s – 5 min, default ~45 min) — that abandons stale sessions with transcript cache eviction and scans active sessions for new compaction entries by reading `sessions.transcript_path` directly (an O(active sessions) lookup; the previous `SELECT DISTINCT json_extract(events.data,'$.transcript_path')` scan grew with the events table and is gone). **Error detection watchdog** runs every 15 seconds: finds active sessions with no recent hook events (>10 s stale), re-reads their transcript files looking for API errors (401 auth, rate limits, quota exhaustion), derives transcript paths from session `cwd` for imported sessions, and marks sessions/agents as `error` when API errors are found — catches cases where the CLI doesn't fire a hook after API errors. The same watchdog also performs **user-interrupt (Esc) recovery**: `Esc` fires no hook, so a cancelled turn would otherwise leave the main agent stuck `working`. It detects this two ways — (a) the transcript's `[Request interrupted by user]` marker, surfaced as `result.pendingInterrupt` from `TranscriptCache` (computed from transcript ordering alone, immune to server/transcript clock skew), and (b) an idle-working fallback for an Esc pressed *before any output* (which writes no marker): when the main agent has been `working` with `current_tool` null and neither a hook event nor the transcript mtime has advanced for `DASHBOARD_WORKING_IDLE_SECONDS` (default 120) — and moves the session to **Waiting** (agent → `waiting`, `awaiting_input_since` stamped) with an `Interrupted` event. Triggers legacy session import (with active-session detection for recently-modified JSONL files) and compaction backfill on startup, plus a boot **liveness reap** — immediately for rows from a previous run and again ~5 s later for rows the startup sync just imported (see the `routes/hooks.js` row) — so sessions that died while the dashboard was down never render as Waiting. Also starts the **Remote Data Sources** sync poller (`startRemoteSourceSync`) that pulls each enabled remote source on an interval — `DASHBOARD_REMOTE_SYNC_MS` (default 60000; 0 disables) — reusing `server/lib/remote-sync.js`. **Graceful shutdown** (SIGTERM/SIGINT) tears down in order: drop realtime clients first (`closeWebSocket` terminates WS clients so their sockets release), then `httpServer.close()` to stop new connections, then `httpServer.closeAllConnections()` to drop lingering keep-alive sockets so `close()` fires promptly, and only **then** close SQLite — inside the `close()` callback, after the HTTP server has drained. Closing the DB before drain made in-flight requests throw `The database connection is not open`; leaving WS/keep-alive sockets open stalled the shutdown until the 5 s force-exit backstop (the "waiting for graceful termination" hang under `node --watch`). A second signal forces an immediate exit | | `server/openapi.js` | OpenAPI 3.0.3 document generator for the backend API (metadata, schemas, endpoint paths), merging supplementary fragments from `server/openapi-extra/` in `createOpenApiSpec()`. Feeds the raw spec endpoint (`/api/openapi.json`), Swagger UI (`/api/docs`), **ReDoc** (`/api/redoc`, served via `server/lib/redoc.js` with a self-hosted bundle — never a CDN), and the committed `openapi.yaml` regenerated by `npm run openapi:yaml` | -| `server/lib/redoc.js` | Serves the **ReDoc** API reference (`/api/redoc`) as a self-hosted three-panel rendering of the OpenAPI spec, with the ReDoc bundle served locally from `/api/redoc/redoc.standalone.js` (bundled via the `redoc` dependency, never a CDN) so the reference works fully offline / air-gapped | +| `server/lib/redoc.js` | Serves the **ReDoc** API reference (`/api/redoc`) as a self-hosted three-panel rendering of the OpenAPI spec, with the ReDoc bundle served locally from `/api/redoc/redoc.standalone.js` (vendored under `server/vendor/redoc/` — the `redoc` npm package is not a dependency — never a CDN) so the reference works fully offline / air-gapped | | `server/openapi-extra/` | Supplementary OpenAPI path/schema fragments merged into the spec by `createOpenApiSpec()` — covers `cc-config.js`, `push.js`, `run.js`, and `misc.js` route groups | | `server/db.js` | SQLite connection with WAL mode, schema migration (CREATE TABLE IF NOT EXISTS + ALTER TABLE for column additions), all prepared statements as a reusable `stmts` object. Tries `better-sqlite3` first, falls back to `node:sqlite` via `compat-sqlite.js`. Migrations use literal defaults for ALTER TABLE since SQLite does not support expressions like `strftime()` in column defaults added via ALTER TABLE | | `server/compat-sqlite.js` | Compatibility wrapper that gives Node.js built-in `node:sqlite` (`DatabaseSync`) the same API as `better-sqlite3` — pragma, transaction, prepare. Used as automatic fallback when the native module is unavailable (Node 22+) Maps every better-sqlite3 API the server uses — `function` (the `trim_event_data` SQL function `db.js` registers at boot), `stmt.pluck()`, the `readonly`/`fileMustExist` open options — and `db.js` exports the chosen class as `Database` so other SQLite files (agy's conversations) open with the same driver. A plugin install has NO better-sqlite3 build, so this is production there; `server/__tests__/compat-sqlite.test.js` boots `db.js` with better-sqlite3 blocked because the rest of the suite never runs on it. | @@ -1066,7 +1066,7 @@ flowchart TD - Uses Node.js `http` module directly — no dependencies. - Resolution order is **env override → discovery file → default**: - `CLAUDE_DASHBOARD_PORT` forces a single target (no fan-out, no discovery). - - Otherwise `server/lib/server-info.js` reads `~/.claude/.agenthub.json`, prunes dead-PID entries, and returns one live `port` per unique `dataDir` (lowest port wins when two instances share `~/.claude/agenthub`). The handler POSTs to each returned port in parallel. The other instance learns of a lane the hooks moved through `broadcastForeignLaneChanges` (`server/routes/lanes.js`): every `DASHBOARD_LANE_SYNC_MS` (2 s) it reads `PRAGMA data_version`, which moves only on another connection's commit, and re-broadcasts each lane whose `updated_at` changed (and `removed` for a vanished one) to its own browsers. Sessions and events are not re-broadcast this way — a page on that instance shows them on its next fetch. + - Otherwise `server/lib/server-info.js` reads `~/.claude/.agenthub.json`, prunes dead-PID entries, and returns one live `port` per unique `dataDir` (lowest port wins when two instances share `~/.claude/agenthub`). The handler POSTs to each returned port in parallel. The other instance learns of a lane the hooks moved through `broadcastForeignLaneChanges` (`server/routes/lanes.js`): every `DASHBOARD_LANE_SYNC_MS` (2 s) — while `peersSharingDataDir()` finds another live dashboard on its data dir, which it checks every 30 s — it reads `PRAGMA data_version`, which moves only on another connection's commit, and re-broadcasts each lane whose `updated_at` changed (and `removed` for a vanished one) to its own browsers. Sessions and events are not re-broadcast this way — a page on that instance shows them on its next fetch. - If neither yields anything, the handler falls back to `4820`. - Per-target promises never reject — a dead listener can't starve the others, and the handler can wait on `Promise.all` for clean exit timing. @@ -1223,7 +1223,12 @@ common "nothing changed" tick is just a handful of `stat` calls), funnels them through the same `parseSessionFile` + `importSession` pipeline as every other path, and broadcasts `session_created` for newly imported sessions / `session_updated` for grown ones — the same events hooks emit, so the UI -refreshes live. All timers and watchers are `unref`'d and best-effort; nothing +refreshes live. Two kinds of transcript are not re-parsed: one whose session +hooks are feeding **live** (status `active`, newest event a hook's, a hook +within `DASHBOARD_SYNC_LIVE_HOOK_MS`, default 5 min) is left until it goes +quiet or ends — then caught up once — and one whose session a hook created +(no `imported` flag, which `importSession` skips anyway) only has its durable +snapshot refreshed, never a parse. All timers and watchers are `unref`'d and best-effort; nothing here blocks shutdown or can take down the server. ### Upload request sequence @@ -1579,7 +1584,11 @@ re-point if that changes. `DASHBOARD_CODEX_POLL_MS` beat, a first pass over every journal in the background at startup). Each file's read offset and parse state live in the `codex_rollouts` table, so an unchanged file is never re-read and a grown one is -read from where it stopped. `token_count` events are summed per `turn_context` +read from where it stopped (a pass loads every row's size/mtime in one query). +The first pass and one every five minutes walk every journal; the poll's other +passes stat only the two newest day folders plus the journals the table saw +written in the last hour (or not yet read to the end), so a thread resumed +after an hour's quiet in an older folder is picked up by the next full pass. `token_count` events are summed per `turn_context` model — `input_tokens` includes `cached_input_tokens` (stored as input − cached plus cache_read) and `output_tokens` includes reasoning. A **fork** copies its parent's whole history into its own file, token events included, so every total @@ -1654,7 +1663,9 @@ the binary's own proto descriptors. **Sessions and tokens** (`server/lib/antigravity-usage.js`, `startAntigravityUsagePoll`, every `DASHBOARD_ANTIGRAVITY_POLL_MS`, default -15000, `0` disables). agy writes one SQLite file per conversation, +15000, `0` disables; after a pass that read nothing, wrote nothing and left no +fresh session to settle it slows to once a minute until one finds work — +`server/lib/backoff-poll.js`). agy writes one SQLite file per conversation, `~/.gemini/antigravity-cli/conversations/.db`. Each is opened read-only whenever its mtime (or its non-empty `-wal`'s) changes; `antigravity_conversations` holds the mtime read, so a session the user deleted @@ -1743,7 +1754,8 @@ is ever inferred. ## Cursor Sessions `server/lib/cursor-usage.js` (`startCursorUsagePoll`, every -`DASHBOARD_CURSOR_POLL_MS`, default 15000, `0` disables) reads the agent +`DASHBOARD_CURSOR_POLL_MS`, default 15000, `0` disables; idle passes slow it to +once a minute like the Antigravity poll) reads the agent transcripts Cursor writes — the CLI (`cursor-agent`) and the editor's agent both — at `~/.cursor/projects//agent-transcripts//.jsonl` (`AGENTHUB_CURSOR_DIR` overrides `~/.cursor`). Each becomes a `sessions` row with @@ -2225,7 +2237,7 @@ sequenceDiagram | Component | Responsibility | | --- | --- | | **`server/lib/update-check.js`** | `getUpdatesStatus(root?, { skipFetch?, latestRelease? })` + `applyUpdate(root?)`. Runs every git call via `execFile` (no shell, 10s–120s timeouts) and reads the newest release over `fetch` with an `AbortSignal.timeout` — `fetchLatestRelease` NEVER throws, resolving to `{ok:false, reason}` (`no_remote`, `remote_not_http`, `no_releases`, `unreachable`, `bad_payload`, `http_`) so a status poll degrades instead of erroring. `releaseApiUrl` derives the endpoint from a repository URL (https, scp-style and `ssh://` forms) and returns null for anything not owner/repo shaped, which is what keeps local-path remotes off the network entirely. `fetchLatestRelease` finds that URL via the `origin` remote; `fetchReleaseFromUrl` takes one directly, which is how the **git-free plugin path** works: `pluginMarketplaceUrl(mkt, plugin)` reads `known_marketplaces.json` → the marketplace's `.claude-plugin/marketplace.json` → the entry's `source.url`, returning null (never a guessed host) for a `github` `owner/repo` shorthand and never throwing. **Order matters:** `detectPluginInstall` runs FIRST in `getUpdatesStatus`, ahead of the `.git` probe — a plugin cache unpacked from an archive has no `.git`, and probing first is the 1.5.1 bug that made `update_available` permanently false. `compareVersions` orders numeric triples and strips a leading `v`, since this repo carries both `v1.5.0` and `1.4.6`. `isShallowClone` gates every commit-distance calculation; `detectPluginInstall` reads the marketplace and plugin name out of the cache path. **Branch- and fork-aware** as before: resolves `/master`/`/main`/`/HEAD`, reads the current branch and its tracked upstream, and shapes `manual_command` per situation — the `claude plugin ...` commands for `plugin_managed`; `git fetch --tags && git merge --ff-only ` for `release_available`; `git pull --ff-only` when the branch tracks the canonical ref; `git fetch && git merge --ff-only ` for forks; `git fetch ` only on a feature branch or detached HEAD. Non-git installs, missing remotes, fetch failures, and unresolvable upstream refs are returned as soft payloads — never throws. | -| **`server/update-scheduler.js`** | Ticks the lib every `DASHBOARD_UPDATE_CHECK_INTERVAL_MS` (default 300 000, floor 60 000). First tick is scheduled 8s after server start with `.unref()` so it doesn't block shutdown. Broadcasts only when the fingerprint `{update_available, remote_sha, commits_behind, fetch_error, manual_command}` changes — `manual_command` is included so situation transitions (e.g. user switches branches, or adds an `upstream` remote) trigger a re-broadcast even when the SHA and commit count are unchanged. Emits a framed message to stdout on "up-to-date → behind" transitions, and only suggests "restart the dashboard" when the printed command actually rewrites the working tree. `DASHBOARD_UPDATE_CHECK=0\|false\|off` disables the scheduler entirely. | +| **`server/update-scheduler.js`** | Ticks the lib every `DASHBOARD_UPDATE_CHECK_INTERVAL_MS` (default 3 600 000 = 1 h, floor 60 000). A tick with no `/ws` browser connected (`getConnectionCount`) is skipped, and the first browser to connect afterwards (`onConnection` in `server/websocket.js`) gets one check 3 s later if the last one is older than the interval; the manual `POST /api/updates/check` is unaffected. First tick is scheduled 8s after server start with `.unref()` so it doesn't block shutdown. Broadcasts only when the fingerprint `{update_available, remote_sha, commits_behind, fetch_error, manual_command}` changes — `manual_command` is included so situation transitions (e.g. user switches branches, or adds an `upstream` remote) trigger a re-broadcast even when the SHA and commit count are unchanged. Emits a framed message to stdout on "up-to-date → behind" transitions, and only suggests "restart the dashboard" when the printed command actually rewrites the working tree. `DASHBOARD_UPDATE_CHECK=0\|false\|off` disables the scheduler entirely. | | **`server/routes/updates.js`** | Three endpoints: `GET /status` (read-only check), `POST /check` (check + broadcast), `POST /apply`. `/apply` has **two modes**, chosen by how this copy was installed, never by the request body: **checkout** — fast-forward onto the release tag, `npm run setup`, `npm run build` in production (both through the bootstrap's `npmCommand` with `NODE_ENV` dropped — `npmInvocation` in `server/lib/update-check.js` — since the server's `NODE_ENV=production` makes npm omit the client's devDependency build toolchain, and a bare `npm.cmd` is EINVAL under `execFile` on Windows), then `scheduleRestart()`; **plugin** — `applyUpdate`'s `plugin_managed` refusal is caught and `schedulePluginUpdate()` runs instead, answering `200 {applied:true, mode:"plugin"}`. The plugin branch fires only when there is genuinely something to pull (`update_available` plus a marketplace and plugin name parsed from the cache path) — a `plugin_managed` refusal with nothing newer published stays a 409 rather than spawning a chain that would stop the server for nothing. Otherwise 409 `UPDATE_NOT_APPLICABLE` with `reason` `"up_to_date"`, `"not_fast_forwardable"`, or `"plugin_managed"`. Both modes write the response BEFORE anything stops the process. Mounted under `/api/*`, so all three ride the default loopback bind as their trust boundary and are gated by `DASHBOARD_TOKEN` when one is set. | | **`server/lib/plugin-update.js`** + **`scripts/plugin-update-helper.js`** | The plugin-cache update chain. The lib only spawns the helper detached (cwd = the runtime dir, **not** the plugin root, which is about to be superseded) and clears any previous verdict first so a stale success can't be read back as this run's result. All work is in the helper because its last step SIGTERMs the server that asked for the update — the same split as `self-restart.js`, one step further. The helper re-validates the marketplace and plugin names against `/^[A-Za-z0-9][\w.-]*$/` (they reach an argv across a process boundary), resolves `claude` on PATH or at `~/.local/bin/claude` (a hook-spawned server does not inherit the login shell's PATH), picks the newest cache directory that isn't the old root and does contain `scripts/plugin-bootstrap.js`, and records **every** outcome — including an unexpected throw — to `plugin-update.json` under `~/.claude/agenthub/runtime/`, outside the cache so it survives the swap. Steps: `validate`, `resolve_claude`, `marketplace_update`, `plugin_update`, `already_current` (`ok:true`; nothing was pulled and the old server was left running), `bootstrap`, `done`. `readLastPluginUpdate()` surfaces it as `last_plugin_update` on the status payload — without it a failed chain is indistinguishable from a slow one. | | **`UpdateNotifier.tsx`** | Modal. Hydrates from `api.updates.status()` on mount and mirrors the payload back into the local `eventBus` so the Sidebar can listen without a second git fetch. Subscribes to `update_status` WS frames for ongoing sync. Keeps the dismissal key in `localStorage` (`agent-monitor-update-dismissed-sha`) and in React state — the **release tag** when one was read, else the upstream SHA, so a newer release re-opens the prompt while a dismissed one stays dismissed; a window event `dashboard:reset-update-dismissal` from the Sidebar clears both. ESC / backdrop click dismisses. | diff --git a/INSTALL.md b/INSTALL.md index 18c5b629..23d69069 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,6 +1,6 @@ # Installation -A step-by-step guide to get AgentHub — the local control surface for Claude Code agents — up and running on your machine, with optional sections for importing history and running in a container. +The one install-and-setup guide for AgentHub — the local control surface for Claude Code agents: the plugin install, a checkout install, configuration, the database, importing history, and troubleshooting. (`SETUP.md` is only a pointer here now.) ## Fastest path — install it as a Claude Code plugin @@ -17,17 +17,20 @@ on PATH — no clone, no `npm run setup`, no result and `/agenthub-open` to build the UI and get the URL. Requires Node **>= 22.5** (a plugin install has no native `better-sqlite3`, so -the server stores data through `node:sqlite`). Full behavior, including the -uninstall cleanup (`agenthub uninstall`), is in [`docs/PLUGINS.md`](docs/PLUGINS.md). +the server stores data through `node:sqlite`), plus `git` and `tmux` from +[Step 0](#step-0--system-packages). Full behavior, including the uninstall +cleanup (`agenthub uninstall`), is in [`docs/PLUGINS.md`](docs/PLUGINS.md). If +the dashboard never comes up, see +[Plugin bootstrap never comes up](#plugin-bootstrap-never-comes-up). Follow the steps below instead when you want a checkout — to develop the -dashboard, run it from source, or stay on Node 20. +dashboard or run it from source. ## Requirements | Requirement | Version | Notes | |---|---|---| -| Node.js | 20+ (22+ recommended) | Required for server and client | +| Node.js | **22.5+** | Required for server and client (`node:sqlite`). Node 20 is end-of-life and unsupported | | npm | 9+ | Comes with Node.js | | Claude Code | 2.x+ | Required for hook integration | | Git | Any | Cloning the repository, and every lane operation (worktrees, branch/status reads) | @@ -76,7 +79,7 @@ Check it: ```bash tmux -V # e.g. tmux 3.4 git --version -node -v # v20.x / v22.x / v24.x +node -v # v22.5+ / v24.x ``` Once the server is up you can ask it directly — this is the same probe the @@ -113,8 +116,8 @@ brew install node git tmux # Node >= 22.5 for the plugin install (nvm work echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc # where the plugin puts `agenthub` ``` -- **Node:** a plugin install needs **>= 22.5** (it stores data through - `node:sqlite`); a checkout still runs on Node 20. The `agenthub` launcher +- **Node:** **>= 22.5** (the plugin stores data through `node:sqlite`; a + checkout needs the same). The `agenthub` launcher pins the node that installed it and falls back to `node` on `PATH` when a `brew upgrade` or `nvm` switch deletes that binary. - **Starts at login once you turn it on (LaunchAgent).** Off by default; with @@ -172,24 +175,20 @@ cd AgentHub ## Step 2 — Install dependencies ```bash -npm run setup +npm run setup # or: make setup ``` -This installs all server and client dependencies, plus the VS Code extension, and links the `agenthub` CLI. +This runs `npm install` (whose `postinstall` hook installs the client's +dependencies in `client/`), installs `client/` once more explicitly, and links +the `agenthub` CLI (`npm link`; if that has no permission it prints how to link +it by hand). A plain `npm install` is enough to build and run the dashboard — +only the CLI link is missing. -A plain root install already covers server **and** client — a `postinstall` hook installs the client dependencies automatically, so this alone is enough to build and run the dashboard: +With `--ignore-scripts` the `postinstall` hook is skipped; install the client +yourself with `npm --prefix client install`. -```bash -npm install -``` - -`npm run setup` additionally installs the VS Code extension and links the `agenthub` CLI. (If you install with `--ignore-scripts`, the `postinstall` hook is skipped — run `cd client && npm install` manually in that case.) - -Or via Makefile: - -```bash -make setup -``` +`better-sqlite3` gyp/compile warnings here are harmless — see +[Troubleshooting](#better-sqlite3-errors-during-npm-install--npm-run-setup). --- @@ -234,7 +233,7 @@ After starting a Claude Code session, you should see: - **Dashboard** — stats updating in real-time - **Settings page** — data export and cleanup tools on the Dashboard tab; Claude Code's model pricing rules, hook configuration status and CLAUDE_HOME on **Settings → Claude Code → Overview** -If nothing appears after 30 seconds, see [SETUP.md](./SETUP.md#troubleshooting). +If nothing appears after 30 seconds, see [Troubleshooting](#no-sessions-appearing-after-starting-claude-code). ### PWA install (optional) @@ -246,57 +245,110 @@ The dashboard is a Progressive Web App. After opening it in a supported browser --- -## Step 5 — (Optional) Import existing Claude Code history +## Step 5 — (Optional) Importing existing Claude Code history -The server **automatically imports** every session under -`~/.claude/projects/` on startup, so if you've used Claude Code on this -machine before, your historical sessions, agents, events, token counts, -and cost totals should already be visible in the Sessions list. +The dashboard automatically imports sessions from `~/.claude/projects/` on +**every startup**, so if Claude Code has been used on this machine, you'll +see history immediately after the first launch. If you need to bring in +history from another machine, from a backup, or just force a rescan, use +**Settings → Import History** in the UI — it's a guided, drag-and-drop +experience with live progress. -To bring in history from another machine, a backup, or a `.tar.gz` -archive a teammate sent you, use **Settings → Import History** in the -UI. It supports three modes: +### Pick the right mode ```mermaid -flowchart LR - UI["Settings →
Import History"] --> M1["Rescan default folder
~/.claude/projects"] - UI --> M2["Scan a folder
any absolute path"] - UI --> M3["Upload files
.jsonl / .zip / .tar.gz / .gz"] - M1 --> P["Same parser as live
hook ingestion"] - M2 --> P - M3 --> P - P --> DB[("SQLite
sessions + tokens + cost")] +flowchart TD + Q["Where is the history?"] --> Q1{Is it on this machine
under ~/.claude/projects?} + Q1 -->|yes, and I just want
to re-scan| M1["Mode: Rescan default folder
one click"] + Q1 -->|yes, but in another folder
on this machine| M2["Mode: Scan a folder
paste the absolute path"] + Q1 -->|no — it's on another machine
or in an archive file| M3["Mode: Upload files
drag-drop JSONL or archive"] - style UI fill:#a855f7,stroke:#c084fc,color:#fff - style P fill:#f59e0b,stroke:#fbbf24,color:#000 - style DB fill:#10b981,stroke:#34d399,color:#fff + M3 --> PREP["Archive source:
tar -czf claude-history.tar.gz
-C ~/.claude projects"] + + style M1 fill:#10b981,stroke:#34d399,color:#fff + style M2 fill:#f59e0b,stroke:#fbbf24,color:#000 + style M3 fill:#a855f7,stroke:#c084fc,color:#fff ``` -Re-imports are idempotent: sessions are deduplicated by UUID and -compaction baselines preserve pre-compaction token totals, so running -the importer twice never double-counts tokens or cost. +### Step-by-step: moving history from one machine to another -Verify it worked by opening the **Analytics** page and checking that -per-model token totals and estimated cost look correct. Full walkthrough -with per-OS archive commands in -[SETUP.md → Importing existing Claude Code history](./SETUP.md#importing-existing-claude-code-history). -### Optional: tune import limits +**On the source machine**, bundle the projects folder: -If you regularly import very large archives, these environment variables -can be raised (the defaults are generous for typical use): +```bash +# macOS / Linux +tar -czf claude-history.tar.gz -C ~/.claude projects -| Variable | Default | Purpose | -| --------------------------------- | ------- | ----------------------------------------------------------- | -| `AGENTHUB_IMPORT_MAX_BYTES` | 1 GB | Maximum size per uploaded file | -| `AGENTHUB_IMPORT_MAX_FILES` | 2000 | Maximum files per upload request | -| `AGENTHUB_IMPORT_MAX_EXTRACT_BYTES` | 4 GB | Ceiling on uncompressed bytes per archive (zip-bomb guard) | +# Windows (PowerShell, via built-in tar) +tar -czf claude-history.tar.gz -C "$env:USERPROFILE\.claude" projects +``` -Set them before `npm run dev` or `npm start`: +Transfer the resulting `claude-history.tar.gz` to the destination machine +however you like — AirDrop, `scp`, USB, cloud storage. + +**On the destination machine**, in the dashboard: + +1. Open **Settings → Import History**. +2. Pick **Upload files** (the third tab). +3. Drag the archive onto the drop zone. +4. Click **Upload & Import** and watch the progress. +5. When the green result card appears, open **Analytics → Cost** to confirm + per-model token totals and estimated cost. + +### Supported inputs + +Any of the following can be dropped onto the upload zone or found inside a +folder given to **Scan a folder**: + +- `.jsonl` — session transcripts +- `.meta.json` — subagent metadata sidecars +- `.zip` — extracted with path-traversal protection +- `.tar`, `.tar.gz`, `.tgz` — extracted via the `tar` package +- `.gz` — single gzipped JSONL (streaming-decompressed) + +### Accuracy guarantees + +- **Idempotent** — re-importing never double-counts. Sessions are + deduplicated by UUID. +- **Cost-preserving** — the `token_usage` table uses `baseline_*` columns + to preserve pre-compaction token totals, so re-ingesting a compacted + transcript never erases historical cost. +- **Same parser as live** — `parseSessionFile` + `importSession` is the + single source of truth for both hook-driven ingestion and manual + import, so imported numbers match captured numbers exactly. + +### Safety + +Archive extraction is hardened against path traversal and archive bombs. +The defaults are generous for real-world transcripts but tight enough to +stop obvious attacks. If you regularly import very large archives, raise them +before `npm run dev` or `npm start` (also listed under +[Environment variables](#environment-variables)): + +| Variable | Default | Purpose | +| ----------------------------------- | ------- | ---------------------------------------------------------- | +| `AGENTHUB_IMPORT_MAX_BYTES` | 1 GB | Maximum size per uploaded file | +| `AGENTHUB_IMPORT_MAX_FILES` | 2000 | Maximum files per upload request | +| `AGENTHUB_IMPORT_MAX_EXTRACT_BYTES` | 4 GB | Ceiling on uncompressed bytes per archive (zip-bomb guard) | ```bash AGENTHUB_IMPORT_MAX_EXTRACT_BYTES=17179869184 npm start # allow 16 GB extraction ``` +### CLI alternative + +For scripts and automation, the same logic runs from the terminal: + +```bash +# Import (or re-import) everything under ~/.claude/projects +npm run import-history + +# Dry run — show what would be imported without writing +node scripts/import-history.js --dry-run + +# Scope to a single project dir +node scripts/import-history.js --project my-project +``` + --- ## Production mode @@ -328,44 +380,260 @@ and, for plugin installs, [`docs/PLUGINS.md` → Auto-start on boot](docs/PLUGIN --- -## Optional: Agent extension packs +## How it works -This repository includes extension packs for both Claude Code and Codex. +AgentHub integrates with Claude Code through its native hook system. When Claude Code performs any action (session start, tool use, turn completion, subagent finish, session exit), it fires a hook that calls a small Node.js script bundled with this project. That script forwards the event over HTTP to the dashboard server, which stores it in SQLite and broadcasts it to the browser over WebSocket. -- Claude Code loads project extensions from: +``` +Claude Code → hook fires → hook-handler.js → POST /api/hooks/event + ↓ +Browser ← WebSocket broadcast ← Express server ← SQLite +``` + +No extra Claude Code configuration is required in the normal host-run path — when you start the dashboard with `npm run dev` or `npm start`, the server configures the hooks automatically on startup (or, with the `agenthub` plugin enabled in `~/.claude/settings.json`, removes the checkout's copies — the plugin's own hooks already run, and both would post every event twice). Container deployments are the exception: after the container is up, run `npm run install-hooks` on the host so Claude Code points at `http://localhost:4820`. + +--- + +## Configuration + +### Hook auto-installation + +When the dashboard is running directly on the host, the server writes the following to `~/.claude/settings.json` every time it starts: + +```json +{ + "hooks": { + "SessionStart": [{ "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" SessionStart" }] }], + "PreToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" PreToolUse" }] }], + "PostToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" PostToolUse" }] }], + "Stop": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" Stop" }] }], + "SubagentStop": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" SubagentStop" }] }], + "Notification": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" Notification" }] }], + "SessionEnd": [{ "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" SessionEnd" }] }] + } +} +``` + +> [!NOTE] +> Note: `SessionStart` and `SessionEnd` hooks do not support the `matcher` field — they fire unconditionally on every session start and exit. + +Existing hooks in that file are preserved. The dashboard only adds or updates entries that contain `hook-handler.js`. + +To re-run hook installation manually: + +```bash +npm run install-hooks +``` + +> [!TIP] +> Container note: if you run the dashboard inside a container (a Dev Container, Codespaces, or your own image), do not install hooks from in there — the hook path a container writes points at the container filesystem, not the host. Run `npm run install-hooks` on the host instead. As a safeguard (issue #193) the installer **detects container execution and refuses to run** (exiting non-zero) so it can never poison a bind-mounted host `~/.claude`. If Claude Code itself genuinely runs inside that container, override with `AGENTHUB_ALLOW_CONTAINER_HOOKS=1 npm run install-hooks`. + +> [!NOTE] +> Prefer a ready-made dev environment? This repo ships an **optional** Dev Container (`.devcontainer/`) for VS Code / GitHub Codespaces — Node 22, native build tools for `better-sqlite3`, Python, and ports `4820`/`5173` preconfigured. It's purely opt-in and changes nothing for host-based development. See [`.devcontainer/README.md`](.devcontainer/README.md). (Hooks remain host-side there too.) + +### Environment variables + +| Variable | Default | Description | +|---|---|---| +| `DASHBOARD_PORT` | `4820` | Port the Express server listens on | +| `CLAUDE_DASHBOARD_PORT` | `4820` | Port the hook handler uses when posting events to the dashboard | +| `DASHBOARD_DB_PATH` | `data/dashboard.db` | Path to the SQLite database file | +| `NODE_ENV` | `development` | Set to `production` to serve built client | +| `DASHBOARD_CLIENT_DIST` | `client/dist` | Directory the built UI is served from in production. Set by the `agenthub` plugin bootstrap to its own runtime dir, because the plugin cache is replaced on every update | +| `AGENTHUB_IMPORT_MAX_BYTES` | `1073741824` (1 GB) | Maximum size per uploaded file on `/api/import/upload` | +| `AGENTHUB_IMPORT_MAX_FILES` | `2000` | Maximum number of files per upload request | +| `AGENTHUB_IMPORT_MAX_EXTRACT_BYTES` | `4294967296` (4 GB) | Maximum uncompressed bytes any single archive is allowed to expand to (zip-bomb defense) | +| `DASHBOARD_DATA_DIR` | `~/.claude/agenthub` | AgentHub's data dir; a plugin install keeps its runtime (deps, UI build, logs) in `runtime/` under it | + +Example with a custom port: + +```bash +DASHBOARD_PORT=9000 npm run dev +``` + +> [!NOTE] +> You usually do **not** need to set `DASHBOARD_PORT` manually. `npm run dev` is wrapped by `scripts/dev.js`, which probes both `127.0.0.1` and `::1` (so an SSH `LocalForward` bound to one loopback can't slip past) and picks the first free port in `4820–4859` automatically. The chosen port is propagated to the Vite dev proxy via `DASHBOARD_PORT`, and the Express server writes it to `~/.claude/.agenthub.json` so the Claude Code hook handler discovers it without any env var. +> +> Multiple dashboards can run side by side — for example two `npm run dev` checkouts, or `npm run dev` alongside `npm start`. Each one appends its `{port, pid, startedAt}` entry to the discovery file, and `scripts/hook-handler.js` fan-outs every hook event to every live entry, so both UIs keep their real-time stream. +> +> Setting `CLAUDE_DASHBOARD_PORT=N` overrides discovery entirely and forces the hook handler to a single port — useful for tests and container setups where the in-process discovery file isn't reachable from the host. +> +> If you bypass the picker (e.g. `npm run dev:raw`, container builds, or anything else that calls `node server/index.js` directly), make sure your client is built / proxied against the port the server actually bound. + +### Agent extension setup (Claude Code + Codex) + +This repository ships extension files for both agent ecosystems: + +- Claude Code: - `CLAUDE.md` - - `.claude/rules/` - - `skills/` (shipped as the `agenthub` plugin's skills) -- Codex project packs live under `.codex/`: + - `.claude/rules/*` + - `skills/*` (the `agenthub` plugin's own skills) +- Codex: - `AGENTS.md` - - `.codex/rules/` - - `.codex/agents/` - - `.codex/skills/` + - `.codex/config.toml` + - `.codex/rules/default.rules` + - `.codex/agents/*` + - `.codex/skills/*` See [`.codex/README.md`](./.codex/README.md) for Codex extension details. +### PWA configuration (optional) + +The dashboard ships as a Progressive Web App. No configuration is required — its manifest and service worker are included out of the box. + +**Customising the manifest:** Edit `client/public/manifest.json`. Common fields to change: + +- `name` / `short_name` — displayed on the home screen / dock +- `theme_color` — address bar / title bar tint (default: `#6366f1`) +- `background_color` — splash screen background +- `start_url` — entry point when launched from home screen + +**Updating the service worker cache:** The SW has a `CACHE_NAME` constant (e.g. `dashboard-v2`). After deploying new assets, bump the version string to force browsers to re-fetch — though for the dashboard this is rarely needed: hashed `/assets/*` URLs are immutable per build, everything else is fetched network-first with cache fallback, and a `controllerchange` listener in the client reloads the page exactly once when a new SW takes over, so a rebuild propagates without a hard refresh. + +**Browser support:** PWA install prompts appear in Chrome 107+, Edge 107+, and Firefox 110+ (desktop and Android). Safari supports `apple-mobile-web-app-capable` for iOS home-screen mode but does not show an install banner. + +**Verifying PWA status:** Open DevTools → Application → Manifest to confirm the manifest loads. Check the Service Workers section to verify the SW is registered and active. The Lighthouse PWA audit should pass all core checks. + +--- + +## Database + +The SQLite database is created automatically on first run (`data/dashboard.db` in a checkout, unless `DASHBOARD_DB_PATH` says otherwise). The directory is created if it does not exist. The database uses WAL mode for concurrent reads and foreign keys for referential integrity. + +### Clear all data + +To remove all sessions, agents, events, and token usage (useful after running seed data or for a clean start): + +```bash +npm run clear-data +``` + +### Data management via Settings page + +The Settings page (`/settings`) provides a UI for the following. **Model Pricing** +and **Hook Configuration** are not on its Dashboard tab: they sit under the +Claude Code tab's **Overview** (Settings → Claude Code → Overview), beside +CLAUDE_HOME; Codex (its Overview) and Antigravity have their own pricing and +hooks in their own tabs. + +- **Model Pricing** — view and edit per-model cost rates, reset to defaults, add custom models +- **Hook Configuration** — check which hooks are installed and reinstall them +- **Data Export** — download all sessions, agents, events, and pricing as a JSON file +- **Session Cleanup** — abandon stale active sessions after N hours, purge old completed sessions after N days +- **Clear All Data** — remove all sessions, agents, events, and token usage +- **Data Management** and **About** sections render with loading placeholders while server info is being fetched, so the page is always fully navigable + +### Seed demo data + +To populate the dashboard with sample sessions, agents, and events for UI exploration: + +```bash +npm run seed +``` + +--- + +## Scripts reference + +| Script | Command | Description | +|---|---|---| +| `setup` | `npm run setup` | Install all dependencies (server + client) | +| `dev` | `npm run dev` | Start server + client in development mode | +| `start` | `npm start` | Start server in production mode | +| `build` | `npm run build` | Build the React client to `client/dist/` | +| `install-hooks` | `npm run install-hooks` | Write Claude Code hooks to `~/.claude/settings.json` | +| `clear-data` | `npm run clear-data` | Delete all data from the database | +| `seed` | `npm run seed` | Insert demo sessions/agents/events | +| `import-history` | `npm run import-history` | Import legacy sessions from `~/.claude/` (also runs on startup) | +| `claude` | Claude CLI | Uses `CLAUDE.md`, `.claude/rules`, and `.claude/skills` automatically | +| `test` | `npm test` | Run all server and client tests | +| `test:server` | `npm run test:server` | Run server integration tests only | +| `test:client` | `npm run test:client` | Run client unit tests only | +| `format` | `npm run format` | Format all files with Prettier | +| `format:check` | `npm run format:check` | Check formatting without writing | + +--- + +## Makefile targets + +All npm scripts are mirrored as `make` targets for convenience. Run `make help` to list them: + +```bash +make help +``` + +Commonly used targets: + +| Make target | Equivalent npm command | Description | +|---|---|---| +| `make setup` | `npm run setup` | Install all dependencies (root + client) | +| `make dev` | `npm run dev` | Start server + client in watch mode | +| `make build` | `npm run build` | Build the React client for production | +| `make start` | `npm start` | Start the production server | +| `make prod` | `npm run build && npm start` | Build then start in one step | +| `make test` | `npm test` | Run all tests (server + client) | +| `make test-server` | `npm run test:server` | Run server tests only | +| `make test-client` | `npm run test:client` | Run client tests only | +| `make format` | `npm run format` | Format all files with Prettier | +| `make format-check` | `npm run format:check` | Check formatting without writing | +| `make seed` | `npm run seed` | Load demo data | +| `make clear-data` | `npm run clear-data` | Delete all data rows | + --- ## Troubleshooting -### `npm run setup` shows `better-sqlite3` errors +### Plugin bootstrap never comes up -This is expected and **non-fatal**. `better-sqlite3` is a native C++ module listed as an optional dependency. If prebuilt binaries are not available for your Node version or platform, npm will print gyp/compilation errors but still complete successfully. +The plugin's `SessionStart` hook only checks a fast path and hands the real +work (npm install, UI build, server start) to a detached background worker, so +a failure there does not show in the session. When the worker's last run +failed, the next session start prints a one-time **AgentHub:** message naming +the log to read. Everything is logged under `~/.claude/agenthub/runtime/`: -At runtime the server uses this fallback chain: +| File | What it holds | +|---|---| +| `bootstrap.log` | Each bootstrap step and why it stopped (Node too old, install failed, superseded build, …) | +| `npm-install.log` | npm's output for the runtime dependency install | +| `client-build.log` | The dashboard UI build (the API still works when only this fails) | +| `server.log` | The server's own output, when it was started detached | +| `last-failure.json` | The last failure the session-start message reports (removed once a bootstrap succeeds) | -1. **`better-sqlite3`** — used when prebuilt binaries are available (Node 20/22/24 on Windows x64, macOS arm64/x64, Linux x64/arm64) -2. **`node:sqlite`** — Node.js built-in SQLite module, used automatically on Node 22+ when `better-sqlite3` is unavailable +Then run `/agenthub-doctor` from Claude Code — it checks Node, the runtime +dependencies, the server and the service unit, and names the fix for each +failing row. `/agenthub-update` re-runs the bootstrap in the foreground with its +output visible. The most common causes: Node older than 22.5 (`node -v` in the +shell Claude Code was started from), no network or a proxy blocking the npm +registry (`npm-install.log`), and a port held by another program (`server.log`, +see [Port 4820 already in use](#port-4820-already-in-use)). -If you see an error box at startup saying *"SQLite backend not available"*, either: +### `better-sqlite3` errors during `npm install` / `npm run setup` -- **Upgrade to Node.js 22+** (recommended — zero native dependencies needed), or -- **Install build tools** so `better-sqlite3` can compile from source: - - **Windows:** `npm install -g windows-build-tools` or install [Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) with the C++ workload - - **macOS:** `xcode-select --install` - - **Linux:** `sudo apt install python3 make g++` (Debian/Ubuntu) or equivalent +Only a **checkout** install sees these — the plugin installs with +`--ignore-scripts` and never builds `better-sqlite3`. They are **harmless**: +`better-sqlite3` is an optional dependency, and when it cannot be built npm +skips it and the server uses Node's built-in `node:sqlite` (Node 22.5+). You do +**not** need Python, Visual Studio Build Tools or a C++ compiler. - Then run: `npm rebuild better-sqlite3` +To build it anyway (it is used when present), install a toolchain and run +`npm rebuild better-sqlite3`: + +- **Windows:** [Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) with the C++ workload +- **macOS:** `xcode-select --install` +- **Linux:** `sudo apt install python3 make g++` (Debian/Ubuntu) or equivalent + +### "SQLite backend not available" error on startup + +Neither `better-sqlite3` nor `node:sqlite` could be loaded — almost always a +Node older than 22.5. Upgrade Node. + +### Database is locked / busy errors + +The SQLite database uses WAL mode with a 5-second busy timeout. If you see lock errors: + +- Ensure only one dashboard server instance is running +- Check for zombie `node server/index.js` processes: `ps aux | grep server/index` +- Delete `data/dashboard.db-wal` and `data/dashboard.db-shm` if the server was killed uncleanly, then restart ### `npm run dev` fails immediately @@ -375,7 +643,7 @@ Ensure both server and client dependencies are installed: npm run setup ``` -If the error mentions a missing module like `express` or `react`, dependencies may be incomplete. Delete `node_modules` in both root and `client/`, then re-run setup: +If the error mentions a missing module like `express` or `react`, dependencies may be incomplete. Delete `node_modules` in both the root and `client/`, then re-run setup: ```bash rm -rf node_modules client/node_modules @@ -409,9 +677,66 @@ that case. ### No sessions appearing after starting Claude Code -See [SETUP.md — Troubleshooting](./SETUP.md#troubleshooting) for detailed hook debugging steps. +**Check 1 — Is the server running?** ---- +```bash +curl http://localhost:4820/api/health +# Expected: {"status":"ok","timestamp":"..."} +``` + +**Check 2 — Are hooks installed?** + +With the plugin, its hooks come with it — run `/agenthub-doctor` instead. For a +checkout, open `~/.claude/settings.json` and confirm it contains a `hooks` +section with entries referencing `hook-handler.js`. If not, run: + +```bash +npm run install-hooks +``` + +**Check 3 — Did you start a new Claude Code session after the server started?** + +Hooks only apply to sessions started after installation. Restart Claude Code. + +**Check 4 — Is Node.js in PATH when Claude Code runs hooks?** + +On some systems, the shell environment when Claude Code fires hooks may not include the full PATH. Test with: + +```bash +node --version +``` + +If Node.js is not found, use the full path to `node` in the hook command. Edit `scripts/install-hooks.js`, replace `node` with the absolute path (e.g. `/usr/local/bin/node`), and re-run `npm run install-hooks`. + +### Dashboard shows "Disconnected" in the sidebar + +The WebSocket connection to the server failed. Ensure the server is running: + +```bash +npm run dev +``` + +The client will automatically reconnect every 2 seconds once the server is available. + +### Port 4820 already in use + +When another program holds the port, the server stops with +`Port 4820 is already in use by another program…` (a running AgentHub there is +detected and simply reused). Pick another port: + +```bash +DASHBOARD_PORT=4821 npm start # or: DASHBOARD_PORT=4821 npm run dev +``` + +The Vite dev proxy and the Claude Code hooks follow the port on their own +(`client/vite.config.ts` reads `DASHBOARD_PORT`; the server publishes the port it bound). + +And make sure Claude Code posts hooks to the new port: + +```bash +CLAUDE_DASHBOARD_PORT=4821 claude +# or edit scripts/hook-handler.js and change the default port +``` ## Ports diff --git a/SETUP.md b/SETUP.md index be59022c..be75561e 100644 --- a/SETUP.md +++ b/SETUP.md @@ -1,422 +1,14 @@ # Setup Guide -A comprehensive guide to setting up and configuring the Agent Dashboard, including how it integrates with Claude Code, environment variables, container deployment, and troubleshooting common issues. - -## How it works - -Agent Dashboard integrates with Claude Code through its native hook system. When Claude Code performs any action (session start, tool use, turn completion, subagent finish, session exit), it fires a hook that calls a small Node.js script bundled with this project. That script forwards the event over HTTP to the dashboard server, which stores it in SQLite and broadcasts it to the browser over WebSocket. - -``` -Claude Code → hook fires → hook-handler.js → POST /api/hooks/event - ↓ -Browser ← WebSocket broadcast ← Express server ← SQLite -``` - -No extra Claude Code configuration is required in the normal host-run path — when you start the dashboard with `npm run dev` or `npm start`, the server configures the hooks automatically on startup (or, with the `agenthub` plugin enabled in `~/.claude/settings.json`, removes the checkout's copies — the plugin's own hooks already run, and both would post every event twice). Container deployments are the exception: after the container is up, run `npm run install-hooks` on the host so Claude Code points at `http://localhost:4820`. - ---- - -## Configuration - -### Hook auto-installation - -When the dashboard is running directly on the host, the server writes the following to `~/.claude/settings.json` every time it starts: - -```json -{ - "hooks": { - "SessionStart": [{ "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" SessionStart" }] }], - "PreToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" PreToolUse" }] }], - "PostToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" PostToolUse" }] }], - "Stop": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" Stop" }] }], - "SubagentStop": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" SubagentStop" }] }], - "Notification": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" Notification" }] }], - "SessionEnd": [{ "hooks": [{ "type": "command", "command": "node \"/path/to/scripts/hook-handler.js\" SessionEnd" }] }] - } -} -``` - -> [!NOTE] -> Note: `SessionStart` and `SessionEnd` hooks do not support the `matcher` field — they fire unconditionally on every session start and exit. - -Existing hooks in that file are preserved. The dashboard only adds or updates entries that contain `hook-handler.js`. - -To re-run hook installation manually: - -```bash -npm run install-hooks -``` - -> [!TIP] -> Container note: if you run the dashboard inside a container (a Dev Container, Codespaces, or your own image), do not install hooks from in there — the hook path a container writes points at the container filesystem, not the host. Run `npm run install-hooks` on the host instead. As a safeguard (issue #193) the installer **detects container execution and refuses to run** (exiting non-zero) so it can never poison a bind-mounted host `~/.claude`. If Claude Code itself genuinely runs inside that container, override with `AGENTHUB_ALLOW_CONTAINER_HOOKS=1 npm run install-hooks`. - -> [!NOTE] -> Prefer a ready-made dev environment? This repo ships an **optional** Dev Container (`.devcontainer/`) for VS Code / GitHub Codespaces — Node 22, native build tools for `better-sqlite3`, Python, and ports `4820`/`5173` preconfigured. It's purely opt-in and changes nothing for host-based development. See [`.devcontainer/README.md`](.devcontainer/README.md). (Hooks remain host-side there too.) - -### Environment variables - -| Variable | Default | Description | -|---|---|---| -| `DASHBOARD_PORT` | `4820` | Port the Express server listens on | -| `CLAUDE_DASHBOARD_PORT` | `4820` | Port the hook handler uses when posting events to the dashboard | -| `DASHBOARD_DB_PATH` | `data/dashboard.db` | Path to the SQLite database file | -| `NODE_ENV` | `development` | Set to `production` to serve built client | -| `DASHBOARD_CLIENT_DIST` | `client/dist` | Directory the built UI is served from in production. Set by the `agenthub` plugin bootstrap to its own runtime dir, because the plugin cache is replaced on every update | -| `AGENTHUB_IMPORT_MAX_BYTES` | `1073741824` (1 GB) | Maximum size per uploaded file on `/api/import/upload` | -| `AGENTHUB_IMPORT_MAX_FILES` | `2000` | Maximum number of files per upload request | -| `AGENTHUB_IMPORT_MAX_EXTRACT_BYTES` | `4294967296` (4 GB) | Maximum uncompressed bytes any single archive is allowed to expand to (zip-bomb defense) | - -Example with a custom port: - -```bash -DASHBOARD_PORT=9000 npm run dev -``` - -> [!NOTE] -> You usually do **not** need to set `DASHBOARD_PORT` manually. `npm run dev` is wrapped by `scripts/dev.js`, which probes both `127.0.0.1` and `::1` (so an SSH `LocalForward` bound to one loopback can't slip past) and picks the first free port in `4820–4859` automatically. The chosen port is propagated to the Vite dev proxy via `DASHBOARD_PORT`, and the Express server writes it to `~/.claude/.agenthub.json` so the Claude Code hook handler discovers it without any env var. -> -> Multiple dashboards can run side by side — for example two `npm run dev` checkouts, or `npm run dev` alongside `npm start`. Each one appends its `{port, pid, startedAt}` entry to the discovery file, and `scripts/hook-handler.js` fan-outs every hook event to every live entry, so both UIs keep their real-time stream. -> -> Setting `CLAUDE_DASHBOARD_PORT=N` overrides discovery entirely and forces the hook handler to a single port — useful for tests and container setups where the in-process discovery file isn't reachable from the host. -> -> If you bypass the picker (e.g. `npm run dev:raw`, container builds, or anything else that calls `node server/index.js` directly), make sure your client is built / proxied against the port the server actually bound. - -### Agent extension setup (Claude Code + Codex) - -This repository ships extension files for both agent ecosystems: - -- Claude Code: - - `CLAUDE.md` - - `.claude/rules/*` - - `skills/*` (the `agenthub` plugin's own skills) - - `agents/*` (the `agenthub` plugin's own agents) -- Codex: - - `AGENTS.md` - - `.codex/config.toml` - - `.codex/rules/default.rules` - - `.codex/agents/*` - - `.codex/skills/*` - -See [`.codex/README.md`](./.codex/README.md) for Codex extension details. - -### PWA configuration (optional) - -The dashboard ships as a Progressive Web App. No configuration is required — its manifest and service worker are included out of the box. - -**Customising the manifest:** Edit `client/public/manifest.json`. Common fields to change: - -- `name` / `short_name` — displayed on the home screen / dock -- `theme_color` — address bar / title bar tint (default: `#6366f1`) -- `background_color` — splash screen background -- `start_url` — entry point when launched from home screen - -**Updating the service worker cache:** The SW has a `CACHE_NAME` constant (e.g. `dashboard-v2`). After deploying new assets, bump the version string to force browsers to re-fetch — though for the dashboard this is rarely needed: hashed `/assets/*` URLs are immutable per build, everything else is fetched network-first with cache fallback, and a `controllerchange` listener in the client reloads the page exactly once when a new SW takes over, so a rebuild propagates without a hard refresh. - -**Browser support:** PWA install prompts appear in Chrome 107+, Edge 107+, and Firefox 110+ (desktop and Android). Safari supports `apple-mobile-web-app-capable` for iOS home-screen mode but does not show an install banner. - -**Verifying PWA status:** Open DevTools → Application → Manifest to confirm the manifest loads. Check the Service Workers section to verify the SW is registered and active. The Lighthouse PWA audit should pass all core checks. - ---- - -## Database - -The SQLite database is created automatically at `data/dashboard.db` on first run. The directory is created if it does not exist. The database uses WAL mode for concurrent reads and foreign keys for referential integrity. - -### Clear all data - -To remove all sessions, agents, events, and token usage (useful after running seed data or for a clean start): - -```bash -npm run clear-data -``` - -### Data management via Settings page - -The Settings page (`/settings`) provides a UI for the following. **Model Pricing** -and **Hook Configuration** are not on its Dashboard tab: they sit under the -Claude Code tab's **Overview** (Settings → Claude Code → Overview), beside -CLAUDE_HOME; Codex (its Overview) and Antigravity have their own pricing and -hooks in their own tabs. - -- **Model Pricing** — view and edit per-model cost rates, reset to defaults, add custom models -- **Hook Configuration** — check which hooks are installed and reinstall them -- **Data Export** — download all sessions, agents, events, and pricing as a JSON file -- **Session Cleanup** — abandon stale active sessions after N hours, purge old completed sessions after N days -- **Clear All Data** — remove all sessions, agents, events, and token usage -- **Data Management** and **About** sections render with loading placeholders while server info is being fetched, so the page is always fully navigable - -### Seed demo data - -To populate the dashboard with sample sessions, agents, and events for UI exploration: - -```bash -npm run seed -``` - ---- - -## Importing existing Claude Code history - -The dashboard automatically imports sessions from `~/.claude/projects/` on -**every startup**, so if Claude Code has been used on this machine, you'll -see history immediately after the first launch. If you need to bring in -history from another machine, from a backup, or just force a rescan, use -**Settings → Import History** in the UI — it's a guided, drag-and-drop -experience with live progress. -### Pick the right mode - -```mermaid -flowchart TD - Q["Where is the history?"] --> Q1{Is it on this machine
under ~/.claude/projects?} - Q1 -->|yes, and I just want
to re-scan| M1["Mode: Rescan default folder
one click"] - Q1 -->|yes, but in another folder
on this machine| M2["Mode: Scan a folder
paste the absolute path"] - Q1 -->|no — it's on another machine
or in an archive file| M3["Mode: Upload files
drag-drop JSONL or archive"] - - M3 --> PREP["Archive source:
tar -czf claude-history.tar.gz
-C ~/.claude projects"] - - style M1 fill:#10b981,stroke:#34d399,color:#fff - style M2 fill:#f59e0b,stroke:#fbbf24,color:#000 - style M3 fill:#a855f7,stroke:#c084fc,color:#fff -``` - -### Step-by-step: moving history from one machine to another - -**On the source machine**, bundle the projects folder: - -```bash -# macOS / Linux -tar -czf claude-history.tar.gz -C ~/.claude projects - -# Windows (PowerShell, via built-in tar) -tar -czf claude-history.tar.gz -C "$env:USERPROFILE\.claude" projects -``` - -Transfer the resulting `claude-history.tar.gz` to the destination machine -however you like — AirDrop, `scp`, USB, cloud storage. - -**On the destination machine**, in the dashboard: - -1. Open **Settings → Import History**. -2. Pick **Upload files** (the third tab). -3. Drag the archive onto the drop zone. -4. Click **Upload & Import** and watch the progress. -5. When the green result card appears, open **Analytics → Cost** to confirm - per-model token totals and estimated cost. - -### Supported inputs - -Any of the following can be dropped onto the upload zone or found inside a -folder given to **Scan a folder**: - -- `.jsonl` — session transcripts -- `.meta.json` — subagent metadata sidecars -- `.zip` — extracted with path-traversal protection -- `.tar`, `.tar.gz`, `.tgz` — extracted via the `tar` package -- `.gz` — single gzipped JSONL (streaming-decompressed) - -### Accuracy guarantees - -- **Idempotent** — re-importing never double-counts. Sessions are - deduplicated by UUID. -- **Cost-preserving** — the `token_usage` table uses `baseline_*` columns - to preserve pre-compaction token totals, so re-ingesting a compacted - transcript never erases historical cost. -- **Same parser as live** — `parseSessionFile` + `importSession` is the - single source of truth for both hook-driven ingestion and manual - import, so imported numbers match captured numbers exactly. - -### Safety - -Archive extraction is hardened against path traversal and archive bombs. -The defaults are generous for real-world transcripts but tight enough to -stop obvious attacks; see the env vars table above for -`AGENTHUB_IMPORT_MAX_BYTES`, `AGENTHUB_IMPORT_MAX_FILES`, and -`AGENTHUB_IMPORT_MAX_EXTRACT_BYTES`. - -### CLI alternative - -For scripts and automation, the same logic runs from the terminal: - -```bash -# Import (or re-import) everything under ~/.claude/projects -npm run import-history - -# Dry run — show what would be imported without writing -node scripts/import-history.js --dry-run - -# Scope to a single project dir -node scripts/import-history.js --project my-project -``` - ---- - -## Scripts reference - -| Script | Command | Description | -|---|---|---| -| `setup` | `npm run setup` | Install all dependencies (server + client) | -| `dev` | `npm run dev` | Start server + client in development mode | -| `start` | `npm start` | Start server in production mode | -| `build` | `npm run build` | Build the React client to `client/dist/` | -| `install-hooks` | `npm run install-hooks` | Write Claude Code hooks to `~/.claude/settings.json` | -| `clear-data` | `npm run clear-data` | Delete all data from the database | -| `seed` | `npm run seed` | Insert demo sessions/agents/events | -| `import-history` | `npm run import-history` | Import legacy sessions from `~/.claude/` (also runs on startup) | -| `claude` | Claude CLI | Uses `CLAUDE.md`, `.claude/rules`, and `.claude/skills` automatically | -| `test` | `npm test` | Run all server and client tests | -| `test:server` | `npm run test:server` | Run server integration tests only | -| `test:client` | `npm run test:client` | Run client unit tests only | -| `format` | `npm run format` | Format all files with Prettier | -| `format:check` | `npm run format:check` | Check formatting without writing | - ---- - -## Makefile targets - -All npm scripts are mirrored as `make` targets for convenience. Run `make help` to list them: - -```bash -make help -``` - -Commonly used targets: - -| Make target | Equivalent npm command | Description | -|---|---|---| -| `make setup` | `npm run setup` | Install all dependencies (root + client) | -| `make dev` | `npm run dev` | Start server + client in watch mode | -| `make build` | `npm run build` | Build the React client for production | -| `make start` | `npm start` | Start the production server | -| `make prod` | `npm run build && npm start` | Build then start in one step | -| `make test` | `npm test` | Run all tests (server + client) | -| `make test-server` | `npm run test:server` | Run server tests only | -| `make test-client` | `npm run test:client` | Run client tests only | -| `make format` | `npm run format` | Format all files with Prettier | -| `make format-check` | `npm run format:check` | Check formatting without writing | -| `make seed` | `npm run seed` | Load demo data | -| `make clear-data` | `npm run clear-data` | Delete all data rows | - ---- - -## Troubleshooting - -### `better-sqlite3` errors during `npm install` / `npm run setup` - -These warnings are **harmless**. `better-sqlite3` is an optional dependency — if it cannot compile, npm skips it and the server falls back to Node.js built-in `node:sqlite` (available on Node 22+). - -You do **not** need Python, Visual Studio Build Tools, or any C++ compiler to run this project on Node 22+. - -If you are on Node 20 or 21 and `better-sqlite3` prebuilds are not available for your platform (there is no `node:sqlite` fallback below Node 22), you have two options: - -1. **Upgrade to Node.js 22+** — the built-in `node:sqlite` fallback requires no native compilation at all -2. **Install build tools** and run `npm rebuild better-sqlite3`: - - **Windows:** install [Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) with the C++ workload - - **macOS:** `xcode-select --install` - - **Linux:** `sudo apt install python3 make g++` (Debian/Ubuntu) - -### "SQLite backend not available" error on startup - -This means neither `better-sqlite3` nor `node:sqlite` could be loaded. The most common cause is running Node.js < 22 without `better-sqlite3` prebuilds. Upgrade to Node.js 22+ to resolve this. - -### Database is locked / busy errors - -The SQLite database uses WAL mode with a 5-second busy timeout. If you see lock errors: - -- Ensure only one dashboard server instance is running -- Check for zombie `node server/index.js` processes: `ps aux | grep server/index` -- Delete `data/dashboard.db-wal` and `data/dashboard.db-shm` if the server was killed uncleanly, then restart - ---- - -### The run console won't start a run / the terminal never attaches - -Runs are tmux-backed: the server executes the `tmux` binary and has no fallback. - -```bash -tmux -V # missing → sudo apt install tmux -curl -s http://localhost:4820/api/run/tmux # {"available":true} -curl -s "http://localhost:4820/api/run/binary?tool=claude" # {"found":true,"path":"…"} -``` - -`{"available":false}` while your own shell finds tmux means the **server's** -`PATH` differs from yours — typically a systemd `--user` service, which never -reads your shell profile. Install tmux system-wide (`/usr/bin/tmux`) and -re-run `agenthub service uninstall && agenthub service install`. The same -applies to `claude` / `codex`: a run launches them by name. - -Install instructions per OS: [INSTALL.md → Step 0](./INSTALL.md#step-0--system-packages). - ---- - -### No sessions appearing after starting Claude Code - -**Check 1 — Is the server running?** - -```bash -curl http://localhost:4820/api/health -# Expected: {"status":"ok","timestamp":"..."} -``` - -**Check 2 — Are hooks installed?** - -Open `~/.claude/settings.json` and confirm it contains a `hooks` section with entries referencing `hook-handler.js`. If not, run: - -```bash -npm run install-hooks -``` - -**Check 3 — Did you start a new Claude Code session after the server started?** - -Hooks only apply to sessions started after installation. Restart Claude Code. - -**Check 4 — Is Node.js in PATH when Claude Code runs hooks?** - -On some systems, the shell environment when Claude Code fires hooks may not include the full PATH. Test with: - -```bash -node --version -``` - -If Node.js is not found, use the full path to `node` in the hook command. Edit `scripts/install-hooks.js`, replace `node` with the absolute path (e.g. `/usr/local/bin/node`), and re-run `npm run install-hooks`. - ---- - -### Dashboard shows "Disconnected" in the sidebar - -The WebSocket connection to the server failed. Ensure the server is running: - -```bash -npm run dev -``` - -The client will automatically reconnect every 2 seconds once the server is available. - ---- - -### Events Today shows 0 despite recent activity - -This was a known timezone bug (fixed in current version). If you are still seeing this, ensure you are running the latest code and restart the server. - ---- - -### Port 4820 already in use - -```bash -DASHBOARD_PORT=4821 npm run dev -``` - -Then update the Vite proxy in `client/vite.config.ts`: - -```ts -proxy: { - "/api": "http://localhost:4821", - "/ws": { target: "ws://localhost:4821", ws: true } -} -``` - -And make sure Claude Code posts hooks to the new port: - -```bash -CLAUDE_DASHBOARD_PORT=4821 claude -# or edit scripts/hook-handler.js and change the default port -``` +This guide has moved into **[INSTALL.md](./INSTALL.md)** — the one install and +setup guide (it and this file had grown into near-duplicates). Everything that +was here is there: + +| Was in SETUP.md | Now in INSTALL.md | +|---|---| +| How it works | [How it works](./INSTALL.md#how-it-works) | +| Hook auto-installation, environment variables, agent extensions, PWA | [Configuration](./INSTALL.md#configuration) | +| Database (clear, Settings page, seed) | [Database](./INSTALL.md#database) | +| Importing existing Claude Code history | [Step 5](./INSTALL.md#step-5--optional-importing-existing-claude-code-history) | +| Scripts reference, Makefile targets | [Scripts reference](./INSTALL.md#scripts-reference) | +| Troubleshooting (incl. "Port 4820 already in use") | [Troubleshooting](./INSTALL.md#troubleshooting) | diff --git a/client/src/components/Layout.tsx b/client/src/components/Layout.tsx index 3865d673..31e0f668 100644 --- a/client/src/components/Layout.tsx +++ b/client/src/components/Layout.tsx @@ -76,7 +76,7 @@ * * ----------------------------------------------------------------------------- */ -import { useState, useCallback, useEffect, useSyncExternalStore } from "react"; +import { lazy, Suspense, useState, useCallback, useEffect, useSyncExternalStore } from "react"; import { Outlet, useLocation } from "react-router-dom"; import { Menu } from "lucide-react"; import { useTranslation } from "react-i18next"; @@ -85,9 +85,15 @@ import { UpdateNotifier } from "./UpdateNotifier"; import { InterruptedSessionsPrompt } from "./lanes/InterruptedSessionsPrompt"; import { SagiMount } from "./Sagi/SagiMount"; import { StatusBar } from "./StatusBar"; -import { OnboardingWizard } from "./onboarding/OnboardingWizard"; +import { useOnboarding } from "../lib/userPrefs"; import { OnboardingTour } from "./onboarding/OnboardingTour"; +// Loaded only for an account that has not finished onboarding: the wizard +// carries the appearance, pet and notification settings screens. +const OnboardingWizard = lazy(() => + import("./onboarding/OnboardingWizard").then((m) => ({ default: m.OnboardingWizard })) +); + const WIDTH_KEY = "agenthub.sidebar.width"; /** The default width, and the narrowest the edge drags to. */ export const SIDEBAR_MIN = 240; @@ -136,6 +142,7 @@ export function Layout({ wsConnected }: LayoutProps) { const { t } = useTranslation("nav"); const [collapsed, setCollapsed] = useState(loadCollapsed); const [connectionOpen, setConnectionOpen] = useState(false); + const onboarding = useOnboarding(); const [updateAvailable, setUpdateAvailable] = useState(false); const drawer = useMedia(DRAWER_QUERY); const [drawerOpen, setDrawerOpen] = useState(false); @@ -177,7 +184,11 @@ export function Layout({ wsConnected }: LayoutProps) { - + {onboarding.loaded && !onboarding.onboardedAt && ( + + + + )} {drawer && drawerOpen && (
- typeof window !== "undefined" && - window.matchMedia?.("(prefers-reduced-motion: reduce)").matches - ); - useEffect(() => { - const mq = window.matchMedia?.("(prefers-reduced-motion: reduce)"); - if (!mq) return; - const onChange = () => setReduced(mq.matches); - mq.addEventListener?.("change", onChange); - return () => mq.removeEventListener?.("change", onChange); - }, []); - return reduced; -} - /** * Fixed-position wrapper that places its content next to the avatar and clamps * it inside the viewport. It measures itself (and re-measures on content/size diff --git a/client/src/components/StatusBar.tsx b/client/src/components/StatusBar.tsx index 20116d12..86bd0a9e 100644 --- a/client/src/components/StatusBar.tsx +++ b/client/src/components/StatusBar.tsx @@ -9,8 +9,12 @@ * Workspace page, the open workspace's total (`?lane=` on the same call: the * sessions it owns) and the shown session's (`GET /api/pricing/cost/:id` for * the URL's `session`, or the focused pane's session from the page's run poll, - * `LIVE_RUNS_EVENT`), all re-read every 30 s while the tab is visible and - * whenever the URL names another workspace or session. Each figure carries its + * `LIVE_RUNS_EVENT`), all re-read at once whenever the URL names another + * workspace or session, then at most every 30 s while events or session + * updates arrive (spend only moves with work) and every 2 min otherwise, while + * the tab is visible. The session counts re-read only when a session is + * created or its status / waiting / archived state changes (every 60 s + * otherwise). Each figure carries its * token total, and hovering it lists tokens and cost per model. At the right * end, the plan quota spent per native tool (`GET /api/pricing/quota`, every * 5 min while visible; a click forces a re-read): one "N% used" chip per tool — @@ -31,9 +35,15 @@ import { fmt, fmtCostFull, formatModelName, timeAgo } from "../lib/format"; import { AiToolIcon } from "./AiToolIcon"; import { useLiveRefresh } from "../hooks/useLiveRefresh"; import { useSpin } from "../hooks/useSpin"; +import { sessionChangeMatcher } from "../lib/sessionChange"; import { LIVE_RUNS_EVENT, selectedFrom } from "./WorkspaceTree"; +/** Spend moves only with work: at most this often while events arrive… */ const COST_POLL_MS = 30_000; +/** …and this often regardless (date rollover, budget period, a missed frame). */ +const COST_FALLBACK_MS = 120_000; +/** The counts' safety poll; session frames that change a count drive the rest. */ +const COUNTS_FALLBACK_MS = 60_000; const QUOTA_POLL_MS = 5 * 60_000; const QUOTA_TOOL_LABEL: Record = { claude: "Claude", @@ -384,51 +394,57 @@ export function StatusBar({ .catch(() => undefined); }, []); useEffect(loadCounts, [loadCounts]); - useLiveRefresh(loadCounts, { - intervalMs: 15_000, - match: (msg) => msg.type === "session_updated" || msg.type === "session_created", - }); + // Only a frame that moves a session between the counted states (a new + // session, a status / waiting / archived change) re-reads: a session row is + // re-broadcast on almost every hook. + const [countsChanged] = useState(() => sessionChangeMatcher()); + useLiveRefresh(loadCounts, { intervalMs: COUNTS_FALLBACK_MS, match: countsChanged }); + // Bumped on every lane/session switch: an answer for the previous one is dropped. + const costGen = useRef(0); + const loadCosts = useCallback(() => { + const gen = costGen.current; + const live = () => gen === costGen.current; + api.pricing + .totalCost({ date: localDate() }) + .then((r) => live() && setToday(r)) + .catch(() => undefined); + api.budgets + .status() + .then(({ budgets }) => { + const hit = budgets.filter((b) => b.crossed.length > 0).sort((a, b) => b.pct - a.pct); + if (live()) setBudget(hit[0] ?? null); + }) + .catch(() => undefined); + if (lane !== null) { + api.pricing + .totalCost({ lane }) + .then((r) => live() && setLaneCost(r)) + .catch(() => undefined); + } + if (sessionId) { + api.pricing + .sessionCost(sessionId) + .then((r) => live() && setSessionCost(r)) + .catch(() => undefined); + } + }, [lane, sessionId]); useEffect(() => { - let live = true; + costGen.current++; // Another workspace or session: never show the previous one's figure. setLaneCost(null); setSessionCost(null); - const tick = () => { - if (document.visibilityState !== "visible") return; - api.pricing - .totalCost({ date: localDate() }) - .then((r) => live && setToday(r)) - .catch(() => undefined); - api.budgets - .status() - .then(({ budgets }) => { - const hit = budgets.filter((b) => b.crossed.length > 0).sort((a, b) => b.pct - a.pct); - if (live) setBudget(hit[0] ?? null); - }) - .catch(() => undefined); - if (lane !== null) { - api.pricing - .totalCost({ lane }) - .then((r) => live && setLaneCost(r)) - .catch(() => undefined); - } - if (sessionId) { - api.pricing - .sessionCost(sessionId) - .then((r) => live && setSessionCost(r)) - .catch(() => undefined); - } - }; - tick(); - const id = setInterval(tick, COST_POLL_MS); - document.addEventListener("visibilitychange", tick); + if (document.visibilityState === "visible") loadCosts(); return () => { - live = false; - clearInterval(id); - document.removeEventListener("visibilitychange", tick); + costGen.current++; }; - }, [lane, sessionId]); + }, [loadCosts]); + useLiveRefresh(loadCosts, { + intervalMs: COST_FALLBACK_MS, + throttleMs: COST_POLL_MS, + match: (msg) => + msg.type === "new_event" || msg.type === "session_updated" || msg.type === "session_created", + }); return (
*/ /* ============================================================================= @@ -79,6 +83,9 @@ import type { TranscriptMessage, TranscriptInfo, WSMessage } from "../../lib/typ // hook event. A short visibility-gated poll closes that gap and also rescues // the conversation from missed/late WebSocket frames. const POLL_INTERVAL_MS = 3000; +// An ended session writes nothing more: a slow safety poll only, in case it was +// resumed somewhere whose frames this view missed. +const ENDED_POLL_INTERVAL_MS = 60000; // Rescan the transcripts list periodically so new subagents that spawn // mid-session appear in the dropdown without a page reload. const TRANSCRIPTS_REFRESH_MS = 15000; @@ -110,6 +117,8 @@ interface ConversationViewProps { onContext?: (tokens: number, model: string | null) => void; /** A live pane's session has no row yet: the CLI has not started it. */ onNotStarted?: (notStarted: boolean) => void; + /** The session has ended (and no pane holds it): poll slowly, if at all. */ + ended?: boolean; } function ConversationViewPane({ @@ -124,6 +133,7 @@ function ConversationViewPane({ stopped = 0, onContext, onNotStarted, + ended = false, }: ConversationViewProps) { const { t } = useTranslation("sessions"); const [messages, setMessages] = useState([]); @@ -188,14 +198,18 @@ function ConversationViewPane({ } } loadTranscripts(); - const interval = window.setInterval(() => { - if (isShown(onScreen)) loadTranscripts(); - }, TRANSCRIPTS_REFRESH_MS); + // An ended session spawns no new sub-agents: the load above (re-run when + // it ends, for the last ones) is enough. + const interval = ended + ? undefined + : window.setInterval(() => { + if (isShown(onScreen)) loadTranscripts(); + }, TRANSCRIPTS_REFRESH_MS); return () => { cancelled = true; window.clearInterval(interval); }; - }, [sessionId]); + }, [sessionId, ended]); // Sync external initialTranscriptId to internal state useEffect(() => { @@ -355,9 +369,12 @@ function ConversationViewPane({ let interval: number | null = null; function start() { if (interval !== null) return; - interval = window.setInterval(() => { - if (isShown(onScreen)) fetchNewMessages(); - }, POLL_INTERVAL_MS); + interval = window.setInterval( + () => { + if (isShown(onScreen)) fetchNewMessages(); + }, + ended ? ENDED_POLL_INTERVAL_MS : POLL_INTERVAL_MS + ); } function stop() { if (interval !== null) { @@ -382,7 +399,7 @@ function ConversationViewPane({ stop(); document.removeEventListener("visibilitychange", onVisibility); }; - }, [fetchNewMessages, onScreen]); + }, [fetchNewMessages, onScreen, ended]); // Manual refresh - surfaces a control in the toolbar so users can force // a sync without reloading the page. diff --git a/client/src/components/lanes/SessionReplay.tsx b/client/src/components/lanes/SessionReplay.tsx index 599d2c4e..3ecf3532 100644 --- a/client/src/components/lanes/SessionReplay.tsx +++ b/client/src/components/lanes/SessionReplay.tsx @@ -132,7 +132,11 @@ export function SessionReplay({
)}
- +
{livePane ? (
{ + const command = async (line: string, files: string[] = []) => { if ( notStarted && !(await confirmDialog({ @@ -501,14 +507,15 @@ export const PaneChat = memo(function PaneChat({ })) ) return false; - const ok = submitToRun(runId, line); + const ok = submitToRun(runId, line, files); if (!ok) toast.error(t("chat.notSent")); return ok; }; const send = async () => { if (!text || uploading) return; - if (!(await command(text))) return; + const out = promptForPane(prompt, images); + if (!(await command(out.text, out.files))) return; setFollow((n) => n + 1); setPrompt(""); images.forEach((i) => i.url && URL.revokeObjectURL(i.url)); diff --git a/client/src/components/run/PaneGrid.tsx b/client/src/components/run/PaneGrid.tsx index b63f7116..6d7f090f 100644 --- a/client/src/components/run/PaneGrid.tsx +++ b/client/src/components/run/PaneGrid.tsx @@ -73,7 +73,7 @@ import { RunDot, type RunState } from "./ConsoleTabs"; import { setSessionChat, useSessionChat } from "../../lib/chatUi"; import { readChatDraft, writeChatDraft } from "../../lib/chatDraft"; import { pasteToRun, takeRunInput } from "../../lib/panePaste"; -import { promptWithImages } from "./RunSetup"; +import { promptForPane } from "./RunSetup"; export const PANE_DRAG_TYPE = "application/x-agenthub-pane"; /** The slot being dragged: `dataTransfer` data cannot be read during dragover. */ @@ -246,8 +246,8 @@ const ITEM = * the CLI's input box, without Enter. */ export function showTerminal(runId: string, sessionId: string) { const draft = readChatDraft(sessionId); - const text = promptWithImages(draft.prompt, draft.images); - if (text && pasteToRun(runId, text)) writeChatDraft(sessionId, "", []); + const { text, files } = promptForPane(draft.prompt, draft.images); + if ((text || files.length) && pasteToRun(runId, text, files)) writeChatDraft(sessionId, "", []); setSessionChat(sessionId, false); } diff --git a/client/src/components/run/RunSetup.tsx b/client/src/components/run/RunSetup.tsx index 1b917266..a4f91b4c 100644 --- a/client/src/components/run/RunSetup.tsx +++ b/client/src/components/run/RunSetup.tsx @@ -208,6 +208,23 @@ export function promptWithImages(text: string, images: PromptImage[]): string { return [text.trim(), ...images.map((i) => i.path)].filter(Boolean).join(" "); } +const IMAGE_PATH = /^[^@].*\.(png|jpe?g|gif|webp)$/i; + +/** The prompt as pasted into a live pane: the text with every non-image file + * in it (as `promptWithImages`), and the images' paths apart — each goes in + * a paste of its own, the one shape `claude` turns into `[Image #n]` on every + * platform (a Windows path inside a paste of text stayed a plain path). */ +export function promptForPane( + text: string, + images: PromptImage[] +): { text: string; files: string[] } { + const isImage = (i: PromptImage) => IMAGE_PATH.test(i.path); + return { + text: promptWithImages(text, images.filter((i) => !isImage(i))), + files: images.filter(isImage).map((i) => i.path), + }; +} + /** A plain-text paste longer than this is attached as `pasted-text.txt`. */ export const PASTE_AS_FILE_CHARS = 5000; diff --git a/client/src/components/run/TerminalView.tsx b/client/src/components/run/TerminalView.tsx index 80d1ba9c..378a2e3e 100644 --- a/client/src/components/run/TerminalView.tsx +++ b/client/src/components/run/TerminalView.tsx @@ -666,8 +666,12 @@ export const TerminalView = memo(function TerminalView({ () => registerPane( runId, - (text, submit) => { - termRef.current?.paste(text); + (text, submit, files = []) => { + const term = termRef.current; + // The text, then each image's path in a paste of its own — the one + // shape `claude` turns into `[Image #n]` on every platform. + if (text) term?.paste(files.length ? `${text} ` : text); + files.forEach((f, i) => term?.paste(i < files.length - 1 ? `${f} ` : f)); // Enter a beat after the paste, so a TUI that times its paste // detection never reads it as a newline inside the paste. A submit // comes from the pane's Chat view, which keeps the keyboard. diff --git a/client/src/components/run/__tests__/PaneChat.test.tsx b/client/src/components/run/__tests__/PaneChat.test.tsx index 6dd54bcd..abfada18 100644 --- a/client/src/components/run/__tests__/PaneChat.test.tsx +++ b/client/src/components/run/__tests__/PaneChat.test.tsx @@ -267,7 +267,7 @@ describe("PaneChat — model, effort and permission mode", () => { renderChat(); fireEvent.click(screen.getByRole("button", { name: /Opus/ })); fireEvent.click(await screen.findByRole("menuitemradio", { name: /Sonnet/ })); - expect(submitToRun).toHaveBeenCalledWith("agenthub-lane-1", "/model sonnet"); + expect(submitToRun).toHaveBeenCalledWith("agenthub-lane-1", "/model sonnet", []); }); it("shows the mode the pane shows, and asks the server to step it", async () => { @@ -430,7 +430,7 @@ describe("PaneChat — the unsent prompt", () => { expect(screen.getByPlaceholderText("Write a message…")).toHaveValue("half typed"); expect(screen.getByText("a.ts")).toBeInTheDocument(); fireEvent.click(screen.getByTestId("pane-chat-send")); - expect(submitToRun).toHaveBeenCalledWith("agenthub-lane-1", "half typed @src/a.ts"); + expect(submitToRun).toHaveBeenCalledWith("agenthub-lane-1", "half typed @src/a.ts", []); await waitFor(() => expect(localStorage.getItem("agenthub.chat.draft.s1")).toBeNull()); }); @@ -462,7 +462,8 @@ describe("PaneChat — the unsent prompt", () => { fireEvent.click(screen.getByTestId("pane-chat-send")); expect(submitToRun).toHaveBeenCalledWith( "agenthub-lane-1", - 'read @"/home/u/My Docs/spec.md" @/home/u/b.ts' + 'read @"/home/u/My Docs/spec.md" @/home/u/b.ts', + [] ); }); @@ -490,7 +491,7 @@ describe("PaneChat — the unsent prompt", () => { expect(box).toHaveValue("hello"); confirmDialog.mockResolvedValueOnce(true); fireEvent.click(screen.getByTestId("pane-chat-send")); - await waitFor(() => expect(submitToRun).toHaveBeenCalledWith("agenthub-lane-1", "hello")); + await waitFor(() => expect(submitToRun).toHaveBeenCalledWith("agenthub-lane-1", "hello", [])); }); it("sends without asking once the session has started", async () => { @@ -499,7 +500,7 @@ describe("PaneChat — the unsent prompt", () => { renderChat(); fireEvent.change(screen.getByPlaceholderText("Write a message…"), { target: { value: "hi" } }); fireEvent.click(screen.getByTestId("pane-chat-send")); - await waitFor(() => expect(submitToRun).toHaveBeenCalledWith("agenthub-lane-1", "hi")); + await waitFor(() => expect(submitToRun).toHaveBeenCalledWith("agenthub-lane-1", "hi", [])); expect(confirmDialog).not.toHaveBeenCalled(); }); }); diff --git a/client/src/components/run/__tests__/RunSetup.test.tsx b/client/src/components/run/__tests__/RunSetup.test.tsx index 820f4f45..07cb8dc0 100644 --- a/client/src/components/run/__tests__/RunSetup.test.tsx +++ b/client/src/components/run/__tests__/RunSetup.test.tsx @@ -24,6 +24,7 @@ import { ModelPicker, PASTE_AS_FILE_CHARS, PromptEditor, + promptForPane, promptWithImages, type PromptImage, } from "../RunSetup"; @@ -586,3 +587,23 @@ describe("ModelMenu", () => { expect(onChange).toHaveBeenCalledWith("claude-sonnet-5-5"); }); }); + +describe("promptForPane — images apart, every other file in the text", () => { + it("keeps @-mentions and other files in the text, and takes images out", () => { + // A Windows path inside a paste of text stayed a plain path in claude; a + // paste that is only the path becomes [Image #n]. + const images: PromptImage[] = [ + { path: "C:\\Users\\u\\.claude\\agenthub\\drops\\f326fc666d3bdd92-image.png", name: "image.png" }, + { path: "/data/drops/0123456789abcdef-log.txt", name: "log.txt" }, + { path: '@"/home/u/My Docs/a.PNG"', name: "a.PNG" }, + { path: "/data/drops/0123456789abcdef.JPG", name: "b.jpg" }, + ]; + expect(promptForPane(" look ", images)).toEqual({ + text: 'look /data/drops/0123456789abcdef-log.txt @"/home/u/My Docs/a.PNG"', + files: [ + "C:\\Users\\u\\.claude\\agenthub\\drops\\f326fc666d3bdd92-image.png", + "/data/drops/0123456789abcdef.JPG", + ], + }); + }); +}); diff --git a/client/src/components/settings/PetSettings.tsx b/client/src/components/settings/PetSettings.tsx index 753b95c7..da941c9d 100644 --- a/client/src/components/settings/PetSettings.tsx +++ b/client/src/components/settings/PetSettings.tsx @@ -28,7 +28,7 @@ import { SettingsRow, SettingsSwitchRow } from "./SettingsRow"; import { SagiAvatar } from "../Sagi/SagiAvatar"; import { PetSprite } from "../Sagi/PetSprite"; import { PET_SIZE, sagiPrefs } from "../Sagi/prefs"; -import { usePrefersReducedMotion } from "../Sagi/Sagi"; +import { usePrefersReducedMotion } from "../../hooks/usePrefersReducedMotion"; import { confirmDialog } from "../../lib/confirm"; import { toast } from "../../lib/toast"; import { usePets, useWornPet } from "../Sagi/usePets"; diff --git a/client/src/components/settings/RetentionSettings.tsx b/client/src/components/settings/RetentionSettings.tsx new file mode 100644 index 00000000..5af6a006 --- /dev/null +++ b/client/src/components/settings/RetentionSettings.tsx @@ -0,0 +1,180 @@ +/** + * @file RetentionSettings.tsx + * @description Settings → Data → Session cleanup, under the manual purge: the + * OPT-IN automatic cleanup (`AGENTHUB_RETENTION_DAYS`, 0 = off, the default) + * that the hourly maintenance applies, the database's size and free space, and + * **Compact now** — a full VACUUM behind a confirm, polled through + * `GET /api/settings/retention` while it runs, then toasted. Backed by + * `server/lib/db-retention.js`; a value the environment set is read-only. + * @author Nguyễn Ngọc Trí Vĩ + */ + +import { useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; +import { AlertTriangle, Minimize2, RefreshCw } from "lucide-react"; +import { api } from "../../lib/api"; +import type { RetentionState } from "../../lib/api"; +import { confirmDialog } from "../../lib/confirm"; +import { formatBytes, formatDateTime } from "../../lib/format"; +import { toast } from "../../lib/toast"; + +export function RetentionSettings() { + const { t } = useTranslation("settings"); + const [state, setState] = useState(null); + const [days, setDays] = useState("0"); + const [saving, setSaving] = useState(false); + + useEffect(() => { + api.settings.retention + .get() + .then((s) => { + setState(s); + setDays(String(s.days)); + }) + .catch(() => undefined); + }, []); + + // A Compact takes a while on a large database: poll until it ends. + const compacting = !!state?.compacting; + useEffect(() => { + if (!compacting) return; + const id = window.setInterval(() => { + api.settings.retention + .get() + .then((s) => { + setState(s); // the draft keeps its value + if (s.compacting || !s.last_compact) return; + if (s.last_compact.ok) { + toast.success( + t("retention.compactDone", { + before: formatBytes(s.last_compact.size_before ?? 0), + after: formatBytes(s.last_compact.size_after ?? 0), + }) + ); + } else { + toast.error(t("retention.compactFailed", { error: s.last_compact.error })); + } + }) + .catch(() => undefined); + }, 2000); + return () => window.clearInterval(id); + }, [compacting, t]); + + const max = state?.max_days ?? 3650; + const n = Number(days); + const valid = days.trim() !== "" && Number.isInteger(n) && n >= 0 && n <= max; + const changed = state !== null && valid && n !== state.days; + const owned = !!state?.env_owned.days; + + async function save() { + setSaving(true); + try { + const s = await api.settings.retention.save(n); + setState(s); + setDays(String(s.days)); + toast.success(t("retention.saved")); + } catch (err) { + toast.error(err); + } finally { + setSaving(false); + } + } + + async function compact() { + const ok = await confirmDialog({ + title: t("retention.compactConfirmTitle"), + message: t("retention.compactConfirmBody"), + confirmLabel: t("retention.compact"), + }); + if (!ok) return; + try { + setState(await api.settings.retention.compact()); + } catch (err) { + toast.error(err); + } + } + + const purged = state?.last_run?.retention?.purged_sessions; + + return ( +
+
+

{t("retention.title")}

+

{t("retention.description")}

+
+
+
+ +
+ setDays(e.target.value)} + aria-invalid={!valid || undefined} + aria-describedby={!valid ? "retention-days-error" : undefined} + className="input w-20 text-sm text-right font-mono" + /> + {t("common:days")} +
+ {!valid && ( +

+ {t("retention.invalid", { max })} +

+ )} +
+ +
+

+ {state && state.days > 0 ? t("retention.on", { days: state.days }) : t("retention.off")} + {state?.last_run && purged !== undefined && ( + <> {t("retention.lastRun", { time: formatDateTime(state.last_run.at), n: purged })} + )} +

+ {owned && ( +

+ + {t("privacy.envOwned")} +

+ )} +
+ + {state?.space && ( + + {t("retention.space", { + size: formatBytes(state.db_size), + free: formatBytes(state.space.free_bytes), + mode: state.space.auto_vacuum, + })} + + )} +
+
+ ); +} diff --git a/client/src/hooks/usePrefersReducedMotion.ts b/client/src/hooks/usePrefersReducedMotion.ts new file mode 100644 index 00000000..42ba7626 --- /dev/null +++ b/client/src/hooks/usePrefersReducedMotion.ts @@ -0,0 +1,27 @@ +/** + * @file usePrefersReducedMotion.ts + * @description The OS "reduce motion" preference, followed live. Its own + * module so a settings screen can read it without importing the pet overlay + * (`components/Sagi/Sagi.tsx`), whose chat and pane UI would otherwise be + * pulled into every page's first bundle. + * @author Nguyễn Ngọc Trí Vĩ + */ + +import { useEffect, useState } from "react"; + +/** The OS "reduce motion" preference, followed live. */ +export function usePrefersReducedMotion(): boolean { + const [reduced, setReduced] = useState( + () => + typeof window !== "undefined" && + window.matchMedia?.("(prefers-reduced-motion: reduce)").matches + ); + useEffect(() => { + const mq = window.matchMedia?.("(prefers-reduced-motion: reduce)"); + if (!mq) return; + const onChange = () => setReduced(mq.matches); + mq.addEventListener?.("change", onChange); + return () => mq.removeEventListener?.("change", onChange); + }, []); + return reduced; +} diff --git a/client/src/i18n/locales/en/settings.json b/client/src/i18n/locales/en/settings.json index 9e40469f..76dbc72a 100644 --- a/client/src/i18n/locales/en/settings.json +++ b/client/src/i18n/locales/en/settings.json @@ -1216,6 +1216,23 @@ "ignoreHint": "One absolute path per line. Hooks from these folders, and anything under them, are dropped whole; history import and the Codex reader skip their sessions. AGENTHUB_IGNORE_CWD sets the same list.", "envOwned": "A value here is set by the environment the dashboard started in, and cannot be changed from this page." }, + "retention": { + "title": "Automatic cleanup", + "description": "Off by default. When on, the hourly maintenance deletes finished sessions (completed, error, abandoned) that started more than this many days ago — with their events, agents and token usage — a little at a time.", + "days": "Delete sessions older than", + "off": "Automatic cleanup is off.", + "on": "Sessions older than {{days}} days are deleted every hour.", + "invalid": "A whole number from 0 (off) to {{max}}", + "saved": "Automatic cleanup saved", + "lastRun": "Last run {{time}}: {{n}} session(s) deleted", + "space": "Database {{size}} · {{free}} free inside it · auto-vacuum: {{mode}}", + "compact": "Compact now", + "compacting": "Compacting…", + "compactConfirmTitle": "Compact the database?", + "compactConfirmBody": "This rewrites the whole database file to give free space back to the disk and turns on incremental auto-vacuum. On a large database it takes a while, and new hook events wait until it finishes.", + "compactDone": "Database compacted: {{before}} → {{after}}", + "compactFailed": "Compact failed: {{error}}" + }, "backup": { "title": "Daily backup", "description": "A full copy of the database once a day, into a folder you choose — best on another disk, so a failed drive does not take the backups with it.", diff --git a/client/src/i18n/locales/vi/settings.json b/client/src/i18n/locales/vi/settings.json index b760b7eb..16c0b2f2 100644 --- a/client/src/i18n/locales/vi/settings.json +++ b/client/src/i18n/locales/vi/settings.json @@ -1216,6 +1216,23 @@ "ignoreHint": "Mỗi dòng một đường dẫn tuyệt đối. Hook từ các thư mục này, và mọi thứ bên trong, bị bỏ hoàn toàn; việc nhập lịch sử và bộ đọc Codex cũng bỏ qua phiên của chúng. AGENTHUB_IGNORE_CWD đặt cùng danh sách này.", "envOwned": "Một giá trị ở đây do môi trường khởi động dashboard đặt, và không thể đổi từ trang này." }, + "retention": { + "title": "Tự động dọn dẹp", + "description": "Mặc định tắt. Khi bật, bảo trì hằng giờ xóa các phiên đã kết thúc (hoàn tất, lỗi, bỏ dở) bắt đầu cách đây hơn số ngày này — cùng sự kiện, agent và token của chúng — từng ít một.", + "days": "Xóa phiên cũ hơn", + "off": "Tự động dọn dẹp đang tắt.", + "on": "Phiên cũ hơn {{days}} ngày được xóa mỗi giờ.", + "invalid": "Số nguyên từ 0 (tắt) đến {{max}}", + "saved": "Đã lưu tự động dọn dẹp", + "lastRun": "Lần chạy gần nhất {{time}}: đã xóa {{n}} phiên", + "space": "Cơ sở dữ liệu {{size}} · {{free}} trống bên trong · auto-vacuum: {{mode}}", + "compact": "Nén ngay", + "compacting": "Đang nén…", + "compactConfirmTitle": "Nén cơ sở dữ liệu?", + "compactConfirmBody": "Thao tác này ghi lại toàn bộ tệp cơ sở dữ liệu để trả dung lượng trống cho ổ đĩa và bật auto-vacuum tăng dần. Với cơ sở dữ liệu lớn sẽ mất một lúc, và sự kiện hook mới phải chờ đến khi xong.", + "compactDone": "Đã nén cơ sở dữ liệu: {{before}} → {{after}}", + "compactFailed": "Nén thất bại: {{error}}" + }, "backup": { "title": "Backup hằng ngày", "description": "Mỗi ngày một bản sao đầy đủ của cơ sở dữ liệu vào thư mục bạn chọn — tốt nhất là trên một ổ đĩa khác, để hỏng một ổ không mất luôn bản backup.", diff --git a/client/src/lib/__tests__/sessionChange.test.ts b/client/src/lib/__tests__/sessionChange.test.ts new file mode 100644 index 00000000..b5ba4238 --- /dev/null +++ b/client/src/lib/__tests__/sessionChange.test.ts @@ -0,0 +1,34 @@ +/** + * @file sessionChange.test.ts + * @description Unit tests for `sessionChangeMatcher`: fires on a new session + * and on a change of the keyed columns, never on a re-broadcast that moved none. + * @author Nguyễn Ngọc Trí Vĩ + */ + +import { describe, expect, it } from "vitest"; +import { sessionChangeMatcher } from "../sessionChange"; +import type { WSMessage } from "../types"; + +const msg = (type: string, data: unknown) => ({ type, data, timestamp: "" }) as WSMessage; + +describe("sessionChangeMatcher", () => { + it("fires on a new session and on a state change, not on a same-state re-broadcast", () => { + const m = sessionChangeMatcher(); + expect(m(msg("session_created", { id: "a", status: "active" }))).toBe(true); + expect(m(msg("session_updated", { id: "a", status: "active", name: "x" }))).toBe(false); + expect( + m(msg("session_updated", { id: "a", status: "active", awaiting_input_since: "t" })) + ).toBe(true); + expect(m(msg("session_updated", { id: "a", status: "completed" }))).toBe(true); + expect(m(msg("session_updated", { id: "a", status: "completed", archived_at: "t" }))).toBe( + true + ); + }); + + it("takes an unseen or unkeyable session as a change, and ignores other types", () => { + const m = sessionChangeMatcher(); + expect(m(msg("session_updated", { id: "b", status: "active" }))).toBe(true); + expect(m(msg("session_updated", null))).toBe(true); + expect(m(msg("new_event", { session_id: "b" }))).toBe(false); + }); +}); diff --git a/client/src/lib/api.ts b/client/src/lib/api.ts index 3fb0ae6e..f1355930 100644 --- a/client/src/lib/api.ts +++ b/client/src/lib/api.ts @@ -1649,6 +1649,23 @@ export const api = { /** POST /api/settings/backup/run — starts one; poll `get` while `running` */ run: () => request("/settings/backup/run", { method: "POST" }), }, + /** Opt-in automatic retention and Compact (`server/lib/db-retention.js`). */ + retention: { + /** GET /api/settings/retention */ + get: () => request("/settings/retention"), + /** PUT /api/settings/retention — `days` 0 turns it off */ + save: (days: number) => + request("/settings/retention", { + method: "PUT", + body: JSON.stringify({ days }), + }), + /** POST /api/settings/compact — a full VACUUM; poll `get` while `compacting` */ + compact: () => + request("/settings/compact", { + method: "POST", + body: JSON.stringify({ confirm: true }), + }), + }, /** The bearer token for `POST /api/hooks/ingest-batch`. Only its hash is * stored: `rotate` returns the new token this once, `get` never does. */ pushToken: { @@ -5461,6 +5478,36 @@ export interface BackupState { env_owned: { dir: boolean; hour: boolean; keep: boolean }; } +/** GET /api/settings/retention. `days` 0 = automatic retention off; + * `last_run`/`last_compact` are this server process's own. */ +export interface RetentionState { + days: number; + max_days: number; + env_owned: { days: boolean }; + last_run: { + at: string; + retention?: { purged_sessions: number; purged_events: number; error?: string }; + reclaim?: { reclaimed_pages: number; error?: string }; + } | null; + space: { + auto_vacuum: "none" | "full" | "incremental"; + page_size: number; + page_count: number; + freelist_pages: number; + free_bytes: number; + } | null; + db_size: number; + compacting: boolean; + last_compact: { + at: string; + ok: boolean; + size_before?: number; + size_after?: number; + ms?: number; + error?: string; + } | null; +} + /** GET /api/settings/push-token — whether push ingest is on; never the token. */ export interface PushTokenStatus { enabled: boolean; diff --git a/client/src/lib/panePaste.ts b/client/src/lib/panePaste.ts index ee99c7be..3148520a 100644 --- a/client/src/lib/panePaste.ts +++ b/client/src/lib/panePaste.ts @@ -14,6 +14,9 @@ * terminal moves the unsent prompt across (`takeRunInput` reads the TUI's * input box off the screen and empties it; the chat's draft is pasted back * without Enter), so the half-typed text is never left behind on the other side. + * Attached images' paths go after the text, each in a paste of its own: `claude` + * turns a paste that is only an image's path into `[Image #n]`, but left a + * Windows path (`C:\…\drops\…png`) inside a paste of text as a plain path. * The Chat view also answers a menu the CLI asks with (`parsePaneMenu` reads * it off the screen; `chooseRunOption`/`answerRunMenu` press its digit, the * arrows and Enter, or type into its "Type something" row). @@ -24,7 +27,8 @@ export type PaneScreen = { rows: string[]; cols: number }; interface Pane { - paste: (text: string, submit?: boolean) => void; + /** `files`: image paths pasted after `text`, one paste each. */ + paste: (text: string, submit?: boolean, files?: string[]) => void; visible: () => boolean; key?: (data: string) => void; /** `menuOnly`: null at once unless a row could be a menu's cursor row. */ @@ -62,19 +66,19 @@ function ofLane(runId: string, laneId: number): boolean { /** Pastes `text` into the pane of `runId` when it is mounted and on screen; * false otherwise (not mounted yet, or hidden). */ -export function pasteToRun(runId: string, text: string): boolean { +export function pasteToRun(runId: string, text: string, files: string[] = []): boolean { const p = panes.get(runId); if (!p?.visible()) return false; - p.paste(text); + p.paste(text, false, files); return true; } /** Sends `text` as a message to the pane of `runId`: a paste, then Enter. * False when the pane is not mounted or not attached. */ -export function submitToRun(runId: string, text: string): boolean { +export function submitToRun(runId: string, text: string, files: string[] = []): boolean { const p = panes.get(runId); if (!p?.visible()) return false; - p.paste(text, true); + p.paste(text, true, files); return true; } diff --git a/client/src/lib/sessionChange.ts b/client/src/lib/sessionChange.ts new file mode 100644 index 00000000..a8481816 --- /dev/null +++ b/client/src/lib/sessionChange.ts @@ -0,0 +1,32 @@ +/** + * @file sessionChange.ts + * @description `session_created` / `session_updated` matcher for live-refresh + * callers that care about only a few session columns. A session row is + * re-broadcast on nearly every hook (last activity, name, tokens…), so + * matching the bare message types made every such frame refetch; this one + * fires on a new session, or when the chosen key of a session actually + * changed. Each call keeps its own memory of the keys it has seen. + * @author Nguyễn Ngọc Trí Vĩ + */ + +import type { Session, WSMessage } from "./types"; + +/** The columns that move a session between the active / waiting / archived counts. */ +export const sessionStateKeyOf = (s: Partial): string => + `${s.status}:${s.awaiting_input_since ? 1 : 0}:${s.archived_at ? 1 : 0}`; + +export function sessionChangeMatcher( + keyOf: (s: Partial) => string = sessionStateKeyOf +): (msg: WSMessage) => boolean { + const seen = new Map(); + return (msg) => { + if (msg.type !== "session_created" && msg.type !== "session_updated") return false; + const s = msg.data as Partial | undefined; + // A frame we cannot key is taken as a change: refetching is the safe side. + if (!s || typeof s.id !== "string") return true; + const key = keyOf(s); + if (msg.type === "session_updated" && seen.get(s.id) === key) return false; + seen.set(s.id, key); + return true; + }; +} diff --git a/client/src/pages/Dashboard.tsx b/client/src/pages/Dashboard.tsx index 1157b20f..9a558fec 100644 --- a/client/src/pages/Dashboard.tsx +++ b/client/src/pages/Dashboard.tsx @@ -2790,9 +2790,12 @@ function RecentActivityPanel({ sessionsById }: { sessionsById: Map { load(); }, [load]); - useLiveRefresh(load, { intervalMs: 10000 }); + // New events arrive over the WebSocket (prepended below); a reload is only + // for what the socket cannot carry: a remote source's import, a gap while it + // was down (reconnect) or the tab hidden (shown again), and a slow safety poll. + useLiveRefresh(load, { intervalMs: 60000, match: isRemoteDataRefreshMessage }); - // A new event is prepended at once (no reload); the poll reconciles. + // A new event is prepended at once (no reload); the reloads reconcile. useEffect( () => eventBus.subscribe((msg: WSMessage) => { diff --git a/client/src/pages/SessionDetail.tsx b/client/src/pages/SessionDetail.tsx index 6f90fa59..738fc024 100644 --- a/client/src/pages/SessionDetail.tsx +++ b/client/src/pages/SessionDetail.tsx @@ -1129,7 +1129,11 @@ export function SessionDetail() { {visitedTabs.has("conversation") && ( )} diff --git a/client/src/pages/Settings.tsx b/client/src/pages/Settings.tsx index 86f1b02c..1a6cf034 100644 --- a/client/src/pages/Settings.tsx +++ b/client/src/pages/Settings.tsx @@ -1,6 +1,6 @@ /** * @file Settings.tsx - * @description The install-wide settings, as three pages of the Settings nav (`SettingsHub.tsx`): `section="data"` — total cost, database overview, workspace housekeeping (dry run first, confirm before a real run), import, remote sources, push ingest (`components/settings/PushIngestSettings.tsx`), privacy (`components/settings/PrivacySettings.tsx`), the daily database backup (`components/settings/BackupSettings.tsx`), export, this browser's preferences backup, session cleanup (whole days ≥ 1, a dry-run count in its confirm) and the danger zone (typed confirmation) —, `section="about"` (the System page) — the start-at-login switch and Quit (`AutostartSettings`), then the server process (release, uptime, platform, CPU, memory, live connections), how AgentHub is installed (the update check's cached status) and the database file — and `section="notifications"` — browser notifications (per-browser, with a reset) and alerts (server-wide). Server info (`/api/settings/info`) is read only by Data and About, refreshed on activity at most every 10 s. Language, theme and the pet live on the Appearance page (`components/settings/AppearanceSettings.tsx`); per-tool settings live in that tool's page under `/settings/agents/`. + * @description The install-wide settings, as three pages of the Settings nav (`SettingsHub.tsx`): `section="data"` — total cost, database overview, workspace housekeeping (dry run first, confirm before a real run), import, remote sources, push ingest (`components/settings/PushIngestSettings.tsx`), privacy (`components/settings/PrivacySettings.tsx`), the daily database backup (`components/settings/BackupSettings.tsx`), export, this browser's preferences backup, session cleanup (whole days ≥ 1, a dry-run count in its confirm; under it the opt-in automatic cleanup and Compact, `components/settings/RetentionSettings.tsx`) and the danger zone (typed confirmation) —, `section="about"` (the System page) — the start-at-login switch and Quit (`AutostartSettings`), then the server process (release, uptime, platform, CPU, memory, live connections), how AgentHub is installed (the update check's cached status) and the database file — and `section="notifications"` — browser notifications (per-browser, with a reset) and alerts (server-wide). Server info (`/api/settings/info`) is read only by Data and About, refreshed on activity at most every 10 s. Language, theme and the pet live on the Appearance page (`components/settings/AppearanceSettings.tsx`); per-tool settings live in that tool's page under `/settings/agents/`. * @author Nguyễn Ngọc Trí Vĩ */ /* ============================================================================= @@ -103,6 +103,7 @@ import { RemoteSources } from "../components/RemoteSources"; import { PushIngestSettings } from "../components/settings/PushIngestSettings"; import { PrivacySettings } from "../components/settings/PrivacySettings"; import { BackupSettings } from "../components/settings/BackupSettings"; +import { RetentionSettings } from "../components/settings/RetentionSettings"; import { AutostartSettings } from "../components/settings/AutostartSettings"; import { usePermissions } from "../components/AuthGate"; import { Skeleton } from "../components/Skeleton"; @@ -1054,6 +1055,8 @@ export function Settings({ {actionBanner(["cleanup"])} + + {/* ─── THIS BROWSER'S PREFERENCES ─── */} diff --git a/client/src/pages/Workspace.tsx b/client/src/pages/Workspace.tsx index 3d894398..7304c74a 100644 --- a/client/src/pages/Workspace.tsx +++ b/client/src/pages/Workspace.tsx @@ -85,6 +85,9 @@ import { endRuns } from "../lib/stopSession"; import { ContextMenu, MenuItem, useContextMenu } from "../components/ContextMenu"; import { confirmDiscard } from "../lib/confirm"; import { keepIfSame } from "../lib/keepIfSame"; +import { laneChangeMatcher, runKeyOf } from "../lib/laneChange"; +import { sessionChangeMatcher } from "../lib/sessionChange"; +import { useLiveRefresh } from "../hooks/useLiveRefresh"; import { useWorkLanes } from "../hooks/useLanes"; import { LaneConsolePane } from "../components/run/LaneConsolePane"; import { @@ -1044,9 +1047,10 @@ export function Workspace() { .catch(() => undefined); }, []); - // Goes through `keepIfSame`: this fires every 5 s below, and a - // fresh-but-identical payload would otherwise re-render the lane strip, the - // lane card and the whole console area on every tick for nothing. + // Goes through `keepIfSame`: this re-reads on run-moving messages and a + // fallback poll below, and a fresh-but-identical payload would otherwise + // re-render the lane strip, the lane card and the whole console area for + // nothing. const refreshList = useCallback(() => { api.run .list() @@ -1061,33 +1065,30 @@ export function Workspace() { window.dispatchEvent(new CustomEvent(LIVE_RUNS_EVENT, { detail: activeRuns.items })); }, [activeRuns]); - // Background poll so the run list and history reflect external changes - // (server-boot reconciliation, sibling tabs, direct DB edits) even when - // no WS event fires. Lighter than typical WS gaps; aggressive enough that - // status flips appear within seconds without needing a manual refresh. + // The run list follows the WebSocket instead of a blind 5 s poll: a pane + // starting, ending or learning its session in slot 0 moves the lane's run + // columns (`lane_update`); an agent starting in a free tab (slots 1–9) + // shows as a new session, one ending as a session status change, and a pane + // dying under its agent as `runs_interrupted`. This page's own starts, stops + // and a shown terminal's exit call `refreshList` directly + // (`onRunsChanged`). What none of those cover — a shell tab opened or closed + // from another browser, server-boot reconciliation — is caught by the + // 30 s fallback poll, on reconnect, and when the tab is shown or focused. + const [laneRunChanged] = useState(() => laneChangeMatcher(runKeyOf)); + const [sessionRunChanged] = useState(() => sessionChangeMatcher((s) => `${s.status}`)); useEffect(() => { refreshList(); - const tick = setInterval(() => { - // Hidden tab: skip; the visibility handler below re-reads on show. - if (document.visibilityState === "visible") refreshList(); - }, 5000); - return () => clearInterval(tick); }, [refreshList]); - - // Refresh whenever the tab regains focus / visibility - typical when the - // user comes back from running `claude` in a terminal and wants to see the - // current state of every run without waiting for the next poll. + useLiveRefresh(refreshList, { + intervalMs: 30_000, + throttleMs: 1500, + match: (msg) => + msg.type === "runs_interrupted" || laneRunChanged(msg) || sessionRunChanged(msg), + }); useEffect(() => { const onFocus = () => refreshList(); - const onVis = () => { - if (document.visibilityState === "visible") refreshList(); - }; window.addEventListener("focus", onFocus); - document.addEventListener("visibilitychange", onVis); - return () => { - window.removeEventListener("focus", onFocus); - document.removeEventListener("visibilitychange", onVis); - }; + return () => window.removeEventListener("focus", onFocus); }, [refreshList]); const currentLane = selectedLaneId !== null ? lanes.find((l) => l.id === selectedLaneId) : null; diff --git a/client/src/pages/__tests__/Settings.test.tsx b/client/src/pages/__tests__/Settings.test.tsx index 2da66d7e..7cfa1db7 100644 --- a/client/src/pages/__tests__/Settings.test.tsx +++ b/client/src/pages/__tests__/Settings.test.tsx @@ -77,6 +77,18 @@ vi.mock("../../lib/api", async (importOriginal) => { env_owned: { dir: false, hour: false, keep: false }, })), }, + retention: { + get: vi.fn(async () => ({ + days: 0, + max_days: 3650, + env_owned: { days: false }, + last_run: null, + space: null, + db_size: 0, + compacting: false, + last_compact: null, + })), + }, }, }, }; diff --git a/client/src/pages/__tests__/__snapshots__/screens.snapshot.test.tsx.snap b/client/src/pages/__tests__/__snapshots__/screens.snapshot.test.tsx.snap index 80adb12a..710285d1 100644 --- a/client/src/pages/__tests__/__snapshots__/screens.snapshot.test.tsx.snap +++ b/client/src/pages/__tests__/__snapshots__/screens.snapshot.test.tsx.snap @@ -9357,6 +9357,108 @@ exit 0 Run Cleanup +
+
+

+ Automatic cleanup +

+

+ Off by default. When on, the hourly maintenance deletes finished sessions (completed, error, abandoned) that started more than this many days ago — with their events, agents and token usage — a little at a time. +

+
+
+
+ +
+ + + days + +
+
+ +
+

+ Automatic cleanup is off. +

+
+ +
+
{ env_owned: { dir: false, hour: false, keep: false }, }), }, + retention: { + get: r({ + days: 0, + max_days: 3650, + env_owned: { days: false }, + last_run: null, + space: null, + db_size: 0, + compacting: false, + last_compact: null, + }), + }, exportData: () => "/api/settings/export", cleanup: r({ ok: true, diff --git a/docs/API.md b/docs/API.md index d2c84baf..4ada6d57 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1006,6 +1006,9 @@ cannot collide on `index.lock`. the file resolves by removing it. `merge-commit` is `409 ECONFLICTS` while anything is unmerged, and it and `merge-abort` are `409 ENOMERGE` with no merge in progress. `merge-abort` needs `confirm: true` (`400 ECONFIRM`). +- Any action on a host with no `git` binary (or none on the dashboard's PATH) + is `503 EGITMISSING`: a missing dependency, not a bad request; the message + carries the install command (like `ETMUXMISSING` for tmux). - `push` pushes `HEAD`, never a branch name from the request, so a workspace can only push the branch it is on. - A **path** in the body is never trusted as a path: `stage`, `unstage` and @@ -3057,6 +3060,16 @@ POST /api/settings/backup/run 202 — started (or already running); poll GE Settings → Data → **Daily backup** (`server/lib/db-backup.js`). Once a day, at `hour` (0–23, the server's local time, default 2), the database is copied to `dir` as `agenthub-YYYYMMDD-HHMMSS.db`: `VACUUM INTO` on a read-only connection in a worker thread, so the copy is a consistent snapshot (writes from another dashboard on the same database never restart it), compacted, and the event loop keeps serving while it runs (≈30 s for a 1.25 GB database). It is written as `.partial` and renamed when complete. Beyond `keep` (1–365, default 7) the oldest are deleted — only regular files matching that exact name; nothing else in the folder, and no symlink, is ever touched. A day missed while the server was down runs at the next start; a failed run is retried the next day or by **Back up now**, never every minute. The three values persist to the settings file as `AGENTHUB_BACKUP_DIR` / `AGENTHUB_BACKUP_HOUR` / `AGENTHUB_BACKUP_KEEP`; one the environment set is `env_owned` (`409 EENVOWNED`). Writes are same-origin, and admin-only in server mode. `400 INVALID_PATH` for a relative, missing, non-directory or unwritable folder, `400 INVALID_INPUT` for an hour or count out of range, `400 ENOBACKUPDIR` for a run with no folder. The scheduler beat is `DASHBOARD_BACKUP_TICK_MS` (default 60000, `0` = off). Restoring is manual, on purpose: `agenthub stop`, delete `dashboard.db-wal` and `dashboard.db-shm`, copy a backup over `dashboard.db` (its path is on Settings → System), `agenthub start`. + +### Retention and Compact + +``` +GET /api/settings/retention { days, max_days, env_owned: { days }, last_run, space: { auto_vacuum, page_size, page_count, freelist_pages, free_bytes }, db_size, compacting, last_compact } +PUT /api/settings/retention { days } → the same state; 0 turns it off (the default) +POST /api/settings/compact { confirm: true } → 202 — started (or already running); poll GET while `compacting` +``` + +Settings → Data → **Session cleanup** (`server/lib/db-retention.js`). Automatic retention is OFF unless `days` (1–3650, `AGENTHUB_RETENTION_DAYS` in the settings file) is set; nothing is deleted by default. When set, the hourly maintenance (`DASHBOARD_DB_MAINTAIN_MS`) purges finished (completed/error/abandoned) sessions that started more than `days` ago — the same rule and the same deletion (`purgeSessionIds`: events, agents, token usage, the session) as `POST /api/settings/cleanup` with `purge_days` — 25 sessions per transaction with a yield between, at most 5000 per run. A new database is created with `auto_vacuum = INCREMENTAL`, an existing one up to 32 MB is converted by a VACUUM at startup; the same hourly run then returns free pages to the OS (`incremental_vacuum`, in 1024-page slices, at most 65536 pages per run) once more than 1024 are free. A larger, older database is converted only by **Compact**: a full VACUUM in a worker thread followed by a TRUNCATE checkpoint — it holds the write lock while it runs (tens of seconds on a GB-size file), so hooks wait meanwhile; it runs only on a click. In server mode both writes are an admin's (`/settings` is in `ADMIN_WRITE_PREFIXES`). --- ## WebSocket API diff --git a/docs/DATABASE.md b/docs/DATABASE.md index d094779b..685a8066 100644 --- a/docs/DATABASE.md +++ b/docs/DATABASE.md @@ -915,7 +915,7 @@ worker's own writable connection. SQLite's automatic checkpoint runs inside whic per commit under load. A failed checkpoint switches the automatic one back on. A second process on the same file (another dashboard, the CLI) keeps its own setting. -**Upkeep.** `maintainDatabase()` (exported by `server/db.js`) runs hourly from `server/index.js` (`DASHBOARD_DB_MAINTAIN_MS`, `0` = off): a `wal_checkpoint(PASSIVE)` — it never waits on a reader, such as the other dashboard — after which the next write shrinks the WAL to `journal_size_limit`, and `PRAGMA optimize`. Nothing runs `VACUUM`: it rewrites the whole file under an exclusive lock, so space freed by a cleanup is reused for new rows instead of returned to the disk. +**Upkeep.** `maintainDatabase()` (exported by `server/db.js`) runs hourly from `server/index.js` (`DASHBOARD_DB_MAINTAIN_MS`, `0` = off): a `wal_checkpoint(PASSIVE)` — it never waits on a reader, such as the other dashboard — after which the next write shrinks the WAL to `journal_size_limit`, and `PRAGMA optimize`. Then `runScheduledMaintenance` (`server/lib/db-retention.js`) applies the OPT-IN retention (`AGENTHUB_RETENTION_DAYS`, off by default: finished sessions older than N days, purged 25 per transaction like the manual cleanup) and, when the database is in `auto_vacuum = INCREMENTAL` and more than 1024 pages are free, a bounded `incremental_vacuum` (1024-page slices, ≤ 65536 pages per run) that returns them to the disk. A new database is created INCREMENTAL; an existing one up to 32 MB is converted by one `VACUUM` at startup (`convertAutoVacuum`), a larger one only by Settings → Data → **Compact** (`POST /api/settings/compact`: a full `VACUUM` in a worker thread, write lock held while it runs). No automatic path runs a full `VACUUM` on a large file. See docs/API.md § Retention and Compact. **Growth.** `events.data` is the hook payload TRIMMED by `trim_event_data(?)` (`server/lib/event-payload.js`, a SQL function registered on the connection in `server/db.js`, used by every event `INSERT` and by the duplicate guard): Edit/MultiEdit/NotebookEdit/Write drop `tool_response.originalFile`/`oldString`/`newString` (Write also `content`), Read drops `tool_response.file.content`/`base64`, and any string inside `tool_input`/`tool_response` over 8 KB keeps its first 6 KB and last 2 KB; `structuredPatch` and every field outside those two are kept, and `_trimmed` lists what was dropped. The full text stays in the session transcript and AgentHub's snapshot of it under `/transcripts/`, which the Conversation tab reads. Rows stored before this are trimmed once in the background (`sweepEventPayloads`, 200 rows per transaction, `user_version` 4 after marker 3); measured on a 1.2 GB install it took `events.data` from 913 MB to ~400 MB. Freed pages are reused, not returned to the disk (no `VACUUM`). No ROW is pruned automatically. The only deletions are the user's: Settings → clear data / cleanup, a workspace's purge, `scripts/clear-data.js`. Clear data runs in ONE transaction (foreign keys off around it, so workflows are deleted explicitly), cleanup deletes in 500-id chunks inside one transaction. `GET /api/settings/export` streams `events` in keyset pages of 500 instead of loading the table. diff --git a/docs/DEPLOYMENT.md b/docs/DEPLOYMENT.md index bd06d876..13e0977c 100644 --- a/docs/DEPLOYMENT.md +++ b/docs/DEPLOYMENT.md @@ -256,9 +256,9 @@ DASHBOARD_DB_PATH=/var/lib/agenthub/dashboard.db DASHBOARD_WORKFLOW_POLL_MS=12000 # Workflow-tool run journals DASHBOARD_CODEX_POLL_MS=15000 # Codex rollout journals → codex lane running/idle + Codex sessions/tokens CODEX_HOME= # where Codex keeps sessions/ (default ~/.codex) -DASHBOARD_ANTIGRAVITY_POLL_MS=15000 # agy conversation files → Antigravity sessions/tokens +DASHBOARD_ANTIGRAVITY_POLL_MS=15000 # agy conversation files → Antigravity sessions/tokens (60 s while idle) AGENTHUB_GEMINI_DIR= # where agy keeps its data (default ~/.gemini) -DASHBOARD_CURSOR_POLL_MS=15000 # Cursor agent transcripts → Cursor sessions (no tokens) +DASHBOARD_CURSOR_POLL_MS=15000 # Cursor agent transcripts → Cursor sessions (no tokens; 60 s while idle) AGENTHUB_CURSOR_DIR= # where Cursor keeps its data (default ~/.cursor) AGENTHUB_AGY_USAGE= # 0 never runs `agy --print /usage` for the Usage panel's Antigravity quota (default on; running agy may update it) diff --git a/docs/HOOKS.md b/docs/HOOKS.md index fe5e24a4..c560629d 100644 --- a/docs/HOOKS.md +++ b/docs/HOOKS.md @@ -491,7 +491,8 @@ graph TB > entry whose PID is no longer alive** and POSTs the hook payload to one > port per **unique SQLite data directory** (lowest port wins when two > instances share `~/.claude/agenthub`). The other instance re-broadcasts -> the workspaces those hooks moved within `DASHBOARD_LANE_SYNC_MS` (2 s), so its +> the workspaces those hooks moved within `DASHBOARD_LANE_SYNC_MS` (2 s; a server +> alone on its data dir only looks for such a peer every 30 s), so its > browsers see a workspace's status without a refresh. > 3. If neither yields a target, the handler falls back to `4820`. > @@ -589,6 +590,7 @@ Claude Code waits only for the handler process: Node start-up, reading stdin, se - **Fire-and-forget POST** — no wait for the dashboard's reply. - **Incremental transcript reads** — `TranscriptCache` reads only the bytes appended since the last hook. +- **Only new transcript entries are written** — a per-transcript mark (`transcriptMarks` in `server/routes/hooks.js`, set once the hook's transaction commits) skips the token, compaction, API-error and turn-duration writes when the transcript did not change, and walks only the entries after the last one handled when it grew. - **One POST per database, not per server** — servers sharing a database get each event once (`resolveHookIngestPorts`). - **Heavy reads off the event loop** — aggregates run in a worker (`server/lib/read-pool.js`), so a slow page never delays ingest. diff --git a/docs/OVERVIEW.md b/docs/OVERVIEW.md index ed233e6c..8cf91374 100644 --- a/docs/OVERVIEW.md +++ b/docs/OVERVIEW.md @@ -115,7 +115,7 @@ Internal build — all rights reserved. | Need | Version | Required for | |---|---|---| -| **Node.js** | >= 20 (>= 22.5 for a plugin install) | Everything. Both suites are verified green on **24** and **26** | +| **Node.js** | >= 22.5 (`node:sqlite`; Node 20 is end-of-life) | Everything. Both suites are verified green on **24** and **26** | | **npm** | 9+ | Ships with Node | | **git** | any | Cloning, and every workspace operation (worktrees, branch/status reads) | | **tmux** | 3.x | The browser run console, `agenthub workspace shell`, typing `/reload-plugins` into a live pane | diff --git a/docs/OVERVIEW.vi.md b/docs/OVERVIEW.vi.md index 44ec2d3b..1a1bd6bc 100644 --- a/docs/OVERVIEW.vi.md +++ b/docs/OVERVIEW.vi.md @@ -81,7 +81,7 @@ Internal build — all rights reserved. | Cần | Phiên bản | Dùng cho | |---|---|---| -| **Node.js** | >= 20 (>= 22.5 nếu cài qua plugin) | Tất cả. Cả hai test suite verify xanh trên Node **24** và **26** | +| **Node.js** | >= 22.5 (`node:sqlite`; Node 20 đã hết hạn hỗ trợ) | Tất cả. Cả hai test suite verify xanh trên Node **24** và **26** | | **npm** | 9+ | Đi kèm Node | | **git** | bất kỳ | Clone repo, và mọi thao tác workspace (worktree, đọc branch/status) | | **tmux** | 3.x | Run console trên trình duyệt, `agenthub workspace shell`, gõ `/reload-plugins` vào pane đang sống | diff --git a/docs/PLUGINS.md b/docs/PLUGINS.md index 1967a8cb..049f935c 100644 --- a/docs/PLUGINS.md +++ b/docs/PLUGINS.md @@ -61,13 +61,13 @@ claude --plugin-dir plugins/agenthub-analytics ## Prerequisites - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) installed and authenticated -- Node **>= 22.5** when installing via the `agenthub` plugin. A plugin install has no - native `better-sqlite3`, so the server stores data through `node:sqlite`, which - landed in 22.5. The bootstrap refuses with one line on anything older instead - of letting the server crash. (A checkout install still works on Node >= 20.) +- Node **>= 22.5**. A plugin install has no native `better-sqlite3`, so the + server stores data through `node:sqlite`, which landed in 22.5. The bootstrap + refuses on anything older instead of letting the server crash, and says so in + the session (below). A checkout needs the same (`engines` in `package.json`). - The Agent Monitor dashboard reachable at `http://localhost:4820` — the `agenthub` plugin starts it for you; a checkout starts it with `npm start` (see - [SETUP.md](../SETUP.md)) + [INSTALL.md](../INSTALL.md)) Skills and commands are invoked as `/agenthub-:`. Agents are dispatched automatically by Claude Code (or named explicitly). @@ -124,12 +124,12 @@ waits on an install: 1. **Fast path** — recorded state matches this plugin build and a server is live → exit. "Live" means a discovery entry whose pid answers AND whose `startedAt` is after this boot (60 s margin): an entry left over from before a reboot names a pid the OS may have handed to an unrelated process, and without systemd (macOS) nothing else clears it. 2. **Superseded check** — if Claude Code records a DIFFERENT build of this plugin as installed, this one logs a line and does nothing else (see [A retired build never acts](#a-retired-build-never-acts)). -3. **Node gate** — refuse below 22.5 with one line (see Prerequisites). +3. **Node gate** — refuse below 22.5 with one line (see Prerequisites). Also checked by the foreground pass itself (it costs nothing), which then spawns no worker and tells the session at once. 4. **Lock** — atomic `mkdir` lock holding the PID; reclaimed when the owner is dead or the lock is older than 10 minutes, so two sessions cannot race the install or spawn two servers. -5. **Install** — `npm install --omit=dev --ignore-scripts` into the runtime dir, run as the npm bundled with the node running the bootstrap (`npmCommand`: its `npm-cli.js` beside `process.execPath`, no shell, that node's directory first on PATH; `npm` on PATH only when that node ships none) — the update chain runs with the dashboard server's environment, whose PATH need not reach `npm.cmd` on Windows. The UI build below and the doctor's npm row use the same npm (never into the plugin cache, which is garbage-collected and replaced on every update). `--ignore-scripts` keeps the root `postinstall` from pulling the whole Vite client toolchain. +5. **Install** — only when the dependencies changed (`depsHash` covers what npm installs — the dependency lists and the lockfile's package tree — never the release's own `version`, so a plain version bump reinstalls nothing): `npm install --omit=dev --ignore-scripts` into the runtime dir, output in `runtime/npm-install.log`, run as the npm bundled with the node running the bootstrap (`npmCommand`: its `npm-cli.js` beside `process.execPath`, no shell, that node's directory first on PATH; `npm` on PATH only when that node ships none) — the update chain runs with the dashboard server's environment, whose PATH need not reach `npm.cmd` on Windows. The UI build below and the doctor's npm row use the same npm (never into the plugin cache, which is garbage-collected and replaced on every update). `--ignore-scripts` keeps the root `postinstall` from pulling the whole Vite client toolchain. 6. **Legacy hook cleanup** — see above. 7. **CLI** — write the `~/.local/bin/agenthub` launcher, never clobbering a `agenthub` the bootstrap did not write. It pins the node that ran the bootstrap and falls back to `node` on `PATH` when that binary is gone (a Homebrew Cellar or nvm path deleted by an upgrade). -8. **UI build** — `client/` is copied into the runtime dir and built there (`npm ci --include=dev --ignore-scripts`, falling back to `npm install` with the same flags, then `tsc -b` and `vite build` run by the bootstrap's own `node` — the client's `build` script without `npm run`), landing in `runtime/client-dist` — the same directory the server serves from. Nothing in it looks `node` up on PATH: on Windows an install script or a `.bin/*.cmd` shim runs through cmd.exe, and the server's PATH may have no `node` (esbuild's postinstall failed there with "'node' is not recognized" and the update kept the old UI); esbuild, the only dependency with an install script, finds its binary without it. `--include=dev` is required, not tidy: the entire build toolchain (`vite`, `typescript`, `@vitejs/plugin-react`, `tailwindcss`, `@types/*`) is a devDependency, and npm reads an inherited `NODE_ENV=production` as `--omit=dev`. Every bootstrap descended from the running server carries that env — the self-update chain, and any `SessionStart` fired by a `claude` inside a tmux pane the server started — so without the flag the install drops `vite` and the build dies on missing types. Skipped when a bundle for the current version already exists; a failure here does not fail the bootstrap (the API still works, and `/agenthub-open` can retry) but does mean `/run` 404s until it's fixed — and when a bundle from the PREVIOUS version is still on disk the failure is quieter still: the dashboard keeps serving the old UI against the new API, visible only as the Settings page's `UI build vX (rebuild client to match)` line. +8. **UI build** — `client/` is copied into the runtime dir and built there (`npm ci --include=dev --ignore-scripts`, falling back to `npm install` with the same flags — skipped while `client/package.json` and its lockfile are unchanged, because the installed tree in `runtime/client-src/node_modules` is kept with a `.agenthub-deps` stamp; a failed build drops the stamp so the next one installs from clean — then `vite build` run by the bootstrap's own `node`: the vite half of the client's `build` script without `npm run`. The `tsc -b` half is the release's job, not every user's: it emits nothing the bundle needs and cost ~25 s and ~900 MB per update), landing in `runtime/client-dist` — the same directory the server serves from. Nothing in it looks `node` up on PATH: on Windows an install script or a `.bin/*.cmd` shim runs through cmd.exe, and the server's PATH may have no `node` (esbuild's postinstall failed there with "'node' is not recognized" and the update kept the old UI); esbuild, the only dependency with an install script, finds its binary without it. `--include=dev` is required, not tidy: the entire build toolchain (`vite`, `typescript`, `@vitejs/plugin-react`, `tailwindcss`, `@types/*`) is a devDependency, and npm reads an inherited `NODE_ENV=production` as `--omit=dev`. Every bootstrap descended from the running server carries that env — the self-update chain, and any `SessionStart` fired by a `claude` inside a tmux pane the server started — so without the flag the install drops `vite` and the build dies on missing types. Skipped when a bundle for the current version already exists (`clientBuild` in `state.json`, recorded only after a build that did not fail, so the next session retries a failed one); a failure here does not fail the bootstrap (the API still works, and `/agenthub-open` can retry) but does mean `/run` 404s until it's fixed — and when a bundle from the PREVIOUS version is still on disk the failure is quieter still: the dashboard keeps serving the old UI against the new API, visible only as the Settings page's `UI build vX (rebuild client to match)` line. 9. **Server** — when the user has turned **Start AgentHub automatically** on (Settings → System; OFF by default), install/refresh the `agenthub.service` unit on Linux — on macOS with a GUI login, the @@ -149,10 +149,21 @@ waits on an install: The first run takes a few minutes — most of it is the UI build, which is what makes client-only routes (`http://localhost:4820/run`, and every other page) work the moment `claude` starts, with no manual `/agenthub-open` step. Progress -goes to `~/.claude/agenthub/runtime/bootstrap.log`; the UI build's own -output goes to `client-build.log` next to it; the server's own output goes to +goes to `~/.claude/agenthub/runtime/bootstrap.log`; npm's own output goes to +`npm-install.log` and the UI build's to `client-build.log` next to it; the server's own output goes to `server.log`. +**A failure is reported once, in the session.** The worker's output is +discarded, so a Node that is too old, a failed npm install or a failed UI build +is recorded in `runtime/last-failure.json` (kind, message, log file). The NEXT +foreground pass — its stdout is what Claude Code reads — prints it as a +SessionStart `{"systemMessage": "AgentHub: … — details in . Run +/agenthub-doctor …"}` and marks it reported, so the same failure is not repeated +every session; a different failure is reported again, and a bootstrap that +succeeds removes the file. The steady state prints nothing, and the report is a +single small read (plus one write, only when there is something to show) — the +fast path still spawns nothing. + ### A retired build never acts `claude plugin update` unpacks the new version into a **new** cache directory diff --git a/docs/README.md b/docs/README.md index dd392998..09d55690 100644 --- a/docs/README.md +++ b/docs/README.md @@ -9,8 +9,7 @@ Comprehensive documentation for the Agent Dashboard project. - [Architecture Overview](../ARCHITECTURE.md) - System design and technical reference - [I18N Architecture](./I18N.md) - Internationalization architecture and usage guide - [CLI Reference](./CLI.md) - The `agenthub` terminal CLI: every command, discovery, safety model -- [Setup Guide](../SETUP.md) - Installation and configuration -- [Installation](../INSTALL.md) - Detailed installation instructions +- [Installation & setup](../INSTALL.md) - Installation, configuration and troubleshooting --- @@ -20,7 +19,7 @@ Comprehensive documentation for the Agent Dashboard project. ```mermaid graph TB - Start[Start Here] --> Setup[SETUP.md
Installation & Config] + Start[Start Here] --> Setup[INSTALL.md
Installation & Config] Start --> Architecture[ARCHITECTURE.md
System Design] Setup --> Client[Client README
React UI docs] @@ -62,7 +61,7 @@ graph TB ```mermaid graph LR - A[New to Project] --> B[Read SETUP.md] + A[New to Project] --> B[Read INSTALL.md] B --> C[Install Dependencies] C --> D[Run npm run dev] D --> E[Open localhost:5173] @@ -75,7 +74,7 @@ graph LR 1. Install the system packages — `node` (20+), `git`, and `tmux` (the run console has no fallback without it): [INSTALL.md → Step 0](../INSTALL.md#step-0--system-packages) -2. Read [SETUP.md](../SETUP.md) +2. Read the rest of [INSTALL.md](../INSTALL.md) 3. Run `npm run setup` 4. Run `npm run dev` 5. Open browser to `http://localhost:5173` @@ -287,7 +286,7 @@ graph LR **Documentation:** - [Hook System Guide](./HOOKS.md) - [Hook Processing](../server/README.md#hook-processing) -- [Installation](../SETUP.md#install-hooks) +- [Installation](../INSTALL.md#hook-auto-installation) --- @@ -441,4 +440,4 @@ This documentation covers: - ✅ **Internationalization** - Language resources, switching flow, locale formatting, rollout checklist - ✅ **Development guides** - Setup, testing, contributing -**Start with:** [SETUP.md](../SETUP.md) for installation, then explore specific areas based on your role. +**Start with:** [INSTALL.md](../INSTALL.md) for installation, then explore specific areas based on your role. diff --git a/openapi.yaml b/openapi.yaml index 3d91562c..a523baae 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -3,7 +3,7 @@ openapi: 3.0.3 info: title: Agent Dashboard for Claude Code API - version: 2.8.5 + version: 2.8.7 description: HTTP API for real-time Claude Code session monitoring, agent lifecycle tracking, analytics, pricing, hooks ingestion, and workflow intelligence. contact: name: Nguyễn Ngọc Trí Vĩ @@ -13328,6 +13328,178 @@ paths: description: 'ENOBACKUPDIR: no backup folder is set' '403': description: 'EBADORIGIN: another site asked' + /api/settings/retention: + get: + tags: + - Settings + summary: Automatic retention and database space + operationId: getRetention + responses: + '200': + description: Automatic retention setting, database space and the last Compact + content: + application/json: + schema: + type: object + required: + - days + - max_days + - env_owned + - compacting + properties: + days: + type: integer + minimum: 0 + maximum: 3650 + description: Finished sessions older than this many days are purged by the hourly maintenance; 0 = off (the default) + max_days: + type: integer + env_owned: + type: object + properties: + days: + type: boolean + last_run: + type: object + nullable: true + description: 'This process''s last hourly maintenance: {at, retention?: {purged_sessions, purged_events, purged_agents, error?}, reclaim: {reclaimed_pages, error?}, ms}' + space: + type: object + nullable: true + properties: + auto_vacuum: + type: string + enum: + - none + - full + - incremental + page_size: + type: integer + page_count: + type: integer + freelist_pages: + type: integer + free_bytes: + type: integer + db_size: + type: integer + description: Database file size in bytes + compacting: + type: boolean + last_compact: + type: object + nullable: true + description: 'This process''s last Compact: {at, ok, size_before?, size_after?, ms?, error?}' + put: + tags: + - Settings + summary: Set the automatic retention + description: Persisted to the settings file as AGENTHUB_RETENTION_DAYS. 0 turns it off. Same-origin only; in server mode an admin's. + operationId: setRetention + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - days + properties: + days: + type: integer + minimum: 0 + maximum: 3650 + responses: + '200': + description: The new state + content: + application/json: + schema: + type: object + required: + - days + - max_days + - env_owned + - compacting + properties: + days: + type: integer + minimum: 0 + maximum: 3650 + description: Finished sessions older than this many days are purged by the hourly maintenance; 0 = off (the default) + max_days: + type: integer + env_owned: + type: object + properties: + days: + type: boolean + last_run: + type: object + nullable: true + description: 'This process''s last hourly maintenance: {at, retention?: {purged_sessions, purged_events, purged_agents, error?}, reclaim: {reclaimed_pages, error?}, ms}' + space: + type: object + nullable: true + properties: + auto_vacuum: + type: string + enum: + - none + - full + - incremental + page_size: + type: integer + page_count: + type: integer + freelist_pages: + type: integer + free_bytes: + type: integer + db_size: + type: integer + description: Database file size in bytes + compacting: + type: boolean + last_compact: + type: object + nullable: true + description: 'This process''s last Compact: {at, ok, size_before?, size_after?, ms?, error?}' + '400': + description: 'INVALID_INPUT: days is not a whole number from 0 to 3650' + '403': + description: 'EBADORIGIN: another site asked' + '409': + description: 'EENVOWNED: the environment set AGENTHUB_RETENTION_DAYS' + '500': + description: 'ESAVE: the settings file could not be written' + /api/settings/compact: + post: + tags: + - Settings + summary: Compact the database now (full VACUUM) + description: Rewrites the database in a worker thread, switching it to incremental auto_vacuum, then truncates the WAL. Hook writes wait while it runs. Answers at once; poll GET /api/settings/retention while `compacting`. Same-origin only; in server mode an admin's. + operationId: compactDatabase + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - confirm + properties: + confirm: + type: boolean + enum: + - true + responses: + '202': + description: Started (or already running); the retention state + '400': + description: 'ECONFIRM: confirm: true is missing' + '403': + description: 'EBADORIGIN: another site asked' /api/settings/codex-hooks: get: tags: diff --git a/package-lock.json b/package-lock.json index 01beb12d..5c601450 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,6 @@ "cors": "^2.8.5", "express": "^4.21.2", "multer": "^2.0.0", - "redoc": "^2.5.3", "swagger-ui-express": "^5.0.1", "systray2": "^2.1.4", "tar": "^7.4.3", @@ -32,44 +31,12 @@ "prettier": "^3.8.1" }, "engines": { - "node": ">=20.0.0" + "node": ">=22.5.0" }, "optionalDependencies": { "better-sqlite3": "^12.0.0" } }, - "node_modules/@babel/runtime": { - "version": "7.29.10", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.10.tgz", - "integrity": "sha512-NpugTzbKgGrNe45Ui32cN8vCFFMxVtP/9rtfwv0nP5FRDAjvYBxJcLVpYA9mr1jxP6cnIT7x9LUzuDTbWYYNRA==", - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@emotion/is-prop-valid": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.4.0.tgz", - "integrity": "sha512-QgD4fyscGcbbKwJmqNvUMSE02OsHUa+lAWKdEUIJKgqe5IwRSKd7+KhibEWdaKwgjLj0DRSHA9biAIqGBk05lw==", - "license": "MIT", - "peer": true, - "dependencies": { - "@emotion/memoize": "^0.9.0" - } - }, - "node_modules/@emotion/memoize": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.9.0.tgz", - "integrity": "sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ==", - "license": "MIT", - "peer": true - }, - "node_modules/@exodus/schemasafe": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@exodus/schemasafe/-/schemasafe-1.3.0.tgz", - "integrity": "sha512-5Aap/GaRupgNx/feGBwLLTVv8OQFfv3pq2lPRzPg9R+IOBnDgghTGW7l7EuVXOvg5cc/xSAlRW8rBrjIC3Nvqw==", - "license": "MIT" - }, "node_modules/@isaacs/fs-minipass": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", @@ -174,61 +141,6 @@ "win32" ] }, - "node_modules/@nodable/entities": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-3.1.0.tgz", - "integrity": "sha512-LsS/DjHr+uDM647Gru/cA8+J3a3HfhttwCKLyuoyN7yXTFCxKBtSgMQBvrW9yNPa2/zDRUNuGPaH5QUFoa4arQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/nodable" - } - ], - "license": "MIT" - }, - "node_modules/@redocly/ajv": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.11.2.tgz", - "integrity": "sha512-io1JpnwtIcvojV7QKDUSIuMN/ikdOUd1ReEnUnMKGfDVridQZ31J0MmIuqwuRjWDZfmvr+Q0MqCcfHM2gTivOg==", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js-replace": "^1.0.1" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/@redocly/config": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/@redocly/config/-/config-0.22.0.tgz", - "integrity": "sha512-gAy93Ddo01Z3bHuVdPWfCwzgfaYgMdaZPcfL7JZ7hWJoK9V0lXDbigTWkhiPFAaLWzbOJ+kbUQG1+XwIm0KRGQ==", - "license": "MIT" - }, - "node_modules/@redocly/openapi-core": { - "version": "1.34.20", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.34.20.tgz", - "integrity": "sha512-ypeBZ/6BKXR9+7/TtbKhbl4UgD7raHhPS12oknlKno2A8+lnFkxIwiE/Aklu6L2cd/ioH+fCWuMxi9/p3EyAPw==", - "license": "MIT", - "dependencies": { - "@redocly/ajv": "8.11.2", - "@redocly/config": "0.22.0", - "colorette": "1.4.0", - "https-proxy-agent": "7.0.6", - "js-levenshtein": "1.1.6", - "js-yaml": "4.3.2", - "minimatch": "5.1.9", - "pluralize": "8.0.0", - "yaml-ast-parser": "0.0.43" - }, - "engines": { - "node": ">=18.17.0", - "npm": ">=9.5.0" - } - }, "node_modules/@scarf/scarf": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.4.0.tgz", @@ -236,19 +148,6 @@ "hasInstallScript": true, "license": "Apache-2.0" }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "license": "MIT" - }, - "node_modules/@types/trusted-types": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", - "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", - "license": "MIT", - "optional": true - }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -284,6 +183,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -293,6 +193,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -304,18 +205,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/anynum": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/anynum/-/anynum-1.0.1.tgz", - "integrity": "sha512-N6//FLET/tXYNM/F6ABca1oH6fWB+KlTt909Le28WMDBk8oaT4vY17DCrwg2MvmuqUKt3Ni4N5dGJ/EoBgcO6A==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - } - ], - "license": "MIT" - }, "node_modules/append-field": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", @@ -326,6 +215,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, "license": "Python-2.0" }, "node_modules/array-flatten": { @@ -346,12 +236,6 @@ "safer-buffer": "^2.1.0" } }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "license": "MIT" - }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -440,15 +324,6 @@ "npm": "1.2.8000 || >= 1.4.16" } }, - "node_modules/brace-expansion": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz", - "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", @@ -529,22 +404,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/call-me-maybe": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", - "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==", - "license": "MIT" - }, - "node_modules/camelize": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.1.tgz", - "integrity": "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==", - "license": "MIT", - "peer": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -584,16 +443,11 @@ "node": ">=18" } }, - "node_modules/classnames": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz", - "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==", - "license": "MIT" - }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, "license": "ISC", "dependencies": { "string-width": "^4.2.0", @@ -604,19 +458,11 @@ "node": ">=12" } }, - "node_modules/clsx": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", - "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -629,12 +475,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "license": "MIT" - }, - "node_modules/colorette": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", - "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "dev": true, "license": "MIT" }, "node_modules/concurrently": { @@ -698,21 +539,6 @@ "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==", "license": "MIT" }, - "node_modules/core-js": { - "version": "3.50.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.50.0.tgz", - "integrity": "sha512-BRWgOLKkFeCgRudR6zrs8p9XJZcE14grzKMMssoYrk6krtuEZ7MTKPIY5RzOnqsEKIR9kst7wNzphttraT+Yqw==", - "hasInstallScript": true, - "license": "MIT", - "peer": true, - "engines": { - "node": "*" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, "node_modules/cors": { "version": "2.8.6", "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", @@ -730,35 +556,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/css-color-keywords": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz", - "integrity": "sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg==", - "license": "ISC", - "peer": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/css-to-react-native": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-3.2.0.tgz", - "integrity": "sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ==", - "license": "MIT", - "peer": true, - "dependencies": { - "camelize": "^1.0.0", - "css-color-keywords": "^1.0.0", - "postcss-value-parser": "^4.0.2" - } - }, - "node_modules/csstype": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", - "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", - "license": "MIT", - "peer": true - }, "node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -768,11 +565,6 @@ "ms": "2.0.0" } }, - "node_modules/decko": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decko/-/decko-1.2.0.tgz", - "integrity": "sha512-m8FnyHXV1QX+S1cl+KPFDIl6NMkxtKsy6+U/aYyjrOqWMuwAwYWu7ePqrsUHtDR5Y8Yk2pi/KIDSgF+vT4cPOQ==" - }, "node_modules/decompress-response": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", @@ -828,15 +620,6 @@ "node": ">=8" } }, - "node_modules/dompurify": { - "version": "3.4.16", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.16.tgz", - "integrity": "sha512-sqo+pNp3qRhCIpbgRi1y8Tgk27Bo2Ry7w0dC1NBeNTdZChWjz9Xb/KOoZbRP/R6pQZ80Qw8YhXw13hWWBbMRnQ==", - "license": "(MPL-2.0 OR Apache-2.0)", - "optionalDependencies": { - "@types/trusted-types": "^2.0.7" - } - }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -870,6 +653,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, "license": "MIT" }, "node_modules/encodeurl": { @@ -921,16 +705,11 @@ "node": ">= 0.4" } }, - "node_modules/es6-promise": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", - "integrity": "sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==", - "license": "MIT" - }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -951,12 +730,6 @@ "node": ">= 0.6" } }, - "node_modules/eventemitter3": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", - "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", - "license": "MIT" - }, "node_modules/expand-template": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", @@ -1013,57 +786,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "license": "MIT" - }, - "node_modules/fast-safe-stringify": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", - "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", - "license": "MIT" - }, - "node_modules/fast-xml-builder": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.3.1.tgz", - "integrity": "sha512-pIM/1n3ntFXKYrUZwW7QCK0gAW7XY+wzj1YMIV3tLDvPj/V+zTGJK5e3/4WJfwj0qWw2ElNXiTixda/R+3YSug==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - } - ], - "license": "MIT", - "dependencies": { - "path-expression-matcher": "^1.6.2", - "xml-naming": "^0.3.0" - } - }, - "node_modules/fast-xml-parser": { - "version": "5.11.2", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.11.2.tgz", - "integrity": "sha512-R9iDuNrQYeQut46cn2r2wHKn4HYzVDvDm5J1wW+koZewykv0yuO2HChTYeZtrULyHIDM9cj9TUXloCsueCQUog==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - } - ], - "license": "MIT", - "dependencies": { - "@nodable/entities": "^3.0.1", - "fast-xml-builder": "^1.2.0", - "is-unsafe": "^2.0.0", - "path-expression-matcher": "^1.6.2", - "strnum": "^2.4.2", - "xml-naming": "^0.3.0" - }, - "bin": { - "fxparser": "src/cli/cli.js" - } - }, "node_modules/file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", @@ -1089,12 +811,6 @@ "node": ">= 0.8" } }, - "node_modules/foreach": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.6.tgz", - "integrity": "sha512-k6GAGDyqLe9JaebCsFCoudPPWfihKu8pylYXRlqP1J7ms39iPoTtk2fviNglIeQEwdh0bQeKJ01ZPyuyQvKzwg==", - "license": "MIT" - }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -1147,6 +863,7 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, "license": "ISC", "engines": { "node": "6.* || 8.* || >= 10.*" @@ -1277,12 +994,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/http2-client": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/http2-client/-/http2-client-1.3.5.tgz", - "integrity": "sha512-EC2utToWl4RKfs5zd36Mxq7nzHHBuomZboI0yYL6Y0RmBgT7Sgkq4rQ0ezFTYoIsSs7Tm9SJe+o2FcAg6GBhGA==", - "license": "MIT" - }, "node_modules/https-proxy-agent": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", @@ -1378,42 +1089,17 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/is-unsafe": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-unsafe/-/is-unsafe-2.0.2.tgz", - "integrity": "sha512-HgbIHPBH0KHHCcjLfGsCvhtPTVxjaAZlXjwdz7/GQC40SjSe4sfQsar8J5VFo8JOSbarkpV0OLG95bbaNd9aAQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - } - ], - "license": "MIT" - }, - "node_modules/js-levenshtein": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", - "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "license": "MIT" - }, "node_modules/js-yaml": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "dev": true, "funding": [ { "type": "github", @@ -1432,21 +1118,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/json-pointer": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/json-pointer/-/json-pointer-0.6.2.tgz", - "integrity": "sha512-vLWcKbOaXlO+jvRy4qNd+TI1QUPZzfJj1tpJ3vAXDych5XJf93ftpUKe5pKCrzyIIwgBJcOcCVRUfqQP25afBw==", - "license": "MIT", - "dependencies": { - "foreach": "^2.0.4" - } - }, - "node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "license": "MIT" - }, "node_modules/jsonfile": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz", @@ -1480,42 +1151,6 @@ "safe-buffer": "^5.0.1" } }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "license": "MIT", - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, - "node_modules/lunr": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", - "license": "MIT" - }, - "node_modules/mark.js": { - "version": "8.11.1", - "resolved": "https://registry.npmjs.org/mark.js/-/mark.js-8.11.1.tgz", - "integrity": "sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==", - "license": "MIT" - }, - "node_modules/marked": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", - "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", - "license": "MIT", - "bin": { - "marked": "bin/marked.js" - }, - "engines": { - "node": ">= 12" - } - }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", @@ -1604,18 +1239,6 @@ "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", "license": "ISC" }, - "node_modules/minimatch": { - "version": "5.1.9", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz", - "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==", - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/minimist": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", @@ -1653,67 +1276,6 @@ "license": "MIT", "optional": true }, - "node_modules/mobx": { - "version": "6.16.1", - "resolved": "https://registry.npmjs.org/mobx/-/mobx-6.16.1.tgz", - "integrity": "sha512-syNcDdX3KT+Jq3je6eGjBhuc24Z68td2VG0zNFqRswaE433D9SNH5VRy/xrGbJsUixfppLLccXhAW9JSf6n+SQ==", - "license": "MIT", - "peer": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mobx" - } - }, - "node_modules/mobx-react": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/mobx-react/-/mobx-react-9.2.0.tgz", - "integrity": "sha512-dkGWCx+S0/1mfiuFfHRH8D9cplmwhxOV5CkXMp38u6rQGG2Pv3FWYztS0M7ncR6TyPRQKaTG/pnitInoYE9Vrw==", - "license": "MIT", - "dependencies": { - "mobx-react-lite": "^4.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mobx" - }, - "peerDependencies": { - "mobx": "^6.9.0", - "react": "^16.8.0 || ^17 || ^18 || ^19" - }, - "peerDependenciesMeta": { - "react-dom": { - "optional": true - }, - "react-native": { - "optional": true - } - } - }, - "node_modules/mobx-react-lite": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/mobx-react-lite/-/mobx-react-lite-4.1.1.tgz", - "integrity": "sha512-iUxiMpsvNraCKXU+yPotsOncNNmyeS2B5DKL+TL6Tar/xm+wwNJAubJmtRSeAoYawdZqwv8Z/+5nPRHeQxTiXg==", - "license": "MIT", - "dependencies": { - "use-sync-external-store": "^1.4.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mobx" - }, - "peerDependencies": { - "mobx": "^6.9.0", - "react": "^16.8.0 || ^17 || ^18 || ^19" - }, - "peerDependenciesMeta": { - "react-dom": { - "optional": true - }, - "react-native": { - "optional": true - } - } - }, "node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -1767,117 +1329,6 @@ "node": ">=10" } }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "license": "MIT", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/node-fetch-h2": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/node-fetch-h2/-/node-fetch-h2-2.3.0.tgz", - "integrity": "sha512-ofRW94Ab0T4AOh5Fk8t0h8OBWrmjb0SSB20xh1H8YnPV9EJ+f5AMoYSUQ2zgJ4Iq2HAK0I2l5/Nequ8YzFS3Hg==", - "license": "MIT", - "dependencies": { - "http2-client": "^1.2.5" - }, - "engines": { - "node": "4.x || >=6.0.0" - } - }, - "node_modules/node-readfiles": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/node-readfiles/-/node-readfiles-0.2.0.tgz", - "integrity": "sha512-SU00ZarexNlE4Rjdm83vglt5Y9yiQ+XI1XpflWlb7q7UTN1JUItm69xMeiQCTxtTfnzt+83T8Cx+vI2ED++VDA==", - "license": "MIT", - "dependencies": { - "es6-promise": "^3.2.1" - } - }, - "node_modules/oas-kit-common": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/oas-kit-common/-/oas-kit-common-1.0.8.tgz", - "integrity": "sha512-pJTS2+T0oGIwgjGpw7sIRU8RQMcUoKCDWFLdBqKB2BNmGpbBMH2sdqAaOXUg8OzonZHU0L7vfJu1mJFEiYDWOQ==", - "license": "BSD-3-Clause", - "dependencies": { - "fast-safe-stringify": "^2.0.7" - } - }, - "node_modules/oas-linter": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/oas-linter/-/oas-linter-3.2.2.tgz", - "integrity": "sha512-KEGjPDVoU5K6swgo9hJVA/qYGlwfbFx+Kg2QB/kd7rzV5N8N5Mg6PlsoCMohVnQmo+pzJap/F610qTodKzecGQ==", - "license": "BSD-3-Clause", - "dependencies": { - "@exodus/schemasafe": "^1.0.0-rc.2", - "should": "^13.2.1", - "yaml": "^1.10.0" - }, - "funding": { - "url": "https://github.com/Mermade/oas-kit?sponsor=1" - } - }, - "node_modules/oas-resolver": { - "version": "2.5.6", - "resolved": "https://registry.npmjs.org/oas-resolver/-/oas-resolver-2.5.6.tgz", - "integrity": "sha512-Yx5PWQNZomfEhPPOphFbZKi9W93CocQj18NlD2Pa4GWZzdZpSJvYwoiuurRI7m3SpcChrnO08hkuQDL3FGsVFQ==", - "license": "BSD-3-Clause", - "dependencies": { - "node-fetch-h2": "^2.3.0", - "oas-kit-common": "^1.0.8", - "reftools": "^1.1.9", - "yaml": "^1.10.0", - "yargs": "^17.0.1" - }, - "bin": { - "resolve": "resolve.js" - }, - "funding": { - "url": "https://github.com/Mermade/oas-kit?sponsor=1" - } - }, - "node_modules/oas-schema-walker": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/oas-schema-walker/-/oas-schema-walker-1.1.5.tgz", - "integrity": "sha512-2yucenq1a9YPmeNExoUa9Qwrt9RFkjqaMAA1X+U7sbb0AqBeTIdMHky9SQQ6iN94bO5NW0W4TRYXerG+BdAvAQ==", - "license": "BSD-3-Clause", - "funding": { - "url": "https://github.com/Mermade/oas-kit?sponsor=1" - } - }, - "node_modules/oas-validator": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/oas-validator/-/oas-validator-5.0.8.tgz", - "integrity": "sha512-cu20/HE5N5HKqVygs3dt94eYJfBi0TsZvPVXDhbXQHiEityDN+RROTleefoKRKKJ9dFAF2JBkDHgvWj0sjKGmw==", - "license": "BSD-3-Clause", - "dependencies": { - "call-me-maybe": "^1.0.1", - "oas-kit-common": "^1.0.8", - "oas-linter": "^3.2.2", - "oas-resolver": "^2.5.6", - "oas-schema-walker": "^1.1.5", - "reftools": "^1.1.9", - "should": "^13.2.1", - "yaml": "^1.10.0" - }, - "funding": { - "url": "https://github.com/Mermade/oas-kit?sponsor=1" - } - }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -1921,17 +1372,6 @@ "wrappy": "1" } }, - "node_modules/openapi-sampler": { - "version": "1.7.6", - "resolved": "https://registry.npmjs.org/openapi-sampler/-/openapi-sampler-1.7.6.tgz", - "integrity": "sha512-MvWOm3vdgX7CZ6CNfu2wOFMGhC/pq03BxYTL/DKCkyPWfR6XIwUJnOV32mQGgCcUm1tY/y1jj7F2yqx1DieIWw==", - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.7", - "fast-xml-parser": "^5.5.1", - "json-pointer": "0.6.2" - } - }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -1941,67 +1381,12 @@ "node": ">= 0.8" } }, - "node_modules/path-browserify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", - "license": "MIT" - }, - "node_modules/path-expression-matcher": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.6.2.tgz", - "integrity": "sha512-enSlaiat05iasnzmgNxRj8reFdj3puY2QpNgP1aPIaVfT6nn9ICuPoFlKHk8EN22HcwewshO+mN2DGbkCEOtqQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - } - ], - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/path-to-regexp": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz", "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==", "license": "MIT" }, - "node_modules/perfect-scrollbar": { - "version": "1.5.6", - "resolved": "https://registry.npmjs.org/perfect-scrollbar/-/perfect-scrollbar-1.5.6.tgz", - "integrity": "sha512-rixgxw3SxyJbCaSpo1n35A/fwI1r2rdwMKOTCg/AcG+xOEyZcE8UHVjpZMFCVImzsFoCZeJTT+M/rdEIQYO2nw==", - "license": "MIT" - }, - "node_modules/pluralize": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", - "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/polished": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/polished/-/polished-4.3.1.tgz", - "integrity": "sha512-OBatVyC/N7SCW/FaDHrSd+vn0o5cS855TOmYi4OkdWUMSJCET/xip//ch8xGUvtr3i44X9LVyWwQlRMTN3pwSA==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.17.8" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/postcss-value-parser": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", - "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", - "license": "MIT", - "peer": true - }, "node_modules/prebuild-install": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", @@ -2046,26 +1431,6 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/prismjs": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", - "integrity": "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/prop-types": { - "version": "15.8.1", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", - "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "license": "MIT", - "dependencies": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.13.1" - } - }, "node_modules/proxy-addr": { "version": "2.0.8", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz", @@ -2150,48 +1515,6 @@ "rc": "cli.js" } }, - "node_modules/react": { - "version": "19.3.0", - "resolved": "https://registry.npmjs.org/react/-/react-19.3.0.tgz", - "integrity": "sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "19.3.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.0.tgz", - "integrity": "sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q==", - "license": "MIT", - "peer": true, - "dependencies": { - "scheduler": "^0.28.0" - }, - "peerDependencies": { - "react": "^19.3.0" - } - }, - "node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", - "license": "MIT" - }, - "node_modules/react-tabs": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/react-tabs/-/react-tabs-6.1.1.tgz", - "integrity": "sha512-CPiuKoMFf89B7QlbFfdBD9XmUWiE3qudQputMVZB8GQvPJZRX/gqjDaDWOPDwGinEfpJKEuBCkGt83Tt4efeyA==", - "license": "MIT", - "dependencies": { - "clsx": "^2.0.0", - "prop-types": "^15.5.0" - }, - "peerDependencies": { - "react": "^18.0.0 || ^19.0.0" - } - }, "node_modules/readable-stream": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", @@ -2207,68 +1530,11 @@ "node": ">= 6" } }, - "node_modules/redoc": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.5.4.tgz", - "integrity": "sha512-M6jWhG1qoBnH6TFmzJnstyCZ87HmOY/UzDm78mHiYihEdlV/YcS9ogOo1NlElnJMeLsyxHFe2yFc4sNjHTrABQ==", - "license": "MIT", - "dependencies": { - "@redocly/openapi-core": "^1.34.15", - "classnames": "^2.3.2", - "decko": "^1.2.0", - "dompurify": "^3.2.4", - "eventemitter3": "^5.0.1", - "json-pointer": "^0.6.2", - "lunr": "^2.3.9", - "mark.js": "^8.11.1", - "marked": "^4.3.0", - "mobx-react": "9.2.0", - "openapi-sampler": "^1.6.2", - "path-browserify": "^1.0.1", - "perfect-scrollbar": "^1.5.5", - "polished": "^4.2.2", - "prismjs": "^1.29.0", - "prop-types": "^15.8.1", - "react-tabs": "^6.0.2", - "slugify": "~1.4.7", - "stickyfill": "^1.1.1", - "swagger2openapi": "^7.0.8", - "url-template": "^2.0.8" - }, - "engines": { - "node": ">=6.9", - "npm": ">=3.0.0" - }, - "peerDependencies": { - "core-js": "^3.1.4", - "mobx": "^6.0.4", - "react": "^16.8.4 || ^17.0.0 || ^18.0.0 || ^19.0.0", - "react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0 || ^19.0.0", - "styled-components": "^4.1.1 || ^5.1.1 || ^6.0.5" - } - }, - "node_modules/reftools": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/reftools/-/reftools-1.1.9.tgz", - "integrity": "sha512-OVede/NQE13xBQ+ob5CKd5KyeJYU2YInb1bmV4nRoOfquZPkAkxuOXicSe1PvqIuZZ4kD13sPKBbR7UFDmli6w==", - "license": "BSD-3-Clause", - "funding": { - "url": "https://github.com/Mermade/oas-kit?sponsor=1" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -2310,13 +1576,6 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "license": "MIT" }, - "node_modules/scheduler": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", - "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", - "license": "MIT", - "peer": true - }, "node_modules/semver": { "version": "7.8.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", @@ -2394,60 +1653,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/should": { - "version": "13.2.3", - "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz", - "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==", - "license": "MIT", - "dependencies": { - "should-equal": "^2.0.0", - "should-format": "^3.0.3", - "should-type": "^1.4.0", - "should-type-adaptors": "^1.0.1", - "should-util": "^1.0.0" - } - }, - "node_modules/should-equal": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz", - "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==", - "license": "MIT", - "dependencies": { - "should-type": "^1.4.0" - } - }, - "node_modules/should-format": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", - "integrity": "sha512-hZ58adtulAk0gKtua7QxevgUaXTTXxIi8t41L3zo9AHvjXO1/7sdLECuHeIN2SRtYXpNkmhoUP2pdeWgricQ+Q==", - "license": "MIT", - "dependencies": { - "should-type": "^1.3.0", - "should-type-adaptors": "^1.0.1" - } - }, - "node_modules/should-type": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", - "integrity": "sha512-MdAsTu3n25yDbIe1NeN69G4n6mUnJGtSJHygX3+oN0ZbO3DTiATnf7XnYJdGT42JCXurTb1JI0qOBR65shvhPQ==", - "license": "MIT" - }, - "node_modules/should-type-adaptors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz", - "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==", - "license": "MIT", - "dependencies": { - "should-type": "^1.3.0", - "should-util": "^1.0.0" - } - }, - "node_modules/should-util": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.1.tgz", - "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==", - "license": "MIT" - }, "node_modules/side-channel": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", @@ -2567,15 +1772,6 @@ "simple-concat": "^1.0.0" } }, - "node_modules/slugify": { - "version": "1.4.7", - "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.4.7.tgz", - "integrity": "sha512-tf+h5W1IrjNm/9rKKj0JU2MDMruiopx0jjVA5zCdBtcGjfp0+c5rHw/zADLC3IeKlGHtVbHtpfzvYA0OYT+HKg==", - "license": "MIT", - "engines": { - "node": ">=8.0.0" - } - }, "node_modules/statuses": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", @@ -2585,11 +1781,6 @@ "node": ">= 0.8" } }, - "node_modules/stickyfill": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stickyfill/-/stickyfill-1.1.1.tgz", - "integrity": "sha512-GCp7vHAfpao+Qh/3Flh9DXEJ/qSi0KJwJw6zYlZOtRYXWUIpMM6mC2rIep/dK8RQqwW0KxGJIllmjPIBOGN8AA==" - }, "node_modules/streamsearch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", @@ -2612,6 +1803,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -2626,6 +1818,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -2644,65 +1837,6 @@ "node": ">=0.10.0" } }, - "node_modules/strnum": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.4.2.tgz", - "integrity": "sha512-rDG3Ah4TV0k1hWvLSzkZtMmLN9+eS+h3knq4MP6A42Y3Yh5qGNnOUs1jJkoSr8FG5dsL28c7KgkIBzSEykqtuw==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - } - ], - "license": "MIT", - "dependencies": { - "anynum": "^1.0.1" - } - }, - "node_modules/styled-components": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.5.3.tgz", - "integrity": "sha512-vAX79sfpmUerP9fsTTxoTrBDE0RuO4ahjInyWYoohNgqrdg63Ms4q6FJ/o2Fyity82NU3cujOT8Ewl9TThBdwg==", - "license": "MIT", - "peer": true, - "dependencies": { - "@emotion/is-prop-valid": "1.4.0", - "css-to-react-native": "3.2.0", - "csstype": "3.2.3", - "stylis": "4.3.6" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/styled-components" - }, - "peerDependencies": { - "css-to-react-native": ">= 3.2.0", - "react": ">= 16.8.0", - "react-dom": ">= 16.8.0", - "react-native": ">= 0.68.0" - }, - "peerDependenciesMeta": { - "css-to-react-native": { - "optional": true - }, - "react-dom": { - "optional": true - }, - "react-native": { - "optional": true - } - } - }, - "node_modules/stylis": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.6.tgz", - "integrity": "sha512-yQ3rwFWRfwNUY7H5vpU0wfdkNSnvnJinhF9830Swlaxl03zsOjCfmX0ugac+3LtK0lYSgwL/KXc8oYL3mG4YFQ==", - "license": "MIT", - "peer": true - }, "node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -2743,33 +1877,6 @@ "express": ">=4.0.0 || >=5.0.0-beta" } }, - "node_modules/swagger2openapi": { - "version": "7.0.8", - "resolved": "https://registry.npmjs.org/swagger2openapi/-/swagger2openapi-7.0.8.tgz", - "integrity": "sha512-upi/0ZGkYgEcLeGieoz8gT74oWHA0E7JivX7aN9mAf+Tc7BQoRBvnIGHoPDw+f9TXTW4s6kGYCZJtauP6OYp7g==", - "license": "BSD-3-Clause", - "dependencies": { - "call-me-maybe": "^1.0.1", - "node-fetch": "^2.6.1", - "node-fetch-h2": "^2.3.0", - "node-readfiles": "^0.2.0", - "oas-kit-common": "^1.0.8", - "oas-resolver": "^2.5.6", - "oas-schema-walker": "^1.1.5", - "oas-validator": "^5.0.8", - "reftools": "^1.1.9", - "yaml": "^1.10.0", - "yargs": "^17.0.1" - }, - "bin": { - "boast": "boast.js", - "oas-validate": "oas-validate.js", - "swagger2openapi": "swagger2openapi.js" - }, - "funding": { - "url": "https://github.com/Mermade/oas-kit?sponsor=1" - } - }, "node_modules/systray2": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/systray2/-/systray2-2.1.4.tgz", @@ -2868,12 +1975,6 @@ "node": ">=0.6" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "license": "MIT" - }, "node_modules/tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", @@ -2935,27 +2036,6 @@ "node": ">= 0.8" } }, - "node_modules/uri-js-replace": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/uri-js-replace/-/uri-js-replace-1.0.1.tgz", - "integrity": "sha512-W+C9NWNLFOoBI2QWDp4UT9pv65r2w5Cx+3sTYFvtMdDBxkKt1syCqsUdSFAChbEe1uK5TfS04wt/nGwmaeIQ0g==", - "license": "MIT" - }, - "node_modules/url-template": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", - "integrity": "sha512-XdVKMF4SJ0nP/O7XIPB0JwAEuT9lDIYnNsK8yGVe43y0AWoKeJNdv3ZNWh7ksJ6KqQFjOO6ox/VEitLnaVNufw==", - "license": "BSD" - }, - "node_modules/use-sync-external-store": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.7.0.tgz", - "integrity": "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==", - "license": "MIT", - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" - } - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -3013,26 +2093,11 @@ "node": ">= 16" } }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "license": "BSD-2-Clause" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "license": "MIT", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", @@ -3074,25 +2139,11 @@ } } }, - "node_modules/xml-naming": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/xml-naming/-/xml-naming-0.3.0.tgz", - "integrity": "sha512-ghig2TBE/H11aOVgmahA3MhimvkBr6JIYknH/Dhdk10nXwdbIqBJsbfMxpvFPG8bAw77gN29aQWvKpmVoPlvPQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - } - ], - "license": "MIT", - "engines": { - "node": ">=16.0.0" - } - }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, "license": "ISC", "engines": { "node": ">=10" @@ -3107,25 +2158,11 @@ "node": ">=18" } }, - "node_modules/yaml": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.3.tgz", - "integrity": "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==", - "license": "ISC", - "engines": { - "node": ">= 6" - } - }, - "node_modules/yaml-ast-parser": { - "version": "0.0.43", - "resolved": "https://registry.npmjs.org/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz", - "integrity": "sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==", - "license": "Apache-2.0" - }, "node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, "license": "MIT", "dependencies": { "cliui": "^8.0.1", @@ -3144,6 +2181,7 @@ "version": "21.1.1", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, "license": "ISC", "engines": { "node": ">=12" diff --git a/package.json b/package.json index 51acb00a..a1976c67 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "cors": "^2.8.5", "express": "^4.21.2", "multer": "^2.0.0", - "redoc": "^2.5.3", "swagger-ui-express": "^5.0.1", "systray2": "^2.1.4", "tar": "^7.4.3", @@ -93,6 +92,6 @@ "prettier": "^3.8.1" }, "engines": { - "node": ">=20.0.0" + "node": ">=22.5.0" } } diff --git a/scripts/import-history.js b/scripts/import-history.js index b0cedc11..41a2b5f5 100644 --- a/scripts/import-history.js +++ b/scripts/import-history.js @@ -1937,6 +1937,47 @@ async function ingestWorkflowsForBatch(dbModule, sessions) { } } +// Session sync: a session counts as fed LIVE by hooks while it is active, its +// newest event came from a hook (not this importer), and a hook touched it +// within this window. Such a transcript is left to the hooks until it goes +// quiet. DASHBOARD_SYNC_LIVE_HOOK_MS=0 turns the deferral off. +const LIVE_HOOK_MS = (() => { + const n = Number(process.env.DASHBOARD_SYNC_LIVE_HOOK_MS ?? 5 * 60_000); + return Number.isFinite(n) && n >= 0 ? n : 5 * 60_000; +})(); +// mtimeCache value for a deferred file: present (so the fs watcher ignores its +// appends) yet never equal to a real mtime (so every sweep re-checks it). +const DEFERRED_MTIME = -1; +const IMPORTED_DATA_RE = /"imported"\s*:\s*true/; +const latestEventStmts = new WeakMap(); + +function rowIsImported(row) { + try { + return !!(row.metadata && JSON.parse(row.metadata).imported); + } catch { + return false; + } +} + +function isHookLive(dbModule, row) { + if (!(LIVE_HOOK_MS > 0) || row.status !== "active") return false; + const touched = Date.parse(row.updated_at); + if (!Number.isFinite(touched) || Date.now() - touched > LIVE_HOOK_MS) return false; + try { + let stmt = latestEventStmts.get(dbModule.db); + if (!stmt) { + stmt = dbModule.db.prepare( + "SELECT data FROM events WHERE session_id = ? ORDER BY id DESC LIMIT 1" + ); + latestEventStmts.set(dbModule.db, stmt); + } + const ev = stmt.get(row.id); + return !!ev && !IMPORTED_DATA_RE.test(ev.data || ""); + } catch { + return false; // when in doubt, sync as before + } +} + /** * Incremental, change-driven sync of the default `~/.claude/projects` directory. * @@ -2024,6 +2065,25 @@ async function syncDefaultProjects(dbModule, options = {}) { continue; } } + // A session hooks are feeding RIGHT NOW: its transcript keeps growing + // between hooks, so `mtime > updated_at` on nearly every sweep, and a + // full re-parse + snapshot copy here bought nothing the hooks do not + // already record. Leave it until it goes quiet (or ends): the sentinel + // keeps the watcher ignoring its appends, and never equals a real + // mtime, so the first sweep after the hooks stop catches it up. + if (existingRow && isHookLive(dbModule, existingRow)) { + mtimeCache.set(sourcePath, DEFERRED_MTIME); + continue; + } + // A session a hook created (no `imported` flag): importSession() skips + // it outright, so parsing the whole transcript + subagents was pure + // waste — only the durable snapshot copy still matters. + if (existingRow && !rowIsImported(existingRow)) { + mtimeCache.set(sourcePath, mtime); + if (require("../server/lib/run-as").sameOwner(sourcePath, existingRow.cwd)) + await snapshotTranscript(sourcePath, sessionId); + continue; + } const existed = !!existingRow; const session = await parseSessionForImport(projPath, sourcePath); // Record the mtime even when the file yields no session, so we don't diff --git a/scripts/plugin-bootstrap.js b/scripts/plugin-bootstrap.js index 2c704be9..04729705 100644 --- a/scripts/plugin-bootstrap.js +++ b/scripts/plugin-bootstrap.js @@ -138,14 +138,38 @@ function serverIsLive() { return livePids().length > 0; } +/** + * What npm installs from a manifest: its dependency lists, or the lockfile's + * package tree — never the release's own `version`, which both files carry. + * Hashing the whole files reinstalled every dependency on each update (minutes + * on a slow link) when the bump changed nothing npm would fetch. + */ +function installedPart(file, text) { + const json = JSON.parse(text); + if (file === "package.json") { + const { dependencies, optionalDependencies, overrides } = json; + return JSON.stringify({ dependencies, optionalDependencies, overrides }); + } + const { "": own, ...packages } = json.packages || {}; + const { version: _version, ...rest } = own || {}; + return JSON.stringify({ own: rest, packages }); +} + /** Hash of the dependency manifest — changes mean the runtime tree must be reinstalled. */ function depsHash(root = PLUGIN_ROOT) { const h = crypto.createHash("sha256"); for (const f of ["package.json", "package-lock.json"]) { + let text; try { - h.update(fs.readFileSync(path.join(root, f))); + text = fs.readFileSync(path.join(root, f), "utf8"); } catch { h.update(f); // absent counts as its own state + continue; + } + try { + h.update(installedPart(f, text)); + } catch { + h.update(text); // not JSON npm could read either: the bytes decide } } return h.digest("hex").slice(0, 16); @@ -196,6 +220,81 @@ function nodeVersionOk(version = process.versions.node) { return true; } +/* ------------------------------------------------------- last failure report */ + +/** + * The worker runs detached with its output discarded, so a failed install, a + * Node that is too old or a failed UI build used to live only in a log nobody + * opens — and every session silently retried. The last failure is kept in one + * small file; the NEXT foreground pass (which Claude Code reads) prints it once + * as a SessionStart `systemMessage`, and a bootstrap that succeeds removes it. + */ +function failurePath(rt = runtimeDir()) { + return path.join(rt, "last-failure.json"); +} + +function readFailure(rt = runtimeDir()) { + try { + return JSON.parse(fs.readFileSync(failurePath(rt), "utf8")); + } catch { + return null; + } +} + +/** Record a failure; the same kind again keeps its `reported` flag (once per failure). */ +function recordFailure(rt, kind, message, logFile) { + const prev = readFailure(rt); + const same = prev && prev.kind === kind && prev.message === message; + const rec = { + kind, + message, + log: logFile, + at: new Date().toISOString(), + reported: Boolean(same && prev.reported), + }; + try { + fs.mkdirSync(rt, { recursive: true }); + fs.writeFileSync(failurePath(rt), JSON.stringify(rec, null, 2) + "\n", "utf8"); + } catch { + /* best effort */ + } +} + +function clearFailure(rt = runtimeDir()) { + try { + fs.rmSync(failurePath(rt), { force: true }); + } catch { + /* best effort */ + } +} + +/** + * The SessionStart output for an unreported failure, or null. Marks it + * reported, so a failure is shown once — not on every session until fixed. + */ +function takeFailureReport(rt = runtimeDir()) { + const rec = readFailure(rt); + if (!rec || rec.reported) return null; + try { + fs.writeFileSync(failurePath(rt), JSON.stringify({ ...rec, reported: true }, null, 2) + "\n"); + } catch { + return null; // could not mark it: stay quiet rather than repeat forever + } + return { + systemMessage: + `AgentHub: ${rec.message}` + + (rec.log ? ` — details in ${rec.log}` : "") + + ". Run /agenthub-doctor for a diagnosis.", + }; +} + +function nodeTooOldMessage(version = process.versions.node) { + return ( + `Node ${version} is too old — AgentHub needs Node >= ${MIN_NODE.join(".")} ` + + `(the server stores data through node:sqlite). Upgrade Node, then start a new session` + ); +} + /* -------------------------------------------------------------------- lock */ function lockPath(rt = runtimeDir()) { @@ -422,13 +521,22 @@ function installDeps(rt = runtimeDir(), root = PLUGIN_ROOT) { if (fs.existsSync(src)) fs.copyFileSync(src, path.join(rt, f)); } const npm = npmCommand(["install", "--omit=dev", "--ignore-scripts", "--no-audit", "--no-fund"]); - const res = spawnSync(npm.file, npm.args, { - cwd: rt, - stdio: "inherit", - env: npm.env, - shell: npm.shell, - }); - return res.status === 0; + // npm's output goes to a log: the worker's own stdout is discarded, so + // inheriting it threw away the one explanation of a failed install. + const logPath = path.join(rt, "npm-install.log"); + require("./log-rotate").rotateIfLarge(logPath); + const logFd = fs.openSync(logPath, "a"); + try { + const res = spawnSync(npm.file, npm.args, { + cwd: rt, + stdio: ["ignore", logFd, logFd], + env: npm.env, + shell: npm.shell, + }); + return res.status === 0; + } finally { + fs.closeSync(logFd); + } } /* ------------------------------------------------------------------ server */ @@ -671,11 +779,8 @@ function bootstrap(rt = runtimeDir(), { force = false } = {}) { } if (!nodeVersionOk()) { - log( - rt, - `Node ${process.versions.node} is too old — AgentHub needs Node >= ${MIN_NODE.join(".")} ` + - `(the server stores data through node:sqlite). Upgrade Node, then start a new session.` - ); + log(rt, nodeTooOldMessage()); + recordFailure(rt, "node-too-old", nodeTooOldMessage(), path.join(rt, "bootstrap.log")); return "node-too-old"; } @@ -695,7 +800,16 @@ function bootstrap(rt = runtimeDir(), { force = false } = {}) { if (force || state.depsHash !== wantDeps || !fs.existsSync(path.join(rt, "node_modules"))) { log(rt, "installing runtime dependencies (first run takes a few minutes)"); if (!installDeps(rt)) { - log(rt, "npm install failed — see the output above; run /agenthub-doctor after fixing it"); + log( + rt, + `npm install failed — see ${path.join(rt, "npm-install.log")}; run /agenthub-doctor after fixing it` + ); + recordFailure( + rt, + "install-failed", + "installing the dashboard's runtime dependencies failed", + path.join(rt, "npm-install.log") + ); return "install-failed"; } } @@ -713,17 +827,24 @@ function bootstrap(rt = runtimeDir(), { force = false } = {}) { // Built eagerly (not lazily behind /agenthub-open) so the dashboard, including // client-only routes like /run, works the instant `claude` is started — - // same trigger as the dependency install above: missing, or this plugin - // version has not built one yet. + // when missing, or when this plugin version has not built one yet + // (`clientBuild` is recorded only after a build that did not fail, so the + // next session retries a failed one instead of keeping the old UI for good). const { buildClient } = require("./plugin-open"); const uiResult = buildClient({ rt, root: PLUGIN_ROOT, - force: force || state.depsHash !== wantDeps, + force: force || state.clientBuild !== pluginVersion(), logPath: path.join(rt, "client-build.log"), }); if (uiResult === "failed") { log(rt, "dashboard UI build failed — the API still works; run /agenthub-open to retry"); + recordFailure( + rt, + "ui-build-failed", + "the dashboard UI build failed (the API still works; /agenthub-open retries it)", + path.join(rt, "client-build.log") + ); } else if (uiResult === "built") { log(rt, "built the dashboard UI bundle"); } @@ -829,6 +950,7 @@ function bootstrap(rt = runtimeDir(), { force = false } = {}) { { pluginVersion: pluginVersion(), depsHash: wantDeps, + clientBuild: uiResult === "failed" ? state.clientBuild : pluginVersion(), pluginRoot: PLUGIN_ROOT, claudeHome: getClaudeHome(), updatedAt: new Date().toISOString(), @@ -836,6 +958,8 @@ function bootstrap(rt = runtimeDir(), { force = false } = {}) { rt ); + if (uiResult !== "failed") clearFailure(rt); + // After the state is durable, so a prune that goes wrong cannot also cost // us the record of a bootstrap that went right. pruneRetiredPluginRoots(rt); @@ -868,13 +992,26 @@ function bootstrap(rt = runtimeDir(), { force = false } = {}) { * milliseconds in the steady state, and otherwise hands off to a detached * worker so the session never waits on an install. */ -function main() { - if (notTheHost() || fastPathOk()) return; - const child = spawn(process.execPath, [__filename, "--worker"], { - detached: true, - stdio: "ignore", - }); - child.unref(); +function main(rt = runtimeDir()) { + if (notTheHost()) return null; + // Checked here too, not only in the worker: it costs nothing, the worker + // could only log it, and this pass can tell the user right now. A retired + // build stays silent — its worker would do nothing either. + if (!nodeVersionOk()) { + if (supersededBy()) return null; + recordFailure(rt, "node-too-old", nodeTooOldMessage(), null); + return takeFailureReport(rt); + } + if (!fastPathOk(rt)) { + const child = spawn(process.execPath, [__filename, "--worker"], { + detached: true, + stdio: "ignore", + }); + child.unref(); + } + // A failure the previous worker recorded (it ran after that session's + // foreground pass had already returned). Pure fs; writes only to mark it shown. + return takeFailureReport(rt); } // Exported before the entry block below, not after it: `bootstrap()` requires @@ -897,6 +1034,12 @@ module.exports = { depsHash, fastPathOk, nodeVersionOk, + failurePath, + readFailure, + recordFailure, + clearFailure, + takeFailureReport, + main, lockPath, lockIsStale, acquireLock, @@ -934,7 +1077,10 @@ if (require.main === module) { } } else { try { - main(); + const report = main(); + // SessionStart reads a JSON object on stdout; `systemMessage` is shown + // to the user. Nothing at all is printed in the steady state. + if (report) process.stdout.write(JSON.stringify(report) + "\n"); } catch { // A bootstrap failure must never break a Claude Code session. } diff --git a/scripts/plugin-open.js b/scripts/plugin-open.js index 6c49e7bc..11cbecc6 100644 --- a/scripts/plugin-open.js +++ b/scripts/plugin-open.js @@ -68,7 +68,19 @@ function buildClient({ const stdio = logFd === null ? "inherit" : ["ignore", logFd, logFd]; try { const src = path.join(rt, "client-src"); - fs.rmSync(src, { recursive: true, force: true }); + // The installed tree is kept across updates while the client's manifests + // are unchanged (`stamp`, written after a successful install): a release + // rarely touches them, and the clean `npm ci` below fetched all of the + // ~200 MB toolchain again on every update. + const stamp = path.join(src, "node_modules", ".agenthub-deps"); + const want = clientDepsHash(root); + const reuse = readText(stamp) === want; + if (reuse) { + for (const e of fs.readdirSync(src)) + if (e !== "node_modules") fs.rmSync(path.join(src, e), { recursive: true, force: true }); + } else { + fs.rmSync(src, { recursive: true, force: true }); + } fs.cpSync(path.join(root, "client"), src, { recursive: true, filter: (p) => !/[\\/](node_modules|dist)$/.test(p), @@ -101,19 +113,25 @@ function buildClient({ // esbuild is the only dependency with an install script, and it finds its // platform binary without it. const npmFlags = ["--no-audit", "--no-fund", "--include=dev", "--ignore-scripts"]; - if ( - !exec(NPM, ["ci", ...npmFlags], src, stdio) && - !exec(NPM, ["install", ...npmFlags], src, stdio) - ) { - return "failed"; + if (!reuse) { + if ( + !exec(NPM, ["ci", ...npmFlags], src, stdio) && + !exec(NPM, ["install", ...npmFlags], src, stdio) + ) { + return "failed"; + } + fs.mkdirSync(path.dirname(stamp), { recursive: true }); + fs.writeFileSync(stamp, want); } - // = client/package.json's "build" script (`tsc -b && vite build`); a test - // keeps the two in step. + // client/package.json's "build" script is `tsc -b && vite build`; only the + // vite half runs here. The type check emits nothing the bundle needs, and on + // a user's machine it cost ~25 s and ~900 MB of memory per update — and a + // type error in a release then kept the old UI everywhere (v2.7.0). The + // release itself still runs `tsc -b`. A test keeps the two in step. const bin = (...p) => path.join(src, "node_modules", ...p); - if ( - !exec(NODE, [bin("typescript", "bin", "tsc"), "-b"], src, stdio) || - !exec(NODE, [bin("vite", "bin", "vite.js"), "build"], src, stdio) - ) { + if (!exec(NODE, [bin("vite", "bin", "vite.js"), "build"], src, stdio)) { + // Maybe a damaged kept tree: the next build starts from a clean install. + fs.rmSync(stamp, { force: true }); return "failed"; } @@ -125,6 +143,22 @@ function buildClient({ } } +function readText(file) { + try { + return fs.readFileSync(file, "utf8"); + } catch { + return null; + } +} + +/** The client's manifests, which decide whether its installed tree still fits. */ +function clientDepsHash(root) { + const h = require("crypto").createHash("sha256"); + for (const f of ["package.json", "package-lock.json"]) + h.update(readText(path.join(root, "client", f)) ?? `no ${f}`); + return h.digest("hex").slice(0, 16); +} + function dashboardUrl() { try { return `http://localhost:${resolveDashboardPort()}`; diff --git a/server/README.md b/server/README.md index 7aa72d63..cd8fdf47 100644 --- a/server/README.md +++ b/server/README.md @@ -439,7 +439,7 @@ All endpoints return JSON unless noted. Error responses use: | `GET` | `/api/openapi.json` | Raw OpenAPI 3.0.3 spec | | `GET` | `/api/docs` | Interactive **Swagger UI** (try-it-out request execution) | | `GET` | `/api/redoc` | **ReDoc** reference — clean, read-optimized three-panel rendering of the same spec | -| `GET` | `/api/redoc/redoc.standalone.js` | Self-hosted ReDoc bundle (via the `redoc` dependency, never a CDN — works offline) | +| `GET` | `/api/redoc/redoc.standalone.js` | Self-hosted ReDoc bundle (vendored in `server/vendor/redoc/`, never a CDN — works offline) | The OpenAPI spec is generated from `server/openapi.js` (`createOpenApiSpec()`), merged with supplementary fragments under `server/openapi-extra/`, and is the source of truth for request/response contracts. It now documents every backend route (75 path entries). Both Swagger UI and ReDoc (`server/lib/redoc.js`) render the same spec; the ReDoc bundle is served locally so the reference works offline / air-gapped. A committed `openapi.yaml` at the repo root mirrors the live spec — regenerate it after API changes with `npm run openapi:yaml` (never hand-edit it). @@ -1600,10 +1600,11 @@ DASHBOARD_DB_PATH=./data/dashboard.db # SQLite database path DASHBOARD_AI_TOOLS_DIR= # Extra AI Tools catalog JSON files; an id here replaces the built-in one AGENTHUB_SHELL_PATH=1 # 0 = never run the login shell to read its PATH (startup + Refresh) AGENTHUB_AI_TOOLS_SYNC=1 # 0 = never copy the newest release's AI Tools catalog (server/lib/ai-tools-sync.js, daily) -DASHBOARD_LANE_SYNC_MS=2000 # re-broadcast lanes another dashboard on the same DB changed (PRAGMA data_version); 0 = off +DASHBOARD_LANE_SYNC_MS=2000 # re-broadcast lanes another dashboard on the same DB changed (PRAGMA data_version), only while one runs (checked every 30 s); 0 = off # Background services DASHBOARD_SESSION_SYNC_MS=30000 # Continuous project-sync poll interval (ms); 0 disables the poll (watcher stays) +DASHBOARD_SYNC_LIVE_HOOK_MS=300000 # project sync leaves a transcript alone while hooks fed its session within this window; 0 = never defer DASHBOARD_LIVENESS_PROBE=1 # 0 disables the dead-session liveness reap (use when hooks arrive from another machine) DASHBOARD_LIVENESS_IDLE_SECONDS=60 # Idle gate before the liveness reap may complete a process-less session DASHBOARD_REPORTS_MS=60000 # Scheduled-reports beat (ms); 0 disables the scheduler diff --git a/server/__tests__/api.test.js b/server/__tests__/api.test.js index 32be89e9..d2a4ee21 100644 --- a/server/__tests__/api.test.js +++ b/server/__tests__/api.test.js @@ -213,6 +213,13 @@ describe("OpenAPI / Swagger", () => { const res = await fetch("/api/redoc/redoc.standalone.js"); assert.equal(res.status, 200); assert.match(res.headers["content-type"], /javascript/); + // The vendored file (server/vendor/redoc/), licence banner intact — the + // `redoc` npm package is no longer a dependency. + assert.match( + res.body, + /For license information please see redoc\.standalone\.js\.LICENSE\.txt/ + ); + assert.doesNotThrow(() => require("fs").statSync(require("../lib/redoc").redocBundlePath())); }); }); diff --git a/server/__tests__/backoff-poll.test.js b/server/__tests__/backoff-poll.test.js new file mode 100644 index 00000000..ade35d60 --- /dev/null +++ b/server/__tests__/backoff-poll.test.js @@ -0,0 +1,42 @@ +/** + * @file Tests server/lib/backoff-poll.js — the poll that runs at its base pace + * while passes find work (or fail) and slows to its idle pace after a pass + * that resolved `false`, returning to the base pace once work shows up again. + * @author Nguyễn Ngọc Trí Vĩ + */ + +const { describe, it } = require("node:test"); +const assert = require("node:assert/strict"); +const { startBackoffPoll, idleDefault } = require("../lib/backoff-poll"); + +const wait = (ms) => new Promise((r) => setTimeout(r, ms)); + +describe("startBackoffPoll", () => { + it("slows down after idle passes and speeds up again on work", async () => { + const answers = [true, false, false, true, "x"]; + const at = []; + const t0 = Date.now(); + const poll = startBackoffPoll( + () => { + at.push(Date.now() - t0); + const a = answers.shift(); + if (a === "x") throw new Error("boom"); + return a; + }, + { baseMs: 10, idleMs: 80 } + ); + await wait(260); + poll.stop(); + assert.ok(at.length >= 5, `ran ${at.length} times`); + const gaps = at.slice(1).map((t, i) => t - at[i]); + assert.ok(gaps[0] < 60, "work → base pace"); + assert.ok(gaps[1] >= 75, "idle → idle pace"); + assert.ok(gaps[2] >= 75, "still idle"); + assert.ok(gaps[3] < 60, "work again → base pace"); + }); + + it("idles at a minute by default, never faster than the base pace", () => { + assert.equal(idleDefault(15_000), 60_000); + assert.equal(idleDefault(120_000), 120_000); + }); +}); diff --git a/server/__tests__/codex-usage.test.js b/server/__tests__/codex-usage.test.js index 554336b1..7dec3f82 100644 --- a/server/__tests__/codex-usage.test.js +++ b/server/__tests__/codex-usage.test.js @@ -179,7 +179,9 @@ describe("ingestCodexUsage", () => { }); it("settles an active session to completed once its journals go quiet", async () => { - const now = Date.now(); + // A whole second: utimes rounds through a float, and a millisecond `now` + // came back from stat 1 ms early about half the time. + const now = Math.floor(Date.now() / 1000) * 1000; writeRollout( "s1", [meta("s1"), ctx("gpt-a"), tc([1, 0, 1], [1, 0, 1])], @@ -536,3 +538,78 @@ describe("service tier", () => { ]); }); }); + +describe("ingestCodexUsage — recent pass", () => { + const NOW = Date.parse("2026-09-29T03:00:00Z"); + function writeAt(day, id, lines, mtime) { + const dir = path.join(process.env.CODEX_HOME, "sessions", ...day.split("/")); + fs.mkdirSync(dir, { recursive: true }); + const file = path.join(dir, `rollout-${day.replace(/\//g, "-")}T01-00-00-${id}.jsonl`); + fs.writeFileSync(file, jsonl(lines)); + fs.utimesSync(file, mtime, mtime); + return file; + } + + it("stats only the newest day folders and the journals still growing", async () => { + const quiet = writeAt( + "2026/09/01", + "old1", + [meta("old1"), ctx("gpt-a"), tc([10, 0, 1], [10, 0, 1])], + new Date(NOW - 20 * 86_400_000) + ); + const live = writeAt( + "2026/09/02", + "old2", + [meta("old2"), ctx("gpt-a"), tc([10, 0, 1], [10, 0, 1])], + new Date(NOW - 60_000) + ); + writeAt("2026/09/27", "a", [meta("a"), ctx("gpt-a")], new Date(NOW - 86_400_000)); + writeAt("2026/09/28", "b", [meta("b"), ctx("gpt-a")], new Date(NOW - 86_400_000)); + await ingestCodexUsage({ now: NOW }); // the full first pass + + // Both old journals grow; only the one written within the hour is looked at. + fs.appendFileSync(quiet, jsonl([tc([30, 0, 3], [20, 0, 2])])); + fs.appendFileSync(live, jsonl([tc([30, 0, 3], [20, 0, 2])])); + fs.utimesSync(quiet, new Date(NOW - 1000), new Date(NOW - 1000)); + fs.utimesSync(live, new Date(NOW - 1000), new Date(NOW - 1000)); + // A new journal in today's folder is found too. + writeAt( + "2026/09/29", + "new1", + [meta("new1"), ctx("gpt-a"), tc([5, 0, 1], [5, 0, 1])], + new Date(NOW - 1000) + ); + await ingestCodexUsage({ now: NOW, recent: true }); + assert.deepEqual(usage("old2"), [{ model: "gpt-a", i: 30, r: 0, o: 3 }]); + assert.deepEqual(usage("old1"), [{ model: "gpt-a", i: 10, r: 0, o: 1 }], "left to a full pass"); + assert.deepEqual(usage("new1"), [{ model: "gpt-a", i: 5, r: 0, o: 1 }]); + + await ingestCodexUsage({ now: NOW }); // the next full pass catches it up + assert.deepEqual(usage("old1"), [{ model: "gpt-a", i: 30, r: 0, o: 3 }]); + }); + + it("finds a fork's parent in an older folder on a recent pass", async () => { + const parent = [ + meta("p9"), + ctx("gpt-a"), + tc([100, 0, 10], [100, 0, 10]), + tc([300, 0, 30], [200, 0, 20]), + ]; + writeAt("2026/08/01", "p9", parent, new Date(NOW - 50 * 86_400_000)); + writeAt("2026/09/28", "x", [meta("x")], new Date(NOW - 86_400_000)); + await ingestCodexUsage({ now: NOW }); + writeAt( + "2026/09/29", + "f9", + [ + meta("f9", { forked_from_id: "p9" }), + meta("p9"), + ...parent.slice(1), + tc([350, 0, 35], [50, 0, 5]), + ], + new Date(NOW - 1000) + ); + await ingestCodexUsage({ now: NOW, recent: true }); + assert.deepEqual(usage("f9"), [{ model: "gpt-a", i: 50, r: 0, o: 5 }]); + }); +}); diff --git a/server/__tests__/db-retention.test.js b/server/__tests__/db-retention.test.js new file mode 100644 index 00000000..3f487cef --- /dev/null +++ b/server/__tests__/db-retention.test.js @@ -0,0 +1,175 @@ +/** + * @file Tests server/lib/db-retention.js and its Settings routes — a new + * database is INCREMENTAL auto_vacuum, retention is off by default and purges + * nothing then, when on it removes only finished sessions older than the + * cutoff (with their events, agents and token rows) in bounded batches, the + * free-page reclaim shrinks the freelist, GET/PUT /api/settings/retention + * validate and persist the setting, and POST /api/settings/compact needs + * confirm and runs a VACUUM in a worker. The database and settings file are + * temp paths. + * @author Nguyễn Ngọc Trí Vĩ + */ + +const os = require("node:os"); +const fs = require("node:fs"); +const path = require("node:path"); +const { describe, it, before, after } = require("node:test"); +const assert = require("node:assert/strict"); + +const ROOT = fs.mkdtempSync(path.join(os.tmpdir(), "agenthub-db-retention-")); +process.env.DASHBOARD_DB_PATH = path.join(ROOT, "dashboard.db"); +process.env.AGENTHUB_SETTINGS_FILE = path.join(ROOT, "settings.env"); +process.env.DASHBOARD_LIVENESS_PROBE = "0"; +delete process.env.AGENTHUB_RETENTION_DAYS; + +const { createApp, startServer } = require("../index"); +const { db } = require("../db"); +const retention = require("../lib/db-retention"); + +let server; +let BASE; +before(async () => { + server = await startServer(createApp(), 0); + BASE = `http://127.0.0.1:${server.address().port}`; +}); +after(() => { + server?.close(); + delete process.env.AGENTHUB_RETENTION_DAYS; + fs.rmSync(ROOT, { recursive: true, force: true }); +}); + +async function call(method, urlPath, body) { + const res = await fetch(BASE + urlPath, { + method, + headers: body ? { "content-type": "application/json" } : {}, + body: body ? JSON.stringify(body) : undefined, + }); + return { status: res.status, body: await res.json() }; +} + +const daysAgo = (n) => new Date(Date.now() - n * 86400 * 1000).toISOString(); + +function seed(id, status, startedAt, events = 3) { + db.prepare( + "INSERT INTO sessions (id, name, status, cwd, started_at, updated_at) VALUES (?, ?, ?, '/tmp', ?, ?)" + ).run(id, id, status, startedAt, startedAt); + const ins = db.prepare( + "INSERT INTO events (session_id, event_type, summary, data, created_at) VALUES (?, 'PostToolUse', 's', ?, ?)" + ); + for (let i = 0; i < events; i++) + ins.run(id, JSON.stringify({ pad: "x".repeat(2000) }), startedAt); +} +const exists = (id) => !!db.prepare("SELECT 1 FROM sessions WHERE id = ?").get(id); +const eventCount = (id) => + db.prepare("SELECT COUNT(*) AS n FROM events WHERE session_id = ?").get(id).n; + +describe("auto_vacuum", () => { + it("a new database is INCREMENTAL", () => { + assert.equal(db.pragma("auto_vacuum", { simple: true }), 2); + assert.equal(retention.spaceInfo(db).auto_vacuum, "incremental"); + }); +}); + +describe("retentionConfig", () => { + it("is off by default and for anything out of range", () => { + assert.equal(retention.retentionConfig({}).days, 0); + for (const v of ["", "0", "-3", "1.5", "abc", "99999"]) { + assert.equal(retention.retentionConfig({ AGENTHUB_RETENTION_DAYS: v }).days, 0, v); + } + assert.equal(retention.retentionConfig({ AGENTHUB_RETENTION_DAYS: "30" }).days, 30); + }); +}); + +describe("scheduled maintenance", () => { + it("purges nothing while retention is off", async () => { + seed("ret-off-old", "completed", daysAgo(400)); + const out = await retention.runScheduledMaintenance({ db }); + assert.equal(out.retention, undefined); + assert.ok(exists("ret-off-old")); + db.prepare("DELETE FROM sessions WHERE id = 'ret-off-old'").run(); + }); + + it("purges only finished sessions older than the cutoff, with their rows", async () => { + seed("ret-old-done", "completed", daysAgo(100)); + seed("ret-old-err", "error", daysAgo(100)); + seed("ret-old-active", "active", daysAgo(100)); + seed("ret-new-done", "completed", daysAgo(5)); + db.prepare( + "INSERT INTO token_usage (session_id, model, input_tokens) VALUES ('ret-old-done', 'm', 1)" + ).run(); + process.env.AGENTHUB_RETENTION_DAYS = "30"; + try { + const out = await retention.runScheduledMaintenance({ db }); + assert.equal(out.retention.purged_sessions, 2); + assert.equal(out.retention.purged_events, 6); + } finally { + delete process.env.AGENTHUB_RETENTION_DAYS; + } + assert.ok(!exists("ret-old-done")); + assert.ok(!exists("ret-old-err")); + assert.equal(eventCount("ret-old-done"), 0); + assert.equal( + db.prepare("SELECT COUNT(*) AS n FROM token_usage WHERE session_id = 'ret-old-done'").get().n, + 0 + ); + assert.ok(exists("ret-old-active"), "an active session is never purged"); + assert.ok(exists("ret-new-done"), "a recent session is kept"); + assert.equal(eventCount("ret-new-done"), 3); + }); + + it("works in bounded batches and stops at the per-run cap", async () => { + for (let i = 0; i < 7; i++) seed(`ret-batch-${i}`, "abandoned", daysAgo(50), 1); + const first = await retention.applyRetention({ db, days: 10, batch: 2, maxSessions: 5 }); + assert.equal(first.purged_sessions, 5); + const second = await retention.applyRetention({ db, days: 10, batch: 2, maxSessions: 5 }); + assert.equal(second.purged_sessions, 2); + const third = await retention.applyRetention({ db, days: 10 }); + assert.equal(third.purged_sessions, 0); + }); + + it("returns free pages to the OS", async () => { + for (let i = 0; i < 40; i++) seed(`ret-big-${i}`, "completed", daysAgo(60), 20); + await retention.applyRetention({ db, days: 30 }); + const before = db.pragma("freelist_count", { simple: true }); + assert.ok(before > 50, `expected free pages, got ${before}`); + const out = await retention.reclaimFreePages({ db, minPages: 10, slice: 16 }); + assert.ok(out.reclaimed_pages > 0); + assert.ok(db.pragma("freelist_count", { simple: true }) < before); + }); +}); + +describe("routes", () => { + it("GET reports retention off by default", async () => { + const r = await call("GET", "/api/settings/retention"); + assert.equal(r.status, 200); + assert.equal(r.body.days, 0); + assert.equal(r.body.compacting, false); + assert.equal(r.body.space.auto_vacuum, "incremental"); + }); + + it("PUT validates and persists, 0 turns it off", async () => { + for (const bad of [-1, 1.5, "7", 99999, null]) { + const r = await call("PUT", "/api/settings/retention", { days: bad }); + assert.equal(r.status, 400, String(bad)); + } + let r = await call("PUT", "/api/settings/retention", { days: 90 }); + assert.equal(r.status, 200); + assert.equal(r.body.days, 90); + assert.match(fs.readFileSync(process.env.AGENTHUB_SETTINGS_FILE, "utf8"), /RETENTION_DAYS=90/); + r = await call("PUT", "/api/settings/retention", { days: 0 }); + assert.equal(r.body.days, 0); + }); + + it("POST /compact needs confirm and then vacuums", async () => { + let r = await call("POST", "/api/settings/compact", {}); + assert.equal(r.status, 400); + r = await call("POST", "/api/settings/compact", { confirm: true }); + assert.equal(r.status, 202); + for (let i = 0; i < 200 && retention.isCompacting(); i++) { + await new Promise((res) => setTimeout(res, 50)); + } + const last = retention.lastCompactResult(); + assert.equal(last?.ok, true, last?.error); + assert.equal(db.pragma("auto_vacuum", { simple: true }), 2); + }); +}); diff --git a/server/__tests__/plugin-bootstrap.test.js b/server/__tests__/plugin-bootstrap.test.js index 277eda7a..b6bc6024 100644 --- a/server/__tests__/plugin-bootstrap.test.js +++ b/server/__tests__/plugin-bootstrap.test.js @@ -91,6 +91,69 @@ describe("node version gate", () => { }); }); +describe("last failure report (SessionStart systemMessage)", () => { + beforeEach(resetRuntime); + + it("reports a recorded failure once, naming the log and /agenthub-doctor", () => { + boot.recordFailure(RT, "install-failed", "npm broke", path.join(RT, "npm-install.log")); + const first = boot.takeFailureReport(RT); + assert.match(first.systemMessage, /npm broke/); + assert.match(first.systemMessage, /npm-install\.log/); + assert.match(first.systemMessage, /\/agenthub-doctor/); + assert.equal(boot.takeFailureReport(RT), null); + }); + + it("does not re-report the same failure recorded again by a later retry", () => { + boot.recordFailure(RT, "install-failed", "npm broke", "x.log"); + boot.takeFailureReport(RT); + boot.recordFailure(RT, "install-failed", "npm broke", "x.log"); + assert.equal(boot.takeFailureReport(RT), null); + }); + + it("reports a different failure, and nothing once cleared", () => { + boot.recordFailure(RT, "install-failed", "npm broke", "x.log"); + boot.takeFailureReport(RT); + boot.recordFailure(RT, "ui-build-failed", "vite broke", "y.log"); + assert.match(boot.takeFailureReport(RT).systemMessage, /vite broke/); + boot.recordFailure(RT, "ui-build-failed", "vite broke", "y.log"); + boot.clearFailure(RT); + assert.equal(boot.readFailure(RT), null); + assert.equal(boot.takeFailureReport(RT), null); + }); + + it("prints nothing with no failure on record", () => { + assert.equal(boot.takeFailureReport(RT), null); + }); +}); + +describe("depsHash — only what npm installs", () => { + function root(pkg, lock) { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), "agenthub-deps-")); + fs.writeFileSync(path.join(dir, "package.json"), JSON.stringify(pkg)); + fs.writeFileSync(path.join(dir, "package-lock.json"), JSON.stringify(lock)); + return dir; + } + const pkg = (version, deps) => ({ name: "agenthub", version, dependencies: deps }); + const lock = (version, deps) => ({ + name: "agenthub", + version, + packages: { "": { name: "agenthub", version, dependencies: deps }, "node_modules/a": {} }, + }); + + it("ignores a release's version bump", () => { + // Every update reinstalled all runtime dependencies when only the version moved. + const a = root(pkg("1.0.0", { a: "^1" }), lock("1.0.0", { a: "^1" })); + const b = root(pkg("1.0.1", { a: "^1" }), lock("1.0.1", { a: "^1" })); + assert.equal(boot.depsHash(a), boot.depsHash(b)); + }); + + it("changes when a dependency does", () => { + const a = root(pkg("1.0.0", { a: "^1" }), lock("1.0.0", { a: "^1" })); + const b = root(pkg("1.0.0", { a: "^2" }), lock("1.0.0", { a: "^2" })); + assert.notEqual(boot.depsHash(a), boot.depsHash(b)); + }); +}); + describe("fast path", () => { beforeEach(resetRuntime); @@ -527,7 +590,6 @@ describe("buildClient dependency install", () => { assert.deepEqual(calls, [ "ci --no-audit --no-fund --include=dev --ignore-scripts", "install --no-audit --no-fund --include=dev --ignore-scripts", - "node tsc -b", "node vite.js build", ]); }); @@ -567,8 +629,9 @@ describe("buildClient dependency install", () => { it("builds with the running node, no lifecycle script and no PATH lookup (Windows)", () => { // On Windows a script or a .bin shim runs through cmd.exe and needs `node` // on PATH; the server's PATH lacked it, so esbuild's postinstall failed and - // every update kept the previous UI. The build here must equal the - // client's own "build" script, run without npm. + // every update kept the previous UI. The build here is the vite half of + // the client's own "build" script, run without npm; the type check is the + // release's job, not every user's. assert.equal( JSON.parse(fs.readFileSync(path.join(__dirname, "..", "..", "client", "package.json"))) .scripts.build, @@ -577,8 +640,35 @@ describe("buildClient dependency install", () => { resetRuntime(); const calls = []; buildClient({ rt: RT, root: fakeRoot(), exec: fakeExec(calls) }); - assert.deepEqual(calls.slice(-2), ["node tsc -b", "node vite.js build"]); - assert.ok(calls.every((c) => !c.startsWith("run"))); + assert.deepEqual(calls.slice(-1), ["node vite.js build"]); + assert.ok(calls.every((c) => !c.startsWith("run") && !c.includes("tsc"))); + }); + + it("keeps the installed tree while the client's manifests are unchanged", () => { + resetRuntime(); + const root = fakeRoot(); + const first = []; + buildClient({ rt: RT, root, exec: fakeExec(first) }); + assert.ok(first[0].startsWith("ci")); + const again = []; + assert.equal(buildClient({ rt: RT, root, force: true, exec: fakeExec(again) }), "built"); + assert.deepEqual(again, ["node vite.js build"]); + + fs.writeFileSync(path.join(root, "client", "package.json"), '{"dependencies":{"x":"1"}}'); + const changed = []; + buildClient({ rt: RT, root, force: true, exec: fakeExec(changed) }); + assert.ok(changed[0].startsWith("ci"), "a changed manifest installs from clean"); + }); + + it("installs from clean again after a build on the kept tree failed", () => { + resetRuntime(); + const root = fakeRoot(); + buildClient({ rt: RT, root, exec: fakeExec([]) }); + const failing = (cmd, args, cwd) => (cmd === "node" ? false : fakeExec([])(cmd, args, cwd)); + assert.equal(buildClient({ rt: RT, root, force: true, exec: failing }), "failed"); + const next = []; + buildClient({ rt: RT, root, force: true, exec: fakeExec(next) }); + assert.ok(next[0].startsWith("ci")); }); }); diff --git a/server/__tests__/repo-links.test.js b/server/__tests__/repo-links.test.js index a5d7d39d..ed429f3f 100644 --- a/server/__tests__/repo-links.test.js +++ b/server/__tests__/repo-links.test.js @@ -50,6 +50,8 @@ function trackedFiles() { // Generated from server/openapi-extra/* (which IS linted): the drift test // below covers it, so linting both would only double-report one fix. .filter((f) => f !== "openapi.yaml" && !f.endsWith("package-lock.json")) + // Third-party files copied unchanged (server/vendor/redoc): their links are upstream's. + .filter((f) => !f.includes("/vendor/")) ); } diff --git a/server/__tests__/session-sync.test.js b/server/__tests__/session-sync.test.js index bc35afb3..afd7df7f 100644 --- a/server/__tests__/session-sync.test.js +++ b/server/__tests__/session-sync.test.js @@ -150,3 +150,85 @@ describe("syncDefaultProjects", () => { ); }); }); + +describe("syncDefaultProjects — sessions hooks are feeding", () => { + const SNAP_DIR = path.join(process.env.DASHBOARD_DATA_DIR, "transcripts"); + const more = (sessionId, cwd, ts) => ({ + type: "assistant", + cwd, + sessionId, + timestamp: ts, + message: { + model: "claude-opus-4-8", + content: [{ type: "text", text: "later" }], + usage: { input_tokens: 3, output_tokens: 2 }, + }, + }); + const bumpMtime = (file) => { + const future = Date.now() / 1000 + 120; + fs.utimesSync(file, future, future); + }; + const ageSession = (id) => + dbModule.db + .prepare("UPDATE sessions SET updated_at = ? WHERE id = ?") + .run(new Date(Date.now() - 10 * 60_000).toISOString(), id); + + it("defers a live hook-fed imported session, then catches it up once quiet", async () => { + const ID = "33333333-cccc-4ccc-8ccc-333333333333"; + const cache = new Map(); + const file = writeSession("-live", ID, fixtureLines(ID, "/live")); + await syncDefaultProjects(dbModule, { mtimeCache: cache }); + assert.ok(dbModule.stmts.getSession.get(ID), "imported first"); + + // A hook arrives: its event is the newest, and it touches the session. + dbModule.stmts.insertEvent.run(ID, `${ID}-main`, "PreToolUse", "Bash", "hook", "{}"); + dbModule.stmts.touchSession.run(ID); + writeSession( + "-live", + ID, + fixtureLines(ID, "/live", [more(ID, "/live", "2026-04-18T12:09:00.000Z")]) + ); + bumpMtime(file); + + const live = await syncDefaultProjects(dbModule, { mtimeCache: cache }); + assert.equal( + live.changed.find((c) => c.sessionId === ID), + undefined, + "deferred while live" + ); + assert.equal(cache.get(file), -1, "kept in the cache so the watcher ignores its appends"); + + ageSession(ID); // the hooks went quiet + const quiet = await syncDefaultProjects(dbModule, { mtimeCache: cache }); + assert.ok( + quiet.changed.find((c) => c.sessionId === ID && !c.isNew), + "caught up once quiet" + ); + assert.notEqual(cache.get(file), -1); + }); + + it("never re-parses a hook-created session, only refreshes its snapshot once quiet", async () => { + const ID = "44444444-dddd-4ddd-8ddd-444444444444"; + dbModule.stmts.insertSession.run(ID, "hooked", "active", "/hooked", null, null); + dbModule.stmts.insertEvent.run(ID, null, "SessionStart", null, "hook", "{}"); + const file = writeSession("-hooked", ID, fixtureLines(ID, "/hooked")); + bumpMtime(file); + const snap = path.join(SNAP_DIR, `${ID}.jsonl`); + const cache = new Map(); + + await syncDefaultProjects(dbModule, { mtimeCache: cache }); + assert.equal(fs.existsSync(snap), false, "no snapshot copy while hooks are live"); + + ageSession(ID); + const before = dbModule.db.prepare("SELECT COUNT(*) AS n FROM events WHERE session_id = ?"); + const n0 = before.get(ID).n; + const r = await syncDefaultProjects(dbModule, { mtimeCache: cache }); + assert.equal( + r.changed.find((c) => c.sessionId === ID), + undefined, + "nothing imported" + ); + assert.equal(before.get(ID).n, n0, "no events written for a hook-created session"); + assert.equal(fs.existsSync(snap), true, "snapshot taken once quiet"); + }); +}); diff --git a/server/__tests__/transcript-marks.test.js b/server/__tests__/transcript-marks.test.js new file mode 100644 index 00000000..82c4d244 --- /dev/null +++ b/server/__tests__/transcript-marks.test.js @@ -0,0 +1,167 @@ +/** + * @file Tests for the hook writer's per-transcript "already handled" marks + * (`transcriptMarks` in server/routes/hooks.js): a hook whose transcript is + * unchanged skips the token / compaction / API-error / turn-duration writes, + * a grown transcript is walked only from the last entry handled, and the rows + * left behind are exactly the ones a full re-walk would have written. + * @author Nguyễn Ngọc Trí Vĩ + */ + +const { describe, it, before, after } = require("node:test"); +const assert = require("node:assert/strict"); +const path = require("path"); +const fs = require("fs"); +const os = require("os"); +const http = require("http"); + +const TMP = fs.mkdtempSync(path.join(os.tmpdir(), "agenthub-marks-")); +process.env.DASHBOARD_DB_PATH = path.join(TMP, "dashboard.db"); +process.env.CLAUDE_HOME = path.join(TMP, "home"); +process.env.DASHBOARD_DATA_DIR = path.join(TMP, "data"); + +const { createApp, startServer } = require("../index"); +const { db } = require("../db"); +const hooksRouter = require("../routes/hooks"); + +let server; +let BASE; + +function post(body) { + return new Promise((resolve, reject) => { + const url = new URL("/api/hooks/event", BASE); + const payload = JSON.stringify(body); + const r = http.request( + { + hostname: url.hostname, + port: url.port, + path: url.pathname, + method: "POST", + headers: { + "Content-Type": "application/json", + "Content-Length": Buffer.byteLength(payload), + }, + }, + (res) => { + res.resume(); + res.on("end", () => resolve(res.statusCode)); + } + ); + r.on("error", reject); + r.write(payload); + r.end(); + }); +} + +const line = (o) => JSON.stringify(o) + "\n"; +const assistant = (id, inTok) => ({ + type: "assistant", + timestamp: "2026-09-18T01:00:00.000Z", + message: { + id, + model: "claude-sonnet-5", + content: [{ type: "text", text: "ok" }], + usage: { input_tokens: inTok, output_tokens: 1 }, + }, +}); +const turn = (ms, ts) => ({ + type: "system", + subtype: "turn_duration", + durationMs: ms, + timestamp: ts, +}); +const apiError = (text, ts) => ({ + type: "assistant", + isApiErrorMessage: true, + error: "rate_limit", + timestamp: ts, + message: { content: [{ type: "text", text }] }, +}); +const compact = (uuid, ts) => ({ type: "user", isCompactSummary: true, uuid, timestamp: ts }); + +function rows(sid) { + const ev = db + .prepare( + "SELECT event_type, summary, created_at FROM events WHERE session_id = ? AND event_type IN ('TurnDuration','APIError','Compaction') ORDER BY event_type, created_at, summary" + ) + .all(sid) + .map((r) => + r.event_type === "APIError" + ? `${r.event_type}|${r.summary}` + : `${r.event_type}|${r.created_at}|${r.summary}` + ); + const tokens = db + .prepare("SELECT model, input_tokens, baseline_input FROM token_usage WHERE session_id = ?") + .all(sid); + return { ev, tokens }; +} + +before(async () => { + server = await startServer(createApp(), 0); + BASE = `http://127.0.0.1:${server.address().port}`; +}); + +after(() => { + server?.close(); + fs.rmSync(TMP, { recursive: true, force: true }); +}); + +describe("transcript marks", () => { + it("skips an unchanged transcript and walks only the new tail of a grown one", async () => { + const sid = "abababab-1111-4111-8111-abababababab"; + const cwd = path.join(TMP, "work"); + fs.mkdirSync(cwd, { recursive: true }); + const tpath = path.join(TMP, `${sid}.jsonl`); + fs.writeFileSync( + tpath, + line(assistant("m1", 5)) + + line(turn(1000, "2026-09-18T01:00:01.000Z")) + + line(apiError("slow down", "2026-09-18T01:00:02.000Z")) + + line(compact("c-1", "2026-09-18T01:00:03.000Z")) + + line(assistant("m2", 7)) + + line(turn(2000, "2026-09-18T01:00:04.000Z")) + ); + const data = { session_id: sid, cwd, transcript_path: tpath }; + + assert.equal(await post({ hook_type: "PostToolUse", data }), 200); + const first = rows(sid); + assert.equal(first.ev.filter((e) => e.startsWith("TurnDuration")).length, 2); + assert.equal(first.ev.filter((e) => e.startsWith("APIError")).length, 1); + assert.equal(first.ev.filter((e) => e.startsWith("Compaction")).length, 1); + assert.ok(hooksRouter.transcriptMarks.size >= 1, "a mark is kept after commit"); + + // Proof of the skip: a row removed behind the writer's back is NOT put + // back by a hook whose transcript did not change (before, every hook + // re-walked the whole history and re-inserted it). + db.prepare( + "DELETE FROM events WHERE session_id = ? AND event_type = 'TurnDuration' AND created_at = '2026-09-18T01:00:01.000Z'" + ).run(sid); + assert.equal(await post({ hook_type: "PostToolUse", data: { ...data, tool_name: "x" } }), 200); + assert.equal(rows(sid).ev.filter((e) => e.startsWith("TurnDuration")).length, 1); + db.prepare("DELETE FROM events WHERE session_id = ? AND event_type = 'TurnDuration'").run(sid); + hooksRouter.transcriptMarks.clear(); + assert.equal(await post({ hook_type: "PostToolUse", data: { ...data, tool_name: "y" } }), 200); + assert.deepEqual(rows(sid), first, "a cleared mark re-walks the whole history, as before"); + + // Grow it: one turn, one new error, a repeat of the old error, a compaction. + fs.appendFileSync( + tpath, + line(assistant("m3", 11)) + + line(turn(3000, "2026-09-18T01:00:05.000Z")) + + line(apiError("slow down", "2026-09-18T01:00:06.000Z")) + + line(apiError("overloaded", "2026-09-18T01:00:07.000Z")) + + line(compact("c-2", "2026-09-18T01:00:08.000Z")) + ); + assert.equal(await post({ hook_type: "Stop", data }), 200); + const grown = rows(sid); + + // The same transcript walked from scratch must produce the same rows. + hooksRouter.transcriptMarks.clear(); + assert.equal(await post({ hook_type: "Stop", data: { ...data, stop_hook_active: true } }), 200); + assert.deepEqual(rows(sid), grown, "the delta wrote exactly what a full walk writes"); + assert.equal(grown.ev.filter((e) => e.startsWith("TurnDuration")).length, 3); + assert.equal(grown.ev.filter((e) => e.startsWith("APIError")).length, 2, "repeat deduped"); + assert.equal(grown.ev.filter((e) => e.startsWith("Compaction")).length, 2); + assert.equal(grown.tokens.length, 1); + assert.equal(grown.tokens[0].input_tokens + grown.tokens[0].baseline_input, 23); + }); +}); diff --git a/server/__tests__/update-scheduler.test.js b/server/__tests__/update-scheduler.test.js new file mode 100644 index 00000000..ed073949 --- /dev/null +++ b/server/__tests__/update-scheduler.test.js @@ -0,0 +1,76 @@ +/** + * @file Tests server/update-scheduler.js — the default interval is an hour + * (the env override and its 60 s floor still apply), a scheduled tick with no + * browser connected runs no check, and a browser connecting after that gets + * one catch-up check (only when the last check is stale). The check, the + * connection count and the connection event are injected; nothing touches git + * or the network. + * @author Nguyễn Ngọc Trí Vĩ + */ + +const { describe, it, afterEach } = require("node:test"); +const assert = require("node:assert/strict"); + +delete process.env.DASHBOARD_UPDATE_CHECK; +const { startUpdateScheduler, intervalMs } = require("../update-scheduler"); + +const wait = (ms) => new Promise((r) => setTimeout(r, ms)); + +let handle = null; +afterEach(() => { + handle?.stop(); + handle = null; + delete process.env.DASHBOARD_UPDATE_CHECK_INTERVAL_MS; +}); + +function harness(clients) { + const h = { checks: 0, clients, listeners: [] }; + handle = startUpdateScheduler({ + broadcast: () => {}, + getConnectionCount: () => h.clients, + onConnection: (fn) => { + h.listeners.push(fn); + return () => {}; + }, + getStatus: async () => { + h.checks++; + return { update_available: false }; + }, + initialDelayMs: 10, + }); + h.connect = () => h.listeners.forEach((fn) => fn()); + return h; +} + +describe("intervalMs", () => { + it("defaults to one hour and keeps the override with its floor", () => { + delete process.env.DASHBOARD_UPDATE_CHECK_INTERVAL_MS; + assert.equal(intervalMs(), 60 * 60 * 1000); + process.env.DASHBOARD_UPDATE_CHECK_INTERVAL_MS = "120000"; + assert.equal(intervalMs(), 120000); + process.env.DASHBOARD_UPDATE_CHECK_INTERVAL_MS = "1000"; + assert.equal(intervalMs(), 60 * 60 * 1000); + }); +}); + +describe("startUpdateScheduler", () => { + it("checks on the first tick when a browser is connected", async () => { + const h = harness(1); + await wait(40); + assert.equal(h.checks, 1); + }); + + it("skips the tick with no browser, then checks once when one connects", async () => { + const h = harness(0); + await wait(40); + assert.equal(h.checks, 0); + h.clients = 1; + h.connect(); + h.connect(); // a second tab in the same window: still one check + await wait(3_300); + assert.equal(h.checks, 1); + h.connect(); // fresh check: no catch-up + await wait(3_300); + assert.equal(h.checks, 1); + }); +}); diff --git a/server/__tests__/worktree.test.js b/server/__tests__/worktree.test.js index bc609b41..dbf0ea76 100644 --- a/server/__tests__/worktree.test.js +++ b/server/__tests__/worktree.test.js @@ -465,3 +465,23 @@ describe("listBranches", () => { assert.deepEqual(branches, []); }); }); + +describe("git missing from PATH", () => { + it("answers EGITMISSING with the fix, not a bare ENOENT, when the folder exists", async () => { + const saved = process.env.PATH; + process.env.PATH = path.join(ROOT, "no-such-bin"); + try { + await assert.rejects( + () => wt.git(ROOT, ["status"]), + (err) => err.code === "EGITMISSING" && /install/i.test(err.message) + ); + // A missing FOLDER is the other ENOENT, and stays one. + await assert.rejects( + () => wt.git(path.join(ROOT, "gone"), ["status"]), + (err) => err.code === "ENOENT" + ); + } finally { + process.env.PATH = saved; + } + }); +}); diff --git a/server/db.js b/server/db.js index 627a60b5..fb9a1d61 100644 --- a/server/db.js +++ b/server/db.js @@ -141,6 +141,14 @@ migrateLegacyDatabase(DB_PATH); const db = new Database(DB_PATH); +// Freed pages go back to the OS only with auto_vacuum. On a NEW database this +// takes effect at once — it must come before `journal_mode = WAL`, which +// writes the header; an existing one is converted further down, by a VACUUM, +// only while it is small (`convertAutoVacuum`), else by Settings → Data → +// Compact. `maintainDatabase` then runs a bounded `incremental_vacuum`. +if (db.pragma("auto_vacuum", { simple: true }) === 0) { + db.pragma("auto_vacuum = INCREMENTAL"); +} db.pragma("journal_mode = WAL"); db.pragma("foreign_keys = ON"); db.pragma("busy_timeout = 5000"); @@ -1866,6 +1874,28 @@ for (const col of ["display_name", "email", "avatar_at"]) { } } +// An existing database made before auto_vacuum: the setting is stored only by +// a VACUUM, which rewrites the whole file under an exclusive lock. Done here, +// at startup and under the migration lock, only for a file up to +// AUTO_VACUUM_CONVERT_MAX_BYTES (well under a second); a bigger one is +// converted by the manual Compact (server/lib/db-retention.js). Best effort: a +// second process holding a read open makes it fail, and the next start retries. +const AUTO_VACUUM_CONVERT_MAX_BYTES = 32 * 1024 * 1024; +function convertAutoVacuum() { + try { + if (db.pragma("auto_vacuum", { simple: true }) !== 0) return false; + const bytes = + db.pragma("page_count", { simple: true }) * db.pragma("page_size", { simple: true }); + if (bytes > AUTO_VACUUM_CONVERT_MAX_BYTES) return false; + db.pragma("auto_vacuum = INCREMENTAL"); + db.exec("VACUUM"); + return db.pragma("auto_vacuum", { simple: true }) === 2; + } catch { + return false; + } +} +convertAutoVacuum(); + migrationLock.exec("COMMIT"); migrationLock.close(); @@ -2535,7 +2565,9 @@ const stmts = { * on a reader — the other dashboard's), after which the next write truncates * the WAL to `journal_size_limit`; and `PRAGMA optimize`, which refreshes the * planner's statistics only where they went stale. Never VACUUM: it rewrites - * the whole file under an exclusive lock. + * the whole file under an exclusive lock. The opt-in retention and the + * bounded `incremental_vacuum` run after this, from + * `server/lib/db-retention.js`'s `runScheduledMaintenance`. */ function maintainDatabase() { const out = {}; @@ -2561,4 +2593,6 @@ module.exports = { applyIntroPricing, topUpDefaultPricing, maintainDatabase, + convertAutoVacuum, + AUTO_VACUUM_CONVERT_MAX_BYTES, }; diff --git a/server/index.js b/server/index.js index 3fd4045b..c774df49 100644 --- a/server/index.js +++ b/server/index.js @@ -33,6 +33,20 @@ if (process.env.GIT_EDITOR === "true") delete process.env.GIT_EDITOR; // server/lib/settings-env.js. Only when this // file IS the process: the test suite requires it dozens of times, and a // developer's real settings file pins DASHBOARD_DATA_DIR at their live database. +/** What to tell the user when the dashboard cannot bind its port. The health + * probe above already turned away a port held by a running dashboard, so a + * port in use here belongs to some other program. */ +function listenFailure(err, port) { + if (err?.code === "EADDRINUSE") + return ( + `Port ${port} is already in use by another program, so AgentHub cannot start there. ` + + `Stop that program, or run AgentHub on another port with DASHBOARD_PORT (for example DASHBOARD_PORT=4821).` + ); + if (err?.code === "EACCES") + return `Not allowed to listen on port ${port}. Pick a port above 1024 with DASHBOARD_PORT.`; + return `AgentHub could not start its server: ${err?.stack || err}`; +} + if (require.main === module) { const settingsEnv = require("./lib/settings-env"); settingsEnv.loadEnvFiles({ @@ -337,8 +351,12 @@ function startServer(app, port) { const host = resolveHost(); const boundLoopback = isLoopbackHostname(host); - return new Promise((resolve) => { + return new Promise((resolve, reject) => { + // A port another program holds fails here, not as an uncaught 'error' + // event: the caller says what happened instead of a bare stack trace. + server.once("error", reject); server.listen(port, host, () => { + server.off("error", reject); // Publish the live port so the Claude Code hook handler can find this // server even when it bound a non-default port (the desktop app falls // back off 4820 when that port is already taken). @@ -482,11 +500,17 @@ function startBackgroundServices() { .catch(() => {}); // Hourly DB upkeep: a non-blocking checkpoint (the WAL then shrinks to - // journal_size_limit) and PRAGMA optimize. Off with DASHBOARD_DB_MAINTAIN_MS=0. + // journal_size_limit), PRAGMA optimize, the opt-in retention + // (AGENTHUB_RETENTION_DAYS, off by default) and a bounded incremental_vacuum + // (server/lib/db-retention.js). Off with DASHBOARD_DB_MAINTAIN_MS=0. { const every = Number(process.env.DASHBOARD_DB_MAINTAIN_MS ?? 60 * 60 * 1000); if (every > 0) { - const t = setInterval(() => require("./db").maintainDatabase(), every); + const t = setInterval(() => { + require("./lib/db-retention") + .runScheduledMaintenance() + .catch(() => {}); + }, every); if (t.unref) t.unref(); } } @@ -807,18 +831,35 @@ function startBackgroundServices() { } // Another dashboard on the same database (hooks reach only one of them) // moving a lane: re-broadcast it here. One pragma per beat when nothing - // changed. Off with DASHBOARD_LANE_SYNC_MS=0. + // changed — and only while such a dashboard runs at all: alone on its data + // dir, this server only looks for one every LANE_PEER_CHECK_MS (the first + // call primes what it has seen, so a peer that starts later is compared + // against it). Off with DASHBOARD_LANE_SYNC_MS=0. const LANE_SYNC_MS = Number(process.env.DASHBOARD_LANE_SYNC_MS ?? 2_000); if (Number.isFinite(LANE_SYNC_MS) && LANE_SYNC_MS > 0) { const { broadcastForeignLaneChanges } = require("./routes/lanes"); - const laneSyncTimer = setInterval(() => { + const LANE_PEER_CHECK_MS = Math.max(LANE_SYNC_MS, 30_000); + let peersSeenAt = 0; + let hasPeers = false; + const syncLanes = () => { try { broadcastForeignLaneChanges(); } catch (err) { console.warn("lane sync failed:", err.message); } - }, LANE_SYNC_MS); - if (laneSyncTimer.unref) laneSyncTimer.unref(); + }; + syncLanes(); + const laneSyncTick = () => { + if (Date.now() - peersSeenAt >= LANE_PEER_CHECK_MS) { + hasPeers = peersSharingDataDir().length > 0; + peersSeenAt = Date.now(); + } + if (hasPeers) syncLanes(); + const t = setTimeout(laneSyncTick, hasPeers ? LANE_SYNC_MS : LANE_PEER_CHECK_MS); + if (t.unref) t.unref(); + }; + const first = setTimeout(laneSyncTick, LANE_SYNC_MS); + if (first.unref) first.unref(); } // Continuous discovery of sessions under ~/.claude/projects. The one-time // legacy backfill above runs only once (marker-gated), so a project added @@ -1210,12 +1251,17 @@ if (require.main === module) { return; } const app = createApp(); - startServer(app, PORT).then((server) => { - httpServer = server; - startBackgroundServices(); - // The status-area icon (server/lib/tray.js) — production servers only. - require("./lib/tray").startTrayWatch(); - }); + startServer(app, PORT) + .then((server) => { + httpServer = server; + startBackgroundServices(); + // The status-area icon (server/lib/tray.js) — production servers only. + require("./lib/tray").startTrayWatch(); + }) + .catch((err) => { + console.error(listenFailure(err, PORT)); + process.exit(1); + }); }); // Graceful shutdown — close connections and DB cleanly diff --git a/server/lib/antigravity-usage.js b/server/lib/antigravity-usage.js index a415d53f..ab4453a2 100644 --- a/server/lib/antigravity-usage.js +++ b/server/lib/antigravity-usage.js @@ -425,6 +425,9 @@ function writeSession(f, conv, now) { } let running = null; +// Fresh sessions the last pass left for a later one to settle (the poll keeps +// its base pace while there are any). +let lastPending = 0; /** * One pass over every conversation file: a changed one is re-read, an @@ -440,12 +443,16 @@ function ingestAntigravityUsage({ running = (async () => { let read = 0; let written = 0; + let pending = 0; // still-fresh sessions a later pass may have to settle for (const f of conversationFiles()) { try { const seen = getSeen.get(f.path); if (seen && seen.mtime_ms === f.mtime) { const a = activity(f.id, f.mtime); - if (fresh(a, now)) continue; + if (fresh(a, now)) { + pending += 1; + continue; + } const s = stmts.getSession.get(f.id); if (s && s.tool === "antigravity" && s.status === "active") { const at = new Date(a.last).toISOString(); @@ -486,6 +493,7 @@ function ingestAntigravityUsage({ } await new Promise((r) => setImmediate(r)); } + lastPending = pending; return { files: read, sessions: written }; })().finally(() => { running = null; @@ -504,16 +512,16 @@ function startAntigravityUsagePoll(broadcast, broadcastLane) { if (!Number.isFinite(POLL_MS) || POLL_MS <= 0) return; // Files an older build could not read get another try. db.prepare("DELETE FROM antigravity_conversations WHERE session_id = ''").run(); - const tick = () => { - ingestAntigravityUsage({ broadcast, broadcastLane }) - .then((r) => { + // Slowed to once a minute after a pass that read nothing, wrote nothing and + // left no fresh session to settle; back to POLL_MS once one finds work. + require("./backoff-poll").startBackoffPoll( + () => + ingestAntigravityUsage({ broadcast, broadcastLane }).then((r) => { if (r.sessions > 0 && pricingSync.syncEnabled()) void pricingSync.syncPricing(db); - }) - .catch(() => {}); - }; - tick(); - const timer = setInterval(tick, POLL_MS); - if (timer.unref) timer.unref(); + return r.files + r.sessions + lastPending > 0; + }), + { baseMs: POLL_MS } + ); } module.exports = { diff --git a/server/lib/backoff-poll.js b/server/lib/backoff-poll.js new file mode 100644 index 00000000..3e4e64cb --- /dev/null +++ b/server/lib/backoff-poll.js @@ -0,0 +1,43 @@ +/** + * @file A background poll that slows down while it finds nothing to do: the + * next pass runs `baseMs` after a pass that did work (or failed), `idleMs` + * after one whose `tick` resolved `false` (nothing changed, nothing pending). + * One pass at a time — the next is scheduled only once the last settled — and + * every timer is `unref`'d. Used by the Cursor and Antigravity usage polls. + * @author Nguyễn Ngọc Trí Vĩ + */ + +/** Default slow interval: 60 s, never faster than the base one. */ +const idleDefault = (baseMs) => Math.max(baseMs, 60_000); + +/** + * Run `tick` now, then again and again. `tick` resolves `false` for an idle + * pass; anything else (or a throw) keeps the base pace. + * @returns {{stop: () => void}} + */ +function startBackoffPoll(tick, { baseMs, idleMs = idleDefault(baseMs) }) { + let timer = null; + let stopped = false; + const schedule = (ms) => { + if (stopped) return; + timer = setTimeout(run, ms); + if (timer.unref) timer.unref(); + }; + function run() { + Promise.resolve() + .then(tick) + .then( + (busy) => schedule(busy === false ? idleMs : baseMs), + () => schedule(baseMs) + ); + } + run(); + return { + stop() { + stopped = true; + clearTimeout(timer); + }, + }; +} + +module.exports = { startBackoffPoll, idleDefault }; diff --git a/server/lib/codex-usage.js b/server/lib/codex-usage.js index c4b136bc..723ebb69 100644 --- a/server/lib/codex-usage.js +++ b/server/lib/codex-usage.js @@ -235,7 +235,9 @@ function threadNames(home = getCodexHome()) { const names = new Map(); let text = ""; try { - text = require("./run-as").readFileSafe(path.join(home, "session_index.jsonl"), "utf8", { max: 16 << 20 }); + text = require("./run-as").readFileSafe(path.join(home, "session_index.jsonl"), "utf8", { + max: 16 << 20, + }); } catch { return names; } @@ -251,6 +253,17 @@ function threadNames(home = getCodexHome()) { } const getRollout = db.prepare("SELECT * FROM codex_rollouts WHERE path = ?"); +// What a pass needs to skip an unchanged journal, for every journal at once: +// one query per pass instead of one (with its whole parse state) per file. +const rolloutStamps = db.prepare( + `SELECT path, size, mtime_ms, instr(state, '"more":true') > 0 AS more FROM codex_rollouts` +); +// Journals that may still be growing outside the newest day folders: written +// within RECENT_ROW_MS, or not yet read to the end. +const liveRolloutPaths = db.prepare( + `SELECT path FROM codex_rollouts WHERE mtime_ms > ? OR instr(state, '"more":true') > 0` +); +const threadPath = db.prepare("SELECT path FROM codex_rollouts WHERE thread_id = ? LIMIT 1"); const upsertRollout = db.prepare( `INSERT INTO codex_rollouts (path, session_id, thread_id, size, mtime_ms, offset, state, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) @@ -400,6 +413,59 @@ function writeSession(sessionId, names, now, origin = LOCAL) { const running = new Map(); // home ("" = CODEX_HOME) → the pass in flight +// A RECENT pass (the poll's, between full ones) stats only the newest +// RECENT_DAY_DIRS day folders plus the journals the table says may still grow +// (RECENT_ROW_MS) — not every rollout Codex ever wrote. A journal in an older +// folder that wakes up again (a resumed thread quiet for over RECENT_ROW_MS) +// is picked up by the next full pass. +const RECENT_DAY_DIRS = 2; +const RECENT_ROW_MS = 60 * 60_000; + +function numericDirs(dir) { + try { + return fs + .readdirSync(dir, { withFileTypes: true }) + .filter((e) => e.isDirectory() && /^\d+$/.test(e.name)) + .map((e) => e.name) + .sort((a, b) => Number(b) - Number(a)); + } catch { + return []; + } +} + +function recentRolloutFiles(home, now) { + const root = path.join(home || getCodexHome(), "sessions"); + const days = []; + outer: for (const y of numericDirs(root)) + for (const m of numericDirs(path.join(root, y))) + for (const d of numericDirs(path.join(root, y, m))) { + days.push(path.join(root, y, m, d)); + if (days.length >= RECENT_DAY_DIRS) break outer; + } + const paths = new Set(); + for (const dir of days) { + try { + for (const e of fs.readdirSync(dir, { withFileTypes: true })) + if (e.isFile() && /^rollout-.*\.jsonl$/.test(e.name)) paths.add(path.join(dir, e.name)); + } catch { + /* vanished mid-scan */ + } + } + const prefix = root + path.sep; + for (const { path: p } of liveRolloutPaths.all(now - RECENT_ROW_MS)) + if (p.startsWith(prefix)) paths.add(p); + const out = []; + for (const p of paths) { + try { + const stat = fs.statSync(p); + if (stat.isFile()) out.push({ path: p, mtime: stat.mtimeMs, size: stat.size }); + } catch { + /* gone */ + } + } + return out; +} + /** * One pass over every journal. Yields to the event loop between files; a * second call for the same home while one runs joins it. `home`, `source` and @@ -413,21 +479,42 @@ function ingestCodexUsage({ home, source = LOCAL.source, activeMs = LOCAL.activeMs, + recent = false, } = {}) { const key = home || ""; if (running.has(key)) return running.get(key); const pass = (async () => { - const files = allRolloutFiles(home); + const files = recent ? recentRolloutFiles(home, now) : allRolloutFiles(home); const byThread = new Map(); for (const f of files) { const m = FILE_NAME.exec(path.basename(f.path)); if (m) byThread.set(m[1], f.path); } + // A recent pass lists only part of the tree: a fork's parent may live in + // an older folder, known to the table (or, failing that, to a full walk). + let walkedAll = !recent; + const parentPath = (id) => { + if (byThread.has(id)) return byThread.get(id); + if (walkedAll) return null; + const known = threadPath.get(id)?.path; + const root = path.join(home || getCodexHome(), "sessions") + path.sep; + if (known && known.startsWith(root) && fs.existsSync(known)) return known; + walkedAll = true; + for (const f of allRolloutFiles(home)) { + const m = FILE_NAME.exec(path.basename(f.path)); + if (m && !byThread.has(m[1])) byThread.set(m[1], f.path); + } + return byThread.get(id) || null; + }; + const stamps = new Map(); + for (const r of rolloutStamps.all()) stamps.set(r.path, r); const touched = new Set(); let read = 0; for (const f of files) { try { const mtime = Math.floor(f.mtime); + const seen = stamps.get(f.path); + if (seen && seen.size === f.size && seen.mtime_ms === mtime && !seen.more) continue; const row = getRollout.get(f.path); let offset = row ? row.offset : 0; let state = row ? JSON.parse(row.state) : {}; @@ -439,7 +526,8 @@ function ingestCodexUsage({ let skip = null; const parent = offset === 0 ? firstLineMeta(f.path).forked_from_id : state.forkedFrom; if (parent && !state.pastFork) { - if (byThread.has(parent)) skip = await parentTotals(byThread.get(parent)); + const pp = parentPath(parent); + if (pp) skip = await parentTotals(pp); else if (offset === 0) console.warn(`[codex-usage] fork parent ${parent} not found; ${f.path} may overcount`); } @@ -508,10 +596,15 @@ function startCodexUsagePoll(broadcast) { .memberHomes() .map((h) => path.join(h, ".codex")), ]; + // Every FULL_EVERY-th pass (and the first) walks every journal; the others + // only the recent ones (recentRolloutFiles). + const FULL_EVERY = Math.max(1, Math.round((5 * 60_000) / POLL_MS)); + let passNo = 0; const ingestAll = async () => { const total = { sessions: 0 }; + const recent = passNo++ % FULL_EVERY !== 0; for (const home of homes()) { - const r = await ingestCodexUsage({ broadcast, home }); + const r = await ingestCodexUsage({ broadcast, home, recent }); total.sessions += r?.sessions || 0; } return total; diff --git a/server/lib/cursor-usage.js b/server/lib/cursor-usage.js index deb6412e..053d3a2b 100644 --- a/server/lib/cursor-usage.js +++ b/server/lib/cursor-usage.js @@ -182,14 +182,7 @@ function writeSession(f, now) { const endedAt = active ? null : lastWrite; const name = firstPrompt(f.path) || existing?.name || `Cursor ${f.id.slice(0, 8)}`; if (existing) { - updateSession.run( - name, - status, - endedAt, - lastWrite, - cwd, - f.id - ); + updateSession.run(name, status, endedAt, lastWrite, cwd, f.id); return "session_updated"; } insertSession.run( @@ -206,6 +199,9 @@ function writeSession(f, now) { } let running = null; +// Fresh sessions the last pass left for a later one to settle (the poll keeps +// its base pace while there are any). +let lastPending = 0; /** * One pass over every transcript: a changed one is re-read, an unchanged one @@ -217,11 +213,15 @@ function ingestCursorUsage({ broadcast = () => {}, now = Date.now() } = {}) { running = (async () => { let read = 0; let written = 0; + let pending = 0; // still-fresh sessions a later pass may have to settle for (const f of transcriptFiles()) { try { const seen = getSeen.get(f.path); if (seen && seen.mtime_ms === f.mtime) { - if (fresh(f.mtime, now)) continue; + if (fresh(f.mtime, now)) { + pending += 1; + continue; + } const s = stmts.getSession.get(f.id); if (s && s.tool === "cursor" && s.status === "active") { settle.run(new Date(f.mtime).toISOString(), s.id); @@ -242,6 +242,7 @@ function ingestCursorUsage({ broadcast = () => {}, now = Date.now() } = {}) { } await new Promise((r) => setImmediate(r)); } + lastPending = pending; return { files: read, sessions: written }; })().finally(() => { running = null; @@ -249,18 +250,21 @@ function ingestCursorUsage({ broadcast = () => {}, now = Date.now() } = {}) { return running; } -/** First pass at once (in the background), then every DASHBOARD_CURSOR_POLL_MS (default 15 s; 0 disables). */ +/** + * First pass at once (in the background), then every DASHBOARD_CURSOR_POLL_MS + * (default 15 s; 0 disables) — slowed to once a minute after a pass that read + * nothing, wrote nothing and left no fresh session to settle, and back to the + * base pace as soon as one finds work. + */ function startCursorUsagePoll(broadcast) { const POLL_MS = process.env.DASHBOARD_CURSOR_POLL_MS ? Number(process.env.DASHBOARD_CURSOR_POLL_MS) : 15_000; if (!Number.isFinite(POLL_MS) || POLL_MS <= 0) return; - const tick = () => { - ingestCursorUsage({ broadcast }).catch(() => {}); - }; - tick(); - const timer = setInterval(tick, POLL_MS); - if (timer.unref) timer.unref(); + require("./backoff-poll").startBackoffPoll( + () => ingestCursorUsage({ broadcast }).then((r) => r.files + r.sessions + lastPending > 0), + { baseMs: POLL_MS } + ); } module.exports = { diff --git a/server/lib/db-retention.js b/server/lib/db-retention.js new file mode 100644 index 00000000..3865c01c --- /dev/null +++ b/server/lib/db-retention.js @@ -0,0 +1,337 @@ +/** + * @file Database size upkeep (Settings → Data → Session cleanup): the shared + * session purge, the OPT-IN automatic retention, the bounded reclaim of free + * pages, and the manual Compact. + * + * - `purgeSessionIds` is THE deletion of whole sessions — events, agents, + * token usage (daily and hourly) and the session row — used by both the + * manual `POST /api/settings/cleanup` and the automatic retention, so the two + * can never leave different leftovers. + * - Retention is OFF unless `AGENTHUB_RETENTION_DAYS` (settings file, 1–3650) + * is set; it never deletes data by default. When set, the hourly + * `runScheduledMaintenance` purges finished (completed/error/abandoned) + * sessions that STARTED more than that many days ago — the manual purge's + * rule — in transactions of `RETENTION_BATCH` sessions, yielding to the event + * loop between them, and at most `RETENTION_MAX_PER_RUN` per run, so a first + * run on a long history never blocks hooks for long. Each batch deletes by + * `idx_events_session`, never a scan of the events table. + * - With `auto_vacuum = INCREMENTAL` (server/db.js sets it on a new database + * and converts a small existing one at startup), the same run returns free + * pages to the OS once the freelist passes `RECLAIM_MIN_PAGES`, in slices of + * `RECLAIM_SLICE_PAGES`, at most `RECLAIM_MAX_PAGES` per run. + * - `runCompact` (`POST /api/settings/compact`) is the one full VACUUM: in a + * worker thread on its own connection, setting `auto_vacuum = INCREMENTAL` + * first so a large existing database is converted, then a TRUNCATE + * checkpoint so the file actually shrinks. It holds the write lock for its + * whole run (tens of seconds on a GB-size file), so hooks wait or are retried + * meanwhile — it only ever runs on a click. This file is also its worker's + * entry point. + * @author Nguyễn Ngọc Trí Vĩ + */ + +"use strict"; + +const { Worker, isMainThread, workerData, parentPort } = require("node:worker_threads"); + +const KEYS = { days: "AGENTHUB_RETENTION_DAYS" }; +const MAX_DAYS = 3650; +const RETENTION_BATCH = 25; +const RETENTION_MAX_PER_RUN = 5000; +const RECLAIM_MIN_PAGES = 1024; +const RECLAIM_SLICE_PAGES = 1024; +const RECLAIM_MAX_PAGES = 65536; +const PURGE_CHUNK = 500; +const PURGEABLE = "status IN ('completed','error','abandoned')"; + +const coded = (message, code) => Object.assign(new Error(message), { code }); +const yieldLoop = () => new Promise((r) => setImmediate(r)); + +/** `{ days }` — 0 means off. Anything outside 1–MAX_DAYS reads as off. */ +function retentionConfig(env = process.env) { + const raw = env[KEYS.days]; + const n = Number(raw); + const days = raw !== undefined && raw !== "" && Number.isInteger(n) && n >= 1 && n <= MAX_DAYS; + return { days: days ? n : 0 }; +} + +/** + * Delete these sessions and everything hung off them, in chunks (a single + * IN (...) of every id would pass SQLite's bound-variable limit). Runs in the + * CALLER's transaction when there is one. Returns the rows removed. + */ +function purgeSessionIds(db, ids) { + const { forgetHourly } = require("./hourly-usage"); + const out = { purged_sessions: 0, purged_events: 0, purged_agents: 0 }; + for (let i = 0; i < ids.length; i += PURGE_CHUNK) { + const chunk = ids.slice(i, i + PURGE_CHUNK); + const placeholders = chunk.map(() => "?").join(","); + // Cascading deletes handle agents/events, but token_usage FK might not cascade on all setups + out.purged_events += db + .prepare(`DELETE FROM events WHERE session_id IN (${placeholders})`) + .run(...chunk).changes; + out.purged_agents += db + .prepare(`DELETE FROM agents WHERE session_id IN (${placeholders})`) + .run(...chunk).changes; + db.prepare(`DELETE FROM token_usage WHERE session_id IN (${placeholders})`).run(...chunk); + db.prepare(`DELETE FROM token_usage_hourly WHERE session_id IN (${placeholders})`).run( + ...chunk + ); + forgetHourly(chunk); + out.purged_sessions += db + .prepare(`DELETE FROM sessions WHERE id IN (${placeholders})`) + .run(...chunk).changes; + } + return out; +} + +/** What `purgeSessionIds` would delete, without deleting it (the dry run). */ +function countSessionIds(db, ids) { + const out = { purged_sessions: ids.length, purged_events: 0, purged_agents: 0 }; + for (let i = 0; i < ids.length; i += PURGE_CHUNK) { + const chunk = ids.slice(i, i + PURGE_CHUNK); + const placeholders = chunk.map(() => "?").join(","); + out.purged_events += db + .prepare(`SELECT COUNT(*) AS n FROM events WHERE session_id IN (${placeholders})`) + .get(...chunk).n; + out.purged_agents += db + .prepare(`SELECT COUNT(*) AS n FROM agents WHERE session_id IN (${placeholders})`) + .get(...chunk).n; + } + return out; +} + +/** Finished sessions that started before `cutoff` (ISO), at most `limit`. */ +function purgeableBefore(db, cutoff, limit = -1) { + return db + .prepare(`SELECT id, started_at FROM sessions WHERE ${PURGEABLE} AND started_at < ? LIMIT ?`) + .all(cutoff, limit); +} + +/** + * Purge finished sessions older than `days`, a batch per transaction with a + * yield between batches. Resolves to the totals; never throws. + */ +async function applyRetention({ + db = require("../db").db, + days, + now = Date.now(), + batch = RETENTION_BATCH, + maxSessions = RETENTION_MAX_PER_RUN, +} = {}) { + const out = { purged_sessions: 0, purged_events: 0, purged_agents: 0 }; + if (!Number.isInteger(days) || days < 1) return out; + const cutoff = new Date(now - days * 86400 * 1000).toISOString(); + try { + while (out.purged_sessions < maxSessions) { + const ids = purgeableBefore( + db, + cutoff, + Math.min(batch, maxSessions - out.purged_sessions) + ).map((r) => r.id); + if (ids.length === 0) break; + const r = db.transaction(() => purgeSessionIds(db, ids))(); + out.purged_sessions += r.purged_sessions; + out.purged_events += r.purged_events; + out.purged_agents += r.purged_agents; + if (r.purged_sessions === 0) break; // nothing removable: never spin + await yieldLoop(); + } + } catch (err) { + out.error = err.message; + } + return out; +} + +/** One `incremental_vacuum(n)`, stepped to the end on either driver. */ +function incrementalVacuum(db, pages) { + const sql = `PRAGMA incremental_vacuum(${Math.max(1, Math.floor(pages))})`; + try { + db.prepare(sql).all(); // node:sqlite: one row per freed page + } catch (err) { + if (!/does not return data/i.test(err.message)) throw err; + db.pragma(`incremental_vacuum(${Math.max(1, Math.floor(pages))})`); // better-sqlite3 + } +} + +/** + * Hand free pages back to the OS, a slice at a time. A no-op unless the + * database is in INCREMENTAL auto_vacuum and its freelist is over `minPages`. + */ +async function reclaimFreePages({ + db = require("../db").db, + minPages = RECLAIM_MIN_PAGES, + slice = RECLAIM_SLICE_PAGES, + maxPages = RECLAIM_MAX_PAGES, +} = {}) { + const out = { reclaimed_pages: 0 }; + try { + if (db.pragma("auto_vacuum", { simple: true }) !== 2) return out; + let free = db.pragma("freelist_count", { simple: true }); + if (free < minPages) return out; + while (free > 0 && out.reclaimed_pages < maxPages) { + incrementalVacuum(db, Math.min(slice, free, maxPages - out.reclaimed_pages)); + const after = db.pragma("freelist_count", { simple: true }); + if (after >= free) break; + out.reclaimed_pages += free - after; + free = after; + await yieldLoop(); + } + } catch (err) { + out.error = err.message; + } + return out; +} + +let lastRun = null; +let maintaining = null; + +/** + * The hourly upkeep: `maintainDatabase` (checkpoint + optimize), then the + * opt-in retention, then the bounded free-page reclaim. A call while one runs + * joins it. + */ +function runScheduledMaintenance(opts = {}) { + if (maintaining) return maintaining; + maintaining = maintain(opts).finally(() => { + maintaining = null; + }); + return maintaining; +} + +async function maintain({ db } = {}) { + const dbm = require("../db"); + const conn = db || dbm.db; + const started = new Date(); + const out = { at: started.toISOString() }; + try { + if (!db) dbm.maintainDatabase(); + } catch { + /* maintainDatabase reports its own errors in its result */ + } + const { days } = retentionConfig(); + if (days) { + out.retention = await applyRetention({ db: conn, days }); + if (out.retention.purged_sessions > 0) { + console.log( + `[retention] purged ${out.retention.purged_sessions} session(s) older than ${days} days` + ); + } + } + out.reclaim = await reclaimFreePages({ db: conn }); + out.ms = Date.now() - started; + lastRun = out; + return out; +} + +/** Page counts for the Settings card. */ +function spaceInfo(db = require("../db").db) { + const pageSize = db.pragma("page_size", { simple: true }); + const pageCount = db.pragma("page_count", { simple: true }); + const free = db.pragma("freelist_count", { simple: true }); + const mode = db.pragma("auto_vacuum", { simple: true }); + return { + auto_vacuum: mode === 2 ? "incremental" : mode === 1 ? "full" : "none", + page_size: pageSize, + page_count: pageCount, + freelist_pages: free, + free_bytes: free * pageSize, + }; +} + +let compacting = null; +let lastCompact = null; + +function vacuumInWorker(dbPath) { + return new Promise((resolve, reject) => { + const w = new Worker(__filename, { workerData: { agenthubCompactWorker: true, dbPath } }); + w.once("message", (m) => (m.error ? reject(coded(m.error.message, m.error.code)) : resolve(m))); + w.once("error", reject); + w.once( + "exit", + (code) => code !== 0 && reject(coded(`compact worker exited (${code})`, "ECOMPACT")) + ); + }); +} + +/** Start (or join) the manual Compact. The outcome is `lastCompactResult()`. */ +function runCompact() { + if (compacting) return compacting; + const fs = require("node:fs"); + const { DB_PATH } = require("../db"); + const size = () => { + try { + return fs.statSync(DB_PATH).size; + } catch { + return 0; + } + }; + compacting = (async () => { + const started = Date.now(); + const before = size(); + try { + await vacuumInWorker(DB_PATH); + lastCompact = { + at: new Date(started).toISOString(), + ok: true, + size_before: before, + size_after: size(), + ms: Date.now() - started, + }; + return lastCompact; + } catch (err) { + lastCompact = { at: new Date(started).toISOString(), ok: false, error: err.message }; + throw err; + } + })().finally(() => { + compacting = null; + }); + return compacting; +} + +const isCompacting = () => compacting !== null; +const lastCompactResult = () => lastCompact; +const lastMaintenance = () => lastRun; + +if (!isMainThread && workerData?.agenthubCompactWorker) { + // Same driver order as server/db.js: better-sqlite3, else node:sqlite. + let conn; + try { + try { + const Database = require("better-sqlite3"); + conn = new Database(workerData.dbPath); + } catch { + const Database = require("../compat-sqlite"); + conn = new Database(workerData.dbPath); + } + conn.pragma("busy_timeout = 30000"); + conn.pragma("auto_vacuum = INCREMENTAL"); // stored by the VACUUM below + conn.exec("VACUUM"); + try { + conn.pragma("wal_checkpoint(TRUNCATE)"); + } catch { + /* a reader holds the WAL: the periodic checkpoint finishes it */ + } + parentPort.postMessage({ ok: true }); + } catch (err) { + parentPort.postMessage({ error: { message: err.message, code: err.code || "ECOMPACT" } }); + } finally { + conn?.close(); + } +} + +module.exports = { + KEYS, + MAX_DAYS, + retentionConfig, + purgeSessionIds, + countSessionIds, + purgeableBefore, + applyRetention, + reclaimFreePages, + runScheduledMaintenance, + spaceInfo, + runCompact, + isCompacting, + lastCompactResult, + lastMaintenance, +}; diff --git a/server/lib/redoc.js b/server/lib/redoc.js index 4ab21ede..848e47f0 100644 --- a/server/lib/redoc.js +++ b/server/lib/redoc.js @@ -2,21 +2,29 @@ * @file Self-hosted ReDoc API reference. ReDoc renders the OpenAPI spec as a * clean, three-panel reference document — a read-optimized complement to * Swagger UI's interactive "try it out" console (both are served from the same - * `/api/openapi.json` spec). The ReDoc bundle ships with the `redoc` - * dependency and is served straight from `node_modules` rather than a CDN, so - * the docs render fully offline / air-gapped, consistent with the project's - * no-external-assets policy. + * `/api/openapi.json` spec). The ReDoc bundle is served from the repo itself + * rather than a CDN, so the docs render fully offline / air-gapped, consistent + * with the project's no-external-assets policy. + * + * The bundle is VENDORED (`server/vendor/redoc/`): `redoc.standalone.js` from + * the `redoc` npm package 2.5.4, byte-for-byte, with its MIT `LICENSE` and the + * bundled libraries' `redoc.standalone.js.LICENSE.txt`. The `redoc` package + * itself is not a dependency — the server only ever serves this one browser + * file, and the package pulled ~25 MB of Node-side dependencies into every + * runtime install. To update: `npm pack redoc@`, copy + * `package/bundles/redoc.standalone.js` (+ `.LICENSE.txt`) over these files and + * bump the version named here. * @author Nguyễn Ngọc Trí Vĩ */ +const path = require("path"); + /** - * Absolute path to the prebuilt ReDoc standalone bundle inside the installed - * `redoc` package. Resolved through Node's module resolution so it works - * regardless of hoisting / install layout. Throws if `redoc` is not installed. + * Absolute path to the vendored ReDoc standalone bundle. * @returns {string} */ function redocBundlePath() { - return require.resolve("redoc/bundles/redoc.standalone.js"); + return path.join(__dirname, "..", "vendor", "redoc", "redoc.standalone.js"); } /** diff --git a/server/lib/worktree.js b/server/lib/worktree.js index d693402d..b2336780 100644 --- a/server/lib/worktree.js +++ b/server/lib/worktree.js @@ -115,6 +115,19 @@ async function git( }); return { stdout: result.stdout, stderr: result.stderr }; } catch (err) { + // ENOENT from execFile is ambiguous: a missing binary OR a missing cwd. + // With the folder present it is git itself that is absent — say so, with + // the fix, rather than `git status failed` (like ETMUXMISSING for tmux). + if (err.code === "ENOENT" && cmd === "git" && fs.existsSync(cwd)) { + const error = new Error( + "git is not installed (or not on the dashboard's PATH), and every git action needs it. " + + "Install it (sudo apt install git / brew install git / https://git-scm.com/download/win), " + + "then restart the dashboard." + ); + error.code = "EGITMISSING"; + error.git = { args, code: "EGITMISSING", stderr: "", stdout: "" }; + throw error; + } const error = new Error(`git ${args[0]} failed`); error.code = err.code; error.git = { args, code: err.code, stderr: err.stderr, stdout: err.stdout }; diff --git a/server/openapi-extra/misc.js b/server/openapi-extra/misc.js index d22bdd99..ab172934 100644 --- a/server/openapi-extra/misc.js +++ b/server/openapi-extra/misc.js @@ -11,6 +11,9 @@ * - GET /api/settings/backup (Settings) * - PUT /api/settings/backup (Settings) * - POST /api/settings/backup/run (Settings) + * - GET /api/settings/retention (Settings) + * - PUT /api/settings/retention (Settings) + * - POST /api/settings/compact (Settings) * - GET /api/workflows/runs (Workflows) * - GET /api/workflows/runs/{runId} (Workflows) * - GET /api/remote-sources (Remote Sources) @@ -1225,6 +1228,117 @@ const paths = { }, }, + "/api/settings/retention": (() => { + const state = { + description: "Automatic retention setting, database space and the last Compact", + content: { + "application/json": { + schema: { + type: "object", + required: ["days", "max_days", "env_owned", "compacting"], + properties: { + days: { + type: "integer", + minimum: 0, + maximum: 3650, + description: + "Finished sessions older than this many days are purged by the hourly maintenance; 0 = off (the default)", + }, + max_days: { type: "integer" }, + env_owned: { type: "object", properties: { days: { type: "boolean" } } }, + last_run: { + type: "object", + nullable: true, + description: + "This process's last hourly maintenance: {at, retention?: {purged_sessions, purged_events, purged_agents, error?}, reclaim: {reclaimed_pages, error?}, ms}", + }, + space: { + type: "object", + nullable: true, + properties: { + auto_vacuum: { type: "string", enum: ["none", "full", "incremental"] }, + page_size: { type: "integer" }, + page_count: { type: "integer" }, + freelist_pages: { type: "integer" }, + free_bytes: { type: "integer" }, + }, + }, + db_size: { type: "integer", description: "Database file size in bytes" }, + compacting: { type: "boolean" }, + last_compact: { + type: "object", + nullable: true, + description: + "This process's last Compact: {at, ok, size_before?, size_after?, ms?, error?}", + }, + }, + }, + }, + }, + }; + return { + get: { + tags: ["Settings"], + summary: "Automatic retention and database space", + operationId: "getRetention", + responses: { 200: state }, + }, + put: { + tags: ["Settings"], + summary: "Set the automatic retention", + description: + "Persisted to the settings file as AGENTHUB_RETENTION_DAYS. 0 turns it off. Same-origin only; in server mode an admin's.", + operationId: "setRetention", + requestBody: { + required: true, + content: { + "application/json": { + schema: { + type: "object", + required: ["days"], + properties: { days: { type: "integer", minimum: 0, maximum: 3650 } }, + }, + }, + }, + }, + responses: { + 200: { ...state, description: "The new state" }, + 400: { description: "INVALID_INPUT: days is not a whole number from 0 to 3650" }, + 403: { description: "EBADORIGIN: another site asked" }, + 409: { description: "EENVOWNED: the environment set AGENTHUB_RETENTION_DAYS" }, + 500: { description: "ESAVE: the settings file could not be written" }, + }, + }, + }; + })(), + + "/api/settings/compact": { + post: { + tags: ["Settings"], + summary: "Compact the database now (full VACUUM)", + description: + "Rewrites the database in a worker thread, switching it to incremental auto_vacuum, then truncates the WAL. Hook writes wait while it runs. Answers at once; poll GET /api/settings/retention while `compacting`. Same-origin only; in server mode an admin's.", + operationId: "compactDatabase", + requestBody: { + required: true, + content: { + "application/json": { + schema: { + type: "object", + required: ["confirm"], + properties: { confirm: { type: "boolean", enum: [true] } }, + }, + }, + }, + }, + responses: { + 202: { description: "Started (or already running); the retention state" }, + 400: { description: "ECONFIRM: confirm: true is missing" }, + 403: { description: "EBADORIGIN: another site asked" }, + }, + }, + }, + "/api/settings/codex-hooks": (() => { const status = { description: "Where AgentHub's Codex hooks stand", diff --git a/server/routes/hooks.js b/server/routes/hooks.js index 107ba529..ecc105fc 100644 --- a/server/routes/hooks.js +++ b/server/routes/hooks.js @@ -294,6 +294,46 @@ const turnDurationStampsStmt = db.prepare( "SELECT created_at FROM events WHERE session_id = ? AND event_type = 'TurnDuration'" ); +// What this process already handled of each session's transcript parse. +// `transcriptCache.extract` returns the SAME result object while the file is +// unchanged, and a grown file's result is the old arrays plus the new tail +// (errors/turnDurations keep their element objects, compaction entries their +// uuid). So an identical result skips the token, compaction, API-error and +// turn-duration writes outright — each is idempotent against the DB, so they +// would have written nothing new — and a grown one walks only the entries +// after the last one handled. Anything that does not line up (a full re-read, +// the session re-created, the head trimmed off a capped array) falls back to +// the whole array, exactly as before. Marks are applied only once the hook's +// transaction committed; bounded, oldest dropped first. +const TRANSCRIPT_MARKS_MAX = 500; +const transcriptMarks = new Map(); +let pendingMarks = null; + +function transcriptMarkFor(sessionId, transcriptPath, startedAt) { + const m = transcriptMarks.get(`${sessionId}\0${transcriptPath}`); + return m && m.startedAt === startedAt ? m : null; +} + +function queueTranscriptMark(sessionId, transcriptPath, mark) { + if (pendingMarks) pendingMarks.push([`${sessionId}\0${transcriptPath}`, mark]); +} + +function applyTranscriptMarks(marks) { + for (const [key, mark] of marks) { + transcriptMarks.delete(key); + transcriptMarks.set(key, mark); + if (transcriptMarks.size > TRANSCRIPT_MARKS_MAX) + transcriptMarks.delete(transcriptMarks.keys().next().value); + } +} + +/** The entries of `arr` after `last` (found by `same`), or all of `arr`. */ +function tailAfter(arr, last, same) { + if (!arr || last == null) return arr; + for (let i = arr.length - 1; i >= 0; i--) if (same(arr[i], last)) return arr.slice(i + 1); + return arr; +} + /** The session's `-main` agent, created and broadcast. */ function createMainAgent(session) { const mainAgentId = `${session.id}-main`; @@ -944,6 +984,11 @@ const processEventTx = db.transaction((hookType, data, tool = "claude") => { const result = transcriptCache.extract(transcriptPath); if (result) { const { tokensByModel, compaction, latestModel } = result; + // Already handled (see transcriptMarks): the same result skips the + // idempotent writes below, a grown one handles only its new entries. + const mark = transcriptMarkFor(sessionId, transcriptPath, session.started_at); + const unchanged = !!mark && mark.result === result; + const lastOf = (arr) => (arr && arr.length ? arr[arr.length - 1] : null); // Keep session.model in sync with the user's *current* model — the // transcript's most recent assistant entry is the source of truth, since @@ -972,8 +1017,13 @@ const processEventTx = db.transaction((hookType, data, tool = "claude") => { // Register compaction agents and events. // Each isCompactSummary entry in the JSONL = one compaction that occurred. // Deduplicate by uuid so we only create once per compaction. - if (compaction) { - for (const entry of compaction.entries) { + if (compaction && !unchanged) { + const fresh = tailAfter( + compaction.entries, + mark?.compactionUuid, + (e, uuid) => e.uuid === uuid + ); + for (const entry of fresh) { const compactId = `${sessionId}-compact-${entry.uuid}`; if (stmts.getAgent.get(compactId)) continue; @@ -1024,7 +1074,7 @@ const processEventTx = db.transaction((hookType, data, tool = "claude") => { } } - if (tokensByModel) { + if (tokensByModel && !unchanged) { // Each bucket carries its pricing dimensions (model/speed/geo/tier) plus // the 1h cache-write split and server-tool request counts. for (const tokens of Object.values(tokensByModel)) { @@ -1059,12 +1109,15 @@ const processEventTx = db.transaction((hookType, data, tool = "claude") => { } // Register API errors from transcript (quota limits, rate limits, overloaded, etc.) - if (result.errors) { + const freshErrors = unchanged + ? null + : tailAfter(result.errors, mark?.lastError, (a, b) => a === b); + if (freshErrors && freshErrors.length) { let newErrorRecorded = false; // Deduplicate against the errors already recorded, read ONCE per hook: // `result.errors` is the transcript's whole history, not just new ones. const recorded = new Set(apiErrorSummariesStmt.all(sessionId).map((r) => r.summary)); - for (const apiErr of result.errors) { + for (const apiErr of freshErrors) { const errSummary = `${apiErr.type}: ${apiErr.message}`; if (recorded.has(errSummary)) continue; recorded.add(errSummary); @@ -1136,13 +1189,16 @@ const processEventTx = db.transaction((hookType, data, tool = "claude") => { } // Register turn duration events from transcript - if (result.turnDurations) { + const freshTurns = unchanged + ? null + : tailAfter(result.turnDurations, mark?.lastTurn, (a, b) => a === b); + if (freshTurns && freshTurns.length) { // `turnDurations` is every turn in the transcript (up to 1000), on // every hook: dedupe against ONE read of the recorded timestamps (a // covering-index scan) instead of a query per turn — 23 ms per hook on // a 763-turn session before. const recorded = new Set(turnDurationStampsStmt.all(sessionId).map((r) => r.created_at)); - for (const td of result.turnDurations) { + for (const td of freshTurns) { const tdTs = td.timestamp || new Date().toISOString(); if (recorded.has(tdTs)) continue; recorded.add(tdTs); @@ -1171,6 +1227,14 @@ const processEventTx = db.transaction((hookType, data, tool = "claude") => { } } + queueTranscriptMark(sessionId, transcriptPath, { + result, + startedAt: session.started_at, + compactionUuid: lastOf(compaction?.entries)?.uuid ?? null, + lastError: lastOf(result.errors), + lastTurn: lastOf(result.turnDurations), + }); + // Update session metadata with enriched data (thinking blocks, usage extras) if (result.usageExtras || result.thinkingBlockCount > 0) { const session = stmts.getSession.get(sessionId); @@ -1250,7 +1314,19 @@ const processEventTx = db.transaction((hookType, data, tool = "claude") => { * inside it described a row a later throw could still roll back. */ function processEvent(hookType, data, tool) { - return holdFrames(() => processEventTx(hookType, data, tool)); + const outer = pendingMarks; + pendingMarks = []; + let marks = null; + try { + const out = holdFrames(() => processEventTx(hookType, data, tool)); + marks = pendingMarks; + return out; + } finally { + pendingMarks = outer; + // Only what COMMITTED is marked handled: a rolled-back hook's entries are + // walked again by the next one. + if (marks && !db.inTransaction) applyTranscriptMarks(marks); + } } /** Run `fn` with frames held, then send them if it returned (nested: the @@ -2176,6 +2252,7 @@ const watchdogTimer = setInterval(watchdogCheck, WATCHDOG_INTERVAL_MS); if (watchdogTimer.unref) watchdogTimer.unref(); router.transcriptCache = transcriptCache; +router.transcriptMarks = transcriptMarks; router.watchdogCheck = watchdogCheck; router.livenessReap = livenessReap; module.exports = router; diff --git a/server/routes/lanes.js b/server/routes/lanes.js index 6845be8c..9ed3a256 100644 --- a/server/routes/lanes.js +++ b/server/routes/lanes.js @@ -1937,7 +1937,10 @@ router.post("/:id/git/:action", sameOriginGuard, async (req, res) => { "EMEMBERGONE", ].includes(err.code) ? 409 - : 500; + : // Not the request's fault and not a server bug: the host lacks git. + err.code === "EGITMISSING" + ? 503 + : 500; // git's own stderr is the useful half of a failed push or pull (a // rejection, a missing credential, a diverged branch), so it joins the // message rather than riding a side field the client would have to know diff --git a/server/routes/settings.js b/server/routes/settings.js index ea67d61d..3c62e4bc 100644 --- a/server/routes/settings.js +++ b/server/routes/settings.js @@ -1,5 +1,5 @@ /** - * @file Express router for settings-related endpoints, providing system info, database statistics, hook status, and operations to clear data, re-import sessions, reinstall hooks, reset pricing, export data, and perform cleanup of stale sessions, plus the privacy controls (secret redaction, ignored folders), the push-ingest token and the daily database backup (server/lib/db-backup.js). This allows the frontend to manage and maintain the agent monitoring system effectively. + * @file Express router for settings-related endpoints, providing system info, database statistics, hook status, and operations to clear data, re-import sessions, reinstall hooks, reset pricing, export data, and perform cleanup of stale sessions, plus the privacy controls (secret redaction, ignored folders), the push-ingest token, the daily database backup (server/lib/db-backup.js) and the opt-in retention + Compact (server/lib/db-retention.js). This allows the frontend to manage and maintain the agent monitoring system effectively. * @author Nguyễn Ngọc Trí Vĩ */ @@ -28,6 +28,7 @@ const { getCodexHome, setCodexHome } = require("../lib/codex-home"); const { envOwned, applySetting } = require("../lib/settings-env"); const privacy = require("../lib/privacy"); const dbBackup = require("../lib/db-backup"); +const retention = require("../lib/db-retention"); const pushToken = require("../lib/push-token"); const pricingSync = require("../lib/pricing-sync"); const { @@ -678,10 +679,66 @@ function pushTokenWrite(fn) { router.post("/push-token", sameOriginGuard, pushTokenWrite(pushToken.rotatePushToken)); router.delete("/push-token", sameOriginGuard, pushTokenWrite(pushToken.revokePushToken)); +// GET/PUT /api/settings/retention, POST /api/settings/compact — database size +// upkeep (server/lib/db-retention.js). Retention is OFF by default: `days` 0 +// turns it off, 1–3650 makes the hourly maintenance purge finished sessions +// older than that, the manual purge's rule. It persists to the settings file; +// one the environment set is `env_owned` and refused. Compact (a full VACUUM +// in a worker) answers 202 and the page polls GET while `compacting`. +function retentionState() { + let space = null; + try { + space = retention.spaceInfo(db); + } catch { + /* pragma unavailable: the card shows no numbers */ + } + return { + ...retention.retentionConfig(), + max_days: retention.MAX_DAYS, + env_owned: { days: envOwned.has(retention.KEYS.days) }, + last_run: retention.lastMaintenance(), + space, + db_size: getDbSize(), + compacting: retention.isCompacting(), + last_compact: retention.lastCompactResult(), + }; +} +router.get("/retention", (_req, res) => res.json(retentionState())); +router.put("/retention", sameOriginGuard, (req, res) => { + const days = req.body?.days; + if (!Number.isInteger(days) || days < 0 || days > retention.MAX_DAYS) { + return res.status(400).json({ + error: { + code: "INVALID_INPUT", + message: `days must be a whole number from 0 (off) to ${retention.MAX_DAYS}`, + }, + }); + } + if (envOwned.has(retention.KEYS.days)) { + return res.status(409).json({ + error: { code: "EENVOWNED", message: `${retention.KEYS.days} is set by the environment` }, + }); + } + try { + applySetting(retention.KEYS.days, days === 0 ? "" : String(days)); + } catch (err) { + return res.status(500).json({ error: { code: "ESAVE", message: err.message } }); + } + res.json({ ok: true, ...retentionState() }); +}); +router.post("/compact", sameOriginGuard, (req, res) => { + if (req.body?.confirm !== true) { + return res.status(400).json({ + error: { code: "ECONFIRM", message: "compacting needs confirm: true" }, + }); + } + retention.runCompact().catch(() => {}); // the outcome is `last_compact` in GET + res.status(202).json({ ok: true, ...retentionState() }); +}); + // POST /api/settings/cleanup — abandon stale sessions, purge old data. // `purge_days` is a whole number ≥ 1 (0.1 days would purge almost everything); // `dry_run: true` answers the same counts and changes nothing. -const PURGE_CHUNK = 500; router.post("/cleanup", (req, res) => { const { abandon_hours, purge_days } = req.body; const dryRun = req.body.dry_run === true; @@ -739,11 +796,7 @@ router.post("/cleanup", (req, res) => { if (purge_days && typeof purge_days === "number" && purge_days > 0) { const cutoff = new Date(Date.now() - purge_days * 86400 * 1000).toISOString(); // Only purge completed/error/abandoned sessions, never active - const toDelete = db - .prepare( - "SELECT id FROM sessions WHERE status IN ('completed','error','abandoned') AND started_at < ?" - ) - .all(cutoff); + const toDelete = retention.purgeableBefore(db, cutoff); if (dryRun) { // Exactly the ids the real run deletes: those already purgeable, plus @@ -752,43 +805,15 @@ router.post("/cleanup", (req, res) => { ...toDelete.map((r) => r.id), ...wouldAbandon.filter((r) => r.started_at < cutoff).map((r) => r.id), ]; - for (let i = 0; i < ids.length; i += PURGE_CHUNK) { - const chunk = ids.slice(i, i + PURGE_CHUNK); - const placeholders = chunk.map(() => "?").join(","); - result.purged_events += db - .prepare(`SELECT COUNT(*) AS n FROM events WHERE session_id IN (${placeholders})`) - .get(...chunk).n; - result.purged_agents += db - .prepare(`SELECT COUNT(*) AS n FROM agents WHERE session_id IN (${placeholders})`) - .get(...chunk).n; - } - result.purged_sessions = ids.length; + Object.assign(result, retention.countSessionIds(db, ids)); return res.json({ ok: true, ...result }); } - // One transaction, in chunks: a single IN (...) list of every id would - // pass SQLite's bound-variable limit on a large history. - db.transaction(() => { - const ids = toDelete.map((r) => r.id); - for (let i = 0; i < ids.length; i += PURGE_CHUNK) { - const chunk = ids.slice(i, i + PURGE_CHUNK); - const placeholders = chunk.map(() => "?").join(","); - // Cascading deletes handle agents/events, but token_usage FK might not cascade on all setups - result.purged_events += db - .prepare(`DELETE FROM events WHERE session_id IN (${placeholders})`) - .run(...chunk).changes; - result.purged_agents += db - .prepare(`DELETE FROM agents WHERE session_id IN (${placeholders})`) - .run(...chunk).changes; - db.prepare(`DELETE FROM token_usage WHERE session_id IN (${placeholders})`).run(...chunk); - db.prepare(`DELETE FROM token_usage_hourly WHERE session_id IN (${placeholders})`).run( - ...chunk - ); - forgetHourly(chunk); - db.prepare(`DELETE FROM sessions WHERE id IN (${placeholders})`).run(...chunk); - } - result.purged_sessions = ids.length; - })(); + // One transaction; the deletion itself is shared with the automatic + // retention (server/lib/db-retention.js). + const ids = toDelete.map((r) => r.id); + const purged = db.transaction(() => retention.purgeSessionIds(db, ids))(); + Object.assign(result, purged, { purged_sessions: ids.length }); } res.json({ ok: true, ...result }); diff --git a/server/update-scheduler.js b/server/update-scheduler.js index 6a7a9ea6..eda5d0a3 100644 --- a/server/update-scheduler.js +++ b/server/update-scheduler.js @@ -1,5 +1,11 @@ /** - * @file Periodic git upstream check and WebSocket broadcast when update availability changes. + * @file Periodic release/upstream check and WebSocket broadcast when update + * availability changes. Hourly by default (`DASHBOARD_UPDATE_CHECK_INTERVAL_MS`, + * floor 60 s); a tick with no browser connected is skipped — a checkout install + * runs `git fetch` on every check, and nobody would see the answer — and the + * first browser to connect after a skipped or stale check gets one promptly. + * The manual "Check now" (`POST /api/updates/check`, `agenthub update-check`) + * is not routed through here and always runs. * @author Nguyễn Ngọc Trí Vĩ */ @@ -13,11 +19,39 @@ function isUpdateCheckDisabled() { function intervalMs() { const n = Number.parseInt(process.env.DASHBOARD_UPDATE_CHECK_INTERVAL_MS || "", 10); if (Number.isFinite(n) && n >= 60_000) return n; - return 5 * 60 * 1000; + return 60 * 60 * 1000; } -function startUpdateScheduler({ broadcast }) { +/** Delay before the catch-up check a reconnecting browser triggers. */ +const CONNECT_CHECK_DELAY_MS = 3_000; + +/** + * @param {object} opts + * @param {Function} opts.broadcast + * @param {() => number} [opts.getConnectionCount] browsers connected now + * (default: server/websocket.js's); 0 skips a scheduled tick. + * @param {(fn: Function) => Function} [opts.onConnection] subscribe to new + * browser connections; returns an unsubscribe. + * @param {Function} [opts.getStatus] the check itself (tests inject it). + * @param {number} [opts.initialDelayMs] first tick after start (default 8 s). + */ +function startUpdateScheduler({ + broadcast, + getConnectionCount, + onConnection, + getStatus = getUpdatesStatus, + initialDelayMs = 8_000, +}) { if (isUpdateCheckDisabled()) return { stop: () => {} }; + if (!getConnectionCount || !onConnection) { + const ws = require("./websocket"); + getConnectionCount = getConnectionCount || ws.getConnectionCount; + onConnection = onConnection || ws.onConnection; + } + const every = intervalMs(); + let lastCheckAt = 0; + let inFlight = false; + let connectTimer = null; let lastFingerprint = ""; let lastHadUpdate = false; @@ -25,10 +59,24 @@ function startUpdateScheduler({ broadcast }) { let initialTimer = null; let intervalTimer = null; - async function tick() { + // A scheduled tick: skipped while no browser is connected. + function scheduledTick() { if (stopped) return; + let clients = 1; try { - const status = await getUpdatesStatus(); + clients = getConnectionCount(); + } catch { + /* unknown: check as before */ + } + if (clients > 0) tick(); + } + + async function tick() { + if (stopped || inFlight) return; + inFlight = true; + lastCheckAt = Date.now(); + try { + const status = await getStatus(); // Fingerprint must change whenever anything user-visible changes, // including the *shape* of manual_command (e.g. user switches branch // or adds an upstream remote — same remote_sha / commits_behind, but @@ -72,15 +120,33 @@ function startUpdateScheduler({ broadcast }) { } } catch { // Non-fatal — never block the server on update checks + } finally { + inFlight = false; } } - initialTimer = setTimeout(() => { - tick(); - }, 8_000); + // A browser came back after the scheduled checks were skipped (or the last + // one is older than the interval): check once, shortly, so the banner is + // current without waiting up to an hour. + let unsubscribe = null; + try { + unsubscribe = onConnection(() => { + if (stopped || connectTimer || inFlight) return; + if (Date.now() - lastCheckAt < every) return; + connectTimer = setTimeout(() => { + connectTimer = null; + tick(); + }, CONNECT_CHECK_DELAY_MS); + if (typeof connectTimer.unref === "function") connectTimer.unref(); + }); + } catch { + /* no WebSocket server: scheduled ticks only */ + } + + initialTimer = setTimeout(scheduledTick, initialDelayMs); if (typeof initialTimer.unref === "function") initialTimer.unref(); - intervalTimer = setInterval(tick, intervalMs()); + intervalTimer = setInterval(scheduledTick, every); if (typeof intervalTimer.unref === "function") intervalTimer.unref(); return { @@ -88,8 +154,10 @@ function startUpdateScheduler({ broadcast }) { stopped = true; if (initialTimer) clearTimeout(initialTimer); if (intervalTimer) clearInterval(intervalTimer); + if (connectTimer) clearTimeout(connectTimer); + if (typeof unsubscribe === "function") unsubscribe(); }, }; } -module.exports = { startUpdateScheduler }; +module.exports = { startUpdateScheduler, intervalMs }; diff --git a/server/vendor/redoc/LICENSE b/server/vendor/redoc/LICENSE new file mode 100644 index 00000000..20075d85 --- /dev/null +++ b/server/vendor/redoc/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015-present, Rebilly, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/server/vendor/redoc/redoc.standalone.js b/server/vendor/redoc/redoc.standalone.js new file mode 100644 index 00000000..d0bc2eeb --- /dev/null +++ b/server/vendor/redoc/redoc.standalone.js @@ -0,0 +1,1851 @@ +/*! For license information please see redoc.standalone.js.LICENSE.txt */ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("null")):"function"==typeof define&&define.amd?define(["null"],t):"object"==typeof exports?exports.Redoc=t(require("null")):e.Redoc=t(e.null)}(this,function(e){return function(){var t={4206:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const r=n(2785),i=n(7582),o=n(1498),s=n(2791),a="https://json-schema.org/draft/2020-12/schema";class l extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),i.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:e,meta:t}=this.opts;t&&(s.default.call(this,e),this.refs["http://json-schema.org/schema"]=a)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}e.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=n(8597);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=n(9288);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}})},5659:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0,t._=o,t.str=a,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},t.stringify=function(e){return new i(u(e))},t.safeStringify=u,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new i(`.${e}`):o`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new i(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new i(e.toString())};class n{}t._CodeOrName=n,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends n{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=r;class i extends n{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function o(e,...t){const n=[e[0]];let r=0;for(;r"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){const n=e?i.varKinds.var:this.varKind,r=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,e,t)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof r.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=j(this.rhs,e,t),this}get names(){return C(this.lhs instanceof r.Name?{}:{...this.lhs.names},this.rhs)}}class u extends c{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class p extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class f extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class h extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=j(this.code,e,t),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}}class m extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:n}=this;let r=n.length;for(;r--;){const i=n[r];i.optimizeNames(e,t)||(T(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>A(e,t.names),{})}}class g extends m{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class y extends m{}class b extends g{}b.kind="else";class v extends g{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new b(e):e}return t?!1===e?t instanceof v?t:t.nodes:this.nodes.length?this:new v(N(e),t instanceof v?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var n;if(this.else=null===(n=this.else)||void 0===n?void 0:n.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=j(this.condition,e,t),this}get names(){const e=super.names;return C(e,this.condition),this.else&&A(e,this.else.names),e}}v.kind="if";class x extends g{}x.kind="for";class w extends x{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=j(this.iteration,e,t),this}get names(){return A(super.names,this.iteration.names)}}class k extends x{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){const t=e.es5?i.varKinds.var:this.varKind,{name:n,from:r,to:o}=this;return`for(${t} ${n}=${r}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){const e=C(super.names,this.from);return C(e,this.to)}}class S extends x{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=j(this.iterable,e,t),this}get names(){return A(super.names,this.iterable.names)}}class E extends g{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}E.kind="func";class O extends m{render(e){return"return "+super.render(e)}}O.kind="return";class _ extends g{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),null===(n=this.catch)||void 0===n||n.optimizeNames(e,t),null===(r=this.finally)||void 0===r||r.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&A(e,this.catch.names),this.finally&&A(e,this.finally.names),e}}class P extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}P.kind="catch";class $ extends g{render(e){return"finally"+super.render(e)}}function A(e,t){for(const n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function C(e,t){return t instanceof r._CodeOrName?A(e,t.names):e}function j(e,t,n){return e instanceof r.Name?o(e):(i=e)instanceof r._Code&&i._items.some(e=>e instanceof r.Name&&1===t[e.str]&&void 0!==n[e.str])?new r._Code(e._items.reduce((e,t)=>(t instanceof r.Name&&(t=o(t)),t instanceof r._Code?e.push(...t._items):e.push(t),e),[])):e;var i;function o(e){const r=n[e.str];return void 0===r||1!==t[e.str]?e:(delete t[e.str],r)}}function T(e,t){for(const n in t)e[n]=(e[n]||0)-(t[n]||0)}function N(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:r._`!${D(e)}`}$.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new i.Scope({parent:e}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){const i=this._scope.toName(t);return void 0!==n&&r&&(this._constants[i.str]=n),this._leafNode(new l(e,i,n)),i}const(e,t,n){return this._def(i.varKinds.const,e,t,n)}let(e,t,n){return this._def(i.varKinds.let,e,t,n)}var(e,t,n){return this._def(i.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new c(e,t,n))}add(e,n){return this._leafNode(new u(e,t.operators.ADD,n))}code(e){return"function"==typeof e?e():e!==r.nil&&this._leafNode(new h(e)),this}object(...e){const t=["{"];for(const[n,i]of e)t.length>1&&t.push(","),t.push(n),(n!==i||this.opts.es5)&&(t.push(":"),(0,r.addCodeArg)(t,i));return t.push("}"),new r._Code(t)}if(e,t,n){if(this._blockNode(new v(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new v(e))}else(){return this._elseNode(new b)}endIf(){return this._endBlockNode(v,b)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new w(e),t)}forRange(e,t,n,r,o=(this.opts.es5?i.varKinds.var:i.varKinds.let)){const s=this._scope.toName(e);return this._for(new k(o,s,t,n),()=>r(s))}forOf(e,t,n,o=i.varKinds.const){const s=this._scope.toName(e);if(this.opts.es5){const e=t instanceof r.Name?t:this.var("_arr",t);return this.forRange("_i",0,r._`${e}.length`,t=>{this.var(s,r._`${e}[${t}]`),n(s)})}return this._for(new S("of",o,s,t),()=>n(s))}forIn(e,t,n,o=(this.opts.es5?i.varKinds.var:i.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,r._`Object.keys(${t})`,n);const s=this._scope.toName(e);return this._for(new S("in",o,s,t),()=>n(s))}endFor(){return this._endBlockNode(x)}label(e){return this._leafNode(new p(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new O;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(O)}try(e,t,n){if(!t&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');const r=new _;if(this._blockNode(r),this.code(e),t){const e=this.name("e");this._currNode=r.catch=new P(e),t(e)}return n&&(this._currNode=r.finally=new $,this.code(n)),this._endBlockNode(P,$)}throw(e){return this._leafNode(new f(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const n=this._nodes.length-t;if(n<0||void 0!==e&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=r.nil,n,i){return this._blockNode(new E(e,t,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(E)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof v))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}};const I=L(t.operators.AND),R=L(t.operators.OR);function L(e){return(t,n)=>t===r.nil?n:n===r.nil?t:r._`${D(t)} ${e} ${D(n)}`}function D(e){return e instanceof r.Name?e:r._`(${e})`}},352:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const r=n(5659);class i extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var o;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(o||(t.UsedValueState=o={})),t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};class s{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof r.Name?e:this.name(e)}name(e){return new r.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,n;if((null===(n=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===n?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=s;class a extends r.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=r._`.${new r.Name(t)}[${n}]`}}t.ValueScopeName=a;const l=r._`\n`;t.ValueScope=class extends s{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?l:r.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var n;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const r=this.toName(e),{prefix:i}=r,o=null!==(n=t.key)&&void 0!==n?n:t.ref;let s=this._values[i];if(s){const e=s.get(o);if(e)return e}else s=this._values[i]=new Map;s.set(o,r);const a=this._scope[i]||(this._scope[i]=[]),l=a.length;return a[l]=t.ref,r.setValue(t,{property:i,itemIndex:l}),r}getValue(e,t){const n=this._values[e];if(n)return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw new Error(`CodeGen: name "${t}" has no value`);return r._`${e}${t.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(e,n,s={},a){let l=r.nil;for(const c in e){const u=e[c];if(!u)continue;const p=s[c]=s[c]||new Map;u.forEach(e=>{if(p.has(e))return;p.set(e,o.Started);let s=n(e);if(s){const n=this.opts.es5?t.varKinds.var:t.varKinds.const;l=r._`${l}${n} ${e} = ${s};${this.opts._n}`}else{if(!(s=null==a?void 0:a(e)))throw new i(e);l=r._`${l}${s}${this.opts._n}`}p.set(e,o.Completed)})}return l}}},695:function(e,t,n){"use strict";t.keyword$DataError=t.y=void 0,t.reportError=function(e,n=t.y,i,o){const{it:l}=e,{gen:u,compositeRule:p,allErrors:d}=l,f=c(e,n,i);(null!=o?o:p||d)?s(u,f):a(l,r._`[${f}]`)},t.reportExtraError=function(e,n=t.y,r){const{it:i}=e,{gen:l,compositeRule:u,allErrors:p}=i;s(l,c(e,n,r)),u||p||a(i,o.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(o.default.errors,t),e.if(r._`${o.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(r._`${o.default.vErrors}.length`,t),()=>e.assign(o.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:n,data:i,errsCount:s,it:a}){if(void 0===s)throw new Error("ajv implementation error");const l=e.name("err");e.forRange("i",s,o.default.errors,s=>{e.const(l,r._`${o.default.vErrors}[${s}]`),e.if(r._`${l}.instancePath === undefined`,()=>e.assign(r._`${l}.instancePath`,(0,r.strConcat)(o.default.instancePath,a.errorPath))),e.assign(r._`${l}.schemaPath`,r.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(r._`${l}.schema`,n),e.assign(r._`${l}.data`,i))})};const r=n(9288),i=n(2124),o=n(6202);function s(e,t){const n=e.const("err",t);e.if(r._`${o.default.vErrors} === null`,()=>e.assign(o.default.vErrors,r._`[${n}]`),r._`${o.default.vErrors}.push(${n})`),e.code(r._`${o.default.errors}++`)}function a(e,t){const{gen:n,validateName:i,schemaEnv:o}=e;o.$async?n.throw(r._`new ${e.ValidationError}(${t})`):(n.assign(r._`${i}.errors`,t),n.return(!1))}t.y={message:({keyword:e})=>r.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?r.str`"${e}" keyword must be ${t} ($data)`:r.str`"${e}" keyword is invalid ($data)`};const l={keyword:new r.Name("keyword"),schemaPath:new r.Name("schemaPath"),params:new r.Name("params"),propertyName:new r.Name("propertyName"),message:new r.Name("message"),schema:new r.Name("schema"),parentSchema:new r.Name("parentSchema")};function c(e,t,n){const{createErrors:i}=e.it;return!1===i?r._`{}`:function(e,t,n={}){const{gen:i,it:s}=e,a=[u(s,n),p(e,n)];return function(e,{params:t,message:n},i){const{keyword:s,data:a,schemaValue:c,it:u}=e,{opts:p,propertyName:d,topSchemaRef:f,schemaPath:h}=u;i.push([l.keyword,s],[l.params,"function"==typeof t?t(e):t||r._`{}`]),p.messages&&i.push([l.message,"function"==typeof n?n(e):n]),p.verbose&&i.push([l.schema,c],[l.parentSchema,r._`${f}${h}`],[o.default.data,a]),d&&i.push([l.propertyName,d])}(e,t,a),i.object(...a)}(e,t,n)}function u({errorPath:e},{instancePath:t}){const n=t?r.str`${e}${(0,i.getErrorPath)(t,i.Type.Str)}`:e;return[o.default.instancePath,(0,r.strConcat)(o.default.instancePath,n)]}function p({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:o}){let s=o?t:r.str`${t}/${e}`;return n&&(s=r.str`${s}${(0,i.getErrorPath)(n,i.Type.Str)}`),[l.schemaPath,s]}},6066:function(e,t,n){"use strict";t.SchemaEnv=void 0,t.compileSchema=u,t.resolveRef=function(e,t,n){var r;const i=(0,s.resolveUrl)(this.opts.uriResolver,t,n),o=e.refs[i];if(o)return o;let a=h.call(this,e,i);if(void 0===a){const n=null===(r=e.localRefs)||void 0===r?void 0:r[i],{schemaId:o}=this.opts;n&&(a=new c({schema:n,schemaId:o,root:e,baseId:t}))}if(void 0===a&&this.opts.loadSchemaSync){const r=this.opts.loadSchemaSync(t,n,i);!r||this.refs[i]||this.schemas[i]||(this.addSchema(r,i,void 0),a=h.call(this,e,i))}return void 0!==a?e.refs[i]=p.call(this,a):void 0},t.resolveSchema=m;const r=n(9288),i=n(4273),o=n(6202),s=n(9630),a=n(2124),l=n(8597);class c{constructor(e){var t;let n;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,s.normalizeId)(null==n?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==n?void 0:n.$async,this.refs={}}}function u(e){const t=d.call(this,e);if(t)return t;const n=(0,s.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:c}=this.opts.code,{ownProperties:u}=this.opts,p=new r.CodeGen(this.scope,{es5:a,lines:c,ownProperties:u});let f;e.$async&&(f=p.scopeValue("Error",{ref:i.default,code:r._`require("ajv/dist/runtime/validation_error").default`}));const h=p.scopeName("validate");e.validateName=h;const m={gen:p,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[r.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:p.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,r.stringify)(e.schema)}:{ref:e.schema}),validateName:h,ValidationError:f,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:r.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:r._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,l.validateFunctionCode)(m),p.optimize(this.opts.code.optimize);const t=p.toString();g=`const visitedNodesForRef = new WeakMap(); ${p.scopeRefs(o.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,e));const n=new Function(`${o.default.self}`,`${o.default.scope}`,g)(this,this.scope.get());if(this.scope.value(h,{ref:n}),n.errors=null,n.schema=e.schema,n.schemaEnv=e,e.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:h,validateCode:t,scopeValues:p._values}),this.opts.unevaluated){const{props:e,items:t}=m;n.evaluated={props:e instanceof r.Name?void 0:e,items:t instanceof r.Name?void 0:t,dynamicProps:e instanceof r.Name,dynamicItems:t instanceof r.Name},n.source&&(n.source.evaluated=(0,r.stringify)(n.evaluated))}return e.validate=n,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error("Error compiling schema, function code:",g),t}finally{this._compilations.delete(e)}}function p(e){return(0,s.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function d(e){for(const t of this._compilations)if(f(t,e))return t}function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function h(e,t){let n;for(;"string"==typeof(n=this.refs[t]);)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){const n=this.opts.uriResolver.parse(t),r=(0,s._getFullPath)(this.opts.uriResolver,n);let i=(0,s.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===i)return y.call(this,n,e);const o=(0,s.normalizeId)(r),a=this.refs[o]||this.schemas[o];if("string"==typeof a){const t=m.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return y.call(this,n,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||u.call(this,a),o===(0,s.normalizeId)(t)){const{schema:t}=a,{schemaId:n}=this.opts,r=t[n];return r&&(i=(0,s.resolveUrl)(this.opts.uriResolver,i,r)),new c({schema:t,schemaId:n,root:e,baseId:i})}return y.call(this,n,a)}}t.SchemaEnv=c;const g=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function y(e,{baseId:t,schema:n,root:r}){var i;if("/"!==(null===(i=e.fragment)||void 0===i?void 0:i[0]))return;for(const r of e.fragment.slice(1).split("/")){if("boolean"==typeof n)return;const e=n[(0,a.unescapeFragment)(r)];if(void 0===e)return;const i="object"==typeof(n=e)&&n[this.opts.schemaId];!g.has(r)&&i&&(t=(0,s.resolveUrl)(this.opts.uriResolver,t,i))}let o;if("boolean"!=typeof n&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){const e=(0,s.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}const{schemaId:l}=this.opts;return o=o||new c({schema:n,schemaId:l,root:r,baseId:t}),o.schema!==o.root.schema?o:void 0}},6202:function(e,t,n){"use strict";const r=n(9288),i={data:new r.Name("data"),valCxt:new r.Name("valCxt"),instancePath:new r.Name("instancePath"),parentData:new r.Name("parentData"),parentDataProperty:new r.Name("parentDataProperty"),rootData:new r.Name("rootData"),dynamicAnchors:new r.Name("dynamicAnchors"),isAllOfVariant:new r.Name("isAllOfVariant"),vErrors:new r.Name("vErrors"),errors:new r.Name("errors"),this:new r.Name("this"),self:new r.Name("self"),scope:new r.Name("scope"),json:new r.Name("json"),jsonPos:new r.Name("jsonPos"),jsonLen:new r.Name("jsonLen"),jsonPart:new r.Name("jsonPart")};t.default=i},2830:function(e,t,n){"use strict";const r=n(9630);class i extends Error{constructor(e,t,n,i){super(i||`can't resolve reference ${n} from id ${t}`),this.missingRef=(0,r.resolveUrl)(e,t,n),this.missingSchema=(0,r.normalizeId)((0,r.getFullPath)(e,this.missingRef))}}t.default=i},9630:function(e,t,n){"use strict";t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!l(e):!!t&&c(e)<=t)},t.getFullPath=u,t._getFullPath=p,t.normalizeId=f,t.resolveUrl=function(e,t,n){return n=f(n),e.resolve(t,n)},t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:n,uriResolver:r}=this.opts,s=f(e[n]||t),a={"":s},l=u(r,s,!1),c={},p=new Set;return o(e,{allKeys:!0},(e,t,r,i)=>{if(void 0===i)return;const o=l+t;let s=a[i];function u(t){const n=this.opts.uriResolver.resolve;if(t=f(s?n(s,t):t),p.has(t))throw m(t);p.add(t);let r=this.refs[t];return"string"==typeof r&&(r=this.refs[r]),"object"==typeof r?d(e,r.schema,t):t!==f(o)&&("#"===t[0]?(d(e,c[t],t),c[t]=e):this.refs[t]=o),t}function g(e){if("string"==typeof e){if(!h.test(e))throw new Error(`invalid anchor "${e}"`);u.call(this,`#${e}`)}}"string"==typeof e[n]&&(s=u.call(this,e[n])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),a[t]=s}),c;function d(e,t,n){if(void 0!==t&&!i(e,t))throw m(n)}function m(e){return new Error(`reference "${e}" resolves to more than one schema`)}};const r=n(2124),i=n(2017),o=n(6212),s=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]),a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e){for(const t in e){if(a.has(t))return!0;const n=e[t];if(Array.isArray(n)&&n.some(l))return!0;if("object"==typeof n&&l(n))return!0}return!1}function c(e){let t=0;for(const n in e){if("$ref"===n)return 1/0;if(t++,!s.has(n)&&("object"==typeof e[n]&&(0,r.eachItem)(e[n],e=>t+=c(e)),t===1/0))return 1/0}return t}function u(e,t="",n){!1!==n&&(t=f(t));const r=e.parse(t);return p(e,r)}function p(e,t){return e.serialize(t).split("#")[0]+"#"}const d=/#\/?$/;function f(e){return e?e.replace(d,""):""}const h=/^[a-z_][-a-z0-9._]*$/i},9485:function(e,t){"use strict";t.isJSONType=function(e){return"string"==typeof e&&n.has(e)},t.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}};const n=new Set(["string","number","integer","boolean","null","object","array"])},2124:function(e,t,n){"use strict";t.Type=t.mergeEvaluated=void 0,t.toHash=function(e){const t={};for(const n of e)t[n]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(o(e,t),!function(e,t){if("boolean"==typeof e)return!e;for(const n in e)if(t[n])return!0;return!1}(t,e.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const n in e)if("$ref"!==n&&t.all[n])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},n,i,o){if(!o){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return r._`${n}`}return r._`${e}${t}${(0,r.getProperty)(i)}`},t.unescapeFragment=function(e){return a(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(s(e))},t.unescapeJsonPointer=a,t.eachItem=function(e,t){if(Array.isArray(e))for(const n of e)t(n);else t(e)},t.evaluatedPropsToName=c,t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:p[t.code]||(p[t.code]=new i._Code(t.code))})},t.getErrorPath=function(e,t,n){if(e instanceof r.Name){const i=t===d.Num;return n?i?r._`"[" + ${e} + "]"`:r._`"['" + ${e} + "']"`:i?r._`"/" + ${e}`:r._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,r.getProperty)(e).toString():"/"+s(e)},t.checkStrictMode=f;const r=n(9288),i=n(5659);function o(e,t=e.schema){const{opts:n,self:r}=e;if(!n.strictSchema)return;if("boolean"==typeof t)return;const i=r.RULES.keywords;for(const n in t)i[n]||f(e,`unknown keyword: "${n}"`)}function s(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function a(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function l({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:i}){return(o,s,a,l)=>{const c=void 0===a?s:a instanceof r.Name?(s instanceof r.Name?e(o,s,a):t(o,s,a),a):s instanceof r.Name?(t(o,a,s),s):n(s,a);return l!==r.Name||c instanceof r.Name?c:i(o,c)}}function c(e,t){if(!0===t)return e.var("props",!0);const n=e.var("props",r._`{}`);return void 0!==t&&u(e,n,t),n}function u(e,t,n){Object.keys(n).forEach(n=>e.assign(r._`${t}${(0,r.getProperty)(n)}`,!0))}t.mergeEvaluated={props:l({mergeNames:(e,t,n)=>e.if(r._`${n} !== true && ${t} !== undefined`,()=>{e.if(r._`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,r._`${n} || {}`).code(r._`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if(r._`${n} !== true`,()=>{!0===t?e.assign(n,!0):(e.assign(n,r._`${n} || {}`),u(e,n,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:c}),items:l({mergeNames:(e,t,n)=>e.if(r._`${n} !== true && ${t} !== undefined`,()=>e.assign(n,r._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if(r._`${n} !== true`,()=>e.assign(n,!0===t||r._`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};const p={};var d;function f(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,!0===n)throw new Error(t);e.self.logger.warn(t)}}!function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(d||(t.Type=d={}))},9160:function(e,t){"use strict";function n(e,t){return t.rules.some(t=>r(e,t))}function r(e,t){var n;return void 0!==e[t.keyword]||(null===(n=t.definition.implements)||void 0===n?void 0:n.some(t=>void 0!==e[t]))}t.schemaHasRulesForType=function({schema:e,self:t},r){const i=t.RULES.types[r];return i&&!0!==i&&n(e,i)},t.shouldUseGroup=n,t.shouldUseRule=r},8886:function(e,t,n){"use strict";t.topBoolOrEmptySchema=function(e){const{gen:t,schema:n,validateName:r}=e;!1===n?a(e,!1):"object"==typeof n&&!0===n.$async?t.return(o.default.data):(t.assign(i._`${r}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:n,schema:r}=e;!1===r?(n.var(t,!1),a(e)):n.var(t,!0)};const r=n(695),i=n(9288),o=n(6202),s={message:"boolean schema is false"};function a(e,t){const{gen:n,data:i}=e,o={gen:n,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,r.reportError)(o,s,void 0,t)}},6649:function(e,t,n){"use strict";t.DataType=void 0,t.getSchemaTypes=function(e){const t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){const{gen:n,data:r,opts:o}=e,a=function(e,t){return t?e.filter(e=>u.has(e)||"array"===t&&"array"===e):[]}(t,o.coerceTypes),c=t.length>0&&!(0===a.length&&1===t.length&&(0,i.schemaHasRulesForType)(e,t[0]));if(c){const i=d(t,r,o.strictNumbers,l.Wrong);n.if(i,()=>{a.length?function(e,t,n){const{gen:r,data:i,opts:o}=e,a=r.let("dataType",s._`typeof ${i}`),l=r.let("coerced",s._`undefined`);"array"===o.coerceTypes&&r.if(s._`${a} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>r.assign(i,s._`${i}[0]`).assign(a,s._`typeof ${i}`).if(d(t,i,o.strictNumbers),()=>r.assign(l,i))),r.if(s._`${l} !== undefined`);for(const e of n)(u.has(e)||"array"===e&&"array"===o.coerceTypes)&&c(e);function c(e){switch(e){case"string":return void r.elseIf(s._`${a} == "number" || ${a} == "boolean"`).assign(l,s._`"" + ${i}`).elseIf(s._`${i} === null`).assign(l,s._`""`);case"number":return void r.elseIf(s._`${a} == "boolean" || ${i} === null + || (${a} == "string" && ${i} && ${i} == +${i})`).assign(l,s._`+${i}`);case"integer":return void r.elseIf(s._`${a} === "boolean" || ${i} === null + || (${a} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(l,s._`+${i}`);case"boolean":return void r.elseIf(s._`${i} === "false" || ${i} === 0 || ${i} === null`).assign(l,!1).elseIf(s._`${i} === "true" || ${i} === 1`).assign(l,!0);case"null":return r.elseIf(s._`${i} === "" || ${i} === 0 || ${i} === false`),void r.assign(l,null);case"array":r.elseIf(s._`${a} === "string" || ${a} === "number" + || ${a} === "boolean" || ${i} === null`).assign(l,s._`[${i}]`)}}r.else(),h(e),r.endIf(),r.if(s._`${l} !== undefined`,()=>{r.assign(i,l),function({gen:e,parentData:t,parentDataProperty:n},r){e.if(s._`${t} !== undefined`,()=>e.assign(s._`${t}[${n}]`,r))}(e,l)})}(e,t,a):h(e)})}return c},t.checkDataType=p,t.checkDataTypes=d,t.reportTypeError=h;const r=n(9485),i=n(9160),o=n(695),s=n(9288),a=n(2124);var l;function c(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(r.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(l||(t.DataType=l={}));const u=new Set(["string","number","integer","boolean","null"]);function p(e,t,n,r=l.Correct){const i=r===l.Correct?s.operators.EQ:s.operators.NEQ;let o;switch(e){case"null":return s._`${t} ${i} null`;case"array":o=s._`Array.isArray(${t})`;break;case"object":o=s._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=a(s._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=a();break;default:return s._`typeof ${t} ${i} ${e}`}return r===l.Correct?o:(0,s.not)(o);function a(e=s.nil){return(0,s.and)(s._`typeof ${t} == "number"`,e,n?s._`isFinite(${t})`:s.nil)}}function d(e,t,n,r){if(1===e.length)return p(e[0],t,n,r);let i;const o=(0,a.toHash)(e);if(o.array&&o.object){const e=s._`typeof ${t} != "object"`;i=o.null?e:s._`!${t} || ${e}`,delete o.null,delete o.array,delete o.object}else i=s.nil;o.number&&delete o.integer;for(const e in o)i=(0,s.and)(i,p(e,t,n,r));return i}const f={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?s._`{type: ${e}}`:s._`{type: ${t}}`};function h(e){const t=function(e){const{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}(e);(0,o.reportError)(t,f)}},511:function(e,t,n){"use strict";t.assignDefaults=function(e,t){const{properties:n,items:r}=e.schema;if("object"===t&&n)for(const t in n)o(e,t,n[t].default);else"array"===t&&Array.isArray(r)&&r.forEach((t,n)=>o(e,n,t.default))};const r=n(9288),i=n(2124);function o(e,t,n){const{gen:o,compositeRule:s,data:a,opts:l}=e;if(void 0===n)return;const c=r._`${a}${(0,r.getProperty)(t)}`;if(s)return void(0,i.checkStrictMode)(e,`default is ignored for: ${c}`);let u=r._`${c} === undefined`;"empty"===l.useDefaults&&(u=r._`${u} || ${c} === null || ${c} === ""`),o.if(u,r._`${c} = ${(0,r.stringify)(n)}`)}},8597:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KeywordCxt=void 0,t.validateFunctionCode=function(e){b(e)&&(v(e),y(e))?function(e){const{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&w(e),function(e){const{schema:t,opts:n}=e;void 0!==t.default&&n.useDefaults&&n.strictSchema&&(0,f.checkStrictMode)(e,"default is ignored in the schema root")}(e),r.let(p.default.vErrors,null),r.let(p.default.errors,0),n.unevaluated&&function(e){const{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",u._`${n}.evaluated`),t.if(u._`${e.evaluated}.dynamicProps`,()=>t.assign(u._`${e.evaluated}.props`,u._`undefined`)),t.if(u._`${e.evaluated}.dynamicItems`,()=>t.assign(u._`${e.evaluated}.items`,u._`undefined`))}(e),x(e),function(e){const{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:o}=e;n.$async?t.if(u._`${p.default.errors} === 0`,()=>t.return(p.default.data),()=>t.throw(u._`new ${i}(${p.default.vErrors})`)):(t.assign(u._`${r}.errors`,p.default.vErrors),o.unevaluated&&function({gen:e,evaluated:t,props:n,items:r}){n instanceof u.Name&&e.assign(u._`${t}.props`,n),r instanceof u.Name&&e.assign(u._`${t}.items`,r)}(e),t.return(u._`${p.default.errors} === 0`))}(e)})}(e):m(e,()=>(0,r.topBoolOrEmptySchema)(e))},t.getData=C;const r=n(8886),i=n(6649),o=n(9160),s=n(6649),a=n(511),l=n(886),c=n(820),u=n(9288),p=n(6202),d=n(9630),f=n(2124),h=n(695);function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},o){i.code.es5?e.func(t,u._`${p.default.data}, ${p.default.valCxt}`,r.$async,()=>{e.code(u._`"use strict"; ${g(n,i)}`),function(e,t){e.if(p.default.valCxt,()=>{e.var(p.default.instancePath,u._`${p.default.valCxt}.${p.default.instancePath}`),e.var(p.default.parentData,u._`${p.default.valCxt}.${p.default.parentData}`),e.var(p.default.parentDataProperty,u._`${p.default.valCxt}.${p.default.parentDataProperty}`),e.var(p.default.rootData,u._`${p.default.valCxt}.${p.default.rootData}`),e.var(p.default.isAllOfVariant,u._`${p.default.valCxt}.${p.default.isAllOfVariant}`),t.dynamicRef&&e.var(p.default.dynamicAnchors,u._`${p.default.valCxt}.${p.default.dynamicAnchors}`)},()=>{e.var(p.default.instancePath,u._`""`),e.var(p.default.parentData,u._`undefined`),e.var(p.default.parentDataProperty,u._`undefined`),e.var(p.default.rootData,p.default.data),e.var(p.default.isAllOfVariant,u._`0`),t.dynamicRef&&e.var(p.default.dynamicAnchors,u._`{}`)})}(e,i),e.code(o)}):e.func(t,u._`${p.default.data}, ${function(e){return u._`{${p.default.instancePath}="", ${p.default.parentData}, ${p.default.parentDataProperty}, ${p.default.rootData}=${p.default.data}${e.dynamicRef?u._`, ${p.default.dynamicAnchors}={}`:u.nil}, ${p.default.isAllOfVariant} = 0}={}`}(i)}`,r.$async,()=>e.code(g(n,i)).code(o))}function g(e,t){const n="object"==typeof e&&e[t.schemaId];return n&&(t.code.source||t.code.process)?u._`/*# sourceURL=${n} */`:u.nil}function y({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const n in e)if(t.RULES.all[n])return!0;return!1}function b(e){return"boolean"!=typeof e.schema}function v(e){(0,f.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}(e)}function x(e,t){if(e.opts.jtd)return k(e,[],!1,t);const n=(0,i.getSchemaTypes)(e.schema);k(e,n,!(0,i.coerceAndCheckDataType)(e,n),t)}function w({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){const o=n.$comment;if(!0===i.$comment)e.code(u._`${p.default.self}.logger.log(${o})`);else if("function"==typeof i.$comment){const n=u.str`${r}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code(u._`${p.default.self}.opts.$comment(${o}, ${n}, ${i}.schema)`)}}function k(e,t,n,r){const{gen:i,schema:a,data:l,allErrors:c,opts:d,self:h}=e,{RULES:m}=h;function g(f){(0,o.shouldUseGroup)(a,f)&&(f.type?(i.if((0,s.checkDataType)(f.type,l,d.strictNumbers)),S(e,f),1===t.length&&t[0]===f.type&&n&&(i.else(),(0,s.reportTypeError)(e)),i.endIf()):S(e,f),c||i.if(u._`${p.default.errors} === ${r||0}`))}!a.$ref||!d.ignoreKeywordsWithRef&&(0,f.schemaHasRulesButRef)(a,m)?(d.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach(t=>{E(e.dataTypes,t)||O(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),e.dataTypes=e.dataTypes.filter(e=>E(t,e))):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&O(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const n=e.self.RULES.all;for(const r in n){const i=n[r];if("object"==typeof i&&(0,o.shouldUseRule)(e.schema,i)){const{type:n}=i.definition;n.length&&!n.some(e=>{return r=e,(n=t).includes(r)||"number"===r&&n.includes("integer");var n,r})&&O(e,`missing type "${n.join(",")}" for keyword "${r}"`)}}}(e,e.dataTypes))}(e,t),i.block(()=>{for(const e of m.rules)g(e);g(m.post)})):i.block(()=>P(e,"$ref",m.all.$ref.definition))}function S(e,t){const{gen:n,schema:r,opts:{useDefaults:i}}=e;function s(t,n){return!("unevaluatedProperties"!==n.keyword||!t.properties&&!t.patternProperties||e.isAllOfVariant||!1!==e.opts.defaultUnevaluatedProperties)}i&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(const n of t.rules)((0,o.shouldUseRule)(r,n)||s(r,n))&&P(e,n.keyword,n.definition,t.type)})}function E(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function O(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,f.checkStrictMode)(e,t,e.opts.strictTypes)}class _{constructor(e,t,n){if((0,l.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,f.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",C(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",p.default.errors))}result(e,t,n){this.failResult((0,u.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,u.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(u._`${t} !== undefined && (${(0,u.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t)return this.setParams(t),this._error(e,n),void this.setParams({});this._error(e,n)}_error(e,t){(e?h.reportExtraError:h.reportError)(this,this.def.error,t)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=u.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=u.nil,t=u.nil){if(!this.$data)return;const{gen:n,schemaCode:r,schemaType:i,def:o}=this;n.if((0,u.or)(u._`${r} === undefined`,t)),e!==u.nil&&n.assign(e,!0),(i.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==u.nil&&n.assign(e,!1)),n.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:n,def:r,it:i}=this;return(0,u.or)(function(){if(n.length){if(!(t instanceof u.Name))throw new Error("ajv implementation error");const e=Array.isArray(n)?n:[n];return u._`${(0,s.checkDataTypes)(e,t,i.opts.strictNumbers,s.DataType.Wrong)}`}return u.nil}(),function(){if(r.validateSchema){const n=e.scopeValue("validate$data",{ref:r.validateSchema});return u._`!${n}(${t})`}return u.nil}())}subschema(e,t,n){const i=(0,c.getSubschema)(this.it,e);(0,c.extendSubschemaData)(i,this.it,e),(0,c.extendSubschemaMode)(i,e);const o={...this.it,...i,items:void 0,props:void 0,isAllOfVariant:n};return function(e,t){b(e)&&(v(e),y(e))?function(e,t){const{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&w(e),function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,d.resolveUrl)(e.opts.uriResolver,e.baseId,t))}(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const o=r.const("_errs",p.default.errors);x(e,o),r.var(t,u._`${o} === ${p.default.errors}`)}(e,t):(0,r.boolOrEmptySchema)(e,t)}(o,t),o}mergeEvaluated(e,t){const{it:n,gen:r}=this;n.opts.unevaluated&&(!0!==n.props&&void 0!==e.props&&(n.props=f.mergeEvaluated.props(r,e.props,n.props,t)),!0!==n.items&&void 0!==e.items&&(n.items=f.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){const{it:n,gen:r}=this;if(n.opts.unevaluated&&(!0!==n.props||!0!==n.items))return r.if(t,()=>this.mergeEvaluated(e,u.Name)),!0}}function P(e,t,n,r){const i=new _(e,n,t);"code"in n?n.code(i,r):i.$data&&n.validate?(0,l.funcKeywordCode)(i,n):"macro"in n?(0,l.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,l.funcKeywordCode)(i,n)}t.KeywordCxt=_;const $=/^\/(?:[^~]|~0|~1)*$/,A=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function C(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,o;if(""===e)return p.default.rootData;if("/"===e[0]){if(!$.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,o=p.default.rootData}else{const s=A.exec(e);if(!s)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+s[1];if(i=s[2],"#"===i){if(a>=t)throw new Error(l("property/index",a));return r[t-a]}if(a>t)throw new Error(l("data",a));if(o=n[t-a],!i)return o}let s=o;const a=i.split("/");for(const e of a)e&&(o=u._`${o}${(0,u.getProperty)((0,f.unescapeJsonPointer)(e))}`,s=u._`${s} && ${o}`);return s;function l(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}},886:function(e,t,n){"use strict";t.macroKeywordCode=function(e,t){const{gen:n,keyword:i,schema:o,parentSchema:s,it:a}=e,c=t.macro.call(a.self,o,s,a),u=l(n,i,c);!1!==a.opts.validateSchema&&a.self.validateSchema(c,!0);const p=n.name("valid");e.subschema({schema:c,schemaPath:r.nil,errSchemaPath:`${a.errSchemaPath}/${i}`,topSchemaRef:u,compositeRule:!0},p),e.pass(p,()=>e.error(!0))},t.funcKeywordCode=function(e,t){var n;const{gen:c,keyword:u,schema:p,parentSchema:d,$data:f,it:h}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(h,t);const m=!f&&t.compile?t.compile.call(h.self,p,d,h):t.validate,g=l(c,u,m),y=c.let("valid");function b(n=(t.async?r._`await `:r.nil)){const s=h.opts.passContext?i.default.this:i.default.self,a=!("compile"in t&&!f||!1===t.schema);c.assign(y,r._`${n}${(0,o.callValidateCode)(e,g,s,a)}`,t.modifying)}function v(e){var n;c.if((0,r.not)(null!==(n=t.valid)&&void 0!==n?n:y),e)}e.block$data(y,function(){if(!1===t.errors)b(),t.modifying&&a(e),v(()=>e.error());else{const n=t.async?function(){const e=c.let("ruleErrs",null);return c.try(()=>b(r._`await `),t=>c.assign(y,!1).if(r._`${t} instanceof ${h.ValidationError}`,()=>c.assign(e,r._`${t}.errors`),()=>c.throw(t))),e}():function(){const e=r._`${g}.errors`;return c.assign(e,null),b(r.nil),e}();t.modifying&&a(e),v(()=>function(e,t){const{gen:n}=e;n.if(r._`Array.isArray(${t})`,()=>{n.assign(i.default.vErrors,r._`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`).assign(i.default.errors,r._`${i.default.vErrors}.length`),(0,s.extendErrors)(e)},()=>e.error())}(e,n))}}),e.ok(null!==(n=t.valid)&&void 0!==n?n:y)},t.validSchemaType=function(e,t,n=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||n&&void 0===e)},t.validateKeywordUsage=function({schema:e,opts:t,self:n,errSchemaPath:r},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");const s=i.dependencies;if(null==s?void 0:s.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[o])){const e=`keyword "${o}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);n.logger.error(e)}};const r=n(9288),i=n(6202),o=n(4608),s=n(695);function a(e){const{gen:t,data:n,it:i}=e;t.if(i.parentData,()=>t.assign(n,r._`${i.parentData}[${i.parentDataProperty}]`))}function l(e,t,n){if(void 0===n)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,r.stringify)(n)})}},820:function(e,t,n){"use strict";t.getSubschema=function(e,{keyword:t,schemaProp:n,schema:o,schemaPath:s,errSchemaPath:a,topSchemaRef:l}){if(void 0!==t&&void 0!==o)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const o=e.schema[t];return void 0===n?{schema:o,schemaPath:r._`${e.schemaPath}${(0,r.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:o[n],schemaPath:r._`${e.schemaPath}${(0,r.getProperty)(t)}${(0,r.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,i.escapeFragment)(n)}`}}if(void 0!==o){if(void 0===s||void 0===a||void 0===l)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:s,topSchemaRef:l,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:n,dataPropType:o,data:s,dataTypes:a,propertyName:l}){if(void 0!==s&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(void 0!==n){const{errorPath:s,dataPathArr:a,opts:l}=t;u(c.let("data",r._`${t.data}${(0,r.getProperty)(n)}`,!0)),e.errorPath=r.str`${s}${(0,i.getErrorPath)(n,o,l.jsPropertySyntax)}`,e.parentDataProperty=r._`${n}`,e.dataPathArr=[...a,e.parentDataProperty]}function u(n){e.data=n,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,n]}void 0!==s&&(u(s instanceof r.Name?s:c.let("data",s,!0)),void 0!==l&&(e.propertyName=l)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:o}){void 0!==r&&(e.compositeRule=r),void 0!==i&&(e.createErrors=i),void 0!==o&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=n};const r=n(9288),i=n(2124)},2785:function(e,t,n){"use strict";n(8597),n(9288);const r=n(4273),i=n(2830),o=n(9485),s=n(6066),a=n(9288),l=n(9630),c=n(6649),u=n(2124),p=n(8884),d=n(5689),f=(e,t)=>new RegExp(e,t);f.code="new RegExp";const h=["removeAdditional","useDefaults","coerceTypes","defaultUnevaluatedProperties","defaultAdditionalProperties"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function b(e){var t,n,r,i,o,s,a,l,c,u,p,h,m,g,y,b,v,x,w,k,S,E,O,_,P;const $=e.strict,A=null===(t=e.code)||void 0===t?void 0:t.optimize,C=!0===A||void 0===A?1:A||0,j=null!==(r=null===(n=e.code)||void 0===n?void 0:n.regExp)&&void 0!==r?r:f,T=null!==(i=e.uriResolver)&&void 0!==i?i:d.default;return{strictSchema:null===(s=null!==(o=e.strictSchema)&&void 0!==o?o:$)||void 0===s||s,strictNumbers:null===(l=null!==(a=e.strictNumbers)&&void 0!==a?a:$)||void 0===l||l,strictTypes:null!==(u=null!==(c=e.strictTypes)&&void 0!==c?c:$)&&void 0!==u?u:"log",strictTuples:null!==(h=null!==(p=e.strictTuples)&&void 0!==p?p:$)&&void 0!==h?h:"log",strictRequired:null!==(g=null!==(m=e.strictRequired)&&void 0!==m?m:$)&&void 0!==g&&g,code:e.code?{...e.code,optimize:C,regExp:j}:{optimize:C,regExp:j},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:200,loopEnum:null!==(b=e.loopEnum)&&void 0!==b?b:200,meta:null===(v=e.meta)||void 0===v||v,messages:null===(x=e.messages)||void 0===x||x,inlineRefs:null===(w=e.inlineRefs)||void 0===w||w,schemaId:null!==(k=e.schemaId)&&void 0!==k?k:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(E=e.validateSchema)||void 0===E||E,validateFormats:null===(O=e.validateFormats)||void 0===O||O,unicodeRegExp:null===(_=e.unicodeRegExp)||void 0===_||_,int32range:null===(P=e.int32range)||void 0===P||P,uriResolver:T}}class v{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...b(e)};const{es5:t,lines:n}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:m,es5:t,lines:n}),this.logger=function(e){if(!1===e)return _;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),x.call(this,g,e,"NOT SUPPORTED"),x.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=O.call(this),e.formats&&S.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),k.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:n}=this.opts;let r=p;"id"===n&&(r={...p},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let n;if("string"==typeof e){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);const r=n(t);return"$async"in n||(this.errors=n.errors),r}compile(e,t){const n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await o.call(this,e.$schema);const n=this._addSchema(e,t);return n.validate||s.call(this,n)}async function o(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function s(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return a.call(this,t),await l.call(this,t.missingSchema),s.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){const n=await c.call(this,e);this.refs[e]||await o.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function c(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,n,r);return this}let i;if("object"==typeof e){const{schemaId:t}=this.opts;if(i=e[t],void 0!==i&&"string"!=typeof i)throw new Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let n;if(n=e.$schema,void 0!==n&&"string"!=typeof n)throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const r=this.validate(n,e);if(!r&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return r}getSchema(e){let t;for(;"string"==typeof(t=w.call(this,e));)e=t;if(void 0===t){const{schemaId:n}=this.opts,r=new s.SchemaEnv({schema:{},schemaId:n});if(t=s.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=w.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,l.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if("string"==typeof e)n=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(n=(t=e).keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if($.call(this,n,t),!t)return(0,u.eachItem)(n,e=>A.call(this,e)),this;j.call(this,t);const r={...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(n,0===r.type.length?e=>A.call(this,e,r):e=>r.type.forEach(t=>A.call(this,e,r,t))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const n of t.rules){const t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:n="data"}={}){return e&&0!==e.length?e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n):"No errors"}$dataMetaSchema(e,t){const n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const r of t){const t=r.split("/").slice(1);let i=e;for(const e of t)i=i[e];for(const e in n){const t=n[e];if("object"!=typeof t)continue;const{$data:r}=t.definition,o=i[e];r&&o&&(i[e]=N(o))}}return e}_removeAllSchemas(e,t){for(const n in e){const r=e[n];t&&!t.test(n)||("string"==typeof r?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let o;const{schemaId:a}=this.opts;if("object"==typeof e)o=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(void 0!==c)return c;n=(0,l.normalizeId)(o||n);const u=l.getSchemaRefs.call(this,e,n);return c=new s.SchemaEnv({schema:e,schemaId:a,meta:t,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),r&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):s.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,e)}finally{this.opts=t}}}function x(e,t,n,r="error"){for(const i in e){const o=i;o in t&&this.logger[r](`${n}: option ${i}. ${e[o]}`)}}function w(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function k(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function S(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const n=e[t];n.keyword||(n.keyword=t),this.addKeyword(n)}}}function O(){const e={...this.opts};for(const t of h)delete e[t];return e}v.ValidationError=r.default,v.MissingRefError=i.default,t.default=v;const _={log(){},warn(){},error(){}},P=/^[a-z_$][a-z0-9_$:-]*$/i;function $(e,t){const{RULES:n}=this;if((0,u.eachItem)(e,e=>{if(n.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!P.test(e))throw new Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function A(e,t,n){var r;const i=null==t?void 0:t.post;if(n&&i)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:o}=this;let s=i?o.post:o.rules.find(({type:e})=>e===n);if(s||(s={type:n,rules:[]},o.rules.push(s)),o.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)}};t.before?C.call(this,s,a,t.before):s.rules.push(a),o.all[e]=a,null===(r=t.implements)||void 0===r||r.forEach(e=>this.addKeyword(e))}function C(e,t,n){const r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function j(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=N(t)),e.validateSchema=this.compile(t,!0))}const T={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function N(e){return{anyOf:[e,T]}}},2791:function(e,t,n){"use strict";t.default=function(e){return[r,i,o,s,a,t(this,l),c,t(this,u)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function t(t,n){return e?t.$dataMetaSchema(n,p):n}};const r=n(7207),i=n(3243),o=n(8818),s=n(6211),a=n(3953),l=n(6573),c=n(5386),u=n(9509),p=["/properties"]},8947:function(e,t,n){"use strict";const r=n(2017);r.code='require("ajv/dist/runtime/equal").default',t.default=r},9794:function(e,t){"use strict";function n(e){const t=e.length;let n,r=0,i=0;for(;i=55296&&n<=56319&&ir.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:r}=t;Array.isArray(r)?s(e,r):(0,i.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function s(e,t){const{gen:n,schema:o,data:s,keyword:a,it:l}=e;l.items=!0;const c=n.const("len",r._`${s}.length`);if(!1===o)e.setParams({len:t.length}),e.pass(r._`${c} <= ${t.length}`);else if("object"==typeof o&&!(0,i.alwaysValidSchema)(l,o)){const o=n.var("valid",r._`${c} <= ${t.length}`);n.if((0,r.not)(o),()=>function(o){n.forRange("i",t.length,c,t=>{e.subschema({keyword:a,dataProp:t,dataPropType:i.Type.Num},o),l.allErrors||n.if((0,r.not)(o),()=>n.break())})}(o)),e.ok(o)}}t.default=o},3003:function(e,t,n){"use strict";const r=n(4608),i=n(9288),o=n(6202),s=n(2124),a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>i._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,parentSchema:n,data:a,errsCount:l,it:c}=e,{schema:u=c.opts.defaultAdditionalProperties}=e;if(!l)throw new Error("ajv implementation error");const{allErrors:p,opts:d}=c;if(c.props=!0,"all"!==d.removeAdditional&&(0,s.alwaysValidSchema)(c,u))return;const f=(0,r.allSchemaProperties)(n.properties),h=(0,r.allSchemaProperties)(n.patternProperties);function m(e){t.code(i._`delete ${a}[${e}]`)}function g(n){if("all"===d.removeAdditional||d.removeAdditional&&!1===u)m(n);else{if(!1===u)return e.setParams({additionalProperty:n}),e.error(),void(p||t.break());if("object"==typeof u&&!(0,s.alwaysValidSchema)(c,u)){const r=t.name("valid");"failing"===d.removeAdditional?(y(n,r,!1),t.if((0,i.not)(r),()=>{e.reset(),m(n)})):(y(n,r),p||t.if((0,i.not)(r),()=>t.break()))}}}function y(t,n,r){const i={keyword:"additionalProperties",dataProp:t,dataPropType:s.Type.Str};!1===r&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,n)}t.forIn("key",a,o=>{f.length||h.length?t.if(function(o){let a;if(f.length>8){const e=(0,s.schemaRefOrVal)(c,n.properties,"properties");a=(0,r.isOwnProperty)(t,e,o)}else a=f.length?(0,i.or)(...f.map(e=>i._`${o} === ${e}`)):i.nil;return h.length&&(a=(0,i.or)(a,...h.map(t=>i._`${(0,r.usePattern)(e,t)}.test(${o})`))),(0,i.not)(a)}(o),()=>g(o)):g(o)}),e.ok(i._`${l} === ${o.default.errors}`)}};t.default=a},5049:function(e,t,n){"use strict";const r=n(2124),i={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:i}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const o=t.name("valid");n.forEach((t,n)=>{if((0,r.alwaysValidSchema)(i,t))return;const s=e.subschema({keyword:"allOf",schemaProp:n},o,!0);e.ok(o),e.mergeEvaluated(s)})}};t.default=i},7856:function(e,t,n){"use strict";const r={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:n(4608).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=r},3842:function(e,t,n){"use strict";const r=n(9288),i=n(2124),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?r.str`must contain at least ${e} valid item(s)`:r.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?r._`{minContains: ${e}}`:r._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:o,data:s,it:a}=e;let l,c;const{minContains:u,maxContains:p}=o;a.opts.next?(l=void 0===u?1:u,c=p):l=1;const d=t.const("len",r._`${s}.length`);if(e.setParams({min:l,max:c}),void 0===c&&0===l)return void(0,i.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==c&&l>c)return(0,i.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,i.alwaysValidSchema)(a,n)){let t=r._`${d} >= ${l}`;return void 0!==c&&(t=r._`${t} && ${d} <= ${c}`),void e.pass(t)}a.items=!0;const f=t.name("valid");function h(){const e=t.name("_valid"),n=t.let("count",0);m(e,()=>t.if(e,()=>function(e){t.code(r._`${e}++`),void 0===c?t.if(r._`${e} >= ${l}`,()=>t.assign(f,!0).break()):(t.if(r._`${e} > ${c}`,()=>t.assign(f,!1).break()),1===l?t.assign(f,!0):t.if(r._`${e} >= ${l}`,()=>t.assign(f,!0)))}(n)))}function m(n,r){t.forRange("i",0,d,t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:i.Type.Num,compositeRule:!0},n),r()})}void 0===c&&1===l?m(f,()=>t.if(f,()=>t.break())):0===l?(t.let(f,!0),void 0!==c&&t.if(r._`${s}.length > 0`,h)):(t.let(f,!1),h()),e.result(f,()=>e.reset())}};t.default=o},7630:function(e,t,n){"use strict";t.error=void 0,t.validatePropertyDeps=a,t.validateSchemaDeps=l;const r=n(9288),i=n(2124),o=n(4608);t.error={message:({params:{property:e,depsCount:t,deps:n}})=>{const i=1===t?"property":"properties";return r.str`must have ${i} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:i}})=>r._`{property: ${e}, + missingProperty: ${i}, + depsCount: ${t}, + deps: ${n}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,n]=function({schema:e}){const t={},n={};for(const r in e)"__proto__"!==r&&((Array.isArray(e[r])?t:n)[r]=e[r]);return[t,n]}(e);a(e,t),l(e,n)}};function a(e,t=e.schema){const{gen:n,data:i,it:s}=e;if(0===Object.keys(t).length)return;const a=n.let("missing");for(const l in t){const c=t[l];if(0===c.length)continue;const u=(0,o.propertyInData)(n,i,l,s.opts.ownProperties);e.setParams({property:l,depsCount:c.length,deps:c.join(", ")}),s.allErrors?n.if(u,()=>{for(const t of c)(0,o.checkReportMissingProp)(e,t)}):(n.if(r._`${u} && (${(0,o.checkMissingProp)(e,c,a)})`),(0,o.reportMissingProp)(e,a),n.else())}}function l(e,t=e.schema){const{gen:n,data:r,keyword:s,it:a}=e,l=n.name("valid");for(const c in t)(0,i.alwaysValidSchema)(a,t[c])||(n.if((0,o.propertyInData)(n,r,c,a.opts.ownProperties),()=>{const t=e.subschema({keyword:s,schemaProp:c},l);e.mergeValidEvaluated(t,l)},()=>n.var(l,!0)),e.ok(l))}t.default=s},7894:function(e,t,n){"use strict";const r=n(7630),i={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,r.validateSchemaDeps)(e)};t.default=i},6908:function(e,t,n){"use strict";const r=n(9288),i=n(2124),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>r.str`must match "${e.ifClause}" schema`,params:({params:e})=>r._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:o}=e;void 0===n.then&&void 0===n.else&&(0,i.checkStrictMode)(o,'"if" without "then" and "else" is ignored');const a=s(o,"then"),l=s(o,"else");if(!a&&!l)return;const c=t.let("valid",!0),u=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}(),e.reset(),a&&l){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(u,p("then",n),p("else",n))}else a?t.if(u,p("then")):t.if((0,r.not)(u),p("else"));function p(n,i){return()=>{const o=e.subschema({keyword:n},u);t.assign(c,u),e.mergeValidEvaluated(o,c),i?t.assign(i,r._`${n}`):e.setParams({ifClause:n})}}e.pass(c,()=>e.error(!0))}};function s(e,t){const n=e.schema[t];return void 0!==n&&!(0,i.alwaysValidSchema)(e,n)}t.default=o},8499:function(e,t,n){"use strict";t.default=function(e=!1){const t=[f.default,h.default,m.default,g.default,y.default,b.default,c.default,u.default,l.default,p.default,d.default];return e?t.push(i.default,s.default):t.push(r.default,o.default),t.push(a.default),t};const r=n(2276),i=n(3183),o=n(1931),s=n(203),a=n(3842),l=n(7630),c=n(7968),u=n(3003),p=n(5494),d=n(7932),f=n(2346),h=n(7856),m=n(9814),g=n(5049),y=n(6908),b=n(2009)},1931:function(e,t,n){"use strict";t.validateTuple=a;const r=n(9288),i=n(2124),o=n(4608),s={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return a(e,"additionalItems",t);n.items=!0,(0,i.alwaysValidSchema)(n,t)||e.ok((0,o.validateArray)(e))}};function a(e,t,n=e.schema){const{gen:o,parentSchema:s,data:a,keyword:l,it:c}=e;!function(e){const{opts:r,errSchemaPath:o}=c,s=n.length,a=s===e.minItems&&(s===e.maxItems||!1===e[t]);if(r.strictTuples&&!a){const e=`"${l}" is ${s}-tuple, but minItems or maxItems/${t} are not specified or different at path "${o}"`;(0,i.checkStrictMode)(c,e,r.strictTuples)}}(s),c.opts.unevaluated&&n.length&&!0!==c.items&&(c.items=i.mergeEvaluated.items(o,n.length,c.items));const u=o.name("valid"),p=o.const("len",r._`${a}.length`);n.forEach((t,n)=>{(0,i.alwaysValidSchema)(c,t)||(o.if(r._`${p} > ${n}`,()=>e.subschema({keyword:l,schemaProp:n,dataProp:n},u)),e.ok(u))})}t.default=s},203:function(e,t,n){"use strict";const r=n(9288),i=n(2124),o=n(4608),s=n(2276),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:r}=e,{prefixItems:a}=n;r.items=!0,(0,i.alwaysValidSchema)(r,t)||(a?(0,s.validateAdditionalItems)(e,a):e.ok((0,o.validateArray)(e)))}};t.default=a},2346:function(e,t,n){"use strict";const r=n(2124),i={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:i}=e;if((0,r.alwaysValidSchema)(i,n))return void e.fail();const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};t.default=i},9814:function(e,t,n){"use strict";const r=n(9288),i=n(2124),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>r._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:n,parentSchema:o,it:s}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(s.opts.discriminator&&o.discriminator)return;const a=n,l=t.let("valid",!1),c=t.let("passing",null),u=t.name("_valid");e.setParams({passing:c}),t.block(function(){a.forEach((n,o)=>{let a;(0,i.alwaysValidSchema)(s,n)?t.var(u,!0):a=e.subschema({keyword:"oneOf",schemaProp:o,compositeRule:!0},u),o>0&&t.if(r._`${u} && ${l}`).assign(l,!1).assign(c,r._`[${c}, ${o}]`).else(),t.if(u,()=>{t.assign(l,!0),t.assign(c,o),a&&e.mergeEvaluated(a,r.Name)})})}),e.result(l,()=>e.reset(),()=>e.error(!0))}};t.default=o},7932:function(e,t,n){"use strict";const r=n(4608),i=n(9288),o=n(2124),s=n(2124),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:a,parentSchema:l,it:c}=e,{opts:u}=c,p=(0,r.allSchemaProperties)(n),d=p.filter(e=>(0,o.alwaysValidSchema)(c,n[e]));if(0===p.length||d.length===p.length&&(!c.opts.unevaluated||!0===c.props))return;const f=u.strictSchema&&!u.allowMatchingProperties&&l.properties,h=t.name("valid");!0===c.props||c.props instanceof i.Name||(c.props=(0,s.evaluatedPropsToName)(t,c.props));const{props:m}=c;function g(e){for(const t in f)new RegExp(e).test(t)&&(0,o.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(n){t.forIn("key",a,o=>{t.if(i._`${(0,r.usePattern)(e,n)}.test(${o})`,()=>{const r=d.includes(n);r||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:o,dataPropType:s.Type.Str},h),c.opts.unevaluated&&!0!==m?t.assign(i._`${m}[${o}]`,!0):r||c.allErrors||t.if((0,i.not)(h),()=>t.break())})})}!function(){for(const e of p)f&&g(e),c.allErrors?y(e):(t.var(h,!0),y(e),t.if(h))}()}};t.default=a},3183:function(e,t,n){"use strict";const r=n(1931),i={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,r.validateTuple)(e,"items")};t.default=i},5494:function(e,t,n){"use strict";const r=n(8597),i=n(4608),o=n(2124),s=n(3003),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:a,data:l,it:c}=e;("all"===c.opts.removeAdditional&&void 0===a.additionalProperties||!1===c.opts.defaultAdditionalProperties)&&s.default.code(new r.KeywordCxt(c,s.default,"additionalProperties"));const u=(0,i.allSchemaProperties)(n);for(const e of u)c.definedProperties.add(e);c.opts.unevaluated&&u.length&&!0!==c.props&&(c.props=o.mergeEvaluated.props(t,(0,o.toHash)(u),c.props));const p=u.filter(e=>!(0,o.alwaysValidSchema)(c,n[e]));if(0===p.length)return;const d=t.name("valid");for(const n of p)f(n)?h(n):(t.if((0,i.propertyInData)(t,l,n,c.opts.ownProperties)),h(n),c.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(n),e.ok(d);function f(e){return c.opts.useDefaults&&!c.compositeRule&&void 0!==n[e].default}function h(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},d)}}};t.default=a},7968:function(e,t,n){"use strict";const r=n(9288),i=n(2124),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>r._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:o,it:s}=e;if((0,i.alwaysValidSchema)(s,n))return;const a=t.name("valid");t.forIn("key",o,n=>{e.setParams({propertyName:n}),e.subschema({keyword:"propertyNames",data:n,dataTypes:["string"],propertyName:n,compositeRule:!0},a),t.if((0,r.not)(a),()=>{e.error(!0),s.allErrors||t.break()})}),e.ok(a)}};t.default=o},2009:function(e,t,n){"use strict";const r=n(2124),i={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){void 0===t.if&&(0,r.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};t.default=i},4608:function(e,t,n){"use strict";t.checkReportMissingProp=function(e,t){const{gen:n,data:i,it:o}=e;n.if(l(n,i,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:r._`${t}`},!0),e.error()})},t.checkMissingProp=function({gen:e,data:t,it:{opts:n}},i,o){return(0,r.or)(...i.map(i=>(0,r.and)(l(e,t,i,n.ownProperties),r._`${o} = ${i}`)))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.isOwnProperty=a,t.propertyInData=function(e,t,n,i){const o=r._`${t}${(0,r.getProperty)(n)} !== undefined`;return i?r._`${o} && ${a(e,t,n)}`:o},t.noPropertyInData=l,t.allSchemaProperties=function(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:n,topSchemaRef:i,schemaPath:s,errorPath:a},it:l},c,u,p){const d=p?r._`${e}, ${t}, ${i}${s}`:t,f=[[o.default.instancePath,(0,r.strConcat)(o.default.instancePath,a)],[o.default.parentData,l.parentData],[o.default.parentDataProperty,l.parentDataProperty],[o.default.rootData,o.default.rootData],[o.default.isAllOfVariant,l.isAllOfVariant?1:0]];l.opts.dynamicRef&&f.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);const h=r._`${d}, ${n.object(...f)}`;return u!==r.nil?r._`${c}.call(${u}, ${h})`:r._`${c}(${h})`},t.usePattern=function({gen:e,it:{opts:t}},n){const i=t.unicodeRegExp?"u":"",{regExp:o}=t.code,a=o(n,i);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:r._`${"new RegExp"===o.code?c:(0,s.useFunc)(e,o)}(${n}, ${i})`})},t.validateArray=function(e){const{gen:t,data:n,keyword:o,it:s}=e,a=t.name("valid");if(s.allErrors){const e=t.let("valid",!0);return l(()=>t.assign(e,!1)),e}return t.var(a,!0),l(()=>t.break()),a;function l(s){const l=t.const("len",r._`${n}.length`);t.forRange("i",0,l,n=>{e.subschema({keyword:o,dataProp:n,dataPropType:i.Type.Num},a),t.if((0,r.not)(a),s)})}},t.validateUnion=function(e){const{gen:t,schema:n,keyword:o,parentSchema:s,it:a}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(a.opts.discriminator&&s.discriminator)return;if(n.some(e=>(0,i.alwaysValidSchema)(a,e))&&!a.opts.unevaluated)return;const l=t.let("valid",!1),c=t.name("_valid");t.block(()=>n.forEach((n,i)=>{const s=e.subschema({keyword:o,schemaProp:i,compositeRule:!0},c);t.assign(l,r._`${l} || ${c}`),e.mergeValidEvaluated(s,c)||t.if((0,r.not)(l))})),e.result(l,()=>e.reset(),()=>e.error(!0))};const r=n(9288),i=n(2124),o=n(6202),s=n(2124);function a(e,t,n){return r._`${function(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:r._`Object.prototype.hasOwnProperty`})}(e)}.call(${t}, ${n})`}function l(e,t,n,i){const o=r._`${t}${(0,r.getProperty)(n)} === undefined`;return i?(0,r.or)(o,(0,r.not)(a(e,t,n))):o}const c=r._`new RegExp`},7820:function(e,t){"use strict";const n={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=n},2777:function(e,t,n){"use strict";const r=n(7820),i=n(4768),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,i.default];t.default=o},4768:function(e,t,n){"use strict";t.getValidate=u,t.callRef=p;const r=n(2830),i=n(4608),o=n(9288),s=n(6202),a=n(6066),l=n(2124),c={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:i}=e,{baseId:s,schemaEnv:l,validateName:c,opts:d,self:f}=i,{root:h}=l;if(("#"===n||"#/"===n)&&s===h.baseId)return function(){if(l===h)return p(e,c,l,l.$async);const n=t.scopeValue("root",{ref:h});return p(e,o._`${n}.validate`,h,h.$async)}();const m=a.resolveRef.call(f,h,s,n);if(void 0===m)throw new r.default(i.opts.uriResolver,s,n);return m instanceof a.SchemaEnv?function(t){const n=u(e,t);p(e,n,t,t.$async)}(m):function(r){const s=t.scopeValue("schema",!0===d.code.source?{ref:r,code:(0,o.stringify)(r)}:{ref:r}),a=t.name("valid"),l=e.subschema({schema:r,dataTypes:[],schemaPath:o.nil,topSchemaRef:s,errSchemaPath:n},a,i.isAllOfVariant);e.mergeEvaluated(l),e.ok(a)}(m)}};function u(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):o._`${n.scopeValue("wrapper",{ref:t})}.validate`}function p(e,t,n,r){const{gen:a,it:c}=e,{allErrors:u,schemaEnv:p,opts:d}=c,f=d.passContext?s.default.this:o.nil;function h(e){const t=o._`${e}.errors`;a.assign(s.default.vErrors,o._`${s.default.vErrors} === null ? ${t} : ${s.default.vErrors}.concat(${t})`),a.assign(s.default.errors,o._`${s.default.vErrors}.length`)}function m(e){var t;if(!c.opts.unevaluated)return;const r=null===(t=null==n?void 0:n.validate)||void 0===t?void 0:t.evaluated;if(!0!==c.props)if(r&&!r.dynamicProps)void 0!==r.props&&(c.props=l.mergeEvaluated.props(a,r.props,c.props));else{const t=a.var("props",o._`${e}.evaluated.props`);c.props=l.mergeEvaluated.props(a,t,c.props,o.Name)}if(!0!==c.items)if(r&&!r.dynamicItems)void 0!==r.items&&(c.items=l.mergeEvaluated.items(a,r.items,c.items));else{const t=a.var("items",o._`${e}.evaluated.items`);c.items=l.mergeEvaluated.items(a,t,c.items,o.Name)}}r?function(){if(!p.$async)throw new Error("async schema referenced by sync schema");const n=a.let("valid");a.try(()=>{a.code(o._`await ${(0,i.callValidateCode)(e,t,f)}`),m(t),u||a.assign(n,!0)},e=>{a.if(o._`!(${e} instanceof ${c.ValidationError})`,()=>a.throw(e)),h(e),u||a.assign(n,!1)}),e.ok(n)}():function(){const n=a.name("visitedNodes");a.code(o._`const ${n} = (typeof visitedNodesForRef !== 'undefined') && visitedNodesForRef.get(${t}) || new Set()`),a.if(o._`!${n}.has(${e.data})`,()=>{a.code(o._`if (typeof visitedNodesForRef !== 'undefined') visitedNodesForRef.set(${t}, ${n})`),a.code(o._`const dataNode = ${e.data}`),a.code(o._`if (typeof dataNode === "object" && dataNode !== null) ${n}.add(dataNode)`);const r=e.result((0,i.callValidateCode)(e,t,f),()=>m(t),()=>h(t));return a.code(o._`${n}.delete(dataNode)`),r})}()}t.default=c},1498:function(e,t,n){"use strict";const r=n(9288),i=n(6375),o=n(6066),s=n(2124),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===i.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf or anyOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>r._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:a,parentSchema:l,it:c}=e,u=l.oneOf?"oneOf":l.anyOf?"anyOf":void 0;if(!c.opts.discriminator)throw new Error("discriminator: requires discriminator option");const p=a.propertyName;if("string"!=typeof p)throw new Error("discriminator: requires propertyName");if(!u)throw new Error("discriminator: requires oneOf or anyOf composite keyword");const d=l[u],f=t.let("valid",!1),h=t.const("tag",r._`${n}${(0,r.getProperty)(p)}`);function m(n){const i=t.name("valid"),o=e.subschema({keyword:u,schemaProp:n},i);return e.mergeEvaluated(o,r.Name),i}t.if(r._`typeof ${h} == "string"`,()=>function(){const n=function(){var e;const t={},n=i(l);let r=!0;for(let t=0;te[t]===l.$ref);if(n.length){for(const e of n)h(e,t);continue}}m&&!(0,s.schemaHasRulesButRef)(l,c.self.RULES)&&(l=o.resolveRef.call(c.self,c.schemaEnv.root,c.baseId,m),l instanceof o.SchemaEnv&&(l=l.schema));const g=null===(e=null==l?void 0:l.properties)||void 0===e?void 0:e[p];if("object"!=typeof g)throw new Error(`discriminator: ${u} subschemas (or referenced schemas) must have "properties/${p}" or match mapping`);r=r&&(n||i(l)),f(g,t)}if(!r)throw new Error(`discriminator: "${p}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(p)}function f(e,t){if(e.const)h(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${p}" must have "const" or "enum"`);for(const n of e.enum)h(n,t)}}function h(e,n){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${p}" values must be unique strings`);t[e]=n}}();t.if(!1);for(const e in n)t.elseIf(r._`${h} === ${e}`),t.assign(f,m(n[e]));t.else(),e.error(!1,{discrError:i.DiscrError.Mapping,tag:h,tagName:p}),t.endIf()}(),()=>e.error(!1,{discrError:i.DiscrError.Tag,tag:h,tagName:p})),e.ok(f)}};t.default=a},6375:function(e,t){"use strict";var n;t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(n||(t.DiscrError=n={}))},7582:function(e,t,n){"use strict";const r=n(2777),i=n(1309),o=n(8499),s=n(2135),a=n(8720),l=n(1774),c=n(3949),u=n(344),p=[s.default,r.default,i.default,(0,o.default)(!0),c.default,u.metadataVocabulary,u.contentVocabulary,a.default,l.default];t.default=p},2883:function(e,t,n){"use strict";t.dynamicAnchor=l;const r=n(9288),i=n(6202),o=n(6066),s=n(4768),a={keyword:"$dynamicAnchor",schemaType:"string",code:e=>l(e,e.schema)};function l(e,t){const{gen:n,it:a}=e;a.schemaEnv.root.dynamicAnchors[t]=!0;const l=r._`${i.default.dynamicAnchors}${(0,r.getProperty)(t)}`,c="#"===a.errSchemaPath?a.validateName:function(e){const{schemaEnv:t,schema:n,self:r}=e.it,{root:i,baseId:a,localRefs:l,meta:c}=t.root,{schemaId:u}=r.opts,p=new o.SchemaEnv({schema:n,schemaId:u,root:i,baseId:a,localRefs:l,meta:c});return o.compileSchema.call(r,p),(0,s.getValidate)(e,p)}(e);n.if(r._`!${l}`,()=>n.assign(l,c))}t.default=a},9909:function(e,t,n){"use strict";t.dynamicRef=a;const r=n(9288),i=n(6202),o=n(4768),s={keyword:"$dynamicRef",schemaType:"string",code:e=>a(e,e.schema)};function a(e,t){const{gen:n,keyword:s,it:a}=e;if("#"!==t[0])throw new Error(`"${s}" only supports hash fragment reference`);const l=t.slice(1);if(a.allErrors)c();else{const t=n.let("valid",!1);c(t),e.ok(t)}function c(e){if(a.schemaEnv.root.dynamicAnchors[l]){const t=n.let("_v",r._`${i.default.dynamicAnchors}${(0,r.getProperty)(l)}`);n.if(t,u(t,e),u(a.validateName,e))}else u(a.validateName,e)()}function u(t,r){return r?()=>n.block(()=>{(0,o.callRef)(e,t),n.let(r,!0)}):()=>(0,o.callRef)(e,t)}}t.default=s},2135:function(e,t,n){"use strict";const r=n(2883),i=n(9909),o=n(7370),s=n(8582),a=[r.default,i.default,o.default,s.default];t.default=a},7370:function(e,t,n){"use strict";const r=n(2883),i=n(2124),o={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,r.dynamicAnchor)(e,""):(0,i.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};t.default=o},8582:function(e,t,n){"use strict";const r=n(9909),i={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,r.dynamicRef)(e,e.schema)};t.default=i},5302:function(e,t,n){"use strict";const r=n(9288),i={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>r.str`must match format "${e}"`,params:({schemaCode:e})=>r._`{format: ${e}}`},code(e,t){const{gen:n,data:i,$data:o,schema:s,schemaCode:a,it:l}=e,{opts:c,errSchemaPath:u,schemaEnv:p,self:d}=l;c.validateFormats&&(o?function(){const o=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),s=n.const("fDef",r._`${o}[${a}]`),l=n.let("fType"),u=n.let("format");n.if(r._`typeof ${s} == "object" && !(${s} instanceof RegExp)`,()=>n.assign(l,r._`${s}.type || "string"`).assign(u,r._`${s}.validate`),()=>n.assign(l,r._`"string"`).assign(u,s)),e.fail$data((0,r.or)(!1===c.strictSchema?r.nil:r._`${a} && !${u}`,function(){const e=p.$async?r._`(${s}.async ? await ${u}(${i}) : ${u}(${i}))`:r._`${u}(${i})`,n=r._`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return r._`${u} && ${u} !== true && ${l} === ${t} && !${n}`}()))}():function(){const o=d.formats[s];if(!o)return void function(){if(!1!==c.strictSchema)throw new Error(e());function e(){return`unknown format "${s}" ignored in schema at path "${u}"`}d.logger.warn(e())}();if(!0===o)return;const[a,l,f]=function(e){const t=e instanceof RegExp?(0,r.regexpCode)(e):c.code.formats?r._`${c.code.formats}${(0,r.getProperty)(s)}`:void 0,i=n.scopeValue("formats",{key:s,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,i]:[e.type||"string",e.validate,r._`${i}.validate`]}(o);a===t&&e.pass(function(){if("object"==typeof o&&!(o instanceof RegExp)&&o.async){if(!p.$async)throw new Error("async format in sync schema");return r._`await ${f}(${i})`}return"function"==typeof l?r._`${f}(${i})`:r._`${f}.test(${i})`}())}())}};t.default=i},3949:function(e,t,n){"use strict";const r=[n(5302).default];t.default=r},344:function(e,t){"use strict";t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},8720:function(e,t,n){"use strict";const r=n(140),i=n(7894),o=n(4391),s=[r.default,i.default,o.default];t.default=s},1774:function(e,t,n){"use strict";const r=n(5899),i=n(5396),o=[r.default,i.default];t.default=o},5396:function(e,t,n){"use strict";const r=n(9288),i=n(2124),o={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{gen:t,schema:n,data:o,it:s}=e,a=s.items||0;if(!0===a)return;const l=t.const("len",r._`${o}.length`);if(!1===n)e.setParams({len:a}),e.fail(r._`${l} > ${a}`);else if("object"==typeof n&&!(0,i.alwaysValidSchema)(s,n)){const n=t.var("valid",r._`${l} <= ${a}`);t.if((0,r.not)(n),()=>function(n,o){t.forRange("i",o,l,o=>{e.subschema({keyword:"unevaluatedItems",dataProp:o,dataPropType:i.Type.Num},n),s.allErrors||t.if((0,r.not)(n),()=>t.break())})}(n,a)),e.ok(n)}s.items=!0}};t.default=o},5899:function(e,t,n){"use strict";const r=n(9288),i=n(2124),o=n(6202),s={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>r._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){const{gen:t,schema:n=e.it.opts.defaultUnevaluatedProperties,data:s,errsCount:a,it:l}=e,c=void 0===e.schema&&!1===e.it.opts.defaultUnevaluatedProperties;if(!a)throw new Error("ajv implementation error");const{allErrors:u,props:p}=l;if(p instanceof r.Name)t.if(r._`${p} !== true`,()=>t.forIn("key",s,e=>t.if(function(e,t){return r._`!${e} || !${e}[${t}]`}(p,e),()=>d(e))));else if(!0!==p){const e=()=>t.forIn("key",s,e=>void 0===p?d(e):t.if(function(e,t){const n=[];for(const i in e)!0===e[i]&&n.push(r._`${t} !== ${i}`);return(0,r.and)(...n)}(p,e),()=>d(e)));c&&l.errorPath.emptyStr()?t.if(r._`${o.default.isAllOfVariant} === 0`,e):e()}function d(o){if(!1===n)return e.setParams({unevaluatedProperty:o}),e.error(),void(u||t.break());if(!(0,i.alwaysValidSchema)(l,n)){const n=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:o,dataPropType:i.Type.Str},n),u||t.if((0,r.not)(n),()=>t.break())}}c||(l.props=!0),e.ok(r._`${a} === ${o.default.errors}`)}};t.default=s},7422:function(e,t,n){"use strict";const r=n(9288),i=n(2124),o=n(8947),s={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>r._`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:s,schemaCode:a,schema:l}=e;s||l&&"object"==typeof l?e.fail$data(r._`!${(0,i.useFunc)(t,o.default)}(${n}, ${a})`):e.fail(r._`${l} !== ${n}`)}};t.default=s},140:function(e,t,n){"use strict";const r=n(7630),i={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:e=>(0,r.validatePropertyDeps)(e)};t.default=i},2468:function(e,t,n){"use strict";const r=n(9288),i=n(2124),o=n(8947),s={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>r._`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:s,schema:a,schemaCode:l,it:c}=e;if(!s&&0===a.length)throw new Error("enum must have non-empty array");const u=a.length>=c.opts.loopEnum;let p;const d=()=>null!=p?p:p=(0,i.useFunc)(t,o.default);let f;if(u||s)f=t.let("valid"),e.block$data(f,function(){t.assign(f,!1),t.forOf("v",l,e=>t.if(r._`${d()}(${n}, ${e})`,()=>t.assign(f,!0).break()))});else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",l);f=(0,r.or)(...a.map((t,i)=>function(e,t){const i=a[t];return"object"==typeof i&&null!==i?r._`${d()}(${n}, ${e}[${t}])`:r._`${n} === ${i}`}(e,i)))}e.pass(f)}};t.default=s},1309:function(e,t,n){"use strict";const r=n(799),i=n(744),o=n(7214),s=n(5411),a=n(4211),l=n(8412),c=n(9612),u=n(8176),p=n(7422),d=n(2468),f=[r.default,i.default,o.default,s.default,a.default,l.default,c.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},p.default,d.default];t.default=f},4391:function(e,t,n){"use strict";const r=n(2124),i={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){void 0===t.contains&&(0,r.checkStrictMode)(n,`"${e}" without "contains" is ignored`)}};t.default=i},9612:function(e,t,n){"use strict";const r=n(9288),i={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxItems"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:i}=e,o="maxItems"===t?r.operators.GT:r.operators.LT;e.fail$data(r._`${n}.length ${o} ${i}`)}};t.default=i},7214:function(e,t,n){"use strict";const r=n(9288),i=n(2124),o=n(9794),s={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxLength"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:s,it:a}=e,l="maxLength"===t?r.operators.GT:r.operators.LT,c=!1===a.opts.unicode?r._`${n}.length`:r._`${(0,i.useFunc)(e.gen,o.default)}(${n})`;e.fail$data(r._`${c} ${l} ${s}`)}};t.default=s},799:function(e,t,n){"use strict";const r=n(9288),i=r.operators,o={maximum:{okStr:"<=",ok:i.LTE,fail:i.GT},minimum:{okStr:">=",ok:i.GTE,fail:i.LT},exclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},exclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}},s={message:({keyword:e,schemaCode:t})=>r.str`must be ${o[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>r._`{comparison: ${o[e].okStr}, limit: ${t}}`},a={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:s,code(e){const{keyword:t,data:n,schemaCode:i}=e;e.fail$data(r._`${n} ${o[t].fail} ${i} || isNaN(${n})`)}};t.default=a},4211:function(e,t,n){"use strict";const r=n(9288),i={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxProperties"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:i}=e,o="maxProperties"===t?r.operators.GT:r.operators.LT;e.fail$data(r._`Object.keys(${n}).length ${o} ${i}`)}};t.default=i},744:function(e,t,n){"use strict";const r=n(9288),i={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>r.str`must be multiple of ${e}`,params:({schemaCode:e})=>r._`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:i,it:o}=e,s=o.opts.multipleOfPrecision,a=t.let("res"),l=s?r._`Math.abs(Math.round(${a}) - ${a}) > 1e-${s}`:r._`${a} !== parseInt(${a})`;e.fail$data(r._`(${i} === 0 || (${a} = ${n}/${i}, ${l}))`)}};t.default=i},5411:function(e,t,n){"use strict";const r=n(4608),i=n(9288),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>i.str`must match pattern "${e}"`,params:({schemaCode:e})=>i._`{pattern: ${e}}`},code(e){const{data:t,$data:n,schema:o,schemaCode:s,it:a}=e,l=a.opts.unicodeRegExp?"u":"",c=n?i._`(new RegExp(${s}, ${l}))`:(0,r.usePattern)(e,o);e.fail$data(i._`!${c}.test(${t})`)}};t.default=o},8412:function(e,t,n){"use strict";const r=n(4608),i=n(9288),o=n(2124),s={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>i.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>i._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:n,schemaCode:s,data:a,$data:l,it:c}=e,{opts:u}=c;if(!l&&0===n.length)return;const p=n.length>=u.loopRequired;if(c.allErrors?function(){if(p||l)e.block$data(i.nil,d);else for(const t of n)(0,r.checkReportMissingProp)(e,t)}():function(){const o=t.let("missing");if(p||l){const n=t.let("valid",!0);e.block$data(n,()=>function(n,o){e.setParams({missingProperty:n}),t.forOf(n,s,()=>{t.assign(o,(0,r.propertyInData)(t,a,n,u.ownProperties)),t.if((0,i.not)(o),()=>{e.error(),t.break()})},i.nil)}(o,n)),e.ok(n)}else t.if((0,r.checkMissingProp)(e,n,o)),(0,r.reportMissingProp)(e,o),t.else()}(),u.strictRequired){const t=e.parentSchema.properties,{definedProperties:r}=e.it;for(const e of n)if(void 0===(null==t?void 0:t[e])&&!r.has(e)){const t=`required property "${e}" is not defined at "${c.schemaEnv.baseId+c.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(c,t,c.opts.strictRequired)}}function d(){t.forOf("prop",s,n=>{e.setParams({missingProperty:n}),t.if((0,r.noPropertyInData)(t,a,n,u.ownProperties),()=>e.error())})}}};t.default=s},8176:function(e,t,n){"use strict";const r=n(6649),i=n(9288),o=n(2124),s=n(8947),a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>i.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>i._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:n,$data:a,schema:l,parentSchema:c,schemaCode:u,it:p}=e;if(!a&&!l)return;const d=t.let("valid"),f=c.items?(0,r.getSchemaTypes)(c.items):[];function h(o,s){const a=t.name("item"),l=(0,r.checkDataTypes)(f,a,p.opts.strictNumbers,r.DataType.Wrong),c=t.const("indices",i._`{}`);t.for(i._`;${o}--;`,()=>{t.let(a,i._`${n}[${o}]`),t.if(l,i._`continue`),f.length>1&&t.if(i._`typeof ${a} == "string"`,i._`${a} += "_"`),t.if(i._`typeof ${c}[${a}] == "number"`,()=>{t.assign(s,i._`${c}[${a}]`),e.error(),t.assign(d,!1).break()}).code(i._`${c}[${a}] = ${o}`)})}function m(r,a){const l=(0,o.useFunc)(t,s.default),c=t.name("outer");t.label(c).for(i._`;${r}--;`,()=>t.for(i._`${a} = ${r}; ${a}--;`,()=>t.if(i._`${l}(${n}[${r}], ${n}[${a}])`,()=>{e.error(),t.assign(d,!1).break(c)})))}e.block$data(d,function(){const r=t.let("i",i._`${n}.length`),o=t.let("j");e.setParams({i:r,j:o}),t.assign(d,!0),t.if(i._`${r} > 1`,()=>(f.length>0&&!f.some(e=>"object"===e||"array"===e)?h:m)(r,o))},i._`${u} === false`),e.ok(d)}};t.default=a},6212:function(e){"use strict";var t=e.exports=function(e,t,r){"function"==typeof t&&(r=t,t={}),n(t,"function"==typeof(r=t.cb||r)?r:r.pre||function(){},r.post||function(){},e,"",e)};function n(e,i,o,s,a,l,c,u,p,d){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var f in i(s,a,l,c,u,p,d),s){var h=s[f];if(Array.isArray(h)){if(f in t.arrayKeywords)for(var m=0;mt in e).map(t=>[t,e[t]]))}function D(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e)))}const M={type:"object",properties:{hide:{type:"boolean"}},additionalProperties:!1},z={type:"object",properties:{src:{type:"string"},async:{type:"boolean"},crossorigin:{type:"string"},defer:{type:"boolean"},fetchpriority:{type:"string"},integrity:{type:"string"},module:{type:"boolean"},nomodule:{type:"boolean"},nonce:{type:"string"},referrerpolicy:{type:"string"},type:{type:"string"}},required:["src"],additionalProperties:!0},F={type:"object",properties:{page:{type:"string"},directory:{type:"string"},disconnect:{type:"boolean",default:!1},group:{type:"string"},label:{type:"string"},href:{type:"string"},external:{type:"boolean"},labelTranslationKey:{type:"string"},groupTranslationKey:{type:"string"},icon:{oneOf:[{type:"string"},{type:"object",properties:{srcSet:{type:"string"}},required:["srcSet"]}]},separator:{type:"string"},separatorLine:{type:"boolean"},linePosition:{type:"string",enum:["top","bottom"],default:"top"},version:{type:"string"},menuStyle:{type:"string",enum:["drilldown"]},expanded:{type:"string",const:"always"},selectFirstItemOnExpand:{type:"boolean"},flatten:{type:"boolean"},linkedSidebars:{type:"array",items:{type:"string"}},items:{type:"array",items:{type:"object",additionalProperties:!0}}}},U={type:"array",items:Object.assign(Object.assign({},F),{properties:Object.assign(Object.assign({},F.properties),{items:{type:"array",items:F}})})},q={type:"object",properties:Object.assign({facets:{type:"array",items:{type:"object",required:["name","field","type"],properties:{name:{type:"string"},field:{type:"string"},type:{type:"string",enum:["multi-select","select","tags"]}},additionalProperties:!1}}},M.properties),additionalProperties:!1},B={type:"object",properties:{image:{type:"string"},srcSet:{type:"string"},altText:{type:"string"},link:{type:"string"},favicon:{type:"string"}},additionalProperties:!1},V={type:"object",properties:Object.assign({items:U},M.properties),additionalProperties:!1},W={type:"object",additionalProperties:{type:"object",properties:{name:{type:"string"},icon:{type:"string"},folder:{type:"string"}},additionalProperties:!1,required:["name","folder"]}},H={type:"object",properties:Object.assign({items:U,copyrightText:{type:"string"},logo:M},M.properties),additionalProperties:!1},Y={type:"object",properties:Object.assign({separatorLine:{type:"boolean"},linePosition:{type:"string",enum:["top","bottom"],default:"bottom"}},M.properties),additionalProperties:!1},G={type:"object",properties:{head:{type:"array",items:z},body:{type:"array",items:z}},additionalProperties:!1},K={type:"array",items:{type:"object",properties:{href:{type:"string"},as:{type:"string"},crossorigin:{type:"string"},fetchpriority:{type:"string"},hreflang:{type:"string"},imagesizes:{type:"string"},imagesrcset:{type:"string"},integrity:{type:"string"},media:{type:"string"},prefetch:{type:"string"},referrerpolicy:{type:"string"},rel:{type:"string"},sizes:{type:"string"},title:{type:"string"},type:{type:"string"}},required:["href"],additionalProperties:!0}},Q={type:"object",properties:Object.assign({engine:{type:"string",enum:["flexsearch","typesense"],default:"flexsearch"},ai:{type:"object",properties:{hide:{type:"boolean",default:!1},suggestions:{default:[],type:"array",items:{type:"string"}},prompt:{type:"string"}},additionalProperties:!1},filters:q,placement:{type:"string",default:"navbar"},shortcuts:{type:"array",items:{type:"string"},default:["/"]},suggestedPages:{type:"array",items:{type:"object",properties:{page:{type:"string"},label:{type:"string"},labelTranslationKey:{type:"string"}},required:["page"]}}},M.properties),additionalProperties:!1},X={type:"object",properties:Object.assign({ignoreDetection:{type:"boolean"},modes:{type:"array",items:{type:"string"},default:["light","dark"]}},M.properties),additionalProperties:!1},J={type:"object",properties:{nextButton:{type:"object",properties:Object.assign({text:{type:"string",default:"Next page"}},M.properties),additionalProperties:!1,default:{}},previousButton:{type:"object",properties:Object.assign({text:{type:"string",default:"Previous page"}},M.properties),additionalProperties:!1,default:{}}},additionalProperties:!1},Z={type:"object",properties:{elementFormat:{type:"string",default:"icon"},copy:{type:"object",properties:Object.assign({},M.properties),additionalProperties:!1,default:{hide:!1}},report:{type:"object",properties:Object.assign({tooltipText:{type:"string"},buttonText:{type:"string"},label:{type:"string"}},M.properties),additionalProperties:!1,default:{hide:!1}},expand:{type:"object",properties:Object.assign({},M.properties),additionalProperties:!1,default:{hide:!1}},collapse:{type:"object",properties:Object.assign({},M.properties),additionalProperties:!1,default:{hide:!1}}},additionalProperties:!1},ee={type:"object",properties:{frontMatterKeysToResolve:{type:"array",items:{type:"string"},default:["image","links"]},partialsFolders:{type:"array",items:{type:"string"},default:["_partials"]},lastUpdatedBlock:{type:"object",properties:Object.assign({format:{type:"string",enum:["timeago","iso","long","short"],default:"timeago"},locale:{type:"string"}},M.properties),additionalProperties:!1,default:{}},toc:{type:"object",properties:Object.assign({header:{type:"string",default:"On this page"},depth:{type:"integer",default:3,minimum:1}},M.properties),additionalProperties:!1,default:{}},editPage:{type:"object",properties:Object.assign({baseUrl:{type:"string"}},M.properties),additionalProperties:!1,default:{}}},additionalProperties:!1,default:{}},te=Object.assign(Object.assign({},c),{properties:Object.assign(Object.assign({},c.properties),R.properties)}),ne={type:"object",properties:{includeInDevelopment:{type:"boolean"},trackingId:{type:"string"},conversionId:{type:"string"},floodlightId:{type:"string"},optimizeId:{type:"string"},exclude:{type:"array",items:{type:"string"}}},additionalProperties:!1,required:["trackingId"]},re={type:"object",properties:{adobe:{type:"object",properties:{includeInDevelopment:{type:"boolean"},scriptUrl:{type:"string"},pageViewEventName:{type:"string"}},additionalProperties:!1,required:["scriptUrl"]},amplitude:{type:"object",properties:{includeInDevelopment:{type:"boolean"},apiKey:{type:"string"},head:{type:"boolean"},respectDNT:{type:"boolean"},exclude:{type:"array",items:{type:"string"}},outboundClickEventName:{type:"string"},pageViewEventName:{type:"string"},amplitudeConfig:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["apiKey"]},fullstory:{type:"object",properties:{includeInDevelopment:{type:"boolean"},orgId:{type:"string"}},additionalProperties:!1,required:["orgId"]},heap:{type:"object",properties:{includeInDevelopment:{type:"boolean"},appId:{type:"string"}},additionalProperties:!1,required:["appId"]},rudderstack:{type:"object",properties:{includeInDevelopment:{type:"boolean"},writeKey:{type:"string",minLength:10},trackPage:{type:"boolean"},dataPlaneUrl:{type:"string"},controlPlaneUrl:{type:"string"},sdkUrl:{type:"string"},loadOptions:{type:"object",additionalProperties:!0}},additionalProperties:!1,required:["writeKey"]},segment:{type:"object",properties:{includeInDevelopment:{type:"boolean"},writeKey:{type:"string",minLength:10},trackPage:{type:"boolean"},includeTitleInPageCall:{type:"boolean"},host:{type:"string"}},additionalProperties:!1,required:["writeKey"]},gtm:{type:"object",properties:{includeInDevelopment:{type:"boolean"},trackingId:{type:"string"},gtmAuth:{type:"string"},gtmPreview:{type:"string"},defaultDataLayer:{},dataLayerName:{type:"string"},enableWebVitalsTracking:{type:"boolean"},selfHostedOrigin:{type:"string"},pageViewEventName:{type:"string"}},additionalProperties:!1,required:["trackingId"]},ga:{type:"object",properties:{includeInDevelopment:{type:"boolean"},trackingId:{type:"string"},conversionId:{type:"string"},floodlightId:{type:"string"},head:{type:"boolean"},respectDNT:{type:"boolean"},exclude:{type:"array",items:{type:"string"}},optimizeId:{type:"string"},anonymizeIp:{type:"boolean"},cookieExpires:{type:"number"},trackers:{type:"object",additionalProperties:ne}},additionalProperties:!1,required:["trackingId"]}}},ie={type:"object",properties:Object.assign({items:{type:"array",items:{type:"object",properties:{label:{type:"string"},external:{type:"boolean"},link:{type:"string"},separatorLine:{type:"boolean"}},additionalProperties:!0},default:[]},hideLoginButton:{type:"boolean"}},M.properties),additionalProperties:!1},oe={type:"object",properties:{hide:{type:"boolean"},showForUnversioned:{type:"boolean"}}},se={type:"object",properties:{hide:{type:"boolean"},prefixItems:{type:"array",items:{type:"object",properties:{label:{type:"string"},labelTranslationKey:{type:"string"},page:{type:"string"}},additionalProperties:!1,default:{}}}},additionalProperties:!1},ae={type:"object",patternProperties:{".*":{type:"object",additionalProperties:!0,required:["slug","items"],properties:{slug:{type:"string"},filters:{type:"array",items:{type:"object",additionalProperties:!1,required:["title","property"],properties:{type:{type:"string",enum:["select","checkboxes","date-range"],default:"checkboxes"},title:{type:"string"},titleTranslationKey:{type:"string"},property:{type:"string"},parentFilter:{type:"string"},valuesMapping:{type:"object",additionalProperties:{type:"string"}},missingCategoryName:{type:"string"},missingCategoryNameTranslationKey:{type:"string"},options:{type:"array",items:{type:"string"}}}}},groupByFirstFilter:{type:"boolean"},filterValuesCasing:{type:"string",enum:["sentence","original","lowercase","uppercase"]},items:U,requiredPermission:{type:"string"},separateVersions:{type:"boolean"},title:{type:"string"},titleTranslationKey:{type:"string"},description:{type:"string"},descriptionTranslationKey:{type:"string"}}}}},le={type:"object",additionalProperties:!0,required:[],properties:{ignoreNonCompliant:{type:"boolean",default:!1},teamMetadataProperty:{type:"object",properties:{property:{type:"string"},label:{type:"string"},default:{type:"string"}}},levels:{type:"array",items:{type:"object",required:["name"],properties:{name:{type:"string"},color:{type:"string"},extends:{type:"array",items:{type:"string"}},rules:{type:"object",additionalProperties:{oneOf:[{type:"string"},{type:"object"}]}}},additionalProperties:!1}},targets:{type:"array",items:{type:"object",required:["where"],properties:{minimumLevel:{type:"string"},rules:{type:"object",additionalProperties:!0},where:{type:"object",required:["metadata"],properties:{metadata:{type:"object",additionalProperties:{type:"string"}}},additionalProperties:!1}},additionalProperties:!1}},ignore:{type:"array",items:{type:"string"}}}},ce={type:"object",properties:{imports:{type:"array",items:{type:"string"}},logo:B,navbar:V,products:W,footer:H,sidebar:Y,scripts:G,links:K,feedback:o,search:Q,colorMode:X,navigation:J,codeSnippet:Z,markdown:ee,openapi:te,graphql:l,analytics:re,userMenu:ie,versionPicker:oe,breadcrumbs:se,catalog:ae,scorecard:le},additionalProperties:!0};var ue,pe,de;Object.assign(Object.assign({},ce),{additionalProperties:!1}),function(e){e.OIDC="OIDC",e.SAML2="SAML2"}(ue||(ue={})),function(e){e.SERVICE_ACCOUNT="SERVICE_ACCOUNT",e.OAUTH2="OAUTH2"}(pe||(pe={})),function(e){e.STACKED="stacked",e.THREE_PANEL="three-panel"}(de||(de={}));const fe={type:"string",enum:["error","warn","off"]},he={type:"object",properties:{ignoreLint:{oneOf:[{type:"boolean",default:!1},{type:"object",additionalProperties:{type:"boolean"}}]},ignoreLinkChecker:{type:"boolean"},ignoreMarkdocErrors:{type:"boolean"},jobs:{type:"array",items:{type:"object",properties:{path:{type:"string",pattern:"^(?!\\.\\./)(/[a-zA-Z0-9_\\-\\./]+|./[a-zA-Z0-9_\\-\\./]+|[a-zA-Z0-9_\\-\\./]+)$"},agent:{type:"string",enum:["respect"]},trigger:{type:"object",additionalProperties:!1,properties:{event:{type:"string",enum:["schedule"]},interval:{type:"string",pattern:"^[1-9]\\d*[mhdw]$"}},required:["event"]},inputs:{type:"object",additionalProperties:{type:"string"}},servers:{type:"object",additionalProperties:!1,patternProperties:{"^[a-zA-Z0-9_-]+$":{type:"string",pattern:"^https?://[^\\s/$.?#].[^\\s]*$"}}},severity:{type:"object",additionalProperties:!1,properties:{schemaCheck:fe,statusCodeCheck:fe,contentTypeCheck:fe,successCriteriaCheck:fe}}},required:["path","trigger","agent"],additionalProperties:!1}}},additionalProperties:!1},me={type:"object",additionalProperties:{oneOf:[{type:"object",properties:{type:{type:"string",const:ue.OIDC},title:{type:"string"},pkce:{type:"boolean",default:!1},configurationUrl:{type:"string",minLength:1},configuration:{type:"object",properties:{end_session_endpoint:{type:"string"},token_endpoint:{type:"string"},authorization_endpoint:{type:"string"},jwks_uri:{type:"string"}},required:["token_endpoint","authorization_endpoint"],additionalProperties:!0},clientId:{type:"string",minLength:1},clientSecret:{type:"string",minLength:0},teamsClaimName:{type:"string"},teamsClaimMap:{type:"object",additionalProperties:{type:"string"}},defaultTeams:{type:"array",items:{type:"string"}},scopes:{type:"array",items:{type:"string"}},tokenExpirationTime:{type:"number"},authorizationRequestCustomParams:{type:"object",additionalProperties:{type:"string"}},tokenRequestCustomParams:{type:"object",additionalProperties:{type:"string"}},audience:{type:"array",items:{type:"string"}}},required:["type","clientId"],oneOf:[{required:["configurationUrl"]},{required:["configuration"]}],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:ue.SAML2},title:{type:"string"},issuerId:{type:"string"},entityId:{type:"string"},ssoUrl:{type:"string"},x509PublicCert:{type:"string"},teamsAttributeName:{type:"string",default:"https://redocly.com/sso/teams"},teamsAttributeMap:{type:"object",additionalProperties:{type:"string"}},defaultTeams:{type:"array",items:{type:"string"}}},additionalProperties:!1,required:["type","issuerId","ssoUrl","x509PublicCert"]}],discriminator:{propertyName:"type"}}},ge={type:"object",additionalProperties:{oneOf:[{type:"string"},{type:"object"}]}},ye={type:"object",properties:{root:{type:"string"},output:{type:"string",pattern:"(.ya?ml|.json)$"},rbac:{type:"object",additionalProperties:!0},openapi:te,graphql:l,theme:{type:"object",properties:{openapi:te,graphql:l},additionalProperties:!1},title:{type:"string"},metadata:{type:"object",additionalProperties:!0},rules:ge,decorators:{type:"object",additionalProperties:!0},preprocessors:{type:"object",additionalProperties:!0}},required:["root"]},be={type:"object",additionalProperties:{type:"string"}},ve={type:"object",properties:{teamNamePatterns:{type:"array",items:{type:"string"}},teamFolders:{type:"array",items:{type:"string"}},teamFoldersBaseRoles:be,cms:be,reunite:be,features:{type:"object",properties:{aiSearch:be},additionalProperties:!1},content:{type:"object",properties:{"**":be},additionalProperties:be}},additionalProperties:be},xe={type:"object",properties:{type:{type:"string",const:"APIGEE_X"},apiUrl:{type:"string"},stage:{type:"string",default:"non-production"},organizationName:{type:"string"},ignoreApiProducts:{type:"array",items:{type:"string"}},allowApiProductsOutsideCatalog:{type:"boolean",default:!1},auth:{type:"object",oneOf:[{type:"object",properties:{type:{type:"string",const:pe.OAUTH2},tokenEndpoint:{type:"string"},clientId:{type:"string"},clientSecret:{type:"string"}},additionalProperties:!1,required:["type","tokenEndpoint","clientId","clientSecret"]},{type:"object",properties:{type:{type:"string",const:pe.SERVICE_ACCOUNT},serviceAccountEmail:{type:"string"},serviceAccountPrivateKey:{type:"string"}},additionalProperties:!1,required:["type","serviceAccountEmail","serviceAccountPrivateKey"]}],discriminator:{propertyName:"type"}}},additionalProperties:!1,required:["type","organizationName","auth"]},we={type:"object",properties:{defaultLocale:{type:"string"},locales:{type:"array",items:{type:"object",properties:{code:{type:"string"},name:{type:"string"}},required:["code"]}}},additionalProperties:!1,required:["defaultLocale"]},ke={type:"object",properties:{imports:{type:"array",items:{type:"string"}},licenseKey:{type:"string"},redirects:{type:"object",additionalProperties:{type:"object",properties:{to:{type:"string"},type:{type:"number",default:301}},additionalProperties:!1},default:{}},seo:{type:"object",properties:{title:{type:"string"},description:{type:"string"},siteUrl:{type:"string"},image:{type:"string"},keywords:{oneOf:[{type:"array",items:{type:"string"}},{type:"string"}]},lang:{type:"string"},jsonLd:{type:"object"},meta:{type:"array",items:{type:"object",properties:{name:{type:"string"},content:{type:"string"}},required:["name","content"],additionalProperties:!1}}},additionalProperties:!1},rbac:ve,apiFunctions:{type:"object",properties:{folders:{type:"array",items:{type:"string"}}},additionalProperties:!1},requiresLogin:{type:"boolean"},responseHeaders:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},value:{type:"string"}},additionalProperties:!1,required:["name","value"]}}},mockServer:{type:"object",properties:{off:{type:"boolean",default:!1},position:{type:"string",enum:["first","last","replace","off"],default:"first"},strictExamples:{type:"boolean",default:!1},errorIfForcedExampleNotFound:{type:"boolean",default:!1},description:{type:"string"}}},apis:{type:"object",additionalProperties:ye},rules:ge,decorators:{type:"object",additionalProperties:!0},preprocessors:{type:"object",additionalProperties:!0},ssoDirect:me,sso:{oneOf:[{type:"array",items:{type:"string",enum:["REDOCLY","CORPORATE","GUEST"]},uniqueItems:!0},{type:"string",enum:["REDOCLY","CORPORATE","GUEST"]}]},residency:{type:"string"},developerOnboarding:{type:"object",required:["adapters"],additionalProperties:!1,properties:{adapters:{type:"array",items:{type:"object",oneOf:[xe,Object.assign(Object.assign({},xe),{properties:Object.assign(Object.assign({},xe.properties),{type:{type:"string",const:"APIGEE_EDGE"}})}),{type:"object",properties:{type:{type:"string",const:"GRAVITEE"},apiBaseUrl:{type:"string"},env:{type:"string"},allowApiProductsOutsideCatalog:{type:"boolean",default:!1},stage:{type:"string",default:"non-production"},auth:{oneOf:[{type:"object",properties:{static:{type:"string"}},additionalProperties:!1,required:["static"]},{type:"object",properties:{idp:{type:"string"}},additionalProperties:!1,required:["idp"]}]}},additionalProperties:!1,required:["type","apiBaseUrl"]}],discriminator:{propertyName:"type"}}}}},removeAttribution:{type:"boolean"},i18n:we,l10n:we,metadata:{type:"object",additionalProperties:!0},metadataGlobs:{type:"object",additionalProperties:{type:"object",additionalProperties:!0}},ignore:{type:"array",items:{type:"string"}},theme:ce,reunite:he,logo:B,navbar:V,products:W,footer:H,sidebar:Y,scripts:G,links:K,feedback:o,search:Q,colorMode:X,navigation:J,codeSnippet:Z,markdown:ee,openapi:te,graphql:l,analytics:re,userMenu:ie,versionPicker:oe,breadcrumbs:se,catalog:ae,scorecard:le},default:{redirects:{}},additionalProperties:!0},Se=Object.assign(Object.assign({},function e(t,n){return Object.fromEntries(Object.entries(t).map(([t,r])=>{if(t!==n)return"object"==typeof r&&r?Array.isArray(r)?[t,r.map(t=>"object"==typeof t?e(t,n):t)]:[t,e(r,n)]:[t,r]}).filter(Boolean))}(ke,"default")),{additionalProperties:!1}),Ee=Object.assign(Object.assign({$id:"root-redocly-config"},ke),{properties:Object.assign(Object.assign({plugins:{type:"array",items:{type:"string"}}},ke.properties),{env:{type:"object",additionalProperties:Se}}),default:{},additionalProperties:!1}),Oe={type:"object",properties:{logo:ce.properties.logo,navbar:ce.properties.navbar,footer:ce.properties.footer,sidebar:ce.properties.sidebar,search:ce.properties.search,codeSnippet:ce.properties.codeSnippet,breadcrumbs:ce.properties.breadcrumbs,openapi:ce.properties.openapi,feedback:ce.properties.feedback,analytics:{type:"object",properties:{ga:ne}}},additionalProperties:!0,default:{}};Object.assign(Object.assign({},Oe.properties),{apis:{type:"object",additionalProperties:ye},theme:Oe})},854:function(e,t,n){"use strict";t.l2=async function(e){const{ref:t,doc:n,externalRefResolver:l=new r.BaseResolver(e.config.resolve),base:u=null}=e;if(!t&&!n)throw new Error("Document or reference is required.\n");const p=void 0===n?await l.resolveDocument(u,t,!0):n;if(p instanceof Error)throw p;return e.collectSpecData?.(p.parsed),async function(e){const{document:t,config:n,customTypes:l,externalRefResolver:u,dereference:p=!1,skipRedoclyRegistryRefs:d=!1,removeUnusedComponents:m=!1,keepUrlRefs:g=!1}=e,y=(0,a.detectSpec)(t.parsed),b=(0,a.getMajorSpecVersion)(y),x=n.getRulesForSpecVersion(b),w=(0,o.normalizeTypes)(n.extendTypes(l??(0,a.getTypes)(y),y),n),k=(0,c.initRules)(x,n,"preprocessors",y),S=(0,c.initRules)(x,n,"decorators",y),E={problems:[],oasVersion:y,refTypes:new Map,visitorsData:{}};m&&S.push({severity:"error",ruleId:"remove-unused-components",visitor:b===a.SpecMajorVersion.OAS2?(0,f.RemoveUnusedComponents)({}):(0,h.RemoveUnusedComponents)({})});let O=await(0,r.resolveDocument)({rootDocument:t,rootType:w.Root,externalRefResolver:u});k.length>0&&((0,s.walkDocument)({document:t,rootType:w.Root,normalizedVisitors:(0,i.normalizeVisitors)(k,w),resolvedRefMap:O,ctx:E}),O=await(0,r.resolveDocument)({rootDocument:t,rootType:w.Root,externalRefResolver:u}));const _=(0,i.normalizeVisitors)([{severity:"error",ruleId:"bundler",visitor:v(b,p,d,t,O,g)},...S],w);return(0,s.walkDocument)({document:t,rootType:w.Root,normalizedVisitors:_,resolvedRefMap:O,ctx:E}),{bundle:t,problems:E.problems.map(e=>n.addProblemToIgnore(e)),fileDependencies:u.getFiles(),rootType:w.Root,refTypes:E.refTypes,visitorsData:E.visitorsData}}({document:p,...e,config:e.config.styleguide,externalRefResolver:l})};const r=n(2928),i=n(2161),o=n(1990),s=n(5735),a=n(3101),l=n(3873),c=n(2900),u=n(3416),p=n(8209),d=n(2440),f=n(6729),h=n(2020),m=n(750);var g;!function(e){e.Version2="oas2",e.Version3_0="oas3_0",e.Version3_1="oas3_1"}(g||(g={}));(0,i.normalizeVisitors)([{severity:"error",ruleId:"configBundler",visitor:{ref:{leave(e,t,n){b(e,n,t)}}}}],m.NormalizedConfigTypes);function y(e,t){switch(t){case a.SpecMajorVersion.OAS3:switch(e){case"Schema":return"schemas";case"Parameter":return"parameters";case"Response":return"responses";case"Example":return"examples";case"RequestBody":return"requestBodies";case"Header":return"headers";case"SecuritySchema":return"securitySchemes";case"Link":return"links";case"Callback":return"callbacks";default:return null}case a.SpecMajorVersion.OAS2:switch(e){case"Schema":return"definitions";case"Parameter":return"parameters";case"Response":return"responses";default:return null}case a.SpecMajorVersion.Async2:switch(e){case"Schema":return"schemas";case"Parameter":return"parameters";default:return null}case a.SpecMajorVersion.Async3:switch(e){case"Schema":return"schemas";case"Parameter":return"parameters";default:return null}case a.SpecMajorVersion.Arazzo1:switch(e){case"Root.workflows_items.parameters_items":case"Root.workflows_items.steps_items.parameters_items":return"parameters";default:return null}case a.SpecMajorVersion.Overlay1:return null}}function b(e,t,n){if((0,p.isPlainObject)(t.node)){delete e.$ref;const n=Object.assign({},t.node,e);Object.assign(e,n)}else n.parent[n.key]=t.node}function v(e,t,n,i,o,s){let c,f;const h={ref:{leave(a,c,p){if(!p.location||void 0===p.node)return void(0,u.reportUnresolvedRef)(p,c.report,c.location);if(p.location.source===i.source&&p.location.source===c.location.source&&"scalar"!==c.type.name&&!t)return;if(n&&(0,d.isRedoclyRegistryURL)(a.$ref))return;if(s&&(0,l.isAbsoluteUrl)(a.$ref))return;const f=y(c.type.name,e);f?t?(m(f,p,c),b(a,p,c)):(a.$ref=m(f,p,c),function(e,t,n){const s=(0,r.makeRefId)(n.location.source.absoluteRef,e.$ref);o.set(s,{document:i,isRemote:!1,node:t.node,nodePointer:e.$ref,resolved:!0})}(a,p,c)):b(a,p,c)}},Example:{leave(e,t){if((0,l.isExternalValue)(e)&&void 0===e.value){const n=t.resolve({$ref:e.externalValue});if(!n.location||void 0===n.node)return void(0,u.reportUnresolvedRef)(n,t.report,t.location);if(s&&(0,l.isAbsoluteUrl)(e.externalValue))return;e.value=t.resolve({$ref:e.externalValue}).node,delete e.externalValue}}},Root:{enter(t,n){f=n.location,e===a.SpecMajorVersion.OAS3?c=t.components=t.components||{}:e===a.SpecMajorVersion.OAS2?c=t:(e===a.SpecMajorVersion.Async2||e===a.SpecMajorVersion.Async3||e===a.SpecMajorVersion.Arazzo1)&&(c=t.components=t.components||{})}}};function m(t,n,r){c[t]=c[t]||{};const i=function(e,t,n){const[r,i]=[e.location.source.absoluteRef,e.location.pointer],o=c[t];let s="";const a=i.slice(2).split("/").filter(p.isTruthy);for(;a.length>0;)if(s=a.pop()+(s?`-${s}`:""),!o||!o[s]||g(o[s],e,n))return s;if(s=(0,l.refBaseName)(r)+(s?`_${s}`:""),!o[s]||g(o[s],e,n))return s;const u=s;let d=2;for(;o[s]&&!g(o[s],e,n);)s=`${u}-${d}`,d++;return o[s]||n.report({message:`Two schemas are referenced with the same name but different content. Renamed ${u} to ${s}.`,location:n.location,forceSeverity:"warn"}),s}(n,t,r);return c[t][i]=n.node,e===a.SpecMajorVersion.OAS3||e===a.SpecMajorVersion.Async2||e===a.SpecMajorVersion.Async3?`#/components/${t}/${i}`:`#/${t}/${i}`}function g(e,t,n){return!(!(0,l.isRef)(e)||n.resolve(e,f.absolutePointer).location?.absolutePointer!==t.location.absolutePointer)||(0,p.dequal)(e,t.node)}return e===a.SpecMajorVersion.OAS3&&(h.DiscriminatorMapping={leave(t,n){for(const r of Object.keys(t)){const i=t[r],o=n.resolve({$ref:i});if(!o.location||void 0===o.node)return void(0,u.reportUnresolvedRef)(o,n.report,n.location.child(r));const s=y("Schema",e);t[r]=m(s,o,n)}}}),h}},8921:function(e,t,n){"use strict";t.Config=t.SV=void 0;const r=n(7992),i=n(7975),o=n(970),s=n(8209),a=n(3101),l=n(1827),c=n(462),u=n(3873);t.SV=".redocly.lint-ignore.yaml";class p{constructor(e,n){this.rawConfig=e,this.configFile=n,this.ignore={},this._usedRules=new Set,this._usedVersions=new Set,this.plugins=e.plugins||[],this.doNotResolveExamples=!!e.doNotResolveExamples,this.recommendedFallback=e.recommendedFallback||!1,d(["rules","oas2Rules","oas3_0Rules","oas3_1Rules","async2Rules","async3Rules","arazzo1Rules","overlay1Rules"],e),this.rules={[a.SpecVersion.OAS2]:{...e.rules,...e.oas2Rules},[a.SpecVersion.OAS3_0]:{...e.rules,...e.oas3_0Rules},[a.SpecVersion.OAS3_1]:{...e.rules,...e.oas3_1Rules},[a.SpecVersion.Async2]:{...e.rules,...e.async2Rules},[a.SpecVersion.Async3]:{...e.rules,...e.async3Rules},[a.SpecVersion.Arazzo1]:{...e.rules,...e.arazzo1Rules},[a.SpecVersion.Overlay1]:{...e.rules,...e.overlay1Rules}},this.preprocessors={[a.SpecVersion.OAS2]:{...e.preprocessors,...e.oas2Preprocessors},[a.SpecVersion.OAS3_0]:{...e.preprocessors,...e.oas3_0Preprocessors},[a.SpecVersion.OAS3_1]:{...e.preprocessors,...e.oas3_1Preprocessors},[a.SpecVersion.Async2]:{...e.preprocessors,...e.async2Preprocessors},[a.SpecVersion.Async3]:{...e.preprocessors,...e.async3Preprocessors},[a.SpecVersion.Arazzo1]:{...e.arazzo1Preprocessors},[a.SpecVersion.Overlay1]:{...e.preprocessors,...e.overlay1Preprocessors}},this.decorators={[a.SpecVersion.OAS2]:{...e.decorators,...e.oas2Decorators},[a.SpecVersion.OAS3_0]:{...e.decorators,...e.oas3_0Decorators},[a.SpecVersion.OAS3_1]:{...e.decorators,...e.oas3_1Decorators},[a.SpecVersion.Async2]:{...e.decorators,...e.async2Decorators},[a.SpecVersion.Async3]:{...e.decorators,...e.async3Decorators},[a.SpecVersion.Arazzo1]:{...e.arazzo1Decorators},[a.SpecVersion.Overlay1]:{...e.decorators,...e.overlay1Decorators}},this.extendPaths=e.extendPaths||[],this.pluginPaths=e.pluginPaths||[],this.resolveIgnore(function(e){return e?(0,s.doesYamlFileExist)(e)?i.join(i.dirname(e),t.SV):i.join(e,t.SV):l.isBrowser?void 0:i.join(process.cwd(),t.SV)}(n))}resolveIgnore(e){if(e&&(0,s.doesYamlFileExist)(e)){this.ignore=(0,o.parseYaml)(r.readFileSync(e,"utf-8"))||{},d(Object.keys(this.ignore),this.ignore);for(const t of Object.keys(this.ignore)){this.ignore[(0,u.isAbsoluteUrl)(t)?t:i.resolve(i.dirname(e),t)]=this.ignore[t];for(const e of Object.keys(this.ignore[t]))this.ignore[t][e]=new Set(this.ignore[t][e]);(0,u.isAbsoluteUrl)(t)||delete this.ignore[t]}}}saveIgnore(){const e=this.configFile?i.dirname(this.configFile):process.cwd(),n=i.join(e,t.SV),a={};for(const t of Object.keys(this.ignore)){const n=a[(0,u.isAbsoluteUrl)(t)?t:(0,s.slash)(i.relative(e,t))]=this.ignore[t];for(const e of Object.keys(n))n[e]=Array.from(n[e])}r.writeFileSync(n,"# This file instructs Redocly's linter to ignore the rules contained for specific parts of your API.\n# See https://redocly.com/docs/cli/ for more information.\n"+(0,o.stringifyYaml)(a))}addIgnore(e){const t=this.ignore,n=e.location[0];if(void 0===n.pointer)return;const r=t[n.source.absoluteRef]=t[n.source.absoluteRef]||{};(r[e.ruleId]=r[e.ruleId]||new Set).add(n.pointer)}addProblemToIgnore(e){const t=e.location[0];if(void 0===t.pointer)return e;const n=(this.ignore[t.source.absoluteRef]||{})[e.ruleId],r=n&&n.has(t.pointer);return r?{...e,ignored:r}:e}extendTypes(e,t){let n=e;for(const e of this.plugins)if(void 0!==e.typeExtension)switch(t){case a.SpecVersion.OAS3_0:case a.SpecVersion.OAS3_1:if(!e.typeExtension.oas3)continue;n=e.typeExtension.oas3(n,t);break;case a.SpecVersion.OAS2:if(!e.typeExtension.oas2)continue;n=e.typeExtension.oas2(n,t);break;case a.SpecVersion.Async2:if(!e.typeExtension.async2)continue;n=e.typeExtension.async2(n,t);break;case a.SpecVersion.Async3:if(!e.typeExtension.async3)continue;n=e.typeExtension.async3(n,t);break;case a.SpecVersion.Arazzo1:if(!e.typeExtension.arazzo1)continue;n=e.typeExtension.arazzo1(n,t);break;case a.SpecVersion.Overlay1:if(!e.typeExtension.overlay1)continue;n=e.typeExtension.overlay1(n,t);break;default:throw new Error("Not implemented")}return n}getRuleSettings(e,t){this._usedRules.add(e),this._usedVersions.add(t);const n=this.rules[t][e]||"off";return"string"==typeof n?{severity:n}:{severity:"error",...n}}getPreprocessorSettings(e,t){this._usedRules.add(e),this._usedVersions.add(t);const n=this.preprocessors[t][e]||"off";return"string"==typeof n?{severity:"on"===n?"error":n}:{severity:"error",...n}}getDecoratorSettings(e,t){this._usedRules.add(e),this._usedVersions.add(t);const n=this.decorators[t][e]||"off";return"string"==typeof n?{severity:"on"===n?"error":n}:{severity:"error",...n}}getUnusedRules(){const e=[],t=[],n=[];for(const r of Array.from(this._usedVersions))e.push(...Object.keys(this.rules[r]).filter(e=>!this._usedRules.has(e))),t.push(...Object.keys(this.decorators[r]).filter(e=>!this._usedRules.has(e))),n.push(...Object.keys(this.preprocessors[r]).filter(e=>!this._usedRules.has(e)));return{rules:e,preprocessors:n,decorators:t}}getRulesForSpecVersion(e){switch(e){case a.SpecMajorVersion.OAS3:const e=[];return this.plugins.forEach(t=>t.preprocessors?.oas3&&e.push(t.preprocessors.oas3)),this.plugins.forEach(t=>t.rules?.oas3&&e.push(t.rules.oas3)),this.plugins.forEach(t=>t.decorators?.oas3&&e.push(t.decorators.oas3)),e;case a.SpecMajorVersion.OAS2:const t=[];return this.plugins.forEach(e=>e.preprocessors?.oas2&&t.push(e.preprocessors.oas2)),this.plugins.forEach(e=>e.rules?.oas2&&t.push(e.rules.oas2)),this.plugins.forEach(e=>e.decorators?.oas2&&t.push(e.decorators.oas2)),t;case a.SpecMajorVersion.Async2:const n=[];return this.plugins.forEach(e=>e.preprocessors?.async2&&n.push(e.preprocessors.async2)),this.plugins.forEach(e=>e.rules?.async2&&n.push(e.rules.async2)),this.plugins.forEach(e=>e.decorators?.async2&&n.push(e.decorators.async2)),n;case a.SpecMajorVersion.Async3:const r=[];return this.plugins.forEach(e=>e.preprocessors?.async3&&r.push(e.preprocessors.async3)),this.plugins.forEach(e=>e.rules?.async3&&r.push(e.rules.async3)),this.plugins.forEach(e=>e.decorators?.async3&&r.push(e.decorators.async3)),r;case a.SpecMajorVersion.Arazzo1:const i=[];return this.plugins.forEach(e=>e.preprocessors?.arazzo1&&i.push(e.preprocessors.arazzo1)),this.plugins.forEach(e=>e.rules?.arazzo1&&i.push(e.rules.arazzo1)),this.plugins.forEach(e=>e.decorators?.arazzo1&&i.push(e.decorators.arazzo1)),i;case a.SpecMajorVersion.Overlay1:const o=[];return this.plugins.forEach(e=>e.preprocessors?.overlay1&&o.push(e.preprocessors.overlay1)),this.plugins.forEach(e=>e.rules?.overlay1&&o.push(e.rules.overlay1)),this.plugins.forEach(e=>e.decorators?.overlay1&&o.push(e.decorators.overlay1)),o}}skipRules(e){for(const t of e||[])for(const e of Object.values(a.SpecVersion))if(this.rules[e][t])this.rules[e][t]="off";else if(Array.isArray(this.rules[e].assertions))for(const n of this.rules[e].assertions)n.assertionId===t&&(n.severity="off")}skipPreprocessors(e){for(const t of e||[])for(const e of Object.values(a.SpecVersion))this.preprocessors[e][t]&&(this.preprocessors[e][t]="off")}skipDecorators(e){for(const t of e||[])for(const e of Object.values(a.SpecVersion))this.decorators[e][t]&&(this.decorators[e][t]="off")}}function d(e,t){for(const n of e)t[n]&&(0,s.isPlainObject)(t[n])&&"spec"in t[n]&&((0,s.showWarningForDeprecatedField)("spec","struct"),t[n].struct=t[n].spec,delete t[n].spec)}t.Config=class{constructor(e,t){this.rawConfig=e,this.configFile=t,this.apis=e.apis||{},this.styleguide=new p(e.styleguide||{},t),this.theme=e.theme||{},this.resolve=(0,c.getResolveConfig)(e?.resolve),this.region=e.region,this.organization=e.organization,this.files=e.files||[],this.telemetry=e.telemetry}}},2900:function(e,t,n){"use strict";t.initRules=function(e,t,n,i){return e.flatMap(e=>Object.keys(e).map(r=>{const o=e[r],s="rules"===n?t.getRuleSettings(r,i):"preprocessors"===n?t.getPreprocessorSettings(r,i):t.getDecoratorSettings(r,i);if("off"===s.severity)return;const a=s.severity,l=s.message,c=o(s);return Array.isArray(c)?c.map(e=>({severity:a,ruleId:r,message:l,visitor:e})):{severity:a,message:l,ruleId:r,visitor:c}})).flatMap(e=>e).filter(r.isDefined)};const r=n(8209)},462:function(e,t,n){"use strict";t.getResolveConfig=function(e){return{http:{headers:e?.http?.headers??[],customFetch:void 0}}};n(8209),n(8921),n(2678);Error},6729:function(e,t,n){"use strict";t.RemoveUnusedComponents=void 0;const r=n(8209);t.RemoveUnusedComponents=()=>{const e=new Map;function t(t,n,r){e.set(t.absolutePointer,{usedIn:e.get(t.absolutePointer)?.usedIn??[],componentType:n,name:r})}function n(t,i){const o=i.length;for(const[n,{usedIn:o,name:s,componentType:a}]of e)!o.some(e=>!i.some(t=>e.absolutePointer.startsWith(t)&&(e.absolutePointer.length===t.length||"/"===e.absolutePointer[t.length])))&&a&&(i.push(n),delete t[a][s],e.delete(n),(0,r.isEmptyObject)(t[a])&&delete t[a]);return i.length>o?n(t,i):i.length}return{ref:{leave(t,{location:n,type:r,resolve:i,key:o}){if(["Schema","Parameter","Response","SecurityScheme"].includes(r.name)){const r=i(t);if(!r.location)return;const[s,a]=r.location.absolutePointer.split("#",2),l=`${s}#${a.split("/").slice(0,3).join("/")}`,c=e.get(l);c?c.usedIn.push(n):e.set(l,{usedIn:[n],name:o.toString()})}}},Root:{leave(e,t){t.getVisitorData().removedCount=n(e,[])}},NamedSchemas:{Schema(e,{location:n,key:r}){e.allOf||t(n,"definitions",r.toString())}},NamedParameters:{Parameter(e,{location:n,key:r}){t(n,"parameters",r.toString())}},NamedResponses:{Response(e,{location:n,key:r}){t(n,"responses",r.toString())}},NamedSecuritySchemes:{SecurityScheme(e,{location:n,key:r}){t(n,"securityDefinitions",r.toString())}}}}},2020:function(e,t,n){"use strict";t.RemoveUnusedComponents=void 0;const r=n(8209);t.RemoveUnusedComponents=()=>{const e=new Map;function t(t,n,r){e.set(t.absolutePointer,{usedIn:e.get(t.absolutePointer)?.usedIn??[],componentType:n,name:r})}function n(t,i){const o=i.length;for(const[n,{usedIn:o,name:s,componentType:a}]of e)if(!o.some(e=>!i.some(t=>e.absolutePointer.startsWith(t)&&(e.absolutePointer.length===t.length||"/"===e.absolutePointer[t.length])))&&a&&t.components){i.push(n);const o=t.components[a];delete o[s],e.delete(n),(0,r.isEmptyObject)(o)&&delete t.components[a]}return i.length>o?n(t,i):i.length}return{ref:{leave(t,{location:n,type:r,resolve:i,key:o}){if(["Schema","Header","Parameter","Response","Example","RequestBody"].includes(r.name)){const r=i(t);if(!r.location)return;const[s,a]=r.location.absolutePointer.split("#",2),l=`${s}#${a.split("/").slice(0,4).join("/")}`,c=e.get(l);c?c.usedIn.push(n):e.set(l,{usedIn:[n],name:o.toString()})}}},Root:{leave(e,t){t.getVisitorData().removedCount=n(e,[]),(0,r.isEmptyObject)(e.components)&&delete e.components}},NamedSchemas:{Schema(e,{location:n,key:r}){e.allOf||t(n,"schemas",r.toString())}},NamedParameters:{Parameter(e,{location:n,key:r}){t(n,"parameters",r.toString())}},NamedResponses:{Response(e,{location:n,key:r}){t(n,"responses",r.toString())}},NamedExamples:{Example(e,{location:n,key:r}){t(n,"examples",r.toString())}},NamedRequestBodies:{RequestBody(e,{location:n,key:r}){t(n,"requestBodies",r.toString())}},NamedHeaders:{Header(e,{location:n,key:r}){t(n,"headers",r.toString())}}}}},1827:function(e,t){"use strict";t.env=t.isBrowser=void 0,t.isBrowser="undefined"!=typeof window||"undefined"==typeof process||!0,t.env=t.isBrowser?{}:{}||{}},970:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringifyYaml=t.parseYaml=void 0;const r=n(7210),i=r.JSON_SCHEMA.extend({implicit:[r.types.merge],explicit:[r.types.binary,r.types.omap,r.types.pairs,r.types.set]});t.parseYaml=(e,t)=>(0,r.load)(e,{schema:i,...t}),t.stringifyYaml=(e,t)=>(0,r.dump)(e,t)},2678:function(e,t,n){"use strict";t.logger=t.colorize=void 0;const r=n(8825),i=n(1827),o=n(8209);r.options,t.colorize=new Proxy(r,{get(e,t){return i.isBrowser?o.identity:e[t]}}),t.logger=new class{stderr(e){return process.stderr.write(e)}info(e){return i.isBrowser?console.log(e):this.stderr(e)}warn(e){return i.isBrowser?console.warn(e):this.stderr(t.colorize.yellow(e))}error(e){return i.isBrowser?console.error(e):this.stderr(t.colorize.red(e))}}},3101:function(e,t,n){"use strict";t.SpecMajorVersion=t.SpecVersion=void 0,t.detectSpec=function(e){if(!(0,u.isPlainObject)(e))throw new Error("Document must be JSON object, got "+typeof e);if(e.openapi&&"string"!=typeof e.openapi)throw new Error(`Invalid OpenAPI version: should be a string but got "${typeof e.openapi}"`);if("string"==typeof e.openapi&&e.openapi.startsWith("3.0"))return d.OAS3_0;if("string"==typeof e.openapi&&(e.openapi.startsWith("3.1")||e.openapi.startsWith("3.2")))return d.OAS3_1;if(e.swagger&&"2.0"===e.swagger)return d.OAS2;if(e.openapi||e.swagger)throw new Error(`Unsupported OpenAPI version: ${e.openapi||e.swagger}`);if("string"==typeof e.asyncapi&&e.asyncapi.startsWith("2."))return d.Async2;if("string"==typeof e.asyncapi&&e.asyncapi.startsWith("3."))return d.Async3;if(e.asyncapi)throw new Error(`Unsupported AsyncAPI version: ${e.asyncapi}`);if("string"==typeof e.arazzo&&p.VERSION_PATTERN.test(e.arazzo))return d.Arazzo1;if("string"==typeof e.overlay&&p.VERSION_PATTERN.test(e.overlay))return d.Overlay1;throw new Error("Unsupported specification")},t.getMajorSpecVersion=function(e){return e===d.OAS2?f.OAS2:e===d.Async2?f.Async2:e===d.Async3?f.Async3:e===d.Arazzo1?f.Arazzo1:e===d.Overlay1?f.Overlay1:f.OAS3},t.getTypes=function(e){return h[e]};const r=n(4409),i=n(4154),o=n(2082),s=n(1360),a=n(2407),l=n(907),c=n(382),u=n(8209),p=n(5068);var d,f;!function(e){e.OAS2="oas2",e.OAS3_0="oas3_0",e.OAS3_1="oas3_1",e.Async2="async2",e.Async3="async3",e.Arazzo1="arazzo1",e.Overlay1="overlay1"}(d||(t.SpecVersion=d={})),function(e){e.OAS2="oas2",e.OAS3="oas3",e.Async2="async2",e.Async3="async3",e.Arazzo1="arazzo1",e.Overlay1="overlay1"}(f||(t.SpecMajorVersion=f={}));const h={[d.OAS2]:r.Oas2Types,[d.OAS3_0]:i.Oas3Types,[d.OAS3_1]:o.Oas3_1Types,[d.Async2]:s.AsyncApi2Types,[d.Async3]:a.AsyncApi3Types,[d.Arazzo1]:l.Arazzo1Types,[d.Overlay1]:c.Overlay1Types}},2440:function(e,t){"use strict";t.si=t.t9=void 0,t.isRedoclyRegistryURL=function(e){const r=n||t.si[t.t9],i="redocly.com"===r?"redoc.ly":r;return!(!e.startsWith(`https://api.${r}/registry/`)&&!e.startsWith(`https://api.${i}/registry/`))};let n="redocly.com";t.t9="us",t.si=function(){const e={us:"redocly.com",eu:"eu.redocly.com"},t=n;return t?.endsWith(".redocly.host")&&(e[t.split(".")[0]]=t),"redoc.online"===t&&(e[t]=t),e}(),Object.keys(t.si)},3873:function(e,t,n){"use strict";t.Location=void 0,t.joinPointer=i,t.isRef=function(e){return(0,r.isPlainObject)(e)&&"string"==typeof e.$ref},t.isExternalValue=function(e){return(0,r.isPlainObject)(e)&&"string"==typeof e.externalValue},t.escapePointer=a,t.parseRef=function(e){const[t,n=""]=e.split("#/");return{uri:(t.endsWith("#")?t.slice(0,-1):t)||null,pointer:l(n)}},t.refBaseName=function(e){const t=e.split(/[\/\\]/);return t[t.length-1].replace(/\.[^.]+$/,"")},t.isAbsoluteUrl=function(e){return e.startsWith("http://")||e.startsWith("https://")},t.isMappingRef=function(e){return e.startsWith("#")||e.startsWith("https://")||e.startsWith("http://")||e.startsWith("./")||e.startsWith("../")||e.indexOf("/")>-1},t.isAnchor=function(e){return/^#[A-Za-z][A-Za-z0-9\-_:.]*$/.test(e)};const r=n(8209);function i(e,t){return""===e&&(e="#/"),"/"===e[e.length-1]?e+t:e+"/"+t}class o{constructor(e,t){this.source=e,this.pointer=t}child(e){return new o(this.source,i(this.pointer,(Array.isArray(e)?e:[e]).map(a).join("/")))}key(){return{...this,reportOnKey:!0}}get absolutePointer(){return this.source.absoluteRef+("#/"===this.pointer?"":this.pointer)}}function s(e){return decodeURIComponent(e.replace(/~1/g,"/").replace(/~0/g,"~"))}function a(e){return"number"==typeof e?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function l(e){return e.split("/").map(s).filter(r.isTruthy)}t.Location=o},2928:function(e,t,n){"use strict";t.BaseResolver=t.YamlParseError=void 0,t.makeRefId=d,t.makeDocumentFromString=function(e,t){const n=new l(t,e);try{return{source:n,parsed:(0,a.parseYaml)(e,{filename:t})}}catch(e){throw new p(e,n)}},t.resolveDocument=async function(e){const{rootDocument:t,externalRefResolver:n,rootType:r}=e,i=new Map,l=new Set,c=[];let u;!function e(t,r,u,p){const g=r.source.absoluteRef,y=new Map;async function b(e,t,r){if(function(e,t){for(;e;){if(e.node===t)return!0;e=e.prev}return!1}(r.prev,t))throw new Error("Self-referencing circular pointer");if((0,o.isAnchor)(t.$ref)){await(0,a.nextTick)();const n={resolved:!0,isRemote:!1,node:y.get(t.$ref),document:e,nodePointer:t.$ref},r=d(e.source.absoluteRef,t.$ref);return i.set(r,n),n}const{uri:s,pointer:l}=(0,o.parseRef)(t.$ref),c=null!==s;let u;try{u=c?await n.resolveDocument(e.source.absoluteRef,s):e}catch(n){const r={resolved:!1,isRemote:c,document:void 0,error:n},o=d(e.source.absoluteRef,t.$ref);return i.set(o,r),r}let p={resolved:!0,document:u,isRemote:c,node:e.parsed,nodePointer:"#/"},h=u.parsed;const m=l;for(const e of m){if("object"!=typeof h){h=void 0;break}if(void 0!==h[e])h=h[e],p.nodePointer=(0,o.joinPointer)(p.nodePointer,(0,o.escapePointer)(e));else{if(!(0,o.isRef)(h)){h=void 0;break}if(p=await b(u,h,f(r,h)),u=p.document||u,"object"!=typeof p.node){h=void 0;break}h=p.node[e],p.nodePointer=(0,o.joinPointer)(p.nodePointer,(0,o.escapePointer)(e))}}p.node=h,p.document=u;const g=d(e.source.absoluteRef,t.$ref);return p.document&&(0,o.isRef)(h)&&(p=await b(p.document,h,f(r,h))),i.set(g,p),{...p}}!function t(n,i,a){if("object"!=typeof n||null===n)return;const u=`${i.name}::${a}`;if(l.has(u))return;l.add(u);const[p,d]=Object.entries(n).find(([e])=>"$anchor"===e)||[];if(d&&y.set(`#${d}`,n),Array.isArray(n)){const e=i.items;if(void 0===e&&i!==h&&i!==s.SpecExtension)return;const r="function"==typeof e;for(let l=0;l{t.resolved&&e(t.node,t.document,t.nodePointer,i)});c.push(t)}if((0,o.isExternalValue)(n)){const t=b(r,{$ref:n.externalValue},{prev:null,node:n}).then(t=>{t.resolved&&e(t.node,t.document,t.nodePointer,i)});c.push(t)}}(t,p,g+u)}(t.parsed,t,"#/",r);do{u=await Promise.all(c)}while(c.length!==u.length);return i};const r=n(7411),i=n(7975),o=n(3873),s=n(1990),a=n(8209);class l{constructor(e,t,n){this.absoluteRef=e,this.body=t,this.mimeType=n}getAst(e){return void 0===this._ast&&(this._ast=e(this.body,{filename:this.absoluteRef})??void 0,this._ast&&0===this._ast.kind&&""===this._ast.value&&1!==this._ast.startPosition&&(this._ast.startPosition=1,this._ast.endPosition=1)),this._ast}getLines(){return void 0===this._lines&&(this._lines=this.body.split(/\r\n|[\n\r]/g)),this._lines}}class c extends Error{constructor(e){super(e.message),this.originalError=e,Object.setPrototypeOf(this,c.prototype)}}const u=/\((\d+):(\d+)\)$/;class p extends Error{constructor(e,t){super(e.message.split("\n")[0]),this.originalError=e,this.source=t,Object.setPrototypeOf(this,p.prototype);const[,n,r]=this.message.match(u)||[];this.line=parseInt(n,10),this.col=parseInt(r,10)}}function d(e,t){return e+"::"+t}function f(e,t){return{prev:e,node:t}}t.YamlParseError=p,t.BaseResolver=class{constructor(e={http:{headers:[]}}){this.config=e,this.cache=new Map}getFiles(){return new Set(Array.from(this.cache.keys()))}resolveExternalRef(e,t){return(0,o.isAbsoluteUrl)(t)?t:e&&(0,o.isAbsoluteUrl)(e)?new URL(t,e).href:i.resolve(e?i.dirname(e):process.cwd(),t)}async loadExternalRef(e){try{if((0,o.isAbsoluteUrl)(e)){const{body:t,mimeType:n}=await(0,a.readFileFromUrl)(e,this.config.http);return new l(e,t,n)}{if(r.lstatSync(e).isDirectory())throw new Error(`Expected a file but received a folder at ${e}.`);const t=await r.promises.readFile(e,"utf-8");return new l(e,t.replace(/\r\n/g,"\n"))}}catch(e){throw e.message=e.message.replace(", lstat",""),new c(e)}}parseDocument(e,t=!1){const n=e.absoluteRef.substr(e.absoluteRef.lastIndexOf("."));if(![".json",".json",".yml",".yaml"].includes(n)&&!e.mimeType?.match(/(json|yaml|openapi)/)&&!t)return{source:e,parsed:e.body};try{return{source:e,parsed:(0,a.parseYaml)(e.body,{filename:e.absoluteRef})}}catch(t){throw new p(t,e)}}async resolveDocument(e,t,n=!1){const r=this.resolveExternalRef(e,t),i=this.cache.get(r);if(i)return i;const o=this.loadExternalRef(r).then(e=>this.parseDocument(e,n));return this.cache.set(r,o),o}};const h={name:"unknown",properties:{}},m={name:"scalar",properties:{}}},3416:function(e,t,n){"use strict";t.reportUnresolvedRef=function(e,t,n){const i=e.error;i instanceof r.YamlParseError&&t({message:"Failed to parse: "+i.message,location:{source:i.source,pointer:void 0,start:{col:i.col,line:i.line}}});const o=e.error?.message;t({location:n,message:"Can't resolve $ref"+(o?": "+o:"")})};const r=n(2928)},907:function(e,t,n){"use strict";t.Arazzo1Types=void 0;const r=n(1990),i=n(2082),o=n(4154),s=(0,r.mapOf)("Schema"),a=(0,r.listOf)("Workflow"),l=(0,r.listOf)("Step"),c={properties:{stepId:{type:"string"},description:{type:"string"},operationId:{type:"string"},operationPath:{type:"string"},workflowId:{type:"string"},parameters:"Parameters",successCriteria:(0,r.listOf)("CriterionObject"),onSuccess:"OnSuccessActionList",onFailure:"OnFailureActionList",outputs:"Outputs","x-operation":"ExtendedOperation",requestBody:"RequestBody"},required:["stepId"],requiredOneOf:["x-operation","operationId","operationPath","workflowId"],extensionsPrefix:"x-"},u={properties:{contentType:{type:"string"},payload:{},replacements:(0,r.listOf)("Replacement")},required:["payload"],extensionsPrefix:"x-"},p={properties:{name:{type:"string"},type:{type:"string",enum:["goto","end"]},stepId:{type:"string"},workflowId:{type:"string"},criteria:(0,r.listOf)("CriterionObject")},required:["type","name"]},d={properties:{name:{type:"string"},type:{type:"string",enum:["goto","retry","end"]},workflowId:{type:"string"},stepId:{type:"string"},retryAfter:{type:"number"},retryLimit:{type:"number"},criteria:(0,r.listOf)("CriterionObject")},required:["type","name"]};t.Arazzo1Types={Root:{properties:{arazzo:{type:"string"},info:"Info",sourceDescriptions:"SourceDescriptions",workflows:"Workflows",components:"Components"},required:["arazzo","info","sourceDescriptions","workflows"],extensionsPrefix:"x-"},Info:{properties:{title:{type:"string"},description:{type:"string"},summary:{type:"string"},version:{type:"string"}},required:["title","version"],extensionsPrefix:"x-"},SourceDescriptions:{properties:{},items:e=>"openapi"===e?.type?"OpenAPISourceDescription":"ArazzoSourceDescription"},OpenAPISourceDescription:{properties:{name:{type:"string"},type:{type:"string",enum:["openapi"]},url:{type:"string"},"x-serverUrl":{type:"string"}},required:["name","type","url"],extensionsPrefix:"x-"},ArazzoSourceDescription:{properties:{name:{type:"string"},type:{type:"string",enum:["arazzo"]},url:{type:"string"}},required:["name","type","url"],extensionsPrefix:"x-"},Parameters:{properties:{},items:e=>e?.reference?"ReusableObject":"Parameter"},Parameter:{properties:{in:{type:"string",enum:["header","query","path","cookie"]},name:{type:"string"},value:{}},required:["name","value"],extensionsPrefix:"x-"},ReusableObject:{properties:{reference:{type:"string"},value:{}},required:["reference"],extensionsPrefix:"x-"},Workflows:a,Workflow:{properties:{workflowId:{type:"string"},summary:{type:"string"},description:{type:"string"},parameters:"Parameters",dependsOn:{type:"array",items:{type:"string"}},inputs:"Schema",outputs:"Outputs",steps:"Steps",successActions:"OnSuccessActionList",failureActions:"OnFailureActionList"},required:["workflowId","steps"],extensionsPrefix:"x-"},Steps:l,Step:c,RequestBody:u,Replacement:{properties:{target:{type:"string"},value:{}},required:["target","value"],extensionsPrefix:"x-"},ExtendedOperation:{properties:{url:{type:"string"},method:{enum:["get","post","put","delete","patch","head","options","trace","connect","query","GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","TRACE","CONNECT","QUERY"]}},required:["url","method"]},Outputs:{properties:{},additionalProperties:{type:"string"}},CriterionObject:{properties:{condition:{type:"string"},context:{type:"string"},type:e=>e?"string"==typeof e?{enum:["regex","jsonpath","simple","xpath"]}:"jsonpath"===e?.type?"JSONPathCriterion":"XPathCriterion":void 0},required:["condition"]},XPathCriterion:{properties:{type:{type:"string",enum:["xpath"]},version:{type:"string",enum:["xpath-30","xpath-20","xpath-10"]}}},JSONPathCriterion:{properties:{type:{type:"string",enum:["jsonpath"]},version:{type:"string",enum:["draft-goessner-dispatch-jsonpath-00"]}}},SuccessActionObject:p,OnSuccessActionList:{properties:{},items:e=>e?.type&&e?.name?"SuccessActionObject":"ReusableObject"},FailureActionObject:d,OnFailureActionList:{properties:{},items:e=>e?.type&&e?.name?"FailureActionObject":"ReusableObject"},Schema:i.Schema,NamedSchemas:(0,r.mapOf)("Schema"),ExternalDocs:o.ExternalDocs,DiscriminatorMapping:o.DiscriminatorMapping,Discriminator:o.Discriminator,DependentRequired:i.DependentRequired,SchemaProperties:i.SchemaProperties,PatternProperties:i.SchemaProperties,Components:{properties:{inputs:"NamedInputs",parameters:"NamedParameters",successActions:"NamedSuccessActions",failureActions:"NamedFailureActions"},extensionsPrefix:"x-"},NamedInputs:s,NamedParameters:{properties:{},additionalProperties:"Parameter"},NamedSuccessActions:{properties:{},additionalProperties:"SuccessActionObject"},NamedFailureActions:{properties:{},additionalProperties:"FailureActionObject"},Xml:o.Xml}},1360:function(e,t,n){"use strict";t.AsyncApi2Types=t.AsyncApi2Bindings=t.Dependencies=t.SecuritySchemeFlows=t.Discriminator=t.DiscriminatorMapping=t.SchemaProperties=t.Schema=t.MessageExample=t.CorrelationId=t.License=t.Contact=t.ServerVariable=t.ServerMap=t.ExternalDocs=t.Tag=void 0;const r=n(1990),i=n(3873),o={properties:{},allowed(){return["http","ws","kafka","anypointmq","amqp","amqp1","mqtt","mqtt5","nats","jms","sns","solace","sqs","stomp","redis","mercure","ibmmq","googlepubsub","pulsar"]},additionalProperties:{type:"object"}};t.Tag={properties:{name:{type:"string"},description:{type:"string"},externalDocs:"ExternalDocs"},required:["name"]},t.ExternalDocs={properties:{description:{type:"string"},url:{type:"string"}},required:["url"]};const s={properties:{},allowed(){return["http","ws","kafka","anypointmq","amqp","amqp1","mqtt","mqtt5","nats","jms","sns","solace","sqs","stomp","redis","mercure","ibmmq","googlepubsub","pulsar"]},additionalProperties:{type:"object"}};t.ServerMap={properties:{},additionalProperties:(e,t)=>t.match(/^[A-Za-z0-9_\-]+$/)?"Server":void 0},t.ServerVariable={properties:{enum:{type:"array",items:{type:"string"}},default:{type:"string"},description:{type:"string"},examples:{type:"array",items:{type:"string"}}},required:[]},t.Contact={properties:{name:{type:"string"},url:{type:"string"},email:{type:"string"}}},t.License={properties:{name:{type:"string"},url:{type:"string"}},required:["name"]},t.CorrelationId={properties:{description:{type:"string"},location:{type:"string"}},required:["location"]};const a={properties:{},allowed(){return["http","ws","kafka","anypointmq","amqp","amqp1","mqtt","mqtt5","nats","jms","sns","solace","sqs","stomp","redis","mercure","ibmmq","googlepubsub","pulsar"]},additionalProperties:{type:"object"}},l={properties:{},allowed(){return["http","ws","kafka","anypointmq","amqp","amqp1","mqtt","mqtt5","nats","jms","sns","solace","sqs","stomp","redis","mercure","ibmmq","googlepubsub","pulsar"]},additionalProperties:{type:"object"}};t.MessageExample={properties:{payload:{isExample:!0},summary:{type:"string"},name:{type:"string"},headers:{type:"object"}}},t.Schema={properties:{$id:{type:"string"},$schema:{type:"string"},definitions:"NamedSchemas",externalDocs:"ExternalDocs",discriminator:"Discriminator",myArbitraryKeyword:{type:"boolean"},title:{type:"string"},multipleOf:{type:"number",minimum:0},maximum:{type:"number"},minimum:{type:"number"},exclusiveMaximum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{type:"integer",minimum:0},minLength:{type:"integer",minimum:0},pattern:{type:"string"},maxItems:{type:"integer",minimum:0},minItems:{type:"integer",minimum:0},uniqueItems:{type:"boolean"},maxProperties:{type:"integer",minimum:0},minProperties:{type:"integer",minimum:0},required:{type:"array",items:{type:"string"}},enum:{type:"array"},type:e=>Array.isArray(e)?{type:"array",items:{enum:["object","array","string","number","integer","boolean","null"]}}:{enum:["object","array","string","number","integer","boolean","null"]},allOf:(0,r.listOf)("Schema"),anyOf:(0,r.listOf)("Schema"),oneOf:(0,r.listOf)("Schema"),not:"Schema",if:"Schema",then:"Schema",else:"Schema",contains:"Schema",patternProperties:{type:"object"},propertyNames:"Schema",properties:"SchemaProperties",items:e=>Array.isArray(e)?(0,r.listOf)("Schema"):"Schema",additionalProperties:e=>"boolean"==typeof e?{type:"boolean"}:"Schema",description:{type:"string"},format:{type:"string"},contentEncoding:{type:"string"},contentMediaType:{type:"string"},default:null,readOnly:{type:"boolean"},writeOnly:{type:"boolean"},examples:{type:"array"},example:{isExample:!0},deprecated:{type:"boolean"},const:null,$comment:{type:"string"},additionalItems:e=>"boolean"==typeof e?{type:"boolean"}:"Schema",dependencies:"Dependencies"}},t.SchemaProperties={properties:{},additionalProperties:e=>"boolean"==typeof e?{type:"boolean"}:"Schema"},t.DiscriminatorMapping={properties:{},additionalProperties:e=>(0,i.isMappingRef)(e)?{type:"string",directResolveAs:"Schema"}:{type:"string"}},t.Discriminator={properties:{propertyName:{type:"string"},mapping:"DiscriminatorMapping"},required:["propertyName"]},t.SecuritySchemeFlows={properties:{implicit:"ImplicitFlow",password:"PasswordFlow",clientCredentials:"ClientCredentials",authorizationCode:"AuthorizationCode"}};const c={properties:{type:{enum:["userPassword","apiKey","X509","symmetricEncryption","asymmetricEncryption","httpApiKey","http","oauth2","openIdConnect","plain","scramSha256","scramSha512","gssapi"]},description:{type:"string"},name:{type:"string"},in:{type:"string",enum:["query","header","cookie","user","password"]},scheme:{type:"string"},bearerFormat:{type:"string"},flows:"SecuritySchemeFlows",openIdConnectUrl:{type:"string"}},required(e){switch(e?.type){case"apiKey":return["type","in"];case"httpApiKey":return["type","name","in"];case"http":return["type","scheme"];case"oauth2":return["type","flows"];case"openIdConnect":return["type","openIdConnectUrl"];default:return["type"]}},allowed(e){switch(e?.type){case"apiKey":return["type","in","description"];case"httpApiKey":return["type","name","in","description"];case"http":return["type","scheme","bearerFormat","description"];case"oauth2":return["type","flows","description"];case"openIdConnect":return["type","openIdConnectUrl","description"];default:return["type","description"]}},extensionsPrefix:"x-"};t.Dependencies={properties:{},additionalProperties:e=>Array.isArray(e)?{type:"array",items:{type:"string"}}:"Schema"};const u={properties:{}};o.properties.http=u;const p={properties:{}};s.properties.http=p;const d={properties:{headers:"Schema",bindingVersion:{type:"string"}}};a.properties.http=d;const f={properties:{type:{type:"string"},method:{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","CONNECT","TRACE"]},headers:"Schema",bindingVersion:{type:"string"}}};l.properties.http=f;const h={properties:{method:{type:"string"},query:"Schema",headers:"Schema",bindingVersion:{type:"string"}}};o.properties.ws=h;const m={properties:{}};s.properties.ws=m;const g={properties:{}};a.properties.ws=g;const y={properties:{}};l.properties.ws=y;const b={properties:{topic:{type:"string"},partitions:{type:"integer"},replicas:{type:"integer"},topicConfiguration:"KafkaTopicConfiguration",bindingVersion:{type:"string"}}};o.properties.kafka=b;const v={properties:{}};s.properties.kafka=v;const x={properties:{key:"Schema",schemaIdLocation:{type:"string"},schemaIdPayloadEncoding:{type:"string"},schemaLookupStrategy:{type:"string"},bindingVersion:{type:"string"}}};a.properties.kafka=x;const w={properties:{groupId:"Schema",clientId:"Schema",bindingVersion:{type:"string"}}};l.properties.kafka=w;const k={properties:{destination:{type:"string"},destinationType:{type:"string"},bindingVersion:{type:"string"}}};o.properties.anypointmq=k;const S={properties:{}};s.properties.anypointmq=S;const E={properties:{headers:"Schema",bindingVersion:{type:"string"}}};a.properties.anypointmq=E;const O={properties:{}};l.properties.anypointmq=O;const _={properties:{}};o.properties.amqp=_;const P={properties:{}};s.properties.amqp=P;const $={properties:{contentEncoding:{type:"string"},messageType:{type:"string"},bindingVersion:{type:"string"}}};a.properties.amqp=$;const A={properties:{expiration:{type:"integer"},userId:{type:"string"},cc:{type:"array",items:{type:"string"}},priority:{type:"integer"},deliveryMode:{type:"integer"},mandatory:{type:"boolean"},bcc:{type:"array",items:{type:"string"}},replyTo:{type:"string"},timestamp:{type:"boolean"},ack:{type:"boolean"},bindingVersion:{type:"string"}}};l.properties.amqp=A;const C={properties:{}};o.properties.amqp1=C;const j={properties:{}};s.properties.amqp1=j;const T={properties:{}};a.properties.amqp1=T;const N={properties:{}};l.properties.amqp1=N;const I={properties:{qos:{type:"integer"},retain:{type:"boolean"},bindingVersion:{type:"string"}}};o.properties.mqtt=I;const R={properties:{clientId:{type:"string"},cleanSession:{type:"boolean"},lastWill:"MqttServerBindingLastWill",keepAlive:{type:"integer"},bindingVersion:{type:"string"}}};s.properties.mqtt=R;const L={properties:{bindingVersion:{type:"string"}}};a.properties.mqtt=L;const D={properties:{qos:{type:"integer"},retain:{type:"boolean"},bindingVersion:{type:"string"}}};l.properties.mqtt=D;const M={properties:{}};o.properties.mqtt5=M;const z={properties:{}};s.properties.mqtt5=z;const F={properties:{}};a.properties.mqtt5=F;const U={properties:{}};l.properties.mqtt5=U;const q={properties:{}};o.properties.nats=q;const B={properties:{}};s.properties.nats=B;const V={properties:{}};a.properties.nats=V;const W={properties:{queue:{type:"string"},bindingVersion:{type:"string"}}};l.properties.nats=W;const H={properties:{destination:{type:"string"},destinationType:{type:"string"},bindingVersion:{type:"string"}}};o.properties.jms=H;const Y={properties:{}};s.properties.jms=Y;const G={properties:{headers:"Schema",bindingVersion:{type:"string"}}};a.properties.jms=G;const K={properties:{headers:"Schema",bindingVersion:{type:"string"}}};l.properties.jms=K;const Q={properties:{}};o.properties.solace=Q;const X={properties:{bindingVersion:{type:"string"},msgVpn:{type:"string"}}};s.properties.solace=X;const J={properties:{}};a.properties.solace=J;const Z={properties:{bindingVersion:{type:"string"},destinations:(0,r.listOf)("SolaceDestination")}};l.properties.solace=Z;const ee={properties:{}};o.properties.stomp=ee;const te={properties:{}};s.properties.stomp=te;const ne={properties:{}};a.properties.stomp=ne;const re={properties:{}};l.properties.stomp=re;const ie={properties:{}};o.properties.redis=ie;const oe={properties:{}};s.properties.redis=oe;const se={properties:{}};a.properties.redis=se;const ae={properties:{}};l.properties.redis=ae;const le={properties:{}};o.properties.mercure=le;const ce={properties:{}};s.properties.mercure=ce;const ue={properties:{}};a.properties.mercure=ue;const pe={properties:{}};l.properties.mercure=pe,t.AsyncApi2Bindings={HttpServerBinding:p,HttpChannelBinding:u,HttpMessageBinding:d,HttpOperationBinding:f,WsServerBinding:m,WsChannelBinding:h,WsMessageBinding:g,WsOperationBinding:y,KafkaServerBinding:v,KafkaTopicConfiguration:{properties:{"cleanup.policy":{type:"array",items:{enum:["delete","compact"]}},"retention.ms":{type:"integer"},"retention.bytes":{type:"integer"},"delete.retention.ms":{type:"integer"},"max.message.bytes":{type:"integer"}}},KafkaChannelBinding:b,KafkaMessageBinding:x,KafkaOperationBinding:w,AnypointmqServerBinding:S,AnypointmqChannelBinding:k,AnypointmqMessageBinding:E,AnypointmqOperationBinding:O,AmqpServerBinding:P,AmqpChannelBinding:_,AmqpMessageBinding:$,AmqpOperationBinding:A,Amqp1ServerBinding:j,Amqp1ChannelBinding:C,Amqp1MessageBinding:T,Amqp1OperationBinding:N,MqttServerBindingLastWill:{properties:{topic:{type:"string"},qos:{type:"integer"},message:{type:"string"},retain:{type:"boolean"}}},MqttServerBinding:R,MqttChannelBinding:I,MqttMessageBinding:L,MqttOperationBinding:D,Mqtt5ServerBinding:z,Mqtt5ChannelBinding:M,Mqtt5MessageBinding:F,Mqtt5OperationBinding:U,NatsServerBinding:B,NatsChannelBinding:q,NatsMessageBinding:V,NatsOperationBinding:W,JmsServerBinding:Y,JmsChannelBinding:H,JmsMessageBinding:G,JmsOperationBinding:K,SolaceServerBinding:X,SolaceChannelBinding:Q,SolaceMessageBinding:J,SolaceDestination:{properties:{destinationType:{type:"string",enum:["queue","topic"]},deliveryMode:{type:"string",enum:["direct","persistent"]},"queue.name":{type:"string"},"queue.topicSubscriptions":{type:"array",items:{type:"string"}},"queue.accessType":{type:"string",enum:["exclusive","nonexclusive"]},"queue.maxMsgSpoolSize":{type:"string"},"queue.maxTtl":{type:"string"},"topic.topicSubscriptions":{type:"array",items:{type:"string"}}}},SolaceOperationBinding:Z,StompServerBinding:te,StompChannelBinding:ee,StompMessageBinding:ne,StompOperationBinding:re,RedisServerBinding:oe,RedisChannelBinding:ie,RedisMessageBinding:se,RedisOperationBinding:ae,MercureServerBinding:ce,MercureChannelBinding:le,MercureMessageBinding:ue,MercureOperationBinding:pe,ServerBindings:s,ChannelBindings:o,MessageBindings:a,OperationBindings:l},t.AsyncApi2Types={...t.AsyncApi2Bindings,Root:{properties:{asyncapi:null,info:"Info",id:{type:"string"},servers:"ServerMap",channels:"ChannelMap",components:"Components",tags:"TagList",externalDocs:"ExternalDocs",defaultContentType:{type:"string"}},required:["asyncapi","channels","info"]},Tag:t.Tag,TagList:(0,r.listOf)("Tag"),ServerMap:t.ServerMap,ExternalDocs:t.ExternalDocs,Server:{properties:{url:{type:"string"},protocol:{type:"string"},protocolVersion:{type:"string"},description:{type:"string"},variables:"ServerVariablesMap",security:"SecurityRequirementList",bindings:"ServerBindings",tags:"TagList"},required:["url","protocol"]},ServerVariable:t.ServerVariable,ServerVariablesMap:(0,r.mapOf)("ServerVariable"),SecurityRequirement:{properties:{},additionalProperties:{type:"array",items:{type:"string"}}},SecurityRequirementList:(0,r.listOf)("SecurityRequirement"),Info:{properties:{title:{type:"string"},version:{type:"string"},description:{type:"string"},termsOfService:{type:"string"},contact:"Contact",license:"License"},required:["title","version"]},Contact:t.Contact,License:t.License,ChannelMap:{properties:{},additionalProperties:"Channel"},Channel:{properties:{description:{type:"string"},subscribe:"Operation",publish:"Operation",parameters:"ParametersMap",bindings:"ChannelBindings",servers:{type:"array",items:{type:"string"}}}},Parameter:{properties:{description:{type:"string"},schema:"Schema",location:{type:"string"}}},ParametersMap:(0,r.mapOf)("Parameter"),Operation:{properties:{tags:"TagList",summary:{type:"string"},description:{type:"string"},externalDocs:"ExternalDocs",operationId:{type:"string"},security:"SecurityRequirementList",bindings:"OperationBindings",traits:"OperationTraitList",message:"Message"},required:[]},Schema:t.Schema,MessageExample:t.MessageExample,SchemaProperties:t.SchemaProperties,DiscriminatorMapping:t.DiscriminatorMapping,Discriminator:t.Discriminator,Components:{properties:{messages:"NamedMessages",parameters:"NamedParameters",schemas:"NamedSchemas",correlationIds:"NamedCorrelationIds",messageTraits:"NamedMessageTraits",operationTraits:"NamedOperationTraits",securitySchemes:"NamedSecuritySchemes",servers:"ServerMap",serverVariables:"ServerVariablesMap",channels:"ChannelMap",serverBindings:"ServerBindings",channelBindings:"ChannelBindings",operationBindings:"OperationBindings",messageBindings:"MessageBindings"}},NamedSchemas:(0,r.mapOf)("Schema"),NamedMessages:(0,r.mapOf)("Message"),NamedMessageTraits:(0,r.mapOf)("MessageTrait"),NamedOperationTraits:(0,r.mapOf)("OperationTrait"),NamedParameters:(0,r.mapOf)("Parameter"),NamedSecuritySchemes:(0,r.mapOf)("SecurityScheme"),NamedCorrelationIds:(0,r.mapOf)("CorrelationId"),ImplicitFlow:{properties:{refreshUrl:{type:"string"},scopes:{type:"object",additionalProperties:{type:"string"}},authorizationUrl:{type:"string"}},required:["authorizationUrl","scopes"]},PasswordFlow:{properties:{refreshUrl:{type:"string"},scopes:{type:"object",additionalProperties:{type:"string"}},tokenUrl:{type:"string"}},required:["tokenUrl","scopes"]},ClientCredentials:{properties:{refreshUrl:{type:"string"},scopes:{type:"object",additionalProperties:{type:"string"}},tokenUrl:{type:"string"}},required:["tokenUrl","scopes"]},AuthorizationCode:{properties:{refreshUrl:{type:"string"},authorizationUrl:{type:"string"},scopes:{type:"object",additionalProperties:{type:"string"}},tokenUrl:{type:"string"}},required:["authorizationUrl","tokenUrl","scopes"]},SecuritySchemeFlows:t.SecuritySchemeFlows,SecurityScheme:c,Message:{properties:{messageId:{type:"string"},headers:"Schema",payload:"Schema",correlationId:"CorrelationId",schemaFormat:{type:"string"},contentType:{type:"string"},name:{type:"string"},title:{type:"string"},summary:{type:"string"},description:{type:"string"},tags:"TagList",externalDocs:"ExternalDocs",bindings:"MessageBindings",examples:"MessageExampleList",traits:"MessageTraitList"},additionalProperties:{}},MessageBindings:a,OperationBindings:l,OperationTrait:{properties:{tags:"TagList",summary:{type:"string"},description:{type:"string"},externalDocs:"ExternalDocs",operationId:{type:"string"},security:"SecurityRequirementList",bindings:"OperationBindings"},required:[]},OperationTraitList:(0,r.listOf)("OperationTrait"),MessageTrait:{properties:{messageId:{type:"string"},headers:"Schema",correlationId:"CorrelationId",schemaFormat:{type:"string"},contentType:{type:"string"},name:{type:"string"},title:{type:"string"},summary:{type:"string"},description:{type:"string"},tags:"TagList",externalDocs:"ExternalDocs",bindings:"MessageBindings",examples:"MessageExampleList"},additionalProperties:{}},MessageTraitList:(0,r.listOf)("MessageTrait"),MessageExampleList:(0,r.listOf)("MessageExample"),CorrelationId:t.CorrelationId,Dependencies:t.Dependencies}},2407:function(e,t,n){"use strict";t.AsyncApi3Types=void 0;const r=n(1990),i=n(1360),o={properties:{type:{enum:["userPassword","apiKey","X509","symmetricEncryption","asymmetricEncryption","httpApiKey","http","oauth2","openIdConnect","plain","scramSha256","scramSha512","gssapi"]},description:{type:"string"},name:{type:"string"},in:{type:"string",enum:["query","header","cookie","user","password"]},scheme:{type:"string"},bearerFormat:{type:"string"},flows:"SecuritySchemeFlows",openIdConnectUrl:{type:"string"},scopes:{type:"array",items:{type:"string"}}},required(e){switch(e?.type){case"apiKey":return["type","in"];case"httpApiKey":return["type","name","in"];case"http":return["type","scheme"];case"oauth2":return["type","flows"];case"openIdConnect":return["type","openIdConnectUrl"];default:return["type"]}},allowed(e){switch(e?.type){case"apiKey":return["type","in","description"];case"httpApiKey":return["type","name","in","description"];case"http":return["type","scheme","bearerFormat","description"];case"oauth2":return["type","flows","description","scopes"];case"openIdConnect":return["type","openIdConnectUrl","description","scopes"];default:return["type","description"]}},extensionsPrefix:"x-"};t.AsyncApi3Types={...i.AsyncApi2Bindings,CorrelationId:i.CorrelationId,SecuritySchemeFlows:i.SecuritySchemeFlows,ServerVariable:i.ServerVariable,Contact:i.Contact,License:i.License,MessageExample:i.MessageExample,Tag:i.Tag,Dependencies:i.Dependencies,Schema:i.Schema,Discriminator:i.Discriminator,DiscriminatorMapping:i.DiscriminatorMapping,SchemaProperties:i.SchemaProperties,ServerMap:i.ServerMap,ExternalDocs:i.ExternalDocs,Root:{properties:{asyncapi:{type:"string",enum:["3.0.0"]},info:"Info",id:{type:"string"},servers:"ServerMap",channels:"NamedChannels",components:"Components",operations:"NamedOperations",defaultContentType:{type:"string"}},required:["asyncapi","info"]},Channel:{properties:{address:{type:"string"},messages:"NamedMessages",title:{type:"string"},summary:{type:"string"},description:{type:"string"},servers:"ServerList",parameters:"ParametersMap",bindings:"ChannelBindings",tags:"TagList",externalDocs:"ExternalDocs"}},Parameter:{properties:{description:{type:"string"},enum:{type:"array",items:{type:"string"}},default:{type:"string"},examples:{type:"array",items:{type:"string"}},location:{type:"string"}}},Info:{properties:{title:{type:"string"},version:{type:"string"},description:{type:"string"},termsOfService:{type:"string"},contact:"Contact",license:"License",tags:"TagList",externalDocs:"ExternalDocs"},required:["title","version"]},Server:{properties:{host:{type:"string"},pathname:{type:"string"},protocol:{type:"string"},protocolVersion:{type:"string"},description:{type:"string"},variables:"ServerVariablesMap",security:"SecuritySchemeList",bindings:"ServerBindings",externalDocs:"ExternalDocs",tags:"TagList"},required:["host","protocol"]},MessageTrait:{properties:{headers:e=>"function"==typeof e||"object"==typeof e&&e?{properties:{schema:"Schema",schemaFormat:{type:"string"}}}:"Schema",correlationId:"CorrelationId",contentType:{type:"string"},name:{type:"string"},title:{type:"string"},summary:{type:"string"},description:{type:"string"},tags:"TagList",externalDocs:"ExternalDocs",bindings:"MessageBindings",examples:"MessageExampleList"},additionalProperties:{}},Operation:{properties:{action:{type:"string",enum:["send","receive"]},channel:"Channel",title:{type:"string"},tags:"TagList",summary:{type:"string"},description:{type:"string"},externalDocs:"ExternalDocs",operationId:{type:"string"},security:"SecuritySchemeList",bindings:"OperationBindings",traits:"OperationTraitList",messages:"MessageList",reply:"OperationReply"},required:["action","channel"]},OperationReply:{properties:{channel:"Channel",messages:"MessageList",address:"OperationReplyAddress"}},OperationReplyAddress:{properties:{location:{type:"string"},description:{type:"string"}},required:["location"]},Components:{properties:{messages:"NamedMessages",parameters:"NamedParameters",schemas:"NamedSchemas",replies:"NamedOperationReplies",replyAddresses:"NamedOperationRelyAddresses",correlationIds:"NamedCorrelationIds",messageTraits:"NamedMessageTraits",operationTraits:"NamedOperationTraits",tags:"NamedTags",externalDocs:"NamedExternalDocs",securitySchemes:"NamedSecuritySchemes",servers:"ServerMap",serverVariables:"ServerVariablesMap",channels:"NamedChannels",operations:"NamedOperations",serverBindings:"ServerBindings",channelBindings:"ChannelBindings",operationBindings:"OperationBindings",messageBindings:"MessageBindings"}},ImplicitFlow:{properties:{refreshUrl:{type:"string"},availableScopes:{type:"object",additionalProperties:{type:"string"}},authorizationUrl:{type:"string"}},required:["authorizationUrl","availableScopes"]},PasswordFlow:{properties:{refreshUrl:{type:"string"},availableScopes:{type:"object",additionalProperties:{type:"string"}},tokenUrl:{type:"string"}},required:["tokenUrl","availableScopes"]},ClientCredentials:{properties:{refreshUrl:{type:"string"},availableScopes:{type:"object",additionalProperties:{type:"string"}},tokenUrl:{type:"string"}},required:["tokenUrl","availableScopes"]},AuthorizationCode:{properties:{refreshUrl:{type:"string"},authorizationUrl:{type:"string"},availableScopes:{type:"object",additionalProperties:{type:"string"}},tokenUrl:{type:"string"}},required:["authorizationUrl","tokenUrl","availableScopes"]},SecurityScheme:o,Message:{properties:{headers:"Schema",payload:e=>e&&e?.schemaFormat?{properties:{schema:"Schema",schemaFormat:{type:"string"}},required:["schema","schemaFormat"]}:"Schema",correlationId:"CorrelationId",contentType:{type:"string"},name:{type:"string"},title:{type:"string"},summary:{type:"string"},description:{type:"string"},tags:"TagList",externalDocs:"ExternalDocs",bindings:"MessageBindings",examples:"MessageExampleList",traits:"MessageTraitList"},additionalProperties:{}},OperationTrait:{properties:{tags:"TagList",title:{type:"string"},summary:{type:"string"},description:{type:"string"},externalDocs:"ExternalDocs",security:"SecuritySchemeList",bindings:"OperationBindings"},required:[]},ServerVariablesMap:(0,r.mapOf)("ServerVariable"),NamedTags:(0,r.mapOf)("Tag"),NamedExternalDocs:(0,r.mapOf)("ExternalDocs"),NamedChannels:(0,r.mapOf)("Channel"),ParametersMap:(0,r.mapOf)("Parameter"),NamedOperations:(0,r.mapOf)("Operation"),NamedOperationReplies:(0,r.mapOf)("OperationReply"),NamedOperationRelyAddresses:(0,r.mapOf)("OperationReplyAddress"),NamedSchemas:(0,r.mapOf)("Schema"),NamedMessages:(0,r.mapOf)("Message"),NamedMessageTraits:(0,r.mapOf)("MessageTrait"),NamedOperationTraits:(0,r.mapOf)("OperationTrait"),NamedParameters:(0,r.mapOf)("Parameter"),NamedSecuritySchemes:(0,r.mapOf)("SecurityScheme"),NamedCorrelationIds:(0,r.mapOf)("CorrelationId"),ServerList:(0,r.listOf)("Server"),SecuritySchemeList:(0,r.listOf)("SecurityScheme"),MessageList:(0,r.listOf)("Message"),OperationTraitList:(0,r.listOf)("OperationTrait"),MessageTraitList:(0,r.listOf)("MessageTrait"),MessageExampleList:(0,r.listOf)("MessageExample"),TagList:(0,r.listOf)("Tag")}},1990:function(e,t){"use strict";t.SpecExtension=void 0,t.listOf=function(e){return{name:`${e}List`,properties:{},items:e}},t.mapOf=function(e){return{name:`${e}Map`,properties:{},additionalProperties:()=>e}},t.normalizeTypes=function(e,n={}){const r={};for(const t of Object.keys(e))r[t]={...e[t],name:t};for(const e of Object.values(r))i(e);return r.SpecExtension=t.SpecExtension,r;function i(e){if(e.additionalProperties&&(e.additionalProperties=o(e.additionalProperties)),e.items&&(e.items=o(e.items)),e.properties){const t={};for(const[r,i]of Object.entries(e.properties))t[r]=o(i),n.doNotResolveExamples&&i&&i.isExample&&(t[r]={...i,resolvable:!1});e.properties=t}}function o(e){if("string"==typeof e){if(!r[e])throw new Error(`Unknown type name found: ${e}`);return r[e]}return"function"==typeof e?(t,n)=>o(e(t,n)):e&&e.name?(i(e={...e}),e):e&&e.directResolveAs?{...e,directResolveAs:o(e.directResolveAs)}:e}},t.isNamedType=function(e){return"string"==typeof e?.name},t.SpecExtension={name:"SpecExtension",properties:{},additionalProperties:{resolvable:!0}}},58:function(e,t,n){"use strict";t.getNodeTypesFromJSONSchema=function(e,t){const n={};return a(e,t,n),n};const r=n(4206),i=n(8209),o=new r.default({strictSchema:!1,allowUnionTypes:!0,useDefaults:!0,allErrors:!0,discriminator:!0,strictTypes:!1,verbose:!0});function s(e,t){if(t.some(e=>"function"==typeof e))throw new Error("Unexpected oneOf inside oneOf.");return n=>{let r=e.findIndex(e=>o.validate(e,n));return-1===r&&(r=0),t[r]}}function a(e,t,n){if(!t||"boolean"==typeof t)throw new Error(`Unexpected schema in ${e}.`);if(t instanceof Array)throw new Error(`Unexpected array schema in ${e}. Try using oneOf instead.`);if("null"===t.type)throw new Error(`Unexpected null schema type in ${e} schema.`);if(t.type instanceof Array)throw new Error(`Unexpected array schema type in ${e} schema. Try using oneOf instead.`);if("string"===t.type||"number"===t.type||"integer"===t.type||"boolean"===t.type){const{default:e,format:n,...r}=t;return r}if("object"===t.type&&!t.properties&&!t.oneOf){if(void 0===t.additionalProperties||!0===t.additionalProperties)return{type:"object"};if(!1===t.additionalProperties)return{type:"object",properties:{}}}if(t.allOf)throw new Error(`Unexpected allOf in ${e}.`);if(t.anyOf)throw new Error(`Unexpected anyOf in ${e}.`);if((0,i.isPlainObject)(t.properties)||(0,i.isPlainObject)(t.additionalProperties)||(0,i.isPlainObject)(t.items)&&((0,i.isPlainObject)(t.items.properties)||(0,i.isPlainObject)(t.items.additionalProperties)||t.items.oneOf))return function(e,t,n){if(!t||"boolean"==typeof t)throw new Error(`Unexpected schema in ${e}.`);if(t instanceof Array)throw new Error(`Unexpected array schema in ${e}. Try using oneOf instead.`);if("null"===t.type)throw new Error(`Unexpected null schema type in ${e} schema.`);if(t.type instanceof Array)throw new Error(`Unexpected array schema type in ${e} schema. Try using oneOf instead.`);const r={};for(const[i,o]of Object.entries(t.properties||{}))r[i]=a(e+"."+i,o,n);let o,s;(0,i.isPlainObject)(t.additionalProperties)&&(o=a(e+"_additionalProperties",t.additionalProperties,n)),!0===t.additionalProperties&&(o={}),(0,i.isPlainObject)(t.items)&&((0,i.isPlainObject)(t.items.properties)||(0,i.isPlainObject)(t.items.additionalProperties)||t.items.oneOf)&&(s=a(e+"_items",t.items,n));let l=t.required;return t.oneOf&&t.oneOf.every(e=>!!e.required)&&(l=e=>{const n=t.oneOf.map(e=>[...t.required||[],...e.required]);let r=n.findIndex(t=>t.every(t=>void 0!==e[t]));return-1===r&&(r=0),n[r]}),n[e]={properties:r,additionalProperties:o,items:s,required:l},e}(e,t,n);if(t.oneOf){if(t.discriminator){const r=t.discriminator?.propertyName;if(!r)throw new Error(`Unexpected discriminator without a propertyName in ${e}.`);const o=t.oneOf.map((t,i)=>{if("boolean"==typeof t)throw new Error(`Unexpected boolean schema in ${e} at position ${i} in oneOf.`);const o=t?.properties?.[r];if(!o||"boolean"==typeof o)throw new Error(`Unexpected property '${o}' schema in ${e} at position ${i} in oneOf.`);return a(o.const,t,n)});return(e,a)=>{if((0,i.isPlainObject)(e)){const t=e[r];if("string"==typeof t&&n[t])return t}return s(t.oneOf,o)(e,a)}}{const r=t.oneOf.map((t,r)=>a(e+"_"+r,t,n));return s(t.oneOf,r)}}return t}},4409:function(e,t,n){"use strict";t.Oas2Types=void 0;const r=n(1990),i=/^[0-9][0-9Xx]{2}$/,o={properties:{name:{type:"string"},in:{type:"string",enum:["query","header","path","formData","body"]},description:{type:"string"},required:{type:"boolean"},schema:"Schema",type:{type:"string",enum:["string","number","integer","boolean","array","file"]},format:{type:"string"},allowEmptyValue:{type:"boolean"},items:"ParameterItems",collectionFormat:{type:"string",enum:["csv","ssv","tsv","pipes","multi"]},default:null,maximum:{type:"integer"},exclusiveMaximum:{type:"boolean"},minimum:{type:"integer"},exclusiveMinimum:{type:"boolean"},maxLength:{type:"integer"},minLength:{type:"integer"},pattern:{type:"string"},maxItems:{type:"integer"},minItems:{type:"integer"},uniqueItems:{type:"boolean"},enum:{type:"array"},multipleOf:{type:"number"},"x-example":{},"x-examples":"ExamplesMap"},required(e){return e&&e.in?"body"===e.in?["name","in","schema"]:"array"===e.type?["name","in","type","items"]:["name","in","type"]:["name","in"]},extensionsPrefix:"x-"},s={properties:{type:{type:"string",enum:["string","number","integer","boolean","array"]},format:{type:"string"},items:"ParameterItems",collectionFormat:{type:"string",enum:["csv","ssv","tsv","pipes","multi"]},default:null,maximum:{type:"integer"},exclusiveMaximum:{type:"boolean"},minimum:{type:"integer"},exclusiveMinimum:{type:"boolean"},maxLength:{type:"integer"},minLength:{type:"integer"},pattern:{type:"string"},maxItems:{type:"integer"},minItems:{type:"integer"},uniqueItems:{type:"boolean"},enum:{type:"array"},multipleOf:{type:"number"}},required(e){return e&&"array"===e.type?["type","items"]:["type"]},extensionsPrefix:"x-"},a={properties:{default:"Response"},additionalProperties:(e,t)=>i.test(t)?"Response":void 0},l={properties:{description:{type:"string"},schema:"Schema",headers:(0,r.mapOf)("Header"),examples:"Examples","x-summary":{type:"string"}},required:["description"],extensionsPrefix:"x-"},c={properties:{description:{type:"string"},type:{type:"string",enum:["string","number","integer","boolean","array"]},format:{type:"string"},items:"ParameterItems",collectionFormat:{type:"string",enum:["csv","ssv","tsv","pipes","multi"]},default:null,maximum:{type:"integer"},exclusiveMaximum:{type:"boolean"},minimum:{type:"integer"},exclusiveMinimum:{type:"boolean"},maxLength:{type:"integer"},minLength:{type:"integer"},pattern:{type:"string"},maxItems:{type:"integer"},minItems:{type:"integer"},uniqueItems:{type:"boolean"},enum:{type:"array"},multipleOf:{type:"number"}},required(e){return e&&"array"===e.type?["type","items"]:["type"]},extensionsPrefix:"x-"},u={properties:{format:{type:"string"},title:{type:"string"},description:{type:"string"},default:null,multipleOf:{type:"number"},maximum:{type:"number"},minimum:{type:"number"},exclusiveMaximum:{type:"boolean"},exclusiveMinimum:{type:"boolean"},maxLength:{type:"number"},minLength:{type:"number"},pattern:{type:"string"},maxItems:{type:"number"},minItems:{type:"number"},uniqueItems:{type:"boolean"},maxProperties:{type:"number"},minProperties:{type:"number"},required:{type:"array",items:{type:"string"}},enum:{type:"array"},type:{type:"string",enum:["object","array","string","number","integer","boolean","null"]},items:e=>Array.isArray(e)?(0,r.listOf)("Schema"):"Schema",allOf:(0,r.listOf)("Schema"),properties:"SchemaProperties",additionalProperties:e=>"boolean"==typeof e?{type:"boolean"}:"Schema",discriminator:{type:"string"},readOnly:{type:"boolean"},xml:"Xml",externalDocs:"ExternalDocs",example:{isExample:!0},"x-tags":{type:"array",items:{type:"string"}},"x-nullable":{type:"boolean"},"x-extendedDiscriminator":{type:"string"},"x-additionalPropertiesName":{type:"string"},"x-explicitMappingOnly":{type:"boolean"},"x-enumDescriptions":"EnumDescriptions"},extensionsPrefix:"x-"},p={properties:{type:{enum:["basic","apiKey","oauth2"]},description:{type:"string"},name:{type:"string"},in:{type:"string",enum:["query","header"]},flow:{enum:["implicit","password","application","accessCode"]},authorizationUrl:{type:"string"},tokenUrl:{type:"string"},scopes:{type:"object",additionalProperties:{type:"string"}},"x-defaultClientId":{type:"string"}},required(e){switch(e?.type){case"apiKey":return["type","name","in"];case"oauth2":switch(e?.flow){case"implicit":return["type","flow","authorizationUrl","scopes"];case"accessCode":return["type","flow","authorizationUrl","tokenUrl","scopes"];case"application":case"password":return["type","flow","tokenUrl","scopes"];default:return["type","flow","scopes"]}default:return["type"]}},allowed(e){switch(e?.type){case"basic":return["type","description"];case"apiKey":return["type","name","in","description"];case"oauth2":switch(e?.flow){case"implicit":return["type","flow","authorizationUrl","description","scopes"];case"accessCode":return["type","flow","authorizationUrl","tokenUrl","description","scopes"];case"application":case"password":return["type","flow","tokenUrl","description","scopes"];default:return["type","flow","tokenUrl","authorizationUrl","description","scopes"]}default:return["type","description"]}},extensionsPrefix:"x-"};t.Oas2Types={Root:{properties:{swagger:{type:"string"},info:"Info",host:{type:"string"},basePath:{type:"string"},schemes:{type:"array",items:{type:"string"}},consumes:{type:"array",items:{type:"string"}},produces:{type:"array",items:{type:"string"}},paths:"Paths",definitions:"NamedSchemas",parameters:"NamedParameters",responses:"NamedResponses",securityDefinitions:"NamedSecuritySchemes",security:"SecurityRequirementList",tags:"TagList",externalDocs:"ExternalDocs","x-servers":"XServerList","x-tagGroups":"TagGroups","x-ignoredHeaderParameters":{type:"array",items:{type:"string"}}},required:["swagger","paths","info"],extensionsPrefix:"x-"},Tag:{properties:{name:{type:"string"},description:{type:"string"},externalDocs:"ExternalDocs","x-traitTag":{type:"boolean"},"x-displayName":{type:"string"}},required:["name"],extensionsPrefix:"x-"},TagList:(0,r.listOf)("Tag"),TagGroups:(0,r.listOf)("TagGroup"),TagGroup:{properties:{name:{type:"string"},tags:{type:"array",items:{type:"string"}}}},ExternalDocs:{properties:{description:{type:"string"},url:{type:"string"}},required:["url"],extensionsPrefix:"x-"},Example:{properties:{value:{isExample:!0},summary:{type:"string"},description:{type:"string"},externalValue:{type:"string"}},extensionsPrefix:"x-"},ExamplesMap:(0,r.mapOf)("Example"),EnumDescriptions:{properties:{},additionalProperties:{type:"string"}},SecurityRequirement:{properties:{},additionalProperties:{type:"array",items:{type:"string"}}},SecurityRequirementList:(0,r.listOf)("SecurityRequirement"),Info:{properties:{title:{type:"string"},description:{type:"string"},termsOfService:{type:"string"},contact:"Contact",license:"License",version:{type:"string"},"x-logo":"Logo"},required:["title","version"],extensionsPrefix:"x-"},Contact:{properties:{name:{type:"string"},url:{type:"string"},email:{type:"string"}},extensionsPrefix:"x-"},License:{properties:{name:{type:"string"},url:{type:"string"}},required:["name"],extensionsPrefix:"x-"},Logo:{properties:{url:{type:"string"},altText:{type:"string"},backgroundColor:{type:"string"},href:{type:"string"}},extensionsPrefix:"x-"},Paths:{properties:{},additionalProperties:(e,t)=>t.startsWith("/")?"PathItem":void 0},PathItem:{properties:{$ref:{type:"string"},parameters:"ParameterList",get:"Operation",put:"Operation",post:"Operation",delete:"Operation",options:"Operation",head:"Operation",patch:"Operation"},extensionsPrefix:"x-"},Parameter:o,ParameterItems:s,ParameterList:(0,r.listOf)("Parameter"),Operation:{properties:{tags:{type:"array",items:{type:"string"}},summary:{type:"string"},description:{type:"string"},externalDocs:"ExternalDocs",operationId:{type:"string"},consumes:{type:"array",items:{type:"string"}},produces:{type:"array",items:{type:"string"}},parameters:"ParameterList",responses:"Responses",schemes:{type:"array",items:{type:"string"}},deprecated:{type:"boolean"},security:"SecurityRequirementList","x-codeSamples":"XCodeSampleList","x-code-samples":"XCodeSampleList","x-hideTryItPanel":{type:"boolean"}},required:["responses"],extensionsPrefix:"x-"},Examples:{properties:{},additionalProperties:{isExample:!0}},Header:c,Responses:a,Response:l,Schema:u,Xml:{properties:{name:{type:"string"},namespace:{type:"string"},prefix:{type:"string"},attribute:{type:"boolean"},wrapped:{type:"boolean"}},extensionsPrefix:"x-"},SchemaProperties:{properties:{},additionalProperties:"Schema"},NamedSchemas:(0,r.mapOf)("Schema"),NamedResponses:(0,r.mapOf)("Response"),NamedParameters:(0,r.mapOf)("Parameter"),NamedSecuritySchemes:(0,r.mapOf)("SecurityScheme"),SecurityScheme:p,XCodeSample:{properties:{lang:{type:"string"},label:{type:"string"},source:{type:"string"}}},XCodeSampleList:(0,r.listOf)("XCodeSample"),XServerList:(0,r.listOf)("XServer"),XServer:{properties:{url:{type:"string"},description:{type:"string"}},required:["url"]}}},4154:function(e,t,n){"use strict";t.Oas3Types=t.Discriminator=t.DiscriminatorMapping=t.Xml=t.ExternalDocs=void 0;const r=n(1990),i=n(3873),o=/^[0-9][0-9Xx]{2}$/;t.ExternalDocs={properties:{description:{type:"string"},url:{type:"string"}},required:["url"],extensionsPrefix:"x-"};const s={properties:{default:"Response"},additionalProperties:(e,t)=>o.test(t)?"Response":void 0},a={properties:{externalDocs:"ExternalDocs",discriminator:"Discriminator",title:{type:"string"},multipleOf:{type:"number",minimum:0},maximum:{type:"number"},minimum:{type:"number"},exclusiveMaximum:{type:"boolean"},exclusiveMinimum:{type:"boolean"},maxLength:{type:"integer",minimum:0},minLength:{type:"integer",minimum:0},pattern:{type:"string"},maxItems:{type:"integer",minimum:0},minItems:{type:"integer",minimum:0},uniqueItems:{type:"boolean"},maxProperties:{type:"integer",minimum:0},minProperties:{type:"integer",minimum:0},required:{type:"array",items:{type:"string"}},enum:{type:"array"},type:{enum:["object","array","string","number","integer","boolean"]},allOf:(0,r.listOf)("Schema"),anyOf:(0,r.listOf)("Schema"),oneOf:(0,r.listOf)("Schema"),not:"Schema",properties:"SchemaProperties",items:e=>Array.isArray(e)?(0,r.listOf)("Schema"):"Schema",additionalProperties:e=>"boolean"==typeof e?{type:"boolean"}:"Schema",description:{type:"string"},format:{type:"string"},default:null,nullable:{type:"boolean"},readOnly:{type:"boolean"},writeOnly:{type:"boolean"},xml:"Xml",example:{isExample:!0},deprecated:{type:"boolean"},"x-tags":{type:"array",items:{type:"string"}},"x-additionalPropertiesName":{type:"string"},"x-explicitMappingOnly":{type:"boolean"}},extensionsPrefix:"x-"};t.Xml={properties:{name:{type:"string"},namespace:{type:"string"},prefix:{type:"string"},attribute:{type:"boolean"},wrapped:{type:"boolean"}},extensionsPrefix:"x-"},t.DiscriminatorMapping={properties:{},additionalProperties:e=>(0,i.isMappingRef)(e)?{type:"string",directResolveAs:"Schema"}:{type:"string"}},t.Discriminator={properties:{propertyName:{type:"string"},mapping:"DiscriminatorMapping"},required:["propertyName"],extensionsPrefix:"x-"};const l={properties:{type:{enum:["apiKey","http","oauth2","openIdConnect"]},description:{type:"string"},name:{type:"string"},in:{type:"string",enum:["query","header","cookie"]},scheme:{type:"string"},bearerFormat:{type:"string"},flows:"OAuth2Flows",openIdConnectUrl:{type:"string"},"x-defaultClientId":{type:"string"}},required(e){switch(e?.type){case"apiKey":return["type","name","in"];case"http":return["type","scheme"];case"oauth2":return["type","flows"];case"openIdConnect":return["type","openIdConnectUrl"];default:return["type"]}},allowed(e){switch(e?.type){case"apiKey":return["type","name","in","description"];case"http":return["type","scheme","bearerFormat","description"];case"oauth2":return["type","flows","description"];case"openIdConnect":return["type","openIdConnectUrl","description"];default:return["type","description"]}},extensionsPrefix:"x-"};t.Oas3Types={Root:{properties:{openapi:null,info:"Info",servers:"ServerList",security:"SecurityRequirementList",tags:"TagList",externalDocs:"ExternalDocs",paths:"Paths",components:"Components","x-webhooks":"WebhooksMap","x-tagGroups":"TagGroups","x-ignoredHeaderParameters":{type:"array",items:{type:"string"}}},required:["openapi","paths","info"],extensionsPrefix:"x-"},Tag:{properties:{name:{type:"string"},description:{type:"string"},externalDocs:"ExternalDocs","x-traitTag":{type:"boolean"},"x-displayName":{type:"string"}},required:["name"],extensionsPrefix:"x-"},TagList:(0,r.listOf)("Tag"),TagGroups:(0,r.listOf)("TagGroup"),TagGroup:{properties:{name:{type:"string"},tags:{type:"array",items:{type:"string"}}},extensionsPrefix:"x-"},ExternalDocs:t.ExternalDocs,Server:{properties:{url:{type:"string"},description:{type:"string"},variables:"ServerVariablesMap"},required:["url"],extensionsPrefix:"x-"},ServerList:(0,r.listOf)("Server"),ServerVariable:{properties:{enum:{type:"array",items:{type:"string"}},default:{type:"string"},description:{type:"string"}},required:["default"],extensionsPrefix:"x-"},ServerVariablesMap:(0,r.mapOf)("ServerVariable"),SecurityRequirement:{properties:{},additionalProperties:{type:"array",items:{type:"string"}}},SecurityRequirementList:(0,r.listOf)("SecurityRequirement"),Info:{properties:{title:{type:"string"},version:{type:"string"},description:{type:"string"},termsOfService:{type:"string"},contact:"Contact",license:"License","x-logo":"Logo"},required:["title","version"],extensionsPrefix:"x-"},Contact:{properties:{name:{type:"string"},url:{type:"string"},email:{type:"string"}},extensionsPrefix:"x-"},License:{properties:{name:{type:"string"},url:{type:"string"}},required:["name"],extensionsPrefix:"x-"},Paths:{properties:{},additionalProperties:(e,t)=>t.startsWith("/")?"PathItem":void 0},PathItem:{properties:{$ref:{type:"string"},servers:"ServerList",parameters:"ParameterList",summary:{type:"string"},description:{type:"string"},get:"Operation",put:"Operation",post:"Operation",delete:"Operation",options:"Operation",head:"Operation",patch:"Operation",trace:"Operation"},extensionsPrefix:"x-"},Parameter:{properties:{name:{type:"string"},in:{enum:["query","header","path","cookie"]},description:{type:"string"},required:{type:"boolean"},deprecated:{type:"boolean"},allowEmptyValue:{type:"boolean"},style:{enum:["form","simple","label","matrix","spaceDelimited","pipeDelimited","deepObject"]},explode:{type:"boolean"},allowReserved:{type:"boolean"},schema:"Schema",example:{isExample:!0},examples:"ExamplesMap",content:"MediaTypesMap"},required:["name","in"],requiredOneOf:["schema","content"],extensionsPrefix:"x-"},ParameterList:(0,r.listOf)("Parameter"),Operation:{properties:{tags:{type:"array",items:{type:"string"}},summary:{type:"string"},description:{type:"string"},externalDocs:"ExternalDocs",operationId:{type:"string"},parameters:"ParameterList",security:"SecurityRequirementList",servers:"ServerList",requestBody:"RequestBody",responses:"Responses",deprecated:{type:"boolean"},callbacks:"CallbacksMap","x-codeSamples":"XCodeSampleList","x-code-samples":"XCodeSampleList","x-hideTryItPanel":{type:"boolean"}},required:["responses"],extensionsPrefix:"x-"},Callback:(0,r.mapOf)("PathItem"),CallbacksMap:(0,r.mapOf)("Callback"),RequestBody:{properties:{description:{type:"string"},required:{type:"boolean"},content:"MediaTypesMap"},required:["content"],extensionsPrefix:"x-"},MediaTypesMap:{properties:{},additionalProperties:"MediaType"},MediaType:{properties:{schema:"Schema",example:{isExample:!0},examples:"ExamplesMap",encoding:"EncodingMap"},extensionsPrefix:"x-"},Example:{properties:{value:{isExample:!0},summary:{type:"string"},description:{type:"string"},externalValue:{type:"string"}},extensionsPrefix:"x-"},ExamplesMap:(0,r.mapOf)("Example"),Encoding:{properties:{contentType:{type:"string"},headers:"HeadersMap",style:{enum:["form","simple","label","matrix","spaceDelimited","pipeDelimited","deepObject"]},explode:{type:"boolean"},allowReserved:{type:"boolean"}},extensionsPrefix:"x-"},EncodingMap:(0,r.mapOf)("Encoding"),EnumDescriptions:{properties:{},additionalProperties:{type:"string"}},Header:{properties:{description:{type:"string"},required:{type:"boolean"},deprecated:{type:"boolean"},allowEmptyValue:{type:"boolean"},style:{enum:["form","simple","label","matrix","spaceDelimited","pipeDelimited","deepObject"]},explode:{type:"boolean"},allowReserved:{type:"boolean"},schema:"Schema",example:{isExample:!0},examples:"ExamplesMap",content:"MediaTypesMap"},requiredOneOf:["schema","content"],extensionsPrefix:"x-"},HeadersMap:(0,r.mapOf)("Header"),Responses:s,Response:{properties:{description:{type:"string"},headers:"HeadersMap",content:"MediaTypesMap",links:"LinksMap","x-summary":{type:"string"}},required:["description"],extensionsPrefix:"x-"},Link:{properties:{operationRef:{type:"string"},operationId:{type:"string"},parameters:null,requestBody:null,description:{type:"string"},server:"Server"},extensionsPrefix:"x-"},Logo:{properties:{url:{type:"string"},altText:{type:"string"},backgroundColor:{type:"string"},href:{type:"string"}}},Schema:a,Xml:t.Xml,SchemaProperties:{properties:{},additionalProperties:"Schema"},DiscriminatorMapping:t.DiscriminatorMapping,Discriminator:t.Discriminator,Components:{properties:{parameters:"NamedParameters",schemas:"NamedSchemas",responses:"NamedResponses",examples:"NamedExamples",requestBodies:"NamedRequestBodies",headers:"NamedHeaders",securitySchemes:"NamedSecuritySchemes",links:"NamedLinks",callbacks:"NamedCallbacks"},extensionsPrefix:"x-"},LinksMap:(0,r.mapOf)("Link"),NamedSchemas:(0,r.mapOf)("Schema"),NamedResponses:(0,r.mapOf)("Response"),NamedParameters:(0,r.mapOf)("Parameter"),NamedExamples:(0,r.mapOf)("Example"),NamedRequestBodies:(0,r.mapOf)("RequestBody"),NamedHeaders:(0,r.mapOf)("Header"),NamedSecuritySchemes:(0,r.mapOf)("SecurityScheme"),NamedLinks:(0,r.mapOf)("Link"),NamedCallbacks:(0,r.mapOf)("Callback"),ImplicitFlow:{properties:{refreshUrl:{type:"string"},scopes:{type:"object",additionalProperties:{type:"string"}},authorizationUrl:{type:"string"}},required:["authorizationUrl","scopes"],extensionsPrefix:"x-"},PasswordFlow:{properties:{refreshUrl:{type:"string"},scopes:{type:"object",additionalProperties:{type:"string"}},tokenUrl:{type:"string"}},required:["tokenUrl","scopes"],extensionsPrefix:"x-"},ClientCredentials:{properties:{refreshUrl:{type:"string"},scopes:{type:"object",additionalProperties:{type:"string"}},tokenUrl:{type:"string"}},required:["tokenUrl","scopes"],extensionsPrefix:"x-"},AuthorizationCode:{properties:{refreshUrl:{type:"string"},authorizationUrl:{type:"string"},scopes:{type:"object",additionalProperties:{type:"string"}},tokenUrl:{type:"string"},"x-usePkce":e=>"boolean"==typeof e?{type:"boolean"}:"XUsePkce"},required:["authorizationUrl","tokenUrl","scopes"],extensionsPrefix:"x-"},OAuth2Flows:{properties:{implicit:"ImplicitFlow",password:"PasswordFlow",clientCredentials:"ClientCredentials",authorizationCode:"AuthorizationCode"},extensionsPrefix:"x-"},SecurityScheme:l,XCodeSample:{properties:{lang:{type:"string"},label:{type:"string"},source:{type:"string"}}},XCodeSampleList:(0,r.listOf)("XCodeSample"),XUsePkce:{properties:{disableManualConfiguration:{type:"boolean"},hideClientSecretInput:{type:"boolean"}}},WebhooksMap:{properties:{},additionalProperties:()=>"PathItem"}}},2082:function(e,t,n){"use strict";t.Oas3_1Types=t.DependentRequired=t.SchemaProperties=t.Schema=void 0;const r=n(1990),i=n(4154);t.Schema={properties:{$id:{type:"string"},$anchor:{type:"string"},id:{type:"string"},$schema:{type:"string"},definitions:"NamedSchemas",$defs:"NamedSchemas",$vocabulary:{type:"string"},externalDocs:"ExternalDocs",discriminator:"Discriminator",title:{type:"string"},multipleOf:{type:"number",minimum:0},maximum:{type:"number"},minimum:{type:"number"},exclusiveMaximum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{type:"integer",minimum:0},minLength:{type:"integer",minimum:0},pattern:{type:"string"},maxItems:{type:"integer",minimum:0},minItems:{type:"integer",minimum:0},uniqueItems:{type:"boolean"},maxProperties:{type:"integer",minimum:0},minProperties:{type:"integer",minimum:0},required:{type:"array",items:{type:"string"}},enum:{type:"array"},type:e=>Array.isArray(e)?{type:"array",items:{enum:["object","array","string","number","integer","boolean","null"]}}:{enum:["object","array","string","number","integer","boolean","null"]},allOf:(0,r.listOf)("Schema"),anyOf:(0,r.listOf)("Schema"),oneOf:(0,r.listOf)("Schema"),not:"Schema",if:"Schema",then:"Schema",else:"Schema",dependentSchemas:(0,r.mapOf)("Schema"),dependentRequired:"DependentRequired",prefixItems:(0,r.listOf)("Schema"),contains:"Schema",minContains:{type:"integer",minimum:0},maxContains:{type:"integer",minimum:0},patternProperties:"PatternProperties",propertyNames:"Schema",unevaluatedItems:e=>"boolean"==typeof e?{type:"boolean"}:"Schema",unevaluatedProperties:e=>"boolean"==typeof e?{type:"boolean"}:"Schema",summary:{type:"string"},properties:"SchemaProperties",items:e=>"boolean"==typeof e?{type:"boolean"}:"Schema",additionalProperties:e=>"boolean"==typeof e?{type:"boolean"}:"Schema",description:{type:"string"},format:{type:"string"},contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:"Schema",default:null,readOnly:{type:"boolean"},writeOnly:{type:"boolean"},xml:"Xml",examples:{type:"array"},example:{isExample:!0},deprecated:{type:"boolean"},const:null,$comment:{type:"string"},"x-tags":{type:"array",items:{type:"string"}},$dynamicAnchor:{type:"string"},$dynamicRef:{type:"string"}},extensionsPrefix:"x-"},t.SchemaProperties={properties:{},additionalProperties:e=>"boolean"==typeof e?{type:"boolean"}:"Schema"};const o={properties:{type:{enum:["apiKey","http","oauth2","openIdConnect","mutualTLS"]},description:{type:"string"},name:{type:"string"},in:{type:"string",enum:["query","header","cookie"]},scheme:{type:"string"},bearerFormat:{type:"string"},flows:"OAuth2Flows",openIdConnectUrl:{type:"string"}},required(e){switch(e?.type){case"apiKey":return["type","name","in"];case"http":return["type","scheme"];case"oauth2":return["type","flows"];case"openIdConnect":return["type","openIdConnectUrl"];default:return["type"]}},allowed(e){switch(e?.type){case"apiKey":return["type","name","in","description"];case"http":return["type","scheme","bearerFormat","description"];case"oauth2":switch(e?.flows){case"implicit":return["type","flows","authorizationUrl","refreshUrl","description","scopes"];case"password":case"clientCredentials":return["type","flows","tokenUrl","refreshUrl","description","scopes"];default:return["type","flows","authorizationUrl","refreshUrl","tokenUrl","description","scopes"]}case"openIdConnect":return["type","openIdConnectUrl","description"];default:return["type","description"]}},extensionsPrefix:"x-"};t.DependentRequired={properties:{},additionalProperties:{type:"array",items:{type:"string"}}},t.Oas3_1Types={...i.Oas3Types,Info:{properties:{title:{type:"string"},version:{type:"string"},description:{type:"string"},termsOfService:{type:"string"},summary:{type:"string"},contact:"Contact",license:"License","x-logo":"Logo"},required:["title","version"],extensionsPrefix:"x-"},Root:{properties:{openapi:null,info:"Info",servers:"ServerList",security:"SecurityRequirementList",tags:"TagList",externalDocs:"ExternalDocs",paths:"Paths",webhooks:"WebhooksMap",components:"Components",jsonSchemaDialect:{type:"string"}},required:["openapi","info"],requiredOneOf:["paths","components","webhooks"],extensionsPrefix:"x-"},Schema:t.Schema,SchemaProperties:t.SchemaProperties,PatternProperties:t.SchemaProperties,License:{properties:{name:{type:"string"},url:{type:"string"},identifier:{type:"string"}},required:["name"],extensionsPrefix:"x-"},Components:{properties:{parameters:"NamedParameters",schemas:"NamedSchemas",responses:"NamedResponses",examples:"NamedExamples",requestBodies:"NamedRequestBodies",headers:"NamedHeaders",securitySchemes:"NamedSecuritySchemes",links:"NamedLinks",callbacks:"NamedCallbacks",pathItems:"NamedPathItems"},extensionsPrefix:"x-"},NamedPathItems:(0,r.mapOf)("PathItem"),SecurityScheme:o,Operation:{properties:{tags:{type:"array",items:{type:"string"}},summary:{type:"string"},description:{type:"string"},externalDocs:"ExternalDocs",operationId:{type:"string"},parameters:"ParameterList",security:"SecurityRequirementList",servers:"ServerList",requestBody:"RequestBody",responses:"Responses",deprecated:{type:"boolean"},callbacks:"CallbacksMap","x-codeSamples":"XCodeSampleList","x-code-samples":"XCodeSampleList","x-hideTryItPanel":{type:"boolean"}},extensionsPrefix:"x-"},DependentRequired:t.DependentRequired}},382:function(e,t,n){"use strict";t.Overlay1Types=void 0;const r=(0,n(1990).listOf)("Action");t.Overlay1Types={Root:{properties:{overlay:{type:"string"},info:"Info",extends:{type:"string"},actions:"Actions"},required:["overlay","info","actions"],extensionsPrefix:"x-"},Info:{properties:{title:{type:"string"},version:{type:"string"}},required:["title","version"],extensionsPrefix:"x-"},Actions:r,Action:{properties:{target:{type:"string"},description:{type:"string"},update:{},remove:{type:"boolean"}},required:["target"],extensionsPrefix:"x-"}}},750:function(e,t,n){"use strict";t.NormalizedConfigTypes=t.QB=void 0;const r=n(1510),i=n(1990),o=n(3101),s=n(8209),a=n(58),l=n(1990),c=["info-contact","operation-operationId","tag-description","tags-alphabetical","info-license-url","info-license-strict","info-license","no-ambiguous-paths","no-enum-type-mismatch","no-http-verbs-in-paths","no-identical-paths","no-invalid-parameter-examples","no-invalid-schema-examples","no-path-trailing-slash","operation-2xx-response","operation-4xx-response","operation-description","operation-operationId-unique","operation-operationId-url-safe","operation-parameters-unique","operation-singular-tag","operation-summary","operation-tag-defined","parameter-description","path-declaration-must-exist","path-excludes-patterns","path-http-verbs-order","path-not-include-query","path-params-defined","path-parameters-defined","path-segment-plural","paths-kebab-case","required-string-property-missing-min-length","response-contains-header","scalar-property-missing-example","security-defined","spec-strict-refs","no-unresolved-refs","no-required-schema-properties-undefined","no-schema-type-mismatch","boolean-parameter-prefixes","request-mime-type","response-contains-property","response-mime-type","info-contact","operation-operationId","tag-description","tags-alphabetical","info-license-url","info-license-strict","info-license","no-ambiguous-paths","no-enum-type-mismatch","no-http-verbs-in-paths","no-identical-paths","no-invalid-parameter-examples","no-invalid-schema-examples","no-path-trailing-slash","operation-2xx-response","operation-4xx-response","operation-description","operation-operationId-unique","operation-operationId-url-safe","operation-parameters-unique","operation-singular-tag","operation-summary","operation-tag-defined","parameter-description","path-declaration-must-exist","path-excludes-patterns","path-http-verbs-order","path-not-include-query","path-params-defined","path-parameters-defined","path-segment-plural","paths-kebab-case","required-string-property-missing-min-length","response-contains-header","scalar-property-missing-example","security-defined","spec-strict-refs","no-unresolved-refs","no-required-schema-properties-undefined","no-schema-type-mismatch","boolean-parameter-prefixes","component-name-unique","no-empty-servers","no-example-value-and-externalValue","no-invalid-media-type-examples","no-server-example.com","no-server-trailing-slash","no-server-variables-empty-enum","no-undefined-server-variable","no-unused-components","operation-4xx-problem-details-rfc7807","request-mime-type","response-contains-property","response-mime-type","spec-components-invalid-map-name","array-parameter-serialization","info-contact","info-license-strict","operation-operationId","tag-description","tags-alphabetical","channels-kebab-case","no-channel-trailing-slash","info-contact","info-license-strict","operation-operationId","tag-description","tags-alphabetical","channels-kebab-case","no-channel-trailing-slash","sourceDescription-type","workflowId-unique","stepId-unique","sourceDescription-name-unique","sourceDescriptions-not-empty","workflow-dependsOn","parameters-unique","step-onSuccess-unique","step-onFailure-unique","respect-supported-versions","requestBody-replacements-unique","no-criteria-xpath","criteria-unique","info-contact","spec","struct"],u={properties:{extends:{type:"array",items:{type:"string"}},rules:"Rules",oas2Rules:"Rules",oas3_0Rules:"Rules",oas3_1Rules:"Rules",async2Rules:"Rules",arazzo1Rules:"Rules",preprocessors:{type:"object"},oas2Preprocessors:{type:"object"},oas3_0Preprocessors:{type:"object"},oas3_1Preprocessors:{type:"object"},async2Preprocessors:{type:"object"},arazzoPreprocessors:{type:"object"},decorators:{type:"object"},oas2Decorators:{type:"object"},oas3_0Decorators:{type:"object"},oas3_1Decorators:{type:"object"},async2Decorators:{type:"object"},arazzo1Decorators:{type:"object"}}},p=e=>({...e.rootRedoclyConfigSchema,properties:{...e.rootRedoclyConfigSchema.properties,...u.properties,apis:"ConfigApis","features.openapi":"ConfigReferenceDocs","features.mockServer":"ConfigMockServer",organization:{type:"string"},region:{enum:["us","eu"]},telemetry:{enum:["on","off"]},resolve:{properties:{http:"ConfigHTTP",doNotResolveExamples:{type:"boolean"}}},files:{type:"array",items:{type:"string"}}}}),d=e=>({...e["rootRedoclyConfigSchema.apis_additionalProperties"],properties:{...e["rootRedoclyConfigSchema.apis_additionalProperties"]?.properties,labels:{type:"array",items:{type:"string"}},...u.properties,"features.openapi":"ConfigReferenceDocs","features.mockServer":"ConfigMockServer",files:{type:"array",items:{type:"string"}}}}),f={properties:{},additionalProperties:(e,t)=>t.startsWith("rule/")||t.startsWith("assert/")?"string"==typeof e?{enum:["error","warn","off"]}:"Assert":c.includes(t)||(0,s.isCustomRuleId)(t)?"string"==typeof e?{enum:["error","warn","off"]}:"ObjectRule":"metadata-schema"===t||"custom-fields-schema"===t?"Schema":void 0};function h(e){return{properties:{type:{enum:[...new Set(["any",...e,"SpecExtension"])]},property:e=>Array.isArray(e)?{type:"array",items:{type:"string"}}:null===e?null:{type:"string"},filterInParentKeys:{type:"array",items:{type:"string"}},filterOutParentKeys:{type:"array",items:{type:"string"}},matchParentKeys:{type:"string"}},required:["type"]}}const m={properties:{subject:"AssertionDefinitionSubject",assertions:"AssertionDefinitionAssertions",where:(0,i.listOf)("AssertDefinition"),message:{type:"string"},suggest:{type:"array",items:{type:"string"}},severity:{enum:["error","warn","off"]}},required:["subject","assertions"]},g={properties:{beforeInfo:(0,i.listOf)("CommonConfigSidebarLinks"),end:(0,i.listOf)("CommonConfigSidebarLinks")}},y={properties:{main:{type:"string"},light:{type:"string"},dark:{type:"string"},contrastText:{type:"string"}}},b={properties:(0,s.pickObjectProps)(y.properties,["light","dark"])},v={properties:(0,s.omitObjectProps)(y.properties,["dark"])},x={properties:{fontFamily:{type:"string"},fontSize:{type:"string"},fontWeight:{type:"string"},lineHeight:{type:"string"}}},w={properties:{...(0,s.omitObjectProps)(x.properties,["fontSize","lineHeight"]),borderRadius:{type:"string"},hoverStyle:{type:"string"},boxShadow:{type:"string"},hoverBoxShadow:{type:"string"},sizes:"Sizes"}},k={properties:(0,s.pickObjectProps)(x.properties,["fontSize","lineHeight"])},S={properties:{...(0,s.omitObjectProps)(x.properties,["fontSize","lineHeight"]),borderRadius:{type:"string"},color:{type:"string"},sizes:"BadgeSizes"}},E={properties:{subItemsColor:{type:"string"},textTransform:{type:"string"},fontWeight:{type:"string"}}},O={properties:(0,s.pickObjectProps)(E.properties,["textTransform"])},_={properties:{...(0,s.omitObjectProps)(x.properties,["fontWeight","lineHeight"]),activeBgColor:{type:"string"},activeTextColor:{type:"string"},backgroundColor:{type:"string"},borderRadius:{type:"string"},breakPath:{type:"boolean"},caretColor:{type:"string"},caretSize:{type:"string"},groupItems:"GroupItemsConfig",level1items:"Level1Items",rightLineColor:{type:"string"},separatorLabelColor:{type:"string"},showAtBreakpoint:{type:"string"},spacing:"SpacingConfig",textColor:{type:"string"},width:{type:"string"}}},P={properties:{...x.properties,color:{type:"string"},transform:{type:"string"}}},$={properties:{...x.properties,backgroundColor:{type:"string"},color:{type:"string"},wordBreak:{enum:["break-all","break-word","keep-all","normal","revert","unset","inherit","initial"]},wrap:{type:"boolean"}}},A={properties:(0,s.omitObjectProps)(x.properties,["fontSize"])},C={properties:{code:"CodeConfig",fieldName:"FontConfig",...(0,s.pickObjectProps)(x.properties,["fontSize","fontFamily"]),fontWeightBold:{type:"string"},fontWeightLight:{type:"string"},fontWeightRegular:{type:"string"},heading1:"Heading",heading2:"Heading",heading3:"Heading",headings:"HeadingsConfig",lineHeight:{type:"string"},links:"LinksConfig",optimizeSpeed:{type:"boolean"},rightPanelHeading:"Heading",smoothing:{enum:["auto","none","antialiased","subpixel-antialiased","grayscale"]}}},j={properties:{color:{type:"string"},...(0,s.omitObjectProps)(x.properties,["fontWeight"])}},T={properties:{skipOptionalParameters:{type:"boolean"},languages:(0,i.listOf)("ConfigLanguage")},required:["languages"]};const N={Assert:m,ConfigApis:{properties:{},additionalProperties:"ConfigApisProperties"},ConfigStyleguide:u,ConfigReferenceDocs:{properties:{theme:"ConfigTheme",corsProxyUrl:{type:"string"},ctrlFHijack:{type:"boolean"},defaultSampleLanguage:{type:"string"},disableDeepLinks:{type:"boolean"},disableSearch:{type:"boolean"},disableSidebar:{type:"boolean"},downloadDefinitionUrl:{type:"string"},expandDefaultServerVariables:{type:"boolean"},enumSkipQuotes:{type:"boolean"},expandDefaultRequest:{type:"boolean"},expandDefaultResponse:{type:"boolean"},expandResponses:{type:"string"},expandSingleSchemaField:{type:"boolean"},generateCodeSamples:"GenerateCodeSamples",generatedPayloadSamplesMaxDepth:{type:"number"},hideDownloadButton:{type:"boolean"},hideHostname:{type:"boolean"},hideInfoSection:{type:"boolean"},hideLoading:{type:"boolean"},hideLogo:{type:"boolean"},hideRequestPayloadSample:{type:"boolean"},hideRightPanel:{type:"boolean"},hideSchemaPattern:{type:"boolean"},hideSchemaTitles:{type:"boolean"},hideSingleRequestSampleTab:{type:"boolean"},hideSecuritySection:{type:"boolean"},hideTryItPanel:{type:"boolean"},hideFab:{type:"boolean"},hideOneOfDescription:{type:"boolean"},htmlTemplate:{type:"string"},jsonSampleExpandLevel:e=>"number"==typeof e?{type:"number",minimum:1}:{type:"string"},labels:"ConfigLabels",layout:{enum:["stacked","three-panel"]},maxDisplayedEnumValues:{type:"number"},menuToggle:{type:"boolean"},nativeScrollbars:{type:"boolean"},noAutoAuth:{type:"boolean"},oAuth2RedirectURI:{type:"string"},onDeepLinkClick:{type:"object"},onlyRequiredInSamples:{type:"boolean"},pagination:{enum:["none","section","item"]},pathInMiddlePanel:{type:"boolean"},payloadSampleIdx:{type:"number",minimum:0},requestInterceptor:{type:"object"},requiredPropsFirst:{type:"boolean"},routingBasePath:{type:"string"},routingStrategy:{type:"string"},samplesTabsMaxCount:{type:"number"},schemaExpansionLevel:e=>"number"==typeof e?{type:"number",minimum:0}:{type:"string"},schemaDefinitionsTagName:{type:"string"},minCharacterLengthToInitSearch:{type:"number",minimum:1},maxResponseHeadersToShowInTryIt:{type:"number",minimum:0},scrollYOffset:e=>"number"==typeof e?{type:"number"}:{type:"string"},searchAutoExpand:{type:"boolean"},searchFieldLevelBoost:{type:"number",minimum:0},searchMaxDepth:{type:"number",minimum:1},searchMode:{enum:["default","path-only"]},searchOperationTitleBoost:{type:"number"},searchTagTitleBoost:{type:"number"},sendXUserAgentInTryIt:{type:"boolean"},showChangeLayoutButton:{type:"boolean"},showConsole:{type:"boolean"},showExtensions:e=>"boolean"==typeof e?{type:"boolean"}:{type:"array",items:{type:"string"}},showNextButton:{type:"boolean"},showRightPanelToggle:{type:"boolean"},showSecuritySchemeType:{type:"boolean"},showWebhookVerb:{type:"boolean"},showObjectSchemaExamples:{type:"boolean"},disableTryItRequestUrlEncoding:{type:"boolean"},sidebarLinks:"ConfigSidebarLinks",sideNavStyle:{enum:["summary-only","path-first","id-only","path-only"]},simpleOneOfTypeLabel:{type:"boolean"},sortEnumValuesAlphabetically:{type:"boolean"},sortOperationsAlphabetically:{type:"boolean"},sortPropsAlphabetically:{type:"boolean"},sortTagsAlphabetically:{type:"boolean"},suppressWarnings:{type:"boolean"},unstable_externalDescription:{type:"boolean"},unstable_ignoreMimeParameters:{type:"boolean"},untrustedDefinition:{type:"boolean"},mockServer:{properties:{url:{type:"string"},position:{enum:["first","last","replace","off"]},description:{type:"string"}}},showAccessMode:{type:"boolean"},preserveOriginalExtensionsName:{type:"boolean"},markdownHeadingsAnchorLevel:{type:"number"}},additionalProperties:{}},ConfigMockServer:{properties:{strictExamples:{type:"boolean"},errorIfForcedExampleNotFound:{type:"boolean"}}},ConfigHTTP:{properties:{headers:{type:"array",items:{type:"string"}}}},ConfigLanguage:{properties:{label:{type:"string"},lang:{enum:["curl","C#","Go","Java","Java8+Apache","JavaScript","Node.js","PHP","Python","R","Ruby"]}},required:["lang"]},ConfigLabels:{properties:{enum:{type:"string"},enumSingleValue:{type:"string"},enumArray:{type:"string"},default:{type:"string"},deprecated:{type:"string"},example:{type:"string"},examples:{type:"string"},nullable:{type:"string"},recursive:{type:"string"},arrayOf:{type:"string"},webhook:{type:"string"},authorizations:{type:"string"},tryItAuthBasicUsername:{type:"string"},tryItAuthBasicPassword:{type:"string"}}},ConfigSidebarLinks:g,CommonConfigSidebarLinks:{properties:{label:{type:"string"},link:{type:"string"},target:{type:"string"}},required:["label","link"]},ConfigTheme:{properties:{breakpoints:"Breakpoints",codeBlock:"CodeBlock",colors:"ThemeColors",components:"ConfigThemeComponents",layout:"Layout",logo:"ConfigThemeLogo",fab:"Fab",overrides:"Overrides",rightPanel:"RightPanel",schema:"ConfigThemeSchema",shape:"Shape",sidebar:"Sidebar",spacing:"ThemeSpacing",typography:"Typography",links:{properties:{color:{type:"string"}}},codeSample:{properties:{backgroundColor:{type:"string"}}}}},AssertDefinition:{properties:{subject:"AssertionDefinitionSubject",assertions:"AssertionDefinitionAssertions"},required:["subject","assertions"]},ThemeColors:{properties:{accent:"CommonThemeColors",border:"BorderThemeColors",error:"CommonThemeColors",http:"HttpColors",primary:"CommonThemeColors",responses:"ResponseColors",secondary:"SecondaryColors",success:"CommonThemeColors",text:"TextThemeColors",tonalOffset:{type:"number"},warning:"CommonThemeColors"}},CommonThemeColors:y,BorderThemeColors:b,HttpColors:{properties:{basic:{type:"string"},delete:{type:"string"},get:{type:"string"},head:{type:"string"},link:{type:"string"},options:{type:"string"},patch:{type:"string"},post:{type:"string"},put:{type:"string"}}},ResponseColors:{properties:{error:"CommonColorProps",info:"CommonColorProps",redirect:"CommonColorProps",success:"CommonColorProps"}},SecondaryColors:v,TextThemeColors:{properties:{primary:{type:"string"},secondary:{type:"string"},light:{type:"string"}}},Sizes:{properties:{small:"SizeProps",medium:"SizeProps",large:"SizeProps",xlarge:"SizeProps"}},ButtonsConfig:w,CommonColorProps:{properties:{backgroundColor:{type:"string"},borderColor:{type:"string"},color:{type:"string"},tabTextColor:{type:"string"}}},BadgeFontConfig:k,BadgeSizes:{properties:{medium:"BadgeFontConfig",small:"BadgeFontConfig"}},HttpBadgesConfig:S,LabelControls:{properties:{top:{type:"string"},width:{type:"string"},height:{type:"string"}}},Panels:{properties:{borderRadius:{type:"string"},backgroundColor:{type:"string"}}},TryItButton:{properties:{fullWidth:{type:"boolean"}}},Breakpoints:{properties:{small:{type:"string"},medium:{type:"string"},large:{type:"string"}}},StackedConfig:{properties:{maxWidth:"Breakpoints"}},ThreePanelConfig:{properties:{maxWidth:"Breakpoints",middlePanelMaxWidth:"Breakpoints"}},SchemaColorsConfig:{properties:{backgroundColor:{type:"string"},border:{type:"string"}}},SizeProps:{properties:{fontSize:{type:"string"},padding:{type:"string"},minWidth:{type:"string"}}},Level1Items:O,SpacingConfig:{properties:{unit:{type:"number"},paddingHorizontal:{type:"string"},paddingVertical:{type:"string"},offsetTop:{type:"string"},offsetLeft:{type:"string"},offsetNesting:{type:"string"}}},FontConfig:x,CodeConfig:$,HeadingsConfig:A,LinksConfig:{properties:{color:{type:"string"},hover:{type:"string"},textDecoration:{type:"string"},hoverTextDecoration:{type:"string"},visited:{type:"string"}}},TokenProps:j,CodeBlock:{properties:{backgroundColor:{type:"string"},borderRadius:{type:"string"},tokens:"TokenProps"}},ConfigThemeLogo:{properties:{gutter:{type:"string"},maxHeight:{type:"string"},maxWidth:{type:"string"}}},Fab:{properties:{backgroundColor:{type:"string"},color:{type:"string"}}},ButtonOverrides:{properties:{custom:{type:"string"}}},Overrides:{properties:{DownloadButton:"ButtonOverrides",NextSectionButton:"ButtonOverrides"}},ObjectRule:{properties:{severity:{enum:["error","warn","off"]}},additionalProperties:{},required:["severity"]},Schema:{properties:{},additionalProperties:{}},RightPanel:{properties:{backgroundColor:{type:"string"},panelBackgroundColor:{type:"string"},panelControlsBackgroundColor:{type:"string"},showAtBreakpoint:{type:"string"},textColor:{type:"string"},width:{type:"string"}}},Rules:f,Shape:{properties:{borderRadius:{type:"string"}}},ThemeSpacing:{properties:{sectionHorizontal:{type:"number"},sectionVertical:{type:"number"},unit:{type:"number"}}},GenerateCodeSamples:T,GroupItemsConfig:E,ConfigThemeComponents:{properties:{buttons:"ButtonsConfig",httpBadges:"HttpBadgesConfig",layoutControls:"LabelControls",panels:"Panels",tryItButton:"TryItButton",tryItSendButton:"TryItButton"}},Layout:{properties:{showDarkRightPanel:{type:"boolean"},stacked:"StackedConfig","three-panel":"ThreePanelConfig"}},ConfigThemeSchema:{properties:{breakFieldNames:{type:"boolean"},caretColor:{type:"string"},caretSize:{type:"string"},constraints:"SchemaColorsConfig",defaultDetailsWidth:{type:"string"},examples:"SchemaColorsConfig",labelsTextSize:{type:"string"},linesColor:{type:"string"},nestedBackground:{type:"string"},nestingSpacing:{type:"string"},requireLabelColor:{type:"string"},typeNameColor:{type:"string"},typeTitleColor:{type:"string"}}},Sidebar:_,Heading:P,Typography:C,AssertionDefinitionAssertions:{properties:{enum:{type:"array",items:{type:"string"}},pattern:{type:"string"},notPattern:{type:"string"},casing:{enum:["camelCase","kebab-case","snake_case","PascalCase","MACRO_CASE","COBOL-CASE","flatcase"]},mutuallyExclusive:{type:"array",items:{type:"string"}},mutuallyRequired:{type:"array",items:{type:"string"}},required:{type:"array",items:{type:"string"}},requireAny:{type:"array",items:{type:"string"}},disallowed:{type:"array",items:{type:"string"}},defined:{type:"boolean"},nonEmpty:{type:"boolean"},minLength:{type:"integer"},maxLength:{type:"integer"},ref:e=>"string"==typeof e?{type:"string"}:{type:"boolean"},const:e=>"string"==typeof e?{type:"string"}:"number"==typeof e?{type:"number"}:"boolean"==typeof e?{type:"boolean"}:void 0},additionalProperties:(e,t)=>{if(/^\w+\/\w+$/.test(t))return{type:"object"}}}};t.QB=function(e,t){const n=Object.values(o.SpecVersion).flatMap(e=>{const n=t?.styleguide?t.styleguide.extendTypes((0,o.getTypes)(e),e):(0,o.getTypes)(e);return Object.keys(n)}),r=(0,a.getNodeTypesFromJSONSchema)("rootRedoclyConfigSchema",e);return{...N,ConfigRoot:p(r),ConfigApisProperties:d(r),AssertionDefinitionSubject:h(n),...r}}(r.rootRedoclyConfigSchema),t.NormalizedConfigTypes=(0,l.normalizeTypes)(t.QB)},5068:function(e,t){"use strict";t.VERSION_PATTERN=void 0,t.VERSION_PATTERN=/^1\.0\.\d+(-.+)?$/},8209:function(e,t,n){"use strict";t.assignConfig=t.parseYaml=void 0,t.pushStack=function(e,t){return{prev:e,value:t}},t.popStack=function(e){return e?.prev??null},t.isDefined=function(e){return void 0!==e},t.isPlainObject=c,t.isEmptyObject=function(e){return c(e)&&0===Object.keys(e).length},t.readFileFromUrl=async function(e,t){const n={};for(const r of t.headers)u(e,r.matches)&&(n[r.name]=void 0!==r.envVariable?s.env[r.envVariable]||"":r.value);const r=await(t.customFetch||fetch)(e,{headers:n});if(!r.ok)throw new Error(`Failed to load ${e}: ${r.status} ${r.statusText}`);return{body:await r.text(),mimeType:r.headers.get("content-type")}},t.pickObjectProps=function(e,t){return Object.fromEntries(t.filter(t=>t in e).map(t=>[t,e[t]]))},t.omitObjectProps=function(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e)))},t.slash=function(e){return/^\\\\\?\\/.test(e)?e:e.replace(/\\/g,"/")},t.assignOnlyExistingConfig=function(e,t){if(t)for(const n of Object.keys(t))e.hasOwnProperty(n)&&(c(e[n])&&"string"==typeof t[n]?e[n].severity=t[n]:e[n]=t[n])},t.isCustomRuleId=function(e){return e.includes("/")},t.doesYamlFileExist=function(e){return(".yaml"===(0,i.extname)(e)||".yml"===(0,i.extname)(e))&&r?.hasOwnProperty?.("existsSync")&&r.existsSync(e)},t.showWarningForDeprecatedField=function(e,t,n,r){const i=r?`Read more about this change: ${r}`:"";a.logger.warn(`The '${a.colorize.red(e)}' field is deprecated. ${t?`Use ${a.colorize.green(p(t,n))} instead. `:""}${i}\n`)},t.showErrorForDeprecatedField=function(e,t,n){throw new Error(`Do not use '${e}' field. ${t?`Use '${p(t,n)}' instead. `:""}\n`)},t.isTruthy=function(e){return!!e},t.identity=function(e){return e},t.nextTick=function(){return new Promise(e=>{setTimeout(e)})},t.dequal=function e(t,n){let r,i;if(t===n)return!0;if(t&&n&&(r=t.constructor)===n.constructor){if(r===Date)return t.getTime()===n.getTime();if(r===RegExp)return t.toString()===n.toString();if(r===Array){if((i=t.length)===n.length)for(;i--&&e(t[i],n[i]););return-1===i}if(!r||"object"==typeof t){for(r in i=0,t){if(Object.prototype.hasOwnProperty.call(t,r)&&++i&&!Object.prototype.hasOwnProperty.call(n,r))return!1;if(!(r in n)||!e(t[r],n[r]))return!1}return Object.keys(n).length===i}}return t!=t&&n!=n};const r=n(7411),i=n(7975),o=n(4536),s=(n(970),n(1827)),a=n(2678);n(3290),n(5127);var l=n(970);function c(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function u(e,t){return t.match(/^https?:\/\//)||(e=e.replace(/^https?:\/\//,"")),o(e,t)}function p(e,t){return`${void 0!==t?`${t}.`:""}${e}`}Object.defineProperty(t,"parseYaml",{enumerable:!0,get:function(){return l.parseYaml}}),t.assignConfig=(e,t)=>{if(t)for(const n of Object.keys(t))c(e[n])&&"string"==typeof t[n]?e[n].severity=t[n]:e[n]=t[n]}},2161:function(e,t,n){"use strict";t.normalizeVisitors=function(e,t){const n={any:{enter:[],leave:[]}};for(const e of Object.keys(t))n[e]={enter:[],leave:[]};n.ref={enter:[],leave:[]};for(const{ruleId:t,severity:n,message:r,visitor:i}of e)a({ruleId:t,severity:n,message:r},i,null);for(const e of Object.keys(n))n[e].enter.sort((e,t)=>t.depth-e.depth),n[e].leave.sort((e,t)=>e.depth-t.depth);return n;function o(e,t,i,s,a=[]){if(a.includes(t))return;a=[...a,t];const l=new Set;for(const n of Object.values(t.properties))n!==i?"object"==typeof n&&null!==n&&n.name&&l.add(n):c(e,a);t.additionalProperties&&"function"!=typeof t.additionalProperties&&(t.additionalProperties===i?c(e,a):void 0!==t.additionalProperties.name&&l.add(t.additionalProperties)),t.items&&"function"!=typeof t.items&&(t.items===i?c(e,a):void 0!==t.items.name&&l.add(t.items)),t.extensionsPrefix&&l.add(r.SpecExtension);for(const t of Array.from(l.values()))o(e,t,i,s,a);function c(e,t){for(const r of t.slice(1))n[r.name]=n[r.name]||{enter:[],leave:[]},n[r.name].enter.push({...e,visit:()=>{},depth:0,context:{isSkippedLevel:!0,seen:new Set,parent:s}})}}function s(e,t){if(Array.isArray(t)){const n=t.find(t=>e[t])||void 0;return n&&e[n]}return e[t]}function a(e,r,l,c=0){const u=Object.keys(t);if(0===c)u.push("any"),u.push("ref");else{if(r.any)throw new Error("any() is allowed only on top level");if(r.ref)throw new Error("ref() is allowed only on top level")}for(const p of u){const u=r[p]||s(r,i[p]),d=n[p];if(!u)continue;let f,h,m;const g="object"==typeof u;if("ref"===p&&g&&u.skip)throw new Error("ref() visitor does not support skip");"function"==typeof u?f=u:g&&(f=u.enter,h=u.leave,m=u.skip);const y={activatedOn:null,type:t[p],parent:l,isSkippedLevel:!1};if("object"==typeof u&&a(e,u,y,c+1),l&&o(e,l.type,t[p],l),f||g){if(f&&"function"!=typeof f)throw new Error("DEV: should be function");d.enter.push({...e,visit:f||(()=>{}),skip:m,depth:c,context:y})}if(h){if("function"!=typeof h)throw new Error("DEV: should be function");d.leave.push({...e,visit:h,depth:c,context:y})}}}};const r=n(1990),i={Root:"DefinitionRoot",ServerVariablesMap:"ServerVariableMap",Paths:["PathMap","PathsMap"],CallbacksMap:"CallbackMap",MediaTypesMap:"MediaTypeMap",ExamplesMap:"ExampleMap",EncodingMap:"EncodingsMap",HeadersMap:"HeaderMap",LinksMap:"LinkMap",OAuth2Flows:"SecuritySchemeFlows",Responses:"ResponsesMap"}},5735:function(e,t,n){"use strict";t.walkDocument=function(e){const{document:t,rootType:n,normalizedVisitors:l,resolvedRefMap:c,ctx:u}=e,p={},d=new Set;!function e(t,n,f,h,m){const g=(e,t=b.source.absoluteRef)=>{if(!(0,r.isRef)(e))return{location:f,node:e};const n=(0,o.makeRefId)(t,e.$ref),i=c.get(n);if(!i)return{location:void 0,node:void 0};const{resolved:s,node:a,document:l,nodePointer:u,error:p}=i;return{location:s?new r.Location(l.source,u):p instanceof o.YamlParseError?new r.Location(p.source,""):void 0,node:a,error:p}},y=f;let b=f;const{node:v,location:x,error:w}=g(t),k=new Set;if((0,r.isRef)(t)){const e=l.ref.enter;for(const{visit:r,ruleId:i,severity:o,message:s,context:a}of e)k.add(a),r(t,{report:E.bind(void 0,i,o,s),resolve:g,rawNode:t,rawLocation:y,location:f,type:n,parent:h,key:m,parentLocations:{},oasVersion:u.oasVersion,getVisitorData:O.bind(void 0,i)},{node:v,location:x,error:w}),x?.source.absoluteRef&&u.refTypes&&u.refTypes.set(x?.source.absoluteRef,n)}if(void 0!==v&&x&&"scalar"!==n.name){b=x;const o=p[n.name]?.has?.(v);let a=!1;const c=l.any.enter.concat(l[n.name]?.enter||[]),u=[];for(const{context:e,visit:r,skip:s,ruleId:l,severity:p,message:h}of c){if(d.has(`${b.absolutePointer}${b.pointer}`))break;if(e.isSkippedLevel)!e.parent.activatedOn||e.parent.activatedOn.value.nextLevelTypeActivated||e.seen.has(t)||(e.seen.add(t),a=!0,u.push(e));else if(e.parent&&e.parent.activatedOn&&e.activatedOn?.value.withParentNode!==e.parent.activatedOn.value.node&&e.parent.activatedOn.value.nextLevelTypeActivated?.value!==n||!e.parent&&!o){u.push(e);const o={node:v,location:x,nextLevelTypeActivated:null,withParentNode:e.parent?.activatedOn?.value.node,skipped:(e.parent?.activatedOn?.value.skipped||s?.(v,m,{location:f,rawLocation:y,resolve:g,rawNode:t}))??!1};e.activatedOn=(0,i.pushStack)(e.activatedOn,o);let c=e.parent;for(;c;)c.activatedOn.value.nextLevelTypeActivated=(0,i.pushStack)(c.activatedOn.value.nextLevelTypeActivated,n),c=c.parent;o.skipped||(a=!0,k.add(e),S(r,v,t,e,l,p,h))}}if(a||!o)if(p[n.name]=p[n.name]||new Set,p[n.name].add(v),Array.isArray(v)){const t=n.items;if(void 0!==t){const n="function"==typeof t;for(let r=0;r!i.includes(e))):n.extensionsPrefix&&i.push(...Object.keys(v).filter(e=>e.startsWith(n.extensionsPrefix))),(0,r.isRef)(t)&&i.push(...Object.keys(t).filter(e=>"$ref"!==e&&!i.includes(e)));for(const o of i){let i=v[o],a=x;void 0===i&&(i=t[o],a=f);let l=n.properties[o];void 0===l&&(l=n.additionalProperties),"function"==typeof l&&(l=l(i,o)),void 0===l&&n.extensionsPrefix&&o.startsWith(n.extensionsPrefix)&&(l=s.SpecExtension),!(0,s.isNamedType)(l)&&l?.directResolveAs&&(l=l.directResolveAs,i={$ref:i}),l&&void 0===l.name&&!1!==l.resolvable&&(l={name:"scalar",properties:{}}),(0,s.isNamedType)(l)&&("scalar"!==l.name||(0,r.isRef)(i))&&e(i,l,a.child([o]),v,o)}}const h=l.any.leave,w=(l[n.name]?.leave||[]).concat(h);for(const e of u.reverse())if(e.isSkippedLevel)e.seen.delete(v);else if(e.activatedOn=(0,i.popStack)(e.activatedOn),e.parent){let t=e.parent;for(;t;)t.activatedOn.value.nextLevelTypeActivated=(0,i.popStack)(t.activatedOn.value.nextLevelTypeActivated),t=t.parent}for(const{context:e,visit:n,ruleId:r,severity:i,message:o}of w)!e.isSkippedLevel&&k.has(e)&&S(n,v,t,e,r,i,o)}if(b=f,(0,r.isRef)(t)){const e=l.ref.leave;for(const{visit:r,ruleId:i,severity:o,context:s,message:a}of e)k.has(s)&&r(t,{report:E.bind(void 0,i,o,a),resolve:g,rawNode:t,rawLocation:y,location:f,type:n,parent:h,key:m,parentLocations:{},oasVersion:u.oasVersion,getVisitorData:O.bind(void 0,i)},{node:v,location:x,error:w})}function S(e,t,r,i,o,s,l){e(t,{report:E.bind(void 0,o,s,l),resolve:g,rawNode:r,location:b,rawLocation:y,type:n,parent:h,key:m,parentLocations:a(i),oasVersion:u.oasVersion,ignoreNextVisitorsOnNode:()=>{d.add(`${b.absolutePointer}${b.pointer}`)},getVisitorData:O.bind(void 0,o)},function(e){const t={};for(;e.parent;)t[e.parent.type.name]=e.parent.activatedOn?.value.node,e=e.parent;return t}(i),i)}function E(e,t,n,r){const i=(r.location?Array.isArray(r.location)?r.location:[r.location]:[{...b,reportOnKey:!1}]).map(e=>({...b,reportOnKey:!1,...e})),o=r.forceSeverity||t;"off"!==o&&u.problems.push({ruleId:r.ruleId||e,severity:o,...r,message:n?n.replace("{{message}}",r.message):r.message,suggest:r.suggest||[],location:i})}function O(e){return u.visitorsData[e]=u.visitorsData[e]||{},u.visitorsData[e]}}(t.parsed,n,new r.Location(t.source,"#/"),void 0,"")};const r=n(3873),i=n(8209),o=n(2928),s=n(1990);function a(e){const t={};for(;e.parent;)e.parent.activatedOn?.value.location&&(t[e.parent.type.name]=e.parent.activatedOn?.value.location),e=e.parent;return t}},1431:function(e,t,n){var r=n(8505);e.exports=function(e,t){if(!e)return[];var n=null==(t=t||{}).max?c:t.max,r=null==t.maxLength?u:t.maxLength;return"{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2)),x(function(e){return e.split("\\\\").join(i).split("\\{").join(o).split("\\}").join(s).split("\\,").join(a).split("\\.").join(l)}(e),n,r,!0).map(d)};var i="\0SLASH"+Math.random()+"\0",o="\0OPEN"+Math.random()+"\0",s="\0CLOSE"+Math.random()+"\0",a="\0COMMA"+Math.random()+"\0",l="\0PERIOD"+Math.random()+"\0",c=1e5,u=4e6;function p(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function d(e){return e.split(i).join("\\").split(o).join("{").split(s).join("}").split(a).join(",").split(l).join(".")}function f(e){if(!e)return[""];var t=[],n=r("{","}",e);if(!n)return e.split(",");var i=n.pre,o=n.body,s=n.post,a=i.split(",");a[a.length-1]+="{"+o+"}";var l=f(s);return s.length&&(a[a.length-1]+=l.shift(),a.push.apply(a,l)),t.push.apply(t,a),t}function h(e){return"{"+e+"}"}function m(e){return/^-?0\d/.test(e)}function g(e,t){return e<=t}function y(e,t){return e>=t}function b(e,t,n,r,i,o){for(var s=[],a=0,l=0;l=r)return s;var u=e[l]+t+n[c];if(!o||u){if(a+u.length>i)return s;s.push(u),a+=u.length}}return s}function v(e,t,n,r){var i=e.split(/\.\./),o=[];if(void 0===i[0]||void 0===i[1])return o;var s=p(i[0]),a=p(i[1]),l=Math.max(i[0].length,i[1].length),c=3===i.length&&void 0!==i[2]?Math.max(Math.abs(p(i[2])),1):1,u=g;a0){var x=new Array(v+1).join("0");b=h<0?"-"+x+b.slice(1):x+b}}if(f+b.length>r)break;o.push(b),f+=b.length}return o}function x(e,t,n,i){for(var o=[""],a=!1,l=!0;;){const P=r("{","}",e);if(!P)return b(o,e,[""],t,n,a);const $=P.pre;if(/\$$/.test($)){if(o=b(o,$+"{"+P.body+"}",[""],t,n,a&&!P.post.length),l=!1,!P.post.length)break;e=P.post}else{var c,u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(P.body),p=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(P.body),d=u||p,m=P.body.indexOf(",")>=0;if(!d&&!m){if(P.post.match(/,(?!,).*\}/)){e=P.pre+"{"+P.body+s+P.post,i=!0;continue}return b(o,$+"{"+P.body+"}"+P.post,[""],t,n,a)}if(l&&(a=i&&!d,l=!1),d)c=v(P.body,p,t,n);else{var g=f(P.body);if(1===g.length&&void 0!==g[0]&&1===(g=x(g[0],t,n,!1).map(h)).length){if(o=b(o,$+g[0],[""],t,n,a&&!P.post.length),!P.post.length)break;e=P.post;continue}for(var y=a&&!P.post.length&&!$,w=0;y&&w=t||k+_.length>n)break e;c.push(_),k+=_.length}}}if(o=b(o,$,c,t,n,a&&!P.post.length),!P.post.length)break;e=P.post}}return o}},4077:function(e){const t="object"==typeof process&&process&&!1;e.exports=t?{sep:"\\"}:{sep:"/"}},4536:function(e,t,n){const r=e.exports=(e,t,n={})=>(g(t),!(!n.nocomment&&"#"===t.charAt(0))&&new x(t,n).match(e));e.exports=r;const i=n(4077);r.sep=i.sep;const o=Symbol("globstar **");r.GLOBSTAR=o;const s=n(1431),a={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},l="[^/]",c=l+"*?",u=e=>e.split("").reduce((e,t)=>(e[t]=!0,e),{}),p=u("().*{}+?[]^$\\!"),d=u("[.("),f=/\/+/;r.filter=(e,t={})=>(n,i,o)=>r(n,e,t);const h=(e,t={})=>{const n={};return Object.keys(e).forEach(t=>n[t]=e[t]),Object.keys(t).forEach(e=>n[e]=t[e]),n};r.defaults=e=>{if(!e||"object"!=typeof e||!Object.keys(e).length)return r;const t=r,n=(n,r,i)=>t(n,r,h(e,i));return(n.Minimatch=class extends t.Minimatch{constructor(t,n){super(t,h(e,n))}}).defaults=n=>t.defaults(h(e,n)).Minimatch,n.filter=(n,r)=>t.filter(n,h(e,r)),n.defaults=n=>t.defaults(h(e,n)),n.makeRe=(n,r)=>t.makeRe(n,h(e,r)),n.braceExpand=(n,r)=>t.braceExpand(n,h(e,r)),n.match=(n,r,i)=>t.match(n,r,h(e,i)),n},r.braceExpand=(e,t)=>m(e,t);const m=(e,t={})=>(g(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:s(e)),g=e=>{if("string"!=typeof e)throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},y=Symbol("subparse");r.makeRe=(e,t)=>new x(e,t||{}).makeRe(),r.match=(e,t,n={})=>{const r=new x(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};const b=e=>e.replace(/\\([^-\]])/g,"$1"),v=e=>e.replace(/[[\]\\]/g,"\\$&");class x{constructor(e,t){g(e),t||(t={}),this.options=t,this.maxGlobstarRecursion=void 0!==t.maxGlobstarRecursion?t.maxGlobstarRecursion:200,this.set=[],this.pattern=e,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||!1===t.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.make()}debug(){}make(){const e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();let n=this.globSet=this.braceExpand();t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,n),n=this.globParts=n.map(e=>e.split(f)),this.debug(this.pattern,n),n=n.map((e,t,n)=>e.map(this.parse,this)),this.debug(this.pattern,n),n=n.filter(e=>-1===e.indexOf(!1)),this.debug(this.pattern,n),this.set=n}parseNegate(){if(this.options.nonegate)return;const e=this.pattern;let t=!1,n=0;for(let r=0;r=0;e--)if(t[e]===o){a=e;break}const l=t.slice(i,s),c=n?t.slice(s+1):t.slice(s+1,a),u=n?[]:t.slice(a+1);if(l.length){const t=e.slice(r,r+l.length);if(!this._matchOne(t,l,n,0,0))return!1;r+=l.length}let p=0;if(u.length){if(u.length+r>e.length)return!1;const t=e.length-u.length;if(this._matchOne(e,u,n,t,0))p=u.length;else{if(""!==e[e.length-1]||r+u.length===e.length)return!1;if(!this._matchOne(e,u,n,t-1,0))return!1;p=u.length+1}}if(!c.length){let t=!!p;for(let n=r;n"."===e.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",$=()=>{if(h){switch(h){case"*":r+=c,i=!0;break;case"?":r+=l,i=!0;break;default:r+="\\"+h}this.debug("clearStateChar %j %j",h,r),h=!1}};for(let t,o=0;o(n||(n="\\"),t+t+n+"|")),this.debug("tail=%j\n %s",e,e,x,r);const t="*"===x.type?c:"?"===x.type?l:"\\"+x.type;i=!0,r=r.slice(0,x.reStart)+t+"\\("+e}$(),s&&(r+="\\\\");const A=d[r.charAt(0)];for(let e=f.length-1;e>-1;e--){const n=f[e],i=r.slice(0,n.reStart),o=r.slice(n.reStart,n.reEnd-8);let s=r.slice(n.reEnd);const a=r.slice(n.reEnd-8,n.reEnd)+s,l=i.split(")").length,c=i.split("(").length-l;let u=s;for(let e=0;e(e=e.map(e=>"string"==typeof e?e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):e===o?o:e._src).reduce((e,t)=>(e[e.length-1]===o&&t===o||e.push(t),e),[]),e.forEach((t,r)=>{t===o&&e[r-1]!==o&&(0===r?e.length>1?e[r+1]="(?:\\/|"+n+"\\/)?"+e[r+1]:e[r]=n:r===e.length-1?e[r-1]+="(?:\\/|"+n+")?":(e[r-1]+="(?:\\/|\\/"+n+"\\/)"+e[r+1],e[r+1]=o))}),e.filter(e=>e!==o).join("/"))).join("|");i="^(?:"+i+")$",this.negate&&(i="^(?!"+i+").*$");try{this.regexp=new RegExp(i,r)}catch(e){this.regexp=!1}return this.regexp}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;const n=this.options;"/"!==i.sep&&(e=e.split(i.sep).join("/")),e=e.split(f),this.debug(this.pattern,"split",e);const r=this.set;let o;this.debug(this.pattern,"set",r);for(let t=e.length-1;t>=0&&(o=e[t],!o);t--);for(let i=0;i0){var u=j.utils.clone(t)||{};u.position=[o,a],u.index=i.length,i.push(new j.Token(r.slice(o,s),u))}o=s+1}}return i},j.tokenizer.separator=/[\\s\\-]+/,j.Pipeline=function(){this._stack=[]},j.Pipeline.registeredFunctions=Object.create(null),j.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&j.utils.warn("Overwriting existing registered function: "+t),e.label=t,j.Pipeline.registeredFunctions[e.label]=e},j.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||j.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\\n",e)},j.Pipeline.load=function(e){var t=new j.Pipeline;return e.forEach(function(e){var r=j.Pipeline.registeredFunctions[e];if(!r)throw new Error("Cannot load unregistered function: "+e);t.add(r)}),t},j.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach(function(e){j.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},j.Pipeline.prototype.after=function(e,t){j.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},j.Pipeline.prototype.before=function(e,t){j.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},j.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},j.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r1&&(se&&(r=i),s!=e);)n=r-t,i=t+Math.floor(n/2),s=this.elements[2*i];return s==e||s>e?2*i:sa?l+=2:o==a&&(t+=r[u+1]*n[l+1],u+=2,l+=2);return t},j.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},j.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t0){var s,o=i.str.charAt(0);o in i.node.edges?s=i.node.edges[o]:(s=new j.TokenSet,i.node.edges[o]=s),1==i.str.length&&(s.final=!0),n.push({node:s,editsRemaining:i.editsRemaining,str:i.str.slice(1)})}if(0!=i.editsRemaining){if("*"in i.node.edges)var a=i.node.edges["*"];else a=new j.TokenSet,i.node.edges["*"]=a;if(0==i.str.length&&(a.final=!0),n.push({node:a,editsRemaining:i.editsRemaining-1,str:i.str}),i.str.length>1&&n.push({node:i.node,editsRemaining:i.editsRemaining-1,str:i.str.slice(1)}),1==i.str.length&&(i.node.final=!0),i.str.length>=1){if("*"in i.node.edges)var u=i.node.edges["*"];else u=new j.TokenSet,i.node.edges["*"]=u;1==i.str.length&&(u.final=!0),n.push({node:u,editsRemaining:i.editsRemaining-1,str:i.str.slice(1)})}if(i.str.length>1){var l,c=i.str.charAt(0),h=i.str.charAt(1);h in i.node.edges?l=i.node.edges[h]:(l=new j.TokenSet,i.node.edges[h]=l),1==i.str.length&&(l.final=!0),n.push({node:l,editsRemaining:i.editsRemaining-1,str:c+i.str.slice(2)})}}}return r},j.TokenSet.fromString=function(e){for(var t=new j.TokenSet,r=t,n=0,i=e.length;n=e;t--){var r=this.uncheckedNodes[t],n=r.child.toString();n in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[n]:(r.child._str=n,this.minimizedNodes[n]=r.child),this.uncheckedNodes.pop()}},j.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},j.Index.prototype.search=function(e){return this.query(function(t){new j.QueryParser(e,t).parse()})},j.Index.prototype.query=function(e){for(var t=new j.Query(this.fields),r=Object.create(null),n=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a1?1:e},j.Builder.prototype.k1=function(e){this._k1=e},j.Builder.prototype.add=function(e,t){var r=e[this._ref],n=Object.keys(this._fields);this._documents[r]=t||{},this.documentCount+=1;for(var i=0;i=this.length)return j.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},j.QueryLexer.prototype.width=function(){return this.pos-this.start},j.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},j.QueryLexer.prototype.backup=function(){this.pos-=1},j.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=j.QueryLexer.EOS&&this.backup()},j.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(j.QueryLexer.TERM)),e.ignore(),e.more())return j.QueryLexer.lexText},j.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(j.QueryLexer.EDIT_DISTANCE),j.QueryLexer.lexText},j.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(j.QueryLexer.BOOST),j.QueryLexer.lexText},j.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(j.QueryLexer.TERM)},j.QueryLexer.termSeparator=j.tokenizer.separator,j.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==j.QueryLexer.EOS)return j.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return j.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit(j.QueryLexer.TERM),j.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit(j.QueryLexer.TERM),j.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit(j.QueryLexer.PRESENCE),j.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit(j.QueryLexer.PRESENCE),j.QueryLexer.lexText;if(t.match(j.QueryLexer.termSeparator))return j.QueryLexer.lexTerm}else e.escapeCharacter()}},j.QueryParser=function(e,t){this.lexer=new j.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0},j.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=j.QueryParser.parseClause;e;)e=e(this);return this.query},j.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},j.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},j.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},j.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case j.QueryLexer.PRESENCE:return j.QueryParser.parsePresence;case j.QueryLexer.FIELD:return j.QueryParser.parseField;case j.QueryLexer.TERM:return j.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(r+=" with value \'"+t.str+"\'"),new j.QueryParseError(r,t.start,t.end)}},j.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=j.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=j.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator\'"+t.str+"\'";throw new j.QueryParseError(r,t.start,t.end)}var n=e.peekLexeme();if(null==n)throw r="expecting term or field, found nothing",new j.QueryParseError(r,t.start,t.end);switch(n.type){case j.QueryLexer.FIELD:return j.QueryParser.parseField;case j.QueryLexer.TERM:return j.QueryParser.parseTerm;default:throw r="expecting term or field, found \'"+n.type+"\'",new j.QueryParseError(r,n.start,n.end)}}},j.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var r=e.query.allFields.map(function(e){return"\'"+e+"\'"}).join(", "),n="unrecognised field \'"+t.str+"\', possible fields: "+r;throw new j.QueryParseError(n,t.start,t.end)}e.currentClause.fields=[t.str];var i=e.peekLexeme();if(null==i)throw n="expecting term, found nothing",new j.QueryParseError(n,t.start,t.end);if(i.type===j.QueryLexer.TERM)return j.QueryParser.parseTerm;throw n="expecting term, found \'"+i.type+"\'",new j.QueryParseError(n,i.start,i.end)}},j.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(null!=r)switch(r.type){case j.QueryLexer.TERM:return e.nextClause(),j.QueryParser.parseTerm;case j.QueryLexer.FIELD:return e.nextClause(),j.QueryParser.parseField;case j.QueryLexer.EDIT_DISTANCE:return j.QueryParser.parseEditDistance;case j.QueryLexer.BOOST:return j.QueryParser.parseBoost;case j.QueryLexer.PRESENCE:return e.nextClause(),j.QueryParser.parsePresence;default:var n="Unexpected lexeme type \'"+r.type+"\'";throw new j.QueryParseError(n,r.start,r.end)}else e.nextClause()}},j.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var n="edit distance must be numeric";throw new j.QueryParseError(n,t.start,t.end)}e.currentClause.editDistance=r;var i=e.peekLexeme();if(null!=i)switch(i.type){case j.QueryLexer.TERM:return e.nextClause(),j.QueryParser.parseTerm;case j.QueryLexer.FIELD:return e.nextClause(),j.QueryParser.parseField;case j.QueryLexer.EDIT_DISTANCE:return j.QueryParser.parseEditDistance;case j.QueryLexer.BOOST:return j.QueryParser.parseBoost;case j.QueryLexer.PRESENCE:return e.nextClause(),j.QueryParser.parsePresence;default:throw n="Unexpected lexeme type \'"+i.type+"\'",new j.QueryParseError(n,i.start,i.end)}else e.nextClause()}},j.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var n="boost must be numeric";throw new j.QueryParseError(n,t.start,t.end)}e.currentClause.boost=r;var i=e.peekLexeme();if(null!=i)switch(i.type){case j.QueryLexer.TERM:return e.nextClause(),j.QueryParser.parseTerm;case j.QueryLexer.FIELD:return e.nextClause(),j.QueryParser.parseField;case j.QueryLexer.EDIT_DISTANCE:return j.QueryParser.parseEditDistance;case j.QueryLexer.BOOST:return j.QueryParser.parseBoost;case j.QueryLexer.PRESENCE:return e.nextClause(),j.QueryParser.parsePresence;default:throw n="Unexpected lexeme type \'"+i.type+"\'",new j.QueryParseError(n,i.start,i.end)}else e.nextClause()}},void 0===(i="function"==typeof(n=function(){return j})?n.call(t,r,t,e):n)||(e.exports=i)}()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var n={};!function(){"use strict";r.d(n,{add:function(){return c},dispose:function(){return y},done:function(){return h},fromExternalJS:function(){return f},load:function(){return p},search:function(){return m},toJS:function(){return d}});var e=r(291),t=(e,t,r)=>new Promise((n,i)=>{var s=e=>{try{a(r.next(e))}catch(e){i(e)}},o=e=>{try{a(r.throw(e))}catch(e){i(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(s,o);a((r=r.apply(e,t)).next())});let i,s,o,a=[];function u(){i=new e.Builder,i.field("title"),i.field("description"),i.ref("ref"),i.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),o=new Promise(e=>{s=e})}e.tokenizer.separator=/\\s+/,u();const l=t=>{const r=e.trimmer(new e.Token(t,{}));return"*"+e.stemmer(r)+"*"};function c(e,t,r){const n=a.push(r)-1,s={title:e.toLowerCase(),description:t.toLowerCase(),ref:n};i.add(s)}function h(){return t(this,null,function*(){s(i.build())})}function d(){return t(this,null,function*(){return{store:a,index:(yield o).toJSON()}})}function f(e,r){return t(this,null,function*(){try{if(importScripts(e),!self[r])throw new Error("Broken index file format");p(self[r])}catch(e){console.error("Failed to load search index: "+e.message)}})}function p(r){return t(this,null,function*(){a=r.store,s(e.Index.load(r.index))})}function y(){return t(this,null,function*(){a=[],u()})}function m(e,r=0){return t(this,null,function*(){if(0===e.trim().length)return[];let t=(yield o).query(t=>{e.trim().toLowerCase().split(/\\s+/).forEach(e=>{if(1===e.length)return;const r=l(e);t.term(r,{})})});return r>0&&(t=t.slice(0,r)),t.map(e=>({meta:a[e.ref],score:e.score}))})}addEventListener("message",function(e){var t,r=e.data,i=r.type,s=r.method,o=r.id,a=r.params;"RPC"===i&&s&&((t=n[s])?Promise.resolve().then(function(){return t.apply(n,a)}):Promise.reject("No such method")).then(function(e){postMessage({type:"RPC",id:o,result:e})}).catch(function(e){var t={message:e};e.stack&&(t.message=e.message,t.stack=e.stack,t.name=e.name),postMessage({type:"RPC",id:o,error:t})})}),postMessage({type:"RPC",method:"ready"})}()}();\n//# sourceMappingURL=d87bcbdbea8f8f5aa26f.worker.js.map'])),{name:"[fullhash].worker.js"});return r(e,i),e}},3224:function(e){e.exports=function(e,t){var n=0,r={};e.addEventListener("message",function(t){var n=t.data;if("RPC"===n.type)if(n.id){var i=r[n.id];i&&(delete r[n.id],n.error?i[1](Object.assign(Error(n.error.message),n.error)):i[0](n.result))}else{var o=document.createEvent("Event");o.initEvent(n.method,!1,!1),o.data=n.params,e.dispatchEvent(o)}}),t.forEach(function(t){e[t]=function(){var i=arguments;return new Promise(function(o,s){var a=++n;r[a]=[o,s],e.postMessage({type:"RPC",id:a,method:t,params:[].slice.call(i)})})}})}},8505:function(e){"use strict";function t(e,t,i){e instanceof RegExp&&(e=n(e,i)),t instanceof RegExp&&(t=n(t,i));var o=r(e,t,i);return o&&{start:o[0],end:o[1],pre:i.slice(0,o[0]),body:i.slice(o[0]+e.length,o[1]),post:i.slice(o[1]+t.length)}}function n(e,t){var n=t.match(e);return n?n[0]:null}function r(e,t,n){var r,i,o,s,a,l=n.indexOf(e),c=n.indexOf(t,l+1),u=l;if(l>=0&&c>0){if(e===t)return[l,c];for(r=[],o=n.length;u>=0&&!a;)u==l?(r.push(u),l=n.indexOf(e,u+1)):1==r.length?a=[r.pop(),c]:((i=r.pop())=0?l:c;r.length&&(a=[o,s])}return a}e.exports=t,t.range=r},3998:function(e,t,n){"use strict";var r=n(1137);e.exports=function(e,t){return e?void t.then(function(t){r(function(){e(null,t)})},function(t){r(function(){e(t)})}):t}},1137:function(e){"use strict";e.exports="object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:"function"==typeof setImmediate?setImmediate:function(e){setTimeout(e,0)}},2485:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e=[],t=0;tu;)if((a=l[u++])!=a)return!0}else for(;c>u;u++)if((e||u in l)&&l[u]===n)return e||u||0;return!e&&-1}};e.exports={includes:s(!0),indexOf:s(!1)}},1344:function(e,t,n){var r=n(6885),i=n(8664),o=n(2612),s=n(3747),a=n(2998),l=[].push,c=function(e){var t=1==e,n=2==e,c=3==e,u=4==e,p=6==e,d=7==e,f=5==e||p;return function(h,m,g,y){for(var b,v,x=o(h),w=i(x),k=r(m,g,3),S=s(w.length),E=0,O=y||a,_=t?O(h,S):n||d?O(h,0):void 0;S>E;E++)if((f||E in w)&&(v=k(b=w[E],E,x),e))if(t)_[E]=v;else if(v)switch(e){case 3:return!0;case 5:return b;case 6:return E;case 2:l.call(_,b)}else switch(e){case 4:return!1;case 7:l.call(_,b)}return p?-1:c||u?u:_}};e.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6),filterOut:c(7)}},5634:function(e,t,n){var r=n(2074),i=n(1602),o=n(6845),s=i("species");e.exports=function(e){return o>=51||!r(function(){var t=[];return(t.constructor={})[s]=function(){return{foo:1}},1!==t[e](Boolean).foo})}},2998:function(e,t,n){var r=n(5335),i=n(8679),o=n(1602)("species");e.exports=function(e,t){var n;return i(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!i(n.prototype)?r(n)&&null===(n=n[o])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},8569:function(e){var t={}.toString;e.exports=function(e){return t.call(e).slice(8,-1)}},3062:function(e,t,n){var r=n(3129),i=n(8569),o=n(1602)("toStringTag"),s="Arguments"==i(function(){return arguments}());e.exports=r?i:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),o))?n:s?i(t):"Object"==(r=i(t))&&"function"==typeof t.callee?"Arguments":r}},4361:function(e,t,n){var r=n(1883),i=n(5816),o=n(7632),s=n(3610);e.exports=function(e,t){for(var n=i(t),a=s.f,l=o.f,c=0;c=74)&&(r=s.match(/Chrome\/(\d+)/))&&(i=r[1]),e.exports=i&&+i},290:function(e){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},1605:function(e,t,n){var r=n(200),i=n(7632).f,o=n(7712),s=n(7485),a=n(5975),l=n(4361),c=n(4977);e.exports=function(e,t){var n,u,p,d,f,h=e.target,m=e.global,g=e.stat;if(n=m?r:g?r[h]||a(h,{}):(r[h]||{}).prototype)for(u in t){if(d=t[u],p=e.noTargetGet?(f=i(n,u))&&f.value:n[u],!c(m?u:h+(g?".":"#")+u,e.forced)&&void 0!==p){if(typeof d==typeof p)continue;l(d,p)}(e.sham||p&&p.sham)&&o(d,"sham",!0),s(n,u,d,e)}}},2074:function(e){e.exports=function(e){try{return!!e()}catch(e){return!0}}},6885:function(e,t,n){var r=n(9085);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},6492:function(e,t,n){var r=n(9720),i=n(200),o=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?o(r[e])||o(i[e]):r[e]&&r[e][t]||i[e]&&i[e][t]}},200:function(e,t,n){var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},1883:function(e,t,n){var r=n(2612),i={}.hasOwnProperty;e.exports=Object.hasOwn||function(e,t){return i.call(r(e),t)}},7708:function(e){e.exports={}},8890:function(e,t,n){var r=n(6492);e.exports=r("document","documentElement")},7694:function(e,t,n){var r=n(5077),i=n(2074),o=n(3262);e.exports=!r&&!i(function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a})},8664:function(e,t,n){var r=n(2074),i=n(8569),o="".split;e.exports=r(function(){return!Object("z").propertyIsEnumerable(0)})?function(e){return"String"==i(e)?o.call(e,""):Object(e)}:Object},9965:function(e,t,n){var r=n(9310),i=Function.toString;"function"!=typeof r.inspectSource&&(r.inspectSource=function(e){return i.call(e)}),e.exports=r.inspectSource},9206:function(e,t,n){var r,i,o,s=n(2886),a=n(200),l=n(5335),c=n(7712),u=n(1883),p=n(9310),d=n(5904),f=n(7708),h="Object already initialized",m=a.WeakMap;if(s||p.state){var g=p.state||(p.state=new m),y=g.get,b=g.has,v=g.set;r=function(e,t){if(b.call(g,e))throw new TypeError(h);return t.facade=e,v.call(g,e,t),t},i=function(e){return y.call(g,e)||{}},o=function(e){return b.call(g,e)}}else{var x=d("state");f[x]=!0,r=function(e,t){if(u(e,x))throw new TypeError(h);return t.facade=e,c(e,x,t),t},i=function(e){return u(e,x)?e[x]:{}},o=function(e){return u(e,x)}}e.exports={set:r,get:i,has:o,enforce:function(e){return o(e)?i(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!l(t)||(n=i(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}}},8679:function(e,t,n){var r=n(8569);e.exports=Array.isArray||function(e){return"Array"==r(e)}},4977:function(e,t,n){var r=n(2074),i=/#|\.prototype\./,o=function(e,t){var n=a[s(e)];return n==c||n!=l&&("function"==typeof t?r(t):!!t)},s=o.normalize=function(e){return String(e).replace(i,".").toLowerCase()},a=o.data={},l=o.NATIVE="N",c=o.POLYFILL="P";e.exports=o},5335:function(e){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},6926:function(e){e.exports=!1},1849:function(e,t,n){var r=n(6845),i=n(2074);e.exports=!!Object.getOwnPropertySymbols&&!i(function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41})},2886:function(e,t,n){var r=n(200),i=n(9965),o=r.WeakMap;e.exports="function"==typeof o&&/native code/.test(i(o))},3105:function(e,t,n){var r,i=n(3938),o=n(5318),s=n(290),a=n(7708),l=n(8890),c=n(3262),u=n(5904),p="prototype",d="script",f=u("IE_PROTO"),h=function(){},m=function(e){return"<"+d+">"+e+""},g=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e,t,n;g=r?function(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t}(r):(t=c("iframe"),n="java"+d+":",t.style.display="none",l.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(m("document.F=Object")),e.close(),e.F);for(var i=s.length;i--;)delete g[p][s[i]];return g()};a[f]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(h[p]=i(e),n=new h,h[p]=null,n[f]=e):n=g(),void 0===t?n:o(n,t)}},5318:function(e,t,n){var r=n(5077),i=n(3610),o=n(3938),s=n(1641);e.exports=r?Object.defineProperties:function(e,t){o(e);for(var n,r=s(t),a=r.length,l=0;a>l;)i.f(e,n=r[l++],t[n]);return e}},3610:function(e,t,n){var r=n(5077),i=n(7694),o=n(3938),s=n(874),a=Object.defineProperty;t.f=r?a:function(e,t,n){if(o(e),t=s(t,!0),o(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},7632:function(e,t,n){var r=n(5077),i=n(9304),o=n(6843),s=n(5476),a=n(874),l=n(1883),c=n(7694),u=Object.getOwnPropertyDescriptor;t.f=r?u:function(e,t){if(e=s(e),t=a(t,!0),c)try{return u(e,t)}catch(e){}if(l(e,t))return o(!i.f.call(e,t),e[t])}},6509:function(e,t,n){var r=n(5476),i=n(4789).f,o={}.toString,s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return s&&"[object Window]"==o.call(e)?function(e){try{return i(e)}catch(e){return s.slice()}}(e):i(r(e))}},4789:function(e,t,n){var r=n(6347),i=n(290).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},8916:function(e,t){t.f=Object.getOwnPropertySymbols},6347:function(e,t,n){var r=n(1883),i=n(5476),o=n(8186).indexOf,s=n(7708);e.exports=function(e,t){var n,a=i(e),l=0,c=[];for(n in a)!r(s,n)&&r(a,n)&&c.push(n);for(;t.length>l;)r(a,n=t[l++])&&(~o(c,n)||c.push(n));return c}},1641:function(e,t,n){var r=n(6347),i=n(290);e.exports=Object.keys||function(e){return r(e,i)}},9304:function(e,t){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!n.call({1:2},1);t.f=i?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},4972:function(e,t,n){"use strict";var r=n(3129),i=n(3062);e.exports=r?{}.toString:function(){return"[object "+i(this)+"]"}},5816:function(e,t,n){var r=n(6492),i=n(4789),o=n(8916),s=n(3938);e.exports=r("Reflect","ownKeys")||function(e){var t=i.f(s(e)),n=o.f;return n?t.concat(n(e)):t}},9720:function(e,t,n){var r=n(200);e.exports=r},7485:function(e,t,n){var r=n(200),i=n(7712),o=n(1883),s=n(5975),a=n(9965),l=n(9206),c=l.get,u=l.enforce,p=String(String).split("String");(e.exports=function(e,t,n,a){var l,c=!!a&&!!a.unsafe,d=!!a&&!!a.enumerable,f=!!a&&!!a.noTargetGet;"function"==typeof n&&("string"!=typeof t||o(n,"name")||i(n,"name",t),(l=u(n)).source||(l.source=p.join("string"==typeof t?t:""))),e!==r?(c?!f&&e[t]&&(d=!0):delete e[t],d?e[t]=n:i(e,t,n)):d?e[t]=n:s(t,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&c(this).source||a(this)})},1229:function(e){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},5975:function(e,t,n){var r=n(200),i=n(7712);e.exports=function(e,t){try{i(r,e,t)}catch(n){r[e]=t}return t}},5282:function(e,t,n){var r=n(3610).f,i=n(1883),o=n(1602)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},5904:function(e,t,n){var r=n(2),i=n(665),o=r("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},9310:function(e,t,n){var r=n(200),i=n(5975),o="__core-js_shared__",s=r[o]||i(o,{});e.exports=s},2:function(e,t,n){var r=n(6926),i=n(9310);(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.14.0",mode:r?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},6539:function(e,t,n){var r=n(7317),i=Math.max,o=Math.min;e.exports=function(e,t){var n=r(e);return n<0?i(n+t,0):o(n,t)}},5476:function(e,t,n){var r=n(8664),i=n(1229);e.exports=function(e){return r(i(e))}},7317:function(e){var t=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:t)(e)}},3747:function(e,t,n){var r=n(7317),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},2612:function(e,t,n){var r=n(1229);e.exports=function(e){return Object(r(e))}},874:function(e,t,n){var r=n(5335);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},3129:function(e,t,n){var r={};r[n(1602)("toStringTag")]="z",e.exports="[object z]"===String(r)},665:function(e){var t=0,n=Math.random();e.exports=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++t+n).toString(36)}},5225:function(e,t,n){var r=n(1849);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},802:function(e,t,n){var r=n(1602);t.f=r},1602:function(e,t,n){var r=n(200),i=n(2),o=n(1883),s=n(665),a=n(1849),l=n(5225),c=i("wks"),u=r.Symbol,p=l?u:u&&u.withoutSetter||s;e.exports=function(e){return o(c,e)&&(a||"string"==typeof c[e])||(a&&o(u,e)?c[e]=u[e]:c[e]=p("Symbol."+e)),c[e]}},115:function(e,t,n){"use strict";var r=n(1605),i=n(2074),o=n(8679),s=n(5335),a=n(2612),l=n(3747),c=n(2057),u=n(2998),p=n(5634),d=n(1602),f=n(6845),h=d("isConcatSpreadable"),m=9007199254740991,g="Maximum allowed index exceeded",y=f>=51||!i(function(){var e=[];return e[h]=!1,e.concat()[0]!==e}),b=p("concat"),v=function(e){if(!s(e))return!1;var t=e[h];return void 0!==t?!!t:o(e)};r({target:"Array",proto:!0,forced:!y||!b},{concat:function(e){var t,n,r,i,o,s=a(this),p=u(s,0),d=0;for(t=-1,r=arguments.length;tm)throw TypeError(g);for(n=0;n=m)throw TypeError(g);c(p,d++,o)}return p.length=d,p}})},1586:function(e,t,n){var r=n(200);n(5282)(r.JSON,"JSON",!0)},6982:function(e,t,n){n(5282)(Math,"Math",!0)},5086:function(e,t,n){var r=n(3129),i=n(7485),o=n(4972);r||i(Object.prototype,"toString",o,{unsafe:!0})},3719:function(e,t,n){var r=n(1605),i=n(200),o=n(5282);r({global:!0},{Reflect:{}}),o(i.Reflect,"Reflect",!0)},7727:function(e,t,n){n(1272)("asyncIterator")},590:function(e,t,n){"use strict";var r=n(1605),i=n(5077),o=n(200),s=n(1883),a=n(5335),l=n(3610).f,c=n(4361),u=o.Symbol;if(i&&"function"==typeof u&&(!("description"in u.prototype)||void 0!==u().description)){var p={},d=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof d?new u(e):void 0===e?u():u(e);return""===e&&(p[t]=!0),t};c(d,u);var f=d.prototype=u.prototype;f.constructor=d;var h=f.toString,m="Symbol(test)"==String(u("test")),g=/^Symbol\((.*)\)[^)]+$/;l(f,"description",{configurable:!0,get:function(){var e=a(this)?this.valueOf():this,t=h.call(e);if(s(p,e))return"";var n=m?t.slice(7,-1):t.replace(g,"$1");return""===n?void 0:n}}),r({global:!0,forced:!0},{Symbol:d})}},8290:function(e,t,n){n(1272)("hasInstance")},2619:function(e,t,n){n(1272)("isConcatSpreadable")},4216:function(e,t,n){n(1272)("iterator")},3534:function(e,t,n){"use strict";var r=n(1605),i=n(200),o=n(6492),s=n(6926),a=n(5077),l=n(1849),c=n(5225),u=n(2074),p=n(1883),d=n(8679),f=n(5335),h=n(3938),m=n(2612),g=n(5476),y=n(874),b=n(6843),v=n(3105),x=n(1641),w=n(4789),k=n(6509),S=n(8916),E=n(7632),O=n(3610),_=n(9304),P=n(7712),$=n(7485),A=n(2),C=n(5904),j=n(7708),T=n(665),N=n(1602),I=n(802),R=n(1272),L=n(5282),D=n(9206),M=n(1344).forEach,z=C("hidden"),F="Symbol",U="prototype",q=N("toPrimitive"),B=D.set,V=D.getterFor(F),W=Object[U],H=i.Symbol,Y=o("JSON","stringify"),G=E.f,K=O.f,Q=k.f,X=_.f,J=A("symbols"),Z=A("op-symbols"),ee=A("string-to-symbol-registry"),te=A("symbol-to-string-registry"),ne=A("wks"),re=i.QObject,ie=!re||!re[U]||!re[U].findChild,oe=a&&u(function(){return 7!=v(K({},"a",{get:function(){return K(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=G(W,t);r&&delete W[t],K(e,t,n),r&&e!==W&&K(W,t,r)}:K,se=function(e,t){var n=J[e]=v(H[U]);return B(n,{type:F,tag:e,description:t}),a||(n.description=t),n},ae=c?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof H},le=function(e,t,n){e===W&&le(Z,t,n),h(e);var r=y(t,!0);return h(n),p(J,r)?(n.enumerable?(p(e,z)&&e[z][r]&&(e[z][r]=!1),n=v(n,{enumerable:b(0,!1)})):(p(e,z)||K(e,z,b(1,{})),e[z][r]=!0),oe(e,r,n)):K(e,r,n)},ce=function(e,t){h(e);var n=g(t),r=x(n).concat(fe(n));return M(r,function(t){a&&!ue.call(n,t)||le(e,t,n[t])}),e},ue=function(e){var t=y(e,!0),n=X.call(this,t);return!(this===W&&p(J,t)&&!p(Z,t))&&(!(n||!p(this,t)||!p(J,t)||p(this,z)&&this[z][t])||n)},pe=function(e,t){var n=g(e),r=y(t,!0);if(n!==W||!p(J,r)||p(Z,r)){var i=G(n,r);return!i||!p(J,r)||p(n,z)&&n[z][r]||(i.enumerable=!0),i}},de=function(e){var t=Q(g(e)),n=[];return M(t,function(e){p(J,e)||p(j,e)||n.push(e)}),n},fe=function(e){var t=e===W,n=Q(t?Z:g(e)),r=[];return M(n,function(e){!p(J,e)||t&&!p(W,e)||r.push(J[e])}),r};l||(H=function(){if(this instanceof H)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=T(e),n=function(e){this===W&&n.call(Z,e),p(this,z)&&p(this[z],t)&&(this[z][t]=!1),oe(this,t,b(1,e))};return a&&ie&&oe(W,t,{configurable:!0,set:n}),se(t,e)},$(H[U],"toString",function(){return V(this).tag}),$(H,"withoutSetter",function(e){return se(T(e),e)}),_.f=ue,O.f=le,E.f=pe,w.f=k.f=de,S.f=fe,I.f=function(e){return se(N(e),e)},a&&(K(H[U],"description",{configurable:!0,get:function(){return V(this).description}}),s||$(W,"propertyIsEnumerable",ue,{unsafe:!0}))),r({global:!0,wrap:!0,forced:!l,sham:!l},{Symbol:H}),M(x(ne),function(e){R(e)}),r({target:F,stat:!0,forced:!l},{for:function(e){var t=String(e);if(p(ee,t))return ee[t];var n=H(t);return ee[t]=n,te[n]=t,n},keyFor:function(e){if(!ae(e))throw TypeError(e+" is not a symbol");if(p(te,e))return te[e]},useSetter:function(){ie=!0},useSimple:function(){ie=!1}}),r({target:"Object",stat:!0,forced:!l,sham:!a},{create:function(e,t){return void 0===t?v(e):ce(v(e),t)},defineProperty:le,defineProperties:ce,getOwnPropertyDescriptor:pe}),r({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:de,getOwnPropertySymbols:fe}),r({target:"Object",stat:!0,forced:u(function(){S.f(1)})},{getOwnPropertySymbols:function(e){return S.f(m(e))}}),Y&&r({target:"JSON",stat:!0,forced:!l||u(function(){var e=H();return"[null]"!=Y([e])||"{}"!=Y({a:e})||"{}"!=Y(Object(e))})},{stringify:function(e,t,n){for(var r,i=[e],o=1;arguments.length>o;)i.push(arguments[o++]);if(r=t,(f(t)||void 0!==e)&&!ae(e))return d(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!ae(t))return t}),i[1]=t,Y.apply(null,i)}}),H[U][q]||P(H[U],q,H[U].valueOf),L(H,F),j[z]=!0},6195:function(e,t,n){n(1272)("matchAll")},2957:function(e,t,n){n(1272)("match")},4100:function(e,t,n){n(1272)("replace")},3006:function(e,t,n){n(1272)("search")},4910:function(e,t,n){n(1272)("species")},2820:function(e,t,n){n(1272)("split")},6611:function(e,t,n){n(1272)("toPrimitive")},9576:function(e,t,n){n(1272)("toStringTag")},9747:function(e,t,n){n(1272)("unscopables")},8997:function(e,t,n){"use strict";var r=n(4991),i=n.n(r),o=n(6314),s=n.n(o)()(i());s.push([e.id,".ps{overflow:hidden!important;overflow-anchor:none;-ms-overflow-style:none;touch-action:auto;-ms-touch-action:auto}.ps__rail-x{display:none;opacity:0;transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;height:15px;bottom:0;position:absolute}.ps__rail-y{display:none;opacity:0;transition:background-color .2s linear,opacity .2s linear;-webkit-transition:background-color .2s linear,opacity .2s linear;width:15px;right:0;position:absolute}.ps--active-x>.ps__rail-x,.ps--active-y>.ps__rail-y{display:block;background-color:transparent}.ps:hover>.ps__rail-x,.ps:hover>.ps__rail-y,.ps--focus>.ps__rail-x,.ps--focus>.ps__rail-y,.ps--scrolling-x>.ps__rail-x,.ps--scrolling-y>.ps__rail-y{opacity:.6}.ps .ps__rail-x:hover,.ps .ps__rail-y:hover,.ps .ps__rail-x:focus,.ps .ps__rail-y:focus,.ps .ps__rail-x.ps--clicking,.ps .ps__rail-y.ps--clicking{background-color:#eee;opacity:.9}.ps__thumb-x{background-color:#aaa;border-radius:6px;transition:background-color .2s linear,height .2s ease-in-out;-webkit-transition:background-color .2s linear,height .2s ease-in-out;height:6px;bottom:2px;position:absolute}.ps__thumb-y{background-color:#aaa;border-radius:6px;transition:background-color .2s linear,width .2s ease-in-out;-webkit-transition:background-color .2s linear,width .2s ease-in-out;width:6px;right:2px;position:absolute}.ps__rail-x:hover>.ps__thumb-x,.ps__rail-x:focus>.ps__thumb-x,.ps__rail-x.ps--clicking .ps__thumb-x{background-color:#999;height:11px}.ps__rail-y:hover>.ps__thumb-y,.ps__rail-y:focus>.ps__thumb-y,.ps__rail-y.ps--clicking .ps__thumb-y{background-color:#999;width:11px}@supports (-ms-overflow-style: none){.ps{overflow:auto!important}}@media screen and (-ms-high-contrast: active),(-ms-high-contrast: none){.ps{overflow:auto!important}}\n","",{version:3,sources:["webpack://./node_modules/perfect-scrollbar/css/perfect-scrollbar.css"],names:[],mappings:"AAGA,IACE,yBAAU,CACV,oBAAiB,CACjB,uBAAoB,CACpB,iBAAc,CACd,qBACF,CAKA,YACE,YAAS,CACT,SAAS,CACT,yDAAqD,CACrD,iEAA6D,CAC7D,WAAQ,CAER,QAAQ,CAER,iBACF,CAEA,YACE,YAAS,CACT,SAAS,CACT,yDAAqD,CACrD,iEAA6D,CAC7D,UAAO,CAEP,OAAO,CAEP,iBACF,CAEA,oDAEE,aAAS,CACT,4BACF,CAEA,oJAME,UACF,CAEA,kJAME,qBAAkB,CAClB,UACF,CAKA,aACE,qBAAkB,CAnEpB,iBAoEiB,CACf,6DAAoD,CACpD,qEAA4D,CAC5D,UAAQ,CAER,UAAQ,CAER,iBACF,CAEA,aACE,qBAAkB,CA/EpB,iBAgFiB,CACf,4DAAmD,CACnD,oEAA2D,CAC3D,SAAO,CAEP,SAAO,CAEP,iBACF,CAEA,oGAGE,qBAAkB,CAClB,WACF,CAEA,oGAGE,qBAAkB,CAClB,UACF,CAGA,qCACE,IACE,uBACF,CACF,CAEA,wEACE,IACE,uBACF,CACF",sourcesContent:["/*\n * Container style\n */\n.ps {\n overflow: hidden !important;\n overflow-anchor: none;\n -ms-overflow-style: none;\n touch-action: auto;\n -ms-touch-action: auto;\n}\n\n/*\n * Scrollbar rail styles\n */\n.ps__rail-x {\n display: none;\n opacity: 0;\n transition: background-color .2s linear, opacity .2s linear;\n -webkit-transition: background-color .2s linear, opacity .2s linear;\n height: 15px;\n /* there must be 'bottom' or 'top' for ps__rail-x */\n bottom: 0px;\n /* please don't change 'position' */\n position: absolute;\n}\n\n.ps__rail-y {\n display: none;\n opacity: 0;\n transition: background-color .2s linear, opacity .2s linear;\n -webkit-transition: background-color .2s linear, opacity .2s linear;\n width: 15px;\n /* there must be 'right' or 'left' for ps__rail-y */\n right: 0;\n /* please don't change 'position' */\n position: absolute;\n}\n\n.ps--active-x > .ps__rail-x,\n.ps--active-y > .ps__rail-y {\n display: block;\n background-color: transparent;\n}\n\n.ps:hover > .ps__rail-x,\n.ps:hover > .ps__rail-y,\n.ps--focus > .ps__rail-x,\n.ps--focus > .ps__rail-y,\n.ps--scrolling-x > .ps__rail-x,\n.ps--scrolling-y > .ps__rail-y {\n opacity: 0.6;\n}\n\n.ps .ps__rail-x:hover,\n.ps .ps__rail-y:hover,\n.ps .ps__rail-x:focus,\n.ps .ps__rail-y:focus,\n.ps .ps__rail-x.ps--clicking,\n.ps .ps__rail-y.ps--clicking {\n background-color: #eee;\n opacity: 0.9;\n}\n\n/*\n * Scrollbar thumb styles\n */\n.ps__thumb-x {\n background-color: #aaa;\n border-radius: 6px;\n transition: background-color .2s linear, height .2s ease-in-out;\n -webkit-transition: background-color .2s linear, height .2s ease-in-out;\n height: 6px;\n /* there must be 'bottom' for ps__thumb-x */\n bottom: 2px;\n /* please don't change 'position' */\n position: absolute;\n}\n\n.ps__thumb-y {\n background-color: #aaa;\n border-radius: 6px;\n transition: background-color .2s linear, width .2s ease-in-out;\n -webkit-transition: background-color .2s linear, width .2s ease-in-out;\n width: 6px;\n /* there must be 'right' for ps__thumb-y */\n right: 2px;\n /* please don't change 'position' */\n position: absolute;\n}\n\n.ps__rail-x:hover > .ps__thumb-x,\n.ps__rail-x:focus > .ps__thumb-x,\n.ps__rail-x.ps--clicking .ps__thumb-x {\n background-color: #999;\n height: 11px;\n}\n\n.ps__rail-y:hover > .ps__thumb-y,\n.ps__rail-y:focus > .ps__thumb-y,\n.ps__rail-y.ps--clicking .ps__thumb-y {\n background-color: #999;\n width: 11px;\n}\n\n/* MS supports */\n@supports (-ms-overflow-style: none) {\n .ps {\n overflow: auto !important;\n }\n}\n\n@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {\n .ps {\n overflow: auto !important;\n }\n}\n"],sourceRoot:""}]),t.A=s},6314:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n}).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var o=0;oe.length)&&(t=e.length);for(var n=0,r=new Array(t);n2?r:e).apply(void 0,i)}}e.memoize=s,e.debounce=a,e.bind=l,e.default={memoize:s,debounce:a,bind:l}},void 0===(r=n.apply(t,[t]))||(e.exports=r)},6364:function(e){e.exports={}},228:function(e){"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||e,s),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);iu.depthLimit)return void a(t,e,r,s);if(void 0!==u.edgesLimit&&i+1>u.edgesLimit)return void a(t,e,r,s);if(o.push(e),Array.isArray(e))for(p=0;pt?1:0}function u(e,t,n,s){void 0===s&&(s=o());var a,l=p(e,"",0,[],void 0,0,s)||e;try{a=0===i.length?JSON.stringify(l,t,n):JSON.stringify(l,d(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return a}function p(e,i,o,s,l,u,d){var f;if(u+=1,"object"==typeof e&&null!==e){for(f=0;fd.depthLimit)return void a(t,e,i,l);if(void 0!==d.edgesLimit&&o+1>d.edgesLimit)return void a(t,e,i,l);if(s.push(e),Array.isArray(e))for(f=0;f0)for(var r=0;r=32&&e<=126||e>=161&&e<=55295&&8232!==e&&8233!==e||e>=57344&&e<=65533&&e!==l||e>=65536&&e<=1114111}function b(e){return y(e)&&e!==l&&13!==e&&10!==e}function v(e,t,n){const r=b(e),i=r&&!g(e);return(n?r:r&&44!==e&&91!==e&&93!==e&&123!==e&&125!==e)&&35!==e&&!(58===t&&!i)||b(t)&&!g(t)&&35===e||58===t&&i}function x(e,t){const n=e.charCodeAt(t);let r;return n>=55296&&n<=56319&&t+1=56320&&r<=57343)?1024*(n-55296)+r-56320+65536:n}function w(e){return/^\n* /.test(e)}function k(e,t,n,r,o){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==u.indexOf(t)||p.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'";const s=e.indent*Math.max(1,n),a=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-s),f=r||e.flowLevel>-1&&n>=e.flowLevel;switch(function(e,t,n,r,i,o,s,a){let c,u=0,p=null,d=!1,f=!1;const h=-1!==r;let m=-1,b=y(k=x(e,0))&&k!==l&&!g(k)&&45!==k&&63!==k&&58!==k&&44!==k&&91!==k&&93!==k&&123!==k&&125!==k&&35!==k&&38!==k&&42!==k&&33!==k&&124!==k&&61!==k&&62!==k&&39!==k&&34!==k&&37!==k&&64!==k&&96!==k&&function(e){return!g(e)&&58!==e}(x(e,e.length-1));var k;if(t||s)for(c=0;c=65536?c+=2:c++){if(u=x(e,c),!y(u))return 5;b=b&&v(u,p,a),p=u}else{for(c=0;c=65536?c+=2:c++){if(u=x(e,c),10===u)d=!0,h&&(f=f||c-m-1>r&&" "!==e[m+1],m=c);else if(!y(u))return 5;b=b&&v(u,p,a),p=u}f=f||h&&c-m-1>r&&" "!==e[m+1]}return d||f?n>9&&w(e)?5:s?2===o?5:2:f?4:3:!b||s||i(e)?2===o?5:2:1}(t,f,e.indent,a,function(t){return function(e,t){for(let n=0,r=e.implicitTypes.length;n"+S(t,e.indent)+E(h(function(e,t){const n=/(\n+)([^\n]*)/g;let r,i,o=function(){let r=e.indexOf("\n");return r=-1!==r?r:e.length,n.lastIndex=r,O(e.slice(0,r),t)}(),s="\n"===e[0]||" "===e[0];for(;i=n.exec(e);){const e=i[1],n=i[2];r=" "===n[0],o+=e+(s||r||""===n?"":"\n")+O(n,t),s=r}return o}(t,a),s));case 5:return'"'+function(e){let t="",n=0;for(let r=0;r=65536?r+=2:r++){n=x(e,r);const i=c[n];!i&&y(n)?(t+=e[r],n>=65536&&(t+=e[r+1])):t+=i||d(n)}return t}(t)+'"';default:throw new i("impossible error: invalid scalar style")}}()}function S(e,t){const n=w(e)?String(t):"",r="\n"===e[e.length-1];return n+(!r||"\n"!==e[e.length-2]&&"\n"!==e?r?"":"-":"+")+"\n"}function E(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function O(e,t){if(""===e||" "===e[0])return e;const n=/ [^ ]/g;let r,i,o=0,s=0,a=0,l="";for(;r=n.exec(e);)a=r.index,a-o>t&&(i=s>o?s:a,l+="\n"+e.slice(o,i),o=i+1),s=a;return l+="\n",e.length-o>t&&s>o?l+=e.slice(o,s)+"\n"+e.slice(s+1):l+=e.slice(o),l.slice(1)}function _(e,t,n,r){let i="";const o=e.tag;for(let o=0,s=n.length;o tag resolver accepts not "'+n+'" style');r=l.represent[n](t,n)}e.dump=r}return!0}}return!1}function $(e,t,n,r,o,a,l){e.tag=null,e.dump=n,P(e,n,!1)||P(e,n,!0);const c=s.call(e.dump),u=r;r&&(r=e.flowLevel<0||e.flowLevel>t);const p="[object Object]"===c||"[object Array]"===c;let d,f;if(p&&(d=e.duplicates.indexOf(n),f=-1!==d),(null!==e.tag&&"?"!==e.tag||f||2!==e.indent&&t>0)&&(o=!1),f&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(p&&f&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)r&&0!==Object.keys(e.dump).length?(function(e,t,n,r){let o="";const s=e.tag,a=Object.keys(n);if(!0===e.sortKeys)a.sort();else if("function"==typeof e.sortKeys)a.sort(e.sortKeys);else if(e.sortKeys)throw new i("sortKeys must be a boolean or a function");for(let i=0,s=a.length;i1024;u&&(e.dump&&10===e.dump.charCodeAt(0)?s+="?":s+="? "),s+=e.dump,u&&(s+=m(e,t)),$(e,t+1,c,!0,u)&&(e.dump&&10===e.dump.charCodeAt(0)?s+=":":s+=": ",s+=e.dump,o+=s)}e.tag=s,e.dump=o||"{}"}(e,t,e.dump,o),f&&(e.dump="&ref_"+d+e.dump)):(function(e,t,n){let r="";const i=e.tag,o=Object.keys(n);for(let i=0,s=o.length;i1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),$(e,t,l,!1,!1)&&(s+=e.dump,r+=s))}e.tag=i,e.dump="{"+r+"}"}(e,t,e.dump),f&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)r&&0!==e.dump.length?(e.noArrayIndent&&!l&&t>0?_(e,t-1,e.dump,o):_(e,t,e.dump,o),f&&(e.dump="&ref_"+d+e.dump)):(function(e,t,n){let r="";const i=e.tag;for(let i=0,o=n.length;i",e.dump=t+" "+e.dump}}return!0}function A(e,t){const n=[],r=[];C(e,n,r);const i=r.length;for(let e=0;e=48&&e<=57)return e-48;const t=32|e;return t>=97&&t<=102?t-97+10:-1}function v(e){return 120===e?2:117===e?4:85===e?8:0}function x(e){return e>=48&&e<=57?e-48:-1}function w(e){switch(e){case 48:return"\0";case 97:return"";case 98:return"\b";case 116:case 9:return"\t";case 110:return"\n";case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"…";case 95:return" ";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function k(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}function S(e,t,n){"__proto__"===t?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}const E=new Array(256),O=new Array(256);for(let e=0;e<256;e++)E[e]=w(e)?1:0,O[e]=w(e);function _(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||s,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.maxDepth="number"==typeof t.maxDepth?t.maxDepth:100,this.maxTotalMergeKeys="number"==typeof t.maxTotalMergeKeys?t.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function P(e,t){const n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=o(n),new i(t,n)}function $(e,t){throw P(e,t)}function A(e,t){e.onWarning&&e.onWarning.call(null,P(e,t))}function C(e,t,n){const r=e.anchorMapTransactions;if(0!==r.length){const n=r[r.length-1];a.call(n,t)||(n[t]={existed:a.call(e.anchorMap,t),value:e.anchorMap[t]})}e.anchorMap[t]=n}function j(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,tag:e.tag,anchor:e.anchor,kind:e.kind,result:e.result}}function T(e,t){e.position=t.position,e.line=t.line,e.lineStart=t.lineStart,e.lineIndent=t.lineIndent,e.firstTabInLine=t.firstTabInLine,e.tag=t.tag,e.anchor=t.anchor,e.kind=t.kind,e.result=t.result}const N={YAML:function(e,t,n){null!==e.version&&$(e,"duplication of %YAML directive"),1!==n.length&&$(e,"YAML directive accepts exactly one argument");const r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]);null===r&&$(e,"ill-formed argument of the YAML directive");const i=parseInt(r[1],10),o=parseInt(r[2],10);1!==i&&$(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&A(e,"unsupported YAML version of the document")},TAG:function(e,t,n){let r;2!==n.length&&$(e,"TAG directive accepts exactly two arguments");const i=n[0];r=n[1],p.test(i)||$(e,"ill-formed tag handle (first argument) of the TAG directive"),a.call(e.tagMap,i)&&$(e,'there is a previously declared suffix for "'+i+'" tag handle'),d.test(r)||$(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(t){$(e,"tag prefix is malformed: "+r)}e.tagMap[i]=r}};function I(e,t,n,r){if(t=32&&n<=1114111||$(e,"expected valid JSON character")}else l.test(i)&&$(e,"the stream contains non-printable characters");e.result+=i}}function R(e,t,n,i){r.isObject(n)||$(e,"cannot merge mappings; the provided source object is unacceptable");const o=Object.keys(n);for(let r=0,s=o.length;re.maxTotalMergeKeys&&$(e,"merge keys exceeded maxTotalMergeKeys ("+e.maxTotalMergeKeys+")"),a.call(t,s)||(S(t,s,n[s]),i[s]=!0)}}function L(e,t,n,r,i,o,s,l,c){if(Array.isArray(i))for(let t=0,n=(i=Array.prototype.slice.call(i)).length;t1&&(e.result+=r.repeat("\n",t-1))}function U(e,t){const n=e.tag,r=e.anchor,i=[];let o=!1;if(-1!==e.firstTabInLine)return!1;null!==e.anchor&&C(e,e.anchor,i);let s=e.input.charCodeAt(e.position);for(;0!==s&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,$(e,"tab characters must not be used in indentation")),45===s)&&g(e.input.charCodeAt(e.position+1));){if(o=!0,e.position++,M(e,!0,-1)&&e.lineIndent<=t){i.push(null),s=e.input.charCodeAt(e.position);continue}const n=e.line;if(W(e,t,3,!1,!0),i.push(e.result),M(e,!0,-1),s=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==s)$(e,"bad indentation of a sequence entry");else if(e.lineIndentt)&&(h&&(i=e.line,o=e.lineStart,s=e.position),W(e,t,4,!0,r)&&(h?d=e.result:f=e.result),h||(L(e,c,u,p,d,f,i,o,s),p=d=f=null),M(e,!0,-1),b=e.input.charCodeAt(e.position)),(e.line===x||e.lineIndent>t)&&0!==b)$(e,"bad indentation of a mapping entry");else if(e.lineIndent=e.maxDepth&&$(e,"nesting exceeded maxDepth ("+e.maxDepth+")"),e.depth+=1,null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null;const _=s=l=4===n||3===n;if(i&&M(e,!0,-1)&&(f=!0,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndentt?d=1:e.lineIndent===t?d=0:e.lineIndent=0;r-=1){const i=t[n[r]];i.existed?e.anchorMap[n[r]]=i.value:delete e.anchorMap[n[r]]}}(e),T(e,i),!1)}(e,S,S.position-S.lineStart,u)||s&&function(e,t){let n,i,o=1,s=!1,a=!1,l=t,c=0,u=!1,p=e.input.charCodeAt(e.position);if(124===p)n=!1;else{if(62!==p)return!1;n=!0}for(e.kind="scalar",e.result="";0!==p;)if(p=e.input.charCodeAt(++e.position),43===p||45===p)1===o?o=43===p?3:2:$(e,"repeat of a chomping mode identifier");else{if(!((i=x(p))>=0))break;0===i?$(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?$(e,"repeat of an indentation width identifier"):(l=t+i-1,a=!0)}if(m(p)){do{p=e.input.charCodeAt(++e.position)}while(m(p));if(35===p)do{p=e.input.charCodeAt(++e.position)}while(!h(p)&&0!==p)}for(;0!==p;){for(D(e),e.lineIndent=0,p=e.input.charCodeAt(e.position);(!a||e.lineIndentl&&(l=e.lineIndent),h(p)){c++;continue}if(a||0!==l||$(e,"missing indentation for block scalar"),e.lineIndent0){let t=i,n=0;for(;t>0;t--)o=e.input.charCodeAt(++e.position),(i=b(o))>=0?n=(n<<4)+i:$(e,"expected hexadecimal character");e.result+=k(n),e.position++}else $(e,"unknown escape sequence");n=r=e.position}else h(o)?(I(e,n,r,!0),F(e,M(e,!1,t)),n=r=e.position):e.position===e.lineStart&&z(e)?$(e,"unexpected end of the document within a double quoted scalar"):(e.position++,m(o)||(r=e.position))}$(e,"unexpected end of the stream within a double quoted scalar")}(e,u)?w=!0:function(e){let t=e.input.charCodeAt(e.position);if(42!==t)return!1;t=e.input.charCodeAt(++e.position);const n=e.position;for(;0!==t&&!g(t)&&!y(t);)t=e.input.charCodeAt(++e.position);e.position===n&&$(e,"name of an alias node must contain at least one character");const r=e.input.slice(n,e.position);return a.call(e.anchorMap,r)||$(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],M(e,!0,-1),!0}(e)?(w=!0,null===e.tag&&null===e.anchor||$(e,"alias node should not have any properties")):function(e,t,n){let r,i,o,s,a,l;const c=e.kind,u=e.result;let p=e.input.charCodeAt(e.position);if(g(p)||y(p)||35===p||38===p||42===p||33===p||124===p||62===p||39===p||34===p||37===p||64===p||96===p)return!1;if(63===p||45===p){const t=e.input.charCodeAt(e.position+1);if(g(t)||n&&y(t))return!1}for(e.kind="scalar",e.result="",r=i=e.position,o=!1;0!==p;){if(58===p){const t=e.input.charCodeAt(e.position+1);if(g(t)||n&&y(t))break}else if(35===p){if(g(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&z(e)||n&&y(p))break;if(h(p)){if(s=e.line,a=e.lineStart,l=e.lineIndent,M(e,!1,-1),e.lineIndent>=t){o=!0,p=e.input.charCodeAt(e.position);continue}e.position=i,e.line=s,e.lineStart=a,e.lineIndent=l;break}}o&&(I(e,r,i,!1),F(e,e.line-s),r=i=e.position,o=!1),m(p)||(i=e.position+1),p=e.input.charCodeAt(++e.position)}return I(e,r,i,!1),!!e.result||(e.kind=c,e.result=u,!1)}(e,u,1===n)&&(w=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&C(e,e.anchor,e.result)}else 0===d&&(w=l&&U(e,p));if(null===e.tag)null!==e.anchor&&C(e,e.anchor,e.result);else if("?"===e.tag){null!==e.result&&"scalar"!==e.kind&&$(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"');for(let t=0,n=e.implicitTypes.length;t"),null!==e.result&&c.kind!==e.kind&&$(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+c.kind+'", not "'+e.kind+'"'),c.resolve(e.result,e.tag)?(e.result=c.construct(e.result,e.tag),null!==e.anchor&&C(e,e.anchor,e.result)):$(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),e.depth-=1,null!==e.tag||null!==e.anchor||w}function H(e){const t=e.position;let n,r=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(n=e.input.charCodeAt(e.position))&&(M(e,!0,-1),n=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==n));){r=!0,n=e.input.charCodeAt(++e.position);let t=e.position;for(;0!==n&&!g(n);)n=e.input.charCodeAt(++e.position);const i=e.input.slice(t,e.position),o=[];for(i.length<1&&$(e,"directive name must not be less than one character in length");0!==n;){for(;m(n);)n=e.input.charCodeAt(++e.position);if(35===n){do{n=e.input.charCodeAt(++e.position)}while(0!==n&&!h(n));break}if(h(n))break;for(t=e.position;0!==n&&!g(n);)n=e.input.charCodeAt(++e.position);o.push(e.input.slice(t,e.position))}0!==n&&D(e),a.call(N,i)?N[i](e,i,o):A(e,'unknown document directive "'+i+'"')}M(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,M(e,!0,-1)):r&&$(e,"directives end mark is expected"),W(e,e.lineIndent-1,4,!1,!0),M(e,!0,-1),e.checkLineBreaks&&c.test(e.input.slice(t,e.position))&&A(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&z(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,M(e,!0,-1)):e.positiona&&(o=" ... ",t=r-a+o.length),n-r>a&&(s=" ...",n=r+a-s.length),{str:o+e.slice(t,n).replace(/\t/g,"→")+s,pos:r-t+o.length}}function o(e,t){return r.repeat(" ",t-e.length)+e}e.exports=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);const n=/\r?\n|\r|\0/g,s=[0],a=[];let l,c=-1;for(;l=n.exec(e.buffer);)a.push(l.index),s.push(l.index+l[0].length),e.position<=l.index&&c<0&&(c=s.length-2);c<0&&(c=s.length-1);let u="";const p=Math.min(e.line+t.linesAfter,a.length).toString().length,d=t.maxLength-(t.indent+p+3);for(let n=1;n<=t.linesBefore&&!(c-n<0);n++){const l=i(e.buffer,s[c-n],a[c-n],e.position-(s[c]-s[c-n]),d);u=r.repeat(" ",t.indent)+o((e.line-n+1).toString(),p)+" | "+l.str+"\n"+u}const f=i(e.buffer,s[c],a[c],e.position,d);u+=r.repeat(" ",t.indent)+o((e.line+1).toString(),p)+" | "+f.str+"\n",u+=r.repeat("-",t.indent+p+3+f.pos)+"^\n";for(let n=1;n<=t.linesAfter&&!(c+n>=a.length);n++){const l=i(e.buffer,s[c+n],a[c+n],e.position-(s[c]-s[c+n]),d);u+=r.repeat(" ",t.indent)+o((e.line+n+1).toString(),p)+" | "+l.str+"\n"}return u.replace(/\n$/,"")}},5388:function(e,t,n){"use strict";const r=n(1231),i=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],o=["scalar","sequence","mapping"];e.exports=function(e,t){if(t=t||{},Object.keys(t).forEach(function(t){if(-1===i.indexOf(t))throw new r('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){const t={};return null!==e&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}(t.styleAliases||null),-1===o.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},9342:function(e,t,n){"use strict";const r=n(5388),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";e.exports=new r("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;let t=0;const n=e.length,r=i;for(let i=0;i64)){if(n<0)return!1;t+=6}}return t%8==0},construct:function(e){const t=e.replace(/[\r\n=]/g,""),n=t.length,r=i;let o=0;const s=[];for(let e=0;e>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(t.charAt(e));const a=n%4*6;return 0===a?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===a?(s.push(o>>10&255),s.push(o>>2&255)):12===a&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){let t="",n=0;const r=e.length,o=i;for(let i=0;i>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[63&n]),n=(n<<8)+e[i];const s=r%3;return 0===s?(t+=o[n>>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[63&n]):2===s?(t+=o[n>>10&63],t+=o[n>>4&63],t+=o[n<<2&63],t+=o[64]):1===s&&(t+=o[n>>2&63],t+=o[n<<4&63],t+=o[64],t+=o[64]),t}})},6199:function(e,t,n){"use strict";const r=n(5388);e.exports=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;const t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},1461:function(e,t,n){"use strict";const r=n(8433),i=n(5388),o=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),s=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),a=/^[-+]?[0-9]+e/;e.exports=new i("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!!o.test(e)&&(!!isFinite(parseFloat(e,10))||s.test(e))},construct:function(e){let t=e.toLowerCase();const n="-"===t[0]?-1:1;return"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||r.isNegativeZero(e))},represent:function(e,t){if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(e))return"-0.0";const n=e.toString(10);return a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},4466:function(e,t,n){"use strict";const r=n(8433),i=n(5388);function o(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function s(e){return e>=48&&e<=55}function a(e){return e>=48&&e<=57}function l(e){let t=e,n=1,r=t[0];if("-"!==r&&"+"!==r||("-"===r&&(n=-1),t=t.slice(1),r=t[0]),"0"===t)return 0;if("0"===r){if("b"===t[1])return n*parseInt(t.slice(2),2);if("x"===t[1])return n*parseInt(t.slice(2),16);if("o"===t[1])return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}e.exports=new i("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;const t=e.length;let n=0,r=!1;if(!t)return!1;let i=e[n];if("-"!==i&&"+"!==i||(i=e[++n]),"0"===i){if(n+1===t)return!0;if(i=e[++n],"b"===i){for(n++;n=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},2369:function(e,t,n){"use strict";const r=n(5388);e.exports=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},1851:function(e,t,n){"use strict";const r=n(5388);e.exports=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},9198:function(e,t,n){"use strict";const r=n(5388);e.exports=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;const t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"})},6946:function(e,t,n){"use strict";const r=n(5388),i=Object.prototype.hasOwnProperty,o=Object.prototype.toString;e.exports=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;const t={},n=e;for(let e=0,r=n.length;e1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;t(this,e),this.ctx=n,this.iframes=r,this.exclude=i,this.iframesTimeout=o}return n(e,[{key:"getContexts",value:function(){var e=[];return(void 0!==this.ctx&&this.ctx?NodeList.prototype.isPrototypeOf(this.ctx)?Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?this.ctx:"string"==typeof this.ctx?Array.prototype.slice.call(document.querySelectorAll(this.ctx)):[this.ctx]:[]).forEach(function(t){var n=e.filter(function(e){return e.contains(t)}).length>0;-1!==e.indexOf(t)||n||e.push(t)}),e}},{key:"getIframeContents",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=void 0;try{var i=e.contentWindow;if(r=i.document,!i||!r)throw new Error("iframe inaccessible")}catch(e){n()}r&&t(r)}},{key:"isIframeBlank",value:function(e){var t="about:blank",n=e.getAttribute("src").trim();return e.contentWindow.location.href===t&&n!==t&&n}},{key:"observeIframeLoad",value:function(e,t,n){var r=this,i=!1,o=null,s=function s(){if(!i){i=!0,clearTimeout(o);try{r.isIframeBlank(e)||(e.removeEventListener("load",s),r.getIframeContents(e,t,n))}catch(e){n()}}};e.addEventListener("load",s),o=setTimeout(s,this.iframesTimeout)}},{key:"onIframeReady",value:function(e,t,n){try{"complete"===e.contentWindow.document.readyState?this.isIframeBlank(e)?this.observeIframeLoad(e,t,n):this.getIframeContents(e,t,n):this.observeIframeLoad(e,t,n)}catch(e){n()}}},{key:"waitForIframes",value:function(e,t){var n=this,r=0;this.forEachIframe(e,function(){return!0},function(e){r++,n.waitForIframes(e.querySelector("html"),function(){--r||t()})},function(e){e||t()})}},{key:"forEachIframe",value:function(t,n,r){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},s=t.querySelectorAll("iframe"),a=s.length,l=0;s=Array.prototype.slice.call(s);var c=function(){--a<=0&&o(l)};a||c(),s.forEach(function(t){e.matches(t,i.exclude)?c():i.onIframeReady(t,function(e){n(t)&&(l++,r(e)),c()},c)})}},{key:"createIterator",value:function(e,t,n){return document.createNodeIterator(e,t,n,!1)}},{key:"createInstanceOnIframe",value:function(t){return new e(t.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(e,t,n){if(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING){if(null===t)return!0;if(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)return!0}return!1}},{key:"getIteratorNode",value:function(e){var t=e.previousNode();return{prevNode:t,node:(null===t||e.nextNode())&&e.nextNode()}}},{key:"checkIframeFilter",value:function(e,t,n,r){var i=!1,o=!1;return r.forEach(function(e,t){e.val===n&&(i=t,o=e.handled)}),this.compareNodeIframe(e,t,n)?(!1!==i||o?!1===i||o||(r[i].handled=!0):r.push({val:n,handled:!0}),!0):(!1===i&&r.push({val:n,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(e,t,n,r){var i=this;e.forEach(function(e){e.handled||i.getIframeContents(e.val,function(e){i.createInstanceOnIframe(e).forEachNode(t,n,r)})})}},{key:"iterateThroughNodes",value:function(e,t,n,r,i){for(var o=this,s=this.createIterator(t,e,r),a=[],l=[],c=void 0,u=void 0,p=function(){var e=o.getIteratorNode(s);return u=e.prevNode,c=e.node};p();)this.iframes&&this.forEachIframe(t,function(e){return o.checkIframeFilter(c,u,e,a)},function(t){o.createInstanceOnIframe(t).forEachNode(e,function(e){return l.push(e)},r)}),l.push(c);l.forEach(function(e){n(e)}),this.iframes&&this.handleOpenIframes(a,e,n,r),i()}},{key:"forEachNode",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=this.getContexts(),s=o.length;s||i(),o.forEach(function(o){var a=function(){r.iterateThroughNodes(e,o,t,n,function(){--s<=0&&i()})};r.iframes?r.waitForIframes(o,a):a()})}}],[{key:"matches",value:function(e,t){var n="string"==typeof t?[t]:t,r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;if(r){var i=!1;return n.every(function(t){return!r.call(e,t)||(i=!0,!1)}),i}return!1}}]),e}(),o=function(){function o(e){t(this,o),this.ctx=e,this.ie=!1;var n=window.navigator.userAgent;(n.indexOf("MSIE")>-1||n.indexOf("Trident")>-1)&&(this.ie=!0)}return n(o,[{key:"log",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"debug",r=this.opt.log;this.opt.debug&&"object"===(void 0===r?"undefined":e(r))&&"function"==typeof r[n]&&r[n]("mark.js: "+t)}},{key:"escapeStr",value:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createRegExp",value:function(e){return"disabled"!==this.opt.wildcards&&(e=this.setupWildcardsRegExp(e)),e=this.escapeStr(e),Object.keys(this.opt.synonyms).length&&(e=this.createSynonymsRegExp(e)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),this.opt.diacritics&&(e=this.createDiacriticsRegExp(e)),e=this.createMergedBlanksRegExp(e),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.createJoinersRegExp(e)),"disabled"!==this.opt.wildcards&&(e=this.createWildcardsRegExp(e)),this.createAccuracyRegExp(e)}},{key:"createSynonymsRegExp",value:function(e){var t=this.opt.synonyms,n=this.opt.caseSensitive?"":"i",r=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(var i in t)if(t.hasOwnProperty(i)){var o=t[i],s="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(i):this.escapeStr(i),a="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(o):this.escapeStr(o);""!==s&&""!==a&&(e=e.replace(new RegExp("("+this.escapeStr(s)+"|"+this.escapeStr(a)+")","gm"+n),r+"("+this.processSynomyms(s)+"|"+this.processSynomyms(a)+")"+r))}return e}},{key:"processSynomyms",value:function(e){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),e}},{key:"setupWildcardsRegExp",value:function(e){return(e=e.replace(/(?:\\)*\?/g,function(e){return"\\"===e.charAt(0)?"?":""})).replace(/(?:\\)*\*/g,function(e){return"\\"===e.charAt(0)?"*":""})}},{key:"createWildcardsRegExp",value:function(e){var t="withSpaces"===this.opt.wildcards;return e.replace(/\u0001/g,t?"[\\S\\s]?":"\\S?").replace(/\u0002/g,t?"[\\S\\s]*?":"\\S*")}},{key:"setupIgnoreJoinersRegExp",value:function(e){return e.replace(/[^(|)\\]/g,function(e,t,n){var r=n.charAt(t+1);return/[(|)\\]/.test(r)||""===r?e:e+"\0"})}},{key:"createJoinersRegExp",value:function(e){var t=[],n=this.opt.ignorePunctuation;return Array.isArray(n)&&n.length&&t.push(this.escapeStr(n.join(""))),this.opt.ignoreJoiners&&t.push("\\u00ad\\u200b\\u200c\\u200d"),t.length?e.split(/\u0000+/).join("["+t.join("")+"]*"):e}},{key:"createDiacriticsRegExp",value:function(e){var t=this.opt.caseSensitive?"":"i",n=this.opt.caseSensitive?["aàáảãạăằắẳẵặâầấẩẫậäåāą","AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćč","CÇĆČ","dđď","DĐĎ","eèéẻẽẹêềếểễệëěēę","EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïī","IÌÍỈĨỊÎÏĪ","lł","LŁ","nñňń","NÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøō","OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rř","RŘ","sšśșş","SŠŚȘŞ","tťțţ","TŤȚŢ","uùúủũụưừứửữựûüůū","UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿ","YÝỲỶỸỴŸ","zžżź","ZŽŻŹ"]:["aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćčCÇĆČ","dđďDĐĎ","eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïīIÌÍỈĨỊÎÏĪ","lłLŁ","nñňńNÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rřRŘ","sšśșşSŠŚȘŞ","tťțţTŤȚŢ","uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿYÝỲỶỸỴŸ","zžżźZŽŻŹ"],r=[];return e.split("").forEach(function(i){n.every(function(n){if(-1!==n.indexOf(i)){if(r.indexOf(n)>-1)return!1;e=e.replace(new RegExp("["+n+"]","gm"+t),"["+n+"]"),r.push(n)}return!0})}),e}},{key:"createMergedBlanksRegExp",value:function(e){return e.replace(/[\s]+/gim,"[\\s]+")}},{key:"createAccuracyRegExp",value:function(e){var t=this,n=this.opt.accuracy,r="string"==typeof n?n:n.value,i="string"==typeof n?[]:n.limiters,o="";switch(i.forEach(function(e){o+="|"+t.escapeStr(e)}),r){case"partially":default:return"()("+e+")";case"complementary":return"()([^"+(o="\\s"+(o||this.escapeStr("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿")))+"]*"+e+"[^"+o+"]*)";case"exactly":return"(^|\\s"+o+")("+e+")(?=$|\\s"+o+")"}}},{key:"getSeparatedKeywords",value:function(e){var t=this,n=[];return e.forEach(function(e){t.opt.separateWordSearch?e.split(" ").forEach(function(e){e.trim()&&-1===n.indexOf(e)&&n.push(e)}):e.trim()&&-1===n.indexOf(e)&&n.push(e)}),{keywords:n.sort(function(e,t){return t.length-e.length}),length:n.length}}},{key:"isNumeric",value:function(e){return Number(parseFloat(e))==e}},{key:"checkRanges",value:function(e){var t=this;if(!Array.isArray(e)||"[object Object]"!==Object.prototype.toString.call(e[0]))return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(e),[];var n=[],r=0;return e.sort(function(e,t){return e.start-t.start}).forEach(function(e){var i=t.callNoMatchOnInvalidRanges(e,r),o=i.start,s=i.end;i.valid&&(e.start=o,e.length=s-o,n.push(e),r=s)}),n}},{key:"callNoMatchOnInvalidRanges",value:function(e,t){var n=void 0,r=void 0,i=!1;return e&&void 0!==e.start?(r=(n=parseInt(e.start,10))+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&r-t>0&&r-n>0?i=!0:(this.log("Ignoring invalid or overlapping range: "+JSON.stringify(e)),this.opt.noMatch(e))):(this.log("Ignoring invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:n,end:r,valid:i}}},{key:"checkWhitespaceRanges",value:function(e,t,n){var r=void 0,i=!0,o=n.length,s=t-o,a=parseInt(e.start,10)-s;return(r=(a=a>o?o:a)+parseInt(e.length,10))>o&&(r=o,this.log("End range automatically set to the max value of "+o)),a<0||r-a<0||a>o||r>o?(i=!1,this.log("Invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)):""===n.substring(a,r).replace(/\s+/g,"")&&(i=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:a,end:r,valid:i}}},{key:"getTextNodes",value:function(e){var t=this,n="",r=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,function(e){r.push({start:n.length,end:(n+=e.textContent).length,node:e})},function(e){return t.matchesExclude(e.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},function(){e({value:n,nodes:r})})}},{key:"matchesExclude",value:function(e){return i.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(e,t,n){var r=this.opt.element?this.opt.element:"mark",i=e.splitText(t),o=i.splitText(n-t),s=document.createElement(r);return s.setAttribute("data-markjs","true"),this.opt.className&&s.setAttribute("class",this.opt.className),s.textContent=i.textContent,i.parentNode.replaceChild(s,i),o}},{key:"wrapRangeInMappedTextNode",value:function(e,t,n,r,i){var o=this;e.nodes.every(function(s,a){var l=e.nodes[a+1];if(void 0===l||l.start>t){if(!r(s.node))return!1;var c=t-s.start,u=(n>s.end?s.end:n)-s.start,p=e.value.substr(0,s.start),d=e.value.substr(u+s.start);if(s.node=o.wrapRangeInTextNode(s.node,c,u),e.value=p+d,e.nodes.forEach(function(t,n){n>=a&&(e.nodes[n].start>0&&n!==a&&(e.nodes[n].start-=u),e.nodes[n].end-=u)}),n-=u,i(s.node.previousSibling,s.start),!(n>s.end))return!1;t=s.end}return!0})}},{key:"wrapMatches",value:function(e,t,n,r,i){var o=this,s=0===t?0:t+1;this.getTextNodes(function(t){t.nodes.forEach(function(t){t=t.node;for(var i=void 0;null!==(i=e.exec(t.textContent))&&""!==i[s];)if(n(i[s],t)){var a=i.index;if(0!==s)for(var l=1;l1&&console.warn("Replacing with",t),m++}}else{let i=u(l(t,e[n]));if(s.verbose>1&&console.warn((!1===i?f.colour.red:f.colour.green)+"Fragment resolution",e[n],f.colour.normal),!1===i){if(r.parent[r.pkey]={},s.fatal){let t=new Error("Fragment $ref resolution failed "+e[n]);if(!s.promise)throw t;s.promise.reject(t)}}else m++,r.parent[r.pkey]=i,h[e[n]]=r.path.replace("/%24ref","")}else if(p.protocol){let t=o.resolve(i,e[n]).toString();s.verbose>1&&console.warn(f.colour.yellow+"Rewriting external url ref",e[n],"as",t,f.colour.normal),e["x-miro"]=e[n],s.externalRefs[e[n]]&&(s.externalRefs[t]||(s.externalRefs[t]=s.externalRefs[e[n]]),s.externalRefs[t].failed=s.externalRefs[e[n]].failed),e[n]=t}else if(!e["x-miro"]){let t=o.resolve(i,e[n]).toString(),r=!1;s.externalRefs[e[n]]&&(r=s.externalRefs[e[n]].failed),r||(s.verbose>1&&console.warn(f.colour.yellow+"Rewriting external ref",e[n],"as",t,f.colour.normal),e["x-miro"]=e[n],e[n]=t)}});return c(e,{},function(e,t,n){d(e,t)&&void 0!==e.$fixed&&delete e.$fixed}),s.verbose>1&&console.warn("Finished fragment resolution"),e}function m(e,t){if(!t.filters||!t.filters.length)return e;for(let n of t.filters)e=n(e,t);return e}function g(e,t,n,s){var c=o.parse(n.source),p=n.source.split("\\").join("/").split("/");p.pop()||p.pop();let d="",f=t.split("#");f.length>1&&(d="#"+f[1],t=f[0]),p=p.join("/");let g=(y=o.parse(t).protocol,b=c.protocol,y&&y.length>2?y:b&&b.length>2?b:"file:");var y,b;let v;if(v="file:"===g?i.resolve(p?p+"/":"",t):o.resolve(p?p+"/":"",t),n.cache[v]){n.verbose&&console.warn("CACHED",v,d);let e=u(n.cache[v]),r=n.externalRef=e;if(d&&(r=l(r,d),!1===r&&(r={},n.fatal))){let e=new Error("Cached $ref resolution failed "+v+d);if(!n.promise)throw e;n.promise.reject(e)}return r=h(r,e,t,d,v,n),r=m(r,n),s(u(r),v,n),Promise.resolve(r)}if(n.verbose&&console.warn("GET",v,d),n.handlers&&n.handlers[g])return n.handlers[g](p,t,d,n).then(function(e){return n.externalRef=e,e=m(e,n),n.cache[v]=e,s(e,v,n),e}).catch(function(e){throw n.verbose&&console.warn(e),e});if(g&&g.startsWith("http")){const e=Object.assign({},n.fetchOptions,{agent:n.agent});return n.fetch(v,e).then(function(e){if(200!==e.status){if(n.ignoreIOErrors)return n.verbose&&console.warn("FAILED",t),n.externalRefs[t].failed=!0,'{"$ref":"'+t+'"}';throw new Error(`Received status code ${e.status}: ${v}`)}return e.text()}).then(function(e){try{let r=a.parse(e,{schema:"core",prettyErrors:!0});if(e=n.externalRef=r,n.cache[v]=u(e),d&&!1===(e=l(e,d))&&(e={},n.fatal)){let e=new Error("Remote $ref resolution failed "+v+d);if(!n.promise)throw e;n.promise.reject(e)}e=m(e=h(e,r,t,d,v,n),n)}catch(e){if(n.verbose&&console.warn(e),!n.promise||!n.fatal)throw e;n.promise.reject(e)}return s(e,v,n),e}).catch(function(e){if(n.verbose&&console.warn(e),n.cache[v]={},!n.promise||!n.fatal)throw e;n.promise.reject(e)})}{const e='{"$ref":"'+t+'"}';return function(e,t,n,i,o){return new Promise(function(s,a){r.readFile(e,t,function(e,t){e?n.ignoreIOErrors&&o?(n.verbose&&console.warn("FAILED",i),n.externalRefs[i].failed=!0,s(o)):a(e):s(t)})})}(v,n.encoding||"utf8",n,t,e).then(function(e){try{let r=a.parse(e,{schema:"core",prettyErrors:!0});if(e=n.externalRef=r,n.cache[v]=u(e),d&&!1===(e=l(e,d))&&(e={},n.fatal)){let e=new Error("File $ref resolution failed "+v+d);if(!n.promise)throw e;n.promise.reject(e)}e=m(e=h(e,r,t,d,v,n),n)}catch(e){if(n.verbose&&console.warn(e),!n.promise||!n.fatal)throw e;n.promise.reject(e)}return s(e,v,n),e}).catch(function(e){if(n.verbose&&console.warn(e),!n.promise||!n.fatal)throw e;n.promise.reject(e)})}}function y(e){return new Promise(function(t,n){(function(e){return new Promise(function(t,n){function r(t,n,r){if(t[n]&&d(t[n],"$ref")){let o=t[n].$ref;if(!o.startsWith("#")){let s="";if(!i[o]){let t=Object.keys(i).find(function(e,t,n){return o.startsWith(e+"/")});t&&(e.verbose&&console.warn("Found potential subschema at",t),s="/"+(o.split("#")[1]||"").replace(t.split("#")[1]||""),s=s.split("/undefined").join(""),o=t)}if(i[o]||(i[o]={resolved:!1,paths:[],extras:{},description:t[n].description}),i[o].resolved)if(i[o].failed);else if(e.rewriteRefs){let r=i[o].resolvedAt;e.verbose>1&&console.warn("Rewriting ref",o,r),t[n]["x-miro"]=o,t[n].$ref=r+s}else t[n]=u(i[o].data);else i[o].paths.push(r.path),i[o].extras[r.path]=s}}}let i=e.externalRefs;if(e.resolver.depth>0&&e.source===e.resolver.base)return t(i);c(e.openapi.definitions,{identityDetection:!0,path:"#/definitions"},r),c(e.openapi.components,{identityDetection:!0,path:"#/components"},r),c(e.openapi,{identityDetection:!0},r),t(i)})})(e).then(function(t){for(let n in t)if(!t[n].resolved){let r=e.resolver.depth;r>0&&r++,e.resolver.actions[r].push(function(){return g(e.openapi,n,e,function(e,r,i){if(!t[n].resolved){let o={};o.context=t[n],o.$ref=n,o.original=u(e),o.updated=e,o.source=r,i.externals.push(o),t[n].resolved=!0}let o=Object.assign({},i,{source:"",resolver:{actions:i.resolver.actions,depth:i.resolver.actions.length-1,base:i.resolver.base}});i.patch&&t[n].description&&!e.description&&"object"==typeof e&&(e.description=t[n].description),t[n].data=e;let s=(a=t[n].paths,[...new Set(a)]);var a;s=s.sort(function(e,t){const n=e.startsWith("#/components/")||e.startsWith("#/definitions/"),r=t.startsWith("#/components/")||t.startsWith("#/definitions/");return n&&!r?-1:r&&!n?1:0});for(let r of s)if(t[n].resolvedAt&&r!==t[n].resolvedAt&&r.indexOf("x-ms-examples/")<0)i.verbose>1&&console.warn("Creating pointer to data at",r),l(i.openapi,r,{$ref:t[n].resolvedAt+t[n].extras[r],"x-miro":n+t[n].extras[r]});else{t[n].resolvedAt?i.verbose>1&&console.warn("Avoiding circular reference"):(t[n].resolvedAt=r,i.verbose>1&&console.warn("Creating initial clone of data at",r));let o=u(e);l(i.openapi,r,o)}0===i.resolver.actions[o.resolver.depth].length&&i.resolver.actions[o.resolver.depth].push(function(){return y(o)})})})}}).catch(function(t){e.verbose&&console.warn(t),n(t)});let r={options:e};r.actions=e.resolver.actions[e.resolver.depth],t(r)})}function b(e,t,n){e.resolver.actions.push([]),y(e).then(function(r){var i;(i=r.actions,i.reduce((e,t)=>e.then(e=>t().then(Array.prototype.concat.bind(e))),Promise.resolve([]))).then(function(){if(e.resolver.depth>=e.resolver.actions.length)return console.warn("Ran off the end of resolver actions"),t(!0);e.resolver.depth++,e.resolver.actions[e.resolver.depth].length?setTimeout(function(){b(r.options,t,n)},0):(e.verbose>1&&console.warn(f.colour.yellow+"Finished external resolution!",f.colour.normal),e.resolveInternal&&(e.verbose>1&&console.warn(f.colour.yellow+"Starting internal resolution!",f.colour.normal),e.openapi=p(e.openapi,e.original,{verbose:e.verbose-1}),e.verbose>1&&console.warn(f.colour.yellow+"Finished internal resolution!",f.colour.normal)),c(e.openapi,{},function(t,n,r){d(t,n)&&(e.preserveMiro||delete t["x-miro"])}),t(e))}).catch(function(t){e.verbose&&console.warn(t),n(t)})}).catch(function(t){e.verbose&&console.warn(t),n(t)})}function v(e){if(e.cache||(e.cache={}),e.fetch||(e.fetch=s),e.source){let t=o.parse(e.source);(!t.protocol||t.protocol.length<=2)&&(e.source=i.resolve(e.source))}e.externals=[],e.externalRefs={},e.rewriteRefs=!0,e.resolver={},e.resolver.depth=0,e.resolver.base=e.source,e.resolver.actions=[[]]}e.exports={optionalResolve:function(e){return v(e),new Promise(function(t,n){e.resolve?b(e,t,n):t(e)})},resolve:function(e,t,n){return n||(n={}),n.openapi=e,n.source=t,n.resolve=!0,v(n),new Promise(function(e,t){b(n,e,t)})}}},1319:function(e){"use strict";function t(){return{depth:0,seen:new WeakMap,top:!0,combine:!1,allowRefSiblings:!1}}e.exports={getDefaultState:t,walkSchema:function e(n,r,i,o){if(void 0===i.depth&&(i=t()),null==n)return n;if(void 0!==n.$ref){let e={$ref:n.$ref};return i.allowRefSiblings&&n.description&&(e.description=n.description),o(e,r,i),e}if(i.combine&&(n.allOf&&Array.isArray(n.allOf)&&1===n.allOf.length&&delete(n=Object.assign({},n.allOf[0],n)).allOf,n.anyOf&&Array.isArray(n.anyOf)&&1===n.anyOf.length&&delete(n=Object.assign({},n.anyOf[0],n)).anyOf,n.oneOf&&Array.isArray(n.oneOf)&&1===n.oneOf.length&&delete(n=Object.assign({},n.oneOf[0],n)).oneOf),o(n,r,i),i.seen.has(n))return n;if("object"==typeof n&&null!==n&&i.seen.set(n,!0),i.top=!1,i.depth++,void 0!==n.items&&(i.property="items",e(n.items,n,i,o)),n.additionalItems&&"object"==typeof n.additionalItems&&(i.property="additionalItems",e(n.additionalItems,n,i,o)),n.additionalProperties&&"object"==typeof n.additionalProperties&&(i.property="additionalProperties",e(n.additionalProperties,n,i,o)),n.properties)for(let t in n.properties){let r=n.properties[t];i.property="properties/"+t,e(r,n,i,o)}if(n.patternProperties)for(let t in n.patternProperties){let r=n.patternProperties[t];i.property="patternProperties/"+t,e(r,n,i,o)}if(n.allOf)for(let t in n.allOf){let r=n.allOf[t];i.property="allOf/"+t,e(r,n,i,o)}if(n.anyOf)for(let t in n.anyOf){let r=n.anyOf[t];i.property="anyOf/"+t,e(r,n,i,o)}if(n.oneOf)for(let t in n.oneOf){let r=n.oneOf[t];i.property="oneOf/"+t,e(r,n,i,o)}return n.not&&(i.property="not",e(n.not,n,i,o)),i.depth--,n}}},7975:function(e){"use strict";function t(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var n,r="",i=0,o=-1,s=0,a=0;a<=e.length;++a){if(a2){var l=r.lastIndexOf("/");if(l!==r.length-1){-1===l?(r="",i=0):i=(r=r.slice(0,l)).length-1-r.lastIndexOf("/"),o=a,s=0;continue}}else if(2===r.length||1===r.length){r="",i=0,o=a,s=0;continue}t&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+e.slice(o+1,a):r=e.slice(o+1,a),i=a-o-1;o=a,s=0}else 46===n&&-1!==s?++s:s=-1}return r}var r={resolve:function(){for(var e,r="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var s;o>=0?s=arguments[o]:(void 0===e&&(e=process.cwd()),s=e),t(s),0!==s.length&&(r=s+"/"+r,i=47===s.charCodeAt(0))}return r=n(r,!i),i?r.length>0?"/"+r:"/":r.length>0?r:"."},normalize:function(e){if(t(e),0===e.length)return".";var r=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!r)).length||r||(e="."),e.length>0&&i&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,n=0;n0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":r.normalize(e)},relative:function(e,n){if(t(e),t(n),e===n)return"";if((e=r.resolve(e))===(n=r.resolve(n)))return"";for(var i=1;ic){if(47===n.charCodeAt(a+p))return n.slice(a+p+1);if(0===p)return n.slice(a+p)}else s>c&&(47===e.charCodeAt(i+p)?u=p:0===p&&(u=0));break}var d=e.charCodeAt(i+p);if(d!==n.charCodeAt(a+p))break;47===d&&(u=p)}var f="";for(p=i+u+1;p<=o;++p)p!==o&&47!==e.charCodeAt(p)||(0===f.length?f+="..":f+="/..");return f.length>0?f+n.slice(a+u):(a+=u,47===n.charCodeAt(a)&&++a,n.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var n=e.charCodeAt(0),r=47===n,i=-1,o=!0,s=e.length-1;s>=1;--s)if(47===(n=e.charCodeAt(s))){if(!o){i=s;break}}else o=!1;return-1===i?r?"/":".":r&&1===i?"//":e.slice(0,i)},basename:function(e,n){if(void 0!==n&&"string"!=typeof n)throw new TypeError('"ext" argument must be a string');t(e);var r,i=0,o=-1,s=!0;if(void 0!==n&&n.length>0&&n.length<=e.length){if(n.length===e.length&&n===e)return"";var a=n.length-1,l=-1;for(r=e.length-1;r>=0;--r){var c=e.charCodeAt(r);if(47===c){if(!s){i=r+1;break}}else-1===l&&(s=!1,l=r+1),a>=0&&(c===n.charCodeAt(a)?-1===--a&&(o=r):(a=-1,o=l))}return i===o?o=l:-1===o&&(o=e.length),e.slice(i,o)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!s){i=r+1;break}}else-1===o&&(s=!1,o=r+1);return-1===o?"":e.slice(i,o)},extname:function(e){t(e);for(var n=-1,r=0,i=-1,o=!0,s=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47!==l)-1===i&&(o=!1,i=a+1),46===l?-1===n?n=a:1!==s&&(s=1):-1!==n&&(s=-1);else if(!o){r=a+1;break}}return-1===n||-1===i||0===s||1===s&&n===i-1&&n===r+1?"":e.slice(n,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var n=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+r:n+"/"+r:r}(0,e)},parse:function(e){t(e);var n={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return n;var r,i=e.charCodeAt(0),o=47===i;o?(n.root="/",r=1):r=0;for(var s=-1,a=0,l=-1,c=!0,u=e.length-1,p=0;u>=r;--u)if(47!==(i=e.charCodeAt(u)))-1===l&&(c=!1,l=u+1),46===i?-1===s?s=u:1!==p&&(p=1):-1!==s&&(p=-1);else if(!c){a=u+1;break}return-1===s||-1===l||0===p||1===p&&s===l-1&&s===a+1?-1!==l&&(n.base=n.name=0===a&&o?e.slice(1,l):e.slice(a,l)):(0===a&&o?(n.name=e.slice(1,s),n.base=e.slice(1,l)):(n.name=e.slice(a,s),n.base=e.slice(a,l)),n.ext=e.slice(s,l)),a>0?n.dir=e.slice(0,a-1):o&&(n.dir="/"),n},sep:"/",delimiter:":",win32:null,posix:null};r.posix=r,e.exports=r},5127:function(e){e.exports=function(){var e=[],t=[],n={},r={},i={};function o(e){return"string"==typeof e?new RegExp("^"+e+"$","i"):e}function s(e,t){return e===t?t:e===e.toLowerCase()?t.toLowerCase():e===e.toUpperCase()?t.toUpperCase():e[0]===e[0].toUpperCase()?t.charAt(0).toUpperCase()+t.substr(1).toLowerCase():t.toLowerCase()}function a(e,t){return e.replace(t[0],function(n,r){var i,o,a=(i=t[1],o=arguments,i.replace(/\$(\d{1,2})/g,function(e,t){return o[t]||""}));return s(""===n?e[r-1]:n,a)})}function l(e,t,r){if(!e.length||n.hasOwnProperty(e))return t;for(var i=r.length;i--;){var o=r[i];if(o[0].test(t))return a(t,o)}return t}function c(e,t,n){return function(r){var i=r.toLowerCase();return t.hasOwnProperty(i)?s(r,i):e.hasOwnProperty(i)?s(r,e[i]):l(i,r,n)}}function u(e,t,n,r){return function(r){var i=r.toLowerCase();return!!t.hasOwnProperty(i)||!e.hasOwnProperty(i)&&l(i,i,n)===i}}function p(e,t,n){return(n?t+" ":"")+(1===t?p.singular(e):p.plural(e))}return p.plural=c(i,r,e),p.isPlural=u(i,r,e),p.singular=c(r,i,t),p.isSingular=u(r,i,t),p.addPluralRule=function(t,n){e.push([o(t),n])},p.addSingularRule=function(e,n){t.push([o(e),n])},p.addUncountableRule=function(e){"string"!=typeof e?(p.addPluralRule(e,"$0"),p.addSingularRule(e,"$0")):n[e.toLowerCase()]=!0},p.addIrregularRule=function(e,t){t=t.toLowerCase(),e=e.toLowerCase(),i[e]=t,r[t]=e},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(e){return p.addIrregularRule(e[0],e[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(e){return p.addPluralRule(e[0],e[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(e){return p.addSingularRule(e[0],e[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(p.addUncountableRule),p}()},7022:function(){!function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var i=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=r.variable[1].inside,s=0;s>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}}),Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete Prism.languages.c.boolean},5624:function(){Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}},4511:function(){!function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(Prism)},2415:function(){!function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,function(){return t.source});e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,function(){return n})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(Prism)},5651:function(){!function(e){function t(e,t){return e.replace(/<<(\d+)>>/g,function(e,n){return"(?:"+t[+n]+")"})}function n(e,n,r){return RegExp(t(e,n),r||"")}function r(e,t){for(var n=0;n>/g,function(){return"(?:"+e+")"});return e.replace(/<>/g,"[^\\s\\S]")}var i="bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",o="class enum interface record struct",s="add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",a="abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield";function l(e){return"\\b(?:"+e.trim().replace(/ /g,"|")+")\\b"}var c=l(o),u=RegExp(l(i+" "+o+" "+s+" "+a)),p=l(o+" "+s+" "+a),d=l(i+" "+o+" "+a),f=r(/<(?:[^<>;=+\-*/%&|^]|<>)*>/.source,2),h=r(/\((?:[^()]|<>)*\)/.source,2),m=/@?\b[A-Za-z_]\w*\b/.source,g=t(/<<0>>(?:\s*<<1>>)?/.source,[m,f]),y=t(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[p,g]),b=/\[\s*(?:,\s*)*\]/.source,v=t(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[y,b]),x=t(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[f,h,b]),w=t(/\(<<0>>+(?:,<<0>>+)+\)/.source,[x]),k=t(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[w,y,b]),S={keyword:u,punctuation:/[<>()?,.:[\]]/},E=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,O=/"(?:\\.|[^\\"\r\n])*"/.source,_=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;e.languages.csharp=e.languages.extend("clike",{string:[{pattern:n(/(^|[^$\\])<<0>>/.source,[_]),lookbehind:!0,greedy:!0},{pattern:n(/(^|[^@$\\])<<0>>/.source,[O]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:n(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[y]),lookbehind:!0,inside:S},{pattern:n(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[m,k]),lookbehind:!0,inside:S},{pattern:n(/(\busing\s+)<<0>>(?=\s*=)/.source,[m]),lookbehind:!0},{pattern:n(/(\b<<0>>\s+)<<1>>/.source,[c,g]),lookbehind:!0,inside:S},{pattern:n(/(\bcatch\s*\(\s*)<<0>>/.source,[y]),lookbehind:!0,inside:S},{pattern:n(/(\bwhere\s+)<<0>>/.source,[m]),lookbehind:!0},{pattern:n(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[v]),lookbehind:!0,inside:S},{pattern:n(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[k,d,m]),inside:S}],keyword:u,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),e.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),e.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:n(/([(,]\s*)<<0>>(?=\s*:)/.source,[m]),lookbehind:!0,alias:"punctuation"}}),e.languages.insertBefore("csharp","class-name",{namespace:{pattern:n(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[m]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:n(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[h]),lookbehind:!0,alias:"class-name",inside:S},"return-type":{pattern:n(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[k,y]),inside:S,alias:"class-name"},"constructor-invocation":{pattern:n(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[k]),lookbehind:!0,inside:S,alias:"class-name"},"generic-method":{pattern:n(/<<0>>\s*<<1>>(?=\s*\()/.source,[m,f]),inside:{function:n(/^<<0>>/.source,[m]),generic:{pattern:RegExp(f),alias:"class-name",inside:S}}},"type-list":{pattern:n(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[c,g,m,k,u.source,h,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:n(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[g,h]),lookbehind:!0,greedy:!0,inside:e.languages.csharp},keyword:u,"class-name":{pattern:RegExp(k),greedy:!0,inside:S},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var P=O+"|"+E,$=t(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[P]),A=r(t(/[^"'/()]|<<0>>|\(<>*\)/.source,[$]),2),C=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,j=t(/<<0>>(?:\s*\(<<1>>*\))?/.source,[y,A]);e.languages.insertBefore("csharp","class-name",{attribute:{pattern:n(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[C,j]),lookbehind:!0,greedy:!0,inside:{target:{pattern:n(/^<<0>>(?=\s*:)/.source,[C]),alias:"keyword"},"attribute-arguments":{pattern:n(/\(<<0>>*\)/.source,[A]),inside:e.languages.csharp},"class-name":{pattern:RegExp(y),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var T=/:[^}\r\n]+/.source,N=r(t(/[^"'/()]|<<0>>|\(<>*\)/.source,[$]),2),I=t(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[N,T]),R=r(t(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<>*\)/.source,[P]),2),L=t(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[R,T]);function D(t,r){return{interpolation:{pattern:n(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[t]),lookbehind:!0,inside:{"format-string":{pattern:n(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[r,T]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:e.languages.csharp}}},string:/[\s\S]+/}}e.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:n(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[I]),lookbehind:!0,greedy:!0,inside:D(I,N)},{pattern:n(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[L]),lookbehind:!0,greedy:!0,inside:D(L,R)}],char:{pattern:RegExp(E),greedy:!0}}),e.languages.dotnet=e.languages.cs=e.languages.csharp}(Prism)},2630:function(){Prism.languages.csv={value:/[^\r\n,"]+|"(?:[^"]|"")*"(?!")/,punctuation:/,/}},6378:function(){Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete Prism.languages.go["class-name"]},4784:function(){!function(e){function t(e){return RegExp("(^(?:"+e+"):[ \t]*(?![ \t]))[^]+","i")}e.languages.http={"request-line":{pattern:/^(?:CONNECT|DELETE|GET|HEAD|OPTIONS|PATCH|POST|PRI|PUT|SEARCH|TRACE)\s(?:https?:\/\/|\/)\S*\sHTTP\/[\d.]+/m,inside:{method:{pattern:/^[A-Z]+\b/,alias:"property"},"request-target":{pattern:/^(\s)(?:https?:\/\/|\/)\S*(?=\s)/,lookbehind:!0,alias:"url",inside:e.languages.uri},"http-version":{pattern:/^(\s)HTTP\/[\d.]+/,lookbehind:!0,alias:"property"}}},"response-status":{pattern:/^HTTP\/[\d.]+ \d+ .+/m,inside:{"http-version":{pattern:/^HTTP\/[\d.]+/,alias:"property"},"status-code":{pattern:/^(\s)\d+(?=\s)/,lookbehind:!0,alias:"number"},"reason-phrase":{pattern:/^(\s).+/,lookbehind:!0,alias:"string"}}},header:{pattern:/^[\w-]+:.+(?:(?:\r\n?|\n)[ \t].+)*/m,inside:{"header-value":[{pattern:t(/Content-Security-Policy/.source),lookbehind:!0,alias:["csp","languages-csp"],inside:e.languages.csp},{pattern:t(/Public-Key-Pins(?:-Report-Only)?/.source),lookbehind:!0,alias:["hpkp","languages-hpkp"],inside:e.languages.hpkp},{pattern:t(/Strict-Transport-Security/.source),lookbehind:!0,alias:["hsts","languages-hsts"],inside:e.languages.hsts},{pattern:t(/[^:]+/.source),lookbehind:!0}],"header-name":{pattern:/^[^:]+/,alias:"keyword"},punctuation:/^:/}}};var n,r=e.languages,i={"application/javascript":r.javascript,"application/json":r.json||r.javascript,"application/xml":r.xml,"text/xml":r.xml,"text/html":r.html,"text/css":r.css,"text/plain":r.plain},o={"application/json":!0,"application/xml":!0};function s(e){var t=e.replace(/^[a-z]+\//,"");return"(?:"+e+"|\\w+/(?:[\\w.-]+\\+)+"+t+"(?![+\\w.-]))"}for(var a in i)if(i[a]){n=n||{};var l=o[a]?s(a):a;n[a.replace(/\//g,"-")]={pattern:RegExp("("+/content-type:\s*/.source+l+/(?:(?:\r\n?|\n)[\w-].*)*(?:\r(?:\n|(?!\n))|\n)/.source+")"+/[^ \t\w-][\s\S]*/.source,"i"),lookbehind:!0,inside:i[a]}}n&&e.languages.insertBefore("http","header",n)}(Prism)},6976:function(){!function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),e.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,function(){return t.source})),lookbehind:!0,inside:{punctuation:/\./}}})}(Prism)},64:function(){Prism.languages.lua={comment:/^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,string:{pattern:/(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,greedy:!0},number:/\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,keyword:/\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,function:/(?!\d)\w+(?=\s*(?:[({]))/,operator:[/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,{pattern:/(^|[^.])\.\.(?!\.)/,lookbehind:!0}],punctuation:/[\[\](){},;]|\.+|:+/}},9700:function(){!function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,i,o){if(n.language===r){var s=n.tokenStack=[];n.code=n.code.replace(i,function(e){if("function"==typeof o&&!o(e))return e;for(var i,a=s.length;-1!==n.code.indexOf(i=t(r,a));)++a;return s[a]=e,i}),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language===r&&n.tokenStack){n.grammar=e.languages[r];var i=0,o=Object.keys(n.tokenStack);!function s(a){for(var l=0;l=o.length);l++){var c=a[l];if("string"==typeof c||c.content&&"string"==typeof c.content){var u=o[i],p=n.tokenStack[u],d="string"==typeof c?c:c.content,f=t(r,u),h=d.indexOf(f);if(h>-1){++i;var m=d.substring(0,h),g=new e.Token(r,e.tokenize(p,n.grammar),"language-"+r,p),y=d.substring(h+f.length),b=[];m&&b.push.apply(b,s([m])),b.push(g),y&&b.push.apply(b,s([y])),"string"==typeof c?a.splice.apply(a,[l,1].concat(b)):c.content=b}}else c.content&&s(c.content)}return a}(n.tokens)}}}})}(Prism)},4312:function(){Prism.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml},596:function(){Prism.languages.objectivec=Prism.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete Prism.languages.objectivec["class-name"],Prism.languages.objc=Prism.languages.objectivec},2821:function(){!function(e){var t=/(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;e.languages.perl={comment:[{pattern:/(^\s*)=\w[\s\S]*?=cut.*/m,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],string:[{pattern:RegExp(/\b(?:q|qq|qw|qx)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,t].join("|")+")"),greedy:!0},{pattern:/("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,greedy:!0},{pattern:/'(?:[^'\\\r\n]|\\.)*'/,greedy:!0}],regex:[{pattern:RegExp(/\b(?:m|qr)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,t].join("|")+")"+/[msixpodualngc]*/.source),greedy:!0},{pattern:RegExp(/(^|[^-])\b(?:s|tr|y)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,/([a-zA-Z0-9])(?:(?!\3)[^\\]|\\[\s\S])*\3(?:(?!\3)[^\\]|\\[\s\S])*\3/.source,t+/\s*/.source+t].join("|")+")"+/[msixpodualngcer]*/.source),lookbehind:!0,greedy:!0},{pattern:/\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|x|xor)\b))/,greedy:!0}],variable:[/[&*$@%]\{\^[A-Z]+\}/,/[&*$@%]\^[A-Z_]/,/[&*$@%]#?(?=\{)/,/[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+(?![\w$]))+(?:::)*/,/[&*$@%]\d+/,/(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/],filehandle:{pattern:/<(?![<=])\S*?>|\b_\b/,alias:"symbol"},"v-string":{pattern:/v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,alias:"string"},function:{pattern:/(\bsub[ \t]+)\w+/,lookbehind:!0},keyword:/\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,operator:/-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\b/,punctuation:/[{}[\];(),:]/}}(Prism)},3554:function(){!function(e){var t=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,n=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],r=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,i=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,o=/[{}\[\](),:;]/;e.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:t,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:r,operator:i,punctuation:o};var s={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:e.languages.php},a=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:s}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:s}}];e.languages.insertBefore("php","variable",{string:a,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:t,string:a,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,number:r,operator:i,punctuation:o}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),e.hooks.add("before-tokenize",function(t){/<\?/.test(t.code)&&e.languages["markup-templating"].buildPlaceholders(t,"php",/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g)}),e.hooks.add("after-tokenize",function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"php")})}(Prism)},2342:function(){Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python},4113:function(){Prism.languages.q={string:/"(?:\\.|[^"\\\r\n])*"/,comment:[{pattern:/([\t )\]}])\/.*/,lookbehind:!0,greedy:!0},{pattern:/(^|\r?\n|\r)\/[\t ]*(?:(?:\r?\n|\r)(?:.*(?:\r?\n|\r(?!\n)))*?(?:\\(?=[\t ]*(?:\r?\n|\r))|$)|\S.*)/,lookbehind:!0,greedy:!0},{pattern:/^\\[\t ]*(?:\r?\n|\r)[\s\S]+/m,greedy:!0},{pattern:/^#!.+/m,greedy:!0}],symbol:/`(?::\S+|[\w.]*)/,datetime:{pattern:/0N[mdzuvt]|0W[dtz]|\d{4}\.\d\d(?:m|\.\d\d(?:T(?:\d\d(?::\d\d(?::\d\d(?:[.:]\d\d\d)?)?)?)?)?[dz]?)|\d\d:\d\d(?::\d\d(?:[.:]\d\d\d)?)?[uvt]?/,alias:"number"},number:/\b(?![01]:)(?:0N[hje]?|0W[hj]?|0[wn]|0x[\da-fA-F]+|\d+(?:\.\d*)?(?:e[+-]?\d+)?[hjfeb]?)/,keyword:/\\\w+\b|\b(?:abs|acos|aj0?|all|and|any|asc|asin|asof|atan|attr|avgs?|binr?|by|ceiling|cols|cor|cos|count|cov|cross|csv|cut|delete|deltas|desc|dev|differ|distinct|div|do|dsave|ej|enlist|eval|except|exec|exit|exp|fby|fills|first|fkeys|flip|floor|from|get|getenv|group|gtime|hclose|hcount|hdel|hopen|hsym|iasc|identity|idesc|if|ij|in|insert|inter|inv|keys?|last|like|list|ljf?|load|log|lower|lsq|ltime|ltrim|mavg|maxs?|mcount|md5|mdev|med|meta|mins?|mmax|mmin|mmu|mod|msum|neg|next|not|null|or|over|parse|peach|pj|plist|prds?|prev|prior|rand|rank|ratios|raze|read0|read1|reciprocal|reval|reverse|rload|rotate|rsave|rtrim|save|scan|scov|sdev|select|set|setenv|show|signum|sin|sqrt|ssr?|string|sublist|sums?|sv|svar|system|tables|tan|til|trim|txf|type|uj|ungroup|union|update|upper|upsert|value|var|views?|vs|wavg|where|while|within|wj1?|wsum|ww|xasc|xbar|xcols?|xdesc|xexp|xgroup|xkey|xlog|xprev|xrank)\b/,adverb:{pattern:/['\/\\]:?|\beach\b/,alias:"function"},verb:{pattern:/(?:\B\.\B|\b[01]:|<[=>]?|>=?|[:+\-*%,!?~=|$&#@^]):?|\b_\b:?/,alias:"operator"},punctuation:/[(){}\[\];.]/}},1648:function(){!function(e){e.languages.ruby=e.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===||[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),e.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var t={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:e.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete e.languages.ruby.function;var n="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",r=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;e.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+n+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+r),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+r+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),e.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+n),greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+n),greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete e.languages.ruby.string,e.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),e.languages.rb=e.languages.ruby}(Prism)},4252:function(){Prism.languages.scala=Prism.languages.extend("java",{"triple-quoted-string":{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string"},string:{pattern:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},keyword:/<-|=>|\b(?:abstract|case|catch|class|def|derives|do|else|enum|extends|extension|final|finally|for|forSome|given|if|implicit|import|infix|inline|lazy|match|new|null|object|opaque|open|override|package|private|protected|return|sealed|self|super|this|throw|trait|transparent|try|type|using|val|var|while|with|yield)\b/,number:/\b0x(?:[\da-f]*\.)?[\da-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e\d+)?[dfl]?/i,builtin:/\b(?:Any|AnyRef|AnyVal|Boolean|Byte|Char|Double|Float|Int|Long|Nothing|Short|String|Unit)\b/,symbol:/'[^\d\s\\]\w*/}),Prism.languages.insertBefore("scala","triple-quoted-string",{"string-interpolation":{pattern:/\b[a-z]\w*(?:"""(?:[^$]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*?"""|"(?:[^$"\r\n]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*")/i,greedy:!0,inside:{id:{pattern:/^\w+/,greedy:!0,alias:"function"},escape:{pattern:/\\\$"|\$[$"]/,greedy:!0,alias:"symbol"},interpolation:{pattern:/\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,greedy:!0,inside:{punctuation:/^\$\{?|\}$/,expression:{pattern:/[\s\S]+/,inside:Prism.languages.scala}}},string:/[\s\S]+/}}}),delete Prism.languages.scala["class-name"],delete Prism.languages.scala.function,delete Prism.languages.scala.constant},6966:function(){Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}},4793:function(){Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ \t]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},Prism.languages.swift["string-literal"].forEach(function(e){e.inside.interpolation.inside=Prism.languages.swift})},83:function(){!function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+n.source+")?)",i=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function s(e,t){t=(t||"").replace(/m/g,"")+"m";var n=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return r}).replace(/<>/g,function(){return e});return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return r}).replace(/<>/g,function(){return"(?:"+i+"|"+o+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:s(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:s(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:s(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:s(o),lookbehind:!0,greedy:!0},number:{pattern:s(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(Prism)},8848:function(e,t,n){var r=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,r={},i={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof o?new o(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=p.reach);S+=k.value.length,k=k.next){var E=k.value;if(t.length>e.length)return;if(!(E instanceof o)){var O,_=1;if(b){if(!(O=s(w,S,e,y))||O.index>=e.length)break;var P=O.index,$=O.index+O[0].length,A=S;for(A+=k.value.length;P>=A;)A+=(k=k.next).value.length;if(S=A-=k.value.length,k.value instanceof o)continue;for(var C=k;C!==t.tail&&(A<$||"string"==typeof C.value);C=C.next)_++,A+=C.value.length;_--,E=e.slice(S,A),O.index-=S}else if(!(O=s(w,0,E,y)))continue;P=O.index;var j=O[0],T=E.slice(0,P),N=E.slice(P+j.length),I=S+E.length;p&&I>p.reach&&(p.reach=I);var R=k.prev;if(T&&(R=c(t,R,T),S+=T.length),u(t,R,_),k=c(t,R,new o(d,g?i.tokenize(j,g):j,v,j)),N&&c(t,k,N),_>1){var L={cause:d+","+h,reach:I};a(e,t,n,k.prev,S,L),p&&L.reach>p.reach&&(p.reach=L.reach)}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function u(e,t,n){for(var r=t.next,i=0;i"+o.content+""},!e.document)return e.addEventListener?(i.disableWorkerMessageHandler||e.addEventListener("message",function(t){var n=JSON.parse(t.data),r=n.language,o=n.code,s=n.immediateClose;e.postMessage(i.highlight(o,i.languages[r],r)),s&&e.close()},!1),i):i;var p=i.util.currentScript();function d(){i.manual||i.highlightAll()}if(p&&(i.filename=p.src,p.hasAttribute("data-manual")&&(i.manual=!0)),!i.manual){var f=document.readyState;"loading"===f||"interactive"===f&&p&&p.defer?document.addEventListener("DOMContentLoaded",d):window.requestAnimationFrame?window.requestAnimationFrame(d):window.setTimeout(d,16)}return i}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});e.exports&&(e.exports=r),void 0!==n.g&&(n.g.Prism=r),r.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},r.languages.markup.tag.inside["attr-value"].inside.entity=r.languages.markup.entity,r.languages.markup.doctype.inside["internal-subset"].inside=r.languages.markup,r.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(r.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:r.languages[t]},n.cdata=/^$/i;var i={"included-cdata":{pattern://i,inside:n}};i["language-"+t]={pattern:/[\s\S]+/,inside:r.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:i},r.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(r.languages.markup.tag,"addAttribute",{value:function(e,t){r.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:r.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),r.languages.html=r.languages.markup,r.languages.mathml=r.languages.markup,r.languages.svg=r.languages.markup,r.languages.xml=r.languages.extend("markup",{}),r.languages.ssml=r.languages.xml,r.languages.atom=r.languages.xml,r.languages.rss=r.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(r),r.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},r.languages.javascript=r.languages.extend("clike",{"class-name":[r.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),r.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,r.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:r.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:r.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:r.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:r.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:r.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),r.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:r.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),r.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),r.languages.markup&&(r.languages.markup.tag.addInlined("script","javascript"),r.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),r.languages.js=r.languages.javascript,function(){if(void 0!==r&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",n="loading",i="loaded",o="pre[data-src]:not(["+t+'="'+i+'"]):not(['+t+'="'+n+'"])';r.hooks.add("before-highlightall",function(e){e.selector+=", "+o}),r.hooks.add("before-sanity-check",function(s){var a=s.element;if(a.matches(o)){s.code="",a.setAttribute(t,n);var l=a.appendChild(document.createElement("CODE"));l.textContent="Loading…";var c=a.getAttribute("data-src"),u=s.language;if("none"===u){var p=(/\.(\w+)$/.exec(c)||[,"none"])[1];u=e[p]||p}r.util.setLanguage(l,u),r.util.setLanguage(a,u);var d=r.plugins.autoloader;d&&d.loadLanguages(u),function(e,n,o){var s=new XMLHttpRequest;s.open("GET",e,!0),s.onreadystatechange=function(){4==s.readyState&&(s.status<400&&s.responseText?function(e){a.setAttribute(t,i);var n=function(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var n=Number(t[1]),r=t[2],i=t[3];return r?i?[n,Number(i)]:[n,void 0]:[n,n]}}(a.getAttribute("data-range"));if(n){var o=e.split(/\r\n?|\n/g),s=n[0],c=null==n[1]?o.length:n[1];s<0&&(s+=o.length),s=Math.max(0,Math.min(s-1,o.length)),c<0&&(c+=o.length),c=Math.max(0,Math.min(c,o.length)),e=o.slice(s,c).join("\n"),a.hasAttribute("data-start")||a.setAttribute("data-start",String(s+1))}l.textContent=e,r.highlightElement(l)}(s.responseText):s.status>=400?o("✖ Error "+s.status+" while fetching file: "+s.statusText):o("✖ Error: File does not exist or is empty"))},s.send(null)}(c,0,function(e){a.setAttribute(t,"failed"),l.textContent=e})}}),r.plugins.fileHighlight={highlight:function(e){for(var t,n=(e||document).querySelectorAll(o),i=0;t=n[i++];)r.highlightElement(t)}};var s=!1;r.fileHighlight=function(){s||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),s=!0),r.plugins.fileHighlight.highlight.apply(this,arguments)}}}()},2694:function(e,t,n){"use strict";var r=n(6925);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,s){if(s!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},5556:function(e,t,n){e.exports=n(2694)()},6925:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},2551:function(e,t,n){"use strict";var r=n(6540),i=n(194);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n