diff --git a/adapters/__init__.py b/adapters/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/adapters/__pycache__/__init__.cpython-310.pyc b/adapters/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index d9bb293639032e8034504a64dced7cf139249ebc..0000000000000000000000000000000000000000 Binary files a/adapters/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/adapters/__pycache__/base.cpython-310.pyc b/adapters/__pycache__/base.cpython-310.pyc deleted file mode 100644 index aaf65acf1f8a217cd4bd8d587ba1ccb0882415d5..0000000000000000000000000000000000000000 Binary files a/adapters/__pycache__/base.cpython-310.pyc and /dev/null differ diff --git a/adapters/__pycache__/hf_adapter.cpython-310.pyc b/adapters/__pycache__/hf_adapter.cpython-310.pyc deleted file mode 100644 index 758bcc3b527bdfbf38fde4e68028803698efcdbe..0000000000000000000000000000000000000000 Binary files a/adapters/__pycache__/hf_adapter.cpython-310.pyc and /dev/null differ diff --git a/adapters/__pycache__/onnx_adapter.cpython-310.pyc b/adapters/__pycache__/onnx_adapter.cpython-310.pyc deleted file mode 100644 index 7c06e6a1f1f09945c85700de241fea7ef40caff3..0000000000000000000000000000000000000000 Binary files a/adapters/__pycache__/onnx_adapter.cpython-310.pyc and /dev/null differ diff --git a/adapters/__pycache__/roboflow_adapter.cpython-310.pyc b/adapters/__pycache__/roboflow_adapter.cpython-310.pyc deleted file mode 100644 index 0d566d82ef99ba9b8ed7838d00c9648d74efa5e2..0000000000000000000000000000000000000000 Binary files a/adapters/__pycache__/roboflow_adapter.cpython-310.pyc and /dev/null differ diff --git a/adapters/base.py b/adapters/base.py deleted file mode 100644 index a2644f64251c2da46205c9b297486df0c3d603e4..0000000000000000000000000000000000000000 --- a/adapters/base.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -adapters/base.py — Abstract base class every source adapter must implement. -Enforces a stable contract so the registry never knows which adapter runs. -""" -from __future__ import annotations - -from abc import ABC, abstractmethod - -from models.model import Model - - -class BaseAdapter(ABC): - """Fetch models from an external source and normalize to the Model schema.""" - - source_name: str = "unknown" - - @abstractmethod - async def fetch_models(self) -> list[Model]: - """Return a list of normalized Model objects from the source.""" - ... - - def _format_size(self, bytes_: int) -> str: - """Human-readable file size.""" - for unit in ("B", "KB", "MB", "GB", "TB"): - if bytes_ < 1024: - return f"{bytes_:.1f} {unit}" - bytes_ //= 1024 - return f"{bytes_} PB" diff --git a/adapters/hf_adapter.py b/adapters/hf_adapter.py deleted file mode 100644 index 7dcf3232dfa9fbb35bb1f18edda53145c84147ad..0000000000000000000000000000000000000000 --- a/adapters/hf_adapter.py +++ /dev/null @@ -1,415 +0,0 @@ -""" -adapters/hf_adapter.py — Hugging Face Hub adapter. -Fetches real models via the public HF API and normalises them to our schema. - -Rate-limits respected via polite delays. Requires no authentication for -publicly accessible models; set HF_TOKEN env var for higher rate-limits. -""" -from __future__ import annotations - -import asyncio -import re -from typing import Any - - -def _is_shard_file(filename: str) -> bool: - """Return True for sharded weight files like model-00001-of-00003.safetensors.""" - return bool(re.search(r"-\d{5}-of-\d{5}\.", filename)) - -import httpx -from tenacity import retry, stop_after_attempt, wait_exponential - -from adapters.base import BaseAdapter -from config import settings -from models.model import Model, ModelMetrics, ModelVersion -from observability.logger import get_logger - -log = get_logger("hf_adapter") - -# ── Task mapping: HF pipeline_tag → our internal task ───────────────────────── -HF_TASK_MAP: dict[str, str] = { - "object-detection": "detection", - "image-classification": "classification", - "image-segmentation": "segmentation", - "text-to-image": "generation", - "image-to-image": "generation", - "image-feature-extraction": "embedding", -} - -# Tasks we actively fetch -FETCH_TASKS: list[str] = list(HF_TASK_MAP.keys()) - -# ── Framework detection ──────────────────────────────────────────────────────── -def _detect_framework(tags: list[str], model_id: str) -> str: - tag_str = " ".join(tags + [model_id]).lower() - if "onnx" in tag_str: return "onnx" - if "tflite" in tag_str: return "tflite" - if "coreml" in tag_str: return "coreml" - if "tensorflow" in tag_str or "tf" in tag_str: return "tensorflow" - return "pytorch" # HF default - -# ── Hardware detection ───────────────────────────────────────────────────────── -def _detect_hardware(tags: list[str]) -> list[str]: - hw: list[str] = [] - tag_str = " ".join(tags).lower() - if any(k in tag_str for k in ("cuda", "gpu")): hw.append("gpu") - if "edge" in tag_str or "mobile" in tag_str: hw.append("edge") - if "cpu" in tag_str: hw.append("cpu") - if not hw: hw.append("gpu") # safe default - return hw - -# ── Internal tag normalisation ───────────────────────────────────────────────── -QUALITY_TAG_MAP = { - "state-of-the-art": "sota", - "lightweight": "lightweight", - "tiny": "tiny", - "fast": "fastest", - "real-time": "real-time", - "accuracy": "high-accuracy", -} - -def _normalise_tags(raw_tags: list[str], pipeline: str) -> list[str]: - out: list[str] = [] - for t in raw_tags: - t_lower = t.lower() - for keyword, mapped in QUALITY_TAG_MAP.items(): - if keyword in t_lower: - out.append(mapped) - # keep relevant library / dataset tags - if any(t_lower.startswith(p) for p in ("dataset:", "license:", "language:")): - continue - out.append(t_lower) - # add pipeline as tag - if pipeline: - out.append(pipeline.replace("-", "_")) - return list(dict.fromkeys(out)) # deduplicate, preserve order - - -class HFAdapter(BaseAdapter): - source_name = "hf" - - def __init__(self) -> None: - headers = {"Accept": "application/json"} - if settings.hf_token: - headers["Authorization"] = f"Bearer {settings.hf_token}" - self._client = httpx.AsyncClient( - base_url=settings.hf_api_base, - headers=headers, - timeout=30, - ) - - @retry( - stop=stop_after_attempt(3), - wait=wait_exponential(multiplier=1, min=2, max=10), - reraise=True, - ) - async def _fetch_task_page( - self, pipeline_tag: str, limit: int = 100 - ) -> list[dict[str, Any]]: - params = { - "pipeline_tag": pipeline_tag, - "sort": "downloads", - "direction": -1, # descending - "limit": limit, - "full": "True", - } - log.info("hf_fetch_task", pipeline_tag=pipeline_tag, limit=limit) - resp = await self._client.get("/models", params=params) - resp.raise_for_status() - return resp.json() - - @retry( - stop=stop_after_attempt(3), - wait=wait_exponential(multiplier=1, min=2, max=10), - reraise=True, - ) - async def _fetch_model_detail(self, model_id: str) -> dict[str, Any]: - resp = await self._client.get(f"/models/{model_id}", params={"full": "True"}) - resp.raise_for_status() - raw = resp.json() - - siblings: list[dict[str, Any]] = raw.get("siblings") or [] - has_any_size = any(isinstance(s, dict) and s.get("size") for s in siblings) - if not has_any_size: - try: - tree = await self._fetch_model_tree(model_id, revision="main") - size_by_path: dict[str, int] = { - (t.get("path") or ""): int(t.get("size") or 0) - for t in (tree or []) - if isinstance(t, dict) - } - - patched: list[dict[str, Any]] = [] - for s in siblings: - if not isinstance(s, dict): - continue - fn = s.get("rfilename") or s.get("path") or "" - if fn and not s.get("size") and fn in size_by_path: - s = {**s, "size": size_by_path[fn]} - patched.append(s) - raw["siblings"] = patched - except Exception: - pass - - return raw - - @retry( - stop=stop_after_attempt(3), - wait=wait_exponential(multiplier=1, min=2, max=10), - reraise=True, - ) - async def _fetch_model_tree(self, model_id: str, *, revision: str = "main") -> list[dict[str, Any]]: - resp = await self._client.get(f"/models/{model_id}/tree/{revision}") - resp.raise_for_status() - data = resp.json() - if isinstance(data, list): - return data - return [] - - def _parse_safe_tensors_size(self, siblings: list[dict]) -> int: - """Estimate model size from sibling file list.""" - total = 0 - weight_exts = (".pt", ".pth", ".safetensors", ".bin", ".onnx", ".tflite", ".mlmodel") - for s in siblings or []: - filename = s.get("rfilename", "").lower() - if filename.endswith(weight_exts): - total += s.get("size", 0) - - if total > 0: - return total - - # If no size found in siblings, check if it's in the root dict (sometimes HF API does this) - return 0 # Return 0 if not found, we'll handle fallback in _make_model - - @retry( - stop=stop_after_attempt(3), - wait=wait_exponential(multiplier=1, min=2, max=10), - reraise=True, - ) - async def _fetch_model_card(self, model_id: str) -> str: - """Fetch model card (README.md) content for real-time description.""" - url = f"{settings.hf_hub_url}/{model_id}/raw/main/README.md" - try: - resp = await self._client.get(url) - if resp.status_code == 200: - return resp.text - except Exception: - pass - return "" - - def _extract_description(self, readme: str, raw: dict[str, Any]) -> str: - """Extract a clean description from README or card data.""" - if readme: - # Simple heuristic: take first paragraph that isn't frontmatter - lines = readme.split("\n") - in_frontmatter = False - for line in lines: - if line.strip() == "---": - in_frontmatter = not in_frontmatter - continue - if not in_frontmatter and line.strip() and not line.startswith("#"): - return line.strip()[:500] - - card_data = raw.get("cardData") or {} - description: str = ( - (card_data.get("summary") or "") - or (card_data.get("description") or "") - or (raw.get("description") or "") - ).strip() - return description - - def _estimate_metrics(self, model_id: str, task: str) -> ModelMetrics: - """ - Product-Grade Metrics Estimation. - Uses model name heuristics to provide realistic data for common architectures. - """ - metrics = ModelMetrics() - m_id = model_id.lower() - - # Base latency/vram estimates by architecture - if "vit" in m_id or "dinov2" in m_id: - metrics.latency_ms = 45.5 if "base" in m_id else 85.2 if "large" in m_id else 25.0 - metrics.vram_gb = 1.2 if "base" in m_id else 2.4 if "large" in m_id else 0.8 - metrics.accuracy = 82.4 if "base" in m_id else 84.5 - elif "segformer" in m_id: - # b0, b1, b2, b3, b4, b5 - if "b0" in m_id: metrics.latency_ms, metrics.vram_gb, metrics.accuracy = 12.0, 0.4, 35.0 - elif "b1" in m_id: metrics.latency_ms, metrics.vram_gb, metrics.accuracy = 18.0, 0.6, 40.0 - elif "b5" in m_id: metrics.latency_ms, metrics.vram_gb, metrics.accuracy = 45.0, 1.8, 50.0 - else: metrics.latency_ms, metrics.vram_gb, metrics.accuracy = 25.0, 1.0, 42.0 - elif "convnext" in m_id: - metrics.latency_ms = 15.0 if "tiny" in m_id else 30.0 - metrics.vram_gb = 0.5 if "tiny" in m_id else 1.2 - metrics.accuracy = 81.0 if "tiny" in m_id else 83.5 - elif "yolo" in m_id: - # n, s, m, l, x - if "yolov8n" in m_id: metrics.latency_ms, metrics.vram_gb, metrics.mAP = 1.5, 0.2, 37.3 - elif "yolov8s" in m_id: metrics.latency_ms, metrics.vram_gb, metrics.mAP = 2.8, 0.4, 44.9 - elif "yolov8m" in m_id: metrics.latency_ms, metrics.vram_gb, metrics.mAP = 6.2, 0.9, 50.2 - else: metrics.latency_ms, metrics.vram_gb, metrics.mAP = 10.0, 1.5, 52.0 - - # Generic task-based fallbacks if still empty - if metrics.latency_ms is None: - if task == "classification": metrics.latency_ms, metrics.accuracy = 20.0, 75.0 - elif task == "detection": metrics.latency_ms, metrics.mAP = 35.0, 45.0 - elif task == "embedding": metrics.latency_ms = 40.0 - elif task == "generation": metrics.latency_ms = 1500.0 - - return metrics - - def _make_model(self, raw: dict[str, Any], pipeline_tag: str) -> Model | None: - model_id: str = raw.get("id") or raw.get("modelId", "") - if not model_id: - return None - - task = HF_TASK_MAP.get(pipeline_tag) - if not task: - return None - tags_raw: list[str] = raw.get("tags") or [] - framework = _detect_framework(tags_raw, model_id) - hardware = _detect_hardware(tags_raw) - tags = _normalise_tags(tags_raw, pipeline_tag) - - # Size - siblings: list[dict] = raw.get("siblings") or [] - size = self._parse_safe_tensors_size(siblings) - if size == 0: - # Fallback based on model type if size not found - if "large" in model_id.lower(): size = 1_200_000_000 - elif "base" in model_id.lower(): size = 500_000_000 - elif "small" in model_id.lower() or "tiny" in model_id.lower(): size = 150_000_000 - else: size = 450_000_000 # More realistic general default than exactly 500MB - - # Provider — author part of model_id - provider = model_id.split("/")[0] if "/" in model_id else "community" - - # safe name - name = model_id.split("/")[-1] if "/" in model_id else model_id - # Clean ugly names - name = re.sub(r"[-_]+", "-", name).strip("-") - - downloads = raw.get("downloads") or 0 - likes = raw.get("likes") or 0 - - # Fabricate a sensible version from last modified - last_mod: str = raw.get("lastModified") or raw.get("createdAt") or "" - release_date = last_mod[:10] if last_mod else "2024-01-01" - sha8 = (raw.get("sha") or "main")[:8] - - # Build versions from weight files in the repo (one per distinct weight file) - weight_exts = (".pt", ".pth", ".safetensors", ".bin", ".onnx", ".tflite", ".mlmodel") - weight_files = [ - s for s in siblings - if s.get("rfilename", "").lower().endswith(weight_exts) - and not _is_shard_file(s.get("rfilename", "")) - ] - - if len(weight_files) > 1: - versions = [] - for s in weight_files[:15]: - filename = s["rfilename"] - # Detect variant from filename (n, s, m, l, x, or specific labels) - variant_label = "Stable" - fn_lower = filename.lower() - if any(x in fn_lower for x in ["-n.", "_n.", "nano"]): variant_label = "Nano" - elif any(x in fn_lower for x in ["-s.", "_s.", "small"]): variant_label = "Small" - elif any(x in fn_lower for x in ["-m.", "_m.", "medium"]): variant_label = "Medium" - elif any(x in fn_lower for x in ["-l.", "_l.", "large"]): variant_label = "Large" - elif any(x in fn_lower for x in ["-x.", "_x.", "xlarge", "huge"]): variant_label = "XLarge" - - versions.append(ModelVersion( - version=filename.replace(".", "_"), - label=variant_label, - description=f"Model variant: {filename}", - releaseDate=release_date, - changelog=None, - )) - else: - versions = [ - ModelVersion( - version=sha8, - label="Latest", - description="Primary model weight file.", - releaseDate=release_date, - changelog=None, - ) - ] - - # Description from card data - description = self._extract_description("", raw) - if not description: - description = f"{task.capitalize()} model by {provider}." - - # Metrics Estimation - metrics = self._estimate_metrics(model_id, task) - - return Model( - id = model_id.replace("/", "_").lower(), - name = name, - task = task, - framework = framework, - source = "hf", - provider = provider, - description = description, - download_url = f"https://huggingface.co/{model_id}", - size = size, - size_label = self._format_size(size), - tags = tags, - hardware = hardware, - status = "available", - downloaded = False, - downloads = downloads, - rating = min(5.0, (likes / 200) + 3.5) if likes else None, - liked = False, - metrics = metrics, - versions = versions, - ) - - async def fetch_models(self) -> list[Model]: - models: list[Model] = [] - seen_ids: set[str] = set() - - for pipeline_tag in FETCH_TASKS: - try: - raw_list = await self._fetch_task_page( - pipeline_tag, limit=settings.hf_models_per_task - ) - for idx, raw in enumerate(raw_list): - # Enrich top-N per task with full model detail so siblings include sizes. - if idx < 10: - original_id = raw.get("id") or raw.get("modelId") - if original_id: - try: - raw = await self._fetch_model_detail(original_id) - except Exception: - pass - - m = self._make_model(raw, pipeline_tag) - if m and m.id not in seen_ids: - # Try to fetch real-time description for the first 5 models of each task - if len([mod for mod in models if mod.task == m.task]) < 5: - original_id = raw.get("id") or raw.get("modelId") - if original_id: - readme = await self._fetch_model_card(original_id) - if readme: - m.description = self._extract_description(readme, raw) - - seen_ids.add(m.id) - models.append(m) - # Be polite to HF API - await asyncio.sleep(0.3) - except Exception as exc: - log.warning( - "hf_fetch_task_failed", - pipeline_tag=pipeline_tag, - error=str(exc), - ) - - log.info("hf_fetch_complete", total=len(models)) - return models - - async def __aenter__(self) -> "HFAdapter": - return self - - async def __aexit__(self, *_: Any) -> None: - await self._client.aclose() diff --git a/adapters/onnx_adapter.py b/adapters/onnx_adapter.py deleted file mode 100644 index b14d45c894997f4b8ac9f336cabfc3657e81704e..0000000000000000000000000000000000000000 --- a/adapters/onnx_adapter.py +++ /dev/null @@ -1,176 +0,0 @@ -""" -adapters/onnx_adapter.py — ONNX Model Zoo adapter. -Fetches the curated list of ONNX Zoo models from the GitHub API. -""" -from __future__ import annotations - -from typing import Any - -import httpx -from tenacity import retry, stop_after_attempt, wait_exponential - -from adapters.base import BaseAdapter -from models.model import Model, ModelMetrics, ModelVersion -from observability.logger import get_logger - -log = get_logger("onnx_adapter") - -# Curated ONNX Zoo models with metadata + download URLs (GitHub API is rate-limited without auth) -ONNX_CURATED: list[dict[str, Any]] = [ - { - "id": "onnx_resnet50", - "name": "ResNet-50", - "task": "classification", - "provider": "ONNX Zoo", - "description": "ResNet-50 v1 image classification model in ONNX format.", - "download_url": "https://github.com/onnx/models/raw/main/validated/vision/classification/resnet/model/resnet50-v2-7.onnx", - "size": 102_000_000, - "tags": ["resnet", "imagenet", "classification"], - "hardware": ["gpu", "cpu"], - "metrics": {"latency_ms": 14.2, "top1": 74.9}, - "downloads": 250_000, - "versions": [{"version": "1.0", "label": "Stable", "releaseDate": "2023-06-01"}], - }, - { - "id": "onnx_yolov8n", - "name": "YOLOv8n", - "task": "detection", - "provider": "Ultralytics", - "description": "Ultralytics YOLOv8 Nano — real-time object detection, ONNX export.", - "download_url": "https://github.com/ultralytics/yolov8/releases/download/v8.0.0/yolov8n.onnx", - "size": 6_200_000, - "tags": ["yolo", "real-time", "fastest", "edge"], - "hardware": ["gpu", "cpu", "edge"], - "metrics": {"latency_ms": 3.1, "mAP": 37.3}, - "downloads": 420_000, - "versions": [{"version": "8.0", "label": "Latest", "releaseDate": "2023-09-15"}], - }, - { - "id": "onnx_mobilenet_v3", - "name": "MobileNetV3-Large", - "task": "classification", - "provider": "Google", - "description": "MobileNetV3-Large for efficient on-device image classification.", - "download_url": "https://github.com/onnx/models/raw/main/validated/vision/classification/mobilenet/model/mobilenetv3-large-1.11.onnx", - "size": 22_000_000, - "tags": ["mobilenet", "lightweight", "edge", "efficient"], - "hardware": ["cpu", "edge"], - "metrics": {"latency_ms": 5.8, "top1": 75.2, "fps": 180}, - "downloads": 310_000, - "versions": [{"version": "3.0", "label": "Latest", "releaseDate": "2023-01-01"}], - }, - { - "id": "onnx_bert_base_uncased", - "name": "BERT-Base-Uncased", - "task": "nlp", - "provider": "Google", - "description": "BERT base model fine-tuned for NLP inference in ONNX format.", - "download_url": "https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2/resolve/main/onnx/model.onnx", - "size": 438_000_000, - "tags": ["bert", "nlp", "transformer"], - "hardware": ["gpu", "cpu"], - "metrics": {"latency_ms": 42.0}, - "downloads": 198_000, - "versions": [{"version": "1.0", "label": "Stable", "releaseDate": "2022-11-01"}], - }, - { - "id": "onnx_efficientnet_b0", - "name": "EfficientNet-B0", - "task": "classification", - "provider": "Google Brain", - "description": "EfficientNet-B0 for scalable image classification.", - "download_url": "https://github.com/onnx/models/raw/main/validated/vision/classification/efficientnet-lite/model/efficientnet-lite4-11.onnx", - "size": 20_000_000, - "tags": ["efficientnet", "efficient", "high-accuracy"], - "hardware": ["gpu", "cpu"], - "metrics": {"latency_ms": 10.4, "top1": 77.1}, - "downloads": 145_000, - "versions": [{"version": "1.0", "label": "Stable", "releaseDate": "2023-03-01"}], - }, - { - "id": "onnx_sam_vit_b", - "name": "SAM ViT-B", - "task": "segmentation", - "provider": "Meta AI", - "description": "Segment Anything Model (ViT-B) for universal image segmentation.", - "download_url": "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth", - "size": 375_000_000, - "tags": ["sam", "segmentation", "sota"], - "hardware": ["gpu"], - "metrics": {"latency_ms": 68.0}, - "downloads": 88_000, - "versions": [{"version": "1.0", "label": "Latest", "releaseDate": "2023-04-05"}], - }, - { - "id": "onnx_clip_vit_b32", - "name": "CLIP ViT-B/32", - "task": "embedding", - "provider": "OpenAI", - "description": "CLIP image + text embedding model for zero-shot classification.", - "download_url": "https://openaipublic.blob.core.windows.net/clip/models/40d365715913c9da98579312b702a82c18be219cc2a73407c4526f58eba4f386/ViT-B-32.pt", - "size": 338_000_000, - "tags": ["clip", "embedding", "multimodal"], - "hardware": ["gpu", "cpu"], - "metrics": {"latency_ms": 25.0}, - "downloads": 275_000, - "versions": [{"version": "1.0", "label": "Stable", "releaseDate": "2023-01-01"}], - }, - { - "id": "onnx_whisper_tiny", - "name": "Whisper Tiny", - "task": "nlp", - "provider": "OpenAI", - "description": "Whisper Tiny speech-to-text model in ONNX format.", - "download_url": "https://openaipublic.azureedge.net/main/whisper/models/65147644a518d12f04e32d6f3b26facc3f8dd46e5390956a9424930e36a852c0/tiny.pt", - "size": 39_000_000, - "tags": ["whisper", "speech", "lightweight"], - "hardware": ["cpu", "edge"], - "metrics": {"latency_ms": 100.0}, - "downloads": 167_000, - "versions": [{"version": "20231117", "label": "Latest", "releaseDate": "2023-11-17"}], - }, -] - - -class ONNXAdapter(BaseAdapter): - source_name = "onnx" - - async def fetch_models(self) -> list[Model]: - models: list[Model] = [] - for raw in ONNX_CURATED: - try: - versions = [ - ModelVersion( - version=v["version"], - label=v.get("label", "Stable"), - releaseDate=v.get("releaseDate", ""), - ) - for v in raw.get("versions", []) - ] - metrics_raw = raw.get("metrics", {}) - m = Model( - id = raw["id"], - name = raw["name"], - task = raw["task"], - framework = "onnx", - source = "onnx", - provider = raw.get("provider", "ONNX Zoo"), - description = raw.get("description", ""), - download_url = raw.get("download_url"), - size = raw.get("size", 0), - size_label = self._format_size(raw.get("size", 0)), - tags = raw.get("tags", []), - hardware = raw.get("hardware", ["gpu"]), - status = "available", - downloaded = False, - downloads = raw.get("downloads"), - rating = 4.2, - metrics = ModelMetrics(**metrics_raw), - versions = versions, - ) - models.append(m) - except Exception as exc: - log.warning("onnx_parse_failed", model_id=raw.get("id"), error=str(exc)) - - log.info("onnx_fetch_complete", total=len(models)) - return models diff --git a/adapters/roboflow_adapter.py b/adapters/roboflow_adapter.py deleted file mode 100644 index 74d4bb58fe2e0241a4c07bd80d20bea87308dcd5..0000000000000000000000000000000000000000 --- a/adapters/roboflow_adapter.py +++ /dev/null @@ -1,353 +0,0 @@ -""" -adapters/roboflow_adapter.py — Roboflow Universe API client. - -Responsibilities: - - Fetch dataset metadata (search, workspace listings, project details) - - Normalise responses → Dataset domain model - - Cache results in roboflow_cache table (TTL-aware) - - Handle pagination, rate limits, and errors robustly - -Roboflow API reference: https://docs.roboflow.com/api-reference/ -""" -from __future__ import annotations - -import hashlib -import json -import time -from typing import Any - -import httpx -from tenacity import retry, stop_after_attempt, wait_exponential - -from database.connection import get_db -from models.dataset import Dataset, DatasetFormat, DatasetSource, DatasetStatus, DatasetTask -from observability.logger import audit, get_logger - -log = get_logger("roboflow_adapter") - -_ROBOFLOW_BASE = "https://api.roboflow.com" -_UNIVERSE_BASE = "https://universe.roboflow.com" -_DEFAULT_TTL = 3600 # 1 hour - -# ── Task mapping from Roboflow annotation_type ─────────────────────────────── - -_TASK_MAP: dict[str, DatasetTask] = { - "object-detection": DatasetTask.detection, - "instance-segmentation": DatasetTask.segmentation, - "semantic-segmentation": DatasetTask.segmentation, - "classification": DatasetTask.classification, - "keypoint-detection": DatasetTask.keypoints, - "multiclass-classification": DatasetTask.classification, -} - -_FORMAT_MAP: dict[str, DatasetFormat] = { - "yolov5": DatasetFormat.yolo, - "yolov7": DatasetFormat.yolo, - "yolov8": DatasetFormat.yolo, - "yolov9": DatasetFormat.yolo, - "coco": DatasetFormat.coco, - "voc": DatasetFormat.voc, - "tfrecord": DatasetFormat.tfrecord, - "csv": DatasetFormat.csv, - "createml": DatasetFormat.json, - "multiclass": DatasetFormat.csv, -} - - -def _cache_key(parts: list[str]) -> str: - raw = "|".join(parts) - return hashlib.sha256(raw.encode()).hexdigest()[:32] - - -def _fmt_bytes(n: int) -> str: - for unit in ("B", "KB", "MB", "GB", "TB"): - if n < 1024: - return f"{n:.1f} {unit}" - n /= 1024 - return f"{n:.1f} PB" - - -# ── Cache helpers ───────────────────────────────────────────────────────────── - -async def _cache_get(key: str) -> dict[str, Any] | None: - db = await get_db() - async with db.execute( - "SELECT payload, fetched_at, ttl_secs FROM roboflow_cache WHERE cache_key = ?", - (key,), - ) as cur: - row = await cur.fetchone() - if row is None: - return None - fetched = time.mktime(time.strptime(row["fetched_at"], "%Y-%m-%d %H:%M:%S")) - if time.time() - fetched > row["ttl_secs"]: - return None # expired - return json.loads(row["payload"]) - - -async def _cache_set(key: str, payload: dict[str, Any], ttl: int = _DEFAULT_TTL) -> None: - db = await get_db() - await db.execute( - """INSERT OR REPLACE INTO roboflow_cache (cache_key, payload, ttl_secs) - VALUES (?, ?, ?)""", - (key, json.dumps(payload), ttl), - ) - await db.commit() - - -# ── HTTP client factory ─────────────────────────────────────────────────────── - -def _make_client(api_key: str) -> httpx.AsyncClient: - return httpx.AsyncClient( - base_url=_ROBOFLOW_BASE, - params={"api_key": api_key}, - timeout=30.0, - headers={"User-Agent": "MLForge/1.0"}, - ) - - -# ── Roboflow Adapter ────────────────────────────────────────────────────────── - -class RoboflowAdapter: - """ - Stateless adapter for the Roboflow API. - All methods accept api_key explicitly to support per-user keys. - """ - - # ── Search (Universe) ───────────────────────────────────────────────────── - - @staticmethod - @retry(stop=stop_after_attempt(3), wait=wait_exponential(min=1, max=8)) - async def search_datasets( - api_key: str, - query: str = "", - workspace: str | None = None, - page: int = 0, - page_size: int = 50, - ) -> list[Dataset]: - """ - Search Roboflow Universe for datasets. - Returns normalised Dataset objects. - """ - ck = _cache_key(["search", query, str(workspace), str(page), str(page_size)]) - cached = await _cache_get(ck) - if cached: - log.debug("roboflow_cache_hit", key=ck, query=query) - return [Dataset(**d) for d in cached] - - params: dict[str, Any] = { - "api_key": api_key, - "q": query or "*", - "from": page * page_size, - "size": page_size, - } - if workspace: - params["workspace"] = workspace - - async with _make_client(api_key) as client: - try: - resp = await client.get("/", params=params) - resp.raise_for_status() - data = resp.json() - except httpx.HTTPStatusError as e: - log.error("roboflow_api_error", status=e.response.status_code, query=query) - await audit("roboflow_error", {"query": query, "status": e.response.status_code}, level="error") - raise - - datasets = [] - for item in data.get("results", []): - try: - ds = RoboflowAdapter._normalise_search_result(item) - datasets.append(ds) - except Exception as exc: - log.warning("normalise_error", item_id=item.get("id"), error=str(exc)) - - await _cache_set(ck, [d.model_dump() for d in datasets]) - await audit("roboflow_search", {"query": query, "count": len(datasets)}) - return datasets - - # ── Workspace datasets listing ──────────────────────────────────────────── - - @staticmethod - @retry(stop=stop_after_attempt(3), wait=wait_exponential(min=1, max=8)) - async def list_workspace_datasets( - api_key: str, - workspace: str, - ) -> list[Dataset]: - """List all datasets in a Roboflow workspace.""" - ck = _cache_key(["workspace", workspace]) - cached = await _cache_get(ck) - if cached: - return [Dataset(**d) for d in cached] - - async with _make_client(api_key) as client: - try: - resp = await client.get(f"/{workspace}") - resp.raise_for_status() - data = resp.json() - except httpx.HTTPStatusError as e: - log.error("roboflow_workspace_error", workspace=workspace, status=e.response.status_code) - raise - - datasets = [] - for proj in data.get("workspace", {}).get("projects", []): - try: - ds = RoboflowAdapter._normalise_project(proj, workspace) - datasets.append(ds) - except Exception as exc: - log.warning("normalise_project_error", project=proj.get("id"), error=str(exc)) - - await _cache_set(ck, [d.model_dump() for d in datasets]) - return datasets - - # ── Single project detail ───────────────────────────────────────────────── - - @staticmethod - @retry(stop=stop_after_attempt(3), wait=wait_exponential(min=1, max=8)) - async def get_project( - api_key: str, - workspace: str, - project_id: str, - ) -> Dataset | None: - """Fetch full metadata for a single Roboflow project.""" - ck = _cache_key(["project", workspace, project_id]) - cached = await _cache_get(ck) - if cached: - return Dataset(**cached) - - async with _make_client(api_key) as client: - try: - resp = await client.get(f"/{workspace}/{project_id}") - resp.raise_for_status() - data = resp.json() - except httpx.HTTPStatusError as e: - if e.response.status_code == 404: - return None - raise - - proj_data = data.get("project", data) - ds = RoboflowAdapter._normalise_project(proj_data, workspace) - await _cache_set(ck, ds.model_dump()) - return ds - - # ── Download URL builder ────────────────────────────────────────────────── - - @staticmethod - async def get_download_url( - api_key: str, - workspace: str, - project_id: str, - version: int, - export_format: str = "yolov8", - ) -> str: - """ - Fetch the export download link from Roboflow for the specified format. - Uses the official Roboflow SDK to handle authentication and URL resolution. - """ - try: - from roboflow import Roboflow - rf = Roboflow(api_key=api_key) - project = rf.workspace(workspace).project(project_id) - version_obj = project.version(version) - - # The SDK's download method usually downloads to disk, - # but we can get the underlying export info. - # We'll use a thread to run the SDK call since it's blocking. - import asyncio - def _get_link(): - return version_obj.export(export_format).download_link - - link = await asyncio.to_thread(_get_link) - if not link: - raise ValueError(f"No download link returned for {workspace}/{project_id} v{version}") - return link - except Exception as e: - log.error("roboflow_sdk_error", error=str(e)) - # Fallback to manual API if SDK fails or isn't installed correctly - async with _make_client(api_key) as client: - resp = await client.get( - f"/{workspace}/{project_id}/{version}/{export_format}" - ) - resp.raise_for_status() - data = resp.json() - - link = export.get("link") or "" - if not link: - # If 'link' is missing, check if it's a Universe-style project and try to resolve manually - # Roboflow manual resolution often follows: universe.roboflow.com/ds/[id]?key=[api_key] - if "project" in data: - pid = data["project"].get("id") - if pid: - link = f"https://universe.roboflow.com/ds/{pid}?key={api_key}" - - if not link: - raise ValueError(f"No download link returned for {workspace}/{project_id} v{version}") - - # Ensure the link includes the API key correctly - if "universe.roboflow.com" in link: - if "key=" not in link: - separator = "&" if "?" in link else "?" - link = f"{link}{separator}key={api_key}" - elif f"key={api_key}" not in link: - # Replace old key if it exists but is wrong - import re - link = re.sub(r"key=[^&]+", f"key={api_key}", link) - - return link - - # ── Normalisation helpers ───────────────────────────────────────────────── - - @staticmethod - def _normalise_search_result(item: dict[str, Any]) -> Dataset: - """Map a Universe search result → Dataset.""" - ann_type = item.get("annotation", {}).get("type", "object-detection") - rf_task = _TASK_MAP.get(ann_type, DatasetTask.detection) - class_names = [c.get("name", "") for c in item.get("classes", [])] - images = item.get("images", 0) or 0 - - return Dataset( - id = item.get("id", "").replace("/", "__"), - name = item.get("name", "Unnamed"), - description = item.get("description", ""), - task = rf_task, - format = DatasetFormat.yolo, - source = DatasetSource.roboflow, - status = DatasetStatus.available, - images = images, - classes = len(class_names), - class_names = class_names, - size_bytes = 0, - size_label = "—", - tags = item.get("tags", []), - roboflow_id = item.get("id", ""), - created_at = item.get("created", ""), - updated_at = item.get("updated", ""), - ) - - @staticmethod - def _normalise_project(proj: dict[str, Any], workspace: str) -> Dataset: - """Map a workspace project → Dataset.""" - ann_type = proj.get("annotation", "object-detection") - rf_task = _TASK_MAP.get(ann_type, DatasetTask.detection) - class_names = [c.get("name", c) if isinstance(c, dict) else c - for c in proj.get("classes", [])] - project_id = proj.get("id", proj.get("name", "unknown")) - rf_id = f"{workspace}/{project_id}" - images = proj.get("images", 0) or 0 - - return Dataset( - id = rf_id.replace("/", "__"), - name = proj.get("name", project_id), - description = proj.get("description", ""), - task = rf_task, - format = DatasetFormat.yolo, - source = DatasetSource.roboflow, - status = DatasetStatus.available, - images = images, - classes = len(class_names), - class_names = class_names, - size_bytes = 0, - size_label = "—", - roboflow_id = rf_id, - created_at = proj.get("created", ""), - updated_at = proj.get("updated", ""), - ) diff --git a/api/routes/benchmark.py b/api/routes/benchmark.py deleted file mode 100644 index 63d8a1b9b078bafdc4e152c01cf823c4c7f85db1..0000000000000000000000000000000000000000 --- a/api/routes/benchmark.py +++ /dev/null @@ -1,238 +0,0 @@ -""" -api/routes/benchmark.py — Benchmark Bridge REST + WebSocket API. - -Routes: - POST /benchmark/validate — compatibility check (no job created) - POST /benchmark/run — validate + create + enqueue (202) - GET /benchmark/jobs — list jobs (filterable) - GET /benchmark/results/all — list all results - GET /benchmark/{job_id} — single job status + logs - GET /benchmark/{job_id}/result — metrics + telemetry for completed job - WS /benchmark/live/{job_id} — real-time progress stream -""" -from __future__ import annotations - -import asyncio -from typing import Any - -from fastapi import APIRouter, HTTPException, Query, WebSocket, WebSocketDisconnect - -import benchmark.orchestrator as orchestrator -import benchmark.registry as bench_reg -from models.benchmark import ( - BenchmarkContext, - BenchmarkJob, - BenchmarkResult, - BenchmarkRunResponse, - ValidationReport, -) -from observability.logger import get_logger - -log = get_logger("api.benchmark") - -router = APIRouter(prefix="/benchmark", tags=["benchmark"]) - - -# ── POST /benchmark/validate ────────────────────────────────────────────────── - -@router.post( - "/validate", - response_model = ValidationReport, - summary = "Validate model ↔ dataset compatibility", - description = ( - "Runs all 5 compatibility gates (task, format, framework×hardware, " - "VRAM, precision) and returns a structured report. " - "Does NOT create a benchmark job." - ), -) -async def validate_benchmark(ctx: BenchmarkContext) -> ValidationReport: - try: - return await orchestrator.validate_context(ctx) - except HTTPException: - raise - except Exception as exc: - log.exception("validate_error") - raise HTTPException(status_code=500, detail=str(exc)) from exc - - -# ── POST /benchmark/run ─────────────────────────────────────────────────────── - -@router.post( - "/run", - response_model = BenchmarkRunResponse, - status_code = 202, - summary = "Start a benchmark run", - description = ( - "Validates compatibility, creates a benchmark job, and starts async " - "execution. Returns job_id immediately — poll GET /benchmark/{job_id} " - "or connect to WS /benchmark/live/{job_id} for progress." - ), -) -async def run_benchmark(ctx: BenchmarkContext) -> BenchmarkRunResponse: - try: - job = await orchestrator.create_and_run(ctx) - return BenchmarkRunResponse( - job_id = job.id, - status = job.status, - message = f"Benchmark job {job.id} queued — connect to /benchmark/live/{job.id} for live telemetry", - ) - except HTTPException: - raise - except Exception as exc: - log.exception("run_benchmark_error") - raise HTTPException(status_code=500, detail=str(exc)) from exc - - -# ── POST /benchmark/sync ────────────────────────────────────────────────────────── - -@router.post( - "/sync", - summary = "Sync benchmarks from active project folder", - description = "Scans the active project's 'benchmarks' folder and ensures all JSON records are indexed in SQLite.", -) -async def sync_benchmarks() -> dict[str, Any]: - try: - count = await orchestrator.sync_project_benchmarks() - return {"status": "success", "count": count} - except Exception as exc: - log.exception("sync_error") - raise HTTPException(status_code=500, detail=str(exc)) from exc - - -# ── GET /benchmark/jobs ─────────────────────────────────────────────────────── - -@router.get( - "/jobs", - response_model = list[BenchmarkJob], - summary = "List benchmark jobs", -) -async def list_jobs( - status: str | None = Query(None, description="Filter by status (queued|running|completed|failed)"), - model_id: str | None = Query(None, description="Filter by model_id"), - limit: int = Query(100, ge=1, le=500), -) -> list[BenchmarkJob]: - return await bench_reg.list_jobs(status=status, model_id=model_id, limit=limit) - - -# ── GET /benchmark/results/all ──────────────────────────────────────────────── -# Must be declared BEFORE /{job_id} to avoid "results" being treated as a job_id - -@router.get( - "/results/all", - response_model = list[BenchmarkResult], - summary = "List all benchmark results (leaderboard feed)", -) -async def list_results( - limit: int = Query(100, ge=1, le=500), -) -> list[BenchmarkResult]: - return await bench_reg.list_results(limit=limit) - - -# ── GET /benchmark/{job_id} ─────────────────────────────────────────────────── - -@router.get( - "/{job_id}", - response_model = BenchmarkJob, - summary = "Get benchmark job status + logs", -) -async def get_job(job_id: str) -> BenchmarkJob: - job = await bench_reg.get_job(job_id) - if not job: - raise HTTPException(status_code=404, detail=f"Job '{job_id}' not found") - return job - - -# ── GET /benchmark/{job_id}/result ─────────────────────────────────────────── - -@router.get( - "/{job_id}/result", - response_model = BenchmarkResult, - summary = "Get final metrics + telemetry for a completed job", -) -async def get_result(job_id: str) -> BenchmarkResult: - result = await bench_reg.get_result(job_id) - if not result: - raise HTTPException( - status_code = 404, - detail = f"No result for job '{job_id}' — job may still be running", - ) - return result - - -# ── WS /benchmark/live/{job_id} ─────────────────────────────────────────────── - -@router.websocket("/live/{job_id}") -async def live_telemetry(websocket: WebSocket, job_id: str) -> None: - """ - WebSocket stream for real-time benchmark progress. - Streams incremental logs and high-frequency telemetry. - """ - await websocket.accept() - log.info("ws_connected", job_id=job_id) - - last_log_idx = 0 - - try: - while True: - job = await bench_reg.get_job(job_id) - - if not job: - await websocket.send_json( - {"error": f"Job '{job_id}' not found", "job_id": job_id} - ) - break - - # Only send new logs - new_logs = job.logs[last_log_idx:] - last_log_idx = len(job.logs) - - payload: dict[str, Any] = { - "job_id": job.id, - "status": job.status, - "progress": round(job.progress, 4), - "logs": new_logs, - "telemetry": job.last_telemetry.model_dump() if job.last_telemetry else None, - } - # Explicitly include detections for the UI visualizer if they exist - if job.last_telemetry and hasattr(job.last_telemetry, "detections"): - payload["detections"] = job.last_telemetry.detections - - await websocket.send_json(payload) - - if job.status == "completed": - result = await bench_reg.get_result(job_id) - if result: - await websocket.send_json( - { - "job_id": job_id, - "status": "completed", - "result": result.model_dump(), - } - ) - break - - if job.status == "failed": - await websocket.send_json( - { - "job_id": job_id, - "status": "failed", - "error": job.error or "Unknown error", - } - ) - break - - await asyncio.sleep(0.5) # poll at 2 Hz - - except WebSocketDisconnect: - log.info("ws_disconnected", job_id=job_id) - except Exception as exc: - log.exception("ws_error", job_id=job_id) - try: - await websocket.send_json({"error": str(exc), "job_id": job_id}) - except Exception: - pass - finally: - try: - await websocket.close() - except Exception: - pass diff --git a/api/routes/inference.py b/api/routes/inference.py deleted file mode 100644 index 9cb7039a84aa747d69a63ece340e94c4885b47af..0000000000000000000000000000000000000000 --- a/api/routes/inference.py +++ /dev/null @@ -1,168 +0,0 @@ -""" -api/routes/inference.py — Inference Engine endpoints. - -POST /inference/run — single synchronous inference pass -POST /inference/stream — SSE stream (stage-by-stage pipeline events) -GET /inference/history — session ledger -DELETE /inference/history — clear session ledger -GET /inference/cache — currently warm models in memory -DELETE /inference/cache/{model_id} — evict from cache -""" -from __future__ import annotations - -import asyncio -import json -import time - -from fastapi import APIRouter, HTTPException, Response -from fastapi.responses import StreamingResponse - -from inference.engine import InferenceEngine, evict_model, get_cache_status -from inference.session import clear_history, get_history, record -from models.inference import ( - InferenceHistoryEntry, - InferenceRequest, - InferenceResult, -) -from observability.logger import get_logger -from registry.registry import get_model - -log = get_logger("api.inference") -router = APIRouter(prefix="/inference", tags=["inference"]) - -_engine = InferenceEngine() - - -# ── Single run ─────────────────────────────────────────────────────────────── - -@router.post("/run", response_model=InferenceResult) -async def run_inference(body: InferenceRequest) -> InferenceResult: - """Execute one full inference pass and return the complete result.""" - model = await get_model(body.model_id) - if not model: - raise HTTPException(status_code=404, detail=f"Model '{body.model_id}' not found") - - result = await _engine.run(body, model) - - if result.status == "error": - raise HTTPException(status_code=500, detail=result.error or "Inference failed") - - await record(body, result, model.name) - return result - - -# ── SSE stream ─────────────────────────────────────────────────────────────── - -@router.post("/stream") -async def stream_inference(body: InferenceRequest) -> StreamingResponse: - """ - Server-Sent Events stream. - Emits one JSON event per pipeline stage as it completes, then a final - 'done' event with the full InferenceResult. - - Client usage: - const es = new EventSource('/inference/stream'); // POST via fetch + EventSource polyfill - es.onmessage = e => console.log(JSON.parse(e.data)); - """ - model = await get_model(body.model_id) - if not model: - raise HTTPException(status_code=404, detail=f"Model '{body.model_id}' not found") - - queue: asyncio.Queue[str | None] = asyncio.Queue() - - async def _producer() -> None: - """Run inference while pushing SSE events into the queue.""" - try: - # Patch engine to emit stage events - result = await _engine_stream(body, model, queue) - await record(body, result, model.name) - # Final complete event - await queue.put( - f"event: done\ndata: {result.model_dump_json()}\n\n" - ) - except Exception as exc: - await queue.put( - f"event: error\ndata: {json.dumps({'error': str(exc)})}\n\n" - ) - finally: - await queue.put(None) # sentinel - - asyncio.create_task(_producer()) - - async def _generator(): - while True: - msg = await queue.get() - if msg is None: - break - yield msg - - return StreamingResponse( - _generator(), - media_type="text/event-stream", - headers={ - "Cache-Control": "no-cache", - "X-Accel-Buffering": "no", - }, - ) - - -async def _engine_stream( - req: InferenceRequest, - model, - queue: asyncio.Queue, -) -> InferenceResult: - """ - Run inference and push a 'stage' SSE event for each PipelineStage. - Falls back to a simple full run if streaming is not distinguishable. - """ - # Run full pipeline - result = await _engine.run(req, model) - - # Emit one event per stage (replay after completion) - for stage in result.pipeline: - payload = json.dumps({ - "type": "stage", - "stage": stage.model_dump(), - "ts": time.time(), - }) - await queue.put(f"data: {payload}\n\n") - await asyncio.sleep(0) # yield - - # Emit vitals snapshot - vitals_payload = json.dumps({ - "type": "vitals", - "latency_ms": result.inference_ms, - "total_ms": result.total_ms, - "quality": result.quality_score, - }) - await queue.put(f"data: {vitals_payload}\n\n") - - return result - - -# ── History ────────────────────────────────────────────────────────────────── - -@router.get("/history", response_model=list[InferenceHistoryEntry]) -async def inference_history(limit: int = 50) -> list[InferenceHistoryEntry]: - return await get_history(limit=min(limit, 200)) - - -@router.delete("/history", status_code=204, response_model=None) -async def clear_inference_history(): - await clear_history() - return Response(status_code=204) - - -# ── Model cache ────────────────────────────────────────────────────────────── - -@router.get("/cache") -async def cache_status() -> dict[str, bool]: - return get_cache_status() - - -@router.delete("/cache/{model_id}", status_code=204, response_model=None) -async def evict_from_cache(model_id: str): - evicted = evict_model(model_id) - if not evicted: - raise HTTPException(status_code=404, detail="Model not in cache") - return Response(status_code=204) diff --git a/api/routes/jobs.py b/api/routes/jobs.py deleted file mode 100644 index 065f0e1ef1f075ec8d097ee56613eb0e0a5a3346..0000000000000000000000000000000000000000 --- a/api/routes/jobs.py +++ /dev/null @@ -1,56 +0,0 @@ -""" -api/routes/jobs.py — /jobs & /download endpoints. -""" -from __future__ import annotations - -from fastapi import APIRouter, HTTPException - -from download.manager import cancel_job, enqueue_download, get_job, list_jobs -from models.job import Job, JobCreate -from observability.logger import audit, get_logger -from registry.registry import get_model - -log = get_logger("api.jobs") -router = APIRouter(tags=["jobs"]) - - -@router.post("/download", response_model=Job, status_code=202) -async def trigger_download(body: JobCreate) -> Job: - """Enqueue a model download. Returns the created job immediately.""" - model = await get_model(body.model_id) - if not model: - raise HTTPException(status_code=404, detail=f"Model '{body.model_id}' not found") - if model.downloaded: - raise HTTPException(status_code=409, detail="Model is already cached locally") - - job_id = await enqueue_download( - model_id=body.model_id, - model_name=body.model_name, - version=body.version, - ) - job = await get_job(job_id) - if not job: - raise HTTPException(status_code=500, detail="Job creation failed") - - await audit("api_download_trigger", model_id=body.model_id, job_id=job_id) - return job - - -@router.get("/jobs", response_model=list[Job]) -async def jobs_list(status: str | None = None, limit: int = 50) -> list[Job]: - return await list_jobs(status=status, limit=limit) - - -@router.get("/jobs/{job_id}", response_model=Job) -async def job_detail(job_id: str) -> Job: - job = await get_job(job_id) - if not job: - raise HTTPException(status_code=404, detail=f"Job '{job_id}' not found") - return job - - -@router.delete("/jobs/{job_id}", status_code=204, response_model=None) -async def job_cancel(job_id: str) -> None: - success = await cancel_job(job_id) - if not success: - raise HTTPException(status_code=409, detail="Job cannot be cancelled") diff --git a/api/routes/system.py b/api/routes/system.py deleted file mode 100644 index 59191be55c260250f7ba18a2dd4fbf17859908e5..0000000000000000000000000000000000000000 --- a/api/routes/system.py +++ /dev/null @@ -1,97 +0,0 @@ -"""api/routes/system.py — System metrics endpoints.""" - -from __future__ import annotations - -import asyncio -import json - -from fastapi import APIRouter, Query -from fastapi.responses import StreamingResponse - -from models.system import SystemMetrics -from system.metrics import sample_metrics - -router = APIRouter(prefix="/system", tags=["system"]) - - -@router.get("/metrics", response_model=SystemMetrics) -async def get_metrics(gpu_index: int = Query(0, ge=0)) -> SystemMetrics: - payload = sample_metrics(gpu_index=gpu_index) - return SystemMetrics( - ts=payload["ts"], - cpu_pct=payload["cpu_pct"], - cpu_model=payload.get("cpu_model"), - cpu_freq_mhz=payload.get("cpu_freq_mhz"), - cpu_count=payload.get("cpu_count"), - ram_used_mb=payload["ram_used_mb"], - ram_total_mb=payload["ram_total_mb"], - gpu=payload.get("gpu"), - disks=payload.get("disks", []), - network=payload.get("network", []), - ) - - -@router.get("/metrics/stream") -async def stream_metrics( - gpu_index: int = Query(0, ge=0), - hz: float = Query(2.0, ge=0.2, le=20.0), -): - """Server-Sent Events stream of system metrics.""" - - interval = 1.0 / float(hz) - - async def gen(): - # Initial comment helps some proxies establish the stream - yield ": connected\n\n" - while True: - try: - payload = sample_metrics(gpu_index=gpu_index) - # Ensure the payload is valid JSON and wrapped in data: format - data = json.dumps(payload) - yield f"data: {data}\n\n" - except Exception as e: - # Log error but keep stream alive - print(f"Metrics streaming error: {e}") - await asyncio.sleep(interval) - - return StreamingResponse( - gen(), - media_type="text/event-stream", - headers={ - "Cache-Control": "no-cache", - "X-Accel-Buffering": "no", - "Connection": "keep-alive", - "Transfer-Encoding": "chunked", - }, - ) - - -@router.get("/logs/stream") -async def stream_system_logs(): - """SSE stream of global system and gateway logs.""" - from observability.logger import _sys_log_subs - - q: asyncio.Queue = asyncio.Queue() - _sys_log_subs.append(q) - - async def generator(): - yield ": connected\n\n" - try: - while True: - try: - entry = await asyncio.wait_for(q.get(), timeout=30.0) - except asyncio.TimeoutError: - yield ": heartbeat\n\n" - continue - if entry is None: - break - yield f"data: {json.dumps(entry)}\n\n" - finally: - if q in _sys_log_subs: - _sys_log_subs.remove(q) - - return StreamingResponse( - generator(), - media_type="text/event-stream", - headers={"Cache-Control": "no-cache", "X-Accel-Buffering": "no"}, - ) diff --git a/api/routes/training.py b/api/routes/training.py deleted file mode 100644 index b616144c0564c5902d14df56895522073e84d717..0000000000000000000000000000000000000000 --- a/api/routes/training.py +++ /dev/null @@ -1,428 +0,0 @@ -""" -api/routes/training.py — Training Engine REST + SSE endpoints. - -POST /train/start — create and launch a training run -POST /train/stop — cancel a running run -POST /train/pause — pause a running run -POST /train/resume — resume a paused run -GET /train/status — run status + progress snapshot -GET /train/runs — list all runs -GET /train/runs/{run_id} — single run detail -GET /train/schema — UI schema for task/model/dataset combo -GET /train/checkpoints — checkpoints for a run (stub) -POST /train/checkpoints/{id}/export — export a checkpoint (stub) -GET /train/metrics/stream — SSE: real-time metrics ticks -GET /train/logs/stream — SSE: real-time log entries -GET /train/resources/stream — SSE: real-time resource ticks -""" -from __future__ import annotations - -import asyncio -import json -import time -import os - -from fastapi import APIRouter, HTTPException, Query -from fastapi.responses import StreamingResponse - -from observability.logger import get_logger -from training import run_manager -from training.schema_engine import generate_schema -from training.schemas import ( - CheckpointOut, - PauseTrainRequest, - ResumeTrainRequest, - StartTrainRequest, - StartTrainResponse, - StopTrainRequest, - TrainRunOut, - TrainStatusResponse, - TrainingSchemaResponse, -) - -log = get_logger("api.training") -router = APIRouter(prefix="/train", tags=["training"]) - -# ── Helpers ──────────────────────────────────────────────────────────────────── - -def _format_duration(seconds: float) -> str: - h = int(seconds // 3600) - m = int((seconds % 3600) // 60) - s = int(seconds % 60) - return f"{h}h {m}m {s}s" - - -def _run_to_out(run: run_manager.TrainRun) -> TrainRunOut: - elapsed = (run.completed_at or time.time()) - run.created_at - return TrainRunOut( - id=run.run_id, - run_number=run.run_number, - model_id=run.model_id, - model_name=run.model_name, - dataset_id=run.dataset_id, - dataset_name=run.dataset_name, - task=run.task, - status=run.status, - epochs_done=run.epoch, - total_epochs=run.total_epochs, - best_metric=run.best_metric, - final_loss=run.final_loss, - duration=_format_duration(elapsed), - created_at=run.created_at, - completed_at=run.completed_at, - hyperparams=run.hyperparams, - ) - - -# ── Control endpoints ───────────────────────────────────────────────────────── - -@router.post("/start", response_model=StartTrainResponse) -async def start_training(body: StartTrainRequest) -> StartTrainResponse: - """Create and immediately launch a training run.""" - # Resolve friendly names (fall back to ids if registries unavailable) - model_name = body.model_id - dataset_name = body.dataset_id - try: - from registry.registry import get_model - m = await get_model(body.model_id) - if m: - model_name = m.name - except Exception: - pass - try: - from datasets.registry import get_dataset - d = await get_dataset(body.dataset_id) - if d: - dataset_name = d.get("name", body.dataset_id) if isinstance(d, dict) else getattr(d, "name", body.dataset_id) - except Exception: - pass - - run = run_manager.create_run( - model_id=body.model_id, - model_name=model_name, - dataset_id=body.dataset_id, - dataset_name=dataset_name, - task=body.task, - hyperparams=body.hyperparams, - augmentation=body.augmentation, - scheduler=body.scheduler, - project_id=body.project_id - ) - run_manager.start_run(run) - - log.info("training_started", run_id=run.run_id, model=body.model_id) - return StartTrainResponse( - run_id=run.run_id, - status=run.status, - message=f"Training run {run.run_id} started.", - ) - - -@router.post("/stop", status_code=200) -async def stop_training(body: StopTrainRequest) -> dict: - run = run_manager.get_run(body.run_id) - if not run: - raise HTTPException(status_code=404, detail=f"Run '{body.run_id}' not found") - run_manager.stop_run(run) - log.info("training_stopped", run_id=body.run_id) - return {"run_id": body.run_id, "status": run.status} - - -@router.post("/pause", status_code=200) -async def pause_training(body: PauseTrainRequest) -> dict: - run = run_manager.get_run(body.run_id) - if not run: - raise HTTPException(status_code=404, detail=f"Run '{body.run_id}' not found") - run_manager.pause_run(run) - return {"run_id": body.run_id, "status": run.status} - - -@router.post("/resume", status_code=200) -async def resume_training(body: ResumeTrainRequest) -> dict: - run = run_manager.get_run(body.run_id) - if not run: - raise HTTPException(status_code=404, detail=f"Run '{body.run_id}' not found") - run_manager.resume_run(run) - return {"run_id": body.run_id, "status": run.status} - - -@router.get("/status", response_model=TrainStatusResponse) -async def get_train_status(run_id: str = Query(...)) -> TrainStatusResponse: - run = run_manager.get_run(run_id) - if not run: - raise HTTPException(status_code=404, detail=f"Run '{run_id}' not found") - return TrainStatusResponse( - run_id=run.run_id, - status=run.status, - epoch=run.epoch, - total_epochs=run.total_epochs, - step=run.step, - total_steps=run.total_epochs * 100, - eta_seconds=run.eta_seconds, - elapsed_seconds=run.elapsed_seconds, - ) - - -# ── Run history ─────────────────────────────────────────────────────────────── - -@router.get("/runs", response_model=list[TrainRunOut]) -async def list_runs() -> list[TrainRunOut]: - return [_run_to_out(r) for r in reversed(run_manager.list_runs())] - - -@router.get("/runs/{run_id}", response_model=TrainRunOut) -async def get_run(run_id: str) -> TrainRunOut: - run = run_manager.get_run(run_id) - if not run: - raise HTTPException(status_code=404, detail=f"Run '{run_id}' not found") - return _run_to_out(run) - - -# ── Schema Engine ───────────────────────────────────────────────────────────── - -@router.get("/schema", response_model=TrainingSchemaResponse) -async def get_schema( - model_id: str = Query(""), - dataset_id: str = Query(""), - task: str = Query("detection"), -) -> TrainingSchemaResponse: - schema = generate_schema(task=task, model_id=model_id, dataset_id=dataset_id) - return TrainingSchemaResponse(**schema) - - -# ── Checkpoints (stub — extend when artifact storage is wired) ──────────────── - -@router.get("/checkpoints", response_model=list[CheckpointOut]) -async def list_checkpoints(run_id: str = Query(...)) -> list[CheckpointOut]: - """Returns an empty list until checkpoint persistence is implemented.""" - run = run_manager.get_run(run_id) - if not run: - raise HTTPException(status_code=404, detail=f"Run '{run_id}' not found") - return [] - - -@router.post("/checkpoints/{checkpoint_id}/export") -async def export_checkpoint(checkpoint_id: str, body: dict = {}) -> dict: - raise HTTPException(status_code=501, detail="Checkpoint export not yet implemented") - - -# ── SSE: Metrics stream ──────────────────────────────────────────────────────── - -@router.get("/metrics/stream") -async def stream_metrics(run_id: str = Query(...)) -> StreamingResponse: - """ - Server-Sent Events stream of TrainMetricsTick objects. - Connects to the run's metrics queue and forwards each tick as SSE. - Stream closes when the run finishes (sentinel None pushed by worker). - """ - run = run_manager.get_run(run_id) - if not run: - raise HTTPException(status_code=404, detail=f"Run '{run_id}' not found") - - q: asyncio.Queue = asyncio.Queue() - run.metrics_subs.append(q) - - async def generator(): - yield ": connected\n\n" - try: - while True: - try: - tick = await asyncio.wait_for(q.get(), timeout=30.0) - except asyncio.TimeoutError: - # Heartbeat to keep connection alive - yield ": heartbeat\n\n" - continue - if tick is None: - break - yield f"data: {json.dumps(tick)}\n\n" - finally: - if q in run.metrics_subs: - run.metrics_subs.remove(q) - - return StreamingResponse( - generator(), - media_type="text/event-stream", - headers={"Cache-Control": "no-cache", "X-Accel-Buffering": "no"}, - ) - - -# ── SSE: Logs stream ────────────────────────────────────────────────────────── - -@router.get("/logs/stream") -async def stream_logs(run_id: str = Query(...)) -> StreamingResponse: - """Server-Sent Events stream of LogEntry objects.""" - run = run_manager.get_run(run_id) - if not run: - raise HTTPException(status_code=404, detail=f"Run '{run_id}' not found") - - q: asyncio.Queue = asyncio.Queue() - run.log_subs.append(q) - - async def generator(): - yield ": connected\n\n" - try: - while True: - try: - entry = await asyncio.wait_for(q.get(), timeout=30.0) - except asyncio.TimeoutError: - yield ": heartbeat\n\n" - continue - if entry is None: - break - yield f"data: {json.dumps(entry)}\n\n" - finally: - if q in run.log_subs: - run.log_subs.remove(q) - - return StreamingResponse( - generator(), - media_type="text/event-stream", - headers={"Cache-Control": "no-cache", "X-Accel-Buffering": "no"}, - ) - - -@router.get("/runs/{run_id}/history") -async def get_run_history(run_id: str) -> list[dict]: - """Retrieves the full historical telemetry (metrics ticks) for a run.""" - run = run_manager.get_run(run_id) - if not run: - raise HTTPException(status_code=404, detail=f"Run '{run_id}' not found") - - from training.persistence import TrainingPersistence - run_dir = await TrainingPersistence.get_run_dir(run.project_id or "default", run_id) - telemetry_path = os.path.join(run_dir, "telemetry.jsonl") - - history = [] - if os.path.exists(telemetry_path): - try: - with open(telemetry_path, "r") as f: - for line in f: - if line.strip(): - history.append(json.loads(line)) - except Exception as e: - log.error("history_read_failed", run_id=run_id, error=str(e)) - raise HTTPException(status_code=500, detail="Failed to read telemetry history") - - return history - -@router.get("/runs/{run_id}/artifacts") -async def list_run_artifacts(run_id: str) -> dict: - """Lists available artifacts (images) for a specific run by scanning the directory.""" - run = run_manager.get_run(run_id) - if not run: - raise HTTPException(status_code=404, detail=f"Run '{run_id}' not found") - - from training.persistence import TrainingPersistence - run_dir = await TrainingPersistence.get_run_dir(run.project_id or "default", run_id) - - if not os.path.exists(run_dir): - return {"artifacts": [], "batches": []} - - artifacts = [] - batches = [] - - # Standard YOLO artifact mappings for better UI titles - titles = { - "confusion_matrix.png": "Confusion Matrix", - "confusion_matrix_normalized.png": "Confusion Matrix (Norm)", - "results.png": "Results Summary", - "F1_curve.png": "F1 Curve", - "PR_curve.png": "PR Curve", - "P_curve.png": "Precision Curve", - "R_curve.png": "Recall Curve", - "BoxF1_curve.png": "Box F1 Curve", - "BoxP_curve.png": "Box Precision Curve", - "BoxPR_curve.png": "Box PR Curve", - "BoxR_curve.png": "Box Recall Curve", - "labels.jpg": "Labels Distribution", - "labels_correlogram.jpg": "Labels Correlogram" - } - - for f in os.listdir(run_dir): - path = f"/train/runs/{run_id}/files/{f}" - if f.endswith(('.png', '.jpg', '.jpeg')): - item = { - "title": titles.get(f, f.replace('_', ' ').title().split('.')[0]), - "path": path, - "type": "Analysis" - } - - if "batch" in f.lower(): - item["type"] = "Batch Preview" if "val" in f.lower() else "Augmentation" - batches.append(item) - else: - if "curve" in f.lower(): - item["type"] = "Precision-Recall" - elif "confusion" in f.lower(): - item["type"] = "Analysis" - elif "results" in f.lower(): - item["type"] = "Overall" - artifacts.append(item) - - return { - "artifacts": sorted(artifacts, key=lambda x: x['title']), - "batches": sorted(batches, key=lambda x: x['title']) - } - -@router.get("/runs/{run_id}/files/{filename}") -async def get_run_file(run_id: str, filename: str): - """Serves a specific file from the run directory.""" - run = run_manager.get_run(run_id) - if not run: - raise HTTPException(status_code=404, detail="Run not found") - - # We need to find the project to get the run_dir - # Since run_manager doesn't easily expose the full path in memory, - # we recalculate it using persistence - from training.persistence import TrainingPersistence - run_dir = await TrainingPersistence.get_run_dir(run.project_id or "default", run_id) - file_path = os.path.join(run_dir, filename) - - if not os.path.exists(file_path): - raise HTTPException(status_code=404, detail="File not found") - - from fastapi.responses import FileResponse - return FileResponse(file_path) -# The frontend uses /system/metrics/stream for resources (already implemented). -# This alias exists for training-scoped resource monitoring. - -@router.get("/resources/stream") -async def stream_resources( - run_id: str = Query(...), - gpu_index: int = Query(0, ge=0), - hz: float = Query(1.0, ge=0.2, le=10.0), -) -> StreamingResponse: - """ - SSE stream of ResourceTick objects for a specific training run. - Forwards system metrics at the requested hz rate. - """ - run = run_manager.get_run(run_id) - if not run: - raise HTTPException(status_code=404, detail=f"Run '{run_id}' not found") - - q: asyncio.Queue = asyncio.Queue() - run.resource_subs.append(q) - - interval = 1.0 / hz - - async def generator(): - yield ": connected\n\n" - try: - while True: - try: - tick = await asyncio.wait_for(q.get(), timeout=30.0) - except asyncio.TimeoutError: - yield ": heartbeat\n\n" - continue - if tick is None: - break - yield f"data: {json.dumps(tick)}\n\n" - finally: - if q in run.resource_subs: - run.resource_subs.remove(q) - - return StreamingResponse( - generator(), - media_type="text/event-stream", - headers={"Cache-Control": "no-cache", "X-Accel-Buffering": "no"}, - ) diff --git a/benchmark/__init__.py b/benchmark/__init__.py deleted file mode 100644 index 639df04e71177c6512c122abf44e1f0138157e4b..0000000000000000000000000000000000000000 --- a/benchmark/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# benchmark — Benchmark Bridge System for MLForge diff --git a/benchmark/__pycache__/__init__.cpython-310.pyc b/benchmark/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 29c1709cbf123d14e003da151f564218de89bc90..0000000000000000000000000000000000000000 Binary files a/benchmark/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/benchmark/__pycache__/compatibility.cpython-310.pyc b/benchmark/__pycache__/compatibility.cpython-310.pyc deleted file mode 100644 index a86a314341973d5f9dce083ff80ff7694d0af51e..0000000000000000000000000000000000000000 Binary files a/benchmark/__pycache__/compatibility.cpython-310.pyc and /dev/null differ diff --git a/benchmark/__pycache__/execution.cpython-310.pyc b/benchmark/__pycache__/execution.cpython-310.pyc deleted file mode 100644 index 512b964e89258d6d99ddc1c45301a9f5fee3d541..0000000000000000000000000000000000000000 Binary files a/benchmark/__pycache__/execution.cpython-310.pyc and /dev/null differ diff --git a/benchmark/__pycache__/metrics.cpython-310.pyc b/benchmark/__pycache__/metrics.cpython-310.pyc deleted file mode 100644 index fbf6b2f03c47aee2ac388d06b5a9f6ebac2910b5..0000000000000000000000000000000000000000 Binary files a/benchmark/__pycache__/metrics.cpython-310.pyc and /dev/null differ diff --git a/benchmark/__pycache__/orchestrator.cpython-310.pyc b/benchmark/__pycache__/orchestrator.cpython-310.pyc deleted file mode 100644 index 520d741deed4aa5b2849b79206aec911de4b573f..0000000000000000000000000000000000000000 Binary files a/benchmark/__pycache__/orchestrator.cpython-310.pyc and /dev/null differ diff --git a/benchmark/__pycache__/registry.cpython-310.pyc b/benchmark/__pycache__/registry.cpython-310.pyc deleted file mode 100644 index dd2a9a5f3a6cc0b3ef3ecf1cb6b5247b6acae876..0000000000000000000000000000000000000000 Binary files a/benchmark/__pycache__/registry.cpython-310.pyc and /dev/null differ diff --git a/benchmark/__pycache__/telemetry.cpython-310.pyc b/benchmark/__pycache__/telemetry.cpython-310.pyc deleted file mode 100644 index ea6f026b10c3f79d0825498114cd105b0dad4bae..0000000000000000000000000000000000000000 Binary files a/benchmark/__pycache__/telemetry.cpython-310.pyc and /dev/null differ diff --git a/benchmark/adapters/__pycache__/base.cpython-310.pyc b/benchmark/adapters/__pycache__/base.cpython-310.pyc deleted file mode 100644 index 24ff4a2890c8ba8d65b299c868e0717ca220c1e6..0000000000000000000000000000000000000000 Binary files a/benchmark/adapters/__pycache__/base.cpython-310.pyc and /dev/null differ diff --git a/benchmark/adapters/__pycache__/registry.cpython-310.pyc b/benchmark/adapters/__pycache__/registry.cpython-310.pyc deleted file mode 100644 index 6f78e04b2d65ecb46efde9b020774f2a0478d241..0000000000000000000000000000000000000000 Binary files a/benchmark/adapters/__pycache__/registry.cpython-310.pyc and /dev/null differ diff --git a/benchmark/adapters/__pycache__/torch_runner.cpython-310.pyc b/benchmark/adapters/__pycache__/torch_runner.cpython-310.pyc deleted file mode 100644 index 6d3bfaa256012b2af744526da42691e08b9af948..0000000000000000000000000000000000000000 Binary files a/benchmark/adapters/__pycache__/torch_runner.cpython-310.pyc and /dev/null differ diff --git a/benchmark/adapters/base.py b/benchmark/adapters/base.py deleted file mode 100644 index b3462388e9172ff98b98ab85d8a35d5a83fca1fa..0000000000000000000000000000000000000000 --- a/benchmark/adapters/base.py +++ /dev/null @@ -1,38 +0,0 @@ -""" -benchmark/adapters/base.py — Base class for all Benchmark Runners. -""" -from __future__ import annotations - -from abc import ABC, abstractmethod -from dataclasses import dataclass, field -from typing import Any, AsyncGenerator - -from models.benchmark import BenchmarkContext, TelemetrySample - - -@dataclass -class BatchResult: - """Result of a single batch execution.""" - latency_ms: float - vram_used_gb: float - task_scores: dict[str, float] = field(default_factory=dict) - metadata: dict[str, Any] = field(default_factory=dict) - - -class BaseRunner(ABC): - """Abstract interface for benchmark executors (Torch, Optimum, vLLM).""" - - @abstractmethod - async def initialize(self, ctx: BenchmarkContext, model_path: str) -> None: - """Load model and prepare environment.""" - pass - - @abstractmethod - async def run_batch(self, batch: Any) -> BatchResult: - """Execute a single batch of data.""" - pass - - @abstractmethod - async def shutdown(self) -> None: - """Release resources.""" - pass diff --git a/benchmark/adapters/optimum_runner.py b/benchmark/adapters/optimum_runner.py deleted file mode 100644 index 7aaf5d66f23033eb3be47b2fcbf667e5581d26c2..0000000000000000000000000000000000000000 --- a/benchmark/adapters/optimum_runner.py +++ /dev/null @@ -1,53 +0,0 @@ -""" -benchmark/adapters/optimum_runner.py — Hugging Face Optimum Adapter. -Supports ONNX, OpenVINO, and TensorRT acceleration. -""" -from __future__ import annotations - -import time -import asyncio -from typing import Any -from benchmark.adapters.base import BaseRunner, BatchResult -from models.benchmark import BenchmarkContext -from observability.logger import get_logger - -log = get_logger("benchmark.optimum") - -class OptimumRunner(BaseRunner): - def __init__(self): - self.session = None - self.device = "cpu" - - async def initialize(self, ctx: BenchmarkContext, model_path: str) -> None: - """ - Load model using Optimum's ORTModel or equivalent. - In a real implementation, this would detect the framework and use: - ORTModelForFeatureExtraction.from_pretrained(model_path, provider=...) - """ - log.info("optimum_init", model_path=model_path, hardware=ctx.hardware) - self.device = "cuda" if "gpu" in ctx.hardware.lower() or "rtx" in ctx.hardware.lower() else "cpu" - - # Simulate load time - await asyncio.sleep(1.5) - self.session = "active" # Placeholder for the real session object - - async def run_batch(self, batch: Any) -> BatchResult: - """Execute inference using the Optimum/ONNX Runtime session.""" - if not self.session: - raise RuntimeError("Optimum session not initialized") - - start_time = time.perf_counter() - # Mocking inference logic - # outputs = self.session(**batch) - await asyncio.sleep(0.01) # Simulated inference time - latency = (time.perf_counter() - start_time) * 1000 - - return BatchResult( - latency_ms=latency, - vram_used_gb=0.8, # Mocked - task_scores={"accuracy": 0.92} # Mocked - ) - - async def shutdown(self) -> None: - log.info("optimum_shutdown") - self.session = None diff --git a/benchmark/adapters/registry.py b/benchmark/adapters/registry.py deleted file mode 100644 index 877edaa8c05ee434e6780a58028c1e2471ace46e..0000000000000000000000000000000000000000 --- a/benchmark/adapters/registry.py +++ /dev/null @@ -1,44 +0,0 @@ -""" -benchmark/adapters/registry.py — Executor Registry for dynamic runner resolution. -""" -from __future__ import annotations - -from typing import Type -from benchmark.adapters.base import BaseRunner -from models.benchmark import BenchmarkContext -from models.model import Model - -class ExecutorRegistry: - _runners: dict[str, Type[BaseRunner]] = {} - - @classmethod - def register(cls, framework: str, runner_cls: Type[BaseRunner]): - cls._runners[framework.lower()] = runner_cls - - @classmethod - def get_runner(cls, framework: str) -> BaseRunner: - runner_cls = cls._runners.get(framework.lower()) - if not runner_cls: - # Fallback or default runner - from benchmark.adapters.torch_runner import TorchRunner - return TorchRunner() - return runner_cls() - -def get_executor(ctx: BenchmarkContext, model: Model) -> BaseRunner: - """Resolve the appropriate executor based on framework and task.""" - framework = model.framework.lower() - - # Special cases for optimized engines - if framework == "onnx" or framework == "openvino" or framework == "tensorrt": - from benchmark.adapters.optimum_runner import OptimumRunner - return OptimumRunner() - - if ctx.task in ("generation", "nlp") and framework == "pytorch": - # Potential for vLLM if configured - try: - from benchmark.adapters.vllm_runner import VLLMRunner - return VLLMRunner() - except ImportError: - pass - - return ExecutorRegistry.get_runner(framework) diff --git a/benchmark/adapters/torch_runner.py b/benchmark/adapters/torch_runner.py deleted file mode 100644 index 8a00dabb2bc0f86e692ebb721b0f0564e12ef228..0000000000000000000000000000000000000000 --- a/benchmark/adapters/torch_runner.py +++ /dev/null @@ -1,45 +0,0 @@ -""" -benchmark/adapters/torch_runner.py — PyTorch Runner Adapter. -Wraps standard PyTorch inference for Vision and NLP tasks. -""" -from __future__ import annotations - -import time -import asyncio -import random -from typing import Any -from benchmark.adapters.base import BaseRunner, BatchResult -from models.benchmark import BenchmarkContext -from observability.logger import get_logger - -log = get_logger("benchmark.torch") - -class TorchRunner(BaseRunner): - def __init__(self): - self.model = None - self.device = "cpu" - - async def initialize(self, ctx: BenchmarkContext, model_path: str) -> None: - log.info("torch_init", model_path=model_path, hardware=ctx.hardware) - # In production: self.model = torch.load(model_path).to(self.device) - await asyncio.sleep(1.0) - self.model = "active" - - async def run_batch(self, batch: Any) -> BatchResult: - if not self.model: - raise RuntimeError("Torch model not initialized") - - start_time = time.perf_counter() - # Mocking torch inference - await asyncio.sleep(0.02) - latency = (time.perf_counter() - start_time) * 1000 - - return BatchResult( - latency_ms=latency, - vram_used_gb=1.2, - task_scores={"mAP": 0.45} - ) - - async def shutdown(self) -> None: - log.info("torch_shutdown") - self.model = None diff --git a/benchmark/compatibility.py b/benchmark/compatibility.py deleted file mode 100644 index a299bff9ae4c5898a2bdebdd4d8457d26b3a56b9..0000000000000000000000000000000000000000 --- a/benchmark/compatibility.py +++ /dev/null @@ -1,360 +0,0 @@ -""" -benchmark/compatibility.py — Compatibility Validator (CRITICAL MODULE). - -Validates model ↔ dataset ↔ hardware compatibility before any benchmark -execution begins. Returns a structured ValidationReport — never raises. - -Five gates (all must pass): - A. Task compatibility — model.task matches dataset.task - B. Annotation format — dataset format supports the model's task - C. Framework × hardware — framework can run on the requested device - D. VRAM constraint — estimated memory fits available VRAM - E. Precision support — precision mode is valid for framework + hardware -""" -from __future__ import annotations - -from models.benchmark import BenchmarkContext, ValidationCheck, ValidationReport -from models.dataset import Dataset -from models.model import Model -from observability.logger import get_logger - -log = get_logger("benchmark.compatibility") - - -# ── Lookup tables ───────────────────────────────────────────────────────────── - -# Hardware → available VRAM in GB (normalized keys, no spaces/dashes) -HARDWARE_VRAM_GB: dict[str, float] = { - # NVIDIA consumer — Ampere / Ada - "rtx4090": 24.0, - "rtx4080": 16.0, - "rtx4070ti": 12.0, - "rtx4070": 12.0, - "rtx4060ti": 8.0, - "rtx4060": 8.0, - "rtx3090": 24.0, - "rtx3080": 10.0, - "rtx3070": 8.0, - "rtx3060": 12.0, - "rtx2080ti": 11.0, - "rtx2080": 8.0, - # NVIDIA datacenter - "a100": 80.0, - "a10040gb": 40.0, - "h100": 80.0, - "v100": 32.0, - "t4": 16.0, - "a10": 24.0, - # AMD - "rx7900xtx": 24.0, - "rx6800xt": 16.0, - # Generic fallbacks - "gpu": 8.0, - "cpu": 0.0, - "tpu": 0.0, - "edge": 0.0, -} - -# model.task → set of compatible dataset.task values -TASK_COMPAT: dict[str, set[str]] = { - "detection": {"detection"}, - "classification": {"classification"}, - "segmentation": {"segmentation"}, - "nlp": {"nlp"}, - "generation": {"generation"}, - "keypoints": {"keypoints", "detection"}, - "embedding": {"nlp", "classification"}, -} - -# dataset.format → set of model tasks it supports -FORMAT_TASK_COMPAT: dict[str, set[str]] = { - "yolo": {"detection", "segmentation", "keypoints"}, - "coco": {"detection", "segmentation", "keypoints"}, - "voc": {"detection"}, - "csv": {"classification"}, - "json": {"detection", "segmentation", "classification", "nlp", "generation"}, - "tfrecord": {"detection", "classification", "segmentation"}, - "custom": {"detection", "classification", "segmentation", "nlp", "generation", "keypoints"}, -} - -# model.framework → set of hardware targets (normalized) it can run on -FRAMEWORK_HARDWARE_COMPAT: dict[str, set[str]] = { - "pytorch": { - "cpu", "gpu", - "rtx4090", "rtx4080", "rtx4070ti", "rtx4070", "rtx4060ti", "rtx4060", - "rtx3090", "rtx3080", "rtx3070", "rtx3060", - "rtx2080ti", "rtx2080", - "a100", "a10040gb", "h100", "v100", "t4", "a10", - }, - "onnx": { - "cpu", "gpu", - "rtx4090", "rtx3090", "a100", "h100", "t4", "a10", - "edge", - }, - "tensorflow": { - "cpu", "gpu", - "rtx4090", "rtx3090", "a100", "h100", "v100", "t4", - "tpu", - }, - "tflite": {"cpu", "edge"}, - "coreml": {"cpu"}, -} - -# Precisions that require GPU -_GPU_ONLY_PRECISIONS = {"FP16", "BF16"} - -# Frameworks supporting INT8 quantization -_INT8_FRAMEWORKS = {"onnx", "tflite", "pytorch", "tensorflow"} - - -class CompatibilityValidator: - """ - Runs all compatibility gates before a benchmark job is created. - Returns a ValidationReport — never raises exceptions. - """ - - def validate( - self, - model: Model, - dataset: Dataset, - ctx: BenchmarkContext, - ) -> ValidationReport: - checks: list[ValidationCheck] = [ - self._check_task(model, dataset), - self._check_annotation_format(model, dataset), - self._check_framework_hardware(model, ctx), - self._check_vram(model, ctx), - self._check_precision(model, ctx), - ] - - errors = [c.detail for c in checks if not c.passed] - warnings: list[str] = [] - - log.info( - "compatibility_validated", - model_id = model.id, - dataset_id = dataset.id, - passed = len(errors) == 0, - error_count = len(errors), - ) - - return ValidationReport( - model_id = model.id, - dataset_id = dataset.id, - passed = len(errors) == 0, - checks = checks, - errors = errors, - warnings = warnings, - ) - - # ── Gate A: Task ────────────────────────────────────────────────────────── - - def _check_task(self, model: Model, dataset: Dataset) -> ValidationCheck: - model_task = model.task.lower().strip() - dataset_task = str(dataset.task).lower().strip() - - allowed = TASK_COMPAT.get(model_task, {model_task}) - if dataset_task in allowed: - return ValidationCheck( - name = "task_compatibility", - passed = True, - detail = ( - f"Model task '{model_task}' is compatible " - f"with dataset task '{dataset_task}'" - ), - ) - return ValidationCheck( - name = "task_compatibility", - passed = False, - detail = ( - f"Model task '{model_task}' cannot evaluate " - f"a '{dataset_task}' dataset" - ), - suggestion = ( - f"Select a model with task='{dataset_task}', " - f"or choose a dataset with task='{model_task}'" - ), - ) - - # ── Gate B: Annotation Format ───────────────────────────────────────────── - - def _check_annotation_format(self, model: Model, dataset: Dataset) -> ValidationCheck: - dataset_fmt = str(dataset.format).lower().strip() - model_task = model.task.lower().strip() - supported = FORMAT_TASK_COMPAT.get(dataset_fmt, set()) - - if model_task in supported: - return ValidationCheck( - name = "annotation_format", - passed = True, - detail = ( - f"Dataset format '{dataset_fmt}' supports " - f"model task '{model_task}'" - ), - ) - - if model_task in {"detection", "segmentation", "keypoints"}: - suggestion = ( - f"Convert dataset to YOLO or COCO format — both support '{model_task}'" - ) - elif model_task == "classification": - suggestion = "Convert dataset to CSV or JSON format for classification tasks" - else: - suggestion = f"Use a JSON or custom-format dataset for '{model_task}' tasks" - - return ValidationCheck( - name = "annotation_format", - passed = False, - detail = ( - f"Dataset format '{dataset_fmt}' does not support " - f"model task '{model_task}'" - ), - suggestion = suggestion, - ) - - # ── Gate C: Framework × Hardware ───────────────────────────────────────── - - def _check_framework_hardware( - self, model: Model, ctx: BenchmarkContext - ) -> ValidationCheck: - framework = model.framework.lower().strip() - hw_raw = ctx.hardware - hw_key = self._normalize_hw(hw_raw) - - supported_hw = FRAMEWORK_HARDWARE_COMPAT.get(framework, {"cpu"}) - - # Match: exact key, or generic "gpu" bucket covers any named GPU - hw_ok = ( - hw_key in supported_hw - or ("gpu" in supported_hw and hw_key not in {"cpu", "tpu", "edge"}) - ) - - if hw_ok: - return ValidationCheck( - name = "framework_hardware", - passed = True, - detail = f"Framework '{framework}' is supported on '{hw_raw}'", - ) - return ValidationCheck( - name = "framework_hardware", - passed = False, - detail = ( - f"Framework '{framework}' cannot run on '{hw_raw}'. " - f"Supported targets: {', '.join(sorted(supported_hw))}" - ), - suggestion = ( - "Use ONNX runtime for broadest hardware support, " - f"or pick a device from: {', '.join(sorted(supported_hw))}" - ), - ) - - # ── Gate D: VRAM Constraint ─────────────────────────────────────────────── - - def _check_vram(self, model: Model, ctx: BenchmarkContext) -> ValidationCheck: - hw_key = self._normalize_hw(ctx.hardware) - available = self._lookup_vram(hw_key) - - if available == 0.0: - return ValidationCheck( - name = "vram_constraint", - passed = True, - detail = f"Running on '{ctx.hardware}' (CPU/TPU/Edge) — no VRAM constraint", - ) - - # Estimate: weights at given precision + activations for one batch - model_gb = max(model.size, 1) / (1024 ** 3) - prec_map = {"FP16": 0.5, "BF16": 0.5, "INT8": 0.25, "FP32": 1.0} - prec_mult = prec_map.get(ctx.precision.upper(), 1.0) - # weights × precision + ~20% for optimizer/activation buffers + batch overhead - estimated = (model_gb * prec_mult * 1.2) + (ctx.batch_size * 0.05) - - if estimated <= available: - return ValidationCheck( - name = "vram_constraint", - passed = True, - detail = ( - f"Estimated VRAM {estimated:.2f} GB ≤ " - f"available {available:.1f} GB on '{ctx.hardware}'" - ), - ) - return ValidationCheck( - name = "vram_constraint", - passed = False, - detail = ( - f"Estimated VRAM {estimated:.2f} GB exceeds " - f"available {available:.1f} GB on '{ctx.hardware}'" - ), - suggestion = ( - f"Try: reduce batch_size (now {ctx.batch_size}), " - f"switch to FP16/INT8 precision, " - f"or use a GPU with ≥ {estimated:.1f} GB VRAM" - ), - ) - - # ── Gate E: Precision Support ───────────────────────────────────────────── - - def _check_precision(self, model: Model, ctx: BenchmarkContext) -> ValidationCheck: - precision = ctx.precision.upper() - framework = model.framework.lower().strip() - hw_key = self._normalize_hw(ctx.hardware) - is_gpu = hw_key not in {"cpu", "tpu", "edge"} - - if precision in _GPU_ONLY_PRECISIONS and not is_gpu: - return ValidationCheck( - name = "precision_support", - passed = False, - detail = ( - f"Precision '{precision}' requires a CUDA GPU; " - f"'{ctx.hardware}' does not support it" - ), - suggestion = "Use FP32 for CPU inference, or switch to a compatible GPU", - ) - - if precision == "INT8" and framework not in _INT8_FRAMEWORKS: - return ValidationCheck( - name = "precision_support", - passed = False, - detail = ( - f"Framework '{framework}' does not support INT8 quantization" - ), - suggestion = ( - "Convert model to ONNX or use PyTorch with torch.quantization" - ), - ) - - return ValidationCheck( - name = "precision_support", - passed = True, - detail = ( - f"Precision '{precision}' is valid for " - f"framework '{framework}' on '{ctx.hardware}'" - ), - ) - - # ── Helpers ─────────────────────────────────────────────────────────────── - - @staticmethod - def _normalize_hw(hardware: str) -> str: - """Lowercase, strip spaces/dashes/underscores for lookup.""" - return ( - hardware.lower() - .replace(" ", "") - .replace("-", "") - .replace("_", "") - .replace("nvidia", "") - .replace("geforce", "") - ) - - @staticmethod - def _lookup_vram(hw_key: str) -> float: - """Return VRAM GB for a normalized hardware key, with fallback matching.""" - if hw_key in HARDWARE_VRAM_GB: - return HARDWARE_VRAM_GB[hw_key] - # Partial match (e.g. "rtx4090laptop" → "rtx4090") - for key, vram in HARDWARE_VRAM_GB.items(): - if key and key in hw_key: - return vram - # Anything that looks like a GPU but isn't in the table - if "gpu" in hw_key or "rtx" in hw_key or "gtx" in hw_key or "cuda" in hw_key: - return HARDWARE_VRAM_GB["gpu"] - return 0.0 # CPU / unknown → no VRAM constraint diff --git a/benchmark/execution.py b/benchmark/execution.py deleted file mode 100644 index 3f7d76abec0189942414e930c10cf2600b70bae1..0000000000000000000000000000000000000000 --- a/benchmark/execution.py +++ /dev/null @@ -1,366 +0,0 @@ -""" -benchmark/execution.py — Benchmark Execution Engine. - -Drives the batch inference loop, collecting latencies and VRAM readings. -Calls TelemetryCollector in parallel with batch processing. -Yields progress callbacks so the orchestrator can persist real-time state. - -Adapter pattern: swap _run_single_batch() with a real inference call -(torch.cuda.synchronize + model(batch)) once GPU runtime is wired up. - -PRODUCTION SWAP POINTS are marked with # <<< REPLACE IN PRODUCTION >>> -""" -from __future__ import annotations - -import asyncio -import math -import random -from dataclasses import dataclass, field -from typing import Awaitable, Callable - -from benchmark.compatibility import HARDWARE_VRAM_GB -from benchmark.telemetry import TelemetryCollector -from models.benchmark import BenchmarkJob, LayerBreakdown, TelemetrySample, TelemetrySummary -from models.dataset import Dataset -from models.model import Model -from observability.logger import get_logger - -log = get_logger("benchmark.execution") - - -# ── Per-image latency profiles (ms at batch=1, fp32) ───────────────────────── -_LATENCY_MS_PER_IMAGE: dict[str, float] = { - "rtx4090": 1.8, - "rtx4080": 2.5, - "rtx4070ti": 3.2, - "rtx4070": 3.8, - "rtx3090": 3.0, - "rtx3080": 4.5, - "rtx3070": 6.5, - "rtx3060": 9.0, - "rtx2080ti": 5.0, - "rtx2080": 7.5, - "a100": 1.2, - "h100": 0.7, - "v100": 2.8, - "t4": 5.5, - "a10": 3.5, - "gpu": 8.0, - "cpu": 42.0, -} - -# Precision speedup multipliers (relative to FP32) -_PRECISION_SPEEDUP: dict[str, float] = { - "FP32": 1.0, - "FP16": 1.8, - "BF16": 1.7, - "INT8": 2.5, -} - -# Task-specific baseline metric scores (pre-jitter) -_TASK_BASELINES: dict[str, dict[str, float]] = { - "detection": {"mAP": 0.435, "mAP_50": 0.618, "mAP_50_95": 0.435}, - "classification": {"accuracy": 0.872, "top5": 0.968}, - "segmentation": {"mAP": 0.372, "iou_mean": 0.706}, - "keypoints": {"mAP": 0.641, "mAP_50": 0.860}, - "nlp": {"accuracy": 0.891}, - "generation": {"accuracy": 0.780}, -} - -# Cap simulated batches so large datasets don't stall the event loop -_MAX_SIMULATED_BATCHES = 250 - - -@dataclass -class ExecutionResult: - """Raw output from the execution engine, consumed by MetricsEngine.""" - latencies_ms: list[float] - total_images: int - vram_samples: list[float] - task_scores: dict[str, float] - telemetry_samples: list[TelemetrySample] = field(default_factory=list) - telemetry_summary: TelemetrySummary = field(default_factory=TelemetrySummary) - - -# Progress callback type: (progress_0_to_1, message, last_telemetry) → None -ProgressCallback = Callable[[float, str, TelemetrySample | None], Awaitable[None]] - - -class BenchmarkExecutor: - """ - Drives the benchmark execution loop. - Non-blocking: all sleeps are asyncio.sleep so other coroutines run freely. - """ - - async def execute( - self, - job: BenchmarkJob, - model: Model, - dataset: Dataset, - on_progress: ProgressCallback, - ) -> ExecutionResult: - hw = job.hardware - batch_sz = job.batch_size - - # Handle polymorphic input duration - is_live = getattr(job, "input_source", "dataset") in ("video", "live") - - if is_live: - # For live/video, we run for a fixed duration or until stopped - # Increase limit for a longer session (e.g., 10,000 batches) - total_img = 10000 * batch_sz - n_batches = 10000 - sim_batches = 10000 - else: - total_img = max(dataset.images, 100) # floor so simulation always runs - n_batches = math.ceil(total_img / batch_sz) - sim_batches = min(n_batches, _MAX_SIMULATED_BATCHES) - - vram_total = self._get_vram_gb(hw, model) - vram_frac = self._vram_usage_fraction(hw) - - telemetry = TelemetryCollector(hw, vram_total_gb=vram_total) - await telemetry.start() - - latencies: list[float] = [] - vram_samples: list[float] = [] - - base_lat_ms = self._base_batch_latency_ms(hw, model, batch_sz, job.precision) - - # Resolve real model path once (None → use simulation) - real_model_path = model.local_path if model.local_path and model.downloaded else None - use_real_inference = self._check_torch_available() and real_model_path is not None - loop = asyncio.get_event_loop() - - try: - for sim_idx in range(sim_batches): - # Map simulated index back to real batch index - real_idx = int(sim_idx * (n_batches / sim_batches)) - - if use_real_inference: - # Real GPU inference via torch_runner (runs in thread executor) - try: - from benchmark.torch_runner import run_torch_batch - batch_lat_ms = await loop.run_in_executor( - None, - run_torch_batch, - real_model_path, - batch_sz, - job.task, - ) - # Add a tiny sleep to prevent event loop starvation in live mode - if is_live: - await asyncio.sleep(0.001) - except Exception as exc: - log.warning("torch_inference_failed_fallback", error=str(exc)) - use_real_inference = False # fall back for remaining batches - batch_lat_ms = max( - 0.5, base_lat_ms + random.gauss(0, base_lat_ms * 0.07) - ) - else: - # Simulation path — non-blocking synthetic latency - batch_lat_ms = max( - 0.5, - base_lat_ms + random.gauss(0, base_lat_ms * 0.07), - ) - await asyncio.sleep(batch_lat_ms / 1000.0) # non-blocking - - latencies.append(batch_lat_ms) - vram_used = vram_total * random.uniform( - vram_frac - 0.05, vram_frac + 0.05 - ) - vram_samples.append(max(0.0, vram_used)) - - progress = (sim_idx + 1) / sim_batches - telemetry.record_batch_context(real_idx, progress) - - # Throttle callbacks: every 5 batches or first/last - if sim_idx % 5 == 0 or sim_idx == sim_batches - 1: - images_done = int(progress * total_img) - - # Generate simulated detection data for live preview if it's a vision task - live_data = {} - if job.task.lower() in ("detection", "segmentation"): - # Use provided bbox telemetry if available (e.g. from real inference) - # otherwise generate simulated ones - live_data["detections"] = [ - { - "x": random.uniform(0.1, 0.7), - "y": random.uniform(0.1, 0.7), - "width": random.uniform(0.1, 0.3), - "height": random.uniform(0.1, 0.3), - "label": random.choice(["person", "car", "bicycle", "dog"]), - "confidence": random.uniform(0.5, 0.99) - } - for _ in range(random.randint(1, 5)) - ] - - last_sample = telemetry.samples[-1] if telemetry.samples else None - if last_sample: - last_sample.live_data = live_data - # Explicitly broadcast detections for the visualizer - last_sample.detections = live_data.get("detections", []) - - await on_progress( - progress, - f"Batch {real_idx+1}/{n_batches} — " - f"{images_done}/{total_img} images processed", - last_sample, - ) - - finally: - telemetry_summary = await telemetry.stop() - # Attach simulated layer breakdown so Live Lab can display it - telemetry_summary.layer_breakdown = self._compute_layer_breakdown( - job.task, base_lat_ms - ) - - task_scores = self._simulate_task_scores(job.task, model, dataset) - - log.info( - "execution_complete", - job_id = job.id, - total_images = total_img, - sim_batches = sim_batches, - avg_lat_ms = round(sum(latencies) / len(latencies), 2) if latencies else 0, - ) - - return ExecutionResult( - latencies_ms = latencies, - total_images = total_img, - vram_samples = vram_samples, - task_scores = task_scores, - telemetry_samples = telemetry.samples, - telemetry_summary = telemetry_summary, - ) - - # ── Helpers ─────────────────────────────────────────────────────────────── - - def _base_batch_latency_ms( - self, - hardware: str, - model: Model, - batch_sz: int, - precision: str, - ) -> float: - """ - Estimate per-batch latency in ms. - Accounts for hardware tier, model size, batch size, and precision. - """ - hw_key = self._normalize_hw(hardware) - per_img = self._lookup_latency(hw_key) - - # Larger models are slower: +30% per GB of model weights - size_gb = max(model.size, 1) / (1024 ** 3) - size_factor = 1.0 + size_gb * 0.30 - - # Batch parallelism: ~65% linear efficiency on GPU, 90% on CPU - eff = 0.65 if "cpu" not in hw_key else 0.90 - batch_lat = per_img * size_factor * batch_sz * eff - - # Precision speedup - speedup = _PRECISION_SPEEDUP.get(precision.upper(), 1.0) - - return batch_lat / speedup - - def _get_vram_gb(self, hardware: str, model: Model) -> float: - hw_key = self._normalize_hw(hardware) - for key, vram in HARDWARE_VRAM_GB.items(): - if key and key in hw_key: - return vram - return 8.0 - - @staticmethod - def _vram_usage_fraction(hardware: str) -> float: - """Fraction of VRAM typically consumed during inference.""" - hw = hardware.lower() - if any(x in hw for x in ("4090", "3090", "a100", "h100")): - return 0.62 - if any(x in hw for x in ("4080", "3080", "v100", "a10")): - return 0.60 - if "cpu" in hw: - return 0.0 - return 0.55 - - @staticmethod - def _simulate_task_scores( - task: str, model: Model, dataset: Dataset - ) -> dict[str, float]: - """ - Produce realistic metric scores with small per-run variance. - - PRODUCTION SWAP: replace with actual metric computation: - from torchmetrics.detection import MeanAveragePrecision - metric = MeanAveragePrecision() - metric.update(predictions, targets) - return metric.compute() - """ - baselines = dict(_TASK_BASELINES.get(task.lower(), {"accuracy": 0.80})) - # Small Gaussian jitter simulates run-to-run variance - return { - k: float(max(0.0, min(1.0, v + random.gauss(0, 0.015)))) - for k, v in baselines.items() - } - - @staticmethod - def _check_torch_available() -> bool: - """Return True if PyTorch is installed and importable.""" - try: - import torch # noqa: F401 - return True - except ImportError: - return False - - @staticmethod - def _compute_layer_breakdown(task: str, base_lat_ms: float) -> list[LayerBreakdown]: - """Build a realistic layer breakdown for the given task. - - Splits total latency across architectural stages with small jitter. - PRODUCTION SWAP: replace with actual profiler data (e.g. torch.profiler). - """ - if task.lower() in ("detection", "segmentation"): - stages = [ - ("Backbone", 0.45), - ("Neck (FPN/PAFPN)", 0.30), - ("Detection Head", 0.20), - ("NMS Post-process", 0.05), - ] - elif task.lower() == "classification": - stages = [ - ("Feature Extractor", 0.70), - ("Classifier Head", 0.20), - ("Softmax", 0.10), - ] - else: - stages = [ - ("Encoder", 0.55), - ("Decoder / Head", 0.35), - ("Post-process", 0.10), - ] - - result: list[LayerBreakdown] = [] - remaining = base_lat_ms - for name, frac in stages: - t = round(base_lat_ms * frac + random.gauss(0, base_lat_ms * 0.01), 3) - result.append(LayerBreakdown(name=name, time_ms=t, percent=round(frac * 100, 1))) - return result - - @staticmethod - def _normalize_hw(hardware: str) -> str: - return ( - hardware.lower() - .replace(" ", "") - .replace("-", "") - .replace("_", "") - .replace("nvidia", "") - .replace("geforce", "") - ) - - @staticmethod - def _lookup_latency(hw_key: str) -> float: - for key, ms in _LATENCY_MS_PER_IMAGE.items(): - if key and key in hw_key: - return ms - if any(x in hw_key for x in ("gpu", "rtx", "gtx", "cuda")): - return _LATENCY_MS_PER_IMAGE["gpu"] - return _LATENCY_MS_PER_IMAGE["cpu"] diff --git a/benchmark/metrics.py b/benchmark/metrics.py deleted file mode 100644 index f80529e1cf8a754881bdadb3980f8e1915d336fb..0000000000000000000000000000000000000000 --- a/benchmark/metrics.py +++ /dev/null @@ -1,110 +0,0 @@ -""" -benchmark/metrics.py — Metrics Engine. - -Computes the final BenchmarkMetrics object from raw execution data: - - Latency statistics (mean, p95, p99) - - Throughput (FPS) - - VRAM statistics (avg, peak) - - Task-specific scores (mAP, accuracy, IoU) supplied by the executor - -In a production deployment the task_scores dict comes from actual -metric computation (e.g. pycocotools, torchmetrics). In this local-first -build the executor supplies realistic simulated scores. -""" -from __future__ import annotations - -import statistics - -from models.benchmark import BenchmarkMetrics, LayerBreakdown, TelemetrySummary -from observability.logger import get_logger - -log = get_logger("benchmark.metrics") - - -class MetricsEngine: - """Computes BenchmarkMetrics from raw benchmark execution data.""" - - def compute( - self, - *, - task: str, - latencies_ms: list[float], # per-batch latencies - total_images: int = 0, - total_tokens: int = 0, - batch_size: int, - vram_samples: list[float], # VRAM readings (GB) during run - task_scores: dict[str, float], # task-specific metric scores - ) -> BenchmarkMetrics: - if not latencies_ms: - return BenchmarkMetrics(total_images=total_images, total_tokens=total_tokens, batch_size=batch_size) - - total_time_s = sum(latencies_ms) / 1000.0 - fps = total_images / total_time_s if total_time_s > 0 and total_images > 0 else 0.0 - tps = total_tokens / total_time_s if total_time_s > 0 and total_tokens > 0 else 0.0 - - lat_mean = statistics.mean(latencies_ms) - lat_p95 = _percentile(latencies_ms, 0.95) - lat_p99 = _percentile(latencies_ms, 0.99) - - vram_peak = max(vram_samples) if vram_samples else 0.0 - vram_avg = statistics.mean(vram_samples) if vram_samples else 0.0 - - m = BenchmarkMetrics( - fps = round(fps, 2), - tokens_per_sec = round(tps, 2), - latency_mean_ms = round(lat_mean, 3), - latency_p95_ms = round(lat_p95, 3), - latency_p99_ms = round(lat_p99, 3), - vram_peak_gb = round(vram_peak, 3), - vram_avg_gb = round(vram_avg, 3), - total_images = total_images, - total_tokens = total_tokens, - batch_size = batch_size, - ) - - task_lower = task.lower() - - # CV Task Mapping - if task_lower in ("detection", "segmentation", "keypoints"): - m.mAP = _fmt(task_scores.get("mAP", 0.0)) - m.mAP_50 = _fmt(task_scores.get("mAP_50", 0.0)) - m.mAP_50_95 = _fmt(task_scores.get("mAP_50_95", 0.0)) - if task_lower == "segmentation": - m.iou_mean = _fmt(task_scores.get("iou_mean", 0.0)) - - elif task_lower == "classification": - m.accuracy = _fmt(task_scores.get("accuracy", 0.0)) - m.top1 = _fmt(task_scores.get("top1", 0.0)) - m.top5 = _fmt(task_scores.get("top5", 0.0)) - - # NLP Task Mapping (ROUGE, BLEU, Perplexity) - elif task_lower in ("nlp", "generation"): - m.accuracy = _fmt(task_scores.get("accuracy", 0.0)) - m.rouge_l = _fmt(task_scores.get("rouge_l", task_scores.get("rougeL", 0.0))) - m.bleu = _fmt(task_scores.get("bleu", 0.0)) - m.perplexity = task_scores.get("perplexity") - - log.info( - "metrics_computed", - task = task, - fps = m.fps, - tps = m.tokens_per_sec, - latency_ms = m.latency_mean_ms, - vram_peak = m.vram_peak_gb, - ) - return m - - -# ── Helpers ─────────────────────────────────────────────────────────────────── - -def _percentile(data: list[float], p: float) -> float: - if not data: - return 0.0 - s = sorted(data) - idx = min(int(len(s) * p), len(s) - 1) - return s[idx] - - -def _fmt(v: float) -> float: - """Round to 4dp and clamp to [0, 1].""" - return round(max(0.0, min(1.0, v)), 4) diff --git a/benchmark/orchestrator.py b/benchmark/orchestrator.py deleted file mode 100644 index b7fcef70f2d048a35db59e93ab98eb9703279f8e..0000000000000000000000000000000000000000 --- a/benchmark/orchestrator.py +++ /dev/null @@ -1,374 +0,0 @@ -""" -benchmark/orchestrator.py — Benchmark Orchestrator (Main Controller). - -Coordinates the full benchmark lifecycle: - 1. Resolve model + dataset from their registries - 2. Run all compatibility checks (gates A–E) - 3. If valid → create a BenchmarkJob in the DB - 4. Persist the validation audit log - 5. Enqueue async background task → execution → metrics → storage - 6. Return the job immediately so callers are non-blocking - -Public interface used by api/routes/benchmark.py: - validate_context(ctx) → ValidationReport (no job created) - create_and_run(ctx) → BenchmarkJob (job queued, execution in background) -""" -from __future__ import annotations - -import asyncio -from datetime import datetime, timezone - -from benchmark.adapters.registry import get_executor -from benchmark.compatibility import CompatibilityValidator -from benchmark.execution import BenchmarkExecutor -from benchmark.metrics import MetricsEngine -import benchmark.registry as bench_reg -from datasets.registry import get_dataset -from models.benchmark import ( - BenchmarkContext, - BenchmarkJob, - BenchmarkMetrics, - TelemetrySummary, - ValidationReport, -) -from models.dataset import Dataset -from models.model import Model -from observability.logger import audit, get_logger -from registry.registry import get_model - -log = get_logger("benchmark.orchestrator") - -# Module-level singletons — stateless, safe to share -_validator = CompatibilityValidator() -_metrics = MetricsEngine() - -# job_id → asyncio.Task (for future cancellation support) -_active_tasks: dict[str, asyncio.Task] = {} - - -# ── Public API ──────────────────────────────────────────────────────────────── - -async def sync_project_benchmarks() -> int: - """ - Sync benchmark jobs and results from the active project's 'benchmarks' folder. - This ensures that benchmarks created in different sessions or projects are indexed. - """ - from benchmark.registry import _get_active_project_benchmark_dir_sync - from projects.service import get_active_project_path - import json - import os - from database.connection import get_db - - project_path = await get_active_project_path() - benchmark_dir = _get_active_project_benchmark_dir_sync(project_path) - if not benchmark_dir or not benchmark_dir.exists(): - return 0 - - db = await get_db() - count = 0 - - for file_path in benchmark_dir.glob("*.json"): - try: - with open(file_path, "r") as f: - data = json.load(f) - - # Check if it's a job or a result - if file_path.name.startswith("job_"): - # Upsert into benchmark_jobs - await db.execute( - """INSERT OR IGNORE INTO benchmark_jobs - (id, model_id, dataset_id, task, framework, hardware, - precision, batch_size, config, status, progress, created_at, updated_at, started_at) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)""", - ( - data["id"], data["model_id"], data["dataset_id"], - data["task"], data["framework"], data["hardware"], - data["precision"], data["batch_size"], - json.dumps(data["config"]), data["status"], - data.get("progress", 0.0), - data.get("created_at", datetime.now(timezone.utc).isoformat()), - data.get("updated_at", datetime.now(timezone.utc).isoformat()), - data.get("started_at") - ) - ) - count += 1 - elif file_path.name.startswith("result_"): - # Upsert into benchmark_results - await db.execute( - """INSERT OR IGNORE INTO benchmark_results - (id, job_id, metrics, telemetry_summary, created_at) - VALUES (?,?,?,?,?)""", - ( - data["id"], data["job_id"], - json.dumps(data["metrics"]), - json.dumps(data["telemetry_summary"]), - data.get("created_at", datetime.now(timezone.utc).isoformat()) - ) - ) - count += 1 - except Exception as e: - log.error("sync_file_failed", file=file_path.name, error=str(e)) - - await db.commit() - log.info("sync_complete", count=count) - return count - -async def validate_context(ctx: BenchmarkContext) -> ValidationReport: - """ - Validate model ↔ dataset ↔ hardware compatibility. - Does NOT create a job. Safe to call repeatedly from the UI. - """ - model = await _require_model(ctx.model_id) - - # ── Handle Polymorphic Input (Video/Live) ──────────────────────────────── - if ctx.input_source in ["video", "live"] or ctx.dataset_id == "none": - # Create a synthetic dataset object for non-dataset sources - now = datetime.now(timezone.utc).isoformat() - dataset = Dataset( - id="none", - name="Live/Video Stream", - task=model.task, # Match model task to pass task check - format="custom", - source="local", - status="imported", - images=0, - classes=0, - size_label="0 MB", - created_at=now, - updated_at=now - ) - else: - dataset = await _require_dataset(ctx.dataset_id) - - return _validator.validate(model, dataset, ctx) - - -async def create_and_run(ctx: BenchmarkContext) -> BenchmarkJob: - """ - Full benchmark initiation: - """ - model = await _require_model(ctx.model_id) - - # ── Handle Polymorphic Input (Video/Live) ──────────────────────────────── - if ctx.input_source in ["video", "live"] or ctx.dataset_id == "none": - now = datetime.now(timezone.utc).isoformat() - dataset = Dataset( - id="none", - name="Live/Video Stream", - task=model.task, - format="custom", - source="local", - status="imported", - images=0, - classes=0, - size_label="0 MB", - created_at=now, - updated_at=now - ) - else: - dataset = await _require_dataset(ctx.dataset_id) - - # ── Compatibility check ─────────────────────────────────────────────────── - report = _validator.validate(model, dataset, ctx) - - # Always persist the validation log (even for failures) - await bench_reg.save_validation_log( - job_id = "pre-check", - model_id = ctx.model_id, - dataset_id = ctx.dataset_id, - checks = report.checks, - passed = report.passed, - ) - - if not report.passed: - from fastapi import HTTPException - failed = [c for c in report.checks if not c.passed] - raise HTTPException( - status_code = 422, - detail = { - "error": "Compatibility validation failed", - "failed_checks": [ - { - "name": c.name, - "detail": c.detail, - "suggestion": c.suggestion, - } - for c in failed - ], - }, - ) - - # ── Create job ──────────────────────────────────────────────────────────── - job = await bench_reg.create_job(ctx) - - # Overwrite 'pre-check' validation log with the real job_id - await bench_reg.save_validation_log( - job_id = job.id, - model_id = ctx.model_id, - dataset_id = ctx.dataset_id, - checks = report.checks, - passed = True, - ) - - # ── Log the Polymorphic Input params ───────────────────────────────────── - if ctx.input_source or ctx.video_path or ctx.rtsp_url: - log.info("polymorphic_input_received", - job_id=job.id, - source=ctx.input_source, - video=ctx.video_path, - rtsp=ctx.rtsp_url) - - # ── Enqueue background execution ────────────────────────────────────────── - task = asyncio.create_task( - _execute_job(job.id, ctx, model, dataset), - name = f"benchmark_{job.id}", - ) - _active_tasks[job.id] = task - task.add_done_callback(lambda _t: _active_tasks.pop(job.id, None)) - - log.info("benchmark_enqueued", job_id=job.id, model=ctx.model_id) - return job - - -# ── Background execution ────────────────────────────────────────────────────── - -async def _execute_job( - job_id: str, - ctx: BenchmarkContext, - model: Model, - dataset: Dataset, -) -> None: - """Full benchmark lifecycle — runs in an asyncio background task.""" - now = datetime.now(timezone.utc).isoformat() - - # Transition → running - ts_color = "\x1b[36m" # Cyan - info_color = "\x1b[34m" # Blue - success_color = "\x1b[32m" # Green - reset = "\x1b[0m" - - await bench_reg.update_job( - job_id, - status = "running", - progress = 0.0, - started_at = now, - log_entry = f"{ts_color}[{now}]{reset} {info_color}Job started{reset} on {ctx.hardware} ({ctx.precision})", - ) - - runner = BenchmarkExecutor() - - try: - # ── Fetch the persisted job (for executor) ──────────────────────────── - job = await bench_reg.get_job(job_id) - assert job is not None, "Job disappeared from DB after creation" - - # ── Define Progress Callback ────────────────────────────────────────── - async def on_progress(progress: float, message: str, telemetry: Any | None): - await bench_reg.update_job( - job_id, - progress=progress, - log_entry=f"{ts_color}[{datetime.now(timezone.utc).isoformat()}]{reset} {info_color}{message}{reset}", - last_telemetry=telemetry.model_dump() if telemetry and hasattr(telemetry, "model_dump") else telemetry - ) - - # ── Execution Loop ──────────────────────────────────────────────────── - exec_result = await runner.execute( - job=job, - model=model, - dataset=dataset, - on_progress=on_progress - ) - - # ── Compute metrics ─────────────────────────────────────────────────── - metrics = _metrics.compute( - task = ctx.task, - latencies_ms = exec_result.latencies_ms, - total_images = exec_result.total_images, - batch_size = ctx.batch_size, - vram_samples = exec_result.vram_samples, - task_scores = exec_result.task_scores, - ) - - # ── Persist result ──────────────────────────────────────────────────── - await bench_reg.save_result( - job_id = job_id, - metrics = metrics, - telemetry_summary = exec_result.telemetry_summary, - ) - - ended = datetime.now(timezone.utc).isoformat() - await bench_reg.update_job( - job_id, - status = "completed", - progress = 1.0, - ended_at = ended, - log_entry = f"{ts_color}[{ended}]{reset} {success_color}Benchmark completed{reset} — {metrics.fps} FPS", - ) - - await audit( - "benchmark_completed", - job_id = job_id, - payload = {"model_id": ctx.model_id, "dataset_id": ctx.dataset_id}, - ) - log.info( - "benchmark_completed", - job_id = job_id, - fps = metrics.fps, - lat_ms = metrics.latency_mean_ms, - ) - - except asyncio.CancelledError: - # Task cancelled externally (e.g. server shutdown) — don't swallow - ended = datetime.now(timezone.utc).isoformat() - await bench_reg.update_job( - job_id, - status = "failed", - error = "Job cancelled", - ended_at = ended, - log_entry = f"{ts_color}[{ended}]{reset} \x1b[31mJob cancelled\x1b[0m", - ) - raise - - except Exception as exc: - ended = datetime.now(timezone.utc).isoformat() - err_msg = str(exc) - error_color = "\x1b[31m" # Red - await bench_reg.update_job( - job_id, - status = "failed", - error = err_msg, - ended_at = ended, - log_entry = f"{ts_color}[{ended}]{reset} {error_color}ERROR: {err_msg}{reset}", - ) - await audit( - "benchmark_failed", - job_id = job_id, - level = "error", - payload = {"error": err_msg, "model_id": ctx.model_id}, - ) - log.exception("benchmark_failed", job_id=job_id) - finally: - pass - -# ── Resource resolvers ──────────────────────────────────────────────────────── - -async def _require_model(model_id: str) -> Model: - model = await get_model(model_id) - if not model: - from fastapi import HTTPException - raise HTTPException( - status_code = 404, - detail = f"Model '{model_id}' not found in Model Zoo", - ) - return model - - -async def _require_dataset(dataset_id: str) -> Dataset: - dataset = await get_dataset(dataset_id) - if not dataset: - from fastapi import HTTPException - raise HTTPException( - status_code = 404, - detail = f"Dataset '{dataset_id}' not found in Dataset Manager", - ) - return dataset diff --git a/benchmark/registry.py b/benchmark/registry.py deleted file mode 100644 index ef02ea0cd927b2358611301aea64d9f7c4cd1746..0000000000000000000000000000000000000000 --- a/benchmark/registry.py +++ /dev/null @@ -1,302 +0,0 @@ -""" -benchmark/registry.py — Benchmark Registry. - -All DB interactions for: - • benchmark_jobs — job lifecycle state - • benchmark_results — final metrics + telemetry summary - • benchmark_validation_logs — immutable check audit trail - -Follows the same pattern as registry/registry.py and datasets/registry.py. -No direct DB access from other benchmark modules — everything routes here. -""" -from __future__ import annotations - -import json -import uuid -from datetime import datetime, timezone -from typing import Any -from pathlib import Path - -from database.connection import get_db -from models.benchmark import ( - BenchmarkContext, - BenchmarkJob, - BenchmarkMetrics, - BenchmarkResult, - TelemetrySummary, - ValidationCheck, - row_to_job, - row_to_result, -) -from observability.logger import get_logger - -log = get_logger("benchmark.registry") - - -def _get_active_project_benchmark_dir_sync(project_path: str | None) -> Path | None: - """Get the absolute path to the 'benchmarks' folder in a given project path.""" - if not project_path: - return None - - benchmark_dir = Path(project_path) / "benchmarks" - benchmark_dir.mkdir(parents=True, exist_ok=True) - return benchmark_dir - -async def _get_active_project_benchmark_dir() -> Path | None: - """Get the absolute path to the 'benchmarks' folder in the active project.""" - from projects.service import get_active_project_path - project_path = await get_active_project_path() - return _get_active_project_benchmark_dir_sync(project_path) - -async def _save_to_project(filename: str, data: dict) -> None: - """Save data to a JSON file in the active project's benchmark folder.""" - benchmark_dir = await _get_active_project_benchmark_dir() - if not benchmark_dir: - return - - file_path = benchmark_dir / filename - try: - with open(file_path, "w") as f: - json.dump(data, f, indent=2) - except Exception as e: - log.error("project_persistence_failed", error=str(e), file=filename) - -# ── Job CRUD ────────────────────────────────────────────────────────────────── - -async def create_job(ctx: BenchmarkContext) -> BenchmarkJob: - db = await get_db() - job_id = f"bmark-{uuid.uuid4().hex[:12]}" - now = datetime.now(timezone.utc).isoformat() - - # Create job object - job = BenchmarkJob( - id = job_id, - model_id = ctx.model_id, - dataset_id = ctx.dataset_id, - task = ctx.task, - framework = ctx.framework, - hardware = ctx.hardware, - precision = ctx.precision, - batch_size = ctx.batch_size, - config = ctx.model_dump(), - status = "queued", - progress = 0.0, - created_at = now, - updated_at = now, - ) - - # Persist to SQLite - await db.execute( - """INSERT INTO benchmark_jobs - (id, model_id, dataset_id, task, framework, hardware, - precision, batch_size, config, - status, progress, logs, created_at, updated_at) - VALUES (?,?,?,?,?,?,?,?,?,'queued',0.0,'[]',?,?)""", - ( - job_id, - ctx.model_id, ctx.dataset_id, - ctx.task, ctx.framework, ctx.hardware, - ctx.precision, ctx.batch_size, - json.dumps(ctx.model_dump()), - now, now, - ), - ) - await db.commit() - - # Persist to project folder - await _save_to_project(f"job_{job_id}.json", job.model_dump()) - - log.info("benchmark_job_created", job_id=job_id, model=ctx.model_id) - return job - - -async def get_job(job_id: str) -> BenchmarkJob | None: - db = await get_db() - async with db.execute( - "SELECT * FROM benchmark_jobs WHERE id = ?", (job_id,) - ) as cur: - row = await cur.fetchone() - return row_to_job(row) if row else None - - -async def list_jobs( - *, - status: str | None = None, - model_id: str | None = None, - limit: int = 100, -) -> list[BenchmarkJob]: - db = await get_db() - clauses: list[str] = [] - params: list[Any] = [] - - if status: - clauses.append("status = ?") - params.append(status) - if model_id: - clauses.append("model_id = ?") - params.append(model_id) - - where = f"WHERE {' AND '.join(clauses)}" if clauses else "" - params.append(limit) - - async with db.execute( - f"SELECT * FROM benchmark_jobs {where} ORDER BY created_at DESC LIMIT ?", - params, - ) as cur: - rows = await cur.fetchall() - return [row_to_job(r) for r in rows] - - -async def update_job( - job_id: str, - *, - status: str | None = None, - progress: float | None = None, - error: str | None = None, - started_at: str | None = None, - ended_at: str | None = None, - log_entry: str | None = None, - last_telemetry: dict | None = None, -) -> None: - """Update mutable fields on a benchmark job atomically.""" - db = await get_db() - now = datetime.now(timezone.utc).isoformat() - - sets: list[str] = ["updated_at = ?"] - vals: list[Any] = [now] - - if status is not None: - sets.append("status = ?"); vals.append(status) - if progress is not None: - sets.append("progress = ?"); vals.append(round(progress, 4)) - if error is not None: - sets.append("error = ?"); vals.append(error) - if started_at is not None: - sets.append("started_at = ?"); vals.append(started_at) - if ended_at is not None: - sets.append("ended_at = ?"); vals.append(ended_at) - if last_telemetry is not None: - sets.append("last_telemetry = ?"); vals.append(json.dumps(last_telemetry)) - - if log_entry is not None: - # Append new entry to the JSON log array (capped at 500 lines) - async with db.execute( - "SELECT logs FROM benchmark_jobs WHERE id = ?", (job_id,) - ) as cur: - row = await cur.fetchone() - existing = json.loads(row["logs"]) if row and row["logs"] else [] - existing.append(log_entry) - sets.append("logs = ?") - vals.append(json.dumps(existing[-500:])) - - vals.append(job_id) - # Persist to project folder if we have the job info - async with db.execute("SELECT * FROM benchmark_jobs WHERE id = ?", (job_id,)) as cur: - row = await cur.fetchone() - if row: - job = row_to_job(row) - if job: - await _save_to_project(f"job_{job_id}.json", job.model_dump()) - - await db.commit() - - -# ── Result CRUD ─────────────────────────────────────────────────────────────── - -async def save_result( - *, - job_id: str, - metrics: BenchmarkMetrics, - telemetry_summary: TelemetrySummary, -) -> BenchmarkResult: - db = await get_db() - result_id = f"bres-{uuid.uuid4().hex[:12]}" - now = datetime.now(timezone.utc).isoformat() - - # Persist result to SQLite - await db.execute( - """INSERT INTO benchmark_results - (id, job_id, metrics, telemetry_summary, created_at) - VALUES (?,?,?,?,?)""", - ( - result_id, - job_id, - json.dumps(metrics.model_dump(exclude_none=True)), - json.dumps(telemetry_summary.model_dump()), - now, - ), - ) - await db.commit() - - result = BenchmarkResult( - id = result_id, - job_id = job_id, - metrics = metrics, - telemetry_summary = telemetry_summary, - created_at = now, - ) - - # Persist result to project folder - await _save_to_project(f"result_{job_id}.json", result.model_dump()) - - log.info("benchmark_result_saved", job_id=job_id, result_id=result_id) - return result - - -async def get_result(job_id: str) -> BenchmarkResult | None: - db = await get_db() - async with db.execute( - """SELECT r.*, j.model_id, j.dataset_id, j.task, j.framework, j.hardware, j.precision - FROM benchmark_results r - JOIN benchmark_jobs j ON r.job_id = j.id - WHERE r.job_id = ?""", (job_id,) - ) as cur: - row = await cur.fetchone() - return row_to_result(row) if row else None - - -async def list_results(*, limit: int = 100) -> list[BenchmarkResult]: - db = await get_db() - async with db.execute( - """SELECT r.*, j.model_id, j.dataset_id, j.task, j.framework, j.hardware, j.precision - FROM benchmark_results r - JOIN benchmark_jobs j ON r.job_id = j.id - ORDER BY r.created_at DESC LIMIT ?""", (limit,) - ) as cur: - rows = await cur.fetchall() - return [row_to_result(r) for r in rows] - - -# ── Validation Log ──────────────────────────────────────────────────────────── - -async def save_validation_log( - *, - job_id: str, - model_id: str, - dataset_id: str, - checks: list[ValidationCheck], - passed: bool, -) -> None: - """Persist an immutable record of all compatibility checks.""" - db = await get_db() - log_id = f"bval-{uuid.uuid4().hex[:12]}" - now = datetime.now(timezone.utc).isoformat() - - await db.execute( - """INSERT INTO benchmark_validation_logs - (id, job_id, model_id, dataset_id, checks, passed, created_at) - VALUES (?,?,?,?,?,?,?)""", - ( - log_id, job_id, model_id, dataset_id, - json.dumps([c.model_dump() for c in checks]), - 1 if passed else 0, - now, - ), - ) - await db.commit() - log.info( - "validation_log_saved", - job_id = job_id, - passed = passed, - n_checks = len(checks), - ) diff --git a/benchmark/telemetry.py b/benchmark/telemetry.py deleted file mode 100644 index cee6cd1202b1d38fdb3de66903382fe7d9cac7b5..0000000000000000000000000000000000000000 --- a/benchmark/telemetry.py +++ /dev/null @@ -1,182 +0,0 @@ -""" -benchmark/telemetry.py — Real-time Telemetry Collector. - -Collects GPU/hardware metrics at 2 Hz during benchmark execution. -Designed as a drop-in adapter: - • Local dev → simulates realistic GPU readings based on hardware tier - • Production → replace _read_gpu_metrics() with pynvml calls: - nvmlDeviceGetUtilizationRates() - nvmlDeviceGetMemoryInfo() - nvmlDeviceGetTemperature() - nvmlDeviceGetPowerUsage() - -Usage (async context): - collector = TelemetryCollector("rtx4090", vram_total_gb=24.0) - await collector.start() - # ... run inference ... - summary = await collector.stop() - samples = collector.samples -""" -from __future__ import annotations - -import asyncio -import random -import statistics -import time - -from models.benchmark import TelemetrySample, TelemetrySummary -from observability.logger import get_logger - -log = get_logger("benchmark.telemetry") - -# ── Hardware simulation profiles ────────────────────────────────────────────── -# (base_util%, base_temp_C, base_power_W) -_HW_PROFILES: dict[str, tuple[float, float, float]] = { - "rtx4090": (88.0, 74.0, 380.0), - "rtx4080": (84.0, 70.0, 280.0), - "rtx4070": (80.0, 68.0, 200.0), - "rtx3090": (85.0, 72.0, 320.0), - "rtx3080": (82.0, 70.0, 250.0), - "rtx3070": (78.0, 66.0, 180.0), - "rtx3060": (74.0, 64.0, 150.0), - "a100": (90.0, 68.0, 350.0), - "h100": (92.0, 65.0, 550.0), - "v100": (87.0, 70.0, 280.0), - "t4": (75.0, 62.0, 60.0), - "gpu": (70.0, 65.0, 150.0), - "cpu": (0.0, 0.0, 0.0), -} - -_COLLECTION_INTERVAL_S = 0.5 # 2 Hz - - -class TelemetryCollector: - """ - Async telemetry collector. Call start() before inference, stop() after. - Thread-safe via asyncio (single-threaded event loop). - """ - - def __init__(self, hardware: str, vram_total_gb: float = 8.0) -> None: - self._hardware = hardware - self._vram_total = vram_total_gb - self._hw_profile = self._resolve_profile(hardware) - self._samples: list[TelemetrySample] = [] - self._running = False - self._task: asyncio.Task | None = None - - # ── Public API ──────────────────────────────────────────────────────────── - - async def start(self) -> None: - self._running = True - self._samples = [] - self._task = asyncio.create_task( - self._collect_loop(), name="telemetry_collector" - ) - log.debug("telemetry_started", hardware=self._hardware) - - async def stop(self) -> TelemetrySummary: - self._running = False - if self._task and not self._task.done(): - self._task.cancel() - try: - await self._task - except asyncio.CancelledError: - pass - log.debug( - "telemetry_stopped", - hardware = self._hardware, - samples = len(self._samples), - ) - return self._build_summary() - - def record_batch_context(self, batch_idx: int, progress: float) -> None: - """Annotate the most recent sample with the current batch context.""" - if self._samples: - self._samples[-1].batch_idx = batch_idx - self._samples[-1].progress = progress - - @property - def samples(self) -> list[TelemetrySample]: - return list(self._samples) - - # ── Internal ────────────────────────────────────────────────────────────── - - async def _collect_loop(self) -> None: - while self._running: - sample = self._read_gpu_metrics() - self._samples.append(sample) - await asyncio.sleep(_COLLECTION_INTERVAL_S) - - def _read_gpu_metrics(self) -> TelemetrySample: - """ - Returns a TelemetrySample for the current hardware state. - - PRODUCTION SWAP: Replace this body with pynvml calls: - handle = nvmlDeviceGetHandleByIndex(0) - util = nvmlDeviceGetUtilizationRates(handle) - mem = nvmlDeviceGetMemoryInfo(handle) - temp = nvmlDeviceGetTemperature(handle, NVML_TEMPERATURE_GPU) - power = nvmlDeviceGetPowerUsage(handle) / 1000 # mW → W - """ - base_util, base_temp, base_power = self._hw_profile - - if base_util == 0.0: # CPU path — no meaningful GPU readings - return TelemetrySample( - timestamp = time.time(), - gpu_util_pct = 0.0, - vram_used_gb = 0.0, - vram_total_gb = 0.0, - temp_c = 0.0, - power_w = 0.0, - ) - - # Simulate realistic jitter (±5% util, ±3°C, ±10W) - jitter_util = random.gauss(0, 3.0) - jitter_temp = random.gauss(0, 1.5) - jitter_power = random.gauss(0, 8.0) - vram_frac = random.uniform(0.58, 0.72) - - return TelemetrySample( - timestamp = time.time(), - gpu_util_pct = max(0.0, min(100.0, base_util + jitter_util)), - vram_used_gb = round( - max(0.0, min(self._vram_total, self._vram_total * vram_frac)), 3 - ), - vram_total_gb = self._vram_total, - temp_c = round(max(0.0, base_temp + jitter_temp), 1), - power_w = round(max(0.0, base_power + jitter_power), 1), - ) - - def _build_summary(self) -> TelemetrySummary: - if not self._samples: - return TelemetrySummary() - - utils = [s.gpu_util_pct for s in self._samples] - vrams = [s.vram_used_gb for s in self._samples] - temps = [s.temp_c for s in self._samples] - powers = [s.power_w for s in self._samples] - - def _safe_mean(lst: list[float]) -> float: - return statistics.mean(lst) if lst else 0.0 - - return TelemetrySummary( - gpu_util_avg = round(_safe_mean(utils), 2), - gpu_util_peak = round(max(utils), 2), - vram_avg_gb = round(_safe_mean(vrams), 3), - vram_peak_gb = round(max(vrams), 3), - temp_avg_c = round(_safe_mean(temps), 1), - temp_peak_c = round(max(temps), 1), - power_avg_w = round(_safe_mean(powers), 1), - power_peak_w = round(max(powers), 1), - ) - - @staticmethod - def _resolve_profile(hardware: str) -> tuple[float, float, float]: - hw = hardware.lower().replace(" ", "").replace("-", "") - for key, profile in _HW_PROFILES.items(): - if key in hw: - return profile - # Default for unknown GPU-class hardware - if any(x in hw for x in ("gpu", "rtx", "gtx", "cuda", "vram")): - return _HW_PROFILES["gpu"] - return _HW_PROFILES["cpu"] diff --git a/benchmark/torch_runner.py b/benchmark/torch_runner.py deleted file mode 100644 index 56ad3ca22d19e5497875d800f2a1bc243fe40df5..0000000000000000000000000000000000000000 --- a/benchmark/torch_runner.py +++ /dev/null @@ -1,142 +0,0 @@ -""" -benchmark/torch_runner.py — Synchronous GPU inference runner. - -Called from BenchmarkExecutor via asyncio.run_in_executor() so it never -blocks the event loop. PyTorch is an optional dependency — if it is not -installed the module raises ImportError and execution.py falls back to -the simulation path. - -Supported weight formats (detected by file extension): - .pt / .pth — torch.load (TorchScript or state-dict) - .safetensors — safetensors.torch.load_file - .onnx — onnxruntime InferenceSession - -PRODUCTION SWAP POINTS are marked with # <<< REPLACE IN PRODUCTION >>> -""" -from __future__ import annotations - -import time -from pathlib import Path -from typing import Any - -# ── Model cache (keyed by absolute path) ───────────────────────────────────── -_MODEL_CACHE: dict[str, Any] = {} - -# Standard input shapes per task (B, C, H, W) -_INPUT_SHAPES: dict[str, tuple[int, int, int]] = { - "detection": (3, 640, 640), - "segmentation": (3, 640, 640), - "classification": (3, 224, 224), - "generation": (3, 512, 512), - "embedding": (3, 224, 224), -} -_DEFAULT_SHAPE = (3, 640, 640) - - -def run_torch_batch(model_path: str, batch_size: int, task: str = "detection") -> float: - """Run one inference batch and return per-image latency in ms. - - Args: - model_path: Absolute path to the weight file. - batch_size: Number of images in the batch. - task: Model task (affects dummy input shape). - - Returns: - Latency per image in milliseconds. - """ - import torch # raises ImportError if not installed - - device = "cuda" if torch.cuda.is_available() else "cpu" - ext = Path(model_path).suffix.lower() - - model = _load_model(model_path, ext, device) - c, h, w = _INPUT_SHAPES.get(task, _DEFAULT_SHAPE) - dummy = torch.zeros(batch_size, c, h, w, device=device) - - # Warm-up pass (first call is slower due to CUDA kernel compilation) - if device == "cuda": - with torch.no_grad(): - _forward(model, dummy, ext, device) - torch.cuda.synchronize() - - # Timed pass - if device == "cuda": - torch.cuda.synchronize() - t0 = time.perf_counter() - with torch.no_grad(): - _forward(model, dummy, ext, device) - if device == "cuda": - torch.cuda.synchronize() - elapsed_ms = (time.perf_counter() - t0) * 1000 - - return elapsed_ms / batch_size - - -def _load_model(path: str, ext: str, device: str) -> Any: - """Load and cache the model by absolute path.""" - if path in _MODEL_CACHE: - return _MODEL_CACHE[path] - - model = _load_by_ext(path, ext, device) - _MODEL_CACHE[path] = model - return model - - -def _load_by_ext(path: str, ext: str, device: str) -> Any: - """Select loader based on file extension.""" - if ext in (".pt", ".pth"): - return _load_torch(path, device) - if ext == ".safetensors": - return _load_safetensors(path, device) - if ext == ".onnx": - return _load_onnx(path) - raise ValueError(f"Unsupported model format: {ext}") - - -def _load_torch(path: str, device: str) -> Any: - import torch - # <<< REPLACE IN PRODUCTION >>> with proper model class instantiation - # TorchScript models can be loaded directly; state-dict models need - # the model class to be imported separately. - try: - model = torch.jit.load(path, map_location=device) - model.eval() - return model - except RuntimeError: - # Not a TorchScript model — try loading as a full checkpoint - obj = torch.load(path, map_location=device, weights_only=False) - if hasattr(obj, "eval"): - obj.eval() - return obj - # It's a state-dict — we cannot run inference without knowing the arch - raise RuntimeError( - f"Model at {path} is a state-dict; cannot run inference without " - "the model class. Use a TorchScript-exported .pt file." - ) - - -def _load_safetensors(path: str, device: str) -> Any: - # <<< REPLACE IN PRODUCTION >>> safetensors gives tensors only; - # you still need the model class. This is intentionally left as a - # placeholder that raises a clear error rather than silently failing. - raise NotImplementedError( - "safetensors inference requires the model class to be registered. " - "Convert to TorchScript or ONNX for architecture-agnostic inference." - ) - - -def _load_onnx(path: str) -> Any: - import onnxruntime as ort # type: ignore[import] - providers = ["CUDAExecutionProvider", "CPUExecutionProvider"] - return ort.InferenceSession(path, providers=providers) - - -def _forward(model: Any, dummy: Any, ext: str, device: str) -> Any: - """Run a single forward pass, dispatching by model type.""" - if ext == ".onnx": - import numpy as np - np_input = dummy.cpu().numpy() - input_name = model.get_inputs()[0].name - return model.run(None, {input_name: np_input}) - # TorchScript / nn.Module - return model(dummy) diff --git a/config.py b/config.py index f632171ee65a51b00b76deaf8a4f2e24d63a5350..35f139c5e5f7cc9546e2344bfe9fbf32acde5b53 100644 --- a/config.py +++ b/config.py @@ -21,31 +21,15 @@ class Settings(BaseSettings): # ── API ─────────────────────────────────────────────────────────── host: str = "0.0.0.0" port: int = 7860 # Default for HF Spaces - cors_origins: list[str] = [ - "http://localhost:3000", - "http://127.0.0.1:3000", - "http://localhost:5173", - "http://127.0.0.1:5173", - "http://localhost:2000", - "http://127.0.0.1:2000", - ] + cors_origins: list[str] = ["*"] # ── Storage ─────────────────────────────────────────────────────── base_dir: Path = Path(__file__).resolve().parents[1] data_dir: Path = base_dir / "data" - models_dir: Path = data_dir / "models" - datasets_dir: Path = data_dir / "datasets" # root for imported datasets - logs_dir: Path = data_dir / "logs" - db_path: Path = data_dir / "modelzoo.db" - - # ── Download Manager ────────────────────────────────────────────── - max_concurrent_downloads: int = 5 - download_chunk_size: int = 1024 * 1024 # 1 MB - download_max_retries: int = 3 - download_retry_delay: float = 2.0 # seconds (base, exponential backoff) + db_path: Path = data_dir / "modelzoo.db" # ── Search ──────────────────────────────────────────────────────── - search_max_results: int = 500 + search_max_results: int = 1000 # ── Sync ────────────────────────────────────────────────────────── auto_sync_on_startup: bool = True @@ -54,30 +38,10 @@ class Settings(BaseSettings): hf_api_base: str = "https://huggingface.co/api" hf_hub_url: str = "https://huggingface.co" hf_token: str | None = None # Optional: HF_TOKEN env var - hf_models_per_task: int = 100 # How many to pull per task - - # ── ONNX Zoo ────────────────────────────────────────────────────── - onnx_models_url: str = ( - "https://raw.githubusercontent.com/onnx/models/main/README.md" - ) - - # ── Benchmark Bridge ────────────────────────────────────────────── - benchmark_max_concurrent: int = 3 # max parallel benchmark jobs - benchmark_max_log_lines: int = 500 # log entries kept per job - benchmark_ws_poll_hz: float = 2.0 # WebSocket telemetry poll rate - - # ── Dataset Manager ─────────────────────────────────────────────── - roboflow_api_base: str = "https://api.roboflow.com" - dataset_import_workers: int = 3 # max concurrent import jobs - dataset_chunk_size: int = 1024 * 1024 * 4 # 4 MB download chunk - roboflow_cache_ttl_secs: int = 3600 # 1 hour + hf_models_per_task: int = 200 # Discovery server pulls more per task def ensure_dirs(self) -> None: self.data_dir.mkdir(parents=True, exist_ok=True) - self.models_dir.mkdir(parents=True, exist_ok=True) - self.datasets_dir.mkdir(parents=True, exist_ok=True) - (self.datasets_dir / "_tmp").mkdir(parents=True, exist_ok=True) - self.logs_dir.mkdir(parents=True, exist_ok=True) settings = Settings() diff --git a/download/__init__.py b/download/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/download/__pycache__/__init__.cpython-310.pyc b/download/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index a282a59643aafb3112beb51caec1cb3e635b694b..0000000000000000000000000000000000000000 Binary files a/download/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/download/__pycache__/manager.cpython-310.pyc b/download/__pycache__/manager.cpython-310.pyc deleted file mode 100644 index f01cd1376113a32b4920523bdf08796c359683d2..0000000000000000000000000000000000000000 Binary files a/download/__pycache__/manager.cpython-310.pyc and /dev/null differ diff --git a/download/manager.py b/download/manager.py deleted file mode 100644 index 0605d4b6ac6e2c73fa2d7ee4333ffa62983e364d..0000000000000000000000000000000000000000 --- a/download/manager.py +++ /dev/null @@ -1,366 +0,0 @@ -""" -download/manager.py — Async download manager. -Handles queueing, concurrency limiting, retry, resume, and progress tracking. -All state is persisted in the jobs table for crash recovery. -""" -from __future__ import annotations - -import asyncio -import json -import uuid -from datetime import datetime, timezone -from pathlib import Path -from typing import Any - -import aiofiles -import httpx -from tenacity import retry, stop_after_attempt, wait_exponential - -from config import settings -from database.connection import get_db -from models.job import Job, row_to_job -from observability.logger import audit, get_logger -from registry.registry import get_model, update_model_status - -log = get_logger("download_manager") - -# ── Semaphore caps concurrent downloads ─────────────────────────────────────── -_download_sem: asyncio.Semaphore | None = None - - -def _get_sem() -> asyncio.Semaphore: - global _download_sem - if _download_sem is None: - _download_sem = asyncio.Semaphore(settings.max_concurrent_downloads) - return _download_sem - - -# ── Job CRUD ────────────────────────────────────────────────────────────────── - -async def _create_job( - job_type: str, - model_id: str, - model_name: str, - meta: dict | None = None, -) -> str: - job_id = str(uuid.uuid4()) - db = await get_db() - now = datetime.now(timezone.utc).isoformat() - await db.execute( - """INSERT INTO jobs (id, type, status, model_id, model_name, meta, created_at, updated_at) - VALUES (?,?,?,?,?,?,?,?)""", - (job_id, job_type, "queued", model_id, model_name, - json.dumps(meta or {}), now, now), - ) - await db.commit() - log.info("job_created", job_id=job_id, type=job_type, model_id=model_id) - await audit("job_created", model_id=model_id, job_id=job_id, - payload={"type": job_type, "model_name": model_name}) - return job_id - - -def _is_shard_file(filename: str) -> bool: - """Return True if the file is part of a sharded model (e.g. model-00001-of-00003.safetensors).""" - import re - return bool(re.search(r"-\d{5}-of-\d{5}\.", filename)) - - -async def _get_active_version(model_id: str) -> str: - """Return the active version string for a model, defaulting to 'v1'.""" - model = await get_model(model_id) - if model and model.active_version: - return model.active_version - return "v1" - - -@retry( - stop=stop_after_attempt(3), - wait=wait_exponential(multiplier=1, min=1, max=6), - reraise=True, -) -async def _resolve_hf_download_url(repo_id: str) -> str: - """Resolve a reliable download URL for a HF repo. - - Prefer safetensors over pytorch_model.bin; fall back to onnx if needed. - """ - async with httpx.AsyncClient(timeout=30, follow_redirects=True) as client: - resp = await client.get(f"{settings.hf_api_base}/models/{repo_id}") - resp.raise_for_status() - data = resp.json() - - siblings = data.get("siblings") or [] - filenames: list[str] = [] - for s in siblings: - fn = s.get("rfilename") or s.get("filename") - if fn: - filenames.append(fn) - - preferred_exact = [ - "model.safetensors", - "pytorch_model.bin", - "model.onnx", - ] - for fn in preferred_exact: - if fn in filenames: - return f"https://huggingface.co/{repo_id}/resolve/main/{fn}" - - preferred_suffix = [".safetensors", ".bin", ".onnx", ".pt", ".pth"] - for suffix in preferred_suffix: - for fn in filenames: - if fn.endswith(suffix) and not _is_shard_file(fn): - return f"https://huggingface.co/{repo_id}/resolve/main/{fn}" - - # Accept sharded files as a fallback (first shard of safetensors) - for fn in filenames: - if _is_shard_file(fn): - return f"https://huggingface.co/{repo_id}/resolve/main/{fn}" - - # Last resort: try the index file for sharded models - if "model.safetensors.index.json" in filenames: - # For sharded models without a single file, use the first shard - for fn in filenames: - if fn.startswith("model-") and fn.endswith(".safetensors"): - return f"https://huggingface.co/{repo_id}/resolve/main/{fn}" - - return f"https://huggingface.co/{repo_id}/resolve/main/pytorch_model.bin" - - -async def _update_job( - job_id: str, - status: str | None = None, - progress: float | None = None, - error: str | None = None, - started_at: str | None = None, - ended_at: str | None = None, -) -> None: - db = await get_db() - now = datetime.now(timezone.utc).isoformat() - parts: list[str] = ["updated_at = ?"] - vals: list[Any] = [now] - if status is not None: parts.append("status = ?"); vals.append(status) - if progress is not None: parts.append("progress = ?"); vals.append(progress) - if error is not None: parts.append("error = ?"); vals.append(error) - if started_at: parts.append("started_at = ?"); vals.append(started_at) - if ended_at: parts.append("ended_at = ?"); vals.append(ended_at) - vals.append(job_id) - await db.execute(f"UPDATE jobs SET {', '.join(parts)} WHERE id = ?", vals) - await db.commit() - - -# ── Download worker ─────────────────────────────────────────────────────────── - -async def _execute_download( - job_id: str, - model_id: str, - model_name: str, - download_url: str, - dest_path: Path, -) -> None: - now = datetime.now(timezone.utc).isoformat() - await _update_job(job_id, status="running", started_at=now) - - dest_path.parent.mkdir(parents=True, exist_ok=True) - tmp_path = dest_path.with_suffix(".tmp") - - # Determine resume offset - resume_offset = tmp_path.stat().st_size if tmp_path.exists() else 0 - - headers: dict[str, str] = {} - if resume_offset: - headers["Range"] = f"bytes={resume_offset}-" - log.info("download_resume", job_id=job_id, offset=resume_offset) - - try: - async with httpx.AsyncClient(timeout=120, follow_redirects=True) as client: - async with client.stream("GET", download_url, headers=headers) as resp: - resp.raise_for_status() - total = int(resp.headers.get("content-length", 0)) + resume_offset - downloaded = resume_offset - - async with aiofiles.open(tmp_path, "ab" if resume_offset else "wb") as fh: - async for chunk in resp.aiter_bytes(chunk_size=settings.download_chunk_size): - await fh.write(chunk) - downloaded += len(chunk) - progress = downloaded / total if total else 0 - await _update_job(job_id, progress=min(progress, 0.99)) - - # Rename tmp → final - tmp_path.rename(dest_path) - now_end = datetime.now(timezone.utc).isoformat() - await _update_job(job_id, status="completed", progress=1.0, ended_at=now_end) - await update_model_status( - model_id, - status="cached", - downloaded=True, - local_path=str(dest_path), - ) - # Copy into the active project's workspace models/ folder - from projects.service import link_model_to_active_project - await link_model_to_active_project(model_id, str(dest_path)) - log.info("download_complete", job_id=job_id, model_id=model_id, path=str(dest_path)) - await audit("download_complete", model_id=model_id, job_id=job_id, - payload={"path": str(dest_path)}) - - except Exception as exc: - now_end = datetime.now(timezone.utc).isoformat() - await _update_job(job_id, status="failed", error=str(exc), ended_at=now_end) - await update_model_status(model_id, status="error") - log.error("download_failed", job_id=job_id, error=str(exc)) - await audit("download_failed", model_id=model_id, job_id=job_id, - payload={"error": str(exc)}, level="error") - raise - - -# ── Public API ──────────────────────────────────────────────────────────────── - -async def enqueue_download( - model_id: str, - model_name: str, - download_url: str | None = None, - version: str | None = None, -) -> str: - """Create a download job and dispatch resolution+download in the background. - - This function should not perform network calls; otherwise /download can return 500 - on transient provider errors. - """ - job_id = await _create_job("download", model_id, model_name) - - asyncio.create_task( - _rate_limited_download_resolving(job_id, model_id, model_name, download_url, version) - ) - return job_id - - -async def _rate_limited_download_resolving( - job_id: str, - model_id: str, - model_name: str, - download_url: str | None, - version: str | None = None, -) -> None: - async with _get_sem(): - try: - resolved_url = await _resolve_download_url(model_id, download_url, version) - # Version folder: use explicit version label, else active_version from DB - folder = version or await _get_active_version(model_id) - ext = Path(resolved_url.split("?")[0]).suffix or ".bin" - dest_path = settings.models_dir / model_id / folder / f"model{ext}" - await _execute_download(job_id, model_id, model_name, resolved_url, dest_path) - except Exception as exc: - now_end = datetime.now(timezone.utc).isoformat() - await _update_job(job_id, status="failed", error=str(exc), ended_at=now_end) - await update_model_status(model_id, status="error") - log.error("download_failed", job_id=job_id, error=str(exc)) - await audit( - "download_failed", - model_id=model_id, - job_id=job_id, - payload={"error": str(exc)}, - level="error", - ) - - -async def _resolve_download_url( - model_id: str, - download_url: str | None, - version: str | None = None, -) -> str: - """Resolve the final download URL for a model. - - If `version` is provided and looks like a filename (e.g. 'yolov8n_pt'), - it was generated by hf_adapter from a sibling rfilename. Restore the - original filename (replace trailing _ext with .ext) and build a direct URL. - """ - repo_id: str | None = None - - if download_url and "huggingface.co" in download_url: - repo_id = download_url.replace("https://huggingface.co/", "").rstrip("/") - elif not download_url: - model = await get_model(model_id) - if model and model.download_url: - url = model.download_url - if "huggingface.co" in url: - repo_id = url.replace("https://huggingface.co/", "").rstrip("/") - else: - return url - else: - repo_id = model_id.replace("_", "/", 1) - else: - return download_url - - # If the caller specified a version that is a converted rfilename - # (dots replaced with underscores by hf_adapter), reconstruct the filename. - if version and repo_id: - filename = _version_to_filename(version) - if filename: - return f"https://huggingface.co/{repo_id}/resolve/main/{filename}" - - return await _resolve_hf_download_url(repo_id) - - -def _version_to_filename(version: str) -> str | None: - """Convert an hf_adapter version string back to a real filename. - - hf_adapter stores version as rfilename.replace('.', '_'), e.g.: - 'yolov8n_pt' → 'yolov8n.pt' - 'model_safetensors' → 'model.safetensors' - Only converts if the result ends with a known weight extension. - """ - weight_exts = (".pt", ".pth", ".safetensors", ".bin", ".onnx") - # Try replacing the last underscore with a dot - idx = version.rfind("_") - if idx == -1: - return None - candidate = version[:idx] + "." + version[idx + 1:] - if any(candidate.endswith(ext) for ext in weight_exts): - return candidate - return None - - -async def _rate_limited_download( - job_id: str, - model_id: str, - model_name: str, - download_url: str, - dest_path: Path, -) -> None: - async with _get_sem(): - try: - await _execute_download(job_id, model_id, model_name, download_url, dest_path) - except Exception: - pass # Already logged & stored in DB - - -async def get_job(job_id: str) -> Job | None: - db = await get_db() - async with db.execute("SELECT * FROM jobs WHERE id = ?", (job_id,)) as cur: - row = await cur.fetchone() - return row_to_job(row) if row else None - - -async def list_jobs( - status: str | None = None, - limit: int = 50, -) -> list[Job]: - db = await get_db() - if status: - sql = "SELECT * FROM jobs WHERE status = ? ORDER BY created_at DESC LIMIT ?" - params: tuple = (status, limit) - else: - sql = "SELECT * FROM jobs ORDER BY created_at DESC LIMIT ?" - params = (limit,) - async with db.execute(sql, params) as cur: - rows = await cur.fetchall() - return [row_to_job(r) for r in rows] - - -async def cancel_job(job_id: str) -> bool: - """Cancel a queued or running job (best-effort).""" - job = await get_job(job_id) - if not job or job.status not in ("queued", "running"): - return False - now = datetime.now(timezone.utc).isoformat() - await _update_job(job_id, status="cancelled", ended_at=now) - log.info("job_cancelled", job_id=job_id) - return True diff --git a/inference/__init__.py b/inference/__init__.py deleted file mode 100644 index a111050304c40dcb721f14fd1515588ba0cc0376..0000000000000000000000000000000000000000 --- a/inference/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# inference package diff --git a/inference/__pycache__/__init__.cpython-310.pyc b/inference/__pycache__/__init__.cpython-310.pyc deleted file mode 100644 index 85505a07772b135ba47d22c8cf9200943fd2f983..0000000000000000000000000000000000000000 Binary files a/inference/__pycache__/__init__.cpython-310.pyc and /dev/null differ diff --git a/inference/__pycache__/engine.cpython-310.pyc b/inference/__pycache__/engine.cpython-310.pyc deleted file mode 100644 index 3b9abe12755a60406c2f1c9de2034e05a24ef885..0000000000000000000000000000000000000000 Binary files a/inference/__pycache__/engine.cpython-310.pyc and /dev/null differ diff --git a/inference/__pycache__/session.cpython-310.pyc b/inference/__pycache__/session.cpython-310.pyc deleted file mode 100644 index e2f1494ed9e28264fd4d522f56a20c20599fbce7..0000000000000000000000000000000000000000 Binary files a/inference/__pycache__/session.cpython-310.pyc and /dev/null differ diff --git a/inference/engine.py b/inference/engine.py deleted file mode 100644 index 61ff7c379a8ea7591abec730078418878239862a..0000000000000000000000000000000000000000 --- a/inference/engine.py +++ /dev/null @@ -1,447 +0,0 @@ -""" -inference/engine.py — MLForge Inference Engine. - -Dispatcher that routes each InferenceRequest to the correct adapter pipeline: - YOLO → YOLOInferencePipeline - TRANSFORMERS → TransformersPipeline - ONNX → ONNXPipeline - CUSTOM → CustomPipeline - -Each pipeline implements preprocess → inference_step → postprocess. -Simulation paths are used when real model weights are not loaded; -every # <<< REPLACE IN PRODUCTION >>> comment marks the exact swap point. - -Architecture follows the spec in infra_arch.md §4 (Adapter Protocol). -""" -from __future__ import annotations - -import asyncio -import base64 -import io -import random -import time -import uuid -from typing import Any - -from models.inference import ( - AdapterType, - Detection, - InferenceRequest, - InferenceResult, - PipelineStage, -) -from models.model import Model -from observability.logger import get_logger - -log = get_logger("inference.engine") - -# ── Model cache: model_id → loaded model object ────────────────────────────── -_MODEL_CACHE: dict[str, Any] = {} - - -def _now_ms() -> float: - return time.perf_counter() * 1000 - - -# ── YOLO Pipeline ───────────────────────────────────────────────────────────── - -class YOLOPipeline: - """ - YOLO inference pipeline. - Preprocess: letterbox resize → BGR→RGB → 1/255 normalise. - Postprocess: NMS → [{x1,y1,x2,y2,confidence,class_id,class_name}]. - """ - - async def run( - self, req: InferenceRequest, model: Model - ) -> tuple[list[PipelineStage], dict[str, Any]]: - cfg = req.yolo_config - conf = cfg.confidence if cfg else 0.25 - iou = cfg.iou_threshold if cfg else 0.45 - - stages: list[PipelineStage] = [] - - # — Stage 1: Preprocess ———————————————————————————— - t0 = _now_ms() - await asyncio.sleep(0) # yield control - if req.image_base64: - try: - raw_bytes = base64.b64decode(req.image_base64) - # <<< REPLACE IN PRODUCTION >>> - # img = cv2.imdecode(np.frombuffer(raw_bytes, np.uint8), cv2.IMREAD_COLOR) - # tensor = letterbox(img, 640) / 255.0 - _ = len(raw_bytes) # validate decode worked - except Exception as e: - return [PipelineStage(name="Preprocess", status="error", detail=str(e))], {} - pre_ms = _now_ms() - t0 + random.uniform(0.8, 2.5) - stages.append(PipelineStage(name="Preprocess", status="done", - latency_ms=round(pre_ms, 2), detail="Letterbox 640×640")) - - # — Stage 2: Engine Load ——————————————————————————— - t1 = _now_ms() - loaded = model.id in _MODEL_CACHE - load_ms = 0.0 if loaded else random.uniform(80, 220) - await asyncio.sleep(load_ms / 1000.0) - if not loaded: - _MODEL_CACHE[model.id] = object() # <<< REPLACE: load actual weights - stages.append(PipelineStage(name="Engine Load", status="done", - latency_ms=round(_now_ms() - t1, 2), - detail="Cache hit" if loaded else "Weights loaded")) - - # — Stage 3: Inference ———————————————————————————— - t2 = _now_ms() - size_gb = max(model.size, 1) / (1024 ** 3) - base_lat = 2.5 + size_gb * 1.5 - infer_ms = base_lat + random.gauss(0, base_lat * 0.07) - await asyncio.sleep(infer_ms / 1000.0) - # <<< REPLACE IN PRODUCTION >>> - # results = model_obj(tensor, conf=conf, iou=iou) - stages.append(PipelineStage(name="Inference", status="done", - latency_ms=round(infer_ms, 2), - detail=f"conf={conf} iou={iou}")) - - # — Stage 4: Post-process (NMS) —————————————————— - t3 = _now_ms() - detections = self._simulate_detections(conf, cfg.class_filter if cfg else []) - post_ms = random.uniform(0.3, 1.2) - await asyncio.sleep(post_ms / 1000.0) - stages.append(PipelineStage(name="NMS Post-process", status="done", - latency_ms=round(post_ms, 2), - detail=f"{len(detections)} detections")) - - output: dict[str, Any] = { - "detections": [d.model_dump() for d in detections], - "pre_ms": round(pre_ms, 2), - "infer_ms": round(infer_ms, 2), - "post_ms": round(post_ms, 2), - } - return stages, output - - @staticmethod - def _simulate_detections(conf_thresh: float, class_filter: list[str]) -> list[Detection]: - """Simulate bounding-box detections. <<< REPLACE with real NMS output.""" - CLASSES = ["person", "car", "truck", "bicycle", "dog", "cat", - "traffic light", "stop sign", "bench", "bird"] - n = random.randint(0, 8) - dets: list[Detection] = [] - for _ in range(n): - c = random.uniform(conf_thresh, 1.0) - cid = random.randint(0, len(CLASSES) - 1) - cname = CLASSES[cid] - if class_filter and cname not in class_filter: - continue - x1 = random.uniform(0, 0.7) - y1 = random.uniform(0, 0.7) - dets.append(Detection( - x1=round(x1 * 640, 1), y1=round(y1 * 640, 1), - x2=round((x1 + random.uniform(0.05, 0.3)) * 640, 1), - y2=round((y1 + random.uniform(0.05, 0.3)) * 640, 1), - confidence=round(c, 4), - class_id=cid, class_name=cname, - )) - return dets - - -# ── Transformers Pipeline ───────────────────────────────────────────────────── - -class TransformersPipeline: - """ - HuggingFace Transformers pipeline. - Preprocess: AutoTokenizer.encode. - Inference: model.generate with KV-cache. - Postprocess: decode + strip special tokens. - """ - - async def run( - self, req: InferenceRequest, model: Model - ) -> tuple[list[PipelineStage], dict[str, Any]]: - cfg = req.transformers_config - stages: list[PipelineStage] = [] - - # — Tokenize —————————————————————————————————————— - t0 = _now_ms() - txt = req.text_input or "Hello, world!" - tok_count = len(txt.split()) * 2 # rough BPE estimate - await asyncio.sleep(0.002) - pre_ms = _now_ms() - t0 + random.uniform(1, 4) - stages.append(PipelineStage(name="Tokenise", status="done", - latency_ms=round(pre_ms, 2), - detail=f"{tok_count} tokens")) - - # — Engine Load ————————————————————————————————— - t1 = _now_ms() - loaded = model.id in _MODEL_CACHE - load_ms = 0.0 if loaded else random.uniform(150, 400) - await asyncio.sleep(load_ms / 1000.0) - if not loaded: - _MODEL_CACHE[model.id] = object() - stages.append(PipelineStage(name="Engine Load", status="done", - latency_ms=round(_now_ms() - t1, 2), - detail="Cache hit" if loaded else "Model loaded")) - - # — Generate —————————————————————————————————————— - t2 = _now_ms() - max_tok = cfg.max_new_tokens if cfg else 256 - # Simulate token-by-token generation at ~20 tok/s - infer_ms = (max_tok / 20.0) * 1000 + random.gauss(0, 50) - await asyncio.sleep(min(infer_ms / 1000.0, 0.5)) # cap sim delay - # <<< REPLACE IN PRODUCTION >>> - # outputs = model_obj.generate(input_ids, max_new_tokens=max_tok, - # temperature=cfg.temperature, top_p=cfg.top_p, do_sample=cfg.do_sample) - stages.append(PipelineStage(name="Generate", status="done", - latency_ms=round(infer_ms, 2), - detail=f"~{max_tok} tokens @ fp16")) - - # — Decode ———————————————————————————————————————— - t3 = _now_ms() - text_output = self._simulate_text(txt, max_tok) - post_ms = random.uniform(0.5, 2.0) - stages.append(PipelineStage(name="Decode", status="done", - latency_ms=round(post_ms, 2), - detail="Special tokens stripped")) - - output: dict[str, Any] = { - "text_output": text_output, - "tokens_generated": max_tok, - "pre_ms": round(pre_ms, 2), - "infer_ms": round(infer_ms, 2), - "post_ms": round(post_ms, 2), - } - return stages, output - - @staticmethod - def _simulate_text(prompt: str, n_tokens: int) -> str: - """Placeholder generation. <<< REPLACE with model.generate.""" - lorem = ( - "The model processed your input and generated a response based on the " - "learned distribution of the training corpus. This output is a simulation " - "placeholder — replace with actual model.generate() in production. " - ) - # Repeat to roughly match token count - words = (lorem * (n_tokens // 20 + 1)).split()[:n_tokens] - return " ".join(words) - - -# ── ONNX Pipeline ───────────────────────────────────────────────────────────── - -class ONNXPipeline: - """ - ONNX Runtime pipeline. - Acts as universal wrapper for TF / sklearn / PyTorch exported models. - Dynamically maps input tensor names from model metadata. - """ - - async def run( - self, req: InferenceRequest, model: Model - ) -> tuple[list[PipelineStage], dict[str, Any]]: - cfg = req.onnx_config - stages: list[PipelineStage] = [] - provider = cfg.execution_provider if cfg else "CUDAExecutionProvider" - - # — Preprocess ———————————————————————————————————— - t0 = _now_ms() - pre_ms = random.uniform(1.0, 3.5) - await asyncio.sleep(pre_ms / 1000.0) - stages.append(PipelineStage(name="Preprocess", status="done", - latency_ms=round(pre_ms, 2), - detail="Normalise + reshape tensor")) - - # — ONNX Runtime —————————————————————————————————— - t1 = _now_ms() - loaded = model.id in _MODEL_CACHE - load_ms = 0.0 if loaded else random.uniform(50, 150) - await asyncio.sleep(load_ms / 1000.0) - if not loaded: - _MODEL_CACHE[model.id] = object() - # <<< REPLACE IN PRODUCTION >>> - # import onnxruntime as ort - # sess_opts = ort.SessionOptions() - # _MODEL_CACHE[model.id] = ort.InferenceSession( - # model.local_path, sess_options=sess_opts, - # providers=[provider]) - stages.append(PipelineStage(name="ONNX Runtime", status="done", - latency_ms=round(_now_ms() - t1, 2), - detail=provider.replace("ExecutionProvider", ""))) - - # — Inference ———————————————————————————————————— - t2 = _now_ms() - infer_ms = random.uniform(3.0, 12.0) - await asyncio.sleep(infer_ms / 1000.0) - # <<< REPLACE IN PRODUCTION >>> - # ort_inputs = {sess.get_inputs()[0].name: tensor.numpy()} - # raw = sess.run(None, ort_inputs) - stages.append(PipelineStage(name="Inference", status="done", - latency_ms=round(infer_ms, 2), - detail="session.run()")) - - # — Format Output ———————————————————————————————— - t3 = _now_ms() - post_ms = random.uniform(0.2, 0.8) - raw_out = {"output_0": [round(random.random(), 4) for _ in range(10)]} - stages.append(PipelineStage(name="Format Output", status="done", - latency_ms=round(post_ms, 2), - detail="Tensor → JSON")) - - output: dict[str, Any] = { - "raw_output": raw_out, - "pre_ms": round(pre_ms, 2), - "infer_ms": round(infer_ms, 2), - "post_ms": round(post_ms, 2), - } - return stages, output - - -# ── Custom Python Pipeline ──────────────────────────────────────────────────── - -class CustomPipeline: - """ - Sandboxed custom Python pipeline. - Executes user-supplied pre/postprocess scripts in a restricted namespace. - Only numpy, the input tensor, and the model's raw output are accessible. - """ - - FORBIDDEN = ("import os", "import sys", "subprocess", "open(", "__import__", - "eval(", "exec(", "globals(", "locals(") - - def _validate_script(self, script: str) -> str | None: - for tok in self.FORBIDDEN: - if tok in script: - return f"Forbidden token in script: {tok!r}" - return None - - async def run( - self, req: InferenceRequest, model: Model - ) -> tuple[list[PipelineStage], dict[str, Any]]: - cfg = req.custom_config - stages: list[PipelineStage] = [] - - # — Validate scripts —————————————————————————————— - if cfg: - for label, script in [("preprocess", cfg.preprocess_script), - ("postprocess", cfg.postprocess_script)]: - if script: - err = self._validate_script(script) - if err: - return [PipelineStage(name=label.capitalize(), - status="error", detail=err)], {} - - # — Transform Input ——————————————————————————————— - pre_ms = random.uniform(1.0, 5.0) - await asyncio.sleep(pre_ms / 1000.0) - stages.append(PipelineStage(name="Transform Input", status="done", - latency_ms=round(pre_ms, 2), - detail="Custom preprocess script")) - - # — Run Inference ———————————————————————————————— - infer_ms = random.uniform(5.0, 30.0) - await asyncio.sleep(infer_ms / 1000.0) - # <<< REPLACE IN PRODUCTION >>> - # namespace = {"input": tensor, "model": raw_model} - # exec(compile(cfg.preprocess_script, "
", "exec"), namespace)
- # tensor = namespace.get("output", tensor)
- stages.append(PipelineStage(name="Run Inference", status="done",
- latency_ms=round(infer_ms, 2),
- detail="Custom runtime"))
-
- # — Format Result ————————————————————————————————
- post_ms = random.uniform(0.5, 3.0)
- stages.append(PipelineStage(name="Format Result", status="done",
- latency_ms=round(post_ms, 2),
- detail="Custom postprocess script"))
-
- output: dict[str, Any] = {
- "raw_output": {"custom_result": round(random.random(), 4)},
- "pre_ms": round(pre_ms, 2),
- "infer_ms": round(infer_ms, 2),
- "post_ms": round(post_ms, 2),
- }
- return stages, output
-
-
-# ── Master Dispatcher ─────────────────────────────────────────────────────────
-
-_PIPELINE_MAP = {
- AdapterType.YOLO: YOLOPipeline,
- AdapterType.TRANSFORMERS: TransformersPipeline,
- AdapterType.ONNX: ONNXPipeline,
- AdapterType.CUSTOM: CustomPipeline,
-}
-
-
-class InferenceEngine:
- """
- Central inference dispatcher.
- Resolves the correct pipeline, executes it, and wraps the result
- into a fully-populated InferenceResult.
- """
-
- async def run(self, req: InferenceRequest, model: Model) -> InferenceResult:
- t_start = _now_ms()
- pipeline_cls = _PIPELINE_MAP.get(req.adapter_type)
- if pipeline_cls is None:
- return InferenceResult(
- request_id=str(uuid.uuid4()),
- model_id=req.model_id,
- adapter_type=req.adapter_type,
- status="error",
- error=f"Unknown adapter type: {req.adapter_type}",
- )
-
- try:
- stages, output = await pipeline_cls().run(req, model)
-
- total_ms = _now_ms() - t_start
- pre_ms = output.get("pre_ms", 0.0)
- infer_ms = output.get("infer_ms", 0.0)
- post_ms = output.get("post_ms", 0.0)
-
- # Quality score: mean confidence of detections (0–5 scale)
- detections = [Detection(**d) for d in output.get("detections", [])]
- if detections:
- mean_conf = sum(d.confidence for d in detections) / len(detections)
- quality = round(mean_conf * 5.0, 2)
- else:
- quality = round(random.uniform(3.2, 4.8), 2)
-
- result = InferenceResult(
- model_id = req.model_id,
- adapter_type = req.adapter_type,
- preprocess_ms = pre_ms,
- inference_ms = infer_ms,
- postprocess_ms= post_ms,
- total_ms = round(total_ms, 2),
- pipeline = stages,
- detections = detections,
- text_output = output.get("text_output"),
- raw_output = output.get("raw_output"),
- quality_score = quality,
- status = "ok",
- )
-
- log.info("inference_complete",
- model_id=req.model_id,
- adapter=req.adapter_type,
- total_ms=round(total_ms, 2))
- return result
-
- except Exception as exc:
- log.error("inference_error", model_id=req.model_id, error=str(exc))
- return InferenceResult(
- model_id=req.model_id,
- adapter_type=req.adapter_type,
- status="error",
- error=str(exc),
- )
-
-
-def get_cache_status() -> dict[str, bool]:
- """Return which model IDs are currently warm in cache."""
- return {k: True for k in _MODEL_CACHE}
-
-
-def evict_model(model_id: str) -> bool:
- """Evict a model from the in-process cache (free VRAM sim)."""
- if model_id in _MODEL_CACHE:
- del _MODEL_CACHE[model_id]
- return True
- return False
diff --git a/inference/session.py b/inference/session.py
deleted file mode 100644
index 4e829443fddb311a8895e1feb183117d92e18c33..0000000000000000000000000000000000000000
--- a/inference/session.py
+++ /dev/null
@@ -1,80 +0,0 @@
-"""
-inference/session.py — In-memory inference session ledger.
-
-Keeps the last MAX_HISTORY inference results per process lifetime.
-Persisted to the SQLite `inference_history` table on each write
-(non-blocking via aiosqlite).
-"""
-from __future__ import annotations
-
-import asyncio
-import json
-import uuid
-from collections import deque
-from typing import Deque
-
-from models.inference import InferenceHistoryEntry, InferenceRequest, InferenceResult
-from observability.logger import get_logger
-
-log = get_logger("inference.session")
-
-MAX_HISTORY = 200
-
-_history: Deque[InferenceHistoryEntry] = deque(maxlen=MAX_HISTORY)
-_lock = asyncio.Lock()
-
-
-async def record(req: InferenceRequest, result: InferenceResult, model_name: str) -> None:
- """Append a completed inference run to the ledger."""
- entry = InferenceHistoryEntry(
- model_id = req.model_id,
- model_name = model_name,
- adapter_type = req.adapter_type,
- total_ms = result.total_ms,
- quality_score = result.quality_score,
- status = result.status,
- request_snapshot = req.model_dump(exclude={"image_base64"}),
- )
- async with _lock:
- _history.appendleft(entry)
-
- # Persist to DB (fire-and-forget)
- asyncio.create_task(_persist(entry))
-
-
-async def _persist(entry: InferenceHistoryEntry) -> None:
- try:
- from database.connection import get_db
- async with get_db() as db:
- await db.execute(
- """
- INSERT OR REPLACE INTO inference_history
- (id, model_id, model_name, adapter_type, timestamp,
- total_ms, quality_score, status, request_snapshot)
- VALUES (?,?,?,?,?,?,?,?,?)
- """,
- (
- entry.id,
- entry.model_id,
- entry.model_name,
- entry.adapter_type.value,
- entry.timestamp,
- entry.total_ms,
- entry.quality_score,
- entry.status,
- json.dumps(entry.request_snapshot),
- ),
- )
- await db.commit()
- except Exception as exc:
- log.warning("inference_persist_failed", error=str(exc))
-
-
-async def get_history(limit: int = 50) -> list[InferenceHistoryEntry]:
- async with _lock:
- return list(_history)[:limit]
-
-
-async def clear_history() -> None:
- async with _lock:
- _history.clear()
diff --git a/main.py b/main.py
index a25f68a44e0a261d25f1ee2182813a76f16fa578..8290baeaff5856951995c937a69573dbb00ca6d1 100644
--- a/main.py
+++ b/main.py
@@ -26,7 +26,6 @@ from fastapi.responses import JSONResponse
from api.routes import models as models_router
from api.routes import sync as sync_router
from api.routes import datasets as datasets_router
-from api.routes import projects as projects_router
from config import settings
from database.connection import close_db, get_db
from middleware.logging_middleware import RequestLoggingMiddleware
@@ -65,9 +64,9 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
# ── Application ───────────────────────────────────────────────────────────────
app = FastAPI(
- title=settings.app_name,
+ title="MLForge Cloud Registry",
version=settings.version,
- description="Production ML Model Zoo backend — local-first, traceable, extensible.",
+ description="Global Model and Dataset Discovery Service — The Brain of MLForge.",
docs_url="/docs",
redoc_url="/redoc",
lifespan=lifespan,
@@ -91,8 +90,7 @@ async def global_exception_handler(request: Request, exc: Exception):
# ── Middleware ─────────────────────────────────────────────────────────────────
app.add_middleware(
CORSMiddleware,
- allow_origins=settings.cors_origins,
- allow_origin_regex=r"^https?://(localhost|127\\.0\\.0\\.1)(:\\d+)?$",
+ allow_origins=["*"], # Allow all origins for the cloud registry to support SDK/CLI/UI
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
@@ -103,7 +101,6 @@ app.add_middleware(RequestLoggingMiddleware)
app.include_router(models_router.router)
app.include_router(sync_router.router)
app.include_router(datasets_router.router)
-app.include_router(projects_router.router)
@app.get("/health", tags=["system"])
@@ -114,6 +111,7 @@ async def health() -> dict:
n_datasets = await count_datasets()
return {
"status": "ok",
+ "service": "cloud_registry",
"version": settings.version,
"model_count": n_models,
"dataset_count": n_datasets,
diff --git a/projects/__init__.py b/projects/__init__.py
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/projects/__pycache__/__init__.cpython-310.pyc b/projects/__pycache__/__init__.cpython-310.pyc
deleted file mode 100644
index 32012d58ef7624a78017691a0749ea3e665d812b..0000000000000000000000000000000000000000
Binary files a/projects/__pycache__/__init__.cpython-310.pyc and /dev/null differ
diff --git a/projects/__pycache__/registry.cpython-310.pyc b/projects/__pycache__/registry.cpython-310.pyc
deleted file mode 100644
index 67d54c8623bf91bec987d8cd7815bc46f2095fa8..0000000000000000000000000000000000000000
Binary files a/projects/__pycache__/registry.cpython-310.pyc and /dev/null differ
diff --git a/projects/__pycache__/service.cpython-310.pyc b/projects/__pycache__/service.cpython-310.pyc
deleted file mode 100644
index 001fc8db63f17e75d6ef644b43fe80388712d0f6..0000000000000000000000000000000000000000
Binary files a/projects/__pycache__/service.cpython-310.pyc and /dev/null differ
diff --git a/projects/registry.py b/projects/registry.py
deleted file mode 100644
index e541ae8fe4bdebbce6ce1a3b15f85aa61ddd0e4d..0000000000000000000000000000000000000000
--- a/projects/registry.py
+++ /dev/null
@@ -1,73 +0,0 @@
-"""projects/registry.py — Project persistence in SQLite."""
-
-from __future__ import annotations
-
-from datetime import datetime, timezone
-
-from database.connection import get_db
-from models.project import Project
-
-
-async def upsert_project(project: Project) -> None:
- db = await get_db()
- await db.execute(
- """INSERT INTO projects (id, name, path, created_at, last_opened, status)
- VALUES (?,?,?,?,?,?)
- ON CONFLICT(id) DO UPDATE SET
- name=excluded.name,
- path=excluded.path,
- last_opened=excluded.last_opened,
- status=excluded.status
- """,
- (
- project.id,
- project.name,
- project.path,
- project.created_at,
- project.last_opened,
- project.status,
- ),
- )
- await db.commit()
-
-
-async def list_projects(limit: int = 200, offset: int = 0) -> list[Project]:
- db = await get_db()
- async with db.execute(
- """SELECT id, name, path, created_at, last_opened, status
- FROM projects
- ORDER BY datetime(last_opened) DESC
- LIMIT ? OFFSET ?
- """,
- (limit, offset),
- ) as cur:
- rows = await cur.fetchall()
- return [Project(**dict(r)) for r in rows]
-
-
-async def delete_project(project_id: str) -> bool:
- db = await get_db()
- cur = await db.execute("DELETE FROM projects WHERE id = ?", (project_id,))
- await db.commit()
- return (cur.rowcount or 0) > 0
-
-
-async def get_project(project_id: str) -> Project | None:
- db = await get_db()
- async with db.execute(
- "SELECT id, name, path, created_at, last_opened, status FROM projects WHERE id = ?",
- (project_id,),
- ) as cur:
- row = await cur.fetchone()
- return Project(**dict(row)) if row else None
-
-
-async def touch_last_opened(project_id: str) -> None:
- db = await get_db()
- now = datetime.now(timezone.utc).isoformat()
- await db.execute(
- "UPDATE projects SET last_opened = ? WHERE id = ?",
- (now, project_id),
- )
- await db.commit()
-
diff --git a/projects/service.py b/projects/service.py
deleted file mode 100644
index fba5632396b5f33091f45a5959ee3f01c7cd46d1..0000000000000000000000000000000000000000
--- a/projects/service.py
+++ /dev/null
@@ -1,186 +0,0 @@
-"""
-projects/service.py — Active project session + model workspace linking.
-
-Tracks which project is currently open (via the `session` DB table) and
-copies freshly-downloaded model files into the project's models/ folder
-so the benchmark engine and other workspaces can locate them.
-"""
-from __future__ import annotations
-
-import os
-import shutil
-import uuid
-from pathlib import Path
-from datetime import datetime, timezone
-
-from database.connection import get_db
-from observability.logger import get_logger, audit
-from models.model import Model, ModelMetrics
-from registry.registry import upsert_model
-
-log = get_logger("projects.service")
-
-
-async def import_local_model(
- name: str,
- task: str,
- framework: str,
- source_file_path: str
-) -> Model:
- """Import a local model file into the active project."""
- project_id = await get_active_project_id()
- project_path = await get_active_project_path()
-
- if not project_id or not project_path:
- raise ValueError("No active project found. Please open a project first.")
-
- src = Path(source_file_path)
- if not src.exists():
- raise FileNotFoundError(f"Source model file not found: {source_file_path}")
-
- # Create destination directory in project
- model_id = f"local-{uuid.uuid4().hex[:12]}"
- dest_dir = Path(project_path) / "models" / model_id
- dest_dir.mkdir(parents=True, exist_ok=True)
-
- dest_path = dest_dir / src.name
- shutil.copy2(src, dest_path)
-
- # Calculate size
- size_bytes = dest_path.stat().st_size
- size_label = f"{size_bytes / (1024*1024):.1f} MB" if size_bytes > 1024*1024 else f"{size_bytes / 1024:.1f} KB"
-
- # Create model entry
- now = datetime.now(timezone.utc).isoformat()
- model = Model(
- id=model_id,
- name=name,
- task=task,
- framework=framework,
- source="local",
- provider="Local Import",
- size=size_bytes,
- size_label=size_label,
- local_path=str(dest_path),
- project_id=project_id,
- downloaded=True,
- status="cached",
- created_at=now,
- updated_at=now,
- metrics=ModelMetrics()
- )
-
- await upsert_model(model)
- await audit("model_imported_locally", model_id=model_id, payload={"name": name, "project_id": project_id})
- log.info("model_imported_locally", model_id=model_id, name=name, path=str(dest_path))
-
- return model
-
-
-# ── Session helpers ───────────────────────────────────────────────────────────
-
-async def set_active_project(project_id: str, project_path: str) -> None:
- """Persist the currently open project in the session table."""
- db = await get_db()
- await db.execute(
- "INSERT INTO session (key, value) VALUES ('active_project_id', ?)"
- " ON CONFLICT(key) DO UPDATE SET value=excluded.value",
- (project_id,),
- )
- await db.execute(
- "INSERT INTO session (key, value) VALUES ('active_project_path', ?)"
- " ON CONFLICT(key) DO UPDATE SET value=excluded.value",
- (project_path,),
- )
- await db.commit()
- log.info("active_project_set", project_id=project_id, path=project_path)
-
-
-async def get_active_project_id() -> str | None:
- """Return the ID of the currently open project, or None."""
- db = await get_db()
- async with db.execute(
- "SELECT value FROM session WHERE key = 'active_project_id'"
- ) as cur:
- row = await cur.fetchone()
- return row["value"] if row else None
-
-
-async def get_active_project_path() -> str | None:
- """Return the filesystem path of the currently open project, or None."""
- db = await get_db()
- async with db.execute(
- "SELECT value FROM session WHERE key = 'active_project_path'"
- ) as cur:
- row = await cur.fetchone()
- return row["value"] if row else None
-
-
-# ── Workspace model linking ───────────────────────────────────────────────────
-
-async def link_model_to_active_project(model_id: str, source_path: str) -> None:
- """Copy the downloaded model file into the active project's models/ folder.
-
- This is a best-effort operation — if no project is open, or if the copy
- fails for any reason, we log and continue rather than failing the download.
- """
- project_path = await get_active_project_path()
- if not project_path:
- log.debug("link_model_skipped_no_project", model_id=model_id)
- return
-
- src = Path(source_path)
- if not src.exists():
- log.warning("link_model_source_missing", model_id=model_id, path=source_path)
- return
-
- dest_dir = Path(project_path) / "models" / model_id
- dest_dir.mkdir(parents=True, exist_ok=True)
- dest = dest_dir / src.name
-
- if dest.exists():
- log.debug("link_model_already_exists", model_id=model_id, dest=str(dest))
- return
-
- try:
- shutil.copy2(src, dest)
- log.info("model_linked_to_project", model_id=model_id, project=project_path, dest=str(dest))
- except OSError as exc:
- log.warning("link_model_copy_failed", model_id=model_id, error=str(exc))
-
-
-async def link_dataset_to_active_project(dataset_id: str, source_path: str) -> None:
- """Copy the imported dataset folder into the active project's datasets/ folder.
-
- This is a best-effort operation — if no project is open, or if the copy
- fails for any reason, we log and continue rather than failing the import.
- """
- project_path = await get_active_project_path()
- if not project_path:
- log.debug("link_dataset_skipped_no_project", dataset_id=dataset_id)
- return
-
- src = Path(source_path)
- if not src.exists():
- log.warning("link_dataset_source_missing", dataset_id=dataset_id, path=source_path)
- return
-
- dest_dir = Path(project_path) / "datasets" / dataset_id
-
- if dest_dir.exists():
- log.debug("link_dataset_already_exists", dataset_id=dataset_id, dest=str(dest_dir))
- return
-
- try:
- if src.is_dir():
- shutil.copytree(src, dest_dir, dirs_exist_ok=True)
- else:
- # If it's a file (e.g. zip that wasn't extracted yet), just copy it
- dest_dir.parent.mkdir(parents=True, exist_ok=True)
- shutil.copy2(src, dest_dir)
-
- log.info("dataset_linked_to_project", dataset_id=dataset_id, project=project_path, dest=str(dest_dir))
- return dest_dir
- except OSError as exc:
- log.warning("link_dataset_copy_failed", dataset_id=dataset_id, error=str(exc))
- return None
diff --git a/static/assets/index-CxHjXbkP.js b/static/assets/index-CxHjXbkP.js
deleted file mode 100644
index 6fe88e2ca75b131fe4e6a99866c9206a42b35957..0000000000000000000000000000000000000000
--- a/static/assets/index-CxHjXbkP.js
+++ /dev/null
@@ -1,136 +0,0 @@
-var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1ie||(e.current=re[ie],re[ie]=null,ie--)}function se(e,t){ie++,re[ie]=e.current,e.current=t}var ce=ae(null),le=ae(null),ue=ae(null),de=ae(null);function fe(e,t){switch(se(ue,t),se(le,e),se(ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qd(t),e=Jd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}oe(ce),se(ce,e)}function pe(){oe(ce),oe(le),oe(ue)}function me(e){e.memoizedState!==null&&se(de,e);var t=ce.current,n=Jd(t,e.type);t!==n&&(se(le,e),se(ce,n))}function he(e){le.current===e&&(oe(ce),oe(le)),de.current===e&&(oe(de),ip._currentValue=ne)}var ge,_e;function ve(e){if(ge===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ge=t&&t[1]||``,_e=-1)`:-1i||c[r]!==l[i]){var u=`
-`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ye=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ve(n):``}function xe(e,t){switch(e.tag){case 26:case 27:case 5:return ve(e.type);case 16:return ve(`Lazy`);case 13:return e.child!==t&&t!==null?ve(`Suspense Fallback`):ve(`Suspense`);case 19:return ve(`SuspenseList`);case 0:case 15:return be(e.type,!1);case 11:return be(e.type.render,!1);case 1:return be(e.type,!0);case 31:return ve(`Activity`);default:return``}}function Se(e){try{var t=``,n=null;do t+=xe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
-Error generating stack: `+e.message+`
-`+e.stack}}var Ce=Object.prototype.hasOwnProperty,we=t.unstable_scheduleCallback,Te=t.unstable_cancelCallback,Ee=t.unstable_shouldYield,De=t.unstable_requestPaint,Oe=t.unstable_now,ke=t.unstable_getCurrentPriorityLevel,Ae=t.unstable_ImmediatePriority,je=t.unstable_UserBlockingPriority,Me=t.unstable_NormalPriority,Ne=t.unstable_LowPriority,Pe=t.unstable_IdlePriority,Fe=t.log,Ie=t.unstable_setDisableYieldValue,I=null,L=null;function Le(e){if(typeof Fe==`function`&&Ie(e),L&&typeof L.setStrictMode==`function`)try{L.setStrictMode(I,e)}catch{}}var Re=Math.clz32?Math.clz32:Be,ze=Math.log,R=Math.LN2;function Be(e){return e>>>=0,e===0?32:31-(ze(e)/R|0)|0}var Ve=256,He=262144,Ue=4194304;function We(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 Ge(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=We(n))):i=We(o):i=We(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=We(n))):i=We(o)):i=We(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ke(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function qe(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 Je(){var e=Ue;return Ue<<=1,!(Ue&62914560)&&(Ue=4194304),e}function Ye(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ze(e,t,n,r,i,a){var o=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 s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),un=!1;if(ln)try{var dn={};Object.defineProperty(dn,`passive`,{get:function(){un=!0}}),window.addEventListener(`test`,dn,dn),window.removeEventListener(`test`,dn,dn)}catch{un=!1}var fn=null,pn=null,mn=null;function hn(){if(mn)return mn;var e,t=pn,n=t.length,r,i=`value`in fn?fn.value:fn.textContent,a=i.length;for(e=0;e=qn),Xn=` `,Zn=!1;function Qn(e,t){switch(e){case`keyup`:return Gn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function $n(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var er=!1;function tr(e,t){switch(e){case`compositionend`:return $n(t);case`keypress`:return t.which===32?(Zn=!0,Xn):null;case`textInput`:return e=t.data,e===Xn&&Zn?null:e;default:return null}}function nr(e,t){if(er)return e===`compositionend`||!Kn&&Qn(e,t)?(e=hn(),mn=pn=fn=null,er=!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=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=wr(n)}}function Er(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Er(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Dr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=It(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=It(e.document)}return t}function Or(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 kr=ln&&`documentMode`in document&&11>=document.documentMode,Ar=null,jr=null,Mr=null,Nr=!1;function Pr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Nr||Ar==null||Ar!==It(r)||(r=Ar,`selectionStart`in r&&Or(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Mr&&Cr(Mr,r)||(Mr=r,r=jd(jr,`onSelect`),0>=o,i-=o,Ei=1<<32-Re(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Fi&&Oi(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Fi&&Oi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Fi&&Oi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Fi&&Oi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Oa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Fa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=pi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=fi(o.type,o.key,o.props,null,e.mode,c),Fa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=gi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Oa(o),b(e,r,o,c)}if(ee(o))return h(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Pa(o),c);if(o.$$typeof===C)return b(e,r,ra(e,o),c);Ia(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=mi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Na=0;var i=b(e,t,n,r);return Ma=null,i}catch(t){if(t===Sa||t===wa)throw t;var a=ci(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ra=La(!0),za=La(!1),Ba=!1;function Va(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ha(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 Ua(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Wa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,zl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ai(e),ii(e,null,n),t}return ti(e,r,t,n),ai(e)}function Ga(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}function Ka(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var qa=!1;function Ja(){if(qa){var e=pa;if(e!==null)throw e}}function Ya(e,t,n,r){qa=!1;var i=e.updateQueue;Ba=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Hl&f)===f:(r&f)===f){f!==0&&f===fa&&(qa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Ba=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Yl|=o,e.lanes=o,e.memoizedState=d}}function Xa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Za(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=F.T,s={};F.T=s,Ps(e,!1,t,n);try{var c=i(),l=F.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ns(e,t,ga(c,r),_u(e)):Ns(e,t,r,_u(e))}catch(n){Ns(e,t,{then:function(){},status:`rejected`,reason:n},_u())}finally{te.p=a,o!==null&&s.types!==null&&(o.types=s.types),F.T=o}}function Cs(){}function ws(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ts(e).queue;Ss(e,a,t,ne,n===null?Cs:function(){return Es(e),n(r)})}function Ts(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fo,lastRenderedState:ne},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Es(e){var t=Ts(e);t.next===null&&(t=e.alternate.memoizedState),Ns(e,t.next.queue,{},_u())}function Ds(){return na(ip)}function Os(){return U().memoizedState}function ks(){return U().memoizedState}function As(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=_u();e=Ua(n);var r=Wa(t,e,n);r!==null&&(yu(r,t,n),Ga(r,t,n)),t={cache:ca()},e.payload=t;return}t=t.return}}function js(e,t,n){var r=_u();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Fs(e)?Is(t,n):(n=ni(e,t,n,r),n!==null&&(yu(n,e,r),Ls(n,t,r)))}function Ms(e,t,n){Ns(e,t,n,_u())}function Ns(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Fs(e))Is(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Sr(s,o))return ti(e,t,i,0),Bl===null&&ei(),!1}catch{}if(n=ni(e,t,i,r),n!==null)return yu(n,e,r),Ls(n,t,r),!0}return!1}function Ps(e,t,n,r){if(r={lane:2,revertLane:gd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Fs(e)){if(t)throw Error(i(479))}else t=ni(e,n,r,2),t!==null&&yu(t,e,2)}function Fs(e){var t=e.alternate;return e===V||t!==null&&t===V}function Is(e,t){ho=mo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ls(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}var Rs={readContext:na,use:No,useCallback:xo,useContext:xo,useEffect:xo,useImperativeHandle:xo,useLayoutEffect:xo,useInsertionEffect:xo,useMemo:xo,useReducer:xo,useRef:xo,useState:xo,useDebugValue:xo,useDeferredValue:xo,useTransition:xo,useSyncExternalStore:xo,useId:xo,useHostTransitionStatus:xo,useFormState:xo,useActionState:xo,useOptimistic:xo,useMemoCache:xo,useCacheRefresh:xo};Rs.useEffectEvent=xo;var zs={readContext:na,use:No,useCallback:function(e,t){return Ao().memoizedState=[e,t===void 0?null:t],e},useContext:na,useEffect:ls,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ss(4194308,4,hs.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=Ao();t=t===void 0?null:t;var r=e();if(go){Le(!0);try{e()}finally{Le(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ao();if(n!==void 0){var i=n(t);if(go){Le(!0);try{n(t)}finally{Le(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=js.bind(null,V,e),[r.memoizedState,e]},useRef:function(e){var t=Ao();return e={current:e},t.memoizedState=e},useState:function(e){e=Go(e);var t=e.queue,n=Ms.bind(null,V,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:_s,useDeferredValue:function(e,t){return bs(Ao(),e,t)},useTransition:function(){var e=Go(!1);return e=Ss.bind(null,V,e.queue,!0,!1),Ao().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=V,a=Ao();if(Fi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Bl===null)throw Error(i(349));Hl&127||Bo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ls(Ho.bind(null,r,o,e),[e]),r.flags|=2048,as(9,{destroy:void 0},Vo.bind(null,r,o,n,t),null),n},useId:function(){var e=Ao(),t=Bl.identifierPrefix;if(Fi){var n=Di,r=Ei;n=(r&~(1<<32-Re(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=_o++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[ot]=t,o[st]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Bd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Mc(t)}}return Lc(t),Nc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Mc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ue.current,Hi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ni,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Ld(e.nodeValue,n)),e||zi(t,!0)}else e=Kd(e).createTextNode(r),e[ot]=t,t.stateNode=e}return Lc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Hi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[ot]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Lc(t),e=!1}else n=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(co(t),t):(co(t),null);if(t.flags&128)throw Error(i(558))}return Lc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Hi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[ot]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Lc(t),a=!1}else a=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(co(t),t):(co(t),null)}return co(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Fc(t,t.updateQueue),Lc(t),null);case 4:return pe(),e===null&&Dd(t.stateNode.containerInfo),Lc(t),null;case 10:return Xi(t.type),Lc(t),null;case 19:if(oe(lo),r=t.memoizedState,r===null)return Lc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Ic(r,!1);else{if(K!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=uo(e),o!==null){for(t.flags|=128,Ic(r,!1),e=o.updateQueue,t.updateQueue=e,Fc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)di(n,e),n=n.sibling;return se(lo,lo.current&1|2),Fi&&Oi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Oe()>au&&(t.flags|=128,a=!0,Ic(r,!1),t.lanes=4194304)}else{if(!a)if(e=uo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Fc(t,e),Ic(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Fi)return Lc(t),null}else 2*Oe()-r.renderingStartTime>au&&n!==536870912&&(t.flags|=128,a=!0,Ic(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Lc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Oe(),e.sibling=null,n=lo.current,se(lo,a?n&1|2:n&1),Fi&&Oi(t,r.treeForkCount),e);case 22:case 23:return co(t),no(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Lc(t),t.subtreeFlags&6&&(t.flags|=8192)):Lc(t),n=t.updateQueue,n!==null&&Fc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&oe(va),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Xi(sa),Lc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function zc(e,t){switch(ji(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xi(sa),pe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return he(t),null;case 31:if(t.memoizedState!==null){if(co(t),t.alternate===null)throw Error(i(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(co(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return oe(lo),null;case 4:return pe(),null;case 10:return Xi(t.type),null;case 22:case 23:return co(t),no(),e!==null&&oe(va),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xi(sa),null;case 25:return null;default:return null}}function Bc(e,t){switch(ji(t),t.tag){case 3:Xi(sa),pe();break;case 26:case 27:case 5:he(t);break;case 4:pe();break;case 31:t.memoizedState!==null&&co(t);break;case 13:co(t);break;case 19:oe(lo);break;case 10:Xi(t.type);break;case 22:case 23:co(t),no(),e!==null&&oe(va);break;case 24:Xi(sa)}}function Vc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Yu(t,t.return,e)}}function Hc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Yu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Yu(t,t.return,e)}}function Uc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Za(t,n)}catch(t){Yu(e,e.return,t)}}}function Wc(e,t,n){n.props=Gs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Yu(e,t,n)}}function Gc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Yu(e,t,n)}}function Kc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Yu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Yu(e,t,n)}else n.current=null}function qc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Yu(e,e.return,t)}}function Jc(e,t,n){try{var r=e.stateNode;Vd(r,e.type,n,t),r[st]=t}catch(t){Yu(e,e.return,t)}}function Yc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&rf(e.type)||e.tag===4}function Xc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Yc(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&&rf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Zc(e,t,n){var r=e.tag;if(r===5||r===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=$t));else if(r!==4&&(r===27&&rf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Zc(e,t,n),e=e.sibling;e!==null;)Zc(e,t,n),e=e.sibling}function Qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&rf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function $c(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Bd(t,r,n),t[ot]=e,t[st]=n}catch(t){Yu(e,e.return,t)}}var el=!1,tl=!1,nl=!1,rl=typeof WeakSet==`function`?WeakSet:Set,il=null;function al(e,t){if(e=e.containerInfo,Wd=pp,e=Dr(e),Or(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Gd={focusedElem:e,selectionRange:n},pp=!1,il=t;il!==null;)if(t=il,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,il=e;else for(;il!==null;){switch(t=il,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Bd(o,r,n),o[ot]=e,yt(o),r=o;break a;case`link`:var s=qf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=Tr(s,h),v=Tr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,F.T=null,n=pu,pu=null;var o=lu,s=du;if(cu=0,uu=lu=null,du=0,zl&6)throw Error(i(331));var c=zl;if(zl|=4,Fl(o.current),Dl(o,o.current,s,n),zl=c,ld(0,!1),L&&typeof L.onPostCommitFiberRoot==`function`)try{L.onPostCommitFiberRoot(I,o)}catch{}return!0}finally{te.p=a,F.T=r,Gu(e,t)}}function Ju(e,t,n){t=vi(n,t),t=Zs(e.stateNode,t,2),e=Wa(e,t,2),e!==null&&(Xe(e,2),cd(e))}function Yu(e,t,n){if(e.tag===3)Ju(e,e,n);else for(;t!==null;){if(t.tag===3){Ju(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(su===null||!su.has(r))){e=vi(n,e),n=Qs(2),r=Wa(t,n,2),r!==null&&($s(n,r,t,e),Xe(r,2),cd(r));break}}t=t.return}}function Xu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Rl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ql=!0,i.add(n),e=Zu.bind(null,e,t,n),t.then(e,e))}function Zu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Bl===e&&(Hl&n)===n&&(K===4||K===3&&(Hl&62914560)===Hl&&300>Oe()-ru?!(zl&2)&&Eu(e,0):Zl|=n,$l===Hl&&($l=0)),cd(e)}function Qu(e,t){t===0&&(t=Je()),e=ri(e,t),e!==null&&(Xe(e,t),cd(e))}function $u(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Qu(e,n)}function ed(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Qu(e,n)}function td(e,t){return we(e,t)}var nd=null,rd=null,id=!1,ad=!1,od=!1,sd=0;function cd(e){e!==rd&&e.next===null&&(rd===null?nd=rd=e:rd=rd.next=e),ad=!0,id||(id=!0,hd())}function ld(e,t){if(!od&&ad){od=!0;do for(var n=!1,r=nd;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Re(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,md(r,a))}else a=Hl,a=Ge(r,r===Bl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ke(r,a)||(n=!0,md(r,a));r=r.next}while(n);od=!1}}function ud(){dd()}function dd(){ad=id=!1;var e=0;sd!==0&&Zd()&&(e=sd);for(var t=Oe(),n=null,r=nd;r!==null;){var i=r.next,a=fd(r,t);a===0?(r.next=null,n===null?nd=i:n.next=i,i===null&&(rd=n)):(n=r,(e!==0||a&3)&&(ad=!0)),r=i}cu!==0&&cu!==5||ld(e,!1),sd!==0&&(sd=0)}function fd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Hd(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function Df(e,t,n){var r=Ef;if(r&&typeof t==`string`&&t){var i=Rt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),xf.has(i)||(xf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Bd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Of(e){Cf.D(e),Df(`dns-prefetch`,e,null)}function kf(e,t){Cf.C(e,t),Df(`preconnect`,e,t)}function Af(e,t,n){Cf.L(e,t,n);var r=Ef;if(r&&e&&t){var i=`link[rel="preload"][as="`+Rt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Rt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Rt(n.imageSizes)+`"]`)):i+=`[href="`+Rt(e)+`"]`;var a=i;switch(t){case`style`:a=If(e);break;case`script`:a=Bf(e)}bf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),bf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Lf(a))||t===`script`&&r.querySelector(Vf(a))||(t=r.createElement(`link`),Bd(t,`link`,e),yt(t),r.head.appendChild(t)))}}function jf(e,t){Cf.m(e,t);var n=Ef;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Rt(r)+`"][href="`+Rt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Bf(e)}if(!bf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),bf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Vf(a)))return}r=n.createElement(`link`),Bd(r,`link`,e),yt(r),n.head.appendChild(r)}}}function Mf(e,t,n){Cf.S(e,t,n);var r=Ef;if(r&&e){var i=vt(r).hoistableStyles,a=If(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Lf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=bf.get(a))&&Wf(e,n);var c=o=r.createElement(`link`);yt(c),Bd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Uf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Nf(e,t){Cf.X(e,t);var n=Ef;if(n&&e){var r=vt(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=m({src:e,async:!0},t),(t=bf.get(i))&&Gf(e,t),a=n.createElement(`script`),yt(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pf(e,t){Cf.M(e,t);var n=Ef;if(n&&e){var r=vt(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=bf.get(i))&&Gf(e,t),a=n.createElement(`script`),yt(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Ff(e,t,n,r){var a=(a=ue.current)?Sf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=If(n.href),n=vt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=If(n.href);var o=vt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Lf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),bf.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},bf.set(e,n),o||zf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Bf(n),n=vt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function If(e){return`href="`+Rt(e)+`"`}function Lf(e){return`link[rel="stylesheet"][`+e+`]`}function Rf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function zf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Bd(t,`link`,n),yt(t),e.head.appendChild(t))}function Bf(e){return`[src="`+Rt(e)+`"]`}function Vf(e){return`script[async]`+e}function Hf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Rt(n.href)+`"]`);if(r)return t.instance=r,yt(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),yt(r),Bd(r,`style`,a),Uf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=If(n.href);var o=e.querySelector(Lf(a));if(o)return t.state.loading|=4,t.instance=o,yt(o),o;r=Rf(n),(a=bf.get(a))&&Wf(r,a),o=(e.ownerDocument||e).createElement(`link`),yt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Bd(o,`link`,r),t.state.loading|=4,Uf(o,n.precedence,e),t.instance=o;case`script`:return o=Bf(n.src),(a=e.querySelector(Vf(o)))?(t.instance=a,yt(a),a):(r=n,(a=bf.get(o))&&(r=m({},n),Gf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),yt(a),Bd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Uf(r,n.precedence,e));return t.instance}function Uf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Yf(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;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Xf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Zf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=If(r.href),a=t.querySelector(Lf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ep.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,yt(a);return}a=t.ownerDocument||t,r=Rf(r),(i=bf.get(i))&&Wf(r,i),a=a.createElement(`link`),yt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Bd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ep.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Qf=0;function $f(e,t){return e.stylesheets&&e.count===0&&np(e,e.stylesheets),0Qf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function ep(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)np(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var tp=null;function np(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,tp=new Map,t.forEach(rp,e),tp=null,ep.call(e))}function rp(e,t){if(!(t.state.loading&4)){var n=tp.get(e);if(n)var r=n.get(null);else{n=new Map,tp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},y=new class extends v{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},b={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},x=new class{#e=b;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function S(e){setTimeout(e,0)}var C=typeof window>`u`||`Deno`in globalThis;function w(){}function T(e,t){return typeof e==`function`?e(t):e}function E(e){return typeof e==`number`&&e>=0&&e!==1/0}function D(e,t){return Math.max(e+(t||0)-Date.now(),0)}function O(e,t){return typeof e==`function`?e(t):e}function k(e,t){return typeof e==`function`?e(t):e}function A(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==M(o,t.options))return!1}else if(!P(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function j(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(N(t.options.mutationKey)!==N(a))return!1}else if(!P(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function M(e,t){return(t?.queryKeyHashFn||N)(e)}function N(e){return JSON.stringify(e,(e,t)=>ne(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function P(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>P(e[n],t[n])):!1}var ee=Object.prototype.hasOwnProperty;function F(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=te(e)&&te(t);if(!r&&!(ne(e)&&ne(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{x.setTimeout(t,e)})}function ae(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:F(e,t)}function oe(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function se(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ce=Symbol();function le(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ce?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ue(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var de=(()=>{let e=()=>C;return{isServer(){return e()},setIsServer(t){e=t}}})();function fe(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var pe=S;function me(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=pe,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var he=me(),ge=new class extends v{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function _e(e){return Math.min(1e3*2**e,3e4)}function ve(e){return(e??`online`)===`online`?ge.isOnline():!0}var ye=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function be(e){let t=!1,n=0,r,i=fe(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new ye(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>y.isFocused()&&(e.networkMode===`always`||ge.isOnline())&&e.canRun(),u=()=>ve(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(de.isServer()?0:3),o=e.retryDelay??_e,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&nl()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var xe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),E(this.gcTime)&&(this.#e=x.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(de.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e&&=(x.clearTimeout(this.#e),void 0)}},Se=class extends xe{#e;#t;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Te(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Te(this.options);e.data!==void 0&&(this.setState(we(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#n.remove(this)}setData(e,t){let n=ae(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#c({type:`setState`,state:e,setStateOptions:t})}cancel(e){let t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(w).catch(w):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#e}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>k(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ce||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>O(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!D(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#i&&(this.#o||this.#s()?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#s(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#i?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{let e=le(this.options,t),n=(()=>{let e={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#o=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};return r(e),e})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta}),this.#i=be({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof ye&&e.revert&&this.setState({...this.#t,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#i.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#n.config.onSuccess?.(e,this),this.#n.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof ye){if(e.silent)return this.#i.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#n.config.onError?.(e,this),this.#n.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Ce(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...we(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),he.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#n.notify({query:this,type:`updated`,action:e})})}};function Ce(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ve(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function we(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Te(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}function Ee(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ue(e,()=>t.signal,()=>n=!0)},u=le(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?se:oe;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Oe:De,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:De(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function De(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Oe(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var ke=class extends xe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ae(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=be({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),he.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ae(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var je=class extends v{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new ke({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Me(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Me(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Me(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Me(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){he.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>j(t,e))}findAll(e={}){return this.getAll().filter(t=>j(e,t))}notify(e){he.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return he.batch(()=>Promise.all(e.map(e=>e.continue().catch(w))))}};function Me(e){return e.options.scope?.id}var Ne=class extends v{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??M(r,t),a=this.get(i);return a||(a=new Se({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){he.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>A(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>A(e,t)):t}notify(e){he.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){he.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){he.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Pe=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ne,this.#t=e.mutationCache||new je,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=y.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ge.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(O(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=T(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return he.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;he.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return he.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=he.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(w).catch(w)}invalidateQueries(e,t={}){return he.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=he.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(w)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(w)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(O(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(w).catch(w)}fetchInfiniteQuery(e){return e.behavior=Ee(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(w).catch(w)}ensureInfiniteQueryData(e){return e.behavior=Ee(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ge.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(N(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{P(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(N(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{P(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=M(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ce&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Fe=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Ie=o(((e,t)=>{t.exports=Fe()})),I=l(d(),1),L=Ie(),Le=I.createContext(void 0),Re=({client:e,children:t})=>(I.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,L.jsx)(Le.Provider,{value:e,children:t})),ze=l(_(),1);typeof window<`u`&&window.document&&window.document.createElement;function R(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Be(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Ve(...e){return t=>{let n=!1,r=e.map(e=>{let r=Be(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{children:t,...r}=e,i=I.useMemo(()=>r,Object.values(r));return(0,L.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=I.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function We(e,t=[]){let n=[];function r(t,r){let i=I.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=I.useMemo(()=>o,Object.values(o));return(0,L.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=I.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>I.createContext(e));return function(n){let r=n?.[e]||t;return I.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Ge(i,...t)]}function Ge(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Ke=l(h(),1);function qe(e){let t=Je(e),n=I.forwardRef((e,n)=>{let{children:r,...i}=e,a=I.Children.toArray(r),o=a.find(Xe);if(o){let e=o.props.children,r=a.map(t=>t===o?I.Children.count(e)>1?I.Children.only(null):I.isValidElement(e)?e.props.children:null:t);return(0,L.jsx)(t,{...i,ref:n,children:I.isValidElement(e)?I.cloneElement(e,void 0,r):null})}return(0,L.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Je(e){let t=I.forwardRef((e,t)=>{let{children:n,...r}=e;if(I.isValidElement(n)){let e=Qe(n),i=Ze(r,n.props);return n.type!==I.Fragment&&(i.ref=t?Ve(t,e):e),I.cloneElement(n,i)}return I.Children.count(n)>1?I.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ye=Symbol(`radix.slottable`);function Xe(e){return I.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ye}function Ze(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Qe(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $e=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=qe(`Primitive.${t}`),r=I.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,L.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function et(e,t){e&&Ke.flushSync(()=>e.dispatchEvent(t))}function tt(e){let t=I.useRef(e);return I.useEffect(()=>{t.current=e}),I.useMemo(()=>(...e)=>t.current?.(...e),[])}function nt(e,t=globalThis?.document){let n=tt(e);I.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var rt=`DismissableLayer`,it=`dismissableLayer.update`,at=`dismissableLayer.pointerDownOutside`,ot=`dismissableLayer.focusOutside`,st,ct=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),lt=I.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=I.useContext(ct),[u,d]=I.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=I.useState({}),m=He(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=ft(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=pt(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return nt(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),I.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(st=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),mt(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=st)}},[u,f,n,l]),I.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),mt())},[u,l]),I.useEffect(()=>{let e=()=>p({});return document.addEventListener(it,e),()=>document.removeEventListener(it,e)},[]),(0,L.jsx)($e.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:R(e.onFocusCapture,S.onFocusCapture),onBlurCapture:R(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:R(e.onPointerDownCapture,x.onPointerDownCapture)})});lt.displayName=rt;var ut=`DismissableLayerBranch`,dt=I.forwardRef((e,t)=>{let n=I.useContext(ct),r=I.useRef(null),i=He(t,r);return I.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,L.jsx)($e.div,{...e,ref:i})});dt.displayName=ut;function ft(e,t=globalThis?.document){let n=tt(e),r=I.useRef(!1),i=I.useRef(()=>{});return I.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){ht(at,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function pt(e,t=globalThis?.document){let n=tt(e),r=I.useRef(!1);return I.useEffect(()=>{let e=e=>{e.target&&!r.current&&ht(ot,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function mt(){let e=new CustomEvent(it);document.dispatchEvent(e)}function ht(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?et(i,a):i.dispatchEvent(a)}var gt=globalThis?.document?I.useLayoutEffect:()=>{},_t=I.useId||(()=>void 0),vt=0;function yt(e){let[t,n]=I.useState(_t());return gt(()=>{e||n(e=>e??String(vt++))},[e]),e||(t?`radix-${t}`:``)}var bt=[`top`,`right`,`bottom`,`left`],xt=Math.min,St=Math.max,Ct=Math.round,wt=Math.floor,Tt=e=>({x:e,y:e}),Et={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Dt(e,t,n){return St(e,xt(t,n))}function Ot(e,t){return typeof e==`function`?e(t):e}function kt(e){return e.split(`-`)[0]}function At(e){return e.split(`-`)[1]}function jt(e){return e===`x`?`y`:`x`}function Mt(e){return e===`y`?`height`:`width`}function Nt(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Pt(e){return jt(Nt(e))}function Ft(e,t,n){n===void 0&&(n=!1);let r=At(e),i=Pt(e),a=Mt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Wt(o)),[o,Wt(o)]}function It(e){let t=Wt(e);return[Lt(e),t,Lt(t)]}function Lt(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Rt=[`left`,`right`],zt=[`right`,`left`],Bt=[`top`,`bottom`],Vt=[`bottom`,`top`];function Ht(e,t,n){switch(e){case`top`:case`bottom`:return n?t?zt:Rt:t?Rt:zt;case`left`:case`right`:return t?Bt:Vt;default:return[]}}function Ut(e,t,n,r){let i=At(e),a=Ht(kt(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Lt)))),a}function Wt(e){let t=kt(e);return Et[t]+e.slice(t.length)}function Gt(e){return{top:0,right:0,bottom:0,left:0,...e}}function Kt(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Gt(e)}function qt(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Jt(e,t,n){let{reference:r,floating:i}=e,a=Nt(t),o=Pt(t),s=Mt(o),c=kt(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(At(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Yt(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Ot(t,e),p=Kt(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=qt(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=qt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Xt=50,Zt=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Yt},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Jt(l,r,c),f=r,p=0,m={};for(let n=0;n({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Ot(e,t)||{};if(l==null)return{};let d=Kt(u),f={x:n,y:r},p=Pt(i),m=Mt(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=xt(d[_],T),D=xt(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Dt(O,A,k),M=!c.arrow&&At(i)!=null&&A!==j&&a.reference[m]/2-(Ae<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Nt(t))||T.every(e=>Nt(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Nt(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function en(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function tn(e){return bt.some(t=>e[t]>=0)}var nn=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Ot(e,t);switch(i){case`referenceHidden`:{let e=en(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:tn(e)}}}case`escaped`:{let e=en(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:tn(e)}}}default:return{}}}}},rn=new Set([`left`,`top`]);async function an(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=kt(n),s=At(n),c=Nt(n)===`y`,l=rn.has(o)?-1:1,u=a&&c?-1:1,d=Ot(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var on=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await an(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},sn=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Ot(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Nt(kt(i)),p=jt(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Dt(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Dt(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},cn=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Ot(e,t),u={x:n,y:r},d=Nt(i),f=jt(d),p=u[f],m=u[d],h=Ot(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=rn.has(kt(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},ln=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Ot(e,t),u=await o.detectOverflow(t,l),d=kt(i),f=At(i),p=Nt(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=xt(h-u[g],v),x=xt(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=St(u.left,0),t=St(u.right,0),n=St(u.top,0),r=St(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:St(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:St(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function un(){return typeof window<`u`}function dn(e){return mn(e)?(e.nodeName||``).toLowerCase():`#document`}function fn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pn(e){return((mn(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function mn(e){return un()?e instanceof Node||e instanceof fn(e).Node:!1}function hn(e){return un()?e instanceof Element||e instanceof fn(e).Element:!1}function gn(e){return un()?e instanceof HTMLElement||e instanceof fn(e).HTMLElement:!1}function _n(e){return!un()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof fn(e).ShadowRoot}function vn(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=kn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function yn(e){return/^(table|td|th)$/.test(dn(e))}function bn(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var xn=/transform|translate|scale|rotate|perspective|filter/,Sn=/paint|layout|strict|content/,Cn=e=>!!e&&e!==`none`,wn;function Tn(e){let t=hn(e)?kn(e):e;return Cn(t.transform)||Cn(t.translate)||Cn(t.scale)||Cn(t.rotate)||Cn(t.perspective)||!Dn()&&(Cn(t.backdropFilter)||Cn(t.filter))||xn.test(t.willChange||``)||Sn.test(t.contain||``)}function En(e){let t=jn(e);for(;gn(t)&&!On(t);){if(Tn(t))return t;if(bn(t))return null;t=jn(t)}return null}function Dn(){return wn??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),wn}function On(e){return/^(html|body|#document)$/.test(dn(e))}function kn(e){return fn(e).getComputedStyle(e)}function An(e){return hn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function jn(e){if(dn(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||_n(e)&&e.host||pn(e);return _n(t)?t.host:t}function Mn(e){let t=jn(e);return On(t)?e.ownerDocument?e.ownerDocument.body:e.body:gn(t)&&vn(t)?t:Mn(t)}function Nn(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Mn(e),i=r===e.ownerDocument?.body,a=fn(r);if(i){let e=Pn(a);return t.concat(a,a.visualViewport||[],vn(r)?r:[],e&&n?Nn(e):[])}else return t.concat(r,Nn(r,[],n))}function Pn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Fn(e){let t=kn(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=gn(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ct(n)!==a||Ct(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function In(e){return hn(e)?e:e.contextElement}function Ln(e){let t=In(e);if(!gn(t))return Tt(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Fn(t),o=(a?Ct(n.width):n.width)/r,s=(a?Ct(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Rn=Tt(0);function zn(e){let t=fn(e);return!Dn()||!t.visualViewport?Rn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==fn(e)?!1:t}function Vn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=In(e),o=Tt(1);t&&(r?hn(r)&&(o=Ln(r)):o=Ln(e));let s=Bn(a,n,r)?zn(a):Tt(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=fn(a),t=r&&hn(r)?fn(r):r,n=e,i=Pn(n);for(;i&&r&&t!==n;){let e=Ln(i),t=i.getBoundingClientRect(),r=kn(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=fn(i),i=Pn(n)}}return qt({width:u,height:d,x:c,y:l})}function Hn(e,t){let n=An(e).scrollLeft;return t?t.left+n:Vn(pn(e)).left+n}function Un(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Hn(e,n),y:n.top+t.scrollTop}}function Wn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=pn(r),s=t?bn(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Tt(1),u=Tt(0),d=gn(r);if((d||!d&&!a)&&((dn(r)!==`body`||vn(o))&&(c=An(r)),d)){let e=Vn(r);l=Ln(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Un(o,c):Tt(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Gn(e){return Array.from(e.getClientRects())}function Kn(e){let t=pn(e),n=An(e),r=e.ownerDocument.body,i=St(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=St(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Hn(e),s=-n.scrollTop;return kn(r).direction===`rtl`&&(o+=St(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var qn=25;function Jn(e,t){let n=fn(e),r=pn(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Dn();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Hn(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=qn&&(a-=o)}else l<=qn&&(a+=l);return{width:a,height:o,x:s,y:c}}function Yn(e,t){let n=Vn(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=gn(e)?Ln(e):Tt(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Xn(e,t,n){let r;if(t===`viewport`)r=Jn(e,n);else if(t===`document`)r=Kn(pn(e));else if(hn(t))r=Yn(t,n);else{let n=zn(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return qt(r)}function Zn(e,t){let n=jn(e);return n===t||!hn(n)||On(n)?!1:kn(n).position===`fixed`||Zn(n,t)}function Qn(e,t){let n=t.get(e);if(n)return n;let r=Nn(e,[],!1).filter(e=>hn(e)&&dn(e)!==`body`),i=null,a=kn(e).position===`fixed`,o=a?jn(e):e;for(;hn(o)&&!On(o);){let t=kn(o),n=Tn(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||vn(o)&&!n&&Zn(e,o))?r=r.filter(e=>e!==o):i=t,o=jn(o)}return t.set(e,r),r}function $n(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?bn(t)?[]:Qn(t,this._c):[].concat(n),r],o=Xn(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{o(!1,1e-7)},1e3)}n===1&&!cr(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function ur(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=In(e),u=i||a?[...l?Nn(l):[],...t?Nn(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?lr(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Vn(e):null;c&&g();function g(){let t=Vn(e);h&&!cr(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var dr=on,fr=sn,pr=$t,mr=ln,hr=nn,gr=Qt,_r=cn,vr=(e,t,n)=>{let r=new Map,i={platform:sr,...n},a={...i.platform,_c:r};return Zt(e,t,{...i,platform:a})},yr=typeof document<`u`?I.useLayoutEffect:function(){};function br(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!br(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!br(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function xr(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Sr(e,t){let n=xr(e);return Math.round(t*n)/n}function Cr(e){let t=I.useRef(e);return yr(()=>{t.current=e}),t}function wr(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=I.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=I.useState(r);br(f,r)||p(r);let[m,h]=I.useState(null),[g,_]=I.useState(null),v=I.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=I.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=I.useRef(null),C=I.useRef(null),w=I.useRef(u),T=c!=null,E=Cr(c),D=Cr(i),O=Cr(l),k=I.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),vr(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!br(w.current,t)&&(w.current=t,Ke.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);yr(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=I.useRef(!1);yr(()=>(A.current=!0,()=>{A.current=!1}),[]),yr(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=I.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=I.useMemo(()=>({reference:b,floating:x}),[b,x]),N=I.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Sr(M.floating,u.x),r=Sr(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...xr(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return I.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Tr=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:gr({element:r.current,padding:i}).fn(n):r?gr({element:r,padding:i}).fn(n):{}}}},Er=(e,t)=>{let n=dr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dr=(e,t)=>{let n=fr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Or=(e,t)=>({fn:_r(e).fn,options:[e,t]}),kr=(e,t)=>{let n=pr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ar=(e,t)=>{let n=mr(e);return{name:n.name,fn:n.fn,options:[e,t]}},jr=(e,t)=>{let n=hr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mr=(e,t)=>{let n=Tr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Nr=`Arrow`,Pr=I.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,L.jsx)($e.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,L.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Pr.displayName=Nr;var Fr=Pr;function Ir(e){let[t,n]=I.useState(void 0);return gt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Lr=`Popper`,[Rr,zr]=We(Lr),[Br,Vr]=Rr(Lr),Hr=e=>{let{__scopePopper:t,children:n}=e,[r,i]=I.useState(null);return(0,L.jsx)(Br,{scope:t,anchor:r,onAnchorChange:i,children:n})};Hr.displayName=Lr;var Ur=`PopperAnchor`,Wr=I.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Vr(Ur,n),o=I.useRef(null),s=He(t,o),c=I.useRef(null);return I.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,L.jsx)($e.div,{...i,ref:s})});Wr.displayName=Ur;var Gr=`PopperContent`,[Kr,qr]=Rr(Gr),Jr=I.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Vr(Gr,n),[_,v]=I.useState(null),y=He(t,e=>v(e)),[b,x]=I.useState(null),S=Ir(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(Qr),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=wr({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>ur(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Er({mainAxis:i+w,alignmentAxis:o}),c&&Dr({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Or():void 0,...k}),c&&kr({...k}),Ar({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&Mr({element:b,padding:s}),$r({arrowWidth:C,arrowHeight:w}),f&&jr({strategy:`referenceHidden`,...k})]}),[ee,F]=ei(M),te=tt(m);gt(()=>{N&&te?.()},[N,te]);let ne=P.arrow?.x,re=P.arrow?.y,ie=P.arrow?.centerOffset!==0,[ae,oe]=I.useState();return gt(()=>{_&&oe(window.getComputedStyle(_).zIndex)},[_]),(0,L.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,L.jsx)(Kr,{scope:n,placedSide:ee,onArrowChange:x,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,L.jsx)($e.div,{"data-side":ee,"data-align":F,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});Jr.displayName=Gr;var Yr=`PopperArrow`,Xr={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Zr=I.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=qr(Yr,n),a=Xr[i.placedSide];return(0,L.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,L.jsx)(Fr,{...r,ref:t,style:{...r.style,display:`block`}})})});Zr.displayName=Yr;function Qr(e){return e!==null}var $r=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=ei(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function ei(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var ti=Hr,ni=Wr,ri=Jr,ii=Zr,ai=`Portal`,oi=I.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=I.useState(!1);gt(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Ke.createPortal((0,L.jsx)($e.div,{...r,ref:t}),o):null});oi.displayName=ai;function si(e,t){return I.useReducer((e,n)=>t[e][n]??e,e)}var ci=e=>{let{present:t,children:n}=e,r=li(t),i=typeof n==`function`?n({present:r.isPresent}):I.Children.only(n),a=He(r.ref,di(i));return typeof n==`function`||r.isPresent?I.cloneElement(i,{ref:a}):null};ci.displayName=`Presence`;function li(e){let[t,n]=I.useState(),r=I.useRef(null),i=I.useRef(e),a=I.useRef(`none`),[o,s]=si(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return I.useEffect(()=>{let e=ui(r.current);a.current=o===`mounted`?e:`none`},[o]),gt(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=ui(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),gt(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=ui(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=ui(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:I.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function ui(e){return e?.animationName||`none`}function di(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var fi=Symbol(`radix.slottable`);function pi(e){let t=({children:e})=>(0,L.jsx)(L.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=fi,t}var mi=I.useInsertionEffect||gt;function hi({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=gi({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=I.useRef(e!==void 0);I.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`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.`),t.current=s},[s,r])}return[c,I.useCallback(t=>{if(s){let n=_i(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function gi({defaultProp:e,onChange:t}){let[n,r]=I.useState(e),i=I.useRef(n),a=I.useRef(t);return mi(()=>{a.current=t},[t]),I.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function _i(e){return typeof e==`function`}var vi=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),yi=`VisuallyHidden`,bi=I.forwardRef((e,t)=>(0,L.jsx)($e.span,{...e,ref:t,style:{...vi,...e.style}}));bi.displayName=yi;var xi=bi,[Si,Ci]=We(`Tooltip`,[zr]),wi=zr(),Ti=`TooltipProvider`,Ei=700,Di=`tooltip.open`,[Oi,ki]=Si(Ti),Ai=e=>{let{__scopeTooltip:t,delayDuration:n=Ei,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=I.useRef(!0),s=I.useRef(!1),c=I.useRef(0);return I.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,L.jsx)(Oi,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:I.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:I.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:I.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Ai.displayName=Ti;var ji=`Tooltip`,[Mi,Ni]=Si(ji),Pi=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=ki(ji,e.__scopeTooltip),l=wi(t),[u,d]=I.useState(null),f=yt(),p=I.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=I.useRef(!1),[_,v]=hi({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Di))):c.onClose(),a?.(e)},caller:ji}),y=I.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=I.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=I.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=I.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return I.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,L.jsx)(ti,{...l,children:(0,L.jsx)(Mi,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:I.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:I.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};Pi.displayName=ji;var Fi=`TooltipTrigger`,Ii=I.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Ni(Fi,n),a=ki(Fi,n),o=wi(n),s=He(t,I.useRef(null),i.onTriggerChange),c=I.useRef(!1),l=I.useRef(!1),u=I.useCallback(()=>c.current=!1,[]);return I.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,L.jsx)(ni,{asChild:!0,...o,children:(0,L.jsx)($e.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:R(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:R(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:R(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:R(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:R(e.onBlur,i.onClose),onClick:R(e.onClick,i.onClose)})})});Ii.displayName=Fi;var Li=`TooltipPortal`,[Ri,zi]=Si(Li,{forceMount:void 0}),Bi=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Ni(Li,t);return(0,L.jsx)(Ri,{scope:t,forceMount:n,children:(0,L.jsx)(ci,{present:n||a.open,children:(0,L.jsx)(oi,{asChild:!0,container:i,children:r})})})};Bi.displayName=Li;var Vi=`TooltipContent`,Hi=I.forwardRef((e,t)=>{let n=zi(Vi,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Ni(Vi,e.__scopeTooltip);return(0,L.jsx)(ci,{present:r||o.open,children:o.disableHoverableContent?(0,L.jsx)(qi,{side:i,...a,ref:t}):(0,L.jsx)(Ui,{side:i,...a,ref:t})})}),Ui=I.forwardRef((e,t)=>{let n=Ni(Vi,e.__scopeTooltip),r=ki(Vi,e.__scopeTooltip),i=I.useRef(null),a=He(t,i),[o,s]=I.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=I.useCallback(()=>{s(null),d(!1)},[d]),p=I.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Zi(r,Xi(r,n.getBoundingClientRect())),a=Qi(t.getBoundingClientRect());s(ea([...i,...a])),d(!0)},[d]);return I.useEffect(()=>()=>f(),[f]),I.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),I.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!$i(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,L.jsx)(qi,{...e,ref:a})}),[Wi,Gi]=Si(ji,{isInside:!1}),Ki=pi(`TooltipContent`),qi=I.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Ni(Vi,n),l=wi(n),{onClose:u}=c;return I.useEffect(()=>(document.addEventListener(Di,u),()=>document.removeEventListener(Di,u)),[u]),I.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,L.jsx)(lt,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,L.jsxs)(ri,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,L.jsx)(Ki,{children:r}),(0,L.jsx)(Wi,{scope:n,isInside:!0,children:(0,L.jsx)(xi,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Hi.displayName=Vi;var Ji=`TooltipArrow`,Yi=I.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=wi(n);return Gi(Ji,n).isInside?null:(0,L.jsx)(ii,{...i,...r,ref:t})});Yi.displayName=Ji;function Xi(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Zi(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Qi(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function $i(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ea(e){let t=e.slice();return t.sort((e,t)=>e.xt.x?1:e.yt.y)),ta(t)}function ta(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var na=Ai,ra=Pi,ia=Ii,aa=Hi;function oa(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t{let n=Array(e.length+t.length);for(let t=0;t({classGroupId:e,validator:t}),la=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ua=`-`,da=[],fa=`arbitrary..`,pa=e=>{let t=ga(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return ha(e);let n=e.split(ua);return ma(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?sa(i,t):t:i||da}return n[e]||da}}},ma=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=ma(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(ua):e.slice(t).join(ua),s=a.length;for(let e=0;ee.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?fa+r:void 0})(),ga=e=>{let{theme:t,classGroups:n}=e;return _a(n,t)},_a=(e,t)=>{let n=la();for(let r in e){let i=e[r];va(i,n,r,t)}return n},va=(e,t,n,r)=>{let i=e.length;for(let a=0;a{if(typeof e==`string`){ba(e,t,n);return}if(typeof e==`function`){xa(e,t,n,r);return}Sa(e,t,n,r)},ba=(e,t,n)=>{let r=e===``?t:Ca(t,e);r.classGroupId=n},xa=(e,t,n,r)=>{if(wa(e)){va(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ca(n,e))},Sa=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e{let n=e,r=t.split(ua),i=r.length;for(let e=0;e`isThemeGetter`in e&&e.isThemeGetter===!0,Ta=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ea=`!`,Da=`:`,Oa=[],ka=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Aa=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;si?a-i:void 0;return ka(t,l,c,u)};if(t){let e=t+Da,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):ka(Oa,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ja=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ma=e=>({cache:Ta(e.cacheSize),parseClassName:Aa(e),sortModifiers:ja(e),...pa(e)}),Na=/\s+/,Pa=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Na),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Ea:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e0?` `+c:c)}return c},Fa=(...e)=>{let t=0,n,r,i=``;for(;t{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r{let n,r,i,a,o=o=>(n=Ma(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Pa(e,n);return i(e,a),a};return a=o,(...e)=>a(Fa(...e))},Ra=[],za=e=>{let t=t=>t[e]||Ra;return t.isThemeGetter=!0,t},Ba=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Va=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ha=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ua=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Wa=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ga=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ka=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qa=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ja=e=>Ha.test(e),Ya=e=>!!e&&!Number.isNaN(Number(e)),Xa=e=>!!e&&Number.isInteger(Number(e)),Za=e=>e.endsWith(`%`)&&Ya(e.slice(0,-1)),Qa=e=>Ua.test(e),$a=()=>!0,eo=e=>Wa.test(e)&&!Ga.test(e),to=()=>!1,no=e=>Ka.test(e),ro=e=>qa.test(e),io=e=>!B(e)&&!H(e),ao=e=>bo(e,wo,to),B=e=>Ba.test(e),oo=e=>bo(e,To,eo),so=e=>bo(e,Eo,Ya),co=e=>bo(e,Oo,$a),lo=e=>bo(e,Do,to),uo=e=>bo(e,So,to),fo=e=>bo(e,Co,ro),V=e=>bo(e,ko,no),H=e=>Va.test(e),po=e=>xo(e,To),mo=e=>xo(e,Do),ho=e=>xo(e,So),go=e=>xo(e,wo),_o=e=>xo(e,Co),vo=e=>xo(e,ko,!0),yo=e=>xo(e,Oo,!0),bo=(e,t,n)=>{let r=Ba.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},xo=(e,t,n=!1)=>{let r=Va.exec(e);return r?r[1]?t(r[1]):n:!1},So=e=>e===`position`||e===`percentage`,Co=e=>e===`image`||e===`url`,wo=e=>e===`length`||e===`size`||e===`bg-size`,To=e=>e===`length`,Eo=e=>e===`number`,Do=e=>e===`family-name`,Oo=e=>e===`number`||e===`weight`,ko=e=>e===`shadow`,Ao=La(()=>{let e=za(`color`),t=za(`font`),n=za(`text`),r=za(`font-weight`),i=za(`tracking`),a=za(`leading`),o=za(`breakpoint`),s=za(`container`),c=za(`spacing`),l=za(`radius`),u=za(`shadow`),d=za(`inset-shadow`),f=za(`text-shadow`),p=za(`drop-shadow`),m=za(`blur`),h=za(`perspective`),g=za(`aspect`),_=za(`ease`),v=za(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),H,B],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[H,B,c],T=()=>[Ja,`full`,`auto`,...w()],E=()=>[Xa,`none`,`subgrid`,H,B],D=()=>[`auto`,{span:[`full`,Xa,H,B]},Xa,H,B],O=()=>[Xa,`auto`,H,B],k=()=>[`auto`,`min`,`max`,`fr`,H,B],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Ja,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Ja,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ee=()=>[Ja,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],F=()=>[e,H,B],te=()=>[...b(),ho,uo,{position:[H,B]}],ne=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],re=()=>[`auto`,`cover`,`contain`,go,ao,{size:[H,B]}],ie=()=>[Za,po,oo],ae=()=>[``,`none`,`full`,l,H,B],oe=()=>[``,Ya,po,oo],se=()=>[`solid`,`dashed`,`dotted`,`double`],ce=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],le=()=>[Ya,Za,ho,uo],ue=()=>[``,`none`,m,H,B],de=()=>[`none`,Ya,H,B],fe=()=>[`none`,Ya,H,B],pe=()=>[Ya,H,B],me=()=>[Ja,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Qa],breakpoint:[Qa],color:[$a],container:[Qa],"drop-shadow":[Qa],ease:[`in`,`out`,`in-out`],font:[io],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Qa],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Qa],shadow:[Qa],spacing:[`px`,Ya],text:[Qa],"text-shadow":[Qa],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Ja,B,H,g]}],container:[`container`],columns:[{columns:[Ya,B,H,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Xa,`auto`,H,B]}],basis:[{basis:[Ja,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Ya,Ja,`auto`,`initial`,`none`,B]}],grow:[{grow:[``,Ya,H,B]}],shrink:[{shrink:[``,Ya,H,B]}],order:[{order:[Xa,`first`,`last`,`none`,H,B]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...ee()]}],"min-block-size":[{"min-block":[`auto`,...ee()]}],"max-block-size":[{"max-block":[`none`,...ee()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,po,oo]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,yo,co]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Za,B]}],"font-family":[{font:[mo,lo,t]}],"font-features":[{"font-features":[B]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,H,B]}],"line-clamp":[{"line-clamp":[Ya,`none`,H,so]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,H,B]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,H,B]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...se(),`wavy`]}],"text-decoration-thickness":[{decoration:[Ya,`from-font`,`auto`,H,oo]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Ya,`auto`,H,B]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,H,B]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,H,B]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:te()}],"bg-repeat":[{bg:ne()}],"bg-size":[{bg:re()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Xa,H,B],radial:[``,H,B],conic:[Xa,H,B]},_o,fo]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...se(),`hidden`,`none`]}],"divide-style":[{divide:[...se(),`hidden`,`none`]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...se(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Ya,H,B]}],"outline-w":[{outline:[``,Ya,po,oo]}],"outline-color":[{outline:F()}],shadow:[{shadow:[``,`none`,u,vo,V]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":[`none`,d,vo,V]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:oe()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Ya,oo]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":[`none`,f,vo,V]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Ya,H,B]}],"mix-blend":[{"mix-blend":[...ce(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Ya]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[H,B]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Ya]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:te()}],"mask-repeat":[{mask:ne()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,H,B]}],filter:[{filter:[``,`none`,H,B]}],blur:[{blur:ue()}],brightness:[{brightness:[Ya,H,B]}],contrast:[{contrast:[Ya,H,B]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,vo,V]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:[``,Ya,H,B]}],"hue-rotate":[{"hue-rotate":[Ya,H,B]}],invert:[{invert:[``,Ya,H,B]}],saturate:[{saturate:[Ya,H,B]}],sepia:[{sepia:[``,Ya,H,B]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,H,B]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[Ya,H,B]}],"backdrop-contrast":[{"backdrop-contrast":[Ya,H,B]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Ya,H,B]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ya,H,B]}],"backdrop-invert":[{"backdrop-invert":[``,Ya,H,B]}],"backdrop-opacity":[{"backdrop-opacity":[Ya,H,B]}],"backdrop-saturate":[{"backdrop-saturate":[Ya,H,B]}],"backdrop-sepia":[{"backdrop-sepia":[``,Ya,H,B]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,H,B]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Ya,`initial`,H,B]}],ease:[{ease:[`linear`,`initial`,_,H,B]}],delay:[{delay:[Ya,H,B]}],animate:[{animate:[`none`,v,H,B]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,H,B]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":[`scale-3d`],skew:[{skew:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[H,B,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":[`translate-none`],accent:[{accent:F()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,H,B]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,H,B]}],fill:[{fill:[`none`,...F()]}],"stroke-w":[{stroke:[Ya,po,oo,so]}],stroke:[{stroke:[`none`,...F()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function U(...e){return Ao(z(e))}function jo(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function Mo(e){return e===void 0?`text-zinc-500`:e<20?`text-emerald-400`:e<80?`text-yellow-400`:`text-red-400`}var No=na,Po=ra,Fo=ia,Io=I.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,L.jsx)(aa,{ref:r,sideOffset:t,className:U(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]`,e),...n}));Io.displayName=aa.displayName;var Lo=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Ro=(e=>e?Lo(e):Lo),zo=e=>e;function Bo(e,t=zo){let n=I.useSyncExternalStore(e.subscribe,I.useCallback(()=>t(e.getState()),[e,t]),I.useCallback(()=>t(e.getInitialState()),[e,t]));return I.useDebugValue(n),n}var Vo=e=>{let t=Ro(e),n=e=>Bo(t,e);return Object.assign(n,t),n},Ho=(e=>e?Vo(e):Vo),Uo=Ho((e,t)=>({activeView:`explore`,setActiveView:t=>e({activeView:t}),selectedIds:new Set,inspectedModel:null,comparisonModels:[],select:t=>{e(e=>({selectedIds:new Set([...e.selectedIds,t])}))},deselect:t=>{e(e=>{let n=new Set(e.selectedIds);return n.delete(t),{selectedIds:n}})},toggleSelect:e=>{let n=t();n.selectedIds.has(e.id)?n.deselect(e.id):n.select(e.id)},clearSelection:()=>{e({selectedIds:new Set})},setInspected:t=>{e({inspectedModel:t})},setActiveVersion:t=>{e(e=>e.inspectedModel?{inspectedModel:{...e.inspectedModel,active_version:t}}:e)},addToComparison:t=>{e(e=>e.comparisonModels.find(e=>e.id===t.id)||e.comparisonModels.length>=4?e:{comparisonModels:[...e.comparisonModels,t]})},removeFromComparison:t=>{e(e=>({comparisonModels:e.comparisonModels.filter(e=>e.id!==t)}))},clearComparison:()=>{e({comparisonModels:[]})},isSelected:e=>t().selectedIds.has(e),isInComparison:e=>t().comparisonModels.some(t=>t.id===e)})),Wo=`http://127.0.0.1:8005`,Go=`https://kumar2421-mlforge-backend.hf.space`;console.log(`[API] Dual Backend Configured:`),console.log(` - Local (Muscle):`,Wo),console.log(` - Cloud (Brain):`,Go);var Ko=s({checkBackendHealth:()=>es,deleteProjectRecord:()=>ss,fetchJobById:()=>ns,fetchModels:()=>ts,fetchProjects:()=>is,fetchSystemMetrics:()=>cs,markProjectOpened:()=>os,openSystemMetricsStream:()=>ls,triggerDownload:()=>rs,upsertProject:()=>as}),qo=Wo,Jo=Go;console.log(`[API] Base URL configured as:`,qo);function Yo(e){let t=[];for(let[n,r]of Object.entries(e))r==null||r===``||(Array.isArray(r)?r.forEach(e=>t.push(`${n}=${encodeURIComponent(String(e))}`)):t.push(`${n}=${encodeURIComponent(String(r))}`));return t.length?`?${t.join(`&`)}`:``}async function Xo(e){let t=await fetch(`${Jo}${e}`,{headers:{Accept:`application/json`}});if(!t.ok){let e=await t.text();throw Error(`Cloud API ${t.status}: ${e}`)}return t.json()}async function Zo(e){let t=await fetch(`${qo}${e}`,{headers:{Accept:`application/json`}});if(!t.ok){let e=await t.text();throw Error(`API ${t.status}: ${e}`)}return t.json()}async function Qo(e,t){let n=await fetch(`${qo}${e}`,{headers:{Accept:`application/json`,...t.body?{"Content-Type":`application/json`}:{},...t.headers??{}},...t});if(!n.ok){let e=await n.text();throw Error(`API ${n.status}: ${e}`)}if(n.status!==204)return n.json()}var $o=null;async function es(){if($o!==null)return $o;try{$o=(await Promise.race([Zo(`/health`),new Promise((e,t)=>setTimeout(()=>t(Error(`timeout`)),2500))])).status===`ok`}catch{$o=!1}return $o}async function ts(e={}){return Xo(`/models${Yo(e)}`)}async function ns(e){try{return await Zo(`/jobs/${e}`)}catch{return null}}async function rs(e,t,n){if(!await es())throw Error(`Backend offline`);let r=await fetch(`${qo}/download`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({model_id:e,model_name:t,version:n})});if(!r.ok)throw Error(`Download failed: ${r.status}`);return r.json()}async function is(){return Xo(`/projects`)}async function as(e){if(!await es())throw Error(`Backend offline`);return Qo(`/projects`,{method:`POST`,body:JSON.stringify(e)})}async function os(e){await es()&&await Qo(`/projects/${encodeURIComponent(e)}/open`,{method:`POST`})}async function ss(e){await es()&&await Qo(`/projects/${encodeURIComponent(e)}`,{method:`DELETE`})}async function cs(e=0){if(!await es())throw Error(`Backend offline`);return Zo(`/system/metrics?gpu_index=${encodeURIComponent(String(e))}`)}function ls(e={}){let t=e.gpu_index??0,n=e.hz??2,r=window.location.hostname===`localhost`||window.location.hostname===`127.0.0.1`,i=r?`/system/metrics/stream?gpu_index=${encodeURIComponent(String(t))}&hz=${encodeURIComponent(String(n))}`:`${qo}/system/metrics/stream?gpu_index=${encodeURIComponent(String(t))}&hz=${encodeURIComponent(String(n))}`;console.log(`[API] Opening metrics stream:`,i,`Proxied:`,r);let a=new EventSource(i);return a.onopen=()=>console.log(`[API] Metrics stream opened successfully`),a.onerror=e=>{console.error(`[API] Metrics stream error state:`,a.readyState),console.error(`[API] Metrics stream error details:`,e)},a}var us=[];for(let e=0;e<256;++e)us.push((e+256).toString(16).slice(1));function ds(e,t=0){return(us[e[t+0]]+us[e[t+1]]+us[e[t+2]]+us[e[t+3]]+`-`+us[e[t+4]]+us[e[t+5]]+`-`+us[e[t+6]]+us[e[t+7]]+`-`+us[e[t+8]]+us[e[t+9]]+`-`+us[e[t+10]]+us[e[t+11]]+us[e[t+12]]+us[e[t+13]]+us[e[t+14]]+us[e[t+15]]).toLowerCase()}var fs=new Uint8Array(16);function ps(){return crypto.getRandomValues(fs)}function ms(e,t,n){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():hs(e,t,n)}function hs(e,t,n){e||={};let r=e.random??e.rng?.()??ps();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return ds(r)}function gs(e){return Array.isArray?Array.isArray(e):Ds(e)===`[object Array]`}var _s=1/0;function vs(e){if(typeof e==`string`)return e;let t=e+``;return t==`0`&&1/e==-_s?`-0`:t}function ys(e){return e==null?``:vs(e)}function bs(e){return typeof e==`string`}function xs(e){return typeof e==`number`}function Ss(e){return e===!0||e===!1||ws(e)&&Ds(e)==`[object Boolean]`}function Cs(e){return typeof e==`object`}function ws(e){return Cs(e)&&e!==null}function Ts(e){return e!=null}function Es(e){return!e.trim().length}function Ds(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var Os=`Incorrect 'index' type`,ks=e=>`Invalid value for key ${e}`,As=e=>`Pattern length exceeds max of ${e}.`,js=e=>`Missing ${e} property in key`,Ms=e=>`Property 'weight' in key '${e}' must be a positive integer`,Ns=Object.prototype.hasOwnProperty,Ps=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=Fs(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function Fs(e){let t=null,n=null,r=null,i=1,a=null;if(bs(e)||gs(e))r=e,t=Is(e),n=Ls(e);else{if(!Ns.call(e,`name`))throw Error(js(`name`));let o=e.name;if(r=o,Ns.call(e,`weight`)&&(i=e.weight,i<=0))throw Error(Ms(o));t=Is(o),n=Ls(o),a=e.getFn}return{path:t,id:n,weight:i,src:r,getFn:a}}function Is(e){return gs(e)?e:e.split(`.`)}function Ls(e){return gs(e)?e.join(`.`):e}function Rs(e,t){let n=[],r=!1,i=(e,t,a)=>{if(Ts(e))if(!t[a])n.push(e);else{let o=e[t[a]];if(!Ts(o))return;if(a===t.length-1&&(bs(o)||xs(o)||Ss(o)))n.push(ys(o));else if(gs(o)){r=!0;for(let e=0,n=o.length;ee.score===t.score?e.idx{this._keysMap[e.id]=t})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,bs(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){let t=this.size();bs(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t{let i=t.getFn?t.getFn(e):this.getFn(e,t.path);if(Ts(i)){if(gs(i)){let e=[],t=[{nestedArrIndex:-1,value:i}];for(;t.length;){let{nestedArrIndex:n,value:r}=t.pop();if(Ts(r))if(bs(r)&&!Es(r)){let t={v:r,i:n,n:this.norm.get(r)};e.push(t)}else gs(r)&&r.forEach((e,n)=>{t.push({nestedArrIndex:n,value:e})})}n.$[r]=e}else if(bs(i)&&!Es(i)){let e={v:i,n:this.norm.get(i)};n.$[r]=e}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}};function Ks(e,t,{getFn:n=W.getFn,fieldNormWeight:r=W.fieldNormWeight}={}){let i=new Gs({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(Fs)),i.setSources(t),i.create(),i}function qs(e,{getFn:t=W.getFn,fieldNormWeight:n=W.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new Gs({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function Js(e,{errors:t=0,currentLocation:n=0,expectedLocation:r=0,distance:i=W.distance,ignoreLocation:a=W.ignoreLocation}={}){let o=t/e.length;if(a)return o;let s=Math.abs(r-n);return i?o+s/i:s?1:o}function Ys(e=[],t=W.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}var Xs=32;function Zs(e,t,n,{location:r=W.location,distance:i=W.distance,threshold:a=W.threshold,findAllMatches:o=W.findAllMatches,minMatchCharLength:s=W.minMatchCharLength,includeMatches:c=W.includeMatches,ignoreLocation:l=W.ignoreLocation}={}){if(t.length>Xs)throw Error(As(Xs));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=s>1||c,g=h?Array(d):[],_;for(;(_=e.indexOf(t,m))>-1;){let e=Js(t,{currentLocation:_,expectedLocation:f,distance:i,ignoreLocation:l});if(p=Math.min(e,p),m=_+u,h){let e=0;for(;e=c;--a){let o=a-1,s=n[e.charAt(o)];if(h&&(g[o]=+!!s),S[a]=(S[a+1]<<1|1)&s,r&&(S[a]|=(v[a+1]|v[a])<<1|1|v[a+1]),S[a]&x&&(y=Js(t,{errors:r,currentLocation:o,expectedLocation:f,distance:i,ignoreLocation:l}),y<=p)){if(p=y,m=o,m<=f)break;c=Math.max(1,2*f-m)}}if(Js(t,{errors:r+1,currentLocation:f,expectedLocation:f,distance:i,ignoreLocation:l})>p)break;v=S}let S={isMatch:m>=0,score:Math.max(.001,y)};if(h){let e=Ys(g,s);e.length?c&&(S.indices=e):S.isMatch=!1}return S}function Qs(e){let t={};for(let n=0,r=e.length;ne.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``)):(e=>e),ec=class{constructor(e,{location:t=W.location,threshold:n=W.threshold,distance:r=W.distance,includeMatches:i=W.includeMatches,findAllMatches:a=W.findAllMatches,minMatchCharLength:o=W.minMatchCharLength,isCaseSensitive:s=W.isCaseSensitive,ignoreDiacritics:c=W.ignoreDiacritics,ignoreLocation:l=W.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?$s(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:Qs(e),startIndex:t})},d=this.pattern.length;if(d>Xs){let e=0,t=d%Xs,n=d-t;for(;e{let{isMatch:m,score:h,indices:g}=Zs(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&(u=[...u,...g])});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=u),p}},tc=class{constructor(e){this.pattern=e}static isMultiMatch(e){return nc(e,this.multiRegex)}static isSingleMatch(e){return nc(e,this.singleRegex)}search(){}};function nc(e,t){let n=e.match(t);return n?n[1]:null}var rc=class extends tc{constructor(e){super(e)}static get type(){return`exact`}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){let t=e===this.pattern;return{isMatch:t,score:+!t,indices:[0,this.pattern.length-1]}}},ic=class extends tc{constructor(e){super(e)}static get type(){return`inverse-exact`}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){let t=e.indexOf(this.pattern)===-1;return{isMatch:t,score:+!t,indices:[0,e.length-1]}}},ac=class extends tc{constructor(e){super(e)}static get type(){return`prefix-exact`}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){let t=e.startsWith(this.pattern);return{isMatch:t,score:+!t,indices:[0,this.pattern.length-1]}}},oc=class extends tc{constructor(e){super(e)}static get type(){return`inverse-prefix-exact`}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){let t=!e.startsWith(this.pattern);return{isMatch:t,score:+!t,indices:[0,e.length-1]}}},sc=class extends tc{constructor(e){super(e)}static get type(){return`suffix-exact`}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){let t=e.endsWith(this.pattern);return{isMatch:t,score:+!t,indices:[e.length-this.pattern.length,e.length-1]}}},cc=class extends tc{constructor(e){super(e)}static get type(){return`inverse-suffix-exact`}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){let t=!e.endsWith(this.pattern);return{isMatch:t,score:+!t,indices:[0,e.length-1]}}},lc=class extends tc{constructor(e,{location:t=W.location,threshold:n=W.threshold,distance:r=W.distance,includeMatches:i=W.includeMatches,findAllMatches:a=W.findAllMatches,minMatchCharLength:o=W.minMatchCharLength,isCaseSensitive:s=W.isCaseSensitive,ignoreDiacritics:c=W.ignoreDiacritics,ignoreLocation:l=W.ignoreLocation}={}){super(e),this._bitapSearch=new ec(e,{location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l})}static get type(){return`fuzzy`}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}},uc=class extends tc{constructor(e){super(e)}static get type(){return`include`}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t=0,n,r=[],i=this.pattern.length;for(;(n=e.indexOf(this.pattern,t))>-1;)t=n+i,r.push([n,t-1]);let a=!!r.length;return{isMatch:a,score:+!a,indices:r}}},dc=[rc,uc,ac,oc,cc,sc,ic,lc],fc=dc.length,pc=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,mc=`|`;function hc(e,t={}){return e.split(mc).map(e=>{let n=e.trim().split(pc).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e!!(e[xc.AND]||e[xc.OR]),wc=e=>!!e[Sc.PATH],Tc=e=>!gs(e)&&Cs(e)&&!Cc(e),Ec=e=>({[xc.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Dc(e,t,{auto:n=!0}={}){let r=e=>{let i=Object.keys(e),a=wc(e);if(!a&&i.length>1&&!Cc(e))return r(Ec(e));if(Tc(e)){let r=a?e[Sc.PATH]:i[0],o=a?e[Sc.PATTERN]:e[r];if(!bs(o))throw Error(ks(r));let s={keyId:Ls(r),pattern:o};return n&&(s.searcher=bc(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];gs(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return Cc(e)||(e=Ec(e)),r(e)}function Oc(e,{ignoreFieldNorm:t=W.ignoreFieldNorm}){e.forEach(e=>{let n=1;e.matches.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),e.score=n})}function kc(e,t){let n=e.matches;t.matches=[],Ts(n)&&n.forEach(e=>{if(!Ts(e.indices)||!e.indices.length)return;let{indices:n,value:r}=e,i={indices:n,value:r};e.key&&(i.key=e.key.src),e.idx>-1&&(i.refIndex=e.idx),t.matches.push(i)})}function Ac(e,t){t.score=e.score}function jc(e,t,{includeMatches:n=W.includeMatches,includeScore:r=W.includeScore}={}){let i=[];return n&&i.push(kc),r&&i.push(Ac),e.map(e=>{let{idx:n}=e,r={item:t[n],refIndex:n};return i.length&&i.forEach(t=>{t(e,r)}),r})}var Mc=class{constructor(e,t={},n){this.options={...W,...t},this.options.useExtendedSearch,this._keyStore=new Ps(this.options.keys),this.setCollection(e,n)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Gs))throw Error(Os);this._myIndex=t||Ks(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){Ts(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){let t=[];for(let n=0,r=this._docs.length;n-1&&(s=s.slice(0,t)),jc(s,this._docs,{includeMatches:n,includeScore:r})}_searchStringList(e){let t=bc(e,this.options),{records:n}=this._myIndex,r=[];return n.forEach(({v:e,i:n,n:i})=>{if(!Ts(e))return;let{isMatch:a,score:o,indices:s}=t.searchIn(e);a&&r.push({item:e,idx:n,matches:[{score:o,value:e,norm:i,indices:s}]})}),r}_searchLogical(e){let t=Dc(e,this.options),n=(e,t,r)=>{if(!e.children){let{keyId:n,searcher:i}=e,a=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(t,n),searcher:i});return a&&a.length?[{idx:r,item:t,matches:a}]:[]}let i=[];for(let a=0,o=e.children.length;a{if(Ts(e)){let o=n(t,e,r);o.length&&(i[r]||(i[r]={idx:r,item:e,matches:[]},a.push(i[r])),o.forEach(({matches:e})=>{i[r].matches.push(...e)}))}}),a}_searchObjectList(e){let t=bc(e,this.options),{keys:n,records:r}=this._myIndex,i=[];return r.forEach(({$:e,i:r})=>{if(!Ts(e))return;let a=[];n.forEach((n,r)=>{a.push(...this._findMatches({key:n,value:e[r],searcher:t}))}),a.length&&i.push({idx:r,item:e,matches:a})}),i}_findMatches({key:e,value:t,searcher:n}){if(!Ts(t))return[];let r=[];if(gs(t))t.forEach(({v:t,i,n:a})=>{if(!Ts(t))return;let{isMatch:o,score:s,indices:c}=n.searchIn(t);o&&r.push({score:s,key:e,value:t,idx:i,norm:a,indices:c})});else{let{v:i,n:a}=t,{isMatch:o,score:s,indices:c}=n.searchIn(i);o&&r.push({score:s,key:e,value:i,norm:a,indices:c})}return r}};Mc.version=`7.1.0`,Mc.createIndex=Ks,Mc.parseIndex=qs,Mc.config=W,Mc.parseQuery=Dc,yc(_c);var Nc={keys:[{name:`name`,weight:.4},{name:`variant`,weight:.2},{name:`tags`,weight:.2},{name:`provider`,weight:.1},{name:`description`,weight:.1}],threshold:.35,includeScore:!0,minMatchCharLength:2},Pc=null,Fc=null;function Ic(e){return Pc&&Fc===e?Pc:(Pc=new Mc(e,Nc),Fc=e,Pc)}function Lc(e,t){return e.filter(e=>!(t.tasks&&t.tasks.length>0&&!t.tasks.includes(e.task)||t.frameworks&&t.frameworks.length>0&&!t.frameworks.includes(e.framework)||t.hardware&&t.hardware.length>0&&!t.hardware.some(t=>e.hardware.includes(t))||t.sources&&t.sources.length>0&&!t.sources.includes(e.source)||t.downloaded!==void 0&&e.downloaded!==t.downloaded))}function Rc(e,t){let{sortBy:n=`name`,sortDir:r=`asc`}=t,i=r===`asc`?1:-1;return[...e].sort((e,t)=>{switch(n){case`name`:return i*e.name.localeCompare(t.name);case`size`:return i*(e.size-t.size);case`latency`:return i*((e.metrics.latency_ms??1/0)-(t.metrics.latency_ms??1/0));case`accuracy`:return i*((e.metrics.accuracy??e.metrics.top1??e.metrics.mAP??0)-(t.metrics.accuracy??t.metrics.top1??t.metrics.mAP??0));case`downloads`:return i*((e.downloads??0)-(t.downloads??0));default:return 0}})}function zc(e,t){return t.search&&t.search.trim().length>0?Lc(Ic(e).search(t.search.trim()).map(e=>e.item),t):Rc(Lc(e,t),t)}function Bc(){Pc=null,Fc=null}var Vc=`http://127.0.0.1:8005`,Hc={tasks:[],frameworks:[],hardware:[],sources:[],downloaded:void 0};function Uc(e){return zc(e.models,{search:e.searchQuery,tasks:e.filters.tasks,frameworks:e.filters.frameworks,hardware:e.filters.hardware,sources:e.filters.sources,downloaded:e.filters.downloaded,sortBy:e.sortBy,sortDir:e.sortDir})}var Wc=Ho((e,t)=>({models:[],filteredModels:[],searchQuery:``,filters:{...Hc},sortBy:`downloads`,sortDir:`desc`,viewMode:`grid`,isLoading:!1,error:null,localModels:[],loadModels:async()=>{let n=t();if(!n.isLoading){e({isLoading:!0,error:null});try{let r=await ts({limit:500,sort_by:n.sortBy??`downloads`,sort_dir:n.sortDir??`desc`}),i=await ts({source:[`local`],limit:500,sort_by:`created`,sort_dir:`desc`}),a=r.filter(e=>e.source!==`local`),o=new Map;for(let e of a)o.set(e.id,e);for(let e of i)o.set(e.id,e);let s=Array.from(o.values());Bc(),e({models:s,localModels:i,filteredModels:Uc({...t(),models:s}),isLoading:!1})}catch(t){let n=t instanceof Error?t.message:`Unknown error`;console.error(`[ModelStore] loadModels failed:`,n),e({isLoading:!1,error:n})}}},importModel:async t=>{e({isLoading:!0,error:null});try{let n=await fetch(`${Vc}/models/import`,{method:`POST`,body:t});if(!n.ok){let e=await n.json();throw Error(e.detail||`Import failed`)}let r=await n.json();return e(e=>({localModels:[r,...e.localModels],isLoading:!1})),r}catch(t){throw e({isLoading:!1,error:t instanceof Error?t.message:`Import failed`}),t}},setSearchQuery:n=>{e({searchQuery:n,filteredModels:Uc({...t(),searchQuery:n})})},setFilter:(n,r)=>{let i=t(),a={...i.filters,[n]:r};e({filters:a,filteredModels:Uc({...i,filters:a})})},toggleTaskFilter:n=>{let r=t(),i=r.filters.tasks.includes(n)?r.filters.tasks.filter(e=>e!==n):[...r.filters.tasks,n],a={...r.filters,tasks:i};e({filters:a,filteredModels:Uc({...r,filters:a})})},toggleFrameworkFilter:n=>{let r=t(),i=r.filters.frameworks.includes(n)?r.filters.frameworks.filter(e=>e!==n):[...r.filters.frameworks,n],a={...r.filters,frameworks:i};e({filters:a,filteredModels:Uc({...r,filters:a})})},toggleHardwareFilter:n=>{let r=t(),i=r.filters.hardware.includes(n)?r.filters.hardware.filter(e=>e!==n):[...r.filters.hardware,n],a={...r.filters,hardware:i};e({filters:a,filteredModels:Uc({...r,filters:a})})},toggleSourceFilter:n=>{let r=t(),i=r.filters.sources.includes(n)?r.filters.sources.filter(e=>e!==n):[...r.filters.sources,n],a={...r.filters,sources:i};e({filters:a,filteredModels:Uc({...r,filters:a})})},clearFilters:()=>{let n=t(),r={...Hc};e({filters:r,searchQuery:``,filteredModels:Uc({...n,filters:r,searchQuery:``})})},setSortBy:n=>{e({sortBy:n,filteredModels:Uc({...t(),sortBy:n})})},setSortDir:n=>{e({sortDir:n,filteredModels:Uc({...t(),sortDir:n})})},setViewMode:t=>e({viewMode:t}),updateModel:(n,r)=>{let i=t(),a=i.models.map(e=>e.id===n?{...e,...r}:e);Bc(),e({models:a,filteredModels:Uc({...i,models:a})})}})),Gc=s({deleteDataset:()=>rl,getAnnotationsSummary:()=>tl,getDataset:()=>Xc,getDatasetStats:()=>el,getUniversalItems:()=>$c,importDataset:()=>Qc,listDatasetJobs:()=>il,listDatasets:()=>Yc,pauseDatasetJob:()=>ol,resumeDatasetJob:()=>sl,searchRoboflow:()=>Zc,stopDatasetJob:()=>al,toggleDatasetStar:()=>nl}),Kc=`http://localhost:8005`;async function qc(e,t){let n=await fetch(`${Kc}${e}`,{headers:{Accept:`application/json`,"Content-Type":`application/json`},...t});if(!n.ok){let e=await n.text().catch(()=>n.statusText);throw Error(`API ${n.status}: ${e}`)}return n.json()}function Jc(e){let t=[];for(let[n,r]of Object.entries(e))r==null||r===``||t.push(`${n}=${encodeURIComponent(String(r))}`);return t.length?`?${t.join(`&`)}`:``}async function Yc(e={}){return qc(`/datasets${Jc(e)}`)}async function Xc(e){return qc(`/datasets/${encodeURIComponent(e)}`)}async function Zc(e,t=``,n,r=0,i=50){return qc(`/datasets/search/roboflow`,{method:`POST`,body:JSON.stringify({api_key:e,query:t,workspace:n||null,page:r,page_size:i})})}async function Qc(e,t){return qc(`/datasets/${encodeURIComponent(e)}/import`,{method:`POST`,body:JSON.stringify({dataset_id:e,source:t.source,roboflow_key:t.roboflowKey??null,roboflow_workspace:t.roboflowWorkspace??null,roboflow_project:t.roboflowProject??null,roboflow_version:t.roboflowVersion??1,hf_dataset_id:t.hfDatasetId??null,format:t.format??`yolo`,local_path:t.local_path??null,name:t.name??null,download_url:t.downloadUrl??null,headers:t.headers??{},dataset_name:t.datasetName??null,curl_format:t.curlFormat??null})})}async function $c(e,t=0,n=20,r,i){let a=Jc({page:t,page_size:n,split:r,class_label:i});return qc(`/datasets/${encodeURIComponent(e)}/universal${a}`)}async function el(e){return qc(`/datasets/${encodeURIComponent(e)}/stats`)}async function tl(e){return qc(`/datasets/${encodeURIComponent(e)}/annotations`)}async function nl(e){return qc(`/datasets/${encodeURIComponent(e)}/star`,{method:`POST`})}async function rl(e,t=!1){let n=Jc({delete_files:t});return qc(`/datasets/${encodeURIComponent(e)}${n}`,{method:`DELETE`})}async function il(e=50){return qc(`/datasets/jobs?limit=${e}`)}async function al(e){return qc(`/datasets/jobs/${encodeURIComponent(e)}/stop`,{method:`POST`})}async function ol(e){return qc(`/datasets/jobs/${encodeURIComponent(e)}/pause`,{method:`POST`})}async function sl(e){return qc(`/datasets/jobs/${encodeURIComponent(e)}/resume`,{method:`POST`})}var cl=`https://huggingface.co/api`;async function ll(e={}){let t=new URLSearchParams;e.query?.trim()&&t.set(`search`,e.query.trim()),e.filter&&t.set(`filter`,e.filter),t.set(`limit`,String(e.limit??50)),t.set(`offset`,String(e.offset??0));let n=`${cl}/datasets?${t.toString()}`,r=await fetch(n,{headers:{Accept:`application/json`},signal:AbortSignal.timeout(12e3)});if(!r.ok)throw Error(`HuggingFace API ${r.status}: ${r.statusText}`);return(await r.json()).filter(e=>!e.private).map(ul)}function ul(e){let t=e.id.split(`/`).pop()??e.id;return{id:`hf-${e.id.replace(`/`,`--`)}`,name:t,author:e.author,task:fl(e.tags),format:ml(e.tags),source:`huggingface`,status:`available`,images:vl(e.tags),classes:0,classNames:[],size:gl(e.tags),sizeBytes:_l(e.tags),description:e.description??``,createdAt:e.lastModified,updatedAt:e.lastModified,versions:[],activeVersion:`main`,starred:!1,tags:e.tags,importProgress:0,hfId:e.id,likes:e.likes,downloads:e.downloads}}var dl=[[`object-detection`,`detection`],[`image-object-detection`,`detection`],[`image-classification`,`classification`],[`image-segmentation`,`segmentation`],[`instance-segmentation`,`segmentation`],[`semantic-segmentation`,`segmentation`],[`keypoint-detection`,`keypoints`],[`text-classification`,`nlp`],[`token-classification`,`nlp`],[`question-answering`,`nlp`],[`text-generation`,`generation`],[`summarization`,`generation`],[`translation`,`nlp`]];function fl(e){for(let t of e){let e=t.toLowerCase();for(let[t,n]of dl)if(e.includes(t))return n}return e.some(e=>e.includes(`image`))?`classification`:`nlp`}var pl=[[`parquet`,`JSON`],[`json`,`JSON`],[`csv`,`CSV`],[`coco`,`COCO`],[`yolo`,`YOLO`]];function ml(e){for(let t of e){let e=t.toLowerCase();for(let[t,n]of pl)if(e.includes(t))return n}return`JSON`}var hl=[[`n<1K`,`< 1K`,500],[`1K 10M`,5e7]];function gl(e){for(let t of e)for(let[e,n]of hl)if(t.includes(e))return n;return`Unknown`}function _l(e){for(let t of e)for(let[e,,n]of hl)if(t.includes(e))return n;return 0}function vl(e){for(let t of e)for(let[e,,n]of hl)if(t.includes(e))return Math.floor(n/10);return 0}function yl(e){return{id:e.id,name:e.name,task:e.task,format:e.format,source:e.source,status:e.status.toLowerCase(),images:e.images,classes:e.classes,classNames:e.class_names||[],size:e.size_label,sizeBytes:e.size_bytes||0,description:e.description||``,createdAt:e.created_at||``,updatedAt:e.updated_at||``,versions:[],activeVersion:e.active_version||`—`,starred:e.starred,tags:e.tags||[],importProgress:e.import_progress,healthScore:e.health_score}}function bl(e,t,n,r,i){let a=[...e];if(n.trim()){let e=n.toLowerCase();a=a.filter(t=>t.name.toLowerCase().includes(e)||t.task.includes(e)||t.format.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.tags.some(t=>t.toLowerCase().includes(e)))}t.tasks.length>0&&(a=a.filter(e=>t.tasks.includes(e.task))),t.formats.length>0&&(a=a.filter(e=>t.formats.includes(e.format))),t.sources.length>0&&(a=a.filter(e=>t.sources.includes(e.source))),t.statuses.length>0&&(a=a.filter(e=>t.statuses.includes(e.status))),t.minSize>0&&(a=a.filter(e=>e.sizeBytes>=t.minSize)),t.maxSize<1/0&&(a=a.filter(e=>e.sizeBytes<=t.maxSize)),t.starred===!0&&(a=a.filter(e=>e.starred));let o=i===`asc`?1:-1;return a.sort((e,t)=>{switch(r){case`name`:return e.name.localeCompare(t.name)*o;case`images`:return(e.images-t.images)*o;case`size`:return(e.sizeBytes-t.sizeBytes)*o;case`classes`:return(e.classes-t.classes)*o;default:return(new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime())*o}}),a}function xl(e){if(!e.trim())return null;let t=e.match(/curl(?:\s+-[A-Za-z]+)*\s+-L\s+["']([^"']+)["']/);if(t)return t[1];let n=e.match(/curl(?:\s+-[A-Za-z]+)*\s+-L\s+(https?:\/\/\S+)/);if(n)return n[1].replace(/[\\'"]+$/,``);let r=e.match(/["'](https?:\/\/[^"']+)["']/);if(r)return r[1];let i=e.match(/curl\s+(https?:\/\/\S+)/);return i?i[1].replace(/[\\'"]+$/,``):null}var Sl={tasks:[],formats:[],sources:[],statuses:[],minSize:0,maxSize:1/0,starred:void 0},Cl=[`#3b82f6`,`#10b981`,`#f59e0b`,`#ef4444`,`#8b5cf6`,`#06b6d4`,`#ec4899`,`#f97316`,`#14b8a6`,`#6366f1`];function wl(e,t){let n=e.stats||{},r=t.map((e,t)=>({name:e.label,count:e.count,color:Cl[t%Cl.length]})),i=[{label:`320×320`,count:Math.floor(e.images*.05)},{label:`640×480`,count:Math.floor(e.images*.15)},{label:`640×640`,count:Math.floor(e.images*.45)},{label:`1280×720`,count:Math.floor(e.images*.25)},{label:`1920×1080`,count:Math.floor(e.images*.1)}],a=[{label:`1:1`,count:Math.floor(e.images*.5)},{label:`4:3`,count:Math.floor(e.images*.2)},{label:`16:9`,count:Math.floor(e.images*.2)},{label:`Other`,count:Math.floor(e.images*.1)}],o=[{bucket:`0`,count:n.empty_images||Math.floor(e.images*.05)},{bucket:`1-3`,count:Math.floor(e.images*.4)},{bucket:`4-7`,count:Math.floor(e.images*.35)},{bucket:`8-15`,count:Math.floor(e.images*.15)},{bucket:`16+`,count:Math.floor(e.images*.05)}],s=n.split||{},c=s.train||s.training||0,l=s.val||s.valid||s.validation||0,u=s.test||s.testing||0,d=c+l+u,f=d>0?{train:Math.round(c/d*100),val:Math.round(l/d*100),test:Math.round(u/d*100)}:{train:100,val:0,test:0},p=n.health_score==null?e.health_score?Math.round(e.health_score*10):8:Math.round(n.health_score*10)/10;return{classDistribution:r,resolutionDist:i,aspectRatioDist:a,objectsPerImage:o,qualityIssues:{missingLabels:n.missing_labels||0,emptyImages:n.empty_images||0,duplicates:n.duplicate_count||0,outliers:0},healthScore:Math.min(10,Math.max(0,p)),split:f}}function Tl(e){let t={...Sl};switch(e){case`imported`:return{filters:{...t,statuses:[`imported`]},sortBy:`recent`};case`recent`:return{filters:{...t},sortBy:`recent`,sortDir:`desc`};case`starred`:return{filters:{...t,starred:!0},sortBy:`recent`};case`huggingface`:return{filters:{...t,sources:[`huggingface`]}};case`roboflow`:return{filters:{...t,sources:[`roboflow`]}};case`local`:return{filters:{...t,sources:[`local`]}};case`failed`:return{filters:{...t,statuses:[`failed`]}};default:return{filters:{...t}}}}var El=Ho((e,t)=>{function n(e={}){let n={...t(),...e};return bl(n.datasets,n.filters,n.searchQuery,n.sortBy,n.sortDir)}return{datasets:[],filteredDatasets:[],isLoading:!1,error:null,selectedDatasetId:null,inspectedDatasetId:null,viewMode:`explorer`,searchQuery:``,sortBy:`recent`,sortDir:`desc`,listMode:`grid`,viewerSplit:null,viewerClass:null,setViewerSplit:t=>e({viewerSplit:t}),setViewerClass:t=>e({viewerClass:t}),navSection:`all`,filters:{...Sl},importJobs:[],roboflowApiKey:``,isRoboflowConnected:!1,roboflowDiscovery:[],isSearchingRoboflow:!1,hfDatasets:[],hfSearchQuery:``,isSearchingHF:!1,hfError:null,hfToken:``,showImportModal:!1,importModalInitialTab:`hf`,analyticsCache:new Set,_jobInterval:null,fetchDatasets:async()=>{e({isLoading:!0,error:null});try{let n=(await Yc({})).map(yl),r=t().inspectedDatasetId,i=n.some(e=>e.id===r);e({datasets:n,filteredDatasets:bl(n,t().filters,t().searchQuery,t().sortBy,t().sortDir),isLoading:!1,inspectedDatasetId:i?r:null}),await t().refreshJobs()}catch(t){e({error:t.message,isLoading:!1})}},fetchAnalytics:async r=>{if(!t().analyticsCache.has(r))try{let[i,a,o]=await Promise.all([Xc(r),el(r).catch(()=>({class_distribution:{},split_distribution:{}})),tl(r).catch(()=>({dataset_id:r,class_distribution:[],total_annotations:0}))]),s=o.class_distribution;s.length===0&&Object.keys(a.class_distribution).length>0&&(s=Object.entries(a.class_distribution).map(([e,t])=>({label:e,count:t})));let c=wl({...i,stats:{...i.stats||{},split:a.split_distribution}},s),l=t().datasets.map(e=>e.id===r?{...e,analytics:c}:e);e(e=>({datasets:l,filteredDatasets:n({datasets:l}),analyticsCache:new Set([...e.analyticsCache,r])}))}catch(e){console.error(`fetchAnalytics failed`,e)}},refreshJobs:async()=>{try{let r=await il(20);e({importJobs:r.map(e=>({id:e.id,datasetId:e.dataset_id,datasetName:e.dataset_name,source:e.type.toLowerCase(),status:e.status.toLowerCase(),progress:e.progress,startedAt:e.started_at?new Date(e.started_at).getTime():Date.now(),completedAt:e.ended_at?new Date(e.ended_at).getTime():void 0,error:e.error||void 0}))});let i=r.some(e=>{let t=(e.status||``).toLowerCase();return t===`queued`||t===`running`});if(i&&!t()._jobInterval&&e({_jobInterval:setInterval(()=>t().refreshJobs(),3e3)}),!i&&t()._jobInterval&&(clearInterval(t()._jobInterval),e({_jobInterval:null})),r.some(e=>e.status===`completed`||e.status===`failed`)){let i=t().datasets.map(e=>{let t=r.find(t=>t.dataset_id===e.id);return t?{...e,status:t.status.toLowerCase(),importProgress:t.progress}:e});r.filter(e=>e.status===`completed`&&!t().datasets.some(t=>t.id===e.dataset_id)).length>0?await t().fetchDatasets():e({datasets:i,filteredDatasets:n({datasets:i})})}}catch(e){console.error(`Job refresh failed`,e)}},setSelectedDataset:t=>e({selectedDatasetId:t}),setInspectedDataset:t=>e({inspectedDatasetId:t}),setViewMode:t=>e({viewMode:t}),setSearchQuery:t=>{e({searchQuery:t,filteredDatasets:n({searchQuery:t})})},setSortBy:t=>{e({sortBy:t,filteredDatasets:n({sortBy:t})})},setSortDir:t=>{e({sortDir:t,filteredDatasets:n({sortDir:t})})},setListMode:t=>e({listMode:t}),setNavSection:n=>{let r={navSection:n,...Tl(n),searchQuery:``},i=t(),a=bl(i.datasets,r.filters||i.filters,``,r.sortBy||i.sortBy,r.sortDir||i.sortDir);e({...r,filteredDatasets:a})},toggleTaskFilter:r=>{let i=t(),a=i.filters.tasks.includes(r)?i.filters.tasks.filter(e=>e!==r):[...i.filters.tasks,r],o={...i.filters,tasks:a};e({filters:o,filteredDatasets:n({filters:o})})},toggleFormatFilter:r=>{let i=t(),a=i.filters.formats.includes(r)?i.filters.formats.filter(e=>e!==r):[...i.filters.formats,r],o={...i.filters,formats:a};e({filters:o,filteredDatasets:n({filters:o})})},toggleSourceFilter:r=>{let i=t(),a=i.filters.sources.includes(r)?i.filters.sources.filter(e=>e!==r):[...i.filters.sources,r],o={...i.filters,sources:a};e({filters:o,filteredDatasets:n({filters:o})})},toggleStatusFilter:r=>{let i=t(),a=i.filters.statuses.includes(r)?i.filters.statuses.filter(e=>e!==r):[...i.filters.statuses,r],o={...i.filters,statuses:a};e({filters:o,filteredDatasets:n({filters:o})})},setMinSize:r=>{let i={...t().filters,minSize:r};e({filters:i,filteredDatasets:n({filters:i})})},setMaxSize:r=>{let i={...t().filters,maxSize:r};e({filters:i,filteredDatasets:n({filters:i})})},toggleStarredFilter:()=>{let r=t(),i=r.filters.starred?void 0:!0,a={...r.filters,starred:i};e({filters:a,filteredDatasets:n({filters:a})})},clearFilters:()=>{let t={...Sl};e({filters:t,searchQuery:``,filteredDatasets:n({filters:t,searchQuery:``})})},toggleStar:async r=>{try{let{starred:i}=await nl(r),a=t().datasets.map(e=>e.id===r?{...e,starred:i}:e);e({datasets:a,filteredDatasets:n({datasets:a})})}catch(e){console.error(`toggleStar failed`,e)}},startImport:async(e,n)=>{try{await Qc(e,{roboflowKey:t().roboflowApiKey,...n}),t().refreshJobs(),t().fetchDatasets()}catch(e){console.error(`startImport failed`,e)}},startValidation:async n=>{e(e=>({datasets:e.datasets.map(e=>e.id===n?{...e,status:`validating`}:e)}));try{await new Promise(e=>setTimeout(e,1e3)),t().fetchDatasets()}catch(e){console.error(`startValidation failed`,e)}},deleteDataset:async t=>{try{await rl(t,!0),e(e=>{let r=e.datasets.filter(e=>e.id!==t);return{datasets:r,filteredDatasets:n({datasets:r}),selectedDatasetId:e.selectedDatasetId===t?null:e.selectedDatasetId,inspectedDatasetId:e.inspectedDatasetId===t?null:e.inspectedDatasetId}})}catch(e){console.error(`deleteDataset failed`,e)}},stopJob:async e=>{let n=t().importJobs.find(t=>t.datasetId===e&&(t.status===`queued`||t.status===`downloading`||t.status===`processing`||t.status===`extracting`||t.status===`validating`));if(n)try{await al(n.id),await t().refreshJobs()}catch(e){console.error(`stopJob failed`,e)}},pauseJob:async e=>{let n=t().importJobs.find(t=>t.datasetId===e&&(t.status===`downloading`||t.status===`processing`));if(n)try{await ol(n.id),await t().refreshJobs()}catch(e){console.error(`pauseJob failed`,e)}},resumeJob:async e=>{let n=t().importJobs.find(t=>t.datasetId===e&&t.status===`failed`);if(n)try{await sl(n.id),await t().refreshJobs()}catch(e){console.error(`resumeJob failed`,e)}},setRoboflowApiKey:t=>e({roboflowApiKey:t}),connectRoboflow:async()=>{if(t().roboflowApiKey.trim().length>8){e({isRoboflowConnected:!0});try{await t().searchRoboflow(``)}catch{}}},searchRoboflow:async n=>{if(t().roboflowApiKey){e({isSearchingRoboflow:!0});try{e({roboflowDiscovery:(await Zc(t().roboflowApiKey,n)).map(yl),isSearchingRoboflow:!1})}catch(t){e({isSearchingRoboflow:!1}),console.error(`searchRoboflow failed`,t)}}},setHFSearchQuery:t=>e({hfSearchQuery:t}),setHFToken:t=>e({hfToken:t}),searchHuggingFace:async n=>{let r=n??t().hfSearchQuery;e({isSearchingHF:!0,hfError:null});try{e({hfDatasets:await ll({query:r,limit:60}),isSearchingHF:!1})}catch(t){e({hfError:t.message,isSearchingHF:!1})}},importHFDataset:async e=>{try{let n=t().hfToken.trim(),r=n?{Authorization:`Bearer ${n}`}:{};await Qc(e.id,{source:`huggingface`,hfDatasetId:e.hfId||e.id,format:e.format.toLowerCase(),headers:r}),t().fetchDatasets(),t().refreshJobs()}catch(e){throw console.error(`importHFDataset failed`,e),e}},importRoboflowCurl:async({curlCommand:e,datasetName:n,curlFormat:r,downloadUrl:i,headers:a})=>{let o=i||xl(e);if(!o)throw Error(`Could not parse a download URL from the curl command. Make sure to paste the full curl command from Roboflow.`);let s=`rf-curl-${n.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)}-${Date.now().toString(36)}`;try{await Qc(s,{source:`roboflow_curl`,downloadUrl:o,headers:a||{},datasetName:n,curlFormat:r}),t().fetchDatasets(),t().refreshJobs()}catch(e){throw console.error(`importRoboflowCurl failed`,e),e}},setShowImportModal:(t,n=`hf`)=>{e({showImportModal:t,importModalInitialTab:n})}}}),Dl=`http://localhost:8005`;async function Ol(e,t){let n=await fetch(`${Dl}${e}`,{...t,headers:{"Content-Type":`application/json`,Accept:`application/json`,...t?.headers}});if(!n.ok){let e=await n.text();throw Error(`Benchmark API ${n.status}: ${e}`)}return n.json()}async function kl(e){if(!await es())throw Error(`Backend offline`);return Ol(`/benchmark/run`,{method:`POST`,body:JSON.stringify(e)})}async function Al(){return await es()?Ol(`/benchmark/jobs`):[]}async function jl(){return await es()?Ol(`/benchmark/results/all`):[]}async function Ml(e){return Ol(`/benchmark/${e}/result`)}async function Nl(){return Ol(`/benchmark/sync`,{method:`POST`})}var Pl=60;function Fl(e=[],t){let n=[...Array.isArray(e)?e:[],{time:Date.now(),value:t}];return n.length>Pl?n.slice(-Pl):n}function Il(e){let{metrics:t,telemetry_summary:n}=e,r=e.task||t.task||`detection`,i=0;i=r===`classification`?t.accuracy||0:r===`generation`||r===`nlp`?t.rouge_l||t.bleu||0:t.mAP||0;let a=t.inference_ms||0,o=t.nms_ms||0;if(n?.layer_breakdown&&n.layer_breakdown.length>0){let e=n.layer_breakdown,t=e.find(e=>e.name.toLowerCase().includes(`post`)||e.name.toLowerCase().includes(`nms`));t&&(o=t.time_ms);let r=e.reduce((e,t)=>e+t.time_ms,0);a||=r-o}return{id:e.id,modelName:e.model_id?e.model_id.split(`/`).pop()||e.model_id:e.id.split(`-`)[0].toUpperCase(),task:r,framework:e.framework||t.framework||`PyT`,targetHW:e.hardware||n.hardware_name||`GPU`,mAP:i,fps:t.fps||0,latencyMean:t.latency_mean_ms||0,latencyP99:t.latency_p99_ms||0,vramGB:t.vram_peak_gb||0,params:t.params||`N/A`,dataset:e.dataset_id||t.dataset_name||`Custom`,ap50:t.mAP_50||0,ap75:t.mAP_50_95||t.mAP_75||0,inferenceMs:a,nmsMs:o,rank:0,status:`completed`,apSmall:t.ap_small||0,apMedium:t.ap_medium||0,apLarge:t.ap_large||0}}var G=Ho((e,t)=>({activeTab:`leaderboard`,setActiveTab:t=>e({activeTab:t}),config:{tasks:[`detection`],dataset:`COCO-2017`,targetHardware:`RTX 4090`,precision:`FP16`,imgsz:640,vidStride:1,stream:!1,inputSource:`dataset`},setConfig:t=>e(e=>({config:{...e.config,...t}})),results:[],selectedResultIds:new Set,hoveredResultId:null,inspectedResultId:null,toggleResultSelection:t=>e(e=>{let n=new Set(e.selectedResultIds);return n.has(t)?n.delete(t):n.add(t),{selectedResultIds:n}}),setHoveredResult:t=>e({hoveredResultId:t}),setInspectedResult:t=>e({inspectedResultId:t}),clearResultSelection:()=>e({selectedResultIds:new Set}),activeJobId:null,setActiveJobId:t=>e({activeJobId:t}),searchHistory:[`Pareto front all models`,`SOTA edge detection`,`SOTA at segmentation mIoU`],addSearchHistory:t=>e(e=>({searchHistory:[t,...e.searchHistory.filter(e=>e!==t)].slice(0,10)})),isLiveRunning:!1,liveModelName:`YOLOv11-M`,liveDevice:`cuda:0 (RTX 4090)`,liveInputSource:`Webcam (Live)`,inferenceMetrics:{avgFps:0,meanLatency:0,vramPeak:0},telemetry:{gpuTemp:[],gpuClock:[],vramUsage:[],powerDraw:[]},latestDetections:[],executionLogs:[],bottleneckLayers:[{name:`Backbone (CSPDarknet)`,timeMs:4.2,percent:45},{name:`Neck (PAFPN)`,timeMs:2.8,percent:30},{name:`Head (Decoupled Head)`,timeMs:2.3,percent:25}],confidenceThreshold:.25,iouThreshold:.45,batchSize:1,maxDetections:300,driftScore:.02,setLiveRunning:t=>e({isLiveRunning:t}),setLiveModelName:t=>e({liveModelName:t}),setLiveDevice:t=>e({liveDevice:t}),setLiveInputSource:t=>e({liveInputSource:t}),setConfidenceThreshold:t=>e({confidenceThreshold:t}),setIouThreshold:t=>e({iouThreshold:t}),setBatchSize:t=>e({batchSize:t}),setMaxDetections:t=>e({maxDetections:t}),clearExecutionLogs:()=>e({executionLogs:[]}),_ws:null,_wsJobId:null,_telemetryInterval:null,_metricsStream:null,connectToJob:n=>{let r=t();r._ws&&r._ws.close();let i=`http://localhost:8005`.replace(/^http/,`ws`)+`/benchmark/live/${n}`,a=new WebSocket(i);e({_ws:a,_wsJobId:n,activeJobId:n});let o=0;a.onmessage=async r=>{try{let i=JSON.parse(r.data);if(i.error){console.error(`[WS] Job error:`,i.error);return}let a=Date.now(),s=a-o>200;if(i.telemetry){let n=i.telemetry,r=t();if(s||i.status===`completed`){let t={telemetry:{gpuTemp:Fl(r.telemetry.gpuTemp,n.temp_c||0),gpuClock:Fl(r.telemetry.gpuClock,(n.gpu_util_pct||0)*20),vramUsage:Fl(r.telemetry.vramUsage,n.vram_used_gb||0),powerDraw:Fl(r.telemetry.powerDraw,n.power_w||0)},inferenceMetrics:{...r.inferenceMetrics,vramPeak:Math.max(r.inferenceMetrics.vramPeak,n.vram_used_gb||0)}};n.live_data?.detections&&(t.latestDetections=n.live_data.detections),e(t),o=a}}if(i.logs&&i.logs.length>0&&e(e=>({executionLogs:[...e.executionLogs,...i.logs]})),i.status===`completed`){console.log(`[WS] Job completed:`,n),e({isLiveRunning:!1});try{let r=await Ml(n),i=r.metrics,a=r.telemetry_summary;e({inferenceMetrics:{avgFps:i.fps??0,meanLatency:i.latency_mean_ms??0,vramPeak:i.vram_peak_gb??0},bottleneckLayers:a?.layer_breakdown??t().bottleneckLayers})}catch(e){console.warn(`[WS] Could not fetch benchmark result:`,e)}t().fetchResults()}}catch(e){console.error(`[WS] Parse error:`,e)}},a.onclose=()=>e({_ws:null,_wsJobId:null}),a.onerror=e=>console.error(`[WS] Error:`,e)},disconnectFromJob:()=>{let n=t()._ws;n&&(n.close(),e({_ws:null,_wsJobId:null}))},fetchResults:async()=>{try{await t().syncProjectBenchmarks();let n=(await jl()).map(Il),r={};n.forEach(e=>{let t=`${e.modelName}-${e.task}-${e.dataset}`;r[t]||(r[t]={...e,precisionVariants:{}});let n=e.id.toLowerCase(),i=n.includes(`fp16`)?`fp16`:n.includes(`int8`)?`int8`:`fp32`;r[t].precisionVariants&&(r[t].precisionVariants[i]={latency:e.latencyMean,mAP:e.mAP,vram:e.vramGB})});let i=Object.values(r);i.sort((e,t)=>t.mAP-e.mAP),i.forEach((e,t)=>e.rank=t+1),e({results:i})}catch(e){console.error(`[BenchmarkStore] fetchResults failed:`,e)}},syncProjectBenchmarks:async()=>{try{await Nl()}catch(e){console.error(`[BenchmarkStore] syncProjectBenchmarks failed:`,e)}},fetchJobs:async()=>{try{let e=(await Al()).find(e=>e.status===`running`),n=t()._wsJobId;e&&e.id!==n&&t().connectToJob(e.id)}catch(e){console.error(`[BenchmarkStore] fetchJobs failed:`,e)}},runBenchmark:async(n,r)=>{let{config:i}=t(),a={model_id:n,dataset_id:i.inputSource===`dataset`?r:`none`,task:i.tasks[0]||`detection`,framework:`PyTorch`,hardware:i.targetHardware.toLowerCase(),precision:i.precision,batch_size:t().batchSize,confidence_threshold:t().confidenceThreshold,iou_threshold:t().iouThreshold,max_detections:t().maxDetections,imgsz:i.imgsz,vid_stride:i.vidStride,stream:i.stream||i.inputSource===`live`,input_source:i.inputSource,video_path:i.videoPath,rtsp_url:i.rtspUrl};try{let{job_id:r}=await kl(a);return e({activeJobId:r,activeTab:`live-lab`,isLiveRunning:!0,liveModelName:n.split(`/`).pop()||n,liveDevice:i.targetHardware?`${i.targetHardware} (${i.precision})`:`GPU`}),t().connectToJob(r),r}catch(e){throw console.error(`[BenchmarkStore] runBenchmark failed:`,e),e}},startTelemetrySimulation:()=>{if(!t()._metricsStream){let n=ls({hz:1});n.onmessage=n=>{try{let r=JSON.parse(n.data),i=r.gpu?.utilization_pct??0,a=r.gpu?.mem_used_mb??0,o=r.gpu?.mem_total_mb??0,s=o>0?a/o*100:0,c=t(),l=c.telemetry.vramUsage.length>0?c.telemetry.vramUsage[c.telemetry.vramUsage.length-1].value:0,u=c.telemetry.powerDraw.length>0?c.telemetry.powerDraw[c.telemetry.powerDraw.length-1].value:0,d=Math.abs(s-l),f=Math.abs(i-u);if(!(d>=1||f>=1))return;let p=c.telemetry.gpuTemp.length>0?c.telemetry.gpuTemp[c.telemetry.gpuTemp.length-1].value:62,m=c.telemetry.gpuClock.length>0?c.telemetry.gpuClock[c.telemetry.gpuClock.length-1].value:1800;e({telemetry:{gpuTemp:Fl(c.telemetry.gpuTemp,p+Math.random()*5),gpuClock:Fl(c.telemetry.gpuClock,m+Math.random()*100),vramUsage:Fl(c.telemetry.vramUsage,s),powerDraw:Fl(c.telemetry.powerDraw,i)},inferenceMetrics:{...c.inferenceMetrics,vramPeak:Math.max(c.inferenceMetrics.vramPeak,s)}})}catch{}},e({_metricsStream:n})}},stopTelemetrySimulation:()=>{let n=t()._metricsStream;n&&(n.close(),e({_metricsStream:null}))},initHardware:async()=>{try{let t=(await cs())?.gpu?.name;if(!t)return;let n=t.toLowerCase().replace(/nvidia\s*/g,``).replace(/geforce\s*/g,``).replace(/\s+/g,``);e(e=>({config:{...e.config,targetHardware:n}}))}catch{}}}));function Ll(e){return{id:e.id,name:e.name,path:e.path,created_at:e.created_at,last_opened:e.last_opened,status:e.status,size_label:e.size}}function Rl(e){return{id:e.id,name:e.name,path:e.path,created_at:e.created_at,last_opened:e.last_opened,size:e.size_label||`—`,status:e.status===`active`?`active`:`idle`}}var zl=Ho((e,t)=>({projects:[],activeProject:null,activeProjectDetails:null,isLoading:!1,refreshProjects:async()=>{e({isLoading:!0});try{let t=[];try{t=(await is()).map(Rl)}catch{}if(window.electron?.listProjects){let e=await window.electron.listProjects();Array.isArray(e)&&e.length>0&&(await Promise.all(e.map(async e=>{try{await as(Ll(e))}catch{}})),t=e)}e({projects:t,isLoading:!1})}catch{e({isLoading:!1})}},createProject:async(n,r)=>{e({isLoading:!0});try{if(window.electron?.createProject){let e=r?.includes(n)?r:`${r}\\${n}`,i=await window.electron.createProject(n,e);if(i)try{await as(Ll(i))}catch(e){console.error(`[ProjectStore] Sync to backend DB failed:`,e)}await t().refreshProjects(),i&&await t().openProject(i)}else{let e=r?.includes(n)?r:`${r||`/tmp`}/${n}`,i={id:`proj_${ms().slice(0,8)}`,name:n,path:e,created_at:new Date().toISOString(),last_opened:new Date().toISOString(),size:`0 B`,status:`active`};try{await as(Ll(i))}catch(e){console.error(`[ProjectStore] Sync to backend DB failed:`,e)}await t().refreshProjects(),await t().openProject(i)}}catch(e){throw console.error(`[ProjectStore] createProject failed:`,e),e}finally{e({isLoading:!1})}},openProject:async t=>{e({isLoading:!0});try{e({activeProject:t,activeProjectDetails:await window.electron?.getProjectDetails(t.path),isLoading:!1});try{await os(t.id)}catch{}let{setActiveView:n}=Uo.getState();n(`explore`),setTimeout(()=>{El.getState().fetchDatasets(),Wc.getState().loadModels(),G.getState().fetchJobs()},50)}catch{e({isLoading:!1})}},closeProject:()=>{e({activeProject:null,activeProjectDetails:null});let t=Uo.getState();t.setActiveView(`explore`),t.clearSelection(),t.clearComparison(),t.setInspected(null)},deleteProject:async n=>{e({isLoading:!0});try{window.electron?.deleteProject&&await window.electron.deleteProject(n);try{await ss(n)}catch{}await t().refreshProjects(),t().activeProject?.id===n&&t().closeProject()}finally{e({isLoading:!1})}}})),Bl=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Vl=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Hl=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Ul=e=>{let t=Hl(e);return t.charAt(0).toUpperCase()+t.slice(1)},Wl={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Gl=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Kl=(0,I.createContext)({}),ql=()=>(0,I.useContext)(Kl),Jl=(0,I.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=ql()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,I.createElement)(`svg`,{ref:c,...Wl,width:t??l??Wl.width,height:t??l??Wl.height,stroke:e??f,strokeWidth:m,className:Bl(`lucide`,p,i),...!a&&!Gl(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,I.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),K=(e,t)=>{let n=(0,I.forwardRef)(({className:n,...r},i)=>(0,I.createElement)(Jl,{ref:i,iconNode:t,className:Bl(`lucide-${Vl(Ul(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Ul(e),n},Yl=K(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Xl=K(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Zl=K(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),Ql=K(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),$l=K(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),eu=K(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),tu=K(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),nu=K(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),ru=K(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),iu=K(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),au=K(`chart-no-axes-column`,[[`path`,{d:`M5 21v-6`,key:`1hz6c0`}],[`path`,{d:`M12 21V3`,key:`1lcnhd`}],[`path`,{d:`M19 21V9`,key:`unv183`}]]),ou=K(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),su=K(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),cu=K(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),lu=K(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),uu=K(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),du=K(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),fu=K(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),pu=K(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),mu=K(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),hu=K(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),gu=K(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),_u=K(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),vu=K(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),yu=K(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),bu=K(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),xu=K(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Su=K(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Cu=K(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),wu=K(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),Tu=K(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Eu=K(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),Du=K(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),Ou=K(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),ku=K(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),Au=K(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),ju=K(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Mu=K(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Nu=K(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),Pu=K(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),Fu=K(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Iu=K(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),Lu=K(`grid-3x3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Ru=K(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),zu=K(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),Bu=K(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Vu=K(`heart`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}]]),Hu=K(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Uu=K(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),Wu=K(`images`,[[`path`,{d:`m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16`,key:`9kzy35`}],[`path`,{d:`M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2`,key:`1t0f0t`}],[`circle`,{cx:`13`,cy:`7`,r:`1`,fill:`currentColor`,key:`1obus6`}],[`rect`,{x:`8`,y:`2`,width:`14`,height:`14`,rx:`2`,key:`1gvhby`}]]),Gu=K(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Ku=K(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),qu=K(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Ju=K(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Yu=K(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),Xu=K(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Zu=K(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),Qu=K(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),$u=K(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),ed=K(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),td=K(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),nd=K(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),rd=K(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),id=K(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),ad=K(`panels-top-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),od=K(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),sd=K(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),cd=K(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),ld=K(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),ud=K(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),dd=K(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),fd=K(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),pd=K(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),md=K(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),hd=K(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),gd=K(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),_d=K(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),vd=K(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),yd=K(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),bd=K(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),xd=K(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),Sd=K(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Cd=K(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),wd=K(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),q=K(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Td=K(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Ed=K(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),Dd=K(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Od=K(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),kd=K(`trending-down`,[[`path`,{d:`M16 17h6v-6`,key:`t6n2it`}],[`path`,{d:`m22 17-8.5-8.5-5 5L2 7`,key:`x473p`}]]),Ad=K(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),jd=K(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Md=K(`trophy`,[[`path`,{d:`M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978`,key:`1n3hpd`}],[`path`,{d:`M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978`,key:`rfe1zi`}],[`path`,{d:`M18 9h1.5a1 1 0 0 0 0-5H18`,key:`7xy6bh`}],[`path`,{d:`M4 22h16`,key:`57wxv0`}],[`path`,{d:`M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z`,key:`1mhfuq`}],[`path`,{d:`M6 9H4.5a1 1 0 0 1 0-5H6`,key:`tex48p`}]]),Nd=K(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),Pd=K(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Fd=K(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Id=K(`video`,[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]),Ld=K(`webcam`,[[`circle`,{cx:`12`,cy:`10`,r:`8`,key:`1gshiw`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}],[`path`,{d:`M7 22h10`,key:`10w4w3`}],[`path`,{d:`M12 22v-4`,key:`1utk9m`}]]),Rd=K(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),zd=K(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),Bd=K(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Vd=K(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Hd=K(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Ud=K(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),Wd=Ho(e=>({notifications:[],addNotification:t=>{let n=Math.random().toString(36).substring(2,9),r={...t,id:n};e(e=>({notifications:[...e.notifications,r]})),t.duration!==0&&setTimeout(()=>{e(e=>({notifications:e.notifications.filter(e=>e.id!==n)}))},t.duration||5e3)},removeNotification:t=>e(e=>({notifications:e.notifications.filter(e=>e.id!==t)}))})),Gd=Ho(e=>({activeSourceId:null,activeSourceType:`training`,logs:[],logFilter:`ALL`,logSearch:``,logAutoScroll:!0,logPaused:!1,activePhase:`ALL`,activeModel:`ALL`,setActiveSource:(t,n)=>e({activeSourceId:t,activeSourceType:n,logs:[]}),pushLog:t=>e(e=>e.logPaused?e:{logs:[...e.logs,t].slice(-5e3)}),clearLogs:()=>e({logs:[]}),setLogFilter:t=>e({logFilter:t}),setLogSearch:t=>e({logSearch:t}),setLogPhase:t=>e({activePhase:t}),setLogModel:t=>e({activeModel:t}),toggleLogAutoScroll:()=>e(e=>({logAutoScroll:!e.logAutoScroll})),toggleLogPaused:()=>e(e=>({logPaused:!e.logPaused}))})),Kd={CPU_CRITICAL:90,GPU_TEMP_CRITICAL:85,VRAM_CRITICAL:95};function qd(){return`job-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}function Jd(e,t,n){return Math.min(Math.max(e,t),n)}function Yd(e){return{queued:`queued`,running:`running`,completed:`complete`,failed:`error`,cancelled:`error`}[e]||`error`}var Xd=Ho((e,t)=>({jobs:[],gpuUsage:0,gpuModel:``,gpuTemp:0,gpuPower:0,gpuPowerLimit:0,gpuClock:0,vramUsed:0,vramTotal:1,cpuUsage:0,cpuFreq:0,cpuCount:0,cpuModel:``,ramUsed:0,ramTotal:0,disks:[],network:[],_intervalId:null,_metricsStream:null,_pollIntervals:new Map,addJob:n=>{let r=qd(),i={...n,id:r,progress:0,status:`queued`,startedAt:Date.now()};return e(e=>({jobs:[...e.jobs,i]})),setTimeout(()=>{t().updateJob(r,{status:`running`})},500),r},updateJob:(n,r)=>{let{pushLog:i}=Gd.getState(),a=t().jobs.find(e=>e.id===n);if(e(e=>({jobs:e.jobs.map(e=>e.id===n?{...e,...r}:e)})),r.status&&a&&a.status!==r.status){let e=r.status===`error`?`ERROR`:`INFO`,t=new Date,n=t.toLocaleTimeString(),o=t.getTime()/1e3;i({id:Math.random().toString(36).substring(2,9),ts:n,timestamp:o,level:e,source:`system`,source_type:`benchmark`,model:a.modelName,phase:a.type.toUpperCase(),message:`Job ${r.status.toUpperCase()}: ${a.type} for ${a.modelName}${r.error?` - ${r.error}`:``}`})}},removeJob:n=>{e(e=>({jobs:e.jobs.filter(e=>e.id!==n)}));let r=t()._pollIntervals.get(n);r&&(clearInterval(r),t()._pollIntervals.delete(n))},triggerModelDownload:async(n,r)=>{let i=qd();try{let a=Uo.getState().inspectedModel,o=await rs(n,r,a?.id===n?a.active_version??void 0:void 0),s={id:i,modelId:n,modelName:r,type:`download`,status:`queued`,progress:0,startedAt:Date.now(),backendJobId:o.id};e(e=>({jobs:[...e.jobs,s]}));let c=setInterval(async()=>{try{let e=await ns(o.id);if(!e)return;let r=Math.round((e.progress||0)*100),a=Yd(e.status);t().updateJob(i,{progress:r,status:a,error:e.error}),(a===`complete`||a===`error`)&&(clearInterval(c),t()._pollIntervals.delete(i),a===`complete`&&Wc.getState().updateModel(n,{downloaded:!0,status:`cached`}))}catch(e){console.error(`[JobStore] Polling failed:`,e)}},2e3);t()._pollIntervals.set(i,c)}catch(t){console.error(`[JobStore] Download trigger failed:`,t),e(e=>({jobs:e.jobs.map(e=>e.id===i?{...e,status:`error`,error:t.message}:e)}))}},startResourceSimulation:()=>{if(t()._intervalId||e({_intervalId:setInterval(()=>{let n=t().jobs.map(e=>{if(e.status!==`running`)return e;let t=Math.min(e.progress+Math.random()*3+.5,100);return t>=100?{...e,progress:100,status:`complete`,completedAt:Date.now()}:{...e,progress:t}}),r=n.filter(e=>e.status===`running`).length;e({jobs:n.map(e=>e.status===`queued`&&r<2?{...e,status:`running`,startedAt:Date.now()}:e)})},800)}),!t()._metricsStream){console.log(`[JobStore] Initializing system metrics stream...`),cs().then(t=>{e({cpuUsage:t.cpu_pct,cpuFreq:t.cpu_freq_mhz??0,cpuCount:t.cpu_count??0,ramUsed:t.ram_used_mb,ramTotal:t.ram_total_mb,gpuUsage:t.gpu?.utilization_pct??0,gpuModel:t.gpu?.name??``,gpuTemp:t.gpu?.temperature_c??0,gpuPower:t.gpu?.power_usage_w??0,gpuPowerLimit:t.gpu?.power_limit_w??0,gpuClock:t.gpu?.clock_graphics_mhz??0,vramUsed:(t.gpu?.mem_used_mb??0)/1024,vramTotal:(t.gpu?.mem_total_mb??0)/1024,disks:t.disks||[],network:t.network||[]})}).catch(e=>{console.warn(`[JobStore] Failed to fetch initial snapshot:`,e)});let t=ls({hz:2}),n=0,r={cpu:0,gpu:0,vram:0,temp:0},i={cpu:!1,temp:!1,vram:!1};t.onmessage=t=>{try{if(!t.data||t.data.trim()===`: connected`||t.data.trim()===`: heartbeat`)return;let a=JSON.parse(t.data),o=Date.now(),s=a.gpu?.utilization_pct??0,c=a.gpu?.name??``,l=(a.gpu?.mem_used_mb??0)/1024,u=(a.gpu?.mem_total_mb??0)/1024,d=Math.round(a.gpu?.temperature_c??0),f=Jd(a.cpu_pct,0,100),p=a.cpu_model??``,m=Jd(s,0,100),h=u>0?u:1,g=u>0?Jd(l,0,u):0,_=g/h*100,{addNotification:v}=Wd.getState();f>Kd.CPU_CRITICAL?i.cpu||=(v({type:`warning`,title:`High CPU Usage`,message:`CPU utilization reached ${f.toFixed(1)}%`}),!0):fKd.GPU_TEMP_CRITICAL?i.temp||=(v({type:`error`,title:`GPU Thermal Alert`,message:`GPU temperature at ${d}°C`}),!0):dKd.VRAM_CRITICAL?i.vram||=(v({type:`warning`,title:`VRAM Pressure`,message:`GPU memory usage at ${_.toFixed(1)}%`}),!0):_1||Math.abs(m-r.gpu)>1||Math.abs(_-r.vram)>1||d!==r.temp;if(o-n<250&&!y)return;n=o,r={cpu:f,gpu:m,vram:_,temp:d},e(e=>({cpuUsage:f,cpuFreq:a.cpu_freq_mhz??0,cpuCount:a.cpu_count??0,cpuModel:p,ramUsed:a.ram_used_mb,ramTotal:a.ram_total_mb,gpuUsage:m,gpuModel:c,gpuTemp:d,gpuPower:Math.round(a.gpu?.power_usage_w??0),gpuPowerLimit:Math.round(a.gpu?.power_limit_w??0),gpuClock:Math.round(a.gpu?.clock_graphics_mhz??0),vramUsed:Number(g.toFixed(2)),vramTotal:Number(h.toFixed(2)),disks:a.disks||[],network:a.network||[]}));try{let e=G.getState();e&&e.telemetry&&G.setState(e=>({telemetry:{gpuTemp:Fl(e.telemetry?.gpuTemp,a.gpu?.temperature_c??0),gpuClock:Fl(e.telemetry?.gpuClock,(a.gpu?.utilization_pct??0)*20),vramUsage:Fl(e.telemetry?.vramUsage,g),powerDraw:Fl(e.telemetry?.powerDraw,a.gpu?.power_usage_w??0)}}))}catch{}}catch(e){console.error(`[JobStore] Failed to parse metrics data:`,e),console.error(`[JobStore] Failed on data:`,t.data)}},t.onerror=e=>{console.error(`[JobStore] SSE Stream Error. ReadyState:`,t.readyState,e)},t.onopen=()=>{console.log(`[JobStore] SSE Connection Established to:`,t.url)},e({_metricsStream:t})}},stopResourceSimulation:()=>{let n=t()._intervalId;n&&(clearInterval(n),e({_intervalId:null}));let r=t()._metricsStream;r&&(r.close(),e({_metricsStream:null}))},getActiveJobs:()=>t().jobs.filter(e=>e.status===`running`||e.status===`queued`)}));function Zd(){Xd(e=>e.gpuUsage);let e=Xd(e=>e.getActiveJobs),{activeView:t,setActiveView:n}=Uo(),r=zl(e=>e.activeProject),i=e();return(0,L.jsxs)(`header`,{className:`h-[52px] flex items-center px-4 gap-4 bg-zinc-950 border-b border-zinc-800/80 shrink-0 z-20`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`div`,{className:`h-7 w-7 rounded-md bg-gradient-to-br from-blue-500 to-violet-600 flex items-center justify-center shadow-lg shadow-blue-900/30`,children:(0,L.jsx)(qu,{className:`h-3.5 w-3.5 text-white`})}),(0,L.jsx)(`span`,{className:`text-sm font-semibold text-zinc-100 tracking-tight`,children:`MLForge`})]}),(0,L.jsx)(lu,{className:`h-3.5 w-3.5 text-zinc-800`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1 rounded-md bg-zinc-900 border border-zinc-800/80 shadow-sm`,children:[(0,L.jsx)(ju,{className:`h-5.1 w-4 text-gray-400`}),(0,L.jsx)(`span`,{className:`text-xs font-semibold text-zinc-200 tracking-tight`,children:r?r.name:`No Project`})]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-px rounded-md bg-zinc-900 p-0.5 border border-zinc-800/80`,children:[(0,L.jsxs)(`button`,{onClick:()=>n(`explore`),className:U(`flex items-center gap-1.5 px-3 py-1.5 rounded-sm text-[11px] font-medium transition-all cursor-pointer`,t===`explore`?`bg-zinc-700 text-zinc-100 shadow-sm`:`text-zinc-500 hover:text-zinc-300`),children:[(0,L.jsx)(hu,{className:`h-3 w-3`}),`Explore`]}),(0,L.jsxs)(`button`,{onClick:()=>n(`benchmark`),className:U(`flex items-center gap-1.5 px-3 py-1.5 rounded-sm text-[11px] font-medium transition-all cursor-pointer`,t===`benchmark`?`bg-zinc-700 text-zinc-100 shadow-sm`:`text-zinc-500 hover:text-zinc-300`),children:[(0,L.jsx)(iu,{className:`h-3 w-3`}),`Benchmark`]}),(0,L.jsxs)(`button`,{onClick:()=>n(`datasets`),className:U(`flex items-center gap-1.5 px-3 py-1.5 rounded-sm text-[11px] font-medium transition-all cursor-pointer`,t===`datasets`?`bg-zinc-700 text-zinc-100 shadow-sm`:`text-zinc-500 hover:text-zinc-300`),children:[(0,L.jsx)(_u,{className:`h-3 w-3`}),`Datasets`]}),(0,L.jsxs)(`button`,{onClick:()=>n(`inference`),className:U(`flex items-center gap-1.5 px-3 py-1.5 rounded-sm text-[11px] font-medium transition-all cursor-pointer`,t===`inference`?`bg-zinc-700 text-zinc-100 shadow-sm`:`text-zinc-500 hover:text-zinc-300`),children:[(0,L.jsx)(Au,{className:`h-3 w-3`}),`Inference`]}),(0,L.jsxs)(`button`,{onClick:()=>n(`training`),className:U(`flex items-center gap-1.5 px-3 py-1.5 rounded-sm text-[11px] font-medium transition-all cursor-pointer`,t===`training`?`bg-zinc-700 text-zinc-100 shadow-sm`:`text-zinc-500 hover:text-zinc-300`),children:[(0,L.jsx)(Iu,{className:`h-3 w-3`}),`Training`]}),(0,L.jsxs)(`button`,{onClick:()=>n(`logs`),className:U(`flex items-center gap-1.5 px-3 py-1.5 rounded-sm text-[11px] font-medium transition-all cursor-pointer`,t===`logs`?`bg-zinc-700 text-zinc-100 shadow-sm`:`text-zinc-500 hover:text-zinc-300`),children:[(0,L.jsx)(Dd,{className:`h-3 w-3`}),`Logs`]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0 ml-auto`,children:[(0,L.jsxs)(Po,{children:[(0,L.jsx)(Fo,{asChild:!0,children:(0,L.jsxs)(`button`,{className:`relative h-8 w-8 rounded-md flex items-center justify-center text-zinc-400 hover:text-zinc-200 hover:bg-zinc-800 transition-colors cursor-pointer`,children:[(0,L.jsx)($l,{className:`h-4 w-4`}),i.length>0&&(0,L.jsx)(`span`,{className:`absolute top-1.5 right-1.5 h-1.5 w-1.5 rounded-full bg-blue-500`})]})}),(0,L.jsx)(Io,{side:`bottom`,children:`Notifications`})]}),(0,L.jsx)(`div`,{className:`w-px h-5 bg-zinc-800`}),(0,L.jsx)(`div`,{className:`h-7 w-7 rounded-full bg-gradient-to-br from-blue-500 to-violet-600 flex items-center justify-center cursor-pointer ring-2 ring-zinc-800 hover:ring-zinc-600 transition-all`,children:(0,L.jsx)(Fd,{className:`h-3.5 w-3.5 text-white`})})]})]})}var Qd=I.createContext(void 0);function $d(e){let t=I.useContext(Qd);return e||t||`ltr`}function ef(e,[t,n]){return Math.min(n,Math.max(t,e))}function tf(e,t){return I.useReducer((e,n)=>t[e][n]??e,e)}var nf=`ScrollArea`,[rf,af]=We(nf),[of,sf]=rf(nf),cf=I.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=I.useState(null),[l,u]=I.useState(null),[d,f]=I.useState(null),[p,m]=I.useState(null),[h,g]=I.useState(null),[_,v]=I.useState(0),[y,b]=I.useState(0),[x,S]=I.useState(!1),[C,w]=I.useState(!1),T=He(t,e=>c(e)),E=$d(i);return(0,L.jsx)(of,{scope:n,type:r,dir:E,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:x,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:C,onScrollbarYEnabledChange:w,onCornerWidthChange:v,onCornerHeightChange:b,children:(0,L.jsx)($e.div,{dir:E,...o,ref:T,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})})});cf.displayName=nf;var lf=`ScrollAreaViewport`,uf=I.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=sf(lf,n),s=He(t,I.useRef(null),o.onViewportChange);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,L.jsx)($e.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,L.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});uf.displayName=lf;var df=`ScrollAreaScrollbar`,ff=I.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=sf(df,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return I.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,L.jsx)(pf,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,L.jsx)(mf,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,L.jsx)(hf,{...r,ref:t,forceMount:n}):i.type===`always`?(0,L.jsx)(gf,{...r,ref:t}):null});ff.displayName=df;var pf=I.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=sf(df,e.__scopeScrollArea),[a,o]=I.useState(!1);return I.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,L.jsx)(ci,{present:n||a,children:(0,L.jsx)(hf,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),mf=I.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=sf(df,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=If(()=>c(`SCROLL_END`),100),[s,c]=tf(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return I.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),I.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,L.jsx)(ci,{present:n||s!==`hidden`,children:(0,L.jsx)(gf,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:R(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:R(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),hf=I.forwardRef((e,t)=>{let n=sf(df,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=I.useState(!1),s=e.orientation===`horizontal`,c=If(()=>{if(n.viewport){let e=n.viewport.offsetWidth{let{orientation:n=`vertical`,...r}=e,i=sf(df,e.__scopeScrollArea),a=I.useRef(null),o=I.useRef(0),[s,c]=I.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=kf(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return jf(e,o.current,s,t)}return n===`horizontal`?(0,L.jsx)(_f,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Mf(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,L.jsx)(vf,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Mf(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),_f=I.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=sf(df,e.__scopeScrollArea),[o,s]=I.useState(),c=I.useRef(null),l=He(t,c,a.onScrollbarXChange);return I.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,L.jsx)(xf,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":Af(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Pf(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Of(o.paddingLeft),paddingEnd:Of(o.paddingRight)}})}})}),vf=I.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=sf(df,e.__scopeScrollArea),[o,s]=I.useState(),c=I.useRef(null),l=He(t,c,a.onScrollbarYChange);return I.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,L.jsx)(xf,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":Af(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Pf(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Of(o.paddingTop),paddingEnd:Of(o.paddingBottom)}})}})}),[yf,bf]=rf(df),xf=I.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=sf(df,n),[m,h]=I.useState(null),g=He(t,e=>h(e)),_=I.useRef(null),v=I.useRef(``),y=p.viewport,b=r.content-r.viewport,x=tt(u),S=tt(c),C=If(d,10);function w(e){_.current&&l({x:e.clientX-_.current.left,y:e.clientY-_.current.top})}return I.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&x(e,b)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b,x]),I.useEffect(S,[r,S]),Lf(m,C),Lf(p.content,C),(0,L.jsx)(yf,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:tt(a),onThumbPointerUp:tt(o),onThumbPositionChange:S,onThumbPointerDown:tt(s),children:(0,L.jsx)($e.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:R(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),w(e))}),onPointerMove:R(e.onPointerMove,w),onPointerUp:R(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})}),Sf=`ScrollAreaThumb`,Cf=I.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=bf(Sf,e.__scopeScrollArea);return(0,L.jsx)(ci,{present:n||i.hasThumb,children:(0,L.jsx)(wf,{ref:t,...r})})}),wf=I.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=sf(Sf,n),o=bf(Sf,n),{onThumbPositionChange:s}=o,c=He(t,e=>o.onThumbChange(e)),l=I.useRef(void 0),u=If(()=>{l.current&&=(l.current(),void 0)},100);return I.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{u(),l.current||(l.current=Ff(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,L.jsx)($e.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:R(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:R(e.onPointerUp,o.onThumbPointerUp)})});Cf.displayName=Sf;var Tf=`ScrollAreaCorner`,Ef=I.forwardRef((e,t)=>{let n=sf(Tf,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,L.jsx)(Df,{...e,ref:t}):null});Ef.displayName=Tf;var Df=I.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=sf(Tf,n),[a,o]=I.useState(0),[s,c]=I.useState(0),l=!!(a&&s);return Lf(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Lf(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,L.jsx)($e.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function Of(e){return e?parseInt(e,10):0}function kf(e,t){let n=e/t;return isNaN(n)?0:n}function Af(e){let t=kf(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function jf(e,t,n,r=`ltr`){let i=Af(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Nf([c,l],d)(e)}function Mf(e,t,n=`ltr`){let r=Af(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=ef(e,n===`ltr`?[0,o]:[o*-1,0]);return Nf([0,o],[0,s])(c)}function Nf(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Pf(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function If(e,t){let n=tt(e),r=I.useRef(0);return I.useEffect(()=>()=>window.clearTimeout(r.current),[]),I.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Lf(e,t){let n=tt(t);gt(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var Rf=cf,zf=uf,Bf=Ef,Vf=I.forwardRef(({className:e,children:t,...n},r)=>(0,L.jsxs)(Rf,{ref:r,className:U(`relative overflow-hidden`,e),...n,children:[(0,L.jsx)(zf,{className:`h-full w-full rounded-[inherit]`,children:t}),(0,L.jsx)(Hf,{}),(0,L.jsx)(Bf,{})]}));Vf.displayName=Rf.displayName;var Hf=I.forwardRef(({className:e,orientation:t=`vertical`,...n},r)=>(0,L.jsx)(ff,{ref:r,orientation:t,className:U(`flex touch-none select-none transition-colors`,t===`vertical`&&`h-full w-2 border-l border-l-transparent p-[1px]`,t===`horizontal`&&`h-2 flex-col border-t border-t-transparent p-[1px]`,e),...n,children:(0,L.jsx)(Cf,{className:`relative flex-1 rounded-full bg-zinc-700`})}));Hf.displayName=ff.displayName;var Uf=Symbol.for(`react.lazy`),Wf=I.use;function Gf(e){return typeof e==`object`&&!!e&&`then`in e}function Kf(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Uf&&`_payload`in e&&Gf(e._payload)}function qf(e){let t=Yf(e),n=I.forwardRef((e,n)=>{let{children:r,...i}=e;Kf(r)&&typeof Wf==`function`&&(r=Wf(r._payload));let a=I.Children.toArray(r),o=a.find(Zf);if(o){let e=o.props.children,r=a.map(t=>t===o?I.Children.count(e)>1?I.Children.only(null):I.isValidElement(e)?e.props.children:null:t);return(0,L.jsx)(t,{...i,ref:n,children:I.isValidElement(e)?I.cloneElement(e,void 0,r):null})}return(0,L.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Jf=qf(`Slot`);function Yf(e){let t=I.forwardRef((e,t)=>{let{children:n,...r}=e;if(Kf(n)&&typeof Wf==`function`&&(n=Wf(n._payload)),I.isValidElement(n)){let e=$f(n),i=Qf(r,n.props);return n.type!==I.Fragment&&(i.ref=t?Ve(t,e):e),I.cloneElement(n,i)}return I.Children.count(n)>1?I.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Xf=Symbol(`radix.slottable`);function Zf(e){return I.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Xf}function Qf(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function $f(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ep=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=qf(`Primitive.${t}`),r=I.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,L.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),tp=`Separator`,np=`horizontal`,rp=[`horizontal`,`vertical`],ip=I.forwardRef((e,t)=>{let{decorative:n,orientation:r=np,...i}=e,a=ap(r)?r:np,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,L.jsx)(ep.div,{"data-orientation":a,...o,...i,ref:t})});ip.displayName=tp;function ap(e){return rp.includes(e)}var op=ip,sp=I.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,L.jsx)(op,{ref:i,decorative:n,orientation:t,className:U(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));sp.displayName=op.displayName;var cp=typeof window<`u`?I.useLayoutEffect:I.useEffect;function lp(e){if(e!==void 0)switch(typeof e){case`number`:return e;case`string`:if(e.endsWith(`px`))return parseFloat(e);break}}function up({box:e,defaultHeight:t,defaultWidth:n,disabled:r,element:i,mode:a,style:o}){let{styleHeight:s,styleWidth:c}=(0,I.useMemo)(()=>({styleHeight:lp(o?.height),styleWidth:lp(o?.width)}),[o?.height,o?.width]),[l,u]=(0,I.useState)({height:t,width:n}),d=r||a===`only-height`&&s!==void 0||a===`only-width`&&c!==void 0||s!==void 0&&c!==void 0;return cp(()=>{if(i===null||d)return;let t=new ResizeObserver(e=>{for(let t of e){let{contentRect:e,target:n}=t;i===n&&u(t=>t.height===e.height&&t.width===e.width?t:{height:e.height,width:e.width})}});return t.observe(i,{box:e}),()=>{t?.unobserve(i)}},[e,d,i,s,c]),(0,I.useMemo)(()=>({height:s??l.height,width:c??l.width}),[l,s,c])}function dp(e){let t=(0,I.useRef)(()=>{throw Error(`Cannot call during render.`)});return cp(()=>{t.current=e},[e]),(0,I.useCallback)(e=>t.current?.(e),[t])}var fp=null;function pp(e=!1){if(fp===null||e){let e=document.createElement(`div`),t=e.style;t.width=`50px`,t.height=`50px`,t.overflow=`scroll`,t.direction=`rtl`;let n=document.createElement(`div`),r=n.style;return r.width=`100px`,r.height=`100px`,e.appendChild(n),document.body.appendChild(e),e.scrollLeft>0?fp=`positive-descending`:(e.scrollLeft=1,fp=e.scrollLeft===0?`negative`:`positive-ascending`),document.body.removeChild(e),fp}return fp}function mp({containerElement:e,direction:t,isRtl:n,scrollOffset:r}){if(t===`horizontal`&&n)switch(pp()){case`negative`:return-r;case`positive-descending`:if(e){let{clientWidth:t,scrollLeft:n,scrollWidth:r}=e;return r-t-n}break}return r}function hp(e,t=`Assertion error`){if(!e)throw console.error(t),Error(t)}function gp(e,t){if(e===t)return!0;if(!!e!=!!t||(hp(e!==void 0),hp(t!==void 0),Object.keys(e).length!==Object.keys(t).length))return!1;for(let n in e)if(!Object.is(t[n],e[n]))return!1;return!0}function _p({cachedBounds:e,itemCount:t,itemSize:n}){if(t===0)return 0;if(typeof n==`number`)return t*n;{let n=e.get(e.size===0?0:e.size-1);return hp(n!==void 0,`Unexpected bounds cache miss`),t*((n.scrollOffset+n.size)/e.size)}}function vp({align:e,cachedBounds:t,index:n,itemCount:r,itemSize:i,containerScrollOffset:a,containerSize:o}){if(n<0||n>=r)throw RangeError(`Invalid index specified: ${n}`,{cause:`Index ${n} is not within the range of 0 - ${r-1}`});let s=_p({cachedBounds:t,itemCount:r,itemSize:i}),c=t.get(n),l=Math.max(0,Math.min(s-o,c.scrollOffset)),u=Math.max(0,c.scrollOffset-o+c.size);switch(e===`smart`&&(e=a>=u&&a<=l?`auto`:`center`),e){case`start`:return l;case`end`:return u;case`center`:return c.scrollOffset<=o/2?0:c.scrollOffset+c.size/2>=s-o/2?s-o:c.scrollOffset+c.size/2-o/2;default:return a>=u&&a<=l?a:at)break;u++}for(o=u,c=Math.max(0,o-i);u=t+n)break;u++}return s=Math.min(a,u),l=Math.min(r-1,s+i),o<0&&(o=0,s=-1,c=0,l=-1),{startIndexVisible:o,stopIndexVisible:s,startIndexOverscan:c,stopIndexOverscan:l}}function bp({itemCount:e,itemProps:t,itemSize:n}){let r=new Map;return{get(i){for(hp(ibp({itemCount:e,itemProps:t,itemSize:n}),[e,t,n])}function Sp({containerSize:e,itemSize:t}){let n;switch(typeof t){case`string`:hp(t.endsWith(`%`),`Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`),hp(e!==void 0,`Container size must be defined if a percentage item size is specified`),n=e*parseInt(t)/100;break;default:n=t;break}return n}function Cp({containerElement:e,containerStyle:t,defaultContainerSize:n=0,direction:r,isRtl:i=!1,itemCount:a,itemProps:o,itemSize:s,onResize:c,overscanCount:l}){let{height:u=n,width:d=n}=up({defaultHeight:r===`vertical`?n:void 0,defaultWidth:r===`horizontal`?n:void 0,element:e,mode:r===`vertical`?`only-height`:`only-width`,style:t}),f=(0,I.useRef)({height:0,width:0}),p=r===`vertical`?u:d,m=Sp({containerSize:p,itemSize:s});(0,I.useLayoutEffect)(()=>{if(typeof c==`function`){let e=f.current;(e.height!==u||e.width!==d)&&(c({height:u,width:d},{...e}),e.height=u,e.width=d)}},[u,c,d]);let h=xp({itemCount:a,itemProps:o,itemSize:m}),g=(0,I.useCallback)(e=>h.get(e),[h]),[_,v]=(0,I.useState)(()=>yp({cachedBounds:h,containerScrollOffset:0,containerSize:p,itemCount:a,overscanCount:l})),{startIndexVisible:y,startIndexOverscan:b,stopIndexVisible:x,stopIndexOverscan:S}={startIndexVisible:Math.min(a-1,_.startIndexVisible),startIndexOverscan:Math.min(a-1,_.startIndexOverscan),stopIndexVisible:Math.min(a-1,_.stopIndexVisible),stopIndexOverscan:Math.min(a-1,_.stopIndexOverscan)},C=(0,I.useCallback)(()=>_p({cachedBounds:h,itemCount:a,itemSize:m}),[h,a,m]),w=(0,I.useCallback)(t=>yp({cachedBounds:h,containerScrollOffset:mp({containerElement:e,direction:r,isRtl:i,scrollOffset:t}),containerSize:p,itemCount:a,overscanCount:l}),[h,e,p,r,i,a,l]);return cp(()=>{v(w((r===`vertical`?e?.scrollTop:e?.scrollLeft)??0))},[e,r,w]),cp(()=>{if(!e)return;let t=()=>{v(t=>{let{scrollLeft:n,scrollTop:o}=e,s=yp({cachedBounds:h,containerScrollOffset:mp({containerElement:e,direction:r,isRtl:i,scrollOffset:r===`vertical`?o:n}),containerSize:p,itemCount:a,overscanCount:l});return gp(s,t)?t:s})};return e.addEventListener(`scroll`,t),()=>{e.removeEventListener(`scroll`,t)}},[h,e,p,r,a,l]),{getCellBounds:g,getEstimatedSize:C,scrollToIndex:dp(({align:t=`auto`,containerScrollOffset:n,index:o})=>{let s=vp({align:t,cachedBounds:h,containerScrollOffset:n,containerSize:p,index:o,itemCount:a,itemSize:m});if(e){if(s=mp({containerElement:e,direction:r,isRtl:i,scrollOffset:s}),typeof e.scrollTo!=`function`){let e=w(s);gp(_,e)||v(e)}return s}}),startIndexOverscan:b,startIndexVisible:y,stopIndexOverscan:S,stopIndexVisible:x}}function wp(e){return(0,I.useMemo)(()=>e,Object.values(e))}function Tp(e,t){let{ariaAttributes:n,style:r,...i}=e,{ariaAttributes:a,style:o,...s}=t;return gp(n,a)&&gp(r,o)&&gp(i,s)}function Ep(e){return typeof e==`object`&&!!e&&`getAverageRowHeight`in e&&typeof e.getAverageRowHeight==`function`}var Dp=`data-react-window-index`;function Op({children:e,className:t,defaultHeight:n=0,listRef:r,onResize:i,onRowsRendered:a,overscanCount:o=3,rowComponent:s,rowCount:c,rowHeight:l,rowProps:u,tagName:d=`div`,style:f,...p}){let m=wp(u),h=(0,I.useMemo)(()=>(0,I.memo)(s,Tp),[s]),[g,_]=(0,I.useState)(null),v=Ep(l),{getCellBounds:y,getEstimatedSize:b,scrollToIndex:x,startIndexOverscan:S,startIndexVisible:C,stopIndexOverscan:w,stopIndexVisible:T}=Cp({containerElement:g,containerStyle:f,defaultContainerSize:n,direction:`vertical`,itemCount:c,itemProps:m,itemSize:(0,I.useMemo)(()=>v?e=>l.getRowHeight(e)??l.getAverageRowHeight():l,[v,l]),onResize:i,overscanCount:o});(0,I.useImperativeHandle)(r,()=>({get element(){return g},scrollToRow({align:e=`auto`,behavior:t=`auto`,index:n}){let r=x({align:e,containerScrollOffset:g?.scrollTop??0,index:n});typeof g?.scrollTo==`function`&&g.scrollTo({behavior:t,top:r})}}),[g,x]),cp(()=>{if(!g)return;let e=Array.from(g.children).filter((e,t)=>{if(e.hasAttribute(`aria-hidden`))return!1;let n=`${S+t}`;return e.setAttribute(Dp,n),!0});if(v)return l.observeRowElements(e)},[g,v,l,S,w]),(0,I.useEffect)(()=>{S>=0&&w>=0&&a&&a({startIndex:C,stopIndex:T},{startIndex:S,stopIndex:w})},[a,S,C,w,T]);let E=(0,I.useMemo)(()=>{let e=[];if(c>0)for(let t=S;t<=w;t++){let n=y(t);e.push((0,I.createElement)(h,{...m,ariaAttributes:{"aria-posinset":t+1,"aria-setsize":c,role:`listitem`},key:t,index:t,style:{position:`absolute`,left:0,transform:`translateY(${n.scrollOffset}px)`,height:v?void 0:n.size,width:`100%`}}))}return e},[h,y,v,c,m,S,w]),D=(0,L.jsx)(`div`,{"aria-hidden":!0,style:{height:b(),width:`100%`,zIndex:-1}});return(0,I.createElement)(d,{role:`list`,...p,className:t,ref:_,style:{position:`relative`,maxHeight:`100%`,flexGrow:1,overflowY:`auto`,...f}},E,e,D)}var kp=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Ap=z,jp=(e,t)=>n=>{if(t?.variants==null)return Ap(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=kp(t)||kp(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Ap(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Mp=jp(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-10 px-4 py-2`,sm:`h-9 rounded-md px-3`,lg:`h-11 rounded-md px-8`,icon:`h-10 w-10`}},defaultVariants:{variant:`default`,size:`default`}}),Np=I.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,L.jsx)(r?Jf:`button`,{className:U(Mp({variant:t,size:n,className:e})),ref:a,...i}));Np.displayName=`Button`;function Pp(e,t=[]){let n=[];function r(t,r){let i=I.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=I.useMemo(()=>o,Object.values(o));return(0,L.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=I.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>I.createContext(e));return function(n){let r=n?.[e]||t;return I.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Fp(i,...t)]}function Fp(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Ip=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=qf(`Primitive.${t}`),r=I.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,L.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Lp=`Progress`,Rp=100,[zp,Bp]=Pp(Lp),[Vp,Hp]=zp(Lp),Up=I.forwardRef((e,t)=>{let{__scopeProgress:n,value:r=null,max:i,getValueLabel:a=Kp,...o}=e;(i||i===0)&&!Yp(i)&&console.error(Zp(`${i}`,`Progress`));let s=Yp(i)?i:Rp;r!==null&&!Xp(r,s)&&console.error(Qp(`${r}`,`Progress`));let c=Xp(r,s)?r:null,l=Jp(c)?a(c,s):void 0;return(0,L.jsx)(Vp,{scope:n,value:c,max:s,children:(0,L.jsx)(Ip.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":Jp(c)?c:void 0,"aria-valuetext":l,role:`progressbar`,"data-state":qp(c,s),"data-value":c??void 0,"data-max":s,...o,ref:t})})});Up.displayName=Lp;var Wp=`ProgressIndicator`,Gp=I.forwardRef((e,t)=>{let{__scopeProgress:n,...r}=e,i=Hp(Wp,n);return(0,L.jsx)(Ip.div,{"data-state":qp(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})});Gp.displayName=Wp;function Kp(e,t){return`${Math.round(e/t*100)}%`}function qp(e,t){return e==null?`indeterminate`:e===t?`complete`:`loading`}function Jp(e){return typeof e==`number`}function Yp(e){return Jp(e)&&!isNaN(e)&&e>0}function Xp(e,t){return Jp(e)&&!isNaN(e)&&e<=t&&e>=0}function Zp(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Rp}\`.`}function Qp(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
- - a positive number
- - less than the value passed to \`max\` (or ${Rp} if no \`max\` prop is set)
- - \`null\` or \`undefined\` if the progress is indeterminate.
-
-Defaulting to \`null\`.`}var $p=Up,em=Gp,tm=I.forwardRef(({className:e,value:t,...n},r)=>(0,L.jsx)($p,{ref:r,className:U(`relative h-1.5 w-full overflow-hidden rounded-full bg-zinc-700`,e),...n,children:(0,L.jsx)(em,{className:`h-full w-full flex-1 bg-gradient-to-r from-blue-600 to-blue-400 transition-all`,style:{transform:`translateX(-${100-(t??0)}%)`}})}));tm.displayName=$p.displayName;var nm={detection:{dot:`bg-orange-500`,text:`text-orange-400`,label:`Detection`},classification:{dot:`bg-blue-500`,text:`text-blue-400`,label:`Classification`},segmentation:{dot:`bg-purple-500`,text:`text-purple-400`,label:`Segmentation`},generation:{dot:`bg-pink-500`,text:`text-pink-400`,label:`Generation`},embedding:{dot:`bg-teal-500`,text:`text-teal-400`,label:`Embedding`}},rm={dot:`bg-zinc-700`,text:`text-zinc-400`,label:`Unknown`},im={pytorch:`PyTorch`,onnx:`ONNX`,tensorflow:`TensorFlow`,tflite:`TFLite`,coreml:`Core ML`};function am(e){return e.includes(`sota`)||e.includes(`high-accuracy`)?`SOTA`:e.includes(`fastest`)||e.includes(`real-time`)?`Fast`:e.includes(`best-for-edge`)||e.includes(`edge`)?`Edge`:e.includes(`recommended`)?`Pick`:e.includes(`lightweight`)||e.includes(`tiny`)?`Lite`:null}function om(e){return e?e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`:``}function sm({model:e,style:t,hideActions:n}){let{inspectedModel:r,setInspected:i,addToComparison:a,comparisonModels:o,selectedIds:s,toggleSelect:c}=Uo(),{jobs:l}=Xd(),u=l.find(t=>t.modelId===e.id&&t.type===`download`&&(t.status===`running`||t.status===`queued`)),d=!!u,f=u?.progress??0,p=r?.id===e.id,m=s.has(e.id),h=o.some(t=>t.id===e.id),g=p||m||h,_=nm[e.task]??rm,v=am(e.tags),y=e.metrics.mAP??e.metrics.top1??e.metrics.accuracy,b=om(e.downloads),x=I.useMemo(()=>{if(!t)return;let e={...t};for(let t of[`top`,`left`,`right`,`bottom`,`width`,`height`]){let n=e[t];typeof n==`number`&&Number.isNaN(n)&&delete e[t]}return e},[t]);return(0,L.jsxs)(`div`,{style:x,onClick:t=>{t.stopPropagation(),i(p?null:e)},className:U(`group relative flex flex-col rounded-xl border transition-all duration-150 cursor-pointer select-none overflow-hidden`,g?`border-blue-500/60 bg-blue-950/10 shadow-md shadow-blue-900/20 ring-1 ring-blue-500/20`:`border-zinc-800 bg-zinc-900/60 hover:border-zinc-700 hover:bg-zinc-900`),children:[g&&(0,L.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-blue-500 to-transparent`}),(0,L.jsxs)(`div`,{className:`p-3.5 flex flex-col gap-2.5 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-2 min-w-0`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`p`,{className:`text-[13px] font-semibold text-zinc-100 truncate leading-snug`,children:e.name}),e.variant&&(0,L.jsx)(`p`,{className:`text-[11px] text-zinc-600 truncate mt-0.5`,children:e.variant})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 mt-0.5`,children:[e.liked&&(0,L.jsx)(q,{className:`h-3 w-3 text-amber-400 fill-amber-400 shrink-0`}),e.downloaded&&(0,L.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-500 shrink-0`,title:`Cached locally`})]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`span`,{className:U(`h-1.5 w-1.5 rounded-full shrink-0`,_.dot)}),(0,L.jsx)(`span`,{className:U(`text-[11px] font-medium`,_.text),children:_.label})]}),(0,L.jsx)(`span`,{className:`text-zinc-800`,children:`·`}),(0,L.jsx)(`span`,{className:`text-[11px] text-zinc-500`,children:im[e.framework]}),v&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`text-zinc-800`,children:`·`}),(0,L.jsx)(`span`,{className:`text-[10px] font-semibold text-blue-400 bg-blue-500/10 px-1.5 py-0.5 rounded-sm`,children:v})]})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] font-mono`,children:[e.metrics.latency_ms==null?(0,L.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,L.jsx)(`span`,{className:`text-zinc-700 italic`,children:`-- ms`})}):(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`span`,{className:U(`font-semibold`,Mo(e.metrics.latency_ms)),children:e.metrics.latency_ms.toFixed(1)}),(0,L.jsx)(`span`,{className:`text-zinc-700`,children:`ms`})]}),y==null?(0,L.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,L.jsx)(`span`,{className:`text-zinc-700 italic`,children:`-- %`})}):(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`span`,{className:`font-semibold text-blue-400`,children:y.toFixed(1)}),(0,L.jsx)(`span`,{className:`text-zinc-700`,children:`%`})]}),e.metrics.fps?(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`span`,{className:`font-semibold text-zinc-400`,children:e.metrics.fps}),(0,L.jsx)(`span`,{className:`text-zinc-700`,children:`fps`})]}):(0,L.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,L.jsx)(`span`,{className:`text-zinc-700 italic`,children:`-- fps`})}),(0,L.jsx)(`span`,{className:`ml-auto text-zinc-700`,children:e.size_label})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-between mt-auto pt-1 border-t border-zinc-800/60`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`p`,{className:`text-[10px] text-zinc-600 truncate`,children:e.provider}),b&&(0,L.jsxs)(`p`,{className:`text-[10px] text-zinc-700 font-mono`,children:[b,` dl`]})]}),!n&&(0,L.jsxs)(`div`,{className:`flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,L.jsxs)(Po,{children:[(0,L.jsx)(Fo,{asChild:!0,children:(0,L.jsx)(`button`,{onClick:t=>{if(t.stopPropagation(),!e.downloaded)return;let{setActiveView:n,setInspected:r}=Uo.getState();r(e),n(`benchmark`)},className:`h-6 w-6 flex items-center justify-center rounded text-zinc-500 hover:text-blue-400 hover:bg-blue-500/10 transition-colors cursor-pointer`,children:(0,L.jsx)(cd,{className:`h-3 w-3`})})}),(0,L.jsx)(Io,{children:`Run benchmark`})]}),d?(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-1.5 py-0.5 bg-emerald-500/10 rounded border border-emerald-500/20`,children:[(0,L.jsx)(Qu,{className:`h-3 w-3 text-emerald-500 animate-spin`}),(0,L.jsxs)(`span`,{className:`text-[10px] font-mono font-bold text-emerald-500`,children:[f,`%`]})]}):(0,L.jsxs)(Po,{children:[(0,L.jsx)(Fo,{asChild:!0,children:(0,L.jsx)(`button`,{onClick:async t=>{if(t.stopPropagation(),!navigator.onLine){Wd.getState().addNotification({type:`warning`,title:`Network Offline`,message:`An active internet connection is required to download models. Please check your connection and try again.`});return}if(!e.downloaded)try{await Xd.getState().triggerModelDownload(e.id,e.name)}catch(e){console.error(`Download failed:`,e)}},className:U(`h-6 w-6 flex items-center justify-center rounded transition-colors cursor-pointer`,e.downloaded?`text-emerald-500 cursor-default`:`text-zinc-500 hover:text-emerald-400 hover:bg-emerald-500/10`),children:(0,L.jsx)(vu,{className:`h-3 w-3`})})}),(0,L.jsx)(Io,{children:e.downloaded?`Cached`:`Download`})]}),(0,L.jsxs)(Po,{children:[(0,L.jsx)(Fo,{asChild:!0,children:(0,L.jsx)(`button`,{onClick:t=>{t.stopPropagation(),c(e),!h&&!m&&a(e)},className:U(`h-6 w-6 flex items-center justify-center rounded transition-colors cursor-pointer`,h?`text-blue-400 bg-blue-500/10`:`text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800`),children:(0,L.jsx)(Pu,{className:`h-3 w-3`})})}),(0,L.jsx)(Io,{children:h?`Remove from compare`:`Add to compare`})]})]})]})]})]})}function cm({models:e}){return(0,L.jsx)(`div`,{className:`grid gap-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(210px, 1fr))`},children:e.map(e=>(0,L.jsx)(sm,{model:e},e.id))})}var lm={detection:`bg-orange-500`,classification:`bg-blue-500`,segmentation:`bg-purple-500`,generation:`bg-pink-500`,embedding:`bg-teal-500`},um={detection:`text-orange-400`,classification:`text-blue-400`,segmentation:`text-purple-400`,generation:`text-pink-400`,embedding:`text-teal-400`},dm={detection:`Detection`,classification:`Classify`,segmentation:`Segment`,generation:`Generate`,embedding:`Embed`},fm={pytorch:`PyTorch`,onnx:`ONNX`,tensorflow:`TF`,tflite:`TFLite`,coreml:`CoreML`};function pm({model:e,style:t}){let{inspectedModel:n,setInspected:r,addToComparison:i,comparisonModels:a,selectedIds:o,toggleSelect:s}=Uo(),{addJob:c}=Xd(),l=n?.id===e.id,u=o.has(e.id),d=a.some(t=>t.id===e.id),f=l||u||d,p=e.metrics.mAP??e.metrics.top1??e.metrics.accuracy;return(0,L.jsxs)(`div`,{style:t,onClick:()=>r(l?null:e),className:U(`group flex items-center gap-3 px-4 border-b border-zinc-800/60 cursor-pointer transition-colors`,f?`bg-blue-950/15 border-l-2 border-l-blue-500`:`hover:bg-zinc-900/60`),children:[(0,L.jsx)(`span`,{className:U(`h-1.5 w-1.5 rounded-full shrink-0`,e.downloaded?`bg-emerald-500`:`bg-zinc-800`)}),(0,L.jsxs)(`div`,{className:`w-48 min-w-0 flex items-center gap-1.5`,children:[(0,L.jsx)(`span`,{className:`text-[13px] font-medium text-zinc-200 truncate`,children:e.name}),e.liked&&(0,L.jsx)(q,{className:`h-3 w-3 text-amber-400 fill-amber-400 shrink-0`})]}),(0,L.jsxs)(`div`,{className:`w-24 shrink-0 flex items-center gap-1.5`,children:[(0,L.jsx)(`span`,{className:U(`h-1.5 w-1.5 rounded-full shrink-0`,lm[e.task])}),(0,L.jsx)(`span`,{className:U(`text-[11px] font-medium`,um[e.task]),children:dm[e.task]})]}),(0,L.jsx)(`div`,{className:`w-20 shrink-0`,children:(0,L.jsx)(`span`,{className:`text-[11px] text-zinc-500`,children:fm[e.framework]})}),(0,L.jsx)(`div`,{className:`w-20 shrink-0 text-[11px] font-mono text-zinc-600`,children:e.size_label}),(0,L.jsx)(`div`,{className:`w-20 shrink-0 text-[11px] font-mono`,children:e.metrics.latency_ms==null?(0,L.jsx)(`span`,{className:`text-zinc-800`,children:`—`}):(0,L.jsxs)(`span`,{className:Mo(e.metrics.latency_ms),children:[e.metrics.latency_ms.toFixed(1),`ms`]})}),(0,L.jsx)(`div`,{className:`w-16 shrink-0 text-[11px] font-mono`,children:p==null?(0,L.jsx)(`span`,{className:`text-zinc-800`,children:`—`}):(0,L.jsxs)(`span`,{className:`text-blue-400`,children:[p.toFixed(1),`%`]})}),(0,L.jsx)(`div`,{className:`flex-1 min-w-0 text-[11px] text-zinc-700 truncate`,children:e.provider}),(0,L.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity w-20 justify-end`,children:[(0,L.jsxs)(Po,{children:[(0,L.jsx)(Fo,{asChild:!0,children:(0,L.jsx)(`button`,{onClick:t=>{t.stopPropagation(),c({modelId:e.id,modelName:e.name,type:`benchmark`})},className:`h-6 w-6 flex items-center justify-center rounded text-zinc-600 hover:text-blue-400 hover:bg-blue-500/10 transition-colors cursor-pointer`,children:(0,L.jsx)(cd,{className:`h-3 w-3`})})}),(0,L.jsx)(Io,{children:`Benchmark`})]}),(0,L.jsxs)(Po,{children:[(0,L.jsx)(Fo,{asChild:!0,children:(0,L.jsx)(`button`,{onClick:t=>{t.stopPropagation(),e.downloaded||c({modelId:e.id,modelName:e.name,type:`download`})},className:U(`h-6 w-6 flex items-center justify-center rounded transition-colors cursor-pointer`,e.downloaded?`text-emerald-500 cursor-default`:`text-zinc-600 hover:text-emerald-400 hover:bg-emerald-500/10`),children:(0,L.jsx)(vu,{className:`h-3 w-3`})})}),(0,L.jsx)(Io,{children:e.downloaded?`Cached`:`Download`})]}),(0,L.jsxs)(Po,{children:[(0,L.jsx)(Fo,{asChild:!0,children:(0,L.jsx)(`button`,{onClick:t=>{t.stopPropagation(),s(e),!d&&!u&&i(e)},className:U(`h-6 w-6 flex items-center justify-center rounded transition-colors cursor-pointer`,d?`text-blue-400 bg-blue-500/10`:`text-zinc-600 hover:text-zinc-300 hover:bg-zinc-800`),children:(0,L.jsx)(Pu,{className:`h-3 w-3`})})}),(0,L.jsx)(Io,{children:d?`Remove`:`Compare`})]})]})]})}function mm(){let{loadModels:e,models:t,isLoading:n}=Wc(),r=(0,I.useRef)(!1);(0,I.useEffect)(()=>{!r.current&&t.length===0&&!n&&(r.current=!0,e())},[t.length,e,n])}function hm(e){let t=gm(e),n=I.forwardRef((e,n)=>{let{children:r,...i}=e,a=I.Children.toArray(r),o=a.find(vm);if(o){let e=o.props.children,r=a.map(t=>t===o?I.Children.count(e)>1?I.Children.only(null):I.isValidElement(e)?e.props.children:null:t);return(0,L.jsx)(t,{...i,ref:n,children:I.isValidElement(e)?I.cloneElement(e,void 0,r):null})}return(0,L.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function gm(e){let t=I.forwardRef((e,t)=>{let{children:n,...r}=e;if(I.isValidElement(n)){let e=bm(n),i=ym(r,n.props);return n.type!==I.Fragment&&(i.ref=t?Ve(t,e):e),I.cloneElement(n,i)}return I.Children.count(n)>1?I.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _m=Symbol(`radix.slottable`);function vm(e){return I.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===_m}function ym(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function bm(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function xm(e){let t=e+`CollectionProvider`,[n,r]=We(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=I.useRef(null),a=I.useRef(new Map).current;return(0,L.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=hm(s),l=I.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,L.jsx)(c,{ref:He(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=hm(u),p=I.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=I.useRef(null),s=He(t,o),c=a(u,n);return I.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,L.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return I.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var Sm=0;function Cm(){I.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??wm()),document.body.insertAdjacentElement(`beforeend`,e[1]??wm()),Sm++,()=>{Sm===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Sm--}},[])}function wm(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Tm=`focusScope.autoFocusOnMount`,Em=`focusScope.autoFocusOnUnmount`,Dm={bubbles:!1,cancelable:!0},Om=`FocusScope`,km=I.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=I.useState(null),l=tt(i),u=tt(a),d=I.useRef(null),f=He(t,e=>c(e)),p=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Im(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Im(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Im(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),I.useEffect(()=>{if(s){Lm.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Tm,Dm);s.addEventListener(Tm,l),s.dispatchEvent(t),t.defaultPrevented||(Am(Bm(Mm(s)),{select:!0}),document.activeElement===e&&Im(s))}return()=>{s.removeEventListener(Tm,l),setTimeout(()=>{let t=new CustomEvent(Em,Dm);s.addEventListener(Em,u),s.dispatchEvent(t),t.defaultPrevented||Im(e??document.body,{select:!0}),s.removeEventListener(Em,u),Lm.remove(p)},0)}}},[s,l,u,p]);let m=I.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=jm(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Im(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Im(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,L.jsx)($e.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});km.displayName=Om;function Am(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Im(r,{select:t}),document.activeElement!==n)return}function jm(e){let t=Mm(e);return[Nm(t,e),Nm(t.reverse(),e)]}function Mm(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Nm(e,t){for(let n of e)if(!Pm(n,{upTo:t}))return n}function Pm(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Fm(e){return e instanceof HTMLInputElement&&`select`in e}function Im(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Fm(e)&&t&&e.select()}}var Lm=Rm();function Rm(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=zm(e,t),e.unshift(t)},remove(t){e=zm(e,t),e[0]?.resume()}}}function zm(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Bm(e){return e.filter(e=>e.tagName!==`A`)}var Vm=`rovingFocusGroup.onEntryFocus`,Hm={bubbles:!1,cancelable:!0},Um=`RovingFocusGroup`,[Wm,Gm,Km]=xm(Um),[qm,Jm]=We(Um,[Km]),[Ym,Xm]=qm(Um),Zm=I.forwardRef((e,t)=>(0,L.jsx)(Wm.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,L.jsx)(Wm.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,L.jsx)(Qm,{...e,ref:t})})}));Zm.displayName=Um;var Qm=I.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=I.useRef(null),p=He(t,f),m=$d(a),[h,g]=hi({prop:o,defaultProp:s??null,onChange:c,caller:Um}),[_,v]=I.useState(!1),y=tt(l),b=Gm(n),x=I.useRef(!1),[S,C]=I.useState(0);return I.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Vm,y),()=>e.removeEventListener(Vm,y)},[y]),(0,L.jsx)(Ym,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:I.useCallback(e=>g(e),[g]),onItemShiftTab:I.useCallback(()=>v(!0),[]),onFocusableItemAdd:I.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:I.useCallback(()=>C(e=>e-1),[]),children:(0,L.jsx)($e.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:R(e.onMouseDown,()=>{x.current=!0}),onFocus:R(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Vm,Hm);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);ih([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:R(e.onBlur,()=>v(!1))})})}),$m=`RovingFocusGroupItem`,eh=I.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=yt(),l=a||c,u=Xm($m,n),d=u.currentTabStopId===l,f=Gm(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return I.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,L.jsx)(Wm.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,L.jsx)($e.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:R(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:R(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:R(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=rh(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?ah(n,r+1):n.slice(r+1)}setTimeout(()=>ih(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});eh.displayName=$m;var th={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function nh(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function rh(e,t,n){let r=nh(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return th[r]}function ih(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ah(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var oh=Zm,sh=eh;function ch(e){let t=lh(e),n=I.forwardRef((e,n)=>{let{children:r,...i}=e,a=I.Children.toArray(r),o=a.find(dh);if(o){let e=o.props.children,r=a.map(t=>t===o?I.Children.count(e)>1?I.Children.only(null):I.isValidElement(e)?e.props.children:null:t);return(0,L.jsx)(t,{...i,ref:n,children:I.isValidElement(e)?I.cloneElement(e,void 0,r):null})}return(0,L.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function lh(e){let t=I.forwardRef((e,t)=>{let{children:n,...r}=e;if(I.isValidElement(n)){let e=ph(n),i=fh(r,n.props);return n.type!==I.Fragment&&(i.ref=t?Ve(t,e):e),I.cloneElement(n,i)}return I.Children.count(n)>1?I.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uh=Symbol(`radix.slottable`);function dh(e){return I.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===uh}function fh(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function ph(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mh=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},hh=new WeakMap,gh=new WeakMap,_h={},vh=0,yh=function(e){return e&&(e.host||yh(e.parentNode))},bh=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=yh(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},xh=function(e,t,n,r){var i=bh(t,Array.isArray(e)?e:[e]);_h[n]||(_h[n]=new WeakMap);var a=_h[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(hh.get(e)||0)+1,l=(a.get(e)||0)+1;hh.set(e,c),a.set(e,l),o.push(e),c===1&&i&&gh.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),vh++,function(){o.forEach(function(e){var t=hh.get(e)-1,i=a.get(e)-1;hh.set(e,t),a.set(e,i),t||(gh.has(e)||e.removeAttribute(r),gh.delete(e)),i||e.removeAttribute(n)}),vh--,vh||(hh=new WeakMap,hh=new WeakMap,gh=new WeakMap,_h={})}},Sh=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||mh(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),xh(r,i,n,`aria-hidden`)):function(){return null}},Ch=function(){return Ch=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return Zh;var t=$h(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},tg=Xh(),ng=`data-scroll-locked`,rg=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
- .${Oh} {
- overflow: hidden ${r};
- padding-right: ${s}px ${r};
- }
- body[${ng}] {
- overflow: hidden ${r};
- overscroll-behavior: contain;
- ${[t&&`position: relative ${r};`,n===`margin`&&`
- padding-left: ${i}px;
- padding-top: ${a}px;
- padding-right: ${o}px;
- margin-left:0;
- margin-top:0;
- margin-right: ${s}px ${r};
- `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
- }
-
- .${Eh} {
- right: ${s}px ${r};
- }
-
- .${Dh} {
- margin-right: ${s}px ${r};
- }
-
- .${Eh} .${Eh} {
- right: 0 ${r};
- }
-
- .${Dh} .${Dh} {
- margin-right: 0 ${r};
- }
-
- body[${ng}] {
- ${kh}: ${s}px;
- }
-`},ig=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},ag=function(){I.useEffect(function(){return document.body.setAttribute(ng,(ig()+1).toString()),function(){var e=ig()-1;e<=0?document.body.removeAttribute(ng):document.body.setAttribute(ng,e.toString())}},[])},og=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;ag();var a=I.useMemo(function(){return eg(i)},[i]);return I.createElement(tg,{styles:rg(a,!t,i,n?``:`!important`)})},sg=!1;if(typeof window<`u`)try{var cg=Object.defineProperty({},`passive`,{get:function(){return sg=!0,!0}});window.addEventListener(`test`,cg,cg),window.removeEventListener(`test`,cg,cg)}catch{sg=!1}var lg=sg?{passive:!1}:!1,ug=function(e){return e.tagName===`TEXTAREA`},dg=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!ug(e)&&n[t]===`visible`)},fg=function(e){return dg(e,`overflowY`)},pg=function(e){return dg(e,`overflowX`)},mg=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),_g(e,r)){var i=vg(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},hg=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},gg=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},_g=function(e,t){return e===`v`?fg(t):pg(t)},vg=function(e,t){return e===`v`?hg(t):gg(t)},yg=function(e,t){return e===`h`&&t===`rtl`?-1:1},bg=function(e,t,n,r,i){var a=yg(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=vg(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&_g(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},xg=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Sg=function(e){return[e.deltaX,e.deltaY]},Cg=function(e){return e&&`current`in e?e.current:e},wg=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Tg=function(e){return`
- .block-interactivity-${e} {pointer-events: none;}
- .allow-interactivity-${e} {pointer-events: all;}
-`},Eg=0,Dg=[];function Og(e){var t=I.useRef([]),n=I.useRef([0,0]),r=I.useRef(),i=I.useState(Eg++)[0],a=I.useState(Xh)[0],o=I.useRef(e);I.useEffect(function(){o.current=e},[e]),I.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Th([e.lockRef.current],(e.shards||[]).map(Cg),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=I.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=xg(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=mg(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=mg(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return bg(h,t,e,h===`h`?s:c,!0)},[]),c=I.useCallback(function(e){var n=e;if(!(!Dg.length||Dg[Dg.length-1]!==a)){var r=`deltaY`in n?Sg(n):xg(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&wg(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Cg).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=I.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:kg(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=I.useCallback(function(e){n.current=xg(e),r.current=void 0},[]),d=I.useCallback(function(t){l(t.type,Sg(t),t.target,s(t,e.lockRef.current))},[]),f=I.useCallback(function(t){l(t.type,xg(t),t.target,s(t,e.lockRef.current))},[]);I.useEffect(function(){return Dg.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,lg),document.addEventListener(`touchmove`,c,lg),document.addEventListener(`touchstart`,u,lg),function(){Dg=Dg.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,lg),document.removeEventListener(`touchmove`,c,lg),document.removeEventListener(`touchstart`,u,lg)}},[]);var p=e.removeScrollBar,m=e.inert;return I.createElement(I.Fragment,null,m?I.createElement(a,{styles:Tg(i)}):null,p?I.createElement(og,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function kg(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Ag=zh(Bh,Og),jg=I.forwardRef(function(e,t){return I.createElement(Hh,Ch({},e,{ref:t,sideCar:Ag}))});jg.classNames=Hh.classNames;var Mg=[`Enter`,` `],Ng=[`ArrowDown`,`PageUp`,`Home`],Pg=[`ArrowUp`,`PageDown`,`End`],Fg=[...Ng,...Pg],Ig={ltr:[...Mg,`ArrowRight`],rtl:[...Mg,`ArrowLeft`]},Lg={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Rg=`Menu`,[zg,Bg,Vg]=xm(Rg),[Hg,Ug]=We(Rg,[Vg,zr,Jm]),Wg=zr(),Gg=Jm(),[Kg,qg]=Hg(Rg),[Jg,Yg]=Hg(Rg),Xg=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Wg(t),[c,l]=I.useState(null),u=I.useRef(!1),d=tt(a),f=$d(i);return I.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,L.jsx)(ti,{...s,children:(0,L.jsx)(Kg,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,L.jsx)(Jg,{scope:t,onClose:I.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Xg.displayName=Rg;var Zg=`MenuAnchor`,Qg=I.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Wg(n);return(0,L.jsx)(ni,{...i,...r,ref:t})});Qg.displayName=Zg;var $g=`MenuPortal`,[e_,t_]=Hg($g,{forceMount:void 0}),n_=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=qg($g,t);return(0,L.jsx)(e_,{scope:t,forceMount:n,children:(0,L.jsx)(ci,{present:n||a.open,children:(0,L.jsx)(oi,{asChild:!0,container:i,children:r})})})};n_.displayName=$g;var r_=`MenuContent`,[i_,a_]=Hg(r_),o_=I.forwardRef((e,t)=>{let n=t_(r_,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=qg(r_,e.__scopeMenu),o=Yg(r_,e.__scopeMenu);return(0,L.jsx)(zg.Provider,{scope:e.__scopeMenu,children:(0,L.jsx)(ci,{present:r||a.open,children:(0,L.jsx)(zg.Slot,{scope:e.__scopeMenu,children:o.modal?(0,L.jsx)(s_,{...i,ref:t}):(0,L.jsx)(c_,{...i,ref:t})})})})}),s_=I.forwardRef((e,t)=>{let n=qg(r_,e.__scopeMenu),r=I.useRef(null),i=He(t,r);return I.useEffect(()=>{let e=r.current;if(e)return Sh(e)},[]),(0,L.jsx)(u_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:R(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),c_=I.forwardRef((e,t)=>{let n=qg(r_,e.__scopeMenu);return(0,L.jsx)(u_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),l_=ch(`MenuContent.ScrollLock`),u_=I.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=qg(r_,n),_=Yg(r_,n),v=Wg(n),y=Gg(n),b=Bg(n),[x,S]=I.useState(null),C=I.useRef(null),w=He(t,C,g.onContentChange),T=I.useRef(0),E=I.useRef(``),D=I.useRef(0),O=I.useRef(null),k=I.useRef(`right`),A=I.useRef(0),j=m?jg:I.Fragment,M=m?{as:l_,allowPinchZoom:!0}:void 0,N=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=J_(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};I.useEffect(()=>()=>window.clearTimeout(T.current),[]),Cm();let P=I.useCallback(e=>k.current===O.current?.side&&X_(e,O.current?.area),[]);return(0,L.jsx)(i_,{scope:n,searchRef:E,onItemEnter:I.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:I.useCallback(e=>{P(e)||(C.current?.focus(),S(null))},[P]),onTriggerLeave:I.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:D,onPointerGraceIntentChange:I.useCallback(e=>{O.current=e},[]),children:(0,L.jsx)(j,{...M,children:(0,L.jsx)(km,{asChild:!0,trapped:i,onMountAutoFocus:R(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,L.jsx)(lt,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,L.jsx)(oh,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:R(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,L.jsx)(ri,{role:`menu`,"aria-orientation":`vertical`,"data-state":U_(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:R(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&N(e.key));let i=C.current;if(e.target!==i||!Fg.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Pg.includes(e.key)&&a.reverse(),K_(a)}),onBlur:R(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:R(e.onPointerMove,Z_(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})});o_.displayName=r_;var d_=`MenuGroup`,f_=I.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,L.jsx)($e.div,{role:`group`,...r,ref:t})});f_.displayName=d_;var p_=`MenuLabel`,m_=I.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,L.jsx)($e.div,{...r,ref:t})});m_.displayName=p_;var h_=`MenuItem`,g_=`menu.itemSelect`,__=I.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=I.useRef(null),o=Yg(h_,e.__scopeMenu),s=a_(h_,e.__scopeMenu),c=He(t,a),l=I.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(g_,{bubbles:!0,cancelable:!0});e.addEventListener(g_,e=>r?.(e),{once:!0}),et(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,L.jsx)(v_,{...i,ref:c,disabled:n,onClick:R(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:R(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:R(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Mg.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});__.displayName=h_;var v_=I.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=a_(h_,n),s=Gg(n),c=I.useRef(null),l=He(t,c),[u,d]=I.useState(!1),[f,p]=I.useState(``);return I.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,L.jsx)(zg.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,L.jsx)(sh,{asChild:!0,...s,focusable:!r,children:(0,L.jsx)($e.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:R(e.onPointerMove,Z_(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:R(e.onPointerLeave,Z_(e=>o.onItemLeave(e))),onFocus:R(e.onFocus,()=>d(!0)),onBlur:R(e.onBlur,()=>d(!1))})})})}),y_=`MenuCheckboxItem`,b_=I.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,L.jsx)(O_,{scope:e.__scopeMenu,checked:n,children:(0,L.jsx)(__,{role:`menuitemcheckbox`,"aria-checked":W_(n)?`mixed`:n,...i,ref:t,"data-state":G_(n),onSelect:R(i.onSelect,()=>r?.(W_(n)?!0:!n),{checkForDefaultPrevented:!1})})})});b_.displayName=y_;var x_=`MenuRadioGroup`,[S_,C_]=Hg(x_,{value:void 0,onValueChange:()=>{}}),w_=I.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=tt(r);return(0,L.jsx)(S_,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,L.jsx)(f_,{...i,ref:t})})});w_.displayName=x_;var T_=`MenuRadioItem`,E_=I.forwardRef((e,t)=>{let{value:n,...r}=e,i=C_(T_,e.__scopeMenu),a=n===i.value;return(0,L.jsx)(O_,{scope:e.__scopeMenu,checked:a,children:(0,L.jsx)(__,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":G_(a),onSelect:R(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});E_.displayName=T_;var D_=`MenuItemIndicator`,[O_,k_]=Hg(D_,{checked:!1}),A_=I.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=k_(D_,n);return(0,L.jsx)(ci,{present:r||W_(a.checked)||a.checked===!0,children:(0,L.jsx)($e.span,{...i,ref:t,"data-state":G_(a.checked)})})});A_.displayName=D_;var j_=`MenuSeparator`,M_=I.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,L.jsx)($e.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});M_.displayName=j_;var N_=`MenuArrow`,P_=I.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Wg(n);return(0,L.jsx)(ii,{...i,...r,ref:t})});P_.displayName=N_;var F_=`MenuSub`,[I_,L_]=Hg(F_),R_=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=qg(F_,t),o=Wg(t),[s,c]=I.useState(null),[l,u]=I.useState(null),d=tt(i);return I.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,L.jsx)(ti,{...o,children:(0,L.jsx)(Kg,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,L.jsx)(I_,{scope:t,contentId:yt(),triggerId:yt(),trigger:s,onTriggerChange:c,children:n})})})};R_.displayName=F_;var z_=`MenuSubTrigger`,B_=I.forwardRef((e,t)=>{let n=qg(z_,e.__scopeMenu),r=Yg(z_,e.__scopeMenu),i=L_(z_,e.__scopeMenu),a=a_(z_,e.__scopeMenu),o=I.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=I.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return I.useEffect(()=>u,[u]),I.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,L.jsx)(Qg,{asChild:!0,...l,children:(0,L.jsx)(v_,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":U_(n.open),...e,ref:Ve(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:R(e.onPointerMove,Z_(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:R(e.onPointerLeave,Z_(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:R(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Ig[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});B_.displayName=z_;var V_=`MenuSubContent`,H_=I.forwardRef((e,t)=>{let n=t_(r_,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=qg(r_,e.__scopeMenu),o=Yg(r_,e.__scopeMenu),s=L_(V_,e.__scopeMenu),c=I.useRef(null),l=He(t,c);return(0,L.jsx)(zg.Provider,{scope:e.__scopeMenu,children:(0,L.jsx)(ci,{present:r||a.open,children:(0,L.jsx)(zg.Slot,{scope:e.__scopeMenu,children:(0,L.jsx)(u_,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:R(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:R(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:R(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Lg[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});H_.displayName=V_;function U_(e){return e?`open`:`closed`}function W_(e){return e===`indeterminate`}function G_(e){return W_(e)?`indeterminate`:e?`checked`:`unchecked`}function K_(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function q_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function J_(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=q_(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Y_(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function X_(e,t){return t?Y_({x:e.clientX,y:e.clientY},t):!1}function Z_(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Q_=Xg,$_=Qg,ev=n_,tv=o_,nv=f_,rv=m_,iv=__,av=b_,ov=w_,sv=E_,cv=A_,lv=M_,uv=P_,dv=B_,fv=H_,pv=`DropdownMenu`,[mv,hv]=We(pv,[Ug]),gv=Ug(),[_v,vv]=mv(pv),yv=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=gv(t),l=I.useRef(null),[u,d]=hi({prop:i,defaultProp:a??!1,onChange:o,caller:pv});return(0,L.jsx)(_v,{scope:t,triggerId:yt(),triggerRef:l,contentId:yt(),open:u,onOpenChange:d,onOpenToggle:I.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,L.jsx)(Q_,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};yv.displayName=pv;var bv=`DropdownMenuTrigger`,xv=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=vv(bv,n),o=gv(n);return(0,L.jsx)($_,{asChild:!0,...o,children:(0,L.jsx)($e.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:Ve(t,a.triggerRef),onPointerDown:R(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:R(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});xv.displayName=bv;var Sv=`DropdownMenuPortal`,Cv=e=>{let{__scopeDropdownMenu:t,...n}=e,r=gv(t);return(0,L.jsx)(ev,{...r,...n})};Cv.displayName=Sv;var wv=`DropdownMenuContent`,Tv=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=vv(wv,n),a=gv(n),o=I.useRef(!1);return(0,L.jsx)(tv,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:R(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:R(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Tv.displayName=wv;var Ev=`DropdownMenuGroup`,Dv=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gv(n);return(0,L.jsx)(nv,{...i,...r,ref:t})});Dv.displayName=Ev;var Ov=`DropdownMenuLabel`,kv=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gv(n);return(0,L.jsx)(rv,{...i,...r,ref:t})});kv.displayName=Ov;var Av=`DropdownMenuItem`,jv=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gv(n);return(0,L.jsx)(iv,{...i,...r,ref:t})});jv.displayName=Av;var Mv=`DropdownMenuCheckboxItem`,Nv=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gv(n);return(0,L.jsx)(av,{...i,...r,ref:t})});Nv.displayName=Mv;var Pv=`DropdownMenuRadioGroup`,Fv=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gv(n);return(0,L.jsx)(ov,{...i,...r,ref:t})});Fv.displayName=Pv;var Iv=`DropdownMenuRadioItem`,Lv=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gv(n);return(0,L.jsx)(sv,{...i,...r,ref:t})});Lv.displayName=Iv;var Rv=`DropdownMenuItemIndicator`,zv=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gv(n);return(0,L.jsx)(cv,{...i,...r,ref:t})});zv.displayName=Rv;var Bv=`DropdownMenuSeparator`,Vv=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gv(n);return(0,L.jsx)(lv,{...i,...r,ref:t})});Vv.displayName=Bv;var Hv=`DropdownMenuArrow`,Uv=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gv(n);return(0,L.jsx)(uv,{...i,...r,ref:t})});Uv.displayName=Hv;var Wv=`DropdownMenuSubTrigger`,Gv=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gv(n);return(0,L.jsx)(dv,{...i,...r,ref:t})});Gv.displayName=Wv;var Kv=`DropdownMenuSubContent`,qv=I.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=gv(n);return(0,L.jsx)(fv,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});qv.displayName=Kv;var Jv=yv,Yv=xv,Xv=Cv,Zv=Tv,Qv=kv,$v=jv,ey=Nv,ty=Lv,ny=zv,ry=Vv,iy=Gv,ay=qv,oy=Jv,sy=Yv,cy=I.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,L.jsxs)(iy,{ref:i,className:U(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-zinc-800 data-[state=open]:bg-zinc-800`,t&&`pl-8`,e),...r,children:[n,(0,L.jsx)(lu,{className:`ml-auto h-4 w-4`})]}));cy.displayName=iy.displayName;var ly=I.forwardRef(({className:e,...t},n)=>(0,L.jsx)(ay,{ref:n,className:U(`z-50 min-w-[8rem] overflow-hidden rounded-md border border-zinc-700 bg-zinc-900 p-1 text-zinc-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));ly.displayName=ay.displayName;var uy=I.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,L.jsx)(Xv,{children:(0,L.jsx)(Zv,{ref:r,sideOffset:t,className:U(`z-50 min-w-[8rem] overflow-hidden rounded-md border border-zinc-700 bg-zinc-900 p-1 text-zinc-100 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));uy.displayName=Zv.displayName;var dy=I.forwardRef(({className:e,inset:t,...n},r)=>(0,L.jsx)($v,{ref:r,className:U(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-zinc-800 focus:text-zinc-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t&&`pl-8`,e),...n}));dy.displayName=$v.displayName;var fy=I.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,L.jsxs)(ey,{ref:i,className:U(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-zinc-800 focus:text-zinc-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,L.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,L.jsx)(ny,{children:(0,L.jsx)(ou,{className:`h-4 w-4`})})}),t]}));fy.displayName=ey.displayName;var py=I.forwardRef(({className:e,children:t,...n},r)=>(0,L.jsxs)(ty,{ref:r,className:U(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-zinc-800 focus:text-zinc-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,L.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,L.jsx)(ny,{children:(0,L.jsx)(pu,{className:`h-2 w-2 fill-current`})})}),t]}));py.displayName=ty.displayName;var my=I.forwardRef(({className:e,inset:t,...n},r)=>(0,L.jsx)(Qv,{ref:r,className:U(`px-2 py-1.5 text-xs font-semibold text-zinc-500 uppercase tracking-wider`,t&&`pl-8`,e),...n}));my.displayName=Qv.displayName;var hy=I.forwardRef(({className:e,...t},n)=>(0,L.jsx)(ry,{ref:n,className:U(`-mx-1 my-1 h-px bg-zinc-800`,e),...t}));hy.displayName=ry.displayName;var gy=({className:e,...t})=>(0,L.jsx)(`span`,{className:U(`ml-auto text-xs tracking-widest opacity-60`,e),...t});gy.displayName=`DropdownMenuShortcut`;var _y=[{value:`downloads`,label:`Most Downloaded`},{value:`name`,label:`Name A→Z`},{value:`size`,label:`Model Size`},{value:`latency`,label:`Latency`},{value:`accuracy`,label:`Accuracy`}];function vy({index:e,style:t,models:n}){return(0,L.jsx)(pm,{model:n[e],style:t})}var yy={detection:`Detection`,classification:`Classification`,segmentation:`Segmentation`,generation:`Generation`,embedding:`Embedding`};function by(){mm();let{filteredModels:e,viewMode:t,setViewMode:n,sortBy:r,setSortBy:i,isLoading:a,filters:o,clearFilters:s,searchQuery:c,setSearchQuery:l}=Wc(),{comparisonModels:u}=Uo(),d=(0,I.useRef)(null),[f,p]=(0,I.useState)(500),[m,h]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let e=()=>{d.current&&p(d.current.clientHeight)};e();let t=new ResizeObserver(e);return d.current&&t.observe(d.current),()=>t.disconnect()},[]);let g=_y.find(e=>e.value===r)?.label??`Sort`,_=o.tasks.map(e=>({key:`task-${e}`,label:yy[e]??e})),v=o.tasks.length+o.frameworks.length+o.hardware.length+o.sources.length+ +!!o.downloaded>0||c.length>0;return(0,L.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden bg-zinc-950`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3 px-4 h-[44px] border-b border-zinc-800/80 shrink-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-px bg-zinc-900 rounded-md p-0.5 border border-zinc-800/80`,children:[(0,L.jsx)(`button`,{onClick:()=>n(`grid`),className:U(`h-6 w-6 flex items-center justify-center rounded transition-all cursor-pointer`,t===`grid`?`bg-zinc-700 text-zinc-100 shadow-sm`:`text-zinc-600 hover:text-zinc-300`),children:(0,L.jsx)(Yu,{className:`h-3.5 w-3.5`})}),(0,L.jsx)(`button`,{onClick:()=>n(`list`),className:U(`h-6 w-6 flex items-center justify-center rounded transition-all cursor-pointer`,t===`list`?`bg-zinc-700 text-zinc-100 shadow-sm`:`text-zinc-600 hover:text-zinc-300`),children:(0,L.jsx)(Zu,{className:`h-3.5 w-3.5`})})]}),(0,L.jsx)(`div`,{className:`flex-1 max-w-md mx-auto`,children:(0,L.jsxs)(`div`,{className:U(`relative flex items-center h-7 rounded-md border bg-zinc-900/50 transition-all duration-150`,m?`border-zinc-600 bg-zinc-900 ring-1 ring-blue-500/20`:`border-zinc-800 hover:border-zinc-700`),children:[(0,L.jsx)(hd,{className:`absolute left-2 h-3 w-3 text-zinc-600 pointer-events-none`}),(0,L.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),onFocus:()=>h(!0),onBlur:()=>h(!1),placeholder:`Search model zoo...`,className:`w-full h-full pl-7 pr-7 bg-transparent text-[11px] text-zinc-200 placeholder:text-zinc-700 outline-none`}),c&&(0,L.jsx)(`button`,{onClick:()=>l(``),className:`absolute right-1.5 text-zinc-600 hover:text-zinc-300 cursor-pointer transition-colors`,children:(0,L.jsx)(Bd,{className:`h-3 w-3`})})]})}),u.length>0&&(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-blue-500/10 border border-blue-500/20 text-blue-400 text-[10px] font-medium select-none shrink-0`,children:[(0,L.jsx)(Pu,{className:`h-3 w-3`}),(0,L.jsxs)(`span`,{children:[`Compare (`,u.length,`)`]})]}),v&&(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 overflow-hidden`,children:[(0,L.jsx)(Sd,{className:`h-3 w-3 text-zinc-600 shrink-0`}),_.slice(0,3).map(e=>(0,L.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] font-medium border border-zinc-700 bg-zinc-900 text-zinc-400 shrink-0`,children:e.label},e.key)),v&&(0,L.jsx)(`button`,{onClick:s,className:`text-[10px] text-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer shrink-0 underline-offset-2 hover:underline`,children:`Clear`})]}),(0,L.jsx)(`div`,{className:`flex-1`}),(0,L.jsx)(`span`,{className:`text-xs text-zinc-600 tabular-nums shrink-0`,children:a?`Loading…`:`${e.length.toLocaleString()} models`}),(0,L.jsxs)(oy,{children:[(0,L.jsx)(sy,{asChild:!0,children:(0,L.jsxs)(Np,{variant:`ghost`,size:`sm`,className:`h-7 text-xs gap-1.5 text-zinc-400 hover:text-zinc-200 border border-zinc-800 hover:border-zinc-700 cursor-pointer shrink-0`,children:[g,(0,L.jsx)(su,{className:`h-3 w-3`})]})}),(0,L.jsx)(uy,{align:`end`,className:`min-w-[160px]`,children:_y.map(e=>(0,L.jsxs)(dy,{onClick:()=>i(e.value),className:U(`cursor-pointer text-xs`,r===e.value?`text-blue-400`:``),children:[r===e.value&&(0,L.jsx)(`span`,{className:`mr-1.5`,children:`✓`}),e.label]},e.value))})]})]}),t===`list`&&(0,L.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2 bg-zinc-900/50 border-b border-zinc-800/80 text-[10px] font-semibold uppercase tracking-wider text-zinc-700 shrink-0`,children:[(0,L.jsx)(`span`,{className:`w-4 shrink-0`}),(0,L.jsx)(`span`,{className:`w-48`,children:`Name`}),(0,L.jsx)(`span`,{className:`w-24`,children:`Task`}),(0,L.jsx)(`span`,{className:`w-20`,children:`Framework`}),(0,L.jsx)(`span`,{className:`w-20`,children:`Size`}),(0,L.jsx)(`span`,{className:`w-20`,children:`Latency`}),(0,L.jsx)(`span`,{className:`w-16`,children:`Accuracy`}),(0,L.jsx)(`span`,{className:`flex-1`,children:`Provider`}),(0,L.jsx)(`span`,{className:`w-24 text-right`,children:`Actions`})]}),(0,L.jsx)(`div`,{ref:d,className:`flex-1 overflow-hidden relative`,children:a?(0,L.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3`,children:[(0,L.jsx)(`div`,{className:`flex gap-1`,children:[0,1,2].map(e=>(0,L.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-zinc-700 animate-pulse`,style:{animationDelay:`${e*150}ms`}},e))}),(0,L.jsx)(`p`,{className:`text-xs text-zinc-600`,children:`Loading models…`})]}):e.length===0?(0,L.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center px-8`,children:[(0,L.jsx)(`div`,{className:`h-12 w-12 rounded-full bg-zinc-900 border border-zinc-800 flex items-center justify-center mb-1`,children:(0,L.jsx)(Sd,{className:`h-5 w-5 text-zinc-700`})}),(0,L.jsx)(`p`,{className:`text-sm font-medium text-zinc-400`,children:`No models match your filters`}),(0,L.jsx)(`p`,{className:`text-xs text-zinc-700 max-w-xs`,children:`Try adjusting the filters in the sidebar or clearing your search query`}),(0,L.jsx)(Np,{variant:`outline`,size:`sm`,onClick:()=>Wc.getState().clearFilters(),className:`mt-1 text-xs cursor-pointer`,children:`Clear all filters`})]}):t===`grid`?(0,L.jsx)(`div`,{className:`h-full overflow-auto p-4`,children:(0,L.jsx)(cm,{models:e})}):(0,L.jsx)(Op,{rowCount:e.length,rowHeight:48,overscanCount:10,rowComponent:vy,rowProps:{models:e},style:{height:f}})})]})}var xy=jp(`inline-flex items-center rounded border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide transition-colors`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground`,detection:`border-orange-800 bg-orange-950/60 text-orange-400`,classification:`border-blue-800 bg-blue-950/60 text-blue-400`,segmentation:`border-violet-800 bg-violet-950/60 text-violet-400`,generation:`border-pink-800 bg-pink-950/60 text-pink-400`,embedding:`border-cyan-800 bg-cyan-950/60 text-cyan-400`,pytorch:`border-orange-700 bg-transparent text-orange-400`,onnx:`border-purple-700 bg-transparent text-purple-400`,tensorflow:`border-yellow-700 bg-transparent text-yellow-400`,tflite:`border-yellow-600 bg-transparent text-yellow-300`,coreml:`border-blue-600 bg-transparent text-blue-300`,gpu:`border-emerald-700 bg-transparent text-emerald-400`,edge:`border-teal-700 bg-transparent text-teal-400`,cpu:`border-zinc-600 bg-transparent text-zinc-400`,tpu:`border-violet-700 bg-transparent text-violet-400`,hf:`border-yellow-800 bg-yellow-950/40 text-yellow-400`,onnxsource:`border-purple-800 bg-purple-950/40 text-purple-400`,local:`border-zinc-600 bg-zinc-900 text-zinc-300`,success:`border-emerald-700 bg-emerald-950/40 text-emerald-400`,warning:`border-yellow-700 bg-yellow-950/40 text-yellow-400`,error:`border-red-700 bg-red-950/40 text-red-400`,latest:`border-blue-600 bg-blue-950/60 text-blue-300`,stable:`border-emerald-700 bg-emerald-950/40 text-emerald-400`,legacy:`border-zinc-600 bg-zinc-800 text-zinc-500`}},defaultVariants:{variant:`default`}});function Sy({className:e,variant:t,...n}){return(0,L.jsx)(`div`,{className:U(xy({variant:t}),e),...n})}var Cy={detection:{bg:`bg-orange-500/10`,text:`text-orange-400`,dot:`bg-orange-500`},classification:{bg:`bg-blue-500/10`,text:`text-blue-400`,dot:`bg-blue-500`},segmentation:{bg:`bg-purple-500/10`,text:`text-purple-400`,dot:`bg-purple-500`},generation:{bg:`bg-pink-500/10`,text:`text-pink-400`,dot:`bg-pink-500`},embedding:{bg:`bg-teal-500/10`,text:`text-teal-400`,dot:`bg-teal-500`}},wy={pytorch:`PyTorch`,onnx:`ONNX`,tensorflow:`TensorFlow`,tflite:`TFLite`,coreml:`Core ML`};function Ty({label:e,className:t}){return(0,L.jsx)(`span`,{className:U(`px-2 py-0.5 rounded-md text-[10px] font-semibold border border-white/5`,t),children:e})}function Ey({label:e,value:t,unit:n,colorClass:r}){return t===void 0?null:(0,L.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,L.jsx)(`span`,{className:`text-[11px] text-zinc-600`,children:e}),(0,L.jsxs)(`span`,{className:U(`text-[11px] font-mono tabular-nums`,r??`text-zinc-300`),children:[t,n&&(0,L.jsx)(`span`,{className:`text-zinc-600 ml-0.5`,children:n})]})]})}function Dy({label:e,delta:t,unit:n=``,lowerIsBetter:r=!1}){let i=(r?t<0:t>0)?`text-emerald-400`:`text-red-400`,a=t<0?kd:Ad;return(0,L.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,L.jsx)(`span`,{className:`text-[11px] text-zinc-600`,children:e}),(0,L.jsxs)(`div`,{className:U(`flex items-center gap-1`,i),children:[(0,L.jsx)(a,{className:`h-2.5 w-2.5`}),(0,L.jsxs)(`span`,{className:`text-[11px] font-mono tabular-nums`,children:[t>0?`+`:``,t.toFixed(1),n]})]})]})}function Oy({label:e}){return(0,L.jsx)(`span`,{className:U(`px-1.5 py-0.5 rounded text-[9px] font-semibold border`,{Latest:`bg-blue-500/15 text-blue-400 border-blue-500/20`,Stable:`bg-emerald-500/15 text-emerald-400 border-emerald-500/20`,Legacy:`bg-zinc-700/50 text-zinc-500 border-zinc-700`}[e]||`bg-zinc-800 text-zinc-400 border-zinc-700`),children:e})}function ky({children:e}){return(0,L.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-widest text-zinc-600 mb-2`,children:e})}function Ay(){let{inspectedModel:e,comparisonModels:t,setInspected:n,setActiveView:r}=Uo(),{jobs:i,triggerModelDownload:a}=Xd(),[o,s]=(0,I.useState)(null),c=e?.id,l=(0,I.useMemo)(()=>c?i.find(e=>e.modelId===c&&e.type===`download`&&(e.status===`running`||e.status===`queued`)):void 0,[i,c]),u=!!l,d=l?.progress??0;if(!e)return(0,L.jsx)(`aside`,{className:`w-[280px] shrink-0 bg-zinc-950 border-l border-zinc-800/80 flex flex-col items-center justify-center`,children:(0,L.jsxs)(`div`,{className:`text-center p-6 space-y-3`,children:[(0,L.jsx)(`div`,{className:`h-12 w-12 rounded-xl bg-zinc-900 border border-zinc-800 flex items-center justify-center mx-auto`,children:(0,L.jsx)(lu,{className:`h-5 w-5 text-zinc-700`})}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-zinc-500`,children:`Select a model`}),(0,L.jsx)(`p`,{className:`text-xs text-zinc-700 mt-1`,children:`Click any card to inspect details`})]})]})});let f=e,p=Cy[f.task],m=t.find(e=>e.id!==f.id),h=m?.metrics.latency_ms&&f.metrics.latency_ms?(f.metrics.latency_ms-m.metrics.latency_ms)/m.metrics.latency_ms*100:null,g=m?(f.size-m.size)/m.size*100:null,_=m?(f.metrics.accuracy??f.metrics.top1??f.metrics.mAP??0)-(m.metrics.accuracy??m.metrics.top1??m.metrics.mAP??0):null;return(0,L.jsxs)(`aside`,{className:`w-[280px] shrink-0 bg-zinc-950 border-l border-zinc-800/80 flex flex-col overflow-hidden`,children:[(0,L.jsxs)(`div`,{className:`px-4 py-3 border-b border-zinc-800/80 shrink-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-2`,children:[(0,L.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,L.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-widest text-zinc-700 mb-1`,children:`Inspector`}),(0,L.jsx)(`p`,{className:`text-sm font-semibold text-zinc-100 leading-tight truncate`,children:f.name}),f.variant&&(0,L.jsx)(`p`,{className:`text-xs text-zinc-600 mt-0.5`,children:f.variant})]}),(0,L.jsx)(`button`,{onClick:()=>n(null),className:`h-6 w-6 flex items-center justify-center rounded text-zinc-600 hover:text-zinc-300 hover:bg-zinc-800 transition-colors cursor-pointer shrink-0 mt-1`,children:(0,L.jsx)(Bd,{className:`h-3.5 w-3.5`})})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,L.jsxs)(`div`,{className:U(`flex items-center gap-1 px-2 py-0.5 rounded-md border border-white/5`,p.bg),children:[(0,L.jsx)(`span`,{className:U(`h-1.5 w-1.5 rounded-full shrink-0`,p.dot)}),(0,L.jsx)(`span`,{className:U(`text-[10px] font-semibold capitalize`,p.text),children:f.task})]}),(0,L.jsx)(Ty,{label:wy[f.framework],className:`bg-zinc-800/80 text-zinc-400`}),f.hardware.includes(`edge`)&&(0,L.jsx)(Ty,{label:`Edge`,className:`bg-teal-500/10 text-teal-400`}),f.hardware.includes(`gpu`)&&(0,L.jsx)(Ty,{label:`GPU`,className:`bg-violet-500/10 text-violet-400`})]})]}),(0,L.jsx)(Vf,{className:`flex-1`,children:(0,L.jsxs)(`div`,{className:`px-4 py-3 space-y-4`,children:[(0,L.jsx)(`p`,{className:`text-[12px] text-zinc-500 leading-relaxed`,children:f.description}),o&&(0,L.jsx)(`div`,{className:`p-3 rounded-lg bg-blue-500/5 border border-blue-500/20 animate-in fade-in slide-in-from-top-2 duration-300`,children:(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(Qu,{className:`h-3.5 w-3.5 text-blue-400 animate-spin`}),(0,L.jsx)(`p`,{className:`text-[11px] font-semibold text-blue-300`,children:o})]}),(0,L.jsx)(`button`,{onClick:()=>s(null),className:`text-blue-400/70 hover:text-blue-300 cursor-pointer`,"aria-label":`dismiss`,children:(0,L.jsx)(Bd,{className:`h-3.5 w-3.5`})})]})}),(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsxs)(Np,{size:`sm`,disabled:!f.downloaded,onClick:()=>{n(f),r(`benchmark`)},title:f.downloaded?`Open in Benchmark`:`Cache this model in the current project first`,className:U(`flex-1 h-8 text-xs gap-1.5 cursor-pointer border-transparent`,f.downloaded?`bg-blue-600 hover:bg-blue-500 text-white`:`bg-zinc-800 text-zinc-500 cursor-not-allowed`),children:[(0,L.jsx)(cd,{className:`h-3 w-3`}),`Benchmark`]}),(0,L.jsxs)(Np,{size:`sm`,variant:`outline`,onClick:()=>{f.downloaded||u||(s(`Caching started. You can keep browsing — progress will update here.`),a(f.id,f.name))},disabled:f.downloaded||u,className:U(`h-8 px-3 text-xs cursor-pointer`,u&&`cursor-not-allowed opacity-90`,f.downloaded&&`text-emerald-500 border-emerald-500/30 bg-emerald-500/5`),children:[u?(0,L.jsx)(Qu,{className:`h-3 w-3 mr-1 animate-spin`}):(0,L.jsx)(vu,{className:`h-3 w-3 mr-1`}),f.downloaded?`Cached`:u?`Caching… ${d}%`:`Cache`]})]}),u&&(0,L.jsx)(`div`,{className:`-mt-2`,children:(0,L.jsx)(`div`,{className:`h-1.5 w-full bg-emerald-500/10 rounded-full overflow-hidden`,children:(0,L.jsx)(`div`,{className:`h-full bg-emerald-500 transition-all duration-500 ease-out`,style:{width:`${d}%`}})})}),f.downloaded&&f.local_path&&(0,L.jsxs)(`div`,{className:`flex items-start gap-1.5 px-2 py-1.5 rounded-md bg-emerald-500/5 border border-emerald-500/10`,children:[(0,L.jsx)(ju,{className:`h-3 w-3 text-emerald-500 shrink-0 mt-0.5`}),(0,L.jsx)(`span`,{className:`text-[10px] text-emerald-600 break-all leading-snug font-mono`,children:f.local_path})]}),(0,L.jsx)(sp,{className:`bg-zinc-800/80`}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(ky,{children:`Performance`}),(0,L.jsxs)(`div`,{className:`space-y-0`,children:[(0,L.jsx)(Ey,{label:`Latency`,value:f.metrics.latency_ms?.toFixed(1),unit:`ms`,colorClass:Mo(f.metrics.latency_ms)}),(0,L.jsx)(Ey,{label:`Accuracy`,value:(f.metrics.accuracy??f.metrics.top1??f.metrics.mAP)===void 0?void 0:`${(f.metrics.accuracy??f.metrics.top1??f.metrics.mAP??0).toFixed(1)}`,unit:`%`,colorClass:`text-blue-400`}),(0,L.jsx)(Ey,{label:`FPS`,value:f.metrics.fps,colorClass:`text-emerald-400`}),(0,L.jsx)(Ey,{label:`VRAM`,value:f.metrics.vram_gb?.toFixed(1),unit:`GB`})]})]}),(0,L.jsx)(sp,{className:`bg-zinc-800/80`}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(ky,{children:`Details`}),(0,L.jsxs)(`div`,{className:`space-y-0`,children:[(0,L.jsx)(Ey,{label:`Size`,value:f.size_label}),(0,L.jsx)(Ey,{label:`Downloads`,value:f.downloads?jo(f.downloads):void 0,colorClass:`text-zinc-400`}),(0,L.jsx)(Ey,{label:`Provider`,value:f.provider,colorClass:`text-zinc-400`}),(0,L.jsx)(Ey,{label:`Source`,value:f.source===`hf`?`Hugging Face`:f.source===`onnx`?`ONNX Zoo`:`Local`,colorClass:`text-zinc-500`})]})]}),f.rating&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(sp,{className:`bg-zinc-800/80`}),(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,L.jsx)(ky,{children:`Quality Score`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(q,{className:`h-3 w-3 text-amber-400 fill-amber-400`}),(0,L.jsx)(`span`,{className:`text-[11px] font-mono text-amber-400`,children:f.rating.toFixed(1)}),(0,L.jsx)(`span`,{className:`text-[10px] text-zinc-700`,children:`/5`})]})]}),(0,L.jsx)(tm,{value:f.rating/5*100,className:`h-1.5 bg-zinc-800`})]})]}),m&&(h!==null||g!==null||_!==null)&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(sp,{className:`bg-zinc-800/80`}),(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(ky,{children:[`vs `,m.name]}),(0,L.jsxs)(`div`,{className:`space-y-0`,children:[h!==null&&(0,L.jsx)(Dy,{label:`Latency`,delta:h,unit:`%`,lowerIsBetter:!0}),g!==null&&(0,L.jsx)(Dy,{label:`Size`,delta:g,unit:`%`,lowerIsBetter:!0}),_!==null&&(0,L.jsx)(Dy,{label:`Accuracy`,delta:_,unit:`pp`})]})]})]}),(0,L.jsx)(sp,{className:`bg-zinc-800/80`}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(ky,{children:`Version History`}),(0,L.jsx)(`div`,{className:`space-y-2`,children:f.versions.map(e=>(0,L.jsx)(`div`,{className:`flex items-start gap-2.5 p-2.5 rounded-lg border border-zinc-800/80 bg-zinc-900/40`,children:(0,L.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-0.5`,children:[(0,L.jsx)(`span`,{className:`text-[11px] font-mono text-zinc-300`,children:e.version}),(0,L.jsx)(Oy,{label:e.label})]}),(0,L.jsx)(`p`,{className:`text-[10px] text-zinc-700`,children:e.releaseDate}),e.changelog&&(0,L.jsx)(`p`,{className:`text-[10px] text-zinc-700 mt-0.5 line-clamp-1`,children:e.changelog})]})},e.version))})]})]})})]})}function jy({value:e,color:t}){return(0,L.jsx)(`div`,{className:`relative h-1 w-16 rounded-full bg-zinc-800 overflow-hidden`,children:(0,L.jsx)(`div`,{className:U(`h-full rounded-full transition-all duration-700`,t),style:{width:`${e}%`}})})}function My(){let{gpuUsage:e,gpuModel:t,cpuUsage:n,ramUsed:r,ramTotal:i,vramUsed:a,vramTotal:o,jobs:s}=Xd();s.filter(e=>e.status===`running`||e.status===`queued`).length;let[c,l]=(0,I.useState)(navigator.onLine);(0,I.useEffect)(()=>{let e=()=>l(!0),t=()=>l(!1);return window.addEventListener(`online`,e),window.addEventListener(`offline`,t),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,t)}},[]);let u=o>0?a/o*100:0,d=e>90?`bg-red-500`:e>70?`bg-amber-500`:`bg-emerald-500`,f=n>80?`bg-red-500`:n>50?`bg-amber-500`:`bg-zinc-600`,p=u>90?`bg-red-500`:u>70?`bg-amber-500`:`bg-blue-500`,m=e>90?`text-red-400`:e>70?`text-amber-400`:`text-emerald-400`;return(0,L.jsx)(`footer`,{className:`h-7 flex items-center px-4 bg-zinc-950 border-t border-zinc-800/80 shrink-0 z-10`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-4 flex-1 text-[10px] font-mono overflow-hidden`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-3 text-zinc-700`,children:[(0,L.jsx)(`div`,{className:`flex items-center gap-1.5`,children:c?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(zd,{className:`h-3 w-3 text-emerald-500`}),(0,L.jsx)(`span`,{className:`text-emerald-500/80`,children:`Online`})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Rd,{className:`h-3 w-3 text-red-500`}),(0,L.jsx)(`span`,{className:`text-red-500/80`,children:`Offline`})]})}),(0,L.jsx)(`span`,{className:`text-zinc-800`,children:`|`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)(Fu,{className:`h-3 w-3 text-zinc-600`}),(0,L.jsx)(`span`,{children:`Region: US-East`})]}),(0,L.jsx)(`span`,{className:`text-zinc-800`,children:`|`}),(0,L.jsx)(`span`,{className:`text-zinc-800`,children:`|`}),(0,L.jsx)(`span`,{children:t||`Checking GPU...`})]}),(0,L.jsx)(`div`,{className:`flex-1`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-4 text-zinc-600`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)(jy,{value:u,color:p}),(0,L.jsxs)(`span`,{className:U(u>90?`text-red-400`:u>70?`text-amber-400`:``),children:[`VRAM `,a.toFixed(1),`/`,o,`GB`]})]}),(0,L.jsx)(`span`,{className:`text-zinc-800`,children:`|`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)(jy,{value:n,color:f}),(0,L.jsxs)(`span`,{className:U(n>80?`text-red-400`:n>50?`text-amber-400`:``),children:[`CPU `,n.toFixed(0),`%`]})]}),(0,L.jsx)(`span`,{className:`text-zinc-800`,children:`|`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)(jy,{value:e,color:d}),(0,L.jsxs)(`span`,{className:U(`font-semibold`,m),children:[`GPU `,e.toFixed(0),`%`]})]}),(0,L.jsx)(`span`,{className:`text-zinc-800`,children:`|`}),(0,L.jsx)(`span`,{children:`v1.4.2`})]})]})})}function Ny({value:e,unit:t=``,lowerIsBetter:n=!1,className:r}){let i=Math.abs(e)<.5,a=i?`text-zinc-400`:!i&&(n?e<0:e>0)?`text-emerald-400`:`text-red-400`,o=i?td:e<0?kd:Ad;return(0,L.jsxs)(`span`,{className:U(`inline-flex items-center gap-0.5`,a,r),children:[(0,L.jsx)(o,{className:`h-3 w-3`}),(0,L.jsxs)(`span`,{className:`font-mono-metrics text-xs`,children:[e>0?`+`:``,e.toFixed(1),t]})]})}function Py(e){return e.metrics.accuracy??e.metrics.top1??e.metrics.mAP}function Fy(){let{comparisonModels:e,removeFromComparison:t,clearComparison:n}=Uo();if(e.length<2)return null;let r=e[0];return(0,L.jsxs)(`div`,{className:`border-t border-zinc-800 bg-zinc-900 shrink-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-zinc-800`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(Pu,{className:`h-4 w-4 text-blue-400`}),(0,L.jsx)(`span`,{className:`text-xs font-semibold text-zinc-200`,children:`Model Comparison`}),(0,L.jsxs)(`span`,{className:`text-[10px] text-zinc-500`,children:[e.length,` models · baseline: `,r.name]})]}),(0,L.jsx)(Np,{variant:`ghost`,size:`sm`,className:`h-6 text-xs text-zinc-500 hover:text-zinc-200`,onClick:n,children:`Clear All`})]}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{className:`text-[10px] uppercase tracking-wider text-zinc-600 border-b border-zinc-800`,children:[(0,L.jsx)(`th`,{className:`text-left px-4 py-1.5 font-medium w-48`,children:`Model`}),(0,L.jsx)(`th`,{className:`text-left px-3 py-1.5 font-medium w-24`,children:`Task`}),(0,L.jsx)(`th`,{className:`text-left px-3 py-1.5 font-medium w-24`,children:`Framework`}),(0,L.jsx)(`th`,{className:`text-right px-3 py-1.5 font-medium w-28`,children:`Latency`}),(0,L.jsx)(`th`,{className:`text-right px-3 py-1.5 font-medium w-24`,children:`mAP / Top1`}),(0,L.jsx)(`th`,{className:`text-right px-3 py-1.5 font-medium w-24`,children:`Size`}),(0,L.jsx)(`th`,{className:`text-left px-3 py-1.5 font-medium w-28`,children:`Status`}),(0,L.jsx)(`th`,{className:`px-3 py-1.5 w-10`})]})}),(0,L.jsx)(`tbody`,{children:e.map((e,n)=>{let i=n===0,a=!i&&r.metrics.latency_ms&&e.metrics.latency_ms?(e.metrics.latency_ms-r.metrics.latency_ms)/r.metrics.latency_ms*100:null,o=i?null:(Py(e)??0)-(Py(r)??0),s=!i&&r.size?(e.size-r.size)/r.size*100:null,c=e.task;return(0,L.jsxs)(`tr`,{className:U(`border-b border-zinc-800/50 hover:bg-zinc-800/30 transition-colors`,i&&`bg-blue-950/10`),children:[(0,L.jsx)(`td`,{className:`px-4 py-2`,children:(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[i&&(0,L.jsx)(`span`,{className:`text-[9px] text-blue-400 font-semibold uppercase`,children:`Base`}),(0,L.jsx)(`span`,{className:`font-medium text-zinc-100 truncate`,children:e.name}),e.variant&&(0,L.jsx)(`span`,{className:`text-zinc-600 text-[10px]`,children:e.variant})]})}),(0,L.jsx)(`td`,{className:`px-3 py-2`,children:(0,L.jsx)(Sy,{variant:c,className:`text-[9px]`,children:e.task})}),(0,L.jsx)(`td`,{className:`px-3 py-2`,children:(0,L.jsx)(Sy,{variant:e.framework,className:`text-[9px]`,children:e.framework})}),(0,L.jsx)(`td`,{className:`px-3 py-2 text-right`,children:e.metrics.latency_ms===void 0?(0,L.jsx)(`span`,{className:`text-zinc-600`,children:`—`}):(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,L.jsxs)(`span`,{className:U(`font-mono-metrics`,Mo(e.metrics.latency_ms)),children:[e.metrics.latency_ms.toFixed(1),`ms`]}),a!==null&&(0,L.jsx)(Ny,{value:a,unit:`%`,lowerIsBetter:!0})]})}),(0,L.jsx)(`td`,{className:`px-3 py-2 text-right`,children:Py(e)===void 0?(0,L.jsx)(`span`,{className:`text-zinc-600`,children:`—`}):(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,L.jsxs)(`span`,{className:`font-mono-metrics text-blue-400`,children:[Py(e).toFixed(1),`%`]}),o!==null&&(0,L.jsx)(Ny,{value:o,unit:`pp`})]})}),(0,L.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,L.jsx)(`span`,{className:`font-mono-metrics text-zinc-400`,children:e.size_label}),s!==null&&(0,L.jsx)(Ny,{value:s,unit:`%`,lowerIsBetter:!0})]})}),(0,L.jsx)(`td`,{className:`px-3 py-2`,children:(0,L.jsx)(`span`,{className:U(`text-[10px] font-medium`,e.downloaded?`text-emerald-400`:e.status===`downloading`?`text-blue-400`:`text-zinc-500`),children:e.downloaded?`● Cached`:e.status===`downloading`?`⟳ Downloading`:`○ Available`})}),(0,L.jsx)(`td`,{className:`px-3 py-2`,children:(0,L.jsx)(Np,{size:`icon`,variant:`ghost`,className:`h-5 w-5 text-zinc-600 hover:text-zinc-300`,onClick:()=>t(e.id),children:(0,L.jsx)(Bd,{className:`h-3 w-3`})})})]},e.id)})})]})})]})}var Iy=o(((e,t)=>{t.exports=Array.isArray})),Ly=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),Ry=o(((e,t)=>{var n=Ly(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),zy=o(((e,t)=>{t.exports=Ry().Symbol})),By=o(((e,t)=>{var n=zy(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),Vy=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),Hy=o(((e,t)=>{var n=zy(),r=By(),i=Vy(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),Uy=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),Wy=o(((e,t)=>{var n=Hy(),r=Uy(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),Gy=o(((e,t)=>{var n=Iy(),r=Wy(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),Ky=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),qy=o(((e,t)=>{var n=Hy(),r=Ky(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),Jy=o(((e,t)=>{t.exports=Ry()[`__core-js_shared__`]})),Yy=o(((e,t)=>{var n=Jy(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),Xy=o(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),Zy=o(((e,t)=>{var n=qy(),r=Yy(),i=Ky(),a=Xy(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),Qy=o(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),$y=o(((e,t)=>{var n=Zy(),r=Qy();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),eb=o(((e,t)=>{t.exports=$y()(Object,`create`)})),tb=o(((e,t)=>{var n=eb();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),nb=o(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),rb=o(((e,t)=>{var n=eb(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),ib=o(((e,t)=>{var n=eb(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),ab=o(((e,t)=>{var n=eb(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),ob=o(((e,t)=>{var n=tb(),r=nb(),i=rb(),a=ib(),o=ab();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{function n(){this.__data__=[],this.size=0}t.exports=n})),cb=o(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),lb=o(((e,t)=>{var n=cb();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),ub=o(((e,t)=>{var n=lb(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),db=o(((e,t)=>{var n=lb();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),fb=o(((e,t)=>{var n=lb();function r(e){return n(this.__data__,e)>-1}t.exports=r})),pb=o(((e,t)=>{var n=lb();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),mb=o(((e,t)=>{var n=sb(),r=ub(),i=db(),a=fb(),o=pb();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{t.exports=$y()(Ry(),`Map`)})),gb=o(((e,t)=>{var n=ob(),r=mb(),i=hb();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),_b=o(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),vb=o(((e,t)=>{var n=_b();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),yb=o(((e,t)=>{var n=vb();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),bb=o(((e,t)=>{var n=vb();function r(e){return n(this,e).get(e)}t.exports=r})),xb=o(((e,t)=>{var n=vb();function r(e){return n(this,e).has(e)}t.exports=r})),Sb=o(((e,t)=>{var n=vb();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),Cb=o(((e,t)=>{var n=gb(),r=yb(),i=bb(),a=xb(),o=Sb();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{var n=Cb(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),Tb=o(((e,t)=>{var n=wb(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),Eb=o(((e,t)=>{var n=Tb(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),Db=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n{var n=zy(),r=Db(),i=Iy(),a=Wy(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),kb=o(((e,t)=>{var n=Ob();function r(e){return e==null?``:n(e)}t.exports=r})),Ab=o(((e,t)=>{var n=Iy(),r=Gy(),i=Eb(),a=kb();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),jb=o(((e,t)=>{var n=Wy(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),Mb=o(((e,t)=>{var n=Ab(),r=jb();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i{var n=Mb();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),Pb=o(((e,t)=>{function n(e){return e==null}t.exports=n})),Fb=o(((e,t)=>{var n=Hy(),r=Iy(),i=Uy(),a=`[object String]`;function o(e){return typeof e==`string`||!r(e)&&i(e)&&n(e)==a}t.exports=o})),Ib=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.server_context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.suspense_list`),f=Symbol.for(`react.memo`),p=Symbol.for(`react.lazy`);function m(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case u:case d:return e;default:switch(e&&=e.$$typeof,e){case c:case s:case l:case p:case f:case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),Lb=o(((e,t)=>{t.exports=Ib()})),Rb=o(((e,t)=>{var n=Hy(),r=Uy(),i=`[object Number]`;function a(e){return typeof e==`number`||r(e)&&n(e)==i}t.exports=a})),zb=o(((e,t)=>{var n=Rb();function r(e){return n(e)&&e!=+e}t.exports=r})),Bb=l(Fb()),Vb=l(zb()),Hb=l(Nb()),Ub=l(Rb()),J=l(Pb()),Wb=function(e){return e===0?0:e>0?1:-1},Gb=function(e){return(0,Bb.default)(e)&&e.indexOf(`%`)===e.length-1},Y=function(e){return(0,Ub.default)(e)&&!(0,Vb.default)(e)},Kb=function(e){return(0,J.default)(e)},qb=function(e){return Y(e)||(0,Bb.default)(e)},Jb=0,Yb=function(e){var t=++Jb;return`${e||``}${t}`},Xb=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Y(e)&&!(0,Bb.default)(e))return n;var i;if(Gb(e)){var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return(0,Vb.default)(i)&&(i=n),r&&i>t&&(i=t),i},Zb=function(e){if(!e)return null;var t=Object.keys(e);return t&&t.length?e[t[0]]:null},Qb=function(e){if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function vx(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function yx(e){"@babel/helpers - typeof";return yx=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},yx(e)}var bx={click:`onClick`,mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,mouseout:`onMouseOut`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,touchcancel:`onTouchCancel`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchstart:`onTouchStart`,contextmenu:`onContextMenu`,dblclick:`onDoubleClick`},xx=function(e){return typeof e==`string`?e:e?e.displayName||e.name||`Component`:``},Sx=null,Cx=null,wx=function e(t){if(t===Sx&&Array.isArray(Cx))return Cx;var n=[];return I.Children.forEach(t,function(t){(0,J.default)(t)||((0,mx.isFragment)(t)?n=n.concat(e(t.props.children)):n.push(t))}),Cx=n,Sx=t,n};function Tx(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(function(e){return xx(e)}):[xx(t)],wx(e).forEach(function(e){var t=(0,Hb.default)(e,`type.displayName`)||(0,Hb.default)(e,`type.name`);r.indexOf(t)!==-1&&n.push(e)}),n}function Ex(e,t){var n=Tx(e,t);return n&&n[0]}var Dx=function(e){if(!e||!e.props)return!1;var t=e.props,n=t.width,r=t.height;return!(!Y(n)||n<=0||!Y(r)||r<=0)},Ox=`a.altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.feBlend.feColormatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.font.font-face.font-face-format.font-face-name.font-face-url.foreignObject.g.glyph.glyphRef.hkern.image.line.lineGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tref.tspan.use.view.vkern`.split(`.`),kx=function(e){return e&&e.type&&(0,Bb.default)(e.type)&&Ox.indexOf(e.type)>=0},Ax=function(e){return e&&yx(e)===`object`&&`clipDot`in e},jx=function(e,t,n,r){var i=lx?.[r]??[];return t.startsWith(`data-`)||!(0,X.default)(e)&&(r&&i.includes(t)||sx.includes(t))||n&&ux.includes(t)},Z=function(e,t,n){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var r=e;if((0,I.isValidElement)(e)&&(r=e.props),!(0,ix.default)(r))return null;var i={};return Object.keys(r).forEach(function(e){jx(r?.[e],e,t,n)&&(i[e]=r[e])}),i},Mx=function e(t,n){if(t===n)return!0;var r=I.Children.count(t);if(r!==I.Children.count(n))return!1;if(r===0)return!0;if(r===1)return Nx(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Bx(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Vx(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,o=e.style,s=e.title,c=e.desc,l=zx(e,Lx),u=i||{width:n,height:r,x:0,y:0},d=z(`recharts-surface`,a);return I.createElement(`svg`,Rx({},Z(l,!0,`svg`),{className:d,width:n,height:r,style:o,viewBox:`${u.x} ${u.y} ${u.width} ${u.height}`}),I.createElement(`title`,null,s),I.createElement(`desc`,null,c),t)}var Hx=[`children`,`className`];function Ux(){return Ux=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gx(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Kx=I.forwardRef(function(e,t){var n=e.children,r=e.className,i=Wx(e,Hx),a=z(`recharts-layer`,r);return I.createElement(`g`,Ux({className:a},Z(i,!0),{ref:t}),n)}),qx=!1,Jx=function(e,t){var n=[...arguments].slice(2);if(qx&&typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e))if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,function(){return n[r++]}))}},Yx=o(((e,t)=>{function n(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r{var n=Yx();function r(e,t,r){var i=e.length;return r=r===void 0?i:r,!t&&r>=i?e:n(e,t,r)}t.exports=r})),Zx=o(((e,t)=>{var n=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function r(e){return n.test(e)}t.exports=r})),Qx=o(((e,t)=>{function n(e){return e.split(``)}t.exports=n})),$x=o(((e,t)=>{var n=`\\ud800-\\udfff`,r=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,i=`\\ufe0e\\ufe0f`,a=`[`+n+`]`,o=`[`+r+`]`,s=`\\ud83c[\\udffb-\\udfff]`,c=`(?:`+o+`|`+s+`)`,l=`[^`+n+`]`,u=`(?:\\ud83c[\\udde6-\\uddff]){2}`,d=`[\\ud800-\\udbff][\\udc00-\\udfff]`,f=`\\u200d`,p=c+`?`,m=`[`+i+`]?`,h=`(?:`+f+`(?:`+[l,u,d].join(`|`)+`)`+m+p+`)*`,g=m+p+h,_=`(?:`+[l+o+`?`,o,u,d,a].join(`|`)+`)`,v=RegExp(s+`(?=`+s+`)|`+_+g,`g`);function y(e){return e.match(v)||[]}t.exports=y})),eS=o(((e,t)=>{var n=Qx(),r=Zx(),i=$x();function a(e){return r(e)?i(e):n(e)}t.exports=a})),tS=o(((e,t)=>{var n=Xx(),r=Zx(),i=eS(),a=kb();function o(e){return function(t){t=a(t);var o=r(t)?i(t):void 0,s=o?o[0]:t.charAt(0),c=o?n(o,1).join(``):t.slice(1);return s[e]()+c}}t.exports=o})),nS=o(((e,t)=>{t.exports=tS()(`toUpperCase`)}));function rS(e){return function(){return e}}var iS=Math.cos,aS=Math.sin,oS=Math.sqrt,sS=Math.PI;sS/2;var cS=2*sS,lS=Math.PI,uS=2*lS,dS=1e-6,fS=uS-dS;function pS(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return pS;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tdS)if(!(Math.abs(u*s-c*l)>dS)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((lS-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>dS&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>dS||Math.abs(this._y1-l)>dS)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%uS+uS),d>fS?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>dS&&this._append`A${n},${n},0,${+(d>=lS)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function gS(){return new hS}gS.prototype=hS.prototype;function _S(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new hS(t)}Array.prototype.slice;function vS(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function yS(e){this._context=e}yS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function bS(e){return new yS(e)}function xS(e){return e[0]}function SS(e){return e[1]}function CS(e,t){var n=rS(!0),r=null,i=bS,a=null,o=_S(s);e=typeof e==`function`?e:e===void 0?xS:rS(e),t=typeof t==`function`?t:t===void 0?SS:rS(t);function s(s){var c,l=(s=vS(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return CS().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:rS(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:rS(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:rS(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:rS(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:rS(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:rS(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:rS(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var TS=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t);break}this._x0=e,this._y0=t}};function ES(e){return new TS(e,!0)}function DS(e){return new TS(e,!1)}var OS={draw(e,t){let n=oS(t/sS);e.moveTo(n,0),e.arc(0,0,n,0,cS)}},kS={draw(e,t){let n=oS(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},AS=oS(1/3),jS=AS*2,MS={draw(e,t){let n=oS(t/jS),r=n*AS;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},NS={draw(e,t){let n=oS(t),r=-n/2;e.rect(r,r,n,n)}},PS=.8908130915292852,FS=aS(sS/10)/aS(7*sS/10),IS=aS(cS/10)*FS,LS=-iS(cS/10)*FS,RS={draw(e,t){let n=oS(t*PS),r=IS*n,i=LS*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=cS*t/5,o=iS(a),s=aS(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},zS=oS(3),BS={draw(e,t){let n=-oS(t/(zS*3));e.moveTo(0,n*2),e.lineTo(-zS*n,-n),e.lineTo(zS*n,-n),e.closePath()}},VS=-.5,HS=oS(3)/2,US=1/oS(12),WS=(US/2+1)*3,GS={draw(e,t){let n=oS(t/WS),r=n/2,i=n*US,a=r,o=n*US+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(VS*r-HS*i,HS*r+VS*i),e.lineTo(VS*a-HS*o,HS*a+VS*o),e.lineTo(VS*s-HS*c,HS*s+VS*c),e.lineTo(VS*r+HS*i,VS*i-HS*r),e.lineTo(VS*a+HS*o,VS*o-HS*a),e.lineTo(VS*s+HS*c,VS*c-HS*s),e.closePath()}};function KS(e,t){let n=null,r=_S(i);e=typeof e==`function`?e:rS(e||OS),t=typeof t==`function`?t:rS(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:rS(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:rS(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function qS(){}function JS(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function YS(e){this._context=e}YS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:JS(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:JS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function XS(e){return new YS(e)}function ZS(e){this._context=e}ZS.prototype={areaStart:qS,areaEnd:qS,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:JS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function QS(e){return new ZS(e)}function $S(e){this._context=e}$S.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:JS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function eC(e){return new $S(e)}function tC(e){this._context=e}tC.prototype={areaStart:qS,areaEnd:qS,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function nC(e){return new tC(e)}function rC(e){return e<0?-1:1}function iC(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(rC(a)+rC(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function aC(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function oC(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function sC(e){this._context=e}sC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:oC(this,this._t0,aC(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,oC(this,aC(this,n=iC(this,e,t)),n);break;default:oC(this,this._t0,n=iC(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function cC(e){this._context=new lC(e)}(cC.prototype=Object.create(sC.prototype)).point=function(e,t){sC.prototype.point.call(this,t,e)};function lC(e){this._context=e}lC.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function uC(e){return new sC(e)}function dC(e){return new cC(e)}function fC(e){this._context=e}fC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=pC(e),i=pC(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}};function gC(e){return new hC(e,.5)}function _C(e){return new hC(e,0)}function vC(e){return new hC(e,1)}function yC(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function xC(e,t){return e[t]}function SC(e){let t=[];return t.key=e,t}function CC(){var e=rS([]),t=bC,n=yC,r=xC;function i(i){var a=Array.from(e.apply(this,arguments),SC),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function LC(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var RC={symbolCircle:OS,symbolCross:kS,symbolDiamond:MS,symbolSquare:NS,symbolStar:RS,symbolTriangle:BS,symbolWye:GS},zC=Math.PI/180,BC=function(e){return RC[`symbol${(0,DC.default)(e)}`]||OS},VC=function(e,t,n){if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*zC;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},HC=function(e,t){RC[`symbol${(0,DC.default)(e)}`]=t},UC=function(e){var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=MC(MC({},IC(e,kC)),{},{type:n,size:i,sizeType:o}),c=function(){var e=BC(n);return KS().type(e).size(VC(i,o,n))()},l=s.className,u=s.cx,d=s.cy,f=Z(s,!0);return u===+u&&d===+d&&i===+i?I.createElement(`path`,AC({},f,{className:z(`recharts-symbols`,l),transform:`translate(${u}, ${d})`,d:c()})):null};UC.registerSymbol=HC;function WC(e){"@babel/helpers - typeof";return WC=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},WC(e)}function GC(){return GC=Object.assign?Object.assign.bind():function(e){for(var t=1;t `);var f=t.inactive?o:t.color;return I.createElement(`li`,GC({className:u,style:c,key:`legend-item-${n}`},px(e.props,t,n)),I.createElement(Vx,{width:r,height:r,viewBox:s,style:l},e.renderIcon(t)),I.createElement(`span`,{className:`recharts-legend-item-text`,style:{color:f}},i?i(d,t,n):d))})}},{key:`render`,value:function(){var e=this.props,t=e.payload,n=e.layout,r=e.align;if(!t||!t.length)return null;var i={padding:0,margin:0,textAlign:n===`horizontal`?r:`left`};return I.createElement(`ul`,{className:`recharts-default-legend`,style:i},this.renderItems())}}])}(I.PureComponent);iw(cw,`displayName`,`Legend`),iw(cw,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`middle`,inactiveColor:`#ccc`});var lw=o(((e,t)=>{var n=mb();function r(){this.__data__=new n,this.size=0}t.exports=r})),uw=o(((e,t)=>{function n(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}t.exports=n})),dw=o(((e,t)=>{function n(e){return this.__data__.get(e)}t.exports=n})),fw=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),pw=o(((e,t)=>{var n=mb(),r=hb(),i=Cb(),a=200;function o(e,t){var o=this.__data__;if(o instanceof n){var s=o.__data__;if(!r||s.length{var n=mb(),r=lw(),i=uw(),a=dw(),o=fw(),s=pw();function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,t.exports=c})),hw=o(((e,t)=>{var n=`__lodash_hash_undefined__`;function r(e){return this.__data__.set(e,n),this}t.exports=r})),gw=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),_w=o(((e,t)=>{var n=Cb(),r=hw(),i=gw();function a(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new n;++t{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{function n(e,t){return e.has(t)}t.exports=n})),bw=o(((e,t)=>{var n=_w(),r=vw(),i=yw(),a=1,o=2;function s(e,t,s,c,l,u){var d=s&a,f=e.length,p=t.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(e),h=u.get(t);if(m&&h)return m==t&&h==e;var g=-1,_=!0,v=s&o?new n:void 0;for(u.set(e,t),u.set(t,e);++g{t.exports=Ry().Uint8Array})),Sw=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}t.exports=n})),Cw=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}t.exports=n})),ww=o(((e,t)=>{var n=zy(),r=xw(),i=cb(),a=bw(),o=Sw(),s=Cw(),c=1,l=2,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Map]`,m=`[object Number]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object Symbol]`,y=`[object ArrayBuffer]`,b=`[object DataView]`,x=n?n.prototype:void 0,S=x?x.valueOf:void 0;function C(e,t,n,x,C,w,T){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!w(new r(e),new r(t)));case u:case d:case m:return i(+e,+t);case f:return e.name==t.name&&e.message==t.message;case h:case _:return e==t+``;case p:var E=o;case g:var D=x&c;if(E||=s,e.size!=t.size&&!D)return!1;var O=T.get(e);if(O)return O==t;x|=l,T.set(e,t);var k=a(E(e),E(t),x,C,w,T);return T.delete(e),k;case v:if(S)return S.call(e)==S.call(t)}return!1}t.exports=C})),Tw=o(((e,t)=>{function n(e,t){for(var n=-1,r=t.length,i=e.length;++n{var n=Tw(),r=Iy();function i(e,t,i){var a=t(e);return r(e)?a:n(a,i(e))}t.exports=i})),Dw=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n{function n(){return[]}t.exports=n})),kw=o(((e,t)=>{var n=Dw(),r=Ow(),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols;t.exports=a?function(e){return e==null?[]:(e=Object(e),n(a(e),function(t){return i.call(e,t)}))}:r})),Aw=o(((e,t)=>{function n(e,t){for(var n=-1,r=Array(e);++n{var n=Hy(),r=Uy(),i=`[object Arguments]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),Mw=o(((e,t)=>{var n=jw(),r=Uy(),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable;t.exports=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,`callee`)&&!o.call(e,`callee`)}})),Nw=o(((e,t)=>{function n(){return!1}t.exports=n})),Pw=o(((e,t)=>{var n=Ry(),r=Nw(),i=typeof e==`object`&&e&&!e.nodeType&&e,a=i&&typeof t==`object`&&t&&!t.nodeType&&t,o=a&&a.exports===i?n.Buffer:void 0;t.exports=(o?o.isBuffer:void 0)||r})),Fw=o(((e,t)=>{var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t??=n,!!t&&(i==`number`||i!=`symbol`&&r.test(e))&&e>-1&&e%1==0&&e{var n=9007199254740991;function r(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=n}t.exports=r})),Lw=o(((e,t)=>{var n=Hy(),r=Iw(),i=Uy(),a=`[object Arguments]`,o=`[object Array]`,s=`[object Boolean]`,c=`[object Date]`,l=`[object Error]`,u=`[object Function]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object RegExp]`,h=`[object Set]`,g=`[object String]`,_=`[object WeakMap]`,v=`[object ArrayBuffer]`,y=`[object DataView]`,b=`[object Float32Array]`,x=`[object Float64Array]`,S=`[object Int8Array]`,C=`[object Int16Array]`,w=`[object Int32Array]`,T=`[object Uint8Array]`,E=`[object Uint8ClampedArray]`,D=`[object Uint16Array]`,O=`[object Uint32Array]`,k={};k[b]=k[x]=k[S]=k[C]=k[w]=k[T]=k[E]=k[D]=k[O]=!0,k[a]=k[o]=k[v]=k[s]=k[y]=k[c]=k[l]=k[u]=k[d]=k[f]=k[p]=k[m]=k[h]=k[g]=k[_]=!1;function A(e){return i(e)&&r(e.length)&&!!k[n(e)]}t.exports=A})),Rw=o(((e,t)=>{function n(e){return function(t){return e(t)}}t.exports=n})),zw=o(((e,t)=>{var n=Ly(),r=typeof e==`object`&&e&&!e.nodeType&&e,i=r&&typeof t==`object`&&t&&!t.nodeType&&t,a=i&&i.exports===r&&n.process;t.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})),Bw=o(((e,t)=>{var n=Lw(),r=Rw(),i=zw(),a=i&&i.isTypedArray;t.exports=a?r(a):n})),Vw=o(((e,t)=>{var n=Aw(),r=Mw(),i=Iy(),a=Pw(),o=Fw(),s=Bw(),c=Object.prototype.hasOwnProperty;function l(e,t){var l=i(e),u=!l&&r(e),d=!l&&!u&&a(e),f=!l&&!u&&!d&&s(e),p=l||u||d||f,m=p?n(e.length,String):[],h=m.length;for(var g in e)(t||c.call(e,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||o(g,h)))&&m.push(g);return m}t.exports=l})),Hw=o(((e,t)=>{var n=Object.prototype;function r(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||n)}t.exports=r})),Uw=o(((e,t)=>{function n(e,t){return function(n){return e(t(n))}}t.exports=n})),Ww=o(((e,t)=>{t.exports=Uw()(Object.keys,Object)})),Gw=o(((e,t)=>{var n=Hw(),r=Ww(),i=Object.prototype.hasOwnProperty;function a(e){if(!n(e))return r(e);var t=[];for(var a in Object(e))i.call(e,a)&&a!=`constructor`&&t.push(a);return t}t.exports=a})),Kw=o(((e,t)=>{var n=qy(),r=Iw();function i(e){return e!=null&&r(e.length)&&!n(e)}t.exports=i})),qw=o(((e,t)=>{var n=Vw(),r=Gw(),i=Kw();function a(e){return i(e)?n(e):r(e)}t.exports=a})),Jw=o(((e,t)=>{var n=Ew(),r=kw(),i=qw();function a(e){return n(e,i,r)}t.exports=a})),Yw=o(((e,t)=>{var n=Jw(),r=1,i=Object.prototype.hasOwnProperty;function a(e,t,a,o,s,c){var l=a&r,u=n(e),d=u.length;if(d!=n(t).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in t:i.call(t,p)))return!1}var m=c.get(e),h=c.get(t);if(m&&h)return m==t&&h==e;var g=!0;c.set(e,t),c.set(t,e);for(var _=l;++f{t.exports=$y()(Ry(),`DataView`)})),Zw=o(((e,t)=>{t.exports=$y()(Ry(),`Promise`)})),Qw=o(((e,t)=>{t.exports=$y()(Ry(),`Set`)})),$w=o(((e,t)=>{t.exports=$y()(Ry(),`WeakMap`)})),eT=o(((e,t)=>{var n=Xw(),r=hb(),i=Zw(),a=Qw(),o=$w(),s=Hy(),c=Xy(),l=`[object Map]`,u=`[object Object]`,d=`[object Promise]`,f=`[object Set]`,p=`[object WeakMap]`,m=`[object DataView]`,h=c(n),g=c(r),_=c(i),v=c(a),y=c(o),b=s;(n&&b(new n(new ArrayBuffer(1)))!=m||r&&b(new r)!=l||i&&b(i.resolve())!=d||a&&b(new a)!=f||o&&b(new o)!=p)&&(b=function(e){var t=s(e),n=t==u?e.constructor:void 0,r=n?c(n):``;if(r)switch(r){case h:return m;case g:return l;case _:return d;case v:return f;case y:return p}return t}),t.exports=b})),tT=o(((e,t)=>{var n=mw(),r=bw(),i=ww(),a=Yw(),o=eT(),s=Iy(),c=Pw(),l=Bw(),u=1,d=`[object Arguments]`,f=`[object Array]`,p=`[object Object]`,m=Object.prototype.hasOwnProperty;function h(e,t,h,g,_,v){var y=s(e),b=s(t),x=y?f:o(e),S=b?f:o(t);x=x==d?p:x,S=S==d?p:S;var C=x==p,w=S==p,T=x==S;if(T&&c(e)){if(!c(t))return!1;y=!0,C=!1}if(T&&!C)return v||=new n,y||l(e)?r(e,t,h,g,_,v):i(e,t,x,h,g,_,v);if(!(h&u)){var E=C&&m.call(e,`__wrapped__`),D=w&&m.call(t,`__wrapped__`);if(E||D){var O=E?e.value():e,k=D?t.value():t;return v||=new n,_(O,k,h,g,v)}}return T?(v||=new n,a(e,t,h,g,_,v)):!1}t.exports=h})),nT=o(((e,t)=>{var n=tT(),r=Uy();function i(e,t,a,o,s){return e===t?!0:e==null||t==null||!r(e)&&!r(t)?e!==e&&t!==t:n(e,t,a,o,i,s)}t.exports=i})),rT=o(((e,t)=>{var n=mw(),r=nT(),i=1,a=2;function o(e,t,o,s){var c=o.length,l=c,u=!s;if(e==null)return!l;for(e=Object(e);c--;){var d=o[c];if(u&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++c{var n=Ky();function r(e){return e===e&&!n(e)}t.exports=r})),aT=o(((e,t)=>{var n=iT(),r=qw();function i(e){for(var t=r(e),i=t.length;i--;){var a=t[i],o=e[a];t[i]=[a,o,n(o)]}return t}t.exports=i})),oT=o(((e,t)=>{function n(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}t.exports=n})),sT=o(((e,t)=>{var n=rT(),r=aT(),i=oT();function a(e){var t=r(e);return t.length==1&&t[0][2]?i(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}t.exports=a})),cT=o(((e,t)=>{function n(e,t){return e!=null&&t in Object(e)}t.exports=n})),lT=o(((e,t)=>{var n=Ab(),r=Mw(),i=Iy(),a=Fw(),o=Iw(),s=jb();function c(e,t,c){t=n(t,e);for(var l=-1,u=t.length,d=!1;++l{var n=cT(),r=lT();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i})),dT=o(((e,t)=>{var n=nT(),r=Nb(),i=uT(),a=Gy(),o=iT(),s=oT(),c=jb(),l=1,u=2;function d(e,t){return a(e)&&o(t)?s(c(e),t):function(a){var o=r(a,e);return o===void 0&&o===t?i(a,e):n(t,o,l|u)}}t.exports=d})),fT=o(((e,t)=>{function n(e){return e}t.exports=n})),pT=o(((e,t)=>{function n(e){return function(t){return t?.[e]}}t.exports=n})),mT=o(((e,t)=>{var n=Mb();function r(e){return function(t){return n(t,e)}}t.exports=r})),hT=o(((e,t)=>{var n=pT(),r=mT(),i=Gy(),a=jb();function o(e){return i(e)?n(a(e)):r(e)}t.exports=o})),gT=o(((e,t)=>{var n=sT(),r=dT(),i=fT(),a=Iy(),o=hT();function s(e){return typeof e==`function`?e:e==null?i:typeof e==`object`?a(e)?r(e[0],e[1]):n(e):o(e)}t.exports=s})),_T=o(((e,t)=>{function n(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a{function n(e){return e!==e}t.exports=n})),yT=o(((e,t)=>{function n(e,t,n){for(var r=n-1,i=e.length;++r{var n=_T(),r=vT(),i=yT();function a(e,t,a){return t===t?i(e,t,a):n(e,r,a)}t.exports=a})),xT=o(((e,t)=>{var n=bT();function r(e,t){return!!(e!=null&&e.length)&&n(e,t,0)>-1}t.exports=r})),ST=o(((e,t)=>{function n(e,t,n){for(var r=-1,i=e==null?0:e.length;++r{function n(){}t.exports=n})),wT=o(((e,t)=>{var n=Qw(),r=CT(),i=Cw();t.exports=n&&1/i(new n([,-0]))[1]==1/0?function(e){return new n(e)}:r})),TT=o(((e,t)=>{var n=_w(),r=xT(),i=ST(),a=yw(),o=wT(),s=Cw(),c=200;function l(e,t,l){var u=-1,d=r,f=e.length,p=!0,m=[],h=m;if(l)p=!1,d=i;else if(f>=c){var g=t?null:o(e);if(g)return s(g);p=!1,d=a,h=new n}else h=t?[]:m;outer:for(;++u{var n=gT(),r=TT();function i(e,t){return e&&e.length?r(e,n(t,2)):[]}t.exports=i}))());function DT(e,t,n){return t===!0?(0,ET.default)(e,n):(0,X.default)(t)?(0,ET.default)(e,t):e}function OT(e){"@babel/helpers - typeof";return OT=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},OT(e)}var kT=[`ref`];function AT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jT(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function KT(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function qT(e){return e.value}function JT(e,t){if(I.isValidElement(e))return I.cloneElement(e,t);if(typeof e==`function`)return I.createElement(e,t);t.ref;var n=GT(t,kT);return I.createElement(cw,n)}var YT=1,XT=function(e){function t(){var e;MT(this,t);var n=[...arguments];return e=FT(this,t,[].concat(n)),HT(e,`lastBoundingBox`,{width:-1,height:-1}),e}return BT(t,e),PT(t,[{key:`componentDidMount`,value:function(){this.updateBBox()}},{key:`componentDidUpdate`,value:function(){this.updateBBox()}},{key:`getBBox`,value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var e=this.wrapperNode.getBoundingClientRect();return e.height=this.wrapperNode.offsetHeight,e.width=this.wrapperNode.offsetWidth,e}return null}},{key:`updateBBox`,value:function(){var e=this.props.onBBoxUpdate,t=this.getBBox();t?(Math.abs(t.width-this.lastBoundingBox.width)>YT||Math.abs(t.height-this.lastBoundingBox.height)>YT)&&(this.lastBoundingBox.width=t.width,this.lastBoundingBox.height=t.height,e&&e(t)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,e&&e(null))}},{key:`getBBoxSnapshot`,value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?jT({},this.lastBoundingBox):{width:0,height:0}}},{key:`getDefaultPosition`,value:function(e){var t=this.props,n=t.layout,r=t.align,i=t.verticalAlign,a=t.margin,o=t.chartWidth,s=t.chartHeight,c,l;if(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))if(r===`center`&&n===`vertical`){var u=this.getBBoxSnapshot();c={left:((o||0)-u.width)/2}}else c=r===`right`?{right:a&&a.right||0}:{left:a&&a.left||0};if(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))if(i===`middle`){var d=this.getBBoxSnapshot();l={top:((s||0)-d.height)/2}}else l=i===`bottom`?{bottom:a&&a.bottom||0}:{top:a&&a.top||0};return jT(jT({},c),l)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.content,r=t.width,i=t.height,a=t.wrapperStyle,o=t.payloadUniqBy,s=t.payload,c=jT(jT({position:`absolute`,width:r||`auto`,height:i||`auto`},this.getDefaultPosition(a)),a);return I.createElement(`div`,{className:`recharts-legend-wrapper`,style:c,ref:function(t){e.wrapperNode=t}},JT(n,jT(jT({},this.props),{},{payload:DT(s,o,qT)})))}}],[{key:`getWithHeight`,value:function(e,t){var n=jT(jT({},this.defaultProps),e.props).layout;return n===`vertical`&&Y(e.props.height)?{height:e.props.height}:n===`horizontal`?{width:e.props.width||t}:null}}])}(I.PureComponent);HT(XT,`displayName`,`Legend`),HT(XT,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`bottom`});var ZT=o(((e,t)=>{var n=zy(),r=Mw(),i=Iy(),a=n?n.isConcatSpreadable:void 0;function o(e){return i(e)||r(e)||!!(a&&e&&e[a])}t.exports=o})),QT=o(((e,t)=>{var n=Tw(),r=ZT();function i(e,t,a,o,s){var c=-1,l=e.length;for(a||=r,s||=[];++c0&&a(u)?t>1?i(u,t-1,a,o,s):n(s,u):o||(s[s.length]=u)}return s}t.exports=i})),$T=o(((e,t)=>{function n(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}t.exports=n})),eE=o(((e,t)=>{t.exports=$T()()})),tE=o(((e,t)=>{var n=eE(),r=qw();function i(e,t){return e&&n(e,t,r)}t.exports=i})),nE=o(((e,t)=>{var n=Kw();function r(e,t){return function(r,i){if(r==null)return r;if(!n(r))return e(r,i);for(var a=r.length,o=t?a:-1,s=Object(r);(t?o--:++o{var n=tE();t.exports=nE()(n)})),iE=o(((e,t)=>{var n=rE(),r=Kw();function i(e,t){var i=-1,a=r(e)?Array(e.length):[];return n(e,function(e,n,r){a[++i]=t(e,n,r)}),a}t.exports=i})),aE=o(((e,t)=>{function n(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}t.exports=n})),oE=o(((e,t)=>{var n=Wy();function r(e,t){if(e!==t){var r=e!==void 0,i=e===null,a=e===e,o=n(e),s=t!==void 0,c=t===null,l=t===t,u=n(t);if(!c&&!u&&!o&&e>t||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&e{var n=oE();function r(e,t,r){for(var i=-1,a=e.criteria,o=t.criteria,s=a.length,c=r.length;++i=c?l:l*(r[i]==`desc`?-1:1)}return e.index-t.index}t.exports=r})),cE=o(((e,t)=>{var n=Db(),r=Mb(),i=gT(),a=iE(),o=aE(),s=Rw(),c=sE(),l=fT(),u=Iy();function d(e,t,d){t=t.length?n(t,function(e){return u(e)?function(t){return r(t,e.length===1?e[0]:e)}:e}):[l];var f=-1;return t=n(t,s(i)),o(a(e,function(e,r,i){return{criteria:n(t,function(t){return t(e)}),index:++f,value:e}}),function(e,t){return c(e,t,d)})}t.exports=d})),lE=o(((e,t)=>{function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}t.exports=n})),uE=o(((e,t)=>{var n=lE(),r=Math.max;function i(e,t,i){return t=r(t===void 0?e.length-1:t,0),function(){for(var a=arguments,o=-1,s=r(a.length-t,0),c=Array(s);++o{function n(e){return function(){return e}}t.exports=n})),fE=o(((e,t)=>{var n=$y();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),pE=o(((e,t)=>{var n=dE(),r=fE(),i=fT();t.exports=r?function(e,t){return r(e,`toString`,{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:i})),mE=o(((e,t)=>{var n=800,r=16,i=Date.now;function a(e){var t=0,a=0;return function(){var o=i(),s=r-(o-a);if(a=o,s>0){if(++t>=n)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}t.exports=a})),hE=o(((e,t)=>{var n=pE();t.exports=mE()(n)})),gE=o(((e,t)=>{var n=fT(),r=uE(),i=hE();function a(e,t){return i(r(e,t,n),e+``)}t.exports=a})),_E=o(((e,t)=>{var n=cb(),r=Kw(),i=Fw(),a=Ky();function o(e,t,o){if(!a(o))return!1;var s=typeof t;return(s==`number`?r(o)&&i(t,o.length):s==`string`&&t in o)?n(o[t],e):!1}t.exports=o})),vE=l(o(((e,t)=>{var n=QT(),r=cE(),i=gE(),a=_E();t.exports=i(function(e,t){if(e==null)return[];var i=t.length;return i>1&&a(e,t[0],t[1])?t=[]:i>2&&a(t[0],t[1],t[2])&&(t=[t[0]]),r(e,n(t,1),[])})}))());function yE(e){"@babel/helpers - typeof";return yE=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},yE(e)}function bE(){return bE=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=t.x),`${RE}-left`,Y(n)&&t&&Y(t.x)&&n=t.y),`${RE}-top`,Y(r)&&t&&Y(t.y)&&rc[r]+l?Math.max(u,c[r]):Math.max(d,c[r])}function HE(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function UE(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,s=e.useTranslate3d,c=e.viewBox,l,u,d;return o.height>0&&o.width>0&&n?(u=VE({allowEscapeViewBox:t,coordinate:n,key:`x`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),d=VE({allowEscapeViewBox:t,coordinate:n,key:`y`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),l=HE({translateX:u,translateY:d,useTranslate3d:s})):l=zE,{cssProperties:l,cssClasses:BE({translateX:u,translateY:d,coordinate:n})}}function WE(e){"@babel/helpers - typeof";return WE=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},WE(e)}function GE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function KE(e){for(var t=1;toD||Math.abs(e.height-this.state.lastBoundingBox.height)>oD)&&this.setState({lastBoundingBox:{width:e.width,height:e.height}})}else (this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:`componentDidMount`,value:function(){document.addEventListener(`keydown`,this.handleKeyDown),this.updateBBox()}},{key:`componentWillUnmount`,value:function(){document.removeEventListener(`keydown`,this.handleKeyDown)}},{key:`componentDidUpdate`,value:function(){this.props.active&&this.updateBBox(),this.state.dismissed&&(this.props.coordinate?.x!==this.state.dismissedAtCoordinate.x||this.props.coordinate?.y!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.active,r=t.allowEscapeViewBox,i=t.animationDuration,a=t.animationEasing,o=t.children,s=t.coordinate,c=t.hasPayload,l=t.isAnimationActive,u=t.offset,d=t.position,f=t.reverseDirection,p=t.useTranslate3d,m=t.viewBox,h=t.wrapperStyle,g=UE({allowEscapeViewBox:r,coordinate:s,offsetTopLeft:u,position:d,reverseDirection:f,tooltipBox:this.state.lastBoundingBox,useTranslate3d:p,viewBox:m}),_=g.cssClasses,v=g.cssProperties,y=KE(KE({transition:l&&n?`transform ${i}ms ${a}`:void 0},v),{},{pointerEvents:`none`,visibility:!this.state.dismissed&&n&&c?`visible`:`hidden`,position:`absolute`,top:0,left:0},h);return I.createElement(`div`,{tabIndex:-1,className:_,style:y,ref:function(t){e.wrapperNode=t}},o)}}])}(I.PureComponent),cD={isSsr:function(){return!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)}(),get:function(e){return cD[e]},set:function(e,t){if(typeof e==`string`)cD[e]=t;else{var n=Object.keys(e);n&&n.length&&n.forEach(function(t){cD[t]=e[t]})}}};function lD(e){"@babel/helpers - typeof";return lD=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},lD(e)}function uD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dD(e){for(var t=1;t0;return I.createElement(sD,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:l,active:n,coordinate:s,hasPayload:y,offset:u,position:p,reverseDirection:m,useTranslate3d:h,viewBox:g,wrapperStyle:_},ED(o,dD(dD({},this.props),{},{payload:v})))}}])}(I.PureComponent);SD(DD,`displayName`,`Tooltip`),SD(DD,`defaultProps`,{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:`ease`,contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!cD.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:` : `,trigger:`hover`,useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var OD=o(((e,t)=>{var n=Ry();t.exports=function(){return n.Date.now()}})),kD=o(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),AD=o(((e,t)=>{var n=kD(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),jD=o(((e,t)=>{var n=AD(),r=Ky(),i=Wy(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),MD=o(((e,t)=>{var n=Ky(),r=OD(),i=jD(),a=`Expected a function`,o=Math.max,s=Math.min;function c(e,t,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof e!=`function`)throw TypeError(a);t=i(t)||0,n(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?o(i(c.maxWait)||0,t):d,v=`trailing`in c?!!c.trailing:v);function y(t){var n=l,r=u;return l=u=void 0,h=t,f=e.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,t),g?y(e):f}function x(e){var n=e-m,r=e-h,i=t-n;return _?s(i,d-r):i}function S(e){var n=e-m,r=e-h;return m===void 0||n>=t||n<0||_&&r>=d}function C(){var e=r();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(r())}function D(){var e=r(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,t),y(m)}return p===void 0&&(p=setTimeout(C,t)),f}return D.cancel=T,D.flush=E,D}t.exports=c})),ND=l(o(((e,t)=>{var n=MD(),r=Ky(),i=`Expected a function`;function a(e,t,a){var o=!0,s=!0;if(typeof e!=`function`)throw TypeError(i);return r(a)&&(o=`leading`in a?!!a.leading:o,s=`trailing`in a?!!a.trailing:s),n(e,t,{leading:o,maxWait:t,trailing:s})}t.exports=a}))());function PD(e){"@babel/helpers - typeof";return PD=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},PD(e)}function FD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ID(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&(e=(0,ND.default)(e,h,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=x.current.getBoundingClientRect(),r=n.width,i=n.height;return E(r,i),t.observe(x.current),function(){t.disconnect()}},[E,h]);var D=(0,I.useMemo)(function(){var e=w.containerWidth,t=w.containerHeight;if(e<0||t<0)return null;Jx(Gb(o)||Gb(c),`The width(%s) and height(%s) are both fixed numbers,
- maybe you don't need to use a ResponsiveContainer.`,o,c),Jx(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var r=Gb(o)?e:o,i=Gb(c)?t:c;n&&n>0&&(r?i=r/n:i&&(r=i*n),f&&i>f&&(i=f)),Jx(r>0||i>0,`The width(%s) and height(%s) of chart should be greater than 0,
- please check the style of container, or the props width(%s) and height(%s),
- or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
- height and width.`,r,i,o,c,u,d,n);var a=!Array.isArray(p)&&xx(p.type).endsWith(`Chart`);return I.Children.map(p,function(e){return I.isValidElement(e)?(0,I.cloneElement)(e,ID({width:r,height:i},a?{style:ID({height:`100%`,width:`100%`,maxHeight:i,maxWidth:r},e.props.style)}:{})):e})},[n,p,c,f,d,u,w,o]);return I.createElement(`div`,{id:g?`${g}`:void 0,className:z(`recharts-responsive-container`,_),style:ID(ID({},b),{},{width:o,height:c,minWidth:u,minHeight:d,maxHeight:f}),ref:x},D)}),qD=function(e){return null};qD.displayName=`Cell`;function JD(e){"@babel/helpers - typeof";return JD=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},JD(e)}function YD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function XD(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||cD.isSsr)return{width:0,height:0};var n=iO(t),r=JSON.stringify({text:e,copyStyle:n});if(eO.widthCache[r])return eO.widthCache[r];try{var i=document.getElementById(rO);i||(i=document.createElement(`span`),i.setAttribute(`id`,rO),i.setAttribute(`aria-hidden`,`true`),document.body.appendChild(i));var a=XD(XD({},nO),n);Object.assign(i.style,a),i.textContent=`${e}`;var o=i.getBoundingClientRect(),s={width:o.width,height:o.height};return eO.widthCache[r]=s,++eO.cacheCount>tO&&(eO.cacheCount=0,eO.widthCache={}),s}catch{return{width:0,height:0}}},oO=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function sO(e){"@babel/helpers - typeof";return sO=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},sO(e)}function cO(e,t){return pO(e)||fO(e,t)||uO(e,t)||lO()}function lO(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uO(e,t){if(e){if(typeof e==`string`)return dO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dO(e,t)}}function dO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function RO(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function zO(e,t){return WO(e)||UO(e,t)||VO(e,t)||BO()}function BO(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VO(e,t){if(e){if(typeof e==`string`)return HO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return HO(e,t)}}function HO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&arguments[0]!==void 0?arguments[0]:[]).reduce(function(e,t){var a=t.word,o=t.width,s=e[e.length-1];if(s&&(r==null||i||s.width+o+nt.width?e:t})};if(!l)return f;for(var m=`…`,h=function(e){var t=KO({breakAll:c,style:s,children:u.slice(0,e)+m}).wordsWithComputedWidth,n=d(t);return[n.length>a||p(n).width>Number(r),n]},g=0,_=u.length-1,v=0,y;g<=_&&v<=u.length-1;){var b=Math.floor((g+_)/2),x=zO(h(b-1),2),S=x[0],C=x[1],w=zO(h(b),1)[0];if(!S&&!w&&(g=b+1),S&&w&&(_=b-1),!S&&w){y=C;break}v++}return y||f},JO=function(e){return[{words:(0,J.default)(e)?[]:e.toString().split(GO)}]},YO=function(e){var t=e.width,n=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,o=e.maxLines;if((t||n)&&!cD.isSsr){var s,c,l=KO({breakAll:a,children:r,style:i});if(l){var u=l.wordsWithComputedWidth,d=l.spaceWidth;s=u,c=d}else return JO(r);return qO({breakAll:a,children:r,maxLines:o,style:i},s,c,t,n)}return JO(r)},XO=`#808080`,ZO=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.lineHeight,o=a===void 0?`1em`:a,s=e.capHeight,c=s===void 0?`0.71em`:s,l=e.scaleToFit,u=l===void 0?!1:l,d=e.textAnchor,f=d===void 0?`start`:d,p=e.verticalAnchor,m=p===void 0?`end`:p,h=e.fill,g=h===void 0?XO:h,_=LO(e,PO),v=(0,I.useMemo)(function(){return YO({breakAll:_.breakAll,children:_.children,maxLines:_.maxLines,scaleToFit:u,style:_.style,width:_.width})},[_.breakAll,_.children,_.maxLines,u,_.style,_.width]),y=_.dx,b=_.dy,x=_.angle,S=_.className,C=_.breakAll,w=LO(_,FO);if(!qb(n)||!qb(i))return null;var T=n+(Y(y)?y:0),E=i+(Y(b)?b:0),D;switch(m){case`start`:D=NO(`calc(${c})`);break;case`middle`:D=NO(`calc(${(v.length-1)/2} * -${o} + (${c} / 2))`);break;default:D=NO(`calc(${v.length-1} * -${o})`);break}var O=[];if(u){var k=v[0].width,A=_.width;O.push(`scale(${(Y(A)?A/k:1)/k})`)}return x&&O.push(`rotate(${x}, ${T}, ${E})`),O.length&&(w.transform=O.join(` `)),I.createElement(`text`,IO({},Z(w,!0),{x:T,y:E,className:z(`recharts-text`,S),textAnchor:f,fill:g.includes(`url`)?XO:g}),v.map(function(e,t){var n=e.words.join(C?``:` `);return I.createElement(`tspan`,{x:T,dy:t===0?D:o,key:`${n}-${t}`},n)}))};function QO(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function $O(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function ek(e){let t,n,r;e.length===2?(t=e===QO||e===$O?e:tk,n=e,r=e):(t=QO,n=(t,n)=>QO(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function tk(){return 0}function nk(e){return e===null?NaN:+e}function*rk(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var ik=ek(QO),ak=ik.right;ik.left,ek(nk).center;var ok=class extends Map{constructor(e,t=uk){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(sk(this,e))}has(e){return super.has(sk(this,e))}set(e,t){return super.set(ck(this,e),t)}delete(e){return super.delete(lk(this,e))}};function sk({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function ck({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function lk({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function uk(e){return typeof e==`object`&&e?e.valueOf():e}function dk(e=QO){if(e===QO)return fk;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function fk(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var pk=Math.sqrt(50),mk=Math.sqrt(10),hk=Math.sqrt(2);function gk(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=pk?10:a>=mk?5:a>=hk?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function xk(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function Sk(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?fk:dk(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));Sk(e,t,u,d,i)}let a=e[t],o=n,s=r;for(Ck(e,n,t),i(e[r],a)>0&&Ck(e,n,r);o0;)--s}i(e[n],a)===0?Ck(e,n,s):(++s,Ck(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function Ck(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function wk(e,t,n){if(e=Float64Array.from(rk(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return xk(e);if(t>=1)return bk(e);var r,i=(r-1)*t,a=Math.floor(i),o=bk(Sk(e,a).subarray(0,a+1));return o+(xk(e.subarray(a+1))-o)*(i-a)}}function Tk(e,t,n=nk){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function Ek(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?nA(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?nA(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Uk.exec(e))?new aA(t[1],t[2],t[3],1):(t=Wk.exec(e))?new aA(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Gk.exec(e))?nA(t[1],t[2],t[3],t[4]):(t=Kk.exec(e))?nA(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=qk.exec(e))?fA(t[1],t[2]/100,t[3]/100,1):(t=Jk.exec(e))?fA(t[1],t[2]/100,t[3]/100,t[4]):Yk.hasOwnProperty(e)?tA(Yk[e]):e===`transparent`?new aA(NaN,NaN,NaN,0):null}function tA(e){return new aA(e>>16&255,e>>8&255,e&255,1)}function nA(e,t,n,r){return r<=0&&(e=t=n=NaN),new aA(e,t,n,r)}function rA(e){return e instanceof Ik||(e=eA(e)),e?(e=e.rgb(),new aA(e.r,e.g,e.b,e.opacity)):new aA}function iA(e,t,n,r){return arguments.length===1?rA(e):new aA(e,t,n,r??1)}function aA(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Pk(aA,iA,Fk(Ik,{brighter(e){return e=e==null?Rk:Rk**+e,new aA(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Lk:Lk**+e,new aA(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new aA(uA(this.r),uA(this.g),uA(this.b),lA(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:oA,formatHex:oA,formatHex8:sA,formatRgb:cA,toString:cA}));function oA(){return`#${dA(this.r)}${dA(this.g)}${dA(this.b)}`}function sA(){return`#${dA(this.r)}${dA(this.g)}${dA(this.b)}${dA((isNaN(this.opacity)?1:this.opacity)*255)}`}function cA(){let e=lA(this.opacity);return`${e===1?`rgb(`:`rgba(`}${uA(this.r)}, ${uA(this.g)}, ${uA(this.b)}${e===1?`)`:`, ${e})`}`}function lA(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function uA(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function dA(e){return e=uA(e),(e<16?`0`:``)+e.toString(16)}function fA(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new hA(e,t,n,r)}function pA(e){if(e instanceof hA)return new hA(e.h,e.s,e.l,e.opacity);if(e instanceof Ik||(e=eA(e)),!e)return new hA;if(e instanceof hA)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new hA(o,s,c,e.opacity)}function mA(e,t,n,r){return arguments.length===1?pA(e):new hA(e,t,n,r??1)}function hA(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Pk(hA,mA,Fk(Ik,{brighter(e){return e=e==null?Rk:Rk**+e,new hA(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Lk:Lk**+e,new hA(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new aA(vA(e>=240?e-240:e+120,i,r),vA(e,i,r),vA(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new hA(gA(this.h),_A(this.s),_A(this.l),lA(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=lA(this.opacity);return`${e===1?`hsl(`:`hsla(`}${gA(this.h)}, ${_A(this.s)*100}%, ${_A(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function gA(e){return e=(e||0)%360,e<0?e+360:e}function _A(e){return Math.max(0,Math.min(1,e||0))}function vA(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var yA=e=>()=>e;function bA(e,t){return function(n){return e+n*t}}function xA(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function SA(e){return(e=+e)==1?CA:function(t,n){return n-t?xA(t,n,e):yA(isNaN(t)?n:t)}}function CA(e,t){var n=t-e;return n?bA(e,n):yA(isNaN(e)?t:e)}var wA=(function e(t){var n=SA(t);function r(e,t){var r=n((e=iA(e)).r,(t=iA(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=CA(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function TA(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:kA(r,i)})),n=MA.lastIndex;return nt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function GA(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?KA:GA,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),kA))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,BA),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=LA,u()},d.clamp=function(e){return arguments.length?(o=e?!0:HA,u()):o!==HA},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function YA(){return JA()(HA,HA)}function XA(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function ZA(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function QA(e){return e=ZA(Math.abs(e)),e?e[1]:NaN}function $A(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function ej(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var tj=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function nj(e){if(!(t=tj.exec(e)))throw Error(`invalid format: `+e);var t;return new rj({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}nj.prototype=rj.prototype;function rj(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}rj.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function ij(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var aj;function oj(e,t){var n=ZA(e,t);if(!n)return aj=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(aj=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+ZA(e,Math.max(0,t+a-1))[0]}function sj(e,t){var n=ZA(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var cj={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:XA,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>sj(e*100,t),r:sj,s:oj,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function lj(e){return e}var uj=Array.prototype.map,dj=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function fj(e){var t=e.grouping===void 0||e.thousands===void 0?lj:$A(uj.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?lj:ej(uj.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=nj(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):cj[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=cj[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=ij(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&aj!==void 0?dj[8+aj/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(QA(t)/3)))*3,r=10**-n,i=l((e=nj(e),e.type=`f`,e),{suffix:dj[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var pj,mj,hj;gj({thousands:`,`,grouping:[3],currency:[`$`,``]});function gj(e){return pj=fj(e),mj=pj.format,hj=pj.formatPrefix,pj}function _j(e){return Math.max(0,-QA(Math.abs(e)))}function vj(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(QA(t)/3)))*3-QA(Math.abs(e)))}function yj(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,QA(t)-QA(e))+1}function bj(e,t,n,r){var i=yk(e,t,n),a;switch(r=nj(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=vj(i,o))&&(r.precision=a),hj(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=yj(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=_j(i))&&(r.precision=a-(r.type===`%`)*2);break}return mj(r)}function xj(e){var t=e.domain;return e.ticks=function(e){var n=t();return _k(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return bj(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=vk(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function Sj(){var e=YA();return e.copy=function(){return qA(e,Sj())},Dk.apply(e,arguments),xj(e)}function Cj(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,BA),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return Cj(e).unknown(t)},e=arguments.length?Array.from(e,BA):[0,1],xj(n)}function wj(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function jj(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function Mj(e){return(t,n)=>-e(-t,n)}function Nj(e){let t=e(Tj,Ej),n=t.domain,r=10,i,a;function o(){return i=jj(r),a=Aj(r),n()[0]<0?(i=Mj(i),a=Mj(a),e(Dj,Oj)):e(Tj,Ej),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=nj(n)).precision==null&&(n.trim=!0),n=mj(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(wj(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function Pj(){let e=Nj(JA()).domain([1,10]);return e.copy=()=>qA(e,Pj()).base(e.base()),Dk.apply(e,arguments),e}function Fj(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Ij(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Lj(e){var t=1,n=e(Fj(t),Ij(t));return n.constant=function(n){return arguments.length?e(Fj(t=+n),Ij(t)):t},xj(n)}function Rj(){var e=Lj(JA());return e.copy=function(){return qA(e,Rj()).constant(e.constant())},Dk.apply(e,arguments)}function zj(e){return function(t){return t<0?-((-t)**+e):t**+e}}function Bj(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Vj(e){return e<0?-e*e:e*e}function Hj(e){var t=e(HA,HA),n=1;function r(){return n===1?e(HA,HA):n===.5?e(Bj,Vj):e(zj(n),zj(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},xj(t)}function Uj(){var e=Hj(JA());return e.copy=function(){return qA(e,Uj()).exponent(e.exponent())},Dk.apply(e,arguments),e}function Wj(){return Uj.apply(null,arguments).exponent(.5)}function Gj(e){return Math.sign(e)*e*e}function Kj(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function qj(){var e=YA(),t=[0,1],n=!1,r;function i(t){var i=Kj(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(Gj(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,BA)).map(Gj)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return qj(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Dk.apply(i,arguments),xj(i)}function Jj(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Yj().domain([e,t]).range(i).unknown(a)},Dk.apply(xj(o),arguments)}function Xj(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[ak(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return Xj().domain(e).range(t).unknown(n)},Dk.apply(i,arguments)}var Zj=new Date,Qj=new Date;function $j(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(s$j(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(Zj.setTime(+t),Qj.setTime(+r),e(Zj),e(Qj),Math.floor(n(Zj,Qj))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var eM=$j(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);eM.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?$j(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):eM),eM.range;var tM=1e3,nM=tM*60,rM=nM*60,iM=rM*24,aM=iM*7,oM=iM*30,sM=iM*365,cM=$j(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*tM)},(e,t)=>(t-e)/tM,e=>e.getUTCSeconds());cM.range;var lM=$j(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*tM)},(e,t)=>{e.setTime(+e+t*nM)},(e,t)=>(t-e)/nM,e=>e.getMinutes());lM.range;var uM=$j(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*nM)},(e,t)=>(t-e)/nM,e=>e.getUTCMinutes());uM.range;var dM=$j(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*tM-e.getMinutes()*nM)},(e,t)=>{e.setTime(+e+t*rM)},(e,t)=>(t-e)/rM,e=>e.getHours());dM.range;var fM=$j(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*rM)},(e,t)=>(t-e)/rM,e=>e.getUTCHours());fM.range;var pM=$j(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*nM)/iM,e=>e.getDate()-1);pM.range;var mM=$j(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/iM,e=>e.getUTCDate()-1);mM.range;var hM=$j(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/iM,e=>Math.floor(e/iM));hM.range;function gM(e){return $j(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*nM)/aM)}var _M=gM(0),vM=gM(1),yM=gM(2),bM=gM(3),xM=gM(4),SM=gM(5),CM=gM(6);_M.range,vM.range,yM.range,bM.range,xM.range,SM.range,CM.range;function wM(e){return $j(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/aM)}var TM=wM(0),EM=wM(1),DM=wM(2),OM=wM(3),kM=wM(4),AM=wM(5),jM=wM(6);TM.range,EM.range,DM.range,OM.range,kM.range,AM.range,jM.range;var MM=$j(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());MM.range;var NM=$j(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());NM.range;var PM=$j(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());PM.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:$j(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),PM.range;var FM=$j(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());FM.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:$j(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),FM.range;function IM(e,t,n,r,i,a){let o=[[cM,1,tM],[cM,5,5*tM],[cM,15,15*tM],[cM,30,30*tM],[a,1,nM],[a,5,5*nM],[a,15,15*nM],[a,30,30*nM],[i,1,rM],[i,3,3*rM],[i,6,6*rM],[i,12,12*rM],[r,1,iM],[r,2,2*iM],[n,1,aM],[t,1,oM],[t,3,3*oM],[e,1,sM]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(yk(t/sM,n/sM,r));if(a===0)return eM.every(Math.max(yk(t,n,r),1));let[s,c]=o[i/o[a-1][2]53)return null;`w`in r||(r.w=1),`Z`in r?(a=HM(UM(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?EM.ceil(a):EM(a),a=mM.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=VM(UM(r.y,0,1)),o=a.getDay(),a=o>4||o===0?vM.ceil(a):vM(a),a=pM.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else (`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?HM(UM(r.y,0,1)).getUTCDay():VM(UM(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,HM(r)):VM(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in GM?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function j(e,t,r){return w(e,n,t,r)}function M(e,t,n){return w(e,r,t,n)}function N(e){return o[e.getDay()]}function P(e){return a[e.getDay()]}function ee(e){return c[e.getMonth()]}function F(e){return s[e.getMonth()]}function te(e){return i[+(e.getHours()>=12)]}function ne(e){return 1+~~(e.getMonth()/3)}function re(e){return o[e.getUTCDay()]}function ie(e){return a[e.getUTCDay()]}function ae(e){return c[e.getUTCMonth()]}function oe(e){return s[e.getUTCMonth()]}function se(e){return i[+(e.getUTCHours()>=12)]}function ce(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var GM={"-":``,_:` `,0:`0`},KM=/^\s*\d+/,qM=/^%/,JM=/[\\^$*+?|[\]().{}]/g;function YM(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function $M(e,t,n){var r=KM.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function eN(e,t,n){var r=KM.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function tN(e,t,n){var r=KM.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function nN(e,t,n){var r=KM.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function rN(e,t,n){var r=KM.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function iN(e,t,n){var r=KM.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function aN(e,t,n){var r=KM.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function oN(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function sN(e,t,n){var r=KM.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function cN(e,t,n){var r=KM.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function lN(e,t,n){var r=KM.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function uN(e,t,n){var r=KM.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function dN(e,t,n){var r=KM.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function fN(e,t,n){var r=KM.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function pN(e,t,n){var r=KM.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function mN(e,t,n){var r=KM.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function hN(e,t,n){var r=KM.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function gN(e,t,n){var r=qM.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function _N(e,t,n){var r=KM.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function vN(e,t,n){var r=KM.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function yN(e,t){return YM(e.getDate(),t,2)}function bN(e,t){return YM(e.getHours(),t,2)}function xN(e,t){return YM(e.getHours()%12||12,t,2)}function SN(e,t){return YM(1+pM.count(PM(e),e),t,3)}function CN(e,t){return YM(e.getMilliseconds(),t,3)}function wN(e,t){return CN(e,t)+`000`}function TN(e,t){return YM(e.getMonth()+1,t,2)}function EN(e,t){return YM(e.getMinutes(),t,2)}function DN(e,t){return YM(e.getSeconds(),t,2)}function ON(e){var t=e.getDay();return t===0?7:t}function kN(e,t){return YM(_M.count(PM(e)-1,e),t,2)}function AN(e){var t=e.getDay();return t>=4||t===0?xM(e):xM.ceil(e)}function jN(e,t){return e=AN(e),YM(xM.count(PM(e),e)+(PM(e).getDay()===4),t,2)}function MN(e){return e.getDay()}function NN(e,t){return YM(vM.count(PM(e)-1,e),t,2)}function PN(e,t){return YM(e.getFullYear()%100,t,2)}function FN(e,t){return e=AN(e),YM(e.getFullYear()%100,t,2)}function IN(e,t){return YM(e.getFullYear()%1e4,t,4)}function LN(e,t){var n=e.getDay();return e=n>=4||n===0?xM(e):xM.ceil(e),YM(e.getFullYear()%1e4,t,4)}function RN(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+YM(t/60|0,`0`,2)+YM(t%60,`0`,2)}function zN(e,t){return YM(e.getUTCDate(),t,2)}function BN(e,t){return YM(e.getUTCHours(),t,2)}function VN(e,t){return YM(e.getUTCHours()%12||12,t,2)}function HN(e,t){return YM(1+mM.count(FM(e),e),t,3)}function UN(e,t){return YM(e.getUTCMilliseconds(),t,3)}function WN(e,t){return UN(e,t)+`000`}function GN(e,t){return YM(e.getUTCMonth()+1,t,2)}function KN(e,t){return YM(e.getUTCMinutes(),t,2)}function qN(e,t){return YM(e.getUTCSeconds(),t,2)}function JN(e){var t=e.getUTCDay();return t===0?7:t}function YN(e,t){return YM(TM.count(FM(e)-1,e),t,2)}function XN(e){var t=e.getUTCDay();return t>=4||t===0?kM(e):kM.ceil(e)}function ZN(e,t){return e=XN(e),YM(kM.count(FM(e),e)+(FM(e).getUTCDay()===4),t,2)}function QN(e){return e.getUTCDay()}function $N(e,t){return YM(EM.count(FM(e)-1,e),t,2)}function eP(e,t){return YM(e.getUTCFullYear()%100,t,2)}function tP(e,t){return e=XN(e),YM(e.getUTCFullYear()%100,t,2)}function nP(e,t){return YM(e.getUTCFullYear()%1e4,t,4)}function rP(e,t){var n=e.getUTCDay();return e=n>=4||n===0?kM(e):kM.ceil(e),YM(e.getUTCFullYear()%1e4,t,4)}function iP(){return`+0000`}function aP(){return`%`}function oP(e){return+e}function sP(e){return Math.floor(e/1e3)}var cP,lP,uP;dP({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function dP(e){return cP=WM(e),lP=cP.format,cP.parse,uP=cP.utcFormat,cP.utcParse,cP}function fP(e){return new Date(e)}function pP(e){return e instanceof Date?+e:+new Date(+e)}function mP(e,t,n,r,i,a,o,s,c,l){var u=YA(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>wk(e,r/t))},n.copy=function(){return wP(t).domain(e)},Ok.apply(n,arguments)}function TP(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=HA,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*ejk,scaleDiverging:()=>EP,scaleDivergingLog:()=>DP,scaleDivergingPow:()=>kP,scaleDivergingSqrt:()=>AP,scaleDivergingSymlog:()=>OP,scaleIdentity:()=>Cj,scaleImplicit:()=>kk,scaleLinear:()=>Sj,scaleLog:()=>Pj,scaleOrdinal:()=>Ak,scalePoint:()=>Nk,scalePow:()=>Uj,scaleQuantile:()=>Jj,scaleQuantize:()=>Yj,scaleRadial:()=>qj,scaleSequential:()=>yP,scaleSequentialLog:()=>bP,scaleSequentialPow:()=>SP,scaleSequentialQuantile:()=>wP,scaleSequentialSqrt:()=>CP,scaleSequentialSymlog:()=>xP,scaleSqrt:()=>Wj,scaleSymlog:()=>Rj,scaleThreshold:()=>Xj,scaleTime:()=>hP,scaleUtc:()=>gP,tickFormat:()=>bj}),MP=o(((e,t)=>{var n=Wy();function r(e,t,r){for(var i=-1,a=e.length;++i{function n(e,t){return e>t}t.exports=n})),PP=o(((e,t)=>{var n=MP(),r=NP(),i=fT();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),FP=o(((e,t)=>{function n(e,t){return e{var n=MP(),r=FP(),i=fT();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),LP=o(((e,t)=>{var n=Db(),r=gT(),i=iE(),a=Iy();function o(e,t){return(a(e)?n:i)(e,r(t,3))}t.exports=o})),RP=o(((e,t)=>{var n=QT(),r=LP();function i(e,t){return n(r(e,t),1)}t.exports=i})),zP=o(((e,t)=>{var n=nT();function r(e,t){return n(e,t)}t.exports=r})),BP=o(((e,t)=>{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),A(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),A(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||en)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tr?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,A=r.constructor,j=r.s==i.s?1:-1,M=r.d,N=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=N.length,T=M.length,g=new A(j),_=g.d=[],u=0;N[u]==(M[u]||0);)++u;if(N[u]>(M[u]||0)&&--l,x=o==null?o=A.precision:s?o+(S(r)-S(i))+1:o,x<0)return new A(0);if(x=x/p+2|0,u=0,O==1)for(d=0,N=N[0],x++;(u1&&(N=e(N,d),M=e(M,d),O=N.length,T=M.length),w=O,v=M.slice(0,O),y=v.length;y=f/2&&++E;do d=0,c=t(N,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(N,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),rh||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function A(e,t){if(e.length>t)return e.length=t,!0}function j(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}else if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=j,i.config=i.set=M,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i);if((i=e[r=`LN10`])!==void 0)if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i);return this}r=j(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}));function VP(e){return GP(e)||WP(e)||UP(e)||HP()}function HP(){throw TypeError(`Invalid attempt to spread non-iterable instance.
-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UP(e,t){if(e){if(typeof e==`string`)return KP(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return KP(e,t)}}function WP(e){if(typeof Symbol<`u`&&Symbol.iterator in Object(e))return Array.from(e)}function GP(e){if(Array.isArray(e))return KP(e)}function KP(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=t?n.apply(void 0,r):e(t-i,XP(function(){var e=[...arguments],t=r.map(function(t){return YP(t)?e.shift():t});return n.apply(void 0,VP(t).concat(e))}))})},QP=function(e){return ZP(e.length,e)},$P=function(e,t){for(var n=[],r=e;re.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return!=null&&o.return()}finally{if(i)throw a}}return n}}function _F(e){if(Array.isArray(e))return e}function vF(e){var t=fF(e,2),n=t[0],r=t[1],i=n,a=r;return n>r&&(i=r,a=n),[i,a]}function yF(e,t,n){if(e.lte(0))return new iF.default(0);var r=sF.getDigitCount(e.toNumber()),i=new iF.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new iF.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?s:new iF.default(Math.ceil(s))}function bF(e,t,n){var r=1,i=new iF.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new iF.default(10).pow(sF.getDigitCount(e)-1),i=new iF.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new iF.default(Math.floor(e)))}else e===0?i=new iF.default(Math.floor((t-1)/2)):n||(i=new iF.default(Math.floor(e)));var o=Math.floor((t-1)/2);return tF(eF(function(e){return i.add(new iF.default(e-o).mul(r)).toNumber()}),$P)(0,t)}function xF(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new iF.default(0),tickMin:new iF.default(0),tickMax:new iF.default(0)};var a=yF(new iF.default(t).sub(e).div(n-1),r,i),o;e<=0&&t>=0?o=new iF.default(0):(o=new iF.default(e).add(t).div(2),o=o.sub(new iF.default(o).mod(a)));var s=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new iF.default(t).sub(o).div(a).toNumber()),l=s+c+1;return l>n?xF(e,t,n,r,i+1):(l0?c+(n-l):c,s=t>0?s:s+(n-l)),{step:a,tickMin:o.sub(new iF.default(s).mul(a)),tickMax:o.add(new iF.default(c).mul(a))})}function SF(e){var t=fF(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),s=fF(vF([n,r]),2),c=s[0],l=s[1];if(c===-1/0||l===1/0){var u=l===1/0?[c].concat(cF($P(0,i-1).map(function(){return 1/0}))):[].concat(cF($P(0,i-1).map(function(){return-1/0})),[l]);return n>r?nF(u):u}if(c===l)return bF(c,i,a);var d=xF(c,l,o,a),f=d.step,p=d.tickMin,m=d.tickMax,h=sF.rangeStep(p,m.add(new iF.default(.1).mul(f)),f);return n>r?nF(h):h}function CF(e,t){var n=fF(e,2),r=n[0],i=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=fF(vF([r,i]),2),s=o[0],c=o[1];if(s===-1/0||c===1/0)return[r,i];if(s===c)return[s];var l=Math.max(t,2),u=yF(new iF.default(c).sub(s).div(l-1),a,0),d=[].concat(cF(sF.rangeStep(new iF.default(s),new iF.default(c).sub(new iF.default(.99).mul(u)),u)),[c]);return r>i?nF(d):d}var wF=rF(SF),TF=rF(CF),EF=!0,DF=`Invariant failed`;function OF(e,t){if(!e){if(EF)throw Error(DF);var n=typeof t==`function`?t():t,r=n?`${DF}: ${n}`:DF;throw Error(r)}}var kF=[`offset`,`layout`,`width`,`dataKey`,`data`,`dataPointFormatter`,`xAxis`,`yAxis`];function AF(e){"@babel/helpers - typeof";return AF=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},AF(e)}function jF(){return jF=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function zF(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function BF(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function VF(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=-1,a=t?.length??0;if(a<=1)return 0;if(r&&r.axisType===`angleAxis`&&Math.abs(Math.abs(r.range[1]-r.range[0])-360)<=1e-6)for(var o=r.range,s=0;s0?n[s-1].coordinate:n[a-1].coordinate,l=n[s].coordinate,u=s>=a-1?n[0].coordinate:n[s+1].coordinate,d=void 0;if(Wb(l-c)!==Wb(u-l)){var f=[];if(Wb(u-l)===Wb(o[1]-o[0])){d=u;var p=l+o[1]-o[0];f[0]=Math.min(p,(p+c)/2),f[1]=Math.max(p,(p+c)/2)}else{d=c;var m=u+o[1]-o[0];f[0]=Math.min(l,(m+l)/2),f[1]=Math.max(l,(m+l)/2)}var h=[Math.min(l,(d+l)/2),Math.max(l,(d+l)/2)];if(e>h[0]&&e<=h[1]||e>=f[0]&&e<=f[1]){i=n[s].index;break}}else{var g=Math.min(c,u),_=Math.max(c,u);if(e>(g+l)/2&&e<=(_+l)/2){i=n[s].index;break}}}else for(var v=0;v0&&v(t[v].coordinate+t[v-1].coordinate)/2&&e<=(t[v].coordinate+t[v+1].coordinate)/2||v===a-1&&e>(t[v].coordinate+t[v-1].coordinate)/2){i=t[v].index;break}return i},EI=function(e){var t,n=e.type.displayName,r=(t=e.type)!=null&&t.defaultProps?yI(yI({},e.type.defaultProps),e.props):e.props,i=r.stroke,a=r.fill,o;switch(n){case`Line`:o=i;break;case`Area`:case`Radar`:o=i&&i!==`none`?i:a;break;default:o=a;break}return o},DI=function(e){var t=e.barSize,n=e.totalSize,r=e.stackGroups,i=r===void 0?{}:r;if(!i)return{};for(var a={},o=Object.keys(i),s=0,c=o.length;s=0});if(g&&g.length){var _=g[0].type.defaultProps,v=_===void 0?g[0].props:yI(yI({},_),g[0].props),y=v.barSize,b=v[h];a[b]||(a[b]=[]);var x=(0,J.default)(y)?t:y;a[b].push({item:g[0],stackList:g.slice(1),barSize:(0,J.default)(x)?void 0:Xb(x,n,0)})}}return a},OI=function(e){var t=e.barGap,n=e.barCategoryGap,r=e.bandSize,i=e.sizeList,a=i===void 0?[]:i,o=e.maxBarSize,s=a.length;if(s<1)return null;var c=Xb(t,r,0,!0),l,u=[];if(a[0].barSize===+a[0].barSize){var d=!1,f=r/s,p=a.reduce(function(e,t){return e+t.barSize||0},0);p+=(s-1)*c,p>=r&&(p-=(s-1)*c,c=0),p>=r&&f>0&&(d=!0,f*=.9,p=s*f);var m={offset:((r-p)/2>>0)-c,size:0};l=a.reduce(function(e,t){var n={item:t.item,position:{offset:m.offset+m.size+c,size:d?f:t.barSize}},r=[].concat(fI(e),[n]);return m=r[r.length-1].position,t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:m})}),r},u)}else{var h=Xb(n,r,0,!0);r-2*h-(s-1)*c<=0&&(c=0);var g=(r-2*h-(s-1)*c)/s;g>1&&(g>>=0);var _=o===+o?Math.min(g,o):g;l=a.reduce(function(e,t,n){var r=[].concat(fI(e),[{item:t.item,position:{offset:h+(g+c)*n+(g-_)/2,size:_}}]);return t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:r[r.length-1].position})}),r},u)}return l},kI=function(e,t,n,r){var i=n.children,a=n.width,o=n.margin,s=oI({children:i,legendWidth:a-(o.left||0)-(o.right||0)});if(s){var c=r||{},l=c.width,u=c.height,d=s.align,f=s.verticalAlign,p=s.layout;if((p===`vertical`||p===`horizontal`&&f===`middle`)&&d!==`center`&&Y(e[d]))return yI(yI({},e),{},bI({},d,e[d]+(l||0)));if((p===`horizontal`||p===`vertical`&&d===`center`)&&f!==`middle`&&Y(e[f]))return yI(yI({},e),{},bI({},f,e[f]+(u||0)))}return e},AI=function(e,t,n){return(0,J.default)(t)?!0:e===`horizontal`?t===`yAxis`:e===`vertical`||n===`x`?t===`xAxis`:n===`y`?t===`yAxis`:!0},jI=function(e,t,n,r,i){var a=t.props.children,o=Tx(a,$F).filter(function(e){return AI(r,i,e.props.direction)});if(o&&o.length){var s=o.map(function(e){return e.props.dataKey});return e.reduce(function(e,t){var r=CI(t,n);if((0,J.default)(r))return e;var i=Array.isArray(r)?[(0,cI.default)(r),(0,sI.default)(r)]:[r,r],a=s.reduce(function(e,n){var r=CI(t,n,0),a=i[0]-Math.abs(Array.isArray(r)?r[0]:r),o=i[1]+Math.abs(Array.isArray(r)?r[1]:r);return[Math.min(a,e[0]),Math.max(o,e[1])]},[1/0,-1/0]);return[Math.min(a[0],e[0]),Math.max(a[1],e[1])]},[1/0,-1/0])}return null},MI=function(e,t,n,r,i){var a=t.map(function(t){return jI(e,t,n,i,r)}).filter(function(e){return!(0,J.default)(e)});return a&&a.length?a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]):null},NI=function(e,t,n,r,i){var a=t.map(function(t){var a=t.props.dataKey;return n===`number`&&a&&jI(e,t,a,r)||wI(e,a,n,i)});if(n===`number`)return a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]);var o={};return a.reduce(function(e,t){for(var n=0,r=t.length;n=2?Wb(o[0]-o[1])*2*c:c,t&&(e.ticks||e.niceTicks)?(e.ticks||e.niceTicks).map(function(e){return{coordinate:r(i?i.indexOf(e):e)+c,value:e,offset:c}}).filter(function(e){return!(0,Vb.default)(e.coordinate)}):e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(e,t){return{coordinate:r(e)+c,value:e,index:t,offset:c}}):r.ticks&&!n?r.ticks(e.tickCount).map(function(e){return{coordinate:r(e)+c,value:e,offset:c}}):r.domain().map(function(e,t){return{coordinate:r(e)+c,value:i?i[e]:e,index:t,offset:c}})},LI=new WeakMap,RI=function(e,t){if(typeof t!=`function`)return e;LI.has(e)||LI.set(e,new WeakMap);var n=LI.get(e);if(n.has(t))return n.get(t);var r=function(){e.apply(void 0,arguments),t.apply(void 0,arguments)};return n.set(t,r),r},zI=function(e,t,n){var r=e.scale,i=e.type,a=e.layout,o=e.axisType;if(r===`auto`)return a===`radial`&&o===`radiusAxis`?{scale:jk(),realScaleType:`band`}:a===`radial`&&o===`angleAxis`?{scale:Sj(),realScaleType:`linear`}:i===`category`&&t&&(t.indexOf(`LineChart`)>=0||t.indexOf(`AreaChart`)>=0||t.indexOf(`ComposedChart`)>=0&&!n)?{scale:Nk(),realScaleType:`point`}:i===`category`?{scale:jk(),realScaleType:`band`}:{scale:Sj(),realScaleType:`linear`};if((0,Bb.default)(r)){var s=`scale${(0,DC.default)(r)}`;return{scale:(jP[s]||Nk)(),realScaleType:jP[s]?s:`point`}}return(0,X.default)(r)?{scale:r}:{scale:Nk(),realScaleType:`point`}},BI=1e-4,VI=function(e){var t=e.domain();if(!(!t||t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-BI,a=Math.max(r[0],r[1])+BI,o=e(t[0]),s=e(t[n-1]);(oa||sa)&&e.domain([t[0],t[n-1]])}},HI=function(e,t){if(!e)return null;for(var n=0,r=e.length;nr)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]=0?(e[o][n][0]=i,e[o][n][1]=i+s,i=e[o][n][1]):(e[o][n][0]=a,e[o][n][1]=a+s,a=e[o][n][1])}},expand:wC,none:yC,silhouette:TC,wiggle:EC,positive:function(e){var t=e.length;if(!(t<=0))for(var n=0,r=e[0].length;n=0?(e[a][n][0]=i,e[a][n][1]=i+o,i=e[a][n][1]):(e[a][n][0]=0,e[a][n][1]=0)}}},GI=function(e,t,n){var r=t.map(function(e){return e.props.dataKey}),i=WI[n];return CC().keys(r).value(function(e,t){return+CI(e,t,0)}).order(bC).offset(i)(e)},KI=function(e,t,n,r,i,a){if(!e)return null;var o=(a?t.reverse():t).reduce(function(e,t){var i,a=(i=t.type)!=null&&i.defaultProps?yI(yI({},t.type.defaultProps),t.props):t.props,o=a.stackId;if(a.hide)return e;var s=a[n],c=e[s]||{hasStack:!1,stackGroups:{}};if(qb(o)){var l=c.stackGroups[o]||{numericAxisId:n,cateAxisId:r,items:[]};l.items.push(t),c.hasStack=!0,c.stackGroups[o]=l}else c.stackGroups[Yb(`_stackId_`)]={numericAxisId:n,cateAxisId:r,items:[t]};return yI(yI({},e),{},bI({},s,c))},{});return Object.keys(o).reduce(function(t,a){var s=o[a];return s.hasStack&&(s.stackGroups=Object.keys(s.stackGroups).reduce(function(t,a){var o=s.stackGroups[a];return yI(yI({},t),{},bI({},a,{numericAxisId:n,cateAxisId:r,items:o.items,stackedData:GI(e,o.items,i)}))},{})),yI(yI({},t),{},bI({},a,s))},{})},qI=function(e,t){var n=t.realScaleType,r=t.type,i=t.tickCount,a=t.originalDomain,o=t.allowDecimals,s=n||t.scale;if(s!==`auto`&&s!==`linear`)return null;if(i&&r===`number`&&a&&(a[0]===`auto`||a[1]===`auto`)){var c=e.domain();if(!c.length)return null;var l=wF(c,i,o);return e.domain([(0,cI.default)(l),(0,sI.default)(l)]),{niceTicks:l}}return i&&r===`number`?{niceTicks:TF(e.domain(),i,o)}:null};function JI(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!(0,J.default)(i[t.dataKey])){var s=ex(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=CI(i,(0,J.default)(o)?t.dataKey:o);return(0,J.default)(c)?null:t.scale(c)}var YI=function(e){var t=e.axis,n=e.ticks,r=e.offset,i=e.bandSize,a=e.entry,o=e.index;if(t.type===`category`)return n[o]?n[o].coordinate+r:null;var s=CI(a,t.dataKey,t.domain[o]);return(0,J.default)(s)?null:t.scale(s)-i/2+r},XI=function(e){var t=e.numericAxis,n=t.scale.domain();if(t.type===`number`){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},ZI=function(e,t){var n,r=((n=e.type)!=null&&n.defaultProps?yI(yI({},e.type.defaultProps),e.props):e.props).stackId;if(qb(r)){var i=t[r];if(i){var a=i.items.indexOf(e);return a>=0?i.stackedData[a]:null}}return null},QI=function(e){return e.reduce(function(e,t){return[(0,cI.default)(t.concat([e[0]]).filter(Y)),(0,sI.default)(t.concat([e[1]]).filter(Y))]},[1/0,-1/0])},$I=function(e,t,n){return Object.keys(e).reduce(function(r,i){var a=e[i].stackedData.reduce(function(e,r){var i=QI(r.slice(t,n+1));return[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]).map(function(e){return e===1/0||e===-1/0?0:e})},eL=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,tL=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,nL=function(e,t,n){if((0,X.default)(e))return e(t,n);if(!Array.isArray(e))return t;var r=[];if(Y(e[0]))r[0]=n?e[0]:Math.min(e[0],t[0]);else if(eL.test(e[0])){var i=+eL.exec(e[0])[1];r[0]=t[0]-i}else (0,X.default)(e[0])?r[0]=e[0](t[0]):r[0]=t[0];if(Y(e[1]))r[1]=n?e[1]:Math.max(e[1],t[1]);else if(tL.test(e[1])){var a=+tL.exec(e[1])[1];r[1]=t[1]+a}else (0,X.default)(e[1])?r[1]=e[1](t[1]):r[1]=t[1];return r},rL=function(e,t,n){if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,vE.default)(t,function(e){return e.coordinate}),a=1/0,o=1,s=i.length;oe.length)&&(t=e.length);for(var n=0,r=Array(t);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2},SL=function(e,t,n,r,i){var a=e.width,o=e.height,s=e.startAngle,c=e.endAngle,l=Xb(e.cx,a,a/2),u=Xb(e.cy,o,o/2),d=xL(a,o,n),f=Xb(e.innerRadius,d,0),p=Xb(e.outerRadius,d,d*.8);return Object.keys(t).reduce(function(e,n){var a=t[n],o=a.domain,d=a.reversed,m;if((0,J.default)(a.range))r===`angleAxis`?m=[s,c]:r===`radiusAxis`&&(m=[f,p]),d&&(m=[m[1],m[0]]);else{m=a.range;var h=fL(m,2);s=h[0],c=h[1]}var g=zI(a,i),_=g.realScaleType,v=g.scale;v.domain(o).range(m),VI(v);var y=qI(v,cL(cL({},a),{},{realScaleType:_})),b=cL(cL(cL({},a),y),{},{range:m,radius:p,realScaleType:_,scale:v,cx:l,cy:u,innerRadius:f,outerRadius:p,startAngle:s,endAngle:c});return cL(cL({},e),{},lL({},n,b))},{})},CL=function(e,t){var n=e.x,r=e.y,i=t.x,a=t.y;return Math.sqrt((n-i)**2+(r-a)**2)},wL=function(e,t){var n=e.x,r=e.y,i=t.cx,a=t.cy,o=CL({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o};var s=(n-i)/o,c=Math.acos(s);return r>a&&(c=2*Math.PI-c),{radius:o,angle:yL(c),angleInRadian:c}},TL=function(e){var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},EL=function(e,t){var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),a=Math.floor(r/360);return e+Math.min(i,a)*360},DL=function(e,t){var n=e.x,r=e.y,i=wL({x:n,y:r},t),a=i.radius,o=i.angle,s=t.innerRadius,c=t.outerRadius;if(ac)return!1;if(a===0)return!0;var l=TL(t),u=l.startAngle,d=l.endAngle,f=o,p;if(u<=d){for(;f>d;)f-=360;for(;f=u&&f<=d}else{for(;f>u;)f-=360;for(;f=d&&f<=u}return p?cL(cL({},t),{},{radius:a,angle:EL(f,t)}):null},OL=function(e){return!(0,I.isValidElement)(e)&&!(0,X.default)(e)&&typeof e!=`boolean`?e.className:``};function kL(e){"@babel/helpers - typeof";return kL=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},kL(e)}var AL=[`offset`];function jL(e){return FL(e)||PL(e)||NL(e)||ML()}function ML(){throw TypeError(`Invalid attempt to spread non-iterable instance.
-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NL(e,t){if(e){if(typeof e==`string`)return IL(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return IL(e,t)}}function PL(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function FL(e){if(Array.isArray(e))return IL(e)}function IL(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function RL(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function zL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BL(e){for(var t=1;t=0?1:-1,v,y;r===`insideStart`?(v=f+_*a,y=m):r===`insideEnd`?(v=p-_*a,y=!m):r===`end`&&(v=p+_*a,y=m),y=g<=0?y:!y;var b=bL(c,l,h,v),x=bL(c,l,h,v+(y?1:-1)*359),S=`M${b.x},${b.y}
- A${h},${h},0,1,${+!y},
- ${x.x},${x.y}`,C=(0,J.default)(e.id)?Yb(`recharts-radial-line-`):e.id;return I.createElement(`text`,WL({},n,{dominantBaseline:`central`,className:z(`recharts-radial-bar-label`,o)}),I.createElement(`defs`,null,I.createElement(`path`,{id:C,d:S})),I.createElement(`textPath`,{xlinkHref:`#${C}`},t))},JL=function(e){var t=e.viewBox,n=e.offset,r=e.position,i=t,a=i.cx,o=i.cy,s=i.innerRadius,c=i.outerRadius,l=(i.startAngle+i.endAngle)/2;if(r===`outside`){var u=bL(a,o,c+n,l),d=u.x;return{x:d,y:u.y,textAnchor:d>=a?`start`:`end`,verticalAnchor:`middle`}}if(r===`center`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`middle`};if(r===`centerTop`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`start`};if(r===`centerBottom`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`end`};var f=bL(a,o,(s+c)/2,l);return{x:f.x,y:f.y,textAnchor:`middle`,verticalAnchor:`middle`}},YL=function(e){var t=e.viewBox,n=e.parentViewBox,r=e.offset,i=e.position,a=t,o=a.x,s=a.y,c=a.width,l=a.height,u=l>=0?1:-1,d=u*r,f=u>0?`end`:`start`,p=u>0?`start`:`end`,m=c>=0?1:-1,h=m*r,g=m>0?`end`:`start`,_=m>0?`start`:`end`;if(i===`top`)return BL(BL({},{x:o+c/2,y:s-u*r,textAnchor:`middle`,verticalAnchor:f}),n?{height:Math.max(s-n.y,0),width:c}:{});if(i===`bottom`)return BL(BL({},{x:o+c/2,y:s+l+d,textAnchor:`middle`,verticalAnchor:p}),n?{height:Math.max(n.y+n.height-(s+l),0),width:c}:{});if(i===`left`){var v={x:o-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`};return BL(BL({},v),n?{width:Math.max(v.x-n.x,0),height:l}:{})}if(i===`right`){var y={x:o+c+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`};return BL(BL({},y),n?{width:Math.max(n.x+n.width-y.x,0),height:l}:{})}var b=n?{width:c,height:l}:{};return i===`insideLeft`?BL({x:o+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`},b):i===`insideRight`?BL({x:o+c-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`},b):i===`insideTop`?BL({x:o+c/2,y:s+d,textAnchor:`middle`,verticalAnchor:p},b):i===`insideBottom`?BL({x:o+c/2,y:s+l-d,textAnchor:`middle`,verticalAnchor:f},b):i===`insideTopLeft`?BL({x:o+h,y:s+d,textAnchor:_,verticalAnchor:p},b):i===`insideTopRight`?BL({x:o+c-h,y:s+d,textAnchor:g,verticalAnchor:p},b):i===`insideBottomLeft`?BL({x:o+h,y:s+l-d,textAnchor:_,verticalAnchor:f},b):i===`insideBottomRight`?BL({x:o+c-h,y:s+l-d,textAnchor:g,verticalAnchor:f},b):(0,ix.default)(i)&&(Y(i.x)||Gb(i.x))&&(Y(i.y)||Gb(i.y))?BL({x:o+Xb(i.x,c),y:s+Xb(i.y,l),textAnchor:`end`,verticalAnchor:`end`},b):BL({x:o+c/2,y:s+l/2,textAnchor:`middle`,verticalAnchor:`middle`},b)},XL=function(e){return`cx`in e&&Y(e.cx)};function ZL(e){var t=e.offset,n=t===void 0?5:t,r=LL(e,AL),i=BL({offset:n},r),a=i.viewBox,o=i.position,s=i.value,c=i.children,l=i.content,u=i.className,d=u===void 0?``:u,f=i.textBreakAll;if(!a||(0,J.default)(s)&&(0,J.default)(c)&&!(0,I.isValidElement)(l)&&!(0,X.default)(l))return null;if((0,I.isValidElement)(l))return(0,I.cloneElement)(l,i);var p;if((0,X.default)(l)){if(p=(0,I.createElement)(l,i),(0,I.isValidElement)(p))return p}else p=GL(i);var m=XL(a),h=Z(i,!0);if(m&&(o===`insideStart`||o===`insideEnd`||o===`end`))return qL(i,p,h);var g=m?JL(i):YL(i);return I.createElement(ZO,WL({className:z(`recharts-label`,d)},h,g,{breakAll:f}),p)}ZL.displayName=`Label`;var QL=function(e){var t=e.cx,n=e.cy,r=e.angle,i=e.startAngle,a=e.endAngle,o=e.r,s=e.radius,c=e.innerRadius,l=e.outerRadius,u=e.x,d=e.y,f=e.top,p=e.left,m=e.width,h=e.height,g=e.clockWise,_=e.labelViewBox;if(_)return _;if(Y(m)&&Y(h)){if(Y(u)&&Y(d))return{x:u,y:d,width:m,height:h};if(Y(f)&&Y(p))return{x:f,y:p,width:m,height:h}}return Y(u)&&Y(d)?{x:u,y:d,width:0,height:0}:Y(t)&&Y(n)?{cx:t,cy:n,startAngle:i||r||0,endAngle:a||r||0,innerRadius:c||0,outerRadius:l||s||o||0,clockWise:g}:e.viewBox?e.viewBox:{}},$L=function(e,t){return e?e===!0?I.createElement(ZL,{key:`label-implicit`,viewBox:t}):qb(e)?I.createElement(ZL,{key:`label-implicit`,viewBox:t,value:e}):(0,I.isValidElement)(e)?e.type===ZL?(0,I.cloneElement)(e,{key:`label-implicit`,viewBox:t}):I.createElement(ZL,{key:`label-implicit`,content:e,viewBox:t}):(0,X.default)(e)?I.createElement(ZL,{key:`label-implicit`,content:e,viewBox:t}):(0,ix.default)(e)?I.createElement(ZL,WL({viewBox:t},e,{key:`label-implicit`})):null:null};ZL.parseViewBox=QL,ZL.renderCallByParent=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=QL(e),a=Tx(r,ZL).map(function(e,n){return(0,I.cloneElement)(e,{viewBox:t||i,key:`label-${n}`})});return n?[$L(e.label,t||i)].concat(jL(a)):a};var eR=l(o(((e,t)=>{function n(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}t.exports=n}))());function tR(e){"@babel/helpers - typeof";return tR=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},tR(e)}var nR=[`valueAccessor`],rR=[`data`,`dataKey`,`clockWise`,`id`,`textBreakAll`];function iR(e){return cR(e)||sR(e)||oR(e)||aR()}function aR(){throw TypeError(`Invalid attempt to spread non-iterable instance.
-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oR(e,t){if(e){if(typeof e==`string`)return lR(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lR(e,t)}}function sR(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function cR(e){if(Array.isArray(e))return lR(e)}function lR(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _R(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var vR=function(e){return Array.isArray(e.value)?(0,eR.default)(e.value):e.value};function yR(e){var t=e.valueAccessor,n=t===void 0?vR:t,r=gR(e,nR),i=r.data,a=r.dataKey,o=r.clockWise,s=r.id,c=r.textBreakAll,l=gR(r,rR);return!i||!i.length?null:I.createElement(Kx,{className:`recharts-label-list`},i.map(function(e,t){var r=(0,J.default)(a)?n(e,t):CI(e&&e.payload,a),i=(0,J.default)(s)?{}:{id:`${s}-${t}`};return I.createElement(ZL,uR({},Z(e,!0),l,i,{parentViewBox:e.parentViewBox,value:r,textBreakAll:c,viewBox:ZL.parseViewBox((0,J.default)(o)?e:fR(fR({},e),{},{clockWise:o})),key:`label-${t}`,index:t}))}))}yR.displayName=`LabelList`;function bR(e,t){return e?e===!0?I.createElement(yR,{key:`labelList-implicit`,data:t}):I.isValidElement(e)||(0,X.default)(e)?I.createElement(yR,{key:`labelList-implicit`,data:t,content:e}):(0,ix.default)(e)?I.createElement(yR,uR({data:t},e,{key:`labelList-implicit`})):null:null}function xR(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=Tx(r,yR).map(function(e,n){return(0,I.cloneElement)(e,{data:t,key:`labelList-${n}`})});return n?[bR(e.label,t)].concat(iR(i)):i}yR.renderCallByParent=xR;function SR(e){"@babel/helpers - typeof";return SR=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},SR(e)}function CR(){return CR=Object.assign?Object.assign.bind():function(e){for(var t=1;t180)},${+(a>c)},
- ${u.x},${u.y}
- `;if(r>0){var f=bL(t,n,r,a),p=bL(t,n,r,c);d+=`L ${p.x},${p.y}
- A ${r},${r},0,
- ${+(Math.abs(s)>180)},${+(a<=c)},
- ${f.x},${f.y} Z`}else d+=`L ${t},${n} Z`;return d},MR=function(e){var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.cornerRadius,o=e.forceCornerRadius,s=e.cornerIsExternal,c=e.startAngle,l=e.endAngle,u=Wb(l-c),d=AR({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),f=d.circleTangency,p=d.lineTangency,m=d.theta,h=AR({cx:t,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),g=h.circleTangency,_=h.lineTangency,v=h.theta,y=s?Math.abs(c-l):Math.abs(c-l)-m-v;if(y<0)return o?`M ${p.x},${p.y}
- a${a},${a},0,0,1,${a*2},0
- a${a},${a},0,0,1,${-a*2},0
- `:jR({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var b=`M ${p.x},${p.y}
- A${a},${a},0,0,${+(u<0)},${f.x},${f.y}
- A${i},${i},0,${+(y>180)},${+(u<0)},${g.x},${g.y}
- A${a},${a},0,0,${+(u<0)},${_.x},${_.y}
- `;if(r>0){var x=AR({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),S=x.circleTangency,C=x.lineTangency,w=x.theta,T=AR({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),E=T.circleTangency,D=T.lineTangency,O=T.theta,k=s?Math.abs(c-l):Math.abs(c-l)-w-O;if(k<0&&a===0)return`${b}L${t},${n}Z`;b+=`L${D.x},${D.y}
- A${a},${a},0,0,${+(u<0)},${E.x},${E.y}
- A${r},${r},0,${+(k>180)},${+(u>0)},${S.x},${S.y}
- A${a},${a},0,0,${+(u<0)},${C.x},${C.y}Z`}else b+=`L${t},${n}Z`;return b},NR={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},PR=function(e){var t=TR(TR({},NR),e),n=t.cx,r=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,s=t.forceCornerRadius,c=t.cornerIsExternal,l=t.startAngle,u=t.endAngle,d=t.className;if(a0&&Math.abs(l-u)<360?MR({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u}):jR({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:l,endAngle:u});return I.createElement(`path`,CR({},Z(t,!0),{className:f,d:h,role:`img`}))};function FR(e){"@babel/helpers - typeof";return FR=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},FR(e)}function IR(){return IR=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),XR=o(((e,t)=>{var n=YR();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),ZR=o(((e,t)=>{t.exports=XR()()})),{getOwnPropertyNames:QR,getOwnPropertySymbols:$R}=Object,{hasOwnProperty:ez}=Object.prototype;function tz(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function nz(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function rz(e){return e?.[Symbol.toStringTag]}function iz(e){return QR(e).concat($R(e))}var az=Object.hasOwn||((e,t)=>ez.call(e,t));function oz(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var sz=`__v`,cz=`__o`,lz=`_owner`,{getOwnPropertyDescriptor:uz,keys:dz}=Object;function fz(e,t){return e.byteLength===t.byteLength&&Tz(new Uint8Array(e),new Uint8Array(t))}function pz(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function mz(e,t){return e.byteLength===t.byteLength&&Tz(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function hz(e,t){return oz(e.getTime(),t.getTime())}function gz(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function _z(e,t){return e===t}function vz(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var yz=oz;function bz(e,t,n){let r=dz(e),i=r.length;if(dz(t).length!==i)return!1;for(;i-- >0;)if(!Dz(e,t,n,r[i]))return!1;return!0}function xz(e,t,n){let r=iz(e),i=r.length;if(iz(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!Dz(e,t,n,a)||(o=uz(e,a),s=uz(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Sz(e,t){return oz(e.valueOf(),t.valueOf())}function Cz(e,t){return e.source===t.source&&e.flags===t.flags}function wz(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function Tz(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Ez(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Dz(e,t,n,r){return(r===lz||r===cz||r===sz)&&(e.$$typeof||t.$$typeof)?!0:az(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var Oz=`[object ArrayBuffer]`,kz=`[object Arguments]`,Az=`[object Boolean]`,jz=`[object DataView]`,Mz=`[object Date]`,Nz=`[object Error]`,Pz=`[object Map]`,Fz=`[object Number]`,Iz=`[object Object]`,Lz=`[object RegExp]`,Rz=`[object Set]`,zz=`[object String]`,Bz={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Vz=`[object URL]`,Hz=Object.prototype.toString;function Uz({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=Hz.call(h);if(b===Mz)return r(h,g,_);if(b===Lz)return u(h,g,_);if(b===Pz)return o(h,g,_);if(b===Rz)return d(h,g,_);if(b===Iz)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===Vz)return p(h,g,_);if(b===Nz)return i(h,g,_);if(b===kz)return c(h,g,_);if(Bz[b])return f(h,g,_);if(b===Oz)return e(h,g,_);if(b===jz)return n(h,g,_);if(b===Az||b===Fz||b===zz)return l(h,g,_);if(m){let e=m[b];if(!e){let t=rz(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function Wz({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:fz,areArraysEqual:n?xz:pz,areDataViewsEqual:mz,areDatesEqual:hz,areErrorsEqual:gz,areFunctionsEqual:_z,areMapsEqual:n?tz(vz,xz):vz,areNumbersEqual:yz,areObjectsEqual:n?xz:bz,arePrimitiveWrappersEqual:Sz,areRegExpsEqual:Cz,areSetsEqual:n?tz(wz,xz):wz,areTypedArraysEqual:n?tz(Tz,xz):Tz,areUrlsEqual:Ez,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=nz(r.areArraysEqual),t=nz(r.areMapsEqual),n=nz(r.areObjectsEqual),i=nz(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function Gz(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function Kz({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var qz=Jz();Jz({strict:!0}),Jz({circular:!0}),Jz({circular:!0,strict:!0}),Jz({createInternalComparator:()=>oz}),Jz({strict:!0,createInternalComparator:()=>oz}),Jz({circular:!0,createInternalComparator:()=>oz}),Jz({circular:!0,createInternalComparator:()=>oz,strict:!0});function Jz(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=Uz(Wz(e));return Kz({circular:t,comparator:a,createState:r,equals:n?n(a):Gz(a),strict:i})}function Yz(e){typeof requestAnimationFrame<`u`&&requestAnimationFrame(e)}function Xz(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1;requestAnimationFrame(function r(i){n<0&&(n=i),i-n>t?(e(i),n=-1):Yz(r)})}function Zz(e){"@babel/helpers - typeof";return Zz=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Zz(e)}function Qz(e){return rB(e)||nB(e)||eB(e)||$z()}function $z(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eB(e,t){if(e){if(typeof e==`string`)return tB(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tB(e,t)}}function tB(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);n=0&&e<=1}),`[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s`,e);var s=jB(t,r),c=jB(n,i),l=MB(t,r),u=function(e){return e>1?1:e<0?0:e},d=function(e){for(var t=e>1?1:e,n=t,r=0;r<8;++r){var i=s(n)-t,a=l(n);if(Math.abs(i-t)0&&arguments[0]!==void 0?arguments[0]:{},t=e.stiff,n=t===void 0?100:t,r=e.damping,i=r===void 0?8:r,a=e.dt,o=a===void 0?17:a,s=function(e,t,r){var a=r+(-(e-t)*n-r*i)*o/1e3,s=r*o/1e3+e;return Math.abs(s-t)e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oV(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a=0)&&(n[i]=e[i]);return n}function sV(e){return dV(e)||uV(e)||lV(e)||cV()}function cV(){throw TypeError(`Invalid attempt to spread non-iterable instance.
-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lV(e,t){if(e){if(typeof e==`string`)return fV(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fV(e,t)}}function uV(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function dV(e){if(Array.isArray(e))return fV(e)}function fV(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function DV(e){return DV=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},DV(e)}var OV=function(e){xV(n,e);var t=CV(n);function n(e,r){var i;gV(this,n),i=t.call(this,e,r);var a=i.props,o=a.isActive,s=a.attributeName,c=a.from,l=a.to,u=a.steps,d=a.children,f=a.duration;if(i.handleStyleChange=i.handleStyleChange.bind(TV(i)),i.changeStyle=i.changeStyle.bind(TV(i)),!o||f<=0)return i.state={style:{}},typeof d==`function`&&(i.state={style:l}),wV(i);if(u&&u.length)i.state={style:u[0].style};else if(c){if(typeof d==`function`)return i.state={style:c},wV(i);i.state={style:s?hV({},s,c):c}}else i.state={style:{}};return i}return vV(n,[{key:`componentDidMount`,value:function(){var e=this.props,t=e.isActive,n=e.canBegin;this.mounted=!0,!(!t||!n)&&this.runAnimation(this.props)}},{key:`componentDidUpdate`,value:function(e){var t=this.props,n=t.isActive,r=t.canBegin,i=t.attributeName,a=t.shouldReAnimate,o=t.to,s=t.from,c=this.state.style;if(r){if(!n){var l={style:i?hV({},i,o):o};this.state&&c&&(i&&c[i]!==o||!i&&c!==o)&&this.setState(l);return}if(!(qz(e.to,o)&&e.canBegin&&e.isActive)){var u=!e.canBegin||!e.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var d=u||a?s:e.to;if(this.state&&c){var f={style:i?hV({},i,d):d};(i&&c[i]!==d||!i&&c!==d)&&this.setState(f)}this.runAnimation(mV(mV({},this.props),{},{from:d,begin:0}))}}}},{key:`componentWillUnmount`,value:function(){this.mounted=!1;var e=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&=(this.manager.stop(),null),this.stopJSAnimation&&this.stopJSAnimation(),e&&e()}},{key:`handleStyleChange`,value:function(e){this.changeStyle(e)}},{key:`changeStyle`,value:function(e){this.mounted&&this.setState({style:e})}},{key:`runJSAnimation`,value:function(e){var t=this,n=e.from,r=e.to,i=e.duration,a=e.easing,o=e.begin,s=e.onAnimationEnd,c=e.onAnimationStart,l=tV(n,r,FB(a),i,this.changeStyle);this.manager.start([c,o,function(){t.stopJSAnimation=l()},i,s])}},{key:`runStepAnimation`,value:function(e){var t=this,n=e.steps,r=e.begin,i=e.onAnimationStart,a=n[0],o=a.style,s=a.duration,c=s===void 0?0:s;return this.manager.start([i].concat(sV(n.reduce(function(e,r,i){if(i===0)return e;var a=r.duration,o=r.easing,s=o===void 0?`ease`:o,c=r.style,l=r.properties,u=r.onAnimationEnd,d=i>0?n[i-1]:r,f=l||Object.keys(c);if(typeof s==`function`||s===`spring`)return[].concat(sV(e),[t.runJSAnimation.bind(t,{from:d.style,to:c,duration:a,easing:s}),a]);var p=hB(f,a,s),m=mV(mV(mV({},d.style),c),{},{transition:p});return[].concat(sV(e),[m,a,u]).filter(fB)},[o,Math.max(c,r)])),[e.onAnimationEnd]))}},{key:`runAnimation`,value:function(e){this.manager||=iB();var t=e.begin,n=e.duration,r=e.attributeName,i=e.to,a=e.easing,o=e.onAnimationStart,s=e.onAnimationEnd,c=e.steps,l=e.children,u=this.manager;if(this.unSubscribe=u.subscribe(this.handleStyleChange),typeof a==`function`||typeof l==`function`||a===`spring`){this.runJSAnimation(e);return}if(c.length>1){this.runStepAnimation(e);return}var d=r?hV({},r,i):i,f=hB(Object.keys(d),n,a);u.start([o,t,mV(mV({},d),{},{transition:f}),n,s])}},{key:`render`,value:function(){var e=this.props,t=e.children;e.begin;var n=e.duration;e.attributeName,e.easing;var r=e.isActive;e.steps,e.from,e.to,e.canBegin,e.onAnimationEnd,e.shouldReAnimate,e.onAnimationReStart;var i=aV(e,iV),a=I.Children.count(t),o=this.state.style;if(typeof t==`function`)return t(o);if(!r||a===0||n<=0)return t;var s=function(e){var t=e.props,n=t.style,r=n===void 0?{}:n,a=t.className;return(0,I.cloneElement)(e,mV(mV({},i),{},{style:mV(mV({},r),o),className:a}))};return a===1?s(I.Children.only(t)):I.createElement(`div`,null,I.Children.map(t,function(e){return s(e)}))}}]),n}(I.PureComponent);OV.displayName=`Animate`,OV.defaultProps={begin:0,duration:1e3,from:``,to:``,attributeName:``,easing:`ease`,isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}},OV.propTypes={from:nV.default.oneOfType([nV.default.object,nV.default.string]),to:nV.default.oneOfType([nV.default.object,nV.default.string]),attributeName:nV.default.string,duration:nV.default.number,begin:nV.default.number,easing:nV.default.oneOfType([nV.default.string,nV.default.func]),steps:nV.default.arrayOf(nV.default.shape({duration:nV.default.number.isRequired,style:nV.default.object.isRequired,easing:nV.default.oneOfType([nV.default.oneOf([`ease`,`ease-in`,`ease-out`,`ease-in-out`,`linear`]),nV.default.func]),properties:nV.default.arrayOf(`string`),onAnimationEnd:nV.default.func})),children:nV.default.oneOfType([nV.default.node,nV.default.func]),isActive:nV.default.bool,canBegin:nV.default.bool,onAnimationEnd:nV.default.func,shouldReAnimate:nV.default.bool,onAnimationStart:nV.default.func,onAnimationReStart:nV.default.func};var kV=OV;function AV(e){"@babel/helpers - typeof";return AV=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},AV(e)}function jV(){return jV=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0?1:-1,s=n>=0?1:-1,c=+(r>=0&&n>=0||r<0&&n<0),l;if(a>0&&i instanceof Array){for(var u=[0,0,0,0],d=0,f=4;da?a:i[d];l=`M${e},${t+o*u[0]}`,u[0]>0&&(l+=`A ${u[0]},${u[0]},0,0,${c},${e+s*u[0]},${t}`),l+=`L ${e+n-s*u[1]},${t}`,u[1]>0&&(l+=`A ${u[1]},${u[1]},0,0,${c},
- ${e+n},${t+o*u[1]}`),l+=`L ${e+n},${t+r-o*u[2]}`,u[2]>0&&(l+=`A ${u[2]},${u[2]},0,0,${c},
- ${e+n-s*u[2]},${t+r}`),l+=`L ${e+s*u[3]},${t+r}`,u[3]>0&&(l+=`A ${u[3]},${u[3]},0,0,${c},
- ${e},${t+r-o*u[3]}`),l+=`Z`}else if(a>0&&i===+i&&i>0){var p=Math.min(a,i);l=`M ${e},${t+o*p}
- A ${p},${p},0,0,${c},${e+s*p},${t}
- L ${e+n-s*p},${t}
- A ${p},${p},0,0,${c},${e+n},${t+o*p}
- L ${e+n},${t+r-o*p}
- A ${p},${p},0,0,${c},${e+n-s*p},${t+r}
- L ${e+s*p},${t+r}
- A ${p},${p},0,0,${c},${e},${t+r-o*p} Z`}else l=`M ${e},${t} h ${n} v ${r} h ${-n} Z`;return l},WV=function(e,t){if(!e||!t)return!1;var n=e.x,r=e.y,i=t.x,a=t.y,o=t.width,s=t.height;if(Math.abs(o)>0&&Math.abs(s)>0){var c=Math.min(i,i+o),l=Math.max(i,i+o),u=Math.min(a,a+s),d=Math.max(a,a+s);return n>=c&&n<=l&&r>=u&&r<=d}return!1},GV={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},KV=function(e){var t=zV(zV({},GV),e),n=(0,I.useRef)(),r=MV((0,I.useState)(-1),2),i=r[0],a=r[1];(0,I.useEffect)(function(){if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&a(e)}catch{}},[]);var o=t.x,s=t.y,c=t.width,l=t.height,u=t.radius,d=t.className,f=t.animationEasing,p=t.animationDuration,m=t.animationBegin,h=t.isAnimationActive,g=t.isUpdateAnimationActive;if(o!==+o||s!==+s||c!==+c||l!==+l||c===0||l===0)return null;var _=z(`recharts-rectangle`,d);return g?I.createElement(kV,{canBegin:i>0,from:{width:c,height:l,x:o,y:s},to:{width:c,height:l,x:o,y:s},duration:p,animationEasing:f,isActive:g},function(e){var r=e.width,a=e.height,o=e.x,s=e.y;return I.createElement(kV,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,isActive:h,easing:f},I.createElement(`path`,jV({},Z(t,!0),{className:_,d:UV(o,s,r,a,u),ref:n})))}):I.createElement(`path`,jV({},Z(t,!0),{className:_,d:UV(o,s,c,l,u)}))},qV=[`points`,`className`,`baseLinePoints`,`connectNulls`];function JV(){return JV=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function XV(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ZV(e){return tH(e)||eH(e)||$V(e)||QV()}function QV(){throw TypeError(`Invalid attempt to spread non-iterable instance.
-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $V(e,t){if(e){if(typeof e==`string`)return nH(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nH(e,t)}}function eH(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function tH(e){if(Array.isArray(e))return nH(e)}function nH(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&arguments[0]!==void 0?arguments[0]:[],t=[[]];return e.forEach(function(e){rH(e)?t[t.length-1].push(e):t[t.length-1].length>0&&t.push([])}),rH(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t},aH=function(e,t){var n=iH(e);t&&(n=[n.reduce(function(e,t){return[].concat(ZV(e),ZV(t))},[])]);var r=n.map(function(e){return e.reduce(function(e,t,n){return`${e}${n===0?`M`:`L`}${t.x},${t.y}`},``)}).join(``);return n.length===1?`${r}Z`:r},oH=function(e,t,n){var r=aH(e,n);return`${r.slice(-1)===`Z`?r.slice(0,-1):r}L${aH(t.reverse(),n).slice(1)}`},sH=function(e){var t=e.points,n=e.className,r=e.baseLinePoints,i=e.connectNulls,a=YV(e,qV);if(!t||!t.length)return null;var o=z(`recharts-polygon`,n);if(r&&r.length){var s=a.stroke&&a.stroke!==`none`,c=oH(t,r,i);return I.createElement(`g`,{className:o},I.createElement(`path`,JV({},Z(a,!0),{fill:c.slice(-1)===`Z`?a.fill:`none`,stroke:`none`,d:c})),s?I.createElement(`path`,JV({},Z(a,!0),{fill:`none`,d:aH(t,i)})):null,s?I.createElement(`path`,JV({},Z(a,!0),{fill:`none`,d:aH(r,i)})):null)}var l=aH(t,i);return I.createElement(`path`,JV({},Z(a,!0),{fill:l.slice(-1)===`Z`?a.fill:`none`,className:o,d:l}))};function cH(){return cH=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function yH(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var bH=function(e,t,n,r,i,a){return`M${e},${i}v${r}M${a},${t}h${n}`},xH=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.top,o=a===void 0?0:a,s=e.left,c=s===void 0?0:s,l=e.width,u=l===void 0?0:l,d=e.height,f=d===void 0?0:d,p=e.className,m=vH(e,dH),h=mH({x:n,y:i,top:o,left:c,width:u,height:f},m);return!Y(n)||!Y(i)||!Y(u)||!Y(f)||!Y(o)||!Y(c)?null:I.createElement(`path`,fH({},Z(h,!0),{className:z(`recharts-cross`,p),d:bH(n,i,u,f,o,c)}))},SH=[`cx`,`cy`,`innerRadius`,`outerRadius`,`gridType`,`radialLines`];function CH(e){"@babel/helpers - typeof";return CH=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},CH(e)}function wH(e,t){if(e==null)return{};var n=TH(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function TH(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function EH(){return EH=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=MP(),r=NP(),i=gT();function a(e,t){return e&&e.length?n(e,i(t,2),r):void 0}t.exports=a})),zH=o(((e,t)=>{var n=MP(),r=gT(),i=FP();function a(e,t){return e&&e.length?n(e,r(t,2),i):void 0}t.exports=a})),BH=l(RH()),VH=l(zH()),HH=[`cx`,`cy`,`angle`,`ticks`,`axisLine`],UH=[`ticks`,`tick`,`angle`,`tickFormatter`,`stroke`];function WH(e){"@babel/helpers - typeof";return WH=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},WH(e)}function GH(){return GH=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function YH(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function XH(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function ZH(e,t){for(var n=0;nOU?t===`outer`?`start`:`end`:n<-OU?t===`outer`?`end`:`start`:`middle`}},{key:`renderAxisLine`,value:function(){var e=this.props,t=e.cx,n=e.cy,r=e.radius,i=e.axisLine,a=e.axisLineType,o=pU(pU({},Z(this.props,!1)),{},{fill:`none`},Z(i,!1));if(a===`circle`)return I.createElement(lH,dU({className:`recharts-polar-angle-axis-line`},o,{cx:t,cy:n,r}));var s=this.props.ticks.map(function(e){return bL(t,n,r,e.coordinate)});return I.createElement(sH,dU({className:`recharts-polar-angle-axis-line`},o,{points:s}))}},{key:`renderTicks`,value:function(){var e=this,n=this.props,r=n.ticks,i=n.tick,a=n.tickLine,o=n.tickFormatter,s=n.stroke,c=Z(this.props,!1),l=Z(i,!1),u=pU(pU({},c),{},{fill:`none`},Z(a,!1)),d=r.map(function(n,r){var d=e.getTickLineCoord(n),f=pU(pU(pU({textAnchor:e.getTickTextAnchor(n)},c),{},{stroke:`none`,fill:s},l),{},{index:r,payload:n,x:d.x2,y:d.y2});return I.createElement(Kx,dU({className:z(`recharts-polar-angle-axis-tick`,OL(i)),key:`tick-${n.coordinate}`},px(e.props,n,r)),a&&I.createElement(`line`,dU({className:`recharts-polar-angle-axis-tick-line`},u,d)),i&&t.renderTickItem(i,f,o?o(n.value,r):n.value))});return I.createElement(Kx,{className:`recharts-polar-angle-axis-ticks`},d)}},{key:`render`,value:function(){var e=this.props,t=e.ticks,n=e.radius,r=e.axisLine;return n<=0||!t||!t.length?null:I.createElement(Kx,{className:z(`recharts-polar-angle-axis`,this.props.className)},r&&this.renderAxisLine(),this.renderTicks())}}],[{key:`renderTickItem`,value:function(e,t,n){return I.isValidElement(e)?I.cloneElement(e,t):(0,X.default)(e)?e(t):I.createElement(ZO,dU({},t,{className:`recharts-polar-angle-axis-tick-value`}),n)}}])}(I.PureComponent);wU(kU,`displayName`,`PolarAngleAxis`),wU(kU,`axisType`,`angleAxis`),wU(kU,`defaultProps`,{type:`category`,angleAxisId:0,scale:`auto`,cx:0,cy:0,orientation:`outer`,axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var AU=o(((e,t)=>{t.exports=Uw()(Object.getPrototypeOf,Object)})),jU=o(((e,t)=>{var n=Hy(),r=AU(),i=Uy(),a=`[object Object]`,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=c.call(Object);function d(e){if(!i(e)||n(e)!=a)return!1;var t=r(e);if(t===null)return!0;var o=l.call(t,`constructor`)&&t.constructor;return typeof o==`function`&&o instanceof o&&c.call(o)==u}t.exports=d})),MU=o(((e,t)=>{var n=Hy(),r=Uy(),i=`[object Boolean]`;function a(e){return e===!0||e===!1||r(e)&&n(e)==i}t.exports=a}));function NU(e){"@babel/helpers - typeof";return NU=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},NU(e)}function PU(){return PU=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:u,x:o,y:s},to:{upperWidth:c,lowerWidth:l,height:u,x:o,y:s},duration:p,animationEasing:f,isActive:h},function(e){var r=e.upperWidth,a=e.lowerWidth,o=e.height,s=e.x,c=e.y;return I.createElement(kV,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,easing:f},I.createElement(`path`,PU({},Z(t,!0),{className:g,d:KU(s,c,r,a,o),ref:n})))}):I.createElement(`g`,null,I.createElement(`path`,PU({},Z(t,!0),{className:g,d:KU(o,s,c,l,u)})))},YU=l(jU()),XU=l(MU()),ZU=[`option`,`shapeType`,`propTransformer`,`activeClassName`,`isActive`];function QU(e){"@babel/helpers - typeof";return QU=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},QU(e)}function $U(e,t){if(e==null)return{};var n=eW(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function eW(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function tW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nW(e){for(var t=1;t0?(0,Hb.default)(e,`paddingAngle`,0):0;if(n){var s=$b(n.endAngle-n.startAngle,e.endAngle-e.startAngle),c=TW(TW({},e),{},{startAngle:a+o,endAngle:a+s(r)+o});i.push(c),a=c.endAngle}else{var u=e.endAngle,d=e.startAngle,f=$b(0,u-d)(r),p=TW(TW({},e),{},{startAngle:a+o,endAngle:a+f+o});i.push(p),a=p.endAngle}}),I.createElement(Kx,null,e.renderSectorsStatically(i))})}},{key:`attachKeyboardHandlers`,value:function(e){var t=this;e.onkeydown=function(e){if(!e.altKey)switch(e.key){case`ArrowLeft`:var n=++t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[n].focus(),t.setState({sectorToFocus:n});break;case`ArrowRight`:var r=--t.state.sectorToFocus<0?t.sectorRefs.length-1:t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[r].focus(),t.setState({sectorToFocus:r});break;case`Escape`:t.sectorRefs[t.state.sectorToFocus].blur(),t.setState({sectorToFocus:0});break;default:}}}},{key:`renderSectors`,value:function(){var e=this.props,t=e.sectors,n=e.isAnimationActive,r=this.state.prevSectors;return n&&t&&t.length&&(!r||!(0,uI.default)(r,t))?this.renderSectorsWithAnimation():this.renderSectorsStatically(t)}},{key:`componentDidMount`,value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.hide,r=t.sectors,i=t.className,a=t.label,o=t.cx,s=t.cy,c=t.innerRadius,l=t.outerRadius,u=t.isAnimationActive,d=this.state.isAnimationFinished;if(n||!r||!r.length||!Y(o)||!Y(s)||!Y(c)||!Y(l))return null;var f=z(`recharts-pie`,i);return I.createElement(Kx,{tabIndex:this.props.rootTabIndex,className:f,ref:function(t){e.pieRef=t}},this.renderSectors(),a&&this.renderLabels(r),ZL.renderCallByParent(this.props,null,!1),(!u||d)&&yR.renderCallByParent(this.props,r,!1))}}],[{key:`getDerivedStateFromProps`,value:function(e,t){return t.prevIsAnimationActive===e.isAnimationActive?e.isAnimationActive&&e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:t.curSectors,isAnimationFinished:!0}:e.sectors===t.curSectors?null:{curSectors:e.sectors,isAnimationFinished:!0}:{prevIsAnimationActive:e.isAnimationActive,prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:[],isAnimationFinished:!0}}},{key:`getTextAnchor`,value:function(e,t){return e>t?`start`:e=360?v:v-1)*c,b=g-v*p-y,x=i.reduce(function(e,t){var n=CI(t,_,0);return e+(Y(n)?n:0)},0),S;if(x>0){var C;S=i.map(function(e,t){var n=CI(e,_,0),r=CI(e,u,t),i=(Y(n)?n:0)/x,s=t?C.endAngle+Wb(h)*c*(n===0?0:1):o,l=s+Wb(h)*((n===0?0:p)+i*b),d=(s+l)/2,g=(m.innerRadius+m.outerRadius)/2;return C=TW(TW(TW({percent:i,cornerRadius:a,name:r,tooltipPayload:[{name:r,value:n,payload:e,dataKey:_,type:f}],midAngle:d,middleRadius:g,tooltipPosition:bL(m.cx,m.cy,g,d)},e),m),{},{value:CI(e,_),startAngle:s,endAngle:l,payload:e,paddingAngle:Wb(h)*c}),C})}return TW(TW({},m),{},{sectors:S,data:i})});var BW=o(((e,t)=>{function n(e){return e&&e.length?e[0]:void 0}t.exports=n})),VW=l(o(((e,t)=>{t.exports=BW()}))()),HW=[`key`];function UW(e){"@babel/helpers - typeof";return UW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},UW(e)}function WW(e,t){if(e==null)return{};var n=GW(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function GW(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function KW(){return KW=Object.assign?Object.assign.bind():function(e){for(var t=1;t=2&&(c=!0),l.push(JW(JW({},bL(o,s,m,f)),{},{name:a,value:d,cx:o,cy:s,radius:m,angle:f,payload:e}))});var d=[];return c&&l.forEach(function(e){if(Array.isArray(e.value)){var n=(0,VW.default)(e.value),r=(0,J.default)(n)?void 0:t.scale(n);d.push(JW(JW({},e),{},{radius:r},bL(o,s,r,e.angle)))}else d.push(e)}),{points:l,isRange:c,baseLinePoints:d}});var lG=o(((e,t)=>{var n=Math.ceil,r=Math.max;function i(e,t,i,a){for(var o=-1,s=r(n((t-e)/(i||1)),0),c=Array(s);s--;)c[a?s:++o]=e,e+=i;return c}t.exports=i})),uG=o(((e,t)=>{var n=jD(),r=1/0,i=17976931348623157e292;function a(e){return e?(e=n(e),e===r||e===-r?(e<0?-1:1)*i:e===e?e:0):e===0?e:0}t.exports=a})),dG=o(((e,t)=>{var n=lG(),r=_E(),i=uG();function a(e){return function(t,a,o){return o&&typeof o!=`number`&&r(t,a,o)&&(a=o=void 0),t=i(t),a===void 0?(a=t,t=0):a=i(a),o=o===void 0?t{t.exports=dG()()}));function pG(e){"@babel/helpers - typeof";return pG=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},pG(e)}function mG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function hG(e){for(var t=1;t0&&n.handleDrag(e.changedTouches[0])}),IG(n,`handleDragEnd`,function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var e=n.props,t=e.endIndex,r=e.onDragEnd,i=e.startIndex;r?.({endIndex:t,startIndex:i})}),n.detachDragEndListener()}),IG(n,`handleLeaveWrapper`,function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),IG(n,`handleEnterSlideOrTraveller`,function(){n.setState({isTextActive:!0})}),IG(n,`handleLeaveSlideOrTraveller`,function(){n.setState({isTextActive:!1})}),IG(n,`handleSlideDragStart`,function(e){var t=BG(e)?e.changedTouches[0]:e;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:t.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,`startX`),endX:n.handleTravellerDragStart.bind(n,`endX`)},n.state={},n}return PG(t,e),OG(t,[{key:`componentWillUnmount`,value:function(){this.leaveTimer&&=(clearTimeout(this.leaveTimer),null),this.detachDragEndListener()}},{key:`getIndex`,value:function(e){var n=e.startX,r=e.endX,i=this.state.scaleValues,a=this.props,o=a.gap,s=a.data.length-1,c=Math.min(n,r),l=Math.max(n,r),u=t.getIndexInRange(i,c),d=t.getIndexInRange(i,l);return{startIndex:u-u%o,endIndex:d===s?s:d-d%o}}},{key:`getTextOfTick`,value:function(e){var t=this.props,n=t.data,r=t.tickFormatter,i=t.dataKey,a=CI(n[e],i,e);return(0,X.default)(r)?r(a,e):a}},{key:`attachDragEndListener`,value:function(){window.addEventListener(`mouseup`,this.handleDragEnd,!0),window.addEventListener(`touchend`,this.handleDragEnd,!0),window.addEventListener(`mousemove`,this.handleDrag,!0)}},{key:`detachDragEndListener`,value:function(){window.removeEventListener(`mouseup`,this.handleDragEnd,!0),window.removeEventListener(`touchend`,this.handleDragEnd,!0),window.removeEventListener(`mousemove`,this.handleDrag,!0)}},{key:`handleSlideDrag`,value:function(e){var t=this.state,n=t.slideMoveStartX,r=t.startX,i=t.endX,a=this.props,o=a.x,s=a.width,c=a.travellerWidth,l=a.startIndex,u=a.endIndex,d=a.onChange,f=e.pageX-n;f>0?f=Math.min(f,o+s-c-i,o+s-c-r):f<0&&(f=Math.max(f,o-r,o-i));var p=this.getIndex({startX:r+f,endX:i+f});(p.startIndex!==l||p.endIndex!==u)&&d&&d(p),this.setState({startX:r+f,endX:i+f,slideMoveStartX:e.pageX})}},{key:`handleTravellerDragStart`,value:function(e,t){var n=BG(t)?t.changedTouches[0]:t;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:e,brushMoveStartX:n.pageX}),this.attachDragEndListener()}},{key:`handleTravellerMove`,value:function(e){var t=this.state,n=t.brushMoveStartX,r=t.movingTravellerId,i=t.endX,a=t.startX,o=this.state[r],s=this.props,c=s.x,l=s.width,u=s.travellerWidth,d=s.onChange,f=s.gap,p=s.data,m={startX:this.state.startX,endX:this.state.endX},h=e.pageX-n;h>0?h=Math.min(h,c+l-u-o):h<0&&(h=Math.max(h,c-o)),m[r]=o+h;var g=this.getIndex(m),_=g.startIndex,v=g.endIndex,y=function(){var e=p.length-1;return r===`startX`&&(i>a?_%f===0:v%f===0)||ia?v%f===0:_%f===0)||i>a&&v===e};this.setState(IG(IG({},r,o+h),`brushMoveStartX`,e.pageX),function(){d&&y()&&d(g)})}},{key:`handleTravellerMoveKeyboard`,value:function(e,t){var n=this,r=this.state,i=r.scaleValues,a=r.startX,o=r.endX,s=this.state[t],c=i.indexOf(s);if(c!==-1){var l=c+e;if(!(l===-1||l>=i.length)){var u=i[l];t===`startX`&&u>=o||t===`endX`&&u<=a||this.setState(IG({},t,u),function(){n.props.onChange(n.getIndex({startX:n.state.startX,endX:n.state.endX}))})}}}},{key:`renderBackground`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.fill,o=e.stroke;return I.createElement(`rect`,{stroke:o,fill:a,x:t,y:n,width:r,height:i})}},{key:`renderPanorama`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.data,o=e.children,s=e.padding,c=I.Children.only(o);return c?I.cloneElement(c,{x:t,y:n,width:r,height:i,margin:s,compact:!0,data:a}):null}},{key:`renderTravellerLayer`,value:function(e,n){var r=this,i=this.props,a=i.y,o=i.travellerWidth,s=i.height,c=i.traveller,l=i.ariaLabel,u=i.data,d=i.startIndex,f=i.endIndex,p=Math.max(e,this.props.x),m=TG(TG({},Z(this.props,!1)),{},{x:p,y:a,width:o,height:s}),h=l||`Min value: ${u[d]?.name}, Max value: ${u[f]?.name}`;return I.createElement(Kx,{tabIndex:0,role:`slider`,"aria-label":h,"aria-valuenow":e,className:`recharts-brush-traveller`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[n],onTouchStart:this.travellerDragStartHandlers[n],onKeyDown:function(e){[`ArrowLeft`,`ArrowRight`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),r.handleTravellerMoveKeyboard(e.key===`ArrowRight`?1:-1,n))},onFocus:function(){r.setState({isTravellerFocused:!0})},onBlur:function(){r.setState({isTravellerFocused:!1})},style:{cursor:`col-resize`}},t.renderTraveller(c,m))}},{key:`renderSlide`,value:function(e,t){var n=this.props,r=n.y,i=n.height,a=n.stroke,o=n.travellerWidth,s=Math.min(e,t)+o,c=Math.max(Math.abs(t-e)-o,0);return I.createElement(`rect`,{className:`recharts-brush-slide`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:`move`},stroke:`none`,fill:a,fillOpacity:.2,x:s,y:r,width:c,height:i})}},{key:`renderText`,value:function(){var e=this.props,t=e.startIndex,n=e.endIndex,r=e.y,i=e.height,a=e.travellerWidth,o=e.stroke,s=this.state,c=s.startX,l=s.endX,u=5,d={pointerEvents:`none`,fill:o};return I.createElement(Kx,{className:`recharts-brush-texts`},I.createElement(ZO,CG({textAnchor:`end`,verticalAnchor:`middle`,x:Math.min(c,l)-u,y:r+i/2},d),this.getTextOfTick(t)),I.createElement(ZO,CG({textAnchor:`start`,verticalAnchor:`middle`,x:Math.max(c,l)+a+u,y:r+i/2},d),this.getTextOfTick(n)))}},{key:`render`,value:function(){var e=this.props,t=e.data,n=e.className,r=e.children,i=e.x,a=e.y,o=e.width,s=e.height,c=e.alwaysShowText,l=this.state,u=l.startX,d=l.endX,f=l.isTextActive,p=l.isSlideMoving,m=l.isTravellerMoving,h=l.isTravellerFocused;if(!t||!t.length||!Y(i)||!Y(a)||!Y(o)||!Y(s)||o<=0||s<=0)return null;var g=z(`recharts-brush`,n),_=I.Children.count(r)===1,v=bG(`userSelect`,`none`);return I.createElement(Kx,{className:g,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:v},this.renderBackground(),_&&this.renderPanorama(),this.renderSlide(u,d),this.renderTravellerLayer(u,`startX`),this.renderTravellerLayer(d,`endX`),(f||p||m||h||c)&&this.renderText())}}],[{key:`renderDefaultTraveller`,value:function(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.stroke,o=Math.floor(n+i/2)-1;return I.createElement(I.Fragment,null,I.createElement(`rect`,{x:t,y:n,width:r,height:i,fill:a,stroke:`none`}),I.createElement(`line`,{x1:t+1,y1:o,x2:t+r-1,y2:o,fill:`none`,stroke:`#fff`}),I.createElement(`line`,{x1:t+1,y1:o+2,x2:t+r-1,y2:o+2,fill:`none`,stroke:`#fff`}))}},{key:`renderTraveller`,value:function(e,n){return I.isValidElement(e)?I.cloneElement(e,n):(0,X.default)(e)?e(n):t.renderDefaultTraveller(n)}},{key:`getDerivedStateFromProps`,value:function(e,t){var n=e.data,r=e.width,i=e.x,a=e.travellerWidth,o=e.updateId,s=e.startIndex,c=e.endIndex;if(n!==t.prevData||o!==t.prevUpdateId)return TG({prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r},n&&n.length?zG({data:n,width:r,x:i,travellerWidth:a,startIndex:s,endIndex:c}):{scale:null,scaleValues:null});if(t.scale&&(r!==t.prevWidth||i!==t.prevX||a!==t.prevTravellerWidth)){t.scale.range([i,i+r-a]);var l=t.scale.domain().map(function(e){return t.scale(e)});return{prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r,startX:t.scale(e.startIndex),endX:t.scale(e.endIndex),scaleValues:l}}return null}},{key:`getIndexInRange`,value:function(e,t){for(var n=e.length,r=0,i=n-1;i-r>1;){var a=Math.floor((r+i)/2);e[a]>t?i=a:r=a}return t>=e[i]?i:r}}])}(I.PureComponent);IG(VG,`displayName`,`Brush`),IG(VG,`defaultProps`,{height:40,travellerWidth:5,gap:1,fill:`#fff`,stroke:`#666`,padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var HG=o(((e,t)=>{var n=rE();function r(e,t){var r;return n(e,function(e,n,i){return r=t(e,n,i),!r}),!!r}t.exports=r})),UG=o(((e,t)=>{var n=vw(),r=gT(),i=HG(),a=Iy(),o=_E();function s(e,t,s){var c=a(e)?n:i;return s&&o(e,t,s)&&(t=void 0),c(e,r(t,3))}t.exports=s})),WG=function(e,t){var n=e.alwaysShow,r=e.ifOverflow;return n&&(r=`extendDomain`),r===t},GG=o(((e,t)=>{var n=fE();function r(e,t,r){t==`__proto__`&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}t.exports=r})),KG=o(((e,t)=>{var n=GG(),r=tE(),i=gT();function a(e,t){var a={};return t=i(t,3),r(e,function(e,r,i){n(a,r,t(e,r,i))}),a}t.exports=a})),qG=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{var n=rE();function r(e,t){var r=!0;return n(e,function(e,n,i){return r=!!t(e,n,i),r}),r}t.exports=r})),YG=o(((e,t)=>{var n=qG(),r=JG(),i=gT(),a=Iy(),o=_E();function s(e,t,s){var c=a(e)?n:r;return s&&o(e,t,s)&&(t=void 0),c(e,i(t,3))}t.exports=s})),XG=[`x`,`y`];function ZG(e){"@babel/helpers - typeof";return ZG=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ZG(e)}function QG(){return QG=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function aK(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function oK(e,t){var n=e.x,r=e.y,i=iK(e,XG),a=`${n}`,o=parseInt(a,10),s=`${r}`,c=parseInt(s,10),l=`${t.height||i.height}`,u=parseInt(l,10),d=`${t.width||i.width}`,f=parseInt(d,10);return eK(eK(eK(eK(eK({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:u,width:f,name:t.name,radius:t.radius})}function sK(e){return I.createElement(uW,QG({shapeType:`rectangle`,propTransformer:oK,activeClassName:`recharts-active-bar`},e))}var cK=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,r){if(typeof e==`number`)return e;var i=Y(n)||Kb(n);return i?e(n,r):(!i&&OF(!1),t)}},lK=[`value`,`background`],uK;function dK(e){"@babel/helpers - typeof";return dK=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},dK(e)}function fK(e,t){if(e==null)return{};var n=pK(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function pK(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function mK(){return mK=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(g)0&&Math.abs(h)0&&(w=Math.min((e||0)-(T[t-1]||0),w))}),Number.isFinite(w)){var E=w/C,D=c.layout===`vertical`?n.height:n.width;if(c.padding===`gap`&&(v=E*D/2),c.padding===`no-gap`){var O=Xb(e.barCategoryGap,E*D),k=E*D/2;v=k-O-(k-O)/D*O}}}y=r===`xAxis`?[n.left+(m.left||0)+(v||0),n.left+n.width-(m.right||0)-(v||0)]:r===`yAxis`?s===`horizontal`?[n.top+n.height-(m.bottom||0),n.top+(m.top||0)]:[n.top+(m.top||0)+(v||0),n.top+n.height-(m.bottom||0)-(v||0)]:c.range,g&&(y=[y[1],y[0]]);var A=zI(c,i,d),j=A.scale,M=A.realScaleType;j.domain(f).range(y),VI(j);var N=qI(j,RK(RK({},c),{},{realScaleType:M}));r===`xAxis`?(S=l===`top`&&!h||l===`bottom`&&h,b=n.left,x=u[_]-S*c.height):r===`yAxis`&&(S=l===`left`&&!h||l===`right`&&h,b=u[_]-S*c.width,x=n.top);var P=RK(RK(RK({},c),N),{},{realScaleType:M,x:b,y:x,scale:j,width:r===`xAxis`?n.width:c.width,height:r===`yAxis`?n.height:c.height});return P.bandSize=rL(P,N),!c.hide&&r===`xAxis`?u[_]+=(S?-1:1)*P.height:c.hide||(u[_]+=(S?-1:1)*P.width),RK(RK({},a),{},zK({},o,P))},{})},UK=function(e,t){var n=e.x,r=e.y,i=t.x,a=t.y;return{x:Math.min(n,i),y:Math.min(r,a),width:Math.abs(i-n),height:Math.abs(a-r)}},WK=function(e){var t=e.x1,n=e.y1,r=e.x2,i=e.y2;return UK({x:t,y:n},{x:r,y:i})},GK=function(){function e(t){PK(this,e),this.scale=t}return IK(e,[{key:`domain`,get:function(){return this.scale.domain}},{key:`range`,get:function(){return this.scale.range}},{key:`rangeMin`,get:function(){return this.range()[0]}},{key:`rangeMax`,get:function(){return this.range()[1]}},{key:`bandwidth`,get:function(){return this.scale.bandwidth}},{key:`apply`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.bandAware,r=t.position;if(e!==void 0){if(r)switch(r){case`start`:return this.scale(e);case`middle`:var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+i;case`end`:var a=this.bandwidth?this.bandwidth():0;return this.scale(e)+a;default:return this.scale(e)}if(n){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+o}return this.scale(e)}}},{key:`isInRange`,value:function(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}],[{key:`create`,value:function(t){return new e(t)}}])}();zK(GK,`EPS`,1e-4);var KK=function(e){var t=Object.keys(e).reduce(function(t,n){return RK(RK({},t),{},zK({},n,GK.create(e[n])))},{});return RK(RK({},t),{},{apply:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.bandAware,i=n.position;return(0,jK.default)(e,function(e,n){return t[n].apply(e,{bandAware:r,position:i})})},isInRange:function(e){return(0,MK.default)(e,function(e,n){return t[n].isInRange(e)})}})};function qK(e){return(e%180+180)%180}var JK=function(e){var t=e.width,n=e.height,r=qK(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r{var n=gT(),r=Kw(),i=qw();function a(e){return function(t,a,o){var s=Object(t);if(!r(t)){var c=n(a,3);t=i(t),a=function(e){return c(s[e],e,s)}}var l=e(t,a,o);return l>-1?s[c?t[l]:l]:void 0}}t.exports=a})),XK=o(((e,t)=>{var n=uG();function r(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}t.exports=r})),ZK=o(((e,t)=>{var n=_T(),r=gT(),i=XK(),a=Math.max;function o(e,t,o){var s=e==null?0:e.length;if(!s)return-1;var c=o==null?0:i(o);return c<0&&(c=a(s+c,0)),n(e,r(t,3),c)}t.exports=o})),QK=o(((e,t)=>{t.exports=YK()(ZK())})),$K=(0,l(wb()).default)(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return[`l`,e.left,`t`,e.top,`w`,e.width,`h`,e.height].join(``)}),eq=l(QK()),tq=(0,I.createContext)(void 0),nq=(0,I.createContext)(void 0),rq=(0,I.createContext)(void 0),iq=(0,I.createContext)({}),aq=(0,I.createContext)(void 0),oq=(0,I.createContext)(0),sq=(0,I.createContext)(0),cq=function(e){var t=e.state,n=t.xAxisMap,r=t.yAxisMap,i=t.offset,a=e.clipPathId,o=e.children,s=e.width,c=e.height,l=$K(i);return I.createElement(tq.Provider,{value:n},I.createElement(nq.Provider,{value:r},I.createElement(iq.Provider,{value:i},I.createElement(rq.Provider,{value:l},I.createElement(aq.Provider,{value:a},I.createElement(oq.Provider,{value:c},I.createElement(sq.Provider,{value:s},o)))))))},lq=function(){return(0,I.useContext)(aq)},uq=function(e){var t=(0,I.useContext)(tq);t??OF(!1);var n=t[e];return n??OF(!1),n},dq=function(){return Zb((0,I.useContext)(tq))},fq=function(){var e=(0,I.useContext)(nq);return(0,eq.default)(e,function(e){return(0,MK.default)(e.domain,Number.isFinite)})||Zb(e)},pq=function(e){var t=(0,I.useContext)(nq);t??OF(!1);var n=t[e];return n??OF(!1),n},mq=function(){return(0,I.useContext)(rq)},hq=function(){return(0,I.useContext)(iq)},gq=function(){return(0,I.useContext)(sq)},_q=function(){return(0,I.useContext)(oq)},vq=l(UG());function yq(e){"@babel/helpers - typeof";return yq=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},yq(e)}function bq(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function xq(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);ne*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function PJ(e,t){return AJ(e,t+1)}function FJ(e,t,n,r,i){for(var a=(r||[]).slice(),o=t.start,s=t.end,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:AJ(r,l)};var a=c,d,f=function(){return d===void 0&&(d=n(t,a)),d},p=t.coordinate,m=c===0||NJ(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function IJ(e){"@babel/helpers - typeof";return IJ=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},IJ(e)}function LJ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function RJ(e){for(var t=1;t0?r.coordinate-d*e:r.coordinate})}else a[t]=r=RJ(RJ({},r),{},{tickCoord:r.coordinate});NJ(e,r.tickCoord,u,s,c)&&(c=r.tickCoord-e*(u()/2+i),a[t]=RJ(RJ({},r),{},{isShow:!0}))},u=o-1;u>=0;u--)l(u);return a}function UJ(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,c=t.start,l=t.end;if(a){var u=r[s-1],d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=RJ(RJ({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),NJ(e,u.tickCoord,function(){return d},c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=RJ(RJ({},u),{},{isShow:!0}))}for(var p=a?s-1:s,m=function(t){var r=o[t],a,s=function(){return a===void 0&&(a=n(r,t)),a};if(t===0){var u=e*(r.coordinate-e*s()/2-c);o[t]=r=RJ(RJ({},r),{},{tickCoord:u<0?r.coordinate-u*e:r.coordinate})}else o[t]=r=RJ(RJ({},r),{},{tickCoord:r.coordinate});NJ(e,r.tickCoord,s,c,l)&&(c=r.tickCoord+e*(s()/2+i),o[t]=RJ(RJ({},r),{},{isShow:!0}))},h=0;h=2?Wb(i[1].coordinate-i[0].coordinate):1,_=MJ(a,g,p);return c===`equidistantPreserveStart`?FJ(g,_,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?UJ(g,_,h,i,o,c===`preserveStartEnd`):HJ(g,_,h,i,o),f.filter(function(e){return e.isShow}))}var GJ=[`viewBox`],KJ=[`viewBox`],qJ=[`ticks`];function JJ(e){"@babel/helpers - typeof";return JJ=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},JJ(e)}function YJ(){return YJ=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $J(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function eY(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function tY(e,t){for(var n=0;n0?a(this.props):a(l)),r<=0||i<=0||!u||!u.length?null:I.createElement(Kx,{className:z(`recharts-cartesian-axis`,o),ref:function(t){e.layerReference=t}},n&&this.renderAxisLine(),this.renderTicks(u,this.state.fontSize,this.state.letterSpacing),ZL.renderCallByParent(this.props))}}],[{key:`renderTickItem`,value:function(e,t,n){var r,i=z(t.className,`recharts-cartesian-axis-tick-value`);return r=I.isValidElement(e)?I.cloneElement(e,ZJ(ZJ({},t),{},{className:i})):(0,X.default)(e)?e(ZJ(ZJ({},t),{},{className:i})):I.createElement(ZO,YJ({},t,{className:`recharts-cartesian-axis-tick-value`}),n),r}}])}(I.Component);uY(pY,`displayName`,`CartesianAxis`),uY(pY,`defaultProps`,{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:`bottom`,ticks:[],stroke:`#666`,tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:`preserveEnd`});var mY=[`x1`,`y1`,`x2`,`y2`,`key`],hY=[`offset`];function gY(e){"@babel/helpers - typeof";return gY=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},gY(e)}function _Y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vY(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function wY(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var TY=function(e){var t=e.fill;if(!t||t===`none`)return null;var n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,s=e.ry;return I.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function EY(e,t){var n;if(I.isValidElement(e))n=I.cloneElement(e,t);else if((0,X.default)(e))n=e(t);else{var r=t.x1,i=t.y1,a=t.x2,o=t.y2,s=t.key,c=Z(CY(t,mY),!1);c.offset;var l=CY(c,hY);n=I.createElement(`line`,SY({},l,{x1:r,y1:i,x2:a,y2:o,fill:`none`,key:s}))}return n}function DY(e){var t=e.x,n=e.width,r=e.horizontal,i=r===void 0?!0:r,a=e.horizontalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(r,a){return EY(i,vY(vY({},e),{},{x1:t,y1:r,x2:t+n,y2:r,key:`line-${a}`,index:a}))});return I.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},o)}function OY(e){var t=e.y,n=e.height,r=e.vertical,i=r===void 0?!0:r,a=e.verticalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(r,a){return EY(i,vY(vY({},e),{},{x1:r,y1:t,x2:r,y2:t+n,key:`line-${a}`,index:a}))});return I.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},o)}function kY(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,s=e.horizontalPoints,c=e.horizontal;if(!(c===void 0||c)||!t||!t.length)return null;var l=s.map(function(e){return Math.round(e+i-i)}).sort(function(e,t){return e-t});i!==l[0]&&l.unshift(0);var u=l.map(function(e,s){var c=l[s+1]?l[s+1]-e:i+o-e;if(c<=0)return null;var u=s%t.length;return I.createElement(`rect`,{key:`react-${s}`,y:e,x:r,height:c,width:a,stroke:`none`,fill:t[u],fillOpacity:n,className:`recharts-cartesian-grid-bg`})});return I.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},u)}function AY(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,s=e.width,c=e.height,l=e.verticalPoints;if(!n||!r||!r.length)return null;var u=l.map(function(e){return Math.round(e+a-a)}).sort(function(e,t){return e-t});a!==u[0]&&u.unshift(0);var d=u.map(function(e,t){var n=u[t+1]?u[t+1]-e:a+s-e;if(n<=0)return null;var l=t%r.length;return I.createElement(`rect`,{key:`react-${t}`,x:e,y:o,width:n,height:c,stroke:`none`,fill:r[l],fillOpacity:i,className:`recharts-cartesian-grid-bg`})});return I.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},d)}var jY=function(e,t){var n=e.xAxis,r=e.width,i=e.height,a=e.offset;return FI(WJ(vY(vY(vY({},pY.defaultProps),n),{},{ticks:II(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},MY=function(e,t){var n=e.yAxis,r=e.width,i=e.height,a=e.offset;return FI(WJ(vY(vY(vY({},pY.defaultProps),n),{},{ticks:II(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},NY={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:`#ccc`,fill:`none`,verticalFill:[],horizontalFill:[]};function PY(e){var t=gq(),n=_q(),r=hq(),i=vY(vY({},e),{},{stroke:e.stroke??NY.stroke,fill:e.fill??NY.fill,horizontal:e.horizontal??NY.horizontal,horizontalFill:e.horizontalFill??NY.horizontalFill,vertical:e.vertical??NY.vertical,verticalFill:e.verticalFill??NY.verticalFill,x:Y(e.x)?e.x:r.left,y:Y(e.y)?e.y:r.top,width:Y(e.width)?e.width:r.width,height:Y(e.height)?e.height:r.height}),a=i.x,o=i.y,s=i.width,c=i.height,l=i.syncWithTicks,u=i.horizontalValues,d=i.verticalValues,f=dq(),p=fq();if(!Y(s)||s<=0||!Y(c)||c<=0||!Y(a)||a!==+a||!Y(o)||o!==+o)return null;var m=i.verticalCoordinatesGenerator||jY,h=i.horizontalCoordinatesGenerator||MY,g=i.horizontalPoints,_=i.verticalPoints;if((!g||!g.length)&&(0,X.default)(h)){var v=u&&u.length,y=h({yAxis:p?vY(vY({},p),{},{ticks:v?u:p.ticks}):void 0,width:t,height:n,offset:r},v?!0:l);Jx(Array.isArray(y),`horizontalCoordinatesGenerator should return Array but instead it returned [${gY(y)}]`),Array.isArray(y)&&(g=y)}if((!_||!_.length)&&(0,X.default)(m)){var b=d&&d.length,x=m({xAxis:f?vY(vY({},f),{},{ticks:b?d:f.ticks}):void 0,width:t,height:n,offset:r},b?!0:l);Jx(Array.isArray(x),`verticalCoordinatesGenerator should return Array but instead it returned [${gY(x)}]`),Array.isArray(x)&&(_=x)}return I.createElement(`g`,{className:`recharts-cartesian-grid`},I.createElement(TY,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),I.createElement(DY,SY({},i,{offset:r,horizontalPoints:g,xAxis:f,yAxis:p})),I.createElement(OY,SY({},i,{offset:r,verticalPoints:_,xAxis:f,yAxis:p})),I.createElement(kY,SY({},i,{horizontalPoints:g})),I.createElement(AY,SY({},i,{verticalPoints:_})))}PY.displayName=`CartesianGrid`;var FY=[`layout`,`type`,`stroke`,`connectNulls`,`isRange`,`ref`],IY=[`key`],LY;function RY(e){"@babel/helpers - typeof";return RY=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},RY(e)}function zY(e,t){if(e==null)return{};var n=BY(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function BY(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function VY(){return VY=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!(0,uI.default)(s,r)||!(0,uI.default)(c,i))?this.renderAreaWithAnimation(e,t):this.renderAreaStatically(r,i,e,t)}},{key:`render`,value:function(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.top,o=e.left,s=e.xAxis,c=e.yAxis,l=e.width,u=e.height,d=e.isAnimationActive,f=e.id;if(t||!r||!r.length)return null;var p=this.state.isAnimationFinished,m=r.length===1,h=z(`recharts-area`,i),g=s&&s.allowDataOverflow,_=c&&c.allowDataOverflow,v=g||_,y=(0,J.default)(f)?this.id:f,b=Z(n,!1)??{r:3,strokeWidth:2},x=b.r,S=x===void 0?3:x,C=b.strokeWidth,w=C===void 0?2:C,T=(Ax(n)?n:{}).clipDot,E=T===void 0?!0:T,D=S*2+w;return I.createElement(Kx,{className:h},g||_?I.createElement(`defs`,null,I.createElement(`clipPath`,{id:`clipPath-${y}`},I.createElement(`rect`,{x:g?o:o-l/2,y:_?a:a-u/2,width:g?l:l*2,height:_?u:u*2})),!E&&I.createElement(`clipPath`,{id:`clipPath-dots-${y}`},I.createElement(`rect`,{x:o-D/2,y:a-D/2,width:l+D,height:u+D}))):null,m?null:this.renderArea(v,y),(n||m)&&this.renderDots(v,E,y),(!d||p)&&yR.renderCallByParent(this.props,r))}}],[{key:`getDerivedStateFromProps`,value:function(e,t){return e.animationId===t.prevAnimationId?e.points!==t.curPoints||e.baseLine!==t.curBaseLine?{curPoints:e.points,curBaseLine:e.baseLine}:null:{prevAnimationId:e.animationId,curPoints:e.points,curBaseLine:e.baseLine,prevPoints:t.curPoints,prevBaseLine:t.curBaseLine}}}])}(I.PureComponent);LY=rX,eX(rX,`displayName`,`Area`),eX(rX,`defaultProps`,{stroke:`#3182bd`,fill:`#3182bd`,fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:`line`,connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!cD.isSsr,animationBegin:0,animationDuration:1500,animationEasing:`ease`}),eX(rX,`getBaseValue`,function(e,t,n,r){var i=e.layout,a=e.baseValue,o=t.props.baseValue??a;if(Y(o)&&typeof o==`number`)return o;var s=i===`horizontal`?r:n,c=s.scale.domain();if(s.type===`number`){var l=Math.max(c[0],c[1]),u=Math.min(c[0],c[1]);return o===`dataMin`?u:o===`dataMax`||l<0?l:Math.max(Math.min(c[0],c[1]),0)}return o===`dataMin`?c[0]:o===`dataMax`?c[1]:c[0]}),eX(rX,`getComposedData`,function(e){var t=e.props,n=e.item,r=e.xAxis,i=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,s=e.bandSize,c=e.dataKey,l=e.stackedData,u=e.dataStartIndex,d=e.displayedData,f=e.offset,p=t.layout,m=l&&l.length,h=LY.getBaseValue(t,n,r,i),g=p===`horizontal`,_=!1,v=d.map(function(e,t){var n;m?n=l[u+t]:(n=CI(e,c),Array.isArray(n)?_=!0:n=[h,n]);var d=n[1]==null||m&&CI(e,c)==null;return g?{x:JI({axis:r,ticks:a,bandSize:s,entry:e,index:t}),y:d?null:i.scale(n[1]),value:n,payload:e}:{x:d?null:r.scale(n[1]),y:JI({axis:i,ticks:o,bandSize:s,entry:e,index:t}),value:n,payload:e}});return UY({points:v,baseLine:m||_?v.map(function(e){var t=Array.isArray(e.value)?e.value[0]:null;return g?{x:e.x,y:t!=null&&e.y!=null?i.scale(t):null}:{x:t==null?null:r.scale(t),y:e.y}}):g?i.scale(h):r.scale(h),layout:p,isRange:_},f)}),eX(rX,`renderDotItem`,function(e,t){var n;if(I.isValidElement(e))n=I.cloneElement(e,t);else if((0,X.default)(e))n=e(t);else{var r=z(`recharts-area-dot`,typeof e==`boolean`?``:e.className),i=t.key,a=zY(t,IY);n=I.createElement(lH,VY({},a,{key:i,className:r}))}return n});function iX(e){"@babel/helpers - typeof";return iX=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},iX(e)}function aX(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function oX(e,t){for(var n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function SX(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function CX(e){var t=e.option,n=e.isActive,r=xX(e,yX);return typeof t==`string`?I.createElement(uW,bX({option:I.createElement(UC,bX({type:t},r)),isActive:n,shapeType:`symbols`},r)):I.createElement(uW,bX({option:t,isActive:n,shapeType:`symbols`},r))}function wX(e){"@babel/helpers - typeof";return wX=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},wX(e)}function TX(){return TX=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function aQ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function oQ(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function sQ(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n