diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..974dc72 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,72 @@ +name: Overwatch acceptance gates + +on: + pull_request: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: overwatch-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + backend: + name: backend-lint-and-locked-tests + runs-on: ubuntu-latest + timeout-minutes: 25 + # Configure required reviewers and the authorized short-lived index token + # in this environment before using this as an acceptance gate. + environment: overwatch-ci + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: '3.13.12' + - name: Install pinned uv + run: python -m pip install uv==0.10.0 + - name: Require supported runtime and authorized CI credential route + env: + OVERWATCH_CI_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name || github.repository }} + UV_INDEX_TSCORE_PASSWORD: ${{ secrets.TSCORE_CODEARTIFACT_TOKEN }} + run: python scripts/ci_prerequisites.py --ci + - name: Install the unchanged dependency lock + env: + UV_INDEX_TSCORE_USERNAME: aws + UV_INDEX_TSCORE_PASSWORD: ${{ secrets.TSCORE_CODEARTIFACT_TOKEN }} + UV_HTTP_TIMEOUT: '30' + UV_HTTP_RETRIES: '2' + run: uv sync --locked --group dev --python 3.13.12 + - name: Backend lint + run: uv run --locked --no-sync ruff check src tests scripts + - name: Backend suite with explicit skip reasons + run: uv run --locked --no-sync pytest -q -ra --junitxml=backend-junit.xml + - name: Preserve lock and dependency constraints + run: git diff --exit-code -- pyproject.toml uv.lock + + frontend: + name: frontend-typecheck-vitest-build + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: '22.16.0' + - name: Install frontend lock without lifecycle scripts + run: npm ci --ignore-scripts --no-audit --no-fund + - name: Typecheck + run: npm run typecheck + - name: Vitest + run: npm test + - name: Production build + run: npm run build + - name: Preserve frontend dependencies + run: git diff --exit-code -- package.json package-lock.json diff --git a/docs/CI_ACCEPTANCE.md b/docs/CI_ACCEPTANCE.md new file mode 100644 index 0000000..46bdfc2 --- /dev/null +++ b/docs/CI_ACCEPTANCE.md @@ -0,0 +1,76 @@ +# Locked Overwatch CI and acceptance boundaries + +These source changes target Overwatch issue #2 and the existing draft PR #1. +They do not establish successful private authentication, backend tests or the +producer-to-visible-UI acceptance gate. Keep PR #1 draft until its live gates pass. + +## Supported runtime and unchanged dependency sources + +Use Python `>=3.13.12,<3.14`. The workflow selects `3.13.12`; neither +`pyproject.toml` nor `uv.lock` is changed. `typesafe` and `tspath` remain bound to +the named `tscore` index and the existing `subprocess` keyring configuration. +No public package substitutes, unlocked install or version relaxation is allowed. + +For a local checkout, retain the **existing authorized** CodeArtifact/keyring +route. Check that its credential is current without printing it. uv also supports +`UV_INDEX_TSCORE_USERNAME=aws` and `UV_INDEX_TSCORE_PASSWORD` for this exact named +index. Set the password only through the existing secret manager, not a shell +command containing its value, a checked-in dotenv file, a URL or a log. +The preflight deliberately does not dump variables or query a credential store. +A present value is not proof of authorization; only the actual locked install is. + +```sh +python scripts/ci_prerequisites.py +uv sync --locked --group dev --python 3.13.12 +uv run --locked --no-sync ruff check src tests scripts +uv run --locked --no-sync pytest -q -ra --junitxml=backend-junit.xml +npm ci --ignore-scripts --no-audit --no-fund +npm run typecheck +npm test +npm run build +``` + +## Hosted credential boundary + +A maintainer must configure the `overwatch-ci` GitHub environment with required +reviewers and bind the already authorized, short-lived index credential as +`TSCORE_CODEARTIFACT_TOKEN`. This patch neither obtains that credential nor changes +AWS access policies. Rotate/refresh expired credentials using the existing approved +route. Check the environment and secret configuration before running credentialed +jobs; this source file cannot enforce GitHub environment protection by itself. + +The token is scoped only to the prerequisite/install steps, never frontend or +test steps. No `pull_request_target` trigger, OIDC/cloud deployment, cache upload, +secret artifact upload or automatic remote telemetry is added. Review the exact +PR commit before permitting the environment: private package installation executes +trusted dependency/build code. Fork PRs are not given the token and cannot count a +skipped backend as success. The preflight exits 2 on a foreign/missing repository +identity or missing token. Missing/expired access is an environment gate, not a +passing backend test result. Do not promote untrusted fork code merely to obtain +credentials. + +Stable job names are `backend-lint-and-locked-tests` and +`frontend-typecheck-vitest-build`. This patch does not configure branch rules or +claim these jobs ran. Before merge, inspect both checks on **the current PR #1 head**. + +## Fresh producer and running UI remain separate + +The normal suite retains explicit skip reasons. A skipped +`tests/test_kev_laya_pipeline.py` is not a successful Layev pipeline. For issue #3, +provide the separately authorized fresh producer export, isolated registry/cache +paths, unskipped pipeline receipt, the actual report JSON, browser errors and +populated UI screenshot. Do not inject a fixture or use hosted CI green as a +substitute. Run the full suite after supplying that prerequisite on the supported +local environment. Confirm which checkout the running service uses, preserving +unrelated files and existing run identities. Never terminate WSL. + +## Source references + +- Repository dependency source: `pyproject.toml` at + `11f32c597f3763137b041e7d867d346e782b3bf9`. +- uv named-index environment authentication: + https://docs.astral.sh/uv/concepts/indexes/#authentication +- uv existing subprocess keyring route: + https://docs.astral.sh/uv/concepts/authentication/http/#keyring-providers + +Local source/preflight tests are not the locked Overwatch backend suite. diff --git a/docs/WANDB_RESPONSE_GUARDS.md b/docs/WANDB_RESPONSE_GUARDS.md new file mode 100644 index 0000000..c75ec94 --- /dev/null +++ b/docs/WANDB_RESPONSE_GUARDS.md @@ -0,0 +1,56 @@ +# W&B response guards + +This is source-level robustness for Overwatch #5, not evidence that an authorized +W&B or S3 exchange, complete backend suite, or populated UI has passed. + +## Pagination metadata + +The collector requires `pageInfo` to be an object and `hasNextPage` to be an +actual JSON Boolean. It must not coerce `null`, numbers, strings, arrays, or +objects to a completion decision. The Cursor Connections specification defines +`hasNextPage` as a non-null Boolean: +https://relay.dev/graphql/connections.htm#sec-undefined.PageInfo.Fields + +The Boolean and, for a continuing page, the nonempty, nonrepeating string cursor +and nonempty edge list are validated before snapshots from that page are +accepted. A malformed page is an error, not a successfully refreshed source. +Already accepted snapshots from earlier valid pages remain available. This does +not promise transactional validation of every other field in a page. + +An invalid response does not revoke registration: `configured_ids` and +`registry_complete` describe the validated registry, while `complete`, source +`status`, and source `refreshed_at` describe this collection attempt. Do not +replace an older successful refresh with a failed attempt's timestamp. + +## Response ownership + +`WandbPages.fetch_snapshot_page` owns the opened response until it returns the +`Body`. A header-extraction or Content-Length conversion exception closes that +response without reading it, then propagates the exception. Valid responses +transfer ownership to the collector, whose existing `finally` closes the body. +The existing length interpretation and byte-budget rules are unchanged. + +No request retries, redirect allowance, credential fallback, run creation, +run finishing, or additional payload reads are introduced. The deadline remains +cooperative: these changes do not cancel an in-flight network/credential call. + +## Regressions + +`tests/test_kev_laya_wandb_response_guards.py` uses the real collector and the +standalone telemetry validator, synthetic in-memory pages, and an injected +opener. Socket connection attempts are forbidden in this suite. It covers +invalid completion types and page metadata, invalid/repeated cursors, previous +valid-page retention, valid terminal/paginated pages, encoded summary JSON, +known/unknown lengths, source and request/page budgets, identity mismatch, +GraphQL errors, header-error cleanup, ownership transfer, and no added retry. + +In a supported, authenticated checkout, run these tests and the unchanged full +CI gates described in [CI_ACCEPTANCE.md](CI_ACCEPTANCE.md). No synthetic result +satisfies the live acceptance boxes in [issue #5](https://github.com/CompleteDotTech/Overwatch/issues/5) +or the fresh producer-to-visible-UI gate in [issue #3](https://github.com/CompleteDotTech/Overwatch/issues/3). + +Live qualification must still record the actual endpoint/query shape, bounded +S3/W&B bytes and request/page/read counts, timeout behavior, malformed/outage and +budget-exhaustion cache preservation, and source-registration/freshness +separation, using existing authorized non-production targets. Keep credentials +and private payloads out of source, receipts, logs, and issue comments. diff --git a/scripts/ci_prerequisites.py b/scripts/ci_prerequisites.py new file mode 100644 index 0000000..a31a1bf --- /dev/null +++ b/scripts/ci_prerequisites.py @@ -0,0 +1,39 @@ +"""Secret-safe CI prerequisite checks. No credential lookup or network requests.""" +from __future__ import annotations + +import argparse +import os +import sys +from collections.abc import Mapping + + +def blockers(version: tuple[int, ...], environ: Mapping[str, str], *, ci: bool) -> list[str]: + """Return public diagnostic codes only; never include environment values.""" + result = [] + if not (version[:2] == (3, 13) and version[2] >= 12): + result.append("unsupported_python_requires_3_13_12_to_before_3_14") + if ci: + repository = environ.get("GITHUB_REPOSITORY", "") + head = environ.get("OVERWATCH_CI_HEAD_REPOSITORY", "") + if not repository or not head or head != repository: + result.append("credentialed_backend_requires_reviewed_same_repository_code") + if not environ.get("UV_INDEX_TSCORE_PASSWORD", ""): + result.append("missing_authorized_tscore_index_token") + return result + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--ci", action="store_true") + args = parser.parse_args() + reasons = blockers(tuple(sys.version_info[:3]), os.environ, ci=args.ci) + for reason in reasons: + print("BLOCKED: " + reason) + if reasons: + return 2 + print("Prerequisite shape checks passed; authentication and locked install remain unverified.") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/src/overwatch/cached_metrics.py b/src/overwatch/cached_metrics.py index b816fa7..a017b13 100644 --- a/src/overwatch/cached_metrics.py +++ b/src/overwatch/cached_metrics.py @@ -680,3 +680,10 @@ def cloudwatch_event_order(event: dict[str, Any]) -> tuple[int, str]: def raw_cache_manifest() -> dict[str, Any]: """Load the collector manifest used for query status and cache provenance.""" return read_json(raw_cache_path("manifest.json"), {"sources": {}, "cache_root": str(RAW_CACHE_ROOT)}) + + +def cached_kev_laya_runs() -> dict[str, Any]: + """Read model-run snapshots strictly from the versioned collector cache.""" + from overwatch.raw_cache import read_model_runs_cache + + return read_model_runs_cache() diff --git a/src/overwatch/collector.py b/src/overwatch/collector.py index 34f87e1..2039bb9 100644 --- a/src/overwatch/collector.py +++ b/src/overwatch/collector.py @@ -57,6 +57,7 @@ class CollectorOptions: limit: int = 20 entity: str | None = None gcp_billing_table: str | None = None + local_models_only: bool = False @@ -194,6 +195,29 @@ async def collect_source( } return value + # Explicit offline/local mode: use the REAL collector and cache without cloud I/O. + # Default behavior and existing Flow/resource records remain unchanged. + if options.local_models_only: + if job_id is not None: + raise ValueError("local-models-only cannot refresh a SkyPilot job") + result = await collect_source("kev_laya", collect_kev_laya_cache) + if result is not None: + source_status["kev_laya"]["raw"] = result + if result["warnings"]: + source_status["kev_laya"]["status"] = "warning" + for key in ("sky_jobs", "sky_clusters", "aws_billing", "gcp_billing", "wandb", "cloudwatch"): + source_status[key] = {"status": "skipped", "duration_seconds": 0.0, + "error": None, "reason": "explicit local-models-only"} + manifest = { + "cache_spec_version": RAW_CACHE_SPEC_VERSION, "cache_root": str(RAW_CACHE_ROOT), + "updated_at": isoformat(datetime.now(UTC)), + "duration_seconds": round(perf_counter() - collection_started, 3), + "scope": {"job_id": None, "full_logs": False, "local_models_only": True}, + "sources": source_status, + } + write_json_atomically(manifest_path, manifest) + return manifest + # A scoped job refresh reuses inventory and only advances that job's raw log cursor. if job_id is not None: job = read_json(raw_cache_path("jobs", str(job_id), "sky.json")) @@ -253,6 +277,12 @@ async def collect_source( "error": None, } + kev_laya_result = await collect_source("kev_laya", collect_kev_laya_cache) + if kev_laya_result is not None: + source_status["kev_laya"]["raw"] = kev_laya_result + if kev_laya_result["warnings"]: + source_status["kev_laya"]["status"] = "warning" + # W&B stays optional and is captured as raw hydrated run records. wandb_started = perf_counter() try: @@ -393,10 +423,35 @@ async def run_bounded_cloudwatch_operation( return manifest + +def collect_kev_laya_cache() -> dict[str, Any]: + """The collector alone owns Kev-Laya raw-cache writes.""" + from overwatch.constants import KEV_LAYA_RETENTION_DAYS + from overwatch.kev_laya_adapter import merge_snapshots + from overwatch.kev_laya_lock import collector_lock + from overwatch.providers.kev_laya import collect_snapshots + from overwatch.raw_cache import model_runs_cache_path + + path = model_runs_cache_path() + collected = collect_snapshots() + with collector_lock(path.with_suffix(".lock")): + from overwatch.raw_cache import read_model_runs_cache + envelope = merge_snapshots(read_model_runs_cache(), collected, + retention_days=KEV_LAYA_RETENTION_DAYS) + write_json_atomically(path, envelope) + return {"runs": len(envelope["records"]), "warnings": len(envelope["warnings"]), + "complete": collected.get("complete", False), + "accounting": collected.get("accounting", {}), + "source_status": collected.get("sources", []), + "collection_warnings": collected.get("warnings", [])} + + def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser(description="Collect raw Overwatch metrics") parser.add_argument("--job-id", type=int) parser.add_argument("--full-logs", action="store_true") + parser.add_argument("--local-models-only", action="store_true", + default=os.environ.get("OVERWATCH_LOCAL_MODELS_ONLY") == "1") parser.add_argument("--limit", type=int, default=20) parser.add_argument("--entity") parser.add_argument( @@ -411,6 +466,7 @@ def main() -> int: limit=args.limit, entity=args.entity, gcp_billing_table=args.gcp_billing_table, + local_models_only=args.local_models_only, ) manifest = asyncio.run( collect_raw_metrics(options, job_id=args.job_id, full_logs=args.full_logs) diff --git a/src/overwatch/constants.py b/src/overwatch/constants.py index ca8e54b..18782a4 100644 --- a/src/overwatch/constants.py +++ b/src/overwatch/constants.py @@ -60,3 +60,7 @@ r"\[(?P[^<\]]+)<(?P.+?)\s+[\d.eE+-]+ex/s " r"(?P[\d,]+)tok/s" ) + +# Kev-Laya adapter policy; does not change Flow/cloud log defaults. +KEV_LAYA_STALE_SECONDS = 120 +KEV_LAYA_RETENTION_DAYS = 14 diff --git a/src/overwatch/frontend/App.tsx b/src/overwatch/frontend/App.tsx index 38254c3..dfcdfd8 100644 --- a/src/overwatch/frontend/App.tsx +++ b/src/overwatch/frontend/App.tsx @@ -1,3 +1,4 @@ +import { ModelRuns } from "./ModelRunsView"; import { ActionIcon, Alert, @@ -1009,7 +1010,7 @@ export function App() { )} - {report && page === "resources" && } + {report && page === "resources" && <>} {report && page === "billing" && } {report && page === "cost-waste" && } {report && page === "run" && runJobId != null && } diff --git a/src/overwatch/frontend/ModelRunsView.tsx b/src/overwatch/frontend/ModelRunsView.tsx new file mode 100644 index 0000000..ede7c28 --- /dev/null +++ b/src/overwatch/frontend/ModelRunsView.tsx @@ -0,0 +1,77 @@ +import { Alert, Anchor, Badge, Box, Card, Group, Stack, Table, Text, Title } from "@mantine/core"; +import { curve, executionSummary, formatBytes, percentile, phaseLabel, safeWebURL, verificationLabel } from "./modelRuns"; +import type { ModelRun } from "./modelRuns"; + +function MetricCurve({ run, metric }: { run: ModelRun; metric: string }) { + const points = curve(run.history, metric); + return {metric}: {run.metrics[metric]?.toPrecision(4) ?? "unknown"} + {points && + + }; +} +function ArtifactLink({ uri, label }: { uri: string; label: string }) { + const web = safeWebURL(uri); + return web ? {label} + : {label}: {uri}; +} +export function ModelRuns({ runs, warnings = [] }: { runs: ModelRun[]; warnings?: Array> }) { + return + Decision model experiments + {warnings.length > 0 && {warnings.length} telemetry warning(s): {warnings.map(w => String(w.code ?? "unknown")).join(", ")}} + {!runs.length && No registered Kev-Laya runs. Resource inventory above is unchanged.} + {runs.map(run => { + const ext = run.extensions, execution = ext?.execution, resource = ext?.resources; + return + {run.experiment_id} / {run.run_id} + {verificationLabel(run)}{run.freshness}{run.provenance.evidence_class} + + {run.verification && run.verification !== "verified" && + {run.verification === "unverified" ? "No verified attempt is available for this observation." : "The values below describe the last verified attempt, not the newer unverified observation."} + {(run.unverified_observations ?? []).map((o, index) => + Observed attempt {o.attempt_index} ({o.attempt_id}) · {o.phase} · sequence {o.sequence} · source {o.source_id} · {o.reason} · heartbeat {o.heartbeat_at} + )} + } + Attempt {run.attempt_index} · {run.attempt_id} · sequence {run.sequence} + {phaseLabel(run)}: {run.phase} · Sky: {run.provider_status.skypilot ?? "unknown"} · W&B: {run.provider_status.wandb ?? "unknown"} + Association: {run.association.status}{run.association.scheduler ? ` · ${run.association.scheduler.namespace}/${run.association.scheduler.job_id}` : " (no scheduler resource)"} + Heartbeat {run.heartbeat_at} · {Math.round(run.heartbeat_age_seconds)} seconds old · monitoring failures {run.monitoring_export_failures} + {run.progress.optimizer_steps.toLocaleString()} / {run.progress.totals.optimizer_steps?.toLocaleString() ?? "unknown"} optimizer steps + {run.progress.microbatches.toLocaleString()} accumulation microbatches · {run.progress.examples.toLocaleString()} examples · {run.progress.forward_tokens.toLocaleString()} useful forward tokens + Elapsed {run.progress.elapsed_seconds?.toFixed(1) ?? "unknown"} s · ETA {run.progress.eta_seconds?.toFixed(1) ?? "unknown"} s · {run.progress.tokens_per_second?.toFixed(1) ?? "unknown"} tokens/s + {executionSummary(ext)} + {execution && Padding overhead {execution.padding_tokens.toLocaleString()} tokens · total forward compute {execution.compute_tokens.toLocaleString()} tokens (excludes backward recomputation) · batch sizes {Object.entries(execution.batch_size_histogram).map(([size, count]) => `${size} × ${count}`).join(", ")}} + + {ext?.calibration && Calibration: {ext.calibration.status} · {ext.calibration.method ?? "unknown method"} + {Object.entries(ext.calibration.per_type).map(([kind, fit]) => fit && + {kind}: T={fit.temperature.toPrecision(4)} · {fit.count} calibration questions · calibration NLL {fit.before_nll?.toPrecision(4) ?? "unknown"} → {fit.after_nll?.toPrecision(4) ?? "unknown"} + )} + Calibration split SHA-256: {ext.calibration.split_sha256 ?? "unknown"}. These are fit diagnostics, not a general calibration guarantee. + } + Backbone {run.provenance.backbone} · {run.provenance.precision} · {run.provenance.hardware} + RSS {formatBytes(resource?.rss_bytes)} · CUDA allocated {formatBytes(resource?.gpu_allocated_bytes)} · CUDA peak allocated {formatBytes(resource?.gpu_peak_allocated_bytes)} + Resource sample {resource?.sampled_at ?? "unknown"} · minimum sampling interval {resource?.interval_seconds ?? "unknown"} s; samples are activity-driven. Cache-admission estimates are not total memory guarantees. + Branch budget {run.provenance.context_limits.branch}; aggregate {run.provenance.context_limits.aggregate}. Budget is not a benchmark result. +
Source, preprocessing, and split provenance + Tokenizer {run.provenance.tokenizer} · serialization {ext?.serialization.serialization ?? "historical / unknown"} · literals {ext?.serialization.literal_encoding ?? "unknown"} + Package {ext?.source.package_version ?? "unknown"} · Git {ext?.source.git_status ?? "unknown"} · dirty state {ext?.source.git_dirty == null ? "unknown" : ext.source.git_dirty ? "dirty" : "clean"} + Source tree SHA-256 {ext?.source.source_tree_sha256 ?? "unknown"} · archive SHA-256 {ext?.source.archive_sha256 ?? "unknown"} + Config {run.provenance.config_sha256 ?? "unknown"} · data manifest {run.provenance.data_sha256 ?? "unknown"} · seed {run.provenance.seed ?? "unknown"} + {Object.entries(run.provenance.split_hashes ?? {}).map(([name, hash]) => {name}: {hash})} + {run.git_url && }{run.wandb_url && } +
+
Attempt lineage and collection freshness + Receipt storage durability: {ext?.lineage_durable == null ? "unknown" : ext.lineage_durable ? "confirmed by writer" : "write failed; recovery may be uncertain"} · at most 64 consecutive receipts retained + {(ext?.attempt_lineage ?? []).map(a => Attempt {a.attempt_index} · {a.attempt_id} · parent {a.parent_attempt_id ?? "none"} · receipt {a.sha256})} + {(run.collection_sources ?? []).map(s => Source {s.source_id}: {s.status} · current refresh {s.refreshed_at ?? "not refreshed"} · last successful refresh {s.last_successful_refresh_at ?? "unknown"} · {s.payload_bytes} payload bytes / {s.requests} request slots)} +
+ Resume: {run.resume.capable ? "optimization-boundary checkpoint available" : "not established"} · parent attempt: {run.parent_attempt_id ?? "none"} + Recoveries: {run.recoveries.total ?? "unknown"}; infrastructure {run.recoveries.infrastructure ?? "unknown"}; application {run.recoveries.application ?? "unknown"} + Measured cost: {run.cost.measured_usd == null ? "unknown" : `$${run.cost.measured_usd.toFixed(4)}`} · estimate: {run.cost.estimated_usd == null ? "unknown" : `$${run.cost.estimated_usd.toFixed(4)}`} · basis {run.cost.basis ?? "unknown"} + Serving: {run.serving.requests} requests / {run.serving.errors} errors · recent latency (last 128): p50 {percentile(run.serving.latency_ms, .5)?.toFixed(1) ?? "unknown"} ms · p95 {percentile(run.serving.latency_ms, .95)?.toFixed(1) ?? "unknown"} ms · {run.serving.prefix_reuses} prefix reuses + ArtifactChecksum / lineage + {run.artifacts.map(a => + {a.sha256}Parent {a.parent_sha256 ?? "none"} · {a.size_bytes.toLocaleString()} bytes)}
+
; + })} +
; +} diff --git a/src/overwatch/frontend/modelRuns.test.ts b/src/overwatch/frontend/modelRuns.test.ts new file mode 100644 index 0000000..33d8440 --- /dev/null +++ b/src/overwatch/frontend/modelRuns.test.ts @@ -0,0 +1,26 @@ +import { describe, expect, it } from "vitest"; +import { curve, executionSummary, formatBytes, percentile, phaseLabel, safeWebURL, verificationLabel } from "./modelRuns"; + +describe("versioned model telemetry presentation", () => { + it("does not label stale verified values as the new verified attempt", () => { + const run = { verification: "last_verified_with_newer_uncertainty" as const }; + expect(verificationLabel(run)).toContain("newer observation is uncertain"); + expect(phaseLabel(run)).toBe("Last verified trainer phase"); + expect(verificationLabel({ verification: "unverified" })).toBe("Unverified observation"); + }); + it("preserves historical unknown fields rather than inventing measurements", () => { + expect(executionSummary(null)).toContain("unknown"); + expect(formatBytes(null)).toBe("unknown"); + expect(formatBytes(1048576)).toBe("1.00 MiB"); + expect(verificationLabel({})).toBe("Verified attempt"); + }); + it("uses only safe links, finite samples and bounded curve coordinates", () => { + expect(safeWebURL("javascript:alert(1)")).toBe(null); + expect(safeWebURL(["https://", "user", ":", "secret", "@example.org/file"].join(""))).toBe(null); + expect(safeWebURL("https://example.org/commit/abc")).toContain("https://"); + expect(percentile([NaN, 8, 1, 3], 0.5)).toBe(3); + expect(percentile([], 0.5)).toBe(null); + expect(curve([{ step: 4, phase: "train", metrics: { loss: 2 } }, + { step: 1, phase: "train", metrics: { loss: 3 } }], "loss")).toBe("256,76 4,4"); + }); +}); diff --git a/src/overwatch/frontend/modelRuns.ts b/src/overwatch/frontend/modelRuns.ts new file mode 100644 index 0000000..406e177 --- /dev/null +++ b/src/overwatch/frontend/modelRuns.ts @@ -0,0 +1,81 @@ +/** Compatible cache presentation for v1 and v2 model telemetry; no training runtime. */ +export interface AttemptReceipt { + experiment_id: string; run_id: string; attempt_id: string; attempt_index: number; + parent_attempt_id: string | null; previous_sha256: string | null; sha256: string; +} +export interface ModelExtensions { + serialization: { tokenizer: string; serialization: string; literal_encoding: string }; + source: { source_tree_sha256: string | null; archive_sha256: string | null; git_dirty: boolean | null; + git_status: "verified" | "unavailable" | "error"; package_version: string }; + attempt_lineage: AttemptReceipt[]; lineage_durable: boolean | null; + execution: { prefix_passes: number; branch_passes: number; compute_tokens: number; padding_tokens: number; + useful_forward_tokens: number; questions: number; max_batch_size: number; batch_size_histogram: Record } | null; + resources: { sampled_at: string; interval_seconds: number; rss_bytes: number | null; gpu_allocated_bytes: number | null; + gpu_peak_allocated_bytes: number | null; units: "bytes"; unavailable: string[] } | null; + calibration?: { status: string; method: string | null; split_sha256: string | null; + per_type: Partial> } | null; +} +export interface CollectionSource { + source_id: string; status: string; payload_bytes: number; requests: number; + refreshed_at: string | null; last_successful_refresh_at?: string | null; +} +export interface ModelRun { + experiment_id: string; run_id: string; attempt_id: string; attempt_index: number; + parent_attempt_id: string | null; sequence: number; phase: string; + verification?: "verified" | "last_verified_with_newer_uncertainty" | "unverified"; + unverified_observations?: Array<{ attempt_id: string; attempt_index: number; parent_attempt_id: string | null; + sequence: number; phase: string; heartbeat_at: string; reason: string; source_id: string }>; + extensions?: ModelExtensions | null; collection_sources?: CollectionSource[]; + provider_status: { skypilot: string | null; wandb: string | null }; + association: { status: "local" | "matched" | "unmatched" | "ambiguous"; scheduler: { namespace: string; job_id: number } | null }; + heartbeat_at: string; heartbeat_age_seconds: number; freshness: "fresh" | "stale" | "terminal"; + progress: { optimizer_steps: number; microbatches: number; examples: number; forward_tokens: number; epoch: number | null; + totals: Record; elapsed_seconds: number | null; eta_seconds: number | null; tokens_per_second: number | null }; + metrics: Record; + history: Array<{ step: number; phase: string; metrics: Record }>; + resume: { capable: boolean; checkpoint_sha256: string | null }; + artifacts: Array<{ kind: string; uri: string; sha256: string; size_bytes: number; parent_sha256: string | null; resumable: boolean }>; + provenance: { model: string; backbone: string; backbone_revision: string; tokenizer: string; precision: string; hardware: string; + evidence_class: string; context_limits: { branch: number; aggregate: number }; repository?: string | null; commit?: string | null; + config_sha256?: string | null; data_sha256?: string | null; split_hashes?: Record; seed?: number }; + serving: { requests: number; errors: number; input_tokens: number; forward_tokens: number; output_tokens: number; + questions: number; prefix_reuses: number; latency_ms: number[] }; + recoveries: { total: number | null; infrastructure: number | null; application: number | null }; + cost: { measured_usd: number | null; estimated_usd: number | null; basis: string | null }; + git_url: string | null; wandb_url: string | null; source_ids: string[]; transports: string[]; monitoring_export_failures: number; +} +export function safeWebURL(uri: string): string | null { + try { const url = new URL(uri); return ["https:", "http:"].includes(url.protocol) && !url.username && !url.password ? uri : null; } + catch { return null; } +} +export function curve(history: ModelRun["history"], metric: string): string { + const values = history.filter(r => Number.isFinite(r.metrics[metric])); + if (values.length < 2) return ""; + const minX = Math.min(...values.map(r => r.step)), maxX = Math.max(...values.map(r => r.step)); + const ys = values.map(r => r.metrics[metric]); const minY = Math.min(...ys), maxY = Math.max(...ys); + return values.map(r => `${4 + 252 * (r.step - minX) / Math.max(1, maxX - minX)},${76 - 72 * (r.metrics[metric] - minY) / Math.max(1e-12, maxY - minY)}`).join(" "); +} +export function percentile(values: number[], quantile: number): number | null { + if (!values.length) return null; + const sorted = values.filter(Number.isFinite).sort((a, b) => a - b); + return sorted[Math.min(sorted.length - 1, Math.max(0, Math.ceil(quantile * sorted.length) - 1))] ?? null; +} +export function verificationLabel(run: Pick): string { + if (run.verification === "unverified") return "Unverified observation"; + if (run.verification === "last_verified_with_newer_uncertainty") return "Last verified attempt; newer observation is uncertain"; + return "Verified attempt"; +} +export function phaseLabel(run: Pick): string { + if (run.verification === "unverified") return "Unverified observed phase"; + if (run.verification === "last_verified_with_newer_uncertainty") return "Last verified trainer phase"; + return "Trainer phase"; +} +export function formatBytes(bytes: number | null | undefined): string { + return bytes == null || !Number.isFinite(bytes) ? "unknown" : `${(bytes / 1048576).toFixed(2)} MiB`; +} +export function executionSummary(ext: ModelExtensions | null | undefined): string { + const e = ext?.execution; + return e ? `${e.prefix_passes} prefix passes; ${e.branch_passes} question-batch passes; ${e.questions} questions; largest batch ${e.max_batch_size}` + : "Parallel execution counters unknown in this historical snapshot"; +} diff --git a/src/overwatch/frontend/types.ts b/src/overwatch/frontend/types.ts index e53bbe3..a54ead6 100644 --- a/src/overwatch/frontend/types.ts +++ b/src/overwatch/frontend/types.ts @@ -1,3 +1,5 @@ +import type { ModelRun } from "./modelRuns"; + export interface BillingDay { date: string; [series: string]: string | number | null; @@ -141,6 +143,8 @@ export interface Report { raw_cache_root?: string; billing: Billing; resources: Resource[]; + model_runs?: ModelRun[]; + model_run_warnings?: Array>; config_differences: ConfigDifference[]; warnings: string[]; } diff --git a/src/overwatch/kev_laya_adapter.py b/src/overwatch/kev_laya_adapter.py new file mode 100644 index 0000000..c36b9b2 --- /dev/null +++ b/src/overwatch/kev_laya_adapter.py @@ -0,0 +1,305 @@ +"""Versioned run identity/ordering merge and cache-only presentation. No provider I/O.""" +from __future__ import annotations + +import copy +import hashlib +import json +from datetime import UTC, datetime +from urllib.parse import urlsplit + +from overwatch.kev_laya_contract import timestamp, validate_snapshot + +CACHE_VERSION = "kev_laya/raw/2" +READABLE_CACHE_VERSIONS = {"kev_laya/raw/1", CACHE_VERSION} + + +def _readable_cache_envelope(envelope: object) -> bool: + """Guard the version before set membership: cache JSON may contain any type.""" + return (isinstance(envelope, dict) + and isinstance(envelope.get("schema_version"), str) + and envelope["schema_version"] in READABLE_CACHE_VERSIONS) + + +def key(snapshot: dict) -> str: + return snapshot["experiment_id"] + "\0" + snapshot["run_id"] + + +def digest(snapshot: dict) -> str: + return hashlib.sha256(json.dumps(snapshot, sort_keys=True, separators=(",", ":"), allow_nan=False).encode()).hexdigest() + + +def merge_snapshots(previous: dict | None, collected: dict, *, now: datetime | None = None, retention_days=14) -> dict: + """Keep the highest verified position and separately retain disputed observations. + + The collector owns this envelope. No exporter, network call, or directory walk + is made here. Missing/partial registries are not implicit revocations. + """ + now = now or datetime.now(UTC) + warnings = list(collected.get("warnings", [])) + if previous is not None and not _readable_cache_envelope(previous): + warnings.append({"code": "unsupported_prior_cache_version"}) + previous = None + previous = previous if previous is not None else {} + prior_records = previous.get("records", []) + if not isinstance(prior_records, list): + prior_records = [] + warnings.append({"code": "invalid_prior_cache_records"}) + allowed = set(collected.get("configured_ids", [])) + if not collected.get("registry_complete", True): + for rec in prior_records: + if isinstance(rec, dict) and isinstance(rec.get("source_ids"), list): + allowed.update(x for x in rec["source_ids"] if isinstance(x, str)) + records, observations = {}, [] + for rec in prior_records: + try: + snapshot = validate_snapshot(rec["snapshot"], now=now) + sources = sorted(set(rec["source_ids"]) & allowed) + age = (now - timestamp(snapshot["heartbeat_at"])).total_seconds() + if not isinstance(rec.get("provider_status"), dict) or not isinstance(rec.get("transports"), list): + raise ValueError("invalid cache wrapper") # noqa: TRY004 - Preserve cache warning contract. + if sources and age <= retention_days * 86400: + records[key(snapshot)] = copy.deepcopy(rec) | {"source_ids": sources} + except (ValueError, KeyError, TypeError): + warnings.append({"code": "invalid_prior_cache_record"}) + old_observations = previous.get("observations", []) + if not isinstance(old_observations, list): + old_observations = [] + warnings.append({"code": "invalid_prior_cache_observations"}) + for item in old_observations: + try: + snap = validate_snapshot(item["snapshot"], now=now) + if item["source_id"] in allowed and isinstance(item["reason"], str) and ( + now - timestamp(snap["heartbeat_at"])).total_seconds() <= retention_days * 86400: + observations.append(copy.deepcopy(item)) + except (ValueError, KeyError, TypeError): + warnings.append({"code": "invalid_prior_cache_observation"}) + + def position(snap): + return snap["attempt_index"], snap["sequence"] + + def unverified(candidate, code): + snap = candidate["snapshot"] + observations[:] = [o for o in observations if not (o["source_id"] == candidate["source_id"] and + key(o["snapshot"]) == key(snap) and position(o["snapshot"]) <= position(snap))] + observations.append({"snapshot": copy.deepcopy(snap), "source_id": candidate["source_id"], + "transport": candidate["transport"], "reason": code, "received_at": now.isoformat()}) + + grouped = {} + for candidate in collected.get("records", []): + try: + snapshot = validate_snapshot(candidate["snapshot"], now=now) + if (now - timestamp(snapshot["heartbeat_at"])).total_seconds() > retention_days * 86400: + warnings.append({"code": "expired_snapshot_ignored", "run_id": snapshot["run_id"]}) + continue + if candidate["source_id"] not in allowed or candidate["transport"] not in {"local", "s3", "wandb"}: + raise ValueError("unregistered source/transport") + provider = candidate.get("provider_status") + if provider is not None and (not isinstance(provider, str) or len(provider) > 128): + raise ValueError("invalid provider status") + grouped.setdefault(key(snapshot), []).append(candidate) + except (ValueError, KeyError, TypeError): + warnings.append({"code": "invalid_candidate"}) + for run_key, candidates in grouped.items(): + prior = records.get(run_key) + positions, attempt_ids, conflict = {}, {}, False + for candidate in candidates: + snap = candidate["snapshot"] + pos, identity = position(snap), (snap["attempt_id"], digest(snap)) + conflict |= pos in positions and positions[pos] != identity + positions[pos] = identity + attempt_ids.setdefault(snap["attempt_index"], set()).add(snap["attempt_id"]) + if conflict or any(len(ids) > 1 for ids in attempt_ids.values()): + warnings.append({"run_id": candidates[0]["snapshot"]["run_id"], "code": "conflicting_transport_snapshots"}) + for candidate in candidates: + unverified(candidate, "conflicting_transport_snapshots") + continue + for candidate in sorted(candidates, key=lambda c: position(c["snapshot"])): + snap = candidate["snapshot"] + current = prior["snapshot"] if prior else None + code = None + if current is None: + if not verified_attempt_transition(None, snap): + code = "unverified_attempt_lineage" + elif snap["attempt_index"] < current["attempt_index"]: + code = "older_attempt_ignored" + elif snap["attempt_index"] == current["attempt_index"]: + if snap["attempt_id"] != current["attempt_id"]: + code = "attempt_identity_conflict" + elif snap["sequence"] < current["sequence"]: + code = "older_sequence_ignored" + elif snap["sequence"] == current["sequence"] and digest(snap) != digest(current): + code = "sequence_payload_conflict" + elif timestamp(snap["heartbeat_at"]) < timestamp(current["heartbeat_at"]): + code = "heartbeat_regression" + elif any(snap["progress"][k] < current["progress"][k] for k in ("optimizer_steps", "microbatches", "examples", "forward_tokens")): + code = "progress_regression" + elif any(snap[k] != current[k] for k in ("started_at", "provenance", "scheduler", "wandb")) or current.get("extensions") and any(snap.get("extensions", {}).get(k) != current["extensions"].get(k) + for k in ("source", "serialization", "attempt_lineage")): + code = "attempt_metadata_conflict" + elif current["phase"] in {"completed", "failed", "cancelled"} and snap["phase"] != current["phase"]: + code = "terminal_phase_regression" + elif not verified_attempt_transition(current, snap): + code = "unverified_attempt_lineage" + elif snap["wandb"] != current["wandb"]: + code = "run_wandb_identity_conflict" + if code: + warnings.append({"run_id": snap["run_id"], "code": code}) + if code not in {"older_attempt_ignored", "older_sequence_ignored"}: + unverified(candidate, code) + continue + # A strictly newer, independently verified observation resolves an + # older conflict. Equal-position disagreement is never erased merely + # because one transport is temporarily unavailable. + observations[:] = [o for o in observations if not (key(o["snapshot"]) == key(snap) and + (position(o["snapshot"]) < position(snap) or + (digest(o["snapshot"]) == digest(snap) and o["reason"] != "conflicting_transport_snapshots")))] + source_ids = sorted({candidate["source_id"], *(prior["source_ids"] if prior else [])}) + transports = sorted({candidate["transport"], *(prior["transports"] if prior else [])}) + provider_status = dict(prior.get("provider_status", {}) if prior else {}) + if candidate.get("provider_status") is not None: + provider_status[candidate["transport"]] = candidate["provider_status"] + prior = {"snapshot": copy.deepcopy(snap), "source_ids": source_ids, "transports": transports, + "provider_status": provider_status, "received_at": now.isoformat()} + if prior: + records[run_key] = prior + previous_source_rows = previous.get("collection_sources", []) + if not isinstance(previous_source_rows, list): + previous_source_rows = [] + warnings.append({"code": "invalid_prior_collection_sources"}) + previous_sources = {s["source_id"]: s for s in previous_source_rows + if isinstance(s, dict) and isinstance(s.get("source_id"), str)} + new_sources = {s["source_id"]: s for s in collected.get("sources", []) + if isinstance(s, dict) and isinstance(s.get("source_id"), str)} + collection_sources = [] + for source_id in sorted(allowed): + old = previous_sources.get(source_id, {}) + incoming = new_sources.get(source_id, {"source_id": source_id, "status": "skipped_unavailable", + "refreshed_at": None, "payload_bytes": 0, "requests": 0}) + latest = incoming.get("refreshed_at") or old.get("last_successful_refresh_at") or old.get("refreshed_at") + collection_sources.append(dict(incoming, last_successful_refresh_at=latest)) + if len(observations) > 64: + warnings.append({"code": "unverified_observation_retention_bound", "retained": 64}) + return {"schema_version": CACHE_VERSION, "updated_at": now.isoformat(), + "records": [records[k] for k in sorted(records)], "warnings": warnings[-256:], + "observations": observations[-64:], "collection_sources": collection_sources, + "collection_accounting": collected.get("accounting", {}), + "registry_complete": collected.get("registry_complete", True)} + + +def verified_attempt_transition(current: dict | None, candidate: dict) -> bool: + """An index is not authority: require a trusted observed parent or hashed receipts. + + Snapshot validation already checked each receipt's fields, hash, consecutive + index/parent links, and final binding to this exact current attempt. Receipts + are integrity evidence on trusted transports, not third-party signatures. + """ + receipts = candidate.get("extensions", {}).get("attempt_lineage", []) + if current is None: + return candidate["attempt_index"] == 0 or bool(receipts and receipts[0]["attempt_index"] == 0) + known_receipts = current.get("extensions", {}).get("attempt_lineage", []) + known_hash = known_receipts[-1]["sha256"] if known_receipts else None + if receipts: + for row in receipts: + if row["attempt_index"] == current["attempt_index"]: + return (row["attempt_id"] == current["attempt_id"] and + row["parent_attempt_id"] == current["parent_attempt_id"] and + (known_hash is None or row["sha256"] == known_hash)) + first = receipts[0] + if first["attempt_index"] == current["attempt_index"] + 1: + return first["parent_attempt_id"] == current["attempt_id"] and ( + known_hash is None or first["previous_sha256"] == known_hash) + return False + # Compatible historical direct-parent v1 snapshots remain readable. A v2 + # writer with lost receipt storage may also provide exactly one observed + # parent link, but never skip unobserved intervening attempts without proof. + return candidate["attempt_index"] == current["attempt_index"] + 1 and candidate["parent_attempt_id"] == current["attempt_id"] + +def presentation(envelope: dict, jobs: list | None = None, *, namespace: str | None = None, + now: datetime | None = None, stale_seconds=120) -> dict: + """Interpret only already cached records. Sky status is authoritative, never inferred.""" + now = now or datetime.now(UTC) + if not _readable_cache_envelope(envelope): + return {"runs": [], "warnings": [{"code": "missing_or_invalid_model_run_cache"}]} + jobs = jobs or [] + index = {} + for job in jobs: + raw = job if isinstance(job, dict) else vars(job) + ns = raw.get("scheduler_namespace") or namespace + if ns is not None: + index.setdefault((ns, raw.get("job_id")), []).append(raw) + runs, warnings = [], list(envelope.get("warnings", [])) if isinstance(envelope.get("warnings", []), list) else [{"code": "invalid_cached_warnings"}] + def cache_list(name): + value = envelope.get(name, []) + if not isinstance(value, list): + warnings.append({"code": "invalid_cached_" + name}) + return [] + return value + wb_owners = {} + valid_records = [] + for rec in cache_list("records"): + try: + snap = validate_snapshot(rec["snapshot"], now=now) + if not isinstance(rec.get("provider_status"), dict) or not isinstance(rec.get("source_ids"), list) or not isinstance(rec.get("transports"), list): + raise ValueError("invalid cached wrapper") # noqa: TRY004 - Preserve cache warning contract. + except (ValueError, KeyError, TypeError): + warnings.append({"code": "invalid_cached_snapshot"}) + continue + valid_records.append((rec, snap)) + wb = snap.get("wandb") + if wb: + wb_owners.setdefault(tuple(wb[k] for k in ("entity", "project", "run_id")), set()).add(key(snap)) + observation_by_run = {} + for observation in cache_list("observations"): + try: + validate_snapshot(observation["snapshot"], now=now) + if not all(isinstance(observation.get(k), str) for k in ("source_id", "transport", "reason")): + raise ValueError("invalid unverified wrapper") + observation_by_run.setdefault(key(observation["snapshot"]), []).append(observation) + except (ValueError, KeyError, TypeError): + warnings.append({"code": "invalid_unverified_observation"}) + verified_keys = {key(snap) for _, snap in valid_records} + # New but unverifiable observations must not disappear just because no root + # has reached the collector. They are displayed with explicit uncertainty. + for run_key, observations in observation_by_run.items(): + if run_key not in verified_keys: + newest = max(observations, key=lambda o: (o["snapshot"]["attempt_index"], o["snapshot"]["sequence"])) + valid_records.append(({"provider_status": {}, "source_ids": [newest["source_id"]], + "transports": [newest["transport"]], "unverified_only": True}, newest["snapshot"])) + for rec, snap in valid_records: + link = snap["scheduler"] + candidates = index.get((link["namespace"], link["job_id"]), []) if link else [] + status = "local" if link is None else "matched" if len(candidates) == 1 else "ambiguous" if candidates else "unmatched" + resource = candidates[0] if status == "matched" else None + wb = snap["wandb"] + if wb and len(wb_owners.get(tuple(wb[k] for k in ("entity", "project", "run_id")), set())) > 1: + warnings.append({"code": "wandb_identity_conflict", "run_id": snap["run_id"]}) + age = max(0., (now - timestamp(snap["heartbeat_at"])).total_seconds()) + repo, commit = snap["provenance"]["repository"], snap["provenance"]["commit"] + git_url = f"{repo.rstrip('/')}/commit/{commit}" if repo and commit and urlsplit(repo).scheme == "https" else None + total_recoveries = resource.get("recovery_count") if resource else snap["recoveries"]["total"] + phase = snap["phase"] + pending = observation_by_run.get(key(snap), []) + summaries = [{"attempt_id": o["snapshot"]["attempt_id"], "attempt_index": o["snapshot"]["attempt_index"], + "parent_attempt_id": o["snapshot"]["parent_attempt_id"], "sequence": o["snapshot"]["sequence"], + "phase": o["snapshot"]["phase"], "heartbeat_at": o["snapshot"]["heartbeat_at"], + "reason": o["reason"], "source_id": o["source_id"]} for o in pending] + verification = "unverified" if rec.get("unverified_only") else "last_verified_with_newer_uncertainty" if pending else "verified" + runs.append({"experiment_id": snap["experiment_id"], "run_id": snap["run_id"], "attempt_id": snap["attempt_id"], + "attempt_index": snap["attempt_index"], "parent_attempt_id": snap["parent_attempt_id"], "sequence": snap["sequence"], + "phase": phase, "verification": verification, "unverified_observations": summaries, + "extensions": snap.get("extensions"), + "collection_sources": [v for v in cache_list("collection_sources") if isinstance(v, dict) and v.get("source_id") in rec["source_ids"]], + "provider_status": {"skypilot": str(getattr(resource.get("status"), "value", resource.get("status"))) if resource and resource.get("status") is not None else None, + "wandb": rec["provider_status"].get("wandb")}, + "association": {"status": status, "scheduler": link}, + "heartbeat_at": snap["heartbeat_at"], "heartbeat_age_seconds": age, + "freshness": "terminal" if phase in {"completed", "failed", "cancelled"} else "stale" if age > stale_seconds else "fresh", + "progress": snap["progress"], "metrics": snap["metrics"], "history": snap["history"], "resume": snap["resume"], + "artifacts": snap["artifacts"], "provenance": snap["provenance"], "serving": snap["serving"], + "recoveries": {"total": total_recoveries, "infrastructure": None if resource else snap["recoveries"]["infrastructure"], + "application": None if resource else snap["recoveries"]["application"]}, + "cost": snap["cost"], "git_url": git_url, + "wandb_url": f"https://wandb.ai/{wb['entity']}/{wb['project']}/runs/{wb['run_id']}" if wb else None, + "source_ids": rec["source_ids"], "transports": rec["transports"], + "monitoring_export_failures": snap["monitoring_export_failures"]}) + return {"runs": runs, "warnings": warnings} diff --git a/src/overwatch/kev_laya_contract.py b/src/overwatch/kev_laya_contract.py new file mode 100644 index 0000000..0bc0a51 --- /dev/null +++ b/src/overwatch/kev_laya_contract.py @@ -0,0 +1,305 @@ +"""Kev-Laya telemetry v1/v2: standalone stdlib contract; safe to vendor in Overwatch. + +Copyright 2026 Kev-Laya contributors. SPDX-License-Identifier: Apache-2.0 +No imports from the model, torch, training, cloud SDKs or Overwatch. +""" +from __future__ import annotations + +import hashlib +import json +import math +import re +from datetime import UTC, datetime +from urllib.parse import urlsplit + +SCHEMA_VERSION = 2 +SUPPORTED_VERSIONS = {1, 2} +MAX_ATTEMPTS = 64 +MAX_SNAPSHOT_BYTES = 262144 +MAX_HISTORY = 128 +MAX_ARTIFACTS = 32 +PHASES = {"prepare", "train", "calibrate", "evaluate", "serve", "completed", "failed", "cancelled"} +METRICS = {"loss/total", "loss/ce", "loss/policy_gradient", "loss/ordinal", "reward/proper", + "validation/nll", "validation/brier", "validation/ece", "validation/accuracy", "validation/ordinal_mae", + "gradient/norm", "resource/rss_bytes", "resource/gpu_peak_bytes", "learning_rate"} +COUNTERS = {"optimizer_steps", "microbatches", "examples", "forward_tokens"} +IDENT = re.compile(r"^[A-Za-z0-9][A-Za-z0-9_.:/-]{0,159}$") +HEX = re.compile(r"^[a-f0-9]{64}$") +TOP = {"schema_version", "framework", "framework_version", "experiment_id", "run_id", "attempt_id", "attempt_index", + "parent_attempt_id", "sequence", "started_at", "updated_at", "heartbeat_at", "phase", "scheduler", "wandb", + "progress", "metrics", "history", "provenance", "artifacts", "serving", "resume", "recoveries", "cost", + "monitoring_export_failures"} + + +class TelemetryError(ValueError): + pass + + +def require(condition: bool, message: str): + if not condition: + raise TelemetryError(message) + + +def identifier(value, name="identifier"): + require(isinstance(value, str) and IDENT.fullmatch(value) is not None, f"invalid {name}") + + +def number(value, name, *, integer=False, nullable=False, minimum=0): + if value is None and nullable: + return + require(not isinstance(value, bool) and isinstance(value, int if integer else (int, float)), f"invalid {name}") + require(math.isfinite(value) and value >= minimum, f"invalid {name}") + + +def fields(obj, allowed, required=None): + require(isinstance(obj, dict), "object required") + require(not (set(obj) - set(allowed)), "unknown fields") + require(not (set(allowed if required is None else required) - set(obj)), "missing fields") + + +def timestamp(value): + require(isinstance(value, str) and len(value) <= 40, "invalid timestamp") + try: + result = datetime.fromisoformat(value) + except ValueError as exc: + raise TelemetryError("invalid timestamp") from exc + require(result.tzinfo is not None and result.utcoffset() is not None, "timezone required") + return result.astimezone(UTC) + + +def uri(value): + require(isinstance(value, str) and len(value) <= 2048, "invalid URI") + parsed = urlsplit(value) + require(parsed.scheme in {"https", "http", "file", "s3", "gs"}, "unsupported URI scheme") + require(not parsed.username and not parsed.password and not parsed.query and not parsed.fragment, + "credential/query/fragment-bearing URI forbidden") + require(not any(ord(c) < 32 for c in value), "control character in URI") + + +def metrics(obj): + fields(obj, METRICS, required=set()) + for name, value in obj.items(): + number(value, name, minimum=-1e30 if name.startswith(("reward/", "loss/policy", "loss/total")) else 0) + + +def validate_snapshot(data: dict, *, now: datetime | None = None) -> dict: + version = data.get("schema_version") + require(type(version) is int and version in SUPPORTED_VERSIONS, "schema version mismatch") + fields(data, TOP | ({"extensions"} if version == 2 else set())) + require(data["framework"] == "kev_laya", "framework mismatch") + require(isinstance(data["framework_version"], str) and re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9_.+:/-]{0,159}", data["framework_version"]), "invalid framework version") + for key in ("experiment_id", "run_id", "attempt_id"): + identifier(data[key], key) + for key in ("attempt_index", "sequence", "monitoring_export_failures"): + number(data[key], key, integer=True) + if data["parent_attempt_id"] is not None: + identifier(data["parent_attempt_id"]) + require(data["parent_attempt_id"] != data["attempt_id"], "attempt cannot be its own parent") + require((data["attempt_index"] == 0) == (data["parent_attempt_id"] is None), "attempt lineage mismatch") + start, updated, heartbeat = (timestamp(data[k]) for k in ("started_at", "updated_at", "heartbeat_at")) + require(start <= heartbeat <= updated, "timestamp ordering mismatch") + if now is not None: + require((updated - now).total_seconds() <= 30, "future snapshot") + require(data["phase"] in PHASES, "invalid phase") + scheduler = data["scheduler"] + if scheduler is not None: + fields(scheduler, {"provider", "namespace", "job_id"}) + require(scheduler["provider"] == "skypilot", "unsupported scheduler") + identifier(scheduler["namespace"]) + number(scheduler["job_id"], "scheduler job_id", integer=True) + wandb = data["wandb"] + if wandb is not None: + fields(wandb, {"entity", "project", "run_id"}) + for val in wandb.values(): + identifier(val) + require("/" not in val, "W&B ID component contains slash") + progress = data["progress"] + fields(progress, COUNTERS | {"epoch", "totals", "elapsed_seconds", "eta_seconds", "tokens_per_second"}) + for key in COUNTERS: + number(progress[key], key, integer=True) + fields(progress["totals"], COUNTERS, required=set()) + for key, value in progress["totals"].items(): + number(value, key, integer=True, nullable=True) + if value is not None: + require(progress[key] <= value, "counter exceeds declared total") + for key in ("epoch", "elapsed_seconds", "eta_seconds", "tokens_per_second"): + number(progress[key], key, nullable=True) + metrics(data["metrics"]) + require(isinstance(data["history"], list) and len(data["history"]) <= MAX_HISTORY, "history bound exceeded") + previous_step = -1 + for row in data["history"]: + fields(row, {"step", "phase", "metrics"}) + number(row["step"], "history step", integer=True) + require(row["step"] >= previous_step, "history order invalid") + previous_step = row["step"] + require(row["phase"] in PHASES, "invalid history phase") + metrics(row["metrics"]) + provenance = data["provenance"] + pfields = {"model", "backbone", "backbone_revision", "tokenizer", "config_sha256", "data_sha256", "split_hashes", + "seed", "repository", "commit", "precision", "hardware", "context_limits", "evidence_class"} + fields(provenance, pfields) + for key in ("model", "backbone", "backbone_revision", "tokenizer", "precision", "hardware", "evidence_class"): + require(isinstance(provenance[key], str) and len(provenance[key]) <= 240, "invalid provenance string") + for key in ("config_sha256", "data_sha256"): + if version == 2 and provenance[key] is None: + continue + require(isinstance(provenance[key], str) and HEX.fullmatch(provenance[key]) is not None, "invalid hash") + fields(provenance["split_hashes"], {"train", "development", "calibration", "test"}, required=set()) + for val in provenance["split_hashes"].values(): + require(isinstance(val, str) and HEX.fullmatch(val) is not None, "invalid split hash") + number(provenance["seed"], "seed", integer=True) + if provenance["repository"] is not None: + uri(provenance["repository"]) + if provenance["commit"] is not None: + require(isinstance(provenance["commit"], str) and re.fullmatch(r"[a-f0-9]{40,64}", provenance["commit"]) is not None, "invalid commit") + fields(provenance["context_limits"], {"branch", "aggregate"}) + for value in provenance["context_limits"].values(): + number(value, "context limit", integer=True, minimum=1) + require(isinstance(data["artifacts"], list) and len(data["artifacts"]) <= MAX_ARTIFACTS, "artifact bound exceeded") + for artifact in data["artifacts"]: + fields(artifact, {"kind", "uri", "sha256", "size_bytes", "parent_sha256", "resumable"}) + require(artifact["kind"] in {"checkpoint", "configuration", "evaluation", "manifest"}, "artifact kind invalid") + uri(artifact["uri"]) + for key in ("sha256", "parent_sha256"): + require((key == "parent_sha256" and artifact[key] is None) or + (isinstance(artifact[key], str) and HEX.fullmatch(artifact[key]) is not None), "invalid artifact hash") + number(artifact["size_bytes"], "artifact bytes", integer=True) + require(type(artifact["resumable"]) is bool, "invalid resumable flag") + serving = data["serving"] + sfields = {"requests", "errors", "input_tokens", "forward_tokens", "output_tokens", "questions", "prefix_reuses", "latency_ms"} + fields(serving, sfields) + for key in sfields - {"latency_ms"}: + number(serving[key], key, integer=True) + require(serving["errors"] <= serving["requests"], "serving errors exceed requests") + require(isinstance(serving["latency_ms"], list) and len(serving["latency_ms"]) <= MAX_HISTORY, "latency bound exceeded") + for value in serving["latency_ms"]: + number(value, "latency") + fields(data["resume"], {"capable", "checkpoint_sha256"}) + require(type(data["resume"]["capable"]) is bool, "resume flag invalid") + resume_hash = data["resume"]["checkpoint_sha256"] + require(resume_hash is None or (isinstance(resume_hash, str) and HEX.fullmatch(resume_hash) is not None), "resume hash invalid") + require(not data["resume"]["capable"] or resume_hash is not None, "resume capability needs checkpoint") + fields(data["recoveries"], {"total", "infrastructure", "application"}) + for key, value in data["recoveries"].items(): + number(value, key, nullable=True, integer=True) + fields(data["cost"], {"measured_usd", "estimated_usd", "basis"}) + for key in ("measured_usd", "estimated_usd"): + number(data["cost"][key], key, nullable=True) + require(data["cost"]["basis"] is None or data["cost"]["basis"] in {"provider_billing", "configured_hourly_rate", "metered_local"}, "unknown cost basis") + if version == 2: + validate_extensions(data["extensions"], data) + try: + encoded = json.dumps(data, ensure_ascii=False, allow_nan=False).encode() + except (ValueError, TypeError) as exc: + raise TelemetryError("snapshot is not finite JSON") from exc + require(len(encoded) <= MAX_SNAPSHOT_BYTES, "snapshot byte bound exceeded") + return data + + +def decode_snapshot(raw: bytes, *, now: datetime | None = None) -> dict: + require(len(raw) <= MAX_SNAPSHOT_BYTES, "snapshot byte bound exceeded") + def pairs(items): + obj = {} + for key, value in items: + require(key not in obj, "duplicate JSON key") + obj[key] = value + return obj + try: + data = json.loads(raw, object_pairs_hook=pairs) + except (ValueError, UnicodeError) as exc: + raise TelemetryError("invalid telemetry JSON") from exc + return validate_snapshot(data, now=now) + + +ATTEMPT_FIELDS = {"experiment_id", "run_id", "attempt_id", "attempt_index", "parent_attempt_id", "previous_sha256", "sha256"} + + +def attempt_digest(record: dict) -> str: + content = {k: v for k, v in record.items() if k != "sha256"} + return hashlib.sha256(json.dumps(content, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode()).hexdigest() + + +def validate_attempt_records(records: list, experiment_id: str, run_id: str) -> None: + require(isinstance(records, list) and len(records) <= MAX_ATTEMPTS, "attempt receipts bound exceeded") + previous = None + seen = set() + for record in records: + fields(record, ATTEMPT_FIELDS) + require(record["experiment_id"] == experiment_id and record["run_id"] == run_id, "receipt run identity mismatch") + identifier(record["attempt_id"]) + require(record["attempt_id"] not in seen, "duplicate attempt receipt") + seen.add(record["attempt_id"]) + number(record["attempt_index"], "attempt index", integer=True) + require(record["sha256"] == attempt_digest(record), "attempt receipt hash mismatch") + if record["attempt_index"] == 0: + require(record["parent_attempt_id"] is None and record["previous_sha256"] is None, "root attempt receipt mismatch") + else: + identifier(record["parent_attempt_id"]) + require(record["parent_attempt_id"] != record["attempt_id"], "self parent receipt") + require(isinstance(record["previous_sha256"], str) and HEX.fullmatch(record["previous_sha256"]), "missing receipt predecessor hash") + if previous is not None: + require(record["attempt_index"] == previous["attempt_index"] + 1 and + record["parent_attempt_id"] == previous["attempt_id"] and + record["previous_sha256"] == previous["sha256"], "nonconsecutive receipt chain") + previous = record + + +def validate_extensions(ext: dict, snapshot: dict) -> None: + fields(ext, {"serialization", "source", "attempt_lineage", "lineage_durable", "execution", "resources", "calibration"}, + required={"serialization", "source", "attempt_lineage", "lineage_durable", "execution", "resources"}) + calibration = ext.get("calibration") + if calibration is not None: + fields(calibration, {"status", "method", "split_sha256", "per_type"}) + require(isinstance(calibration["status"], str) and len(calibration["status"]) <= 80, "invalid calibration status") + require(calibration["method"] is None or isinstance(calibration["method"], str) and len(calibration["method"]) <= 80, "invalid calibration method") + require(calibration["split_sha256"] is None or isinstance(calibration["split_sha256"], str) and HEX.fullmatch(calibration["split_sha256"]), "invalid calibration split hash") + fields(calibration["per_type"], {"choice", "score", "noul"}, required=set()) + for row in calibration["per_type"].values(): + fields(row, {"temperature", "count", "status", "before_nll", "after_nll"}) + number(row["temperature"], "temperature", minimum=.2) + require(row["temperature"] <= 5, "temperature outside fitted bounds") + number(row["count"], "calibration count", integer=True) + require(isinstance(row["status"], str) and len(row["status"]) <= 80, "invalid fit status") + for name in ("before_nll", "after_nll"): + number(row[name], name, nullable=True) + + require(ext["lineage_durable"] is None or type(ext["lineage_durable"]) is bool, "invalid lineage durability") + fields(ext["serialization"], {"tokenizer", "serialization", "literal_encoding"}) + for value in ext["serialization"].values(): + require(isinstance(value, str) and len(value) <= 240, "invalid serialization identity") + require(ext["serialization"]["tokenizer"] == snapshot["provenance"]["tokenizer"], "serialization tokenizer mismatch") + source = ext["source"] + fields(source, {"source_tree_sha256", "archive_sha256", "git_dirty", "git_status", "package_version"}) + for key in ("source_tree_sha256", "archive_sha256"): + require(source[key] is None or (isinstance(source[key], str) and HEX.fullmatch(source[key])), "invalid source hash") + require(source["git_dirty"] is None or type(source["git_dirty"]) is bool, "invalid dirty flag") + require(source["git_status"] in {"verified", "unavailable", "error"}, "invalid git source status") + require(isinstance(source["package_version"], str) and len(source["package_version"]) <= 80, "invalid package version") + records = ext["attempt_lineage"] + validate_attempt_records(records, snapshot["experiment_id"], snapshot["run_id"]) + if records: + for key in ("attempt_id", "attempt_index", "parent_attempt_id"): + require(records[-1][key] == snapshot[key], "receipt/current attempt mismatch") + execution = ext["execution"] + if execution is not None: + keys = {"prefix_passes", "branch_passes", "compute_tokens", "padding_tokens", "max_batch_size", "batch_size_histogram", "useful_forward_tokens", "questions"} + fields(execution, keys) + for key in keys - {"batch_size_histogram"}: + number(execution[key], key, integer=True) + hist = execution["batch_size_histogram"] + require(isinstance(hist, dict) and len(hist) <= 1024, "batch histogram bound") + for key, val in hist.items(): + require(isinstance(key, str) and key.isdigit() and 1 <= int(key) <= 1024, "invalid batch size") + number(val, "batch count", integer=True) + require(sum(hist.values()) == execution["branch_passes"], "branch pass/histogram mismatch") + require(sum(int(k)*v for k,v in hist.items()) == execution["questions"], "question count/histogram mismatch") + require(execution["compute_tokens"] == execution["useful_forward_tokens"] + execution["padding_tokens"], "compute token accounting mismatch") + resource = ext["resources"] + if resource is not None: + fields(resource, {"sampled_at", "interval_seconds", "rss_bytes", "gpu_allocated_bytes", "gpu_peak_allocated_bytes", "units", "unavailable"}) + timestamp(resource["sampled_at"]) + number(resource["interval_seconds"], "sampling interval", minimum=0.001) + for key in ("rss_bytes", "gpu_allocated_bytes", "gpu_peak_allocated_bytes"): + number(resource[key], key, nullable=True, integer=True) + require(resource["units"] == "bytes", "invalid resource units") + require(isinstance(resource["unavailable"], list) and set(resource["unavailable"]) <= {"rss", "cuda"}, "invalid unavailable resource") diff --git a/src/overwatch/kev_laya_lock.py b/src/overwatch/kev_laya_lock.py new file mode 100644 index 0000000..33a6d69 --- /dev/null +++ b/src/overwatch/kev_laya_lock.py @@ -0,0 +1,39 @@ +"""Cross-process cache transaction lock; separate from the trainer's atomic export.""" + +import os +from contextlib import contextmanager +from pathlib import Path + + +@contextmanager +def collector_lock(path: Path): + path = Path(path) + path.parent.mkdir(parents=True, exist_ok=True) + descriptor = os.open(path, os.O_CREAT | os.O_RDWR, 0o600) + locked = False + try: + if os.name == "nt": + import msvcrt + + if os.fstat(descriptor).st_size == 0: + os.write(descriptor, b"\0") + os.lseek(descriptor, 0, os.SEEK_SET) + msvcrt.locking(descriptor, msvcrt.LK_NBLCK, 1) + else: + import fcntl + + fcntl.flock(descriptor, fcntl.LOCK_EX | fcntl.LOCK_NB) + locked = True + yield + finally: + if locked: + if os.name == "nt": + import msvcrt + + os.lseek(descriptor, 0, os.SEEK_SET) + msvcrt.locking(descriptor, msvcrt.LK_UNLCK, 1) + else: + import fcntl + + fcntl.flock(descriptor, fcntl.LOCK_UN) + os.close(descriptor) diff --git a/src/overwatch/providers/kev_laya.py b/src/overwatch/providers/kev_laya.py new file mode 100644 index 0000000..b3d7455 --- /dev/null +++ b/src/overwatch/providers/kev_laya.py @@ -0,0 +1,353 @@ +"""Budgeted structured transports. Only this collector reads registered exports. + +Local/S3 exposed stream bytes and the entire W&B JSON response body are charged +before another read or fetch. W&B envelope bytes are conservatively included; +TLS, headers, SDK credential discovery and other opaque transport overhead are +not claimed as measured payload. No implicit SDK pagination or retry loops. +""" +from __future__ import annotations + +import base64 +import json +import math +import os +import stat +import time +from dataclasses import dataclass +from datetime import UTC, datetime +from pathlib import Path +from typing import Any +from urllib.parse import urlsplit +from urllib.request import HTTPRedirectHandler, Request, build_opener + +from overwatch.kev_laya_contract import MAX_SNAPSHOT_BYTES, decode_snapshot, identifier + +MAX_SOURCES = 512 +MAX_TOTAL_BYTES = 16 * 1024 * 1024 + + +@dataclass(frozen=True) +class CollectionLimits: + payload_bytes: int = MAX_TOTAL_BYTES + requests: int = 512 + pages: int = 8 + seconds: float = 15.0 + stream_reads: int = 4096 + def __post_init__(self): + if any(type(x) is not int or x < 1 for x in (self.payload_bytes, self.requests, self.pages, self.stream_reads)): + raise ValueError('collection counts must be positive integers') + if not math.isfinite(self.seconds) or self.seconds < 0: + raise ValueError('invalid collection deadline') + + +class BudgetStop(RuntimeError): + pass + + +class Budget: + def __init__(self, limits, clock, *, started=None): + self.limits, self.clock, self.start = limits, clock, clock() if started is None else started + self.bytes = self.requests = self.pages = self.reads = 0 + @property + def remaining(self): + return self.limits.payload_bytes - self.bytes + def check(self): + if self.clock() - self.start >= self.limits.seconds: + raise BudgetStop('deadline') + if self.remaining <= 0: + raise BudgetStop('payload_budget') + def request(self, *, page=False): + self.check() + if self.requests >= self.limits.requests: + raise BudgetStop('request_budget') + if page and self.pages >= self.limits.pages: + raise BudgetStop('page_budget') + self.requests += 1 + self.pages += int(page) + def timeout(self): + self.check() + return max(.001, min(3., self.limits.seconds - (self.clock() - self.start))) + def read(self, stream, *, known_length=None, maximum=MAX_SNAPSHOT_BYTES): + self.check() + if known_length is not None: + if type(known_length) is not int or known_length < 0: + raise ValueError('invalid declared payload length') + if known_length > maximum: + raise ValueError('payload exceeds snapshot bound') + goal = known_length if known_length is not None else maximum + 1 + cap = min(goal, self.remaining) + chunks, used, eof = [], 0, False + while used < cap: + self.check() + if self.reads >= self.limits.stream_reads: + raise BudgetStop('stream_read_budget') + count = min(32768, cap - used, self.remaining) + self.reads += 1 + raw = stream.read(count) + if not isinstance(raw, bytes): + raise ValueError('transport violated byte-read contract') # noqa: TRY004 - Preserve transport error contract. + self.bytes += len(raw) # Charge even a misbehaving injected transport; do not hide actual I/O. + if len(raw) > count: + raise ValueError('transport violated bounded byte-read contract') + used += len(raw) + if not raw: + eof = True + break + chunks.append(raw) + if known_length is not None: + if used != known_length: + if self.remaining == 0: + raise BudgetStop('payload_budget') + raise ValueError('short declared payload') + elif not eof: + if used > maximum: + raise ValueError('snapshot overflow probe detected excess bytes') + raise BudgetStop('payload_budget') # Completeness unknown, no uncharged probe. + raw = b''.join(chunks) + if len(raw) > maximum: + raise ValueError('snapshot byte bound exceeded') + return raw + + +def registry_path() -> Path: + return Path(os.environ.get('OVERWATCH_KEV_LAYA_REGISTRY', str(Path.home() / '.config/overwatch/kev-laya-sources.json'))) + + +def unique_json(raw): + def pairs(values): + obj = {} + for k, v in values: + if k in obj: + raise ValueError('duplicate JSON key') + obj[k] = v + return obj + return json.loads(raw, object_pairs_hook=pairs) + + +def validate_registry(registry): + if not isinstance(registry, dict) or set(registry) != {'schema_version', 'sources'} or type(registry['schema_version']) is not int or registry['schema_version'] != 1: + raise ValueError('invalid Kev-Laya registry version/fields') + sources = registry['sources'] + if not isinstance(sources, list) or len(sources) > MAX_SOURCES: + raise ValueError('registry source bound exceeded') + seen = set() + for source in sources: + if not isinstance(source, dict): + raise ValueError('registry source must be an object') # noqa: TRY004 - Preserve registry error contract. + source_id = source.get('id') + identifier(source_id, 'source ID') + if source_id in seen: + raise ValueError('duplicate registry source ID') + seen.add(source_id) + transport = source.get('transport') + if transport == 'local': + if set(source) != {'id', 'transport', 'path'} or not isinstance(source['path'], str) or not Path(source['path']).is_absolute(): + raise ValueError('invalid local source; absolute registered file required') + elif transport == 's3': + if set(source) != {'id', 'transport', 'bucket', 'key'}: + raise ValueError('invalid S3 source fields') + for k in ('bucket', 'key'): + val = source[k] + if not isinstance(val, str) or not val or len(val) > 1024 or any(ord(c) < 32 for c in val): + raise ValueError('invalid S3 identifier') + if '/' in source['bucket'] or '?' in source['bucket']: + raise ValueError('bucket is not an identifier') + elif transport == 'wandb': + if set(source) != {'id', 'transport', 'entity', 'project', 'limit'} or type(source['limit']) is not int or not 1 <= source['limit'] <= MAX_SOURCES: + raise ValueError('invalid W&B source fields/limit') + for k in ('entity', 'project'): + identifier(source[k], k) + if '/' in source[k]: + raise ValueError('invalid W&B component') + else: + raise ValueError('unknown telemetry transport') + return sources + + +class NoRedirects(HTTPRedirectHandler): + def redirect_request(self, req, fp, code, msg, headers, newurl): + raise ValueError('W&B redirects are disabled; request count and credential scope are explicit') + + +def open_regular(path: Path): + """Open before fstat without a FIFO race; symlinks are rejected where supported.""" + flags = os.O_RDONLY | getattr(os, 'O_NONBLOCK', 0) | getattr(os, 'O_NOFOLLOW', 0) | getattr(os, 'O_BINARY', 0) + fd = os.open(path, flags) + try: + details = os.fstat(fd) + if not stat.S_ISREG(details.st_mode): + raise ValueError('registered source must be a regular file') + stream = os.fdopen(fd, 'rb') + except BaseException: + os.close(fd) + raise + return stream, details.st_size + + +class WandbPages: + """Explicit, streamed GraphQL pages; no eager public-SDK iterator hydration. + + fetch_snapshot_page is also the bounded SDK-double interface used by tests. + The SDK's ordinary lazy iterator does not expose a pre-read byte cap and is + deliberately not used by this transport. Each call makes one HTTP request. + """ + def fetch_snapshot_page(self, *, entity, project, cursor, first, timeout): + token = os.environ.get('WANDB_API_KEY') + if not token: + raise ValueError('explicit W&B read authentication unavailable') + base = os.environ.get('WANDB_BASE_URL', 'https://api.wandb.ai').rstrip('/') + parsed = urlsplit(base) + if parsed.scheme != 'https' or not parsed.hostname or parsed.username or parsed.password or parsed.query or parsed.fragment: + raise ValueError('invalid W&B base URL') + query = '''query KevLayaSnapshots($entity: String!, $project: String!, $first: Int!, $after: String, $filters: JSONString) { + project(name: $project, entityName: $entity) { + runs(first: $first, after: $after, filters: $filters, order: "-updatedAt") { + edges { cursor node { name state summaryMetrics } } + pageInfo { hasNextPage endCursor } + } + } + }''' + body = json.dumps({'query': query, 'variables': {'entity': entity, 'project': project, + 'first': first, 'after': cursor, + 'filters': json.dumps({'config.framework': 'kev_laya', 'config.telemetry_schema_version': {'$in': [1, 2]}})}}).encode() + auth = base64.b64encode(('api:' + token).encode()).decode() + response = build_opener(NoRedirects()).open(Request(base + '/graphql', data=body, + headers={'Authorization': 'Basic ' + auth, 'Content-Type': 'application/json', 'Accept-Encoding': 'identity'}), timeout=timeout) + # Until the body is returned, this method owns it. Header failures must + # not leak an unread response outside the collector's cleanup scope. + try: + length = response.headers.get('Content-Length') + declared_length = int(length) if length is not None else None + except BaseException: + response.close() + raise + return {'Body': response, 'ContentLength': declared_length} + + +def collect_snapshots(path: Path | None = None, *, wandb_api=None, s3_client=None, + limits: CollectionLimits | None = None, clock=time.monotonic) -> dict[str, Any]: + started = clock() + limits = limits or CollectionLimits() + path = Path(path) if path is not None else registry_path() + if not path.exists(): + # Missing is unavailable, NOT an explicit empty registration/revocation. + return {'records': [], 'warnings': [{'code': 'registry_unavailable'}], 'configured_ids': [], + 'registry_complete': False, 'complete': False, 'sources': [], 'accounting': {}} + registry_stream, _ = open_regular(path) + with registry_stream: + raw_registry = registry_stream.read(131073) + if len(raw_registry) > 131072: + raise ValueError('Kev-Laya registry exceeds 128 KiB') + sources = validate_registry(unique_json(raw_registry)) # All validation BEFORE payload I/O. + budget = Budget(limits, clock, started=started) + cached_s3_client = s3_client + records, warnings, statuses = [], [], [] + now = datetime.now(UTC) + stop_reason = None + + def append(raw, source, provider_status=None, wb_identity=None): + snapshot = decode_snapshot(raw, now=now) + if wb_identity is not None and snapshot['wandb'] != wb_identity: + raise ValueError('W&B transport identity conflicts with snapshot') + records.append({'snapshot': snapshot, 'source_id': source['id'], 'transport': source['transport'], 'provider_status': provider_status}) + + for source in sources: + source_id = source['id'] + before_bytes, before_requests, before_records = budget.bytes, budget.requests, len(records) + status, error_type = 'ok', None + try: + if stop_reason: + raise BudgetStop(stop_reason) + budget.check() + transport = source['transport'] + if transport == 'local': + budget.request() + stream, size = open_regular(Path(source['path'])) + with stream: + raw = budget.read(stream, known_length=size) + append(raw, source) + elif transport == 's3': + budget.request() + client = cached_s3_client + if client is None: + import boto3 + from botocore.config import Config + timeout = budget.timeout() + client = boto3.client('s3', config=Config(connect_timeout=timeout, read_timeout=timeout, + retries={'total_max_attempts': 1})) + cached_s3_client = client + budget.check() + response = client.get_object(Bucket=source['bucket'], Key=source['key']) + body = response['Body'] + try: + raw = budget.read(body, known_length=response.get('ContentLength')) + finally: + body.close() + append(raw, source) + else: + api = wandb_api if wandb_api is not None else WandbPages() + if not hasattr(api, 'fetch_snapshot_page'): + raise ValueError('bounded W&B page transport required; eager SDK iterators are unsupported') + cursor, seen, count = None, set(), 0 + while count < source['limit']: + budget.request(page=True) + first = min(32, source['limit'] - count, max(1, budget.remaining // MAX_SNAPSHOT_BYTES)) + response = api.fetch_snapshot_page(entity=source['entity'], project=source['project'], + cursor=cursor, first=first, timeout=budget.timeout()) + body = response['Body'] + try: + page_raw = budget.read(body, known_length=response.get('ContentLength'), maximum=budget.remaining) + finally: + body.close() + page = unique_json(page_raw) + if page.get('errors'): + raise ValueError('W&B GraphQL errors') + runs = page['data']['project']['runs'] + edges = runs['edges'] + if not isinstance(edges, list) or len(edges) > first: + raise ValueError('W&B page exceeded requested node count') + page_info = runs.get('pageInfo') + if not isinstance(page_info, dict) or type(page_info.get('hasNextPage')) is not bool: + raise ValueError('invalid W&B page completion flag') + has_next = page_info['hasNextPage'] + next_cursor = page_info.get('endCursor') + if has_next and (not isinstance(next_cursor, str) or not next_cursor + or next_cursor in seen or not edges): + raise ValueError('invalid or repeating W&B cursor') + # Validate page completeness before accepting this page's + # records. Prior valid pages remain available on failure. + for edge in edges: + node = edge['node'] + summary = node['summaryMetrics'] + if isinstance(summary, str): + summary = unique_json(summary) + snapshot = summary.get('kev_laya/snapshot') + count += 1 + if snapshot is not None: + identity = {'entity': source['entity'], 'project': source['project'], 'run_id': node['name']} + # Entire containing response was already charged; do not double count. + append(json.dumps(snapshot, allow_nan=False, ensure_ascii=False).encode(), source, node['state'], identity) + if not has_next: + break + cursor = next_cursor + seen.add(cursor) + if count >= source['limit']: + status = 'partial_limit' + warnings.append({'source_id': source_id, 'code': 'source_listing_limit'}) + except BudgetStop as exc: + stop_reason = str(exc) + status = 'partial_' + stop_reason if len(records) > before_records else 'skipped_' + stop_reason + warnings.append({'source_id': source_id, 'code': stop_reason}) + except Exception as exc: # noqa: BLE001 - A failed source must not stop collection of other sources. + status, error_type = 'error', type(exc).__name__ + warnings.append({'source_id': source_id, 'code': 'source_unavailable_or_invalid', 'error_type': error_type}) + statuses.append({'source_id': source_id, 'status': status, 'payload_bytes': budget.bytes - before_bytes, + 'requests': budget.requests - before_requests, 'refreshed_at': now.isoformat() if status == 'ok' else None}) + return {'records': records, 'warnings': warnings, 'configured_ids': [s['id'] for s in sources], + 'registry_complete': True, 'complete': all(s['status'] == 'ok' for s in statuses), 'sources': statuses, + 'accounting': {'payload_bytes': budget.bytes, 'payload_limit': budget.limits.payload_bytes, + 'requests': budget.requests, 'pages': budget.pages, 'stream_reads': budget.reads, + 'registry_bytes': len(raw_registry), 'registry_limit': 131072, + 'elapsed_seconds': max(0., clock() - budget.start), 'stop_reason': stop_reason, + 'payload_convention': 'local/S3 exposed bytes; entire W&B JSON response charged including envelope', + 'transport_overhead_bytes': None, 'deadline_kind': 'cooperative checks before calls/reads plus bounded network timeouts; in-flight I/O may finish after deadline'}} diff --git a/src/overwatch/raw_cache.py b/src/overwatch/raw_cache.py index 0dd5842..538cac7 100644 --- a/src/overwatch/raw_cache.py +++ b/src/overwatch/raw_cache.py @@ -4,6 +4,7 @@ import json import math +import os import shutil import tempfile from datetime import UTC, date, datetime @@ -15,7 +16,7 @@ from overwatch.utils import isoformat -RAW_CACHE_ROOT = Path.home() / ".cache" / "overwatch" / "raw-v1" +RAW_CACHE_ROOT = Path(os.environ.get("OVERWATCH_RAW_CACHE_ROOT", str(Path.home() / ".cache" / "overwatch" / "raw-v1"))).expanduser() def raw_cache_path(*parts: str) -> Path: @@ -108,3 +109,24 @@ def read_json(path: Path, default: Any = None) -> Any: except (OSError, json.JSONDecodeError) as error: logger.warning("Ignoring unreadable cache snapshot {}: {}", path, error) return default + + +def model_runs_cache_path() -> Path: + """Dedicated versioned model cache; legacy raw-v1 resources are unchanged.""" + return raw_cache_path("global", "kev_laya", "runs-v2.json") + + +def read_model_runs_cache() -> dict: + """Cache-only migration read. Never reread producer exports during rendering. + + Existing v1 files are immutable migration inputs; the collector writes v2. + A corrupt v2 does NOT silently roll the current view back to an old v1. + """ + path = model_runs_cache_path() + if not path.exists(): + path = raw_cache_path("global", "kev_laya", "runs-v1.json") + value = read_json(path) + if isinstance(value, dict) and isinstance(value.get("schema_version"), str) and value["schema_version"] in {"kev_laya/raw/1", "kev_laya/raw/2"}: + return value + warning = [{"code": "model_run_cache_unreadable_or_incompatible", "source": "cache"}] if path.exists() else [] + return {"schema_version": "kev_laya/raw/2", "records": [], "observations": [], "warnings": warning} diff --git a/src/overwatch/report.py b/src/overwatch/report.py index e2a9562..d1de913 100644 --- a/src/overwatch/report.py +++ b/src/overwatch/report.py @@ -551,3 +551,12 @@ def build_cluster_record(cluster: Any, zymtrace_project_id: str) -> dict[str, An "gcp_bucket": None, }, } + + +def build_model_runs_report(envelope: dict, jobs: list, *, namespace: str | None = None) -> dict: + """Dedicated model records; no invented scheduler resources or Flow counters.""" + from overwatch.constants import KEV_LAYA_STALE_SECONDS + from overwatch.kev_laya_adapter import presentation + + return presentation(envelope, jobs, namespace=namespace, + stale_seconds=KEV_LAYA_STALE_SECONDS) diff --git a/src/overwatch/report_service.py b/src/overwatch/report_service.py index 745ca93..1adf843 100644 --- a/src/overwatch/report_service.py +++ b/src/overwatch/report_service.py @@ -16,6 +16,7 @@ from overwatch.providers.wandb_flow import match_skypilot_jobs from overwatch.report import ( build_cluster_record, + build_model_runs_report, build_run_record, build_sky_only_record, ) @@ -27,6 +28,7 @@ "sky_clusters": "SkyPilot clusters", "billing": "Cloud billing", "wandb": "W&B training runs", + "kev_laya": "Kev-Laya model telemetry", "cloudwatch": "CloudWatch progress", } @@ -43,6 +45,7 @@ async def collect_report_from_raw_cache( cached_billing_report, cached_cloudwatch_retry_breakdown, cached_cloudwatch_telemetry, + cached_kev_laya_runs, cached_sky_clusters, cached_sky_jobs, cached_train_config, @@ -54,6 +57,7 @@ async def collect_report_from_raw_cache( options = CollectorOptions( limit=args.limit, + local_models_only=bool(getattr(args, "local_models_only", False)) or os.environ.get("OVERWATCH_LOCAL_MODELS_ONLY") == "1", entity=args.entity, gcp_billing_table=( getattr(args, "gcp_billing_table", None) @@ -109,6 +113,7 @@ async def collect_report_from_raw_cache( ], ), "wandb": ("wandb", [raw_cache_path("global", "wandb", "runs.json")]), + "kev_laya": ("kev_laya", [raw_cache_path("global", "kev_laya", "runs-v2.json")]), "cloudwatch": ( "cloudwatch", [raw_cache_path("jobs", str(job_id), "cloudwatch", "cursor.json") for job_id in jobs_for_progress], @@ -121,7 +126,7 @@ async def collect_report_from_raw_cache( query_diagnostics[query_key] = { "key": query_key, "label": QUERY_LABELS[query_key], - "status": "error" if error else "ok", + "status": source.get("status", "ok") if query_key == "kev_laya" else ("error" if error else "ok"), "summary": error or f"Cached in {len(existing_paths)} raw file(s)", "updated_at": manifest.get("updated_at"), "duration_seconds": source.get("duration_seconds"), @@ -196,6 +201,9 @@ async def collect_report_from_raw_cache( records.extend( build_cluster_record(cluster, args.zymtrace_project_id) for cluster in clusters ) + model_runs_report = build_model_runs_report( + cached_kev_laya_runs(), jobs, namespace=os.environ.get("OVERWATCH_SKY_NAMESPACE") + ) records.sort( key=lambda record: ( record["status"]["skypilot"] in ACTIVE_RESOURCE_STATUSES, @@ -211,6 +219,8 @@ async def collect_report_from_raw_cache( "log_enrichment": not args.no_log_enrichment, "billing": billing, "resources": records, + "model_runs": model_runs_report["runs"], + "model_run_warnings": model_runs_report["warnings"], "config_differences": config_differences(matched_records, matched_configs), "warnings": billing["warnings"], "raw_cache_root": manifest.get("cache_root"), diff --git a/src/overwatch/static/dist/assets/index-Daui7N9W.js b/src/overwatch/static/dist/assets/index-B02SM1Kt.js similarity index 67% rename from src/overwatch/static/dist/assets/index-Daui7N9W.js rename to src/overwatch/static/dist/assets/index-B02SM1Kt.js index 3e2fc37..4a66def 100644 --- a/src/overwatch/static/dist/assets/index-Daui7N9W.js +++ b/src/overwatch/static/dist/assets/index-B02SM1Kt.js @@ -46,62 +46,62 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r= `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ge=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?he(n):``}function ve(e,t){switch(e.tag){case 26:case 27:case 5:return he(e.type);case 16:return he(`Lazy`);case 13:return e.child!==t&&t!==null?he(`Suspense Fallback`):he(`Suspense`);case 19:return he(`SuspenseList`);case 0:case 15:return _e(e.type,!1);case 11:return _e(e.type.render,!1);case 1:return _e(e.type,!0);case 31:return he(`Activity`);default:return``}}function ye(e){try{var t=``,n=null;do t+=ve(e,n),n=e,e=e.return;while(e);return t}catch(e){return` Error generating stack: `+e.message+` `+e.stack}}var be=Object.prototype.hasOwnProperty,xe=t.unstable_scheduleCallback,Se=t.unstable_cancelCallback,Ce=t.unstable_shouldYield,we=t.unstable_requestPaint,Te=t.unstable_now,Ee=t.unstable_getCurrentPriorityLevel,De=t.unstable_ImmediatePriority,Oe=t.unstable_UserBlockingPriority,ke=t.unstable_NormalPriority,Ae=t.unstable_LowPriority,je=t.unstable_IdlePriority,Me=t.log,Ne=t.unstable_setDisableYieldValue,Pe=null,Fe=null;function Ie(e){if(typeof Me==`function`&&Ne(e),Fe&&typeof Fe.setStrictMode==`function`)try{Fe.setStrictMode(Pe,e)}catch{}}var Le=Math.clz32?Math.clz32:Be,Re=Math.log,ze=Math.LN2;function Be(e){return e>>>=0,e===0?32:31-(Re(e)/ze|0)|0}var He=256,Ue=262144,We=4194304;function Ge(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 Ke(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=Ge(n))):i=Ge(o):i=Ge(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ge(n))):i=Ge(o)):i=Ge(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 qe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Je(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 L(){var e=We;return We<<=1,!(We&62914560)&&(We=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),ln=!1;if(cn)try{var un={};Object.defineProperty(un,"passive",{get:function(){ln=!0}}),window.addEventListener(`test`,un,un),window.removeEventListener(`test`,un,un)}catch{ln=!1}var dn=null,z=null,fn=null;function pn(){if(fn)return fn;var e,t=z,n=t.length,r,i=`value`in dn?dn.value:dn.textContent,a=i.length;for(e=0;e=Wn),qn=` `,Jn=!1;function Yn(e,t){switch(e){case`keyup`:return Hn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Xn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Zn=!1;function Qn(e,t){switch(e){case`compositionend`:return Xn(t);case`keypress`:return t.which===32?(Jn=!0,qn):null;case`textInput`:return e=t.data,e===qn&&Jn?null:e;default:return null}}function $n(e,t){if(Zn)return e===`compositionend`||!Un&&Yn(e,t)?(e=pn(),fn=z=dn=null,Zn=!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=yr(n)}}function xr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sr(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 Cr(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 wr=cn&&`documentMode`in document&&11>=document.documentMode,Tr=null,Er=null,Dr=null,Or=!1;function kr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Or||Tr==null||Tr!==It(r)||(r=Tr,`selectionStart`in r&&Cr(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}),Dr&&vr(Dr,r)||(Dr=r,r=Pd(Er,`onSelect`),0>=o,i-=o,xi=1<<32-Le(t)+i|n<m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),Ai&&Ci(i,m),l;if(d===null){for(;mh?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),Ai&&Ci(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return Ai&&Ci(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),Ai&&Ci(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){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===E&&wa(l)===r.type){n(e,r.sibling),c=a(r,o.props),ja(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===g?(c=ci(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=si(o.type,o.key,o.props,null,e.mode,c),ja(c,o),c.return=e,e=c)}return s(e);case h: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}n(e,r);break}t(e,r),r=r.sibling}c=di(o,e.mode,c),c.return=e,e=c}return s(e);case E:return o=wa(o),x(e,r,o,c)}if(N(o))return v(e,r,o,c);if(A(o)){if(l=A(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,Aa(o),c);if(o.$$typeof===b)return x(e,r,Qi(e,o),c);Ma(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=li(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ka=0;var i=x(e,t,n,r);return Oa=null,i}catch(t){if(t===va||t===ba)throw t;var a=ri(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Pa=Na(!0),Fa=Na(!1),Ia=!1;function La(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ra(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 za(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ba(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Vl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ei(e),$r(e,null,n),t}return Xr(e,r,t,n),ei(e)}function Va(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 Ha(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 Ua=!1;function Wa(){if(Ua){var e=la;if(e!==null)throw e}}function Ga(e,t,n,r){Ua=!1;var i=e.updateQueue;Ia=!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 p=s.lane&-536870913,m=p!==s.lane;if(m?(Wl&p)===p:(r&p)===p){p!==0&&p===ca&&(Ua=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Ia=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,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),Ql|=o,e.lanes=o,e.memoizedState=d}}function Ka(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function qa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=P.T,s={};P.T=s,Ps(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ns(e,t,fa(c,r),bu(e)):Ns(e,t,r,bu(e))}catch(n){Ns(e,t,{then:function(){},status:`rejected`,reason:n},bu())}finally{F.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.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,ee,n===null?Cs:function(){return Es(e),n(r)})}function Ts(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fo,lastRenderedState:ee},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,{},bu())}function Ds(){return Zi(sp)}function Os(){return Ao().memoizedState}function ks(){return Ao().memoizedState}function As(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=bu();e=za(n);var r=Ba(t,e,n);r!==null&&(Su(r,t,n),Va(r,t,n)),t={cache:ia()},e.payload=t;return}t=t.return}}function js(e,t,n){var r=bu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Fs(e)?Is(t,n):(n=Zr(e,t,n,r),n!==null&&(Su(n,e,r),Ls(n,t,r)))}function Ms(e,t,n){Ns(e,t,n,bu())}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,_r(s,o))return Xr(e,t,i,0),Hl===null&&Yr(),!1}catch{}if(n=Zr(e,t,i,r),n!==null)return Su(n,e,r),Ls(n,t,r),!0}return!1}function Ps(e,t,n,r){if(r={lane:2,revertLane:vd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Fs(e)){if(t)throw Error(i(479))}else t=Zr(e,n,r,2),t!==null&&Su(t,e,2)}function Fs(e){var t=e.alternate;return e===lo||t!==null&&t===lo}function Is(e,t){mo=po=!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:Zi,use:No,useCallback:bo,useContext:bo,useEffect:bo,useImperativeHandle:bo,useLayoutEffect:bo,useInsertionEffect:bo,useMemo:bo,useReducer:bo,useRef:bo,useState:bo,useDebugValue:bo,useDeferredValue:bo,useTransition:bo,useSyncExternalStore:bo,useId:bo,useHostTransitionStatus:bo,useFormState:bo,useActionState:bo,useOptimistic:bo,useMemoCache:bo,useCacheRefresh:bo};Rs.useEffectEvent=bo;var zs={readContext:Zi,use:No,useCallback:function(e,t){return ko().memoizedState=[e,t===void 0?null:t],e},useContext:Zi,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=ko();t=t===void 0?null:t;var r=e();if(ho){Ie(!0);try{e()}finally{Ie(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ko();if(n!==void 0){var i=n(t);if(ho){Ie(!0);try{n(t)}finally{Ie(!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,lo,e),[r.memoizedState,e]},useRef:function(e){var t=ko();return e={current:e},t.memoizedState=e},useState:function(e){e=Go(e);var t=e.queue,n=Ms.bind(null,lo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:_s,useDeferredValue:function(e,t){return bs(ko(),e,t)},useTransition:function(){var e=Go(!1);return e=Ss.bind(null,lo,e.queue,!0,!1),ko().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=lo,a=ko();if(Ai){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Hl===null)throw Error(i(349));Wl&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=ko(),t=Hl.identifierPrefix;if(Ai){var n=Si,r=xi;n=(r&~(1<<32-Le(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=go++,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(Ud(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&&Nc(t)}}return Rc(t),Pc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Nc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=se.current,Li(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Oi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Bd(e.nodeValue,n)),e||Pi(t,!0)}else e=Yd(e).createTextNode(r),e[ot]=t,t.stateNode=e}return Rc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Li(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 Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Rc(t),e=!1}else n=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ao(t),t):(ao(t),null);if(t.flags&128)throw Error(i(558))}return Rc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Li(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 Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Rc(t),a=!1}else a=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ao(t),t):(ao(t),null)}return ao(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),Ic(t,t.updateQueue),Rc(t),null);case 4:return ue(),e===null&&Ad(t.stateNode.containerInfo),Rc(t),null;case 10:return Gi(t.type),Rc(t),null;case 19:if(ie(oo),r=t.memoizedState,r===null)return Rc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Lc(r,!1);else{if(Zl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=so(e),o!==null){for(t.flags|=128,Lc(r,!1),e=o.updateQueue,t.updateQueue=e,Ic(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)oi(n,e),n=n.sibling;return I(oo,oo.current&1|2),Ai&&Ci(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Te()>cu&&(t.flags|=128,a=!0,Lc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=so(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Ic(t,e),Lc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ai)return Rc(t),null}else 2*Te()-r.renderingStartTime>cu&&n!==536870912&&(t.flags|=128,a=!0,Lc(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?(Rc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Te(),e.sibling=null,n=oo.current,I(oo,a?n&1|2:n&1),Ai&&Ci(t,r.treeForkCount),e);case 22:case 23:return ao(t),Qa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Rc(t),t.subtreeFlags&6&&(t.flags|=8192)):Rc(t),n=t.updateQueue,n!==null&&Ic(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&&ie(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gi(ra),Rc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Bc(e,t){switch(Ei(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gi(ra),ue(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return fe(t),null;case 31:if(t.memoizedState!==null){if(ao(t),t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ao(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ie(oo),null;case 4:return ue(),null;case 10:return Gi(t.type),null;case 22:case 23:return ao(t),Qa(),e!==null&&ie(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gi(ra),null;case 25:return null;default:return null}}function Vc(e,t){switch(Ei(t),t.tag){case 3:Gi(ra),ue();break;case 26:case 27:case 5:fe(t);break;case 4:ue();break;case 31:t.memoizedState!==null&&ao(t);break;case 13:ao(t);break;case 19:ie(oo);break;case 10:Gi(t.type);break;case 22:case 23:ao(t),Qa(),e!==null&&ie(ma);break;case 24:Gi(ra)}}function Hc(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){Qu(t,t.return,e)}}function Uc(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){Qu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Qu(t,t.return,e)}}function Wc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{qa(t,n)}catch(t){Qu(e,e.return,t)}}}function Gc(e,t,n){n.props=Ks(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Qu(e,t,n)}}function Kc(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){Qu(e,t,n)}}function qc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Qu(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){Qu(e,t,n)}else n.current=null}}function Jc(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){Qu(e,e.return,t)}}function Yc(e,t,n){try{var r=e.stateNode;Wd(r,e.type,n,t),r[st]=t}catch(t){Qu(e,e.return,t)}}function Xc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&sf(e.type)||e.tag===4}function Zc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Xc(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&&sf(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 Qc(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=Qt));else if(r!==4&&(r===27&&sf(e.type)&&(n=e.stateNode,t=null),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,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&&sf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Ud(t,r,n),t[ot]=e,t[st]=n}catch(t){Qu(e,e.return,t)}}var tl=!1,nl=!1,rl=!1,il=typeof WeakSet==`function`?WeakSet:Set,al=null;function ol(e,t){if(e=e.containerInfo,qd=gp,e=Sr(e),Cr(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(Jd={focusedElem:e,selectionRange:n},gp=!1,al=t;al!==null;)if(t=al,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,al=e;else for(;al!==null;){switch(t=al,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`))),Ud(o,r,n),o[ot]=e,yt(o),r=o;break a;case`link`:var s=Xf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=br(s,h),v=br(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,P.T=null,n=gu,gu=null;var o=fu,s=mu;if(du=0,pu=fu=null,mu=0,Vl&6)throw Error(i(331));var c=Vl;if(Vl|=4,Il(o.current),Ol(o,o.current,s,n),Vl=c,dd(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot==`function`)try{Fe.onPostCommitFiberRoot(Pe,o)}catch{}return!0}finally{F.p=a,P.T=r,Ju(e,t)}}function Zu(e,t,n){t=pi(n,t),t=Qs(e.stateNode,t,2),e=Ba(e,t,2),e!==null&&(Xe(e,2),ud(e))}function Qu(e,t,n){if(e.tag===3)Zu(e,e,n);else for(;t!==null;){if(t.tag===3){Zu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(uu===null||!uu.has(r))){e=pi(n,e),n=$s(2),r=Ba(t,n,2),r!==null&&(ec(n,r,t,e),Xe(r,2),ud(r));break}}t=t.return}}function $u(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Bl;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)||(Yl=!0,i.add(n),e=ed.bind(null,e,t,n),t.then(e,e))}function ed(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Hl===e&&(Wl&n)===n&&(Zl===4||Zl===3&&(Wl&62914560)===Wl&&300>Te()-ou?!(Vl&2)&&ku(e,0):eu|=n,nu===Wl&&(nu=0)),ud(e)}function td(e,t){t===0&&(t=L()),e=Qr(e,t),e!==null&&(Xe(e,t),ud(e))}function nd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),td(e,n)}function rd(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),td(e,n)}function id(e,t){return xe(e,t)}var ad=null,od=null,U=!1,sd=!1,cd=!1,ld=0;function ud(e){e!==od&&e.next===null&&(od===null?ad=od=e:od=od.next=e),sd=!0,U||(U=!0,_d())}function dd(e,t){if(!cd&&sd){cd=!0;do for(var n=!1,r=ad;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-Le(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,gd(r,a))}else a=Wl,a=Ke(r,r===Hl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||qe(r,a)||(n=!0,gd(r,a))}r=r.next}while(n);cd=!1}}function fd(){pd()}function pd(){sd=U=!1;var e=0;ld!==0&&ef()&&(e=ld);for(var t=Te(),n=null,r=ad;r!==null;){var i=r.next,a=md(r,t);a===0?(r.next=null,n===null?ad=i:n.next=i,i===null&&(od=n)):(n=r,(e!==0||a&3)&&(sd=!0)),r=i}du!==0&&du!==5||dd(e,!1),ld!==0&&(ld=0)}function md(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&&Gd(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function Af(e,t,n){var r=kf;if(r&&typeof t==`string`&&t){var i=Rt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),wf.has(i)||(wf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Ud(t,`link`,e),yt(t),r.head.appendChild(t)))}}function jf(e){Ef.D(e),Af(`dns-prefetch`,e,null)}function Mf(e,t){Ef.C(e,t),Af(`preconnect`,e,t)}function Nf(e,t,n){Ef.L(e,t,n);var r=kf;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=zf(e);break;case`script`:a=Uf(e)}Cf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Cf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Bf(a))||t===`script`&&r.querySelector(Wf(a))||(t=r.createElement(`link`),Ud(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Pf(e,t){Ef.m(e,t);var n=kf;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=Uf(e)}if(!Cf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),Cf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Wf(a)))return}r=n.createElement(`link`),Ud(r,`link`,e),yt(r),n.head.appendChild(r)}}}function Ff(e,t,n){Ef.S(e,t,n);var r=kf;if(r&&e){var i=vt(r).hoistableStyles,a=zf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Bf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Cf.get(a))&&qf(e,n);var c=o=r.createElement(`link`);yt(c),Ud(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,Kf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function If(e,t){Ef.X(e,t);var n=kf;if(n&&e){var r=vt(n).hoistableScripts,i=Uf(e),a=r.get(i);a||(a=n.querySelector(Wf(i)),a||(e=f({src:e,async:!0},t),(t=Cf.get(i))&&Jf(e,t),a=n.createElement(`script`),yt(a),Ud(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lf(e,t){Ef.M(e,t);var n=kf;if(n&&e){var r=vt(n).hoistableScripts,i=Uf(e),a=r.get(i);a||(a=n.querySelector(Wf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=Cf.get(i))&&Jf(e,t),a=n.createElement(`script`),yt(a),Ud(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Rf(e,t,n,r){var a=(a=se.current)?Tf(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=zf(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=zf(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(Bf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Cf.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},Cf.set(e,n),o||Hf(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=Uf(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 zf(e){return`href="`+Rt(e)+`"`}function Bf(e){return`link[rel="stylesheet"][`+e+`]`}function Vf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Hf(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}),Ud(t,`link`,n),yt(t),e.head.appendChild(t))}function Uf(e){return`[src="`+Rt(e)+`"]`}function Wf(e){return`script[async]`+e}function Gf(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=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),yt(r),Ud(r,`style`,a),Kf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=zf(n.href);var o=e.querySelector(Bf(a));if(o)return t.state.loading|=4,t.instance=o,yt(o),o;r=Vf(n),(a=Cf.get(a))&&qf(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}),Ud(o,`link`,r),t.state.loading|=4,Kf(o,n.precedence,e),t.instance=o;case`script`:return o=Uf(n.src),(a=e.querySelector(Wf(o)))?(t.instance=a,yt(a),a):(r=n,(a=Cf.get(o))&&(r=f({},n),Jf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),yt(a),Ud(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,Kf(r,n.precedence,e));return t.instance}function Kf(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 Qf(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 $f(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function ep(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=zf(r.href),a=t.querySelector(Bf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=rp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,yt(a);return}a=t.ownerDocument||t,r=Vf(r),(i=Cf.get(i))&&qf(r,i),a=a.createElement(`link`),yt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Ud(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=rp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var tp=0;function np(e,t){return e.stylesheets&&e.count===0&&ap(e,e.stylesheets),0tp?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function rp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ap(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ip=null;function ap(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ip=new Map,t.forEach(op,e),ip=null,rp.call(e))}function op(e,t){if(!(t.state.loading&4)){var n=ip.get(e);if(n)var r=n.get(null);else{n=new Map,ip.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=ah()})),sh={outline:{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`},filled:{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`currentColor`,stroke:`none`}},ch=(e,t,n,r)=>{let i=(0,w.forwardRef)(({color:n=`currentColor`,size:i=24,stroke:a=2,title:o,className:s,children:c,...l},u)=>(0,w.createElement)(`svg`,{ref:u,...sh[e],width:i,height:i,className:[`tabler-icon`,`tabler-icon-${t}`,s].join(` `),...e===`filled`?{fill:n}:{strokeWidth:a,stroke:n},...l},[o&&(0,w.createElement)(`title`,{key:`svg-title`},o),...r.map(([e,t])=>(0,w.createElement)(e,t)),...Array.isArray(c)?c:[c]]));return i.displayName=`${n}`,i},lh=ch(`outline`,`activity-heartbeat`,`ActivityHeartbeat`,[[`path`,{d:`M3 12h4.5l1.5 -6l4 12l2 -9l1.5 3h4.5`,key:`svg-0`}]]),uh=ch(`outline`,`alert-triangle`,`AlertTriangle`,[[`path`,{d:`M12 9v4`,key:`svg-0`}],[`path`,{d:`M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0`,key:`svg-1`}],[`path`,{d:`M12 16h.01`,key:`svg-2`}]]),dh=ch(`outline`,`arrow-bar-to-down`,`ArrowBarToDown`,[[`path`,{d:`M4 20l16 0`,key:`svg-0`}],[`path`,{d:`M12 14l0 -10`,key:`svg-1`}],[`path`,{d:`M12 14l4 -4`,key:`svg-2`}],[`path`,{d:`M12 14l-4 -4`,key:`svg-3`}]]),fh=ch(`outline`,`arrow-bar-to-up`,`ArrowBarToUp`,[[`path`,{d:`M12 10l0 10`,key:`svg-0`}],[`path`,{d:`M12 10l4 4`,key:`svg-1`}],[`path`,{d:`M12 10l-4 4`,key:`svg-2`}],[`path`,{d:`M4 4l16 0`,key:`svg-3`}]]),ph=ch(`outline`,`arrow-left`,`ArrowLeft`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}],[`path`,{d:`M5 12l6 6`,key:`svg-1`}],[`path`,{d:`M5 12l6 -6`,key:`svg-2`}]]),mh=ch(`outline`,`chart-line`,`ChartLine`,[[`path`,{d:`M4 19l16 0`,key:`svg-0`}],[`path`,{d:`M4 15l4 -6l4 2l4 -5l4 4`,key:`svg-1`}]]),hh=ch(`outline`,`check`,`Check`,[[`path`,{d:`M5 12l5 5l10 -10`,key:`svg-0`}]]),gh=ch(`outline`,`code`,`Code`,[[`path`,{d:`M7 8l-4 4l4 4`,key:`svg-0`}],[`path`,{d:`M17 8l4 4l-4 4`,key:`svg-1`}],[`path`,{d:`M14 4l-4 16`,key:`svg-2`}]]),_h=ch(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),vh=ch(`outline`,`currency-dollar`,`CurrencyDollar`,[[`path`,{d:`M16.7 8a3 3 0 0 0 -2.7 -2h-4a3 3 0 0 0 0 6h4a3 3 0 0 1 0 6h-4a3 3 0 0 1 -2.7 -2`,key:`svg-0`}],[`path`,{d:`M12 3v3m0 12v3`,key:`svg-1`}]]),yh=ch(`outline`,`database`,`Database`,[[`path`,{d:`M4 6a8 3 0 1 0 16 0a8 3 0 1 0 -16 0`,key:`svg-0`}],[`path`,{d:`M4 6v6a8 3 0 0 0 16 0v-6`,key:`svg-1`}],[`path`,{d:`M4 12v6a8 3 0 0 0 16 0v-6`,key:`svg-2`}]]),bh=ch(`outline`,`file-text`,`FileText`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2`,key:`svg-1`}],[`path`,{d:`M9 9l1 0`,key:`svg-2`}],[`path`,{d:`M9 13l6 0`,key:`svg-3`}],[`path`,{d:`M9 17l6 0`,key:`svg-4`}]]),xh=ch(`outline`,`help-circle`,`HelpCircle`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0`,key:`svg-0`}],[`path`,{d:`M12 16v.01`,key:`svg-1`}],[`path`,{d:`M12 13a2 2 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483`,key:`svg-2`}]]),Sh=ch(`outline`,`refresh`,`Refresh`,[[`path`,{d:`M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4`,key:`svg-0`}],[`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`,key:`svg-1`}]]),Ch=ch(`outline`,`search`,`Search`,[[`path`,{d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M21 21l-6 -6`,key:`svg-1`}]]),wh=ch(`outline`,`server`,`Server`,[[`path`,{d:`M3 7a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-2`,key:`svg-0`}],[`path`,{d:`M3 15a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3l0 -2`,key:`svg-1`}],[`path`,{d:`M7 8l0 .01`,key:`svg-2`}],[`path`,{d:`M7 16l0 .01`,key:`svg-3`}]]),Th=ch(`outline`,`terminal-2`,`Terminal2`,[[`path`,{d:`M8 9l3 3l-3 3`,key:`svg-0`}],[`path`,{d:`M13 15l3 0`,key:`svg-1`}],[`path`,{d:`M3 6a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2l0 -12`,key:`svg-2`}]]);function Eh(e){return e?e.reduce((e,t)=>{let n=t.name.search(/\./);if(n>=0){let r=t.name.substring(n+1);return e[r]=t.label,e}return e[t.name]=t.label,e},{}):{}}var Dh={tooltip:`m_e4d36c9b`,tooltipLabel:`m_7f4bcb19`,tooltipBody:`m_3de554dd`,tooltipItemColor:`m_b30369b5`,tooltipItem:`m_3de8964e`,tooltipItemBody:`m_50186d10`,tooltipItemName:`m_501dadf9`,tooltipItemData:`m_50192318`};function Oh(e){return e.map(e=>{if(!e.payload||e.payload[e.name])return e;let t=e.name.search(/\./);if(t>=0){let n=e.name.substring(0,t),r={...e.payload[n]},i=Object.entries(e.payload).reduce((e,t)=>{let[r,i]=t;return r===n?e:{...e,[r]:i}},{});return{...e,name:e.name.substring(t+1),payload:{...i,...r}}}return e})}function kh(e,t){let n=Oh(e.filter(e=>e.fill!==`none`||!e.color));if(t==null)return n;if(typeof t==`number`){let e=n[t];return e?[e]:[]}return n.filter(e=>e.name===t)}function Ah(e,t){return t===`radial`||t===`scatter`?Array.isArray(e.value)?e.value[1]-e.value[0]:e.value:Array.isArray(e.payload[e.dataKey])?e.payload[e.dataKey][1]-e.payload[e.dataKey][0]:e.payload[e.name]}var jh={type:`area`,showColor:!0},Mh=V(e=>{let t=z(`ChartTooltip`,jh,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,payload:c,label:l,unit:u,type:d,segmentId:f,mod:p,series:m,valueFormatter:h,showColor:g,attributes:_,...v}=t,y=Xt(),b=B({name:`ChartTooltip`,classes:Dh,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:_});if(!c)return null;let x=kh(c,f),S=d===`scatter`?c[0]?.payload?.name:null,C=Eh(m),w=l||S,T=x.map((e,t)=>(0,R.jsxs)(`div`,{"data-type":d,...b(`tooltipItem`),children:[(0,R.jsxs)(`div`,{...b(`tooltipItemBody`),children:[g&&(0,R.jsx)(`svg`,{...b(`tooltipItemColor`),children:(0,R.jsx)(`circle`,{r:6,fill:ft(e.color,y),width:12,height:12,cx:6,cy:6})}),(0,R.jsx)(`div`,{...b(`tooltipItemName`),children:C[e.name]||e.name})]}),(0,R.jsxs)(`div`,{...b(`tooltipItemData`),children:[typeof h==`function`?h(Ah(e,d)):Ah(e,d),u||e.unit]})]},e?.key??`${e.name}-${t}`));return(0,R.jsxs)(H,{...b(`tooltip`),mod:[{type:d},p],...v,children:[w&&(0,R.jsx)(`div`,{...b(`tooltipLabel`),children:w}),(0,R.jsx)(`div`,{...b(`tooltipBody`),children:T})]})});Mh.displayName=`@mantine/charts/ChartTooltip`;var Nh={legend:`m_847eaf`,legendItem:`m_17da7e62`,legendItemColor:`m_6e236e21`,legendItemName:`m_8ff56c0d`};function Ph(e,t){return e.map(e=>{let n=t?e.dataKey?.split(`.`).pop():e.dataKey;return{...e,dataKey:n,payload:{...e.payload,name:n,dataKey:n}}})}function Fh(e,t=!0){return Ph(e.filter(e=>e.color!==`none`),t)}var Ih=V(e=>{let t=z(`ChartLegend`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,payload:c,onHighlight:l,legendPosition:u,mod:d,series:f,showColor:p,centered:m,attributes:h,...g}=t,_=B({name:`ChartLegend`,classes:Nh,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:h,rootSelector:`legend`});if(!c)return null;let v=Fh(c,f!=null),y=Eh(f),b=v.map((e,t)=>(0,R.jsxs)(`div`,{..._(`legendItem`),onMouseEnter:()=>l(e.highlightKey??e.dataKey),"data-without-color":p===!1||void 0,children:[(0,R.jsx)(Zf,{color:e.color,size:12,..._(`legendItemColor`),withShadow:!1}),(0,R.jsx)(`p`,{..._(`legendItemName`),children:y[e.dataKey]||e.dataKey})]},t));return(0,R.jsx)(H,{mod:[{position:u,centered:m},d],..._(`legend`),...g,onMouseLeave:e=>{g.onMouseLeave?.(e),l(null)},children:b})});Ih.displayName=`@mantine/charts/ChartLegend`,Ih.classes=Nh;var Lh={brush:`m_bb368c49`},Rh=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function zh(e){return typeof e==`string`&&Rh.includes(e)}var Bh=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function Vh(e){return typeof e==`string`&&Bh.has(e)}function Hh(e){return typeof e==`string`&&e.startsWith(`data-`)}function Uh(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Vh(n)||Hh(n))&&(t[n]=e[n]);return t}function Wh(e){if(e==null)return null;if((0,w.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return Uh(t)}return typeof e==`object`&&!Array.isArray(e)?Uh(e):null}function Gh(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Vh(n)||Hh(n)||zh(n))&&(t[n]=e[n]);return t}var Kh=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function qh(){return qh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=Jh(e,Kh),d=a||{width:r,height:i,x:0,y:0},f=L(`recharts-surface`,o);return w.createElement(`svg`,qh({},Gh(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),w.createElement(`title`,null,c),w.createElement(`desc`,null,l),n)}),Zh=[`children`,`className`];function Qh(){return Qh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,i=$h(e,Zh),a=L(`recharts-layer`,r);return w.createElement(`g`,Qh({className:a},Gh(i),{ref:t}),n)});function ng(e){return e===`__proto__`}var rg=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function ig(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:rg.test(e);default:return!1}}function ag(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function og(e){return typeof e==`symbol`||e instanceof Symbol}function sg(e){return e==null?``:cg(e)}function cg(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(cg).join(`,`);if(og(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function lg(e){if(Array.isArray(e))return e.map(ag);if(typeof e==`symbol`)return[e];e=sg(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r1&&arguments[1]!==void 0?arguments[1]:fg),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function mg(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+pg(i)+n},``)}var hg=e=>e===0?0:e>0?1:-1,gg=e=>typeof e==`number`&&e!=+e,_g=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,G=e=>(typeof e==`number`||e instanceof Number)&&!gg(e),vg=e=>G(e)||typeof e==`string`,yg=0,bg=e=>{var t=++yg;return`${e||``}${t}`},xg=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];if(!G(e)&&typeof e!=`string`)return n;var i;if(_g(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return gg(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},Sg=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):ug(e,t))===n)}var Tg=e=>e==null,Eg=e=>Tg(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function Dg(e){return e!=null}function Og(){}function kg(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function Ag(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 jg(e){for(var t=1;t{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=kg(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?jg({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?jg({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?jg({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?jg({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?jg({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?jg({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?jg({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?jg({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(G(n.x)||_g(n.x))&&(G(n.y)||_g(n.y))?jg({x:c+xg(n.x,g),y:l+xg(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):jg({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},Ig=[`top`,`left`,`right`,`bottom`];function Lg(e){return e==null?!1:typeof e==`object`||Ig.includes(e)}var Rg=(0,w.createContext)(null),zg=()=>(0,w.useContext)(Rg);function Bg(e){return function(){return e}}var Vg=Math.cos,Hg=Math.sin,Ug=Math.sqrt,Wg=Math.PI;Wg/2;var Gg=2*Wg,Kg=Math.PI,qg=2*Kg,Jg=1e-6,Yg=qg-Jg;function Xg(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return Xg;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tJg){if(!(Math.abs(u*s-c*l)>Jg)||!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((Kg-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Jg&&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)>Jg||Math.abs(this._y1-l)>Jg)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%qg+qg),d>Yg?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>Jg&&this._append`A${n},${n},0,${+(d>=Kg)},${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._}};Qg.prototype;function $g(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 Qg(t)}Array.prototype.slice;function e_(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function t_(e){this._context=e}t_.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)}}};function n_(e){return new t_(e)}function r_(e){return e[0]}function i_(e){return e[1]}function a_(e,t){var n=Bg(!0),r=null,i=n_,a=null,o=$g(s);e=typeof e==`function`?e:e===void 0?r_:Bg(e),t=typeof t==`function`?t:t===void 0?i_:Bg(t);function s(s){var c,l=(s=e_(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 a_().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:Bg(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:Bg(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:Bg(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:Bg(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:Bg(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:Bg(+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:Bg(!!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 s_=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)}this._x0=e,this._y0=t}};function c_(e){return new s_(e,!0)}function l_(e){return new s_(e,!1)}var u_={draw(e,t){let n=Ug(t/Wg);e.moveTo(n,0),e.arc(0,0,n,0,Gg)}},d_={draw(e,t){let n=Ug(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()}},f_=Ug(1/3),p_=f_*2,m_={draw(e,t){let n=Ug(t/p_),r=n*f_;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},h_={draw(e,t){let n=Ug(t),r=-n/2;e.rect(r,r,n,n)}},g_=.8908130915292852,__=Hg(Wg/10)/Hg(7*Wg/10),v_=Hg(Gg/10)*__,y_=-Vg(Gg/10)*__,b_={draw(e,t){let n=Ug(t*g_),r=v_*n,i=y_*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=Gg*t/5,o=Vg(a),s=Hg(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},x_=Ug(3),S_={draw(e,t){let n=-Ug(t/(x_*3));e.moveTo(0,n*2),e.lineTo(-x_*n,-n),e.lineTo(x_*n,-n),e.closePath()}},C_=-.5,w_=Ug(3)/2,T_=1/Ug(12),E_=(T_/2+1)*3,D_={draw(e,t){let n=Ug(t/E_),r=n/2,i=n*T_,a=r,o=n*T_+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(C_*r-w_*i,w_*r+C_*i),e.lineTo(C_*a-w_*o,w_*a+C_*o),e.lineTo(C_*s-w_*c,w_*s+C_*c),e.lineTo(C_*r+w_*i,C_*i-w_*r),e.lineTo(C_*a+w_*o,C_*o-w_*a),e.lineTo(C_*s+w_*c,C_*c-w_*s),e.closePath()}};function O_(e,t){let n=null,r=$g(i);e=typeof e==`function`?e:Bg(e||u_),t=typeof t==`function`?t:Bg(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:Bg(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:Bg(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function k_(){}function A_(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 j_(e){this._context=e}j_.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:A_(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(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:A_(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function M_(e){return new j_(e)}function N_(e){this._context=e}N_.prototype={areaStart:k_,areaEnd:k_,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)}},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:A_(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function P_(e){return new N_(e)}function F_(e){this._context=e}F_.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:A_(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function I_(e){return new F_(e)}function L_(e){this._context=e}L_.prototype={areaStart:k_,areaEnd:k_,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 R_(e){return new L_(e)}function z_(e){return e<0?-1:1}function B_(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(z_(a)+z_(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function V_(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function H_(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 U_(e){this._context=e}U_.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:H_(this,this._t0,V_(this,this._t0))}(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,H_(this,V_(this,n=B_(this,e,t)),n);break;default:H_(this,this._t0,n=B_(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function W_(e){this._context=new G_(e)}(W_.prototype=Object.create(U_.prototype)).point=function(e,t){U_.prototype.point.call(this,t,e)};function G_(e){this._context=e}G_.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 K_(e){return new U_(e)}function q_(e){return new W_(e)}function J_(e){this._context=e}J_.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=Y_(e),i=Y_(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)}}this._x=e,this._y=t}};function Q_(e){return new Z_(e,.5)}function $_(e){return new Z_(e,0)}function ev(e){return new Z_(e,1)}function tv(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 rv(e,t){return e[t]}function iv(e){let t=[];return t.key=e,t}function av(){var e=Bg([]),t=nv,n=tv,r=rv;function i(i){var a=Array.from(e.apply(this,arguments),iv),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;rvv[`symbol${Eg(e)}`]||u_,xv=(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*yv;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}},Sv=(e,t)=>{vv[`symbol${Eg(e)}`]=t},Cv=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=fv(fv({},gv(e,lv)),{},{type:n,size:i,sizeType:o}),c=`circle`;typeof n==`string`&&(c=n);var l=()=>{var e=bv(c),t=O_().type(e).size(xv(i,o,c))();if(t!==null)return t},u=s.className,d=s.cx,f=s.cy,p=Gh(s);return G(d)&&G(f)&&G(i)?w.createElement(`path`,uv({},p,{className:L(`recharts-symbols`,u),transform:`translate(${d}, ${f})`,d:l()})):null};Cv.registerSymbol=Sv;var wv=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,Tv=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,w.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{zh(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},Ev=(e,t,n)=>r=>(e(t,n,r),null),Dv=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];zh(i)&&typeof a==`function`&&(r||={},r[i]=Ev(a,t,n))}),r};function Ov(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 kv(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function Pv(){return Pv=Object.assign?Object.assign.bind():function(e){for(var t=1;ts)break;var u=c.transferSize,d=c.initiatorType;u&&Gd(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function Af(e,t,n){var r=kf;if(r&&typeof t==`string`&&t){var i=Rt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),wf.has(i)||(wf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Ud(t,`link`,e),yt(t),r.head.appendChild(t)))}}function jf(e){Ef.D(e),Af(`dns-prefetch`,e,null)}function Mf(e,t){Ef.C(e,t),Af(`preconnect`,e,t)}function Nf(e,t,n){Ef.L(e,t,n);var r=kf;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=zf(e);break;case`script`:a=Uf(e)}Cf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Cf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Bf(a))||t===`script`&&r.querySelector(Wf(a))||(t=r.createElement(`link`),Ud(t,`link`,e),yt(t),r.head.appendChild(t)))}}function Pf(e,t){Ef.m(e,t);var n=kf;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=Uf(e)}if(!Cf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),Cf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Wf(a)))return}r=n.createElement(`link`),Ud(r,`link`,e),yt(r),n.head.appendChild(r)}}}function Ff(e,t,n){Ef.S(e,t,n);var r=kf;if(r&&e){var i=vt(r).hoistableStyles,a=zf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Bf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Cf.get(a))&&qf(e,n);var c=o=r.createElement(`link`);yt(c),Ud(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,Kf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function If(e,t){Ef.X(e,t);var n=kf;if(n&&e){var r=vt(n).hoistableScripts,i=Uf(e),a=r.get(i);a||(a=n.querySelector(Wf(i)),a||(e=f({src:e,async:!0},t),(t=Cf.get(i))&&Jf(e,t),a=n.createElement(`script`),yt(a),Ud(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lf(e,t){Ef.M(e,t);var n=kf;if(n&&e){var r=vt(n).hoistableScripts,i=Uf(e),a=r.get(i);a||(a=n.querySelector(Wf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=Cf.get(i))&&Jf(e,t),a=n.createElement(`script`),yt(a),Ud(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Rf(e,t,n,r){var a=(a=se.current)?Tf(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=zf(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=zf(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(Bf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Cf.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},Cf.set(e,n),o||Hf(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=Uf(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 zf(e){return`href="`+Rt(e)+`"`}function Bf(e){return`link[rel="stylesheet"][`+e+`]`}function Vf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Hf(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}),Ud(t,`link`,n),yt(t),e.head.appendChild(t))}function Uf(e){return`[src="`+Rt(e)+`"]`}function Wf(e){return`script[async]`+e}function Gf(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=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),yt(r),Ud(r,`style`,a),Kf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=zf(n.href);var o=e.querySelector(Bf(a));if(o)return t.state.loading|=4,t.instance=o,yt(o),o;r=Vf(n),(a=Cf.get(a))&&qf(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}),Ud(o,`link`,r),t.state.loading|=4,Kf(o,n.precedence,e),t.instance=o;case`script`:return o=Uf(n.src),(a=e.querySelector(Wf(o)))?(t.instance=a,yt(a),a):(r=n,(a=Cf.get(o))&&(r=f({},n),Jf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),yt(a),Ud(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,Kf(r,n.precedence,e));return t.instance}function Kf(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 Qf(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 $f(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function ep(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=zf(r.href),a=t.querySelector(Bf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=rp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,yt(a);return}a=t.ownerDocument||t,r=Vf(r),(i=Cf.get(i))&&qf(r,i),a=a.createElement(`link`),yt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Ud(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=rp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var tp=0;function np(e,t){return e.stylesheets&&e.count===0&&ap(e,e.stylesheets),0tp?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function rp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ap(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ip=null;function ap(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ip=new Map,t.forEach(op,e),ip=null,rp.call(e))}function op(e,t){if(!(t.state.loading&4)){var n=ip.get(e);if(n)var r=n.get(null);else{n=new Map,ip.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=ah()}))();function sh(e){try{let t=new URL(e);return[`https:`,`http:`].includes(t.protocol)&&!t.username&&!t.password?e:null}catch{return null}}function ch(e,t){let n=e.filter(e=>Number.isFinite(e.metrics[t]));if(n.length<2)return``;let r=Math.min(...n.map(e=>e.step)),i=Math.max(...n.map(e=>e.step)),a=n.map(e=>e.metrics[t]),o=Math.min(...a),s=Math.max(...a);return n.map(e=>`${4+252*(e.step-r)/Math.max(1,i-r)},${76-72*(e.metrics[t]-o)/Math.max(1e-12,s-o)}`).join(` `)}function lh(e,t){if(!e.length)return null;let n=e.filter(Number.isFinite).sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.max(0,Math.ceil(t*n.length)-1))]??null}function uh(e){return e.verification===`unverified`?`Unverified observation`:e.verification===`last_verified_with_newer_uncertainty`?`Last verified attempt; newer observation is uncertain`:`Verified attempt`}function dh(e){return e.verification===`unverified`?`Unverified observed phase`:e.verification===`last_verified_with_newer_uncertainty`?`Last verified trainer phase`:`Trainer phase`}function fh(e){return e==null||!Number.isFinite(e)?`unknown`:`${(e/1048576).toFixed(2)} MiB`}function ph(e){let t=e?.execution;return t?`${t.prefix_passes} prefix passes; ${t.branch_passes} question-batch passes; ${t.questions} questions; largest batch ${t.max_batch_size}`:`Parallel execution counters unknown in this historical snapshot`}function mh({run:e,metric:t}){let n=ch(e.history,t);return(0,R.jsxs)(H,{children:[(0,R.jsxs)(U,{size:`xs`,children:[t,`: `,e.metrics[t]?.toPrecision(4)??`unknown`]}),n&&(0,R.jsx)(`svg`,{role:`img`,"aria-label":`${t} by optimizer step for ${e.run_id}`,viewBox:`0 0 260 80`,width:`260`,height:`80`,children:(0,R.jsx)(`polyline`,{fill:`none`,stroke:`currentColor`,strokeWidth:`2`,points:n})})]})}function hh({uri:e,label:t}){let n=sh(e);return n?(0,R.jsx)(ld,{href:n,target:`_blank`,rel:`noreferrer`,children:t}):(0,R.jsxs)(U,{size:`xs`,style:{overflowWrap:`anywhere`},children:[t,`: `,e]})}function gh({runs:e,warnings:t=[]}){return(0,R.jsxs)(Dm,{gap:`md`,mt:`xl`,"data-testid":`model-runs`,children:[(0,R.jsx)(nh,{order:2,children:`Decision model experiments`}),t.length>0&&(0,R.jsxs)(U,{role:`status`,children:[t.length,` telemetry warning(s): `,t.map(e=>String(e.code??`unknown`)).join(`, `)]}),!e.length&&(0,R.jsx)(U,{c:`dimmed`,children:`No registered Kev-Laya runs. Resource inventory above is unchanged.`}),e.map(e=>{let t=e.extensions,n=t?.execution,r=t?.resources;return(0,R.jsxs)(Vf,{withBorder:!0,"data-run-id":e.run_id,children:[(0,R.jsxs)(nl,{justify:`space-between`,children:[(0,R.jsxs)(nh,{order:3,children:[e.experiment_id,` / `,e.run_id]}),(0,R.jsxs)(nl,{children:[(0,R.jsx)(Tf,{children:uh(e)}),(0,R.jsx)(Tf,{variant:`outline`,children:e.freshness}),(0,R.jsx)(Tf,{variant:`outline`,children:e.provenance.evidence_class})]})]}),e.verification&&e.verification!==`verified`&&(0,R.jsxs)(nd,{title:`Attempt identity requires verification`,role:`status`,mt:`sm`,children:[e.verification===`unverified`?`No verified attempt is available for this observation.`:`The values below describe the last verified attempt, not the newer unverified observation.`,(e.unverified_observations??[]).map((e,t)=>(0,R.jsxs)(U,{size:`sm`,children:[`Observed attempt `,e.attempt_index,` (`,e.attempt_id,`) · `,e.phase,` · sequence `,e.sequence,` · source `,e.source_id,` · `,e.reason,` · heartbeat `,e.heartbeat_at]},`${e.source_id}/${e.attempt_id}/${e.sequence}/${t}`))]}),(0,R.jsxs)(U,{size:`sm`,children:[`Attempt `,e.attempt_index,` · `,e.attempt_id,` · sequence `,e.sequence]}),(0,R.jsxs)(U,{size:`sm`,children:[dh(e),`: `,e.phase,` · Sky: `,e.provider_status.skypilot??`unknown`,` · W&B: `,e.provider_status.wandb??`unknown`]}),(0,R.jsxs)(U,{size:`sm`,children:[`Association: `,e.association.status,e.association.scheduler?` · ${e.association.scheduler.namespace}/${e.association.scheduler.job_id}`:` (no scheduler resource)`]}),(0,R.jsxs)(U,{size:`xs`,children:[`Heartbeat `,e.heartbeat_at,` · `,Math.round(e.heartbeat_age_seconds),` seconds old · monitoring failures `,e.monitoring_export_failures]}),(0,R.jsxs)(U,{children:[e.progress.optimizer_steps.toLocaleString(),` / `,e.progress.totals.optimizer_steps?.toLocaleString()??`unknown`,` optimizer steps`]}),(0,R.jsxs)(U,{size:`sm`,children:[e.progress.microbatches.toLocaleString(),` accumulation microbatches · `,e.progress.examples.toLocaleString(),` examples · `,e.progress.forward_tokens.toLocaleString(),` useful forward tokens`]}),(0,R.jsxs)(U,{size:`sm`,children:[`Elapsed `,e.progress.elapsed_seconds?.toFixed(1)??`unknown`,` s · ETA `,e.progress.eta_seconds?.toFixed(1)??`unknown`,` s · `,e.progress.tokens_per_second?.toFixed(1)??`unknown`,` tokens/s`]}),(0,R.jsx)(U,{size:`sm`,children:ph(t)}),n&&(0,R.jsxs)(U,{size:`sm`,children:[`Padding overhead `,n.padding_tokens.toLocaleString(),` tokens · total forward compute `,n.compute_tokens.toLocaleString(),` tokens (excludes backward recomputation) · batch sizes `,Object.entries(n.batch_size_histogram).map(([e,t])=>`${e} × ${t}`).join(`, `)]}),(0,R.jsxs)(nl,{align:`start`,children:[(0,R.jsx)(mh,{run:e,metric:`loss/ce`}),(0,R.jsx)(mh,{run:e,metric:`reward/proper`}),(0,R.jsx)(mh,{run:e,metric:`validation/ece`})]}),t?.calibration&&(0,R.jsxs)(H,{mt:`sm`,children:[(0,R.jsxs)(U,{size:`sm`,children:[`Calibration: `,t.calibration.status,` · `,t.calibration.method??`unknown method`]}),Object.entries(t.calibration.per_type).map(([e,t])=>t&&(0,R.jsxs)(U,{size:`xs`,children:[e,`: T=`,t.temperature.toPrecision(4),` · `,t.count,` calibration questions · calibration NLL `,t.before_nll?.toPrecision(4)??`unknown`,` → `,t.after_nll?.toPrecision(4)??`unknown`]},e)),(0,R.jsxs)(U,{size:`xs`,style:{overflowWrap:`anywhere`},children:[`Calibration split SHA-256: `,t.calibration.split_sha256??`unknown`,`. These are fit diagnostics, not a general calibration guarantee.`]})]}),(0,R.jsxs)(U,{size:`sm`,children:[`Backbone `,e.provenance.backbone,` · `,e.provenance.precision,` · `,e.provenance.hardware]}),(0,R.jsxs)(U,{size:`sm`,children:[`RSS `,fh(r?.rss_bytes),` · CUDA allocated `,fh(r?.gpu_allocated_bytes),` · CUDA peak allocated `,fh(r?.gpu_peak_allocated_bytes)]}),(0,R.jsxs)(U,{size:`xs`,children:[`Resource sample `,r?.sampled_at??`unknown`,` · minimum sampling interval `,r?.interval_seconds??`unknown`,` s; samples are activity-driven. Cache-admission estimates are not total memory guarantees.`]}),(0,R.jsxs)(U,{size:`xs`,children:[`Branch budget `,e.provenance.context_limits.branch,`; aggregate `,e.provenance.context_limits.aggregate,`. Budget is not a benchmark result.`]}),(0,R.jsxs)(`details`,{children:[(0,R.jsx)(`summary`,{children:`Source, preprocessing, and split provenance`}),(0,R.jsxs)(U,{size:`xs`,style:{overflowWrap:`anywhere`},children:[`Tokenizer `,e.provenance.tokenizer,` · serialization `,t?.serialization.serialization??`historical / unknown`,` · literals `,t?.serialization.literal_encoding??`unknown`]}),(0,R.jsxs)(U,{size:`xs`,children:[`Package `,t?.source.package_version??`unknown`,` · Git `,t?.source.git_status??`unknown`,` · dirty state `,t?.source.git_dirty==null?`unknown`:t.source.git_dirty?`dirty`:`clean`]}),(0,R.jsxs)(U,{size:`xs`,style:{overflowWrap:`anywhere`},children:[`Source tree SHA-256 `,t?.source.source_tree_sha256??`unknown`,` · archive SHA-256 `,t?.source.archive_sha256??`unknown`]}),(0,R.jsxs)(U,{size:`xs`,style:{overflowWrap:`anywhere`},children:[`Config `,e.provenance.config_sha256??`unknown`,` · data manifest `,e.provenance.data_sha256??`unknown`,` · seed `,e.provenance.seed??`unknown`]}),Object.entries(e.provenance.split_hashes??{}).map(([e,t])=>(0,R.jsxs)(U,{size:`xs`,style:{overflowWrap:`anywhere`},children:[e,`: `,t]},e)),(0,R.jsxs)(nl,{children:[e.git_url&&(0,R.jsx)(hh,{uri:e.git_url,label:`Source commit`}),e.wandb_url&&(0,R.jsx)(hh,{uri:e.wandb_url,label:`W&B run`})]})]}),(0,R.jsxs)(`details`,{children:[(0,R.jsx)(`summary`,{children:`Attempt lineage and collection freshness`}),(0,R.jsxs)(U,{size:`xs`,children:[`Receipt storage durability: `,t?.lineage_durable==null?`unknown`:t.lineage_durable?`confirmed by writer`:`write failed; recovery may be uncertain`,` · at most 64 consecutive receipts retained`]}),(t?.attempt_lineage??[]).map(e=>(0,R.jsxs)(U,{size:`xs`,style:{overflowWrap:`anywhere`},children:[`Attempt `,e.attempt_index,` · `,e.attempt_id,` · parent `,e.parent_attempt_id??`none`,` · receipt `,e.sha256]},e.attempt_id)),(e.collection_sources??[]).map(e=>(0,R.jsxs)(U,{size:`xs`,children:[`Source `,e.source_id,`: `,e.status,` · current refresh `,e.refreshed_at??`not refreshed`,` · last successful refresh `,e.last_successful_refresh_at??`unknown`,` · `,e.payload_bytes,` payload bytes / `,e.requests,` request slots`]},e.source_id))]}),(0,R.jsxs)(U,{size:`sm`,children:[`Resume: `,e.resume.capable?`optimization-boundary checkpoint available`:`not established`,` · parent attempt: `,e.parent_attempt_id??`none`]}),(0,R.jsxs)(U,{size:`sm`,children:[`Recoveries: `,e.recoveries.total??`unknown`,`; infrastructure `,e.recoveries.infrastructure??`unknown`,`; application `,e.recoveries.application??`unknown`]}),(0,R.jsxs)(U,{size:`sm`,children:[`Measured cost: `,e.cost.measured_usd==null?`unknown`:`$${e.cost.measured_usd.toFixed(4)}`,` · estimate: `,e.cost.estimated_usd==null?`unknown`:`$${e.cost.estimated_usd.toFixed(4)}`,` · basis `,e.cost.basis??`unknown`]}),(0,R.jsxs)(U,{size:`sm`,children:[`Serving: `,e.serving.requests,` requests / `,e.serving.errors,` errors · recent latency (last 128): p50 `,lh(e.serving.latency_ms,.5)?.toFixed(1)??`unknown`,` ms · p95 `,lh(e.serving.latency_ms,.95)?.toFixed(1)??`unknown`,` ms · `,e.serving.prefix_reuses,` prefix reuses`]}),(0,R.jsxs)(W,{children:[(0,R.jsx)(W.Thead,{children:(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Th,{children:`Artifact`}),(0,R.jsx)(W.Th,{children:`Checksum / lineage`})]})}),(0,R.jsx)(W.Tbody,{children:e.artifacts.map(e=>(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Td,{children:(0,R.jsx)(hh,{uri:e.uri,label:e.kind})}),(0,R.jsxs)(W.Td,{children:[(0,R.jsx)(U,{size:`xs`,ff:`monospace`,style:{overflowWrap:`anywhere`},children:e.sha256}),(0,R.jsxs)(U,{size:`xs`,children:[`Parent `,e.parent_sha256??`none`,` · `,e.size_bytes.toLocaleString(),` bytes`]})]})]},`${e.kind}/${e.sha256}`))})]})]},`${e.experiment_id}/${e.run_id}`)})]})}var _h={outline:{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`},filled:{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`currentColor`,stroke:`none`}},vh=(e,t,n,r)=>{let i=(0,w.forwardRef)(({color:n=`currentColor`,size:i=24,stroke:a=2,title:o,className:s,children:c,...l},u)=>(0,w.createElement)(`svg`,{ref:u,..._h[e],width:i,height:i,className:[`tabler-icon`,`tabler-icon-${t}`,s].join(` `),...e===`filled`?{fill:n}:{strokeWidth:a,stroke:n},...l},[o&&(0,w.createElement)(`title`,{key:`svg-title`},o),...r.map(([e,t])=>(0,w.createElement)(e,t)),...Array.isArray(c)?c:[c]]));return i.displayName=`${n}`,i},yh=vh(`outline`,`activity-heartbeat`,`ActivityHeartbeat`,[[`path`,{d:`M3 12h4.5l1.5 -6l4 12l2 -9l1.5 3h4.5`,key:`svg-0`}]]),bh=vh(`outline`,`alert-triangle`,`AlertTriangle`,[[`path`,{d:`M12 9v4`,key:`svg-0`}],[`path`,{d:`M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0`,key:`svg-1`}],[`path`,{d:`M12 16h.01`,key:`svg-2`}]]),xh=vh(`outline`,`arrow-bar-to-down`,`ArrowBarToDown`,[[`path`,{d:`M4 20l16 0`,key:`svg-0`}],[`path`,{d:`M12 14l0 -10`,key:`svg-1`}],[`path`,{d:`M12 14l4 -4`,key:`svg-2`}],[`path`,{d:`M12 14l-4 -4`,key:`svg-3`}]]),Sh=vh(`outline`,`arrow-bar-to-up`,`ArrowBarToUp`,[[`path`,{d:`M12 10l0 10`,key:`svg-0`}],[`path`,{d:`M12 10l4 4`,key:`svg-1`}],[`path`,{d:`M12 10l-4 4`,key:`svg-2`}],[`path`,{d:`M4 4l16 0`,key:`svg-3`}]]),Ch=vh(`outline`,`arrow-left`,`ArrowLeft`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}],[`path`,{d:`M5 12l6 6`,key:`svg-1`}],[`path`,{d:`M5 12l6 -6`,key:`svg-2`}]]),wh=vh(`outline`,`chart-line`,`ChartLine`,[[`path`,{d:`M4 19l16 0`,key:`svg-0`}],[`path`,{d:`M4 15l4 -6l4 2l4 -5l4 4`,key:`svg-1`}]]),Th=vh(`outline`,`check`,`Check`,[[`path`,{d:`M5 12l5 5l10 -10`,key:`svg-0`}]]),Eh=vh(`outline`,`code`,`Code`,[[`path`,{d:`M7 8l-4 4l4 4`,key:`svg-0`}],[`path`,{d:`M17 8l4 4l-4 4`,key:`svg-1`}],[`path`,{d:`M14 4l-4 16`,key:`svg-2`}]]),Dh=vh(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),Oh=vh(`outline`,`currency-dollar`,`CurrencyDollar`,[[`path`,{d:`M16.7 8a3 3 0 0 0 -2.7 -2h-4a3 3 0 0 0 0 6h4a3 3 0 0 1 0 6h-4a3 3 0 0 1 -2.7 -2`,key:`svg-0`}],[`path`,{d:`M12 3v3m0 12v3`,key:`svg-1`}]]),kh=vh(`outline`,`database`,`Database`,[[`path`,{d:`M4 6a8 3 0 1 0 16 0a8 3 0 1 0 -16 0`,key:`svg-0`}],[`path`,{d:`M4 6v6a8 3 0 0 0 16 0v-6`,key:`svg-1`}],[`path`,{d:`M4 12v6a8 3 0 0 0 16 0v-6`,key:`svg-2`}]]),Ah=vh(`outline`,`file-text`,`FileText`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2`,key:`svg-1`}],[`path`,{d:`M9 9l1 0`,key:`svg-2`}],[`path`,{d:`M9 13l6 0`,key:`svg-3`}],[`path`,{d:`M9 17l6 0`,key:`svg-4`}]]),jh=vh(`outline`,`help-circle`,`HelpCircle`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0`,key:`svg-0`}],[`path`,{d:`M12 16v.01`,key:`svg-1`}],[`path`,{d:`M12 13a2 2 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483`,key:`svg-2`}]]),Mh=vh(`outline`,`refresh`,`Refresh`,[[`path`,{d:`M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4`,key:`svg-0`}],[`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`,key:`svg-1`}]]),Nh=vh(`outline`,`search`,`Search`,[[`path`,{d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M21 21l-6 -6`,key:`svg-1`}]]),Ph=vh(`outline`,`server`,`Server`,[[`path`,{d:`M3 7a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-2`,key:`svg-0`}],[`path`,{d:`M3 15a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3l0 -2`,key:`svg-1`}],[`path`,{d:`M7 8l0 .01`,key:`svg-2`}],[`path`,{d:`M7 16l0 .01`,key:`svg-3`}]]),Fh=vh(`outline`,`terminal-2`,`Terminal2`,[[`path`,{d:`M8 9l3 3l-3 3`,key:`svg-0`}],[`path`,{d:`M13 15l3 0`,key:`svg-1`}],[`path`,{d:`M3 6a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2l0 -12`,key:`svg-2`}]]);function Ih(e){return e?e.reduce((e,t)=>{let n=t.name.search(/\./);if(n>=0){let r=t.name.substring(n+1);return e[r]=t.label,e}return e[t.name]=t.label,e},{}):{}}var Lh={tooltip:`m_e4d36c9b`,tooltipLabel:`m_7f4bcb19`,tooltipBody:`m_3de554dd`,tooltipItemColor:`m_b30369b5`,tooltipItem:`m_3de8964e`,tooltipItemBody:`m_50186d10`,tooltipItemName:`m_501dadf9`,tooltipItemData:`m_50192318`};function Rh(e){return e.map(e=>{if(!e.payload||e.payload[e.name])return e;let t=e.name.search(/\./);if(t>=0){let n=e.name.substring(0,t),r={...e.payload[n]},i=Object.entries(e.payload).reduce((e,t)=>{let[r,i]=t;return r===n?e:{...e,[r]:i}},{});return{...e,name:e.name.substring(t+1),payload:{...i,...r}}}return e})}function zh(e,t){let n=Rh(e.filter(e=>e.fill!==`none`||!e.color));if(t==null)return n;if(typeof t==`number`){let e=n[t];return e?[e]:[]}return n.filter(e=>e.name===t)}function Bh(e,t){return t===`radial`||t===`scatter`?Array.isArray(e.value)?e.value[1]-e.value[0]:e.value:Array.isArray(e.payload[e.dataKey])?e.payload[e.dataKey][1]-e.payload[e.dataKey][0]:e.payload[e.name]}var Vh={type:`area`,showColor:!0},Hh=V(e=>{let t=z(`ChartTooltip`,Vh,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,payload:c,label:l,unit:u,type:d,segmentId:f,mod:p,series:m,valueFormatter:h,showColor:g,attributes:_,...v}=t,y=Xt(),b=B({name:`ChartTooltip`,classes:Lh,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:_});if(!c)return null;let x=zh(c,f),S=d===`scatter`?c[0]?.payload?.name:null,C=Ih(m),w=l||S,T=x.map((e,t)=>(0,R.jsxs)(`div`,{"data-type":d,...b(`tooltipItem`),children:[(0,R.jsxs)(`div`,{...b(`tooltipItemBody`),children:[g&&(0,R.jsx)(`svg`,{...b(`tooltipItemColor`),children:(0,R.jsx)(`circle`,{r:6,fill:ft(e.color,y),width:12,height:12,cx:6,cy:6})}),(0,R.jsx)(`div`,{...b(`tooltipItemName`),children:C[e.name]||e.name})]}),(0,R.jsxs)(`div`,{...b(`tooltipItemData`),children:[typeof h==`function`?h(Bh(e,d)):Bh(e,d),u||e.unit]})]},e?.key??`${e.name}-${t}`));return(0,R.jsxs)(H,{...b(`tooltip`),mod:[{type:d},p],...v,children:[w&&(0,R.jsx)(`div`,{...b(`tooltipLabel`),children:w}),(0,R.jsx)(`div`,{...b(`tooltipBody`),children:T})]})});Hh.displayName=`@mantine/charts/ChartTooltip`;var Uh={legend:`m_847eaf`,legendItem:`m_17da7e62`,legendItemColor:`m_6e236e21`,legendItemName:`m_8ff56c0d`};function Wh(e,t){return e.map(e=>{let n=t?e.dataKey?.split(`.`).pop():e.dataKey;return{...e,dataKey:n,payload:{...e.payload,name:n,dataKey:n}}})}function Gh(e,t=!0){return Wh(e.filter(e=>e.color!==`none`),t)}var Kh=V(e=>{let t=z(`ChartLegend`,null,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,payload:c,onHighlight:l,legendPosition:u,mod:d,series:f,showColor:p,centered:m,attributes:h,...g}=t,_=B({name:`ChartLegend`,classes:Uh,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:h,rootSelector:`legend`});if(!c)return null;let v=Gh(c,f!=null),y=Ih(f),b=v.map((e,t)=>(0,R.jsxs)(`div`,{..._(`legendItem`),onMouseEnter:()=>l(e.highlightKey??e.dataKey),"data-without-color":p===!1||void 0,children:[(0,R.jsx)(Zf,{color:e.color,size:12,..._(`legendItemColor`),withShadow:!1}),(0,R.jsx)(`p`,{..._(`legendItemName`),children:y[e.dataKey]||e.dataKey})]},t));return(0,R.jsx)(H,{mod:[{position:u,centered:m},d],..._(`legend`),...g,onMouseLeave:e=>{g.onMouseLeave?.(e),l(null)},children:b})});Kh.displayName=`@mantine/charts/ChartLegend`,Kh.classes=Uh;var qh={brush:`m_bb368c49`},Jh=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function Yh(e){return typeof e==`string`&&Jh.includes(e)}var Xh=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function Zh(e){return typeof e==`string`&&Xh.has(e)}function Qh(e){return typeof e==`string`&&e.startsWith(`data-`)}function $h(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Zh(n)||Qh(n))&&(t[n]=e[n]);return t}function eg(e){if(e==null)return null;if((0,w.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return $h(t)}return typeof e==`object`&&!Array.isArray(e)?$h(e):null}function tg(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Zh(n)||Qh(n)||Yh(n))&&(t[n]=e[n]);return t}var ng=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function rg(){return rg=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=ig(e,ng),d=a||{width:r,height:i,x:0,y:0},f=L(`recharts-surface`,o);return w.createElement(`svg`,rg({},tg(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),w.createElement(`title`,null,c),w.createElement(`desc`,null,l),n)}),sg=[`children`,`className`];function cg(){return cg=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,i=lg(e,sg),a=L(`recharts-layer`,r);return w.createElement(`g`,cg({className:a},tg(i),{ref:t}),n)});function fg(e){return e===`__proto__`}var pg=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function mg(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:pg.test(e);default:return!1}}function hg(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function gg(e){return typeof e==`symbol`||e instanceof Symbol}function _g(e){return e==null?``:vg(e)}function vg(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(vg).join(`,`);if(gg(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function yg(e){if(Array.isArray(e))return e.map(hg);if(typeof e==`symbol`)return[e];e=_g(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r1&&arguments[1]!==void 0?arguments[1]:Sg),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function wg(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+Cg(i)+n},``)}var Tg=e=>e===0?0:e>0?1:-1,Eg=e=>typeof e==`number`&&e!=+e,Dg=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,G=e=>(typeof e==`number`||e instanceof Number)&&!Eg(e),Og=e=>G(e)||typeof e==`string`,kg=0,Ag=e=>{var t=++kg;return`${e||``}${t}`},jg=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];if(!G(e)&&typeof e!=`string`)return n;var i;if(Dg(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return Eg(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},Mg=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):bg(e,t))===n)}var Fg=e=>e==null,Ig=e=>Fg(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function Lg(e){return e!=null}function Rg(){}function zg(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function Bg(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 Vg(e){for(var t=1;t{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=zg(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?Vg({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?Vg({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?Vg({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?Vg({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?Vg({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?Vg({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?Vg({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?Vg({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(G(n.x)||Dg(n.x))&&(G(n.y)||Dg(n.y))?Vg({x:c+jg(n.x,g),y:l+jg(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):Vg({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},Kg=[`top`,`left`,`right`,`bottom`];function qg(e){return e==null?!1:typeof e==`object`||Kg.includes(e)}var Jg=(0,w.createContext)(null),Yg=()=>(0,w.useContext)(Jg);function Xg(e){return function(){return e}}var Zg=Math.cos,Qg=Math.sin,$g=Math.sqrt,e_=Math.PI;e_/2;var t_=2*e_,n_=Math.PI,r_=2*n_,i_=1e-6,a_=r_-i_;function o_(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return o_;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;ti_){if(!(Math.abs(u*s-c*l)>i_)||!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((n_-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>i_&&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)>i_||Math.abs(this._y1-l)>i_)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%r_+r_),d>a_?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>i_&&this._append`A${n},${n},0,${+(d>=n_)},${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._}};c_.prototype;function l_(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 c_(t)}Array.prototype.slice;function u_(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function d_(e){this._context=e}d_.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)}}};function f_(e){return new d_(e)}function p_(e){return e[0]}function m_(e){return e[1]}function h_(e,t){var n=Xg(!0),r=null,i=f_,a=null,o=l_(s);e=typeof e==`function`?e:e===void 0?p_:Xg(e),t=typeof t==`function`?t:t===void 0?m_:Xg(t);function s(s){var c,l=(s=u_(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 h_().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:Xg(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:Xg(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:Xg(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:Xg(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:Xg(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:Xg(+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:Xg(!!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 __=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)}this._x0=e,this._y0=t}};function v_(e){return new __(e,!0)}function y_(e){return new __(e,!1)}var b_={draw(e,t){let n=$g(t/e_);e.moveTo(n,0),e.arc(0,0,n,0,t_)}},x_={draw(e,t){let n=$g(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()}},S_=$g(1/3),C_=S_*2,w_={draw(e,t){let n=$g(t/C_),r=n*S_;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},T_={draw(e,t){let n=$g(t),r=-n/2;e.rect(r,r,n,n)}},E_=.8908130915292852,D_=Qg(e_/10)/Qg(7*e_/10),O_=Qg(t_/10)*D_,k_=-Zg(t_/10)*D_,A_={draw(e,t){let n=$g(t*E_),r=O_*n,i=k_*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=t_*t/5,o=Zg(a),s=Qg(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},j_=$g(3),M_={draw(e,t){let n=-$g(t/(j_*3));e.moveTo(0,n*2),e.lineTo(-j_*n,-n),e.lineTo(j_*n,-n),e.closePath()}},N_=-.5,P_=$g(3)/2,F_=1/$g(12),I_=(F_/2+1)*3,L_={draw(e,t){let n=$g(t/I_),r=n/2,i=n*F_,a=r,o=n*F_+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(N_*r-P_*i,P_*r+N_*i),e.lineTo(N_*a-P_*o,P_*a+N_*o),e.lineTo(N_*s-P_*c,P_*s+N_*c),e.lineTo(N_*r+P_*i,N_*i-P_*r),e.lineTo(N_*a+P_*o,N_*o-P_*a),e.lineTo(N_*s+P_*c,N_*c-P_*s),e.closePath()}};function R_(e,t){let n=null,r=l_(i);e=typeof e==`function`?e:Xg(e||b_),t=typeof t==`function`?t:Xg(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:Xg(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:Xg(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function z_(){}function B_(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 V_(e){this._context=e}V_.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:B_(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(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:B_(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function H_(e){return new V_(e)}function U_(e){this._context=e}U_.prototype={areaStart:z_,areaEnd:z_,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)}},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:B_(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function W_(e){return new U_(e)}function G_(e){this._context=e}G_.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:B_(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function K_(e){return new G_(e)}function q_(e){this._context=e}q_.prototype={areaStart:z_,areaEnd:z_,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 J_(e){return new q_(e)}function Y_(e){return e<0?-1:1}function X_(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(Y_(a)+Y_(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Z_(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Q_(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 $_(e){this._context=e}$_.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:Q_(this,this._t0,Z_(this,this._t0))}(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,Q_(this,Z_(this,n=X_(this,e,t)),n);break;default:Q_(this,this._t0,n=X_(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function ev(e){this._context=new tv(e)}(ev.prototype=Object.create($_.prototype)).point=function(e,t){$_.prototype.point.call(this,t,e)};function tv(e){this._context=e}tv.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 nv(e){return new $_(e)}function rv(e){return new ev(e)}function iv(e){this._context=e}iv.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=av(e),i=av(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)}}this._x=e,this._y=t}};function cv(e){return new sv(e,.5)}function lv(e){return new sv(e,0)}function uv(e){return new sv(e,1)}function dv(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 pv(e,t){return e[t]}function mv(e){let t=[];return t.key=e,t}function hv(){var e=Xg([]),t=fv,n=dv,r=pv;function i(i){var a=Array.from(e.apply(this,arguments),mv),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;rOv[`symbol${Ig(e)}`]||b_,jv=(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*kv;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}},Mv=(e,t)=>{Ov[`symbol${Ig(e)}`]=t},Nv=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=Sv(Sv({},Ev(e,yv)),{},{type:n,size:i,sizeType:o}),c=`circle`;typeof n==`string`&&(c=n);var l=()=>{var e=Av(c),t=R_().type(e).size(jv(i,o,c))();if(t!==null)return t},u=s.className,d=s.cx,f=s.cy,p=tg(s);return G(d)&&G(f)&&G(i)?w.createElement(`path`,bv({},p,{className:L(`recharts-symbols`,u),transform:`translate(${d}, ${f})`,d:l()})):null};Nv.registerSymbol=Mv;var Pv=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,Fv=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,w.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{Yh(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},Iv=(e,t,n)=>r=>(e(t,n,r),null),Lv=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];Yh(i)&&typeof a==`function`&&(r||={},r[i]=Iv(a,t,n))}),r};function Rv(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 zv(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function Wv(){return Wv=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var d=t.formatter||i,f=L({"recharts-legend-item":!0,[`legend-item-${r}`]:!0,inactive:t.inactive});if(t.type===`none`)return null;var p=typeof s==`object`?Iv({},s):{};p.color=t.inactive?a:p.color||t.color,p.whiteSpace??=`normal`,p.overflowWrap??=`break-word`;var m=d?d(t.value,t,r):t.value;return w.createElement(`li`,Pv({className:f,style:l,key:`legend-item-${r}`},Dv(e,t,r)),w.createElement(Xh,{width:n,height:n,viewBox:c,style:u,"aria-label":t.value==null?`legend icon`:`${t.value} legend icon`},w.createElement(Uv,{data:t,iconType:o,inactiveColor:a})),w.createElement(`span`,{className:`recharts-legend-item-text`,style:p},m))})}var Gv=e=>{var t=Nv(e,Vv),n=t.payload,r=t.layout,i=t.align;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:r===`horizontal`?i:`left`};return w.createElement(`ul`,{className:`recharts-default-legend`,style:a},w.createElement(Wv,Pv({},t,{payload:n})))};function Kv(e,t){let n=new Map;for(let r=0;r=0}function Xv(e){return e!=null&&typeof e!=`function`&&Yv(e.length)}function Zv(e){return function(t){return ug(t,e)}}function Qv(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function $v(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ey(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function ty(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var ny=`[object RegExp]`,ry=`[object String]`,iy=`[object Number]`,ay=`[object Boolean]`,oy=`[object Arguments]`,sy=`[object Symbol]`,cy=`[object Date]`,ly=`[object Map]`,uy=`[object Set]`,dy=`[object Array]`,fy=`[object Function]`,py=`[object ArrayBuffer]`,my=`[object Object]`,hy=`[object Error]`,gy=`[object DataView]`,_y=`[object Uint8Array]`,vy=`[object Uint8ClampedArray]`,yy=`[object Uint16Array]`,by=`[object Uint32Array]`,xy=`[object BigUint64Array]`,Sy=`[object Int8Array]`,Cy=`[object Int16Array]`,wy=`[object Int32Array]`,Ty=`[object BigInt64Array]`,Ey=`[object Float32Array]`,Dy=`[object Float64Array]`,Oy=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function ky(e){return Oy.Buffer!==void 0&&Oy.Buffer.isBuffer(e)}function Ay(e,t){return jy(e,void 0,e,new Map,t)}function jy(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(Qv(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;avoid 0)}function Ry(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return zy(e,t,n,r,i);case`function`:return Object.keys(t).length>0?Ry(e,{...t},n,r,i):Fy(e,t);default:return Iy(e)&&i?typeof t!=`string`||t===``:Fy(e,t)}}function zy(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return Vy(e,t,n,r);if(t instanceof Map)return By(e,t,n,r);if(t instanceof Set)return Hy(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)Qv(e)&&(e=Object(e));else{let t=ty(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;ivoid 0)}function Wy(e){return e=Py(e),t=>Uy(t,e)}function Gy(e,t){return Ay(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(ty(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),My(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case iy:case ry:case ay:{let t=new e.constructor(e?.valueOf());return My(t,e),t}case oy:{let t={};return My(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function Ky(e){return Gy(e)}var qy=/^(?:0|[1-9]\d*)$/;function Jy(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{var t=C();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),rb=o(((e,t)=>{t.exports=nb()})),ib=o((e=>{var t=C(),n=rb();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),ab=o(((e,t)=>{t.exports=ib()})),ob=(0,w.createContext)(null),sb=ab(),cb=e=>e,lb=()=>{var e=(0,w.useContext)(ob);return e?e.store.dispatch:cb},ub=()=>{},db=()=>ub,fb=(e,t)=>e===t;function K(e){var t=(0,w.useContext)(ob),n=(0,w.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:ub,[t,e]);return(0,sb.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:db,t?t.store.getState:ub,t?t.store.getState:ub,n,fb)}function pb(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function mb(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var hb=e=>Array.isArray(e)?e:[e];function gb(e){let t=Array.isArray(e[0])?e[0]:e;return mb(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function _b(e,t){let n=[],{length:r}=e;for(let i=0;i`u`?vb:WeakRef,bb=0,xb=1;function Sb(){return{s:bb,v:void 0,o:null,p:null}}function Cb(e){return e instanceof yb?e.deref():e}function wb(e,t={}){let n=Sb(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e{n=Sb(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Tb(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),pb(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=wb,argsMemoizeOptions:u=[]}={...n,...a},d=hb(c),f=hb(u),p=gb(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=_b(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var q=Tb(wb);function Eb(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{if(e!==t){let r=Ob(e),i=Ob(t);if(r===i&&r===0){if(et)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},Ab=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,jb=/^\w*$/;function Mb(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||og(e)?!0:typeof e==`string`&&(jb.test(e)||!Ab.test(e))||t!=null&&Object.hasOwn(t,e)}function Nb(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=Xv(e)?Array.from(e):Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||Mb(e)?e:{key:e,path:lg(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;re.original)}function Pb(e,...t){let n=t.length;return n>1&&Db(e,t[0],t[1])?t=[]:n>2&&Db(t[0],t[1],t[2])&&(t=[t[0]]),Nb(e,Eb(t),[`asc`])}var Fb=e=>e.legend.settings,Ib=e=>e.legend.size,Lb=q([e=>e.legend.payload,Fb],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?Pb(r,n):r});function Rb(){return K(Lb)}function zb(e,t){return Wb(e)||Ub(e,t)||Vb(e,t)||Bb()}function Bb(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vb(e,t){if(e){if(typeof e==`string`)return Hb(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hb(e,t):void 0}}function Hb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nGb||Math.abs(e.left-t.left)>Gb||Math.abs(e.top-t.top)>Gb||Math.abs(e.width-t.width)>Gb}function qb(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function Jb(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=zb((0,w.useState)({height:0,left:0,top:0,width:0}),2),n=t[0],r=t[1],i=(0,w.useRef)(null),a=(0,w.useRef)(n);a.current=n;var o=(0,w.useCallback)(e=>{if(i.current!=null&&(i.current.disconnect(),i.current=null),e!=null){var t=qb(e);if(Kb(t,a.current)&&r(t),typeof ResizeObserver<`u`){var n=new ResizeObserver(()=>{var t=qb(e);Kb(t,a.current)&&r(t)});n.observe(e),i.current=n}}},[...e]);return(0,w.useEffect)(()=>()=>{var e;(e=i.current)==null||e.disconnect()},[]),[n,o]}function Yb(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Xb=typeof Symbol==`function`&&Symbol.observable||`@@observable`,Zb=()=>Math.random().toString(36).substring(7).split(``).join(`.`),Qb={INIT:`@@redux/INIT${Zb()}`,REPLACE:`@@redux/REPLACE${Zb()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Zb()}`};function $b(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function ex(e,t,n){if(typeof e!=`function`)throw Error(Yb(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(Yb(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(Yb(1));return n(ex)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(Yb(3));return i}function d(e){if(typeof e!=`function`)throw Error(Yb(4));if(c)throw Error(Yb(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(Yb(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!$b(e))throw Error(Yb(7));if(e.type===void 0)throw Error(Yb(8));if(typeof e.type!=`string`)throw Error(Yb(17));if(c)throw Error(Yb(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(Yb(10));r=e,f({type:Qb.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(Yb(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[Xb](){return this}}}return f({type:Qb.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[Xb]:m}}function tx(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:Qb.INIT})===void 0)throw Error(Yb(12));if(n(void 0,{type:Qb.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(Yb(13))})}function nx(e){let t=Object.keys(e),n={};for(let r=0;re:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function ix(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(Yb(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=rx(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function ax(e){return $b(e)&&`type`in e&&typeof e.type==`string`}var ox=Symbol.for(`immer-nothing`),sx=Symbol.for(`immer-draftable`),cx=Symbol.for(`immer-state`);function lx(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ux=Object,dx=ux.getPrototypeOf,fx=`constructor`,px=`prototype`,mx=`configurable`,hx=`enumerable`,gx=`writable`,_x=`value`,vx=e=>!!e&&!!e[cx];function yx(e){return e?Sx(e)||kx(e)||!!e[sx]||!!e[fx]?.[sx]||Ax(e)||jx(e):!1}var bx=ux[px][fx].toString(),xx=new WeakMap;function Sx(e){if(!e||!Mx(e))return!1;let t=dx(e);if(t===null||t===ux[px])return!0;let n=ux.hasOwnProperty.call(t,fx)&&t[fx];if(n===Object)return!0;if(!Nx(n))return!1;let r=xx.get(n);return r===void 0&&(r=Function.toString.call(n),xx.set(n,r)),r===bx}function Cx(e,t,n=!0){wx(e)===0?(n?Reflect.ownKeys(e):ux.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function wx(e){let t=e[cx];return t?t.type_:kx(e)?1:Ax(e)?2:jx(e)?3:0}var Tx=(e,t,n=wx(e))=>n===2?e.has(t):ux[px].hasOwnProperty.call(e,t),Ex=(e,t,n=wx(e))=>n===2?e.get(t):e[t],Dx=(e,t,n,r=wx(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function Ox(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var kx=Array.isArray,Ax=e=>e instanceof Map,jx=e=>e instanceof Set,Mx=e=>typeof e==`object`,Nx=e=>typeof e==`function`,Px=e=>typeof e==`boolean`;function Fx(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Ix=e=>e.copy_||e.base_,Lx=e=>e.modified_?e.copy_:e.base_;function Rx(e,t){if(Ax(e))return new Map(e);if(jx(e))return new Set(e);if(kx(e))return Array[px].slice.call(e);let n=Sx(e);if(t===!0||t===`class_only`&&!n){let t=ux.getOwnPropertyDescriptors(e);delete t[cx];let n=Reflect.ownKeys(t);for(let r=0;r1&&ux.defineProperties(e,{set:Vx,add:Vx,clear:Vx,delete:Vx}),ux.freeze(e),t&&Cx(e,(e,t)=>{zx(t,!0)},!1),e)}function Bx(){lx(2)}var Vx={[_x]:Bx};function Hx(e){return e===null||!Mx(e)||ux.isFrozen(e)}var Ux=`MapSet`,Wx=`Patches`,Gx=`ArrayMethods`,Kx={};function qx(e){let t=Kx[e];return t||lx(0,e),t}var Jx=e=>!!Kx[e],Yx,Xx=()=>Yx,Zx=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Jx(Ux)?qx(Ux):void 0,arrayMethodsPlugin_:Jx(Gx)?qx(Gx):void 0});function Qx(e,t){t&&(e.patchPlugin_=qx(Wx),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function $x(e){eS(e),e.drafts_.forEach(nS),e.drafts_=null}function eS(e){e===Yx&&(Yx=e.parent_)}var tS=e=>Yx=Zx(Yx,e);function nS(e){let t=e[cx];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function rS(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[cx].modified_&&($x(t),lx(4)),yx(e)&&(e=iS(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[cx].base_,e,t)}else e=iS(t,n);return aS(t,e,!0),$x(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===ox?void 0:e}function iS(e,t){if(Hx(t))return t;let n=t[cx];if(!n)return pS(t,e.handledSet_,e);if(!sS(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);dS(n,e)}return n.copy_}function aS(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&zx(t,n)}function oS(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var sS=(e,t)=>e.scope_===t,cS=[];function lS(e,t,n,r){let i=Ix(e),a=e.type_;if(r!==void 0&&Ex(i,r,a)===t){Dx(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;Cx(i,(e,n)=>{if(vx(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??cS;for(let e of o)Dx(i,e,n,a)}function uS(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!sS(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Lx(i);lS(e,i.draft_??i,a,n),dS(i,r)})}function dS(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}oS(e)}}function fS(e,t,n){let{scope_:r}=e;if(vx(n)){let i=n[cx];sS(i,r)&&i.callbacks_.push(function(){SS(e),lS(e,n,Lx(i),t)})}else yx(n)&&e.callbacks_.push(function(){let i=Ix(e);e.type_===3?i.has(n)&&pS(n,r.handledSet_,r):Ex(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&pS(Ex(e.copy_,t,e.type_),r.handledSet_,r)})}function pS(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||vx(e)||t.has(e)||!yx(e)||Hx(e)?e:(t.add(e),Cx(e,(r,i)=>{if(vx(i)){let t=i[cx];sS(t,n)&&(Dx(e,r,Lx(t),e.type_),oS(t))}else yx(i)&&pS(i,t,n)}),e)}function mS(e,t){let n=kx(e),r={type_:+!!n,scope_:t?t.scope_:Xx(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=hS;n&&(i=[r],a=gS);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var hS={get(e,t){if(t===cx)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=Ix(e);if(!Tx(i,t,e.type_))return yS(e,i,t);let a=i[t];if(e.finalized_||!yx(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&Fx(t))return a;if(a===_S(e.base_,t)||vS(e,t,a)){SS(e);let n=e.type_===1?+t:t,r=wS(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in Ix(e)},ownKeys(e){return Reflect.ownKeys(Ix(e))},set(e,t,n){let r=bS(Ix(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=_S(Ix(e),t),i=r?.[cx];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(Ox(n,r)&&(n!==void 0||Tx(e.base_,t,e.type_)))return!0;SS(e),xS(e)}return e.copy_[t]===n&&(n!==void 0||Tx(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),fS(e,t,n),!0)},deleteProperty(e,t){return SS(e),_S(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),xS(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=Ix(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[gx]:!0,[mx]:e.type_!==1||t!==`length`,[hx]:r[hx],[_x]:n[t]}},defineProperty(){lx(11)},getPrototypeOf(e){return dx(e.base_)},setPrototypeOf(){lx(12)}},gS={};for(let e in hS){let t=hS[e];gS[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}gS.deleteProperty=function(e,t){return gS.set.call(this,e,t,void 0)},gS.set=function(e,t,n){return hS.set.call(this,e[0],t,n,e[0])};function _S(e,t){let n=e[cx];return(n?Ix(n):e)[t]}function vS(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!yx(n)||n[cx]?!1:e.baseRefs_.has(n)}function yS(e,t,n){let r=bS(t,n);return r?_x in r?r[_x]:r.get?.call(e.draft_):void 0}function bS(e,t){if(!(t in e))return;let n=dx(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=dx(n)}}function xS(e){e.modified_||(e.modified_=!0,e.parent_&&xS(e.parent_))}function SS(e){e.copy_||=(e.assigned_=new Map,Rx(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var CS=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Nx(e)&&!Nx(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}Nx(t)||lx(6),n!==void 0&&!Nx(n)&&lx(7);let r;if(yx(e)){let i=tS(this),a=wS(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?$x(i):eS(i)}return Qx(i,n),rS(r,i)}if(!e||!Mx(e)){if(r=t(e),r===void 0&&(r=e),r===ox&&(r=void 0),this.autoFreeze_&&zx(r,!0),n){let t=[],i=[];qx(Wx).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}lx(1,e)},this.produceWithPatches=(e,t)=>{if(Nx(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Px(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Px(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Px(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){yx(e)||lx(8),vx(e)&&(e=TS(e));let t=tS(this),n=wS(t,e,void 0);return n[cx].isManual_=!0,eS(t),n}finishDraft(e,t){let n=e&&e[cx];(!n||!n.isManual_)&&lx(9);let{scope_:r}=n;return Qx(r,t),rS(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=qx(Wx).applyPatches_;return vx(e)?r(e,t):this.produce(e,e=>r(e,t))}};function wS(e,t,n,r){let[i,a]=Ax(t)?qx(Ux).proxyMap_(t,n):jx(t)?qx(Ux).proxySet_(t,n):mS(t,n);return(n?.scope_??Xx()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?uS(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function TS(e){return vx(e)||lx(10,e),ES(e)}function ES(e){if(!yx(e)||Hx(e))return e;let t=e[cx],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Rx(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Rx(e,!0);return Cx(n,(e,t)=>{Dx(n,e,ES(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var DS=new CS().produce,OS=e=>e;function kS(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var AS=kS(),jS=kS,MS=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?rx:rx.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function NS(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(HC(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ax(t)&&t.type===e,n}var PS=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function FS(e){return yx(e)?DS(e,()=>{}):e}function IS(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function LS(e){return typeof e==`boolean`}var RS=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new PS;return t&&(LS(t)?a.push(AS):a.push(jS(t.extraArgument))),a},zS=`RTK_autoBatch`,BS=()=>e=>({payload:e,meta:{[zS]:!0}}),VS=e=>t=>{setTimeout(t,e)},HS=(e,t)=>n=>{let r=!1,i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(o),n())},a=e(i),o=setTimeout(i,t)},US=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?HS(window.requestAnimationFrame,100):VS(10):e.type===`callback`?e.queueNotification:VS(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[zS],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},WS=e=>function(t){let{autoBatch:n=!0}=t??{},r=new PS(e);return n&&r.push(US(typeof n==`object`?n:void 0)),r};function GS(e){let t=RS(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if($b(n))c=nx(n);else throw Error(HC(1));let l;l=typeof r==`function`?r(t):t();let u=rx;i&&(u=MS({trace:!1,...typeof i==`object`&&i}));let d=WS(ix(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return ex(c,o,p)}function KS(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(HC(28));if(r in t)throw Error(HC(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function qS(e){return typeof e==`function`}function JS(e,t){let[n,r,i]=KS(t),a;if(qS(e))a=()=>FS(e());else{let t=FS(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(vx(e)){let r=n(e,t);return r===void 0?e:r}if(yx(e))return DS(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}}return e},e)}return o.getInitialState=a,o}var YS=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,XS=(e=21)=>{let t=``,n=e;for(;n--;)t+=YS[Math.random()*64|0];return t},ZS=Symbol.for(`rtk-slice-createasyncthunk`);function QS(e,t){return`${e}/${t}`}function $S({creators:e}={}){let t=e?.asyncThunk?.[ZS];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(HC(11));let i=(typeof e.reducers==`function`?e.reducers(nC()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(HC(12));if(n in o.sliceCaseReducersByType)throw Error(HC(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:QS(n,r),createNotation:typeof e.reducers==`function`};iC(a)?oC(o,a,s,t):rC(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?KS(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return JS(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=IS(d,r,m)),i}function i(t=l){return IS(IS(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=eC(a,t,()=>IS(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function eC(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var tC=$S();function nC(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function rC({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!aC(r))throw Error(HC(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?NS(e,o):NS(e))}function iC(e){return e._reducerDefinitionType===`asyncThunk`}function aC(e){return e._reducerDefinitionType===`reducerWithPrepare`}function oC({type:e,reducerName:t},n,r,i){if(!i)throw Error(HC(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||sC,pending:s||sC,rejected:c||sC,settled:l||sC})}function sC(){}var cC=`task`,lC=`listener`,uC=`completed`,dC=`cancelled`,fC=`task-${dC}`,pC=`task-${uC}`,mC=`${lC}-${dC}`,hC=`${lC}-${uC}`,gC=class{constructor(e){this.code=e,this.message=`${cC} ${dC} (reason: ${e})`}code;name=`TaskAbortError`;message},_C=(e,t)=>{if(typeof e!=`function`)throw TypeError(HC(32))},vC=()=>{},yC=(e,t=vC)=>(e.catch(t),e),bC=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),xC=e=>{if(e.aborted)throw new gC(e.reason)};function SC(e,t){let n=vC;return new Promise((r,i)=>{let a=()=>i(new gC(e.reason));if(e.aborted){a();return}n=bC(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=vC})}var CC=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof gC?`cancelled`:`rejected`,error:e}}finally{t?.()}},wC=e=>t=>yC(SC(e,t).then(t=>(xC(e),t))),TC=e=>{let t=wC(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:EC}=Object,DC={},OC=`listenerMiddleware`,kC=(e,t)=>{let n=t=>bC(e,()=>t.abort(e.reason));return(r,i)=>{_C(r,`taskExecutor`);let a=new AbortController;n(a);let o=CC(async()=>{xC(e),xC(a.signal);let t=await r({pause:wC(a.signal),delay:TC(a.signal),signal:a.signal});return xC(a.signal),t},()=>a.abort(pC));return i?.autoJoin&&t.push(o.catch(vC)),{result:wC(e)(o),cancel(){a.abort(fC)}}}},AC=(e,t)=>{let n=async(n,r)=>{xC(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await SC(t,Promise.race(a));return xC(t),e}finally{i()}};return((e,t)=>yC(n(e,t)))},jC=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=NS(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(HC(21));return _C(a,`options.listener`),{predicate:i,type:t,effect:a}},MC=EC(e=>{let{type:t,predicate:n,effect:r}=jC(e);return{id:XS(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(HC(22))}}},{withTypes:()=>MC}),NC=(e,t)=>{let{type:n,effect:r,predicate:i}=jC(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},PC=e=>{e.pending.forEach(e=>{e.abort(mC)})},FC=(e,t)=>()=>{for(let e of t.keys())PC(e);e.clear()},IC=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},LC=EC(NS(`${OC}/add`),{withTypes:()=>LC}),RC=NS(`${OC}/removeAll`),zC=EC(NS(`${OC}/remove`),{withTypes:()=>zC}),BC=(...e)=>{console.error(`${OC}/error`,...e)},VC=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=BC}=e;_C(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&PC(e)}),c=(e=>{let n=NC(t,e)??MC(e);return s(n)});EC(c,{withTypes:()=>c});let l=e=>{let n=NC(t,e);return n&&(n.unsubscribe(),e.cancelActive&&PC(n)),!!n};EC(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=AC(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,EC({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:TC(u.signal),pause:wC(u.signal),extra:a,signal:u.signal,fork:kC(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(mC),n.delete(e))})},cancel:()=>{u.abort(mC),e.pending.delete(u)},throwIfCancelled:()=>{xC(u.signal)}})))}catch(e){e instanceof gC||IC(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(hC),i(e),e.pending.delete(u)}},d=FC(t,n);return{middleware:e=>n=>r=>{if(!ax(r))return n(r);if(LC.match(r))return c(r.payload);if(RC.match(r)){d();return}if(zC.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===DC)throw Error(HC(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,IC(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=DC}return s},startListening:c,stopListening:l,clearListeners:d}};function HC(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var UC=tC({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),WC=UC.actions,GC=WC.setMargin,KC=WC.setLayout,qC=WC.setChartSize,JC=WC.setScale,YC=UC.reducer;function XC(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function ZC(e){return Number.isFinite(e)}function QC(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function $C(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 ew(e){for(var t=1;t{if(t&&n){var r=n.width,i=n.height,a=t.align,o=t.verticalAlign,s=t.layout,c=t.position,l=t.offset,u=l===void 0?0:l;if(c!=null){if(Lg(c)){if(c===`top`&&G(e.top))return ew(ew({},e),{},{top:e.top+(i||0)+u});if(c===`bottom`&&G(e.bottom))return ew(ew({},e),{},{bottom:e.bottom+(i||0)+u});if(c===`left`&&G(e.left))return ew(ew({},e),{},{left:e.left+(r||0)+u});if(c===`right`&&G(e.right))return ew(ew({},e),{},{right:e.right+(r||0)+u})}return e}if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&G(e[a]))return ew(ew({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&G(e[o]))return ew(ew({},e),{},{[o]:e[o]+(i||0)})}return e},ow=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,sw=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},cw=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,i=e.type,a=e.range,o=e.scale,s=e.realScaleType,c=e.isCategorical,l=e.categoricalDomain,u=e.tickCount,d=e.ticks,f=e.niceTicks,p=e.axisType;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?hg(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return ZC(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(Dg):c&&l?l.map((e,t)=>{var n=o.map(e);return ZC(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(Dg):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return ZC(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(Dg):o.domain().map((e,t)=>{var n=o.map(e);return ZC(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(Dg)},lw=(e,t)=>{if(!t||t.length!==2||!G(t[0])||!G(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!G(e[0])||e[0]r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:ov,none:tv,silhouette:sv,wiggle:cv,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},dw=(e,t,n)=>{var r=uw[n]??tv,i=av().keys(t).value((e,t)=>Number(iw(e,t,0))).order(nv).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=iw(e[i],t[r],0);Array.isArray(a)&&a.length===2&&G(a[0])&&G(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function fw(e){return e==null?void 0:String(e)}var pw=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=iw(a,t.dataKey,t.scale.domain()[o]);if(Tg(s))return null;var c=t.scale.map(s);return G(c)?c-i/2+r:null},mw=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]},hw=e=>{var t=e.flat(2).filter(G);return[Math.min(...t),Math.max(...t)]},gw=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],_w=(e,t,n)=>{if(e!=null&&Object.keys(e).length!==0)return gw(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var o=a.stackedData.reduce((e,r)=>{var i=hw(XC(r,t,n));return!ZC(i[0])||!ZC(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},vw=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,yw=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,bw=(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=Pb(t,e=>e.coordinate),a=[],o=0,s=1,c=i.length;su&&(d=Math.min(f,d));return d===1/0?0:d}return n?void 0:0};function xw(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,i=e.value,a=e.name;return ew(ew({},t),{},{dataKey:n,payload:r,value:i,name:a})}function Sw(e,t){if(e!=null)return String(e);if(typeof t==`string`)return t}var Cw=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},ww=(e,t)=>t===`centric`?e.angle:e.radius,Tw=e=>e.layout.width,Ew=e=>e.layout.height,Dw=e=>e.layout.scale,Ow=e=>e.layout.margin,kw=q(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Aw=q(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),jw=`data-recharts-item-index`;function Mw(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;te.brush.height;function Rw(e){return Aw(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function zw(e){return Aw(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Bw(e){return kw(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}function Vw(e){return kw(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}var Hw=q([Tw,Ew,Ow,Lw,Rw,zw,Bw,Vw,Fb,Ib],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=Nw(Nw({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=aw(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return Nw(Nw({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),Uw=q(Hw,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Ww=q(Tw,Ew,(e,t)=>({x:0,y:0,width:e,height:t})),Gw=(0,w.createContext)(null),Kw=()=>(0,w.useContext)(Gw)!=null,qw=e=>{var t=e.children;return w.createElement(Gw.Provider,{value:!0},t)},Jw=e=>e.brush,Yw=q([Jw,Hw,Ow],(e,t,n)=>({height:e.height,x:G(e.x)?e.x:t.left,y:G(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:G(e.width)?e.width:t.width}));function Xw(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function Zw(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=Xw(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function Qw(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return Zw(e,t,{leading:r,maxWait:t,trailing:i})}var $w=function(e,t){var n=[...arguments].slice(2);if(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,()=>n[r++]))}}},eT={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},tT=(e,t,n)=>{var r=n.width,i=r===void 0?eT.width:r,a=n.height,o=a===void 0?eT.height:a,s=n.aspect,c=n.maxHeight,l=_g(i)?e:Number(i),u=_g(o)?t:Number(o);return s&&s>0&&(l?u=l/s:u&&(l=u*s),c&&u!=null&&u>c&&(u=c)),{calculatedWidth:l,calculatedHeight:u}},nT={width:0,height:0,overflow:`visible`},rT={width:0,overflowX:`visible`},iT={height:0,overflowY:`visible`},aT={},oT=e=>{var t=e.width,n=e.height,r=_g(t),i=_g(n);return r&&i?nT:r?rT:i?iT:aT};function sT(e){var t=e.width,n=e.height,r=e.aspect,i=t,a=n;return i===void 0&&a===void 0?(i=eT.width,a=eT.height):i===void 0?i=r&&r>0?void 0:eT.width:a===void 0&&(a=r&&r>0?void 0:eT.height),{width:i,height:a}}var cT=[`aspect`,`initialDimension`,`width`,`height`,`minWidth`,`minHeight`,`maxHeight`,`children`,`debounce`,`id`,`className`,`onResize`,`style`];function lT(){return lT=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({width:n,height:r}),[n,r]);return wT(i)?w.createElement(CT.Provider,{value:i},t):null}var ET=()=>(0,w.useContext)(CT),DT=(0,w.forwardRef)((e,t)=>{var n=e.aspect,r=e.initialDimension,i=r===void 0?eT.initialDimension:r,a=e.width,o=e.height,s=e.minWidth,c=s===void 0?eT.minWidth:s,l=e.minHeight,u=e.maxHeight,d=e.children,f=e.debounce,p=f===void 0?eT.debounce:f,m=e.id,h=e.className,g=e.onResize,_=e.style,v=_===void 0?{}:_,y=xT(e,cT),b=(0,w.useRef)(null),x=(0,w.useRef)();x.current=g,(0,w.useImperativeHandle)(t,()=>b.current);var S=hT((0,w.useState)({containerWidth:i.width,containerHeight:i.height}),2),C=S[0],T=S[1],E=(0,w.useCallback)((e,t)=>{T(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,w.useEffect)(()=>{if(b.current==null||typeof ResizeObserver>`u`)return Og;var e=e=>{var t,n=e[0];if(n!=null){var r=n.contentRect,i=r.width,a=r.height;E(i,a),(t=x.current)==null||t.call(x,i,a)}};p>0&&(e=Qw(e,p,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=b.current.getBoundingClientRect(),r=n.width,i=n.height;return E(r,i),t.observe(b.current),()=>{t.disconnect()}},[E,p]);var D=C.containerWidth,O=C.containerHeight;$w(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var k=tT(D,O,{width:a,height:o,aspect:n,maxHeight:u}),A=k.calculatedWidth,j=k.calculatedHeight;return $w(D<0||O<0||A!=null&&A>0||j!=null&&j>0,`The width(%s) and height(%s) of chart should be greater than 0, + H${Xv}M${2*o},${i} + A${a},${a},0,1,1,${o},${i}`,className:`recharts-legend-icon`});if(c===`rect`)return w.createElement(`path`,{stroke:`none`,fill:s,d:`M0,${Xv/8}h${Xv}v${Xv*3/4}h${-Xv}z`,className:`recharts-legend-icon`});if(w.isValidElement(t.legendIcon)){var l=Kv({},t);return delete l.legendIcon,w.cloneElement(t.legendIcon,l)}return w.createElement(Nv,{fill:s,cx:i,cy:i,size:Xv,sizeType:`diameter`,type:c})}function ey(e){var t=e.payload,n=e.iconSize,r=e.layout,i=e.formatter,a=e.inactiveColor,o=e.iconType,s=e.labelStyle,c={x:0,y:0,width:Xv,height:Xv},l={display:r===`horizontal`?`inline-block`:`block`,marginRight:10,whiteSpace:`nowrap`},u={display:`inline-block`,verticalAlign:`middle`,marginRight:4};return t.map((t,r)=>{var d=t.formatter||i,f=L({"recharts-legend-item":!0,[`legend-item-${r}`]:!0,inactive:t.inactive});if(t.type===`none`)return null;var p=typeof s==`object`?Kv({},s):{};p.color=t.inactive?a:p.color||t.color,p.whiteSpace??=`normal`,p.overflowWrap??=`break-word`;var m=d?d(t.value,t,r):t.value;return w.createElement(`li`,Wv({className:f,style:l,key:`legend-item-${r}`},Lv(e,t,r)),w.createElement(og,{width:n,height:n,viewBox:c,style:u,"aria-label":t.value==null?`legend icon`:`${t.value} legend icon`},w.createElement($v,{data:t,iconType:o,inactiveColor:a})),w.createElement(`span`,{className:`recharts-legend-item-text`,style:p},m))})}var ty=e=>{var t=Uv(e,Zv),n=t.payload,r=t.layout,i=t.align;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:r===`horizontal`?i:`left`};return w.createElement(`ul`,{className:`recharts-default-legend`,style:a},w.createElement(ey,Wv({},t,{payload:n})))};function ny(e,t){let n=new Map;for(let r=0;r=0}function oy(e){return e!=null&&typeof e!=`function`&&ay(e.length)}function sy(e){return function(t){return bg(t,e)}}function cy(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function ly(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function uy(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function dy(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var fy=`[object RegExp]`,py=`[object String]`,my=`[object Number]`,hy=`[object Boolean]`,gy=`[object Arguments]`,_y=`[object Symbol]`,vy=`[object Date]`,yy=`[object Map]`,by=`[object Set]`,xy=`[object Array]`,Sy=`[object Function]`,Cy=`[object ArrayBuffer]`,wy=`[object Object]`,Ty=`[object Error]`,Ey=`[object DataView]`,Dy=`[object Uint8Array]`,Oy=`[object Uint8ClampedArray]`,ky=`[object Uint16Array]`,Ay=`[object Uint32Array]`,jy=`[object BigUint64Array]`,My=`[object Int8Array]`,Ny=`[object Int16Array]`,Py=`[object Int32Array]`,Fy=`[object BigInt64Array]`,Iy=`[object Float32Array]`,Ly=`[object Float64Array]`,Ry=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function zy(e){return Ry.Buffer!==void 0&&Ry.Buffer.isBuffer(e)}function By(e,t){return Vy(e,void 0,e,new Map,t)}function Vy(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(cy(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;avoid 0)}function Jy(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return Yy(e,t,n,r,i);case`function`:return Object.keys(t).length>0?Jy(e,{...t},n,r,i):Gy(e,t);default:return Ky(e)&&i?typeof t!=`string`||t===``:Gy(e,t)}}function Yy(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return Zy(e,t,n,r);if(t instanceof Map)return Xy(e,t,n,r);if(t instanceof Set)return Qy(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)cy(e)&&(e=Object(e));else{let t=dy(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;ivoid 0)}function eb(e){return e=Wy(e),t=>$y(t,e)}function tb(e,t){return By(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(dy(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),Hy(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case my:case py:case hy:{let t=new e.constructor(e?.valueOf());return Hy(t,e),t}case gy:{let t={};return Hy(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function nb(e){return tb(e)}var rb=/^(?:0|[1-9]\d*)$/;function ib(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{var t=C();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),pb=o(((e,t)=>{t.exports=fb()})),mb=o((e=>{var t=C(),n=pb();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),hb=o(((e,t)=>{t.exports=mb()})),gb=(0,w.createContext)(null),_b=hb(),vb=e=>e,yb=()=>{var e=(0,w.useContext)(gb);return e?e.store.dispatch:vb},bb=()=>{},xb=()=>bb,Sb=(e,t)=>e===t;function K(e){var t=(0,w.useContext)(gb),n=(0,w.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:bb,[t,e]);return(0,_b.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:xb,t?t.store.getState:bb,t?t.store.getState:bb,n,Sb)}function Cb(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function wb(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var Tb=e=>Array.isArray(e)?e:[e];function Eb(e){let t=Array.isArray(e[0])?e[0]:e;return wb(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Db(e,t){let n=[],{length:r}=e;for(let i=0;i`u`?Ob:WeakRef,Ab=0,jb=1;function Mb(){return{s:Ab,v:void 0,o:null,p:null}}function Nb(e){return e instanceof kb?e.deref():e}function Pb(e,t={}){let n=Mb(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e{n=Mb(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Fb(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Cb(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=Pb,argsMemoizeOptions:u=[]}={...n,...a},d=Tb(c),f=Tb(u),p=Eb(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=Db(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var q=Fb(Pb);function Ib(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{if(e!==t){let r=Rb(e),i=Rb(t);if(r===i&&r===0){if(et)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},Bb=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vb=/^\w*$/;function Hb(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||gg(e)?!0:typeof e==`string`&&(Vb.test(e)||!Bb.test(e))||t!=null&&Object.hasOwn(t,e)}function Ub(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=oy(e)?Array.from(e):Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||Hb(e)?e:{key:e,path:yg(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;re.original)}function Wb(e,...t){let n=t.length;return n>1&&Lb(e,t[0],t[1])?t=[]:n>2&&Lb(t[0],t[1],t[2])&&(t=[t[0]]),Ub(e,Ib(t),[`asc`])}var Gb=e=>e.legend.settings,Kb=e=>e.legend.size,qb=q([e=>e.legend.payload,Gb],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?Wb(r,n):r});function Jb(){return K(qb)}function Yb(e,t){return ex(e)||$b(e,t)||Zb(e,t)||Xb()}function Xb(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zb(e,t){if(e){if(typeof e==`string`)return Qb(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qb(e,t):void 0}}function Qb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ntx||Math.abs(e.left-t.left)>tx||Math.abs(e.top-t.top)>tx||Math.abs(e.width-t.width)>tx}function rx(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function ix(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=Yb((0,w.useState)({height:0,left:0,top:0,width:0}),2),n=t[0],r=t[1],i=(0,w.useRef)(null),a=(0,w.useRef)(n);a.current=n;var o=(0,w.useCallback)(e=>{if(i.current!=null&&(i.current.disconnect(),i.current=null),e!=null){var t=rx(e);if(nx(t,a.current)&&r(t),typeof ResizeObserver<`u`){var n=new ResizeObserver(()=>{var t=rx(e);nx(t,a.current)&&r(t)});n.observe(e),i.current=n}}},[...e]);return(0,w.useEffect)(()=>()=>{var e;(e=i.current)==null||e.disconnect()},[]),[n,o]}function ax(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var ox=typeof Symbol==`function`&&Symbol.observable||`@@observable`,sx=()=>Math.random().toString(36).substring(7).split(``).join(`.`),cx={INIT:`@@redux/INIT${sx()}`,REPLACE:`@@redux/REPLACE${sx()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${sx()}`};function lx(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function ux(e,t,n){if(typeof e!=`function`)throw Error(ax(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(ax(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(ax(1));return n(ux)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(ax(3));return i}function d(e){if(typeof e!=`function`)throw Error(ax(4));if(c)throw Error(ax(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(ax(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!lx(e))throw Error(ax(7));if(e.type===void 0)throw Error(ax(8));if(typeof e.type!=`string`)throw Error(ax(17));if(c)throw Error(ax(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(ax(10));r=e,f({type:cx.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(ax(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[ox](){return this}}}return f({type:cx.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[ox]:m}}function dx(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:cx.INIT})===void 0)throw Error(ax(12));if(n(void 0,{type:cx.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(ax(13))})}function fx(e){let t=Object.keys(e),n={};for(let r=0;re:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function mx(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(ax(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=px(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function hx(e){return lx(e)&&`type`in e&&typeof e.type==`string`}var gx=Symbol.for(`immer-nothing`),_x=Symbol.for(`immer-draftable`),vx=Symbol.for(`immer-state`);function yx(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var bx=Object,xx=bx.getPrototypeOf,Sx=`constructor`,Cx=`prototype`,wx=`configurable`,Tx=`enumerable`,Ex=`writable`,Dx=`value`,Ox=e=>!!e&&!!e[vx];function kx(e){return e?Mx(e)||zx(e)||!!e[_x]||!!e[Sx]?.[_x]||Bx(e)||Vx(e):!1}var Ax=bx[Cx][Sx].toString(),jx=new WeakMap;function Mx(e){if(!e||!Hx(e))return!1;let t=xx(e);if(t===null||t===bx[Cx])return!0;let n=bx.hasOwnProperty.call(t,Sx)&&t[Sx];if(n===Object)return!0;if(!Ux(n))return!1;let r=jx.get(n);return r===void 0&&(r=Function.toString.call(n),jx.set(n,r)),r===Ax}function Nx(e,t,n=!0){Px(e)===0?(n?Reflect.ownKeys(e):bx.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Px(e){let t=e[vx];return t?t.type_:zx(e)?1:Bx(e)?2:Vx(e)?3:0}var Fx=(e,t,n=Px(e))=>n===2?e.has(t):bx[Cx].hasOwnProperty.call(e,t),Ix=(e,t,n=Px(e))=>n===2?e.get(t):e[t],Lx=(e,t,n,r=Px(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function Rx(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var zx=Array.isArray,Bx=e=>e instanceof Map,Vx=e=>e instanceof Set,Hx=e=>typeof e==`object`,Ux=e=>typeof e==`function`,Wx=e=>typeof e==`boolean`;function Gx(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Kx=e=>e.copy_||e.base_,qx=e=>e.modified_?e.copy_:e.base_;function Jx(e,t){if(Bx(e))return new Map(e);if(Vx(e))return new Set(e);if(zx(e))return Array[Cx].slice.call(e);let n=Mx(e);if(t===!0||t===`class_only`&&!n){let t=bx.getOwnPropertyDescriptors(e);delete t[vx];let n=Reflect.ownKeys(t);for(let r=0;r1&&bx.defineProperties(e,{set:Zx,add:Zx,clear:Zx,delete:Zx}),bx.freeze(e),t&&Nx(e,(e,t)=>{Yx(t,!0)},!1),e)}function Xx(){yx(2)}var Zx={[Dx]:Xx};function Qx(e){return e===null||!Hx(e)||bx.isFrozen(e)}var $x=`MapSet`,eS=`Patches`,tS=`ArrayMethods`,nS={};function rS(e){let t=nS[e];return t||yx(0,e),t}var iS=e=>!!nS[e],aS,oS=()=>aS,sS=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:iS($x)?rS($x):void 0,arrayMethodsPlugin_:iS(tS)?rS(tS):void 0});function cS(e,t){t&&(e.patchPlugin_=rS(eS),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function lS(e){uS(e),e.drafts_.forEach(fS),e.drafts_=null}function uS(e){e===aS&&(aS=e.parent_)}var dS=e=>aS=sS(aS,e);function fS(e){let t=e[vx];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function pS(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[vx].modified_&&(lS(t),yx(4)),kx(e)&&(e=mS(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[vx].base_,e,t)}else e=mS(t,n);return hS(t,e,!0),lS(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===gx?void 0:e}function mS(e,t){if(Qx(t))return t;let n=t[vx];if(!n)return CS(t,e.handledSet_,e);if(!_S(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);xS(n,e)}return n.copy_}function hS(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Yx(t,n)}function gS(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var _S=(e,t)=>e.scope_===t,vS=[];function yS(e,t,n,r){let i=Kx(e),a=e.type_;if(r!==void 0&&Ix(i,r,a)===t){Lx(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;Nx(i,(e,n)=>{if(Ox(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??vS;for(let e of o)Lx(i,e,n,a)}function bS(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!_S(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=qx(i);yS(e,i.draft_??i,a,n),xS(i,r)})}function xS(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}gS(e)}}function SS(e,t,n){let{scope_:r}=e;if(Ox(n)){let i=n[vx];_S(i,r)&&i.callbacks_.push(function(){MS(e),yS(e,n,qx(i),t)})}else kx(n)&&e.callbacks_.push(function(){let i=Kx(e);e.type_===3?i.has(n)&&CS(n,r.handledSet_,r):Ix(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&CS(Ix(e.copy_,t,e.type_),r.handledSet_,r)})}function CS(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ox(e)||t.has(e)||!kx(e)||Qx(e)?e:(t.add(e),Nx(e,(r,i)=>{if(Ox(i)){let t=i[vx];_S(t,n)&&(Lx(e,r,qx(t),e.type_),gS(t))}else kx(i)&&CS(i,t,n)}),e)}function wS(e,t){let n=zx(e),r={type_:+!!n,scope_:t?t.scope_:oS(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=TS;n&&(i=[r],a=ES);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var TS={get(e,t){if(t===vx)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=Kx(e);if(!Fx(i,t,e.type_))return kS(e,i,t);let a=i[t];if(e.finalized_||!kx(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&Gx(t))return a;if(a===DS(e.base_,t)||OS(e,t,a)){MS(e);let n=e.type_===1?+t:t,r=PS(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in Kx(e)},ownKeys(e){return Reflect.ownKeys(Kx(e))},set(e,t,n){let r=AS(Kx(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=DS(Kx(e),t),i=r?.[vx];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(Rx(n,r)&&(n!==void 0||Fx(e.base_,t,e.type_)))return!0;MS(e),jS(e)}return e.copy_[t]===n&&(n!==void 0||Fx(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),SS(e,t,n),!0)},deleteProperty(e,t){return MS(e),DS(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),jS(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=Kx(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Ex]:!0,[wx]:e.type_!==1||t!==`length`,[Tx]:r[Tx],[Dx]:n[t]}},defineProperty(){yx(11)},getPrototypeOf(e){return xx(e.base_)},setPrototypeOf(){yx(12)}},ES={};for(let e in TS){let t=TS[e];ES[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}ES.deleteProperty=function(e,t){return ES.set.call(this,e,t,void 0)},ES.set=function(e,t,n){return TS.set.call(this,e[0],t,n,e[0])};function DS(e,t){let n=e[vx];return(n?Kx(n):e)[t]}function OS(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||e.assigned_?.get(t)||!kx(n)||n[vx]?!1:e.baseRefs_.has(n)}function kS(e,t,n){let r=AS(t,n);return r?Dx in r?r[Dx]:r.get?.call(e.draft_):void 0}function AS(e,t){if(!(t in e))return;let n=xx(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=xx(n)}}function jS(e){e.modified_||(e.modified_=!0,e.parent_&&jS(e.parent_))}function MS(e){e.copy_||=(e.assigned_=new Map,Jx(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var NS=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Ux(e)&&!Ux(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}Ux(t)||yx(6),n!==void 0&&!Ux(n)&&yx(7);let r;if(kx(e)){let i=dS(this),a=PS(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?lS(i):uS(i)}return cS(i,n),pS(r,i)}if(!e||!Hx(e)){if(r=t(e),r===void 0&&(r=e),r===gx&&(r=void 0),this.autoFreeze_&&Yx(r,!0),n){let t=[],i=[];rS(eS).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}yx(1,e)},this.produceWithPatches=(e,t)=>{if(Ux(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Wx(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Wx(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Wx(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){kx(e)||yx(8),Ox(e)&&(e=FS(e));let t=dS(this),n=PS(t,e,void 0);return n[vx].isManual_=!0,uS(t),n}finishDraft(e,t){let n=e&&e[vx];(!n||!n.isManual_)&&yx(9);let{scope_:r}=n;return cS(r,t),pS(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=rS(eS).applyPatches_;return Ox(e)?r(e,t):this.produce(e,e=>r(e,t))}};function PS(e,t,n,r){let[i,a]=Bx(t)?rS($x).proxyMap_(t,n):Vx(t)?rS($x).proxySet_(t,n):wS(t,n);return(n?.scope_??oS()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?bS(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function FS(e){return Ox(e)||yx(10,e),IS(e)}function IS(e){if(!kx(e)||Qx(e))return e;let t=e[vx],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Jx(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Jx(e,!0);return Nx(n,(e,t)=>{Lx(n,e,IS(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var LS=new NS().produce,RS=e=>e;function zS(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var BS=zS(),VS=zS,HS=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?px:px.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function US(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(QC(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>hx(t)&&t.type===e,n}var WS=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function GS(e){return kx(e)?LS(e,()=>{}):e}function KS(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function qS(e){return typeof e==`boolean`}var JS=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new WS;return t&&(qS(t)?a.push(BS):a.push(VS(t.extraArgument))),a},YS=`RTK_autoBatch`,XS=()=>e=>({payload:e,meta:{[YS]:!0}}),ZS=e=>t=>{setTimeout(t,e)},QS=(e,t)=>n=>{let r=!1,i=()=>{r||(r=!0,cancelAnimationFrame(a),clearTimeout(o),n())},a=e(i),o=setTimeout(i,t)},$S=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?QS(window.requestAnimationFrame,100):ZS(10):e.type===`callback`?e.queueNotification:ZS(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[YS],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},eC=e=>function(t){let{autoBatch:n=!0}=t??{},r=new WS(e);return n&&r.push($S(typeof n==`object`?n:void 0)),r};function tC(e){let t=JS(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(lx(n))c=fx(n);else throw Error(QC(1));let l;l=typeof r==`function`?r(t):t();let u=px;i&&(u=HS({trace:!1,...typeof i==`object`&&i}));let d=eC(mx(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return ux(c,o,p)}function nC(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(QC(28));if(r in t)throw Error(QC(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function rC(e){return typeof e==`function`}function iC(e,t){let[n,r,i]=nC(t),a;if(rC(e))a=()=>GS(e());else{let t=GS(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(Ox(e)){let r=n(e,t);return r===void 0?e:r}if(kx(e))return LS(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}}return e},e)}return o.getInitialState=a,o}var aC=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,oC=(e=21)=>{let t=``,n=e;for(;n--;)t+=aC[Math.random()*64|0];return t},sC=Symbol.for(`rtk-slice-createasyncthunk`);function cC(e,t){return`${e}/${t}`}function lC({creators:e}={}){let t=e?.asyncThunk?.[sC];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(QC(11));let i=(typeof e.reducers==`function`?e.reducers(fC()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(QC(12));if(n in o.sliceCaseReducersByType)throw Error(QC(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:cC(n,r),createNotation:typeof e.reducers==`function`};mC(a)?gC(o,a,s,t):pC(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?nC(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return iC(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=KS(d,r,m)),i}function i(t=l){return KS(KS(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=uC(a,t,()=>KS(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function uC(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var dC=lC();function fC(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function pC({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!hC(r))throw Error(QC(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?US(e,o):US(e))}function mC(e){return e._reducerDefinitionType===`asyncThunk`}function hC(e){return e._reducerDefinitionType===`reducerWithPrepare`}function gC({type:e,reducerName:t},n,r,i){if(!i)throw Error(QC(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||_C,pending:s||_C,rejected:c||_C,settled:l||_C})}function _C(){}var vC=`task`,yC=`listener`,bC=`completed`,xC=`cancelled`,SC=`task-${xC}`,CC=`task-${bC}`,wC=`${yC}-${xC}`,TC=`${yC}-${bC}`,EC=class{constructor(e){this.code=e,this.message=`${vC} ${xC} (reason: ${e})`}code;name=`TaskAbortError`;message},DC=(e,t)=>{if(typeof e!=`function`)throw TypeError(QC(32))},OC=()=>{},kC=(e,t=OC)=>(e.catch(t),e),AC=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),jC=e=>{if(e.aborted)throw new EC(e.reason)};function MC(e,t){let n=OC;return new Promise((r,i)=>{let a=()=>i(new EC(e.reason));if(e.aborted){a();return}n=AC(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=OC})}var NC=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof EC?`cancelled`:`rejected`,error:e}}finally{t?.()}},PC=e=>t=>kC(MC(e,t).then(t=>(jC(e),t))),FC=e=>{let t=PC(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:IC}=Object,LC={},RC=`listenerMiddleware`,zC=(e,t)=>{let n=t=>AC(e,()=>t.abort(e.reason));return(r,i)=>{DC(r,`taskExecutor`);let a=new AbortController;n(a);let o=NC(async()=>{jC(e),jC(a.signal);let t=await r({pause:PC(a.signal),delay:FC(a.signal),signal:a.signal});return jC(a.signal),t},()=>a.abort(CC));return i?.autoJoin&&t.push(o.catch(OC)),{result:PC(e)(o),cancel(){a.abort(SC)}}}},BC=(e,t)=>{let n=async(n,r)=>{jC(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await MC(t,Promise.race(a));return jC(t),e}finally{i()}};return((e,t)=>kC(n(e,t)))},VC=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=US(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(QC(21));return DC(a,`options.listener`),{predicate:i,type:t,effect:a}},HC=IC(e=>{let{type:t,predicate:n,effect:r}=VC(e);return{id:oC(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(QC(22))}}},{withTypes:()=>HC}),UC=(e,t)=>{let{type:n,effect:r,predicate:i}=VC(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},WC=e=>{e.pending.forEach(e=>{e.abort(wC)})},GC=(e,t)=>()=>{for(let e of t.keys())WC(e);e.clear()},KC=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},qC=IC(US(`${RC}/add`),{withTypes:()=>qC}),JC=US(`${RC}/removeAll`),YC=IC(US(`${RC}/remove`),{withTypes:()=>YC}),XC=(...e)=>{console.error(`${RC}/error`,...e)},ZC=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=XC}=e;DC(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&WC(e)}),c=(e=>{let n=UC(t,e)??HC(e);return s(n)});IC(c,{withTypes:()=>c});let l=e=>{let n=UC(t,e);return n&&(n.unsubscribe(),e.cancelActive&&WC(n)),!!n};IC(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=BC(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,IC({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:FC(u.signal),pause:PC(u.signal),extra:a,signal:u.signal,fork:zC(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(wC),n.delete(e))})},cancel:()=>{u.abort(wC),e.pending.delete(u)},throwIfCancelled:()=>{jC(u.signal)}})))}catch(e){e instanceof EC||KC(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(TC),i(e),e.pending.delete(u)}},d=GC(t,n);return{middleware:e=>n=>r=>{if(!hx(r))return n(r);if(qC.match(r))return c(r.payload);if(JC.match(r)){d();return}if(YC.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===LC)throw Error(QC(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,KC(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=LC}return s},startListening:c,stopListening:l,clearListeners:d}};function QC(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var $C=dC({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),ew=$C.actions,tw=ew.setMargin,nw=ew.setLayout,rw=ew.setChartSize,iw=ew.setScale,aw=$C.reducer;function ow(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function sw(e){return Number.isFinite(e)}function cw(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function lw(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 uw(e){for(var t=1;t{if(t&&n){var r=n.width,i=n.height,a=t.align,o=t.verticalAlign,s=t.layout,c=t.position,l=t.offset,u=l===void 0?0:l;if(c!=null){if(qg(c)){if(c===`top`&&G(e.top))return uw(uw({},e),{},{top:e.top+(i||0)+u});if(c===`bottom`&&G(e.bottom))return uw(uw({},e),{},{bottom:e.bottom+(i||0)+u});if(c===`left`&&G(e.left))return uw(uw({},e),{},{left:e.left+(r||0)+u});if(c===`right`&&G(e.right))return uw(uw({},e),{},{right:e.right+(r||0)+u})}return e}if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&G(e[a]))return uw(uw({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&G(e[o]))return uw(uw({},e),{},{[o]:e[o]+(i||0)})}return e},gw=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,_w=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},vw=(e,t,n)=>{if(!e)return null;var r=e.duplicateDomain,i=e.type,a=e.range,o=e.scale,s=e.realScaleType,c=e.isCategorical,l=e.categoricalDomain,u=e.tickCount,d=e.ticks,f=e.niceTicks,p=e.axisType;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?Tg(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return sw(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(Lg):c&&l?l.map((e,t)=>{var n=o.map(e);return sw(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(Lg):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return sw(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(Lg):o.domain().map((e,t)=>{var n=o.map(e);return sw(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(Lg)},yw=(e,t)=>{if(!t||t.length!==2||!G(t[0])||!G(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!G(e[0])||e[0]r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:gv,none:dv,silhouette:_v,wiggle:vv,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},xw=(e,t,n)=>{var r=bw[n]??dv,i=hv().keys(t).value((e,t)=>Number(mw(e,t,0))).order(fv).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=mw(e[i],t[r],0);Array.isArray(a)&&a.length===2&&G(a[0])&&G(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function Sw(e){return e==null?void 0:String(e)}var Cw=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=mw(a,t.dataKey,t.scale.domain()[o]);if(Fg(s))return null;var c=t.scale.map(s);return G(c)?c-i/2+r:null},ww=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]},Tw=e=>{var t=e.flat(2).filter(G);return[Math.min(...t),Math.max(...t)]},Ew=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],Dw=(e,t,n)=>{if(e!=null&&Object.keys(e).length!==0)return Ew(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var o=a.stackedData.reduce((e,r)=>{var i=Tw(ow(r,t,n));return!sw(i[0])||!sw(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},Ow=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,kw=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Aw=(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=Wb(t,e=>e.coordinate),a=[],o=0,s=1,c=i.length;su&&(d=Math.min(f,d));return d===1/0?0:d}return n?void 0:0};function jw(e){var t=e.tooltipEntrySettings,n=e.dataKey,r=e.payload,i=e.value,a=e.name;return uw(uw({},t),{},{dataKey:n,payload:r,value:i,name:a})}function Mw(e,t){if(e!=null)return String(e);if(typeof t==`string`)return t}var Nw=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},Pw=(e,t)=>t===`centric`?e.angle:e.radius,Fw=e=>e.layout.width,Iw=e=>e.layout.height,Lw=e=>e.layout.scale,Rw=e=>e.layout.margin,zw=q(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Bw=q(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),Vw=`data-recharts-item-index`;function Hw(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 Uw(e){for(var t=1;te.brush.height;function Jw(e){return Bw(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Yw(e){return Bw(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function Xw(e){return zw(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}function Zw(e){return zw(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+(typeof t.height==`number`?t.height:30):e,0)}var Qw=q([Fw,Iw,Rw,qw,Jw,Yw,Xw,Zw,Gb,Kb],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=Uw(Uw({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=hw(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return Uw(Uw({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),$w=q(Qw,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),eT=q(Fw,Iw,(e,t)=>({x:0,y:0,width:e,height:t})),tT=(0,w.createContext)(null),nT=()=>(0,w.useContext)(tT)!=null,rT=e=>{var t=e.children;return w.createElement(tT.Provider,{value:!0},t)},iT=e=>e.brush,aT=q([iT,Qw,Rw],(e,t,n)=>({height:e.height,x:G(e.x)?e.x:t.left,y:G(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:G(e.width)?e.width:t.width}));function oT(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function sT(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=oT(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function cT(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return sT(e,t,{leading:r,maxWait:t,trailing:i})}var lT=function(e,t){var n=[...arguments].slice(2);if(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,()=>n[r++]))}}},uT={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},dT=(e,t,n)=>{var r=n.width,i=r===void 0?uT.width:r,a=n.height,o=a===void 0?uT.height:a,s=n.aspect,c=n.maxHeight,l=Dg(i)?e:Number(i),u=Dg(o)?t:Number(o);return s&&s>0&&(l?u=l/s:u&&(l=u*s),c&&u!=null&&u>c&&(u=c)),{calculatedWidth:l,calculatedHeight:u}},fT={width:0,height:0,overflow:`visible`},pT={width:0,overflowX:`visible`},mT={height:0,overflowY:`visible`},hT={},gT=e=>{var t=e.width,n=e.height,r=Dg(t),i=Dg(n);return r&&i?fT:r?pT:i?mT:hT};function _T(e){var t=e.width,n=e.height,r=e.aspect,i=t,a=n;return i===void 0&&a===void 0?(i=uT.width,a=uT.height):i===void 0?i=r&&r>0?void 0:uT.width:a===void 0&&(a=r&&r>0?void 0:uT.height),{width:i,height:a}}var vT=[`aspect`,`initialDimension`,`width`,`height`,`minWidth`,`minHeight`,`maxHeight`,`children`,`debounce`,`id`,`className`,`onResize`,`style`];function yT(){return yT=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({width:n,height:r}),[n,r]);return PT(i)?w.createElement(NT.Provider,{value:i},t):null}var IT=()=>(0,w.useContext)(NT),LT=(0,w.forwardRef)((e,t)=>{var n=e.aspect,r=e.initialDimension,i=r===void 0?uT.initialDimension:r,a=e.width,o=e.height,s=e.minWidth,c=s===void 0?uT.minWidth:s,l=e.minHeight,u=e.maxHeight,d=e.children,f=e.debounce,p=f===void 0?uT.debounce:f,m=e.id,h=e.className,g=e.onResize,_=e.style,v=_===void 0?{}:_,y=jT(e,vT),b=(0,w.useRef)(null),x=(0,w.useRef)();x.current=g,(0,w.useImperativeHandle)(t,()=>b.current);var S=TT((0,w.useState)({containerWidth:i.width,containerHeight:i.height}),2),C=S[0],T=S[1],E=(0,w.useCallback)((e,t)=>{T(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,w.useEffect)(()=>{if(b.current==null||typeof ResizeObserver>`u`)return Rg;var e=e=>{var t,n=e[0];if(n!=null){var r=n.contentRect,i=r.width,a=r.height;E(i,a),(t=x.current)==null||t.call(x,i,a)}};p>0&&(e=cT(e,p,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=b.current.getBoundingClientRect(),r=n.width,i=n.height;return E(r,i),t.observe(b.current),()=>{t.disconnect()}},[E,p]);var D=C.containerWidth,O=C.containerHeight;lT(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var k=dT(D,O,{width:a,height:o,aspect:n,maxHeight:u}),A=k.calculatedWidth,j=k.calculatedHeight;return lT(D<0||O<0||A!=null&&A>0||j!=null&&j>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.`,A,j,a,o,c,l,n),w.createElement(`div`,lT({id:m?`${m}`:void 0,className:L(`recharts-responsive-container`,h),style:dT(dT({},v),{},{width:a,height:o,minWidth:c,minHeight:l,maxHeight:u}),ref:b},y),w.createElement(`div`,{style:oT({width:a,height:o})},w.createElement(TT,{width:A,height:j},d)))}),OT=(0,w.forwardRef)((e,t)=>{var n=ET();if(QC(n.width)&&QC(n.height))return e.children;var r=sT({width:e.width,height:e.height,aspect:e.aspect}),i=r.width,a=r.height,o=tT(void 0,void 0,{width:i,height:a,aspect:e.aspect,maxHeight:e.maxHeight}),s=o.calculatedWidth,c=o.calculatedHeight;return G(s)&&G(c)?w.createElement(TT,{width:s,height:c},e.children):w.createElement(DT,lT({},e,{width:i,height:a,ref:t}))}),kT=()=>{var e=Kw(),t=K(Uw),n=K(Yw),r=K(Jw)?.padding;return!e||!n||!r?t:{width:n.width-r.left-r.right,height:n.height-r.top-r.bottom,x:r.left,y:r.top}},AT={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},jT=()=>K(Hw)??AT,MT=()=>K(Tw),NT=()=>K(Ew),PT=()=>K(e=>e.layout.margin),FT=e=>e.layout.layoutType,IT=()=>K(FT),LT=()=>{var e=IT();if(e===`horizontal`||e===`vertical`)return e},RT=e=>{var t=e.layout.layoutType;if(t===`centric`||t===`radial`)return t},zT=()=>IT()!==void 0,BT=e=>{var t=lb(),n=Kw(),r=e.width,i=e.height,a=ET(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,w.useEffect)(()=>{!n&&QC(o)&&QC(s)&&t(qC({width:o,height:s}))},[t,n,o,s]),null},VT=tC({name:`legend`,initialState:{settings:{layout:`horizontal`,align:`center`,verticalAlign:`bottom`,itemSorter:`value`,position:void 0,offset:0},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter,e.settings.position=t.payload.position,e.settings.offset=t.payload.offset},addLegendPayload:{reducer(e,t){e.payload.push(OS(t.payload))},prepare:BS()},replaceLegendPayload:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=TS(e).payload.indexOf(OS(r));a>-1&&(e.payload[a]=OS(i))},prepare:BS()},removeLegendPayload:{reducer(e,t){var n=TS(e).payload.indexOf(OS(t.payload));n>-1&&e.payload.splice(n,1)},prepare:BS()}}}),HT=VT.actions,UT=HT.setLegendSize,WT=HT.setLegendSettings,GT=HT.addLegendPayload,KT=HT.replaceLegendPayload,qT=HT.removeLegendPayload,JT=VT.reducer,YT=o((e=>{var t=C();t.useSyncExternalStore,t.useRef,t.useEffect,t.useMemo,t.useDebugValue}));o(((e,t)=>{t.exports=YT()}))();function XT(e){e()}function ZT(){let e=null,t=null;return{clear(){e=null,t=null},notify(){XT(()=>{let t=e;for(;t;)t.callback(),t=t.next})},get(){let t=[],n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0,i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var QT={notify(){},get:()=>[]};function $T(e,t){let n,r=QT,i=0,a=!1;function o(e){u();let t=r.subscribe(e),n=!1;return()=>{n||(n=!0,t(),d())}}function s(){r.notify()}function c(){m.onStateChange&&m.onStateChange()}function l(){return a}function u(){i++,n||(n=t?t.addNestedSub(c):e.subscribe(c),r=ZT())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=QT)}function f(){a||(a=!0,u())}function p(){a&&(a=!1,d())}let m={addNestedSub:o,notifyNestedSubs:s,handleChangeWrapper:c,isSubscribed:l,trySubscribe:f,tryUnsubscribe:p,getListeners:()=>r};return m}var eE=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,tE=typeof navigator<`u`&&navigator.product===`ReactNative`,nE=eE||tE?w.useLayoutEffect:w.useEffect;function rE(e,t){return e===t?e!==0||t!==0||1/e==1/t:e!==e&&t!==t}function iE(e,t){if(rE(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r{let e=$T(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),o=w.useMemo(()=>i.getState(),[i]);nE(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]);let s=n||cE;return w.createElement(s.Provider,{value:a},t)}var uE=lE,dE=new Set([`axisLine`,`tickLine`,`activeBar`,`activeDot`,`activeLabel`,`activeShape`,`allowEscapeViewBox`,`background`,`cursor`,`dot`,`label`,`line`,`margin`,`padding`,`position`,`shape`,`style`,`tick`,`wrapperStyle`,`radius`,`throttledEvents`]);function fE(e,t){return e==null&&t==null?!0:typeof e==`number`&&typeof t==`number`?e===t||e!==e&&t!==t:e===t}function pE(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(dE.has(n)){if(e[n]==null&&t[n]==null)continue;if(!iE(e[n],t[n]))return!1}else if(!fE(e[n],t[n]))return!1;return!0}var mE=q([Tw,Ew,Ow],(e,t,n)=>({x:n.left||0,y:n.top||0,width:Math.max(e-(n.left||0)-(n.right||0),0),height:Math.max(t-(n.top||0)-(n.bottom||0),0)}));function hE(e,t){return e===`start`&&t===`start`?``:`translate(${e===`inherit`?`0`:{start:`0`,middle:`-50%`,end:`-100%`}[e]}, ${{start:`0`,middle:`-50%`,end:`-100%`}[t]??`0`})`}var gE=[`contextPayload`];function _E(){return _E=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{s(WT({align:t,layout:n,verticalAlign:r,itemSorter:i,position:a,offset:o}))},[s,t,n,r,i,a,o]),null}function RE(e){var t=e.width,n=e.height,r=lb();return(0,w.useLayoutEffect)(()=>{r(UT({width:t,height:n}))},[r,t,n]),(0,w.useLayoutEffect)(()=>()=>{r(UT({width:0,height:0}))},[r]),null}function zE(e,t,n,r){return e===`vertical`&&t!=null?{height:t}:e===`horizontal`?{width:n||r}:null}var BE={align:`center`,iconSize:14,inactiveColor:`#ccc`,itemSorter:`value`,labelStyle:{},layout:`auto`,verticalAlign:`bottom`,offset:0};function VE(e){var t=Nv(e,BE),n=e.layout&&e.layout!==`auto`?e.layout:NE(t.position),r=Rb(),i=zg(),a=PT(),o=K(e=>PE(e,t.position)),s=t.width,c=t.height,l=t.wrapperStyle,u=t.portal,d=u==null&&(t.position==null||Lg(t.position)),f=vE(Jb([r]),2),p=f[0],m=f[1],h=MT(),g=NT();if(h==null||g==null||t.position!=null&&o==null)return null;var _=zE(n,c,s,h-(a?.left||0)-(a?.right||0)),v=t.position==null?null:Fg({viewBox:o??{x:0,y:0,width:h,height:g},position:t.position,offset:t.offset??0}),y=FE(t.position,t.offset??0,p),b=n===`vertical`?(o?.width??0)/2:o?.width??0,x=n===`horizontal`?(o?.height??0)/2:o?.height??0,S=v?{width:`max-content`,height:`max-content`,maxWidth:b,maxHeight:x,overflowY:`auto`,top:v.y+(y.top??0),left:v.x+(y.left??0),transform:hE(v.horizontalAnchor,v.verticalAnchor)}:IE(l,t,a,h,g,p),C=u?l:TE(TE({position:`absolute`,width:_?.width||s||`auto`,height:_?.height||c||`auto`},S),l),T=u??i;if(T==null||r==null)return null;var E=w.createElement(`div`,{className:`recharts-legend-wrapper`,style:C,ref:m},w.createElement(LE,{layout:n,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter,position:t.position,offset:t.offset}),d&&w.createElement(RE,p),w.createElement(ME,_E({},t,{layout:n},_,{margin:a,chartWidth:h,chartHeight:g,contextPayload:r})));return(0,bo.createPortal)(E,T)}var HE=w.memo(VE,pE);HE.displayName=`Legend`;function UE(){return UE=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 t=e.separator,n=t===void 0?nD.separator:t,r=e.contentStyle,i=e.itemStyle,a=e.labelStyle,o=a===void 0?nD.labelStyle:a,s=e.payload,c=e.formatter,l=e.itemSorter,u=e.wrapperClassName,d=e.labelClassName,f=e.label,p=e.labelFormatter,m=e.accessibilityLayer,h=m===void 0?nD.accessibilityLayer:m,g=()=>{if(s&&s.length){var e={padding:0,margin:0},t=rD(s,l).map((e,t)=>{if(!e||e.type===`none`)return null;var r=e.formatter||c||tD,a=e.value,o=e.name,l=a,u=o;if(r){var d=r(a,o,e,t,s);if(Array.isArray(d)){var f=YE(d,2);l=f[0],u=f[1]}else if(d!=null)l=d;else return null}var p=GE(GE({},nD.itemStyle),{},{color:e.color||nD.itemStyle.color},i);return w.createElement(`li`,{className:`recharts-tooltip-item`,key:`tooltip-item-${t}`,style:p},vg(u)?w.createElement(`span`,{className:`recharts-tooltip-item-name`},u):null,vg(u)?w.createElement(`span`,{className:`recharts-tooltip-item-separator`},n):null,w.createElement(`span`,{className:`recharts-tooltip-item-value`},l),w.createElement(`span`,{className:`recharts-tooltip-item-unit`},e.unit||``))});return w.createElement(`ul`,{className:`recharts-tooltip-item-list`,style:e},t)}return null},_=GE(GE({},nD.contentStyle),r),v=GE({margin:0},o),y=!Tg(f),b=y?f:``,x=L(`recharts-default-tooltip`,u),S=L(`recharts-tooltip-label`,d);y&&p&&s!=null&&(b=p(f,s));var C=h?{role:`status`,"aria-live":`assertive`}:{};return w.createElement(`div`,UE({className:x,style:_},C),w.createElement(`p`,{className:S,style:v},w.isValidElement(b)?b:`${b}`),g())},aD=`recharts-tooltip-wrapper`,oD={visibility:`hidden`};function sD(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return L(aD,{[`${aD}-right`]:G(n)&&t&&G(t.x)&&n>=t.x,[`${aD}-left`]:G(n)&&t&&G(t.x)&&n=t.y,[`${aD}-top`]:G(r)&&t&&G(t.y)&&r0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var f=c[r];return f==null?0:o[r]?Math.max(uf+l?Math.max(u,f):Math.max(d,f)}function lD(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function uD(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTop,i=e.offsetLeft,a=e.position,o=e.reverseDirection,s=e.tooltipBox,c=e.useTranslate3d,l=e.viewBox,u,d,f;return s&&s.height>0&&s.width>0&&n?(d=cD({allowEscapeViewBox:t,coordinate:n,key:`x`,offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=cD({allowEscapeViewBox:t,coordinate:n,key:`y`,offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=lD({translateX:d,translateY:f,useTranslate3d:c})):u=oD,{cssProperties:u,cssClasses:sD({translateX:d,translateY:f,coordinate:n})}}var dD={devToolsEnabled:!0,isSsr:!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)};function fD(e,t){return _D(e)||gD(e,t)||mD(e,t)||pD()}function pD(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mD(e,t){if(e){if(typeof e==`string`)return hD(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hD(e,t):void 0}}function hD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ndD.isSsr||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),2),t=e[0],n=e[1];return(0,w.useEffect)(()=>{if(window.matchMedia){var e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>{n(e.matches)};return e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}}},[]),t}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 bD(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),2),r=n[0],i=n[1];w.useEffect(()=>{var t=t=>{t.key===`Escape`&&i({dismissed:!0,dismissedAtCoordinate:{x:e.coordinate?.x??0,y:e.coordinate?.y??0}})};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e.coordinate?.x,e.coordinate?.y]),r.dismissed&&((e.coordinate?.x??0)!==r.dismissedAtCoordinate.x||(e.coordinate?.y??0)!==r.dismissedAtCoordinate.y)&&i(bD(bD({},r),{},{dismissed:!1}));var a=uD({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset==`number`?e.offset:e.offset.x,offsetTop:typeof e.offset==`number`?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:e.lastBoundingBox,useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),o=a.cssClasses,s=a.cssProperties,c=bD(bD({},e.hasPortalFromProps?{}:bD(bD({transition:AD({prefersReducedMotion:t,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},s),{},{pointerEvents:`none`,position:`absolute`,top:0,left:0})),{},{visibility:!r.dismissed&&e.active&&e.hasPayload?`visible`:`hidden`},e.wrapperStyle);return w.createElement(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,tabIndex:-1,className:o,style:c,ref:e.innerRef},e.children)}var MD=w.memo(jD),ND=()=>K(e=>e.rootProps.accessibilityLayer)??!0;function PD(){return PD=Object.assign?Object.assign.bind():function(e){for(var t=1;tZC(e.x)&&ZC(e.y),HD=e=>e.base!=null&&VD(e.base)&&VD(e),UD=e=>e.x,WD=e=>e.y,GD=(e,t)=>{if(typeof e==`function`)return e;var n=`curve${Eg(e)}`;if((n===`curveMonotone`||n===`curveBump`)&&t){var r=BD[`${n}${t===`vertical`?`Y`:`X`}`];if(r)return r}return BD[n]||n_},KD={connectNulls:!1,type:`linear`},qD=e=>{var t=e.type,n=t===void 0?KD.type:t,r=e.points,i=r===void 0?[]:r,a=e.baseLine,o=e.layout,s=e.connectNulls,c=s===void 0?KD.connectNulls:s,l=GD(n,o),u=c?i.filter(VD):i;if(Array.isArray(a)){var d,f=i.map((e,t)=>ID(ID({},e),{},{base:a[t]}));return d=o===`vertical`?o_().y(WD).x1(UD).x0(e=>e.base.x):o_().x(UD).y1(WD).y0(e=>e.base.y),d.defined(HD).curve(l)(c?f.filter(HD):f)}return(o===`vertical`&&G(a)?o_().y(WD).x1(UD).x0(a):G(a)?o_().x(UD).y1(WD).y0(a):a_().x(UD).y(WD)).defined(VD).curve(l)(u)},JD=e=>{var t=e.className,n=e.points,r=e.path,i=e.pathRef,a=IT();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?qD(o):r;return w.createElement(`path`,PD({},Uh(e),Tv(e),{className:L(`recharts-curve`,t),d:s===null?void 0:s,ref:i}))},YD=[`x`,`y`,`top`,`left`,`width`,`height`,`className`];function XD(){return XD=Object.assign?Object.assign.bind():function(e){for(var t=1;t`M${e},${i}v${r}M${a},${t}h${n}`,aO=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=nO(e,YD),h=QD({x:n,y:i,top:o,left:c,width:u,height:f},m);return!G(n)||!G(i)||!G(u)||!G(f)||!G(o)||!G(c)?null:w.createElement(`path`,XD({},Gh(h),{className:L(`recharts-cross`,p),d:iO(n,i,u,f,o,c)}))};function oO(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}var sO=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],cO=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),lO=(e,t)=>n=>cO(sO(e,t),n),uO=(e,t)=>n=>cO([...sO(e,t).map((e,t)=>e*t).slice(1),0],n),dO=e=>{var t,n=e.split(`(`);if(n.length!==2||n[0]!==`cubic-bezier`)return null;var r=(t=n[1])==null||(t=t.split(`)`)[0])==null?void 0:t.split(`,`);if(r==null||r.length!==4)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]},fO=function(){var e=[...arguments];if(e.length===1)switch(e[0]){case`linear`:return[0,0,1,1];case`ease`:return[.25,.1,.25,1];case`ease-in`:return[.42,0,1,1];case`ease-out`:return[.42,0,.58,1];case`ease-in-out`:return[0,0,.58,1];default:var t=dO(e[0]);if(t)return t}return e.length===4?e:[0,0,1,1]},pO=(e,t,n,r)=>{var i=lO(e,n),a=lO(t,r),o=uO(e,n),s=e=>e>1?1:e<0?0:e,c=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var c=i(n)-t,l=o(n);if(Math.abs(c-t)<1e-4||l<1e-4)return a(n);n=s(n-c/l)}return a(n)};return c.isStepper=!1,c},mO=function(){return pO(...fO(...arguments))},hO=function(){for(var e=arguments.length>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?16.67:a,s=1,c=[0],l=0,u=0,d=1e4,f=0;f{if(e<=0)return 0;if(e>=1)return s;var t=e*h,n=Math.floor(t),r=t-n;return(c[n]??0)+((c[n+1]??0)-(c[n]??0))*r}},gO=e=>{if(typeof e==`string`)switch(e){case`ease`:case`ease-in-out`:case`ease-out`:case`ease-in`:case`linear`:return mO(e);case`spring`:return hO();default:if(e.split(`(`)[0]===`cubic-bezier`)return mO(e)}return typeof e==`function`?e:null},_O=(0,w.createContext)((e,t,n)=>{var r,i=a=>{var o=t.tick(a);if(t.getState()===`active`){if(n(t.getInterpolated()),t.getProgress()===1){t.complete(),r=void 0;return}r=e.setTimeout(i,o);return}r=e.setTimeout(i,o)};return r=e.setTimeout(i,0),()=>r?.()});_O.Provider;function vO(e){var t=(0,w.useContext)(_O);return(0,w.useMemo)(()=>e??t,[e,t])}function yO(e,t,n){return(t=bO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bO(e){var t=xO(e,`string`);return typeof t==`symbol`?t:t+``}function xO(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var SO=`init`,CO=`pending`,wO=`active`,TO=`completed`;function EO(e){return Math.max(0,e)}var DO=class{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var t;yO(this,`state`,SO),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=EO(e.animationDuration),this.animationBegin=EO(e.animationBegin),this.progress=0,this.from=e.from,this.to=e.to,this.easing=e.easing,(t=e.onAnimationStart)==null||t.call(e)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(e){if(this.getState()===SO)return this.state=CO,this.beginStartedTime=e,this.animationBegin;if(this.getState()===CO){if(this.beginStartedTime==null)throw Error();var t=e-this.beginStartedTime;return t>=this.animationBegin?(this.state=wO,this.animationStartedTime=e,this.nextAnimationUpdate(0)):EO(this.animationBegin-t)}if(this.getState()===wO){if(this.animationStartedTime==null)throw Error();var n=e-this.animationStartedTime;return this.setProgress(n/this.animationDuration),this.nextAnimationUpdate(n)}return 0}setProgress(e){this.progress=Math.min(1,Math.max(0,e))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state===`active`){var e;(e=this.onAnimationEnd)==null||e.call(this)}this.state=TO}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}},OO=class extends DO{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(Cg(this.getFrom(),this.getTo(),this.getProgress()))}},kO=class{setTimeout(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):r=requestAnimationFrame(i)};return r=requestAnimationFrame(i),()=>{r!=null&&cancelAnimationFrame(r)}}};function AO(e,t){return FO(e)||PO(e,t)||MO(e,t)||jO()}function jO(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MO(e,t){if(e){if(typeof e==`string`)return NO(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?NO(e,t):void 0}}function NO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{},onAnimationStart:()=>{}},LO=0,RO=1;function zO(e){var t=Nv(e,IO),n=t.animationId,r=t.isActive,i=t.canBegin,a=t.duration,o=t.easing,s=t.begin,c=t.onAnimationEnd,l=t.onAnimationStart,u=t.children,d=vD(),f=r===`auto`?!dD.isSsr&&!d:r,p=vO(t.animationController),m=AO((0,w.useState)(f?LO:RO),2),h=m[0],g=m[1];return(0,w.useEffect)(()=>{f||g(RO)},[f]),(0,w.useEffect)(()=>{var e=gO(o);return!f||!i||e==null?Og:p(new kO,new OO({animationId:n,easing:e,animationDuration:a,animationBegin:s,onAnimationStart:l,onAnimationEnd:c,from:LO,to:RO}),g)},[p,n,f,i,a,o,s,l,c]),u(Number(h))}function BO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`animation-`,n=(0,w.useRef)(bg(t)),r=(0,w.useRef)(e);return r.current!==e&&(n.current=bg(t),r.current=e),n.current}var VO=e=>e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`),HO=(e,t,n)=>e.map(e=>`${VO(e)} ${t}ms ${n}`).join(`,`),UO=[`radius`],WO=[`radius`],GO,KO,qO,JO,YO,XO,ZO,QO,$O,ek;function tk(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 nk(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var a=pg(n),o=pg(r),s=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,l=a>=0?1:-1,u=+(o>=0&&a>=0||o<0&&a<0),d;if(s>0&&Array.isArray(i)){for(var f=[0,0,0,0],p=0,m=4;ps?s:h}d=mg(GO||=hk([`M`,`,`,``]),e,t+c*f[0]),f[0]>0&&(d+=mg(KO||=hk([`A `,`,`,`,0,0,`,`,`,`,`,``]),f[0],f[0],u,e+l*f[0],t)),d+=mg(qO||=hk([`L `,`,`,``]),e+n-l*f[1],t),f[1]>0&&(d+=mg(JO||=hk([`A `,`,`,`,0,0,`,`, - `,`,`,``]),f[1],f[1],u,e+n,t+c*f[1])),d+=mg(YO||=hk([`L `,`,`,``]),e+n,t+r-c*f[2]),f[2]>0&&(d+=mg(XO||=hk([`A `,`,`,`,0,0,`,`, - `,`,`,``]),f[2],f[2],u,e+n-l*f[2],t+r)),d+=mg(ZO||=hk([`L `,`,`,``]),e+l*f[3],t+r),f[3]>0&&(d+=mg(QO||=hk([`A `,`,`,`,0,0,`,`, - `,`,`,``]),f[3],f[3],u,e,t+r-c*f[3])),d+=`Z`}else if(s>0&&i===+i&&i>0){var g=Math.min(s,i);d=mg($O||=hk(`M .,. + height and width.`,A,j,a,o,c,l,n),w.createElement(`div`,yT({id:m?`${m}`:void 0,className:L(`recharts-responsive-container`,h),style:xT(xT({},v),{},{width:a,height:o,minWidth:c,minHeight:l,maxHeight:u}),ref:b},y),w.createElement(`div`,{style:gT({width:a,height:o})},w.createElement(FT,{width:A,height:j},d)))}),RT=(0,w.forwardRef)((e,t)=>{var n=IT();if(cw(n.width)&&cw(n.height))return e.children;var r=_T({width:e.width,height:e.height,aspect:e.aspect}),i=r.width,a=r.height,o=dT(void 0,void 0,{width:i,height:a,aspect:e.aspect,maxHeight:e.maxHeight}),s=o.calculatedWidth,c=o.calculatedHeight;return G(s)&&G(c)?w.createElement(FT,{width:s,height:c},e.children):w.createElement(LT,yT({},e,{width:i,height:a,ref:t}))}),zT=()=>{var e=nT(),t=K($w),n=K(aT),r=K(iT)?.padding;return!e||!n||!r?t:{width:n.width-r.left-r.right,height:n.height-r.top-r.bottom,x:r.left,y:r.top}},BT={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},VT=()=>K(Qw)??BT,HT=()=>K(Fw),UT=()=>K(Iw),WT=()=>K(e=>e.layout.margin),GT=e=>e.layout.layoutType,KT=()=>K(GT),qT=()=>{var e=KT();if(e===`horizontal`||e===`vertical`)return e},JT=e=>{var t=e.layout.layoutType;if(t===`centric`||t===`radial`)return t},YT=()=>KT()!==void 0,XT=e=>{var t=yb(),n=nT(),r=e.width,i=e.height,a=IT(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,w.useEffect)(()=>{!n&&cw(o)&&cw(s)&&t(rw({width:o,height:s}))},[t,n,o,s]),null},ZT=dC({name:`legend`,initialState:{settings:{layout:`horizontal`,align:`center`,verticalAlign:`bottom`,itemSorter:`value`,position:void 0,offset:0},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter,e.settings.position=t.payload.position,e.settings.offset=t.payload.offset},addLegendPayload:{reducer(e,t){e.payload.push(RS(t.payload))},prepare:XS()},replaceLegendPayload:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=FS(e).payload.indexOf(RS(r));a>-1&&(e.payload[a]=RS(i))},prepare:XS()},removeLegendPayload:{reducer(e,t){var n=FS(e).payload.indexOf(RS(t.payload));n>-1&&e.payload.splice(n,1)},prepare:XS()}}}),QT=ZT.actions,$T=QT.setLegendSize,eE=QT.setLegendSettings,tE=QT.addLegendPayload,nE=QT.replaceLegendPayload,rE=QT.removeLegendPayload,iE=ZT.reducer,aE=o((e=>{var t=C();t.useSyncExternalStore,t.useRef,t.useEffect,t.useMemo,t.useDebugValue}));o(((e,t)=>{t.exports=aE()}))();function oE(e){e()}function sE(){let e=null,t=null;return{clear(){e=null,t=null},notify(){oE(()=>{let t=e;for(;t;)t.callback(),t=t.next})},get(){let t=[],n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0,i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var cE={notify(){},get:()=>[]};function lE(e,t){let n,r=cE,i=0,a=!1;function o(e){u();let t=r.subscribe(e),n=!1;return()=>{n||(n=!0,t(),d())}}function s(){r.notify()}function c(){m.onStateChange&&m.onStateChange()}function l(){return a}function u(){i++,n||(n=t?t.addNestedSub(c):e.subscribe(c),r=sE())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=cE)}function f(){a||(a=!0,u())}function p(){a&&(a=!1,d())}let m={addNestedSub:o,notifyNestedSubs:s,handleChangeWrapper:c,isSubscribed:l,trySubscribe:f,tryUnsubscribe:p,getListeners:()=>r};return m}var uE=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,dE=typeof navigator<`u`&&navigator.product===`ReactNative`,fE=uE||dE?w.useLayoutEffect:w.useEffect;function pE(e,t){return e===t?e!==0||t!==0||1/e==1/t:e!==e&&t!==t}function mE(e,t){if(pE(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r{let e=lE(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),o=w.useMemo(()=>i.getState(),[i]);fE(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]);let s=n||vE;return w.createElement(s.Provider,{value:a},t)}var bE=yE,xE=new Set([`axisLine`,`tickLine`,`activeBar`,`activeDot`,`activeLabel`,`activeShape`,`allowEscapeViewBox`,`background`,`cursor`,`dot`,`label`,`line`,`margin`,`padding`,`position`,`shape`,`style`,`tick`,`wrapperStyle`,`radius`,`throttledEvents`]);function SE(e,t){return e==null&&t==null?!0:typeof e==`number`&&typeof t==`number`?e===t||e!==e&&t!==t:e===t}function CE(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(xE.has(n)){if(e[n]==null&&t[n]==null)continue;if(!mE(e[n],t[n]))return!1}else if(!SE(e[n],t[n]))return!1;return!0}var wE=q([Fw,Iw,Rw],(e,t,n)=>({x:n.left||0,y:n.top||0,width:Math.max(e-(n.left||0)-(n.right||0),0),height:Math.max(t-(n.top||0)-(n.bottom||0),0)}));function TE(e,t){return e===`start`&&t===`start`?``:`translate(${e===`inherit`?`0`:{start:`0`,middle:`-50%`,end:`-100%`}[e]}, ${{start:`0`,middle:`-50%`,end:`-100%`}[t]??`0`})`}var EE=[`contextPayload`];function DE(){return DE=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{s(eE({align:t,layout:n,verticalAlign:r,itemSorter:i,position:a,offset:o}))},[s,t,n,r,i,a,o]),null}function JE(e){var t=e.width,n=e.height,r=yb();return(0,w.useLayoutEffect)(()=>{r($T({width:t,height:n}))},[r,t,n]),(0,w.useLayoutEffect)(()=>()=>{r($T({width:0,height:0}))},[r]),null}function YE(e,t,n,r){return e===`vertical`&&t!=null?{height:t}:e===`horizontal`?{width:n||r}:null}var XE={align:`center`,iconSize:14,inactiveColor:`#ccc`,itemSorter:`value`,labelStyle:{},layout:`auto`,verticalAlign:`bottom`,offset:0};function ZE(e){var t=Uv(e,XE),n=e.layout&&e.layout!==`auto`?e.layout:UE(t.position),r=Jb(),i=Yg(),a=WT(),o=K(e=>WE(e,t.position)),s=t.width,c=t.height,l=t.wrapperStyle,u=t.portal,d=u==null&&(t.position==null||qg(t.position)),f=OE(ix([r]),2),p=f[0],m=f[1],h=HT(),g=UT();if(h==null||g==null||t.position!=null&&o==null)return null;var _=YE(n,c,s,h-(a?.left||0)-(a?.right||0)),v=t.position==null?null:Gg({viewBox:o??{x:0,y:0,width:h,height:g},position:t.position,offset:t.offset??0}),y=GE(t.position,t.offset??0,p),b=n===`vertical`?(o?.width??0)/2:o?.width??0,x=n===`horizontal`?(o?.height??0)/2:o?.height??0,S=v?{width:`max-content`,height:`max-content`,maxWidth:b,maxHeight:x,overflowY:`auto`,top:v.y+(y.top??0),left:v.x+(y.left??0),transform:TE(v.horizontalAnchor,v.verticalAnchor)}:KE(l,t,a,h,g,p),C=u?l:FE(FE({position:`absolute`,width:_?.width||s||`auto`,height:_?.height||c||`auto`},S),l),T=u??i;if(T==null||r==null)return null;var E=w.createElement(`div`,{className:`recharts-legend-wrapper`,style:C,ref:m},w.createElement(qE,{layout:n,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter,position:t.position,offset:t.offset}),d&&w.createElement(JE,p),w.createElement(HE,DE({},t,{layout:n},_,{margin:a,chartWidth:h,chartHeight:g,contextPayload:r})));return(0,bo.createPortal)(E,T)}var QE=w.memo(ZE,CE);QE.displayName=`Legend`;function $E(){return $E=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 t=e.separator,n=t===void 0?fD.separator:t,r=e.contentStyle,i=e.itemStyle,a=e.labelStyle,o=a===void 0?fD.labelStyle:a,s=e.payload,c=e.formatter,l=e.itemSorter,u=e.wrapperClassName,d=e.labelClassName,f=e.label,p=e.labelFormatter,m=e.accessibilityLayer,h=m===void 0?fD.accessibilityLayer:m,g=()=>{if(s&&s.length){var e={padding:0,margin:0},t=pD(s,l).map((e,t)=>{if(!e||e.type===`none`)return null;var r=e.formatter||c||dD,a=e.value,o=e.name,l=a,u=o;if(r){var d=r(a,o,e,t,s);if(Array.isArray(d)){var f=aD(d,2);l=f[0],u=f[1]}else if(d!=null)l=d;else return null}var p=tD(tD({},fD.itemStyle),{},{color:e.color||fD.itemStyle.color},i);return w.createElement(`li`,{className:`recharts-tooltip-item`,key:`tooltip-item-${t}`,style:p},Og(u)?w.createElement(`span`,{className:`recharts-tooltip-item-name`},u):null,Og(u)?w.createElement(`span`,{className:`recharts-tooltip-item-separator`},n):null,w.createElement(`span`,{className:`recharts-tooltip-item-value`},l),w.createElement(`span`,{className:`recharts-tooltip-item-unit`},e.unit||``))});return w.createElement(`ul`,{className:`recharts-tooltip-item-list`,style:e},t)}return null},_=tD(tD({},fD.contentStyle),r),v=tD({margin:0},o),y=!Fg(f),b=y?f:``,x=L(`recharts-default-tooltip`,u),S=L(`recharts-tooltip-label`,d);y&&p&&s!=null&&(b=p(f,s));var C=h?{role:`status`,"aria-live":`assertive`}:{};return w.createElement(`div`,$E({className:x,style:_},C),w.createElement(`p`,{className:S,style:v},w.isValidElement(b)?b:`${b}`),g())},hD=`recharts-tooltip-wrapper`,gD={visibility:`hidden`};function _D(e){var t=e.coordinate,n=e.translateX,r=e.translateY;return L(hD,{[`${hD}-right`]:G(n)&&t&&G(t.x)&&n>=t.x,[`${hD}-left`]:G(n)&&t&&G(t.x)&&n=t.y,[`${hD}-top`]:G(r)&&t&&G(t.y)&&r0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var f=c[r];return f==null?0:o[r]?Math.max(uf+l?Math.max(u,f):Math.max(d,f)}function yD(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function bD(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTop,i=e.offsetLeft,a=e.position,o=e.reverseDirection,s=e.tooltipBox,c=e.useTranslate3d,l=e.viewBox,u,d,f;return s&&s.height>0&&s.width>0&&n?(d=vD({allowEscapeViewBox:t,coordinate:n,key:`x`,offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=vD({allowEscapeViewBox:t,coordinate:n,key:`y`,offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=yD({translateX:d,translateY:f,useTranslate3d:c})):u=gD,{cssProperties:u,cssClasses:_D({translateX:d,translateY:f,coordinate:n})}}var xD={devToolsEnabled:!0,isSsr:!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)};function SD(e,t){return DD(e)||ED(e,t)||wD(e,t)||CD()}function CD(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wD(e,t){if(e){if(typeof e==`string`)return TD(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?TD(e,t):void 0}}function TD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nxD.isSsr||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),2),t=e[0],n=e[1];return(0,w.useEffect)(()=>{if(window.matchMedia){var e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>{n(e.matches)};return e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t)}}},[]),t}function kD(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 AD(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),2),r=n[0],i=n[1];w.useEffect(()=>{var t=t=>{t.key===`Escape`&&i({dismissed:!0,dismissedAtCoordinate:{x:e.coordinate?.x??0,y:e.coordinate?.y??0}})};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e.coordinate?.x,e.coordinate?.y]),r.dismissed&&((e.coordinate?.x??0)!==r.dismissedAtCoordinate.x||(e.coordinate?.y??0)!==r.dismissedAtCoordinate.y)&&i(AD(AD({},r),{},{dismissed:!1}));var a=bD({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset==`number`?e.offset:e.offset.x,offsetTop:typeof e.offset==`number`?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:e.lastBoundingBox,useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),o=a.cssClasses,s=a.cssProperties,c=AD(AD({},e.hasPortalFromProps?{}:AD(AD({transition:BD({prefersReducedMotion:t,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},s),{},{pointerEvents:`none`,position:`absolute`,top:0,left:0})),{},{visibility:!r.dismissed&&e.active&&e.hasPayload?`visible`:`hidden`},e.wrapperStyle);return w.createElement(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,tabIndex:-1,className:o,style:c,ref:e.innerRef},e.children)}var HD=w.memo(VD),UD=()=>K(e=>e.rootProps.accessibilityLayer)??!0;function WD(){return WD=Object.assign?Object.assign.bind():function(e){for(var t=1;tsw(e.x)&&sw(e.y),QD=e=>e.base!=null&&ZD(e.base)&&ZD(e),$D=e=>e.x,eO=e=>e.y,tO=(e,t)=>{if(typeof e==`function`)return e;var n=`curve${Ig(e)}`;if((n===`curveMonotone`||n===`curveBump`)&&t){var r=XD[`${n}${t===`vertical`?`Y`:`X`}`];if(r)return r}return XD[n]||f_},nO={connectNulls:!1,type:`linear`},rO=e=>{var t=e.type,n=t===void 0?nO.type:t,r=e.points,i=r===void 0?[]:r,a=e.baseLine,o=e.layout,s=e.connectNulls,c=s===void 0?nO.connectNulls:s,l=tO(n,o),u=c?i.filter(ZD):i;if(Array.isArray(a)){var d,f=i.map((e,t)=>KD(KD({},e),{},{base:a[t]}));return d=o===`vertical`?g_().y(eO).x1($D).x0(e=>e.base.x):g_().x($D).y1(eO).y0(e=>e.base.y),d.defined(QD).curve(l)(c?f.filter(QD):f)}return(o===`vertical`&&G(a)?g_().y(eO).x1($D).x0(a):G(a)?g_().x($D).y1(eO).y0(a):h_().x($D).y(eO)).defined(ZD).curve(l)(u)},iO=e=>{var t=e.className,n=e.points,r=e.path,i=e.pathRef,a=KT();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?rO(o):r;return w.createElement(`path`,WD({},$h(e),Fv(e),{className:L(`recharts-curve`,t),d:s===null?void 0:s,ref:i}))},aO=[`x`,`y`,`top`,`left`,`width`,`height`,`className`];function oO(){return oO=Object.assign?Object.assign.bind():function(e){for(var t=1;t`M${e},${i}v${r}M${a},${t}h${n}`,hO=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=fO(e,aO),h=cO({x:n,y:i,top:o,left:c,width:u,height:f},m);return!G(n)||!G(i)||!G(u)||!G(f)||!G(o)||!G(c)?null:w.createElement(`path`,oO({},tg(h),{className:L(`recharts-cross`,p),d:mO(n,i,u,f,o,c)}))};function gO(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}var _O=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],vO=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),yO=(e,t)=>n=>vO(_O(e,t),n),bO=(e,t)=>n=>vO([..._O(e,t).map((e,t)=>e*t).slice(1),0],n),xO=e=>{var t,n=e.split(`(`);if(n.length!==2||n[0]!==`cubic-bezier`)return null;var r=(t=n[1])==null||(t=t.split(`)`)[0])==null?void 0:t.split(`,`);if(r==null||r.length!==4)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]},SO=function(){var e=[...arguments];if(e.length===1)switch(e[0]){case`linear`:return[0,0,1,1];case`ease`:return[.25,.1,.25,1];case`ease-in`:return[.42,0,1,1];case`ease-out`:return[.42,0,.58,1];case`ease-in-out`:return[0,0,.58,1];default:var t=xO(e[0]);if(t)return t}return e.length===4?e:[0,0,1,1]},CO=(e,t,n,r)=>{var i=yO(e,n),a=yO(t,r),o=bO(e,n),s=e=>e>1?1:e<0?0:e,c=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var c=i(n)-t,l=o(n);if(Math.abs(c-t)<1e-4||l<1e-4)return a(n);n=s(n-c/l)}return a(n)};return c.isStepper=!1,c},wO=function(){return CO(...SO(...arguments))},TO=function(){for(var e=arguments.length>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?16.67:a,s=1,c=[0],l=0,u=0,d=1e4,f=0;f{if(e<=0)return 0;if(e>=1)return s;var t=e*h,n=Math.floor(t),r=t-n;return(c[n]??0)+((c[n+1]??0)-(c[n]??0))*r}},EO=e=>{if(typeof e==`string`)switch(e){case`ease`:case`ease-in-out`:case`ease-out`:case`ease-in`:case`linear`:return wO(e);case`spring`:return TO();default:if(e.split(`(`)[0]===`cubic-bezier`)return wO(e)}return typeof e==`function`?e:null},DO=(0,w.createContext)((e,t,n)=>{var r,i=a=>{var o=t.tick(a);if(t.getState()===`active`){if(n(t.getInterpolated()),t.getProgress()===1){t.complete(),r=void 0;return}r=e.setTimeout(i,o);return}r=e.setTimeout(i,o)};return r=e.setTimeout(i,0),()=>r?.()});DO.Provider;function OO(e){var t=(0,w.useContext)(DO);return(0,w.useMemo)(()=>e??t,[e,t])}function kO(e,t,n){return(t=AO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function AO(e){var t=jO(e,`string`);return typeof t==`symbol`?t:t+``}function jO(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var MO=`init`,NO=`pending`,PO=`active`,FO=`completed`;function IO(e){return Math.max(0,e)}var LO=class{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var t;kO(this,`state`,MO),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=IO(e.animationDuration),this.animationBegin=IO(e.animationBegin),this.progress=0,this.from=e.from,this.to=e.to,this.easing=e.easing,(t=e.onAnimationStart)==null||t.call(e)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(e){if(this.getState()===MO)return this.state=NO,this.beginStartedTime=e,this.animationBegin;if(this.getState()===NO){if(this.beginStartedTime==null)throw Error();var t=e-this.beginStartedTime;return t>=this.animationBegin?(this.state=PO,this.animationStartedTime=e,this.nextAnimationUpdate(0)):IO(this.animationBegin-t)}if(this.getState()===PO){if(this.animationStartedTime==null)throw Error();var n=e-this.animationStartedTime;return this.setProgress(n/this.animationDuration),this.nextAnimationUpdate(n)}return 0}setProgress(e){this.progress=Math.min(1,Math.max(0,e))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state===`active`){var e;(e=this.onAnimationEnd)==null||e.call(this)}this.state=FO}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}},RO=class extends LO{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(Ng(this.getFrom(),this.getTo(),this.getProgress()))}},zO=class{setTimeout(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):r=requestAnimationFrame(i)};return r=requestAnimationFrame(i),()=>{r!=null&&cancelAnimationFrame(r)}}};function BO(e,t){return GO(e)||WO(e,t)||HO(e,t)||VO()}function VO(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function HO(e,t){if(e){if(typeof e==`string`)return UO(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?UO(e,t):void 0}}function UO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{},onAnimationStart:()=>{}},qO=0,JO=1;function YO(e){var t=Uv(e,KO),n=t.animationId,r=t.isActive,i=t.canBegin,a=t.duration,o=t.easing,s=t.begin,c=t.onAnimationEnd,l=t.onAnimationStart,u=t.children,d=OD(),f=r===`auto`?!xD.isSsr&&!d:r,p=OO(t.animationController),m=BO((0,w.useState)(f?qO:JO),2),h=m[0],g=m[1];return(0,w.useEffect)(()=>{f||g(JO)},[f]),(0,w.useEffect)(()=>{var e=EO(o);return!f||!i||e==null?Rg:p(new zO,new RO({animationId:n,easing:e,animationDuration:a,animationBegin:s,onAnimationStart:l,onAnimationEnd:c,from:qO,to:JO}),g)},[p,n,f,i,a,o,s,l,c]),u(Number(h))}function XO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`animation-`,n=(0,w.useRef)(Ag(t)),r=(0,w.useRef)(e);return r.current!==e&&(n.current=Ag(t),r.current=e),n.current}var ZO=e=>e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`),QO=(e,t,n)=>e.map(e=>`${ZO(e)} ${t}ms ${n}`).join(`,`),$O=[`radius`],ek=[`radius`],tk,nk,rk,ik,ak,ok,sk,ck,lk,uk;function dk(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 fk(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{var a=Cg(n),o=Cg(r),s=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,l=a>=0?1:-1,u=+(o>=0&&a>=0||o<0&&a<0),d;if(s>0&&Array.isArray(i)){for(var f=[0,0,0,0],p=0,m=4;ps?s:h}d=wg(tk||=Tk([`M`,`,`,``]),e,t+c*f[0]),f[0]>0&&(d+=wg(nk||=Tk([`A `,`,`,`,0,0,`,`,`,`,`,``]),f[0],f[0],u,e+l*f[0],t)),d+=wg(rk||=Tk([`L `,`,`,``]),e+n-l*f[1],t),f[1]>0&&(d+=wg(ik||=Tk([`A `,`,`,`,0,0,`,`, + `,`,`,``]),f[1],f[1],u,e+n,t+c*f[1])),d+=wg(ak||=Tk([`L `,`,`,``]),e+n,t+r-c*f[2]),f[2]>0&&(d+=wg(ok||=Tk([`A `,`,`,`,0,0,`,`, + `,`,`,``]),f[2],f[2],u,e+n-l*f[2],t+r)),d+=wg(sk||=Tk([`L `,`,`,``]),e+l*f[3],t+r),f[3]>0&&(d+=wg(ck||=Tk([`A `,`,`,`,0,0,`,`, + `,`,`,``]),f[3],f[3],u,e,t+r-c*f[3])),d+=`Z`}else if(s>0&&i===+i&&i>0){var g=Math.min(s,i);d=wg(lk||=Tk(`M .,. A .,.,0,0,.,.,. L .,. A .,.,0,0,.,.,. L .,. A .,.,0,0,.,.,. L .,. - A .,.,0,0,.,.,. Z`.split(`.`)),e,t+c*g,g,g,u,e+l*g,t,e+n-l*g,t,g,g,u,e+n,t+c*g,e+n,t+r-c*g,g,g,u,e+n-l*g,t+r,e+l*g,t+r,g,g,u,e,t+r-c*g)}else d=mg(ek||=hk([`M `,`,`,` h `,` v `,` h `,` Z`]),e,t,n,r,-n);return d},_k={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},vk=e=>{var t=Nv(e,_k),n=(0,w.useRef)(null),r=lk((0,w.useState)(-1),2),i=r[0],a=r[1];(0,w.useEffect)(()=>{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,_=(0,w.useRef)(c),v=(0,w.useRef)(l),y=(0,w.useRef)(o),b=(0,w.useRef)(s),x=BO((0,w.useMemo)(()=>({x:o,y:s,width:c,height:l,radius:u}),[o,s,c,l,u]),`rectangle-`);if(o!==+o||s!==+s||c!==+c||l!==+l||c===0||l===0)return null;var S=L(`recharts-rectangle`,d);if(!g){var C=Gh(t);C.radius;var T=sk(C,UO);return w.createElement(`path`,ok({},T,{x:pg(o),y:pg(s),width:pg(c),height:pg(l),radius:typeof u==`number`?u:void 0,className:S,d:gk(o,s,c,l,u)}))}var E=_.current,D=v.current,O=y.current,k=b.current,A=`0px ${i===-1?1:i}px`,j=`${i}px ${i}px`,M=HO([`strokeDasharray`],p,typeof f==`string`?f:_k.animationEasing);return w.createElement(zO,{animationId:x,key:x,canBegin:i>0,duration:p,easing:f,isActive:g,begin:m},e=>{var r=Cg(E,c,e),i=Cg(D,l,e),a=Cg(O,o,e),d=Cg(k,s,e);n.current&&(_.current=r,v.current=i,y.current=a,b.current=d);var f=h?e>0?{transition:M,strokeDasharray:j}:{strokeDasharray:A}:{strokeDasharray:j},p=Gh(t);p.radius;var m=sk(p,WO);return w.createElement(`path`,ok({},m,{radius:typeof u==`number`?u:void 0,className:S,d:gk(a,d,r,i,u),ref:n,style:nk(nk({},f),t.style)}))})};function yk(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 bk(e){for(var t=1;te*180/Math.PI,Ek=(e,t,n,r)=>({x:e+Math.cos(-wk*r)*n,y:t+Math.sin(-wk*r)*n}),Dk=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2},Ok=(e,t)=>{var n=e.x,r=e.y,i=t.x,a=t.y;return Math.sqrt((n-i)**2+(r-a)**2)},kk=(e,t)=>{var n=e.x,r=e.y,i=t.cx,a=t.cy,o=Ok({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=(n-i)/o,c=Math.acos(s);return r>a&&(c=2*Math.PI-c),{radius:o,angle:Tk(c),angleInRadian:c}},Ak=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}},jk=(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},Mk=(e,t)=>{var n=e.relativeX,r=e.relativeY,i=kk({x:n,y:r},t),a=i.radius,o=i.angle,s=t.innerRadius,c=t.outerRadius;if(ac||a===0)return null;var l=Ak(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?bk(bk({},t),{},{radius:a,angle:jk(f,t)}):null};function Nk(e){var t=e.cx,n=e.cy,r=e.radius,i=e.startAngle,a=e.endAngle;return{points:[Ek(t,n,r,i),Ek(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var Pk,Fk,Ik,Lk,Rk,zk,Bk;function Vk(){return Vk=Object.assign?Object.assign.bind():function(e){for(var t=1;thg(t-e)*Math.min(Math.abs(t-e),359.999),Wk=e=>{var t=e.cx,n=e.cy,r=e.radius,i=e.angle,a=e.sign,o=e.isExternal,s=e.cornerRadius,c=e.cornerIsExternal,l=s*(o?1:-1)+r,u=Math.asin(s/l)/wk,d=c?i:i+a*u,f=Ek(t,n,l,d),p=Ek(t,n,r,d),m=c?i-a*u:i;return{center:f,circleTangency:p,lineTangency:Ek(t,n,l*Math.cos(u*wk),m),theta:u}},Gk=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.startAngle,o=e.endAngle,s=Uk(a,o),c=a+s,l=Ek(t,n,i,a),u=Ek(t,n,i,c),d=mg(Pk||=Hk([`M `,`,`,` + A .,.,0,0,.,.,. Z`.split(`.`)),e,t+c*g,g,g,u,e+l*g,t,e+n-l*g,t,g,g,u,e+n,t+c*g,e+n,t+r-c*g,g,g,u,e+n-l*g,t+r,e+l*g,t+r,g,g,u,e,t+r-c*g)}else d=wg(uk||=Tk([`M `,`,`,` h `,` v `,` h `,` Z`]),e,t,n,r,-n);return d},Dk={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},Ok=e=>{var t=Uv(e,Dk),n=(0,w.useRef)(null),r=yk((0,w.useState)(-1),2),i=r[0],a=r[1];(0,w.useEffect)(()=>{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,_=(0,w.useRef)(c),v=(0,w.useRef)(l),y=(0,w.useRef)(o),b=(0,w.useRef)(s),x=XO((0,w.useMemo)(()=>({x:o,y:s,width:c,height:l,radius:u}),[o,s,c,l,u]),`rectangle-`);if(o!==+o||s!==+s||c!==+c||l!==+l||c===0||l===0)return null;var S=L(`recharts-rectangle`,d);if(!g){var C=tg(t);C.radius;var T=_k(C,$O);return w.createElement(`path`,gk({},T,{x:Cg(o),y:Cg(s),width:Cg(c),height:Cg(l),radius:typeof u==`number`?u:void 0,className:S,d:Ek(o,s,c,l,u)}))}var E=_.current,D=v.current,O=y.current,k=b.current,A=`0px ${i===-1?1:i}px`,j=`${i}px ${i}px`,M=QO([`strokeDasharray`],p,typeof f==`string`?f:Dk.animationEasing);return w.createElement(YO,{animationId:x,key:x,canBegin:i>0,duration:p,easing:f,isActive:g,begin:m},e=>{var r=Ng(E,c,e),i=Ng(D,l,e),a=Ng(O,o,e),d=Ng(k,s,e);n.current&&(_.current=r,v.current=i,y.current=a,b.current=d);var f=h?e>0?{transition:M,strokeDasharray:j}:{strokeDasharray:A}:{strokeDasharray:j},p=tg(t);p.radius;var m=_k(p,ek);return w.createElement(`path`,gk({},m,{radius:typeof u==`number`?u:void 0,className:S,d:Ek(a,d,r,i,u),ref:n,style:fk(fk({},f),t.style)}))})};function kk(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 Ak(e){for(var t=1;te*180/Math.PI,Ik=(e,t,n,r)=>({x:e+Math.cos(-Pk*r)*n,y:t+Math.sin(-Pk*r)*n}),Lk=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2},Rk=(e,t)=>{var n=e.x,r=e.y,i=t.x,a=t.y;return Math.sqrt((n-i)**2+(r-a)**2)},zk=(e,t)=>{var n=e.x,r=e.y,i=t.cx,a=t.cy,o=Rk({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=(n-i)/o,c=Math.acos(s);return r>a&&(c=2*Math.PI-c),{radius:o,angle:Fk(c),angleInRadian:c}},Bk=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}},Vk=(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},Hk=(e,t)=>{var n=e.relativeX,r=e.relativeY,i=zk({x:n,y:r},t),a=i.radius,o=i.angle,s=t.innerRadius,c=t.outerRadius;if(ac||a===0)return null;var l=Bk(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?Ak(Ak({},t),{},{radius:a,angle:Vk(f,t)}):null};function Uk(e){var t=e.cx,n=e.cy,r=e.radius,i=e.startAngle,a=e.endAngle;return{points:[Ik(t,n,r,i),Ik(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}var Wk,Gk,Kk,qk,Jk,Yk,Xk;function Zk(){return Zk=Object.assign?Object.assign.bind():function(e){for(var t=1;tTg(t-e)*Math.min(Math.abs(t-e),359.999),eA=e=>{var t=e.cx,n=e.cy,r=e.radius,i=e.angle,a=e.sign,o=e.isExternal,s=e.cornerRadius,c=e.cornerIsExternal,l=s*(o?1:-1)+r,u=Math.asin(s/l)/Pk,d=c?i:i+a*u,f=Ik(t,n,l,d),p=Ik(t,n,r,d),m=c?i-a*u:i;return{center:f,circleTangency:p,lineTangency:Ik(t,n,l*Math.cos(u*Pk),m),theta:u}},tA=e=>{var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.startAngle,o=e.endAngle,s=$k(a,o),c=a+s,l=Ik(t,n,i,a),u=Ik(t,n,i,c),d=wg(Wk||=Qk([`M `,`,`,` A `,`,`,`,0, `,`,`,`, `,`,`,` - `]),l.x,l.y,i,i,+(Math.abs(s)>180),+(a>c),u.x,u.y);if(r>0){var f=Ek(t,n,r,a),p=Ek(t,n,r,c);d+=mg(Fk||=Hk([`L `,`,`,` + `]),l.x,l.y,i,i,+(Math.abs(s)>180),+(a>c),u.x,u.y);if(r>0){var f=Ik(t,n,r,a),p=Ik(t,n,r,c);d+=wg(Gk||=Qk([`L `,`,`,` A `,`,`,`,0, `,`,`,`, - `,`,`,` Z`]),p.x,p.y,r,r,+(Math.abs(s)>180),+(a<=c),f.x,f.y)}else d+=mg(Ik||=Hk([`L `,`,`,` Z`]),t,n);return d},Kk=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=hg(l-c),d=Wk({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),f=d.circleTangency,p=d.lineTangency,m=d.theta,h=Wk({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?mg(Lk||=Hk([`M `,`,`,` + `,`,`,` Z`]),p.x,p.y,r,r,+(Math.abs(s)>180),+(a<=c),f.x,f.y)}else d+=wg(Kk||=Qk([`L `,`,`,` Z`]),t,n);return d},nA=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=Tg(l-c),d=eA({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),f=d.circleTangency,p=d.lineTangency,m=d.theta,h=eA({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?wg(qk||=Qk([`M `,`,`,` a`,`,`,`,0,0,1,`,`,0 a`,`,`,`,0,0,1,`,`,0 - `]),p.x,p.y,a,a,a*2,a,a,-a*2):Gk({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var b=mg(Rk||=Hk([`M `,`,`,` + `]),p.x,p.y,a,a,a*2,a,a,-a*2):tA({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var b=wg(Jk||=Qk([`M `,`,`,` A`,`,`,`,0,0,`,`,`,`,`,` A`,`,`,`,0,`,`,`,`,`,`,`,` A`,`,`,`,0,0,`,`,`,`,`,` - `]),p.x,p.y,a,a,+(u<0),f.x,f.y,i,i,+(y>180),+(u<0),g.x,g.y,a,a,+(u<0),_.x,_.y);if(r>0){var x=Wk({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=Wk({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+=mg(zk||=Hk([`L`,`,`,` + `]),p.x,p.y,a,a,+(u<0),f.x,f.y,i,i,+(y>180),+(u<0),g.x,g.y,a,a,+(u<0),_.x,_.y);if(r>0){var x=eA({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=eA({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+=wg(Yk||=Qk([`L`,`,`,` A`,`,`,`,0,0,`,`,`,`,`,` A`,`,`,`,0,`,`,`,`,`,`,`,` - A`,`,`,`,0,0,`,`,`,`,`,`Z`]),D.x,D.y,a,a,+(u<0),E.x,E.y,r,r,+(k>180),+(u>0),S.x,S.y,a,a,+(u<0),C.x,C.y)}else b+=mg(Bk||=Hk([`L`,`,`,`Z`]),t,n);return b},qk={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Jk=e=>{var t=Nv(e,qk),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?Kk({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u}):Gk({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:l,endAngle:u});return w.createElement(`path`,Vk({},Gh(t),{className:f,d:h}))};function Yk(e,t,n){if(e===`horizontal`)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e===`vertical`)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(wv(t)){if(e===`centric`){var r=t.cx,i=t.cy,a=t.innerRadius,o=t.outerRadius,s=t.angle,c=Ek(r,i,a,s),l=Ek(r,i,o,s);return[{x:c.x,y:c.y},{x:l.x,y:l.y}]}return Nk(t)}}function Xk(e){return og(e)?NaN:Number(e)}function Zk(e){return e?(e=Xk(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function Qk(e,t,n){n&&typeof n!=`number`&&Db(e,t,n)&&(t=n=void 0),e=Zk(e),t===void 0?(t=e,e=0):t=Zk(t),n=n===void 0?ee.chartData,eA=q([$k],e=>{var t=e.chartData==null?0:e.chartData.length-1;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),tA=(e,t,n,r)=>r?eA(e):$k(e),nA=(e,t,n)=>n?eA(e):$k(e),rA=q([tA],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t==null?[]:t.slice(n,r+1)});q([eA],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t==null?[]:t.slice(n,r+1)});var iA=q([$k],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t==null?[]:t.slice(n,r+1)});function aA(e,t){return uA(e)||lA(e,t)||sA(e,t)||oA()}function oA(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sA(e,t){if(e){if(typeof e==`string`)return cA(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cA(e,t):void 0}}function cA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{(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())}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 gA(e){return e===0?1:Math.floor(new hA.default(e).abs().log(10).toNumber())+1}function _A(e,t,n){for(var r=new hA.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}function vA(e,t){return CA(e)||SA(e,t)||bA(e,t)||yA()}function yA(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bA(e,t){if(e){if(typeof e==`string`)return xA(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xA(e,t):void 0}}function xA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=vA(e,2),n=t[0],r=t[1],i=n,a=r;return n>r&&(i=r,a=n),[i,a]},TA=(e,t,n)=>{if(e.lte(0))return new hA.default(0);var r=gA(e.toNumber()),i=new hA.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new hA.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?new hA.default(s.toNumber()):new hA.default(Math.ceil(s.toNumber()))},EA=(e,t,n)=>{if(e.lte(0))return new hA.default(0);var r=[1,2,2.5,5],i=e.toNumber(),a=Math.floor(new hA.default(i).abs().log(10).toNumber()),o=new hA.default(10).pow(a),s=e.div(o).toNumber(),c=r.findIndex(e=>e>=s-1e-10);if(c===-1&&(o=o.mul(10),c=0),c+=n,c>=r.length){var l=Math.floor(c/r.length);c%=r.length,o=o.mul(new hA.default(10).pow(l))}var u=r[c]??1,d=new hA.default(u).mul(o);return t?d:new hA.default(Math.ceil(d.toNumber()))},DA=(e,t,n)=>{var r=new hA.default(1),i=new hA.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new hA.default(10).pow(gA(e)-1),i=new hA.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new hA.default(Math.floor(e)))}else e===0?i=new hA.default(Math.floor((t-1)/2)):n||(i=new hA.default(Math.floor(e)));for(var o=Math.floor((t-1)/2),s=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:TA;if(!Number.isFinite((t-e)/(n-1)))return{step:new hA.default(0),tickMin:new hA.default(0),tickMax:new hA.default(0)};var o=a(new hA.default(t).sub(e).div(n-1),r,i),s;e<=0&&t>=0?s=new hA.default(0):(s=new hA.default(e).add(t).div(2),s=s.sub(new hA.default(s).mod(o)));var c=Math.ceil(s.sub(e).div(o).toNumber()),l=Math.ceil(new hA.default(t).sub(s).div(o).toNumber()),u=c+l+1;return u>n?OA(e,t,n,r,i+1,a):(u0?l+(n-u):l,c=t>0?c:c+(n-u)),{step:o,tickMin:s.sub(new hA.default(c).mul(o)),tickMax:s.add(new hA.default(l).mul(o))})},kA=function(e){var t=vA(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=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,s=Math.max(i,2),c=vA(wA([n,r]),2),l=c[0],u=c[1];if(l===-1/0||u===1/0){var d=u===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),u];return n>r?d.reverse():d}if(l===u)return DA(l,i,a);var f=OA(l,u,s,a,0,o===`snap125`?EA:TA),p=f.step,m=f.tickMin,h=f.tickMax,g=_A(m,h.add(new hA.default(.1).mul(p)),p);return n>r?g.reverse():g},AA=function(e,t){var n=vA(e,2),r=n[0],i=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,s=vA(wA([r,i]),2),c=s[0],l=s[1];if(c===-1/0||l===1/0)return[r,i];if(c===l)return[c];var u=o===`snap125`?EA:TA,d=Math.max(t,2),f=u(new hA.default(l).sub(c).div(d-1),a,0),p=[..._A(new hA.default(c),new hA.default(l),f),l];if(a===!1){p=p.map(e=>Math.round(e));var m=p.length-1;m>0&&p[m]===p[m-1]&&(p=p.slice(0,m))}return r>i?p.reverse():p},jA=e=>e.rootProps.maxBarSize,MA=e=>e.rootProps.barGap,NA=e=>e.rootProps.barCategoryGap,PA=e=>e.rootProps.barSize,FA=e=>e.rootProps.stackOffset,IA=e=>e.rootProps.reverseStackOrder,LA=e=>e.options.chartName,RA=e=>e.rootProps.syncId,zA=e=>e.rootProps.syncMethod,BA=e=>e.options.eventEmitter,VA={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},HA={allowDecimals:!1,allowDuplicatedCategory:!0,allowDataOverflow:!1,angle:0,angleAxisId:0,axisLine:!0,axisLineType:`polygon`,cx:0,cy:0,hide:!1,includeHidden:!1,label:!1,niceTicks:`auto`,orientation:`outer`,reversed:!1,scale:`auto`,tick:!0,tickLine:!0,tickSize:8,type:`auto`,zIndex:VA.axis},UA={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,niceTicks:`auto`,label:!1,orientation:`right`,radiusAxisId:0,reversed:!1,scale:`auto`,stroke:`#ccc`,tick:!0,tickCount:5,tickLine:!0,type:`auto`,zIndex:VA.axis},WA=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function GA(e,t,n){if(n!==`auto`)return n;if(e!=null)return ow(e,t)?`category`:`number`}function KA(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 qA(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},RT],(e,t)=>{if(e!=null)return e;var n=GA(t,`angleAxis`,ZA.type)??`category`;return qA(qA({},ZA),{},{type:n})}),ej=q([(e,t)=>e.polarAxis.radiusAxis[t],RT],(e,t)=>{if(e!=null)return e;var n=GA(t,`radiusAxis`,QA.type)??`category`;return qA(qA({},QA),{},{type:n})}),tj=e=>e.polarOptions,nj=q([Tw,Ew,Hw],Dk),rj=q([tj,nj],(e,t)=>{if(e!=null)return xg(e.innerRadius,t,0)}),ij=q([tj,nj],(e,t)=>{if(e!=null)return xg(e.outerRadius,t,t*.8)}),aj=q([tj],e=>e==null?[0,0]:[e.startAngle,e.endAngle]);q([$A,aj],WA);var oj=q([nj,rj,ij],(e,t,n)=>{if(e!=null&&t!=null&&n!=null)return[t,n]});q([ej,oj],WA);var sj=q([FT,tj,rj,ij,Tw,Ew],(e,t,n,r,i,a)=>{if(!(e!==`centric`&&e!==`radial`||t==null||n==null||r==null)){var o=t.cx,s=t.cy,c=t.startAngle,l=t.endAngle;return{cx:xg(o,i,i/2),cy:xg(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:l,clockWise:!1}}}),cj=(e,t)=>t,lj=(e,t,n)=>n;function uj(e){return e?.id}function dj(e,t,n){var r=t.chartData,i=r===void 0?[]:r,a=n.allowDuplicatedCategory,o=n.dataKey,s=new Map;return e.forEach(e=>{var t=e.data??i;if(t!=null&&t.length!==0){var n=uj(e);t.forEach((t,r)=>{var i=o==null||a?r:String(iw(t,o,null)),c=iw(t,e.dataKey,0),l=s.has(i)?s.get(i):{};Object.assign(l,{[n]:c}),s.set(i,l)})}}),Array.from(s.values())}function fj(e){return`stackId`in e&&e.stackId!=null&&e.dataKey!=null}var pj=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function mj(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function hj(e,t){if(e.length===t.length){for(var n=0;n{var t=FT(e);return t===`horizontal`?`xAxis`:t===`vertical`?`yAxis`:t===`centric`?`angleAxis`:`radiusAxis`},_j=e=>e.tooltip.settings.axisId;function vj(e){if(e!=null){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(e){var t=i[0],n=i[1];return t<=n?e>=t&&e<=n:e>=n&&e<=t},bandwidth:n?()=>n.call(e):void 0,ticks:t?n=>t.call(e,n):void 0,map:(t,n)=>{var r=e(t);if(r!=null){if(e.bandwidth&&n!=null&&n.position){var i=e.bandwidth();switch(n.position){case`middle`:r+=i/2;break;case`end`:r+=i}}return r}}}}}var yj=(e,t)=>{if(t!=null)switch(e){case`linear`:if(!dA(t)){for(var n,r,i=0;ir)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t;default:return t}};function bj(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function xj(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Sj(e){let t,n,r;e.length===2?(t=e===bj||e===xj?e:Cj,n=e,r=e):(t=bj,n=(t,n)=>bj(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 Cj(){return 0}function wj(e){return e===null?NaN:+e}function*Tj(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 Ej=Sj(bj),Dj=Ej.right;Ej.left,Sj(wj).center;var Oj=class extends Map{constructor(e,t=Mj){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(kj(this,e))}has(e){return super.has(kj(this,e))}set(e,t){return super.set(Aj(this,e),t)}delete(e){return super.delete(jj(this,e))}};function kj({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function Aj({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function jj({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Mj(e){return typeof e==`object`&&e?e.valueOf():e}function Nj(e=bj){if(e===bj)return Pj;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 Pj(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var Fj=Math.sqrt(50),Ij=Math.sqrt(10),Lj=Math.sqrt(2);function Rj(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=Fj?10:a>=Ij?5:a>=Lj?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 Uj(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 Wj(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?Pj:Nj(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));Wj(e,t,u,d,i)}let a=e[t],o=n,s=r;for(Gj(e,n,t),i(e[r],a)>0&&Gj(e,n,r);o0;)--s}i(e[n],a)===0?Gj(e,n,s):(++s,Gj(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function Gj(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Kj(e,t,n){if(e=Float64Array.from(Tj(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return Uj(e);if(t>=1)return Hj(e);var r,i=(r-1)*t,a=Math.floor(i),o=Hj(Wj(e,a).subarray(0,a+1));return o+(Uj(e.subarray(a+1))-o)*(i-a)}}function qj(e,t,n=wj){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 Jj(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?wM(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?wM(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=dM.exec(e))?new DM(t[1],t[2],t[3],1):(t=fM.exec(e))?new DM(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=pM.exec(e))?wM(t[1],t[2],t[3],t[4]):(t=mM.exec(e))?wM(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=hM.exec(e))?PM(t[1],t[2]/100,t[3]/100,1):(t=gM.exec(e))?PM(t[1],t[2]/100,t[3]/100,t[4]):_M.hasOwnProperty(e)?CM(_M[e]):e===`transparent`?new DM(NaN,NaN,NaN,0):null}function CM(e){return new DM(e>>16&255,e>>8&255,e&255,1)}function wM(e,t,n,r){return r<=0&&(e=t=n=NaN),new DM(e,t,n,r)}function TM(e){return e instanceof iM||(e=SM(e)),e?(e=e.rgb(),new DM(e.r,e.g,e.b,e.opacity)):new DM}function EM(e,t,n,r){return arguments.length===1?TM(e):new DM(e,t,n,r??1)}function DM(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}nM(DM,EM,rM(iM,{brighter(e){return e=e==null?oM:oM**+e,new DM(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?aM:aM**+e,new DM(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new DM(MM(this.r),MM(this.g),MM(this.b),jM(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:OM,formatHex:OM,formatHex8:kM,formatRgb:AM,toString:AM}));function OM(){return`#${NM(this.r)}${NM(this.g)}${NM(this.b)}`}function kM(){return`#${NM(this.r)}${NM(this.g)}${NM(this.b)}${NM((isNaN(this.opacity)?1:this.opacity)*255)}`}function AM(){let e=jM(this.opacity);return`${e===1?`rgb(`:`rgba(`}${MM(this.r)}, ${MM(this.g)}, ${MM(this.b)}${e===1?`)`:`, ${e})`}`}function jM(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function MM(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function NM(e){return e=MM(e),(e<16?`0`:``)+e.toString(16)}function PM(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new LM(e,t,n,r)}function FM(e){if(e instanceof LM)return new LM(e.h,e.s,e.l,e.opacity);if(e instanceof iM||(e=SM(e)),!e)return new LM;if(e instanceof LM)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 LM(o,s,c,e.opacity)}function IM(e,t,n,r){return arguments.length===1?FM(e):new LM(e,t,n,r??1)}function LM(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}nM(LM,IM,rM(iM,{brighter(e){return e=e==null?oM:oM**+e,new LM(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?aM:aM**+e,new LM(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 DM(BM(e>=240?e-240:e+120,i,r),BM(e,i,r),BM(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new LM(RM(this.h),zM(this.s),zM(this.l),jM(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=jM(this.opacity);return`${e===1?`hsl(`:`hsla(`}${RM(this.h)}, ${zM(this.s)*100}%, ${zM(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function RM(e){return e=(e||0)%360,e<0?e+360:e}function zM(e){return Math.max(0,Math.min(1,e||0))}function BM(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 VM=e=>()=>e;function HM(e,t){return function(n){return e+n*t}}function UM(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function WM(e){return(e=+e)==1?GM:function(t,n){return n-t?UM(t,n,e):VM(isNaN(t)?n:t)}}function GM(e,t){var n=t-e;return n?HM(e,n):VM(isNaN(e)?t:e)}var KM=(function e(t){var n=WM(t);function r(e,t){var r=n((e=EM(e)).r,(t=EM(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=GM(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 qM(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:ZM(r,i)})),n=eN.lastIndex;return nt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function pN(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?mN:pN,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),ZM))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,cN),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=aN,u()},d.clamp=function(e){return arguments.length?(o=e?!0:uN,u()):o!==uN},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 _N(){return gN()(uN,uN)}function vN(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function yN(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 bN(e){return e=yN(Math.abs(e)),e?e[1]:NaN}function xN(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 SN(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var CN=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wN(e){if(!(t=CN.exec(e)))throw Error(`invalid format: `+e);var t;return new TN({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]})}wN.prototype=TN.prototype;function TN(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+``}TN.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 EN(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}var DN;function ON(e,t){var n=yN(e,t);if(!n)return DN=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(DN=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`)+yN(e,Math.max(0,t+a-1))[0]}function kN(e,t){var n=yN(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 AN={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:vN,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)=>kN(e*100,t),r:kN,s:ON,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function jN(e){return e}var MN=Array.prototype.map,NN=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function PN(e){var t=e.grouping===void 0||e.thousands===void 0?jN:xN(MN.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?jN:SN(MN.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=wN(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`):AN[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=AN[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=EN(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&DN!==void 0?NN[8+DN/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}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(bN(t)/3)))*3,r=10**-n,i=l((e=wN(e),e.type=`f`,e),{suffix:NN[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var FN,IN,LN;RN({thousands:`,`,grouping:[3],currency:[`$`,``]});function RN(e){return FN=PN(e),IN=FN.format,LN=FN.formatPrefix,FN}function zN(e){return Math.max(0,-bN(Math.abs(e)))}function BN(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(bN(t)/3)))*3-bN(Math.abs(e)))}function VN(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,bN(t)-bN(e))+1}function HN(e,t,n,r){var i=Vj(e,t,n),a;switch(r=wN(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=BN(i,o))&&(r.precision=a),LN(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=VN(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=zN(i))&&(r.precision=a-(r.type===`%`)*2)}return IN(r)}function UN(e){var t=e.domain;return e.ticks=function(e){var n=t();return zj(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return HN(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=Bj(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 WN(){var e=_N();return e.copy=function(){return hN(e,WN())},Yj.apply(e,arguments),UN(e)}function GN(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,cN),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return GN(e).unknown(t)},e=arguments.length?Array.from(e,cN):[0,1],UN(n)}function KN(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function $N(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 eP(e){return(t,n)=>-e(-t,n)}function tP(e){let t=e(qN,JN),n=t.domain,r=10,i,a;function o(){return i=$N(r),a=QN(r),n()[0]<0?(i=eP(i),a=eP(a),e(YN,XN)):e(qN,JN),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=wN(n)).precision==null&&(n.trim=!0),n=IN(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(KN(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function nP(){let e=tP(gN()).domain([1,10]);return e.copy=()=>hN(e,nP()).base(e.base()),Yj.apply(e,arguments),e}function rP(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function iP(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function aP(e){var t=1,n=e(rP(t),iP(t));return n.constant=function(n){return arguments.length?e(rP(t=+n),iP(t)):t},UN(n)}function oP(){var e=aP(gN());return e.copy=function(){return hN(e,oP()).constant(e.constant())},Yj.apply(e,arguments)}function sP(e){return function(t){return t<0?-((-t)**+e):t**+e}}function cP(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function lP(e){return e<0?-e*e:e*e}function uP(e){var t=e(uN,uN),n=1;function r(){return n===1?e(uN,uN):n===.5?e(cP,lP):e(sP(n),sP(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},UN(t)}function dP(){var e=uP(gN());return e.copy=function(){return hN(e,dP()).exponent(e.exponent())},Yj.apply(e,arguments),e}function fP(){return dP.apply(null,arguments).exponent(.5)}function pP(e){return Math.sign(e)*e*e}function mP(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function hP(){var e=_N(),t=[0,1],n=!1,r;function i(t){var i=mP(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(pP(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,cN)).map(pP)),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 hP(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Yj.apply(i,arguments),UN(i)}function gP(){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 _P().domain([e,t]).range(i).unknown(a)},Yj.apply(UN(o),arguments)}function vP(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[Dj(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 vP().domain(e).range(t).unknown(n)},Yj.apply(i,arguments)}var yP=new Date,bP=new Date;function xP(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(sxP(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)=>(yP.setTime(+t),bP.setTime(+r),e(yP),e(bP),Math.floor(n(yP,bP))),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 SP=xP(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);SP.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?xP(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):SP),SP.range;var CP=1e3,wP=CP*60,TP=wP*60,EP=TP*24,DP=EP*7,OP=EP*30,kP=EP*365,AP=xP(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*CP)},(e,t)=>(t-e)/CP,e=>e.getUTCSeconds());AP.range;var jP=xP(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*CP)},(e,t)=>{e.setTime(+e+t*wP)},(e,t)=>(t-e)/wP,e=>e.getMinutes());jP.range;var MP=xP(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*wP)},(e,t)=>(t-e)/wP,e=>e.getUTCMinutes());MP.range;var NP=xP(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*CP-e.getMinutes()*wP)},(e,t)=>{e.setTime(+e+t*TP)},(e,t)=>(t-e)/TP,e=>e.getHours());NP.range;var PP=xP(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*TP)},(e,t)=>(t-e)/TP,e=>e.getUTCHours());PP.range;var FP=xP(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*wP)/EP,e=>e.getDate()-1);FP.range;var IP=xP(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/EP,e=>e.getUTCDate()-1);IP.range;var LP=xP(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/EP,e=>Math.floor(e/EP));LP.range;function RP(e){return xP(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())*wP)/DP)}var zP=RP(0),BP=RP(1),VP=RP(2),HP=RP(3),UP=RP(4),WP=RP(5),GP=RP(6);zP.range,BP.range,VP.range,HP.range,UP.range,WP.range,GP.range;function KP(e){return xP(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)/DP)}var qP=KP(0),JP=KP(1),YP=KP(2),XP=KP(3),ZP=KP(4),QP=KP(5),$P=KP(6);qP.range,JP.range,YP.range,XP.range,ZP.range,QP.range,$P.range;var eF=xP(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());eF.range;var tF=xP(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());tF.range;var nF=xP(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());nF.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xP(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)}),nF.range;var rF=xP(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());rF.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xP(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)}),rF.range;function iF(e,t,n,r,i,a){let o=[[AP,1,CP],[AP,5,5*CP],[AP,15,15*CP],[AP,30,30*CP],[a,1,wP],[a,5,5*wP],[a,15,15*wP],[a,30,30*wP],[i,1,TP],[i,3,3*TP],[i,6,6*TP],[i,12,12*TP],[r,1,EP],[r,2,2*EP],[n,1,DP],[t,1,OP],[t,3,3*OP],[e,1,kP]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(Vj(t/kP,n/kP,r));if(a===0)return SP.every(Math.max(Vj(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=uF(dF(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?JP.ceil(a):JP(a),a=IP.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=lF(dF(r.y,0,1)),o=a.getDay(),a=o>4||o===0?BP.ceil(a):BP(a),a=FP.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?uF(dF(r.y,0,1)).getUTCDay():lF(dF(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,uF(r)):lF(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 pF?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 F(e){return c[e.getMonth()]}function ee(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 I(e){return c[e.getUTCMonth()]}function ae(e){return s[e.getUTCMonth()]}function oe(e){return i[+(e.getUTCHours()>=12)]}function se(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 pF={"-":``,_:` `,0:`0`},mF=/^\s*\d+/,hF=/^%/,gF=/[\\^$*+?|[\]().{}]/g;function _F(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function xF(e,t,n){var r=mF.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function SF(e,t,n){var r=mF.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function CF(e,t,n){var r=mF.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function wF(e,t,n){var r=mF.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function TF(e,t,n){var r=mF.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function EF(e,t,n){var r=mF.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function DF(e,t,n){var r=mF.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function OF(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 kF(e,t,n){var r=mF.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function AF(e,t,n){var r=mF.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function jF(e,t,n){var r=mF.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function MF(e,t,n){var r=mF.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function NF(e,t,n){var r=mF.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function PF(e,t,n){var r=mF.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function FF(e,t,n){var r=mF.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function IF(e,t,n){var r=mF.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function LF(e,t,n){var r=mF.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function RF(e,t,n){var r=hF.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function zF(e,t,n){var r=mF.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function BF(e,t,n){var r=mF.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function VF(e,t){return _F(e.getDate(),t,2)}function HF(e,t){return _F(e.getHours(),t,2)}function UF(e,t){return _F(e.getHours()%12||12,t,2)}function WF(e,t){return _F(1+FP.count(nF(e),e),t,3)}function GF(e,t){return _F(e.getMilliseconds(),t,3)}function KF(e,t){return GF(e,t)+`000`}function qF(e,t){return _F(e.getMonth()+1,t,2)}function JF(e,t){return _F(e.getMinutes(),t,2)}function YF(e,t){return _F(e.getSeconds(),t,2)}function XF(e){var t=e.getDay();return t===0?7:t}function ZF(e,t){return _F(zP.count(nF(e)-1,e),t,2)}function QF(e){var t=e.getDay();return t>=4||t===0?UP(e):UP.ceil(e)}function $F(e,t){return e=QF(e),_F(UP.count(nF(e),e)+(nF(e).getDay()===4),t,2)}function eI(e){return e.getDay()}function tI(e,t){return _F(BP.count(nF(e)-1,e),t,2)}function nI(e,t){return _F(e.getFullYear()%100,t,2)}function rI(e,t){return e=QF(e),_F(e.getFullYear()%100,t,2)}function iI(e,t){return _F(e.getFullYear()%1e4,t,4)}function aI(e,t){var n=e.getDay();return e=n>=4||n===0?UP(e):UP.ceil(e),_F(e.getFullYear()%1e4,t,4)}function oI(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+_F(t/60|0,`0`,2)+_F(t%60,`0`,2)}function sI(e,t){return _F(e.getUTCDate(),t,2)}function cI(e,t){return _F(e.getUTCHours(),t,2)}function lI(e,t){return _F(e.getUTCHours()%12||12,t,2)}function uI(e,t){return _F(1+IP.count(rF(e),e),t,3)}function dI(e,t){return _F(e.getUTCMilliseconds(),t,3)}function fI(e,t){return dI(e,t)+`000`}function pI(e,t){return _F(e.getUTCMonth()+1,t,2)}function mI(e,t){return _F(e.getUTCMinutes(),t,2)}function hI(e,t){return _F(e.getUTCSeconds(),t,2)}function gI(e){var t=e.getUTCDay();return t===0?7:t}function _I(e,t){return _F(qP.count(rF(e)-1,e),t,2)}function vI(e){var t=e.getUTCDay();return t>=4||t===0?ZP(e):ZP.ceil(e)}function yI(e,t){return e=vI(e),_F(ZP.count(rF(e),e)+(rF(e).getUTCDay()===4),t,2)}function bI(e){return e.getUTCDay()}function xI(e,t){return _F(JP.count(rF(e)-1,e),t,2)}function SI(e,t){return _F(e.getUTCFullYear()%100,t,2)}function CI(e,t){return e=vI(e),_F(e.getUTCFullYear()%100,t,2)}function wI(e,t){return _F(e.getUTCFullYear()%1e4,t,4)}function TI(e,t){var n=e.getUTCDay();return e=n>=4||n===0?ZP(e):ZP.ceil(e),_F(e.getUTCFullYear()%1e4,t,4)}function EI(){return`+0000`}function DI(){return`%`}function OI(e){return+e}function kI(e){return Math.floor(e/1e3)}var AI,jI,MI;NI({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 NI(e){return AI=fF(e),jI=AI.format,AI.parse,MI=AI.utcFormat,AI.utcParse,AI}function PI(e){return new Date(e)}function FI(e){return e instanceof Date?+e:+new Date(+e)}function II(e,t,n,r,i,a,o,s,c,l){var u=_N(),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)=>Kj(e,r/t))},n.copy=function(){return KI(t).domain(e)},Xj.apply(n,arguments)}function qI(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=uN,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*e$j,scaleDiverging:()=>JI,scaleDivergingLog:()=>YI,scaleDivergingPow:()=>ZI,scaleDivergingSqrt:()=>QI,scaleDivergingSymlog:()=>XI,scaleIdentity:()=>GN,scaleImplicit:()=>Zj,scaleLinear:()=>WN,scaleLog:()=>nP,scaleOrdinal:()=>Qj,scalePoint:()=>tM,scalePow:()=>dP,scaleQuantile:()=>gP,scaleQuantize:()=>_P,scaleRadial:()=>hP,scaleSequential:()=>VI,scaleSequentialLog:()=>HI,scaleSequentialPow:()=>WI,scaleSequentialQuantile:()=>KI,scaleSequentialSqrt:()=>GI,scaleSequentialSymlog:()=>UI,scaleSqrt:()=>fP,scaleSymlog:()=>oP,scaleThreshold:()=>vP,scaleTime:()=>LI,scaleUtc:()=>RI,tickFormat:()=>HN});function eL(e){var t=$I;if(e in t&&typeof t[e]==`function`)return t[e]();var n=`scale${Eg(e)}`;if(n in t&&typeof t[n]==`function`)return t[n]()}function tL(e,t,n){if(typeof e==`function`)return e.copy().domain(t).range(n);if(e!=null){var r=eL(e);if(r!=null)return r.domain(t).range(n),r}}function nL(e,t,n,r){if(n!=null&&r!=null)return typeof e.scale==`function`?tL(e.scale,n,r):tL(t,n,r)}function rL(e){return`scale${Eg(e)}`}function iL(e){return rL(e)in $I}var aL=(e,t,n)=>{if(e!=null){var r=e.scale,i=e.type;if(r===`auto`)return i===`category`&&n&&(n.indexOf(`LineChart`)>=0||n.indexOf(`AreaChart`)>=0||n.indexOf(`ComposedChart`)>=0&&!t)?`point`:i===`category`?`band`:`linear`;if(typeof r==`string`)return iL(r)?r:`point`}};function oL(e,t){for(var n=0,r=e.length,i=e[0]t)?n=a+1:r=a}return n}function sL(e,t){if(e){var n=t??e.domain(),r=n.map(t=>e(t)??0),i=e.range();if(!(n.length===0||i.length<2))return e=>{var t=oL(r,e);if(t<=0)return n[0];if(t>=n.length)return n[n.length-1];var i=r[t-1]??0,a=r[t]??0;return Math.abs(e-i)<=Math.abs(e-a)?n[t-1]:n[t]}}}function cL(e){if(e!=null)return`invert`in e&&typeof e.invert==`function`?e.invert.bind(e):sL(e,void 0)}function lL(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 uL(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ne.cartesianAxis.xAxis[t],CL=(e,t)=>SL(e,t)??xL,wL={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:bL,hide:!0,id:0,includeHidden:!1,interval:`preserveEnd`,minTickGap:5,mirror:!1,name:void 0,orientation:`left`,padding:{top:0,bottom:0},reversed:!1,scale:`auto`,tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:`number`,unit:void 0,niceTicks:`auto`,width:60},TL=(e,t)=>e.cartesianAxis.yAxis[t],EL=(e,t)=>TL(e,t)??wL,DL={domain:[0,`auto`],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:``,range:[64,64],scale:`auto`,type:`number`,unit:``},OL=(e,t)=>e.cartesianAxis.zAxis[t]??DL,kL=(e,t,n)=>{switch(t){case`xAxis`:return CL(e,n);case`yAxis`:return EL(e,n);case`zAxis`:return OL(e,n);case`angleAxis`:return $A(e,n);case`radiusAxis`:return ej(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},AL=(e,t,n)=>{switch(t){case`xAxis`:return CL(e,n);case`yAxis`:return EL(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},jL=(e,t,n)=>{switch(t){case`xAxis`:return CL(e,n);case`yAxis`:return EL(e,n);case`angleAxis`:return $A(e,n);case`radiusAxis`:return ej(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},ML=e=>e.graphicalItems.cartesianItems.some(e=>e.type===`bar`)||e.graphicalItems.polarItems.some(e=>e.type===`radialBar`);function NL(e,t){return n=>{switch(e){case`xAxis`:return`xAxisId`in n&&n.xAxisId===t;case`yAxis`:return`yAxisId`in n&&n.yAxisId===t;case`zAxis`:return`zAxisId`in n&&n.zAxisId===t;case`angleAxis`:return`angleAxisId`in n&&n.angleAxisId===t;case`radiusAxis`:return`radiusAxisId`in n&&n.radiusAxisId===t;default:return!1}}}var PL=e=>e.graphicalItems.cartesianItems,FL=q([cj,lj],NL),IL=(e,t,n)=>e.filter(n).filter(e=>t?.includeHidden===!0||!e.hide),LL=q([PL,kL,FL],IL,{memoizeOptions:{resultEqualityCheck:mj}}),RL=q([LL],e=>e.filter(e=>e.type===`area`||e.type===`bar`).filter(fj)),zL=e=>e.filter(e=>!(`stackId`in e)||e.stackId===void 0),BL=q([LL],zL),VL=e=>e.map(e=>e.data).filter(Boolean).flat(1),HL=q([LL],e=>e.some(e=>!e.data)),UL=q([LL],VL,{memoizeOptions:{resultEqualityCheck:mj}}),WL=(e,t)=>{var n=t.chartData,r=n===void 0?[]:n,i=t.dataStartIndex,a=t.dataEndIndex;return e.length>0?e:r.slice(i,a+1)},GL=q([UL,tA],WL),KL=(e,t,n)=>t?.dataKey==null?n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:iw(e,t)}))):e.map(e=>({value:e})):e.map(e=>({value:iw(e,t.dataKey)})),qL=(e,t,n,r,i,a)=>{var o=r.chartData,s=o===void 0?[]:o,c=r.dataStartIndex,l=r.dataEndIndex,u=KL(e,t,n);return i&&t?.dataKey!=null&&a.length>0?[...s.slice(c,l+1).map(e=>({value:iw(e,t.dataKey)})).filter(e=>e.value!=null),...u]:u},JL=q([GL,kL,LL,tA,HL,UL],qL);function YL(e){if(vg(e)||e instanceof Date){var t=Number(e);if(ZC(t))return t}}function XL(e){if(Array.isArray(e)){var t=[YL(e[0]),YL(e[1])];return dA(t)?t:void 0}var n=YL(e);if(n!=null)return[n,n]}function ZL(e){return e.map(YL).filter(Dg)}function QL(e,t){var n=YL(e),r=YL(t);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var $L=q([JL],e=>e?.map(e=>e.value).sort(QL));function eR(e,t){switch(e){case`xAxis`:return t.direction===`x`;case`yAxis`:return t.direction===`y`;default:return!1}}function tR(e,t,n){if(!n||!n.length)return[];var r;if(typeof t==`number`&&!gg(t))r=t;else if(Array.isArray(t)){var i=ZL(t);i.length>0&&(r=Math.max(...i))}return r==null?[]:ZL(n.flatMap(t=>{var n=iw(e,t.dataKey),i,a;if(Array.isArray(n)){var o=mL(n,2);i=o[0],a=o[1]}else i=a=n;if(!(!ZC(i)||!ZC(a)))return[r-i,r+a]}))}var nR=e=>jL(e,gj(e),_j(e)),rR=q([nR],e=>e?.dataKey),iR=q([RL,tA,nR],dj),aR=(e,t,n,r)=>{var i=t.reduce((e,t)=>{if(t.stackId==null)return e;var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},{});return Object.fromEntries(Object.entries(i).map(t=>{var i=mL(t,2),a=i[0],o=i[1],s=r?[...o].reverse():o;return[a,{stackedData:dw(e,s.map(uj),n),graphicalItems:s}]}))},oR=q([iR,RL,FA,IA],aR),sR=(e,t,n,r)=>{var i=t.dataStartIndex,a=t.dataEndIndex;if(r==null&&n!==`zAxis`)return _w(e,i,a)},cR=q([kL],e=>e.allowDataOverflow),lR=e=>{if(e==null||!(`domain`in e))return bL;if(e.domain!=null)return e.domain;if(`ticks`in e&&e.ticks!=null){if(e.type===`number`){var t=ZL(e.ticks);return[Math.min(...t),Math.max(...t)]}if(e.type===`category`)return e.ticks.map(String)}return e?.domain??bL},uR=q([kL],lR),dR=q([uR,cR],pA),fR=q([oR,$k,cj,dR],sR,{memoizeOptions:{resultEqualityCheck:pj}}),pR=e=>e.errorBars,mR=(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>eR(n,e)),hR=function(){var e=[...arguments].filter(Boolean);if(e.length!==0){var t=e.flat();return[Math.min(...t),Math.max(...t)]}},gR=function(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],o,s;if(n.length>0&&n.forEach(e=>{var n=e.data==null?a:[...e.data],c=r[e.id]?.filter(e=>eR(i,e));n.forEach(n=>{var r=iw(n,t.dataKey??e.dataKey),i=tR(n,r,c);if(i.length>=2){var a=Math.min(...i),l=Math.max(...i);(o==null||as)&&(s=l)}var u=XL(r);u!=null&&(o=o==null?u[0]:Math.min(o,u[0]),s=s==null?u[1]:Math.max(s,u[1]))})}),t?.dataKey!=null&&n.length===0&&e.forEach(e=>{var n=XL(iw(e,t.dataKey));n!=null&&(o=o==null?n[0]:Math.min(o,n[0]),s=s==null?n[1]:Math.max(s,n[1]))}),ZC(o)&&ZC(s))return[o,s]},_R=q([GL,kL,BL,pR,cj,rA],gR,{memoizeOptions:{resultEqualityCheck:pj}});function vR(e){var t=e.value;if(vg(t)||t instanceof Date)return t}var yR=(e,t,n)=>{var r=e.map(vR).filter(e=>e!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&Sg(r))?Qk(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},bR=e=>e.referenceElements.dots,xR=(e,t,n)=>e.filter(e=>e.ifOverflow===`extendDomain`).filter(e=>t===`xAxis`?e.xAxisId===n:e.yAxisId===n),SR=q([bR,cj,lj],xR),CR=e=>e.referenceElements.areas,wR=q([CR,cj,lj],xR),TR=e=>e.referenceElements.lines,ER=q([TR,cj,lj],xR),DR=(e,t)=>{if(e!=null){var n=ZL(e.map(e=>t===`xAxis`?e.x:e.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},OR=q(SR,cj,DR),kR=(e,t)=>{if(e!=null){var n=ZL(e.flatMap(e=>[t===`xAxis`?e.x1:e.y1,t===`xAxis`?e.x2:e.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},AR=q([wR,cj],kR);function jR(e){if(e.x!=null)return ZL([e.x]);var t=e.segment?.map(e=>e.x);return t==null||t.length===0?[]:ZL(t)}function MR(e){if(e.y!=null)return ZL([e.y]);var t=e.segment?.map(e=>e.y);return t==null||t.length===0?[]:ZL(t)}var NR=(e,t)=>{if(e!=null){var n=e.flatMap(e=>t===`xAxis`?jR(e):MR(e));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},PR=q(OR,q([ER,cj],NR),AR,(e,t,n)=>hR(e,n,t)),FR=(e,t,n,r,i,a,o,s,c)=>{if(n!=null)return n;var l=o===`vertical`&&s===`xAxis`||o===`horizontal`&&s===`yAxis`?hR(r,a,i):hR(a,i),u=mA(t,l,e.allowDataOverflow);return u==null&&e.allowDataOverflow&&l==null&&c!=null?c:u},IR=q([kL,uR,dR,fR,_R,PR,FT,cj,q([kL],e=>{if(!(e==null||e.type!==`number`||!(`ticks`in e)||e.ticks==null)){var t=ZL(e.ticks);if(t.length!==0)return[Math.min(...t),Math.max(...t)]}},{memoizeOptions:{resultEqualityCheck:pj}})],FR,{memoizeOptions:{resultEqualityCheck:pj}}),LR=[0,1],RR=(e,t,n,r,i,a,o)=>{if(e!=null&&n!=null&&n.length!==0||o!==void 0){var s=e.dataKey,c=e.type,l=ow(t,a);return l&&s==null?Qk(0,n?.length??0):c===`category`?yR(r,e,l):i===`expand`&&!l?LR:o}},zR=q([kL,FT,GL,JL,FA,cj,IR],RR),BR=q([kL,ML,LA],aL),VR=(e,t,n)=>{var r=t.niceTicks;if(r!==`none`){var i=lR(t),a=Array.isArray(i)&&(i[0]===`auto`||i[1]===`auto`);if((r===`snap125`||r===`adaptive`)&&t!=null&&t.tickCount&&dA(e)){if(a)return kA(e,t.tickCount,t.allowDecimals,r);if(t.type===`number`)return AA(e,t.tickCount,t.allowDecimals,r)}if(r===`auto`&&n===`linear`&&t!=null&&t.tickCount){if(a&&dA(e))return kA(e,t.tickCount,t.allowDecimals,`adaptive`);if(t.type===`number`&&dA(e))return AA(e,t.tickCount,t.allowDecimals,`adaptive`)}}},HR=q([zR,jL,BR],VR),UR=(e,t,n,r)=>{if(r!==`angleAxis`&&e?.type===`number`&&dA(t)&&Array.isArray(n)&&n.length>0){var i=t[0],a=n[0]??0,o=t[1],s=n[n.length-1]??0;return[Math.min(i,a),Math.max(o,s)]}return t},WR=q([kL,zR,HR,cj],UR),GR=q(q(JL,kL,(e,t)=>{if(!(!t||t.type!==`number`)){var n=1/0,r=Array.from(ZL(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var s=0;si,(e,t,n,r,i)=>{if(!ZC(e))return 0;var a=t===`vertical`?r.height:r.width;if(i===`gap`)return e*a/2;if(i===`no-gap`){var o=xg(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),KR=(e,t,n)=>{var r=CL(e,t);return r==null||typeof r.padding!=`string`?0:GR(e,`xAxis`,t,n,r.padding)},qR=(e,t,n)=>{var r=EL(e,t);return r==null||typeof r.padding!=`string`?0:GR(e,`yAxis`,t,n,r.padding)},JR=q(CL,KR,(e,t)=>{if(e==null)return{left:0,right:0};var n=e.padding;return typeof n==`string`?{left:t,right:t}:{left:(n.left??0)+t,right:(n.right??0)+t}}),YR=q(EL,qR,(e,t)=>{if(e==null)return{top:0,bottom:0};var n=e.padding;return typeof n==`string`?{top:t,bottom:t}:{top:(n.top??0)+t,bottom:(n.bottom??0)+t}}),XR=q([Hw,JR,Yw,Jw,(e,t,n)=>n],(e,t,n,r,i)=>{var a=r.padding;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),ZR=q([Hw,FT,YR,Yw,Jw,(e,t,n)=>n],(e,t,n,r,i,a)=>{var o=i.padding;return a?[r.height-o.bottom,o.top]:t===`horizontal`?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),QR=(e,t,n,r)=>{switch(t){case`xAxis`:return XR(e,n,r);case`yAxis`:return ZR(e,n,r);case`zAxis`:return OL(e,n)?.range;case`angleAxis`:return aj(e);case`radiusAxis`:return oj(e,n);default:return}},$R=q([kL,QR],WA),ez=q([kL,BR,q([BR,WR],yj),$R],nL),tz=(e,t,n,r)=>{if(n!=null&&n.dataKey!=null){var i=n.type,a=n.scale;if(ow(e,r)&&(i===`number`||a!==`auto`))return t.map(e=>e.value)}},nz=q([FT,JL,jL,cj],tz),rz=q([ez],vj);q([ez],cL),q([ez,$L],sL),q([LL,pR,cj],mR);function iz(e,t){return e.idt.id)}var az=(e,t)=>t,oz=(e,t,n)=>n,sz=q(kw,az,oz,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(iz)),cz=q(Aw,az,oz,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(iz)),lz=(e,t)=>{var n=typeof t.height==`number`?t.height:30;return{width:e.width,height:n}},uz=(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height}),dz=q(Hw,CL,lz),fz=(e,t,n)=>{switch(t){case`top`:return e.top;case`bottom`:return n-e.bottom;default:return 0}},pz=(e,t,n)=>{switch(t){case`left`:return e.left;case`right`:return n-e.right;default:return 0}},mz=q(Ew,Hw,sz,az,oz,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=lz(t,n);o??=fz(t,r,e);var c=r===`top`&&!i||r===`bottom`&&i;a[n.id]=o-Number(c)*s.height,o+=(c?-1:1)*s.height}),a}),hz=q(Tw,Hw,cz,az,oz,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=uz(t,n);o??=pz(t,r,e);var c=r===`left`&&!i||r===`right`&&i;a[n.id]=o-Number(c)*s.width,o+=(c?-1:1)*s.width}),a}),gz=q([Hw,CL,(e,t)=>{var n=CL(e,t);if(n!=null)return mz(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),_z=q([Hw,EL,(e,t)=>{var n=EL(e,t);if(n!=null)return hz(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),vz=q(Hw,EL,(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height})),yz=(e,t,n)=>{switch(t){case`xAxis`:return dz(e,n).width;case`yAxis`:return vz(e,n).height;default:return}},bz=(e,t,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,a=n.type,o=n.dataKey,s=ow(e,r),c=t.map(e=>e.value),l=c.filter(e=>e!=null);if(o&&s&&a===`category`&&i&&Sg(l))return c}},xz=q([FT,JL,kL,cj],bz),Sz=q([FT,AL,BR,rz,xz,nz,QR,HR,cj],(e,t,n,r,i,a,o,s,c)=>{if(t!=null){var l=ow(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:l,niceTicks:s,range:o,realScaleType:n,scale:r}}}),Cz=q([FT,jL,BR,rz,HR,QR,xz,nz,cj],(e,t,n,r,i,a,o,s,c)=>{if(t!=null&&r!=null){var l=ow(e,c),u=t.type,d=t.ticks,f=t.tickCount,p=n===`scaleBand`&&typeof r.bandwidth==`function`?r.bandwidth()/2:2,m=u===`category`&&r.bandwidth?r.bandwidth()/p:0;m=c===`angleAxis`&&a!=null&&a.length>=2?hg(a[0]-a[1])*2*m:m;var h=d||i;return h?h.map((e,t)=>{var n=o?o.indexOf(e):e,i=r.map(n);return ZC(i)?{index:t,coordinate:i+m,value:e,offset:m}:null}).filter(Dg):l&&s?s.map((e,t)=>{var n=r.map(e);return ZC(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(Dg):r.ticks?r.ticks(f).map((e,t)=>{var n=r.map(e);return ZC(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(Dg):r.domain().map((e,t)=>{var n=r.map(e);return ZC(n)?{coordinate:n+m,value:o?o[e]:e,index:t,offset:m}:null}).filter(Dg)}}),wz=q([FT,jL,rz,QR,xz,nz,cj],(e,t,n,r,i,a,o)=>{if(t!=null&&n!=null&&r!=null&&r[0]!==r[1]){var s=ow(e,o),c=t.tickCount,l=0;return l=o===`angleAxis`&&r?.length>=2?hg(r[0]-r[1])*2*l:l,s&&a?a.map((e,t)=>{var r=n.map(e);return ZC(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(Dg):n.ticks?n.ticks(c).map((e,t)=>{var r=n.map(e);return ZC(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(Dg):n.domain().map((e,t)=>{var r=n.map(e);return ZC(r)?{coordinate:r+l,value:i?i[e]:e,index:t,offset:l}:null}).filter(Dg)}}),Tz=q(kL,rz,(e,t)=>{if(e!=null&&t!=null)return uL(uL({},e),{},{scale:t})});q((e,t,n)=>OL(e,n),q([q([kL,BR,zR,$R],nL)],vj),(e,t)=>{if(e!=null&&t!=null)return uL(uL({},e),{},{scale:t})});var Ez=q([FT,kw,Aw],(e,t,n)=>{switch(e){case`horizontal`:return t.some(e=>e.reversed)?`right-to-left`:`left-to-right`;case`vertical`:return n.some(e=>e.reversed)?`bottom-to-top`:`top-to-bottom`;case`centric`:case`radial`:return`left-to-right`;default:return}});q([(e,t,n)=>e.renderedTicks[t]?.[n]],e=>{if(!(!e||e.length===0))return t=>{var n=1/0,r=e[0];for(var i of e){var a=Math.abs(i.coordinate-t);ae.options.defaultTooltipEventType,Oz=e=>e.options.validateTooltipEventTypes;function kz(e,t,n){if(e==null)return t;var r=e?`axis`:`item`;return n==null?t:n.includes(r)?r:t}function Az(e,t){return kz(t,Dz(e),Oz(e))}function jz(e){return K(t=>Az(t,e))}var Mz=(e,t)=>{var n,r=Number(t);if(!(gg(r)||t==null))return r>=0?e==null||(n=e[r])==null?void 0:n.value:void 0},Nz=e=>e.tooltip.settings,Pz={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Fz=tC({name:`tooltip`,initialState:{itemInteraction:{click:Pz,hover:Pz},axisInteraction:{click:Pz,hover:Pz},keyboardInteraction:Pz,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:`hover`,axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(OS(t.payload))},prepare:BS()},replaceTooltipEntrySettings:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=TS(e).tooltipItemPayloads.indexOf(OS(r));a>-1&&(e.tooltipItemPayloads[a]=OS(i))},prepare:BS()},removeTooltipEntrySettings:{reducer(e,t){var n=TS(e).tooltipItemPayloads.indexOf(OS(t.payload));n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:BS()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),Iz=Fz.actions,Lz=Iz.addTooltipEntrySettings,Rz=Iz.replaceTooltipEntrySettings,zz=Iz.removeTooltipEntrySettings,Bz=Iz.setTooltipSettingsState,Vz=Iz.setActiveMouseOverItemIndex,Hz=Iz.mouseLeaveItem,Uz=Iz.mouseLeaveChart,Wz=Iz.setActiveClickItemIndex,Gz=Iz.setMouseOverAxisIndex,Kz=Iz.setMouseClickAxisIndex,qz=Iz.setSyncInteraction,Jz=Iz.setKeyboardInteraction,Yz=Fz.reducer;function Xz(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 Zz(e){for(var t=1;t{if(t==null)return Pz;var i=tB(e,t,n);if(i==null)return Pz;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(nB(i)){if(a)return Zz(Zz({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Zz(Zz({},Pz),{},{coordinate:i.coordinate})};function iB(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function aB(e,t){var n=iB(e),r=t[0],i=t[1];return n!==void 0&&n>=Math.min(r,i)&&n<=Math.max(r,i)}function oB(e,t,n){if(n==null||t==null)return!0;var r=iw(e,t);return r==null||!dA(n)||aB(r,n)}var sB=(e,t,n,r)=>{var i=e?.index;if(i==null)return null;var a=Number(i);if(!ZC(a))return i;var o=0,s=1/0;t.length>0&&(s=t.length-1);var c=Math.max(o,Math.min(a,s)),l=t[c];return l==null||oB(l,n,r)?String(c):null},cB=(e,t,n,r,i,a,o)=>{if(a!=null){var s=o[0]?.getPosition(a);if(s!=null)return s;var c=i?.[Number(a)];if(c)switch(n){case`horizontal`:return{x:c.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:c.coordinate}}}},lB=(e,t,n,r)=>{if(t===`axis`)return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i=n===`hover`?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId;if(e.syncInteraction.active&&i==null)return e.tooltipItemPayloads;if(i==null&&(r!=null||e.keyboardInteraction.active)){var a=e.tooltipItemPayloads[0];return a==null?[]:[a]}return e.tooltipItemPayloads.filter(e=>e.settings?.graphicalItemId===i)},uB=e=>e.options.tooltipPayloadSearcher,dB=e=>e.tooltip;function fB(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 pB(e){for(var t=1;te(t)}function bB(e){if(typeof e==`string`)return e}function xB(e){if(!(typeof e!=`object`||!e))return{name:`name`in e?_B(e.name):void 0,unit:`unit`in e?vB(e.unit):void 0,dataKey:`dataKey`in e?yB(e.dataKey):void 0,payload:`payload`in e?e.payload:void 0,color:`color`in e?bB(e.color):void 0,fill:`fill`in e?bB(e.fill):void 0}}function SB(e,t){return e??t}var CB=(e,t,n,r,i,a,o)=>{if(t!=null&&a!=null){var s=n.chartData,c=n.computedData,l=n.dataStartIndex,u=n.dataEndIndex;return e.reduce((e,n)=>{var d=n.dataDefinedOnItem,f=n.settings,p=SB(d,s),m=Array.isArray(p)?XC(p,l,u):p,h=f?.dataKey??r,g=f?.nameKey,_;return r&&Array.isArray(m)&&!Array.isArray(m[0])&&o===`axis`?(_=wg(m,r,i),_??=a(m,t,c,g)):_=a(m,t,c,g),Array.isArray(_)?_.forEach(t=>{var n=xB(t),r=n?.name,i=n?.dataKey,a=n?.payload,o=pB(pB({},f),{},{name:r,unit:n?.unit,color:n?.color??f?.color,fill:n?.fill??f?.fill});e.push(xw({tooltipEntrySettings:o,dataKey:i,payload:a,value:iw(a,i),name:r==null?void 0:String(r)}))}):e.push(xw({tooltipEntrySettings:f,dataKey:h,payload:_,value:iw(_,h),name:iw(_,g)??f?.name})),e},[])}},wB=q([nR,ML,LA],aL),TB=q([q([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),nR,q([gj,_j],NL)],IL,{memoizeOptions:{resultEqualityCheck:mj}}),EB=q([TB],e=>e.filter(fj)),DB=q([TB],VL,{memoizeOptions:{resultEqualityCheck:mj}}),OB=q([TB],e=>e.some(e=>!e.data)),kB=q([DB,$k],WL),AB=q([EB,$k,nR],dj),jB=q([kB,nR,TB,$k,OB,DB],qL),MB=q([nR],lR),NB=q([MB,q([nR],e=>e.allowDataOverflow)],pA),PB=q([q([AB,q([TB],e=>e.filter(fj)),FA,IA],aR),$k,gj,NB],sR),FB=q([kB,nR,q([TB],zL),pR,gj,iA],gR,{memoizeOptions:{resultEqualityCheck:pj}}),IB=q([q([bR,gj,_j],xR),gj],DR),LB=q([q([CR,gj,_j],xR),gj],kR),RB=q([nR,FT,kB,jB,FA,gj,q([nR,MB,NB,PB,FB,q([IB,q([q([TR,gj,_j],xR),gj],NR),LB],hR),FT,gj],FR)],RR),zB=q([nR,RB,q([RB,nR,wB],VR),gj],UR),BB=e=>QR(e,gj(e),_j(e),!1),VB=q([nR,BB],WA),HB=q([q([nR,wB,zB,VB],nL)],vj),UB=q([FT,nR,wB,HB,BB,q([FT,jB,nR,gj],bz),q([FT,jB,nR,gj],tz),gj],(e,t,n,r,i,a,o,s)=>{if(t){var c=t.type,l=ow(e,s);if(r){var u=n===`scaleBand`&&r.bandwidth?r.bandwidth()/2:2,d=c===`category`&&r.bandwidth?r.bandwidth()/u:0;return d=s===`angleAxis`&&i!=null&&i?.length>=2?hg(i[0]-i[1])*2*d:d,l&&o?o.map((e,t)=>{var n=r.map(e);return ZC(n)?{coordinate:n+d,value:e,index:t,offset:d}:null}).filter(Dg):r.domain().map((e,t)=>{var n=r.map(e);return ZC(n)?{coordinate:n+d,value:a?a[e]:e,index:t,offset:d}:null}).filter(Dg)}}}),WB=q([Dz,Oz,Nz],(e,t,n)=>kz(n.shared,e,t)),GB=e=>e.tooltip.settings.trigger,KB=e=>e.tooltip.settings.defaultIndex,qB=q([dB,WB,GB,KB],rB),JB=q([qB,kB,rR,RB],sB),YB=q([UB,JB],Mz),XB=q([qB],e=>{if(e)return e.dataKey}),ZB=q([qB],e=>{if(e)return e.graphicalItemId}),QB=q([dB,WB,GB,KB],lB),$B=q([qB,q([Tw,Ew,FT,Hw,UB,KB,QB],cB)],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),eV=q([qB],e=>e?.active??!1);q([q([QB,JB,$k,rR,YB,uB,WB],CB)],e=>{if(e!=null){var t=e.map(e=>e.payload).filter(e=>e!=null);return Array.from(new Set(t))}});function tV(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 nV(e){for(var t=1;tK(nR),sV=()=>{var e=oV(),t=K(UB),n=K(HB);return bw(!e||!n?void 0:nV(nV({},e),{},{scale:n}),t)};function cV(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 lV(e){for(var t=1;t{var i=t.find(e=>e&&e.index===n);if(i){if(e===`horizontal`)return{x:i.coordinate,y:r.relativeY};if(e===`vertical`)return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},mV=(e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if(e===`centric`){var a=i.coordinate,o=r.radius;return lV(lV(lV({},r),Ek(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,c=r.angle;return lV(lV(lV({},r),Ek(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function hV(e,t){var n=e.relativeX,r=e.relativeY;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var gV=(e,t,n,r,i)=>{var a=t?.length??0;if(a<=1||e==null)return 0;if(r===`angleAxis`&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var o=i[1]-i[0],s=(t,n,r)=>[e,e+o,e-o].some(e=>(r?e>=t:e>t)&&e<=n),c=0;c0?n[c-1]?.coordinate:n[a-1]?.coordinate,u=n[c]?.coordinate,d=c>=a-1?n[0]?.coordinate:n[c+1]?.coordinate,f=void 0;if(l!=null&&u!=null&&d!=null){if(hg(u-l)!==hg(d-u)){var p=[];if(hg(d-u)===hg(i[1]-i[0])){f=d;var m=u+i[1]-i[0];p[0]=Math.min(m,(m+l)/2),p[1]=Math.max(m,(m+l)/2)}else{f=l;var h=d+i[1]-i[0];p[0]=Math.min(u,(h+u)/2),p[1]=Math.max(u,(h+u)/2)}var g=[Math.min(u,(f+u)/2),Math.max(u,(f+u)/2)];if(s(g[0],g[1],!1)||s(p[0],p[1],!0))return n[c]?.index}else{var _=Math.min(l,d),v=Math.max(l,d);if(s((_+u)/2,(v+u)/2,!1))return n[c]?.index}}}else if(t)for(var y=0;y(b.coordinate+S.coordinate)/2||y>0&&y(b.coordinate+S.coordinate)/2&&e<=(b.coordinate+x.coordinate)/2)return b.index}}return-1},_V=()=>K(LA),vV=(e,t)=>t,yV=(e,t,n)=>n,bV=(e,t,n,r)=>r,xV=q(UB,e=>Pb(e,e=>e.coordinate)),SV=q([dB,vV,yV,bV],rB),CV=q([SV,kB,rR,RB],sB),wV=(e,t,n)=>{if(t!=null){var r=dB(e);return t===`axis`?n===`hover`?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n===`hover`?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},TV=q([dB,vV,yV,bV],lB),EV=q([Tw,Ew,FT,Hw,UB,bV,TV],cB),DV=q([SV,EV],(e,t)=>e.coordinate??t),OV=q([UB,CV],Mz),kV=q([TV,CV,$k,rR,OV,uB,vV],CB),AV=q([SV,CV],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),jV=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&hV(e,o)){var s=gV(Cw(e,t),a,i,n,r),c=pV(t,i,s,e);return{activeIndex:String(s),activeCoordinate:c}}},MV=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var s=Mk(e,n);if(s){var c=gV(ww(s,t),o,a,r,i),l=mV(t,a,c,s);return{activeIndex:String(c),activeCoordinate:l}}}},NV=(e,t,n,r,i,a,o,s)=>{if(!(!e||!t||!r||!i||!a))return t===`horizontal`||t===`vertical`?jV(e,t,r,i,a,o,s):MV(e,t,n,r,i,a,o)},PV=q(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),FV=q(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(VA));return Array.from(new Set(t)).sort((e,t)=>e-t)},{memoizeOptions:{resultEqualityCheck:hj}});function IV(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 LV(e){for(var t=1;tLV(LV({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},HV=new Set(Object.values(VA));function UV(e){return HV.has(e)}var WV=tC({name:`zIndex`,initialState:VV,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:BS()},unregisterZIndexPortal:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]&&(--e.zIndexMap[n].consumers,e.zIndexMap[n].consumers<=0&&!UV(n)&&delete e.zIndexMap[n])},prepare:BS()},registerZIndexPortalElement:{reducer:(e,t)=>{var n=t.payload,r=n.zIndex,i=n.element,a=n.isPanorama;e.zIndexMap[r]?a?e.zIndexMap[r].panoramaElement=OS(i):e.zIndexMap[r].element=OS(i):e.zIndexMap[r]={consumers:0,element:a?void 0:OS(i),panoramaElement:a?OS(i):void 0}},prepare:BS()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:BS()}}}),GV=WV.actions,KV=GV.registerZIndexPortal,qV=GV.unregisterZIndexPortal,JV=GV.registerZIndexPortalElement,YV=GV.unregisterZIndexPortalElement,XV=WV.reducer;function ZV(e){var t=e.zIndex,n=e.children,r=zT()&&t!==void 0&&t!==0,i=Kw(),a=(0,w.useRef)(void 0),o=(0,w.useRef)(new Set),s=lb(),c=K(e=>PV(e,t,i));if((0,w.useLayoutEffect)(()=>{if(!r){var e=o.current;e.forEach(e=>{s(qV({zIndex:e}))}),e.clear(),a.current=void 0;return}if(o.current.has(t)||(s(KV({zIndex:t})),o.current.add(t)),c){a.current=c;var n=o.current;n.forEach(e=>{e!==t&&(s(qV({zIndex:e})),n.delete(e))})}},[s,t,r,c]),(0,w.useLayoutEffect)(()=>{var e=o.current;return()=>{e.forEach(e=>{s(qV({zIndex:e}))}),e.clear()}},[s]),!r)return n;var l=c??a.current;return l?(0,bo.createPortal)(n,l):null}function QV(){return QV=Object.assign?Object.assign.bind():function(e){for(var t=1;t(0,w.useContext)(sH),lH=l(o(((e,t)=>{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{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!gg(n))return e[n]}},mH=tC({name:`options`,initialState:{chartName:``,tooltipPayloadSearcher:()=>void 0,eventEmitter:void 0,defaultTooltipEventType:`axis`},reducers:{createEventEmitter:e=>{e.eventEmitter??=Symbol(`rechartsEventEmitter`)}}}),hH=mH.reducer,gH=mH.actions.createEventEmitter;function _H(e){return e.tooltip.syncInteraction}var vH=tC({name:`chartData`,initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=OS(t.payload),t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var n=t.payload,r=n.startIndex,i=n.endIndex;r!=null&&(e.dataStartIndex=r),i!=null&&(e.dataEndIndex=i)}}}),yH=vH.actions,bH=yH.setChartData,xH=yH.setDataStartEndIndexes;yH.setComputedData;var SH=vH.reducer,CH=[`x`,`y`];function wH(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 TH(e){for(var t=1;te.rootProps.className);(0,w.useEffect)(()=>{if(e==null)return Og;var s=(s,c,l)=>{if(t!==l&&e===s){if(c.payload.active===!1){n(qz({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r===`index`){var u;if(o&&c!=null&&(u=c.payload)!=null&&u.coordinate&&c.payload.sourceViewBox){var d=c.payload.coordinate,f=d.x,p=d.y,m=kH(d,CH),h=c.payload.sourceViewBox,g=h.x,_=h.y,v=h.width,y=h.height,b=TH(TH({},m),{},{x:o.x+(v?(f-g)/v:0)*o.width,y:o.y+(y?(p-_)/y:0)*o.height});n(TH(TH({},c),{},{payload:TH(TH({},c.payload),{},{coordinate:b})}))}else n(c);return}if(i!=null){var x;typeof r==`function`?x=i[r(i,{activeTooltipIndex:c.payload.index==null?void 0:Number(c.payload.index),isTooltipActive:c.payload.active,activeIndex:c.payload.index==null?void 0:Number(c.payload.index),activeLabel:c.payload.label,activeDataKey:c.payload.dataKey,activeCoordinate:c.payload.coordinate})]:r===`value`&&(x=i.find(e=>String(e.value)===c.payload.label));var S=c.payload.coordinate;if(S==null||o==null){n(qz({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(x==null){n(qz({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:void 0}));return}var C=S.x,w=S.y,T=Math.min(C,o.x+o.width),E=Math.min(w,o.y+o.height),D={x:a===`horizontal`?x.coordinate:T,y:a===`horizontal`?E:x.coordinate};n(qz({active:c.payload.active,coordinate:D,dataKey:c.payload.dataKey,index:String(x.index),label:c.payload.label,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:c.payload.graphicalItemId}))}}};return uH.on(dH,s),()=>{uH.off(dH,s)}},[s,n,t,e,r,i,a,o])}function MH(){var e=K(RA),t=K(BA),n=lb();(0,w.useEffect)(()=>{if(e==null)return Og;var r=(r,i,a)=>{t!==a&&e===r&&n(xH(i))};return uH.on(fH,r),()=>{uH.off(fH,r)}},[n,t,e])}function NH(){var e=lb();(0,w.useEffect)(()=>{e(gH())},[e]),jH(),MH()}function PH(e,t,n,r,i,a){var o=K(n=>wV(n,e,t)),s=K(ZB),c=K(BA),l=K(RA),u=K(zA),d=K(_H)?.sourceViewBox!=null,f=kT();(0,w.useEffect)(()=>{if(!d&&l!=null&&c!=null){var e=qz({active:a,coordinate:n,dataKey:o,index:i,label:typeof r==`number`?String(r):r,sourceViewBox:f,graphicalItemId:s});uH.emit(dH,l,e,c)}},[d,n,o,s,i,r,c,l,u,a,f])}function FH(){var e=K(RA),t=K(BA),n=K(e=>e.chartData.dataStartIndex),r=K(e=>e.chartData.dataEndIndex);(0,w.useEffect)(()=>{if(e!=null&&n!=null&&r!=null&&t!=null){var i={startIndex:n,endIndex:r};uH.emit(fH,e,i,t)}},[r,n,t,e])}function IH(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 LH(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{x(Bz({shared:g,trigger:_,axisId:b,active:n,defaultIndex:S}))},[x,g,_,b,n,S]);var C=kT(),T=ND(),E=jz(g),D=K(e=>AV(e,E,_,S))??{},O=D.activeIndex,k=D.isActive,A=K(e=>kV(e,E,_,S)),j=K(e=>OV(e,E,_,S)),M=K(e=>DV(e,E,_,S)),N=A,P=cH(),F=n??k??!1,ee=VH(Jb([N,F]),2),te=ee[0],ne=ee[1],re=E===`axis`?j:void 0;PH(E,_,M,re,O,F);var ie=y??P;if(ie==null||C==null||E==null)return null;var I=N??YH;F||(I=YH),s&&I.length&&(I=tb(I.filter(e=>e.value!=null&&(e.hide!==!0||t.includeHidden)),u,qH));var ae=I.length>0,oe=LH(LH({},t),{},{payload:I,label:re,active:F,activeIndex:O,coordinate:M,accessibilityLayer:T}),se=w.createElement(MD,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:c,active:F,coordinate:M,hasPayload:ae,offset:l,position:d,reverseDirection:f,useTranslate3d:p,viewBox:C,wrapperStyle:m,lastBoundingBox:te,innerRef:ne,hasPortalFromProps:!!y},JH(o,oe));return w.createElement(w.Fragment,null,(0,bo.createPortal)(se,ie),F&&w.createElement(oH,{cursor:h,tooltipEventType:E,coordinate:M,payload:I,index:O}))}var QH=e=>null;QH.displayName=`Cell`;function $H(e,t,n){return(t=eU(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eU(e){var t=tU(e,`string`);return typeof t==`symbol`?t:t+``}function tU(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var nU=class{constructor(e){$H(this,`cache`,new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};function rU(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 iU(e){for(var t=1;t{try{var n=document.getElementById(dU);n||(n=document.createElement(`span`),n.setAttribute(`id`,dU),n.setAttribute(`aria-hidden`,`true`),document.body.appendChild(n)),Object.assign(n.style,uU,t),n.textContent=`${e}`;var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},mU=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||dD.isSsr)return{width:0,height:0};if(!cU.enableCache)return pU(e,t);var n=fU(e,t),r=lU.get(n);if(r)return r;var i=pU(e,t);return lU.set(n,i),i},hU;function gU(e,t){return xU(e)||bU(e,t)||vU(e,t)||_U()}function _U(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vU(e,t){if(e){if(typeof e==`string`)return yU(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yU(e,t):void 0}}function yU(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{var t=e.children,n=e.breakAll,r=e.style;try{var i=[];return Tg(t)||(i=n?t.toString().split(``):t.toString().split(QU)),{wordsWithComputedWidth:i.map(e=>({word:e,width:mU(e,r).width})),spaceWidth:n?0:mU(`\xA0`,r).width}}catch{return null}};function eW(e){return e===`start`||e===`middle`||e===`end`||e===`inherit`}function tW(e){return Tg(e)||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}var nW=(e,t,n,r)=>e.reduce((e,i)=>{var a=i.word,o=i.width,s=e[e.length-1];if(s&&o!=null&&(t==null||r||s.width+o+ne.reduce((e,t)=>e.width>t.width?e:t),iW=`…`,aW=(e,t,n,r,i,a,o,s)=>{var c=$U({breakAll:n,style:r,children:e.slice(0,t)+iW});if(!c)return[!1,[]];var l=nW(c.wordsWithComputedWidth,a,o,s);return[l.length>i||rW(l).width>Number(a),l]},oW=(e,t,n,r,i)=>{var a=e.maxLines,o=e.children,s=e.style,c=e.breakAll,l=G(a),u=String(o),d=nW(t,r,n,i);if(!l||i||!(d.length>a||rW(d).width>Number(r)))return d;for(var f=0,p=u.length-1,m=0,h;f<=p&&m<=u.length-1;){var g=Math.floor((f+p)/2),_=KU(aW(u,g-1,c,s,a,r,n,i),2),v=_[0],y=_[1],b=KU(aW(u,g,c,s,a,r,n,i),1)[0];if(!v&&!b&&(f=g+1),v&&b&&(p=g-1),!v&&b){h=y;break}m++}return h||d},sW=e=>[{words:Tg(e)?[]:e.toString().split(QU),width:void 0}],cW=e=>{var t=e.width,n=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,o=e.maxLines;if((t||n)&&!dD.isSsr){var s,c,l=$U({breakAll:a,children:r,style:i});if(l){var u=l.wordsWithComputedWidth,d=l.spaceWidth;s=u,c=d}else return sW(r);return oW({breakAll:a,children:r,maxLines:o,style:i},s,c,t,!!n)}return sW(r)},lW=`#808080`,uW={angle:0,breakAll:!1,capHeight:`0.71em`,fill:lW,lineHeight:`1em`,scaleToFit:!1,textAnchor:`start`,verticalAnchor:`end`,x:0,y:0},dW=(0,w.forwardRef)((e,t)=>{var n=Nv(e,uW),r=n.x,i=n.y,a=n.lineHeight,o=n.capHeight,s=n.fill,c=n.scaleToFit,l=n.textAnchor,u=n.verticalAnchor,d=WU(n,VU),f=(0,w.useMemo)(()=>cW({breakAll:d.breakAll,children:d.children,maxLines:d.maxLines,scaleToFit:c,style:d.style,width:d.width}),[d.breakAll,d.children,d.maxLines,c,d.style,d.width]),p=d.dx,m=d.dy,h=d.angle,g=d.className,_=d.breakAll,v=WU(d,HU);if(!vg(r)||!vg(i)||f.length===0)return null;var y=Number(r)+(G(p)?p:0),b=Number(i)+(G(m)?m:0);if(!ZC(y)||!ZC(b))return null;var x;switch(u){case`start`:x=BU(`calc(${o})`);break;case`middle`:x=BU(`calc(${(f.length-1)/2} * -${a} + (${o} / 2))`);break;default:x=BU(`calc(${f.length-1} * -${a})`)}var S=[],C=f[0];if(c&&C!=null){var T=C.width,E=d.width;S.push(`scale(${G(E)&&G(T)?E/T:1})`)}return h&&S.push(`rotate(${h}, ${y}, ${b})`),S.length&&(v.transform=S.join(` `)),w.createElement(`text`,UU({},Gh(v),{ref:t,x:y,y:b,className:L(`recharts-text`,g),textAnchor:l,fill:s.includes(`url`)?lW:s}),f.map((e,t)=>{var n=e.words.join(_?``:` `);return w.createElement(`tspan`,{x:y,dy:t===0?x:a,key:`${n}-${t}`},n)}))});dW.displayName=`Text`;var fW=[`labelRef`],pW=[`content`];function mW(e,t){if(e==null)return{};var n,r,i=hW(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var t=e.x,n=e.y,r=e.upperWidth,i=e.lowerWidth,a=e.width,o=e.height,s=e.children,c=(0,w.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return w.createElement(SW.Provider,{value:c},s)},wW=()=>{var e=(0,w.useContext)(SW),t=kT();return e||(t?kg(t):void 0)},TW=(0,w.createContext)(null),EW=()=>{var e=(0,w.useContext)(TW),t=K(sj);return e||t},DW=e=>{var t=e.value,n=e.formatter,r=Tg(e.children)?t:e.children;return typeof n==`function`?n(r):r},OW=e=>e!=null&&typeof e==`function`,kW=(e,t)=>hg(t-e)*Math.min(Math.abs(t-e),360),AW=(e,t,n,r,i)=>{var a=e.offset,o=e.className,s=i.cx,c=i.cy,l=i.innerRadius,u=i.outerRadius,d=i.startAngle,f=i.endAngle,p=i.clockWise,m=(l+u)/2,h=kW(d,f),g=h>=0?1:-1,_,v;switch(t){case`insideStart`:_=d+g*a,v=p;break;case`insideEnd`:_=f-g*a,v=!p;break;case`end`:_=f+g*a,v=p;break;default:throw Error(`Unsupported position ${t}`)}v=h<=0?v:!v;var y=Ek(s,c,m,_),b=Ek(s,c,m,_+(v?1:-1)*359),x=`M${y.x},${y.y} + A`,`,`,`,0,0,`,`,`,`,`,`Z`]),D.x,D.y,a,a,+(u<0),E.x,E.y,r,r,+(k>180),+(u>0),S.x,S.y,a,a,+(u<0),C.x,C.y)}else b+=wg(Xk||=Qk([`L`,`,`,`Z`]),t,n);return b},rA={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},iA=e=>{var t=Uv(e,rA),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?nA({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u}):tA({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:l,endAngle:u});return w.createElement(`path`,Zk({},tg(t),{className:f,d:h}))};function aA(e,t,n){if(e===`horizontal`)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if(e===`vertical`)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(Pv(t)){if(e===`centric`){var r=t.cx,i=t.cy,a=t.innerRadius,o=t.outerRadius,s=t.angle,c=Ik(r,i,a,s),l=Ik(r,i,o,s);return[{x:c.x,y:c.y},{x:l.x,y:l.y}]}return Uk(t)}}function oA(e){return gg(e)?NaN:Number(e)}function sA(e){return e?(e=oA(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function cA(e,t,n){n&&typeof n!=`number`&&Lb(e,t,n)&&(t=n=void 0),e=sA(e),t===void 0?(t=e,e=0):t=sA(t),n=n===void 0?ee.chartData,uA=q([lA],e=>{var t=e.chartData==null?0:e.chartData.length-1;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),dA=(e,t,n,r)=>r?uA(e):lA(e),fA=(e,t,n)=>n?uA(e):lA(e),pA=q([dA],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t==null?[]:t.slice(n,r+1)});q([uA],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t==null?[]:t.slice(n,r+1)});var mA=q([lA],e=>{var t=e.chartData,n=e.dataStartIndex,r=e.dataEndIndex;return t==null?[]:t.slice(n,r+1)});function hA(e,t){return bA(e)||yA(e,t)||_A(e,t)||gA()}function gA(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _A(e,t){if(e){if(typeof e==`string`)return vA(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vA(e,t):void 0}}function vA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{(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())}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 EA(e){return e===0?1:Math.floor(new TA.default(e).abs().log(10).toNumber())+1}function DA(e,t,n){for(var r=new TA.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}function OA(e,t){return NA(e)||MA(e,t)||AA(e,t)||kA()}function kA(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function AA(e,t){if(e){if(typeof e==`string`)return jA(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jA(e,t):void 0}}function jA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=OA(e,2),n=t[0],r=t[1],i=n,a=r;return n>r&&(i=r,a=n),[i,a]},FA=(e,t,n)=>{if(e.lte(0))return new TA.default(0);var r=EA(e.toNumber()),i=new TA.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new TA.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?new TA.default(s.toNumber()):new TA.default(Math.ceil(s.toNumber()))},IA=(e,t,n)=>{if(e.lte(0))return new TA.default(0);var r=[1,2,2.5,5],i=e.toNumber(),a=Math.floor(new TA.default(i).abs().log(10).toNumber()),o=new TA.default(10).pow(a),s=e.div(o).toNumber(),c=r.findIndex(e=>e>=s-1e-10);if(c===-1&&(o=o.mul(10),c=0),c+=n,c>=r.length){var l=Math.floor(c/r.length);c%=r.length,o=o.mul(new TA.default(10).pow(l))}var u=r[c]??1,d=new TA.default(u).mul(o);return t?d:new TA.default(Math.ceil(d.toNumber()))},LA=(e,t,n)=>{var r=new TA.default(1),i=new TA.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new TA.default(10).pow(EA(e)-1),i=new TA.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new TA.default(Math.floor(e)))}else e===0?i=new TA.default(Math.floor((t-1)/2)):n||(i=new TA.default(Math.floor(e)));for(var o=Math.floor((t-1)/2),s=[],c=0;c4&&arguments[4]!==void 0?arguments[4]:0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:FA;if(!Number.isFinite((t-e)/(n-1)))return{step:new TA.default(0),tickMin:new TA.default(0),tickMax:new TA.default(0)};var o=a(new TA.default(t).sub(e).div(n-1),r,i),s;e<=0&&t>=0?s=new TA.default(0):(s=new TA.default(e).add(t).div(2),s=s.sub(new TA.default(s).mod(o)));var c=Math.ceil(s.sub(e).div(o).toNumber()),l=Math.ceil(new TA.default(t).sub(s).div(o).toNumber()),u=c+l+1;return u>n?RA(e,t,n,r,i+1,a):(u0?l+(n-u):l,c=t>0?c:c+(n-u)),{step:o,tickMin:s.sub(new TA.default(c).mul(o)),tickMax:s.add(new TA.default(l).mul(o))})},zA=function(e){var t=OA(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=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,s=Math.max(i,2),c=OA(PA([n,r]),2),l=c[0],u=c[1];if(l===-1/0||u===1/0){var d=u===1/0?[l,...Array(i-1).fill(1/0)]:[...Array(i-1).fill(-1/0),u];return n>r?d.reverse():d}if(l===u)return LA(l,i,a);var f=RA(l,u,s,a,0,o===`snap125`?IA:FA),p=f.step,m=f.tickMin,h=f.tickMax,g=DA(m,h.add(new TA.default(.1).mul(p)),p);return n>r?g.reverse():g},BA=function(e,t){var n=OA(e,2),r=n[0],i=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`auto`,s=OA(PA([r,i]),2),c=s[0],l=s[1];if(c===-1/0||l===1/0)return[r,i];if(c===l)return[c];var u=o===`snap125`?IA:FA,d=Math.max(t,2),f=u(new TA.default(l).sub(c).div(d-1),a,0),p=[...DA(new TA.default(c),new TA.default(l),f),l];if(a===!1){p=p.map(e=>Math.round(e));var m=p.length-1;m>0&&p[m]===p[m-1]&&(p=p.slice(0,m))}return r>i?p.reverse():p},VA=e=>e.rootProps.maxBarSize,HA=e=>e.rootProps.barGap,UA=e=>e.rootProps.barCategoryGap,WA=e=>e.rootProps.barSize,GA=e=>e.rootProps.stackOffset,KA=e=>e.rootProps.reverseStackOrder,qA=e=>e.options.chartName,JA=e=>e.rootProps.syncId,YA=e=>e.rootProps.syncMethod,XA=e=>e.options.eventEmitter,ZA={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},QA={allowDecimals:!1,allowDuplicatedCategory:!0,allowDataOverflow:!1,angle:0,angleAxisId:0,axisLine:!0,axisLineType:`polygon`,cx:0,cy:0,hide:!1,includeHidden:!1,label:!1,niceTicks:`auto`,orientation:`outer`,reversed:!1,scale:`auto`,tick:!0,tickLine:!0,tickSize:8,type:`auto`,zIndex:ZA.axis},$A={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,niceTicks:`auto`,label:!1,orientation:`right`,radiusAxisId:0,reversed:!1,scale:`auto`,stroke:`#ccc`,tick:!0,tickCount:5,tickLine:!0,type:`auto`,zIndex:ZA.axis},ej=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function tj(e,t,n){if(n!==`auto`)return n;if(e!=null)return gw(e,t)?`category`:`number`}function nj(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;t{if(t!=null)return e.polarAxis.angleAxis[t]},JT],(e,t)=>{if(e!=null)return e;var n=tj(t,`angleAxis`,sj.type)??`category`;return rj(rj({},sj),{},{type:n})}),uj=q([(e,t)=>e.polarAxis.radiusAxis[t],JT],(e,t)=>{if(e!=null)return e;var n=tj(t,`radiusAxis`,cj.type)??`category`;return rj(rj({},cj),{},{type:n})}),dj=e=>e.polarOptions,fj=q([Fw,Iw,Qw],Lk),pj=q([dj,fj],(e,t)=>{if(e!=null)return jg(e.innerRadius,t,0)}),mj=q([dj,fj],(e,t)=>{if(e!=null)return jg(e.outerRadius,t,t*.8)}),hj=q([dj],e=>e==null?[0,0]:[e.startAngle,e.endAngle]);q([lj,hj],ej);var gj=q([fj,pj,mj],(e,t,n)=>{if(e!=null&&t!=null&&n!=null)return[t,n]});q([uj,gj],ej);var _j=q([GT,dj,pj,mj,Fw,Iw],(e,t,n,r,i,a)=>{if(!(e!==`centric`&&e!==`radial`||t==null||n==null||r==null)){var o=t.cx,s=t.cy,c=t.startAngle,l=t.endAngle;return{cx:jg(o,i,i/2),cy:jg(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:c,endAngle:l,clockWise:!1}}}),vj=(e,t)=>t,yj=(e,t,n)=>n;function bj(e){return e?.id}function xj(e,t,n){var r=t.chartData,i=r===void 0?[]:r,a=n.allowDuplicatedCategory,o=n.dataKey,s=new Map;return e.forEach(e=>{var t=e.data??i;if(t!=null&&t.length!==0){var n=bj(e);t.forEach((t,r)=>{var i=o==null||a?r:String(mw(t,o,null)),c=mw(t,e.dataKey,0),l=s.has(i)?s.get(i):{};Object.assign(l,{[n]:c}),s.set(i,l)})}}),Array.from(s.values())}function Sj(e){return`stackId`in e&&e.stackId!=null&&e.dataKey!=null}var Cj=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function wj(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function Tj(e,t){if(e.length===t.length){for(var n=0;n{var t=GT(e);return t===`horizontal`?`xAxis`:t===`vertical`?`yAxis`:t===`centric`?`angleAxis`:`radiusAxis`},Dj=e=>e.tooltip.settings.axisId;function Oj(e){if(e!=null){var t=e.ticks,n=e.bandwidth,r=e.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>e.domain(),range:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(e){var t=i[0],n=i[1];return t<=n?e>=t&&e<=n:e>=n&&e<=t},bandwidth:n?()=>n.call(e):void 0,ticks:t?n=>t.call(e,n):void 0,map:(t,n)=>{var r=e(t);if(r!=null){if(e.bandwidth&&n!=null&&n.position){var i=e.bandwidth();switch(n.position){case`middle`:r+=i/2;break;case`end`:r+=i}}return r}}}}}var kj=(e,t)=>{if(t!=null)switch(e){case`linear`:if(!xA(t)){for(var n,r,i=0;ir)&&(r=a))}return n!==void 0&&r!==void 0?[n,r]:void 0}return t;default:return t}};function Aj(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function jj(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Mj(e){let t,n,r;e.length===2?(t=e===Aj||e===jj?e:Nj,n=e,r=e):(t=Aj,n=(t,n)=>Aj(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 Nj(){return 0}function Pj(e){return e===null?NaN:+e}function*Fj(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 Ij=Mj(Aj),Lj=Ij.right;Ij.left,Mj(Pj).center;var Rj=class extends Map{constructor(e,t=Hj){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(zj(this,e))}has(e){return super.has(zj(this,e))}set(e,t){return super.set(Bj(this,e),t)}delete(e){return super.delete(Vj(this,e))}};function zj({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function Bj({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Vj({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Hj(e){return typeof e==`object`&&e?e.valueOf():e}function Uj(e=Aj){if(e===Aj)return Wj;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 Wj(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var Gj=Math.sqrt(50),Kj=Math.sqrt(10),qj=Math.sqrt(2);function Jj(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=Gj?10:a>=Kj?5:a>=qj?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 $j(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 eM(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?Wj:Uj(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));eM(e,t,u,d,i)}let a=e[t],o=n,s=r;for(tM(e,n,t),i(e[r],a)>0&&tM(e,n,r);o0;)--s}i(e[n],a)===0?tM(e,n,s):(++s,tM(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function tM(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function nM(e,t,n){if(e=Float64Array.from(Fj(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return $j(e);if(t>=1)return Qj(e);var r,i=(r-1)*t,a=Math.floor(i),o=Qj(eM(e,a).subarray(0,a+1));return o+($j(e.subarray(a+1))-o)*(i-a)}}function rM(e,t,n=Pj){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 iM(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?PM(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?PM(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=xM.exec(e))?new LM(t[1],t[2],t[3],1):(t=SM.exec(e))?new LM(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=CM.exec(e))?PM(t[1],t[2],t[3],t[4]):(t=wM.exec(e))?PM(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=TM.exec(e))?WM(t[1],t[2]/100,t[3]/100,1):(t=EM.exec(e))?WM(t[1],t[2]/100,t[3]/100,t[4]):DM.hasOwnProperty(e)?NM(DM[e]):e===`transparent`?new LM(NaN,NaN,NaN,0):null}function NM(e){return new LM(e>>16&255,e>>8&255,e&255,1)}function PM(e,t,n,r){return r<=0&&(e=t=n=NaN),new LM(e,t,n,r)}function FM(e){return e instanceof mM||(e=MM(e)),e?(e=e.rgb(),new LM(e.r,e.g,e.b,e.opacity)):new LM}function IM(e,t,n,r){return arguments.length===1?FM(e):new LM(e,t,n,r??1)}function LM(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}fM(LM,IM,pM(mM,{brighter(e){return e=e==null?gM:gM**+e,new LM(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?hM:hM**+e,new LM(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new LM(HM(this.r),HM(this.g),HM(this.b),VM(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:RM,formatHex:RM,formatHex8:zM,formatRgb:BM,toString:BM}));function RM(){return`#${UM(this.r)}${UM(this.g)}${UM(this.b)}`}function zM(){return`#${UM(this.r)}${UM(this.g)}${UM(this.b)}${UM((isNaN(this.opacity)?1:this.opacity)*255)}`}function BM(){let e=VM(this.opacity);return`${e===1?`rgb(`:`rgba(`}${HM(this.r)}, ${HM(this.g)}, ${HM(this.b)}${e===1?`)`:`, ${e})`}`}function VM(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function HM(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function UM(e){return e=HM(e),(e<16?`0`:``)+e.toString(16)}function WM(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new qM(e,t,n,r)}function GM(e){if(e instanceof qM)return new qM(e.h,e.s,e.l,e.opacity);if(e instanceof mM||(e=MM(e)),!e)return new qM;if(e instanceof qM)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 qM(o,s,c,e.opacity)}function KM(e,t,n,r){return arguments.length===1?GM(e):new qM(e,t,n,r??1)}function qM(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}fM(qM,KM,pM(mM,{brighter(e){return e=e==null?gM:gM**+e,new qM(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?hM:hM**+e,new qM(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 LM(XM(e>=240?e-240:e+120,i,r),XM(e,i,r),XM(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new qM(JM(this.h),YM(this.s),YM(this.l),VM(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=VM(this.opacity);return`${e===1?`hsl(`:`hsla(`}${JM(this.h)}, ${YM(this.s)*100}%, ${YM(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function JM(e){return e=(e||0)%360,e<0?e+360:e}function YM(e){return Math.max(0,Math.min(1,e||0))}function XM(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 ZM=e=>()=>e;function QM(e,t){return function(n){return e+n*t}}function $M(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function eN(e){return(e=+e)==1?tN:function(t,n){return n-t?$M(t,n,e):ZM(isNaN(t)?n:t)}}function tN(e,t){var n=t-e;return n?QM(e,n):ZM(isNaN(e)?t:e)}var nN=(function e(t){var n=eN(t);function r(e,t){var r=n((e=IM(e)).r,(t=IM(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=tN(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 rN(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:sN(r,i)})),n=uN.lastIndex;return nt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function CN(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?wN:CN,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),sN))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,vN),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=hN,u()},d.clamp=function(e){return arguments.length?(o=e?!0:bN,u()):o!==bN},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 DN(){return EN()(bN,bN)}function ON(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function kN(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 AN(e){return e=kN(Math.abs(e)),e?e[1]:NaN}function jN(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 MN(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var NN=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function PN(e){if(!(t=NN.exec(e)))throw Error(`invalid format: `+e);var t;return new FN({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]})}PN.prototype=FN.prototype;function FN(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+``}FN.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 IN(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}var LN;function RN(e,t){var n=kN(e,t);if(!n)return LN=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(LN=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`)+kN(e,Math.max(0,t+a-1))[0]}function zN(e,t){var n=kN(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 BN={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:ON,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)=>zN(e*100,t),r:zN,s:RN,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function VN(e){return e}var HN=Array.prototype.map,UN=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function WN(e){var t=e.grouping===void 0||e.thousands===void 0?VN:jN(HN.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?VN:MN(HN.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=PN(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`):BN[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=BN[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=IN(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&LN!==void 0?UN[8+LN/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}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(AN(t)/3)))*3,r=10**-n,i=l((e=PN(e),e.type=`f`,e),{suffix:UN[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var GN,KN,qN;JN({thousands:`,`,grouping:[3],currency:[`$`,``]});function JN(e){return GN=WN(e),KN=GN.format,qN=GN.formatPrefix,GN}function YN(e){return Math.max(0,-AN(Math.abs(e)))}function XN(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(AN(t)/3)))*3-AN(Math.abs(e)))}function ZN(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,AN(t)-AN(e))+1}function QN(e,t,n,r){var i=Zj(e,t,n),a;switch(r=PN(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=XN(i,o))&&(r.precision=a),qN(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=ZN(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=YN(i))&&(r.precision=a-(r.type===`%`)*2)}return KN(r)}function $N(e){var t=e.domain;return e.ticks=function(e){var n=t();return Yj(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return QN(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=Xj(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 eP(){var e=DN();return e.copy=function(){return TN(e,eP())},aM.apply(e,arguments),$N(e)}function tP(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,vN),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return tP(e).unknown(t)},e=arguments.length?Array.from(e,vN):[0,1],$N(n)}function nP(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function lP(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 uP(e){return(t,n)=>-e(-t,n)}function dP(e){let t=e(rP,iP),n=t.domain,r=10,i,a;function o(){return i=lP(r),a=cP(r),n()[0]<0?(i=uP(i),a=uP(a),e(aP,oP)):e(rP,iP),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=PN(n)).precision==null&&(n.trim=!0),n=KN(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(nP(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function fP(){let e=dP(EN()).domain([1,10]);return e.copy=()=>TN(e,fP()).base(e.base()),aM.apply(e,arguments),e}function pP(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function mP(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function hP(e){var t=1,n=e(pP(t),mP(t));return n.constant=function(n){return arguments.length?e(pP(t=+n),mP(t)):t},$N(n)}function gP(){var e=hP(EN());return e.copy=function(){return TN(e,gP()).constant(e.constant())},aM.apply(e,arguments)}function _P(e){return function(t){return t<0?-((-t)**+e):t**+e}}function vP(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function yP(e){return e<0?-e*e:e*e}function bP(e){var t=e(bN,bN),n=1;function r(){return n===1?e(bN,bN):n===.5?e(vP,yP):e(_P(n),_P(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},$N(t)}function xP(){var e=bP(EN());return e.copy=function(){return TN(e,xP()).exponent(e.exponent())},aM.apply(e,arguments),e}function SP(){return xP.apply(null,arguments).exponent(.5)}function CP(e){return Math.sign(e)*e*e}function wP(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function TP(){var e=DN(),t=[0,1],n=!1,r;function i(t){var i=wP(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(CP(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,vN)).map(CP)),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 TP(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},aM.apply(i,arguments),$N(i)}function EP(){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 DP().domain([e,t]).range(i).unknown(a)},aM.apply($N(o),arguments)}function OP(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[Lj(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 OP().domain(e).range(t).unknown(n)},aM.apply(i,arguments)}var kP=new Date,AP=new Date;function jP(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(sjP(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)=>(kP.setTime(+t),AP.setTime(+r),e(kP),e(AP),Math.floor(n(kP,AP))),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 MP=jP(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);MP.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?jP(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):MP),MP.range;var NP=1e3,PP=NP*60,FP=PP*60,IP=FP*24,LP=IP*7,RP=IP*30,zP=IP*365,BP=jP(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*NP)},(e,t)=>(t-e)/NP,e=>e.getUTCSeconds());BP.range;var VP=jP(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*NP)},(e,t)=>{e.setTime(+e+t*PP)},(e,t)=>(t-e)/PP,e=>e.getMinutes());VP.range;var HP=jP(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*PP)},(e,t)=>(t-e)/PP,e=>e.getUTCMinutes());HP.range;var UP=jP(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*NP-e.getMinutes()*PP)},(e,t)=>{e.setTime(+e+t*FP)},(e,t)=>(t-e)/FP,e=>e.getHours());UP.range;var WP=jP(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*FP)},(e,t)=>(t-e)/FP,e=>e.getUTCHours());WP.range;var GP=jP(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*PP)/IP,e=>e.getDate()-1);GP.range;var KP=jP(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/IP,e=>e.getUTCDate()-1);KP.range;var qP=jP(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/IP,e=>Math.floor(e/IP));qP.range;function JP(e){return jP(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())*PP)/LP)}var YP=JP(0),XP=JP(1),ZP=JP(2),QP=JP(3),$P=JP(4),eF=JP(5),tF=JP(6);YP.range,XP.range,ZP.range,QP.range,$P.range,eF.range,tF.range;function nF(e){return jP(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)/LP)}var rF=nF(0),iF=nF(1),aF=nF(2),oF=nF(3),sF=nF(4),cF=nF(5),lF=nF(6);rF.range,iF.range,aF.range,oF.range,sF.range,cF.range,lF.range;var uF=jP(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());uF.range;var dF=jP(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());dF.range;var fF=jP(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());fF.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:jP(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)}),fF.range;var pF=jP(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());pF.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:jP(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)}),pF.range;function mF(e,t,n,r,i,a){let o=[[BP,1,NP],[BP,5,5*NP],[BP,15,15*NP],[BP,30,30*NP],[a,1,PP],[a,5,5*PP],[a,15,15*PP],[a,30,30*PP],[i,1,FP],[i,3,3*FP],[i,6,6*FP],[i,12,12*FP],[r,1,IP],[r,2,2*IP],[n,1,LP],[t,1,RP],[t,3,3*RP],[e,1,zP]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(Zj(t/zP,n/zP,r));if(a===0)return MP.every(Math.max(Zj(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=bF(xF(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?iF.ceil(a):iF(a),a=KP.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=yF(xF(r.y,0,1)),o=a.getDay(),a=o>4||o===0?XP.ceil(a):XP(a),a=GP.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?bF(xF(r.y,0,1)).getUTCDay():yF(xF(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,bF(r)):yF(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 CF?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 F(e){return c[e.getMonth()]}function ee(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 I(e){return c[e.getUTCMonth()]}function ae(e){return s[e.getUTCMonth()]}function oe(e){return i[+(e.getUTCHours()>=12)]}function se(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 CF={"-":``,_:` `,0:`0`},wF=/^\s*\d+/,TF=/^%/,EF=/[\\^$*+?|[\]().{}]/g;function DF(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function jF(e,t,n){var r=wF.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function MF(e,t,n){var r=wF.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function NF(e,t,n){var r=wF.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function PF(e,t,n){var r=wF.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function FF(e,t,n){var r=wF.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function IF(e,t,n){var r=wF.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function LF(e,t,n){var r=wF.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function RF(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 zF(e,t,n){var r=wF.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function BF(e,t,n){var r=wF.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function VF(e,t,n){var r=wF.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function HF(e,t,n){var r=wF.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function UF(e,t,n){var r=wF.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function WF(e,t,n){var r=wF.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function GF(e,t,n){var r=wF.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function KF(e,t,n){var r=wF.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function qF(e,t,n){var r=wF.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function JF(e,t,n){var r=TF.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function YF(e,t,n){var r=wF.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function XF(e,t,n){var r=wF.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function ZF(e,t){return DF(e.getDate(),t,2)}function QF(e,t){return DF(e.getHours(),t,2)}function $F(e,t){return DF(e.getHours()%12||12,t,2)}function eI(e,t){return DF(1+GP.count(fF(e),e),t,3)}function tI(e,t){return DF(e.getMilliseconds(),t,3)}function nI(e,t){return tI(e,t)+`000`}function rI(e,t){return DF(e.getMonth()+1,t,2)}function iI(e,t){return DF(e.getMinutes(),t,2)}function aI(e,t){return DF(e.getSeconds(),t,2)}function oI(e){var t=e.getDay();return t===0?7:t}function sI(e,t){return DF(YP.count(fF(e)-1,e),t,2)}function cI(e){var t=e.getDay();return t>=4||t===0?$P(e):$P.ceil(e)}function lI(e,t){return e=cI(e),DF($P.count(fF(e),e)+(fF(e).getDay()===4),t,2)}function uI(e){return e.getDay()}function dI(e,t){return DF(XP.count(fF(e)-1,e),t,2)}function fI(e,t){return DF(e.getFullYear()%100,t,2)}function pI(e,t){return e=cI(e),DF(e.getFullYear()%100,t,2)}function mI(e,t){return DF(e.getFullYear()%1e4,t,4)}function hI(e,t){var n=e.getDay();return e=n>=4||n===0?$P(e):$P.ceil(e),DF(e.getFullYear()%1e4,t,4)}function gI(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+DF(t/60|0,`0`,2)+DF(t%60,`0`,2)}function _I(e,t){return DF(e.getUTCDate(),t,2)}function vI(e,t){return DF(e.getUTCHours(),t,2)}function yI(e,t){return DF(e.getUTCHours()%12||12,t,2)}function bI(e,t){return DF(1+KP.count(pF(e),e),t,3)}function xI(e,t){return DF(e.getUTCMilliseconds(),t,3)}function SI(e,t){return xI(e,t)+`000`}function CI(e,t){return DF(e.getUTCMonth()+1,t,2)}function wI(e,t){return DF(e.getUTCMinutes(),t,2)}function TI(e,t){return DF(e.getUTCSeconds(),t,2)}function EI(e){var t=e.getUTCDay();return t===0?7:t}function DI(e,t){return DF(rF.count(pF(e)-1,e),t,2)}function OI(e){var t=e.getUTCDay();return t>=4||t===0?sF(e):sF.ceil(e)}function kI(e,t){return e=OI(e),DF(sF.count(pF(e),e)+(pF(e).getUTCDay()===4),t,2)}function AI(e){return e.getUTCDay()}function jI(e,t){return DF(iF.count(pF(e)-1,e),t,2)}function MI(e,t){return DF(e.getUTCFullYear()%100,t,2)}function NI(e,t){return e=OI(e),DF(e.getUTCFullYear()%100,t,2)}function PI(e,t){return DF(e.getUTCFullYear()%1e4,t,4)}function FI(e,t){var n=e.getUTCDay();return e=n>=4||n===0?sF(e):sF.ceil(e),DF(e.getUTCFullYear()%1e4,t,4)}function II(){return`+0000`}function LI(){return`%`}function RI(e){return+e}function zI(e){return Math.floor(e/1e3)}var BI,VI,HI;UI({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 UI(e){return BI=SF(e),VI=BI.format,BI.parse,HI=BI.utcFormat,BI.utcParse,BI}function WI(e){return new Date(e)}function GI(e){return e instanceof Date?+e:+new Date(+e)}function KI(e,t,n,r,i,a,o,s,c,l){var u=DN(),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)=>nM(e,r/t))},n.copy=function(){return nL(t).domain(e)},oM.apply(n,arguments)}function rL(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=bN,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*elM,scaleDiverging:()=>iL,scaleDivergingLog:()=>aL,scaleDivergingPow:()=>sL,scaleDivergingSqrt:()=>cL,scaleDivergingSymlog:()=>oL,scaleIdentity:()=>tP,scaleImplicit:()=>sM,scaleLinear:()=>eP,scaleLog:()=>fP,scaleOrdinal:()=>cM,scalePoint:()=>dM,scalePow:()=>xP,scaleQuantile:()=>EP,scaleQuantize:()=>DP,scaleRadial:()=>TP,scaleSequential:()=>ZI,scaleSequentialLog:()=>QI,scaleSequentialPow:()=>eL,scaleSequentialQuantile:()=>nL,scaleSequentialSqrt:()=>tL,scaleSequentialSymlog:()=>$I,scaleSqrt:()=>SP,scaleSymlog:()=>gP,scaleThreshold:()=>OP,scaleTime:()=>qI,scaleUtc:()=>JI,tickFormat:()=>QN});function uL(e){var t=lL;if(e in t&&typeof t[e]==`function`)return t[e]();var n=`scale${Ig(e)}`;if(n in t&&typeof t[n]==`function`)return t[n]()}function dL(e,t,n){if(typeof e==`function`)return e.copy().domain(t).range(n);if(e!=null){var r=uL(e);if(r!=null)return r.domain(t).range(n),r}}function fL(e,t,n,r){if(n!=null&&r!=null)return typeof e.scale==`function`?dL(e.scale,n,r):dL(t,n,r)}function pL(e){return`scale${Ig(e)}`}function mL(e){return pL(e)in lL}var hL=(e,t,n)=>{if(e!=null){var r=e.scale,i=e.type;if(r===`auto`)return i===`category`&&n&&(n.indexOf(`LineChart`)>=0||n.indexOf(`AreaChart`)>=0||n.indexOf(`ComposedChart`)>=0&&!t)?`point`:i===`category`?`band`:`linear`;if(typeof r==`string`)return mL(r)?r:`point`}};function gL(e,t){for(var n=0,r=e.length,i=e[0]t)?n=a+1:r=a}return n}function _L(e,t){if(e){var n=t??e.domain(),r=n.map(t=>e(t)??0),i=e.range();if(!(n.length===0||i.length<2))return e=>{var t=gL(r,e);if(t<=0)return n[0];if(t>=n.length)return n[n.length-1];var i=r[t-1]??0,a=r[t]??0;return Math.abs(e-i)<=Math.abs(e-a)?n[t-1]:n[t]}}}function vL(e){if(e!=null)return`invert`in e&&typeof e.invert==`function`?e.invert.bind(e):_L(e,void 0)}function yL(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;te.length)&&(t=e.length);for(var n=0,r=Array(t);ne.cartesianAxis.xAxis[t],NL=(e,t)=>ML(e,t)??jL,PL={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:AL,hide:!0,id:0,includeHidden:!1,interval:`preserveEnd`,minTickGap:5,mirror:!1,name:void 0,orientation:`left`,padding:{top:0,bottom:0},reversed:!1,scale:`auto`,tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:`number`,unit:void 0,niceTicks:`auto`,width:60},FL=(e,t)=>e.cartesianAxis.yAxis[t],IL=(e,t)=>FL(e,t)??PL,LL={domain:[0,`auto`],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:``,range:[64,64],scale:`auto`,type:`number`,unit:``},RL=(e,t)=>e.cartesianAxis.zAxis[t]??LL,zL=(e,t,n)=>{switch(t){case`xAxis`:return NL(e,n);case`yAxis`:return IL(e,n);case`zAxis`:return RL(e,n);case`angleAxis`:return lj(e,n);case`radiusAxis`:return uj(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},BL=(e,t,n)=>{switch(t){case`xAxis`:return NL(e,n);case`yAxis`:return IL(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},VL=(e,t,n)=>{switch(t){case`xAxis`:return NL(e,n);case`yAxis`:return IL(e,n);case`angleAxis`:return lj(e,n);case`radiusAxis`:return uj(e,n);default:throw Error(`Unexpected axis type: ${t}`)}},HL=e=>e.graphicalItems.cartesianItems.some(e=>e.type===`bar`)||e.graphicalItems.polarItems.some(e=>e.type===`radialBar`);function UL(e,t){return n=>{switch(e){case`xAxis`:return`xAxisId`in n&&n.xAxisId===t;case`yAxis`:return`yAxisId`in n&&n.yAxisId===t;case`zAxis`:return`zAxisId`in n&&n.zAxisId===t;case`angleAxis`:return`angleAxisId`in n&&n.angleAxisId===t;case`radiusAxis`:return`radiusAxisId`in n&&n.radiusAxisId===t;default:return!1}}}var WL=e=>e.graphicalItems.cartesianItems,GL=q([vj,yj],UL),KL=(e,t,n)=>e.filter(n).filter(e=>t?.includeHidden===!0||!e.hide),qL=q([WL,zL,GL],KL,{memoizeOptions:{resultEqualityCheck:wj}}),JL=q([qL],e=>e.filter(e=>e.type===`area`||e.type===`bar`).filter(Sj)),YL=e=>e.filter(e=>!(`stackId`in e)||e.stackId===void 0),XL=q([qL],YL),ZL=e=>e.map(e=>e.data).filter(Boolean).flat(1),QL=q([qL],e=>e.some(e=>!e.data)),$L=q([qL],ZL,{memoizeOptions:{resultEqualityCheck:wj}}),eR=(e,t)=>{var n=t.chartData,r=n===void 0?[]:n,i=t.dataStartIndex,a=t.dataEndIndex;return e.length>0?e:r.slice(i,a+1)},tR=q([$L,dA],eR),nR=(e,t,n)=>t?.dataKey==null?n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:mw(e,t)}))):e.map(e=>({value:e})):e.map(e=>({value:mw(e,t.dataKey)})),rR=(e,t,n,r,i,a)=>{var o=r.chartData,s=o===void 0?[]:o,c=r.dataStartIndex,l=r.dataEndIndex,u=nR(e,t,n);return i&&t?.dataKey!=null&&a.length>0?[...s.slice(c,l+1).map(e=>({value:mw(e,t.dataKey)})).filter(e=>e.value!=null),...u]:u},iR=q([tR,zL,qL,dA,QL,$L],rR);function aR(e){if(Og(e)||e instanceof Date){var t=Number(e);if(sw(t))return t}}function oR(e){if(Array.isArray(e)){var t=[aR(e[0]),aR(e[1])];return xA(t)?t:void 0}var n=aR(e);if(n!=null)return[n,n]}function sR(e){return e.map(aR).filter(Lg)}function cR(e,t){var n=aR(e),r=aR(t);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var lR=q([iR],e=>e?.map(e=>e.value).sort(cR));function uR(e,t){switch(e){case`xAxis`:return t.direction===`x`;case`yAxis`:return t.direction===`y`;default:return!1}}function dR(e,t,n){if(!n||!n.length)return[];var r;if(typeof t==`number`&&!Eg(t))r=t;else if(Array.isArray(t)){var i=sR(t);i.length>0&&(r=Math.max(...i))}return r==null?[]:sR(n.flatMap(t=>{var n=mw(e,t.dataKey),i,a;if(Array.isArray(n)){var o=wL(n,2);i=o[0],a=o[1]}else i=a=n;if(!(!sw(i)||!sw(a)))return[r-i,r+a]}))}var fR=e=>VL(e,Ej(e),Dj(e)),pR=q([fR],e=>e?.dataKey),mR=q([JL,dA,fR],xj),hR=(e,t,n,r)=>{var i=t.reduce((e,t)=>{if(t.stackId==null)return e;var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},{});return Object.fromEntries(Object.entries(i).map(t=>{var i=wL(t,2),a=i[0],o=i[1],s=r?[...o].reverse():o;return[a,{stackedData:xw(e,s.map(bj),n),graphicalItems:s}]}))},gR=q([mR,JL,GA,KA],hR),_R=(e,t,n,r)=>{var i=t.dataStartIndex,a=t.dataEndIndex;if(r==null&&n!==`zAxis`)return Dw(e,i,a)},vR=q([zL],e=>e.allowDataOverflow),yR=e=>{if(e==null||!(`domain`in e))return AL;if(e.domain!=null)return e.domain;if(`ticks`in e&&e.ticks!=null){if(e.type===`number`){var t=sR(e.ticks);return[Math.min(...t),Math.max(...t)]}if(e.type===`category`)return e.ticks.map(String)}return e?.domain??AL},bR=q([zL],yR),xR=q([bR,vR],CA),SR=q([gR,lA,vj,xR],_R,{memoizeOptions:{resultEqualityCheck:Cj}}),CR=e=>e.errorBars,wR=(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>uR(n,e)),TR=function(){var e=[...arguments].filter(Boolean);if(e.length!==0){var t=e.flat();return[Math.min(...t),Math.max(...t)]}},ER=function(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],o,s;if(n.length>0&&n.forEach(e=>{var n=e.data==null?a:[...e.data],c=r[e.id]?.filter(e=>uR(i,e));n.forEach(n=>{var r=mw(n,t.dataKey??e.dataKey),i=dR(n,r,c);if(i.length>=2){var a=Math.min(...i),l=Math.max(...i);(o==null||as)&&(s=l)}var u=oR(r);u!=null&&(o=o==null?u[0]:Math.min(o,u[0]),s=s==null?u[1]:Math.max(s,u[1]))})}),t?.dataKey!=null&&n.length===0&&e.forEach(e=>{var n=oR(mw(e,t.dataKey));n!=null&&(o=o==null?n[0]:Math.min(o,n[0]),s=s==null?n[1]:Math.max(s,n[1]))}),sw(o)&&sw(s))return[o,s]},DR=q([tR,zL,XL,CR,vj,pA],ER,{memoizeOptions:{resultEqualityCheck:Cj}});function OR(e){var t=e.value;if(Og(t)||t instanceof Date)return t}var kR=(e,t,n)=>{var r=e.map(OR).filter(e=>e!=null);return n&&(t.dataKey==null||t.allowDuplicatedCategory&&Mg(r))?cA(0,e.length):t.allowDuplicatedCategory?r:Array.from(new Set(r))},AR=e=>e.referenceElements.dots,jR=(e,t,n)=>e.filter(e=>e.ifOverflow===`extendDomain`).filter(e=>t===`xAxis`?e.xAxisId===n:e.yAxisId===n),MR=q([AR,vj,yj],jR),NR=e=>e.referenceElements.areas,PR=q([NR,vj,yj],jR),FR=e=>e.referenceElements.lines,IR=q([FR,vj,yj],jR),LR=(e,t)=>{if(e!=null){var n=sR(e.map(e=>t===`xAxis`?e.x:e.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},RR=q(MR,vj,LR),zR=(e,t)=>{if(e!=null){var n=sR(e.flatMap(e=>[t===`xAxis`?e.x1:e.y1,t===`xAxis`?e.x2:e.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},BR=q([PR,vj],zR);function VR(e){if(e.x!=null)return sR([e.x]);var t=e.segment?.map(e=>e.x);return t==null||t.length===0?[]:sR(t)}function HR(e){if(e.y!=null)return sR([e.y]);var t=e.segment?.map(e=>e.y);return t==null||t.length===0?[]:sR(t)}var UR=(e,t)=>{if(e!=null){var n=e.flatMap(e=>t===`xAxis`?VR(e):HR(e));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},WR=q(RR,q([IR,vj],UR),BR,(e,t,n)=>TR(e,n,t)),GR=(e,t,n,r,i,a,o,s,c)=>{if(n!=null)return n;var l=o===`vertical`&&s===`xAxis`||o===`horizontal`&&s===`yAxis`?TR(r,a,i):TR(a,i),u=wA(t,l,e.allowDataOverflow);return u==null&&e.allowDataOverflow&&l==null&&c!=null?c:u},KR=q([zL,bR,xR,SR,DR,WR,GT,vj,q([zL],e=>{if(!(e==null||e.type!==`number`||!(`ticks`in e)||e.ticks==null)){var t=sR(e.ticks);if(t.length!==0)return[Math.min(...t),Math.max(...t)]}},{memoizeOptions:{resultEqualityCheck:Cj}})],GR,{memoizeOptions:{resultEqualityCheck:Cj}}),qR=[0,1],JR=(e,t,n,r,i,a,o)=>{if(e!=null&&n!=null&&n.length!==0||o!==void 0){var s=e.dataKey,c=e.type,l=gw(t,a);return l&&s==null?cA(0,n?.length??0):c===`category`?kR(r,e,l):i===`expand`&&!l?qR:o}},YR=q([zL,GT,tR,iR,GA,vj,KR],JR),XR=q([zL,HL,qA],hL),ZR=(e,t,n)=>{var r=t.niceTicks;if(r!==`none`){var i=yR(t),a=Array.isArray(i)&&(i[0]===`auto`||i[1]===`auto`);if((r===`snap125`||r===`adaptive`)&&t!=null&&t.tickCount&&xA(e)){if(a)return zA(e,t.tickCount,t.allowDecimals,r);if(t.type===`number`)return BA(e,t.tickCount,t.allowDecimals,r)}if(r===`auto`&&n===`linear`&&t!=null&&t.tickCount){if(a&&xA(e))return zA(e,t.tickCount,t.allowDecimals,`adaptive`);if(t.type===`number`&&xA(e))return BA(e,t.tickCount,t.allowDecimals,`adaptive`)}}},QR=q([YR,VL,XR],ZR),$R=(e,t,n,r)=>{if(r!==`angleAxis`&&e?.type===`number`&&xA(t)&&Array.isArray(n)&&n.length>0){var i=t[0],a=n[0]??0,o=t[1],s=n[n.length-1]??0;return[Math.min(i,a),Math.max(o,s)]}return t},ez=q([zL,YR,QR,vj],$R),tz=q(q(iR,zL,(e,t)=>{if(!(!t||t.type!==`number`)){var n=1/0,r=Array.from(sR(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(i==null||a==null)return 1/0;var o=a-i;if(o===0)return 1/0;for(var s=0;si,(e,t,n,r,i)=>{if(!sw(e))return 0;var a=t===`vertical`?r.height:r.width;if(i===`gap`)return e*a/2;if(i===`no-gap`){var o=jg(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),nz=(e,t,n)=>{var r=NL(e,t);return r==null||typeof r.padding!=`string`?0:tz(e,`xAxis`,t,n,r.padding)},rz=(e,t,n)=>{var r=IL(e,t);return r==null||typeof r.padding!=`string`?0:tz(e,`yAxis`,t,n,r.padding)},iz=q(NL,nz,(e,t)=>{if(e==null)return{left:0,right:0};var n=e.padding;return typeof n==`string`?{left:t,right:t}:{left:(n.left??0)+t,right:(n.right??0)+t}}),az=q(IL,rz,(e,t)=>{if(e==null)return{top:0,bottom:0};var n=e.padding;return typeof n==`string`?{top:t,bottom:t}:{top:(n.top??0)+t,bottom:(n.bottom??0)+t}}),oz=q([Qw,iz,aT,iT,(e,t,n)=>n],(e,t,n,r,i)=>{var a=r.padding;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),sz=q([Qw,GT,az,aT,iT,(e,t,n)=>n],(e,t,n,r,i,a)=>{var o=i.padding;return a?[r.height-o.bottom,o.top]:t===`horizontal`?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),cz=(e,t,n,r)=>{switch(t){case`xAxis`:return oz(e,n,r);case`yAxis`:return sz(e,n,r);case`zAxis`:return RL(e,n)?.range;case`angleAxis`:return hj(e);case`radiusAxis`:return gj(e,n);default:return}},lz=q([zL,cz],ej),uz=q([zL,XR,q([XR,ez],kj),lz],fL),dz=(e,t,n,r)=>{if(n!=null&&n.dataKey!=null){var i=n.type,a=n.scale;if(gw(e,r)&&(i===`number`||a!==`auto`))return t.map(e=>e.value)}},fz=q([GT,iR,VL,vj],dz),pz=q([uz],Oj);q([uz],vL),q([uz,lR],_L),q([qL,CR,vj],wR);function mz(e,t){return e.idt.id)}var hz=(e,t)=>t,gz=(e,t,n)=>n,_z=q(zw,hz,gz,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(mz)),vz=q(Bw,hz,gz,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(mz)),yz=(e,t)=>{var n=typeof t.height==`number`?t.height:30;return{width:e.width,height:n}},bz=(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height}),xz=q(Qw,NL,yz),Sz=(e,t,n)=>{switch(t){case`top`:return e.top;case`bottom`:return n-e.bottom;default:return 0}},Cz=(e,t,n)=>{switch(t){case`left`:return e.left;case`right`:return n-e.right;default:return 0}},wz=q(Iw,Qw,_z,hz,gz,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=yz(t,n);o??=Sz(t,r,e);var c=r===`top`&&!i||r===`bottom`&&i;a[n.id]=o-Number(c)*s.height,o+=(c?-1:1)*s.height}),a}),Tz=q(Fw,Qw,vz,hz,gz,(e,t,n,r,i)=>{var a={},o;return n.forEach(n=>{var s=bz(t,n);o??=Cz(t,r,e);var c=r===`left`&&!i||r===`right`&&i;a[n.id]=o-Number(c)*s.width,o+=(c?-1:1)*s.width}),a}),Ez=q([Qw,NL,(e,t)=>{var n=NL(e,t);if(n!=null)return wz(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:e.left,y:0}:{x:e.left,y:i}}}),Dz=q([Qw,IL,(e,t)=>{var n=IL(e,t);if(n!=null)return Tz(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(t!=null){var i=n?.[r];return i==null?{x:0,y:e.top}:{x:i,y:e.top}}}),Oz=q(Qw,IL,(e,t)=>({width:typeof t.width==`number`?t.width:60,height:e.height})),kz=(e,t,n)=>{switch(t){case`xAxis`:return xz(e,n).width;case`yAxis`:return Oz(e,n).height;default:return}},Az=(e,t,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,a=n.type,o=n.dataKey,s=gw(e,r),c=t.map(e=>e.value),l=c.filter(e=>e!=null);if(o&&s&&a===`category`&&i&&Mg(l))return c}},jz=q([GT,iR,zL,vj],Az),Mz=q([GT,BL,XR,pz,jz,fz,cz,QR,vj],(e,t,n,r,i,a,o,s,c)=>{if(t!=null){var l=gw(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:a,duplicateDomain:i,isCategorical:l,niceTicks:s,range:o,realScaleType:n,scale:r}}}),Nz=q([GT,VL,XR,pz,QR,cz,jz,fz,vj],(e,t,n,r,i,a,o,s,c)=>{if(t!=null&&r!=null){var l=gw(e,c),u=t.type,d=t.ticks,f=t.tickCount,p=n===`scaleBand`&&typeof r.bandwidth==`function`?r.bandwidth()/2:2,m=u===`category`&&r.bandwidth?r.bandwidth()/p:0;m=c===`angleAxis`&&a!=null&&a.length>=2?Tg(a[0]-a[1])*2*m:m;var h=d||i;return h?h.map((e,t)=>{var n=o?o.indexOf(e):e,i=r.map(n);return sw(i)?{index:t,coordinate:i+m,value:e,offset:m}:null}).filter(Lg):l&&s?s.map((e,t)=>{var n=r.map(e);return sw(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(Lg):r.ticks?r.ticks(f).map((e,t)=>{var n=r.map(e);return sw(n)?{coordinate:n+m,value:e,index:t,offset:m}:null}).filter(Lg):r.domain().map((e,t)=>{var n=r.map(e);return sw(n)?{coordinate:n+m,value:o?o[e]:e,index:t,offset:m}:null}).filter(Lg)}}),Pz=q([GT,VL,pz,cz,jz,fz,vj],(e,t,n,r,i,a,o)=>{if(t!=null&&n!=null&&r!=null&&r[0]!==r[1]){var s=gw(e,o),c=t.tickCount,l=0;return l=o===`angleAxis`&&r?.length>=2?Tg(r[0]-r[1])*2*l:l,s&&a?a.map((e,t)=>{var r=n.map(e);return sw(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(Lg):n.ticks?n.ticks(c).map((e,t)=>{var r=n.map(e);return sw(r)?{coordinate:r+l,value:e,index:t,offset:l}:null}).filter(Lg):n.domain().map((e,t)=>{var r=n.map(e);return sw(r)?{coordinate:r+l,value:i?i[e]:e,index:t,offset:l}:null}).filter(Lg)}}),Fz=q(zL,pz,(e,t)=>{if(e!=null&&t!=null)return bL(bL({},e),{},{scale:t})});q((e,t,n)=>RL(e,n),q([q([zL,XR,YR,lz],fL)],Oj),(e,t)=>{if(e!=null&&t!=null)return bL(bL({},e),{},{scale:t})});var Iz=q([GT,zw,Bw],(e,t,n)=>{switch(e){case`horizontal`:return t.some(e=>e.reversed)?`right-to-left`:`left-to-right`;case`vertical`:return n.some(e=>e.reversed)?`bottom-to-top`:`top-to-bottom`;case`centric`:case`radial`:return`left-to-right`;default:return}});q([(e,t,n)=>e.renderedTicks[t]?.[n]],e=>{if(!(!e||e.length===0))return t=>{var n=1/0,r=e[0];for(var i of e){var a=Math.abs(i.coordinate-t);ae.options.defaultTooltipEventType,Rz=e=>e.options.validateTooltipEventTypes;function zz(e,t,n){if(e==null)return t;var r=e?`axis`:`item`;return n==null?t:n.includes(r)?r:t}function Bz(e,t){return zz(t,Lz(e),Rz(e))}function Vz(e){return K(t=>Bz(t,e))}var Hz=(e,t)=>{var n,r=Number(t);if(!(Eg(r)||t==null))return r>=0?e==null||(n=e[r])==null?void 0:n.value:void 0},Uz=e=>e.tooltip.settings,Wz={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Gz=dC({name:`tooltip`,initialState:{itemInteraction:{click:Wz,hover:Wz},axisInteraction:{click:Wz,hover:Wz},keyboardInteraction:Wz,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:`hover`,axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(RS(t.payload))},prepare:XS()},replaceTooltipEntrySettings:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=FS(e).tooltipItemPayloads.indexOf(RS(r));a>-1&&(e.tooltipItemPayloads[a]=RS(i))},prepare:XS()},removeTooltipEntrySettings:{reducer(e,t){var n=FS(e).tooltipItemPayloads.indexOf(RS(t.payload));n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:XS()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),Kz=Gz.actions,qz=Kz.addTooltipEntrySettings,Jz=Kz.replaceTooltipEntrySettings,Yz=Kz.removeTooltipEntrySettings,Xz=Kz.setTooltipSettingsState,Zz=Kz.setActiveMouseOverItemIndex,Qz=Kz.mouseLeaveItem,$z=Kz.mouseLeaveChart,eB=Kz.setActiveClickItemIndex,tB=Kz.setMouseOverAxisIndex,nB=Kz.setMouseClickAxisIndex,rB=Kz.setSyncInteraction,iB=Kz.setKeyboardInteraction,aB=Gz.reducer;function oB(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 sB(e){for(var t=1;t{if(t==null)return Wz;var i=dB(e,t,n);if(i==null)return Wz;if(i.active)return i;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var a=e.settings.active===!0;if(fB(i)){if(a)return sB(sB({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return sB(sB({},Wz),{},{coordinate:i.coordinate})};function mB(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}function hB(e,t){var n=mB(e),r=t[0],i=t[1];return n!==void 0&&n>=Math.min(r,i)&&n<=Math.max(r,i)}function gB(e,t,n){if(n==null||t==null)return!0;var r=mw(e,t);return r==null||!xA(n)||hB(r,n)}var _B=(e,t,n,r)=>{var i=e?.index;if(i==null)return null;var a=Number(i);if(!sw(a))return i;var o=0,s=1/0;t.length>0&&(s=t.length-1);var c=Math.max(o,Math.min(a,s)),l=t[c];return l==null||gB(l,n,r)?String(c):null},vB=(e,t,n,r,i,a,o)=>{if(a!=null){var s=o[0]?.getPosition(a);if(s!=null)return s;var c=i?.[Number(a)];if(c)switch(n){case`horizontal`:return{x:c.coordinate,y:(r.top+t)/2};default:return{x:(r.left+e)/2,y:c.coordinate}}}},yB=(e,t,n,r)=>{if(t===`axis`)return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var i=n===`hover`?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId;if(e.syncInteraction.active&&i==null)return e.tooltipItemPayloads;if(i==null&&(r!=null||e.keyboardInteraction.active)){var a=e.tooltipItemPayloads[0];return a==null?[]:[a]}return e.tooltipItemPayloads.filter(e=>e.settings?.graphicalItemId===i)},bB=e=>e.options.tooltipPayloadSearcher,xB=e=>e.tooltip;function SB(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 CB(e){for(var t=1;te(t)}function AB(e){if(typeof e==`string`)return e}function jB(e){if(!(typeof e!=`object`||!e))return{name:`name`in e?DB(e.name):void 0,unit:`unit`in e?OB(e.unit):void 0,dataKey:`dataKey`in e?kB(e.dataKey):void 0,payload:`payload`in e?e.payload:void 0,color:`color`in e?AB(e.color):void 0,fill:`fill`in e?AB(e.fill):void 0}}function MB(e,t){return e??t}var NB=(e,t,n,r,i,a,o)=>{if(t!=null&&a!=null){var s=n.chartData,c=n.computedData,l=n.dataStartIndex,u=n.dataEndIndex;return e.reduce((e,n)=>{var d=n.dataDefinedOnItem,f=n.settings,p=MB(d,s),m=Array.isArray(p)?ow(p,l,u):p,h=f?.dataKey??r,g=f?.nameKey,_;return r&&Array.isArray(m)&&!Array.isArray(m[0])&&o===`axis`?(_=Pg(m,r,i),_??=a(m,t,c,g)):_=a(m,t,c,g),Array.isArray(_)?_.forEach(t=>{var n=jB(t),r=n?.name,i=n?.dataKey,a=n?.payload,o=CB(CB({},f),{},{name:r,unit:n?.unit,color:n?.color??f?.color,fill:n?.fill??f?.fill});e.push(jw({tooltipEntrySettings:o,dataKey:i,payload:a,value:mw(a,i),name:r==null?void 0:String(r)}))}):e.push(jw({tooltipEntrySettings:f,dataKey:h,payload:_,value:mw(_,h),name:mw(_,g)??f?.name})),e},[])}},PB=q([fR,HL,qA],hL),FB=q([q([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),fR,q([Ej,Dj],UL)],KL,{memoizeOptions:{resultEqualityCheck:wj}}),IB=q([FB],e=>e.filter(Sj)),LB=q([FB],ZL,{memoizeOptions:{resultEqualityCheck:wj}}),RB=q([FB],e=>e.some(e=>!e.data)),zB=q([LB,lA],eR),BB=q([IB,lA,fR],xj),VB=q([zB,fR,FB,lA,RB,LB],rR),HB=q([fR],yR),UB=q([HB,q([fR],e=>e.allowDataOverflow)],CA),WB=q([q([BB,q([FB],e=>e.filter(Sj)),GA,KA],hR),lA,Ej,UB],_R),GB=q([zB,fR,q([FB],YL),CR,Ej,mA],ER,{memoizeOptions:{resultEqualityCheck:Cj}}),KB=q([q([AR,Ej,Dj],jR),Ej],LR),qB=q([q([NR,Ej,Dj],jR),Ej],zR),JB=q([fR,GT,zB,VB,GA,Ej,q([fR,HB,UB,WB,GB,q([KB,q([q([FR,Ej,Dj],jR),Ej],UR),qB],TR),GT,Ej],GR)],JR),YB=q([fR,JB,q([JB,fR,PB],ZR),Ej],$R),XB=e=>cz(e,Ej(e),Dj(e),!1),ZB=q([fR,XB],ej),QB=q([q([fR,PB,YB,ZB],fL)],Oj),$B=q([GT,fR,PB,QB,XB,q([GT,VB,fR,Ej],Az),q([GT,VB,fR,Ej],dz),Ej],(e,t,n,r,i,a,o,s)=>{if(t){var c=t.type,l=gw(e,s);if(r){var u=n===`scaleBand`&&r.bandwidth?r.bandwidth()/2:2,d=c===`category`&&r.bandwidth?r.bandwidth()/u:0;return d=s===`angleAxis`&&i!=null&&i?.length>=2?Tg(i[0]-i[1])*2*d:d,l&&o?o.map((e,t)=>{var n=r.map(e);return sw(n)?{coordinate:n+d,value:e,index:t,offset:d}:null}).filter(Lg):r.domain().map((e,t)=>{var n=r.map(e);return sw(n)?{coordinate:n+d,value:a?a[e]:e,index:t,offset:d}:null}).filter(Lg)}}}),eV=q([Lz,Rz,Uz],(e,t,n)=>zz(n.shared,e,t)),tV=e=>e.tooltip.settings.trigger,nV=e=>e.tooltip.settings.defaultIndex,rV=q([xB,eV,tV,nV],pB),iV=q([rV,zB,pR,JB],_B),aV=q([$B,iV],Hz),oV=q([rV],e=>{if(e)return e.dataKey}),sV=q([rV],e=>{if(e)return e.graphicalItemId}),cV=q([xB,eV,tV,nV],yB),lV=q([rV,q([Fw,Iw,GT,Qw,$B,nV,cV],vB)],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),uV=q([rV],e=>e?.active??!1);q([q([cV,iV,lA,pR,aV,bB,eV],NB)],e=>{if(e!=null){var t=e.map(e=>e.payload).filter(e=>e!=null);return Array.from(new Set(t))}});function dV(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 fV(e){for(var t=1;tK(fR),_V=()=>{var e=gV(),t=K($B),n=K(QB);return Aw(!e||!n?void 0:fV(fV({},e),{},{scale:n}),t)};function vV(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 yV(e){for(var t=1;t{var i=t.find(e=>e&&e.index===n);if(i){if(e===`horizontal`)return{x:i.coordinate,y:r.relativeY};if(e===`vertical`)return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},wV=(e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if(e===`centric`){var a=i.coordinate,o=r.radius;return yV(yV(yV({},r),Ik(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,c=r.angle;return yV(yV(yV({},r),Ik(r.cx,r.cy,s,c)),{},{angle:c,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function TV(e,t){var n=e.relativeX,r=e.relativeY;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}var EV=(e,t,n,r,i)=>{var a=t?.length??0;if(a<=1||e==null)return 0;if(r===`angleAxis`&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var o=i[1]-i[0],s=(t,n,r)=>[e,e+o,e-o].some(e=>(r?e>=t:e>t)&&e<=n),c=0;c0?n[c-1]?.coordinate:n[a-1]?.coordinate,u=n[c]?.coordinate,d=c>=a-1?n[0]?.coordinate:n[c+1]?.coordinate,f=void 0;if(l!=null&&u!=null&&d!=null){if(Tg(u-l)!==Tg(d-u)){var p=[];if(Tg(d-u)===Tg(i[1]-i[0])){f=d;var m=u+i[1]-i[0];p[0]=Math.min(m,(m+l)/2),p[1]=Math.max(m,(m+l)/2)}else{f=l;var h=d+i[1]-i[0];p[0]=Math.min(u,(h+u)/2),p[1]=Math.max(u,(h+u)/2)}var g=[Math.min(u,(f+u)/2),Math.max(u,(f+u)/2)];if(s(g[0],g[1],!1)||s(p[0],p[1],!0))return n[c]?.index}else{var _=Math.min(l,d),v=Math.max(l,d);if(s((_+u)/2,(v+u)/2,!1))return n[c]?.index}}}else if(t)for(var y=0;y(b.coordinate+S.coordinate)/2||y>0&&y(b.coordinate+S.coordinate)/2&&e<=(b.coordinate+x.coordinate)/2)return b.index}}return-1},DV=()=>K(qA),OV=(e,t)=>t,kV=(e,t,n)=>n,AV=(e,t,n,r)=>r,jV=q($B,e=>Wb(e,e=>e.coordinate)),MV=q([xB,OV,kV,AV],pB),NV=q([MV,zB,pR,JB],_B),PV=(e,t,n)=>{if(t!=null){var r=xB(e);return t===`axis`?n===`hover`?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n===`hover`?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},FV=q([xB,OV,kV,AV],yB),IV=q([Fw,Iw,GT,Qw,$B,AV,FV],vB),LV=q([MV,IV],(e,t)=>e.coordinate??t),RV=q([$B,NV],Hz),zV=q([FV,NV,lA,pR,RV,bB,OV],NB),BV=q([MV,NV],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),VV=(e,t,n,r,i,a,o)=>{if(!(!e||!n||!r||!i)&&TV(e,o)){var s=EV(Nw(e,t),a,i,n,r),c=CV(t,i,s,e);return{activeIndex:String(s),activeCoordinate:c}}},HV=(e,t,n,r,i,a,o)=>{if(!(!e||!r||!i||!a||!n)){var s=Hk(e,n);if(s){var c=EV(Pw(s,t),o,a,r,i),l=wV(t,a,c,s);return{activeIndex:String(c),activeCoordinate:l}}}},UV=(e,t,n,r,i,a,o,s)=>{if(!(!e||!t||!r||!i||!a))return t===`horizontal`||t===`vertical`?VV(e,t,r,i,a,o,s):HV(e,t,n,r,i,a,o)},WV=q(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(t!=null){var r=e[t];if(r!=null)return n?r.panoramaElement:r.element}}),GV=q(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(ZA));return Array.from(new Set(t)).sort((e,t)=>e-t)},{memoizeOptions:{resultEqualityCheck:Tj}});function KV(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 qV(e){for(var t=1;tqV(qV({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},QV=new Set(Object.values(ZA));function $V(e){return QV.has(e)}var eH=dC({name:`zIndex`,initialState:ZV,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:XS()},unregisterZIndexPortal:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]&&(--e.zIndexMap[n].consumers,e.zIndexMap[n].consumers<=0&&!$V(n)&&delete e.zIndexMap[n])},prepare:XS()},registerZIndexPortalElement:{reducer:(e,t)=>{var n=t.payload,r=n.zIndex,i=n.element,a=n.isPanorama;e.zIndexMap[r]?a?e.zIndexMap[r].panoramaElement=RS(i):e.zIndexMap[r].element=RS(i):e.zIndexMap[r]={consumers:0,element:a?void 0:RS(i),panoramaElement:a?RS(i):void 0}},prepare:XS()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var n=t.payload.zIndex;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:XS()}}}),tH=eH.actions,nH=tH.registerZIndexPortal,rH=tH.unregisterZIndexPortal,iH=tH.registerZIndexPortalElement,aH=tH.unregisterZIndexPortalElement,oH=eH.reducer;function sH(e){var t=e.zIndex,n=e.children,r=YT()&&t!==void 0&&t!==0,i=nT(),a=(0,w.useRef)(void 0),o=(0,w.useRef)(new Set),s=yb(),c=K(e=>WV(e,t,i));if((0,w.useLayoutEffect)(()=>{if(!r){var e=o.current;e.forEach(e=>{s(rH({zIndex:e}))}),e.clear(),a.current=void 0;return}if(o.current.has(t)||(s(nH({zIndex:t})),o.current.add(t)),c){a.current=c;var n=o.current;n.forEach(e=>{e!==t&&(s(rH({zIndex:e})),n.delete(e))})}},[s,t,r,c]),(0,w.useLayoutEffect)(()=>{var e=o.current;return()=>{e.forEach(e=>{s(rH({zIndex:e}))}),e.clear()}},[s]),!r)return n;var l=c??a.current;return l?(0,bo.createPortal)(n,l):null}function cH(){return cH=Object.assign?Object.assign.bind():function(e){for(var t=1;t(0,w.useContext)(_H),yH=l(o(((e,t)=>{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{if(t&&Array.isArray(e)){var n=Number.parseInt(t,10);if(!Eg(n))return e[n]}},wH=dC({name:`options`,initialState:{chartName:``,tooltipPayloadSearcher:()=>void 0,eventEmitter:void 0,defaultTooltipEventType:`axis`},reducers:{createEventEmitter:e=>{e.eventEmitter??=Symbol(`rechartsEventEmitter`)}}}),TH=wH.reducer,EH=wH.actions.createEventEmitter;function DH(e){return e.tooltip.syncInteraction}var OH=dC({name:`chartData`,initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=RS(t.payload),t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var n=t.payload,r=n.startIndex,i=n.endIndex;r!=null&&(e.dataStartIndex=r),i!=null&&(e.dataEndIndex=i)}}}),kH=OH.actions,AH=kH.setChartData,jH=kH.setDataStartEndIndexes;kH.setComputedData;var MH=OH.reducer,NH=[`x`,`y`];function PH(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 FH(e){for(var t=1;te.rootProps.className);(0,w.useEffect)(()=>{if(e==null)return Rg;var s=(s,c,l)=>{if(t!==l&&e===s){if(c.payload.active===!1){n(rB({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r===`index`){var u;if(o&&c!=null&&(u=c.payload)!=null&&u.coordinate&&c.payload.sourceViewBox){var d=c.payload.coordinate,f=d.x,p=d.y,m=zH(d,NH),h=c.payload.sourceViewBox,g=h.x,_=h.y,v=h.width,y=h.height,b=FH(FH({},m),{},{x:o.x+(v?(f-g)/v:0)*o.width,y:o.y+(y?(p-_)/y:0)*o.height});n(FH(FH({},c),{},{payload:FH(FH({},c.payload),{},{coordinate:b})}))}else n(c);return}if(i!=null){var x;typeof r==`function`?x=i[r(i,{activeTooltipIndex:c.payload.index==null?void 0:Number(c.payload.index),isTooltipActive:c.payload.active,activeIndex:c.payload.index==null?void 0:Number(c.payload.index),activeLabel:c.payload.label,activeDataKey:c.payload.dataKey,activeCoordinate:c.payload.coordinate})]:r===`value`&&(x=i.find(e=>String(e.value)===c.payload.label));var S=c.payload.coordinate;if(S==null||o==null){n(rB({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(x==null){n(rB({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:void 0}));return}var C=S.x,w=S.y,T=Math.min(C,o.x+o.width),E=Math.min(w,o.y+o.height),D={x:a===`horizontal`?x.coordinate:T,y:a===`horizontal`?E:x.coordinate};n(rB({active:c.payload.active,coordinate:D,dataKey:c.payload.dataKey,index:String(x.index),label:c.payload.label,sourceViewBox:c.payload.sourceViewBox,graphicalItemId:c.payload.graphicalItemId}))}}};return bH.on(xH,s),()=>{bH.off(xH,s)}},[s,n,t,e,r,i,a,o])}function HH(){var e=K(JA),t=K(XA),n=yb();(0,w.useEffect)(()=>{if(e==null)return Rg;var r=(r,i,a)=>{t!==a&&e===r&&n(jH(i))};return bH.on(SH,r),()=>{bH.off(SH,r)}},[n,t,e])}function UH(){var e=yb();(0,w.useEffect)(()=>{e(EH())},[e]),VH(),HH()}function WH(e,t,n,r,i,a){var o=K(n=>PV(n,e,t)),s=K(sV),c=K(XA),l=K(JA),u=K(YA),d=K(DH)?.sourceViewBox!=null,f=zT();(0,w.useEffect)(()=>{if(!d&&l!=null&&c!=null){var e=rB({active:a,coordinate:n,dataKey:o,index:i,label:typeof r==`number`?String(r):r,sourceViewBox:f,graphicalItemId:s});bH.emit(xH,l,e,c)}},[d,n,o,s,i,r,c,l,u,a,f])}function GH(){var e=K(JA),t=K(XA),n=K(e=>e.chartData.dataStartIndex),r=K(e=>e.chartData.dataEndIndex);(0,w.useEffect)(()=>{if(e!=null&&n!=null&&r!=null&&t!=null){var i={startIndex:n,endIndex:r};bH.emit(SH,e,i,t)}},[r,n,t,e])}function KH(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 qH(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n{x(Xz({shared:g,trigger:_,axisId:b,active:n,defaultIndex:S}))},[x,g,_,b,n,S]);var C=zT(),T=UD(),E=Vz(g),D=K(e=>BV(e,E,_,S))??{},O=D.activeIndex,k=D.isActive,A=K(e=>zV(e,E,_,S)),j=K(e=>RV(e,E,_,S)),M=K(e=>LV(e,E,_,S)),N=A,P=vH(),F=n??k??!1,ee=ZH(ix([N,F]),2),te=ee[0],ne=ee[1],re=E===`axis`?j:void 0;WH(E,_,M,re,O,F);var ie=y??P;if(ie==null||C==null||E==null)return null;var I=N??aU;F||(I=aU),s&&I.length&&(I=db(I.filter(e=>e.value!=null&&(e.hide!==!0||t.includeHidden)),u,rU));var ae=I.length>0,oe=qH(qH({},t),{},{payload:I,label:re,active:F,activeIndex:O,coordinate:M,accessibilityLayer:T}),se=w.createElement(HD,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:c,active:F,coordinate:M,hasPayload:ae,offset:l,position:d,reverseDirection:f,useTranslate3d:p,viewBox:C,wrapperStyle:m,lastBoundingBox:te,innerRef:ne,hasPortalFromProps:!!y},iU(o,oe));return w.createElement(w.Fragment,null,(0,bo.createPortal)(se,ie),F&&w.createElement(gH,{cursor:h,tooltipEventType:E,coordinate:M,payload:I,index:O}))}var cU=e=>null;cU.displayName=`Cell`;function lU(e,t,n){return(t=uU(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uU(e){var t=dU(e,`string`);return typeof t==`symbol`?t:t+``}function dU(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var fU=class{constructor(e){lU(this,`cache`,new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}};function pU(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 mU(e){for(var t=1;t{try{var n=document.getElementById(xU);n||(n=document.createElement(`span`),n.setAttribute(`id`,xU),n.setAttribute(`aria-hidden`,`true`),document.body.appendChild(n)),Object.assign(n.style,bU,t),n.textContent=`${e}`;var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},wU=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||xD.isSsr)return{width:0,height:0};if(!vU.enableCache)return CU(e,t);var n=SU(e,t),r=yU.get(n);if(r)return r;var i=CU(e,t);return yU.set(n,i),i},TU;function EU(e,t){return jU(e)||AU(e,t)||OU(e,t)||DU()}function DU(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function OU(e,t){if(e){if(typeof e==`string`)return kU(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kU(e,t):void 0}}function kU(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{var t=e.children,n=e.breakAll,r=e.style;try{var i=[];return Fg(t)||(i=n?t.toString().split(``):t.toString().split(cW)),{wordsWithComputedWidth:i.map(e=>({word:e,width:wU(e,r).width})),spaceWidth:n?0:wU(`\xA0`,r).width}}catch{return null}};function uW(e){return e===`start`||e===`middle`||e===`end`||e===`inherit`}function dW(e){return Fg(e)||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}var fW=(e,t,n,r)=>e.reduce((e,i)=>{var a=i.word,o=i.width,s=e[e.length-1];if(s&&o!=null&&(t==null||r||s.width+o+ne.reduce((e,t)=>e.width>t.width?e:t),mW=`…`,hW=(e,t,n,r,i,a,o,s)=>{var c=lW({breakAll:n,style:r,children:e.slice(0,t)+mW});if(!c)return[!1,[]];var l=fW(c.wordsWithComputedWidth,a,o,s);return[l.length>i||pW(l).width>Number(a),l]},gW=(e,t,n,r,i)=>{var a=e.maxLines,o=e.children,s=e.style,c=e.breakAll,l=G(a),u=String(o),d=fW(t,r,n,i);if(!l||i||!(d.length>a||pW(d).width>Number(r)))return d;for(var f=0,p=u.length-1,m=0,h;f<=p&&m<=u.length-1;){var g=Math.floor((f+p)/2),_=nW(hW(u,g-1,c,s,a,r,n,i),2),v=_[0],y=_[1],b=nW(hW(u,g,c,s,a,r,n,i),1)[0];if(!v&&!b&&(f=g+1),v&&b&&(p=g-1),!v&&b){h=y;break}m++}return h||d},_W=e=>[{words:Fg(e)?[]:e.toString().split(cW),width:void 0}],vW=e=>{var t=e.width,n=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,o=e.maxLines;if((t||n)&&!xD.isSsr){var s,c,l=lW({breakAll:a,children:r,style:i});if(l){var u=l.wordsWithComputedWidth,d=l.spaceWidth;s=u,c=d}else return _W(r);return gW({breakAll:a,children:r,maxLines:o,style:i},s,c,t,!!n)}return _W(r)},yW=`#808080`,bW={angle:0,breakAll:!1,capHeight:`0.71em`,fill:yW,lineHeight:`1em`,scaleToFit:!1,textAnchor:`start`,verticalAnchor:`end`,x:0,y:0},xW=(0,w.forwardRef)((e,t)=>{var n=Uv(e,bW),r=n.x,i=n.y,a=n.lineHeight,o=n.capHeight,s=n.fill,c=n.scaleToFit,l=n.textAnchor,u=n.verticalAnchor,d=eW(n,ZU),f=(0,w.useMemo)(()=>vW({breakAll:d.breakAll,children:d.children,maxLines:d.maxLines,scaleToFit:c,style:d.style,width:d.width}),[d.breakAll,d.children,d.maxLines,c,d.style,d.width]),p=d.dx,m=d.dy,h=d.angle,g=d.className,_=d.breakAll,v=eW(d,QU);if(!Og(r)||!Og(i)||f.length===0)return null;var y=Number(r)+(G(p)?p:0),b=Number(i)+(G(m)?m:0);if(!sw(y)||!sw(b))return null;var x;switch(u){case`start`:x=XU(`calc(${o})`);break;case`middle`:x=XU(`calc(${(f.length-1)/2} * -${a} + (${o} / 2))`);break;default:x=XU(`calc(${f.length-1} * -${a})`)}var S=[],C=f[0];if(c&&C!=null){var T=C.width,E=d.width;S.push(`scale(${G(E)&&G(T)?E/T:1})`)}return h&&S.push(`rotate(${h}, ${y}, ${b})`),S.length&&(v.transform=S.join(` `)),w.createElement(`text`,$U({},tg(v),{ref:t,x:y,y:b,className:L(`recharts-text`,g),textAnchor:l,fill:s.includes(`url`)?yW:s}),f.map((e,t)=>{var n=e.words.join(_?``:` `);return w.createElement(`tspan`,{x:y,dy:t===0?x:a,key:`${n}-${t}`},n)}))});xW.displayName=`Text`;var SW=[`labelRef`],CW=[`content`];function wW(e,t){if(e==null)return{};var n,r,i=TW(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var t=e.x,n=e.y,r=e.upperWidth,i=e.lowerWidth,a=e.width,o=e.height,s=e.children,c=(0,w.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return w.createElement(MW.Provider,{value:c},s)},PW=()=>{var e=(0,w.useContext)(MW),t=zT();return e||(t?zg(t):void 0)},FW=(0,w.createContext)(null),IW=()=>{var e=(0,w.useContext)(FW),t=K(_j);return e||t},LW=e=>{var t=e.value,n=e.formatter,r=Fg(e.children)?t:e.children;return typeof n==`function`?n(r):r},RW=e=>e!=null&&typeof e==`function`,zW=(e,t)=>Tg(t-e)*Math.min(Math.abs(t-e),360),BW=(e,t,n,r,i)=>{var a=e.offset,o=e.className,s=i.cx,c=i.cy,l=i.innerRadius,u=i.outerRadius,d=i.startAngle,f=i.endAngle,p=i.clockWise,m=(l+u)/2,h=zW(d,f),g=h>=0?1:-1,_,v;switch(t){case`insideStart`:_=d+g*a,v=p;break;case`insideEnd`:_=f-g*a,v=!p;break;case`end`:_=f+g*a,v=p;break;default:throw Error(`Unsupported position ${t}`)}v=h<=0?v:!v;var y=Ik(s,c,m,_),b=Ik(s,c,m,_+(v?1:-1)*359),x=`M${y.x},${y.y} A${m},${m},0,1,${+!v}, - ${b.x},${b.y}`,S=Tg(e.id)?bg(`recharts-radial-line-`):e.id;return w.createElement(`text`,xW({},r,{dominantBaseline:`central`,className:L(`recharts-radial-bar-label`,o)}),w.createElement(`defs`,null,w.createElement(`path`,{id:S,d:x})),w.createElement(`textPath`,{xlinkHref:`#${S}`},n))},jW=(e,t,n)=>{var r=e.cx,i=e.cy,a=e.innerRadius,o=e.outerRadius,s=(e.startAngle+e.endAngle)/2;if(n===`outside`){var c=Ek(r,i,o+t,s),l=c.x;return{x:l,y:c.y,textAnchor:l>=r?`start`:`end`,verticalAnchor:`middle`}}if(n===`center`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`middle`};if(n===`centerTop`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`start`};if(n===`centerBottom`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`end`};var u=Ek(r,i,(a+o)/2,s);return{x:u.x,y:u.y,textAnchor:`middle`,verticalAnchor:`middle`}},MW=e=>e!=null&&`cx`in e&&G(e.cx),NW={angle:0,offset:5,zIndex:VA.label,position:`middle`,textBreakAll:!1};function PW(e){if(!MW(e))return e;var t=e.cx,n=e.cy,r=e.outerRadius,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function FW(e){var t=Nv(e,NW),n=t.viewBox,r=t.parentViewBox,i=t.position,a=t.value,o=t.children,s=t.content,c=t.className,l=c===void 0?``:c,u=t.textBreakAll,d=t.labelRef,f=EW(),p=wW(),m=n==null?i===`center`?p:f??p:MW(n)?n:kg(n),h,g,_=PW(m);if(!m||Tg(a)&&Tg(o)&&!(0,w.isValidElement)(s)&&typeof s!=`function`)return null;var v=MW(m)&&(i===`insideStart`||i===`insideEnd`||i===`end`);if(MW(m))v||(g=jW(m,t.offset,t.position));else if(_){var y=Fg({viewBox:_,position:i,offset:t.offset,parentViewBox:MW(r)?void 0:r,clamp:!0});g=_W(_W({x:y.x,y:y.y,textAnchor:y.horizontalAnchor,verticalAnchor:y.verticalAnchor},y.width===void 0?{}:{width:y.width}),y.height===void 0?{}:{height:y.height})}var b=_W(_W(_W(_W({},g?.x===void 0?{}:{x:g.x}),g?.y===void 0?{}:{y:g.y}),t),{},{viewBox:m});if((0,w.isValidElement)(s)){b.labelRef;var x=mW(b,fW);return(0,w.cloneElement)(s,x)}if(typeof s==`function`){b.content;var S=mW(b,pW);if(h=(0,w.createElement)(s,S),(0,w.isValidElement)(h))return h}else h=DW(t);var C=Gh(t);return v&&MW(m)?AW(t,i,h,C,m):g==null?null:w.createElement(ZV,{zIndex:t.zIndex},w.createElement(dW,xW({ref:d,className:L(`recharts-label`,l)},C,g,{textAnchor:eW(C.textAnchor)?C.textAnchor:g.textAnchor,breakAll:u}),h))}FW.displayName=`Label`;var IW=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?w.createElement(FW,xW({key:`label-implicit`},r)):vg(e)?w.createElement(FW,xW({key:`label-implicit`,value:e},r)):(0,w.isValidElement)(e)?e.type===FW?(0,w.cloneElement)(e,_W({key:`label-implicit`},r)):w.createElement(FW,xW({key:`label-implicit`,content:e},r)):OW(e)?w.createElement(FW,xW({key:`label-implicit`,content:e},r)):e&&typeof e==`object`?w.createElement(FW,xW({},e,{key:`label-implicit`},r)):null};function LW(e){var t=e.label,n=e.labelRef;return IW(t,wW(),n)||null}var RW=[`valueAccessor`],zW=[`dataKey`,`clockWise`,`id`,`textBreakAll`,`zIndex`];function BW(){return BW=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(tW(t))return t},WW=(0,w.createContext)(void 0),GW=WW.Provider,KW=(0,w.createContext)(void 0);KW.Provider;function qW(){return(0,w.useContext)(WW)}function JW(){return(0,w.useContext)(KW)}function YW(e){var t=e.valueAccessor,n=t===void 0?UW:t,r=VW(e,RW),i=r.dataKey;r.clockWise;var a=r.id,o=r.textBreakAll,s=r.zIndex,c=VW(r,zW),l=qW(),u=JW(),d=l||u;return!d||!d.length?null:w.createElement(ZV,{zIndex:s??VA.label},w.createElement(tg,{className:`recharts-label-list`},d.map((e,t)=>{var s=Tg(i)?n(e,t):iw(e.payload,i),l=Tg(a)?{}:{id:`${a}-${t}`};return w.createElement(FW,BW({key:`label-${t}`},Gh(e),c,l,{fill:r.fill??e.fill,parentViewBox:e.parentViewBox,value:s,textBreakAll:o,viewBox:e.viewBox,index:t,zIndex:0}))})))}YW.displayName=`LabelList`;function XW(e){var t=e.label;return t?t===!0?w.createElement(YW,{key:`labelList-implicit`}):w.isValidElement(t)||OW(t)?w.createElement(YW,{key:`labelList-implicit`,content:t}):typeof t==`object`?w.createElement(YW,BW({key:`labelList-implicit`},t,{type:String(t.type)})):null:null}var ZW=tC({name:`polarAxis`,initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=OS(t.payload)},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=OS(t.payload)},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),QW=ZW.actions;QW.addRadiusAxis,QW.removeRadiusAxis,QW.addAngleAxis,QW.removeAngleAxis;var $W=ZW.reducer;function eG(e){return e&&typeof e==`object`&&`className`in e&&typeof e.className==`string`?e.className:``}var tG=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.suspense_list`),d=Symbol.for(`react.memo`),f=Symbol.for(`react.lazy`),p=Symbol.for(`react.view_transition`);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 l:case u:case p:return e;default:switch(e&&=e.$$typeof,e){case s:case c:case f:case d:return e;case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),nG=o(((e,t)=>{t.exports=tG()}))(),rG=e=>typeof e==`string`?e:e?e.displayName||e.name||`Component`:``,iG=null,aG=null,oG=e=>{if(e===iG&&Array.isArray(aG))return aG;var t=[];return w.Children.forEach(e,e=>{Tg(e)||((0,nG.isFragment)(e)?t=t.concat(oG(e.props.children)):t.push(e))}),aG=t,iG=e,t};function sG(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(e=>rG(e)):[rG(t)],oG(e).forEach(e=>{var t=ug(e,`type.displayName`)||ug(e,`type.name`);t&&r.indexOf(t)!==-1&&n.push(e)}),n}function cG(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 lG(e){for(var t=1;t{var r=lb();return(i,a)=>o=>{e?.(i,a,o),r(Vz({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},bG=e=>{var t=lb();return(n,r)=>i=>{e?.(n,r,i),t(Hz())}},xG=(e,t,n)=>{var r=lb();return(i,a)=>o=>{e?.(i,a,o),r(Wz({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function SG(e){var t=e.tooltipEntrySettings,n=lb(),r=Kw(),i=(0,w.useRef)(null);return(0,w.useLayoutEffect)(()=>{r||(i.current===null?n(Lz(t)):i.current!==t&&n(Rz({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,w.useLayoutEffect)(()=>()=>{i.current&&=(n(zz(i.current)),null)},[n]),null}function CG(e){var t=e.legendPayload,n=lb(),r=Kw(),i=(0,w.useRef)(null);return(0,w.useLayoutEffect)(()=>{r||(i.current===null?n(GT(t)):i.current!==t&&n(KT({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,w.useLayoutEffect)(()=>()=>{i.current&&=(n(qT(i.current)),null)},[n]),null}function wG(e,t){return kG(e)||OG(e,t)||EG(e,t)||TG()}function TG(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function EG(e,t){if(e){if(typeof e==`string`)return DG(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?DG(e,t):void 0}}function DG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n2&&arguments[2]!==void 0?arguments[2]:[],r=[];for(var i of n)r.push({status:`removed`,prev:i});for(var a=0;ae[Math.floor(r*n)]),t)}function PG(e,t){return MG(t.map((t,n)=>e[n]),t)}function FG(e,t){for(var n=new Map,r=0;r{var a=n(e,t);if(a!=null){var o=r.get(a);if(o!==void 0)return i.add(a),o}}),o=[];for(var s of r){var c=wG(s,2),l=c[0],u=c[1];i.has(l)||o.push(u)}return MG(a,t,o)}function LG(e,t,n){return t==null?null:e==null?t.map(e=>({status:`added`,next:e})):n===`index`?NG(e,t):n===`append`?PG(e,t):IG(e,t,n)}function RG(e,t){var n=(0,w.useRef)(e),r=(0,w.useRef)(t.current),i=(0,w.useRef)(!0);n.current!==e&&(n.current=e,r.current=t.current,i.current=!1);var a=(0,w.useCallback)(function(e,n){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(n===0){i.current=!0;return}n===1&&(r.current=e),n>0&&i.current&&a&&(t.current=e)},[t]);return{startValue:r.current,syncStepValue:a}}function zG(e,t){return WG(e)||UG(e,t)||VG(e,t)||BG()}function BG(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VG(e,t){if(e){if(typeof e==`string`)return HG(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?HG(e,t):void 0}}function HG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{typeof e==`function`&&e(),i(!0)},[e]),handleAnimationEnd:(0,w.useCallback)(()=>{typeof t==`function`&&t(),i(!1)},[t])}}function KG(e){var t=e.animationInput,n=e.animationIdPrefix,r=e.items,i=e.previousItemsRef,a=e.isAnimationActive,o=e.animationBegin,s=e.animationDuration,c=e.animationEasing,l=e.onAnimationStart,u=e.onAnimationEnd,d=e.animationInterpolateFn,f=e.animationMatchBy,p=e.shouldUpdatePreviousRef,m=e.children,h=e.layout,g=BO(t,n),_=RG(g,i),v=_.startValue??null,y=LG(v,r,f??AG);return w.createElement(zO,{animationId:g,begin:o,duration:s,isActive:a,easing:c,onAnimationEnd:u,onAnimationStart:l,key:g},e=>{var t=v==null,n=r==null?r:d(y,e,h),i=p?p(e):e>0;return _.syncStepValue(n,e,i),n==null?null:m(n,e,t)})}function qG(e,t){return QG(e)||ZG(e,t)||YG(e,t)||JG()}function JG(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function YG(e,t){if(e){if(typeof e==`string`)return XG(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?XG(e,t):void 0}}function XG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nqG(w.useState(()=>bg(`uid-`)),1)[0]);function eK(e,t){var n=$G();return t||(e?`${e}-${n}`:n)}var tK=(0,w.createContext)(void 0),nK=e=>{var t=e.id,n=e.type,r=e.children,i=eK(`recharts-${n}`,t);return w.createElement(tK.Provider,{value:i},r(i))},rK=tC({name:`graphicalItems`,initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(OS(t.payload))},prepare:BS()},replaceCartesianGraphicalItem:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=TS(e).cartesianItems.indexOf(OS(r));a>-1&&(e.cartesianItems[a]=OS(i))},prepare:BS()},removeCartesianGraphicalItem:{reducer(e,t){var n=TS(e).cartesianItems.indexOf(OS(t.payload));n>-1&&e.cartesianItems.splice(n,1)},prepare:BS()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(OS(t.payload))},prepare:BS()},removePolarGraphicalItem:{reducer(e,t){var n=TS(e).polarItems.indexOf(OS(t.payload));n>-1&&e.polarItems.splice(n,1)},prepare:BS()},replacePolarGraphicalItem:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=TS(e).polarItems.indexOf(OS(r));a>-1&&(e.polarItems[a]=OS(i))},prepare:BS()}}}),iK=rK.actions,aK=iK.addCartesianGraphicalItem,oK=iK.replaceCartesianGraphicalItem,sK=iK.removeCartesianGraphicalItem;iK.addPolarGraphicalItem,iK.removePolarGraphicalItem,iK.replacePolarGraphicalItem;var cK=rK.reducer,lK=(0,w.memo)(e=>{var t=lb(),n=(0,w.useRef)(null);return(0,w.useLayoutEffect)(()=>{n.current===null?t(aK(e)):n.current!==e&&t(oK({prev:n.current,next:e})),n.current=e},[t,e]),(0,w.useLayoutEffect)(()=>()=>{n.current&&=(t(sK(n.current)),null)},[t]),null});function uK(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 dK(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),Tw,Ew],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),DK=()=>K(EK);function OK(e,t){return NK(e)||MK(e,t)||AK(e,t)||kK()}function kK(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function AK(e,t){if(e){if(typeof e==`string`)return jK(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jK(e,t):void 0}}function jK(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var r=n??e;if(!Tg(r))return xg(r,t,0)},FK=(e,t,n)=>{var r={},i=e.filter(fj),a=e.filter(e=>e.stackId==null),o=i.reduce((e,t)=>{var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},r),s=Object.entries(o).map(e=>{var r=OK(e,2),i=r[0],a=r[1];return{stackId:i,dataKeys:a.map(e=>e.dataKey),barSize:PK(t,n,a[0]?.barSize)}}),c=a.map(e=>({stackId:void 0,dataKeys:[e.dataKey].filter(e=>e!=null),barSize:PK(t,n,e.barSize)}));return[...s,...c]};function IK(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 LK(e){for(var t=1;te+(t.barSize||0),0);d+=(a-1)*o,d>=n&&(d-=(a-1)*o,o=0),d>=n&&u>0&&(l=!0,u*=.9,d=a*u);var f={offset:Math.round((n-d)/2)-o,size:0};s=r.reduce((e,t)=>{var n={stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:f.offset+f.size+o,size:l?u:t.barSize??0}},r=[...e,n];return f=n.position,r},c)}else{var p=xg(t,n,0,!0);n-2*p-(a-1)*o<=0&&(o=0);var m=(n-2*p-(a-1)*o)/a;m>1&&(m=Math.round(m));var h=ZC(i)?Math.min(m,i):m;s=r.reduce((e,t,n)=>[...e,{stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:p+a*(m-h)/2+(h+o)*n,size:h}}],c)}return s}}var HK=(e,t,n,r,i,a,o)=>{var s=Tg(o)?t:o,c=VK(n,r,i===a?a:i,e,s);return i!==a&&c!=null&&(c=c.map(e=>LK(LK({},e),{},{position:LK(LK({},e.position),{},{offset:e.position.offset-i/2})}))),c},UK=(e,t)=>{var n=uj(t);if(!(!e||n==null||t==null)){var r=t.stackId;if(r!=null){var i=e[r];if(i){var a=i.stackedData;if(a)return a.find(e=>e.key===n)}}}},WK=(e,t)=>{if(e!=null&&t!=null){var n=e.find(e=>e.stackId===t.stackId&&t.dataKey!=null&&e.dataKeys.includes(t.dataKey));if(n!=null)return n.position}};function GK(e,t){return e&&typeof e==`object`&&`zIndex`in e&&typeof e.zIndex==`number`&&ZC(e.zIndex)?e.zIndex:t}function KK(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 qK(e){for(var t=1;t{if(e){var n=e.replace(/(\w)/,e=>e.toUpperCase()),r=ZK.reduce((e,r)=>qK(qK({},e),{},{[r+n]:t}),{});return r[e]=t,r}},$K=e=>{var t=e.chartData,n=lb(),r=Kw();return(0,w.useEffect)(()=>r?()=>{}:(n(bH(t)),()=>{n(bH(void 0))}),[t,n,r]),null},eq=e=>e.chartData.chartData,tq=()=>K(eq),nq=e=>{var t=e.chartData;return{startIndex:t.dataStartIndex,endIndex:t.dataEndIndex}},rq=()=>K(nq),iq=(0,w.createContext)(()=>{}),aq={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},oq=tC({name:`brush`,initialState:aq,reducers:{setBrushSettings(e,t){return t.payload==null?aq:t.payload}}}),sq=oq.actions.setBrushSettings,cq=oq.reducer;function lq(){return lq=Object.assign?Object.assign.bind():function(e){for(var t=1;t{[`ArrowLeft`,`ArrowRight`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),c(e.key===`ArrowRight`?1:-1,r))},onFocus:l,onBlur:u,style:{cursor:`col-resize`}},w.createElement(gq,{travellerType:h,travellerProps:x}))}function bq(e){var t=e.index,n=e.data,r=e.tickFormatter,i=e.dataKey,a=iw(n[t],i,t);return typeof r==`function`?r(a,t):a}function xq(e,t){for(var n=e.length,r=0,i=n-1;i-r>1;){var a=Math.floor((r+i)/2),o=e[a];o!=null&&o>t?i=a:r=a}var s=e[i];return s!=null&&t>=s?i:r}function Sq(e){var t=e.startX,n=e.endX,r=e.scaleValues,i=e.gap,a=e.data.length-1,o=Math.min(t,n),s=Math.max(t,n),c=xq(r,o),l=xq(r,s);return{startIndex:c-c%i,endIndex:l===a?a:l-l%i}}function Cq(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.fill,o=e.stroke;return w.createElement(`rect`,{stroke:o,fill:a,x:t,y:n,width:r,height:i})}function wq(e){var t=e.startIndex,n=e.endIndex,r=e.y,i=e.height,a=e.travellerWidth,o=e.stroke,s=e.tickFormatter,c=e.dataKey,l=e.data,u=e.startX,d=e.endX,f=5,p={pointerEvents:`none`,fill:o};return w.createElement(tg,{className:`recharts-brush-texts`},w.createElement(dW,lq({textAnchor:`end`,verticalAnchor:`middle`,x:Math.min(u,d)-f,y:r+i/2},p),bq({index:t,tickFormatter:s,dataKey:c,data:l})),w.createElement(dW,lq({textAnchor:`start`,verticalAnchor:`middle`,x:Math.max(u,d)+a+f,y:r+i/2},p),bq({index:n,tickFormatter:s,dataKey:c,data:l})))}function Tq(e){var t=e.y,n=e.height,r=e.stroke,i=e.travellerWidth,a=e.startX,o=e.endX,s=e.onMouseEnter,c=e.onMouseLeave,l=e.onMouseDown,u=e.onTouchStart,d=Math.min(a,o)+i,f=Math.max(Math.abs(o-a)-i,0);return w.createElement(`rect`,{className:`recharts-brush-slide`,onMouseEnter:s,onMouseLeave:c,onMouseDown:l,onTouchStart:u,style:{cursor:`move`},stroke:`none`,fill:r,fillOpacity:.2,x:d,y:t,width:f,height:n})}function Eq(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.data,o=e.children,s=e.padding;if(w.Children.count(o)!==1)return null;var c=w.Children.only(o);return c?w.cloneElement(c,{x:t,y:n,width:r,height:i,margin:s,compact:!0,data:a}):null}var Dq=e=>{var t=e.data,n=e.startIndex,r=e.endIndex,i=e.x,a=e.width,o=e.travellerWidth;if(!t||!t.length)return{};var s=t.length,c=tM().domain(Qk(0,s)).range([i,i+a-o]),l=c.domain().map(e=>c(e)).filter(Dg);return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:c(n),endX:c(r),scale:c,scaleValues:l}},Oq=e=>e.changedTouches&&!!e.changedTouches.length,kq=class extends w.PureComponent{constructor(e){super(e),fq(this,`handleDrag`,e=>{this.leaveTimer&&=(clearTimeout(this.leaveTimer),null),this.state.isTravellerMoving?this.handleTravellerMove(e):this.state.isSlideMoving&&this.handleSlideDrag(e)}),fq(this,`handleTouchMove`,e=>{var t=e.changedTouches?.[0];t!=null&&this.handleDrag(t)}),fq(this,`handleDragEnd`,()=>{this.setState({isTravellerMoving:!1,isSlideMoving:!1},()=>{var e=this.props,t=e.endIndex,n=e.onDragEnd,r=e.startIndex;n?.({endIndex:t,startIndex:r})}),this.detachDragEndListener()}),fq(this,`handleLeaveWrapper`,()=>{(this.state.isTravellerMoving||this.state.isSlideMoving)&&(this.leaveTimer=window.setTimeout(this.handleDragEnd,this.props.leaveTimeOut))}),fq(this,`handleEnterSlideOrTraveller`,()=>{this.setState({isTextActive:!0})}),fq(this,`handleLeaveSlideOrTraveller`,()=>{this.setState({isTextActive:!1})}),fq(this,`handleSlideDragStart`,e=>{var t=Oq(e)?e.changedTouches[0]:e;t!=null&&(this.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:t.pageX}),this.attachDragEndListener())}),fq(this,`handleTravellerMoveKeyboard`,(e,t)=>{var n=this.props,r=n.data,i=n.gap,a=n.startIndex,o=n.endIndex,s=this.state,c=s.scaleValues,l=s.startX,u=s.endX;if(c!=null){var d=-1;if(t===`startX`?d=a:t===`endX`&&(d=o),!(d<0||d>=r.length)){var f=d+e;if(!(f===-1||f>=c.length)){var p=c[f];p!=null&&(t===`startX`&&p>=u||t===`endX`&&p<=l||this.setState({[t]:p},()=>{this.props.onChange(Sq({startX:this.state.startX,endX:this.state.endX,data:r,gap:i,scaleValues:c}))}))}}}}),this.travellerDragStartHandlers={startX:this.handleTravellerDragStart.bind(this,`startX`),endX:this.handleTravellerDragStart.bind(this,`endX`)},this.state={brushMoveStartX:0,movingTravellerId:void 0,endX:0,startX:0,slideMoveStartX:0}}static getDerivedStateFromProps(e,t){var n=e.data,r=e.width,i=e.x,a=e.travellerWidth,o=e.startIndex,s=e.endIndex,c=e.startIndexControlledFromProps,l=e.endIndexControlledFromProps;if(n!==t.prevData)return dq({prevData:n,prevTravellerWidth:a,prevX:i,prevWidth:r,prevStartIndexControlledFromProps:c,prevEndIndexControlledFromProps:l},n&&n.length?Dq({data:n,width:r,x:i,travellerWidth:a,startIndex:o,endIndex:s}):{scale:void 0,scaleValues:void 0});var u=t.scale;if(u&&(r!==t.prevWidth||i!==t.prevX||a!==t.prevTravellerWidth)){u.range([i,i+r-a]);var d=u.domain().map(e=>u(e)).filter(e=>e!=null);return{prevData:n,prevTravellerWidth:a,prevX:i,prevWidth:r,startX:u(e.startIndex),endX:u(e.endIndex),scaleValues:d}}if(t.scale&&!t.isSlideMoving&&!t.isTravellerMoving&&!t.isTravellerFocused&&!t.isTextActive){if(c!=null&&t.prevStartIndexControlledFromProps!==c)return{startX:t.scale(c),prevStartIndexControlledFromProps:c};if(l!=null&&t.prevEndIndexControlledFromProps!==l)return{endX:t.scale(l),prevEndIndexControlledFromProps:l}}return null}componentWillUnmount(){this.leaveTimer&&=(clearTimeout(this.leaveTimer),null),this.detachDragEndListener()}attachDragEndListener(){window.addEventListener(`mouseup`,this.handleDragEnd,!0),window.addEventListener(`touchend`,this.handleDragEnd,!0),window.addEventListener(`mousemove`,this.handleDrag,!0)}detachDragEndListener(){window.removeEventListener(`mouseup`,this.handleDragEnd,!0),window.removeEventListener(`touchend`,this.handleDragEnd,!0),window.removeEventListener(`mousemove`,this.handleDrag,!0)}handleSlideDrag(e){var t=this.state,n=t.slideMoveStartX,r=t.startX,i=t.endX,a=t.scaleValues;if(a!=null){var o=this.props,s=o.x,c=o.width,l=o.travellerWidth,u=o.startIndex,d=o.endIndex,f=o.onChange,p=o.data,m=o.gap,h=e.pageX-n;h>0?h=Math.min(h,s+c-l-i,s+c-l-r):h<0&&(h=Math.max(h,s-r,s-i));var g=Sq({startX:r+h,endX:i+h,data:p,gap:m,scaleValues:a});(g.startIndex!==u||g.endIndex!==d)&&f&&f(g),this.setState({startX:r+h,endX:i+h,slideMoveStartX:e.pageX})}}handleTravellerDragStart(e,t){var n=Oq(t)?t.changedTouches[0]:t;n!=null&&(this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:e,brushMoveStartX:n.pageX}),this.attachDragEndListener())}handleTravellerMove(e){var t=this.state,n=t.brushMoveStartX,r=t.movingTravellerId,i=t.endX,a=t.startX,o=t.scaleValues;if(r!=null&&o!=null){var s=this.state[r],c=this.props,l=c.x,u=c.width,d=c.travellerWidth,f=c.onChange,p=c.gap,m=c.data,h={startX:this.state.startX,endX:this.state.endX,data:m,gap:p,scaleValues:o},g=e.pageX-n;g>0?g=Math.min(g,l+u-d-s):g<0&&(g=Math.max(g,l-s)),h[r]=s+g;var _=Sq(h),v=_.startIndex,y=_.endIndex,b=()=>{var e=m.length-1;return r===`startX`&&(i>a?v%p===0:y%p===0)||ia?y%p===0:v%p===0)||i>a&&y===e};this.setState({[r]:s+g,brushMoveStartX:e.pageX},()=>{f&&b()&&f(_)})}}render(){var e=this.props,t=e.data,n=e.className,r=e.children,i=e.x,a=e.y,o=e.dy,s=e.width,c=e.height,l=e.alwaysShowText,u=e.fill,d=e.stroke,f=e.startIndex,p=e.endIndex,m=e.travellerWidth,h=e.tickFormatter,g=e.dataKey,_=e.padding,v=this.state,y=v.startX,b=v.endX,x=v.isTextActive,S=v.isSlideMoving,C=v.isTravellerMoving,T=v.isTravellerFocused;if(!t||!t.length||!G(i)||!G(a)||!G(s)||!G(c)||s<=0||c<=0)return null;var E=L(`recharts-brush`,n),D=QK(`userSelect`,`none`),O=a+(o??0);return w.createElement(tg,{className:E,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:D},w.createElement(Cq,{x:i,y:O,width:s,height:c,fill:u,stroke:d}),w.createElement(qw,null,w.createElement(Eq,{x:i,y:O,width:s,height:c,data:t,padding:_},r)),w.createElement(Tq,{y:O,height:c,stroke:d,travellerWidth:m,startX:y,endX:b,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart}),w.createElement(yq,{travellerX:y,id:`startX`,otherProps:dq(dq({},this.props),{},{y:O}),onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers.startX,onTouchStart:this.travellerDragStartHandlers.startX,onTravellerMoveKeyboard:this.handleTravellerMoveKeyboard,onFocus:()=>{this.setState({isTravellerFocused:!0})},onBlur:()=>{this.setState({isTravellerFocused:!1})}}),w.createElement(yq,{travellerX:b,id:`endX`,otherProps:dq(dq({},this.props),{},{y:O}),onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers.endX,onTouchStart:this.travellerDragStartHandlers.endX,onTravellerMoveKeyboard:this.handleTravellerMoveKeyboard,onFocus:()=>{this.setState({isTravellerFocused:!0})},onBlur:()=>{this.setState({isTravellerFocused:!1})}}),(x||S||C||T||l)&&w.createElement(wq,{startIndex:f,endIndex:p,y:O,height:c,travellerWidth:m,stroke:d,tickFormatter:h,dataKey:g,data:t,startX:y,endX:b}))}};function Aq(e){var t=lb(),n=tq(),r=rq(),i=(0,w.useContext)(iq),a=e.onChange,o=e.startIndex,s=e.endIndex;(0,w.useEffect)(()=>{t(xH({startIndex:o,endIndex:s}))},[t,s,o,n]),FH();var c=(0,w.useCallback)(e=>{if(r!=null){var n=r.startIndex,o=r.endIndex;(e.startIndex!==n||e.endIndex!==o)&&(i?.(e),a?.(e),t(xH(e)))}},[a,i,t,r]),l=K(Yw);if(l==null||r==null||n==null||!n.length)return null;var u=r.startIndex,d=r.endIndex,f={data:n,x:l.x,y:l.y,width:l.width,startIndex:u,endIndex:d,onChange:c};return w.createElement(kq,lq({},e,f,{startIndexControlledFromProps:o??void 0,endIndexControlledFromProps:s??void 0}))}function jq(e){var t=lb();return(0,w.useEffect)(()=>(t(sq(e)),()=>{t(sq(null))}),[t,e]),null}var Mq={height:40,travellerWidth:5,gap:1,fill:`#fff`,stroke:`#666`,padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1};function Nq(e){var t=Nv(e,Mq);return w.createElement(w.Fragment,null,w.createElement(jq,{height:t.height,x:t.x,y:t.y,width:t.width,padding:t.padding}),w.createElement(Aq,t))}Nq.displayName=`Brush`;var Pq=(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)}},Fq=e=>{var t=e.x1,n=e.y1,r=e.x2,i=e.y2;return Pq({x:t,y:n},{x:r,y:i})};function Iq(e){return(e%180+180)%180}var Lq=function(e){var t=e.width,n=e.height,r=Iq(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=TS(e).dots.findIndex(e=>e===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=TS(e).areas.findIndex(e=>e===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(OS(t.payload))},removeLine:(e,t)=>{var n=TS(e).lines.findIndex(e=>e===t.payload);n!==-1&&e.lines.splice(n,1)}}}),zq=Rq.actions;zq.addDot,zq.removeDot,zq.addArea,zq.removeArea;var Bq=zq.addLine,Vq=zq.removeLine,Hq=Rq.reducer;function Uq(e,t){return Jq(e)||qq(e,t)||Gq(e,t)||Wq()}function Wq(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gq(e,t){if(e){if(typeof e==`string`)return Kq(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kq(e,t):void 0}}function Kq(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.children,n=Uq((0,w.useState)(`${bg(`recharts`)}-clip`),1)[0],r=DK();if(r==null)return null;var i=r.x,a=r.y,o=r.width,s=r.height;return w.createElement(Yq.Provider,{value:n},w.createElement(`defs`,null,w.createElement(`clipPath`,{id:n},w.createElement(`rect`,{x:i,y:a,height:s,width:o}))),t)},Zq=()=>(0,w.useContext)(Yq),Qq=class{constructor(e){var t=e.x,n=e.y;this.xAxisScale=t,this.yAxisScale=n}map(e,t){var n=t.position;return{x:this.xAxisScale.map(e.x,{position:n})??0,y:this.yAxisScale.map(e.y,{position:n})??0}}mapWithFallback(e,t){var n=t.position,r=t.fallback,i=r===`rangeMin`?this.yAxisScale.rangeMin():r===`rangeMax`?this.yAxisScale.rangeMax():0,a=r===`rangeMin`?this.xAxisScale.rangeMin():r===`rangeMax`?this.xAxisScale.rangeMax():0;return{x:this.xAxisScale.map(e.x,{position:n})??a,y:this.yAxisScale.map(e.y,{position:n})??i}}isInRange(e){var t=e.x,n=e.y,r=t==null||this.xAxisScale.isInRange(t),i=n==null||this.yAxisScale.isInRange(n);return r&&i}};function $q(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 eJ(e){for(var t=1;t{var n;if(w.isValidElement(e))n=w.cloneElement(e,t);else if(typeof e==`function`)n=e(t);else{if(!ZC(t.x1)||!ZC(t.y1)||!ZC(t.x2)||!ZC(t.y2))return null;n=w.createElement(`line`,iJ({},t,{className:`recharts-reference-line-line`}))}return n},oJ=(e,t,n,r,i,a)=>{var o=a.x,s=a.width,c=i.map(e,{position:n});if(!ZC(c)||t===`discard`&&!i.isInRange(c))return null;var l=[{x:o+s,y:c},{x:o,y:c}];return r===`left`?l.reverse():l},sJ=(e,t,n,r,i,a)=>{var o=a.y,s=a.height,c=i.map(e,{position:n});if(!ZC(c)||t===`discard`&&!i.isInRange(c))return null;var l=[{x:c,y:o+s},{x:c,y:o}];return r===`top`?l.reverse():l},cJ=(e,t,n,r)=>{var i=[r.mapWithFallback(e[0],{position:n,fallback:`rangeMin`}),r.mapWithFallback(e[1],{position:n,fallback:`rangeMax`})];return t===`discard`&&i.some(e=>!r.isInRange(e))?null:i},lJ=(e,t,n,r,i,a,o)=>{var s=o.x,c=o.y,l=o.segment,u=o.ifOverflow,d=vg(s);return vg(c)?oJ(c,u,r,a,t,n):d?sJ(s,u,r,i,e,n):l!=null&&l.length===2?cJ(l,u,r,new Qq({x:e,y:t})):null};function uJ(e){var t=lb();return(0,w.useEffect)(()=>(t(Bq(e)),()=>{t(Vq(e))})),null}function dJ(e){var t=e.xAxisId,n=e.yAxisId,r=e.shape,i=e.className,a=e.ifOverflow,o=Kw(),s=Zq(),c=K(e=>CL(e,t)),l=K(e=>EL(e,n)),u=K(e=>rz(e,`xAxis`,t,o)),d=K(e=>rz(e,`yAxis`,n,o)),f=kT();if(!s||!f||c==null||l==null||u==null||d==null)return null;var p=lJ(u,d,f,e.position,c.orientation,l.orientation,e);if(!p)return null;var m=p[0],h=p[1];if(m==null||h==null)return null;var g=m.x,_=m.y,v=h.x,y=h.y,b=eJ(eJ({clipPath:a===`hidden`?`url(#${s})`:void 0},Gh(e)),{},{x1:g,y1:_,x2:v,y2:y}),x=Fq({x1:g,y1:_,x2:v,y2:y});return w.createElement(ZV,{zIndex:e.zIndex},w.createElement(tg,{className:L(`recharts-reference-line`,i)},aJ(r,b),w.createElement(CW,iJ({},x,{lowerWidth:x.width,upperWidth:x.width}),w.createElement(LW,{label:e.label}),e.children)))}var fJ={ifOverflow:`discard`,xAxisId:0,yAxisId:0,fill:`none`,label:!1,stroke:`#ccc`,fillOpacity:1,strokeWidth:1,position:`middle`,zIndex:VA.line};function pJ(e){var t=Nv(e,fJ);return w.createElement(w.Fragment,null,w.createElement(uJ,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x:t.x,y:t.y,segment:t.segment}),w.createElement(dJ,t))}pJ.displayName=`ReferenceLine`;function mJ(){}function hJ(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:Object.prototype.toString.call(e)===`[object Object]`}function gJ(e,t,n){return _J(e,t,void 0,void 0,void 0,void 0,n)}function _J(e,t,n,r,i,a,o){let s=o(e,t,n,r,i,a);if(s!==void 0)return s;if(typeof e==typeof t)switch(typeof e){case`bigint`:case`string`:case`boolean`:case`symbol`:case`undefined`:return e===t;case`number`:return e===t||Object.is(e,t);case`function`:return e===t;case`object`:return vJ(e,t,a,o)}return vJ(e,t,a,o)}function vJ(e,t,n,r){if(Object.is(e,t))return!0;let i=ty(e),a=ty(t);if(i===`[object Arguments]`&&(i=my),a===`[object Arguments]`&&(a=my),i!==a)return!1;switch(i){case ry:return e.toString()===t.toString();case iy:return Fy(e.valueOf(),t.valueOf());case ay:case cy:case sy:return Object.is(e.valueOf(),t.valueOf());case ny:return e.source===t.source&&e.flags===t.flags;case fy:return e===t}n??=new Map;let o=n.get(e),s=n.get(t);if(o!=null&&s!=null)return o===t;n.set(e,t),n.set(t,e);try{switch(i){case ly:if(e.size!==t.size)return!1;for(let[i,a]of e.entries())if(!t.has(i)||!_J(a,t.get(i),i,e,t,n,r))return!1;return!0;case uy:{if(e.size!==t.size)return!1;let i=Array.from(e.values()),a=Array.from(t.values());for(let o=0;o_J(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case dy:case _y:case vy:case yy:case by:case xy:case Sy:case Cy:case wy:case Ty:case Ey:case Dy:if(ky(e)!==ky(t)||e.length!==t.length)return!1;for(let i=0;ie*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function wJ(e,t){return bJ(e,t+1)}function TJ(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:bJ(r,l)};var a=c,d,f=()=>(d===void 0&&(d=n(t,a)),d),p=t.coordinate,m=c===0||CJ(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 EJ(e,t,n,r,i){var a=(r||[]).slice().length;if(a===0)return[];for(var o=t.start,s=t.end,c=1;c<=a;c++){for(var l=(a-1)%c,u=o,d=!0,f=function(){var t=r[m];if(t==null)return 0;var a=m,o,c=()=>(o===void 0&&(o=n(t,a)),o),f=t.coordinate,p=m===l||CJ(e,f,c,u,s);if(!p)return d=!1,1;p&&(u=f+e*(c()/2+i))},p,m=l;m(u===void 0&&(u=n(r,t)),u);if(t===o-1){var f=e*(l.coordinate+e*d()/2-c);a[t]=l=OJ(OJ({},l),{},{tickCoord:f>0?l.coordinate-f*e:l.coordinate})}else a[t]=l=OJ(OJ({},l),{},{tickCoord:l.coordinate});l.tickCoord!=null&&CJ(e,l.tickCoord,d,s,c)&&(c=l.tickCoord-e*(d()/2+i),a[t]=OJ(OJ({},l),{},{isShow:!0}))},u=o-1;u>=0;u--)if(l(u))continue;return a}function NJ(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];if(u!=null){var d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=OJ(OJ({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),u.tickCoord!=null&&CJ(e,u.tickCoord,()=>d,c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=OJ(OJ({},u),{},{isShow:!0}))}}for(var p=a?s-1:s,m=function(t){var r=o[t];if(r==null)return 1;var a=r,s,u=()=>(s===void 0&&(s=n(r,t)),s);if(t===0){var d=e*(a.coordinate-e*u()/2-c);o[t]=a=OJ(OJ({},a),{},{tickCoord:d<0?a.coordinate-d*e:a.coordinate})}else o[t]=a=OJ(OJ({},a),{},{tickCoord:a.coordinate});a.tickCoord!=null&&CJ(e,a.tickCoord,u,c,l)&&(c=a.tickCoord+e*(u()/2+i),o[t]=OJ(OJ({},a),{},{isShow:!0}))},h=0;h{var i=typeof l==`function`?l(e.value,r):e.value;return p===`width`?xJ(mU(i,{fontSize:t,letterSpacing:n}),m,d):mU(i,{fontSize:t,letterSpacing:n})[p]},g=i[0],_=i[1],v=i.length>=2&&g!=null&&_!=null?hg(_.coordinate-g.coordinate):1,y=SJ(a,v,p);return c===`equidistantPreserveStart`?TJ(v,y,h,i,o):c===`equidistantPreserveEnd`?EJ(v,y,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?NJ(v,y,h,i,o,c===`preserveStartEnd`):MJ(v,y,h,i,o),f.filter(e=>e.isShow))}var FJ=e=>{var t=e.ticks,n=e.label,r=e.labelGapWithTick,i=r===void 0?5:r,a=e.tickSize,o=a===void 0?0:a,s=e.tickMargin,c=s===void 0?0:s,l=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>l&&(l=t.width)}});var u=n?n.getBoundingClientRect().width:0,d=o+c,f=l+d+u+(n?i:0);return Math.round(f)}return 0},IJ=e=>{var t=e.ticks,n=e.label,r=e.labelGapWithTick,i=r===void 0?5:r,a=e.tickSize,o=a===void 0?0:a,s=e.tickMargin,c=s===void 0?0:s,l=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.height>l&&(l=t.height)}});var u=n?n.getBoundingClientRect().height:0,d=o+c,f=l+d+u+(n?i:0);return Math.round(f)}return 0},LJ=tC({name:`renderedTicks`,initialState:{xAxis:{},yAxis:{}},reducers:{setRenderedTicks:(e,t)=>{var n=t.payload,r=n.axisType,i=n.axisId,a=n.ticks;e[r][i]=OS(a)},removeRenderedTicks:(e,t)=>{var n=t.payload,r=n.axisType,i=n.axisId;delete e[r][i]}}}),RJ=LJ.actions,zJ=RJ.setRenderedTicks,BJ=RJ.removeRenderedTicks,VJ=LJ.reducer,HJ=[`axisLine`,`width`,`height`,`className`,`hide`,`ticks`,`axisType`,`axisId`];function UJ(e,t){return JJ(e)||qJ(e,t)||GJ(e,t)||WJ()}function WJ(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GJ(e,t){if(e){if(typeof e==`string`)return KJ(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?KJ(e,t):void 0}}function KJ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{if(r!=null&&n!=null){var e=t.map(e=>({value:e.value,coordinate:e.coordinate,offset:e.offset,index:e.index})),o=a.current;o!=null&&o.axisId===r&&o.axisType===n&&yJ(o.ticks,e)||(a.current={ticks:e,axisId:r,axisType:n},i(zJ({ticks:e,axisId:r,axisType:n})))}},[i,t,r,n]),(0,w.useEffect)(()=>r==null||n==null?Og:()=>{i(BJ({axisId:r,axisType:n}))},[i,r,n]),null}var uY=(0,w.forwardRef)((e,t)=>{var n=e.ticks,r=n===void 0?[]:n,i=e.tick,a=e.tickLine,o=e.stroke,s=e.tickFormatter,c=e.unit,l=e.padding,u=e.tickTextProps,d=e.orientation,f=e.mirror,p=e.x,m=e.y,h=e.width,g=e.height,_=e.tickSize,v=e.tickMargin,y=e.fontSize,b=e.letterSpacing,x=e.getTicksConfig,S=e.events,C=e.axisType,T=e.axisId,E=PJ($J($J({},x),{},{ticks:r}),y,b),D=Uh(x),O=Wh(i),k=eW(D.textAnchor)?D.textAnchor:oY(d,f),A=sY(d,f),j={};typeof a==`object`&&(j=a);var M=$J($J({},D),{},{fill:`none`},j),N=E.map(e=>$J({entry:e},aY(e,p,m,h,g,d,_,f,v))),P=N.map(e=>{var t=e.entry,n=e.line;return w.createElement(tg,{className:`recharts-cartesian-axis-tick`,key:`tick-${t.value}-${t.coordinate}-${t.tickCoord}`},a&&w.createElement(`line`,ZJ({},M,n,{className:L(`recharts-cartesian-axis-tick-line`,ug(a,`className`))})))}),F=N.map((e,t)=>{var n=e.entry,r=e.tick,a=$J($J({},$J($J($J($J({verticalAnchor:A},D),{},{textAnchor:k,stroke:`none`,fill:o},r),{},{index:t,payload:n,visibleTicksCount:E.length,tickFormatter:s,padding:l},u),{},{angle:u?.angle??D.angle??0})),O);return w.createElement(tg,ZJ({className:`recharts-cartesian-axis-tick-label`,key:`tick-label-${n.value}-${n.coordinate}-${n.tickCoord}`},Dv(S,n,t)),i&&w.createElement(cY,{option:i,tickProps:a,value:`${typeof s==`function`?s(n.value,t):n.value}${c||``}`}))});return w.createElement(`g`,{className:`recharts-cartesian-axis-ticks recharts-${C}-ticks`},w.createElement(lY,{ticks:E,axisId:T,axisType:C}),F.length>0&&w.createElement(ZV,{zIndex:VA.label},w.createElement(`g`,{className:`recharts-cartesian-axis-tick-labels recharts-${C}-tick-labels`,ref:t},F)),P.length>0&&w.createElement(`g`,{className:`recharts-cartesian-axis-tick-lines recharts-${C}-tick-lines`},P))}),dY=(0,w.forwardRef)((e,t)=>{var n=e.axisLine,r=e.width,i=e.height,a=e.className,o=e.hide,s=e.ticks,c=e.axisType,l=e.axisId,u=YJ(e,HJ),d=UJ((0,w.useState)(``),2),f=d[0],p=d[1],m=UJ((0,w.useState)(``),2),h=m[0],g=m[1],_=(0,w.useRef)(null);(0,w.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>FJ({ticks:_.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin}),getCalculatedHeight:()=>IJ({ticks:_.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}));var v=(0,w.useCallback)(e=>{if(e){var t=e.getElementsByClassName(`recharts-cartesian-axis-tick-value`);_.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==f||a!==h)&&(p(i),g(a))}}},[f,h]);return o||r!=null&&r<=0||i!=null&&i<=0?null:w.createElement(ZV,{zIndex:e.zIndex},w.createElement(tg,{className:L(`recharts-cartesian-axis`,a)},w.createElement(iY,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:Uh(e)}),w.createElement(uY,{ref:v,axisType:c,events:u,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:l}),w.createElement(CW,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},w.createElement(LW,{label:e.label,labelRef:e.labelRef}),e.children)))}),fY=w.forwardRef((e,t)=>{var n=Nv(e,rY);return w.createElement(dY,ZJ({},n,{ref:t}))});fY.displayName=`CartesianAxis`;var pY=(0,w.createContext)({grid:{stroke:`#ccc`,fill:`none`}});pY.Provider;var mY=()=>(0,w.useContext)(pY),hY=[`x1`,`y1`,`x2`,`y2`,`key`],gY=[`offset`],_Y=[`xAxisId`,`yAxisId`],vY=[`xAxisId`,`yAxisId`];function yY(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 bY(e){for(var t=1;t{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 w.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function OY(e){var t=e.option,n=e.lineItemProps,r;if(w.isValidElement(t))r=w.cloneElement(t,n);else if(typeof t==`function`)r=t(n);else{var i=n.x1,a=n.y1,o=n.x2,s=n.y2,c=n.key,l=Uh(TY(n,hY))??{};l.offset;var u=TY(l,gY),d=Array.isArray(u.strokeDasharray)?u.strokeDasharray.join(`,`):u.strokeDasharray;r=w.createElement(`line`,wY({},u,{strokeDasharray:d,x1:i,y1:a,x2:o,y2:s,fill:`none`,key:c}))}return r}function kY(e){var t=e.x,n=e.width,r=e.horizontal,i=r===void 0||r,a=e.horizontalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=TY(e,_Y),s=a.map((e,r)=>{var a=bY(bY({},o),{},{x1:t,y1:e,x2:t+n,y2:e,key:`line-${r}`,index:r});return w.createElement(OY,{key:`line-${r}`,option:i,lineItemProps:a})});return w.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},s)}function AY(e){var t=e.y,n=e.height,r=e.vertical,i=r===void 0||r,a=e.verticalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=TY(e,vY),s=a.map((e,r)=>{var a=bY(bY({},o),{},{x1:e,y1:t,x2:e,y2:t+n,key:`line-${r}`,index:r});return w.createElement(OY,{option:i,lineItemProps:a,key:`line-${r}`})});return w.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},s)}function jY(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||s==null)return null;var l=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,s)=>{var c=l[s+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=s%t.length;return w.createElement(`rect`,{key:`react-${s}`,y:e,x:r,height:u,width:a,stroke:`none`,fill:t[d],fillOpacity:n,className:`recharts-cartesian-grid-bg`})});return w.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},u)}function MY(e){var t=e.vertical,n=t===void 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(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==u[0]&&u.unshift(0);var d=u.map((e,t)=>{var n=u[t+1],l=n==null?a+s-e:n-e;if(l<=0)return null;var d=t%r.length;return w.createElement(`rect`,{key:`react-${t}`,x:e,y:o,width:l,height:c,stroke:`none`,fill:r[d],fillOpacity:i,className:`recharts-cartesian-grid-bg`})});return w.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},d)}var NY=(e,t)=>{var n=e.xAxis,r=e.width,i=e.height,a=e.offset;return sw(PJ(bY(bY(bY({},rY),n),{},{ticks:cw(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},PY=(e,t)=>{var n=e.yAxis,r=e.width,i=e.height,a=e.offset;return sw(PJ(bY(bY(bY({},rY),n),{},{ticks:cw(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},FY={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:VA.grid};function IY(e){var t=MT(),n=NT(),r=jT(),i=bY(bY({},Nv(e,FY)),{},{x:G(e.x)?e.x:r.left,y:G(e.y)?e.y:r.top,width:G(e.width)?e.width:r.width,height:G(e.height)?e.height:r.height}),a=i.xAxisId,o=i.yAxisId,s=i.x,c=i.y,l=i.width,u=i.height,d=i.syncWithTicks,f=i.horizontalValues,p=i.verticalValues,m=Kw(),h=K(e=>Sz(e,`xAxis`,a,m)),g=K(e=>Sz(e,`yAxis`,o,m)),_=mY(),v={stroke:i.stroke??_.grid.stroke,strokeWidth:i.strokeWidth??_.grid.strokeWidth,strokeOpacity:i.strokeOpacity??_.grid.strokeOpacity,strokeDasharray:i.strokeDasharray??_.grid.strokeDasharray};if(!QC(l)||!QC(u)||!G(s)||!G(c))return null;var y=i.verticalCoordinatesGenerator||NY,b=i.horizontalCoordinatesGenerator||PY,x=i.horizontalPoints,S=i.verticalPoints;if((!x||!x.length)&&typeof b==`function`){var C=f&&f.length,T=b({yAxis:g?bY(bY({},g),{},{ticks:C?f:g.ticks}):void 0,width:t??l,height:n??u,offset:r},C?!0:d);$w(Array.isArray(T),`horizontalCoordinatesGenerator should return Array but instead it returned [${typeof T}]`),Array.isArray(T)&&(x=T)}if((!S||!S.length)&&typeof y==`function`){var E=p&&p.length,D=y({xAxis:h?bY(bY({},h),{},{ticks:E?p:h.ticks}):void 0,width:t??l,height:n??u,offset:r},E?!0:d);$w(Array.isArray(D),`verticalCoordinatesGenerator should return Array but instead it returned [${typeof D}]`),Array.isArray(D)&&(S=D)}return w.createElement(ZV,{zIndex:i.zIndex},w.createElement(`g`,{className:`recharts-cartesian-grid`},w.createElement(DY,{fill:i.fill??_.grid.fill,fillOpacity:i.fillOpacity??_.grid.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),w.createElement(jY,wY({},i,{horizontalPoints:x})),w.createElement(MY,wY({},i,{verticalPoints:S})),w.createElement(kY,wY({},i,v,{offset:r,horizontalPoints:x,xAxis:h,yAxis:g})),w.createElement(AY,wY({},i,v,{offset:r,verticalPoints:S,xAxis:h,yAxis:g}))))}IY.displayName=`CartesianGrid`;var LY=tC({name:`errorBars`,initialState:{},reducers:{addErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.errorBar;e[r]||(e[r]=[]),e[r].push(i)},replaceErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.prev,a=n.next;e[r]&&(e[r]=e[r].map(e=>e.dataKey===i.dataKey&&e.direction===i.direction?a:e))},removeErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.errorBar;e[r]&&(e[r]=e[r].filter(e=>e.dataKey!==i.dataKey||e.direction!==i.direction))}}}),RY=LY.actions;RY.addErrorBar,RY.replaceErrorBar,RY.removeErrorBar;var zY=LY.reducer,BY=[`children`];function VY(e,t){if(e==null)return{};var n,r,i=HY(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function WY(e){var t=e.children,n=VY(e,BY);return w.createElement(UY.Provider,{value:n},t)}function GY(e,t){var n=K(t=>CL(t,e)),r=K(e=>EL(e,t)),i=n?.allowDataOverflow??xL.allowDataOverflow,a=r?.allowDataOverflow??wL.allowDataOverflow;return{needClip:i||a,needClipX:i,needClipY:a}}function KY(e){var t=e.xAxisId,n=e.yAxisId,r=e.clipPathId,i=DK(),a=GY(t,n),o=a.needClipX,s=a.needClipY,c=a.needClip,l=K(e=>XR(e,t,!1)),u=K(e=>ZR(e,n,!1));if(!c||!i)return null;var d=i.x,f=i.y,p=i.width,m=i.height,h=o&&l?Math.min(l[0],l[1]):d-p/2,g=s&&u?Math.min(u[0],u[1]):f-m/2,_=o&&l?Math.abs(l[1]-l[0]):p*2,v=s&&u?Math.abs(u[1]-u[0]):m*2;return w.createElement(`clipPath`,{id:`clipPath-${r}`},w.createElement(`rect`,{x:h,y:g,width:_,height:v}))}function qY(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function JY(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var YY=`Invariant failed`;function XY(e,t){if(!e)throw Error(YY)}var ZY=[`option`];function QY(e,t){if(e==null)return{};var n,r,i=$Y(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r1&&arguments[1]!==void 0?arguments[1]:0;return(n,r)=>{if(G(e))return e;var i=G(n)||Tg(n);return i?e(n,r):(!i&&XY(!1,`minPointSize callback function received a value with type of ${typeof n}. Currently only numbers or null/undefined are supported.`),t)}},rX=(e,t,n)=>n,iX=q([PL,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`bar`).find(e=>e.id===t)),aX=q([iX],e=>e?.maxBarSize),oX=(e,t,n,r)=>r,sX=q([FT,PL,qY,JY,rX],(e,t,n,r,i)=>t.filter(t=>e===`horizontal`?t.xAxisId===n:t.yAxisId===r).filter(e=>e.isPanorama===i).filter(e=>e.hide===!1).filter(e=>e.type===`bar`)),cX=(e,t,n)=>{var r=FT(e),i=qY(e,t),a=JY(e,t);if(i!=null&&a!=null)return r===`horizontal`?oR(e,`yAxis`,a,n):oR(e,`xAxis`,i,n)},lX=q([sX,PA,(e,t)=>{var n=FT(e),r=qY(e,t),i=JY(e,t);if(r!=null&&i!=null)return n===`horizontal`?yz(e,`xAxis`,r):yz(e,`yAxis`,i)}],FK),uX=(e,t,n)=>{var r=iX(e,t);if(r==null)return 0;var i=qY(e,t),a=JY(e,t);if(i==null||a==null)return 0;var o=FT(e),s=jA(e),c=r.maxBarSize,l=Tg(c)?s:c,u,d;return o===`horizontal`?(u=Tz(e,`xAxis`,i,n),d=wz(e,`xAxis`,i,n)):(u=Tz(e,`yAxis`,a,n),d=wz(e,`yAxis`,a,n)),bw(u,d,!0)??l??0},dX=(e,t,n)=>{var r=FT(e),i=qY(e,t),a=JY(e,t);if(i!=null&&a!=null){var o,s;return r===`horizontal`?(o=Tz(e,`xAxis`,i,n),s=wz(e,`xAxis`,i,n)):(o=Tz(e,`yAxis`,a,n),s=wz(e,`yAxis`,a,n)),bw(o,s)}},fX=q([Hw,Ww,(e,t,n)=>{var r=qY(e,t);if(r!=null)return Tz(e,`xAxis`,r,n)},(e,t,n)=>{var r=JY(e,t);if(r!=null)return Tz(e,`yAxis`,r,n)},(e,t,n)=>{var r=qY(e,t);if(r!=null)return wz(e,`xAxis`,r,n)},(e,t,n)=>{var r=JY(e,t);if(r!=null)return wz(e,`yAxis`,r,n)},q([q([lX,jA,MA,NA,uX,dX,aX],HK),iX],WK),FT,nA,dX,q([cX,iX],UK),iX,oX],(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{var p=c.chartData,m=c.dataStartIndex,h=c.dataEndIndex;if(!(d==null||o==null||t==null||s!==`horizontal`&&s!==`vertical`||n==null||r==null||i==null||a==null||l==null)){var g=d.data,_=g!=null&&g.length>0?g:p?.slice(m,h+1);if(_!=null)return tZ({layout:s,barSettings:d,pos:o,parentViewBox:t,bandSize:l,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,stackedData:u,displayedData:_,offset:e,cells:f,dataStartIndex:m})}}),pX=[`index`];function mX(){return mX=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=(0,w.useContext)(_X);if(t!=null)return t.stackId;if(e!=null)return fw(e)},yX=(e,t)=>`recharts-bar-stack-clip-path-${e}-${t}`,bX=e=>{var t=(0,w.useContext)(_X);if(t!=null){var n=t.stackId;return`url(#${yX(n,e)})`}},xX=e=>{var t=e.index,n=hX(e,pX),r=bX(t);return w.createElement(tg,mX({className:`recharts-bar-stack-layer`,clipPath:r},n))},SX=[`onMouseEnter`,`onMouseLeave`,`onClick`],CX=[`value`,`background`,`tooltipPosition`],wX=[`id`],TX=[`onMouseEnter`,`onClick`,`onMouseLeave`];function EX(e,t){return jX(e)||AX(e,t)||OX(e,t)||DX()}function DX(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function OX(e,t){if(e){if(typeof e==`string`)return kX(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kX(e,t):void 0}}function kX(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.dataKey,n=e.name,r=e.fill,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:Sw(n,t),payload:e}]},VX=w.memo(e=>{var t=e.dataKey,n=e.stroke,r=e.strokeWidth,i=e.fill,a=e.name,o=e.hide,s=e.unit,c=e.formatter,l=e.tooltipType,u=e.id,d={dataDefinedOnItem:void 0,getPosition:Og,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:Sw(a,t),hide:o,type:l,color:i,unit:s,formatter:c,graphicalItemId:u}};return w.createElement(SG,{tooltipEntrySettings:d})});function HX(e){var t=K(JB),n=e.data,r=e.dataKey,i=e.background,a=e.allOtherBarProps,o=a.onMouseEnter,s=a.onMouseLeave,c=a.onClick,l=RX(a,SX),u=yG(o,r,a.id),d=bG(s),f=xG(c,r,a.id);if(!i||n==null)return null;var p=Wh(i);return w.createElement(ZV,{zIndex:GK(i,VA.barBackground)},n.map((e,n)=>{e.value;var a=e.background;e.tooltipPosition;var o=RX(e,CX);if(!a)return null;var s=u(e,e.originalDataIndex),c=d(e,e.originalDataIndex),m=f(e,e.originalDataIndex),h=PX(PX(PX(PX(PX({option:i,isActive:String(e.originalDataIndex)===t},o),{},{fill:`#eee`},a),p),Dv(l,e,n)),{},{onMouseEnter:s,onMouseLeave:c,onClick:m,dataKey:r,index:n,className:`recharts-bar-background-rectangle`});return w.createElement(tX,MX({key:`background-bar-${n}`},h))}))}function UX(e){var t=e.showLabels,n=e.children,r=e.rects?.map(e=>{var t={x:e.x,y:e.y,width:e.width,lowerWidth:e.width,upperWidth:e.width,height:e.height};return PX(PX({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return w.createElement(GW,{value:t?r:void 0},n)}function WX(e){var t=e.shape,n=e.activeBar,r=e.baseProps,i=e.entry,a=e.index,o=e.dataKey,s=K(JB),c=K(XB),l=n&&String(i.originalDataIndex)===s&&(c==null||o===c),u=s!=null&&(String(i.originalDataIndex)!==s||c!=null&&o!==c),d=EX((0,w.useState)(!1),2),f=d[0],p=d[1],m=EX((0,w.useState)(!1),2),h=m[0],g=m[1];(0,w.useEffect)(()=>{var e;return l?(p(!0),e=requestAnimationFrame(()=>{g(!0)})):(g(!1),u&&p(!1)),()=>{cancelAnimationFrame(e)}},[l,u]);var _=(0,w.useCallback)(()=>{l||p(!1)},[l]),v=l&&h,y=l||f,b=l?n===!0?t:n:t,x=w.createElement(tX,MX({},r,{name:String(r.name)},i,{isActive:v,option:b,index:a,dataKey:o,animationElapsedTime:e.animationElapsedTime,isAnimating:e.isAnimating,isEntrance:e.isEntrance,onTransitionEnd:_}));return y?w.createElement(ZV,{zIndex:VA.activeBar},w.createElement(xX,{index:i.originalDataIndex},x)):x}function GX(e){var t=e.shape,n=e.baseProps,r=e.entry,i=e.index,a=e.dataKey;return w.createElement(tX,MX({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:a,animationElapsedTime:e.animationElapsedTime,isAnimating:e.isAnimating,isEntrance:e.isEntrance}))}function KX(e){var t=e.data,n=e.props,r=e.animationElapsedTime,i=e.isAnimating,a=e.isEntrance,o=Uh(n)??{},s=o.id,c=RX(o,wX),l=n.shape,u=n.dataKey,d=n.activeBar,f=n.onMouseEnter,p=n.onClick,m=n.onMouseLeave,h=RX(n,TX),g=yG(f,u,s),_=bG(m),v=xG(p,u,s);return t?w.createElement(w.Fragment,null,t.map((e,t)=>w.createElement(xX,MX({index:e.originalDataIndex,key:`rectangle-${e?.x}-${e?.y}-${e?.value}-${t}`,className:`recharts-bar-rectangle`},Dv(h,e,t),{onMouseEnter:g(e,e.originalDataIndex),onMouseLeave:_(e,e.originalDataIndex),onClick:v(e,e.originalDataIndex)}),d?w.createElement(WX,{shape:l,activeBar:d,baseProps:c,entry:e,index:t,dataKey:u,animationElapsedTime:r,isAnimating:i,isEntrance:a}):w.createElement(GX,{shape:l,baseProps:c,entry:e,index:t,dataKey:u,animationElapsedTime:r,isAnimating:i,isEntrance:a})))):null}var qX=(e,t,n)=>e==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>{if(e.status===`removed`)return n===`horizontal`?[PX(PX({},e.prev),{},{height:Cg(e.prev.height,0,t),y:Cg(e.prev.y,e.prev.y+e.prev.height,t)})]:[PX(PX({},e.prev),{},{width:Cg(e.prev.width,0,t)})];if(e.status===`matched`)return[PX(PX({},e.next),{},{x:Cg(e.prev.x,e.next.x,t),y:Cg(e.prev.y,e.next.y,t),width:Cg(e.prev.width,e.next.width,t),height:Cg(e.prev.height,e.next.height,t)})];var r=e.next;return n===`horizontal`?[PX(PX({},r),{},{height:Cg(0,r.height,t),y:Cg(r.stackedBarStart,r.y,t)})]:[PX(PX({},r),{},{width:Cg(0,r.width,t),x:Cg(r.stackedBarStart,r.x,t)})]});function JX(e){var t=e.props,n=e.previousRectanglesRef,r=t.data,i=t.isAnimationActive,a=t.animationBegin,o=t.animationDuration,s=t.animationEasing,c=t.animationInterpolateFn,l=t.layout,u=GG(t.onAnimationStart,t.onAnimationEnd),d=u.isAnimating,f=u.handleAnimationStart,p=u.handleAnimationEnd;return w.createElement(UX,{showLabels:!d,rects:r},w.createElement(KG,{animationInput:r,animationIdPrefix:`recharts-bar-`,items:r,previousItemsRef:n,isAnimationActive:i,animationBegin:a,animationDuration:o,animationEasing:s,onAnimationStart:f,onAnimationEnd:p,animationInterpolateFn:c,animationMatchBy:t.animationMatchBy,layout:l},(e,n,r)=>w.createElement(tg,null,w.createElement(KX,{props:t,data:e,animationElapsedTime:n,isAnimating:d||n<1,isEntrance:r}))),w.createElement(XW,{label:t.label}),t.children)}function YX(e){var t=(0,w.useRef)(null);return w.createElement(JX,{previousRectanglesRef:t,props:e})}var XX=0,ZX=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:iw(e,t)}},QX=class extends w.PureComponent{render(){var e=this.props,t=e.hide,n=e.data,r=e.dataKey,i=e.className,a=e.xAxisId,o=e.yAxisId,s=e.needClip,c=e.background,l=e.id;if(t||n==null)return null;var u=L(`recharts-bar`,i),d=l;return w.createElement(tg,{className:u,id:l},s&&w.createElement(`defs`,null,w.createElement(KY,{clipPathId:d,xAxisId:a,yAxisId:o})),w.createElement(tg,{className:`recharts-bar-rectangles`,clipPath:s?`url(#clipPath-${d})`:void 0},w.createElement(HX,{data:n,dataKey:r,background:c,allOtherBarProps:this.props}),w.createElement(YX,this.props)))}},$X={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:`ease`,animationInterpolateFn:qX,animationMatchBy:jG,background:!1,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`rect`,minPointSize:XX,shape:eX,xAxisId:0,yAxisId:0,zIndex:VA.bar};function eZ(e){var t=e.xAxisId,n=e.yAxisId,r=e.hide,i=e.legendType,a=e.minPointSize,o=e.activeBar,s=e.animationBegin,c=e.animationDuration,l=e.animationEasing,u=e.isAnimationActive,d=GY(t,n).needClip,f=IT(),p=Kw(),m=sG(e.children,QH),h=K(t=>fX(t,e.id,p,m));if(f!==`vertical`&&f!==`horizontal`)return null;var g,_=h?.[0];return g=_==null||_.height==null||_.width==null?0:f===`vertical`?_.height/2:_.width/2,w.createElement(WY,{xAxisId:t,yAxisId:n,data:h,dataPointFormatter:ZX,errorBarOffset:g},w.createElement(QX,MX({},e,{layout:f,needClip:d,data:h,xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:o,animationBegin:s,animationDuration:c,animationEasing:l,isAnimationActive:u})))}function tZ(e){var t=e.layout,n=e.barSettings,r=n.dataKey,i=n.minPointSize,a=n.hasCustomShape,o=e.pos,s=e.bandSize,c=e.xAxis,l=e.yAxis,u=e.xAxisTicks,d=e.yAxisTicks,f=e.stackedData,p=e.displayedData,m=e.offset,h=e.cells,g=e.parentViewBox,_=e.dataStartIndex,v=t===`horizontal`?l:c,y=f?v.scale.domain():null,b=mw({numericAxis:v}),x=v.scale.map(b);return p.map((e,n)=>{var p,v,S,C,w,T;if(f){var E=f[n+_];if(E==null)return null;p=lw(E,y)}else p=iw(e,r),Array.isArray(p)||(p=[b,p]);var D=nX(i,XX)(p[1],n);if(t===`horizontal`){var O=l.scale.map(p[0]),k=l.scale.map(p[1]);if(O==null||k==null)return null;v=pw({axis:c,ticks:u,bandSize:s,offset:o.offset,entry:e,index:n}),S=k??O??void 0,C=o.size;var A=O-k;if(w=gg(A)?0:A,T={x:v,y:m.top,width:C,height:m.height},Math.abs(D)>0&&Math.abs(w)0&&Math.abs(C)w.createElement(w.Fragment,null,w.createElement(CG,{legendPayload:BX(t)}),w.createElement(VX,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),w.createElement(lK,{type:`bar`,id:e,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:n,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r,hasCustomShape:t.shape!=null&&t.shape!==eX}),w.createElement(ZV,{zIndex:t.zIndex},w.createElement(eZ,MX({},t,{id:e})))))}var rZ=w.memo(nZ,pE);rZ.displayName=`Bar`;var iZ=[`domain`,`range`],aZ=[`domain`,`range`];function oZ(e,t){if(e==null)return{};var n,r,i=sZ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{if(o!=null)return hZ(hZ({},a),{},{type:o})},[a,o]);return(0,w.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(_K(s)):n.current!==s&&t(vK({prev:n.current,next:s})),n.current=s)},[s,t]),(0,w.useLayoutEffect)(()=>()=>{n.current&&=(t(yK(n.current)),null)},[t]),null}var SZ=e=>{var t=e.xAxisId,n=e.className,r=e.height,i=e.label,a=(0,w.useRef)(null),o=(0,w.useRef)(null),s=K(Ww),c=Kw(),l=lb(),u=`xAxis`,d=K(e=>Cz(e,u,t,c)),f=K(e=>dz(e,t)),p=K(e=>gz(e,t)),m=K(e=>SL(e,t));if((0,w.useLayoutEffect)(()=>{if(!(r!==`auto`||!f||OW(i)||(0,w.isValidElement)(i)||m==null)){var e=a.current;if(e){var n=e.getCalculatedHeight();Math.round(f.height)!==Math.round(n)&&l(wK({id:t,height:n}))}}},[d,f,l,i,t,r,m]),f==null||p==null||m==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var h=yZ(e,dZ);m.id,m.scale;var g=yZ(m,fZ);return w.createElement(fY,pZ({},h,g,{ref:a,labelRef:o,x:p.x,y:p.y,width:f.width,height:f.height,className:L(`recharts-${u} ${u}`,n),viewBox:s,ticks:d,axisType:u,axisId:t}))},CZ={allowDataOverflow:xL.allowDataOverflow,allowDecimals:xL.allowDecimals,allowDuplicatedCategory:xL.allowDuplicatedCategory,angle:xL.angle,axisLine:rY.axisLine,height:xL.height,hide:!1,includeHidden:xL.includeHidden,interval:xL.interval,label:!1,minTickGap:xL.minTickGap,mirror:xL.mirror,orientation:xL.orientation,padding:xL.padding,reversed:xL.reversed,scale:xL.scale,tick:xL.tick,tickCount:xL.tickCount,tickLine:rY.tickLine,tickSize:rY.tickSize,type:xL.type,niceTicks:xL.niceTicks,xAxisId:0},wZ=w.memo(e=>{var t=Nv(e,CZ);return w.createElement(w.Fragment,null,w.createElement(xZ,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),w.createElement(SZ,t))},lZ);wZ.displayName=`XAxis`;var TZ=[`type`],EZ=[`dangerouslySetInnerHTML`,`ticks`,`scale`],DZ=[`id`,`scale`];function OZ(){return OZ=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(o!=null)return AZ(AZ({},a),{},{type:o})},[o,a]);return(0,w.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(bK(s)):n.current!==s&&t(xK({prev:n.current,next:s})),n.current=s)},[s,t]),(0,w.useLayoutEffect)(()=>()=>{n.current&&=(t(SK(n.current)),null)},[t]),null}function LZ(e){var t=e.yAxisId,n=e.className,r=e.width,i=e.label,a=(0,w.useRef)(null),o=(0,w.useRef)(null),s=K(Ww),c=Kw(),l=lb(),u=`yAxis`,d=K(e=>vz(e,t)),f=K(e=>_z(e,t)),p=K(e=>Cz(e,u,t,c)),m=K(e=>TL(e,t));if((0,w.useLayoutEffect)(()=>{if(!(r!==`auto`||!d||OW(i)||(0,w.isValidElement)(i)||m==null)){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&l(CK({id:t,width:n}))}}},[p,d,l,i,t,r,m]),d==null||f==null||m==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var h=PZ(e,EZ);m.id,m.scale;var g=PZ(m,DZ);return w.createElement(fY,OZ({},h,g,{ref:a,labelRef:o,x:f.x,y:f.y,tickTextProps:r===`auto`?{width:void 0}:{width:r},width:d.width,height:d.height,className:L(`recharts-${u} ${u}`,n),viewBox:s,ticks:p,axisType:u,axisId:t}))}var RZ={allowDataOverflow:wL.allowDataOverflow,allowDecimals:wL.allowDecimals,allowDuplicatedCategory:wL.allowDuplicatedCategory,angle:wL.angle,axisLine:rY.axisLine,hide:!1,includeHidden:wL.includeHidden,interval:wL.interval,label:!1,minTickGap:wL.minTickGap,mirror:wL.mirror,orientation:wL.orientation,padding:wL.padding,reversed:wL.reversed,scale:wL.scale,tick:wL.tick,tickCount:wL.tickCount,tickLine:rY.tickLine,tickSize:rY.tickSize,type:wL.type,niceTicks:wL.niceTicks,width:wL.width,yAxisId:0},zZ=w.memo(e=>{var t=Nv(e,RZ);return w.createElement(w.Fragment,null,w.createElement(IZ,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),w.createElement(LZ,t))},lZ);zZ.displayName=`YAxis`;var BZ=q([(e,t)=>t,FT,sj,gj,VB,UB,xV,Hw],NV);function VZ(e){return`getBBox`in e.currentTarget&&typeof e.currentTarget.getBBox==`function`}function HZ(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(VZ(e)){var i=e.currentTarget.getBBox();n=i.width>0?t.width/i.width:1,r=i.height>0?t.height/i.height:1}else{var a=e.currentTarget;n=a.offsetWidth>0?t.width/a.offsetWidth:1,r=a.offsetHeight>0?t.height/a.offsetHeight:1}var o=(e,i)=>({relativeX:Math.round((e-t.left)/n),relativeY:Math.round((i-t.top)/r)});return`touches`in e?Array.from(e.touches).map(e=>o(e.clientX,e.clientY)):o(e.clientX,e.clientY)}var UZ=NS(`mouseClick`),WZ=VC();WZ.startListening({actionCreator:UZ,effect:(e,t)=>{var n=e.payload,r=BZ(t.getState(),HZ(n));r?.activeIndex!=null&&t.dispatch(Kz({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var GZ=NS(`mouseMove`),KZ=VC(),qZ=null,JZ=null,YZ=null;KZ.startListening({actionCreator:GZ,effect:(e,t)=>{var n=e.payload,r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a?.includes(`mousemove`);qZ!==null&&(cancelAnimationFrame(qZ),qZ=null),JZ!==null&&(typeof i!=`number`||!o)&&(clearTimeout(JZ),JZ=null),YZ=HZ(n);var s=()=>{var e=t.getState(),n=Az(e,e.tooltip.settings.shared);if(!YZ){qZ=null,JZ=null;return}if(n===`axis`){var r=BZ(e,YZ);r?.activeIndex==null?t.dispatch(Uz()):t.dispatch(Gz({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}qZ=null,JZ=null};if(!o){s();return}i===`raf`?qZ=requestAnimationFrame(s):typeof i==`number`&&JZ===null&&(JZ=setTimeout(s,i))}});function XZ(e,t){return t instanceof HTMLElement?`HTMLElement <${t.tagName} class="${t.className}">`:t===window?`global.window`:e===`children`&&typeof t==`object`&&t?`<>`:t}var ZZ={accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:`none`,syncId:void 0,syncMethod:`index`,baseValue:void 0,reverseStackOrder:!1},QZ=tC({name:`rootProps`,initialState:ZZ,reducers:{updateOptions:(e,t)=>{e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=t.payload.barGap??ZZ.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),$Z=QZ.reducer,eQ=QZ.actions.updateOptions,tQ=tC({name:`polarOptions`,initialState:null,reducers:{updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)}});tQ.actions.updatePolarOptions;var nQ=tQ.reducer,rQ=NS(`keyDown`),iQ=NS(`focus`),aQ=NS(`blur`),oQ=VC(),sQ=null,cQ=null,lQ=null;oQ.startListening({actionCreator:rQ,effect:(e,t)=>{lQ=e.payload,sQ!==null&&(cancelAnimationFrame(sQ),sQ=null);var n=t.getState().eventSettings,r=n.throttleDelay,i=n.throttledEvents,a=i===`all`||i.includes(`keydown`);cQ!==null&&(typeof r!=`number`||!a)&&(clearTimeout(cQ),cQ=null);var o=()=>{try{var e=t.getState();if(e.rootProps.accessibilityLayer===!1)return;var n=e.tooltip.keyboardInteraction,r=lQ;if(r!==`ArrowRight`&&r!==`ArrowLeft`&&r!==`Enter`)return;var i=sB(n,kB(e),rR(e),RB(e)),a=i==null?-1:Number(i),o=!Number.isFinite(a)||a<0,s=UB(e),c=kB(e),l=Az(e,e.tooltip.settings.shared);if(r===`Enter`){if(o)return;var u=EV(e,l,`hover`,String(n.index));t.dispatch(Jz({active:!n.active,activeIndex:n.index,activeCoordinate:u}));return}var d=Ez(e)===`left-to-right`?1:-1,f=r===`ArrowRight`?1:-1,p;if(o){var m=rR(e),h=RB(e),g=f*d,_=e=>({active:!1,index:String(e),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(p=-1,g>0){for(var v=0;v=0;y--)if(sB(_(y),c,m,h)!=null){p=y;break}if(p<0)return}else{p=a+f*d;var b=s?.length||c.length;if(b===0||p>=b||p<0)return}var x=EV(e,l,`hover`,String(p));t.dispatch(Jz({active:!0,activeIndex:p.toString(),activeCoordinate:x}))}finally{sQ=null,cQ=null}};if(!a){o();return}r===`raf`?sQ=requestAnimationFrame(o):typeof r==`number`&&cQ===null&&(o(),lQ=null,cQ=setTimeout(()=>{lQ?o():(cQ=null,sQ=null)},r))}}),oQ.startListening({actionCreator:iQ,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;if(!r.active&&r.index==null){var i=`0`,a=EV(n,Az(n,n.tooltip.settings.shared),`hover`,String(i));t.dispatch(Jz({active:!0,activeIndex:i,activeCoordinate:a}))}}}}),oQ.startListening({actionCreator:aQ,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;r.active&&t.dispatch(Jz({active:!1,activeIndex:r.index,activeCoordinate:r.coordinate}))}}});function uQ(e){e.persist();var t=e.currentTarget;return new Proxy(e,{get:(e,n)=>{if(n===`currentTarget`)return t;var r=Reflect.get(e,n);return typeof r==`function`?r.bind(e):r}})}var dQ=NS(`externalEvent`),fQ=VC(),pQ=new Map,mQ=new Map,hQ=new Map;fQ.startListening({actionCreator:dQ,effect:(e,t)=>{var n=e.payload,r=n.handler,i=n.reactEvent;if(r!=null){var a=i.type,o=uQ(i);hQ.set(a,{handler:r,reactEvent:o});var s=pQ.get(a);s!==void 0&&(cancelAnimationFrame(s),pQ.delete(a));var c=t.getState().eventSettings,l=c.throttleDelay,u=c.throttledEvents,d=u===`all`||u?.includes(a),f=mQ.get(a);f!==void 0&&(typeof l!=`number`||!d)&&(clearTimeout(f),mQ.delete(a));var p=()=>{var e=hQ.get(a);try{if(!e)return;var n=e.handler,r=e.reactEvent,i=t.getState(),o={activeCoordinate:$B(i),activeDataKey:XB(i),activeIndex:JB(i),activeLabel:YB(i),activeTooltipIndex:JB(i),isTooltipActive:eV(i)};n&&n(o,r)}finally{pQ.delete(a),mQ.delete(a),hQ.delete(a)}};if(!d){p();return}if(l===`raf`){var m=requestAnimationFrame(p);pQ.set(a,m)}else if(typeof l==`number`){if(!mQ.has(a)){p();var h=setTimeout(p,l);mQ.set(a,h)}}else p()}}});var gQ=q([q([dB],e=>e.tooltipItemPayloads),(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(e=>e.settings.graphicalItemId===n);if(r!=null){var i=r.getPosition;if(i!=null)return i(t)}}}),_Q=NS(`touchMove`),vQ=VC(),yQ=null,bQ=null,xQ=null,SQ=null;vQ.startListening({actionCreator:_Q,effect:(e,t)=>{var n=e.payload;if(n.touches!=null&&n.touches.length!==0){SQ=uQ(n);var r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a.includes(`touchmove`);yQ!==null&&(cancelAnimationFrame(yQ),yQ=null),bQ!==null&&(typeof i!=`number`||!o)&&(clearTimeout(bQ),bQ=null),xQ=Array.from(n.touches).map(e=>HZ({clientX:e.clientX,clientY:e.clientY,currentTarget:n.currentTarget}));var s=()=>{if(SQ!=null){var e=t.getState(),n=Az(e,e.tooltip.settings.shared);if(n===`axis`){var r=xQ?.[0];if(r==null){yQ=null,bQ=null;return}var i=BZ(e,r);i?.activeIndex!=null&&t.dispatch(Gz({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}else if(n===`item`){var a=SQ.touches[0];if(document.elementFromPoint==null||a==null)return;var o=document.elementFromPoint(a.clientX,a.clientY);if(!o||!o.getAttribute)return;var s=o.getAttribute(jw),c=o.getAttribute(`data-recharts-item-id`)??void 0,l=TB(e).find(e=>e.id===c);if(s==null||l==null||c==null)return;var u=l.dataKey,d=gQ(e,s,c);t.dispatch(Vz({activeDataKey:u,activeIndex:s,activeCoordinate:d,activeGraphicalItemId:c}))}yQ=null,bQ=null}};if(!o){s();return}i===`raf`?yQ=requestAnimationFrame(s):typeof i==`number`&&bQ===null&&(s(),SQ=null,bQ=setTimeout(()=>{SQ?s():(bQ=null,yQ=null)},i))}}});var CQ={throttleDelay:`raf`,throttledEvents:[`mousemove`,`touchmove`,`pointermove`,`scroll`,`wheel`]},wQ=tC({name:`eventSettings`,initialState:CQ,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=OS(t.payload.throttledEvents))}}}),TQ=wQ.actions.setEventSettings,EQ=wQ.reducer,DQ=nx({brush:cq,cartesianAxis:TK,chartData:SH,errorBars:zY,eventSettings:EQ,graphicalItems:cK,layout:YC,legend:JT,options:hH,polarAxis:$W,polarOptions:nQ,referenceElements:Hq,renderedTicks:VJ,rootProps:$Z,tooltip:Yz,zIndex:XV}),OQ=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Chart`;return GS({reducer:DQ,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:![`commonjs`,`es6`,`production`].includes(`es6`)}).concat([WZ.middleware,KZ.middleware,oQ.middleware,fQ.middleware,vQ.middleware]),enhancers:e=>{var t=e;return typeof e==`function`&&(t=e()),t.concat(US({type:`raf`}))},devTools:dD.devToolsEnabled&&{serialize:{replacer:XZ},name:`recharts-${t}`}})};function kQ(e){var t=e.preloadedState,n=e.children,r=e.reduxStoreName,i=Kw(),a=(0,w.useRef)(null);if(i)return n;a.current??=OQ(t,r);var o=ob;return w.createElement(uE,{context:o,store:a.current},n)}function AQ(e){var t=e.layout,n=e.margin,r=lb(),i=Kw();return(0,w.useEffect)(()=>{i||(r(KC(t)),r(GC(n)))},[r,i,t,n]),null}var jQ=(0,w.memo)(AQ,pE);function MQ(e){var t=lb();return(0,w.useEffect)(()=>{t(eQ(e))},[t,e]),null}var NQ=(0,w.memo)(e=>{var t=lb();return(0,w.useEffect)(()=>{t(TQ(e))},[t,e]),null},pE);function PQ(e){var t=e.zIndex,n=e.isPanorama,r=(0,w.useRef)(null),i=lb();return(0,w.useLayoutEffect)(()=>(r.current&&i(JV({zIndex:t,element:r.current,isPanorama:n})),()=>{i(YV({zIndex:t,isPanorama:n}))}),[i,t,n]),w.createElement(`g`,{tabIndex:-1,ref:r,className:`recharts-zIndex-layer_${t}`})}function FQ(e){var t=e.children,n=e.isPanorama,r=K(FV);if(!r||r.length===0)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return w.createElement(w.Fragment,null,i.map(e=>w.createElement(PQ,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>w.createElement(PQ,{key:e,zIndex:e,isPanorama:n})))}var IQ=[`children`];function LQ(e,t){if(e==null)return{};var n,r,i=RQ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=MT(),r=NT(),i=ND();if(!QC(n)||!QC(r))return null;var a=e.children,o=e.otherAttributes,s=e.title,c=e.desc,l,u;return o!=null&&(l=typeof o.tabIndex==`number`?o.tabIndex:i?0:void 0,u=typeof o.role==`string`?o.role:i?`application`:void 0),w.createElement(Xh,zQ({},o,{title:s,desc:c,role:u,tabIndex:l,width:n,height:r,style:BQ,ref:t}),a)}),HQ=e=>{var t=e.children,n=K(Yw);if(!n)return null;var r=n.width,i=n.height,a=n.y,o=n.x;return w.createElement(Xh,{width:r,height:i,x:o,y:a},t)},UQ=(0,w.forwardRef)((e,t)=>{var n=e.children,r=LQ(e,IQ);return Kw()?w.createElement(HQ,null,w.createElement(FQ,{isPanorama:!0},n)):w.createElement(VQ,zQ({ref:t},r),w.createElement(FQ,{isPanorama:!1},n))});function WQ(e,t){return YQ(e)||JQ(e,t)||KQ(e,t)||GQ()}function GQ(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function KQ(e,t){if(e){if(typeof e==`string`)return qQ(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qQ(e,t):void 0}}function qQ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{if(n!=null){var t=n.getBoundingClientRect().width/n.offsetWidth;ZC(t)&&t!==i&&e(JC(t))}},[n,e,i]),r}function ZQ(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 QQ(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n(NH(),null);function u$(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var d$=(0,w.forwardRef)((e,t)=>{var n=(0,w.useRef)(null),r=r$((0,w.useState)({containerWidth:u$(e.style?.width),containerHeight:u$(e.style?.height)}),2),i=r[0],a=r[1],o=(0,w.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,w.useCallback)(e=>{if(typeof t==`function`&&t(e),n.current!=null&&(n.current.disconnect(),n.current=null),e!=null&&typeof ResizeObserver<`u`){var r=e.getBoundingClientRect(),i=r.width,a=r.height;o(i,a);var s=new ResizeObserver(e=>{var t=e[0];if(t!=null){var n=t.contentRect,r=n.width,i=n.height;o(r,i)}});s.observe(e),n.current=s}},[t,o]);return(0,w.useEffect)(()=>()=>{n.current?.disconnect()},[o]),w.createElement(w.Fragment,null,w.createElement(BT,{width:i.containerWidth,height:i.containerHeight}),w.createElement(`div`,n$({ref:s},e)))}),f$=(0,w.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=r$((0,w.useState)({containerWidth:u$(n),containerHeight:u$(r)}),2),a=i[0],o=i[1],s=(0,w.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),c=(0,w.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var n=e.getBoundingClientRect(),r=n.width,i=n.height;s(r,i)}},[t,s]);return w.createElement(w.Fragment,null,w.createElement(BT,{width:a.containerWidth,height:a.containerHeight}),w.createElement(`div`,n$({ref:c},e)))}),p$=(0,w.forwardRef)((e,t)=>{var n=e.width,r=e.height;return w.createElement(w.Fragment,null,w.createElement(BT,{width:n,height:r}),w.createElement(`div`,n$({ref:t},e)))}),m$=(0,w.forwardRef)((e,t)=>{var n=e.width,r=e.height;return typeof n==`string`||typeof r==`string`?w.createElement(f$,n$({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?w.createElement(p$,n$({},e,{width:n,height:r,ref:t})):w.createElement(w.Fragment,null,w.createElement(BT,{width:n,height:r}),w.createElement(`div`,n$({ref:t},e)))});function h$(e){return e?d$:m$}var g$=(0,w.forwardRef)((e,t)=>{var n=e.children,r=e.className,i=e.height,a=e.onClick,o=e.onContextMenu,s=e.onDoubleClick,c=e.onMouseDown,l=e.onMouseEnter,u=e.onMouseLeave,d=e.onMouseMove,f=e.onMouseUp,p=e.onTouchEnd,m=e.onTouchMove,h=e.onTouchStart,g=e.style,_=e.width,v=e.responsive,y=e.dispatchTouchEvents,b=y===void 0||y,x=(0,w.useRef)(null),S=lb(),C=r$((0,w.useState)(null),2),T=C[0],E=C[1],D=r$((0,w.useState)(null),2),O=D[0],k=D[1],A=XQ(),j=ET(),M=j?.width>0?j.width:_,N=j?.height>0?j.height:i,P=(0,w.useCallback)(e=>{A(e),typeof t==`function`&&t(e),E(e),k(e),e!=null&&(x.current=e)},[A,t,E,k]),F=(0,w.useCallback)(e=>{S(UZ(e)),S(dQ({handler:a,reactEvent:e}))},[S,a]),ee=(0,w.useCallback)(e=>{S(GZ(e)),S(dQ({handler:l,reactEvent:e}))},[S,l]),te=(0,w.useCallback)(e=>{S(Uz()),S(dQ({handler:u,reactEvent:e}))},[S,u]),ne=(0,w.useCallback)(e=>{S(GZ(e)),S(dQ({handler:d,reactEvent:e}))},[S,d]),re=(0,w.useCallback)(()=>{S(iQ())},[S]),ie=(0,w.useCallback)(()=>{S(aQ())},[S]),I=(0,w.useCallback)(e=>{S(rQ(e.key))},[S]),ae=(0,w.useCallback)(e=>{S(dQ({handler:o,reactEvent:e}))},[S,o]),oe=(0,w.useCallback)(e=>{S(dQ({handler:s,reactEvent:e}))},[S,s]),se=(0,w.useCallback)(e=>{S(dQ({handler:c,reactEvent:e}))},[S,c]),ce=(0,w.useCallback)(e=>{S(dQ({handler:f,reactEvent:e}))},[S,f]),le=(0,w.useCallback)(e=>{S(dQ({handler:h,reactEvent:e}))},[S,h]),ue=(0,w.useCallback)(e=>{b&&S(_Q(e)),S(dQ({handler:m,reactEvent:e}))},[S,b,m]),de=(0,w.useCallback)(e=>{S(dQ({handler:p,reactEvent:e}))},[S,p]),fe=h$(v);return w.createElement(sH.Provider,{value:T},w.createElement(Rg.Provider,{value:O},w.createElement(fe,{width:M??g?.width,height:N??g?.height,className:L(`recharts-wrapper`,r),style:QQ({position:`relative`,cursor:`default`,width:M,height:N},g),onClick:F,onContextMenu:ae,onDoubleClick:oe,onFocus:re,onBlur:ie,onKeyDown:I,onMouseDown:se,onMouseEnter:ee,onMouseLeave:te,onMouseMove:ne,onMouseUp:ce,onTouchEnd:de,onTouchMove:ue,onTouchStart:le,ref:P},w.createElement(l$,null),n)))}),_$=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function v$(e,t){if(e==null)return{};var n,r,i=y$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=e.width,r=e.height,i=e.responsive,a=e.children,o=e.className,s=e.style,c=e.compact,l=e.title,u=e.desc,d=Uh(v$(e,_$));return c?w.createElement(w.Fragment,null,w.createElement(BT,{width:n,height:r}),w.createElement(UQ,{otherAttributes:d,title:l,desc:u},a)):w.createElement(g$,{className:o,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},w.createElement(UQ,{otherAttributes:d,title:l,desc:u,ref:t},w.createElement(Xq,null,a)))});function x$(){return x$=Object.assign?Object.assign.bind():function(e){for(var t=1;tw.createElement(O$,{chartName:`BarChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:k$,tooltipPayloadSearcher:pH,categoricalChartProps:e,ref:t})),j$={},M$=V(e=>{let t=z(`ChartBrush`,j$,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,attributes:c,...l}=t,u=B({name:`ChartBrush`,classes:Lh,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:c});return(0,R.jsx)(Nq,{dy:8,stroke:`var(--chart-grid-color)`,fill:`var(--mantine-color-body)`,...l,...u(`brush`)})});M$.classes=Lh,M$.displayName=`@mantine/charts/ChartBrush`;var N$={root:`m_a50f3e58`,container:`m_af9188cb`,grid:`m_a50a48bc`,axis:`m_a507a517`,axisLabel:`m_2293801d`,tooltip:`m_92b296cd`};function P$(e){return`${(e*100).toFixed(0)}%`}var F$={withXAxis:!0,withYAxis:!0,withTooltip:!0,tooltipAnimationDuration:0,fillOpacity:1,tickLine:`y`,strokeDasharray:`5 5`,gridAxis:`x`,type:`default`,accessibilityLayer:!0},I$=qe((e,{textColor:t,gridColor:n,cursorFill:r,barLabelColor:i})=>({root:{"--chart-text-color":t?ft(t,e):void 0,"--chart-grid-color":n?ft(n,e):void 0,"--chart-cursor-fill":r?ft(r,e):void 0,"--chart-bar-label-color":i?ft(i,e):void 0}}));function L$(e,t){let n=0,r=0;return e.map(e=>{if(e.standalone)for(let n in e)typeof e[n]==`number`&&n!==t&&(e[n]=[0,e[n]]);else for(let i in e)typeof e[i]==`number`&&i!==t&&(r+=e[i],e[i]=[n,r],n=r);return e})}function R$(e,t){return typeof e==`function`?e(t).fill:e?.fill}var z$=V(e=>{let t=z(`BarChart`,F$,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,data:c,withLegend:l,legendProps:u,series:d,onMouseLeave:f,dataKey:p,withTooltip:m,withXAxis:h,withYAxis:g,gridAxis:_,tickLine:v,xAxisProps:y,yAxisProps:b,unit:x,tooltipAnimationDuration:S,strokeDasharray:C,gridProps:T,tooltipProps:E,referenceLines:D,fillOpacity:O,barChartProps:k,type:A,orientation:j,dir:M,valueFormatter:N,children:P,barProps:F,xAxisLabel:ee,yAxisLabel:te,withBarValueLabel:ne,valueLabelProps:re,withRightYAxis:ie,rightYAxisLabel:I,rightYAxisProps:ae,minBarSize:oe,maxBarWidth:se,mod:ce,getBarColor:le,gridColor:ue,textColor:de,attributes:fe,accessibilityLayer:pe,withBrush:me,brushProps:he,...ge}=t,_e=Xt(),ve=_!==`none`&&(v===`x`||v===`xy`),ye=_!==`none`&&(v===`y`||v===`xy`),[be,xe]=(0,w.useState)(null),Se=be!==null,Ce=A===`stacked`||A===`percent`,we=A===`percent`?P$:N,Te=e=>{xe(null),f?.(e)},{resolvedClassNames:Ee,resolvedStyles:De}=pn({classNames:n,styles:a,props:t}),Oe=A===`waterfall`?L$(c,p):c,ke=B({name:`BarChart`,classes:N$,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:fe,vars:s,varsResolver:I$}),Ae=d.map(e=>{let t=ft(e.color,_e),n=Se&&be!==e.name,r=typeof F==`function`?F(e):F,i=r?.shape;return(0,w.createElement)(rZ,{...ke(`bar`),key:e.name,name:e.name,dataKey:e.name,fill:t,stroke:t,isAnimationActive:!1,fillOpacity:n?.1:O,strokeOpacity:n?.2:0,stackId:Ce?`stack`:e.stackId||void 0,yAxisId:e.yAxisId||void 0,minPointSize:oe,...r,shape:n=>{let r=n.payload,a=r?.color?ft(r.color,_e):typeof le==`function`?ft(le(r?.[e.name],e),_e):R$(F,e)||t,o={...n,fill:a};return typeof i==`function`?i(o):w.isValidElement(i)?w.cloneElement(i,o):typeof i==`object`&&i?(0,R.jsx)(vk,{...o,...i}):(0,R.jsx)(vk,{...o})}},ne&&(0,R.jsx)(YW,{position:j===`vertical`?`right`:`top`,fontSize:12,fill:`var(--chart-bar-label-color, var(--mantine-color-dimmed))`,formatter:e=>we?.(e),...typeof re==`function`?re(e):re}))}),je=D?.map((e,t)=>{let n=ft(e.color,_e);return(0,R.jsx)(pJ,{stroke:e.color?n:`var(--chart-grid-color)`,strokeWidth:1,yAxisId:e.yAxisId||void 0,...e,label:{fill:e.color?n:`currentColor`,fontSize:12,position:e.labelPosition??`insideBottomLeft`,...typeof e.label==`object`?e.label:{value:e.label}},...ke(`referenceLine`)},t)}),Me={axisLine:!1,...j===`vertical`?{dataKey:p,type:`category`}:{type:`number`},tickLine:ye?{stroke:`currentColor`}:!1,allowDecimals:!0,unit:x,tickFormatter:j===`vertical`?void 0:we,...ke(`axis`)};return(0,R.jsx)(H,{...ke(`root`),onMouseLeave:Te,dir:M||`ltr`,mod:[{orientation:j},ce],...ge,children:(0,R.jsx)(OT,{...ke(`container`),children:(0,R.jsxs)(A$,{data:Oe,stackOffset:A===`percent`?`expand`:void 0,layout:j,maxBarSize:se,margin:{bottom:ee?30:void 0,left:te?10:void 0,right:te?5:void 0},accessibilityLayer:pe,...k,children:[l&&(0,R.jsx)(HE,{verticalAlign:`top`,content:e=>(0,R.jsx)(Ih,{payload:e.payload,onHighlight:xe,legendPosition:u?.verticalAlign||`top`,classNames:Ee,styles:De,series:d,showColor:A!==`waterfall`,attributes:fe}),...u}),(0,R.jsxs)(wZ,{hide:!h,...j===`vertical`?{type:`number`}:{dataKey:p},tick:{transform:`translate(0, 10)`,fontSize:12,fill:`currentColor`},stroke:``,interval:`preserveStartEnd`,tickLine:ve?{stroke:`currentColor`}:!1,minTickGap:5,tickFormatter:j===`vertical`?we:void 0,...ke(`axis`),...y,children:[ee&&(0,R.jsx)(FW,{position:`insideBottom`,offset:-20,fontSize:12,...ke(`axisLabel`),children:ee}),y?.children]}),(0,R.jsxs)(zZ,{orientation:`left`,tick:{transform:`translate(-10, 0)`,fontSize:12,fill:`currentColor`},hide:!g,...Me,...b,children:[te&&(0,R.jsx)(FW,{position:`insideLeft`,angle:-90,textAnchor:`middle`,fontSize:12,offset:-5,...ke(`axisLabel`),children:te}),b?.children]}),(0,R.jsxs)(zZ,{yAxisId:`right`,orientation:`right`,tick:{transform:`translate(10, 0)`,fontSize:12,fill:`currentColor`},hide:!ie,...Me,...ae,children:[I&&(0,R.jsx)(FW,{position:`insideRight`,angle:90,textAnchor:`middle`,fontSize:12,offset:-5,...ke(`axisLabel`),children:I}),b?.children]}),(0,R.jsx)(IY,{strokeDasharray:C,vertical:_===`y`||_===`xy`,horizontal:_===`x`||_===`xy`,...ke(`grid`),...T}),m&&(0,R.jsx)(ZH,{animationDuration:S,isAnimationActive:S!==0,position:j===`vertical`?{}:{y:0},cursor:{stroke:`var(--chart-grid-color)`,strokeWidth:1,strokeDasharray:C,fill:`var(--chart-cursor-fill)`},content:({label:e,payload:t,labelFormatter:n})=>(0,R.jsx)(Mh,{label:n&&t?n(e,t):e,payload:t,type:A===`waterfall`?`scatter`:void 0,unit:x,classNames:Ee,styles:De,series:d,valueFormatter:N,attributes:fe}),...E}),Ae,je,me&&(0,R.jsx)(M$,{dataKey:p,classNames:Ee,styles:De,...he}),P]})})})});z$.displayName=`@mantine/charts/BarChart`,z$.classes=N$,z$.varsResolver=I$;var B$=oh();function V$(e){return e==null?`—`:new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e)}function H$(e){return e?new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,timeZone:`America/Los_Angeles`,timeZoneName:`short`}).format(new Date(e)):`—`}function U$(e){if(e==null)return`—`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t?`${t}d ${n}h ${r}m`:`${n}h ${r}m`}function W$(e){if(!e)return`gray`;let t=e.toUpperCase();return[`RUNNING`,`UP`].includes(t)?`blue`:[`SUCCEEDED`,`FINISHED`].includes(t)?`green`:t.startsWith(`FAILED`)||[`CRASHED`,`CANCELLED`].includes(t)?`red`:[`RECOVERING`,`AUTOSTOPPING`,`STARTING`,`INIT`,`PENDING`].includes(t)?`yellow`:`gray`}function G$(e){return e===`ok`?`green`:e===`warning`?`yellow`:e===`error`?`red`:e===`pending`?`blue`:`gray`}function K$({warnings:e}){return e.length?(0,R.jsx)(Dm,{gap:`xs`,children:e.map(e=>(0,R.jsx)(nd,{color:`yellow`,icon:(0,R.jsx)(uh,{size:18}),children:e},e))}):null}function q$({label:e,value:t,detail:n}){return(0,R.jsxs)(Vf,{withBorder:!0,className:`hud-stat`,children:[(0,R.jsx)(U,{c:`dimmed`,size:`xs`,tt:`uppercase`,fw:700,children:e}),(0,R.jsx)(U,{fw:800,mt:4,className:`hud-stat-value`,children:t}),n&&(0,R.jsx)(U,{c:`dimmed`,size:`xs`,mt:2,children:n})]})}function J$({report:e}){let t=e.billing,n=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`}),r=t.category_daily.map(e=>({date:n.format(new Date(`${e.date}T00:00:00Z`)),aws_compute:e.aws_compute??0,aws_storage:e.aws_storage??0,aws_everything_else:e.aws_everything_else??0,gcp_compute:e.gcp_compute??0,gcp_storage:e.gcp_storage??0,gcp_everything_else:e.gcp_everything_else??0}));return(0,R.jsxs)(Dm,{gap:`lg`,children:[(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:1,children:`Cloud billing`}),(0,R.jsxs)(U,{c:`dimmed`,children:[t.start_date,` through `,t.end_date,` · daily net spend in USD`]})]}),(0,R.jsx)(K$,{warnings:t.warnings}),!t.gcp_configured&&(0,R.jsxs)(nd,{color:`blue`,icon:(0,R.jsx)(bh,{size:18}),children:[`Set `,(0,R.jsx)(qf,{children:`GCP_BILLING_EXPORT_TABLE`}),` to load per-project GCP billing lines.`]}),(0,R.jsxs)(Cm,{cols:{base:1,sm:3},children:[(0,R.jsx)(q$,{label:`AWS · 30 days`,value:V$(t.totals.aws),detail:t.totals.aws==null?`Unavailable`:`Net unblended cost`}),(0,R.jsx)(q$,{label:`GCP · 30 days`,value:V$(t.totals.gcp),detail:t.totals.gcp==null?`Unavailable`:`Cost after credits`}),(0,R.jsx)(q$,{label:`Combined · 30 days`,value:V$(t.totals.combined),detail:`Available providers`})]}),(0,R.jsxs)(Vf,{withBorder:!0,padding:`lg`,children:[(0,R.jsxs)(H,{mb:`lg`,children:[(0,R.jsx)(nh,{order:3,children:`Daily spend`}),(0,R.jsx)(U,{c:`dimmed`,size:`sm`,children:`Stacked by cloud and major category · recent days may be provisional`})]}),(0,R.jsx)(z$,{h:420,data:r,dataKey:`date`,type:`stacked`,series:[{name:`aws_compute`,label:`AWS · compute`,color:`orange.7`},{name:`aws_storage`,label:`AWS · storage`,color:`orange.4`},{name:`aws_everything_else`,label:`AWS · other`,color:`yellow.4`},{name:`gcp_compute`,label:`GCP · compute`,color:`blue.7`},{name:`gcp_storage`,label:`GCP · storage`,color:`blue.4`},{name:`gcp_everything_else`,label:`GCP · other`,color:`cyan.4`}],valueFormatter:e=>V$(e),withLegend:!0,yAxisProps:{width:72}})]})]})}var Y$=0,X$=1,Z$=2,Q$=4;function $$(e){return()=>e}function e1(e){e()}function t1(e,t){return n=>e(t(n))}function n1(e,t){return()=>e(t)}function r1(e,t){return n=>e(t,n)}function i1(e){return e!==void 0}function a1(...e){return()=>{e.map(e1)}}function o1(){}function s1(e,t){return t(e),e}function c1(e,t){return t(e)}function l1(...e){return e}function u1(e,t){return e(X$,t)}function d1(e,t){e(Y$,t)}function f1(e){e(Z$)}function p1(e){return e(Q$)}function J(e,t){return u1(e,r1(t,Y$))}function m1(e,t){let n=e(X$,e=>{n(),t(e)});return n}function h1(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function g1(e,t){return e===t}function _1(e=g1){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Y(e){return t=>n=>{e(n)&&t(n)}}function X(e){return t=>t1(t,e)}function v1(e){return t=>()=>{t(e)}}function Z(e,...t){let n=C1(...t);return((t,r)=>{switch(t){case Z$:f1(e);return;case X$:return u1(e,n(r))}})}function y1(e,t){return n=>r=>{n(t=e(t,r))}}function b1(e){return t=>n=>{e>0?e--:t(n)}}function x1(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function S1(...e){let t=Array.from({length:e.length}),n=0,r=null,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;u1(e,e=>{let s=n;n|=o,t[a]=e,s!==i&&n===i&&r&&(r(),r=null)})}),e=>a=>{let o=()=>{e([a].concat(t))};n===i?o():r=o}}function C1(...e){return t=>e.reduceRight(c1,t)}function w1(e){let t,n,r=()=>t?.();return function(i,a){switch(i){case X$:return a?n===a?void 0:(r(),n=a,t=u1(e,a),t):(r(),o1);case Z$:r(),n=null;return}}}function Q(e){let t=e,n=E1();return((e,r)=>{switch(e){case Y$:t=r;break;case X$:r(t);break;case Q$:return t}return n(e,r)})}function T1(e,t){return s1(Q(t),t=>J(e,t))}function E1(){let e=[];return((t,n)=>{switch(t){case Y$:e.slice().forEach(e=>{e(n)});return;case Z$:e.splice(0);return;case X$:return e.push(n),()=>{let t=e.indexOf(n);t>-1&&e.splice(t,1)}}})}function D1(e){return s1(E1(),t=>J(e,t))}var O1={singleton:!0};function k1(e,t=[],n=O1){let{singleton:r}=n;return{constructor:e,dependencies:t,id:A1(),singleton:r}}var A1=()=>Symbol(`id`);function j1(e){let t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:a})=>{if(a&&t.has(i))return t.get(i);let o=e(r.map(e=>n(e)));return a&&t.set(i,o),o};return n(e)}function M1(...e){let t=E1(),n=Array.from({length:e.length}),r=0,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;u1(e,e=>{n[a]=e,r|=o,r===i&&d1(t,n)})}),function(e,a){switch(e){case Z$:f1(t);return;case X$:return r===i&&a(n),u1(t,a)}}}function $(e,t=g1){return Z(e,_1(t))}function N1(...e){return function(t,n){switch(t){case Z$:return;case X$:return a1(...e.map(e=>u1(e,n)))}}}var P1={DEBUG:0,INFO:1,WARN:2,ERROR:3},F1={[P1.DEBUG]:`debug`,[P1.ERROR]:`error`,[P1.INFO]:`log`,[P1.WARN]:`warn`},I1=()=>typeof globalThis>`u`?window:globalThis,L1=k1(()=>{let e=Q(P1.ERROR);return{log:Q((t,n,r=P1.INFO)=>{r>=(I1().VIRTUOSO_LOG_LEVEL??p1(e))&&console[F1[r]](`%creact-virtuoso: %c%s %o`,`color: #0253b3; font-weight: bold`,`color: initial`,t,n)}),logLevel:e}},[],{singleton:!0});function R1(e){return`self`in e?e.document.documentElement:e}function z1(e){let t=R1(e);return t.ownerDocument.defaultView.getComputedStyle(t).direction===`rtl`}function B1(e,t){return z1(e)?-t:t}function V1(e,t){return z1(e)?-t:t}function H1(e,t,n){return U1(e,t,n).callbackRef}function U1(e,t,n){let r=w.useRef(null),i=e=>{},a=w.useMemo(()=>typeof ResizeObserver<`u`?new ResizeObserver(t=>{let r=()=>{let n=t[0].target;n.offsetParent!==null&&e(n)};n?r():requestAnimationFrame(r)}):null,[e,n]);return i=e=>{e&&t?(a?.observe(e),r.current=e):(r.current&&a?.unobserve(r.current),r.current=null)},{callbackRef:i,ref:r}}function W1(e,t,n,r,i,a,o,s,c){return U1(w.useCallback(n=>{let c=G1(n.children,t,s?`offsetWidth`:`offsetHeight`,i),l=n.parentElement;for(;l.dataset.virtuosoScroller===void 0;)l=l.parentElement;let u=l.lastElementChild?.dataset.viewportType===`window`,d;u&&(d=l.ownerDocument.defaultView);let f=o?s?o.scrollWidth:o.scrollHeight:u?s?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight:s?l.scrollWidth:l.scrollHeight,p=o?s?o.offsetWidth:o.offsetHeight:u?s?d.innerWidth:d.innerHeight:s?l.offsetWidth:l.offsetHeight,m=o?s?B1(o,o.scrollLeft):o.scrollTop:u?s?B1(d,d.scrollX||d.document.documentElement.scrollLeft):d.scrollY||d.document.documentElement.scrollTop:s?B1(l,l.scrollLeft):l.scrollTop;r({scrollHeight:f,scrollTop:Math.max(m,0),viewportHeight:p}),a?.(s?K1(`column-gap`,getComputedStyle(n).columnGap,i):K1(`row-gap`,getComputedStyle(n).rowGap,i)),c!==null&&e(c)},[e,t,i,a,o,r,s]),n,c)}function G1(e,t,n,r){let i=e.length;if(i===0)return null;let a=[];for(let o=0;o{if(!n?.offsetParent)return;let i=n.getBoundingClientRect(),a=i.width,s,c;if(t){let e=t.getBoundingClientRect(),n=i.top-e.top;c=e.height-Math.max(0,n),s=n+t.scrollTop}else{let e=o.current.ownerDocument.defaultView;c=e.innerHeight-Math.max(0,i.top),s=i.top+e.scrollY}r.current={listHeight:i.height,offsetTop:s,visibleHeight:c,visibleWidth:a},e(r.current)},[e,t]),{callbackRef:a,ref:o}=U1(i,!0,n),s=w.useCallback(()=>{i(o.current)},[i,o]);return w.useEffect(()=>{if(t){t.addEventListener(`scroll`,s);let e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener(`scroll`,s),e.unobserve(t)}}let e=o.current?.ownerDocument.defaultView;return e?.addEventListener(`scroll`,s),e?.addEventListener(`resize`,s),()=>{e?.removeEventListener(`scroll`,s),e?.removeEventListener(`resize`,s)}},[s,t,o]),a}var J1=k1(()=>{let e=E1(),t=E1(),n=Q(0),r=E1(),i=Q(0),a=E1(),o=E1(),s=Q(0),c=Q(0),l=Q(0),u=Q(0),d=E1(),f=E1(),p=Q(!1),m=Q(!1),h=Q(!1);return J(Z(e,X(({scrollTop:e})=>e)),t),J(Z(e,X(({scrollHeight:e})=>e)),o),J(t,i),{deviation:n,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:u,headerHeight:s,horizontalDirection:m,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:p,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:h,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:a}},[],{singleton:!0}),Y1={lvl:0};function X1(e,t){let n=e.length;if(n===0)return[];let{index:r,value:i}=t(e[0]),a=[];for(let o=1;ot&&(s=s.concat(a0(i,t,n))),r>=t&&r<=n&&s.push({k:r,v:o}),r<=n&&(s=s.concat(a0(a,t,n))),s}function o0(e){let{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(l0(t))return p0(s0(e,{lvl:n-1}));if(!Z1(t)&&!Z1(t.r))return s0(t.r,{l:s0(t,{r:t.r.l}),lvl:n,r:s0(e,{l:t.r.r,lvl:n-1})});throw Error(`Unexpected empty nodes`)}if(l0(e))return m0(s0(e,{lvl:n-1}));if(!Z1(r)&&!Z1(r.l)){let t=r.l,i=l0(t)?r.lvl-1:r.lvl;return s0(t,{l:s0(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:m0(s0(r,{l:t.r,lvl:i}))})}throw Error(`Unexpected empty nodes`)}function s0(e,t){return d0(t.k===void 0?e.k:t.k,t.v===void 0?e.v:t.v,t.lvl===void 0?e.lvl:t.lvl,t.l===void 0?e.l:t.l,t.r===void 0?e.r:t.r)}function c0(e){return Z1(e.r)?e.l:o0(s0(e,{r:c0(e.r)}))}function l0(e){return Z1(e)||e.lvl>e.r.lvl}function u0(e){return Z1(e.r)?[e.k,e.v]:u0(e.r)}function d0(e,t,n,r=Y1,i=Y1){return{k:e,l:r,lvl:n,r:i,v:t}}function f0(e){return m0(p0(e))}function p0(e){let{l:t}=e;return!Z1(t)&&t.lvl===e.lvl?s0(t,{r:s0(e,{l:t.r})}):e}function m0(e){let{lvl:t,r:n}=e;return!Z1(n)&&!Z1(n.r)&&n.lvl===t&&n.r.lvl===t?s0(n,{l:s0(e,{r:n.l}),lvl:t+1}):e}function h0(e){return X1(e,({k:e,v:t})=>({index:e,value:t}))}function g0(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function _0(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}var v0=k1(()=>({recalcInProgress:Q(!1)}),[],{singleton:!0});function y0(e,t,n){return e[b0(e,t,n)]}function b0(e,t,n,r=0){let i=e.length-1;for(;r<=i;){let a=Math.floor((r+i)/2),o=e[a],s=n(o,t);if(s===0)return a;if(s===-1){if(i-r<2)return a-1;i=a-1}else{if(i===r)return a;r=a+1}}throw Error(`Failed binary finding record in array - ${e.join(`,`)}, searched for ${t}`)}function x0(e,t,n,r){let i=b0(e,t,r),a=b0(e,n,r,i);return e.slice(i,a+1)}function S0(e,t){return Math.round(e.getBoundingClientRect()[t])}function C0(e){return!Z1(e.groupOffsetTree)}function w0({index:e},t){return t===e?0:t=r||i===a)&&(e=r0(e,r)):(c=a!==i,s=!0),n>t&&t>=r&&a!==i&&(e=e0(e,t+1,a));c&&(e=e0(e,a,i))}return[e,n]}function D0(e){return e.groupIndex!==void 0}function O0({offset:e},t){return t===e?0:t0?s+n:s}function A0(e,t){if(!C0(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function j0(e,t,n){if(D0(e))return t.groupIndices[e.groupIndex]+1;let r=A0(e.index===`LAST`?n:e.index,t);return r=Math.max(0,Math.min(n,r)),r}function M0(e,t,n,r=0){return r>0&&(t=Math.max(t,y0(e,r,w0).offset)),X1(x0(e,t,n,O0),L0)}function N0(e,[t,n,r,i]){t.length>0&&r(`received item sizes`,t,P1.DEBUG);let a=e.sizeTree,o=a,s=0;if(n.length>0&&Z1(a)&&t.length===2){let e=t[0].size,r=t[1].size;o=n.reduce((t,n)=>e0(e0(t,n,e),n+1,r),o)}else[o,s]=E0(o,t);if(o===a)return e;let{lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d}=I0(e.offsetTree,s,o,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>e0(e,t,k0(t,d,i)),t0()),lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d,sizeTree:o}}function P0(e){return i0(e).map(({k:e,v:t},n,r)=>{let i=r[n+1];return{endIndex:i===void 0?1/0:i.k-1,size:t,startIndex:e}})}function F0(e,t){let n=0,r=0;for(;ne.start===r&&(e.end===t||e.end===1/0)&&e.value===n}var z0={offsetHeight:`height`,offsetWidth:`width`},B0=k1(([{log:e},{recalcInProgress:t}])=>{let n=E1(),r=E1(),i=T1(r,0),a=E1(),o=E1(),s=Q(0),c=Q([]),l=Q(void 0),u=Q(void 0),d=Q(void 0),f=Q(void 0),p=Q((e,t)=>S0(e,z0[t])),m=Q(void 0),h=Q(0),g=T0(),_=T1(Z(n,S1(c,e,h),y1(N0,g),_1()),g),v=T1(Z(c,_1(),y1((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),X(({prev:e})=>e)),[]);J(Z(c,Y(e=>e.length>0),S1(_,h),X(([e,t,n])=>{let r=e.reduce((e,r,i)=>e0(e,r,k0(r,t.offsetTree,n)||i),t0());return{...t,groupIndices:e,groupOffsetTree:r}})),_),J(Z(r,S1(_),Y(([e,{lastIndex:t}])=>e[{endIndex:t,size:n,startIndex:e}])),n),J(l,u);let y=T1(Z(l,X(e=>e===void 0)),!0);J(Z(u,Y(e=>e!==void 0&&Z1(p1(_).sizeTree)),X(e=>{let t=p1(d),n=p1(c).length>0;return t!==void 0&&t!==0?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),J(Z(f,Y(e=>e!==void 0&&e.length>0&&Z1(p1(_).sizeTree)),X(e=>{let t=[],n=e[0],r=0;for(let i=1;ie!==void 0&&t!==void 0),X(([e,t,n])=>{let r=[];for(let i=0;i({changed:n!==e,sizes:n}),{changed:!1,sizes:g}),X(e=>e.changed)));u1(Z(s,y1((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),X(e=>e.diff)),e=>{let{groupIndices:n}=p1(_);if(e>0)d1(t,!0),d1(a,e+F0(e,n));else if(e<0){let t=p1(v);t.length>0&&(e-=F0(-e,t)),d1(o,e)}}),u1(Z(s,S1(e)),([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},P1.ERROR)});let x=D1(a);J(Z(a,S1(_),X(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=Q1(t.sizeTree,0),a=0,o=0;for(;a{let i=t.ranges;return t.prevSize!==0&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return i0(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);let S=D1(Z(o,S1(_,h),X(([e,{offsetTree:t},n])=>k0(-e,t,n))));return J(Z(o,S1(_,h),X(([e,t,n])=>{if(t.groupIndices.length>0){if(Z1(t.sizeTree))return t;let r=t0(),i=p1(v),a=0,o=0,s=0;for(;a<-e;){s=i[o];let e=i[o+1]-s-1;o++,a+=e+1}if(r=i0(t.sizeTree).reduce((t,{k:n,v:r})=>e0(t,Math.max(0,n+e),r),r),a!==-e){let n=Q1(t.sizeTree,s);r=e0(r,0,n);let i=$1(t.sizeTree,-e+1)[1];r=e0(r,1,i)}return{...t,sizeTree:r,...I0(t.offsetTree,0,r,n)}}let r=i0(t.sizeTree).reduce((t,{k:n,v:r})=>e0(t,Math.max(0,n+e),r),t0());return{...t,sizeTree:r,...I0(t.offsetTree,0,r,n)}})),_),{beforeUnshiftWith:x,data:m,defaultItemSize:u,firstItemIndex:s,fixedItemSize:l,fixedGroupSize:d,gap:h,groupIndices:c,heightEstimates:f,itemSize:p,listRefresh:b,shiftWith:o,shiftWithOffset:S,sizeRanges:n,sizes:_,statefulTotalCount:i,totalCount:r,trackItemSizes:y,unshiftWith:a}},l1(L1,v0),{singleton:!0});function V0(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}var H0=k1(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let a=E1(),o=E1(),s=D1(Z(a,X(V0)));return J(Z(s,X(e=>e.totalCount)),n),J(Z(s,X(e=>e.groupIndices)),e),J(Z(M1(i,t,r),Y(([e,t])=>C0(t)),X(([e,t,n])=>$1(t.groupOffsetTree,Math.max(e-n,0),`v`)[0]),_1(),X(e=>[e])),o),{groupCounts:a,topItemsIndexes:o}},l1(B0,J1)),U0=k1(([{log:e}])=>{let t=Q(!1),n=D1(Z(t,Y(e=>e),_1()));return u1(t,t=>{t&&p1(e)(`props updated`,{},P1.DEBUG)}),{didMount:n,propsReady:t}},l1(L1),{singleton:!0}),W0=typeof document<`u`&&`scrollBehavior`in document.documentElement.style;function G0(e){let t=typeof e==`number`?{index:e}:{...e};return t.align||=`start`,(!t.behavior||!W0)&&(t.behavior=`auto`),t.offset===void 0&&(t.offset=0),t}var K0=k1(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:a,footerHeight:o,headerHeight:s,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:u,viewportHeight:d},{log:f}])=>{let p=E1(),m=E1(),h=Q(0),g=null,_=null,v=null;function y(){g!==null&&(g(),g=null),v!==null&&(v(),v=null),_&&=(clearTimeout(_),null),d1(c,!1)}return J(Z(p,S1(n,d,r,h,s,o,f),S1(e,a,i),X(([[e,n,r,i,a,o,s,l],d,f,h])=>{let b=G0(e),{align:x,behavior:S,offset:C}=b,w=i-1,T=j0(b,n,w),E=k0(T,n.offsetTree,d)+o;x===`end`?(E+=f+$1(n.sizeTree,T)[1]-r+h,T===w&&(E+=s)):x===`center`?E+=(f+$1(n.sizeTree,T)[1]-r+h)/2:E-=a,C!==void 0&&C!==0&&(E+=C);let D=t=>{y(),t?(l(`retrying to scroll to`,{location:e},P1.DEBUG),d1(p,e)):(d1(m,!0),l(`list did not change, scroll successful`,{},P1.DEBUG))};if(y(),S===`smooth`){let e=!1;v=u1(t,t=>{e||=t}),g=m1(u,()=>{D(e)})}else g=m1(Z(t,q0(150)),D);return _=setTimeout(()=>{y()},1200),d1(c,!0),l(`scrolling from index to`,{behavior:S,index:T,top:E},P1.DEBUG),{behavior:S,top:E}})),l),{scrollTargetReached:m,scrollToIndex:p,topListHeight:h}},l1(B0,J1,L1),{singleton:!0});function q0(e){return t=>{let n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}function J0(e,t){e===0?t():requestAnimationFrame(()=>{J0(e-1,t)})}function Y0(e,t){if(e===void 0)return 0;let n=t-1,r=typeof e==`number`?e:e.index===`LAST`?n:e.index;return Math.max(0,Math.min(r,n))}function X0(e){return e===void 0?!0:typeof e==`number`?e===0:e.index===0&&(e.align===void 0||e.align===`start`)&&(e.offset===void 0||e.offset===0)}var Z0=k1(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:a},{didMount:o}])=>{let s=Q(!0),c=Q(0),l=Q(!0);return J(Z(o,S1(c),Y(([e,t])=>!X0(t)),v1(!1)),s),J(Z(o,S1(c),Y(([e,t])=>!X0(t)),v1(!1)),l),u1(Z(M1(t,o),S1(s,n,e,l),Y(([[,e],t,{sizeTree:n},r,i])=>e&&(!Z1(n)||i1(r))&&!t&&!i),S1(c)),([,e])=>{if(e===void 0){d1(s,!0),d1(l,!0);return}m1(i,()=>{d1(l,!0)}),J0(4,()=>{m1(r,()=>{d1(s,!0)}),d1(a,e)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:s}},l1(B0,J1,K0,U0),{singleton:!0});function Q0(e,t){return Math.abs(e-t)<1.01}var $0=`up`,e2=`down`,t2=`none`,n2={atBottom:!1,notAtBottomBecause:`NOT_SHOWING_LAST_ITEM`,state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},r2=0,i2=k1(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:a}])=>{let o=Q(!1),s=Q(!0),c=E1(),l=E1(),u=Q(4),d=Q(r2),f=T1(Z(N1(Z($(i),b1(1),v1(!0)),Z($(i),b1(1),v1(!1),h1(100))),_1()),!1),p=T1(Z(N1(Z(n,v1(!0)),Z(n,v1(!1),h1(200))),_1()),!1);J(Z(M1($(i),$(d)),X(([e,t])=>e<=t),_1()),s),J(Z(s,x1(50)),l);let m=D1(Z(M1(r,$(a),$(t),$(e),$(u)),y1((e,[{scrollHeight:t,scrollTop:n},r,i,a,o])=>{let s=n+r-t>-o,c={scrollHeight:t,scrollTop:n,viewportHeight:r};if(s){let t,r;return n>e.state.scrollTop?(t=`SCROLLED_DOWN`,r=e.state.scrollTop-n):(t=`SIZE_DECREASED`,r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:c}}let l;return l=c.scrollHeight>e.state.scrollHeight?`SIZE_INCREASED`:re!==void 0&&e.atBottom===t.atBottom))),h=T1(Z(r,y1((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!Q0(e.scrollHeight,t)){let i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Y(e=>e.changed),X(e=>e.jump)),0);J(Z(m,X(e=>e.atBottom)),o),J(Z(o,x1(50)),c);let g=Q(e2);J(Z(r,X(({scrollTop:e})=>e),_1(),y1((e,t)=>p1(p)?{direction:e.direction,prevScrollTop:t}:{direction:te.direction)),g),J(Z(r,x1(50),v1(t2)),g);let _=Q(0);return J(Z(f,Y(e=>!e),v1(0)),_),J(Z(i,x1(100),S1(f),Y(([e,t])=>t),y1(([e,t],[n])=>[t,n],[0,0]),X(([e,t])=>t-e)),_),{atBottomState:m,atBottomStateChange:c,atBottomThreshold:u,atTopStateChange:l,atTopThreshold:d,isAtBottom:o,isAtTop:s,isScrolling:f,lastJumpDueToItemResize:h,scrollDirection:g,scrollVelocity:_}},l1(J1)),a2=`top`,o2=`bottom`,s2=`none`;function c2(e,t,n){return typeof e==`number`?n===$0&&t===a2||n===e2&&t===o2?e:0:n===$0?t===a2?e.main:e.reverse:t===o2?e.main:e.reverse}function l2(e,t){return typeof e==`number`?e:e[t]??0}var u2=k1(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let a=E1(),o=Q(0),s=Q(0),c=Q(0);return{increaseViewportBy:s,listBoundary:a,overscan:c,topListHeight:o,visibleRange:T1(Z(M1($(r),$(i),$(n),$(a,_0),$(c),$(o),$(t),$(e),$(s)),X(([e,t,n,[r,i],a,o,s,c,l])=>{let u=e-c,d=o+s,f=Math.max(n-u,0),p=s2,m=l2(l,a2),h=l2(l,o2);return r-=c,r+=n+s,i+=n+s,i-=c,r>e+d-m&&(p=$0),ie!==null),_1(_0)),[0,0])}},l1(J1),{singleton:!0});function d2(e,t,n){if(C0(t)){let r=A0(e,t);return[{index:$1(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}var f2={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function p2(e,t,n,r,i,a){let{lastIndex:o,lastOffset:s,lastSize:c}=i,l=0,u=0;if(e.length>0){l=e[0].offset;let t=e[e.length-1];u=t.offset+t.size}let d=n-o,f=s+d*c+(d-1)*r,p=l,m=f-u;return{bottom:u,firstItemIndex:a,items:h2(e,i,a),offsetBottom:m,offsetTop:l,top:p,topItems:h2(t,i,a),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function m2(e,t,n,r,i,a){let o=0;if(n.groupIndices.length>0)for(let t of n.groupIndices){if(t-o>=e)break;o++}let s=e+o,c=Y0(t,s);return p2(Array.from({length:s}).map((e,t)=>({data:a[t+c],index:t+c,offset:0,size:0})),[],s,i,n,r)}function h2(e,t,n){if(e.length===0)return[];if(!C0(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));let r=e[0].index,i=e[e.length-1].index,a=[],o=n0(t.groupOffsetTree,r,i),s,c=0;for(let r of e){(!s||s.end{let h=Q([]),g=Q(0),_=E1(),v=Q(0);J(a.topItemsIndexes,h);let y=T1(Z(M1(p,m,$(c,_0),$(i),$(r),$(l),u,$(h),$(t),$(n),$(v),e),Y(([e,t,,n,,,,,,,,r])=>{let i=r!==void 0&&r.length!==n;return e&&!t&&!i}),X(([,,[e,t],n,r,i,a,o,s,c,l,u])=>{let d=r,{offsetTree:f,sizeTree:p}=d,m=p1(g);if(n===0)return{...f2,totalCount:n};if(e===0&&t===0)return m===0?{...f2,totalCount:n}:m2(m,i,r,s,c,u||[]);if(Z1(p))return m>0?null:p2(d2(Y0(i,n),d,u),[],n,c,d,s);let h=[];if(o.length>0){let e=o[0],t=o[o.length-1],n=0;for(let r of n0(p,e,t)){let i=r.value,a=Math.max(r.start,e),o=Math.min(r.end,t);for(let e=a;e<=o;e++)h.push({data:u?.[e],index:e,offset:n,size:i}),n+=i}}if(!a)return p2([],h,n,c,d,s);let _=o.length>0?o[o.length-1]+1:0,v=M0(f,e,t,_);if(v.length===0)return null;let y=n-1,b=s1([],n=>{for(let r of v){let i=r.value,a=i.offset,o=r.start,s=i.size;if(i.offset=t);e++)n.push({data:u?.[e],index:e,offset:a,size:s}),a+=s+c}}),x=g2(l,a2),S=g2(l,o2);if(b.length>0&&(x>0||S>0)){let e=b[0],t=b[b.length-1];if(x>0&&e.index>_){let t=Math.min(x,e.index-_),n=[],r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){let t=n0(p,i,i)[0]?.value??e.size;r-=t+c,n.unshift({data:u?.[i],index:i,offset:r,size:t})}b.unshift(...n)}if(S>0&&t.indexe!==null),_1()),f2);J(Z(e,Y(i1),X(e=>e?.length)),i),J(Z(y,X(e=>e.topListHeight)),d),J(d,s),J(Z(y,X(e=>[e.top,e.bottom])),o),J(Z(y,X(e=>e.items)),_);let b=D1(Z(y,Y(({items:e})=>e.length>0),S1(i,e),Y(([{items:e},t])=>e[e.length-1].originalIndex===t-1),X(([,e,t])=>[e-1,t]),_1(_0),X(([e])=>e))),x=D1(Z(y,x1(200),Y(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),X(({items:e})=>e[0].index),_1()));return{endReached:b,initialItemCount:g,itemsRendered:_,listState:y,minOverscanItemCount:v,rangeChanged:D1(Z(y,Y(({items:e})=>e.length>0),X(({items:e})=>{let t=0,n=e.length-1;for(;e[t].type===`group`&&tt;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),_1(g0))),startReached:x,topItemsIndexes:h,...f}},l1(B0,H0,u2,Z0,K0,i2,U0,v0),{singleton:!0}),v2=k1(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let a=E1(),o=T1(Z(M1(n,e,r,t,i),X(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return J($(o),a),{totalListHeight:o,totalListHeightChanged:a}},l1(J1,_2),{singleton:!0}),y2=k1(([{viewportHeight:e},{totalListHeight:t}])=>{let n=Q(!1);return{alignToBottom:n,paddingTopAddition:T1(Z(M1(n,e,t),Y(([e])=>e),X(([,e,t])=>Math.max(0,e-t)),x1(0),_1()),0)}},l1(J1,v2),{singleton:!0}),b2=k1(()=>({context:Q(null)})),x2=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:a,viewportTop:o})=>ta?{...i,align:n??`end`,...r===void 0?{}:{behavior:r}}:null,S2=k1(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:a,scrollingInProgress:o,scrollTop:s,viewportHeight:c},{scrollToIndex:l}])=>{let u=E1();return J(Z(u,S1(t,c,n,a,i,r,s),S1(e),X(([[e,t,n,r,i,a,s,c],l])=>{let{calculateViewLocation:u=x2,done:d,...f}=e,p=j0(e,t,r-1),m=k0(p,t.offsetTree,l)+i+a,h=m+$1(t.sizeTree,p)[1],g=c+a,_=u({itemBottom:h,itemTop:m,locationParams:f,viewportBottom:c+n-s,viewportTop:g});return _===null?d?.():d&&m1(Z(o,Y(e=>!e),b1(p1(o)?1:2)),d),_}),Y(e=>e!==null)),l),{scrollIntoView:u}},l1(B0,J1,K0,_2,L1),{singleton:!0});function C2(e){return e===!1?!1:e===`smooth`?`smooth`:`auto`}var w2=(e,t)=>typeof e==`function`?C2(e(t)):t&&C2(e),T2=k1(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:s},{didMount:c,propsReady:l},{log:u},{scrollingInProgress:d},{context:f},{scrollIntoView:p}])=>{let m=Q(!1),h=E1(),g=null;function _(e){d1(o,{align:`end`,behavior:e,index:`LAST`})}u1(Z(M1(Z($(t),b1(1)),c),S1($(m),a,s,d),X(([[e,t],n,r,i,a])=>{let o=t&&i,s=`auto`;return o&&(s=w2(n,r||a),o&&=s!==!1),{followOutputBehavior:s,shouldFollow:o,totalCount:e}}),Y(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{g!==null&&(g(),g=null),p1(n)===void 0?g=m1(e,()=>{p1(u)(`following output to `,{totalCount:r},P1.DEBUG),_(t),g=null}):requestAnimationFrame(()=>{p1(u)(`following output to `,{totalCount:r},P1.DEBUG),_(t)})});function v(e){let t=m1(i,t=>{e&&!t.atBottom&&t.notAtBottomBecause===`SIZE_INCREASED`&&g===null&&(p1(u)(`scrolling to bottom due to increased size`,{},P1.DEBUG),_(`auto`))});setTimeout(t,100)}u1(Z(M1($(m),t,l),Y(([e,,t])=>e!==!1&&t),y1(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),Y(({refreshed:e})=>e),S1(m,t)),([,e])=>{p1(s)&&v(e!==!1)}),u1(h,()=>{v(p1(m)!==!1)}),u1(M1($(m),i),([e,t])=>{e!==!1&&!t.atBottom&&t.notAtBottomBecause===`VIEWPORT_HEIGHT_DECREASING`&&_(`auto`)});let y=Q(null),b=E1();return J(N1(Z($(r),X(e=>e?.length??0)),Z($(t))),b),u1(Z(M1(Z(b,b1(1)),c),S1($(y),s,d,f),X(([[e,t],n,r,i,a])=>t&&r&&n?.({context:a,totalCount:e,scrollingInProgress:i})),Y(e=>!!e),x1(0)),t=>{g!==null&&(g(),g=null),p1(n)===void 0?g=m1(e,()=>{p1(u)(`scrolling into view`,{}),d1(p,t),g=null}):requestAnimationFrame(()=>{p1(u)(`scrolling into view`,{}),d1(p,t)})}),{autoscrollToBottom:h,followOutput:m,scrollIntoViewOnChange:y}},l1(B0,i2,K0,Z0,U0,L1,J1,b2,S2)),E2=k1(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:a,listState:o},{didMount:s}])=>(J(Z(s,S1(a),Y(([,e])=>e!==0),S1(i,r,t,n,e),X(([[,e],t,n,r,i,a=[]])=>m2(e,t,n,r,i,a))),o),{}),l1(B0,Z0,_2,U0),{singleton:!0}),D2=k1(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=Q(0);return u1(Z(e,S1(r),Y(([,e])=>e!==0),X(([,e])=>({top:e}))),e=>{m1(Z(n,b1(1),Y(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{d1(t,e)})})}),{initialScrollTop:r}},l1(U0,J1,_2),{singleton:!0}),O2=k1(([{scrollVelocity:e}])=>{let t=Q(!1),n=E1(),r=Q(!1);return J(Z(e,S1(r,t,n),Y(([e,t])=>t!==!1&&t!==void 0),X(([e,t,n,r])=>{let{enter:i,exit:a}=t;if(n){if(a(e,r))return!1}else if(i(e,r))return!0;return n}),_1()),t),u1(Z(M1(t,e,n),S1(r)),([[e,t,n],r])=>{e&&r!==!1&&r!==void 0&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},l1(i2),{singleton:!0}),k2=k1(([{scrollContainerState:e,scrollTo:t}])=>{let n=E1(),r=E1(),i=E1(),a=Q(!1),o=Q(void 0);return J(Z(M1(n,r),X(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),J(Z(t,S1(r),X(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},l1(J1)),A2=k1(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:a},{useWindowScroll:o,windowScrollContainerState:s,windowViewportRect:c}])=>{let l=E1(),u=Q(void 0),d=Q(null),f=Q(null);return J(s,d),J(c,f),u1(Z(l,S1(t,r,o,d,f,n)),([e,t,n,r,i,a,o])=>{let s=P0(t.sizeTree);r&&i!==null&&a!==null&&(n=i.scrollTop-a.offsetTop),n-=o,e({ranges:s,scrollTop:n})}),J(Z(u,Y(i1),X(j2)),i),J(Z(a,S1(u),Y(([,e])=>e!==void 0),_1(),X(([,e])=>e.ranges)),e),{getState:l,restoreStateFrom:u}},l1(B0,J1,Z0,U0,k2));function j2(e){return{align:`start`,index:0,offset:e.scrollTop}}var M2=k1(([{topItemsIndexes:e}])=>{let t=Q(0);return J(Z(t,Y(e=>e>=0),X(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},l1(_2));function N2(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}var P2=N2(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),F2=k1(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:a,groupIndices:o,heightEstimates:s,itemSize:c,sizeRanges:l,sizes:u,statefulTotalCount:d,totalCount:f,trackItemSizes:p},{initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g},_,v,y,b,{scrollToIndex:x},S,{topItemCount:C},{groupCounts:w},T])=>{let{listState:E,minOverscanItemCount:D,topItemsIndexes:O,rangeChanged:k,...A}=b;return J(k,T.scrollSeekRangeChanged),J(Z(M1(T.windowViewportRect,_.headerHeight,_.fixedHeaderHeight),X(([e,t,n])=>Math.max(t+n+1,e.visibleHeight))),_.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:a,groupCounts:w,heightEstimates:s,initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g,sizeRanges:l,topItemCount:C,topItemsIndexes:O,totalCount:f,...y,groupIndices:o,itemSize:c,listState:E,minOverscanItemCount:D,scrollToIndex:x,statefulTotalCount:d,trackItemSizes:p,rangeChanged:k,...A,...T,..._,sizes:u,...v}},l1(B0,Z0,J1,A2,T2,_2,K0,k1(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:s},{listState:c},{beforeUnshiftWith:l,gap:u,shiftWithOffset:d,sizes:f},{log:p},{recalcInProgress:m}])=>{let h=D1(Z(c,S1(o),y1(([,e,t,n],[{bottom:r,items:i,offsetBottom:a,totalCount:o},s])=>{let c=r+a,l=0;return t===o&&e.length>0&&i.length>0&&(i[0].originalIndex===0&&e[0].originalIndex===0||(l=c-n,l!==0&&(l+=s))),[l,i,o,c]},[0,[],0,0]),Y(([e])=>e!==0),S1(r,s,n,i,p,m),Y(([,e,t,n,,,r])=>!r&&!n&&e!==0&&t===$0),X(([[e],,,,,t])=>(t(`Upward scrolling compensation`,{amount:e},P1.DEBUG),e))));function g(n){n>0?(d1(t,{behavior:`auto`,top:-n}),d1(e,0)):(d1(e,0),d1(t,{behavior:`auto`,top:-n}))}return u1(Z(h,S1(e,a)),([t,n,r])=>{r&&P2()?d1(e,n-t):g(-t)}),u1(Z(M1(T1(a,!1),e,m),Y(([e,t,n])=>!e&&!n&&t!==0),X(([e,t])=>t),x1(1)),g),J(Z(d,X(e=>({top:-e}))),t),u1(Z(l,S1(f,u),X(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function a(e){return e*(n+i)}if(t.length===0)return a(e);let o=0,s=Q1(r,0),c=0,l=0;for(;ce&&(o-=s,n=e-c+1),c+=n,o+=a(n),l++}return o})),n=>{d1(e,n),requestAnimationFrame(()=>{d1(t,{top:n}),requestAnimationFrame(()=>{d1(e,0),d1(m,!1)})})}),{deviation:e}},l1(J1,i2,_2,B0,L1,v0)),M2,H0,k1(([e,t,n,r,i,a,o,s,c,l,u])=>({...e,...t,...n,...r,...i,...a,...o,...s,...c,...l,...u}),l1(u2,E2,U0,O2,v2,D2,y2,k2,S2,L1,b2))));function I2(e,t){let n={},r={},i=0,a=e.length;for(;i`u`?w.useEffect:w.useLayoutEffect;function R2(e,t,n){let r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),a=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),s=w.createContext({});function c(e,n){e.propsReady!==void 0&&d1(e.propsReady,!1);for(let i of r){let r=e[t.required[i]];d1(r,n[i])}for(let r of i)if(r in n){let i=e[t.optional[r]];d1(i,n[r])}e.propsReady!==void 0&&d1(e.propsReady,!0)}function l(e){return a.reduce((n,r)=>(n[r]=n=>{let i=e[t.methods[r]];d1(i,n)},n),{})}function u(e){return o.reduce((n,r)=>(n[r]=w1(e[t.events[r]]),n),{})}return{Component:w.forwardRef(function(t,a){let{children:d,...f}=t,[p]=w.useState(()=>s1(j1(e),e=>{c(e,f)})),[m]=w.useState(n1(u,p));L2(()=>{for(let e of o)e in f&&u1(m[e],f[e]);return()=>{Object.values(m).map(f1)}},[f,m,p]),L2(()=>{c(p,f)}),w.useImperativeHandle(a,$$(l(p)));let h=n;return(0,R.jsx)(s.Provider,{value:p,children:n===void 0?d:(0,R.jsx)(h,{...I2([...r,...i,...o],f),children:d})})}),useEmitter:(e,t)=>{let n=w.useContext(s)[e];L2(()=>u1(n,t),[t,n])},useEmitterValue:e=>{let t=w.useContext(s)[e],n=w.useCallback(e=>u1(t,e),[t]);return w.useSyncExternalStore(n,()=>p1(t),()=>p1(t))},usePublisher:e=>{let t=w.useContext(s);return w.useCallback(n=>{d1(t[e],n)},[t,e])}}}var z2=w.createContext(void 0),B2=w.createContext(void 0),V2=`-webkit-sticky`,H2=`sticky`,U2=N2(()=>{if(typeof document>`u`)return H2;let e=document.createElement(`div`);return e.style.position=V2,e.style.position===V2?V2:H2}),W2=typeof document>`u`?w.useEffect:w.useLayoutEffect;function G2(e){return`self`in e}function K2(e){return`body`in e}function q2(e,t,n,r=o1,i,a){let o=w.useRef(null),s=w.useRef(null),c=w.useRef(null),l=w.useCallback(n=>{let r,i,o,l=n.target;if(K2(l)||G2(l)){let e=G2(l)?l:l.defaultView;o=a===!0?B1(e,e.scrollX):e.scrollY,r=a===!0?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a===!0?e.innerWidth:e.innerHeight}else o=a===!0?B1(l,l.scrollLeft):l.scrollTop,r=a===!0?l.scrollWidth:l.scrollHeight,i=a===!0?l.offsetWidth:l.offsetHeight;let u=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync===!0?u():bo.flushSync(u),s.current!==null&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&=(clearTimeout(c.current),null))},[e,t,a]);w.useEffect(()=>{let e=i??o.current;return r(i??o.current),l({suppressFlushSync:!0,target:e}),e.addEventListener(`scroll`,l,{passive:!0}),()=>{r(null),e.removeEventListener(`scroll`,l)}},[o,l,n,r,i]);function u(n){let r=o.current;if(!r||(a===!0?`offsetWidth`in r&&r.offsetWidth===0:`offsetHeight`in r&&r.offsetHeight===0))return;let i=n.behavior===`smooth`,l,u,d;G2(r)?(u=Math.max(S0(r.document.documentElement,a===!0?`width`:`height`),a===!0?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),l=a===!0?r.innerWidth:r.innerHeight,d=a===!0?B1(r,r.scrollX):r.scrollY):(u=r[a===!0?`scrollWidth`:`scrollHeight`],l=S0(r,a===!0?`width`:`height`),d=a===!0?B1(r,r.scrollLeft):r.scrollTop);let f=u-l;if(n.top===void 0){r.scrollTo(n);return}let p=Math.ceil(Math.max(Math.min(f,n.top),0));if(n.top=p,Q0(l,u)||p===d){e({scrollHeight:u,scrollTop:d,viewportHeight:l}),i&&t(!0);return}i?(s.current=p,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,a===!0&&(n={...n.behavior===void 0?{}:{behavior:n.behavior},left:V1(r,p)}),r.scrollTo(n)}function d(e){a===!0&&(e={...e.behavior===void 0?{}:{behavior:e.behavior},...e.top===void 0?{}:{left:V1(o.current,e.top)}}),o.current.scrollBy(e)}return{scrollByCallback:d,scrollerRef:o,scrollToCallback:u}}function J2(e){return e}var Y2=k1(([e,t])=>({...e,...t}),l1(F2,k1(()=>{let e=Q(e=>`Item ${e}`),t=Q(e=>`Group ${e}`),n=Q({}),r=Q(J2),i=Q(`div`),a=Q(o1),o=(e,t=null)=>T1(Z(n,X(t=>t[e]),_1()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:o(`EmptyPlaceholder`),FooterComponent:o(`Footer`),GroupComponent:o(`Group`,`div`),groupContent:t,HeaderComponent:o(`Header`),HeaderFooterTag:i,ItemComponent:o(`Item`,`div`),itemContent:e,ListComponent:o(`List`,`div`),ScrollerComponent:o(`Scroller`,`div`),scrollerRef:a,ScrollSeekPlaceholder:o(`ScrollSeekPlaceholder`),TopItemListComponent:o(`TopItemList`)}}))),X2=({height:e})=>(0,R.jsx)(`div`,{style:{height:e}}),Z2={overflowAnchor:`none`,position:U2(),zIndex:1},Q2={overflowAnchor:`none`},$2={...Q2,display:`inline-block`,height:`100%`},e4=w.memo(function({showTopList:e=!1}){let t=_4(`listState`),n=v4(`sizeRanges`),r=_4(`useWindowScroll`),i=_4(`customScrollParent`),a=v4(`windowScrollContainerState`),o=v4(`scrollContainerState`),s=i||r?a:o,c=_4(`itemContent`),l=_4(`context`),u=_4(`groupContent`),d=_4(`trackItemSizes`),f=_4(`itemSize`),p=_4(`log`),m=v4(`gap`),h=_4(`horizontalDirection`),{callbackRef:g}=W1(n,f,d,e?o1:s,p,m,i,h,_4(`skipAnimationFrameInResizeObserver`)),[_,v]=w.useState(0);g4(`deviation`,e=>{_!==e&&v(e)});let y=_4(`EmptyPlaceholder`),b=_4(`ScrollSeekPlaceholder`)??X2,x=_4(`ListComponent`),S=_4(`ItemComponent`),C=_4(`GroupComponent`),T=_4(`computeItemKey`),E=_4(`isSeeking`),D=_4(`groupIndices`).length>0,O=_4(`alignToBottom`),k=_4(`initialItemFinalLocationReached`),A=e?{}:{boxSizing:`border-box`,...h?{display:`inline-block`,height:`100%`,marginInlineStart:_===0?O?`auto`:0:_,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:`nowrap`}:{marginTop:_===0?O?`auto`:0:_,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...k?{}:{visibility:`hidden`}};return!e&&t.totalCount===0&&y!=null?(0,R.jsx)(y,{...o4(y,l)}):(0,R.jsx)(x,{...o4(x,l),"data-testid":e?`virtuoso-top-item-list`:`virtuoso-item-list`,ref:g,style:A,children:(e?t.topItems:t.items).map(e=>{let n=e.originalIndex,r=T(n+t.firstItemIndex,e.data,l);return E?(0,w.createElement)(b,{...o4(b,l),height:e.size,index:e.index,key:r,type:e.type||`item`,...e.type===`group`?{}:{groupIndex:e.groupIndex}}):e.type===`group`?(0,w.createElement)(C,{...o4(C,l),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:Z2},u(e.index,l)):(0,w.createElement)(S,{...o4(S,l),...s4(S,e.data),"data-index":n,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:h?$2:Q2},D?c(e.index,e.groupIndex,e.data,l):c(e.index,e.data,l))})})}),t4={height:`100%`,outline:`none`,overflowY:`auto`,position:`relative`,WebkitOverflowScrolling:`touch`},n4={outline:`none`,overflowX:`auto`,position:`relative`},r4=e=>({height:`100%`,position:`absolute`,top:0,width:`100%`,...e?{display:`flex`,flexDirection:`column`}:void 0}),i4=(e,t,n=0)=>({...r4(e),position:t?`relative`:`absolute`,top:t?-n:0}),a4={position:U2(),top:0,width:`100%`,zIndex:1};function o4(e,t){if(typeof e!=`string`)return{context:t}}function s4(e,t){return{item:typeof e==`string`?void 0:t}}var c4=w.memo(function(){let e=_4(`HeaderComponent`),t=v4(`headerHeight`),n=_4(`HeaderFooterTag`),r=H1(w.useMemo(()=>e=>{t(S0(e,`height`))},[t]),!0,_4(`skipAnimationFrameInResizeObserver`)),i=_4(`context`);return e==null?null:(0,R.jsx)(n,{ref:r,children:(0,R.jsx)(e,{...o4(e,i)})})}),l4=w.memo(function(){let e=_4(`FooterComponent`),t=v4(`footerHeight`),n=_4(`HeaderFooterTag`),r=H1(w.useMemo(()=>e=>{t(S0(e,`height`))},[t]),!0,_4(`skipAnimationFrameInResizeObserver`)),i=_4(`context`);return e==null?null:(0,R.jsx)(n,{ref:r,children:(0,R.jsx)(e,{...o4(e,i)})})});function u4({useEmitter:e,useEmitterValue:t,usePublisher:n}){return w.memo(function({children:r,style:i,context:a,...o}){let s=n(`scrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`scrollerRef`),d=t(`horizontalDirection`)||!1,{scrollByCallback:f,scrollerRef:p,scrollToCallback:m}=q2(s,l,c,u,void 0,d);return e(`scrollTo`,m),e(`scrollBy`,f),(0,R.jsx)(c,{"data-testid":`virtuoso-scroller`,"data-virtuoso-scroller":!0,ref:p,style:{...d?n4:t4,...i},tabIndex:0,...o,...o4(c,a),children:r})})}function d4({useEmitter:e,useEmitterValue:t,usePublisher:n}){return w.memo(function({children:r,style:i,context:a,...o}){let s=n(`windowScrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`totalListHeight`),d=t(`deviation`),f=t(`customScrollParent`),p=w.useRef(null),{scrollByCallback:m,scrollerRef:h,scrollToCallback:g}=q2(s,l,c,t(`scrollerRef`),f);return W2(()=>(h.current=f??p.current?.ownerDocument.defaultView,()=>{h.current=null}),[h,f]),e(`windowScrollTo`,g),e(`scrollBy`,m),(0,R.jsx)(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:`relative`,...i,...u===0?void 0:{height:u+d}},...o,...o4(c,a),children:r})})}var f4=({children:e})=>{let t=w.useContext(z2),n=v4(`viewportHeight`),r=v4(`fixedItemHeight`),i=_4(`alignToBottom`),a=_4(`horizontalDirection`),o=H1(w.useMemo(()=>t1(n,e=>S0(e,a?`width`:`height`)),[n,a]),!0,_4(`skipAnimationFrameInResizeObserver`));return w.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,R.jsx)(`div`,{"data-viewport-type":`element`,ref:o,style:r4(i),children:e})},p4=({children:e})=>{let t=w.useContext(z2),n=v4(`windowViewportRect`),r=v4(`fixedItemHeight`),i=_4(`customScrollParent`),a=_4(`useWindowScroll`),o=_4(`topListHeight`),s=q1(n,i,_4(`skipAnimationFrameInResizeObserver`)),c=_4(`alignToBottom`);return w.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,R.jsx)(`div`,{"data-viewport-type":`window`,ref:s,style:i4(c,a,o),children:e})},m4=({children:e})=>{let t=_4(`TopItemListComponent`)??`div`,n=_4(`headerHeight`),r={...a4,marginTop:`${n}px`},i=_4(`context`);return(0,R.jsx)(t,{style:r,...o4(t,i),children:e})},{Component:h4,useEmitter:g4,useEmitterValue:_4,usePublisher:v4}=R2(Y2,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,scrollIntoViewOnChange:`scrollIntoViewOnChange`,itemContent:`itemContent`,groupContent:`groupContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,groupCounts:`groupCounts`,topItemCount:`topItemCount`,firstItemIndex:`firstItemIndex`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,heightEstimates:`heightEstimates`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`HeaderFooterTag`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,horizontalDirection:`horizontalDirection`,skipAnimationFrameInResizeObserver:`skipAnimationFrameInResizeObserver`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,autoscrollToBottom:`autoscrollToBottom`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},w.memo(function(e){let t=_4(`useWindowScroll`),n=_4(`topItemsIndexes`).length>0,r=_4(`customScrollParent`),i=_4(`context`);return(0,R.jsxs)(r||t?b4:y4,{...e,context:i,children:[n&&(0,R.jsx)(m4,{children:(0,R.jsx)(e4,{showTopList:!0})}),(0,R.jsxs)(r||t?p4:f4,{children:[(0,R.jsx)(c4,{}),(0,R.jsx)(e4,{}),(0,R.jsx)(l4,{})]})]})})),y4=u4({useEmitter:g4,useEmitterValue:_4,usePublisher:v4}),b4=d4({useEmitter:g4,useEmitterValue:_4,usePublisher:v4}),x4=h4,S4=k1(([e,t])=>({...e,...t}),l1(F2,k1(()=>{let e=Q(e=>(0,R.jsxs)(`td`,{children:[`Item $`,e]})),t=Q(null),n=Q(e=>(0,R.jsxs)(`td`,{colSpan:1e3,children:[`Group `,e]})),r=Q(null),i=Q(null),a=Q({}),o=Q(J2),s=Q(o1),c=(e,t=null)=>T1(Z(a,X(t=>t[e]),_1()),t);return{components:a,computeItemKey:o,context:t,EmptyPlaceholder:c(`EmptyPlaceholder`),FillerRow:c(`FillerRow`),fixedFooterContent:i,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`),TableBodyComponent:c(`TableBody`,`tbody`),TableComponent:c(`Table`,`table`),TableFooterComponent:c(`TableFoot`,`tfoot`),TableHeadComponent:c(`TableHead`,`thead`),TableRowComponent:c(`TableRow`,`tr`),GroupComponent:c(`Group`,`tr`)}}))),C4=({height:e})=>(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{style:{height:e}})}),w4=({height:e})=>(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{style:{border:0,height:e,padding:0}})}),T4={overflowAnchor:`none`},E4={position:U2(),zIndex:2,overflowAnchor:`none`},D4=w.memo(function({showTopList:e=!1}){let t=N4(`listState`),n=N4(`computeItemKey`),r=N4(`firstItemIndex`),i=N4(`context`),a=N4(`isSeeking`),o=N4(`fixedHeaderHeight`),s=N4(`groupIndices`).length>0,c=N4(`itemContent`),l=N4(`groupContent`),u=N4(`ScrollSeekPlaceholder`)??C4,d=N4(`GroupComponent`),f=N4(`TableRowComponent`),p=(e?t.topItems:[]).reduce((e,t,n)=>(n===0?e.push(t.size):e.push(e[n-1]+t.size),e),[]);return(e?t.topItems:t.items).map(t=>{let m=t.originalIndex,h=n(m+r,t.data,i),g=e?m===0?0:p[m-1]:0;return a?(0,w.createElement)(u,{...o4(u,i),height:t.size,index:t.index,key:h,type:t.type||`item`}):t.type===`group`?(0,w.createElement)(d,{...o4(d,i),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,key:h,style:{...E4,top:o}},l(t.index,i)):(0,w.createElement)(f,{...o4(f,i),...s4(f,t.data),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,"data-item-group-index":t.groupIndex,key:h,style:e?{...E4,top:o+g}:T4},s?c(t.index,t.groupIndex,t.data,i):c(t.index,t.data,i))})}),O4=w.memo(function(){let e=N4(`listState`),t=N4(`topItemsIndexes`).length>0,n=P4(`sizeRanges`),r=N4(`useWindowScroll`),i=N4(`customScrollParent`),a=P4(`windowScrollContainerState`),o=P4(`scrollContainerState`),s=i||r?a:o,c=N4(`trackItemSizes`),{callbackRef:l,ref:u}=W1(n,N4(`itemSize`),c,s,N4(`log`),void 0,i,!1,N4(`skipAnimationFrameInResizeObserver`)),[d,f]=w.useState(0);M4(`deviation`,e=>{d!==e&&(u.current.style.marginTop=`${e}px`,f(e))});let p=N4(`EmptyPlaceholder`),m=N4(`FillerRow`)??w4,h=N4(`TableBodyComponent`),g=N4(`paddingTopAddition`),_=N4(`statefulTotalCount`),v=N4(`context`);if(_===0&&p!=null)return(0,R.jsx)(p,{...o4(p,v)});let y=(t?e.topItems:[]).reduce((e,t)=>e+t.size,0),b=e.offsetTop+g+d-y,x=e.offsetBottom,S=b>0?(0,R.jsx)(m,{context:v,height:b},`padding-top`):null,C=x>0?(0,R.jsx)(m,{context:v,height:x},`padding-bottom`):null;return(0,R.jsxs)(h,{"data-testid":`virtuoso-item-list`,ref:l,...o4(h,v),children:[S,t&&(0,R.jsx)(D4,{showTopList:!0}),(0,R.jsx)(D4,{}),C]})}),k4=({children:e})=>{let t=w.useContext(z2),n=P4(`viewportHeight`),r=P4(`fixedItemHeight`),i=H1(w.useMemo(()=>t1(n,e=>S0(e,`height`)),[n]),!0,N4(`skipAnimationFrameInResizeObserver`));return w.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,R.jsx)(`div`,{"data-viewport-type":`element`,ref:i,style:r4(!1),children:e})},A4=({children:e})=>{let t=w.useContext(z2),n=P4(`windowViewportRect`),r=P4(`fixedItemHeight`),i=N4(`customScrollParent`),a=N4(`useWindowScroll`),o=q1(n,i,N4(`skipAnimationFrameInResizeObserver`));return w.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,R.jsx)(`div`,{"data-viewport-type":`window`,ref:o,style:i4(!1,a),children:e})},{Component:j4,useEmitter:M4,useEmitterValue:N4,usePublisher:P4}=R2(S4,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,firstItemIndex:`firstItemIndex`,itemContent:`itemContent`,groupContent:`groupContent`,fixedHeaderContent:`fixedHeaderContent`,fixedFooterContent:`fixedFooterContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,topItemCount:`topItemCount`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,groupCounts:`groupCounts`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},w.memo(function(e){let t=N4(`useWindowScroll`),n=N4(`customScrollParent`),r=P4(`fixedHeaderHeight`),i=P4(`fixedFooterHeight`),a=N4(`fixedHeaderContent`),o=N4(`fixedFooterContent`),s=N4(`context`),c=H1(w.useMemo(()=>t1(r,e=>S0(e,`height`)),[r]),!0,N4(`skipAnimationFrameInResizeObserver`)),l=H1(w.useMemo(()=>t1(i,e=>S0(e,`height`)),[i]),!0,N4(`skipAnimationFrameInResizeObserver`)),u=n||t?I4:F4,d=n||t?A4:k4,f=N4(`TableComponent`),p=N4(`TableHeadComponent`),m=N4(`TableFooterComponent`),h=a?(0,R.jsx)(p,{ref:c,style:{position:`sticky`,top:0,zIndex:2},...o4(p,s),children:a()},`TableHead`):null,g=o?(0,R.jsx)(m,{ref:l,style:{bottom:0,position:`sticky`,zIndex:1},...o4(m,s),children:o()},`TableFoot`):null;return(0,R.jsx)(u,{...e,...o4(u,s),children:(0,R.jsx)(d,{children:(0,R.jsxs)(f,{style:{borderSpacing:0,overflowAnchor:`none`},...o4(f,s),children:[h,(0,R.jsx)(O4,{},`TableBody`),g]})})})})),F4=u4({useEmitter:M4,useEmitterValue:N4,usePublisher:P4}),I4=d4({useEmitter:M4,useEmitterValue:N4,usePublisher:P4}),L4={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},R4={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:z4,floor:B4,max:V4,min:H4,round:U4}=Math;function W4(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:n===null?null:n[r+e],index:r+e}))}function G4(e){return{...R4,items:e}}function K4(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function q4(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}var J4=k1(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:a,scrollBy:o,scrollContainerState:s,scrollTo:c,scrollTop:l,smoothScrollTargetReached:u,viewportHeight:d},f,p,{didMount:m,propsReady:h},{customScrollParent:g,useWindowScroll:_,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b},x])=>{let S=Q(0),C=Q(0),w=Q(L4),T=Q({height:0,width:0}),E=Q({height:0,width:0}),D=E1(),O=E1(),k=Q(0),A=Q(null),j=Q({column:0,row:0}),M=E1(),N=E1(),P=Q(!1),F=Q(0),ee=Q(!0),te=Q(!1),ne=Q(!1);u1(Z(m,S1(F),Y(([e,t])=>!X0(t))),()=>{d1(ee,!1)}),u1(Z(M1(m,ee,E,T,F,te),Y(([e,t,n,r,,i])=>e&&!t&&n.height!==0&&r.height!==0&&!i)),([,,,,e])=>{if(e===void 0){d1(ee,!0);return}d1(te,!0),J0(1,()=>{d1(D,e)}),m1(Z(l),()=>{d1(t,[0,0]),d1(ee,!0)})}),J(Z(N,Y(e=>e!=null&&e.scrollTop>0),v1(0)),C),u1(Z(m,S1(N),Y(([,e])=>e!=null)),([,e])=>{e&&(d1(T,e.viewport),d1(E,e.item),d1(j,e.gap),e.scrollTop>0&&(d1(P,!0),m1(Z(l,b1(1)),e=>{d1(P,!1)}),d1(c,{top:e.scrollTop})))}),J(Z(T,X(({height:e})=>e)),d),J(Z(M1($(T,K4),$(E,K4),$(j,(e,t)=>e!==void 0&&e.column===t.column&&e.row===t.row),$(l)),X(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),M),J(Z(M1($(S),r,$(j,q4),$(E,K4),$(T,K4),$(A),$(C),$(P),$(ee),$(F)),Y(([,,,,,,,e])=>!e),X(([e,[t,n],r,i,a,o,s,,c,l])=>{let{column:u,row:d}=r,{height:f,width:p}=i,{width:m}=a;if(s===0&&(e===0||m===0))return L4;if(p===0){let t=Y0(l,e);return G4(W4(t,t+Math.max(s-1,0),o))}let h=Y4(m,p,u),g,_;c?t===0&&n===0&&s>0?(g=0,_=s-1):(g=h*B4((t+d)/(f+d)),_=h*z4((n+d)/(f+d))-1,_=H4(e-1,V4(_,h-1)),g=H4(_,V4(0,g))):(g=0,_=-1);let v=W4(g,_,o),{bottom:y,top:b}=X4(a,r,i,v),x=z4(e/h);return{bottom:y,itemHeight:f,items:v,itemWidth:p,offsetBottom:x*f+(x-1)*d-y,offsetTop:b,top:b}})),w),J(Z(A,Y(e=>e!==null),X(e=>e.length)),S),J(Z(M1(T,E,w,j),Y(([e,t,{items:n}])=>n.length>0&&t.height!==0&&e.height!==0),X(([e,t,{items:n},r])=>{let{bottom:i,top:a}=X4(e,r,t,n);return[a,i]}),_1(_0)),t);let re=Q(!1);J(Z(l,S1(re),X(([e,t])=>t||e!==0)),re);let ie=D1(Z(M1(w,S),Y(([{items:e}])=>e.length>0),S1(re),Y(([[e,t],n])=>{let r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&e.offsetBottom===0&&e.items.length===t)&&r}),X(([[,e]])=>e-1),_1())),I=D1(Z($(w),Y(({items:e})=>e.length>0&&e[0].index===0),v1(0),_1())),ae=D1(Z($(w),S1(P),Y(([{items:e},t])=>e.length>0&&!t),X(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),_1(g0),x1(0)));J(ae,p.scrollSeekRangeChanged),J(Z(D,S1(T,E,S,j),X(([e,t,n,r,i])=>{let a=G0(e),{align:o,behavior:s,offset:c}=a,l=a.index;l===`LAST`&&(l=r-1),l=V4(0,l,H4(r-1,l));let u=Z4(t,i,n,l);return o===`end`?u=U4(u-t.height+n.height):o===`center`&&(u=U4(u-t.height/2+n.height/2)),c!==void 0&&c!==0&&(u+=c),{behavior:s,top:u}})),c);let oe=T1(Z(w,X(e=>e.offsetBottom+e.bottom)),0);return J(Z(b,X(e=>({height:e.visibleHeight,width:e.visibleWidth}))),T),{customScrollParent:g,data:A,deviation:k,footerHeight:i,gap:j,headerHeight:a,increaseViewportBy:e,initialItemCount:C,itemDimensions:E,overscan:n,restoreStateFrom:N,scrollBy:o,scrollContainerState:s,scrollHeight:O,scrollTo:c,scrollToIndex:D,scrollTop:l,smoothScrollTargetReached:u,totalCount:S,useWindowScroll:_,viewportDimensions:T,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b,...p,gridState:w,horizontalDirection:ne,initialTopMostItemIndex:F,totalListHeight:oe,...f,endReached:ie,propsReady:h,rangeChanged:ae,startReached:I,stateChanged:M,stateRestoreInProgress:P,...x}},l1(u2,J1,i2,O2,U0,k2,L1));function Y4(e,t,n){return V4(1,B4((e+n)/(B4(t)+n)))}function X4(e,t,n,r){let{height:i}=n;if(i===void 0||r.length===0)return{bottom:0,top:0};let a=Z4(e,t,n,r[0].index);return{bottom:Z4(e,t,n,r[r.length-1].index)+i,top:a}}function Z4(e,t,n,r){let i=B4(r/Y4(e.width,n.width,t.column)),a=i*n.height+V4(0,i-1)*t.row;return a>0?a+t.row:a}var Q4=k1(([e,t])=>({...e,...t}),l1(J4,k1(()=>{let e=Q(e=>`Item ${e}`),t=Q({}),n=Q(null),r=Q(`virtuoso-grid-item`),i=Q(`virtuoso-grid-list`),a=Q(J2),o=Q(`div`),s=Q(o1),c=(e,n=null)=>T1(Z(t,X(t=>t[e]),_1()),n),l=Q(!1),u=Q(!1);return J($(u),l),{components:t,computeItemKey:a,context:n,FooterComponent:c(`Footer`),HeaderComponent:c(`Header`),headerFooterTag:o,itemClassName:r,ItemComponent:c(`Item`,`div`),itemContent:e,listClassName:i,ListComponent:c(`List`,`div`),readyStateChanged:l,reportReadyState:u,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`,`div`)}}))),$4=w.memo(function(){let e=o3(`gridState`),t=o3(`listClassName`),n=o3(`itemClassName`),r=o3(`itemContent`),i=o3(`computeItemKey`),a=o3(`isSeeking`),o=s3(`scrollHeight`),s=o3(`ItemComponent`),c=o3(`ListComponent`),l=o3(`ScrollSeekPlaceholder`),u=o3(`context`),d=s3(`itemDimensions`),f=s3(`gap`),p=o3(`log`),m=o3(`stateRestoreInProgress`),h=s3(`reportReadyState`),g=H1(w.useMemo(()=>e=>{let t=e.parentElement.parentElement.scrollHeight;o(t);let n=e.firstChild;if(n!==null){let{height:e,width:t}=n.getBoundingClientRect();d({height:e,width:t})}f({column:u3(`column-gap`,getComputedStyle(e).columnGap,p),row:u3(`row-gap`,getComputedStyle(e).rowGap,p)})},[o,d,f,p]),!0,!1);return W2(()=>{e.itemHeight>0&&e.itemWidth>0&&h(!0)},[e]),m?null:(0,R.jsx)(c,{className:t,ref:g,...o4(c,u),"data-testid":`virtuoso-item-list`,style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(t=>{let o=i(t.index,t.data,u);return a?(0,R.jsx)(l,{...o4(l,u),height:e.itemHeight,index:t.index,width:e.itemWidth},o):(0,w.createElement)(s,{...o4(s,u),className:n,"data-index":t.index,key:o},r(t.index,t.data,u))})})}),e3=w.memo(function(){let e=o3(`HeaderComponent`),t=s3(`headerHeight`),n=o3(`headerFooterTag`),r=H1(w.useMemo(()=>e=>{t(S0(e,`height`))},[t]),!0,!1),i=o3(`context`);return e==null?null:(0,R.jsx)(n,{ref:r,children:(0,R.jsx)(e,{...o4(e,i)})})}),t3=w.memo(function(){let e=o3(`FooterComponent`),t=s3(`footerHeight`),n=o3(`headerFooterTag`),r=H1(w.useMemo(()=>e=>{t(S0(e,`height`))},[t]),!0,!1),i=o3(`context`);return e==null?null:(0,R.jsx)(n,{ref:r,children:(0,R.jsx)(e,{...o4(e,i)})})}),n3=({children:e})=>{let t=w.useContext(B2),n=s3(`itemDimensions`),r=s3(`viewportDimensions`),i=H1(w.useMemo(()=>e=>{r(e.getBoundingClientRect())},[r]),!0,!1);return w.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),(0,R.jsx)(`div`,{ref:i,style:r4(!1),children:e})},r3=({children:e})=>{let t=w.useContext(B2),n=s3(`windowViewportRect`),r=s3(`itemDimensions`),i=o3(`customScrollParent`),a=o3(`useWindowScroll`),o=q1(n,i,!1);return w.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),(0,R.jsx)(`div`,{ref:o,style:i4(!1,a),children:e})},{Component:i3,useEmitter:a3,useEmitterValue:o3,usePublisher:s3}=R2(Q4,{optional:{context:`context`,totalCount:`totalCount`,overscan:`overscan`,itemContent:`itemContent`,components:`components`,computeItemKey:`computeItemKey`,data:`data`,initialItemCount:`initialItemCount`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`headerFooterTag`,listClassName:`listClassName`,itemClassName:`itemClassName`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,restoreStateFrom:`restoreStateFrom`,initialTopMostItemIndex:`initialTopMostItemIndex`,increaseViewportBy:`increaseViewportBy`},methods:{scrollTo:`scrollTo`,scrollBy:`scrollBy`,scrollToIndex:`scrollToIndex`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,stateChanged:`stateChanged`,readyStateChanged:`readyStateChanged`}},w.memo(function({...e}){let t=o3(`useWindowScroll`),n=o3(`customScrollParent`),r=n||t?l3:c3,i=n||t?r3:n3,a=o3(`context`);return(0,R.jsx)(r,{...e,...o4(r,a),children:(0,R.jsxs)(i,{children:[(0,R.jsx)(e3,{}),(0,R.jsx)($4,{}),(0,R.jsx)(t3,{})]})})})),c3=u4({useEmitter:a3,useEmitterValue:o3,usePublisher:s3}),l3=d4({useEmitter:a3,useEmitterValue:o3,usePublisher:s3});function u3(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,P1.WARN),t===`normal`?0:parseInt(t??`0`,10)}var d3=2e3,f3=1e6;function p3(e,t,n,r=d3){let i=new Map((n===`replace`?[]:e).map(e=>[e.id,e]));for(let e of t)i.set(e.id,e);let a=[...i.values()].sort((e,t)=>e.timestamp-t.timestamp||e.id.localeCompare(t.id)),o=n===`older`?a.slice(0,r):a.slice(-r),s=0;if(n===`older`){let t=e[0]?.id,n=t==null?-1:o.findIndex(e=>e.id===t);n>0&&(s=-n)}else if(n===`newer`){let t=new Set(o.map(e=>e.id)),n=e.findIndex(e=>t.has(e.id));n>0&&(s=n)}return{events:o,firstItemIndexDelta:s}}function m3(){return(0,R.jsxs)(Ac,{width:430,position:`bottom-start`,shadow:`md`,children:[(0,R.jsx)(Ac.Target,{children:(0,R.jsx)(Kc,{variant:`subtle`,color:`gray`,"aria-label":`How CloudWatch attempts are detected`,children:(0,R.jsx)(xh,{size:19})})}),(0,R.jsxs)(Ac.Dropdown,{children:[(0,R.jsx)(U,{fw:700,mb:`xs`,children:`How CloudWatch attempts are detected`}),(0,R.jsxs)(Ep,{type:`ordered`,spacing:`xs`,size:`sm`,children:[(0,R.jsx)(Ep.Item,{children:`Read locally cached events in timestamp order.`}),(0,R.jsxs)(Ep.Item,{children:[`Extract `,(0,R.jsx)(qf,{children:`pid`}),` from structured messages or plain-text `,(0,R.jsx)(qf,{children:`pid=…`}),` markers.`]}),(0,R.jsx)(Ep.Item,{children:`Order unique PIDs by first event; each PID establishes one attempt window.`}),(0,R.jsx)(Ep.Item,{children:`Show every cached event in that window, including untagged setup and teardown lines.`})]}),(0,R.jsx)(nd,{color:`yellow`,variant:`light`,mt:`md`,icon:(0,R.jsx)(uh,{size:17}),children:`An auxiliary process with its own PID may be mistaken for a recovery attempt.`})]})]})}function h3({resource:e}){let t=e.skypilot.job_id,[n,r]=(0,w.useState)([]),[i,a]=(0,w.useState)(`Loading cached logs…`),[o,s]=(0,w.useState)([]),[c,l]=(0,w.useState)(0),[u,d]=(0,w.useState)(!1),[f,p]=(0,w.useState)(null),[m,h]=(0,w.useState)(null),[g,_]=(0,w.useState)(null),[v,y]=(0,w.useState)(!1),[b,x]=(0,w.useState)(!1),[S,C]=(0,w.useState)(null),[T,E]=(0,w.useState)(!1),[D,O]=(0,w.useState)(0),[k,A]=(0,w.useState)(f3),j=(0,w.useRef)(!1),M=(0,w.useRef)(null),N=(0,w.useRef)(!1),P=(0,w.useRef)(!1),F=`${t??`none`}:${g??`none`}`,ee=(0,w.useRef)(F);ee.current=F,(0,w.useEffect)(()=>{!N.current||n.length===0||(N.current=!1,M.current?.scrollToIndex({index:k,align:`start`}))},[k,n]),(0,w.useEffect)(()=>{if(t==null||e.skypilot.cloud?.toLowerCase()!==`aws`||!e.skypilot.cluster_name)return;let n=new AbortController,r;d(!0);let i=()=>{fetch(`/api/logs/${t}/attempts`,{signal:n.signal}).then(async e=>{if(!e.ok)throw Error(await e.text());return e.json()}).then(({attempts:e,expected_attempts:t,indexing:n,backfill:o,error:c})=>{s(e),l(t),d(n),p(o.cached_events),h(c),c&&a(c);let u=e.find(e=>e.current)??e.at(-1);_(u?e=>e==null||e===`live`?u.attempt.toString():e:e=>e??`live`),n&&(r=window.setTimeout(i,5e3))}).catch(e=>{e.name!==`AbortError`&&(d(!1),h(e.message))})};return i(),()=>{n.abort(),r!=null&&window.clearTimeout(r)}},[t,e.skypilot.cloud,e.skypilot.cluster_name]),(0,w.useEffect)(()=>{if(t==null||e.skypilot.cloud?.toLowerCase()!==`aws`||!e.skypilot.cluster_name||!g||T)return;j.current=!1,r([]),y(!1),x(!1),A(f3),a(`Loading cached logs…`);let n=g===`live`?`/api/logs/${t}`:`/api/logs/${t}?attempt=${g}`,i=new EventSource(n),o=(e,t=!1)=>{let n=JSON.parse(e.data);r(e=>p3(e,n.events,t?`replace`:`live`).events),y(n.has_older),x(n.has_newer),a(``),t&&P.current&&(P.current=!1,j.current=!1,C(null),window.requestAnimationFrame(()=>M.current?.scrollToIndex({index:f3+n.events.length-1,align:`end`})))};return i.onmessage=o,i.addEventListener(`tail`,e=>o(e,!0)),i.onerror=()=>{P.current=!1,j.current=!1,C(null),a(`Waiting for cached log updates…`)},i.addEventListener(`complete`,()=>{i.close(),a(`— End of attempt —`)}),()=>i.close()},[t,e.skypilot.cloud,e.skypilot.cluster_name,g,T,D]);let te=async e=>{let i=ee.current,o=e===`older`?n[0]:n.at(-1);if(!(j.current||t==null||!g||g===`live`||!o||(e===`older`?!v:!b))){j.current=!0,C(e),e===`older`&&E(!0);try{let s=new URLSearchParams({attempt:g,[e===`older`?`before`:`after`]:`${o.timestamp}:${o.id}`}),c=await fetch(`/api/logs/${t}/page?${s}`);if(!c.ok)throw Error(await c.text());let l=await c.json();if(ee.current!==i)return;let u=p3(n,l.events,e);u.firstItemIndexDelta!==0&&A(e=>e+u.firstItemIndexDelta),r(u.events),y(l.has_older),x(l.has_newer),a(l.events.length?``:e===`older`?`— Start of attempt —`:`— End of attempt —`),e===`newer`&&!l.has_newer&&(E(!1),O(e=>e+1))}catch(e){a(e instanceof Error?e.message:String(e))}finally{ee.current===i&&(j.current=!1,C(null))}}},ne=async e=>{let n=ee.current;if(!(j.current||t==null||!g||g===`live`)){if(j.current=!0,C(e),a(`Loading ${e} of attempt…`),e===`end`){P.current=!0,E(!1),O(e=>e+1);return}E(!0);try{let e=new URLSearchParams({attempt:g,edge:`start`}),i=await fetch(`/api/logs/${t}/page?${e}`);if(!i.ok)throw Error(await i.text());let o=await i.json();if(ee.current!==n)return;r(o.events),y(o.has_older),x(o.has_newer),A(f3),a(o.events.length?``:`— Start of attempt —`),N.current=o.events.length>0}catch(e){a(e instanceof Error?e.message:String(e))}finally{ee.current===n&&(j.current=!1,C(null))}}};return t==null||e.skypilot.cloud?.toLowerCase()!==`aws`?(0,R.jsx)(nd,{color:`gray`,icon:(0,R.jsx)(Th,{size:18}),children:`CloudWatch logs are unavailable for this run.`}):e.skypilot.cluster_name?(0,R.jsxs)(Vf,{withBorder:!0,padding:`lg`,children:[(0,R.jsxs)(nl,{mb:`md`,justify:`space-between`,align:`flex-end`,children:[(0,R.jsxs)(H,{children:[(0,R.jsxs)(nl,{gap:`xs`,children:[(0,R.jsx)(Th,{size:20}),(0,R.jsx)(nh,{order:2,children:`CloudWatch logs`}),(0,R.jsx)(m3,{})]}),(0,R.jsx)(U,{c:`dimmed`,size:`sm`,children:`Served from the local raw cache`})]}),(0,R.jsxs)(nl,{gap:`xs`,align:`flex-end`,children:[(0,R.jsx)(mm,{label:`Attempt`,placeholder:`Finding attempts…`,value:g,onChange:e=>{E(!1),A(f3),_(e)},data:[...o.length===0?[{value:`live`,label:`Latest cached logs`}]:[],...o.map(e=>({value:e.attempt.toString(),label:`Attempt ${e.attempt}${e.current?` · current/live`:``} · PID ${e.pid}`}))],w:360}),u&&(0,R.jsx)(Rc,{size:`xs`,mb:`sm`}),(0,R.jsx)(fm,{label:m??void 0,disabled:!m,children:(0,R.jsxs)(Tf,{mb:`sm`,color:m?`red`:u?`blue`:o.length===c?`green`:`yellow`,variant:`light`,children:[u?`Backfilling${f==null?``:` · ${f.toLocaleString()} events`} · `:``,o.length,`/`,c||`?`,` attempts`]})})]})]}),(0,R.jsxs)(nl,{justify:`space-between`,mb:`xs`,children:[(0,R.jsxs)(nl,{gap:`xs`,children:[(0,R.jsx)(fm,{label:`Jump to start of attempt`,children:(0,R.jsx)(Kc,{"aria-label":`Jump to start of attempt`,variant:`light`,loading:S===`start`,disabled:!g||g===`live`,onClick:()=>void ne(`start`),children:(0,R.jsx)(fh,{size:17})})}),(0,R.jsx)(fm,{label:`Jump to end of attempt`,children:(0,R.jsx)(Kc,{"aria-label":`Jump to end of attempt`,variant:`light`,loading:S===`end`,disabled:!g||g===`live`,onClick:()=>void ne(`end`),children:(0,R.jsx)(dh,{size:17})})}),(0,R.jsx)(U,{size:`xs`,c:`dimmed`,children:S?`Loading ${S} cached events…`:`Scroll to the top or bottom to load more`})]}),(0,R.jsxs)(U,{size:`xs`,c:`dimmed`,children:[n.length.toLocaleString(),` events in memory · maximum `,d3.toLocaleString()]})]}),(0,R.jsx)(H,{bg:`dark.9`,style:{height:620,overflow:`hidden`},children:(0,R.jsx)(x4,{ref:M,data:n,firstItemIndex:k,followOutput:!T&&`auto`,startReached:()=>void te(`older`),endReached:()=>void te(`newer`),computeItemKey:(e,t)=>t.id,itemContent:(e,t)=>(0,R.jsxs)(H,{px:`md`,py:2,c:`green.2`,ff:`monospace`,fz:`xs`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:[(0,R.jsxs)(`span`,{children:[`[`,new Date(t.timestamp).toLocaleTimeString(),`] `]}),(0,R.jsx)(`span`,{dangerouslySetInnerHTML:{__html:t.html}})]}),components:{Footer:()=>i?(0,R.jsx)(U,{c:`dimmed`,ff:`monospace`,fz:`xs`,p:`md`,children:i}):null}})})]}):(0,R.jsxs)(Vf,{withBorder:!0,padding:`lg`,children:[(0,R.jsxs)(nl,{gap:`xs`,mb:`sm`,children:[(0,R.jsx)(Th,{size:20}),(0,R.jsx)(nh,{order:2,children:`CloudWatch logs`}),(0,R.jsx)(m3,{})]}),(0,R.jsxs)(nd,{color:`yellow`,icon:(0,R.jsx)(uh,{size:18}),children:[`Logs are not populated yet. SkyPilot reports this job as `,(0,R.jsx)(qf,{children:e.status.skypilot??`unknown`}),` and has not published its AWS cluster link. The collector will retry during refreshes.`]})]})}var g3=new Set([`PENDING`,`SUBMITTED`,`STARTING`,`RUNNING`,`WINDING_DOWN`,`RECOVERING`,`CANCELLING`,`AUTOSTOPPING`,`INIT`,`UP`]),_3=/(gpu|tpu|b200|h200|h100|a100|v100|l40|l4|t4|a10)/i;function v3(e){return e.filter(e=>g3.has(e.status.skypilot??``)).flatMap(e=>{let t=[],n=e.progress.completed_batches!=null||e.progress.tokens_per_second!=null;return _3.test(e.skypilot.resources??``)&&!n&&t.push(`Idle GPU candidate`),e.kind===`managed_job`&&e.wandb_id==null&&t.push(`Orphan candidate`),e.kind===`cluster`&&(e.timing.elapsed_seconds??0)>=172800&&t.push(`Zombie dev box candidate`),t.length?[{resource:e,reasons:t}]:[]})}function y3(e){return e.filter(e=>(e.retries.total_recoveries??0)>0||(e.retries.preemption_or_infrastructure??0)>0||(e.retries.application_error??0)>0).sort((e,t)=>(t.retries.total_recoveries??0)-(e.retries.total_recoveries??0))}function b3(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e)??{name:e,spend:0,hourly:0};i.spend+=r.cost.estimated_spend_usd??0,g3.has(r.status.skypilot??``)&&(i.hourly+=r.cost.hourly_usd??0),n.set(e,i)}return[...n.values()].filter(e=>e.spend>0||e.hourly>0).sort((e,t)=>t.spend-e.spend)}function x3(e,t){return t===`name`?`${e.user}/${e.project}/${e.name}`:t===`progress`?e.progress.progress_fraction??-1:t===`started`?e.timing.started_at??``:t===`cost`?e.cost.estimated_spend_usd??-1:`${e.skypilot.cloud}/${e.skypilot.region}`}function S3(e,t,n,r){if(n===`status`){let n=Number(t.status.skypilot?.toUpperCase()===`RUNNING`)-Number(e.status.skypilot?.toUpperCase()===`RUNNING`),i=(t.submitted_at??``).localeCompare(e.submitted_at??``),a=n||i||e.name.localeCompare(t.name,void 0,{numeric:!0});return r?-a:a}let i=x3(e,n),a=x3(t,n),o=typeof i==`number`&&typeof a==`number`?i-a:String(i).localeCompare(String(a),void 0,{numeric:!0});return r?-o:o}function C3({page:e,queryStatus:t,onOpenStatus:n,onRefresh:r}){let{colorScheme:i,setColorScheme:a}=Ft(),o=!!(t?.refresh.last_error||t?.queries.some(e=>e.status===`error`)),s=!!t?.queries.some(e=>e.status===`warning`),c=o?`red`:s?`yellow`:`green`;return(0,R.jsx)(Nd.Header,{px:`md`,className:`hud-header`,children:(0,R.jsxs)(nl,{h:`100%`,justify:`space-between`,wrap:`nowrap`,children:[(0,R.jsxs)(nl,{gap:`sm`,wrap:`nowrap`,children:[(0,R.jsx)(Ym,{className:`hud-logo`,size:`lg`,children:(0,R.jsx)(`img`,{src:`/static/dist/overwatch-favicon.svg`,width:30,height:30,alt:``})}),(0,R.jsx)(ld,{href:`/`,c:`inherit`,underline:`never`,className:`hud-brand`,children:`Overwatch`}),(0,R.jsx)(Tf,{color:c,variant:`light`,size:`xs`,children:o?`Degraded`:`Live`})]}),(0,R.jsxs)(nl,{gap:`xs`,wrap:`nowrap`,children:[(0,R.jsx)(Pf,{component:`a`,href:`/`,variant:e===`resources`||e===`run`?`light`:`subtle`,leftSection:(0,R.jsx)(wh,{size:16}),children:`Resources`}),(0,R.jsx)(Pf,{component:`a`,href:`/cost-waste`,variant:e===`cost-waste`?`light`:`subtle`,leftSection:(0,R.jsx)(vh,{size:16}),children:`Cost & waste`}),(0,R.jsx)(Pf,{component:`a`,href:`/billing`,variant:e===`billing`?`light`:`subtle`,leftSection:(0,R.jsx)(mh,{size:16}),children:`Billing`}),(0,R.jsx)(Pf,{variant:`subtle`,leftSection:(0,R.jsx)(Sh,{size:16}),loading:t?.refresh.in_progress??!1,onClick:r,children:`Refresh`}),(0,R.jsx)(Pf,{variant:`subtle`,color:c,leftSection:(0,R.jsx)(lh,{size:16}),onClick:n,children:`Status`}),(0,R.jsx)(mm,{"aria-label":`Color scheme`,allowDeselect:!1,data:[{value:`auto`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}],value:i,onChange:e=>e&&a(e),w:105})]})]})})}function w3({label:e,secondaryLabel:t,value:n,active:r,descending:i,onSort:a}){return(0,R.jsx)(W.Th,{children:(0,R.jsxs)(Rs,{fw:700,onClick:()=>a(n),children:[(0,R.jsxs)(`span`,{children:[e,` `,r?i?`↓`:`↑`:`↕`]}),t&&(0,R.jsx)(U,{component:`span`,display:`block`,size:`xs`,c:`dimmed`,fw:400,children:t})]})})}function T3({resource:e}){let t=[{label:`W&B`,url:e.links.wandb,color:`yellow`,icon:(0,R.jsx)(U,{component:`span`,size:`sm`,fw:900,c:`yellow.8`,children:`W`})},{label:`SkyPilot`,url:e.links.skypilot,color:`blue`,icon:(0,R.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 27 27`,"aria-hidden":`true`,children:(0,R.jsx)(`path`,{fill:`#094AD0`,fillRule:`evenodd`,d:`M19.94 25.75c-.08.31-.12.46-.18.55a.7.7 0 0 1-.91.25c-.1-.05-.22-.16-.45-.39l-7-7c-.15-.15-.22-.23-.28-.31a1.4 1.4 0 0 1-.24-.88c.01-.1.04-.2.1-.41l.6-2.27c.02-.07.03-.1.03-.13a.16.16 0 0 0-.15-.15c-.02 0-.06.01-.13.03l-2.26.61c-.21.06-.31.08-.41.09a1.4 1.4 0 0 1-.89-.23c-.08-.06-.15-.14-.3-.29l-7-7c-.23-.23-.34-.34-.4-.44a.7.7 0 0 1 .25-.91c.1-.06.25-.1.56-.19L25.38.12c.31-.08.47-.13.58-.12.36.02.65.31.67.67 0 .11-.04.27-.12.57l-6.57 24.51ZM5.49 8.37c-.14.04-.2.06-.25.09a.32.32 0 0 0-.1.41c.02.05.07.1.17.2l3.42 3.42c.06.06.09.09.12.11.1.07.21.1.33.09.04 0 .08-.02.15-.04l5.66-1.52c.14-.04.2-.05.25-.05.17.01.3.14.3.3.01.05 0 .12-.04.26l-1.52 5.65c-.02.08-.04.12-.04.16-.01.11.02.23.09.32.02.03.05.06.1.12l3.43 3.43c.1.1.15.15.2.17.14.08.32.03.4-.1.03-.05.05-.12.09-.26l4.5-16.76c.04-.14.06-.21.06-.26a.32.32 0 0 0-.3-.3c-.05 0-.12.01-.26.05L5.49 8.37Z`})})},{label:`Zymtrace`,url:e.links.zymtrace,color:`grape`,icon:(0,R.jsx)(`img`,{alt:``,src:`https://zymtrace.com/favicon.ico`,width:18,height:18})}];return(0,R.jsxs)(nl,{gap:4,wrap:`wrap`,maw:116,children:[t.map(({label:e,url:t,color:n,icon:r})=>t?(0,R.jsx)(fm,{label:e,children:(0,R.jsx)(Kc,{component:`a`,href:t,target:`_blank`,color:n,variant:`subtle`,"aria-label":e,children:r})},e):null),e.storage.run_uri&&(0,R.jsx)($f,{value:e.storage.run_uri,children:({copied:e,copy:t})=>(0,R.jsx)(fm,{label:e?`Copied`:`Copy storage URI`,children:(0,R.jsx)(Kc,{"aria-label":`Copy storage URI`,color:e?`green`:`gray`,variant:`subtle`,onClick:t,children:e?(0,R.jsx)(hh,{size:16}):(0,R.jsx)(yh,{size:16})})})})]})}function E3({resource:e}){return e.skypilot.job_id==null?(0,R.jsx)(U,{fw:600,children:e.name}):(0,R.jsx)(ld,{fw:600,href:`/runs/${e.skypilot.job_id}`,children:e.name})}function D3({resources:e}){let[t,n]=(0,w.useState)(`status`),[r,i]=(0,w.useState)(!1),[a,o]=(0,w.useState)(``),s=(0,w.useMemo)(()=>{let n=a.trim().toLocaleLowerCase();return[...n?e.filter(e=>[e.name,e.user,e.project,e.wandb_id,e.git.commit,e.kind,e.status.skypilot,e.status.wandb,e.skypilot.job_id,e.skypilot.job_name,e.skypilot.cluster_name,e.skypilot.resources,e.skypilot.cloud,e.skypilot.region].filter(e=>e!=null).some(e=>String(e).toLocaleLowerCase().includes(n))):e].sort((e,n)=>S3(e,n,t,r))},[r,e,a,t]),c=e=>{t===e?i(e=>!e):(n(e),i(!1))};return(0,R.jsx)(R.Fragment,{children:(0,R.jsxs)(Vf,{withBorder:!0,padding:0,children:[e.length>1&&(0,R.jsx)(H,{p:`md`,children:(0,R.jsx)(Km,{"aria-label":`Search resources`,placeholder:`Search resources by name, user, project, status, cloud, region, or job ID…`,leftSection:(0,R.jsx)(Ch,{size:17}),rightSection:(0,R.jsxs)(U,{size:`xs`,c:`dimmed`,children:[s.length,`/`,e.length]}),rightSectionWidth:64,value:a,onChange:e=>o(e.currentTarget.value)})}),(0,R.jsx)(W.ScrollContainer,{minWidth:0,children:(0,R.jsxs)(W,{className:`resources-table`,striped:!0,highlightOnHover:!0,verticalSpacing:`sm`,children:[(0,R.jsxs)(`colgroup`,{children:[(0,R.jsx)(`col`,{style:{width:`21%`}}),(0,R.jsx)(`col`,{style:{width:`16%`}}),(0,R.jsx)(`col`,{style:{width:`7%`}}),(0,R.jsx)(`col`,{style:{width:`13%`}}),(0,R.jsx)(`col`,{style:{width:`9%`}}),(0,R.jsx)(`col`,{style:{width:`10%`}}),(0,R.jsx)(`col`,{style:{width:`10%`}}),(0,R.jsx)(`col`,{style:{width:`10%`}}),(0,R.jsx)(`col`,{style:{width:`4%`}})]}),(0,R.jsx)(W.Thead,{children:(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(w3,{label:`User / job ID`,secondaryLabel:`project / experiment`,value:`name`,active:t===`name`,descending:r,onSort:c}),(0,R.jsx)(w3,{label:`Status`,secondaryLabel:`running, then newest submitted`,value:`status`,active:t===`status`,descending:r,onSort:c}),(0,R.jsx)(W.Th,{children:`Git checkout`}),(0,R.jsx)(w3,{label:`Progress`,value:`progress`,active:t===`progress`,descending:r,onSort:c}),(0,R.jsxs)(W.Th,{children:[`Retries`,(0,R.jsx)(U,{size:`xs`,c:`dimmed`,fw:400,children:`total | preempts | error`})]}),(0,R.jsx)(w3,{label:`Started`,secondaryLabel:`elapsed > time left`,value:`started`,active:t===`started`,descending:r,onSort:c}),(0,R.jsx)(w3,{label:`Cost`,secondaryLabel:`spent / projected · $/hr`,value:`cost`,active:t===`cost`,descending:r,onSort:c}),(0,R.jsx)(w3,{label:`Cloud / region`,secondaryLabel:`instance resources`,value:`cloud`,active:t===`cloud`,descending:r,onSort:c}),(0,R.jsx)(W.Th,{children:`Links`})]})}),(0,R.jsxs)(W.Tbody,{children:[s.length===0&&(0,R.jsx)(W.Tr,{children:(0,R.jsx)(W.Td,{colSpan:9,children:(0,R.jsx)(Wf,{py:`xl`,children:(0,R.jsxs)(U,{c:`dimmed`,children:[`No resources match “`,a.trim(),`”.`]})})})}),s.map(e=>{let t=Math.max(0,Math.min(100,(e.progress.progress_fraction??0)*100));return(0,R.jsxs)(W.Tr,{children:[(0,R.jsxs)(W.Td,{children:[(0,R.jsxs)(U,{size:`xs`,c:`dimmed`,children:[e.user??`—`,` / `,e.skypilot.job_id??`—`]}),(0,R.jsxs)(Dm,{gap:0,children:[(0,R.jsxs)(nl,{gap:4,wrap:`nowrap`,children:[e.project&&e.links.wandb?(0,R.jsx)(ld,{href:e.links.wandb.split(`/runs/`,1)[0],target:`_blank`,rel:`noreferrer`,children:e.project}):(0,R.jsx)(U,{children:e.project??`—`}),(0,R.jsx)(U,{children:`/`})]}),(0,R.jsx)(E3,{resource:e})]})]}),(0,R.jsx)(W.Td,{children:(0,R.jsxs)(Dm,{gap:4,align:`flex-start`,children:[e.status.wandb&&(0,R.jsxs)(Tf,{color:W$(e.status.wandb),variant:`light`,children:[`W&B · `,e.status.wandb]}),(0,R.jsxs)(Tf,{color:W$(e.status.skypilot),variant:`light`,children:[`Sky · `,e.status.skypilot??`unknown`]})]})}),(0,R.jsx)(W.Td,{children:e.git.commit&&e.git.url?(0,R.jsx)(ld,{ff:`monospace`,href:e.git.url,target:`_blank`,rel:`noreferrer`,children:e.git.commit.slice(0,8)}):(0,R.jsx)(U,{c:`dimmed`,children:`—`})}),(0,R.jsxs)(W.Td,{children:[e.progress.total_batches?(0,R.jsxs)(Dm,{gap:4,children:[(0,R.jsxs)(U,{size:`xs`,children:[e.progress.completed_batches?.toLocaleString(),`/`,e.progress.total_batches.toLocaleString(),` batches`]}),(0,R.jsx)(Qp.Root,{size:`lg`,autoContrast:!0,children:(0,R.jsx)(Qp.Section,{value:t,children:(0,R.jsxs)(Qp.Label,{children:[Math.round(t),`%`]})})})]}):(0,R.jsx)(U,{c:`dimmed`,children:`—`}),e.progress.tokens_per_second!=null&&(0,R.jsxs)(U,{size:`xs`,c:`dimmed`,mt:4,children:[e.progress.tokens_per_second.toLocaleString(),` tok/s`]})]}),(0,R.jsxs)(W.Td,{children:[e.retries.total_recoveries??`?`,` | `,e.retries.preemption_or_infrastructure??`?`,` | `,e.retries.application_error??`?`]}),(0,R.jsxs)(W.Td,{children:[(0,R.jsx)(U,{size:`xs`,c:`dimmed`,children:H$(e.timing.started_at)}),(0,R.jsxs)(U,{children:[U$(e.timing.elapsed_seconds),` > `,U$(e.progress.estimated_remaining_seconds)]})]}),(0,R.jsxs)(W.Td,{children:[(0,R.jsxs)(U,{children:[V$(e.cost.estimated_spend_usd),` / `,V$(e.cost.estimated_total_usd)]}),(0,R.jsxs)(U,{size:`xs`,c:`dimmed`,children:[V$(e.cost.hourly_usd),`/hr`]})]}),(0,R.jsxs)(W.Td,{children:[(0,R.jsx)(U,{children:e.skypilot.cloud??`—`}),(0,R.jsx)(U,{size:`xs`,c:`dimmed`,children:e.skypilot.region??`—`}),(0,R.jsx)(U,{size:`xs`,ff:`monospace`,mt:3,style:{overflowWrap:`anywhere`},children:e.skypilot.resources??`—`})]}),(0,R.jsx)(W.Td,{children:(0,R.jsx)(T3,{resource:e})})]},`${e.kind}-${e.skypilot.job_id??e.name}`)})]})]})})]})})}function O3({projects:e}){return e.length?(0,R.jsx)(Dm,{gap:`lg`,children:e.map(e=>(0,R.jsxs)(Vf,{withBorder:!0,children:[(0,R.jsx)(nh,{order:3,mb:`md`,children:e.project}),(0,R.jsx)(W.ScrollContainer,{minWidth:700,children:(0,R.jsxs)(W,{striped:!0,withColumnBorders:!0,children:[(0,R.jsx)(W.Thead,{children:(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Th,{children:`Field`}),e.runs.map(e=>(0,R.jsx)(W.Th,{children:(0,R.jsx)(ld,{href:e.wandb_url??void 0,target:`_blank`,rel:`noreferrer`,children:e.experiment_name})},e.wandb_id))]})}),(0,R.jsx)(W.Tbody,{children:e.fields.map(e=>(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Td,{children:(0,R.jsx)(qf,{children:e.field})}),e.values.map(e=>(0,R.jsx)(W.Td,{children:(0,R.jsx)(qf,{children:e.missing?``:JSON.stringify(e.value)})},e.wandb_id))]},e.field))})]})})]},e.project))}):(0,R.jsx)(U,{c:`dimmed`,children:`No differing TrainConfig fields.`})}function k3({report:e}){let t=e.resources.filter(e=>g3.has(e.status.skypilot??``)),n=t.reduce((e,t)=>e+(t.cost.hourly_usd??0),0),r=e.resources.reduce((e,t)=>e+(t.cost.estimated_spend_usd??0),0),i=t.reduce((e,t)=>e+(t.cost.estimated_total_usd??0),0);return(0,R.jsxs)(Dm,{gap:`xl`,children:[(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:1,children:`Resource overview`}),(0,R.jsxs)(U,{c:`dimmed`,children:[e.resources.length,` cloud resources · generated `,H$(e.generated_at)]})]}),(0,R.jsx)(K$,{warnings:e.warnings}),(0,R.jsxs)(Cm,{cols:{base:1,sm:3},children:[(0,R.jsx)(q$,{label:`Live burn rate`,value:`${V$(n)}/hr`}),(0,R.jsx)(q$,{label:`Spent so far`,value:V$(r)}),(0,R.jsx)(q$,{label:`Active projected total`,value:V$(i)})]}),(0,R.jsxs)(H,{id:`resources`,children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Resources`}),(0,R.jsx)(D3,{resources:e.resources})]}),(0,R.jsxs)(H,{id:`config`,children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Running Job TrainConfig Deltas`}),(0,R.jsx)(O3,{projects:e.config_differences})]})]})}function A3({report:e,jobId:t}){let n=e.resources.find(e=>e.skypilot.job_id===t);return n?(0,R.jsxs)(Dm,{gap:`xl`,children:[(0,R.jsxs)(H,{children:[(0,R.jsx)(Pf,{component:`a`,href:`/`,variant:`subtle`,leftSection:(0,R.jsx)(ph,{size:16}),mb:`sm`,children:`All resources`}),(0,R.jsxs)(nl,{justify:`space-between`,align:`flex-start`,children:[(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:1,children:n.name}),(0,R.jsxs)(U,{c:`dimmed`,children:[`SkyPilot job `,t,` · `,n.user??`Unknown user`,` · `,n.project??`No W&B project`]})]}),(0,R.jsxs)(nl,{gap:`xs`,children:[n.status.wandb&&(0,R.jsxs)(Tf,{color:W$(n.status.wandb),size:`lg`,variant:`light`,children:[`W&B · `,n.status.wandb]}),(0,R.jsxs)(Tf,{color:W$(n.status.skypilot),size:`lg`,variant:`light`,children:[`Sky · `,n.status.skypilot??`unknown`]})]})]})]}),(n.cache?.missing_files.length??0)>0&&(0,R.jsxs)(nd,{color:`yellow`,icon:(0,R.jsx)(uh,{size:18}),title:`Raw cache is incomplete`,children:[`Missing cached `,n.cache.missing_files.length===1?`file`:`files`,`: `,n.cache.missing_files.map((e,t)=>(0,R.jsxs)(w.Fragment,{children:[t>0&&`, `,(0,R.jsx)(qf,{children:e}),n.cache.errors[e]&&` (${n.cache.errors[e]})`]},e)),`. W&B and TrainConfig files may remain unavailable until the workload initializes them.`]}),(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Run telemetry`}),(0,R.jsx)(D3,{resources:[n]})]}),(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Extra Info`}),(0,R.jsx)(Vf,{withBorder:!0,padding:0,children:(0,R.jsxs)(W,{verticalSpacing:`sm`,withColumnBorders:!0,children:[(0,R.jsx)(W.Thead,{children:(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Th,{children:`Raw cache directory`}),(0,R.jsx)(W.Th,{children:`TrainConfig run_dir`})]})}),(0,R.jsx)(W.Tbody,{children:(0,R.jsx)(W.Tr,{children:[{label:`Raw cache directory`,value:`${e.raw_cache_root??`~/.cache/overwatch/raw-v1`}/jobs/${t}`},{label:`TrainConfig run_dir`,value:n.storage.run_uri}].map(({label:e,value:t})=>(0,R.jsx)(W.Td,{w:`50%`,children:(0,R.jsxs)(nl,{justify:`space-between`,wrap:`nowrap`,align:`flex-start`,children:[(0,R.jsx)(qf,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:t??`—`}),(0,R.jsx)($f,{value:t??``,children:({copied:n,copy:r})=>(0,R.jsx)(fm,{label:n?`Copied`:`Copy ${e}`,children:(0,R.jsx)(Kc,{"aria-label":`Copy ${e}`,color:n?`green`:`gray`,variant:`subtle`,disabled:!t,onClick:r,children:n?(0,R.jsx)(hh,{size:16}):(0,R.jsx)(_h,{size:16})})})})]})},e))})})]})})]}),(0,R.jsx)(h3,{resource:n})]}):(0,R.jsxs)(nd,{color:`yellow`,icon:(0,R.jsx)(uh,{size:18}),children:[`Job `,t,` is not present in the retained SkyPilot cache.`]})}function j3({title:e,rows:t}){let n=Math.max(...t.map(e=>e.spend),0);return(0,R.jsxs)(Vf,{withBorder:!0,children:[(0,R.jsx)(nh,{order:3,mb:`md`,children:e}),t.length?(0,R.jsx)(Dm,{gap:`md`,children:t.map(e=>(0,R.jsxs)(H,{children:[(0,R.jsxs)(nl,{justify:`space-between`,wrap:`nowrap`,children:[(0,R.jsx)(U,{fw:600,truncate:!0,children:e.name}),(0,R.jsx)(U,{size:`sm`,children:V$(e.spend)})]}),(0,R.jsx)(Qp,{value:n?e.spend/n*100:0,mt:4}),(0,R.jsxs)(U,{c:`dimmed`,size:`xs`,children:[V$(e.hourly),`/hr currently active`]})]},e.name))}):(0,R.jsx)(U,{c:`dimmed`,children:`No attributable resource spend.`})]})}function M3({report:e}){let t=v3(e.resources),n=t.reduce((e,t)=>e+(t.resource.cost.hourly_usd??0),0),r=y3(e.resources),i=t=>b3(e.resources,t);return(0,R.jsxs)(Dm,{gap:`xl`,children:[(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:1,children:`Cost & waste`}),(0,R.jsx)(U,{c:`dimmed`,children:`Resource-cost estimates and actionable utilization signals from the retained SkyPilot inventory`})]}),(0,R.jsx)(nd,{color:`blue`,icon:(0,R.jsx)(uh,{size:18}),children:`Waste flags are candidates for review, not proof of inactivity. Progress is inferred from W&B and training logs; spend below uses Sky catalog estimates rather than provider billing allocation.`}),(0,R.jsxs)(Cm,{cols:{base:1,sm:3},children:[(0,R.jsx)(q$,{label:`Waste candidates`,value:t.length.toLocaleString()}),(0,R.jsx)(q$,{label:`Candidate burn rate`,value:`${V$(n)}/hr`}),(0,R.jsx)(q$,{label:`Recoveries retained`,value:r.reduce((e,t)=>e+(t.retries.total_recoveries??0),0).toLocaleString()})]}),(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Idle, orphaned, and zombie candidates`}),(0,R.jsx)(Vf,{withBorder:!0,padding:0,children:(0,R.jsx)(W.ScrollContainer,{minWidth:900,children:(0,R.jsxs)(W,{striped:!0,highlightOnHover:!0,children:[(0,R.jsx)(W.Thead,{children:(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Th,{children:`Resource`}),(0,R.jsx)(W.Th,{children:`Signals`}),(0,R.jsx)(W.Th,{children:`Age`}),(0,R.jsx)(W.Th,{children:`Burn rate`}),(0,R.jsx)(W.Th,{children:`Cloud`}),(0,R.jsx)(W.Th,{children:`Links`})]})}),(0,R.jsxs)(W.Tbody,{children:[t.map(({resource:e,reasons:t})=>(0,R.jsxs)(W.Tr,{children:[(0,R.jsxs)(W.Td,{children:[(0,R.jsx)(E3,{resource:e}),(0,R.jsx)(U,{c:`dimmed`,size:`xs`,children:e.user??`Unknown user`})]}),(0,R.jsx)(W.Td,{children:(0,R.jsx)(nl,{gap:4,children:t.map(e=>(0,R.jsx)(Tf,{color:`yellow`,variant:`light`,children:e},e))})}),(0,R.jsx)(W.Td,{children:U$(e.timing.elapsed_seconds)}),(0,R.jsxs)(W.Td,{children:[V$(e.cost.hourly_usd),`/hr`]}),(0,R.jsx)(W.Td,{children:e.skypilot.cloud??`—`}),(0,R.jsx)(W.Td,{children:(0,R.jsx)(T3,{resource:e})})]},`${e.kind}-${e.skypilot.job_id??e.name}`)),!t.length&&(0,R.jsx)(W.Tr,{children:(0,R.jsx)(W.Td,{colSpan:6,children:(0,R.jsx)(U,{c:`dimmed`,children:`No candidates detected.`})})})]})]})})})]}),(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Spend by owner and infrastructure`}),(0,R.jsxs)(Cm,{cols:{base:1,lg:3},children:[(0,R.jsx)(j3,{title:`By user`,rows:i(e=>e.user??`Unknown user`)}),(0,R.jsx)(j3,{title:`By project`,rows:i(e=>e.project??`Unassigned`)}),(0,R.jsx)(j3,{title:`By cloud`,rows:i(e=>e.skypilot.cloud??`Unknown cloud`)})]})]}),(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Recovery and preemption history`}),(0,R.jsx)(Vf,{withBorder:!0,padding:0,children:(0,R.jsx)(W.ScrollContainer,{minWidth:800,children:(0,R.jsxs)(W,{striped:!0,highlightOnHover:!0,children:[(0,R.jsx)(W.Thead,{children:(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Th,{children:`Resource`}),(0,R.jsx)(W.Th,{children:`Started`}),(0,R.jsx)(W.Th,{children:`Total recoveries`}),(0,R.jsx)(W.Th,{children:`Preemption / infrastructure`}),(0,R.jsx)(W.Th,{children:`Application errors`}),(0,R.jsx)(W.Th,{children:`Links`})]})}),(0,R.jsxs)(W.Tbody,{children:[r.map(e=>(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Td,{children:(0,R.jsx)(E3,{resource:e})}),(0,R.jsx)(W.Td,{children:H$(e.timing.started_at)}),(0,R.jsx)(W.Td,{children:e.retries.total_recoveries??`—`}),(0,R.jsx)(W.Td,{children:e.retries.preemption_or_infrastructure??`—`}),(0,R.jsx)(W.Td,{children:e.retries.application_error??`—`}),(0,R.jsx)(W.Td,{children:(0,R.jsx)(T3,{resource:e})})]},`${e.kind}-${e.skypilot.job_id??e.name}`)),!r.length&&(0,R.jsx)(W.Tr,{children:(0,R.jsx)(W.Td,{colSpan:6,children:(0,R.jsx)(U,{c:`dimmed`,children:`No recoveries in the retained inventory.`})})})]})]})})})]})]})}function N3({opened:e,onClose:t,queryStatus:n}){let[r,i]=(0,w.useState)(null),a=async(e,t)=>{i({title:t,content:`Loading raw output…`});try{let n=await fetch(`/api/status/${e}/raw`,{cache:`no-store`}),r=await n.json();if(!n.ok)throw Error(`Raw query request failed (${n.status})`);i({title:t,content:JSON.stringify(r,null,2)})}catch(e){i({title:t,content:String(e)})}};return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Hp,{opened:e,onClose:t,title:`Overwatch query status`,size:`xl`,children:n?(0,R.jsxs)(Dm,{gap:`md`,children:[(0,R.jsxs)(nl,{gap:`lg`,children:[(0,R.jsxs)(U,{size:`sm`,children:[`Last attempt: `,H$(n.refresh.last_attempt_at)]}),(0,R.jsxs)(U,{size:`sm`,children:[`Last success: `,H$(n.refresh.last_success_at)]}),(0,R.jsxs)(U,{size:`sm`,children:[`Duration: `,n.refresh.last_duration_seconds==null?`—`:`${n.refresh.last_duration_seconds.toFixed(1)}s`]}),n.refresh.in_progress&&(0,R.jsx)(Tf,{color:`blue`,children:`Refreshing`})]}),n.refresh.last_error&&(0,R.jsx)(nd,{color:`red`,title:`Last refresh failed`,icon:(0,R.jsx)(uh,{size:18}),children:n.refresh.last_error}),(0,R.jsx)(W.ScrollContainer,{minWidth:700,children:(0,R.jsxs)(W,{striped:!0,highlightOnHover:!0,children:[(0,R.jsx)(W.Thead,{children:(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Th,{children:`Query`}),(0,R.jsx)(W.Th,{children:`Status`}),(0,R.jsx)(W.Th,{children:`Duration`}),(0,R.jsx)(W.Th,{children:`Summary`}),(0,R.jsx)(W.Th,{children:`Updated`}),(0,R.jsx)(W.Th,{children:`Output`})]})}),(0,R.jsx)(W.Tbody,{children:n.queries.map(e=>(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Td,{children:e.label}),(0,R.jsx)(W.Td,{children:(0,R.jsx)(Tf,{color:G$(e.status),children:e.status})}),(0,R.jsx)(W.Td,{children:e.duration_seconds==null?`—`:`${e.duration_seconds.toFixed(2)}s`}),(0,R.jsx)(W.Td,{children:e.error??e.summary}),(0,R.jsx)(W.Td,{children:H$(e.updated_at)}),(0,R.jsx)(W.Td,{children:(0,R.jsx)(ld,{component:`button`,type:`button`,onClick:()=>void a(e.key,e.label),children:(0,R.jsxs)(nl,{gap:4,wrap:`nowrap`,children:[(0,R.jsx)(gh,{size:15}),` Raw`]})})})]},e.key))})]})})]}):(0,R.jsx)(Wf,{h:160,children:(0,R.jsx)(Rc,{})})}),(0,R.jsx)(yp,{opened:r!=null,onClose:()=>i(null),title:`Raw query output · ${r?.title??``}`,position:`right`,size:`xl`,zIndex:300,children:(0,R.jsx)(Ps,{h:`calc(100vh - 100px)`,type:`auto`,children:(0,R.jsx)(qf,{block:!0,children:r?.content})})})]})}function P3(){let[e,t]=(0,w.useState)(null),[n,r]=(0,w.useState)(null),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!1),c=(0,w.useRef)(null),l=window.location.pathname.match(/^\/runs\/(\d+)\/?$/),u=l?Number(l[1]):null,d=window.location.pathname===`/billing`?`billing`:window.location.pathname===`/cost-waste`?`cost-waste`:u==null?`resources`:`run`;(0,w.useEffect)(()=>{let e=!1,n,i=async()=>{try{let a=await fetch(`/api/report`,{cache:`no-store`});if(a.status===202){let t=await a.json();e||(r(t.error),n=window.setTimeout(i,750));return}if(!a.ok)throw Error(`Report request failed (${a.status})`);let o=await a.json();e||(t(o),r(null))}catch(t){e||(r(String(t)),n=window.setTimeout(i,1e3))}};i(),(async()=>{try{let t=await fetch(`/api/status`,{cache:`no-store`});if(!t.ok)throw Error(`Status request failed (${t.status})`);let n=await t.json();e||a(n)}catch{}})();let o=window.setInterval(async()=>{try{let[t,n]=await Promise.all([fetch(`/api/health`,{cache:`no-store`}),fetch(`/api/status`,{cache:`no-store`})]),r=await t.json();n.ok&&!e&&a(await n.json());let o=c.current;c.current=r,o&&r.startup_id!==o.startup_id?window.location.reload():o&&r.report_version!==o.report_version&&await i()}catch{}},2e3);return()=>{e=!0,window.clearInterval(o),window.clearTimeout(n)}},[]);let f=async()=>{try{let e=await fetch(`/api/refresh`,{method:`POST`});if(!e.ok)throw Error(`Refresh request failed (${e.status})`);a(e=>e&&{...e,refresh:{...e.refresh,in_progress:!0}}),r(null)}catch(e){r(String(e))}},p=i?.queries.filter(e=>e.status===`error`)??[];return(0,R.jsxs)(Nd,{header:{height:60},padding:`lg`,children:[(0,R.jsx)(C3,{page:d,queryStatus:i,onOpenStatus:()=>s(!0),onRefresh:()=>void f()}),(0,R.jsxs)(Nd.Main,{className:`hud-main`,children:[n&&(0,R.jsx)(nd,{color:`red`,children:n}),(i?.refresh.last_error||p.length>0)&&(0,R.jsxs)(nd,{color:`red`,title:`Overwatch query failure`,icon:(0,R.jsx)(uh,{size:18}),mb:`md`,children:[i?.refresh.last_error??`${p.map(e=>e.label).join(`, `)} failed.`,` The last successful report remains visible; open Status for details and raw outputs.`]}),!e&&(0,R.jsx)(Wf,{h:300,children:(0,R.jsxs)(Dm,{align:`center`,gap:`sm`,children:[(0,R.jsx)(Rc,{}),(0,R.jsx)(U,{c:`dimmed`,children:`Loading cloud inventory…`})]})}),e&&d===`resources`&&(0,R.jsx)(k3,{report:e}),e&&d===`billing`&&(0,R.jsx)(J$,{report:e}),e&&d===`cost-waste`&&(0,R.jsx)(M3,{report:e}),e&&d===`run`&&u!=null&&(0,R.jsx)(A3,{report:e,jobId:u})]}),(0,R.jsx)(N3,{opened:o,onClose:()=>s(!1),queryStatus:i})]})}var F3=fn({colors:{overwatch:[`#fff4e6`,`#ffe8cc`,`#ffd09b`,`#ffb45c`,`#fa9c1e`,`#e9840b`,`#cc6d00`,`#a95800`,`#874600`,`#6d3700`]},primaryColor:`overwatch`,primaryShade:{light:5,dark:4},defaultRadius:`xs`,defaultGradient:{from:`overwatch.4`,to:`overwatch.6`,deg:110},fontFamily:`Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,headings:{fontFamily:`"Avenir Next Condensed", "Arial Narrow", Inter, sans-serif`,fontWeight:`800`}});(0,B$.createRoot)(document.getElementById(`root`)).render((0,R.jsx)(w.StrictMode,{children:(0,R.jsx)(dn,{defaultColorScheme:`auto`,theme:F3,children:(0,R.jsx)(P3,{})})})); \ No newline at end of file + ${b.x},${b.y}`,S=Fg(e.id)?Ag(`recharts-radial-line-`):e.id;return w.createElement(`text`,jW({},r,{dominantBaseline:`central`,className:L(`recharts-radial-bar-label`,o)}),w.createElement(`defs`,null,w.createElement(`path`,{id:S,d:x})),w.createElement(`textPath`,{xlinkHref:`#${S}`},n))},VW=(e,t,n)=>{var r=e.cx,i=e.cy,a=e.innerRadius,o=e.outerRadius,s=(e.startAngle+e.endAngle)/2;if(n===`outside`){var c=Ik(r,i,o+t,s),l=c.x;return{x:l,y:c.y,textAnchor:l>=r?`start`:`end`,verticalAnchor:`middle`}}if(n===`center`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`middle`};if(n===`centerTop`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`start`};if(n===`centerBottom`)return{x:r,y:i,textAnchor:`middle`,verticalAnchor:`end`};var u=Ik(r,i,(a+o)/2,s);return{x:u.x,y:u.y,textAnchor:`middle`,verticalAnchor:`middle`}},HW=e=>e!=null&&`cx`in e&&G(e.cx),UW={angle:0,offset:5,zIndex:ZA.label,position:`middle`,textBreakAll:!1};function WW(e){if(!HW(e))return e;var t=e.cx,n=e.cy,r=e.outerRadius,i=r*2;return{x:t-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function GW(e){var t=Uv(e,UW),n=t.viewBox,r=t.parentViewBox,i=t.position,a=t.value,o=t.children,s=t.content,c=t.className,l=c===void 0?``:c,u=t.textBreakAll,d=t.labelRef,f=IW(),p=PW(),m=n==null?i===`center`?p:f??p:HW(n)?n:zg(n),h,g,_=WW(m);if(!m||Fg(a)&&Fg(o)&&!(0,w.isValidElement)(s)&&typeof s!=`function`)return null;var v=HW(m)&&(i===`insideStart`||i===`insideEnd`||i===`end`);if(HW(m))v||(g=VW(m,t.offset,t.position));else if(_){var y=Gg({viewBox:_,position:i,offset:t.offset,parentViewBox:HW(r)?void 0:r,clamp:!0});g=DW(DW({x:y.x,y:y.y,textAnchor:y.horizontalAnchor,verticalAnchor:y.verticalAnchor},y.width===void 0?{}:{width:y.width}),y.height===void 0?{}:{height:y.height})}var b=DW(DW(DW(DW({},g?.x===void 0?{}:{x:g.x}),g?.y===void 0?{}:{y:g.y}),t),{},{viewBox:m});if((0,w.isValidElement)(s)){b.labelRef;var x=wW(b,SW);return(0,w.cloneElement)(s,x)}if(typeof s==`function`){b.content;var S=wW(b,CW);if(h=(0,w.createElement)(s,S),(0,w.isValidElement)(h))return h}else h=LW(t);var C=tg(t);return v&&HW(m)?BW(t,i,h,C,m):g==null?null:w.createElement(sH,{zIndex:t.zIndex},w.createElement(xW,jW({ref:d,className:L(`recharts-label`,l)},C,g,{textAnchor:uW(C.textAnchor)?C.textAnchor:g.textAnchor,breakAll:u}),h))}GW.displayName=`Label`;var KW=(e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return e===!0?w.createElement(GW,jW({key:`label-implicit`},r)):Og(e)?w.createElement(GW,jW({key:`label-implicit`,value:e},r)):(0,w.isValidElement)(e)?e.type===GW?(0,w.cloneElement)(e,DW({key:`label-implicit`},r)):w.createElement(GW,jW({key:`label-implicit`,content:e},r)):RW(e)?w.createElement(GW,jW({key:`label-implicit`,content:e},r)):e&&typeof e==`object`?w.createElement(GW,jW({},e,{key:`label-implicit`},r)):null};function qW(e){var t=e.label,n=e.labelRef;return KW(t,PW(),n)||null}var JW=[`valueAccessor`],YW=[`dataKey`,`clockWise`,`id`,`textBreakAll`,`zIndex`];function XW(){return XW=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(dW(t))return t},eG=(0,w.createContext)(void 0),tG=eG.Provider,nG=(0,w.createContext)(void 0);nG.Provider;function rG(){return(0,w.useContext)(eG)}function iG(){return(0,w.useContext)(nG)}function aG(e){var t=e.valueAccessor,n=t===void 0?$W:t,r=ZW(e,JW),i=r.dataKey;r.clockWise;var a=r.id,o=r.textBreakAll,s=r.zIndex,c=ZW(r,YW),l=rG(),u=iG(),d=l||u;return!d||!d.length?null:w.createElement(sH,{zIndex:s??ZA.label},w.createElement(dg,{className:`recharts-label-list`},d.map((e,t)=>{var s=Fg(i)?n(e,t):mw(e.payload,i),l=Fg(a)?{}:{id:`${a}-${t}`};return w.createElement(GW,XW({key:`label-${t}`},tg(e),c,l,{fill:r.fill??e.fill,parentViewBox:e.parentViewBox,value:s,textBreakAll:o,viewBox:e.viewBox,index:t,zIndex:0}))})))}aG.displayName=`LabelList`;function oG(e){var t=e.label;return t?t===!0?w.createElement(aG,{key:`labelList-implicit`}):w.isValidElement(t)||RW(t)?w.createElement(aG,{key:`labelList-implicit`,content:t}):typeof t==`object`?w.createElement(aG,XW({key:`labelList-implicit`},t,{type:String(t.type)})):null:null}var sG=dC({name:`polarAxis`,initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=RS(t.payload)},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=RS(t.payload)},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),cG=sG.actions;cG.addRadiusAxis,cG.removeRadiusAxis,cG.addAngleAxis,cG.removeAngleAxis;var lG=sG.reducer;function uG(e){return e&&typeof e==`object`&&`className`in e&&typeof e.className==`string`?e.className:``}var dG=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.suspense_list`),d=Symbol.for(`react.memo`),f=Symbol.for(`react.lazy`),p=Symbol.for(`react.view_transition`);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 l:case u:case p:return e;default:switch(e&&=e.$$typeof,e){case s:case c:case f:case d:return e;case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),fG=o(((e,t)=>{t.exports=dG()}))(),pG=e=>typeof e==`string`?e:e?e.displayName||e.name||`Component`:``,mG=null,hG=null,gG=e=>{if(e===mG&&Array.isArray(hG))return hG;var t=[];return w.Children.forEach(e,e=>{Fg(e)||((0,fG.isFragment)(e)?t=t.concat(gG(e.props.children)):t.push(e))}),hG=t,mG=e,t};function _G(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(e=>pG(e)):[pG(t)],gG(e).forEach(e=>{var t=bg(e,`type.displayName`)||bg(e,`type.name`);t&&r.indexOf(t)!==-1&&n.push(e)}),n}function vG(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 yG(e){for(var t=1;t{var r=yb();return(i,a)=>o=>{e?.(i,a,o),r(Zz({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},AG=e=>{var t=yb();return(n,r)=>i=>{e?.(n,r,i),t(Qz())}},jG=(e,t,n)=>{var r=yb();return(i,a)=>o=>{e?.(i,a,o),r(eB({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}};function MG(e){var t=e.tooltipEntrySettings,n=yb(),r=nT(),i=(0,w.useRef)(null);return(0,w.useLayoutEffect)(()=>{r||(i.current===null?n(qz(t)):i.current!==t&&n(Jz({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,w.useLayoutEffect)(()=>()=>{i.current&&=(n(Yz(i.current)),null)},[n]),null}function NG(e){var t=e.legendPayload,n=yb(),r=nT(),i=(0,w.useRef)(null);return(0,w.useLayoutEffect)(()=>{r||(i.current===null?n(tE(t)):i.current!==t&&n(nE({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,w.useLayoutEffect)(()=>()=>{i.current&&=(n(rE(i.current)),null)},[n]),null}function PG(e,t){return zG(e)||RG(e,t)||IG(e,t)||FG()}function FG(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IG(e,t){if(e){if(typeof e==`string`)return LG(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?LG(e,t):void 0}}function LG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n2&&arguments[2]!==void 0?arguments[2]:[],r=[];for(var i of n)r.push({status:`removed`,prev:i});for(var a=0;ae[Math.floor(r*n)]),t)}function WG(e,t){return HG(t.map((t,n)=>e[n]),t)}function GG(e,t){for(var n=new Map,r=0;r{var a=n(e,t);if(a!=null){var o=r.get(a);if(o!==void 0)return i.add(a),o}}),o=[];for(var s of r){var c=PG(s,2),l=c[0],u=c[1];i.has(l)||o.push(u)}return HG(a,t,o)}function qG(e,t,n){return t==null?null:e==null?t.map(e=>({status:`added`,next:e})):n===`index`?UG(e,t):n===`append`?WG(e,t):KG(e,t,n)}function JG(e,t){var n=(0,w.useRef)(e),r=(0,w.useRef)(t.current),i=(0,w.useRef)(!0);n.current!==e&&(n.current=e,r.current=t.current,i.current=!1);var a=(0,w.useCallback)(function(e,n){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(n===0){i.current=!0;return}n===1&&(r.current=e),n>0&&i.current&&a&&(t.current=e)},[t]);return{startValue:r.current,syncStepValue:a}}function YG(e,t){return eK(e)||$G(e,t)||ZG(e,t)||XG()}function XG(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZG(e,t){if(e){if(typeof e==`string`)return QG(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?QG(e,t):void 0}}function QG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{typeof e==`function`&&e(),i(!0)},[e]),handleAnimationEnd:(0,w.useCallback)(()=>{typeof t==`function`&&t(),i(!1)},[t])}}function nK(e){var t=e.animationInput,n=e.animationIdPrefix,r=e.items,i=e.previousItemsRef,a=e.isAnimationActive,o=e.animationBegin,s=e.animationDuration,c=e.animationEasing,l=e.onAnimationStart,u=e.onAnimationEnd,d=e.animationInterpolateFn,f=e.animationMatchBy,p=e.shouldUpdatePreviousRef,m=e.children,h=e.layout,g=XO(t,n),_=JG(g,i),v=_.startValue??null,y=qG(v,r,f??BG);return w.createElement(YO,{animationId:g,begin:o,duration:s,isActive:a,easing:c,onAnimationEnd:u,onAnimationStart:l,key:g},e=>{var t=v==null,n=r==null?r:d(y,e,h),i=p?p(e):e>0;return _.syncStepValue(n,e,i),n==null?null:m(n,e,t)})}function rK(e,t){return cK(e)||sK(e,t)||aK(e,t)||iK()}function iK(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aK(e,t){if(e){if(typeof e==`string`)return oK(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oK(e,t):void 0}}function oK(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nrK(w.useState(()=>Ag(`uid-`)),1)[0]);function uK(e,t){var n=lK();return t||(e?`${e}-${n}`:n)}var dK=(0,w.createContext)(void 0),fK=e=>{var t=e.id,n=e.type,r=e.children,i=uK(`recharts-${n}`,t);return w.createElement(dK.Provider,{value:i},r(i))},pK=dC({name:`graphicalItems`,initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(RS(t.payload))},prepare:XS()},replaceCartesianGraphicalItem:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=FS(e).cartesianItems.indexOf(RS(r));a>-1&&(e.cartesianItems[a]=RS(i))},prepare:XS()},removeCartesianGraphicalItem:{reducer(e,t){var n=FS(e).cartesianItems.indexOf(RS(t.payload));n>-1&&e.cartesianItems.splice(n,1)},prepare:XS()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(RS(t.payload))},prepare:XS()},removePolarGraphicalItem:{reducer(e,t){var n=FS(e).polarItems.indexOf(RS(t.payload));n>-1&&e.polarItems.splice(n,1)},prepare:XS()},replacePolarGraphicalItem:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next,a=FS(e).polarItems.indexOf(RS(r));a>-1&&(e.polarItems[a]=RS(i))},prepare:XS()}}}),mK=pK.actions,hK=mK.addCartesianGraphicalItem,gK=mK.replaceCartesianGraphicalItem,_K=mK.removeCartesianGraphicalItem;mK.addPolarGraphicalItem,mK.removePolarGraphicalItem,mK.replacePolarGraphicalItem;var vK=pK.reducer,yK=(0,w.memo)(e=>{var t=yb(),n=(0,w.useRef)(null);return(0,w.useLayoutEffect)(()=>{n.current===null?t(hK(e)):n.current!==e&&t(gK({prev:n.current,next:e})),n.current=e},[t,e]),(0,w.useLayoutEffect)(()=>()=>{n.current&&=(t(_K(n.current)),null)},[t]),null});function bK(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 xK(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),Fw,Iw],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),LK=()=>K(IK);function RK(e,t){return UK(e)||HK(e,t)||BK(e,t)||zK()}function zK(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BK(e,t){if(e){if(typeof e==`string`)return VK(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?VK(e,t):void 0}}function VK(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var r=n??e;if(!Fg(r))return jg(r,t,0)},GK=(e,t,n)=>{var r={},i=e.filter(Sj),a=e.filter(e=>e.stackId==null),o=i.reduce((e,t)=>{var n=e[t.stackId];return n??=[],n.push(t),e[t.stackId]=n,e},r),s=Object.entries(o).map(e=>{var r=RK(e,2),i=r[0],a=r[1];return{stackId:i,dataKeys:a.map(e=>e.dataKey),barSize:WK(t,n,a[0]?.barSize)}}),c=a.map(e=>({stackId:void 0,dataKeys:[e.dataKey].filter(e=>e!=null),barSize:WK(t,n,e.barSize)}));return[...s,...c]};function KK(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 qK(e){for(var t=1;te+(t.barSize||0),0);d+=(a-1)*o,d>=n&&(d-=(a-1)*o,o=0),d>=n&&u>0&&(l=!0,u*=.9,d=a*u);var f={offset:Math.round((n-d)/2)-o,size:0};s=r.reduce((e,t)=>{var n={stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:f.offset+f.size+o,size:l?u:t.barSize??0}},r=[...e,n];return f=n.position,r},c)}else{var p=jg(t,n,0,!0);n-2*p-(a-1)*o<=0&&(o=0);var m=(n-2*p-(a-1)*o)/a;m>1&&(m=Math.round(m));var h=sw(i)?Math.min(m,i):m;s=r.reduce((e,t,n)=>[...e,{stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:p+a*(m-h)/2+(h+o)*n,size:h}}],c)}return s}}var QK=(e,t,n,r,i,a,o)=>{var s=Fg(o)?t:o,c=ZK(n,r,i===a?a:i,e,s);return i!==a&&c!=null&&(c=c.map(e=>qK(qK({},e),{},{position:qK(qK({},e.position),{},{offset:e.position.offset-i/2})}))),c},$K=(e,t)=>{var n=bj(t);if(!(!e||n==null||t==null)){var r=t.stackId;if(r!=null){var i=e[r];if(i){var a=i.stackedData;if(a)return a.find(e=>e.key===n)}}}},eq=(e,t)=>{if(e!=null&&t!=null){var n=e.find(e=>e.stackId===t.stackId&&t.dataKey!=null&&e.dataKeys.includes(t.dataKey));if(n!=null)return n.position}};function tq(e,t){return e&&typeof e==`object`&&`zIndex`in e&&typeof e.zIndex==`number`&&sw(e.zIndex)?e.zIndex:t}function nq(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 rq(e){for(var t=1;t{if(e){var n=e.replace(/(\w)/,e=>e.toUpperCase()),r=sq.reduce((e,r)=>rq(rq({},e),{},{[r+n]:t}),{});return r[e]=t,r}},lq=e=>{var t=e.chartData,n=yb(),r=nT();return(0,w.useEffect)(()=>r?()=>{}:(n(AH(t)),()=>{n(AH(void 0))}),[t,n,r]),null},uq=e=>e.chartData.chartData,dq=()=>K(uq),fq=e=>{var t=e.chartData;return{startIndex:t.dataStartIndex,endIndex:t.dataEndIndex}},pq=()=>K(fq),mq=(0,w.createContext)(()=>{}),hq={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},gq=dC({name:`brush`,initialState:hq,reducers:{setBrushSettings(e,t){return t.payload==null?hq:t.payload}}}),_q=gq.actions.setBrushSettings,vq=gq.reducer;function yq(){return yq=Object.assign?Object.assign.bind():function(e){for(var t=1;t{[`ArrowLeft`,`ArrowRight`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),c(e.key===`ArrowRight`?1:-1,r))},onFocus:l,onBlur:u,style:{cursor:`col-resize`}},w.createElement(Eq,{travellerType:h,travellerProps:x}))}function Aq(e){var t=e.index,n=e.data,r=e.tickFormatter,i=e.dataKey,a=mw(n[t],i,t);return typeof r==`function`?r(a,t):a}function jq(e,t){for(var n=e.length,r=0,i=n-1;i-r>1;){var a=Math.floor((r+i)/2),o=e[a];o!=null&&o>t?i=a:r=a}var s=e[i];return s!=null&&t>=s?i:r}function Mq(e){var t=e.startX,n=e.endX,r=e.scaleValues,i=e.gap,a=e.data.length-1,o=Math.min(t,n),s=Math.max(t,n),c=jq(r,o),l=jq(r,s);return{startIndex:c-c%i,endIndex:l===a?a:l-l%i}}function Nq(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.fill,o=e.stroke;return w.createElement(`rect`,{stroke:o,fill:a,x:t,y:n,width:r,height:i})}function Pq(e){var t=e.startIndex,n=e.endIndex,r=e.y,i=e.height,a=e.travellerWidth,o=e.stroke,s=e.tickFormatter,c=e.dataKey,l=e.data,u=e.startX,d=e.endX,f=5,p={pointerEvents:`none`,fill:o};return w.createElement(dg,{className:`recharts-brush-texts`},w.createElement(xW,yq({textAnchor:`end`,verticalAnchor:`middle`,x:Math.min(u,d)-f,y:r+i/2},p),Aq({index:t,tickFormatter:s,dataKey:c,data:l})),w.createElement(xW,yq({textAnchor:`start`,verticalAnchor:`middle`,x:Math.max(u,d)+a+f,y:r+i/2},p),Aq({index:n,tickFormatter:s,dataKey:c,data:l})))}function Fq(e){var t=e.y,n=e.height,r=e.stroke,i=e.travellerWidth,a=e.startX,o=e.endX,s=e.onMouseEnter,c=e.onMouseLeave,l=e.onMouseDown,u=e.onTouchStart,d=Math.min(a,o)+i,f=Math.max(Math.abs(o-a)-i,0);return w.createElement(`rect`,{className:`recharts-brush-slide`,onMouseEnter:s,onMouseLeave:c,onMouseDown:l,onTouchStart:u,style:{cursor:`move`},stroke:`none`,fill:r,fillOpacity:.2,x:d,y:t,width:f,height:n})}function Iq(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.data,o=e.children,s=e.padding;if(w.Children.count(o)!==1)return null;var c=w.Children.only(o);return c?w.cloneElement(c,{x:t,y:n,width:r,height:i,margin:s,compact:!0,data:a}):null}var Lq=e=>{var t=e.data,n=e.startIndex,r=e.endIndex,i=e.x,a=e.width,o=e.travellerWidth;if(!t||!t.length)return{};var s=t.length,c=dM().domain(cA(0,s)).range([i,i+a-o]),l=c.domain().map(e=>c(e)).filter(Lg);return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:c(n),endX:c(r),scale:c,scaleValues:l}},Rq=e=>e.changedTouches&&!!e.changedTouches.length,zq=class extends w.PureComponent{constructor(e){super(e),Sq(this,`handleDrag`,e=>{this.leaveTimer&&=(clearTimeout(this.leaveTimer),null),this.state.isTravellerMoving?this.handleTravellerMove(e):this.state.isSlideMoving&&this.handleSlideDrag(e)}),Sq(this,`handleTouchMove`,e=>{var t=e.changedTouches?.[0];t!=null&&this.handleDrag(t)}),Sq(this,`handleDragEnd`,()=>{this.setState({isTravellerMoving:!1,isSlideMoving:!1},()=>{var e=this.props,t=e.endIndex,n=e.onDragEnd,r=e.startIndex;n?.({endIndex:t,startIndex:r})}),this.detachDragEndListener()}),Sq(this,`handleLeaveWrapper`,()=>{(this.state.isTravellerMoving||this.state.isSlideMoving)&&(this.leaveTimer=window.setTimeout(this.handleDragEnd,this.props.leaveTimeOut))}),Sq(this,`handleEnterSlideOrTraveller`,()=>{this.setState({isTextActive:!0})}),Sq(this,`handleLeaveSlideOrTraveller`,()=>{this.setState({isTextActive:!1})}),Sq(this,`handleSlideDragStart`,e=>{var t=Rq(e)?e.changedTouches[0]:e;t!=null&&(this.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:t.pageX}),this.attachDragEndListener())}),Sq(this,`handleTravellerMoveKeyboard`,(e,t)=>{var n=this.props,r=n.data,i=n.gap,a=n.startIndex,o=n.endIndex,s=this.state,c=s.scaleValues,l=s.startX,u=s.endX;if(c!=null){var d=-1;if(t===`startX`?d=a:t===`endX`&&(d=o),!(d<0||d>=r.length)){var f=d+e;if(!(f===-1||f>=c.length)){var p=c[f];p!=null&&(t===`startX`&&p>=u||t===`endX`&&p<=l||this.setState({[t]:p},()=>{this.props.onChange(Mq({startX:this.state.startX,endX:this.state.endX,data:r,gap:i,scaleValues:c}))}))}}}}),this.travellerDragStartHandlers={startX:this.handleTravellerDragStart.bind(this,`startX`),endX:this.handleTravellerDragStart.bind(this,`endX`)},this.state={brushMoveStartX:0,movingTravellerId:void 0,endX:0,startX:0,slideMoveStartX:0}}static getDerivedStateFromProps(e,t){var n=e.data,r=e.width,i=e.x,a=e.travellerWidth,o=e.startIndex,s=e.endIndex,c=e.startIndexControlledFromProps,l=e.endIndexControlledFromProps;if(n!==t.prevData)return xq({prevData:n,prevTravellerWidth:a,prevX:i,prevWidth:r,prevStartIndexControlledFromProps:c,prevEndIndexControlledFromProps:l},n&&n.length?Lq({data:n,width:r,x:i,travellerWidth:a,startIndex:o,endIndex:s}):{scale:void 0,scaleValues:void 0});var u=t.scale;if(u&&(r!==t.prevWidth||i!==t.prevX||a!==t.prevTravellerWidth)){u.range([i,i+r-a]);var d=u.domain().map(e=>u(e)).filter(e=>e!=null);return{prevData:n,prevTravellerWidth:a,prevX:i,prevWidth:r,startX:u(e.startIndex),endX:u(e.endIndex),scaleValues:d}}if(t.scale&&!t.isSlideMoving&&!t.isTravellerMoving&&!t.isTravellerFocused&&!t.isTextActive){if(c!=null&&t.prevStartIndexControlledFromProps!==c)return{startX:t.scale(c),prevStartIndexControlledFromProps:c};if(l!=null&&t.prevEndIndexControlledFromProps!==l)return{endX:t.scale(l),prevEndIndexControlledFromProps:l}}return null}componentWillUnmount(){this.leaveTimer&&=(clearTimeout(this.leaveTimer),null),this.detachDragEndListener()}attachDragEndListener(){window.addEventListener(`mouseup`,this.handleDragEnd,!0),window.addEventListener(`touchend`,this.handleDragEnd,!0),window.addEventListener(`mousemove`,this.handleDrag,!0)}detachDragEndListener(){window.removeEventListener(`mouseup`,this.handleDragEnd,!0),window.removeEventListener(`touchend`,this.handleDragEnd,!0),window.removeEventListener(`mousemove`,this.handleDrag,!0)}handleSlideDrag(e){var t=this.state,n=t.slideMoveStartX,r=t.startX,i=t.endX,a=t.scaleValues;if(a!=null){var o=this.props,s=o.x,c=o.width,l=o.travellerWidth,u=o.startIndex,d=o.endIndex,f=o.onChange,p=o.data,m=o.gap,h=e.pageX-n;h>0?h=Math.min(h,s+c-l-i,s+c-l-r):h<0&&(h=Math.max(h,s-r,s-i));var g=Mq({startX:r+h,endX:i+h,data:p,gap:m,scaleValues:a});(g.startIndex!==u||g.endIndex!==d)&&f&&f(g),this.setState({startX:r+h,endX:i+h,slideMoveStartX:e.pageX})}}handleTravellerDragStart(e,t){var n=Rq(t)?t.changedTouches[0]:t;n!=null&&(this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:e,brushMoveStartX:n.pageX}),this.attachDragEndListener())}handleTravellerMove(e){var t=this.state,n=t.brushMoveStartX,r=t.movingTravellerId,i=t.endX,a=t.startX,o=t.scaleValues;if(r!=null&&o!=null){var s=this.state[r],c=this.props,l=c.x,u=c.width,d=c.travellerWidth,f=c.onChange,p=c.gap,m=c.data,h={startX:this.state.startX,endX:this.state.endX,data:m,gap:p,scaleValues:o},g=e.pageX-n;g>0?g=Math.min(g,l+u-d-s):g<0&&(g=Math.max(g,l-s)),h[r]=s+g;var _=Mq(h),v=_.startIndex,y=_.endIndex,b=()=>{var e=m.length-1;return r===`startX`&&(i>a?v%p===0:y%p===0)||ia?y%p===0:v%p===0)||i>a&&y===e};this.setState({[r]:s+g,brushMoveStartX:e.pageX},()=>{f&&b()&&f(_)})}}render(){var e=this.props,t=e.data,n=e.className,r=e.children,i=e.x,a=e.y,o=e.dy,s=e.width,c=e.height,l=e.alwaysShowText,u=e.fill,d=e.stroke,f=e.startIndex,p=e.endIndex,m=e.travellerWidth,h=e.tickFormatter,g=e.dataKey,_=e.padding,v=this.state,y=v.startX,b=v.endX,x=v.isTextActive,S=v.isSlideMoving,C=v.isTravellerMoving,T=v.isTravellerFocused;if(!t||!t.length||!G(i)||!G(a)||!G(s)||!G(c)||s<=0||c<=0)return null;var E=L(`recharts-brush`,n),D=cq(`userSelect`,`none`),O=a+(o??0);return w.createElement(dg,{className:E,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:D},w.createElement(Nq,{x:i,y:O,width:s,height:c,fill:u,stroke:d}),w.createElement(rT,null,w.createElement(Iq,{x:i,y:O,width:s,height:c,data:t,padding:_},r)),w.createElement(Fq,{y:O,height:c,stroke:d,travellerWidth:m,startX:y,endX:b,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart}),w.createElement(kq,{travellerX:y,id:`startX`,otherProps:xq(xq({},this.props),{},{y:O}),onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers.startX,onTouchStart:this.travellerDragStartHandlers.startX,onTravellerMoveKeyboard:this.handleTravellerMoveKeyboard,onFocus:()=>{this.setState({isTravellerFocused:!0})},onBlur:()=>{this.setState({isTravellerFocused:!1})}}),w.createElement(kq,{travellerX:b,id:`endX`,otherProps:xq(xq({},this.props),{},{y:O}),onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers.endX,onTouchStart:this.travellerDragStartHandlers.endX,onTravellerMoveKeyboard:this.handleTravellerMoveKeyboard,onFocus:()=>{this.setState({isTravellerFocused:!0})},onBlur:()=>{this.setState({isTravellerFocused:!1})}}),(x||S||C||T||l)&&w.createElement(Pq,{startIndex:f,endIndex:p,y:O,height:c,travellerWidth:m,stroke:d,tickFormatter:h,dataKey:g,data:t,startX:y,endX:b}))}};function Bq(e){var t=yb(),n=dq(),r=pq(),i=(0,w.useContext)(mq),a=e.onChange,o=e.startIndex,s=e.endIndex;(0,w.useEffect)(()=>{t(jH({startIndex:o,endIndex:s}))},[t,s,o,n]),GH();var c=(0,w.useCallback)(e=>{if(r!=null){var n=r.startIndex,o=r.endIndex;(e.startIndex!==n||e.endIndex!==o)&&(i?.(e),a?.(e),t(jH(e)))}},[a,i,t,r]),l=K(aT);if(l==null||r==null||n==null||!n.length)return null;var u=r.startIndex,d=r.endIndex,f={data:n,x:l.x,y:l.y,width:l.width,startIndex:u,endIndex:d,onChange:c};return w.createElement(zq,yq({},e,f,{startIndexControlledFromProps:o??void 0,endIndexControlledFromProps:s??void 0}))}function Vq(e){var t=yb();return(0,w.useEffect)(()=>(t(_q(e)),()=>{t(_q(null))}),[t,e]),null}var Hq={height:40,travellerWidth:5,gap:1,fill:`#fff`,stroke:`#666`,padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1};function Uq(e){var t=Uv(e,Hq);return w.createElement(w.Fragment,null,w.createElement(Vq,{height:t.height,x:t.x,y:t.y,width:t.width,padding:t.padding}),w.createElement(Bq,t))}Uq.displayName=`Brush`;var Wq=(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)}},Gq=e=>{var t=e.x1,n=e.y1,r=e.x2,i=e.y2;return Wq({x:t,y:n},{x:r,y:i})};function Kq(e){return(e%180+180)%180}var qq=function(e){var t=e.width,n=e.height,r=Kq(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=FS(e).dots.findIndex(e=>e===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=FS(e).areas.findIndex(e=>e===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(RS(t.payload))},removeLine:(e,t)=>{var n=FS(e).lines.findIndex(e=>e===t.payload);n!==-1&&e.lines.splice(n,1)}}}),Yq=Jq.actions;Yq.addDot,Yq.removeDot,Yq.addArea,Yq.removeArea;var Xq=Yq.addLine,Zq=Yq.removeLine,Qq=Jq.reducer;function $q(e,t){return iJ(e)||rJ(e,t)||tJ(e,t)||eJ()}function eJ(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tJ(e,t){if(e){if(typeof e==`string`)return nJ(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nJ(e,t):void 0}}function nJ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.children,n=$q((0,w.useState)(`${Ag(`recharts`)}-clip`),1)[0],r=LK();if(r==null)return null;var i=r.x,a=r.y,o=r.width,s=r.height;return w.createElement(aJ.Provider,{value:n},w.createElement(`defs`,null,w.createElement(`clipPath`,{id:n},w.createElement(`rect`,{x:i,y:a,height:s,width:o}))),t)},sJ=()=>(0,w.useContext)(aJ),cJ=class{constructor(e){var t=e.x,n=e.y;this.xAxisScale=t,this.yAxisScale=n}map(e,t){var n=t.position;return{x:this.xAxisScale.map(e.x,{position:n})??0,y:this.yAxisScale.map(e.y,{position:n})??0}}mapWithFallback(e,t){var n=t.position,r=t.fallback,i=r===`rangeMin`?this.yAxisScale.rangeMin():r===`rangeMax`?this.yAxisScale.rangeMax():0,a=r===`rangeMin`?this.xAxisScale.rangeMin():r===`rangeMax`?this.xAxisScale.rangeMax():0;return{x:this.xAxisScale.map(e.x,{position:n})??a,y:this.yAxisScale.map(e.y,{position:n})??i}}isInRange(e){var t=e.x,n=e.y,r=t==null||this.xAxisScale.isInRange(t),i=n==null||this.yAxisScale.isInRange(n);return r&&i}};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 uJ(e){for(var t=1;t{var n;if(w.isValidElement(e))n=w.cloneElement(e,t);else if(typeof e==`function`)n=e(t);else{if(!sw(t.x1)||!sw(t.y1)||!sw(t.x2)||!sw(t.y2))return null;n=w.createElement(`line`,mJ({},t,{className:`recharts-reference-line-line`}))}return n},gJ=(e,t,n,r,i,a)=>{var o=a.x,s=a.width,c=i.map(e,{position:n});if(!sw(c)||t===`discard`&&!i.isInRange(c))return null;var l=[{x:o+s,y:c},{x:o,y:c}];return r===`left`?l.reverse():l},_J=(e,t,n,r,i,a)=>{var o=a.y,s=a.height,c=i.map(e,{position:n});if(!sw(c)||t===`discard`&&!i.isInRange(c))return null;var l=[{x:c,y:o+s},{x:c,y:o}];return r===`top`?l.reverse():l},vJ=(e,t,n,r)=>{var i=[r.mapWithFallback(e[0],{position:n,fallback:`rangeMin`}),r.mapWithFallback(e[1],{position:n,fallback:`rangeMax`})];return t===`discard`&&i.some(e=>!r.isInRange(e))?null:i},yJ=(e,t,n,r,i,a,o)=>{var s=o.x,c=o.y,l=o.segment,u=o.ifOverflow,d=Og(s);return Og(c)?gJ(c,u,r,a,t,n):d?_J(s,u,r,i,e,n):l!=null&&l.length===2?vJ(l,u,r,new cJ({x:e,y:t})):null};function bJ(e){var t=yb();return(0,w.useEffect)(()=>(t(Xq(e)),()=>{t(Zq(e))})),null}function xJ(e){var t=e.xAxisId,n=e.yAxisId,r=e.shape,i=e.className,a=e.ifOverflow,o=nT(),s=sJ(),c=K(e=>NL(e,t)),l=K(e=>IL(e,n)),u=K(e=>pz(e,`xAxis`,t,o)),d=K(e=>pz(e,`yAxis`,n,o)),f=zT();if(!s||!f||c==null||l==null||u==null||d==null)return null;var p=yJ(u,d,f,e.position,c.orientation,l.orientation,e);if(!p)return null;var m=p[0],h=p[1];if(m==null||h==null)return null;var g=m.x,_=m.y,v=h.x,y=h.y,b=uJ(uJ({clipPath:a===`hidden`?`url(#${s})`:void 0},tg(e)),{},{x1:g,y1:_,x2:v,y2:y}),x=Gq({x1:g,y1:_,x2:v,y2:y});return w.createElement(sH,{zIndex:e.zIndex},w.createElement(dg,{className:L(`recharts-reference-line`,i)},hJ(r,b),w.createElement(NW,mJ({},x,{lowerWidth:x.width,upperWidth:x.width}),w.createElement(qW,{label:e.label}),e.children)))}var SJ={ifOverflow:`discard`,xAxisId:0,yAxisId:0,fill:`none`,label:!1,stroke:`#ccc`,fillOpacity:1,strokeWidth:1,position:`middle`,zIndex:ZA.line};function CJ(e){var t=Uv(e,SJ);return w.createElement(w.Fragment,null,w.createElement(bJ,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x:t.x,y:t.y,segment:t.segment}),w.createElement(xJ,t))}CJ.displayName=`ReferenceLine`;function wJ(){}function TJ(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:Object.prototype.toString.call(e)===`[object Object]`}function EJ(e,t,n){return DJ(e,t,void 0,void 0,void 0,void 0,n)}function DJ(e,t,n,r,i,a,o){let s=o(e,t,n,r,i,a);if(s!==void 0)return s;if(typeof e==typeof t)switch(typeof e){case`bigint`:case`string`:case`boolean`:case`symbol`:case`undefined`:return e===t;case`number`:return e===t||Object.is(e,t);case`function`:return e===t;case`object`:return OJ(e,t,a,o)}return OJ(e,t,a,o)}function OJ(e,t,n,r){if(Object.is(e,t))return!0;let i=dy(e),a=dy(t);if(i===`[object Arguments]`&&(i=wy),a===`[object Arguments]`&&(a=wy),i!==a)return!1;switch(i){case py:return e.toString()===t.toString();case my:return Gy(e.valueOf(),t.valueOf());case hy:case vy:case _y:return Object.is(e.valueOf(),t.valueOf());case fy:return e.source===t.source&&e.flags===t.flags;case Sy:return e===t}n??=new Map;let o=n.get(e),s=n.get(t);if(o!=null&&s!=null)return o===t;n.set(e,t),n.set(t,e);try{switch(i){case yy:if(e.size!==t.size)return!1;for(let[i,a]of e.entries())if(!t.has(i)||!DJ(a,t.get(i),i,e,t,n,r))return!1;return!0;case by:{if(e.size!==t.size)return!1;let i=Array.from(e.values()),a=Array.from(t.values());for(let o=0;oDJ(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case xy:case Dy:case Oy:case ky:case Ay:case jy:case My:case Ny:case Py:case Fy:case Iy:case Ly:if(zy(e)!==zy(t)||e.length!==t.length)return!1;for(let i=0;ie*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=()=>(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,t,n,r,i){var a=(r||[]).slice().length;if(a===0)return[];for(var o=t.start,s=t.end,c=1;c<=a;c++){for(var l=(a-1)%c,u=o,d=!0,f=function(){var t=r[m];if(t==null)return 0;var a=m,o,c=()=>(o===void 0&&(o=n(t,a)),o),f=t.coordinate,p=m===l||NJ(e,f,c,u,s);if(!p)return d=!1,1;p&&(u=f+e*(c()/2+i))},p,m=l;m(u===void 0&&(u=n(r,t)),u);if(t===o-1){var f=e*(l.coordinate+e*d()/2-c);a[t]=l=RJ(RJ({},l),{},{tickCoord:f>0?l.coordinate-f*e:l.coordinate})}else a[t]=l=RJ(RJ({},l),{},{tickCoord:l.coordinate});l.tickCoord!=null&&NJ(e,l.tickCoord,d,s,c)&&(c=l.tickCoord-e*(d()/2+i),a[t]=RJ(RJ({},l),{},{isShow:!0}))},u=o-1;u>=0;u--)if(l(u))continue;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];if(u!=null){var 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}),u.tickCoord!=null&&NJ(e,u.tickCoord,()=>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];if(r==null)return 1;var a=r,s,u=()=>(s===void 0&&(s=n(r,t)),s);if(t===0){var d=e*(a.coordinate-e*u()/2-c);o[t]=a=RJ(RJ({},a),{},{tickCoord:d<0?a.coordinate-d*e:a.coordinate})}else o[t]=a=RJ(RJ({},a),{},{tickCoord:a.coordinate});a.tickCoord!=null&&NJ(e,a.tickCoord,u,c,l)&&(c=a.tickCoord+e*(u()/2+i),o[t]=RJ(RJ({},a),{},{isShow:!0}))},h=0;h{var i=typeof l==`function`?l(e.value,r):e.value;return p===`width`?jJ(wU(i,{fontSize:t,letterSpacing:n}),m,d):wU(i,{fontSize:t,letterSpacing:n})[p]},g=i[0],_=i[1],v=i.length>=2&&g!=null&&_!=null?Tg(_.coordinate-g.coordinate):1,y=MJ(a,v,p);return c===`equidistantPreserveStart`?FJ(v,y,h,i,o):c===`equidistantPreserveEnd`?IJ(v,y,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?UJ(v,y,h,i,o,c===`preserveStartEnd`):HJ(v,y,h,i,o),f.filter(e=>e.isShow))}var GJ=e=>{var t=e.ticks,n=e.label,r=e.labelGapWithTick,i=r===void 0?5:r,a=e.tickSize,o=a===void 0?0:a,s=e.tickMargin,c=s===void 0?0:s,l=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>l&&(l=t.width)}});var u=n?n.getBoundingClientRect().width:0,d=o+c,f=l+d+u+(n?i:0);return Math.round(f)}return 0},KJ=e=>{var t=e.ticks,n=e.label,r=e.labelGapWithTick,i=r===void 0?5:r,a=e.tickSize,o=a===void 0?0:a,s=e.tickMargin,c=s===void 0?0:s,l=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.height>l&&(l=t.height)}});var u=n?n.getBoundingClientRect().height:0,d=o+c,f=l+d+u+(n?i:0);return Math.round(f)}return 0},qJ=dC({name:`renderedTicks`,initialState:{xAxis:{},yAxis:{}},reducers:{setRenderedTicks:(e,t)=>{var n=t.payload,r=n.axisType,i=n.axisId,a=n.ticks;e[r][i]=RS(a)},removeRenderedTicks:(e,t)=>{var n=t.payload,r=n.axisType,i=n.axisId;delete e[r][i]}}}),JJ=qJ.actions,YJ=JJ.setRenderedTicks,XJ=JJ.removeRenderedTicks,ZJ=qJ.reducer,QJ=[`axisLine`,`width`,`height`,`className`,`hide`,`ticks`,`axisType`,`axisId`];function $J(e,t){return iY(e)||rY(e,t)||tY(e,t)||eY()}function eY(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tY(e,t){if(e){if(typeof e==`string`)return nY(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nY(e,t):void 0}}function nY(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{if(r!=null&&n!=null){var e=t.map(e=>({value:e.value,coordinate:e.coordinate,offset:e.offset,index:e.index})),o=a.current;o!=null&&o.axisId===r&&o.axisType===n&&kJ(o.ticks,e)||(a.current={ticks:e,axisId:r,axisType:n},i(YJ({ticks:e,axisId:r,axisType:n})))}},[i,t,r,n]),(0,w.useEffect)(()=>r==null||n==null?Rg:()=>{i(XJ({axisId:r,axisType:n}))},[i,r,n]),null}var bY=(0,w.forwardRef)((e,t)=>{var n=e.ticks,r=n===void 0?[]:n,i=e.tick,a=e.tickLine,o=e.stroke,s=e.tickFormatter,c=e.unit,l=e.padding,u=e.tickTextProps,d=e.orientation,f=e.mirror,p=e.x,m=e.y,h=e.width,g=e.height,_=e.tickSize,v=e.tickMargin,y=e.fontSize,b=e.letterSpacing,x=e.getTicksConfig,S=e.events,C=e.axisType,T=e.axisId,E=WJ(lY(lY({},x),{},{ticks:r}),y,b),D=$h(x),O=eg(i),k=uW(D.textAnchor)?D.textAnchor:gY(d,f),A=_Y(d,f),j={};typeof a==`object`&&(j=a);var M=lY(lY({},D),{},{fill:`none`},j),N=E.map(e=>lY({entry:e},hY(e,p,m,h,g,d,_,f,v))),P=N.map(e=>{var t=e.entry,n=e.line;return w.createElement(dg,{className:`recharts-cartesian-axis-tick`,key:`tick-${t.value}-${t.coordinate}-${t.tickCoord}`},a&&w.createElement(`line`,sY({},M,n,{className:L(`recharts-cartesian-axis-tick-line`,bg(a,`className`))})))}),F=N.map((e,t)=>{var n=e.entry,r=e.tick,a=lY(lY({},lY(lY(lY(lY({verticalAnchor:A},D),{},{textAnchor:k,stroke:`none`,fill:o},r),{},{index:t,payload:n,visibleTicksCount:E.length,tickFormatter:s,padding:l},u),{},{angle:u?.angle??D.angle??0})),O);return w.createElement(dg,sY({className:`recharts-cartesian-axis-tick-label`,key:`tick-label-${n.value}-${n.coordinate}-${n.tickCoord}`},Lv(S,n,t)),i&&w.createElement(vY,{option:i,tickProps:a,value:`${typeof s==`function`?s(n.value,t):n.value}${c||``}`}))});return w.createElement(`g`,{className:`recharts-cartesian-axis-ticks recharts-${C}-ticks`},w.createElement(yY,{ticks:E,axisId:T,axisType:C}),F.length>0&&w.createElement(sH,{zIndex:ZA.label},w.createElement(`g`,{className:`recharts-cartesian-axis-tick-labels recharts-${C}-tick-labels`,ref:t},F)),P.length>0&&w.createElement(`g`,{className:`recharts-cartesian-axis-tick-lines recharts-${C}-tick-lines`},P))}),xY=(0,w.forwardRef)((e,t)=>{var n=e.axisLine,r=e.width,i=e.height,a=e.className,o=e.hide,s=e.ticks,c=e.axisType,l=e.axisId,u=aY(e,QJ),d=$J((0,w.useState)(``),2),f=d[0],p=d[1],m=$J((0,w.useState)(``),2),h=m[0],g=m[1],_=(0,w.useRef)(null);(0,w.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>GJ({ticks:_.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin}),getCalculatedHeight:()=>KJ({ticks:_.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}));var v=(0,w.useCallback)(e=>{if(e){var t=e.getElementsByClassName(`recharts-cartesian-axis-tick-value`);_.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==f||a!==h)&&(p(i),g(a))}}},[f,h]);return o||r!=null&&r<=0||i!=null&&i<=0?null:w.createElement(sH,{zIndex:e.zIndex},w.createElement(dg,{className:L(`recharts-cartesian-axis`,a)},w.createElement(mY,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:$h(e)}),w.createElement(bY,{ref:v,axisType:c,events:u,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:l}),w.createElement(NW,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},w.createElement(qW,{label:e.label,labelRef:e.labelRef}),e.children)))}),SY=w.forwardRef((e,t)=>{var n=Uv(e,pY);return w.createElement(xY,sY({},n,{ref:t}))});SY.displayName=`CartesianAxis`;var CY=(0,w.createContext)({grid:{stroke:`#ccc`,fill:`none`}});CY.Provider;var wY=()=>(0,w.useContext)(CY),TY=[`x1`,`y1`,`x2`,`y2`,`key`],EY=[`offset`],DY=[`xAxisId`,`yAxisId`],OY=[`xAxisId`,`yAxisId`];function kY(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 AY(e){for(var t=1;t{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 w.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function RY(e){var t=e.option,n=e.lineItemProps,r;if(w.isValidElement(t))r=w.cloneElement(t,n);else if(typeof t==`function`)r=t(n);else{var i=n.x1,a=n.y1,o=n.x2,s=n.y2,c=n.key,l=$h(FY(n,TY))??{};l.offset;var u=FY(l,EY),d=Array.isArray(u.strokeDasharray)?u.strokeDasharray.join(`,`):u.strokeDasharray;r=w.createElement(`line`,PY({},u,{strokeDasharray:d,x1:i,y1:a,x2:o,y2:s,fill:`none`,key:c}))}return r}function zY(e){var t=e.x,n=e.width,r=e.horizontal,i=r===void 0||r,a=e.horizontalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=FY(e,DY),s=a.map((e,r)=>{var a=AY(AY({},o),{},{x1:t,y1:e,x2:t+n,y2:e,key:`line-${r}`,index:r});return w.createElement(RY,{key:`line-${r}`,option:i,lineItemProps:a})});return w.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},s)}function BY(e){var t=e.y,n=e.height,r=e.vertical,i=r===void 0||r,a=e.verticalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=FY(e,OY),s=a.map((e,r)=>{var a=AY(AY({},o),{},{x1:e,y1:t,x2:e,y2:t+n,key:`line-${r}`,index:r});return w.createElement(RY,{option:i,lineItemProps:a,key:`line-${r}`})});return w.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},s)}function VY(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||s==null)return null;var l=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,s)=>{var c=l[s+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=s%t.length;return w.createElement(`rect`,{key:`react-${s}`,y:e,x:r,height:u,width:a,stroke:`none`,fill:t[d],fillOpacity:n,className:`recharts-cartesian-grid-bg`})});return w.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},u)}function HY(e){var t=e.vertical,n=t===void 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(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==u[0]&&u.unshift(0);var d=u.map((e,t)=>{var n=u[t+1],l=n==null?a+s-e:n-e;if(l<=0)return null;var d=t%r.length;return w.createElement(`rect`,{key:`react-${t}`,x:e,y:o,width:l,height:c,stroke:`none`,fill:r[d],fillOpacity:i,className:`recharts-cartesian-grid-bg`})});return w.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},d)}var UY=(e,t)=>{var n=e.xAxis,r=e.width,i=e.height,a=e.offset;return _w(WJ(AY(AY(AY({},pY),n),{},{ticks:vw(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},WY=(e,t)=>{var n=e.yAxis,r=e.width,i=e.height,a=e.offset;return _w(WJ(AY(AY(AY({},pY),n),{},{ticks:vw(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},GY={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:ZA.grid};function KY(e){var t=HT(),n=UT(),r=VT(),i=AY(AY({},Uv(e,GY)),{},{x:G(e.x)?e.x:r.left,y:G(e.y)?e.y:r.top,width:G(e.width)?e.width:r.width,height:G(e.height)?e.height:r.height}),a=i.xAxisId,o=i.yAxisId,s=i.x,c=i.y,l=i.width,u=i.height,d=i.syncWithTicks,f=i.horizontalValues,p=i.verticalValues,m=nT(),h=K(e=>Mz(e,`xAxis`,a,m)),g=K(e=>Mz(e,`yAxis`,o,m)),_=wY(),v={stroke:i.stroke??_.grid.stroke,strokeWidth:i.strokeWidth??_.grid.strokeWidth,strokeOpacity:i.strokeOpacity??_.grid.strokeOpacity,strokeDasharray:i.strokeDasharray??_.grid.strokeDasharray};if(!cw(l)||!cw(u)||!G(s)||!G(c))return null;var y=i.verticalCoordinatesGenerator||UY,b=i.horizontalCoordinatesGenerator||WY,x=i.horizontalPoints,S=i.verticalPoints;if((!x||!x.length)&&typeof b==`function`){var C=f&&f.length,T=b({yAxis:g?AY(AY({},g),{},{ticks:C?f:g.ticks}):void 0,width:t??l,height:n??u,offset:r},C?!0:d);lT(Array.isArray(T),`horizontalCoordinatesGenerator should return Array but instead it returned [${typeof T}]`),Array.isArray(T)&&(x=T)}if((!S||!S.length)&&typeof y==`function`){var E=p&&p.length,D=y({xAxis:h?AY(AY({},h),{},{ticks:E?p:h.ticks}):void 0,width:t??l,height:n??u,offset:r},E?!0:d);lT(Array.isArray(D),`verticalCoordinatesGenerator should return Array but instead it returned [${typeof D}]`),Array.isArray(D)&&(S=D)}return w.createElement(sH,{zIndex:i.zIndex},w.createElement(`g`,{className:`recharts-cartesian-grid`},w.createElement(LY,{fill:i.fill??_.grid.fill,fillOpacity:i.fillOpacity??_.grid.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),w.createElement(VY,PY({},i,{horizontalPoints:x})),w.createElement(HY,PY({},i,{verticalPoints:S})),w.createElement(zY,PY({},i,v,{offset:r,horizontalPoints:x,xAxis:h,yAxis:g})),w.createElement(BY,PY({},i,v,{offset:r,verticalPoints:S,xAxis:h,yAxis:g}))))}KY.displayName=`CartesianGrid`;var qY=dC({name:`errorBars`,initialState:{},reducers:{addErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.errorBar;e[r]||(e[r]=[]),e[r].push(i)},replaceErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.prev,a=n.next;e[r]&&(e[r]=e[r].map(e=>e.dataKey===i.dataKey&&e.direction===i.direction?a:e))},removeErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.errorBar;e[r]&&(e[r]=e[r].filter(e=>e.dataKey!==i.dataKey||e.direction!==i.direction))}}}),JY=qY.actions;JY.addErrorBar,JY.replaceErrorBar,JY.removeErrorBar;var YY=qY.reducer,XY=[`children`];function ZY(e,t){if(e==null)return{};var n,r,i=QY(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r({x:0,y:0,value:0}),errorBarOffset:0});function eX(e){var t=e.children,n=ZY(e,XY);return w.createElement($Y.Provider,{value:n},t)}function tX(e,t){var n=K(t=>NL(t,e)),r=K(e=>IL(e,t)),i=n?.allowDataOverflow??jL.allowDataOverflow,a=r?.allowDataOverflow??PL.allowDataOverflow;return{needClip:i||a,needClipX:i,needClipY:a}}function nX(e){var t=e.xAxisId,n=e.yAxisId,r=e.clipPathId,i=LK(),a=tX(t,n),o=a.needClipX,s=a.needClipY,c=a.needClip,l=K(e=>oz(e,t,!1)),u=K(e=>sz(e,n,!1));if(!c||!i)return null;var d=i.x,f=i.y,p=i.width,m=i.height,h=o&&l?Math.min(l[0],l[1]):d-p/2,g=s&&u?Math.min(u[0],u[1]):f-m/2,_=o&&l?Math.abs(l[1]-l[0]):p*2,v=s&&u?Math.abs(u[1]-u[0]):m*2;return w.createElement(`clipPath`,{id:`clipPath-${r}`},w.createElement(`rect`,{x:h,y:g,width:_,height:v}))}function rX(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function iX(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var aX=`Invariant failed`;function oX(e,t){if(!e)throw Error(aX)}var sX=[`option`];function cX(e,t){if(e==null)return{};var n,r,i=lX(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r1&&arguments[1]!==void 0?arguments[1]:0;return(n,r)=>{if(G(e))return e;var i=G(n)||Fg(n);return i?e(n,r):(!i&&oX(!1,`minPointSize callback function received a value with type of ${typeof n}. Currently only numbers or null/undefined are supported.`),t)}},pX=(e,t,n)=>n,mX=q([WL,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`bar`).find(e=>e.id===t)),hX=q([mX],e=>e?.maxBarSize),gX=(e,t,n,r)=>r,_X=q([GT,WL,rX,iX,pX],(e,t,n,r,i)=>t.filter(t=>e===`horizontal`?t.xAxisId===n:t.yAxisId===r).filter(e=>e.isPanorama===i).filter(e=>e.hide===!1).filter(e=>e.type===`bar`)),vX=(e,t,n)=>{var r=GT(e),i=rX(e,t),a=iX(e,t);if(i!=null&&a!=null)return r===`horizontal`?gR(e,`yAxis`,a,n):gR(e,`xAxis`,i,n)},yX=q([_X,WA,(e,t)=>{var n=GT(e),r=rX(e,t),i=iX(e,t);if(r!=null&&i!=null)return n===`horizontal`?kz(e,`xAxis`,r):kz(e,`yAxis`,i)}],GK),bX=(e,t,n)=>{var r=mX(e,t);if(r==null)return 0;var i=rX(e,t),a=iX(e,t);if(i==null||a==null)return 0;var o=GT(e),s=VA(e),c=r.maxBarSize,l=Fg(c)?s:c,u,d;return o===`horizontal`?(u=Fz(e,`xAxis`,i,n),d=Pz(e,`xAxis`,i,n)):(u=Fz(e,`yAxis`,a,n),d=Pz(e,`yAxis`,a,n)),Aw(u,d,!0)??l??0},xX=(e,t,n)=>{var r=GT(e),i=rX(e,t),a=iX(e,t);if(i!=null&&a!=null){var o,s;return r===`horizontal`?(o=Fz(e,`xAxis`,i,n),s=Pz(e,`xAxis`,i,n)):(o=Fz(e,`yAxis`,a,n),s=Pz(e,`yAxis`,a,n)),Aw(o,s)}},SX=q([Qw,eT,(e,t,n)=>{var r=rX(e,t);if(r!=null)return Fz(e,`xAxis`,r,n)},(e,t,n)=>{var r=iX(e,t);if(r!=null)return Fz(e,`yAxis`,r,n)},(e,t,n)=>{var r=rX(e,t);if(r!=null)return Pz(e,`xAxis`,r,n)},(e,t,n)=>{var r=iX(e,t);if(r!=null)return Pz(e,`yAxis`,r,n)},q([q([yX,VA,HA,UA,bX,xX,hX],QK),mX],eq),GT,fA,xX,q([vX,mX],$K),mX,gX],(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{var p=c.chartData,m=c.dataStartIndex,h=c.dataEndIndex;if(!(d==null||o==null||t==null||s!==`horizontal`&&s!==`vertical`||n==null||r==null||i==null||a==null||l==null)){var g=d.data,_=g!=null&&g.length>0?g:p?.slice(m,h+1);if(_!=null)return dZ({layout:s,barSettings:d,pos:o,parentViewBox:t,bandSize:l,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,stackedData:u,displayedData:_,offset:e,cells:f,dataStartIndex:m})}}),CX=[`index`];function wX(){return wX=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=(0,w.useContext)(DX);if(t!=null)return t.stackId;if(e!=null)return Sw(e)},kX=(e,t)=>`recharts-bar-stack-clip-path-${e}-${t}`,AX=e=>{var t=(0,w.useContext)(DX);if(t!=null){var n=t.stackId;return`url(#${kX(n,e)})`}},jX=e=>{var t=e.index,n=TX(e,CX),r=AX(t);return w.createElement(dg,wX({className:`recharts-bar-stack-layer`,clipPath:r},n))},MX=[`onMouseEnter`,`onMouseLeave`,`onClick`],NX=[`value`,`background`,`tooltipPosition`],PX=[`id`],FX=[`onMouseEnter`,`onClick`,`onMouseLeave`];function IX(e,t){return VX(e)||BX(e,t)||RX(e,t)||LX()}function LX(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RX(e,t){if(e){if(typeof e==`string`)return zX(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zX(e,t):void 0}}function zX(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{var t=e.dataKey,n=e.name,r=e.fill,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:Mw(n,t),payload:e}]},ZX=w.memo(e=>{var t=e.dataKey,n=e.stroke,r=e.strokeWidth,i=e.fill,a=e.name,o=e.hide,s=e.unit,c=e.formatter,l=e.tooltipType,u=e.id,d={dataDefinedOnItem:void 0,getPosition:Rg,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:Mw(a,t),hide:o,type:l,color:i,unit:s,formatter:c,graphicalItemId:u}};return w.createElement(MG,{tooltipEntrySettings:d})});function QX(e){var t=K(iV),n=e.data,r=e.dataKey,i=e.background,a=e.allOtherBarProps,o=a.onMouseEnter,s=a.onMouseLeave,c=a.onClick,l=JX(a,MX),u=kG(o,r,a.id),d=AG(s),f=jG(c,r,a.id);if(!i||n==null)return null;var p=eg(i);return w.createElement(sH,{zIndex:tq(i,ZA.barBackground)},n.map((e,n)=>{e.value;var a=e.background;e.tooltipPosition;var o=JX(e,NX);if(!a)return null;var s=u(e,e.originalDataIndex),c=d(e,e.originalDataIndex),m=f(e,e.originalDataIndex),h=WX(WX(WX(WX(WX({option:i,isActive:String(e.originalDataIndex)===t},o),{},{fill:`#eee`},a),p),Lv(l,e,n)),{},{onMouseEnter:s,onMouseLeave:c,onClick:m,dataKey:r,index:n,className:`recharts-bar-background-rectangle`});return w.createElement(dX,HX({key:`background-bar-${n}`},h))}))}function $X(e){var t=e.showLabels,n=e.children,r=e.rects?.map(e=>{var t={x:e.x,y:e.y,width:e.width,lowerWidth:e.width,upperWidth:e.width,height:e.height};return WX(WX({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return w.createElement(tG,{value:t?r:void 0},n)}function eZ(e){var t=e.shape,n=e.activeBar,r=e.baseProps,i=e.entry,a=e.index,o=e.dataKey,s=K(iV),c=K(oV),l=n&&String(i.originalDataIndex)===s&&(c==null||o===c),u=s!=null&&(String(i.originalDataIndex)!==s||c!=null&&o!==c),d=IX((0,w.useState)(!1),2),f=d[0],p=d[1],m=IX((0,w.useState)(!1),2),h=m[0],g=m[1];(0,w.useEffect)(()=>{var e;return l?(p(!0),e=requestAnimationFrame(()=>{g(!0)})):(g(!1),u&&p(!1)),()=>{cancelAnimationFrame(e)}},[l,u]);var _=(0,w.useCallback)(()=>{l||p(!1)},[l]),v=l&&h,y=l||f,b=l?n===!0?t:n:t,x=w.createElement(dX,HX({},r,{name:String(r.name)},i,{isActive:v,option:b,index:a,dataKey:o,animationElapsedTime:e.animationElapsedTime,isAnimating:e.isAnimating,isEntrance:e.isEntrance,onTransitionEnd:_}));return y?w.createElement(sH,{zIndex:ZA.activeBar},w.createElement(jX,{index:i.originalDataIndex},x)):x}function tZ(e){var t=e.shape,n=e.baseProps,r=e.entry,i=e.index,a=e.dataKey;return w.createElement(dX,HX({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:a,animationElapsedTime:e.animationElapsedTime,isAnimating:e.isAnimating,isEntrance:e.isEntrance}))}function nZ(e){var t=e.data,n=e.props,r=e.animationElapsedTime,i=e.isAnimating,a=e.isEntrance,o=$h(n)??{},s=o.id,c=JX(o,PX),l=n.shape,u=n.dataKey,d=n.activeBar,f=n.onMouseEnter,p=n.onClick,m=n.onMouseLeave,h=JX(n,FX),g=kG(f,u,s),_=AG(m),v=jG(p,u,s);return t?w.createElement(w.Fragment,null,t.map((e,t)=>w.createElement(jX,HX({index:e.originalDataIndex,key:`rectangle-${e?.x}-${e?.y}-${e?.value}-${t}`,className:`recharts-bar-rectangle`},Lv(h,e,t),{onMouseEnter:g(e,e.originalDataIndex),onMouseLeave:_(e,e.originalDataIndex),onClick:v(e,e.originalDataIndex)}),d?w.createElement(eZ,{shape:l,activeBar:d,baseProps:c,entry:e,index:t,dataKey:u,animationElapsedTime:r,isAnimating:i,isEntrance:a}):w.createElement(tZ,{shape:l,baseProps:c,entry:e,index:t,dataKey:u,animationElapsedTime:r,isAnimating:i,isEntrance:a})))):null}var rZ=(e,t,n)=>e==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>{if(e.status===`removed`)return n===`horizontal`?[WX(WX({},e.prev),{},{height:Ng(e.prev.height,0,t),y:Ng(e.prev.y,e.prev.y+e.prev.height,t)})]:[WX(WX({},e.prev),{},{width:Ng(e.prev.width,0,t)})];if(e.status===`matched`)return[WX(WX({},e.next),{},{x:Ng(e.prev.x,e.next.x,t),y:Ng(e.prev.y,e.next.y,t),width:Ng(e.prev.width,e.next.width,t),height:Ng(e.prev.height,e.next.height,t)})];var r=e.next;return n===`horizontal`?[WX(WX({},r),{},{height:Ng(0,r.height,t),y:Ng(r.stackedBarStart,r.y,t)})]:[WX(WX({},r),{},{width:Ng(0,r.width,t),x:Ng(r.stackedBarStart,r.x,t)})]});function iZ(e){var t=e.props,n=e.previousRectanglesRef,r=t.data,i=t.isAnimationActive,a=t.animationBegin,o=t.animationDuration,s=t.animationEasing,c=t.animationInterpolateFn,l=t.layout,u=tK(t.onAnimationStart,t.onAnimationEnd),d=u.isAnimating,f=u.handleAnimationStart,p=u.handleAnimationEnd;return w.createElement($X,{showLabels:!d,rects:r},w.createElement(nK,{animationInput:r,animationIdPrefix:`recharts-bar-`,items:r,previousItemsRef:n,isAnimationActive:i,animationBegin:a,animationDuration:o,animationEasing:s,onAnimationStart:f,onAnimationEnd:p,animationInterpolateFn:c,animationMatchBy:t.animationMatchBy,layout:l},(e,n,r)=>w.createElement(dg,null,w.createElement(nZ,{props:t,data:e,animationElapsedTime:n,isAnimating:d||n<1,isEntrance:r}))),w.createElement(oG,{label:t.label}),t.children)}function aZ(e){var t=(0,w.useRef)(null);return w.createElement(iZ,{previousRectanglesRef:t,props:e})}var oZ=0,sZ=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:mw(e,t)}},cZ=class extends w.PureComponent{render(){var e=this.props,t=e.hide,n=e.data,r=e.dataKey,i=e.className,a=e.xAxisId,o=e.yAxisId,s=e.needClip,c=e.background,l=e.id;if(t||n==null)return null;var u=L(`recharts-bar`,i),d=l;return w.createElement(dg,{className:u,id:l},s&&w.createElement(`defs`,null,w.createElement(nX,{clipPathId:d,xAxisId:a,yAxisId:o})),w.createElement(dg,{className:`recharts-bar-rectangles`,clipPath:s?`url(#clipPath-${d})`:void 0},w.createElement(QX,{data:n,dataKey:r,background:c,allOtherBarProps:this.props}),w.createElement(aZ,this.props)))}},lZ={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:`ease`,animationInterpolateFn:rZ,animationMatchBy:VG,background:!1,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`rect`,minPointSize:oZ,shape:uX,xAxisId:0,yAxisId:0,zIndex:ZA.bar};function uZ(e){var t=e.xAxisId,n=e.yAxisId,r=e.hide,i=e.legendType,a=e.minPointSize,o=e.activeBar,s=e.animationBegin,c=e.animationDuration,l=e.animationEasing,u=e.isAnimationActive,d=tX(t,n).needClip,f=KT(),p=nT(),m=_G(e.children,cU),h=K(t=>SX(t,e.id,p,m));if(f!==`vertical`&&f!==`horizontal`)return null;var g,_=h?.[0];return g=_==null||_.height==null||_.width==null?0:f===`vertical`?_.height/2:_.width/2,w.createElement(eX,{xAxisId:t,yAxisId:n,data:h,dataPointFormatter:sZ,errorBarOffset:g},w.createElement(cZ,HX({},e,{layout:f,needClip:d,data:h,xAxisId:t,yAxisId:n,hide:r,legendType:i,minPointSize:a,activeBar:o,animationBegin:s,animationDuration:c,animationEasing:l,isAnimationActive:u})))}function dZ(e){var t=e.layout,n=e.barSettings,r=n.dataKey,i=n.minPointSize,a=n.hasCustomShape,o=e.pos,s=e.bandSize,c=e.xAxis,l=e.yAxis,u=e.xAxisTicks,d=e.yAxisTicks,f=e.stackedData,p=e.displayedData,m=e.offset,h=e.cells,g=e.parentViewBox,_=e.dataStartIndex,v=t===`horizontal`?l:c,y=f?v.scale.domain():null,b=ww({numericAxis:v}),x=v.scale.map(b);return p.map((e,n)=>{var p,v,S,C,w,T;if(f){var E=f[n+_];if(E==null)return null;p=yw(E,y)}else p=mw(e,r),Array.isArray(p)||(p=[b,p]);var D=fX(i,oZ)(p[1],n);if(t===`horizontal`){var O=l.scale.map(p[0]),k=l.scale.map(p[1]);if(O==null||k==null)return null;v=Cw({axis:c,ticks:u,bandSize:s,offset:o.offset,entry:e,index:n}),S=k??O??void 0,C=o.size;var A=O-k;if(w=Eg(A)?0:A,T={x:v,y:m.top,width:C,height:m.height},Math.abs(D)>0&&Math.abs(w)0&&Math.abs(C)w.createElement(w.Fragment,null,w.createElement(NG,{legendPayload:XX(t)}),w.createElement(ZX,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),w.createElement(yK,{type:`bar`,id:e,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:n,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:r,hasCustomShape:t.shape!=null&&t.shape!==uX}),w.createElement(sH,{zIndex:t.zIndex},w.createElement(uZ,HX({},t,{id:e})))))}var pZ=w.memo(fZ,CE);pZ.displayName=`Bar`;var mZ=[`domain`,`range`],hZ=[`domain`,`range`];function gZ(e,t){if(e==null)return{};var n,r,i=_Z(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{if(o!=null)return TZ(TZ({},a),{},{type:o})},[a,o]);return(0,w.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(DK(s)):n.current!==s&&t(OK({prev:n.current,next:s})),n.current=s)},[s,t]),(0,w.useLayoutEffect)(()=>()=>{n.current&&=(t(kK(n.current)),null)},[t]),null}var MZ=e=>{var t=e.xAxisId,n=e.className,r=e.height,i=e.label,a=(0,w.useRef)(null),o=(0,w.useRef)(null),s=K(eT),c=nT(),l=yb(),u=`xAxis`,d=K(e=>Nz(e,u,t,c)),f=K(e=>xz(e,t)),p=K(e=>Ez(e,t)),m=K(e=>ML(e,t));if((0,w.useLayoutEffect)(()=>{if(!(r!==`auto`||!f||RW(i)||(0,w.isValidElement)(i)||m==null)){var e=a.current;if(e){var n=e.getCalculatedHeight();Math.round(f.height)!==Math.round(n)&&l(PK({id:t,height:n}))}}},[d,f,l,i,t,r,m]),f==null||p==null||m==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var h=kZ(e,xZ);m.id,m.scale;var g=kZ(m,SZ);return w.createElement(SY,CZ({},h,g,{ref:a,labelRef:o,x:p.x,y:p.y,width:f.width,height:f.height,className:L(`recharts-${u} ${u}`,n),viewBox:s,ticks:d,axisType:u,axisId:t}))},NZ={allowDataOverflow:jL.allowDataOverflow,allowDecimals:jL.allowDecimals,allowDuplicatedCategory:jL.allowDuplicatedCategory,angle:jL.angle,axisLine:pY.axisLine,height:jL.height,hide:!1,includeHidden:jL.includeHidden,interval:jL.interval,label:!1,minTickGap:jL.minTickGap,mirror:jL.mirror,orientation:jL.orientation,padding:jL.padding,reversed:jL.reversed,scale:jL.scale,tick:jL.tick,tickCount:jL.tickCount,tickLine:pY.tickLine,tickSize:pY.tickSize,type:jL.type,niceTicks:jL.niceTicks,xAxisId:0},PZ=w.memo(e=>{var t=Uv(e,NZ);return w.createElement(w.Fragment,null,w.createElement(jZ,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),w.createElement(MZ,t))},yZ);PZ.displayName=`XAxis`;var FZ=[`type`],IZ=[`dangerouslySetInnerHTML`,`ticks`,`scale`],LZ=[`id`,`scale`];function RZ(){return RZ=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(o!=null)return BZ(BZ({},a),{},{type:o})},[o,a]);return(0,w.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(AK(s)):n.current!==s&&t(jK({prev:n.current,next:s})),n.current=s)},[s,t]),(0,w.useLayoutEffect)(()=>()=>{n.current&&=(t(MK(n.current)),null)},[t]),null}function qZ(e){var t=e.yAxisId,n=e.className,r=e.width,i=e.label,a=(0,w.useRef)(null),o=(0,w.useRef)(null),s=K(eT),c=nT(),l=yb(),u=`yAxis`,d=K(e=>Oz(e,t)),f=K(e=>Dz(e,t)),p=K(e=>Nz(e,u,t,c)),m=K(e=>FL(e,t));if((0,w.useLayoutEffect)(()=>{if(!(r!==`auto`||!d||RW(i)||(0,w.isValidElement)(i)||m==null)){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&l(NK({id:t,width:n}))}}},[p,d,l,i,t,r,m]),d==null||f==null||m==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var h=WZ(e,IZ);m.id,m.scale;var g=WZ(m,LZ);return w.createElement(SY,RZ({},h,g,{ref:a,labelRef:o,x:f.x,y:f.y,tickTextProps:r===`auto`?{width:void 0}:{width:r},width:d.width,height:d.height,className:L(`recharts-${u} ${u}`,n),viewBox:s,ticks:p,axisType:u,axisId:t}))}var JZ={allowDataOverflow:PL.allowDataOverflow,allowDecimals:PL.allowDecimals,allowDuplicatedCategory:PL.allowDuplicatedCategory,angle:PL.angle,axisLine:pY.axisLine,hide:!1,includeHidden:PL.includeHidden,interval:PL.interval,label:!1,minTickGap:PL.minTickGap,mirror:PL.mirror,orientation:PL.orientation,padding:PL.padding,reversed:PL.reversed,scale:PL.scale,tick:PL.tick,tickCount:PL.tickCount,tickLine:pY.tickLine,tickSize:pY.tickSize,type:PL.type,niceTicks:PL.niceTicks,width:PL.width,yAxisId:0},YZ=w.memo(e=>{var t=Uv(e,JZ);return w.createElement(w.Fragment,null,w.createElement(KZ,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),w.createElement(qZ,t))},yZ);YZ.displayName=`YAxis`;var XZ=q([(e,t)=>t,GT,_j,Ej,ZB,$B,jV,Qw],UV);function ZZ(e){return`getBBox`in e.currentTarget&&typeof e.currentTarget.getBBox==`function`}function QZ(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(ZZ(e)){var i=e.currentTarget.getBBox();n=i.width>0?t.width/i.width:1,r=i.height>0?t.height/i.height:1}else{var a=e.currentTarget;n=a.offsetWidth>0?t.width/a.offsetWidth:1,r=a.offsetHeight>0?t.height/a.offsetHeight:1}var o=(e,i)=>({relativeX:Math.round((e-t.left)/n),relativeY:Math.round((i-t.top)/r)});return`touches`in e?Array.from(e.touches).map(e=>o(e.clientX,e.clientY)):o(e.clientX,e.clientY)}var $Z=US(`mouseClick`),eQ=ZC();eQ.startListening({actionCreator:$Z,effect:(e,t)=>{var n=e.payload,r=XZ(t.getState(),QZ(n));r?.activeIndex!=null&&t.dispatch(nB({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var tQ=US(`mouseMove`),nQ=ZC(),rQ=null,iQ=null,aQ=null;nQ.startListening({actionCreator:tQ,effect:(e,t)=>{var n=e.payload,r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a?.includes(`mousemove`);rQ!==null&&(cancelAnimationFrame(rQ),rQ=null),iQ!==null&&(typeof i!=`number`||!o)&&(clearTimeout(iQ),iQ=null),aQ=QZ(n);var s=()=>{var e=t.getState(),n=Bz(e,e.tooltip.settings.shared);if(!aQ){rQ=null,iQ=null;return}if(n===`axis`){var r=XZ(e,aQ);r?.activeIndex==null?t.dispatch($z()):t.dispatch(tB({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}rQ=null,iQ=null};if(!o){s();return}i===`raf`?rQ=requestAnimationFrame(s):typeof i==`number`&&iQ===null&&(iQ=setTimeout(s,i))}});function oQ(e,t){return t instanceof HTMLElement?`HTMLElement <${t.tagName} class="${t.className}">`:t===window?`global.window`:e===`children`&&typeof t==`object`&&t?`<>`:t}var sQ={accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:`none`,syncId:void 0,syncMethod:`index`,baseValue:void 0,reverseStackOrder:!1},cQ=dC({name:`rootProps`,initialState:sQ,reducers:{updateOptions:(e,t)=>{e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=t.payload.barGap??sQ.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),lQ=cQ.reducer,uQ=cQ.actions.updateOptions,dQ=dC({name:`polarOptions`,initialState:null,reducers:{updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)}});dQ.actions.updatePolarOptions;var fQ=dQ.reducer,pQ=US(`keyDown`),mQ=US(`focus`),hQ=US(`blur`),gQ=ZC(),_Q=null,vQ=null,yQ=null;gQ.startListening({actionCreator:pQ,effect:(e,t)=>{yQ=e.payload,_Q!==null&&(cancelAnimationFrame(_Q),_Q=null);var n=t.getState().eventSettings,r=n.throttleDelay,i=n.throttledEvents,a=i===`all`||i.includes(`keydown`);vQ!==null&&(typeof r!=`number`||!a)&&(clearTimeout(vQ),vQ=null);var o=()=>{try{var e=t.getState();if(e.rootProps.accessibilityLayer===!1)return;var n=e.tooltip.keyboardInteraction,r=yQ;if(r!==`ArrowRight`&&r!==`ArrowLeft`&&r!==`Enter`)return;var i=_B(n,zB(e),pR(e),JB(e)),a=i==null?-1:Number(i),o=!Number.isFinite(a)||a<0,s=$B(e),c=zB(e),l=Bz(e,e.tooltip.settings.shared);if(r===`Enter`){if(o)return;var u=IV(e,l,`hover`,String(n.index));t.dispatch(iB({active:!n.active,activeIndex:n.index,activeCoordinate:u}));return}var d=Iz(e)===`left-to-right`?1:-1,f=r===`ArrowRight`?1:-1,p;if(o){var m=pR(e),h=JB(e),g=f*d,_=e=>({active:!1,index:String(e),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(p=-1,g>0){for(var v=0;v=0;y--)if(_B(_(y),c,m,h)!=null){p=y;break}if(p<0)return}else{p=a+f*d;var b=s?.length||c.length;if(b===0||p>=b||p<0)return}var x=IV(e,l,`hover`,String(p));t.dispatch(iB({active:!0,activeIndex:p.toString(),activeCoordinate:x}))}finally{_Q=null,vQ=null}};if(!a){o();return}r===`raf`?_Q=requestAnimationFrame(o):typeof r==`number`&&vQ===null&&(o(),yQ=null,vQ=setTimeout(()=>{yQ?o():(vQ=null,_Q=null)},r))}}),gQ.startListening({actionCreator:mQ,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;if(!r.active&&r.index==null){var i=`0`,a=IV(n,Bz(n,n.tooltip.settings.shared),`hover`,String(i));t.dispatch(iB({active:!0,activeIndex:i,activeCoordinate:a}))}}}}),gQ.startListening({actionCreator:hQ,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;r.active&&t.dispatch(iB({active:!1,activeIndex:r.index,activeCoordinate:r.coordinate}))}}});function bQ(e){e.persist();var t=e.currentTarget;return new Proxy(e,{get:(e,n)=>{if(n===`currentTarget`)return t;var r=Reflect.get(e,n);return typeof r==`function`?r.bind(e):r}})}var xQ=US(`externalEvent`),SQ=ZC(),CQ=new Map,wQ=new Map,TQ=new Map;SQ.startListening({actionCreator:xQ,effect:(e,t)=>{var n=e.payload,r=n.handler,i=n.reactEvent;if(r!=null){var a=i.type,o=bQ(i);TQ.set(a,{handler:r,reactEvent:o});var s=CQ.get(a);s!==void 0&&(cancelAnimationFrame(s),CQ.delete(a));var c=t.getState().eventSettings,l=c.throttleDelay,u=c.throttledEvents,d=u===`all`||u?.includes(a),f=wQ.get(a);f!==void 0&&(typeof l!=`number`||!d)&&(clearTimeout(f),wQ.delete(a));var p=()=>{var e=TQ.get(a);try{if(!e)return;var n=e.handler,r=e.reactEvent,i=t.getState(),o={activeCoordinate:lV(i),activeDataKey:oV(i),activeIndex:iV(i),activeLabel:aV(i),activeTooltipIndex:iV(i),isTooltipActive:uV(i)};n&&n(o,r)}finally{CQ.delete(a),wQ.delete(a),TQ.delete(a)}};if(!d){p();return}if(l===`raf`){var m=requestAnimationFrame(p);CQ.set(a,m)}else if(typeof l==`number`){if(!wQ.has(a)){p();var h=setTimeout(p,l);wQ.set(a,h)}}else p()}}});var EQ=q([q([xB],e=>e.tooltipItemPayloads),(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(e=>e.settings.graphicalItemId===n);if(r!=null){var i=r.getPosition;if(i!=null)return i(t)}}}),DQ=US(`touchMove`),OQ=ZC(),kQ=null,AQ=null,jQ=null,MQ=null;OQ.startListening({actionCreator:DQ,effect:(e,t)=>{var n=e.payload;if(n.touches!=null&&n.touches.length!==0){MQ=bQ(n);var r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a.includes(`touchmove`);kQ!==null&&(cancelAnimationFrame(kQ),kQ=null),AQ!==null&&(typeof i!=`number`||!o)&&(clearTimeout(AQ),AQ=null),jQ=Array.from(n.touches).map(e=>QZ({clientX:e.clientX,clientY:e.clientY,currentTarget:n.currentTarget}));var s=()=>{if(MQ!=null){var e=t.getState(),n=Bz(e,e.tooltip.settings.shared);if(n===`axis`){var r=jQ?.[0];if(r==null){kQ=null,AQ=null;return}var i=XZ(e,r);i?.activeIndex!=null&&t.dispatch(tB({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}else if(n===`item`){var a=MQ.touches[0];if(document.elementFromPoint==null||a==null)return;var o=document.elementFromPoint(a.clientX,a.clientY);if(!o||!o.getAttribute)return;var s=o.getAttribute(Vw),c=o.getAttribute(`data-recharts-item-id`)??void 0,l=FB(e).find(e=>e.id===c);if(s==null||l==null||c==null)return;var u=l.dataKey,d=EQ(e,s,c);t.dispatch(Zz({activeDataKey:u,activeIndex:s,activeCoordinate:d,activeGraphicalItemId:c}))}kQ=null,AQ=null}};if(!o){s();return}i===`raf`?kQ=requestAnimationFrame(s):typeof i==`number`&&AQ===null&&(s(),MQ=null,AQ=setTimeout(()=>{MQ?s():(AQ=null,kQ=null)},i))}}});var NQ={throttleDelay:`raf`,throttledEvents:[`mousemove`,`touchmove`,`pointermove`,`scroll`,`wheel`]},PQ=dC({name:`eventSettings`,initialState:NQ,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=RS(t.payload.throttledEvents))}}}),FQ=PQ.actions.setEventSettings,IQ=PQ.reducer,LQ=fx({brush:vq,cartesianAxis:FK,chartData:MH,errorBars:YY,eventSettings:IQ,graphicalItems:vK,layout:aw,legend:iE,options:TH,polarAxis:lG,polarOptions:fQ,referenceElements:Qq,renderedTicks:ZJ,rootProps:lQ,tooltip:aB,zIndex:oH}),RQ=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Chart`;return tC({reducer:LQ,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:![`commonjs`,`es6`,`production`].includes(`es6`)}).concat([eQ.middleware,nQ.middleware,gQ.middleware,SQ.middleware,OQ.middleware]),enhancers:e=>{var t=e;return typeof e==`function`&&(t=e()),t.concat($S({type:`raf`}))},devTools:xD.devToolsEnabled&&{serialize:{replacer:oQ},name:`recharts-${t}`}})};function zQ(e){var t=e.preloadedState,n=e.children,r=e.reduxStoreName,i=nT(),a=(0,w.useRef)(null);if(i)return n;a.current??=RQ(t,r);var o=gb;return w.createElement(bE,{context:o,store:a.current},n)}function BQ(e){var t=e.layout,n=e.margin,r=yb(),i=nT();return(0,w.useEffect)(()=>{i||(r(nw(t)),r(tw(n)))},[r,i,t,n]),null}var VQ=(0,w.memo)(BQ,CE);function HQ(e){var t=yb();return(0,w.useEffect)(()=>{t(uQ(e))},[t,e]),null}var UQ=(0,w.memo)(e=>{var t=yb();return(0,w.useEffect)(()=>{t(FQ(e))},[t,e]),null},CE);function WQ(e){var t=e.zIndex,n=e.isPanorama,r=(0,w.useRef)(null),i=yb();return(0,w.useLayoutEffect)(()=>(r.current&&i(iH({zIndex:t,element:r.current,isPanorama:n})),()=>{i(aH({zIndex:t,isPanorama:n}))}),[i,t,n]),w.createElement(`g`,{tabIndex:-1,ref:r,className:`recharts-zIndex-layer_${t}`})}function GQ(e){var t=e.children,n=e.isPanorama,r=K(GV);if(!r||r.length===0)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return w.createElement(w.Fragment,null,i.map(e=>w.createElement(WQ,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>w.createElement(WQ,{key:e,zIndex:e,isPanorama:n})))}var KQ=[`children`];function qQ(e,t){if(e==null)return{};var n,r,i=JQ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=HT(),r=UT(),i=UD();if(!cw(n)||!cw(r))return null;var a=e.children,o=e.otherAttributes,s=e.title,c=e.desc,l,u;return o!=null&&(l=typeof o.tabIndex==`number`?o.tabIndex:i?0:void 0,u=typeof o.role==`string`?o.role:i?`application`:void 0),w.createElement(og,YQ({},o,{title:s,desc:c,role:u,tabIndex:l,width:n,height:r,style:XQ,ref:t}),a)}),QQ=e=>{var t=e.children,n=K(aT);if(!n)return null;var r=n.width,i=n.height,a=n.y,o=n.x;return w.createElement(og,{width:r,height:i,x:o,y:a},t)},$Q=(0,w.forwardRef)((e,t)=>{var n=e.children,r=qQ(e,KQ);return nT()?w.createElement(QQ,null,w.createElement(GQ,{isPanorama:!0},n)):w.createElement(ZQ,YQ({ref:t},r),w.createElement(GQ,{isPanorama:!1},n))});function e$(e,t){return a$(e)||i$(e,t)||n$(e,t)||t$()}function t$(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n$(e,t){if(e){if(typeof e==`string`)return r$(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r$(e,t):void 0}}function r$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{if(n!=null){var t=n.getBoundingClientRect().width/n.offsetWidth;sw(t)&&t!==i&&e(iw(t))}},[n,e,i]),r}function s$(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 c$(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n(UH(),null);function b$(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var x$=(0,w.forwardRef)((e,t)=>{var n=(0,w.useRef)(null),r=p$((0,w.useState)({containerWidth:b$(e.style?.width),containerHeight:b$(e.style?.height)}),2),i=r[0],a=r[1],o=(0,w.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,w.useCallback)(e=>{if(typeof t==`function`&&t(e),n.current!=null&&(n.current.disconnect(),n.current=null),e!=null&&typeof ResizeObserver<`u`){var r=e.getBoundingClientRect(),i=r.width,a=r.height;o(i,a);var s=new ResizeObserver(e=>{var t=e[0];if(t!=null){var n=t.contentRect,r=n.width,i=n.height;o(r,i)}});s.observe(e),n.current=s}},[t,o]);return(0,w.useEffect)(()=>()=>{n.current?.disconnect()},[o]),w.createElement(w.Fragment,null,w.createElement(XT,{width:i.containerWidth,height:i.containerHeight}),w.createElement(`div`,f$({ref:s},e)))}),S$=(0,w.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=p$((0,w.useState)({containerWidth:b$(n),containerHeight:b$(r)}),2),a=i[0],o=i[1],s=(0,w.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),c=(0,w.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var n=e.getBoundingClientRect(),r=n.width,i=n.height;s(r,i)}},[t,s]);return w.createElement(w.Fragment,null,w.createElement(XT,{width:a.containerWidth,height:a.containerHeight}),w.createElement(`div`,f$({ref:c},e)))}),C$=(0,w.forwardRef)((e,t)=>{var n=e.width,r=e.height;return w.createElement(w.Fragment,null,w.createElement(XT,{width:n,height:r}),w.createElement(`div`,f$({ref:t},e)))}),w$=(0,w.forwardRef)((e,t)=>{var n=e.width,r=e.height;return typeof n==`string`||typeof r==`string`?w.createElement(S$,f$({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?w.createElement(C$,f$({},e,{width:n,height:r,ref:t})):w.createElement(w.Fragment,null,w.createElement(XT,{width:n,height:r}),w.createElement(`div`,f$({ref:t},e)))});function T$(e){return e?x$:w$}var E$=(0,w.forwardRef)((e,t)=>{var n=e.children,r=e.className,i=e.height,a=e.onClick,o=e.onContextMenu,s=e.onDoubleClick,c=e.onMouseDown,l=e.onMouseEnter,u=e.onMouseLeave,d=e.onMouseMove,f=e.onMouseUp,p=e.onTouchEnd,m=e.onTouchMove,h=e.onTouchStart,g=e.style,_=e.width,v=e.responsive,y=e.dispatchTouchEvents,b=y===void 0||y,x=(0,w.useRef)(null),S=yb(),C=p$((0,w.useState)(null),2),T=C[0],E=C[1],D=p$((0,w.useState)(null),2),O=D[0],k=D[1],A=o$(),j=IT(),M=j?.width>0?j.width:_,N=j?.height>0?j.height:i,P=(0,w.useCallback)(e=>{A(e),typeof t==`function`&&t(e),E(e),k(e),e!=null&&(x.current=e)},[A,t,E,k]),F=(0,w.useCallback)(e=>{S($Z(e)),S(xQ({handler:a,reactEvent:e}))},[S,a]),ee=(0,w.useCallback)(e=>{S(tQ(e)),S(xQ({handler:l,reactEvent:e}))},[S,l]),te=(0,w.useCallback)(e=>{S($z()),S(xQ({handler:u,reactEvent:e}))},[S,u]),ne=(0,w.useCallback)(e=>{S(tQ(e)),S(xQ({handler:d,reactEvent:e}))},[S,d]),re=(0,w.useCallback)(()=>{S(mQ())},[S]),ie=(0,w.useCallback)(()=>{S(hQ())},[S]),I=(0,w.useCallback)(e=>{S(pQ(e.key))},[S]),ae=(0,w.useCallback)(e=>{S(xQ({handler:o,reactEvent:e}))},[S,o]),oe=(0,w.useCallback)(e=>{S(xQ({handler:s,reactEvent:e}))},[S,s]),se=(0,w.useCallback)(e=>{S(xQ({handler:c,reactEvent:e}))},[S,c]),ce=(0,w.useCallback)(e=>{S(xQ({handler:f,reactEvent:e}))},[S,f]),le=(0,w.useCallback)(e=>{S(xQ({handler:h,reactEvent:e}))},[S,h]),ue=(0,w.useCallback)(e=>{b&&S(DQ(e)),S(xQ({handler:m,reactEvent:e}))},[S,b,m]),de=(0,w.useCallback)(e=>{S(xQ({handler:p,reactEvent:e}))},[S,p]),fe=T$(v);return w.createElement(_H.Provider,{value:T},w.createElement(Jg.Provider,{value:O},w.createElement(fe,{width:M??g?.width,height:N??g?.height,className:L(`recharts-wrapper`,r),style:c$({position:`relative`,cursor:`default`,width:M,height:N},g),onClick:F,onContextMenu:ae,onDoubleClick:oe,onFocus:re,onBlur:ie,onKeyDown:I,onMouseDown:se,onMouseEnter:ee,onMouseLeave:te,onMouseMove:ne,onMouseUp:ce,onTouchEnd:de,onTouchMove:ue,onTouchStart:le,ref:P},w.createElement(y$,null),n)))}),D$=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function O$(e,t){if(e==null)return{};var n,r,i=k$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r{var n=e.width,r=e.height,i=e.responsive,a=e.children,o=e.className,s=e.style,c=e.compact,l=e.title,u=e.desc,d=$h(O$(e,D$));return c?w.createElement(w.Fragment,null,w.createElement(XT,{width:n,height:r}),w.createElement($Q,{otherAttributes:d,title:l,desc:u},a)):w.createElement(E$,{className:o,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},w.createElement($Q,{otherAttributes:d,title:l,desc:u,ref:t},w.createElement(oJ,null,a)))});function j$(){return j$=Object.assign?Object.assign.bind():function(e){for(var t=1;tw.createElement(R$,{chartName:`BarChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:z$,tooltipPayloadSearcher:CH,categoricalChartProps:e,ref:t})),V$={},H$=V(e=>{let t=z(`ChartBrush`,V$,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,attributes:c,...l}=t,u=B({name:`ChartBrush`,classes:qh,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:c});return(0,R.jsx)(Uq,{dy:8,stroke:`var(--chart-grid-color)`,fill:`var(--mantine-color-body)`,...l,...u(`brush`)})});H$.classes=qh,H$.displayName=`@mantine/charts/ChartBrush`;var U$={root:`m_a50f3e58`,container:`m_af9188cb`,grid:`m_a50a48bc`,axis:`m_a507a517`,axisLabel:`m_2293801d`,tooltip:`m_92b296cd`};function W$(e){return`${(e*100).toFixed(0)}%`}var G$={withXAxis:!0,withYAxis:!0,withTooltip:!0,tooltipAnimationDuration:0,fillOpacity:1,tickLine:`y`,strokeDasharray:`5 5`,gridAxis:`x`,type:`default`,accessibilityLayer:!0},K$=qe((e,{textColor:t,gridColor:n,cursorFill:r,barLabelColor:i})=>({root:{"--chart-text-color":t?ft(t,e):void 0,"--chart-grid-color":n?ft(n,e):void 0,"--chart-cursor-fill":r?ft(r,e):void 0,"--chart-bar-label-color":i?ft(i,e):void 0}}));function q$(e,t){let n=0,r=0;return e.map(e=>{if(e.standalone)for(let n in e)typeof e[n]==`number`&&n!==t&&(e[n]=[0,e[n]]);else for(let i in e)typeof e[i]==`number`&&i!==t&&(r+=e[i],e[i]=[n,r],n=r);return e})}function J$(e,t){return typeof e==`function`?e(t).fill:e?.fill}var Y$=V(e=>{let t=z(`BarChart`,G$,e),{classNames:n,className:r,style:i,styles:a,unstyled:o,vars:s,data:c,withLegend:l,legendProps:u,series:d,onMouseLeave:f,dataKey:p,withTooltip:m,withXAxis:h,withYAxis:g,gridAxis:_,tickLine:v,xAxisProps:y,yAxisProps:b,unit:x,tooltipAnimationDuration:S,strokeDasharray:C,gridProps:T,tooltipProps:E,referenceLines:D,fillOpacity:O,barChartProps:k,type:A,orientation:j,dir:M,valueFormatter:N,children:P,barProps:F,xAxisLabel:ee,yAxisLabel:te,withBarValueLabel:ne,valueLabelProps:re,withRightYAxis:ie,rightYAxisLabel:I,rightYAxisProps:ae,minBarSize:oe,maxBarWidth:se,mod:ce,getBarColor:le,gridColor:ue,textColor:de,attributes:fe,accessibilityLayer:pe,withBrush:me,brushProps:he,...ge}=t,_e=Xt(),ve=_!==`none`&&(v===`x`||v===`xy`),ye=_!==`none`&&(v===`y`||v===`xy`),[be,xe]=(0,w.useState)(null),Se=be!==null,Ce=A===`stacked`||A===`percent`,we=A===`percent`?W$:N,Te=e=>{xe(null),f?.(e)},{resolvedClassNames:Ee,resolvedStyles:De}=pn({classNames:n,styles:a,props:t}),Oe=A===`waterfall`?q$(c,p):c,ke=B({name:`BarChart`,classes:U$,props:t,className:r,style:i,classNames:n,styles:a,unstyled:o,attributes:fe,vars:s,varsResolver:K$}),Ae=d.map(e=>{let t=ft(e.color,_e),n=Se&&be!==e.name,r=typeof F==`function`?F(e):F,i=r?.shape;return(0,w.createElement)(pZ,{...ke(`bar`),key:e.name,name:e.name,dataKey:e.name,fill:t,stroke:t,isAnimationActive:!1,fillOpacity:n?.1:O,strokeOpacity:n?.2:0,stackId:Ce?`stack`:e.stackId||void 0,yAxisId:e.yAxisId||void 0,minPointSize:oe,...r,shape:n=>{let r=n.payload,a=r?.color?ft(r.color,_e):typeof le==`function`?ft(le(r?.[e.name],e),_e):J$(F,e)||t,o={...n,fill:a};return typeof i==`function`?i(o):w.isValidElement(i)?w.cloneElement(i,o):typeof i==`object`&&i?(0,R.jsx)(Ok,{...o,...i}):(0,R.jsx)(Ok,{...o})}},ne&&(0,R.jsx)(aG,{position:j===`vertical`?`right`:`top`,fontSize:12,fill:`var(--chart-bar-label-color, var(--mantine-color-dimmed))`,formatter:e=>we?.(e),...typeof re==`function`?re(e):re}))}),je=D?.map((e,t)=>{let n=ft(e.color,_e);return(0,R.jsx)(CJ,{stroke:e.color?n:`var(--chart-grid-color)`,strokeWidth:1,yAxisId:e.yAxisId||void 0,...e,label:{fill:e.color?n:`currentColor`,fontSize:12,position:e.labelPosition??`insideBottomLeft`,...typeof e.label==`object`?e.label:{value:e.label}},...ke(`referenceLine`)},t)}),Me={axisLine:!1,...j===`vertical`?{dataKey:p,type:`category`}:{type:`number`},tickLine:ye?{stroke:`currentColor`}:!1,allowDecimals:!0,unit:x,tickFormatter:j===`vertical`?void 0:we,...ke(`axis`)};return(0,R.jsx)(H,{...ke(`root`),onMouseLeave:Te,dir:M||`ltr`,mod:[{orientation:j},ce],...ge,children:(0,R.jsx)(RT,{...ke(`container`),children:(0,R.jsxs)(B$,{data:Oe,stackOffset:A===`percent`?`expand`:void 0,layout:j,maxBarSize:se,margin:{bottom:ee?30:void 0,left:te?10:void 0,right:te?5:void 0},accessibilityLayer:pe,...k,children:[l&&(0,R.jsx)(QE,{verticalAlign:`top`,content:e=>(0,R.jsx)(Kh,{payload:e.payload,onHighlight:xe,legendPosition:u?.verticalAlign||`top`,classNames:Ee,styles:De,series:d,showColor:A!==`waterfall`,attributes:fe}),...u}),(0,R.jsxs)(PZ,{hide:!h,...j===`vertical`?{type:`number`}:{dataKey:p},tick:{transform:`translate(0, 10)`,fontSize:12,fill:`currentColor`},stroke:``,interval:`preserveStartEnd`,tickLine:ve?{stroke:`currentColor`}:!1,minTickGap:5,tickFormatter:j===`vertical`?we:void 0,...ke(`axis`),...y,children:[ee&&(0,R.jsx)(GW,{position:`insideBottom`,offset:-20,fontSize:12,...ke(`axisLabel`),children:ee}),y?.children]}),(0,R.jsxs)(YZ,{orientation:`left`,tick:{transform:`translate(-10, 0)`,fontSize:12,fill:`currentColor`},hide:!g,...Me,...b,children:[te&&(0,R.jsx)(GW,{position:`insideLeft`,angle:-90,textAnchor:`middle`,fontSize:12,offset:-5,...ke(`axisLabel`),children:te}),b?.children]}),(0,R.jsxs)(YZ,{yAxisId:`right`,orientation:`right`,tick:{transform:`translate(10, 0)`,fontSize:12,fill:`currentColor`},hide:!ie,...Me,...ae,children:[I&&(0,R.jsx)(GW,{position:`insideRight`,angle:90,textAnchor:`middle`,fontSize:12,offset:-5,...ke(`axisLabel`),children:I}),b?.children]}),(0,R.jsx)(KY,{strokeDasharray:C,vertical:_===`y`||_===`xy`,horizontal:_===`x`||_===`xy`,...ke(`grid`),...T}),m&&(0,R.jsx)(sU,{animationDuration:S,isAnimationActive:S!==0,position:j===`vertical`?{}:{y:0},cursor:{stroke:`var(--chart-grid-color)`,strokeWidth:1,strokeDasharray:C,fill:`var(--chart-cursor-fill)`},content:({label:e,payload:t,labelFormatter:n})=>(0,R.jsx)(Hh,{label:n&&t?n(e,t):e,payload:t,type:A===`waterfall`?`scatter`:void 0,unit:x,classNames:Ee,styles:De,series:d,valueFormatter:N,attributes:fe}),...E}),Ae,je,me&&(0,R.jsx)(H$,{dataKey:p,classNames:Ee,styles:De,...he}),P]})})})});Y$.displayName=`@mantine/charts/BarChart`,Y$.classes=U$,Y$.varsResolver=K$;function X$(e){return e==null?`—`:new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e)}function Z$(e){return e?new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,timeZone:`America/Los_Angeles`,timeZoneName:`short`}).format(new Date(e)):`—`}function Q$(e){if(e==null)return`—`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t?`${t}d ${n}h ${r}m`:`${n}h ${r}m`}function $$(e){if(!e)return`gray`;let t=e.toUpperCase();return[`RUNNING`,`UP`].includes(t)?`blue`:[`SUCCEEDED`,`FINISHED`].includes(t)?`green`:t.startsWith(`FAILED`)||[`CRASHED`,`CANCELLED`].includes(t)?`red`:[`RECOVERING`,`AUTOSTOPPING`,`STARTING`,`INIT`,`PENDING`].includes(t)?`yellow`:`gray`}function e1(e){return e===`ok`?`green`:e===`warning`?`yellow`:e===`error`?`red`:e===`pending`?`blue`:`gray`}function t1({warnings:e}){return e.length?(0,R.jsx)(Dm,{gap:`xs`,children:e.map(e=>(0,R.jsx)(nd,{color:`yellow`,icon:(0,R.jsx)(bh,{size:18}),children:e},e))}):null}function n1({label:e,value:t,detail:n}){return(0,R.jsxs)(Vf,{withBorder:!0,className:`hud-stat`,children:[(0,R.jsx)(U,{c:`dimmed`,size:`xs`,tt:`uppercase`,fw:700,children:e}),(0,R.jsx)(U,{fw:800,mt:4,className:`hud-stat-value`,children:t}),n&&(0,R.jsx)(U,{c:`dimmed`,size:`xs`,mt:2,children:n})]})}function r1({report:e}){let t=e.billing,n=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`}),r=t.category_daily.map(e=>({date:n.format(new Date(`${e.date}T00:00:00Z`)),aws_compute:e.aws_compute??0,aws_storage:e.aws_storage??0,aws_everything_else:e.aws_everything_else??0,gcp_compute:e.gcp_compute??0,gcp_storage:e.gcp_storage??0,gcp_everything_else:e.gcp_everything_else??0}));return(0,R.jsxs)(Dm,{gap:`lg`,children:[(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:1,children:`Cloud billing`}),(0,R.jsxs)(U,{c:`dimmed`,children:[t.start_date,` through `,t.end_date,` · daily net spend in USD`]})]}),(0,R.jsx)(t1,{warnings:t.warnings}),!t.gcp_configured&&(0,R.jsxs)(nd,{color:`blue`,icon:(0,R.jsx)(Ah,{size:18}),children:[`Set `,(0,R.jsx)(qf,{children:`GCP_BILLING_EXPORT_TABLE`}),` to load per-project GCP billing lines.`]}),(0,R.jsxs)(Cm,{cols:{base:1,sm:3},children:[(0,R.jsx)(n1,{label:`AWS · 30 days`,value:X$(t.totals.aws),detail:t.totals.aws==null?`Unavailable`:`Net unblended cost`}),(0,R.jsx)(n1,{label:`GCP · 30 days`,value:X$(t.totals.gcp),detail:t.totals.gcp==null?`Unavailable`:`Cost after credits`}),(0,R.jsx)(n1,{label:`Combined · 30 days`,value:X$(t.totals.combined),detail:`Available providers`})]}),(0,R.jsxs)(Vf,{withBorder:!0,padding:`lg`,children:[(0,R.jsxs)(H,{mb:`lg`,children:[(0,R.jsx)(nh,{order:3,children:`Daily spend`}),(0,R.jsx)(U,{c:`dimmed`,size:`sm`,children:`Stacked by cloud and major category · recent days may be provisional`})]}),(0,R.jsx)(Y$,{h:420,data:r,dataKey:`date`,type:`stacked`,series:[{name:`aws_compute`,label:`AWS · compute`,color:`orange.7`},{name:`aws_storage`,label:`AWS · storage`,color:`orange.4`},{name:`aws_everything_else`,label:`AWS · other`,color:`yellow.4`},{name:`gcp_compute`,label:`GCP · compute`,color:`blue.7`},{name:`gcp_storage`,label:`GCP · storage`,color:`blue.4`},{name:`gcp_everything_else`,label:`GCP · other`,color:`cyan.4`}],valueFormatter:e=>X$(e),withLegend:!0,yAxisProps:{width:72}})]})]})}var i1=0,a1=1,o1=2,s1=4;function c1(e){return()=>e}function l1(e){e()}function u1(e,t){return n=>e(t(n))}function d1(e,t){return()=>e(t)}function f1(e,t){return n=>e(t,n)}function p1(e){return e!==void 0}function m1(...e){return()=>{e.map(l1)}}function h1(){}function g1(e,t){return t(e),e}function _1(e,t){return t(e)}function v1(...e){return e}function y1(e,t){return e(a1,t)}function b1(e,t){e(i1,t)}function x1(e){e(o1)}function S1(e){return e(s1)}function J(e,t){return y1(e,f1(t,i1))}function C1(e,t){let n=e(a1,e=>{n(),t(e)});return n}function w1(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function T1(e,t){return e===t}function E1(e=T1){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Y(e){return t=>n=>{e(n)&&t(n)}}function X(e){return t=>u1(t,e)}function D1(e){return t=>()=>{t(e)}}function Z(e,...t){let n=M1(...t);return((t,r)=>{switch(t){case o1:x1(e);return;case a1:return y1(e,n(r))}})}function O1(e,t){return n=>r=>{n(t=e(t,r))}}function k1(e){return t=>n=>{e>0?e--:t(n)}}function A1(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function j1(...e){let t=Array.from({length:e.length}),n=0,r=null,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;y1(e,e=>{let s=n;n|=o,t[a]=e,s!==i&&n===i&&r&&(r(),r=null)})}),e=>a=>{let o=()=>{e([a].concat(t))};n===i?o():r=o}}function M1(...e){return t=>e.reduceRight(_1,t)}function N1(e){let t,n,r=()=>t?.();return function(i,a){switch(i){case a1:return a?n===a?void 0:(r(),n=a,t=y1(e,a),t):(r(),h1);case o1:r(),n=null;return}}}function Q(e){let t=e,n=F1();return((e,r)=>{switch(e){case i1:t=r;break;case a1:r(t);break;case s1:return t}return n(e,r)})}function P1(e,t){return g1(Q(t),t=>J(e,t))}function F1(){let e=[];return((t,n)=>{switch(t){case i1:e.slice().forEach(e=>{e(n)});return;case o1:e.splice(0);return;case a1:return e.push(n),()=>{let t=e.indexOf(n);t>-1&&e.splice(t,1)}}})}function I1(e){return g1(F1(),t=>J(e,t))}var L1={singleton:!0};function R1(e,t=[],n=L1){let{singleton:r}=n;return{constructor:e,dependencies:t,id:z1(),singleton:r}}var z1=()=>Symbol(`id`);function B1(e){let t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:a})=>{if(a&&t.has(i))return t.get(i);let o=e(r.map(e=>n(e)));return a&&t.set(i,o),o};return n(e)}function V1(...e){let t=F1(),n=Array.from({length:e.length}),r=0,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;y1(e,e=>{n[a]=e,r|=o,r===i&&b1(t,n)})}),function(e,a){switch(e){case o1:x1(t);return;case a1:return r===i&&a(n),y1(t,a)}}}function $(e,t=T1){return Z(e,E1(t))}function H1(...e){return function(t,n){switch(t){case o1:return;case a1:return m1(...e.map(e=>y1(e,n)))}}}var U1={DEBUG:0,INFO:1,WARN:2,ERROR:3},W1={[U1.DEBUG]:`debug`,[U1.ERROR]:`error`,[U1.INFO]:`log`,[U1.WARN]:`warn`},G1=()=>typeof globalThis>`u`?window:globalThis,K1=R1(()=>{let e=Q(U1.ERROR);return{log:Q((t,n,r=U1.INFO)=>{r>=(G1().VIRTUOSO_LOG_LEVEL??S1(e))&&console[W1[r]](`%creact-virtuoso: %c%s %o`,`color: #0253b3; font-weight: bold`,`color: initial`,t,n)}),logLevel:e}},[],{singleton:!0});function q1(e){return`self`in e?e.document.documentElement:e}function J1(e){let t=q1(e);return t.ownerDocument.defaultView.getComputedStyle(t).direction===`rtl`}function Y1(e,t){return J1(e)?-t:t}function X1(e,t){return J1(e)?-t:t}function Z1(e,t,n){return Q1(e,t,n).callbackRef}function Q1(e,t,n){let r=w.useRef(null),i=e=>{},a=w.useMemo(()=>typeof ResizeObserver<`u`?new ResizeObserver(t=>{let r=()=>{let n=t[0].target;n.offsetParent!==null&&e(n)};n?r():requestAnimationFrame(r)}):null,[e,n]);return i=e=>{e&&t?(a?.observe(e),r.current=e):(r.current&&a?.unobserve(r.current),r.current=null)},{callbackRef:i,ref:r}}function $1(e,t,n,r,i,a,o,s,c){return Q1(w.useCallback(n=>{let c=e0(n.children,t,s?`offsetWidth`:`offsetHeight`,i),l=n.parentElement;for(;l.dataset.virtuosoScroller===void 0;)l=l.parentElement;let u=l.lastElementChild?.dataset.viewportType===`window`,d;u&&(d=l.ownerDocument.defaultView);let f=o?s?o.scrollWidth:o.scrollHeight:u?s?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight:s?l.scrollWidth:l.scrollHeight,p=o?s?o.offsetWidth:o.offsetHeight:u?s?d.innerWidth:d.innerHeight:s?l.offsetWidth:l.offsetHeight,m=o?s?Y1(o,o.scrollLeft):o.scrollTop:u?s?Y1(d,d.scrollX||d.document.documentElement.scrollLeft):d.scrollY||d.document.documentElement.scrollTop:s?Y1(l,l.scrollLeft):l.scrollTop;r({scrollHeight:f,scrollTop:Math.max(m,0),viewportHeight:p}),a?.(s?t0(`column-gap`,getComputedStyle(n).columnGap,i):t0(`row-gap`,getComputedStyle(n).rowGap,i)),c!==null&&e(c)},[e,t,i,a,o,r,s]),n,c)}function e0(e,t,n,r){let i=e.length;if(i===0)return null;let a=[];for(let o=0;o{if(!n?.offsetParent)return;let i=n.getBoundingClientRect(),a=i.width,s,c;if(t){let e=t.getBoundingClientRect(),n=i.top-e.top;c=e.height-Math.max(0,n),s=n+t.scrollTop}else{let e=o.current.ownerDocument.defaultView;c=e.innerHeight-Math.max(0,i.top),s=i.top+e.scrollY}r.current={listHeight:i.height,offsetTop:s,visibleHeight:c,visibleWidth:a},e(r.current)},[e,t]),{callbackRef:a,ref:o}=Q1(i,!0,n),s=w.useCallback(()=>{i(o.current)},[i,o]);return w.useEffect(()=>{if(t){t.addEventListener(`scroll`,s);let e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener(`scroll`,s),e.unobserve(t)}}let e=o.current?.ownerDocument.defaultView;return e?.addEventListener(`scroll`,s),e?.addEventListener(`resize`,s),()=>{e?.removeEventListener(`scroll`,s),e?.removeEventListener(`resize`,s)}},[s,t,o]),a}var r0=R1(()=>{let e=F1(),t=F1(),n=Q(0),r=F1(),i=Q(0),a=F1(),o=F1(),s=Q(0),c=Q(0),l=Q(0),u=Q(0),d=F1(),f=F1(),p=Q(!1),m=Q(!1),h=Q(!1);return J(Z(e,X(({scrollTop:e})=>e)),t),J(Z(e,X(({scrollHeight:e})=>e)),o),J(t,i),{deviation:n,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:u,headerHeight:s,horizontalDirection:m,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:p,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:h,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:a}},[],{singleton:!0}),i0={lvl:0};function a0(e,t){let n=e.length;if(n===0)return[];let{index:r,value:i}=t(e[0]),a=[];for(let o=1;ot&&(s=s.concat(m0(i,t,n))),r>=t&&r<=n&&s.push({k:r,v:o}),r<=n&&(s=s.concat(m0(a,t,n))),s}function h0(e){let{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(v0(t))return S0(g0(e,{lvl:n-1}));if(!o0(t)&&!o0(t.r))return g0(t.r,{l:g0(t,{r:t.r.l}),lvl:n,r:g0(e,{l:t.r.r,lvl:n-1})});throw Error(`Unexpected empty nodes`)}if(v0(e))return C0(g0(e,{lvl:n-1}));if(!o0(r)&&!o0(r.l)){let t=r.l,i=v0(t)?r.lvl-1:r.lvl;return g0(t,{l:g0(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:C0(g0(r,{l:t.r,lvl:i}))})}throw Error(`Unexpected empty nodes`)}function g0(e,t){return b0(t.k===void 0?e.k:t.k,t.v===void 0?e.v:t.v,t.lvl===void 0?e.lvl:t.lvl,t.l===void 0?e.l:t.l,t.r===void 0?e.r:t.r)}function _0(e){return o0(e.r)?e.l:h0(g0(e,{r:_0(e.r)}))}function v0(e){return o0(e)||e.lvl>e.r.lvl}function y0(e){return o0(e.r)?[e.k,e.v]:y0(e.r)}function b0(e,t,n,r=i0,i=i0){return{k:e,l:r,lvl:n,r:i,v:t}}function x0(e){return C0(S0(e))}function S0(e){let{l:t}=e;return!o0(t)&&t.lvl===e.lvl?g0(t,{r:g0(e,{l:t.r})}):e}function C0(e){let{lvl:t,r:n}=e;return!o0(n)&&!o0(n.r)&&n.lvl===t&&n.r.lvl===t?g0(n,{l:g0(e,{r:n.l}),lvl:t+1}):e}function w0(e){return a0(e,({k:e,v:t})=>({index:e,value:t}))}function T0(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function E0(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}var D0=R1(()=>({recalcInProgress:Q(!1)}),[],{singleton:!0});function O0(e,t,n){return e[k0(e,t,n)]}function k0(e,t,n,r=0){let i=e.length-1;for(;r<=i;){let a=Math.floor((r+i)/2),o=e[a],s=n(o,t);if(s===0)return a;if(s===-1){if(i-r<2)return a-1;i=a-1}else{if(i===r)return a;r=a+1}}throw Error(`Failed binary finding record in array - ${e.join(`,`)}, searched for ${t}`)}function A0(e,t,n,r){let i=k0(e,t,r),a=k0(e,n,r,i);return e.slice(i,a+1)}function j0(e,t){return Math.round(e.getBoundingClientRect()[t])}function M0(e){return!o0(e.groupOffsetTree)}function N0({index:e},t){return t===e?0:t=r||i===a)&&(e=f0(e,r)):(c=a!==i,s=!0),n>t&&t>=r&&a!==i&&(e=l0(e,t+1,a));c&&(e=l0(e,a,i))}return[e,n]}function I0(e){return e.groupIndex!==void 0}function L0({offset:e},t){return t===e?0:t0?s+n:s}function z0(e,t){if(!M0(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function B0(e,t,n){if(I0(e))return t.groupIndices[e.groupIndex]+1;let r=z0(e.index===`LAST`?n:e.index,t);return r=Math.max(0,Math.min(n,r)),r}function V0(e,t,n,r=0){return r>0&&(t=Math.max(t,O0(e,r,N0).offset)),a0(A0(e,t,n,L0),K0)}function H0(e,[t,n,r,i]){t.length>0&&r(`received item sizes`,t,U1.DEBUG);let a=e.sizeTree,o=a,s=0;if(n.length>0&&o0(a)&&t.length===2){let e=t[0].size,r=t[1].size;o=n.reduce((t,n)=>l0(l0(t,n,e),n+1,r),o)}else[o,s]=F0(o,t);if(o===a)return e;let{lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d}=G0(e.offsetTree,s,o,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>l0(e,t,R0(t,d,i)),u0()),lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d,sizeTree:o}}function U0(e){return p0(e).map(({k:e,v:t},n,r)=>{let i=r[n+1];return{endIndex:i===void 0?1/0:i.k-1,size:t,startIndex:e}})}function W0(e,t){let n=0,r=0;for(;ne.start===r&&(e.end===t||e.end===1/0)&&e.value===n}var J0={offsetHeight:`height`,offsetWidth:`width`},Y0=R1(([{log:e},{recalcInProgress:t}])=>{let n=F1(),r=F1(),i=P1(r,0),a=F1(),o=F1(),s=Q(0),c=Q([]),l=Q(void 0),u=Q(void 0),d=Q(void 0),f=Q(void 0),p=Q((e,t)=>j0(e,J0[t])),m=Q(void 0),h=Q(0),g=P0(),_=P1(Z(n,j1(c,e,h),O1(H0,g),E1()),g),v=P1(Z(c,E1(),O1((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),X(({prev:e})=>e)),[]);J(Z(c,Y(e=>e.length>0),j1(_,h),X(([e,t,n])=>{let r=e.reduce((e,r,i)=>l0(e,r,R0(r,t.offsetTree,n)||i),u0());return{...t,groupIndices:e,groupOffsetTree:r}})),_),J(Z(r,j1(_),Y(([e,{lastIndex:t}])=>e[{endIndex:t,size:n,startIndex:e}])),n),J(l,u);let y=P1(Z(l,X(e=>e===void 0)),!0);J(Z(u,Y(e=>e!==void 0&&o0(S1(_).sizeTree)),X(e=>{let t=S1(d),n=S1(c).length>0;return t!==void 0&&t!==0?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),J(Z(f,Y(e=>e!==void 0&&e.length>0&&o0(S1(_).sizeTree)),X(e=>{let t=[],n=e[0],r=0;for(let i=1;ie!==void 0&&t!==void 0),X(([e,t,n])=>{let r=[];for(let i=0;i({changed:n!==e,sizes:n}),{changed:!1,sizes:g}),X(e=>e.changed)));y1(Z(s,O1((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),X(e=>e.diff)),e=>{let{groupIndices:n}=S1(_);if(e>0)b1(t,!0),b1(a,e+W0(e,n));else if(e<0){let t=S1(v);t.length>0&&(e-=W0(-e,t)),b1(o,e)}}),y1(Z(s,j1(e)),([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},U1.ERROR)});let x=I1(a);J(Z(a,j1(_),X(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=s0(t.sizeTree,0),a=0,o=0;for(;a{let i=t.ranges;return t.prevSize!==0&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return p0(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);let S=I1(Z(o,j1(_,h),X(([e,{offsetTree:t},n])=>R0(-e,t,n))));return J(Z(o,j1(_,h),X(([e,t,n])=>{if(t.groupIndices.length>0){if(o0(t.sizeTree))return t;let r=u0(),i=S1(v),a=0,o=0,s=0;for(;a<-e;){s=i[o];let e=i[o+1]-s-1;o++,a+=e+1}if(r=p0(t.sizeTree).reduce((t,{k:n,v:r})=>l0(t,Math.max(0,n+e),r),r),a!==-e){let n=s0(t.sizeTree,s);r=l0(r,0,n);let i=c0(t.sizeTree,-e+1)[1];r=l0(r,1,i)}return{...t,sizeTree:r,...G0(t.offsetTree,0,r,n)}}let r=p0(t.sizeTree).reduce((t,{k:n,v:r})=>l0(t,Math.max(0,n+e),r),u0());return{...t,sizeTree:r,...G0(t.offsetTree,0,r,n)}})),_),{beforeUnshiftWith:x,data:m,defaultItemSize:u,firstItemIndex:s,fixedItemSize:l,fixedGroupSize:d,gap:h,groupIndices:c,heightEstimates:f,itemSize:p,listRefresh:b,shiftWith:o,shiftWithOffset:S,sizeRanges:n,sizes:_,statefulTotalCount:i,totalCount:r,trackItemSizes:y,unshiftWith:a}},v1(K1,D0),{singleton:!0});function X0(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}var Z0=R1(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let a=F1(),o=F1(),s=I1(Z(a,X(X0)));return J(Z(s,X(e=>e.totalCount)),n),J(Z(s,X(e=>e.groupIndices)),e),J(Z(V1(i,t,r),Y(([e,t])=>M0(t)),X(([e,t,n])=>c0(t.groupOffsetTree,Math.max(e-n,0),`v`)[0]),E1(),X(e=>[e])),o),{groupCounts:a,topItemsIndexes:o}},v1(Y0,r0)),Q0=R1(([{log:e}])=>{let t=Q(!1),n=I1(Z(t,Y(e=>e),E1()));return y1(t,t=>{t&&S1(e)(`props updated`,{},U1.DEBUG)}),{didMount:n,propsReady:t}},v1(K1),{singleton:!0}),$0=typeof document<`u`&&`scrollBehavior`in document.documentElement.style;function e2(e){let t=typeof e==`number`?{index:e}:{...e};return t.align||=`start`,(!t.behavior||!$0)&&(t.behavior=`auto`),t.offset===void 0&&(t.offset=0),t}var t2=R1(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:a,footerHeight:o,headerHeight:s,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:u,viewportHeight:d},{log:f}])=>{let p=F1(),m=F1(),h=Q(0),g=null,_=null,v=null;function y(){g!==null&&(g(),g=null),v!==null&&(v(),v=null),_&&=(clearTimeout(_),null),b1(c,!1)}return J(Z(p,j1(n,d,r,h,s,o,f),j1(e,a,i),X(([[e,n,r,i,a,o,s,l],d,f,h])=>{let b=e2(e),{align:x,behavior:S,offset:C}=b,w=i-1,T=B0(b,n,w),E=R0(T,n.offsetTree,d)+o;x===`end`?(E+=f+c0(n.sizeTree,T)[1]-r+h,T===w&&(E+=s)):x===`center`?E+=(f+c0(n.sizeTree,T)[1]-r+h)/2:E-=a,C!==void 0&&C!==0&&(E+=C);let D=t=>{y(),t?(l(`retrying to scroll to`,{location:e},U1.DEBUG),b1(p,e)):(b1(m,!0),l(`list did not change, scroll successful`,{},U1.DEBUG))};if(y(),S===`smooth`){let e=!1;v=y1(t,t=>{e||=t}),g=C1(u,()=>{D(e)})}else g=C1(Z(t,n2(150)),D);return _=setTimeout(()=>{y()},1200),b1(c,!0),l(`scrolling from index to`,{behavior:S,index:T,top:E},U1.DEBUG),{behavior:S,top:E}})),l),{scrollTargetReached:m,scrollToIndex:p,topListHeight:h}},v1(Y0,r0,K1),{singleton:!0});function n2(e){return t=>{let n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}function r2(e,t){e===0?t():requestAnimationFrame(()=>{r2(e-1,t)})}function i2(e,t){if(e===void 0)return 0;let n=t-1,r=typeof e==`number`?e:e.index===`LAST`?n:e.index;return Math.max(0,Math.min(r,n))}function a2(e){return e===void 0?!0:typeof e==`number`?e===0:e.index===0&&(e.align===void 0||e.align===`start`)&&(e.offset===void 0||e.offset===0)}var o2=R1(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:a},{didMount:o}])=>{let s=Q(!0),c=Q(0),l=Q(!0);return J(Z(o,j1(c),Y(([e,t])=>!a2(t)),D1(!1)),s),J(Z(o,j1(c),Y(([e,t])=>!a2(t)),D1(!1)),l),y1(Z(V1(t,o),j1(s,n,e,l),Y(([[,e],t,{sizeTree:n},r,i])=>e&&(!o0(n)||p1(r))&&!t&&!i),j1(c)),([,e])=>{if(e===void 0){b1(s,!0),b1(l,!0);return}C1(i,()=>{b1(l,!0)}),r2(4,()=>{C1(r,()=>{b1(s,!0)}),b1(a,e)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:s}},v1(Y0,r0,t2,Q0),{singleton:!0});function s2(e,t){return Math.abs(e-t)<1.01}var c2=`up`,l2=`down`,u2=`none`,d2={atBottom:!1,notAtBottomBecause:`NOT_SHOWING_LAST_ITEM`,state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},f2=0,p2=R1(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:a}])=>{let o=Q(!1),s=Q(!0),c=F1(),l=F1(),u=Q(4),d=Q(f2),f=P1(Z(H1(Z($(i),k1(1),D1(!0)),Z($(i),k1(1),D1(!1),w1(100))),E1()),!1),p=P1(Z(H1(Z(n,D1(!0)),Z(n,D1(!1),w1(200))),E1()),!1);J(Z(V1($(i),$(d)),X(([e,t])=>e<=t),E1()),s),J(Z(s,A1(50)),l);let m=I1(Z(V1(r,$(a),$(t),$(e),$(u)),O1((e,[{scrollHeight:t,scrollTop:n},r,i,a,o])=>{let s=n+r-t>-o,c={scrollHeight:t,scrollTop:n,viewportHeight:r};if(s){let t,r;return n>e.state.scrollTop?(t=`SCROLLED_DOWN`,r=e.state.scrollTop-n):(t=`SIZE_DECREASED`,r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:c}}let l;return l=c.scrollHeight>e.state.scrollHeight?`SIZE_INCREASED`:re!==void 0&&e.atBottom===t.atBottom))),h=P1(Z(r,O1((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!s2(e.scrollHeight,t)){let i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Y(e=>e.changed),X(e=>e.jump)),0);J(Z(m,X(e=>e.atBottom)),o),J(Z(o,A1(50)),c);let g=Q(l2);J(Z(r,X(({scrollTop:e})=>e),E1(),O1((e,t)=>S1(p)?{direction:e.direction,prevScrollTop:t}:{direction:te.direction)),g),J(Z(r,A1(50),D1(u2)),g);let _=Q(0);return J(Z(f,Y(e=>!e),D1(0)),_),J(Z(i,A1(100),j1(f),Y(([e,t])=>t),O1(([e,t],[n])=>[t,n],[0,0]),X(([e,t])=>t-e)),_),{atBottomState:m,atBottomStateChange:c,atBottomThreshold:u,atTopStateChange:l,atTopThreshold:d,isAtBottom:o,isAtTop:s,isScrolling:f,lastJumpDueToItemResize:h,scrollDirection:g,scrollVelocity:_}},v1(r0)),m2=`top`,h2=`bottom`,g2=`none`;function _2(e,t,n){return typeof e==`number`?n===c2&&t===m2||n===l2&&t===h2?e:0:n===c2?t===m2?e.main:e.reverse:t===h2?e.main:e.reverse}function v2(e,t){return typeof e==`number`?e:e[t]??0}var y2=R1(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let a=F1(),o=Q(0),s=Q(0),c=Q(0);return{increaseViewportBy:s,listBoundary:a,overscan:c,topListHeight:o,visibleRange:P1(Z(V1($(r),$(i),$(n),$(a,E0),$(c),$(o),$(t),$(e),$(s)),X(([e,t,n,[r,i],a,o,s,c,l])=>{let u=e-c,d=o+s,f=Math.max(n-u,0),p=g2,m=v2(l,m2),h=v2(l,h2);return r-=c,r+=n+s,i+=n+s,i-=c,r>e+d-m&&(p=c2),ie!==null),E1(E0)),[0,0])}},v1(r0),{singleton:!0});function b2(e,t,n){if(M0(t)){let r=z0(e,t);return[{index:c0(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}var x2={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function S2(e,t,n,r,i,a){let{lastIndex:o,lastOffset:s,lastSize:c}=i,l=0,u=0;if(e.length>0){l=e[0].offset;let t=e[e.length-1];u=t.offset+t.size}let d=n-o,f=s+d*c+(d-1)*r,p=l,m=f-u;return{bottom:u,firstItemIndex:a,items:w2(e,i,a),offsetBottom:m,offsetTop:l,top:p,topItems:w2(t,i,a),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function C2(e,t,n,r,i,a){let o=0;if(n.groupIndices.length>0)for(let t of n.groupIndices){if(t-o>=e)break;o++}let s=e+o,c=i2(t,s);return S2(Array.from({length:s}).map((e,t)=>({data:a[t+c],index:t+c,offset:0,size:0})),[],s,i,n,r)}function w2(e,t,n){if(e.length===0)return[];if(!M0(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));let r=e[0].index,i=e[e.length-1].index,a=[],o=d0(t.groupOffsetTree,r,i),s,c=0;for(let r of e){(!s||s.end{let h=Q([]),g=Q(0),_=F1(),v=Q(0);J(a.topItemsIndexes,h);let y=P1(Z(V1(p,m,$(c,E0),$(i),$(r),$(l),u,$(h),$(t),$(n),$(v),e),Y(([e,t,,n,,,,,,,,r])=>{let i=r!==void 0&&r.length!==n;return e&&!t&&!i}),X(([,,[e,t],n,r,i,a,o,s,c,l,u])=>{let d=r,{offsetTree:f,sizeTree:p}=d,m=S1(g);if(n===0)return{...x2,totalCount:n};if(e===0&&t===0)return m===0?{...x2,totalCount:n}:C2(m,i,r,s,c,u||[]);if(o0(p))return m>0?null:S2(b2(i2(i,n),d,u),[],n,c,d,s);let h=[];if(o.length>0){let e=o[0],t=o[o.length-1],n=0;for(let r of d0(p,e,t)){let i=r.value,a=Math.max(r.start,e),o=Math.min(r.end,t);for(let e=a;e<=o;e++)h.push({data:u?.[e],index:e,offset:n,size:i}),n+=i}}if(!a)return S2([],h,n,c,d,s);let _=o.length>0?o[o.length-1]+1:0,v=V0(f,e,t,_);if(v.length===0)return null;let y=n-1,b=g1([],n=>{for(let r of v){let i=r.value,a=i.offset,o=r.start,s=i.size;if(i.offset=t);e++)n.push({data:u?.[e],index:e,offset:a,size:s}),a+=s+c}}),x=T2(l,m2),S=T2(l,h2);if(b.length>0&&(x>0||S>0)){let e=b[0],t=b[b.length-1];if(x>0&&e.index>_){let t=Math.min(x,e.index-_),n=[],r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){let t=d0(p,i,i)[0]?.value??e.size;r-=t+c,n.unshift({data:u?.[i],index:i,offset:r,size:t})}b.unshift(...n)}if(S>0&&t.indexe!==null),E1()),x2);J(Z(e,Y(p1),X(e=>e?.length)),i),J(Z(y,X(e=>e.topListHeight)),d),J(d,s),J(Z(y,X(e=>[e.top,e.bottom])),o),J(Z(y,X(e=>e.items)),_);let b=I1(Z(y,Y(({items:e})=>e.length>0),j1(i,e),Y(([{items:e},t])=>e[e.length-1].originalIndex===t-1),X(([,e,t])=>[e-1,t]),E1(E0),X(([e])=>e))),x=I1(Z(y,A1(200),Y(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),X(({items:e})=>e[0].index),E1()));return{endReached:b,initialItemCount:g,itemsRendered:_,listState:y,minOverscanItemCount:v,rangeChanged:I1(Z(y,Y(({items:e})=>e.length>0),X(({items:e})=>{let t=0,n=e.length-1;for(;e[t].type===`group`&&tt;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),E1(T0))),startReached:x,topItemsIndexes:h,...f}},v1(Y0,Z0,y2,o2,t2,p2,Q0,D0),{singleton:!0}),D2=R1(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let a=F1(),o=P1(Z(V1(n,e,r,t,i),X(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return J($(o),a),{totalListHeight:o,totalListHeightChanged:a}},v1(r0,E2),{singleton:!0}),O2=R1(([{viewportHeight:e},{totalListHeight:t}])=>{let n=Q(!1);return{alignToBottom:n,paddingTopAddition:P1(Z(V1(n,e,t),Y(([e])=>e),X(([,e,t])=>Math.max(0,e-t)),A1(0),E1()),0)}},v1(r0,D2),{singleton:!0}),k2=R1(()=>({context:Q(null)})),A2=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:a,viewportTop:o})=>ta?{...i,align:n??`end`,...r===void 0?{}:{behavior:r}}:null,j2=R1(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:a,scrollingInProgress:o,scrollTop:s,viewportHeight:c},{scrollToIndex:l}])=>{let u=F1();return J(Z(u,j1(t,c,n,a,i,r,s),j1(e),X(([[e,t,n,r,i,a,s,c],l])=>{let{calculateViewLocation:u=A2,done:d,...f}=e,p=B0(e,t,r-1),m=R0(p,t.offsetTree,l)+i+a,h=m+c0(t.sizeTree,p)[1],g=c+a,_=u({itemBottom:h,itemTop:m,locationParams:f,viewportBottom:c+n-s,viewportTop:g});return _===null?d?.():d&&C1(Z(o,Y(e=>!e),k1(S1(o)?1:2)),d),_}),Y(e=>e!==null)),l),{scrollIntoView:u}},v1(Y0,r0,t2,E2,K1),{singleton:!0});function M2(e){return e===!1?!1:e===`smooth`?`smooth`:`auto`}var N2=(e,t)=>typeof e==`function`?M2(e(t)):t&&M2(e),P2=R1(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:s},{didMount:c,propsReady:l},{log:u},{scrollingInProgress:d},{context:f},{scrollIntoView:p}])=>{let m=Q(!1),h=F1(),g=null;function _(e){b1(o,{align:`end`,behavior:e,index:`LAST`})}y1(Z(V1(Z($(t),k1(1)),c),j1($(m),a,s,d),X(([[e,t],n,r,i,a])=>{let o=t&&i,s=`auto`;return o&&(s=N2(n,r||a),o&&=s!==!1),{followOutputBehavior:s,shouldFollow:o,totalCount:e}}),Y(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{g!==null&&(g(),g=null),S1(n)===void 0?g=C1(e,()=>{S1(u)(`following output to `,{totalCount:r},U1.DEBUG),_(t),g=null}):requestAnimationFrame(()=>{S1(u)(`following output to `,{totalCount:r},U1.DEBUG),_(t)})});function v(e){let t=C1(i,t=>{e&&!t.atBottom&&t.notAtBottomBecause===`SIZE_INCREASED`&&g===null&&(S1(u)(`scrolling to bottom due to increased size`,{},U1.DEBUG),_(`auto`))});setTimeout(t,100)}y1(Z(V1($(m),t,l),Y(([e,,t])=>e!==!1&&t),O1(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),Y(({refreshed:e})=>e),j1(m,t)),([,e])=>{S1(s)&&v(e!==!1)}),y1(h,()=>{v(S1(m)!==!1)}),y1(V1($(m),i),([e,t])=>{e!==!1&&!t.atBottom&&t.notAtBottomBecause===`VIEWPORT_HEIGHT_DECREASING`&&_(`auto`)});let y=Q(null),b=F1();return J(H1(Z($(r),X(e=>e?.length??0)),Z($(t))),b),y1(Z(V1(Z(b,k1(1)),c),j1($(y),s,d,f),X(([[e,t],n,r,i,a])=>t&&r&&n?.({context:a,totalCount:e,scrollingInProgress:i})),Y(e=>!!e),A1(0)),t=>{g!==null&&(g(),g=null),S1(n)===void 0?g=C1(e,()=>{S1(u)(`scrolling into view`,{}),b1(p,t),g=null}):requestAnimationFrame(()=>{S1(u)(`scrolling into view`,{}),b1(p,t)})}),{autoscrollToBottom:h,followOutput:m,scrollIntoViewOnChange:y}},v1(Y0,p2,t2,o2,Q0,K1,r0,k2,j2)),F2=R1(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:a,listState:o},{didMount:s}])=>(J(Z(s,j1(a),Y(([,e])=>e!==0),j1(i,r,t,n,e),X(([[,e],t,n,r,i,a=[]])=>C2(e,t,n,r,i,a))),o),{}),v1(Y0,o2,E2,Q0),{singleton:!0}),I2=R1(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=Q(0);return y1(Z(e,j1(r),Y(([,e])=>e!==0),X(([,e])=>({top:e}))),e=>{C1(Z(n,k1(1),Y(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{b1(t,e)})})}),{initialScrollTop:r}},v1(Q0,r0,E2),{singleton:!0}),L2=R1(([{scrollVelocity:e}])=>{let t=Q(!1),n=F1(),r=Q(!1);return J(Z(e,j1(r,t,n),Y(([e,t])=>t!==!1&&t!==void 0),X(([e,t,n,r])=>{let{enter:i,exit:a}=t;if(n){if(a(e,r))return!1}else if(i(e,r))return!0;return n}),E1()),t),y1(Z(V1(t,e,n),j1(r)),([[e,t,n],r])=>{e&&r!==!1&&r!==void 0&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},v1(p2),{singleton:!0}),R2=R1(([{scrollContainerState:e,scrollTo:t}])=>{let n=F1(),r=F1(),i=F1(),a=Q(!1),o=Q(void 0);return J(Z(V1(n,r),X(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),J(Z(t,j1(r),X(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},v1(r0)),z2=R1(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:a},{useWindowScroll:o,windowScrollContainerState:s,windowViewportRect:c}])=>{let l=F1(),u=Q(void 0),d=Q(null),f=Q(null);return J(s,d),J(c,f),y1(Z(l,j1(t,r,o,d,f,n)),([e,t,n,r,i,a,o])=>{let s=U0(t.sizeTree);r&&i!==null&&a!==null&&(n=i.scrollTop-a.offsetTop),n-=o,e({ranges:s,scrollTop:n})}),J(Z(u,Y(p1),X(B2)),i),J(Z(a,j1(u),Y(([,e])=>e!==void 0),E1(),X(([,e])=>e.ranges)),e),{getState:l,restoreStateFrom:u}},v1(Y0,r0,o2,Q0,R2));function B2(e){return{align:`start`,index:0,offset:e.scrollTop}}var V2=R1(([{topItemsIndexes:e}])=>{let t=Q(0);return J(Z(t,Y(e=>e>=0),X(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},v1(E2));function H2(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}var U2=H2(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),W2=R1(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:a,groupIndices:o,heightEstimates:s,itemSize:c,sizeRanges:l,sizes:u,statefulTotalCount:d,totalCount:f,trackItemSizes:p},{initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g},_,v,y,b,{scrollToIndex:x},S,{topItemCount:C},{groupCounts:w},T])=>{let{listState:E,minOverscanItemCount:D,topItemsIndexes:O,rangeChanged:k,...A}=b;return J(k,T.scrollSeekRangeChanged),J(Z(V1(T.windowViewportRect,_.headerHeight,_.fixedHeaderHeight),X(([e,t,n])=>Math.max(t+n+1,e.visibleHeight))),_.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:a,groupCounts:w,heightEstimates:s,initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g,sizeRanges:l,topItemCount:C,topItemsIndexes:O,totalCount:f,...y,groupIndices:o,itemSize:c,listState:E,minOverscanItemCount:D,scrollToIndex:x,statefulTotalCount:d,trackItemSizes:p,rangeChanged:k,...A,...T,..._,sizes:u,...v}},v1(Y0,o2,r0,z2,P2,E2,t2,R1(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:s},{listState:c},{beforeUnshiftWith:l,gap:u,shiftWithOffset:d,sizes:f},{log:p},{recalcInProgress:m}])=>{let h=I1(Z(c,j1(o),O1(([,e,t,n],[{bottom:r,items:i,offsetBottom:a,totalCount:o},s])=>{let c=r+a,l=0;return t===o&&e.length>0&&i.length>0&&(i[0].originalIndex===0&&e[0].originalIndex===0||(l=c-n,l!==0&&(l+=s))),[l,i,o,c]},[0,[],0,0]),Y(([e])=>e!==0),j1(r,s,n,i,p,m),Y(([,e,t,n,,,r])=>!r&&!n&&e!==0&&t===c2),X(([[e],,,,,t])=>(t(`Upward scrolling compensation`,{amount:e},U1.DEBUG),e))));function g(n){n>0?(b1(t,{behavior:`auto`,top:-n}),b1(e,0)):(b1(e,0),b1(t,{behavior:`auto`,top:-n}))}return y1(Z(h,j1(e,a)),([t,n,r])=>{r&&U2()?b1(e,n-t):g(-t)}),y1(Z(V1(P1(a,!1),e,m),Y(([e,t,n])=>!e&&!n&&t!==0),X(([e,t])=>t),A1(1)),g),J(Z(d,X(e=>({top:-e}))),t),y1(Z(l,j1(f,u),X(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function a(e){return e*(n+i)}if(t.length===0)return a(e);let o=0,s=s0(r,0),c=0,l=0;for(;ce&&(o-=s,n=e-c+1),c+=n,o+=a(n),l++}return o})),n=>{b1(e,n),requestAnimationFrame(()=>{b1(t,{top:n}),requestAnimationFrame(()=>{b1(e,0),b1(m,!1)})})}),{deviation:e}},v1(r0,p2,E2,Y0,K1,D0)),V2,Z0,R1(([e,t,n,r,i,a,o,s,c,l,u])=>({...e,...t,...n,...r,...i,...a,...o,...s,...c,...l,...u}),v1(y2,F2,Q0,L2,D2,I2,O2,R2,j2,K1,k2))));function G2(e,t){let n={},r={},i=0,a=e.length;for(;i`u`?w.useEffect:w.useLayoutEffect;function q2(e,t,n){let r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),a=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),s=w.createContext({});function c(e,n){e.propsReady!==void 0&&b1(e.propsReady,!1);for(let i of r){let r=e[t.required[i]];b1(r,n[i])}for(let r of i)if(r in n){let i=e[t.optional[r]];b1(i,n[r])}e.propsReady!==void 0&&b1(e.propsReady,!0)}function l(e){return a.reduce((n,r)=>(n[r]=n=>{let i=e[t.methods[r]];b1(i,n)},n),{})}function u(e){return o.reduce((n,r)=>(n[r]=N1(e[t.events[r]]),n),{})}return{Component:w.forwardRef(function(t,a){let{children:d,...f}=t,[p]=w.useState(()=>g1(B1(e),e=>{c(e,f)})),[m]=w.useState(d1(u,p));K2(()=>{for(let e of o)e in f&&y1(m[e],f[e]);return()=>{Object.values(m).map(x1)}},[f,m,p]),K2(()=>{c(p,f)}),w.useImperativeHandle(a,c1(l(p)));let h=n;return(0,R.jsx)(s.Provider,{value:p,children:n===void 0?d:(0,R.jsx)(h,{...G2([...r,...i,...o],f),children:d})})}),useEmitter:(e,t)=>{let n=w.useContext(s)[e];K2(()=>y1(n,t),[t,n])},useEmitterValue:e=>{let t=w.useContext(s)[e],n=w.useCallback(e=>y1(t,e),[t]);return w.useSyncExternalStore(n,()=>S1(t),()=>S1(t))},usePublisher:e=>{let t=w.useContext(s);return w.useCallback(n=>{b1(t[e],n)},[t,e])}}}var J2=w.createContext(void 0),Y2=w.createContext(void 0),X2=`-webkit-sticky`,Z2=`sticky`,Q2=H2(()=>{if(typeof document>`u`)return Z2;let e=document.createElement(`div`);return e.style.position=X2,e.style.position===X2?X2:Z2}),$2=typeof document>`u`?w.useEffect:w.useLayoutEffect;function e4(e){return`self`in e}function t4(e){return`body`in e}function n4(e,t,n,r=h1,i,a){let o=w.useRef(null),s=w.useRef(null),c=w.useRef(null),l=w.useCallback(n=>{let r,i,o,l=n.target;if(t4(l)||e4(l)){let e=e4(l)?l:l.defaultView;o=a===!0?Y1(e,e.scrollX):e.scrollY,r=a===!0?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a===!0?e.innerWidth:e.innerHeight}else o=a===!0?Y1(l,l.scrollLeft):l.scrollTop,r=a===!0?l.scrollWidth:l.scrollHeight,i=a===!0?l.offsetWidth:l.offsetHeight;let u=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync===!0?u():bo.flushSync(u),s.current!==null&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&=(clearTimeout(c.current),null))},[e,t,a]);w.useEffect(()=>{let e=i??o.current;return r(i??o.current),l({suppressFlushSync:!0,target:e}),e.addEventListener(`scroll`,l,{passive:!0}),()=>{r(null),e.removeEventListener(`scroll`,l)}},[o,l,n,r,i]);function u(n){let r=o.current;if(!r||(a===!0?`offsetWidth`in r&&r.offsetWidth===0:`offsetHeight`in r&&r.offsetHeight===0))return;let i=n.behavior===`smooth`,l,u,d;e4(r)?(u=Math.max(j0(r.document.documentElement,a===!0?`width`:`height`),a===!0?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),l=a===!0?r.innerWidth:r.innerHeight,d=a===!0?Y1(r,r.scrollX):r.scrollY):(u=r[a===!0?`scrollWidth`:`scrollHeight`],l=j0(r,a===!0?`width`:`height`),d=a===!0?Y1(r,r.scrollLeft):r.scrollTop);let f=u-l;if(n.top===void 0){r.scrollTo(n);return}let p=Math.ceil(Math.max(Math.min(f,n.top),0));if(n.top=p,s2(l,u)||p===d){e({scrollHeight:u,scrollTop:d,viewportHeight:l}),i&&t(!0);return}i?(s.current=p,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,a===!0&&(n={...n.behavior===void 0?{}:{behavior:n.behavior},left:X1(r,p)}),r.scrollTo(n)}function d(e){a===!0&&(e={...e.behavior===void 0?{}:{behavior:e.behavior},...e.top===void 0?{}:{left:X1(o.current,e.top)}}),o.current.scrollBy(e)}return{scrollByCallback:d,scrollerRef:o,scrollToCallback:u}}function r4(e){return e}var i4=R1(([e,t])=>({...e,...t}),v1(W2,R1(()=>{let e=Q(e=>`Item ${e}`),t=Q(e=>`Group ${e}`),n=Q({}),r=Q(r4),i=Q(`div`),a=Q(h1),o=(e,t=null)=>P1(Z(n,X(t=>t[e]),E1()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:o(`EmptyPlaceholder`),FooterComponent:o(`Footer`),GroupComponent:o(`Group`,`div`),groupContent:t,HeaderComponent:o(`Header`),HeaderFooterTag:i,ItemComponent:o(`Item`,`div`),itemContent:e,ListComponent:o(`List`,`div`),ScrollerComponent:o(`Scroller`,`div`),scrollerRef:a,ScrollSeekPlaceholder:o(`ScrollSeekPlaceholder`),TopItemListComponent:o(`TopItemList`)}}))),a4=({height:e})=>(0,R.jsx)(`div`,{style:{height:e}}),o4={overflowAnchor:`none`,position:Q2(),zIndex:1},s4={overflowAnchor:`none`},c4={...s4,display:`inline-block`,height:`100%`},l4=w.memo(function({showTopList:e=!1}){let t=E4(`listState`),n=D4(`sizeRanges`),r=E4(`useWindowScroll`),i=E4(`customScrollParent`),a=D4(`windowScrollContainerState`),o=D4(`scrollContainerState`),s=i||r?a:o,c=E4(`itemContent`),l=E4(`context`),u=E4(`groupContent`),d=E4(`trackItemSizes`),f=E4(`itemSize`),p=E4(`log`),m=D4(`gap`),h=E4(`horizontalDirection`),{callbackRef:g}=$1(n,f,d,e?h1:s,p,m,i,h,E4(`skipAnimationFrameInResizeObserver`)),[_,v]=w.useState(0);T4(`deviation`,e=>{_!==e&&v(e)});let y=E4(`EmptyPlaceholder`),b=E4(`ScrollSeekPlaceholder`)??a4,x=E4(`ListComponent`),S=E4(`ItemComponent`),C=E4(`GroupComponent`),T=E4(`computeItemKey`),E=E4(`isSeeking`),D=E4(`groupIndices`).length>0,O=E4(`alignToBottom`),k=E4(`initialItemFinalLocationReached`),A=e?{}:{boxSizing:`border-box`,...h?{display:`inline-block`,height:`100%`,marginInlineStart:_===0?O?`auto`:0:_,paddingInlineEnd:t.offsetBottom,paddingInlineStart:t.offsetTop,whiteSpace:`nowrap`}:{marginTop:_===0?O?`auto`:0:_,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...k?{}:{visibility:`hidden`}};return!e&&t.totalCount===0&&y!=null?(0,R.jsx)(y,{...h4(y,l)}):(0,R.jsx)(x,{...h4(x,l),"data-testid":e?`virtuoso-top-item-list`:`virtuoso-item-list`,ref:g,style:A,children:(e?t.topItems:t.items).map(e=>{let n=e.originalIndex,r=T(n+t.firstItemIndex,e.data,l);return E?(0,w.createElement)(b,{...h4(b,l),height:e.size,index:e.index,key:r,type:e.type||`item`,...e.type===`group`?{}:{groupIndex:e.groupIndex}}):e.type===`group`?(0,w.createElement)(C,{...h4(C,l),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:o4},u(e.index,l)):(0,w.createElement)(S,{...h4(S,l),...g4(S,e.data),"data-index":n,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:h?c4:s4},D?c(e.index,e.groupIndex,e.data,l):c(e.index,e.data,l))})})}),u4={height:`100%`,outline:`none`,overflowY:`auto`,position:`relative`,WebkitOverflowScrolling:`touch`},d4={outline:`none`,overflowX:`auto`,position:`relative`},f4=e=>({height:`100%`,position:`absolute`,top:0,width:`100%`,...e?{display:`flex`,flexDirection:`column`}:void 0}),p4=(e,t,n=0)=>({...f4(e),position:t?`relative`:`absolute`,top:t?-n:0}),m4={position:Q2(),top:0,width:`100%`,zIndex:1};function h4(e,t){if(typeof e!=`string`)return{context:t}}function g4(e,t){return{item:typeof e==`string`?void 0:t}}var _4=w.memo(function(){let e=E4(`HeaderComponent`),t=D4(`headerHeight`),n=E4(`HeaderFooterTag`),r=Z1(w.useMemo(()=>e=>{t(j0(e,`height`))},[t]),!0,E4(`skipAnimationFrameInResizeObserver`)),i=E4(`context`);return e==null?null:(0,R.jsx)(n,{ref:r,children:(0,R.jsx)(e,{...h4(e,i)})})}),v4=w.memo(function(){let e=E4(`FooterComponent`),t=D4(`footerHeight`),n=E4(`HeaderFooterTag`),r=Z1(w.useMemo(()=>e=>{t(j0(e,`height`))},[t]),!0,E4(`skipAnimationFrameInResizeObserver`)),i=E4(`context`);return e==null?null:(0,R.jsx)(n,{ref:r,children:(0,R.jsx)(e,{...h4(e,i)})})});function y4({useEmitter:e,useEmitterValue:t,usePublisher:n}){return w.memo(function({children:r,style:i,context:a,...o}){let s=n(`scrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`scrollerRef`),d=t(`horizontalDirection`)||!1,{scrollByCallback:f,scrollerRef:p,scrollToCallback:m}=n4(s,l,c,u,void 0,d);return e(`scrollTo`,m),e(`scrollBy`,f),(0,R.jsx)(c,{"data-testid":`virtuoso-scroller`,"data-virtuoso-scroller":!0,ref:p,style:{...d?d4:u4,...i},tabIndex:0,...o,...h4(c,a),children:r})})}function b4({useEmitter:e,useEmitterValue:t,usePublisher:n}){return w.memo(function({children:r,style:i,context:a,...o}){let s=n(`windowScrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`totalListHeight`),d=t(`deviation`),f=t(`customScrollParent`),p=w.useRef(null),{scrollByCallback:m,scrollerRef:h,scrollToCallback:g}=n4(s,l,c,t(`scrollerRef`),f);return $2(()=>(h.current=f??p.current?.ownerDocument.defaultView,()=>{h.current=null}),[h,f]),e(`windowScrollTo`,g),e(`scrollBy`,m),(0,R.jsx)(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:`relative`,...i,...u===0?void 0:{height:u+d}},...o,...h4(c,a),children:r})})}var x4=({children:e})=>{let t=w.useContext(J2),n=D4(`viewportHeight`),r=D4(`fixedItemHeight`),i=E4(`alignToBottom`),a=E4(`horizontalDirection`),o=Z1(w.useMemo(()=>u1(n,e=>j0(e,a?`width`:`height`)),[n,a]),!0,E4(`skipAnimationFrameInResizeObserver`));return w.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,R.jsx)(`div`,{"data-viewport-type":`element`,ref:o,style:f4(i),children:e})},S4=({children:e})=>{let t=w.useContext(J2),n=D4(`windowViewportRect`),r=D4(`fixedItemHeight`),i=E4(`customScrollParent`),a=E4(`useWindowScroll`),o=E4(`topListHeight`),s=n0(n,i,E4(`skipAnimationFrameInResizeObserver`)),c=E4(`alignToBottom`);return w.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,R.jsx)(`div`,{"data-viewport-type":`window`,ref:s,style:p4(c,a,o),children:e})},C4=({children:e})=>{let t=E4(`TopItemListComponent`)??`div`,n=E4(`headerHeight`),r={...m4,marginTop:`${n}px`},i=E4(`context`);return(0,R.jsx)(t,{style:r,...h4(t,i),children:e})},{Component:w4,useEmitter:T4,useEmitterValue:E4,usePublisher:D4}=q2(i4,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,scrollIntoViewOnChange:`scrollIntoViewOnChange`,itemContent:`itemContent`,groupContent:`groupContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,groupCounts:`groupCounts`,topItemCount:`topItemCount`,firstItemIndex:`firstItemIndex`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,heightEstimates:`heightEstimates`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`HeaderFooterTag`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,horizontalDirection:`horizontalDirection`,skipAnimationFrameInResizeObserver:`skipAnimationFrameInResizeObserver`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,autoscrollToBottom:`autoscrollToBottom`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},w.memo(function(e){let t=E4(`useWindowScroll`),n=E4(`topItemsIndexes`).length>0,r=E4(`customScrollParent`),i=E4(`context`);return(0,R.jsxs)(r||t?k4:O4,{...e,context:i,children:[n&&(0,R.jsx)(C4,{children:(0,R.jsx)(l4,{showTopList:!0})}),(0,R.jsxs)(r||t?S4:x4,{children:[(0,R.jsx)(_4,{}),(0,R.jsx)(l4,{}),(0,R.jsx)(v4,{})]})]})})),O4=y4({useEmitter:T4,useEmitterValue:E4,usePublisher:D4}),k4=b4({useEmitter:T4,useEmitterValue:E4,usePublisher:D4}),A4=w4,j4=R1(([e,t])=>({...e,...t}),v1(W2,R1(()=>{let e=Q(e=>(0,R.jsxs)(`td`,{children:[`Item $`,e]})),t=Q(null),n=Q(e=>(0,R.jsxs)(`td`,{colSpan:1e3,children:[`Group `,e]})),r=Q(null),i=Q(null),a=Q({}),o=Q(r4),s=Q(h1),c=(e,t=null)=>P1(Z(a,X(t=>t[e]),E1()),t);return{components:a,computeItemKey:o,context:t,EmptyPlaceholder:c(`EmptyPlaceholder`),FillerRow:c(`FillerRow`),fixedFooterContent:i,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`),TableBodyComponent:c(`TableBody`,`tbody`),TableComponent:c(`Table`,`table`),TableFooterComponent:c(`TableFoot`,`tfoot`),TableHeadComponent:c(`TableHead`,`thead`),TableRowComponent:c(`TableRow`,`tr`),GroupComponent:c(`Group`,`tr`)}}))),M4=({height:e})=>(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{style:{height:e}})}),N4=({height:e})=>(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{style:{border:0,height:e,padding:0}})}),P4={overflowAnchor:`none`},F4={position:Q2(),zIndex:2,overflowAnchor:`none`},I4=w.memo(function({showTopList:e=!1}){let t=H4(`listState`),n=H4(`computeItemKey`),r=H4(`firstItemIndex`),i=H4(`context`),a=H4(`isSeeking`),o=H4(`fixedHeaderHeight`),s=H4(`groupIndices`).length>0,c=H4(`itemContent`),l=H4(`groupContent`),u=H4(`ScrollSeekPlaceholder`)??M4,d=H4(`GroupComponent`),f=H4(`TableRowComponent`),p=(e?t.topItems:[]).reduce((e,t,n)=>(n===0?e.push(t.size):e.push(e[n-1]+t.size),e),[]);return(e?t.topItems:t.items).map(t=>{let m=t.originalIndex,h=n(m+r,t.data,i),g=e?m===0?0:p[m-1]:0;return a?(0,w.createElement)(u,{...h4(u,i),height:t.size,index:t.index,key:h,type:t.type||`item`}):t.type===`group`?(0,w.createElement)(d,{...h4(d,i),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,key:h,style:{...F4,top:o}},l(t.index,i)):(0,w.createElement)(f,{...h4(f,i),...g4(f,t.data),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,"data-item-group-index":t.groupIndex,key:h,style:e?{...F4,top:o+g}:P4},s?c(t.index,t.groupIndex,t.data,i):c(t.index,t.data,i))})}),L4=w.memo(function(){let e=H4(`listState`),t=H4(`topItemsIndexes`).length>0,n=U4(`sizeRanges`),r=H4(`useWindowScroll`),i=H4(`customScrollParent`),a=U4(`windowScrollContainerState`),o=U4(`scrollContainerState`),s=i||r?a:o,c=H4(`trackItemSizes`),{callbackRef:l,ref:u}=$1(n,H4(`itemSize`),c,s,H4(`log`),void 0,i,!1,H4(`skipAnimationFrameInResizeObserver`)),[d,f]=w.useState(0);V4(`deviation`,e=>{d!==e&&(u.current.style.marginTop=`${e}px`,f(e))});let p=H4(`EmptyPlaceholder`),m=H4(`FillerRow`)??N4,h=H4(`TableBodyComponent`),g=H4(`paddingTopAddition`),_=H4(`statefulTotalCount`),v=H4(`context`);if(_===0&&p!=null)return(0,R.jsx)(p,{...h4(p,v)});let y=(t?e.topItems:[]).reduce((e,t)=>e+t.size,0),b=e.offsetTop+g+d-y,x=e.offsetBottom,S=b>0?(0,R.jsx)(m,{context:v,height:b},`padding-top`):null,C=x>0?(0,R.jsx)(m,{context:v,height:x},`padding-bottom`):null;return(0,R.jsxs)(h,{"data-testid":`virtuoso-item-list`,ref:l,...h4(h,v),children:[S,t&&(0,R.jsx)(I4,{showTopList:!0}),(0,R.jsx)(I4,{}),C]})}),R4=({children:e})=>{let t=w.useContext(J2),n=U4(`viewportHeight`),r=U4(`fixedItemHeight`),i=Z1(w.useMemo(()=>u1(n,e=>j0(e,`height`)),[n]),!0,H4(`skipAnimationFrameInResizeObserver`));return w.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,R.jsx)(`div`,{"data-viewport-type":`element`,ref:i,style:f4(!1),children:e})},z4=({children:e})=>{let t=w.useContext(J2),n=U4(`windowViewportRect`),r=U4(`fixedItemHeight`),i=H4(`customScrollParent`),a=H4(`useWindowScroll`),o=n0(n,i,H4(`skipAnimationFrameInResizeObserver`));return w.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,R.jsx)(`div`,{"data-viewport-type":`window`,ref:o,style:p4(!1,a),children:e})},{Component:B4,useEmitter:V4,useEmitterValue:H4,usePublisher:U4}=q2(j4,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,firstItemIndex:`firstItemIndex`,itemContent:`itemContent`,groupContent:`groupContent`,fixedHeaderContent:`fixedHeaderContent`,fixedFooterContent:`fixedFooterContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,topItemCount:`topItemCount`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,groupCounts:`groupCounts`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},w.memo(function(e){let t=H4(`useWindowScroll`),n=H4(`customScrollParent`),r=U4(`fixedHeaderHeight`),i=U4(`fixedFooterHeight`),a=H4(`fixedHeaderContent`),o=H4(`fixedFooterContent`),s=H4(`context`),c=Z1(w.useMemo(()=>u1(r,e=>j0(e,`height`)),[r]),!0,H4(`skipAnimationFrameInResizeObserver`)),l=Z1(w.useMemo(()=>u1(i,e=>j0(e,`height`)),[i]),!0,H4(`skipAnimationFrameInResizeObserver`)),u=n||t?G4:W4,d=n||t?z4:R4,f=H4(`TableComponent`),p=H4(`TableHeadComponent`),m=H4(`TableFooterComponent`),h=a?(0,R.jsx)(p,{ref:c,style:{position:`sticky`,top:0,zIndex:2},...h4(p,s),children:a()},`TableHead`):null,g=o?(0,R.jsx)(m,{ref:l,style:{bottom:0,position:`sticky`,zIndex:1},...h4(m,s),children:o()},`TableFoot`):null;return(0,R.jsx)(u,{...e,...h4(u,s),children:(0,R.jsx)(d,{children:(0,R.jsxs)(f,{style:{borderSpacing:0,overflowAnchor:`none`},...h4(f,s),children:[h,(0,R.jsx)(L4,{},`TableBody`),g]})})})})),W4=y4({useEmitter:V4,useEmitterValue:H4,usePublisher:U4}),G4=b4({useEmitter:V4,useEmitterValue:H4,usePublisher:U4}),K4={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},q4={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:J4,floor:Y4,max:X4,min:Z4,round:Q4}=Math;function $4(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:n===null?null:n[r+e],index:r+e}))}function e3(e){return{...q4,items:e}}function t3(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function n3(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}var r3=R1(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:a,scrollBy:o,scrollContainerState:s,scrollTo:c,scrollTop:l,smoothScrollTargetReached:u,viewportHeight:d},f,p,{didMount:m,propsReady:h},{customScrollParent:g,useWindowScroll:_,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b},x])=>{let S=Q(0),C=Q(0),w=Q(K4),T=Q({height:0,width:0}),E=Q({height:0,width:0}),D=F1(),O=F1(),k=Q(0),A=Q(null),j=Q({column:0,row:0}),M=F1(),N=F1(),P=Q(!1),F=Q(0),ee=Q(!0),te=Q(!1),ne=Q(!1);y1(Z(m,j1(F),Y(([e,t])=>!a2(t))),()=>{b1(ee,!1)}),y1(Z(V1(m,ee,E,T,F,te),Y(([e,t,n,r,,i])=>e&&!t&&n.height!==0&&r.height!==0&&!i)),([,,,,e])=>{if(e===void 0){b1(ee,!0);return}b1(te,!0),r2(1,()=>{b1(D,e)}),C1(Z(l),()=>{b1(t,[0,0]),b1(ee,!0)})}),J(Z(N,Y(e=>e!=null&&e.scrollTop>0),D1(0)),C),y1(Z(m,j1(N),Y(([,e])=>e!=null)),([,e])=>{e&&(b1(T,e.viewport),b1(E,e.item),b1(j,e.gap),e.scrollTop>0&&(b1(P,!0),C1(Z(l,k1(1)),e=>{b1(P,!1)}),b1(c,{top:e.scrollTop})))}),J(Z(T,X(({height:e})=>e)),d),J(Z(V1($(T,t3),$(E,t3),$(j,(e,t)=>e!==void 0&&e.column===t.column&&e.row===t.row),$(l)),X(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),M),J(Z(V1($(S),r,$(j,n3),$(E,t3),$(T,t3),$(A),$(C),$(P),$(ee),$(F)),Y(([,,,,,,,e])=>!e),X(([e,[t,n],r,i,a,o,s,,c,l])=>{let{column:u,row:d}=r,{height:f,width:p}=i,{width:m}=a;if(s===0&&(e===0||m===0))return K4;if(p===0){let t=i2(l,e);return e3($4(t,t+Math.max(s-1,0),o))}let h=i3(m,p,u),g,_;c?t===0&&n===0&&s>0?(g=0,_=s-1):(g=h*Y4((t+d)/(f+d)),_=h*J4((n+d)/(f+d))-1,_=Z4(e-1,X4(_,h-1)),g=Z4(_,X4(0,g))):(g=0,_=-1);let v=$4(g,_,o),{bottom:y,top:b}=a3(a,r,i,v),x=J4(e/h);return{bottom:y,itemHeight:f,items:v,itemWidth:p,offsetBottom:x*f+(x-1)*d-y,offsetTop:b,top:b}})),w),J(Z(A,Y(e=>e!==null),X(e=>e.length)),S),J(Z(V1(T,E,w,j),Y(([e,t,{items:n}])=>n.length>0&&t.height!==0&&e.height!==0),X(([e,t,{items:n},r])=>{let{bottom:i,top:a}=a3(e,r,t,n);return[a,i]}),E1(E0)),t);let re=Q(!1);J(Z(l,j1(re),X(([e,t])=>t||e!==0)),re);let ie=I1(Z(V1(w,S),Y(([{items:e}])=>e.length>0),j1(re),Y(([[e,t],n])=>{let r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&e.offsetBottom===0&&e.items.length===t)&&r}),X(([[,e]])=>e-1),E1())),I=I1(Z($(w),Y(({items:e})=>e.length>0&&e[0].index===0),D1(0),E1())),ae=I1(Z($(w),j1(P),Y(([{items:e},t])=>e.length>0&&!t),X(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),E1(T0),A1(0)));J(ae,p.scrollSeekRangeChanged),J(Z(D,j1(T,E,S,j),X(([e,t,n,r,i])=>{let a=e2(e),{align:o,behavior:s,offset:c}=a,l=a.index;l===`LAST`&&(l=r-1),l=X4(0,l,Z4(r-1,l));let u=o3(t,i,n,l);return o===`end`?u=Q4(u-t.height+n.height):o===`center`&&(u=Q4(u-t.height/2+n.height/2)),c!==void 0&&c!==0&&(u+=c),{behavior:s,top:u}})),c);let oe=P1(Z(w,X(e=>e.offsetBottom+e.bottom)),0);return J(Z(b,X(e=>({height:e.visibleHeight,width:e.visibleWidth}))),T),{customScrollParent:g,data:A,deviation:k,footerHeight:i,gap:j,headerHeight:a,increaseViewportBy:e,initialItemCount:C,itemDimensions:E,overscan:n,restoreStateFrom:N,scrollBy:o,scrollContainerState:s,scrollHeight:O,scrollTo:c,scrollToIndex:D,scrollTop:l,smoothScrollTargetReached:u,totalCount:S,useWindowScroll:_,viewportDimensions:T,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b,...p,gridState:w,horizontalDirection:ne,initialTopMostItemIndex:F,totalListHeight:oe,...f,endReached:ie,propsReady:h,rangeChanged:ae,startReached:I,stateChanged:M,stateRestoreInProgress:P,...x}},v1(y2,r0,p2,L2,Q0,R2,K1));function i3(e,t,n){return X4(1,Y4((e+n)/(Y4(t)+n)))}function a3(e,t,n,r){let{height:i}=n;if(i===void 0||r.length===0)return{bottom:0,top:0};let a=o3(e,t,n,r[0].index);return{bottom:o3(e,t,n,r[r.length-1].index)+i,top:a}}function o3(e,t,n,r){let i=Y4(r/i3(e.width,n.width,t.column)),a=i*n.height+X4(0,i-1)*t.row;return a>0?a+t.row:a}var s3=R1(([e,t])=>({...e,...t}),v1(r3,R1(()=>{let e=Q(e=>`Item ${e}`),t=Q({}),n=Q(null),r=Q(`virtuoso-grid-item`),i=Q(`virtuoso-grid-list`),a=Q(r4),o=Q(`div`),s=Q(h1),c=(e,n=null)=>P1(Z(t,X(t=>t[e]),E1()),n),l=Q(!1),u=Q(!1);return J($(u),l),{components:t,computeItemKey:a,context:n,FooterComponent:c(`Footer`),HeaderComponent:c(`Header`),headerFooterTag:o,itemClassName:r,ItemComponent:c(`Item`,`div`),itemContent:e,listClassName:i,ListComponent:c(`List`,`div`),readyStateChanged:l,reportReadyState:u,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`,`div`)}}))),c3=w.memo(function(){let e=h3(`gridState`),t=h3(`listClassName`),n=h3(`itemClassName`),r=h3(`itemContent`),i=h3(`computeItemKey`),a=h3(`isSeeking`),o=g3(`scrollHeight`),s=h3(`ItemComponent`),c=h3(`ListComponent`),l=h3(`ScrollSeekPlaceholder`),u=h3(`context`),d=g3(`itemDimensions`),f=g3(`gap`),p=h3(`log`),m=h3(`stateRestoreInProgress`),h=g3(`reportReadyState`),g=Z1(w.useMemo(()=>e=>{let t=e.parentElement.parentElement.scrollHeight;o(t);let n=e.firstChild;if(n!==null){let{height:e,width:t}=n.getBoundingClientRect();d({height:e,width:t})}f({column:y3(`column-gap`,getComputedStyle(e).columnGap,p),row:y3(`row-gap`,getComputedStyle(e).rowGap,p)})},[o,d,f,p]),!0,!1);return $2(()=>{e.itemHeight>0&&e.itemWidth>0&&h(!0)},[e]),m?null:(0,R.jsx)(c,{className:t,ref:g,...h4(c,u),"data-testid":`virtuoso-item-list`,style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(t=>{let o=i(t.index,t.data,u);return a?(0,R.jsx)(l,{...h4(l,u),height:e.itemHeight,index:t.index,width:e.itemWidth},o):(0,w.createElement)(s,{...h4(s,u),className:n,"data-index":t.index,key:o},r(t.index,t.data,u))})})}),l3=w.memo(function(){let e=h3(`HeaderComponent`),t=g3(`headerHeight`),n=h3(`headerFooterTag`),r=Z1(w.useMemo(()=>e=>{t(j0(e,`height`))},[t]),!0,!1),i=h3(`context`);return e==null?null:(0,R.jsx)(n,{ref:r,children:(0,R.jsx)(e,{...h4(e,i)})})}),u3=w.memo(function(){let e=h3(`FooterComponent`),t=g3(`footerHeight`),n=h3(`headerFooterTag`),r=Z1(w.useMemo(()=>e=>{t(j0(e,`height`))},[t]),!0,!1),i=h3(`context`);return e==null?null:(0,R.jsx)(n,{ref:r,children:(0,R.jsx)(e,{...h4(e,i)})})}),d3=({children:e})=>{let t=w.useContext(Y2),n=g3(`itemDimensions`),r=g3(`viewportDimensions`),i=Z1(w.useMemo(()=>e=>{r(e.getBoundingClientRect())},[r]),!0,!1);return w.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),(0,R.jsx)(`div`,{ref:i,style:f4(!1),children:e})},f3=({children:e})=>{let t=w.useContext(Y2),n=g3(`windowViewportRect`),r=g3(`itemDimensions`),i=h3(`customScrollParent`),a=h3(`useWindowScroll`),o=n0(n,i,!1);return w.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),(0,R.jsx)(`div`,{ref:o,style:p4(!1,a),children:e})},{Component:p3,useEmitter:m3,useEmitterValue:h3,usePublisher:g3}=q2(s3,{optional:{context:`context`,totalCount:`totalCount`,overscan:`overscan`,itemContent:`itemContent`,components:`components`,computeItemKey:`computeItemKey`,data:`data`,initialItemCount:`initialItemCount`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`headerFooterTag`,listClassName:`listClassName`,itemClassName:`itemClassName`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,restoreStateFrom:`restoreStateFrom`,initialTopMostItemIndex:`initialTopMostItemIndex`,increaseViewportBy:`increaseViewportBy`},methods:{scrollTo:`scrollTo`,scrollBy:`scrollBy`,scrollToIndex:`scrollToIndex`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,stateChanged:`stateChanged`,readyStateChanged:`readyStateChanged`}},w.memo(function({...e}){let t=h3(`useWindowScroll`),n=h3(`customScrollParent`),r=n||t?v3:_3,i=n||t?f3:d3,a=h3(`context`);return(0,R.jsx)(r,{...e,...h4(r,a),children:(0,R.jsxs)(i,{children:[(0,R.jsx)(l3,{}),(0,R.jsx)(c3,{}),(0,R.jsx)(u3,{})]})})})),_3=y4({useEmitter:m3,useEmitterValue:h3,usePublisher:g3}),v3=b4({useEmitter:m3,useEmitterValue:h3,usePublisher:g3});function y3(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,U1.WARN),t===`normal`?0:parseInt(t??`0`,10)}var b3=2e3,x3=1e6;function S3(e,t,n,r=b3){let i=new Map((n===`replace`?[]:e).map(e=>[e.id,e]));for(let e of t)i.set(e.id,e);let a=[...i.values()].sort((e,t)=>e.timestamp-t.timestamp||e.id.localeCompare(t.id)),o=n===`older`?a.slice(0,r):a.slice(-r),s=0;if(n===`older`){let t=e[0]?.id,n=t==null?-1:o.findIndex(e=>e.id===t);n>0&&(s=-n)}else if(n===`newer`){let t=new Set(o.map(e=>e.id)),n=e.findIndex(e=>t.has(e.id));n>0&&(s=n)}return{events:o,firstItemIndexDelta:s}}function C3(){return(0,R.jsxs)(Ac,{width:430,position:`bottom-start`,shadow:`md`,children:[(0,R.jsx)(Ac.Target,{children:(0,R.jsx)(Kc,{variant:`subtle`,color:`gray`,"aria-label":`How CloudWatch attempts are detected`,children:(0,R.jsx)(jh,{size:19})})}),(0,R.jsxs)(Ac.Dropdown,{children:[(0,R.jsx)(U,{fw:700,mb:`xs`,children:`How CloudWatch attempts are detected`}),(0,R.jsxs)(Ep,{type:`ordered`,spacing:`xs`,size:`sm`,children:[(0,R.jsx)(Ep.Item,{children:`Read locally cached events in timestamp order.`}),(0,R.jsxs)(Ep.Item,{children:[`Extract `,(0,R.jsx)(qf,{children:`pid`}),` from structured messages or plain-text `,(0,R.jsx)(qf,{children:`pid=…`}),` markers.`]}),(0,R.jsx)(Ep.Item,{children:`Order unique PIDs by first event; each PID establishes one attempt window.`}),(0,R.jsx)(Ep.Item,{children:`Show every cached event in that window, including untagged setup and teardown lines.`})]}),(0,R.jsx)(nd,{color:`yellow`,variant:`light`,mt:`md`,icon:(0,R.jsx)(bh,{size:17}),children:`An auxiliary process with its own PID may be mistaken for a recovery attempt.`})]})]})}function w3({resource:e}){let t=e.skypilot.job_id,[n,r]=(0,w.useState)([]),[i,a]=(0,w.useState)(`Loading cached logs…`),[o,s]=(0,w.useState)([]),[c,l]=(0,w.useState)(0),[u,d]=(0,w.useState)(!1),[f,p]=(0,w.useState)(null),[m,h]=(0,w.useState)(null),[g,_]=(0,w.useState)(null),[v,y]=(0,w.useState)(!1),[b,x]=(0,w.useState)(!1),[S,C]=(0,w.useState)(null),[T,E]=(0,w.useState)(!1),[D,O]=(0,w.useState)(0),[k,A]=(0,w.useState)(x3),j=(0,w.useRef)(!1),M=(0,w.useRef)(null),N=(0,w.useRef)(!1),P=(0,w.useRef)(!1),F=`${t??`none`}:${g??`none`}`,ee=(0,w.useRef)(F);ee.current=F,(0,w.useEffect)(()=>{!N.current||n.length===0||(N.current=!1,M.current?.scrollToIndex({index:k,align:`start`}))},[k,n]),(0,w.useEffect)(()=>{if(t==null||e.skypilot.cloud?.toLowerCase()!==`aws`||!e.skypilot.cluster_name)return;let n=new AbortController,r;d(!0);let i=()=>{fetch(`/api/logs/${t}/attempts`,{signal:n.signal}).then(async e=>{if(!e.ok)throw Error(await e.text());return e.json()}).then(({attempts:e,expected_attempts:t,indexing:n,backfill:o,error:c})=>{s(e),l(t),d(n),p(o.cached_events),h(c),c&&a(c);let u=e.find(e=>e.current)??e.at(-1);_(u?e=>e==null||e===`live`?u.attempt.toString():e:e=>e??`live`),n&&(r=window.setTimeout(i,5e3))}).catch(e=>{e.name!==`AbortError`&&(d(!1),h(e.message))})};return i(),()=>{n.abort(),r!=null&&window.clearTimeout(r)}},[t,e.skypilot.cloud,e.skypilot.cluster_name]),(0,w.useEffect)(()=>{if(t==null||e.skypilot.cloud?.toLowerCase()!==`aws`||!e.skypilot.cluster_name||!g||T)return;j.current=!1,r([]),y(!1),x(!1),A(x3),a(`Loading cached logs…`);let n=g===`live`?`/api/logs/${t}`:`/api/logs/${t}?attempt=${g}`,i=new EventSource(n),o=(e,t=!1)=>{let n=JSON.parse(e.data);r(e=>S3(e,n.events,t?`replace`:`live`).events),y(n.has_older),x(n.has_newer),a(``),t&&P.current&&(P.current=!1,j.current=!1,C(null),window.requestAnimationFrame(()=>M.current?.scrollToIndex({index:x3+n.events.length-1,align:`end`})))};return i.onmessage=o,i.addEventListener(`tail`,e=>o(e,!0)),i.onerror=()=>{P.current=!1,j.current=!1,C(null),a(`Waiting for cached log updates…`)},i.addEventListener(`complete`,()=>{i.close(),a(`— End of attempt —`)}),()=>i.close()},[t,e.skypilot.cloud,e.skypilot.cluster_name,g,T,D]);let te=async e=>{let i=ee.current,o=e===`older`?n[0]:n.at(-1);if(!(j.current||t==null||!g||g===`live`||!o||(e===`older`?!v:!b))){j.current=!0,C(e),e===`older`&&E(!0);try{let s=new URLSearchParams({attempt:g,[e===`older`?`before`:`after`]:`${o.timestamp}:${o.id}`}),c=await fetch(`/api/logs/${t}/page?${s}`);if(!c.ok)throw Error(await c.text());let l=await c.json();if(ee.current!==i)return;let u=S3(n,l.events,e);u.firstItemIndexDelta!==0&&A(e=>e+u.firstItemIndexDelta),r(u.events),y(l.has_older),x(l.has_newer),a(l.events.length?``:e===`older`?`— Start of attempt —`:`— End of attempt —`),e===`newer`&&!l.has_newer&&(E(!1),O(e=>e+1))}catch(e){a(e instanceof Error?e.message:String(e))}finally{ee.current===i&&(j.current=!1,C(null))}}},ne=async e=>{let n=ee.current;if(!(j.current||t==null||!g||g===`live`)){if(j.current=!0,C(e),a(`Loading ${e} of attempt…`),e===`end`){P.current=!0,E(!1),O(e=>e+1);return}E(!0);try{let e=new URLSearchParams({attempt:g,edge:`start`}),i=await fetch(`/api/logs/${t}/page?${e}`);if(!i.ok)throw Error(await i.text());let o=await i.json();if(ee.current!==n)return;r(o.events),y(o.has_older),x(o.has_newer),A(x3),a(o.events.length?``:`— Start of attempt —`),N.current=o.events.length>0}catch(e){a(e instanceof Error?e.message:String(e))}finally{ee.current===n&&(j.current=!1,C(null))}}};return t==null||e.skypilot.cloud?.toLowerCase()!==`aws`?(0,R.jsx)(nd,{color:`gray`,icon:(0,R.jsx)(Fh,{size:18}),children:`CloudWatch logs are unavailable for this run.`}):e.skypilot.cluster_name?(0,R.jsxs)(Vf,{withBorder:!0,padding:`lg`,children:[(0,R.jsxs)(nl,{mb:`md`,justify:`space-between`,align:`flex-end`,children:[(0,R.jsxs)(H,{children:[(0,R.jsxs)(nl,{gap:`xs`,children:[(0,R.jsx)(Fh,{size:20}),(0,R.jsx)(nh,{order:2,children:`CloudWatch logs`}),(0,R.jsx)(C3,{})]}),(0,R.jsx)(U,{c:`dimmed`,size:`sm`,children:`Served from the local raw cache`})]}),(0,R.jsxs)(nl,{gap:`xs`,align:`flex-end`,children:[(0,R.jsx)(mm,{label:`Attempt`,placeholder:`Finding attempts…`,value:g,onChange:e=>{E(!1),A(x3),_(e)},data:[...o.length===0?[{value:`live`,label:`Latest cached logs`}]:[],...o.map(e=>({value:e.attempt.toString(),label:`Attempt ${e.attempt}${e.current?` · current/live`:``} · PID ${e.pid}`}))],w:360}),u&&(0,R.jsx)(Rc,{size:`xs`,mb:`sm`}),(0,R.jsx)(fm,{label:m??void 0,disabled:!m,children:(0,R.jsxs)(Tf,{mb:`sm`,color:m?`red`:u?`blue`:o.length===c?`green`:`yellow`,variant:`light`,children:[u?`Backfilling${f==null?``:` · ${f.toLocaleString()} events`} · `:``,o.length,`/`,c||`?`,` attempts`]})})]})]}),(0,R.jsxs)(nl,{justify:`space-between`,mb:`xs`,children:[(0,R.jsxs)(nl,{gap:`xs`,children:[(0,R.jsx)(fm,{label:`Jump to start of attempt`,children:(0,R.jsx)(Kc,{"aria-label":`Jump to start of attempt`,variant:`light`,loading:S===`start`,disabled:!g||g===`live`,onClick:()=>void ne(`start`),children:(0,R.jsx)(Sh,{size:17})})}),(0,R.jsx)(fm,{label:`Jump to end of attempt`,children:(0,R.jsx)(Kc,{"aria-label":`Jump to end of attempt`,variant:`light`,loading:S===`end`,disabled:!g||g===`live`,onClick:()=>void ne(`end`),children:(0,R.jsx)(xh,{size:17})})}),(0,R.jsx)(U,{size:`xs`,c:`dimmed`,children:S?`Loading ${S} cached events…`:`Scroll to the top or bottom to load more`})]}),(0,R.jsxs)(U,{size:`xs`,c:`dimmed`,children:[n.length.toLocaleString(),` events in memory · maximum `,b3.toLocaleString()]})]}),(0,R.jsx)(H,{bg:`dark.9`,style:{height:620,overflow:`hidden`},children:(0,R.jsx)(A4,{ref:M,data:n,firstItemIndex:k,followOutput:!T&&`auto`,startReached:()=>void te(`older`),endReached:()=>void te(`newer`),computeItemKey:(e,t)=>t.id,itemContent:(e,t)=>(0,R.jsxs)(H,{px:`md`,py:2,c:`green.2`,ff:`monospace`,fz:`xs`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:[(0,R.jsxs)(`span`,{children:[`[`,new Date(t.timestamp).toLocaleTimeString(),`] `]}),(0,R.jsx)(`span`,{dangerouslySetInnerHTML:{__html:t.html}})]}),components:{Footer:()=>i?(0,R.jsx)(U,{c:`dimmed`,ff:`monospace`,fz:`xs`,p:`md`,children:i}):null}})})]}):(0,R.jsxs)(Vf,{withBorder:!0,padding:`lg`,children:[(0,R.jsxs)(nl,{gap:`xs`,mb:`sm`,children:[(0,R.jsx)(Fh,{size:20}),(0,R.jsx)(nh,{order:2,children:`CloudWatch logs`}),(0,R.jsx)(C3,{})]}),(0,R.jsxs)(nd,{color:`yellow`,icon:(0,R.jsx)(bh,{size:18}),children:[`Logs are not populated yet. SkyPilot reports this job as `,(0,R.jsx)(qf,{children:e.status.skypilot??`unknown`}),` and has not published its AWS cluster link. The collector will retry during refreshes.`]})]})}var T3=new Set([`PENDING`,`SUBMITTED`,`STARTING`,`RUNNING`,`WINDING_DOWN`,`RECOVERING`,`CANCELLING`,`AUTOSTOPPING`,`INIT`,`UP`]),E3=/(gpu|tpu|b200|h200|h100|a100|v100|l40|l4|t4|a10)/i;function D3(e){return e.filter(e=>T3.has(e.status.skypilot??``)).flatMap(e=>{let t=[],n=e.progress.completed_batches!=null||e.progress.tokens_per_second!=null;return E3.test(e.skypilot.resources??``)&&!n&&t.push(`Idle GPU candidate`),e.kind===`managed_job`&&e.wandb_id==null&&t.push(`Orphan candidate`),e.kind===`cluster`&&(e.timing.elapsed_seconds??0)>=172800&&t.push(`Zombie dev box candidate`),t.length?[{resource:e,reasons:t}]:[]})}function O3(e){return e.filter(e=>(e.retries.total_recoveries??0)>0||(e.retries.preemption_or_infrastructure??0)>0||(e.retries.application_error??0)>0).sort((e,t)=>(t.retries.total_recoveries??0)-(e.retries.total_recoveries??0))}function k3(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e)??{name:e,spend:0,hourly:0};i.spend+=r.cost.estimated_spend_usd??0,T3.has(r.status.skypilot??``)&&(i.hourly+=r.cost.hourly_usd??0),n.set(e,i)}return[...n.values()].filter(e=>e.spend>0||e.hourly>0).sort((e,t)=>t.spend-e.spend)}function A3(e,t){return t===`name`?`${e.user}/${e.project}/${e.name}`:t===`progress`?e.progress.progress_fraction??-1:t===`started`?e.timing.started_at??``:t===`cost`?e.cost.estimated_spend_usd??-1:`${e.skypilot.cloud}/${e.skypilot.region}`}function j3(e,t,n,r){if(n===`status`){let n=Number(t.status.skypilot?.toUpperCase()===`RUNNING`)-Number(e.status.skypilot?.toUpperCase()===`RUNNING`),i=(t.submitted_at??``).localeCompare(e.submitted_at??``),a=n||i||e.name.localeCompare(t.name,void 0,{numeric:!0});return r?-a:a}let i=A3(e,n),a=A3(t,n),o=typeof i==`number`&&typeof a==`number`?i-a:String(i).localeCompare(String(a),void 0,{numeric:!0});return r?-o:o}function M3({page:e,queryStatus:t,onOpenStatus:n,onRefresh:r}){let{colorScheme:i,setColorScheme:a}=Ft(),o=!!(t?.refresh.last_error||t?.queries.some(e=>e.status===`error`)),s=!!t?.queries.some(e=>e.status===`warning`),c=o?`red`:s?`yellow`:`green`;return(0,R.jsx)(Nd.Header,{px:`md`,className:`hud-header`,children:(0,R.jsxs)(nl,{h:`100%`,justify:`space-between`,wrap:`nowrap`,children:[(0,R.jsxs)(nl,{gap:`sm`,wrap:`nowrap`,children:[(0,R.jsx)(Ym,{className:`hud-logo`,size:`lg`,children:(0,R.jsx)(`img`,{src:`/static/dist/overwatch-favicon.svg`,width:30,height:30,alt:``})}),(0,R.jsx)(ld,{href:`/`,c:`inherit`,underline:`never`,className:`hud-brand`,children:`Overwatch`}),(0,R.jsx)(Tf,{color:c,variant:`light`,size:`xs`,children:o?`Degraded`:`Live`})]}),(0,R.jsxs)(nl,{gap:`xs`,wrap:`nowrap`,children:[(0,R.jsx)(Pf,{component:`a`,href:`/`,variant:e===`resources`||e===`run`?`light`:`subtle`,leftSection:(0,R.jsx)(Ph,{size:16}),children:`Resources`}),(0,R.jsx)(Pf,{component:`a`,href:`/cost-waste`,variant:e===`cost-waste`?`light`:`subtle`,leftSection:(0,R.jsx)(Oh,{size:16}),children:`Cost & waste`}),(0,R.jsx)(Pf,{component:`a`,href:`/billing`,variant:e===`billing`?`light`:`subtle`,leftSection:(0,R.jsx)(wh,{size:16}),children:`Billing`}),(0,R.jsx)(Pf,{variant:`subtle`,leftSection:(0,R.jsx)(Mh,{size:16}),loading:t?.refresh.in_progress??!1,onClick:r,children:`Refresh`}),(0,R.jsx)(Pf,{variant:`subtle`,color:c,leftSection:(0,R.jsx)(yh,{size:16}),onClick:n,children:`Status`}),(0,R.jsx)(mm,{"aria-label":`Color scheme`,allowDeselect:!1,data:[{value:`auto`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}],value:i,onChange:e=>e&&a(e),w:105})]})]})})}function N3({label:e,secondaryLabel:t,value:n,active:r,descending:i,onSort:a}){return(0,R.jsx)(W.Th,{children:(0,R.jsxs)(Rs,{fw:700,onClick:()=>a(n),children:[(0,R.jsxs)(`span`,{children:[e,` `,r?i?`↓`:`↑`:`↕`]}),t&&(0,R.jsx)(U,{component:`span`,display:`block`,size:`xs`,c:`dimmed`,fw:400,children:t})]})})}function P3({resource:e}){let t=[{label:`W&B`,url:e.links.wandb,color:`yellow`,icon:(0,R.jsx)(U,{component:`span`,size:`sm`,fw:900,c:`yellow.8`,children:`W`})},{label:`SkyPilot`,url:e.links.skypilot,color:`blue`,icon:(0,R.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 27 27`,"aria-hidden":`true`,children:(0,R.jsx)(`path`,{fill:`#094AD0`,fillRule:`evenodd`,d:`M19.94 25.75c-.08.31-.12.46-.18.55a.7.7 0 0 1-.91.25c-.1-.05-.22-.16-.45-.39l-7-7c-.15-.15-.22-.23-.28-.31a1.4 1.4 0 0 1-.24-.88c.01-.1.04-.2.1-.41l.6-2.27c.02-.07.03-.1.03-.13a.16.16 0 0 0-.15-.15c-.02 0-.06.01-.13.03l-2.26.61c-.21.06-.31.08-.41.09a1.4 1.4 0 0 1-.89-.23c-.08-.06-.15-.14-.3-.29l-7-7c-.23-.23-.34-.34-.4-.44a.7.7 0 0 1 .25-.91c.1-.06.25-.1.56-.19L25.38.12c.31-.08.47-.13.58-.12.36.02.65.31.67.67 0 .11-.04.27-.12.57l-6.57 24.51ZM5.49 8.37c-.14.04-.2.06-.25.09a.32.32 0 0 0-.1.41c.02.05.07.1.17.2l3.42 3.42c.06.06.09.09.12.11.1.07.21.1.33.09.04 0 .08-.02.15-.04l5.66-1.52c.14-.04.2-.05.25-.05.17.01.3.14.3.3.01.05 0 .12-.04.26l-1.52 5.65c-.02.08-.04.12-.04.16-.01.11.02.23.09.32.02.03.05.06.1.12l3.43 3.43c.1.1.15.15.2.17.14.08.32.03.4-.1.03-.05.05-.12.09-.26l4.5-16.76c.04-.14.06-.21.06-.26a.32.32 0 0 0-.3-.3c-.05 0-.12.01-.26.05L5.49 8.37Z`})})},{label:`Zymtrace`,url:e.links.zymtrace,color:`grape`,icon:(0,R.jsx)(`img`,{alt:``,src:`https://zymtrace.com/favicon.ico`,width:18,height:18})}];return(0,R.jsxs)(nl,{gap:4,wrap:`wrap`,maw:116,children:[t.map(({label:e,url:t,color:n,icon:r})=>t?(0,R.jsx)(fm,{label:e,children:(0,R.jsx)(Kc,{component:`a`,href:t,target:`_blank`,color:n,variant:`subtle`,"aria-label":e,children:r})},e):null),e.storage.run_uri&&(0,R.jsx)($f,{value:e.storage.run_uri,children:({copied:e,copy:t})=>(0,R.jsx)(fm,{label:e?`Copied`:`Copy storage URI`,children:(0,R.jsx)(Kc,{"aria-label":`Copy storage URI`,color:e?`green`:`gray`,variant:`subtle`,onClick:t,children:e?(0,R.jsx)(Th,{size:16}):(0,R.jsx)(kh,{size:16})})})})]})}function F3({resource:e}){return e.skypilot.job_id==null?(0,R.jsx)(U,{fw:600,children:e.name}):(0,R.jsx)(ld,{fw:600,href:`/runs/${e.skypilot.job_id}`,children:e.name})}function I3({resources:e}){let[t,n]=(0,w.useState)(`status`),[r,i]=(0,w.useState)(!1),[a,o]=(0,w.useState)(``),s=(0,w.useMemo)(()=>{let n=a.trim().toLocaleLowerCase();return[...n?e.filter(e=>[e.name,e.user,e.project,e.wandb_id,e.git.commit,e.kind,e.status.skypilot,e.status.wandb,e.skypilot.job_id,e.skypilot.job_name,e.skypilot.cluster_name,e.skypilot.resources,e.skypilot.cloud,e.skypilot.region].filter(e=>e!=null).some(e=>String(e).toLocaleLowerCase().includes(n))):e].sort((e,n)=>j3(e,n,t,r))},[r,e,a,t]),c=e=>{t===e?i(e=>!e):(n(e),i(!1))};return(0,R.jsx)(R.Fragment,{children:(0,R.jsxs)(Vf,{withBorder:!0,padding:0,children:[e.length>1&&(0,R.jsx)(H,{p:`md`,children:(0,R.jsx)(Km,{"aria-label":`Search resources`,placeholder:`Search resources by name, user, project, status, cloud, region, or job ID…`,leftSection:(0,R.jsx)(Nh,{size:17}),rightSection:(0,R.jsxs)(U,{size:`xs`,c:`dimmed`,children:[s.length,`/`,e.length]}),rightSectionWidth:64,value:a,onChange:e=>o(e.currentTarget.value)})}),(0,R.jsx)(W.ScrollContainer,{minWidth:0,children:(0,R.jsxs)(W,{className:`resources-table`,striped:!0,highlightOnHover:!0,verticalSpacing:`sm`,children:[(0,R.jsxs)(`colgroup`,{children:[(0,R.jsx)(`col`,{style:{width:`21%`}}),(0,R.jsx)(`col`,{style:{width:`16%`}}),(0,R.jsx)(`col`,{style:{width:`7%`}}),(0,R.jsx)(`col`,{style:{width:`13%`}}),(0,R.jsx)(`col`,{style:{width:`9%`}}),(0,R.jsx)(`col`,{style:{width:`10%`}}),(0,R.jsx)(`col`,{style:{width:`10%`}}),(0,R.jsx)(`col`,{style:{width:`10%`}}),(0,R.jsx)(`col`,{style:{width:`4%`}})]}),(0,R.jsx)(W.Thead,{children:(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(N3,{label:`User / job ID`,secondaryLabel:`project / experiment`,value:`name`,active:t===`name`,descending:r,onSort:c}),(0,R.jsx)(N3,{label:`Status`,secondaryLabel:`running, then newest submitted`,value:`status`,active:t===`status`,descending:r,onSort:c}),(0,R.jsx)(W.Th,{children:`Git checkout`}),(0,R.jsx)(N3,{label:`Progress`,value:`progress`,active:t===`progress`,descending:r,onSort:c}),(0,R.jsxs)(W.Th,{children:[`Retries`,(0,R.jsx)(U,{size:`xs`,c:`dimmed`,fw:400,children:`total | preempts | error`})]}),(0,R.jsx)(N3,{label:`Started`,secondaryLabel:`elapsed > time left`,value:`started`,active:t===`started`,descending:r,onSort:c}),(0,R.jsx)(N3,{label:`Cost`,secondaryLabel:`spent / projected · $/hr`,value:`cost`,active:t===`cost`,descending:r,onSort:c}),(0,R.jsx)(N3,{label:`Cloud / region`,secondaryLabel:`instance resources`,value:`cloud`,active:t===`cloud`,descending:r,onSort:c}),(0,R.jsx)(W.Th,{children:`Links`})]})}),(0,R.jsxs)(W.Tbody,{children:[s.length===0&&(0,R.jsx)(W.Tr,{children:(0,R.jsx)(W.Td,{colSpan:9,children:(0,R.jsx)(Wf,{py:`xl`,children:(0,R.jsxs)(U,{c:`dimmed`,children:[`No resources match “`,a.trim(),`”.`]})})})}),s.map(e=>{let t=Math.max(0,Math.min(100,(e.progress.progress_fraction??0)*100));return(0,R.jsxs)(W.Tr,{children:[(0,R.jsxs)(W.Td,{children:[(0,R.jsxs)(U,{size:`xs`,c:`dimmed`,children:[e.user??`—`,` / `,e.skypilot.job_id??`—`]}),(0,R.jsxs)(Dm,{gap:0,children:[(0,R.jsxs)(nl,{gap:4,wrap:`nowrap`,children:[e.project&&e.links.wandb?(0,R.jsx)(ld,{href:e.links.wandb.split(`/runs/`,1)[0],target:`_blank`,rel:`noreferrer`,children:e.project}):(0,R.jsx)(U,{children:e.project??`—`}),(0,R.jsx)(U,{children:`/`})]}),(0,R.jsx)(F3,{resource:e})]})]}),(0,R.jsx)(W.Td,{children:(0,R.jsxs)(Dm,{gap:4,align:`flex-start`,children:[e.status.wandb&&(0,R.jsxs)(Tf,{color:$$(e.status.wandb),variant:`light`,children:[`W&B · `,e.status.wandb]}),(0,R.jsxs)(Tf,{color:$$(e.status.skypilot),variant:`light`,children:[`Sky · `,e.status.skypilot??`unknown`]})]})}),(0,R.jsx)(W.Td,{children:e.git.commit&&e.git.url?(0,R.jsx)(ld,{ff:`monospace`,href:e.git.url,target:`_blank`,rel:`noreferrer`,children:e.git.commit.slice(0,8)}):(0,R.jsx)(U,{c:`dimmed`,children:`—`})}),(0,R.jsxs)(W.Td,{children:[e.progress.total_batches?(0,R.jsxs)(Dm,{gap:4,children:[(0,R.jsxs)(U,{size:`xs`,children:[e.progress.completed_batches?.toLocaleString(),`/`,e.progress.total_batches.toLocaleString(),` batches`]}),(0,R.jsx)(Qp.Root,{size:`lg`,autoContrast:!0,children:(0,R.jsx)(Qp.Section,{value:t,children:(0,R.jsxs)(Qp.Label,{children:[Math.round(t),`%`]})})})]}):(0,R.jsx)(U,{c:`dimmed`,children:`—`}),e.progress.tokens_per_second!=null&&(0,R.jsxs)(U,{size:`xs`,c:`dimmed`,mt:4,children:[e.progress.tokens_per_second.toLocaleString(),` tok/s`]})]}),(0,R.jsxs)(W.Td,{children:[e.retries.total_recoveries??`?`,` | `,e.retries.preemption_or_infrastructure??`?`,` | `,e.retries.application_error??`?`]}),(0,R.jsxs)(W.Td,{children:[(0,R.jsx)(U,{size:`xs`,c:`dimmed`,children:Z$(e.timing.started_at)}),(0,R.jsxs)(U,{children:[Q$(e.timing.elapsed_seconds),` > `,Q$(e.progress.estimated_remaining_seconds)]})]}),(0,R.jsxs)(W.Td,{children:[(0,R.jsxs)(U,{children:[X$(e.cost.estimated_spend_usd),` / `,X$(e.cost.estimated_total_usd)]}),(0,R.jsxs)(U,{size:`xs`,c:`dimmed`,children:[X$(e.cost.hourly_usd),`/hr`]})]}),(0,R.jsxs)(W.Td,{children:[(0,R.jsx)(U,{children:e.skypilot.cloud??`—`}),(0,R.jsx)(U,{size:`xs`,c:`dimmed`,children:e.skypilot.region??`—`}),(0,R.jsx)(U,{size:`xs`,ff:`monospace`,mt:3,style:{overflowWrap:`anywhere`},children:e.skypilot.resources??`—`})]}),(0,R.jsx)(W.Td,{children:(0,R.jsx)(P3,{resource:e})})]},`${e.kind}-${e.skypilot.job_id??e.name}`)})]})]})})]})})}function L3({projects:e}){return e.length?(0,R.jsx)(Dm,{gap:`lg`,children:e.map(e=>(0,R.jsxs)(Vf,{withBorder:!0,children:[(0,R.jsx)(nh,{order:3,mb:`md`,children:e.project}),(0,R.jsx)(W.ScrollContainer,{minWidth:700,children:(0,R.jsxs)(W,{striped:!0,withColumnBorders:!0,children:[(0,R.jsx)(W.Thead,{children:(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Th,{children:`Field`}),e.runs.map(e=>(0,R.jsx)(W.Th,{children:(0,R.jsx)(ld,{href:e.wandb_url??void 0,target:`_blank`,rel:`noreferrer`,children:e.experiment_name})},e.wandb_id))]})}),(0,R.jsx)(W.Tbody,{children:e.fields.map(e=>(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Td,{children:(0,R.jsx)(qf,{children:e.field})}),e.values.map(e=>(0,R.jsx)(W.Td,{children:(0,R.jsx)(qf,{children:e.missing?``:JSON.stringify(e.value)})},e.wandb_id))]},e.field))})]})})]},e.project))}):(0,R.jsx)(U,{c:`dimmed`,children:`No differing TrainConfig fields.`})}function R3({report:e}){let t=e.resources.filter(e=>T3.has(e.status.skypilot??``)),n=t.reduce((e,t)=>e+(t.cost.hourly_usd??0),0),r=e.resources.reduce((e,t)=>e+(t.cost.estimated_spend_usd??0),0),i=t.reduce((e,t)=>e+(t.cost.estimated_total_usd??0),0);return(0,R.jsxs)(Dm,{gap:`xl`,children:[(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:1,children:`Resource overview`}),(0,R.jsxs)(U,{c:`dimmed`,children:[e.resources.length,` cloud resources · generated `,Z$(e.generated_at)]})]}),(0,R.jsx)(t1,{warnings:e.warnings}),(0,R.jsxs)(Cm,{cols:{base:1,sm:3},children:[(0,R.jsx)(n1,{label:`Live burn rate`,value:`${X$(n)}/hr`}),(0,R.jsx)(n1,{label:`Spent so far`,value:X$(r)}),(0,R.jsx)(n1,{label:`Active projected total`,value:X$(i)})]}),(0,R.jsxs)(H,{id:`resources`,children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Resources`}),(0,R.jsx)(I3,{resources:e.resources})]}),(0,R.jsxs)(H,{id:`config`,children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Running Job TrainConfig Deltas`}),(0,R.jsx)(L3,{projects:e.config_differences})]})]})}function z3({report:e,jobId:t}){let n=e.resources.find(e=>e.skypilot.job_id===t);return n?(0,R.jsxs)(Dm,{gap:`xl`,children:[(0,R.jsxs)(H,{children:[(0,R.jsx)(Pf,{component:`a`,href:`/`,variant:`subtle`,leftSection:(0,R.jsx)(Ch,{size:16}),mb:`sm`,children:`All resources`}),(0,R.jsxs)(nl,{justify:`space-between`,align:`flex-start`,children:[(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:1,children:n.name}),(0,R.jsxs)(U,{c:`dimmed`,children:[`SkyPilot job `,t,` · `,n.user??`Unknown user`,` · `,n.project??`No W&B project`]})]}),(0,R.jsxs)(nl,{gap:`xs`,children:[n.status.wandb&&(0,R.jsxs)(Tf,{color:$$(n.status.wandb),size:`lg`,variant:`light`,children:[`W&B · `,n.status.wandb]}),(0,R.jsxs)(Tf,{color:$$(n.status.skypilot),size:`lg`,variant:`light`,children:[`Sky · `,n.status.skypilot??`unknown`]})]})]})]}),(n.cache?.missing_files.length??0)>0&&(0,R.jsxs)(nd,{color:`yellow`,icon:(0,R.jsx)(bh,{size:18}),title:`Raw cache is incomplete`,children:[`Missing cached `,n.cache.missing_files.length===1?`file`:`files`,`: `,n.cache.missing_files.map((e,t)=>(0,R.jsxs)(w.Fragment,{children:[t>0&&`, `,(0,R.jsx)(qf,{children:e}),n.cache.errors[e]&&` (${n.cache.errors[e]})`]},e)),`. W&B and TrainConfig files may remain unavailable until the workload initializes them.`]}),(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Run telemetry`}),(0,R.jsx)(I3,{resources:[n]})]}),(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Extra Info`}),(0,R.jsx)(Vf,{withBorder:!0,padding:0,children:(0,R.jsxs)(W,{verticalSpacing:`sm`,withColumnBorders:!0,children:[(0,R.jsx)(W.Thead,{children:(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Th,{children:`Raw cache directory`}),(0,R.jsx)(W.Th,{children:`TrainConfig run_dir`})]})}),(0,R.jsx)(W.Tbody,{children:(0,R.jsx)(W.Tr,{children:[{label:`Raw cache directory`,value:`${e.raw_cache_root??`~/.cache/overwatch/raw-v1`}/jobs/${t}`},{label:`TrainConfig run_dir`,value:n.storage.run_uri}].map(({label:e,value:t})=>(0,R.jsx)(W.Td,{w:`50%`,children:(0,R.jsxs)(nl,{justify:`space-between`,wrap:`nowrap`,align:`flex-start`,children:[(0,R.jsx)(qf,{style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:t??`—`}),(0,R.jsx)($f,{value:t??``,children:({copied:n,copy:r})=>(0,R.jsx)(fm,{label:n?`Copied`:`Copy ${e}`,children:(0,R.jsx)(Kc,{"aria-label":`Copy ${e}`,color:n?`green`:`gray`,variant:`subtle`,disabled:!t,onClick:r,children:n?(0,R.jsx)(Th,{size:16}):(0,R.jsx)(Dh,{size:16})})})})]})},e))})})]})})]}),(0,R.jsx)(w3,{resource:n})]}):(0,R.jsxs)(nd,{color:`yellow`,icon:(0,R.jsx)(bh,{size:18}),children:[`Job `,t,` is not present in the retained SkyPilot cache.`]})}function B3({title:e,rows:t}){let n=Math.max(...t.map(e=>e.spend),0);return(0,R.jsxs)(Vf,{withBorder:!0,children:[(0,R.jsx)(nh,{order:3,mb:`md`,children:e}),t.length?(0,R.jsx)(Dm,{gap:`md`,children:t.map(e=>(0,R.jsxs)(H,{children:[(0,R.jsxs)(nl,{justify:`space-between`,wrap:`nowrap`,children:[(0,R.jsx)(U,{fw:600,truncate:!0,children:e.name}),(0,R.jsx)(U,{size:`sm`,children:X$(e.spend)})]}),(0,R.jsx)(Qp,{value:n?e.spend/n*100:0,mt:4}),(0,R.jsxs)(U,{c:`dimmed`,size:`xs`,children:[X$(e.hourly),`/hr currently active`]})]},e.name))}):(0,R.jsx)(U,{c:`dimmed`,children:`No attributable resource spend.`})]})}function V3({report:e}){let t=D3(e.resources),n=t.reduce((e,t)=>e+(t.resource.cost.hourly_usd??0),0),r=O3(e.resources),i=t=>k3(e.resources,t);return(0,R.jsxs)(Dm,{gap:`xl`,children:[(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:1,children:`Cost & waste`}),(0,R.jsx)(U,{c:`dimmed`,children:`Resource-cost estimates and actionable utilization signals from the retained SkyPilot inventory`})]}),(0,R.jsx)(nd,{color:`blue`,icon:(0,R.jsx)(bh,{size:18}),children:`Waste flags are candidates for review, not proof of inactivity. Progress is inferred from W&B and training logs; spend below uses Sky catalog estimates rather than provider billing allocation.`}),(0,R.jsxs)(Cm,{cols:{base:1,sm:3},children:[(0,R.jsx)(n1,{label:`Waste candidates`,value:t.length.toLocaleString()}),(0,R.jsx)(n1,{label:`Candidate burn rate`,value:`${X$(n)}/hr`}),(0,R.jsx)(n1,{label:`Recoveries retained`,value:r.reduce((e,t)=>e+(t.retries.total_recoveries??0),0).toLocaleString()})]}),(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Idle, orphaned, and zombie candidates`}),(0,R.jsx)(Vf,{withBorder:!0,padding:0,children:(0,R.jsx)(W.ScrollContainer,{minWidth:900,children:(0,R.jsxs)(W,{striped:!0,highlightOnHover:!0,children:[(0,R.jsx)(W.Thead,{children:(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Th,{children:`Resource`}),(0,R.jsx)(W.Th,{children:`Signals`}),(0,R.jsx)(W.Th,{children:`Age`}),(0,R.jsx)(W.Th,{children:`Burn rate`}),(0,R.jsx)(W.Th,{children:`Cloud`}),(0,R.jsx)(W.Th,{children:`Links`})]})}),(0,R.jsxs)(W.Tbody,{children:[t.map(({resource:e,reasons:t})=>(0,R.jsxs)(W.Tr,{children:[(0,R.jsxs)(W.Td,{children:[(0,R.jsx)(F3,{resource:e}),(0,R.jsx)(U,{c:`dimmed`,size:`xs`,children:e.user??`Unknown user`})]}),(0,R.jsx)(W.Td,{children:(0,R.jsx)(nl,{gap:4,children:t.map(e=>(0,R.jsx)(Tf,{color:`yellow`,variant:`light`,children:e},e))})}),(0,R.jsx)(W.Td,{children:Q$(e.timing.elapsed_seconds)}),(0,R.jsxs)(W.Td,{children:[X$(e.cost.hourly_usd),`/hr`]}),(0,R.jsx)(W.Td,{children:e.skypilot.cloud??`—`}),(0,R.jsx)(W.Td,{children:(0,R.jsx)(P3,{resource:e})})]},`${e.kind}-${e.skypilot.job_id??e.name}`)),!t.length&&(0,R.jsx)(W.Tr,{children:(0,R.jsx)(W.Td,{colSpan:6,children:(0,R.jsx)(U,{c:`dimmed`,children:`No candidates detected.`})})})]})]})})})]}),(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Spend by owner and infrastructure`}),(0,R.jsxs)(Cm,{cols:{base:1,lg:3},children:[(0,R.jsx)(B3,{title:`By user`,rows:i(e=>e.user??`Unknown user`)}),(0,R.jsx)(B3,{title:`By project`,rows:i(e=>e.project??`Unassigned`)}),(0,R.jsx)(B3,{title:`By cloud`,rows:i(e=>e.skypilot.cloud??`Unknown cloud`)})]})]}),(0,R.jsxs)(H,{children:[(0,R.jsx)(nh,{order:2,mb:`md`,children:`Recovery and preemption history`}),(0,R.jsx)(Vf,{withBorder:!0,padding:0,children:(0,R.jsx)(W.ScrollContainer,{minWidth:800,children:(0,R.jsxs)(W,{striped:!0,highlightOnHover:!0,children:[(0,R.jsx)(W.Thead,{children:(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Th,{children:`Resource`}),(0,R.jsx)(W.Th,{children:`Started`}),(0,R.jsx)(W.Th,{children:`Total recoveries`}),(0,R.jsx)(W.Th,{children:`Preemption / infrastructure`}),(0,R.jsx)(W.Th,{children:`Application errors`}),(0,R.jsx)(W.Th,{children:`Links`})]})}),(0,R.jsxs)(W.Tbody,{children:[r.map(e=>(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Td,{children:(0,R.jsx)(F3,{resource:e})}),(0,R.jsx)(W.Td,{children:Z$(e.timing.started_at)}),(0,R.jsx)(W.Td,{children:e.retries.total_recoveries??`—`}),(0,R.jsx)(W.Td,{children:e.retries.preemption_or_infrastructure??`—`}),(0,R.jsx)(W.Td,{children:e.retries.application_error??`—`}),(0,R.jsx)(W.Td,{children:(0,R.jsx)(P3,{resource:e})})]},`${e.kind}-${e.skypilot.job_id??e.name}`)),!r.length&&(0,R.jsx)(W.Tr,{children:(0,R.jsx)(W.Td,{colSpan:6,children:(0,R.jsx)(U,{c:`dimmed`,children:`No recoveries in the retained inventory.`})})})]})]})})})]})]})}function H3({opened:e,onClose:t,queryStatus:n}){let[r,i]=(0,w.useState)(null),a=async(e,t)=>{i({title:t,content:`Loading raw output…`});try{let n=await fetch(`/api/status/${e}/raw`,{cache:`no-store`}),r=await n.json();if(!n.ok)throw Error(`Raw query request failed (${n.status})`);i({title:t,content:JSON.stringify(r,null,2)})}catch(e){i({title:t,content:String(e)})}};return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Hp,{opened:e,onClose:t,title:`Overwatch query status`,size:`xl`,children:n?(0,R.jsxs)(Dm,{gap:`md`,children:[(0,R.jsxs)(nl,{gap:`lg`,children:[(0,R.jsxs)(U,{size:`sm`,children:[`Last attempt: `,Z$(n.refresh.last_attempt_at)]}),(0,R.jsxs)(U,{size:`sm`,children:[`Last success: `,Z$(n.refresh.last_success_at)]}),(0,R.jsxs)(U,{size:`sm`,children:[`Duration: `,n.refresh.last_duration_seconds==null?`—`:`${n.refresh.last_duration_seconds.toFixed(1)}s`]}),n.refresh.in_progress&&(0,R.jsx)(Tf,{color:`blue`,children:`Refreshing`})]}),n.refresh.last_error&&(0,R.jsx)(nd,{color:`red`,title:`Last refresh failed`,icon:(0,R.jsx)(bh,{size:18}),children:n.refresh.last_error}),(0,R.jsx)(W.ScrollContainer,{minWidth:700,children:(0,R.jsxs)(W,{striped:!0,highlightOnHover:!0,children:[(0,R.jsx)(W.Thead,{children:(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Th,{children:`Query`}),(0,R.jsx)(W.Th,{children:`Status`}),(0,R.jsx)(W.Th,{children:`Duration`}),(0,R.jsx)(W.Th,{children:`Summary`}),(0,R.jsx)(W.Th,{children:`Updated`}),(0,R.jsx)(W.Th,{children:`Output`})]})}),(0,R.jsx)(W.Tbody,{children:n.queries.map(e=>(0,R.jsxs)(W.Tr,{children:[(0,R.jsx)(W.Td,{children:e.label}),(0,R.jsx)(W.Td,{children:(0,R.jsx)(Tf,{color:e1(e.status),children:e.status})}),(0,R.jsx)(W.Td,{children:e.duration_seconds==null?`—`:`${e.duration_seconds.toFixed(2)}s`}),(0,R.jsx)(W.Td,{children:e.error??e.summary}),(0,R.jsx)(W.Td,{children:Z$(e.updated_at)}),(0,R.jsx)(W.Td,{children:(0,R.jsx)(ld,{component:`button`,type:`button`,onClick:()=>void a(e.key,e.label),children:(0,R.jsxs)(nl,{gap:4,wrap:`nowrap`,children:[(0,R.jsx)(Eh,{size:15}),` Raw`]})})})]},e.key))})]})})]}):(0,R.jsx)(Wf,{h:160,children:(0,R.jsx)(Rc,{})})}),(0,R.jsx)(yp,{opened:r!=null,onClose:()=>i(null),title:`Raw query output · ${r?.title??``}`,position:`right`,size:`xl`,zIndex:300,children:(0,R.jsx)(Ps,{h:`calc(100vh - 100px)`,type:`auto`,children:(0,R.jsx)(qf,{block:!0,children:r?.content})})})]})}function U3(){let[e,t]=(0,w.useState)(null),[n,r]=(0,w.useState)(null),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!1),c=(0,w.useRef)(null),l=window.location.pathname.match(/^\/runs\/(\d+)\/?$/),u=l?Number(l[1]):null,d=window.location.pathname===`/billing`?`billing`:window.location.pathname===`/cost-waste`?`cost-waste`:u==null?`resources`:`run`;(0,w.useEffect)(()=>{let e=!1,n,i=async()=>{try{let a=await fetch(`/api/report`,{cache:`no-store`});if(a.status===202){let t=await a.json();e||(r(t.error),n=window.setTimeout(i,750));return}if(!a.ok)throw Error(`Report request failed (${a.status})`);let o=await a.json();e||(t(o),r(null))}catch(t){e||(r(String(t)),n=window.setTimeout(i,1e3))}};i(),(async()=>{try{let t=await fetch(`/api/status`,{cache:`no-store`});if(!t.ok)throw Error(`Status request failed (${t.status})`);let n=await t.json();e||a(n)}catch{}})();let o=window.setInterval(async()=>{try{let[t,n]=await Promise.all([fetch(`/api/health`,{cache:`no-store`}),fetch(`/api/status`,{cache:`no-store`})]),r=await t.json();n.ok&&!e&&a(await n.json());let o=c.current;c.current=r,o&&r.startup_id!==o.startup_id?window.location.reload():o&&r.report_version!==o.report_version&&await i()}catch{}},2e3);return()=>{e=!0,window.clearInterval(o),window.clearTimeout(n)}},[]);let f=async()=>{try{let e=await fetch(`/api/refresh`,{method:`POST`});if(!e.ok)throw Error(`Refresh request failed (${e.status})`);a(e=>e&&{...e,refresh:{...e.refresh,in_progress:!0}}),r(null)}catch(e){r(String(e))}},p=i?.queries.filter(e=>e.status===`error`)??[];return(0,R.jsxs)(Nd,{header:{height:60},padding:`lg`,children:[(0,R.jsx)(M3,{page:d,queryStatus:i,onOpenStatus:()=>s(!0),onRefresh:()=>void f()}),(0,R.jsxs)(Nd.Main,{className:`hud-main`,children:[n&&(0,R.jsx)(nd,{color:`red`,children:n}),(i?.refresh.last_error||p.length>0)&&(0,R.jsxs)(nd,{color:`red`,title:`Overwatch query failure`,icon:(0,R.jsx)(bh,{size:18}),mb:`md`,children:[i?.refresh.last_error??`${p.map(e=>e.label).join(`, `)} failed.`,` The last successful report remains visible; open Status for details and raw outputs.`]}),!e&&(0,R.jsx)(Wf,{h:300,children:(0,R.jsxs)(Dm,{align:`center`,gap:`sm`,children:[(0,R.jsx)(Rc,{}),(0,R.jsx)(U,{c:`dimmed`,children:`Loading cloud inventory…`})]})}),e&&d===`resources`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(R3,{report:e}),(0,R.jsx)(gh,{runs:e.model_runs??[],warnings:e.model_run_warnings??[]})]}),e&&d===`billing`&&(0,R.jsx)(r1,{report:e}),e&&d===`cost-waste`&&(0,R.jsx)(V3,{report:e}),e&&d===`run`&&u!=null&&(0,R.jsx)(z3,{report:e,jobId:u})]}),(0,R.jsx)(H3,{opened:o,onClose:()=>s(!1),queryStatus:i})]})}var W3=fn({colors:{overwatch:[`#fff4e6`,`#ffe8cc`,`#ffd09b`,`#ffb45c`,`#fa9c1e`,`#e9840b`,`#cc6d00`,`#a95800`,`#874600`,`#6d3700`]},primaryColor:`overwatch`,primaryShade:{light:5,dark:4},defaultRadius:`xs`,defaultGradient:{from:`overwatch.4`,to:`overwatch.6`,deg:110},fontFamily:`Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,headings:{fontFamily:`"Avenir Next Condensed", "Arial Narrow", Inter, sans-serif`,fontWeight:`800`}});(0,oh.createRoot)(document.getElementById(`root`)).render((0,R.jsx)(w.StrictMode,{children:(0,R.jsx)(dn,{defaultColorScheme:`auto`,theme:W3,children:(0,R.jsx)(U3,{})})})); \ No newline at end of file diff --git a/src/overwatch/static/dist/index.html b/src/overwatch/static/dist/index.html index dbc675a..91c9e65 100644 --- a/src/overwatch/static/dist/index.html +++ b/src/overwatch/static/dist/index.html @@ -6,7 +6,7 @@ Overwatch - + diff --git a/tests/test_ci_prerequisites.py b/tests/test_ci_prerequisites.py new file mode 100644 index 0000000..0b48375 --- /dev/null +++ b/tests/test_ci_prerequisites.py @@ -0,0 +1,113 @@ +"""Pure prerequisite/workflow contract checks, not authenticated backend evidence.""" +from __future__ import annotations + +import importlib.util +import subprocess +import sys +from pathlib import Path + +import pytest +import yaml + +ROOT = Path(__file__).resolve().parents[1] +SPEC = importlib.util.spec_from_file_location("overwatch_ci_prerequisites", ROOT / "scripts/ci_prerequisites.py") +assert SPEC is not None and SPEC.loader is not None +MODULE = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(MODULE) + + +def authorized_shape(): + return { + "GITHUB_REPOSITORY": "fixture/Overwatch", + "OVERWATCH_CI_HEAD_REPOSITORY": "fixture/Overwatch", + "UV_INDEX_TSCORE_PASSWORD": "synthetic-not-a-real-credential", + } + + +@pytest.mark.parametrize("version", [(3, 12, 99), (3, 13, 5), (3, 13, 11), (3, 14, 0), (4, 0, 0)]) +def test_unsupported_python_is_not_a_pass(version): + assert MODULE.blockers(version, authorized_shape(), ci=True) == [ + "unsupported_python_requires_3_13_12_to_before_3_14", + ] + + +@pytest.mark.parametrize("version", [(3, 13, 12), (3, 13, 13), (3, 13, 99)]) +def test_supported_python_only_establishes_prerequisite_shape(version): + assert MODULE.blockers(version, authorized_shape(), ci=True) == [] + + +def test_local_preserves_external_keyring_route(): + assert MODULE.blockers((3, 13, 12), {}, ci=False) == [] + + +def test_missing_token_is_blocked(): + env = authorized_shape() + env.pop("UV_INDEX_TSCORE_PASSWORD") + assert MODULE.blockers((3, 13, 12), env, ci=True) == ["missing_authorized_tscore_index_token"] + + +@pytest.mark.parametrize("head", ["", "other/fork"]) +def test_untrusted_or_unknown_repo_is_blocked(head): + env = authorized_shape() + env["OVERWATCH_CI_HEAD_REPOSITORY"] = head + reasons = MODULE.blockers((3, 13, 12), env, ci=True) + assert reasons == ["credentialed_backend_requires_reviewed_same_repository_code"] + assert env["UV_INDEX_TSCORE_PASSWORD"] not in repr(reasons) + + +def test_cli_missing_prerequisites_is_nonzero_and_secret_safe(): + import os + env = dict(os.environ) + for key in ("GITHUB_REPOSITORY", "OVERWATCH_CI_HEAD_REPOSITORY", "UV_INDEX_TSCORE_PASSWORD"): + env.pop(key, None) + result = subprocess.run([sys.executable, str(ROOT / "scripts/ci_prerequisites.py"), "--ci"], + env=env, text=True, capture_output=True, timeout=10, check=False) + assert result.returncode == 2 + assert "missing_authorized_tscore_index_token" in result.stdout + assert not result.stderr + + +def workflow(): + return yaml.load((ROOT / ".github/workflows/ci.yml").read_text(), Loader=yaml.BaseLoader) + + +def test_workflow_never_uses_privileged_pr_trigger_or_suppresses_failure(): + text = (ROOT / ".github/workflows/ci.yml").read_text() + data = workflow() + assert set(data["on"]) == {"pull_request", "push", "workflow_dispatch"} + assert "pull_request_target" not in text + assert "continue-on-error" not in text + assert data["permissions"] == {"contents": "read"} + assert all("if" not in job for job in data["jobs"].values()) + + +def test_credentials_only_reach_preflight_and_locked_install(): + data = workflow() + backend = data["jobs"]["backend"] + assert backend["environment"] == "overwatch-ci" + assert "env" not in backend + secret_steps = [step for step in backend["steps"] if "secrets." in repr(step)] + assert len(secret_steps) == 2 + assert {step["run"] for step in secret_steps} == { + "python scripts/ci_prerequisites.py --ci", + "uv sync --locked --group dev --python 3.13.12", + } + assert "secrets." not in repr(data["jobs"]["frontend"]) + assert "cache" not in repr(data["jobs"]) + + +def test_workflow_pin_and_required_commands(): + import re + data = workflow() + steps = [step for job in data["jobs"].values() for step in job["steps"]] + uses = [step["uses"] for step in steps if "uses" in step] + assert all(re.fullmatch(r"actions/[\w-]+@[a-f0-9]{40}", ref) for ref in uses) + runs = [step["run"] for step in steps if "run" in step] + for command in ["npm ci --ignore-scripts --no-audit --no-fund", "npm run typecheck", + "npm test", "npm run build", "uv run --locked --no-sync ruff check src tests scripts", + "uv run --locked --no-sync pytest -q -ra --junitxml=backend-junit.xml"]: + assert command in runs + python_steps = [step for step in steps if step.get("uses", "").startswith("actions/setup-python@")] + assert len(python_steps) == 1 and python_steps[0]["with"]["python-version"] == "3.13.12" + assert data["jobs"]["backend"]["name"] == "backend-lint-and-locked-tests" + assert data["jobs"]["frontend"]["name"] == "frontend-typecheck-vitest-build" diff --git a/tests/test_kev_laya_cache_versions.py b/tests/test_kev_laya_cache_versions.py new file mode 100644 index 0000000..f80b662 --- /dev/null +++ b/tests/test_kev_laya_cache_versions.py @@ -0,0 +1,138 @@ +"""Direct adapter boundary tests; these are synthetic cache data, not live telemetry.""" +from copy import deepcopy +from datetime import UTC, datetime + +import pytest + +from overwatch.kev_laya_adapter import CACHE_VERSION, merge_snapshots, presentation +from overwatch.kev_laya_contract import validate_snapshot + +NOW = datetime(2026, 9, 27, 0, 0, tzinfo=UTC) +BAD_VERSIONS = [[], {}, None, True, False, 1, 2.0, "", "kev_laya/raw/3"] + + +def snapshot(): + """A schema-valid historical v1 snapshot, explicitly synthetic.""" + return { + "schema_version": 1, "framework": "kev_laya", "framework_version": "test-fixture", + "experiment_id": "test-experiment", "run_id": "test-run", "attempt_id": "test-attempt", + "attempt_index": 0, "parent_attempt_id": None, "sequence": 1, + "started_at": NOW.isoformat(), "updated_at": NOW.isoformat(), + "heartbeat_at": NOW.isoformat(), "phase": "train", "scheduler": None, "wandb": None, + "progress": { + "optimizer_steps": 7, "microbatches": 14, "examples": 28, "forward_tokens": 100, + "epoch": None, "totals": {}, "elapsed_seconds": 1, "eta_seconds": None, + "tokens_per_second": None, + }, + "metrics": {"loss/ce": 0.75}, "history": [], "artifacts": [], + "provenance": { + "model": "fixture", "backbone": "fixture", "backbone_revision": "fixture", + "tokenizer": "fixture", "config_sha256": "0" * 64, "data_sha256": "1" * 64, + "split_hashes": {}, "seed": 0, "repository": None, "commit": None, + "precision": "fixture", "hardware": "fixture", "evidence_class": "synthetic", + "context_limits": {"branch": 32, "aggregate": 64}, + }, + "serving": { + "requests": 0, "errors": 0, "input_tokens": 0, "forward_tokens": 0, + "output_tokens": 0, "questions": 0, "prefix_reuses": 0, "latency_ms": [], + }, + "resume": {"capable": False, "checkpoint_sha256": None}, + "recoveries": {"total": 7, "infrastructure": None, "application": None}, + "cost": {"measured_usd": None, "estimated_usd": None, "basis": None}, + "monitoring_export_failures": 0, + } + + +def envelope(version): + snap = snapshot() + validate_snapshot(snap, now=NOW) + return { + "schema_version": version, "warnings": [], "observations": [], + "records": [{ + "snapshot": snap, "source_ids": ["local-fixture"], "transports": ["local"], + "provider_status": {}, "received_at": NOW.isoformat(), + }], + } + + +@pytest.mark.parametrize("version", BAD_VERSIONS) +def test_merge_rejects_invalid_version_without_mutating_inputs(version): + previous = envelope(version) + collected = {"configured_ids": ["local-fixture"], "records": [], "warnings": []} + originals = deepcopy((previous, collected)) + result = merge_snapshots(previous, collected, now=NOW) + assert result["schema_version"] == CACHE_VERSION + assert result["records"] == [] + assert result["warnings"] == [{"code": "unsupported_prior_cache_version"}] + assert (previous, collected) == originals + + +@pytest.mark.parametrize("version", BAD_VERSIONS) +def test_presentation_rejects_invalid_version(version): + previous = envelope(version) + original = deepcopy(previous) + assert presentation(previous, now=NOW) == { + "runs": [], "warnings": [{"code": "missing_or_invalid_model_run_cache"}], + } + assert previous == original + + +@pytest.mark.parametrize("previous", [{}, {"records": []}, [], "bad-envelope"]) +def test_missing_version_or_invalid_envelope_is_diagnostic(previous): + result = merge_snapshots(previous, {}, now=NOW) + assert {"code": "unsupported_prior_cache_version"} in result["warnings"] + assert result["records"] == [] + assert presentation(previous, now=NOW)["warnings"] == [ + {"code": "missing_or_invalid_model_run_cache"}, + ] + + +def test_no_previous_cache_is_a_valid_cold_start(): + assert merge_snapshots(None, {}, now=NOW)["warnings"] == [] + + +@pytest.mark.parametrize("version", ["kev_laya/raw/1", "kev_laya/raw/2"]) +def test_supported_versions_preserve_cached_values_and_unknowns(version): + previous = envelope(version) + original = deepcopy(previous) + result = merge_snapshots(previous, {"configured_ids": ["local-fixture"]}, now=NOW) + assert result["warnings"] == [] + assert result["records"][0]["snapshot"] == original["records"][0]["snapshot"] + direct = presentation(previous, now=NOW) + view = presentation(result, now=NOW) + for rendered in (direct, view): + assert rendered["warnings"] == [] + run = rendered["runs"][0] + assert run["run_id"] == "test-run" + assert run["progress"]["optimizer_steps"] == 7 + assert run["recoveries"] == {"total": 7, "infrastructure": None, "application": None} + assert run["cost"]["measured_usd"] is None + assert run["association"] == {"status": "local", "scheduler": None} + assert run["provider_status"]["skypilot"] is None + assert previous == original + + +@pytest.mark.parametrize("version", ["kev_laya/raw/1", "kev_laya/raw/2"]) +def test_scheduler_status_and_total_remain_authoritative(version): + previous = envelope(version) + previous["records"][0]["snapshot"]["scheduler"] = { + "provider": "skypilot", "namespace": "fixture-ns", "job_id": 42, + } + result = presentation(previous, [{ + "scheduler_namespace": "fixture-ns", "job_id": 42, + "status": "RUNNING", "recovery_count": 11, + }], now=NOW) + run = result["runs"][0] + assert run["provider_status"]["skypilot"] == "RUNNING" + assert run["recoveries"] == {"total": 11, "infrastructure": None, "application": None} + + +def test_invalid_prior_does_not_drop_fresh_valid_candidate(): + result = merge_snapshots({"schema_version": []}, { + "configured_ids": ["local-fixture"], "records": [{ + "source_id": "local-fixture", "transport": "local", "snapshot": snapshot(), + }], + }, now=NOW) + assert result["warnings"] == [{"code": "unsupported_prior_cache_version"}] + assert len(result["records"]) == 1 + assert result["records"][0]["snapshot"]["run_id"] == "test-run" diff --git a/tests/test_kev_laya_pipeline.py b/tests/test_kev_laya_pipeline.py new file mode 100644 index 0000000..d68b8bb --- /dev/null +++ b/tests/test_kev_laya_pipeline.py @@ -0,0 +1,78 @@ +"""Native Overwatch E2E gate: run only in its real supported environment. + +No reader/provider is replaced by a fake to obtain the initial report. The one +negative monkeypatch below is a trap proving cache-only rendering AFTER an actual +collector pass. Test caches/registries are always isolated from the running user. +""" +import argparse +import asyncio +import hashlib +import importlib +import json +import os +import sys +from pathlib import Path + +import pytest + + +def test_real_export_through_collector_cache_and_report(tmp_path, monkeypatch): + if sys.version_info < (3, 13, 12) or sys.version_info >= (3, 14): + pytest.skip('Overwatch requires Python >=3.13.12,<3.14; do not relax the native gate') + source = os.environ.get('KEV_LAYA_SNAPSHOT') + if not source: + pytest.skip('set KEV_LAYA_SNAPSHOT to a fresh real training export with checkpoint/evaluation artifacts') + from overwatch import cached_metrics, collector, raw_cache + from overwatch.kev_laya_contract import decode_snapshot + from overwatch.report_service import collect_report_from_raw_cache + original = Path(source).resolve() + raw = original.read_bytes() + snapshot = decode_snapshot(raw) + assert snapshot['schema_version'] == 2 + assert snapshot['progress']['optimizer_steps'] > 0 + assert snapshot['extensions']['execution']['max_batch_size'] > 1 + assert any(a['kind'] == 'checkpoint' for a in snapshot['artifacts']) + assert any(a['kind'] == 'evaluation' for a in snapshot['artifacts']) + # Copy, never remove or rewrite the evidence-producing trainer's original. + export = tmp_path / 'actual-export.json' + export.write_bytes(raw) + isolated = tmp_path / 'raw-v1' + monkeypatch.setenv('OVERWATCH_RAW_CACHE_ROOT', str(isolated)) + for module in (raw_cache, collector, cached_metrics): + monkeypatch.setattr(module, 'RAW_CACHE_ROOT', isolated) + registry = tmp_path / 'registry.json' + registry.write_text(json.dumps({'schema_version': 1, 'sources': [ + {'id': 'actual-training', 'transport': 'local', 'path': str(export)}]})) + monkeypatch.setenv('OVERWATCH_KEV_LAYA_REGISTRY', str(registry)) + manifest = asyncio.run(collector.collect_raw_metrics(collector.CollectorOptions(local_models_only=True))) + assert manifest['sources']['kev_laya']['status'] == 'ok' + assert manifest['sources']['kev_laya']['raw']['runs'] == 1 + assert all(manifest['sources'][k]['status'] == 'skipped' for k in ('sky_jobs', 'wandb', 'cloudwatch')) + cache = raw_cache.model_runs_cache_path() + assert cache.name == 'runs-v2.json' and cache.is_file() + args = argparse.Namespace(limit=20, entity=None, gcp_billing_table=None, no_log_enrichment=True, + zymtrace_project_id='00000000-0000-0000-0000-000000000000', local_models_only=True) + report = asyncio.run(collect_report_from_raw_cache(args, refresh_cache=False)) + assert report['resources'] == [] + run = report['model_runs'][0] + assert run['run_id'] == snapshot['run_id'] and run['verification'] == 'verified' + assert run['association']['status'] == 'local' and run['provider_status']['skypilot'] is None + assert run['progress']['optimizer_steps'] == snapshot['progress']['optimizer_steps'] + assert run['extensions']['execution'] == snapshot['extensions']['execution'] + # Model/report module reload stands in for a fresh reader process, retaining + # actual persisted bytes, not an in-memory adapter result. + importlib.reload(cached_metrics) + export.unlink() + def no_io(*args, **kwargs): + raise AssertionError('cache-only report unexpectedly contacted collector/export/provider') + monkeypatch.setattr(collector, 'collect_raw_metrics', no_io) + from overwatch.providers import kev_laya as provider + monkeypatch.setattr(provider, 'collect_snapshots', no_io) + after = asyncio.run(collect_report_from_raw_cache(args, refresh_cache=False)) + assert after['model_runs'] == report['model_runs'] or ( + after['model_runs'][0]['extensions'] == run['extensions'] and + after['model_runs'][0]['progress'] == run['progress']) # freshness age legitimately advances + assert hashlib.sha256(original.read_bytes()).hexdigest() == hashlib.sha256(raw).hexdigest() + (tmp_path / 'native-e2e-report.json').write_text(json.dumps({ + 'fresh_export_sha256': hashlib.sha256(raw).hexdigest(), 'report': after, + 'collector': manifest, 'cache_only_after_source_removed': True}, indent=2)) diff --git a/tests/test_kev_laya_wandb_response_guards.py b/tests/test_kev_laya_wandb_response_guards.py new file mode 100644 index 0000000..2a925ea --- /dev/null +++ b/tests/test_kev_laya_wandb_response_guards.py @@ -0,0 +1,303 @@ +"""Synthetic transport regressions; no live W&B, SDK, model, or UI qualification.""" +from __future__ import annotations + +import io +import json +import socket +from datetime import UTC, datetime +from urllib.error import URLError + +import pytest + +from overwatch.kev_laya_contract import validate_snapshot +from overwatch.providers import kev_laya as provider + + +@pytest.fixture(autouse=True) +def no_network(monkeypatch): + def forbidden(*args, **kwargs): + raise AssertionError('source regressions must not contact a network') + monkeypatch.setattr(socket.socket, 'connect', forbidden) + monkeypatch.setattr(socket.socket, 'connect_ex', forbidden) + monkeypatch.setattr(socket, 'create_connection', forbidden) + monkeypatch.setenv('WANDB_API_KEY', 'synthetic-source-test-placeholder') + monkeypatch.setenv('WANDB_BASE_URL', 'https://example.invalid') + + +def snapshot(run_id='run-1', sequence=1): + now = datetime.now(UTC).isoformat() + result = { + 'schema_version': 1, 'framework': 'kev_laya', 'framework_version': 'test', + 'experiment_id': 'synthetic-test', 'run_id': run_id, 'attempt_id': 'attempt-0', + 'attempt_index': 0, 'parent_attempt_id': None, 'sequence': sequence, + 'started_at': now, 'updated_at': now, 'heartbeat_at': now, 'phase': 'train', + 'scheduler': None, 'wandb': {'entity': 'test', 'project': 'test', 'run_id': run_id}, + 'progress': {'optimizer_steps': 1, 'microbatches': 1, 'examples': 1, + 'forward_tokens': 1, 'epoch': None, 'totals': {}, + 'elapsed_seconds': None, 'eta_seconds': None, 'tokens_per_second': None}, + 'metrics': {}, 'history': [], + 'provenance': {'model': 'synthetic', 'backbone': 'none', 'backbone_revision': 'none', + 'tokenizer': 'none', 'config_sha256': '0' * 64, 'data_sha256': '0' * 64, + 'split_hashes': {}, 'seed': 0, 'repository': None, 'commit': None, + 'precision': 'none', 'hardware': 'none', + 'context_limits': {'branch': 1, 'aggregate': 1}, 'evidence_class': 'fixture'}, + 'artifacts': [], + 'serving': {'requests': 0, 'errors': 0, 'input_tokens': 0, 'forward_tokens': 0, + 'output_tokens': 0, 'questions': 0, 'prefix_reuses': 0, 'latency_ms': []}, + 'resume': {'capable': False, 'checkpoint_sha256': None}, + 'recoveries': {'total': None, 'infrastructure': None, 'application': None}, + 'cost': {'measured_usd': None, 'estimated_usd': None, 'basis': None}, + 'monitoring_export_failures': 0, + } + return validate_snapshot(result) + + +def page(flag=False, *, cursor=None, snapshots=(), encoded_summary=False): + edges = [] + for item in snapshots: + summary = {'kev_laya/snapshot': item} + edges.append({'cursor': cursor, 'node': {'name': item['run_id'], 'state': 'running', + 'summaryMetrics': json.dumps(summary) if encoded_summary else summary}}) + return {'data': {'project': {'runs': {'edges': edges, + 'pageInfo': {'hasNextPage': flag, 'endCursor': cursor}}}}} + + +class RecordingBody(io.BytesIO): + def __init__(self, raw, headers=None): + super().__init__(raw) + self.headers = {} if headers is None else headers + self.read_sizes = [] + self.close_calls = 0 + + def read(self, size=-1): + self.read_sizes.append(size) + assert size >= 0, 'unbounded read' + return super().read(size) + + def close(self): + self.close_calls += 1 + super().close() + + +class Pages: + def __init__(self, pages, *, known_length=True): + self.raw = [json.dumps(item, allow_nan=False).encode() for item in pages] + self.bodies = [RecordingBody(raw) for raw in self.raw] + self.calls = [] + self.known_length = known_length + + def fetch_snapshot_page(self, **kwargs): + index = len(self.calls) + self.calls.append(kwargs) + assert index < len(self.bodies), 'unexpected extra provider request' + return {'Body': self.bodies[index], + 'ContentLength': len(self.raw[index]) if self.known_length else None} + + +def collect(tmp_path, pages, *, limits=None, source_limit=8): + registry = tmp_path / 'registry.json' + registry.write_text(json.dumps({'schema_version': 1, 'sources': [ + {'id': 'registered-test', 'transport': 'wandb', 'entity': 'test', + 'project': 'test', 'limit': source_limit}]}), encoding='utf-8') + return provider.collect_snapshots(registry, wandb_api=pages, limits=limits) + + +def assert_invalid(result, pages, *, retained=()): + assert result['complete'] is False + assert result['registry_complete'] is True # An invalid response is not revocation. + assert result['configured_ids'] == ['registered-test'] + assert result['sources'][0]['status'] == 'error' + assert result['sources'][0]['refreshed_at'] is None + assert [row['snapshot']['run_id'] for row in result['records']] == list(retained) + assert result['warnings'] == [{'source_id': 'registered-test', + 'code': 'source_unavailable_or_invalid', 'error_type': 'ValueError'}] + assert result['accounting']['payload_bytes'] == sum(len(raw) for raw in pages.raw[:len(pages.calls)]) + assert result['accounting']['requests'] == len(pages.calls) + assert result['accounting']['pages'] == len(pages.calls) + for body in pages.bodies[:len(pages.calls)]: + assert body.closed and body.close_calls == 1 + assert 'synthetic-source-test-placeholder' not in json.dumps(result) + + +@pytest.mark.parametrize('flag', [None, 0, 1, -1, 0.0, 1.0, '', 'false', 'true', [], {}, [False]]) +@pytest.mark.parametrize('populated', [False, True]) +def test_non_boolean_page_completion_is_never_success(tmp_path, flag, populated): + pages = Pages([page(flag, cursor='next', snapshots=[snapshot()] if populated else [])]) + result = collect(tmp_path, pages) + assert len(pages.calls) == 1 + assert_invalid(result, pages) + + +@pytest.mark.parametrize('metadata', [None, [], '', {}, {'endCursor': None}]) +def test_invalid_page_info_rejected_before_snapshot_acceptance(tmp_path, metadata): + response = page(snapshots=[snapshot()]) + response['data']['project']['runs']['pageInfo'] = metadata + pages = Pages([response]) + assert_invalid(collect(tmp_path, pages), pages) + + +@pytest.mark.parametrize('cursor', [None, '', 1, False, [], {}]) +def test_invalid_continuation_rejected_before_snapshot_acceptance(tmp_path, cursor): + pages = Pages([page(True, cursor=cursor, snapshots=[snapshot()])]) + assert_invalid(collect(tmp_path, pages), pages) + + +def test_repeated_cursor_rejects_current_page_but_retains_valid_previous_page(tmp_path): + first = snapshot('run-1') + pages = Pages([page(True, cursor='same', snapshots=[first]), + page(True, cursor='same', snapshots=[snapshot('run-2')])]) + result = collect(tmp_path, pages) + assert_invalid(result, pages, retained=['run-1']) + assert result['records'][0]['snapshot'] == first + assert [call['cursor'] for call in pages.calls] == [None, 'same'] + + +def test_bad_later_page_does_not_discard_prior_records_or_refresh_source(tmp_path): + first = snapshot('run-1') + pages = Pages([page(True, cursor='next', snapshots=[first]), + page(None, snapshots=[snapshot('run-2')])]) + result = collect(tmp_path, pages) + assert_invalid(result, pages, retained=['run-1']) + assert result['records'][0]['snapshot'] == first + + +@pytest.mark.parametrize('populated', [False, True]) +@pytest.mark.parametrize('encoded_summary', [False, True]) +@pytest.mark.parametrize('known_length', [False, True]) +def test_valid_final_pages_remain_successful(tmp_path, populated, encoded_summary, known_length): + item = snapshot() + pages = Pages([page(False, snapshots=[item] if populated else [], + encoded_summary=encoded_summary)], known_length=known_length) + result = collect(tmp_path, pages) + assert result['complete'] is True and result['warnings'] == [] + assert result['sources'][0]['refreshed_at'] is not None + assert len(result['records']) == int(populated) + if populated: + assert result['records'][0]['snapshot'] == item + assert result['records'][0]['provider_status'] == 'running' + assert result['accounting']['payload_bytes'] == len(pages.raw[0]) + assert pages.bodies[0].closed and pages.bodies[0].close_calls == 1 + + +def test_valid_pagination_keeps_explicit_request_and_payload_accounting(tmp_path): + pages = Pages([page(True, cursor='next', snapshots=[snapshot('run-1')]), + page(False, snapshots=[snapshot('run-2')])]) + result = collect(tmp_path, pages) + assert result['complete'] and len(result['records']) == 2 + assert result['accounting']['payload_bytes'] == sum(map(len, pages.raw)) + assert result['accounting']['requests'] == result['accounting']['pages'] == 2 + assert [call['cursor'] for call in pages.calls] == [None, 'next'] + assert all(0 < call['timeout'] <= 3 for call in pages.calls) + assert all(body.closed and body.close_calls == 1 for body in pages.bodies) + + +def test_source_listing_limit_stays_partial(tmp_path): + pages = Pages([page(True, cursor='next', snapshots=[snapshot()])]) + result = collect(tmp_path, pages, source_limit=1) + assert not result['complete'] and len(result['records']) == 1 + assert result['sources'][0]['status'] == 'partial_limit' + assert result['sources'][0]['refreshed_at'] is None + assert len(pages.calls) == 1 + + +@pytest.mark.parametrize('limits,reason', [ + (provider.CollectionLimits(requests=1), 'request_budget'), + (provider.CollectionLimits(pages=1), 'page_budget'), +]) +def test_budget_stop_preserves_previous_valid_page(tmp_path, limits, reason): + pages = Pages([page(True, cursor='next', snapshots=[snapshot()])]) + result = collect(tmp_path, pages, limits=limits) + assert not result['complete'] and len(result['records']) == 1 + assert result['sources'][0]['status'] == 'partial_' + reason + assert result['sources'][0]['refreshed_at'] is None + assert result['accounting']['stop_reason'] == reason + assert len(pages.calls) == 1 and pages.bodies[0].closed + + +def test_short_payload_budget_is_not_refreshed(tmp_path): + pages = Pages([page(False)]) + result = collect(tmp_path, pages, limits=provider.CollectionLimits(payload_bytes=20)) + assert not result['complete'] and result['records'] == [] + assert result['sources'][0]['refreshed_at'] is None + assert result['accounting']['payload_bytes'] <= 20 + assert pages.bodies[0].closed + + +def test_identity_mismatch_still_fails(tmp_path): + response = page(snapshots=[snapshot()]) + response['data']['project']['runs']['edges'][0]['node']['name'] = 'other-run' + pages = Pages([response]) + assert_invalid(collect(tmp_path, pages), pages) + + +@pytest.mark.parametrize('errors', [[{'message': 'synthetic remote failure'}], ['failure']]) +def test_graphql_error_stays_non_success_and_secret_safe(tmp_path, errors): + response = page(snapshots=[snapshot()]) + response['errors'] = errors + pages = Pages([response]) + result = collect(tmp_path, pages) + assert_invalid(result, pages) + assert 'synthetic remote failure' not in json.dumps(result) + + +class Opener: + def __init__(self, response): + self.response = response + self.calls = [] + + def open(self, request, *, timeout): + self.calls.append((request, timeout)) + assert request.full_url == 'https://example.invalid/graphql' + return self.response + + +def fetch_page(monkeypatch, response): + opener = Opener(response) + monkeypatch.setattr(provider, 'build_opener', lambda *handlers: opener) + result = provider.WandbPages().fetch_snapshot_page(entity='test', project='test', + cursor=None, first=1, timeout=1) + assert len(opener.calls) == 1 + return result + + +@pytest.mark.parametrize('length', ['', 'NaN', '1.5', 'not-a-length', '0x10', [], {}]) +def test_invalid_content_length_closes_unread_response(monkeypatch, length): + response = RecordingBody(b'never-read', {'Content-Length': length}) + with pytest.raises((ValueError, TypeError)): + fetch_page(monkeypatch, response) + assert response.closed and response.close_calls == 1 + assert response.read_sizes == [] + + +@pytest.mark.parametrize('exception', [ValueError('bad headers'), KeyboardInterrupt()]) +def test_header_extraction_failure_closes_response(monkeypatch, exception): + class BrokenHeaders: + def get(self, name): + raise exception + response = RecordingBody(b'never-read', BrokenHeaders()) + with pytest.raises(type(exception)): + fetch_page(monkeypatch, response) + assert response.closed and response.close_calls == 1 + assert response.read_sizes == [] + + +@pytest.mark.parametrize('length,expected', [(None, None), ('0', 0), ('123', 123)]) +def test_valid_header_transfers_body_ownership_without_reading(monkeypatch, length, expected): + response = RecordingBody(b'not-read', {'Content-Length': length}) + result = fetch_page(monkeypatch, response) + assert result == {'Body': response, 'ContentLength': expected} + assert not response.closed and response.read_sizes == [] + response.close() + + +def test_request_failure_is_not_retried(monkeypatch): + calls = [] + class FailedOpener: + def open(self, request, *, timeout): + calls.append(request.full_url) + raise URLError('synthetic request failure') + monkeypatch.setattr(provider, 'build_opener', lambda *handlers: FailedOpener()) + with pytest.raises(URLError): + provider.WandbPages().fetch_snapshot_page(entity='test', project='test', + cursor=None, first=1, timeout=1) + assert calls == ['https://example.invalid/graphql']