diff --git a/CHANGELOG.md b/CHANGELOG.md index f862fe8b..5eac89d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,51 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [2.13.0] — Full-corpus reasoning mining: deep discovery, per-model targets, live progress + +### Added + +- **Full-corpus reasoning mining.** The miner now discovers transcripts + recursively — nested session directories and Task-tool subagent transcripts + (`projects///subagents/agent-*.jsonl`), not just the top + `projects//*.jsonl` layer — so the ~1000 previously-invisible files + are mined. Subagent traces are attributed to their real project, not a + literal "subagents" pseudo-project. +- **Per-model pattern targets.** Each mineable model has a distillation target + (0–100), set via a slider on the dashboard Reasoning tab (or + `[reasoning_training.pattern_targets]` in config / `PUT /config`). A + preliminary Mine with no targets set only DETECTS models; raising a target + then distills that model's traces up to the target. Replaces the old global + `max_patterns_per_run`. +- **Live mining progress.** `GET /api/dashboard/reasoning/status` and the + dashboard show the phase (scanning → ingesting → distilling → done), files + scanned/total, traces found/ingested, and per-model distillation progress + while a run is active. The `smem reasoning mine` CLI prints the same, and + `docker logs` shows INFO milestones at start / after ingest / at end. +- **Backfill is a true full re-scan.** `--backfill` (CLI / MCP / dashboard) now + re-reads every transcript from the top, bypassing the incremental + size+mtime/line skip (trace-hash dedup keeps it idempotent) instead of only + widening the lookback window. It never deletes scan state, so a later normal + scan stays cheap. + +### Changed + +- **opus-4-8 is now mined.** It was wrongly denylisted as "signature-only + thinking"; the real corpus has ~933 opus-4-8 traces averaging ~1166 chars of + genuine reasoning. The prefix-denylist mechanism is kept (currently empty) for + a future thinking-less model. +- **No per-scan trace cap.** `max_traces_per_scan` is removed — mining ingests + one transcript at a time (bounded memory) and sees ALL traces. The + `max_trace_chars` content-safety limit is raised 20k → 100k. + +### Fixed + +- **Docker: reasoning mining found zero traces.** `docker-compose.surrealdb.yml` + now mounts the host's `~/.claude/projects` read-only into the dashboard + container at `/home/appuser/.claude/projects`. Without it the in-container miner + scanned an empty `~/.claude` and every dashboard "Mine" finished instantly with + 0 traces (no error) — looking like nothing happened. Projects-only, read-only + mount (not the whole `~/.claude`); override via `HOST_CLAUDE_PROJECTS` in `.env`. ## [2.12.1] — Release pipeline: npm packages actually ship again diff --git a/dashboard/e2e/reasoning.spec.ts b/dashboard/e2e/reasoning.spec.ts index 91070de8..4e25d918 100644 --- a/dashboard/e2e/reasoning.spec.ts +++ b/dashboard/e2e/reasoning.spec.ts @@ -27,19 +27,18 @@ const STATUS_BODY = { injection_map: {}, categories: CATEGORIES, min_trace_chars: 200, - max_trace_chars: 20000, - max_traces_per_scan: 500, + max_trace_chars: 100000, scan_lookback_days: 30, retention_days: 90, max_traces_total: 20000, min_cluster_support: 3, - max_patterns_per_run: 10, min_confidence: 0.2, min_patterns_per_category: 3, injection_max_patterns: 5, injection_max_chars: 4000, distill_use_llm: false, redact_secrets: true, + pattern_targets: {}, }, detected_models: ["claude-fable-5"], per_model: [ @@ -67,8 +66,16 @@ const STATUS_BODY = { running: false, started_at: null, finished_at: null, + phase: "idle", + files_total: 0, + files_scanned: 0, + traces_found: 0, traces_ingested: 0, + traces_processed: 0, patterns_learned: 0, + current_model: null, + models_done: 0, + models_total: 0, dry_run: false, error: null, }, diff --git a/dashboard/src/api/hooks/useReasoning.ts b/dashboard/src/api/hooks/useReasoning.ts index 1aa0b7b7..73b1b152 100644 --- a/dashboard/src/api/hooks/useReasoning.ts +++ b/dashboard/src/api/hooks/useReasoning.ts @@ -22,8 +22,8 @@ export function useReasoningStatus() { return useQuery({ queryKey: keys.status, queryFn: () => api.get("/api/dashboard/reasoning/status"), - // Poll while a mining job is running so counts/coverage update live. - refetchInterval: (query) => (query.state.data?.mining.running ? 3000 : false), + // Poll while a mining job is running so live progress + counts update. + refetchInterval: (query) => (query.state.data?.mining.running ? 1500 : false), }) } diff --git a/dashboard/src/api/types.ts b/dashboard/src/api/types.ts index 3700a72f..638892f3 100755 --- a/dashboard/src/api/types.ts +++ b/dashboard/src/api/types.ts @@ -487,18 +487,18 @@ export interface ReasoningConfig { categories: string[] min_trace_chars: number max_trace_chars: number - max_traces_per_scan: number scan_lookback_days: number retention_days: number max_traces_total: number min_cluster_support: number - max_patterns_per_run: number min_confidence: number min_patterns_per_category: number injection_max_patterns: number injection_max_chars: number distill_use_llm: boolean redact_secrets: boolean + // Per-model distillation targets (model -> desired pattern count, 0..100). + pattern_targets: Record } export interface ModelTraceStats { @@ -517,12 +517,22 @@ export interface CategoryCoverage { covered: boolean } +export type MiningPhase = "idle" | "scanning" | "ingesting" | "distilling" | "done" + export interface MiningJobState { running: boolean started_at: string | null finished_at: string | null + phase: MiningPhase + files_total: number + files_scanned: number + traces_found: number traces_ingested: number + traces_processed: number patterns_learned: number + current_model: string | null + models_done: number + models_total: number dry_run: boolean error: string | null } @@ -546,15 +556,17 @@ export interface ReasoningConfigUpdate { mining_models?: string[] injection_map?: Record categories?: string[] + min_trace_chars?: number + max_trace_chars?: number scan_lookback_days?: number retention_days?: number max_traces_total?: number min_cluster_support?: number - max_patterns_per_run?: number min_confidence?: number min_patterns_per_category?: number injection_max_patterns?: number injection_max_chars?: number + pattern_targets?: Record } export interface ReasoningConfigUpdateResponse { diff --git a/dashboard/src/features/reasoning/MiningConfigCard.tsx b/dashboard/src/features/reasoning/MiningConfigCard.tsx index c87eeeda..f97c2287 100644 --- a/dashboard/src/features/reasoning/MiningConfigCard.tsx +++ b/dashboard/src/features/reasoning/MiningConfigCard.tsx @@ -11,12 +11,66 @@ import { useUpdateReasoningConfig, useWipeTraces, } from "@/api/hooks/useReasoning" -import type { ReasoningStatusResponse } from "@/api/types" +import type { MiningJobState, ReasoningStatusResponse } from "@/api/types" interface Props { status: ReasoningStatusResponse } +function MiningProgressBlock({ mining }: { mining: MiningJobState }) { + const { t } = useTranslation() + const { phase, files_total, files_scanned, traces_found, traces_ingested } = mining + const pct = files_total > 0 ? Math.round((files_scanned / files_total) * 100) : 0 + const scanning = phase === "scanning" || phase === "ingesting" + const phaseLabel = + phase === "scanning" + ? t("reasoning.progressScanning") + : phase === "ingesting" + ? t("reasoning.progressIngesting") + : phase === "distilling" + ? t("reasoning.progressDistilling") + : t("reasoning.progressDone") + + return ( +
+
+ {phaseLabel} + {scanning && files_total > 0 && ( + + {t("reasoning.progressFiles", { scanned: files_scanned, total: files_total })} + + )} +
+ {scanning && files_total > 0 && ( +
+
+
+ )} + {scanning && ( +

+ {t("reasoning.progressTraces", { found: traces_found, ingested: traces_ingested })} +

+ )} + {phase === "distilling" && ( +

+ {t("reasoning.progressModels", { + model: mining.current_model ?? "", + done: mining.models_done, + total: mining.models_total, + patterns: mining.patterns_learned, + })} +

+ )} +
+ ) +} + export function MiningConfigCard({ status }: Props) { const { t } = useTranslation() const updateConfig = useUpdateReasoningConfig() @@ -169,6 +223,8 @@ export function MiningConfigCard({ status }: Props) { {running ? t("reasoning.miningRunning") : t("reasoning.runMining")}
+ + {running && } m.has_thinking_text) + const configTargets = status.config.pattern_targets + + const [targets, setTargets] = useState>(configTargets) + // Re-sync local slider state when the server config changes. + useEffect(() => { + setTargets(configTargets) + }, [configTargets]) + + const setTarget = (model: string, value: number) => { + const next = { ...targets, [model]: value } + setTargets(next) + updateConfig.mutate( + { pattern_targets: next }, + { + onSuccess: () => toast.success(t("reasoning.configSaved")), + onError: (err) => toast.error(apiErrorMessage(err, t("reasoning.configSaveFailed"))), + }, + ) + } + + return ( + + + {t("reasoning.targetsTitle")} + + + {models.length === 0 ? ( +

{t("reasoning.noModels")}

+ ) : ( +
+ {models.map((m) => { + const value = targets[m.model] ?? 0 + return ( +
+
+ {m.model} + + {value} + +
+ setTarget(m.model, Number(e.target.value))} + className="w-full cursor-pointer accent-primary" + /> +
+ + {t("reasoning.targetCounts", { + patterns: m.pattern_count, + traces: m.trace_count, + })} + + {value === 0 && {t("reasoning.targetsZeroHint")}} +
+
+ ) + })} +
+ )} +

{t("reasoning.targetsHint")}

+
+
+ ) +} diff --git a/dashboard/src/features/reasoning/ReasoningPage.tsx b/dashboard/src/features/reasoning/ReasoningPage.tsx index fbd201da..87b66619 100644 --- a/dashboard/src/features/reasoning/ReasoningPage.tsx +++ b/dashboard/src/features/reasoning/ReasoningPage.tsx @@ -8,6 +8,7 @@ import { Skeleton } from "@/components/ui/skeleton" import { useReasoningStatus } from "@/api/hooks/useReasoning" import type { ReasoningStatusResponse } from "@/api/types" import { MiningConfigCard } from "./MiningConfigCard" +import { PatternTargetsCard } from "./PatternTargetsCard" import { InjectionMappingCard } from "./InjectionMappingCard" import { PatternsTable } from "./PatternsTable" @@ -126,9 +127,11 @@ export default function ReasoningPage() {
- +
+ + tuple[str, ...]: @@ -137,6 +137,12 @@ async def _mine() -> None: from surreal_memory.engine.reasoning_distiller import distill_reasoning_patterns from surreal_memory.engine.reasoning_miner import ingest_reasoning_traces + from surreal_memory.engine.reasoning_progress import ( + PHASE_DISTILLING, + PHASE_INGESTING, + PHASE_SCANNING, + MiningProgress, + ) from surreal_memory.unified_config import get_config as get_unified_config config = get_config() @@ -174,11 +180,40 @@ async def _mine() -> None: overrides["mining_models"] = model_list run_cfg = dc_replace(ucfg, reasoning_training=dc_replace(rt, **overrides)) - ingest = await ingest_reasoning_traces(storage, brain_id, run_cfg) - distill = await distill_reasoning_patterns(storage, brain_id, run_cfg) + # Live progress printer (human output only; keeps --json machine-clean). + _prog: dict[str, Any] = {"phase": "", "model": "", "files": -1} + + def _progress(p: MiningProgress) -> None: + if json_output: + return + if p.phase != _prog["phase"]: + _prog["phase"] = p.phase + typer.echo(f"[{p.phase}]") + if p.phase in (PHASE_SCANNING, PHASE_INGESTING): + if p.files_total and p.files_scanned - int(_prog["files"]) >= 250: + _prog["files"] = p.files_scanned + typer.echo( + f" scanned {p.files_scanned}/{p.files_total} files " + f"· {p.traces_found} traces" + ) + elif ( + p.phase == PHASE_DISTILLING + and p.current_model + and p.current_model != _prog["model"] + ): + _prog["model"] = p.current_model + typer.echo(f" distilling {p.current_model} ({p.models_done}/{p.models_total})") + + ingest = await ingest_reasoning_traces( + storage, brain_id, run_cfg, backfill=backfill, progress=_progress + ) + distill = await distill_reasoning_patterns( + storage, brain_id, run_cfg, drain=True, progress=_progress + ) result = { "traces_ingested": ingest.traces_ingested, "patterns_learned": distill.patterns_learned, + "files_scanned": ingest.files_scanned, } if json_output: output_result(result, True) diff --git a/src/surreal_memory/engine/reasoning_distiller.py b/src/surreal_memory/engine/reasoning_distiller.py index d90aa31b..e59078a4 100644 --- a/src/surreal_memory/engine/reasoning_distiller.py +++ b/src/surreal_memory/engine/reasoning_distiller.py @@ -33,9 +33,11 @@ from surreal_memory.core.neuron import Neuron, NeuronType from surreal_memory.core.synapse import Direction, Synapse, SynapseType from surreal_memory.engine.clustering import UnionFind +from surreal_memory.engine.reasoning_progress import PHASE_DISTILLING, MiningProgress if TYPE_CHECKING: from surreal_memory.engine.embedding.provider import EmbeddingProvider + from surreal_memory.engine.reasoning_progress import ProgressCallback from surreal_memory.storage.base import NeuralStorage from surreal_memory.unified_config import ReasoningTrainingConfig, UnifiedConfig @@ -46,6 +48,9 @@ _MOVE_JACCARD = 0.6 _CLASSIFY_CHARS = 500 _BATCH_PER_MODEL = 200 +# Ceiling on existing pattern fibers fetched for dedup/existing-count/coverage. +# Raised from 5000 for full-corpus mining across many models (u008). +_PATTERN_FETCH_LIMIT = 20_000 # ── Reasoning moves (closed vocabulary; regex discourse markers) ────────────── _REASONING_MOVES: dict[str, re.Pattern[str]] = { @@ -477,10 +482,10 @@ async def _process_model_batch( """Distill one model's trace batch. Returns (patterns_created, consumed_ids). ``consumed_ids`` are the traces safe to mark processed: ``other`` traces, - under-support categories, and every category fully clustered before the - ``budget`` (remaining max_patterns_per_run) ran out. A category left - unreached — or cut off mid-cluster — by the cap is NOT consumed, so the next - run revisits it (already-materialized patterns are skipped by signature). + under-support categories, and every category fully clustered before this + model's remaining per-target ``budget`` ran out. A category left unreached — + or cut off mid-cluster — by the budget is NOT consumed, so the next run + revisits it (already-materialized patterns are skipped by signature). """ clf_texts = [ f"{t.get('task_context', '')} {str(t.get('content', ''))[:_CLASSIFY_CHARS]}".strip() @@ -507,7 +512,7 @@ async def _process_model_batch( created = 0 for category, idxs in by_category.items(): if created >= budget: - break # cap reached before this category → leave its traces unprocessed + break # budget reached before this category → leave its traces unprocessed if len(idxs) < rt.min_cluster_support: consumed.extend(traces[i]["id"] for i in idxs) # too few to cluster; done continue @@ -542,22 +547,43 @@ async def distill_reasoning_patterns( config: UnifiedConfig, *, embedder: EmbeddingProvider | None = None, + drain: bool = False, + progress: ProgressCallback | None = None, ) -> DistillResult: """Distill unprocessed reasoning traces into ReasoningBank pattern fibers. ``storage`` must already be on ``brain_id`` (graph writes use the current - brain). Marks only the consumed traces processed, then prunes/caps staging. + brain). Distillation is governed by per-model targets + (``reasoning_training.pattern_targets``): for each detected source model the + budget is ``max(0, target - existing_patterns_for_that_model)``. A model with + budget 0 (its target is unset/0, or already met) is SKIPPED entirely — its + traces stay unprocessed until a target is raised, so a preliminary Mine with + no targets set only DETECTS models without distilling anything. + + ``drain=True`` (a manual ``POST /mine``) keeps fetching batches for a model + until its budget is spent or its backlog is exhausted; ``drain=False`` + (background consolidation) processes at most one batch per model per run. + Consumed traces are marked processed per batch so the next fetch returns + fresh work. ``progress`` receives a distilling snapshot as each model + advances. """ rt = config.reasoning_training embedder = embedder or _get_embedder() seeds = await _seed_centroids(embedder, rt.categories) if embedder is not None else None - existing = await storage.find_fibers(metadata_key="_reasoning_pattern", limit=5000) + existing = await storage.find_fibers( + metadata_key="_reasoning_pattern", limit=_PATTERN_FETCH_LIMIT + ) existing_sigs = { str(f.metadata.get("_reasoning_signature")) for f in existing if f.metadata.get("_reasoning_signature") } + existing_by_model: dict[str, int] = {} + for f in existing: + source_model = f.metadata.get("_source_model") + if source_model: + existing_by_model[str(source_model)] = existing_by_model.get(str(source_model), 0) + 1 patterns_created = 0 processed_ids: list[Any] = [] @@ -567,32 +593,61 @@ async def distill_reasoning_patterns( # the same models as ingestion (and to POST /mine's models= override). An # empty mining_models means "all models" (unchanged default behavior). models = [m for m in models if any(fnmatch(m, pat) for pat in rt.mining_models)] + models_total = len(models) + + def _emit(current_model: str | None, models_done: int) -> None: + if progress is not None: + progress( + MiningProgress( + phase=PHASE_DISTILLING, + traces_processed=len(processed_ids), + patterns_learned=patterns_created, + current_model=current_model, + models_done=models_done, + models_total=models_total, + ) + ) - for model in models: - budget = rt.max_patterns_per_run - patterns_created + for idx, model in enumerate(models): + budget = max(0, rt.pattern_targets.get(model, 0) - existing_by_model.get(model, 0)) if budget <= 0: - break - traces = await storage.get_unprocessed_reasoning_traces( - brain_id, limit=rt.max_traces_per_scan, model=model - ) - traces = traces[:_BATCH_PER_MODEL] # one bounded batch per model per run - if not traces: + # Target unset/0 or already met → leave this model's traces unprocessed. + _emit(model, idx + 1) continue - created, consumed = await _process_model_batch( - storage, brain_id, rt, model, traces, embedder, seeds, existing_sigs, budget - ) - patterns_created += created - processed_ids.extend(consumed) + while budget > 0: + traces = await storage.get_unprocessed_reasoning_traces( + brain_id, limit=_BATCH_PER_MODEL, model=model + ) + traces = traces[:_BATCH_PER_MODEL] + if not traces: + break # backlog for this model exhausted + created, consumed = await _process_model_batch( + storage, brain_id, rt, model, traces, embedder, seeds, existing_sigs, budget + ) + patterns_created += created + budget -= created + if consumed: + processed_ids.extend(consumed) + # Mark consumed processed NOW so the next fetch returns fresh + # traces — otherwise a drain loop re-fetches the same batch forever. + await storage.mark_reasoning_traces_processed(brain_id, consumed) + _emit(model, idx) + # Termination guard: a batch that consumes nothing makes no forward + # progress (budget hit 0 mid-category), so stop draining this model. + if not consumed: + break + if not drain: + break # background consolidation: one batch per model per run + _emit(model, idx + 1) if processed_ids: - await storage.mark_reasoning_traces_processed(brain_id, processed_ids) await storage.prune_reasoning_traces(brain_id, rt.retention_days) await storage.cap_reasoning_traces(brain_id, rt.max_traces_total) return DistillResult( patterns_learned=patterns_created, traces_processed=len(processed_ids), - models_seen=len(models), + models_seen=models_total, ) @@ -609,7 +664,9 @@ async def reasoning_coverage( it is never in ``categories``). ``storage`` must be on the target brain. """ rt = config.reasoning_training - fibers = await storage.find_fibers(metadata_key="_reasoning_pattern", limit=5000) + fibers = await storage.find_fibers( + metadata_key="_reasoning_pattern", limit=_PATTERN_FETCH_LIMIT + ) counts: dict[str, int] = dict.fromkeys(rt.categories, 0) for f in fibers: md = f.metadata diff --git a/src/surreal_memory/engine/reasoning_injection.py b/src/surreal_memory/engine/reasoning_injection.py index 531c2d1b..179b8f53 100644 --- a/src/surreal_memory/engine/reasoning_injection.py +++ b/src/surreal_memory/engine/reasoning_injection.py @@ -43,7 +43,7 @@ # the distiller's own fetch limit. If it is ever hit, we warn rather than let a # source model's patterns silently fall outside the window (the post-LIMIT # metadata-filter failure mode documented in storage.find_fibers). -_PATTERN_FETCH_LIMIT = 5000 +_PATTERN_FETCH_LIMIT = 20_000 # Claude Code short model aliases -> canonical ids used across the reasoning # pipeline. Full ids pass through ``normalize_model`` unchanged. diff --git a/src/surreal_memory/engine/reasoning_miner.py b/src/surreal_memory/engine/reasoning_miner.py index e303fd54..c9f2e72e 100644 --- a/src/surreal_memory/engine/reasoning_miner.py +++ b/src/surreal_memory/engine/reasoning_miner.py @@ -13,18 +13,25 @@ from __future__ import annotations +import asyncio import hashlib import json import logging +import os import re import time -from dataclasses import dataclass +from dataclasses import dataclass, replace from datetime import UTC from fnmatch import fnmatch from functools import lru_cache from pathlib import Path from typing import TYPE_CHECKING, Any +from surreal_memory.engine.reasoning_progress import ( + PHASE_INGESTING, + PHASE_SCANNING, + MiningProgress, +) from surreal_memory.safety.sensitive import ( SensitivePattern, SensitiveType, @@ -36,15 +43,25 @@ if TYPE_CHECKING: from datetime import datetime + from surreal_memory.engine.reasoning_progress import ProgressCallback from surreal_memory.storage.base import NeuralStorage from surreal_memory.unified_config import ReasoningTrainingConfig, UnifiedConfig +# Persist scan-state to disk this often (in files) during a long ingest, so a +# crash midway keeps most of the progress; a full save also runs in ``finally``. +_STATE_SAVE_EVERY = 50 +# Emit a milestone log line this often (in files) so ``docker logs`` shows life. +_LOG_EVERY = 250 + logger = logging.getLogger(__name__) -# Models whose thinking blocks are empty (signature-only) — never a mining -# source. opus-4.8 is already excluded by the non-empty-thinking filter; this is -# a belt-and-suspenders prefix denylist (see run 007 BINDING CORRECTION #5). -_MODELS_WITHOUT_THINKING = ("claude-opus-4-8",) +# Prefix denylist of models whose thinking blocks are empty (signature-only) and +# must never be mined. Currently EMPTY: run-007 assumed claude-opus-4-8 emitted +# signature-only thinking, but the real corpus has ~933 opus-4-8 traces averaging +# ~1166 chars of genuine reasoning, so opus is now mined like any other model. +# The mechanism (_is_denylisted, the route's _has_thinking / PUT-config 422 path) +# is kept for a future model that genuinely lacks thinking text. +_MODELS_WITHOUT_THINKING: tuple[str, ...] = () # The synthetic attribution used for non-model turns — never mine it. _SYNTHETIC_MODEL = "" @@ -166,9 +183,50 @@ def _extract_user_text(entry: dict[str, Any]) -> str: return "" -def _project_from_path(jsonl: Path) -> str: - """Derive a readable project name from the transcript's parent directory.""" - return jsonl.parent.name +def _project_from_path(resolved: Path, projects_dir: Path) -> str: + """Derive the top-level project name from the transcript's location under *projects_dir*. + + Uses the first path segment under ``projects/`` (e.g. ``proj-a`` for both + ``proj-a/session.jsonl`` and ``proj-a/session/subagents/agent-1.jsonl``), + NOT the immediate parent directory — so nested session transcripts and Task-tool + subagent transcripts attribute to their actual project instead of a literal + session-id or ``"subagents"`` pseudo-project. + """ + try: + rel = resolved.relative_to(projects_dir.resolve()) + except ValueError: + return resolved.parent.name + return rel.parts[0] + + +def _discover_transcripts(projects_dir: Path, claude_root: Path) -> list[tuple[Path, Path]]: + """Recursively discover transcript files under *projects_dir*. + + Covers not just the direct ``projects//*.jsonl`` layer but also + session transcripts nested in dated/session subdirectories and Task-tool + subagent transcripts (``projects///subagents/agent-*.jsonl``), + which a one-level glob misses entirely. + + Each candidate must (a) resolve inside *claude_root* — a path-escape guard + against symlink/traversal tricks, checked at every depth, not just the top + level — and (b) sit at least one directory below *projects_dir*: a stray + file placed directly in ``projects/`` isn't associated with any project and + is skipped. Returns ``(original, resolved)`` pairs sorted by original path. + """ + projects_root = projects_dir.resolve() + discovered: list[tuple[Path, Path]] = [] + for jsonl in sorted(projects_dir.rglob("*.jsonl")): + resolved = jsonl.resolve() + if not resolved.is_relative_to(claude_root): + continue + try: + rel = resolved.relative_to(projects_root) + except ValueError: + continue + if len(rel.parts) < 2: + continue + discovered.append((jsonl, resolved)) + return discovered def _now_ts(now: datetime | None) -> float: @@ -198,12 +256,48 @@ def _save_scan_state(state_path: Path | None, state: dict[str, dict[str, Any]]) logger.debug("reasoning scan-state write failed: %s", state_path, exc_info=True) +def _plan_file_scan( + st: os.stat_result, + prev: dict[str, Any], + cutoff_ts: float | None, + *, + backfill: bool, +) -> tuple[bool, int]: + """Decide whether to skip a transcript file and which line to resume from. + + Normal scans (``backfill=False``) apply today's incrementality exactly as + before: honor the lookback cutoff, skip files whose size+mtime are + unchanged since the last scan, and resume after the last processed line on + append-only growth (falling back to line 0 on shrink/rewrite). + + A backfill scan (``backfill=True``) is a full re-scan BYPASS, not a + state-deletion: it ignores the lookback cutoff and the size+mtime skip and + always reads from line 0, regardless of what the scan-state says. It never + deletes or resets the state file — the caller still records this file's + fresh ``(mtime, size, last_line)`` afterward exactly as a normal scan + would, so trace_hash dedup at insert time makes the re-emission harmless + and a LATER normal scan sees the file as unchanged and skips it again. + + Returns ``(skip, start_line)``. + """ + if backfill: + return False, 0 + if cutoff_ts is not None and st.st_mtime < cutoff_ts: + return True, 0 + if prev.get("size") == st.st_size and prev.get("mtime") == st.st_mtime: + return True, 0 + start_line = int(prev.get("last_line", 0)) if st.st_size > int(prev.get("size", 0)) else 0 + return False, start_line + + @dataclass class ReasoningIngestResult: """Outcome of a reasoning-trace ingest pass.""" traces_ingested: int = 0 traces_scanned: int = 0 + files_total: int = 0 + files_scanned: int = 0 def scan_transcripts( @@ -212,17 +306,29 @@ def scan_transcripts( state_path: Path | None = None, claude_dir: Path | None = None, now: datetime | None = None, + backfill: bool = False, ) -> list[dict[str, Any]]: - """Scan ``~/.claude/projects/*/*.jsonl`` for mineable reasoning traces. - - Returns staging-ready dicts (trace_hash, model, session_id, project, - task_context, content, content_chars, created_at). Honors the config's - model globs, char limits, per-scan cap, lookback window and redaction flag, - and updates the incremental scan-state file. - - The per-scan cap is a soft target: a file is always scanned whole (so its - recorded state never hides un-returned traces), and scanning simply stops - after the running total reaches ``max_traces_per_scan``. + """Scan ``~/.claude/projects/**/*.jsonl`` for mineable reasoning traces. + + Discovery is recursive (see ``_discover_transcripts``): it covers nested + session transcripts and Task-tool subagent transcripts, not just the + direct ``projects//*.jsonl`` layer. Returns staging-ready dicts + (trace_hash, model, session_id, project, task_context, content, + content_chars, created_at). Honors the config's model globs, char limits, + lookback window and redaction flag, and updates the incremental + scan-state file (keyed by each file's full resolved path, so the extra + discovery depth simply accrues new entries). + + There is no per-scan cap: every matching file is scanned in full and all + its traces are returned, unbounded. + + ``backfill=True`` is a full re-scan BYPASS (see ``_plan_file_scan``): it + ignores the lookback cutoff, the size+mtime skip and any resume line for + EVERY discovered file, re-reading each one from the top. It is not + state-deletion — the scan-state entry for each file is still (re)written + afterward exactly as in a normal scan, so trace_hash dedup at insert time + keeps the re-emission harmless and a later normal (``backfill=False``) + scan again sees unchanged files and skips them cheaply. """ claude_root = (claude_dir or (Path.home() / ".claude")).resolve() projects_dir = claude_root / "projects" @@ -239,35 +345,23 @@ def scan_transcripts( traces: list[dict[str, Any]] = [] seen_hashes: set[str] = set() - for jsonl in sorted(projects_dir.glob("*/*.jsonl")): - resolved = jsonl.resolve() - # Path-escape guard: never read outside ~/.claude (symlink / traversal). - if not resolved.is_relative_to(claude_root): - continue + for _jsonl, resolved in _discover_transcripts(projects_dir, claude_root): try: st = resolved.stat() except OSError: continue - # Lookback window: skip transcripts untouched within scan_lookback_days. - if cutoff_ts is not None and st.st_mtime < cutoff_ts: - continue key = str(resolved) prev = state.get(key, {}) - # Incremental: skip files whose size+mtime are unchanged since last scan. - if prev.get("size") == st.st_size and prev.get("mtime") == st.st_mtime: + skip, start_line = _plan_file_scan(st, prev, cutoff_ts, backfill=backfill) + if skip: continue - # Resume after the last processed line on append-only growth; otherwise - # (shrunk / rewritten / edited-in-place) rescan from the top — trace_hash - # dedup keeps any re-emitted traces harmless at insert time. - start_line = int(prev.get("last_line", 0)) if st.st_size > int(prev.get("size", 0)) else 0 + project = _project_from_path(resolved, projects_dir) file_traces, line_count = _scan_file( - resolved, config, seen_hashes, fallback_created, start_line=start_line + resolved, config, seen_hashes, fallback_created, project, start_line=start_line ) traces.extend(file_traces) state[key] = {"mtime": st.st_mtime, "size": st.st_size, "last_line": line_count} - if len(traces) >= config.max_traces_per_scan: - break _save_scan_state(state_path, state) return traces @@ -278,6 +372,7 @@ def _scan_file( config: ReasoningTrainingConfig, seen_hashes: set[str], fallback_created: str, + project: str, *, start_line: int = 0, ) -> tuple[list[dict[str, Any]], int]: @@ -286,7 +381,6 @@ def _scan_file( ``start_line`` resumes after an already-processed prefix (append-only growth), so a resumed scan does not re-emit traces from earlier passes. """ - project = _project_from_path(resolved) out: list[dict[str, Any]] = [] prev_user_text = "" line_count = start_line @@ -411,19 +505,115 @@ async def ingest_reasoning_traces( claude_dir: Path | None = None, state_path: Path | None = None, now: datetime | None = None, + backfill: bool = False, + progress: ProgressCallback | None = None, ) -> ReasoningIngestResult: - """Scan transcripts and insert new reasoning traces into staging. - - The scan-state file lives under ``config.data_dir`` unless overridden. + """Scan transcripts and insert new reasoning traces into staging, per file. + + Unlike the synchronous :func:`scan_transcripts` (which gathers every trace + into one list), this async path discovers the transcript corpus, then scans + and INSERTS one file at a time: each file's blocking read runs in + ``asyncio.to_thread`` and its traces are staged immediately before the next + file is opened. That bounds peak memory to a single file's traces regardless + of corpus size (what makes the un-capped full-corpus scan safe) and lets it + report live :class:`MiningProgress` through *progress* as it goes. + + Scan-state is written every ``_STATE_SAVE_EVERY`` files and again in a + ``finally`` block, and a file's state entry is recorded only AFTER its + traces are successfully inserted — so a crash mid-insert leaves the failed + file un-recorded (it is re-scanned next run) while completed files persist. + The state file lives under ``config.data_dir`` unless overridden and is + never deleted; ``backfill=True`` bypasses the per-file skip (see + :func:`_plan_file_scan`) but is only ever set for an explicit user-triggered + run, never for background consolidation. """ resolved_state = state_path or (config.data_dir / "reasoning_scan_state.json") - traces = scan_transcripts( - config.reasoning_training, - state_path=resolved_state, - claude_dir=claude_dir, - now=now, + rt = config.reasoning_training + claude_root = (claude_dir or (Path.home() / ".claude")).resolve() + projects_dir = claude_root / "projects" + + prog = MiningProgress(phase=PHASE_SCANNING) + + def _emit() -> None: + if progress is not None: + progress(replace(prog)) + + if not projects_dir.is_dir(): + _emit() + return ReasoningIngestResult() + + discovered = _discover_transcripts(projects_dir, claude_root) + prog.files_total = len(discovered) + _emit() + + now_ts = _now_ts(now) + cutoff_ts = now_ts - rt.scan_lookback_days * 86400 if rt.scan_lookback_days > 0 else None + fallback_created = (now or utcnow()).isoformat() + + state = _load_scan_state(resolved_state) + seen_hashes: set[str] = set() + traces_scanned = 0 + traces_ingested = 0 + files_scanned = 0 + + prog.phase = PHASE_INGESTING + try: + for _jsonl, resolved in discovered: + try: + st = resolved.stat() + except OSError: + files_scanned += 1 + prog.files_scanned = files_scanned + continue + + key = str(resolved) + prev = state.get(key, {}) + skip, start_line = _plan_file_scan(st, prev, cutoff_ts, backfill=backfill) + if not skip: + project = _project_from_path(resolved, projects_dir) + # The blocking file read runs off the event-loop thread and + # RETURNS its traces; the callback below is only ever invoked + # from this (event-loop) thread. + file_traces, line_count = await asyncio.to_thread( + _scan_file, + resolved, + rt, + seen_hashes, + fallback_created, + project, + start_line=start_line, + ) + if file_traces: + # Insert this file's traces before opening the next file, so + # peak memory is one file's worth of traces, not the corpus. + inserted = await storage.insert_reasoning_traces(brain_id, file_traces) + traces_scanned += len(file_traces) + traces_ingested += inserted + # Record this file's scan-state ONLY after a successful insert: + # a crash mid-insert leaves it un-recorded so it is re-scanned. + state[key] = {"mtime": st.st_mtime, "size": st.st_size, "last_line": line_count} + + files_scanned += 1 + prog.files_scanned = files_scanned + prog.traces_found = traces_scanned + prog.traces_ingested = traces_ingested + if files_scanned % _STATE_SAVE_EVERY == 0: + _save_scan_state(resolved_state, state) + if files_scanned % _LOG_EVERY == 0: + logger.info( + "reasoning ingest: %d/%d files scanned, %d traces (%d new)", + files_scanned, + prog.files_total, + traces_scanned, + traces_ingested, + ) + _emit() + finally: + _save_scan_state(resolved_state, state) + + return ReasoningIngestResult( + traces_ingested=traces_ingested, + traces_scanned=traces_scanned, + files_total=prog.files_total, + files_scanned=files_scanned, ) - if not traces: - return ReasoningIngestResult(traces_ingested=0, traces_scanned=0) - ingested = await storage.insert_reasoning_traces(brain_id, traces) - return ReasoningIngestResult(traces_ingested=ingested, traces_scanned=len(traces)) diff --git a/src/surreal_memory/engine/reasoning_progress.py b/src/surreal_memory/engine/reasoning_progress.py new file mode 100644 index 00000000..e9f680e7 --- /dev/null +++ b/src/surreal_memory/engine/reasoning_progress.py @@ -0,0 +1,49 @@ +"""Live progress reporting for a reasoning-mining run. + +A ``MiningProgress`` snapshot is emitted through a ``ProgressCallback`` as a +mining run moves through its phases (``scanning`` the transcript corpus -> +``ingesting`` traces per file -> ``distilling`` patterns per model -> ``done``). +The callback is invoked ONLY from the event-loop thread: blocking file work runs +in ``asyncio.to_thread`` and returns its data to the caller, which then emits the +progress update. Consumers (the dashboard mining-state, the CLI progress printer, +the MCP response) read these snapshots; they never mutate a live object because +each emit passes an immutable copy. +""" + +from __future__ import annotations + +from collections.abc import Callable +from dataclasses import dataclass + +# Ordered mining phases. ``idle`` is the resting state before a run starts. +PHASE_IDLE = "idle" +PHASE_SCANNING = "scanning" +PHASE_INGESTING = "ingesting" +PHASE_DISTILLING = "distilling" +PHASE_DONE = "done" + + +@dataclass +class MiningProgress: + """A point-in-time snapshot of a reasoning-mining run. + + Additive by design: scanning/ingesting populate the file + trace counters; + distillation (a later stage) populates ``current_model`` and the model / + pattern counters. All fields default so a partially-populated snapshot is + always valid. + """ + + phase: str = PHASE_IDLE + files_total: int = 0 + files_scanned: int = 0 + traces_found: int = 0 + traces_ingested: int = 0 + traces_processed: int = 0 + patterns_learned: int = 0 + current_model: str | None = None + models_done: int = 0 + models_total: int = 0 + + +# A progress sink. Invoked from the event-loop thread with an immutable snapshot. +ProgressCallback = Callable[[MiningProgress], None] diff --git a/src/surreal_memory/mcp/reasoning_handler.py b/src/surreal_memory/mcp/reasoning_handler.py index eb806c56..cc5ea7e7 100644 --- a/src/surreal_memory/mcp/reasoning_handler.py +++ b/src/surreal_memory/mcp/reasoning_handler.py @@ -18,7 +18,7 @@ logger = logging.getLogger(__name__) -_PATTERN_FETCH_LIMIT = 5000 +_PATTERN_FETCH_LIMIT = 20_000 class ReasoningHandler: @@ -135,8 +135,9 @@ async def _reasoning_mine(self, brain_id: str, args: dict[str, Any]) -> dict[str if args.get("dry_run"): return {"traces_ingested": 0, "patterns_learned": 0, "dry_run": True} + backfill = bool(args.get("backfill")) overrides: dict[str, Any] = {} - if args.get("backfill"): + if backfill: overrides["scan_lookback_days"] = 0 models = args.get("models") if isinstance(models, list) and models: @@ -151,11 +152,13 @@ async def _reasoning_mine(self, brain_id: str, args: dict[str, Any]) -> dict[str storage = await create_isolated_storage(brain_id) owns_storage = self.config.storage_backend == "surrealdb" try: - ingest = await ingest_reasoning_traces(storage, brain_id, run_cfg) - distill = await distill_reasoning_patterns(storage, brain_id, run_cfg) + ingest = await ingest_reasoning_traces(storage, brain_id, run_cfg, backfill=backfill) + distill = await distill_reasoning_patterns(storage, brain_id, run_cfg, drain=True) return { "traces_ingested": ingest.traces_ingested, "patterns_learned": distill.patterns_learned, + "files_scanned": ingest.files_scanned, + "files_total": ingest.files_total, } finally: if owns_storage: diff --git a/src/surreal_memory/server/app.py b/src/surreal_memory/server/app.py index cb78575f..7b78d53d 100755 --- a/src/surreal_memory/server/app.py +++ b/src/surreal_memory/server/app.py @@ -51,6 +51,20 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]: _logger = logging.getLogger(__name__) + # Ensure surreal_memory.* INFO logs (mining milestones, consolidation) reach + # container stdout: uvicorn configures only its own loggers (not the root), + # so without this our INFO lines are swallowed by the WARNING-only lastResort + # handler. Only act when nothing else has configured logging, to avoid + # duplicate lines under an external log config. + _sm_logger = logging.getLogger("surreal_memory") + if _sm_logger.getEffectiveLevel() > logging.INFO: + _sm_logger.setLevel(logging.INFO) + if not _sm_logger.handlers and not logging.getLogger().handlers: + _handler = logging.StreamHandler() + _handler.setFormatter(logging.Formatter("%(asctime)s %(levelname)s %(name)s: %(message)s")) + _sm_logger.addHandler(_handler) + _sm_logger.propagate = False + # Register community plugin for full Pro features (no license required) try: from surreal_memory.plugins import has_pro, register diff --git a/src/surreal_memory/server/routes/reasoning_training.py b/src/surreal_memory/server/routes/reasoning_training.py index 892976e9..b7323be5 100644 --- a/src/surreal_memory/server/routes/reasoning_training.py +++ b/src/surreal_memory/server/routes/reasoning_training.py @@ -27,6 +27,14 @@ from surreal_memory.core.brain import Brain from surreal_memory.engine.reasoning_miner import _MODELS_WITHOUT_THINKING, normalize_model +from surreal_memory.engine.reasoning_progress import ( + PHASE_DISTILLING, + PHASE_DONE, + PHASE_IDLE, + PHASE_INGESTING, + PHASE_SCANNING, + MiningProgress, +) from surreal_memory.server.dependencies import get_brain, get_storage, require_local_request from surreal_memory.server.models import ErrorResponse from surreal_memory.storage.base import NeuralStorage @@ -42,7 +50,7 @@ # Pattern fibers are idempotent by _reasoning_signature (bounded population); # matches the distiller / injection fetch ceiling. -_PATTERN_FETCH_LIMIT = 5000 +_PATTERN_FETCH_LIMIT = 20_000 _MAX_PAGE = 100 # Model names / injection globs: letters, digits, dot, underscore, dash, glob chars. _MODEL_NAME_RE = re.compile(r"^[A-Za-z0-9._*?-]{1,128}$") @@ -60,8 +68,16 @@ def _idle_mining_state() -> dict[str, Any]: "running": False, "started_at": None, "finished_at": None, + "phase": PHASE_IDLE, + "files_total": 0, + "files_scanned": 0, + "traces_found": 0, "traces_ingested": 0, + "traces_processed": 0, "patterns_learned": 0, + "current_model": None, + "models_done": 0, + "models_total": 0, "dry_run": False, "error": None, } @@ -96,8 +112,16 @@ class MiningJobState(BaseModel): running: bool started_at: str | None = None finished_at: str | None = None + phase: str = PHASE_IDLE + files_total: int = 0 + files_scanned: int = 0 + traces_found: int = 0 traces_ingested: int = 0 + traces_processed: int = 0 patterns_learned: int = 0 + current_model: str | None = None + models_done: int = 0 + models_total: int = 0 dry_run: bool = False error: str | None = None @@ -123,15 +147,18 @@ class ReasoningConfigUpdate(BaseModel): mining_models: list[str] | None = None injection_map: dict[str, str] | None = None categories: list[str] | None = None + min_trace_chars: int | None = Field(None, ge=0, le=1_000_000) + max_trace_chars: int | None = Field(None, ge=1, le=10_000_000) scan_lookback_days: int | None = Field(None, ge=0, le=100_000) retention_days: int | None = Field(None, ge=1, le=100_000) max_traces_total: int | None = Field(None, ge=1, le=10_000_000) min_cluster_support: int | None = Field(None, ge=1, le=100_000) - max_patterns_per_run: int | None = Field(None, ge=1, le=100_000) min_confidence: float | None = Field(None, ge=0.0, le=1.0) min_patterns_per_category: int | None = Field(None, ge=1, le=100_000) injection_max_patterns: int | None = Field(None, ge=1, le=1000) injection_max_chars: int | None = Field(None, ge=1, le=1_000_000) + # Per-model distillation targets (model -> 0..100). Validated in update_config. + pattern_targets: dict[str, int] | None = None class MineRequest(BaseModel): @@ -382,12 +409,32 @@ async def update_config(body: ReasoningConfigUpdate) -> dict[str, Any]: raise HTTPException(status_code=422, detail="categories cannot be empty") changes["categories"] = deduped + if body.pattern_targets is not None: + targets: dict[str, int] = {} + for model, count in body.pattern_targets.items(): + name = _validate_model_name(model, field="pattern_targets") + # A target model must actually produce thinking text to be distillable. + if not _has_thinking(name): + raise HTTPException( + status_code=422, + detail=f"Model {name!r} has no thinking text and cannot be a pattern target", + ) + try: + targets[name] = max(0, min(int(count), 100)) + except (ValueError, TypeError): + raise HTTPException( + status_code=422, + detail=f"pattern_targets[{name!r}] must be an integer 0-100", + ) from None + changes["pattern_targets"] = targets + for field_name in ( + "min_trace_chars", + "max_trace_chars", "scan_lookback_days", "retention_days", "max_traces_total", "min_cluster_support", - "max_patterns_per_run", "min_confidence", "min_patterns_per_category", "injection_max_patterns", @@ -427,7 +474,7 @@ async def _run_mining( try: if dry_run: # Parity with consolidation dry_run: no scanning, no writes. - state.update(traces_ingested=0, patterns_learned=0) + state.update(phase=PHASE_DONE, traces_ingested=0, patterns_learned=0) return config = get_config() @@ -439,16 +486,68 @@ async def _run_mining( overrides["mining_models"] = tuple(models) run_config = dc_replace(config, reasoning_training=dc_replace(rt, **overrides)) + def _on_progress(p: MiningProgress) -> None: + # Merge per phase so distill snapshots (which don't know file counts) + # don't zero out the ingest phase's file/trace counters. + updates: dict[str, Any] = {"phase": p.phase} + if p.phase in (PHASE_SCANNING, PHASE_INGESTING): + updates.update( + files_total=p.files_total, + files_scanned=p.files_scanned, + traces_found=p.traces_found, + traces_ingested=p.traces_ingested, + ) + elif p.phase == PHASE_DISTILLING: + updates.update( + traces_processed=p.traces_processed, + patterns_learned=p.patterns_learned, + current_model=p.current_model, + models_done=p.models_done, + models_total=p.models_total, + ) + state.update(updates) + storage = await create_isolated_storage(brain_id) # We own the isolated SurrealDB instance and must close it; SQLite / in-memory # return the shared instance, which must NOT be closed out from under others. owns_storage = config.storage_backend == "surrealdb" try: - ingest = await ingest_reasoning_traces(storage, brain_id, run_config) - distill = await distill_reasoning_patterns(storage, brain_id, run_config) + logger.info("reasoning mining started for brain %s (backfill=%s)", brain_id, backfill) + state["phase"] = PHASE_SCANNING + ingest = await ingest_reasoning_traces( + storage, brain_id, run_config, backfill=backfill, progress=_on_progress + ) + logger.info( + "reasoning ingest done for brain %s: %d/%d files, %d traces (%d new)", + brain_id, + ingest.files_scanned, + ingest.files_total, + ingest.traces_scanned, + ingest.traces_ingested, + ) state.update( + phase=PHASE_DISTILLING, + files_total=ingest.files_total, + files_scanned=ingest.files_scanned, + traces_found=ingest.traces_scanned, traces_ingested=ingest.traces_ingested, + ) + distill = await distill_reasoning_patterns( + storage, brain_id, run_config, drain=True, progress=_on_progress + ) + state.update( + phase=PHASE_DONE, + traces_ingested=ingest.traces_ingested, + traces_processed=distill.traces_processed, patterns_learned=distill.patterns_learned, + models_done=distill.models_seen, + models_total=distill.models_seen, + ) + logger.info( + "reasoning mining done for brain %s: %d patterns from %d traces processed", + brain_id, + distill.patterns_learned, + distill.traces_processed, ) finally: if owns_storage: diff --git a/src/surreal_memory/server/static/dist/assets/DiagramsPage-ClJ9QIg8.js b/src/surreal_memory/server/static/dist/assets/DiagramsPage-DO04XJem.js similarity index 99% rename from src/surreal_memory/server/static/dist/assets/DiagramsPage-ClJ9QIg8.js rename to src/surreal_memory/server/static/dist/assets/DiagramsPage-DO04XJem.js index a4bfb40d..7db9f491 100644 --- a/src/surreal_memory/server/static/dist/assets/DiagramsPage-ClJ9QIg8.js +++ b/src/surreal_memory/server/static/dist/assets/DiagramsPage-DO04XJem.js @@ -1,4 +1,4 @@ -import{j as R}from"./vendor-query-CqA1cBNl.js";import{d as hs,r as Z,b as gs}from"./vendor-react-BfuodpLv.js";import{m as ps,n as ms,f as ys,B as xs}from"./index-DXL5wCpD.js";import{C as Ht,a as Dn,b as Ln,c as Vt}from"./card-Duzfr-hx.js";import{S as jn}from"./skeleton-CBW-y0cP.js";import{d as cn,T as ws,t as vs,n as bs}from"./timer-DWAvo6M8.js";import{i as Es,h as $n,j as zn,k as _s,l as Ns,m as Ss,n as yt,o as Bt,u as Cs}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-icons-C6dhS1UE.js";import"./vendor-ui-Qm4_4bAc.js";function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rn.hasOwnProperty(t)?{space:Rn[t],local:e}:e}function ks(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ut&&t.documentElement.namespaceURI===Ut?t.createElement(e):t.createElementNS(n,e)}}function Ms(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function To(e){var t=Mt(e);return(t.local?Ms:ks)(t)}function Is(){}function ln(e){return e==null?Is:function(){return this.querySelector(e)}}function Os(e){typeof e!="function"&&(e=ln(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r=g&&(g=E+1);!(N=_[g])&&++g=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function ta(e){e||(e=na);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;it?1:e>=t?0:NaN}function oa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ra(){return Array.from(this)}function ia(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ma:typeof t=="function"?xa:ya)(e,t,n??"")):He(this.node(),e)}function He(e,t){return e.style.getPropertyValue(t)||jo(e).getComputedStyle(e,null).getPropertyValue(t)}function va(e){return function(){delete this[e]}}function ba(e,t){return function(){this[e]=t}}function Ea(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _a(e,t){return arguments.length>1?this.each((t==null?va:typeof t=="function"?Ea:ba)(e,t)):this.node()[e]}function $o(e){return e.trim().split(/^|\s+/)}function un(e){return e.classList||new zo(e)}function zo(e){this._node=e,this._names=$o(e.getAttribute("class")||"")}zo.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Ro(e,t){for(var n=un(e),o=-1,r=t.length;++o=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Ka(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n()=>e;function Kt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:c,dx:a,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Kt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ac(e){return!e.ctrlKey&&!e.button}function cc(){return this.parentNode}function lc(e,t){return t??{x:e.x,y:e.y}}function uc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wo(){var e=ac,t=cc,n=lc,o=uc,r={},i=cn("start","drag","end"),s=0,c,a,l,u,d=0;function f(p){p.on("mousedown.drag",h).filter(o).on("touchstart.drag",_).on("touchmove.drag",b,sc).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(p,N){if(!(u||!e.call(this,p,N))){var S=g(this,t.call(this,p,N),p,N,"mouse");S&&(le(p.view).on("mousemove.drag",m,Je).on("mouseup.drag",w,Je),Fo(p.view),Ft(p),l=!1,c=p.clientX,a=p.clientY,S("start",p))}}function m(p){if(Re(p),!l){var N=p.clientX-c,S=p.clientY-a;l=N*N+S*S>d}r.mouse("drag",p)}function w(p){le(p.view).on("mousemove.drag mouseup.drag",null),Yo(p.view,l),Re(p),r.mouse("end",p)}function _(p,N){if(e.call(this,p,N)){var S=p.changedTouches,T=t.call(this,p,N),L=S.length,$,A;for($=0;${o.stop(),e(r+t)},t,n),o}var dc=cn("start","end","cancel","interrupt"),fc=[],Zo=0,Vn=1,Qt=2,xt=3,Bn=4,Jt=5,wt=6;function It(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;hc(e,n,{name:t,index:o,group:r,on:dc,tween:fc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Zo})}function dn(e,t){var n=me(e,t);if(n.state>Zo)throw new Error("too late; already scheduled");return n}function we(e,t){var n=me(e,t);if(n.state>xt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function hc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=vs(i,0,n.time);function i(l){n.state=Vn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,d,f,h;if(n.state!==Vn)return a();for(u in o)if(h=o[u],h.name===n.name){if(h.state===xt)return Hn(s);h.state===Bn?(h.state=wt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+uQt&&o.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Fc(e,t,n){var o,r,i=Bc(t)?dn:we;return function(){var s=i(this,e),c=s.on;c!==o&&(r=(o=c).copy()).on(t,n),s.on=r}}function Yc(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(Fc(n,e,t))}function Wc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Zc(){return this.on("end.remove",Wc(this._id))}function Xc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ln(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s()=>e;function xl(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ee(e,t,n){this.k=e,this.x=t,this.y=n}Ee.prototype={constructor:Ee,scale:function(e){return e===1?this:new Ee(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ee(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ot=new Ee(1,0,0);Uo.prototype=Ee.prototype;function Uo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ot;return e.__zoom}function Yt(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function wl(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function vl(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Fn(){return this.__zoom||Ot}function bl(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function El(){return navigator.maxTouchPoints||"ontouchstart"in this}function _l(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Ko(){var e=wl,t=vl,n=_l,o=bl,r=El,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],c=250,a=yt,l=cn("start","zoom","end"),u,d,f,h=500,m=150,w=0,_=10;function b(y){y.property("__zoom",Fn).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",A).filter(r).on("touchstart.zoom",C).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(y,I,v,k){var M=y.selection?y.selection():y;M.property("__zoom",Fn),y!==M?N(y,I,v,k):M.interrupt().each(function(){S(this,arguments).event(k).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},b.scaleBy=function(y,I,v,k){b.scaleTo(y,function(){var M=this.__zoom.k,j=typeof I=="function"?I.apply(this,arguments):I;return M*j},v,k)},b.scaleTo=function(y,I,v,k){b.transform(y,function(){var M=t.apply(this,arguments),j=this.__zoom,B=v==null?p(M):typeof v=="function"?v.apply(this,arguments):v,F=j.invert(B),Y=typeof I=="function"?I.apply(this,arguments):I;return n(g(E(j,Y),B,F),M,s)},v,k)},b.translateBy=function(y,I,v,k){b.transform(y,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),t.apply(this,arguments),s)},null,k)},b.translateTo=function(y,I,v,k,M){b.transform(y,function(){var j=t.apply(this,arguments),B=this.__zoom,F=k==null?p(j):typeof k=="function"?k.apply(this,arguments):k;return n(Ot.translate(F[0],F[1]).scale(B.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),j,s)},k,M)};function E(y,I){return I=Math.max(i[0],Math.min(i[1],I)),I===y.k?y:new Ee(I,y.x,y.y)}function g(y,I,v){var k=I[0]-v[0]*y.k,M=I[1]-v[1]*y.k;return k===y.x&&M===y.y?y:new Ee(y.k,k,M)}function p(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function N(y,I,v,k){y.on("start.zoom",function(){S(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(k).end()}).tween("zoom",function(){var M=this,j=arguments,B=S(M,j).event(k),F=t.apply(M,j),Y=v==null?p(F):typeof v=="function"?v.apply(M,j):v,X=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),O=M.__zoom,x=typeof I=="function"?I.apply(M,j):I,z=a(O.invert(Y).concat(X/O.k),x.invert(Y).concat(X/x.k));return function(V){if(V===1)V=x;else{var H=z(V),W=X/H[2];V=new Ee(W,Y[0]-H[0]*W,Y[1]-H[1]*W)}B.zoom(null,V)}})}function S(y,I,v){return!v&&y.__zooming||new T(y,I)}function T(y,I){this.that=y,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,I),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,I){return this.mouse&&y!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var I=le(this.that).datum();l.call(y,this.that,new xl(y,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:l}),I)}};function L(y,...I){if(!e.apply(this,arguments))return;var v=S(this,I).event(y),k=this.__zoom,M=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,o.apply(this,arguments)))),j=fe(y);if(v.wheel)(v.mouse[0][0]!==j[0]||v.mouse[0][1]!==j[1])&&(v.mouse[1]=k.invert(v.mouse[0]=j)),clearTimeout(v.wheel);else{if(k.k===M)return;v.mouse=[j,k.invert(j)],vt(this),v.start()}Ke(y),v.wheel=setTimeout(B,m),v.zoom("mouse",n(g(E(k,M),v.mouse[0],v.mouse[1]),v.extent,s));function B(){v.wheel=null,v.end()}}function $(y,...I){if(f||!e.apply(this,arguments))return;var v=y.currentTarget,k=S(this,I,!0).event(y),M=le(y.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",X,!0),j=fe(y,v),B=y.clientX,F=y.clientY;Fo(y.view),Yt(y),k.mouse=[j,this.__zoom.invert(j)],vt(this),k.start();function Y(O){if(Ke(O),!k.moved){var x=O.clientX-B,z=O.clientY-F;k.moved=x*x+z*z>w}k.event(O).zoom("mouse",n(g(k.that.__zoom,k.mouse[0]=fe(O,v),k.mouse[1]),k.extent,s))}function X(O){M.on("mousemove.zoom mouseup.zoom",null),Yo(O.view,k.moved),Ke(O),k.event(O).end()}}function A(y,...I){if(e.apply(this,arguments)){var v=this.__zoom,k=fe(y.changedTouches?y.changedTouches[0]:y,this),M=v.invert(k),j=v.k*(y.shiftKey?.5:2),B=n(g(E(v,j),k,M),t.apply(this,I),s);Ke(y),c>0?le(this).transition().duration(c).call(N,B,k,y):le(this).call(b.transform,B,k,y)}}function C(y,...I){if(e.apply(this,arguments)){var v=y.touches,k=v.length,M=S(this,I,y.changedTouches.length===k).event(y),j,B,F,Y;for(Yt(y),B=0;B"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},et=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qo=["Enter"," ","Escape"],Jo={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ve;(function(e){e.Strict="strict",e.Loose="loose"})(Ve||(Ve={}));var Pe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pe||(Pe={}));var tt;(function(e){e.Partial="partial",e.Full="full"})(tt||(tt={}));const er={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Me;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Me||(Me={}));var Et;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Et||(Et={}));var K;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(K||(K={}));const Yn={[K.Left]:K.Right,[K.Right]:K.Left,[K.Top]:K.Bottom,[K.Bottom]:K.Top};function tr(e){return e===null?null:e?"valid":"invalid"}const nr=e=>"id"in e&&"source"in e&&"target"in e,Nl=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),hn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),st=(e,t=[0,0])=>{const{width:n,height:o}=Se(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Sl=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):hn(r)?r:t.nodeLookup.get(r.id));const c=s?_t(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Tt(o,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Pt(n)},at=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=Tt(n,_t(r)),o=!0)}),o?Pt(n):{x:0,y:0,width:0,height:0}},gn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const c={...lt(t,[n,o,r]),width:t.width/r,height:t.height/r},a=[];for(const l of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=l;if(s&&!d||f)continue;const h=u.width??l.width??l.initialWidth??null,m=u.height??l.height??l.initialHeight??null,w=nt(c,Fe(l)),_=(h??0)*(m??0),b=i&&w>0;(!l.internals.handleBounds||b||w>=_||l.dragging)&&a.push(l)}return a},Cl=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function kl(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Ml({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const c=kl(e,s),a=at(c),l=pn(a,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function or({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),c=s.parentId?n.get(s.parentId):void 0,{x:a,y:l}=c?c.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!c)i?.("005",xe.error005());else{const h=c.measured.width,m=c.measured.height;h&&m&&(d=[[a,l],[a+h,l+m]])}else c&&Ye(s.extent)&&(d=[[s.extent[0][0]+a,s.extent[0][1]+l],[s.extent[1][0]+a,s.extent[1][1]+l]]);const f=Ye(d)?Ae(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",xe.error015()),{position:{x:f.x-a+(s.measured.width??0)*u[0],y:f.y-l+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function Il({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),m=!h&&f.parentId&&s.find(w=>w.id===f.parentId);(h||m)&&s.push(f)}const c=new Set(t.map(f=>f.id)),a=o.filter(f=>f.deletable!==!1),u=Cl(s,a);for(const f of a)c.has(f.id)&&!u.find(m=>m.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const Be=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ae=(e={x:0,y:0},t,n)=>({x:Be(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Be(e.y,t[0][1],t[1][1]-(n?.height??0))});function rr(e,t,n){const{width:o,height:r}=Se(n),{x:i,y:s}=n.internals.positionAbsolute;return Ae(e,[[i,s],[i+o,s+r]],t)}const Wn=(e,t,n)=>en?-Be(Math.abs(e-n),1,t)/t:0,ir=(e,t,n=15,o=40)=>{const r=Wn(e.x,o,t.width-o)*n,i=Wn(e.y,o,t.height-o)*n;return[r,i]},Tt=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),en=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Pt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Fe=(e,t=[0,0])=>{const{x:n,y:o}=hn(e)?e.internals.positionAbsolute:st(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},_t=(e,t=[0,0])=>{const{x:n,y:o}=hn(e)?e.internals.positionAbsolute:st(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},sr=(e,t)=>Pt(Tt(en(e),en(t))),nt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Zn=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),Ol=(e,t)=>{},ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),lt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const c={x:(e-n)/r,y:(t-o)/r};return i?ct(c,s):c},Nt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function je(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Tl(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=je(e,n),r=je(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=je(e.top??e.y??0,n),r=je(e.bottom??e.y??0,n),i=je(e.left??e.x??0,t),s=je(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Pl(e,t,n,o,r,i){const{x:s,y:c}=Nt(e,[t,n,o]),{x:a,y:l}=Nt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-a,d=i-l;return{left:Math.floor(s),top:Math.floor(c),right:Math.floor(u),bottom:Math.floor(d)}}const pn=(e,t,n,o,r,i)=>{const s=Tl(i,t,n),c=(t-s.x)/e.width,a=(n-s.y)/e.height,l=Math.min(c,a),u=Be(l,o,r),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*u,m=n/2-f*u,w=Pl(e,h,m,u,t,n),_={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:h-_.left+_.right,y:m-_.top+_.bottom,zoom:u}},ot=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function Se(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ar(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function cr(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const c=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*c[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*c[1]}return i}function Xn(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Al(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Dl(e){return{...Jo,...e||{}}}function Qe(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ge(e),c=lt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:a,y:l}=n?ct(c,t):c;return{xSnapped:a,ySnapped:l,...c}}const mn=e=>({width:e.offsetWidth,height:e.offsetHeight}),lr=e=>e?.getRootNode?.()||window?.document,Ll=["INPUT","SELECT","TEXTAREA"];function ur(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Ll.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const dr=e=>"clientX"in e,ge=(e,t)=>{const n=dr(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Gn=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const c=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(c.left-n.left)/o,y:(c.top-n.top)/o,...mn(s)}})};function fr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:c}){const a=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+c*.375+o*.125,u=Math.abs(a-e),d=Math.abs(l-t);return[a,l,u,d]}function ht(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function qn({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case K.Left:return[t-ht(t-o,i),n];case K.Right:return[t+ht(o-t,i),n];case K.Top:return[t,n-ht(n-r,i)];case K.Bottom:return[t,n+ht(r-n,i)]}}function yn({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:o,targetY:r,targetPosition:i=K.Top,curvature:s=.25}){const[c,a]=qn({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=qn({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,h,m]=fr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:c,sourceControlY:a,targetControlX:l,targetControlY:u});return[`M${e},${t} C${c},${a} ${l},${u} ${o},${r}`,d,f,h,m]}function hr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n0}const zl=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Rl=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Hl=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||zl;let r;return nr(e)?r={...e}:r={...e,id:o(e)},Rl(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,c]=hr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,c]}const Un={[K.Left]:{x:-1,y:0},[K.Right]:{x:1,y:0},[K.Top]:{x:0,y:-1},[K.Bottom]:{x:0,y:1}},Vl=({source:e,sourcePosition:t=K.Bottom,target:n})=>t===K.Left||t===K.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Bl({source:e,sourcePosition:t=K.Bottom,target:n,targetPosition:o=K.Top,center:r,offset:i,stepPosition:s}){const c=Un[t],a=Un[o],l={x:e.x+c.x*i,y:e.y+c.y*i},u={x:n.x+a.x*i,y:n.y+a.y*i},d=Vl({source:l,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",h=d[f];let m=[],w,_;const b={x:0,y:0},E={x:0,y:0},[,,g,p]=hr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[f]*a[f]===-1){f==="x"?(w=r.x??l.x+(u.x-l.x)*s,_=r.y??(l.y+u.y)/2):(w=r.x??(l.x+u.x)/2,_=r.y??l.y+(u.y-l.y)*s);const S=[{x:w,y:l.y},{x:w,y:u.y}],T=[{x:l.x,y:_},{x:u.x,y:_}];c[f]===h?m=f==="x"?S:T:m=f==="x"?T:S}else{const S=[{x:l.x,y:u.y}],T=[{x:u.x,y:l.y}];if(f==="x"?m=c.x===h?T:S:m=c.y===h?S:T,t===o){const P=Math.abs(e[f]-n[f]);if(P<=i){const D=Math.min(i-1,i-P);c[f]===h?b[f]=(l[f]>e[f]?-1:1)*D:E[f]=(u[f]>n[f]?-1:1)*D}}if(t!==o){const P=f==="x"?"y":"x",D=c[f]===a[P],y=l[P]>u[P],I=l[P]=C?(w=(L.x+$.x)/2,_=m[0].y):(w=m[0].x,_=(L.y+$.y)/2)}return[[e,{x:l.x+b.x,y:l.y+b.y},...m,{x:u.x+E.x,y:u.y+E.y},n],w,_,g,p]}function Fl(e,t,n,o){const r=Math.min(Kn(e,t)/2,Kn(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x{let p="";return g>0&&gn.id===t):e[0])||null}function nn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Wl(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,c)=>([c.markerStart||o,c.markerEnd||r].forEach(a=>{if(a&&typeof a=="object"){const l=nn(a,t);i.has(l)||(s.push({id:l,color:a.color||n,...a}),i.add(l))}}),s),[]).sort((s,c)=>s.id.localeCompare(c.id))}const pr=1e3,Zl=10,xn={nodeOrigin:[0,0],nodeExtent:et,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Xl={...xn,checkEquality:!0};function wn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Gl(e,t,n){const o=wn(xn,n);for(const r of e.values())if(r.parentId)bn(r,e,t,o);else{const i=st(r,o.nodeOrigin),s=Ye(r.extent)?r.extent:o.nodeExtent,c=Ae(i,s,Se(r));r.internals.positionAbsolute=c}}function ql(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function vn(e){return e==="manual"}function on(e,t,n,o={}){const r=wn(Xl,o),i={i:0},s=new Map(t),c=r?.elevateNodesOnSelect&&!vn(r.zIndexMode)?pr:0;let a=e.length>0;t.clear(),n.clear();for(const l of e){let u=s.get(l.id);if(r.checkEquality&&l===u?.internals.userNode)t.set(l.id,u);else{const d=st(l,r.nodeOrigin),f=Ye(l.extent)?l.extent:r.nodeExtent,h=Ae(d,f,Se(l));u={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:h,handleBounds:ql(l,u),z:mr(l,c,r.zIndexMode),userNode:l}},t.set(l.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(a=!1),l.parentId&&bn(u,t,n,o,i)}return a}function Ul(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function bn(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:c,zIndexMode:a}=wn(xn,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ul(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&a==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Zl),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=i&&!vn(a)?pr:0,{x:f,y:h,z:m}=Kl(e,u,s,c,d,a),{positionAbsolute:w}=e.internals,_=f!==w.x||h!==w.y;(_||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:f,y:h}:w,z:m}})}function mr(e,t,n){const o=he(e.zIndex)?e.zIndex:0;return vn(n)?o:o+(e.selected?t:0)}function Kl(e,t,n,o,r,i){const{x:s,y:c}=t.internals.positionAbsolute,a=Se(e),l=st(e,n),u=Ye(e.extent)?Ae(l,e.extent,a):l;let d=Ae({x:s+u.x,y:c+u.y},o,a);e.extent==="parent"&&(d=rr(d,a,t));const f=mr(e,r,i),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function En(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const c=t.get(s.parentId);if(!c)continue;const a=i.get(s.parentId)?.expandedRect??Fe(c),l=sr(a,s.rect);i.set(s.parentId,{expandedRect:l,parent:c})}return i.size>0&&i.forEach(({expandedRect:s,parent:c},a)=>{const l=c.internals.positionAbsolute,u=Se(c),d=c.origin??o,f=s.x0||h>0||_||b)&&(r.push({id:a,type:"position",position:{x:c.position.x-f+_,y:c.position.y-h+b}}),n.get(a)?.forEach(E=>{e.some(g=>g.id===E.id)||r.push({id:E.id,type:"position",position:{x:E.position.x+f,y:E.position.y+h}})})),(u.width0){const h=En(f,t,n,r);l.push(...h)}return{changes:l,updatedInternals:a}}async function Jl({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),c=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(c)}function to(e,t,n,o,r,i){let s=r;const c=o.get(s)||new Map;o.set(s,c.set(n,t)),s=`${r}-${e}`;const a=o.get(s)||new Map;if(o.set(s,a.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function yr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:c=null}=o,a={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:c},l=`${r}-${s}--${i}-${c}`,u=`${i}-${c}--${r}-${s}`;to("source",a,u,e,r,s),to("target",a,l,e,i,c),t.set(o.id,o)}}function xr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:xr(n,t):!1}function no(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function eu(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!xr(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const c=e.get(i);c&&r.set(i,{id:i,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return r}function Wt({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,c]of t){const a=n.get(s)?.internals.userNode;a&&r.push({...a,position:c.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function tu({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=ct(i,t);return{x:s.x-i.x,y:s.y-i.y}}function nu({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,c=new Map,a=!1,l={x:0,y:0},u=null,d=!1,f=null,h=!1,m=!1,w=null;function _({noDragClassName:E,handleSelector:g,domNode:p,isSelectable:N,nodeId:S,nodeClickDistance:T=0}){f=le(p);function L({x:P,y:D}){const{nodeLookup:y,nodeExtent:I,snapGrid:v,snapToGrid:k,nodeOrigin:M,onNodeDrag:j,onSelectionDrag:B,onError:F,updateNodePositions:Y}=t();i={x:P,y:D};let X=!1;const O=c.size>1,x=O&&I?en(at(c)):null,z=O&&k?tu({dragItems:c,snapGrid:v,x:P,y:D}):null;for(const[V,H]of c){if(!y.has(V))continue;let W={x:P-H.distance.x,y:D-H.distance.y};k&&(W=z?{x:Math.round(W.x+z.x),y:Math.round(W.y+z.y)}:ct(W,v));let G=null;if(O&&I&&!H.extent&&x){const{positionAbsolute:Q}=H.internals,J=Q.x-x.x+I[0][0],ee=Q.x+H.measured.width-x.x2+I[1][0],ne=Q.y-x.y+I[0][1],ce=Q.y+H.measured.height-x.y2+I[1][1];G=[[J,ne],[ee,ce]]}const{position:q,positionAbsolute:U}=or({nodeId:V,nextPosition:W,nodeLookup:y,nodeExtent:G||I,nodeOrigin:M,onError:F});X=X||H.position.x!==q.x||H.position.y!==q.y,H.position=q,H.internals.positionAbsolute=U}if(m=m||X,!!X&&(Y(c,!0),w&&(o||j||!S&&B))){const[V,H]=Wt({nodeId:S,dragItems:c,nodeLookup:y});o?.(w,c,V,H),j?.(w,V,H),S||B?.(w,H)}}async function $(){if(!u)return;const{transform:P,panBy:D,autoPanSpeed:y,autoPanOnNodeDrag:I}=t();if(!I){a=!1,cancelAnimationFrame(s);return}const[v,k]=ir(l,u,y);(v!==0||k!==0)&&(i.x=(i.x??0)-v/P[2],i.y=(i.y??0)-k/P[2],await D({x:v,y:k})&&L(i)),s=requestAnimationFrame($)}function A(P){const{nodeLookup:D,multiSelectionActive:y,nodesDraggable:I,transform:v,snapGrid:k,snapToGrid:M,selectNodesOnDrag:j,onNodeDragStart:B,onSelectionDragStart:F,unselectNodesAndEdges:Y}=t();d=!0,(!j||!N)&&!y&&S&&(D.get(S)?.selected||Y()),N&&j&&S&&e?.(S);const X=Qe(P.sourceEvent,{transform:v,snapGrid:k,snapToGrid:M,containerBounds:u});if(i=X,c=eu(D,I,X,S),c.size>0&&(n||B||!S&&F)){const[O,x]=Wt({nodeId:S,dragItems:c,nodeLookup:D});n?.(P.sourceEvent,c,O,x),B?.(P.sourceEvent,O,x),S||F?.(P.sourceEvent,x)}}const C=Wo().clickDistance(T).on("start",P=>{const{domNode:D,nodeDragThreshold:y,transform:I,snapGrid:v,snapToGrid:k}=t();u=D?.getBoundingClientRect()||null,h=!1,m=!1,w=P.sourceEvent,y===0&&A(P),i=Qe(P.sourceEvent,{transform:I,snapGrid:v,snapToGrid:k,containerBounds:u}),l=ge(P.sourceEvent,u)}).on("drag",P=>{const{autoPanOnNodeDrag:D,transform:y,snapGrid:I,snapToGrid:v,nodeDragThreshold:k,nodeLookup:M}=t(),j=Qe(P.sourceEvent,{transform:y,snapGrid:I,snapToGrid:v,containerBounds:u});if(w=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||S&&!M.has(S))&&(h=!0),!h){if(!a&&D&&d&&(a=!0,$()),!d){const B=ge(P.sourceEvent,u),F=B.x-l.x,Y=B.y-l.y;Math.sqrt(F*F+Y*Y)>k&&A(P)}(i.x!==j.xSnapped||i.y!==j.ySnapped)&&c&&d&&(l=ge(P.sourceEvent,u),L(j))}}).on("end",P=>{if(!(!d||h)&&(a=!1,d=!1,cancelAnimationFrame(s),c.size>0)){const{nodeLookup:D,updateNodePositions:y,onNodeDragStop:I,onSelectionDragStop:v}=t();if(m&&(y(c,!1),m=!1),r||I||!S&&v){const[k,M]=Wt({nodeId:S,dragItems:c,nodeLookup:D,dragging:!1});r?.(P.sourceEvent,c,k,M),I?.(P.sourceEvent,k,M),S||v?.(P.sourceEvent,M)}}}).filter(P=>{const D=P.target;return!P.button&&(!E||!no(D,`.${E}`,p))&&(!g||no(D,g,p))});f.call(C)}function b(){f?.on(".drag",null)}return{update:_,destroy:b}}function ou(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())nt(r,Fe(i))>0&&o.push(i);return o}const ru=250;function iu(e,t,n,o){let r=[],i=1/0;const s=ou(e,n,t+ru);for(const c of s){const a=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(const l of a){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:u,y:d}=De(c,l,l.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f1){const c=o.type==="source"?"target":"source";return r.find(a=>a.type===c)??r[0]}return r[0]}function wr(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const c=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],a=(n?c?.find(l=>l.id===n):c?.[0])??null;return a&&i?{...a,...De(s,a,a.position,!0)}:a}function vr(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function su(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const br=()=>!0;function au(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:c,nodeLookup:a,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:h,onConnectStart:m,onConnect:w,onConnectEnd:_,isValidConnection:b=br,onReconnectEnd:E,updateConnection:g,getTransform:p,getFromHandle:N,autoPanSpeed:S,dragThreshold:T=1,handleDomNode:L}){const $=lr(e.target);let A=0,C;const{x:P,y:D}=ge(e),y=vr(i,L),I=c?.getBoundingClientRect();let v=!1;if(!I||!y)return;const k=wr(r,y,o,a,t);if(!k)return;let M=ge(e,I),j=!1,B=null,F=!1,Y=null;function X(){if(!u||!I)return;const[q,U]=ir(M,I,S);f({x:q,y:U}),A=requestAnimationFrame(X)}const O={...k,nodeId:r,type:y,position:k.position},x=a.get(r);let V={inProgress:!0,isValid:null,from:De(x,O,K.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:x,to:M,toHandle:null,toPosition:Yn[O.position],toNode:null,pointer:M};function H(){v=!0,g(V),m?.(e,{nodeId:r,handleId:o,handleType:y})}T===0&&H();function W(q){if(!v){const{x:ce,y:de}=ge(q),ve=ce-P,Oe=de-D;if(!(ve*ve+Oe*Oe>T*T))return;H()}if(!N()||!O){G(q);return}const U=p();M=ge(q,I),C=iu(lt(M,U,!1,[1,1]),n,a,O),j||(X(),j=!0);const Q=Er(q,{handle:C,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:b,doc:$,lib:l,flowId:d,nodeLookup:a});Y=Q.handleDomNode,B=Q.connection,F=su(!!C,Q.isValid);const J=a.get(r),ee=J?De(J,O,K.Left,!0):V.from,ne={...V,from:ee,isValid:F,to:Q.toHandle&&F?Nt({x:Q.toHandle.x,y:Q.toHandle.y},U):M,toHandle:Q.toHandle,toPosition:F&&Q.toHandle?Q.toHandle.position:Yn[O.position],toNode:Q.toHandle?a.get(Q.toHandle.nodeId):null,pointer:M};g(ne),V=ne}function G(q){if(!("touches"in q&&q.touches.length>0)){if(v){(C||Y)&&B&&F&&w?.(B);const{inProgress:U,...Q}=V,J={...Q,toPosition:V.toHandle?V.toPosition:null};_?.(q,J),i&&E?.(q,J)}h(),cancelAnimationFrame(A),j=!1,F=!1,B=null,Y=null,$.removeEventListener("mousemove",W),$.removeEventListener("mouseup",G),$.removeEventListener("touchmove",W),$.removeEventListener("touchend",G)}}$.addEventListener("mousemove",W),$.addEventListener("mouseup",G),$.addEventListener("touchmove",W),$.addEventListener("touchend",G)}function Er(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:c,flowId:a,isValidConnection:l=br,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${c}-flow__handle[data-id="${a}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:m}=ge(e),w=s.elementFromPoint(h,m),_=w?.classList.contains(`${c}-flow__handle`)?w:f,b={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const E=vr(void 0,_),g=_.getAttribute("data-nodeid"),p=_.getAttribute("data-handleid"),N=_.classList.contains("connectable"),S=_.classList.contains("connectableend");if(!g||!E)return b;const T={source:d?g:o,sourceHandle:d?p:r,target:d?o:g,targetHandle:d?r:p};b.connection=T;const $=N&&S&&(n===Ve.Strict?d&&E==="source"||!d&&E==="target":g!==o||p!==r);b.isValid=$&&l(T),b.toHandle=wr(g,E,p,u,n,!0)}return b}const rn={onPointerDown:au,isValid:Er};function cu({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=le(e);function i({translateExtent:c,width:a,height:l,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const m=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const p=n(),N=g.sourceEvent.ctrlKey&&ot()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,T=p[2]*Math.pow(2,S*N);t.scaleTo(T)};let w=[0,0];const _=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},b=g=>{const p=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const N=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[N[0]-w[0],N[1]-w[1]];w=N;const T=o()*Math.max(p[2],Math.log(p[2]))*(h?-1:1),L={x:p[0]-S[0]*T,y:p[1]-S[1]*T},$=[[0,0],[a,l]];t.setViewportConstrained({x:L.x,y:L.y,zoom:p[2]},$,c)},E=Ko().on("start",_).on("zoom",d?b:null).on("zoom.wheel",f?m:null);r.call(E,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const At=e=>({x:e.x,y:e.y,zoom:e.k}),Zt=({x:e,y:t,zoom:n})=>Ot.translate(e,t).scale(n),$e=(e,t)=>e.target.closest(`.${t}`),_r=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),lu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xt=(e,t=0,n=lu,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Nr=e=>{const t=e.ctrlKey&&ot()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function uu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:l}){return u=>{if($e(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const _=fe(u),b=Nr(u),E=d*Math.pow(2,b);o.scaleTo(n,E,_,u);return}const f=u.deltaMode===1?20:1;let h=r===Pe.Vertical?0:u.deltaX*f,m=r===Pe.Horizontal?0:u.deltaY*f;!ot()&&u.shiftKey&&r!==Pe.Vertical&&(h=u.deltaY*f,m=0),o.translateBy(n,-(h/d)*i,-(m/d)*i,{internal:!0});const w=At(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(a?.(u,w),e.panScrollTimeout=setTimeout(()=>{l?.(u,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,c?.(u,w))}}function du({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,c=$e(o,e);if(o.ctrlKey&&i&&c&&o.preventDefault(),s||c)return null;o.preventDefault(),n.call(this,o,r)}}function fu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=At(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function hu({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&_r(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,At(i.transform))}}function gu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&_r(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const c=At(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,c)},n?150:0)}}}function pu({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:c,noPanClassName:a,lib:l,connectionInProgress:u}){return d=>{const f=e||t,h=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&($e(d,`${l}-flow__node`)||$e(d,`${l}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!m||$e(d,c)&&m||$e(d,a)&&(!m||r&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!h&&m||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&w}}function mu({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:c,onDraggingChange:a}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=Ko().scaleExtent([t,n]).translateExtent(o),f=le(e).call(d);E({x:r.x,y:r.y,zoom:Be(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const h=f.on("wheel.zoom"),m=f.on("dblclick.zoom");d.wheelDelta(Nr);function w(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).transform(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function _({noWheelClassName:C,noPanClassName:P,onPaneContextMenu:D,userSelectionActive:y,panOnScroll:I,panOnDrag:v,panOnScrollMode:k,panOnScrollSpeed:M,preventScrolling:j,zoomOnPinch:B,zoomOnScroll:F,zoomOnDoubleClick:Y,zoomActivationKeyPressed:X,lib:O,onTransformChange:x,connectionInProgress:z,paneClickDistance:V,selectionOnDrag:H}){y&&!l.isZoomingOrPanning&&b();const W=I&&!X&&!y;d.clickDistance(H?1/0:!he(V)||V<0?0:V);const G=W?uu({zoomPanValues:l,noWheelClassName:C,d3Selection:f,d3Zoom:d,panOnScrollMode:k,panOnScrollSpeed:M,zoomOnPinch:B,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:c}):du({noWheelClassName:C,preventScrolling:j,d3ZoomHandler:h});if(f.on("wheel.zoom",G,{passive:!1}),!y){const U=fu({zoomPanValues:l,onDraggingChange:a,onPanZoomStart:s});d.on("start",U);const Q=hu({zoomPanValues:l,panOnDrag:v,onPaneContextMenu:!!D,onPanZoom:i,onTransformChange:x});d.on("zoom",Q);const J=gu({zoomPanValues:l,panOnDrag:v,panOnScroll:I,onPaneContextMenu:D,onPanZoomEnd:c,onDraggingChange:a});d.on("end",J)}const q=pu({zoomActivationKeyPressed:X,panOnDrag:v,zoomOnScroll:F,panOnScroll:I,zoomOnDoubleClick:Y,zoomOnPinch:B,userSelectionActive:y,noPanClassName:P,noWheelClassName:C,lib:O,connectionInProgress:z});d.filter(q),Y?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function b(){d.on("zoom",null)}async function E(C,P,D){const y=Zt(C),I=d?.constrain()(y,P,D);return I&&await w(I),new Promise(v=>v(I))}async function g(C,P){const D=Zt(C);return await w(D,P),new Promise(y=>y(D))}function p(C){if(f){const P=Zt(C),D=f.property("__zoom");(D.k!==C.zoom||D.x!==C.x||D.y!==C.y)&&d?.transform(f,P,null,{sync:!0})}}function N(){const C=f?Uo(f.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function S(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).scaleTo(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function T(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).scaleBy(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function L(C){d?.scaleExtent(C)}function $(C){d?.translateExtent(C)}function A(C){const P=!he(C)||C<0?0:C;d?.clickDistance(P)}return{update:_,destroy:b,setViewport:g,setViewportConstrained:E,getViewport:N,scaleTo:S,scaleBy:T,setScaleExtent:L,setTranslateExtent:$,syncViewport:p,setClickDistance:A}}var We;(function(e){e.Line="line",e.Handle="handle"})(We||(We={}));function yu({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,c=n-o,a=[s>0?1:s<0?-1:0,c>0?1:c<0?-1:0];return s&&r&&(a[0]=a[0]*-1),c&&i&&(a[1]=a[1]*-1),a}function oo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function ke(e,t){return Math.max(0,e-t)}function gt(e,t,n){return Math.max(0,t-e,e-n)}function ro(e,t){return e?!t:t}function xu(e,t,n,o,r,i,s,c){let{affectsX:a,affectsY:l}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:h,ySnapped:m}=n,{minWidth:w,maxWidth:_,minHeight:b,maxHeight:E}=o,{x:g,y:p,width:N,height:S,aspectRatio:T}=e;let L=Math.floor(u?h-e.pointerX:0),$=Math.floor(d?m-e.pointerY:0);const A=N+(a?-L:L),C=S+(l?-$:$),P=-i[0]*N,D=-i[1]*S;let y=gt(A,w,_),I=gt(C,b,E);if(s){let M=0,j=0;a&&L<0?M=Ce(g+L+P,s[0][0]):!a&&L>0&&(M=ke(g+A+P,s[1][0])),l&&$<0?j=Ce(p+$+D,s[0][1]):!l&&$>0&&(j=ke(p+C+D,s[1][1])),y=Math.max(y,M),I=Math.max(I,j)}if(c){let M=0,j=0;a&&L>0?M=ke(g+L,c[0][0]):!a&&L<0&&(M=Ce(g+A,c[1][0])),l&&$>0?j=ke(p+$,c[0][1]):!l&&$<0&&(j=Ce(p+C,c[1][1])),y=Math.max(y,M),I=Math.max(I,j)}if(r){if(u){const M=gt(A/T,b,E)*T;if(y=Math.max(y,M),s){let j=0;!a&&!l||a&&!l&&f?j=ke(p+D+A/T,s[1][1])*T:j=Ce(p+D+(a?L:-L)/T,s[0][1])*T,y=Math.max(y,j)}if(c){let j=0;!a&&!l||a&&!l&&f?j=Ce(p+A/T,c[1][1])*T:j=ke(p+(a?L:-L)/T,c[0][1])*T,y=Math.max(y,j)}}if(d){const M=gt(C*T,w,_)/T;if(I=Math.max(I,M),s){let j=0;!a&&!l||l&&!a&&f?j=ke(g+C*T+P,s[1][0])/T:j=Ce(g+(l?$:-$)*T+P,s[0][0])/T,I=Math.max(I,j)}if(c){let j=0;!a&&!l||l&&!a&&f?j=Ce(g+C*T,c[1][0])/T:j=ke(g+(l?$:-$)*T,c[0][0])/T,I=Math.max(I,j)}}}$=$+($<0?I:-I),L=L+(L<0?y:-y),r&&(f?A>C*T?$=(ro(a,l)?-L:L)/T:L=(ro(a,l)?-$:$)*T:u?($=L/T,l=a):(L=$*T,a=l));const v=a?g+L:g,k=l?p+$:p;return{width:N+(a?-L:L),height:S+(l?-$:$),x:i[0]*L*(a?-1:1)+v,y:i[1]*$*(l?-1:1)+k}}const Sr={width:0,height:0,x:0,y:0},wu={...Sr,pointerX:0,pointerY:0,aspectRatio:1};function vu(e){return[[0,0],[e.measured.width,e.measured.height]]}function bu(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,c=n[0]*i,a=n[1]*s;return[[o-c,r-a],[o+i-c,r+s-a]]}function Eu({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=le(e);let s={controlDirection:oo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:l,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:m,onResizeEnd:w,shouldResize:_}){let b={...Sr},E={...wu};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:oo(l)};let g,p=null,N=[],S,T,L,$=!1;const A=Wo().on("start",C=>{const{nodeLookup:P,transform:D,snapGrid:y,snapToGrid:I,nodeOrigin:v,paneDomNode:k}=n();if(g=P.get(t),!g)return;p=k?.getBoundingClientRect()??null;const{xSnapped:M,ySnapped:j}=Qe(C.sourceEvent,{transform:D,snapGrid:y,snapToGrid:I,containerBounds:p});b={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},E={...b,pointerX:M,pointerY:j,aspectRatio:b.width/b.height},S=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=P.get(g.parentId),T=S&&g.extent==="parent"?vu(S):void 0),N=[],L=void 0;for(const[B,F]of P)if(F.parentId===t&&(N.push({id:B,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const Y=bu(F,g,F.origin??v);L?L=[[Math.min(Y[0][0],L[0][0]),Math.min(Y[0][1],L[0][1])],[Math.max(Y[1][0],L[1][0]),Math.max(Y[1][1],L[1][1])]]:L=Y}h?.(C,{...b})}).on("drag",C=>{const{transform:P,snapGrid:D,snapToGrid:y,nodeOrigin:I}=n(),v=Qe(C.sourceEvent,{transform:P,snapGrid:D,snapToGrid:y,containerBounds:p}),k=[];if(!g)return;const{x:M,y:j,width:B,height:F}=b,Y={},X=g.origin??I,{width:O,height:x,x:z,y:V}=xu(E,s.controlDirection,v,s.boundaries,s.keepAspectRatio,X,T,L),H=O!==B,W=x!==F,G=z!==M&&H,q=V!==j&&W;if(!G&&!q&&!H&&!W)return;if((G||q||X[0]===1||X[1]===1)&&(Y.x=G?z:b.x,Y.y=q?V:b.y,b.x=Y.x,b.y=Y.y,N.length>0)){const ee=z-M,ne=V-j;for(const ce of N)ce.position={x:ce.position.x-ee+X[0]*(O-B),y:ce.position.y-ne+X[1]*(x-F)},k.push(ce)}if((H||W)&&(Y.width=H&&(!s.resizeDirection||s.resizeDirection==="horizontal")?O:b.width,Y.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?x:b.height,b.width=Y.width,b.height=Y.height),S&&g.expandParent){const ee=X[0]*(Y.width??0);Y.x&&Y.x{$&&(w?.(C,{...b}),r?.({...b}),$=!1)});i.call(A)}function a(){i.on(".drag",null)}return{update:c,destroy:a}}const _u={},io=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,h))}},r=()=>t,a={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(_u?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,a);return a},Nu=e=>e?io(e):io,{useDebugValue:Su}=hs,{useSyncExternalStoreWithSelector:Cu}=Cs,ku=e=>e;function Cr(e,t=ku,n){const o=Cu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Su(o),o}const so=(e,t)=>{const n=Nu(e),o=(r,i=t)=>Cr(n,r,i);return Object.assign(o,n),o},Mu=(e,t)=>e?so(e,t):so;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const Dt=Z.createContext(null),Iu=Dt.Provider,kr=xe.error001();function te(e,t){const n=Z.useContext(Dt);if(n===null)throw new Error(kr);return Cr(n,e,t)}function ie(){const e=Z.useContext(Dt);if(e===null)throw new Error(kr);return Z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ao={display:"none"},Ou={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Mr="react-flow__node-desc",Ir="react-flow__edge-desc",Tu="react-flow__aria-live",Pu=e=>e.ariaLiveMessage,Au=e=>e.ariaLabelConfig;function Du({rfId:e}){const t=te(Pu);return R.jsx("div",{id:`${Tu}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ou,children:t})}function Lu({rfId:e,disableKeyboardA11y:t}){const n=te(Au);return R.jsxs(R.Fragment,{children:[R.jsx("div",{id:`${Mr}-${e}`,style:ao,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),R.jsx("div",{id:`${Ir}-${e}`,style:ao,children:n["edge.a11yDescription.default"]}),!t&&R.jsx(Du,{rfId:e})]})}const Lt=Z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return R.jsx("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});Lt.displayName="Panel";function ju({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:R.jsx(Lt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:R.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const $u=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},pt=e=>e.id;function zu(e,t){return re(e.selectedNodes.map(pt),t.selectedNodes.map(pt))&&re(e.selectedEdges.map(pt),t.selectedEdges.map(pt))}function Ru({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:o}=te($u,zu);return Z.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Hu=e=>!!e.onSelectionChangeHandlers;function Vu({onSelectionChange:e}){const t=te(Hu);return e||t?R.jsx(Ru,{onSelectionChange:e}):null}const Or=[0,0],Bu={x:0,y:0,zoom:1},Fu=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],co=[...Fu,"rfId"],Yu=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),lo={translateExtent:et,nodeOrigin:Or,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Wu(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:c,setDefaultNodesAndEdges:a}=te(Yu,re),l=ie();Z.useEffect(()=>(a(e.defaultNodes,e.defaultEdges),()=>{u.current=lo,c()}),[]);const u=Z.useRef(lo);return Z.useEffect(()=>{for(const d of co){const f=e[d],h=u.current[d];f!==h&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?l.setState({ariaLabelConfig:Dl(f)}):d==="fitView"?l.setState({fitViewQueued:f}):d==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[d]:f})))}u.current=e},co.map(d=>e[d])),null}function uo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Zu(e){const[t,n]=Z.useState(e==="system"?null:e);return Z.useEffect(()=>{if(e!=="system"){n(e);return}const o=uo(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:uo()?.matches?"dark":"light"}const fo=typeof document<"u"?document:null;function rt(e=null,t={target:fo,actInsideInputWithModifier:!0}){const[n,o]=Z.useState(!1),r=Z.useRef(!1),i=Z.useRef(new Set([])),[s,c]=Z.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",` +import{j as R}from"./vendor-query-CqA1cBNl.js";import{d as hs,r as Z,b as gs}from"./vendor-react-BfuodpLv.js";import{m as ps,n as ms,f as ys,B as xs}from"./index-CLb-kMYl.js";import{C as Ht,a as Dn,b as Ln,c as Vt}from"./card-DG4oK1Wy.js";import{S as jn}from"./skeleton-gKUrR2fT.js";import{d as cn,T as ws,t as vs,n as bs}from"./timer-DWAvo6M8.js";import{i as Es,h as $n,j as zn,k as _s,l as Ns,m as Ss,n as yt,o as Bt,u as Cs}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-icons-C6dhS1UE.js";import"./vendor-ui-Qm4_4bAc.js";function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rn.hasOwnProperty(t)?{space:Rn[t],local:e}:e}function ks(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ut&&t.documentElement.namespaceURI===Ut?t.createElement(e):t.createElementNS(n,e)}}function Ms(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function To(e){var t=Mt(e);return(t.local?Ms:ks)(t)}function Is(){}function ln(e){return e==null?Is:function(){return this.querySelector(e)}}function Os(e){typeof e!="function"&&(e=ln(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r=g&&(g=E+1);!(N=_[g])&&++g=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function ta(e){e||(e=na);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;it?1:e>=t?0:NaN}function oa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ra(){return Array.from(this)}function ia(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ma:typeof t=="function"?xa:ya)(e,t,n??"")):He(this.node(),e)}function He(e,t){return e.style.getPropertyValue(t)||jo(e).getComputedStyle(e,null).getPropertyValue(t)}function va(e){return function(){delete this[e]}}function ba(e,t){return function(){this[e]=t}}function Ea(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _a(e,t){return arguments.length>1?this.each((t==null?va:typeof t=="function"?Ea:ba)(e,t)):this.node()[e]}function $o(e){return e.trim().split(/^|\s+/)}function un(e){return e.classList||new zo(e)}function zo(e){this._node=e,this._names=$o(e.getAttribute("class")||"")}zo.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Ro(e,t){for(var n=un(e),o=-1,r=t.length;++o=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Ka(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n()=>e;function Kt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:c,dx:a,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Kt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ac(e){return!e.ctrlKey&&!e.button}function cc(){return this.parentNode}function lc(e,t){return t??{x:e.x,y:e.y}}function uc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wo(){var e=ac,t=cc,n=lc,o=uc,r={},i=cn("start","drag","end"),s=0,c,a,l,u,d=0;function f(p){p.on("mousedown.drag",h).filter(o).on("touchstart.drag",_).on("touchmove.drag",b,sc).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(p,N){if(!(u||!e.call(this,p,N))){var S=g(this,t.call(this,p,N),p,N,"mouse");S&&(le(p.view).on("mousemove.drag",m,Je).on("mouseup.drag",w,Je),Fo(p.view),Ft(p),l=!1,c=p.clientX,a=p.clientY,S("start",p))}}function m(p){if(Re(p),!l){var N=p.clientX-c,S=p.clientY-a;l=N*N+S*S>d}r.mouse("drag",p)}function w(p){le(p.view).on("mousemove.drag mouseup.drag",null),Yo(p.view,l),Re(p),r.mouse("end",p)}function _(p,N){if(e.call(this,p,N)){var S=p.changedTouches,T=t.call(this,p,N),L=S.length,$,A;for($=0;${o.stop(),e(r+t)},t,n),o}var dc=cn("start","end","cancel","interrupt"),fc=[],Zo=0,Vn=1,Qt=2,xt=3,Bn=4,Jt=5,wt=6;function It(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;hc(e,n,{name:t,index:o,group:r,on:dc,tween:fc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Zo})}function dn(e,t){var n=me(e,t);if(n.state>Zo)throw new Error("too late; already scheduled");return n}function we(e,t){var n=me(e,t);if(n.state>xt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function hc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=vs(i,0,n.time);function i(l){n.state=Vn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,d,f,h;if(n.state!==Vn)return a();for(u in o)if(h=o[u],h.name===n.name){if(h.state===xt)return Hn(s);h.state===Bn?(h.state=wt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+uQt&&o.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Fc(e,t,n){var o,r,i=Bc(t)?dn:we;return function(){var s=i(this,e),c=s.on;c!==o&&(r=(o=c).copy()).on(t,n),s.on=r}}function Yc(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(Fc(n,e,t))}function Wc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Zc(){return this.on("end.remove",Wc(this._id))}function Xc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ln(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s()=>e;function xl(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ee(e,t,n){this.k=e,this.x=t,this.y=n}Ee.prototype={constructor:Ee,scale:function(e){return e===1?this:new Ee(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ee(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ot=new Ee(1,0,0);Uo.prototype=Ee.prototype;function Uo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ot;return e.__zoom}function Yt(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function wl(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function vl(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Fn(){return this.__zoom||Ot}function bl(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function El(){return navigator.maxTouchPoints||"ontouchstart"in this}function _l(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Ko(){var e=wl,t=vl,n=_l,o=bl,r=El,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],c=250,a=yt,l=cn("start","zoom","end"),u,d,f,h=500,m=150,w=0,_=10;function b(y){y.property("__zoom",Fn).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",A).filter(r).on("touchstart.zoom",C).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(y,I,v,k){var M=y.selection?y.selection():y;M.property("__zoom",Fn),y!==M?N(y,I,v,k):M.interrupt().each(function(){S(this,arguments).event(k).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},b.scaleBy=function(y,I,v,k){b.scaleTo(y,function(){var M=this.__zoom.k,j=typeof I=="function"?I.apply(this,arguments):I;return M*j},v,k)},b.scaleTo=function(y,I,v,k){b.transform(y,function(){var M=t.apply(this,arguments),j=this.__zoom,B=v==null?p(M):typeof v=="function"?v.apply(this,arguments):v,F=j.invert(B),Y=typeof I=="function"?I.apply(this,arguments):I;return n(g(E(j,Y),B,F),M,s)},v,k)},b.translateBy=function(y,I,v,k){b.transform(y,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),t.apply(this,arguments),s)},null,k)},b.translateTo=function(y,I,v,k,M){b.transform(y,function(){var j=t.apply(this,arguments),B=this.__zoom,F=k==null?p(j):typeof k=="function"?k.apply(this,arguments):k;return n(Ot.translate(F[0],F[1]).scale(B.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),j,s)},k,M)};function E(y,I){return I=Math.max(i[0],Math.min(i[1],I)),I===y.k?y:new Ee(I,y.x,y.y)}function g(y,I,v){var k=I[0]-v[0]*y.k,M=I[1]-v[1]*y.k;return k===y.x&&M===y.y?y:new Ee(y.k,k,M)}function p(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function N(y,I,v,k){y.on("start.zoom",function(){S(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(k).end()}).tween("zoom",function(){var M=this,j=arguments,B=S(M,j).event(k),F=t.apply(M,j),Y=v==null?p(F):typeof v=="function"?v.apply(M,j):v,X=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),O=M.__zoom,x=typeof I=="function"?I.apply(M,j):I,z=a(O.invert(Y).concat(X/O.k),x.invert(Y).concat(X/x.k));return function(V){if(V===1)V=x;else{var H=z(V),W=X/H[2];V=new Ee(W,Y[0]-H[0]*W,Y[1]-H[1]*W)}B.zoom(null,V)}})}function S(y,I,v){return!v&&y.__zooming||new T(y,I)}function T(y,I){this.that=y,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,I),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,I){return this.mouse&&y!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var I=le(this.that).datum();l.call(y,this.that,new xl(y,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:l}),I)}};function L(y,...I){if(!e.apply(this,arguments))return;var v=S(this,I).event(y),k=this.__zoom,M=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,o.apply(this,arguments)))),j=fe(y);if(v.wheel)(v.mouse[0][0]!==j[0]||v.mouse[0][1]!==j[1])&&(v.mouse[1]=k.invert(v.mouse[0]=j)),clearTimeout(v.wheel);else{if(k.k===M)return;v.mouse=[j,k.invert(j)],vt(this),v.start()}Ke(y),v.wheel=setTimeout(B,m),v.zoom("mouse",n(g(E(k,M),v.mouse[0],v.mouse[1]),v.extent,s));function B(){v.wheel=null,v.end()}}function $(y,...I){if(f||!e.apply(this,arguments))return;var v=y.currentTarget,k=S(this,I,!0).event(y),M=le(y.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",X,!0),j=fe(y,v),B=y.clientX,F=y.clientY;Fo(y.view),Yt(y),k.mouse=[j,this.__zoom.invert(j)],vt(this),k.start();function Y(O){if(Ke(O),!k.moved){var x=O.clientX-B,z=O.clientY-F;k.moved=x*x+z*z>w}k.event(O).zoom("mouse",n(g(k.that.__zoom,k.mouse[0]=fe(O,v),k.mouse[1]),k.extent,s))}function X(O){M.on("mousemove.zoom mouseup.zoom",null),Yo(O.view,k.moved),Ke(O),k.event(O).end()}}function A(y,...I){if(e.apply(this,arguments)){var v=this.__zoom,k=fe(y.changedTouches?y.changedTouches[0]:y,this),M=v.invert(k),j=v.k*(y.shiftKey?.5:2),B=n(g(E(v,j),k,M),t.apply(this,I),s);Ke(y),c>0?le(this).transition().duration(c).call(N,B,k,y):le(this).call(b.transform,B,k,y)}}function C(y,...I){if(e.apply(this,arguments)){var v=y.touches,k=v.length,M=S(this,I,y.changedTouches.length===k).event(y),j,B,F,Y;for(Yt(y),B=0;B"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},et=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qo=["Enter"," ","Escape"],Jo={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ve;(function(e){e.Strict="strict",e.Loose="loose"})(Ve||(Ve={}));var Pe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pe||(Pe={}));var tt;(function(e){e.Partial="partial",e.Full="full"})(tt||(tt={}));const er={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Me;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Me||(Me={}));var Et;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Et||(Et={}));var K;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(K||(K={}));const Yn={[K.Left]:K.Right,[K.Right]:K.Left,[K.Top]:K.Bottom,[K.Bottom]:K.Top};function tr(e){return e===null?null:e?"valid":"invalid"}const nr=e=>"id"in e&&"source"in e&&"target"in e,Nl=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),hn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),st=(e,t=[0,0])=>{const{width:n,height:o}=Se(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Sl=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):hn(r)?r:t.nodeLookup.get(r.id));const c=s?_t(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Tt(o,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Pt(n)},at=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=Tt(n,_t(r)),o=!0)}),o?Pt(n):{x:0,y:0,width:0,height:0}},gn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const c={...lt(t,[n,o,r]),width:t.width/r,height:t.height/r},a=[];for(const l of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=l;if(s&&!d||f)continue;const h=u.width??l.width??l.initialWidth??null,m=u.height??l.height??l.initialHeight??null,w=nt(c,Fe(l)),_=(h??0)*(m??0),b=i&&w>0;(!l.internals.handleBounds||b||w>=_||l.dragging)&&a.push(l)}return a},Cl=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function kl(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Ml({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const c=kl(e,s),a=at(c),l=pn(a,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function or({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),c=s.parentId?n.get(s.parentId):void 0,{x:a,y:l}=c?c.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!c)i?.("005",xe.error005());else{const h=c.measured.width,m=c.measured.height;h&&m&&(d=[[a,l],[a+h,l+m]])}else c&&Ye(s.extent)&&(d=[[s.extent[0][0]+a,s.extent[0][1]+l],[s.extent[1][0]+a,s.extent[1][1]+l]]);const f=Ye(d)?Ae(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",xe.error015()),{position:{x:f.x-a+(s.measured.width??0)*u[0],y:f.y-l+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function Il({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),m=!h&&f.parentId&&s.find(w=>w.id===f.parentId);(h||m)&&s.push(f)}const c=new Set(t.map(f=>f.id)),a=o.filter(f=>f.deletable!==!1),u=Cl(s,a);for(const f of a)c.has(f.id)&&!u.find(m=>m.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const Be=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ae=(e={x:0,y:0},t,n)=>({x:Be(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Be(e.y,t[0][1],t[1][1]-(n?.height??0))});function rr(e,t,n){const{width:o,height:r}=Se(n),{x:i,y:s}=n.internals.positionAbsolute;return Ae(e,[[i,s],[i+o,s+r]],t)}const Wn=(e,t,n)=>en?-Be(Math.abs(e-n),1,t)/t:0,ir=(e,t,n=15,o=40)=>{const r=Wn(e.x,o,t.width-o)*n,i=Wn(e.y,o,t.height-o)*n;return[r,i]},Tt=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),en=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Pt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Fe=(e,t=[0,0])=>{const{x:n,y:o}=hn(e)?e.internals.positionAbsolute:st(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},_t=(e,t=[0,0])=>{const{x:n,y:o}=hn(e)?e.internals.positionAbsolute:st(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},sr=(e,t)=>Pt(Tt(en(e),en(t))),nt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Zn=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),Ol=(e,t)=>{},ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),lt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const c={x:(e-n)/r,y:(t-o)/r};return i?ct(c,s):c},Nt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function je(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Tl(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=je(e,n),r=je(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=je(e.top??e.y??0,n),r=je(e.bottom??e.y??0,n),i=je(e.left??e.x??0,t),s=je(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Pl(e,t,n,o,r,i){const{x:s,y:c}=Nt(e,[t,n,o]),{x:a,y:l}=Nt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-a,d=i-l;return{left:Math.floor(s),top:Math.floor(c),right:Math.floor(u),bottom:Math.floor(d)}}const pn=(e,t,n,o,r,i)=>{const s=Tl(i,t,n),c=(t-s.x)/e.width,a=(n-s.y)/e.height,l=Math.min(c,a),u=Be(l,o,r),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*u,m=n/2-f*u,w=Pl(e,h,m,u,t,n),_={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:h-_.left+_.right,y:m-_.top+_.bottom,zoom:u}},ot=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function Se(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ar(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function cr(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const c=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*c[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*c[1]}return i}function Xn(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Al(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Dl(e){return{...Jo,...e||{}}}function Qe(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ge(e),c=lt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:a,y:l}=n?ct(c,t):c;return{xSnapped:a,ySnapped:l,...c}}const mn=e=>({width:e.offsetWidth,height:e.offsetHeight}),lr=e=>e?.getRootNode?.()||window?.document,Ll=["INPUT","SELECT","TEXTAREA"];function ur(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Ll.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const dr=e=>"clientX"in e,ge=(e,t)=>{const n=dr(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Gn=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const c=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(c.left-n.left)/o,y:(c.top-n.top)/o,...mn(s)}})};function fr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:c}){const a=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+c*.375+o*.125,u=Math.abs(a-e),d=Math.abs(l-t);return[a,l,u,d]}function ht(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function qn({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case K.Left:return[t-ht(t-o,i),n];case K.Right:return[t+ht(o-t,i),n];case K.Top:return[t,n-ht(n-r,i)];case K.Bottom:return[t,n+ht(r-n,i)]}}function yn({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:o,targetY:r,targetPosition:i=K.Top,curvature:s=.25}){const[c,a]=qn({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=qn({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,h,m]=fr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:c,sourceControlY:a,targetControlX:l,targetControlY:u});return[`M${e},${t} C${c},${a} ${l},${u} ${o},${r}`,d,f,h,m]}function hr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n0}const zl=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Rl=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Hl=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||zl;let r;return nr(e)?r={...e}:r={...e,id:o(e)},Rl(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,c]=hr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,c]}const Un={[K.Left]:{x:-1,y:0},[K.Right]:{x:1,y:0},[K.Top]:{x:0,y:-1},[K.Bottom]:{x:0,y:1}},Vl=({source:e,sourcePosition:t=K.Bottom,target:n})=>t===K.Left||t===K.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Bl({source:e,sourcePosition:t=K.Bottom,target:n,targetPosition:o=K.Top,center:r,offset:i,stepPosition:s}){const c=Un[t],a=Un[o],l={x:e.x+c.x*i,y:e.y+c.y*i},u={x:n.x+a.x*i,y:n.y+a.y*i},d=Vl({source:l,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",h=d[f];let m=[],w,_;const b={x:0,y:0},E={x:0,y:0},[,,g,p]=hr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[f]*a[f]===-1){f==="x"?(w=r.x??l.x+(u.x-l.x)*s,_=r.y??(l.y+u.y)/2):(w=r.x??(l.x+u.x)/2,_=r.y??l.y+(u.y-l.y)*s);const S=[{x:w,y:l.y},{x:w,y:u.y}],T=[{x:l.x,y:_},{x:u.x,y:_}];c[f]===h?m=f==="x"?S:T:m=f==="x"?T:S}else{const S=[{x:l.x,y:u.y}],T=[{x:u.x,y:l.y}];if(f==="x"?m=c.x===h?T:S:m=c.y===h?S:T,t===o){const P=Math.abs(e[f]-n[f]);if(P<=i){const D=Math.min(i-1,i-P);c[f]===h?b[f]=(l[f]>e[f]?-1:1)*D:E[f]=(u[f]>n[f]?-1:1)*D}}if(t!==o){const P=f==="x"?"y":"x",D=c[f]===a[P],y=l[P]>u[P],I=l[P]=C?(w=(L.x+$.x)/2,_=m[0].y):(w=m[0].x,_=(L.y+$.y)/2)}return[[e,{x:l.x+b.x,y:l.y+b.y},...m,{x:u.x+E.x,y:u.y+E.y},n],w,_,g,p]}function Fl(e,t,n,o){const r=Math.min(Kn(e,t)/2,Kn(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x{let p="";return g>0&&gn.id===t):e[0])||null}function nn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Wl(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,c)=>([c.markerStart||o,c.markerEnd||r].forEach(a=>{if(a&&typeof a=="object"){const l=nn(a,t);i.has(l)||(s.push({id:l,color:a.color||n,...a}),i.add(l))}}),s),[]).sort((s,c)=>s.id.localeCompare(c.id))}const pr=1e3,Zl=10,xn={nodeOrigin:[0,0],nodeExtent:et,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Xl={...xn,checkEquality:!0};function wn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Gl(e,t,n){const o=wn(xn,n);for(const r of e.values())if(r.parentId)bn(r,e,t,o);else{const i=st(r,o.nodeOrigin),s=Ye(r.extent)?r.extent:o.nodeExtent,c=Ae(i,s,Se(r));r.internals.positionAbsolute=c}}function ql(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function vn(e){return e==="manual"}function on(e,t,n,o={}){const r=wn(Xl,o),i={i:0},s=new Map(t),c=r?.elevateNodesOnSelect&&!vn(r.zIndexMode)?pr:0;let a=e.length>0;t.clear(),n.clear();for(const l of e){let u=s.get(l.id);if(r.checkEquality&&l===u?.internals.userNode)t.set(l.id,u);else{const d=st(l,r.nodeOrigin),f=Ye(l.extent)?l.extent:r.nodeExtent,h=Ae(d,f,Se(l));u={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:h,handleBounds:ql(l,u),z:mr(l,c,r.zIndexMode),userNode:l}},t.set(l.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(a=!1),l.parentId&&bn(u,t,n,o,i)}return a}function Ul(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function bn(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:c,zIndexMode:a}=wn(xn,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ul(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&a==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Zl),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=i&&!vn(a)?pr:0,{x:f,y:h,z:m}=Kl(e,u,s,c,d,a),{positionAbsolute:w}=e.internals,_=f!==w.x||h!==w.y;(_||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:f,y:h}:w,z:m}})}function mr(e,t,n){const o=he(e.zIndex)?e.zIndex:0;return vn(n)?o:o+(e.selected?t:0)}function Kl(e,t,n,o,r,i){const{x:s,y:c}=t.internals.positionAbsolute,a=Se(e),l=st(e,n),u=Ye(e.extent)?Ae(l,e.extent,a):l;let d=Ae({x:s+u.x,y:c+u.y},o,a);e.extent==="parent"&&(d=rr(d,a,t));const f=mr(e,r,i),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function En(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const c=t.get(s.parentId);if(!c)continue;const a=i.get(s.parentId)?.expandedRect??Fe(c),l=sr(a,s.rect);i.set(s.parentId,{expandedRect:l,parent:c})}return i.size>0&&i.forEach(({expandedRect:s,parent:c},a)=>{const l=c.internals.positionAbsolute,u=Se(c),d=c.origin??o,f=s.x0||h>0||_||b)&&(r.push({id:a,type:"position",position:{x:c.position.x-f+_,y:c.position.y-h+b}}),n.get(a)?.forEach(E=>{e.some(g=>g.id===E.id)||r.push({id:E.id,type:"position",position:{x:E.position.x+f,y:E.position.y+h}})})),(u.width0){const h=En(f,t,n,r);l.push(...h)}return{changes:l,updatedInternals:a}}async function Jl({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),c=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(c)}function to(e,t,n,o,r,i){let s=r;const c=o.get(s)||new Map;o.set(s,c.set(n,t)),s=`${r}-${e}`;const a=o.get(s)||new Map;if(o.set(s,a.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function yr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:c=null}=o,a={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:c},l=`${r}-${s}--${i}-${c}`,u=`${i}-${c}--${r}-${s}`;to("source",a,u,e,r,s),to("target",a,l,e,i,c),t.set(o.id,o)}}function xr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:xr(n,t):!1}function no(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function eu(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!xr(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const c=e.get(i);c&&r.set(i,{id:i,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return r}function Wt({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,c]of t){const a=n.get(s)?.internals.userNode;a&&r.push({...a,position:c.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function tu({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=ct(i,t);return{x:s.x-i.x,y:s.y-i.y}}function nu({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,c=new Map,a=!1,l={x:0,y:0},u=null,d=!1,f=null,h=!1,m=!1,w=null;function _({noDragClassName:E,handleSelector:g,domNode:p,isSelectable:N,nodeId:S,nodeClickDistance:T=0}){f=le(p);function L({x:P,y:D}){const{nodeLookup:y,nodeExtent:I,snapGrid:v,snapToGrid:k,nodeOrigin:M,onNodeDrag:j,onSelectionDrag:B,onError:F,updateNodePositions:Y}=t();i={x:P,y:D};let X=!1;const O=c.size>1,x=O&&I?en(at(c)):null,z=O&&k?tu({dragItems:c,snapGrid:v,x:P,y:D}):null;for(const[V,H]of c){if(!y.has(V))continue;let W={x:P-H.distance.x,y:D-H.distance.y};k&&(W=z?{x:Math.round(W.x+z.x),y:Math.round(W.y+z.y)}:ct(W,v));let G=null;if(O&&I&&!H.extent&&x){const{positionAbsolute:Q}=H.internals,J=Q.x-x.x+I[0][0],ee=Q.x+H.measured.width-x.x2+I[1][0],ne=Q.y-x.y+I[0][1],ce=Q.y+H.measured.height-x.y2+I[1][1];G=[[J,ne],[ee,ce]]}const{position:q,positionAbsolute:U}=or({nodeId:V,nextPosition:W,nodeLookup:y,nodeExtent:G||I,nodeOrigin:M,onError:F});X=X||H.position.x!==q.x||H.position.y!==q.y,H.position=q,H.internals.positionAbsolute=U}if(m=m||X,!!X&&(Y(c,!0),w&&(o||j||!S&&B))){const[V,H]=Wt({nodeId:S,dragItems:c,nodeLookup:y});o?.(w,c,V,H),j?.(w,V,H),S||B?.(w,H)}}async function $(){if(!u)return;const{transform:P,panBy:D,autoPanSpeed:y,autoPanOnNodeDrag:I}=t();if(!I){a=!1,cancelAnimationFrame(s);return}const[v,k]=ir(l,u,y);(v!==0||k!==0)&&(i.x=(i.x??0)-v/P[2],i.y=(i.y??0)-k/P[2],await D({x:v,y:k})&&L(i)),s=requestAnimationFrame($)}function A(P){const{nodeLookup:D,multiSelectionActive:y,nodesDraggable:I,transform:v,snapGrid:k,snapToGrid:M,selectNodesOnDrag:j,onNodeDragStart:B,onSelectionDragStart:F,unselectNodesAndEdges:Y}=t();d=!0,(!j||!N)&&!y&&S&&(D.get(S)?.selected||Y()),N&&j&&S&&e?.(S);const X=Qe(P.sourceEvent,{transform:v,snapGrid:k,snapToGrid:M,containerBounds:u});if(i=X,c=eu(D,I,X,S),c.size>0&&(n||B||!S&&F)){const[O,x]=Wt({nodeId:S,dragItems:c,nodeLookup:D});n?.(P.sourceEvent,c,O,x),B?.(P.sourceEvent,O,x),S||F?.(P.sourceEvent,x)}}const C=Wo().clickDistance(T).on("start",P=>{const{domNode:D,nodeDragThreshold:y,transform:I,snapGrid:v,snapToGrid:k}=t();u=D?.getBoundingClientRect()||null,h=!1,m=!1,w=P.sourceEvent,y===0&&A(P),i=Qe(P.sourceEvent,{transform:I,snapGrid:v,snapToGrid:k,containerBounds:u}),l=ge(P.sourceEvent,u)}).on("drag",P=>{const{autoPanOnNodeDrag:D,transform:y,snapGrid:I,snapToGrid:v,nodeDragThreshold:k,nodeLookup:M}=t(),j=Qe(P.sourceEvent,{transform:y,snapGrid:I,snapToGrid:v,containerBounds:u});if(w=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||S&&!M.has(S))&&(h=!0),!h){if(!a&&D&&d&&(a=!0,$()),!d){const B=ge(P.sourceEvent,u),F=B.x-l.x,Y=B.y-l.y;Math.sqrt(F*F+Y*Y)>k&&A(P)}(i.x!==j.xSnapped||i.y!==j.ySnapped)&&c&&d&&(l=ge(P.sourceEvent,u),L(j))}}).on("end",P=>{if(!(!d||h)&&(a=!1,d=!1,cancelAnimationFrame(s),c.size>0)){const{nodeLookup:D,updateNodePositions:y,onNodeDragStop:I,onSelectionDragStop:v}=t();if(m&&(y(c,!1),m=!1),r||I||!S&&v){const[k,M]=Wt({nodeId:S,dragItems:c,nodeLookup:D,dragging:!1});r?.(P.sourceEvent,c,k,M),I?.(P.sourceEvent,k,M),S||v?.(P.sourceEvent,M)}}}).filter(P=>{const D=P.target;return!P.button&&(!E||!no(D,`.${E}`,p))&&(!g||no(D,g,p))});f.call(C)}function b(){f?.on(".drag",null)}return{update:_,destroy:b}}function ou(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())nt(r,Fe(i))>0&&o.push(i);return o}const ru=250;function iu(e,t,n,o){let r=[],i=1/0;const s=ou(e,n,t+ru);for(const c of s){const a=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(const l of a){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:u,y:d}=De(c,l,l.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f1){const c=o.type==="source"?"target":"source";return r.find(a=>a.type===c)??r[0]}return r[0]}function wr(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const c=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],a=(n?c?.find(l=>l.id===n):c?.[0])??null;return a&&i?{...a,...De(s,a,a.position,!0)}:a}function vr(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function su(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const br=()=>!0;function au(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:c,nodeLookup:a,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:h,onConnectStart:m,onConnect:w,onConnectEnd:_,isValidConnection:b=br,onReconnectEnd:E,updateConnection:g,getTransform:p,getFromHandle:N,autoPanSpeed:S,dragThreshold:T=1,handleDomNode:L}){const $=lr(e.target);let A=0,C;const{x:P,y:D}=ge(e),y=vr(i,L),I=c?.getBoundingClientRect();let v=!1;if(!I||!y)return;const k=wr(r,y,o,a,t);if(!k)return;let M=ge(e,I),j=!1,B=null,F=!1,Y=null;function X(){if(!u||!I)return;const[q,U]=ir(M,I,S);f({x:q,y:U}),A=requestAnimationFrame(X)}const O={...k,nodeId:r,type:y,position:k.position},x=a.get(r);let V={inProgress:!0,isValid:null,from:De(x,O,K.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:x,to:M,toHandle:null,toPosition:Yn[O.position],toNode:null,pointer:M};function H(){v=!0,g(V),m?.(e,{nodeId:r,handleId:o,handleType:y})}T===0&&H();function W(q){if(!v){const{x:ce,y:de}=ge(q),ve=ce-P,Oe=de-D;if(!(ve*ve+Oe*Oe>T*T))return;H()}if(!N()||!O){G(q);return}const U=p();M=ge(q,I),C=iu(lt(M,U,!1,[1,1]),n,a,O),j||(X(),j=!0);const Q=Er(q,{handle:C,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:b,doc:$,lib:l,flowId:d,nodeLookup:a});Y=Q.handleDomNode,B=Q.connection,F=su(!!C,Q.isValid);const J=a.get(r),ee=J?De(J,O,K.Left,!0):V.from,ne={...V,from:ee,isValid:F,to:Q.toHandle&&F?Nt({x:Q.toHandle.x,y:Q.toHandle.y},U):M,toHandle:Q.toHandle,toPosition:F&&Q.toHandle?Q.toHandle.position:Yn[O.position],toNode:Q.toHandle?a.get(Q.toHandle.nodeId):null,pointer:M};g(ne),V=ne}function G(q){if(!("touches"in q&&q.touches.length>0)){if(v){(C||Y)&&B&&F&&w?.(B);const{inProgress:U,...Q}=V,J={...Q,toPosition:V.toHandle?V.toPosition:null};_?.(q,J),i&&E?.(q,J)}h(),cancelAnimationFrame(A),j=!1,F=!1,B=null,Y=null,$.removeEventListener("mousemove",W),$.removeEventListener("mouseup",G),$.removeEventListener("touchmove",W),$.removeEventListener("touchend",G)}}$.addEventListener("mousemove",W),$.addEventListener("mouseup",G),$.addEventListener("touchmove",W),$.addEventListener("touchend",G)}function Er(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:c,flowId:a,isValidConnection:l=br,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${c}-flow__handle[data-id="${a}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:m}=ge(e),w=s.elementFromPoint(h,m),_=w?.classList.contains(`${c}-flow__handle`)?w:f,b={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const E=vr(void 0,_),g=_.getAttribute("data-nodeid"),p=_.getAttribute("data-handleid"),N=_.classList.contains("connectable"),S=_.classList.contains("connectableend");if(!g||!E)return b;const T={source:d?g:o,sourceHandle:d?p:r,target:d?o:g,targetHandle:d?r:p};b.connection=T;const $=N&&S&&(n===Ve.Strict?d&&E==="source"||!d&&E==="target":g!==o||p!==r);b.isValid=$&&l(T),b.toHandle=wr(g,E,p,u,n,!0)}return b}const rn={onPointerDown:au,isValid:Er};function cu({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=le(e);function i({translateExtent:c,width:a,height:l,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const m=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const p=n(),N=g.sourceEvent.ctrlKey&&ot()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,T=p[2]*Math.pow(2,S*N);t.scaleTo(T)};let w=[0,0];const _=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},b=g=>{const p=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const N=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[N[0]-w[0],N[1]-w[1]];w=N;const T=o()*Math.max(p[2],Math.log(p[2]))*(h?-1:1),L={x:p[0]-S[0]*T,y:p[1]-S[1]*T},$=[[0,0],[a,l]];t.setViewportConstrained({x:L.x,y:L.y,zoom:p[2]},$,c)},E=Ko().on("start",_).on("zoom",d?b:null).on("zoom.wheel",f?m:null);r.call(E,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const At=e=>({x:e.x,y:e.y,zoom:e.k}),Zt=({x:e,y:t,zoom:n})=>Ot.translate(e,t).scale(n),$e=(e,t)=>e.target.closest(`.${t}`),_r=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),lu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xt=(e,t=0,n=lu,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Nr=e=>{const t=e.ctrlKey&&ot()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function uu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:l}){return u=>{if($e(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const _=fe(u),b=Nr(u),E=d*Math.pow(2,b);o.scaleTo(n,E,_,u);return}const f=u.deltaMode===1?20:1;let h=r===Pe.Vertical?0:u.deltaX*f,m=r===Pe.Horizontal?0:u.deltaY*f;!ot()&&u.shiftKey&&r!==Pe.Vertical&&(h=u.deltaY*f,m=0),o.translateBy(n,-(h/d)*i,-(m/d)*i,{internal:!0});const w=At(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(a?.(u,w),e.panScrollTimeout=setTimeout(()=>{l?.(u,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,c?.(u,w))}}function du({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,c=$e(o,e);if(o.ctrlKey&&i&&c&&o.preventDefault(),s||c)return null;o.preventDefault(),n.call(this,o,r)}}function fu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=At(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function hu({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&_r(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,At(i.transform))}}function gu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&_r(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const c=At(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,c)},n?150:0)}}}function pu({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:c,noPanClassName:a,lib:l,connectionInProgress:u}){return d=>{const f=e||t,h=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&($e(d,`${l}-flow__node`)||$e(d,`${l}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!m||$e(d,c)&&m||$e(d,a)&&(!m||r&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!h&&m||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&w}}function mu({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:c,onDraggingChange:a}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=Ko().scaleExtent([t,n]).translateExtent(o),f=le(e).call(d);E({x:r.x,y:r.y,zoom:Be(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const h=f.on("wheel.zoom"),m=f.on("dblclick.zoom");d.wheelDelta(Nr);function w(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).transform(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function _({noWheelClassName:C,noPanClassName:P,onPaneContextMenu:D,userSelectionActive:y,panOnScroll:I,panOnDrag:v,panOnScrollMode:k,panOnScrollSpeed:M,preventScrolling:j,zoomOnPinch:B,zoomOnScroll:F,zoomOnDoubleClick:Y,zoomActivationKeyPressed:X,lib:O,onTransformChange:x,connectionInProgress:z,paneClickDistance:V,selectionOnDrag:H}){y&&!l.isZoomingOrPanning&&b();const W=I&&!X&&!y;d.clickDistance(H?1/0:!he(V)||V<0?0:V);const G=W?uu({zoomPanValues:l,noWheelClassName:C,d3Selection:f,d3Zoom:d,panOnScrollMode:k,panOnScrollSpeed:M,zoomOnPinch:B,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:c}):du({noWheelClassName:C,preventScrolling:j,d3ZoomHandler:h});if(f.on("wheel.zoom",G,{passive:!1}),!y){const U=fu({zoomPanValues:l,onDraggingChange:a,onPanZoomStart:s});d.on("start",U);const Q=hu({zoomPanValues:l,panOnDrag:v,onPaneContextMenu:!!D,onPanZoom:i,onTransformChange:x});d.on("zoom",Q);const J=gu({zoomPanValues:l,panOnDrag:v,panOnScroll:I,onPaneContextMenu:D,onPanZoomEnd:c,onDraggingChange:a});d.on("end",J)}const q=pu({zoomActivationKeyPressed:X,panOnDrag:v,zoomOnScroll:F,panOnScroll:I,zoomOnDoubleClick:Y,zoomOnPinch:B,userSelectionActive:y,noPanClassName:P,noWheelClassName:C,lib:O,connectionInProgress:z});d.filter(q),Y?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function b(){d.on("zoom",null)}async function E(C,P,D){const y=Zt(C),I=d?.constrain()(y,P,D);return I&&await w(I),new Promise(v=>v(I))}async function g(C,P){const D=Zt(C);return await w(D,P),new Promise(y=>y(D))}function p(C){if(f){const P=Zt(C),D=f.property("__zoom");(D.k!==C.zoom||D.x!==C.x||D.y!==C.y)&&d?.transform(f,P,null,{sync:!0})}}function N(){const C=f?Uo(f.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function S(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).scaleTo(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function T(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).scaleBy(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function L(C){d?.scaleExtent(C)}function $(C){d?.translateExtent(C)}function A(C){const P=!he(C)||C<0?0:C;d?.clickDistance(P)}return{update:_,destroy:b,setViewport:g,setViewportConstrained:E,getViewport:N,scaleTo:S,scaleBy:T,setScaleExtent:L,setTranslateExtent:$,syncViewport:p,setClickDistance:A}}var We;(function(e){e.Line="line",e.Handle="handle"})(We||(We={}));function yu({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,c=n-o,a=[s>0?1:s<0?-1:0,c>0?1:c<0?-1:0];return s&&r&&(a[0]=a[0]*-1),c&&i&&(a[1]=a[1]*-1),a}function oo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function ke(e,t){return Math.max(0,e-t)}function gt(e,t,n){return Math.max(0,t-e,e-n)}function ro(e,t){return e?!t:t}function xu(e,t,n,o,r,i,s,c){let{affectsX:a,affectsY:l}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:h,ySnapped:m}=n,{minWidth:w,maxWidth:_,minHeight:b,maxHeight:E}=o,{x:g,y:p,width:N,height:S,aspectRatio:T}=e;let L=Math.floor(u?h-e.pointerX:0),$=Math.floor(d?m-e.pointerY:0);const A=N+(a?-L:L),C=S+(l?-$:$),P=-i[0]*N,D=-i[1]*S;let y=gt(A,w,_),I=gt(C,b,E);if(s){let M=0,j=0;a&&L<0?M=Ce(g+L+P,s[0][0]):!a&&L>0&&(M=ke(g+A+P,s[1][0])),l&&$<0?j=Ce(p+$+D,s[0][1]):!l&&$>0&&(j=ke(p+C+D,s[1][1])),y=Math.max(y,M),I=Math.max(I,j)}if(c){let M=0,j=0;a&&L>0?M=ke(g+L,c[0][0]):!a&&L<0&&(M=Ce(g+A,c[1][0])),l&&$>0?j=ke(p+$,c[0][1]):!l&&$<0&&(j=Ce(p+C,c[1][1])),y=Math.max(y,M),I=Math.max(I,j)}if(r){if(u){const M=gt(A/T,b,E)*T;if(y=Math.max(y,M),s){let j=0;!a&&!l||a&&!l&&f?j=ke(p+D+A/T,s[1][1])*T:j=Ce(p+D+(a?L:-L)/T,s[0][1])*T,y=Math.max(y,j)}if(c){let j=0;!a&&!l||a&&!l&&f?j=Ce(p+A/T,c[1][1])*T:j=ke(p+(a?L:-L)/T,c[0][1])*T,y=Math.max(y,j)}}if(d){const M=gt(C*T,w,_)/T;if(I=Math.max(I,M),s){let j=0;!a&&!l||l&&!a&&f?j=ke(g+C*T+P,s[1][0])/T:j=Ce(g+(l?$:-$)*T+P,s[0][0])/T,I=Math.max(I,j)}if(c){let j=0;!a&&!l||l&&!a&&f?j=Ce(g+C*T,c[1][0])/T:j=ke(g+(l?$:-$)*T,c[0][0])/T,I=Math.max(I,j)}}}$=$+($<0?I:-I),L=L+(L<0?y:-y),r&&(f?A>C*T?$=(ro(a,l)?-L:L)/T:L=(ro(a,l)?-$:$)*T:u?($=L/T,l=a):(L=$*T,a=l));const v=a?g+L:g,k=l?p+$:p;return{width:N+(a?-L:L),height:S+(l?-$:$),x:i[0]*L*(a?-1:1)+v,y:i[1]*$*(l?-1:1)+k}}const Sr={width:0,height:0,x:0,y:0},wu={...Sr,pointerX:0,pointerY:0,aspectRatio:1};function vu(e){return[[0,0],[e.measured.width,e.measured.height]]}function bu(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,c=n[0]*i,a=n[1]*s;return[[o-c,r-a],[o+i-c,r+s-a]]}function Eu({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=le(e);let s={controlDirection:oo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:l,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:m,onResizeEnd:w,shouldResize:_}){let b={...Sr},E={...wu};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:oo(l)};let g,p=null,N=[],S,T,L,$=!1;const A=Wo().on("start",C=>{const{nodeLookup:P,transform:D,snapGrid:y,snapToGrid:I,nodeOrigin:v,paneDomNode:k}=n();if(g=P.get(t),!g)return;p=k?.getBoundingClientRect()??null;const{xSnapped:M,ySnapped:j}=Qe(C.sourceEvent,{transform:D,snapGrid:y,snapToGrid:I,containerBounds:p});b={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},E={...b,pointerX:M,pointerY:j,aspectRatio:b.width/b.height},S=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=P.get(g.parentId),T=S&&g.extent==="parent"?vu(S):void 0),N=[],L=void 0;for(const[B,F]of P)if(F.parentId===t&&(N.push({id:B,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const Y=bu(F,g,F.origin??v);L?L=[[Math.min(Y[0][0],L[0][0]),Math.min(Y[0][1],L[0][1])],[Math.max(Y[1][0],L[1][0]),Math.max(Y[1][1],L[1][1])]]:L=Y}h?.(C,{...b})}).on("drag",C=>{const{transform:P,snapGrid:D,snapToGrid:y,nodeOrigin:I}=n(),v=Qe(C.sourceEvent,{transform:P,snapGrid:D,snapToGrid:y,containerBounds:p}),k=[];if(!g)return;const{x:M,y:j,width:B,height:F}=b,Y={},X=g.origin??I,{width:O,height:x,x:z,y:V}=xu(E,s.controlDirection,v,s.boundaries,s.keepAspectRatio,X,T,L),H=O!==B,W=x!==F,G=z!==M&&H,q=V!==j&&W;if(!G&&!q&&!H&&!W)return;if((G||q||X[0]===1||X[1]===1)&&(Y.x=G?z:b.x,Y.y=q?V:b.y,b.x=Y.x,b.y=Y.y,N.length>0)){const ee=z-M,ne=V-j;for(const ce of N)ce.position={x:ce.position.x-ee+X[0]*(O-B),y:ce.position.y-ne+X[1]*(x-F)},k.push(ce)}if((H||W)&&(Y.width=H&&(!s.resizeDirection||s.resizeDirection==="horizontal")?O:b.width,Y.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?x:b.height,b.width=Y.width,b.height=Y.height),S&&g.expandParent){const ee=X[0]*(Y.width??0);Y.x&&Y.x{$&&(w?.(C,{...b}),r?.({...b}),$=!1)});i.call(A)}function a(){i.on(".drag",null)}return{update:c,destroy:a}}const _u={},io=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,h))}},r=()=>t,a={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(_u?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,a);return a},Nu=e=>e?io(e):io,{useDebugValue:Su}=hs,{useSyncExternalStoreWithSelector:Cu}=Cs,ku=e=>e;function Cr(e,t=ku,n){const o=Cu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Su(o),o}const so=(e,t)=>{const n=Nu(e),o=(r,i=t)=>Cr(n,r,i);return Object.assign(o,n),o},Mu=(e,t)=>e?so(e,t):so;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const Dt=Z.createContext(null),Iu=Dt.Provider,kr=xe.error001();function te(e,t){const n=Z.useContext(Dt);if(n===null)throw new Error(kr);return Cr(n,e,t)}function ie(){const e=Z.useContext(Dt);if(e===null)throw new Error(kr);return Z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ao={display:"none"},Ou={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Mr="react-flow__node-desc",Ir="react-flow__edge-desc",Tu="react-flow__aria-live",Pu=e=>e.ariaLiveMessage,Au=e=>e.ariaLabelConfig;function Du({rfId:e}){const t=te(Pu);return R.jsx("div",{id:`${Tu}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ou,children:t})}function Lu({rfId:e,disableKeyboardA11y:t}){const n=te(Au);return R.jsxs(R.Fragment,{children:[R.jsx("div",{id:`${Mr}-${e}`,style:ao,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),R.jsx("div",{id:`${Ir}-${e}`,style:ao,children:n["edge.a11yDescription.default"]}),!t&&R.jsx(Du,{rfId:e})]})}const Lt=Z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return R.jsx("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});Lt.displayName="Panel";function ju({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:R.jsx(Lt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:R.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const $u=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},pt=e=>e.id;function zu(e,t){return re(e.selectedNodes.map(pt),t.selectedNodes.map(pt))&&re(e.selectedEdges.map(pt),t.selectedEdges.map(pt))}function Ru({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:o}=te($u,zu);return Z.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Hu=e=>!!e.onSelectionChangeHandlers;function Vu({onSelectionChange:e}){const t=te(Hu);return e||t?R.jsx(Ru,{onSelectionChange:e}):null}const Or=[0,0],Bu={x:0,y:0,zoom:1},Fu=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],co=[...Fu,"rfId"],Yu=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),lo={translateExtent:et,nodeOrigin:Or,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Wu(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:c,setDefaultNodesAndEdges:a}=te(Yu,re),l=ie();Z.useEffect(()=>(a(e.defaultNodes,e.defaultEdges),()=>{u.current=lo,c()}),[]);const u=Z.useRef(lo);return Z.useEffect(()=>{for(const d of co){const f=e[d],h=u.current[d];f!==h&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?l.setState({ariaLabelConfig:Dl(f)}):d==="fitView"?l.setState({fitViewQueued:f}):d==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[d]:f})))}u.current=e},co.map(d=>e[d])),null}function uo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Zu(e){const[t,n]=Z.useState(e==="system"?null:e);return Z.useEffect(()=>{if(e!=="system"){n(e);return}const o=uo(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:uo()?.matches?"dark":"light"}const fo=typeof document<"u"?document:null;function rt(e=null,t={target:fo,actInsideInputWithModifier:!0}){const[n,o]=Z.useState(!1),r=Z.useRef(!1),i=Z.useRef(new Set([])),[s,c]=Z.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",` `).replace(` `,` diff --git a/src/surreal_memory/server/static/dist/assets/EvolutionPage-C6VI1EZi.js b/src/surreal_memory/server/static/dist/assets/EvolutionPage-BA7T5RIn.js similarity index 94% rename from src/surreal_memory/server/static/dist/assets/EvolutionPage-C6VI1EZi.js rename to src/surreal_memory/server/static/dist/assets/EvolutionPage-BA7T5RIn.js index 550af650..10a7b6a8 100644 --- a/src/surreal_memory/server/static/dist/assets/EvolutionPage-C6VI1EZi.js +++ b/src/surreal_memory/server/static/dist/assets/EvolutionPage-BA7T5RIn.js @@ -1 +1 @@ -import{j as s}from"./vendor-query-CqA1cBNl.js";import{l as x,f as h}from"./index-DXL5wCpD.js";import{P as g}from"./ProGate-DjphnyL3.js";import{C as l,a as n,b as c,c as d}from"./card-Duzfr-hx.js";import{S as u}from"./skeleton-CBW-y0cP.js";import{R as j,B as f,X as p,Y as v,T as b,f as y,g as N}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-react-BfuodpLv.js";import"./vendor-icons-C6dhS1UE.js";import"./vendor-ui-Qm4_4bAc.js";const _={short_term:"var(--color-chart-4)",working:"var(--color-chart-3)",episodic:"var(--color-chart-1)",semantic:"var(--color-chart-2)"};function r({label:t,value:o}){const e=Math.round(o*100);return s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:t}),s.jsxs("span",{className:"font-mono font-medium",children:[e,"%"]})]}),s.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${e}%`}})})]})}function E(){const{data:t,isLoading:o}=x(),{t:e}=h(),i=t?.stage_distribution?[{stage:e("evolution.shortTerm"),count:t.stage_distribution.short_term,key:"short_term"},{stage:e("evolution.working"),count:t.stage_distribution.working,key:"working"},{stage:e("evolution.episodic"),count:t.stage_distribution.episodic,key:"episodic"},{stage:e("evolution.semantic"),count:t.stage_distribution.semantic,key:"semantic"}]:[];return s.jsx(g,{label:e("license.pro_feature","Pro Feature"),children:s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:e("evolution.title")}),s.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[s.jsxs(l,{children:[s.jsx(n,{children:s.jsx(c,{children:e("evolution.brainMetrics")})}),s.jsx(d,{children:o?s.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((a,m)=>s.jsx(u,{className:"h-10 w-full"},m))}):t?s.jsxs("div",{className:"space-y-4",children:[s.jsx(r,{label:e("evolution.maturity"),value:t.maturity_level}),s.jsx(r,{label:e("evolution.plasticity"),value:t.plasticity}),s.jsx(r,{label:e("evolution.semanticRatio"),value:t.semantic_ratio}),s.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-muted-foreground",children:e("evolution.totalFibers")}),s.jsx("p",{className:"font-mono text-lg font-bold",children:t.total_fibers.toLocaleString()})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-muted-foreground",children:e("evolution.totalNeurons")}),s.jsx("p",{className:"font-mono text-lg font-bold",children:t.total_neurons.toLocaleString()})]})]})]}):null})]}),s.jsxs(l,{children:[s.jsx(n,{children:s.jsx(c,{children:e("evolution.stageDistribution")})}),s.jsx(d,{children:o?s.jsx(u,{className:"h-64 w-full"}):s.jsx(j,{width:"100%",height:260,children:s.jsxs(f,{data:i,children:[s.jsx(p,{dataKey:"stage",tick:{fill:"var(--color-muted-foreground)",fontSize:12}}),s.jsx(v,{tick:{fill:"var(--color-muted-foreground)",fontSize:12}}),s.jsx(b,{contentStyle:{backgroundColor:"var(--color-card)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"}}),s.jsx(y,{dataKey:"count",radius:[4,4,0,0],children:i.map(a=>s.jsx(N,{fill:_[a.key]??"var(--color-chart-1)"},a.stage))})]})})})]})]})]})})}export{E as default}; +import{j as s}from"./vendor-query-CqA1cBNl.js";import{l as x,f as h}from"./index-CLb-kMYl.js";import{P as g}from"./ProGate-u3qkirgp.js";import{C as l,a as n,b as c,c as d}from"./card-DG4oK1Wy.js";import{S as u}from"./skeleton-gKUrR2fT.js";import{R as j,B as f,X as p,Y as v,T as b,f as y,g as N}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-react-BfuodpLv.js";import"./vendor-icons-C6dhS1UE.js";import"./vendor-ui-Qm4_4bAc.js";const _={short_term:"var(--color-chart-4)",working:"var(--color-chart-3)",episodic:"var(--color-chart-1)",semantic:"var(--color-chart-2)"};function r({label:t,value:o}){const e=Math.round(o*100);return s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:t}),s.jsxs("span",{className:"font-mono font-medium",children:[e,"%"]})]}),s.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${e}%`}})})]})}function E(){const{data:t,isLoading:o}=x(),{t:e}=h(),i=t?.stage_distribution?[{stage:e("evolution.shortTerm"),count:t.stage_distribution.short_term,key:"short_term"},{stage:e("evolution.working"),count:t.stage_distribution.working,key:"working"},{stage:e("evolution.episodic"),count:t.stage_distribution.episodic,key:"episodic"},{stage:e("evolution.semantic"),count:t.stage_distribution.semantic,key:"semantic"}]:[];return s.jsx(g,{label:e("license.pro_feature","Pro Feature"),children:s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:e("evolution.title")}),s.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[s.jsxs(l,{children:[s.jsx(n,{children:s.jsx(c,{children:e("evolution.brainMetrics")})}),s.jsx(d,{children:o?s.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((a,m)=>s.jsx(u,{className:"h-10 w-full"},m))}):t?s.jsxs("div",{className:"space-y-4",children:[s.jsx(r,{label:e("evolution.maturity"),value:t.maturity_level}),s.jsx(r,{label:e("evolution.plasticity"),value:t.plasticity}),s.jsx(r,{label:e("evolution.semanticRatio"),value:t.semantic_ratio}),s.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-muted-foreground",children:e("evolution.totalFibers")}),s.jsx("p",{className:"font-mono text-lg font-bold",children:t.total_fibers.toLocaleString()})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-muted-foreground",children:e("evolution.totalNeurons")}),s.jsx("p",{className:"font-mono text-lg font-bold",children:t.total_neurons.toLocaleString()})]})]})]}):null})]}),s.jsxs(l,{children:[s.jsx(n,{children:s.jsx(c,{children:e("evolution.stageDistribution")})}),s.jsx(d,{children:o?s.jsx(u,{className:"h-64 w-full"}):s.jsx(j,{width:"100%",height:260,children:s.jsxs(f,{data:i,children:[s.jsx(p,{dataKey:"stage",tick:{fill:"var(--color-muted-foreground)",fontSize:12}}),s.jsx(v,{tick:{fill:"var(--color-muted-foreground)",fontSize:12}}),s.jsx(b,{contentStyle:{backgroundColor:"var(--color-card)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"}}),s.jsx(y,{dataKey:"count",radius:[4,4,0,0],children:i.map(a=>s.jsx(N,{fill:_[a.key]??"var(--color-chart-1)"},a.stage))})]})})})]})]})]})})}export{E as default}; diff --git a/src/surreal_memory/server/static/dist/assets/GraphPage-B5RqF55O.js b/src/surreal_memory/server/static/dist/assets/GraphPage-XQ_-o7wQ.js similarity index 99% rename from src/surreal_memory/server/static/dist/assets/GraphPage-B5RqF55O.js rename to src/surreal_memory/server/static/dist/assets/GraphPage-XQ_-o7wQ.js index 20517f6e..d5451684 100644 --- a/src/surreal_memory/server/static/dist/assets/GraphPage-B5RqF55O.js +++ b/src/surreal_memory/server/static/dist/assets/GraphPage-XQ_-o7wQ.js @@ -1,4 +1,4 @@ -import{j as V}from"./vendor-query-CqA1cBNl.js";import{g as mi,r as Te}from"./vendor-react-BfuodpLv.js";import{i as er,f as tr,a as ir,B as rr}from"./index-DXL5wCpD.js";import{C as Pt,a as nr,b as ar,c as It}from"./card-Duzfr-hx.js";import{S as or}from"./skeleton-CBW-y0cP.js";import"./vendor-icons-C6dhS1UE.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";var Qe={exports:{}},Ot;function sr(){if(Ot)return Qe.exports;Ot=1;var n=typeof Reflect=="object"?Reflect:null,i=n&&typeof n.apply=="function"?n.apply:function(v,_,S){return Function.prototype.apply.call(v,_,S)},t;n&&typeof n.ownKeys=="function"?t=n.ownKeys:Object.getOwnPropertySymbols?t=function(v){return Object.getOwnPropertyNames(v).concat(Object.getOwnPropertySymbols(v))}:t=function(v){return Object.getOwnPropertyNames(v)};function e(m){console&&console.warn&&console.warn(m)}var r=Number.isNaN||function(v){return v!==v};function a(){a.init.call(this)}Qe.exports=a,Qe.exports.once=D,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(m){if(typeof m!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof m)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(m){if(typeof m!="number"||m<0||r(m))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+m+".");o=m}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(v){if(typeof v!="number"||v<0||r(v))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+v+".");return this._maxListeners=v,this};function u(m){return m._maxListeners===void 0?a.defaultMaxListeners:m._maxListeners}a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(v){for(var _=[],S=1;S0&&(P=_[0]),P instanceof Error)throw P;var j=new Error("Unhandled error."+(P?" ("+P.message+")":""));throw j.context=P,j}var z=F[v];if(z===void 0)return!1;if(typeof z=="function")i(z,this,_);else for(var f=z.length,K=b(z,f),S=0;S0&&P.length>G&&!P.warned){P.warned=!0;var j=new Error("Possible EventEmitter memory leak detected. "+P.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");j.name="MaxListenersExceededWarning",j.emitter=m,j.type=v,j.count=P.length,e(j)}return m}a.prototype.addListener=function(v,_){return h(this,v,_,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(v,_){return h(this,v,_,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(m,v,_){var S={fired:!1,wrapFn:void 0,target:m,type:v,listener:_},G=d.bind(S);return G.listener=_,S.wrapFn=G,G}a.prototype.once=function(v,_){return s(_),this.on(v,l(this,v,_)),this},a.prototype.prependOnceListener=function(v,_){return s(_),this.prependListener(v,l(this,v,_)),this},a.prototype.removeListener=function(v,_){var S,G,F,P,j;if(s(_),G=this._events,G===void 0)return this;if(S=G[v],S===void 0)return this;if(S===_||S.listener===_)--this._eventsCount===0?this._events=Object.create(null):(delete G[v],G.removeListener&&this.emit("removeListener",v,S.listener||_));else if(typeof S!="function"){for(F=-1,P=S.length-1;P>=0;P--)if(S[P]===_||S[P].listener===_){j=S[P].listener,F=P;break}if(F<0)return this;F===0?S.shift():w(S,F),S.length===1&&(G[v]=S[0]),G.removeListener!==void 0&&this.emit("removeListener",v,j||_)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(v){var _,S,G;if(S=this._events,S===void 0)return this;if(S.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):S[v]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete S[v]),this;if(arguments.length===0){var F=Object.keys(S),P;for(G=0;G=0;G--)this.removeListener(v,_[G]);return this};function c(m,v,_){var S=m._events;if(S===void 0)return[];var G=S[v];return G===void 0?[]:typeof G=="function"?_?[G.listener||G]:[G]:_?C(G):b(G,G.length)}a.prototype.listeners=function(v){return c(this,v,!0)},a.prototype.rawListeners=function(v){return c(this,v,!1)},a.listenerCount=function(m,v){return typeof m.listenerCount=="function"?m.listenerCount(v):g.call(m,v)},a.prototype.listenerCount=g;function g(m){var v=this._events;if(v!==void 0){var _=v[m];if(typeof _=="function")return 1;if(_!==void 0)return _.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function b(m,v){for(var _=new Array(v),S=0;Sn++}function me(){const n=arguments;let i=null,t=-1;return{[Symbol.iterator](){return this},next(){let e=null;do{if(i===null){if(t++,t>=n.length)return{done:!0};i=n[t][Symbol.iterator]()}if(e=i.next(),e.done){i=null;continue}break}while(!0);return e}}}function Le(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class kt extends Error{constructor(i){super(),this.name="GraphError",this.message=i}}class x extends kt{constructor(i){super(i),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,x.prototype.constructor)}}class k extends kt{constructor(i){super(i),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,k.prototype.constructor)}}class I extends kt{constructor(i){super(i),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,I.prototype.constructor)}}function bi(n,i){this.key=n,this.attributes=i,this.clear()}bi.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function wi(n,i){this.key=n,this.attributes=i,this.clear()}wi.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Ei(n,i){this.key=n,this.attributes=i,this.clear()}Ei.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Ge(n,i,t,e,r){this.key=i,this.attributes=r,this.undirected=n,this.source=t,this.target=e}Ge.prototype.attach=function(){let n="out",i="in";this.undirected&&(n=i="undirected");const t=this.source.key,e=this.target.key;this.source[n][e]=this,!(this.undirected&&t===e)&&(this.target[i][t]=this)};Ge.prototype.attachMulti=function(){let n="out",i="in";const t=this.source.key,e=this.target.key;this.undirected&&(n=i="undirected");const r=this.source[n],a=r[e];if(typeof a>"u"){r[e]=this,this.undirected&&t===e||(this.target[i][t]=this);return}a.previous=this,this.next=a,r[e]=this,this.target[i][t]=this};Ge.prototype.detach=function(){const n=this.source.key,i=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),delete this.source[t][i],delete this.target[e][n]};Ge.prototype.detachMulti=function(){const n=this.source.key,i=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][i],delete this.target[e][n]):(this.next.previous=void 0,this.source[t][i]=this.next,this.target[e][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const _i=0,Ti=1,dr=2,Si=3;function ve(n,i,t,e,r,a,o){let s,u,h,d;if(e=""+e,t===_i){if(s=n._nodes.get(e),!s)throw new k(`Graph.${i}: could not find the "${e}" node in the graph.`);h=r,d=a}else if(t===Si){if(r=""+r,u=n._edges.get(r),!u)throw new k(`Graph.${i}: could not find the "${r}" edge in the graph.`);const l=u.source.key,c=u.target.key;if(e===l)s=u.target;else if(e===c)s=u.source;else throw new k(`Graph.${i}: the "${e}" node is not attached to the "${r}" edge (${l}, ${c}).`);h=a,d=o}else{if(u=n._edges.get(e),!u)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`);t===Ti?s=u.source:s=u.target,h=r,d=a}return[s,h,d]}function lr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);return o.attributes[s]}}function cr(n,i,t){n.prototype[i]=function(e,r){const[a]=ve(this,i,t,e,r);return a.attributes}}function fr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);return o.attributes.hasOwnProperty(s)}}function gr(n,i,t){n.prototype[i]=function(e,r,a,o){const[s,u,h]=ve(this,i,t,e,r,a,o);return s.attributes[u]=h,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function pr(n,i,t){n.prototype[i]=function(e,r,a,o){const[s,u,h]=ve(this,i,t,e,r,a,o);if(typeof h!="function")throw new x(`Graph.${i}: updater should be a function.`);const d=s.attributes,l=h(d[u]);return d[u]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function mr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}function vr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);if(!J(s))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function yr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);if(!J(s))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return Z(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}function br(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);if(typeof s!="function")throw new x(`Graph.${i}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const wr=[{name:n=>`get${n}Attribute`,attacher:lr},{name:n=>`get${n}Attributes`,attacher:cr},{name:n=>`has${n}Attribute`,attacher:fr},{name:n=>`set${n}Attribute`,attacher:gr},{name:n=>`update${n}Attribute`,attacher:pr},{name:n=>`remove${n}Attribute`,attacher:mr},{name:n=>`replace${n}Attributes`,attacher:vr},{name:n=>`merge${n}Attributes`,attacher:yr},{name:n=>`update${n}Attributes`,attacher:br}];function Er(n){wr.forEach(function({name:i,attacher:t}){t(n,i("Node"),_i),t(n,i("Source"),Ti),t(n,i("Target"),dr),t(n,i("Opposite"),Si)})}function _r(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]}}function Tr(n,i,t){n.prototype[i]=function(e){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+e,o=""+arguments[1];if(r=oe(this,a,o,t),!r)throw new k(`Graph.${i}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,r=this._edges.get(e),!r)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function Sr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(r)}}function Cr(n,i,t){n.prototype[i]=function(e,r,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=oe(this,s,u,t),!o)throw new k(`Graph.${i}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return o.attributes[r]=a,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Rr(n,i,t){n.prototype[i]=function(e,r,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=oe(this,s,u,t),!o)throw new k(`Graph.${i}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof a!="function")throw new x(`Graph.${i}: updater should be a function.`);return o.attributes[r]=a(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Ar(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return delete a.attributes[r],this.emit("edgeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:r}),this}}function kr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return a.attributes=r,this.emit("edgeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function xr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return Z(a.attributes,r),this.emit("edgeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:r}),this}}function Dr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof r!="function")throw new x(`Graph.${i}: provided updater is not a function.`);return a.attributes=r(a.attributes),this.emit("edgeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const Lr=[{name:n=>`get${n}Attribute`,attacher:_r},{name:n=>`get${n}Attributes`,attacher:Tr},{name:n=>`has${n}Attribute`,attacher:Sr},{name:n=>`set${n}Attribute`,attacher:Cr},{name:n=>`update${n}Attribute`,attacher:Rr},{name:n=>`remove${n}Attribute`,attacher:Ar},{name:n=>`replace${n}Attributes`,attacher:kr},{name:n=>`merge${n}Attributes`,attacher:xr},{name:n=>`update${n}Attributes`,attacher:Dr}];function Gr(n){Lr.forEach(function({name:i,attacher:t}){t(n,i("Edge"),"mixed"),t(n,i("DirectedEdge"),"directed"),t(n,i("UndirectedEdge"),"undirected")})}const Fr=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Nr(n,i,t,e){let r=!1;for(const a in i){if(a===e)continue;const o=i[a];if(r=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&r)return o.key}}function Pr(n,i,t,e){let r,a,o,s=!1;for(const u in i)if(u!==e){r=i[u];do{if(a=r.source,o=r.target,s=t(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected),n&&s)return r.key;r=r.next}while(r!==void 0)}}function ht(n,i){const t=Object.keys(n),e=t.length;let r,a=0;return{[Symbol.iterator](){return this},next(){do if(r)r=r.next;else{if(a>=e)return{done:!0};const o=t[a++];if(o===i){r=void 0;continue}r=n[o]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}}}}function Ir(n,i,t,e){const r=i[t];if(!r)return;const a=r.source,o=r.target;if(e(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected)&&n)return r.key}function Or(n,i,t,e){let r=i[t];if(!r)return;let a=!1;do{if(a=e(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),n&&a)return r.key;r=r.next}while(r!==void 0)}function dt(n,i){let t=n[i];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const r={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:r}}};let e=!1;return{[Symbol.iterator](){return this},next(){return e===!0?{done:!0}:(e=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function Ur(n,i){if(n.size===0)return[];if(i==="mixed"||i===n.type)return Array.from(n._edges.keys());const t=i==="undirected"?n.undirectedSize:n.directedSize,e=new Array(t),r=i==="undirected",a=n._edges.values();let o=0,s,u;for(;s=a.next(),s.done!==!0;)u=s.value,u.undirected===r&&(e[o++]=u.key);return e}function Ci(n,i,t,e){if(i.size===0)return;const r=t!=="mixed"&&t!==i.type,a=t==="undirected";let o,s,u=!1;const h=i._edges.values();for(;o=h.next(),o.done!==!0;){if(s=o.value,r&&s.undirected!==a)continue;const{key:d,attributes:l,source:c,target:g}=s;if(u=e(d,l,c.key,g.key,c.attributes,g.attributes,s.undirected),n&&u)return d}}function zr(n,i){if(n.size===0)return Le();const t=i!=="mixed"&&i!==n.type,e=i==="undirected",r=n._edges.values();return{[Symbol.iterator](){return this},next(){let a,o;for(;;){if(a=r.next(),a.done)return a;if(o=a.value,!(t&&o.undirected!==e))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}}}}function xt(n,i,t,e,r,a){const o=i?Pr:Nr;let s;if(t!=="undirected"&&(e!=="out"&&(s=o(n,r.in,a),n&&s)||e!=="in"&&(s=o(n,r.out,a,e?void 0:r.key),n&&s))||t!=="directed"&&(s=o(n,r.undirected,a),n&&s))return s}function $r(n,i,t,e){const r=[];return xt(!1,n,i,t,e,function(a){r.push(a)}),r}function Br(n,i,t){let e=Le();return n!=="undirected"&&(i!=="out"&&typeof t.in<"u"&&(e=me(e,ht(t.in))),i!=="in"&&typeof t.out<"u"&&(e=me(e,ht(t.out,i?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(e=me(e,ht(t.undirected))),e}function Dt(n,i,t,e,r,a,o){const s=t?Or:Ir;let u;if(i!=="undirected"&&(typeof r.in<"u"&&e!=="out"&&(u=s(n,r.in,a,o),n&&u)||typeof r.out<"u"&&e!=="in"&&(e||r.key!==a)&&(u=s(n,r.out,a,o),n&&u))||i!=="directed"&&typeof r.undirected<"u"&&(u=s(n,r.undirected,a,o),n&&u))return u}function Mr(n,i,t,e,r){const a=[];return Dt(!1,n,i,t,e,r,function(o){a.push(o)}),a}function Hr(n,i,t,e){let r=Le();return n!=="undirected"&&(typeof t.in<"u"&&i!=="out"&&e in t.in&&(r=me(r,dt(t.in,e))),typeof t.out<"u"&&i!=="in"&&e in t.out&&(i||t.key!==e)&&(r=me(r,dt(t.out,e)))),n!=="directed"&&typeof t.undirected<"u"&&e in t.undirected&&(r=me(r,dt(t.undirected,e))),r}function Wr(n,i){const{name:t,type:e,direction:r}=i;n.prototype[t]=function(a,o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];if(!arguments.length)return Ur(this,e);if(arguments.length===1){a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new k(`Graph.${t}: could not find the "${a}" node in the graph.`);return $r(this.multi,e==="mixed"?this.type:e,r,s)}if(arguments.length===2){a=""+a,o=""+o;const s=this._nodes.get(a);if(!s)throw new k(`Graph.${t}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new k(`Graph.${t}: could not find the "${o}" target node in the graph.`);return Mr(e,this.multi,r,s,o)}throw new x(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function jr(n,i){const{name:t,type:e,direction:r}=i,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d,l){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){if(arguments.length===1)return l=h,Ci(!1,this,e,l);if(arguments.length===2){h=""+h,l=d;const c=this._nodes.get(h);if(typeof c>"u")throw new k(`Graph.${a}: could not find the "${h}" node in the graph.`);return xt(!1,this.multi,e==="mixed"?this.type:e,r,c,l)}if(arguments.length===3){h=""+h,d=""+d;const c=this._nodes.get(h);if(!c)throw new k(`Graph.${a}: could not find the "${h}" source node in the graph.`);if(!this._nodes.has(d))throw new k(`Graph.${a}: could not find the "${d}" target node in the graph.`);return Dt(!1,e,this.multi,r,c,d,l)}throw new x(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop();let l;if(h.length===0){let c=0;e!=="directed"&&(c+=this.undirectedSize),e!=="undirected"&&(c+=this.directedSize),l=new Array(c);let g=0;h.push((b,w,C,D,T,A,m)=>{l[g++]=d(b,w,C,D,T,A,m)})}else l=[],h.push((c,g,b,w,C,D,T)=>{l.push(d(c,g,b,w,C,D,T))});return this[a].apply(this,h),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop(),l=[];return h.push((c,g,b,w,C,D,T)=>{d(c,g,b,w,C,D,T)&&l.push(c)}),this[a].apply(this,h),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(){let h=Array.prototype.slice.call(arguments);if(h.length<2||h.length>4)throw new x(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${h.length}).`);if(typeof h[h.length-1]=="function"&&typeof h[h.length-2]!="function")throw new x(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let d,l;h.length===2?(d=h[0],l=h[1],h=[]):h.length===3?(d=h[1],l=h[2],h=[h[0]]):h.length===4&&(d=h[2],l=h[3],h=[h[0],h[1]]);let c=l;return h.push((g,b,w,C,D,T,A)=>{c=d(c,g,b,w,C,D,T,A)}),this[a].apply(this,h),c}}function Vr(n,i){const{name:t,type:e,direction:r}=i,a="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(u,h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return!1;if(arguments.length===1)return d=u,Ci(!0,this,e,d);if(arguments.length===2){u=""+u,d=h;const l=this._nodes.get(u);if(typeof l>"u")throw new k(`Graph.${a}: could not find the "${u}" node in the graph.`);return xt(!0,this.multi,e==="mixed"?this.type:e,r,l,d)}if(arguments.length===3){u=""+u,h=""+h;const l=this._nodes.get(u);if(!l)throw new k(`Graph.${a}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(h))throw new k(`Graph.${a}: could not find the "${h}" target node in the graph.`);return Dt(!0,e,this.multi,r,l,h,d)}throw new x(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,g,b,w,C,D)=>h(l,c,g,b,w,C,D)),!!this[a].apply(this,u)};const s="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,g,b,w,C,D)=>!h(l,c,g,b,w,C,D)),!this[a].apply(this,u)}}function qr(n,i){const{name:t,type:e,direction:r}=i,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o,s){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Le();if(!arguments.length)return zr(this,e);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new k(`Graph.${a}: could not find the "${o}" node in the graph.`);return Br(e,r,u)}if(arguments.length===2){o=""+o,s=""+s;const u=this._nodes.get(o);if(!u)throw new k(`Graph.${a}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new k(`Graph.${a}: could not find the "${s}" target node in the graph.`);return Hr(e,r,u,s)}throw new x(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Kr(n){Fr.forEach(i=>{Wr(n,i),jr(n,i),Vr(n,i),qr(n,i)})}const Yr=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function ot(){this.A=null,this.B=null}ot.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};ot.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function Oe(n,i,t,e,r){for(const a in e){const o=e[a],s=o.source,u=o.target,h=s===t?u:s;if(i&&i.has(h.key))continue;const d=r(h.key,h.attributes);if(n&&d)return h.key}}function Lt(n,i,t,e,r){if(i!=="mixed"){if(i==="undirected")return Oe(n,null,e,e.undirected,r);if(typeof t=="string")return Oe(n,null,e,e[t],r)}const a=new ot;let o;if(i!=="undirected"){if(t!=="out"){if(o=Oe(n,null,e,e.in,r),n&&o)return o;a.wrap(e.in)}if(t!=="in"){if(o=Oe(n,a,e,e.out,r),n&&o)return o;a.wrap(e.out)}}if(i!=="directed"&&(o=Oe(n,a,e,e.undirected,r),n&&o))return o}function Zr(n,i,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof i=="string")return Object.keys(t[i])}const e=[];return Lt(!1,n,i,t,function(r){e.push(r)}),e}function Ue(n,i,t){const e=Object.keys(t),r=e.length;let a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=r)return n&&n.wrap(t),{done:!0};const s=t[e[a++]],u=s.source,h=s.target;if(o=u===i?h:u,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function Xr(n,i,t){if(n!=="mixed"){if(n==="undirected")return Ue(null,t,t.undirected);if(typeof i=="string")return Ue(null,t,t[i])}let e=Le();const r=new ot;return n!=="undirected"&&(i!=="out"&&(e=me(e,Ue(r,t,t.in))),i!=="in"&&(e=me(e,Ue(r,t,t.out)))),n!=="directed"&&(e=me(e,Ue(r,t,t.undirected))),e}function Jr(n,i){const{name:t,type:e,direction:r}=i;n.prototype[t]=function(a){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new k(`Graph.${t}: could not find the "${a}" node in the graph.`);return Zr(e==="mixed"?this.type:e,r,o)}}function Qr(n,i){const{name:t,type:e,direction:r}=i,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new k(`Graph.${a}: could not find the "${h}" node in the graph.`);Lt(!1,e==="mixed"?this.type:e,r,l,d)};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(h,d){const l=[];return this[a](h,(c,g)=>{l.push(d(c,g))}),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(h,d){const l=[];return this[a](h,(c,g)=>{d(c,g)&&l.push(c)}),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(h,d,l){if(arguments.length<3)throw new x(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let c=l;return this[a](h,(g,b)=>{c=d(c,g,b)}),c}}function en(n,i){const{name:t,type:e,direction:r}=i,a=t[0].toUpperCase()+t.slice(1,-1),o="find"+a;n.prototype[o]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new k(`Graph.${o}: could not find the "${h}" node in the graph.`);return Lt(!0,e==="mixed"?this.type:e,r,l,d)};const s="some"+a;n.prototype[s]=function(h,d){return!!this[o](h,d)};const u="every"+a;n.prototype[u]=function(h,d){return!this[o](h,(c,g)=>!d(c,g))}}function tn(n,i){const{name:t,type:e,direction:r}=i,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Le();o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new k(`Graph.${a}: could not find the "${o}" node in the graph.`);return Xr(e==="mixed"?this.type:e,r,s)}}function rn(n){Yr.forEach(i=>{Jr(n,i),Qr(n,i),en(n,i),tn(n,i)})}function et(n,i,t,e,r){const a=e._nodes.values(),o=e.type;let s,u,h,d,l,c;for(;s=a.next(),s.done!==!0;){let g=!1;if(u=s.value,o!=="undirected"){d=u.out;for(h in d){l=d[h];do c=l.target,g=!0,r(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}if(o!=="directed"){d=u.undirected;for(h in d)if(!(i&&u.key>h)){l=d[h];do c=l.target,c.key!==h&&(c=l.source),g=!0,r(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}t&&!g&&r(u.key,null,u.attributes,null,null,null,null)}}function nn(n,i){const t={key:n};return yi(i.attributes)||(t.attributes=Z({},i.attributes)),t}function an(n,i,t){const e={key:i,source:t.source.key,target:t.target.key};return yi(t.attributes)||(e.attributes=Z({},t.attributes)),n==="mixed"&&t.undirected&&(e.undirected=!0),e}function on(n){if(!J(n))throw new x('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new x("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new x("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function sn(n){if(!J(n))throw new x('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new x("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new x("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new x("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new x("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const un=hr(),hn=new Set(["directed","undirected","mixed"]),zt=new Set(["domain","_events","_eventsCount","_maxListeners"]),dn=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],ln={allowSelfLoops:!0,multi:!1,type:"mixed"};function cn(n,i,t){if(t&&!J(t))throw new x(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(i=""+i,t=t||{},n._nodes.has(i))throw new I(`Graph.addNode: the "${i}" node already exist in the graph.`);const e=new n.NodeDataClass(i,t);return n._nodes.set(i,e),n.emit("nodeAdded",{key:i,attributes:t}),e}function $t(n,i,t){const e=new n.NodeDataClass(i,t);return n._nodes.set(i,e),n.emit("nodeAdded",{key:i,attributes:t}),e}function Ri(n,i,t,e,r,a,o,s){if(!e&&n.type==="undirected")throw new I(`Graph.${i}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new I(`Graph.${i}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!J(s))throw new x(`Graph.${i}: invalid attributes. Expecting an object but got "${s}"`);if(a=""+a,o=""+o,s=s||{},!n.allowSelfLoops&&a===o)throw new I(`Graph.${i}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=n._nodes.get(a),h=n._nodes.get(o);if(!u)throw new k(`Graph.${i}: source node "${a}" not found.`);if(!h)throw new k(`Graph.${i}: target node "${o}" not found.`);const d={key:null,undirected:e,source:a,target:o,attributes:s};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new I(`Graph.${i}: the "${r}" edge already exists in the graph.`);if(!n.multi&&(e?typeof u.undirected[o]<"u":typeof u.out[o]<"u"))throw new I(`Graph.${i}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const l=new Ge(e,r,u,h,s);n._edges.set(r,l);const c=a===o;return e?(u.undirectedDegree++,h.undirectedDegree++,c&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,c&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?l.attachMulti():l.attach(),e?n._undirectedSize++:n._directedSize++,d.key=r,n.emit("edgeAdded",d),r}function fn(n,i,t,e,r,a,o,s,u){if(!e&&n.type==="undirected")throw new I(`Graph.${i}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new I(`Graph.${i}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(u){if(typeof s!="function")throw new x(`Graph.${i}: invalid updater function. Expecting a function but got "${s}"`)}else if(!J(s))throw new x(`Graph.${i}: invalid attributes. Expecting an object but got "${s}"`)}a=""+a,o=""+o;let h;if(u&&(h=s,s=void 0),!n.allowSelfLoops&&a===o)throw new I(`Graph.${i}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=n._nodes.get(a),l=n._nodes.get(o),c,g;if(!t&&(c=n._edges.get(r),c)){if((c.source.key!==a||c.target.key!==o)&&(!e||c.source.key!==o||c.target.key!==a))throw new I(`Graph.${i}: inconsistency detected when attempting to merge the "${r}" edge with "${a}" source & "${o}" target vs. ("${c.source.key}", "${c.target.key}").`);g=c}if(!g&&!n.multi&&d&&(g=e?d.undirected[o]:d.out[o]),g){const T=[g.key,!1,!1,!1];if(u?!h:!s)return T;if(u){const A=g.attributes;g.attributes=h(A),n.emit("edgeAttributesUpdated",{type:"replace",key:g.key,attributes:g.attributes})}else Z(g.attributes,s),n.emit("edgeAttributesUpdated",{type:"merge",key:g.key,attributes:g.attributes,data:s});return T}s=s||{},u&&h&&(s=h(s));const b={key:null,undirected:e,source:a,target:o,attributes:s};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new I(`Graph.${i}: the "${r}" edge already exists in the graph.`);let w=!1,C=!1;d||(d=$t(n,a,{}),w=!0,a===o&&(l=d,C=!0)),l||(l=$t(n,o,{}),C=!0),c=new Ge(e,r,d,l,s),n._edges.set(r,c);const D=a===o;return e?(d.undirectedDegree++,l.undirectedDegree++,D&&(d.undirectedLoops++,n._undirectedSelfLoopCount++)):(d.outDegree++,l.inDegree++,D&&(d.directedLoops++,n._directedSelfLoopCount++)),n.multi?c.attachMulti():c.attach(),e?n._undirectedSize++:n._directedSize++,b.key=r,n.emit("edgeAdded",b),[r,!0,w,C]}function Ae(n,i){n._edges.delete(i.key);const{source:t,target:e,attributes:r}=i,a=i.undirected,o=t===e;a?(t.undirectedDegree--,e.undirectedDegree--,o&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,e.inDegree--,o&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?i.detachMulti():i.detach(),a?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:i.key,attributes:r,source:t.key,target:e.key,undirected:a})}class W extends vi.EventEmitter{constructor(i){if(super(),i=Z({},ln,i),typeof i.multi!="boolean")throw new x(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${i.multi}".`);if(!hn.has(i.type))throw new x(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${i.type}".`);if(typeof i.allowSelfLoops!="boolean")throw new x(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${i.allowSelfLoops}".`);const t=i.type==="mixed"?bi:i.type==="directed"?wi:Ei;ae(this,"NodeDataClass",t);const e="geid_"+un()+"_";let r=0;const a=()=>{let o;do o=e+r++;while(this._edges.has(o));return o};ae(this,"_attributes",{}),ae(this,"_nodes",new Map),ae(this,"_edges",new Map),ae(this,"_directedSize",0),ae(this,"_undirectedSize",0),ae(this,"_directedSelfLoopCount",0),ae(this,"_undirectedSelfLoopCount",0),ae(this,"_edgeKeyGenerator",a),ae(this,"_options",i),zt.forEach(o=>ae(this,o,this[o])),he(this,"order",()=>this._nodes.size),he(this,"size",()=>this._edges.size),he(this,"directedSize",()=>this._directedSize),he(this,"undirectedSize",()=>this._undirectedSize),he(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),he(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),he(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),he(this,"multi",this._options.multi),he(this,"type",this._options.type),he(this,"allowSelfLoops",this._options.allowSelfLoops),he(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(i){return this._nodes.has(""+i)}hasDirectedEdge(i,t){if(this.type==="undirected")return!1;if(arguments.length===1){const e=""+i,r=this._edges.get(e);return!!r&&!r.undirected}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?e.out.hasOwnProperty(t):!1}throw new x(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(i,t){if(this.type==="directed")return!1;if(arguments.length===1){const e=""+i,r=this._edges.get(e);return!!r&&r.undirected}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?e.undirected.hasOwnProperty(t):!1}throw new x(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(i,t){if(arguments.length===1){const e=""+i;return this._edges.has(e)}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?typeof e.out<"u"&&e.out.hasOwnProperty(t)||typeof e.undirected<"u"&&e.undirected.hasOwnProperty(t):!1}throw new x(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(i,t){if(this.type==="undirected")return;if(i=""+i,t=""+t,this.multi)throw new I("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const e=this._nodes.get(i);if(!e)throw new k(`Graph.directedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const r=e.out&&e.out[t]||void 0;if(r)return r.key}undirectedEdge(i,t){if(this.type==="directed")return;if(i=""+i,t=""+t,this.multi)throw new I("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const e=this._nodes.get(i);if(!e)throw new k(`Graph.undirectedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const r=e.undirected&&e.undirected[t]||void 0;if(r)return r.key}edge(i,t){if(this.multi)throw new I("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.edge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`Graph.edge: could not find the "${t}" target node in the graph.`);const r=e.out&&e.out[t]||e.undirected&&e.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areDirectedNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.in||t in e.out}areOutNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areOutNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.out}areInNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areInNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.in}areUndirectedNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areUndirectedNeighbors: could not find the "${i}" node in the graph.`);return this.type==="directed"?!1:t in e.undirected}areNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&(t in e.in||t in e.out)||this.type!=="directed"&&t in e.undirected}areInboundNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areInboundNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&t in e.in||this.type!=="directed"&&t in e.undirected}areOutboundNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areOutboundNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&t in e.out||this.type!=="directed"&&t in e.undirected}inDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.directedDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.undirectedDegree: could not find the "${i}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inboundDegree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree),e}outboundDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outboundDegree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.outDegree),e}degree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.degree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree),e}inDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.directedDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree,r+=t.directedLoops),e-r}outboundDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.outDegree,r+=t.directedLoops),e-r}degreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.degreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree,r+=t.directedLoops*2),e-r}source(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.source: could not find the "${i}" edge in the graph.`);return t.source.key}target(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.target: could not find the "${i}" edge in the graph.`);return t.target.key}extremities(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.extremities: could not find the "${i}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(i,t){i=""+i,t=""+t;const e=this._edges.get(t);if(!e)throw new k(`Graph.opposite: could not find the "${t}" edge in the graph.`);const r=e.source.key,a=e.target.key;if(i===r)return a;if(i===a)return r;throw new k(`Graph.opposite: the "${i}" node is not attached to the "${t}" edge (${r}, ${a}).`)}hasExtremity(i,t){i=""+i,t=""+t;const e=this._edges.get(i);if(!e)throw new k(`Graph.hasExtremity: could not find the "${i}" edge in the graph.`);return e.source.key===t||e.target.key===t}isUndirected(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.isUndirected: could not find the "${i}" edge in the graph.`);return t.undirected}isDirected(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.isDirected: could not find the "${i}" edge in the graph.`);return!t.undirected}isSelfLoop(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.isSelfLoop: could not find the "${i}" edge in the graph.`);return t.source===t.target}addNode(i,t){return cn(this,i,t).key}mergeNode(i,t){if(t&&!J(t))throw new x(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);i=""+i,t=t||{};let e=this._nodes.get(i);return e?(t&&(Z(e.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:i,attributes:e.attributes,data:t})),[i,!1]):(e=new this.NodeDataClass(i,t),this._nodes.set(i,e),this.emit("nodeAdded",{key:i,attributes:t}),[i,!0])}updateNode(i,t){if(t&&typeof t!="function")throw new x(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);i=""+i;let e=this._nodes.get(i);if(e){if(t){const a=e.attributes;e.attributes=t(a),this.emit("nodeAttributesUpdated",{type:"replace",key:i,attributes:e.attributes})}return[i,!1]}const r=t?t({}):{};return e=new this.NodeDataClass(i,r),this._nodes.set(i,e),this.emit("nodeAdded",{key:i,attributes:r}),[i,!0]}dropNode(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.dropNode: could not find the "${i}" node in the graph.`);let e;if(this.type!=="undirected"){for(const r in t.out){e=t.out[r];do Ae(this,e),e=e.next;while(e)}for(const r in t.in){e=t.in[r];do Ae(this,e),e=e.next;while(e)}}if(this.type!=="directed")for(const r in t.undirected){e=t.undirected[r];do Ae(this,e),e=e.next;while(e)}this._nodes.delete(i),this.emit("nodeDropped",{key:i,attributes:t.attributes})}dropEdge(i){let t;if(arguments.length>1){const e=""+arguments[0],r=""+arguments[1];if(t=oe(this,e,r,this.type),!t)throw new k(`Graph.dropEdge: could not find the "${e}" -> "${r}" edge in the graph.`)}else if(i=""+i,t=this._edges.get(i),!t)throw new k(`Graph.dropEdge: could not find the "${i}" edge in the graph.`);return Ae(this,t),this}dropDirectedEdge(i,t){if(arguments.length<2)throw new I("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");i=""+i,t=""+t;const e=oe(this,i,t,"directed");if(!e)throw new k(`Graph.dropDirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return Ae(this,e),this}dropUndirectedEdge(i,t){if(arguments.length<2)throw new I("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const e=oe(this,i,t,"undirected");if(!e)throw new k(`Graph.dropUndirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return Ae(this,e),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const i=this._nodes.values();let t;for(;t=i.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(i){return this._attributes[i]}getAttributes(){return this._attributes}hasAttribute(i){return this._attributes.hasOwnProperty(i)}setAttribute(i,t){return this._attributes[i]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:i}),this}updateAttribute(i,t){if(typeof t!="function")throw new x("Graph.updateAttribute: updater should be a function.");const e=this._attributes[i];return this._attributes[i]=t(e),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:i}),this}removeAttribute(i){return delete this._attributes[i],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:i}),this}replaceAttributes(i){if(!J(i))throw new x("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=i,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(i){if(!J(i))throw new x("Graph.mergeAttributes: provided attributes are not a plain object.");return Z(this._attributes,i),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:i}),this}updateAttributes(i){if(typeof i!="function")throw new x("Graph.updateAttributes: provided updater is not a function.");return this._attributes=i(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(i,t){if(typeof i!="function")throw new x("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!Ut(t))throw new x("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._nodes.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,a.attributes=i(a.key,a.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(i,t){if(typeof i!="function")throw new x("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!Ut(t))throw new x("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._edges.values();let r,a,o,s;for(;r=e.next(),r.done!==!0;)a=r.value,o=a.source,s=a.target,a.attributes=i(a.key,a.attributes,o.key,s.key,o.attributes,s.attributes,a.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(i){if(typeof i!="function")throw new x("Graph.forEachAdjacencyEntry: expecting a callback.");et(!1,!1,!1,this,i)}forEachAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new x("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");et(!1,!1,!0,this,i)}forEachAssymetricAdjacencyEntry(i){if(typeof i!="function")throw new x("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");et(!1,!0,!1,this,i)}forEachAssymetricAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new x("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");et(!1,!0,!0,this,i)}nodes(){return Array.from(this._nodes.keys())}forEachNode(i){if(typeof i!="function")throw new x("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)r=e.value,i(r.key,r.attributes)}findNode(i){if(typeof i!="function")throw new x("Graph.findNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,i(r.key,r.attributes))return r.key}mapNodes(i){if(typeof i!="function")throw new x("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let e,r;const a=new Array(this.order);let o=0;for(;e=t.next(),e.done!==!0;)r=e.value,a[o++]=i(r.key,r.attributes);return a}someNode(i){if(typeof i!="function")throw new x("Graph.someNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,i(r.key,r.attributes))return!0;return!1}everyNode(i){if(typeof i!="function")throw new x("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,!i(r.key,r.attributes))return!1;return!0}filterNodes(i){if(typeof i!="function")throw new x("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let e,r;const a=[];for(;e=t.next(),e.done!==!0;)r=e.value,i(r.key,r.attributes)&&a.push(r.key);return a}reduceNodes(i,t){if(typeof i!="function")throw new x("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new x("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let e=t;const r=this._nodes.values();let a,o;for(;a=r.next(),a.done!==!0;)o=a.value,e=i(e,o.key,o.attributes);return e}nodeEntries(){const i=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=i.next();if(t.done)return t;const e=t.value;return{value:{node:e.key,attributes:e.attributes},done:!1}}}}export(){const i=new Array(this._nodes.size);let t=0;this._nodes.forEach((r,a)=>{i[t++]=nn(a,r)});const e=new Array(this._edges.size);return t=0,this._edges.forEach((r,a)=>{e[t++]=an(this.type,a,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:i,edges:e}}import(i,t=!1){if(i instanceof W)return i.forEachNode((u,h)=>{t?this.mergeNode(u,h):this.addNode(u,h)}),i.forEachEdge((u,h,d,l,c,g,b)=>{t?b?this.mergeUndirectedEdgeWithKey(u,d,l,h):this.mergeDirectedEdgeWithKey(u,d,l,h):b?this.addUndirectedEdgeWithKey(u,d,l,h):this.addDirectedEdgeWithKey(u,d,l,h)}),this;if(!J(i))throw new x("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(i.attributes){if(!J(i.attributes))throw new x("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(i.attributes):this.replaceAttributes(i.attributes)}let e,r,a,o,s;if(i.nodes){if(a=i.nodes,!Array.isArray(a))throw new x("Graph.import: invalid nodes. Expecting an array.");for(e=0,r=a.length;e{const a=Z({},e.attributes);e=new t.NodeDataClass(r,a),t._nodes.set(r,e)}),t}copy(i){if(i=i||{},typeof i.type=="string"&&i.type!==this.type&&i.type!=="mixed")throw new I(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${i.type}" because this would mean losing information about the current graph.`);if(typeof i.multi=="boolean"&&i.multi!==this.multi&&i.multi!==!0)throw new I("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof i.allowSelfLoops=="boolean"&&i.allowSelfLoops!==this.allowSelfLoops&&i.allowSelfLoops!==!0)throw new I("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(i),e=this._edges.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,Ri(t,"copy",!1,a.undirected,a.key,a.source.key,a.target.key,Z({},a.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const i={};this._nodes.forEach((a,o)=>{i[o]=a.attributes});const t={},e={};this._edges.forEach((a,o)=>{const s=a.undirected?"--":"->";let u="",h=a.source.key,d=a.target.key,l;a.undirected&&h>d&&(l=h,h=d,d=l);const c=`(${h})${s}(${d})`;o.startsWith("geid_")?this.multi&&(typeof e[c]>"u"?e[c]=0:e[c]++,u+=`${e[c]}. `):u+=`[${o}]: `,u+=c,t[u]=a.attributes});const r={};for(const a in this)this.hasOwnProperty(a)&&!zt.has(a)&&typeof this[a]!="function"&&typeof a!="symbol"&&(r[a]=this[a]);return r.attributes=this._attributes,r.nodes=i,r.edges=t,ae(r,"constructor",this.constructor),r}}typeof Symbol<"u"&&(W.prototype[Symbol.for("nodejs.util.inspect.custom")]=W.prototype.inspect);dn.forEach(n=>{["add","merge","update"].forEach(i=>{const t=n.name(i),e=i==="add"?Ri:fn;n.generateKey?W.prototype[t]=function(r,a,o){return e(this,t,!0,(n.type||this.type)==="undirected",null,r,a,o,i==="update")}:W.prototype[t]=function(r,a,o,s){return e(this,t,!1,(n.type||this.type)==="undirected",r,a,o,s,i==="update")}})});Er(W);Gr(W);Kr(W);rn(W);class Ai extends W{constructor(i){const t=Z({type:"directed"},i);if("multi"in t&&t.multi!==!1)throw new x("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new x('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class ki extends W{constructor(i){const t=Z({type:"undirected"},i);if("multi"in t&&t.multi!==!1)throw new x("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new x('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class xi extends W{constructor(i){const t=Z({multi:!0},i);if("multi"in t&&t.multi!==!0)throw new x("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class Di extends W{constructor(i){const t=Z({type:"directed",multi:!0},i);if("multi"in t&&t.multi!==!0)throw new x("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new x('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Li extends W{constructor(i){const t=Z({type:"undirected",multi:!0},i);if("multi"in t&&t.multi!==!0)throw new x("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new x('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Fe(n){n.from=function(i,t){const e=Z({},i.options,t),r=new n(e);return r.import(i),r}}Fe(W);Fe(Ai);Fe(ki);Fe(xi);Fe(Di);Fe(Li);W.Graph=W;W.DirectedGraph=Ai;W.UndirectedGraph=ki;W.MultiGraph=xi;W.MultiDirectedGraph=Di;W.MultiUndirectedGraph=Li;W.InvalidArgumentsGraphError=x;W.NotFoundGraphError=k;W.UsageGraphError=I;function gn(n,i){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var e=t.call(n,i);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function We(n){var i=gn(n,"string");return typeof i=="symbol"?i:i+""}function Q(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")}function Bt(n,i){for(var t=0;tn.length)&&(i=n.length);for(var t=0,e=Array(i);t0&&(P=_[0]),P instanceof Error)throw P;var j=new Error("Unhandled error."+(P?" ("+P.message+")":""));throw j.context=P,j}var z=F[v];if(z===void 0)return!1;if(typeof z=="function")i(z,this,_);else for(var f=z.length,K=b(z,f),S=0;S0&&P.length>G&&!P.warned){P.warned=!0;var j=new Error("Possible EventEmitter memory leak detected. "+P.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");j.name="MaxListenersExceededWarning",j.emitter=m,j.type=v,j.count=P.length,e(j)}return m}a.prototype.addListener=function(v,_){return h(this,v,_,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(v,_){return h(this,v,_,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(m,v,_){var S={fired:!1,wrapFn:void 0,target:m,type:v,listener:_},G=d.bind(S);return G.listener=_,S.wrapFn=G,G}a.prototype.once=function(v,_){return s(_),this.on(v,l(this,v,_)),this},a.prototype.prependOnceListener=function(v,_){return s(_),this.prependListener(v,l(this,v,_)),this},a.prototype.removeListener=function(v,_){var S,G,F,P,j;if(s(_),G=this._events,G===void 0)return this;if(S=G[v],S===void 0)return this;if(S===_||S.listener===_)--this._eventsCount===0?this._events=Object.create(null):(delete G[v],G.removeListener&&this.emit("removeListener",v,S.listener||_));else if(typeof S!="function"){for(F=-1,P=S.length-1;P>=0;P--)if(S[P]===_||S[P].listener===_){j=S[P].listener,F=P;break}if(F<0)return this;F===0?S.shift():w(S,F),S.length===1&&(G[v]=S[0]),G.removeListener!==void 0&&this.emit("removeListener",v,j||_)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(v){var _,S,G;if(S=this._events,S===void 0)return this;if(S.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):S[v]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete S[v]),this;if(arguments.length===0){var F=Object.keys(S),P;for(G=0;G=0;G--)this.removeListener(v,_[G]);return this};function c(m,v,_){var S=m._events;if(S===void 0)return[];var G=S[v];return G===void 0?[]:typeof G=="function"?_?[G.listener||G]:[G]:_?C(G):b(G,G.length)}a.prototype.listeners=function(v){return c(this,v,!0)},a.prototype.rawListeners=function(v){return c(this,v,!1)},a.listenerCount=function(m,v){return typeof m.listenerCount=="function"?m.listenerCount(v):g.call(m,v)},a.prototype.listenerCount=g;function g(m){var v=this._events;if(v!==void 0){var _=v[m];if(typeof _=="function")return 1;if(_!==void 0)return _.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function b(m,v){for(var _=new Array(v),S=0;Sn++}function me(){const n=arguments;let i=null,t=-1;return{[Symbol.iterator](){return this},next(){let e=null;do{if(i===null){if(t++,t>=n.length)return{done:!0};i=n[t][Symbol.iterator]()}if(e=i.next(),e.done){i=null;continue}break}while(!0);return e}}}function Le(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class kt extends Error{constructor(i){super(),this.name="GraphError",this.message=i}}class x extends kt{constructor(i){super(i),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,x.prototype.constructor)}}class k extends kt{constructor(i){super(i),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,k.prototype.constructor)}}class I extends kt{constructor(i){super(i),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,I.prototype.constructor)}}function bi(n,i){this.key=n,this.attributes=i,this.clear()}bi.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function wi(n,i){this.key=n,this.attributes=i,this.clear()}wi.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Ei(n,i){this.key=n,this.attributes=i,this.clear()}Ei.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Ge(n,i,t,e,r){this.key=i,this.attributes=r,this.undirected=n,this.source=t,this.target=e}Ge.prototype.attach=function(){let n="out",i="in";this.undirected&&(n=i="undirected");const t=this.source.key,e=this.target.key;this.source[n][e]=this,!(this.undirected&&t===e)&&(this.target[i][t]=this)};Ge.prototype.attachMulti=function(){let n="out",i="in";const t=this.source.key,e=this.target.key;this.undirected&&(n=i="undirected");const r=this.source[n],a=r[e];if(typeof a>"u"){r[e]=this,this.undirected&&t===e||(this.target[i][t]=this);return}a.previous=this,this.next=a,r[e]=this,this.target[i][t]=this};Ge.prototype.detach=function(){const n=this.source.key,i=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),delete this.source[t][i],delete this.target[e][n]};Ge.prototype.detachMulti=function(){const n=this.source.key,i=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][i],delete this.target[e][n]):(this.next.previous=void 0,this.source[t][i]=this.next,this.target[e][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const _i=0,Ti=1,dr=2,Si=3;function ve(n,i,t,e,r,a,o){let s,u,h,d;if(e=""+e,t===_i){if(s=n._nodes.get(e),!s)throw new k(`Graph.${i}: could not find the "${e}" node in the graph.`);h=r,d=a}else if(t===Si){if(r=""+r,u=n._edges.get(r),!u)throw new k(`Graph.${i}: could not find the "${r}" edge in the graph.`);const l=u.source.key,c=u.target.key;if(e===l)s=u.target;else if(e===c)s=u.source;else throw new k(`Graph.${i}: the "${e}" node is not attached to the "${r}" edge (${l}, ${c}).`);h=a,d=o}else{if(u=n._edges.get(e),!u)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`);t===Ti?s=u.source:s=u.target,h=r,d=a}return[s,h,d]}function lr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);return o.attributes[s]}}function cr(n,i,t){n.prototype[i]=function(e,r){const[a]=ve(this,i,t,e,r);return a.attributes}}function fr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);return o.attributes.hasOwnProperty(s)}}function gr(n,i,t){n.prototype[i]=function(e,r,a,o){const[s,u,h]=ve(this,i,t,e,r,a,o);return s.attributes[u]=h,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function pr(n,i,t){n.prototype[i]=function(e,r,a,o){const[s,u,h]=ve(this,i,t,e,r,a,o);if(typeof h!="function")throw new x(`Graph.${i}: updater should be a function.`);const d=s.attributes,l=h(d[u]);return d[u]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function mr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}function vr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);if(!J(s))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function yr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);if(!J(s))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return Z(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}function br(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);if(typeof s!="function")throw new x(`Graph.${i}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const wr=[{name:n=>`get${n}Attribute`,attacher:lr},{name:n=>`get${n}Attributes`,attacher:cr},{name:n=>`has${n}Attribute`,attacher:fr},{name:n=>`set${n}Attribute`,attacher:gr},{name:n=>`update${n}Attribute`,attacher:pr},{name:n=>`remove${n}Attribute`,attacher:mr},{name:n=>`replace${n}Attributes`,attacher:vr},{name:n=>`merge${n}Attributes`,attacher:yr},{name:n=>`update${n}Attributes`,attacher:br}];function Er(n){wr.forEach(function({name:i,attacher:t}){t(n,i("Node"),_i),t(n,i("Source"),Ti),t(n,i("Target"),dr),t(n,i("Opposite"),Si)})}function _r(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]}}function Tr(n,i,t){n.prototype[i]=function(e){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+e,o=""+arguments[1];if(r=oe(this,a,o,t),!r)throw new k(`Graph.${i}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,r=this._edges.get(e),!r)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function Sr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(r)}}function Cr(n,i,t){n.prototype[i]=function(e,r,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=oe(this,s,u,t),!o)throw new k(`Graph.${i}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return o.attributes[r]=a,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Rr(n,i,t){n.prototype[i]=function(e,r,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=oe(this,s,u,t),!o)throw new k(`Graph.${i}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof a!="function")throw new x(`Graph.${i}: updater should be a function.`);return o.attributes[r]=a(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Ar(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return delete a.attributes[r],this.emit("edgeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:r}),this}}function kr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return a.attributes=r,this.emit("edgeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function xr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return Z(a.attributes,r),this.emit("edgeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:r}),this}}function Dr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof r!="function")throw new x(`Graph.${i}: provided updater is not a function.`);return a.attributes=r(a.attributes),this.emit("edgeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const Lr=[{name:n=>`get${n}Attribute`,attacher:_r},{name:n=>`get${n}Attributes`,attacher:Tr},{name:n=>`has${n}Attribute`,attacher:Sr},{name:n=>`set${n}Attribute`,attacher:Cr},{name:n=>`update${n}Attribute`,attacher:Rr},{name:n=>`remove${n}Attribute`,attacher:Ar},{name:n=>`replace${n}Attributes`,attacher:kr},{name:n=>`merge${n}Attributes`,attacher:xr},{name:n=>`update${n}Attributes`,attacher:Dr}];function Gr(n){Lr.forEach(function({name:i,attacher:t}){t(n,i("Edge"),"mixed"),t(n,i("DirectedEdge"),"directed"),t(n,i("UndirectedEdge"),"undirected")})}const Fr=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Nr(n,i,t,e){let r=!1;for(const a in i){if(a===e)continue;const o=i[a];if(r=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&r)return o.key}}function Pr(n,i,t,e){let r,a,o,s=!1;for(const u in i)if(u!==e){r=i[u];do{if(a=r.source,o=r.target,s=t(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected),n&&s)return r.key;r=r.next}while(r!==void 0)}}function ht(n,i){const t=Object.keys(n),e=t.length;let r,a=0;return{[Symbol.iterator](){return this},next(){do if(r)r=r.next;else{if(a>=e)return{done:!0};const o=t[a++];if(o===i){r=void 0;continue}r=n[o]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}}}}function Ir(n,i,t,e){const r=i[t];if(!r)return;const a=r.source,o=r.target;if(e(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected)&&n)return r.key}function Or(n,i,t,e){let r=i[t];if(!r)return;let a=!1;do{if(a=e(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),n&&a)return r.key;r=r.next}while(r!==void 0)}function dt(n,i){let t=n[i];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const r={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:r}}};let e=!1;return{[Symbol.iterator](){return this},next(){return e===!0?{done:!0}:(e=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function Ur(n,i){if(n.size===0)return[];if(i==="mixed"||i===n.type)return Array.from(n._edges.keys());const t=i==="undirected"?n.undirectedSize:n.directedSize,e=new Array(t),r=i==="undirected",a=n._edges.values();let o=0,s,u;for(;s=a.next(),s.done!==!0;)u=s.value,u.undirected===r&&(e[o++]=u.key);return e}function Ci(n,i,t,e){if(i.size===0)return;const r=t!=="mixed"&&t!==i.type,a=t==="undirected";let o,s,u=!1;const h=i._edges.values();for(;o=h.next(),o.done!==!0;){if(s=o.value,r&&s.undirected!==a)continue;const{key:d,attributes:l,source:c,target:g}=s;if(u=e(d,l,c.key,g.key,c.attributes,g.attributes,s.undirected),n&&u)return d}}function zr(n,i){if(n.size===0)return Le();const t=i!=="mixed"&&i!==n.type,e=i==="undirected",r=n._edges.values();return{[Symbol.iterator](){return this},next(){let a,o;for(;;){if(a=r.next(),a.done)return a;if(o=a.value,!(t&&o.undirected!==e))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}}}}function xt(n,i,t,e,r,a){const o=i?Pr:Nr;let s;if(t!=="undirected"&&(e!=="out"&&(s=o(n,r.in,a),n&&s)||e!=="in"&&(s=o(n,r.out,a,e?void 0:r.key),n&&s))||t!=="directed"&&(s=o(n,r.undirected,a),n&&s))return s}function $r(n,i,t,e){const r=[];return xt(!1,n,i,t,e,function(a){r.push(a)}),r}function Br(n,i,t){let e=Le();return n!=="undirected"&&(i!=="out"&&typeof t.in<"u"&&(e=me(e,ht(t.in))),i!=="in"&&typeof t.out<"u"&&(e=me(e,ht(t.out,i?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(e=me(e,ht(t.undirected))),e}function Dt(n,i,t,e,r,a,o){const s=t?Or:Ir;let u;if(i!=="undirected"&&(typeof r.in<"u"&&e!=="out"&&(u=s(n,r.in,a,o),n&&u)||typeof r.out<"u"&&e!=="in"&&(e||r.key!==a)&&(u=s(n,r.out,a,o),n&&u))||i!=="directed"&&typeof r.undirected<"u"&&(u=s(n,r.undirected,a,o),n&&u))return u}function Mr(n,i,t,e,r){const a=[];return Dt(!1,n,i,t,e,r,function(o){a.push(o)}),a}function Hr(n,i,t,e){let r=Le();return n!=="undirected"&&(typeof t.in<"u"&&i!=="out"&&e in t.in&&(r=me(r,dt(t.in,e))),typeof t.out<"u"&&i!=="in"&&e in t.out&&(i||t.key!==e)&&(r=me(r,dt(t.out,e)))),n!=="directed"&&typeof t.undirected<"u"&&e in t.undirected&&(r=me(r,dt(t.undirected,e))),r}function Wr(n,i){const{name:t,type:e,direction:r}=i;n.prototype[t]=function(a,o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];if(!arguments.length)return Ur(this,e);if(arguments.length===1){a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new k(`Graph.${t}: could not find the "${a}" node in the graph.`);return $r(this.multi,e==="mixed"?this.type:e,r,s)}if(arguments.length===2){a=""+a,o=""+o;const s=this._nodes.get(a);if(!s)throw new k(`Graph.${t}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new k(`Graph.${t}: could not find the "${o}" target node in the graph.`);return Mr(e,this.multi,r,s,o)}throw new x(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function jr(n,i){const{name:t,type:e,direction:r}=i,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d,l){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){if(arguments.length===1)return l=h,Ci(!1,this,e,l);if(arguments.length===2){h=""+h,l=d;const c=this._nodes.get(h);if(typeof c>"u")throw new k(`Graph.${a}: could not find the "${h}" node in the graph.`);return xt(!1,this.multi,e==="mixed"?this.type:e,r,c,l)}if(arguments.length===3){h=""+h,d=""+d;const c=this._nodes.get(h);if(!c)throw new k(`Graph.${a}: could not find the "${h}" source node in the graph.`);if(!this._nodes.has(d))throw new k(`Graph.${a}: could not find the "${d}" target node in the graph.`);return Dt(!1,e,this.multi,r,c,d,l)}throw new x(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop();let l;if(h.length===0){let c=0;e!=="directed"&&(c+=this.undirectedSize),e!=="undirected"&&(c+=this.directedSize),l=new Array(c);let g=0;h.push((b,w,C,D,T,A,m)=>{l[g++]=d(b,w,C,D,T,A,m)})}else l=[],h.push((c,g,b,w,C,D,T)=>{l.push(d(c,g,b,w,C,D,T))});return this[a].apply(this,h),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop(),l=[];return h.push((c,g,b,w,C,D,T)=>{d(c,g,b,w,C,D,T)&&l.push(c)}),this[a].apply(this,h),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(){let h=Array.prototype.slice.call(arguments);if(h.length<2||h.length>4)throw new x(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${h.length}).`);if(typeof h[h.length-1]=="function"&&typeof h[h.length-2]!="function")throw new x(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let d,l;h.length===2?(d=h[0],l=h[1],h=[]):h.length===3?(d=h[1],l=h[2],h=[h[0]]):h.length===4&&(d=h[2],l=h[3],h=[h[0],h[1]]);let c=l;return h.push((g,b,w,C,D,T,A)=>{c=d(c,g,b,w,C,D,T,A)}),this[a].apply(this,h),c}}function Vr(n,i){const{name:t,type:e,direction:r}=i,a="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(u,h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return!1;if(arguments.length===1)return d=u,Ci(!0,this,e,d);if(arguments.length===2){u=""+u,d=h;const l=this._nodes.get(u);if(typeof l>"u")throw new k(`Graph.${a}: could not find the "${u}" node in the graph.`);return xt(!0,this.multi,e==="mixed"?this.type:e,r,l,d)}if(arguments.length===3){u=""+u,h=""+h;const l=this._nodes.get(u);if(!l)throw new k(`Graph.${a}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(h))throw new k(`Graph.${a}: could not find the "${h}" target node in the graph.`);return Dt(!0,e,this.multi,r,l,h,d)}throw new x(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,g,b,w,C,D)=>h(l,c,g,b,w,C,D)),!!this[a].apply(this,u)};const s="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,g,b,w,C,D)=>!h(l,c,g,b,w,C,D)),!this[a].apply(this,u)}}function qr(n,i){const{name:t,type:e,direction:r}=i,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o,s){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Le();if(!arguments.length)return zr(this,e);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new k(`Graph.${a}: could not find the "${o}" node in the graph.`);return Br(e,r,u)}if(arguments.length===2){o=""+o,s=""+s;const u=this._nodes.get(o);if(!u)throw new k(`Graph.${a}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new k(`Graph.${a}: could not find the "${s}" target node in the graph.`);return Hr(e,r,u,s)}throw new x(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Kr(n){Fr.forEach(i=>{Wr(n,i),jr(n,i),Vr(n,i),qr(n,i)})}const Yr=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function ot(){this.A=null,this.B=null}ot.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};ot.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function Oe(n,i,t,e,r){for(const a in e){const o=e[a],s=o.source,u=o.target,h=s===t?u:s;if(i&&i.has(h.key))continue;const d=r(h.key,h.attributes);if(n&&d)return h.key}}function Lt(n,i,t,e,r){if(i!=="mixed"){if(i==="undirected")return Oe(n,null,e,e.undirected,r);if(typeof t=="string")return Oe(n,null,e,e[t],r)}const a=new ot;let o;if(i!=="undirected"){if(t!=="out"){if(o=Oe(n,null,e,e.in,r),n&&o)return o;a.wrap(e.in)}if(t!=="in"){if(o=Oe(n,a,e,e.out,r),n&&o)return o;a.wrap(e.out)}}if(i!=="directed"&&(o=Oe(n,a,e,e.undirected,r),n&&o))return o}function Zr(n,i,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof i=="string")return Object.keys(t[i])}const e=[];return Lt(!1,n,i,t,function(r){e.push(r)}),e}function Ue(n,i,t){const e=Object.keys(t),r=e.length;let a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=r)return n&&n.wrap(t),{done:!0};const s=t[e[a++]],u=s.source,h=s.target;if(o=u===i?h:u,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function Xr(n,i,t){if(n!=="mixed"){if(n==="undirected")return Ue(null,t,t.undirected);if(typeof i=="string")return Ue(null,t,t[i])}let e=Le();const r=new ot;return n!=="undirected"&&(i!=="out"&&(e=me(e,Ue(r,t,t.in))),i!=="in"&&(e=me(e,Ue(r,t,t.out)))),n!=="directed"&&(e=me(e,Ue(r,t,t.undirected))),e}function Jr(n,i){const{name:t,type:e,direction:r}=i;n.prototype[t]=function(a){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new k(`Graph.${t}: could not find the "${a}" node in the graph.`);return Zr(e==="mixed"?this.type:e,r,o)}}function Qr(n,i){const{name:t,type:e,direction:r}=i,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new k(`Graph.${a}: could not find the "${h}" node in the graph.`);Lt(!1,e==="mixed"?this.type:e,r,l,d)};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(h,d){const l=[];return this[a](h,(c,g)=>{l.push(d(c,g))}),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(h,d){const l=[];return this[a](h,(c,g)=>{d(c,g)&&l.push(c)}),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(h,d,l){if(arguments.length<3)throw new x(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let c=l;return this[a](h,(g,b)=>{c=d(c,g,b)}),c}}function en(n,i){const{name:t,type:e,direction:r}=i,a=t[0].toUpperCase()+t.slice(1,-1),o="find"+a;n.prototype[o]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new k(`Graph.${o}: could not find the "${h}" node in the graph.`);return Lt(!0,e==="mixed"?this.type:e,r,l,d)};const s="some"+a;n.prototype[s]=function(h,d){return!!this[o](h,d)};const u="every"+a;n.prototype[u]=function(h,d){return!this[o](h,(c,g)=>!d(c,g))}}function tn(n,i){const{name:t,type:e,direction:r}=i,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Le();o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new k(`Graph.${a}: could not find the "${o}" node in the graph.`);return Xr(e==="mixed"?this.type:e,r,s)}}function rn(n){Yr.forEach(i=>{Jr(n,i),Qr(n,i),en(n,i),tn(n,i)})}function et(n,i,t,e,r){const a=e._nodes.values(),o=e.type;let s,u,h,d,l,c;for(;s=a.next(),s.done!==!0;){let g=!1;if(u=s.value,o!=="undirected"){d=u.out;for(h in d){l=d[h];do c=l.target,g=!0,r(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}if(o!=="directed"){d=u.undirected;for(h in d)if(!(i&&u.key>h)){l=d[h];do c=l.target,c.key!==h&&(c=l.source),g=!0,r(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}t&&!g&&r(u.key,null,u.attributes,null,null,null,null)}}function nn(n,i){const t={key:n};return yi(i.attributes)||(t.attributes=Z({},i.attributes)),t}function an(n,i,t){const e={key:i,source:t.source.key,target:t.target.key};return yi(t.attributes)||(e.attributes=Z({},t.attributes)),n==="mixed"&&t.undirected&&(e.undirected=!0),e}function on(n){if(!J(n))throw new x('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new x("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new x("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function sn(n){if(!J(n))throw new x('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new x("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new x("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new x("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new x("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const un=hr(),hn=new Set(["directed","undirected","mixed"]),zt=new Set(["domain","_events","_eventsCount","_maxListeners"]),dn=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],ln={allowSelfLoops:!0,multi:!1,type:"mixed"};function cn(n,i,t){if(t&&!J(t))throw new x(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(i=""+i,t=t||{},n._nodes.has(i))throw new I(`Graph.addNode: the "${i}" node already exist in the graph.`);const e=new n.NodeDataClass(i,t);return n._nodes.set(i,e),n.emit("nodeAdded",{key:i,attributes:t}),e}function $t(n,i,t){const e=new n.NodeDataClass(i,t);return n._nodes.set(i,e),n.emit("nodeAdded",{key:i,attributes:t}),e}function Ri(n,i,t,e,r,a,o,s){if(!e&&n.type==="undirected")throw new I(`Graph.${i}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new I(`Graph.${i}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!J(s))throw new x(`Graph.${i}: invalid attributes. Expecting an object but got "${s}"`);if(a=""+a,o=""+o,s=s||{},!n.allowSelfLoops&&a===o)throw new I(`Graph.${i}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=n._nodes.get(a),h=n._nodes.get(o);if(!u)throw new k(`Graph.${i}: source node "${a}" not found.`);if(!h)throw new k(`Graph.${i}: target node "${o}" not found.`);const d={key:null,undirected:e,source:a,target:o,attributes:s};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new I(`Graph.${i}: the "${r}" edge already exists in the graph.`);if(!n.multi&&(e?typeof u.undirected[o]<"u":typeof u.out[o]<"u"))throw new I(`Graph.${i}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const l=new Ge(e,r,u,h,s);n._edges.set(r,l);const c=a===o;return e?(u.undirectedDegree++,h.undirectedDegree++,c&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,c&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?l.attachMulti():l.attach(),e?n._undirectedSize++:n._directedSize++,d.key=r,n.emit("edgeAdded",d),r}function fn(n,i,t,e,r,a,o,s,u){if(!e&&n.type==="undirected")throw new I(`Graph.${i}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new I(`Graph.${i}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(u){if(typeof s!="function")throw new x(`Graph.${i}: invalid updater function. Expecting a function but got "${s}"`)}else if(!J(s))throw new x(`Graph.${i}: invalid attributes. Expecting an object but got "${s}"`)}a=""+a,o=""+o;let h;if(u&&(h=s,s=void 0),!n.allowSelfLoops&&a===o)throw new I(`Graph.${i}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=n._nodes.get(a),l=n._nodes.get(o),c,g;if(!t&&(c=n._edges.get(r),c)){if((c.source.key!==a||c.target.key!==o)&&(!e||c.source.key!==o||c.target.key!==a))throw new I(`Graph.${i}: inconsistency detected when attempting to merge the "${r}" edge with "${a}" source & "${o}" target vs. ("${c.source.key}", "${c.target.key}").`);g=c}if(!g&&!n.multi&&d&&(g=e?d.undirected[o]:d.out[o]),g){const T=[g.key,!1,!1,!1];if(u?!h:!s)return T;if(u){const A=g.attributes;g.attributes=h(A),n.emit("edgeAttributesUpdated",{type:"replace",key:g.key,attributes:g.attributes})}else Z(g.attributes,s),n.emit("edgeAttributesUpdated",{type:"merge",key:g.key,attributes:g.attributes,data:s});return T}s=s||{},u&&h&&(s=h(s));const b={key:null,undirected:e,source:a,target:o,attributes:s};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new I(`Graph.${i}: the "${r}" edge already exists in the graph.`);let w=!1,C=!1;d||(d=$t(n,a,{}),w=!0,a===o&&(l=d,C=!0)),l||(l=$t(n,o,{}),C=!0),c=new Ge(e,r,d,l,s),n._edges.set(r,c);const D=a===o;return e?(d.undirectedDegree++,l.undirectedDegree++,D&&(d.undirectedLoops++,n._undirectedSelfLoopCount++)):(d.outDegree++,l.inDegree++,D&&(d.directedLoops++,n._directedSelfLoopCount++)),n.multi?c.attachMulti():c.attach(),e?n._undirectedSize++:n._directedSize++,b.key=r,n.emit("edgeAdded",b),[r,!0,w,C]}function Ae(n,i){n._edges.delete(i.key);const{source:t,target:e,attributes:r}=i,a=i.undirected,o=t===e;a?(t.undirectedDegree--,e.undirectedDegree--,o&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,e.inDegree--,o&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?i.detachMulti():i.detach(),a?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:i.key,attributes:r,source:t.key,target:e.key,undirected:a})}class W extends vi.EventEmitter{constructor(i){if(super(),i=Z({},ln,i),typeof i.multi!="boolean")throw new x(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${i.multi}".`);if(!hn.has(i.type))throw new x(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${i.type}".`);if(typeof i.allowSelfLoops!="boolean")throw new x(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${i.allowSelfLoops}".`);const t=i.type==="mixed"?bi:i.type==="directed"?wi:Ei;ae(this,"NodeDataClass",t);const e="geid_"+un()+"_";let r=0;const a=()=>{let o;do o=e+r++;while(this._edges.has(o));return o};ae(this,"_attributes",{}),ae(this,"_nodes",new Map),ae(this,"_edges",new Map),ae(this,"_directedSize",0),ae(this,"_undirectedSize",0),ae(this,"_directedSelfLoopCount",0),ae(this,"_undirectedSelfLoopCount",0),ae(this,"_edgeKeyGenerator",a),ae(this,"_options",i),zt.forEach(o=>ae(this,o,this[o])),he(this,"order",()=>this._nodes.size),he(this,"size",()=>this._edges.size),he(this,"directedSize",()=>this._directedSize),he(this,"undirectedSize",()=>this._undirectedSize),he(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),he(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),he(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),he(this,"multi",this._options.multi),he(this,"type",this._options.type),he(this,"allowSelfLoops",this._options.allowSelfLoops),he(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(i){return this._nodes.has(""+i)}hasDirectedEdge(i,t){if(this.type==="undirected")return!1;if(arguments.length===1){const e=""+i,r=this._edges.get(e);return!!r&&!r.undirected}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?e.out.hasOwnProperty(t):!1}throw new x(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(i,t){if(this.type==="directed")return!1;if(arguments.length===1){const e=""+i,r=this._edges.get(e);return!!r&&r.undirected}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?e.undirected.hasOwnProperty(t):!1}throw new x(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(i,t){if(arguments.length===1){const e=""+i;return this._edges.has(e)}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?typeof e.out<"u"&&e.out.hasOwnProperty(t)||typeof e.undirected<"u"&&e.undirected.hasOwnProperty(t):!1}throw new x(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(i,t){if(this.type==="undirected")return;if(i=""+i,t=""+t,this.multi)throw new I("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const e=this._nodes.get(i);if(!e)throw new k(`Graph.directedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const r=e.out&&e.out[t]||void 0;if(r)return r.key}undirectedEdge(i,t){if(this.type==="directed")return;if(i=""+i,t=""+t,this.multi)throw new I("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const e=this._nodes.get(i);if(!e)throw new k(`Graph.undirectedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const r=e.undirected&&e.undirected[t]||void 0;if(r)return r.key}edge(i,t){if(this.multi)throw new I("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.edge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`Graph.edge: could not find the "${t}" target node in the graph.`);const r=e.out&&e.out[t]||e.undirected&&e.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areDirectedNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.in||t in e.out}areOutNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areOutNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.out}areInNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areInNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.in}areUndirectedNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areUndirectedNeighbors: could not find the "${i}" node in the graph.`);return this.type==="directed"?!1:t in e.undirected}areNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&(t in e.in||t in e.out)||this.type!=="directed"&&t in e.undirected}areInboundNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areInboundNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&t in e.in||this.type!=="directed"&&t in e.undirected}areOutboundNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areOutboundNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&t in e.out||this.type!=="directed"&&t in e.undirected}inDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.directedDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.undirectedDegree: could not find the "${i}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inboundDegree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree),e}outboundDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outboundDegree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.outDegree),e}degree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.degree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree),e}inDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.directedDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree,r+=t.directedLoops),e-r}outboundDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.outDegree,r+=t.directedLoops),e-r}degreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.degreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree,r+=t.directedLoops*2),e-r}source(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.source: could not find the "${i}" edge in the graph.`);return t.source.key}target(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.target: could not find the "${i}" edge in the graph.`);return t.target.key}extremities(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.extremities: could not find the "${i}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(i,t){i=""+i,t=""+t;const e=this._edges.get(t);if(!e)throw new k(`Graph.opposite: could not find the "${t}" edge in the graph.`);const r=e.source.key,a=e.target.key;if(i===r)return a;if(i===a)return r;throw new k(`Graph.opposite: the "${i}" node is not attached to the "${t}" edge (${r}, ${a}).`)}hasExtremity(i,t){i=""+i,t=""+t;const e=this._edges.get(i);if(!e)throw new k(`Graph.hasExtremity: could not find the "${i}" edge in the graph.`);return e.source.key===t||e.target.key===t}isUndirected(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.isUndirected: could not find the "${i}" edge in the graph.`);return t.undirected}isDirected(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.isDirected: could not find the "${i}" edge in the graph.`);return!t.undirected}isSelfLoop(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.isSelfLoop: could not find the "${i}" edge in the graph.`);return t.source===t.target}addNode(i,t){return cn(this,i,t).key}mergeNode(i,t){if(t&&!J(t))throw new x(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);i=""+i,t=t||{};let e=this._nodes.get(i);return e?(t&&(Z(e.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:i,attributes:e.attributes,data:t})),[i,!1]):(e=new this.NodeDataClass(i,t),this._nodes.set(i,e),this.emit("nodeAdded",{key:i,attributes:t}),[i,!0])}updateNode(i,t){if(t&&typeof t!="function")throw new x(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);i=""+i;let e=this._nodes.get(i);if(e){if(t){const a=e.attributes;e.attributes=t(a),this.emit("nodeAttributesUpdated",{type:"replace",key:i,attributes:e.attributes})}return[i,!1]}const r=t?t({}):{};return e=new this.NodeDataClass(i,r),this._nodes.set(i,e),this.emit("nodeAdded",{key:i,attributes:r}),[i,!0]}dropNode(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.dropNode: could not find the "${i}" node in the graph.`);let e;if(this.type!=="undirected"){for(const r in t.out){e=t.out[r];do Ae(this,e),e=e.next;while(e)}for(const r in t.in){e=t.in[r];do Ae(this,e),e=e.next;while(e)}}if(this.type!=="directed")for(const r in t.undirected){e=t.undirected[r];do Ae(this,e),e=e.next;while(e)}this._nodes.delete(i),this.emit("nodeDropped",{key:i,attributes:t.attributes})}dropEdge(i){let t;if(arguments.length>1){const e=""+arguments[0],r=""+arguments[1];if(t=oe(this,e,r,this.type),!t)throw new k(`Graph.dropEdge: could not find the "${e}" -> "${r}" edge in the graph.`)}else if(i=""+i,t=this._edges.get(i),!t)throw new k(`Graph.dropEdge: could not find the "${i}" edge in the graph.`);return Ae(this,t),this}dropDirectedEdge(i,t){if(arguments.length<2)throw new I("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");i=""+i,t=""+t;const e=oe(this,i,t,"directed");if(!e)throw new k(`Graph.dropDirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return Ae(this,e),this}dropUndirectedEdge(i,t){if(arguments.length<2)throw new I("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const e=oe(this,i,t,"undirected");if(!e)throw new k(`Graph.dropUndirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return Ae(this,e),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const i=this._nodes.values();let t;for(;t=i.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(i){return this._attributes[i]}getAttributes(){return this._attributes}hasAttribute(i){return this._attributes.hasOwnProperty(i)}setAttribute(i,t){return this._attributes[i]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:i}),this}updateAttribute(i,t){if(typeof t!="function")throw new x("Graph.updateAttribute: updater should be a function.");const e=this._attributes[i];return this._attributes[i]=t(e),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:i}),this}removeAttribute(i){return delete this._attributes[i],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:i}),this}replaceAttributes(i){if(!J(i))throw new x("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=i,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(i){if(!J(i))throw new x("Graph.mergeAttributes: provided attributes are not a plain object.");return Z(this._attributes,i),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:i}),this}updateAttributes(i){if(typeof i!="function")throw new x("Graph.updateAttributes: provided updater is not a function.");return this._attributes=i(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(i,t){if(typeof i!="function")throw new x("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!Ut(t))throw new x("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._nodes.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,a.attributes=i(a.key,a.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(i,t){if(typeof i!="function")throw new x("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!Ut(t))throw new x("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._edges.values();let r,a,o,s;for(;r=e.next(),r.done!==!0;)a=r.value,o=a.source,s=a.target,a.attributes=i(a.key,a.attributes,o.key,s.key,o.attributes,s.attributes,a.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(i){if(typeof i!="function")throw new x("Graph.forEachAdjacencyEntry: expecting a callback.");et(!1,!1,!1,this,i)}forEachAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new x("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");et(!1,!1,!0,this,i)}forEachAssymetricAdjacencyEntry(i){if(typeof i!="function")throw new x("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");et(!1,!0,!1,this,i)}forEachAssymetricAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new x("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");et(!1,!0,!0,this,i)}nodes(){return Array.from(this._nodes.keys())}forEachNode(i){if(typeof i!="function")throw new x("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)r=e.value,i(r.key,r.attributes)}findNode(i){if(typeof i!="function")throw new x("Graph.findNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,i(r.key,r.attributes))return r.key}mapNodes(i){if(typeof i!="function")throw new x("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let e,r;const a=new Array(this.order);let o=0;for(;e=t.next(),e.done!==!0;)r=e.value,a[o++]=i(r.key,r.attributes);return a}someNode(i){if(typeof i!="function")throw new x("Graph.someNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,i(r.key,r.attributes))return!0;return!1}everyNode(i){if(typeof i!="function")throw new x("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,!i(r.key,r.attributes))return!1;return!0}filterNodes(i){if(typeof i!="function")throw new x("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let e,r;const a=[];for(;e=t.next(),e.done!==!0;)r=e.value,i(r.key,r.attributes)&&a.push(r.key);return a}reduceNodes(i,t){if(typeof i!="function")throw new x("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new x("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let e=t;const r=this._nodes.values();let a,o;for(;a=r.next(),a.done!==!0;)o=a.value,e=i(e,o.key,o.attributes);return e}nodeEntries(){const i=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=i.next();if(t.done)return t;const e=t.value;return{value:{node:e.key,attributes:e.attributes},done:!1}}}}export(){const i=new Array(this._nodes.size);let t=0;this._nodes.forEach((r,a)=>{i[t++]=nn(a,r)});const e=new Array(this._edges.size);return t=0,this._edges.forEach((r,a)=>{e[t++]=an(this.type,a,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:i,edges:e}}import(i,t=!1){if(i instanceof W)return i.forEachNode((u,h)=>{t?this.mergeNode(u,h):this.addNode(u,h)}),i.forEachEdge((u,h,d,l,c,g,b)=>{t?b?this.mergeUndirectedEdgeWithKey(u,d,l,h):this.mergeDirectedEdgeWithKey(u,d,l,h):b?this.addUndirectedEdgeWithKey(u,d,l,h):this.addDirectedEdgeWithKey(u,d,l,h)}),this;if(!J(i))throw new x("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(i.attributes){if(!J(i.attributes))throw new x("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(i.attributes):this.replaceAttributes(i.attributes)}let e,r,a,o,s;if(i.nodes){if(a=i.nodes,!Array.isArray(a))throw new x("Graph.import: invalid nodes. Expecting an array.");for(e=0,r=a.length;e{const a=Z({},e.attributes);e=new t.NodeDataClass(r,a),t._nodes.set(r,e)}),t}copy(i){if(i=i||{},typeof i.type=="string"&&i.type!==this.type&&i.type!=="mixed")throw new I(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${i.type}" because this would mean losing information about the current graph.`);if(typeof i.multi=="boolean"&&i.multi!==this.multi&&i.multi!==!0)throw new I("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof i.allowSelfLoops=="boolean"&&i.allowSelfLoops!==this.allowSelfLoops&&i.allowSelfLoops!==!0)throw new I("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(i),e=this._edges.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,Ri(t,"copy",!1,a.undirected,a.key,a.source.key,a.target.key,Z({},a.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const i={};this._nodes.forEach((a,o)=>{i[o]=a.attributes});const t={},e={};this._edges.forEach((a,o)=>{const s=a.undirected?"--":"->";let u="",h=a.source.key,d=a.target.key,l;a.undirected&&h>d&&(l=h,h=d,d=l);const c=`(${h})${s}(${d})`;o.startsWith("geid_")?this.multi&&(typeof e[c]>"u"?e[c]=0:e[c]++,u+=`${e[c]}. `):u+=`[${o}]: `,u+=c,t[u]=a.attributes});const r={};for(const a in this)this.hasOwnProperty(a)&&!zt.has(a)&&typeof this[a]!="function"&&typeof a!="symbol"&&(r[a]=this[a]);return r.attributes=this._attributes,r.nodes=i,r.edges=t,ae(r,"constructor",this.constructor),r}}typeof Symbol<"u"&&(W.prototype[Symbol.for("nodejs.util.inspect.custom")]=W.prototype.inspect);dn.forEach(n=>{["add","merge","update"].forEach(i=>{const t=n.name(i),e=i==="add"?Ri:fn;n.generateKey?W.prototype[t]=function(r,a,o){return e(this,t,!0,(n.type||this.type)==="undirected",null,r,a,o,i==="update")}:W.prototype[t]=function(r,a,o,s){return e(this,t,!1,(n.type||this.type)==="undirected",r,a,o,s,i==="update")}})});Er(W);Gr(W);Kr(W);rn(W);class Ai extends W{constructor(i){const t=Z({type:"directed"},i);if("multi"in t&&t.multi!==!1)throw new x("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new x('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class ki extends W{constructor(i){const t=Z({type:"undirected"},i);if("multi"in t&&t.multi!==!1)throw new x("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new x('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class xi extends W{constructor(i){const t=Z({multi:!0},i);if("multi"in t&&t.multi!==!0)throw new x("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class Di extends W{constructor(i){const t=Z({type:"directed",multi:!0},i);if("multi"in t&&t.multi!==!0)throw new x("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new x('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Li extends W{constructor(i){const t=Z({type:"undirected",multi:!0},i);if("multi"in t&&t.multi!==!0)throw new x("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new x('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Fe(n){n.from=function(i,t){const e=Z({},i.options,t),r=new n(e);return r.import(i),r}}Fe(W);Fe(Ai);Fe(ki);Fe(xi);Fe(Di);Fe(Li);W.Graph=W;W.DirectedGraph=Ai;W.UndirectedGraph=ki;W.MultiGraph=xi;W.MultiDirectedGraph=Di;W.MultiUndirectedGraph=Li;W.InvalidArgumentsGraphError=x;W.NotFoundGraphError=k;W.UsageGraphError=I;function gn(n,i){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var e=t.call(n,i);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function We(n){var i=gn(n,"string");return typeof i=="symbol"?i:i+""}function Q(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")}function Bt(n,i){for(var t=0;tn.length)&&(i=n.length);for(var t=0,e=Array(i);t>>16,t=(n&65280)>>>8,e=n&255,r=255,a=Pi(i,t,e,r);return ft[n]=a,a}function Mt(n,i,t,e){return t+(i<<8)+(n<<16)}function Ht(n,i,t,e,r,a){var o=Math.floor(t/a*r),s=Math.floor(n.drawingBufferHeight/a-e/a*r),u=new Uint8Array(4);n.bindFramebuffer(n.FRAMEBUFFER,i),n.readPixels(o,s,1,1,n.RGBA,n.UNSIGNED_BYTE,u);var h=De(u,4),d=h[0],l=h[1],c=h[2],g=h[3];return[d,l,c,g]}function E(n,i,t){return(i=We(i))in n?Object.defineProperty(n,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[i]=t,n}function Wt(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function L(n){for(var i=1;i0&&e.jsx(I,{penalties:s.top_penalties}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(c,{children:[e.jsx(d,{children:e.jsx(o,{children:a("health.brainMetrics")})}),e.jsx(m,{children:r?e.jsx(x,{className:"h-80 w-full"}):e.jsx(k,{width:"100%",height:320,children:e.jsxs(S,{data:n,children:[e.jsx(A,{stroke:"var(--color-border)"}),e.jsx(M,{dataKey:"metric",tick:{fill:"var(--color-muted-foreground)",fontSize:12}}),e.jsx(O,{angle:90,domain:[0,100],tick:{fill:"var(--color-muted-foreground)",fontSize:10}}),e.jsx(D,{name:a("health.radarName"),dataKey:"value",stroke:"var(--color-primary)",fill:"var(--color-primary)",fillOpacity:.2,strokeWidth:2})]})})})]}),e.jsxs(c,{children:[e.jsx(d,{children:e.jsx(o,{children:a("health.warnings")})}),e.jsx(m,{children:r?e.jsx("div",{className:"space-y-3",children:Array.from({length:4}).map((i,l)=>e.jsx(x,{className:"h-10 w-full"},l))}):e.jsxs("div",{className:"space-y-4",children:[s?.warnings&&s.warnings.length>0?e.jsx("div",{className:"space-y-2",children:s.warnings.map((i,l)=>e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border p-3",children:[e.jsx(g,{variant:i.severity==="critical"?"destructive":i.severity==="warning"?"warning":"secondary",className:"mt-0.5 shrink-0",children:i.severity}),e.jsx("span",{className:"text-sm",children:i.message})]},l))}):e.jsx("p",{className:"text-sm text-muted-foreground",children:a("health.noWarnings")}),s?.recommendations&&s.recommendations.length>0&&e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:a("health.recommendations")}),e.jsx("ul",{className:"space-y-1 text-sm",children:s.recommendations.map((i,l)=>e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"text-primary",children:"-"}),e.jsx("span",{children:i})]},l))})]})]})})]})]}),e.jsx(K,{})]})}function I({penalties:s}){const{t:r}=j();return e.jsxs(c,{className:"border-amber-500/30 bg-amber-500/5",children:[e.jsx(d,{className:"pb-3",children:e.jsxs(o,{className:"flex items-center gap-2 text-base",children:[e.jsx(C,{className:"size-5 text-amber-500"}),r("health.topPenalties")]})}),e.jsx(m,{children:e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:s.map((a,t)=>e.jsx(W,{penalty:a,rank:t+1},a.component))})})]})}function W({penalty:s,rank:r}){const{t:a}=j(),t=Math.round(s.current_score*100),n=Math.round(s.weight*100),i=s.penalty_points.toFixed(1),l=s.estimated_gain.toFixed(1),p=t>=60?"bg-amber-500":t>=30?"bg-orange-500":"bg-red-500";return e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 transition-shadow hover:shadow-md",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex size-6 items-center justify-center rounded-full bg-amber-500/15 text-xs font-bold text-amber-600",children:r}),e.jsx("h4",{className:"text-sm font-semibold capitalize",children:s.component})]}),e.jsx(g,{variant:"outline",className:"text-xs text-red-500 border-red-500/30",children:a("health.penaltyPoints",{points:i})})]}),e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:a("health.currentScore",{score:t})}),e.jsx("span",{children:a("health.weight",{weight:n})})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:`h-full rounded-full transition-all ${p}`,style:{width:`${t}%`}})})]}),e.jsxs("div",{className:"mb-3 flex items-center gap-1.5 rounded-md bg-emerald-500/10 px-2.5 py-1.5",children:[e.jsx(R,{className:"size-3.5 text-emerald-500"}),e.jsx("span",{className:"text-xs font-medium text-emerald-600",children:a("health.estimatedGain",{gain:l})})]}),e.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-muted-foreground",children:[e.jsx(E,{className:"mt-0.5 size-3 shrink-0 text-primary"}),e.jsx("span",{children:s.action})]})]})}function K(){const[s,r]=b.useState(!1),{t:a}=j();return e.jsxs(c,{children:[e.jsxs(d,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(N,{className:"size-5 text-primary"}),a("health.enrichTitle")]}),e.jsxs(w,{variant:"ghost",size:"sm",onClick:()=>r(t=>!t),"aria-label":a(s?"health.collapseTips":"health.expandTips"),children:[s?e.jsx(_,{className:"size-4"}):e.jsx(T,{className:"size-4"}),e.jsx("span",{className:"ml-1 text-xs",children:a(s?"health.less":"health.more")})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("health.enrichDesc")})]}),e.jsx(m,{children:e.jsx("div",{className:`grid grid-cols-1 gap-4 ${s?"md:grid-cols-2":"md:grid-cols-4"}`,children:H.map((t,n)=>{const i=F[n],l=G[n],p=a(`enrichment.${t}Title`),f=a(`enrichment.${t}Tips`,{returnObjects:!0});return e.jsxs("div",{className:"rounded-lg border border-border p-4 transition-shadow hover:shadow-sm",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg",style:{backgroundColor:`${l}15`},children:e.jsx(i,{className:"size-4",style:{color:l}})}),e.jsx("h3",{className:"text-sm font-semibold",children:p})]}),e.jsx("ul",{className:"space-y-2",children:(s?f:f.slice(0,2)).map((h,v)=>e.jsxs("li",{className:"flex gap-2 text-xs leading-relaxed",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-muted-foreground",children:"-"}),e.jsx("span",{className:h.startsWith("BAD:")||h.startsWith("TỆ:")?"text-destructive":h.startsWith("GOOD:")||h.startsWith("TỐT:")?"text-primary":"",children:h})]},v))})]},t)})})})]})}export{Z as default}; +import{j as e}from"./vendor-query-CqA1cBNl.js";import{r as b}from"./vendor-react-BfuodpLv.js";import{g as y,f as j,B as g,a as w}from"./index-CLb-kMYl.js";import{C as c,a as d,b as o,c as m}from"./card-DG4oK1Wy.js";import{S as x}from"./skeleton-gKUrR2fT.js";import{B as C,c as N,J as _,K as T,L as $,H as z,D as P,e as R,M as E}from"./vendor-icons-C6dhS1UE.js";import{R as k,a as S,P as A,b as M,c as O,d as D}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-ui-Qm4_4bAc.js";const F=[N,$,z,P],G=["#6366f1","#f59e0b","#059669","#06b6d4"],H=["remember","causal","diverse","train"],u={A:{color:"#059669",bg:"#05966915",variant:"success"},B:{color:"#6366f1",bg:"#6366f115",variant:"secondary"},C:{color:"#f59e0b",bg:"#f59e0b15",variant:"warning"},D:{color:"#ef4444",bg:"#ef444415",variant:"destructive"},F:{color:"#ef4444",bg:"#ef444415",variant:"destructive"}};function B(s){const r=s.charAt(0).toUpperCase();return u[r]??u.F}function Z(){const{data:s,isLoading:r}=y(),{t:a}=j(),t=s?B(s.grade):u.F,n=s?[{metric:a("health.purity"),value:s.purity_score*100},{metric:a("health.freshness"),value:s.freshness*100},{metric:a("health.connectivity"),value:s.connectivity*100},{metric:a("health.diversity"),value:s.diversity*100},{metric:a("health.consolidation"),value:s.consolidation_ratio*100},{metric:a("health.activation"),value:s.activation_efficiency*100},{metric:a("health.recall"),value:s.recall_confidence*100},{metric:a("health.orphanRate"),value:(1-s.orphan_rate)*100}]:[];return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:a("health.title")}),s&&e.jsx(g,{variant:t.variant,className:"text-lg px-3 py-1",children:s.grade})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[e.jsxs(c,{children:[e.jsx(d,{className:"pb-2",children:e.jsx(o,{className:"text-sm font-medium text-muted-foreground",children:a("health.conflictRate")})}),e.jsx(m,{children:r?e.jsx(x,{className:"h-8 w-20"}):e.jsx("p",{className:"font-mono text-2xl font-bold",children:`${((s?.conflict_rate??0)*100).toFixed(1)}%`})})]}),e.jsxs(c,{children:[e.jsx(d,{className:"pb-2",children:e.jsx(o,{className:"text-sm font-medium text-muted-foreground",children:a("health.contradictionCount")})}),e.jsx(m,{children:r?e.jsx(x,{className:"h-8 w-16"}):e.jsx("p",{className:"font-mono text-2xl font-bold",children:s?.contradiction_count??0})})]})]}),s&&s.top_penalties&&s.top_penalties.length>0&&e.jsx(I,{penalties:s.top_penalties}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(c,{children:[e.jsx(d,{children:e.jsx(o,{children:a("health.brainMetrics")})}),e.jsx(m,{children:r?e.jsx(x,{className:"h-80 w-full"}):e.jsx(k,{width:"100%",height:320,children:e.jsxs(S,{data:n,children:[e.jsx(A,{stroke:"var(--color-border)"}),e.jsx(M,{dataKey:"metric",tick:{fill:"var(--color-muted-foreground)",fontSize:12}}),e.jsx(O,{angle:90,domain:[0,100],tick:{fill:"var(--color-muted-foreground)",fontSize:10}}),e.jsx(D,{name:a("health.radarName"),dataKey:"value",stroke:"var(--color-primary)",fill:"var(--color-primary)",fillOpacity:.2,strokeWidth:2})]})})})]}),e.jsxs(c,{children:[e.jsx(d,{children:e.jsx(o,{children:a("health.warnings")})}),e.jsx(m,{children:r?e.jsx("div",{className:"space-y-3",children:Array.from({length:4}).map((i,l)=>e.jsx(x,{className:"h-10 w-full"},l))}):e.jsxs("div",{className:"space-y-4",children:[s?.warnings&&s.warnings.length>0?e.jsx("div",{className:"space-y-2",children:s.warnings.map((i,l)=>e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border p-3",children:[e.jsx(g,{variant:i.severity==="critical"?"destructive":i.severity==="warning"?"warning":"secondary",className:"mt-0.5 shrink-0",children:i.severity}),e.jsx("span",{className:"text-sm",children:i.message})]},l))}):e.jsx("p",{className:"text-sm text-muted-foreground",children:a("health.noWarnings")}),s?.recommendations&&s.recommendations.length>0&&e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:a("health.recommendations")}),e.jsx("ul",{className:"space-y-1 text-sm",children:s.recommendations.map((i,l)=>e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"text-primary",children:"-"}),e.jsx("span",{children:i})]},l))})]})]})})]})]}),e.jsx(K,{})]})}function I({penalties:s}){const{t:r}=j();return e.jsxs(c,{className:"border-amber-500/30 bg-amber-500/5",children:[e.jsx(d,{className:"pb-3",children:e.jsxs(o,{className:"flex items-center gap-2 text-base",children:[e.jsx(C,{className:"size-5 text-amber-500"}),r("health.topPenalties")]})}),e.jsx(m,{children:e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:s.map((a,t)=>e.jsx(W,{penalty:a,rank:t+1},a.component))})})]})}function W({penalty:s,rank:r}){const{t:a}=j(),t=Math.round(s.current_score*100),n=Math.round(s.weight*100),i=s.penalty_points.toFixed(1),l=s.estimated_gain.toFixed(1),p=t>=60?"bg-amber-500":t>=30?"bg-orange-500":"bg-red-500";return e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 transition-shadow hover:shadow-md",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex size-6 items-center justify-center rounded-full bg-amber-500/15 text-xs font-bold text-amber-600",children:r}),e.jsx("h4",{className:"text-sm font-semibold capitalize",children:s.component})]}),e.jsx(g,{variant:"outline",className:"text-xs text-red-500 border-red-500/30",children:a("health.penaltyPoints",{points:i})})]}),e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:a("health.currentScore",{score:t})}),e.jsx("span",{children:a("health.weight",{weight:n})})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:`h-full rounded-full transition-all ${p}`,style:{width:`${t}%`}})})]}),e.jsxs("div",{className:"mb-3 flex items-center gap-1.5 rounded-md bg-emerald-500/10 px-2.5 py-1.5",children:[e.jsx(R,{className:"size-3.5 text-emerald-500"}),e.jsx("span",{className:"text-xs font-medium text-emerald-600",children:a("health.estimatedGain",{gain:l})})]}),e.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-muted-foreground",children:[e.jsx(E,{className:"mt-0.5 size-3 shrink-0 text-primary"}),e.jsx("span",{children:s.action})]})]})}function K(){const[s,r]=b.useState(!1),{t:a}=j();return e.jsxs(c,{children:[e.jsxs(d,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(o,{className:"flex items-center gap-2",children:[e.jsx(N,{className:"size-5 text-primary"}),a("health.enrichTitle")]}),e.jsxs(w,{variant:"ghost",size:"sm",onClick:()=>r(t=>!t),"aria-label":a(s?"health.collapseTips":"health.expandTips"),children:[s?e.jsx(_,{className:"size-4"}):e.jsx(T,{className:"size-4"}),e.jsx("span",{className:"ml-1 text-xs",children:a(s?"health.less":"health.more")})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("health.enrichDesc")})]}),e.jsx(m,{children:e.jsx("div",{className:`grid grid-cols-1 gap-4 ${s?"md:grid-cols-2":"md:grid-cols-4"}`,children:H.map((t,n)=>{const i=F[n],l=G[n],p=a(`enrichment.${t}Title`),f=a(`enrichment.${t}Tips`,{returnObjects:!0});return e.jsxs("div",{className:"rounded-lg border border-border p-4 transition-shadow hover:shadow-sm",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg",style:{backgroundColor:`${l}15`},children:e.jsx(i,{className:"size-4",style:{color:l}})}),e.jsx("h3",{className:"text-sm font-semibold",children:p})]}),e.jsx("ul",{className:"space-y-2",children:(s?f:f.slice(0,2)).map((h,v)=>e.jsxs("li",{className:"flex gap-2 text-xs leading-relaxed",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-muted-foreground",children:"-"}),e.jsx("span",{className:h.startsWith("BAD:")||h.startsWith("TỆ:")?"text-destructive":h.startsWith("GOOD:")||h.startsWith("TỐT:")?"text-primary":"",children:h})]},v))})]},t)})})})]})}export{Z as default}; diff --git a/src/surreal_memory/server/static/dist/assets/OraclePage-BOi3rQAz.js b/src/surreal_memory/server/static/dist/assets/OraclePage-Crqd4SF_.js similarity index 99% rename from src/surreal_memory/server/static/dist/assets/OraclePage-BOi3rQAz.js rename to src/surreal_memory/server/static/dist/assets/OraclePage-Crqd4SF_.js index 0c7cf424..d88d6ab6 100644 --- a/src/surreal_memory/server/static/dist/assets/OraclePage-BOi3rQAz.js +++ b/src/surreal_memory/server/static/dist/assets/OraclePage-Crqd4SF_.js @@ -1 +1 @@ -import{j as s}from"./vendor-query-CqA1cBNl.js";import{r as d}from"./vendor-react-BfuodpLv.js";import{h as _,Y as F,Z as Y,_ as K,C as H,$ as G,a0 as q}from"./vendor-icons-C6dhS1UE.js";import{f as j,i as V,b as J}from"./index-DXL5wCpD.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const X=[{key:"daily",labelKey:"oracle.dailyReading",icon:_},{key:"whatif",labelKey:"oracle.whatif",icon:F},{key:"matchup",labelKey:"oracle.matchup",icon:Y}];function Z({mode:e,onModeChange:n}){const{t}=j();return s.jsx("div",{className:"flex gap-2",children:X.map(({key:r,labelKey:o,icon:a})=>s.jsxs("button",{onClick:()=>n(r),className:`flex cursor-pointer items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-all ${e===r?"bg-primary/15 text-primary ring-1 ring-primary/30":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,children:[s.jsx(a,{className:"size-4"}),t(o)]},r))})}function Q({card:e,className:n=""}){return s.jsxs("div",{className:`relative overflow-hidden rounded-2xl border border-white/10 bg-[#16140f] p-5 ${n}`,style:{backfaceVisibility:"hidden"},children:[s.jsx("div",{className:`absolute inset-0 bg-gradient-to-b ${e.suit.bg} opacity-60`}),s.jsx("div",{className:"absolute right-3 top-3 opacity-10",children:s.jsx("span",{className:"text-7xl font-bold",style:{color:e.suit.color},children:e.suit.symbol})}),s.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[s.jsx("div",{className:"mb-1 text-center",children:s.jsxs("span",{className:"text-xs font-semibold uppercase tracking-[0.2em]",style:{color:e.suit.color},children:["✦ ",e.title," ✦"]})}),s.jsx("div",{className:"my-4 flex justify-center",children:s.jsx("div",{className:"flex size-16 items-center justify-center rounded-full border-2",style:{borderColor:e.suit.color+"40",backgroundColor:e.suit.color+"15"},children:s.jsx("span",{className:"text-3xl",style:{color:e.suit.color},children:e.suit.symbol})})}),s.jsx("div",{className:"mx-auto mb-3 h-px w-3/4",style:{backgroundColor:e.suit.color+"30"}}),s.jsx("div",{className:"mb-auto flex-1",children:s.jsxs("p",{className:"line-clamp-3 text-center text-sm leading-relaxed text-white/80",children:["“",e.content,"”"]})}),s.jsxs("div",{className:"mt-4 flex items-center justify-between text-xs text-white/50",children:[s.jsxs("span",{"aria-label":`Activation ${e.activation}`,children:[s.jsx("span",{"aria-hidden":"true",children:"⚡"})," ",e.activation]}),s.jsxs("span",{"aria-label":`Connections ${e.connectionCount}`,children:[s.jsx("span",{"aria-hidden":"true",children:"🔗"})," ",e.connectionCount]}),s.jsxs("span",{"aria-label":`Age ${e.age}`,children:[s.jsx("span",{"aria-hidden":"true",children:"📅"})," ",e.age]})]}),s.jsx("div",{className:"mt-2 text-center",children:s.jsxs("span",{className:"inline-block rounded-full px-3 py-0.5 text-xs font-medium",style:{backgroundColor:e.suit.color+"20",color:e.suit.color},children:[e.suit.symbol," ",e.suitKey]})})]})]})}function ee({className:e=""}){return s.jsxs("div",{className:`relative overflow-hidden rounded-2xl border border-white/10 bg-[#16140f] ${e}`,style:{backfaceVisibility:"hidden"},children:[s.jsxs("div",{className:"absolute inset-0 opacity-30",children:[s.jsx("div",{className:"absolute inset-0",style:{background:"repeating-conic-gradient(from 0deg at 50% 50%, #818cf8 0deg 30deg, transparent 30deg 60deg)",opacity:.15}}),s.jsx("div",{className:"absolute inset-0",style:{background:"radial-gradient(circle at 50% 50%, transparent 30%, #818cf820 50%, transparent 70%)"}}),s.jsx("div",{className:"absolute inset-0",style:{background:"radial-gradient(circle at 50% 50%, #818cf815 0%, transparent 40%)"}})]}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center","aria-hidden":"true",children:s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"text-5xl font-bold opacity-20",style:{color:"#818cf8"},children:"✦"}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-2xl font-bold text-white/40",children:"?"})]})}),s.jsx("div",{className:"absolute inset-0 rounded-2xl ring-1 ring-inset ring-white/5"})]})}function B({card:e,autoFlipDelay:n,onFlip:t,className:r=""}){const[o,a]=d.useState(!1),l=d.useRef(t);l.current=t,d.useEffect(()=>{if(n!==void 0&&n>=0){const i=setTimeout(()=>{a(!0),l.current?.()},n);return()=>clearTimeout(i)}},[n]);const c=()=>{const i=!o;a(i),i&&l.current?.()};return s.jsx("div",{className:`cursor-pointer ${r}`,style:{perspective:"1000px"},onClick:c,role:"button",tabIndex:0,"aria-label":o?`Card: ${e.title} — ${e.content}`:"Tap to reveal card",onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),c())},children:s.jsxs("div",{className:"relative h-full w-full",style:{transformStyle:"preserve-3d",transform:o?"rotateY(180deg)":"rotateY(0deg)",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"600ms"},children:[s.jsx("div",{className:"absolute inset-0",style:{backfaceVisibility:"hidden"},children:s.jsx(ee,{className:"h-full w-full"})}),s.jsx("div",{className:"absolute inset-0",style:{backfaceVisibility:"hidden",transform:"rotateY(180deg)"},children:s.jsx(Q,{card:e,className:"h-full w-full"})})]})})}const b=800,C=420,m=180,w=260,I=24;function te(e,n,t,r,o,a){e.beginPath(),e.moveTo(n+a,t),e.lineTo(n+r-a,t),e.quadraticCurveTo(n+r,t,n+r,t+a),e.lineTo(n+r,t+o-a),e.quadraticCurveTo(n+r,t+o,n+r-a,t+o),e.lineTo(n+a,t+o),e.quadraticCurveTo(n,t+o,n,t+o-a),e.lineTo(n,t+a),e.quadraticCurveTo(n,t,n+a,t),e.closePath()}function ne(e,n,t,r,o){te(e,t,r,m,w,12),e.fillStyle="#1a1814",e.fill(),e.strokeStyle=n.suit.color+"40",e.lineWidth=1.5,e.stroke(),e.fillStyle="#a0a0a0",e.font="bold 10px system-ui, sans-serif",e.textAlign="center",e.fillText(o.toUpperCase(),t+m/2,r-8),e.fillStyle=n.suit.color,e.font="36px system-ui, sans-serif",e.fillText(n.suit.symbol,t+m/2,r+50),e.fillStyle=n.suit.color,e.font="bold 11px system-ui, sans-serif",e.fillText(n.title,t+m/2,r+72),e.strokeStyle=n.suit.color+"30",e.lineWidth=1,e.beginPath(),e.moveTo(t+30,r+82),e.lineTo(t+m-30,r+82),e.stroke(),e.fillStyle="#e0e0e0",e.font="12px system-ui, sans-serif";const a=m-28,l=n.content.split(" ");let c="",i=r+100;const u=5;let f=0;for(const h of l){const p=c+(c?" ":"")+h;if(e.measureText(p).width>a&&c){if(e.fillText(c,t+m/2,i),c=h,i+=16,f++,f>=u){e.fillText(c+"...",t+m/2,i);break}}else c=p}f{ne(t,u,c+f*(m+I),i,a[f])}),t.fillStyle="#606060",t.font="10px system-ui, sans-serif",t.textAlign="center",t.fillText("Surreal-Memory — surrealmemory.dev",b/2,C-10),new Promise(u=>{n.toBlob(f=>u(f),"image/png")})}async function se(e){try{const n=await W(e);return await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),!0}catch{return!1}}async function re(e){const n=await W(e),t=URL.createObjectURL(n),r=document.createElement("a");r.href=t,r.download=`oracle-${e.brainName}-${e.date}.png`,r.click(),URL.revokeObjectURL(t)}function oe({reading:e}){const{t:n}=j(),[t,r]=d.useState(!1),o=async()=>{await se(e)&&(r(!0),setTimeout(()=>r(!1),2e3))},a=()=>{re(e)};return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:o,className:"flex cursor-pointer items-center gap-1.5 rounded-lg border border-white/10 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":n("oracle.copyCard"),children:t?s.jsxs(s.Fragment,{children:[s.jsx(K,{className:"size-3.5 text-green-400"}),n("oracle.copied")]}):s.jsxs(s.Fragment,{children:[s.jsx(H,{className:"size-3.5"}),n("oracle.copyCard")]})}),s.jsxs("button",{onClick:a,className:"flex cursor-pointer items-center gap-1.5 rounded-lg border border-white/10 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":n("oracle.downloadCard"),children:[s.jsx(G,{className:"size-3.5"}),n("oracle.downloadCard")]})]})}const ae=["Your past is marked by {past} — {pastContent}. Today, {present} guides your path — {presentContent}. Tomorrow, {future} awaits — {futureContent}.","{past} shaped what came before: {pastContent}. Now {present} holds the key — {presentContent}. The future whispers of {future}: {futureContent}.","From the shadow of {past} ({pastContent}), through the lens of {present} ({presentContent}), your path leads to {future} — {futureContent}.","The memory of {past} echoes: {pastContent}. {present} illuminates the now: {presentContent}. {future} beckons ahead: {futureContent}.","Once, {past} taught you: {pastContent}. Today, {present} reveals: {presentContent}. Soon, {future} will show: {futureContent}.","{past} planted seeds — {pastContent}. {present} tends the garden — {presentContent}. {future} promises the harvest — {futureContent}."],ie=['What if {suitA} and {suitB} collided? Imagine: "{cardA}" meets "{cardB}" — and {wildcardSuit} throws in a twist: "{wildcard}"','In another timeline, {suitA} chose differently: "{cardA}". Meanwhile {suitB} discovered: "{cardB}". The catalyst? {wildcardSuit}: "{wildcard}"',`Picture this: {suitA}'s memory ("{cardA}") suddenly merges with {suitB}'s truth ("{cardB}"). {wildcardSuit} watches from the shadows: "{wildcard}"`,'Two paths diverged — {suitA} whispered "{cardA}" while {suitB} insisted "{cardB}". {wildcardSuit} appeared: "{wildcard}"','What if you had followed {suitA} ("{cardA}") instead of {suitB} ("{cardB}")? {wildcardSuit} holds the answer: "{wildcard}"','Rewind. {suitA} says: "{cardA}". Fast forward. {suitB} replies: "{cardB}". Plot twist by {wildcardSuit}: "{wildcard}"'],le=['Which memory is stronger? {suitA}: "{contentA}" vs {suitB}: "{contentB}"','{suitA} challenges {suitB}! "{contentA}" faces off against "{contentB}" — who wins?','Battle of memories: {suitA} brings "{contentA}", {suitB} counters with "{contentB}"','Your brain asks: is "{contentA}" ({suitA}) more important than "{contentB}" ({suitB})?','Memory arena: {suitA} ("{contentA}") vs {suitB} ("{contentB}") — choose wisely!'];function z(e,n){let t=0;const r=`${e}:${n}`;for(let o=0;o>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}function T(e){let n=e|0;return()=>{n=n+1831565813|0;let t=Math.imul(n^n>>>15,1|n);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function S(e,n,t){const r=[...e],o=[];for(let a=0;a0;a++){const l=Math.floor(t()*r.length);o.push(r[l]),r.splice(l,1)}return o}function M(e,n){return e.length===0?"":e[Math.floor(n()*e.length)]}function R(e,n){return Object.entries(n).reduce((t,[r,o])=>t.replaceAll(`{${r}}`,o),e)}function de(e,n,t){if(e.length<3)return null;const r=new Date().toISOString().slice(0,10),o=z(r,n),a=T(o),l=[...e].sort((A,k)=>k.activation-A.activation),c=l.slice(0,Math.max(Math.ceil(l.length*.6),3)),i=S(c,3,a);if(i.length<3)return null;const[u,f,h]=i,p=R(M(ae,a),{past:u.suit.name,present:f.suit.name,future:h.suit.name,pastContent:u.content,presentContent:f.content,futureContent:h.content});return{past:u,present:f,future:h,interpretation:p,date:r,brainName:n}}function O(e,n){if(e.length<3)return null;const t=T(n??Date.now()),r=S(e,2,t);if(r.length<2)return null;const o=e.filter(i=>!r.includes(i)),a=S(o.length>0?o:e,1,t);if(a.length===0)return null;const l=a[0],c=R(M(ie,t),{cardA:r[0].content,cardB:r[1].content,suitA:r[0].suit.name,suitB:r[1].suit.name,wildcard:l.content,wildcardSuit:l.suit.name});return{decisions:r,error:l,scenario:c}}function $(e,n=1,t=5,r=[],o){if(e.length<2)return null;const a=o??Date.now(),l=T(ce(a,n*7919)),c=e.filter(f=>!r.includes(f.id)),i=c.length>=2?c:e,u=S(i,2,l);return u.length<2?null:{cardA:u[0],cardB:u[1],round:n,score:0,totalRounds:t}}function ue(e,n,t){const r=z(e.id,n.id),o=T(r);return R(M(le,o),{suitA:e.suit.name,suitB:n.suit.name,contentA:e.content,contentB:n.content})}const L="oracle-daily-reading";function fe(){return new Date().toISOString().slice(0,10)}function me(e){try{const n=localStorage.getItem(L);if(!n)return null;const t=JSON.parse(n);return t.date===fe()&&t.brainName===e?t.reading:null}catch{return null}}function he(e){const n={date:e.date,brainName:e.brainName,reading:e};localStorage.setItem(L,JSON.stringify(n))}function pe(e,n){const[t,r]=d.useState(null);return d.useEffect(()=>{if(e.length<3){r(null);return}const o=me(n);if(o){r(o);return}const a=de(e,n);a&&(he(a),r(a))},[e,n]),t}const P=["past","present","future"];function xe({cards:e,brainName:n}){const{t}=j(),r=pe(e,n),[o,a]=d.useState(0);if(!r)return null;const l=[r.past,r.present,r.future];return s.jsxs("div",{className:"flex flex-col items-center gap-8",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:t("oracle.dailyHint")}),s.jsx("div",{className:"flex flex-wrap justify-center gap-6",children:l.map((c,i)=>s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:t(`oracle.${P[i]}`)}),s.jsx(B,{card:c,autoFlipDelay:800+i*500,onFlip:()=>a(u=>Math.max(u,i+1)),className:"h-[340px] w-[240px]"})]},P[i]))}),o>=3&&s.jsxs("div",{className:"max-w-xl animate-in fade-in slide-in-from-bottom-4 duration-700",children:[s.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-5",children:[s.jsx("p",{className:"text-center text-sm leading-relaxed text-foreground/80",children:r.interpretation}),s.jsx("p",{className:"mt-3 text-center text-xs text-muted-foreground",children:t("oracle.readingDate",{date:r.date,brain:r.brainName})})]}),s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(oe,{reading:r})})]})]})}function ge({cards:e}){const{t:n}=j(),[t,r]=d.useState(()=>O(e)),[o,a]=d.useState(!1),l=d.useRef(0),c=d.useCallback(()=>{r(O(e,Date.now())),a(!1),l.current=0},[e]),i=d.useCallback(()=>{l.current+=1,l.current>=3&&a(!0)},[]);if(!t)return null;const u=[...t.decisions,t.error];return s.jsxs("div",{className:"flex flex-col items-center gap-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:n("oracle.whatifHint")}),s.jsxs("button",{onClick:c,className:"flex cursor-pointer items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":n("oracle.reshuffle"),children:[s.jsx(F,{className:"size-3.5"}),n("oracle.reshuffle")]})]}),s.jsx("div",{className:"flex flex-wrap justify-center gap-6",children:u.map((f,h)=>s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:h<2?n("oracle.memory")+` ${h+1}`:n("oracle.wildcard")}),s.jsx(B,{card:f,onFlip:i,className:"h-[340px] w-[240px]"})]},`slot-${h}`))}),o&&s.jsx("div",{className:"max-w-2xl animate-in fade-in slide-in-from-bottom-4 duration-700",children:s.jsx("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/5 p-5",children:s.jsx("p",{className:"text-center text-sm leading-relaxed text-foreground/80 italic",children:t.scenario})})})]})}const y=5;function be(e){const n=e.activation,t=Math.min(e.connectionCount,20)/2;return n+t}function ye({cards:e}){const{t:n}=j(),[t,r]=d.useState(()=>$(e,1,y)),[o,a]=d.useState(0),[l,c]=d.useState([]),[i,u]=d.useState(null),[f,h]=d.useState(!1),p=d.useRef(null);d.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const A=d.useCallback(x=>{if(!t||i)return;u(x);const g=x==="A"?t.cardA:t.cardB,v=o+be(g),N=[...l,t.cardA.id,t.cardB.id];a(v),c(N),p.current=setTimeout(()=>{if(t.round>=y){h(!0);return}const D=$(e,t.round+1,y,N,Date.now());r(D?{...D,score:v}:null),u(null)},1200)},[t,i,o,l,e]),k=d.useCallback(()=>{p.current&&clearTimeout(p.current),r($(e,1,y)),a(0),c([]),u(null),h(!1)},[e]);if(!t)return null;const U=ue(t.cardA,t.cardB);return f?s.jsxs("div",{className:"flex flex-col items-center gap-6 animate-in fade-in duration-500",children:[s.jsx(q,{className:"size-12 text-amber-400","aria-hidden":"true"}),s.jsx("h2",{className:"font-display text-2xl font-bold",children:n("oracle.matchupComplete")}),s.jsx("p",{className:"text-4xl font-bold text-primary",children:Math.round(o)}),s.jsx("p",{className:"text-sm text-muted-foreground",children:n("oracle.matchupScoreDesc")}),s.jsx("button",{onClick:k,className:"cursor-pointer rounded-lg bg-primary px-6 py-2.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90",children:n("oracle.playAgain")})]}):s.jsxs("div",{className:"flex flex-col items-center gap-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex gap-1.5",children:Array.from({length:y},(x,g)=>s.jsx("div",{className:`size-2 rounded-full transition-colors ${g{const g=x==="A"?t.cardA:t.cardB,v=i===x,N=i!==null&&i!==x;return s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx("div",{className:`transition-all duration-500 ${v?"scale-105 ring-2 ring-primary ring-offset-2 ring-offset-background rounded-xl":N?"scale-95 opacity-40":""}`,children:s.jsx(B,{card:g,autoFlipDelay:300+(x==="B"?200:0),className:"h-[340px] w-[240px]"})}),!i&&s.jsx("button",{onClick:()=>A(x),className:"cursor-pointer rounded-lg bg-accent px-5 py-2 text-sm font-medium text-foreground transition-all hover:bg-primary hover:text-primary-foreground",children:n("oracle.choose")}),v&&s.jsx("span",{className:"text-xs font-medium text-primary animate-in fade-in",children:n("oracle.chosen")})]},`${t.round}-${x}`)})}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("oracle.score"),": ",s.jsx("span",{className:"font-mono font-bold text-foreground",children:Math.round(o)})]})]})}const E={decision:{name:"The Architect",color:"#fbbf24",symbol:"◆",bg:"from-amber-900/40 to-amber-950/60"},error:{name:"The Shadow",color:"#ef4444",symbol:"♠",bg:"from-red-900/40 to-red-950/60"},insight:{name:"The Oracle",color:"#a78bfa",symbol:"♥",bg:"from-violet-900/40 to-violet-950/60"},fact:{name:"The Scholar",color:"#60a5fa",symbol:"♣",bg:"from-blue-900/40 to-blue-950/60"},workflow:{name:"The Engineer",color:"#34d399",symbol:"★",bg:"from-emerald-900/40 to-emerald-950/60"},concept:{name:"The Dreamer",color:"#22d3ee",symbol:"○",bg:"from-cyan-900/40 to-cyan-950/60"},entity:{name:"The Keeper",color:"#f59e0b",symbol:"△",bg:"from-amber-900/40 to-orange-950/60"},pattern:{name:"The Weaver",color:"#fb7185",symbol:"◇",bg:"from-rose-900/40 to-rose-950/60"},preference:{name:"The Compass",color:"#2dd4bf",symbol:"⊕",bg:"from-teal-900/40 to-teal-950/60"}},je={name:"The Wanderer",color:"#a8a29e",symbol:"?",bg:"from-stone-900/40 to-stone-950/60"};function ve(e){return e in E?{suit:E[e],key:e}:{suit:je,key:"unknown"}}function we(e){const n=new Date(e),r=new Date().getTime()-n.getTime(),o=Math.floor(r/(1e3*60*60*24));return o===0?"today":o===1?"1d":o<30?`${o}d`:o<365?`${Math.floor(o/30)}mo`:`${Math.floor(o/365)}y`}function Ne(e,n){return n.filter(t=>t.source_id===e||t.target_id===e).length}function Ce(e,n=120){return e.length<=n?e:e.slice(0,n).trimEnd()+"..."}function Se(e,n){return e.map(t=>{const{suit:r,key:o}=ve(t.type),a=t.metadata??{},l=typeof a.activation_level=="number"?a.activation_level:.5,c=typeof a.priority=="number"?a.priority:5,i=typeof a.created_at=="string"?a.created_at:new Date().toISOString();return{id:t.id,title:r.name,content:Ce(t.content),suit:r,suitKey:o,activation:Math.round(l*100)/10,connectionCount:Ne(t.id,n),age:we(i),priority:c,createdAt:i}})}function Te(){const{data:e,isLoading:n,error:t}=V(500);return{cards:d.useMemo(()=>e?Se(e.neurons,e.synapses):[],[e]),isLoading:n,error:t}}function De(){const{t:e}=j(),[n,t]=d.useState("daily"),{cards:r,isLoading:o}=Te(),{data:a}=J(),l=a?.active_brain??"default";return o?s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:e("oracle.title")}),s.jsx("p",{className:"text-muted-foreground",children:e("oracle.loading")})]}):r.length<3?s.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-6 pt-24",children:[s.jsx(_,{className:"size-12 text-muted-foreground/40"}),s.jsx("h2",{className:"font-display text-xl font-semibold text-muted-foreground",children:e("oracle.needMore")}),s.jsx("p",{className:"max-w-md text-center text-sm text-muted-foreground/70",children:e("oracle.needMoreDesc")})]}):s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:e("oracle.title")}),s.jsx(Z,{mode:n,onModeChange:t})]}),s.jsxs("div",{className:"flex flex-col items-center gap-8",children:[n==="daily"&&s.jsx(xe,{cards:r,brainName:l}),n==="whatif"&&s.jsx(ge,{cards:r}),n==="matchup"&&s.jsx(ye,{cards:r})]})]})}export{De as default}; +import{j as s}from"./vendor-query-CqA1cBNl.js";import{r as d}from"./vendor-react-BfuodpLv.js";import{h as _,Y as F,Z as Y,_ as K,C as H,$ as G,a0 as q}from"./vendor-icons-C6dhS1UE.js";import{f as j,i as V,b as J}from"./index-CLb-kMYl.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const X=[{key:"daily",labelKey:"oracle.dailyReading",icon:_},{key:"whatif",labelKey:"oracle.whatif",icon:F},{key:"matchup",labelKey:"oracle.matchup",icon:Y}];function Z({mode:e,onModeChange:n}){const{t}=j();return s.jsx("div",{className:"flex gap-2",children:X.map(({key:r,labelKey:o,icon:a})=>s.jsxs("button",{onClick:()=>n(r),className:`flex cursor-pointer items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-all ${e===r?"bg-primary/15 text-primary ring-1 ring-primary/30":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,children:[s.jsx(a,{className:"size-4"}),t(o)]},r))})}function Q({card:e,className:n=""}){return s.jsxs("div",{className:`relative overflow-hidden rounded-2xl border border-white/10 bg-[#16140f] p-5 ${n}`,style:{backfaceVisibility:"hidden"},children:[s.jsx("div",{className:`absolute inset-0 bg-gradient-to-b ${e.suit.bg} opacity-60`}),s.jsx("div",{className:"absolute right-3 top-3 opacity-10",children:s.jsx("span",{className:"text-7xl font-bold",style:{color:e.suit.color},children:e.suit.symbol})}),s.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[s.jsx("div",{className:"mb-1 text-center",children:s.jsxs("span",{className:"text-xs font-semibold uppercase tracking-[0.2em]",style:{color:e.suit.color},children:["✦ ",e.title," ✦"]})}),s.jsx("div",{className:"my-4 flex justify-center",children:s.jsx("div",{className:"flex size-16 items-center justify-center rounded-full border-2",style:{borderColor:e.suit.color+"40",backgroundColor:e.suit.color+"15"},children:s.jsx("span",{className:"text-3xl",style:{color:e.suit.color},children:e.suit.symbol})})}),s.jsx("div",{className:"mx-auto mb-3 h-px w-3/4",style:{backgroundColor:e.suit.color+"30"}}),s.jsx("div",{className:"mb-auto flex-1",children:s.jsxs("p",{className:"line-clamp-3 text-center text-sm leading-relaxed text-white/80",children:["“",e.content,"”"]})}),s.jsxs("div",{className:"mt-4 flex items-center justify-between text-xs text-white/50",children:[s.jsxs("span",{"aria-label":`Activation ${e.activation}`,children:[s.jsx("span",{"aria-hidden":"true",children:"⚡"})," ",e.activation]}),s.jsxs("span",{"aria-label":`Connections ${e.connectionCount}`,children:[s.jsx("span",{"aria-hidden":"true",children:"🔗"})," ",e.connectionCount]}),s.jsxs("span",{"aria-label":`Age ${e.age}`,children:[s.jsx("span",{"aria-hidden":"true",children:"📅"})," ",e.age]})]}),s.jsx("div",{className:"mt-2 text-center",children:s.jsxs("span",{className:"inline-block rounded-full px-3 py-0.5 text-xs font-medium",style:{backgroundColor:e.suit.color+"20",color:e.suit.color},children:[e.suit.symbol," ",e.suitKey]})})]})]})}function ee({className:e=""}){return s.jsxs("div",{className:`relative overflow-hidden rounded-2xl border border-white/10 bg-[#16140f] ${e}`,style:{backfaceVisibility:"hidden"},children:[s.jsxs("div",{className:"absolute inset-0 opacity-30",children:[s.jsx("div",{className:"absolute inset-0",style:{background:"repeating-conic-gradient(from 0deg at 50% 50%, #818cf8 0deg 30deg, transparent 30deg 60deg)",opacity:.15}}),s.jsx("div",{className:"absolute inset-0",style:{background:"radial-gradient(circle at 50% 50%, transparent 30%, #818cf820 50%, transparent 70%)"}}),s.jsx("div",{className:"absolute inset-0",style:{background:"radial-gradient(circle at 50% 50%, #818cf815 0%, transparent 40%)"}})]}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center","aria-hidden":"true",children:s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"text-5xl font-bold opacity-20",style:{color:"#818cf8"},children:"✦"}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-2xl font-bold text-white/40",children:"?"})]})}),s.jsx("div",{className:"absolute inset-0 rounded-2xl ring-1 ring-inset ring-white/5"})]})}function B({card:e,autoFlipDelay:n,onFlip:t,className:r=""}){const[o,a]=d.useState(!1),l=d.useRef(t);l.current=t,d.useEffect(()=>{if(n!==void 0&&n>=0){const i=setTimeout(()=>{a(!0),l.current?.()},n);return()=>clearTimeout(i)}},[n]);const c=()=>{const i=!o;a(i),i&&l.current?.()};return s.jsx("div",{className:`cursor-pointer ${r}`,style:{perspective:"1000px"},onClick:c,role:"button",tabIndex:0,"aria-label":o?`Card: ${e.title} — ${e.content}`:"Tap to reveal card",onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),c())},children:s.jsxs("div",{className:"relative h-full w-full",style:{transformStyle:"preserve-3d",transform:o?"rotateY(180deg)":"rotateY(0deg)",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"600ms"},children:[s.jsx("div",{className:"absolute inset-0",style:{backfaceVisibility:"hidden"},children:s.jsx(ee,{className:"h-full w-full"})}),s.jsx("div",{className:"absolute inset-0",style:{backfaceVisibility:"hidden",transform:"rotateY(180deg)"},children:s.jsx(Q,{card:e,className:"h-full w-full"})})]})})}const b=800,C=420,m=180,w=260,I=24;function te(e,n,t,r,o,a){e.beginPath(),e.moveTo(n+a,t),e.lineTo(n+r-a,t),e.quadraticCurveTo(n+r,t,n+r,t+a),e.lineTo(n+r,t+o-a),e.quadraticCurveTo(n+r,t+o,n+r-a,t+o),e.lineTo(n+a,t+o),e.quadraticCurveTo(n,t+o,n,t+o-a),e.lineTo(n,t+a),e.quadraticCurveTo(n,t,n+a,t),e.closePath()}function ne(e,n,t,r,o){te(e,t,r,m,w,12),e.fillStyle="#1a1814",e.fill(),e.strokeStyle=n.suit.color+"40",e.lineWidth=1.5,e.stroke(),e.fillStyle="#a0a0a0",e.font="bold 10px system-ui, sans-serif",e.textAlign="center",e.fillText(o.toUpperCase(),t+m/2,r-8),e.fillStyle=n.suit.color,e.font="36px system-ui, sans-serif",e.fillText(n.suit.symbol,t+m/2,r+50),e.fillStyle=n.suit.color,e.font="bold 11px system-ui, sans-serif",e.fillText(n.title,t+m/2,r+72),e.strokeStyle=n.suit.color+"30",e.lineWidth=1,e.beginPath(),e.moveTo(t+30,r+82),e.lineTo(t+m-30,r+82),e.stroke(),e.fillStyle="#e0e0e0",e.font="12px system-ui, sans-serif";const a=m-28,l=n.content.split(" ");let c="",i=r+100;const u=5;let f=0;for(const h of l){const p=c+(c?" ":"")+h;if(e.measureText(p).width>a&&c){if(e.fillText(c,t+m/2,i),c=h,i+=16,f++,f>=u){e.fillText(c+"...",t+m/2,i);break}}else c=p}f{ne(t,u,c+f*(m+I),i,a[f])}),t.fillStyle="#606060",t.font="10px system-ui, sans-serif",t.textAlign="center",t.fillText("Surreal-Memory — surrealmemory.dev",b/2,C-10),new Promise(u=>{n.toBlob(f=>u(f),"image/png")})}async function se(e){try{const n=await W(e);return await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),!0}catch{return!1}}async function re(e){const n=await W(e),t=URL.createObjectURL(n),r=document.createElement("a");r.href=t,r.download=`oracle-${e.brainName}-${e.date}.png`,r.click(),URL.revokeObjectURL(t)}function oe({reading:e}){const{t:n}=j(),[t,r]=d.useState(!1),o=async()=>{await se(e)&&(r(!0),setTimeout(()=>r(!1),2e3))},a=()=>{re(e)};return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:o,className:"flex cursor-pointer items-center gap-1.5 rounded-lg border border-white/10 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":n("oracle.copyCard"),children:t?s.jsxs(s.Fragment,{children:[s.jsx(K,{className:"size-3.5 text-green-400"}),n("oracle.copied")]}):s.jsxs(s.Fragment,{children:[s.jsx(H,{className:"size-3.5"}),n("oracle.copyCard")]})}),s.jsxs("button",{onClick:a,className:"flex cursor-pointer items-center gap-1.5 rounded-lg border border-white/10 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":n("oracle.downloadCard"),children:[s.jsx(G,{className:"size-3.5"}),n("oracle.downloadCard")]})]})}const ae=["Your past is marked by {past} — {pastContent}. Today, {present} guides your path — {presentContent}. Tomorrow, {future} awaits — {futureContent}.","{past} shaped what came before: {pastContent}. Now {present} holds the key — {presentContent}. The future whispers of {future}: {futureContent}.","From the shadow of {past} ({pastContent}), through the lens of {present} ({presentContent}), your path leads to {future} — {futureContent}.","The memory of {past} echoes: {pastContent}. {present} illuminates the now: {presentContent}. {future} beckons ahead: {futureContent}.","Once, {past} taught you: {pastContent}. Today, {present} reveals: {presentContent}. Soon, {future} will show: {futureContent}.","{past} planted seeds — {pastContent}. {present} tends the garden — {presentContent}. {future} promises the harvest — {futureContent}."],ie=['What if {suitA} and {suitB} collided? Imagine: "{cardA}" meets "{cardB}" — and {wildcardSuit} throws in a twist: "{wildcard}"','In another timeline, {suitA} chose differently: "{cardA}". Meanwhile {suitB} discovered: "{cardB}". The catalyst? {wildcardSuit}: "{wildcard}"',`Picture this: {suitA}'s memory ("{cardA}") suddenly merges with {suitB}'s truth ("{cardB}"). {wildcardSuit} watches from the shadows: "{wildcard}"`,'Two paths diverged — {suitA} whispered "{cardA}" while {suitB} insisted "{cardB}". {wildcardSuit} appeared: "{wildcard}"','What if you had followed {suitA} ("{cardA}") instead of {suitB} ("{cardB}")? {wildcardSuit} holds the answer: "{wildcard}"','Rewind. {suitA} says: "{cardA}". Fast forward. {suitB} replies: "{cardB}". Plot twist by {wildcardSuit}: "{wildcard}"'],le=['Which memory is stronger? {suitA}: "{contentA}" vs {suitB}: "{contentB}"','{suitA} challenges {suitB}! "{contentA}" faces off against "{contentB}" — who wins?','Battle of memories: {suitA} brings "{contentA}", {suitB} counters with "{contentB}"','Your brain asks: is "{contentA}" ({suitA}) more important than "{contentB}" ({suitB})?','Memory arena: {suitA} ("{contentA}") vs {suitB} ("{contentB}") — choose wisely!'];function z(e,n){let t=0;const r=`${e}:${n}`;for(let o=0;o>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}function T(e){let n=e|0;return()=>{n=n+1831565813|0;let t=Math.imul(n^n>>>15,1|n);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function S(e,n,t){const r=[...e],o=[];for(let a=0;a0;a++){const l=Math.floor(t()*r.length);o.push(r[l]),r.splice(l,1)}return o}function M(e,n){return e.length===0?"":e[Math.floor(n()*e.length)]}function R(e,n){return Object.entries(n).reduce((t,[r,o])=>t.replaceAll(`{${r}}`,o),e)}function de(e,n,t){if(e.length<3)return null;const r=new Date().toISOString().slice(0,10),o=z(r,n),a=T(o),l=[...e].sort((A,k)=>k.activation-A.activation),c=l.slice(0,Math.max(Math.ceil(l.length*.6),3)),i=S(c,3,a);if(i.length<3)return null;const[u,f,h]=i,p=R(M(ae,a),{past:u.suit.name,present:f.suit.name,future:h.suit.name,pastContent:u.content,presentContent:f.content,futureContent:h.content});return{past:u,present:f,future:h,interpretation:p,date:r,brainName:n}}function O(e,n){if(e.length<3)return null;const t=T(n??Date.now()),r=S(e,2,t);if(r.length<2)return null;const o=e.filter(i=>!r.includes(i)),a=S(o.length>0?o:e,1,t);if(a.length===0)return null;const l=a[0],c=R(M(ie,t),{cardA:r[0].content,cardB:r[1].content,suitA:r[0].suit.name,suitB:r[1].suit.name,wildcard:l.content,wildcardSuit:l.suit.name});return{decisions:r,error:l,scenario:c}}function $(e,n=1,t=5,r=[],o){if(e.length<2)return null;const a=o??Date.now(),l=T(ce(a,n*7919)),c=e.filter(f=>!r.includes(f.id)),i=c.length>=2?c:e,u=S(i,2,l);return u.length<2?null:{cardA:u[0],cardB:u[1],round:n,score:0,totalRounds:t}}function ue(e,n,t){const r=z(e.id,n.id),o=T(r);return R(M(le,o),{suitA:e.suit.name,suitB:n.suit.name,contentA:e.content,contentB:n.content})}const L="oracle-daily-reading";function fe(){return new Date().toISOString().slice(0,10)}function me(e){try{const n=localStorage.getItem(L);if(!n)return null;const t=JSON.parse(n);return t.date===fe()&&t.brainName===e?t.reading:null}catch{return null}}function he(e){const n={date:e.date,brainName:e.brainName,reading:e};localStorage.setItem(L,JSON.stringify(n))}function pe(e,n){const[t,r]=d.useState(null);return d.useEffect(()=>{if(e.length<3){r(null);return}const o=me(n);if(o){r(o);return}const a=de(e,n);a&&(he(a),r(a))},[e,n]),t}const P=["past","present","future"];function xe({cards:e,brainName:n}){const{t}=j(),r=pe(e,n),[o,a]=d.useState(0);if(!r)return null;const l=[r.past,r.present,r.future];return s.jsxs("div",{className:"flex flex-col items-center gap-8",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:t("oracle.dailyHint")}),s.jsx("div",{className:"flex flex-wrap justify-center gap-6",children:l.map((c,i)=>s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:t(`oracle.${P[i]}`)}),s.jsx(B,{card:c,autoFlipDelay:800+i*500,onFlip:()=>a(u=>Math.max(u,i+1)),className:"h-[340px] w-[240px]"})]},P[i]))}),o>=3&&s.jsxs("div",{className:"max-w-xl animate-in fade-in slide-in-from-bottom-4 duration-700",children:[s.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-5",children:[s.jsx("p",{className:"text-center text-sm leading-relaxed text-foreground/80",children:r.interpretation}),s.jsx("p",{className:"mt-3 text-center text-xs text-muted-foreground",children:t("oracle.readingDate",{date:r.date,brain:r.brainName})})]}),s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(oe,{reading:r})})]})]})}function ge({cards:e}){const{t:n}=j(),[t,r]=d.useState(()=>O(e)),[o,a]=d.useState(!1),l=d.useRef(0),c=d.useCallback(()=>{r(O(e,Date.now())),a(!1),l.current=0},[e]),i=d.useCallback(()=>{l.current+=1,l.current>=3&&a(!0)},[]);if(!t)return null;const u=[...t.decisions,t.error];return s.jsxs("div",{className:"flex flex-col items-center gap-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:n("oracle.whatifHint")}),s.jsxs("button",{onClick:c,className:"flex cursor-pointer items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":n("oracle.reshuffle"),children:[s.jsx(F,{className:"size-3.5"}),n("oracle.reshuffle")]})]}),s.jsx("div",{className:"flex flex-wrap justify-center gap-6",children:u.map((f,h)=>s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:h<2?n("oracle.memory")+` ${h+1}`:n("oracle.wildcard")}),s.jsx(B,{card:f,onFlip:i,className:"h-[340px] w-[240px]"})]},`slot-${h}`))}),o&&s.jsx("div",{className:"max-w-2xl animate-in fade-in slide-in-from-bottom-4 duration-700",children:s.jsx("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/5 p-5",children:s.jsx("p",{className:"text-center text-sm leading-relaxed text-foreground/80 italic",children:t.scenario})})})]})}const y=5;function be(e){const n=e.activation,t=Math.min(e.connectionCount,20)/2;return n+t}function ye({cards:e}){const{t:n}=j(),[t,r]=d.useState(()=>$(e,1,y)),[o,a]=d.useState(0),[l,c]=d.useState([]),[i,u]=d.useState(null),[f,h]=d.useState(!1),p=d.useRef(null);d.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const A=d.useCallback(x=>{if(!t||i)return;u(x);const g=x==="A"?t.cardA:t.cardB,v=o+be(g),N=[...l,t.cardA.id,t.cardB.id];a(v),c(N),p.current=setTimeout(()=>{if(t.round>=y){h(!0);return}const D=$(e,t.round+1,y,N,Date.now());r(D?{...D,score:v}:null),u(null)},1200)},[t,i,o,l,e]),k=d.useCallback(()=>{p.current&&clearTimeout(p.current),r($(e,1,y)),a(0),c([]),u(null),h(!1)},[e]);if(!t)return null;const U=ue(t.cardA,t.cardB);return f?s.jsxs("div",{className:"flex flex-col items-center gap-6 animate-in fade-in duration-500",children:[s.jsx(q,{className:"size-12 text-amber-400","aria-hidden":"true"}),s.jsx("h2",{className:"font-display text-2xl font-bold",children:n("oracle.matchupComplete")}),s.jsx("p",{className:"text-4xl font-bold text-primary",children:Math.round(o)}),s.jsx("p",{className:"text-sm text-muted-foreground",children:n("oracle.matchupScoreDesc")}),s.jsx("button",{onClick:k,className:"cursor-pointer rounded-lg bg-primary px-6 py-2.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90",children:n("oracle.playAgain")})]}):s.jsxs("div",{className:"flex flex-col items-center gap-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex gap-1.5",children:Array.from({length:y},(x,g)=>s.jsx("div",{className:`size-2 rounded-full transition-colors ${g{const g=x==="A"?t.cardA:t.cardB,v=i===x,N=i!==null&&i!==x;return s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx("div",{className:`transition-all duration-500 ${v?"scale-105 ring-2 ring-primary ring-offset-2 ring-offset-background rounded-xl":N?"scale-95 opacity-40":""}`,children:s.jsx(B,{card:g,autoFlipDelay:300+(x==="B"?200:0),className:"h-[340px] w-[240px]"})}),!i&&s.jsx("button",{onClick:()=>A(x),className:"cursor-pointer rounded-lg bg-accent px-5 py-2 text-sm font-medium text-foreground transition-all hover:bg-primary hover:text-primary-foreground",children:n("oracle.choose")}),v&&s.jsx("span",{className:"text-xs font-medium text-primary animate-in fade-in",children:n("oracle.chosen")})]},`${t.round}-${x}`)})}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("oracle.score"),": ",s.jsx("span",{className:"font-mono font-bold text-foreground",children:Math.round(o)})]})]})}const E={decision:{name:"The Architect",color:"#fbbf24",symbol:"◆",bg:"from-amber-900/40 to-amber-950/60"},error:{name:"The Shadow",color:"#ef4444",symbol:"♠",bg:"from-red-900/40 to-red-950/60"},insight:{name:"The Oracle",color:"#a78bfa",symbol:"♥",bg:"from-violet-900/40 to-violet-950/60"},fact:{name:"The Scholar",color:"#60a5fa",symbol:"♣",bg:"from-blue-900/40 to-blue-950/60"},workflow:{name:"The Engineer",color:"#34d399",symbol:"★",bg:"from-emerald-900/40 to-emerald-950/60"},concept:{name:"The Dreamer",color:"#22d3ee",symbol:"○",bg:"from-cyan-900/40 to-cyan-950/60"},entity:{name:"The Keeper",color:"#f59e0b",symbol:"△",bg:"from-amber-900/40 to-orange-950/60"},pattern:{name:"The Weaver",color:"#fb7185",symbol:"◇",bg:"from-rose-900/40 to-rose-950/60"},preference:{name:"The Compass",color:"#2dd4bf",symbol:"⊕",bg:"from-teal-900/40 to-teal-950/60"}},je={name:"The Wanderer",color:"#a8a29e",symbol:"?",bg:"from-stone-900/40 to-stone-950/60"};function ve(e){return e in E?{suit:E[e],key:e}:{suit:je,key:"unknown"}}function we(e){const n=new Date(e),r=new Date().getTime()-n.getTime(),o=Math.floor(r/(1e3*60*60*24));return o===0?"today":o===1?"1d":o<30?`${o}d`:o<365?`${Math.floor(o/30)}mo`:`${Math.floor(o/365)}y`}function Ne(e,n){return n.filter(t=>t.source_id===e||t.target_id===e).length}function Ce(e,n=120){return e.length<=n?e:e.slice(0,n).trimEnd()+"..."}function Se(e,n){return e.map(t=>{const{suit:r,key:o}=ve(t.type),a=t.metadata??{},l=typeof a.activation_level=="number"?a.activation_level:.5,c=typeof a.priority=="number"?a.priority:5,i=typeof a.created_at=="string"?a.created_at:new Date().toISOString();return{id:t.id,title:r.name,content:Ce(t.content),suit:r,suitKey:o,activation:Math.round(l*100)/10,connectionCount:Ne(t.id,n),age:we(i),priority:c,createdAt:i}})}function Te(){const{data:e,isLoading:n,error:t}=V(500);return{cards:d.useMemo(()=>e?Se(e.neurons,e.synapses):[],[e]),isLoading:n,error:t}}function De(){const{t:e}=j(),[n,t]=d.useState("daily"),{cards:r,isLoading:o}=Te(),{data:a}=J(),l=a?.active_brain??"default";return o?s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:e("oracle.title")}),s.jsx("p",{className:"text-muted-foreground",children:e("oracle.loading")})]}):r.length<3?s.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-6 pt-24",children:[s.jsx(_,{className:"size-12 text-muted-foreground/40"}),s.jsx("h2",{className:"font-display text-xl font-semibold text-muted-foreground",children:e("oracle.needMore")}),s.jsx("p",{className:"max-w-md text-center text-sm text-muted-foreground/70",children:e("oracle.needMoreDesc")})]}):s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:e("oracle.title")}),s.jsx(Z,{mode:n,onModeChange:t})]}),s.jsxs("div",{className:"flex flex-col items-center gap-8",children:[n==="daily"&&s.jsx(xe,{cards:r,brainName:l}),n==="whatif"&&s.jsx(ge,{cards:r}),n==="matchup"&&s.jsx(ye,{cards:r})]})]})}export{De as default}; diff --git a/src/surreal_memory/server/static/dist/assets/OverviewPage-BixPEj84.js b/src/surreal_memory/server/static/dist/assets/OverviewPage-0Bf2qfse.js similarity index 97% rename from src/surreal_memory/server/static/dist/assets/OverviewPage-BixPEj84.js rename to src/surreal_memory/server/static/dist/assets/OverviewPage-0Bf2qfse.js index ab099aeb..82c1863b 100644 --- a/src/surreal_memory/server/static/dist/assets/OverviewPage-BixPEj84.js +++ b/src/surreal_memory/server/static/dist/assets/OverviewPage-0Bf2qfse.js @@ -1 +1 @@ -import{j as e}from"./vendor-query-CqA1cBNl.js";import{r as N}from"./vendor-react-BfuodpLv.js";import{u as k,B as p,a as h,t as d,b,c as z,d as B,e as L,f as $}from"./index-DXL5wCpD.js";import{C as g,a as w,b as y,c as f}from"./card-Duzfr-hx.js";import{S as c}from"./skeleton-CBW-y0cP.js";import{C as T}from"./confirm-dialog-DE0Sgk6_.js";import{y as C,z as A,A as D,B as E,C as I,D as R,E as G,F as V,c as F,G as H,q as O,H as U,I as P}from"./vendor-icons-C6dhS1UE.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const Q={configured:{icon:C,badgeVariant:"success",label:"Configured"},warning:{icon:E,badgeVariant:"warning",label:"Warning"},not_configured:{icon:D,badgeVariant:"destructive",label:"Not configured"},info:{icon:A,badgeVariant:"secondary",label:"Info"}};function q({item:t}){const{icon:r,badgeVariant:i,label:o}=Q[t.status],n=async()=>{try{await navigator.clipboard.writeText(t.command),d.success("Copied to clipboard")}catch{d.error("Failed to copy")}};return e.jsxs("div",{className:"space-y-1.5 py-3 first:pt-0 last:pb-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(r,{className:`size-4 shrink-0 ${t.status==="configured"?"text-health-good":t.status==="warning"?"text-health-warn":t.status==="not_configured"?"text-destructive":"text-muted-foreground"}`,"aria-hidden":"true"}),e.jsx("span",{className:"text-sm font-medium",children:t.label})]}),e.jsx(p,{variant:i,className:"shrink-0 text-xs",children:o})]}),t.description&&e.jsx("p",{className:"pl-6 text-xs text-muted-foreground",children:t.description}),t.command&&e.jsxs("div",{className:"flex items-center gap-2 pl-6",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-muted px-2.5 py-1.5 font-mono text-xs",children:t.command}),e.jsx(h,{variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground",onClick:n,"aria-label":`Copy command: ${t.command}`,children:e.jsx(I,{className:"size-3.5","aria-hidden":"true"})})]})]})}function K(){return e.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((t,r)=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"size-4 rounded-full"}),e.jsx(c,{className:"h-4 w-32"})]}),e.jsx(c,{className:"h-5 w-20 rounded-md"})]}),e.jsx(c,{className:"ml-6 h-3 w-48"}),e.jsx(c,{className:"ml-6 h-7 w-full"})]},r))})}function W(){const{data:t,isLoading:r}=k(),i=t?.items??[];if(!r&&i.length===0)return null;const o=i.length>0&&i.every(n=>n.status==="configured");return e.jsxs(g,{children:[e.jsx(w,{className:"pb-2",children:e.jsx(y,{className:"text-base",children:"Quick Actions"})}),e.jsx(f,{children:r?e.jsx(K,{}):o?e.jsxs("div",{className:"flex items-center gap-2 py-2 text-sm text-health-good",children:[e.jsx(C,{className:"size-4","aria-hidden":"true"}),e.jsx("span",{children:"All features configured"})]}):e.jsx("div",{className:"grid grid-cols-1 divide-y divide-border sm:grid-cols-2 sm:divide-x sm:divide-y-0",children:i.map((n,m)=>{const l=m%2===1;return e.jsx("div",{className:`${l?"sm:pl-4":"sm:pr-4"}`,children:e.jsx(q,{item:n})},n.key)})})})]})}const M="https://github.com/acidkill/surreal-memory/blob/main/docs/guides/quickstart-guide.md",j="smem-guide-card-dismissed",Y=50;function J(){const{data:t,isLoading:r}=b(),[i,o]=N.useState(()=>{try{return localStorage.getItem(j)==="1"}catch{return!1}});if(r)return null;const n=t?.total_neurons??0;if(i||n>=Y)return null;const m=()=>{localStorage.setItem(j,"1"),o(!0)};return e.jsx(g,{className:"relative overflow-hidden border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10",children:e.jsxs(f,{className:"flex items-center gap-4 p-4 sm:p-5",children:[e.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary/15",children:e.jsx(R,{className:"size-5 text-primary","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-semibold",children:"Quickstart Guide"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Learn setup, recall, cognitive tools & more"})]}),e.jsx(h,{variant:"outline",size:"sm",className:"shrink-0 gap-1.5",asChild:!0,children:e.jsxs("a",{href:M,target:"_blank",rel:"noopener noreferrer",children:["Open Guide",e.jsx(G,{className:"size-3.5","aria-hidden":"true"})]})}),e.jsx(h,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 size-7 text-muted-foreground hover:text-foreground",onClick:m,"aria-label":"Dismiss guide card",children:e.jsx(V,{className:"size-3.5","aria-hidden":"true"})})]})})}function x({label:t,value:r,icon:i,loading:o}){return e.jsx(g,{children:e.jsxs(f,{className:"flex items-center gap-4 p-6",children:[e.jsx("div",{className:"flex size-12 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(i,{className:"size-6 text-primary","aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t}),o?e.jsx(c,{className:"mt-1 h-7 w-20"}):e.jsx("p",{className:"font-mono text-2xl font-bold tracking-tight",children:typeof r=="number"?r.toLocaleString():r})]})]})})}function oe(){const{data:t,isLoading:r}=b(),{data:i,isLoading:o}=z(),n=B(),m=L(),[l,u]=N.useState(null),{t:s}=$(),S=a=>{n.mutate(a,{onSuccess:()=>d.success(s("overview.switchedTo",{name:a})),onError:()=>d.error(s("overview.switchFailed"))})},_=()=>{l&&m.mutate(l.id,{onSuccess:()=>{d.success(s("overview.deleted",{name:l.name})),u(null)},onError:()=>{d.error(s("overview.deleteFailed")),u(null)}})};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("overview.title")}),e.jsx(J,{}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(x,{label:s("overview.neurons"),value:t?.total_neurons??0,icon:F,loading:r}),e.jsx(x,{label:s("overview.synapses"),value:t?.total_synapses??0,icon:H,loading:r}),e.jsx(x,{label:s("overview.fibers"),value:t?.total_fibers??0,icon:O,loading:r}),e.jsx(x,{label:s("overview.brains"),value:t?.total_brains??0,icon:U,loading:r})]}),e.jsx(W,{}),e.jsxs(g,{children:[e.jsx(w,{children:e.jsx(y,{children:s("overview.brainList")})}),e.jsx(f,{children:o?e.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((a,v)=>e.jsx(c,{className:"h-12 w-full"},v))}):i&&i.length>0?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left text-muted-foreground",children:[e.jsx("th",{className:"pb-2 font-medium",children:s("overview.name")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.neurons")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.synapses")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.fibers")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.grade")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.status")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.actions")})]})}),e.jsx("tbody",{children:i.map(a=>e.jsxs("tr",{className:`border-b border-border/50 last:border-0 transition-colors ${a.is_active?"":"cursor-pointer hover:bg-accent/50"}`,onClick:()=>{a.is_active||S(a.name)},title:a.is_active?s("overview.currentBrain"):s("overview.switchTo",{name:a.name}),children:[e.jsx("td",{className:"py-3 font-mono font-medium",children:a.name}),e.jsx("td",{className:"py-3 font-mono",children:a.neuron_count.toLocaleString()}),e.jsx("td",{className:"py-3 font-mono",children:a.synapse_count.toLocaleString()}),e.jsx("td",{className:"py-3 font-mono",children:a.fiber_count.toLocaleString()}),e.jsx("td",{className:"py-3",children:e.jsx(p,{variant:a.grade==="A"||a.grade==="A+"?"success":a.grade==="B"||a.grade==="B+"?"secondary":"warning",children:a.grade})}),e.jsx("td",{className:"py-3",children:a.is_active?e.jsx(p,{variant:"default",children:s("common.active")}):e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx("td",{className:"py-3",children:!a.is_active&&e.jsx(h,{variant:"ghost",size:"icon",className:"size-8 text-muted-foreground hover:text-destructive",onClick:v=>{v.stopPropagation(),u({id:a.id,name:a.name})},"aria-label":s("overview.deleteBrain",{name:a.name}),children:e.jsx(P,{className:"size-4"})})})]},a.id))})]})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:s("overview.noBrains")})})]}),e.jsx(T,{open:!!l,title:s("overview.deleteBrainTitle"),description:s("overview.deleteBrainDesc",{name:l?.name}),confirmLabel:s("common.delete"),variant:"destructive",onConfirm:_,onCancel:()=>u(null)})]})}export{oe as default}; +import{j as e}from"./vendor-query-CqA1cBNl.js";import{r as N}from"./vendor-react-BfuodpLv.js";import{u as k,B as p,a as h,t as d,b,c as z,d as B,e as L,f as $}from"./index-CLb-kMYl.js";import{C as g,a as w,b as y,c as f}from"./card-DG4oK1Wy.js";import{S as c}from"./skeleton-gKUrR2fT.js";import{C as T}from"./confirm-dialog-u0oWl0am.js";import{y as C,z as A,A as D,B as E,C as I,D as R,E as G,F as V,c as F,G as H,q as O,H as U,I as P}from"./vendor-icons-C6dhS1UE.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const Q={configured:{icon:C,badgeVariant:"success",label:"Configured"},warning:{icon:E,badgeVariant:"warning",label:"Warning"},not_configured:{icon:D,badgeVariant:"destructive",label:"Not configured"},info:{icon:A,badgeVariant:"secondary",label:"Info"}};function q({item:t}){const{icon:r,badgeVariant:i,label:o}=Q[t.status],n=async()=>{try{await navigator.clipboard.writeText(t.command),d.success("Copied to clipboard")}catch{d.error("Failed to copy")}};return e.jsxs("div",{className:"space-y-1.5 py-3 first:pt-0 last:pb-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(r,{className:`size-4 shrink-0 ${t.status==="configured"?"text-health-good":t.status==="warning"?"text-health-warn":t.status==="not_configured"?"text-destructive":"text-muted-foreground"}`,"aria-hidden":"true"}),e.jsx("span",{className:"text-sm font-medium",children:t.label})]}),e.jsx(p,{variant:i,className:"shrink-0 text-xs",children:o})]}),t.description&&e.jsx("p",{className:"pl-6 text-xs text-muted-foreground",children:t.description}),t.command&&e.jsxs("div",{className:"flex items-center gap-2 pl-6",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-muted px-2.5 py-1.5 font-mono text-xs",children:t.command}),e.jsx(h,{variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground",onClick:n,"aria-label":`Copy command: ${t.command}`,children:e.jsx(I,{className:"size-3.5","aria-hidden":"true"})})]})]})}function K(){return e.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((t,r)=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"size-4 rounded-full"}),e.jsx(c,{className:"h-4 w-32"})]}),e.jsx(c,{className:"h-5 w-20 rounded-md"})]}),e.jsx(c,{className:"ml-6 h-3 w-48"}),e.jsx(c,{className:"ml-6 h-7 w-full"})]},r))})}function W(){const{data:t,isLoading:r}=k(),i=t?.items??[];if(!r&&i.length===0)return null;const o=i.length>0&&i.every(n=>n.status==="configured");return e.jsxs(g,{children:[e.jsx(w,{className:"pb-2",children:e.jsx(y,{className:"text-base",children:"Quick Actions"})}),e.jsx(f,{children:r?e.jsx(K,{}):o?e.jsxs("div",{className:"flex items-center gap-2 py-2 text-sm text-health-good",children:[e.jsx(C,{className:"size-4","aria-hidden":"true"}),e.jsx("span",{children:"All features configured"})]}):e.jsx("div",{className:"grid grid-cols-1 divide-y divide-border sm:grid-cols-2 sm:divide-x sm:divide-y-0",children:i.map((n,m)=>{const l=m%2===1;return e.jsx("div",{className:`${l?"sm:pl-4":"sm:pr-4"}`,children:e.jsx(q,{item:n})},n.key)})})})]})}const M="https://github.com/acidkill/surreal-memory/blob/main/docs/guides/quickstart-guide.md",j="smem-guide-card-dismissed",Y=50;function J(){const{data:t,isLoading:r}=b(),[i,o]=N.useState(()=>{try{return localStorage.getItem(j)==="1"}catch{return!1}});if(r)return null;const n=t?.total_neurons??0;if(i||n>=Y)return null;const m=()=>{localStorage.setItem(j,"1"),o(!0)};return e.jsx(g,{className:"relative overflow-hidden border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10",children:e.jsxs(f,{className:"flex items-center gap-4 p-4 sm:p-5",children:[e.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary/15",children:e.jsx(R,{className:"size-5 text-primary","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-semibold",children:"Quickstart Guide"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Learn setup, recall, cognitive tools & more"})]}),e.jsx(h,{variant:"outline",size:"sm",className:"shrink-0 gap-1.5",asChild:!0,children:e.jsxs("a",{href:M,target:"_blank",rel:"noopener noreferrer",children:["Open Guide",e.jsx(G,{className:"size-3.5","aria-hidden":"true"})]})}),e.jsx(h,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 size-7 text-muted-foreground hover:text-foreground",onClick:m,"aria-label":"Dismiss guide card",children:e.jsx(V,{className:"size-3.5","aria-hidden":"true"})})]})})}function x({label:t,value:r,icon:i,loading:o}){return e.jsx(g,{children:e.jsxs(f,{className:"flex items-center gap-4 p-6",children:[e.jsx("div",{className:"flex size-12 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(i,{className:"size-6 text-primary","aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t}),o?e.jsx(c,{className:"mt-1 h-7 w-20"}):e.jsx("p",{className:"font-mono text-2xl font-bold tracking-tight",children:typeof r=="number"?r.toLocaleString():r})]})]})})}function oe(){const{data:t,isLoading:r}=b(),{data:i,isLoading:o}=z(),n=B(),m=L(),[l,u]=N.useState(null),{t:s}=$(),S=a=>{n.mutate(a,{onSuccess:()=>d.success(s("overview.switchedTo",{name:a})),onError:()=>d.error(s("overview.switchFailed"))})},_=()=>{l&&m.mutate(l.id,{onSuccess:()=>{d.success(s("overview.deleted",{name:l.name})),u(null)},onError:()=>{d.error(s("overview.deleteFailed")),u(null)}})};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("overview.title")}),e.jsx(J,{}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(x,{label:s("overview.neurons"),value:t?.total_neurons??0,icon:F,loading:r}),e.jsx(x,{label:s("overview.synapses"),value:t?.total_synapses??0,icon:H,loading:r}),e.jsx(x,{label:s("overview.fibers"),value:t?.total_fibers??0,icon:O,loading:r}),e.jsx(x,{label:s("overview.brains"),value:t?.total_brains??0,icon:U,loading:r})]}),e.jsx(W,{}),e.jsxs(g,{children:[e.jsx(w,{children:e.jsx(y,{children:s("overview.brainList")})}),e.jsx(f,{children:o?e.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((a,v)=>e.jsx(c,{className:"h-12 w-full"},v))}):i&&i.length>0?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left text-muted-foreground",children:[e.jsx("th",{className:"pb-2 font-medium",children:s("overview.name")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.neurons")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.synapses")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.fibers")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.grade")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.status")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.actions")})]})}),e.jsx("tbody",{children:i.map(a=>e.jsxs("tr",{className:`border-b border-border/50 last:border-0 transition-colors ${a.is_active?"":"cursor-pointer hover:bg-accent/50"}`,onClick:()=>{a.is_active||S(a.name)},title:a.is_active?s("overview.currentBrain"):s("overview.switchTo",{name:a.name}),children:[e.jsx("td",{className:"py-3 font-mono font-medium",children:a.name}),e.jsx("td",{className:"py-3 font-mono",children:a.neuron_count.toLocaleString()}),e.jsx("td",{className:"py-3 font-mono",children:a.synapse_count.toLocaleString()}),e.jsx("td",{className:"py-3 font-mono",children:a.fiber_count.toLocaleString()}),e.jsx("td",{className:"py-3",children:e.jsx(p,{variant:a.grade==="A"||a.grade==="A+"?"success":a.grade==="B"||a.grade==="B+"?"secondary":"warning",children:a.grade})}),e.jsx("td",{className:"py-3",children:a.is_active?e.jsx(p,{variant:"default",children:s("common.active")}):e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx("td",{className:"py-3",children:!a.is_active&&e.jsx(h,{variant:"ghost",size:"icon",className:"size-8 text-muted-foreground hover:text-destructive",onClick:v=>{v.stopPropagation(),u({id:a.id,name:a.name})},"aria-label":s("overview.deleteBrain",{name:a.name}),children:e.jsx(P,{className:"size-4"})})})]},a.id))})]})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:s("overview.noBrains")})})]}),e.jsx(T,{open:!!l,title:s("overview.deleteBrainTitle"),description:s("overview.deleteBrainDesc",{name:l?.name}),confirmLabel:s("common.delete"),variant:"destructive",onConfirm:_,onCancel:()=>u(null)})]})}export{oe as default}; diff --git a/src/surreal_memory/server/static/dist/assets/ProGate-DjphnyL3.js b/src/surreal_memory/server/static/dist/assets/ProGate-u3qkirgp.js similarity index 71% rename from src/surreal_memory/server/static/dist/assets/ProGate-DjphnyL3.js rename to src/surreal_memory/server/static/dist/assets/ProGate-u3qkirgp.js index 5af2a294..4f04c2d1 100644 --- a/src/surreal_memory/server/static/dist/assets/ProGate-DjphnyL3.js +++ b/src/surreal_memory/server/static/dist/assets/ProGate-u3qkirgp.js @@ -1 +1 @@ -import{j as t}from"./vendor-query-CqA1cBNl.js";import"./vendor-react-BfuodpLv.js";import{f as o}from"./index-DXL5wCpD.js";function i({children:r,label:s}){const{t:a}=o();return t.jsx(t.Fragment,{children:r})}export{i as P}; +import{j as t}from"./vendor-query-CqA1cBNl.js";import"./vendor-react-BfuodpLv.js";import{f as o}from"./index-CLb-kMYl.js";function i({children:r,label:s}){const{t:a}=o();return t.jsx(t.Fragment,{children:r})}export{i as P}; diff --git a/src/surreal_memory/server/static/dist/assets/ReasoningPage-BLOUPTbz.js b/src/surreal_memory/server/static/dist/assets/ReasoningPage-BLOUPTbz.js new file mode 100644 index 00000000..cf49364b --- /dev/null +++ b/src/surreal_memory/server/static/dist/assets/ReasoningPage-BLOUPTbz.js @@ -0,0 +1 @@ +import{u as H,a as P,b as Q,j as e}from"./vendor-query-CqA1cBNl.js";import{r as j}from"./vendor-react-BfuodpLv.js";import{C,a as E,b as q,c as _}from"./card-DG4oK1Wy.js";import{o as T,f as w,a as y,t as u,C as M,D as A,B as W}from"./index-CLb-kMYl.js";import{S as O}from"./skeleton-gKUrR2fT.js";import{I as K,a2 as J}from"./vendor-icons-C6dhS1UE.js";import{C as L}from"./confirm-dialog-u0oWl0am.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const v={status:["reasoning","status"],patterns:["reasoning","patterns"],patternList:(t,n,s,a)=>["reasoning","patterns",t,n,s,a]};function V(){return H({queryKey:v.status,queryFn:()=>T.get("/api/dashboard/reasoning/status"),refetchInterval:t=>t.state.data?.mining.running?1500:!1})}function B(){const t=P();return Q({mutationFn:n=>T.put("/api/dashboard/reasoning/config",n),onMutate:async n=>{await t.cancelQueries({queryKey:v.status});const s=t.getQueryData(v.status);return s&&t.setQueryData(v.status,{...s,config:{...s.config,...n}}),{prev:s}},onError:(n,s,a)=>{a?.prev&&t.setQueryData(v.status,a.prev)},onSettled:()=>t.invalidateQueries({queryKey:v.status})})}function Y(){const t=P();return Q({mutationFn:n=>T.post("/api/dashboard/reasoning/mine",n),onSuccess:()=>t.invalidateQueries({queryKey:v.status})})}function ee(t="",n="",s=50,a=0){const l=new URLSearchParams;return t&&l.set("model",t),n&&l.set("category",n),l.set("limit",String(s)),l.set("offset",String(a)),H({queryKey:v.patternList(t,n,s,a),queryFn:()=>T.get(`/api/dashboard/reasoning/patterns?${l.toString()}`)})}function ne(){const t=P();return Q({mutationFn:n=>T.delete(`/api/dashboard/reasoning/patterns/${encodeURIComponent(n)}`),onSuccess:()=>{t.invalidateQueries({queryKey:v.status}),t.invalidateQueries({queryKey:v.patterns})}})}function se(){const t=P();return Q({mutationFn:n=>T.delete(`/api/dashboard/reasoning/patterns?model=${encodeURIComponent(n)}`),onSuccess:()=>{t.invalidateQueries({queryKey:v.status}),t.invalidateQueries({queryKey:v.patterns})}})}function te(){const t=P();return Q({mutationFn:n=>T.delete(`/api/dashboard/reasoning/traces?model=${encodeURIComponent(n)}`),onSuccess:()=>t.invalidateQueries({queryKey:v.status})})}function re({mining:t}){const{t:n}=w(),{phase:s,files_total:a,files_scanned:l,traces_found:g,traces_ingested:m}=t,d=a>0?Math.round(l/a*100):0,i=s==="scanning"||s==="ingesting",p=n(s==="scanning"?"reasoning.progressScanning":s==="ingesting"?"reasoning.progressIngesting":s==="distilling"?"reasoning.progressDistilling":"reasoning.progressDone");return e.jsxs("div",{"data-testid":"mining-progress",className:"space-y-2 rounded-md border border-border bg-muted/40 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"font-medium",children:p}),i&&a>0&&e.jsx("span",{className:"font-mono tabular-nums text-muted-foreground",children:n("reasoning.progressFiles",{scanned:l,total:a})})]}),i&&a>0&&e.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-300",style:{width:`${d}%`}})}),i&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n("reasoning.progressTraces",{found:g,ingested:m})}),s==="distilling"&&e.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:n("reasoning.progressModels",{model:t.current_model??"",done:t.models_done,total:t.models_total,patterns:t.patterns_learned})})]})}function ae({status:t}){const{t:n}=w(),s=B(),a=Y(),l=te(),g=t.config.mining_enabled,m=new Set(t.config.mining_models),d=t.mining.running,[i,p]=j.useState(!1),[h,b]=j.useState(null),N=()=>{if(!h)return;const r=h;b(null),l.mutate(r,{onSuccess:o=>u.success(n("reasoning.tracesWiped",{count:o.deleted})),onError:o=>u.error(M(o,n("reasoning.configSaveFailed")))})},S=r=>{s.mutate({mining_enabled:r},{onSuccess:()=>u.success(n("reasoning.configSaved")),onError:o=>u.error(M(o,n("reasoning.configSaveFailed")))})},D=(r,o)=>{const f=new Set(m);o?f.add(r):f.delete(r),s.mutate({mining_models:[...f]},{onSuccess:()=>u.success(n("reasoning.configSaved")),onError:x=>u.error(M(x,n("reasoning.configSaveFailed")))})},z=()=>{a.mutate({backfill:i},{onSuccess:()=>u.success(n("reasoning.miningStarted")),onError:r=>{r instanceof A&&r.status===409?u.error(n("reasoning.miningInProgress")):r instanceof A&&r.status===400?u.error(n("reasoning.miningDisabled")):u.error(n("reasoning.miningFailed"))}})};return e.jsxs(C,{children:[e.jsx(E,{children:e.jsx(q,{children:n("reasoning.miningTitle")})}),e.jsxs(_,{className:"space-y-4 text-sm",children:[e.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:g,onChange:r=>S(r.target.checked),disabled:s.isPending,className:"size-4 cursor-pointer"}),e.jsx("span",{children:n("reasoning.miningEnabled")})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:n("reasoning.miningModels")}),t.detected_models.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:n("reasoning.noModels")}):e.jsx("div",{className:"space-y-1.5",children:t.per_model.map(r=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"flex flex-1 items-center gap-2",title:r.has_thinking_text?r.model:n("reasoning.noThinkingText"),children:[e.jsx("input",{type:"checkbox",checked:m.has(r.model),disabled:!r.has_thinking_text||s.isPending,onChange:o=>D(r.model,o.target.checked),className:"size-4 cursor-pointer disabled:cursor-not-allowed"}),e.jsx("span",{className:r.has_thinking_text?"font-mono":"font-mono text-muted-foreground",children:r.model}),!r.has_thinking_text&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",n("reasoning.noThinkingShort"),")"]})]}),r.trace_count>0&&e.jsx(y,{variant:"ghost",size:"icon",onClick:()=>b(r.model),disabled:l.isPending,title:n("reasoning.wipeTraces"),"aria-label":n("reasoning.wipeTraces"),children:e.jsx(K,{className:"size-4"})})]},r.model))}),e.jsx("p",{className:"pt-1 text-xs text-muted-foreground",children:n("reasoning.miningModelsHint")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:r=>p(r.target.checked),className:"size-4 cursor-pointer"}),e.jsx("span",{children:n("reasoning.backfill")})]}),e.jsx(y,{size:"sm",onClick:z,disabled:!g||d||a.isPending,children:n(d?"reasoning.miningRunning":"reasoning.runMining")})]}),d&&e.jsx(re,{mining:t.mining})]}),e.jsx(L,{open:h!==null,title:n("reasoning.wipeTracesTitle"),description:n("reasoning.wipeTracesDesc",{model:h??""}),variant:"destructive",confirmLabel:n("reasoning.wipeTraces"),onConfirm:N,onCancel:()=>b(null)})]})}const ie=10,oe=100;function le({status:t}){const{t:n}=w(),s=B(),a=t.per_model.filter(i=>i.has_thinking_text),l=t.config.pattern_targets,[g,m]=j.useState(l);j.useEffect(()=>{m(l)},[l]);const d=(i,p)=>{const h={...g,[i]:p};m(h),s.mutate({pattern_targets:h},{onSuccess:()=>u.success(n("reasoning.configSaved")),onError:b=>u.error(M(b,n("reasoning.configSaveFailed")))})};return e.jsxs(C,{children:[e.jsx(E,{children:e.jsx(q,{children:n("reasoning.targetsTitle")})}),e.jsxs(_,{className:"space-y-4 text-sm",children:[a.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:n("reasoning.noModels")}):e.jsx("div",{className:"space-y-4",children:a.map(i=>{const p=g[i.model]??0;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-mono text-xs",children:i.model}),e.jsx("span",{className:"font-mono text-xs tabular-nums text-muted-foreground",children:p})]}),e.jsx("input",{type:"range",min:0,max:oe,step:ie,value:p,"aria-label":i.model,onChange:h=>d(i.model,Number(h.target.value)),className:"w-full cursor-pointer accent-primary"}),e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:n("reasoning.targetCounts",{patterns:i.pattern_count,traces:i.trace_count})}),p===0&&e.jsx("span",{children:n("reasoning.targetsZeroHint")})]})]},i.model)})}),e.jsx("p",{className:"pt-1 text-xs text-muted-foreground",children:n("reasoning.targetsHint")})]})]})}let ce=0;const Z=()=>`pair-${ce++}`,U=t=>Object.entries(t).map(([n,s])=>({id:Z(),target:n,source:s}));function de({status:t}){const{t:n}=w(),s=B(),a=t.config.injection_enabled,l=t.per_model.filter(r=>r.has_thinking_text).map(r=>r.model),[g,m]=j.useState(()=>U(t.config.injection_map)),[d,i]=j.useState(!1),[p,h]=j.useState(t.config.injection_map);t.config.injection_map!==p&&(h(t.config.injection_map),m(U(t.config.injection_map)),i(!1));const b=r=>{s.mutate({injection_enabled:r},{onSuccess:()=>u.success(n("reasoning.configSaved")),onError:o=>u.error(M(o,n("reasoning.configSaveFailed")))})},N=(r,o)=>{m(f=>f.map(x=>x.id===r?{...x,...o}:x)),i(!0)},S=()=>{m(r=>[...r,{id:Z(),target:"",source:l[0]??""}]),i(!0)},D=r=>{m(o=>o.filter(f=>f.id!==r)),i(!0)},z=()=>{const r=new Set,o={};for(const f of g){const x=f.target.trim(),F=f.source.trim();if(!(!x||!F)){if(r.has(x)){u.error(n("reasoning.duplicateTarget",{target:x}));return}r.add(x),o[x]=F}}s.mutate({injection_map:o},{onSuccess:()=>{u.success(n("reasoning.configSaved")),i(!1)},onError:f=>u.error(M(f,n("reasoning.configSaveFailed")))})};return e.jsxs(C,{children:[e.jsx(E,{children:e.jsx(q,{children:n("reasoning.injectionTitle")})}),e.jsxs(_,{className:"space-y-4 text-sm",children:[e.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:a,onChange:r=>b(r.target.checked),disabled:s.isPending,className:"size-4 cursor-pointer"}),e.jsx("span",{children:n("reasoning.injectionEnabled")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:n("reasoning.injectionMap")}),g.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n("reasoning.noMappings")}),g.map(r=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:r.source,onChange:o=>N(r.id,{source:o.target.value}),className:"w-40 rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs","aria-label":n("reasoning.source"),children:[!l.includes(r.source)&&r.source&&e.jsx("option",{value:r.source,children:r.source}),l.map(o=>e.jsx("option",{value:o,children:o},o))]}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("input",{type:"text",value:r.target,onChange:o=>N(r.id,{target:o.target.value}),placeholder:n("reasoning.targetPlaceholder"),className:"w-40 rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs","aria-label":n("reasoning.target")}),e.jsx(y,{variant:"ghost",size:"icon",onClick:()=>D(r.id),"aria-label":n("common.delete"),children:e.jsx(K,{className:"size-4"})})]},r.id)),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsxs(y,{variant:"outline",size:"sm",onClick:S,disabled:l.length===0,children:[e.jsx(J,{className:"size-4"})," ",n("reasoning.addMapping")]}),e.jsx(y,{size:"sm",onClick:z,disabled:!d||s.isPending,children:n("reasoning.save")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("reasoning.injectionMapHint")})]})]})]})}const k=20;function ge({detectedModels:t,categories:n}){const{t:s}=w(),[a,l]=j.useState(""),[g,m]=j.useState(""),[d,i]=j.useState(0),[p,h]=j.useState(null),[b,N]=j.useState(null),{data:S,isLoading:D,isError:z,refetch:r}=ee(a,g,k,d),o=ne(),f=se(),x=S?.total??0,F=S?.patterns??[];S&&d>0&&d>=x&&i(Math.max(0,x-k));const $=()=>i(0),G=()=>{if(!p)return;const c=p.id;h(null),o.mutate(c,{onSuccess:()=>u.success(s("reasoning.patternDeleted")),onError:()=>u.error(s("reasoning.patternDeleteFailed"))})},X=()=>{if(!b)return;const c=b;N(null),f.mutate(c,{onSuccess:I=>u.success(s("reasoning.patternsDeletedCount",{count:I.deleted})),onError:I=>u.error(M(I,s("reasoning.patternDeleteFailed")))})};return e.jsxs(C,{children:[e.jsx(E,{children:e.jsx(q,{children:s("reasoning.patternsTitle")})}),e.jsxs(_,{className:"space-y-4 text-sm",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("select",{value:a,onChange:c=>{l(c.target.value),$()},className:"rounded-md border border-border bg-background px-2 py-1.5 text-xs","aria-label":s("reasoning.filterModel"),children:[e.jsx("option",{value:"",children:s("reasoning.allModels")}),t.map(c=>e.jsx("option",{value:c,children:c},c))]}),e.jsxs("select",{value:g,onChange:c=>{m(c.target.value),$()},className:"rounded-md border border-border bg-background px-2 py-1.5 text-xs","aria-label":s("reasoning.filterCategory"),children:[e.jsx("option",{value:"",children:s("reasoning.allCategories")}),n.map(c=>e.jsx("option",{value:c,children:c},c))]}),a&&e.jsxs(y,{variant:"outline",size:"sm",className:"text-destructive",onClick:()=>N(a),disabled:f.isPending,children:[e.jsx(K,{className:"size-4"})," ",s("reasoning.deleteAllForModel")]})]}),D?e.jsx(O,{className:"h-32 w-full"}):z?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:s("reasoning.patternsError")}),e.jsx(y,{variant:"outline",size:"sm",onClick:()=>r(),children:s("common.retry")})]}):F.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("reasoning.noPatterns")}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[e.jsx("th",{className:"py-2 pr-3 font-medium",children:s("reasoning.colTitle")}),e.jsx("th",{className:"py-2 pr-3 font-medium",children:s("reasoning.colModel")}),e.jsx("th",{className:"py-2 pr-3 font-medium",children:s("reasoning.colCategory")}),e.jsx("th",{className:"py-2 pr-3 text-right font-medium",children:s("reasoning.colConfidence")}),e.jsx("th",{className:"py-2 pr-3 text-right font-medium",children:s("reasoning.colFrequency")}),e.jsx("th",{className:"py-2 font-medium"})]})}),e.jsx("tbody",{children:F.map(c=>e.jsxs("tr",{className:"border-b border-border/50",children:[e.jsx("td",{className:"py-2 pr-3",children:c.title}),e.jsx("td",{className:"py-2 pr-3 font-mono text-xs",children:c.source_model}),e.jsx("td",{className:"py-2 pr-3",children:e.jsx(W,{variant:"secondary",children:c.category})}),e.jsxs("td",{className:"py-2 pr-3 text-right font-mono",children:[Math.round(c.confidence*100),"%"]}),e.jsx("td",{className:"py-2 pr-3 text-right font-mono",children:c.frequency}),e.jsx("td",{className:"py-2 text-right",children:e.jsx(y,{variant:"ghost",size:"icon",onClick:()=>h(c),"aria-label":s("common.delete"),children:e.jsx(K,{className:"size-4"})})})]},c.id))})]})}),x>k&&e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[d+1,"–",Math.min(d+k,x)," / ",x]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(y,{variant:"outline",size:"sm",disabled:d===0,onClick:()=>i(Math.max(0,d-k)),children:s("common.prev")}),e.jsx(y,{variant:"outline",size:"sm",disabled:d+k>=x,onClick:()=>i(d+k),children:s("common.next")})]})]})]}),e.jsx(L,{open:p!==null,title:s("reasoning.deletePatternTitle"),description:s("reasoning.deletePatternDesc",{title:p?.title??""}),variant:"destructive",confirmLabel:s("common.delete"),onConfirm:G,onCancel:()=>h(null)}),e.jsx(L,{open:b!==null,title:s("reasoning.deleteAllTitle"),description:s("reasoning.deleteAllDesc",{model:b??""}),variant:"destructive",confirmLabel:s("common.delete"),onConfirm:X,onCancel:()=>N(null)})]})}function R({label:t,value:n}){return e.jsxs(C,{children:[e.jsx(E,{className:"pb-2",children:e.jsx(q,{className:"text-sm font-medium text-muted-foreground",children:t})}),e.jsx(_,{children:e.jsx("p",{className:"font-mono text-2xl font-bold",children:n.toLocaleString()})})]})}function ue({status:t}){const{t:n}=w(),s=t.per_model.filter(a=>a.pattern_count>0);return s.length===0?null:e.jsxs(C,{children:[e.jsx(E,{children:e.jsx(q,{children:n("reasoning.coverageTitle")})}),e.jsx(_,{className:"space-y-4 text-sm",children:s.map(a=>{const l=t.coverage_by_model[a.model]??[];return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-mono text-xs",children:a.model}),e.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[a.coverage_percent,"%"]})]}),e.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${a.coverage_percent}%`}})}),l.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:l.map(g=>e.jsxs(W,{variant:g.covered?"success":"outline",children:[g.category," (",g.pattern_count,")"]},g.category))})]},a.model)})})]})}function Ne(){const{t}=w(),n=P(),{data:s,isLoading:a,isError:l,refetch:g}=V(),m=s?.mining.running??!1,d=j.useRef(m);return j.useEffect(()=>{d.current&&!m&&n.invalidateQueries({queryKey:["reasoning","patterns"]}),d.current=m},[m,n]),e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:t("reasoning.pageTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("reasoning.pageSubtitle")})]}),a?e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-4",children:[0,1,2,3].map(i=>e.jsx(O,{className:"h-24 w-full"},i))}):l||!s?e.jsx(C,{children:e.jsxs(_,{className:"space-y-2 p-6",children:[e.jsx("p",{className:"text-sm text-destructive",children:t("reasoning.statusError")}),e.jsx(y,{variant:"outline",size:"sm",onClick:()=>g(),children:t("common.retry")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-4",children:[e.jsx(R,{label:t("reasoning.kpiTraces"),value:s.total_traces}),e.jsx(R,{label:t("reasoning.kpiUnprocessed"),value:s.unprocessed_traces}),e.jsx(R,{label:t("reasoning.kpiPatterns"),value:s.total_patterns}),e.jsx(R,{label:t("reasoning.kpiModels"),value:s.detected_models.length})]}),s.total_traces===0&&!s.mining.running&&e.jsx(C,{children:e.jsx(_,{className:"p-6 text-sm text-muted-foreground",children:t("reasoning.emptyState")})}),e.jsx(ue,{status:s}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsx(ae,{status:s}),e.jsx(le,{status:s})]}),e.jsx(de,{status:s}),e.jsx(ge,{detectedModels:s.detected_models,categories:s.config.categories})]})]})}export{Ne as default}; diff --git a/src/surreal_memory/server/static/dist/assets/ReasoningPage-BjC1wtHj.js b/src/surreal_memory/server/static/dist/assets/ReasoningPage-BjC1wtHj.js deleted file mode 100644 index 1a0fedb5..00000000 --- a/src/surreal_memory/server/static/dist/assets/ReasoningPage-BjC1wtHj.js +++ /dev/null @@ -1 +0,0 @@ -import{u as A,a as w,b as z,j as e}from"./vendor-query-CqA1cBNl.js";import{r as f}from"./vendor-react-BfuodpLv.js";import{C as k,a as D,b as F,c as _}from"./card-Duzfr-hx.js";import{o as M,f as Q,a as j,t as c,C as P,D as $,B as W}from"./index-DXL5wCpD.js";import{S as H}from"./skeleton-CBW-y0cP.js";import{I as K,a2 as V}from"./vendor-icons-C6dhS1UE.js";import{C as L}from"./confirm-dialog-DE0Sgk6_.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const h={status:["reasoning","status"],patterns:["reasoning","patterns"],patternList:(a,n,s,i)=>["reasoning","patterns",a,n,s,i]};function X(){return A({queryKey:h.status,queryFn:()=>M.get("/api/dashboard/reasoning/status"),refetchInterval:a=>a.state.data?.mining.running?3e3:!1})}function O(){const a=w();return z({mutationFn:n=>M.put("/api/dashboard/reasoning/config",n),onMutate:async n=>{await a.cancelQueries({queryKey:h.status});const s=a.getQueryData(h.status);return s&&a.setQueryData(h.status,{...s,config:{...s.config,...n}}),{prev:s}},onError:(n,s,i)=>{i?.prev&&a.setQueryData(h.status,i.prev)},onSettled:()=>a.invalidateQueries({queryKey:h.status})})}function Y(){const a=w();return z({mutationFn:n=>M.post("/api/dashboard/reasoning/mine",n),onSuccess:()=>a.invalidateQueries({queryKey:h.status})})}function ee(a="",n="",s=50,i=0){const l=new URLSearchParams;return a&&l.set("model",a),n&&l.set("category",n),l.set("limit",String(s)),l.set("offset",String(i)),A({queryKey:h.patternList(a,n,s,i),queryFn:()=>M.get(`/api/dashboard/reasoning/patterns?${l.toString()}`)})}function ne(){const a=w();return z({mutationFn:n=>M.delete(`/api/dashboard/reasoning/patterns/${encodeURIComponent(n)}`),onSuccess:()=>{a.invalidateQueries({queryKey:h.status}),a.invalidateQueries({queryKey:h.patterns})}})}function se(){const a=w();return z({mutationFn:n=>M.delete(`/api/dashboard/reasoning/patterns?model=${encodeURIComponent(n)}`),onSuccess:()=>{a.invalidateQueries({queryKey:h.status}),a.invalidateQueries({queryKey:h.patterns})}})}function te(){const a=w();return z({mutationFn:n=>M.delete(`/api/dashboard/reasoning/traces?model=${encodeURIComponent(n)}`),onSuccess:()=>a.invalidateQueries({queryKey:h.status})})}function ae({status:a}){const{t:n}=Q(),s=O(),i=Y(),l=te(),g=a.config.mining_enabled,p=new Set(a.config.mining_models),u=a.mining.running,[m,y]=f.useState(!1),[v,b]=f.useState(null),N=()=>{if(!v)return;const t=v;b(null),l.mutate(t,{onSuccess:r=>c.success(n("reasoning.tracesWiped",{count:r.deleted})),onError:r=>c.error(P(r,n("reasoning.configSaveFailed")))})},C=t=>{s.mutate({mining_enabled:t},{onSuccess:()=>c.success(n("reasoning.configSaved")),onError:r=>c.error(P(r,n("reasoning.configSaveFailed")))})},T=(t,r)=>{const x=new Set(p);r?x.add(t):x.delete(t),s.mutate({mining_models:[...x]},{onSuccess:()=>c.success(n("reasoning.configSaved")),onError:d=>c.error(P(d,n("reasoning.configSaveFailed")))})},E=()=>{i.mutate({backfill:m},{onSuccess:()=>c.success(n("reasoning.miningStarted")),onError:t=>{t instanceof $&&t.status===409?c.error(n("reasoning.miningInProgress")):t instanceof $&&t.status===400?c.error(n("reasoning.miningDisabled")):c.error(n("reasoning.miningFailed"))}})};return e.jsxs(k,{children:[e.jsx(D,{children:e.jsx(F,{children:n("reasoning.miningTitle")})}),e.jsxs(_,{className:"space-y-4 text-sm",children:[e.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:g,onChange:t=>C(t.target.checked),disabled:s.isPending,className:"size-4 cursor-pointer"}),e.jsx("span",{children:n("reasoning.miningEnabled")})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:n("reasoning.miningModels")}),a.detected_models.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:n("reasoning.noModels")}):e.jsx("div",{className:"space-y-1.5",children:a.per_model.map(t=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"flex flex-1 items-center gap-2",title:t.has_thinking_text?t.model:n("reasoning.noThinkingText"),children:[e.jsx("input",{type:"checkbox",checked:p.has(t.model),disabled:!t.has_thinking_text||s.isPending,onChange:r=>T(t.model,r.target.checked),className:"size-4 cursor-pointer disabled:cursor-not-allowed"}),e.jsx("span",{className:t.has_thinking_text?"font-mono":"font-mono text-muted-foreground",children:t.model}),!t.has_thinking_text&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",n("reasoning.noThinkingShort"),")"]})]}),t.trace_count>0&&e.jsx(j,{variant:"ghost",size:"icon",onClick:()=>b(t.model),disabled:l.isPending,title:n("reasoning.wipeTraces"),"aria-label":n("reasoning.wipeTraces"),children:e.jsx(K,{className:"size-4"})})]},t.model))}),e.jsx("p",{className:"pt-1 text-xs text-muted-foreground",children:n("reasoning.miningModelsHint")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:m,onChange:t=>y(t.target.checked),className:"size-4 cursor-pointer"}),e.jsx("span",{children:n("reasoning.backfill")})]}),e.jsx(j,{size:"sm",onClick:E,disabled:!g||u||i.isPending,children:n(u?"reasoning.miningRunning":"reasoning.runMining")})]})]}),e.jsx(L,{open:v!==null,title:n("reasoning.wipeTracesTitle"),description:n("reasoning.wipeTracesDesc",{model:v??""}),variant:"destructive",confirmLabel:n("reasoning.wipeTraces"),onConfirm:N,onCancel:()=>b(null)})]})}let re=0;const G=()=>`pair-${re++}`,U=a=>Object.entries(a).map(([n,s])=>({id:G(),target:n,source:s}));function ie({status:a}){const{t:n}=Q(),s=O(),i=a.config.injection_enabled,l=a.per_model.filter(t=>t.has_thinking_text).map(t=>t.model),[g,p]=f.useState(()=>U(a.config.injection_map)),[u,m]=f.useState(!1),[y,v]=f.useState(a.config.injection_map);a.config.injection_map!==y&&(v(a.config.injection_map),p(U(a.config.injection_map)),m(!1));const b=t=>{s.mutate({injection_enabled:t},{onSuccess:()=>c.success(n("reasoning.configSaved")),onError:r=>c.error(P(r,n("reasoning.configSaveFailed")))})},N=(t,r)=>{p(x=>x.map(d=>d.id===t?{...d,...r}:d)),m(!0)},C=()=>{p(t=>[...t,{id:G(),target:"",source:l[0]??""}]),m(!0)},T=t=>{p(r=>r.filter(x=>x.id!==t)),m(!0)},E=()=>{const t=new Set,r={};for(const x of g){const d=x.target.trim(),q=x.source.trim();if(!(!d||!q)){if(t.has(d)){c.error(n("reasoning.duplicateTarget",{target:d}));return}t.add(d),r[d]=q}}s.mutate({injection_map:r},{onSuccess:()=>{c.success(n("reasoning.configSaved")),m(!1)},onError:x=>c.error(P(x,n("reasoning.configSaveFailed")))})};return e.jsxs(k,{children:[e.jsx(D,{children:e.jsx(F,{children:n("reasoning.injectionTitle")})}),e.jsxs(_,{className:"space-y-4 text-sm",children:[e.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:t=>b(t.target.checked),disabled:s.isPending,className:"size-4 cursor-pointer"}),e.jsx("span",{children:n("reasoning.injectionEnabled")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:n("reasoning.injectionMap")}),g.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n("reasoning.noMappings")}),g.map(t=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{value:t.source,onChange:r=>N(t.id,{source:r.target.value}),className:"w-40 rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs","aria-label":n("reasoning.source"),children:[!l.includes(t.source)&&t.source&&e.jsx("option",{value:t.source,children:t.source}),l.map(r=>e.jsx("option",{value:r,children:r},r))]}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("input",{type:"text",value:t.target,onChange:r=>N(t.id,{target:r.target.value}),placeholder:n("reasoning.targetPlaceholder"),className:"w-40 rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs","aria-label":n("reasoning.target")}),e.jsx(j,{variant:"ghost",size:"icon",onClick:()=>T(t.id),"aria-label":n("common.delete"),children:e.jsx(K,{className:"size-4"})})]},t.id)),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsxs(j,{variant:"outline",size:"sm",onClick:C,disabled:l.length===0,children:[e.jsx(V,{className:"size-4"})," ",n("reasoning.addMapping")]}),e.jsx(j,{size:"sm",onClick:E,disabled:!u||s.isPending,children:n("reasoning.save")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("reasoning.injectionMapHint")})]})]})]})}const S=20;function oe({detectedModels:a,categories:n}){const{t:s}=Q(),[i,l]=f.useState(""),[g,p]=f.useState(""),[u,m]=f.useState(0),[y,v]=f.useState(null),[b,N]=f.useState(null),{data:C,isLoading:T,isError:E,refetch:t}=ee(i,g,S,u),r=ne(),x=se(),d=C?.total??0,q=C?.patterns??[];C&&u>0&&u>=d&&m(Math.max(0,d-S));const B=()=>m(0),Z=()=>{if(!y)return;const o=y.id;v(null),r.mutate(o,{onSuccess:()=>c.success(s("reasoning.patternDeleted")),onError:()=>c.error(s("reasoning.patternDeleteFailed"))})},J=()=>{if(!b)return;const o=b;N(null),x.mutate(o,{onSuccess:I=>c.success(s("reasoning.patternsDeletedCount",{count:I.deleted})),onError:I=>c.error(P(I,s("reasoning.patternDeleteFailed")))})};return e.jsxs(k,{children:[e.jsx(D,{children:e.jsx(F,{children:s("reasoning.patternsTitle")})}),e.jsxs(_,{className:"space-y-4 text-sm",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("select",{value:i,onChange:o=>{l(o.target.value),B()},className:"rounded-md border border-border bg-background px-2 py-1.5 text-xs","aria-label":s("reasoning.filterModel"),children:[e.jsx("option",{value:"",children:s("reasoning.allModels")}),a.map(o=>e.jsx("option",{value:o,children:o},o))]}),e.jsxs("select",{value:g,onChange:o=>{p(o.target.value),B()},className:"rounded-md border border-border bg-background px-2 py-1.5 text-xs","aria-label":s("reasoning.filterCategory"),children:[e.jsx("option",{value:"",children:s("reasoning.allCategories")}),n.map(o=>e.jsx("option",{value:o,children:o},o))]}),i&&e.jsxs(j,{variant:"outline",size:"sm",className:"text-destructive",onClick:()=>N(i),disabled:x.isPending,children:[e.jsx(K,{className:"size-4"})," ",s("reasoning.deleteAllForModel")]})]}),T?e.jsx(H,{className:"h-32 w-full"}):E?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-destructive",children:s("reasoning.patternsError")}),e.jsx(j,{variant:"outline",size:"sm",onClick:()=>t(),children:s("common.retry")})]}):q.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("reasoning.noPatterns")}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[e.jsx("th",{className:"py-2 pr-3 font-medium",children:s("reasoning.colTitle")}),e.jsx("th",{className:"py-2 pr-3 font-medium",children:s("reasoning.colModel")}),e.jsx("th",{className:"py-2 pr-3 font-medium",children:s("reasoning.colCategory")}),e.jsx("th",{className:"py-2 pr-3 text-right font-medium",children:s("reasoning.colConfidence")}),e.jsx("th",{className:"py-2 pr-3 text-right font-medium",children:s("reasoning.colFrequency")}),e.jsx("th",{className:"py-2 font-medium"})]})}),e.jsx("tbody",{children:q.map(o=>e.jsxs("tr",{className:"border-b border-border/50",children:[e.jsx("td",{className:"py-2 pr-3",children:o.title}),e.jsx("td",{className:"py-2 pr-3 font-mono text-xs",children:o.source_model}),e.jsx("td",{className:"py-2 pr-3",children:e.jsx(W,{variant:"secondary",children:o.category})}),e.jsxs("td",{className:"py-2 pr-3 text-right font-mono",children:[Math.round(o.confidence*100),"%"]}),e.jsx("td",{className:"py-2 pr-3 text-right font-mono",children:o.frequency}),e.jsx("td",{className:"py-2 text-right",children:e.jsx(j,{variant:"ghost",size:"icon",onClick:()=>v(o),"aria-label":s("common.delete"),children:e.jsx(K,{className:"size-4"})})})]},o.id))})]})}),d>S&&e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[u+1,"–",Math.min(u+S,d)," / ",d]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{variant:"outline",size:"sm",disabled:u===0,onClick:()=>m(Math.max(0,u-S)),children:s("common.prev")}),e.jsx(j,{variant:"outline",size:"sm",disabled:u+S>=d,onClick:()=>m(u+S),children:s("common.next")})]})]})]}),e.jsx(L,{open:y!==null,title:s("reasoning.deletePatternTitle"),description:s("reasoning.deletePatternDesc",{title:y?.title??""}),variant:"destructive",confirmLabel:s("common.delete"),onConfirm:Z,onCancel:()=>v(null)}),e.jsx(L,{open:b!==null,title:s("reasoning.deleteAllTitle"),description:s("reasoning.deleteAllDesc",{model:b??""}),variant:"destructive",confirmLabel:s("common.delete"),onConfirm:J,onCancel:()=>N(null)})]})}function R({label:a,value:n}){return e.jsxs(k,{children:[e.jsx(D,{className:"pb-2",children:e.jsx(F,{className:"text-sm font-medium text-muted-foreground",children:a})}),e.jsx(_,{children:e.jsx("p",{className:"font-mono text-2xl font-bold",children:n.toLocaleString()})})]})}function le({status:a}){const{t:n}=Q(),s=a.per_model.filter(i=>i.pattern_count>0);return s.length===0?null:e.jsxs(k,{children:[e.jsx(D,{children:e.jsx(F,{children:n("reasoning.coverageTitle")})}),e.jsx(_,{className:"space-y-4 text-sm",children:s.map(i=>{const l=a.coverage_by_model[i.model]??[];return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-mono text-xs",children:i.model}),e.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[i.coverage_percent,"%"]})]}),e.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${i.coverage_percent}%`}})}),l.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:l.map(g=>e.jsxs(W,{variant:g.covered?"success":"outline",children:[g.category," (",g.pattern_count,")"]},g.category))})]},i.model)})})]})}function je(){const{t:a}=Q(),n=w(),{data:s,isLoading:i,isError:l,refetch:g}=X(),p=s?.mining.running??!1,u=f.useRef(p);return f.useEffect(()=>{u.current&&!p&&n.invalidateQueries({queryKey:["reasoning","patterns"]}),u.current=p},[p,n]),e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:a("reasoning.pageTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("reasoning.pageSubtitle")})]}),i?e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-4",children:[0,1,2,3].map(m=>e.jsx(H,{className:"h-24 w-full"},m))}):l||!s?e.jsx(k,{children:e.jsxs(_,{className:"space-y-2 p-6",children:[e.jsx("p",{className:"text-sm text-destructive",children:a("reasoning.statusError")}),e.jsx(j,{variant:"outline",size:"sm",onClick:()=>g(),children:a("common.retry")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-4",children:[e.jsx(R,{label:a("reasoning.kpiTraces"),value:s.total_traces}),e.jsx(R,{label:a("reasoning.kpiUnprocessed"),value:s.unprocessed_traces}),e.jsx(R,{label:a("reasoning.kpiPatterns"),value:s.total_patterns}),e.jsx(R,{label:a("reasoning.kpiModels"),value:s.detected_models.length})]}),s.total_traces===0&&!s.mining.running&&e.jsx(k,{children:e.jsx(_,{className:"p-6 text-sm text-muted-foreground",children:a("reasoning.emptyState")})}),e.jsx(le,{status:s}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsx(ae,{status:s}),e.jsx(ie,{status:s})]}),e.jsx(oe,{detectedModels:s.detected_models,categories:s.config.categories})]})]})}export{je as default}; diff --git a/src/surreal_memory/server/static/dist/assets/SettingsPage-CcFz-Brq.js b/src/surreal_memory/server/static/dist/assets/SettingsPage-Dq3EMb_r.js similarity index 97% rename from src/surreal_memory/server/static/dist/assets/SettingsPage-CcFz-Brq.js rename to src/surreal_memory/server/static/dist/assets/SettingsPage-Dq3EMb_r.js index 5b62b48e..47eaf72c 100644 --- a/src/surreal_memory/server/static/dist/assets/SettingsPage-CcFz-Brq.js +++ b/src/surreal_memory/server/static/dist/assets/SettingsPage-Dq3EMb_r.js @@ -1 +1 @@ -import{u as B,b as T,j as e}from"./vendor-query-CqA1cBNl.js";import{o as C,u as L,f as w,B as p,p as P,q as M,r as z,a as _,t as d,s as D,b as A,v as R,w as U,x as O,y as I}from"./index-DXL5wCpD.js";import{C as u,a as x,b as g,c as h}from"./card-Duzfr-hx.js";import{R as K,S as $,T as q,E as G}from"./vendor-icons-C6dhS1UE.js";import{S as y}from"./skeleton-CBW-y0cP.js";import{r as S}from"./vendor-react-BfuodpLv.js";import{P as H}from"./ProGate-DjphnyL3.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const V={status:["telegram","status"]};function W(){return B({queryKey:V.status,queryFn:()=>C.get("/api/dashboard/telegram/status"),retry:!1})}function Q(){return T({mutationFn:()=>C.post("/api/dashboard/telegram/test",{})})}function Y(){return T({mutationFn:t=>C.post("/api/dashboard/telegram/backup",{brain:t})})}const J={configured:"success",warning:"warning",not_configured:"secondary",info:"default"};function X(){const{data:t,isLoading:l}=L(),{t:o}=w();return e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:o("settings.configStatus")})}),e.jsx(h,{children:l?e.jsx("div",{className:"space-y-3",children:Array.from({length:4}).map((a,n)=>e.jsx(y,{className:"h-14 w-full"},n))}):e.jsx("div",{className:"space-y-2",children:t?.items.map(a=>e.jsxs("div",{className:"rounded-lg border border-border/50 px-3 py-2 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:a.label}),e.jsx(p,{variant:J[a.status],children:a.status})]}),a.value&&e.jsx("p",{className:"font-mono text-xs text-foreground/80",children:a.value}),a.description&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.description}),a.command&&e.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:a.command})]},a.key))})})]})}const Z=[{value:"sentence_transformer",label:"Sentence Transformer (Local)"},{value:"ollama",label:"Ollama (Local)"},{value:"gemini",label:"Gemini (Google)"},{value:"openai",label:"OpenAI"},{value:"openrouter",label:"OpenRouter"}],F={sentence_transformer:"all-MiniLM-L6-v2",ollama:"nomic-embed-text",gemini:"text-embedding-004",openai:"text-embedding-3-small",openrouter:"openai/text-embedding-3-small"};function ee(){const{t}=w(),{data:l}=P(),o=M(),a=z(),[n,f]=S.useState({enabled:!1,provider:"sentence_transformer",model:F.sentence_transformer,similarity_threshold:.7}),[b,m]=S.useState(!1);S.useEffect(()=>{if(!l)return;const r={enabled:l.enabled,provider:l.provider??"sentence_transformer",model:l.model,similarity_threshold:l.similarity_threshold};f(r),m(!1)},[l]);function s(r,i){f(c=>{const j={...c,[r]:i};return r==="provider"&&(j.model=F[i]),j}),m(!0)}const v=()=>{a.mutate(void 0,{onSuccess:r=>{r.status==="ok"?d.success(t("settings.embeddingTestOk",{provider:r.provider,dimension:r.dimension})):d.error(t("settings.embeddingTestFail",{error:r.error??"Unknown error"}))},onError:()=>d.error(t("settings.embeddingTestFail",{error:"Network error"}))})},k=()=>{o.mutate({embedding:{enabled:n.enabled,provider:n.provider,model:n.model,similarity_threshold:n.similarity_threshold}},{onSuccess:()=>{d.success(t("settings.embeddingSaved")),m(!1)},onError:()=>d.error(t("settings.embeddingSaveFailed"))})};return e.jsx(H,{label:t("settings.proFeature"),children:e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:t("settings.embeddingConfig")})}),e.jsxs(h,{className:"space-y-4 text-sm",children:[e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n.enabled,onChange:r=>s("enabled",r.target.checked),className:"size-4 cursor-pointer"}),e.jsx("span",{children:t("settings.embeddingEnabled")})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"embedding-provider",children:t("settings.embeddingProvider")}),e.jsx("select",{id:"embedding-provider",value:n.provider,onChange:r=>s("provider",r.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm cursor-pointer focus:outline-none focus:ring-2 focus:ring-ring",children:Z.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"embedding-model",children:t("settings.embeddingModel")}),e.jsx("input",{id:"embedding-model",type:"text",value:n.model,onChange:r=>s("model",r.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"embedding-threshold",children:t("settings.embeddingThreshold")}),e.jsx("span",{className:"font-mono text-xs",children:n.similarity_threshold.toFixed(2)})]}),e.jsx("input",{id:"embedding-threshold",type:"range",min:"0",max:"1",step:"0.05",value:n.similarity_threshold,onChange:r=>s("similarity_threshold",parseFloat(r.target.value)),className:"w-full cursor-pointer accent-primary"})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:v,disabled:a.isPending,className:"cursor-pointer",children:a.isPending?t("settings.embeddingTesting"):t("settings.embeddingTest")}),e.jsx(_,{size:"sm",onClick:k,disabled:!b||o.isPending,className:"cursor-pointer",children:o.isPending?t("settings.embeddingSaving"):t("settings.embeddingSave")})]})]})]})})}function se(){const{data:t,isLoading:l}=D(),{t:o}=w(),a=()=>t?t.running?e.jsx(p,{variant:"success",children:o("settings.watcherRunning")}):t.enabled?e.jsx(p,{variant:"warning",children:o("settings.watcherStopped")}):e.jsx(p,{variant:"secondary",children:o("settings.watcherDisabled")}):null;return e.jsxs(u,{children:[e.jsx(x,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(g,{children:o("settings.watcher")}),l?e.jsx(y,{className:"h-5 w-16"}):a()]})}),e.jsx(h,{className:"space-y-4 text-sm",children:l?e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{className:"h-4 w-full"}),e.jsx(y,{className:"h-4 w-3/4"})]}):t?e.jsxs(e.Fragment,{children:[t.paths.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wide",children:o("settings.watcherPaths")}),e.jsx("div",{className:"space-y-1",children:t.paths.map(n=>e.jsx("p",{className:"font-mono text-xs truncate text-foreground",title:n,children:n},n))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wide",children:o("settings.watcherRecent")}),t.recent.length>0?e.jsx("div",{className:"space-y-1",children:t.recent.slice(0,5).map((n,f)=>e.jsxs("div",{className:"flex items-center justify-between rounded border border-border/50 px-2 py-1.5",children:[e.jsx("span",{className:"font-mono text-xs truncate max-w-[200px] text-foreground",title:n.path,children:n.path.split(/[/\\]/).pop()}),e.jsxs("span",{className:"shrink-0 ml-2 font-mono text-xs text-muted-foreground",children:["+",n.neurons_created]})]},f))}):e.jsx("p",{className:"text-xs text-muted-foreground",children:o("settings.watcherNoActivity")})]})]}):null})]})}const te=[K,$,q],ne=["#ef4444","#6366f1","#a8a29e"],re=["reportBug","featureRequest","discussions"],ae=["https://github.com/acidkill/surreal-memory/issues/new?template=bug_report.md","https://github.com/acidkill/surreal-memory/issues/new?template=feature_request.md","https://github.com/acidkill/surreal-memory/discussions"];function he(){const{data:t}=A(),{data:l}=R(),{data:o}=U(),{data:a}=O(),{data:n,isLoading:f}=W(),b=Q(),m=Y(),{t:s}=w(),v=i=>{if(i===0)return"0 B";const c=1024,j=["B","KB","MB","GB"],N=Math.floor(Math.log(i)/Math.log(c));return`${(i/Math.pow(c,N)).toFixed(1)} ${j[N]}`},k=()=>{b.mutate(void 0,{onSuccess:i=>{i.status==="success"?d.success(s("settings.testSuccess")):d.error(s("settings.testPartial"))},onError:()=>{d.error(s("settings.testFailed"))}})},r=()=>{m.mutate(void 0,{onSuccess:i=>{i.sent_to>0?d.success(s("settings.backupSuccess",{brain:i.brain,size:i.size_mb,count:i.sent_to})):d.error(s("settings.backupSendFailed"))},onError:()=>{d.error(s("settings.backupFailed"))}})};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("settings.title")}),e.jsx(X,{}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.general")})}),e.jsxs(h,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.version")}),e.jsx("span",{className:"font-mono",children:l?.version??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.activeBrain")}),e.jsx("span",{className:"font-mono",children:t?.active_brain??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.totalBrains")}),e.jsx("span",{className:"font-mono",children:t?.total_brains??"-"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-muted-foreground",children:s("license.tier","License")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{variant:a?.is_pro?"success":"secondary",children:(a?.tier??"free").toUpperCase()}),!a?.is_pro&&e.jsx("button",{onClick:I,className:"text-xs font-medium text-primary hover:text-primary/80 transition-colors cursor-pointer",children:s("upgrade.title","Upgrade")})]})]})]})]}),e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.brainFiles")})}),e.jsx(h,{className:"space-y-3 text-sm",children:o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.brainsDirectory")}),e.jsx("span",{className:"font-mono text-xs max-w-[200px] truncate",title:o.brains_dir,children:o.brains_dir})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.totalDiskUsage")}),e.jsx("span",{className:"font-mono",children:v(o.total_size_bytes)})]}),o.brains.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:o.brains.map(i=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border/50 px-3 py-2",children:[e.jsx("span",{className:"font-mono font-medium",children:i.name}),e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:v(i.size_bytes)})]},i.name))})]}):e.jsx("p",{className:"text-muted-foreground",children:s("common.loading")})})]}),e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.telegramBackup")})}),e.jsx(h,{className:"space-y-4 text-sm",children:f?e.jsx("p",{className:"text-muted-foreground",children:s("common.loading")}):n?.configured?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{variant:"success",children:s("settings.connected")}),n.bot_name&&e.jsxs("span",{className:"text-muted-foreground",children:[n.bot_name,n.bot_username&&e.jsxs("span",{className:"font-mono text-xs",children:[" @",n.bot_username]})]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.chatIds")}),e.jsx("span",{className:"font-mono text-xs",children:n.chat_ids.length>0?n.chat_ids.join(", "):s("common.none")})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.autoBackup")}),e.jsx("span",{className:"font-mono",children:n.backup_on_consolidation?s("common.yes"):s("common.no")})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:k,disabled:b.isPending,className:"cursor-pointer",children:b.isPending?s("settings.sending"):s("settings.sendTest")}),e.jsx(_,{size:"sm",onClick:r,disabled:m.isPending,className:"cursor-pointer",children:m.isPending?s("settings.backingUp"):s("settings.backupNow")})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(p,{variant:"warning",children:s("settings.notConfigured")})}),n?.error&&e.jsx("p",{className:"text-xs text-destructive",children:n.error}),e.jsx("p",{className:"text-xs text-muted-foreground",dangerouslySetInnerHTML:{__html:s("settings.telegramSetup")}})]})})]}),e.jsx(se,{}),e.jsx(ee,{}),e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.feedbackTitle")})}),e.jsx(h,{className:"space-y-3",children:re.map((i,c)=>{const j=te[c],N=ne[c],E=ae[c];return e.jsxs("a",{href:E,target:"_blank",rel:"noopener noreferrer",className:"flex items-start gap-3 rounded-lg border border-border/50 p-3 transition-colors hover:bg-accent cursor-pointer",children:[e.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${N}15`},children:e.jsx(j,{className:"size-4",style:{color:N}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:s(`settings.${i}`)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s(`settings.${i}Desc`)})]}),e.jsx(G,{className:"size-3.5 shrink-0 text-muted-foreground mt-0.5"})]},i)})})]})]})]})}export{he as default}; +import{u as B,b as T,j as e}from"./vendor-query-CqA1cBNl.js";import{o as C,u as L,f as w,B as p,p as P,q as M,r as z,a as _,t as d,s as D,b as A,v as R,w as U,x as O,y as I}from"./index-CLb-kMYl.js";import{C as u,a as x,b as g,c as h}from"./card-DG4oK1Wy.js";import{R as K,S as $,T as q,E as G}from"./vendor-icons-C6dhS1UE.js";import{S as y}from"./skeleton-gKUrR2fT.js";import{r as S}from"./vendor-react-BfuodpLv.js";import{P as H}from"./ProGate-u3qkirgp.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const V={status:["telegram","status"]};function W(){return B({queryKey:V.status,queryFn:()=>C.get("/api/dashboard/telegram/status"),retry:!1})}function Q(){return T({mutationFn:()=>C.post("/api/dashboard/telegram/test",{})})}function Y(){return T({mutationFn:t=>C.post("/api/dashboard/telegram/backup",{brain:t})})}const J={configured:"success",warning:"warning",not_configured:"secondary",info:"default"};function X(){const{data:t,isLoading:l}=L(),{t:o}=w();return e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:o("settings.configStatus")})}),e.jsx(h,{children:l?e.jsx("div",{className:"space-y-3",children:Array.from({length:4}).map((a,n)=>e.jsx(y,{className:"h-14 w-full"},n))}):e.jsx("div",{className:"space-y-2",children:t?.items.map(a=>e.jsxs("div",{className:"rounded-lg border border-border/50 px-3 py-2 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:a.label}),e.jsx(p,{variant:J[a.status],children:a.status})]}),a.value&&e.jsx("p",{className:"font-mono text-xs text-foreground/80",children:a.value}),a.description&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.description}),a.command&&e.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:a.command})]},a.key))})})]})}const Z=[{value:"sentence_transformer",label:"Sentence Transformer (Local)"},{value:"ollama",label:"Ollama (Local)"},{value:"gemini",label:"Gemini (Google)"},{value:"openai",label:"OpenAI"},{value:"openrouter",label:"OpenRouter"}],F={sentence_transformer:"all-MiniLM-L6-v2",ollama:"nomic-embed-text",gemini:"text-embedding-004",openai:"text-embedding-3-small",openrouter:"openai/text-embedding-3-small"};function ee(){const{t}=w(),{data:l}=P(),o=M(),a=z(),[n,f]=S.useState({enabled:!1,provider:"sentence_transformer",model:F.sentence_transformer,similarity_threshold:.7}),[b,m]=S.useState(!1);S.useEffect(()=>{if(!l)return;const r={enabled:l.enabled,provider:l.provider??"sentence_transformer",model:l.model,similarity_threshold:l.similarity_threshold};f(r),m(!1)},[l]);function s(r,i){f(c=>{const j={...c,[r]:i};return r==="provider"&&(j.model=F[i]),j}),m(!0)}const v=()=>{a.mutate(void 0,{onSuccess:r=>{r.status==="ok"?d.success(t("settings.embeddingTestOk",{provider:r.provider,dimension:r.dimension})):d.error(t("settings.embeddingTestFail",{error:r.error??"Unknown error"}))},onError:()=>d.error(t("settings.embeddingTestFail",{error:"Network error"}))})},k=()=>{o.mutate({embedding:{enabled:n.enabled,provider:n.provider,model:n.model,similarity_threshold:n.similarity_threshold}},{onSuccess:()=>{d.success(t("settings.embeddingSaved")),m(!1)},onError:()=>d.error(t("settings.embeddingSaveFailed"))})};return e.jsx(H,{label:t("settings.proFeature"),children:e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:t("settings.embeddingConfig")})}),e.jsxs(h,{className:"space-y-4 text-sm",children:[e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n.enabled,onChange:r=>s("enabled",r.target.checked),className:"size-4 cursor-pointer"}),e.jsx("span",{children:t("settings.embeddingEnabled")})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"embedding-provider",children:t("settings.embeddingProvider")}),e.jsx("select",{id:"embedding-provider",value:n.provider,onChange:r=>s("provider",r.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm cursor-pointer focus:outline-none focus:ring-2 focus:ring-ring",children:Z.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"embedding-model",children:t("settings.embeddingModel")}),e.jsx("input",{id:"embedding-model",type:"text",value:n.model,onChange:r=>s("model",r.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"embedding-threshold",children:t("settings.embeddingThreshold")}),e.jsx("span",{className:"font-mono text-xs",children:n.similarity_threshold.toFixed(2)})]}),e.jsx("input",{id:"embedding-threshold",type:"range",min:"0",max:"1",step:"0.05",value:n.similarity_threshold,onChange:r=>s("similarity_threshold",parseFloat(r.target.value)),className:"w-full cursor-pointer accent-primary"})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:v,disabled:a.isPending,className:"cursor-pointer",children:a.isPending?t("settings.embeddingTesting"):t("settings.embeddingTest")}),e.jsx(_,{size:"sm",onClick:k,disabled:!b||o.isPending,className:"cursor-pointer",children:o.isPending?t("settings.embeddingSaving"):t("settings.embeddingSave")})]})]})]})})}function se(){const{data:t,isLoading:l}=D(),{t:o}=w(),a=()=>t?t.running?e.jsx(p,{variant:"success",children:o("settings.watcherRunning")}):t.enabled?e.jsx(p,{variant:"warning",children:o("settings.watcherStopped")}):e.jsx(p,{variant:"secondary",children:o("settings.watcherDisabled")}):null;return e.jsxs(u,{children:[e.jsx(x,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(g,{children:o("settings.watcher")}),l?e.jsx(y,{className:"h-5 w-16"}):a()]})}),e.jsx(h,{className:"space-y-4 text-sm",children:l?e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{className:"h-4 w-full"}),e.jsx(y,{className:"h-4 w-3/4"})]}):t?e.jsxs(e.Fragment,{children:[t.paths.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wide",children:o("settings.watcherPaths")}),e.jsx("div",{className:"space-y-1",children:t.paths.map(n=>e.jsx("p",{className:"font-mono text-xs truncate text-foreground",title:n,children:n},n))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wide",children:o("settings.watcherRecent")}),t.recent.length>0?e.jsx("div",{className:"space-y-1",children:t.recent.slice(0,5).map((n,f)=>e.jsxs("div",{className:"flex items-center justify-between rounded border border-border/50 px-2 py-1.5",children:[e.jsx("span",{className:"font-mono text-xs truncate max-w-[200px] text-foreground",title:n.path,children:n.path.split(/[/\\]/).pop()}),e.jsxs("span",{className:"shrink-0 ml-2 font-mono text-xs text-muted-foreground",children:["+",n.neurons_created]})]},f))}):e.jsx("p",{className:"text-xs text-muted-foreground",children:o("settings.watcherNoActivity")})]})]}):null})]})}const te=[K,$,q],ne=["#ef4444","#6366f1","#a8a29e"],re=["reportBug","featureRequest","discussions"],ae=["https://github.com/acidkill/surreal-memory/issues/new?template=bug_report.md","https://github.com/acidkill/surreal-memory/issues/new?template=feature_request.md","https://github.com/acidkill/surreal-memory/discussions"];function he(){const{data:t}=A(),{data:l}=R(),{data:o}=U(),{data:a}=O(),{data:n,isLoading:f}=W(),b=Q(),m=Y(),{t:s}=w(),v=i=>{if(i===0)return"0 B";const c=1024,j=["B","KB","MB","GB"],N=Math.floor(Math.log(i)/Math.log(c));return`${(i/Math.pow(c,N)).toFixed(1)} ${j[N]}`},k=()=>{b.mutate(void 0,{onSuccess:i=>{i.status==="success"?d.success(s("settings.testSuccess")):d.error(s("settings.testPartial"))},onError:()=>{d.error(s("settings.testFailed"))}})},r=()=>{m.mutate(void 0,{onSuccess:i=>{i.sent_to>0?d.success(s("settings.backupSuccess",{brain:i.brain,size:i.size_mb,count:i.sent_to})):d.error(s("settings.backupSendFailed"))},onError:()=>{d.error(s("settings.backupFailed"))}})};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("settings.title")}),e.jsx(X,{}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.general")})}),e.jsxs(h,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.version")}),e.jsx("span",{className:"font-mono",children:l?.version??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.activeBrain")}),e.jsx("span",{className:"font-mono",children:t?.active_brain??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.totalBrains")}),e.jsx("span",{className:"font-mono",children:t?.total_brains??"-"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-muted-foreground",children:s("license.tier","License")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{variant:a?.is_pro?"success":"secondary",children:(a?.tier??"free").toUpperCase()}),!a?.is_pro&&e.jsx("button",{onClick:I,className:"text-xs font-medium text-primary hover:text-primary/80 transition-colors cursor-pointer",children:s("upgrade.title","Upgrade")})]})]})]})]}),e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.brainFiles")})}),e.jsx(h,{className:"space-y-3 text-sm",children:o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.brainsDirectory")}),e.jsx("span",{className:"font-mono text-xs max-w-[200px] truncate",title:o.brains_dir,children:o.brains_dir})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.totalDiskUsage")}),e.jsx("span",{className:"font-mono",children:v(o.total_size_bytes)})]}),o.brains.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:o.brains.map(i=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border/50 px-3 py-2",children:[e.jsx("span",{className:"font-mono font-medium",children:i.name}),e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:v(i.size_bytes)})]},i.name))})]}):e.jsx("p",{className:"text-muted-foreground",children:s("common.loading")})})]}),e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.telegramBackup")})}),e.jsx(h,{className:"space-y-4 text-sm",children:f?e.jsx("p",{className:"text-muted-foreground",children:s("common.loading")}):n?.configured?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{variant:"success",children:s("settings.connected")}),n.bot_name&&e.jsxs("span",{className:"text-muted-foreground",children:[n.bot_name,n.bot_username&&e.jsxs("span",{className:"font-mono text-xs",children:[" @",n.bot_username]})]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.chatIds")}),e.jsx("span",{className:"font-mono text-xs",children:n.chat_ids.length>0?n.chat_ids.join(", "):s("common.none")})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.autoBackup")}),e.jsx("span",{className:"font-mono",children:n.backup_on_consolidation?s("common.yes"):s("common.no")})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:k,disabled:b.isPending,className:"cursor-pointer",children:b.isPending?s("settings.sending"):s("settings.sendTest")}),e.jsx(_,{size:"sm",onClick:r,disabled:m.isPending,className:"cursor-pointer",children:m.isPending?s("settings.backingUp"):s("settings.backupNow")})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(p,{variant:"warning",children:s("settings.notConfigured")})}),n?.error&&e.jsx("p",{className:"text-xs text-destructive",children:n.error}),e.jsx("p",{className:"text-xs text-muted-foreground",dangerouslySetInnerHTML:{__html:s("settings.telegramSetup")}})]})})]}),e.jsx(se,{}),e.jsx(ee,{}),e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.feedbackTitle")})}),e.jsx(h,{className:"space-y-3",children:re.map((i,c)=>{const j=te[c],N=ne[c],E=ae[c];return e.jsxs("a",{href:E,target:"_blank",rel:"noopener noreferrer",className:"flex items-start gap-3 rounded-lg border border-border/50 p-3 transition-colors hover:bg-accent cursor-pointer",children:[e.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${N}15`},children:e.jsx(j,{className:"size-4",style:{color:N}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:s(`settings.${i}`)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s(`settings.${i}Desc`)})]}),e.jsx(G,{className:"size-3.5 shrink-0 text-muted-foreground mt-0.5"})]},i)})})]})]})]})}export{he as default}; diff --git a/src/surreal_memory/server/static/dist/assets/StoragePage-BsRzooql.js b/src/surreal_memory/server/static/dist/assets/StoragePage-CO4TVbcW.js similarity index 96% rename from src/surreal_memory/server/static/dist/assets/StoragePage-BsRzooql.js rename to src/surreal_memory/server/static/dist/assets/StoragePage-CO4TVbcW.js index 3ce2286b..50300059 100644 --- a/src/surreal_memory/server/static/dist/assets/StoragePage-BsRzooql.js +++ b/src/surreal_memory/server/static/dist/assets/StoragePage-CO4TVbcW.js @@ -1 +1 @@ -import{u as c,j as e}from"./vendor-query-CqA1cBNl.js";import{o as x,f as i,B as n}from"./index-DXL5wCpD.js";import{C as m,a as u,b as h,c as g}from"./card-Duzfr-hx.js";import{a1 as d,y as p,A as N,q as b}from"./vendor-icons-C6dhS1UE.js";import{S as o}from"./skeleton-CBW-y0cP.js";import"./vendor-react-BfuodpLv.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const j={status:["storage","status"],tierStats:["storage","tier-stats"]};function y(){return c({queryKey:j.status,queryFn:()=>x.get("/api/dashboard/storage/status")})}function v(){return c({queryKey:j.tierStats,queryFn:()=>x.get("/api/dashboard/tier-stats")})}function S({status:s}){const{t:a}=i();return e.jsxs(m,{children:[e.jsx(u,{className:"pb-3",children:e.jsxs(h,{className:"flex items-center gap-2 text-base",children:[e.jsx(d,{className:"size-5","aria-hidden":"true"}),a("storage.currentBackend","Storage Backend")]})}),e.jsxs(g,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(n,{variant:"default",className:"text-sm px-3 py-1",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(d,{className:"size-3.5","aria-hidden":"true"}),"SurrealDB"]})}),e.jsx(n,{variant:s.healthy?"outline":"destructive",className:"text-xs",children:s.healthy?a("storage.connected","Connected"):a("storage.disconnected","Disconnected")}),s.health_grade&&e.jsxs(n,{variant:"secondary",className:"text-xs",children:[a("storage.grade","Grade"),": ",s.health_grade]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.healthy?e.jsx(p,{className:"size-4 shrink-0 text-green-500","aria-hidden":"true"}):e.jsx(N,{className:"size-4 shrink-0 text-destructive","aria-hidden":"true"}),e.jsx("span",{className:"text-muted-foreground break-all",children:s.url||a("storage.urlUnknown","URL unknown")})]}),(s.namespace||s.database)&&e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm text-muted-foreground",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-foreground",children:a("storage.namespace","Namespace")}),e.jsx("p",{className:"truncate",children:s.namespace||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-foreground",children:a("storage.database","Database")}),e.jsx("p",{className:"truncate",children:s.database||"—"})]})]}),e.jsxs("dl",{className:"grid grid-cols-3 gap-3 text-center",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:a("storage.neurons","Neurons")}),e.jsx("dd",{className:"text-lg font-semibold",children:s.neuron_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:a("storage.synapses","Synapses")}),e.jsx("dd",{className:"text-lg font-semibold",children:s.synapse_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:a("storage.fibers","Fibers")}),e.jsx("dd",{className:"text-lg font-semibold",children:s.fiber_count.toLocaleString()})]})]})]})]})}function l({label:s,count:a,total:t,color:r}){const f=t>0?a/t*100:0;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block size-2.5 rounded-full",style:{backgroundColor:r},"aria-hidden":"true"}),s]}),e.jsx("span",{className:"font-mono font-semibold tabular-nums",children:a})]}),e.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${f}%`,backgroundColor:r}})})]})}function k({data:s}){const{t:a}=i();return e.jsxs(m,{children:[e.jsx(u,{className:"pb-3",children:e.jsxs(h,{className:"flex items-center gap-2 text-base",children:[e.jsx(b,{className:"size-5","aria-hidden":"true"}),a("storage.tierDistribution")]})}),e.jsxs(g,{className:"space-y-4",children:[e.jsx(l,{label:a("storage.tierHot"),count:s.hot,total:s.total,color:"#ef4444"}),e.jsx(l,{label:a("storage.tierWarm"),count:s.warm,total:s.total,color:"#f59e0b"}),e.jsx(l,{label:a("storage.tierCold"),count:s.cold,total:s.total,color:"#3b82f6"}),e.jsxs("div",{className:"pt-2 border-t text-sm text-muted-foreground",children:[a("storage.totalMemories"),": ",e.jsx("span",{className:"font-mono font-semibold text-foreground",children:s.total})]})]})]})}function _(){const{data:s,isLoading:a}=y(),{data:t}=v(),{t:r}=i();return a||!s?e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"text-2xl font-bold",children:r("storage.title")}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(o,{className:"h-48"}),e.jsx(o,{className:"h-48"})]})]}):e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"text-2xl font-bold",children:r("storage.title")}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(S,{status:s}),t&&t.total>0&&e.jsx(k,{data:t})]})]})}export{_ as default}; +import{u as c,j as e}from"./vendor-query-CqA1cBNl.js";import{o as x,f as i,B as n}from"./index-CLb-kMYl.js";import{C as m,a as u,b as h,c as g}from"./card-DG4oK1Wy.js";import{a1 as d,y as p,A as N,q as b}from"./vendor-icons-C6dhS1UE.js";import{S as o}from"./skeleton-gKUrR2fT.js";import"./vendor-react-BfuodpLv.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const j={status:["storage","status"],tierStats:["storage","tier-stats"]};function y(){return c({queryKey:j.status,queryFn:()=>x.get("/api/dashboard/storage/status")})}function v(){return c({queryKey:j.tierStats,queryFn:()=>x.get("/api/dashboard/tier-stats")})}function S({status:s}){const{t:a}=i();return e.jsxs(m,{children:[e.jsx(u,{className:"pb-3",children:e.jsxs(h,{className:"flex items-center gap-2 text-base",children:[e.jsx(d,{className:"size-5","aria-hidden":"true"}),a("storage.currentBackend","Storage Backend")]})}),e.jsxs(g,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(n,{variant:"default",className:"text-sm px-3 py-1",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(d,{className:"size-3.5","aria-hidden":"true"}),"SurrealDB"]})}),e.jsx(n,{variant:s.healthy?"outline":"destructive",className:"text-xs",children:s.healthy?a("storage.connected","Connected"):a("storage.disconnected","Disconnected")}),s.health_grade&&e.jsxs(n,{variant:"secondary",className:"text-xs",children:[a("storage.grade","Grade"),": ",s.health_grade]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.healthy?e.jsx(p,{className:"size-4 shrink-0 text-green-500","aria-hidden":"true"}):e.jsx(N,{className:"size-4 shrink-0 text-destructive","aria-hidden":"true"}),e.jsx("span",{className:"text-muted-foreground break-all",children:s.url||a("storage.urlUnknown","URL unknown")})]}),(s.namespace||s.database)&&e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm text-muted-foreground",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-foreground",children:a("storage.namespace","Namespace")}),e.jsx("p",{className:"truncate",children:s.namespace||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-foreground",children:a("storage.database","Database")}),e.jsx("p",{className:"truncate",children:s.database||"—"})]})]}),e.jsxs("dl",{className:"grid grid-cols-3 gap-3 text-center",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:a("storage.neurons","Neurons")}),e.jsx("dd",{className:"text-lg font-semibold",children:s.neuron_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:a("storage.synapses","Synapses")}),e.jsx("dd",{className:"text-lg font-semibold",children:s.synapse_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:a("storage.fibers","Fibers")}),e.jsx("dd",{className:"text-lg font-semibold",children:s.fiber_count.toLocaleString()})]})]})]})]})}function l({label:s,count:a,total:t,color:r}){const f=t>0?a/t*100:0;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block size-2.5 rounded-full",style:{backgroundColor:r},"aria-hidden":"true"}),s]}),e.jsx("span",{className:"font-mono font-semibold tabular-nums",children:a})]}),e.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${f}%`,backgroundColor:r}})})]})}function k({data:s}){const{t:a}=i();return e.jsxs(m,{children:[e.jsx(u,{className:"pb-3",children:e.jsxs(h,{className:"flex items-center gap-2 text-base",children:[e.jsx(b,{className:"size-5","aria-hidden":"true"}),a("storage.tierDistribution")]})}),e.jsxs(g,{className:"space-y-4",children:[e.jsx(l,{label:a("storage.tierHot"),count:s.hot,total:s.total,color:"#ef4444"}),e.jsx(l,{label:a("storage.tierWarm"),count:s.warm,total:s.total,color:"#f59e0b"}),e.jsx(l,{label:a("storage.tierCold"),count:s.cold,total:s.total,color:"#3b82f6"}),e.jsxs("div",{className:"pt-2 border-t text-sm text-muted-foreground",children:[a("storage.totalMemories"),": ",e.jsx("span",{className:"font-mono font-semibold text-foreground",children:s.total})]})]})]})}function _(){const{data:s,isLoading:a}=y(),{data:t}=v(),{t:r}=i();return a||!s?e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"text-2xl font-bold",children:r("storage.title")}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(o,{className:"h-48"}),e.jsx(o,{className:"h-48"})]})]}):e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"text-2xl font-bold",children:r("storage.title")}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(S,{status:s}),t&&t.total>0&&e.jsx(k,{data:t})]})]})}export{_ as default}; diff --git a/src/surreal_memory/server/static/dist/assets/SyncPage-BRERoUGJ.js b/src/surreal_memory/server/static/dist/assets/SyncPage-DCUBw9Zr.js similarity index 98% rename from src/surreal_memory/server/static/dist/assets/SyncPage-BRERoUGJ.js rename to src/surreal_memory/server/static/dist/assets/SyncPage-DCUBw9Zr.js index dc07fa86..fcbf8e6c 100644 --- a/src/surreal_memory/server/static/dist/assets/SyncPage-BRERoUGJ.js +++ b/src/surreal_memory/server/static/dist/assets/SyncPage-DCUBw9Zr.js @@ -1 +1 @@ -import{u as z,a as L,b as E,j as e}from"./vendor-query-CqA1cBNl.js";import{r as y}from"./vendor-react-BfuodpLv.js";import{o as N,f as P,a as i,B as p,t as a}from"./index-DXL5wCpD.js";import{C as o,a as d,b as u,c as m}from"./card-Duzfr-hx.js";import{U as q,g as D,V as F,v as R,W as B,X as H}from"./vendor-icons-C6dhS1UE.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const b={status:["sync","status"]};function K(){return z({queryKey:b.status,queryFn:()=>N.get("/api/dashboard/sync-status"),refetchInterval:3e4})}function T(){const t=L();return E({mutationFn:x=>N.post("/api/dashboard/sync-config",x),onSuccess:()=>{t.invalidateQueries({queryKey:b.status})}})}const A="",I="https://your-worker.your-subdomain.workers.dev",Q={prefer_recent:"Prefer Recent",prefer_local:"Prefer Local",prefer_remote:"Prefer Remote",prefer_stronger:"Prefer Stronger"};function Y(){const{data:t,isLoading:x,refetch:v}=K(),r=T(),{t:s}=P(),[f,_]=y.useState(""),[j,g]=y.useState(""),[C,h]=y.useState(!1),k=()=>{const n=f.trim()||A,l=j.trim();if(!l){a.error(s("sync.keyRequired"));return}if(!l.startsWith("nmk_")){a.error(s("sync.keyInvalid"));return}r.mutate({hub_url:n,api_key:l,enabled:!0},{onSuccess:()=>{a.success(s("sync.connected")),h(!1),g("")},onError:()=>a.error(s("sync.connectFailed"))})},S=()=>{r.mutate({enabled:!1,api_key:"",hub_url:""},{onSuccess:()=>a.success(s("sync.disconnected")),onError:()=>a.error(s("sync.disconnectFailed"))})},w=n=>{r.mutate({conflict_strategy:n},{onSuccess:()=>a.success(s("sync.strategyUpdated")),onError:()=>a.error(s("sync.updateFailed"))})},U=n=>n?new Date(n).toLocaleString():s("sync.never");if(x)return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("sync.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("common.loading")})]});const c=t?.enabled&&t.api_key!=="(not set)";return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("sync.title")}),e.jsxs(i,{variant:"outline",size:"sm",onClick:()=>v(),className:"cursor-pointer",children:[e.jsx(q,{className:"mr-2 size-4"}),s("sync.refresh")]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[c?e.jsx(D,{className:"size-5 text-emerald-500"}):e.jsx(F,{className:"size-5 text-muted-foreground"}),s("sync.connectionStatus")]})}),e.jsxs(m,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.status")}),e.jsx(p,{variant:c?"success":"warning",children:s(c?"sync.cloudConnected":"sync.notConnected")})]}),c&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.hubUrl")}),e.jsx("span",{className:"max-w-[200px] truncate font-mono text-xs",title:t.hub_url,children:t.hub_url})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.apiKey")}),e.jsx("span",{className:"font-mono text-xs",children:t.api_key})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.deviceId")}),e.jsxs("span",{className:"font-mono text-xs",children:[t.device_id?.slice(0,12),"..."]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.syncMode")}),e.jsx(p,{variant:"success",children:s("sync.merkleDelta")})]})]}),e.jsx("div",{className:"flex gap-2 pt-2",children:c?e.jsx(i,{variant:"destructive",size:"sm",onClick:S,disabled:r.isPending,className:"cursor-pointer",children:s("sync.disconnect")}):e.jsx(i,{size:"sm",onClick:()=>h(!0),className:"cursor-pointer",children:s("sync.setupCloud")})})]})]}),C&&!c&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsx(u,{children:s("sync.setupTitle")})}),e.jsxs(m,{className:"space-y-4 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("sync.setupDesc")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"hub-url",className:"text-xs font-medium text-muted-foreground",children:s("sync.hubUrl")}),e.jsx("input",{id:"hub-url",type:"url",value:f,onChange:n=>_(n.target.value),placeholder:I,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"api-key",className:"text-xs font-medium text-muted-foreground",children:s("sync.apiKey")}),e.jsx("input",{id:"api-key",type:"password",value:j,onChange:n=>g(n.target.value),placeholder:"nmk_...",className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-ring"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("sync.keyHint")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i,{size:"sm",onClick:k,disabled:r.isPending,className:"cursor-pointer",children:r.isPending?s("sync.connecting"):s("sync.connect")}),e.jsx(i,{variant:"outline",size:"sm",onClick:()=>h(!1),className:"cursor-pointer",children:s("common.cancel")})]})]})]}),c&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(R,{className:"size-5"}),s("sync.devices")," (",t.device_count,")"]})}),e.jsx(m,{className:"space-y-3 text-sm",children:t.devices.length>0?t.devices.map(n=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border/50 px-3 py-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-mono text-xs font-medium",children:n.device_name||n.device_id.slice(0,12)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sync.lastSync"),": ",U(n.last_sync_at)]})]}),e.jsxs(p,{variant:"outline",className:"shrink-0",children:["seq ",n.last_sync_sequence]})]},n.device_id)):e.jsx("p",{className:"text-muted-foreground",children:s("sync.noDevices")})})]}),c&&t.change_log&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(B,{className:"size-5"}),s("sync.changeLog")]})}),e.jsxs(m,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.totalChanges")}),e.jsx("span",{className:"font-mono",children:t.change_log.total_changes})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.synced")}),e.jsx("span",{className:"font-mono text-emerald-500",children:t.change_log.synced_changes})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.pending")}),e.jsx("span",{className:"font-mono text-amber-500",children:t.change_log.unsynced_changes})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.latestSequence")}),e.jsx("span",{className:"font-mono",children:t.change_log.latest_sequence})]})]})]}),c&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(H,{className:"size-5"}),s("sync.conflictStrategy")]})}),e.jsxs(m,{className:"space-y-3 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("sync.conflictDesc")}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Object.entries(Q).map(([n,l])=>e.jsx("button",{onClick:()=>w(n),disabled:r.isPending,className:`cursor-pointer rounded-lg border px-3 py-2 text-xs font-medium transition-colors ${t.conflict_strategy===n?"border-primary bg-primary/10 text-primary":"border-border hover:bg-accent"}`,children:l},n))})]})]})]})]})}export{Y as default}; +import{u as z,a as L,b as E,j as e}from"./vendor-query-CqA1cBNl.js";import{r as y}from"./vendor-react-BfuodpLv.js";import{o as N,f as P,a as i,B as p,t as a}from"./index-CLb-kMYl.js";import{C as o,a as d,b as u,c as m}from"./card-DG4oK1Wy.js";import{U as q,g as D,V as F,v as R,W as B,X as H}from"./vendor-icons-C6dhS1UE.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const b={status:["sync","status"]};function K(){return z({queryKey:b.status,queryFn:()=>N.get("/api/dashboard/sync-status"),refetchInterval:3e4})}function T(){const t=L();return E({mutationFn:x=>N.post("/api/dashboard/sync-config",x),onSuccess:()=>{t.invalidateQueries({queryKey:b.status})}})}const A="",I="https://your-worker.your-subdomain.workers.dev",Q={prefer_recent:"Prefer Recent",prefer_local:"Prefer Local",prefer_remote:"Prefer Remote",prefer_stronger:"Prefer Stronger"};function Y(){const{data:t,isLoading:x,refetch:v}=K(),r=T(),{t:s}=P(),[f,_]=y.useState(""),[j,g]=y.useState(""),[C,h]=y.useState(!1),k=()=>{const n=f.trim()||A,l=j.trim();if(!l){a.error(s("sync.keyRequired"));return}if(!l.startsWith("nmk_")){a.error(s("sync.keyInvalid"));return}r.mutate({hub_url:n,api_key:l,enabled:!0},{onSuccess:()=>{a.success(s("sync.connected")),h(!1),g("")},onError:()=>a.error(s("sync.connectFailed"))})},S=()=>{r.mutate({enabled:!1,api_key:"",hub_url:""},{onSuccess:()=>a.success(s("sync.disconnected")),onError:()=>a.error(s("sync.disconnectFailed"))})},w=n=>{r.mutate({conflict_strategy:n},{onSuccess:()=>a.success(s("sync.strategyUpdated")),onError:()=>a.error(s("sync.updateFailed"))})},U=n=>n?new Date(n).toLocaleString():s("sync.never");if(x)return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("sync.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("common.loading")})]});const c=t?.enabled&&t.api_key!=="(not set)";return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("sync.title")}),e.jsxs(i,{variant:"outline",size:"sm",onClick:()=>v(),className:"cursor-pointer",children:[e.jsx(q,{className:"mr-2 size-4"}),s("sync.refresh")]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[c?e.jsx(D,{className:"size-5 text-emerald-500"}):e.jsx(F,{className:"size-5 text-muted-foreground"}),s("sync.connectionStatus")]})}),e.jsxs(m,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.status")}),e.jsx(p,{variant:c?"success":"warning",children:s(c?"sync.cloudConnected":"sync.notConnected")})]}),c&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.hubUrl")}),e.jsx("span",{className:"max-w-[200px] truncate font-mono text-xs",title:t.hub_url,children:t.hub_url})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.apiKey")}),e.jsx("span",{className:"font-mono text-xs",children:t.api_key})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.deviceId")}),e.jsxs("span",{className:"font-mono text-xs",children:[t.device_id?.slice(0,12),"..."]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.syncMode")}),e.jsx(p,{variant:"success",children:s("sync.merkleDelta")})]})]}),e.jsx("div",{className:"flex gap-2 pt-2",children:c?e.jsx(i,{variant:"destructive",size:"sm",onClick:S,disabled:r.isPending,className:"cursor-pointer",children:s("sync.disconnect")}):e.jsx(i,{size:"sm",onClick:()=>h(!0),className:"cursor-pointer",children:s("sync.setupCloud")})})]})]}),C&&!c&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsx(u,{children:s("sync.setupTitle")})}),e.jsxs(m,{className:"space-y-4 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("sync.setupDesc")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"hub-url",className:"text-xs font-medium text-muted-foreground",children:s("sync.hubUrl")}),e.jsx("input",{id:"hub-url",type:"url",value:f,onChange:n=>_(n.target.value),placeholder:I,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"api-key",className:"text-xs font-medium text-muted-foreground",children:s("sync.apiKey")}),e.jsx("input",{id:"api-key",type:"password",value:j,onChange:n=>g(n.target.value),placeholder:"nmk_...",className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-ring"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("sync.keyHint")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i,{size:"sm",onClick:k,disabled:r.isPending,className:"cursor-pointer",children:r.isPending?s("sync.connecting"):s("sync.connect")}),e.jsx(i,{variant:"outline",size:"sm",onClick:()=>h(!1),className:"cursor-pointer",children:s("common.cancel")})]})]})]}),c&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(R,{className:"size-5"}),s("sync.devices")," (",t.device_count,")"]})}),e.jsx(m,{className:"space-y-3 text-sm",children:t.devices.length>0?t.devices.map(n=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border/50 px-3 py-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-mono text-xs font-medium",children:n.device_name||n.device_id.slice(0,12)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sync.lastSync"),": ",U(n.last_sync_at)]})]}),e.jsxs(p,{variant:"outline",className:"shrink-0",children:["seq ",n.last_sync_sequence]})]},n.device_id)):e.jsx("p",{className:"text-muted-foreground",children:s("sync.noDevices")})})]}),c&&t.change_log&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(B,{className:"size-5"}),s("sync.changeLog")]})}),e.jsxs(m,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.totalChanges")}),e.jsx("span",{className:"font-mono",children:t.change_log.total_changes})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.synced")}),e.jsx("span",{className:"font-mono text-emerald-500",children:t.change_log.synced_changes})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.pending")}),e.jsx("span",{className:"font-mono text-amber-500",children:t.change_log.unsynced_changes})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.latestSequence")}),e.jsx("span",{className:"font-mono",children:t.change_log.latest_sequence})]})]})]}),c&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(H,{className:"size-5"}),s("sync.conflictStrategy")]})}),e.jsxs(m,{className:"space-y-3 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("sync.conflictDesc")}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Object.entries(Q).map(([n,l])=>e.jsx("button",{onClick:()=>w(n),disabled:r.isPending,className:`cursor-pointer rounded-lg border px-3 py-2 text-xs font-medium transition-colors ${t.conflict_strategy===n?"border-primary bg-primary/10 text-primary":"border-border hover:bg-accent"}`,children:l},n))})]})]})]})]})}export{Y as default}; diff --git a/src/surreal_memory/server/static/dist/assets/TimelinePage-2mV1L6iZ.js b/src/surreal_memory/server/static/dist/assets/TimelinePage-BROTDDzc.js similarity index 98% rename from src/surreal_memory/server/static/dist/assets/TimelinePage-2mV1L6iZ.js rename to src/surreal_memory/server/static/dist/assets/TimelinePage-BROTDDzc.js index db57973f..8041e058 100644 --- a/src/surreal_memory/server/static/dist/assets/TimelinePage-2mV1L6iZ.js +++ b/src/surreal_memory/server/static/dist/assets/TimelinePage-BROTDDzc.js @@ -1 +1 @@ -import{j as e}from"./vendor-query-CqA1cBNl.js";import{r as p}from"./vendor-react-BfuodpLv.js";import{j as E,k as T,f as z,B as L}from"./index-DXL5wCpD.js";import{C as f,a as v,b,c as u}from"./card-Duzfr-hx.js";import{S as y}from"./skeleton-CBW-y0cP.js";import{c as P,q as R,H as K,Q as B}from"./vendor-icons-C6dhS1UE.js";import{R as k,A as G,C as M,X as S,Y as C,T as D,e as N,B as $,f as W,g as Y}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-ui-Qm4_4bAc.js";const F=[{days:7,key:"range7d"},{days:30,key:"range30d"},{days:90,key:"range90d"},{days:365,key:"rangeAll"}],H={entity:"var(--color-chart-1)",concept:"var(--color-chart-2)",action:"var(--color-chart-3)",intent:"var(--color-chart-4)",time:"var(--color-chart-5, #8b5cf6)",spatial:"#f59e0b",state:"#06b6d4",sensory:"#ec4899"};function h({label:d,value:n,icon:s,loading:o}){return e.jsx(f,{children:e.jsxs(u,{className:"flex items-center gap-4 p-5",children:[e.jsx("div",{className:"flex size-10 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(s,{className:"size-5 text-primary","aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:d}),o?e.jsx(y,{className:"mt-1 h-6 w-16"}):e.jsx("p",{className:"font-mono text-xl font-bold tracking-tight",children:typeof n=="number"?n.toLocaleString():n})]})]})})}function ee(){const[d,n]=p.useState(30),{data:s,isLoading:o}=E(d),{data:l,isLoading:O}=T(20,0),{t:r}=z(),x=p.useMemo(()=>{if(!s||s.length===0)return{today:0,total:0,avgPerDay:0,activeDays:0};const t=new Date().toISOString().slice(0,10),a=s.find(c=>c.date===t),i=a?a.fibers_created:0,m=s.reduce((c,A)=>c+A.fibers_created,0),g=s.filter(c=>c.fibers_created>0).length,w=g>0?Math.round(m/g):0;return{today:i,total:m,avgPerDay:w,activeDays:g}},[s]),j=p.useMemo(()=>{if(!s)return[];const t={};for(const a of s)for(const[i,m]of Object.entries(a.neuron_types))t[i]=(t[i]??0)+m;return Object.entries(t).map(([a,i])=>({type:a,count:i})).sort((a,i)=>i.count-a.count)},[s]),_=p.useMemo(()=>s?s.map(t=>({date:t.date.slice(5),neurons:t.neurons_created,fibers:t.fibers_created,synapses:t.synapses_created})):[],[s]);return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:r("timeline.title")}),e.jsx("div",{className:"flex gap-1 rounded-lg border border-border p-1",children:F.map(t=>e.jsx("button",{onClick:()=>n(t.days),className:`cursor-pointer rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${d===t.days?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent/50"}`,children:r(`timeline.${t.key}`)},t.days))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[e.jsx(h,{label:r("timeline.todayMemories"),value:x.today,icon:P,loading:o}),e.jsx(h,{label:r("timeline.totalPeriod"),value:x.total,icon:R,loading:o}),e.jsx(h,{label:r("timeline.avgPerDay"),value:x.avgPerDay,icon:K,loading:o}),e.jsx(h,{label:r("timeline.activeDays"),value:x.activeDays,icon:B,loading:o})]}),e.jsxs(f,{children:[e.jsx(v,{children:e.jsx(b,{children:r("timeline.activityTrend")})}),e.jsx(u,{children:o?e.jsx(y,{className:"h-72 w-full"}):e.jsx(k,{width:"100%",height:280,children:e.jsxs(G,{data:_,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"colorNeurons",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"var(--color-chart-1)",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"var(--color-chart-1)",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"colorFibers",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"var(--color-chart-2)",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"var(--color-chart-2)",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"colorSynapses",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"var(--color-chart-4)",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"var(--color-chart-4)",stopOpacity:0})]})]}),e.jsx(M,{strokeDasharray:"3 3",stroke:"var(--color-border)",opacity:.3}),e.jsx(S,{dataKey:"date",tick:{fill:"var(--color-muted-foreground)",fontSize:11},interval:"preserveStartEnd"}),e.jsx(C,{tick:{fill:"var(--color-muted-foreground)",fontSize:11},width:40}),e.jsx(D,{contentStyle:{backgroundColor:"var(--color-card)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"}}),e.jsx(N,{type:"monotone",dataKey:"neurons",name:r("timeline.neurons"),stroke:"var(--color-chart-1)",fill:"url(#colorNeurons)",strokeWidth:2}),e.jsx(N,{type:"monotone",dataKey:"fibers",name:r("timeline.fibers"),stroke:"var(--color-chart-2)",fill:"url(#colorFibers)",strokeWidth:2}),e.jsx(N,{type:"monotone",dataKey:"synapses",name:r("timeline.synapses"),stroke:"var(--color-chart-4)",fill:"url(#colorSynapses)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(f,{children:[e.jsx(v,{children:e.jsx(b,{children:r("timeline.neuronDistribution")})}),e.jsx(u,{children:o?e.jsx(y,{className:"h-64 w-full"}):j.length>0?e.jsx(k,{width:"100%",height:260,children:e.jsxs($,{data:j,layout:"vertical",children:[e.jsx(S,{type:"number",tick:{fill:"var(--color-muted-foreground)",fontSize:11}}),e.jsx(C,{dataKey:"type",type:"category",tick:{fill:"var(--color-muted-foreground)",fontSize:11},width:70}),e.jsx(D,{contentStyle:{backgroundColor:"var(--color-card)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"}}),e.jsx(W,{dataKey:"count",radius:[0,4,4,0],children:j.map(t=>e.jsx(Y,{fill:H[t.type]??"var(--color-chart-1)"},t.type))})]})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:r("timeline.noEntries")})})]}),e.jsxs(f,{children:[e.jsx(v,{children:e.jsxs(b,{children:[r("timeline.recentActivity"),l&&e.jsx("span",{className:"ml-2 text-sm font-normal text-muted-foreground",children:r("timeline.entries",{total:l.total.toLocaleString()})})]})}),e.jsx(u,{children:O?e.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((t,a)=>e.jsx(y,{className:"h-14 w-full"},a))}):l?.entries&&l.entries.length>0?e.jsx("div",{className:"max-h-96 space-y-2 overflow-y-auto",children:l.entries.map(t=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border/50 p-3 transition-colors hover:bg-accent/30",children:[e.jsx(L,{variant:"outline",className:"mt-0.5 shrink-0",children:t.neuron_type}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm leading-relaxed line-clamp-2",children:t.content}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t.created_at?new Date(t.created_at).toLocaleString():"-"})]})]},t.id))}):e.jsx("p",{className:"text-sm text-muted-foreground",children:r("timeline.noEntries")})})]})]})]})}export{ee as default}; +import{j as e}from"./vendor-query-CqA1cBNl.js";import{r as p}from"./vendor-react-BfuodpLv.js";import{j as E,k as T,f as z,B as L}from"./index-CLb-kMYl.js";import{C as f,a as v,b,c as u}from"./card-DG4oK1Wy.js";import{S as y}from"./skeleton-gKUrR2fT.js";import{c as P,q as R,H as K,Q as B}from"./vendor-icons-C6dhS1UE.js";import{R as k,A as G,C as M,X as S,Y as C,T as D,e as N,B as $,f as W,g as Y}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-ui-Qm4_4bAc.js";const F=[{days:7,key:"range7d"},{days:30,key:"range30d"},{days:90,key:"range90d"},{days:365,key:"rangeAll"}],H={entity:"var(--color-chart-1)",concept:"var(--color-chart-2)",action:"var(--color-chart-3)",intent:"var(--color-chart-4)",time:"var(--color-chart-5, #8b5cf6)",spatial:"#f59e0b",state:"#06b6d4",sensory:"#ec4899"};function h({label:d,value:n,icon:s,loading:o}){return e.jsx(f,{children:e.jsxs(u,{className:"flex items-center gap-4 p-5",children:[e.jsx("div",{className:"flex size-10 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(s,{className:"size-5 text-primary","aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:d}),o?e.jsx(y,{className:"mt-1 h-6 w-16"}):e.jsx("p",{className:"font-mono text-xl font-bold tracking-tight",children:typeof n=="number"?n.toLocaleString():n})]})]})})}function ee(){const[d,n]=p.useState(30),{data:s,isLoading:o}=E(d),{data:l,isLoading:O}=T(20,0),{t:r}=z(),x=p.useMemo(()=>{if(!s||s.length===0)return{today:0,total:0,avgPerDay:0,activeDays:0};const t=new Date().toISOString().slice(0,10),a=s.find(c=>c.date===t),i=a?a.fibers_created:0,m=s.reduce((c,A)=>c+A.fibers_created,0),g=s.filter(c=>c.fibers_created>0).length,w=g>0?Math.round(m/g):0;return{today:i,total:m,avgPerDay:w,activeDays:g}},[s]),j=p.useMemo(()=>{if(!s)return[];const t={};for(const a of s)for(const[i,m]of Object.entries(a.neuron_types))t[i]=(t[i]??0)+m;return Object.entries(t).map(([a,i])=>({type:a,count:i})).sort((a,i)=>i.count-a.count)},[s]),_=p.useMemo(()=>s?s.map(t=>({date:t.date.slice(5),neurons:t.neurons_created,fibers:t.fibers_created,synapses:t.synapses_created})):[],[s]);return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:r("timeline.title")}),e.jsx("div",{className:"flex gap-1 rounded-lg border border-border p-1",children:F.map(t=>e.jsx("button",{onClick:()=>n(t.days),className:`cursor-pointer rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${d===t.days?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent/50"}`,children:r(`timeline.${t.key}`)},t.days))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[e.jsx(h,{label:r("timeline.todayMemories"),value:x.today,icon:P,loading:o}),e.jsx(h,{label:r("timeline.totalPeriod"),value:x.total,icon:R,loading:o}),e.jsx(h,{label:r("timeline.avgPerDay"),value:x.avgPerDay,icon:K,loading:o}),e.jsx(h,{label:r("timeline.activeDays"),value:x.activeDays,icon:B,loading:o})]}),e.jsxs(f,{children:[e.jsx(v,{children:e.jsx(b,{children:r("timeline.activityTrend")})}),e.jsx(u,{children:o?e.jsx(y,{className:"h-72 w-full"}):e.jsx(k,{width:"100%",height:280,children:e.jsxs(G,{data:_,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"colorNeurons",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"var(--color-chart-1)",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"var(--color-chart-1)",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"colorFibers",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"var(--color-chart-2)",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"var(--color-chart-2)",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"colorSynapses",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"var(--color-chart-4)",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"var(--color-chart-4)",stopOpacity:0})]})]}),e.jsx(M,{strokeDasharray:"3 3",stroke:"var(--color-border)",opacity:.3}),e.jsx(S,{dataKey:"date",tick:{fill:"var(--color-muted-foreground)",fontSize:11},interval:"preserveStartEnd"}),e.jsx(C,{tick:{fill:"var(--color-muted-foreground)",fontSize:11},width:40}),e.jsx(D,{contentStyle:{backgroundColor:"var(--color-card)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"}}),e.jsx(N,{type:"monotone",dataKey:"neurons",name:r("timeline.neurons"),stroke:"var(--color-chart-1)",fill:"url(#colorNeurons)",strokeWidth:2}),e.jsx(N,{type:"monotone",dataKey:"fibers",name:r("timeline.fibers"),stroke:"var(--color-chart-2)",fill:"url(#colorFibers)",strokeWidth:2}),e.jsx(N,{type:"monotone",dataKey:"synapses",name:r("timeline.synapses"),stroke:"var(--color-chart-4)",fill:"url(#colorSynapses)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(f,{children:[e.jsx(v,{children:e.jsx(b,{children:r("timeline.neuronDistribution")})}),e.jsx(u,{children:o?e.jsx(y,{className:"h-64 w-full"}):j.length>0?e.jsx(k,{width:"100%",height:260,children:e.jsxs($,{data:j,layout:"vertical",children:[e.jsx(S,{type:"number",tick:{fill:"var(--color-muted-foreground)",fontSize:11}}),e.jsx(C,{dataKey:"type",type:"category",tick:{fill:"var(--color-muted-foreground)",fontSize:11},width:70}),e.jsx(D,{contentStyle:{backgroundColor:"var(--color-card)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"}}),e.jsx(W,{dataKey:"count",radius:[0,4,4,0],children:j.map(t=>e.jsx(Y,{fill:H[t.type]??"var(--color-chart-1)"},t.type))})]})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:r("timeline.noEntries")})})]}),e.jsxs(f,{children:[e.jsx(v,{children:e.jsxs(b,{children:[r("timeline.recentActivity"),l&&e.jsx("span",{className:"ml-2 text-sm font-normal text-muted-foreground",children:r("timeline.entries",{total:l.total.toLocaleString()})})]})}),e.jsx(u,{children:O?e.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((t,a)=>e.jsx(y,{className:"h-14 w-full"},a))}):l?.entries&&l.entries.length>0?e.jsx("div",{className:"max-h-96 space-y-2 overflow-y-auto",children:l.entries.map(t=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border/50 p-3 transition-colors hover:bg-accent/30",children:[e.jsx(L,{variant:"outline",className:"mt-0.5 shrink-0",children:t.neuron_type}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm leading-relaxed line-clamp-2",children:t.content}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t.created_at?new Date(t.created_at).toLocaleString():"-"})]})]},t.id))}):e.jsx("p",{className:"text-sm text-muted-foreground",children:r("timeline.noEntries")})})]})]})]})}export{ee as default}; diff --git a/src/surreal_memory/server/static/dist/assets/ToolStatsPage-yrXaz2Sj.js b/src/surreal_memory/server/static/dist/assets/ToolStatsPage-D0x1I7ay.js similarity index 97% rename from src/surreal_memory/server/static/dist/assets/ToolStatsPage-yrXaz2Sj.js rename to src/surreal_memory/server/static/dist/assets/ToolStatsPage-D0x1I7ay.js index 092f5ffe..1d9d78c8 100644 --- a/src/surreal_memory/server/static/dist/assets/ToolStatsPage-yrXaz2Sj.js +++ b/src/surreal_memory/server/static/dist/assets/ToolStatsPage-D0x1I7ay.js @@ -1 +1 @@ -import{j as t}from"./vendor-query-CqA1cBNl.js";import{r as u}from"./vendor-react-BfuodpLv.js";import{z as w,f as T,a as R,B as k}from"./index-DXL5wCpD.js";import{C as l,a as c,b as d,c as i}from"./card-Duzfr-hx.js";import{S as x}from"./skeleton-CBW-y0cP.js";import{R as g,B as D,C as N,X as b,Y as y,T as S,f as M,g as B,L,p as z}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-icons-C6dhS1UE.js";import"./vendor-ui-Qm4_4bAc.js";const A=[7,14,30,90],v=["#6366f1","#10b981","#f59e0b","#ef4444","#06b6d4","#8b5cf6","#ec4899","#14b8a6","#f97316","#64748b"];function O(o){return o<1e3?`${Math.round(o)}ms`:`${(o/1e3).toFixed(1)}s`}function _(o){return`${Math.round(o*100)}%`}function E(o){return o>=.95?"success":o>=.8?"warning":"destructive"}function H(){const[o,C]=u.useState(30),{data:j,isLoading:n}=w(o),{t:a}=T(),r=j?.summary,f=j?.daily??[],p=u.useMemo(()=>{const s=new Map;for(const e of f){const m=s.get(e.date);m?(m.count+=e.count,m.successes+=Math.round(e.count*e.success_rate)):s.set(e.date,{date:e.date,count:e.count,successes:Math.round(e.count*e.success_rate)})}return Array.from(s.values()).sort((e,m)=>e.date.localeCompare(m.date)).map(e=>({date:e.date.slice(5),count:e.count,successRate:e.count>0?Math.round(e.successes/e.count*100):0}))},[f]),h=u.useMemo(()=>r?.top_tools?r.top_tools.slice(0,10).map(s=>({...s,shortName:s.tool_name.replace(/^smem_/,"")})):[],[r]);return t.jsxs("div",{className:"space-y-6 p-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"font-display text-2xl font-bold",children:a("toolStats.title")}),t.jsx("div",{className:"flex gap-1",children:A.map(s=>t.jsxs(R,{variant:o===s?"default":"outline",size:"sm",onClick:()=>C(s),className:"cursor-pointer",children:[s,"d"]},s))})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[t.jsxs(l,{children:[t.jsx(c,{className:"pb-2",children:t.jsx(d,{className:"text-sm font-medium text-muted-foreground",children:a("toolStats.totalEvents")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-8 w-24"}):t.jsx("p",{className:"font-mono text-2xl font-bold",children:(r?.total_events??0).toLocaleString()})})]}),t.jsxs(l,{children:[t.jsx(c,{className:"pb-2",children:t.jsx(d,{className:"text-sm font-medium text-muted-foreground",children:a("toolStats.successRate")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-8 w-20"}):t.jsx("p",{className:"font-mono text-2xl font-bold",children:_(r?.success_rate??0)})})]}),t.jsxs(l,{children:[t.jsx(c,{className:"pb-2",children:t.jsx(d,{className:"text-sm font-medium text-muted-foreground",children:a("toolStats.uniqueTools")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-8 w-16"}):t.jsx("p",{className:"font-mono text-2xl font-bold",children:r?.top_tools?.length??0})})]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsxs(l,{children:[t.jsx(c,{children:t.jsx(d,{className:"text-base",children:a("toolStats.topTools")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-72 w-full"}):h.length===0?t.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:a("toolStats.noData")}):t.jsx(g,{width:"100%",height:Math.max(h.length*36,200),children:t.jsxs(D,{data:h,layout:"vertical",margin:{left:80,right:20},children:[t.jsx(N,{strokeDasharray:"3 3",opacity:.1}),t.jsx(b,{type:"number"}),t.jsx(y,{type:"category",dataKey:"shortName",tick:{fontSize:12},width:80}),t.jsx(S,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:8}}),t.jsx(M,{dataKey:"count",radius:[0,4,4,0],children:h.map((s,e)=>t.jsx(B,{fill:v[e%v.length]},e))})]})})})]}),t.jsxs(l,{children:[t.jsx(c,{children:t.jsx(d,{className:"text-base",children:a("toolStats.usageOverTime")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-72 w-full"}):p.length===0?t.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:a("toolStats.noData")}):t.jsx(g,{width:"100%",height:300,children:t.jsxs(L,{data:p,margin:{left:10,right:20},children:[t.jsx(N,{strokeDasharray:"3 3",opacity:.1}),t.jsx(b,{dataKey:"date",tick:{fontSize:11}}),t.jsx(y,{tick:{fontSize:11}}),t.jsx(S,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:8}}),t.jsx(z,{type:"monotone",dataKey:"count",stroke:"#6366f1",strokeWidth:2,dot:!1,name:a("toolStats.calls")})]})})})]})]}),t.jsxs(l,{children:[t.jsx(c,{children:t.jsx(d,{className:"text-base",children:a("toolStats.detailTable")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-48 w-full"}):r?.top_tools?.length?t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[t.jsx("th",{className:"pb-3 font-medium",children:a("toolStats.tool")}),t.jsx("th",{className:"pb-3 font-medium text-right",children:a("toolStats.calls")}),t.jsx("th",{className:"pb-3 font-medium text-right",children:a("toolStats.successRate")}),t.jsx("th",{className:"pb-3 font-medium text-right",children:a("toolStats.avgDuration")}),t.jsx("th",{className:"pb-3 font-medium",children:a("toolStats.server")})]})}),t.jsx("tbody",{children:r.top_tools.map(s=>t.jsxs("tr",{className:"border-b border-border/50",children:[t.jsx("td",{className:"py-2.5 font-mono text-xs",children:s.tool_name}),t.jsx("td",{className:"py-2.5 text-right font-mono",children:s.count}),t.jsx("td",{className:"py-2.5 text-right",children:t.jsx(k,{variant:E(s.success_rate),children:_(s.success_rate)})}),t.jsx("td",{className:"py-2.5 text-right font-mono text-xs text-muted-foreground",children:O(s.avg_duration_ms)}),t.jsx("td",{className:"py-2.5 text-xs text-muted-foreground",children:s.server_name||"—"})]},s.tool_name))})]})}):t.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:a("toolStats.noData")})})]})]})}export{H as default}; +import{j as t}from"./vendor-query-CqA1cBNl.js";import{r as u}from"./vendor-react-BfuodpLv.js";import{z as w,f as T,a as R,B as k}from"./index-CLb-kMYl.js";import{C as l,a as c,b as d,c as i}from"./card-DG4oK1Wy.js";import{S as x}from"./skeleton-gKUrR2fT.js";import{R as g,B as D,C as N,X as b,Y as y,T as S,f as M,g as B,L,p as z}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-icons-C6dhS1UE.js";import"./vendor-ui-Qm4_4bAc.js";const A=[7,14,30,90],v=["#6366f1","#10b981","#f59e0b","#ef4444","#06b6d4","#8b5cf6","#ec4899","#14b8a6","#f97316","#64748b"];function O(o){return o<1e3?`${Math.round(o)}ms`:`${(o/1e3).toFixed(1)}s`}function _(o){return`${Math.round(o*100)}%`}function E(o){return o>=.95?"success":o>=.8?"warning":"destructive"}function H(){const[o,C]=u.useState(30),{data:j,isLoading:n}=w(o),{t:a}=T(),r=j?.summary,f=j?.daily??[],p=u.useMemo(()=>{const s=new Map;for(const e of f){const m=s.get(e.date);m?(m.count+=e.count,m.successes+=Math.round(e.count*e.success_rate)):s.set(e.date,{date:e.date,count:e.count,successes:Math.round(e.count*e.success_rate)})}return Array.from(s.values()).sort((e,m)=>e.date.localeCompare(m.date)).map(e=>({date:e.date.slice(5),count:e.count,successRate:e.count>0?Math.round(e.successes/e.count*100):0}))},[f]),h=u.useMemo(()=>r?.top_tools?r.top_tools.slice(0,10).map(s=>({...s,shortName:s.tool_name.replace(/^smem_/,"")})):[],[r]);return t.jsxs("div",{className:"space-y-6 p-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"font-display text-2xl font-bold",children:a("toolStats.title")}),t.jsx("div",{className:"flex gap-1",children:A.map(s=>t.jsxs(R,{variant:o===s?"default":"outline",size:"sm",onClick:()=>C(s),className:"cursor-pointer",children:[s,"d"]},s))})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[t.jsxs(l,{children:[t.jsx(c,{className:"pb-2",children:t.jsx(d,{className:"text-sm font-medium text-muted-foreground",children:a("toolStats.totalEvents")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-8 w-24"}):t.jsx("p",{className:"font-mono text-2xl font-bold",children:(r?.total_events??0).toLocaleString()})})]}),t.jsxs(l,{children:[t.jsx(c,{className:"pb-2",children:t.jsx(d,{className:"text-sm font-medium text-muted-foreground",children:a("toolStats.successRate")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-8 w-20"}):t.jsx("p",{className:"font-mono text-2xl font-bold",children:_(r?.success_rate??0)})})]}),t.jsxs(l,{children:[t.jsx(c,{className:"pb-2",children:t.jsx(d,{className:"text-sm font-medium text-muted-foreground",children:a("toolStats.uniqueTools")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-8 w-16"}):t.jsx("p",{className:"font-mono text-2xl font-bold",children:r?.top_tools?.length??0})})]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsxs(l,{children:[t.jsx(c,{children:t.jsx(d,{className:"text-base",children:a("toolStats.topTools")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-72 w-full"}):h.length===0?t.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:a("toolStats.noData")}):t.jsx(g,{width:"100%",height:Math.max(h.length*36,200),children:t.jsxs(D,{data:h,layout:"vertical",margin:{left:80,right:20},children:[t.jsx(N,{strokeDasharray:"3 3",opacity:.1}),t.jsx(b,{type:"number"}),t.jsx(y,{type:"category",dataKey:"shortName",tick:{fontSize:12},width:80}),t.jsx(S,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:8}}),t.jsx(M,{dataKey:"count",radius:[0,4,4,0],children:h.map((s,e)=>t.jsx(B,{fill:v[e%v.length]},e))})]})})})]}),t.jsxs(l,{children:[t.jsx(c,{children:t.jsx(d,{className:"text-base",children:a("toolStats.usageOverTime")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-72 w-full"}):p.length===0?t.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:a("toolStats.noData")}):t.jsx(g,{width:"100%",height:300,children:t.jsxs(L,{data:p,margin:{left:10,right:20},children:[t.jsx(N,{strokeDasharray:"3 3",opacity:.1}),t.jsx(b,{dataKey:"date",tick:{fontSize:11}}),t.jsx(y,{tick:{fontSize:11}}),t.jsx(S,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:8}}),t.jsx(z,{type:"monotone",dataKey:"count",stroke:"#6366f1",strokeWidth:2,dot:!1,name:a("toolStats.calls")})]})})})]})]}),t.jsxs(l,{children:[t.jsx(c,{children:t.jsx(d,{className:"text-base",children:a("toolStats.detailTable")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-48 w-full"}):r?.top_tools?.length?t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[t.jsx("th",{className:"pb-3 font-medium",children:a("toolStats.tool")}),t.jsx("th",{className:"pb-3 font-medium text-right",children:a("toolStats.calls")}),t.jsx("th",{className:"pb-3 font-medium text-right",children:a("toolStats.successRate")}),t.jsx("th",{className:"pb-3 font-medium text-right",children:a("toolStats.avgDuration")}),t.jsx("th",{className:"pb-3 font-medium",children:a("toolStats.server")})]})}),t.jsx("tbody",{children:r.top_tools.map(s=>t.jsxs("tr",{className:"border-b border-border/50",children:[t.jsx("td",{className:"py-2.5 font-mono text-xs",children:s.tool_name}),t.jsx("td",{className:"py-2.5 text-right font-mono",children:s.count}),t.jsx("td",{className:"py-2.5 text-right",children:t.jsx(k,{variant:E(s.success_rate),children:_(s.success_rate)})}),t.jsx("td",{className:"py-2.5 text-right font-mono text-xs text-muted-foreground",children:O(s.avg_duration_ms)}),t.jsx("td",{className:"py-2.5 text-xs text-muted-foreground",children:s.server_name||"—"})]},s.tool_name))})]})}):t.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:a("toolStats.noData")})})]})]})}export{H as default}; diff --git a/src/surreal_memory/server/static/dist/assets/UncertaintyPage-CdFbDPD5.js b/src/surreal_memory/server/static/dist/assets/UncertaintyPage-DenkK0_u.js similarity index 96% rename from src/surreal_memory/server/static/dist/assets/UncertaintyPage-CdFbDPD5.js rename to src/surreal_memory/server/static/dist/assets/UncertaintyPage-DenkK0_u.js index cf740049..35c2ede0 100644 --- a/src/surreal_memory/server/static/dist/assets/UncertaintyPage-CdFbDPD5.js +++ b/src/surreal_memory/server/static/dist/assets/UncertaintyPage-DenkK0_u.js @@ -1 +1 @@ -import{j as e}from"./vendor-query-CqA1cBNl.js";import{h as S,f as g,B as b}from"./index-DXL5wCpD.js";import{C as o,a as x,b as m,c as u}from"./card-Duzfr-hx.js";import{S as h}from"./skeleton-CBW-y0cP.js";import{B as z,N as C,z as T,b as I,O as E,P as R}from"./vendor-icons-C6dhS1UE.js";import"./vendor-react-BfuodpLv.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const p=14,j=16,$={low:"success",medium:"warning",high:"destructive"};function i(t){return t.length>j?`${t.slice(0,j)}…`:t}function f(t){return`${(t*100).toFixed(1)}%`}function O(){const{data:t,isLoading:r}=S(p),{t:s}=g(),a=t?.counts,c=t?.samples;return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("uncertainty.title")}),t&&e.jsx(b,{variant:$[t.level],className:"px-3 py-1 text-sm capitalize",children:s(`uncertainty.level.${t.level}`)}),e.jsx("span",{className:"text-sm text-muted-foreground",children:s("uncertainty.window",{days:p})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(y,{label:s("uncertainty.contradictionRate"),value:t?f(t.contradiction_rate):void 0,isLoading:r}),e.jsx(y,{label:s("uncertainty.totalMemories"),value:t?t.total_memories.toLocaleString():void 0,isLoading:r}),e.jsx(N,{icon:e.jsx(z,{className:"size-4 text-red-500"}),label:s("uncertainty.contradictions"),count:a?.contradictions,isLoading:r}),e.jsx(N,{icon:e.jsx(C,{className:"size-4 text-amber-500"}),label:s("uncertainty.expiring"),count:a?.expiring,isLoading:r})]}),t?.scan.typed_scan_truncated&&e.jsxs("p",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[e.jsx(T,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:s("uncertainty.truncatedNote",{count:t.scan.typed_scanned})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:[e.jsx(l,{icon:e.jsx(I,{className:"size-5 text-orange-500"}),title:s("uncertainty.lowTrust"),count:a?.low_evidence,isLoading:r,isEmpty:!c?.low_evidence.length,children:e.jsx(d,{columns:[s("uncertainty.fiberId"),s("uncertainty.trustScore")],rows:c?.low_evidence??[],renderRow:n=>e.jsxs(e.Fragment,{children:[e.jsx("td",{className:"py-2 pr-2 font-mono text-xs",title:n.fiber_id,children:i(n.fiber_id)}),e.jsx("td",{className:"py-2 text-right font-mono text-xs",children:n.trust_score.toFixed(2)})]})})}),e.jsx(l,{icon:e.jsx(E,{className:"size-5 text-indigo-500"}),title:s("uncertainty.superseded"),count:a?.superseded,isLoading:r,isEmpty:!c?.superseded.length,children:e.jsx(d,{columns:[s("uncertainty.fiberId"),s("uncertainty.supersededBy")],rows:c?.superseded??[],renderRow:n=>e.jsxs(e.Fragment,{children:[e.jsx("td",{className:"py-2 pr-2 font-mono text-xs",title:n.fiber_id,children:i(n.fiber_id)}),e.jsx("td",{className:"py-2 text-right font-mono text-xs",title:n.superseded_by,children:i(n.superseded_by)})]})})}),e.jsx(l,{icon:e.jsx(R,{className:"size-5 text-cyan-500"}),title:s("uncertainty.drift"),count:a?.drift_clusters,isLoading:r,isEmpty:!c?.drift_clusters.length,emptyLabel:a?.drift_clusters===0?s("uncertainty.driftSqliteOnly"):void 0,children:e.jsx(d,{columns:[s("uncertainty.canonical"),s("uncertainty.confidence")],rows:c?.drift_clusters??[],renderRow:n=>e.jsxs(e.Fragment,{children:[e.jsx("td",{className:"py-2 pr-2 text-xs",title:n.canonical??"",children:n.canonical?i(n.canonical):"—"}),e.jsx("td",{className:"py-2 text-right font-mono text-xs",children:n.confidence!=null?f(n.confidence):"—"})]})})})]})]})}function y({label:t,value:r,isLoading:s}){return e.jsxs(o,{children:[e.jsx(x,{className:"pb-2",children:e.jsx(m,{className:"text-sm font-medium text-muted-foreground",children:t})}),e.jsx(u,{children:s?e.jsx(h,{className:"h-8 w-24"}):e.jsx("p",{className:"font-mono text-2xl font-bold",children:r??"—"})})]})}function N({icon:t,label:r,count:s,isLoading:a}){return e.jsxs(o,{children:[e.jsx(x,{className:"pb-2",children:e.jsxs(m,{className:"flex items-center gap-1.5 text-sm font-medium text-muted-foreground",children:[t,r]})}),e.jsx(u,{children:a?e.jsx(h,{className:"h-8 w-16"}):e.jsx("p",{className:"font-mono text-2xl font-bold",children:s??0})})]})}function l({icon:t,title:r,count:s,isLoading:a,isEmpty:c,emptyLabel:n,children:_}){const{t:v}=g();return e.jsxs(o,{children:[e.jsx(x,{className:"pb-3",children:e.jsxs(m,{className:"flex items-center justify-between text-base",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[t,r]}),!a&&e.jsx(b,{variant:"secondary",className:"font-mono",children:s??0})]})}),e.jsx(u,{children:a?e.jsx("div",{className:"space-y-2",children:Array.from({length:4}).map((A,w)=>e.jsx(h,{className:"h-6 w-full"},w))}):c?e.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:n??v("uncertainty.noSamples")}):_})]})}function d({columns:t,rows:r,renderRow:s}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[e.jsx("th",{className:"pb-2 font-medium",children:t[0]}),e.jsx("th",{className:"pb-2 text-right font-medium",children:t[1]})]})}),e.jsx("tbody",{children:r.map((a,c)=>e.jsx("tr",{className:"border-b border-border/50",children:s(a)},c))})]})})}export{O as default}; +import{j as e}from"./vendor-query-CqA1cBNl.js";import{h as S,f as g,B as b}from"./index-CLb-kMYl.js";import{C as o,a as x,b as m,c as u}from"./card-DG4oK1Wy.js";import{S as h}from"./skeleton-gKUrR2fT.js";import{B as z,N as C,z as T,b as I,O as E,P as R}from"./vendor-icons-C6dhS1UE.js";import"./vendor-react-BfuodpLv.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const p=14,j=16,$={low:"success",medium:"warning",high:"destructive"};function i(t){return t.length>j?`${t.slice(0,j)}…`:t}function f(t){return`${(t*100).toFixed(1)}%`}function O(){const{data:t,isLoading:r}=S(p),{t:s}=g(),a=t?.counts,c=t?.samples;return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("uncertainty.title")}),t&&e.jsx(b,{variant:$[t.level],className:"px-3 py-1 text-sm capitalize",children:s(`uncertainty.level.${t.level}`)}),e.jsx("span",{className:"text-sm text-muted-foreground",children:s("uncertainty.window",{days:p})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(y,{label:s("uncertainty.contradictionRate"),value:t?f(t.contradiction_rate):void 0,isLoading:r}),e.jsx(y,{label:s("uncertainty.totalMemories"),value:t?t.total_memories.toLocaleString():void 0,isLoading:r}),e.jsx(N,{icon:e.jsx(z,{className:"size-4 text-red-500"}),label:s("uncertainty.contradictions"),count:a?.contradictions,isLoading:r}),e.jsx(N,{icon:e.jsx(C,{className:"size-4 text-amber-500"}),label:s("uncertainty.expiring"),count:a?.expiring,isLoading:r})]}),t?.scan.typed_scan_truncated&&e.jsxs("p",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[e.jsx(T,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:s("uncertainty.truncatedNote",{count:t.scan.typed_scanned})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:[e.jsx(l,{icon:e.jsx(I,{className:"size-5 text-orange-500"}),title:s("uncertainty.lowTrust"),count:a?.low_evidence,isLoading:r,isEmpty:!c?.low_evidence.length,children:e.jsx(d,{columns:[s("uncertainty.fiberId"),s("uncertainty.trustScore")],rows:c?.low_evidence??[],renderRow:n=>e.jsxs(e.Fragment,{children:[e.jsx("td",{className:"py-2 pr-2 font-mono text-xs",title:n.fiber_id,children:i(n.fiber_id)}),e.jsx("td",{className:"py-2 text-right font-mono text-xs",children:n.trust_score.toFixed(2)})]})})}),e.jsx(l,{icon:e.jsx(E,{className:"size-5 text-indigo-500"}),title:s("uncertainty.superseded"),count:a?.superseded,isLoading:r,isEmpty:!c?.superseded.length,children:e.jsx(d,{columns:[s("uncertainty.fiberId"),s("uncertainty.supersededBy")],rows:c?.superseded??[],renderRow:n=>e.jsxs(e.Fragment,{children:[e.jsx("td",{className:"py-2 pr-2 font-mono text-xs",title:n.fiber_id,children:i(n.fiber_id)}),e.jsx("td",{className:"py-2 text-right font-mono text-xs",title:n.superseded_by,children:i(n.superseded_by)})]})})}),e.jsx(l,{icon:e.jsx(R,{className:"size-5 text-cyan-500"}),title:s("uncertainty.drift"),count:a?.drift_clusters,isLoading:r,isEmpty:!c?.drift_clusters.length,emptyLabel:a?.drift_clusters===0?s("uncertainty.driftSqliteOnly"):void 0,children:e.jsx(d,{columns:[s("uncertainty.canonical"),s("uncertainty.confidence")],rows:c?.drift_clusters??[],renderRow:n=>e.jsxs(e.Fragment,{children:[e.jsx("td",{className:"py-2 pr-2 text-xs",title:n.canonical??"",children:n.canonical?i(n.canonical):"—"}),e.jsx("td",{className:"py-2 text-right font-mono text-xs",children:n.confidence!=null?f(n.confidence):"—"})]})})})]})]})}function y({label:t,value:r,isLoading:s}){return e.jsxs(o,{children:[e.jsx(x,{className:"pb-2",children:e.jsx(m,{className:"text-sm font-medium text-muted-foreground",children:t})}),e.jsx(u,{children:s?e.jsx(h,{className:"h-8 w-24"}):e.jsx("p",{className:"font-mono text-2xl font-bold",children:r??"—"})})]})}function N({icon:t,label:r,count:s,isLoading:a}){return e.jsxs(o,{children:[e.jsx(x,{className:"pb-2",children:e.jsxs(m,{className:"flex items-center gap-1.5 text-sm font-medium text-muted-foreground",children:[t,r]})}),e.jsx(u,{children:a?e.jsx(h,{className:"h-8 w-16"}):e.jsx("p",{className:"font-mono text-2xl font-bold",children:s??0})})]})}function l({icon:t,title:r,count:s,isLoading:a,isEmpty:c,emptyLabel:n,children:_}){const{t:v}=g();return e.jsxs(o,{children:[e.jsx(x,{className:"pb-3",children:e.jsxs(m,{className:"flex items-center justify-between text-base",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[t,r]}),!a&&e.jsx(b,{variant:"secondary",className:"font-mono",children:s??0})]})}),e.jsx(u,{children:a?e.jsx("div",{className:"space-y-2",children:Array.from({length:4}).map((A,w)=>e.jsx(h,{className:"h-6 w-full"},w))}):c?e.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:n??v("uncertainty.noSamples")}):_})]})}function d({columns:t,rows:r,renderRow:s}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[e.jsx("th",{className:"pb-2 font-medium",children:t[0]}),e.jsx("th",{className:"pb-2 text-right font-medium",children:t[1]})]})}),e.jsx("tbody",{children:r.map((a,c)=>e.jsx("tr",{className:"border-b border-border/50",children:s(a)},c))})]})})}export{O as default}; diff --git a/src/surreal_memory/server/static/dist/assets/VisualizePage-CayiR_fG.js b/src/surreal_memory/server/static/dist/assets/VisualizePage-BSPpZSKx.js similarity index 94% rename from src/surreal_memory/server/static/dist/assets/VisualizePage-CayiR_fG.js rename to src/surreal_memory/server/static/dist/assets/VisualizePage-BSPpZSKx.js index 48b8f9cd..7c819d72 100644 --- a/src/surreal_memory/server/static/dist/assets/VisualizePage-CayiR_fG.js +++ b/src/surreal_memory/server/static/dist/assets/VisualizePage-BSPpZSKx.js @@ -1,2 +1,2 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/embed-gLOWnRXV.js","assets/vendor-recharts-BkwZfCWA.js","assets/vendor-react-BfuodpLv.js","assets/vendor-ui-Qm4_4bAc.js","assets/timer-DWAvo6M8.js"])))=>i.map(i=>d[i]); -import{j as r}from"./vendor-query-CqA1cBNl.js";import{P as _}from"./ProGate-DjphnyL3.js";import{f as u,A as b,_ as y,a as N}from"./index-DXL5wCpD.js";import{r as n}from"./vendor-react-BfuodpLv.js";import{C as w,a as z,b as C,c as k}from"./card-Duzfr-hx.js";import"./vendor-icons-C6dhS1UE.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";function P({query:s="",chartType:m,format:p="vega_lite",limit:x=20,compact:f=!1}){const{t:l}=u(),a=n.useRef(null),i=b(),[o,h]=n.useState(s),[e,g]=n.useState(null),d=()=>{o.trim()&&i.mutate({query:o.trim(),chart_type:m,format:p,limit:x},{onSuccess:t=>g(t)})};n.useEffect(()=>{if(!e?.vega_lite||!a.current)return;let t=!1;return y(()=>import("./embed-gLOWnRXV.js"),__vite__mapDeps([0,1,2,3,4])).then(v=>{t||!a.current||v.default(a.current,e.vega_lite,{actions:{export:!0,source:!1,compiled:!1,editor:!1},theme:document.documentElement.classList.contains("dark")?"dark":void 0,renderer:"svg"}).catch(j=>console.error("Vega render error:",j))}),()=>{t=!0}},[e?.vega_lite]);const c=r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",value:o,onChange:t=>h(t.target.value),onKeyDown:t=>t.key==="Enter"&&d(),placeholder:l("commandPalette.placeholder"),className:"flex-1 rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring","aria-label":"Chart query"}),r.jsx(N,{size:"sm",onClick:d,disabled:i.isPending||!o.trim(),className:"cursor-pointer",children:i.isPending?l("common.loading"):"Visualize"})]}),e&&r.jsxs("div",{className:"space-y-2",children:[e.vega_lite&&r.jsx("div",{ref:a,className:"w-full min-h-[200px] rounded-md border border-border bg-background p-2"}),e.markdown&&!e.vega_lite&&r.jsx("pre",{className:"whitespace-pre-wrap rounded-md border border-border bg-muted p-3 text-xs font-mono overflow-x-auto",children:e.markdown}),e.ascii&&!e.vega_lite&&r.jsx("pre",{className:"whitespace-pre rounded-md border border-border bg-muted p-3 text-xs font-mono overflow-x-auto",children:e.ascii}),e.message&&!e.vega_lite&&!e.markdown&&!e.ascii&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.message}),e.memories&&e.memories.length>0&&r.jsx("div",{className:"space-y-1",children:e.memories.map(t=>r.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:[r.jsxs("span",{className:"font-mono text-[10px] opacity-50",children:["[",t.type,"]"]})," ",t.content]},t.id))}),e.data_points_count!=null&&e.data_points_count>0&&r.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[e.data_points_count," data points · ",e.chart_type]})]})]});return f?c:r.jsxs(w,{children:[r.jsx(z,{children:r.jsx(C,{className:"text-sm",children:"Memory Visualizer"})}),r.jsx(k,{children:c})]})}function D(){const{t:s}=u();return r.jsx(_,{label:s("license.pro_feature","Pro Feature"),children:r.jsxs("div",{className:"space-y-6 p-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-display text-2xl font-bold",children:s("visualize.title","Memory Visualizer")}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s("visualize.description","Query your memories and generate charts from stored data.")})]}),r.jsx(P,{})]})})}export{D as default}; +import{j as r}from"./vendor-query-CqA1cBNl.js";import{P as _}from"./ProGate-u3qkirgp.js";import{f as u,A as b,_ as y,a as N}from"./index-CLb-kMYl.js";import{r as n}from"./vendor-react-BfuodpLv.js";import{C as w,a as z,b as C,c as k}from"./card-DG4oK1Wy.js";import"./vendor-icons-C6dhS1UE.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";function P({query:s="",chartType:m,format:p="vega_lite",limit:x=20,compact:f=!1}){const{t:l}=u(),a=n.useRef(null),i=b(),[o,h]=n.useState(s),[e,g]=n.useState(null),d=()=>{o.trim()&&i.mutate({query:o.trim(),chart_type:m,format:p,limit:x},{onSuccess:t=>g(t)})};n.useEffect(()=>{if(!e?.vega_lite||!a.current)return;let t=!1;return y(()=>import("./embed-gLOWnRXV.js"),__vite__mapDeps([0,1,2,3,4])).then(v=>{t||!a.current||v.default(a.current,e.vega_lite,{actions:{export:!0,source:!1,compiled:!1,editor:!1},theme:document.documentElement.classList.contains("dark")?"dark":void 0,renderer:"svg"}).catch(j=>console.error("Vega render error:",j))}),()=>{t=!0}},[e?.vega_lite]);const c=r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",value:o,onChange:t=>h(t.target.value),onKeyDown:t=>t.key==="Enter"&&d(),placeholder:l("commandPalette.placeholder"),className:"flex-1 rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring","aria-label":"Chart query"}),r.jsx(N,{size:"sm",onClick:d,disabled:i.isPending||!o.trim(),className:"cursor-pointer",children:i.isPending?l("common.loading"):"Visualize"})]}),e&&r.jsxs("div",{className:"space-y-2",children:[e.vega_lite&&r.jsx("div",{ref:a,className:"w-full min-h-[200px] rounded-md border border-border bg-background p-2"}),e.markdown&&!e.vega_lite&&r.jsx("pre",{className:"whitespace-pre-wrap rounded-md border border-border bg-muted p-3 text-xs font-mono overflow-x-auto",children:e.markdown}),e.ascii&&!e.vega_lite&&r.jsx("pre",{className:"whitespace-pre rounded-md border border-border bg-muted p-3 text-xs font-mono overflow-x-auto",children:e.ascii}),e.message&&!e.vega_lite&&!e.markdown&&!e.ascii&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.message}),e.memories&&e.memories.length>0&&r.jsx("div",{className:"space-y-1",children:e.memories.map(t=>r.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:[r.jsxs("span",{className:"font-mono text-[10px] opacity-50",children:["[",t.type,"]"]})," ",t.content]},t.id))}),e.data_points_count!=null&&e.data_points_count>0&&r.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[e.data_points_count," data points · ",e.chart_type]})]})]});return f?c:r.jsxs(w,{children:[r.jsx(z,{children:r.jsx(C,{className:"text-sm",children:"Memory Visualizer"})}),r.jsx(k,{children:c})]})}function D(){const{t:s}=u();return r.jsx(_,{label:s("license.pro_feature","Pro Feature"),children:r.jsxs("div",{className:"space-y-6 p-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-display text-2xl font-bold",children:s("visualize.title","Memory Visualizer")}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s("visualize.description","Query your memories and generate charts from stored data.")})]}),r.jsx(P,{})]})})}export{D as default}; diff --git a/src/surreal_memory/server/static/dist/assets/card-Duzfr-hx.js b/src/surreal_memory/server/static/dist/assets/card-DG4oK1Wy.js similarity index 86% rename from src/surreal_memory/server/static/dist/assets/card-Duzfr-hx.js rename to src/surreal_memory/server/static/dist/assets/card-DG4oK1Wy.js index a84002b6..2805b4b9 100644 --- a/src/surreal_memory/server/static/dist/assets/card-Duzfr-hx.js +++ b/src/surreal_memory/server/static/dist/assets/card-DG4oK1Wy.js @@ -1 +1 @@ -import{j as s}from"./vendor-query-CqA1cBNl.js";import{r as d}from"./vendor-react-BfuodpLv.js";import{E as o}from"./index-DXL5wCpD.js";const t=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("rounded-xl border border-border bg-card text-card-foreground shadow-sm",a),...r}));t.displayName="Card";const i=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("flex flex-col space-y-1.5 p-6",a),...r}));i.displayName="CardHeader";const n=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("font-display text-lg font-semibold leading-none tracking-tight",a),...r}));n.displayName="CardTitle";const m=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("text-sm text-muted-foreground",a),...r}));m.displayName="CardDescription";const c=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("p-6 pt-0",a),...r}));c.displayName="CardContent";export{t as C,i as a,n as b,c}; +import{j as s}from"./vendor-query-CqA1cBNl.js";import{r as d}from"./vendor-react-BfuodpLv.js";import{E as o}from"./index-CLb-kMYl.js";const t=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("rounded-xl border border-border bg-card text-card-foreground shadow-sm",a),...r}));t.displayName="Card";const i=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("flex flex-col space-y-1.5 p-6",a),...r}));i.displayName="CardHeader";const n=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("font-display text-lg font-semibold leading-none tracking-tight",a),...r}));n.displayName="CardTitle";const m=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("text-sm text-muted-foreground",a),...r}));m.displayName="CardDescription";const c=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("p-6 pt-0",a),...r}));c.displayName="CardContent";export{t as C,i as a,n as b,c}; diff --git a/src/surreal_memory/server/static/dist/assets/confirm-dialog-DE0Sgk6_.js b/src/surreal_memory/server/static/dist/assets/confirm-dialog-u0oWl0am.js similarity index 94% rename from src/surreal_memory/server/static/dist/assets/confirm-dialog-DE0Sgk6_.js rename to src/surreal_memory/server/static/dist/assets/confirm-dialog-u0oWl0am.js index f72487fc..3681cca5 100644 --- a/src/surreal_memory/server/static/dist/assets/confirm-dialog-DE0Sgk6_.js +++ b/src/surreal_memory/server/static/dist/assets/confirm-dialog-u0oWl0am.js @@ -1 +1 @@ -import{j as r}from"./vendor-query-CqA1cBNl.js";import{r as a}from"./vendor-react-BfuodpLv.js";import{f as x,a as n}from"./index-DXL5wCpD.js";function j({open:t,title:l,description:d,confirmLabel:c,cancelLabel:m,variant:f="default",onConfirm:u,onCancel:s}){const o=a.useRef(null),{t:i}=x();return a.useEffect(()=>{const e=o.current;e&&(t&&!e.open&&e.showModal(),!t&&e.open&&e.close())},[t]),t?r.jsx("dialog",{ref:o,className:"fixed inset-0 z-50 m-auto max-w-md rounded-xl border border-border bg-card p-0 shadow-lg backdrop:bg-black/50",onClose:s,onClick:e=>{e.target===o.current&&s()},children:r.jsxs("div",{className:"p-6",children:[r.jsx("h2",{className:"font-display text-lg font-bold text-card-foreground",children:l}),r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:d}),r.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[r.jsx(n,{variant:"outline",size:"sm",onClick:s,children:m??i("common.cancel")}),r.jsx(n,{variant:f==="destructive"?"destructive":"default",size:"sm",onClick:u,children:c??i("common.confirm")})]})]})}):null}export{j as C}; +import{j as r}from"./vendor-query-CqA1cBNl.js";import{r as a}from"./vendor-react-BfuodpLv.js";import{f as x,a as n}from"./index-CLb-kMYl.js";function j({open:t,title:l,description:d,confirmLabel:c,cancelLabel:m,variant:f="default",onConfirm:u,onCancel:s}){const o=a.useRef(null),{t:i}=x();return a.useEffect(()=>{const e=o.current;e&&(t&&!e.open&&e.showModal(),!t&&e.open&&e.close())},[t]),t?r.jsx("dialog",{ref:o,className:"fixed inset-0 z-50 m-auto max-w-md rounded-xl border border-border bg-card p-0 shadow-lg backdrop:bg-black/50",onClose:s,onClick:e=>{e.target===o.current&&s()},children:r.jsxs("div",{className:"p-6",children:[r.jsx("h2",{className:"font-display text-lg font-bold text-card-foreground",children:l}),r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:d}),r.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[r.jsx(n,{variant:"outline",size:"sm",onClick:s,children:m??i("common.cancel")}),r.jsx(n,{variant:f==="destructive"?"destructive":"default",size:"sm",onClick:u,children:c??i("common.confirm")})]})]})}):null}export{j as C}; diff --git a/src/surreal_memory/server/static/dist/assets/index-BgBv2qcr.css b/src/surreal_memory/server/static/dist/assets/index-BgBv2qcr.css deleted file mode 100644 index 89f60f49..00000000 --- a/src/surreal_memory/server/static/dist/assets/index-BgBv2qcr.css +++ /dev/null @@ -1 +0,0 @@ -@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-divide-x-reverse:0}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, sans-serif;--font-mono:"JetBrains Mono", ui-monospace, monospace;--color-red-500:oklch(63.7% .237 25.331);--color-red-900:oklch(39.6% .141 25.723);--color-red-950:oklch(25.8% .092 26.042);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-950:oklch(26.6% .079 36.259);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-900:oklch(41.4% .112 45.904);--color-amber-950:oklch(27.9% .077 45.635);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-900:oklch(37.8% .077 168.94);--color-emerald-950:oklch(26.2% .051 172.552);--color-teal-900:oklch(38.6% .063 188.416);--color-teal-950:oklch(27.7% .046 192.524);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-900:oklch(39.8% .07 227.392);--color-cyan-950:oklch(30.2% .056 229.695);--color-blue-900:oklch(37.9% .146 265.522);--color-blue-950:oklch(28.2% .091 267.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-violet-900:oklch(38% .189 293.745);--color-violet-950:oklch(28.3% .141 291.089);--color-rose-900:oklch(41% .159 10.272);--color-rose-950:oklch(27.1% .105 12.094);--color-stone-900:oklch(21.6% .006 56.043);--color-stone-950:oklch(14.7% .004 49.25);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-7xl:4.5rem;--text-7xl--line-height:1;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-md:8px;--radius-lg:12px;--radius-xl:16px;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-background:#faf8f3;--color-foreground:#1a1714;--color-card:#f5f0ea;--color-card-foreground:#1a1714;--color-primary:#6366f1;--color-primary-foreground:#fff;--color-secondary:#ede5d8;--color-secondary-foreground:#1a1714;--color-muted:#ede5d8;--color-muted-foreground:#78716c;--color-accent:#e8e0d4;--color-accent-foreground:#1a1714;--color-destructive:#dc2626;--color-destructive-foreground:#fff;--color-border:#d4ccc2;--color-input:#d4ccc2;--color-ring:#6366f1;--color-health-good:#059669;--color-health-warn:#f59e0b;--color-chart-1:#6366f1;--color-chart-2:#8b5cf6;--color-chart-3:#06b6d4;--color-chart-4:#f59e0b;--color-chart-5:#059669;--font-display:"Space Grotesk", ui-sans-serif, system-ui, sans-serif;--transition-normal:.25s ease;--color-sidebar:#f0ebe4;--color-sidebar-foreground:#1a1714;--color-sidebar-border:#d4ccc2;--color-sidebar-accent:#e8e0d4;--color-sidebar-primary:#6366f1}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-2{top:calc(var(--spacing) * 2)}.top-3{top:calc(var(--spacing) * 3)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.bottom-12{bottom:calc(var(--spacing) * 12)}.left-0{left:calc(var(--spacing) * 0)}.left-3{left:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\[100\]{z-index:100}.m-auto{margin:auto}.mx-auto{margin-inline:auto}.my-4{margin-block:calc(var(--spacing) * 4)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-auto{margin-bottom:auto}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-6{margin-left:calc(var(--spacing) * 6)}.ml-16{margin-left:calc(var(--spacing) * 16)}.ml-56{margin-left:calc(var(--spacing) * 56)}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-1\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.size-12{width:calc(var(--spacing) * 12);height:calc(var(--spacing) * 12)}.size-16{width:calc(var(--spacing) * 16);height:calc(var(--spacing) * 16)}.h-0\.5{height:calc(var(--spacing) * .5)}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-24{height:calc(var(--spacing) * 24)}.h-28{height:calc(var(--spacing) * 28)}.h-32{height:calc(var(--spacing) * 32)}.h-48{height:calc(var(--spacing) * 48)}.h-64{height:calc(var(--spacing) * 64)}.h-72{height:calc(var(--spacing) * 72)}.h-80{height:calc(var(--spacing) * 80)}.h-\[340px\]{height:340px}.h-\[calc\(100vh-3\.5rem\)\]{height:calc(100vh - 3.5rem)}.h-\[calc\(100vh-14rem\)\]{height:calc(100vh - 14rem)}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-96{max-height:calc(var(--spacing) * 96)}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\[200px\]{min-height:200px}.min-h-\[500px\]{min-height:500px}.w-3\/4{width:75%}.w-4{width:calc(var(--spacing) * 4)}.w-9{width:calc(var(--spacing) * 9)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-40{width:calc(var(--spacing) * 40)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-\[240px\]{width:240px}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[200px\]{max-width:200px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-105{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:var(--color-border)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.\!border-0{border-style:var(--tw-border-style)!important;border-width:0!important}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.\!border-border{border-color:var(--color-border)!important}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-border{border-color:var(--color-border)}.border-border\/50{border-color:#d4ccc280}@supports (color:color-mix(in lab,red,red)){.border-border\/50{border-color:color-mix(in oklab,var(--color-border) 50%,transparent)}}.border-input{border-color:var(--color-input)}.border-muted-foreground{border-color:var(--color-muted-foreground)}.border-primary{border-color:var(--color-primary)}.border-primary\/20{border-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.border-primary\/20{border-color:color-mix(in oklab,var(--color-primary) 20%,transparent)}}.border-primary\/30{border-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.border-primary\/30{border-color:color-mix(in oklab,var(--color-primary) 30%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-sidebar-border{border-color:var(--color-sidebar-border)}.border-transparent{border-color:#0000}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.border-t-transparent{border-top-color:#0000}.\!bg-card{background-color:var(--color-card)!important}.\!bg-transparent{background-color:#0000!important}.bg-\[\#16140f\]{background-color:#16140f}.bg-accent{background-color:var(--color-accent)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-background{background-color:var(--color-background)}.bg-background\/80{background-color:#faf8f3cc}@supports (color:color-mix(in lab,red,red)){.bg-background\/80{background-color:color-mix(in oklab,var(--color-background) 80%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-card{background-color:var(--color-card)}.bg-card\/90{background-color:#f5f0eae6}@supports (color:color-mix(in lab,red,red)){.bg-card\/90{background-color:color-mix(in oklab,var(--color-card) 90%,transparent)}}.bg-destructive{background-color:var(--color-destructive)}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-health-good\/10{background-color:#0596691a}@supports (color:color-mix(in lab,red,red)){.bg-health-good\/10{background-color:color-mix(in oklab,var(--color-health-good) 10%,transparent)}}.bg-health-warn\/10{background-color:#f59e0b1a}@supports (color:color-mix(in lab,red,red)){.bg-health-warn\/10{background-color:color-mix(in oklab,var(--color-health-warn) 10%,transparent)}}.bg-muted{background-color:var(--color-muted)}.bg-muted\/20{background-color:#ede5d833}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,var(--color-muted) 20%,transparent)}}.bg-muted\/30{background-color:#ede5d84d}@supports (color:color-mix(in lab,red,red)){.bg-muted\/30{background-color:color-mix(in oklab,var(--color-muted) 30%,transparent)}}.bg-orange-500{background-color:var(--color-orange-500)}.bg-primary{background-color:var(--color-primary)}.bg-primary\/5{background-color:#6366f10d}@supports (color:color-mix(in lab,red,red)){.bg-primary\/5{background-color:color-mix(in oklab,var(--color-primary) 5%,transparent)}}.bg-primary\/10{background-color:#6366f11a}@supports (color:color-mix(in lab,red,red)){.bg-primary\/10{background-color:color-mix(in oklab,var(--color-primary) 10%,transparent)}}.bg-primary\/15{background-color:#6366f126}@supports (color:color-mix(in lab,red,red)){.bg-primary\/15{background-color:color-mix(in oklab,var(--color-primary) 15%,transparent)}}.bg-primary\/90{background-color:#6366f1e6}@supports (color:color-mix(in lab,red,red)){.bg-primary\/90{background-color:color-mix(in oklab,var(--color-primary) 90%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-secondary{background-color:var(--color-secondary)}.bg-sidebar{background-color:var(--color-sidebar)}.bg-sidebar-accent{background-color:var(--color-sidebar-accent)}.bg-transparent{background-color:#0000}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-amber-900\/40{--tw-gradient-from:#7b330666}@supports (color:color-mix(in lab,red,red)){.from-amber-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-amber-900) 40%, transparent)}}.from-amber-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-900\/40{--tw-gradient-from:#1c398e66}@supports (color:color-mix(in lab,red,red)){.from-blue-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-blue-900) 40%, transparent)}}.from-blue-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-900\/40{--tw-gradient-from:#104e6466}@supports (color:color-mix(in lab,red,red)){.from-cyan-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-cyan-900) 40%, transparent)}}.from-cyan-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-900\/40{--tw-gradient-from:#004e3b66}@supports (color:color-mix(in lab,red,red)){.from-emerald-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-900) 40%, transparent)}}.from-emerald-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-primary\/5{--tw-gradient-from:#6366f10d}@supports (color:color-mix(in lab,red,red)){.from-primary\/5{--tw-gradient-from:color-mix(in oklab, var(--color-primary) 5%, transparent)}}.from-primary\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-red-900\/40{--tw-gradient-from:#82181a66}@supports (color:color-mix(in lab,red,red)){.from-red-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-red-900) 40%, transparent)}}.from-red-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-900\/40{--tw-gradient-from:#8b083666}@supports (color:color-mix(in lab,red,red)){.from-rose-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-rose-900) 40%, transparent)}}.from-rose-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-stone-900\/40{--tw-gradient-from:#1c191766}@supports (color:color-mix(in lab,red,red)){.from-stone-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-stone-900) 40%, transparent)}}.from-stone-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-900\/40{--tw-gradient-from:#0b4f4a66}@supports (color:color-mix(in lab,red,red)){.from-teal-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-teal-900) 40%, transparent)}}.from-teal-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-900\/40{--tw-gradient-from:#4d179a66}@supports (color:color-mix(in lab,red,red)){.from-violet-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-violet-900) 40%, transparent)}}.from-violet-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-amber-950\/60{--tw-gradient-to:#46190199}@supports (color:color-mix(in lab,red,red)){.to-amber-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-amber-950) 60%, transparent)}}.to-amber-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-blue-950\/60{--tw-gradient-to:#16245699}@supports (color:color-mix(in lab,red,red)){.to-blue-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-blue-950) 60%, transparent)}}.to-blue-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-950\/60{--tw-gradient-to:#05334599}@supports (color:color-mix(in lab,red,red)){.to-cyan-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-950) 60%, transparent)}}.to-cyan-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-950\/60{--tw-gradient-to:#002c2299}@supports (color:color-mix(in lab,red,red)){.to-emerald-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-emerald-950) 60%, transparent)}}.to-emerald-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-950\/60{--tw-gradient-to:#44130699}@supports (color:color-mix(in lab,red,red)){.to-orange-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-orange-950) 60%, transparent)}}.to-orange-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-primary\/10{--tw-gradient-to:#6366f11a}@supports (color:color-mix(in lab,red,red)){.to-primary\/10{--tw-gradient-to:color-mix(in oklab, var(--color-primary) 10%, transparent)}}.to-primary\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-red-950\/60{--tw-gradient-to:#46080999}@supports (color:color-mix(in lab,red,red)){.to-red-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-red-950) 60%, transparent)}}.to-red-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-rose-950\/60{--tw-gradient-to:#4d021899}@supports (color:color-mix(in lab,red,red)){.to-rose-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-rose-950) 60%, transparent)}}.to-rose-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-stone-950\/60{--tw-gradient-to:#0c0a0999}@supports (color:color-mix(in lab,red,red)){.to-stone-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-stone-950) 60%, transparent)}}.to-stone-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-teal-950\/60{--tw-gradient-to:#022f2e99}@supports (color:color-mix(in lab,red,red)){.to-teal-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-teal-950) 60%, transparent)}}.to-teal-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-violet-950\/60{--tw-gradient-to:#2f0d6899}@supports (color:color-mix(in lab,red,red)){.to-violet-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-violet-950) 60%, transparent)}}.to-violet-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[15vh\]{padding-top:15vh}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-6{padding-left:calc(var(--spacing) * 6)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-display{font-family:var(--font-display)}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-7xl{font-size:var(--text-7xl);line-height:var(--tw-leading,var(--text-7xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-card-foreground{color:var(--color-card-foreground)}.text-cyan-500{color:var(--color-cyan-500)}.text-destructive{color:var(--color-destructive)}.text-destructive-foreground{color:var(--color-destructive-foreground)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-foreground{color:var(--color-foreground)}.text-foreground\/80{color:#1a1714cc}@supports (color:color-mix(in lab,red,red)){.text-foreground\/80{color:color-mix(in oklab,var(--color-foreground) 80%,transparent)}}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-health-good{color:var(--color-health-good)}.text-health-warn{color:var(--color-health-warn)}.text-indigo-500{color:var(--color-indigo-500)}.text-muted-foreground{color:var(--color-muted-foreground)}.text-muted-foreground\/40{color:#78716c66}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/40{color:color-mix(in oklab,var(--color-muted-foreground) 40%,transparent)}}.text-muted-foreground\/70{color:#78716cb3}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,var(--color-muted-foreground) 70%,transparent)}}.text-orange-500{color:var(--color-orange-500)}.text-primary{color:var(--color-primary)}.text-primary-foreground{color:var(--color-primary-foreground)}.text-red-500{color:var(--color-red-500)}.text-secondary-foreground{color:var(--color-secondary-foreground)}.text-sidebar-foreground{color:var(--color-sidebar-foreground)}.text-sidebar-foreground\/50{color:#1a171480}@supports (color:color-mix(in lab,red,red)){.text-sidebar-foreground\/50{color:color-mix(in oklab,var(--color-sidebar-foreground) 50%,transparent)}}.text-sidebar-foreground\/70{color:#1a1714b3}@supports (color:color-mix(in lab,red,red)){.text-sidebar-foreground\/70{color:color-mix(in oklab,var(--color-sidebar-foreground) 70%,transparent)}}.text-sidebar-primary{color:var(--color-sidebar-primary)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white) 40%,transparent)}}.text-white\/50{color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.text-white\/50{color:color-mix(in oklab,var(--color-white) 50%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline-offset-4{text-underline-offset:4px}.accent-primary{accent-color:var(--color-primary)}.opacity-10{opacity:.1}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.\!shadow-sm{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0000000d)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px var(--tw-shadow-color,#00000012);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-primary{--tw-ring-color:var(--color-primary)}.ring-primary\/30{--tw-ring-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.ring-primary\/30{--tw-ring-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}.ring-white\/5{--tw-ring-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.ring-white\/5{--tw-ring-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.ring-offset-2{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-background{--tw-ring-offset-color:var(--color-background)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.duration-700{--tw-duration:.7s;transition-duration:.7s}.duration-\[var\(--transition-normal\)\]{--tw-duration:var(--transition-normal);transition-duration:var(--transition-normal)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:bg-primary:is(:where(.group):hover *){background-color:var(--color-primary)}.group-hover\:text-foreground:is(:where(.group):hover *){color:var(--color-foreground)}}.placeholder\:text-muted-foreground::placeholder{color:var(--color-muted-foreground)}.backdrop\:bg-black\/50::backdrop{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.backdrop\:bg-black\/50::backdrop{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.first\:pt-0:first-child{padding-top:calc(var(--spacing) * 0)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}.last\:pb-0:last-child{padding-bottom:calc(var(--spacing) * 0)}@media(hover:hover){.hover\:border-primary\/40:hover{border-color:#6366f166}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/40:hover{border-color:color-mix(in oklab,var(--color-primary) 40%,transparent)}}.hover\:bg-accent:hover{background-color:var(--color-accent)}.hover\:bg-accent\/30:hover{background-color:#e8e0d44d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-accent\/30:hover{background-color:color-mix(in oklab,var(--color-accent) 30%,transparent)}}.hover\:bg-accent\/50:hover{background-color:#e8e0d480}@supports (color:color-mix(in lab,red,red)){.hover\:bg-accent\/50:hover{background-color:color-mix(in oklab,var(--color-accent) 50%,transparent)}}.hover\:bg-destructive\/90:hover{background-color:#dc2626e6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--color-destructive) 90%,transparent)}}.hover\:bg-primary:hover{background-color:var(--color-primary)}.hover\:bg-primary\/90:hover{background-color:#6366f1e6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--color-primary) 90%,transparent)}}.hover\:bg-secondary\/80:hover{background-color:#ede5d8cc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--color-secondary) 80%,transparent)}}.hover\:bg-sidebar-accent:hover{background-color:var(--color-sidebar-accent)}.hover\:text-accent-foreground:hover{color:var(--color-accent-foreground)}.hover\:text-destructive:hover{color:var(--color-destructive)}.hover\:text-foreground:hover{color:var(--color-foreground)}.hover\:text-primary-foreground:hover{color:var(--color-primary-foreground)}.hover\:text-primary\/80:hover{color:#6366f1cc}@supports (color:color-mix(in lab,red,red)){.hover\:text-primary\/80:hover{color:color-mix(in oklab,var(--color-primary) 80%,transparent)}}.hover\:text-sidebar-foreground:hover{color:var(--color-sidebar-foreground)}.hover\:underline:hover{text-decoration-line:underline}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px var(--tw-shadow-color,#00000012);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-sm:hover{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-ring:focus{--tw-ring-color:var(--color-ring)}.focus\:outline-2:focus{outline-style:var(--tw-outline-style);outline-width:2px}.focus\:outline-offset-2:focus{outline-offset:2px}.focus\:outline-ring:focus{outline-color:var(--color-ring)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-ring:focus-visible{outline-color:var(--color-ring)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.aria-selected\:bg-accent[aria-selected=true]{background-color:var(--color-accent)}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}@media(min-width:40rem){.sm\:inline{display:inline}.sm\:inline-flex{display:inline-flex}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}:where(.sm\:divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.sm\:divide-y-0>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(0px * var(--tw-divide-y-reverse));border-bottom-width:calc(0px * calc(1 - var(--tw-divide-y-reverse)))}.sm\:p-5{padding:calc(var(--spacing) * 5)}.sm\:pr-4{padding-right:calc(var(--spacing) * 4)}.sm\:pl-4{padding-left:calc(var(--spacing) * 4)}}@media(min-width:48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(min-width:64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&\>button\]\:\!border-border>button{border-color:var(--color-border)!important}.\[\&\>button\]\:\!bg-card>button{background-color:var(--color-card)!important}.\[\&\>button\]\:\!fill-foreground>button{fill:var(--color-foreground)!important}}:root.dark{--color-background:#0c0b09;--color-foreground:#f5f0ea;--color-card:#16140f;--color-card-foreground:#f0ebe4;--color-popover:#1a1814;--color-popover-foreground:#f5f0ea;--color-primary:#818cf8;--color-primary-foreground:#0c0b09;--color-secondary:#1e1b16;--color-secondary-foreground:#f5f0ea;--color-muted:#1e1b16;--color-muted-foreground:#a8a29e;--color-accent:#292520;--color-accent-foreground:#f5f0ea;--color-destructive:#ef4444;--color-destructive-foreground:#fff;--color-border:#2e2a24;--color-input:#342f28;--color-ring:#818cf8;--color-health-good:#34d399;--color-health-warn:#fbbf24;--color-health-bad:#f87171;--shadow-sm:0 1px 3px #0006, 0 1px 2px #0000004d;--shadow-md:0 4px 12px #00000080, 0 2px 4px #00000059;--shadow-lg:0 12px 28px #0000008c, 0 4px 8px #0006;--color-sidebar:#0e0d0a;--color-sidebar-foreground:#f5f0ea;--color-sidebar-border:#2e2a24;--color-sidebar-accent:#1e1b16;--color-sidebar-accent-foreground:#f5f0ea;--color-sidebar-primary:#818cf8;--color-sidebar-primary-foreground:#0c0b09;--color-sidebar-ring:#818cf8}body{font-family:var(--font-sans);background-color:var(--color-background);color:var(--color-foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.font-display{font-family:var(--font-display)}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:9999px}::-webkit-scrollbar-thumb:hover{background:var(--color-muted-foreground)}.dark .border{border-color:#ffffff0f}.dark .rounded-xl{background-image:linear-gradient(#ffffff06,#0000 50%);box-shadow:0 0 0 1px #ffffff0a,0 2px 8px #0006}.dark aside{box-shadow:1px 0 12px #00000080}.dark header{box-shadow:0 1px 8px #0006}:focus-visible{outline:2px solid var(--color-ring);outline-offset:2px}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/src/surreal_memory/server/static/dist/assets/index-DXL5wCpD.js b/src/surreal_memory/server/static/dist/assets/index-CLb-kMYl.js similarity index 89% rename from src/surreal_memory/server/static/dist/assets/index-DXL5wCpD.js rename to src/surreal_memory/server/static/dist/assets/index-CLb-kMYl.js index 73f761eb..50b40656 100644 --- a/src/surreal_memory/server/static/dist/assets/index-DXL5wCpD.js +++ b/src/surreal_memory/server/static/dist/assets/index-CLb-kMYl.js @@ -1,13 +1,13 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OverviewPage-BixPEj84.js","assets/vendor-query-CqA1cBNl.js","assets/vendor-react-BfuodpLv.js","assets/card-Duzfr-hx.js","assets/skeleton-CBW-y0cP.js","assets/confirm-dialog-DE0Sgk6_.js","assets/vendor-icons-C6dhS1UE.js","assets/vendor-ui-Qm4_4bAc.js","assets/vendor-recharts-BkwZfCWA.js","assets/HealthPage-DoDlPq43.js","assets/UncertaintyPage-CdFbDPD5.js","assets/GraphPage-B5RqF55O.js","assets/TimelinePage-2mV1L6iZ.js","assets/EvolutionPage-C6VI1EZi.js","assets/ProGate-DjphnyL3.js","assets/DiagramsPage-ClJ9QIg8.js","assets/timer-DWAvo6M8.js","assets/DiagramsPage-BZV40eAE.css","assets/SettingsPage-CcFz-Brq.js","assets/SyncPage-BRERoUGJ.js","assets/OraclePage-BOi3rQAz.js","assets/ToolStatsPage-yrXaz2Sj.js","assets/VisualizePage-CayiR_fG.js","assets/StoragePage-BsRzooql.js","assets/ReasoningPage-BjC1wtHj.js"])))=>i.map(i=>d[i]); -import{j as E,u as it,a as fc,b as Hi,Q as Ay,c as Dy}from"./vendor-query-CqA1cBNl.js";import{a as wy,c as Ry,d as Y,e as ig,r as y,N as zy,R as dc,b as sg,u as My,O as _y,f as jy,h as ot,i as Ly,B as Uy}from"./vendor-react-BfuodpLv.js";import{c as rg,n as og,a as ug,b as By,s as cg,d as fg,e as dg,f as hg,g as mg,h as gg,i as pg,p as Hy,j as qy,k as Vy,l as vg,m as um,o as Yy,q as ky,r as cm,t as fm,u as Ky,v as Gy,w as Qy,x as Xy}from"./vendor-icons-C6dhS1UE.js";import{t as Zy,c as Fy,a as yg}from"./vendor-ui-Qm4_4bAc.js";import{r as Jy}from"./vendor-recharts-BkwZfCWA.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&o(m)}).observe(document,{childList:!0,subtree:!0});function r(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(c){if(c.ep)return;c.ep=!0;const f=r(c);fetch(c.href,f)}})();var qu={exports:{}},wi={},Vu={exports:{}},Yu={};var dm;function $y(){return dm||(dm=1,(function(i){function l(A,V){var $=A.length;A.push(V);e:for(;0<$;){var de=$-1>>>1,oe=A[de];if(0>>1;dec(q,$))Gc(k,q)?(A[de]=k,A[G]=$,de=G):(A[de]=q,A[_]=$,de=_);else if(Gc(k,$))A[de]=k,A[G]=$,de=G;else break e}}return V}function c(A,V){var $=A.sortIndex-V.sortIndex;return $!==0?$:A.id-V.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;i.unstable_now=function(){return f.now()}}else{var m=Date,h=m.now();i.unstable_now=function(){return m.now()-h}}var b=[],v=[],x=1,g=null,D=3,z=!1,j=!1,B=!1,K=!1,U=typeof setTimeout=="function"?setTimeout:null,Q=typeof clearTimeout=="function"?clearTimeout:null,Z=typeof setImmediate<"u"?setImmediate:null;function I(A){for(var V=r(v);V!==null;){if(V.callback===null)o(v);else if(V.startTime<=A)o(v),V.sortIndex=V.expirationTime,l(b,V);else break;V=r(v)}}function ee(A){if(B=!1,I(A),!j)if(r(b)!==null)j=!0,J||(J=!0,re());else{var V=r(v);V!==null&&je(ee,V.startTime-A)}}var J=!1,X=-1,ve=5,ae=-1;function te(){return K?!0:!(i.unstable_now()-aeA&&te());){var de=g.callback;if(typeof de=="function"){g.callback=null,D=g.priorityLevel;var oe=de(g.expirationTime<=A);if(A=i.unstable_now(),typeof oe=="function"){g.callback=oe,I(A),V=!0;break t}g===r(b)&&o(b),I(A)}else o(b);g=r(b)}if(g!==null)V=!0;else{var me=r(v);me!==null&&je(ee,me.startTime-A),V=!1}}break e}finally{g=null,D=$,z=!1}V=void 0}}finally{V?re():J=!1}}}var re;if(typeof Z=="function")re=function(){Z(fe)};else if(typeof MessageChannel<"u"){var Ee=new MessageChannel,Te=Ee.port2;Ee.port1.onmessage=fe,re=function(){Te.postMessage(null)}}else re=function(){U(fe,0)};function je(A,V){X=U(function(){A(i.unstable_now())},V)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(A){A.callback=null},i.unstable_forceFrameRate=function(A){0>A||125de?(A.sortIndex=$,l(v,A),r(b)===null&&A===r(v)&&(B?(Q(X),X=-1):B=!0,je(ee,$-de))):(A.sortIndex=oe,l(b,A),j||z||(j=!0,J||(J=!0,re()))),A},i.unstable_shouldYield=te,i.unstable_wrapCallback=function(A){var V=D;return function(){var $=D;D=V;try{return A.apply(this,arguments)}finally{D=$}}}})(Yu)),Yu}var hm;function Wy(){return hm||(hm=1,Vu.exports=$y()),Vu.exports}var mm;function Iy(){if(mm)return wi;mm=1;var i=Wy(),l=wy(),r=Ry();function o(e){var t="https://react.dev/errors/"+e;if(1oe||(e.current=de[oe],de[oe]=null,oe--)}function q(e,t){oe++,de[oe]=e.current,e.current=t}var G=me(null),k=me(null),le=me(null),Se=me(null);function ue(e,t){switch(q(le,t),q(k,e),q(G,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Mh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Mh(t),e=_h(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_(G),q(G,e)}function Ae(){_(G),_(k),_(le)}function At(e){e.memoizedState!==null&&q(Se,e);var t=G.current,n=_h(t,e.type);t!==n&&(q(k,e),q(G,n))}function dn(e){k.current===e&&(_(G),_(k)),Se.current===e&&(_(Se),Ci._currentValue=$)}var tn,Yi;function Zt(e){if(tn===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);tn=t&&t[1]||"",Yi=-1i.map(i=>d[i]); +import{j as E,u as it,a as fc,b as Hi,Q as Dy,c as Ay}from"./vendor-query-CqA1cBNl.js";import{a as wy,c as Ry,d as Y,e as ig,r as y,N as zy,R as dc,b as sg,u as My,O as _y,f as jy,h as ot,i as Ly,B as Uy}from"./vendor-react-BfuodpLv.js";import{c as rg,n as og,a as ug,b as By,s as cg,d as fg,e as dg,f as hg,g as mg,h as gg,i as pg,p as Hy,j as qy,k as Vy,l as vg,m as um,o as Yy,q as ky,r as cm,t as fm,u as Ky,v as Gy,w as Qy,x as Xy}from"./vendor-icons-C6dhS1UE.js";import{t as Zy,c as Fy,a as yg}from"./vendor-ui-Qm4_4bAc.js";import{r as Jy}from"./vendor-recharts-BkwZfCWA.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&o(m)}).observe(document,{childList:!0,subtree:!0});function r(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(c){if(c.ep)return;c.ep=!0;const f=r(c);fetch(c.href,f)}})();var qu={exports:{}},wi={},Vu={exports:{}},Yu={};var dm;function $y(){return dm||(dm=1,(function(i){function l(D,V){var $=D.length;D.push(V);e:for(;0<$;){var de=$-1>>>1,oe=D[de];if(0>>1;dec(q,$))Gc(k,q)?(D[de]=k,D[G]=$,de=G):(D[de]=q,D[_]=$,de=_);else if(Gc(k,$))D[de]=k,D[G]=$,de=G;else break e}}return V}function c(D,V){var $=D.sortIndex-V.sortIndex;return $!==0?$:D.id-V.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;i.unstable_now=function(){return f.now()}}else{var m=Date,h=m.now();i.unstable_now=function(){return m.now()-h}}var b=[],v=[],x=1,g=null,A=3,z=!1,j=!1,B=!1,K=!1,U=typeof setTimeout=="function"?setTimeout:null,Q=typeof clearTimeout=="function"?clearTimeout:null,Z=typeof setImmediate<"u"?setImmediate:null;function I(D){for(var V=r(v);V!==null;){if(V.callback===null)o(v);else if(V.startTime<=D)o(v),V.sortIndex=V.expirationTime,l(b,V);else break;V=r(v)}}function ee(D){if(B=!1,I(D),!j)if(r(b)!==null)j=!0,J||(J=!0,re());else{var V=r(v);V!==null&&je(ee,V.startTime-D)}}var J=!1,X=-1,ve=5,ae=-1;function te(){return K?!0:!(i.unstable_now()-aeD&&te());){var de=g.callback;if(typeof de=="function"){g.callback=null,A=g.priorityLevel;var oe=de(g.expirationTime<=D);if(D=i.unstable_now(),typeof oe=="function"){g.callback=oe,I(D),V=!0;break t}g===r(b)&&o(b),I(D)}else o(b);g=r(b)}if(g!==null)V=!0;else{var me=r(v);me!==null&&je(ee,me.startTime-D),V=!1}}break e}finally{g=null,A=$,z=!1}V=void 0}}finally{V?re():J=!1}}}var re;if(typeof Z=="function")re=function(){Z(fe)};else if(typeof MessageChannel<"u"){var Ee=new MessageChannel,Te=Ee.port2;Ee.port1.onmessage=fe,re=function(){Te.postMessage(null)}}else re=function(){U(fe,0)};function je(D,V){X=U(function(){D(i.unstable_now())},V)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(D){D.callback=null},i.unstable_forceFrameRate=function(D){0>D||125de?(D.sortIndex=$,l(v,D),r(b)===null&&D===r(v)&&(B?(Q(X),X=-1):B=!0,je(ee,$-de))):(D.sortIndex=oe,l(b,D),j||z||(j=!0,J||(J=!0,re()))),D},i.unstable_shouldYield=te,i.unstable_wrapCallback=function(D){var V=A;return function(){var $=A;A=V;try{return D.apply(this,arguments)}finally{A=$}}}})(Yu)),Yu}var hm;function Wy(){return hm||(hm=1,Vu.exports=$y()),Vu.exports}var mm;function Iy(){if(mm)return wi;mm=1;var i=Wy(),l=wy(),r=Ry();function o(e){var t="https://react.dev/errors/"+e;if(1oe||(e.current=de[oe],de[oe]=null,oe--)}function q(e,t){oe++,de[oe]=e.current,e.current=t}var G=me(null),k=me(null),le=me(null),Se=me(null);function ue(e,t){switch(q(le,t),q(k,e),q(G,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Mh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Mh(t),e=_h(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_(G),q(G,e)}function De(){_(G),_(k),_(le)}function Dt(e){e.memoizedState!==null&&q(Se,e);var t=G.current,n=_h(t,e.type);t!==n&&(q(k,e),q(G,n))}function dn(e){k.current===e&&(_(G),_(k)),Se.current===e&&(_(Se),Ci._currentValue=$)}var tn,Yi;function Zt(e){if(tn===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);tn=t&&t[1]||"",Yi=-1)":-1s||S[a]!==N[s]){var M=` `+S[a].replace(" at new "," at ");return e.displayName&&M.includes("")&&(M=M.replace("",e.displayName)),M}while(1<=a&&0<=s);break}}}finally{jl=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Zt(n):""}function ca(e,t){switch(e.tag){case 26:case 27:case 5:return Zt(e.type);case 16:return Zt("Lazy");case 13:return e.child!==t&&t!==null?Zt("Suspense Fallback"):Zt("Suspense");case 19:return Zt("SuspenseList");case 0:case 15:return Ha(e.type,!1);case 11:return Ha(e.type.render,!1);case 1:return Ha(e.type,!0);case 31:return Zt("Activity");default:return""}}function Ll(e){try{var t="",n=null;do t+=ca(e,n),n=e,e=e.return;while(e);return t}catch(a){return` Error generating stack: `+a.message+` -`+a.stack}}var Dt=Object.prototype.hasOwnProperty,Ul=i.unstable_scheduleCallback,Bl=i.unstable_cancelCallback,ut=i.unstable_shouldYield,_n=i.unstable_requestPaint,ct=i.unstable_now,Nr=i.unstable_getCurrentPriorityLevel,fa=i.unstable_ImmediatePriority,ki=i.unstable_UserBlockingPriority,da=i.unstable_NormalPriority,Hl=i.unstable_LowPriority,hn=i.unstable_IdlePriority,Ki=i.log,jn=i.unstable_setDisableYieldValue,ha=null,ft=null;function Ft(e){if(typeof Ki=="function"&&jn(e),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(ha,e)}catch{}}var st=Math.clz32?Math.clz32:nn,Ar=Math.log,ql=Math.LN2;function nn(e){return e>>>=0,e===0?32:31-(Ar(e)/ql|0)|0}var qa=256,Va=262144,ma=4194304;function an(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ie(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var s=0,u=e.suspendedLanes,d=e.pingedLanes;e=e.warmLanes;var p=a&134217727;return p!==0?(a=p&~u,a!==0?s=an(a):(d&=p,d!==0?s=an(d):n||(n=p&~e,n!==0&&(s=an(n))))):(p=a&~u,p!==0?s=an(p):d!==0?s=an(d):n||(n=a&~e,n!==0&&(s=an(n)))),s===0?0:t!==0&&t!==s&&(t&u)===0&&(u=s&-s,n=t&-t,u>=n||u===32&&(n&4194048)!==0)?t:s}function Be(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function We(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rt(){var e=ma;return ma<<=1,(ma&62914560)===0&&(ma=4194304),e}function Ln(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ve(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function mt(e,t,n,a,s,u){var d=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var p=e.entanglements,S=e.expirationTimes,N=e.hiddenUpdates;for(n=d&~n;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var xp=/[\n"\\]/g;function Ht(e){return e.replace(xp,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Mr(e,t,n,a,s,u,d,p){e.name="",d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"?e.type=d:e.removeAttribute("type"),t!=null?d==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Bt(t)):e.value!==""+Bt(t)&&(e.value=""+Bt(t)):d!=="submit"&&d!=="reset"||e.removeAttribute("value"),t!=null?_r(e,d,Bt(t)):n!=null?_r(e,d,Bt(n)):a!=null&&e.removeAttribute("value"),s==null&&u!=null&&(e.defaultChecked=!!u),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.name=""+Bt(p):e.removeAttribute("name")}function Cc(e,t,n,a,s,u,d,p){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||n!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){zr(e);return}n=n!=null?""+Bt(n):"",t=t!=null?""+Bt(t):n,p||t===e.value||(e.value=t),e.defaultValue=t}a=a??s,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=p?e.checked:!!a,e.defaultChecked=!!a,d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.name=d),zr(e)}function _r(e,t,n){t==="number"&&Xi(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Za(e,t,n,a){if(e=e.options,t){t={};for(var s=0;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hr=!1;if(pn)try{var Kl={};Object.defineProperty(Kl,"passive",{get:function(){Hr=!0}}),window.addEventListener("test",Kl,Kl),window.removeEventListener("test",Kl,Kl)}catch{Hr=!1}var Bn=null,qr=null,Fi=null;function Mc(){if(Fi)return Fi;var e,t=qr,n=t.length,a,s="value"in Bn?Bn.value:Bn.textContent,u=s.length;for(e=0;e=Xl),Hc=" ",qc=!1;function Vc(e,t){switch(e){case"keyup":return Jp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Wa=!1;function Wp(e,t){switch(e){case"compositionend":return Yc(t);case"keypress":return t.which!==32?null:(qc=!0,Hc);case"textInput":return e=t.data,e===Hc&&qc?null:e;default:return null}}function Ip(e,t){if(Wa)return e==="compositionend"||!Gr&&Vc(e,t)?(e=Mc(),Fi=qr=Bn=null,Wa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Jc(n)}}function Wc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ic(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Xi(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Xi(e.document)}return t}function Zr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var sv=pn&&"documentMode"in document&&11>=document.documentMode,Ia=null,Fr=null,$l=null,Jr=!1;function Pc(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Jr||Ia==null||Ia!==Xi(a)||(a=Ia,"selectionStart"in a&&Zr(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),$l&&Jl($l,a)||($l=a,a=Ys(Fr,"onSelect"),0>=d,s-=d,ln=1<<32-st(t)+s|n<he?(be=W,W=null):be=W.sibling;var Ce=w(O,W,C[he],L);if(Ce===null){W===null&&(W=be);break}e&&W&&Ce.alternate===null&&t(O,W),T=u(Ce,T,he),Oe===null?P=Ce:Oe.sibling=Ce,Oe=Ce,W=be}if(he===C.length)return n(O,W),xe&&yn(O,he),P;if(W===null){for(;hehe?(be=W,W=null):be=W.sibling;var ia=w(O,W,Ce.value,L);if(ia===null){W===null&&(W=be);break}e&&W&&ia.alternate===null&&t(O,W),T=u(ia,T,he),Oe===null?P=ia:Oe.sibling=ia,Oe=ia,W=be}if(Ce.done)return n(O,W),xe&&yn(O,he),P;if(W===null){for(;!Ce.done;he++,Ce=C.next())Ce=H(O,Ce.value,L),Ce!==null&&(T=u(Ce,T,he),Oe===null?P=Ce:Oe.sibling=Ce,Oe=Ce);return xe&&yn(O,he),P}for(W=a(W);!Ce.done;he++,Ce=C.next())Ce=R(W,O,he,Ce.value,L),Ce!==null&&(e&&Ce.alternate!==null&&W.delete(Ce.key===null?he:Ce.key),T=u(Ce,T,he),Oe===null?P=Ce:Oe.sibling=Ce,Oe=Ce);return e&&W.forEach(function(Ny){return t(O,Ny)}),xe&&yn(O,he),P}function Me(O,T,C,L){if(typeof C=="object"&&C!==null&&C.type===B&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case z:e:{for(var P=C.key;T!==null;){if(T.key===P){if(P=C.type,P===B){if(T.tag===7){n(O,T.sibling),L=s(T,C.props.children),L.return=O,O=L;break e}}else if(T.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===ve&&Na(P)===T.type){n(O,T.sibling),L=s(T,C.props),ni(L,C),L.return=O,O=L;break e}n(O,T);break}else t(O,T);T=T.sibling}C.type===B?(L=xa(C.props.children,O.mode,L,C.key),L.return=O,O=L):(L=ls(C.type,C.key,C.props,null,O.mode,L),ni(L,C),L.return=O,O=L)}return d(O);case j:e:{for(P=C.key;T!==null;){if(T.key===P)if(T.tag===4&&T.stateNode.containerInfo===C.containerInfo&&T.stateNode.implementation===C.implementation){n(O,T.sibling),L=s(T,C.children||[]),L.return=O,O=L;break e}else{n(O,T);break}else t(O,T);T=T.sibling}L=no(C,O.mode,L),L.return=O,O=L}return d(O);case ve:return C=Na(C),Me(O,T,C,L)}if(je(C))return F(O,T,C,L);if(re(C)){if(P=re(C),typeof P!="function")throw Error(o(150));return C=P.call(C),ne(O,T,C,L)}if(typeof C.then=="function")return Me(O,T,fs(C),L);if(C.$$typeof===Z)return Me(O,T,rs(O,C),L);ds(O,C)}return typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint"?(C=""+C,T!==null&&T.tag===6?(n(O,T.sibling),L=s(T,C),L.return=O,O=L):(n(O,T),L=to(C,O.mode,L),L.return=O,O=L),d(O)):n(O,T)}return function(O,T,C,L){try{ti=0;var P=Me(O,T,C,L);return ul=null,P}catch(W){if(W===ol||W===us)throw W;var Oe=Rt(29,W,null,O.mode);return Oe.lanes=L,Oe.return=O,Oe}}}var Da=Tf(!0),Of=Tf(!1),kn=!1;function go(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function po(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Kn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Gn(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Ne&2)!==0){var s=a.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),a.pending=t,t=as(e),rf(e,null,n),t}return ns(e,a,t,n),as(e)}function ai(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,gt(e,n)}}function vo(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var s=null,u=null;if(n=n.firstBaseUpdate,n!==null){do{var d={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};u===null?s=u=d:u=u.next=d,n=n.next}while(n!==null);u===null?s=u=t:u=u.next=t}else s=u=t;n={baseState:a.baseState,firstBaseUpdate:s,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var yo=!1;function li(){if(yo){var e=rl;if(e!==null)throw e}}function ii(e,t,n,a){yo=!1;var s=e.updateQueue;kn=!1;var u=s.firstBaseUpdate,d=s.lastBaseUpdate,p=s.shared.pending;if(p!==null){s.shared.pending=null;var S=p,N=S.next;S.next=null,d===null?u=N:d.next=N,d=S;var M=e.alternate;M!==null&&(M=M.updateQueue,p=M.lastBaseUpdate,p!==d&&(p===null?M.firstBaseUpdate=N:p.next=N,M.lastBaseUpdate=S))}if(u!==null){var H=s.baseState;d=0,M=N=S=null,p=u;do{var w=p.lane&-536870913,R=w!==p.lane;if(R?(ye&w)===w:(a&w)===w){w!==0&&w===sl&&(yo=!0),M!==null&&(M=M.next={lane:0,tag:p.tag,payload:p.payload,callback:null,next:null});e:{var F=e,ne=p;w=t;var Me=n;switch(ne.tag){case 1:if(F=ne.payload,typeof F=="function"){H=F.call(Me,H,w);break e}H=F;break e;case 3:F.flags=F.flags&-65537|128;case 0:if(F=ne.payload,w=typeof F=="function"?F.call(Me,H,w):F,w==null)break e;H=g({},H,w);break e;case 2:kn=!0}}w=p.callback,w!==null&&(e.flags|=64,R&&(e.flags|=8192),R=s.callbacks,R===null?s.callbacks=[w]:R.push(w))}else R={lane:w,tag:p.tag,payload:p.payload,callback:p.callback,next:null},M===null?(N=M=R,S=H):M=M.next=R,d|=w;if(p=p.next,p===null){if(p=s.shared.pending,p===null)break;R=p,p=R.next,R.next=null,s.lastBaseUpdate=R,s.shared.pending=null}}while(!0);M===null&&(S=H),s.baseState=S,s.firstBaseUpdate=N,s.lastBaseUpdate=M,u===null&&(s.shared.lanes=0),Jn|=d,e.lanes=d,e.memoizedState=H}}function Cf(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Nf(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;eu?u:8;var d=A.T,p={};A.T=p,Bo(e,!1,t,n);try{var S=s(),N=A.S;if(N!==null&&N(p,S),S!==null&&typeof S=="object"&&typeof S.then=="function"){var M=gv(S,a);oi(e,t,M,Lt(e))}else oi(e,t,a,Lt(e))}catch(H){oi(e,t,{then:function(){},status:"rejected",reason:H},Lt())}finally{V.p=u,d!==null&&p.types!==null&&(d.types=p.types),A.T=d}}function xv(){}function Lo(e,t,n,a){if(e.tag!==5)throw Error(o(476));var s=ld(e).queue;ad(e,s,t,$,n===null?xv:function(){return id(e),n(a)})}function ld(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:En,lastRenderedState:$},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:En,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function id(e){var t=ld(e);t.next===null&&(t=e.alternate.memoizedState),oi(e,t.next.queue,{},Lt())}function Uo(){return nt(Ci)}function sd(){return Ge().memoizedState}function rd(){return Ge().memoizedState}function Ev(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Lt();e=Kn(n);var a=Gn(t,e,n);a!==null&&(Tt(a,t,n),ai(a,t,n)),t={cache:co()},e.payload=t;return}t=t.return}}function Tv(e,t,n){var a=Lt();n={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Es(e)?ud(t,n):(n=Pr(e,t,n,a),n!==null&&(Tt(n,e,a),cd(n,t,a)))}function od(e,t,n){var a=Lt();oi(e,t,n,a)}function oi(e,t,n,a){var s={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Es(e))ud(t,s);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var d=t.lastRenderedState,p=u(d,n);if(s.hasEagerState=!0,s.eagerState=p,wt(p,d))return ns(e,t,s,0),_e===null&&ts(),!1}catch{}if(n=Pr(e,t,s,a),n!==null)return Tt(n,e,a),cd(n,t,a),!0}return!1}function Bo(e,t,n,a){if(a={lane:2,revertLane:gu(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Es(e)){if(t)throw Error(o(479))}else t=Pr(e,n,a,2),t!==null&&Tt(t,e,2)}function Es(e){var t=e.alternate;return e===ce||t!==null&&t===ce}function ud(e,t){fl=gs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function cd(e,t,n){if((n&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,gt(e,n)}}var ui={readContext:nt,use:ys,useCallback:Ye,useContext:Ye,useEffect:Ye,useImperativeHandle:Ye,useLayoutEffect:Ye,useInsertionEffect:Ye,useMemo:Ye,useReducer:Ye,useRef:Ye,useState:Ye,useDebugValue:Ye,useDeferredValue:Ye,useTransition:Ye,useSyncExternalStore:Ye,useId:Ye,useHostTransitionStatus:Ye,useFormState:Ye,useActionState:Ye,useOptimistic:Ye,useMemoCache:Ye,useCacheRefresh:Ye};ui.useEffectEvent=Ye;var fd={readContext:nt,use:ys,useCallback:function(e,t){return dt().memoizedState=[e,t===void 0?null:t],e},useContext:nt,useEffect:Ff,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Ss(4194308,4,If.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ss(4194308,4,e,t)},useInsertionEffect:function(e,t){Ss(4,2,e,t)},useMemo:function(e,t){var n=dt();t=t===void 0?null:t;var a=e();if(wa){Ft(!0);try{e()}finally{Ft(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=dt();if(n!==void 0){var s=n(t);if(wa){Ft(!0);try{n(t)}finally{Ft(!1)}}}else s=t;return a.memoizedState=a.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},a.queue=e,e=e.dispatch=Tv.bind(null,ce,e),[a.memoizedState,e]},useRef:function(e){var t=dt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ro(e);var t=e.queue,n=od.bind(null,ce,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:_o,useDeferredValue:function(e,t){var n=dt();return jo(n,e,t)},useTransition:function(){var e=Ro(!1);return e=ad.bind(null,ce,e.queue,!0,!1),dt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=ce,s=dt();if(xe){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),_e===null)throw Error(o(349));(ye&127)!==0||Mf(a,t,n)}s.memoizedState=n;var u={value:n,getSnapshot:t};return s.queue=u,Ff(jf.bind(null,a,u,e),[e]),a.flags|=2048,hl(9,{destroy:void 0},_f.bind(null,a,u,n,t),null),n},useId:function(){var e=dt(),t=_e.identifierPrefix;if(xe){var n=sn,a=ln;n=(a&~(1<<32-st(a)-1)).toString(32)+n,t="_"+t+"R_"+n,n=ps++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?d.createElement("select",{is:a.is}):d.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?d.createElement(s,{is:a.is}):d.createElement(s)}}u[et]=t,u[vt]=a;e:for(d=t.child;d!==null;){if(d.tag===5||d.tag===6)u.appendChild(d.stateNode);else if(d.tag!==4&&d.tag!==27&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}t.stateNode=u;e:switch(lt(u,s,a),s){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&On(t)}}return Ue(t),Wo(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&On(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(o(166));if(e=le.current,ll(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,s=tt,s!==null)switch(s.tag){case 27:case 5:a=s.memoizedProps}e[et]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||Rh(e.nodeValue,n)),e||Vn(t,!0)}else e=ks(e).createTextNode(a),e[et]=t,t.stateNode=e}return Ue(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(a=ll(t),n!==null){if(e===null){if(!a)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[et]=t}else Ea(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ue(t),e=!1}else n=so(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Mt(t),t):(Mt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Ue(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=ll(t),a!==null&&a.dehydrated!==null){if(e===null){if(!s)throw Error(o(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(o(317));s[et]=t}else Ea(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ue(t),s=!1}else s=so(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Mt(t),t):(Mt(t),null)}return Mt(t),(t.flags&128)!==0?(t.lanes=n,t):(n=a!==null,e=e!==null&&e.memoizedState!==null,n&&(a=t.child,s=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(s=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==s&&(a.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),As(t,t.updateQueue),Ue(t),null);case 4:return Ae(),e===null&&bu(t.stateNode.containerInfo),Ue(t),null;case 10:return Sn(t.type),Ue(t),null;case 19:if(_(Ke),a=t.memoizedState,a===null)return Ue(t),null;if(s=(t.flags&128)!==0,u=a.rendering,u===null)if(s)fi(a,!1);else{if(ke!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=ms(e),u!==null){for(t.flags|=128,fi(a,!1),e=u.updateQueue,t.updateQueue=e,As(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)of(n,e),n=n.sibling;return q(Ke,Ke.current&1|2),xe&&yn(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&ct()>Ms&&(t.flags|=128,s=!0,fi(a,!1),t.lanes=4194304)}else{if(!s)if(e=ms(u),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,As(t,e),fi(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!xe)return Ue(t),null}else 2*ct()-a.renderingStartTime>Ms&&n!==536870912&&(t.flags|=128,s=!0,fi(a,!1),t.lanes=4194304);a.isBackwards?(u.sibling=t.child,t.child=u):(e=a.last,e!==null?e.sibling=u:t.child=u,a.last=u)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=ct(),e.sibling=null,n=Ke.current,q(Ke,s?n&1|2:n&1),xe&&yn(t,a.treeForkCount),e):(Ue(t),null);case 22:case 23:return Mt(t),So(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(n&536870912)!==0&&(t.flags&128)===0&&(Ue(t),t.subtreeFlags&6&&(t.flags|=8192)):Ue(t),n=t.updateQueue,n!==null&&As(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&&_(Ca),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Sn(Qe),Ue(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Dv(e,t){switch(lo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Sn(Qe),Ae(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return dn(t),null;case 31:if(t.memoizedState!==null){if(Mt(t),t.alternate===null)throw Error(o(340));Ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Mt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _(Ke),null;case 4:return Ae(),null;case 10:return Sn(t.type),null;case 22:case 23:return Mt(t),So(),e!==null&&_(Ca),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Sn(Qe),null;case 25:return null;default:return null}}function Ld(e,t){switch(lo(t),t.tag){case 3:Sn(Qe),Ae();break;case 26:case 27:case 5:dn(t);break;case 4:Ae();break;case 31:t.memoizedState!==null&&Mt(t);break;case 13:Mt(t);break;case 19:_(Ke);break;case 10:Sn(t.type);break;case 22:case 23:Mt(t),So(),e!==null&&_(Ca);break;case 24:Sn(Qe)}}function di(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var s=a.next;n=s;do{if((n.tag&e)===e){a=void 0;var u=n.create,d=n.inst;a=u(),d.destroy=a}n=n.next}while(n!==s)}}catch(p){we(t,t.return,p)}}function Zn(e,t,n){try{var a=t.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var u=s.next;a=u;do{if((a.tag&e)===e){var d=a.inst,p=d.destroy;if(p!==void 0){d.destroy=void 0,s=t;var S=n,N=p;try{N()}catch(M){we(s,S,M)}}}a=a.next}while(a!==u)}}catch(M){we(t,t.return,M)}}function Ud(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Nf(t,n)}catch(a){we(e,e.return,a)}}}function Bd(e,t,n){n.props=Ra(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){we(e,t,a)}}function hi(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof n=="function"?e.refCleanup=n(a):n.current=a}}catch(s){we(e,t,s)}}function rn(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(s){we(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(s){we(e,t,s)}else n.current=null}function Hd(e){var t=e.type,n=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&a.focus();break e;case"img":n.src?a.src=n.src:n.srcSet&&(a.srcset=n.srcSet)}}catch(s){we(e,e.return,s)}}function Io(e,t,n){try{var a=e.stateNode;$v(a,e.type,n,t),a[vt]=t}catch(s){we(e,e.return,s)}}function qd(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ea(e.type)||e.tag===4}function Po(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ea(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function eu(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gn));else if(a!==4&&(a===27&&ea(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(eu(e,t,n),e=e.sibling;e!==null;)eu(e,t,n),e=e.sibling}function Ds(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(a!==4&&(a===27&&ea(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Ds(e,t,n),e=e.sibling;e!==null;)Ds(e,t,n),e=e.sibling}function Vd(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);lt(t,a,n),t[et]=e,t[vt]=n}catch(u){we(e,e.return,u)}}var Cn=!1,Fe=!1,tu=!1,Yd=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function wv(e,t){if(e=e.containerInfo,Eu=Js,e=Ic(e),Zr(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var a=n.getSelection&&n.getSelection();if(a&&a.rangeCount!==0){n=a.anchorNode;var s=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{n.nodeType,u.nodeType}catch{n=null;break e}var d=0,p=-1,S=-1,N=0,M=0,H=e,w=null;t:for(;;){for(var R;H!==n||s!==0&&H.nodeType!==3||(p=d+s),H!==u||a!==0&&H.nodeType!==3||(S=d+a),H.nodeType===3&&(d+=H.nodeValue.length),(R=H.firstChild)!==null;)w=H,H=R;for(;;){if(H===e)break t;if(w===n&&++N===s&&(p=d),w===u&&++M===a&&(S=d),(R=H.nextSibling)!==null)break;H=w,w=H.parentNode}H=R}n=p===-1||S===-1?null:{start:p,end:S}}else n=null}n=n||{start:0,end:0}}else n=null;for(Tu={focusedElem:e,selectionRange:n},Js=!1,Pe=t;Pe!==null;)if(t=Pe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Pe=e;else for(;Pe!==null;){switch(t=Pe,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),lt(u,a,n),u[et]=e,Ie(u),a=u;break e;case"link":var d=Zh("link","href",s).get(a+(n.href||""));if(d){for(var p=0;pMe&&(d=Me,Me=ne,ne=d);var O=$c(p,ne),T=$c(p,Me);if(O&&T&&(R.rangeCount!==1||R.anchorNode!==O.node||R.anchorOffset!==O.offset||R.focusNode!==T.node||R.focusOffset!==T.offset)){var C=H.createRange();C.setStart(O.node,O.offset),R.removeAllRanges(),ne>Me?(R.addRange(C),R.extend(T.node,T.offset)):(C.setEnd(T.node,T.offset),R.addRange(C))}}}}for(H=[],R=p;R=R.parentNode;)R.nodeType===1&&H.push({element:R,left:R.scrollLeft,top:R.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;pn?32:n,A.T=null,n=ou,ou=null;var u=Wn,d=Rn;if(Je=0,yl=Wn=null,Rn=0,(Ne&6)!==0)throw Error(o(331));var p=Ne;if(Ne|=4,Id(u.current),Jd(u,u.current,d,n),Ne=p,bi(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(ha,u)}catch{}return!0}finally{V.p=s,A.T=a,ph(e,t)}}function yh(e,t,n){t=Vt(n,t),t=Yo(e.stateNode,t,2),e=Gn(e,t,2),e!==null&&(Ve(e,2),on(e))}function we(e,t,n){if(e.tag===3)yh(e,e,n);else for(;t!==null;){if(t.tag===3){yh(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&($n===null||!$n.has(a))){e=Vt(n,e),n=bd(2),a=Gn(t,n,2),a!==null&&(Sd(n,a,t,e),Ve(a,2),on(a));break}}t=t.return}}function du(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new Mv;var s=new Set;a.set(t,s)}else s=a.get(t),s===void 0&&(s=new Set,a.set(t,s));s.has(n)||(lu=!0,s.add(n),e=Bv.bind(null,e,t,n),t.then(e,e))}function Bv(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,_e===e&&(ye&n)===n&&(ke===4||ke===3&&(ye&62914560)===ye&&300>ct()-zs?(Ne&2)===0&&bl(e,0):iu|=n,vl===ye&&(vl=0)),on(e)}function bh(e,t){t===0&&(t=rt()),e=Sa(e,t),e!==null&&(Ve(e,t),on(e))}function Hv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),bh(e,n)}function qv(e,t){var n=0;switch(e.tag){case 31:case 13:var a=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(o(314))}a!==null&&a.delete(t),bh(e,n)}function Vv(e,t){return Ul(e,t)}var Hs=null,xl=null,hu=!1,qs=!1,mu=!1,Pn=0;function on(e){e!==xl&&e.next===null&&(xl===null?Hs=xl=e:xl=xl.next=e),qs=!0,hu||(hu=!0,kv())}function bi(e,t){if(!mu&&qs){mu=!0;do for(var n=!1,a=Hs;a!==null;){if(e!==0){var s=a.pendingLanes;if(s===0)var u=0;else{var d=a.suspendedLanes,p=a.pingedLanes;u=(1<<31-st(42|e)+1)-1,u&=s&~(d&~p),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(n=!0,Th(a,u))}else u=ye,u=ie(a,a===_e?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||Be(a,u)||(n=!0,Th(a,u));a=a.next}while(n);mu=!1}}function Yv(){Sh()}function Sh(){qs=hu=!1;var e=0;Pn!==0&&Iv()&&(e=Pn);for(var t=ct(),n=null,a=Hs;a!==null;){var s=a.next,u=xh(a,t);u===0?(a.next=null,n===null?Hs=s:n.next=s,s===null&&(xl=n)):(n=a,(e!==0||(u&3)!==0)&&(qs=!0)),a=s}Je!==0&&Je!==5||bi(e),Pn!==0&&(Pn=0)}function xh(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,s=e.expirationTimes,u=e.pendingLanes&-62914561;0p)break;var M=S.transferSize,H=S.initiatorType;M&&zh(H)&&(S=S.responseEnd,d+=M*(S"u"?null:document;function Kh(e,t,n){var a=El;if(a&&typeof t=="string"&&t){var s=Ht(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),kh.has(s)||(kh.add(s),e={rel:e,crossOrigin:n,href:t},a.querySelector(s)===null&&(t=a.createElement("link"),lt(t,"link",e),Ie(t),a.head.appendChild(t)))}}function ry(e){zn.D(e),Kh("dns-prefetch",e,null)}function oy(e,t){zn.C(e,t),Kh("preconnect",e,t)}function uy(e,t,n){zn.L(e,t,n);var a=El;if(a&&e&&t){var s='link[rel="preload"][as="'+Ht(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+Ht(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+Ht(n.imageSizes)+'"]')):s+='[href="'+Ht(e)+'"]';var u=s;switch(t){case"style":u=Tl(e);break;case"script":u=Ol(e)}Xt.has(u)||(e=g({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Xt.set(u,e),a.querySelector(s)!==null||t==="style"&&a.querySelector(Ti(u))||t==="script"&&a.querySelector(Oi(u))||(t=a.createElement("link"),lt(t,"link",e),Ie(t),a.head.appendChild(t)))}}function cy(e,t){zn.m(e,t);var n=El;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Ht(a)+'"][href="'+Ht(e)+'"]',u=s;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ol(e)}if(!Xt.has(u)&&(e=g({rel:"modulepreload",href:e},t),Xt.set(u,e),n.querySelector(s)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Oi(u)))return}a=n.createElement("link"),lt(a,"link",e),Ie(a),n.head.appendChild(a)}}}function fy(e,t,n){zn.S(e,t,n);var a=El;if(a&&e){var s=Qa(a).hoistableStyles,u=Tl(e);t=t||"default";var d=s.get(u);if(!d){var p={loading:0,preload:null};if(d=a.querySelector(Ti(u)))p.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Xt.get(u))&&Ru(e,n);var S=d=a.createElement("link");Ie(S),lt(S,"link",e),S._p=new Promise(function(N,M){S.onload=N,S.onerror=M}),S.addEventListener("load",function(){p.loading|=1}),S.addEventListener("error",function(){p.loading|=2}),p.loading|=4,Gs(d,t,a)}d={type:"stylesheet",instance:d,count:1,state:p},s.set(u,d)}}}function dy(e,t){zn.X(e,t);var n=El;if(n&&e){var a=Qa(n).hoistableScripts,s=Ol(e),u=a.get(s);u||(u=n.querySelector(Oi(s)),u||(e=g({src:e,async:!0},t),(t=Xt.get(s))&&zu(e,t),u=n.createElement("script"),Ie(u),lt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(s,u))}}function hy(e,t){zn.M(e,t);var n=El;if(n&&e){var a=Qa(n).hoistableScripts,s=Ol(e),u=a.get(s);u||(u=n.querySelector(Oi(s)),u||(e=g({src:e,async:!0,type:"module"},t),(t=Xt.get(s))&&zu(e,t),u=n.createElement("script"),Ie(u),lt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(s,u))}}function Gh(e,t,n,a){var s=(s=le.current)?Ks(s):null;if(!s)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Tl(n.href),n=Qa(s).hoistableStyles,a=n.get(t),a||(a={type:"style",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Tl(n.href);var u=Qa(s).hoistableStyles,d=u.get(e);if(d||(s=s.ownerDocument||s,d={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,d),(u=s.querySelector(Ti(e)))&&!u._p&&(d.instance=u,d.state.loading=5),Xt.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Xt.set(e,n),u||my(s,e,n,d.state))),t&&a===null)throw Error(o(528,""));return d}if(t&&a!==null)throw Error(o(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ol(n),n=Qa(s).hoistableScripts,a=n.get(t),a||(a={type:"script",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Tl(e){return'href="'+Ht(e)+'"'}function Ti(e){return'link[rel="stylesheet"]['+e+"]"}function Qh(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function my(e,t,n,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),lt(t,"link",n),Ie(t),e.head.appendChild(t))}function Ol(e){return'[src="'+Ht(e)+'"]'}function Oi(e){return"script[async]"+e}function Xh(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+Ht(n.href)+'"]');if(a)return t.instance=a,Ie(a),a;var s=g({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Ie(a),lt(a,"style",s),Gs(a,n.precedence,e),t.instance=a;case"stylesheet":s=Tl(n.href);var u=e.querySelector(Ti(s));if(u)return t.state.loading|=4,t.instance=u,Ie(u),u;a=Qh(n),(s=Xt.get(s))&&Ru(a,s),u=(e.ownerDocument||e).createElement("link"),Ie(u);var d=u;return d._p=new Promise(function(p,S){d.onload=p,d.onerror=S}),lt(u,"link",a),t.state.loading|=4,Gs(u,n.precedence,e),t.instance=u;case"script":return u=Ol(n.src),(s=e.querySelector(Oi(u)))?(t.instance=s,Ie(s),s):(a=n,(s=Xt.get(u))&&(a=g({},n),zu(a,s)),e=e.ownerDocument||e,s=e.createElement("script"),Ie(s),lt(s,"link",a),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Gs(a,n.precedence,e));return t.instance}function Gs(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=a.length?a[a.length-1]:null,u=s,d=0;d title"):null)}function gy(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Jh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function py(e,t,n,a){if(n.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var s=Tl(a.href),u=t.querySelector(Ti(s));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Xs.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=u,Ie(u);return}u=t.ownerDocument||t,a=Qh(a),(s=Xt.get(s))&&Ru(a,s),u=u.createElement("link"),Ie(u);var d=u;d._p=new Promise(function(p,S){d.onload=p,d.onerror=S}),lt(u,"link",a),n.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Xs.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Mu=0;function vy(e,t){return e.stylesheets&&e.count===0&&Fs(e,e.stylesheets),0Mu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(s)}}:null}function Xs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fs(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Zs=null;function Fs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Zs=new Map,t.forEach(yy,e),Zs=null,Xs.call(e))}function yy(e,t){if(!(t.state.loading&4)){var n=Zs.get(e);if(n)var a=n.get(null);else{n=new Map,Zs.set(e,n);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(l){console.error(l)}}return i(),qu.exports=Iy(),qu.exports}var e0=Py();function t0(i){if(typeof document>"u")return;let l=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",l.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}const n0=i=>{switch(i){case"success":return i0;case"info":return r0;case"warning":return s0;case"error":return o0;default:return null}},a0=Array(12).fill(0),l0=({visible:i,className:l})=>Y.createElement("div",{className:["sonner-loading-wrapper",l].filter(Boolean).join(" "),"data-visible":i},Y.createElement("div",{className:"sonner-spinner"},a0.map((r,o)=>Y.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${o}`})))),i0=Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Y.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),s0=Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Y.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),r0=Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Y.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),o0=Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Y.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),u0=Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Y.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Y.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),c0=()=>{const[i,l]=Y.useState(document.hidden);return Y.useEffect(()=>{const r=()=>{l(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),i};let tc=1;class f0{constructor(){this.subscribe=l=>(this.subscribers.push(l),()=>{const r=this.subscribers.indexOf(l);this.subscribers.splice(r,1)}),this.publish=l=>{this.subscribers.forEach(r=>r(l))},this.addToast=l=>{this.publish(l),this.toasts=[...this.toasts,l]},this.create=l=>{var r;const{message:o,...c}=l,f=typeof l?.id=="number"||((r=l.id)==null?void 0:r.length)>0?l.id:tc++,m=this.toasts.find(b=>b.id===f),h=l.dismissible===void 0?!0:l.dismissible;return this.dismissedToasts.has(f)&&this.dismissedToasts.delete(f),m?this.toasts=this.toasts.map(b=>b.id===f?(this.publish({...b,...l,id:f,title:o}),{...b,...l,id:f,dismissible:h,title:o}):b):this.addToast({title:o,...c,dismissible:h,id:f}),f},this.dismiss=l=>(l?(this.dismissedToasts.add(l),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:l,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(o=>o({id:r.id,dismiss:!0}))}),l),this.message=(l,r)=>this.create({...r,message:l}),this.error=(l,r)=>this.create({...r,message:l,type:"error"}),this.success=(l,r)=>this.create({...r,type:"success",message:l}),this.info=(l,r)=>this.create({...r,type:"info",message:l}),this.warning=(l,r)=>this.create({...r,type:"warning",message:l}),this.loading=(l,r)=>this.create({...r,type:"loading",message:l}),this.promise=(l,r)=>{if(!r)return;let o;r.loading!==void 0&&(o=this.create({...r,promise:l,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const c=Promise.resolve(l instanceof Function?l():l);let f=o!==void 0,m;const h=c.then(async v=>{if(m=["resolve",v],Y.isValidElement(v))f=!1,this.create({id:o,type:"default",message:v});else if(h0(v)&&!v.ok){f=!1;const g=typeof r.error=="function"?await r.error(`HTTP error! status: ${v.status}`):r.error,D=typeof r.description=="function"?await r.description(`HTTP error! status: ${v.status}`):r.description,j=typeof g=="object"&&!Y.isValidElement(g)?g:{message:g};this.create({id:o,type:"error",description:D,...j})}else if(v instanceof Error){f=!1;const g=typeof r.error=="function"?await r.error(v):r.error,D=typeof r.description=="function"?await r.description(v):r.description,j=typeof g=="object"&&!Y.isValidElement(g)?g:{message:g};this.create({id:o,type:"error",description:D,...j})}else if(r.success!==void 0){f=!1;const g=typeof r.success=="function"?await r.success(v):r.success,D=typeof r.description=="function"?await r.description(v):r.description,j=typeof g=="object"&&!Y.isValidElement(g)?g:{message:g};this.create({id:o,type:"success",description:D,...j})}}).catch(async v=>{if(m=["reject",v],r.error!==void 0){f=!1;const x=typeof r.error=="function"?await r.error(v):r.error,g=typeof r.description=="function"?await r.description(v):r.description,z=typeof x=="object"&&!Y.isValidElement(x)?x:{message:x};this.create({id:o,type:"error",description:g,...z})}}).finally(()=>{f&&(this.dismiss(o),o=void 0),r.finally==null||r.finally.call(r)}),b=()=>new Promise((v,x)=>h.then(()=>m[0]==="reject"?x(m[1]):v(m[1])).catch(x));return typeof o!="string"&&typeof o!="number"?{unwrap:b}:Object.assign(o,{unwrap:b})},this.custom=(l,r)=>{const o=r?.id||tc++;return this.create({jsx:l(o),id:o,...r}),o},this.getActiveToasts=()=>this.toasts.filter(l=>!this.dismissedToasts.has(l.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Ct=new f0,d0=(i,l)=>{const r=l?.id||tc++;return Ct.addToast({title:i,...l,id:r}),r},h0=i=>i&&typeof i=="object"&&"ok"in i&&typeof i.ok=="boolean"&&"status"in i&&typeof i.status=="number",m0=d0,g0=()=>Ct.toasts,p0=()=>Ct.getActiveToasts(),AE=Object.assign(m0,{success:Ct.success,info:Ct.info,warning:Ct.warning,error:Ct.error,custom:Ct.custom,message:Ct.message,promise:Ct.promise,dismiss:Ct.dismiss,loading:Ct.loading},{getHistory:g0,getToasts:p0});t0("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function nr(i){return i.label!==void 0}const v0=3,y0="24px",b0="16px",pm=4e3,S0=356,x0=14,E0=45,T0=200;function un(...i){return i.filter(Boolean).join(" ")}function O0(i){const[l,r]=i.split("-"),o=[];return l&&o.push(l),r&&o.push(r),o}const C0=i=>{var l,r,o,c,f,m,h,b,v;const{invert:x,toast:g,unstyled:D,interacting:z,setHeights:j,visibleToasts:B,heights:K,index:U,toasts:Q,expanded:Z,removeToast:I,defaultRichColors:ee,closeButton:J,style:X,cancelButtonStyle:ve,actionButtonStyle:ae,className:te="",descriptionClassName:fe="",duration:re,position:Ee,gap:Te,expandByDefault:je,classNames:A,icons:V,closeButtonAriaLabel:$="Close toast"}=i,[de,oe]=Y.useState(null),[me,_]=Y.useState(null),[q,G]=Y.useState(!1),[k,le]=Y.useState(!1),[Se,ue]=Y.useState(!1),[Ae,At]=Y.useState(!1),[dn,tn]=Y.useState(!1),[Yi,Zt]=Y.useState(0),[jl,Ha]=Y.useState(0),ca=Y.useRef(g.duration||re||pm),Ll=Y.useRef(null),Dt=Y.useRef(null),Ul=U===0,Bl=U+1<=B,ut=g.type,_n=g.dismissible!==!1,ct=g.className||"",Nr=g.descriptionClassName||"",fa=Y.useMemo(()=>K.findIndex(ie=>ie.toastId===g.id)||0,[K,g.id]),ki=Y.useMemo(()=>{var ie;return(ie=g.closeButton)!=null?ie:J},[g.closeButton,J]),da=Y.useMemo(()=>g.duration||re||pm,[g.duration,re]),Hl=Y.useRef(0),hn=Y.useRef(0),Ki=Y.useRef(0),jn=Y.useRef(null),[ha,ft]=Ee.split("-"),Ft=Y.useMemo(()=>K.reduce((ie,Be,We)=>We>=fa?ie:ie+Be.height,0),[K,fa]),st=c0(),Ar=g.invert||x,ql=ut==="loading";hn.current=Y.useMemo(()=>fa*Te+Ft,[fa,Ft]),Y.useEffect(()=>{ca.current=da},[da]),Y.useEffect(()=>{G(!0)},[]),Y.useEffect(()=>{const ie=Dt.current;if(ie){const Be=ie.getBoundingClientRect().height;return Ha(Be),j(We=>[{toastId:g.id,height:Be,position:g.position},...We]),()=>j(We=>We.filter(rt=>rt.toastId!==g.id))}},[j,g.id]),Y.useLayoutEffect(()=>{if(!q)return;const ie=Dt.current,Be=ie.style.height;ie.style.height="auto";const We=ie.getBoundingClientRect().height;ie.style.height=Be,Ha(We),j(rt=>rt.find(Ve=>Ve.toastId===g.id)?rt.map(Ve=>Ve.toastId===g.id?{...Ve,height:We}:Ve):[{toastId:g.id,height:We,position:g.position},...rt])},[q,g.title,g.description,j,g.id,g.jsx,g.action,g.cancel]);const nn=Y.useCallback(()=>{le(!0),Zt(hn.current),j(ie=>ie.filter(Be=>Be.toastId!==g.id)),setTimeout(()=>{I(g)},T0)},[g,I,j,hn]);Y.useEffect(()=>{if(g.promise&&ut==="loading"||g.duration===1/0||g.type==="loading")return;let ie;return Z||z||st?(()=>{if(Ki.current{g.onAutoClose==null||g.onAutoClose.call(g,g),nn()},ca.current)),()=>clearTimeout(ie)},[Z,z,g,ut,st,nn]),Y.useEffect(()=>{g.delete&&(nn(),g.onDismiss==null||g.onDismiss.call(g,g))},[nn,g.delete]);function qa(){var ie;if(V?.loading){var Be;return Y.createElement("div",{className:un(A?.loader,g==null||(Be=g.classNames)==null?void 0:Be.loader,"sonner-loader"),"data-visible":ut==="loading"},V.loading)}return Y.createElement(l0,{className:un(A?.loader,g==null||(ie=g.classNames)==null?void 0:ie.loader),visible:ut==="loading"})}const Va=g.icon||V?.[ut]||n0(ut);var ma,an;return Y.createElement("li",{tabIndex:0,ref:Dt,className:un(te,ct,A?.toast,g==null||(l=g.classNames)==null?void 0:l.toast,A?.default,A?.[ut],g==null||(r=g.classNames)==null?void 0:r[ut]),"data-sonner-toast":"","data-rich-colors":(ma=g.richColors)!=null?ma:ee,"data-styled":!(g.jsx||g.unstyled||D),"data-mounted":q,"data-promise":!!g.promise,"data-swiped":dn,"data-removed":k,"data-visible":Bl,"data-y-position":ha,"data-x-position":ft,"data-index":U,"data-front":Ul,"data-swiping":Se,"data-dismissible":_n,"data-type":ut,"data-invert":Ar,"data-swipe-out":Ae,"data-swipe-direction":me,"data-expanded":!!(Z||je&&q),"data-testid":g.testId,style:{"--index":U,"--toasts-before":U,"--z-index":Q.length-U,"--offset":`${k?Yi:hn.current}px`,"--initial-height":je?"auto":`${jl}px`,...X,...g.style},onDragEnd:()=>{ue(!1),oe(null),jn.current=null},onPointerDown:ie=>{ie.button!==2&&(ql||!_n||(Ll.current=new Date,Zt(hn.current),ie.target.setPointerCapture(ie.pointerId),ie.target.tagName!=="BUTTON"&&(ue(!0),jn.current={x:ie.clientX,y:ie.clientY})))},onPointerUp:()=>{var ie,Be,We;if(Ae||!_n)return;jn.current=null;const rt=Number(((ie=Dt.current)==null?void 0:ie.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ln=Number(((Be=Dt.current)==null?void 0:Be.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ve=new Date().getTime()-((We=Ll.current)==null?void 0:We.getTime()),mt=de==="x"?rt:Ln,ga=Math.abs(mt)/Ve;if(Math.abs(mt)>=E0||ga>.11){Zt(hn.current),g.onDismiss==null||g.onDismiss.call(g,g),_(de==="x"?rt>0?"right":"left":Ln>0?"down":"up"),nn(),At(!0);return}else{var gt,pt;(gt=Dt.current)==null||gt.style.setProperty("--swipe-amount-x","0px"),(pt=Dt.current)==null||pt.style.setProperty("--swipe-amount-y","0px")}tn(!1),ue(!1),oe(null)},onPointerMove:ie=>{var Be,We,rt;if(!jn.current||!_n||((Be=window.getSelection())==null?void 0:Be.toString().length)>0)return;const Ve=ie.clientY-jn.current.y,mt=ie.clientX-jn.current.x;var ga;const gt=(ga=i.swipeDirections)!=null?ga:O0(Ee);!de&&(Math.abs(mt)>1||Math.abs(Ve)>1)&&oe(Math.abs(mt)>Math.abs(Ve)?"x":"y");let pt={x:0,y:0};const Ya=Jt=>1/(1.5+Math.abs(Jt)/20);if(de==="y"){if(gt.includes("top")||gt.includes("bottom"))if(gt.includes("top")&&Ve<0||gt.includes("bottom")&&Ve>0)pt.y=Ve;else{const Jt=Ve*Ya(Ve);pt.y=Math.abs(Jt)0)pt.x=mt;else{const Jt=mt*Ya(mt);pt.x=Math.abs(Jt)0||Math.abs(pt.y)>0)&&tn(!0),(We=Dt.current)==null||We.style.setProperty("--swipe-amount-x",`${pt.x}px`),(rt=Dt.current)==null||rt.style.setProperty("--swipe-amount-y",`${pt.y}px`)}},ki&&!g.jsx&&ut!=="loading"?Y.createElement("button",{"aria-label":$,"data-disabled":ql,"data-close-button":!0,onClick:ql||!_n?()=>{}:()=>{nn(),g.onDismiss==null||g.onDismiss.call(g,g)},className:un(A?.closeButton,g==null||(o=g.classNames)==null?void 0:o.closeButton)},(an=V?.close)!=null?an:u0):null,(ut||g.icon||g.promise)&&g.icon!==null&&(V?.[ut]!==null||g.icon)?Y.createElement("div",{"data-icon":"",className:un(A?.icon,g==null||(c=g.classNames)==null?void 0:c.icon)},g.promise||g.type==="loading"&&!g.icon?g.icon||qa():null,g.type!=="loading"?Va:null):null,Y.createElement("div",{"data-content":"",className:un(A?.content,g==null||(f=g.classNames)==null?void 0:f.content)},Y.createElement("div",{"data-title":"",className:un(A?.title,g==null||(m=g.classNames)==null?void 0:m.title)},g.jsx?g.jsx:typeof g.title=="function"?g.title():g.title),g.description?Y.createElement("div",{"data-description":"",className:un(fe,Nr,A?.description,g==null||(h=g.classNames)==null?void 0:h.description)},typeof g.description=="function"?g.description():g.description):null),Y.isValidElement(g.cancel)?g.cancel:g.cancel&&nr(g.cancel)?Y.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||ve,onClick:ie=>{nr(g.cancel)&&_n&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,ie),nn())},className:un(A?.cancelButton,g==null||(b=g.classNames)==null?void 0:b.cancelButton)},g.cancel.label):null,Y.isValidElement(g.action)?g.action:g.action&&nr(g.action)?Y.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||ae,onClick:ie=>{nr(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,ie),!ie.defaultPrevented&&nn())},className:un(A?.actionButton,g==null||(v=g.classNames)==null?void 0:v.actionButton)},g.action.label):null)};function vm(){if(typeof window>"u"||typeof document>"u")return"ltr";const i=document.documentElement.getAttribute("dir");return i==="auto"||!i?window.getComputedStyle(document.documentElement).direction:i}function N0(i,l){const r={};return[i,l].forEach((o,c)=>{const f=c===1,m=f?"--mobile-offset":"--offset",h=f?b0:y0;function b(v){["top","right","bottom","left"].forEach(x=>{r[`${m}-${x}`]=typeof v=="number"?`${v}px`:v})}typeof o=="number"||typeof o=="string"?b(o):typeof o=="object"?["top","right","bottom","left"].forEach(v=>{o[v]===void 0?r[`${m}-${v}`]=h:r[`${m}-${v}`]=typeof o[v]=="number"?`${o[v]}px`:o[v]}):b(h)}),r}const A0=Y.forwardRef(function(l,r){const{id:o,invert:c,position:f="bottom-right",hotkey:m=["altKey","KeyT"],expand:h,closeButton:b,className:v,offset:x,mobileOffset:g,theme:D="light",richColors:z,duration:j,style:B,visibleToasts:K=v0,toastOptions:U,dir:Q=vm(),gap:Z=x0,icons:I,containerAriaLabel:ee="Notifications"}=l,[J,X]=Y.useState([]),ve=Y.useMemo(()=>o?J.filter(q=>q.toasterId===o):J.filter(q=>!q.toasterId),[J,o]),ae=Y.useMemo(()=>Array.from(new Set([f].concat(ve.filter(q=>q.position).map(q=>q.position)))),[ve,f]),[te,fe]=Y.useState([]),[re,Ee]=Y.useState(!1),[Te,je]=Y.useState(!1),[A,V]=Y.useState(D!=="system"?D:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),$=Y.useRef(null),de=m.join("+").replace(/Key/g,"").replace(/Digit/g,""),oe=Y.useRef(null),me=Y.useRef(!1),_=Y.useCallback(q=>{X(G=>{var k;return(k=G.find(le=>le.id===q.id))!=null&&k.delete||Ct.dismiss(q.id),G.filter(({id:le})=>le!==q.id)})},[]);return Y.useEffect(()=>Ct.subscribe(q=>{if(q.dismiss){requestAnimationFrame(()=>{X(G=>G.map(k=>k.id===q.id?{...k,delete:!0}:k))});return}setTimeout(()=>{ig.flushSync(()=>{X(G=>{const k=G.findIndex(le=>le.id===q.id);return k!==-1?[...G.slice(0,k),{...G[k],...q},...G.slice(k+1)]:[q,...G]})})})}),[J]),Y.useEffect(()=>{if(D!=="system"){V(D);return}if(D==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window>"u")return;const q=window.matchMedia("(prefers-color-scheme: dark)");try{q.addEventListener("change",({matches:G})=>{V(G?"dark":"light")})}catch{q.addListener(({matches:k})=>{try{V(k?"dark":"light")}catch(le){console.error(le)}})}},[D]),Y.useEffect(()=>{J.length<=1&&Ee(!1)},[J]),Y.useEffect(()=>{const q=G=>{var k;if(m.every(ue=>G[ue]||G.code===ue)){var Se;Ee(!0),(Se=$.current)==null||Se.focus()}G.code==="Escape"&&(document.activeElement===$.current||(k=$.current)!=null&&k.contains(document.activeElement))&&Ee(!1)};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[m]),Y.useEffect(()=>{if($.current)return()=>{oe.current&&(oe.current.focus({preventScroll:!0}),oe.current=null,me.current=!1)}},[$.current]),Y.createElement("section",{ref:r,"aria-label":`${ee} ${de}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},ae.map((q,G)=>{var k;const[le,Se]=q.split("-");return ve.length?Y.createElement("ol",{key:q,dir:Q==="auto"?vm():Q,tabIndex:-1,ref:$,className:v,"data-sonner-toaster":!0,"data-sonner-theme":A,"data-y-position":le,"data-x-position":Se,style:{"--front-toast-height":`${((k=te[0])==null?void 0:k.height)||0}px`,"--width":`${S0}px`,"--gap":`${Z}px`,...B,...N0(x,g)},onBlur:ue=>{me.current&&!ue.currentTarget.contains(ue.relatedTarget)&&(me.current=!1,oe.current&&(oe.current.focus({preventScroll:!0}),oe.current=null))},onFocus:ue=>{ue.target instanceof HTMLElement&&ue.target.dataset.dismissible==="false"||me.current||(me.current=!0,oe.current=ue.relatedTarget)},onMouseEnter:()=>Ee(!0),onMouseMove:()=>Ee(!0),onMouseLeave:()=>{Te||Ee(!1)},onDragEnd:()=>Ee(!1),onPointerDown:ue=>{ue.target instanceof HTMLElement&&ue.target.dataset.dismissible==="false"||je(!0)},onPointerUp:()=>je(!1)},ve.filter(ue=>!ue.position&&G===0||ue.position===q).map((ue,Ae)=>{var At,dn;return Y.createElement(C0,{key:ue.id,icons:I,index:Ae,toast:ue,defaultRichColors:z,duration:(At=U?.duration)!=null?At:j,className:U?.className,descriptionClassName:U?.descriptionClassName,invert:c,visibleToasts:K,closeButton:(dn=U?.closeButton)!=null?dn:b,interacting:Te,position:q,style:U?.style,unstyled:U?.unstyled,classNames:U?.classNames,cancelButtonStyle:U?.cancelButtonStyle,actionButtonStyle:U?.actionButtonStyle,closeButtonAriaLabel:U?.closeButtonAriaLabel,removeToast:_,toasts:ve.filter(tn=>tn.position==ue.position),heights:te.filter(tn=>tn.position==ue.position),setHeights:fe,expandByDefault:h,gap:Z,expanded:re,swipeDirections:l.swipeDirections})})):null}))}),D0="modulepreload",w0=function(i){return"/"+i},ym={},Nt=function(l,r,o){let c=Promise.resolve();if(r&&r.length>0){let b=function(v){return Promise.all(v.map(x=>Promise.resolve(x).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),h=m?.nonce||m?.getAttribute("nonce");c=b(r.map(v=>{if(v=w0(v),v in ym)return;ym[v]=!0;const x=v.endsWith(".css"),g=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${g}`))return;const D=document.createElement("link");if(D.rel=x?"stylesheet":D0,x||(D.as="script"),D.crossOrigin="",D.href=v,h&&D.setAttribute("nonce",h),document.head.appendChild(D),x)return new Promise((z,j)=>{D.addEventListener("load",z),D.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${v}`)))})}))}function f(m){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=m,window.dispatchEvent(h),!h.defaultPrevented)throw m}return c.then(m=>{for(const h of m||[])h.status==="rejected"&&f(h.reason);return l().catch(f)})};function ji(...i){return Zy(Fy(i))}const bm=i=>{let l;const r=new Set,o=(v,x)=>{const g=typeof v=="function"?v(l):v;if(!Object.is(g,l)){const D=l;l=x??(typeof g!="object"||g===null)?g:Object.assign({},l,g),r.forEach(z=>z(l,D))}},c=()=>l,h={setState:o,getState:c,getInitialState:()=>b,subscribe:v=>(r.add(v),()=>r.delete(v))},b=l=i(o,c,h);return h},R0=(i=>i?bm(i):bm),z0=i=>i;function M0(i,l=z0){const r=Y.useSyncExternalStore(i.subscribe,Y.useCallback(()=>l(i.getState()),[i,l]),Y.useCallback(()=>l(i.getInitialState()),[i,l]));return Y.useDebugValue(r),r}const Sm=i=>{const l=R0(i),r=o=>M0(l,o);return Object.assign(r,l),r},_0=(i=>i?Sm(i):Sm);function bg(){if(typeof window>"u")return"system";const i=localStorage.getItem("nm-theme");return i==="light"||i==="dark"||i==="system"?i:"system"}function hr(i){const l=document.documentElement,r=i==="dark"||i==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches;l.classList.toggle("dark",r),localStorage.setItem("nm-theme",i)}hr(bg());const br=_0((i,l)=>({sidebarOpen:!0,theme:bg(),toggleSidebar:()=>i(r=>({sidebarOpen:!r.sidebarOpen})),setSidebarOpen:r=>i({sidebarOpen:r}),setTheme:r=>{hr(r),i({theme:r})},cycleTheme:()=>{const r=["light","dark","system"],o=l().theme,c=r[(r.indexOf(o)+1)%r.length];hr(c),i({theme:c})}}));typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{const{theme:i}=br.getState();i==="system"&&hr("system")});const se=i=>typeof i=="string",Ri=()=>{let i,l;const r=new Promise((o,c)=>{i=o,l=c});return r.resolve=i,r.reject=l,r},xm=i=>i==null?"":""+i,j0=(i,l,r)=>{i.forEach(o=>{l[o]&&(r[o]=l[o])})},L0=/###/g,Em=i=>i&&i.indexOf("###")>-1?i.replace(L0,"."):i,Tm=i=>!i||se(i),Mi=(i,l,r)=>{const o=se(l)?l.split("."):l;let c=0;for(;c{const{obj:o,k:c}=Mi(i,l,Object);if(o!==void 0||l.length===1){o[c]=r;return}let f=l[l.length-1],m=l.slice(0,l.length-1),h=Mi(i,m,Object);for(;h.obj===void 0&&m.length;)f=`${m[m.length-1]}.${f}`,m=m.slice(0,m.length-1),h=Mi(i,m,Object),h?.obj&&typeof h.obj[`${h.k}.${f}`]<"u"&&(h.obj=void 0);h.obj[`${h.k}.${f}`]=r},U0=(i,l,r,o)=>{const{obj:c,k:f}=Mi(i,l,Object);c[f]=c[f]||[],c[f].push(r)},mr=(i,l)=>{const{obj:r,k:o}=Mi(i,l);if(r&&Object.prototype.hasOwnProperty.call(r,o))return r[o]},B0=(i,l,r)=>{const o=mr(i,r);return o!==void 0?o:mr(l,r)},Sg=(i,l,r)=>{for(const o in l)o!=="__proto__"&&o!=="constructor"&&(o in i?se(i[o])||i[o]instanceof String||se(l[o])||l[o]instanceof String?r&&(i[o]=l[o]):Sg(i[o],l[o],r):i[o]=l[o]);return i},_a=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var H0={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const q0=i=>se(i)?i.replace(/[&<>"'\/]/g,l=>H0[l]):i;class V0{constructor(l){this.capacity=l,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(l){const r=this.regExpMap.get(l);if(r!==void 0)return r;const o=new RegExp(l);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(l,o),this.regExpQueue.push(l),o}}const Y0=[" ",",","?","!",";"],k0=new V0(20),K0=(i,l,r)=>{l=l||"",r=r||"";const o=Y0.filter(m=>l.indexOf(m)<0&&r.indexOf(m)<0);if(o.length===0)return!0;const c=k0.getRegExp(`(${o.map(m=>m==="?"?"\\?":m).join("|")})`);let f=!c.test(i);if(!f){const m=i.indexOf(r);m>0&&!c.test(i.substring(0,m))&&(f=!0)}return f},nc=(i,l,r=".")=>{if(!i)return;if(i[l])return Object.prototype.hasOwnProperty.call(i,l)?i[l]:void 0;const o=l.split(r);let c=i;for(let f=0;f-1&&bi?.replace("_","-"),G0={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,l){console?.[i]?.apply?.(console,l)}};class gr{constructor(l,r={}){this.init(l,r)}init(l,r={}){this.prefix=r.prefix||"i18next:",this.logger=l||G0,this.options=r,this.debug=r.debug}log(...l){return this.forward(l,"log","",!0)}warn(...l){return this.forward(l,"warn","",!0)}error(...l){return this.forward(l,"error","")}deprecate(...l){return this.forward(l,"warn","WARNING DEPRECATED: ",!0)}forward(l,r,o,c){return c&&!this.debug?null:(se(l[0])&&(l[0]=`${o}${this.prefix} ${l[0]}`),this.logger[r](l))}create(l){return new gr(this.logger,{prefix:`${this.prefix}:${l}:`,...this.options})}clone(l){return l=l||this.options,l.prefix=l.prefix||this.prefix,new gr(this.logger,l)}}var fn=new gr;class Sr{constructor(){this.observers={}}on(l,r){return l.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const c=this.observers[o].get(r)||0;this.observers[o].set(r,c+1)}),this}off(l,r){if(this.observers[l]){if(!r){delete this.observers[l];return}this.observers[l].delete(r)}}emit(l,...r){this.observers[l]&&Array.from(this.observers[l].entries()).forEach(([c,f])=>{for(let m=0;m{for(let m=0;m-1&&this.options.ns.splice(r,1)}getResource(l,r,o,c={}){const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,m=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let h;l.indexOf(".")>-1?h=l.split("."):(h=[l,r],o&&(Array.isArray(o)?h.push(...o):se(o)&&f?h.push(...o.split(f)):h.push(o)));const b=mr(this.data,h);return!b&&!r&&!o&&l.indexOf(".")>-1&&(l=h[0],r=h[1],o=h.slice(2).join(".")),b||!m||!se(o)?b:nc(this.data?.[l]?.[r],o,f)}addResource(l,r,o,c,f={silent:!1}){const m=f.keySeparator!==void 0?f.keySeparator:this.options.keySeparator;let h=[l,r];o&&(h=h.concat(m?o.split(m):o)),l.indexOf(".")>-1&&(h=l.split("."),c=r,r=h[1]),this.addNamespaces(r),Om(this.data,h,c),f.silent||this.emit("added",l,r,o,c)}addResources(l,r,o,c={silent:!1}){for(const f in o)(se(o[f])||Array.isArray(o[f]))&&this.addResource(l,r,f,o[f],{silent:!0});c.silent||this.emit("added",l,r,o)}addResourceBundle(l,r,o,c,f,m={silent:!1,skipCopy:!1}){let h=[l,r];l.indexOf(".")>-1&&(h=l.split("."),c=o,o=r,r=h[1]),this.addNamespaces(r);let b=mr(this.data,h)||{};m.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?Sg(b,o,f):b={...b,...o},Om(this.data,h,b),m.silent||this.emit("added",l,r,o)}removeResourceBundle(l,r){this.hasResourceBundle(l,r)&&delete this.data[l][r],this.removeNamespaces(r),this.emit("removed",l,r)}hasResourceBundle(l,r){return this.getResource(l,r)!==void 0}getResourceBundle(l,r){return r||(r=this.options.defaultNS),this.getResource(l,r)}getDataByLanguage(l){return this.data[l]}hasLanguageSomeTranslations(l){const r=this.getDataByLanguage(l);return!!(r&&Object.keys(r)||[]).find(c=>r[c]&&Object.keys(r[c]).length>0)}toJSON(){return this.data}}var xg={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,l,r,o,c){return i.forEach(f=>{l=this.processors[f]?.process(l,r,o,c)??l}),l}};const Eg=Symbol("i18next/PATH_KEY");function Q0(){const i=[],l=Object.create(null);let r;return l.get=(o,c)=>(r?.revoke?.(),c===Eg?i:(i.push(c),r=Proxy.revocable(o,l),r.proxy)),Proxy.revocable(Object.create(null),l).proxy}function ac(i,l){const{[Eg]:r}=i(Q0());return r.join(l?.keySeparator??".")}const Nm={},ku=i=>!se(i)&&typeof i!="boolean"&&typeof i!="number";class pr extends Sr{constructor(l,r={}){super(),j0(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],l,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=fn.create("translator")}changeLanguage(l){l&&(this.language=l)}exists(l,r={interpolation:{}}){const o={...r};if(l==null)return!1;const c=this.resolve(l,o);if(c?.res===void 0)return!1;const f=ku(c.res);return!(o.returnObjects===!1&&f)}extractFromKey(l,r){let o=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const c=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let f=r.ns||this.options.defaultNS||[];const m=o&&l.indexOf(o)>-1,h=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!K0(l,o,c);if(m&&!h){const b=l.match(this.interpolator.nestingRegexp);if(b&&b.length>0)return{key:l,namespaces:se(f)?[f]:f};const v=l.split(o);(o!==c||o===c&&this.options.ns.indexOf(v[0])>-1)&&(f=v.shift()),l=v.join(c)}return{key:l,namespaces:se(f)?[f]:f}}translate(l,r,o){let c=typeof r=="object"?{...r}:r;if(typeof c!="object"&&this.options.overloadTranslationOptionHandler&&(c=this.options.overloadTranslationOptionHandler(arguments)),typeof c=="object"&&(c={...c}),c||(c={}),l==null)return"";typeof l=="function"&&(l=ac(l,{...this.options,...c})),Array.isArray(l)||(l=[String(l)]);const f=c.returnDetails!==void 0?c.returnDetails:this.options.returnDetails,m=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,{key:h,namespaces:b}=this.extractFromKey(l[l.length-1],c),v=b[b.length-1];let x=c.nsSeparator!==void 0?c.nsSeparator:this.options.nsSeparator;x===void 0&&(x=":");const g=c.lng||this.language,D=c.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(g?.toLowerCase()==="cimode")return D?f?{res:`${v}${x}${h}`,usedKey:h,exactUsedKey:h,usedLng:g,usedNS:v,usedParams:this.getUsedParamsDetails(c)}:`${v}${x}${h}`:f?{res:h,usedKey:h,exactUsedKey:h,usedLng:g,usedNS:v,usedParams:this.getUsedParamsDetails(c)}:h;const z=this.resolve(l,c);let j=z?.res;const B=z?.usedKey||h,K=z?.exactUsedKey||h,U=["[object Number]","[object Function]","[object RegExp]"],Q=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,Z=!this.i18nFormat||this.i18nFormat.handleAsObject,I=c.count!==void 0&&!se(c.count),ee=pr.hasDefaultValue(c),J=I?this.pluralResolver.getSuffix(g,c.count,c):"",X=c.ordinal&&I?this.pluralResolver.getSuffix(g,c.count,{ordinal:!1}):"",ve=I&&!c.ordinal&&c.count===0,ae=ve&&c[`defaultValue${this.options.pluralSeparator}zero`]||c[`defaultValue${J}`]||c[`defaultValue${X}`]||c.defaultValue;let te=j;Z&&!j&&ee&&(te=ae);const fe=ku(te),re=Object.prototype.toString.apply(te);if(Z&&te&&fe&&U.indexOf(re)<0&&!(se(Q)&&Array.isArray(te))){if(!c.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Ee=this.options.returnedObjectHandler?this.options.returnedObjectHandler(B,te,{...c,ns:b}):`key '${h} (${this.language})' returned an object instead of string.`;return f?(z.res=Ee,z.usedParams=this.getUsedParamsDetails(c),z):Ee}if(m){const Ee=Array.isArray(te),Te=Ee?[]:{},je=Ee?K:B;for(const A in te)if(Object.prototype.hasOwnProperty.call(te,A)){const V=`${je}${m}${A}`;ee&&!j?Te[A]=this.translate(V,{...c,defaultValue:ku(ae)?ae[A]:void 0,joinArrays:!1,ns:b}):Te[A]=this.translate(V,{...c,joinArrays:!1,ns:b}),Te[A]===V&&(Te[A]=te[A])}j=Te}}else if(Z&&se(Q)&&Array.isArray(j))j=j.join(Q),j&&(j=this.extendTranslation(j,l,c,o));else{let Ee=!1,Te=!1;!this.isValidLookup(j)&&ee&&(Ee=!0,j=ae),this.isValidLookup(j)||(Te=!0,j=h);const A=(c.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Te?void 0:j,V=ee&&ae!==j&&this.options.updateMissing;if(Te||Ee||V){if(this.logger.log(V?"updateKey":"missingKey",g,v,h,V?ae:j),m){const me=this.resolve(h,{...c,keySeparator:!1});me&&me.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let $=[];const de=this.languageUtils.getFallbackCodes(this.options.fallbackLng,c.lng||this.language);if(this.options.saveMissingTo==="fallback"&&de&&de[0])for(let me=0;me{const G=ee&&q!==j?q:A;this.options.missingKeyHandler?this.options.missingKeyHandler(me,v,_,G,V,c):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(me,v,_,G,V,c),this.emit("missingKey",me,v,_,j)};this.options.saveMissing&&(this.options.saveMissingPlurals&&I?$.forEach(me=>{const _=this.pluralResolver.getSuffixes(me,c);ve&&c[`defaultValue${this.options.pluralSeparator}zero`]&&_.indexOf(`${this.options.pluralSeparator}zero`)<0&&_.push(`${this.options.pluralSeparator}zero`),_.forEach(q=>{oe([me],h+q,c[`defaultValue${q}`]||ae)})}):oe($,h,ae))}j=this.extendTranslation(j,l,c,z,o),Te&&j===h&&this.options.appendNamespaceToMissingKey&&(j=`${v}${x}${h}`),(Te||Ee)&&this.options.parseMissingKeyHandler&&(j=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${v}${x}${h}`:h,Ee?j:void 0,c))}return f?(z.res=j,z.usedParams=this.getUsedParamsDetails(c),z):j}extendTranslation(l,r,o,c,f){if(this.i18nFormat?.parse)l=this.i18nFormat.parse(l,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||c.usedLng,c.usedNS,c.usedKey,{resolved:c});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const b=se(l)&&(o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let v;if(b){const g=l.match(this.interpolator.nestingRegexp);v=g&&g.length}let x=o.replace&&!se(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(x={...this.options.interpolation.defaultVariables,...x}),l=this.interpolator.interpolate(l,x,o.lng||this.language||c.usedLng,o),b){const g=l.match(this.interpolator.nestingRegexp),D=g&&g.length;vf?.[0]===g[0]&&!o.context?(this.logger.warn(`It seems you are nesting recursively key: ${g[0]} in key: ${r[0]}`),null):this.translate(...g,r),o)),o.interpolation&&this.interpolator.reset()}const m=o.postProcess||this.options.postProcess,h=se(m)?[m]:m;return l!=null&&h?.length&&o.applyPostProcessor!==!1&&(l=xg.handle(h,l,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...c,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),l}resolve(l,r={}){let o,c,f,m,h;return se(l)&&(l=[l]),l.forEach(b=>{if(this.isValidLookup(o))return;const v=this.extractFromKey(b,r),x=v.key;c=x;let g=v.namespaces;this.options.fallbackNS&&(g=g.concat(this.options.fallbackNS));const D=r.count!==void 0&&!se(r.count),z=D&&!r.ordinal&&r.count===0,j=r.context!==void 0&&(se(r.context)||typeof r.context=="number")&&r.context!=="",B=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);g.forEach(K=>{this.isValidLookup(o)||(h=K,!Nm[`${B[0]}-${K}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(h)&&(Nm[`${B[0]}-${K}`]=!0,this.logger.warn(`key "${c}" for languages "${B.join(", ")}" won't get resolved as namespace "${h}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),B.forEach(U=>{if(this.isValidLookup(o))return;m=U;const Q=[x];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(Q,x,U,K,r);else{let I;D&&(I=this.pluralResolver.getSuffix(U,r.count,r));const ee=`${this.options.pluralSeparator}zero`,J=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(D&&(r.ordinal&&I.indexOf(J)===0&&Q.push(x+I.replace(J,this.options.pluralSeparator)),Q.push(x+I),z&&Q.push(x+ee)),j){const X=`${x}${this.options.contextSeparator||"_"}${r.context}`;Q.push(X),D&&(r.ordinal&&I.indexOf(J)===0&&Q.push(X+I.replace(J,this.options.pluralSeparator)),Q.push(X+I),z&&Q.push(X+ee))}}let Z;for(;Z=Q.pop();)this.isValidLookup(o)||(f=Z,o=this.getResource(U,K,Z,r))}))})}),{res:o,usedKey:c,exactUsedKey:f,usedLng:m,usedNS:h}}isValidLookup(l){return l!==void 0&&!(!this.options.returnNull&&l===null)&&!(!this.options.returnEmptyString&&l==="")}getResource(l,r,o,c={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(l,r,o,c):this.resourceStore.getResource(l,r,o,c)}getUsedParamsDetails(l={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=l.replace&&!se(l.replace);let c=o?l.replace:l;if(o&&typeof l.count<"u"&&(c.count=l.count),this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),!o){c={...c};for(const f of r)delete c[f]}return c}static hasDefaultValue(l){const r="defaultValue";for(const o in l)if(Object.prototype.hasOwnProperty.call(l,o)&&r===o.substring(0,r.length)&&l[o]!==void 0)return!0;return!1}}class Am{constructor(l){this.options=l,this.supportedLngs=this.options.supportedLngs||!1,this.logger=fn.create("languageUtils")}getScriptPartFromCode(l){if(l=Li(l),!l||l.indexOf("-")<0)return null;const r=l.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(l){if(l=Li(l),!l||l.indexOf("-")<0)return l;const r=l.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(l){if(se(l)&&l.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(l)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?l.toLowerCase():l)}return this.options.cleanCode||this.options.lowerCaseLng?l.toLowerCase():l}isSupportedCode(l){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(l=this.getLanguagePartFromCode(l)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(l)>-1}getBestMatchFromCodes(l){if(!l)return null;let r;return l.forEach(o=>{if(r)return;const c=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(c))&&(r=c)}),!r&&this.options.supportedLngs&&l.forEach(o=>{if(r)return;const c=this.getScriptPartFromCode(o);if(this.isSupportedCode(c))return r=c;const f=this.getLanguagePartFromCode(o);if(this.isSupportedCode(f))return r=f;r=this.options.supportedLngs.find(m=>{if(m===f)return m;if(!(m.indexOf("-")<0&&f.indexOf("-")<0)&&(m.indexOf("-")>0&&f.indexOf("-")<0&&m.substring(0,m.indexOf("-"))===f||m.indexOf(f)===0&&f.length>1))return m})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(l,r){if(!l)return[];if(typeof l=="function"&&(l=l(r)),se(l)&&(l=[l]),Array.isArray(l))return l;if(!r)return l.default||[];let o=l[r];return o||(o=l[this.getScriptPartFromCode(r)]),o||(o=l[this.formatLanguageCode(r)]),o||(o=l[this.getLanguagePartFromCode(r)]),o||(o=l.default),o||[]}toResolveHierarchy(l,r){const o=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],l),c=[],f=m=>{m&&(this.isSupportedCode(m)?c.push(m):this.logger.warn(`rejecting language code not found in supportedLngs: ${m}`))};return se(l)&&(l.indexOf("-")>-1||l.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&f(this.formatLanguageCode(l)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&f(this.getScriptPartFromCode(l)),this.options.load!=="currentOnly"&&f(this.getLanguagePartFromCode(l))):se(l)&&f(this.formatLanguageCode(l)),o.forEach(m=>{c.indexOf(m)<0&&f(this.formatLanguageCode(m))}),c}}const Dm={zero:0,one:1,two:2,few:3,many:4,other:5},wm={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class X0{constructor(l,r={}){this.languageUtils=l,this.options=r,this.logger=fn.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(l,r={}){const o=Li(l==="dev"?"en":l),c=r.ordinal?"ordinal":"cardinal",f=JSON.stringify({cleanedCode:o,type:c});if(f in this.pluralRulesCache)return this.pluralRulesCache[f];let m;try{m=new Intl.PluralRules(o,{type:c})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),wm;if(!l.match(/-|_/))return wm;const b=this.languageUtils.getLanguagePartFromCode(l);m=this.getRule(b,r)}return this.pluralRulesCache[f]=m,m}needsPlural(l,r={}){let o=this.getRule(l,r);return o||(o=this.getRule("dev",r)),o?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(l,r,o={}){return this.getSuffixes(l,o).map(c=>`${r}${c}`)}getSuffixes(l,r={}){let o=this.getRule(l,r);return o||(o=this.getRule("dev",r)),o?o.resolvedOptions().pluralCategories.sort((c,f)=>Dm[c]-Dm[f]).map(c=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${c}`):[]}getSuffix(l,r,o={}){const c=this.getRule(l,o);return c?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${c.select(r)}`:(this.logger.warn(`no plural rule found for: ${l}`),this.getSuffix("dev",r,o))}}const Rm=(i,l,r,o=".",c=!0)=>{let f=B0(i,l,r);return!f&&c&&se(r)&&(f=nc(i,r,o),f===void 0&&(f=nc(l,r,o))),f},Ku=i=>i.replace(/\$/g,"$$$$");class zm{constructor(l={}){this.logger=fn.create("interpolator"),this.options=l,this.format=l?.interpolation?.format||(r=>r),this.init(l)}init(l={}){l.interpolation||(l.interpolation={escapeValue:!0});const{escape:r,escapeValue:o,useRawValueToEscape:c,prefix:f,prefixEscaped:m,suffix:h,suffixEscaped:b,formatSeparator:v,unescapeSuffix:x,unescapePrefix:g,nestingPrefix:D,nestingPrefixEscaped:z,nestingSuffix:j,nestingSuffixEscaped:B,nestingOptionsSeparator:K,maxReplaces:U,alwaysFormat:Q}=l.interpolation;this.escape=r!==void 0?r:q0,this.escapeValue=o!==void 0?o:!0,this.useRawValueToEscape=c!==void 0?c:!1,this.prefix=f?_a(f):m||"{{",this.suffix=h?_a(h):b||"}}",this.formatSeparator=v||",",this.unescapePrefix=x?"":g||"-",this.unescapeSuffix=this.unescapePrefix?"":x||"",this.nestingPrefix=D?_a(D):z||_a("$t("),this.nestingSuffix=j?_a(j):B||_a(")"),this.nestingOptionsSeparator=K||",",this.maxReplaces=U||1e3,this.alwaysFormat=Q!==void 0?Q:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const l=(r,o)=>r?.source===o?(r.lastIndex=0,r):new RegExp(o,"g");this.regexp=l(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=l(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=l(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(l,r,o,c){let f,m,h;const b=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},v=z=>{if(z.indexOf(this.formatSeparator)<0){const U=Rm(r,b,z,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(U,void 0,o,{...c,...r,interpolationkey:z}):U}const j=z.split(this.formatSeparator),B=j.shift().trim(),K=j.join(this.formatSeparator).trim();return this.format(Rm(r,b,B,this.options.keySeparator,this.options.ignoreJSONStructure),K,o,{...c,...r,interpolationkey:B})};this.resetRegExp();const x=c?.missingInterpolationHandler||this.options.missingInterpolationHandler,g=c?.interpolation?.skipOnVariables!==void 0?c.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:z=>Ku(z)},{regex:this.regexp,safeValue:z=>this.escapeValue?Ku(this.escape(z)):Ku(z)}].forEach(z=>{for(h=0;f=z.regex.exec(l);){const j=f[1].trim();if(m=v(j),m===void 0)if(typeof x=="function"){const K=x(l,f,c);m=se(K)?K:""}else if(c&&Object.prototype.hasOwnProperty.call(c,j))m="";else if(g){m=f[0];continue}else this.logger.warn(`missed to pass in variable ${j} for interpolating ${l}`),m="";else!se(m)&&!this.useRawValueToEscape&&(m=xm(m));const B=z.safeValue(m);if(l=l.replace(f[0],B),g?(z.regex.lastIndex+=m.length,z.regex.lastIndex-=f[0].length):z.regex.lastIndex=0,h++,h>=this.maxReplaces)break}}),l}nest(l,r,o={}){let c,f,m;const h=(b,v)=>{const x=this.nestingOptionsSeparator;if(b.indexOf(x)<0)return b;const g=b.split(new RegExp(`${_a(x)}[ ]*{`));let D=`{${g[1]}`;b=g[0],D=this.interpolate(D,m);const z=D.match(/'/g),j=D.match(/"/g);((z?.length??0)%2===0&&!j||(j?.length??0)%2!==0)&&(D=D.replace(/'/g,'"'));try{m=JSON.parse(D),v&&(m={...v,...m})}catch(B){return this.logger.warn(`failed parsing options string in nesting for key ${b}`,B),`${b}${x}${D}`}return m.defaultValue&&m.defaultValue.indexOf(this.prefix)>-1&&delete m.defaultValue,b};for(;c=this.nestingRegexp.exec(l);){let b=[];m={...o},m=m.replace&&!se(m.replace)?m.replace:m,m.applyPostProcessor=!1,delete m.defaultValue;const v=/{.*}/.test(c[1])?c[1].lastIndexOf("}")+1:c[1].indexOf(this.formatSeparator);if(v!==-1&&(b=c[1].slice(v).split(this.formatSeparator).map(x=>x.trim()).filter(Boolean),c[1]=c[1].slice(0,v)),f=r(h.call(this,c[1].trim(),m),m),f&&c[0]===l&&!se(f))return f;se(f)||(f=xm(f)),f||(this.logger.warn(`missed to resolve ${c[1]} for nesting ${l}`),f=""),b.length&&(f=b.reduce((x,g)=>this.format(x,g,o.lng,{...o,interpolationkey:c[1].trim()}),f.trim())),l=l.replace(c[0],f),this.regexp.lastIndex=0}return l}}const Z0=i=>{let l=i.toLowerCase().trim();const r={};if(i.indexOf("(")>-1){const o=i.split("(");l=o[0].toLowerCase().trim();const c=o[1].substring(0,o[1].length-1);l==="currency"&&c.indexOf(":")<0?r.currency||(r.currency=c.trim()):l==="relativetime"&&c.indexOf(":")<0?r.range||(r.range=c.trim()):c.split(";").forEach(m=>{if(m){const[h,...b]=m.split(":"),v=b.join(":").trim().replace(/^'+|'+$/g,""),x=h.trim();r[x]||(r[x]=v),v==="false"&&(r[x]=!1),v==="true"&&(r[x]=!0),isNaN(v)||(r[x]=parseInt(v,10))}})}return{formatName:l,formatOptions:r}},Mm=i=>{const l={};return(r,o,c)=>{let f=c;c&&c.interpolationkey&&c.formatParams&&c.formatParams[c.interpolationkey]&&c[c.interpolationkey]&&(f={...f,[c.interpolationkey]:void 0});const m=o+JSON.stringify(f);let h=l[m];return h||(h=i(Li(o),c),l[m]=h),h(r)}},F0=i=>(l,r,o)=>i(Li(r),o)(l);class J0{constructor(l={}){this.logger=fn.create("formatter"),this.options=l,this.init(l)}init(l,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const o=r.cacheInBuiltFormats?Mm:F0;this.formats={number:o((c,f)=>{const m=new Intl.NumberFormat(c,{...f});return h=>m.format(h)}),currency:o((c,f)=>{const m=new Intl.NumberFormat(c,{...f,style:"currency"});return h=>m.format(h)}),datetime:o((c,f)=>{const m=new Intl.DateTimeFormat(c,{...f});return h=>m.format(h)}),relativetime:o((c,f)=>{const m=new Intl.RelativeTimeFormat(c,{...f});return h=>m.format(h,f.range||"day")}),list:o((c,f)=>{const m=new Intl.ListFormat(c,{...f});return h=>m.format(h)})}}add(l,r){this.formats[l.toLowerCase().trim()]=r}addCached(l,r){this.formats[l.toLowerCase().trim()]=Mm(r)}format(l,r,o,c={}){const f=r.split(this.formatSeparator);if(f.length>1&&f[0].indexOf("(")>1&&f[0].indexOf(")")<0&&f.find(h=>h.indexOf(")")>-1)){const h=f.findIndex(b=>b.indexOf(")")>-1);f[0]=[f[0],...f.splice(1,h)].join(this.formatSeparator)}return f.reduce((h,b)=>{const{formatName:v,formatOptions:x}=Z0(b);if(this.formats[v]){let g=h;try{const D=c?.formatParams?.[c.interpolationkey]||{},z=D.locale||D.lng||c.locale||c.lng||o;g=this.formats[v](h,z,{...x,...c,...D})}catch(D){this.logger.warn(D)}return g}else this.logger.warn(`there was no format function for ${v}`);return h},l)}}const $0=(i,l)=>{i.pending[l]!==void 0&&(delete i.pending[l],i.pendingCount--)};class W0 extends Sr{constructor(l,r,o,c={}){super(),this.backend=l,this.store=r,this.services=o,this.languageUtils=o.languageUtils,this.options=c,this.logger=fn.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=c.maxParallelReads||10,this.readingCalls=0,this.maxRetries=c.maxRetries>=0?c.maxRetries:5,this.retryTimeout=c.retryTimeout>=1?c.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(o,c.backend,c)}queueLoad(l,r,o,c){const f={},m={},h={},b={};return l.forEach(v=>{let x=!0;r.forEach(g=>{const D=`${v}|${g}`;!o.reload&&this.store.hasResourceBundle(v,g)?this.state[D]=2:this.state[D]<0||(this.state[D]===1?m[D]===void 0&&(m[D]=!0):(this.state[D]=1,x=!1,m[D]===void 0&&(m[D]=!0),f[D]===void 0&&(f[D]=!0),b[g]===void 0&&(b[g]=!0)))}),x||(h[v]=!0)}),(Object.keys(f).length||Object.keys(m).length)&&this.queue.push({pending:m,pendingCount:Object.keys(m).length,loaded:{},errors:[],callback:c}),{toLoad:Object.keys(f),pending:Object.keys(m),toLoadLanguages:Object.keys(h),toLoadNamespaces:Object.keys(b)}}loaded(l,r,o){const c=l.split("|"),f=c[0],m=c[1];r&&this.emit("failedLoading",f,m,r),!r&&o&&this.store.addResourceBundle(f,m,o,void 0,void 0,{skipCopy:!0}),this.state[l]=r?-1:2,r&&o&&(this.state[l]=0);const h={};this.queue.forEach(b=>{U0(b.loaded,[f],m),$0(b,l),r&&b.errors.push(r),b.pendingCount===0&&!b.done&&(Object.keys(b.loaded).forEach(v=>{h[v]||(h[v]={});const x=b.loaded[v];x.length&&x.forEach(g=>{h[v][g]===void 0&&(h[v][g]=!0)})}),b.done=!0,b.errors.length?b.callback(b.errors):b.callback())}),this.emit("loaded",h),this.queue=this.queue.filter(b=>!b.done)}read(l,r,o,c=0,f=this.retryTimeout,m){if(!l.length)return m(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:l,ns:r,fcName:o,tried:c,wait:f,callback:m});return}this.readingCalls++;const h=(v,x)=>{if(this.readingCalls--,this.waitingReads.length>0){const g=this.waitingReads.shift();this.read(g.lng,g.ns,g.fcName,g.tried,g.wait,g.callback)}if(v&&x&&c{this.read.call(this,l,r,o,c+1,f*2,m)},f);return}m(v,x)},b=this.backend[o].bind(this.backend);if(b.length===2){try{const v=b(l,r);v&&typeof v.then=="function"?v.then(x=>h(null,x)).catch(h):h(null,v)}catch(v){h(v)}return}return b(l,r,h)}prepareLoading(l,r,o={},c){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),c&&c();se(l)&&(l=this.languageUtils.toResolveHierarchy(l)),se(r)&&(r=[r]);const f=this.queueLoad(l,r,o,c);if(!f.toLoad.length)return f.pending.length||c(),null;f.toLoad.forEach(m=>{this.loadOne(m)})}load(l,r,o){this.prepareLoading(l,r,{},o)}reload(l,r,o){this.prepareLoading(l,r,{reload:!0},o)}loadOne(l,r=""){const o=l.split("|"),c=o[0],f=o[1];this.read(c,f,"read",void 0,void 0,(m,h)=>{m&&this.logger.warn(`${r}loading namespace ${f} for language ${c} failed`,m),!m&&h&&this.logger.log(`${r}loaded namespace ${f} for language ${c}`,h),this.loaded(l,m,h)})}saveMissing(l,r,o,c,f,m={},h=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${o}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend?.create){const b={...m,isUpdate:f},v=this.backend.create.bind(this.backend);if(v.length<6)try{let x;v.length===5?x=v(l,r,o,c,b):x=v(l,r,o,c),x&&typeof x.then=="function"?x.then(g=>h(null,g)).catch(h):h(null,x)}catch(x){h(x)}else v(l,r,o,c,h,b)}!l||!l[0]||this.store.addResource(l[0],r,o,c)}}}const Gu=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let l={};if(typeof i[1]=="object"&&(l=i[1]),se(i[1])&&(l.defaultValue=i[1]),se(i[2])&&(l.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const r=i[3]||i[2];Object.keys(r).forEach(o=>{l[o]=r[o]})}return l},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),_m=i=>(se(i.ns)&&(i.ns=[i.ns]),se(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),se(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),i.supportedLngs?.indexOf?.("cimode")<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),typeof i.initImmediate=="boolean"&&(i.initAsync=i.initImmediate),i),ar=()=>{},I0=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(r=>{typeof i[r]=="function"&&(i[r]=i[r].bind(i))})},Tg="__i18next_supportNoticeShown",P0=()=>typeof globalThis<"u"&&!!globalThis[Tg],eb=()=>{typeof globalThis<"u"&&(globalThis[Tg]=!0)},tb=i=>!!(i?.modules?.backend?.name?.indexOf("Locize")>0||i?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||i?.options?.backend?.backends&&i.options.backend.backends.some(l=>l?.name?.indexOf("Locize")>0||l?.constructor?.name?.indexOf("Locize")>0)||i?.options?.backend?.projectId||i?.options?.backend?.backendOptions&&i.options.backend.backendOptions.some(l=>l?.projectId));class _i extends Sr{constructor(l={},r){if(super(),this.options=_m(l),this.services={},this.logger=fn,this.modules={external:[]},I0(this),r&&!this.isInitialized&&!l.isClone){if(!this.options.initAsync)return this.init(l,r),this;setTimeout(()=>{this.init(l,r)},0)}}init(l={},r){this.isInitializing=!0,typeof l=="function"&&(r=l,l={}),l.defaultNS==null&&l.ns&&(se(l.ns)?l.defaultNS=l.ns:l.ns.indexOf("translation")<0&&(l.defaultNS=l.ns[0]));const o=Gu();this.options={...o,...this.options,..._m(l)},this.options.interpolation={...o.interpolation,...this.options.interpolation},l.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=l.keySeparator),l.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=l.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=o.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!tb(this)&&!P0()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("🌐 i18next is maintained with support from Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"),eb());const c=v=>v?typeof v=="function"?new v:v:null;if(!this.options.isClone){this.modules.logger?fn.init(c(this.modules.logger),this.options):fn.init(null,this.options);let v;this.modules.formatter?v=this.modules.formatter:v=J0;const x=new Am(this.options);this.store=new Cm(this.options.resources,this.options);const g=this.services;g.logger=fn,g.resourceStore=this.store,g.languageUtils=x,g.pluralResolver=new X0(x,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),v&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(g.formatter=c(v),g.formatter.init&&g.formatter.init(g,this.options),this.options.interpolation.format=g.formatter.format.bind(g.formatter)),g.interpolator=new zm(this.options),g.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},g.backendConnector=new W0(c(this.modules.backend),g.resourceStore,g,this.options),g.backendConnector.on("*",(z,...j)=>{this.emit(z,...j)}),this.modules.languageDetector&&(g.languageDetector=c(this.modules.languageDetector),g.languageDetector.init&&g.languageDetector.init(g,this.options.detection,this.options)),this.modules.i18nFormat&&(g.i18nFormat=c(this.modules.i18nFormat),g.i18nFormat.init&&g.i18nFormat.init(this)),this.translator=new pr(this.services,this.options),this.translator.on("*",(z,...j)=>{this.emit(z,...j)}),this.modules.external.forEach(z=>{z.init&&z.init(this)})}if(this.format=this.options.interpolation.format,r||(r=ar),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const v=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);v.length>0&&v[0]!=="dev"&&(this.options.lng=v[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(v=>{this[v]=(...x)=>this.store[v](...x)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(v=>{this[v]=(...x)=>(this.store[v](...x),this)});const h=Ri(),b=()=>{const v=(x,g)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),h.resolve(g),r(x,g)};if(this.languages&&!this.isInitialized)return v(null,this.t.bind(this));this.changeLanguage(this.options.lng,v)};return this.options.resources||!this.options.initAsync?b():setTimeout(b,0),h}loadResources(l,r=ar){let o=r;const c=se(l)?l:this.language;if(typeof l=="function"&&(o=l),!this.options.resources||this.options.partialBundledLanguages){if(c?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const f=[],m=h=>{if(!h||h==="cimode")return;this.services.languageUtils.toResolveHierarchy(h).forEach(v=>{v!=="cimode"&&f.indexOf(v)<0&&f.push(v)})};c?m(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(b=>m(b)),this.options.preload?.forEach?.(h=>m(h)),this.services.backendConnector.load(f,this.options.ns,h=>{!h&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(h)})}else o(null)}reloadResources(l,r,o){const c=Ri();return typeof l=="function"&&(o=l,l=void 0),typeof r=="function"&&(o=r,r=void 0),l||(l=this.languages),r||(r=this.options.ns),o||(o=ar),this.services.backendConnector.reload(l,r,f=>{c.resolve(),o(f)}),c}use(l){if(!l)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!l.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return l.type==="backend"&&(this.modules.backend=l),(l.type==="logger"||l.log&&l.warn&&l.error)&&(this.modules.logger=l),l.type==="languageDetector"&&(this.modules.languageDetector=l),l.type==="i18nFormat"&&(this.modules.i18nFormat=l),l.type==="postProcessor"&&xg.addPostProcessor(l),l.type==="formatter"&&(this.modules.formatter=l),l.type==="3rdParty"&&this.modules.external.push(l),this}setResolvedLanguage(l){if(!(!l||!this.languages)&&!(["cimode","dev"].indexOf(l)>-1)){for(let r=0;r-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}!this.resolvedLanguage&&this.languages.indexOf(l)<0&&this.store.hasLanguageSomeTranslations(l)&&(this.resolvedLanguage=l,this.languages.unshift(l))}}changeLanguage(l,r){this.isLanguageChangingTo=l;const o=Ri();this.emit("languageChanging",l);const c=h=>{this.language=h,this.languages=this.services.languageUtils.toResolveHierarchy(h),this.resolvedLanguage=void 0,this.setResolvedLanguage(h)},f=(h,b)=>{b?this.isLanguageChangingTo===l&&(c(b),this.translator.changeLanguage(b),this.isLanguageChangingTo=void 0,this.emit("languageChanged",b),this.logger.log("languageChanged",b)):this.isLanguageChangingTo=void 0,o.resolve((...v)=>this.t(...v)),r&&r(h,(...v)=>this.t(...v))},m=h=>{!l&&!h&&this.services.languageDetector&&(h=[]);const b=se(h)?h:h&&h[0],v=this.store.hasLanguageSomeTranslations(b)?b:this.services.languageUtils.getBestMatchFromCodes(se(h)?[h]:h);v&&(this.language||c(v),this.translator.language||this.translator.changeLanguage(v),this.services.languageDetector?.cacheUserLanguage?.(v)),this.loadResources(v,x=>{f(x,v)})};return!l&&this.services.languageDetector&&!this.services.languageDetector.async?m(this.services.languageDetector.detect()):!l&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(m):this.services.languageDetector.detect(m):m(l),o}getFixedT(l,r,o){const c=(f,m,...h)=>{let b;typeof m!="object"?b=this.options.overloadTranslationOptionHandler([f,m].concat(h)):b={...m},b.lng=b.lng||c.lng,b.lngs=b.lngs||c.lngs,b.ns=b.ns||c.ns,b.keyPrefix!==""&&(b.keyPrefix=b.keyPrefix||o||c.keyPrefix);const v=this.options.keySeparator||".";let x;return b.keyPrefix&&Array.isArray(f)?x=f.map(g=>(typeof g=="function"&&(g=ac(g,{...this.options,...m})),`${b.keyPrefix}${v}${g}`)):(typeof f=="function"&&(f=ac(f,{...this.options,...m})),x=b.keyPrefix?`${b.keyPrefix}${v}${f}`:f),this.t(x,b)};return se(l)?c.lng=l:c.lngs=l,c.ns=r,c.keyPrefix=o,c}t(...l){return this.translator?.translate(...l)}exists(...l){return this.translator?.exists(...l)}setDefaultNamespace(l){this.options.defaultNS=l}hasLoadedNamespace(l,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=r.lng||this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,f=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const m=(h,b)=>{const v=this.services.backendConnector.state[`${h}|${b}`];return v===-1||v===0||v===2};if(r.precheck){const h=r.precheck(this,m);if(h!==void 0)return h}return!!(this.hasResourceBundle(o,l)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||m(o,l)&&(!c||m(f,l)))}loadNamespaces(l,r){const o=Ri();return this.options.ns?(se(l)&&(l=[l]),l.forEach(c=>{this.options.ns.indexOf(c)<0&&this.options.ns.push(c)}),this.loadResources(c=>{o.resolve(),r&&r(c)}),o):(r&&r(),Promise.resolve())}loadLanguages(l,r){const o=Ri();se(l)&&(l=[l]);const c=this.options.preload||[],f=l.filter(m=>c.indexOf(m)<0&&this.services.languageUtils.isSupportedCode(m));return f.length?(this.options.preload=c.concat(f),this.loadResources(m=>{o.resolve(),r&&r(m)}),o):(r&&r(),Promise.resolve())}dir(l){if(l||(l=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!l)return"rtl";try{const c=new Intl.Locale(l);if(c&&c.getTextInfo){const f=c.getTextInfo();if(f&&f.direction)return f.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services?.languageUtils||new Am(Gu());return l.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(o.getLanguagePartFromCode(l))>-1||l.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(l={},r){const o=new _i(l,r);return o.createInstance=_i.createInstance,o}cloneInstance(l={},r=ar){const o=l.forkResourceStore;o&&delete l.forkResourceStore;const c={...this.options,...l,isClone:!0},f=new _i(c);if((l.debug!==void 0||l.prefix!==void 0)&&(f.logger=f.logger.clone(l)),["store","services","language"].forEach(h=>{f[h]=this[h]}),f.services={...this.services},f.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},o){const h=Object.keys(this.store.data).reduce((b,v)=>(b[v]={...this.store.data[v]},b[v]=Object.keys(b[v]).reduce((x,g)=>(x[g]={...b[v][g]},x),b[v]),b),{});f.store=new Cm(h,c),f.services.resourceStore=f.store}if(l.interpolation){const b={...Gu().interpolation,...this.options.interpolation,...l.interpolation},v={...c,interpolation:b};f.services.interpolator=new zm(v)}return f.translator=new pr(f.services,c),f.translator.on("*",(h,...b)=>{f.emit(h,...b)}),f.init(c,r),f.translator.options=c,f.translator.backendConnector.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},f}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ht=_i.createInstance();ht.createInstance;ht.dir;ht.init;ht.loadResources;ht.reloadResources;ht.use;ht.changeLanguage;ht.getFixedT;ht.t;ht.exists;ht.setDefaultNamespace;ht.hasLoadedNamespace;ht.loadNamespaces;ht.loadLanguages;const nb=(i,l,r,o)=>{const c=[r,{code:l,...o||{}}];if(i?.services?.logger?.forward)return i.services.logger.forward(c,"warn","react-i18next::",!0);ja(c[0])&&(c[0]=`react-i18next:: ${c[0]}`),i?.services?.logger?.warn?i.services.logger.warn(...c):console?.warn&&console.warn(...c)},jm={},Og=(i,l,r,o)=>{ja(r)&&jm[r]||(ja(r)&&(jm[r]=new Date),nb(i,l,r,o))},Cg=(i,l)=>()=>{if(i.isInitialized)l();else{const r=()=>{setTimeout(()=>{i.off("initialized",r)},0),l()};i.on("initialized",r)}},lc=(i,l,r)=>{i.loadNamespaces(l,Cg(i,r))},Lm=(i,l,r,o)=>{if(ja(r)&&(r=[r]),i.options.preload&&i.options.preload.indexOf(l)>-1)return lc(i,r,o);r.forEach(c=>{i.options.ns.indexOf(c)<0&&i.options.ns.push(c)}),i.loadLanguages(l,Cg(i,o))},ab=(i,l,r={})=>!l.languages||!l.languages.length?(Og(l,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:l.languages}),!0):l.hasLoadedNamespace(i,{lng:r.lng,precheck:(o,c)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!c(o.isLanguageChangingTo,i))return!1}}),ja=i=>typeof i=="string",lb=i=>typeof i=="object"&&i!==null,ib=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,sb={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},rb=i=>sb[i],ob=i=>i.replace(ib,rb);let ic={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:ob,transDefaultProps:void 0};const ub=(i={})=>{ic={...ic,...i}},cb=()=>ic;let Ng;const fb=i=>{Ng=i},db=()=>Ng,hb={type:"3rdParty",init(i){ub(i.options.react),fb(i)}},mb=y.createContext();class gb{constructor(){this.usedNamespaces={}}addUsedNamespaces(l){l.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var pb=Jy();const vb=(i,l)=>ja(l)?l:lb(l)&&ja(l.defaultValue)?l.defaultValue:Array.isArray(i)?i[i.length-1]:i,yb={t:vb,ready:!1},bb=()=>()=>{},xr=(i,l={})=>{const{i18n:r}=l,{i18n:o,defaultNS:c}=y.useContext(mb)||{},f=r||o||db();f&&!f.reportNamespaces&&(f.reportNamespaces=new gb),f||Og(f,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const m=y.useMemo(()=>({...cb(),...f?.options?.react,...l}),[f,l]),{useSuspense:h,keyPrefix:b}=m,v=c||f?.options?.defaultNS,x=ja(v)?[v]:v||["translation"],g=y.useMemo(()=>x,x);f?.reportNamespaces?.addUsedNamespaces?.(g);const D=y.useRef(0),z=y.useCallback(ae=>{if(!f)return bb;const{bindI18n:te,bindI18nStore:fe}=m,re=()=>{D.current+=1,ae()};return te&&f.on(te,re),fe&&f.store.on(fe,re),()=>{te&&te.split(" ").forEach(Ee=>f.off(Ee,re)),fe&&fe.split(" ").forEach(Ee=>f.store.off(Ee,re))}},[f,m]),j=y.useRef(),B=y.useCallback(()=>{if(!f)return yb;const ae=!!(f.isInitialized||f.initializedStoreOnce)&&g.every(je=>ab(je,f,m)),te=l.lng||f.language,fe=D.current,re=j.current;if(re&&re.ready===ae&&re.lng===te&&re.keyPrefix===b&&re.revision===fe)return re;const Te={t:f.getFixedT(te,m.nsMode==="fallback"?g:g[0],b),ready:ae,lng:te,keyPrefix:b,revision:fe};return j.current=Te,Te},[f,g,b,m,l.lng]),[K,U]=y.useState(0),{t:Q,ready:Z}=pb.useSyncExternalStore(z,B,B);y.useEffect(()=>{if(f&&!Z&&!h){const ae=()=>U(te=>te+1);l.lng?Lm(f,l.lng,g,ae):lc(f,g,ae)}},[f,l.lng,g,Z,h,K]);const I=f||{},ee=y.useRef(null),J=y.useRef(),X=ae=>{const te=Object.getOwnPropertyDescriptors(ae);te.__original&&delete te.__original;const fe=Object.create(Object.getPrototypeOf(ae),te);if(!Object.prototype.hasOwnProperty.call(fe,"__original"))try{Object.defineProperty(fe,"__original",{value:ae,writable:!1,enumerable:!1,configurable:!1})}catch{}return fe},ve=y.useMemo(()=>{const ae=I,te=ae?.language;let fe=ae;ae&&(ee.current&&ee.current.__original===ae?J.current!==te?(fe=X(ae),ee.current=fe,J.current=te):fe=ee.current:(fe=X(ae),ee.current=fe,J.current=te));const re=[Q,fe,Z];return re.t=Q,re.i18n=fe,re.ready=Z,re},[Q,I,Z,I.resolvedLanguage,I.language,I.languages]);if(f&&h&&!Z)throw new Promise(ae=>{const te=()=>ae();l.lng?Lm(f,l.lng,g,te):lc(f,g,te)});return ve},Sb=[{to:"/",icon:og,labelKey:"nav.overview"},{to:"/health",icon:ug,labelKey:"nav.health"},{to:"/uncertainty",icon:By,labelKey:"nav.uncertainty"},{to:"/graph",icon:cg,labelKey:"nav.graph"},{to:"/timeline",icon:fg,labelKey:"nav.timeline"},{to:"/evolution",icon:dg,labelKey:"nav.evolution"},{to:"/diagrams",icon:hg,labelKey:"nav.mindmap"},{to:"/sync",icon:mg,labelKey:"nav.sync"},{to:"/oracle",icon:gg,labelKey:"nav.oracle"},{to:"/tool-stats",icon:pg,labelKey:"nav.toolStats"},{to:"/reasoning",icon:Hy,labelKey:"nav.reasoningTraining"},{to:"/visualize",icon:qy,labelKey:"nav.visualize"},{to:"/storage",icon:Vy,labelKey:"nav.storage"},{to:"/settings",icon:vg,labelKey:"nav.settings"}];function xb(){const i=br(r=>r.sidebarOpen),{t:l}=xr();return E.jsxs("aside",{className:ji("fixed inset-y-0 left-0 z-30 flex flex-col border-r border-sidebar-border bg-sidebar transition-all duration-[var(--transition-normal)]",i?"w-56":"w-16"),children:[E.jsxs("div",{className:"flex h-14 items-center gap-3 border-b border-sidebar-border px-4",children:[E.jsx(rg,{className:"size-6 shrink-0 text-sidebar-primary"}),i&&E.jsx("span",{className:"font-display text-base font-bold text-sidebar-foreground truncate",children:"Surreal-Memory"})]}),E.jsx("nav",{className:"flex-1 space-y-1 p-2","aria-label":l("common.mainNavigation"),children:Sb.map(({to:r,icon:o,labelKey:c})=>{const f=l(c);return E.jsxs(zy,{to:r,end:r==="/",className:({isActive:m})=>ji("flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors cursor-pointer",m?"bg-sidebar-accent text-sidebar-primary":"text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",!i&&"justify-center px-0"),title:f,children:[E.jsx(o,{className:"size-5 shrink-0","aria-hidden":"true"}),i&&E.jsx("span",{children:f})]},r)})}),E.jsx("div",{className:"border-t border-sidebar-border p-3",children:i&&E.jsx("p",{className:"text-xs text-sidebar-foreground/50 text-center",children:"Surreal-Memory"})})]})}function Um(i,l){if(typeof i=="function")return i(l);i!=null&&(i.current=l)}function Pt(...i){return l=>{let r=!1;const o=i.map(c=>{const f=Um(c,l);return!r&&typeof f=="function"&&(r=!0),f});if(r)return()=>{for(let c=0;c{let{children:f,...m}=o;Ag(f)&&typeof vr=="function"&&(f=vr(f._payload));const h=y.Children.toArray(f),b=h.find(Ab);if(b){const v=b.props.children,x=h.map(g=>g===b?y.Children.count(v)>1?y.Children.only(null):y.isValidElement(v)?v.props.children:null:g);return E.jsx(l,{...m,ref:c,children:y.isValidElement(v)?y.cloneElement(v,void 0,x):null})}return E.jsx(l,{...m,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}var Ob=Dg("Slot");function Cb(i){const l=y.forwardRef((r,o)=>{let{children:c,...f}=r;if(Ag(c)&&typeof vr=="function"&&(c=vr(c._payload)),y.isValidElement(c)){const m=wb(c),h=Db(f,c.props);return c.type!==y.Fragment&&(h.ref=o?Pt(o,m):m),y.cloneElement(c,h)}return y.Children.count(c)>1?y.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var Nb=Symbol("radix.slottable");function Ab(i){return y.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===Nb}function Db(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...h)=>{const b=f(...h);return c(...h),b}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function wb(i){let l=Object.getOwnPropertyDescriptor(i.props,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=Object.getOwnPropertyDescriptor(i,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}const Rb=yg("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 cursor-pointer [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-border bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-lg px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),cr=y.forwardRef(({className:i,variant:l,size:r,asChild:o=!1,...c},f)=>{const m=o?Ob:"button";return E.jsx(m,{className:ji(Rb({variant:l,size:r,className:i})),ref:f,...c})});cr.displayName="Button";const zb="";class wg extends Error{status;constructor(l,r){super(r),this.name="ApiError",this.status=l}}async function lr(i,l={}){const{brain:r,...o}=l,c=new Headers(o.headers);r&&c.set("X-Brain-ID",r),o.body&&!c.has("Content-Type")&&c.set("Content-Type","application/json");const f=await fetch(`${zb}${i}`,{...o,headers:c});if(!f.ok){const m=await f.text().catch(()=>"Unknown error");throw new wg(f.status,m)}return f.json()}const qe={get:(i,l)=>lr(i,{...l,method:"GET"}),post:(i,l,r)=>lr(i,{...r,method:"POST",body:l?JSON.stringify(l):void 0}),put:(i,l,r)=>lr(i,{...r,method:"PUT",body:l?JSON.stringify(l):void 0}),delete:(i,l)=>lr(i,{...l,method:"DELETE"})};function DE(i,l){if(i instanceof wg){try{const r=JSON.parse(i.message);if(r&&typeof r.detail=="string")return r.detail}catch{}return i.message||l}return l}const $e={stats:["dashboard","stats"],brains:["dashboard","brains"],health:["dashboard","health"],healthCheck:["health"],toolStats:i=>["dashboard","tool-stats",i],timeline:(i,l)=>["dashboard","timeline",i,l],dailyStats:i=>["dashboard","timeline","daily-stats",i],evolution:["dashboard","evolution"],fibers:["dashboard","fibers"],fiberDiagram:i=>["dashboard","fiber",i,"diagram"],graph:i=>["graph",i],brainFiles:["dashboard","brain-files"],configStatus:["dashboard","config-status"],embeddingConfig:["config","embedding"],watcherStatus:["dashboard","watcher-status"],license:["dashboard","license"],uncertainty:i=>["dashboard","uncertainty",i]};function Mb(){return it({queryKey:$e.stats,queryFn:()=>qe.get("/api/dashboard/stats")})}function _b(){return it({queryKey:$e.healthCheck,queryFn:()=>qe.get("/health"),staleTime:3e5})}function wE(){return it({queryKey:$e.brains,queryFn:()=>qe.get("/api/dashboard/brains")})}function RE(){const i=fc();return Hi({mutationFn:l=>qe.post("/api/dashboard/brains/switch",{brain_name:l}),onSuccess:()=>{i.invalidateQueries()}})}function zE(){return it({queryKey:$e.health,queryFn:()=>qe.get("/api/dashboard/health")})}function ME(i=14){return it({queryKey:$e.uncertainty(i),queryFn:()=>qe.get(`/api/dashboard/uncertainty?within_days=${i}`)})}function _E(i=100,l=0){return it({queryKey:$e.timeline(i,l),queryFn:()=>qe.get(`/api/dashboard/timeline?limit=${i}&offset=${l}`)})}function jE(i=30){return it({queryKey:$e.dailyStats(i),queryFn:()=>qe.get(`/api/dashboard/timeline/daily-stats?days=${i}`)})}function LE(){return it({queryKey:$e.evolution,queryFn:()=>qe.get("/api/dashboard/evolution")})}function jb(){return it({queryKey:$e.fibers,queryFn:()=>qe.get("/api/dashboard/fibers")})}function UE(i){return it({queryKey:$e.fiberDiagram(i),queryFn:()=>qe.get(`/api/dashboard/fiber/${i}/diagram`),enabled:!!i})}function BE(i=500){return it({queryKey:$e.graph(i),queryFn:()=>qe.get(`/api/graph?limit=${i}`)})}function HE(){const i=fc();return Hi({mutationFn:l=>qe.delete(`/brain/${l}`),onSuccess:()=>{i.invalidateQueries()}})}function qE(i=30){return it({queryKey:$e.toolStats(i),queryFn:()=>qe.get(`/api/dashboard/tool-stats?days=${i}`)})}function VE(){return it({queryKey:$e.brainFiles,queryFn:()=>qe.get("/api/dashboard/brain-files")})}function YE(){return it({queryKey:$e.configStatus,queryFn:()=>qe.get("/api/dashboard/config-status"),staleTime:6e4})}function kE(){return it({queryKey:$e.embeddingConfig,queryFn:()=>qe.get("/api/dashboard/config/embedding"),staleTime:6e4})}function KE(){const i=fc();return Hi({mutationFn:l=>qe.put("/api/dashboard/config",l),onSuccess:()=>{i.invalidateQueries({queryKey:$e.configStatus}),i.invalidateQueries({queryKey:$e.embeddingConfig})}})}function GE(){return it({queryKey:$e.watcherStatus,queryFn:()=>qe.get("/api/dashboard/watcher/status"),staleTime:3e4})}function QE(){return Hi({mutationFn:()=>qe.post("/api/dashboard/config/embedding/test",{})})}function XE(){return Hi({mutationFn:i=>qe.post("/api/dashboard/visualize",i)})}function ZE(){return it({queryKey:$e.license,queryFn:()=>qe.get("/api/dashboard/license"),staleTime:6e4})}const Lb=yg("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-2 focus:outline-offset-2 focus:outline-ring",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground shadow",outline:"text-foreground",success:"border-transparent bg-health-good/10 text-health-good",warning:"border-transparent bg-health-warn/10 text-health-warn"}},defaultVariants:{variant:"default"}});function Ub({className:i,variant:l,...r}){return E.jsx("div",{className:ji(Lb({variant:l}),i),...r})}var Bm=1,Bb=.9,Hb=.8,qb=.17,Qu=.1,Xu=.999,Vb=.9999,Yb=.99,kb=/[\\\/_+.#"@\[\(\{&]/,Kb=/[\\\/_+.#"@\[\(\{&]/g,Gb=/[\s-]/,Rg=/[\s-]/g;function sc(i,l,r,o,c,f,m){if(f===l.length)return c===i.length?Bm:Yb;var h=`${c},${f}`;if(m[h]!==void 0)return m[h];for(var b=o.charAt(f),v=r.indexOf(b,c),x=0,g,D,z,j;v>=0;)g=sc(i,l,r,o,v+1,f+1,m),g>x&&(v===c?g*=Bm:kb.test(i.charAt(v-1))?(g*=Hb,z=i.slice(c,v-1).match(Kb),z&&c>0&&(g*=Math.pow(Xu,z.length))):Gb.test(i.charAt(v-1))?(g*=Bb,j=i.slice(c,v-1).match(Rg),j&&c>0&&(g*=Math.pow(Xu,j.length))):(g*=qb,c>0&&(g*=Math.pow(Xu,v-c))),i.charAt(v)!==l.charAt(f)&&(g*=Vb)),(gg&&(g=D*Qu)),g>x&&(x=g),v=r.indexOf(b,v+1);return m[h]=x,x}function Hm(i){return i.toLowerCase().replace(Rg," ")}function Qb(i,l,r){return i=r&&r.length>0?`${i+" "+r.join(" ")}`:i,sc(i,l,Hm(i),Hm(l),0,0,{})}function ra(i,l,{checkForDefaultPrevented:r=!0}={}){return function(c){if(i?.(c),r===!1||!c.defaultPrevented)return l?.(c)}}function Xb(i,l){const r=y.createContext(l),o=f=>{const{children:m,...h}=f,b=y.useMemo(()=>h,Object.values(h));return E.jsx(r.Provider,{value:b,children:m})};o.displayName=i+"Provider";function c(f){const m=y.useContext(r);if(m)return m;if(l!==void 0)return l;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[o,c]}function Zb(i,l=[]){let r=[];function o(f,m){const h=y.createContext(m),b=r.length;r=[...r,m];const v=g=>{const{scope:D,children:z,...j}=g,B=D?.[i]?.[b]||h,K=y.useMemo(()=>j,Object.values(j));return E.jsx(B.Provider,{value:K,children:z})};v.displayName=f+"Provider";function x(g,D){const z=D?.[i]?.[b]||h,j=y.useContext(z);if(j)return j;if(m!==void 0)return m;throw new Error(`\`${g}\` must be used within \`${f}\``)}return[v,x]}const c=()=>{const f=r.map(m=>y.createContext(m));return function(h){const b=h?.[i]||f;return y.useMemo(()=>({[`__scope${i}`]:{...h,[i]:b}}),[h,b])}};return c.scopeName=i,[o,Fb(c,...l)]}function Fb(...i){const l=i[0];if(i.length===1)return l;const r=()=>{const o=i.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(f){const m=o.reduce((h,{useScope:b,scopeName:v})=>{const g=b(f)[`__scope${v}`];return{...h,...g}},{});return y.useMemo(()=>({[`__scope${l.scopeName}`]:m}),[m])}};return r.scopeName=l.scopeName,r}var Ui=globalThis?.document?y.useLayoutEffect:()=>{},Jb=dc[" useId ".trim().toString()]||(()=>{}),$b=0;function Mn(i){const[l,r]=y.useState(Jb());return Ui(()=>{r(o=>o??String($b++))},[i]),l?`radix-${l}`:""}var Wb=dc[" useInsertionEffect ".trim().toString()]||Ui;function Ib({prop:i,defaultProp:l,onChange:r=()=>{},caller:o}){const[c,f,m]=Pb({defaultProp:l,onChange:r}),h=i!==void 0,b=h?i:c;{const x=y.useRef(i!==void 0);y.useEffect(()=>{const g=x.current;g!==h&&console.warn(`${o} is changing from ${g?"controlled":"uncontrolled"} to ${h?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),x.current=h},[h,o])}const v=y.useCallback(x=>{if(h){const g=eS(x)?x(i):x;g!==i&&m.current?.(g)}else f(x)},[h,i,f,m]);return[b,v]}function Pb({defaultProp:i,onChange:l}){const[r,o]=y.useState(i),c=y.useRef(r),f=y.useRef(l);return Wb(()=>{f.current=l},[l]),y.useEffect(()=>{c.current!==r&&(f.current?.(r),c.current=r)},[r,c]),[r,o,f]}function eS(i){return typeof i=="function"}function tS(i){const l=nS(i),r=y.forwardRef((o,c)=>{const{children:f,...m}=o,h=y.Children.toArray(f),b=h.find(lS);if(b){const v=b.props.children,x=h.map(g=>g===b?y.Children.count(v)>1?y.Children.only(null):y.isValidElement(v)?v.props.children:null:g);return E.jsx(l,{...m,ref:c,children:y.isValidElement(v)?y.cloneElement(v,void 0,x):null})}return E.jsx(l,{...m,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}function nS(i){const l=y.forwardRef((r,o)=>{const{children:c,...f}=r;if(y.isValidElement(c)){const m=sS(c),h=iS(f,c.props);return c.type!==y.Fragment&&(h.ref=o?Pt(o,m):m),y.cloneElement(c,h)}return y.Children.count(c)>1?y.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var aS=Symbol("radix.slottable");function lS(i){return y.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===aS}function iS(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...h)=>{const b=f(...h);return c(...h),b}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function sS(i){let l=Object.getOwnPropertyDescriptor(i.props,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=Object.getOwnPropertyDescriptor(i,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}var rS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zg=rS.reduce((i,l)=>{const r=tS(`Primitive.${l}`),o=y.forwardRef((c,f)=>{const{asChild:m,...h}=c,b=m?r:l;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),E.jsx(b,{...h,ref:f})});return o.displayName=`Primitive.${l}`,{...i,[l]:o}},{});function oS(i,l){i&&sg.flushSync(()=>i.dispatchEvent(l))}function Bi(i){const l=y.useRef(i);return y.useEffect(()=>{l.current=i}),y.useMemo(()=>(...r)=>l.current?.(...r),[])}function uS(i,l=globalThis?.document){const r=Bi(i);y.useEffect(()=>{const o=c=>{c.key==="Escape"&&r(c)};return l.addEventListener("keydown",o,{capture:!0}),()=>l.removeEventListener("keydown",o,{capture:!0})},[r,l])}var cS="DismissableLayer",rc="dismissableLayer.update",fS="dismissableLayer.pointerDownOutside",dS="dismissableLayer.focusOutside",qm,Mg=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_g=y.forwardRef((i,l)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:f,onInteractOutside:m,onDismiss:h,...b}=i,v=y.useContext(Mg),[x,g]=y.useState(null),D=x?.ownerDocument??globalThis?.document,[,z]=y.useState({}),j=Ba(l,X=>g(X)),B=Array.from(v.layers),[K]=[...v.layersWithOutsidePointerEventsDisabled].slice(-1),U=B.indexOf(K),Q=x?B.indexOf(x):-1,Z=v.layersWithOutsidePointerEventsDisabled.size>0,I=Q>=U,ee=gS(X=>{const ve=X.target,ae=[...v.branches].some(te=>te.contains(ve));!I||ae||(c?.(X),m?.(X),X.defaultPrevented||h?.())},D),J=pS(X=>{const ve=X.target;[...v.branches].some(te=>te.contains(ve))||(f?.(X),m?.(X),X.defaultPrevented||h?.())},D);return uS(X=>{Q===v.layers.size-1&&(o?.(X),!X.defaultPrevented&&h&&(X.preventDefault(),h()))},D),y.useEffect(()=>{if(x)return r&&(v.layersWithOutsidePointerEventsDisabled.size===0&&(qm=D.body.style.pointerEvents,D.body.style.pointerEvents="none"),v.layersWithOutsidePointerEventsDisabled.add(x)),v.layers.add(x),Vm(),()=>{r&&v.layersWithOutsidePointerEventsDisabled.size===1&&(D.body.style.pointerEvents=qm)}},[x,D,r,v]),y.useEffect(()=>()=>{x&&(v.layers.delete(x),v.layersWithOutsidePointerEventsDisabled.delete(x),Vm())},[x,v]),y.useEffect(()=>{const X=()=>z({});return document.addEventListener(rc,X),()=>document.removeEventListener(rc,X)},[]),E.jsx(zg.div,{...b,ref:j,style:{pointerEvents:Z?I?"auto":"none":void 0,...i.style},onFocusCapture:ra(i.onFocusCapture,J.onFocusCapture),onBlurCapture:ra(i.onBlurCapture,J.onBlurCapture),onPointerDownCapture:ra(i.onPointerDownCapture,ee.onPointerDownCapture)})});_g.displayName=cS;var hS="DismissableLayerBranch",mS=y.forwardRef((i,l)=>{const r=y.useContext(Mg),o=y.useRef(null),c=Ba(l,o);return y.useEffect(()=>{const f=o.current;if(f)return r.branches.add(f),()=>{r.branches.delete(f)}},[r.branches]),E.jsx(zg.div,{...i,ref:c})});mS.displayName=hS;function gS(i,l=globalThis?.document){const r=Bi(i),o=y.useRef(!1),c=y.useRef(()=>{});return y.useEffect(()=>{const f=h=>{if(h.target&&!o.current){let b=function(){jg(fS,r,v,{discrete:!0})};const v={originalEvent:h};h.pointerType==="touch"?(l.removeEventListener("click",c.current),c.current=b,l.addEventListener("click",c.current,{once:!0})):b()}else l.removeEventListener("click",c.current);o.current=!1},m=window.setTimeout(()=>{l.addEventListener("pointerdown",f)},0);return()=>{window.clearTimeout(m),l.removeEventListener("pointerdown",f),l.removeEventListener("click",c.current)}},[l,r]),{onPointerDownCapture:()=>o.current=!0}}function pS(i,l=globalThis?.document){const r=Bi(i),o=y.useRef(!1);return y.useEffect(()=>{const c=f=>{f.target&&!o.current&&jg(dS,r,{originalEvent:f},{discrete:!1})};return l.addEventListener("focusin",c),()=>l.removeEventListener("focusin",c)},[l,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Vm(){const i=new CustomEvent(rc);document.dispatchEvent(i)}function jg(i,l,r,{discrete:o}){const c=r.originalEvent.target,f=new CustomEvent(i,{bubbles:!1,cancelable:!0,detail:r});l&&c.addEventListener(i,l,{once:!0}),o?oS(c,f):c.dispatchEvent(f)}function vS(i){const l=yS(i),r=y.forwardRef((o,c)=>{const{children:f,...m}=o,h=y.Children.toArray(f),b=h.find(SS);if(b){const v=b.props.children,x=h.map(g=>g===b?y.Children.count(v)>1?y.Children.only(null):y.isValidElement(v)?v.props.children:null:g);return E.jsx(l,{...m,ref:c,children:y.isValidElement(v)?y.cloneElement(v,void 0,x):null})}return E.jsx(l,{...m,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}function yS(i){const l=y.forwardRef((r,o)=>{const{children:c,...f}=r;if(y.isValidElement(c)){const m=ES(c),h=xS(f,c.props);return c.type!==y.Fragment&&(h.ref=o?Pt(o,m):m),y.cloneElement(c,h)}return y.Children.count(c)>1?y.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var bS=Symbol("radix.slottable");function SS(i){return y.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===bS}function xS(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...h)=>{const b=f(...h);return c(...h),b}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function ES(i){let l=Object.getOwnPropertyDescriptor(i.props,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=Object.getOwnPropertyDescriptor(i,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}var TS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],OS=TS.reduce((i,l)=>{const r=vS(`Primitive.${l}`),o=y.forwardRef((c,f)=>{const{asChild:m,...h}=c,b=m?r:l;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),E.jsx(b,{...h,ref:f})});return o.displayName=`Primitive.${l}`,{...i,[l]:o}},{}),Zu="focusScope.autoFocusOnMount",Fu="focusScope.autoFocusOnUnmount",Ym={bubbles:!1,cancelable:!0},CS="FocusScope",Lg=y.forwardRef((i,l)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:c,onUnmountAutoFocus:f,...m}=i,[h,b]=y.useState(null),v=Bi(c),x=Bi(f),g=y.useRef(null),D=Ba(l,B=>b(B)),z=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(o){let B=function(Z){if(z.paused||!h)return;const I=Z.target;h.contains(I)?g.current=I:sa(g.current,{select:!0})},K=function(Z){if(z.paused||!h)return;const I=Z.relatedTarget;I!==null&&(h.contains(I)||sa(g.current,{select:!0}))},U=function(Z){if(document.activeElement===document.body)for(const ee of Z)ee.removedNodes.length>0&&sa(h)};document.addEventListener("focusin",B),document.addEventListener("focusout",K);const Q=new MutationObserver(U);return h&&Q.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",B),document.removeEventListener("focusout",K),Q.disconnect()}}},[o,h,z.paused]),y.useEffect(()=>{if(h){Km.add(z);const B=document.activeElement;if(!h.contains(B)){const U=new CustomEvent(Zu,Ym);h.addEventListener(Zu,v),h.dispatchEvent(U),U.defaultPrevented||(NS(zS(Ug(h)),{select:!0}),document.activeElement===B&&sa(h))}return()=>{h.removeEventListener(Zu,v),setTimeout(()=>{const U=new CustomEvent(Fu,Ym);h.addEventListener(Fu,x),h.dispatchEvent(U),U.defaultPrevented||sa(B??document.body,{select:!0}),h.removeEventListener(Fu,x),Km.remove(z)},0)}}},[h,v,x,z]);const j=y.useCallback(B=>{if(!r&&!o||z.paused)return;const K=B.key==="Tab"&&!B.altKey&&!B.ctrlKey&&!B.metaKey,U=document.activeElement;if(K&&U){const Q=B.currentTarget,[Z,I]=AS(Q);Z&&I?!B.shiftKey&&U===I?(B.preventDefault(),r&&sa(Z,{select:!0})):B.shiftKey&&U===Z&&(B.preventDefault(),r&&sa(I,{select:!0})):U===Q&&B.preventDefault()}},[r,o,z.paused]);return E.jsx(OS.div,{tabIndex:-1,...m,ref:D,onKeyDown:j})});Lg.displayName=CS;function NS(i,{select:l=!1}={}){const r=document.activeElement;for(const o of i)if(sa(o,{select:l}),document.activeElement!==r)return}function AS(i){const l=Ug(i),r=km(l,i),o=km(l.reverse(),i);return[r,o]}function Ug(i){const l=[],r=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const c=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||c?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)l.push(r.currentNode);return l}function km(i,l){for(const r of i)if(!DS(r,{upTo:l}))return r}function DS(i,{upTo:l}){if(getComputedStyle(i).visibility==="hidden")return!0;for(;i;){if(l!==void 0&&i===l)return!1;if(getComputedStyle(i).display==="none")return!0;i=i.parentElement}return!1}function wS(i){return i instanceof HTMLInputElement&&"select"in i}function sa(i,{select:l=!1}={}){if(i&&i.focus){const r=document.activeElement;i.focus({preventScroll:!0}),i!==r&&wS(i)&&l&&i.select()}}var Km=RS();function RS(){let i=[];return{add(l){const r=i[0];l!==r&&r?.pause(),i=Gm(i,l),i.unshift(l)},remove(l){i=Gm(i,l),i[0]?.resume()}}}function Gm(i,l){const r=[...i],o=r.indexOf(l);return o!==-1&&r.splice(o,1),r}function zS(i){return i.filter(l=>l.tagName!=="A")}function MS(i){const l=_S(i),r=y.forwardRef((o,c)=>{const{children:f,...m}=o,h=y.Children.toArray(f),b=h.find(LS);if(b){const v=b.props.children,x=h.map(g=>g===b?y.Children.count(v)>1?y.Children.only(null):y.isValidElement(v)?v.props.children:null:g);return E.jsx(l,{...m,ref:c,children:y.isValidElement(v)?y.cloneElement(v,void 0,x):null})}return E.jsx(l,{...m,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}function _S(i){const l=y.forwardRef((r,o)=>{const{children:c,...f}=r;if(y.isValidElement(c)){const m=BS(c),h=US(f,c.props);return c.type!==y.Fragment&&(h.ref=o?Pt(o,m):m),y.cloneElement(c,h)}return y.Children.count(c)>1?y.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var jS=Symbol("radix.slottable");function LS(i){return y.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===jS}function US(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...h)=>{const b=f(...h);return c(...h),b}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function BS(i){let l=Object.getOwnPropertyDescriptor(i.props,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=Object.getOwnPropertyDescriptor(i,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}var HS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],qS=HS.reduce((i,l)=>{const r=MS(`Primitive.${l}`),o=y.forwardRef((c,f)=>{const{asChild:m,...h}=c,b=m?r:l;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),E.jsx(b,{...h,ref:f})});return o.displayName=`Primitive.${l}`,{...i,[l]:o}},{}),VS="Portal",Bg=y.forwardRef((i,l)=>{const{container:r,...o}=i,[c,f]=y.useState(!1);Ui(()=>f(!0),[]);const m=r||c&&globalThis?.document?.body;return m?ig.createPortal(E.jsx(qS.div,{...o,ref:l}),m):null});Bg.displayName=VS;function YS(i,l){return y.useReducer((r,o)=>l[r][o]??r,i)}var Er=i=>{const{present:l,children:r}=i,o=kS(l),c=typeof r=="function"?r({present:o.isPresent}):y.Children.only(r),f=Ba(o.ref,KS(c));return typeof r=="function"||o.isPresent?y.cloneElement(c,{ref:f}):null};Er.displayName="Presence";function kS(i){const[l,r]=y.useState(),o=y.useRef(null),c=y.useRef(i),f=y.useRef("none"),m=i?"mounted":"unmounted",[h,b]=YS(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const v=ir(o.current);f.current=h==="mounted"?v:"none"},[h]),Ui(()=>{const v=o.current,x=c.current;if(x!==i){const D=f.current,z=ir(v);i?b("MOUNT"):z==="none"||v?.display==="none"?b("UNMOUNT"):b(x&&D!==z?"ANIMATION_OUT":"UNMOUNT"),c.current=i}},[i,b]),Ui(()=>{if(l){let v;const x=l.ownerDocument.defaultView??window,g=z=>{const B=ir(o.current).includes(CSS.escape(z.animationName));if(z.target===l&&B&&(b("ANIMATION_END"),!c.current)){const K=l.style.animationFillMode;l.style.animationFillMode="forwards",v=x.setTimeout(()=>{l.style.animationFillMode==="forwards"&&(l.style.animationFillMode=K)})}},D=z=>{z.target===l&&(f.current=ir(o.current))};return l.addEventListener("animationstart",D),l.addEventListener("animationcancel",g),l.addEventListener("animationend",g),()=>{x.clearTimeout(v),l.removeEventListener("animationstart",D),l.removeEventListener("animationcancel",g),l.removeEventListener("animationend",g)}}else b("ANIMATION_END")},[l,b]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:y.useCallback(v=>{o.current=v?getComputedStyle(v):null,r(v)},[])}}function ir(i){return i?.animationName||"none"}function KS(i){let l=Object.getOwnPropertyDescriptor(i.props,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=Object.getOwnPropertyDescriptor(i,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}function Hg(i){const l=GS(i),r=y.forwardRef((o,c)=>{const{children:f,...m}=o,h=y.Children.toArray(f),b=h.find(XS);if(b){const v=b.props.children,x=h.map(g=>g===b?y.Children.count(v)>1?y.Children.only(null):y.isValidElement(v)?v.props.children:null:g);return E.jsx(l,{...m,ref:c,children:y.isValidElement(v)?y.cloneElement(v,void 0,x):null})}return E.jsx(l,{...m,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}function GS(i){const l=y.forwardRef((r,o)=>{const{children:c,...f}=r;if(y.isValidElement(c)){const m=FS(c),h=ZS(f,c.props);return c.type!==y.Fragment&&(h.ref=o?Pt(o,m):m),y.cloneElement(c,h)}return y.Children.count(c)>1?y.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var QS=Symbol("radix.slottable");function XS(i){return y.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===QS}function ZS(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...h)=>{const b=f(...h);return c(...h),b}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function FS(i){let l=Object.getOwnPropertyDescriptor(i.props,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=Object.getOwnPropertyDescriptor(i,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}var JS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],qi=JS.reduce((i,l)=>{const r=Hg(`Primitive.${l}`),o=y.forwardRef((c,f)=>{const{asChild:m,...h}=c,b=m?r:l;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),E.jsx(b,{...h,ref:f})});return o.displayName=`Primitive.${l}`,{...i,[l]:o}},{}),Ju=0;function $S(){y.useEffect(()=>{const i=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",i[0]??Qm()),document.body.insertAdjacentElement("beforeend",i[1]??Qm()),Ju++,()=>{Ju===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(l=>l.remove()),Ju--}},[])}function Qm(){const i=document.createElement("span");return i.setAttribute("data-radix-focus-guard",""),i.tabIndex=0,i.style.outline="none",i.style.opacity="0",i.style.position="fixed",i.style.pointerEvents="none",i}var cn=function(){return cn=Object.assign||function(l){for(var r,o=1,c=arguments.length;o"u")return h1;var l=m1(i),r=document.documentElement.clientWidth,o=window.innerWidth;return{left:l[0],top:l[1],right:l[2],gap:Math.max(0,o-r+l[2]-l[0])}},p1=kg(),_l="data-scroll-locked",v1=function(i,l,r,o){var c=i.left,f=i.top,m=i.right,h=i.gap;return r===void 0&&(r="margin"),` +`+a.stack}}var At=Object.prototype.hasOwnProperty,Ul=i.unstable_scheduleCallback,Bl=i.unstable_cancelCallback,ut=i.unstable_shouldYield,_n=i.unstable_requestPaint,ct=i.unstable_now,Nr=i.unstable_getCurrentPriorityLevel,fa=i.unstable_ImmediatePriority,ki=i.unstable_UserBlockingPriority,da=i.unstable_NormalPriority,Hl=i.unstable_LowPriority,hn=i.unstable_IdlePriority,Ki=i.log,jn=i.unstable_setDisableYieldValue,ha=null,ft=null;function Ft(e){if(typeof Ki=="function"&&jn(e),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(ha,e)}catch{}}var st=Math.clz32?Math.clz32:nn,Dr=Math.log,ql=Math.LN2;function nn(e){return e>>>=0,e===0?32:31-(Dr(e)/ql|0)|0}var qa=256,Va=262144,ma=4194304;function an(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ie(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var s=0,u=e.suspendedLanes,d=e.pingedLanes;e=e.warmLanes;var p=a&134217727;return p!==0?(a=p&~u,a!==0?s=an(a):(d&=p,d!==0?s=an(d):n||(n=p&~e,n!==0&&(s=an(n))))):(p=a&~u,p!==0?s=an(p):d!==0?s=an(d):n||(n=a&~e,n!==0&&(s=an(n)))),s===0?0:t!==0&&t!==s&&(t&u)===0&&(u=s&-s,n=t&-t,u>=n||u===32&&(n&4194048)!==0)?t:s}function Be(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function We(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rt(){var e=ma;return ma<<=1,(ma&62914560)===0&&(ma=4194304),e}function Ln(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ve(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function mt(e,t,n,a,s,u){var d=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var p=e.entanglements,S=e.expirationTimes,N=e.hiddenUpdates;for(n=d&~n;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var xp=/[\n"\\]/g;function Ht(e){return e.replace(xp,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Mr(e,t,n,a,s,u,d,p){e.name="",d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"?e.type=d:e.removeAttribute("type"),t!=null?d==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Bt(t)):e.value!==""+Bt(t)&&(e.value=""+Bt(t)):d!=="submit"&&d!=="reset"||e.removeAttribute("value"),t!=null?_r(e,d,Bt(t)):n!=null?_r(e,d,Bt(n)):a!=null&&e.removeAttribute("value"),s==null&&u!=null&&(e.defaultChecked=!!u),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.name=""+Bt(p):e.removeAttribute("name")}function Cc(e,t,n,a,s,u,d,p){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||n!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){zr(e);return}n=n!=null?""+Bt(n):"",t=t!=null?""+Bt(t):n,p||t===e.value||(e.value=t),e.defaultValue=t}a=a??s,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=p?e.checked:!!a,e.defaultChecked=!!a,d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.name=d),zr(e)}function _r(e,t,n){t==="number"&&Xi(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Za(e,t,n,a){if(e=e.options,t){t={};for(var s=0;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hr=!1;if(pn)try{var Kl={};Object.defineProperty(Kl,"passive",{get:function(){Hr=!0}}),window.addEventListener("test",Kl,Kl),window.removeEventListener("test",Kl,Kl)}catch{Hr=!1}var Bn=null,qr=null,Fi=null;function Mc(){if(Fi)return Fi;var e,t=qr,n=t.length,a,s="value"in Bn?Bn.value:Bn.textContent,u=s.length;for(e=0;e=Xl),Hc=" ",qc=!1;function Vc(e,t){switch(e){case"keyup":return Jp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Wa=!1;function Wp(e,t){switch(e){case"compositionend":return Yc(t);case"keypress":return t.which!==32?null:(qc=!0,Hc);case"textInput":return e=t.data,e===Hc&&qc?null:e;default:return null}}function Ip(e,t){if(Wa)return e==="compositionend"||!Gr&&Vc(e,t)?(e=Mc(),Fi=qr=Bn=null,Wa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Jc(n)}}function Wc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ic(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Xi(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Xi(e.document)}return t}function Zr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var sv=pn&&"documentMode"in document&&11>=document.documentMode,Ia=null,Fr=null,$l=null,Jr=!1;function Pc(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Jr||Ia==null||Ia!==Xi(a)||(a=Ia,"selectionStart"in a&&Zr(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),$l&&Jl($l,a)||($l=a,a=Ys(Fr,"onSelect"),0>=d,s-=d,ln=1<<32-st(t)+s|n<he?(be=W,W=null):be=W.sibling;var Ce=w(O,W,C[he],L);if(Ce===null){W===null&&(W=be);break}e&&W&&Ce.alternate===null&&t(O,W),T=u(Ce,T,he),Oe===null?P=Ce:Oe.sibling=Ce,Oe=Ce,W=be}if(he===C.length)return n(O,W),xe&&yn(O,he),P;if(W===null){for(;hehe?(be=W,W=null):be=W.sibling;var ia=w(O,W,Ce.value,L);if(ia===null){W===null&&(W=be);break}e&&W&&ia.alternate===null&&t(O,W),T=u(ia,T,he),Oe===null?P=ia:Oe.sibling=ia,Oe=ia,W=be}if(Ce.done)return n(O,W),xe&&yn(O,he),P;if(W===null){for(;!Ce.done;he++,Ce=C.next())Ce=H(O,Ce.value,L),Ce!==null&&(T=u(Ce,T,he),Oe===null?P=Ce:Oe.sibling=Ce,Oe=Ce);return xe&&yn(O,he),P}for(W=a(W);!Ce.done;he++,Ce=C.next())Ce=R(W,O,he,Ce.value,L),Ce!==null&&(e&&Ce.alternate!==null&&W.delete(Ce.key===null?he:Ce.key),T=u(Ce,T,he),Oe===null?P=Ce:Oe.sibling=Ce,Oe=Ce);return e&&W.forEach(function(Ny){return t(O,Ny)}),xe&&yn(O,he),P}function Me(O,T,C,L){if(typeof C=="object"&&C!==null&&C.type===B&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case z:e:{for(var P=C.key;T!==null;){if(T.key===P){if(P=C.type,P===B){if(T.tag===7){n(O,T.sibling),L=s(T,C.props.children),L.return=O,O=L;break e}}else if(T.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===ve&&Na(P)===T.type){n(O,T.sibling),L=s(T,C.props),ni(L,C),L.return=O,O=L;break e}n(O,T);break}else t(O,T);T=T.sibling}C.type===B?(L=xa(C.props.children,O.mode,L,C.key),L.return=O,O=L):(L=ls(C.type,C.key,C.props,null,O.mode,L),ni(L,C),L.return=O,O=L)}return d(O);case j:e:{for(P=C.key;T!==null;){if(T.key===P)if(T.tag===4&&T.stateNode.containerInfo===C.containerInfo&&T.stateNode.implementation===C.implementation){n(O,T.sibling),L=s(T,C.children||[]),L.return=O,O=L;break e}else{n(O,T);break}else t(O,T);T=T.sibling}L=no(C,O.mode,L),L.return=O,O=L}return d(O);case ve:return C=Na(C),Me(O,T,C,L)}if(je(C))return F(O,T,C,L);if(re(C)){if(P=re(C),typeof P!="function")throw Error(o(150));return C=P.call(C),ne(O,T,C,L)}if(typeof C.then=="function")return Me(O,T,fs(C),L);if(C.$$typeof===Z)return Me(O,T,rs(O,C),L);ds(O,C)}return typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint"?(C=""+C,T!==null&&T.tag===6?(n(O,T.sibling),L=s(T,C),L.return=O,O=L):(n(O,T),L=to(C,O.mode,L),L.return=O,O=L),d(O)):n(O,T)}return function(O,T,C,L){try{ti=0;var P=Me(O,T,C,L);return ul=null,P}catch(W){if(W===ol||W===us)throw W;var Oe=Rt(29,W,null,O.mode);return Oe.lanes=L,Oe.return=O,Oe}}}var Aa=Tf(!0),Of=Tf(!1),kn=!1;function go(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function po(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Kn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Gn(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Ne&2)!==0){var s=a.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),a.pending=t,t=as(e),rf(e,null,n),t}return ns(e,a,t,n),as(e)}function ai(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,gt(e,n)}}function vo(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var s=null,u=null;if(n=n.firstBaseUpdate,n!==null){do{var d={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};u===null?s=u=d:u=u.next=d,n=n.next}while(n!==null);u===null?s=u=t:u=u.next=t}else s=u=t;n={baseState:a.baseState,firstBaseUpdate:s,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var yo=!1;function li(){if(yo){var e=rl;if(e!==null)throw e}}function ii(e,t,n,a){yo=!1;var s=e.updateQueue;kn=!1;var u=s.firstBaseUpdate,d=s.lastBaseUpdate,p=s.shared.pending;if(p!==null){s.shared.pending=null;var S=p,N=S.next;S.next=null,d===null?u=N:d.next=N,d=S;var M=e.alternate;M!==null&&(M=M.updateQueue,p=M.lastBaseUpdate,p!==d&&(p===null?M.firstBaseUpdate=N:p.next=N,M.lastBaseUpdate=S))}if(u!==null){var H=s.baseState;d=0,M=N=S=null,p=u;do{var w=p.lane&-536870913,R=w!==p.lane;if(R?(ye&w)===w:(a&w)===w){w!==0&&w===sl&&(yo=!0),M!==null&&(M=M.next={lane:0,tag:p.tag,payload:p.payload,callback:null,next:null});e:{var F=e,ne=p;w=t;var Me=n;switch(ne.tag){case 1:if(F=ne.payload,typeof F=="function"){H=F.call(Me,H,w);break e}H=F;break e;case 3:F.flags=F.flags&-65537|128;case 0:if(F=ne.payload,w=typeof F=="function"?F.call(Me,H,w):F,w==null)break e;H=g({},H,w);break e;case 2:kn=!0}}w=p.callback,w!==null&&(e.flags|=64,R&&(e.flags|=8192),R=s.callbacks,R===null?s.callbacks=[w]:R.push(w))}else R={lane:w,tag:p.tag,payload:p.payload,callback:p.callback,next:null},M===null?(N=M=R,S=H):M=M.next=R,d|=w;if(p=p.next,p===null){if(p=s.shared.pending,p===null)break;R=p,p=R.next,R.next=null,s.lastBaseUpdate=R,s.shared.pending=null}}while(!0);M===null&&(S=H),s.baseState=S,s.firstBaseUpdate=N,s.lastBaseUpdate=M,u===null&&(s.shared.lanes=0),Jn|=d,e.lanes=d,e.memoizedState=H}}function Cf(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Nf(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;eu?u:8;var d=D.T,p={};D.T=p,Bo(e,!1,t,n);try{var S=s(),N=D.S;if(N!==null&&N(p,S),S!==null&&typeof S=="object"&&typeof S.then=="function"){var M=gv(S,a);oi(e,t,M,Lt(e))}else oi(e,t,a,Lt(e))}catch(H){oi(e,t,{then:function(){},status:"rejected",reason:H},Lt())}finally{V.p=u,d!==null&&p.types!==null&&(d.types=p.types),D.T=d}}function xv(){}function Lo(e,t,n,a){if(e.tag!==5)throw Error(o(476));var s=ld(e).queue;ad(e,s,t,$,n===null?xv:function(){return id(e),n(a)})}function ld(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:En,lastRenderedState:$},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:En,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function id(e){var t=ld(e);t.next===null&&(t=e.alternate.memoizedState),oi(e,t.next.queue,{},Lt())}function Uo(){return nt(Ci)}function sd(){return Ge().memoizedState}function rd(){return Ge().memoizedState}function Ev(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Lt();e=Kn(n);var a=Gn(t,e,n);a!==null&&(Tt(a,t,n),ai(a,t,n)),t={cache:co()},e.payload=t;return}t=t.return}}function Tv(e,t,n){var a=Lt();n={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Es(e)?ud(t,n):(n=Pr(e,t,n,a),n!==null&&(Tt(n,e,a),cd(n,t,a)))}function od(e,t,n){var a=Lt();oi(e,t,n,a)}function oi(e,t,n,a){var s={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Es(e))ud(t,s);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var d=t.lastRenderedState,p=u(d,n);if(s.hasEagerState=!0,s.eagerState=p,wt(p,d))return ns(e,t,s,0),_e===null&&ts(),!1}catch{}if(n=Pr(e,t,s,a),n!==null)return Tt(n,e,a),cd(n,t,a),!0}return!1}function Bo(e,t,n,a){if(a={lane:2,revertLane:gu(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Es(e)){if(t)throw Error(o(479))}else t=Pr(e,n,a,2),t!==null&&Tt(t,e,2)}function Es(e){var t=e.alternate;return e===ce||t!==null&&t===ce}function ud(e,t){fl=gs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function cd(e,t,n){if((n&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,gt(e,n)}}var ui={readContext:nt,use:ys,useCallback:Ye,useContext:Ye,useEffect:Ye,useImperativeHandle:Ye,useLayoutEffect:Ye,useInsertionEffect:Ye,useMemo:Ye,useReducer:Ye,useRef:Ye,useState:Ye,useDebugValue:Ye,useDeferredValue:Ye,useTransition:Ye,useSyncExternalStore:Ye,useId:Ye,useHostTransitionStatus:Ye,useFormState:Ye,useActionState:Ye,useOptimistic:Ye,useMemoCache:Ye,useCacheRefresh:Ye};ui.useEffectEvent=Ye;var fd={readContext:nt,use:ys,useCallback:function(e,t){return dt().memoizedState=[e,t===void 0?null:t],e},useContext:nt,useEffect:Ff,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Ss(4194308,4,If.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ss(4194308,4,e,t)},useInsertionEffect:function(e,t){Ss(4,2,e,t)},useMemo:function(e,t){var n=dt();t=t===void 0?null:t;var a=e();if(wa){Ft(!0);try{e()}finally{Ft(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=dt();if(n!==void 0){var s=n(t);if(wa){Ft(!0);try{n(t)}finally{Ft(!1)}}}else s=t;return a.memoizedState=a.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},a.queue=e,e=e.dispatch=Tv.bind(null,ce,e),[a.memoizedState,e]},useRef:function(e){var t=dt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ro(e);var t=e.queue,n=od.bind(null,ce,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:_o,useDeferredValue:function(e,t){var n=dt();return jo(n,e,t)},useTransition:function(){var e=Ro(!1);return e=ad.bind(null,ce,e.queue,!0,!1),dt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=ce,s=dt();if(xe){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),_e===null)throw Error(o(349));(ye&127)!==0||Mf(a,t,n)}s.memoizedState=n;var u={value:n,getSnapshot:t};return s.queue=u,Ff(jf.bind(null,a,u,e),[e]),a.flags|=2048,hl(9,{destroy:void 0},_f.bind(null,a,u,n,t),null),n},useId:function(){var e=dt(),t=_e.identifierPrefix;if(xe){var n=sn,a=ln;n=(a&~(1<<32-st(a)-1)).toString(32)+n,t="_"+t+"R_"+n,n=ps++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?d.createElement("select",{is:a.is}):d.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?d.createElement(s,{is:a.is}):d.createElement(s)}}u[et]=t,u[vt]=a;e:for(d=t.child;d!==null;){if(d.tag===5||d.tag===6)u.appendChild(d.stateNode);else if(d.tag!==4&&d.tag!==27&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}t.stateNode=u;e:switch(lt(u,s,a),s){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&On(t)}}return Ue(t),Wo(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&On(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(o(166));if(e=le.current,ll(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,s=tt,s!==null)switch(s.tag){case 27:case 5:a=s.memoizedProps}e[et]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||Rh(e.nodeValue,n)),e||Vn(t,!0)}else e=ks(e).createTextNode(a),e[et]=t,t.stateNode=e}return Ue(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(a=ll(t),n!==null){if(e===null){if(!a)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[et]=t}else Ea(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ue(t),e=!1}else n=so(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Mt(t),t):(Mt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Ue(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=ll(t),a!==null&&a.dehydrated!==null){if(e===null){if(!s)throw Error(o(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(o(317));s[et]=t}else Ea(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ue(t),s=!1}else s=so(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Mt(t),t):(Mt(t),null)}return Mt(t),(t.flags&128)!==0?(t.lanes=n,t):(n=a!==null,e=e!==null&&e.memoizedState!==null,n&&(a=t.child,s=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(s=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==s&&(a.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Ds(t,t.updateQueue),Ue(t),null);case 4:return De(),e===null&&bu(t.stateNode.containerInfo),Ue(t),null;case 10:return Sn(t.type),Ue(t),null;case 19:if(_(Ke),a=t.memoizedState,a===null)return Ue(t),null;if(s=(t.flags&128)!==0,u=a.rendering,u===null)if(s)fi(a,!1);else{if(ke!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=ms(e),u!==null){for(t.flags|=128,fi(a,!1),e=u.updateQueue,t.updateQueue=e,Ds(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)of(n,e),n=n.sibling;return q(Ke,Ke.current&1|2),xe&&yn(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&ct()>Ms&&(t.flags|=128,s=!0,fi(a,!1),t.lanes=4194304)}else{if(!s)if(e=ms(u),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Ds(t,e),fi(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!xe)return Ue(t),null}else 2*ct()-a.renderingStartTime>Ms&&n!==536870912&&(t.flags|=128,s=!0,fi(a,!1),t.lanes=4194304);a.isBackwards?(u.sibling=t.child,t.child=u):(e=a.last,e!==null?e.sibling=u:t.child=u,a.last=u)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=ct(),e.sibling=null,n=Ke.current,q(Ke,s?n&1|2:n&1),xe&&yn(t,a.treeForkCount),e):(Ue(t),null);case 22:case 23:return Mt(t),So(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(n&536870912)!==0&&(t.flags&128)===0&&(Ue(t),t.subtreeFlags&6&&(t.flags|=8192)):Ue(t),n=t.updateQueue,n!==null&&Ds(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&&_(Ca),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Sn(Qe),Ue(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Av(e,t){switch(lo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Sn(Qe),De(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return dn(t),null;case 31:if(t.memoizedState!==null){if(Mt(t),t.alternate===null)throw Error(o(340));Ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Mt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return _(Ke),null;case 4:return De(),null;case 10:return Sn(t.type),null;case 22:case 23:return Mt(t),So(),e!==null&&_(Ca),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Sn(Qe),null;case 25:return null;default:return null}}function Ld(e,t){switch(lo(t),t.tag){case 3:Sn(Qe),De();break;case 26:case 27:case 5:dn(t);break;case 4:De();break;case 31:t.memoizedState!==null&&Mt(t);break;case 13:Mt(t);break;case 19:_(Ke);break;case 10:Sn(t.type);break;case 22:case 23:Mt(t),So(),e!==null&&_(Ca);break;case 24:Sn(Qe)}}function di(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var s=a.next;n=s;do{if((n.tag&e)===e){a=void 0;var u=n.create,d=n.inst;a=u(),d.destroy=a}n=n.next}while(n!==s)}}catch(p){we(t,t.return,p)}}function Zn(e,t,n){try{var a=t.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var u=s.next;a=u;do{if((a.tag&e)===e){var d=a.inst,p=d.destroy;if(p!==void 0){d.destroy=void 0,s=t;var S=n,N=p;try{N()}catch(M){we(s,S,M)}}}a=a.next}while(a!==u)}}catch(M){we(t,t.return,M)}}function Ud(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Nf(t,n)}catch(a){we(e,e.return,a)}}}function Bd(e,t,n){n.props=Ra(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){we(e,t,a)}}function hi(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof n=="function"?e.refCleanup=n(a):n.current=a}}catch(s){we(e,t,s)}}function rn(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(s){we(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(s){we(e,t,s)}else n.current=null}function Hd(e){var t=e.type,n=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&a.focus();break e;case"img":n.src?a.src=n.src:n.srcSet&&(a.srcset=n.srcSet)}}catch(s){we(e,e.return,s)}}function Io(e,t,n){try{var a=e.stateNode;$v(a,e.type,n,t),a[vt]=t}catch(s){we(e,e.return,s)}}function qd(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ea(e.type)||e.tag===4}function Po(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ea(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function eu(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gn));else if(a!==4&&(a===27&&ea(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(eu(e,t,n),e=e.sibling;e!==null;)eu(e,t,n),e=e.sibling}function As(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(a!==4&&(a===27&&ea(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(As(e,t,n),e=e.sibling;e!==null;)As(e,t,n),e=e.sibling}function Vd(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);lt(t,a,n),t[et]=e,t[vt]=n}catch(u){we(e,e.return,u)}}var Cn=!1,Fe=!1,tu=!1,Yd=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function wv(e,t){if(e=e.containerInfo,Eu=Js,e=Ic(e),Zr(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var a=n.getSelection&&n.getSelection();if(a&&a.rangeCount!==0){n=a.anchorNode;var s=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{n.nodeType,u.nodeType}catch{n=null;break e}var d=0,p=-1,S=-1,N=0,M=0,H=e,w=null;t:for(;;){for(var R;H!==n||s!==0&&H.nodeType!==3||(p=d+s),H!==u||a!==0&&H.nodeType!==3||(S=d+a),H.nodeType===3&&(d+=H.nodeValue.length),(R=H.firstChild)!==null;)w=H,H=R;for(;;){if(H===e)break t;if(w===n&&++N===s&&(p=d),w===u&&++M===a&&(S=d),(R=H.nextSibling)!==null)break;H=w,w=H.parentNode}H=R}n=p===-1||S===-1?null:{start:p,end:S}}else n=null}n=n||{start:0,end:0}}else n=null;for(Tu={focusedElem:e,selectionRange:n},Js=!1,Pe=t;Pe!==null;)if(t=Pe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Pe=e;else for(;Pe!==null;){switch(t=Pe,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),lt(u,a,n),u[et]=e,Ie(u),a=u;break e;case"link":var d=Zh("link","href",s).get(a+(n.href||""));if(d){for(var p=0;pMe&&(d=Me,Me=ne,ne=d);var O=$c(p,ne),T=$c(p,Me);if(O&&T&&(R.rangeCount!==1||R.anchorNode!==O.node||R.anchorOffset!==O.offset||R.focusNode!==T.node||R.focusOffset!==T.offset)){var C=H.createRange();C.setStart(O.node,O.offset),R.removeAllRanges(),ne>Me?(R.addRange(C),R.extend(T.node,T.offset)):(C.setEnd(T.node,T.offset),R.addRange(C))}}}}for(H=[],R=p;R=R.parentNode;)R.nodeType===1&&H.push({element:R,left:R.scrollLeft,top:R.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;pn?32:n,D.T=null,n=ou,ou=null;var u=Wn,d=Rn;if(Je=0,yl=Wn=null,Rn=0,(Ne&6)!==0)throw Error(o(331));var p=Ne;if(Ne|=4,Id(u.current),Jd(u,u.current,d,n),Ne=p,bi(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(ha,u)}catch{}return!0}finally{V.p=s,D.T=a,ph(e,t)}}function yh(e,t,n){t=Vt(n,t),t=Yo(e.stateNode,t,2),e=Gn(e,t,2),e!==null&&(Ve(e,2),on(e))}function we(e,t,n){if(e.tag===3)yh(e,e,n);else for(;t!==null;){if(t.tag===3){yh(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&($n===null||!$n.has(a))){e=Vt(n,e),n=bd(2),a=Gn(t,n,2),a!==null&&(Sd(n,a,t,e),Ve(a,2),on(a));break}}t=t.return}}function du(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new Mv;var s=new Set;a.set(t,s)}else s=a.get(t),s===void 0&&(s=new Set,a.set(t,s));s.has(n)||(lu=!0,s.add(n),e=Bv.bind(null,e,t,n),t.then(e,e))}function Bv(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,_e===e&&(ye&n)===n&&(ke===4||ke===3&&(ye&62914560)===ye&&300>ct()-zs?(Ne&2)===0&&bl(e,0):iu|=n,vl===ye&&(vl=0)),on(e)}function bh(e,t){t===0&&(t=rt()),e=Sa(e,t),e!==null&&(Ve(e,t),on(e))}function Hv(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),bh(e,n)}function qv(e,t){var n=0;switch(e.tag){case 31:case 13:var a=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(o(314))}a!==null&&a.delete(t),bh(e,n)}function Vv(e,t){return Ul(e,t)}var Hs=null,xl=null,hu=!1,qs=!1,mu=!1,Pn=0;function on(e){e!==xl&&e.next===null&&(xl===null?Hs=xl=e:xl=xl.next=e),qs=!0,hu||(hu=!0,kv())}function bi(e,t){if(!mu&&qs){mu=!0;do for(var n=!1,a=Hs;a!==null;){if(e!==0){var s=a.pendingLanes;if(s===0)var u=0;else{var d=a.suspendedLanes,p=a.pingedLanes;u=(1<<31-st(42|e)+1)-1,u&=s&~(d&~p),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(n=!0,Th(a,u))}else u=ye,u=ie(a,a===_e?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||Be(a,u)||(n=!0,Th(a,u));a=a.next}while(n);mu=!1}}function Yv(){Sh()}function Sh(){qs=hu=!1;var e=0;Pn!==0&&Iv()&&(e=Pn);for(var t=ct(),n=null,a=Hs;a!==null;){var s=a.next,u=xh(a,t);u===0?(a.next=null,n===null?Hs=s:n.next=s,s===null&&(xl=n)):(n=a,(e!==0||(u&3)!==0)&&(qs=!0)),a=s}Je!==0&&Je!==5||bi(e),Pn!==0&&(Pn=0)}function xh(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,s=e.expirationTimes,u=e.pendingLanes&-62914561;0p)break;var M=S.transferSize,H=S.initiatorType;M&&zh(H)&&(S=S.responseEnd,d+=M*(S"u"?null:document;function Kh(e,t,n){var a=El;if(a&&typeof t=="string"&&t){var s=Ht(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),kh.has(s)||(kh.add(s),e={rel:e,crossOrigin:n,href:t},a.querySelector(s)===null&&(t=a.createElement("link"),lt(t,"link",e),Ie(t),a.head.appendChild(t)))}}function ry(e){zn.D(e),Kh("dns-prefetch",e,null)}function oy(e,t){zn.C(e,t),Kh("preconnect",e,t)}function uy(e,t,n){zn.L(e,t,n);var a=El;if(a&&e&&t){var s='link[rel="preload"][as="'+Ht(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+Ht(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+Ht(n.imageSizes)+'"]')):s+='[href="'+Ht(e)+'"]';var u=s;switch(t){case"style":u=Tl(e);break;case"script":u=Ol(e)}Xt.has(u)||(e=g({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Xt.set(u,e),a.querySelector(s)!==null||t==="style"&&a.querySelector(Ti(u))||t==="script"&&a.querySelector(Oi(u))||(t=a.createElement("link"),lt(t,"link",e),Ie(t),a.head.appendChild(t)))}}function cy(e,t){zn.m(e,t);var n=El;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Ht(a)+'"][href="'+Ht(e)+'"]',u=s;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ol(e)}if(!Xt.has(u)&&(e=g({rel:"modulepreload",href:e},t),Xt.set(u,e),n.querySelector(s)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Oi(u)))return}a=n.createElement("link"),lt(a,"link",e),Ie(a),n.head.appendChild(a)}}}function fy(e,t,n){zn.S(e,t,n);var a=El;if(a&&e){var s=Qa(a).hoistableStyles,u=Tl(e);t=t||"default";var d=s.get(u);if(!d){var p={loading:0,preload:null};if(d=a.querySelector(Ti(u)))p.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Xt.get(u))&&Ru(e,n);var S=d=a.createElement("link");Ie(S),lt(S,"link",e),S._p=new Promise(function(N,M){S.onload=N,S.onerror=M}),S.addEventListener("load",function(){p.loading|=1}),S.addEventListener("error",function(){p.loading|=2}),p.loading|=4,Gs(d,t,a)}d={type:"stylesheet",instance:d,count:1,state:p},s.set(u,d)}}}function dy(e,t){zn.X(e,t);var n=El;if(n&&e){var a=Qa(n).hoistableScripts,s=Ol(e),u=a.get(s);u||(u=n.querySelector(Oi(s)),u||(e=g({src:e,async:!0},t),(t=Xt.get(s))&&zu(e,t),u=n.createElement("script"),Ie(u),lt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(s,u))}}function hy(e,t){zn.M(e,t);var n=El;if(n&&e){var a=Qa(n).hoistableScripts,s=Ol(e),u=a.get(s);u||(u=n.querySelector(Oi(s)),u||(e=g({src:e,async:!0,type:"module"},t),(t=Xt.get(s))&&zu(e,t),u=n.createElement("script"),Ie(u),lt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(s,u))}}function Gh(e,t,n,a){var s=(s=le.current)?Ks(s):null;if(!s)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Tl(n.href),n=Qa(s).hoistableStyles,a=n.get(t),a||(a={type:"style",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Tl(n.href);var u=Qa(s).hoistableStyles,d=u.get(e);if(d||(s=s.ownerDocument||s,d={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,d),(u=s.querySelector(Ti(e)))&&!u._p&&(d.instance=u,d.state.loading=5),Xt.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Xt.set(e,n),u||my(s,e,n,d.state))),t&&a===null)throw Error(o(528,""));return d}if(t&&a!==null)throw Error(o(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ol(n),n=Qa(s).hoistableScripts,a=n.get(t),a||(a={type:"script",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Tl(e){return'href="'+Ht(e)+'"'}function Ti(e){return'link[rel="stylesheet"]['+e+"]"}function Qh(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function my(e,t,n,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),lt(t,"link",n),Ie(t),e.head.appendChild(t))}function Ol(e){return'[src="'+Ht(e)+'"]'}function Oi(e){return"script[async]"+e}function Xh(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+Ht(n.href)+'"]');if(a)return t.instance=a,Ie(a),a;var s=g({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Ie(a),lt(a,"style",s),Gs(a,n.precedence,e),t.instance=a;case"stylesheet":s=Tl(n.href);var u=e.querySelector(Ti(s));if(u)return t.state.loading|=4,t.instance=u,Ie(u),u;a=Qh(n),(s=Xt.get(s))&&Ru(a,s),u=(e.ownerDocument||e).createElement("link"),Ie(u);var d=u;return d._p=new Promise(function(p,S){d.onload=p,d.onerror=S}),lt(u,"link",a),t.state.loading|=4,Gs(u,n.precedence,e),t.instance=u;case"script":return u=Ol(n.src),(s=e.querySelector(Oi(u)))?(t.instance=s,Ie(s),s):(a=n,(s=Xt.get(u))&&(a=g({},n),zu(a,s)),e=e.ownerDocument||e,s=e.createElement("script"),Ie(s),lt(s,"link",a),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Gs(a,n.precedence,e));return t.instance}function Gs(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=a.length?a[a.length-1]:null,u=s,d=0;d title"):null)}function gy(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Jh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function py(e,t,n,a){if(n.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var s=Tl(a.href),u=t.querySelector(Ti(s));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Xs.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=u,Ie(u);return}u=t.ownerDocument||t,a=Qh(a),(s=Xt.get(s))&&Ru(a,s),u=u.createElement("link"),Ie(u);var d=u;d._p=new Promise(function(p,S){d.onload=p,d.onerror=S}),lt(u,"link",a),n.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Xs.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Mu=0;function vy(e,t){return e.stylesheets&&e.count===0&&Fs(e,e.stylesheets),0Mu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(s)}}:null}function Xs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fs(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Zs=null;function Fs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Zs=new Map,t.forEach(yy,e),Zs=null,Xs.call(e))}function yy(e,t){if(!(t.state.loading&4)){var n=Zs.get(e);if(n)var a=n.get(null);else{n=new Map,Zs.set(e,n);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(l){console.error(l)}}return i(),qu.exports=Iy(),qu.exports}var e0=Py();function t0(i){if(typeof document>"u")return;let l=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",l.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}const n0=i=>{switch(i){case"success":return i0;case"info":return r0;case"warning":return s0;case"error":return o0;default:return null}},a0=Array(12).fill(0),l0=({visible:i,className:l})=>Y.createElement("div",{className:["sonner-loading-wrapper",l].filter(Boolean).join(" "),"data-visible":i},Y.createElement("div",{className:"sonner-spinner"},a0.map((r,o)=>Y.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${o}`})))),i0=Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Y.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),s0=Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Y.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),r0=Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Y.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),o0=Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Y.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),u0=Y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Y.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Y.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),c0=()=>{const[i,l]=Y.useState(document.hidden);return Y.useEffect(()=>{const r=()=>{l(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),i};let tc=1;class f0{constructor(){this.subscribe=l=>(this.subscribers.push(l),()=>{const r=this.subscribers.indexOf(l);this.subscribers.splice(r,1)}),this.publish=l=>{this.subscribers.forEach(r=>r(l))},this.addToast=l=>{this.publish(l),this.toasts=[...this.toasts,l]},this.create=l=>{var r;const{message:o,...c}=l,f=typeof l?.id=="number"||((r=l.id)==null?void 0:r.length)>0?l.id:tc++,m=this.toasts.find(b=>b.id===f),h=l.dismissible===void 0?!0:l.dismissible;return this.dismissedToasts.has(f)&&this.dismissedToasts.delete(f),m?this.toasts=this.toasts.map(b=>b.id===f?(this.publish({...b,...l,id:f,title:o}),{...b,...l,id:f,dismissible:h,title:o}):b):this.addToast({title:o,...c,dismissible:h,id:f}),f},this.dismiss=l=>(l?(this.dismissedToasts.add(l),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:l,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(o=>o({id:r.id,dismiss:!0}))}),l),this.message=(l,r)=>this.create({...r,message:l}),this.error=(l,r)=>this.create({...r,message:l,type:"error"}),this.success=(l,r)=>this.create({...r,type:"success",message:l}),this.info=(l,r)=>this.create({...r,type:"info",message:l}),this.warning=(l,r)=>this.create({...r,type:"warning",message:l}),this.loading=(l,r)=>this.create({...r,type:"loading",message:l}),this.promise=(l,r)=>{if(!r)return;let o;r.loading!==void 0&&(o=this.create({...r,promise:l,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const c=Promise.resolve(l instanceof Function?l():l);let f=o!==void 0,m;const h=c.then(async v=>{if(m=["resolve",v],Y.isValidElement(v))f=!1,this.create({id:o,type:"default",message:v});else if(h0(v)&&!v.ok){f=!1;const g=typeof r.error=="function"?await r.error(`HTTP error! status: ${v.status}`):r.error,A=typeof r.description=="function"?await r.description(`HTTP error! status: ${v.status}`):r.description,j=typeof g=="object"&&!Y.isValidElement(g)?g:{message:g};this.create({id:o,type:"error",description:A,...j})}else if(v instanceof Error){f=!1;const g=typeof r.error=="function"?await r.error(v):r.error,A=typeof r.description=="function"?await r.description(v):r.description,j=typeof g=="object"&&!Y.isValidElement(g)?g:{message:g};this.create({id:o,type:"error",description:A,...j})}else if(r.success!==void 0){f=!1;const g=typeof r.success=="function"?await r.success(v):r.success,A=typeof r.description=="function"?await r.description(v):r.description,j=typeof g=="object"&&!Y.isValidElement(g)?g:{message:g};this.create({id:o,type:"success",description:A,...j})}}).catch(async v=>{if(m=["reject",v],r.error!==void 0){f=!1;const x=typeof r.error=="function"?await r.error(v):r.error,g=typeof r.description=="function"?await r.description(v):r.description,z=typeof x=="object"&&!Y.isValidElement(x)?x:{message:x};this.create({id:o,type:"error",description:g,...z})}}).finally(()=>{f&&(this.dismiss(o),o=void 0),r.finally==null||r.finally.call(r)}),b=()=>new Promise((v,x)=>h.then(()=>m[0]==="reject"?x(m[1]):v(m[1])).catch(x));return typeof o!="string"&&typeof o!="number"?{unwrap:b}:Object.assign(o,{unwrap:b})},this.custom=(l,r)=>{const o=r?.id||tc++;return this.create({jsx:l(o),id:o,...r}),o},this.getActiveToasts=()=>this.toasts.filter(l=>!this.dismissedToasts.has(l.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Ct=new f0,d0=(i,l)=>{const r=l?.id||tc++;return Ct.addToast({title:i,...l,id:r}),r},h0=i=>i&&typeof i=="object"&&"ok"in i&&typeof i.ok=="boolean"&&"status"in i&&typeof i.status=="number",m0=d0,g0=()=>Ct.toasts,p0=()=>Ct.getActiveToasts(),DE=Object.assign(m0,{success:Ct.success,info:Ct.info,warning:Ct.warning,error:Ct.error,custom:Ct.custom,message:Ct.message,promise:Ct.promise,dismiss:Ct.dismiss,loading:Ct.loading},{getHistory:g0,getToasts:p0});t0("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function nr(i){return i.label!==void 0}const v0=3,y0="24px",b0="16px",pm=4e3,S0=356,x0=14,E0=45,T0=200;function un(...i){return i.filter(Boolean).join(" ")}function O0(i){const[l,r]=i.split("-"),o=[];return l&&o.push(l),r&&o.push(r),o}const C0=i=>{var l,r,o,c,f,m,h,b,v;const{invert:x,toast:g,unstyled:A,interacting:z,setHeights:j,visibleToasts:B,heights:K,index:U,toasts:Q,expanded:Z,removeToast:I,defaultRichColors:ee,closeButton:J,style:X,cancelButtonStyle:ve,actionButtonStyle:ae,className:te="",descriptionClassName:fe="",duration:re,position:Ee,gap:Te,expandByDefault:je,classNames:D,icons:V,closeButtonAriaLabel:$="Close toast"}=i,[de,oe]=Y.useState(null),[me,_]=Y.useState(null),[q,G]=Y.useState(!1),[k,le]=Y.useState(!1),[Se,ue]=Y.useState(!1),[De,Dt]=Y.useState(!1),[dn,tn]=Y.useState(!1),[Yi,Zt]=Y.useState(0),[jl,Ha]=Y.useState(0),ca=Y.useRef(g.duration||re||pm),Ll=Y.useRef(null),At=Y.useRef(null),Ul=U===0,Bl=U+1<=B,ut=g.type,_n=g.dismissible!==!1,ct=g.className||"",Nr=g.descriptionClassName||"",fa=Y.useMemo(()=>K.findIndex(ie=>ie.toastId===g.id)||0,[K,g.id]),ki=Y.useMemo(()=>{var ie;return(ie=g.closeButton)!=null?ie:J},[g.closeButton,J]),da=Y.useMemo(()=>g.duration||re||pm,[g.duration,re]),Hl=Y.useRef(0),hn=Y.useRef(0),Ki=Y.useRef(0),jn=Y.useRef(null),[ha,ft]=Ee.split("-"),Ft=Y.useMemo(()=>K.reduce((ie,Be,We)=>We>=fa?ie:ie+Be.height,0),[K,fa]),st=c0(),Dr=g.invert||x,ql=ut==="loading";hn.current=Y.useMemo(()=>fa*Te+Ft,[fa,Ft]),Y.useEffect(()=>{ca.current=da},[da]),Y.useEffect(()=>{G(!0)},[]),Y.useEffect(()=>{const ie=At.current;if(ie){const Be=ie.getBoundingClientRect().height;return Ha(Be),j(We=>[{toastId:g.id,height:Be,position:g.position},...We]),()=>j(We=>We.filter(rt=>rt.toastId!==g.id))}},[j,g.id]),Y.useLayoutEffect(()=>{if(!q)return;const ie=At.current,Be=ie.style.height;ie.style.height="auto";const We=ie.getBoundingClientRect().height;ie.style.height=Be,Ha(We),j(rt=>rt.find(Ve=>Ve.toastId===g.id)?rt.map(Ve=>Ve.toastId===g.id?{...Ve,height:We}:Ve):[{toastId:g.id,height:We,position:g.position},...rt])},[q,g.title,g.description,j,g.id,g.jsx,g.action,g.cancel]);const nn=Y.useCallback(()=>{le(!0),Zt(hn.current),j(ie=>ie.filter(Be=>Be.toastId!==g.id)),setTimeout(()=>{I(g)},T0)},[g,I,j,hn]);Y.useEffect(()=>{if(g.promise&&ut==="loading"||g.duration===1/0||g.type==="loading")return;let ie;return Z||z||st?(()=>{if(Ki.current{g.onAutoClose==null||g.onAutoClose.call(g,g),nn()},ca.current)),()=>clearTimeout(ie)},[Z,z,g,ut,st,nn]),Y.useEffect(()=>{g.delete&&(nn(),g.onDismiss==null||g.onDismiss.call(g,g))},[nn,g.delete]);function qa(){var ie;if(V?.loading){var Be;return Y.createElement("div",{className:un(D?.loader,g==null||(Be=g.classNames)==null?void 0:Be.loader,"sonner-loader"),"data-visible":ut==="loading"},V.loading)}return Y.createElement(l0,{className:un(D?.loader,g==null||(ie=g.classNames)==null?void 0:ie.loader),visible:ut==="loading"})}const Va=g.icon||V?.[ut]||n0(ut);var ma,an;return Y.createElement("li",{tabIndex:0,ref:At,className:un(te,ct,D?.toast,g==null||(l=g.classNames)==null?void 0:l.toast,D?.default,D?.[ut],g==null||(r=g.classNames)==null?void 0:r[ut]),"data-sonner-toast":"","data-rich-colors":(ma=g.richColors)!=null?ma:ee,"data-styled":!(g.jsx||g.unstyled||A),"data-mounted":q,"data-promise":!!g.promise,"data-swiped":dn,"data-removed":k,"data-visible":Bl,"data-y-position":ha,"data-x-position":ft,"data-index":U,"data-front":Ul,"data-swiping":Se,"data-dismissible":_n,"data-type":ut,"data-invert":Dr,"data-swipe-out":De,"data-swipe-direction":me,"data-expanded":!!(Z||je&&q),"data-testid":g.testId,style:{"--index":U,"--toasts-before":U,"--z-index":Q.length-U,"--offset":`${k?Yi:hn.current}px`,"--initial-height":je?"auto":`${jl}px`,...X,...g.style},onDragEnd:()=>{ue(!1),oe(null),jn.current=null},onPointerDown:ie=>{ie.button!==2&&(ql||!_n||(Ll.current=new Date,Zt(hn.current),ie.target.setPointerCapture(ie.pointerId),ie.target.tagName!=="BUTTON"&&(ue(!0),jn.current={x:ie.clientX,y:ie.clientY})))},onPointerUp:()=>{var ie,Be,We;if(De||!_n)return;jn.current=null;const rt=Number(((ie=At.current)==null?void 0:ie.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ln=Number(((Be=At.current)==null?void 0:Be.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ve=new Date().getTime()-((We=Ll.current)==null?void 0:We.getTime()),mt=de==="x"?rt:Ln,ga=Math.abs(mt)/Ve;if(Math.abs(mt)>=E0||ga>.11){Zt(hn.current),g.onDismiss==null||g.onDismiss.call(g,g),_(de==="x"?rt>0?"right":"left":Ln>0?"down":"up"),nn(),Dt(!0);return}else{var gt,pt;(gt=At.current)==null||gt.style.setProperty("--swipe-amount-x","0px"),(pt=At.current)==null||pt.style.setProperty("--swipe-amount-y","0px")}tn(!1),ue(!1),oe(null)},onPointerMove:ie=>{var Be,We,rt;if(!jn.current||!_n||((Be=window.getSelection())==null?void 0:Be.toString().length)>0)return;const Ve=ie.clientY-jn.current.y,mt=ie.clientX-jn.current.x;var ga;const gt=(ga=i.swipeDirections)!=null?ga:O0(Ee);!de&&(Math.abs(mt)>1||Math.abs(Ve)>1)&&oe(Math.abs(mt)>Math.abs(Ve)?"x":"y");let pt={x:0,y:0};const Ya=Jt=>1/(1.5+Math.abs(Jt)/20);if(de==="y"){if(gt.includes("top")||gt.includes("bottom"))if(gt.includes("top")&&Ve<0||gt.includes("bottom")&&Ve>0)pt.y=Ve;else{const Jt=Ve*Ya(Ve);pt.y=Math.abs(Jt)0)pt.x=mt;else{const Jt=mt*Ya(mt);pt.x=Math.abs(Jt)0||Math.abs(pt.y)>0)&&tn(!0),(We=At.current)==null||We.style.setProperty("--swipe-amount-x",`${pt.x}px`),(rt=At.current)==null||rt.style.setProperty("--swipe-amount-y",`${pt.y}px`)}},ki&&!g.jsx&&ut!=="loading"?Y.createElement("button",{"aria-label":$,"data-disabled":ql,"data-close-button":!0,onClick:ql||!_n?()=>{}:()=>{nn(),g.onDismiss==null||g.onDismiss.call(g,g)},className:un(D?.closeButton,g==null||(o=g.classNames)==null?void 0:o.closeButton)},(an=V?.close)!=null?an:u0):null,(ut||g.icon||g.promise)&&g.icon!==null&&(V?.[ut]!==null||g.icon)?Y.createElement("div",{"data-icon":"",className:un(D?.icon,g==null||(c=g.classNames)==null?void 0:c.icon)},g.promise||g.type==="loading"&&!g.icon?g.icon||qa():null,g.type!=="loading"?Va:null):null,Y.createElement("div",{"data-content":"",className:un(D?.content,g==null||(f=g.classNames)==null?void 0:f.content)},Y.createElement("div",{"data-title":"",className:un(D?.title,g==null||(m=g.classNames)==null?void 0:m.title)},g.jsx?g.jsx:typeof g.title=="function"?g.title():g.title),g.description?Y.createElement("div",{"data-description":"",className:un(fe,Nr,D?.description,g==null||(h=g.classNames)==null?void 0:h.description)},typeof g.description=="function"?g.description():g.description):null),Y.isValidElement(g.cancel)?g.cancel:g.cancel&&nr(g.cancel)?Y.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||ve,onClick:ie=>{nr(g.cancel)&&_n&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,ie),nn())},className:un(D?.cancelButton,g==null||(b=g.classNames)==null?void 0:b.cancelButton)},g.cancel.label):null,Y.isValidElement(g.action)?g.action:g.action&&nr(g.action)?Y.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||ae,onClick:ie=>{nr(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,ie),!ie.defaultPrevented&&nn())},className:un(D?.actionButton,g==null||(v=g.classNames)==null?void 0:v.actionButton)},g.action.label):null)};function vm(){if(typeof window>"u"||typeof document>"u")return"ltr";const i=document.documentElement.getAttribute("dir");return i==="auto"||!i?window.getComputedStyle(document.documentElement).direction:i}function N0(i,l){const r={};return[i,l].forEach((o,c)=>{const f=c===1,m=f?"--mobile-offset":"--offset",h=f?b0:y0;function b(v){["top","right","bottom","left"].forEach(x=>{r[`${m}-${x}`]=typeof v=="number"?`${v}px`:v})}typeof o=="number"||typeof o=="string"?b(o):typeof o=="object"?["top","right","bottom","left"].forEach(v=>{o[v]===void 0?r[`${m}-${v}`]=h:r[`${m}-${v}`]=typeof o[v]=="number"?`${o[v]}px`:o[v]}):b(h)}),r}const D0=Y.forwardRef(function(l,r){const{id:o,invert:c,position:f="bottom-right",hotkey:m=["altKey","KeyT"],expand:h,closeButton:b,className:v,offset:x,mobileOffset:g,theme:A="light",richColors:z,duration:j,style:B,visibleToasts:K=v0,toastOptions:U,dir:Q=vm(),gap:Z=x0,icons:I,containerAriaLabel:ee="Notifications"}=l,[J,X]=Y.useState([]),ve=Y.useMemo(()=>o?J.filter(q=>q.toasterId===o):J.filter(q=>!q.toasterId),[J,o]),ae=Y.useMemo(()=>Array.from(new Set([f].concat(ve.filter(q=>q.position).map(q=>q.position)))),[ve,f]),[te,fe]=Y.useState([]),[re,Ee]=Y.useState(!1),[Te,je]=Y.useState(!1),[D,V]=Y.useState(A!=="system"?A:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),$=Y.useRef(null),de=m.join("+").replace(/Key/g,"").replace(/Digit/g,""),oe=Y.useRef(null),me=Y.useRef(!1),_=Y.useCallback(q=>{X(G=>{var k;return(k=G.find(le=>le.id===q.id))!=null&&k.delete||Ct.dismiss(q.id),G.filter(({id:le})=>le!==q.id)})},[]);return Y.useEffect(()=>Ct.subscribe(q=>{if(q.dismiss){requestAnimationFrame(()=>{X(G=>G.map(k=>k.id===q.id?{...k,delete:!0}:k))});return}setTimeout(()=>{ig.flushSync(()=>{X(G=>{const k=G.findIndex(le=>le.id===q.id);return k!==-1?[...G.slice(0,k),{...G[k],...q},...G.slice(k+1)]:[q,...G]})})})}),[J]),Y.useEffect(()=>{if(A!=="system"){V(A);return}if(A==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window>"u")return;const q=window.matchMedia("(prefers-color-scheme: dark)");try{q.addEventListener("change",({matches:G})=>{V(G?"dark":"light")})}catch{q.addListener(({matches:k})=>{try{V(k?"dark":"light")}catch(le){console.error(le)}})}},[A]),Y.useEffect(()=>{J.length<=1&&Ee(!1)},[J]),Y.useEffect(()=>{const q=G=>{var k;if(m.every(ue=>G[ue]||G.code===ue)){var Se;Ee(!0),(Se=$.current)==null||Se.focus()}G.code==="Escape"&&(document.activeElement===$.current||(k=$.current)!=null&&k.contains(document.activeElement))&&Ee(!1)};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[m]),Y.useEffect(()=>{if($.current)return()=>{oe.current&&(oe.current.focus({preventScroll:!0}),oe.current=null,me.current=!1)}},[$.current]),Y.createElement("section",{ref:r,"aria-label":`${ee} ${de}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},ae.map((q,G)=>{var k;const[le,Se]=q.split("-");return ve.length?Y.createElement("ol",{key:q,dir:Q==="auto"?vm():Q,tabIndex:-1,ref:$,className:v,"data-sonner-toaster":!0,"data-sonner-theme":D,"data-y-position":le,"data-x-position":Se,style:{"--front-toast-height":`${((k=te[0])==null?void 0:k.height)||0}px`,"--width":`${S0}px`,"--gap":`${Z}px`,...B,...N0(x,g)},onBlur:ue=>{me.current&&!ue.currentTarget.contains(ue.relatedTarget)&&(me.current=!1,oe.current&&(oe.current.focus({preventScroll:!0}),oe.current=null))},onFocus:ue=>{ue.target instanceof HTMLElement&&ue.target.dataset.dismissible==="false"||me.current||(me.current=!0,oe.current=ue.relatedTarget)},onMouseEnter:()=>Ee(!0),onMouseMove:()=>Ee(!0),onMouseLeave:()=>{Te||Ee(!1)},onDragEnd:()=>Ee(!1),onPointerDown:ue=>{ue.target instanceof HTMLElement&&ue.target.dataset.dismissible==="false"||je(!0)},onPointerUp:()=>je(!1)},ve.filter(ue=>!ue.position&&G===0||ue.position===q).map((ue,De)=>{var Dt,dn;return Y.createElement(C0,{key:ue.id,icons:I,index:De,toast:ue,defaultRichColors:z,duration:(Dt=U?.duration)!=null?Dt:j,className:U?.className,descriptionClassName:U?.descriptionClassName,invert:c,visibleToasts:K,closeButton:(dn=U?.closeButton)!=null?dn:b,interacting:Te,position:q,style:U?.style,unstyled:U?.unstyled,classNames:U?.classNames,cancelButtonStyle:U?.cancelButtonStyle,actionButtonStyle:U?.actionButtonStyle,closeButtonAriaLabel:U?.closeButtonAriaLabel,removeToast:_,toasts:ve.filter(tn=>tn.position==ue.position),heights:te.filter(tn=>tn.position==ue.position),setHeights:fe,expandByDefault:h,gap:Z,expanded:re,swipeDirections:l.swipeDirections})})):null}))}),A0="modulepreload",w0=function(i){return"/"+i},ym={},Nt=function(l,r,o){let c=Promise.resolve();if(r&&r.length>0){let b=function(v){return Promise.all(v.map(x=>Promise.resolve(x).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),h=m?.nonce||m?.getAttribute("nonce");c=b(r.map(v=>{if(v=w0(v),v in ym)return;ym[v]=!0;const x=v.endsWith(".css"),g=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${g}`))return;const A=document.createElement("link");if(A.rel=x?"stylesheet":A0,x||(A.as="script"),A.crossOrigin="",A.href=v,h&&A.setAttribute("nonce",h),document.head.appendChild(A),x)return new Promise((z,j)=>{A.addEventListener("load",z),A.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${v}`)))})}))}function f(m){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=m,window.dispatchEvent(h),!h.defaultPrevented)throw m}return c.then(m=>{for(const h of m||[])h.status==="rejected"&&f(h.reason);return l().catch(f)})};function ji(...i){return Zy(Fy(i))}const bm=i=>{let l;const r=new Set,o=(v,x)=>{const g=typeof v=="function"?v(l):v;if(!Object.is(g,l)){const A=l;l=x??(typeof g!="object"||g===null)?g:Object.assign({},l,g),r.forEach(z=>z(l,A))}},c=()=>l,h={setState:o,getState:c,getInitialState:()=>b,subscribe:v=>(r.add(v),()=>r.delete(v))},b=l=i(o,c,h);return h},R0=(i=>i?bm(i):bm),z0=i=>i;function M0(i,l=z0){const r=Y.useSyncExternalStore(i.subscribe,Y.useCallback(()=>l(i.getState()),[i,l]),Y.useCallback(()=>l(i.getInitialState()),[i,l]));return Y.useDebugValue(r),r}const Sm=i=>{const l=R0(i),r=o=>M0(l,o);return Object.assign(r,l),r},_0=(i=>i?Sm(i):Sm);function bg(){if(typeof window>"u")return"system";const i=localStorage.getItem("nm-theme");return i==="light"||i==="dark"||i==="system"?i:"system"}function hr(i){const l=document.documentElement,r=i==="dark"||i==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches;l.classList.toggle("dark",r),localStorage.setItem("nm-theme",i)}hr(bg());const br=_0((i,l)=>({sidebarOpen:!0,theme:bg(),toggleSidebar:()=>i(r=>({sidebarOpen:!r.sidebarOpen})),setSidebarOpen:r=>i({sidebarOpen:r}),setTheme:r=>{hr(r),i({theme:r})},cycleTheme:()=>{const r=["light","dark","system"],o=l().theme,c=r[(r.indexOf(o)+1)%r.length];hr(c),i({theme:c})}}));typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{const{theme:i}=br.getState();i==="system"&&hr("system")});const se=i=>typeof i=="string",Ri=()=>{let i,l;const r=new Promise((o,c)=>{i=o,l=c});return r.resolve=i,r.reject=l,r},xm=i=>i==null?"":""+i,j0=(i,l,r)=>{i.forEach(o=>{l[o]&&(r[o]=l[o])})},L0=/###/g,Em=i=>i&&i.indexOf("###")>-1?i.replace(L0,"."):i,Tm=i=>!i||se(i),Mi=(i,l,r)=>{const o=se(l)?l.split("."):l;let c=0;for(;c{const{obj:o,k:c}=Mi(i,l,Object);if(o!==void 0||l.length===1){o[c]=r;return}let f=l[l.length-1],m=l.slice(0,l.length-1),h=Mi(i,m,Object);for(;h.obj===void 0&&m.length;)f=`${m[m.length-1]}.${f}`,m=m.slice(0,m.length-1),h=Mi(i,m,Object),h?.obj&&typeof h.obj[`${h.k}.${f}`]<"u"&&(h.obj=void 0);h.obj[`${h.k}.${f}`]=r},U0=(i,l,r,o)=>{const{obj:c,k:f}=Mi(i,l,Object);c[f]=c[f]||[],c[f].push(r)},mr=(i,l)=>{const{obj:r,k:o}=Mi(i,l);if(r&&Object.prototype.hasOwnProperty.call(r,o))return r[o]},B0=(i,l,r)=>{const o=mr(i,r);return o!==void 0?o:mr(l,r)},Sg=(i,l,r)=>{for(const o in l)o!=="__proto__"&&o!=="constructor"&&(o in i?se(i[o])||i[o]instanceof String||se(l[o])||l[o]instanceof String?r&&(i[o]=l[o]):Sg(i[o],l[o],r):i[o]=l[o]);return i},_a=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var H0={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const q0=i=>se(i)?i.replace(/[&<>"'\/]/g,l=>H0[l]):i;class V0{constructor(l){this.capacity=l,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(l){const r=this.regExpMap.get(l);if(r!==void 0)return r;const o=new RegExp(l);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(l,o),this.regExpQueue.push(l),o}}const Y0=[" ",",","?","!",";"],k0=new V0(20),K0=(i,l,r)=>{l=l||"",r=r||"";const o=Y0.filter(m=>l.indexOf(m)<0&&r.indexOf(m)<0);if(o.length===0)return!0;const c=k0.getRegExp(`(${o.map(m=>m==="?"?"\\?":m).join("|")})`);let f=!c.test(i);if(!f){const m=i.indexOf(r);m>0&&!c.test(i.substring(0,m))&&(f=!0)}return f},nc=(i,l,r=".")=>{if(!i)return;if(i[l])return Object.prototype.hasOwnProperty.call(i,l)?i[l]:void 0;const o=l.split(r);let c=i;for(let f=0;f-1&&bi?.replace("_","-"),G0={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,l){console?.[i]?.apply?.(console,l)}};class gr{constructor(l,r={}){this.init(l,r)}init(l,r={}){this.prefix=r.prefix||"i18next:",this.logger=l||G0,this.options=r,this.debug=r.debug}log(...l){return this.forward(l,"log","",!0)}warn(...l){return this.forward(l,"warn","",!0)}error(...l){return this.forward(l,"error","")}deprecate(...l){return this.forward(l,"warn","WARNING DEPRECATED: ",!0)}forward(l,r,o,c){return c&&!this.debug?null:(se(l[0])&&(l[0]=`${o}${this.prefix} ${l[0]}`),this.logger[r](l))}create(l){return new gr(this.logger,{prefix:`${this.prefix}:${l}:`,...this.options})}clone(l){return l=l||this.options,l.prefix=l.prefix||this.prefix,new gr(this.logger,l)}}var fn=new gr;class Sr{constructor(){this.observers={}}on(l,r){return l.split(" ").forEach(o=>{this.observers[o]||(this.observers[o]=new Map);const c=this.observers[o].get(r)||0;this.observers[o].set(r,c+1)}),this}off(l,r){if(this.observers[l]){if(!r){delete this.observers[l];return}this.observers[l].delete(r)}}emit(l,...r){this.observers[l]&&Array.from(this.observers[l].entries()).forEach(([c,f])=>{for(let m=0;m{for(let m=0;m-1&&this.options.ns.splice(r,1)}getResource(l,r,o,c={}){const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,m=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let h;l.indexOf(".")>-1?h=l.split("."):(h=[l,r],o&&(Array.isArray(o)?h.push(...o):se(o)&&f?h.push(...o.split(f)):h.push(o)));const b=mr(this.data,h);return!b&&!r&&!o&&l.indexOf(".")>-1&&(l=h[0],r=h[1],o=h.slice(2).join(".")),b||!m||!se(o)?b:nc(this.data?.[l]?.[r],o,f)}addResource(l,r,o,c,f={silent:!1}){const m=f.keySeparator!==void 0?f.keySeparator:this.options.keySeparator;let h=[l,r];o&&(h=h.concat(m?o.split(m):o)),l.indexOf(".")>-1&&(h=l.split("."),c=r,r=h[1]),this.addNamespaces(r),Om(this.data,h,c),f.silent||this.emit("added",l,r,o,c)}addResources(l,r,o,c={silent:!1}){for(const f in o)(se(o[f])||Array.isArray(o[f]))&&this.addResource(l,r,f,o[f],{silent:!0});c.silent||this.emit("added",l,r,o)}addResourceBundle(l,r,o,c,f,m={silent:!1,skipCopy:!1}){let h=[l,r];l.indexOf(".")>-1&&(h=l.split("."),c=o,o=r,r=h[1]),this.addNamespaces(r);let b=mr(this.data,h)||{};m.skipCopy||(o=JSON.parse(JSON.stringify(o))),c?Sg(b,o,f):b={...b,...o},Om(this.data,h,b),m.silent||this.emit("added",l,r,o)}removeResourceBundle(l,r){this.hasResourceBundle(l,r)&&delete this.data[l][r],this.removeNamespaces(r),this.emit("removed",l,r)}hasResourceBundle(l,r){return this.getResource(l,r)!==void 0}getResourceBundle(l,r){return r||(r=this.options.defaultNS),this.getResource(l,r)}getDataByLanguage(l){return this.data[l]}hasLanguageSomeTranslations(l){const r=this.getDataByLanguage(l);return!!(r&&Object.keys(r)||[]).find(c=>r[c]&&Object.keys(r[c]).length>0)}toJSON(){return this.data}}var xg={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,l,r,o,c){return i.forEach(f=>{l=this.processors[f]?.process(l,r,o,c)??l}),l}};const Eg=Symbol("i18next/PATH_KEY");function Q0(){const i=[],l=Object.create(null);let r;return l.get=(o,c)=>(r?.revoke?.(),c===Eg?i:(i.push(c),r=Proxy.revocable(o,l),r.proxy)),Proxy.revocable(Object.create(null),l).proxy}function ac(i,l){const{[Eg]:r}=i(Q0());return r.join(l?.keySeparator??".")}const Nm={},ku=i=>!se(i)&&typeof i!="boolean"&&typeof i!="number";class pr extends Sr{constructor(l,r={}){super(),j0(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],l,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=fn.create("translator")}changeLanguage(l){l&&(this.language=l)}exists(l,r={interpolation:{}}){const o={...r};if(l==null)return!1;const c=this.resolve(l,o);if(c?.res===void 0)return!1;const f=ku(c.res);return!(o.returnObjects===!1&&f)}extractFromKey(l,r){let o=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");const c=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let f=r.ns||this.options.defaultNS||[];const m=o&&l.indexOf(o)>-1,h=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!K0(l,o,c);if(m&&!h){const b=l.match(this.interpolator.nestingRegexp);if(b&&b.length>0)return{key:l,namespaces:se(f)?[f]:f};const v=l.split(o);(o!==c||o===c&&this.options.ns.indexOf(v[0])>-1)&&(f=v.shift()),l=v.join(c)}return{key:l,namespaces:se(f)?[f]:f}}translate(l,r,o){let c=typeof r=="object"?{...r}:r;if(typeof c!="object"&&this.options.overloadTranslationOptionHandler&&(c=this.options.overloadTranslationOptionHandler(arguments)),typeof c=="object"&&(c={...c}),c||(c={}),l==null)return"";typeof l=="function"&&(l=ac(l,{...this.options,...c})),Array.isArray(l)||(l=[String(l)]);const f=c.returnDetails!==void 0?c.returnDetails:this.options.returnDetails,m=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,{key:h,namespaces:b}=this.extractFromKey(l[l.length-1],c),v=b[b.length-1];let x=c.nsSeparator!==void 0?c.nsSeparator:this.options.nsSeparator;x===void 0&&(x=":");const g=c.lng||this.language,A=c.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(g?.toLowerCase()==="cimode")return A?f?{res:`${v}${x}${h}`,usedKey:h,exactUsedKey:h,usedLng:g,usedNS:v,usedParams:this.getUsedParamsDetails(c)}:`${v}${x}${h}`:f?{res:h,usedKey:h,exactUsedKey:h,usedLng:g,usedNS:v,usedParams:this.getUsedParamsDetails(c)}:h;const z=this.resolve(l,c);let j=z?.res;const B=z?.usedKey||h,K=z?.exactUsedKey||h,U=["[object Number]","[object Function]","[object RegExp]"],Q=c.joinArrays!==void 0?c.joinArrays:this.options.joinArrays,Z=!this.i18nFormat||this.i18nFormat.handleAsObject,I=c.count!==void 0&&!se(c.count),ee=pr.hasDefaultValue(c),J=I?this.pluralResolver.getSuffix(g,c.count,c):"",X=c.ordinal&&I?this.pluralResolver.getSuffix(g,c.count,{ordinal:!1}):"",ve=I&&!c.ordinal&&c.count===0,ae=ve&&c[`defaultValue${this.options.pluralSeparator}zero`]||c[`defaultValue${J}`]||c[`defaultValue${X}`]||c.defaultValue;let te=j;Z&&!j&&ee&&(te=ae);const fe=ku(te),re=Object.prototype.toString.apply(te);if(Z&&te&&fe&&U.indexOf(re)<0&&!(se(Q)&&Array.isArray(te))){if(!c.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Ee=this.options.returnedObjectHandler?this.options.returnedObjectHandler(B,te,{...c,ns:b}):`key '${h} (${this.language})' returned an object instead of string.`;return f?(z.res=Ee,z.usedParams=this.getUsedParamsDetails(c),z):Ee}if(m){const Ee=Array.isArray(te),Te=Ee?[]:{},je=Ee?K:B;for(const D in te)if(Object.prototype.hasOwnProperty.call(te,D)){const V=`${je}${m}${D}`;ee&&!j?Te[D]=this.translate(V,{...c,defaultValue:ku(ae)?ae[D]:void 0,joinArrays:!1,ns:b}):Te[D]=this.translate(V,{...c,joinArrays:!1,ns:b}),Te[D]===V&&(Te[D]=te[D])}j=Te}}else if(Z&&se(Q)&&Array.isArray(j))j=j.join(Q),j&&(j=this.extendTranslation(j,l,c,o));else{let Ee=!1,Te=!1;!this.isValidLookup(j)&&ee&&(Ee=!0,j=ae),this.isValidLookup(j)||(Te=!0,j=h);const D=(c.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Te?void 0:j,V=ee&&ae!==j&&this.options.updateMissing;if(Te||Ee||V){if(this.logger.log(V?"updateKey":"missingKey",g,v,h,V?ae:j),m){const me=this.resolve(h,{...c,keySeparator:!1});me&&me.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let $=[];const de=this.languageUtils.getFallbackCodes(this.options.fallbackLng,c.lng||this.language);if(this.options.saveMissingTo==="fallback"&&de&&de[0])for(let me=0;me{const G=ee&&q!==j?q:D;this.options.missingKeyHandler?this.options.missingKeyHandler(me,v,_,G,V,c):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(me,v,_,G,V,c),this.emit("missingKey",me,v,_,j)};this.options.saveMissing&&(this.options.saveMissingPlurals&&I?$.forEach(me=>{const _=this.pluralResolver.getSuffixes(me,c);ve&&c[`defaultValue${this.options.pluralSeparator}zero`]&&_.indexOf(`${this.options.pluralSeparator}zero`)<0&&_.push(`${this.options.pluralSeparator}zero`),_.forEach(q=>{oe([me],h+q,c[`defaultValue${q}`]||ae)})}):oe($,h,ae))}j=this.extendTranslation(j,l,c,z,o),Te&&j===h&&this.options.appendNamespaceToMissingKey&&(j=`${v}${x}${h}`),(Te||Ee)&&this.options.parseMissingKeyHandler&&(j=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${v}${x}${h}`:h,Ee?j:void 0,c))}return f?(z.res=j,z.usedParams=this.getUsedParamsDetails(c),z):j}extendTranslation(l,r,o,c,f){if(this.i18nFormat?.parse)l=this.i18nFormat.parse(l,{...this.options.interpolation.defaultVariables,...o},o.lng||this.language||c.usedLng,c.usedNS,c.usedKey,{resolved:c});else if(!o.skipInterpolation){o.interpolation&&this.interpolator.init({...o,interpolation:{...this.options.interpolation,...o.interpolation}});const b=se(l)&&(o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let v;if(b){const g=l.match(this.interpolator.nestingRegexp);v=g&&g.length}let x=o.replace&&!se(o.replace)?o.replace:o;if(this.options.interpolation.defaultVariables&&(x={...this.options.interpolation.defaultVariables,...x}),l=this.interpolator.interpolate(l,x,o.lng||this.language||c.usedLng,o),b){const g=l.match(this.interpolator.nestingRegexp),A=g&&g.length;vf?.[0]===g[0]&&!o.context?(this.logger.warn(`It seems you are nesting recursively key: ${g[0]} in key: ${r[0]}`),null):this.translate(...g,r),o)),o.interpolation&&this.interpolator.reset()}const m=o.postProcess||this.options.postProcess,h=se(m)?[m]:m;return l!=null&&h?.length&&o.applyPostProcessor!==!1&&(l=xg.handle(h,l,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...c,usedParams:this.getUsedParamsDetails(o)},...o}:o,this)),l}resolve(l,r={}){let o,c,f,m,h;return se(l)&&(l=[l]),l.forEach(b=>{if(this.isValidLookup(o))return;const v=this.extractFromKey(b,r),x=v.key;c=x;let g=v.namespaces;this.options.fallbackNS&&(g=g.concat(this.options.fallbackNS));const A=r.count!==void 0&&!se(r.count),z=A&&!r.ordinal&&r.count===0,j=r.context!==void 0&&(se(r.context)||typeof r.context=="number")&&r.context!=="",B=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);g.forEach(K=>{this.isValidLookup(o)||(h=K,!Nm[`${B[0]}-${K}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(h)&&(Nm[`${B[0]}-${K}`]=!0,this.logger.warn(`key "${c}" for languages "${B.join(", ")}" won't get resolved as namespace "${h}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),B.forEach(U=>{if(this.isValidLookup(o))return;m=U;const Q=[x];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(Q,x,U,K,r);else{let I;A&&(I=this.pluralResolver.getSuffix(U,r.count,r));const ee=`${this.options.pluralSeparator}zero`,J=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(A&&(r.ordinal&&I.indexOf(J)===0&&Q.push(x+I.replace(J,this.options.pluralSeparator)),Q.push(x+I),z&&Q.push(x+ee)),j){const X=`${x}${this.options.contextSeparator||"_"}${r.context}`;Q.push(X),A&&(r.ordinal&&I.indexOf(J)===0&&Q.push(X+I.replace(J,this.options.pluralSeparator)),Q.push(X+I),z&&Q.push(X+ee))}}let Z;for(;Z=Q.pop();)this.isValidLookup(o)||(f=Z,o=this.getResource(U,K,Z,r))}))})}),{res:o,usedKey:c,exactUsedKey:f,usedLng:m,usedNS:h}}isValidLookup(l){return l!==void 0&&!(!this.options.returnNull&&l===null)&&!(!this.options.returnEmptyString&&l==="")}getResource(l,r,o,c={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(l,r,o,c):this.resourceStore.getResource(l,r,o,c)}getUsedParamsDetails(l={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],o=l.replace&&!se(l.replace);let c=o?l.replace:l;if(o&&typeof l.count<"u"&&(c.count=l.count),this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),!o){c={...c};for(const f of r)delete c[f]}return c}static hasDefaultValue(l){const r="defaultValue";for(const o in l)if(Object.prototype.hasOwnProperty.call(l,o)&&r===o.substring(0,r.length)&&l[o]!==void 0)return!0;return!1}}class Dm{constructor(l){this.options=l,this.supportedLngs=this.options.supportedLngs||!1,this.logger=fn.create("languageUtils")}getScriptPartFromCode(l){if(l=Li(l),!l||l.indexOf("-")<0)return null;const r=l.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(l){if(l=Li(l),!l||l.indexOf("-")<0)return l;const r=l.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(l){if(se(l)&&l.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(l)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?l.toLowerCase():l)}return this.options.cleanCode||this.options.lowerCaseLng?l.toLowerCase():l}isSupportedCode(l){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(l=this.getLanguagePartFromCode(l)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(l)>-1}getBestMatchFromCodes(l){if(!l)return null;let r;return l.forEach(o=>{if(r)return;const c=this.formatLanguageCode(o);(!this.options.supportedLngs||this.isSupportedCode(c))&&(r=c)}),!r&&this.options.supportedLngs&&l.forEach(o=>{if(r)return;const c=this.getScriptPartFromCode(o);if(this.isSupportedCode(c))return r=c;const f=this.getLanguagePartFromCode(o);if(this.isSupportedCode(f))return r=f;r=this.options.supportedLngs.find(m=>{if(m===f)return m;if(!(m.indexOf("-")<0&&f.indexOf("-")<0)&&(m.indexOf("-")>0&&f.indexOf("-")<0&&m.substring(0,m.indexOf("-"))===f||m.indexOf(f)===0&&f.length>1))return m})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(l,r){if(!l)return[];if(typeof l=="function"&&(l=l(r)),se(l)&&(l=[l]),Array.isArray(l))return l;if(!r)return l.default||[];let o=l[r];return o||(o=l[this.getScriptPartFromCode(r)]),o||(o=l[this.formatLanguageCode(r)]),o||(o=l[this.getLanguagePartFromCode(r)]),o||(o=l.default),o||[]}toResolveHierarchy(l,r){const o=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],l),c=[],f=m=>{m&&(this.isSupportedCode(m)?c.push(m):this.logger.warn(`rejecting language code not found in supportedLngs: ${m}`))};return se(l)&&(l.indexOf("-")>-1||l.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&f(this.formatLanguageCode(l)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&f(this.getScriptPartFromCode(l)),this.options.load!=="currentOnly"&&f(this.getLanguagePartFromCode(l))):se(l)&&f(this.formatLanguageCode(l)),o.forEach(m=>{c.indexOf(m)<0&&f(this.formatLanguageCode(m))}),c}}const Am={zero:0,one:1,two:2,few:3,many:4,other:5},wm={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class X0{constructor(l,r={}){this.languageUtils=l,this.options=r,this.logger=fn.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(l,r={}){const o=Li(l==="dev"?"en":l),c=r.ordinal?"ordinal":"cardinal",f=JSON.stringify({cleanedCode:o,type:c});if(f in this.pluralRulesCache)return this.pluralRulesCache[f];let m;try{m=new Intl.PluralRules(o,{type:c})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),wm;if(!l.match(/-|_/))return wm;const b=this.languageUtils.getLanguagePartFromCode(l);m=this.getRule(b,r)}return this.pluralRulesCache[f]=m,m}needsPlural(l,r={}){let o=this.getRule(l,r);return o||(o=this.getRule("dev",r)),o?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(l,r,o={}){return this.getSuffixes(l,o).map(c=>`${r}${c}`)}getSuffixes(l,r={}){let o=this.getRule(l,r);return o||(o=this.getRule("dev",r)),o?o.resolvedOptions().pluralCategories.sort((c,f)=>Am[c]-Am[f]).map(c=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${c}`):[]}getSuffix(l,r,o={}){const c=this.getRule(l,o);return c?`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${c.select(r)}`:(this.logger.warn(`no plural rule found for: ${l}`),this.getSuffix("dev",r,o))}}const Rm=(i,l,r,o=".",c=!0)=>{let f=B0(i,l,r);return!f&&c&&se(r)&&(f=nc(i,r,o),f===void 0&&(f=nc(l,r,o))),f},Ku=i=>i.replace(/\$/g,"$$$$");class zm{constructor(l={}){this.logger=fn.create("interpolator"),this.options=l,this.format=l?.interpolation?.format||(r=>r),this.init(l)}init(l={}){l.interpolation||(l.interpolation={escapeValue:!0});const{escape:r,escapeValue:o,useRawValueToEscape:c,prefix:f,prefixEscaped:m,suffix:h,suffixEscaped:b,formatSeparator:v,unescapeSuffix:x,unescapePrefix:g,nestingPrefix:A,nestingPrefixEscaped:z,nestingSuffix:j,nestingSuffixEscaped:B,nestingOptionsSeparator:K,maxReplaces:U,alwaysFormat:Q}=l.interpolation;this.escape=r!==void 0?r:q0,this.escapeValue=o!==void 0?o:!0,this.useRawValueToEscape=c!==void 0?c:!1,this.prefix=f?_a(f):m||"{{",this.suffix=h?_a(h):b||"}}",this.formatSeparator=v||",",this.unescapePrefix=x?"":g||"-",this.unescapeSuffix=this.unescapePrefix?"":x||"",this.nestingPrefix=A?_a(A):z||_a("$t("),this.nestingSuffix=j?_a(j):B||_a(")"),this.nestingOptionsSeparator=K||",",this.maxReplaces=U||1e3,this.alwaysFormat=Q!==void 0?Q:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const l=(r,o)=>r?.source===o?(r.lastIndex=0,r):new RegExp(o,"g");this.regexp=l(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=l(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=l(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(l,r,o,c){let f,m,h;const b=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},v=z=>{if(z.indexOf(this.formatSeparator)<0){const U=Rm(r,b,z,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(U,void 0,o,{...c,...r,interpolationkey:z}):U}const j=z.split(this.formatSeparator),B=j.shift().trim(),K=j.join(this.formatSeparator).trim();return this.format(Rm(r,b,B,this.options.keySeparator,this.options.ignoreJSONStructure),K,o,{...c,...r,interpolationkey:B})};this.resetRegExp();const x=c?.missingInterpolationHandler||this.options.missingInterpolationHandler,g=c?.interpolation?.skipOnVariables!==void 0?c.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:z=>Ku(z)},{regex:this.regexp,safeValue:z=>this.escapeValue?Ku(this.escape(z)):Ku(z)}].forEach(z=>{for(h=0;f=z.regex.exec(l);){const j=f[1].trim();if(m=v(j),m===void 0)if(typeof x=="function"){const K=x(l,f,c);m=se(K)?K:""}else if(c&&Object.prototype.hasOwnProperty.call(c,j))m="";else if(g){m=f[0];continue}else this.logger.warn(`missed to pass in variable ${j} for interpolating ${l}`),m="";else!se(m)&&!this.useRawValueToEscape&&(m=xm(m));const B=z.safeValue(m);if(l=l.replace(f[0],B),g?(z.regex.lastIndex+=m.length,z.regex.lastIndex-=f[0].length):z.regex.lastIndex=0,h++,h>=this.maxReplaces)break}}),l}nest(l,r,o={}){let c,f,m;const h=(b,v)=>{const x=this.nestingOptionsSeparator;if(b.indexOf(x)<0)return b;const g=b.split(new RegExp(`${_a(x)}[ ]*{`));let A=`{${g[1]}`;b=g[0],A=this.interpolate(A,m);const z=A.match(/'/g),j=A.match(/"/g);((z?.length??0)%2===0&&!j||(j?.length??0)%2!==0)&&(A=A.replace(/'/g,'"'));try{m=JSON.parse(A),v&&(m={...v,...m})}catch(B){return this.logger.warn(`failed parsing options string in nesting for key ${b}`,B),`${b}${x}${A}`}return m.defaultValue&&m.defaultValue.indexOf(this.prefix)>-1&&delete m.defaultValue,b};for(;c=this.nestingRegexp.exec(l);){let b=[];m={...o},m=m.replace&&!se(m.replace)?m.replace:m,m.applyPostProcessor=!1,delete m.defaultValue;const v=/{.*}/.test(c[1])?c[1].lastIndexOf("}")+1:c[1].indexOf(this.formatSeparator);if(v!==-1&&(b=c[1].slice(v).split(this.formatSeparator).map(x=>x.trim()).filter(Boolean),c[1]=c[1].slice(0,v)),f=r(h.call(this,c[1].trim(),m),m),f&&c[0]===l&&!se(f))return f;se(f)||(f=xm(f)),f||(this.logger.warn(`missed to resolve ${c[1]} for nesting ${l}`),f=""),b.length&&(f=b.reduce((x,g)=>this.format(x,g,o.lng,{...o,interpolationkey:c[1].trim()}),f.trim())),l=l.replace(c[0],f),this.regexp.lastIndex=0}return l}}const Z0=i=>{let l=i.toLowerCase().trim();const r={};if(i.indexOf("(")>-1){const o=i.split("(");l=o[0].toLowerCase().trim();const c=o[1].substring(0,o[1].length-1);l==="currency"&&c.indexOf(":")<0?r.currency||(r.currency=c.trim()):l==="relativetime"&&c.indexOf(":")<0?r.range||(r.range=c.trim()):c.split(";").forEach(m=>{if(m){const[h,...b]=m.split(":"),v=b.join(":").trim().replace(/^'+|'+$/g,""),x=h.trim();r[x]||(r[x]=v),v==="false"&&(r[x]=!1),v==="true"&&(r[x]=!0),isNaN(v)||(r[x]=parseInt(v,10))}})}return{formatName:l,formatOptions:r}},Mm=i=>{const l={};return(r,o,c)=>{let f=c;c&&c.interpolationkey&&c.formatParams&&c.formatParams[c.interpolationkey]&&c[c.interpolationkey]&&(f={...f,[c.interpolationkey]:void 0});const m=o+JSON.stringify(f);let h=l[m];return h||(h=i(Li(o),c),l[m]=h),h(r)}},F0=i=>(l,r,o)=>i(Li(r),o)(l);class J0{constructor(l={}){this.logger=fn.create("formatter"),this.options=l,this.init(l)}init(l,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const o=r.cacheInBuiltFormats?Mm:F0;this.formats={number:o((c,f)=>{const m=new Intl.NumberFormat(c,{...f});return h=>m.format(h)}),currency:o((c,f)=>{const m=new Intl.NumberFormat(c,{...f,style:"currency"});return h=>m.format(h)}),datetime:o((c,f)=>{const m=new Intl.DateTimeFormat(c,{...f});return h=>m.format(h)}),relativetime:o((c,f)=>{const m=new Intl.RelativeTimeFormat(c,{...f});return h=>m.format(h,f.range||"day")}),list:o((c,f)=>{const m=new Intl.ListFormat(c,{...f});return h=>m.format(h)})}}add(l,r){this.formats[l.toLowerCase().trim()]=r}addCached(l,r){this.formats[l.toLowerCase().trim()]=Mm(r)}format(l,r,o,c={}){const f=r.split(this.formatSeparator);if(f.length>1&&f[0].indexOf("(")>1&&f[0].indexOf(")")<0&&f.find(h=>h.indexOf(")")>-1)){const h=f.findIndex(b=>b.indexOf(")")>-1);f[0]=[f[0],...f.splice(1,h)].join(this.formatSeparator)}return f.reduce((h,b)=>{const{formatName:v,formatOptions:x}=Z0(b);if(this.formats[v]){let g=h;try{const A=c?.formatParams?.[c.interpolationkey]||{},z=A.locale||A.lng||c.locale||c.lng||o;g=this.formats[v](h,z,{...x,...c,...A})}catch(A){this.logger.warn(A)}return g}else this.logger.warn(`there was no format function for ${v}`);return h},l)}}const $0=(i,l)=>{i.pending[l]!==void 0&&(delete i.pending[l],i.pendingCount--)};class W0 extends Sr{constructor(l,r,o,c={}){super(),this.backend=l,this.store=r,this.services=o,this.languageUtils=o.languageUtils,this.options=c,this.logger=fn.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=c.maxParallelReads||10,this.readingCalls=0,this.maxRetries=c.maxRetries>=0?c.maxRetries:5,this.retryTimeout=c.retryTimeout>=1?c.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(o,c.backend,c)}queueLoad(l,r,o,c){const f={},m={},h={},b={};return l.forEach(v=>{let x=!0;r.forEach(g=>{const A=`${v}|${g}`;!o.reload&&this.store.hasResourceBundle(v,g)?this.state[A]=2:this.state[A]<0||(this.state[A]===1?m[A]===void 0&&(m[A]=!0):(this.state[A]=1,x=!1,m[A]===void 0&&(m[A]=!0),f[A]===void 0&&(f[A]=!0),b[g]===void 0&&(b[g]=!0)))}),x||(h[v]=!0)}),(Object.keys(f).length||Object.keys(m).length)&&this.queue.push({pending:m,pendingCount:Object.keys(m).length,loaded:{},errors:[],callback:c}),{toLoad:Object.keys(f),pending:Object.keys(m),toLoadLanguages:Object.keys(h),toLoadNamespaces:Object.keys(b)}}loaded(l,r,o){const c=l.split("|"),f=c[0],m=c[1];r&&this.emit("failedLoading",f,m,r),!r&&o&&this.store.addResourceBundle(f,m,o,void 0,void 0,{skipCopy:!0}),this.state[l]=r?-1:2,r&&o&&(this.state[l]=0);const h={};this.queue.forEach(b=>{U0(b.loaded,[f],m),$0(b,l),r&&b.errors.push(r),b.pendingCount===0&&!b.done&&(Object.keys(b.loaded).forEach(v=>{h[v]||(h[v]={});const x=b.loaded[v];x.length&&x.forEach(g=>{h[v][g]===void 0&&(h[v][g]=!0)})}),b.done=!0,b.errors.length?b.callback(b.errors):b.callback())}),this.emit("loaded",h),this.queue=this.queue.filter(b=>!b.done)}read(l,r,o,c=0,f=this.retryTimeout,m){if(!l.length)return m(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:l,ns:r,fcName:o,tried:c,wait:f,callback:m});return}this.readingCalls++;const h=(v,x)=>{if(this.readingCalls--,this.waitingReads.length>0){const g=this.waitingReads.shift();this.read(g.lng,g.ns,g.fcName,g.tried,g.wait,g.callback)}if(v&&x&&c{this.read.call(this,l,r,o,c+1,f*2,m)},f);return}m(v,x)},b=this.backend[o].bind(this.backend);if(b.length===2){try{const v=b(l,r);v&&typeof v.then=="function"?v.then(x=>h(null,x)).catch(h):h(null,v)}catch(v){h(v)}return}return b(l,r,h)}prepareLoading(l,r,o={},c){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),c&&c();se(l)&&(l=this.languageUtils.toResolveHierarchy(l)),se(r)&&(r=[r]);const f=this.queueLoad(l,r,o,c);if(!f.toLoad.length)return f.pending.length||c(),null;f.toLoad.forEach(m=>{this.loadOne(m)})}load(l,r,o){this.prepareLoading(l,r,{},o)}reload(l,r,o){this.prepareLoading(l,r,{reload:!0},o)}loadOne(l,r=""){const o=l.split("|"),c=o[0],f=o[1];this.read(c,f,"read",void 0,void 0,(m,h)=>{m&&this.logger.warn(`${r}loading namespace ${f} for language ${c} failed`,m),!m&&h&&this.logger.log(`${r}loaded namespace ${f} for language ${c}`,h),this.loaded(l,m,h)})}saveMissing(l,r,o,c,f,m={},h=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${o}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend?.create){const b={...m,isUpdate:f},v=this.backend.create.bind(this.backend);if(v.length<6)try{let x;v.length===5?x=v(l,r,o,c,b):x=v(l,r,o,c),x&&typeof x.then=="function"?x.then(g=>h(null,g)).catch(h):h(null,x)}catch(x){h(x)}else v(l,r,o,c,h,b)}!l||!l[0]||this.store.addResource(l[0],r,o,c)}}}const Gu=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let l={};if(typeof i[1]=="object"&&(l=i[1]),se(i[1])&&(l.defaultValue=i[1]),se(i[2])&&(l.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const r=i[3]||i[2];Object.keys(r).forEach(o=>{l[o]=r[o]})}return l},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),_m=i=>(se(i.ns)&&(i.ns=[i.ns]),se(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),se(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),i.supportedLngs?.indexOf?.("cimode")<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),typeof i.initImmediate=="boolean"&&(i.initAsync=i.initImmediate),i),ar=()=>{},I0=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(r=>{typeof i[r]=="function"&&(i[r]=i[r].bind(i))})},Tg="__i18next_supportNoticeShown",P0=()=>typeof globalThis<"u"&&!!globalThis[Tg],eb=()=>{typeof globalThis<"u"&&(globalThis[Tg]=!0)},tb=i=>!!(i?.modules?.backend?.name?.indexOf("Locize")>0||i?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||i?.options?.backend?.backends&&i.options.backend.backends.some(l=>l?.name?.indexOf("Locize")>0||l?.constructor?.name?.indexOf("Locize")>0)||i?.options?.backend?.projectId||i?.options?.backend?.backendOptions&&i.options.backend.backendOptions.some(l=>l?.projectId));class _i extends Sr{constructor(l={},r){if(super(),this.options=_m(l),this.services={},this.logger=fn,this.modules={external:[]},I0(this),r&&!this.isInitialized&&!l.isClone){if(!this.options.initAsync)return this.init(l,r),this;setTimeout(()=>{this.init(l,r)},0)}}init(l={},r){this.isInitializing=!0,typeof l=="function"&&(r=l,l={}),l.defaultNS==null&&l.ns&&(se(l.ns)?l.defaultNS=l.ns:l.ns.indexOf("translation")<0&&(l.defaultNS=l.ns[0]));const o=Gu();this.options={...o,...this.options,..._m(l)},this.options.interpolation={...o.interpolation,...this.options.interpolation},l.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=l.keySeparator),l.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=l.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=o.overloadTranslationOptionHandler),this.options.showSupportNotice!==!1&&!tb(this)&&!P0()&&(typeof console<"u"&&typeof console.info<"u"&&console.info("🌐 i18next is maintained with support from Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"),eb());const c=v=>v?typeof v=="function"?new v:v:null;if(!this.options.isClone){this.modules.logger?fn.init(c(this.modules.logger),this.options):fn.init(null,this.options);let v;this.modules.formatter?v=this.modules.formatter:v=J0;const x=new Dm(this.options);this.store=new Cm(this.options.resources,this.options);const g=this.services;g.logger=fn,g.resourceStore=this.store,g.languageUtils=x,g.pluralResolver=new X0(x,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),v&&(!this.options.interpolation.format||this.options.interpolation.format===o.interpolation.format)&&(g.formatter=c(v),g.formatter.init&&g.formatter.init(g,this.options),this.options.interpolation.format=g.formatter.format.bind(g.formatter)),g.interpolator=new zm(this.options),g.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},g.backendConnector=new W0(c(this.modules.backend),g.resourceStore,g,this.options),g.backendConnector.on("*",(z,...j)=>{this.emit(z,...j)}),this.modules.languageDetector&&(g.languageDetector=c(this.modules.languageDetector),g.languageDetector.init&&g.languageDetector.init(g,this.options.detection,this.options)),this.modules.i18nFormat&&(g.i18nFormat=c(this.modules.i18nFormat),g.i18nFormat.init&&g.i18nFormat.init(this)),this.translator=new pr(this.services,this.options),this.translator.on("*",(z,...j)=>{this.emit(z,...j)}),this.modules.external.forEach(z=>{z.init&&z.init(this)})}if(this.format=this.options.interpolation.format,r||(r=ar),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const v=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);v.length>0&&v[0]!=="dev"&&(this.options.lng=v[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(v=>{this[v]=(...x)=>this.store[v](...x)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(v=>{this[v]=(...x)=>(this.store[v](...x),this)});const h=Ri(),b=()=>{const v=(x,g)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),h.resolve(g),r(x,g)};if(this.languages&&!this.isInitialized)return v(null,this.t.bind(this));this.changeLanguage(this.options.lng,v)};return this.options.resources||!this.options.initAsync?b():setTimeout(b,0),h}loadResources(l,r=ar){let o=r;const c=se(l)?l:this.language;if(typeof l=="function"&&(o=l),!this.options.resources||this.options.partialBundledLanguages){if(c?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return o();const f=[],m=h=>{if(!h||h==="cimode")return;this.services.languageUtils.toResolveHierarchy(h).forEach(v=>{v!=="cimode"&&f.indexOf(v)<0&&f.push(v)})};c?m(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(b=>m(b)),this.options.preload?.forEach?.(h=>m(h)),this.services.backendConnector.load(f,this.options.ns,h=>{!h&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),o(h)})}else o(null)}reloadResources(l,r,o){const c=Ri();return typeof l=="function"&&(o=l,l=void 0),typeof r=="function"&&(o=r,r=void 0),l||(l=this.languages),r||(r=this.options.ns),o||(o=ar),this.services.backendConnector.reload(l,r,f=>{c.resolve(),o(f)}),c}use(l){if(!l)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!l.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return l.type==="backend"&&(this.modules.backend=l),(l.type==="logger"||l.log&&l.warn&&l.error)&&(this.modules.logger=l),l.type==="languageDetector"&&(this.modules.languageDetector=l),l.type==="i18nFormat"&&(this.modules.i18nFormat=l),l.type==="postProcessor"&&xg.addPostProcessor(l),l.type==="formatter"&&(this.modules.formatter=l),l.type==="3rdParty"&&this.modules.external.push(l),this}setResolvedLanguage(l){if(!(!l||!this.languages)&&!(["cimode","dev"].indexOf(l)>-1)){for(let r=0;r-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}!this.resolvedLanguage&&this.languages.indexOf(l)<0&&this.store.hasLanguageSomeTranslations(l)&&(this.resolvedLanguage=l,this.languages.unshift(l))}}changeLanguage(l,r){this.isLanguageChangingTo=l;const o=Ri();this.emit("languageChanging",l);const c=h=>{this.language=h,this.languages=this.services.languageUtils.toResolveHierarchy(h),this.resolvedLanguage=void 0,this.setResolvedLanguage(h)},f=(h,b)=>{b?this.isLanguageChangingTo===l&&(c(b),this.translator.changeLanguage(b),this.isLanguageChangingTo=void 0,this.emit("languageChanged",b),this.logger.log("languageChanged",b)):this.isLanguageChangingTo=void 0,o.resolve((...v)=>this.t(...v)),r&&r(h,(...v)=>this.t(...v))},m=h=>{!l&&!h&&this.services.languageDetector&&(h=[]);const b=se(h)?h:h&&h[0],v=this.store.hasLanguageSomeTranslations(b)?b:this.services.languageUtils.getBestMatchFromCodes(se(h)?[h]:h);v&&(this.language||c(v),this.translator.language||this.translator.changeLanguage(v),this.services.languageDetector?.cacheUserLanguage?.(v)),this.loadResources(v,x=>{f(x,v)})};return!l&&this.services.languageDetector&&!this.services.languageDetector.async?m(this.services.languageDetector.detect()):!l&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(m):this.services.languageDetector.detect(m):m(l),o}getFixedT(l,r,o){const c=(f,m,...h)=>{let b;typeof m!="object"?b=this.options.overloadTranslationOptionHandler([f,m].concat(h)):b={...m},b.lng=b.lng||c.lng,b.lngs=b.lngs||c.lngs,b.ns=b.ns||c.ns,b.keyPrefix!==""&&(b.keyPrefix=b.keyPrefix||o||c.keyPrefix);const v=this.options.keySeparator||".";let x;return b.keyPrefix&&Array.isArray(f)?x=f.map(g=>(typeof g=="function"&&(g=ac(g,{...this.options,...m})),`${b.keyPrefix}${v}${g}`)):(typeof f=="function"&&(f=ac(f,{...this.options,...m})),x=b.keyPrefix?`${b.keyPrefix}${v}${f}`:f),this.t(x,b)};return se(l)?c.lng=l:c.lngs=l,c.ns=r,c.keyPrefix=o,c}t(...l){return this.translator?.translate(...l)}exists(...l){return this.translator?.exists(...l)}setDefaultNamespace(l){this.options.defaultNS=l}hasLoadedNamespace(l,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const o=r.lng||this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,f=this.languages[this.languages.length-1];if(o.toLowerCase()==="cimode")return!0;const m=(h,b)=>{const v=this.services.backendConnector.state[`${h}|${b}`];return v===-1||v===0||v===2};if(r.precheck){const h=r.precheck(this,m);if(h!==void 0)return h}return!!(this.hasResourceBundle(o,l)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||m(o,l)&&(!c||m(f,l)))}loadNamespaces(l,r){const o=Ri();return this.options.ns?(se(l)&&(l=[l]),l.forEach(c=>{this.options.ns.indexOf(c)<0&&this.options.ns.push(c)}),this.loadResources(c=>{o.resolve(),r&&r(c)}),o):(r&&r(),Promise.resolve())}loadLanguages(l,r){const o=Ri();se(l)&&(l=[l]);const c=this.options.preload||[],f=l.filter(m=>c.indexOf(m)<0&&this.services.languageUtils.isSupportedCode(m));return f.length?(this.options.preload=c.concat(f),this.loadResources(m=>{o.resolve(),r&&r(m)}),o):(r&&r(),Promise.resolve())}dir(l){if(l||(l=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!l)return"rtl";try{const c=new Intl.Locale(l);if(c&&c.getTextInfo){const f=c.getTextInfo();if(f&&f.direction)return f.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services?.languageUtils||new Dm(Gu());return l.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(o.getLanguagePartFromCode(l))>-1||l.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(l={},r){const o=new _i(l,r);return o.createInstance=_i.createInstance,o}cloneInstance(l={},r=ar){const o=l.forkResourceStore;o&&delete l.forkResourceStore;const c={...this.options,...l,isClone:!0},f=new _i(c);if((l.debug!==void 0||l.prefix!==void 0)&&(f.logger=f.logger.clone(l)),["store","services","language"].forEach(h=>{f[h]=this[h]}),f.services={...this.services},f.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},o){const h=Object.keys(this.store.data).reduce((b,v)=>(b[v]={...this.store.data[v]},b[v]=Object.keys(b[v]).reduce((x,g)=>(x[g]={...b[v][g]},x),b[v]),b),{});f.store=new Cm(h,c),f.services.resourceStore=f.store}if(l.interpolation){const b={...Gu().interpolation,...this.options.interpolation,...l.interpolation},v={...c,interpolation:b};f.services.interpolator=new zm(v)}return f.translator=new pr(f.services,c),f.translator.on("*",(h,...b)=>{f.emit(h,...b)}),f.init(c,r),f.translator.options=c,f.translator.backendConnector.services.utils={hasLoadedNamespace:f.hasLoadedNamespace.bind(f)},f}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ht=_i.createInstance();ht.createInstance;ht.dir;ht.init;ht.loadResources;ht.reloadResources;ht.use;ht.changeLanguage;ht.getFixedT;ht.t;ht.exists;ht.setDefaultNamespace;ht.hasLoadedNamespace;ht.loadNamespaces;ht.loadLanguages;const nb=(i,l,r,o)=>{const c=[r,{code:l,...o||{}}];if(i?.services?.logger?.forward)return i.services.logger.forward(c,"warn","react-i18next::",!0);ja(c[0])&&(c[0]=`react-i18next:: ${c[0]}`),i?.services?.logger?.warn?i.services.logger.warn(...c):console?.warn&&console.warn(...c)},jm={},Og=(i,l,r,o)=>{ja(r)&&jm[r]||(ja(r)&&(jm[r]=new Date),nb(i,l,r,o))},Cg=(i,l)=>()=>{if(i.isInitialized)l();else{const r=()=>{setTimeout(()=>{i.off("initialized",r)},0),l()};i.on("initialized",r)}},lc=(i,l,r)=>{i.loadNamespaces(l,Cg(i,r))},Lm=(i,l,r,o)=>{if(ja(r)&&(r=[r]),i.options.preload&&i.options.preload.indexOf(l)>-1)return lc(i,r,o);r.forEach(c=>{i.options.ns.indexOf(c)<0&&i.options.ns.push(c)}),i.loadLanguages(l,Cg(i,o))},ab=(i,l,r={})=>!l.languages||!l.languages.length?(Og(l,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:l.languages}),!0):l.hasLoadedNamespace(i,{lng:r.lng,precheck:(o,c)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&o.services.backendConnector.backend&&o.isLanguageChangingTo&&!c(o.isLanguageChangingTo,i))return!1}}),ja=i=>typeof i=="string",lb=i=>typeof i=="object"&&i!==null,ib=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,sb={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},rb=i=>sb[i],ob=i=>i.replace(ib,rb);let ic={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:ob,transDefaultProps:void 0};const ub=(i={})=>{ic={...ic,...i}},cb=()=>ic;let Ng;const fb=i=>{Ng=i},db=()=>Ng,hb={type:"3rdParty",init(i){ub(i.options.react),fb(i)}},mb=y.createContext();class gb{constructor(){this.usedNamespaces={}}addUsedNamespaces(l){l.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var pb=Jy();const vb=(i,l)=>ja(l)?l:lb(l)&&ja(l.defaultValue)?l.defaultValue:Array.isArray(i)?i[i.length-1]:i,yb={t:vb,ready:!1},bb=()=>()=>{},xr=(i,l={})=>{const{i18n:r}=l,{i18n:o,defaultNS:c}=y.useContext(mb)||{},f=r||o||db();f&&!f.reportNamespaces&&(f.reportNamespaces=new gb),f||Og(f,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const m=y.useMemo(()=>({...cb(),...f?.options?.react,...l}),[f,l]),{useSuspense:h,keyPrefix:b}=m,v=c||f?.options?.defaultNS,x=ja(v)?[v]:v||["translation"],g=y.useMemo(()=>x,x);f?.reportNamespaces?.addUsedNamespaces?.(g);const A=y.useRef(0),z=y.useCallback(ae=>{if(!f)return bb;const{bindI18n:te,bindI18nStore:fe}=m,re=()=>{A.current+=1,ae()};return te&&f.on(te,re),fe&&f.store.on(fe,re),()=>{te&&te.split(" ").forEach(Ee=>f.off(Ee,re)),fe&&fe.split(" ").forEach(Ee=>f.store.off(Ee,re))}},[f,m]),j=y.useRef(),B=y.useCallback(()=>{if(!f)return yb;const ae=!!(f.isInitialized||f.initializedStoreOnce)&&g.every(je=>ab(je,f,m)),te=l.lng||f.language,fe=A.current,re=j.current;if(re&&re.ready===ae&&re.lng===te&&re.keyPrefix===b&&re.revision===fe)return re;const Te={t:f.getFixedT(te,m.nsMode==="fallback"?g:g[0],b),ready:ae,lng:te,keyPrefix:b,revision:fe};return j.current=Te,Te},[f,g,b,m,l.lng]),[K,U]=y.useState(0),{t:Q,ready:Z}=pb.useSyncExternalStore(z,B,B);y.useEffect(()=>{if(f&&!Z&&!h){const ae=()=>U(te=>te+1);l.lng?Lm(f,l.lng,g,ae):lc(f,g,ae)}},[f,l.lng,g,Z,h,K]);const I=f||{},ee=y.useRef(null),J=y.useRef(),X=ae=>{const te=Object.getOwnPropertyDescriptors(ae);te.__original&&delete te.__original;const fe=Object.create(Object.getPrototypeOf(ae),te);if(!Object.prototype.hasOwnProperty.call(fe,"__original"))try{Object.defineProperty(fe,"__original",{value:ae,writable:!1,enumerable:!1,configurable:!1})}catch{}return fe},ve=y.useMemo(()=>{const ae=I,te=ae?.language;let fe=ae;ae&&(ee.current&&ee.current.__original===ae?J.current!==te?(fe=X(ae),ee.current=fe,J.current=te):fe=ee.current:(fe=X(ae),ee.current=fe,J.current=te));const re=[Q,fe,Z];return re.t=Q,re.i18n=fe,re.ready=Z,re},[Q,I,Z,I.resolvedLanguage,I.language,I.languages]);if(f&&h&&!Z)throw new Promise(ae=>{const te=()=>ae();l.lng?Lm(f,l.lng,g,te):lc(f,g,te)});return ve},Sb=[{to:"/",icon:og,labelKey:"nav.overview"},{to:"/health",icon:ug,labelKey:"nav.health"},{to:"/uncertainty",icon:By,labelKey:"nav.uncertainty"},{to:"/graph",icon:cg,labelKey:"nav.graph"},{to:"/timeline",icon:fg,labelKey:"nav.timeline"},{to:"/evolution",icon:dg,labelKey:"nav.evolution"},{to:"/diagrams",icon:hg,labelKey:"nav.mindmap"},{to:"/sync",icon:mg,labelKey:"nav.sync"},{to:"/oracle",icon:gg,labelKey:"nav.oracle"},{to:"/tool-stats",icon:pg,labelKey:"nav.toolStats"},{to:"/reasoning",icon:Hy,labelKey:"nav.reasoningTraining"},{to:"/visualize",icon:qy,labelKey:"nav.visualize"},{to:"/storage",icon:Vy,labelKey:"nav.storage"},{to:"/settings",icon:vg,labelKey:"nav.settings"}];function xb(){const i=br(r=>r.sidebarOpen),{t:l}=xr();return E.jsxs("aside",{className:ji("fixed inset-y-0 left-0 z-30 flex flex-col border-r border-sidebar-border bg-sidebar transition-all duration-[var(--transition-normal)]",i?"w-56":"w-16"),children:[E.jsxs("div",{className:"flex h-14 items-center gap-3 border-b border-sidebar-border px-4",children:[E.jsx(rg,{className:"size-6 shrink-0 text-sidebar-primary"}),i&&E.jsx("span",{className:"font-display text-base font-bold text-sidebar-foreground truncate",children:"Surreal-Memory"})]}),E.jsx("nav",{className:"flex-1 space-y-1 p-2","aria-label":l("common.mainNavigation"),children:Sb.map(({to:r,icon:o,labelKey:c})=>{const f=l(c);return E.jsxs(zy,{to:r,end:r==="/",className:({isActive:m})=>ji("flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors cursor-pointer",m?"bg-sidebar-accent text-sidebar-primary":"text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",!i&&"justify-center px-0"),title:f,children:[E.jsx(o,{className:"size-5 shrink-0","aria-hidden":"true"}),i&&E.jsx("span",{children:f})]},r)})}),E.jsx("div",{className:"border-t border-sidebar-border p-3",children:i&&E.jsx("p",{className:"text-xs text-sidebar-foreground/50 text-center",children:"Surreal-Memory"})})]})}function Um(i,l){if(typeof i=="function")return i(l);i!=null&&(i.current=l)}function Pt(...i){return l=>{let r=!1;const o=i.map(c=>{const f=Um(c,l);return!r&&typeof f=="function"&&(r=!0),f});if(r)return()=>{for(let c=0;c{let{children:f,...m}=o;Dg(f)&&typeof vr=="function"&&(f=vr(f._payload));const h=y.Children.toArray(f),b=h.find(Db);if(b){const v=b.props.children,x=h.map(g=>g===b?y.Children.count(v)>1?y.Children.only(null):y.isValidElement(v)?v.props.children:null:g);return E.jsx(l,{...m,ref:c,children:y.isValidElement(v)?y.cloneElement(v,void 0,x):null})}return E.jsx(l,{...m,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}var Ob=Ag("Slot");function Cb(i){const l=y.forwardRef((r,o)=>{let{children:c,...f}=r;if(Dg(c)&&typeof vr=="function"&&(c=vr(c._payload)),y.isValidElement(c)){const m=wb(c),h=Ab(f,c.props);return c.type!==y.Fragment&&(h.ref=o?Pt(o,m):m),y.cloneElement(c,h)}return y.Children.count(c)>1?y.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var Nb=Symbol("radix.slottable");function Db(i){return y.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===Nb}function Ab(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...h)=>{const b=f(...h);return c(...h),b}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function wb(i){let l=Object.getOwnPropertyDescriptor(i.props,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=Object.getOwnPropertyDescriptor(i,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}const Rb=yg("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 cursor-pointer [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-border bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-lg px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),cr=y.forwardRef(({className:i,variant:l,size:r,asChild:o=!1,...c},f)=>{const m=o?Ob:"button";return E.jsx(m,{className:ji(Rb({variant:l,size:r,className:i})),ref:f,...c})});cr.displayName="Button";const zb="";class wg extends Error{status;constructor(l,r){super(r),this.name="ApiError",this.status=l}}async function lr(i,l={}){const{brain:r,...o}=l,c=new Headers(o.headers);r&&c.set("X-Brain-ID",r),o.body&&!c.has("Content-Type")&&c.set("Content-Type","application/json");const f=await fetch(`${zb}${i}`,{...o,headers:c});if(!f.ok){const m=await f.text().catch(()=>"Unknown error");throw new wg(f.status,m)}return f.json()}const qe={get:(i,l)=>lr(i,{...l,method:"GET"}),post:(i,l,r)=>lr(i,{...r,method:"POST",body:l?JSON.stringify(l):void 0}),put:(i,l,r)=>lr(i,{...r,method:"PUT",body:l?JSON.stringify(l):void 0}),delete:(i,l)=>lr(i,{...l,method:"DELETE"})};function AE(i,l){if(i instanceof wg){try{const r=JSON.parse(i.message);if(r&&typeof r.detail=="string")return r.detail}catch{}return i.message||l}return l}const $e={stats:["dashboard","stats"],brains:["dashboard","brains"],health:["dashboard","health"],healthCheck:["health"],toolStats:i=>["dashboard","tool-stats",i],timeline:(i,l)=>["dashboard","timeline",i,l],dailyStats:i=>["dashboard","timeline","daily-stats",i],evolution:["dashboard","evolution"],fibers:["dashboard","fibers"],fiberDiagram:i=>["dashboard","fiber",i,"diagram"],graph:i=>["graph",i],brainFiles:["dashboard","brain-files"],configStatus:["dashboard","config-status"],embeddingConfig:["config","embedding"],watcherStatus:["dashboard","watcher-status"],license:["dashboard","license"],uncertainty:i=>["dashboard","uncertainty",i]};function Mb(){return it({queryKey:$e.stats,queryFn:()=>qe.get("/api/dashboard/stats")})}function _b(){return it({queryKey:$e.healthCheck,queryFn:()=>qe.get("/health"),staleTime:3e5})}function wE(){return it({queryKey:$e.brains,queryFn:()=>qe.get("/api/dashboard/brains")})}function RE(){const i=fc();return Hi({mutationFn:l=>qe.post("/api/dashboard/brains/switch",{brain_name:l}),onSuccess:()=>{i.invalidateQueries()}})}function zE(){return it({queryKey:$e.health,queryFn:()=>qe.get("/api/dashboard/health")})}function ME(i=14){return it({queryKey:$e.uncertainty(i),queryFn:()=>qe.get(`/api/dashboard/uncertainty?within_days=${i}`)})}function _E(i=100,l=0){return it({queryKey:$e.timeline(i,l),queryFn:()=>qe.get(`/api/dashboard/timeline?limit=${i}&offset=${l}`)})}function jE(i=30){return it({queryKey:$e.dailyStats(i),queryFn:()=>qe.get(`/api/dashboard/timeline/daily-stats?days=${i}`)})}function LE(){return it({queryKey:$e.evolution,queryFn:()=>qe.get("/api/dashboard/evolution")})}function jb(){return it({queryKey:$e.fibers,queryFn:()=>qe.get("/api/dashboard/fibers")})}function UE(i){return it({queryKey:$e.fiberDiagram(i),queryFn:()=>qe.get(`/api/dashboard/fiber/${i}/diagram`),enabled:!!i})}function BE(i=500){return it({queryKey:$e.graph(i),queryFn:()=>qe.get(`/api/graph?limit=${i}`)})}function HE(){const i=fc();return Hi({mutationFn:l=>qe.delete(`/brain/${l}`),onSuccess:()=>{i.invalidateQueries()}})}function qE(i=30){return it({queryKey:$e.toolStats(i),queryFn:()=>qe.get(`/api/dashboard/tool-stats?days=${i}`)})}function VE(){return it({queryKey:$e.brainFiles,queryFn:()=>qe.get("/api/dashboard/brain-files")})}function YE(){return it({queryKey:$e.configStatus,queryFn:()=>qe.get("/api/dashboard/config-status"),staleTime:6e4})}function kE(){return it({queryKey:$e.embeddingConfig,queryFn:()=>qe.get("/api/dashboard/config/embedding"),staleTime:6e4})}function KE(){const i=fc();return Hi({mutationFn:l=>qe.put("/api/dashboard/config",l),onSuccess:()=>{i.invalidateQueries({queryKey:$e.configStatus}),i.invalidateQueries({queryKey:$e.embeddingConfig})}})}function GE(){return it({queryKey:$e.watcherStatus,queryFn:()=>qe.get("/api/dashboard/watcher/status"),staleTime:3e4})}function QE(){return Hi({mutationFn:()=>qe.post("/api/dashboard/config/embedding/test",{})})}function XE(){return Hi({mutationFn:i=>qe.post("/api/dashboard/visualize",i)})}function ZE(){return it({queryKey:$e.license,queryFn:()=>qe.get("/api/dashboard/license"),staleTime:6e4})}const Lb=yg("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-2 focus:outline-offset-2 focus:outline-ring",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground shadow",outline:"text-foreground",success:"border-transparent bg-health-good/10 text-health-good",warning:"border-transparent bg-health-warn/10 text-health-warn"}},defaultVariants:{variant:"default"}});function Ub({className:i,variant:l,...r}){return E.jsx("div",{className:ji(Lb({variant:l}),i),...r})}var Bm=1,Bb=.9,Hb=.8,qb=.17,Qu=.1,Xu=.999,Vb=.9999,Yb=.99,kb=/[\\\/_+.#"@\[\(\{&]/,Kb=/[\\\/_+.#"@\[\(\{&]/g,Gb=/[\s-]/,Rg=/[\s-]/g;function sc(i,l,r,o,c,f,m){if(f===l.length)return c===i.length?Bm:Yb;var h=`${c},${f}`;if(m[h]!==void 0)return m[h];for(var b=o.charAt(f),v=r.indexOf(b,c),x=0,g,A,z,j;v>=0;)g=sc(i,l,r,o,v+1,f+1,m),g>x&&(v===c?g*=Bm:kb.test(i.charAt(v-1))?(g*=Hb,z=i.slice(c,v-1).match(Kb),z&&c>0&&(g*=Math.pow(Xu,z.length))):Gb.test(i.charAt(v-1))?(g*=Bb,j=i.slice(c,v-1).match(Rg),j&&c>0&&(g*=Math.pow(Xu,j.length))):(g*=qb,c>0&&(g*=Math.pow(Xu,v-c))),i.charAt(v)!==l.charAt(f)&&(g*=Vb)),(gg&&(g=A*Qu)),g>x&&(x=g),v=r.indexOf(b,v+1);return m[h]=x,x}function Hm(i){return i.toLowerCase().replace(Rg," ")}function Qb(i,l,r){return i=r&&r.length>0?`${i+" "+r.join(" ")}`:i,sc(i,l,Hm(i),Hm(l),0,0,{})}function ra(i,l,{checkForDefaultPrevented:r=!0}={}){return function(c){if(i?.(c),r===!1||!c.defaultPrevented)return l?.(c)}}function Xb(i,l){const r=y.createContext(l),o=f=>{const{children:m,...h}=f,b=y.useMemo(()=>h,Object.values(h));return E.jsx(r.Provider,{value:b,children:m})};o.displayName=i+"Provider";function c(f){const m=y.useContext(r);if(m)return m;if(l!==void 0)return l;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[o,c]}function Zb(i,l=[]){let r=[];function o(f,m){const h=y.createContext(m),b=r.length;r=[...r,m];const v=g=>{const{scope:A,children:z,...j}=g,B=A?.[i]?.[b]||h,K=y.useMemo(()=>j,Object.values(j));return E.jsx(B.Provider,{value:K,children:z})};v.displayName=f+"Provider";function x(g,A){const z=A?.[i]?.[b]||h,j=y.useContext(z);if(j)return j;if(m!==void 0)return m;throw new Error(`\`${g}\` must be used within \`${f}\``)}return[v,x]}const c=()=>{const f=r.map(m=>y.createContext(m));return function(h){const b=h?.[i]||f;return y.useMemo(()=>({[`__scope${i}`]:{...h,[i]:b}}),[h,b])}};return c.scopeName=i,[o,Fb(c,...l)]}function Fb(...i){const l=i[0];if(i.length===1)return l;const r=()=>{const o=i.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(f){const m=o.reduce((h,{useScope:b,scopeName:v})=>{const g=b(f)[`__scope${v}`];return{...h,...g}},{});return y.useMemo(()=>({[`__scope${l.scopeName}`]:m}),[m])}};return r.scopeName=l.scopeName,r}var Ui=globalThis?.document?y.useLayoutEffect:()=>{},Jb=dc[" useId ".trim().toString()]||(()=>{}),$b=0;function Mn(i){const[l,r]=y.useState(Jb());return Ui(()=>{r(o=>o??String($b++))},[i]),l?`radix-${l}`:""}var Wb=dc[" useInsertionEffect ".trim().toString()]||Ui;function Ib({prop:i,defaultProp:l,onChange:r=()=>{},caller:o}){const[c,f,m]=Pb({defaultProp:l,onChange:r}),h=i!==void 0,b=h?i:c;{const x=y.useRef(i!==void 0);y.useEffect(()=>{const g=x.current;g!==h&&console.warn(`${o} is changing from ${g?"controlled":"uncontrolled"} to ${h?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),x.current=h},[h,o])}const v=y.useCallback(x=>{if(h){const g=eS(x)?x(i):x;g!==i&&m.current?.(g)}else f(x)},[h,i,f,m]);return[b,v]}function Pb({defaultProp:i,onChange:l}){const[r,o]=y.useState(i),c=y.useRef(r),f=y.useRef(l);return Wb(()=>{f.current=l},[l]),y.useEffect(()=>{c.current!==r&&(f.current?.(r),c.current=r)},[r,c]),[r,o,f]}function eS(i){return typeof i=="function"}function tS(i){const l=nS(i),r=y.forwardRef((o,c)=>{const{children:f,...m}=o,h=y.Children.toArray(f),b=h.find(lS);if(b){const v=b.props.children,x=h.map(g=>g===b?y.Children.count(v)>1?y.Children.only(null):y.isValidElement(v)?v.props.children:null:g);return E.jsx(l,{...m,ref:c,children:y.isValidElement(v)?y.cloneElement(v,void 0,x):null})}return E.jsx(l,{...m,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}function nS(i){const l=y.forwardRef((r,o)=>{const{children:c,...f}=r;if(y.isValidElement(c)){const m=sS(c),h=iS(f,c.props);return c.type!==y.Fragment&&(h.ref=o?Pt(o,m):m),y.cloneElement(c,h)}return y.Children.count(c)>1?y.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var aS=Symbol("radix.slottable");function lS(i){return y.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===aS}function iS(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...h)=>{const b=f(...h);return c(...h),b}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function sS(i){let l=Object.getOwnPropertyDescriptor(i.props,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=Object.getOwnPropertyDescriptor(i,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}var rS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zg=rS.reduce((i,l)=>{const r=tS(`Primitive.${l}`),o=y.forwardRef((c,f)=>{const{asChild:m,...h}=c,b=m?r:l;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),E.jsx(b,{...h,ref:f})});return o.displayName=`Primitive.${l}`,{...i,[l]:o}},{});function oS(i,l){i&&sg.flushSync(()=>i.dispatchEvent(l))}function Bi(i){const l=y.useRef(i);return y.useEffect(()=>{l.current=i}),y.useMemo(()=>(...r)=>l.current?.(...r),[])}function uS(i,l=globalThis?.document){const r=Bi(i);y.useEffect(()=>{const o=c=>{c.key==="Escape"&&r(c)};return l.addEventListener("keydown",o,{capture:!0}),()=>l.removeEventListener("keydown",o,{capture:!0})},[r,l])}var cS="DismissableLayer",rc="dismissableLayer.update",fS="dismissableLayer.pointerDownOutside",dS="dismissableLayer.focusOutside",qm,Mg=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_g=y.forwardRef((i,l)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:f,onInteractOutside:m,onDismiss:h,...b}=i,v=y.useContext(Mg),[x,g]=y.useState(null),A=x?.ownerDocument??globalThis?.document,[,z]=y.useState({}),j=Ba(l,X=>g(X)),B=Array.from(v.layers),[K]=[...v.layersWithOutsidePointerEventsDisabled].slice(-1),U=B.indexOf(K),Q=x?B.indexOf(x):-1,Z=v.layersWithOutsidePointerEventsDisabled.size>0,I=Q>=U,ee=gS(X=>{const ve=X.target,ae=[...v.branches].some(te=>te.contains(ve));!I||ae||(c?.(X),m?.(X),X.defaultPrevented||h?.())},A),J=pS(X=>{const ve=X.target;[...v.branches].some(te=>te.contains(ve))||(f?.(X),m?.(X),X.defaultPrevented||h?.())},A);return uS(X=>{Q===v.layers.size-1&&(o?.(X),!X.defaultPrevented&&h&&(X.preventDefault(),h()))},A),y.useEffect(()=>{if(x)return r&&(v.layersWithOutsidePointerEventsDisabled.size===0&&(qm=A.body.style.pointerEvents,A.body.style.pointerEvents="none"),v.layersWithOutsidePointerEventsDisabled.add(x)),v.layers.add(x),Vm(),()=>{r&&v.layersWithOutsidePointerEventsDisabled.size===1&&(A.body.style.pointerEvents=qm)}},[x,A,r,v]),y.useEffect(()=>()=>{x&&(v.layers.delete(x),v.layersWithOutsidePointerEventsDisabled.delete(x),Vm())},[x,v]),y.useEffect(()=>{const X=()=>z({});return document.addEventListener(rc,X),()=>document.removeEventListener(rc,X)},[]),E.jsx(zg.div,{...b,ref:j,style:{pointerEvents:Z?I?"auto":"none":void 0,...i.style},onFocusCapture:ra(i.onFocusCapture,J.onFocusCapture),onBlurCapture:ra(i.onBlurCapture,J.onBlurCapture),onPointerDownCapture:ra(i.onPointerDownCapture,ee.onPointerDownCapture)})});_g.displayName=cS;var hS="DismissableLayerBranch",mS=y.forwardRef((i,l)=>{const r=y.useContext(Mg),o=y.useRef(null),c=Ba(l,o);return y.useEffect(()=>{const f=o.current;if(f)return r.branches.add(f),()=>{r.branches.delete(f)}},[r.branches]),E.jsx(zg.div,{...i,ref:c})});mS.displayName=hS;function gS(i,l=globalThis?.document){const r=Bi(i),o=y.useRef(!1),c=y.useRef(()=>{});return y.useEffect(()=>{const f=h=>{if(h.target&&!o.current){let b=function(){jg(fS,r,v,{discrete:!0})};const v={originalEvent:h};h.pointerType==="touch"?(l.removeEventListener("click",c.current),c.current=b,l.addEventListener("click",c.current,{once:!0})):b()}else l.removeEventListener("click",c.current);o.current=!1},m=window.setTimeout(()=>{l.addEventListener("pointerdown",f)},0);return()=>{window.clearTimeout(m),l.removeEventListener("pointerdown",f),l.removeEventListener("click",c.current)}},[l,r]),{onPointerDownCapture:()=>o.current=!0}}function pS(i,l=globalThis?.document){const r=Bi(i),o=y.useRef(!1);return y.useEffect(()=>{const c=f=>{f.target&&!o.current&&jg(dS,r,{originalEvent:f},{discrete:!1})};return l.addEventListener("focusin",c),()=>l.removeEventListener("focusin",c)},[l,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Vm(){const i=new CustomEvent(rc);document.dispatchEvent(i)}function jg(i,l,r,{discrete:o}){const c=r.originalEvent.target,f=new CustomEvent(i,{bubbles:!1,cancelable:!0,detail:r});l&&c.addEventListener(i,l,{once:!0}),o?oS(c,f):c.dispatchEvent(f)}function vS(i){const l=yS(i),r=y.forwardRef((o,c)=>{const{children:f,...m}=o,h=y.Children.toArray(f),b=h.find(SS);if(b){const v=b.props.children,x=h.map(g=>g===b?y.Children.count(v)>1?y.Children.only(null):y.isValidElement(v)?v.props.children:null:g);return E.jsx(l,{...m,ref:c,children:y.isValidElement(v)?y.cloneElement(v,void 0,x):null})}return E.jsx(l,{...m,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}function yS(i){const l=y.forwardRef((r,o)=>{const{children:c,...f}=r;if(y.isValidElement(c)){const m=ES(c),h=xS(f,c.props);return c.type!==y.Fragment&&(h.ref=o?Pt(o,m):m),y.cloneElement(c,h)}return y.Children.count(c)>1?y.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var bS=Symbol("radix.slottable");function SS(i){return y.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===bS}function xS(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...h)=>{const b=f(...h);return c(...h),b}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function ES(i){let l=Object.getOwnPropertyDescriptor(i.props,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=Object.getOwnPropertyDescriptor(i,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}var TS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],OS=TS.reduce((i,l)=>{const r=vS(`Primitive.${l}`),o=y.forwardRef((c,f)=>{const{asChild:m,...h}=c,b=m?r:l;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),E.jsx(b,{...h,ref:f})});return o.displayName=`Primitive.${l}`,{...i,[l]:o}},{}),Zu="focusScope.autoFocusOnMount",Fu="focusScope.autoFocusOnUnmount",Ym={bubbles:!1,cancelable:!0},CS="FocusScope",Lg=y.forwardRef((i,l)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:c,onUnmountAutoFocus:f,...m}=i,[h,b]=y.useState(null),v=Bi(c),x=Bi(f),g=y.useRef(null),A=Ba(l,B=>b(B)),z=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(o){let B=function(Z){if(z.paused||!h)return;const I=Z.target;h.contains(I)?g.current=I:sa(g.current,{select:!0})},K=function(Z){if(z.paused||!h)return;const I=Z.relatedTarget;I!==null&&(h.contains(I)||sa(g.current,{select:!0}))},U=function(Z){if(document.activeElement===document.body)for(const ee of Z)ee.removedNodes.length>0&&sa(h)};document.addEventListener("focusin",B),document.addEventListener("focusout",K);const Q=new MutationObserver(U);return h&&Q.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",B),document.removeEventListener("focusout",K),Q.disconnect()}}},[o,h,z.paused]),y.useEffect(()=>{if(h){Km.add(z);const B=document.activeElement;if(!h.contains(B)){const U=new CustomEvent(Zu,Ym);h.addEventListener(Zu,v),h.dispatchEvent(U),U.defaultPrevented||(NS(zS(Ug(h)),{select:!0}),document.activeElement===B&&sa(h))}return()=>{h.removeEventListener(Zu,v),setTimeout(()=>{const U=new CustomEvent(Fu,Ym);h.addEventListener(Fu,x),h.dispatchEvent(U),U.defaultPrevented||sa(B??document.body,{select:!0}),h.removeEventListener(Fu,x),Km.remove(z)},0)}}},[h,v,x,z]);const j=y.useCallback(B=>{if(!r&&!o||z.paused)return;const K=B.key==="Tab"&&!B.altKey&&!B.ctrlKey&&!B.metaKey,U=document.activeElement;if(K&&U){const Q=B.currentTarget,[Z,I]=DS(Q);Z&&I?!B.shiftKey&&U===I?(B.preventDefault(),r&&sa(Z,{select:!0})):B.shiftKey&&U===Z&&(B.preventDefault(),r&&sa(I,{select:!0})):U===Q&&B.preventDefault()}},[r,o,z.paused]);return E.jsx(OS.div,{tabIndex:-1,...m,ref:A,onKeyDown:j})});Lg.displayName=CS;function NS(i,{select:l=!1}={}){const r=document.activeElement;for(const o of i)if(sa(o,{select:l}),document.activeElement!==r)return}function DS(i){const l=Ug(i),r=km(l,i),o=km(l.reverse(),i);return[r,o]}function Ug(i){const l=[],r=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const c=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||c?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)l.push(r.currentNode);return l}function km(i,l){for(const r of i)if(!AS(r,{upTo:l}))return r}function AS(i,{upTo:l}){if(getComputedStyle(i).visibility==="hidden")return!0;for(;i;){if(l!==void 0&&i===l)return!1;if(getComputedStyle(i).display==="none")return!0;i=i.parentElement}return!1}function wS(i){return i instanceof HTMLInputElement&&"select"in i}function sa(i,{select:l=!1}={}){if(i&&i.focus){const r=document.activeElement;i.focus({preventScroll:!0}),i!==r&&wS(i)&&l&&i.select()}}var Km=RS();function RS(){let i=[];return{add(l){const r=i[0];l!==r&&r?.pause(),i=Gm(i,l),i.unshift(l)},remove(l){i=Gm(i,l),i[0]?.resume()}}}function Gm(i,l){const r=[...i],o=r.indexOf(l);return o!==-1&&r.splice(o,1),r}function zS(i){return i.filter(l=>l.tagName!=="A")}function MS(i){const l=_S(i),r=y.forwardRef((o,c)=>{const{children:f,...m}=o,h=y.Children.toArray(f),b=h.find(LS);if(b){const v=b.props.children,x=h.map(g=>g===b?y.Children.count(v)>1?y.Children.only(null):y.isValidElement(v)?v.props.children:null:g);return E.jsx(l,{...m,ref:c,children:y.isValidElement(v)?y.cloneElement(v,void 0,x):null})}return E.jsx(l,{...m,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}function _S(i){const l=y.forwardRef((r,o)=>{const{children:c,...f}=r;if(y.isValidElement(c)){const m=BS(c),h=US(f,c.props);return c.type!==y.Fragment&&(h.ref=o?Pt(o,m):m),y.cloneElement(c,h)}return y.Children.count(c)>1?y.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var jS=Symbol("radix.slottable");function LS(i){return y.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===jS}function US(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...h)=>{const b=f(...h);return c(...h),b}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function BS(i){let l=Object.getOwnPropertyDescriptor(i.props,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=Object.getOwnPropertyDescriptor(i,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}var HS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],qS=HS.reduce((i,l)=>{const r=MS(`Primitive.${l}`),o=y.forwardRef((c,f)=>{const{asChild:m,...h}=c,b=m?r:l;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),E.jsx(b,{...h,ref:f})});return o.displayName=`Primitive.${l}`,{...i,[l]:o}},{}),VS="Portal",Bg=y.forwardRef((i,l)=>{const{container:r,...o}=i,[c,f]=y.useState(!1);Ui(()=>f(!0),[]);const m=r||c&&globalThis?.document?.body;return m?ig.createPortal(E.jsx(qS.div,{...o,ref:l}),m):null});Bg.displayName=VS;function YS(i,l){return y.useReducer((r,o)=>l[r][o]??r,i)}var Er=i=>{const{present:l,children:r}=i,o=kS(l),c=typeof r=="function"?r({present:o.isPresent}):y.Children.only(r),f=Ba(o.ref,KS(c));return typeof r=="function"||o.isPresent?y.cloneElement(c,{ref:f}):null};Er.displayName="Presence";function kS(i){const[l,r]=y.useState(),o=y.useRef(null),c=y.useRef(i),f=y.useRef("none"),m=i?"mounted":"unmounted",[h,b]=YS(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const v=ir(o.current);f.current=h==="mounted"?v:"none"},[h]),Ui(()=>{const v=o.current,x=c.current;if(x!==i){const A=f.current,z=ir(v);i?b("MOUNT"):z==="none"||v?.display==="none"?b("UNMOUNT"):b(x&&A!==z?"ANIMATION_OUT":"UNMOUNT"),c.current=i}},[i,b]),Ui(()=>{if(l){let v;const x=l.ownerDocument.defaultView??window,g=z=>{const B=ir(o.current).includes(CSS.escape(z.animationName));if(z.target===l&&B&&(b("ANIMATION_END"),!c.current)){const K=l.style.animationFillMode;l.style.animationFillMode="forwards",v=x.setTimeout(()=>{l.style.animationFillMode==="forwards"&&(l.style.animationFillMode=K)})}},A=z=>{z.target===l&&(f.current=ir(o.current))};return l.addEventListener("animationstart",A),l.addEventListener("animationcancel",g),l.addEventListener("animationend",g),()=>{x.clearTimeout(v),l.removeEventListener("animationstart",A),l.removeEventListener("animationcancel",g),l.removeEventListener("animationend",g)}}else b("ANIMATION_END")},[l,b]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:y.useCallback(v=>{o.current=v?getComputedStyle(v):null,r(v)},[])}}function ir(i){return i?.animationName||"none"}function KS(i){let l=Object.getOwnPropertyDescriptor(i.props,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=Object.getOwnPropertyDescriptor(i,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}function Hg(i){const l=GS(i),r=y.forwardRef((o,c)=>{const{children:f,...m}=o,h=y.Children.toArray(f),b=h.find(XS);if(b){const v=b.props.children,x=h.map(g=>g===b?y.Children.count(v)>1?y.Children.only(null):y.isValidElement(v)?v.props.children:null:g);return E.jsx(l,{...m,ref:c,children:y.isValidElement(v)?y.cloneElement(v,void 0,x):null})}return E.jsx(l,{...m,ref:c,children:f})});return r.displayName=`${i}.Slot`,r}function GS(i){const l=y.forwardRef((r,o)=>{const{children:c,...f}=r;if(y.isValidElement(c)){const m=FS(c),h=ZS(f,c.props);return c.type!==y.Fragment&&(h.ref=o?Pt(o,m):m),y.cloneElement(c,h)}return y.Children.count(c)>1?y.Children.only(null):null});return l.displayName=`${i}.SlotClone`,l}var QS=Symbol("radix.slottable");function XS(i){return y.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===QS}function ZS(i,l){const r={...l};for(const o in l){const c=i[o],f=l[o];/^on[A-Z]/.test(o)?c&&f?r[o]=(...h)=>{const b=f(...h);return c(...h),b}:c&&(r[o]=c):o==="style"?r[o]={...c,...f}:o==="className"&&(r[o]=[c,f].filter(Boolean).join(" "))}return{...i,...r}}function FS(i){let l=Object.getOwnPropertyDescriptor(i.props,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning;return r?i.ref:(l=Object.getOwnPropertyDescriptor(i,"ref")?.get,r=l&&"isReactWarning"in l&&l.isReactWarning,r?i.props.ref:i.props.ref||i.ref)}var JS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],qi=JS.reduce((i,l)=>{const r=Hg(`Primitive.${l}`),o=y.forwardRef((c,f)=>{const{asChild:m,...h}=c,b=m?r:l;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),E.jsx(b,{...h,ref:f})});return o.displayName=`Primitive.${l}`,{...i,[l]:o}},{}),Ju=0;function $S(){y.useEffect(()=>{const i=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",i[0]??Qm()),document.body.insertAdjacentElement("beforeend",i[1]??Qm()),Ju++,()=>{Ju===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(l=>l.remove()),Ju--}},[])}function Qm(){const i=document.createElement("span");return i.setAttribute("data-radix-focus-guard",""),i.tabIndex=0,i.style.outline="none",i.style.opacity="0",i.style.position="fixed",i.style.pointerEvents="none",i}var cn=function(){return cn=Object.assign||function(l){for(var r,o=1,c=arguments.length;o"u")return h1;var l=m1(i),r=document.documentElement.clientWidth,o=window.innerWidth;return{left:l[0],top:l[1],right:l[2],gap:Math.max(0,o-r+l[2]-l[0])}},p1=kg(),_l="data-scroll-locked",v1=function(i,l,r,o){var c=i.left,f=i.top,m=i.right,h=i.gap;return r===void 0&&(r="margin"),` .`.concat(IS,` { overflow: hidden `).concat(o,`; padding-right: `).concat(h,"px ").concat(o,`; @@ -44,11 +44,11 @@ Error generating stack: `+a.message+` body[`).concat(_l,`] { `).concat(PS,": ").concat(h,`px; } -`)},Zm=function(){var i=parseInt(document.body.getAttribute(_l)||"0",10);return isFinite(i)?i:0},y1=function(){y.useEffect(function(){return document.body.setAttribute(_l,(Zm()+1).toString()),function(){var i=Zm()-1;i<=0?document.body.removeAttribute(_l):document.body.setAttribute(_l,i.toString())}},[])},b1=function(i){var l=i.noRelative,r=i.noImportant,o=i.gapMode,c=o===void 0?"margin":o;y1();var f=y.useMemo(function(){return g1(c)},[c]);return y.createElement(p1,{styles:v1(f,!l,c,r?"":"!important")})},oc=!1;if(typeof window<"u")try{var sr=Object.defineProperty({},"passive",{get:function(){return oc=!0,!0}});window.addEventListener("test",sr,sr),window.removeEventListener("test",sr,sr)}catch{oc=!1}var Nl=oc?{passive:!1}:!1,S1=function(i){return i.tagName==="TEXTAREA"},Kg=function(i,l){if(!(i instanceof Element))return!1;var r=window.getComputedStyle(i);return r[l]!=="hidden"&&!(r.overflowY===r.overflowX&&!S1(i)&&r[l]==="visible")},x1=function(i){return Kg(i,"overflowY")},E1=function(i){return Kg(i,"overflowX")},Fm=function(i,l){var r=l.ownerDocument,o=l;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var c=Gg(i,o);if(c){var f=Qg(i,o),m=f[1],h=f[2];if(m>h)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},T1=function(i){var l=i.scrollTop,r=i.scrollHeight,o=i.clientHeight;return[l,r,o]},O1=function(i){var l=i.scrollLeft,r=i.scrollWidth,o=i.clientWidth;return[l,r,o]},Gg=function(i,l){return i==="v"?x1(l):E1(l)},Qg=function(i,l){return i==="v"?T1(l):O1(l)},C1=function(i,l){return i==="h"&&l==="rtl"?-1:1},N1=function(i,l,r,o,c){var f=C1(i,window.getComputedStyle(l).direction),m=f*o,h=r.target,b=l.contains(h),v=!1,x=m>0,g=0,D=0;do{if(!h)break;var z=Qg(i,h),j=z[0],B=z[1],K=z[2],U=B-K-f*j;(j||U)&&Gg(i,h)&&(g+=U,D+=j);var Q=h.parentNode;h=Q&&Q.nodeType===Node.DOCUMENT_FRAGMENT_NODE?Q.host:Q}while(!b&&h!==document.body||b&&(l.contains(h)||l===h));return(x&&Math.abs(g)<1||!x&&Math.abs(D)<1)&&(v=!0),v},rr=function(i){return"changedTouches"in i?[i.changedTouches[0].clientX,i.changedTouches[0].clientY]:[0,0]},Jm=function(i){return[i.deltaX,i.deltaY]},$m=function(i){return i&&"current"in i?i.current:i},A1=function(i,l){return i[0]===l[0]&&i[1]===l[1]},D1=function(i){return` +`)},Zm=function(){var i=parseInt(document.body.getAttribute(_l)||"0",10);return isFinite(i)?i:0},y1=function(){y.useEffect(function(){return document.body.setAttribute(_l,(Zm()+1).toString()),function(){var i=Zm()-1;i<=0?document.body.removeAttribute(_l):document.body.setAttribute(_l,i.toString())}},[])},b1=function(i){var l=i.noRelative,r=i.noImportant,o=i.gapMode,c=o===void 0?"margin":o;y1();var f=y.useMemo(function(){return g1(c)},[c]);return y.createElement(p1,{styles:v1(f,!l,c,r?"":"!important")})},oc=!1;if(typeof window<"u")try{var sr=Object.defineProperty({},"passive",{get:function(){return oc=!0,!0}});window.addEventListener("test",sr,sr),window.removeEventListener("test",sr,sr)}catch{oc=!1}var Nl=oc?{passive:!1}:!1,S1=function(i){return i.tagName==="TEXTAREA"},Kg=function(i,l){if(!(i instanceof Element))return!1;var r=window.getComputedStyle(i);return r[l]!=="hidden"&&!(r.overflowY===r.overflowX&&!S1(i)&&r[l]==="visible")},x1=function(i){return Kg(i,"overflowY")},E1=function(i){return Kg(i,"overflowX")},Fm=function(i,l){var r=l.ownerDocument,o=l;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var c=Gg(i,o);if(c){var f=Qg(i,o),m=f[1],h=f[2];if(m>h)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},T1=function(i){var l=i.scrollTop,r=i.scrollHeight,o=i.clientHeight;return[l,r,o]},O1=function(i){var l=i.scrollLeft,r=i.scrollWidth,o=i.clientWidth;return[l,r,o]},Gg=function(i,l){return i==="v"?x1(l):E1(l)},Qg=function(i,l){return i==="v"?T1(l):O1(l)},C1=function(i,l){return i==="h"&&l==="rtl"?-1:1},N1=function(i,l,r,o,c){var f=C1(i,window.getComputedStyle(l).direction),m=f*o,h=r.target,b=l.contains(h),v=!1,x=m>0,g=0,A=0;do{if(!h)break;var z=Qg(i,h),j=z[0],B=z[1],K=z[2],U=B-K-f*j;(j||U)&&Gg(i,h)&&(g+=U,A+=j);var Q=h.parentNode;h=Q&&Q.nodeType===Node.DOCUMENT_FRAGMENT_NODE?Q.host:Q}while(!b&&h!==document.body||b&&(l.contains(h)||l===h));return(x&&Math.abs(g)<1||!x&&Math.abs(A)<1)&&(v=!0),v},rr=function(i){return"changedTouches"in i?[i.changedTouches[0].clientX,i.changedTouches[0].clientY]:[0,0]},Jm=function(i){return[i.deltaX,i.deltaY]},$m=function(i){return i&&"current"in i?i.current:i},D1=function(i,l){return i[0]===l[0]&&i[1]===l[1]},A1=function(i){return` .block-interactivity-`.concat(i,` {pointer-events: none;} .allow-interactivity-`).concat(i,` {pointer-events: all;} -`)},w1=0,Al=[];function R1(i){var l=y.useRef([]),r=y.useRef([0,0]),o=y.useRef(),c=y.useState(w1++)[0],f=y.useState(kg)[0],m=y.useRef(i);y.useEffect(function(){m.current=i},[i]),y.useEffect(function(){if(i.inert){document.body.classList.add("block-interactivity-".concat(c));var B=WS([i.lockRef.current],(i.shards||[]).map($m),!0).filter(Boolean);return B.forEach(function(K){return K.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),B.forEach(function(K){return K.classList.remove("allow-interactivity-".concat(c))})}}},[i.inert,i.lockRef.current,i.shards]);var h=y.useCallback(function(B,K){if("touches"in B&&B.touches.length===2||B.type==="wheel"&&B.ctrlKey)return!m.current.allowPinchZoom;var U=rr(B),Q=r.current,Z="deltaX"in B?B.deltaX:Q[0]-U[0],I="deltaY"in B?B.deltaY:Q[1]-U[1],ee,J=B.target,X=Math.abs(Z)>Math.abs(I)?"h":"v";if("touches"in B&&X==="h"&&J.type==="range")return!1;var ve=window.getSelection(),ae=ve&&ve.anchorNode,te=ae?ae===J||ae.contains(J):!1;if(te)return!1;var fe=Fm(X,J);if(!fe)return!0;if(fe?ee=X:(ee=X==="v"?"h":"v",fe=Fm(X,J)),!fe)return!1;if(!o.current&&"changedTouches"in B&&(Z||I)&&(o.current=ee),!ee)return!0;var re=o.current||ee;return N1(re,K,B,re==="h"?Z:I)},[]),b=y.useCallback(function(B){var K=B;if(!(!Al.length||Al[Al.length-1]!==f)){var U="deltaY"in K?Jm(K):rr(K),Q=l.current.filter(function(ee){return ee.name===K.type&&(ee.target===K.target||K.target===ee.shadowParent)&&A1(ee.delta,U)})[0];if(Q&&Q.should){K.cancelable&&K.preventDefault();return}if(!Q){var Z=(m.current.shards||[]).map($m).filter(Boolean).filter(function(ee){return ee.contains(K.target)}),I=Z.length>0?h(K,Z[0]):!m.current.noIsolation;I&&K.cancelable&&K.preventDefault()}}},[]),v=y.useCallback(function(B,K,U,Q){var Z={name:B,delta:K,target:U,should:Q,shadowParent:z1(U)};l.current.push(Z),setTimeout(function(){l.current=l.current.filter(function(I){return I!==Z})},1)},[]),x=y.useCallback(function(B){r.current=rr(B),o.current=void 0},[]),g=y.useCallback(function(B){v(B.type,Jm(B),B.target,h(B,i.lockRef.current))},[]),D=y.useCallback(function(B){v(B.type,rr(B),B.target,h(B,i.lockRef.current))},[]);y.useEffect(function(){return Al.push(f),i.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:D}),document.addEventListener("wheel",b,Nl),document.addEventListener("touchmove",b,Nl),document.addEventListener("touchstart",x,Nl),function(){Al=Al.filter(function(B){return B!==f}),document.removeEventListener("wheel",b,Nl),document.removeEventListener("touchmove",b,Nl),document.removeEventListener("touchstart",x,Nl)}},[]);var z=i.removeScrollBar,j=i.inert;return y.createElement(y.Fragment,null,j?y.createElement(f,{styles:D1(c)}):null,z?y.createElement(b1,{noRelative:i.noRelative,gapMode:i.gapMode}):null)}function z1(i){for(var l=null;i!==null;)i instanceof ShadowRoot&&(l=i.host,i=i.host),i=i.parentNode;return l}const M1=s1(Yg,R1);var Xg=y.forwardRef(function(i,l){return y.createElement(Tr,cn({},i,{ref:l,sideCar:M1}))});Xg.classNames=Tr.classNames;var _1=function(i){if(typeof document>"u")return null;var l=Array.isArray(i)?i[0]:i;return l.ownerDocument.body},Dl=new WeakMap,or=new WeakMap,ur={},Pu=0,Zg=function(i){return i&&(i.host||Zg(i.parentNode))},j1=function(i,l){return l.map(function(r){if(i.contains(r))return r;var o=Zg(r);return o&&i.contains(o)?o:(console.error("aria-hidden",r,"in not contained inside",i,". Doing nothing"),null)}).filter(function(r){return!!r})},L1=function(i,l,r,o){var c=j1(l,Array.isArray(i)?i:[i]);ur[r]||(ur[r]=new WeakMap);var f=ur[r],m=[],h=new Set,b=new Set(c),v=function(g){!g||h.has(g)||(h.add(g),v(g.parentNode))};c.forEach(v);var x=function(g){!g||b.has(g)||Array.prototype.forEach.call(g.children,function(D){if(h.has(D))x(D);else try{var z=D.getAttribute(o),j=z!==null&&z!=="false",B=(Dl.get(D)||0)+1,K=(f.get(D)||0)+1;Dl.set(D,B),f.set(D,K),m.push(D),B===1&&j&&or.set(D,!0),K===1&&D.setAttribute(r,"true"),j||D.setAttribute(o,"true")}catch(U){console.error("aria-hidden: cannot operate on ",D,U)}})};return x(l),h.clear(),Pu++,function(){m.forEach(function(g){var D=Dl.get(g)-1,z=f.get(g)-1;Dl.set(g,D),f.set(g,z),D||(or.has(g)||g.removeAttribute(o),or.delete(g)),z||g.removeAttribute(r)}),Pu--,Pu||(Dl=new WeakMap,Dl=new WeakMap,or=new WeakMap,ur={})}},U1=function(i,l,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(i)?i:[i]),c=_1(i);return c?(o.push.apply(o,Array.from(c.querySelectorAll("[aria-live], script"))),L1(o,c,r,"aria-hidden")):function(){return null}},Or="Dialog",[Fg]=Zb(Or),[B1,en]=Fg(Or),Jg=i=>{const{__scopeDialog:l,children:r,open:o,defaultOpen:c,onOpenChange:f,modal:m=!0}=i,h=y.useRef(null),b=y.useRef(null),[v,x]=Ib({prop:o,defaultProp:c??!1,onChange:f,caller:Or});return E.jsx(B1,{scope:l,triggerRef:h,contentRef:b,contentId:Mn(),titleId:Mn(),descriptionId:Mn(),open:v,onOpenChange:x,onOpenToggle:y.useCallback(()=>x(g=>!g),[x]),modal:m,children:r})};Jg.displayName=Or;var $g="DialogTrigger",H1=y.forwardRef((i,l)=>{const{__scopeDialog:r,...o}=i,c=en($g,r),f=Ba(l,c.triggerRef);return E.jsx(qi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":gc(c.open),...o,ref:f,onClick:ra(i.onClick,c.onOpenToggle)})});H1.displayName=$g;var hc="DialogPortal",[q1,Wg]=Fg(hc,{forceMount:void 0}),Ig=i=>{const{__scopeDialog:l,forceMount:r,children:o,container:c}=i,f=en(hc,l);return E.jsx(q1,{scope:l,forceMount:r,children:y.Children.map(o,m=>E.jsx(Er,{present:r||f.open,children:E.jsx(Bg,{asChild:!0,container:c,children:m})}))})};Ig.displayName=hc;var yr="DialogOverlay",Pg=y.forwardRef((i,l)=>{const r=Wg(yr,i.__scopeDialog),{forceMount:o=r.forceMount,...c}=i,f=en(yr,i.__scopeDialog);return f.modal?E.jsx(Er,{present:o||f.open,children:E.jsx(Y1,{...c,ref:l})}):null});Pg.displayName=yr;var V1=Hg("DialogOverlay.RemoveScroll"),Y1=y.forwardRef((i,l)=>{const{__scopeDialog:r,...o}=i,c=en(yr,r);return E.jsx(Xg,{as:V1,allowPinchZoom:!0,shards:[c.contentRef],children:E.jsx(qi.div,{"data-state":gc(c.open),...o,ref:l,style:{pointerEvents:"auto",...o.style}})})}),La="DialogContent",ep=y.forwardRef((i,l)=>{const r=Wg(La,i.__scopeDialog),{forceMount:o=r.forceMount,...c}=i,f=en(La,i.__scopeDialog);return E.jsx(Er,{present:o||f.open,children:f.modal?E.jsx(k1,{...c,ref:l}):E.jsx(K1,{...c,ref:l})})});ep.displayName=La;var k1=y.forwardRef((i,l)=>{const r=en(La,i.__scopeDialog),o=y.useRef(null),c=Ba(l,r.contentRef,o);return y.useEffect(()=>{const f=o.current;if(f)return U1(f)},[]),E.jsx(tp,{...i,ref:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ra(i.onCloseAutoFocus,f=>{f.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:ra(i.onPointerDownOutside,f=>{const m=f.detail.originalEvent,h=m.button===0&&m.ctrlKey===!0;(m.button===2||h)&&f.preventDefault()}),onFocusOutside:ra(i.onFocusOutside,f=>f.preventDefault())})}),K1=y.forwardRef((i,l)=>{const r=en(La,i.__scopeDialog),o=y.useRef(!1),c=y.useRef(!1);return E.jsx(tp,{...i,ref:l,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{i.onCloseAutoFocus?.(f),f.defaultPrevented||(o.current||r.triggerRef.current?.focus(),f.preventDefault()),o.current=!1,c.current=!1},onInteractOutside:f=>{i.onInteractOutside?.(f),f.defaultPrevented||(o.current=!0,f.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const m=f.target;r.triggerRef.current?.contains(m)&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&c.current&&f.preventDefault()}})}),tp=y.forwardRef((i,l)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:c,onCloseAutoFocus:f,...m}=i,h=en(La,r),b=y.useRef(null),v=Ba(l,b);return $S(),E.jsxs(E.Fragment,{children:[E.jsx(Lg,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:c,onUnmountAutoFocus:f,children:E.jsx(_g,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionId,"aria-labelledby":h.titleId,"data-state":gc(h.open),...m,ref:v,onDismiss:()=>h.onOpenChange(!1)})}),E.jsxs(E.Fragment,{children:[E.jsx(Z1,{titleId:h.titleId}),E.jsx(J1,{contentRef:b,descriptionId:h.descriptionId})]})]})}),mc="DialogTitle",G1=y.forwardRef((i,l)=>{const{__scopeDialog:r,...o}=i,c=en(mc,r);return E.jsx(qi.h2,{id:c.titleId,...o,ref:l})});G1.displayName=mc;var np="DialogDescription",Q1=y.forwardRef((i,l)=>{const{__scopeDialog:r,...o}=i,c=en(np,r);return E.jsx(qi.p,{id:c.descriptionId,...o,ref:l})});Q1.displayName=np;var ap="DialogClose",X1=y.forwardRef((i,l)=>{const{__scopeDialog:r,...o}=i,c=en(ap,r);return E.jsx(qi.button,{type:"button",...o,ref:l,onClick:ra(i.onClick,()=>c.onOpenChange(!1))})});X1.displayName=ap;function gc(i){return i?"open":"closed"}var lp="DialogTitleWarning",[FE,ip]=Xb(lp,{contentName:La,titleName:mc,docsSlug:"dialog"}),Z1=({titleId:i})=>{const l=ip(lp),r=`\`${l.contentName}\` requires a \`${l.titleName}\` for the component to be accessible for screen reader users. +`)},w1=0,Dl=[];function R1(i){var l=y.useRef([]),r=y.useRef([0,0]),o=y.useRef(),c=y.useState(w1++)[0],f=y.useState(kg)[0],m=y.useRef(i);y.useEffect(function(){m.current=i},[i]),y.useEffect(function(){if(i.inert){document.body.classList.add("block-interactivity-".concat(c));var B=WS([i.lockRef.current],(i.shards||[]).map($m),!0).filter(Boolean);return B.forEach(function(K){return K.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),B.forEach(function(K){return K.classList.remove("allow-interactivity-".concat(c))})}}},[i.inert,i.lockRef.current,i.shards]);var h=y.useCallback(function(B,K){if("touches"in B&&B.touches.length===2||B.type==="wheel"&&B.ctrlKey)return!m.current.allowPinchZoom;var U=rr(B),Q=r.current,Z="deltaX"in B?B.deltaX:Q[0]-U[0],I="deltaY"in B?B.deltaY:Q[1]-U[1],ee,J=B.target,X=Math.abs(Z)>Math.abs(I)?"h":"v";if("touches"in B&&X==="h"&&J.type==="range")return!1;var ve=window.getSelection(),ae=ve&&ve.anchorNode,te=ae?ae===J||ae.contains(J):!1;if(te)return!1;var fe=Fm(X,J);if(!fe)return!0;if(fe?ee=X:(ee=X==="v"?"h":"v",fe=Fm(X,J)),!fe)return!1;if(!o.current&&"changedTouches"in B&&(Z||I)&&(o.current=ee),!ee)return!0;var re=o.current||ee;return N1(re,K,B,re==="h"?Z:I)},[]),b=y.useCallback(function(B){var K=B;if(!(!Dl.length||Dl[Dl.length-1]!==f)){var U="deltaY"in K?Jm(K):rr(K),Q=l.current.filter(function(ee){return ee.name===K.type&&(ee.target===K.target||K.target===ee.shadowParent)&&D1(ee.delta,U)})[0];if(Q&&Q.should){K.cancelable&&K.preventDefault();return}if(!Q){var Z=(m.current.shards||[]).map($m).filter(Boolean).filter(function(ee){return ee.contains(K.target)}),I=Z.length>0?h(K,Z[0]):!m.current.noIsolation;I&&K.cancelable&&K.preventDefault()}}},[]),v=y.useCallback(function(B,K,U,Q){var Z={name:B,delta:K,target:U,should:Q,shadowParent:z1(U)};l.current.push(Z),setTimeout(function(){l.current=l.current.filter(function(I){return I!==Z})},1)},[]),x=y.useCallback(function(B){r.current=rr(B),o.current=void 0},[]),g=y.useCallback(function(B){v(B.type,Jm(B),B.target,h(B,i.lockRef.current))},[]),A=y.useCallback(function(B){v(B.type,rr(B),B.target,h(B,i.lockRef.current))},[]);y.useEffect(function(){return Dl.push(f),i.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:A}),document.addEventListener("wheel",b,Nl),document.addEventListener("touchmove",b,Nl),document.addEventListener("touchstart",x,Nl),function(){Dl=Dl.filter(function(B){return B!==f}),document.removeEventListener("wheel",b,Nl),document.removeEventListener("touchmove",b,Nl),document.removeEventListener("touchstart",x,Nl)}},[]);var z=i.removeScrollBar,j=i.inert;return y.createElement(y.Fragment,null,j?y.createElement(f,{styles:A1(c)}):null,z?y.createElement(b1,{noRelative:i.noRelative,gapMode:i.gapMode}):null)}function z1(i){for(var l=null;i!==null;)i instanceof ShadowRoot&&(l=i.host,i=i.host),i=i.parentNode;return l}const M1=s1(Yg,R1);var Xg=y.forwardRef(function(i,l){return y.createElement(Tr,cn({},i,{ref:l,sideCar:M1}))});Xg.classNames=Tr.classNames;var _1=function(i){if(typeof document>"u")return null;var l=Array.isArray(i)?i[0]:i;return l.ownerDocument.body},Al=new WeakMap,or=new WeakMap,ur={},Pu=0,Zg=function(i){return i&&(i.host||Zg(i.parentNode))},j1=function(i,l){return l.map(function(r){if(i.contains(r))return r;var o=Zg(r);return o&&i.contains(o)?o:(console.error("aria-hidden",r,"in not contained inside",i,". Doing nothing"),null)}).filter(function(r){return!!r})},L1=function(i,l,r,o){var c=j1(l,Array.isArray(i)?i:[i]);ur[r]||(ur[r]=new WeakMap);var f=ur[r],m=[],h=new Set,b=new Set(c),v=function(g){!g||h.has(g)||(h.add(g),v(g.parentNode))};c.forEach(v);var x=function(g){!g||b.has(g)||Array.prototype.forEach.call(g.children,function(A){if(h.has(A))x(A);else try{var z=A.getAttribute(o),j=z!==null&&z!=="false",B=(Al.get(A)||0)+1,K=(f.get(A)||0)+1;Al.set(A,B),f.set(A,K),m.push(A),B===1&&j&&or.set(A,!0),K===1&&A.setAttribute(r,"true"),j||A.setAttribute(o,"true")}catch(U){console.error("aria-hidden: cannot operate on ",A,U)}})};return x(l),h.clear(),Pu++,function(){m.forEach(function(g){var A=Al.get(g)-1,z=f.get(g)-1;Al.set(g,A),f.set(g,z),A||(or.has(g)||g.removeAttribute(o),or.delete(g)),z||g.removeAttribute(r)}),Pu--,Pu||(Al=new WeakMap,Al=new WeakMap,or=new WeakMap,ur={})}},U1=function(i,l,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(i)?i:[i]),c=_1(i);return c?(o.push.apply(o,Array.from(c.querySelectorAll("[aria-live], script"))),L1(o,c,r,"aria-hidden")):function(){return null}},Or="Dialog",[Fg]=Zb(Or),[B1,en]=Fg(Or),Jg=i=>{const{__scopeDialog:l,children:r,open:o,defaultOpen:c,onOpenChange:f,modal:m=!0}=i,h=y.useRef(null),b=y.useRef(null),[v,x]=Ib({prop:o,defaultProp:c??!1,onChange:f,caller:Or});return E.jsx(B1,{scope:l,triggerRef:h,contentRef:b,contentId:Mn(),titleId:Mn(),descriptionId:Mn(),open:v,onOpenChange:x,onOpenToggle:y.useCallback(()=>x(g=>!g),[x]),modal:m,children:r})};Jg.displayName=Or;var $g="DialogTrigger",H1=y.forwardRef((i,l)=>{const{__scopeDialog:r,...o}=i,c=en($g,r),f=Ba(l,c.triggerRef);return E.jsx(qi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":gc(c.open),...o,ref:f,onClick:ra(i.onClick,c.onOpenToggle)})});H1.displayName=$g;var hc="DialogPortal",[q1,Wg]=Fg(hc,{forceMount:void 0}),Ig=i=>{const{__scopeDialog:l,forceMount:r,children:o,container:c}=i,f=en(hc,l);return E.jsx(q1,{scope:l,forceMount:r,children:y.Children.map(o,m=>E.jsx(Er,{present:r||f.open,children:E.jsx(Bg,{asChild:!0,container:c,children:m})}))})};Ig.displayName=hc;var yr="DialogOverlay",Pg=y.forwardRef((i,l)=>{const r=Wg(yr,i.__scopeDialog),{forceMount:o=r.forceMount,...c}=i,f=en(yr,i.__scopeDialog);return f.modal?E.jsx(Er,{present:o||f.open,children:E.jsx(Y1,{...c,ref:l})}):null});Pg.displayName=yr;var V1=Hg("DialogOverlay.RemoveScroll"),Y1=y.forwardRef((i,l)=>{const{__scopeDialog:r,...o}=i,c=en(yr,r);return E.jsx(Xg,{as:V1,allowPinchZoom:!0,shards:[c.contentRef],children:E.jsx(qi.div,{"data-state":gc(c.open),...o,ref:l,style:{pointerEvents:"auto",...o.style}})})}),La="DialogContent",ep=y.forwardRef((i,l)=>{const r=Wg(La,i.__scopeDialog),{forceMount:o=r.forceMount,...c}=i,f=en(La,i.__scopeDialog);return E.jsx(Er,{present:o||f.open,children:f.modal?E.jsx(k1,{...c,ref:l}):E.jsx(K1,{...c,ref:l})})});ep.displayName=La;var k1=y.forwardRef((i,l)=>{const r=en(La,i.__scopeDialog),o=y.useRef(null),c=Ba(l,r.contentRef,o);return y.useEffect(()=>{const f=o.current;if(f)return U1(f)},[]),E.jsx(tp,{...i,ref:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ra(i.onCloseAutoFocus,f=>{f.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:ra(i.onPointerDownOutside,f=>{const m=f.detail.originalEvent,h=m.button===0&&m.ctrlKey===!0;(m.button===2||h)&&f.preventDefault()}),onFocusOutside:ra(i.onFocusOutside,f=>f.preventDefault())})}),K1=y.forwardRef((i,l)=>{const r=en(La,i.__scopeDialog),o=y.useRef(!1),c=y.useRef(!1);return E.jsx(tp,{...i,ref:l,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{i.onCloseAutoFocus?.(f),f.defaultPrevented||(o.current||r.triggerRef.current?.focus(),f.preventDefault()),o.current=!1,c.current=!1},onInteractOutside:f=>{i.onInteractOutside?.(f),f.defaultPrevented||(o.current=!0,f.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const m=f.target;r.triggerRef.current?.contains(m)&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&c.current&&f.preventDefault()}})}),tp=y.forwardRef((i,l)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:c,onCloseAutoFocus:f,...m}=i,h=en(La,r),b=y.useRef(null),v=Ba(l,b);return $S(),E.jsxs(E.Fragment,{children:[E.jsx(Lg,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:c,onUnmountAutoFocus:f,children:E.jsx(_g,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionId,"aria-labelledby":h.titleId,"data-state":gc(h.open),...m,ref:v,onDismiss:()=>h.onOpenChange(!1)})}),E.jsxs(E.Fragment,{children:[E.jsx(Z1,{titleId:h.titleId}),E.jsx(J1,{contentRef:b,descriptionId:h.descriptionId})]})]})}),mc="DialogTitle",G1=y.forwardRef((i,l)=>{const{__scopeDialog:r,...o}=i,c=en(mc,r);return E.jsx(qi.h2,{id:c.titleId,...o,ref:l})});G1.displayName=mc;var np="DialogDescription",Q1=y.forwardRef((i,l)=>{const{__scopeDialog:r,...o}=i,c=en(np,r);return E.jsx(qi.p,{id:c.descriptionId,...o,ref:l})});Q1.displayName=np;var ap="DialogClose",X1=y.forwardRef((i,l)=>{const{__scopeDialog:r,...o}=i,c=en(ap,r);return E.jsx(qi.button,{type:"button",...o,ref:l,onClick:ra(i.onClick,()=>c.onOpenChange(!1))})});X1.displayName=ap;function gc(i){return i?"open":"closed"}var lp="DialogTitleWarning",[FE,ip]=Xb(lp,{contentName:La,titleName:mc,docsSlug:"dialog"}),Z1=({titleId:i})=>{const l=ip(lp),r=`\`${l.contentName}\` requires a \`${l.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${l.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${l.docsSlug}`;return y.useEffect(()=>{i&&(document.getElementById(i)||console.error(r))},[r,i]),null},F1="DialogDescriptionWarning",J1=({contentRef:i,descriptionId:l})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ip(F1).contentName}}.`;return y.useEffect(()=>{const c=i.current?.getAttribute("aria-describedby");l&&c&&(document.getElementById(l)||console.warn(o))},[o,i,l]),null},$1=Jg,W1=Ig,I1=Pg,P1=ep,ex=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ua=ex.reduce((i,l)=>{const r=Dg(`Primitive.${l}`),o=y.forwardRef((c,f)=>{const{asChild:m,...h}=c,b=m?r:l;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),E.jsx(b,{...h,ref:f})});return o.displayName=`Primitive.${l}`,{...i,[l]:o}},{}),zi='[cmdk-group=""]',ec='[cmdk-group-items=""]',tx='[cmdk-group-heading=""]',sp='[cmdk-item=""]',Wm=`${sp}:not([aria-disabled="true"])`,uc="cmdk-item-select",zl="data-value",nx=(i,l,r)=>Qb(i,l,r),rp=y.createContext(void 0),Vi=()=>y.useContext(rp),op=y.createContext(void 0),pc=()=>y.useContext(op),up=y.createContext(void 0),cp=y.forwardRef((i,l)=>{let r=Ml(()=>{var _,q;return{search:"",value:(q=(_=i.value)!=null?_:i.defaultValue)!=null?q:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=Ml(()=>new Set),c=Ml(()=>new Map),f=Ml(()=>new Map),m=Ml(()=>new Set),h=fp(i),{label:b,children:v,value:x,onValueChange:g,filter:D,shouldFilter:z,loop:j,disablePointerSelection:B=!1,vimBindings:K=!0,...U}=i,Q=Mn(),Z=Mn(),I=Mn(),ee=y.useRef(null),J=hx();Ua(()=>{if(x!==void 0){let _=x.trim();r.current.value=_,X.emit()}},[x]),Ua(()=>{J(6,Ee)},[]);let X=y.useMemo(()=>({subscribe:_=>(m.current.add(_),()=>m.current.delete(_)),snapshot:()=>r.current,setState:(_,q,G)=>{var k,le,Se,ue;if(!Object.is(r.current[_],q)){if(r.current[_]=q,_==="search")re(),te(),J(1,fe);else if(_==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Ae=document.getElementById(I);Ae?Ae.focus():(k=document.getElementById(Q))==null||k.focus()}if(J(7,()=>{var Ae;r.current.selectedItemId=(Ae=Te())==null?void 0:Ae.id,X.emit()}),G||J(5,Ee),((le=h.current)==null?void 0:le.value)!==void 0){let Ae=q??"";(ue=(Se=h.current).onValueChange)==null||ue.call(Se,Ae);return}}X.emit()}},emit:()=>{m.current.forEach(_=>_())}}),[]),ve=y.useMemo(()=>({value:(_,q,G)=>{var k;q!==((k=f.current.get(_))==null?void 0:k.value)&&(f.current.set(_,{value:q,keywords:G}),r.current.filtered.items.set(_,ae(q,G)),J(2,()=>{te(),X.emit()}))},item:(_,q)=>(o.current.add(_),q&&(c.current.has(q)?c.current.get(q).add(_):c.current.set(q,new Set([_]))),J(3,()=>{re(),te(),r.current.value||fe(),X.emit()}),()=>{f.current.delete(_),o.current.delete(_),r.current.filtered.items.delete(_);let G=Te();J(4,()=>{re(),G?.getAttribute("id")===_&&fe(),X.emit()})}),group:_=>(c.current.has(_)||c.current.set(_,new Set),()=>{f.current.delete(_),c.current.delete(_)}),filter:()=>h.current.shouldFilter,label:b||i["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:Q,inputId:I,labelId:Z,listInnerRef:ee}),[]);function ae(_,q){var G,k;let le=(k=(G=h.current)==null?void 0:G.filter)!=null?k:nx;return _?le(_,r.current.search,q):0}function te(){if(!r.current.search||h.current.shouldFilter===!1)return;let _=r.current.filtered.items,q=[];r.current.filtered.groups.forEach(k=>{let le=c.current.get(k),Se=0;le.forEach(ue=>{let Ae=_.get(ue);Se=Math.max(Ae,Se)}),q.push([k,Se])});let G=ee.current;je().sort((k,le)=>{var Se,ue;let Ae=k.getAttribute("id"),At=le.getAttribute("id");return((Se=_.get(At))!=null?Se:0)-((ue=_.get(Ae))!=null?ue:0)}).forEach(k=>{let le=k.closest(ec);le?le.appendChild(k.parentElement===le?k:k.closest(`${ec} > *`)):G.appendChild(k.parentElement===G?k:k.closest(`${ec} > *`))}),q.sort((k,le)=>le[1]-k[1]).forEach(k=>{var le;let Se=(le=ee.current)==null?void 0:le.querySelector(`${zi}[${zl}="${encodeURIComponent(k[0])}"]`);Se?.parentElement.appendChild(Se)})}function fe(){let _=je().find(G=>G.getAttribute("aria-disabled")!=="true"),q=_?.getAttribute(zl);X.setState("value",q||void 0)}function re(){var _,q,G,k;if(!r.current.search||h.current.shouldFilter===!1){r.current.filtered.count=o.current.size;return}r.current.filtered.groups=new Set;let le=0;for(let Se of o.current){let ue=(q=(_=f.current.get(Se))==null?void 0:_.value)!=null?q:"",Ae=(k=(G=f.current.get(Se))==null?void 0:G.keywords)!=null?k:[],At=ae(ue,Ae);r.current.filtered.items.set(Se,At),At>0&&le++}for(let[Se,ue]of c.current)for(let Ae of ue)if(r.current.filtered.items.get(Ae)>0){r.current.filtered.groups.add(Se);break}r.current.filtered.count=le}function Ee(){var _,q,G;let k=Te();k&&(((_=k.parentElement)==null?void 0:_.firstChild)===k&&((G=(q=k.closest(zi))==null?void 0:q.querySelector(tx))==null||G.scrollIntoView({block:"nearest"})),k.scrollIntoView({block:"nearest"}))}function Te(){var _;return(_=ee.current)==null?void 0:_.querySelector(`${sp}[aria-selected="true"]`)}function je(){var _;return Array.from(((_=ee.current)==null?void 0:_.querySelectorAll(Wm))||[])}function A(_){let q=je()[_];q&&X.setState("value",q.getAttribute(zl))}function V(_){var q;let G=Te(),k=je(),le=k.findIndex(ue=>ue===G),Se=k[le+_];(q=h.current)!=null&&q.loop&&(Se=le+_<0?k[k.length-1]:le+_===k.length?k[0]:k[le+_]),Se&&X.setState("value",Se.getAttribute(zl))}function $(_){let q=Te(),G=q?.closest(zi),k;for(;G&&!k;)G=_>0?fx(G,zi):dx(G,zi),k=G?.querySelector(Wm);k?X.setState("value",k.getAttribute(zl)):V(_)}let de=()=>A(je().length-1),oe=_=>{_.preventDefault(),_.metaKey?de():_.altKey?$(1):V(1)},me=_=>{_.preventDefault(),_.metaKey?A(0):_.altKey?$(-1):V(-1)};return y.createElement(ua.div,{ref:l,tabIndex:-1,...U,"cmdk-root":"",onKeyDown:_=>{var q;(q=U.onKeyDown)==null||q.call(U,_);let G=_.nativeEvent.isComposing||_.keyCode===229;if(!(_.defaultPrevented||G))switch(_.key){case"n":case"j":{K&&_.ctrlKey&&oe(_);break}case"ArrowDown":{oe(_);break}case"p":case"k":{K&&_.ctrlKey&&me(_);break}case"ArrowUp":{me(_);break}case"Home":{_.preventDefault(),A(0);break}case"End":{_.preventDefault(),de();break}case"Enter":{_.preventDefault();let k=Te();if(k){let le=new Event(uc);k.dispatchEvent(le)}}}}},y.createElement("label",{"cmdk-label":"",htmlFor:ve.inputId,id:ve.labelId,style:gx},b),Cr(i,_=>y.createElement(op.Provider,{value:X},y.createElement(rp.Provider,{value:ve},_))))}),ax=y.forwardRef((i,l)=>{var r,o;let c=Mn(),f=y.useRef(null),m=y.useContext(up),h=Vi(),b=fp(i),v=(o=(r=b.current)==null?void 0:r.forceMount)!=null?o:m?.forceMount;Ua(()=>{if(!v)return h.item(c,m?.id)},[v]);let x=dp(c,f,[i.value,i.children,f],i.keywords),g=pc(),D=oa(J=>J.value&&J.value===x.current),z=oa(J=>v||h.filter()===!1?!0:J.search?J.filtered.items.get(c)>0:!0);y.useEffect(()=>{let J=f.current;if(!(!J||i.disabled))return J.addEventListener(uc,j),()=>J.removeEventListener(uc,j)},[z,i.onSelect,i.disabled]);function j(){var J,X;B(),(X=(J=b.current).onSelect)==null||X.call(J,x.current)}function B(){g.setState("value",x.current,!0)}if(!z)return null;let{disabled:K,value:U,onSelect:Q,forceMount:Z,keywords:I,...ee}=i;return y.createElement(ua.div,{ref:Pt(f,l),...ee,id:c,"cmdk-item":"",role:"option","aria-disabled":!!K,"aria-selected":!!D,"data-disabled":!!K,"data-selected":!!D,onPointerMove:K||h.getDisablePointerSelection()?void 0:B,onClick:K?void 0:j},i.children)}),lx=y.forwardRef((i,l)=>{let{heading:r,children:o,forceMount:c,...f}=i,m=Mn(),h=y.useRef(null),b=y.useRef(null),v=Mn(),x=Vi(),g=oa(z=>c||x.filter()===!1?!0:z.search?z.filtered.groups.has(m):!0);Ua(()=>x.group(m),[]),dp(m,h,[i.value,i.heading,b]);let D=y.useMemo(()=>({id:m,forceMount:c}),[c]);return y.createElement(ua.div,{ref:Pt(h,l),...f,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},r&&y.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:v},r),Cr(i,z=>y.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?v:void 0},y.createElement(up.Provider,{value:D},z))))}),ix=y.forwardRef((i,l)=>{let{alwaysRender:r,...o}=i,c=y.useRef(null),f=oa(m=>!m.search);return!r&&!f?null:y.createElement(ua.div,{ref:Pt(c,l),...o,"cmdk-separator":"",role:"separator"})}),sx=y.forwardRef((i,l)=>{let{onValueChange:r,...o}=i,c=i.value!=null,f=pc(),m=oa(v=>v.search),h=oa(v=>v.selectedItemId),b=Vi();return y.useEffect(()=>{i.value!=null&&f.setState("search",i.value)},[i.value]),y.createElement(ua.input,{ref:l,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":h,id:b.inputId,type:"text",value:c?i.value:m,onChange:v=>{c||f.setState("search",v.target.value),r?.(v.target.value)}})}),rx=y.forwardRef((i,l)=>{let{children:r,label:o="Suggestions",...c}=i,f=y.useRef(null),m=y.useRef(null),h=oa(v=>v.selectedItemId),b=Vi();return y.useEffect(()=>{if(m.current&&f.current){let v=m.current,x=f.current,g,D=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let z=v.offsetHeight;x.style.setProperty("--cmdk-list-height",z.toFixed(1)+"px")})});return D.observe(v),()=>{cancelAnimationFrame(g),D.unobserve(v)}}},[]),y.createElement(ua.div,{ref:Pt(f,l),...c,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":o,id:b.listId},Cr(i,v=>y.createElement("div",{ref:Pt(m,b.listInnerRef),"cmdk-list-sizer":""},v)))}),ox=y.forwardRef((i,l)=>{let{open:r,onOpenChange:o,overlayClassName:c,contentClassName:f,container:m,...h}=i;return y.createElement($1,{open:r,onOpenChange:o},y.createElement(W1,{container:m},y.createElement(I1,{"cmdk-overlay":"",className:c}),y.createElement(P1,{"aria-label":i.label,"cmdk-dialog":"",className:f},y.createElement(cp,{ref:l,...h}))))}),ux=y.forwardRef((i,l)=>oa(r=>r.filtered.count===0)?y.createElement(ua.div,{ref:l,...i,"cmdk-empty":"",role:"presentation"}):null),cx=y.forwardRef((i,l)=>{let{progress:r,children:o,label:c="Loading...",...f}=i;return y.createElement(ua.div,{ref:l,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":c},Cr(i,m=>y.createElement("div",{"aria-hidden":!0},m)))}),Ut=Object.assign(cp,{List:rx,Item:ax,Input:sx,Group:lx,Separator:ix,Dialog:ox,Empty:ux,Loading:cx});function fx(i,l){let r=i.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function dx(i,l){let r=i.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function fp(i){let l=y.useRef(i);return Ua(()=>{l.current=i}),l}var Ua=typeof window>"u"?y.useEffect:y.useLayoutEffect;function Ml(i){let l=y.useRef();return l.current===void 0&&(l.current=i()),l}function oa(i){let l=pc(),r=()=>i(l.snapshot());return y.useSyncExternalStore(l.subscribe,r,r)}function dp(i,l,r,o=[]){let c=y.useRef(),f=Vi();return Ua(()=>{var m;let h=(()=>{var v;for(let x of r){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(v=x.current.textContent)==null?void 0:v.trim():c.current}})(),b=o.map(v=>v.trim());f.value(i,h,b),(m=l.current)==null||m.setAttribute(zl,h),c.current=h}),c}var hx=()=>{let[i,l]=y.useState(),r=Ml(()=>new Map);return Ua(()=>{r.current.forEach(o=>o()),r.current=new Map},[i]),(o,c)=>{r.current.set(o,c),l({})}};function mx(i){let l=i.type;return typeof l=="function"?l(i.props):"render"in l?l.render(i.props):i}function Cr({asChild:i,children:l},r){return i&&y.isValidElement(l)?y.cloneElement(mx(l),{ref:l.ref},r(l.props.children)):r(l)}var gx={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const px="https://pay.theio.vn",vx={vn:{product:"NM-PRO-YEARLY",original:"1.190.000 VND",price:"595.000 VND",method:"Bank Transfer (VietQR)",flag:"🇻🇳"},intl:{product:"NM-PRO-YEARLY",original:"$89 USD",price:"$49 USD",method:"Card / PayPal (Polar)",flag:"🌐"}};let cc=null;function Im(){cc?.()}function yx(){const[i,l]=y.useState(!1),[r,o]=y.useState("choose"),[c,f]=y.useState(""),[m,h]=y.useState(!1),[b,v]=y.useState(!1),[x,g]=y.useState(""),{t:D}=xr();return y.useEffect(()=>(cc=()=>l(!0),()=>{cc=null}),[]),y.useEffect(()=>{i||(o("choose"),f(""),g(""),v(!1))},[i]),y.useEffect(()=>{if(!i)return;const z=j=>{j.key==="Escape"&&l(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[i]),y.useCallback(async z=>{const j=vx[z],B=prompt(D("upgrade.enterEmail","Enter your email for the license:"));if(B){try{const Q=await(await fetch(`${px}${z==="intl"?"/checkout/polar":"/order/sepay"}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({product:j.product,email:B})})).json();Q.url?window.open(Q.url,"_blank"):Q.qr_url&&window.open(Q.qr_url,"_blank")}catch{z==="intl"&&window.open("https://polar.sh/nhadaututtheky","_blank")}l(!1)}},[D]),y.useCallback(async()=>{const z=c.trim();if(z){h(!0),g("");try{const j=await qe.post("/api/dashboard/license/activate",{license_key:z});j.success?(v(!0),setTimeout(()=>{l(!1),window.location.reload()},1500)):g(j.error||D("upgrade.activationFailed","Activation failed"))}catch{g(D("upgrade.activationFailed","Activation failed. Check key format."))}finally{h(!1)}}},[c,D]),null}const bx=[{path:"/",icon:og,labelKey:"nav.overview"},{path:"/health",icon:ug,labelKey:"nav.health"},{path:"/graph",icon:cg,labelKey:"nav.graph"},{path:"/timeline",icon:fg,labelKey:"nav.timeline"},{path:"/evolution",icon:dg,labelKey:"nav.evolution"},{path:"/diagrams",icon:hg,labelKey:"nav.mindmap"},{path:"/sync",icon:mg,labelKey:"nav.sync"},{path:"/oracle",icon:gg,labelKey:"nav.oracle"},{path:"/tool-stats",icon:pg,labelKey:"nav.toolStats"},{path:"/settings",icon:vg,labelKey:"nav.settings"}],Pm={fact:"#06b6d4",decision:"#f59e0b",error:"#ef4444",insight:"#8b5cf6",preference:"#ec4899",workflow:"#059669",instruction:"#6366f1",pattern:"#14b8a6",concept:"#6366f1",entity:"#06b6d4"};function Sx(){const[i,l]=y.useState(!1),[r,o]=y.useState(""),[c,f]=y.useState([]),[m,h]=y.useState(!1),b=y.useRef(null),v=My(),{data:x}=jb(),{t:g}=xr();y.useEffect(()=>{const U=Q=>{(Q.metaKey||Q.ctrlKey)&&Q.key==="k"&&(Q.preventDefault(),l(Z=>!Z))};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[]),y.useEffect(()=>{i||(o(""),f([]))},[i]);const D=y.useCallback(U=>{if(b.current&&clearTimeout(b.current),U.length<2){f([]),h(!1);return}h(!0),b.current=setTimeout(async()=>{try{const Q=await qe.get(`/neurons?content_contains=${encodeURIComponent(U)}&limit=8`);f(Q.neurons??[])}catch{f([])}finally{h(!1)}},300)},[]),z=U=>{o(U),D(U)},j=U=>{v(U),l(!1)},B=x?.fibers??[],K=r.length>0?B.filter(U=>U.summary.toLowerCase().includes(r.toLowerCase())):B.slice(0,5);return E.jsxs(E.Fragment,{children:[E.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground cursor-pointer","aria-label":g("commandPalette.placeholder"),children:[E.jsx(um,{className:"size-3.5","aria-hidden":"true"}),E.jsx("span",{className:"hidden sm:inline",children:g("commandPalette.search")}),E.jsxs("kbd",{className:"pointer-events-none hidden select-none rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] font-medium sm:inline-flex",children:[E.jsx(Yy,{className:"mr-0.5 inline size-2.5","aria-hidden":"true"}),"K"]})]}),i&&sg.createPortal(E.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh] bg-black/50 backdrop-blur-sm",onClick:U=>{U.target===U.currentTarget&&l(!1)},children:E.jsxs(Ut,{className:"w-full max-w-lg rounded-xl border border-border bg-card shadow-lg overflow-hidden",shouldFilter:!1,children:[E.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[E.jsx(um,{className:"mr-2 size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),E.jsx(Ut.Input,{value:r,onValueChange:z,placeholder:g("commandPalette.placeholder"),className:"flex h-11 w-full bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground"}),m&&E.jsx("div",{className:"size-4 shrink-0 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})]}),E.jsxs(Ut.List,{className:"max-h-80 overflow-y-auto px-2 py-2",children:[E.jsx(Ut.Empty,{className:"py-6 text-center text-sm text-muted-foreground",children:g("commandPalette.noResults")}),E.jsx(Ut.Group,{heading:E.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("commandPalette.pages")}),children:bx.map(({path:U,icon:Q,labelKey:Z})=>E.jsxs(Ut.Item,{value:`page-${g(Z)}`,onSelect:()=>j(U),className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm cursor-pointer aria-selected:bg-accent",children:[E.jsx(Q,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),E.jsx("span",{children:g(Z)})]},U))}),K.length>0&&E.jsx(Ut.Group,{heading:E.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("commandPalette.fibers")}),children:K.slice(0,6).map(U=>E.jsxs(Ut.Item,{value:`fiber-${U.summary}`,onSelect:()=>{v("/diagrams"),l(!1)},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm cursor-pointer aria-selected:bg-accent",children:[E.jsx(ky,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),E.jsx("span",{className:"flex-1 truncate",children:U.summary}),E.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:U.neuron_count})]},U.id))}),c.length>0&&E.jsx(Ut.Group,{heading:E.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("commandPalette.neurons")}),children:c.map(U=>E.jsxs(Ut.Item,{value:`neuron-${U.id}`,onSelect:()=>{v("/graph"),l(!1)},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm cursor-pointer aria-selected:bg-accent",children:[E.jsx(rg,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),E.jsx("span",{className:"flex-1 truncate text-xs",children:U.content}),E.jsx("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-semibold",style:{backgroundColor:`${Pm[U.type]??"#94a3b8"}20`,color:Pm[U.type]??"#94a3b8"},children:U.type})]},U.id))}),E.jsxs(Ut.Group,{heading:E.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Pro"}),children:[E.jsxs(Ut.Item,{value:"pro-semantic-search",onSelect:()=>{l(!1),Im()},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm opacity-60 cursor-pointer aria-selected:bg-accent aria-selected:opacity-100",children:[E.jsx(cm,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),E.jsx("span",{className:"flex-1",children:g("commandPalette.semanticSearch")}),E.jsx("span",{className:"rounded-md bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary",children:"PRO"})]}),E.jsxs(Ut.Item,{value:"pro-cross-brain-search",onSelect:()=>{l(!1),Im()},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm opacity-60 cursor-pointer aria-selected:bg-accent aria-selected:opacity-100",children:[E.jsx(cm,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),E.jsx("span",{className:"flex-1",children:g("commandPalette.crossBrainSearch")}),E.jsx("span",{className:"rounded-md bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary",children:"PRO"})]})]})]}),E.jsx("div",{className:"flex items-center justify-between border-t border-border px-4 py-2",children:E.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[E.jsxs("span",{children:[E.jsx("kbd",{className:"rounded border border-border bg-muted px-1 py-0.5 font-mono",children:"↑↓"})," ",g("commandPalette.navigate")]}),E.jsxs("span",{children:[E.jsx("kbd",{className:"rounded border border-border bg-muted px-1 py-0.5 font-mono",children:"↵"})," ",g("commandPalette.select")]}),E.jsxs("span",{children:[E.jsx("kbd",{className:"rounded border border-border bg-muted px-1 py-0.5 font-mono",children:"esc"})," ",g("commandPalette.close")]})]})})]})}),document.body)]})}const xx={light:Xy,dark:Qy,system:Gy},eg={light:"common.lightMode",dark:"common.darkMode",system:"common.systemTheme"};function Ex(){const{sidebarOpen:i,toggleSidebar:l,theme:r,cycleTheme:o}=br(),{data:c}=Mb(),{data:f}=_b(),{t:m}=xr(),h=xx[r];return E.jsxs("header",{className:"sticky top-0 z-20 flex h-14 items-center gap-4 border-b border-border bg-background/80 px-4 backdrop-blur-sm",children:[E.jsx(cr,{variant:"ghost",size:"icon",onClick:l,"aria-label":m(i?"common.collapseSidebar":"common.expandSidebar"),children:i?E.jsx(fm,{className:"size-5",weight:"bold"}):E.jsx(fm,{className:"size-5"})}),c?.active_brain&&E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsxs("span",{className:"text-sm text-muted-foreground",children:[m("common.brain"),":"]}),E.jsx(Ub,{variant:"secondary",className:"font-mono text-xs",children:c.active_brain})]}),E.jsx(Sx,{}),E.jsx("div",{className:"flex-1"}),E.jsx(cr,{variant:"ghost",size:"icon",asChild:!0,"aria-label":"Quickstart Guide",title:"Quickstart Guide",children:E.jsx("a",{href:"https://github.com/acidkill/surreal-memory/blob/main/docs/guides/quickstart-guide.md",target:"_blank",rel:"noopener noreferrer",children:E.jsx(Ky,{className:"size-4"})})}),E.jsx(cr,{variant:"ghost",size:"icon",onClick:o,"aria-label":m(eg[r]),title:m(eg[r]),"data-testid":"theme-toggle",children:E.jsx(h,{className:"size-4"})}),f?.version&&E.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["v",f.version]})]})}function Tx(){const i=br(l=>l.sidebarOpen);return E.jsxs("div",{className:"h-screen bg-background overflow-hidden",children:[E.jsx(xb,{}),E.jsxs("div",{className:ji("flex flex-col h-full transition-all duration-[var(--transition-normal)]",i?"ml-56":"ml-16"),children:[E.jsx(Ex,{}),E.jsx("main",{className:"flex-1 overflow-auto",children:E.jsx(_y,{})})]}),E.jsx(yx,{})]})}function Ot(){return E.jsxs("div",{className:"space-y-6 p-6 animate-pulse",children:[E.jsx("div",{className:"h-8 w-48 rounded-lg bg-muted"}),E.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4}).map((i,l)=>E.jsx("div",{className:"h-28 rounded-xl bg-muted"},l))}),E.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[E.jsx("div",{className:"h-64 rounded-xl bg-muted"}),E.jsx("div",{className:"h-64 rounded-xl bg-muted"})]})]})}const Ox=y.lazy(()=>Nt(()=>import("./OverviewPage-BixPEj84.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),Cx=y.lazy(()=>Nt(()=>import("./HealthPage-DoDlPq43.js"),__vite__mapDeps([9,1,2,3,4,6,8,7]))),Nx=y.lazy(()=>Nt(()=>import("./UncertaintyPage-CdFbDPD5.js"),__vite__mapDeps([10,1,2,3,4,6,7,8]))),Ax=y.lazy(()=>Nt(()=>import("./GraphPage-B5RqF55O.js"),__vite__mapDeps([11,1,2,3,4,6,7,8]))),Dx=y.lazy(()=>Nt(()=>import("./TimelinePage-2mV1L6iZ.js"),__vite__mapDeps([12,1,2,3,4,6,8,7]))),wx=y.lazy(()=>Nt(()=>import("./EvolutionPage-C6VI1EZi.js"),__vite__mapDeps([13,1,2,14,3,4,8,7,6]))),Rx=y.lazy(()=>Nt(()=>import("./DiagramsPage-ClJ9QIg8.js"),__vite__mapDeps([15,1,2,3,4,16,8,7,6,17]))),zx=y.lazy(()=>Nt(()=>import("./SettingsPage-CcFz-Brq.js"),__vite__mapDeps([18,1,2,3,6,4,14,7,8]))),Mx=y.lazy(()=>Nt(()=>import("./SyncPage-BRERoUGJ.js"),__vite__mapDeps([19,1,2,3,6,7,8]))),_x=y.lazy(()=>Nt(()=>import("./OraclePage-BOi3rQAz.js"),__vite__mapDeps([20,1,2,6,7,8]))),jx=y.lazy(()=>Nt(()=>import("./ToolStatsPage-yrXaz2Sj.js"),__vite__mapDeps([21,1,2,3,4,8,7,6]))),Lx=y.lazy(()=>Nt(()=>import("./VisualizePage-CayiR_fG.js"),__vite__mapDeps([22,1,2,14,3,6,7,8]))),Ux=y.lazy(()=>Nt(()=>import("./StoragePage-BsRzooql.js"),__vite__mapDeps([23,1,2,3,6,4,7,8]))),Bx=y.lazy(()=>Nt(()=>import("./ReasoningPage-BjC1wtHj.js"),__vite__mapDeps([24,1,2,3,4,6,5,7,8])));function Hx(){return E.jsx(jy,{children:E.jsxs(ot,{element:E.jsx(Tx,{}),children:[E.jsx(ot,{index:!0,element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Ox,{})})}),E.jsx(ot,{path:"health",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Cx,{})})}),E.jsx(ot,{path:"uncertainty",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Nx,{})})}),E.jsx(ot,{path:"graph",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Ax,{})})}),E.jsx(ot,{path:"timeline",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Dx,{})})}),E.jsx(ot,{path:"evolution",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(wx,{})})}),E.jsx(ot,{path:"diagrams",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Rx,{})})}),E.jsx(ot,{path:"settings",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(zx,{})})}),E.jsx(ot,{path:"sync",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Mx,{})})}),E.jsx(ot,{path:"oracle",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(_x,{})})}),E.jsx(ot,{path:"tool-stats",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(jx,{})})}),E.jsx(ot,{path:"visualize",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Lx,{})})}),E.jsx(ot,{path:"storage",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Ux,{})})}),E.jsx(ot,{path:"reasoning",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Bx,{})})}),E.jsx(ot,{path:"*",element:E.jsx(Ly,{to:"/",replace:!0})})]})})}const{slice:qx,forEach:Vx}=[];function Yx(i){return Vx.call(qx.call(arguments,1),l=>{if(l)for(const r in l)i[r]===void 0&&(i[r]=l[r])}),i}function kx(i){return typeof i!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(r=>r.test(i))}const tg=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Kx=function(i,l){const o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},c=encodeURIComponent(l);let f=`${i}=${c}`;if(o.maxAge>0){const m=o.maxAge-0;if(Number.isNaN(m))throw new Error("maxAge should be a Number");f+=`; Max-Age=${Math.floor(m)}`}if(o.domain){if(!tg.test(o.domain))throw new TypeError("option domain is invalid");f+=`; Domain=${o.domain}`}if(o.path){if(!tg.test(o.path))throw new TypeError("option path is invalid");f+=`; Path=${o.path}`}if(o.expires){if(typeof o.expires.toUTCString!="function")throw new TypeError("option expires is invalid");f+=`; Expires=${o.expires.toUTCString()}`}if(o.httpOnly&&(f+="; HttpOnly"),o.secure&&(f+="; Secure"),o.sameSite)switch(typeof o.sameSite=="string"?o.sameSite.toLowerCase():o.sameSite){case!0:f+="; SameSite=Strict";break;case"lax":f+="; SameSite=Lax";break;case"strict":f+="; SameSite=Strict";break;case"none":f+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o.partitioned&&(f+="; Partitioned"),f},ng={create(i,l,r,o){let c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(c.expires=new Date,c.expires.setTime(c.expires.getTime()+r*60*1e3)),o&&(c.domain=o),document.cookie=Kx(i,l,c)},read(i){const l=`${i}=`,r=document.cookie.split(";");for(let o=0;o-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const f=o.substring(1).split("&");for(let m=0;m0&&f[m].substring(0,h)===l&&(r=f[m].substring(h+1))}}return r}},Xx={name:"hash",lookup(i){let{lookupHash:l,lookupFromHashIndex:r}=i,o;if(typeof window<"u"){const{hash:c}=window.location;if(c&&c.length>2){const f=c.substring(1);if(l){const m=f.split("&");for(let h=0;h0&&m[h].substring(0,b)===l&&(o=m[h].substring(b+1))}}if(o)return o;if(!o&&r>-1){const m=c.match(/\/([a-zA-Z-]*)/g);return Array.isArray(m)?m[typeof r=="number"?r:0]?.replace("/",""):void 0}}}return o}};let wl=null;const ag=()=>{if(wl!==null)return wl;try{if(wl=typeof window<"u"&&window.localStorage!==null,!wl)return!1;const i="i18next.translate.boo";window.localStorage.setItem(i,"foo"),window.localStorage.removeItem(i)}catch{wl=!1}return wl};var Zx={name:"localStorage",lookup(i){let{lookupLocalStorage:l}=i;if(l&&ag())return window.localStorage.getItem(l)||void 0},cacheUserLanguage(i,l){let{lookupLocalStorage:r}=l;r&&ag()&&window.localStorage.setItem(r,i)}};let Rl=null;const lg=()=>{if(Rl!==null)return Rl;try{if(Rl=typeof window<"u"&&window.sessionStorage!==null,!Rl)return!1;const i="i18next.translate.boo";window.sessionStorage.setItem(i,"foo"),window.sessionStorage.removeItem(i)}catch{Rl=!1}return Rl};var Fx={name:"sessionStorage",lookup(i){let{lookupSessionStorage:l}=i;if(l&&lg())return window.sessionStorage.getItem(l)||void 0},cacheUserLanguage(i,l){let{lookupSessionStorage:r}=l;r&&lg()&&window.sessionStorage.setItem(r,i)}},Jx={name:"navigator",lookup(i){const l=[];if(typeof navigator<"u"){const{languages:r,userLanguage:o,language:c}=navigator;if(r)for(let f=0;f0?l:void 0}},$x={name:"htmlTag",lookup(i){let{htmlTag:l}=i,r;const o=l||(typeof document<"u"?document.documentElement:null);return o&&typeof o.getAttribute=="function"&&(r=o.getAttribute("lang")),r}},Wx={name:"path",lookup(i){let{lookupFromPathIndex:l}=i;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?r[typeof l=="number"?l:0]?.replace("/",""):void 0}},Ix={name:"subdomain",lookup(i){let{lookupFromSubdomainIndex:l}=i;const r=typeof l=="number"?l+1:1,o=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(o)return o[r]}};let hp=!1;try{document.cookie,hp=!0}catch{}const mp=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];hp||mp.splice(1,1);const Px=()=>({order:mp,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:i=>i});class gp{constructor(l){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(l,r)}init(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=l,this.options=Yx(r,this.options||{},Px()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=c=>c.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=o,this.addDetector(Gx),this.addDetector(Qx),this.addDetector(Zx),this.addDetector(Fx),this.addDetector(Jx),this.addDetector($x),this.addDetector(Wx),this.addDetector(Ix),this.addDetector(Xx)}addDetector(l){return this.detectors[l.name]=l,this}detect(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,r=[];return l.forEach(o=>{if(this.detectors[o]){let c=this.detectors[o].lookup(this.options);c&&typeof c=="string"&&(c=[c]),c&&(r=r.concat(c))}}),r=r.filter(o=>o!=null&&!kx(o)).map(o=>this.options.convertDetectedLanguage(o)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(l){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(l)>-1||r.forEach(o=>{this.detectors[o]&&this.detectors[o].cacheUserLanguage(l,this.options)}))}}gp.type="languageDetector";const eE={overview:"Overview",health:"Health",uncertainty:"Uncertainty",graph:"Graph",timeline:"Timeline",evolution:"Evolution",mindmap:"Mindmap",sync:"Cloud Sync",oracle:"Oracle",toolStats:"Tool Stats",reasoningTraining:"Reasoning Training",visualize:"Visualize",storage:"Storage",settings:"Settings"},tE={confirm:"Confirm",cancel:"Cancel",delete:"Delete",loading:"Loading...",active:"Active",yes:"Yes",no:"No",none:"(none)",neurons:"neurons",brain:"Brain",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",mainNavigation:"Main navigation",lightMode:"Light mode",darkMode:"Dark mode",systemTheme:"System theme",retry:"Retry",prev:"Previous",next:"Next"},nE={pageTitle:"Reasoning Training",pageSubtitle:"Mine model thinking into reasoning strategies and inject them into other models.",statusError:"Failed to load reasoning status.",emptyState:"No reasoning traces yet. Enable mining below, then run a backfill to scan past sessions.",kpiTraces:"Total traces",kpiUnprocessed:"Unprocessed",kpiPatterns:"Learned patterns",kpiModels:"Detected models",coverageTitle:"Category coverage",miningTitle:"Mining",miningEnabled:"Enable mining (reads model thinking from ~/.claude transcripts)",miningModels:"Source models",miningModelsHint:"None selected = mine all models with thinking text.",noModels:"No models detected yet.",noThinkingText:"This model produces no thinking text and cannot be mined.",noThinkingShort:"no thinking",backfill:"Backfill (full history)",runMining:"Run mining",miningRunning:"Mining…",miningStarted:"Mining started.",miningInProgress:"A mining run is already in progress.",miningDisabled:"Enable mining first.",miningFailed:"Failed to start mining.",injectionTitle:"Injection",injectionEnabled:"Enable injection (add learned strategies to other models' sessions)",injectionMap:"Source → target mappings",injectionMapHint:"Inject a source model's learned strategies into the target model's sessions.",noMappings:"No mappings configured.",source:"Source model",target:"Target model",targetPlaceholder:"target model / glob",addMapping:"Add mapping",save:"Save",configSaved:"Configuration saved.",configSaveFailed:"Failed to save configuration.",patternsTitle:"Pattern library",filterModel:"Filter by model",filterCategory:"Filter by category",allModels:"All models",allCategories:"All categories",patternsError:"Failed to load patterns.",noPatterns:"No learned patterns yet.",colTitle:"Pattern",colModel:"Model",colCategory:"Category",colConfidence:"Confidence",colFrequency:"Frequency",patternDeleted:"Pattern deleted.",patternDeleteFailed:"Failed to delete pattern.",deletePatternTitle:"Delete pattern?",deletePatternDesc:'Delete the learned pattern "{{title}}"? This cannot be undone.',deleteAllForModel:"Delete all for model",deleteAllTitle:"Delete all patterns?",deleteAllDesc:'Delete every learned pattern for "{{model}}"? This cannot be undone.',patternsDeletedCount:"Deleted {{count}} pattern(s).",wipeTraces:"Wipe traces",wipeTracesTitle:"Wipe traces?",wipeTracesDesc:'Permanently delete all staged reasoning traces for "{{model}}"? This cannot be undone.',tracesWiped:"Wiped {{count}} trace(s).",duplicateTarget:'Duplicate target "{{target}}" — each target maps to only one source.'},aE={title:"Overview",neurons:"Neurons",synapses:"Synapses",fibers:"Fibers",brains:"Brains",brainList:"Brains",name:"Name",grade:"Grade",status:"Status",actions:"Actions",currentBrain:"Current active brain",switchTo:"Click to switch to {{name}}",deleteBrain:"Delete brain {{name}}",noBrains:"No brains found.",deleteBrainTitle:"Delete Brain",deleteBrainDesc:'Delete brain "{{name}}"? This will remove all neurons, synapses, and fibers permanently. This cannot be undone.',switchedTo:"Switched to brain: {{name}}",switchFailed:"Failed to switch brain",deleted:"Deleted brain: {{name}}",deleteFailed:"Failed to delete brain"},lE={title:"Health",brainMetrics:"Brain Metrics",purity:"Purity",freshness:"Freshness",connectivity:"Connectivity",diversity:"Diversity",consolidation:"Consolidation",activation:"Activation",recall:"Recall",orphanRate:"Orphan Rate",radarName:"Health",warnings:"Warnings & Recommendations",noWarnings:"No warnings. Brain is healthy!",recommendations:"Recommendations",enrichTitle:"How to Enrich Your Brain",enrichDesc:"A richer brain means better recall. Here's how to build detailed neurons and strong synapses.",collapseTips:"Collapse tips",expandTips:"Expand tips",less:"Less",more:"More",topPenalties:"Top Issues Hurting Your Score",noPenalties:"No significant penalties. Keep it up!",penaltyPoints:"{{points}} pts lost",estimatedGain:"+{{gain}} pts if fixed",currentScore:"Current: {{score}}%",weight:"Weight: {{weight}}%",fixAction:"Fix",conflictRate:"Conflict Rate",contradictionCount:"Contradictions"},iE={title:"Uncertainty",window:"Last {{days}} days",level:{low:"Low",medium:"Medium",high:"High"},contradictionRate:"Contradiction Rate",totalMemories:"Total Memories",contradictions:"Contradictions",lowTrust:"Low-trust",superseded:"Superseded",expiring:"Expiring",drift:"Drift Clusters",driftSqliteOnly:"Drift detection is SQLite-only.",truncatedNote:"Low-trust and superseded reflect only the most-recent {{count}} scanned memories.",fiberId:"Fiber",trustScore:"Trust",supersededBy:"Superseded by",canonical:"Canonical",confidence:"Confidence",noSamples:"Nothing to show."},sE={rememberTitle:"Ask your agent to remember frequently",rememberTips:['After every decision: "Remember that we chose PostgreSQL over MongoDB for the user service"','After debugging: "Remember the root cause was a race condition in the WebSocket handler"','After meetings: "Remember Alice suggested rate limiting at the API gateway level"','After learning: "Remember that Vite HMR requires export default for React components"'],causalTitle:"Use rich, causal language",causalTips:['BAD: "PostgreSQL" → creates a single flat neuron','GOOD: "We chose PostgreSQL over MongoDB because we need ACID transactions for payment processing" → creates concept + entity + decision neurons with CAUSED_BY synapses',"Include WHY, not just WHAT — causal chains create richer neural connections","Mention people, dates, and context — they become separate neurons linked by synapses"],diverseTitle:"Diverse memory types = stronger recall",diverseTips:['Facts: "The API rate limit is 1000 req/min per user"','Decisions: "We decided to use JWT over sessions because of microservice architecture"',`Errors: "Import failed because the column 'email' was renamed to 'user_email' in v3"`,'Insights: "Pattern: always validate webhook signatures before processing payloads"','Workflows: "Deploy process: lint → test → build → push → verify health check"'],trainTitle:"Train from documents for permanent knowledge",trainTips:["Use smem_train to import docs (PDF, DOCX, MD) — trained memories never decay","Use smem_index to index your codebase — enables code-aware recall","Pin critical memories with smem_pin — they skip decay and consolidation","Use smem_eternal for project-level context that should persist across all sessions"]},rE={title:"Neural Graph",nodes:"Nodes:",networkVisualization:"Network Visualization",nodesCount:"{{nodes}} nodes, {{edges}} edges",noNeurons:"No neurons found in this brain.",concept:"concept",entity:"entity",time:"time",action:"action",state:"state",other:"other"},oE={title:"Timeline",memoryTimeline:"Memory Timeline",entries:"{{total}} entries",noEntries:"No timeline entries.",range7d:"7 Days",range30d:"30 Days",range90d:"90 Days",rangeAll:"All",todayMemories:"Today",totalPeriod:"Total",avgPerDay:"Avg/Day",activeDays:"Active Days",activityTrend:"Activity Trend",neuronDistribution:"Neuron Distribution",recentActivity:"Recent Activity",neurons:"Neurons",fibers:"Fibers",synapses:"Synapses"},uE={title:"Evolution",brainMetrics:"Brain Metrics",maturity:"Maturity",plasticity:"Plasticity",semanticRatio:"Semantic Ratio",totalFibers:"Total Fibers",totalNeurons:"Total Neurons",stageDistribution:"Stage Distribution",shortTerm:"Short Term",working:"Working",episodic:"Episodic",semantic:"Semantic"},cE={title:"Mindmap",fibers:"Fibers",noFibers:"No fibers found.",selectFiber:"Select a Fiber",fiberLabel:"Fiber: {{id}}...",neuronsCount:"Neurons:",connectionsCount:"Connections:",selectFiberPrompt:"Select a fiber to view its mindmap"},fE={title:"Settings",general:"General",version:"Version",activeBrain:"Active Brain",totalBrains:"Total Brains",brainFiles:"Brain Files",brainsDirectory:"Brains Directory",totalDiskUsage:"Total Disk Usage",telegramBackup:"Telegram Backup",connected:"Connected",chatIds:"Chat IDs",autoBackup:"Auto-backup on consolidation",sendTest:"Send Test",sending:"Sending...",backupNow:"Backup Now",backingUp:"Backing up...",notConfigured:"Not Configured",telegramSetup:"Set NMEM_TELEGRAM_BOT_TOKEN env var and add [telegram] chat_ids to config.toml.",feedbackTitle:"Feedback & Bug Report",reportBug:"Report a Bug",reportBugDesc:"Found something broken? Open an issue with steps to reproduce.",featureRequest:"Feature Request",featureRequestDesc:"Have an idea to improve Surreal-Memory? We'd love to hear it.",discussions:"GitHub Discussions",discussionsDesc:"Questions, tips, and community support.",testSuccess:"Test message sent successfully",testPartial:"Some messages failed to send",testFailed:"Failed to send test message",backupSuccess:"Backup sent! {{brain}} ({{size}}MB) to {{count}} chat(s)",backupSendFailed:"Backup failed to send",backupFailed:"Backup failed",configStatus:"Configuration Status",embeddingConfig:"Embedding Provider",embeddingProvider:"Provider",embeddingModel:"Model",embeddingEnabled:"Enabled",embeddingThreshold:"Similarity Threshold",embeddingTest:"Test Connection",embeddingTesting:"Testing...",embeddingTestOk:"Connection OK — {{provider}} ({{dimension}}D)",embeddingTestFail:"Test failed: {{error}}",embeddingSave:"Save",embeddingSaving:"Saving...",embeddingSaved:"Embedding settings saved",embeddingSaveFailed:"Failed to save embedding settings",proFeature:"Pro",watcher:"File Watcher",watcherPaths:"Watched Paths",watcherRecent:"Recent Activity",watcherRunning:"Running",watcherStopped:"Stopped",watcherDisabled:"Disabled",watcherNoActivity:"No recent activity"},dE={title:"Cloud Sync",refresh:"Refresh",connectionStatus:"Connection",status:"Status",cloudConnected:"Connected",notConnected:"Not Connected",hubUrl:"Hub URL",apiKey:"API Key",deviceId:"Device ID",disconnect:"Disconnect",setupCloud:"Connect to Cloud",setupTitle:"Connect to Cloud Hub",setupDesc:"Enter your hub URL and API key to sync memories across devices. Register at the hub to get your key.",keyRequired:"API key is required",keyInvalid:"API key must start with nmk_",keyHint:"Get your key by registering at the hub. It starts with nmk_.",connect:"Connect",connecting:"Connecting...",connected:"Cloud sync connected!",connectFailed:"Failed to connect",disconnected:"Cloud sync disconnected",disconnectFailed:"Failed to disconnect",devices:"Devices",lastSync:"Last sync",never:"Never",noDevices:"No devices registered yet. Sync from a device to register it.",changeLog:"Change Log",totalChanges:"Total Changes",synced:"Synced",pending:"Pending",latestSequence:"Latest Sequence",conflictStrategy:"Conflict Resolution",conflictDesc:"How to resolve when the same memory is changed on multiple devices.",strategyUpdated:"Conflict strategy updated",updateFailed:"Failed to update config",syncMode:"Sync Mode",merkleDelta:"Merkle Delta",fullSync:"Full Sync"},hE={title:"Brain Oracle",loading:"Channeling your memories...",needMore:"Your brain needs more memories",needMoreDesc:"The Oracle requires at least 3 memories to unlock. Ask your AI agent to remember decisions, insights, and learnings — then return for your reading.",dailyHint:"Tap each card to reveal your reading",past:"Past",present:"Present",future:"Future",readingDate:"Reading for {{brain}} on {{date}}",whatifHint:"What if these memories collided?",reshuffle:"Reshuffle",memory:"Memory",wildcard:"Wildcard",matchupComplete:"Matchup Complete!",matchupScoreDesc:"Based on activation strength and connections of your chosen memories",playAgain:"Play Again",round:"Round {{current}} / {{total}}",choose:"Choose",chosen:"Chosen!",score:"Score",dailyReading:"Daily Reading",whatif:"What If",matchup:"Matchup",copyCard:"Copy Card",copied:"Copied!",downloadCard:"Download"},mE={search:"Search...",placeholder:"Search pages, fibers, memories...",noResults:"No results found.",pages:"Pages",fibers:"Fibers",neurons:"Memories",semanticSearch:"Semantic Search — find by meaning",crossBrainSearch:"Cross-Brain Search — search all brains",navigate:"navigate",select:"open",close:"close"},gE={title:"Tool Stats",totalEvents:"Total Events",successRate:"Success Rate",uniqueTools:"Unique Tools",topTools:"Top Tools",usageOverTime:"Usage Over Time",detailTable:"Tool Details",tool:"Tool",calls:"Calls",avgDuration:"Avg Duration",server:"Server",noData:"No tool events recorded yet. Use Surreal-Memory tools to start tracking."},pE={title:"Memory Visualizer",description:"Query your memories and generate charts from stored data."},vE={title:"Storage",currentBackend:"Current Backend",brain:"Brain",neurons:"Neurons",synapses:"Synapses",fibers:"Fibers",tierDistribution:"Memory Tiers",tierHot:"HOT — Always in context",tierWarm:"WARM — Semantic match",tierCold:"COLD — Explicit recall only",totalMemories:"Total typed memories"},yE={tier:"License",pro_badge:"PRO",pro_feature:"Pro Feature",free:"Free",pro:"Pro",team:"Team"},bE={title:"Get Surreal-Memory Pro",subtitle:"Choose your payment method",enterKey:"Enter your license key",enterEmail:"Enter your email for the license:",orActivate:"or activate a key",haveKey:"I already have a license key",licenseKey:"License Key",activate:"Activate",activated:"Pro activated!",activationFailed:"Activation failed. Check your key.",back:"Back"},SE={nav:eE,common:tE,reasoning:nE,overview:aE,health:lE,uncertainty:iE,enrichment:sE,graph:rE,timeline:oE,evolution:uE,diagrams:cE,settings:fE,sync:dE,oracle:hE,commandPalette:mE,toolStats:gE,visualize:pE,storage:vE,license:yE,upgrade:bE};ht.use(gp).use(hb).init({resources:{en:{translation:SE}},fallbackLng:"en",detection:{order:["localStorage","navigator"],lookupLocalStorage:"smem-lang",caches:["localStorage"]},interpolation:{escapeValue:!1}});const xE=new Ay({defaultOptions:{queries:{staleTime:3e4,retry:1,refetchOnWindowFocus:!1}}});e0.createRoot(document.getElementById("root")).render(E.jsx(y.StrictMode,{children:E.jsx(Dy,{client:xE,children:E.jsxs(Uy,{basename:window.location.pathname.startsWith("/dashboard")?"/dashboard":"/ui",children:[E.jsx(Hx,{}),E.jsx(A0,{position:"bottom-right",toastOptions:{className:"bg-card text-card-foreground border-border"}})]})})}));export{XE as A,Ub as B,DE as C,wg as D,ji as E,Nt as _,cr as a,Mb as b,wE as c,RE as d,HE as e,xr as f,zE as g,ME as h,BE as i,jE as j,_E as k,LE as l,jb as m,UE as n,qe as o,kE as p,KE as q,QE as r,GE as s,AE as t,YE as u,_b as v,VE as w,ZE as x,Im as y,qE as z}; +For more information, see https://radix-ui.com/primitives/docs/components/${l.docsSlug}`;return y.useEffect(()=>{i&&(document.getElementById(i)||console.error(r))},[r,i]),null},F1="DialogDescriptionWarning",J1=({contentRef:i,descriptionId:l})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ip(F1).contentName}}.`;return y.useEffect(()=>{const c=i.current?.getAttribute("aria-describedby");l&&c&&(document.getElementById(l)||console.warn(o))},[o,i,l]),null},$1=Jg,W1=Ig,I1=Pg,P1=ep,ex=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ua=ex.reduce((i,l)=>{const r=Ag(`Primitive.${l}`),o=y.forwardRef((c,f)=>{const{asChild:m,...h}=c,b=m?r:l;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),E.jsx(b,{...h,ref:f})});return o.displayName=`Primitive.${l}`,{...i,[l]:o}},{}),zi='[cmdk-group=""]',ec='[cmdk-group-items=""]',tx='[cmdk-group-heading=""]',sp='[cmdk-item=""]',Wm=`${sp}:not([aria-disabled="true"])`,uc="cmdk-item-select",zl="data-value",nx=(i,l,r)=>Qb(i,l,r),rp=y.createContext(void 0),Vi=()=>y.useContext(rp),op=y.createContext(void 0),pc=()=>y.useContext(op),up=y.createContext(void 0),cp=y.forwardRef((i,l)=>{let r=Ml(()=>{var _,q;return{search:"",value:(q=(_=i.value)!=null?_:i.defaultValue)!=null?q:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=Ml(()=>new Set),c=Ml(()=>new Map),f=Ml(()=>new Map),m=Ml(()=>new Set),h=fp(i),{label:b,children:v,value:x,onValueChange:g,filter:A,shouldFilter:z,loop:j,disablePointerSelection:B=!1,vimBindings:K=!0,...U}=i,Q=Mn(),Z=Mn(),I=Mn(),ee=y.useRef(null),J=hx();Ua(()=>{if(x!==void 0){let _=x.trim();r.current.value=_,X.emit()}},[x]),Ua(()=>{J(6,Ee)},[]);let X=y.useMemo(()=>({subscribe:_=>(m.current.add(_),()=>m.current.delete(_)),snapshot:()=>r.current,setState:(_,q,G)=>{var k,le,Se,ue;if(!Object.is(r.current[_],q)){if(r.current[_]=q,_==="search")re(),te(),J(1,fe);else if(_==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let De=document.getElementById(I);De?De.focus():(k=document.getElementById(Q))==null||k.focus()}if(J(7,()=>{var De;r.current.selectedItemId=(De=Te())==null?void 0:De.id,X.emit()}),G||J(5,Ee),((le=h.current)==null?void 0:le.value)!==void 0){let De=q??"";(ue=(Se=h.current).onValueChange)==null||ue.call(Se,De);return}}X.emit()}},emit:()=>{m.current.forEach(_=>_())}}),[]),ve=y.useMemo(()=>({value:(_,q,G)=>{var k;q!==((k=f.current.get(_))==null?void 0:k.value)&&(f.current.set(_,{value:q,keywords:G}),r.current.filtered.items.set(_,ae(q,G)),J(2,()=>{te(),X.emit()}))},item:(_,q)=>(o.current.add(_),q&&(c.current.has(q)?c.current.get(q).add(_):c.current.set(q,new Set([_]))),J(3,()=>{re(),te(),r.current.value||fe(),X.emit()}),()=>{f.current.delete(_),o.current.delete(_),r.current.filtered.items.delete(_);let G=Te();J(4,()=>{re(),G?.getAttribute("id")===_&&fe(),X.emit()})}),group:_=>(c.current.has(_)||c.current.set(_,new Set),()=>{f.current.delete(_),c.current.delete(_)}),filter:()=>h.current.shouldFilter,label:b||i["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:Q,inputId:I,labelId:Z,listInnerRef:ee}),[]);function ae(_,q){var G,k;let le=(k=(G=h.current)==null?void 0:G.filter)!=null?k:nx;return _?le(_,r.current.search,q):0}function te(){if(!r.current.search||h.current.shouldFilter===!1)return;let _=r.current.filtered.items,q=[];r.current.filtered.groups.forEach(k=>{let le=c.current.get(k),Se=0;le.forEach(ue=>{let De=_.get(ue);Se=Math.max(De,Se)}),q.push([k,Se])});let G=ee.current;je().sort((k,le)=>{var Se,ue;let De=k.getAttribute("id"),Dt=le.getAttribute("id");return((Se=_.get(Dt))!=null?Se:0)-((ue=_.get(De))!=null?ue:0)}).forEach(k=>{let le=k.closest(ec);le?le.appendChild(k.parentElement===le?k:k.closest(`${ec} > *`)):G.appendChild(k.parentElement===G?k:k.closest(`${ec} > *`))}),q.sort((k,le)=>le[1]-k[1]).forEach(k=>{var le;let Se=(le=ee.current)==null?void 0:le.querySelector(`${zi}[${zl}="${encodeURIComponent(k[0])}"]`);Se?.parentElement.appendChild(Se)})}function fe(){let _=je().find(G=>G.getAttribute("aria-disabled")!=="true"),q=_?.getAttribute(zl);X.setState("value",q||void 0)}function re(){var _,q,G,k;if(!r.current.search||h.current.shouldFilter===!1){r.current.filtered.count=o.current.size;return}r.current.filtered.groups=new Set;let le=0;for(let Se of o.current){let ue=(q=(_=f.current.get(Se))==null?void 0:_.value)!=null?q:"",De=(k=(G=f.current.get(Se))==null?void 0:G.keywords)!=null?k:[],Dt=ae(ue,De);r.current.filtered.items.set(Se,Dt),Dt>0&&le++}for(let[Se,ue]of c.current)for(let De of ue)if(r.current.filtered.items.get(De)>0){r.current.filtered.groups.add(Se);break}r.current.filtered.count=le}function Ee(){var _,q,G;let k=Te();k&&(((_=k.parentElement)==null?void 0:_.firstChild)===k&&((G=(q=k.closest(zi))==null?void 0:q.querySelector(tx))==null||G.scrollIntoView({block:"nearest"})),k.scrollIntoView({block:"nearest"}))}function Te(){var _;return(_=ee.current)==null?void 0:_.querySelector(`${sp}[aria-selected="true"]`)}function je(){var _;return Array.from(((_=ee.current)==null?void 0:_.querySelectorAll(Wm))||[])}function D(_){let q=je()[_];q&&X.setState("value",q.getAttribute(zl))}function V(_){var q;let G=Te(),k=je(),le=k.findIndex(ue=>ue===G),Se=k[le+_];(q=h.current)!=null&&q.loop&&(Se=le+_<0?k[k.length-1]:le+_===k.length?k[0]:k[le+_]),Se&&X.setState("value",Se.getAttribute(zl))}function $(_){let q=Te(),G=q?.closest(zi),k;for(;G&&!k;)G=_>0?fx(G,zi):dx(G,zi),k=G?.querySelector(Wm);k?X.setState("value",k.getAttribute(zl)):V(_)}let de=()=>D(je().length-1),oe=_=>{_.preventDefault(),_.metaKey?de():_.altKey?$(1):V(1)},me=_=>{_.preventDefault(),_.metaKey?D(0):_.altKey?$(-1):V(-1)};return y.createElement(ua.div,{ref:l,tabIndex:-1,...U,"cmdk-root":"",onKeyDown:_=>{var q;(q=U.onKeyDown)==null||q.call(U,_);let G=_.nativeEvent.isComposing||_.keyCode===229;if(!(_.defaultPrevented||G))switch(_.key){case"n":case"j":{K&&_.ctrlKey&&oe(_);break}case"ArrowDown":{oe(_);break}case"p":case"k":{K&&_.ctrlKey&&me(_);break}case"ArrowUp":{me(_);break}case"Home":{_.preventDefault(),D(0);break}case"End":{_.preventDefault(),de();break}case"Enter":{_.preventDefault();let k=Te();if(k){let le=new Event(uc);k.dispatchEvent(le)}}}}},y.createElement("label",{"cmdk-label":"",htmlFor:ve.inputId,id:ve.labelId,style:gx},b),Cr(i,_=>y.createElement(op.Provider,{value:X},y.createElement(rp.Provider,{value:ve},_))))}),ax=y.forwardRef((i,l)=>{var r,o;let c=Mn(),f=y.useRef(null),m=y.useContext(up),h=Vi(),b=fp(i),v=(o=(r=b.current)==null?void 0:r.forceMount)!=null?o:m?.forceMount;Ua(()=>{if(!v)return h.item(c,m?.id)},[v]);let x=dp(c,f,[i.value,i.children,f],i.keywords),g=pc(),A=oa(J=>J.value&&J.value===x.current),z=oa(J=>v||h.filter()===!1?!0:J.search?J.filtered.items.get(c)>0:!0);y.useEffect(()=>{let J=f.current;if(!(!J||i.disabled))return J.addEventListener(uc,j),()=>J.removeEventListener(uc,j)},[z,i.onSelect,i.disabled]);function j(){var J,X;B(),(X=(J=b.current).onSelect)==null||X.call(J,x.current)}function B(){g.setState("value",x.current,!0)}if(!z)return null;let{disabled:K,value:U,onSelect:Q,forceMount:Z,keywords:I,...ee}=i;return y.createElement(ua.div,{ref:Pt(f,l),...ee,id:c,"cmdk-item":"",role:"option","aria-disabled":!!K,"aria-selected":!!A,"data-disabled":!!K,"data-selected":!!A,onPointerMove:K||h.getDisablePointerSelection()?void 0:B,onClick:K?void 0:j},i.children)}),lx=y.forwardRef((i,l)=>{let{heading:r,children:o,forceMount:c,...f}=i,m=Mn(),h=y.useRef(null),b=y.useRef(null),v=Mn(),x=Vi(),g=oa(z=>c||x.filter()===!1?!0:z.search?z.filtered.groups.has(m):!0);Ua(()=>x.group(m),[]),dp(m,h,[i.value,i.heading,b]);let A=y.useMemo(()=>({id:m,forceMount:c}),[c]);return y.createElement(ua.div,{ref:Pt(h,l),...f,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},r&&y.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:v},r),Cr(i,z=>y.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?v:void 0},y.createElement(up.Provider,{value:A},z))))}),ix=y.forwardRef((i,l)=>{let{alwaysRender:r,...o}=i,c=y.useRef(null),f=oa(m=>!m.search);return!r&&!f?null:y.createElement(ua.div,{ref:Pt(c,l),...o,"cmdk-separator":"",role:"separator"})}),sx=y.forwardRef((i,l)=>{let{onValueChange:r,...o}=i,c=i.value!=null,f=pc(),m=oa(v=>v.search),h=oa(v=>v.selectedItemId),b=Vi();return y.useEffect(()=>{i.value!=null&&f.setState("search",i.value)},[i.value]),y.createElement(ua.input,{ref:l,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":h,id:b.inputId,type:"text",value:c?i.value:m,onChange:v=>{c||f.setState("search",v.target.value),r?.(v.target.value)}})}),rx=y.forwardRef((i,l)=>{let{children:r,label:o="Suggestions",...c}=i,f=y.useRef(null),m=y.useRef(null),h=oa(v=>v.selectedItemId),b=Vi();return y.useEffect(()=>{if(m.current&&f.current){let v=m.current,x=f.current,g,A=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let z=v.offsetHeight;x.style.setProperty("--cmdk-list-height",z.toFixed(1)+"px")})});return A.observe(v),()=>{cancelAnimationFrame(g),A.unobserve(v)}}},[]),y.createElement(ua.div,{ref:Pt(f,l),...c,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":o,id:b.listId},Cr(i,v=>y.createElement("div",{ref:Pt(m,b.listInnerRef),"cmdk-list-sizer":""},v)))}),ox=y.forwardRef((i,l)=>{let{open:r,onOpenChange:o,overlayClassName:c,contentClassName:f,container:m,...h}=i;return y.createElement($1,{open:r,onOpenChange:o},y.createElement(W1,{container:m},y.createElement(I1,{"cmdk-overlay":"",className:c}),y.createElement(P1,{"aria-label":i.label,"cmdk-dialog":"",className:f},y.createElement(cp,{ref:l,...h}))))}),ux=y.forwardRef((i,l)=>oa(r=>r.filtered.count===0)?y.createElement(ua.div,{ref:l,...i,"cmdk-empty":"",role:"presentation"}):null),cx=y.forwardRef((i,l)=>{let{progress:r,children:o,label:c="Loading...",...f}=i;return y.createElement(ua.div,{ref:l,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":c},Cr(i,m=>y.createElement("div",{"aria-hidden":!0},m)))}),Ut=Object.assign(cp,{List:rx,Item:ax,Input:sx,Group:lx,Separator:ix,Dialog:ox,Empty:ux,Loading:cx});function fx(i,l){let r=i.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function dx(i,l){let r=i.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function fp(i){let l=y.useRef(i);return Ua(()=>{l.current=i}),l}var Ua=typeof window>"u"?y.useEffect:y.useLayoutEffect;function Ml(i){let l=y.useRef();return l.current===void 0&&(l.current=i()),l}function oa(i){let l=pc(),r=()=>i(l.snapshot());return y.useSyncExternalStore(l.subscribe,r,r)}function dp(i,l,r,o=[]){let c=y.useRef(),f=Vi();return Ua(()=>{var m;let h=(()=>{var v;for(let x of r){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(v=x.current.textContent)==null?void 0:v.trim():c.current}})(),b=o.map(v=>v.trim());f.value(i,h,b),(m=l.current)==null||m.setAttribute(zl,h),c.current=h}),c}var hx=()=>{let[i,l]=y.useState(),r=Ml(()=>new Map);return Ua(()=>{r.current.forEach(o=>o()),r.current=new Map},[i]),(o,c)=>{r.current.set(o,c),l({})}};function mx(i){let l=i.type;return typeof l=="function"?l(i.props):"render"in l?l.render(i.props):i}function Cr({asChild:i,children:l},r){return i&&y.isValidElement(l)?y.cloneElement(mx(l),{ref:l.ref},r(l.props.children)):r(l)}var gx={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const px="https://pay.theio.vn",vx={vn:{product:"NM-PRO-YEARLY",original:"1.190.000 VND",price:"595.000 VND",method:"Bank Transfer (VietQR)",flag:"🇻🇳"},intl:{product:"NM-PRO-YEARLY",original:"$89 USD",price:"$49 USD",method:"Card / PayPal (Polar)",flag:"🌐"}};let cc=null;function Im(){cc?.()}function yx(){const[i,l]=y.useState(!1),[r,o]=y.useState("choose"),[c,f]=y.useState(""),[m,h]=y.useState(!1),[b,v]=y.useState(!1),[x,g]=y.useState(""),{t:A}=xr();return y.useEffect(()=>(cc=()=>l(!0),()=>{cc=null}),[]),y.useEffect(()=>{i||(o("choose"),f(""),g(""),v(!1))},[i]),y.useEffect(()=>{if(!i)return;const z=j=>{j.key==="Escape"&&l(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[i]),y.useCallback(async z=>{const j=vx[z],B=prompt(A("upgrade.enterEmail","Enter your email for the license:"));if(B){try{const Q=await(await fetch(`${px}${z==="intl"?"/checkout/polar":"/order/sepay"}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({product:j.product,email:B})})).json();Q.url?window.open(Q.url,"_blank"):Q.qr_url&&window.open(Q.qr_url,"_blank")}catch{z==="intl"&&window.open("https://polar.sh/nhadaututtheky","_blank")}l(!1)}},[A]),y.useCallback(async()=>{const z=c.trim();if(z){h(!0),g("");try{const j=await qe.post("/api/dashboard/license/activate",{license_key:z});j.success?(v(!0),setTimeout(()=>{l(!1),window.location.reload()},1500)):g(j.error||A("upgrade.activationFailed","Activation failed"))}catch{g(A("upgrade.activationFailed","Activation failed. Check key format."))}finally{h(!1)}}},[c,A]),null}const bx=[{path:"/",icon:og,labelKey:"nav.overview"},{path:"/health",icon:ug,labelKey:"nav.health"},{path:"/graph",icon:cg,labelKey:"nav.graph"},{path:"/timeline",icon:fg,labelKey:"nav.timeline"},{path:"/evolution",icon:dg,labelKey:"nav.evolution"},{path:"/diagrams",icon:hg,labelKey:"nav.mindmap"},{path:"/sync",icon:mg,labelKey:"nav.sync"},{path:"/oracle",icon:gg,labelKey:"nav.oracle"},{path:"/tool-stats",icon:pg,labelKey:"nav.toolStats"},{path:"/settings",icon:vg,labelKey:"nav.settings"}],Pm={fact:"#06b6d4",decision:"#f59e0b",error:"#ef4444",insight:"#8b5cf6",preference:"#ec4899",workflow:"#059669",instruction:"#6366f1",pattern:"#14b8a6",concept:"#6366f1",entity:"#06b6d4"};function Sx(){const[i,l]=y.useState(!1),[r,o]=y.useState(""),[c,f]=y.useState([]),[m,h]=y.useState(!1),b=y.useRef(null),v=My(),{data:x}=jb(),{t:g}=xr();y.useEffect(()=>{const U=Q=>{(Q.metaKey||Q.ctrlKey)&&Q.key==="k"&&(Q.preventDefault(),l(Z=>!Z))};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[]),y.useEffect(()=>{i||(o(""),f([]))},[i]);const A=y.useCallback(U=>{if(b.current&&clearTimeout(b.current),U.length<2){f([]),h(!1);return}h(!0),b.current=setTimeout(async()=>{try{const Q=await qe.get(`/neurons?content_contains=${encodeURIComponent(U)}&limit=8`);f(Q.neurons??[])}catch{f([])}finally{h(!1)}},300)},[]),z=U=>{o(U),A(U)},j=U=>{v(U),l(!1)},B=x?.fibers??[],K=r.length>0?B.filter(U=>U.summary.toLowerCase().includes(r.toLowerCase())):B.slice(0,5);return E.jsxs(E.Fragment,{children:[E.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground cursor-pointer","aria-label":g("commandPalette.placeholder"),children:[E.jsx(um,{className:"size-3.5","aria-hidden":"true"}),E.jsx("span",{className:"hidden sm:inline",children:g("commandPalette.search")}),E.jsxs("kbd",{className:"pointer-events-none hidden select-none rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] font-medium sm:inline-flex",children:[E.jsx(Yy,{className:"mr-0.5 inline size-2.5","aria-hidden":"true"}),"K"]})]}),i&&sg.createPortal(E.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh] bg-black/50 backdrop-blur-sm",onClick:U=>{U.target===U.currentTarget&&l(!1)},children:E.jsxs(Ut,{className:"w-full max-w-lg rounded-xl border border-border bg-card shadow-lg overflow-hidden",shouldFilter:!1,children:[E.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[E.jsx(um,{className:"mr-2 size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),E.jsx(Ut.Input,{value:r,onValueChange:z,placeholder:g("commandPalette.placeholder"),className:"flex h-11 w-full bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground"}),m&&E.jsx("div",{className:"size-4 shrink-0 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})]}),E.jsxs(Ut.List,{className:"max-h-80 overflow-y-auto px-2 py-2",children:[E.jsx(Ut.Empty,{className:"py-6 text-center text-sm text-muted-foreground",children:g("commandPalette.noResults")}),E.jsx(Ut.Group,{heading:E.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("commandPalette.pages")}),children:bx.map(({path:U,icon:Q,labelKey:Z})=>E.jsxs(Ut.Item,{value:`page-${g(Z)}`,onSelect:()=>j(U),className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm cursor-pointer aria-selected:bg-accent",children:[E.jsx(Q,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),E.jsx("span",{children:g(Z)})]},U))}),K.length>0&&E.jsx(Ut.Group,{heading:E.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("commandPalette.fibers")}),children:K.slice(0,6).map(U=>E.jsxs(Ut.Item,{value:`fiber-${U.summary}`,onSelect:()=>{v("/diagrams"),l(!1)},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm cursor-pointer aria-selected:bg-accent",children:[E.jsx(ky,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),E.jsx("span",{className:"flex-1 truncate",children:U.summary}),E.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:U.neuron_count})]},U.id))}),c.length>0&&E.jsx(Ut.Group,{heading:E.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("commandPalette.neurons")}),children:c.map(U=>E.jsxs(Ut.Item,{value:`neuron-${U.id}`,onSelect:()=>{v("/graph"),l(!1)},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm cursor-pointer aria-selected:bg-accent",children:[E.jsx(rg,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),E.jsx("span",{className:"flex-1 truncate text-xs",children:U.content}),E.jsx("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-semibold",style:{backgroundColor:`${Pm[U.type]??"#94a3b8"}20`,color:Pm[U.type]??"#94a3b8"},children:U.type})]},U.id))}),E.jsxs(Ut.Group,{heading:E.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Pro"}),children:[E.jsxs(Ut.Item,{value:"pro-semantic-search",onSelect:()=>{l(!1),Im()},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm opacity-60 cursor-pointer aria-selected:bg-accent aria-selected:opacity-100",children:[E.jsx(cm,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),E.jsx("span",{className:"flex-1",children:g("commandPalette.semanticSearch")}),E.jsx("span",{className:"rounded-md bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary",children:"PRO"})]}),E.jsxs(Ut.Item,{value:"pro-cross-brain-search",onSelect:()=>{l(!1),Im()},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm opacity-60 cursor-pointer aria-selected:bg-accent aria-selected:opacity-100",children:[E.jsx(cm,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),E.jsx("span",{className:"flex-1",children:g("commandPalette.crossBrainSearch")}),E.jsx("span",{className:"rounded-md bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary",children:"PRO"})]})]})]}),E.jsx("div",{className:"flex items-center justify-between border-t border-border px-4 py-2",children:E.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[E.jsxs("span",{children:[E.jsx("kbd",{className:"rounded border border-border bg-muted px-1 py-0.5 font-mono",children:"↑↓"})," ",g("commandPalette.navigate")]}),E.jsxs("span",{children:[E.jsx("kbd",{className:"rounded border border-border bg-muted px-1 py-0.5 font-mono",children:"↵"})," ",g("commandPalette.select")]}),E.jsxs("span",{children:[E.jsx("kbd",{className:"rounded border border-border bg-muted px-1 py-0.5 font-mono",children:"esc"})," ",g("commandPalette.close")]})]})})]})}),document.body)]})}const xx={light:Xy,dark:Qy,system:Gy},eg={light:"common.lightMode",dark:"common.darkMode",system:"common.systemTheme"};function Ex(){const{sidebarOpen:i,toggleSidebar:l,theme:r,cycleTheme:o}=br(),{data:c}=Mb(),{data:f}=_b(),{t:m}=xr(),h=xx[r];return E.jsxs("header",{className:"sticky top-0 z-20 flex h-14 items-center gap-4 border-b border-border bg-background/80 px-4 backdrop-blur-sm",children:[E.jsx(cr,{variant:"ghost",size:"icon",onClick:l,"aria-label":m(i?"common.collapseSidebar":"common.expandSidebar"),children:i?E.jsx(fm,{className:"size-5",weight:"bold"}):E.jsx(fm,{className:"size-5"})}),c?.active_brain&&E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsxs("span",{className:"text-sm text-muted-foreground",children:[m("common.brain"),":"]}),E.jsx(Ub,{variant:"secondary",className:"font-mono text-xs",children:c.active_brain})]}),E.jsx(Sx,{}),E.jsx("div",{className:"flex-1"}),E.jsx(cr,{variant:"ghost",size:"icon",asChild:!0,"aria-label":"Quickstart Guide",title:"Quickstart Guide",children:E.jsx("a",{href:"https://github.com/acidkill/surreal-memory/blob/main/docs/guides/quickstart-guide.md",target:"_blank",rel:"noopener noreferrer",children:E.jsx(Ky,{className:"size-4"})})}),E.jsx(cr,{variant:"ghost",size:"icon",onClick:o,"aria-label":m(eg[r]),title:m(eg[r]),"data-testid":"theme-toggle",children:E.jsx(h,{className:"size-4"})}),f?.version&&E.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["v",f.version]})]})}function Tx(){const i=br(l=>l.sidebarOpen);return E.jsxs("div",{className:"h-screen bg-background overflow-hidden",children:[E.jsx(xb,{}),E.jsxs("div",{className:ji("flex flex-col h-full transition-all duration-[var(--transition-normal)]",i?"ml-56":"ml-16"),children:[E.jsx(Ex,{}),E.jsx("main",{className:"flex-1 overflow-auto",children:E.jsx(_y,{})})]}),E.jsx(yx,{})]})}function Ot(){return E.jsxs("div",{className:"space-y-6 p-6 animate-pulse",children:[E.jsx("div",{className:"h-8 w-48 rounded-lg bg-muted"}),E.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4}).map((i,l)=>E.jsx("div",{className:"h-28 rounded-xl bg-muted"},l))}),E.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[E.jsx("div",{className:"h-64 rounded-xl bg-muted"}),E.jsx("div",{className:"h-64 rounded-xl bg-muted"})]})]})}const Ox=y.lazy(()=>Nt(()=>import("./OverviewPage-0Bf2qfse.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),Cx=y.lazy(()=>Nt(()=>import("./HealthPage-udEViHaw.js"),__vite__mapDeps([9,1,2,3,4,6,8,7]))),Nx=y.lazy(()=>Nt(()=>import("./UncertaintyPage-DenkK0_u.js"),__vite__mapDeps([10,1,2,3,4,6,7,8]))),Dx=y.lazy(()=>Nt(()=>import("./GraphPage-XQ_-o7wQ.js"),__vite__mapDeps([11,1,2,3,4,6,7,8]))),Ax=y.lazy(()=>Nt(()=>import("./TimelinePage-BROTDDzc.js"),__vite__mapDeps([12,1,2,3,4,6,8,7]))),wx=y.lazy(()=>Nt(()=>import("./EvolutionPage-BA7T5RIn.js"),__vite__mapDeps([13,1,2,14,3,4,8,7,6]))),Rx=y.lazy(()=>Nt(()=>import("./DiagramsPage-DO04XJem.js"),__vite__mapDeps([15,1,2,3,4,16,8,7,6,17]))),zx=y.lazy(()=>Nt(()=>import("./SettingsPage-Dq3EMb_r.js"),__vite__mapDeps([18,1,2,3,6,4,14,7,8]))),Mx=y.lazy(()=>Nt(()=>import("./SyncPage-DCUBw9Zr.js"),__vite__mapDeps([19,1,2,3,6,7,8]))),_x=y.lazy(()=>Nt(()=>import("./OraclePage-Crqd4SF_.js"),__vite__mapDeps([20,1,2,6,7,8]))),jx=y.lazy(()=>Nt(()=>import("./ToolStatsPage-D0x1I7ay.js"),__vite__mapDeps([21,1,2,3,4,8,7,6]))),Lx=y.lazy(()=>Nt(()=>import("./VisualizePage-BSPpZSKx.js"),__vite__mapDeps([22,1,2,14,3,6,7,8]))),Ux=y.lazy(()=>Nt(()=>import("./StoragePage-CO4TVbcW.js"),__vite__mapDeps([23,1,2,3,6,4,7,8]))),Bx=y.lazy(()=>Nt(()=>import("./ReasoningPage-BLOUPTbz.js"),__vite__mapDeps([24,1,2,3,4,6,5,7,8])));function Hx(){return E.jsx(jy,{children:E.jsxs(ot,{element:E.jsx(Tx,{}),children:[E.jsx(ot,{index:!0,element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Ox,{})})}),E.jsx(ot,{path:"health",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Cx,{})})}),E.jsx(ot,{path:"uncertainty",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Nx,{})})}),E.jsx(ot,{path:"graph",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Dx,{})})}),E.jsx(ot,{path:"timeline",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Ax,{})})}),E.jsx(ot,{path:"evolution",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(wx,{})})}),E.jsx(ot,{path:"diagrams",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Rx,{})})}),E.jsx(ot,{path:"settings",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(zx,{})})}),E.jsx(ot,{path:"sync",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Mx,{})})}),E.jsx(ot,{path:"oracle",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(_x,{})})}),E.jsx(ot,{path:"tool-stats",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(jx,{})})}),E.jsx(ot,{path:"visualize",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Lx,{})})}),E.jsx(ot,{path:"storage",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Ux,{})})}),E.jsx(ot,{path:"reasoning",element:E.jsx(y.Suspense,{fallback:E.jsx(Ot,{}),children:E.jsx(Bx,{})})}),E.jsx(ot,{path:"*",element:E.jsx(Ly,{to:"/",replace:!0})})]})})}const{slice:qx,forEach:Vx}=[];function Yx(i){return Vx.call(qx.call(arguments,1),l=>{if(l)for(const r in l)i[r]===void 0&&(i[r]=l[r])}),i}function kx(i){return typeof i!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(r=>r.test(i))}const tg=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Kx=function(i,l){const o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},c=encodeURIComponent(l);let f=`${i}=${c}`;if(o.maxAge>0){const m=o.maxAge-0;if(Number.isNaN(m))throw new Error("maxAge should be a Number");f+=`; Max-Age=${Math.floor(m)}`}if(o.domain){if(!tg.test(o.domain))throw new TypeError("option domain is invalid");f+=`; Domain=${o.domain}`}if(o.path){if(!tg.test(o.path))throw new TypeError("option path is invalid");f+=`; Path=${o.path}`}if(o.expires){if(typeof o.expires.toUTCString!="function")throw new TypeError("option expires is invalid");f+=`; Expires=${o.expires.toUTCString()}`}if(o.httpOnly&&(f+="; HttpOnly"),o.secure&&(f+="; Secure"),o.sameSite)switch(typeof o.sameSite=="string"?o.sameSite.toLowerCase():o.sameSite){case!0:f+="; SameSite=Strict";break;case"lax":f+="; SameSite=Lax";break;case"strict":f+="; SameSite=Strict";break;case"none":f+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o.partitioned&&(f+="; Partitioned"),f},ng={create(i,l,r,o){let c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(c.expires=new Date,c.expires.setTime(c.expires.getTime()+r*60*1e3)),o&&(c.domain=o),document.cookie=Kx(i,l,c)},read(i){const l=`${i}=`,r=document.cookie.split(";");for(let o=0;o-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const f=o.substring(1).split("&");for(let m=0;m0&&f[m].substring(0,h)===l&&(r=f[m].substring(h+1))}}return r}},Xx={name:"hash",lookup(i){let{lookupHash:l,lookupFromHashIndex:r}=i,o;if(typeof window<"u"){const{hash:c}=window.location;if(c&&c.length>2){const f=c.substring(1);if(l){const m=f.split("&");for(let h=0;h0&&m[h].substring(0,b)===l&&(o=m[h].substring(b+1))}}if(o)return o;if(!o&&r>-1){const m=c.match(/\/([a-zA-Z-]*)/g);return Array.isArray(m)?m[typeof r=="number"?r:0]?.replace("/",""):void 0}}}return o}};let wl=null;const ag=()=>{if(wl!==null)return wl;try{if(wl=typeof window<"u"&&window.localStorage!==null,!wl)return!1;const i="i18next.translate.boo";window.localStorage.setItem(i,"foo"),window.localStorage.removeItem(i)}catch{wl=!1}return wl};var Zx={name:"localStorage",lookup(i){let{lookupLocalStorage:l}=i;if(l&&ag())return window.localStorage.getItem(l)||void 0},cacheUserLanguage(i,l){let{lookupLocalStorage:r}=l;r&&ag()&&window.localStorage.setItem(r,i)}};let Rl=null;const lg=()=>{if(Rl!==null)return Rl;try{if(Rl=typeof window<"u"&&window.sessionStorage!==null,!Rl)return!1;const i="i18next.translate.boo";window.sessionStorage.setItem(i,"foo"),window.sessionStorage.removeItem(i)}catch{Rl=!1}return Rl};var Fx={name:"sessionStorage",lookup(i){let{lookupSessionStorage:l}=i;if(l&&lg())return window.sessionStorage.getItem(l)||void 0},cacheUserLanguage(i,l){let{lookupSessionStorage:r}=l;r&&lg()&&window.sessionStorage.setItem(r,i)}},Jx={name:"navigator",lookup(i){const l=[];if(typeof navigator<"u"){const{languages:r,userLanguage:o,language:c}=navigator;if(r)for(let f=0;f0?l:void 0}},$x={name:"htmlTag",lookup(i){let{htmlTag:l}=i,r;const o=l||(typeof document<"u"?document.documentElement:null);return o&&typeof o.getAttribute=="function"&&(r=o.getAttribute("lang")),r}},Wx={name:"path",lookup(i){let{lookupFromPathIndex:l}=i;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?r[typeof l=="number"?l:0]?.replace("/",""):void 0}},Ix={name:"subdomain",lookup(i){let{lookupFromSubdomainIndex:l}=i;const r=typeof l=="number"?l+1:1,o=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(o)return o[r]}};let hp=!1;try{document.cookie,hp=!0}catch{}const mp=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];hp||mp.splice(1,1);const Px=()=>({order:mp,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:i=>i});class gp{constructor(l){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(l,r)}init(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=l,this.options=Yx(r,this.options||{},Px()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=c=>c.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=o,this.addDetector(Gx),this.addDetector(Qx),this.addDetector(Zx),this.addDetector(Fx),this.addDetector(Jx),this.addDetector($x),this.addDetector(Wx),this.addDetector(Ix),this.addDetector(Xx)}addDetector(l){return this.detectors[l.name]=l,this}detect(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,r=[];return l.forEach(o=>{if(this.detectors[o]){let c=this.detectors[o].lookup(this.options);c&&typeof c=="string"&&(c=[c]),c&&(r=r.concat(c))}}),r=r.filter(o=>o!=null&&!kx(o)).map(o=>this.options.convertDetectedLanguage(o)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(l){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(l)>-1||r.forEach(o=>{this.detectors[o]&&this.detectors[o].cacheUserLanguage(l,this.options)}))}}gp.type="languageDetector";const eE={overview:"Overview",health:"Health",uncertainty:"Uncertainty",graph:"Graph",timeline:"Timeline",evolution:"Evolution",mindmap:"Mindmap",sync:"Cloud Sync",oracle:"Oracle",toolStats:"Tool Stats",reasoningTraining:"Reasoning Training",visualize:"Visualize",storage:"Storage",settings:"Settings"},tE={confirm:"Confirm",cancel:"Cancel",delete:"Delete",loading:"Loading...",active:"Active",yes:"Yes",no:"No",none:"(none)",neurons:"neurons",brain:"Brain",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",mainNavigation:"Main navigation",lightMode:"Light mode",darkMode:"Dark mode",systemTheme:"System theme",retry:"Retry",prev:"Previous",next:"Next"},nE={pageTitle:"Reasoning Training",pageSubtitle:"Mine model thinking into reasoning strategies and inject them into other models.",statusError:"Failed to load reasoning status.",emptyState:"No reasoning traces yet. Enable mining below, then run a backfill to scan past sessions.",kpiTraces:"Total traces",kpiUnprocessed:"Unprocessed",kpiPatterns:"Learned patterns",kpiModels:"Detected models",coverageTitle:"Category coverage",miningTitle:"Mining",miningEnabled:"Enable mining (reads model thinking from ~/.claude transcripts)",miningModels:"Source models",miningModelsHint:"None selected = mine all models with thinking text.",noModels:"No models detected yet.",noThinkingText:"This model produces no thinking text and cannot be mined.",noThinkingShort:"no thinking",backfill:"Backfill (full history)",runMining:"Run mining",miningRunning:"Mining…",miningStarted:"Mining started.",miningInProgress:"A mining run is already in progress.",miningDisabled:"Enable mining first.",miningFailed:"Failed to start mining.",injectionTitle:"Injection",injectionEnabled:"Enable injection (add learned strategies to other models' sessions)",injectionMap:"Source → target mappings",injectionMapHint:"Inject a source model's learned strategies into the target model's sessions.",noMappings:"No mappings configured.",source:"Source model",target:"Target model",targetPlaceholder:"target model / glob",addMapping:"Add mapping",save:"Save",configSaved:"Configuration saved.",configSaveFailed:"Failed to save configuration.",patternsTitle:"Pattern library",filterModel:"Filter by model",filterCategory:"Filter by category",allModels:"All models",allCategories:"All categories",patternsError:"Failed to load patterns.",noPatterns:"No learned patterns yet.",colTitle:"Pattern",colModel:"Model",colCategory:"Category",colConfidence:"Confidence",colFrequency:"Frequency",patternDeleted:"Pattern deleted.",patternDeleteFailed:"Failed to delete pattern.",deletePatternTitle:"Delete pattern?",deletePatternDesc:'Delete the learned pattern "{{title}}"? This cannot be undone.',deleteAllForModel:"Delete all for model",deleteAllTitle:"Delete all patterns?",deleteAllDesc:'Delete every learned pattern for "{{model}}"? This cannot be undone.',patternsDeletedCount:"Deleted {{count}} pattern(s).",wipeTraces:"Wipe traces",wipeTracesTitle:"Wipe traces?",wipeTracesDesc:'Permanently delete all staged reasoning traces for "{{model}}"? This cannot be undone.',tracesWiped:"Wiped {{count}} trace(s).",duplicateTarget:'Duplicate target "{{target}}" — each target maps to only one source.',targetsTitle:"Pattern targets",targetsHint:"How many strategy patterns to distill per model. 0 = detect only; raise a slider, then run mining.",targetsZeroHint:"Set a target above 0 and run mining to distill this model.",targetCounts:"{{patterns}} patterns · {{traces}} traces",progressScanning:"Scanning transcripts",progressIngesting:"Ingesting traces",progressDistilling:"Distilling patterns",progressDone:"Done",progressFiles:"{{scanned}} / {{total}} files",progressTraces:"{{found}} found · {{ingested}} new",progressModels:"{{model}} ({{done}}/{{total}}) · {{patterns}} patterns"},aE={title:"Overview",neurons:"Neurons",synapses:"Synapses",fibers:"Fibers",brains:"Brains",brainList:"Brains",name:"Name",grade:"Grade",status:"Status",actions:"Actions",currentBrain:"Current active brain",switchTo:"Click to switch to {{name}}",deleteBrain:"Delete brain {{name}}",noBrains:"No brains found.",deleteBrainTitle:"Delete Brain",deleteBrainDesc:'Delete brain "{{name}}"? This will remove all neurons, synapses, and fibers permanently. This cannot be undone.',switchedTo:"Switched to brain: {{name}}",switchFailed:"Failed to switch brain",deleted:"Deleted brain: {{name}}",deleteFailed:"Failed to delete brain"},lE={title:"Health",brainMetrics:"Brain Metrics",purity:"Purity",freshness:"Freshness",connectivity:"Connectivity",diversity:"Diversity",consolidation:"Consolidation",activation:"Activation",recall:"Recall",orphanRate:"Orphan Rate",radarName:"Health",warnings:"Warnings & Recommendations",noWarnings:"No warnings. Brain is healthy!",recommendations:"Recommendations",enrichTitle:"How to Enrich Your Brain",enrichDesc:"A richer brain means better recall. Here's how to build detailed neurons and strong synapses.",collapseTips:"Collapse tips",expandTips:"Expand tips",less:"Less",more:"More",topPenalties:"Top Issues Hurting Your Score",noPenalties:"No significant penalties. Keep it up!",penaltyPoints:"{{points}} pts lost",estimatedGain:"+{{gain}} pts if fixed",currentScore:"Current: {{score}}%",weight:"Weight: {{weight}}%",fixAction:"Fix",conflictRate:"Conflict Rate",contradictionCount:"Contradictions"},iE={title:"Uncertainty",window:"Last {{days}} days",level:{low:"Low",medium:"Medium",high:"High"},contradictionRate:"Contradiction Rate",totalMemories:"Total Memories",contradictions:"Contradictions",lowTrust:"Low-trust",superseded:"Superseded",expiring:"Expiring",drift:"Drift Clusters",driftSqliteOnly:"Drift detection is SQLite-only.",truncatedNote:"Low-trust and superseded reflect only the most-recent {{count}} scanned memories.",fiberId:"Fiber",trustScore:"Trust",supersededBy:"Superseded by",canonical:"Canonical",confidence:"Confidence",noSamples:"Nothing to show."},sE={rememberTitle:"Ask your agent to remember frequently",rememberTips:['After every decision: "Remember that we chose PostgreSQL over MongoDB for the user service"','After debugging: "Remember the root cause was a race condition in the WebSocket handler"','After meetings: "Remember Alice suggested rate limiting at the API gateway level"','After learning: "Remember that Vite HMR requires export default for React components"'],causalTitle:"Use rich, causal language",causalTips:['BAD: "PostgreSQL" → creates a single flat neuron','GOOD: "We chose PostgreSQL over MongoDB because we need ACID transactions for payment processing" → creates concept + entity + decision neurons with CAUSED_BY synapses',"Include WHY, not just WHAT — causal chains create richer neural connections","Mention people, dates, and context — they become separate neurons linked by synapses"],diverseTitle:"Diverse memory types = stronger recall",diverseTips:['Facts: "The API rate limit is 1000 req/min per user"','Decisions: "We decided to use JWT over sessions because of microservice architecture"',`Errors: "Import failed because the column 'email' was renamed to 'user_email' in v3"`,'Insights: "Pattern: always validate webhook signatures before processing payloads"','Workflows: "Deploy process: lint → test → build → push → verify health check"'],trainTitle:"Train from documents for permanent knowledge",trainTips:["Use smem_train to import docs (PDF, DOCX, MD) — trained memories never decay","Use smem_index to index your codebase — enables code-aware recall","Pin critical memories with smem_pin — they skip decay and consolidation","Use smem_eternal for project-level context that should persist across all sessions"]},rE={title:"Neural Graph",nodes:"Nodes:",networkVisualization:"Network Visualization",nodesCount:"{{nodes}} nodes, {{edges}} edges",noNeurons:"No neurons found in this brain.",concept:"concept",entity:"entity",time:"time",action:"action",state:"state",other:"other"},oE={title:"Timeline",memoryTimeline:"Memory Timeline",entries:"{{total}} entries",noEntries:"No timeline entries.",range7d:"7 Days",range30d:"30 Days",range90d:"90 Days",rangeAll:"All",todayMemories:"Today",totalPeriod:"Total",avgPerDay:"Avg/Day",activeDays:"Active Days",activityTrend:"Activity Trend",neuronDistribution:"Neuron Distribution",recentActivity:"Recent Activity",neurons:"Neurons",fibers:"Fibers",synapses:"Synapses"},uE={title:"Evolution",brainMetrics:"Brain Metrics",maturity:"Maturity",plasticity:"Plasticity",semanticRatio:"Semantic Ratio",totalFibers:"Total Fibers",totalNeurons:"Total Neurons",stageDistribution:"Stage Distribution",shortTerm:"Short Term",working:"Working",episodic:"Episodic",semantic:"Semantic"},cE={title:"Mindmap",fibers:"Fibers",noFibers:"No fibers found.",selectFiber:"Select a Fiber",fiberLabel:"Fiber: {{id}}...",neuronsCount:"Neurons:",connectionsCount:"Connections:",selectFiberPrompt:"Select a fiber to view its mindmap"},fE={title:"Settings",general:"General",version:"Version",activeBrain:"Active Brain",totalBrains:"Total Brains",brainFiles:"Brain Files",brainsDirectory:"Brains Directory",totalDiskUsage:"Total Disk Usage",telegramBackup:"Telegram Backup",connected:"Connected",chatIds:"Chat IDs",autoBackup:"Auto-backup on consolidation",sendTest:"Send Test",sending:"Sending...",backupNow:"Backup Now",backingUp:"Backing up...",notConfigured:"Not Configured",telegramSetup:"Set NMEM_TELEGRAM_BOT_TOKEN env var and add [telegram] chat_ids to config.toml.",feedbackTitle:"Feedback & Bug Report",reportBug:"Report a Bug",reportBugDesc:"Found something broken? Open an issue with steps to reproduce.",featureRequest:"Feature Request",featureRequestDesc:"Have an idea to improve Surreal-Memory? We'd love to hear it.",discussions:"GitHub Discussions",discussionsDesc:"Questions, tips, and community support.",testSuccess:"Test message sent successfully",testPartial:"Some messages failed to send",testFailed:"Failed to send test message",backupSuccess:"Backup sent! {{brain}} ({{size}}MB) to {{count}} chat(s)",backupSendFailed:"Backup failed to send",backupFailed:"Backup failed",configStatus:"Configuration Status",embeddingConfig:"Embedding Provider",embeddingProvider:"Provider",embeddingModel:"Model",embeddingEnabled:"Enabled",embeddingThreshold:"Similarity Threshold",embeddingTest:"Test Connection",embeddingTesting:"Testing...",embeddingTestOk:"Connection OK — {{provider}} ({{dimension}}D)",embeddingTestFail:"Test failed: {{error}}",embeddingSave:"Save",embeddingSaving:"Saving...",embeddingSaved:"Embedding settings saved",embeddingSaveFailed:"Failed to save embedding settings",proFeature:"Pro",watcher:"File Watcher",watcherPaths:"Watched Paths",watcherRecent:"Recent Activity",watcherRunning:"Running",watcherStopped:"Stopped",watcherDisabled:"Disabled",watcherNoActivity:"No recent activity"},dE={title:"Cloud Sync",refresh:"Refresh",connectionStatus:"Connection",status:"Status",cloudConnected:"Connected",notConnected:"Not Connected",hubUrl:"Hub URL",apiKey:"API Key",deviceId:"Device ID",disconnect:"Disconnect",setupCloud:"Connect to Cloud",setupTitle:"Connect to Cloud Hub",setupDesc:"Enter your hub URL and API key to sync memories across devices. Register at the hub to get your key.",keyRequired:"API key is required",keyInvalid:"API key must start with nmk_",keyHint:"Get your key by registering at the hub. It starts with nmk_.",connect:"Connect",connecting:"Connecting...",connected:"Cloud sync connected!",connectFailed:"Failed to connect",disconnected:"Cloud sync disconnected",disconnectFailed:"Failed to disconnect",devices:"Devices",lastSync:"Last sync",never:"Never",noDevices:"No devices registered yet. Sync from a device to register it.",changeLog:"Change Log",totalChanges:"Total Changes",synced:"Synced",pending:"Pending",latestSequence:"Latest Sequence",conflictStrategy:"Conflict Resolution",conflictDesc:"How to resolve when the same memory is changed on multiple devices.",strategyUpdated:"Conflict strategy updated",updateFailed:"Failed to update config",syncMode:"Sync Mode",merkleDelta:"Merkle Delta",fullSync:"Full Sync"},hE={title:"Brain Oracle",loading:"Channeling your memories...",needMore:"Your brain needs more memories",needMoreDesc:"The Oracle requires at least 3 memories to unlock. Ask your AI agent to remember decisions, insights, and learnings — then return for your reading.",dailyHint:"Tap each card to reveal your reading",past:"Past",present:"Present",future:"Future",readingDate:"Reading for {{brain}} on {{date}}",whatifHint:"What if these memories collided?",reshuffle:"Reshuffle",memory:"Memory",wildcard:"Wildcard",matchupComplete:"Matchup Complete!",matchupScoreDesc:"Based on activation strength and connections of your chosen memories",playAgain:"Play Again",round:"Round {{current}} / {{total}}",choose:"Choose",chosen:"Chosen!",score:"Score",dailyReading:"Daily Reading",whatif:"What If",matchup:"Matchup",copyCard:"Copy Card",copied:"Copied!",downloadCard:"Download"},mE={search:"Search...",placeholder:"Search pages, fibers, memories...",noResults:"No results found.",pages:"Pages",fibers:"Fibers",neurons:"Memories",semanticSearch:"Semantic Search — find by meaning",crossBrainSearch:"Cross-Brain Search — search all brains",navigate:"navigate",select:"open",close:"close"},gE={title:"Tool Stats",totalEvents:"Total Events",successRate:"Success Rate",uniqueTools:"Unique Tools",topTools:"Top Tools",usageOverTime:"Usage Over Time",detailTable:"Tool Details",tool:"Tool",calls:"Calls",avgDuration:"Avg Duration",server:"Server",noData:"No tool events recorded yet. Use Surreal-Memory tools to start tracking."},pE={title:"Memory Visualizer",description:"Query your memories and generate charts from stored data."},vE={title:"Storage",currentBackend:"Current Backend",brain:"Brain",neurons:"Neurons",synapses:"Synapses",fibers:"Fibers",tierDistribution:"Memory Tiers",tierHot:"HOT — Always in context",tierWarm:"WARM — Semantic match",tierCold:"COLD — Explicit recall only",totalMemories:"Total typed memories"},yE={tier:"License",pro_badge:"PRO",pro_feature:"Pro Feature",free:"Free",pro:"Pro",team:"Team"},bE={title:"Get Surreal-Memory Pro",subtitle:"Choose your payment method",enterKey:"Enter your license key",enterEmail:"Enter your email for the license:",orActivate:"or activate a key",haveKey:"I already have a license key",licenseKey:"License Key",activate:"Activate",activated:"Pro activated!",activationFailed:"Activation failed. Check your key.",back:"Back"},SE={nav:eE,common:tE,reasoning:nE,overview:aE,health:lE,uncertainty:iE,enrichment:sE,graph:rE,timeline:oE,evolution:uE,diagrams:cE,settings:fE,sync:dE,oracle:hE,commandPalette:mE,toolStats:gE,visualize:pE,storage:vE,license:yE,upgrade:bE};ht.use(gp).use(hb).init({resources:{en:{translation:SE}},fallbackLng:"en",detection:{order:["localStorage","navigator"],lookupLocalStorage:"smem-lang",caches:["localStorage"]},interpolation:{escapeValue:!1}});const xE=new Dy({defaultOptions:{queries:{staleTime:3e4,retry:1,refetchOnWindowFocus:!1}}});e0.createRoot(document.getElementById("root")).render(E.jsx(y.StrictMode,{children:E.jsx(Ay,{client:xE,children:E.jsxs(Uy,{basename:window.location.pathname.startsWith("/dashboard")?"/dashboard":"/ui",children:[E.jsx(Hx,{}),E.jsx(D0,{position:"bottom-right",toastOptions:{className:"bg-card text-card-foreground border-border"}})]})})}));export{XE as A,Ub as B,AE as C,wg as D,ji as E,Nt as _,cr as a,Mb as b,wE as c,RE as d,HE as e,xr as f,zE as g,ME as h,BE as i,jE as j,_E as k,LE as l,jb as m,UE as n,qe as o,kE as p,KE as q,QE as r,GE as s,DE as t,YE as u,_b as v,VE as w,ZE as x,Im as y,qE as z}; diff --git a/src/surreal_memory/server/static/dist/assets/index-D3f19VU2.css b/src/surreal_memory/server/static/dist/assets/index-D3f19VU2.css new file mode 100644 index 00000000..3b2d3c77 --- /dev/null +++ b/src/surreal_memory/server/static/dist/assets/index-D3f19VU2.css @@ -0,0 +1 @@ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-divide-x-reverse:0}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, sans-serif;--font-mono:"JetBrains Mono", ui-monospace, monospace;--color-red-500:oklch(63.7% .237 25.331);--color-red-900:oklch(39.6% .141 25.723);--color-red-950:oklch(25.8% .092 26.042);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-950:oklch(26.6% .079 36.259);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-900:oklch(41.4% .112 45.904);--color-amber-950:oklch(27.9% .077 45.635);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-900:oklch(37.8% .077 168.94);--color-emerald-950:oklch(26.2% .051 172.552);--color-teal-900:oklch(38.6% .063 188.416);--color-teal-950:oklch(27.7% .046 192.524);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-900:oklch(39.8% .07 227.392);--color-cyan-950:oklch(30.2% .056 229.695);--color-blue-900:oklch(37.9% .146 265.522);--color-blue-950:oklch(28.2% .091 267.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-violet-900:oklch(38% .189 293.745);--color-violet-950:oklch(28.3% .141 291.089);--color-rose-900:oklch(41% .159 10.272);--color-rose-950:oklch(27.1% .105 12.094);--color-stone-900:oklch(21.6% .006 56.043);--color-stone-950:oklch(14.7% .004 49.25);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-7xl:4.5rem;--text-7xl--line-height:1;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-md:8px;--radius-lg:12px;--radius-xl:16px;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-background:#faf8f3;--color-foreground:#1a1714;--color-card:#f5f0ea;--color-card-foreground:#1a1714;--color-primary:#6366f1;--color-primary-foreground:#fff;--color-secondary:#ede5d8;--color-secondary-foreground:#1a1714;--color-muted:#ede5d8;--color-muted-foreground:#78716c;--color-accent:#e8e0d4;--color-accent-foreground:#1a1714;--color-destructive:#dc2626;--color-destructive-foreground:#fff;--color-border:#d4ccc2;--color-input:#d4ccc2;--color-ring:#6366f1;--color-health-good:#059669;--color-health-warn:#f59e0b;--color-chart-1:#6366f1;--color-chart-2:#8b5cf6;--color-chart-3:#06b6d4;--color-chart-4:#f59e0b;--color-chart-5:#059669;--font-display:"Space Grotesk", ui-sans-serif, system-ui, sans-serif;--transition-normal:.25s ease;--color-sidebar:#f0ebe4;--color-sidebar-foreground:#1a1714;--color-sidebar-border:#d4ccc2;--color-sidebar-accent:#e8e0d4;--color-sidebar-primary:#6366f1}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-2{top:calc(var(--spacing) * 2)}.top-3{top:calc(var(--spacing) * 3)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.bottom-12{bottom:calc(var(--spacing) * 12)}.left-0{left:calc(var(--spacing) * 0)}.left-3{left:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\[100\]{z-index:100}.m-auto{margin:auto}.mx-auto{margin-inline:auto}.my-4{margin-block:calc(var(--spacing) * 4)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-auto{margin-bottom:auto}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-6{margin-left:calc(var(--spacing) * 6)}.ml-16{margin-left:calc(var(--spacing) * 16)}.ml-56{margin-left:calc(var(--spacing) * 56)}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-1\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.size-12{width:calc(var(--spacing) * 12);height:calc(var(--spacing) * 12)}.size-16{width:calc(var(--spacing) * 16);height:calc(var(--spacing) * 16)}.h-0\.5{height:calc(var(--spacing) * .5)}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-24{height:calc(var(--spacing) * 24)}.h-28{height:calc(var(--spacing) * 28)}.h-32{height:calc(var(--spacing) * 32)}.h-48{height:calc(var(--spacing) * 48)}.h-64{height:calc(var(--spacing) * 64)}.h-72{height:calc(var(--spacing) * 72)}.h-80{height:calc(var(--spacing) * 80)}.h-\[340px\]{height:340px}.h-\[calc\(100vh-3\.5rem\)\]{height:calc(100vh - 3.5rem)}.h-\[calc\(100vh-14rem\)\]{height:calc(100vh - 14rem)}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-96{max-height:calc(var(--spacing) * 96)}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\[200px\]{min-height:200px}.min-h-\[500px\]{min-height:500px}.w-3\/4{width:75%}.w-4{width:calc(var(--spacing) * 4)}.w-9{width:calc(var(--spacing) * 9)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-40{width:calc(var(--spacing) * 40)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-\[240px\]{width:240px}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[200px\]{max-width:200px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-105{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:var(--color-border)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.\!border-0{border-style:var(--tw-border-style)!important;border-width:0!important}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.\!border-border{border-color:var(--color-border)!important}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-border{border-color:var(--color-border)}.border-border\/50{border-color:#d4ccc280}@supports (color:color-mix(in lab,red,red)){.border-border\/50{border-color:color-mix(in oklab,var(--color-border) 50%,transparent)}}.border-input{border-color:var(--color-input)}.border-muted-foreground{border-color:var(--color-muted-foreground)}.border-primary{border-color:var(--color-primary)}.border-primary\/20{border-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.border-primary\/20{border-color:color-mix(in oklab,var(--color-primary) 20%,transparent)}}.border-primary\/30{border-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.border-primary\/30{border-color:color-mix(in oklab,var(--color-primary) 30%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-sidebar-border{border-color:var(--color-sidebar-border)}.border-transparent{border-color:#0000}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.border-t-transparent{border-top-color:#0000}.\!bg-card{background-color:var(--color-card)!important}.\!bg-transparent{background-color:#0000!important}.bg-\[\#16140f\]{background-color:#16140f}.bg-accent{background-color:var(--color-accent)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-background{background-color:var(--color-background)}.bg-background\/80{background-color:#faf8f3cc}@supports (color:color-mix(in lab,red,red)){.bg-background\/80{background-color:color-mix(in oklab,var(--color-background) 80%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-card{background-color:var(--color-card)}.bg-card\/90{background-color:#f5f0eae6}@supports (color:color-mix(in lab,red,red)){.bg-card\/90{background-color:color-mix(in oklab,var(--color-card) 90%,transparent)}}.bg-destructive{background-color:var(--color-destructive)}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-health-good\/10{background-color:#0596691a}@supports (color:color-mix(in lab,red,red)){.bg-health-good\/10{background-color:color-mix(in oklab,var(--color-health-good) 10%,transparent)}}.bg-health-warn\/10{background-color:#f59e0b1a}@supports (color:color-mix(in lab,red,red)){.bg-health-warn\/10{background-color:color-mix(in oklab,var(--color-health-warn) 10%,transparent)}}.bg-muted{background-color:var(--color-muted)}.bg-muted\/20{background-color:#ede5d833}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,var(--color-muted) 20%,transparent)}}.bg-muted\/30{background-color:#ede5d84d}@supports (color:color-mix(in lab,red,red)){.bg-muted\/30{background-color:color-mix(in oklab,var(--color-muted) 30%,transparent)}}.bg-muted\/40{background-color:#ede5d866}@supports (color:color-mix(in lab,red,red)){.bg-muted\/40{background-color:color-mix(in oklab,var(--color-muted) 40%,transparent)}}.bg-orange-500{background-color:var(--color-orange-500)}.bg-primary{background-color:var(--color-primary)}.bg-primary\/5{background-color:#6366f10d}@supports (color:color-mix(in lab,red,red)){.bg-primary\/5{background-color:color-mix(in oklab,var(--color-primary) 5%,transparent)}}.bg-primary\/10{background-color:#6366f11a}@supports (color:color-mix(in lab,red,red)){.bg-primary\/10{background-color:color-mix(in oklab,var(--color-primary) 10%,transparent)}}.bg-primary\/15{background-color:#6366f126}@supports (color:color-mix(in lab,red,red)){.bg-primary\/15{background-color:color-mix(in oklab,var(--color-primary) 15%,transparent)}}.bg-primary\/90{background-color:#6366f1e6}@supports (color:color-mix(in lab,red,red)){.bg-primary\/90{background-color:color-mix(in oklab,var(--color-primary) 90%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-secondary{background-color:var(--color-secondary)}.bg-sidebar{background-color:var(--color-sidebar)}.bg-sidebar-accent{background-color:var(--color-sidebar-accent)}.bg-transparent{background-color:#0000}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-amber-900\/40{--tw-gradient-from:#7b330666}@supports (color:color-mix(in lab,red,red)){.from-amber-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-amber-900) 40%, transparent)}}.from-amber-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-900\/40{--tw-gradient-from:#1c398e66}@supports (color:color-mix(in lab,red,red)){.from-blue-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-blue-900) 40%, transparent)}}.from-blue-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-900\/40{--tw-gradient-from:#104e6466}@supports (color:color-mix(in lab,red,red)){.from-cyan-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-cyan-900) 40%, transparent)}}.from-cyan-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-900\/40{--tw-gradient-from:#004e3b66}@supports (color:color-mix(in lab,red,red)){.from-emerald-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-900) 40%, transparent)}}.from-emerald-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-primary\/5{--tw-gradient-from:#6366f10d}@supports (color:color-mix(in lab,red,red)){.from-primary\/5{--tw-gradient-from:color-mix(in oklab, var(--color-primary) 5%, transparent)}}.from-primary\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-red-900\/40{--tw-gradient-from:#82181a66}@supports (color:color-mix(in lab,red,red)){.from-red-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-red-900) 40%, transparent)}}.from-red-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-900\/40{--tw-gradient-from:#8b083666}@supports (color:color-mix(in lab,red,red)){.from-rose-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-rose-900) 40%, transparent)}}.from-rose-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-stone-900\/40{--tw-gradient-from:#1c191766}@supports (color:color-mix(in lab,red,red)){.from-stone-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-stone-900) 40%, transparent)}}.from-stone-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-900\/40{--tw-gradient-from:#0b4f4a66}@supports (color:color-mix(in lab,red,red)){.from-teal-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-teal-900) 40%, transparent)}}.from-teal-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-900\/40{--tw-gradient-from:#4d179a66}@supports (color:color-mix(in lab,red,red)){.from-violet-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-violet-900) 40%, transparent)}}.from-violet-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-amber-950\/60{--tw-gradient-to:#46190199}@supports (color:color-mix(in lab,red,red)){.to-amber-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-amber-950) 60%, transparent)}}.to-amber-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-blue-950\/60{--tw-gradient-to:#16245699}@supports (color:color-mix(in lab,red,red)){.to-blue-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-blue-950) 60%, transparent)}}.to-blue-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-950\/60{--tw-gradient-to:#05334599}@supports (color:color-mix(in lab,red,red)){.to-cyan-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-950) 60%, transparent)}}.to-cyan-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-950\/60{--tw-gradient-to:#002c2299}@supports (color:color-mix(in lab,red,red)){.to-emerald-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-emerald-950) 60%, transparent)}}.to-emerald-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-950\/60{--tw-gradient-to:#44130699}@supports (color:color-mix(in lab,red,red)){.to-orange-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-orange-950) 60%, transparent)}}.to-orange-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-primary\/10{--tw-gradient-to:#6366f11a}@supports (color:color-mix(in lab,red,red)){.to-primary\/10{--tw-gradient-to:color-mix(in oklab, var(--color-primary) 10%, transparent)}}.to-primary\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-red-950\/60{--tw-gradient-to:#46080999}@supports (color:color-mix(in lab,red,red)){.to-red-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-red-950) 60%, transparent)}}.to-red-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-rose-950\/60{--tw-gradient-to:#4d021899}@supports (color:color-mix(in lab,red,red)){.to-rose-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-rose-950) 60%, transparent)}}.to-rose-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-stone-950\/60{--tw-gradient-to:#0c0a0999}@supports (color:color-mix(in lab,red,red)){.to-stone-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-stone-950) 60%, transparent)}}.to-stone-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-teal-950\/60{--tw-gradient-to:#022f2e99}@supports (color:color-mix(in lab,red,red)){.to-teal-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-teal-950) 60%, transparent)}}.to-teal-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-violet-950\/60{--tw-gradient-to:#2f0d6899}@supports (color:color-mix(in lab,red,red)){.to-violet-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-violet-950) 60%, transparent)}}.to-violet-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[15vh\]{padding-top:15vh}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-6{padding-left:calc(var(--spacing) * 6)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-display{font-family:var(--font-display)}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-7xl{font-size:var(--text-7xl);line-height:var(--tw-leading,var(--text-7xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-card-foreground{color:var(--color-card-foreground)}.text-cyan-500{color:var(--color-cyan-500)}.text-destructive{color:var(--color-destructive)}.text-destructive-foreground{color:var(--color-destructive-foreground)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-foreground{color:var(--color-foreground)}.text-foreground\/80{color:#1a1714cc}@supports (color:color-mix(in lab,red,red)){.text-foreground\/80{color:color-mix(in oklab,var(--color-foreground) 80%,transparent)}}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-health-good{color:var(--color-health-good)}.text-health-warn{color:var(--color-health-warn)}.text-indigo-500{color:var(--color-indigo-500)}.text-muted-foreground{color:var(--color-muted-foreground)}.text-muted-foreground\/40{color:#78716c66}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/40{color:color-mix(in oklab,var(--color-muted-foreground) 40%,transparent)}}.text-muted-foreground\/70{color:#78716cb3}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,var(--color-muted-foreground) 70%,transparent)}}.text-orange-500{color:var(--color-orange-500)}.text-primary{color:var(--color-primary)}.text-primary-foreground{color:var(--color-primary-foreground)}.text-red-500{color:var(--color-red-500)}.text-secondary-foreground{color:var(--color-secondary-foreground)}.text-sidebar-foreground{color:var(--color-sidebar-foreground)}.text-sidebar-foreground\/50{color:#1a171480}@supports (color:color-mix(in lab,red,red)){.text-sidebar-foreground\/50{color:color-mix(in oklab,var(--color-sidebar-foreground) 50%,transparent)}}.text-sidebar-foreground\/70{color:#1a1714b3}@supports (color:color-mix(in lab,red,red)){.text-sidebar-foreground\/70{color:color-mix(in oklab,var(--color-sidebar-foreground) 70%,transparent)}}.text-sidebar-primary{color:var(--color-sidebar-primary)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white) 40%,transparent)}}.text-white\/50{color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.text-white\/50{color:color-mix(in oklab,var(--color-white) 50%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline-offset-4{text-underline-offset:4px}.accent-primary{accent-color:var(--color-primary)}.opacity-10{opacity:.1}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.\!shadow-sm{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0000000d)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px var(--tw-shadow-color,#00000012);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-primary{--tw-ring-color:var(--color-primary)}.ring-primary\/30{--tw-ring-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.ring-primary\/30{--tw-ring-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}.ring-white\/5{--tw-ring-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.ring-white\/5{--tw-ring-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.ring-offset-2{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-background{--tw-ring-offset-color:var(--color-background)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.duration-700{--tw-duration:.7s;transition-duration:.7s}.duration-\[var\(--transition-normal\)\]{--tw-duration:var(--transition-normal);transition-duration:var(--transition-normal)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:bg-primary:is(:where(.group):hover *){background-color:var(--color-primary)}.group-hover\:text-foreground:is(:where(.group):hover *){color:var(--color-foreground)}}.placeholder\:text-muted-foreground::placeholder{color:var(--color-muted-foreground)}.backdrop\:bg-black\/50::backdrop{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.backdrop\:bg-black\/50::backdrop{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.first\:pt-0:first-child{padding-top:calc(var(--spacing) * 0)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}.last\:pb-0:last-child{padding-bottom:calc(var(--spacing) * 0)}@media(hover:hover){.hover\:border-primary\/40:hover{border-color:#6366f166}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/40:hover{border-color:color-mix(in oklab,var(--color-primary) 40%,transparent)}}.hover\:bg-accent:hover{background-color:var(--color-accent)}.hover\:bg-accent\/30:hover{background-color:#e8e0d44d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-accent\/30:hover{background-color:color-mix(in oklab,var(--color-accent) 30%,transparent)}}.hover\:bg-accent\/50:hover{background-color:#e8e0d480}@supports (color:color-mix(in lab,red,red)){.hover\:bg-accent\/50:hover{background-color:color-mix(in oklab,var(--color-accent) 50%,transparent)}}.hover\:bg-destructive\/90:hover{background-color:#dc2626e6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--color-destructive) 90%,transparent)}}.hover\:bg-primary:hover{background-color:var(--color-primary)}.hover\:bg-primary\/90:hover{background-color:#6366f1e6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--color-primary) 90%,transparent)}}.hover\:bg-secondary\/80:hover{background-color:#ede5d8cc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--color-secondary) 80%,transparent)}}.hover\:bg-sidebar-accent:hover{background-color:var(--color-sidebar-accent)}.hover\:text-accent-foreground:hover{color:var(--color-accent-foreground)}.hover\:text-destructive:hover{color:var(--color-destructive)}.hover\:text-foreground:hover{color:var(--color-foreground)}.hover\:text-primary-foreground:hover{color:var(--color-primary-foreground)}.hover\:text-primary\/80:hover{color:#6366f1cc}@supports (color:color-mix(in lab,red,red)){.hover\:text-primary\/80:hover{color:color-mix(in oklab,var(--color-primary) 80%,transparent)}}.hover\:text-sidebar-foreground:hover{color:var(--color-sidebar-foreground)}.hover\:underline:hover{text-decoration-line:underline}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px var(--tw-shadow-color,#00000012);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-sm:hover{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-ring:focus{--tw-ring-color:var(--color-ring)}.focus\:outline-2:focus{outline-style:var(--tw-outline-style);outline-width:2px}.focus\:outline-offset-2:focus{outline-offset:2px}.focus\:outline-ring:focus{outline-color:var(--color-ring)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-ring:focus-visible{outline-color:var(--color-ring)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.aria-selected\:bg-accent[aria-selected=true]{background-color:var(--color-accent)}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}@media(min-width:40rem){.sm\:inline{display:inline}.sm\:inline-flex{display:inline-flex}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}:where(.sm\:divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.sm\:divide-y-0>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(0px * var(--tw-divide-y-reverse));border-bottom-width:calc(0px * calc(1 - var(--tw-divide-y-reverse)))}.sm\:p-5{padding:calc(var(--spacing) * 5)}.sm\:pr-4{padding-right:calc(var(--spacing) * 4)}.sm\:pl-4{padding-left:calc(var(--spacing) * 4)}}@media(min-width:48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(min-width:64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&\>button\]\:\!border-border>button{border-color:var(--color-border)!important}.\[\&\>button\]\:\!bg-card>button{background-color:var(--color-card)!important}.\[\&\>button\]\:\!fill-foreground>button{fill:var(--color-foreground)!important}}:root.dark{--color-background:#0c0b09;--color-foreground:#f5f0ea;--color-card:#16140f;--color-card-foreground:#f0ebe4;--color-popover:#1a1814;--color-popover-foreground:#f5f0ea;--color-primary:#818cf8;--color-primary-foreground:#0c0b09;--color-secondary:#1e1b16;--color-secondary-foreground:#f5f0ea;--color-muted:#1e1b16;--color-muted-foreground:#a8a29e;--color-accent:#292520;--color-accent-foreground:#f5f0ea;--color-destructive:#ef4444;--color-destructive-foreground:#fff;--color-border:#2e2a24;--color-input:#342f28;--color-ring:#818cf8;--color-health-good:#34d399;--color-health-warn:#fbbf24;--color-health-bad:#f87171;--shadow-sm:0 1px 3px #0006, 0 1px 2px #0000004d;--shadow-md:0 4px 12px #00000080, 0 2px 4px #00000059;--shadow-lg:0 12px 28px #0000008c, 0 4px 8px #0006;--color-sidebar:#0e0d0a;--color-sidebar-foreground:#f5f0ea;--color-sidebar-border:#2e2a24;--color-sidebar-accent:#1e1b16;--color-sidebar-accent-foreground:#f5f0ea;--color-sidebar-primary:#818cf8;--color-sidebar-primary-foreground:#0c0b09;--color-sidebar-ring:#818cf8}body{font-family:var(--font-sans);background-color:var(--color-background);color:var(--color-foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.font-display{font-family:var(--font-display)}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:9999px}::-webkit-scrollbar-thumb:hover{background:var(--color-muted-foreground)}.dark .border{border-color:#ffffff0f}.dark .rounded-xl{background-image:linear-gradient(#ffffff06,#0000 50%);box-shadow:0 0 0 1px #ffffff0a,0 2px 8px #0006}.dark aside{box-shadow:1px 0 12px #00000080}.dark header{box-shadow:0 1px 8px #0006}:focus-visible{outline:2px solid var(--color-ring);outline-offset:2px}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/src/surreal_memory/server/static/dist/assets/skeleton-CBW-y0cP.js b/src/surreal_memory/server/static/dist/assets/skeleton-gKUrR2fT.js similarity index 69% rename from src/surreal_memory/server/static/dist/assets/skeleton-CBW-y0cP.js rename to src/surreal_memory/server/static/dist/assets/skeleton-gKUrR2fT.js index 86c11f0d..446329a6 100644 --- a/src/surreal_memory/server/static/dist/assets/skeleton-CBW-y0cP.js +++ b/src/surreal_memory/server/static/dist/assets/skeleton-gKUrR2fT.js @@ -1 +1 @@ -import{j as m}from"./vendor-query-CqA1cBNl.js";import{E as o}from"./index-DXL5wCpD.js";function n({className:e,...t}){return m.jsx("div",{className:o("animate-pulse rounded-md bg-muted",e),...t})}export{n as S}; +import{j as m}from"./vendor-query-CqA1cBNl.js";import{E as o}from"./index-CLb-kMYl.js";function n({className:e,...t}){return m.jsx("div",{className:o("animate-pulse rounded-md bg-muted",e),...t})}export{n as S}; diff --git a/src/surreal_memory/server/static/dist/index.html b/src/surreal_memory/server/static/dist/index.html index 30b72795..1e2dbee6 100644 --- a/src/surreal_memory/server/static/dist/index.html +++ b/src/surreal_memory/server/static/dist/index.html @@ -5,13 +5,13 @@ dashboard - + - +
diff --git a/src/surreal_memory/unified_config.py b/src/surreal_memory/unified_config.py index 7f6be427..7cf5c703 100755 --- a/src/surreal_memory/unified_config.py +++ b/src/surreal_memory/unified_config.py @@ -1090,6 +1090,10 @@ def _sanitize_toml_glob(value: str) -> str: "data-analysis", ) +# Model-name / glob shape for reasoning config keys — mirrors the route's +# _validate_model_name so config-level and API-level validation agree. +_REASONING_MODEL_NAME_RE = re.compile(r"^[A-Za-z0-9._*?-]{1,128}$") + @dataclass(frozen=True) class ReasoningTrainingConfig: @@ -1109,19 +1113,22 @@ class ReasoningTrainingConfig: injection_map: tuple[tuple[str, str], ...] = () categories: tuple[str, ...] = _DEFAULT_REASONING_CATEGORIES min_trace_chars: int = 200 - max_trace_chars: int = 20_000 - max_traces_per_scan: int = 500 + max_trace_chars: int = 100_000 scan_lookback_days: int = 30 # 0 = full backfill retention_days: int = 90 max_traces_total: int = 20_000 min_cluster_support: int = 3 - max_patterns_per_run: int = 10 min_confidence: float = 0.2 min_patterns_per_category: int = 3 injection_max_patterns: int = 5 injection_max_chars: int = 4000 distill_use_llm: bool = False redact_secrets: bool = True + # Per-model distillation targets: model name -> desired pattern count (0-100). + # An unlisted model defaults to 0 → distillation is skipped for it (the + # preliminary Mine only DETECTS models; a UI slider raises a target to + # actually distill). Mutable default, but the config is loaded read-only. + pattern_targets: dict[str, int] = field(default_factory=dict) def to_dict(self) -> dict[str, Any]: return { @@ -1132,18 +1139,17 @@ def to_dict(self) -> dict[str, Any]: "categories": list(self.categories), "min_trace_chars": self.min_trace_chars, "max_trace_chars": self.max_trace_chars, - "max_traces_per_scan": self.max_traces_per_scan, "scan_lookback_days": self.scan_lookback_days, "retention_days": self.retention_days, "max_traces_total": self.max_traces_total, "min_cluster_support": self.min_cluster_support, - "max_patterns_per_run": self.max_patterns_per_run, "min_confidence": self.min_confidence, "min_patterns_per_category": self.min_patterns_per_category, "injection_max_patterns": self.injection_max_patterns, "injection_max_chars": self.injection_max_chars, "distill_use_llm": self.distill_use_llm, "redact_secrets": self.redact_secrets, + "pattern_targets": dict(self.pattern_targets), } @classmethod @@ -1185,6 +1191,22 @@ def _int(key: str, default: int, lo: int, hi: int) -> int: except (ValueError, TypeError): min_confidence = 0.2 + # Per-model pattern targets: {model: 0..100}. Keys must be model-name + # shaped (bad keys skipped, not fatal — this loads from disk); values + # clamp to 0..100. Legacy keys like max_patterns_per_run are ignored + # simply by never being read here. + targets_raw = data.get("pattern_targets", {}) + pattern_targets: dict[str, int] = {} + if isinstance(targets_raw, dict): + for model, count in targets_raw.items(): + name = str(model).strip() + if not name or not _REASONING_MODEL_NAME_RE.match(name): + continue + try: + pattern_targets[name[:128]] = max(0, min(int(count), 100)) + except (ValueError, TypeError): + continue + return cls( mining_enabled=bool(data.get("mining_enabled", False)), injection_enabled=bool(data.get("injection_enabled", False)), @@ -1192,19 +1214,18 @@ def _int(key: str, default: int, lo: int, hi: int) -> int: injection_map=tuple(injection_pairs), categories=categories, min_trace_chars=_int("min_trace_chars", 200, 0, 1_000_000), - max_trace_chars=_int("max_trace_chars", 20_000, 1, 10_000_000), - max_traces_per_scan=_int("max_traces_per_scan", 500, 1, 1_000_000), + max_trace_chars=_int("max_trace_chars", 100_000, 1, 10_000_000), scan_lookback_days=_int("scan_lookback_days", 30, 0, 100_000), retention_days=_int("retention_days", 90, 1, 100_000), max_traces_total=_int("max_traces_total", 20_000, 1, 100_000_000), min_cluster_support=_int("min_cluster_support", 3, 1, 100_000), - max_patterns_per_run=_int("max_patterns_per_run", 10, 1, 100_000), min_confidence=min_confidence, min_patterns_per_category=_int("min_patterns_per_category", 3, 1, 100_000), injection_max_patterns=_int("injection_max_patterns", 5, 1, 1000), injection_max_chars=_int("injection_max_chars", 4000, 1, 1_000_000), distill_use_llm=bool(data.get("distill_use_llm", False)), redact_secrets=bool(data.get("redact_secrets", True)), + pattern_targets=pattern_targets, ) @@ -1773,12 +1794,10 @@ def _reasoning_toml_lines(self) -> list[str]: f"categories = [{cats}]", f"min_trace_chars = {rt.min_trace_chars}", f"max_trace_chars = {rt.max_trace_chars}", - f"max_traces_per_scan = {rt.max_traces_per_scan}", f"scan_lookback_days = {rt.scan_lookback_days}", f"retention_days = {rt.retention_days}", f"max_traces_total = {rt.max_traces_total}", f"min_cluster_support = {rt.min_cluster_support}", - f"max_patterns_per_run = {rt.max_patterns_per_run}", f"min_confidence = {rt.min_confidence}", f"min_patterns_per_category = {rt.min_patterns_per_category}", f"injection_max_patterns = {rt.injection_max_patterns}", @@ -1792,6 +1811,12 @@ def _reasoning_toml_lines(self) -> list[str]: gv = _sanitize_toml_glob(source) if gk and gv: lines.append(f'"{gk}" = "{gv}"') + # Per-model pattern targets subtable (model = 0..100). Empty is fine. + lines.append("[reasoning_training.pattern_targets]") + for model, count in rt.pattern_targets.items(): + gk = _sanitize_toml_glob(model) + if gk: + lines.append(f'"{gk}" = {int(count)}') return lines def save(self) -> None: diff --git a/tests/unit/test_cli_reasoning.py b/tests/unit/test_cli_reasoning.py index bc3b4f97..0257239f 100644 --- a/tests/unit/test_cli_reasoning.py +++ b/tests/unit/test_cli_reasoning.py @@ -142,8 +142,9 @@ def test_mine_disabled_exits_nonzero(tmp_path: Path) -> None: def test_mine_runs_when_enabled(tmp_path: Path) -> None: storage = _storage() - ingest = SimpleNamespace(traces_ingested=4, traces_scanned=10) + ingest = SimpleNamespace(traces_ingested=4, traces_scanned=10, files_scanned=3, files_total=3) distill = SimpleNamespace(patterns_learned=2, traces_processed=4, models_seen=1) + ingest_mock = AsyncMock(return_value=ingest) with ( patch(f"{CLI}.get_config", MagicMock()), patch(f"{CLI}.get_storage", new=AsyncMock(return_value=storage)), @@ -151,10 +152,7 @@ def test_mine_runs_when_enabled(tmp_path: Path) -> None: "surreal_memory.unified_config.get_config", return_value=_ucfg(tmp_path, mining_enabled=True), ), - patch( - "surreal_memory.engine.reasoning_miner.ingest_reasoning_traces", - new=AsyncMock(return_value=ingest), - ), + patch("surreal_memory.engine.reasoning_miner.ingest_reasoning_traces", new=ingest_mock), patch( "surreal_memory.engine.reasoning_distiller.distill_reasoning_patterns", new=AsyncMock(return_value=distill), @@ -166,6 +164,8 @@ def test_mine_runs_when_enabled(tmp_path: Path) -> None: data = json.loads(result.output) assert data["traces_ingested"] == 4 assert data["patterns_learned"] == 2 + # No --backfill flag → backfill must default to False (never a silent full rescan). + assert ingest_mock.await_args.kwargs["backfill"] is False def test_mine_dry_run(tmp_path: Path) -> None: @@ -189,7 +189,7 @@ def test_mine_dry_run(tmp_path: Path) -> None: def test_mine_force_bypasses_disabled(tmp_path: Path) -> None: # --force runs mining even when mining_enabled is False (the privacy escape hatch). storage = _storage() - ingest = SimpleNamespace(traces_ingested=1, traces_scanned=1) + ingest = SimpleNamespace(traces_ingested=1, traces_scanned=1, files_scanned=1, files_total=1) distill = SimpleNamespace(patterns_learned=0, traces_processed=1, models_seen=1) with ( patch(f"{CLI}.get_config", MagicMock()), @@ -213,7 +213,11 @@ def test_mine_force_bypasses_disabled(tmp_path: Path) -> None: def test_mine_applies_overrides(tmp_path: Path) -> None: # --backfill + --models must flow into the run config passed to the engine. storage = _storage() - ingest_mock = AsyncMock(return_value=SimpleNamespace(traces_ingested=1, traces_scanned=1)) + ingest_mock = AsyncMock( + return_value=SimpleNamespace( + traces_ingested=1, traces_scanned=1, files_scanned=1, files_total=1 + ) + ) distill_mock = AsyncMock( return_value=SimpleNamespace(patterns_learned=0, traces_processed=1, models_seen=1) ) @@ -237,3 +241,6 @@ def test_mine_applies_overrides(tmp_path: Path) -> None: run_cfg = ingest_mock.await_args.args[2] # (storage, brain_id, config) assert run_cfg.reasoning_training.scan_lookback_days == 0 assert run_cfg.reasoning_training.mining_models == ("a", "b") + # --backfill must also flow as the real backfill kwarg (full-rescan bypass), + # not just the scan_lookback_days=0 override. + assert ingest_mock.await_args.kwargs["backfill"] is True diff --git a/tests/unit/test_health_fixes.py b/tests/unit/test_health_fixes.py index f6a4bd82..6b7f0550 100755 --- a/tests/unit/test_health_fixes.py +++ b/tests/unit/test_health_fixes.py @@ -485,7 +485,7 @@ class TestVersionBump: def test_version_is_current(self) -> None: import surreal_memory - assert surreal_memory.__version__ == "2.12.1" + assert surreal_memory.__version__ == "2.13.0" class TestPackageIntegrity: diff --git a/tests/unit/test_mcp_reasoning.py b/tests/unit/test_mcp_reasoning.py index fd6c2951..91a362c8 100644 --- a/tests/unit/test_mcp_reasoning.py +++ b/tests/unit/test_mcp_reasoning.py @@ -126,8 +126,9 @@ async def test_reasoning_mine_disabled(tmp_path: Path) -> None: async def test_reasoning_mine_runs(tmp_path: Path) -> None: server = _make_server(tmp_path, mining_enabled=True) storage = _storage() - ingest = SimpleNamespace(traces_ingested=4, traces_scanned=10) + ingest = SimpleNamespace(traces_ingested=4, traces_scanned=10, files_scanned=3, files_total=3) distill = SimpleNamespace(patterns_learned=2, traces_processed=4, models_seen=1) + ingest_mock = AsyncMock(return_value=ingest) with ( patch.object(server, "get_storage", return_value=storage), # mine runs on an isolated (non-cached) storage to avoid the shared-singleton race. @@ -135,10 +136,7 @@ async def test_reasoning_mine_runs(tmp_path: Path) -> None: "surreal_memory.unified_config.create_isolated_storage", new=AsyncMock(return_value=storage), ), - patch( - "surreal_memory.engine.reasoning_miner.ingest_reasoning_traces", - new=AsyncMock(return_value=ingest), - ), + patch("surreal_memory.engine.reasoning_miner.ingest_reasoning_traces", new=ingest_mock), patch( "surreal_memory.engine.reasoning_distiller.distill_reasoning_patterns", new=AsyncMock(return_value=distill), @@ -148,6 +146,8 @@ async def test_reasoning_mine_runs(tmp_path: Path) -> None: assert result["traces_ingested"] == 4 assert result["patterns_learned"] == 2 + # No backfill arg → backfill must default to False (never a silent full rescan). + assert ingest_mock.await_args.kwargs["backfill"] is False @pytest.mark.asyncio @@ -155,7 +155,11 @@ async def test_reasoning_mine_applies_overrides(tmp_path: Path) -> None: # backfill + models must flow into the run config passed to the engine. server = _make_server(tmp_path, mining_enabled=True) storage = _storage() - ingest_mock = AsyncMock(return_value=SimpleNamespace(traces_ingested=1, traces_scanned=1)) + ingest_mock = AsyncMock( + return_value=SimpleNamespace( + traces_ingested=1, traces_scanned=1, files_scanned=1, files_total=1 + ) + ) distill_mock = AsyncMock( return_value=SimpleNamespace(patterns_learned=0, traces_processed=1, models_seen=1) ) @@ -177,6 +181,9 @@ async def test_reasoning_mine_applies_overrides(tmp_path: Path) -> None: run_cfg = ingest_mock.await_args.args[2] # (storage, brain_id, config) assert run_cfg.reasoning_training.scan_lookback_days == 0 assert run_cfg.reasoning_training.mining_models == ("a", "b") + # backfill must also flow as the real backfill kwarg (full-rescan bypass), + # not just the scan_lookback_days=0 override. + assert ingest_mock.await_args.kwargs["backfill"] is True @pytest.mark.asyncio diff --git a/tests/unit/test_reasoning_distiller.py b/tests/unit/test_reasoning_distiller.py index fd3a1adc..a9e81479 100644 --- a/tests/unit/test_reasoning_distiller.py +++ b/tests/unit/test_reasoning_distiller.py @@ -38,7 +38,9 @@ def _ucfg(tmp_path: Path, **rt_kw: object) -> UnifiedConfig: "min_cluster_support": 2, "min_patterns_per_category": 1, "min_confidence": 0.2, - "max_patterns_per_run": 10, + # Generous per-model targets so the existing fixtures (which create at + # most a couple of patterns) distill freely; individual tests override. + "pattern_targets": {"claude-fable-5": 100, "claude-sonnet-5": 100}, } base.update(rt_kw) return UnifiedConfig( @@ -72,6 +74,17 @@ async def _seed(storage: InMemoryStorage, model: str, contents: list[str]) -> No "I need to resolve it. Let me check the failing traceback. I verify the error.", ] +# Three 2-trace clusters with DISTINCT move-sets (→ distinct signatures), ordered +# so a small per-model batch fetches one cluster at a time. +_THREE_CLUSTERS = [ + "I need to fix the bug. Let me check the error traceback. I verify it.", + "I need to fix the bug. Let me check the error traceback. I verify it.", + "What if the edge case is null? Actually, wait, let me reconsider the boundary.", + "What if the edge case is null? Actually, wait, let me reconsider the boundary.", + "My plan: step 1 decompose the problem. Compare option A versus option B.", + "My plan: step 1 decompose the problem. Compare option A versus option B.", +] + def test_segment_moves_detects_closed_vocab() -> None: moves = segment_moves("I need to fix it. Let me check the logs. Then I verify the result.") @@ -270,11 +283,11 @@ async def test_cap_marks_only_consumed_traces(tmp_path: Path, no_embedder: None) ) await _seed(storage, "claude-fable-5", contents) result = await distill_reasoning_patterns( - storage, BRAIN, _ucfg(tmp_path, max_patterns_per_run=2) + storage, BRAIN, _ucfg(tmp_path, pattern_targets={"claude-fable-5": 2}) ) assert result.patterns_learned == 2 # Only the 2 fully-clustered categories are marked processed; the 2 categories - # the cap never reached keep their traces for the next run (no silent loss). + # the budget never reached keep their traces for the next run (no silent loss). assert result.traces_processed == 4 remaining = await storage.get_unprocessed_reasoning_traces( BRAIN, model="claude-fable-5", limit=100 @@ -302,6 +315,99 @@ async def test_distinct_clusters_same_top_moves_not_dropped( assert len({f.metadata["_reasoning_signature"] for f in fibers}) == 2 +# ── Per-model pattern targets (sliders) ────────────────────────────────────── + + +async def test_target_zero_skips_model_and_leaves_traces(tmp_path: Path, no_embedder: None) -> None: + # With no target set for the model (default 0), distillation is skipped and + # its traces stay UNPROCESSED — a preliminary Mine only detects models. + storage = InMemoryStorage() + storage.set_brain(BRAIN) + await _seed(storage, "claude-fable-5", _DEBUG_TRACES) + cfg = _ucfg(tmp_path, pattern_targets={}) + result = await distill_reasoning_patterns(storage, BRAIN, cfg, drain=True) + assert result.patterns_learned == 0 + remaining = await storage.get_unprocessed_reasoning_traces(BRAIN, model="claude-fable-5") + assert len(remaining) == len(_DEBUG_TRACES) # untouched, not marked processed + + +async def test_existing_patterns_count_toward_budget_and_raising_distills_remainder( + tmp_path: Path, no_embedder: None +) -> None: + storage = InMemoryStorage() + storage.set_brain(BRAIN) + await _seed(storage, "claude-fable-5", _THREE_CLUSTERS) + # First run: target 1 → only the first cluster distills (budget 1); the rest + # stay unprocessed. + run1 = await distill_reasoning_patterns( + storage, BRAIN, _ucfg(tmp_path, pattern_targets={"claude-fable-5": 1}), drain=True + ) + assert run1.patterns_learned == 1 + # Raise the target to 3: 1 already exists → budget 2 → the 2 remaining + # clusters distill (raising a target picks up exactly the remainder). + run2 = await distill_reasoning_patterns( + storage, BRAIN, _ucfg(tmp_path, pattern_targets={"claude-fable-5": 3}), drain=True + ) + assert run2.patterns_learned == 2 + fibers = await storage.find_fibers(metadata_key="_reasoning_pattern", limit=100) + assert len(fibers) == 3 + + +async def test_drain_clears_backlog_across_multiple_fetches( + tmp_path: Path, no_embedder: None, monkeypatch: pytest.MonkeyPatch +) -> None: + # A tiny per-model batch forces the drain loop to fetch more than twice. + monkeypatch.setattr("surreal_memory.engine.reasoning_distiller._BATCH_PER_MODEL", 2) + storage = InMemoryStorage() + storage.set_brain(BRAIN) + await _seed(storage, "claude-fable-5", _THREE_CLUSTERS) # 3 clusters, batch=2 + result = await distill_reasoning_patterns( + storage, BRAIN, _ucfg(tmp_path, pattern_targets={"claude-fable-5": 100}), drain=True + ) + assert result.patterns_learned == 3 # all three clusters drained (3 fetches) + remaining = await storage.get_unprocessed_reasoning_traces(BRAIN, model="claude-fable-5") + assert remaining == [] + + +async def test_background_run_processes_one_batch_per_model( + tmp_path: Path, no_embedder: None, monkeypatch: pytest.MonkeyPatch +) -> None: + # drain=False (background consolidation) does ONE batch per model per run + # even with a large budget and a bigger backlog. + monkeypatch.setattr("surreal_memory.engine.reasoning_distiller._BATCH_PER_MODEL", 2) + storage = InMemoryStorage() + storage.set_brain(BRAIN) + await _seed(storage, "claude-fable-5", _THREE_CLUSTERS) + result = await distill_reasoning_patterns( + storage, BRAIN, _ucfg(tmp_path, pattern_targets={"claude-fable-5": 100}) + ) + assert result.patterns_learned == 1 # only the first batch this run + remaining = await storage.get_unprocessed_reasoning_traces( + BRAIN, model="claude-fable-5", limit=100 + ) + assert len(remaining) == 4 + + +async def test_drain_terminates_when_a_batch_makes_no_progress( + tmp_path: Path, no_embedder: None, monkeypatch: pytest.MonkeyPatch +) -> None: + # If a batch consumes nothing (pathological no-forward-progress), the drain + # loop must break rather than re-fetch the same traces forever. + async def _no_progress(*_a: object, **_k: object) -> tuple[int, list[object]]: + return 0, [] + + monkeypatch.setattr( + "surreal_memory.engine.reasoning_distiller._process_model_batch", _no_progress + ) + storage = InMemoryStorage() + storage.set_brain(BRAIN) + await _seed(storage, "claude-fable-5", _DEBUG_TRACES) + result = await distill_reasoning_patterns( + storage, BRAIN, _ucfg(tmp_path, pattern_targets={"claude-fable-5": 100}), drain=True + ) + assert result.patterns_learned == 0 # terminated without hanging + + # ── Consolidation LEARN_REASONING handler ──────────────────────────────────── diff --git a/tests/unit/test_reasoning_miner.py b/tests/unit/test_reasoning_miner.py index bd6451c4..df637491 100644 --- a/tests/unit/test_reasoning_miner.py +++ b/tests/unit/test_reasoning_miner.py @@ -2,7 +2,8 @@ Uses synthetic JSONL transcript fixtures under a temporary ``.claude`` dir (no real thinking text). Covers dedup, model glob filter, truncation, ```` -and opus (empty/denylisted) skipping, min-length gating, secret redaction, +skipping (opus-4-8 is no longer denylisted — it IS mined), min-length gating, +secret redaction, task_context capture, model normalization, incremental scan-state, and the async ingest path against InMemoryStorage. """ @@ -12,12 +13,16 @@ import json from datetime import UTC, datetime from pathlib import Path +from typing import Any + +import pytest from surreal_memory.engine.reasoning_miner import ( ingest_reasoning_traces, normalize_model, scan_transcripts, ) +from surreal_memory.engine.reasoning_progress import MiningProgress from surreal_memory.storage.memory_store import InMemoryStorage from surreal_memory.unified_config import ReasoningTrainingConfig, UnifiedConfig @@ -136,6 +141,40 @@ def test_incremental_state_rescans_changed(tmp_path: Path) -> None: assert "second reasoning" in traces[0]["content"] +def test_backfill_bypasses_unchanged_skip(tmp_path: Path) -> None: + # A normal scan skips a file whose size+mtime are unchanged since the + # last scan (see test_incremental_state_skips_unchanged), but a backfill + # scan re-emits its traces regardless — bypass, not state-deletion. + claude = tmp_path / ".claude" + state = tmp_path / "state.json" + _write_transcript(claude, [_assistant("a long enough reasoning trace here", uuid="a")]) + assert len(_scan(claude, _cfg(), state)) == 1 + assert _scan(claude, _cfg(), state) == [] # normal 2nd scan: unchanged → skipped + + backfilled = scan_transcripts( + _cfg(), state_path=state, claude_dir=claude, now=_NOW, backfill=True + ) + assert len(backfilled) == 1 + assert "long enough reasoning trace" in backfilled[0]["content"] + + +def test_normal_scan_after_backfill_yields_nothing_new(tmp_path: Path) -> None: + # After a backfill re-scan, the scan-state entry is rewritten just like a + # normal scan would (never deleted) — so a THIRD, normal scan sees the + # file as unchanged again and stays cheap. + claude = tmp_path / ".claude" + state = tmp_path / "state.json" + _write_transcript(claude, [_assistant("a long enough reasoning trace here", uuid="a")]) + assert len(_scan(claude, _cfg(), state)) == 1 # 1st: normal, populates state + + backfilled = scan_transcripts( + _cfg(), state_path=state, claude_dir=claude, now=_NOW, backfill=True + ) + assert len(backfilled) == 1 # 2nd: backfill, bypasses skip, rewrites state + + assert _scan(claude, _cfg(), state) == [] # 3rd: normal, nothing new + + def test_model_glob_filter(tmp_path: Path) -> None: claude = tmp_path / ".claude" _write_transcript( @@ -149,13 +188,13 @@ def test_model_glob_filter(tmp_path: Path) -> None: assert [t["model"] for t in traces] == ["claude-fable-5"] -def test_synthetic_and_opus_are_skipped(tmp_path: Path) -> None: +def test_synthetic_skipped(tmp_path: Path) -> None: + # The pseudo-model (non-model turns) is never mined. claude = tmp_path / ".claude" _write_transcript( claude, [ _assistant("synthetic reasoning trace long enough", model="", uuid="a"), - _assistant("opus reasoning trace long enough", model="claude-opus-4-8", uuid="b"), _assistant("fable reasoning trace long enough", model="claude-fable-5", uuid="c"), ], ) @@ -163,6 +202,21 @@ def test_synthetic_and_opus_are_skipped(tmp_path: Path) -> None: assert [t["model"] for t in traces] == ["claude-fable-5"] +def test_opus_4_8_is_mined(tmp_path: Path) -> None: + # opus-4-8 is NO LONGER denylisted — its thinking traces are mined like any + # other model (run-008 correction: opus emits real thinking, ~1166 chars avg). + claude = tmp_path / ".claude" + _write_transcript( + claude, + [ + _assistant("opus reasoning trace long enough", model="claude-opus-4-8", uuid="b"), + _assistant("fable reasoning trace long enough", model="claude-fable-5", uuid="c"), + ], + ) + traces = _scan(claude, _cfg(), tmp_path / "state.json") + assert {t["model"] for t in traces} == {"claude-opus-4-8", "claude-fable-5"} + + def test_empty_thinking_skipped(tmp_path: Path) -> None: claude = tmp_path / ".claude" _write_transcript(claude, [_assistant(" ", uuid="a")]) # opus-style empty thinking @@ -259,15 +313,86 @@ def test_files_outside_projects_glob_ignored(tmp_path: Path) -> None: assert _scan(claude, _cfg(), tmp_path / "state.json") == [] -def test_max_traces_per_scan_soft_cap(tmp_path: Path) -> None: +def test_nested_session_directory_discovered(tmp_path: Path) -> None: + # projects///t.jsonl — one level deeper than the old + # `projects/*/*.jsonl` glob covered. claude = tmp_path / ".claude" - entries = [ - _assistant(f"reasoning trace number {i} long enough", uuid=f"u{i}") for i in range(5) - ] - _write_transcript(claude, entries) - traces = _scan(claude, _cfg(max_traces_per_scan=3), tmp_path / "state.json") - # Whole file is scanned (no mid-file loss); cap only stops scanning MORE files. - assert len(traces) == 5 + _write_transcript( + claude, + [_assistant("nested session reasoning trace long enough", uuid="n1")], + slug="proj-a/2026-03-01-session1", + ) + traces = _scan(claude, _cfg(), tmp_path / "state.json") + assert len(traces) == 1 + assert traces[0]["project"] == "proj-a" + + +def test_subagent_transcript_discovered_and_attributed_to_project(tmp_path: Path) -> None: + # projects///subagents/agent-*.jsonl — Task-tool subagent + # transcripts must be discovered AND attributed to the top-level project, + # not to a literal "subagents" pseudo-project. + claude = tmp_path / ".claude" + entry = _assistant("subagent reasoning trace long enough to mine", uuid="sa1") + entry["isSidechain"] = True + _write_transcript( + claude, + [entry], + slug="proj-a/session1/subagents", + name="agent-1.jsonl", + ) + traces = _scan(claude, _cfg(), tmp_path / "state.json") + assert len(traces) == 1 + assert traces[0]["project"] == "proj-a" + + +def test_stray_file_directly_in_projects_dir_ignored(tmp_path: Path) -> None: + # A jsonl sitting directly in projects/ (no project subdirectory) isn't + # associated with any project and must be skipped, even though it's a + # deeper scan than the old glob. + claude = tmp_path / ".claude" + (claude / "projects").mkdir(parents=True, exist_ok=True) + (claude / "projects" / "stray.jsonl").write_text( + json.dumps(_assistant("stray at projects root long enough", uuid="s1")) + "\n", + encoding="utf-8", + ) + assert _scan(claude, _cfg(), tmp_path / "state.json") == [] + + +def test_symlink_escape_blocked_at_depth(tmp_path: Path) -> None: + # A symlink nested several directories deep that resolves outside + # ~/.claude must still be rejected by the path-escape guard. + claude = tmp_path / ".claude" + session_dir = claude / "projects" / "proj-a" / "session1" + session_dir.mkdir(parents=True, exist_ok=True) + outside = tmp_path / "outside" + outside.mkdir() + real = outside / "evil.jsonl" + real.write_text( + json.dumps(_assistant("escaped reasoning trace long enough", uuid="e1")) + "\n", + encoding="utf-8", + ) + (session_dir / "evil.jsonl").symlink_to(real) + assert _scan(claude, _cfg(), tmp_path / "state.json") == [] + + +def test_scan_returns_all_traces_unbounded(tmp_path: Path) -> None: + """No per-scan cap: many files' worth of traces are all returned, uncapped.""" + claude = tmp_path / ".claude" + files = 6 + per_file = 4 + total = files * per_file + for f in range(files): + entries = [ + _assistant( + f"reasoning trace file {f} number {i} long enough to qualify", + session=f"s{f}", + uuid=f"u{f}-{i}", + ) + for i in range(per_file) + ] + _write_transcript(claude, entries, slug=f"proj-{f}") + traces = _scan(claude, _cfg(), tmp_path / "state.json") + assert len(traces) == total async def test_ingest_reasoning_traces_into_storage(tmp_path: Path) -> None: @@ -297,6 +422,51 @@ async def test_ingest_reasoning_traces_into_storage(tmp_path: Path) -> None: assert set(stats["by_model"]) == {"claude-fable-5", "claude-sonnet-5"} +async def test_second_consecutive_backfill_ingest_is_noop_at_storage(tmp_path: Path) -> None: + # Backfill bypasses the miner's size+mtime skip, so a 2nd backfill still + # RE-SCANS the file and re-emits its trace — but trace_hash dedup at the + # storage layer means nothing NEW actually gets inserted the 2nd time. + claude = tmp_path / ".claude" + _write_transcript( + claude, + [_assistant("reasoning trace long enough for backfill dedup test", uuid="a")], + ) + storage = InMemoryStorage() + storage.set_brain("b1") + cfg = UnifiedConfig( + data_dir=tmp_path / ".surrealmemory", + current_brain="default", + reasoning_training=_cfg(), + ) + state_path = tmp_path / "state.json" + + first = await ingest_reasoning_traces( + storage, + "b1", + cfg, + claude_dir=claude, + state_path=state_path, + now=_NOW, + backfill=True, + ) + assert first.traces_ingested == 1 + + second = await ingest_reasoning_traces( + storage, + "b1", + cfg, + claude_dir=claude, + state_path=state_path, + now=_NOW, + backfill=True, + ) + assert second.traces_scanned == 1 # the miner still re-emits it (bypass) + assert second.traces_ingested == 0 # but storage-layer dedup drops it + + stats = await storage.get_reasoning_stats("b1") + assert stats["total"] == 1 # no duplicate row was created + + def _fake_unified_config(tmp_path: Path, *, mining_enabled: bool) -> UnifiedConfig: return UnifiedConfig( data_dir=tmp_path / ".surrealmemory", @@ -377,3 +547,129 @@ async def _spy_ingest(*a, **k): # pragma: no cover - must NOT be reached ) assert report.reasoning_traces_ingested == 0 assert calls["n"] == 0 + + +class _CountingStorage(InMemoryStorage): + """InMemoryStorage that records how many times insert is called.""" + + def __init__(self) -> None: + super().__init__() + self.insert_calls = 0 + + async def insert_reasoning_traces(self, brain_id: str, traces: list[dict[str, Any]]) -> int: + self.insert_calls += 1 + return await super().insert_reasoning_traces(brain_id, traces) + + +class _CrashOnNthInsert(InMemoryStorage): + """InMemoryStorage that raises on the *nth* insert call (1-based).""" + + def __init__(self, crash_on: int) -> None: + super().__init__() + self._crash_on = crash_on + self.insert_calls = 0 + + async def insert_reasoning_traces(self, brain_id: str, traces: list[dict[str, Any]]) -> int: + self.insert_calls += 1 + if self.insert_calls == self._crash_on: + raise RuntimeError("simulated storage failure mid-ingest") + return await super().insert_reasoning_traces(brain_id, traces) + + +def _ingest_cfg(tmp_path: Path) -> UnifiedConfig: + return UnifiedConfig( + data_dir=tmp_path / ".surrealmemory", + current_brain="default", + reasoning_training=_cfg(), + ) + + +async def test_ingest_inserts_per_file_not_once(tmp_path: Path) -> None: + # Two separate transcript FILES → two separate storage inserts (per-file + # ingest bounds memory), not one batched insert at the end. + claude = tmp_path / ".claude" + _write_transcript( + claude, [_assistant("file one reasoning long enough", uuid="a")], slug="proj-a" + ) + _write_transcript( + claude, [_assistant("file two reasoning long enough", uuid="b")], slug="proj-b" + ) + storage = _CountingStorage() + storage.set_brain("b1") + result = await ingest_reasoning_traces( + storage, + "b1", + _ingest_cfg(tmp_path), + claude_dir=claude, + state_path=tmp_path / "state.json", + now=_NOW, + ) + assert storage.insert_calls == 2 + assert result.files_total == 2 + assert result.files_scanned == 2 + assert result.traces_ingested == 2 + + +async def test_ingest_progress_is_monotonic_and_complete(tmp_path: Path) -> None: + claude = tmp_path / ".claude" + for i in range(3): + _write_transcript( + claude, + [_assistant(f"reasoning trace {i} long enough", uuid=f"u{i}")], + slug=f"proj-{i}", + ) + storage = InMemoryStorage() + storage.set_brain("b1") + snapshots: list[MiningProgress] = [] + result = await ingest_reasoning_traces( + storage, + "b1", + _ingest_cfg(tmp_path), + claude_dir=claude, + state_path=tmp_path / "state.json", + now=_NOW, + progress=snapshots.append, + ) + assert snapshots, "progress callback was never invoked" + # A scanning snapshot with the total known precedes ingesting. + assert snapshots[0].phase == "scanning" + assert any(s.phase == "ingesting" for s in snapshots) + # files_scanned and traces_found only ever increase. + files_seen = [s.files_scanned for s in snapshots] + assert files_seen == sorted(files_seen) + found_seen = [s.traces_found for s in snapshots] + assert found_seen == sorted(found_seen) + # The final snapshot reflects a fully-scanned corpus. + assert snapshots[-1].files_scanned == snapshots[-1].files_total == 3 + assert result.files_scanned == 3 + assert result.traces_ingested == 3 + + +async def test_ingest_state_survives_a_crash_mid_run(tmp_path: Path) -> None: + # File 1 ingests cleanly, file 2's insert raises → file 1's scan-state is + # persisted (finally block), file 2's is not (recorded only after insert). + claude = tmp_path / ".claude" + _write_transcript( + claude, [_assistant("first file reasoning long enough", uuid="a")], slug="proj-a" + ) + _write_transcript( + claude, [_assistant("second file reasoning long enough", uuid="b")], slug="proj-b" + ) + storage = _CrashOnNthInsert(crash_on=2) + storage.set_brain("b1") + state_file = tmp_path / "state.json" + with pytest.raises(RuntimeError): + await ingest_reasoning_traces( + storage, + "b1", + _ingest_cfg(tmp_path), + claude_dir=claude, + state_path=state_file, + now=_NOW, + ) + saved = json.loads(state_file.read_text(encoding="utf-8")) + # Exactly the first file (proj-a) is recorded; the crashed file (proj-b) is not. + assert len(saved) == 1 + only_key = next(iter(saved)) + assert "proj-a" in only_key + assert not any("proj-b" in k for k in saved) diff --git a/tests/unit/test_route_reasoning_training.py b/tests/unit/test_route_reasoning_training.py index 7db40e5a..d1f2971f 100644 --- a/tests/unit/test_route_reasoning_training.py +++ b/tests/unit/test_route_reasoning_training.py @@ -149,17 +149,115 @@ def test_status_with_traces_and_patterns( def test_status_denylisted_model_has_no_thinking( client: TestClient, mock_storage: AsyncMock, tmp_path: Path, monkeypatch: pytest.MonkeyPatch ) -> None: + # opus-4-8 is no longer denylisted, so use a FICTIONAL denylisted model to + # exercise the has_thinking_text=False path (the mechanism still works). + monkeypatch.setattr(rt_module, "_MODELS_WITHOUT_THINKING", ("fictional-no-think-model",)) monkeypatch.setattr("surreal_memory.unified_config.get_config", lambda: _cfg(tmp_path)) mock_storage.get_reasoning_stats.return_value = { - "by_model": {"claude-opus-4-8": {"trace_count": 0, "unprocessed": 0, "last_trace_at": ""}}, + "by_model": { + "fictional-no-think-model": {"trace_count": 0, "unprocessed": 0, "last_trace_at": ""} + }, "by_category": {}, "total": 0, "unprocessed": 0, } resp = client.get("/api/dashboard/reasoning/status") data = resp.json() - opus = next(m for m in data["per_model"] if m["model"] == "claude-opus-4-8") - assert opus["has_thinking_text"] is False + model = next(m for m in data["per_model"] if m["model"] == "fictional-no-think-model") + assert model["has_thinking_text"] is False + + +def test_status_idle_has_progress_fields( + client: TestClient, tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + monkeypatch.setattr("surreal_memory.unified_config.get_config", lambda: _cfg(tmp_path)) + mining = client.get("/api/dashboard/reasoning/status").json()["mining"] + assert mining["phase"] == "idle" + assert mining["files_total"] == 0 + assert mining["files_scanned"] == 0 + assert mining["traces_found"] == 0 + assert mining["traces_processed"] == 0 + assert mining["current_model"] is None + assert mining["models_done"] == 0 + assert mining["models_total"] == 0 + + +async def test_run_mining_wires_progress_and_finishes( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + from surreal_memory.engine.reasoning_progress import ( + PHASE_DISTILLING, + PHASE_INGESTING, + MiningProgress, + ) + + cfg = _cfg(tmp_path, mining_enabled=True) + monkeypatch.setattr("surreal_memory.unified_config.get_config", lambda *a, **k: cfg) + monkeypatch.setattr( + "surreal_memory.unified_config.create_isolated_storage", + AsyncMock(return_value=AsyncMock()), + ) + + captured: list[dict[str, Any]] = [] + + async def _fake_ingest( + storage: Any, brain_id: str, config: Any, *, backfill: bool = False, progress: Any = None + ) -> SimpleNamespace: + if progress is not None: + progress( + MiningProgress( + phase=PHASE_INGESTING, + files_total=10, + files_scanned=5, + traces_found=3, + traces_ingested=2, + ) + ) + captured.append(dict(rt_module._mining_states[brain_id])) + return SimpleNamespace( + traces_ingested=2, traces_scanned=3, files_scanned=10, files_total=10 + ) + + async def _fake_distill( + storage: Any, brain_id: str, config: Any, *, drain: bool = False, progress: Any = None + ) -> SimpleNamespace: + if progress is not None: + progress( + MiningProgress( + phase=PHASE_DISTILLING, + current_model="claude-fable-5", + models_done=0, + models_total=1, + patterns_learned=1, + traces_processed=2, + ) + ) + return SimpleNamespace(patterns_learned=1, traces_processed=2, models_seen=1) + + monkeypatch.setattr( + "surreal_memory.engine.reasoning_miner.ingest_reasoning_traces", _fake_ingest + ) + monkeypatch.setattr( + "surreal_memory.engine.reasoning_distiller.distill_reasoning_patterns", _fake_distill + ) + + rt_module._mining_states[BRAIN_ID] = rt_module._idle_mining_state() + rt_module._mining_states[BRAIN_ID].update(running=True) + await rt_module._run_mining(BRAIN_ID, backfill=False, dry_run=False, models=None) + + # An intermediate ingest snapshot was visible mid-run. + assert captured and captured[0]["phase"] == PHASE_INGESTING + assert captured[0]["files_scanned"] == 5 + assert captured[0]["traces_found"] == 3 + + final = rt_module._mining_states[BRAIN_ID] + assert final["phase"] == "done" + assert final["running"] is False + assert final["finished_at"] is not None + assert final["patterns_learned"] == 1 + assert final["traces_processed"] == 2 + assert final["files_scanned"] == 10 + assert final["models_total"] == 1 # ── PUT /config ─────────────────────────────────────────────────────────────── @@ -184,36 +282,45 @@ def test_config_toggle_mining(client: TestClient, config_capture: dict[str, Any] def test_config_rejects_model_without_thinking( - client: TestClient, config_capture: dict[str, Any] + client: TestClient, config_capture: dict[str, Any], monkeypatch: pytest.MonkeyPatch ) -> None: + # opus is mineable now; a genuinely thinking-less model (fictional denylist + # entry) is still rejected for mining_models. + monkeypatch.setattr(rt_module, "_MODELS_WITHOUT_THINKING", ("fictional-no-think-model",)) resp = client.put( - "/api/dashboard/reasoning/config", json={"mining_models": ["claude-opus-4-8"]} + "/api/dashboard/reasoning/config", + json={"mining_models": ["fictional-no-think-model"]}, ) assert resp.status_code == 422 assert "thinking" in resp.json()["detail"].lower() def test_config_rejects_injection_source_without_thinking( - client: TestClient, config_capture: dict[str, Any] + client: TestClient, config_capture: dict[str, Any], monkeypatch: pytest.MonkeyPatch ) -> None: + # A thinking-less injection SOURCE (fictional denylist entry) is rejected. + monkeypatch.setattr(rt_module, "_MODELS_WITHOUT_THINKING", ("fictional-no-think-model",)) resp = client.put( "/api/dashboard/reasoning/config", - json={"injection_map": {"claude-fable-5": "claude-opus-4-8"}}, + json={"injection_map": {"claude-fable-5": "fictional-no-think-model"}}, ) assert resp.status_code == 422 def test_config_allows_denylisted_target( - client: TestClient, config_capture: dict[str, Any] + client: TestClient, config_capture: dict[str, Any], monkeypatch: pytest.MonkeyPatch ) -> None: - # opus is a valid injection TARGET (recipient); fable is a thinking source. + # A denylisted (thinking-less) model is still a valid injection TARGET + # (recipient); the source must have thinking text. opus is no longer + # denylisted, so pin a fictional denylisted model as the target here. + monkeypatch.setattr(rt_module, "_MODELS_WITHOUT_THINKING", ("fictional-no-think-model",)) resp = client.put( "/api/dashboard/reasoning/config", - json={"injection_map": {"claude-opus-4-8": "claude-fable-5"}}, + json={"injection_map": {"fictional-no-think-model": "claude-fable-5"}}, ) assert resp.status_code == 200 assert config_capture["cfg"].reasoning_training.injection_map == ( - ("claude-opus-4-8", "claude-fable-5"), + ("fictional-no-think-model", "claude-fable-5"), ) @@ -237,6 +344,30 @@ def test_config_rejects_bad_model_name(client: TestClient, config_capture: dict[ assert resp.status_code == 422 +def test_config_pattern_targets_roundtrip( + client: TestClient, config_capture: dict[str, Any] +) -> None: + # Valid targets round-trip; an out-of-range value clamps to 0..100. + resp = client.put( + "/api/dashboard/reasoning/config", + json={"pattern_targets": {"claude-fable-5": 30, "claude-sonnet-5": 150}}, + ) + assert resp.status_code == 200 + saved = config_capture["cfg"].reasoning_training.pattern_targets + assert saved == {"claude-fable-5": 30, "claude-sonnet-5": 100} + assert resp.json()["config"]["pattern_targets"]["claude-fable-5"] == 30 + + +def test_config_rejects_bad_pattern_target_name( + client: TestClient, config_capture: dict[str, Any] +) -> None: + resp = client.put( + "/api/dashboard/reasoning/config", + json={"pattern_targets": {"bad name!;drop": 10}}, + ) + assert resp.status_code == 422 + + def test_config_rejects_glob_injection_source( client: TestClient, config_capture: dict[str, Any] ) -> None: @@ -263,6 +394,20 @@ def test_config_rejects_bad_category_name( assert resp.status_code == 422 +def test_config_trace_chars_roundtrip(client: TestClient, config_capture: dict[str, Any]) -> None: + resp = client.put( + "/api/dashboard/reasoning/config", + json={"min_trace_chars": 500, "max_trace_chars": 50_000}, + ) + assert resp.status_code == 200 + body = resp.json()["config"] + assert body["min_trace_chars"] == 500 + assert body["max_trace_chars"] == 50_000 + assert config_capture["cfg"].reasoning_training.min_trace_chars == 500 + assert config_capture["cfg"].reasoning_training.max_trace_chars == 50_000 + assert config_capture["saved"] is not None # persisted + + # ── POST /mine ──────────────────────────────────────────────────────────────── @@ -336,6 +481,38 @@ async def _noop(*_a: Any, **_k: Any) -> None: assert client.post("/api/dashboard/reasoning/mine", json={}).status_code == 202 +async def test_run_mining_forwards_backfill_to_ingest( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + # _run_mining must forward backfill=True into ingest_reasoning_traces (the + # miner's real full-rescan bypass), on top of the scan_lookback_days=0 + # override it already applies. + monkeypatch.setattr( + "surreal_memory.unified_config.get_config", + lambda: _cfg(tmp_path, mining_enabled=True), + ) + storage = AsyncMock() + storage.close = AsyncMock() + monkeypatch.setattr( + "surreal_memory.unified_config.create_isolated_storage", + AsyncMock(return_value=storage), + ) + ingest_mock = AsyncMock(return_value=SimpleNamespace(traces_ingested=1, traces_scanned=1)) + distill_mock = AsyncMock( + return_value=SimpleNamespace(patterns_learned=0, traces_processed=1, models_seen=1) + ) + monkeypatch.setattr( + "surreal_memory.engine.reasoning_miner.ingest_reasoning_traces", ingest_mock + ) + monkeypatch.setattr( + "surreal_memory.engine.reasoning_distiller.distill_reasoning_patterns", distill_mock + ) + + await rt_module._run_mining(BRAIN_ID, True, False, None) + + assert ingest_mock.await_args.kwargs["backfill"] is True + + # ── GET/DELETE patterns ─────────────────────────────────────────────────────── diff --git a/tests/unit/test_unified_config.py b/tests/unit/test_unified_config.py index bdba714f..66b6b0d9 100755 --- a/tests/unit/test_unified_config.py +++ b/tests/unit/test_unified_config.py @@ -555,6 +555,21 @@ def test_defaults_are_opt_in_off(self) -> None: assert rt.min_confidence == 0.2 assert rt.redact_secrets is True + def test_default_max_trace_chars_is_100k(self) -> None: + # Bumped 20_000 -> 100_000: content safety, not a real-world cut (no + # per-scan cap left to bound total volume, so the char cap stays the + # only safety valve — raised because real traces were being truncated). + assert ReasoningTrainingConfig().max_trace_chars == 100_000 + assert ReasoningTrainingConfig.from_dict({}).max_trace_chars == 100_000 + + def test_from_dict_ignores_legacy_max_traces_per_scan_key(self) -> None: + # max_traces_per_scan was removed (u2): an old config.toml/dict still + # carrying the key must load without raising, and the field must not + # reappear on the resulting instance. + rt = ReasoningTrainingConfig.from_dict({"max_traces_per_scan": 500, "min_confidence": 0.4}) + assert not hasattr(rt, "max_traces_per_scan") + assert rt.min_confidence == 0.4 + def test_from_dict_to_dict_roundtrip(self) -> None: rt = ReasoningTrainingConfig( mining_enabled=True, diff --git a/vscode-extension/package-lock.json b/vscode-extension/package-lock.json index 5c82d7e1..4e1886a9 100755 --- a/vscode-extension/package-lock.json +++ b/vscode-extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "surrealmemory", - "version": "2.12.1", + "version": "2.13.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "surrealmemory", - "version": "2.12.1", + "version": "2.13.0", "license": "MIT", "dependencies": { "cytoscape": "^3.33.1", diff --git a/vscode-extension/package.json b/vscode-extension/package.json index bcbf30c2..70e5630c 100755 --- a/vscode-extension/package.json +++ b/vscode-extension/package.json @@ -2,7 +2,7 @@ "name": "surrealmemory", "displayName": "Surreal-Memory", "description": "Visual brain explorer, inline recall, and memory management for Surreal-Memory", - "version": "2.12.1", + "version": "2.13.0", "publisher": "ai-flow-nowak", "license": "MIT", "preview": true,